@joclaim/browser-extension-sdk 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/JoclaimExtensionSDK-mv2.bundle.js +2 -2
- package/build/JoclaimExtensionSDK-mv2.bundle.js.map +1 -1
- package/build/JoclaimExtensionSDK.bundle.js +2 -2
- package/build/JoclaimExtensionSDK.bundle.js.map +1 -1
- package/build/offscreen/offscreen.bundle.js +2 -2
- package/build/offscreen/offscreen.bundle.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
const n=r(526),o=r(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=c,t.IS=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return f(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|g(e,t);let n=a(r);const o=n.write(e,t);o!==r&&(n=n.slice(0,o));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(W(e,Uint8Array)){const t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(W(e,ArrayBuffer)||e&&W(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(W(e,SharedArrayBuffer)||e&&W(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);const o=function(e){if(c.isBuffer(e)){const t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||J(e.length)?a(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function f(e){return l(e),a(e<0?0:0|p(e))}function h(e){const t=e.length<0?0:0|p(e.length),r=a(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function d(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,c.prototype),n}function p(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||W(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Y(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(e).length;default:if(o)return n?-1:Y(e).length;t=(""+t).toLowerCase(),o=!0}}function y(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,r);case"utf8":case"utf-8":return R(this,t,r);case"ascii":return _(this,t,r);case"latin1":case"binary":return N(this,t,r);case"base64":return w(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function E(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,o){let i,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){let n=-1;for(i=r;i<a;i++)if(u(e,i)===u(t,-1===n?0:i-n)){if(-1===n&&(n=i),i-n+1===c)return n*s}else-1!==n&&(i-=i-n),n=-1}else for(r+c>a&&(r=a-c),i=r;i>=0;i--){let r=!0;for(let n=0;n<c;n++)if(u(e,i+n)!==u(t,n)){r=!1;break}if(r)return i}return-1}function v(e,t,r,n){r=Number(r)||0;const o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;const i=t.length;let s;for(n>i/2&&(n=i/2),s=0;s<n;++s){const n=parseInt(t.substr(2*s,2),16);if(J(n))return s;e[r+s]=n}return s}function O(e,t,r,n){return z(Y(t,e.length-r),e,r,n)}function I(e,t,r,n){return z(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function A(e,t,r,n){return z(q(t),e,r,n)}function S(e,t,r,n){return z(function(e,t){let r,n,o;const i=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function w(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function R(e,t,r){r=Math.min(e.length,r);const n=[];let o=t;for(;o<r;){const t=e[o];let i=null,s=t>239?4:t>223?3:t>191?2:1;if(o+s<=r){let r,n,a,c;switch(s){case 1:t<128&&(i=t);break;case 2:r=e[o+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(i=c));break;case 3:r=e[o+1],n=e[o+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:r=e[o+1],n=e[o+2],a=e[o+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|1023&i),n.push(i),o+=s}return function(e){const t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=T));return r}(n)}c.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,r){return function(e,t,r){return l(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},c.allocUnsafe=function(e){return f(e)},c.allocUnsafeSlow=function(e){return f(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(W(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),W(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=c.allocUnsafe(t);let o=0;for(r=0;r<e.length;++r){let t=e[r];if(W(t,Uint8Array))o+t.length>n.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(n,o)):Uint8Array.prototype.set.call(n,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,o)}o+=t.length}return n},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)m(this,t,t+1);return this},c.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},c.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?R(this,0,e):y.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){let e="";const r=t.IS;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,o){if(W(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;let i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0);const a=Math.min(i,s),u=this.slice(n,o),l=e.slice(t,r);for(let e=0;e<a;++e)if(u[e]!==l[e]){i=u[e],s=l[e];break}return i<s?-1:s<i?1:0},c.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},c.prototype.indexOf=function(e,t,r){return E(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return E(this,e,t,r,!1)},c.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let i=!1;for(;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return O(this,e,t,r);case"ascii":case"latin1":case"binary":return I(this,e,t,r);case"base64":return A(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const T=4096;function _(e,t,r){let n="";r=Math.min(e.length,r);for(let o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function N(e,t,r){let n="";r=Math.min(e.length,r);for(let o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function C(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let o="";for(let n=t;n<r;++n)o+=X[e[n]];return o}function P(e,t,r){const n=e.slice(t,r);let o="";for(let e=0;e<n.length-1;e+=2)o+=String.fromCharCode(n[e]+256*n[e+1]);return o}function L(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,r,n,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function U(e,t,r,n,o){K(t,n,o,e,r,7);let i=Number(t&BigInt(4294967295));e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function x(e,t,r,n,o){K(t,n,o,e,r,7);let i=Number(t&BigInt(4294967295));e[r+7]=i,i>>=8,e[r+6]=i,i>>=8,e[r+5]=i,i>>=8,e[r+4]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function G(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function F(e,t,r,n,i){return t=+t,r>>>=0,i||G(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function k(e,t,r,n,i){return t=+t,r>>>=0,i||G(e,0,r,8),o.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,c.prototype),n},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=this[e],o=1,i=0;for(;++i<t&&(o*=256);)n+=this[e+i]*o;return n},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=this[e+--t],o=1;for(;t>0&&(o*=256);)n+=this[e+--t]*o;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q(function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))}),c.prototype.readBigUInt64BE=Q(function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(o)}),c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=this[e],o=1,i=0;for(;++i<t&&(o*=256);)n+=this[e+i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=t,o=1,i=this[e+--n];for(;n>0&&(o*=256);)i+=this[e+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q(function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)}),c.prototype.readBigInt64BE=Q(function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)}),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){D(this,e,t,r,Math.pow(2,8*r)-1,0)}let o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){D(this,e,t,r,Math.pow(2,8*r)-1,0)}let o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q(function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Q(function(e,t=0){return x(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);D(this,e,t,r,n-1,-n)}let o=0,i=1,s=0;for(this[t]=255&e;++o<r&&(i*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/i|0)-s&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);D(this,e,t,r,n-1,-n)}let o=r-1,i=1,s=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/i|0)-s&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q(function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Q(function(e,t=0){return x(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(e,t,r){return F(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return F(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return k(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return k(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);const o=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),o},c.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!c.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{const i=c.isBuffer(e)?e:c.from(e,n),s=i.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=i[o%s]}return this};const B={};function M(e,t,r){B[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function j(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function K(e,t,r,n,o,i){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let o;throw o=i>3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(i+1)}${n}`:`>= -(2${n} ** ${8*(i+1)-1}${n}) and < 2 ** ${8*(i+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new B.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,r){V(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||$(t,e.length-(r+1))}(n,o,i)}function V(e,t){if("number"!=typeof e)throw new B.ERR_INVALID_ARG_TYPE(t,"number",e)}function $(e,t,r){if(Math.floor(e)!==e)throw V(e,r),new B.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new B.ERR_BUFFER_OUT_OF_BOUNDS;throw new B.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}M("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),M("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),M("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=j(String(r)):"bigint"==typeof r&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=j(o)),o+="n"),n+=` It must be ${t}. Received ${o}`,n},RangeError);const H=/[^+/0-9A-Za-z-_]/g;function Y(e,t){let r;t=t||1/0;const n=e.length;let o=null;const i=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,r,n){let o;for(o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function W(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const X=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let o=0;o<16;++o)t[n+o]=e[r]+e[o]}return t}();function Q(e){return"undefined"==typeof BigInt?Z:e}function Z(){throw new Error("BigInt not supported")}},251(e,t){
|
|
9
9
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
10
|
-
t.read=function(e,t,r,n,o){var i,s,a=8*o-n-1,c=(1<<a)-1,u=c>>1,l=-7,f=r?o-1:0,h=r?-1:1,d=e[t+f];for(f+=h,i=d&(1<<-l)-1,d>>=-l,l+=a;l>0;i=256*i+e[t+f],f+=h,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=n;l>0;s=256*s+e[t+f],f+=h,l-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),i-=u}return(d?-1:1)*s*Math.pow(2,i-n)},t.write=function(e,t,r,n,o,i){var s,a,c,u=8*i-o-1,l=(1<<u)-1,f=l>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+f>=1?h/c:h*Math.pow(2,1-f))*c>=2&&(s++,c/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*c-1)*Math.pow(2,o),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,o),s=0));o>=8;e[r+d]=255&a,d+=p,a/=256,o-=8);for(s=s<<o|a,u+=o;u>0;e[r+d]=255&s,d+=p,s/=256,u-=8);e[r+d-p]|=128*g}},606(e){var t,r,n=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var a,c=[],u=!1,l=-1;function f(){u&&a&&(u=!1,a.length?c=a.concat(c):l=-1,c.length&&h())}function h(){if(!u){var e=s(f);u=!0;for(var t=c.length;t;){for(a=c,c=[];++l<t;)a&&a[l].run();l=-1,t=c.length}a=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function p(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new d(e,t)),1!==c.length||u||s(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},455(e,t,r){"use strict";r.d(t,{A:()=>wt});var n={};r.r(n),r.d(n,{cancelSession:()=>Ve,failSession:()=>Be,startVerification:()=>Fe,submitProofs:()=>je});r(997);var o=r(952),i=r(770),s=r(859);function a(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var a=n&&n.prototype instanceof u?n:u,l=Object.create(a.prototype);return c(l,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),l}var s={};function u(){}function l(){}function f(){}t=Object.getPrototypeOf;var h=[][n]?t(t([][n]())):(c(t={},n,function(){return this}),t),d=f.prototype=u.prototype=Object.create(h);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,c(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=f,c(d,"constructor",f),c(f,"constructor",l),l.displayName="GeneratorFunction",c(f,o,"GeneratorFunction"),c(d),c(d,o,"Generator"),c(d,n,function(){return this}),c(d,"toString",function(){return"[object Generator]"}),(a=function(){return{w:i,m:p}})()}function c(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}c=function(e,t,r,n){function i(t,r){c(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},c(e,t,r,n)}function u(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function l(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){u(i,n,o,s,a,"next",e)}function a(e){u(i,n,o,s,a,"throw",e)}s(void 0)})}}var f=function(){var e=l(a().m(function e(t,r,n){var c,u,l,f;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:return c=(0,i.y8)({sessionId:r||"unknown",providerId:t||"unknown",appId:n||"unknown",source:"reclaim-extension-sdk",type:s.LOG_TYPES.FETCH_DATA}),e.p=1,e.n=2,fetch("".concat(o.Sn.PROVIDER_URL(t)));case 2:if((u=e.v).ok){e.n=3;break}throw new Error("Failed to fetch provider data");case 3:return c.info({message:"Successfully fetched provider data from the backend: "+JSON.stringify(u),logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.FETCH_DATA}),e.n=4,u.json();case 4:return l=e.v,e.a(2,null==l?void 0:l.providers);case 5:throw e.p=5,f=e.v,c.error({message:"Error fetching provider data: "+f.toString(),logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.FETCH_DATA,eventType:s.EVENT_TYPES.RECLAIM_PROVIDER_DATA_FETCH_ERROR}),f;case 6:return e.a(2)}},e,null,[[1,5]])}));return function(t,r,n){return e.apply(this,arguments)}}(),h=function(){var e=l(a().m(function e(t,r,n,c){var u,l,f,h;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:return u=(0,i.y8)({sessionId:t||"unknown",providerId:n||"unknown",appId:c||"unknown",source:"reclaim-extension-sdk",type:s.LOG_TYPES.FETCH_DATA}),e.p=1,e.n=2,fetch("".concat(o.Sn.UPDATE_SESSION_STATUS()),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:t,status:r})});case 2:if((l=e.v).ok){e.n=3;break}throw new Error("Failed to update session status");case 3:return u.info({message:"Successfully updated session status: "+r,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.FETCH_DATA}),e.n=4,l.json();case 4:return f=e.v,e.a(2,f);case 5:throw e.p=5,h=e.v,u.error({message:"Error updating session status: "+h.toString(),logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.FETCH_DATA,eventType:s.EVENT_TYPES.UPDATE_SESSION_STATUS_ERROR}),h;case 6:return e.a(2)}},e,null,[[1,5]])}));return function(t,r,n,o){return e.apply(this,arguments)}}(),d=function(){var e=l(a().m(function e(t,r,n,c,u){var l,f,d,p,g,y;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:return l=(0,i.y8)({sessionId:n||"unknown",providerId:c||"unknown",appId:u||"unknown",source:"reclaim-extension-sdk",type:s.LOG_TYPES.FETCH_DATA}),e.p=1,f=JSON.stringify(t),d=encodeURIComponent(f),e.n=2,fetch(r,{method:"POST",headers:{"Content-Type":"text/plain"},body:d});case 2:return p=e.v,e.n=3,p.text();case 3:if(g=e.v,p.ok){e.n=5;break}return e.n=4,h(n,o.Ew.PROOF_SUBMISSION_FAILED);case 4:throw new Error("Failed to submit proof to Callback and update session status");case 5:return l.info({message:"Successfully submitted proof to Callback and updated session status",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.FETCH_DATA,eventType:s.EVENT_TYPES.SUBMITTING_PROOF_TO_CALLBACK_URL_SUCCESS}),e.n=6,h(n,o.Ew.PROOF_SUBMITTED);case 6:return e.a(2,g);case 7:throw e.p=7,y=e.v,l.error({message:"Error submitting proof to Callback: "+y.toString(),logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.FETCH_DATA}),y;case 8:return e.a(2)}},e,null,[[1,7]])}));return function(t,r,n,o,i){return e.apply(this,arguments)}}();function p(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return g(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(g(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,g(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,g(f,"constructor",u),g(u,"constructor",c),c.displayName="GeneratorFunction",g(u,o,"GeneratorFunction"),g(f),g(f,o,"Generator"),g(f,n,function(){return this}),g(f,"toString",function(){return"[object Generator]"}),(p=function(){return{w:i,m:h}})()}function g(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}g=function(e,t,r,n){function i(t,r){g(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},g(e,t,r,n)}function y(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function m(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){y(i,n,o,s,a,"next",e)}function a(e){y(i,n,o,s,a,"throw",e)}s(void 0)})}}var E=(0,i.y8)({sessionId:"unknown",providerId:"unknown",appId:"unknown",source:"reclaim-extension-sdk",type:s.LOG_TYPES.OFFSCREEN}),b=!1,v=null,O=null,I=function(e){(null==e?void 0:e.action)===o.wx.OFFSCREEN_DOCUMENT_READY&&(null==e?void 0:e.source)===o.J_.OFFSCREEN&&(null==e?void 0:e.target)===o.J_.BACKGROUND&&(E.info({message:"[OFFSCREEN-MANAGER] Received offscreen ready signal (global listener).",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),b=!0,v&&(clearTimeout(v),v=null))},A=function(){"undefined"!=typeof chrome&&chrome.runtime&&chrome.runtime.onMessage&&chrome.runtime.onMessage.addListener&&chrome.runtime.onMessage.hasListener&&(chrome.runtime.onMessage.hasListener(I)||chrome.runtime.onMessage.addListener(I))};function S(){return w.apply(this,arguments)}function w(){return(w=m(p().m(function e(){var t,r;return p().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=chrome.runtime.getURL("joclaim-browser-extension-sdk/offscreen/offscreen.html"),E.info({message:"[OFFSCREEN-MANAGER] Attempting to create offscreen document with URL:",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN,meta:{offscreenUrl:t}}),e.p=1,e.n=2,chrome.offscreen.createDocument({url:t,reasons:["DOM_PARSER","IFRAME_SCRIPTING","BLOBS"],justification:"Manages DOM-dependent operations like crypto and ZK proof generation for the extension."});case 2:e.n=5;break;case 3:if(e.p=3,!(r=e.v).message||!r.message.includes("Only a single offscreen document may be created.")){e.n=4;break}E.info({message:"[OFFSCREEN-MANAGER] Offscreen document already exists or creation was attempted by another part.",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),e.n=5;break;case 4:throw E.error({message:"[OFFSCREEN-MANAGER] Error creating offscreen document:",logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.OFFSCREEN,meta:{error:r}}),r;case 5:return e.a(2)}},e,null,[[1,3]])}))).apply(this,arguments)}function R(){return T.apply(this,arguments)}function T(){return T=m(p().m(function e(){var t,r=arguments;return p().w(function(e){for(;;)switch(e.n){case 0:if(t=r.length>0&&void 0!==r[0]?r[0]:15e3,!b){e.n=1;break}return E.info({message:"[OFFSCREEN-MANAGER] Already ready (waitForOffscreenReadyInternal check)",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),e.a(2,!0);case 1:E.info({message:"[OFFSCREEN-MANAGER] Waiting for offscreen document to be ready (timeout:- ${timeoutMs}ms)...",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN,meta:{timeoutMs:t}});try{chrome.runtime.sendMessage({action:o.wx.PING_OFFSCREEN,source:o.J_.BACKGROUND,target:o.J_.OFFSCREEN})}catch(e){E.info({message:"[OFFSCREEN-MANAGER] Synchronous error sending ping:"+(null==e?void 0:e.message),logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN,meta:{error:e}})}return e.a(2,new Promise(function(e){if(b)return E.info({message:"[OFFSCREEN-MANAGER] Became ready while setting up promise.",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),void e(!0);var r=function(t){t.action===o.wx.OFFSCREEN_DOCUMENT_READY&&t.source===o.J_.OFFSCREEN&&t.target===o.J_.BACKGROUND&&(b=!0,clearTimeout(n),chrome.runtime.onMessage.removeListener(r),v===n&&(v=null),e(!0))};chrome.runtime.onMessage.addListener(r),v&&clearTimeout(v);var n=setTimeout(function(){chrome.runtime.onMessage.removeListener(r),E.error({message:"[OFFSCREEN-MANAGER] Timed out waiting for offscreen document after "+t+" ms.",logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.OFFSCREEN,meta:{timeoutMs:t}}),v===n&&(v=null),e(!1)},t);v=n}))}},e)})),T.apply(this,arguments)}function _(e){return N.apply(this,arguments)}function N(){return N=m(p().m(function e(t){return p().w(function(e){for(;;)switch(e.n){case 0:if(!b){e.n=1;break}return t.info({message:"[OFFSCREEN-MANAGER] Document already confirmed ready.",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),e.a(2,!0);case 1:if(!O){e.n=2;break}return t.info({message:"[OFFSCREEN-MANAGER] Creation already in progress, awaiting...",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),e.n=2,O;case 2:if(!chrome.runtime.getContexts){e.n=6;break}return e.n=3,chrome.runtime.getContexts({contextTypes:["OFFSCREEN_DOCUMENT"]});case 3:if(!(e.v.length>0)){e.n=6;break}if(t.info({message:"[OFFSCREEN-MANAGER] Offscreen document context found.",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),!b){e.n=4;break}return e.a(2,!0);case 4:return t.info({message:"[OFFSCREEN-MANAGER] Context exists, but not marked ready. Waiting for signal...",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),e.n=5,R(5e3);case 5:return e.a(2,e.v);case 6:if(O){e.n=7;break}return t.info({message:"[OFFSCREEN-MANAGER] No existing context/promise, initiating creation.",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),O=S().finally(function(){O=null}),e.n=7,O;case 7:return e.n=8,R(5e4);case 8:if(e.v){e.n=9;break}throw new Error("Failed to initialize or confirm offscreen document readiness.");case 9:return t.info({message:"[OFFSCREEN-MANAGER] Offscreen document ensured to be ready.",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),e.a(2,!0)}},e)})),N.apply(this,arguments)}function C(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return P(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(P(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,P(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,P(f,"constructor",u),P(u,"constructor",c),c.displayName="GeneratorFunction",P(u,o,"GeneratorFunction"),P(f),P(f,o,"Generator"),P(f,n,function(){return this}),P(f,"toString",function(){return"[object Generator]"}),(C=function(){return{w:i,m:h}})()}function P(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}P=function(e,t,r,n){function i(t,r){P(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},P(e,t,r,n)}function L(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}"undefined"!=typeof chrome&&chrome.runtime&&chrome.runtime.onMessage&&A(),A();var D=function(){var e,t=(e=C().m(function e(t,r){var n,i;return C().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=r,e.p=1,n.setContext({sessionId:t.sessionId||"unknown",providerId:t.providerId||"unknown",appId:t.applicationId||"unknown"}),t){e.n=2;break}throw n.error({message:"[PROOF-GENERATOR] No claim data provided for proof generation",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.PROOF}),new Error("No claim data provided for proof generation");case 2:return e.n=3,_(n);case 3:return e.a(2,new Promise(function(e,r){var i=setTimeout(function(){n.error({message:"[PROOF-GENERATOR] Timeout waiting for offscreen document to generate proof",logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.PROOF}),r({success:!1,error:"Timeout waiting for offscreen document to generate proof"})},6e4),a=function(t){if(t.action===o.wx.GENERATE_PROOF_RESPONSE&&t.source===o.J_.OFFSCREEN&&t.target===o.J_.BACKGROUND){var r,c;if(clearTimeout(i),chrome.runtime.onMessage.removeListener(a),n.all({message:"[PROOF-GENERATOR] Offscreen response: "+JSON.stringify(t),logLevel:s.LOG_LEVEL.ALL,type:s.LOG_TYPES.PROOF,meta:{response:t}}),!t.success)return n.error({message:"[PROOF-GENERATOR] Proof generation failed:",logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.PROOF,meta:{error:t.error}}),void e({success:!1,error:t.error||"Unknown error in proof generation"});var u=(null==t||null===(r=t.proof)||void 0===r||null===(r=r.error)||void 0===r?void 0:r.message)||("string"==typeof(null==t||null===(c=t.proof)||void 0===c?void 0:c.error)?t.proof.error:null);if(u)return n.error({message:"[PROOF-GENERATOR] Proof contains embedded error: "+u,logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.PROOF,meta:{error:u}}),void e({success:!1,error:u});n.info({message:"[PROOF-GENERATOR] Proof generation successful",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.PROOF}),e(t)}};chrome.runtime.onMessage.addListener(a),chrome.runtime.sendMessage({action:o.wx.GENERATE_PROOF,source:o.J_.BACKGROUND,target:o.J_.OFFSCREEN,data:t},function(){chrome.runtime.lastError&&(clearTimeout(i),chrome.runtime.onMessage.removeListener(a),n.error({message:"[PROOF-GENERATOR] Error sending message to offscreen document "+chrome.runtime.lastError.message,logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.PROOF,meta:{error:chrome.runtime.lastError.message}}),r({success:!1,error:chrome.runtime.lastError.message||"Error communicating with offscreen document"}))})}));case 4:return e.p=4,i=e.v,n.error({message:"[PROOF-GENERATOR] Error in proof generation process: "+i.message,logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.PROOF,meta:{error:i}}),e.a(2,{success:!1,error:i.message||"Unknown error in proof generation process"})}},e,null,[[1,4]])}),function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){L(i,n,o,s,a,"next",e)}function a(e){L(i,n,o,s,a,"throw",e)}s(void 0)})});return function(e,r){return t.apply(this,arguments)}}(),U=r(573),x=r(153);class G{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+G.version}static addUnaryOp(e){return G.max_unop_len=Math.max(e.length,G.max_unop_len),G.unary_ops[e]=1,G}static addBinaryOp(e,t,r){return G.max_binop_len=Math.max(e.length,G.max_binop_len),G.binary_ops[e]=t,r?G.right_associative.add(e):G.right_associative.delete(e),G}static addIdentifierChar(e){return G.additional_identifier_chars.add(e),G}static addLiteral(e,t){return G.literals[e]=t,G}static removeUnaryOp(e){return delete G.unary_ops[e],e.length===G.max_unop_len&&(G.max_unop_len=G.getMaxKeyLen(G.unary_ops)),G}static removeAllUnaryOps(){return G.unary_ops={},G.max_unop_len=0,G}static removeIdentifierChar(e){return G.additional_identifier_chars.delete(e),G}static removeBinaryOp(e){return delete G.binary_ops[e],e.length===G.max_binop_len&&(G.max_binop_len=G.getMaxKeyLen(G.binary_ops)),G.right_associative.delete(e),G}static removeAllBinaryOps(){return G.binary_ops={},G.max_binop_len=0,G}static removeLiteral(e){return delete G.literals[e],G}static removeAllLiterals(){return G.literals={},G}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new G(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(e=>e.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return G.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!G.binary_ops[String.fromCharCode(e)]||G.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return G.isIdentifierStart(e)||G.isDecimalDigit(e)}throwError(e){const t=new Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(G.hooks[e]){const r={context:this,node:t};return G.hooks.run(e,r),r.node}return t}searchHook(e){if(G.hooks[e]){const t={context:this};return G.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===G.SPACE_CODE||e===G.TAB_CODE||e===G.LF_CODE||e===G.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:G.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t,r,n=[];for(;this.index<this.expr.length;)if(t=this.code,t===G.SEMCOL_CODE||t===G.COMMA_CODE)this.index++;else if(r=this.gobbleExpression())n.push(r);else if(this.index<this.expr.length){if(t===e)break;this.throwError('Unexpected "'+this.char+'"')}return n}gobbleExpression(){const e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,G.max_binop_len),t=e.length;for(;t>0;){if(G.binary_ops.hasOwnProperty(e)&&(!G.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!G.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,r,n,o,i,s,a,c;if(i=this.gobbleToken(),!i)return i;if(t=this.gobbleBinaryOp(),!t)return i;for(o={value:t,prec:G.binaryPrecedence(t),right_a:G.right_associative.has(t)},s=this.gobbleToken(),s||this.throwError("Expected expression after "+t),n=[i,o,s];t=this.gobbleBinaryOp();){if(r=G.binaryPrecedence(t),0===r){this.index-=t.length;break}o={value:t,prec:r,right_a:G.right_associative.has(t)},c=t;const a=e=>o.right_a&&e.right_a?r>e.prec:r<=e.prec;for(;n.length>2&&a(n[n.length-2]);)s=n.pop(),t=n.pop().value,i=n.pop(),e={type:G.BINARY_EXP,operator:t,left:i,right:s},n.push(e);e=this.gobbleToken(),e||this.throwError("Expected expression after "+c),n.push(o,e)}for(a=n.length-1,e=n[a];a>1;)e={type:G.BINARY_EXP,operator:n[a-1].value,left:n[a-2],right:e},a-=2;return e}gobbleToken(){let e,t,r,n;if(this.gobbleSpaces(),n=this.searchHook("gobble-token"),n)return this.runHook("after-token",n);if(e=this.code,G.isDecimalDigit(e)||e===G.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===G.SQUOTE_CODE||e===G.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(e===G.OBRACK_CODE)n=this.gobbleArray();else{for(t=this.expr.substr(this.index,G.max_unop_len),r=t.length;r>0;){if(G.unary_ops.hasOwnProperty(t)&&(!G.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!G.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=r;const e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:G.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--r)}G.isIdentifierStart(e)?(n=this.gobbleIdentifier(),G.literals.hasOwnProperty(n.name)?n={type:G.LITERAL,value:G.literals[n.name],raw:n.name}:n.name===G.this_str&&(n={type:G.THIS_EXP})):e===G.OPAREN_CODE&&(n=this.gobbleGroup())}return n?(n=this.gobbleTokenProperty(n),this.runHook("after-token",n)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===G.PERIOD_CODE||t===G.OBRACK_CODE||t===G.OPAREN_CODE||t===G.QUMARK_CODE;){let r;if(t===G.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==G.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===G.OBRACK_CODE?((e={type:G.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),t=this.code,t!==G.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===G.OPAREN_CODE?e={type:G.CALL_EXP,arguments:this.gobbleArguments(G.CPAREN_CODE),callee:e}:(t===G.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),e={type:G.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),r&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e,t,r="";for(;G.isDecimalDigit(this.code);)r+=this.expr.charAt(this.index++);if(this.code===G.PERIOD_CODE)for(r+=this.expr.charAt(this.index++);G.isDecimalDigit(this.code);)r+=this.expr.charAt(this.index++);if(e=this.char,"e"===e||"E"===e){for(r+=this.expr.charAt(this.index++),e=this.char,"+"!==e&&"-"!==e||(r+=this.expr.charAt(this.index++));G.isDecimalDigit(this.code);)r+=this.expr.charAt(this.index++);G.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+r+this.char+")")}return t=this.code,G.isIdentifierStart(t)?this.throwError("Variable names cannot start with a number ("+r+this.char+")"):(t===G.PERIOD_CODE||1===r.length&&r.charCodeAt(0)===G.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:G.LITERAL,value:parseFloat(r),raw:r}}gobbleStringLiteral(){let e="";const t=this.index,r=this.expr.charAt(this.index++);let n=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===r){n=!0;break}if("\\"===t)switch(t=this.expr.charAt(this.index++),t){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+="\t";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return n||this.throwError('Unclosed quote after "'+e+'"'),{type:G.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(G.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,G.isIdentifierPart(e));)this.index++;return{type:G.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){const t=[];let r=!1,n=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let o=this.code;if(o===e){r=!0,this.index++,e===G.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(o===G.COMMA_CODE){if(this.index++,n++,n!==t.length)if(e===G.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===G.CBRACK_CODE)for(let e=t.length;e<n;e++)t.push(null)}else if(t.length!==n&&0!==n)this.throwError("Expected comma");else{const e=this.gobbleExpression();e&&e.type!==G.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return r||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(G.CPAREN_CODE);if(this.code===G.CPAREN_CODE)return this.index++,1===e.length?e[0]:!!e.length&&{type:G.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:G.ARRAY_EXP,elements:this.gobbleArguments(G.CBRACK_CODE)}}}const F=new class{add(e,t,r){if("string"!=typeof arguments[0])for(let e in arguments[0])this.add(e,arguments[0][e],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][r?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}};Object.assign(G,{hooks:F,plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.forEach(e=>{if("object"!=typeof e||!e.name||!e.init)throw new Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)})}}(G),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),G.max_unop_len=G.getMaxKeyLen(G.unary_ops),G.max_binop_len=G.getMaxKeyLen(G.binary_ops);const k=e=>new G(e).parse(),B=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(G).filter(e=>!B.includes(e)&&void 0===k[e]).forEach(e=>{k[e]=G[e]}),k.Jsep=G;var M={name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;const r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const o=this.gobbleExpression();if(o||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:o},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}};k.plugins.register(M);var j={name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(47===this.code){const r=++this.index;let n=!1;for(;this.index<this.expr.length;){if(47===this.code&&!n){const n=this.expr.slice(r,this.index);let o,i="";for(;++this.index<this.expr.length;){const e=this.code;if(!(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57))break;i+=this.char}try{o=new RegExp(n,i)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:o,raw:this.expr.slice(r-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?n=!0:n&&this.code===e.CBRACK_CODE&&(n=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}};const K={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[43,45],assignmentPrecedence:.9,init(e){const t=[e.IDENTIFIER,e.MEMBER_EXP];function r(e){K.assignmentOperators.has(e.operator)?(e.type="AssignmentExpression",r(e.left),r(e.right)):e.operator||Object.values(e).forEach(e=>{e&&"object"==typeof e&&r(e)})}K.assignmentOperators.forEach(t=>e.addBinaryOp(t,K.assignmentPrecedence,!0)),e.hooks.add("gobble-token",function(e){const r=this.code;K.updateOperators.some(e=>e===r&&e===this.expr.charCodeAt(this.index+1))&&(this.index+=2,e.node={type:"UpdateExpression",operator:43===r?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},e.node.argument&&t.includes(e.node.argument.type)||this.throwError(`Unexpected ${e.node.operator}`))}),e.hooks.add("after-token",function(e){if(e.node){const r=this.code;K.updateOperators.some(e=>e===r&&e===this.expr.charCodeAt(this.index+1))&&(t.includes(e.node.type)||this.throwError(`Unexpected ${e.node.operator}`),this.index+=2,e.node={type:"UpdateExpression",operator:43===r?"++":"--",argument:e.node,prefix:!1})}}),e.hooks.add("after-expression",function(e){e.node&&r(e.node)})}};k.plugins.register(j,K),k.addUnaryOp("typeof"),k.addLiteral("null",null),k.addLiteral("undefined",void 0);const V=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),$={evalAst(e,t){switch(e.type){case"BinaryExpression":case"LogicalExpression":return $.evalBinaryExpression(e,t);case"Compound":return $.evalCompound(e,t);case"ConditionalExpression":return $.evalConditionalExpression(e,t);case"Identifier":return $.evalIdentifier(e,t);case"Literal":return $.evalLiteral(e,t);case"MemberExpression":return $.evalMemberExpression(e,t);case"UnaryExpression":return $.evalUnaryExpression(e,t);case"ArrayExpression":return $.evalArrayExpression(e,t);case"CallExpression":return $.evalCallExpression(e,t);case"AssignmentExpression":return $.evalAssignmentExpression(e,t);default:throw SyntaxError("Unexpected expression",e)}},evalBinaryExpression:(e,t)=>({"||":(e,t)=>e||t(),"&&":(e,t)=>e&&t(),"|":(e,t)=>e|t(),"^":(e,t)=>e^t(),"&":(e,t)=>e&t(),"==":(e,t)=>e==t(),"!=":(e,t)=>e!=t(),"===":(e,t)=>e===t(),"!==":(e,t)=>e!==t(),"<":(e,t)=>e<t(),">":(e,t)=>e>t(),"<=":(e,t)=>e<=t(),">=":(e,t)=>e>=t(),"<<":(e,t)=>e<<t(),">>":(e,t)=>e>>t(),">>>":(e,t)=>e>>>t(),"+":(e,t)=>e+t(),"-":(e,t)=>e-t(),"*":(e,t)=>e*t(),"/":(e,t)=>e/t(),"%":(e,t)=>e%t()}[e.operator]($.evalAst(e.left,t),()=>$.evalAst(e.right,t))),evalCompound(e,t){let r;for(let n=0;n<e.body.length;n++){"Identifier"===e.body[n].type&&["var","let","const"].includes(e.body[n].name)&&e.body[n+1]&&"AssignmentExpression"===e.body[n+1].type&&(n+=1);const o=e.body[n];r=$.evalAst(o,t)}return r},evalConditionalExpression:(e,t)=>$.evalAst(e.test,t)?$.evalAst(e.consequent,t):$.evalAst(e.alternate,t),evalIdentifier(e,t){if(Object.hasOwn(t,e.name))return t[e.name];throw ReferenceError(`${e.name} is not defined`)},evalLiteral:e=>e.value,evalMemberExpression(e,t){const r=String(e.computed?$.evalAst(e.property):e.property.name),n=$.evalAst(e.object,t);if(null==n)throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);if(!Object.hasOwn(n,r)&&V.has(r))throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);const o=n[r];return"function"==typeof o?o.bind(n):o},evalUnaryExpression:(e,t)=>({"-":e=>-$.evalAst(e,t),"!":e=>!$.evalAst(e,t),"~":e=>~$.evalAst(e,t),"+":e=>+$.evalAst(e,t),typeof:e=>typeof $.evalAst(e,t)}[e.operator](e.argument)),evalArrayExpression:(e,t)=>e.elements.map(e=>$.evalAst(e,t)),evalCallExpression(e,t){const r=e.arguments.map(e=>$.evalAst(e,t));return $.evalAst(e.callee,t)(...r)},evalAssignmentExpression(e,t){if("Identifier"!==e.left.type)throw SyntaxError("Invalid left-hand side in assignment");const r=e.left.name,n=$.evalAst(e.right,t);return t[r]=n,t[r]}};function H(e,t){return(e=e.slice()).push(t),e}function Y(e,t){return(t=t.slice()).unshift(e),t}class q extends Error{constructor(e){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=e,this.name="NewError"}}function z(e,t,r,n,o){if(!(this instanceof z))try{return new z(e,t,r,n,o)}catch(e){if(!e.avoidNew)throw e;return e.value}"string"==typeof e&&(o=n,n=r,r=t,t=e,e=null);const i=e&&"object"==typeof e;if(e=e||{},this.json=e.json||r,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=!Object.hasOwn(e,"wrap")||e.wrap,this.sandbox=e.sandbox||{},this.eval=void 0===e.eval?"safe":e.eval,this.ignoreEvalErrors=void 0!==e.ignoreEvalErrors&&e.ignoreEvalErrors,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||n||null,this.otherTypeCallback=e.otherTypeCallback||o||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},!1!==e.autostart){const n={path:i?e.path:t};i?"json"in e&&(n.json=e.json):n.json=r;const o=this.evaluate(n);if(!o||"object"!=typeof o)throw new q(o);return o}}z.prototype.evaluate=function(e,t,r,n){let o=this.parent,i=this.parentProperty,{flatten:s,wrap:a}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=n||this.otherTypeCallback,t=t||this.json,(e=e||this.path)&&"object"==typeof e&&!Array.isArray(e)){if(!e.path&&""!==e.path)throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),s=Object.hasOwn(e,"flatten")?e.flatten:s,this.currResultType=Object.hasOwn(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=Object.hasOwn(e,"sandbox")?e.sandbox:this.currSandbox,a=Object.hasOwn(e,"wrap")?e.wrap:a,this.currEval=Object.hasOwn(e,"eval")?e.eval:this.currEval,r=Object.hasOwn(e,"callback")?e.callback:r,this.currOtherTypeCallback=Object.hasOwn(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,o=Object.hasOwn(e,"parent")?e.parent:o,i=Object.hasOwn(e,"parentProperty")?e.parentProperty:i,e=e.path}if(o=o||null,i=i||null,Array.isArray(e)&&(e=z.toPathString(e)),!e&&""!==e||!t)return;const c=z.toPathArray(e);"$"===c[0]&&c.length>1&&c.shift(),this._hasParentSelector=null;const u=this._trace(c,t,["$"],o,i,r).filter(function(e){return e&&!e.isParentSelector});return u.length?a||1!==u.length||u[0].hasArrExpr?u.reduce((e,t)=>{const r=this._getPreferredOutput(t);return s&&Array.isArray(r)?e=e.concat(r):e.push(r),e},[]):this._getPreferredOutput(u[0]):a?[]:void 0},z.prototype._getPreferredOutput=function(e){const t=this.currResultType;switch(t){case"all":{const t=Array.isArray(e.path)?e.path:z.toPathArray(e.path);return e.pointer=z.toPointer(t),e.path="string"==typeof e.path?e.path:z.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return z.toPathString(e[t]);case"pointer":return z.toPointer(e.path);default:throw new TypeError("Unknown result type")}},z.prototype._handleCallback=function(e,t,r){if(t){const n=this._getPreferredOutput(e);e.path="string"==typeof e.path?e.path:z.toPathString(e.path),t(n,r,e)}},z.prototype._trace=function(e,t,r,n,o,i,s,a){let c;if(!e.length)return c={path:r,value:t,parent:n,parentProperty:o,hasArrExpr:s},this._handleCallback(c,i,"value"),c;const u=e[0],l=e.slice(1),f=[];function h(e){Array.isArray(e)?e.forEach(e=>{f.push(e)}):f.push(e)}if(("string"!=typeof u||a)&&t&&Object.hasOwn(t,u))h(this._trace(l,t[u],H(r,u),t,u,i,s));else if("*"===u)this._walk(t,e=>{h(this._trace(l,t[e],H(r,e),t,e,i,!0,!0))});else if(".."===u)h(this._trace(l,t,r,n,o,i,s)),this._walk(t,n=>{"object"==typeof t[n]&&h(this._trace(e.slice(),t[n],H(r,n),t,n,i,!0))});else{if("^"===u)return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:l,isParentSelector:!0};if("~"===u)return c={path:H(r,u),value:o,parent:n,parentProperty:null},this._handleCallback(c,i,"property"),c;if("$"===u)h(this._trace(l,t,r,null,null,i,s));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(u))h(this._slice(u,l,t,r,n,o,i));else if(0===u.indexOf("?(")){if(!1===this.currEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const e=u.replace(/^\?\((.*?)\)$/u,"$1"),s=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(e);s?this._walk(t,e=>{const a=[s[2]],c=s[1]?t[e][s[1]]:t[e];this._trace(a,c,r,n,o,i,!0).length>0&&h(this._trace(l,t[e],H(r,e),t,e,i,!0))}):this._walk(t,s=>{this._eval(e,t[s],s,r,n,o)&&h(this._trace(l,t[s],H(r,s),t,s,i,!0))})}else if("("===u[0]){if(!1===this.currEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");h(this._trace(Y(this._eval(u,t,r.at(-1),r.slice(0,-1),n,o),l),t,r,n,o,i,s))}else if("@"===u[0]){let e=!1;const s=u.slice(1,-2);switch(s){case"scalar":t&&["object","function"].includes(typeof t)||(e=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===s&&(e=!0);break;case"integer":!Number.isFinite(t)||t%1||(e=!0);break;case"number":Number.isFinite(t)&&(e=!0);break;case"nonFinite":"number"!=typeof t||Number.isFinite(t)||(e=!0);break;case"object":t&&typeof t===s&&(e=!0);break;case"array":Array.isArray(t)&&(e=!0);break;case"other":e=this.currOtherTypeCallback(t,r,n,o);break;case"null":null===t&&(e=!0);break;default:throw new TypeError("Unknown value type "+s)}if(e)return c={path:r,value:t,parent:n,parentProperty:o},this._handleCallback(c,i,"value"),c}else if("`"===u[0]&&t&&Object.hasOwn(t,u.slice(1))){const e=u.slice(1);h(this._trace(l,t[e],H(r,e),t,e,i,s,!0))}else if(u.includes(",")){const e=u.split(",");for(const s of e)h(this._trace(Y(s,l),t,r,n,o,i,!0))}else!a&&t&&Object.hasOwn(t,u)&&h(this._trace(l,t[u],H(r,u),t,u,i,s,!0))}if(this._hasParentSelector)for(let e=0;e<f.length;e++){const r=f[e];if(r&&r.isParentSelector){const a=this._trace(r.expr,t,r.path,n,o,i,s);if(Array.isArray(a)){f[e]=a[0];const t=a.length;for(let r=1;r<t;r++)e++,f.splice(e,0,a[r])}else f[e]=a}}return f},z.prototype._walk=function(e,t){if(Array.isArray(e)){const r=e.length;for(let e=0;e<r;e++)t(e)}else e&&"object"==typeof e&&Object.keys(e).forEach(e=>{t(e)})},z.prototype._slice=function(e,t,r,n,o,i,s){if(!Array.isArray(r))return;const a=r.length,c=e.split(":"),u=c[2]&&Number.parseInt(c[2])||1;let l=c[0]&&Number.parseInt(c[0])||0,f=c[1]&&Number.parseInt(c[1])||a;l=l<0?Math.max(0,l+a):Math.min(a,l),f=f<0?Math.max(0,f+a):Math.min(a,f);const h=[];for(let e=l;e<f;e+=u){this._trace(Y(e,t),r,n,o,i,s,!0).forEach(e=>{h.push(e)})}return h},z.prototype._eval=function(e,t,r,n,o,i){this.currSandbox._$_parentProperty=i,this.currSandbox._$_parent=o,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;const s=e.includes("@path");s&&(this.currSandbox._$_path=z.toPathString(n.concat([r])));const a=this.currEval+"Script:"+e;if(!z.cache[a]){let t=e.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(s&&(t=t.replaceAll("@path","_$_path")),"safe"===this.currEval||!0===this.currEval||void 0===this.currEval)z.cache[a]=new this.safeVm.Script(t);else if("native"===this.currEval)z.cache[a]=new this.vm.Script(t);else if("function"==typeof this.currEval&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const e=this.currEval;z.cache[a]=new e(t)}else{if("function"!=typeof this.currEval)throw new TypeError(`Unknown "eval" property "${this.currEval}"`);z.cache[a]={runInNewContext:e=>this.currEval(t,e)}}}try{return z.cache[a].runInNewContext(this.currSandbox)}catch(t){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+t.message+": "+e)}},z.cache={},z.toPathString=function(e){const t=e,r=t.length;let n="$";for(let e=1;e<r;e++)/^(~|\^|@.*?\(\))$/u.test(t[e])||(n+=/^[0-9*]+$/u.test(t[e])?"["+t[e]+"]":"['"+t[e]+"']");return n},z.toPointer=function(e){const t=e,r=t.length;let n="";for(let e=1;e<r;e++)/^(~|\^|@.*?\(\))$/u.test(t[e])||(n+="/"+t[e].toString().replaceAll("~","~0").replaceAll("/","~1"));return n},z.toPathArray=function(e){const{cache:t}=z;if(t[e])return t[e].concat();const r=[],n=e.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(e,t){return"[#"+(r.push(t)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(e,t){return"['"+t.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(e,t){return";"+t.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(e){const t=e.match(/#(\d+)/u);return t&&t[1]?r[t[1]]:e});return t[e]=n,t[e].concat()},z.prototype.safeVm={Script:class{constructor(e){this.code=e,this.ast=k(this.code)}runInNewContext(e){const t=Object.assign(Object.create(null),e);return $.evalAst(this.ast,t)}}};z.prototype.vm={Script:class{constructor(e){this.code=e}runInNewContext(e){let t=this.code;const r=Object.keys(e),n=[];!function(e,t,r){const n=e.length;for(let o=0;o<n;o++)r(e[o])&&t.push(e.splice(o--,1)[0])}(r,n,t=>"function"==typeof e[t]);const o=r.map(t=>e[t]);t=n.reduce((t,r)=>{let n=e[r].toString();return/function/u.test(n)||(n="function "+n),"var "+r+"="+n+";"+t},"")+t,/(['"])use strict\1/u.test(t)||r.includes("arguments")||(t="var arguments = undefined;"+t),t=t.replace(/;\s*$/u,"");const i=t.lastIndexOf(";"),s=-1!==i?t.slice(0,i+1)+" return "+t.slice(i+1):" return "+t;return new Function(...r,s)(...o)}}};var W=function(e,t){try{var r=z({path:t,json:e}),n=null==r?void 0:r[0];if(void 0===n)return;return null===n?"null":n}catch(e){return void x.w9.error(x.Ey.CLAIM,"[PARAMS-EXTRACTOR-UTILS] Error extracting JSON value with path ".concat(t,":"),e)}},J=function(e,t){try{var r=t.replace(/^\/\//,"").replace(/\/@/," ").split("/"),n=r[r.length-1],o=new RegExp("<".concat(n,"[^>]*>(.*?)</").concat(n,">"),"i"),i=e.match(o);return i?i[1]:void 0}catch(e){return void x.w9.error(x.Ey.CLAIM,"[PARAMS-EXTRACTOR-UTILS] Error extracting HTML value with XPath ".concat(t,":"),e)}};function X(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Q(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Q(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw i}}}}function Q(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Z(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.replace(/[[\]()*+?.,\\^$|#]/g,"\\$&"),o=function(e){for(var t,r=/{{(\w+)}}/g,n=[];null!==(t=r.exec(e));)n.push(t[1]);return n}(e),i=[],s=X(o);try{for(s.s();!(t=s.n()).done;){var a=t.value;if(r[a])n=n.replace("{{".concat(a,"}}"),r[a]);else{i.push(a);var c=a.endsWith("GRD")?"(.*)":"(.*?)";n=n.replace("{{".concat(a,"}}"),c)}}}catch(e){s.e(e)}finally{s.f()}return{pattern:n,allVars:o,unsubstitutedVars:i}}function ee(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,s,a=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return te(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?te(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function re(e){return re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},re(e)}var ne=function(e){return e?(e.match(/{{([^}]+)}}/g)||[]).map(function(e){return e.substring(2,e.length-2)}):[]},oe=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e||!t)return r;var n=ne(e),o=Z(e,n).pattern,i=t.match(o);if(i&&i.length>1)for(var s=0;s<n.length;s++)i[s+1]&&(r[n[s]]=i[s+1]);return r},ie=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e||!t)return r;var n=ne(e),o=Z(e,{}).pattern,i=new RegExp(o),s=t.match(i);if(s&&s.length>1)for(var a=0;a<n.length;a++)s[a+1]&&(r[n[a]]=s[a+1]);return r},se=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=arguments.length>4?arguments[4]:void 0;if(!e)return n;try{var i=null,s=function(e){if(!e||"string"!=typeof e)return!1;var t=e.trim();return t.startsWith("{")||t.startsWith("[")}(e);if(s&&(i=function(e){try{return JSON.parse(e)}catch(e){return x.w9.warn(x.Ey.CLAIM,"[PARAMS-EXTRACTOR-UTILS] Response looks like JSON but couldn't be parsed"),null}}(e)),t&&t.length>0&&r&&r.length>0)for(var a=0;a<t.length;a++){var c=t[a],u=r[a];if(!c.value)return;var l=ne(c.value);if(0===l.length)return;var f=u;if(f){var h=null;if(f.jsonPath&&i)h=W(i,f.jsonPath);else if(f.xPath&&!s)h=J(e,f.xPath);else if(f.regex){var d=e.match(new RegExp(f.regex));d&&d.length>1&&(h=d[1])}void 0!==h&&("object"===re(h)&&null!==h?n[l[0]]=JSON.stringify(h):n[l[0]]=null===h?null:String(h))}}}catch(e){o.error({message:"[PARAM-EXTRACTOR] Error extracting params from response:",logLevel:x.E$.INFO,type:x.D_.CLAIM_CREATION,eventType:x.Ru.CLAIM_PARAMETER_VALIDATION_FAILED_EXCEPTION,meta:{error:e}})}return n},ae=function(e){var t={},r={};return Object.entries(e||{}).forEach(function(e){var n=ee(e,2),o=n[0],i=n[1];o.toLowerCase().includes("secret")?r[o]=i:t[o]=i}),{publicParams:t,secretParams:r}},ce=r(379);function ue(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return le(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(le(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,le(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,le(f,"constructor",u),le(u,"constructor",c),c.displayName="GeneratorFunction",le(u,o,"GeneratorFunction"),le(f),le(f,o,"Generator"),le(f,n,function(){return this}),le(f,"toString",function(){return"[object Generator]"}),(ue=function(){return{w:i,m:h}})()}function le(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}le=function(e,t,r,n){function i(t,r){le(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},le(e,t,r,n)}function fe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function he(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fe(Object(r),!0).forEach(function(t){de(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fe(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function de(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=pe(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=pe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==pe(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pe(e){return pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pe(e)}function ge(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,s,a=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ye(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ye(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function me(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}var Ee=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:135,t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e<=0&&(e=135);var r="Chrome/".concat(e,".0.0.0"),n=t?" Mobile":"";return"Mozilla/5.0 ".concat("(Linux; Android 10; K)"," ").concat("AppleWebKit/537.36 (KHTML, like Gecko)"," ").concat(r).concat(n," ").concat("Safari/537.36")},be=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"unknown",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown",r=arguments.length>2?arguments[2]:void 0;return r.setContext({sessionId:e,providerId:t,type:s.LOG_TYPES.CLAIM_CREATION}),new Promise(function(n,i){var a=setTimeout(function(){chrome.runtime.onMessage.removeListener(c),i(new Error("Timeout: No response from offscreen document for private key request."))},1e4),c=function(e,t){return e.action!==o.wx.GET_PRIVATE_KEY_RESPONSE||e.source!==o.J_.OFFSCREEN||e.target!==o.J_.BACKGROUND||(clearTimeout(a),chrome.runtime.onMessage.removeListener(c),e.success&&e.privateKey?(r.info({message:"[CLAIM-CREATOR] Received private key from offscreen document",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION}),n(e.privateKey)):(r.error({message:"[CLAIM-CREATOR] Failed to get private key from offscreen document: "+e.error,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION}),i(new Error(e.error||"Unknown error getting private key from offscreen document."))),!1)};chrome.runtime.onMessage.addListener(c),r.info({message:"[CLAIM-CREATOR] Requesting private key from offscreen document",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION}),chrome.runtime.sendMessage({action:o.wx.GET_PRIVATE_KEY,source:o.J_.BACKGROUND,target:o.J_.OFFSCREEN,sessionId:e,providerId:t},function(e){chrome.runtime.lastError&&(clearTimeout(a),chrome.runtime.onMessage.removeListener(c),r.error({message:"[CLAIM-CREATOR] Error sending GET_PRIVATE_KEY message: "+chrome.runtime.lastError.message,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION}),i(new Error("Error sending message to offscreen document: ".concat(chrome.runtime.lastError.message))))})})},ve=function(){var e,t=(e=ue().m(function e(t,r){var n,o,i,a,c,u,l,f,h,d,p,g,y,m,E,b,v,O,I,A,S,w,R=arguments;return ue().w(function(e){for(;;)switch(e.p=e.n){case 0:return i=R.length>2&&void 0!==R[2]?R[2]:"unknown",a=R.length>3&&void 0!==R[3]?R[3]:"unknown",c=R.length>4?R[4]:void 0,(u=R.length>5?R[5]:void 0).setContext({sessionId:i,providerId:a,type:s.LOG_TYPES.CLAIM_CREATION}),u.info({message:"[CLAIM-CREATOR] Creating claim object from request data",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION,eventType:s.EVENT_TYPES.CLAIM_CREATION_STARTED}),e.p=1,e.n=2,_(u);case 2:u.info({message:"[CLAIM-CREATOR] Offscreen document is ready.",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION,eventType:s.EVENT_TYPES.OFFSCREEN_DOCUMENT_READY}),e.n=4;break;case 3:throw e.p=3,S=e.v,u.error({message:"[CLAIM-CREATOR] Failed to ensure offscreen document: "+(null==S?void 0:S.message),logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION,eventType:s.EVENT_TYPES.OFFSCREEN_DOCUMENT_NOT_READY_EXCEPTION,meta:{error:null==S?void 0:S.message,request:t,providerData:r,sessionId:i,loginUrl:c}}),new Error("Failed to initialize offscreen document: ".concat(S.message));case 4:return l="undefined"!=typeof navigator&&navigator.userAgent||Ee(),f=["user-agent","accept","accept-language","accept-encoding","sec-fetch-mode","sec-fetch-site","sec-fetch-user","origin","x-requested-with","sec-ch-ua","sec-ch-ua-mobile"],d={},(h={}).url="TEMPLATE"===r.urlType?r.url:t.url,h.method=t.method||"GET",t.headers&&(p={"Sec-Fetch-Mode":"same-origin","Sec-Fetch-Site":"same-origin","User-Agent":l},g={Referer:t.referer&&String(t.referer)||c||origin||""},Object.entries(t.headers).forEach(function(e){var t=ge(e,2),r=t[0],n=t[1],o=r.toLowerCase();f.includes(o)?p[r]=n:g[r]=n}),Object.keys(p).length>0&&(h.headers=p),Object.keys(g).length>0&&(d.headers=g)),t.body&&(null!=r&&null!==(y=r.bodySniff)&&void 0!==y&&y.enabled?h.body=r.bodySniff.template:h.body=t.body),t.cookieStr&&(d.cookieStr=t.cookieStr),m={},null!=t&&t.extractedParams&&"object"===pe(t.extractedParams)&&(m=he(he({},m),t.extractedParams)),"TEMPLATE"===r.urlType&&t.url&&(m=he(he({},m),oe(r.url,t.url))),null!=r&&null!==(n=r.bodySniff)&&void 0!==n&&n.enabled&&t.body&&(m=he(he({},m),ie(r.bodySniff.template,t.body))),t.responseText&&r.responseMatches&&(m=he(he({},m),se(t.responseText,r.responseMatches,r.responseRedactions||[]))),E=ae(m),b=E.publicParams,v=E.secretParams,Object.keys(b).length>0&&(h.paramValues=b),Object.keys(v).length>0&&(d.paramValues=v),r.responseMatches&&(h.responseMatches=r.responseMatches.map(function(e){return{value:e.value,type:e.type||"contains",invert:e.invert||!1}})),r.responseRedactions&&(h.responseRedactions=r.responseRedactions.map(function(e){var t={};return Object.entries(e).forEach(function(e){var r=ge(e,2),n=r[0],o=r[1];"hash"!==n&&("jsonPath"!==n&&"xPath"!==n||o&&""!==o)&&(t[n]=o)}),t})),r.responseSelections&&(h.responseSelections=r.responseSelections.map(function(e){var t={};return"value"in e&&(t.value=e.value),"type"in e&&(t.type=e.type),"invert"in e&&(t.invert=e.invert),t})),r.additionalClientOptions&&(h.additionalClientOptions=r.additionalClientOptions),r.writeRedactionMode&&(h.writeRedactionMode=r.writeRedactionMode),e.p=5,e.n=6,be(i,a,u);case 6:O=e.v,e.n=8;break;case 7:throw e.p=7,w=e.v,u.error({message:"[CLAIM-CREATOR] Error obtaining owner private key: "+w.message,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION,eventType:s.EVENT_TYPES.CLAIM_CREATION_FAILED}),new Error("Could not obtain owner private key: ".concat(w.message));case 8:if("{{DYNAMIC_GEO}}"!==(I=null!==(o=null==r?void 0:r.geoLocation)&&void 0!==o?o:"")){e.n=10;break}return e.n=9,(0,ce.C)();case 9:I=e.v;case 10:return u.log({message:"[CLAIM-CREATOR] Geo location: "+I,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION}),h.geoLocation=I,A={name:"http",sessionId:i,params:h,secretParams:d,ownerPrivateKey:O,client:{url:"ws://localhost:8001/ws"}},u.info({message:"[CLAIM-CREATOR] Claim object created successfully",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION,eventType:s.EVENT_TYPES.CLAIM_CREATION_SUCCESS}),u.log({message:"[CLAIM-CREATOR] Claim object: "+JSON.stringify(A,null,2),logLevel:s.LOG_LEVEL.ALL,type:s.LOG_TYPES.CLAIM_CREATION}),e.a(2,A)}},e,null,[[5,7],[1,3]])}),function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){me(i,n,o,s,a,"next",e)}function a(e){me(i,n,o,s,a,"throw",e)}s(void 0)})});return function(e,r){return t.apply(this,arguments)}}();function Oe(e){return Oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Oe(e)}function Ie(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ae(n.key),n)}}function Ae(e){var t=function(e,t){if("object"!=Oe(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=Oe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Oe(t)?t:t+""}var Se=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.sessionTimer=null,this.sessionTimerDuration=3e4,this.sessionTimerPaused=!1,this.sessionTimerRemainingTime=0,this.sessionTimerStartTime=0,this.onSessionTimeout=null},(t=[{key:"setCallbacks",value:function(e){this.onSessionTimeout=e}},{key:"startSessionTimer",value:function(){var e=this;x.w9.info(x.Ey.SESSION_TIMER,"[SESSION TIMER] Starting session timer"),this.clearSessionTimer(),this.sessionTimerStartTime=Date.now(),this.sessionTimer=setTimeout(function(){null!==e.sessionTimer?(x.w9.error(x.Ey.SESSION_TIMER,"[SESSION TIMER] Session timer expired"),e.onSessionTimeout&&e.onSessionTimeout("Session timeout: No proofs generated within time limit")):x.w9.info(x.Ey.SESSION_TIMER,"[SESSION TIMER] Timer was already cleared, ignoring timeout")},this.sessionTimerDuration)}},{key:"resetSessionTimer",value:function(){x.w9.info(x.Ey.SESSION_TIMER,"[SESSION TIMER] Resetting session timer"),this.clearSessionTimer(),this.startSessionTimer()}},{key:"clearSessionTimer",value:function(){this.sessionTimer&&(clearTimeout(this.sessionTimer),this.sessionTimer=null)}},{key:"pauseSessionTimer",value:function(){if(this.sessionTimer&&!this.sessionTimerPaused){x.w9.info(x.Ey.SESSION_TIMER,"[SESSION TIMER] Pausing session timer");var e=Date.now()-this.sessionTimerStartTime;this.sessionTimerRemainingTime=Math.max(0,this.sessionTimerDuration-e),this.clearSessionTimer(),this.sessionTimerPaused=!0}}},{key:"resumeSessionTimer",value:function(){var e=this;this.sessionTimerPaused&&(x.w9.info(x.Ey.SESSION_TIMER,"[SESSION TIMER] Resuming session timer with remaining time:",this.sessionTimerRemainingTime),this.sessionTimer=setTimeout(function(){x.w9.error(x.Ey.SESSION_TIMER,"[SESSION TIMER] Session timer expired"),e.onSessionTimeout&&e.onSessionTimeout("Session timeout: No proofs generated within time limit")},this.sessionTimerRemainingTime),this.sessionTimerStartTime=Date.now()-(this.sessionTimerDuration-this.sessionTimerRemainingTime),this.sessionTimerPaused=!1)}},{key:"clearAllTimers",value:function(){x.w9.info(x.Ey.SESSION_TIMER,"[SESSION TIMER] Clearing all timers"),this.clearSessionTimer(),this.sessionTimerPaused=!1,this.sessionTimerRemainingTime=0,this.sessionTimerStartTime=0}},{key:"setTimerDuration",value:function(e){e&&"number"==typeof e&&(this.sessionTimerDuration=e)}}])&&Ie(e.prototype,t),r&&Ie(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}();function we(e){return we="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},we(e)}function Re(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,s,a=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return a}}(e,t)||Pe(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Te(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _e(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Te(Object(r),!0).forEach(function(t){Ne(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Te(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Ne(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=we(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=we(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==we(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ce(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Pe(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw i}}}}function Pe(e,t){if(e){if("string"==typeof e)return Le(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Le(e,t):void 0}}function Le(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function De(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return Ue(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(Ue(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,Ue(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,Ue(f,"constructor",u),Ue(u,"constructor",c),c.displayName="GeneratorFunction",Ue(u,o,"GeneratorFunction"),Ue(f),Ue(f,o,"Generator"),Ue(f,n,function(){return this}),Ue(f,"toString",function(){return"[object Generator]"}),(De=function(){return{w:i,m:h}})()}function Ue(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Ue=function(e,t,r,n){function i(t,r){Ue(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},Ue(e,t,r,n)}function xe(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function Ge(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){xe(i,n,o,s,a,"next",e)}function a(e){xe(i,n,o,s,a,"throw",e)}s(void 0)})}}function Fe(e,t){return ke.apply(this,arguments)}function ke(){return ke=Ge(De().m(function e(t,r){var n,o,i,s;return De().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=t.bgLogger,e.p=1,t.providerData=null,t.parameters={},t.providerId=null,t.appId=null,t.sessionId=null,t.callbackUrl=null,t.generatedProofs=new Map,t.filteredRequests=new Map,t.initPopupMessage=new Map,t.providerDataMessage=new Map,t.providerRequestsByHash=new Map,t.aborted=!1,t.sessionTimerManager.clearAllTimers(),t.firstRequestReceived=!1,r.providerId){e.n=2;break}throw new Error("Provider ID not found");case 2:return n.setContext({type:x.D_.BACKGROUND,sessionId:r.sessionId||t.sessionId||"unknown",providerId:r.providerId||t.providerId||"unknown",appId:r.applicationId||t.appId||"unknown"}),n.info({message:"[BACKGROUND] Fetching provider data from the backend for provider Id ".concat(r.providerId),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=3,t.fetchProviderData(r.providerId,r.sessionId,r.applicationId);case 3:if(o=e.v,t.providerData=o,t.providerId=r.providerId,r.parameters&&(t.parameters=r.parameters),"string"==typeof r.callbackUrl&&(t.callbackUrl=r.callbackUrl),r.sessionId&&(t.sessionId=r.sessionId),r.applicationId&&(t.appId=r.applicationId),o){e.n=4;break}throw new Error("Provider data not found");case 4:return i=o.loginUrl,chrome.tabs.create({url:i},function(e){var o,i,s;t.activeTabId=e.id,n.info({message:"[BACKGROUND] New tab created for provider ".concat(r.providerId," with tab id ").concat(e.id),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),t.managedTabs.add(e.id);var a=(null===(o=t.providerData)||void 0===o?void 0:o.name)||"Default Provider",c=(null===(i=t.providerData)||void 0===i?void 0:i.description)||"Default Description",u=(null===(s=t.providerData)||void 0===s||null===(s=s.verificationConfig)||void 0===s?void 0:s.dataRequired)||"Default Data",l=t.sessionId||"unknown";if(e.id){var f={action:t.MESSAGE_ACTIONS.SHOW_PROVIDER_VERIFICATION_POPUP,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{providerName:a,description:c,dataRequired:u,sessionId:l}},h={action:t.MESSAGE_ACTIONS.PROVIDER_DATA_READY,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{providerData:t.providerData,parameters:t.parameters,sessionId:t.sessionId,callbackUrl:t.callbackUrl,providerId:t.providerId,appId:t.appId}};t.initPopupMessage||(t.initPopupMessage=new Map),t.initPopupMessage.set(e.id,{message:f}),t.providerDataMessage.set(e.id,{message:h})}else n.error({message:"[BACKGROUND] New tab does not have an ID, cannot queue message for popup.",logLevel:x.E$.INFO,type:x.D_.BACKGROUND});n.info({message:"[BACKGROUND] Starting verification with session id: ".concat(t.sessionId),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),t.updateSessionStatus(r.sessionId,t.RECLAIM_SESSION_STATUS.USER_STARTED_VERIFICATION,r.providerId,r.applicationId).catch(function(e){n.error({message:"[BACKGROUND] Error updating session status: ".concat(null==e?void 0:e.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND})})}),e.a(2,{success:!0,message:"Verification started, redirecting to provider login page"});case 5:throw e.p=5,s=e.v,n.error({message:"[BACKGROUND] Error starting verification: ".concat(null==s?void 0:s.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),t.activeSessionId=null,s;case 6:return e.a(2)}},e,null,[[1,5]])})),ke.apply(this,arguments)}function Be(e,t,r){return Me.apply(this,arguments)}function Me(){return Me=Ge(De().m(function e(t,r,n){var o,i,s,a;return De().w(function(e){for(;;)switch(e.p=e.n){case 0:if((o=t.bgLogger).setContext({type:x.D_.BACKGROUND,sessionId:t.sessionId||"unknown",providerId:t.providerId||"unknown",appId:t.appId||"unknown"}),o.log({message:"[BACKGROUND] Failing session: ".concat(r),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.VERIFICATION_FLOW_FAILED}),t.sessionTimerManager.clearAllTimers(),t.aborted=!0,!t.sessionId){e.n=4;break}return e.p=1,e.n=2,t.updateSessionStatus(t.sessionId,t.RECLAIM_SESSION_STATUS.PROOF_GENERATION_FAILED,t.providerId,t.appId);case 2:o.log({message:"[BACKGROUND] Updated session status to failed: ".concat(t.sessionId),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=4;break;case 3:e.p=3,i=e.v,o.error({message:"[BACKGROUND] Error updating session status to failed: ".concat(null==i?void 0:i.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 4:if(t.activeTabId&&chrome.tabs.sendMessage(t.activeTabId,{action:t.MESSAGE_ACTIONS.PROOF_GENERATION_FAILED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{requestHash:n,sessionId:t.sessionId}}).catch(function(e){o.error({message:"[BACKGROUND] Error notifying content script of session failure: ".concat(null==e?void 0:e.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND})}),!t.originalTabId){e.n=8;break}return e.p=5,e.n=6,chrome.tabs.sendMessage(t.originalTabId,{action:t.MESSAGE_ACTIONS.PROOF_GENERATION_FAILED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{error:r,sessionId:t.sessionId}});case 6:e.n=8;break;case 7:e.p=7,s=e.v,o.error({message:"[BACKGROUND] Error notifying original tab of session failure: ".concat(null==s?void 0:s.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 8:return e.p=8,o.info({message:"[BACKGROUND] Proof generation failed, Broadcasting to popup/options pages: ".concat(r),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=9,chrome.runtime.sendMessage({action:t.MESSAGE_ACTIONS.PROOF_GENERATION_FAILED,data:{error:r,sessionId:t.sessionId}});case 9:e.n=11;break;case 10:e.p=10,a=e.v,o.error({message:"[BACKGROUND] Error broadcasting to popup/options pages: ".concat(null==a?void 0:a.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 11:t.proofGenerationQueue=[],t.isProcessingQueue=!1,t.activeSessionId=null;case 12:return e.a(2)}},e,null,[[8,10],[5,7],[1,3]])})),Me.apply(this,arguments)}function je(e){return Ke.apply(this,arguments)}function Ke(){return Ke=Ge(De().m(function e(t){var r,n,o,i,s,a,c,u,l,f,h,d,p,g,y,m,E,b,v,O,I,A,S,w,R;return De().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=t.bgLogger,e.p=1,!t.expectManyClaims){e.n=2;break}return e.a(2);case 2:if(t.sessionTimerManager.clearAllTimers(),r.setContext({type:x.D_.BACKGROUND,sessionId:t.sessionId||"unknown",providerId:t.providerId||"unknown",appId:t.appId||"unknown"}),0!==t.generatedProofs.size){e.n=3;break}return e.a(2);case 3:if(!(o=Array.isArray(null===(n=t.providerData)||void 0===n?void 0:n.requestData)&&t.providerData.requestData.length>0)){e.n=4;break}if(i=t.providerData.requestData.filter(function(e){return t.generatedProofs.has(e.requestHash)}).length,i===t.providerData.requestData.length){e.n=4;break}return e.a(2);case 4:if(s=[],a=new Set,o){c=Ce(t.providerData.requestData);try{for(c.s();!(u=c.n()).done;)l=u.value,t.generatedProofs.has(l.requestHash)&&(f=t.generatedProofs.get(l.requestHash),s.push(t.formatProof(f,l)),a.add(l.requestHash))}catch(e){c.e(e)}finally{c.f()}}h=Ce(t.generatedProofs.entries()),e.p=5,h.s();case 6:if((d=h.n()).done){e.n=9;break}if(p=Re(d.value,2),g=p[0],y=p[1],!a.has(g)){e.n=7;break}return e.a(3,8);case 7:m=t.providerRequestsByHash.get(g)||{url:"",expectedPageUrl:"",urlType:"EXACT",method:"GET",responseMatches:[],responseRedactions:[],requestHash:g},s.push(t.formatProof(y,m));case 8:e.n=6;break;case 9:e.n=11;break;case 10:e.p=10,v=e.v,h.e(v);case 11:return e.p=11,h.f(),e.f(11);case 12:if(E=s.map(function(e){var r;return _e(_e({},e),{},{publicData:null!==(r=t.publicData)&&void 0!==r?r:null})}),r.info({message:"[BACKGROUND] Submitting proofs ".concat(JSON.stringify(E)),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.SUBMITTING_PROOF}),b=!1,!(t.callbackUrl&&"string"==typeof t.callbackUrl&&t.callbackUrl.length>0)){e.n=25;break}return e.p=13,r.log({message:"[BACKGROUND] Submitting proofs to callback URL: ".concat(t.callbackUrl),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.SUBMITTING_PROOF_TO_CALLBACK_URL}),e.n=14,t.submitProofOnCallback(E,t.callbackUrl,t.sessionId,t.providerId,t.appId);case 14:b=!0,e.n=24;break;case 15:return e.p=15,O=e.v,e.p=16,r.error({message:"[BACKGROUND] Notifying original tab of proof submission failure: ".concat(O.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.SUBMITTING_PROOF_TO_CALLBACK_URL_FAILED}),e.n=17,chrome.tabs.sendMessage(t.originalTabId,{action:t.MESSAGE_ACTIONS.PROOF_SUBMISSION_FAILED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{error:O.message,sessionId:t.sessionId}});case 17:e.n=19;break;case 18:e.p=18,I=e.v,r.error({message:"[BACKGROUND] Error notifying original tab of proof submission failure: ".concat(null==I?void 0:I.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.SUBMITTING_PROOF_TO_CALLBACK_URL_FAILED});case 19:return chrome.tabs.sendMessage(t.activeTabId,{action:t.MESSAGE_ACTIONS.PROOF_SUBMISSION_FAILED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{error:O.message,sessionId:t.sessionId}}),r.error({message:"[BACKGROUND] Broadcasting to runtime of proof submission failure: ".concat(O.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.PROOF_SUBMISSION_FAILED}),e.p=20,e.n=21,chrome.runtime.sendMessage({action:t.MESSAGE_ACTIONS.PROOF_SUBMISSION_FAILED,data:{error:O.message,sessionId:t.sessionId}});case 21:e.n=23;break;case 22:e.p=22,e.v;case 23:throw r.error({message:"[BACKGROUND] Error submitting proofs: ".concat(O.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),O;case 24:e.n=29;break;case 25:if(!t.sessionId){e.n=29;break}return e.p=26,r.log({message:"[BACKGROUND] Updating status to PROOF_GENERATION_SUCCESS",logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.PROOF_SUBMITTED}),e.n=27,t.updateSessionStatus(t.sessionId,t.RECLAIM_SESSION_STATUS.PROOF_GENERATION_SUCCESS,t.providerId,t.appId);case 27:e.n=29;break;case 28:e.p=28,A=e.v,r.error({message:"[BACKGROUND] Error updating status to PROOF_GENERATION_SUCCESS: ".concat(null==A?void 0:A.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 29:if(!t.activeTabId){e.n=33;break}return e.p=30,r.log({message:"[BACKGROUND] Proof submitted, Notifying content script with proofs",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=31,chrome.tabs.sendMessage(t.activeTabId,{action:t.MESSAGE_ACTIONS.PROOF_SUBMITTED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{formattedProofs:s,submitted:b,sessionId:t.sessionId}});case 31:e.n=33;break;case 32:e.p=32,S=e.v,r.error({message:"[BACKGROUND] Error notifying content script: ".concat(null==S?void 0:S.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 33:if(!t.originalTabId){e.n=37;break}return e.p=34,r.log({message:"[BACKGROUND] Proof submitted, Notifying original tab with proofs",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=35,chrome.tabs.sendMessage(t.originalTabId,{action:t.MESSAGE_ACTIONS.PROOF_SUBMITTED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{formattedProofs:s,submitted:b,sessionId:t.sessionId}});case 35:e.n=37;break;case 36:e.p=36,w=e.v,r.error({message:"[BACKGROUND] Error notifying original tab: ".concat(null==w?void 0:w.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 37:return e.p=37,r.log({message:"[BACKGROUND] Proof submitted, Broadcasting to runtime",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=38,chrome.runtime.sendMessage({action:t.MESSAGE_ACTIONS.PROOF_SUBMITTED,data:{formattedProofs:s,submitted:b,sessionId:t.sessionId}});case 38:e.n=40;break;case 39:e.p=39,e.v;case 40:if(t.originalTabId)try{setTimeout(Ge(De().m(function e(){return De().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,chrome.tabs.update(t.originalTabId,{active:!0});case 1:if(!t.activeTabId){e.n=3;break}return e.n=2,chrome.tabs.remove(t.activeTabId);case 2:t.activeTabId=null;case 3:t.originalTabId=null;case 4:return e.a(2)}},e)})),3e3)}catch(e){r.error({message:"[BACKGROUND] Error navigating back or closing tab: ".concat(null==e?void 0:e.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND})}else if(t.activeTabId)try{setTimeout(Ge(De().m(function e(){return De().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,chrome.tabs.remove(t.activeTabId);case 1:t.activeTabId=null;case 2:return e.a(2)}},e)})),3e3)}catch(e){}return t.activeSessionId=null,e.a(2,{success:!0});case 41:throw e.p=41,R=e.v,r.error({message:"[BACKGROUND] Error submitting proof: ".concat(null==R?void 0:R.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.PROOF_SUBMISSION_FAILED}),t.activeSessionId=null,R;case 42:return e.a(2)}},e,null,[[37,39],[34,36],[30,32],[26,28],[20,22],[16,18],[13,15],[5,10,11,12],[1,41]])})),Ke.apply(this,arguments)}function Ve(e){return $e.apply(this,arguments)}function $e(){return $e=Ge(De().m(function e(t){var r,n,o,i,s,a,c;return De().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=t.bgLogger,e.p=1,r.setContext({type:x.D_.BACKGROUND,sessionId:t.sessionId||"unknown",providerId:t.providerId||"unknown",appId:t.appId||"unknown"}),r.log({message:"[BACKGROUND] Cancelling session",logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.RECLAIM_VERIFICATION_DISMISSED}),t.sessionTimerManager.clearAllTimers(),t.aborted=!0,!t.sessionId){e.n=5;break}return e.p=2,r.log({message:"[BACKGROUND] Proof generation failed, Updating status on cancel",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=3,t.updateSessionStatus(t.sessionId,t.RECLAIM_SESSION_STATUS.PROOF_GENERATION_FAILED,t.providerId,t.appId);case 3:e.n=5;break;case 4:e.p=4,n=e.v,r.error({message:"[BACKGROUND] Error updating status on cancel: ".concat(null==n?void 0:n.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 5:if(!t.activeTabId){e.n=9;break}return e.p=6,r.log({message:"[BACKGROUND] Proof generation failed, Notifying content on cancel",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=7,chrome.tabs.sendMessage(t.activeTabId,{action:t.MESSAGE_ACTIONS.PROOF_GENERATION_FAILED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{error:"Cancelled by user",sessionId:t.sessionId}});case 7:e.n=9;break;case 8:e.p=8,o=e.v,r.error({message:"[BACKGROUND] Error notifying content on cancel: ".concat(null==o?void 0:o.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 9:if(!t.originalTabId){e.n=13;break}return e.p=10,r.log({message:"[BACKGROUND] Proof generation failed, Notifying original tab on cancel",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=11,chrome.tabs.sendMessage(t.originalTabId,{action:t.MESSAGE_ACTIONS.PROOF_GENERATION_FAILED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{error:"Cancelled by user",sessionId:t.sessionId}});case 11:e.n=13;break;case 12:e.p=12,i=e.v,r.error({message:"[BACKGROUND] Error notifying original tab on cancel: ".concat(null==i?void 0:i.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 13:return e.p=13,r.log({message:"[BACKGROUND] Proof generation failed, Broadcasting to runtime on cancel",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=14,chrome.runtime.sendMessage({action:t.MESSAGE_ACTIONS.PROOF_GENERATION_FAILED,data:{error:"Cancelled by user",sessionId:t.sessionId}});case 14:e.n=16;break;case 15:e.p=15,s=e.v,r.error({message:"[BACKGROUND] Error broadcasting to runtime on cancel: ".concat(null==s?void 0:s.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 16:if(!t.originalTabId){e.n=17;break}try{setTimeout(Ge(De().m(function e(){return De().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,chrome.tabs.update(t.originalTabId,{active:!0});case 1:if(!t.activeTabId){e.n=3;break}return e.n=2,chrome.tabs.remove(t.activeTabId);case 2:t.activeTabId=null;case 3:t.originalTabId=null;case 4:return e.a(2)}},e)})),200)}catch(e){r.error({message:"[BACKGROUND] Error closing tab on cancel: ".concat(null==e?void 0:e.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND})}e.n=21;break;case 17:if(!t.activeTabId){e.n=21;break}return e.p=18,e.n=19,chrome.tabs.remove(t.activeTabId);case 19:t.activeTabId=null,e.n=21;break;case 20:e.p=20,a=e.v,r.error({message:"[BACKGROUND] Error closing active tab on cancel: ".concat(null==a?void 0:a.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 21:t.proofGenerationQueue=[],t.isProcessingQueue=!1,t.providerData=null,t.parameters={},t.providerId=null,t.appId=null,t.sessionId=null,t.callbackUrl=null,t.providerRequestsByHash=new Map,t.managedTabs.clear(),t.activeSessionId=null,e.n=23;break;case 22:e.p=22,c=e.v,t.activeSessionId=null,r.error({message:"[BACKGROUND] Error during cancelSession: ".concat(null==c?void 0:c.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 23:return e.a(2)}},e,null,[[18,20],[13,15],[10,12],[6,8],[2,4],[1,22]])})),$e.apply(this,arguments)}function He(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return Ye(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(Ye(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,Ye(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,Ye(f,"constructor",u),Ye(u,"constructor",c),c.displayName="GeneratorFunction",Ye(u,o,"GeneratorFunction"),Ye(f),Ye(f,o,"Generator"),Ye(f,n,function(){return this}),Ye(f,"toString",function(){return"[object Generator]"}),(He=function(){return{w:i,m:h}})()}function Ye(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Ye=function(e,t,r,n){function i(t,r){Ye(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},Ye(e,t,r,n)}function qe(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function ze(){var e;return e=He().m(function e(t,r,n,o){var i,s,a,c,u,l,f,h,d,p,g,y,m,E,b,v,O,I,A,S,w,R,T,_,N,C,P,L,D,U,G,F,k,B;return He().w(function(e){for(;;)switch(e.p=e.n){case 0:a=r.action,c=r.source,u=r.target,l=r.data,(f=t.bgLogger).setContext({type:x.D_.BACKGROUND,sessionId:t.sessionId||"unknown",providerId:t.providerId||"unknown",appId:t.appId||"unknown"}),e.p=1,G=a,e.n=G===t.MESSAGE_ACTIONS.CONTENT_SCRIPT_LOADED?2:G===t.MESSAGE_ACTIONS.REQUEST_PROVIDER_DATA?4:G===t.MESSAGE_ACTIONS.CHECK_IF_MANAGED_TAB?5:G===t.MESSAGE_ACTIONS.START_VERIFICATION?6:G===t.MESSAGE_ACTIONS.CANCEL_VERIFICATION?12:G===t.MESSAGE_ACTIONS.OFFSCREEN_DOCUMENT_READY?16:G===t.MESSAGE_ACTIONS.CLOSE_CURRENT_TAB?17:G===t.MESSAGE_ACTIONS.FILTERED_REQUEST_FOUND?18:G===t.MESSAGE_ACTIONS.GET_CURRENT_TAB_ID?24:G===t.MESSAGE_ACTIONS.UPDATE_PUBLIC_DATA?25:G===t.MESSAGE_ACTIONS.UPDATE_EXPECT_MANY_CLAIMS?26:G===t.MESSAGE_ACTIONS.GET_PARAMETERS?33:G===t.MESSAGE_ACTIONS.REPORT_PROVIDER_ERROR?34:G===t.MESSAGE_ACTIONS.REQUEST_CLAIM?38:G===t.MESSAGE_ACTIONS.INJECT_VIA_SCRIPTING?46:56;break;case 2:if(c!==t.MESSAGE_SOURCES.CONTENT_SCRIPT||u!==t.MESSAGE_SOURCES.BACKGROUND){e.n=3;break}return d=(null===(h=n.tab)||void 0===h?void 0:h.id)&&t.managedTabs.has(n.tab.id),chrome.tabs.sendMessage(n.tab.id,{action:t.MESSAGE_ACTIONS.SHOULD_INITIALIZE,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{shouldInitialize:d}}).catch(function(e){return f.error({message:"[BACKGROUND] Error sending initialization status: "+(null==e?void 0:e.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND})}),d&&t.initPopupMessage&&t.initPopupMessage.has(n.tab.id)&&(p=t.initPopupMessage.get(n.tab.id),chrome.tabs.sendMessage(n.tab.id,p.message).then(function(){chrome.runtime.lastError&&f.error({message:"[BACKGROUND] Error sending (pending) SHOW_PROVIDER_VERIFICATION_POPUP to tab ".concat(n.tab.id,": ").concat(chrome.runtime.lastError.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.VERIFICATION_POPUP_ERROR})}).catch(function(e){return f.error({message:"[BACKGROUND] Error sending (pending) SHOW_PROVIDER_VERIFICATION_POPUP to tab ".concat(n.tab.id," (promise catch): ").concat(null==e?void 0:e.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.VERIFICATION_POPUP_ERROR})})),d&&t.providerDataMessage&&t.providerDataMessage.has(n.tab.id)&&(g=t.providerDataMessage.get(n.tab.id),chrome.tabs.sendMessage(n.tab.id,g.message).then(function(){chrome.runtime.lastError&&f.error({message:"[BACKGROUND] Error sending (pending) PROVIDER_DATA_READY to tab ".concat(n.tab.id,": ").concat(chrome.runtime.lastError.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.RECLAIM_VERIFICATION_PROVIDER_LOAD_EXCEPTION})}).catch(function(e){return f.error({message:"[BACKGROUND] Error sending (pending) PROVIDER_DATA_READY to tab ".concat(n.tab.id," (promise catch): ").concat(null==e?void 0:e.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.RECLAIM_VERIFICATION_PROVIDER_LOAD_EXCEPTION})}),t.providerDataMessage.delete(n.tab.id)),f.info({message:"[BACKGROUND] Successfully sent (pending) SHOW_PROVIDER_VERIFICATION_POPUP and PROVIDER_DATA_READY to tab ".concat(n.tab.id),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0}),e.a(3,57);case 3:return e.a(3,57);case 4:return c===t.MESSAGE_SOURCES.CONTENT_SCRIPT&&u===t.MESSAGE_SOURCES.BACKGROUND&&(f.setContext({sessionId:t.sessionId||"unknown",providerId:t.providerId||"unknown",appId:t.appId||"unknown",type:x.D_.BACKGROUND}),f.info({message:"[BACKGROUND] Content script requested provider data",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),null!==(y=n.tab)&&void 0!==y&&y.id&&t.managedTabs.has(n.tab.id)&&t.providerData&&t.parameters&&t.sessionId&&void 0!==t.callbackUrl?(f.info({message:"[BACKGROUND] Sending the following provider data to content script: "+JSON.stringify(t.providerData),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0,data:{providerData:t.providerData,parameters:t.parameters||{},sessionId:t.sessionId,callbackUrl:t.callbackUrl,providerId:t.providerId,appId:t.appId}})):(f.error({message:"[BACKGROUND] Provider data not available or tab not managed",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Provider data not available or tab not managed"}))),e.a(3,57);case 5:return c===t.MESSAGE_SOURCES.CONTENT_SCRIPT&&u===t.MESSAGE_SOURCES.BACKGROUND&&(E=(null===(m=n.tab)||void 0===m?void 0:m.id)&&t.managedTabs.has(n.tab.id),f.info({message:"[BACKGROUND] Checking if tab is managed: "+E,logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0,isManaged:E})),e.a(3,57);case 6:if(c!==t.MESSAGE_SOURCES.CONTENT_SCRIPT||u!==t.MESSAGE_SOURCES.BACKGROUND){e.n=10;break}if(f.setContext({sessionId:l.sessionId||t.sessionId||"unknown",providerId:l.providerId||t.providerId||"unknown",appId:l.applicationId||t.appId||"unknown",type:x.D_.BACKGROUND}),f.info({message:"Starting new verification using Reclaim Extension SDK",logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.IS_RECLAIM_EXTENSION_SDK}),f.info({message:"[BACKGROUND] Starting new verification flow with data: "+JSON.stringify(l),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.VERIFICATION_FLOW_STARTED}),t.loggerService.startFlushInterval(),!t.activeSessionId||t.activeSessionId===l.sessionId){e.n=8;break}if(0!==t.managedTabs.size){e.n=7;break}t.activeSessionId=null,e.n=8;break;case 7:return f.error({message:"[BACKGROUND] Another verification is in progress",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Another verification is in progress"}),e.a(3,57);case 8:return t.activeSessionId=l.sessionId||t.activeSessionId,n.tab&&n.tab.id&&(t.originalTabId=n.tab.id),f.info({message:"[BACKGROUND] Starting verification with session id: "+l.sessionId,logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=9,Fe(t,l);case 9:b=e.v,o({success:!0,result:b}),e.n=11;break;case 10:o({success:!1,error:"Action not supported"});case 11:return e.a(3,57);case 12:if(c!==t.MESSAGE_SOURCES.CONTENT_SCRIPT||u!==t.MESSAGE_SOURCES.BACKGROUND){e.n=14;break}return f.info({message:"[BACKGROUND] Cancelling verification with session id: "+(null==l?void 0:l.sessionId),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=13,Ve(t,null==l?void 0:l.sessionId);case 13:o({success:!0}),e.n=15;break;case 14:f.error({message:"[BACKGROUND] CANCEL_VERIFICATION: Action not supported",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Action not supported"});case 15:return e.a(3,57);case 16:return c===t.MESSAGE_SOURCES.OFFSCREEN&&u===t.MESSAGE_SOURCES.BACKGROUND?(f.info({message:"[BACKGROUND] Offscreen document ready",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0})):(f.error({message:"[BACKGROUND] OFFSCREEN_DOCUMENT_READY: Action not supported",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Action not supported"})),e.a(3,57);case 17:return c===t.MESSAGE_SOURCES.CONTENT_SCRIPT&&u===t.MESSAGE_SOURCES.BACKGROUND?n.tab&&n.tab.id?chrome.tabs.remove(n.tab.id,function(){chrome.runtime.lastError?(f.error({message:"[BACKGROUND] Error closing tab: "+chrome.runtime.lastError.message,logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:chrome.runtime.lastError.message})):(t.managedTabs.has(n.tab.id)&&t.managedTabs.delete(n.tab.id),f.info({message:"[BACKGROUND] Tab closed",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0}))}):(f.error({message:"[BACKGROUND] CLOSE_CURRENT_TAB: No tab ID provided by sender.",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"No tab ID found to close."})):o({success:!1,error:"Action not supported"}),e.a(2,!0);case 18:if(c!==t.MESSAGE_SOURCES.CONTENT_SCRIPT||u!==t.MESSAGE_SOURCES.BACKGROUND){e.n=22;break}if(!t.filteredRequests.has(l.criteria.requestHash)){e.n=19;break}f.info({message:"[BACKGROUND] Filtered request found with hash: "+l.criteria.requestHash,logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.FILTERED_REQUEST_FOUND}),o({success:!0,result:t.filteredRequests.get(l.criteria.requestHash)}),e.n=21;break;case 19:return t.filteredRequests.set(l.criteria.requestHash,l.request),e.n=20,t.processFilteredRequest(l.request,l.criteria,l.sessionId,l.loginUrl);case 20:v=e.v,f.info({message:"[BACKGROUND] Filtered request processed with hash: "+l.criteria.requestHash,logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0,result:v});case 21:e.n=23;break;case 22:f.error({message:"[BACKGROUND] FILTERED_REQUEST_FOUND: Action not supported",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Action not supported"});case 23:return e.a(3,57);case 24:return c===t.MESSAGE_SOURCES.CONTENT_SCRIPT&&u===t.MESSAGE_SOURCES.BACKGROUND?(f.info({message:"[BACKGROUND] Getting current tab id: "+(null===(O=n.tab)||void 0===O?void 0:O.id),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0,tabId:null===(I=n.tab)||void 0===I?void 0:I.id})):(f.error({message:"[BACKGROUND] GET_CURRENT_TAB_ID: Action not supported",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Action not supported"})),e.a(3,57);case 25:return null!==(i=n.tab)&&void 0!==i&&i.id&&t.managedTabs.has(n.tab.id)?(f.info({message:"[BACKGROUND] Updating public data: "+(null==l?void 0:l.publicData),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),t.publicData="string"==typeof(null==l?void 0:l.publicData)?l.publicData:null,o({success:!0})):(f.error({message:"[BACKGROUND] UPDATE_PUBLIC_DATA: Tab is not managed by extension",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Tab is not managed by extension"})),e.a(3,57);case 26:if(null===(A=n.tab)||void 0===A||!A.id||!t.managedTabs.has(n.tab.id)){e.n=31;break}if(S=t.expectManyClaims&&!(null!=l&&l.expectMany),t.expectManyClaims=!(null==l||!l.expectMany),f.info({message:"[BACKGROUND] Updating expect many claims: "+(null==l?void 0:l.expectMany),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),!(S&&t.generatedProofs.size>0)){e.n=30;break}return e.p=27,f.info({message:"[BACKGROUND] Turning off expect many claims, Submitting proofs",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=28,t.submitProofs();case 28:e.n=30;break;case 29:e.p=29,e.v;case 30:o({success:!0}),e.n=32;break;case 31:f.error({message:"[BACKGROUND] UPDATE_EXPECT_MANY_CLAIMS: Tab is not managed by extension",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Tab is not managed by extension"});case 32:return e.a(3,57);case 33:return null!==(s=n.tab)&&void 0!==s&&s.id&&t.managedTabs.has(n.tab.id)?(f.info({message:"[BACKGROUND] Getting parameters: "+t.parameters,logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0,parameters:t.parameters||{}})):(f.error({message:"[BACKGROUND] UPDATE_EXPECT_MANY_CLAIMS: Tab is not managed by extension",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Tab is not managed by extension"})),e.a(3,57);case 34:if(null===(w=n.tab)||void 0===w||!w.id||!t.managedTabs.has(n.tab.id)){e.n=36;break}return t.aborted=!0,e.n=35,t.failSession((null==l?void 0:l.message)||"Provider error");case 35:f.info({message:"[BACKGROUND] Provider error reported: "+(null==l?void 0:l.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0}),e.n=37;break;case 36:f.error({message:"[BACKGROUND] REPORT_PROVIDER_ERROR: Tab is not managed by extension",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Tab is not managed by extension"});case 37:return e.a(3,57);case 38:if(c!==t.MESSAGE_SOURCES.CONTENT_SCRIPT||u!==t.MESSAGE_SOURCES.BACKGROUND||null===(R=n.tab)||void 0===R||!R.id||!t.managedTabs.has(n.tab.id)){e.n=44;break}if(e.p=39,t.sessionId||l.sessionId){e.n=40;break}return o({success:!1,error:"Session not initialized"}),e.a(3,57);case 40:return e.n=41,t.processFilteredRequest(l.request,l.criteria,l.sessionId,l.loginUrl||"");case 41:T=e.v,f.info({message:"[BACKGROUND] Request claim processed: "+l.requestHash,logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0,result:T}),e.n=43;break;case 42:e.p=42,F=e.v,f.error({message:"[BACKGROUND] Request claim processing failed: "+(null==F?void 0:F.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:(null==F?void 0:F.message)||String(F)});case 43:e.n=45;break;case 44:f.error({message:"[BACKGROUND] REQUEST_CLAIM: Tab is not managed by extension",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Tab is not managed by extension"});case 45:return e.a(3,57);case 46:if(c!==t.MESSAGE_SOURCES.CONTENT_SCRIPT||u!==t.MESSAGE_SOURCES.BACKGROUND||null===(_=n.tab)||void 0===_||!_.id){e.n=54;break}if(N=n.tab.id,C=null==l?void 0:l.op,e.p=47,"REPLAY_PAGE_FETCH"!==C){e.n=49;break}return f.info({message:"[BACKGROUND] REPLAY_PAGE_FETCH: Executing script",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=48,chrome.scripting.executeScript({target:{tabId:N},world:"MAIN",func:function(e){try{var t=window.location.href,r=new XMLHttpRequest;r.open("GET",t,!0),r.withCredentials=!0,r.setRequestHeader("accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8"),r.setRequestHeader("accept-language","en-GB,en;q=0.5"),r.setRequestHeader("cache-control","no-store"),r.setRequestHeader("x-reclaim-replay","1"),r.onreadystatechange=function(){},r.send(null),null!=e&&e.showAlert&&console.log("Replaying via XHR…",t)}catch(e){console.log("REPLAY_PAGE_FETCH XHR failed:",e&&e.message)}},args:[{showAlert:!(null==l||!l.showAlert)}]});case 48:return f.info({message:"[BACKGROUND] REPLAY_PAGE_FETCH executed in MAIN world (XHR)",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0}),e.a(3,57);case 49:if("RUN_CUSTOM_INJECTION"!==C){e.n=51;break}return L=String((null==l?void 0:l.code)||""),e.n=50,chrome.scripting.executeScript({target:{tabId:n.tab.id},world:"MAIN",func:function(e){try{var t=String((null==e?void 0:e.code)||"");return t?window.__reclaimCustomInjectionDone__?{status:"skipped",reason:"already_injected"}:function(){try{var e=(document.querySelector("script[nonce]")||{}).nonce;if(!e)return!1;var r=document.createElement("script");return r.setAttribute("nonce",e),r.textContent=t,(document.documentElement||document.head||document).appendChild(r),r.remove(),!0}catch(e){return!1}}()||function(){try{if(!window.trustedTypes)return!1;for(var e=(document.querySelector("script[nonce]")||{}).nonce||"",r=0,n=["reclaim-extension-sdk","reclaim","default","policy","app"];r<n.length;r++){var o=n[r];try{var i=window.trustedTypes.createPolicy(o,{createScript:function(e){return e}}),s=document.createElement("script");return e&&s.setAttribute("nonce",e),s.text=i.createScript(t),(document.documentElement||document.head||document).appendChild(s),s.remove(),!0}catch(e){}}return!1}catch(e){return!1}}()||function(){try{var e=document.createElement("script");return e.textContent=t,(document.documentElement||document.head||document).appendChild(e),e.remove(),!0}catch(e){return!1}}()?(window.__reclaimCustomInjectionDone__=!0,{status:"executed"}):{status:"error",reason:"all_strategies_failed"}:{status:"skipped",reason:"no_code"}}catch(e){return{status:"error",reason:String((null==e?void 0:e.message)||e)}}},args:[{code:L}]});case 50:return D=e.v,U=null==D||null===(P=D[0])||void 0===P?void 0:P.result,f.info({message:"[BACKGROUND] RUN_CUSTOM_INJECTION result: "+JSON.stringify(U),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,meta:{result:U}}),o({success:!0,result:U}),e.a(3,57);case 51:e.n=53;break;case 52:e.p=52,k=e.v,f.error({message:"[BACKGROUND] INJECT_VIA_SCRIPTING failed: "+(null==k?void 0:k.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,meta:{e:k}}),o({success:!1,error:(null==k?void 0:k.message)||String(k)});case 53:e.n=55;break;case 54:o({success:!1,error:"Action not supported"});case 55:return e.a(3,57);case 56:f.error({message:"[BACKGROUND] DEFAULT: Action not supported",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Action not supported"});case 57:e.n=59;break;case 58:e.p=58,B=e.v,f.error({message:"[BACKGROUND] Error handling "+a+": "+(null==B?void 0:B.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,meta:{error:B}}),o({success:!1,error:B.message});case 59:return e.a(2,!0)}},e,null,[[47,52],[39,42],[27,29],[1,58]])}),ze=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){qe(i,n,o,s,a,"next",e)}function a(e){qe(i,n,o,s,a,"throw",e)}s(void 0)})},ze.apply(this,arguments)}function We(e){return We="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},We(e)}function Je(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return Xe(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(Xe(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,Xe(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,Xe(f,"constructor",u),Xe(u,"constructor",c),c.displayName="GeneratorFunction",Xe(u,o,"GeneratorFunction"),Xe(f),Xe(f,o,"Generator"),Xe(f,n,function(){return this}),Xe(f,"toString",function(){return"[object Generator]"}),(Je=function(){return{w:i,m:h}})()}function Xe(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Xe=function(e,t,r,n){function i(t,r){Xe(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},Xe(e,t,r,n)}function Qe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Ze(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qe(Object(r),!0).forEach(function(t){et(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qe(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function et(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=We(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=We(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==We(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tt(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function rt(e,t,r){e.proofGenerationQueue.push({claimData:t,requestHash:r}),e.isProcessingQueue||(e.sessionTimerManager.pauseSessionTimer(),nt(e))}function nt(e){return ot.apply(this,arguments)}function ot(){var e;return e=Je().m(function e(t){var r,n,o,i,s,a,c,u,l,f,h;return Je().w(function(e){for(;;)switch(e.p=e.n){case 0:if((r=t.bgLogger).setContext({sessionId:t.sessionId||"unknown",providerId:t.providerId||"unknown",appId:t.appId||"unknown",type:x.D_.BACKGROUND}),!t.aborted){e.n=1;break}return r.info({message:"[BACKGROUND] Proof generation queue aborted",logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.RECLAIM_VERIFICATION_DISMISSED}),e.a(2);case 1:if(!t.isProcessingQueue&&0!==t.proofGenerationQueue.length){e.n=3;break}if(0!==t.proofGenerationQueue.length){e.n=2;break}return(o=Array.isArray(null===(n=t.providerData)||void 0===n?void 0:n.requestData)?t.providerData.requestData.length:0)>0?t.providerData.requestData.filter(function(e){return t.generatedProofs.has(e.requestHash)}).length===o?(t.sessionTimerManager.clearAllTimers(),t.expectManyClaims||setTimeout(function(){return t.submitProofs()},0)):t.sessionTimerManager.resumeSessionTimer():(t.sessionTimerManager.clearAllTimers(),t.expectManyClaims||setTimeout(function(){return t.submitProofs()},0)),e.a(2);case 2:t.sessionTimerManager.resumeSessionTimer();case 3:if(t.isProcessingQueue=!0,i=t.proofGenerationQueue.shift(),e.p=4,!t.aborted){e.n=5;break}return r.info({message:"[BACKGROUND] Proof generation aborted",logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.PROOF_GENERATION_ABORTED}),e.a(2);case 5:return chrome.tabs.sendMessage(t.activeTabId,{action:t.MESSAGE_ACTIONS.PROOF_GENERATION_STARTED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{requestHash:i.requestHash}}),r.info({message:"[BACKGROUND] Proof generation started for request hash: "+i.requestHash,logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=6,t.generateProof(Ze(Ze({},i.claimData),{},{publicData:null!==(s=t.publicData)&&void 0!==s?s:null}),r);case 6:if(a=e.v,!t.aborted){e.n=7;break}return r.info({message:"[BACKGROUND] Proof generation aborted",logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.PROOF_GENERATION_ABORTED}),e.a(2);case 7:if(a.success){e.n=8;break}return r.error({message:"[BACKGROUND] Proof generation failed for request hash: "+i.requestHash+": "+a.error,logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),t.failSession("Proof generation failed: "+a.error,i.requestHash),e.a(2);case 8:(c=a.proof)&&(t.generatedProofs.has(i.requestHash)||t.generatedProofs.set(i.requestHash,c),r.info({message:"[BACKGROUND] Proof generation successful for request hash: "+i.requestHash,logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),chrome.tabs.sendMessage(t.activeTabId,{action:t.MESSAGE_ACTIONS.PROOF_GENERATION_SUCCESS,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{requestHash:i.requestHash}}),t.sessionTimerManager.resetSessionTimer()),e.n=10;break;case 9:return e.p=9,h=e.v,r.error({message:"[BACKGROUND] Proof generation failed for request hash: "+i.requestHash+": "+(null==h?void 0:h.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),t.failSession("Proof generation failed: "+h.message,i.requestHash),e.a(2);case 10:if(e.p=10,t.isProcessingQueue=!1,!t.aborted){e.n=11;break}return e.a(2);case 11:return t.proofGenerationQueue.length>0?nt(t):(l=Array.isArray(null===(u=t.providerData)||void 0===u?void 0:u.requestData)?t.providerData.requestData.length:0)>0?(f=t.providerData.requestData.filter(function(e){return t.generatedProofs.has(e.requestHash)}).length,t.sessionTimerManager.clearAllTimers(),f===l?t.expectManyClaims||setTimeout(function(){return t.submitProofs()},0):t.sessionTimerManager.resumeSessionTimer()):(t.sessionTimerManager.clearAllTimers(),t.expectManyClaims||setTimeout(function(){return t.submitProofs()},0)),e.f(10);case 12:return e.a(2)}},e,null,[[4,9,10,12]])}),ot=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){tt(i,n,o,s,a,"next",e)}function a(e){tt(i,n,o,s,a,"throw",e)}s(void 0)})},ot.apply(this,arguments)}function it(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ut(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw i}}}}function st(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return at(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(at(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,at(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,at(f,"constructor",u),at(u,"constructor",c),c.displayName="GeneratorFunction",at(u,o,"GeneratorFunction"),at(f),at(f,o,"Generator"),at(f,n,function(){return this}),at(f,"toString",function(){return"[object Generator]"}),(st=function(){return{w:i,m:h}})()}function at(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}at=function(e,t,r,n){function i(t,r){at(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},at(e,t,r,n)}function ct(e){return function(e){if(Array.isArray(e))return lt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ut(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ut(e,t){if(e){if("string"==typeof e)return lt(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?lt(e,t):void 0}}function lt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ft(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function ht(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){ft(i,n,o,s,a,"next",e)}function a(e){ft(i,n,o,s,a,"throw",e)}s(void 0)})}}function dt(e,t){return pt.apply(this,arguments)}function pt(){return pt=ht(st().m(function e(t,r){var n,o,i,s,a,c,u,l,f,h,d,p,g,y,m,E,b,v,O,I,A,S,w,R,T,_,N,C,P,L,D,U,G,F,k,B,M,j,K,V,$,H,Y,q,z,W,J,X;return st().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,chrome.cookies&&chrome.cookies.getAll){e.n=1;break}return r.info({message:"[BACKGROUND] Chrome cookies API not available",logLevel:x.E$.INFO,type:x.D_.BACKGROUND,meta:{url:t}}),e.a(2,null);case 1:return n=new URL(t),o=n.hostname,i="https:"===n.protocol,s=Date.now()/1e3,a=function(e){var t=e.split(".");if(t.length<=2)return e;var r=new Set(["co.uk","ac.uk","gov.uk","co.in","com.au","com.br","com.mx","com.sg"]),n=t.slice(-2).join("."),o=t.slice(-3).join(".");return r.has(n)?t.slice(-3).join("."):r.has(o)?t.slice(-4).join("."):t.slice(-2).join(".")},c=function(e){var t=a(e),r=new Set;return r.add("https://".concat(e)),r.add("https://".concat(t)),r.add("https://www.".concat(t)),ct(r)},u=function(e){var t=e.split("."),r=new Set;r.add(e);for(var n=1;n<t.length;n++)r.add(t.slice(n).join(".")),r.add("."+t.slice(n).join("."));return ct(r)},l=function(){var e=ht(st().m(function e(){var t;return st().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,chrome.cookies.getAllCookieStores();case 1:return t=e.v,e.a(2,Array.isArray(t)&&t.length?t:[{id:void 0}]);case 2:return e.p=2,e.v,e.a(2,[{id:void 0}])}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),f=function(){var e=ht(st().m(function e(t){var n;return st().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,chrome.cookies.getAll(t);case 1:return e.a(2,e.v);case 2:return e.p=2,n=e.v,r.info({message:"[BACKGROUND] cookies.getAll failed for details: ",logLevel:x.E$.INFO,type:x.D_.BACKGROUND,meta:{details:t,error:null==n?void 0:n.message}}),e.a(2,[])}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),h=function(e,t,r){if(!t)return!1;if(r)return e===t;var n=t.startsWith(".")?t.slice(1):t;return e===n||e.endsWith("."+n)},d=function(e,t){return!t||"/"===t||!!e.startsWith(t)&&(e.length===t.length||(!!t.endsWith("/")||"/"===e.charAt(t.length)))},p=function(e){return gt(e,n,r)},g=function(e,t){var r,n,o,i;if(!!e.hostOnly!=!!t.hostOnly)return e.hostOnly?e:t;if(((null===(r=e.path)||void 0===r?void 0:r.length)||0)!==((null===(n=t.path)||void 0===n?void 0:n.length)||0))return((null===(o=e.path)||void 0===o?void 0:o.length)||0)>((null===(i=t.path)||void 0===i?void 0:i.length)||0)?e:t;var s=e.expirationDate||0,a=t.expirationDate||0;if(s!==a)return s>a?e:t;var c=e.lastAccessed||0,u=t.lastAccessed||0;return c!==u?c>u?e:t:e},y=[],e.n=2,l();case 2:m=e.v,E=[],b=function(e){var t=JSON.stringify(e);E.some(function(e){return JSON.stringify(e)===t})||E.push(e)},v=u(o),O=c(o),I=it(m);try{for(I.s();!(A=I.n()).done;){S=A.value.id,w=it(v);try{for(w.s();!(R=w.n()).done;)T=R.value,b({domain:T,storeId:S})}catch(e){w.e(e)}finally{w.f()}b({url:t,storeId:S}),_=it(v);try{for(_.s();!(N=_.n()).done;){C=N.value,P=it(O);try{for(P.s();!(L=P.n()).done;)D=L.value,b({domain:C,partitionKey:{topLevelSite:D},storeId:S})}catch(e){P.e(e)}finally{P.f()}}}catch(e){_.e(e)}finally{_.f()}U=it(O);try{for(U.s();!(G=U.n()).done;)F=G.value,b({url:t,partitionKey:{topLevelSite:F},storeId:S})}catch(e){U.e(e)}finally{U.f()}}}catch(e){I.e(e)}finally{I.f()}return e.n=3,Promise.all(E.map(function(e){return f(e)}));case 3:k=e.v,B=it(k);try{for(B.s();!(M=B.n()).done;)j=M.value,y.push.apply(y,ct(j))}catch(e){B.e(e)}finally{B.f()}K=function(e){var t;return[e.name,e.domain||"",e.path||"",(null===(t=e.partitionKey)||void 0===t?void 0:t.topLevelSite)||""].join("|")},V=new Map,$=0,H=y;case 4:if(!($<H.length)){e.n=7;break}if(Y=H[$],p(Y)){e.n=5;break}return e.a(3,6);case 5:q=K(Y),z=V.get(q),V.set(q,z?g(z,Y):Y);case 6:$++,e.n=4;break;case 7:if(0!==(W=ct(V.values())).length){e.n=8;break}return e.a(2,null);case 8:return W.sort(function(e,t){var r=function(e){return e?e.length:0};if(r(e.path)!==r(t.path))return r(t.path)-r(e.path);if(!!e.hostOnly!=!!t.hostOnly)return e.hostOnly?-1:1;var n=e.expirationDate||0;return(t.expirationDate||0)-n}),J=W.map(function(e){return"".concat(e.name,"=").concat(e.value)}).join("; "),e.a(2,J||null);case 9:return e.p=9,X=e.v,r.error({message:"[BACKGROUND] Error getting cookies for URL: "+(null==X?void 0:X.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,meta:{error:null==X?void 0:X.message}}),e.a(2,null)}},e,null,[[0,9]])})),pt.apply(this,arguments)}function gt(e,t,r){try{var n=e.domain.startsWith(".")?e.domain.substring(1):e.domain,o=t.hostname;if(!(o===n||o.endsWith("."+n)||e.domain.startsWith(".")&&o.endsWith(e.domain.substring(1))))return!1;var i=e.path||"/";if(!t.pathname.startsWith(i))return!1;var s="https:"===t.protocol;return!(e.secure&&!s)&&!(e.expirationDate&&e.expirationDate<Date.now()/1e3)}catch(e){return r.info({message:"[BACKGROUND] Error checking cookie inclusion: "+(null==e?void 0:e.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,meta:{error:null==e?void 0:e.message}}),!1}}function yt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return mt(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(mt(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,mt(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,mt(f,"constructor",u),mt(u,"constructor",c),c.displayName="GeneratorFunction",mt(u,o,"GeneratorFunction"),mt(f),mt(f,o,"Generator"),mt(f,n,function(){return this}),mt(f,"toString",function(){return"[object Generator]"}),(yt=function(){return{w:i,m:h}})()}function mt(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}mt=function(e,t,r,n){function i(t,r){mt(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},mt(e,t,r,n)}function Et(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function bt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Et(Object(r),!0).forEach(function(t){vt(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Et(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function vt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=At(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=At(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==At(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ot(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function It(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){Ot(i,n,o,s,a,"next",e)}function a(e){Ot(i,n,o,s,a,"throw",e)}s(void 0)})}}function At(e){return At="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},At(e)}var St=(0,i.y8)({sessionId:"unknown",providerId:"unknown",appId:"unknown",source:"reclaim-extension-sdk"});function wt(){"undefined"!=typeof chrome&&chrome.runtime&&chrome.runtime.onMessage&&chrome.runtime.onMessage.addListener&&chrome.runtime.onMessage.hasListener&&(chrome.runtime.onMessage.hasListener(I)||chrome.runtime.onMessage.addListener(I));var e={activeTabId:null,providerData:null,parameters:{},providerId:null,appId:null,sessionId:null,callbackUrl:null,publicData:null,aborted:!1,expectManyClaims:!1,originalTabId:null,managedTabs:new Set,providerRequestsByHash:new Map,generatedProofs:new Map,filteredRequests:new Map,proofGenerationQueue:[],isProcessingQueue:!1,firstRequestReceived:!1,initPopupMessage:new Map,providerDataMessage:new Map,activeSessionId:null,sessionTimerManager:new Se,fetchProviderData:f,updateSessionStatus:h,submitProofOnCallback:d,RECLAIM_SESSION_STATUS:o.Ew,MESSAGE_ACTIONS:o.wx,MESSAGE_SOURCES:o.J_,generateProof:D,formatProof:U.c,createClaimObject:ve,loggerService:i.Ow,bgLogger:St,debugLogger:x.w9,DebugLogType:x.Ey,processFilteredRequest:null,failSession:null,submitProofs:null};St.setContext({sessionId:e.sessionId||"unknown",providerId:e.providerId||"unknown",appId:e.appId||"unknown",type:s.LOG_TYPES.BACKGROUND});try{var t=r(859).LOG_CONFIG_STORAGE_KEY;chrome.storage.local.get([t],function(r){var n=null==r?void 0:r[t];n&&"object"===At(n)&&e.loggerService.setConfig(n)}),chrome.storage.onChanged.addListener(function(r,n){if("local"===n&&r[t]){var o=r[t].newValue||{};e.loggerService.setConfig(o)}})}catch(e){}return St.info({message:"Background initialized INFO",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND}),e.failSession=function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return Be.apply(n,[e].concat(r))},e.submitProofs=function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return je.apply(n,[e].concat(r))},e.processFilteredRequest=function(){var t=It(yt().m(function t(r,n,o,i){var a,c,u,l,f,h,d,p;return yt().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,o=e.sessionId||o){t.n=1;break}return e.failSession("Session not initialized for claim request",null==n?void 0:n.requestHash),t.a(2,{success:!1,error:"Session not initialized"});case 1:return e.firstRequestReceived||(e.firstRequestReceived=!0,e.sessionTimerManager.startSessionTimer()),St.setContext({sessionId:e.sessionId||"unknown",providerId:e.providerId||"unknown",appId:e.appId||"unknown",type:s.LOG_TYPES.BACKGROUND}),St.info({message:"[BACKGROUND] Filtering request for request hash: ".concat(n.requestHash),logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND}),t.n=2,dt(r.url,e.bgLogger);case 2:return(a=t.v)&&(r.cookieStr=a),St.log({message:"[BACKGROUND] Cookies for URL: ".concat(r.url),logLevel:s.LOG_LEVEL.ALL,type:s.LOG_TYPES.BACKGROUND,meta:{request:r,criteria:n,sessionId:o,loginUrl:i,cookies:a}}),chrome.tabs.sendMessage(e.activeTabId,{action:e.MESSAGE_ACTIONS.CLAIM_CREATION_REQUESTED,source:e.MESSAGE_SOURCES.BACKGROUND,target:e.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{requestHash:n.requestHash}}),St.info({message:"[BACKGROUND] Claim creation requested for request hash: "+n.requestHash,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND,eventType:s.EVENT_TYPES.STARTING_CLAIM_CREATION}),c=null,t.p=3,f=bt(bt({},n),{},{geoLocation:null!==(u=null===(l=e.providerData)||void 0===l?void 0:l.geoLocation)&&void 0!==u?u:""}),t.n=4,e.createClaimObject(r,f,o,e.providerId,i,e.bgLogger);case 4:c=t.v,t.n=6;break;case 5:return t.p=5,d=t.v,St.error({message:"[BACKGROUND] Error creating claim object: "+d.message,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND}),chrome.tabs.sendMessage(e.activeTabId,{action:e.MESSAGE_ACTIONS.CLAIM_CREATION_FAILED,source:e.MESSAGE_SOURCES.BACKGROUND,target:e.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{requestHash:n.requestHash}}),e.failSession("Claim creation failed: "+d.message,n.requestHash),t.a(2,{success:!1,error:d.message});case 6:return c&&(chrome.tabs.sendMessage(e.activeTabId,{action:e.MESSAGE_ACTIONS.CLAIM_CREATION_SUCCESS,source:e.MESSAGE_SOURCES.BACKGROUND,target:e.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{requestHash:n.requestHash}}),St.info({message:"[BACKGROUND] Claim Object creation successful for request hash: "+n.requestHash,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND})),(h={url:(null==n?void 0:n.url)||(null==r?void 0:r.url)||"",expectedPageUrl:(null==n?void 0:n.expectedPageUrl)||"",urlType:(null==n?void 0:n.urlType)||"EXACT",method:(null==n?void 0:n.method)||(null==r?void 0:r.method)||"GET",responseMatches:Array.isArray(null==n?void 0:n.responseMatches)?n.responseMatches:[],responseRedactions:Array.isArray(null==n?void 0:n.responseRedactions)?n.responseRedactions:[],requestHash:null==n?void 0:n.requestHash}).requestHash&&e.providerRequestsByHash.set(h.requestHash,h),rt(e,c,n.requestHash),St.info({message:"[BACKGROUND] Proof generation queued for request hash: "+n.requestHash,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND}),t.a(2,{success:!0,message:"Proof generation queued"});case 7:return t.p=7,p=t.v,St.error({message:"[BACKGROUND] Error processing filtered request: "+p.message,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND}),e.failSession("Error processing request: "+p.message,n.requestHash),t.a(2,{success:!1,error:p.message})}},t,null,[[3,5],[0,7]])}));return function(e,r,n,o){return t.apply(this,arguments)}}(),e.sessionTimerManager.setCallbacks(e.failSession),e.sessionTimerManager.setTimerDuration(3e4),chrome.runtime.onMessage.addListener(function(t,r,n){return function(e,t,r,n){ze.apply(this,arguments)}(e,t,r,n),!0}),chrome.tabs.onRemoved.addListener(function(){var t=It(yt().m(function t(r){var n,o;return yt().w(function(t){for(;;)switch(t.p=t.n){case 0:if(e.managedTabs.has(r)&&e.managedTabs.delete(r),n=r===e.activeTabId,o=0===e.managedTabs.size,!e.activeSessionId||!n&&!o||e.aborted){t.n=4;break}return e.aborted=!0,t.p=1,St.error({message:"[BACKGROUND] Verification tab closed by user",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND,sessionId:e.activeSessionId||e.sessionId||"unknown",providerId:e.providerId||"unknown",appId:e.appId||"unknown",eventType:s.EVENT_TYPES.RECLAIM_VERIFICATION_DISMISSED}),t.n=2,e.failSession("Verification tab closed by user");case 2:t.n=4;break;case 3:t.p=3,t.v;case 4:n&&(e.activeTabId=null),o&&(e.originalTabId=null,e.activeSessionId=null);case 5:return t.a(2)}},t,null,[[1,3]])}));return function(e){return t.apply(this,arguments)}}()),St.info({message:"[BACKGROUND] 🚀 Background initialization complete",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND}),e}},379(e,t,r){"use strict";function n(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",s=r.toStringTag||"@@toStringTag";function a(r,n,i,s){var a=n&&n.prototype instanceof u?n:u,l=Object.create(a.prototype);return o(l,"_invoke",function(r,n,o){var i,s,a,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,s=0,a=e,h.n=r,c}};function d(r,n){for(s=r,a=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(a=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(s=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,s=0))}if(o||r>1)return c;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),s=l,a=p;(t=s<2?e:a)||!f;){i||(s?s<3?(s>1&&(h.n=-1),d(s,a)):h.n=a:h.v=a);try{if(u=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,a)))throw TypeError("iterator result is not an object");if(!t.done)return t;a=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(f=h.n<0)?a:r.call(n,h))!==c)break}catch(t){i=e,s=1,a=t}finally{u=1}}return{value:t,done:f}}}(r,i,s),!0),l}var c={};function u(){}function l(){}function f(){}t=Object.getPrototypeOf;var h=[][i]?t(t([][i]())):(o(t={},i,function(){return this}),t),d=f.prototype=u.prototype=Object.create(h);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,o(e,s,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=f,o(d,"constructor",f),o(f,"constructor",l),l.displayName="GeneratorFunction",o(f,s,"GeneratorFunction"),o(d),o(d,s,"Generator"),o(d,i,function(){return this}),o(d,"toString",function(){return"[object Generator]"}),(n=function(){return{w:a,m:p}})()}function o(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}o=function(e,t,r,n){function s(t,r){o(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(s("next",0),s("throw",1),s("return",2))},o(e,t,r,n)}function i(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}r.d(t,{C:()=>s});var s=function(){var e,t=(e=n().m(function e(){var t,r,o,i,s;return n().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,fetch("https://ipapi.co/json/");case 1:return r=e.v,e.n=2,r.json();case 2:if(o=e.v,200===(null==r?void 0:r.status)){e.n=3;break}throw new Error("Failed to get user location based on IP");case 3:return i=null!==(t=null==o?void 0:o.country_code)&&void 0!==t?t:"US",e.a(2,i);case 4:return e.p=4,s=e.v,console.error("Error getting user location based on IP:",s),e.a(2,"US")}},e,null,[[0,4]])}),function(){var t=this,r=arguments;return new Promise(function(n,o){var s=e.apply(t,r);function a(e){i(s,n,o,a,c,"next",e)}function c(e){i(s,n,o,a,c,"throw",e)}a(void 0)})});return function(){return t.apply(this,arguments)}}()},952(e,t,r){"use strict";r.d(t,{Sn:()=>o,fn:()=>n,wx:()=>c,J_:()=>a,vQ:()=>i,Ew:()=>s});var n="http://localhost:8001",o={PROVIDER_URL:function(e){return"".concat(n,"/api/providers/").concat(e)},SUBMIT_PROOF:function(e){return"".concat(n,"/session/").concat(e,"/proof")},UPDATE_SESSION_STATUS:function(){return"".concat(n,"/api/sdk/update/session/")},STATUS_URL:function(e){return"".concat(n,"/api/sdk/session/").concat(e)}},i={CHECK_EXTENSION:"JOCLAIM_EXTENSION_CHECK",EXTENSION_RESPONSE:"JOCLAIM_EXTENSION_RESPONSE",START_VERIFICATION:"JOCLAIM_START_VERIFICATION",VERIFICATION_STARTED:"JOCLAIM_VERIFICATION_STARTED",VERIFICATION_COMPLETED:"JOCLAIM_VERIFICATION_COMPLETED",VERIFICATION_FAILED:"JOCLAIM_VERIFICATION_FAILED",CANCEL_VERIFICATION:"JOCLAIM_CANCEL_VERIFICATION",SET_PUBLIC_DATA:"JOCLAIM_SET_PUBLIC_DATA",PARAMETERS_UPDATE:"JOCLAIM_PARAMETERS_UPDATE",PARAMETERS_GET:"JOCLAIM_PARAMETERS_GET",REPORT_PROVIDER_ERROR:"JOCLAIM_REPORT_PROVIDER_ERROR",SET_EXPECT_MANY_CLAIMS:"JOCLAIM_SET_EXPECT_MANY_CLAIMS",REQUEST_CLAIM:"JOCLAIM_REQUEST_CLAIM",SET_LOG_CONFIG:"JOCLAIM_SET_LOG_CONFIG",SET_PARAMETERS:"JOCLAIM_SET_PARAMETERS"},s={SESSION_INIT:"SESSION_INIT",SESSION_STARTED:"SESSION_STARTED",USER_INIT_VERIFICATION:"USER_INIT_VERIFICATION",USER_STARTED_VERIFICATION:"USER_STARTED_VERIFICATION",PROOF_GENERATION_STARTED:"PROOF_GENERATION_STARTED",PROOF_GENERATION_SUCCESS:"PROOF_GENERATION_SUCCESS",PROOF_GENERATION_FAILED:"PROOF_GENERATION_FAILED",PROOF_SUBMITTED:"PROOF_SUBMITTED",PROOF_SUBMISSION_FAILED:"PROOF_SUBMISSION_FAILED",PROOF_MANUAL_VERIFICATION_SUBMITED:"PROOF_MANUAL_VERIFICATION_SUBMITED"},a={CONTENT_SCRIPT:"content-script",BACKGROUND:"background",OFFSCREEN:"offscreen"},c={START_VERIFICATION:"START_VERIFICATION",CANCEL_VERIFICATION:"CANCEL_VERIFICATION",GENERATE_PROOF_REQUEST:"GENERATE_PROOF_REQUEST",CLAIM_CREATION_REQUESTED:"CLAIM_CREATION_REQUESTED",CLAIM_CREATION_SUCCESS:"CLAIM_CREATION_SUCCESS",CLAIM_CREATION_FAILED:"CLAIM_CREATION_FAILED",PROOF_GENERATION_STARTED:"PROOF_GENERATION_STARTED",PROOF_GENERATION_SUCCESS:"PROOF_GENERATION_SUCCESS",PROOF_GENERATION_FAILED:"PROOF_GENERATION_FAILED",PROOF_SUBMITTED:"PROOF_SUBMITTED",PROOF_SUBMISSION_FAILED:"PROOF_SUBMISSION_FAILED",GENERATE_PROOF:"GENERATE_PROOF",GENERATED_PROOF_RESPONSE:"GENERATED_PROOF_RESPONSE",GENERATE_CLAIM_ON_ATTESTOR:"GENERATE_CLAIM_ON_ATTESTOR",GET_PRIVATE_KEY:"GET_PRIVATE_KEY",GET_PRIVATE_KEY_RESPONSE:"GET_PRIVATE_KEY_RESPONSE",SHOW_PROVIDER_VERIFICATION_POPUP:"SHOW_PROVIDER_VERIFICATION_POPUP",OFFSCREEN_DOCUMENT_READY:"OFFSCREEN_DOCUMENT_READY",GENERATE_PROOF_RESPONSE:"GENERATE_PROOF_RESPONSE",PING_OFFSCREEN:"PING_OFFSCREEN",CLOSE_CURRENT_TAB:"CLOSE_CURRENT_TAB",GET_CURRENT_TAB_ID:"GET_CURRENT_TAB_ID",REQUEST_PROVIDER_DATA:"REQUEST_PROVIDER_DATA",PROVIDER_DATA_READY:"PROVIDER_DATA_READY",CONTENT_SCRIPT_LOADED:"CONTENT_SCRIPT_LOADED",SHOULD_INITIALIZE:"SHOULD_INITIALIZE",CHECK_IF_MANAGED_TAB:"CHECK_IF_MANAGED_TAB",FILTERED_REQUEST_FOUND:"FILTERED_REQUEST_FOUND",INTERCEPTED_REQUEST_AND_RESPONSE:"INTERCEPTED_REQUEST_AND_RESPONSE",UPDATE_PUBLIC_DATA:"UPDATE_PUBLIC_DATA",UPDATE_EXPECT_MANY_CLAIMS:"UPDATE_EXPECT_MANY_CLAIMS",GET_PARAMETERS:"GET_PARAMETERS",REPORT_PROVIDER_ERROR:"REPORT_PROVIDER_ERROR",REQUEST_CLAIM:"REQUEST_CLAIM",INJECT_VIA_SCRIPTING:"INJECT_VIA_SCRIPTING"}},770(e,t,r){"use strict";r.d(t,{y8:()=>I,Ow:()=>O});var n=r(859);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}}function s(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==o(t)?t:t+""}var a=function(){function e(t){var r=t.sessionId,n=t.providerId,o=t.appId,i=t.logLine,s=t.type,a=t.eventType,c=t.logLevel,u=t.source,l=t.tabId,f=t.url,h=t.meta,d=t.time,p=void 0===d?null:d,g=t.deviceId;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.sessionId=r,this.providerId=n,this.appId=o,this.logLine=i,this.type=s,this.eventType=a,this.logLevel=c,this.source=u,this.tabId=l,this.url=f,this.meta=h||void 0,this.time=p||new Date,this.deviceId=g}return t=e,n=[{key:"fromDateTimeToTimeStamp",value:function(e){return(1e6*e.getTime()).toString()}}],(r=[{key:"toJson",value:function(){var t={logLine:this.logLine,ts:e.fromDateTimeToTimeStamp(this.time),logLevel:this.logLevel,sessionId:this.sessionId,providerId:this.providerId,appId:this.appId,source:this.source,deviceId:this.deviceId};return this.type&&(t.type=this.type),this.eventType&&(t.eventType=this.eventType),this.tabId&&(t.tabId=this.tabId),this.url&&(t.url=this.url),this.meta&&(t.meta=this.meta),t}}])&&i(t.prototype,r),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,n}();function c(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function l(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return f(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var h=[][n]?t(t([][n]())):(f(t={},n,function(){return this}),t),d=u.prototype=a.prototype=Object.create(h);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,f(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=u,f(d,"constructor",u),f(u,"constructor",c),c.displayName="GeneratorFunction",f(u,o,"GeneratorFunction"),f(d),f(d,o,"Generator"),f(d,n,function(){return this}),f(d,"toString",function(){return"[object Generator]"}),(l=function(){return{w:i,m:p}})()}function f(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}f=function(e,t,r,n){function i(t,r){f(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},f(e,t,r,n)}function h(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function d(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){h(i,n,o,s,a,"next",e)}function a(e){h(i,n,o,s,a,"throw",e)}s(void 0)})}}function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?g(Object(r),!0).forEach(function(t){m(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function m(e,t,r){return(t=b(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function E(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,b(n.key),n)}}function b(e){var t=function(e,t){if("object"!=p(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=p(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==p(t)?t:t+""}var v=function(){return e=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.logs=[],this.isSending=!1,this.maxBatchSize=20,this.flushInterval=5e3,this.flushIntervalId=null,this.config=y({},n.DEFAULT_LOG_CONFIG),this.deviceId=null;try{var r;"undefined"!=typeof chrome&&null!==(r=chrome.storage)&&void 0!==r&&r.local&&(chrome.storage.local.get([n.LOG_CONFIG_STORAGE_KEY],function(e){var r=null==e?void 0:e[n.LOG_CONFIG_STORAGE_KEY];r&&"object"===p(r)&&t.setConfig(r)}),chrome.storage.onChanged.addListener(function(e,r){if("local"===r&&e[n.LOG_CONFIG_STORAGE_KEY]){var o=e[n.LOG_CONFIG_STORAGE_KEY].newValue||{};t.setConfig(o)}}))}catch(e){}this.startFlushInterval()},t=[{key:"setConfig",value:function(e){this.config=y(y({},this.config),e)}},{key:"startFlushInterval",value:function(){var e=this;this.flushIntervalId&&clearInterval(this.flushIntervalId),this.flushIntervalId=setInterval(function(){return e.flush()},this.flushInterval)}},{key:"stopFlushInterval",value:function(){this.flushIntervalId&&(clearInterval(this.flushIntervalId),this.flushIntervalId=null)}},{key:"getDeviceLoggingId",value:(s=d(l().m(function e(){var t;return l().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!this.deviceId){e.n=1;break}return e.a(2,this.deviceId);case 1:if(e.p=1,"undefined"==typeof chrome||!chrome.storage){e.n=3;break}return e.n=2,chrome.storage.local.get(["reclaim_device_id"]);case 2:if(!(t=e.v).reclaim_device_id){e.n=3;break}return this.deviceId=t.reclaim_device_id,e.a(2,this.deviceId);case 3:e.n=5;break;case 4:e.p=4,e.v;case 5:if(this.deviceId="undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():String(Date.now()),e.p=6,"undefined"==typeof chrome||!chrome.storage){e.n=7;break}return e.n=7,chrome.storage.local.set({reclaim_device_id:this.deviceId});case 7:e.n=9;break;case 8:e.p=8,e.v;case 9:return e.a(2,this.deviceId)}},e,this,[[6,8],[1,4]])})),function(){return s.apply(this,arguments)})},{key:"addLog",value:function(e){this.logs.push(e),this.logs.length>=this.maxBatchSize&&this.flush()}},{key:"shouldLog",value:function(e){return e<=(n.LOG_LEVEL_MAP[this.config.logLevel]||n.LOG_LEVEL.INFO)}},{key:"emitToConsole",value:function(e,t,r){var n="[".concat(e,"]"),o="".concat(n," ").concat(t);r?console.log(o,r):console.log(o)}},{key:"log",value:function(e){var t=e.message,r=e.logLevel,n=e.type,o=e.eventType,i=e.meta,s=e.sessionId,c=e.providerId,u=e.appId,l=e.source,f=e.tabId,h=e.url;if(t&&r){if(this.shouldLog(r)){this.config.consoleEnabled&&this.emitToConsole(r,t,i);var d=new a({sessionId:s||"unknown",providerId:c||"unknown",appId:u||"unknown",logLine:t,type:n,eventType:o,logLevel:r,source:l||this.config.source,tabId:f,url:h,meta:i,time:new Date});this.addLog(d)}}else console.error("Logger: message and logLevel are required")}},{key:"flush",value:(i=d(l().m(function e(){var t,r;return l().w(function(e){for(;;)switch(e.p=e.n){case 0:if(0!==this.logs.length&&!this.isSending){e.n=1;break}return e.a(2);case 1:return t=c(this.logs),this.logs=[],e.p=2,this.isSending=!0,e.n=3,this.sendLogs(t);case 3:e.n=5;break;case 4:e.p=4,r=e.v,console.error("Error flushing logs:",r),this.logs=[].concat(c(this.logs),c(t));case 5:return e.p=5,this.isSending=!1,e.f(5);case 6:return e.a(2)}},e,this,[[2,4,5,6]])})),function(){return i.apply(this,arguments)})},{key:"sendLogs",value:(o=d(l().m(function e(t){var r,o,i,s,a,c;return l().w(function(e){for(;;)switch(e.n){case 0:if(null!=t&&t.length){e.n=1;break}return e.a(2);case 1:return e.n=2,this.getDeviceLoggingId();case 2:return r=e.v,o=t.map(function(e){var t=e.toJson();return t.deviceId=t.deviceId||r,t}),i=JSON.stringify({logs:o,source:this.config.source,deviceId:r}),e.n=3,fetch(n.LOGGING_ENDPOINTS.DIAGNOSTIC_LOGGING,{method:"POST",headers:{"Content-Type":"application/json"},body:i});case 3:if((s=e.v).ok){e.n=5;break}return a=console,c="Failed to send ".concat(t.length," logs"),e.n=4,s.text();case 4:a.error.call(a,c,e.v);case 5:return e.a(2)}},e,this)})),function(e){return o.apply(this,arguments)})}],t&&E(e.prototype,t),r&&E(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r,o,i,s}(),O=new v,I=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=y({sessionId:"unknown",providerId:"unknown",appId:"unknown",source:(null===(e=O.config)||void 0===e?void 0:e.source)||"reclaim-extension-sdk"},t);return{get context(){return y({},r)},setContext:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.assign(r,e)},log:function(e){O.log(y(y({},r),e))},info:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};O.log(y(y({},r),{},{logLevel:"INFO"},e))},debug:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};O.log(y(y({},r),{},{logLevel:"DEBUG"},e))},all:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};O.log(y(y({},r),{},{logLevel:"ALL"},e))},error:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};O.log(y(y({},r),{},{logLevel:"ALL"},e))}}}},859(e,t,r){"use strict";r.r(t),r.d(t,{DEFAULT_LOG_CONFIG:()=>u,EVENT_TYPES:()=>s,LOGGING_ENDPOINTS:()=>n,LOG_CONFIG_STORAGE_KEY:()=>l,LOG_LEVEL:()=>a,LOG_LEVEL_MAP:()=>c,LOG_SOURCES:()=>i,LOG_TYPES:()=>o});var n={DIAGNOSTIC_LOGGING:"http://localhost:8001/api/logs"},o={BACKGROUND:"reclaim_browser_extension.BackgroundProcess",CONTENT:"reclaim_browser_extension.ContentScript",POPUP:"reclaim_browser_extension.Popup",INIT:"reclaim_browser_extension.Initialization",VERIFICATION:"reclaim_browser_extension.Verification",FETCH_DATA:"reclaim_browser_extension.FetchData",PROVIDER_DATA:"reclaim_browser_extension.ProviderData",CLAIM_CREATION:"reclaim_browser_extension.ClaimCreation",PROOF_GENERATION:"reclaim_browser_extension.ProofGeneration",PROOF_SUBMISSION:"reclaim_browser_extension.ProofSubmission",PROOF_VERIFICATION:"reclaim_browser_extension.ProofVerification",OFFSCREEN:"reclaim_browser_extension.Offscreen"},i={BACKGROUND:"background",CONTENT:"content",OFFSCREEN:"offscreen",POPUP:"popup",INJECTION:"injection"},s={IS_RECLAIM_EXTENSION_SDK:"IS_RECLAIM_EXTENSION_SDK",VERIFICATION_FLOW_STARTED:"VERIFICATION_FLOW_STARTED",RECLAIM_VERIFICATION_DISMISSED:"RECLAIM_VERIFICATION_DISMISSED",RECLAIM_VERIFICATION_PROVIDER_LOAD_EXCEPTION:"RECLAIM_VERIFICATION_PROVIDER_LOAD_EXCEPTION",REQUEST_MATCHED:"REQUEST_MATCHED",RESPONSE_MATCH_FAILED:"RESPONSE_MATCH_FAILED",X_PATH_MATCH_REQUIREMENT_FAILED:"X_PATH_MATCH_REQUIREMENT_FAILED",JSON_PATH_MATCH_REQUIREMENT_FAILED:"JSON_PATH_MATCH_REQUIREMENT_FAILED",REGEX_MATCH_REQUIREMENT_FAILED:"REGEX_MATCH_REQUIREMENT_FAILED",FILTERED_REQUEST_FOUND:"FILTERED_REQUEST_FOUND",FILTER_REQUEST_ERROR:"FILTER_REQUEST_ERROR",STARTING_CLAIM_CREATION:"STARTING_CLAIM_CREATION",CLAIM_CREATION_STARTED:"CLAIM_CREATION_STARTED",CLAIM_CREATION_SUCCESS:"CLAIM_CREATION_SUCCESS",CLAIM_CREATION_FAILED:"CLAIM_CREATION_FAILED",CLAIM_PARAMETER_VALIDATION_FAILED_EXCEPTION:"CLAIM_PARAMETER_VALIDATION_FAILED_EXCEPTION",OFFSCREEN_DOCUMENT_READY:"OFFSCREEN_DOCUMENT_READY",OFFSCREEN_DOCUMENT_NOT_READY_EXCEPTION:"OFFSCREEN_DOCUMENT_NOT_READY_EXCEPTION",PROOF_GENERATION_STARTED:"PROOF_GENERATION_STARTED",PROOF_GENERATION_SUCCESS:"PROOF_GENERATION_SUCCESS",PROOF_GENERATION_ABORTED:"PROOF_GENERATION_ABORTED",PROOF_GENERATION_FAILED:"PROOF_GENERATION_FAILED",RESULT_RECEIVED:"RESULT_RECEIVED",SUBMITTING_PROOF:"SUBMITTING_PROOF",SUBMITTING_PROOF_TO_CALLBACK_URL:"SUBMITTING_PROOF_TO_CALLBACK_URL",SUBMITTING_PROOF_TO_CALLBACK_URL_SUCCESS:"SUBMITTING_PROOF_TO_CALLBACK_URL_SUCCESS",SUBMITTING_PROOF_TO_CALLBACK_URL_FAILED:"SUBMITTING_PROOF_TO_CALLBACK_URL_FAILED",PROOF_SUBMISSION_FAILED:"PROOF_SUBMISSION_FAILED",PROOF_SUBMITTED:"PROOF_SUBMITTED",VERIFICATION_FLOW_FAILED:"VERIFICATION_FLOW_FAILED",TAB_NOT_MANAGED_BY_EXTENSION_EXCEPTION:"TAB_NOT_MANAGED_BY_EXTENSION_EXCEPTION",INJECTION_SCRIPT_SET_IN_LOCAL_STORAGE_FAILED:"INJECTION_SCRIPT_SET_IN_LOCAL_STORAGE_FAILED",VERIFICATION_POPUP_ERROR:"VERIFICATION_POPUP_ERROR",UPDATE_SESSION_STATUS_ERROR:"UPDATE_SESSION_STATUS_ERROR"},a={INFO:10,DEBUG:20,ALL:30},c={INFO:a.INFO,DEBUG:a.DEBUG,ALL:a.ALL},u={logLevel:"INFO",consoleEnabled:!1,source:"reclaim-extension-sdk"},l="reclaim_extension_sdk_log_config"},153(e,t,r){"use strict";r.d(t,{Ey:()=>s,Ru:()=>u.EVENT_TYPES,E$:()=>u.LOG_LEVEL,D_:()=>u.LOG_TYPES,w9:()=>c});r(770);function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var s=Object.freeze({BACKGROUND:"background",CONTENT:"content",POPUP:"popup",INIT:"init",VERIFICATION:"verification",FETCH:"fetch",PROVIDER:"provider",CLAIM:"claim",PROOF:"proof",OFFSCREEN:"offscreen",POLYFILLS:"polyfills",SESSION_TIMER:"session-timer"}),a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.enabled=!0,this.allowedTypes=new Set}return t=e,r=[{key:"enable",value:function(){this.enabled=!0}},{key:"disable",value:function(){this.enabled=!1}},{key:"setTypes",value:function(e){Array.isArray(e)&&(this.allowedTypes=new Set(e))}},{key:"clearTypes",value:function(){this.allowedTypes.clear()}},{key:"log",value:function(t){var r;if(this.enabled&&(!(this.allowedTypes.size>0)||this.allowedTypes.has(t))){for(var n=e.typeColor(t),o=arguments.length,i=new Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];(r=console).log.apply(r,["%c[".concat(t,"][INFO]"),"color: ".concat(n,"; font-weight: bold;")].concat(i))}}},{key:"info",value:function(t){var r;if(this.enabled&&(!(this.allowedTypes.size>0)||this.allowedTypes.has(t))){for(var n=e.typeColor(t),o=arguments.length,i=new Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];(r=console).info.apply(r,["%c[".concat(t,"][INFO]"),"color: ".concat(n,"; font-weight: bold;")].concat(i))}}},{key:"warn",value:function(t){var r;if(this.enabled&&(!(this.allowedTypes.size>0)||this.allowedTypes.has(t))){for(var n=e.typeColor(t,"warn"),o=arguments.length,i=new Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];(r=console).warn.apply(r,["%c[".concat(t,"][WARN]"),"color: ".concat(n,"; font-weight: bold;")].concat(i))}}},{key:"error",value:function(t){var r;if(this.enabled&&(!(this.allowedTypes.size>0)||this.allowedTypes.has(t))){for(var n=e.typeColor(t,"error"),o=arguments.length,i=new Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];(r=console).error.apply(r,["%c[".concat(t,"][ERROR]"),"color: ".concat(n,"; font-weight: bold;")].concat(i))}}}],n=[{key:"typeColor",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",r={background:"#0074D9",content:"#2ECC40",popup:"#FF851B",init:"#B10DC9",verification:"#FF4136",fetch:"#39CCCC",provider:"#FFDC00",claim:"#7FDBFF",proof:"#85144b",offscreen:"#AAAAAA",polyfills:"#0074D9","session-timer":"#2ECC40"},n=r[Object.keys(r).find(function(t){return e.toLowerCase().includes(t)})]||"#888888";return"info"!==t&&(n={info:"",warn:"#FFA500",error:"#FF0000"}[t]||n),n}}],r&&o(t.prototype,r),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,n}(),c=new a,u=r(859),l=r(606);void 0!==l&&l.env?c.disable():c.enable()},997(e,t,r){"use strict";var n=r(287),o=r(606),i=r.n(o),s=r(153);function a(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var a=n&&n.prototype instanceof u?n:u,l=Object.create(a.prototype);return c(l,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),l}var s={};function u(){}function l(){}function f(){}t=Object.getPrototypeOf;var h=[][n]?t(t([][n]())):(c(t={},n,function(){return this}),t),d=f.prototype=u.prototype=Object.create(h);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,c(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=f,c(d,"constructor",f),c(f,"constructor",l),l.displayName="GeneratorFunction",c(f,o,"GeneratorFunction"),c(d),c(d,o,"Generator"),c(d,n,function(){return this}),c(d,"toString",function(){return"[object Generator]"}),(a=function(){return{w:i,m:p}})()}function c(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}c=function(e,t,r,n){function i(t,r){c(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},c(e,t,r,n)}function u(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function l(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){u(i,n,o,s,a,"next",e)}function a(e){u(i,n,o,s,a,"throw",e)}s(void 0)})}}var f,h,d,p="undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0!==p?p:Function("return this")(),g="undefined"==typeof window,y="undefined"!=typeof document&&void 0!==document.contentType;if(p.Buffer=p.Buffer||n.hp,p.process=p.process||i(),void 0!==p.WebSocket||y)y?s.w9.info(s.Ey.POLYFILLS,"Skipping WebSocket in content script context"):s.w9.info(s.Ey.POLYFILLS,"Using native WebSocket implementation");else try{var m=r(296).WebSocket;p.WebSocket=m,s.w9.info(s.Ey.POLYFILLS,"WebSocket polyfill added to global")}catch(e){s.w9.warn(s.Ey.POLYFILLS,"Failed to load WebSocket polyfill:",e)}if(p.process&&(p.process.browser=!0),"function"!=typeof p.require)p.require=function(e){switch(e){case"ws":if(y)return s.w9.info(s.Ey.POLYFILLS,"Blocking ws module in content script"),{};try{return{WebSocket:r(296).WebSocket}}catch(e){return s.w9.warn(s.Ey.POLYFILLS,"Failed to load WebSocket for ws module:",e),{}}case"fs":return p.fs;case"path":return p.path;case"os":return p.os;case"crypto":return p.crypto;case"worker_threads":case"koffi":case"re2":return{};default:return console.warn("Mock require called for module: ".concat(e)),{}}};else{var E=p.require;p.require=function(e){if("ws"===e){if(y)return s.w9.info(s.Ey.POLYFILLS,"Blocking ws module in content script"),{};try{return{WebSocket:r(296).WebSocket}}catch(e){return s.w9.warn(s.Ey.POLYFILLS,"Failed to load WebSocket for ws module:",e),{}}}try{return E(e)}catch(t){return s.w9.warn(s.Ey.POLYFILLS,"Failed to require module: ".concat(e)),{}}}}if(void 0!==i()&&(i().browser=!0,i().version||(i().version="v16.0.0"),i().cwd||(i().cwd=function(){return"/"})),void 0===p.global&&(p.global=p),void 0===p.crypto&&(p.crypto={}),void 0===p.crypto.getRandomValues&&(p.crypto.getRandomValues=function(e){for(var t=new Uint8Array(e.length),r=0;r<t.length;r++)t[r]=Math.floor(256*Math.random());return t}),void 0===p.crypto.subtle&&(s.w9.warn(s.Ey.POLYFILLS,"WebCrypto subtle API not available. Some functionality may not work."),p.crypto.subtle={digest:(f=l(a().m(function e(t,r){var n,o,i;return a().w(function(e){for(;;)if(0===e.n){for(s.w9.warn(s.Ey.POLYFILLS,"Crypto subtle digest (".concat(t,") called with browser fallback")),n=Array.from(new Uint8Array(r)).reduce(function(e,t){return 31*e+t&4294967295},0),o=new Uint8Array(32),i=0;i<32;i++)o[i]=n>>8*i&255;return e.a(2,o.buffer)}},e)})),function(e,t){return f.apply(this,arguments)})}),!g){var b=function(e,t){return"string"==typeof e&&e.startsWith("node:")&&(e=e.replace(/^node:/,"")),new v(e,t)};void 0===p.domain&&(p.domain={create:function(){return{run:function(e){return e()},on:function(){},bind:function(e){return e}}}});var v=p.URL;b.prototype=v.prototype;try{Object.getOwnPropertyNames(v).forEach(function(e){if("prototype"!==e&&"constructor"!==e)try{b[e]=v[e]}catch(e){}})}catch(e){s.w9.warn(s.Ey.POLYFILLS,"Could not copy all URL static properties:",e)}try{p.URL=b}catch(e){s.w9.warn(s.Ey.POLYFILLS,"Could not override URL constructor:",e)}}void 0===p.module&&(p.module={exports:{}}),p.fs=p.fs||{readFileSync:function(e){throw s.w9.warn(s.Ey.POLYFILLS,"Attempted to readFileSync: ".concat(e)),new Error("fs.readFileSync is not available in this environment")},writeFileSync:function(e,t){s.w9.warn(s.Ey.POLYFILLS,"Attempted to writeFileSync: ".concat(e))},existsSync:function(e){return s.w9.warn(s.Ey.POLYFILLS,"Attempted to check if file exists: ".concat(e)),!1},promises:{readFile:(d=l(a().m(function e(t){return a().w(function(e){for(;;)switch(e.n){case 0:throw s.w9.warn(s.Ey.POLYFILLS,"Attempted to readFile: ".concat(t)),new Error("fs.promises.readFile is not available in this environment");case 1:return e.a(2)}},e)})),function(e){return d.apply(this,arguments)}),writeFile:(h=l(a().m(function e(t,r){return a().w(function(e){for(;;)switch(e.n){case 0:s.w9.warn(s.Ey.POLYFILLS,"Attempted to writeFile: ".concat(t));case 1:return e.a(2)}},e)})),function(e,t){return h.apply(this,arguments)})}},p.os=p.os||{tmpdir:function(){return"/tmp"},homedir:function(){return"/home/user"},platform:function(){return"browser"},type:function(){return"Browser"},cpus:function(){return[{model:"Browser CPU",speed:1e3}]},totalmem:function(){return 8589934592},freemem:function(){return 4294967296}},p.path=p.path||{join:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.join("/").replace(/\/+/g,"/")},resolve:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.join("/").replace(/\/+/g,"/")},dirname:function(e){return e.split("/").slice(0,-1).join("/")||"."},basename:function(e,t){var r=e.split("/").pop()||"";return t&&r.endsWith(t)&&(r=r.slice(0,-t.length)),r},extname:function(e){var t=e.split("/").pop()||"",r=t.lastIndexOf(".");return r<0?"":t.slice(r)},sep:"/"};n.hp,i()},573(e,t,r){"use strict";r.d(t,{c:()=>n});var n=function(e,t){var r;return{identifier:e.claim.identifier,claimData:e.claim,signatures:[o(e.signatures.claimSignature)],witnesses:[{id:e.signatures.attestorAddress,url:"ws://localhost:8001/ws"}],taskId:null,publicData:null!==(r=e.publicData)&&void 0!==r?r:null,providerRequest:t}},o=function(e){if(!e)return"";var t=Object.values(e).map(function(e){return e.toString(16).padStart(2,"0")}).join("");return"0x".concat(t)}},296(e,t,r){"use strict";r.r(t),r.d(t,{WebSocket:()=>p,default:()=>g});var n,o=r(153);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,u(n.key),n)}}function c(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==i(t)?t:t+""}function l(e,t,r){return t=h(t),function(e,t){if(t&&("object"==i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,f()?Reflect.construct(t,r||[],h(e).constructor):t.apply(e,r))}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}(e=r.hmd(e),"undefined"==typeof window)?(n=function(){return c(function e(t,r){var n=this;s(this,e),o.w9.info(o.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Creating mock WebSocket for background context"),this.url=t,this.protocols=r,this.readyState=3,setTimeout(function(){"function"==typeof n.onclose&&n.onclose({code:1e3,reason:"WebSockets not supported in background context"})},0)},[{key:"send",value:function(){throw o.w9.warn(o.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Cannot use WebSockets in background context"),new Error("WebSockets are not available in background context")}},{key:"close",value:function(){}},{key:"sendPromise",value:function(){return Promise.reject(new Error("WebSockets are not available in background context"))}},{key:"addEventListener",value:function(){}},{key:"removeEventListener",value:function(){}}])}(),o.w9.info(o.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Using mock WebSocket implementation for background context")):(n=function(e){function t(e,r){var n;return s(this,t),o.w9.info(o.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Creating WebSocket with URL:",e),(n=l(this,t,[e,r])).addEventListener("error",function(e){"function"==typeof n.onerror&&n.onerror(e)}),n.addEventListener("open",function(e){"function"==typeof n.onopen&&n.onopen(e)}),n.addEventListener("close",function(e){"function"==typeof n.onclose&&n.onclose(e)}),n.addEventListener("message",function(e){"function"==typeof n.onmessage&&n.onmessage(e)}),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(t,e),c(t,[{key:"sendPromise",value:function(e){var t=this;return new Promise(function(r,n){try{t.send(e),r()}catch(e){n(e)}})}}])}(window.WebSocket),o.w9.info(o.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Using browser WebSocket implementation"));var p=n;const g=n;e.exports&&(e.exports=n,e.exports.WebSocket=n,e.exports.default=n),o.w9.info(o.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] WebSocket polyfill initialized")}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={id:n,loaded:!1,exports:{}};return e[n](i,i.exports,r),i.loaded=!0,i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{ReclaimExtensionProofRequest:()=>ws,default:()=>_s,joclaimExtensionSDK:()=>Ts});var e={};r.r(e),r.d(e,{OG:()=>Me,My:()=>Pe,Ph:()=>Ue,lX:()=>xe,Id:()=>Be,fg:()=>Ve,qj:()=>ke,aT:()=>De,lq:()=>Ge,z:()=>Fe,Q5:()=>He});r(997);function t(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function o(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function i(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");t(e.outputLen),t(e.blockLen)}function s(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function a(e,t){o(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}const c=BigInt(2**32-1),u=BigInt(32);function l(e,t=!1){return t?{h:Number(e&c),l:Number(e>>u&c)}:{h:0|Number(e>>u&c),l:0|Number(e&c)}}function f(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:i,l:s}=l(e[o],t);[r[o],n[o]]=[i,s]}return[r,n]}const h=(e,t,r)=>e<<r|t>>>32-r,d=(e,t,r)=>t<<r|e>>>32-r,p=(e,t,r)=>t<<r-32|e>>>64-r,g=(e,t,r)=>e<<r-32|t>>>64-r;const y={fromBig:l,split:f,toBig:(e,t)=>BigInt(e>>>0)<<u|BigInt(t>>>0),shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:h,rotlSL:d,rotlBH:p,rotlBL:g,add:function(e,t,r,n){const o=(t>>>0)+(n>>>0);return{h:e+r+(o/2**32|0)|0,l:0|o}},add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,o)=>t+r+n+o+(e/2**32|0)|0,add5H:(e,t,r,n,o,i)=>t+r+n+o+i+(e/2**32|0)|0,add5L:(e,t,r,n,o)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(o>>>0)},m="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,E=e=>e instanceof Uint8Array,b=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),v=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),O=(e,t)=>e<<32-t|e>>>t;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");const I=async()=>{};async function A(e,t,r){let n=Date.now();for(let o=0;o<e;o++){r(o);const e=Date.now()-n;e>=0&&e<t||(await I(),n+=e)}}function S(e){if("string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),!E(e))throw new Error("expected Uint8Array, got "+typeof e);return e}class w{clone(){return this._cloneInto()}}const R={}.toString;function T(e,t){if(void 0!==t&&"[object Object]"!==R.call(t))throw new Error("Options should be object or undefined");return Object.assign(e,t)}function _(e){const t=t=>e().update(S(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function N(e=32){if(m&&"function"==typeof m.getRandomValues)return m.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}const[C,P,L]=[[],[],[]],D=BigInt(0),U=BigInt(1),x=BigInt(2),G=BigInt(7),F=BigInt(256),k=BigInt(113);for(let e=0,t=U,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],C.push(2*(5*n+r)),P.push((e+1)*(e+2)/2%64);let o=D;for(let e=0;e<7;e++)t=(t<<U^(t>>G)*k)%F,t&x&&(o^=U<<(U<<BigInt(e))-U);L.push(o)}const[B,M]=f(L,!0),j=(e,t,r)=>r>32?p(e,t,r):h(e,t,r),K=(e,t,r)=>r>32?g(e,t,r):d(e,t,r);class V extends w{constructor(e,r,n,o=!1,i=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=o,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,t(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=b(this.state)}keccak(){!function(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,o=(t+2)%10,i=r[o],s=r[o+1],a=j(i,s,1)^r[n],c=K(i,s,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],o=e[3];for(let r=0;r<24;r++){const n=P[r],i=j(t,o,n),s=K(t,o,n),a=C[r];t=e[a],o=e[a+1],e[a]=i,e[a+1]=s}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=B[n],e[1]^=M[n]}r.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){s(this);const{blockLen:t,state:r}=this,n=(e=S(e)).length;for(let o=0;o<n;){const i=Math.min(t-this.pos,n-o);for(let t=0;t<i;t++)r[this.pos++]^=e[o++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,128&t&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){s(this,!1),o(e),this.finish();const t=this.state,{blockLen:r}=this;for(let n=0,o=e.length;n<o;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,o-n);e.set(t.subarray(this.posOut,this.posOut+i),n),this.posOut+=i,n+=i}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return t(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(a(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:n,rounds:o,enableXOF:i}=this;return e||(e=new V(t,r,n,i,o)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=o,e.suffix=r,e.outputLen=n,e.enableXOF=i,e.destroyed=this.destroyed,e}}const $=(e,t,r)=>_(()=>new V(t,e,r)),H=$(1,136,32),Y="6.16.0";function q(e,t,r){const n=t.split("|").map(e=>e.trim());for(let r=0;r<n.length;r++)switch(t){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof e===t)return}const o=new Error(`invalid value for type ${t}`);throw o.code="INVALID_ARGUMENT",o.argument=`value.${r}`,o.value=e,o}async function z(e){const t=Object.keys(e);return(await Promise.all(t.map(t=>Promise.resolve(e[t])))).reduce((e,r,n)=>(e[t[n]]=r,e),{})}function W(e,t,r){for(let n in t){let o=t[n];const i=r?r[n]:null;i&&q(o,i,n),Object.defineProperty(e,n,{enumerable:!0,value:o,writable:!1})}}function J(e,t){if(null==e)return"null";if(null==t&&(t=new Set),"object"==typeof e){if(t.has(e))return"[Circular]";t.add(e)}if(Array.isArray(e))return"[ "+e.map(e=>J(e,t)).join(", ")+" ]";if(e instanceof Uint8Array){const t="0123456789abcdef";let r="0x";for(let n=0;n<e.length;n++)r+=t[e[n]>>4],r+=t[15&e[n]];return r}if("object"==typeof e&&"function"==typeof e.toJSON)return J(e.toJSON(),t);switch(typeof e){case"boolean":case"number":case"symbol":return e.toString();case"bigint":return BigInt(e).toString();case"string":return JSON.stringify(e);case"object":{const r=Object.keys(e);return r.sort(),"{ "+r.map(r=>`${J(r,t)}: ${J(e[r],t)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function X(e,t,r){let n,o=e;{const n=[];if(r){if("message"in r||"code"in r||"name"in r)throw new Error(`value will overwrite populated values: ${J(r)}`);for(const e in r){if("shortMessage"===e)continue;const t=r[e];n.push(e+"="+J(t))}}n.push(`code=${t}`),n.push(`version=${Y}`),n.length&&(e+=" ("+n.join(", ")+")")}switch(t){case"INVALID_ARGUMENT":n=new TypeError(e);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":n=new RangeError(e);break;default:n=new Error(e)}return W(n,{code:t}),r&&Object.assign(n,r),null==n.shortMessage&&W(n,{shortMessage:o}),n}function Q(e,t,r,n){if(!e)throw X(t,r,n)}function Z(e,t,r,n){Q(e,t,"INVALID_ARGUMENT",{argument:r,value:n})}const ee=["NFD","NFC","NFKD","NFKC"].reduce((e,t)=>{try{if("test"!=="test".normalize(t))throw new Error("bad");if("NFD"===t){const e=String.fromCharCode(233).normalize("NFD");if(e!==String.fromCharCode(101,769))throw new Error("broken")}e.push(t)}catch(e){}return e},[]);function te(e){Q(ee.indexOf(e)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:e}})}function re(e,t,r){if(null==r&&(r=""),e!==t){let e=r,t="new";r&&(e+=".",t+=" "+r),Q(!1,`private constructor; use ${e}from* methods`,"UNSUPPORTED_OPERATION",{operation:t})}}function ne(e,t,r){if(e instanceof Uint8Array)return r?new Uint8Array(e):e;if("string"==typeof e&&e.length%2==0&&e.match(/^0x[0-9a-f]*$/i)){const t=new Uint8Array((e.length-2)/2);let r=2;for(let n=0;n<t.length;n++)t[n]=parseInt(e.substring(r,r+2),16),r+=2;return t}Z(!1,"invalid BytesLike value",t||"value",e)}function oe(e,t){return ne(e,t,!1)}function ie(e,t){return ne(e,t,!0)}function se(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(("number"!=typeof t||e.length===2+2*t)&&(!0!==t||e.length%2==0))}function ae(e){return se(e,!0)||e instanceof Uint8Array}const ce="0123456789abcdef";function ue(e){const t=oe(e);let r="0x";for(let e=0;e<t.length;e++){const n=t[e];r+=ce[(240&n)>>4]+ce[15&n]}return r}function le(e){return"0x"+e.map(e=>ue(e).substring(2)).join("")}function fe(e){return se(e,!0)?(e.length-2)/2:oe(e).length}function he(e,t,r){const n=oe(e);return null!=r&&r>n.length&&Q(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r}),ue(n.slice(null==t?0:t,null==r?n.length:r))}function de(e,t,r){const n=oe(e);Q(t>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:t,offset:t+1});const o=new Uint8Array(t);return o.fill(0),r?o.set(n,t-n.length):o.set(n,0),ue(o)}function pe(e,t){return de(e,t,!0)}let ge=!1;const ye=function(e){return H(e)};let me=ye;function Ee(e){const t=oe(e,"data");return ue(me(t))}Ee._=ye,Ee.lock=function(){ge=!0},Ee.register=function(e){if(ge)throw new TypeError("keccak256 is locked");me=e},Object.freeze(Ee);class be extends w{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=v(this.buffer)}update(e){s(this);const{view:t,buffer:r,blockLen:n}=this,o=(e=S(e)).length;for(let i=0;i<o;){const s=Math.min(n-this.pos,o-i);if(s===n){const t=v(e);for(;n<=o-i;i+=n)this.process(t,i);continue}r.set(e.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){s(this),a(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:o}=this;let{pos:i}=this;t[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>n-i&&(this.process(r,0),i=0);for(let e=i;e<n;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const o=BigInt(32),i=BigInt(4294967295),s=Number(r>>o&i),a=Number(r&i),c=n?4:0,u=n?0:4;e.setUint32(t+c,s,n),e.setUint32(t+u,a,n)}(r,n-8,BigInt(8*this.length),o),this.process(r,0);const c=v(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=u/4,f=this.get();if(l>f.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<l;e++)c.setUint32(4*e,f[e],o)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:o,destroyed:i,pos:s}=this;return e.length=n,e.pos=s,e.finished=o,e.destroyed=i,n%t&&e.buffer.set(r),e}}const ve=(e,t,r)=>e&t^~e&r,Oe=(e,t,r)=>e&t^e&r^t&r,Ie=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ae=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Se=new Uint32Array(64);class we extends be{constructor(){super(64,32,8,!1),this.A=0|Ae[0],this.B=0|Ae[1],this.C=0|Ae[2],this.D=0|Ae[3],this.E=0|Ae[4],this.F=0|Ae[5],this.G=0|Ae[6],this.H=0|Ae[7]}get(){const{A:e,B:t,C:r,D:n,E:o,F:i,G:s,H:a}=this;return[e,t,r,n,o,i,s,a]}set(e,t,r,n,o,i,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)Se[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=Se[e-15],r=Se[e-2],n=O(t,7)^O(t,18)^t>>>3,o=O(r,17)^O(r,19)^r>>>10;Se[e]=o+Se[e-7]+n+Se[e-16]|0}let{A:r,B:n,C:o,D:i,E:s,F:a,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+(O(s,6)^O(s,11)^O(s,25))+ve(s,a,c)+Ie[e]+Se[e]|0,l=(O(r,2)^O(r,13)^O(r,22))+Oe(r,n,o)|0;u=c,c=a,a=s,s=i+t|0,i=o,o=n,n=r,r=t+l|0}r=r+this.A|0,n=n+this.B|0,o=o+this.C|0,i=i+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,n,o,i,s,a,c,u)}roundClean(){Se.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Re=_(()=>new we),Te=(BigInt(0),BigInt(1)),_e=BigInt(2),Ne=e=>e instanceof Uint8Array,Ce=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Pe(e){if(!Ne(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=Ce[e[r]];return t}function Le(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}function De(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(t/2);for(let t=0;t<r.length;t++){const n=2*t,o=e.slice(n,n+2),i=Number.parseInt(o,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");r[t]=i}return r}function Ue(e){return Le(Pe(e))}function xe(e){if(!Ne(e))throw new Error("Uint8Array expected");return Le(Pe(Uint8Array.from(e).reverse()))}function Ge(e,t){return De(e.toString(16).padStart(2*t,"0"))}function Fe(e,t){return Ge(e,t).reverse()}function ke(e,t,r){let n;if("string"==typeof t)try{n=De(t)}catch(r){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${r}`)}else{if(!Ne(t))throw new Error(`${e} must be hex string or Uint8Array`);n=Uint8Array.from(t)}const o=n.length;if("number"==typeof r&&o!==r)throw new Error(`${e} expected ${r} bytes, got ${o}`);return n}function Be(...e){const t=new Uint8Array(e.reduce((e,t)=>e+t.length,0));let r=0;return e.forEach(e=>{if(!Ne(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length}),t}const Me=e=>(_e<<BigInt(e-1))-Te,je=e=>new Uint8Array(e),Ke=e=>Uint8Array.from(e);function Ve(e,t,r){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");let n=je(e),o=je(e),i=0;const s=()=>{n.fill(1),o.fill(0),i=0},a=(...e)=>r(o,n,...e),c=(e=je())=>{o=a(Ke([0]),e),n=a(),0!==e.length&&(o=a(Ke([1]),e),n=a())},u=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e<t;){n=a();const t=n.slice();r.push(t),e+=n.length}return Be(...r)};return(e,t)=>{let r;for(s(),c(e);!(r=t(u()));)c();return s(),r}}const $e={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function He(e,t,r={}){const n=(t,r,n)=>{const o=$e[r];if("function"!=typeof o)throw new Error(`Invalid validator "${r}", expected function`);const i=e[t];if(!(n&&void 0===i||o(i,e)))throw new Error(`Invalid param ${String(t)}=${i} (${typeof i}), expected ${r}`)};for(const[e,r]of Object.entries(t))n(e,r,!1);for(const[e,t]of Object.entries(r))n(e,t,!0);return e}
|
|
10
|
+
t.read=function(e,t,r,n,o){var i,s,a=8*o-n-1,c=(1<<a)-1,u=c>>1,l=-7,f=r?o-1:0,h=r?-1:1,d=e[t+f];for(f+=h,i=d&(1<<-l)-1,d>>=-l,l+=a;l>0;i=256*i+e[t+f],f+=h,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=n;l>0;s=256*s+e[t+f],f+=h,l-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),i-=u}return(d?-1:1)*s*Math.pow(2,i-n)},t.write=function(e,t,r,n,o,i){var s,a,c,u=8*i-o-1,l=(1<<u)-1,f=l>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+f>=1?h/c:h*Math.pow(2,1-f))*c>=2&&(s++,c/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*c-1)*Math.pow(2,o),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,o),s=0));o>=8;e[r+d]=255&a,d+=p,a/=256,o-=8);for(s=s<<o|a,u+=o;u>0;e[r+d]=255&s,d+=p,s/=256,u-=8);e[r+d-p]|=128*g}},606(e){var t,r,n=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var a,c=[],u=!1,l=-1;function f(){u&&a&&(u=!1,a.length?c=a.concat(c):l=-1,c.length&&h())}function h(){if(!u){var e=s(f);u=!0;for(var t=c.length;t;){for(a=c,c=[];++l<t;)a&&a[l].run();l=-1,t=c.length}a=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function p(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new d(e,t)),1!==c.length||u||s(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},455(e,t,r){"use strict";r.d(t,{A:()=>wt});var n={};r.r(n),r.d(n,{cancelSession:()=>Ve,failSession:()=>Be,startVerification:()=>Fe,submitProofs:()=>je});r(997);var o=r(952),i=r(770),s=r(859);function a(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var a=n&&n.prototype instanceof u?n:u,l=Object.create(a.prototype);return c(l,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),l}var s={};function u(){}function l(){}function f(){}t=Object.getPrototypeOf;var h=[][n]?t(t([][n]())):(c(t={},n,function(){return this}),t),d=f.prototype=u.prototype=Object.create(h);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,c(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=f,c(d,"constructor",f),c(f,"constructor",l),l.displayName="GeneratorFunction",c(f,o,"GeneratorFunction"),c(d),c(d,o,"Generator"),c(d,n,function(){return this}),c(d,"toString",function(){return"[object Generator]"}),(a=function(){return{w:i,m:p}})()}function c(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}c=function(e,t,r,n){function i(t,r){c(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},c(e,t,r,n)}function u(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function l(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){u(i,n,o,s,a,"next",e)}function a(e){u(i,n,o,s,a,"throw",e)}s(void 0)})}}var f=function(){var e=l(a().m(function e(t,r,n){var c,u,l,f;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:return c=(0,i.y8)({sessionId:r||"unknown",providerId:t||"unknown",appId:n||"unknown",source:"reclaim-extension-sdk",type:s.LOG_TYPES.FETCH_DATA}),e.p=1,e.n=2,fetch("".concat(o.Sn.PROVIDER_URL(t)));case 2:if((u=e.v).ok){e.n=3;break}throw new Error("Failed to fetch provider data");case 3:return c.info({message:"Successfully fetched provider data from the backend: "+JSON.stringify(u),logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.FETCH_DATA}),e.n=4,u.json();case 4:return l=e.v,e.a(2,null==l?void 0:l.providers);case 5:throw e.p=5,f=e.v,c.error({message:"Error fetching provider data: "+f.toString(),logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.FETCH_DATA,eventType:s.EVENT_TYPES.RECLAIM_PROVIDER_DATA_FETCH_ERROR}),f;case 6:return e.a(2)}},e,null,[[1,5]])}));return function(t,r,n){return e.apply(this,arguments)}}(),h=function(){var e=l(a().m(function e(t,r,n,c){var u,l,f,h;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:return u=(0,i.y8)({sessionId:t||"unknown",providerId:n||"unknown",appId:c||"unknown",source:"reclaim-extension-sdk",type:s.LOG_TYPES.FETCH_DATA}),e.p=1,e.n=2,fetch("".concat(o.Sn.UPDATE_SESSION_STATUS()),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:t,status:r})});case 2:if((l=e.v).ok){e.n=3;break}throw new Error("Failed to update session status");case 3:return u.info({message:"Successfully updated session status: "+r,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.FETCH_DATA}),e.n=4,l.json();case 4:return f=e.v,e.a(2,f);case 5:throw e.p=5,h=e.v,u.error({message:"Error updating session status: "+h.toString(),logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.FETCH_DATA,eventType:s.EVENT_TYPES.UPDATE_SESSION_STATUS_ERROR}),h;case 6:return e.a(2)}},e,null,[[1,5]])}));return function(t,r,n,o){return e.apply(this,arguments)}}(),d=function(){var e=l(a().m(function e(t,r,n,c,u){var l,f,d,p,g,y;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:return l=(0,i.y8)({sessionId:n||"unknown",providerId:c||"unknown",appId:u||"unknown",source:"reclaim-extension-sdk",type:s.LOG_TYPES.FETCH_DATA}),e.p=1,f=JSON.stringify(t),d=encodeURIComponent(f),e.n=2,fetch(r,{method:"POST",headers:{"Content-Type":"text/plain"},body:d});case 2:return p=e.v,e.n=3,p.text();case 3:if(g=e.v,p.ok){e.n=5;break}return e.n=4,h(n,o.Ew.PROOF_SUBMISSION_FAILED);case 4:throw new Error("Failed to submit proof to Callback and update session status");case 5:return l.info({message:"Successfully submitted proof to Callback and updated session status",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.FETCH_DATA,eventType:s.EVENT_TYPES.SUBMITTING_PROOF_TO_CALLBACK_URL_SUCCESS}),e.n=6,h(n,o.Ew.PROOF_SUBMITTED);case 6:return e.a(2,g);case 7:throw e.p=7,y=e.v,l.error({message:"Error submitting proof to Callback: "+y.toString(),logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.FETCH_DATA}),y;case 8:return e.a(2)}},e,null,[[1,7]])}));return function(t,r,n,o,i){return e.apply(this,arguments)}}();function p(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return g(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(g(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,g(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,g(f,"constructor",u),g(u,"constructor",c),c.displayName="GeneratorFunction",g(u,o,"GeneratorFunction"),g(f),g(f,o,"Generator"),g(f,n,function(){return this}),g(f,"toString",function(){return"[object Generator]"}),(p=function(){return{w:i,m:h}})()}function g(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}g=function(e,t,r,n){function i(t,r){g(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},g(e,t,r,n)}function y(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function m(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){y(i,n,o,s,a,"next",e)}function a(e){y(i,n,o,s,a,"throw",e)}s(void 0)})}}var E=(0,i.y8)({sessionId:"unknown",providerId:"unknown",appId:"unknown",source:"reclaim-extension-sdk",type:s.LOG_TYPES.OFFSCREEN}),b=!1,v=null,O=null,I=function(e){(null==e?void 0:e.action)===o.wx.OFFSCREEN_DOCUMENT_READY&&(null==e?void 0:e.source)===o.J_.OFFSCREEN&&(null==e?void 0:e.target)===o.J_.BACKGROUND&&(E.info({message:"[OFFSCREEN-MANAGER] Received offscreen ready signal (global listener).",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),b=!0,v&&(clearTimeout(v),v=null))},A=function(){"undefined"!=typeof chrome&&chrome.runtime&&chrome.runtime.onMessage&&chrome.runtime.onMessage.addListener&&chrome.runtime.onMessage.hasListener&&(chrome.runtime.onMessage.hasListener(I)||chrome.runtime.onMessage.addListener(I))};function S(){return w.apply(this,arguments)}function w(){return(w=m(p().m(function e(){var t,r;return p().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=chrome.runtime.getURL("joclaim-browser-extension-sdk/offscreen/offscreen.html"),E.info({message:"[OFFSCREEN-MANAGER] Attempting to create offscreen document with URL:",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN,meta:{offscreenUrl:t}}),e.p=1,e.n=2,chrome.offscreen.createDocument({url:t,reasons:["DOM_PARSER","IFRAME_SCRIPTING","BLOBS"],justification:"Manages DOM-dependent operations like crypto and ZK proof generation for the extension."});case 2:e.n=5;break;case 3:if(e.p=3,!(r=e.v).message||!r.message.includes("Only a single offscreen document may be created.")){e.n=4;break}E.info({message:"[OFFSCREEN-MANAGER] Offscreen document already exists or creation was attempted by another part.",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),e.n=5;break;case 4:throw E.error({message:"[OFFSCREEN-MANAGER] Error creating offscreen document:",logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.OFFSCREEN,meta:{error:r}}),r;case 5:return e.a(2)}},e,null,[[1,3]])}))).apply(this,arguments)}function R(){return T.apply(this,arguments)}function T(){return T=m(p().m(function e(){var t,r=arguments;return p().w(function(e){for(;;)switch(e.n){case 0:if(t=r.length>0&&void 0!==r[0]?r[0]:15e3,!b){e.n=1;break}return E.info({message:"[OFFSCREEN-MANAGER] Already ready (waitForOffscreenReadyInternal check)",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),e.a(2,!0);case 1:E.info({message:"[OFFSCREEN-MANAGER] Waiting for offscreen document to be ready (timeout:- ${timeoutMs}ms)...",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN,meta:{timeoutMs:t}});try{chrome.runtime.sendMessage({action:o.wx.PING_OFFSCREEN,source:o.J_.BACKGROUND,target:o.J_.OFFSCREEN})}catch(e){E.info({message:"[OFFSCREEN-MANAGER] Synchronous error sending ping:"+(null==e?void 0:e.message),logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN,meta:{error:e}})}return e.a(2,new Promise(function(e){if(b)return E.info({message:"[OFFSCREEN-MANAGER] Became ready while setting up promise.",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),void e(!0);var r=function(t){t.action===o.wx.OFFSCREEN_DOCUMENT_READY&&t.source===o.J_.OFFSCREEN&&t.target===o.J_.BACKGROUND&&(b=!0,clearTimeout(n),chrome.runtime.onMessage.removeListener(r),v===n&&(v=null),e(!0))};chrome.runtime.onMessage.addListener(r),v&&clearTimeout(v);var n=setTimeout(function(){chrome.runtime.onMessage.removeListener(r),E.error({message:"[OFFSCREEN-MANAGER] Timed out waiting for offscreen document after "+t+" ms.",logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.OFFSCREEN,meta:{timeoutMs:t}}),v===n&&(v=null),e(!1)},t);v=n}))}},e)})),T.apply(this,arguments)}function _(e){return N.apply(this,arguments)}function N(){return N=m(p().m(function e(t){return p().w(function(e){for(;;)switch(e.n){case 0:if(!b){e.n=1;break}return t.info({message:"[OFFSCREEN-MANAGER] Document already confirmed ready.",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),e.a(2,!0);case 1:if(!O){e.n=2;break}return t.info({message:"[OFFSCREEN-MANAGER] Creation already in progress, awaiting...",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),e.n=2,O;case 2:if(!chrome.runtime.getContexts){e.n=6;break}return e.n=3,chrome.runtime.getContexts({contextTypes:["OFFSCREEN_DOCUMENT"]});case 3:if(!(e.v.length>0)){e.n=6;break}if(t.info({message:"[OFFSCREEN-MANAGER] Offscreen document context found.",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),!b){e.n=4;break}return e.a(2,!0);case 4:return t.info({message:"[OFFSCREEN-MANAGER] Context exists, but not marked ready. Waiting for signal...",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),e.n=5,R(5e3);case 5:return e.a(2,e.v);case 6:if(O){e.n=7;break}return t.info({message:"[OFFSCREEN-MANAGER] No existing context/promise, initiating creation.",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),O=S().finally(function(){O=null}),e.n=7,O;case 7:return e.n=8,R(5e4);case 8:if(e.v){e.n=9;break}throw new Error("Failed to initialize or confirm offscreen document readiness.");case 9:return t.info({message:"[OFFSCREEN-MANAGER] Offscreen document ensured to be ready.",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),e.a(2,!0)}},e)})),N.apply(this,arguments)}function C(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return P(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(P(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,P(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,P(f,"constructor",u),P(u,"constructor",c),c.displayName="GeneratorFunction",P(u,o,"GeneratorFunction"),P(f),P(f,o,"Generator"),P(f,n,function(){return this}),P(f,"toString",function(){return"[object Generator]"}),(C=function(){return{w:i,m:h}})()}function P(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}P=function(e,t,r,n){function i(t,r){P(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},P(e,t,r,n)}function L(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}"undefined"!=typeof chrome&&chrome.runtime&&chrome.runtime.onMessage&&A(),A();var D=function(){var e,t=(e=C().m(function e(t,r){var n,i;return C().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=r,e.p=1,n.setContext({sessionId:t.sessionId||"unknown",providerId:t.providerId||"unknown",appId:t.applicationId||"unknown"}),t){e.n=2;break}throw n.error({message:"[PROOF-GENERATOR] No claim data provided for proof generation",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.PROOF}),new Error("No claim data provided for proof generation");case 2:return e.n=3,_(n);case 3:return e.a(2,new Promise(function(e,r){var i=setTimeout(function(){n.error({message:"[PROOF-GENERATOR] Timeout waiting for offscreen document to generate proof",logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.PROOF}),r({success:!1,error:"Timeout waiting for offscreen document to generate proof"})},6e4),a=function(t){if(t.action===o.wx.GENERATE_PROOF_RESPONSE&&t.source===o.J_.OFFSCREEN&&t.target===o.J_.BACKGROUND){var r,c;if(clearTimeout(i),chrome.runtime.onMessage.removeListener(a),n.all({message:"[PROOF-GENERATOR] Offscreen response: "+JSON.stringify(t),logLevel:s.LOG_LEVEL.ALL,type:s.LOG_TYPES.PROOF,meta:{response:t}}),!t.success)return n.error({message:"[PROOF-GENERATOR] Proof generation failed:",logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.PROOF,meta:{error:t.error}}),void e({success:!1,error:t.error||"Unknown error in proof generation"});var u=(null==t||null===(r=t.proof)||void 0===r||null===(r=r.error)||void 0===r?void 0:r.message)||("string"==typeof(null==t||null===(c=t.proof)||void 0===c?void 0:c.error)?t.proof.error:null);if(u)return n.error({message:"[PROOF-GENERATOR] Proof contains embedded error: "+u,logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.PROOF,meta:{error:u}}),void e({success:!1,error:u});n.info({message:"[PROOF-GENERATOR] Proof generation successful",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.PROOF}),e(t)}};chrome.runtime.onMessage.addListener(a),chrome.runtime.sendMessage({action:o.wx.GENERATE_PROOF,source:o.J_.BACKGROUND,target:o.J_.OFFSCREEN,data:t},function(){chrome.runtime.lastError&&(clearTimeout(i),chrome.runtime.onMessage.removeListener(a),n.error({message:"[PROOF-GENERATOR] Error sending message to offscreen document "+chrome.runtime.lastError.message,logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.PROOF,meta:{error:chrome.runtime.lastError.message}}),r({success:!1,error:chrome.runtime.lastError.message||"Error communicating with offscreen document"}))})}));case 4:return e.p=4,i=e.v,n.error({message:"[PROOF-GENERATOR] Error in proof generation process: "+i.message,logLevel:s.LOG_LEVEL.ERROR,type:s.LOG_TYPES.PROOF,meta:{error:i}}),e.a(2,{success:!1,error:i.message||"Unknown error in proof generation process"})}},e,null,[[1,4]])}),function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){L(i,n,o,s,a,"next",e)}function a(e){L(i,n,o,s,a,"throw",e)}s(void 0)})});return function(e,r){return t.apply(this,arguments)}}(),U=r(573),x=r(153);class G{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+G.version}static addUnaryOp(e){return G.max_unop_len=Math.max(e.length,G.max_unop_len),G.unary_ops[e]=1,G}static addBinaryOp(e,t,r){return G.max_binop_len=Math.max(e.length,G.max_binop_len),G.binary_ops[e]=t,r?G.right_associative.add(e):G.right_associative.delete(e),G}static addIdentifierChar(e){return G.additional_identifier_chars.add(e),G}static addLiteral(e,t){return G.literals[e]=t,G}static removeUnaryOp(e){return delete G.unary_ops[e],e.length===G.max_unop_len&&(G.max_unop_len=G.getMaxKeyLen(G.unary_ops)),G}static removeAllUnaryOps(){return G.unary_ops={},G.max_unop_len=0,G}static removeIdentifierChar(e){return G.additional_identifier_chars.delete(e),G}static removeBinaryOp(e){return delete G.binary_ops[e],e.length===G.max_binop_len&&(G.max_binop_len=G.getMaxKeyLen(G.binary_ops)),G.right_associative.delete(e),G}static removeAllBinaryOps(){return G.binary_ops={},G.max_binop_len=0,G}static removeLiteral(e){return delete G.literals[e],G}static removeAllLiterals(){return G.literals={},G}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new G(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(e=>e.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return G.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!G.binary_ops[String.fromCharCode(e)]||G.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return G.isIdentifierStart(e)||G.isDecimalDigit(e)}throwError(e){const t=new Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(G.hooks[e]){const r={context:this,node:t};return G.hooks.run(e,r),r.node}return t}searchHook(e){if(G.hooks[e]){const t={context:this};return G.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===G.SPACE_CODE||e===G.TAB_CODE||e===G.LF_CODE||e===G.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:G.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t,r,n=[];for(;this.index<this.expr.length;)if(t=this.code,t===G.SEMCOL_CODE||t===G.COMMA_CODE)this.index++;else if(r=this.gobbleExpression())n.push(r);else if(this.index<this.expr.length){if(t===e)break;this.throwError('Unexpected "'+this.char+'"')}return n}gobbleExpression(){const e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,G.max_binop_len),t=e.length;for(;t>0;){if(G.binary_ops.hasOwnProperty(e)&&(!G.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!G.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,r,n,o,i,s,a,c;if(i=this.gobbleToken(),!i)return i;if(t=this.gobbleBinaryOp(),!t)return i;for(o={value:t,prec:G.binaryPrecedence(t),right_a:G.right_associative.has(t)},s=this.gobbleToken(),s||this.throwError("Expected expression after "+t),n=[i,o,s];t=this.gobbleBinaryOp();){if(r=G.binaryPrecedence(t),0===r){this.index-=t.length;break}o={value:t,prec:r,right_a:G.right_associative.has(t)},c=t;const a=e=>o.right_a&&e.right_a?r>e.prec:r<=e.prec;for(;n.length>2&&a(n[n.length-2]);)s=n.pop(),t=n.pop().value,i=n.pop(),e={type:G.BINARY_EXP,operator:t,left:i,right:s},n.push(e);e=this.gobbleToken(),e||this.throwError("Expected expression after "+c),n.push(o,e)}for(a=n.length-1,e=n[a];a>1;)e={type:G.BINARY_EXP,operator:n[a-1].value,left:n[a-2],right:e},a-=2;return e}gobbleToken(){let e,t,r,n;if(this.gobbleSpaces(),n=this.searchHook("gobble-token"),n)return this.runHook("after-token",n);if(e=this.code,G.isDecimalDigit(e)||e===G.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===G.SQUOTE_CODE||e===G.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(e===G.OBRACK_CODE)n=this.gobbleArray();else{for(t=this.expr.substr(this.index,G.max_unop_len),r=t.length;r>0;){if(G.unary_ops.hasOwnProperty(t)&&(!G.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!G.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=r;const e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:G.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--r)}G.isIdentifierStart(e)?(n=this.gobbleIdentifier(),G.literals.hasOwnProperty(n.name)?n={type:G.LITERAL,value:G.literals[n.name],raw:n.name}:n.name===G.this_str&&(n={type:G.THIS_EXP})):e===G.OPAREN_CODE&&(n=this.gobbleGroup())}return n?(n=this.gobbleTokenProperty(n),this.runHook("after-token",n)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===G.PERIOD_CODE||t===G.OBRACK_CODE||t===G.OPAREN_CODE||t===G.QUMARK_CODE;){let r;if(t===G.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==G.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===G.OBRACK_CODE?((e={type:G.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),t=this.code,t!==G.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===G.OPAREN_CODE?e={type:G.CALL_EXP,arguments:this.gobbleArguments(G.CPAREN_CODE),callee:e}:(t===G.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),e={type:G.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),r&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e,t,r="";for(;G.isDecimalDigit(this.code);)r+=this.expr.charAt(this.index++);if(this.code===G.PERIOD_CODE)for(r+=this.expr.charAt(this.index++);G.isDecimalDigit(this.code);)r+=this.expr.charAt(this.index++);if(e=this.char,"e"===e||"E"===e){for(r+=this.expr.charAt(this.index++),e=this.char,"+"!==e&&"-"!==e||(r+=this.expr.charAt(this.index++));G.isDecimalDigit(this.code);)r+=this.expr.charAt(this.index++);G.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+r+this.char+")")}return t=this.code,G.isIdentifierStart(t)?this.throwError("Variable names cannot start with a number ("+r+this.char+")"):(t===G.PERIOD_CODE||1===r.length&&r.charCodeAt(0)===G.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:G.LITERAL,value:parseFloat(r),raw:r}}gobbleStringLiteral(){let e="";const t=this.index,r=this.expr.charAt(this.index++);let n=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===r){n=!0;break}if("\\"===t)switch(t=this.expr.charAt(this.index++),t){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+="\t";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return n||this.throwError('Unclosed quote after "'+e+'"'),{type:G.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(G.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,G.isIdentifierPart(e));)this.index++;return{type:G.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){const t=[];let r=!1,n=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let o=this.code;if(o===e){r=!0,this.index++,e===G.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(o===G.COMMA_CODE){if(this.index++,n++,n!==t.length)if(e===G.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===G.CBRACK_CODE)for(let e=t.length;e<n;e++)t.push(null)}else if(t.length!==n&&0!==n)this.throwError("Expected comma");else{const e=this.gobbleExpression();e&&e.type!==G.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return r||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(G.CPAREN_CODE);if(this.code===G.CPAREN_CODE)return this.index++,1===e.length?e[0]:!!e.length&&{type:G.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:G.ARRAY_EXP,elements:this.gobbleArguments(G.CBRACK_CODE)}}}const F=new class{add(e,t,r){if("string"!=typeof arguments[0])for(let e in arguments[0])this.add(e,arguments[0][e],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][r?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}};Object.assign(G,{hooks:F,plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.forEach(e=>{if("object"!=typeof e||!e.name||!e.init)throw new Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)})}}(G),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),G.max_unop_len=G.getMaxKeyLen(G.unary_ops),G.max_binop_len=G.getMaxKeyLen(G.binary_ops);const k=e=>new G(e).parse(),B=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(G).filter(e=>!B.includes(e)&&void 0===k[e]).forEach(e=>{k[e]=G[e]}),k.Jsep=G;var M={name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;const r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const o=this.gobbleExpression();if(o||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:o},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}};k.plugins.register(M);var j={name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(47===this.code){const r=++this.index;let n=!1;for(;this.index<this.expr.length;){if(47===this.code&&!n){const n=this.expr.slice(r,this.index);let o,i="";for(;++this.index<this.expr.length;){const e=this.code;if(!(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57))break;i+=this.char}try{o=new RegExp(n,i)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:o,raw:this.expr.slice(r-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?n=!0:n&&this.code===e.CBRACK_CODE&&(n=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}};const K={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[43,45],assignmentPrecedence:.9,init(e){const t=[e.IDENTIFIER,e.MEMBER_EXP];function r(e){K.assignmentOperators.has(e.operator)?(e.type="AssignmentExpression",r(e.left),r(e.right)):e.operator||Object.values(e).forEach(e=>{e&&"object"==typeof e&&r(e)})}K.assignmentOperators.forEach(t=>e.addBinaryOp(t,K.assignmentPrecedence,!0)),e.hooks.add("gobble-token",function(e){const r=this.code;K.updateOperators.some(e=>e===r&&e===this.expr.charCodeAt(this.index+1))&&(this.index+=2,e.node={type:"UpdateExpression",operator:43===r?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},e.node.argument&&t.includes(e.node.argument.type)||this.throwError(`Unexpected ${e.node.operator}`))}),e.hooks.add("after-token",function(e){if(e.node){const r=this.code;K.updateOperators.some(e=>e===r&&e===this.expr.charCodeAt(this.index+1))&&(t.includes(e.node.type)||this.throwError(`Unexpected ${e.node.operator}`),this.index+=2,e.node={type:"UpdateExpression",operator:43===r?"++":"--",argument:e.node,prefix:!1})}}),e.hooks.add("after-expression",function(e){e.node&&r(e.node)})}};k.plugins.register(j,K),k.addUnaryOp("typeof"),k.addLiteral("null",null),k.addLiteral("undefined",void 0);const V=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),$={evalAst(e,t){switch(e.type){case"BinaryExpression":case"LogicalExpression":return $.evalBinaryExpression(e,t);case"Compound":return $.evalCompound(e,t);case"ConditionalExpression":return $.evalConditionalExpression(e,t);case"Identifier":return $.evalIdentifier(e,t);case"Literal":return $.evalLiteral(e,t);case"MemberExpression":return $.evalMemberExpression(e,t);case"UnaryExpression":return $.evalUnaryExpression(e,t);case"ArrayExpression":return $.evalArrayExpression(e,t);case"CallExpression":return $.evalCallExpression(e,t);case"AssignmentExpression":return $.evalAssignmentExpression(e,t);default:throw SyntaxError("Unexpected expression",e)}},evalBinaryExpression:(e,t)=>({"||":(e,t)=>e||t(),"&&":(e,t)=>e&&t(),"|":(e,t)=>e|t(),"^":(e,t)=>e^t(),"&":(e,t)=>e&t(),"==":(e,t)=>e==t(),"!=":(e,t)=>e!=t(),"===":(e,t)=>e===t(),"!==":(e,t)=>e!==t(),"<":(e,t)=>e<t(),">":(e,t)=>e>t(),"<=":(e,t)=>e<=t(),">=":(e,t)=>e>=t(),"<<":(e,t)=>e<<t(),">>":(e,t)=>e>>t(),">>>":(e,t)=>e>>>t(),"+":(e,t)=>e+t(),"-":(e,t)=>e-t(),"*":(e,t)=>e*t(),"/":(e,t)=>e/t(),"%":(e,t)=>e%t()}[e.operator]($.evalAst(e.left,t),()=>$.evalAst(e.right,t))),evalCompound(e,t){let r;for(let n=0;n<e.body.length;n++){"Identifier"===e.body[n].type&&["var","let","const"].includes(e.body[n].name)&&e.body[n+1]&&"AssignmentExpression"===e.body[n+1].type&&(n+=1);const o=e.body[n];r=$.evalAst(o,t)}return r},evalConditionalExpression:(e,t)=>$.evalAst(e.test,t)?$.evalAst(e.consequent,t):$.evalAst(e.alternate,t),evalIdentifier(e,t){if(Object.hasOwn(t,e.name))return t[e.name];throw ReferenceError(`${e.name} is not defined`)},evalLiteral:e=>e.value,evalMemberExpression(e,t){const r=String(e.computed?$.evalAst(e.property):e.property.name),n=$.evalAst(e.object,t);if(null==n)throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);if(!Object.hasOwn(n,r)&&V.has(r))throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);const o=n[r];return"function"==typeof o?o.bind(n):o},evalUnaryExpression:(e,t)=>({"-":e=>-$.evalAst(e,t),"!":e=>!$.evalAst(e,t),"~":e=>~$.evalAst(e,t),"+":e=>+$.evalAst(e,t),typeof:e=>typeof $.evalAst(e,t)}[e.operator](e.argument)),evalArrayExpression:(e,t)=>e.elements.map(e=>$.evalAst(e,t)),evalCallExpression(e,t){const r=e.arguments.map(e=>$.evalAst(e,t));return $.evalAst(e.callee,t)(...r)},evalAssignmentExpression(e,t){if("Identifier"!==e.left.type)throw SyntaxError("Invalid left-hand side in assignment");const r=e.left.name,n=$.evalAst(e.right,t);return t[r]=n,t[r]}};function H(e,t){return(e=e.slice()).push(t),e}function Y(e,t){return(t=t.slice()).unshift(e),t}class q extends Error{constructor(e){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=e,this.name="NewError"}}function z(e,t,r,n,o){if(!(this instanceof z))try{return new z(e,t,r,n,o)}catch(e){if(!e.avoidNew)throw e;return e.value}"string"==typeof e&&(o=n,n=r,r=t,t=e,e=null);const i=e&&"object"==typeof e;if(e=e||{},this.json=e.json||r,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=!Object.hasOwn(e,"wrap")||e.wrap,this.sandbox=e.sandbox||{},this.eval=void 0===e.eval?"safe":e.eval,this.ignoreEvalErrors=void 0!==e.ignoreEvalErrors&&e.ignoreEvalErrors,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||n||null,this.otherTypeCallback=e.otherTypeCallback||o||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},!1!==e.autostart){const n={path:i?e.path:t};i?"json"in e&&(n.json=e.json):n.json=r;const o=this.evaluate(n);if(!o||"object"!=typeof o)throw new q(o);return o}}z.prototype.evaluate=function(e,t,r,n){let o=this.parent,i=this.parentProperty,{flatten:s,wrap:a}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=n||this.otherTypeCallback,t=t||this.json,(e=e||this.path)&&"object"==typeof e&&!Array.isArray(e)){if(!e.path&&""!==e.path)throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),s=Object.hasOwn(e,"flatten")?e.flatten:s,this.currResultType=Object.hasOwn(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=Object.hasOwn(e,"sandbox")?e.sandbox:this.currSandbox,a=Object.hasOwn(e,"wrap")?e.wrap:a,this.currEval=Object.hasOwn(e,"eval")?e.eval:this.currEval,r=Object.hasOwn(e,"callback")?e.callback:r,this.currOtherTypeCallback=Object.hasOwn(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,o=Object.hasOwn(e,"parent")?e.parent:o,i=Object.hasOwn(e,"parentProperty")?e.parentProperty:i,e=e.path}if(o=o||null,i=i||null,Array.isArray(e)&&(e=z.toPathString(e)),!e&&""!==e||!t)return;const c=z.toPathArray(e);"$"===c[0]&&c.length>1&&c.shift(),this._hasParentSelector=null;const u=this._trace(c,t,["$"],o,i,r).filter(function(e){return e&&!e.isParentSelector});return u.length?a||1!==u.length||u[0].hasArrExpr?u.reduce((e,t)=>{const r=this._getPreferredOutput(t);return s&&Array.isArray(r)?e=e.concat(r):e.push(r),e},[]):this._getPreferredOutput(u[0]):a?[]:void 0},z.prototype._getPreferredOutput=function(e){const t=this.currResultType;switch(t){case"all":{const t=Array.isArray(e.path)?e.path:z.toPathArray(e.path);return e.pointer=z.toPointer(t),e.path="string"==typeof e.path?e.path:z.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return z.toPathString(e[t]);case"pointer":return z.toPointer(e.path);default:throw new TypeError("Unknown result type")}},z.prototype._handleCallback=function(e,t,r){if(t){const n=this._getPreferredOutput(e);e.path="string"==typeof e.path?e.path:z.toPathString(e.path),t(n,r,e)}},z.prototype._trace=function(e,t,r,n,o,i,s,a){let c;if(!e.length)return c={path:r,value:t,parent:n,parentProperty:o,hasArrExpr:s},this._handleCallback(c,i,"value"),c;const u=e[0],l=e.slice(1),f=[];function h(e){Array.isArray(e)?e.forEach(e=>{f.push(e)}):f.push(e)}if(("string"!=typeof u||a)&&t&&Object.hasOwn(t,u))h(this._trace(l,t[u],H(r,u),t,u,i,s));else if("*"===u)this._walk(t,e=>{h(this._trace(l,t[e],H(r,e),t,e,i,!0,!0))});else if(".."===u)h(this._trace(l,t,r,n,o,i,s)),this._walk(t,n=>{"object"==typeof t[n]&&h(this._trace(e.slice(),t[n],H(r,n),t,n,i,!0))});else{if("^"===u)return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:l,isParentSelector:!0};if("~"===u)return c={path:H(r,u),value:o,parent:n,parentProperty:null},this._handleCallback(c,i,"property"),c;if("$"===u)h(this._trace(l,t,r,null,null,i,s));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(u))h(this._slice(u,l,t,r,n,o,i));else if(0===u.indexOf("?(")){if(!1===this.currEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const e=u.replace(/^\?\((.*?)\)$/u,"$1"),s=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(e);s?this._walk(t,e=>{const a=[s[2]],c=s[1]?t[e][s[1]]:t[e];this._trace(a,c,r,n,o,i,!0).length>0&&h(this._trace(l,t[e],H(r,e),t,e,i,!0))}):this._walk(t,s=>{this._eval(e,t[s],s,r,n,o)&&h(this._trace(l,t[s],H(r,s),t,s,i,!0))})}else if("("===u[0]){if(!1===this.currEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");h(this._trace(Y(this._eval(u,t,r.at(-1),r.slice(0,-1),n,o),l),t,r,n,o,i,s))}else if("@"===u[0]){let e=!1;const s=u.slice(1,-2);switch(s){case"scalar":t&&["object","function"].includes(typeof t)||(e=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===s&&(e=!0);break;case"integer":!Number.isFinite(t)||t%1||(e=!0);break;case"number":Number.isFinite(t)&&(e=!0);break;case"nonFinite":"number"!=typeof t||Number.isFinite(t)||(e=!0);break;case"object":t&&typeof t===s&&(e=!0);break;case"array":Array.isArray(t)&&(e=!0);break;case"other":e=this.currOtherTypeCallback(t,r,n,o);break;case"null":null===t&&(e=!0);break;default:throw new TypeError("Unknown value type "+s)}if(e)return c={path:r,value:t,parent:n,parentProperty:o},this._handleCallback(c,i,"value"),c}else if("`"===u[0]&&t&&Object.hasOwn(t,u.slice(1))){const e=u.slice(1);h(this._trace(l,t[e],H(r,e),t,e,i,s,!0))}else if(u.includes(",")){const e=u.split(",");for(const s of e)h(this._trace(Y(s,l),t,r,n,o,i,!0))}else!a&&t&&Object.hasOwn(t,u)&&h(this._trace(l,t[u],H(r,u),t,u,i,s,!0))}if(this._hasParentSelector)for(let e=0;e<f.length;e++){const r=f[e];if(r&&r.isParentSelector){const a=this._trace(r.expr,t,r.path,n,o,i,s);if(Array.isArray(a)){f[e]=a[0];const t=a.length;for(let r=1;r<t;r++)e++,f.splice(e,0,a[r])}else f[e]=a}}return f},z.prototype._walk=function(e,t){if(Array.isArray(e)){const r=e.length;for(let e=0;e<r;e++)t(e)}else e&&"object"==typeof e&&Object.keys(e).forEach(e=>{t(e)})},z.prototype._slice=function(e,t,r,n,o,i,s){if(!Array.isArray(r))return;const a=r.length,c=e.split(":"),u=c[2]&&Number.parseInt(c[2])||1;let l=c[0]&&Number.parseInt(c[0])||0,f=c[1]&&Number.parseInt(c[1])||a;l=l<0?Math.max(0,l+a):Math.min(a,l),f=f<0?Math.max(0,f+a):Math.min(a,f);const h=[];for(let e=l;e<f;e+=u){this._trace(Y(e,t),r,n,o,i,s,!0).forEach(e=>{h.push(e)})}return h},z.prototype._eval=function(e,t,r,n,o,i){this.currSandbox._$_parentProperty=i,this.currSandbox._$_parent=o,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;const s=e.includes("@path");s&&(this.currSandbox._$_path=z.toPathString(n.concat([r])));const a=this.currEval+"Script:"+e;if(!z.cache[a]){let t=e.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(s&&(t=t.replaceAll("@path","_$_path")),"safe"===this.currEval||!0===this.currEval||void 0===this.currEval)z.cache[a]=new this.safeVm.Script(t);else if("native"===this.currEval)z.cache[a]=new this.vm.Script(t);else if("function"==typeof this.currEval&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const e=this.currEval;z.cache[a]=new e(t)}else{if("function"!=typeof this.currEval)throw new TypeError(`Unknown "eval" property "${this.currEval}"`);z.cache[a]={runInNewContext:e=>this.currEval(t,e)}}}try{return z.cache[a].runInNewContext(this.currSandbox)}catch(t){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+t.message+": "+e)}},z.cache={},z.toPathString=function(e){const t=e,r=t.length;let n="$";for(let e=1;e<r;e++)/^(~|\^|@.*?\(\))$/u.test(t[e])||(n+=/^[0-9*]+$/u.test(t[e])?"["+t[e]+"]":"['"+t[e]+"']");return n},z.toPointer=function(e){const t=e,r=t.length;let n="";for(let e=1;e<r;e++)/^(~|\^|@.*?\(\))$/u.test(t[e])||(n+="/"+t[e].toString().replaceAll("~","~0").replaceAll("/","~1"));return n},z.toPathArray=function(e){const{cache:t}=z;if(t[e])return t[e].concat();const r=[],n=e.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(e,t){return"[#"+(r.push(t)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(e,t){return"['"+t.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(e,t){return";"+t.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(e){const t=e.match(/#(\d+)/u);return t&&t[1]?r[t[1]]:e});return t[e]=n,t[e].concat()},z.prototype.safeVm={Script:class{constructor(e){this.code=e,this.ast=k(this.code)}runInNewContext(e){const t=Object.assign(Object.create(null),e);return $.evalAst(this.ast,t)}}};z.prototype.vm={Script:class{constructor(e){this.code=e}runInNewContext(e){let t=this.code;const r=Object.keys(e),n=[];!function(e,t,r){const n=e.length;for(let o=0;o<n;o++)r(e[o])&&t.push(e.splice(o--,1)[0])}(r,n,t=>"function"==typeof e[t]);const o=r.map(t=>e[t]);t=n.reduce((t,r)=>{let n=e[r].toString();return/function/u.test(n)||(n="function "+n),"var "+r+"="+n+";"+t},"")+t,/(['"])use strict\1/u.test(t)||r.includes("arguments")||(t="var arguments = undefined;"+t),t=t.replace(/;\s*$/u,"");const i=t.lastIndexOf(";"),s=-1!==i?t.slice(0,i+1)+" return "+t.slice(i+1):" return "+t;return new Function(...r,s)(...o)}}};var W=function(e,t){try{var r=z({path:t,json:e}),n=null==r?void 0:r[0];if(void 0===n)return;return null===n?"null":n}catch(e){return void x.w9.error(x.Ey.CLAIM,"[PARAMS-EXTRACTOR-UTILS] Error extracting JSON value with path ".concat(t,":"),e)}},J=function(e,t){try{var r=t.replace(/^\/\//,"").replace(/\/@/," ").split("/"),n=r[r.length-1],o=new RegExp("<".concat(n,"[^>]*>(.*?)</").concat(n,">"),"i"),i=e.match(o);return i?i[1]:void 0}catch(e){return void x.w9.error(x.Ey.CLAIM,"[PARAMS-EXTRACTOR-UTILS] Error extracting HTML value with XPath ".concat(t,":"),e)}};function X(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Q(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Q(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw i}}}}function Q(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Z(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.replace(/[[\]()*+?.,\\^$|#]/g,"\\$&"),o=function(e){for(var t,r=/{{(\w+)}}/g,n=[];null!==(t=r.exec(e));)n.push(t[1]);return n}(e),i=[],s=X(o);try{for(s.s();!(t=s.n()).done;){var a=t.value;if(r[a])n=n.replace("{{".concat(a,"}}"),r[a]);else{i.push(a);var c=a.endsWith("GRD")?"(.*)":"(.*?)";n=n.replace("{{".concat(a,"}}"),c)}}}catch(e){s.e(e)}finally{s.f()}return{pattern:n,allVars:o,unsubstitutedVars:i}}function ee(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,s,a=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return te(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?te(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function re(e){return re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},re(e)}var ne=function(e){return e?(e.match(/{{([^}]+)}}/g)||[]).map(function(e){return e.substring(2,e.length-2)}):[]},oe=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e||!t)return r;var n=ne(e),o=Z(e,n).pattern,i=t.match(o);if(i&&i.length>1)for(var s=0;s<n.length;s++)i[s+1]&&(r[n[s]]=i[s+1]);return r},ie=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e||!t)return r;var n=ne(e),o=Z(e,{}).pattern,i=new RegExp(o),s=t.match(i);if(s&&s.length>1)for(var a=0;a<n.length;a++)s[a+1]&&(r[n[a]]=s[a+1]);return r},se=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=arguments.length>4?arguments[4]:void 0;if(!e)return n;try{var i=null,s=function(e){if(!e||"string"!=typeof e)return!1;var t=e.trim();return t.startsWith("{")||t.startsWith("[")}(e);if(s&&(i=function(e){try{return JSON.parse(e)}catch(e){return x.w9.warn(x.Ey.CLAIM,"[PARAMS-EXTRACTOR-UTILS] Response looks like JSON but couldn't be parsed"),null}}(e)),t&&t.length>0&&r&&r.length>0)for(var a=0;a<t.length;a++){var c=t[a],u=r[a];if(!c.value)return;var l=ne(c.value);if(0===l.length)return;var f=u;if(f){var h=null;if(f.jsonPath&&i)h=W(i,f.jsonPath);else if(f.xPath&&!s)h=J(e,f.xPath);else if(f.regex){var d=e.match(new RegExp(f.regex));d&&d.length>1&&(h=d[1])}void 0!==h&&("object"===re(h)&&null!==h?n[l[0]]=JSON.stringify(h):n[l[0]]=null===h?null:String(h))}}}catch(e){o.error({message:"[PARAM-EXTRACTOR] Error extracting params from response:",logLevel:x.E$.INFO,type:x.D_.CLAIM_CREATION,eventType:x.Ru.CLAIM_PARAMETER_VALIDATION_FAILED_EXCEPTION,meta:{error:e}})}return n},ae=function(e){var t={},r={};return Object.entries(e||{}).forEach(function(e){var n=ee(e,2),o=n[0],i=n[1];o.toLowerCase().includes("secret")?r[o]=i:t[o]=i}),{publicParams:t,secretParams:r}},ce=r(379);function ue(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return le(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(le(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,le(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,le(f,"constructor",u),le(u,"constructor",c),c.displayName="GeneratorFunction",le(u,o,"GeneratorFunction"),le(f),le(f,o,"Generator"),le(f,n,function(){return this}),le(f,"toString",function(){return"[object Generator]"}),(ue=function(){return{w:i,m:h}})()}function le(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}le=function(e,t,r,n){function i(t,r){le(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},le(e,t,r,n)}function fe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function he(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fe(Object(r),!0).forEach(function(t){de(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fe(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function de(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=pe(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=pe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==pe(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pe(e){return pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pe(e)}function ge(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,s,a=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ye(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ye(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function me(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}var Ee=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:135,t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e<=0&&(e=135);var r="Chrome/".concat(e,".0.0.0"),n=t?" Mobile":"";return"Mozilla/5.0 ".concat("(Linux; Android 10; K)"," ").concat("AppleWebKit/537.36 (KHTML, like Gecko)"," ").concat(r).concat(n," ").concat("Safari/537.36")},be=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"unknown",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown",r=arguments.length>2?arguments[2]:void 0;return r.setContext({sessionId:e,providerId:t,type:s.LOG_TYPES.CLAIM_CREATION}),new Promise(function(n,i){var a=setTimeout(function(){chrome.runtime.onMessage.removeListener(c),i(new Error("Timeout: No response from offscreen document for private key request."))},1e4),c=function(e,t){return e.action!==o.wx.GET_PRIVATE_KEY_RESPONSE||e.source!==o.J_.OFFSCREEN||e.target!==o.J_.BACKGROUND||(clearTimeout(a),chrome.runtime.onMessage.removeListener(c),e.success&&e.privateKey?(r.info({message:"[CLAIM-CREATOR] Received private key from offscreen document",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION}),n(e.privateKey)):(r.error({message:"[CLAIM-CREATOR] Failed to get private key from offscreen document: "+e.error,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION}),i(new Error(e.error||"Unknown error getting private key from offscreen document."))),!1)};chrome.runtime.onMessage.addListener(c),r.info({message:"[CLAIM-CREATOR] Requesting private key from offscreen document",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION}),chrome.runtime.sendMessage({action:o.wx.GET_PRIVATE_KEY,source:o.J_.BACKGROUND,target:o.J_.OFFSCREEN,sessionId:e,providerId:t},function(e){chrome.runtime.lastError&&(clearTimeout(a),chrome.runtime.onMessage.removeListener(c),r.error({message:"[CLAIM-CREATOR] Error sending GET_PRIVATE_KEY message: "+chrome.runtime.lastError.message,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION}),i(new Error("Error sending message to offscreen document: ".concat(chrome.runtime.lastError.message))))})})},ve=function(){var e,t=(e=ue().m(function e(t,r){var n,o,i,a,c,u,l,f,h,d,p,g,y,m,E,b,v,O,I,A,S,w,R=arguments;return ue().w(function(e){for(;;)switch(e.p=e.n){case 0:return i=R.length>2&&void 0!==R[2]?R[2]:"unknown",a=R.length>3&&void 0!==R[3]?R[3]:"unknown",c=R.length>4?R[4]:void 0,(u=R.length>5?R[5]:void 0).setContext({sessionId:i,providerId:a,type:s.LOG_TYPES.CLAIM_CREATION}),u.info({message:"[CLAIM-CREATOR] Creating claim object from request data",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION,eventType:s.EVENT_TYPES.CLAIM_CREATION_STARTED}),e.p=1,e.n=2,_(u);case 2:u.info({message:"[CLAIM-CREATOR] Offscreen document is ready.",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION,eventType:s.EVENT_TYPES.OFFSCREEN_DOCUMENT_READY}),e.n=4;break;case 3:throw e.p=3,S=e.v,u.error({message:"[CLAIM-CREATOR] Failed to ensure offscreen document: "+(null==S?void 0:S.message),logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION,eventType:s.EVENT_TYPES.OFFSCREEN_DOCUMENT_NOT_READY_EXCEPTION,meta:{error:null==S?void 0:S.message,request:t,providerData:r,sessionId:i,loginUrl:c}}),new Error("Failed to initialize offscreen document: ".concat(S.message));case 4:return l="undefined"!=typeof navigator&&navigator.userAgent||Ee(),f=["user-agent","accept","accept-language","accept-encoding","sec-fetch-mode","sec-fetch-site","sec-fetch-user","origin","x-requested-with","sec-ch-ua","sec-ch-ua-mobile"],d={},(h={}).url="TEMPLATE"===r.urlType?r.url:t.url,h.method=t.method||"GET",t.headers&&(p={"Sec-Fetch-Mode":"same-origin","Sec-Fetch-Site":"same-origin","User-Agent":l},g={Referer:t.referer&&String(t.referer)||c||origin||""},Object.entries(t.headers).forEach(function(e){var t=ge(e,2),r=t[0],n=t[1],o=r.toLowerCase();f.includes(o)?p[r]=n:g[r]=n}),Object.keys(p).length>0&&(h.headers=p),Object.keys(g).length>0&&(d.headers=g)),t.body&&(null!=r&&null!==(y=r.bodySniff)&&void 0!==y&&y.enabled?h.body=r.bodySniff.template:h.body=t.body),t.cookieStr&&(d.cookieStr=t.cookieStr),m={},null!=t&&t.extractedParams&&"object"===pe(t.extractedParams)&&(m=he(he({},m),t.extractedParams)),"TEMPLATE"===r.urlType&&t.url&&(m=he(he({},m),oe(r.url,t.url))),null!=r&&null!==(n=r.bodySniff)&&void 0!==n&&n.enabled&&t.body&&(m=he(he({},m),ie(r.bodySniff.template,t.body))),t.responseText&&r.responseMatches&&(m=he(he({},m),se(t.responseText,r.responseMatches,r.responseRedactions||[]))),E=ae(m),b=E.publicParams,v=E.secretParams,Object.keys(b).length>0&&(h.paramValues=b),Object.keys(v).length>0&&(d.paramValues=v),r.responseMatches&&(h.responseMatches=r.responseMatches.map(function(e){return{value:e.value,type:e.type||"contains",invert:e.invert||!1}})),r.responseRedactions&&"key-update"!==r.writeRedactionMode&&(h.responseRedactions=r.responseRedactions.map(function(e){var t={};return Object.entries(e).forEach(function(e){var r=ge(e,2),n=r[0],o=r[1];"hash"!==n&&("jsonPath"!==n&&"xPath"!==n||o&&""!==o)&&(t[n]=o)}),t})),r.responseSelections&&(h.responseSelections=r.responseSelections.map(function(e){var t={};return"value"in e&&(t.value=e.value),"type"in e&&(t.type=e.type),"invert"in e&&(t.invert=e.invert),t})),r.additionalClientOptions&&(h.additionalClientOptions=r.additionalClientOptions),r.writeRedactionMode&&(h.writeRedactionMode=r.writeRedactionMode),e.p=5,e.n=6,be(i,a,u);case 6:O=e.v,e.n=8;break;case 7:throw e.p=7,w=e.v,u.error({message:"[CLAIM-CREATOR] Error obtaining owner private key: "+w.message,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION,eventType:s.EVENT_TYPES.CLAIM_CREATION_FAILED}),new Error("Could not obtain owner private key: ".concat(w.message));case 8:if("{{DYNAMIC_GEO}}"!==(I=null!==(o=null==r?void 0:r.geoLocation)&&void 0!==o?o:"")){e.n=10;break}return e.n=9,(0,ce.C)();case 9:I=e.v;case 10:return u.log({message:"[CLAIM-CREATOR] Geo location: "+I,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION}),h.geoLocation=I,A={name:"http",sessionId:i,params:h,secretParams:d,ownerPrivateKey:O,client:{url:"ws://localhost:8001/ws"}},u.info({message:"[CLAIM-CREATOR] Claim object created successfully",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION,eventType:s.EVENT_TYPES.CLAIM_CREATION_SUCCESS}),u.log({message:"[CLAIM-CREATOR] Claim object: "+JSON.stringify(A,null,2),logLevel:s.LOG_LEVEL.ALL,type:s.LOG_TYPES.CLAIM_CREATION}),e.a(2,A)}},e,null,[[5,7],[1,3]])}),function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){me(i,n,o,s,a,"next",e)}function a(e){me(i,n,o,s,a,"throw",e)}s(void 0)})});return function(e,r){return t.apply(this,arguments)}}();function Oe(e){return Oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Oe(e)}function Ie(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ae(n.key),n)}}function Ae(e){var t=function(e,t){if("object"!=Oe(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=Oe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Oe(t)?t:t+""}var Se=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.sessionTimer=null,this.sessionTimerDuration=3e4,this.sessionTimerPaused=!1,this.sessionTimerRemainingTime=0,this.sessionTimerStartTime=0,this.onSessionTimeout=null},(t=[{key:"setCallbacks",value:function(e){this.onSessionTimeout=e}},{key:"startSessionTimer",value:function(){var e=this;x.w9.info(x.Ey.SESSION_TIMER,"[SESSION TIMER] Starting session timer"),this.clearSessionTimer(),this.sessionTimerStartTime=Date.now(),this.sessionTimer=setTimeout(function(){null!==e.sessionTimer?(x.w9.error(x.Ey.SESSION_TIMER,"[SESSION TIMER] Session timer expired"),e.onSessionTimeout&&e.onSessionTimeout("Session timeout: No proofs generated within time limit")):x.w9.info(x.Ey.SESSION_TIMER,"[SESSION TIMER] Timer was already cleared, ignoring timeout")},this.sessionTimerDuration)}},{key:"resetSessionTimer",value:function(){x.w9.info(x.Ey.SESSION_TIMER,"[SESSION TIMER] Resetting session timer"),this.clearSessionTimer(),this.startSessionTimer()}},{key:"clearSessionTimer",value:function(){this.sessionTimer&&(clearTimeout(this.sessionTimer),this.sessionTimer=null)}},{key:"pauseSessionTimer",value:function(){if(this.sessionTimer&&!this.sessionTimerPaused){x.w9.info(x.Ey.SESSION_TIMER,"[SESSION TIMER] Pausing session timer");var e=Date.now()-this.sessionTimerStartTime;this.sessionTimerRemainingTime=Math.max(0,this.sessionTimerDuration-e),this.clearSessionTimer(),this.sessionTimerPaused=!0}}},{key:"resumeSessionTimer",value:function(){var e=this;this.sessionTimerPaused&&(x.w9.info(x.Ey.SESSION_TIMER,"[SESSION TIMER] Resuming session timer with remaining time:",this.sessionTimerRemainingTime),this.sessionTimer=setTimeout(function(){x.w9.error(x.Ey.SESSION_TIMER,"[SESSION TIMER] Session timer expired"),e.onSessionTimeout&&e.onSessionTimeout("Session timeout: No proofs generated within time limit")},this.sessionTimerRemainingTime),this.sessionTimerStartTime=Date.now()-(this.sessionTimerDuration-this.sessionTimerRemainingTime),this.sessionTimerPaused=!1)}},{key:"clearAllTimers",value:function(){x.w9.info(x.Ey.SESSION_TIMER,"[SESSION TIMER] Clearing all timers"),this.clearSessionTimer(),this.sessionTimerPaused=!1,this.sessionTimerRemainingTime=0,this.sessionTimerStartTime=0}},{key:"setTimerDuration",value:function(e){e&&"number"==typeof e&&(this.sessionTimerDuration=e)}}])&&Ie(e.prototype,t),r&&Ie(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}();function we(e){return we="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},we(e)}function Re(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,s,a=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return a}}(e,t)||Pe(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Te(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _e(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Te(Object(r),!0).forEach(function(t){Ne(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Te(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Ne(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=we(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=we(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==we(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ce(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Pe(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw i}}}}function Pe(e,t){if(e){if("string"==typeof e)return Le(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Le(e,t):void 0}}function Le(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function De(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return Ue(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(Ue(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,Ue(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,Ue(f,"constructor",u),Ue(u,"constructor",c),c.displayName="GeneratorFunction",Ue(u,o,"GeneratorFunction"),Ue(f),Ue(f,o,"Generator"),Ue(f,n,function(){return this}),Ue(f,"toString",function(){return"[object Generator]"}),(De=function(){return{w:i,m:h}})()}function Ue(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Ue=function(e,t,r,n){function i(t,r){Ue(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},Ue(e,t,r,n)}function xe(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function Ge(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){xe(i,n,o,s,a,"next",e)}function a(e){xe(i,n,o,s,a,"throw",e)}s(void 0)})}}function Fe(e,t){return ke.apply(this,arguments)}function ke(){return ke=Ge(De().m(function e(t,r){var n,o,i,s;return De().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=t.bgLogger,e.p=1,t.providerData=null,t.parameters={},t.providerId=null,t.appId=null,t.sessionId=null,t.callbackUrl=null,t.generatedProofs=new Map,t.filteredRequests=new Map,t.initPopupMessage=new Map,t.providerDataMessage=new Map,t.providerRequestsByHash=new Map,t.aborted=!1,t.sessionTimerManager.clearAllTimers(),t.firstRequestReceived=!1,r.providerId){e.n=2;break}throw new Error("Provider ID not found");case 2:return n.setContext({type:x.D_.BACKGROUND,sessionId:r.sessionId||t.sessionId||"unknown",providerId:r.providerId||t.providerId||"unknown",appId:r.applicationId||t.appId||"unknown"}),n.info({message:"[BACKGROUND] Fetching provider data from the backend for provider Id ".concat(r.providerId),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=3,t.fetchProviderData(r.providerId,r.sessionId,r.applicationId);case 3:if(o=e.v,t.providerData=o,t.providerId=r.providerId,r.parameters&&(t.parameters=r.parameters),"string"==typeof r.callbackUrl&&(t.callbackUrl=r.callbackUrl),r.sessionId&&(t.sessionId=r.sessionId),r.applicationId&&(t.appId=r.applicationId),o){e.n=4;break}throw new Error("Provider data not found");case 4:return i=o.loginUrl,chrome.tabs.create({url:i},function(e){var o,i,s;t.activeTabId=e.id,n.info({message:"[BACKGROUND] New tab created for provider ".concat(r.providerId," with tab id ").concat(e.id),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),t.managedTabs.add(e.id);var a=(null===(o=t.providerData)||void 0===o?void 0:o.name)||"Default Provider",c=(null===(i=t.providerData)||void 0===i?void 0:i.description)||"Default Description",u=(null===(s=t.providerData)||void 0===s||null===(s=s.verificationConfig)||void 0===s?void 0:s.dataRequired)||"Default Data",l=t.sessionId||"unknown";if(e.id){var f={action:t.MESSAGE_ACTIONS.SHOW_PROVIDER_VERIFICATION_POPUP,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{providerName:a,description:c,dataRequired:u,sessionId:l}},h={action:t.MESSAGE_ACTIONS.PROVIDER_DATA_READY,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{providerData:t.providerData,parameters:t.parameters,sessionId:t.sessionId,callbackUrl:t.callbackUrl,providerId:t.providerId,appId:t.appId}};t.initPopupMessage||(t.initPopupMessage=new Map),t.initPopupMessage.set(e.id,{message:f}),t.providerDataMessage.set(e.id,{message:h})}else n.error({message:"[BACKGROUND] New tab does not have an ID, cannot queue message for popup.",logLevel:x.E$.INFO,type:x.D_.BACKGROUND});n.info({message:"[BACKGROUND] Starting verification with session id: ".concat(t.sessionId),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),t.updateSessionStatus(r.sessionId,t.RECLAIM_SESSION_STATUS.USER_STARTED_VERIFICATION,r.providerId,r.applicationId).catch(function(e){n.error({message:"[BACKGROUND] Error updating session status: ".concat(null==e?void 0:e.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND})})}),e.a(2,{success:!0,message:"Verification started, redirecting to provider login page"});case 5:throw e.p=5,s=e.v,n.error({message:"[BACKGROUND] Error starting verification: ".concat(null==s?void 0:s.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),t.activeSessionId=null,s;case 6:return e.a(2)}},e,null,[[1,5]])})),ke.apply(this,arguments)}function Be(e,t,r){return Me.apply(this,arguments)}function Me(){return Me=Ge(De().m(function e(t,r,n){var o,i,s,a;return De().w(function(e){for(;;)switch(e.p=e.n){case 0:if((o=t.bgLogger).setContext({type:x.D_.BACKGROUND,sessionId:t.sessionId||"unknown",providerId:t.providerId||"unknown",appId:t.appId||"unknown"}),o.log({message:"[BACKGROUND] Failing session: ".concat(r),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.VERIFICATION_FLOW_FAILED}),t.sessionTimerManager.clearAllTimers(),t.aborted=!0,!t.sessionId){e.n=4;break}return e.p=1,e.n=2,t.updateSessionStatus(t.sessionId,t.RECLAIM_SESSION_STATUS.PROOF_GENERATION_FAILED,t.providerId,t.appId);case 2:o.log({message:"[BACKGROUND] Updated session status to failed: ".concat(t.sessionId),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=4;break;case 3:e.p=3,i=e.v,o.error({message:"[BACKGROUND] Error updating session status to failed: ".concat(null==i?void 0:i.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 4:if(t.activeTabId&&chrome.tabs.sendMessage(t.activeTabId,{action:t.MESSAGE_ACTIONS.PROOF_GENERATION_FAILED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{requestHash:n,sessionId:t.sessionId}}).catch(function(e){o.error({message:"[BACKGROUND] Error notifying content script of session failure: ".concat(null==e?void 0:e.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND})}),!t.originalTabId){e.n=8;break}return e.p=5,e.n=6,chrome.tabs.sendMessage(t.originalTabId,{action:t.MESSAGE_ACTIONS.PROOF_GENERATION_FAILED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{error:r,sessionId:t.sessionId}});case 6:e.n=8;break;case 7:e.p=7,s=e.v,o.error({message:"[BACKGROUND] Error notifying original tab of session failure: ".concat(null==s?void 0:s.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 8:return e.p=8,o.info({message:"[BACKGROUND] Proof generation failed, Broadcasting to popup/options pages: ".concat(r),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=9,chrome.runtime.sendMessage({action:t.MESSAGE_ACTIONS.PROOF_GENERATION_FAILED,data:{error:r,sessionId:t.sessionId}});case 9:e.n=11;break;case 10:e.p=10,a=e.v,o.error({message:"[BACKGROUND] Error broadcasting to popup/options pages: ".concat(null==a?void 0:a.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 11:t.proofGenerationQueue=[],t.isProcessingQueue=!1,t.activeSessionId=null;case 12:return e.a(2)}},e,null,[[8,10],[5,7],[1,3]])})),Me.apply(this,arguments)}function je(e){return Ke.apply(this,arguments)}function Ke(){return Ke=Ge(De().m(function e(t){var r,n,o,i,s,a,c,u,l,f,h,d,p,g,y,m,E,b,v,O,I,A,S,w,R;return De().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=t.bgLogger,e.p=1,!t.expectManyClaims){e.n=2;break}return e.a(2);case 2:if(t.sessionTimerManager.clearAllTimers(),r.setContext({type:x.D_.BACKGROUND,sessionId:t.sessionId||"unknown",providerId:t.providerId||"unknown",appId:t.appId||"unknown"}),0!==t.generatedProofs.size){e.n=3;break}return e.a(2);case 3:if(!(o=Array.isArray(null===(n=t.providerData)||void 0===n?void 0:n.requestData)&&t.providerData.requestData.length>0)){e.n=4;break}if(i=t.providerData.requestData.filter(function(e){return t.generatedProofs.has(e.requestHash)}).length,i===t.providerData.requestData.length){e.n=4;break}return e.a(2);case 4:if(s=[],a=new Set,o){c=Ce(t.providerData.requestData);try{for(c.s();!(u=c.n()).done;)l=u.value,t.generatedProofs.has(l.requestHash)&&(f=t.generatedProofs.get(l.requestHash),s.push(t.formatProof(f,l)),a.add(l.requestHash))}catch(e){c.e(e)}finally{c.f()}}h=Ce(t.generatedProofs.entries()),e.p=5,h.s();case 6:if((d=h.n()).done){e.n=9;break}if(p=Re(d.value,2),g=p[0],y=p[1],!a.has(g)){e.n=7;break}return e.a(3,8);case 7:m=t.providerRequestsByHash.get(g)||{url:"",expectedPageUrl:"",urlType:"EXACT",method:"GET",responseMatches:[],responseRedactions:[],requestHash:g},s.push(t.formatProof(y,m));case 8:e.n=6;break;case 9:e.n=11;break;case 10:e.p=10,v=e.v,h.e(v);case 11:return e.p=11,h.f(),e.f(11);case 12:if(E=s.map(function(e){var r;return _e(_e({},e),{},{publicData:null!==(r=t.publicData)&&void 0!==r?r:null})}),r.info({message:"[BACKGROUND] Submitting proofs ".concat(JSON.stringify(E)),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.SUBMITTING_PROOF}),b=!1,!(t.callbackUrl&&"string"==typeof t.callbackUrl&&t.callbackUrl.length>0)){e.n=25;break}return e.p=13,r.log({message:"[BACKGROUND] Submitting proofs to callback URL: ".concat(t.callbackUrl),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.SUBMITTING_PROOF_TO_CALLBACK_URL}),e.n=14,t.submitProofOnCallback(E,t.callbackUrl,t.sessionId,t.providerId,t.appId);case 14:b=!0,e.n=24;break;case 15:return e.p=15,O=e.v,e.p=16,r.error({message:"[BACKGROUND] Notifying original tab of proof submission failure: ".concat(O.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.SUBMITTING_PROOF_TO_CALLBACK_URL_FAILED}),e.n=17,chrome.tabs.sendMessage(t.originalTabId,{action:t.MESSAGE_ACTIONS.PROOF_SUBMISSION_FAILED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{error:O.message,sessionId:t.sessionId}});case 17:e.n=19;break;case 18:e.p=18,I=e.v,r.error({message:"[BACKGROUND] Error notifying original tab of proof submission failure: ".concat(null==I?void 0:I.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.SUBMITTING_PROOF_TO_CALLBACK_URL_FAILED});case 19:return chrome.tabs.sendMessage(t.activeTabId,{action:t.MESSAGE_ACTIONS.PROOF_SUBMISSION_FAILED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{error:O.message,sessionId:t.sessionId}}),r.error({message:"[BACKGROUND] Broadcasting to runtime of proof submission failure: ".concat(O.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.PROOF_SUBMISSION_FAILED}),e.p=20,e.n=21,chrome.runtime.sendMessage({action:t.MESSAGE_ACTIONS.PROOF_SUBMISSION_FAILED,data:{error:O.message,sessionId:t.sessionId}});case 21:e.n=23;break;case 22:e.p=22,e.v;case 23:throw r.error({message:"[BACKGROUND] Error submitting proofs: ".concat(O.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),O;case 24:e.n=29;break;case 25:if(!t.sessionId){e.n=29;break}return e.p=26,r.log({message:"[BACKGROUND] Updating status to PROOF_GENERATION_SUCCESS",logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.PROOF_SUBMITTED}),e.n=27,t.updateSessionStatus(t.sessionId,t.RECLAIM_SESSION_STATUS.PROOF_GENERATION_SUCCESS,t.providerId,t.appId);case 27:e.n=29;break;case 28:e.p=28,A=e.v,r.error({message:"[BACKGROUND] Error updating status to PROOF_GENERATION_SUCCESS: ".concat(null==A?void 0:A.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 29:if(!t.activeTabId){e.n=33;break}return e.p=30,r.log({message:"[BACKGROUND] Proof submitted, Notifying content script with proofs",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=31,chrome.tabs.sendMessage(t.activeTabId,{action:t.MESSAGE_ACTIONS.PROOF_SUBMITTED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{formattedProofs:s,submitted:b,sessionId:t.sessionId}});case 31:e.n=33;break;case 32:e.p=32,S=e.v,r.error({message:"[BACKGROUND] Error notifying content script: ".concat(null==S?void 0:S.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 33:if(!t.originalTabId){e.n=37;break}return e.p=34,r.log({message:"[BACKGROUND] Proof submitted, Notifying original tab with proofs",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=35,chrome.tabs.sendMessage(t.originalTabId,{action:t.MESSAGE_ACTIONS.PROOF_SUBMITTED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{formattedProofs:s,submitted:b,sessionId:t.sessionId}});case 35:e.n=37;break;case 36:e.p=36,w=e.v,r.error({message:"[BACKGROUND] Error notifying original tab: ".concat(null==w?void 0:w.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 37:return e.p=37,r.log({message:"[BACKGROUND] Proof submitted, Broadcasting to runtime",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=38,chrome.runtime.sendMessage({action:t.MESSAGE_ACTIONS.PROOF_SUBMITTED,data:{formattedProofs:s,submitted:b,sessionId:t.sessionId}});case 38:e.n=40;break;case 39:e.p=39,e.v;case 40:if(t.originalTabId)try{setTimeout(Ge(De().m(function e(){return De().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,chrome.tabs.update(t.originalTabId,{active:!0});case 1:if(!t.activeTabId){e.n=3;break}return e.n=2,chrome.tabs.remove(t.activeTabId);case 2:t.activeTabId=null;case 3:t.originalTabId=null;case 4:return e.a(2)}},e)})),3e3)}catch(e){r.error({message:"[BACKGROUND] Error navigating back or closing tab: ".concat(null==e?void 0:e.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND})}else if(t.activeTabId)try{setTimeout(Ge(De().m(function e(){return De().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,chrome.tabs.remove(t.activeTabId);case 1:t.activeTabId=null;case 2:return e.a(2)}},e)})),3e3)}catch(e){}return t.activeSessionId=null,e.a(2,{success:!0});case 41:throw e.p=41,R=e.v,r.error({message:"[BACKGROUND] Error submitting proof: ".concat(null==R?void 0:R.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.PROOF_SUBMISSION_FAILED}),t.activeSessionId=null,R;case 42:return e.a(2)}},e,null,[[37,39],[34,36],[30,32],[26,28],[20,22],[16,18],[13,15],[5,10,11,12],[1,41]])})),Ke.apply(this,arguments)}function Ve(e){return $e.apply(this,arguments)}function $e(){return $e=Ge(De().m(function e(t){var r,n,o,i,s,a,c;return De().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=t.bgLogger,e.p=1,r.setContext({type:x.D_.BACKGROUND,sessionId:t.sessionId||"unknown",providerId:t.providerId||"unknown",appId:t.appId||"unknown"}),r.log({message:"[BACKGROUND] Cancelling session",logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.RECLAIM_VERIFICATION_DISMISSED}),t.sessionTimerManager.clearAllTimers(),t.aborted=!0,!t.sessionId){e.n=5;break}return e.p=2,r.log({message:"[BACKGROUND] Proof generation failed, Updating status on cancel",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=3,t.updateSessionStatus(t.sessionId,t.RECLAIM_SESSION_STATUS.PROOF_GENERATION_FAILED,t.providerId,t.appId);case 3:e.n=5;break;case 4:e.p=4,n=e.v,r.error({message:"[BACKGROUND] Error updating status on cancel: ".concat(null==n?void 0:n.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 5:if(!t.activeTabId){e.n=9;break}return e.p=6,r.log({message:"[BACKGROUND] Proof generation failed, Notifying content on cancel",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=7,chrome.tabs.sendMessage(t.activeTabId,{action:t.MESSAGE_ACTIONS.PROOF_GENERATION_FAILED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{error:"Cancelled by user",sessionId:t.sessionId}});case 7:e.n=9;break;case 8:e.p=8,o=e.v,r.error({message:"[BACKGROUND] Error notifying content on cancel: ".concat(null==o?void 0:o.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 9:if(!t.originalTabId){e.n=13;break}return e.p=10,r.log({message:"[BACKGROUND] Proof generation failed, Notifying original tab on cancel",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=11,chrome.tabs.sendMessage(t.originalTabId,{action:t.MESSAGE_ACTIONS.PROOF_GENERATION_FAILED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{error:"Cancelled by user",sessionId:t.sessionId}});case 11:e.n=13;break;case 12:e.p=12,i=e.v,r.error({message:"[BACKGROUND] Error notifying original tab on cancel: ".concat(null==i?void 0:i.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 13:return e.p=13,r.log({message:"[BACKGROUND] Proof generation failed, Broadcasting to runtime on cancel",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=14,chrome.runtime.sendMessage({action:t.MESSAGE_ACTIONS.PROOF_GENERATION_FAILED,data:{error:"Cancelled by user",sessionId:t.sessionId}});case 14:e.n=16;break;case 15:e.p=15,s=e.v,r.error({message:"[BACKGROUND] Error broadcasting to runtime on cancel: ".concat(null==s?void 0:s.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 16:if(!t.originalTabId){e.n=17;break}try{setTimeout(Ge(De().m(function e(){return De().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,chrome.tabs.update(t.originalTabId,{active:!0});case 1:if(!t.activeTabId){e.n=3;break}return e.n=2,chrome.tabs.remove(t.activeTabId);case 2:t.activeTabId=null;case 3:t.originalTabId=null;case 4:return e.a(2)}},e)})),200)}catch(e){r.error({message:"[BACKGROUND] Error closing tab on cancel: ".concat(null==e?void 0:e.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND})}e.n=21;break;case 17:if(!t.activeTabId){e.n=21;break}return e.p=18,e.n=19,chrome.tabs.remove(t.activeTabId);case 19:t.activeTabId=null,e.n=21;break;case 20:e.p=20,a=e.v,r.error({message:"[BACKGROUND] Error closing active tab on cancel: ".concat(null==a?void 0:a.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 21:t.proofGenerationQueue=[],t.isProcessingQueue=!1,t.providerData=null,t.parameters={},t.providerId=null,t.appId=null,t.sessionId=null,t.callbackUrl=null,t.providerRequestsByHash=new Map,t.managedTabs.clear(),t.activeSessionId=null,e.n=23;break;case 22:e.p=22,c=e.v,t.activeSessionId=null,r.error({message:"[BACKGROUND] Error during cancelSession: ".concat(null==c?void 0:c.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND});case 23:return e.a(2)}},e,null,[[18,20],[13,15],[10,12],[6,8],[2,4],[1,22]])})),$e.apply(this,arguments)}function He(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return Ye(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(Ye(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,Ye(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,Ye(f,"constructor",u),Ye(u,"constructor",c),c.displayName="GeneratorFunction",Ye(u,o,"GeneratorFunction"),Ye(f),Ye(f,o,"Generator"),Ye(f,n,function(){return this}),Ye(f,"toString",function(){return"[object Generator]"}),(He=function(){return{w:i,m:h}})()}function Ye(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Ye=function(e,t,r,n){function i(t,r){Ye(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},Ye(e,t,r,n)}function qe(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function ze(){var e;return e=He().m(function e(t,r,n,o){var i,s,a,c,u,l,f,h,d,p,g,y,m,E,b,v,O,I,A,S,w,R,T,_,N,C,P,L,D,U,G,F,k,B;return He().w(function(e){for(;;)switch(e.p=e.n){case 0:a=r.action,c=r.source,u=r.target,l=r.data,(f=t.bgLogger).setContext({type:x.D_.BACKGROUND,sessionId:t.sessionId||"unknown",providerId:t.providerId||"unknown",appId:t.appId||"unknown"}),e.p=1,G=a,e.n=G===t.MESSAGE_ACTIONS.CONTENT_SCRIPT_LOADED?2:G===t.MESSAGE_ACTIONS.REQUEST_PROVIDER_DATA?4:G===t.MESSAGE_ACTIONS.CHECK_IF_MANAGED_TAB?5:G===t.MESSAGE_ACTIONS.START_VERIFICATION?6:G===t.MESSAGE_ACTIONS.CANCEL_VERIFICATION?12:G===t.MESSAGE_ACTIONS.OFFSCREEN_DOCUMENT_READY?16:G===t.MESSAGE_ACTIONS.CLOSE_CURRENT_TAB?17:G===t.MESSAGE_ACTIONS.FILTERED_REQUEST_FOUND?18:G===t.MESSAGE_ACTIONS.GET_CURRENT_TAB_ID?24:G===t.MESSAGE_ACTIONS.UPDATE_PUBLIC_DATA?25:G===t.MESSAGE_ACTIONS.UPDATE_EXPECT_MANY_CLAIMS?26:G===t.MESSAGE_ACTIONS.GET_PARAMETERS?33:G===t.MESSAGE_ACTIONS.REPORT_PROVIDER_ERROR?34:G===t.MESSAGE_ACTIONS.REQUEST_CLAIM?38:G===t.MESSAGE_ACTIONS.INJECT_VIA_SCRIPTING?46:56;break;case 2:if(c!==t.MESSAGE_SOURCES.CONTENT_SCRIPT||u!==t.MESSAGE_SOURCES.BACKGROUND){e.n=3;break}return d=(null===(h=n.tab)||void 0===h?void 0:h.id)&&t.managedTabs.has(n.tab.id),chrome.tabs.sendMessage(n.tab.id,{action:t.MESSAGE_ACTIONS.SHOULD_INITIALIZE,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{shouldInitialize:d}}).catch(function(e){return f.error({message:"[BACKGROUND] Error sending initialization status: "+(null==e?void 0:e.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND})}),d&&t.initPopupMessage&&t.initPopupMessage.has(n.tab.id)&&(p=t.initPopupMessage.get(n.tab.id),chrome.tabs.sendMessage(n.tab.id,p.message).then(function(){chrome.runtime.lastError&&f.error({message:"[BACKGROUND] Error sending (pending) SHOW_PROVIDER_VERIFICATION_POPUP to tab ".concat(n.tab.id,": ").concat(chrome.runtime.lastError.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.VERIFICATION_POPUP_ERROR})}).catch(function(e){return f.error({message:"[BACKGROUND] Error sending (pending) SHOW_PROVIDER_VERIFICATION_POPUP to tab ".concat(n.tab.id," (promise catch): ").concat(null==e?void 0:e.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.VERIFICATION_POPUP_ERROR})})),d&&t.providerDataMessage&&t.providerDataMessage.has(n.tab.id)&&(g=t.providerDataMessage.get(n.tab.id),chrome.tabs.sendMessage(n.tab.id,g.message).then(function(){chrome.runtime.lastError&&f.error({message:"[BACKGROUND] Error sending (pending) PROVIDER_DATA_READY to tab ".concat(n.tab.id,": ").concat(chrome.runtime.lastError.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.RECLAIM_VERIFICATION_PROVIDER_LOAD_EXCEPTION})}).catch(function(e){return f.error({message:"[BACKGROUND] Error sending (pending) PROVIDER_DATA_READY to tab ".concat(n.tab.id," (promise catch): ").concat(null==e?void 0:e.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.RECLAIM_VERIFICATION_PROVIDER_LOAD_EXCEPTION})}),t.providerDataMessage.delete(n.tab.id)),f.info({message:"[BACKGROUND] Successfully sent (pending) SHOW_PROVIDER_VERIFICATION_POPUP and PROVIDER_DATA_READY to tab ".concat(n.tab.id),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0}),e.a(3,57);case 3:return e.a(3,57);case 4:return c===t.MESSAGE_SOURCES.CONTENT_SCRIPT&&u===t.MESSAGE_SOURCES.BACKGROUND&&(f.setContext({sessionId:t.sessionId||"unknown",providerId:t.providerId||"unknown",appId:t.appId||"unknown",type:x.D_.BACKGROUND}),f.info({message:"[BACKGROUND] Content script requested provider data",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),null!==(y=n.tab)&&void 0!==y&&y.id&&t.managedTabs.has(n.tab.id)&&t.providerData&&t.parameters&&t.sessionId&&void 0!==t.callbackUrl?(f.info({message:"[BACKGROUND] Sending the following provider data to content script: "+JSON.stringify(t.providerData),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0,data:{providerData:t.providerData,parameters:t.parameters||{},sessionId:t.sessionId,callbackUrl:t.callbackUrl,providerId:t.providerId,appId:t.appId}})):(f.error({message:"[BACKGROUND] Provider data not available or tab not managed",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Provider data not available or tab not managed"}))),e.a(3,57);case 5:return c===t.MESSAGE_SOURCES.CONTENT_SCRIPT&&u===t.MESSAGE_SOURCES.BACKGROUND&&(E=(null===(m=n.tab)||void 0===m?void 0:m.id)&&t.managedTabs.has(n.tab.id),f.info({message:"[BACKGROUND] Checking if tab is managed: "+E,logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0,isManaged:E})),e.a(3,57);case 6:if(c!==t.MESSAGE_SOURCES.CONTENT_SCRIPT||u!==t.MESSAGE_SOURCES.BACKGROUND){e.n=10;break}if(f.setContext({sessionId:l.sessionId||t.sessionId||"unknown",providerId:l.providerId||t.providerId||"unknown",appId:l.applicationId||t.appId||"unknown",type:x.D_.BACKGROUND}),f.info({message:"Starting new verification using Reclaim Extension SDK",logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.IS_RECLAIM_EXTENSION_SDK}),f.info({message:"[BACKGROUND] Starting new verification flow with data: "+JSON.stringify(l),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.VERIFICATION_FLOW_STARTED}),t.loggerService.startFlushInterval(),!t.activeSessionId||t.activeSessionId===l.sessionId){e.n=8;break}if(0!==t.managedTabs.size){e.n=7;break}t.activeSessionId=null,e.n=8;break;case 7:return f.error({message:"[BACKGROUND] Another verification is in progress",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Another verification is in progress"}),e.a(3,57);case 8:return t.activeSessionId=l.sessionId||t.activeSessionId,n.tab&&n.tab.id&&(t.originalTabId=n.tab.id),f.info({message:"[BACKGROUND] Starting verification with session id: "+l.sessionId,logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=9,Fe(t,l);case 9:b=e.v,o({success:!0,result:b}),e.n=11;break;case 10:o({success:!1,error:"Action not supported"});case 11:return e.a(3,57);case 12:if(c!==t.MESSAGE_SOURCES.CONTENT_SCRIPT||u!==t.MESSAGE_SOURCES.BACKGROUND){e.n=14;break}return f.info({message:"[BACKGROUND] Cancelling verification with session id: "+(null==l?void 0:l.sessionId),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=13,Ve(t,null==l?void 0:l.sessionId);case 13:o({success:!0}),e.n=15;break;case 14:f.error({message:"[BACKGROUND] CANCEL_VERIFICATION: Action not supported",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Action not supported"});case 15:return e.a(3,57);case 16:return c===t.MESSAGE_SOURCES.OFFSCREEN&&u===t.MESSAGE_SOURCES.BACKGROUND?(f.info({message:"[BACKGROUND] Offscreen document ready",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0})):(f.error({message:"[BACKGROUND] OFFSCREEN_DOCUMENT_READY: Action not supported",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Action not supported"})),e.a(3,57);case 17:return c===t.MESSAGE_SOURCES.CONTENT_SCRIPT&&u===t.MESSAGE_SOURCES.BACKGROUND?n.tab&&n.tab.id?chrome.tabs.remove(n.tab.id,function(){chrome.runtime.lastError?(f.error({message:"[BACKGROUND] Error closing tab: "+chrome.runtime.lastError.message,logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:chrome.runtime.lastError.message})):(t.managedTabs.has(n.tab.id)&&t.managedTabs.delete(n.tab.id),f.info({message:"[BACKGROUND] Tab closed",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0}))}):(f.error({message:"[BACKGROUND] CLOSE_CURRENT_TAB: No tab ID provided by sender.",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"No tab ID found to close."})):o({success:!1,error:"Action not supported"}),e.a(2,!0);case 18:if(c!==t.MESSAGE_SOURCES.CONTENT_SCRIPT||u!==t.MESSAGE_SOURCES.BACKGROUND){e.n=22;break}if(!t.filteredRequests.has(l.criteria.requestHash)){e.n=19;break}f.info({message:"[BACKGROUND] Filtered request found with hash: "+l.criteria.requestHash,logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.FILTERED_REQUEST_FOUND}),o({success:!0,result:t.filteredRequests.get(l.criteria.requestHash)}),e.n=21;break;case 19:return t.filteredRequests.set(l.criteria.requestHash,l.request),e.n=20,t.processFilteredRequest(l.request,l.criteria,l.sessionId,l.loginUrl);case 20:v=e.v,f.info({message:"[BACKGROUND] Filtered request processed with hash: "+l.criteria.requestHash,logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0,result:v});case 21:e.n=23;break;case 22:f.error({message:"[BACKGROUND] FILTERED_REQUEST_FOUND: Action not supported",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Action not supported"});case 23:return e.a(3,57);case 24:return c===t.MESSAGE_SOURCES.CONTENT_SCRIPT&&u===t.MESSAGE_SOURCES.BACKGROUND?(f.info({message:"[BACKGROUND] Getting current tab id: "+(null===(O=n.tab)||void 0===O?void 0:O.id),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0,tabId:null===(I=n.tab)||void 0===I?void 0:I.id})):(f.error({message:"[BACKGROUND] GET_CURRENT_TAB_ID: Action not supported",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Action not supported"})),e.a(3,57);case 25:return null!==(i=n.tab)&&void 0!==i&&i.id&&t.managedTabs.has(n.tab.id)?(f.info({message:"[BACKGROUND] Updating public data: "+(null==l?void 0:l.publicData),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),t.publicData="string"==typeof(null==l?void 0:l.publicData)?l.publicData:null,o({success:!0})):(f.error({message:"[BACKGROUND] UPDATE_PUBLIC_DATA: Tab is not managed by extension",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Tab is not managed by extension"})),e.a(3,57);case 26:if(null===(A=n.tab)||void 0===A||!A.id||!t.managedTabs.has(n.tab.id)){e.n=31;break}if(S=t.expectManyClaims&&!(null!=l&&l.expectMany),t.expectManyClaims=!(null==l||!l.expectMany),f.info({message:"[BACKGROUND] Updating expect many claims: "+(null==l?void 0:l.expectMany),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),!(S&&t.generatedProofs.size>0)){e.n=30;break}return e.p=27,f.info({message:"[BACKGROUND] Turning off expect many claims, Submitting proofs",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=28,t.submitProofs();case 28:e.n=30;break;case 29:e.p=29,e.v;case 30:o({success:!0}),e.n=32;break;case 31:f.error({message:"[BACKGROUND] UPDATE_EXPECT_MANY_CLAIMS: Tab is not managed by extension",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Tab is not managed by extension"});case 32:return e.a(3,57);case 33:return null!==(s=n.tab)&&void 0!==s&&s.id&&t.managedTabs.has(n.tab.id)?(f.info({message:"[BACKGROUND] Getting parameters: "+t.parameters,logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0,parameters:t.parameters||{}})):(f.error({message:"[BACKGROUND] UPDATE_EXPECT_MANY_CLAIMS: Tab is not managed by extension",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Tab is not managed by extension"})),e.a(3,57);case 34:if(null===(w=n.tab)||void 0===w||!w.id||!t.managedTabs.has(n.tab.id)){e.n=36;break}return t.aborted=!0,e.n=35,t.failSession((null==l?void 0:l.message)||"Provider error");case 35:f.info({message:"[BACKGROUND] Provider error reported: "+(null==l?void 0:l.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0}),e.n=37;break;case 36:f.error({message:"[BACKGROUND] REPORT_PROVIDER_ERROR: Tab is not managed by extension",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Tab is not managed by extension"});case 37:return e.a(3,57);case 38:if(c!==t.MESSAGE_SOURCES.CONTENT_SCRIPT||u!==t.MESSAGE_SOURCES.BACKGROUND||null===(R=n.tab)||void 0===R||!R.id||!t.managedTabs.has(n.tab.id)){e.n=44;break}if(e.p=39,t.sessionId||l.sessionId){e.n=40;break}return o({success:!1,error:"Session not initialized"}),e.a(3,57);case 40:return e.n=41,t.processFilteredRequest(l.request,l.criteria,l.sessionId,l.loginUrl||"");case 41:T=e.v,f.info({message:"[BACKGROUND] Request claim processed: "+l.requestHash,logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0,result:T}),e.n=43;break;case 42:e.p=42,F=e.v,f.error({message:"[BACKGROUND] Request claim processing failed: "+(null==F?void 0:F.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:(null==F?void 0:F.message)||String(F)});case 43:e.n=45;break;case 44:f.error({message:"[BACKGROUND] REQUEST_CLAIM: Tab is not managed by extension",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Tab is not managed by extension"});case 45:return e.a(3,57);case 46:if(c!==t.MESSAGE_SOURCES.CONTENT_SCRIPT||u!==t.MESSAGE_SOURCES.BACKGROUND||null===(_=n.tab)||void 0===_||!_.id){e.n=54;break}if(N=n.tab.id,C=null==l?void 0:l.op,e.p=47,"REPLAY_PAGE_FETCH"!==C){e.n=49;break}return f.info({message:"[BACKGROUND] REPLAY_PAGE_FETCH: Executing script",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=48,chrome.scripting.executeScript({target:{tabId:N},world:"MAIN",func:function(e){try{var t=window.location.href,r=new XMLHttpRequest;r.open("GET",t,!0),r.withCredentials=!0,r.setRequestHeader("accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8"),r.setRequestHeader("accept-language","en-GB,en;q=0.5"),r.setRequestHeader("cache-control","no-store"),r.setRequestHeader("x-reclaim-replay","1"),r.onreadystatechange=function(){},r.send(null),null!=e&&e.showAlert&&console.log("Replaying via XHR…",t)}catch(e){console.log("REPLAY_PAGE_FETCH XHR failed:",e&&e.message)}},args:[{showAlert:!(null==l||!l.showAlert)}]});case 48:return f.info({message:"[BACKGROUND] REPLAY_PAGE_FETCH executed in MAIN world (XHR)",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!0}),e.a(3,57);case 49:if("RUN_CUSTOM_INJECTION"!==C){e.n=51;break}return L=String((null==l?void 0:l.code)||""),e.n=50,chrome.scripting.executeScript({target:{tabId:n.tab.id},world:"MAIN",func:function(e){try{var t=String((null==e?void 0:e.code)||"");return t?window.__reclaimCustomInjectionDone__?{status:"skipped",reason:"already_injected"}:function(){try{var e=(document.querySelector("script[nonce]")||{}).nonce;if(!e)return!1;var r=document.createElement("script");return r.setAttribute("nonce",e),r.textContent=t,(document.documentElement||document.head||document).appendChild(r),r.remove(),!0}catch(e){return!1}}()||function(){try{if(!window.trustedTypes)return!1;for(var e=(document.querySelector("script[nonce]")||{}).nonce||"",r=0,n=["reclaim-extension-sdk","reclaim","default","policy","app"];r<n.length;r++){var o=n[r];try{var i=window.trustedTypes.createPolicy(o,{createScript:function(e){return e}}),s=document.createElement("script");return e&&s.setAttribute("nonce",e),s.text=i.createScript(t),(document.documentElement||document.head||document).appendChild(s),s.remove(),!0}catch(e){}}return!1}catch(e){return!1}}()||function(){try{var e=document.createElement("script");return e.textContent=t,(document.documentElement||document.head||document).appendChild(e),e.remove(),!0}catch(e){return!1}}()?(window.__reclaimCustomInjectionDone__=!0,{status:"executed"}):{status:"error",reason:"all_strategies_failed"}:{status:"skipped",reason:"no_code"}}catch(e){return{status:"error",reason:String((null==e?void 0:e.message)||e)}}},args:[{code:L}]});case 50:return D=e.v,U=null==D||null===(P=D[0])||void 0===P?void 0:P.result,f.info({message:"[BACKGROUND] RUN_CUSTOM_INJECTION result: "+JSON.stringify(U),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,meta:{result:U}}),o({success:!0,result:U}),e.a(3,57);case 51:e.n=53;break;case 52:e.p=52,k=e.v,f.error({message:"[BACKGROUND] INJECT_VIA_SCRIPTING failed: "+(null==k?void 0:k.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,meta:{e:k}}),o({success:!1,error:(null==k?void 0:k.message)||String(k)});case 53:e.n=55;break;case 54:o({success:!1,error:"Action not supported"});case 55:return e.a(3,57);case 56:f.error({message:"[BACKGROUND] DEFAULT: Action not supported",logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),o({success:!1,error:"Action not supported"});case 57:e.n=59;break;case 58:e.p=58,B=e.v,f.error({message:"[BACKGROUND] Error handling "+a+": "+(null==B?void 0:B.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,meta:{error:B}}),o({success:!1,error:B.message});case 59:return e.a(2,!0)}},e,null,[[47,52],[39,42],[27,29],[1,58]])}),ze=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){qe(i,n,o,s,a,"next",e)}function a(e){qe(i,n,o,s,a,"throw",e)}s(void 0)})},ze.apply(this,arguments)}function We(e){return We="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},We(e)}function Je(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return Xe(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(Xe(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,Xe(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,Xe(f,"constructor",u),Xe(u,"constructor",c),c.displayName="GeneratorFunction",Xe(u,o,"GeneratorFunction"),Xe(f),Xe(f,o,"Generator"),Xe(f,n,function(){return this}),Xe(f,"toString",function(){return"[object Generator]"}),(Je=function(){return{w:i,m:h}})()}function Xe(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Xe=function(e,t,r,n){function i(t,r){Xe(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},Xe(e,t,r,n)}function Qe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Ze(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qe(Object(r),!0).forEach(function(t){et(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qe(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function et(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=We(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=We(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==We(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tt(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function rt(e,t,r){e.proofGenerationQueue.push({claimData:t,requestHash:r}),e.isProcessingQueue||(e.sessionTimerManager.pauseSessionTimer(),nt(e))}function nt(e){return ot.apply(this,arguments)}function ot(){var e;return e=Je().m(function e(t){var r,n,o,i,s,a,c,u,l,f,h;return Je().w(function(e){for(;;)switch(e.p=e.n){case 0:if((r=t.bgLogger).setContext({sessionId:t.sessionId||"unknown",providerId:t.providerId||"unknown",appId:t.appId||"unknown",type:x.D_.BACKGROUND}),!t.aborted){e.n=1;break}return r.info({message:"[BACKGROUND] Proof generation queue aborted",logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.RECLAIM_VERIFICATION_DISMISSED}),e.a(2);case 1:if(!t.isProcessingQueue&&0!==t.proofGenerationQueue.length){e.n=3;break}if(0!==t.proofGenerationQueue.length){e.n=2;break}return(o=Array.isArray(null===(n=t.providerData)||void 0===n?void 0:n.requestData)?t.providerData.requestData.length:0)>0?t.providerData.requestData.filter(function(e){return t.generatedProofs.has(e.requestHash)}).length===o?(t.sessionTimerManager.clearAllTimers(),t.expectManyClaims||setTimeout(function(){return t.submitProofs()},0)):t.sessionTimerManager.resumeSessionTimer():(t.sessionTimerManager.clearAllTimers(),t.expectManyClaims||setTimeout(function(){return t.submitProofs()},0)),e.a(2);case 2:t.sessionTimerManager.resumeSessionTimer();case 3:if(t.isProcessingQueue=!0,i=t.proofGenerationQueue.shift(),e.p=4,!t.aborted){e.n=5;break}return r.info({message:"[BACKGROUND] Proof generation aborted",logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.PROOF_GENERATION_ABORTED}),e.a(2);case 5:return chrome.tabs.sendMessage(t.activeTabId,{action:t.MESSAGE_ACTIONS.PROOF_GENERATION_STARTED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{requestHash:i.requestHash}}),r.info({message:"[BACKGROUND] Proof generation started for request hash: "+i.requestHash,logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),e.n=6,t.generateProof(Ze(Ze({},i.claimData),{},{publicData:null!==(s=t.publicData)&&void 0!==s?s:null}),r);case 6:if(a=e.v,!t.aborted){e.n=7;break}return r.info({message:"[BACKGROUND] Proof generation aborted",logLevel:x.E$.INFO,type:x.D_.BACKGROUND,eventType:x.Ru.PROOF_GENERATION_ABORTED}),e.a(2);case 7:if(a.success){e.n=8;break}return r.error({message:"[BACKGROUND] Proof generation failed for request hash: "+i.requestHash+": "+a.error,logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),t.failSession("Proof generation failed: "+a.error,i.requestHash),e.a(2);case 8:(c=a.proof)&&(t.generatedProofs.has(i.requestHash)||t.generatedProofs.set(i.requestHash,c),r.info({message:"[BACKGROUND] Proof generation successful for request hash: "+i.requestHash,logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),chrome.tabs.sendMessage(t.activeTabId,{action:t.MESSAGE_ACTIONS.PROOF_GENERATION_SUCCESS,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{requestHash:i.requestHash}}),t.sessionTimerManager.resetSessionTimer()),e.n=10;break;case 9:return e.p=9,h=e.v,r.error({message:"[BACKGROUND] Proof generation failed for request hash: "+i.requestHash+": "+(null==h?void 0:h.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND}),t.failSession("Proof generation failed: "+h.message,i.requestHash),e.a(2);case 10:if(e.p=10,t.isProcessingQueue=!1,!t.aborted){e.n=11;break}return e.a(2);case 11:return t.proofGenerationQueue.length>0?nt(t):(l=Array.isArray(null===(u=t.providerData)||void 0===u?void 0:u.requestData)?t.providerData.requestData.length:0)>0?(f=t.providerData.requestData.filter(function(e){return t.generatedProofs.has(e.requestHash)}).length,t.sessionTimerManager.clearAllTimers(),f===l?t.expectManyClaims||setTimeout(function(){return t.submitProofs()},0):t.sessionTimerManager.resumeSessionTimer()):(t.sessionTimerManager.clearAllTimers(),t.expectManyClaims||setTimeout(function(){return t.submitProofs()},0)),e.f(10);case 12:return e.a(2)}},e,null,[[4,9,10,12]])}),ot=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){tt(i,n,o,s,a,"next",e)}function a(e){tt(i,n,o,s,a,"throw",e)}s(void 0)})},ot.apply(this,arguments)}function it(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ut(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw i}}}}function st(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return at(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(at(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,at(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,at(f,"constructor",u),at(u,"constructor",c),c.displayName="GeneratorFunction",at(u,o,"GeneratorFunction"),at(f),at(f,o,"Generator"),at(f,n,function(){return this}),at(f,"toString",function(){return"[object Generator]"}),(st=function(){return{w:i,m:h}})()}function at(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}at=function(e,t,r,n){function i(t,r){at(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},at(e,t,r,n)}function ct(e){return function(e){if(Array.isArray(e))return lt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ut(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ut(e,t){if(e){if("string"==typeof e)return lt(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?lt(e,t):void 0}}function lt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ft(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function ht(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){ft(i,n,o,s,a,"next",e)}function a(e){ft(i,n,o,s,a,"throw",e)}s(void 0)})}}function dt(e,t){return pt.apply(this,arguments)}function pt(){return pt=ht(st().m(function e(t,r){var n,o,i,s,a,c,u,l,f,h,d,p,g,y,m,E,b,v,O,I,A,S,w,R,T,_,N,C,P,L,D,U,G,F,k,B,M,j,K,V,$,H,Y,q,z,W,J,X;return st().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,chrome.cookies&&chrome.cookies.getAll){e.n=1;break}return r.info({message:"[BACKGROUND] Chrome cookies API not available",logLevel:x.E$.INFO,type:x.D_.BACKGROUND,meta:{url:t}}),e.a(2,null);case 1:return n=new URL(t),o=n.hostname,i="https:"===n.protocol,s=Date.now()/1e3,a=function(e){var t=e.split(".");if(t.length<=2)return e;var r=new Set(["co.uk","ac.uk","gov.uk","co.in","com.au","com.br","com.mx","com.sg"]),n=t.slice(-2).join("."),o=t.slice(-3).join(".");return r.has(n)?t.slice(-3).join("."):r.has(o)?t.slice(-4).join("."):t.slice(-2).join(".")},c=function(e){var t=a(e),r=new Set;return r.add("https://".concat(e)),r.add("https://".concat(t)),r.add("https://www.".concat(t)),ct(r)},u=function(e){var t=e.split("."),r=new Set;r.add(e);for(var n=1;n<t.length;n++)r.add(t.slice(n).join(".")),r.add("."+t.slice(n).join("."));return ct(r)},l=function(){var e=ht(st().m(function e(){var t;return st().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,chrome.cookies.getAllCookieStores();case 1:return t=e.v,e.a(2,Array.isArray(t)&&t.length?t:[{id:void 0}]);case 2:return e.p=2,e.v,e.a(2,[{id:void 0}])}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),f=function(){var e=ht(st().m(function e(t){var n;return st().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,chrome.cookies.getAll(t);case 1:return e.a(2,e.v);case 2:return e.p=2,n=e.v,r.info({message:"[BACKGROUND] cookies.getAll failed for details: ",logLevel:x.E$.INFO,type:x.D_.BACKGROUND,meta:{details:t,error:null==n?void 0:n.message}}),e.a(2,[])}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),h=function(e,t,r){if(!t)return!1;if(r)return e===t;var n=t.startsWith(".")?t.slice(1):t;return e===n||e.endsWith("."+n)},d=function(e,t){return!t||"/"===t||!!e.startsWith(t)&&(e.length===t.length||(!!t.endsWith("/")||"/"===e.charAt(t.length)))},p=function(e){return gt(e,n,r)},g=function(e,t){var r,n,o,i;if(!!e.hostOnly!=!!t.hostOnly)return e.hostOnly?e:t;if(((null===(r=e.path)||void 0===r?void 0:r.length)||0)!==((null===(n=t.path)||void 0===n?void 0:n.length)||0))return((null===(o=e.path)||void 0===o?void 0:o.length)||0)>((null===(i=t.path)||void 0===i?void 0:i.length)||0)?e:t;var s=e.expirationDate||0,a=t.expirationDate||0;if(s!==a)return s>a?e:t;var c=e.lastAccessed||0,u=t.lastAccessed||0;return c!==u?c>u?e:t:e},y=[],e.n=2,l();case 2:m=e.v,E=[],b=function(e){var t=JSON.stringify(e);E.some(function(e){return JSON.stringify(e)===t})||E.push(e)},v=u(o),O=c(o),I=it(m);try{for(I.s();!(A=I.n()).done;){S=A.value.id,w=it(v);try{for(w.s();!(R=w.n()).done;)T=R.value,b({domain:T,storeId:S})}catch(e){w.e(e)}finally{w.f()}b({url:t,storeId:S}),_=it(v);try{for(_.s();!(N=_.n()).done;){C=N.value,P=it(O);try{for(P.s();!(L=P.n()).done;)D=L.value,b({domain:C,partitionKey:{topLevelSite:D},storeId:S})}catch(e){P.e(e)}finally{P.f()}}}catch(e){_.e(e)}finally{_.f()}U=it(O);try{for(U.s();!(G=U.n()).done;)F=G.value,b({url:t,partitionKey:{topLevelSite:F},storeId:S})}catch(e){U.e(e)}finally{U.f()}}}catch(e){I.e(e)}finally{I.f()}return e.n=3,Promise.all(E.map(function(e){return f(e)}));case 3:k=e.v,B=it(k);try{for(B.s();!(M=B.n()).done;)j=M.value,y.push.apply(y,ct(j))}catch(e){B.e(e)}finally{B.f()}K=function(e){var t;return[e.name,e.domain||"",e.path||"",(null===(t=e.partitionKey)||void 0===t?void 0:t.topLevelSite)||""].join("|")},V=new Map,$=0,H=y;case 4:if(!($<H.length)){e.n=7;break}if(Y=H[$],p(Y)){e.n=5;break}return e.a(3,6);case 5:q=K(Y),z=V.get(q),V.set(q,z?g(z,Y):Y);case 6:$++,e.n=4;break;case 7:if(0!==(W=ct(V.values())).length){e.n=8;break}return e.a(2,null);case 8:return W.sort(function(e,t){var r=function(e){return e?e.length:0};if(r(e.path)!==r(t.path))return r(t.path)-r(e.path);if(!!e.hostOnly!=!!t.hostOnly)return e.hostOnly?-1:1;var n=e.expirationDate||0;return(t.expirationDate||0)-n}),J=W.map(function(e){return"".concat(e.name,"=").concat(e.value)}).join("; "),e.a(2,J||null);case 9:return e.p=9,X=e.v,r.error({message:"[BACKGROUND] Error getting cookies for URL: "+(null==X?void 0:X.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,meta:{error:null==X?void 0:X.message}}),e.a(2,null)}},e,null,[[0,9]])})),pt.apply(this,arguments)}function gt(e,t,r){try{var n=e.domain.startsWith(".")?e.domain.substring(1):e.domain,o=t.hostname;if(!(o===n||o.endsWith("."+n)||e.domain.startsWith(".")&&o.endsWith(e.domain.substring(1))))return!1;var i=e.path||"/";if(!t.pathname.startsWith(i))return!1;var s="https:"===t.protocol;return!(e.secure&&!s)&&!(e.expirationDate&&e.expirationDate<Date.now()/1e3)}catch(e){return r.info({message:"[BACKGROUND] Error checking cookie inclusion: "+(null==e?void 0:e.message),logLevel:x.E$.INFO,type:x.D_.BACKGROUND,meta:{error:null==e?void 0:e.message}}),!1}}function yt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return mt(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(mt(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,mt(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,mt(f,"constructor",u),mt(u,"constructor",c),c.displayName="GeneratorFunction",mt(u,o,"GeneratorFunction"),mt(f),mt(f,o,"Generator"),mt(f,n,function(){return this}),mt(f,"toString",function(){return"[object Generator]"}),(yt=function(){return{w:i,m:h}})()}function mt(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}mt=function(e,t,r,n){function i(t,r){mt(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},mt(e,t,r,n)}function Et(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function bt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Et(Object(r),!0).forEach(function(t){vt(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Et(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function vt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=At(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=At(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==At(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ot(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function It(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){Ot(i,n,o,s,a,"next",e)}function a(e){Ot(i,n,o,s,a,"throw",e)}s(void 0)})}}function At(e){return At="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},At(e)}var St=(0,i.y8)({sessionId:"unknown",providerId:"unknown",appId:"unknown",source:"reclaim-extension-sdk"});function wt(){"undefined"!=typeof chrome&&chrome.runtime&&chrome.runtime.onMessage&&chrome.runtime.onMessage.addListener&&chrome.runtime.onMessage.hasListener&&(chrome.runtime.onMessage.hasListener(I)||chrome.runtime.onMessage.addListener(I));var e={activeTabId:null,providerData:null,parameters:{},providerId:null,appId:null,sessionId:null,callbackUrl:null,publicData:null,aborted:!1,expectManyClaims:!1,originalTabId:null,managedTabs:new Set,providerRequestsByHash:new Map,generatedProofs:new Map,filteredRequests:new Map,proofGenerationQueue:[],isProcessingQueue:!1,firstRequestReceived:!1,initPopupMessage:new Map,providerDataMessage:new Map,activeSessionId:null,sessionTimerManager:new Se,fetchProviderData:f,updateSessionStatus:h,submitProofOnCallback:d,RECLAIM_SESSION_STATUS:o.Ew,MESSAGE_ACTIONS:o.wx,MESSAGE_SOURCES:o.J_,generateProof:D,formatProof:U.c,createClaimObject:ve,loggerService:i.Ow,bgLogger:St,debugLogger:x.w9,DebugLogType:x.Ey,processFilteredRequest:null,failSession:null,submitProofs:null};St.setContext({sessionId:e.sessionId||"unknown",providerId:e.providerId||"unknown",appId:e.appId||"unknown",type:s.LOG_TYPES.BACKGROUND});try{var t=r(859).LOG_CONFIG_STORAGE_KEY;chrome.storage.local.get([t],function(r){var n=null==r?void 0:r[t];n&&"object"===At(n)&&e.loggerService.setConfig(n)}),chrome.storage.onChanged.addListener(function(r,n){if("local"===n&&r[t]){var o=r[t].newValue||{};e.loggerService.setConfig(o)}})}catch(e){}return St.info({message:"Background initialized INFO",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND}),e.failSession=function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return Be.apply(n,[e].concat(r))},e.submitProofs=function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return je.apply(n,[e].concat(r))},e.processFilteredRequest=function(){var t=It(yt().m(function t(r,n,o,i){var a,c,u,l,f,h,d,p;return yt().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,o=e.sessionId||o){t.n=1;break}return e.failSession("Session not initialized for claim request",null==n?void 0:n.requestHash),t.a(2,{success:!1,error:"Session not initialized"});case 1:return e.firstRequestReceived||(e.firstRequestReceived=!0,e.sessionTimerManager.startSessionTimer()),St.setContext({sessionId:e.sessionId||"unknown",providerId:e.providerId||"unknown",appId:e.appId||"unknown",type:s.LOG_TYPES.BACKGROUND}),St.info({message:"[BACKGROUND] Filtering request for request hash: ".concat(n.requestHash),logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND}),t.n=2,dt(r.url,e.bgLogger);case 2:return(a=t.v)&&(r.cookieStr=a),St.log({message:"[BACKGROUND] Cookies for URL: ".concat(r.url),logLevel:s.LOG_LEVEL.ALL,type:s.LOG_TYPES.BACKGROUND,meta:{request:r,criteria:n,sessionId:o,loginUrl:i,cookies:a}}),chrome.tabs.sendMessage(e.activeTabId,{action:e.MESSAGE_ACTIONS.CLAIM_CREATION_REQUESTED,source:e.MESSAGE_SOURCES.BACKGROUND,target:e.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{requestHash:n.requestHash}}),St.info({message:"[BACKGROUND] Claim creation requested for request hash: "+n.requestHash,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND,eventType:s.EVENT_TYPES.STARTING_CLAIM_CREATION}),c=null,t.p=3,f=bt(bt({},n),{},{geoLocation:null!==(u=null===(l=e.providerData)||void 0===l?void 0:l.geoLocation)&&void 0!==u?u:""}),t.n=4,e.createClaimObject(r,f,o,e.providerId,i,e.bgLogger);case 4:c=t.v,t.n=6;break;case 5:return t.p=5,d=t.v,St.error({message:"[BACKGROUND] Error creating claim object: "+d.message,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND}),chrome.tabs.sendMessage(e.activeTabId,{action:e.MESSAGE_ACTIONS.CLAIM_CREATION_FAILED,source:e.MESSAGE_SOURCES.BACKGROUND,target:e.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{requestHash:n.requestHash}}),e.failSession("Claim creation failed: "+d.message,n.requestHash),t.a(2,{success:!1,error:d.message});case 6:return c&&(chrome.tabs.sendMessage(e.activeTabId,{action:e.MESSAGE_ACTIONS.CLAIM_CREATION_SUCCESS,source:e.MESSAGE_SOURCES.BACKGROUND,target:e.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{requestHash:n.requestHash}}),St.info({message:"[BACKGROUND] Claim Object creation successful for request hash: "+n.requestHash,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND})),(h={url:(null==n?void 0:n.url)||(null==r?void 0:r.url)||"",expectedPageUrl:(null==n?void 0:n.expectedPageUrl)||"",urlType:(null==n?void 0:n.urlType)||"EXACT",method:(null==n?void 0:n.method)||(null==r?void 0:r.method)||"GET",responseMatches:Array.isArray(null==n?void 0:n.responseMatches)?n.responseMatches:[],responseRedactions:Array.isArray(null==n?void 0:n.responseRedactions)?n.responseRedactions:[],requestHash:null==n?void 0:n.requestHash}).requestHash&&e.providerRequestsByHash.set(h.requestHash,h),rt(e,c,n.requestHash),St.info({message:"[BACKGROUND] Proof generation queued for request hash: "+n.requestHash,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND}),t.a(2,{success:!0,message:"Proof generation queued"});case 7:return t.p=7,p=t.v,St.error({message:"[BACKGROUND] Error processing filtered request: "+p.message,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND}),e.failSession("Error processing request: "+p.message,n.requestHash),t.a(2,{success:!1,error:p.message})}},t,null,[[3,5],[0,7]])}));return function(e,r,n,o){return t.apply(this,arguments)}}(),e.sessionTimerManager.setCallbacks(e.failSession),e.sessionTimerManager.setTimerDuration(3e4),chrome.runtime.onMessage.addListener(function(t,r,n){return function(e,t,r,n){ze.apply(this,arguments)}(e,t,r,n),!0}),chrome.tabs.onRemoved.addListener(function(){var t=It(yt().m(function t(r){var n,o;return yt().w(function(t){for(;;)switch(t.p=t.n){case 0:if(e.managedTabs.has(r)&&e.managedTabs.delete(r),n=r===e.activeTabId,o=0===e.managedTabs.size,!e.activeSessionId||!n&&!o||e.aborted){t.n=4;break}return e.aborted=!0,t.p=1,St.error({message:"[BACKGROUND] Verification tab closed by user",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND,sessionId:e.activeSessionId||e.sessionId||"unknown",providerId:e.providerId||"unknown",appId:e.appId||"unknown",eventType:s.EVENT_TYPES.RECLAIM_VERIFICATION_DISMISSED}),t.n=2,e.failSession("Verification tab closed by user");case 2:t.n=4;break;case 3:t.p=3,t.v;case 4:n&&(e.activeTabId=null),o&&(e.originalTabId=null,e.activeSessionId=null);case 5:return t.a(2)}},t,null,[[1,3]])}));return function(e){return t.apply(this,arguments)}}()),St.info({message:"[BACKGROUND] 🚀 Background initialization complete",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND}),e}},379(e,t,r){"use strict";function n(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",s=r.toStringTag||"@@toStringTag";function a(r,n,i,s){var a=n&&n.prototype instanceof u?n:u,l=Object.create(a.prototype);return o(l,"_invoke",function(r,n,o){var i,s,a,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,s=0,a=e,h.n=r,c}};function d(r,n){for(s=r,a=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(a=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(s=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,s=0))}if(o||r>1)return c;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),s=l,a=p;(t=s<2?e:a)||!f;){i||(s?s<3?(s>1&&(h.n=-1),d(s,a)):h.n=a:h.v=a);try{if(u=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,a)))throw TypeError("iterator result is not an object");if(!t.done)return t;a=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(f=h.n<0)?a:r.call(n,h))!==c)break}catch(t){i=e,s=1,a=t}finally{u=1}}return{value:t,done:f}}}(r,i,s),!0),l}var c={};function u(){}function l(){}function f(){}t=Object.getPrototypeOf;var h=[][i]?t(t([][i]())):(o(t={},i,function(){return this}),t),d=f.prototype=u.prototype=Object.create(h);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,o(e,s,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=f,o(d,"constructor",f),o(f,"constructor",l),l.displayName="GeneratorFunction",o(f,s,"GeneratorFunction"),o(d),o(d,s,"Generator"),o(d,i,function(){return this}),o(d,"toString",function(){return"[object Generator]"}),(n=function(){return{w:a,m:p}})()}function o(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}o=function(e,t,r,n){function s(t,r){o(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(s("next",0),s("throw",1),s("return",2))},o(e,t,r,n)}function i(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}r.d(t,{C:()=>s});var s=function(){var e,t=(e=n().m(function e(){var t,r,o,i,s;return n().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,fetch("https://ipapi.co/json/");case 1:return r=e.v,e.n=2,r.json();case 2:if(o=e.v,200===(null==r?void 0:r.status)){e.n=3;break}throw new Error("Failed to get user location based on IP");case 3:return i=null!==(t=null==o?void 0:o.country_code)&&void 0!==t?t:"US",e.a(2,i);case 4:return e.p=4,s=e.v,console.error("Error getting user location based on IP:",s),e.a(2,"US")}},e,null,[[0,4]])}),function(){var t=this,r=arguments;return new Promise(function(n,o){var s=e.apply(t,r);function a(e){i(s,n,o,a,c,"next",e)}function c(e){i(s,n,o,a,c,"throw",e)}a(void 0)})});return function(){return t.apply(this,arguments)}}()},952(e,t,r){"use strict";r.d(t,{Sn:()=>o,fn:()=>n,wx:()=>c,J_:()=>a,vQ:()=>i,Ew:()=>s});var n="http://localhost:8001",o={PROVIDER_URL:function(e){return"".concat(n,"/api/providers/").concat(e)},SUBMIT_PROOF:function(e){return"".concat(n,"/session/").concat(e,"/proof")},UPDATE_SESSION_STATUS:function(){return"".concat(n,"/api/sdk/update/session/")},STATUS_URL:function(e){return"".concat(n,"/api/sdk/session/").concat(e)}},i={CHECK_EXTENSION:"JOCLAIM_EXTENSION_CHECK",EXTENSION_RESPONSE:"JOCLAIM_EXTENSION_RESPONSE",START_VERIFICATION:"JOCLAIM_START_VERIFICATION",VERIFICATION_STARTED:"JOCLAIM_VERIFICATION_STARTED",VERIFICATION_COMPLETED:"JOCLAIM_VERIFICATION_COMPLETED",VERIFICATION_FAILED:"JOCLAIM_VERIFICATION_FAILED",CANCEL_VERIFICATION:"JOCLAIM_CANCEL_VERIFICATION",SET_PUBLIC_DATA:"JOCLAIM_SET_PUBLIC_DATA",PARAMETERS_UPDATE:"JOCLAIM_PARAMETERS_UPDATE",PARAMETERS_GET:"JOCLAIM_PARAMETERS_GET",REPORT_PROVIDER_ERROR:"JOCLAIM_REPORT_PROVIDER_ERROR",SET_EXPECT_MANY_CLAIMS:"JOCLAIM_SET_EXPECT_MANY_CLAIMS",REQUEST_CLAIM:"JOCLAIM_REQUEST_CLAIM",SET_LOG_CONFIG:"JOCLAIM_SET_LOG_CONFIG",SET_PARAMETERS:"JOCLAIM_SET_PARAMETERS"},s={SESSION_INIT:"SESSION_INIT",SESSION_STARTED:"SESSION_STARTED",USER_INIT_VERIFICATION:"USER_INIT_VERIFICATION",USER_STARTED_VERIFICATION:"USER_STARTED_VERIFICATION",PROOF_GENERATION_STARTED:"PROOF_GENERATION_STARTED",PROOF_GENERATION_SUCCESS:"PROOF_GENERATION_SUCCESS",PROOF_GENERATION_FAILED:"PROOF_GENERATION_FAILED",PROOF_SUBMITTED:"PROOF_SUBMITTED",PROOF_SUBMISSION_FAILED:"PROOF_SUBMISSION_FAILED",PROOF_MANUAL_VERIFICATION_SUBMITED:"PROOF_MANUAL_VERIFICATION_SUBMITED"},a={CONTENT_SCRIPT:"content-script",BACKGROUND:"background",OFFSCREEN:"offscreen"},c={START_VERIFICATION:"START_VERIFICATION",CANCEL_VERIFICATION:"CANCEL_VERIFICATION",GENERATE_PROOF_REQUEST:"GENERATE_PROOF_REQUEST",CLAIM_CREATION_REQUESTED:"CLAIM_CREATION_REQUESTED",CLAIM_CREATION_SUCCESS:"CLAIM_CREATION_SUCCESS",CLAIM_CREATION_FAILED:"CLAIM_CREATION_FAILED",PROOF_GENERATION_STARTED:"PROOF_GENERATION_STARTED",PROOF_GENERATION_SUCCESS:"PROOF_GENERATION_SUCCESS",PROOF_GENERATION_FAILED:"PROOF_GENERATION_FAILED",PROOF_SUBMITTED:"PROOF_SUBMITTED",PROOF_SUBMISSION_FAILED:"PROOF_SUBMISSION_FAILED",GENERATE_PROOF:"GENERATE_PROOF",GENERATED_PROOF_RESPONSE:"GENERATED_PROOF_RESPONSE",GENERATE_CLAIM_ON_ATTESTOR:"GENERATE_CLAIM_ON_ATTESTOR",GET_PRIVATE_KEY:"GET_PRIVATE_KEY",GET_PRIVATE_KEY_RESPONSE:"GET_PRIVATE_KEY_RESPONSE",SHOW_PROVIDER_VERIFICATION_POPUP:"SHOW_PROVIDER_VERIFICATION_POPUP",OFFSCREEN_DOCUMENT_READY:"OFFSCREEN_DOCUMENT_READY",GENERATE_PROOF_RESPONSE:"GENERATE_PROOF_RESPONSE",PING_OFFSCREEN:"PING_OFFSCREEN",CLOSE_CURRENT_TAB:"CLOSE_CURRENT_TAB",GET_CURRENT_TAB_ID:"GET_CURRENT_TAB_ID",REQUEST_PROVIDER_DATA:"REQUEST_PROVIDER_DATA",PROVIDER_DATA_READY:"PROVIDER_DATA_READY",CONTENT_SCRIPT_LOADED:"CONTENT_SCRIPT_LOADED",SHOULD_INITIALIZE:"SHOULD_INITIALIZE",CHECK_IF_MANAGED_TAB:"CHECK_IF_MANAGED_TAB",FILTERED_REQUEST_FOUND:"FILTERED_REQUEST_FOUND",INTERCEPTED_REQUEST_AND_RESPONSE:"INTERCEPTED_REQUEST_AND_RESPONSE",UPDATE_PUBLIC_DATA:"UPDATE_PUBLIC_DATA",UPDATE_EXPECT_MANY_CLAIMS:"UPDATE_EXPECT_MANY_CLAIMS",GET_PARAMETERS:"GET_PARAMETERS",REPORT_PROVIDER_ERROR:"REPORT_PROVIDER_ERROR",REQUEST_CLAIM:"REQUEST_CLAIM",INJECT_VIA_SCRIPTING:"INJECT_VIA_SCRIPTING"}},770(e,t,r){"use strict";r.d(t,{y8:()=>I,Ow:()=>O});var n=r(859);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}}function s(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==o(t)?t:t+""}var a=function(){function e(t){var r=t.sessionId,n=t.providerId,o=t.appId,i=t.logLine,s=t.type,a=t.eventType,c=t.logLevel,u=t.source,l=t.tabId,f=t.url,h=t.meta,d=t.time,p=void 0===d?null:d,g=t.deviceId;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.sessionId=r,this.providerId=n,this.appId=o,this.logLine=i,this.type=s,this.eventType=a,this.logLevel=c,this.source=u,this.tabId=l,this.url=f,this.meta=h||void 0,this.time=p||new Date,this.deviceId=g}return t=e,n=[{key:"fromDateTimeToTimeStamp",value:function(e){return(1e6*e.getTime()).toString()}}],(r=[{key:"toJson",value:function(){var t={logLine:this.logLine,ts:e.fromDateTimeToTimeStamp(this.time),logLevel:this.logLevel,sessionId:this.sessionId,providerId:this.providerId,appId:this.appId,source:this.source,deviceId:this.deviceId};return this.type&&(t.type=this.type),this.eventType&&(t.eventType=this.eventType),this.tabId&&(t.tabId=this.tabId),this.url&&(t.url=this.url),this.meta&&(t.meta=this.meta),t}}])&&i(t.prototype,r),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,n}();function c(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function l(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return f(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var h=[][n]?t(t([][n]())):(f(t={},n,function(){return this}),t),d=u.prototype=a.prototype=Object.create(h);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,f(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=u,f(d,"constructor",u),f(u,"constructor",c),c.displayName="GeneratorFunction",f(u,o,"GeneratorFunction"),f(d),f(d,o,"Generator"),f(d,n,function(){return this}),f(d,"toString",function(){return"[object Generator]"}),(l=function(){return{w:i,m:p}})()}function f(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}f=function(e,t,r,n){function i(t,r){f(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},f(e,t,r,n)}function h(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function d(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){h(i,n,o,s,a,"next",e)}function a(e){h(i,n,o,s,a,"throw",e)}s(void 0)})}}function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?g(Object(r),!0).forEach(function(t){m(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function m(e,t,r){return(t=b(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function E(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,b(n.key),n)}}function b(e){var t=function(e,t){if("object"!=p(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=p(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==p(t)?t:t+""}var v=function(){return e=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.logs=[],this.isSending=!1,this.maxBatchSize=20,this.flushInterval=5e3,this.flushIntervalId=null,this.config=y({},n.DEFAULT_LOG_CONFIG),this.deviceId=null;try{var r;"undefined"!=typeof chrome&&null!==(r=chrome.storage)&&void 0!==r&&r.local&&(chrome.storage.local.get([n.LOG_CONFIG_STORAGE_KEY],function(e){var r=null==e?void 0:e[n.LOG_CONFIG_STORAGE_KEY];r&&"object"===p(r)&&t.setConfig(r)}),chrome.storage.onChanged.addListener(function(e,r){if("local"===r&&e[n.LOG_CONFIG_STORAGE_KEY]){var o=e[n.LOG_CONFIG_STORAGE_KEY].newValue||{};t.setConfig(o)}}))}catch(e){}this.startFlushInterval()},t=[{key:"setConfig",value:function(e){this.config=y(y({},this.config),e)}},{key:"startFlushInterval",value:function(){var e=this;this.flushIntervalId&&clearInterval(this.flushIntervalId),this.flushIntervalId=setInterval(function(){return e.flush()},this.flushInterval)}},{key:"stopFlushInterval",value:function(){this.flushIntervalId&&(clearInterval(this.flushIntervalId),this.flushIntervalId=null)}},{key:"getDeviceLoggingId",value:(s=d(l().m(function e(){var t;return l().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!this.deviceId){e.n=1;break}return e.a(2,this.deviceId);case 1:if(e.p=1,"undefined"==typeof chrome||!chrome.storage){e.n=3;break}return e.n=2,chrome.storage.local.get(["reclaim_device_id"]);case 2:if(!(t=e.v).reclaim_device_id){e.n=3;break}return this.deviceId=t.reclaim_device_id,e.a(2,this.deviceId);case 3:e.n=5;break;case 4:e.p=4,e.v;case 5:if(this.deviceId="undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():String(Date.now()),e.p=6,"undefined"==typeof chrome||!chrome.storage){e.n=7;break}return e.n=7,chrome.storage.local.set({reclaim_device_id:this.deviceId});case 7:e.n=9;break;case 8:e.p=8,e.v;case 9:return e.a(2,this.deviceId)}},e,this,[[6,8],[1,4]])})),function(){return s.apply(this,arguments)})},{key:"addLog",value:function(e){this.logs.push(e),this.logs.length>=this.maxBatchSize&&this.flush()}},{key:"shouldLog",value:function(e){return e<=(n.LOG_LEVEL_MAP[this.config.logLevel]||n.LOG_LEVEL.INFO)}},{key:"emitToConsole",value:function(e,t,r){var n="[".concat(e,"]"),o="".concat(n," ").concat(t);r?console.log(o,r):console.log(o)}},{key:"log",value:function(e){var t=e.message,r=e.logLevel,n=e.type,o=e.eventType,i=e.meta,s=e.sessionId,c=e.providerId,u=e.appId,l=e.source,f=e.tabId,h=e.url;if(t&&r){if(this.shouldLog(r)){this.config.consoleEnabled&&this.emitToConsole(r,t,i);var d=new a({sessionId:s||"unknown",providerId:c||"unknown",appId:u||"unknown",logLine:t,type:n,eventType:o,logLevel:r,source:l||this.config.source,tabId:f,url:h,meta:i,time:new Date});this.addLog(d)}}else console.error("Logger: message and logLevel are required")}},{key:"flush",value:(i=d(l().m(function e(){var t,r;return l().w(function(e){for(;;)switch(e.p=e.n){case 0:if(0!==this.logs.length&&!this.isSending){e.n=1;break}return e.a(2);case 1:return t=c(this.logs),this.logs=[],e.p=2,this.isSending=!0,e.n=3,this.sendLogs(t);case 3:e.n=5;break;case 4:e.p=4,r=e.v,console.error("Error flushing logs:",r),this.logs=[].concat(c(this.logs),c(t));case 5:return e.p=5,this.isSending=!1,e.f(5);case 6:return e.a(2)}},e,this,[[2,4,5,6]])})),function(){return i.apply(this,arguments)})},{key:"sendLogs",value:(o=d(l().m(function e(t){var r,o,i,s,a,c;return l().w(function(e){for(;;)switch(e.n){case 0:if(null!=t&&t.length){e.n=1;break}return e.a(2);case 1:return e.n=2,this.getDeviceLoggingId();case 2:return r=e.v,o=t.map(function(e){var t=e.toJson();return t.deviceId=t.deviceId||r,t}),i=JSON.stringify({logs:o,source:this.config.source,deviceId:r}),e.n=3,fetch(n.LOGGING_ENDPOINTS.DIAGNOSTIC_LOGGING,{method:"POST",headers:{"Content-Type":"application/json"},body:i});case 3:if((s=e.v).ok){e.n=5;break}return a=console,c="Failed to send ".concat(t.length," logs"),e.n=4,s.text();case 4:a.error.call(a,c,e.v);case 5:return e.a(2)}},e,this)})),function(e){return o.apply(this,arguments)})}],t&&E(e.prototype,t),r&&E(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r,o,i,s}(),O=new v,I=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=y({sessionId:"unknown",providerId:"unknown",appId:"unknown",source:(null===(e=O.config)||void 0===e?void 0:e.source)||"reclaim-extension-sdk"},t);return{get context(){return y({},r)},setContext:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.assign(r,e)},log:function(e){O.log(y(y({},r),e))},info:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};O.log(y(y({},r),{},{logLevel:"INFO"},e))},debug:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};O.log(y(y({},r),{},{logLevel:"DEBUG"},e))},all:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};O.log(y(y({},r),{},{logLevel:"ALL"},e))},error:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};O.log(y(y({},r),{},{logLevel:"ALL"},e))}}}},859(e,t,r){"use strict";r.r(t),r.d(t,{DEFAULT_LOG_CONFIG:()=>u,EVENT_TYPES:()=>s,LOGGING_ENDPOINTS:()=>n,LOG_CONFIG_STORAGE_KEY:()=>l,LOG_LEVEL:()=>a,LOG_LEVEL_MAP:()=>c,LOG_SOURCES:()=>i,LOG_TYPES:()=>o});var n={DIAGNOSTIC_LOGGING:"http://localhost:8001/api/logs"},o={BACKGROUND:"reclaim_browser_extension.BackgroundProcess",CONTENT:"reclaim_browser_extension.ContentScript",POPUP:"reclaim_browser_extension.Popup",INIT:"reclaim_browser_extension.Initialization",VERIFICATION:"reclaim_browser_extension.Verification",FETCH_DATA:"reclaim_browser_extension.FetchData",PROVIDER_DATA:"reclaim_browser_extension.ProviderData",CLAIM_CREATION:"reclaim_browser_extension.ClaimCreation",PROOF_GENERATION:"reclaim_browser_extension.ProofGeneration",PROOF_SUBMISSION:"reclaim_browser_extension.ProofSubmission",PROOF_VERIFICATION:"reclaim_browser_extension.ProofVerification",OFFSCREEN:"reclaim_browser_extension.Offscreen"},i={BACKGROUND:"background",CONTENT:"content",OFFSCREEN:"offscreen",POPUP:"popup",INJECTION:"injection"},s={IS_RECLAIM_EXTENSION_SDK:"IS_RECLAIM_EXTENSION_SDK",VERIFICATION_FLOW_STARTED:"VERIFICATION_FLOW_STARTED",RECLAIM_VERIFICATION_DISMISSED:"RECLAIM_VERIFICATION_DISMISSED",RECLAIM_VERIFICATION_PROVIDER_LOAD_EXCEPTION:"RECLAIM_VERIFICATION_PROVIDER_LOAD_EXCEPTION",REQUEST_MATCHED:"REQUEST_MATCHED",RESPONSE_MATCH_FAILED:"RESPONSE_MATCH_FAILED",X_PATH_MATCH_REQUIREMENT_FAILED:"X_PATH_MATCH_REQUIREMENT_FAILED",JSON_PATH_MATCH_REQUIREMENT_FAILED:"JSON_PATH_MATCH_REQUIREMENT_FAILED",REGEX_MATCH_REQUIREMENT_FAILED:"REGEX_MATCH_REQUIREMENT_FAILED",FILTERED_REQUEST_FOUND:"FILTERED_REQUEST_FOUND",FILTER_REQUEST_ERROR:"FILTER_REQUEST_ERROR",STARTING_CLAIM_CREATION:"STARTING_CLAIM_CREATION",CLAIM_CREATION_STARTED:"CLAIM_CREATION_STARTED",CLAIM_CREATION_SUCCESS:"CLAIM_CREATION_SUCCESS",CLAIM_CREATION_FAILED:"CLAIM_CREATION_FAILED",CLAIM_PARAMETER_VALIDATION_FAILED_EXCEPTION:"CLAIM_PARAMETER_VALIDATION_FAILED_EXCEPTION",OFFSCREEN_DOCUMENT_READY:"OFFSCREEN_DOCUMENT_READY",OFFSCREEN_DOCUMENT_NOT_READY_EXCEPTION:"OFFSCREEN_DOCUMENT_NOT_READY_EXCEPTION",PROOF_GENERATION_STARTED:"PROOF_GENERATION_STARTED",PROOF_GENERATION_SUCCESS:"PROOF_GENERATION_SUCCESS",PROOF_GENERATION_ABORTED:"PROOF_GENERATION_ABORTED",PROOF_GENERATION_FAILED:"PROOF_GENERATION_FAILED",RESULT_RECEIVED:"RESULT_RECEIVED",SUBMITTING_PROOF:"SUBMITTING_PROOF",SUBMITTING_PROOF_TO_CALLBACK_URL:"SUBMITTING_PROOF_TO_CALLBACK_URL",SUBMITTING_PROOF_TO_CALLBACK_URL_SUCCESS:"SUBMITTING_PROOF_TO_CALLBACK_URL_SUCCESS",SUBMITTING_PROOF_TO_CALLBACK_URL_FAILED:"SUBMITTING_PROOF_TO_CALLBACK_URL_FAILED",PROOF_SUBMISSION_FAILED:"PROOF_SUBMISSION_FAILED",PROOF_SUBMITTED:"PROOF_SUBMITTED",VERIFICATION_FLOW_FAILED:"VERIFICATION_FLOW_FAILED",TAB_NOT_MANAGED_BY_EXTENSION_EXCEPTION:"TAB_NOT_MANAGED_BY_EXTENSION_EXCEPTION",INJECTION_SCRIPT_SET_IN_LOCAL_STORAGE_FAILED:"INJECTION_SCRIPT_SET_IN_LOCAL_STORAGE_FAILED",VERIFICATION_POPUP_ERROR:"VERIFICATION_POPUP_ERROR",UPDATE_SESSION_STATUS_ERROR:"UPDATE_SESSION_STATUS_ERROR"},a={INFO:10,DEBUG:20,ALL:30},c={INFO:a.INFO,DEBUG:a.DEBUG,ALL:a.ALL},u={logLevel:"INFO",consoleEnabled:!1,source:"reclaim-extension-sdk"},l="reclaim_extension_sdk_log_config"},153(e,t,r){"use strict";r.d(t,{Ey:()=>s,Ru:()=>u.EVENT_TYPES,E$:()=>u.LOG_LEVEL,D_:()=>u.LOG_TYPES,w9:()=>c});r(770);function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var s=Object.freeze({BACKGROUND:"background",CONTENT:"content",POPUP:"popup",INIT:"init",VERIFICATION:"verification",FETCH:"fetch",PROVIDER:"provider",CLAIM:"claim",PROOF:"proof",OFFSCREEN:"offscreen",POLYFILLS:"polyfills",SESSION_TIMER:"session-timer"}),a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.enabled=!0,this.allowedTypes=new Set}return t=e,r=[{key:"enable",value:function(){this.enabled=!0}},{key:"disable",value:function(){this.enabled=!1}},{key:"setTypes",value:function(e){Array.isArray(e)&&(this.allowedTypes=new Set(e))}},{key:"clearTypes",value:function(){this.allowedTypes.clear()}},{key:"log",value:function(t){var r;if(this.enabled&&(!(this.allowedTypes.size>0)||this.allowedTypes.has(t))){for(var n=e.typeColor(t),o=arguments.length,i=new Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];(r=console).log.apply(r,["%c[".concat(t,"][INFO]"),"color: ".concat(n,"; font-weight: bold;")].concat(i))}}},{key:"info",value:function(t){var r;if(this.enabled&&(!(this.allowedTypes.size>0)||this.allowedTypes.has(t))){for(var n=e.typeColor(t),o=arguments.length,i=new Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];(r=console).info.apply(r,["%c[".concat(t,"][INFO]"),"color: ".concat(n,"; font-weight: bold;")].concat(i))}}},{key:"warn",value:function(t){var r;if(this.enabled&&(!(this.allowedTypes.size>0)||this.allowedTypes.has(t))){for(var n=e.typeColor(t,"warn"),o=arguments.length,i=new Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];(r=console).warn.apply(r,["%c[".concat(t,"][WARN]"),"color: ".concat(n,"; font-weight: bold;")].concat(i))}}},{key:"error",value:function(t){var r;if(this.enabled&&(!(this.allowedTypes.size>0)||this.allowedTypes.has(t))){for(var n=e.typeColor(t,"error"),o=arguments.length,i=new Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];(r=console).error.apply(r,["%c[".concat(t,"][ERROR]"),"color: ".concat(n,"; font-weight: bold;")].concat(i))}}}],n=[{key:"typeColor",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",r={background:"#0074D9",content:"#2ECC40",popup:"#FF851B",init:"#B10DC9",verification:"#FF4136",fetch:"#39CCCC",provider:"#FFDC00",claim:"#7FDBFF",proof:"#85144b",offscreen:"#AAAAAA",polyfills:"#0074D9","session-timer":"#2ECC40"},n=r[Object.keys(r).find(function(t){return e.toLowerCase().includes(t)})]||"#888888";return"info"!==t&&(n={info:"",warn:"#FFA500",error:"#FF0000"}[t]||n),n}}],r&&o(t.prototype,r),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,n}(),c=new a,u=r(859),l=r(606);void 0!==l&&l.env?c.disable():c.enable()},997(e,t,r){"use strict";var n=r(287),o=r(606),i=r.n(o),s=r(153);function a(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var a=n&&n.prototype instanceof u?n:u,l=Object.create(a.prototype);return c(l,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),l}var s={};function u(){}function l(){}function f(){}t=Object.getPrototypeOf;var h=[][n]?t(t([][n]())):(c(t={},n,function(){return this}),t),d=f.prototype=u.prototype=Object.create(h);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,c(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=f,c(d,"constructor",f),c(f,"constructor",l),l.displayName="GeneratorFunction",c(f,o,"GeneratorFunction"),c(d),c(d,o,"Generator"),c(d,n,function(){return this}),c(d,"toString",function(){return"[object Generator]"}),(a=function(){return{w:i,m:p}})()}function c(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}c=function(e,t,r,n){function i(t,r){c(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},c(e,t,r,n)}function u(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function l(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){u(i,n,o,s,a,"next",e)}function a(e){u(i,n,o,s,a,"throw",e)}s(void 0)})}}var f,h,d,p="undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0!==p?p:Function("return this")(),g="undefined"==typeof window,y="undefined"!=typeof document&&void 0!==document.contentType;if(p.Buffer=p.Buffer||n.hp,p.process=p.process||i(),void 0!==p.WebSocket||y)y?s.w9.info(s.Ey.POLYFILLS,"Skipping WebSocket in content script context"):s.w9.info(s.Ey.POLYFILLS,"Using native WebSocket implementation");else try{var m=r(296).WebSocket;p.WebSocket=m,s.w9.info(s.Ey.POLYFILLS,"WebSocket polyfill added to global")}catch(e){s.w9.warn(s.Ey.POLYFILLS,"Failed to load WebSocket polyfill:",e)}if(p.process&&(p.process.browser=!0),"function"!=typeof p.require)p.require=function(e){switch(e){case"ws":if(y)return s.w9.info(s.Ey.POLYFILLS,"Blocking ws module in content script"),{};try{return{WebSocket:r(296).WebSocket}}catch(e){return s.w9.warn(s.Ey.POLYFILLS,"Failed to load WebSocket for ws module:",e),{}}case"fs":return p.fs;case"path":return p.path;case"os":return p.os;case"crypto":return p.crypto;case"worker_threads":case"koffi":case"re2":return{};default:return console.warn("Mock require called for module: ".concat(e)),{}}};else{var E=p.require;p.require=function(e){if("ws"===e){if(y)return s.w9.info(s.Ey.POLYFILLS,"Blocking ws module in content script"),{};try{return{WebSocket:r(296).WebSocket}}catch(e){return s.w9.warn(s.Ey.POLYFILLS,"Failed to load WebSocket for ws module:",e),{}}}try{return E(e)}catch(t){return s.w9.warn(s.Ey.POLYFILLS,"Failed to require module: ".concat(e)),{}}}}if(void 0!==i()&&(i().browser=!0,i().version||(i().version="v16.0.0"),i().cwd||(i().cwd=function(){return"/"})),void 0===p.global&&(p.global=p),void 0===p.crypto&&(p.crypto={}),void 0===p.crypto.getRandomValues&&(p.crypto.getRandomValues=function(e){for(var t=new Uint8Array(e.length),r=0;r<t.length;r++)t[r]=Math.floor(256*Math.random());return t}),void 0===p.crypto.subtle&&(s.w9.warn(s.Ey.POLYFILLS,"WebCrypto subtle API not available. Some functionality may not work."),p.crypto.subtle={digest:(f=l(a().m(function e(t,r){var n,o,i;return a().w(function(e){for(;;)if(0===e.n){for(s.w9.warn(s.Ey.POLYFILLS,"Crypto subtle digest (".concat(t,") called with browser fallback")),n=Array.from(new Uint8Array(r)).reduce(function(e,t){return 31*e+t&4294967295},0),o=new Uint8Array(32),i=0;i<32;i++)o[i]=n>>8*i&255;return e.a(2,o.buffer)}},e)})),function(e,t){return f.apply(this,arguments)})}),!g){var b=function(e,t){return"string"==typeof e&&e.startsWith("node:")&&(e=e.replace(/^node:/,"")),new v(e,t)};void 0===p.domain&&(p.domain={create:function(){return{run:function(e){return e()},on:function(){},bind:function(e){return e}}}});var v=p.URL;b.prototype=v.prototype;try{Object.getOwnPropertyNames(v).forEach(function(e){if("prototype"!==e&&"constructor"!==e)try{b[e]=v[e]}catch(e){}})}catch(e){s.w9.warn(s.Ey.POLYFILLS,"Could not copy all URL static properties:",e)}try{p.URL=b}catch(e){s.w9.warn(s.Ey.POLYFILLS,"Could not override URL constructor:",e)}}void 0===p.module&&(p.module={exports:{}}),p.fs=p.fs||{readFileSync:function(e){throw s.w9.warn(s.Ey.POLYFILLS,"Attempted to readFileSync: ".concat(e)),new Error("fs.readFileSync is not available in this environment")},writeFileSync:function(e,t){s.w9.warn(s.Ey.POLYFILLS,"Attempted to writeFileSync: ".concat(e))},existsSync:function(e){return s.w9.warn(s.Ey.POLYFILLS,"Attempted to check if file exists: ".concat(e)),!1},promises:{readFile:(d=l(a().m(function e(t){return a().w(function(e){for(;;)switch(e.n){case 0:throw s.w9.warn(s.Ey.POLYFILLS,"Attempted to readFile: ".concat(t)),new Error("fs.promises.readFile is not available in this environment");case 1:return e.a(2)}},e)})),function(e){return d.apply(this,arguments)}),writeFile:(h=l(a().m(function e(t,r){return a().w(function(e){for(;;)switch(e.n){case 0:s.w9.warn(s.Ey.POLYFILLS,"Attempted to writeFile: ".concat(t));case 1:return e.a(2)}},e)})),function(e,t){return h.apply(this,arguments)})}},p.os=p.os||{tmpdir:function(){return"/tmp"},homedir:function(){return"/home/user"},platform:function(){return"browser"},type:function(){return"Browser"},cpus:function(){return[{model:"Browser CPU",speed:1e3}]},totalmem:function(){return 8589934592},freemem:function(){return 4294967296}},p.path=p.path||{join:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.join("/").replace(/\/+/g,"/")},resolve:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.join("/").replace(/\/+/g,"/")},dirname:function(e){return e.split("/").slice(0,-1).join("/")||"."},basename:function(e,t){var r=e.split("/").pop()||"";return t&&r.endsWith(t)&&(r=r.slice(0,-t.length)),r},extname:function(e){var t=e.split("/").pop()||"",r=t.lastIndexOf(".");return r<0?"":t.slice(r)},sep:"/"};n.hp,i()},573(e,t,r){"use strict";r.d(t,{c:()=>n});var n=function(e,t){var r;return{identifier:e.claim.identifier,claimData:e.claim,signatures:[o(e.signatures.claimSignature)],witnesses:[{id:e.signatures.attestorAddress,url:"ws://localhost:8001/ws"}],taskId:null,publicData:null!==(r=e.publicData)&&void 0!==r?r:null,providerRequest:t}},o=function(e){if(!e)return"";var t=Object.values(e).map(function(e){return e.toString(16).padStart(2,"0")}).join("");return"0x".concat(t)}},296(e,t,r){"use strict";r.r(t),r.d(t,{WebSocket:()=>p,default:()=>g});var n,o=r(153);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,u(n.key),n)}}function c(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==i(t)?t:t+""}function l(e,t,r){return t=h(t),function(e,t){if(t&&("object"==i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,f()?Reflect.construct(t,r||[],h(e).constructor):t.apply(e,r))}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}(e=r.hmd(e),"undefined"==typeof window)?(n=function(){return c(function e(t,r){var n=this;s(this,e),o.w9.info(o.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Creating mock WebSocket for background context"),this.url=t,this.protocols=r,this.readyState=3,setTimeout(function(){"function"==typeof n.onclose&&n.onclose({code:1e3,reason:"WebSockets not supported in background context"})},0)},[{key:"send",value:function(){throw o.w9.warn(o.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Cannot use WebSockets in background context"),new Error("WebSockets are not available in background context")}},{key:"close",value:function(){}},{key:"sendPromise",value:function(){return Promise.reject(new Error("WebSockets are not available in background context"))}},{key:"addEventListener",value:function(){}},{key:"removeEventListener",value:function(){}}])}(),o.w9.info(o.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Using mock WebSocket implementation for background context")):(n=function(e){function t(e,r){var n;return s(this,t),o.w9.info(o.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Creating WebSocket with URL:",e),(n=l(this,t,[e,r])).addEventListener("error",function(e){"function"==typeof n.onerror&&n.onerror(e)}),n.addEventListener("open",function(e){"function"==typeof n.onopen&&n.onopen(e)}),n.addEventListener("close",function(e){"function"==typeof n.onclose&&n.onclose(e)}),n.addEventListener("message",function(e){"function"==typeof n.onmessage&&n.onmessage(e)}),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(t,e),c(t,[{key:"sendPromise",value:function(e){var t=this;return new Promise(function(r,n){try{t.send(e),r()}catch(e){n(e)}})}}])}(window.WebSocket),o.w9.info(o.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Using browser WebSocket implementation"));var p=n;const g=n;e.exports&&(e.exports=n,e.exports.WebSocket=n,e.exports.default=n),o.w9.info(o.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] WebSocket polyfill initialized")}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={id:n,loaded:!1,exports:{}};return e[n](i,i.exports,r),i.loaded=!0,i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{ReclaimExtensionProofRequest:()=>ws,default:()=>_s,joclaimExtensionSDK:()=>Ts});var e={};r.r(e),r.d(e,{OG:()=>Me,My:()=>Pe,Ph:()=>Ue,lX:()=>xe,Id:()=>Be,fg:()=>Ve,qj:()=>ke,aT:()=>De,lq:()=>Ge,z:()=>Fe,Q5:()=>He});r(997);function t(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function o(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function i(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");t(e.outputLen),t(e.blockLen)}function s(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function a(e,t){o(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}const c=BigInt(2**32-1),u=BigInt(32);function l(e,t=!1){return t?{h:Number(e&c),l:Number(e>>u&c)}:{h:0|Number(e>>u&c),l:0|Number(e&c)}}function f(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:i,l:s}=l(e[o],t);[r[o],n[o]]=[i,s]}return[r,n]}const h=(e,t,r)=>e<<r|t>>>32-r,d=(e,t,r)=>t<<r|e>>>32-r,p=(e,t,r)=>t<<r-32|e>>>64-r,g=(e,t,r)=>e<<r-32|t>>>64-r;const y={fromBig:l,split:f,toBig:(e,t)=>BigInt(e>>>0)<<u|BigInt(t>>>0),shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:h,rotlSL:d,rotlBH:p,rotlBL:g,add:function(e,t,r,n){const o=(t>>>0)+(n>>>0);return{h:e+r+(o/2**32|0)|0,l:0|o}},add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,o)=>t+r+n+o+(e/2**32|0)|0,add5H:(e,t,r,n,o,i)=>t+r+n+o+i+(e/2**32|0)|0,add5L:(e,t,r,n,o)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(o>>>0)},m="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,E=e=>e instanceof Uint8Array,b=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),v=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),O=(e,t)=>e<<32-t|e>>>t;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");const I=async()=>{};async function A(e,t,r){let n=Date.now();for(let o=0;o<e;o++){r(o);const e=Date.now()-n;e>=0&&e<t||(await I(),n+=e)}}function S(e){if("string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),!E(e))throw new Error("expected Uint8Array, got "+typeof e);return e}class w{clone(){return this._cloneInto()}}const R={}.toString;function T(e,t){if(void 0!==t&&"[object Object]"!==R.call(t))throw new Error("Options should be object or undefined");return Object.assign(e,t)}function _(e){const t=t=>e().update(S(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function N(e=32){if(m&&"function"==typeof m.getRandomValues)return m.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}const[C,P,L]=[[],[],[]],D=BigInt(0),U=BigInt(1),x=BigInt(2),G=BigInt(7),F=BigInt(256),k=BigInt(113);for(let e=0,t=U,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],C.push(2*(5*n+r)),P.push((e+1)*(e+2)/2%64);let o=D;for(let e=0;e<7;e++)t=(t<<U^(t>>G)*k)%F,t&x&&(o^=U<<(U<<BigInt(e))-U);L.push(o)}const[B,M]=f(L,!0),j=(e,t,r)=>r>32?p(e,t,r):h(e,t,r),K=(e,t,r)=>r>32?g(e,t,r):d(e,t,r);class V extends w{constructor(e,r,n,o=!1,i=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=o,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,t(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=b(this.state)}keccak(){!function(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,o=(t+2)%10,i=r[o],s=r[o+1],a=j(i,s,1)^r[n],c=K(i,s,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],o=e[3];for(let r=0;r<24;r++){const n=P[r],i=j(t,o,n),s=K(t,o,n),a=C[r];t=e[a],o=e[a+1],e[a]=i,e[a+1]=s}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=B[n],e[1]^=M[n]}r.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){s(this);const{blockLen:t,state:r}=this,n=(e=S(e)).length;for(let o=0;o<n;){const i=Math.min(t-this.pos,n-o);for(let t=0;t<i;t++)r[this.pos++]^=e[o++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,128&t&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){s(this,!1),o(e),this.finish();const t=this.state,{blockLen:r}=this;for(let n=0,o=e.length;n<o;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,o-n);e.set(t.subarray(this.posOut,this.posOut+i),n),this.posOut+=i,n+=i}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return t(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(a(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:n,rounds:o,enableXOF:i}=this;return e||(e=new V(t,r,n,i,o)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=o,e.suffix=r,e.outputLen=n,e.enableXOF=i,e.destroyed=this.destroyed,e}}const $=(e,t,r)=>_(()=>new V(t,e,r)),H=$(1,136,32),Y="6.16.0";function q(e,t,r){const n=t.split("|").map(e=>e.trim());for(let r=0;r<n.length;r++)switch(t){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof e===t)return}const o=new Error(`invalid value for type ${t}`);throw o.code="INVALID_ARGUMENT",o.argument=`value.${r}`,o.value=e,o}async function z(e){const t=Object.keys(e);return(await Promise.all(t.map(t=>Promise.resolve(e[t])))).reduce((e,r,n)=>(e[t[n]]=r,e),{})}function W(e,t,r){for(let n in t){let o=t[n];const i=r?r[n]:null;i&&q(o,i,n),Object.defineProperty(e,n,{enumerable:!0,value:o,writable:!1})}}function J(e,t){if(null==e)return"null";if(null==t&&(t=new Set),"object"==typeof e){if(t.has(e))return"[Circular]";t.add(e)}if(Array.isArray(e))return"[ "+e.map(e=>J(e,t)).join(", ")+" ]";if(e instanceof Uint8Array){const t="0123456789abcdef";let r="0x";for(let n=0;n<e.length;n++)r+=t[e[n]>>4],r+=t[15&e[n]];return r}if("object"==typeof e&&"function"==typeof e.toJSON)return J(e.toJSON(),t);switch(typeof e){case"boolean":case"number":case"symbol":return e.toString();case"bigint":return BigInt(e).toString();case"string":return JSON.stringify(e);case"object":{const r=Object.keys(e);return r.sort(),"{ "+r.map(r=>`${J(r,t)}: ${J(e[r],t)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function X(e,t,r){let n,o=e;{const n=[];if(r){if("message"in r||"code"in r||"name"in r)throw new Error(`value will overwrite populated values: ${J(r)}`);for(const e in r){if("shortMessage"===e)continue;const t=r[e];n.push(e+"="+J(t))}}n.push(`code=${t}`),n.push(`version=${Y}`),n.length&&(e+=" ("+n.join(", ")+")")}switch(t){case"INVALID_ARGUMENT":n=new TypeError(e);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":n=new RangeError(e);break;default:n=new Error(e)}return W(n,{code:t}),r&&Object.assign(n,r),null==n.shortMessage&&W(n,{shortMessage:o}),n}function Q(e,t,r,n){if(!e)throw X(t,r,n)}function Z(e,t,r,n){Q(e,t,"INVALID_ARGUMENT",{argument:r,value:n})}const ee=["NFD","NFC","NFKD","NFKC"].reduce((e,t)=>{try{if("test"!=="test".normalize(t))throw new Error("bad");if("NFD"===t){const e=String.fromCharCode(233).normalize("NFD");if(e!==String.fromCharCode(101,769))throw new Error("broken")}e.push(t)}catch(e){}return e},[]);function te(e){Q(ee.indexOf(e)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:e}})}function re(e,t,r){if(null==r&&(r=""),e!==t){let e=r,t="new";r&&(e+=".",t+=" "+r),Q(!1,`private constructor; use ${e}from* methods`,"UNSUPPORTED_OPERATION",{operation:t})}}function ne(e,t,r){if(e instanceof Uint8Array)return r?new Uint8Array(e):e;if("string"==typeof e&&e.length%2==0&&e.match(/^0x[0-9a-f]*$/i)){const t=new Uint8Array((e.length-2)/2);let r=2;for(let n=0;n<t.length;n++)t[n]=parseInt(e.substring(r,r+2),16),r+=2;return t}Z(!1,"invalid BytesLike value",t||"value",e)}function oe(e,t){return ne(e,t,!1)}function ie(e,t){return ne(e,t,!0)}function se(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(("number"!=typeof t||e.length===2+2*t)&&(!0!==t||e.length%2==0))}function ae(e){return se(e,!0)||e instanceof Uint8Array}const ce="0123456789abcdef";function ue(e){const t=oe(e);let r="0x";for(let e=0;e<t.length;e++){const n=t[e];r+=ce[(240&n)>>4]+ce[15&n]}return r}function le(e){return"0x"+e.map(e=>ue(e).substring(2)).join("")}function fe(e){return se(e,!0)?(e.length-2)/2:oe(e).length}function he(e,t,r){const n=oe(e);return null!=r&&r>n.length&&Q(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r}),ue(n.slice(null==t?0:t,null==r?n.length:r))}function de(e,t,r){const n=oe(e);Q(t>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:t,offset:t+1});const o=new Uint8Array(t);return o.fill(0),r?o.set(n,t-n.length):o.set(n,0),ue(o)}function pe(e,t){return de(e,t,!0)}let ge=!1;const ye=function(e){return H(e)};let me=ye;function Ee(e){const t=oe(e,"data");return ue(me(t))}Ee._=ye,Ee.lock=function(){ge=!0},Ee.register=function(e){if(ge)throw new TypeError("keccak256 is locked");me=e},Object.freeze(Ee);class be extends w{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=v(this.buffer)}update(e){s(this);const{view:t,buffer:r,blockLen:n}=this,o=(e=S(e)).length;for(let i=0;i<o;){const s=Math.min(n-this.pos,o-i);if(s===n){const t=v(e);for(;n<=o-i;i+=n)this.process(t,i);continue}r.set(e.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){s(this),a(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:o}=this;let{pos:i}=this;t[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>n-i&&(this.process(r,0),i=0);for(let e=i;e<n;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const o=BigInt(32),i=BigInt(4294967295),s=Number(r>>o&i),a=Number(r&i),c=n?4:0,u=n?0:4;e.setUint32(t+c,s,n),e.setUint32(t+u,a,n)}(r,n-8,BigInt(8*this.length),o),this.process(r,0);const c=v(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=u/4,f=this.get();if(l>f.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<l;e++)c.setUint32(4*e,f[e],o)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:o,destroyed:i,pos:s}=this;return e.length=n,e.pos=s,e.finished=o,e.destroyed=i,n%t&&e.buffer.set(r),e}}const ve=(e,t,r)=>e&t^~e&r,Oe=(e,t,r)=>e&t^e&r^t&r,Ie=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ae=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Se=new Uint32Array(64);class we extends be{constructor(){super(64,32,8,!1),this.A=0|Ae[0],this.B=0|Ae[1],this.C=0|Ae[2],this.D=0|Ae[3],this.E=0|Ae[4],this.F=0|Ae[5],this.G=0|Ae[6],this.H=0|Ae[7]}get(){const{A:e,B:t,C:r,D:n,E:o,F:i,G:s,H:a}=this;return[e,t,r,n,o,i,s,a]}set(e,t,r,n,o,i,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)Se[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=Se[e-15],r=Se[e-2],n=O(t,7)^O(t,18)^t>>>3,o=O(r,17)^O(r,19)^r>>>10;Se[e]=o+Se[e-7]+n+Se[e-16]|0}let{A:r,B:n,C:o,D:i,E:s,F:a,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+(O(s,6)^O(s,11)^O(s,25))+ve(s,a,c)+Ie[e]+Se[e]|0,l=(O(r,2)^O(r,13)^O(r,22))+Oe(r,n,o)|0;u=c,c=a,a=s,s=i+t|0,i=o,o=n,n=r,r=t+l|0}r=r+this.A|0,n=n+this.B|0,o=o+this.C|0,i=i+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,n,o,i,s,a,c,u)}roundClean(){Se.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Re=_(()=>new we),Te=(BigInt(0),BigInt(1)),_e=BigInt(2),Ne=e=>e instanceof Uint8Array,Ce=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Pe(e){if(!Ne(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=Ce[e[r]];return t}function Le(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}function De(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(t/2);for(let t=0;t<r.length;t++){const n=2*t,o=e.slice(n,n+2),i=Number.parseInt(o,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");r[t]=i}return r}function Ue(e){return Le(Pe(e))}function xe(e){if(!Ne(e))throw new Error("Uint8Array expected");return Le(Pe(Uint8Array.from(e).reverse()))}function Ge(e,t){return De(e.toString(16).padStart(2*t,"0"))}function Fe(e,t){return Ge(e,t).reverse()}function ke(e,t,r){let n;if("string"==typeof t)try{n=De(t)}catch(r){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${r}`)}else{if(!Ne(t))throw new Error(`${e} must be hex string or Uint8Array`);n=Uint8Array.from(t)}const o=n.length;if("number"==typeof r&&o!==r)throw new Error(`${e} expected ${r} bytes, got ${o}`);return n}function Be(...e){const t=new Uint8Array(e.reduce((e,t)=>e+t.length,0));let r=0;return e.forEach(e=>{if(!Ne(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length}),t}const Me=e=>(_e<<BigInt(e-1))-Te,je=e=>new Uint8Array(e),Ke=e=>Uint8Array.from(e);function Ve(e,t,r){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");let n=je(e),o=je(e),i=0;const s=()=>{n.fill(1),o.fill(0),i=0},a=(...e)=>r(o,n,...e),c=(e=je())=>{o=a(Ke([0]),e),n=a(),0!==e.length&&(o=a(Ke([1]),e),n=a())},u=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e<t;){n=a();const t=n.slice();r.push(t),e+=n.length}return Be(...r)};return(e,t)=>{let r;for(s(),c(e);!(r=t(u()));)c();return s(),r}}const $e={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function He(e,t,r={}){const n=(t,r,n)=>{const o=$e[r];if("function"!=typeof o)throw new Error(`Invalid validator "${r}", expected function`);const i=e[t];if(!(n&&void 0===i||o(i,e)))throw new Error(`Invalid param ${String(t)}=${i} (${typeof i}), expected ${r}`)};for(const[e,r]of Object.entries(t))n(e,r,!1);for(const[e,t]of Object.entries(r))n(e,t,!0);return e}
|
|
11
11
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
12
12
|
const Ye=BigInt(0),qe=BigInt(1),ze=BigInt(2),We=BigInt(3),Je=BigInt(4),Xe=BigInt(5),Qe=BigInt(8);BigInt(9),BigInt(16);function Ze(e,t){const r=e%t;return r>=Ye?r:t+r}function et(e,t,r){if(r<=Ye||t<Ye)throw new Error("Expected power/modulo > 0");if(r===qe)return Ye;let n=qe;for(;t>Ye;)t&qe&&(n=n*e%r),e=e*e%r,t>>=qe;return n}function tt(e,t,r){let n=e;for(;t-- >Ye;)n*=n,n%=r;return n}function rt(e,t){if(e===Ye||t<=Ye)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=Ze(e,t),n=t,o=Ye,i=qe,s=qe,a=Ye;for(;r!==Ye;){const e=n/r,t=n%r,c=o-s*e,u=i-a*e;n=r,r=t,o=s,i=a,s=c,a=u}if(n!==qe)throw new Error("invert: does not exist");return Ze(o,t)}function nt(e){if(e%Je===We){const t=(e+qe)/Je;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}if(e%Qe===Xe){const t=(e-Xe)/Qe;return function(e,r){const n=e.mul(r,ze),o=e.pow(n,t),i=e.mul(r,o),s=e.mul(e.mul(i,ze),o),a=e.mul(i,e.sub(s,e.ONE));if(!e.eql(e.sqr(a),r))throw new Error("Cannot find square root");return a}}return function(e){const t=(e-qe)/ze;let r,n,o;for(r=e-qe,n=0;r%ze===Ye;r/=ze,n++);for(o=ze;o<e&&et(o,t,e)!==e-qe;o++);if(1===n){const t=(e+qe)/Je;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}const i=(r+qe)/ze;return function(e,s){if(e.pow(s,t)===e.neg(e.ONE))throw new Error("Cannot find square root");let a=n,c=e.pow(e.mul(e.ONE,o),r),u=e.pow(s,i),l=e.pow(s,r);for(;!e.eql(l,e.ONE);){if(e.eql(l,e.ZERO))return e.ZERO;let t=1;for(let r=e.sqr(l);t<a&&!e.eql(r,e.ONE);t++)r=e.sqr(r);const r=e.pow(c,qe<<BigInt(a-t-1));c=e.sqr(r),u=e.mul(u,r),l=e.mul(l,c),a=t}return u}}(e)}const ot=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function it(e,t){const r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function st(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function at(e){const t=st(e);return t+Math.ceil(t/2)}class ct extends w{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,i(e);const r=S(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const n=this.blockLen,o=new Uint8Array(n);o.set(r.length>n?e.create().update(r).digest():r);for(let e=0;e<o.length;e++)o[e]^=54;this.iHash.update(o),this.oHash=e.create();for(let e=0;e<o.length;e++)o[e]^=106;this.oHash.update(o),o.fill(0)}update(e){return s(this),this.iHash.update(e),this}digestInto(e){s(this),o(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:n,destroyed:o,blockLen:i,outputLen:s}=this;return e.finished=n,e.destroyed=o,e.blockLen=i,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const ut=(e,t,r)=>new ct(e,t).update(r).digest();ut.create=(e,t)=>new ct(e,t);
|
|
13
13
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
@@ -19,5 +19,5 @@ function Ot(e){return{hash:e,hmac:(t,...r)=>ut(e,t,function(...e){const t=new Ui
|
|
|
19
19
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
20
20
|
const It=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),At=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),St=BigInt(1),wt=BigInt(2),Rt=(e,t)=>(e+t/wt)/t;function Tt(e){const t=It,r=BigInt(3),n=BigInt(6),o=BigInt(11),i=BigInt(22),s=BigInt(23),a=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,f=tt(l,r,t)*l%t,h=tt(f,r,t)*l%t,d=tt(h,wt,t)*u%t,p=tt(d,o,t)*d%t,g=tt(p,i,t)*p%t,y=tt(g,a,t)*g%t,m=tt(y,c,t)*y%t,E=tt(m,a,t)*g%t,b=tt(E,r,t)*l%t,v=tt(b,s,t)*p%t,O=tt(v,n,t)*u%t,I=tt(O,wt,t);if(!_t.eql(_t.sqr(I),e))throw new Error("Cannot find square root");return I}const _t=function(e,t,r=!1,n={}){if(e<=Ye)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:o,nByteLength:i}=it(e,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=nt(e),a=Object.freeze({ORDER:e,BITS:o,BYTES:i,MASK:Me(o),ZERO:Ye,ONE:qe,create:t=>Ze(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return Ye<=t&&t<e},is0:e=>e===Ye,isOdd:e=>(e&qe)===qe,neg:t=>Ze(-t,e),eql:(e,t)=>e===t,sqr:t=>Ze(t*t,e),add:(t,r)=>Ze(t+r,e),sub:(t,r)=>Ze(t-r,e),mul:(t,r)=>Ze(t*r,e),pow:(e,t)=>function(e,t,r){if(r<Ye)throw new Error("Expected power > 0");if(r===Ye)return e.ONE;if(r===qe)return t;let n=e.ONE,o=t;for(;r>Ye;)r&qe&&(n=e.mul(n,o)),o=e.sqr(o),r>>=qe;return n}(a,e,t),div:(t,r)=>Ze(t*rt(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>rt(t,e),sqrt:n.sqrt||(e=>s(a,e)),invertBatch:e=>function(e,t){const r=new Array(t.length),n=t.reduce((t,n,o)=>e.is0(n)?t:(r[o]=t,e.mul(t,n)),e.ONE),o=e.inv(n);return t.reduceRight((t,n,o)=>e.is0(n)?t:(r[o]=e.mul(t,r[o]),e.mul(t,n)),o),r}(a,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?Fe(e,i):Ge(e,i),fromBytes:e=>{if(e.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${e.length}`);return r?xe(e):Ue(e)}});return Object.freeze(a)}(It,void 0,void 0,{sqrt:Tt}),Nt=function(e,t){const r=t=>vt({...e,...Ot(t)});return Object.freeze({...r(t),create:r})}({a:BigInt(0),b:BigInt(7),Fp:_t,n:At,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=At,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-St*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=r,s=BigInt("0x100000000000000000000000000000000"),a=Rt(i*e,t),c=Rt(-n*e,t);let u=Ze(e-a*r-c*o,t),l=Ze(-a*n-c*i,t);const f=u>s,h=l>s;if(f&&(u=t-u),h&&(l=t-l),u>s||l>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:u,k2neg:h,k2:l}}}},Re);BigInt(0);Nt.ProjectivePoint;const Ct=BigInt(0),Pt=BigInt(1),Lt=9007199254740991;function Dt(e,t){switch(typeof e){case"bigint":return e;case"number":return Z(Number.isInteger(e),"underflow",t||"value",e),Z(e>=-Lt&&e<=Lt,"overflow",t||"value",e),BigInt(e);case"string":try{if(""===e)throw new Error("empty string");return"-"===e[0]&&"-"!==e[1]?-BigInt(e.substring(1)):BigInt(e)}catch(r){Z(!1,`invalid BigNumberish string: ${r.message}`,t||"value",e)}}Z(!1,"invalid BigNumberish value",t||"value",e)}function Ut(e,t){const r=Dt(e,t);return Q(r>=Ct,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:e}),r}const xt="0123456789abcdef";function Gt(e){if(e instanceof Uint8Array){let t="0x0";for(const r of e)t+=xt[r>>4],t+=xt[15&r];return BigInt(t)}return Dt(e)}function Ft(e,t){switch(typeof e){case"bigint":return Z(e>=-Lt&&e<=Lt,"overflow",t||"value",e),Number(e);case"number":return Z(Number.isInteger(e),"underflow",t||"value",e),Z(e>=-Lt&&e<=Lt,"overflow",t||"value",e),e;case"string":try{if(""===e)throw new Error("empty string");return Ft(BigInt(e),t)}catch(r){Z(!1,`invalid numeric string: ${r.message}`,t||"value",e)}}Z(!1,"invalid numeric value",t||"value",e)}function kt(e,t){const r=Ut(e,"value");let n=r.toString(16);if(null==t)n.length%2&&(n="0"+n);else{const o=Ft(t,"width");if(0===o&&r===Ct)return"0x";for(Q(2*o>=n.length,`value exceeds width (${o} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:e});n.length<2*o;)n="0"+n}return"0x"+n}function Bt(e,t){const r=Ut(e,"value");if(r===Ct){const e=null!=t?Ft(t,"width"):0;return new Uint8Array(e)}let n=r.toString(16);if(n.length%2&&(n="0"+n),null!=t){const r=Ft(t,"width");for(;n.length<2*r;)n="00"+n;Q(2*r===n.length,`value exceeds width (${r} bytes)`,"NUMERIC_FAULT",{operation:"toBeArray",fault:"overflow",value:e})}const o=new Uint8Array(n.length/2);for(let e=0;e<o.length;e++){const t=2*e;o[e]=parseInt(n.substring(t,t+2),16)}return o}const Mt="0x0000000000000000000000000000000000000000000000000000000000000000",jt=BigInt(0),Kt=BigInt(1),Vt=BigInt(2),$t=BigInt(27),Ht=BigInt(28),Yt=BigInt(35),qt=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),zt=qt/Vt,Wt=Symbol.for("nodejs.util.inspect.custom"),Jt={};function Xt(e){return pe(Bt(e),32)}class Qt{#e;#t;#r;#n;get r(){return this.#e}set r(e){Z(32===fe(e),"invalid r","value",e),this.#e=ue(e)}get s(){return Z(parseInt(this.#t.substring(0,3))<8,"non-canonical s; use ._s","s",this.#t),this.#t}set s(e){Z(32===fe(e),"invalid s","value",e),this.#t=ue(e)}get _s(){return this.#t}isValid(){return BigInt(this.#t)<=zt}get v(){return this.#r}set v(e){const t=Ft(e,"value");Z(27===t||28===t,"invalid v","v",e),this.#r=t}get networkV(){return this.#n}get legacyChainId(){const e=this.networkV;return null==e?null:Qt.getChainId(e)}get yParity(){return 27===this.v?0:1}get yParityAndS(){const e=oe(this.s);return this.yParity&&(e[0]|=128),ue(e)}get compactSerialized(){return le([this.r,this.yParityAndS])}get serialized(){return le([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(e,t,r,n){re(e,Jt,"Signature"),this.#e=t,this.#t=r,this.#r=n,this.#n=null}getCanonical(){if(this.isValid())return this;const e=qt-BigInt(this._s),t=55-this.v,r=new Qt(Jt,this.r,Xt(e),t);return this.networkV&&(r.#n=this.networkV),r}clone(){const e=new Qt(Jt,this.r,this._s,this.v);return this.networkV&&(e.#n=this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:null!=e?e.toString():null,r:this.r,s:this._s,v:this.v}}[Wt](){return this.toString()}toString(){return this.isValid()?`Signature { r: ${this.r}, s: ${this._s}, v: ${this.v} }`:`Signature { r: ${this.r}, s: ${this._s}, v: ${this.v}, valid: false }`}static getChainId(e){const t=Dt(e,"v");return t==$t||t==Ht?jt:(Z(t>=Yt,"invalid EIP-155 v","v",e),(t-Yt)/Vt)}static getChainIdV(e,t){return Dt(e)*Vt+BigInt(35+t-27)}static getNormalizedV(e){const t=Dt(e);return t===jt||t===$t?27:t===Kt||t===Ht?28:(Z(t>=Yt,"invalid v","v",e),t&Kt?27:28)}static from(e){function t(t,r){Z(t,r,"signature",e)}if(null==e)return new Qt(Jt,Mt,Mt,27);if("string"==typeof e){const r=oe(e,"signature");if(64===r.length){const e=ue(r.slice(0,32)),t=r.slice(32,64),n=128&t[0]?28:27;return t[0]&=127,new Qt(Jt,e,ue(t),n)}if(65===r.length){const e=ue(r.slice(0,32)),t=ue(r.slice(32,64)),n=Qt.getNormalizedV(r[64]);return new Qt(Jt,e,t,n)}t(!1,"invalid raw signature length")}if(e instanceof Qt)return e.clone();const r=e.r;t(null!=r,"missing r");const n=Xt(r),o=function(e,r){if(null!=e)return Xt(e);if(null!=r){t(se(r,32),"invalid yParityAndS");const e=oe(r);return e[0]&=127,ue(e)}t(!1,"missing s")}(e.s,e.yParityAndS),{networkV:i,v:s}=function(e,r,n){if(null!=e){const t=Dt(e);return{networkV:t>=Yt?t:void 0,v:Qt.getNormalizedV(t)}}if(null!=r)return t(se(r,32),"invalid yParityAndS"),{v:128&oe(r)[0]?28:27};if(null!=n){switch(Ft(n,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}t(!1,"invalid yParity")}t(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),a=new Qt(Jt,n,o,s);return i&&(a.#n=i),t(null==e.yParity||Ft(e.yParity,"sig.yParity")===a.yParity,"yParity mismatch"),t(null==e.yParityAndS||e.yParityAndS===a.yParityAndS,"yParityAndS mismatch"),a}}class Zt{#o;constructor(e){Z(32===fe(e),"invalid private key","privateKey","[REDACTED]"),this.#o=ue(e)}get privateKey(){return this.#o}get publicKey(){return Zt.computePublicKey(this.#o)}get compressedPublicKey(){return Zt.computePublicKey(this.#o,!0)}sign(e){Z(32===fe(e),"invalid digest length","digest",e);const t=Nt.sign(ie(e),ie(this.#o),{lowS:!0});return Qt.from({r:kt(t.r,32),s:kt(t.s,32),v:t.recovery?28:27})}computeSharedSecret(e){const t=Zt.computePublicKey(e);return ue(Nt.getSharedSecret(ie(this.#o),oe(t),!1))}static computePublicKey(e,t){let r=oe(e,"key");if(32===r.length){return ue(Nt.getPublicKey(r,!!t))}if(64===r.length){const e=new Uint8Array(65);e[0]=4,e.set(r,1),r=e}return ue(Nt.ProjectivePoint.fromHex(r).toRawBytes(t))}static recoverPublicKey(e,t){Z(32===fe(e),"invalid digest length","digest",e);const r=Qt.from(t);let n=Nt.Signature.fromCompact(ie(le([r.r,r.s])));n=n.addRecoveryBit(r.yParity);const o=n.recoverPublicKey(ie(e));return Z(null!=o,"invalid signature for digest","signature",t),"0x"+o.toHex(!1)}static addPoints(e,t,r){const n=Nt.ProjectivePoint.fromHex(Zt.computePublicKey(e).substring(2)),o=Nt.ProjectivePoint.fromHex(Zt.computePublicKey(t).substring(2));return"0x"+n.add(o).toHex(!!r)}}const er=BigInt(0),tr=BigInt(36);function rr(e){const t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let e=0;e<40;e++)r[e]=t[e].charCodeAt(0);const n=oe(Ee(r));for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&(t[e]=t[e].toUpperCase()),(15&n[e>>1])>=8&&(t[e+1]=t[e+1].toUpperCase());return"0x"+t.join("")}const nr={};for(let e=0;e<10;e++)nr[String(e)]=String(e);for(let e=0;e<26;e++)nr[String.fromCharCode(65+e)]=String(10+e);function or(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map(e=>nr[e]).join("");for(;t.length>=15;){let e=t.substring(0,15);t=parseInt(e,10)%97+t.substring(e.length)}let r=String(98-parseInt(t,10)%97);for(;r.length<2;)r="0"+r;return r}const ir=function(){const e={};for(let t=0;t<36;t++){e["0123456789abcdefghijklmnopqrstuvwxyz"[t]]=BigInt(t)}return e}();function sr(e){if(Z("string"==typeof e,"invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/)){e.startsWith("0x")||(e="0x"+e);const t=rr(e);return Z(!e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||t===e,"bad address checksum","address",e),t}if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){Z(e.substring(2,4)===or(e),"bad icap checksum","address",e);let t=function(e){e=e.toLowerCase();let t=er;for(let r=0;r<e.length;r++)t=t*tr+ir[e[r]];return t}(e.substring(4)).toString(16);for(;t.length<40;)t="0"+t;return rr("0x"+t)}Z(!1,"invalid address","address",e)}async function ar(e,t){const r=await t;return null!=r&&"0x0000000000000000000000000000000000000000"!==r||(Q("string"!=typeof e,"unconfigured name","UNCONFIGURED_NAME",{value:e}),Z(!1,"invalid AddressLike value; did not resolve to a value address","target",e)),sr(r)}function cr(e,t){return"string"==typeof e?e.match(/^0x[0-9a-f]{40}$/i)?sr(e):(Q(null!=t,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),ar(e,t.resolveName(e))):(r=e)&&"function"==typeof r.getAddress?ar(e,e.getAddress()):e&&"function"==typeof e.then?ar(e,e):void Z(!1,"unsupported addressable value","target",e);var r}function ur(e,t,r,n,o){if("BAD_PREFIX"===e||"UNEXPECTED_CONTINUE"===e){let e=0;for(let n=t+1;n<r.length&&r[n]>>6==2;n++)e++;return e}return"OVERRUN"===e?r.length-t-1:0}Object.freeze({error:function(e,t,r,n,o){Z(!1,`invalid codepoint at offset ${t}; ${e}`,"bytes",r)},ignore:ur,replace:function(e,t,r,n,o){return"OVERLONG"===e?(Z("number"==typeof o,"invalid bad code point for replacement","badCodepoint",o),n.push(o),0):(n.push(65533),ur(e,t,r))}});function lr(e,t){Z("string"==typeof e,"invalid string value","str",e),null!=t&&(te(t),e=e.normalize(t));let r=[];for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){t++;const o=e.charCodeAt(t);Z(t<e.length&&56320==(64512&o),"invalid surrogate pair","str",e);const i=65536+((1023&n)<<10)+(1023&o);r.push(i>>18|240),r.push(i>>12&63|128),r.push(i>>6&63|128),r.push(63&i|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return new Uint8Array(r)}function fr(e){return"string"==typeof e&&(e=lr(e)),Ee(le([lr("Ethereum Signed Message:\n"),lr(String(e.length)),e]))}function hr(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function dr(e){if(Array.isArray(e)){let t=[];if(e.forEach(function(e){t=t.concat(dr(e))}),t.length<=55)return t.unshift(192+t.length),t;const r=hr(t.length);return r.unshift(247+r.length),r.concat(t)}const t=Array.prototype.slice.call(oe(e,"object"));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const r=hr(t.length);return r.unshift(183+r.length),r.concat(t)}const pr="0123456789abcdef";function gr(e){let t="0x";for(const r of dr(e))t+=pr[r>>4],t+=pr[15&r];return t}function yr(e){return Z("string"==typeof e.address,"invalid address for hashAuthorization","auth.address",e),Ee(le(["0x05",gr([null!=e.chainId?Bt(e.chainId):"0x",sr(e.address),null!=e.nonce?Bt(e.nonce):"0x"])]))}function mr(e){return Ee(lr(e))}const Er=new Uint8Array(32);Er.fill(0);const br=BigInt(-1),vr=BigInt(0),Or=BigInt(1),Ir=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Ar=kt(Or,32),Sr=kt(vr,32),wr={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Rr=["name","version","chainId","verifyingContract","salt"];function Tr(e){return function(t){return Z("string"==typeof t,`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const _r={name:Tr("name"),version:Tr("version"),chainId:function(e){const t=Dt(e,"domain.chainId");return Z(t>=0,"invalid chain ID","domain.chainId",e),Number.isSafeInteger(t)?Number(t):function(e){let t=ue(ae(e)?e:Bt(e)).substring(2);for(;t.startsWith("0");)t=t.substring(1);return""===t&&(t="0"),"0x"+t}(t)},verifyingContract:function(e){try{return sr(e).toLowerCase()}catch(e){}Z(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){const t=oe(e,"domain.salt");return Z(32===t.length,'invalid domain value "salt"',"domain.salt",e),ue(t)}};function Nr(e){{const t=e.match(/^(u?)int(\d+)$/);if(t){const r=""===t[1],n=parseInt(t[2]);Z(n%8==0&&0!==n&&n<=256&&t[2]===String(n),"invalid numeric width","type",e);const o=function(e,t){const r=Ut(e,"value"),n=BigInt(Ft(t,"bits"));return r&(Pt<<n)-Pt}(Ir,r?n-1:n),i=r?(o+Or)*br:vr;return function(t){const n=Dt(t,"value");return Z(n>=i&&n<=o,`value out-of-bounds for ${e}`,"value",n),kt(r?function(e,t){let r=Dt(e,"value");const n=BigInt(Ft(t,"width")),o=Pt<<n-Pt;if(r<Ct)return r=-r,Q(r<=o,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:e}),(~r&(Pt<<n)-Pt)+Pt;return Q(r<o,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:e}),r}(n,256):n,32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return Z(0!==r&&r<=32&&t[1]===String(r),"invalid bytes width","type",e),function(t){return Z(oe(t).length===r,`invalid length for ${e}`,"value",t),function(e){const t=oe(e),r=t.length%32;return r?le([t,Er.slice(r)]):ue(t)}(t)}}}switch(e){case"address":return function(e){return pe(sr(e),32)};case"bool":return function(e){return e?Ar:Sr};case"bytes":return function(e){return Ee(e)};case"string":return function(e){return mr(e)}}return null}function Cr(e,t){return`${e}(${t.map(({name:e,type:t})=>t+" "+e).join(",")})`}function Pr(e){const t=e.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return t?{base:t[1],index:t[2]+t[4],array:{base:t[1],prefix:t[1]+t[2],count:t[5]?parseInt(t[5]):-1}}:{base:e}}class Lr{primaryType;#i;get types(){return JSON.parse(this.#i)}#s;#a;constructor(e){this.#s=new Map,this.#a=new Map;const t=new Map,r=new Map,n=new Map,o={};Object.keys(e).forEach(i=>{o[i]=e[i].map(({name:t,type:r})=>{let{base:n,index:o}=Pr(r);return"int"!==n||e.int||(n="int256"),"uint"!==n||e.uint||(n="uint256"),{name:t,type:n+(o||"")}}),t.set(i,new Set),r.set(i,[]),n.set(i,new Set)}),this.#i=JSON.stringify(o);for(const n in o){const i=new Set;for(const s of o[n]){Z(!i.has(s.name),`duplicate variable name ${JSON.stringify(s.name)} in ${JSON.stringify(n)}`,"types",e),i.add(s.name);const o=Pr(s.type).base;Z(o!==n,`circular type reference to ${JSON.stringify(o)}`,"types",e);Nr(o)||(Z(r.has(o),`unknown type ${JSON.stringify(o)}`,"types",e),r.get(o).push(n),t.get(n).add(o))}}const i=Array.from(r.keys()).filter(e=>0===r.get(e).length);Z(0!==i.length,"missing primary type","types",e),Z(1===i.length,`ambiguous primary types or unused types: ${i.map(e=>JSON.stringify(e)).join(", ")}`,"types",e),W(this,{primaryType:i[0]}),function o(i,s){Z(!s.has(i),`circular type reference to ${JSON.stringify(i)}`,"types",e),s.add(i);for(const e of t.get(i))if(r.has(e)){o(e,s);for(const t of s)n.get(t).add(e)}s.delete(i)}(this.primaryType,new Set);for(const[e,t]of n){const r=Array.from(t);r.sort(),this.#s.set(e,Cr(e,o[e])+r.map(e=>Cr(e,o[e])).join(""))}}getEncoder(e){let t=this.#a.get(e);return t||(t=this.#c(e),this.#a.set(e,t)),t}#c(e){{const t=Nr(e);if(t)return t}const t=Pr(e).array;if(t){const e=t.prefix,r=this.getEncoder(e);return n=>{Z(-1===t.count||t.count===n.length,`array length mismatch; expected length ${t.count}`,"value",n);let o=n.map(r);return this.#s.has(e)&&(o=o.map(Ee)),Ee(le(o))}}const r=this.types[e];if(r){const t=mr(this.#s.get(e));return e=>{const n=r.map(({name:t,type:r})=>{const n=this.getEncoder(r)(e[t]);return this.#s.has(r)?Ee(n):n});return n.unshift(t),le(n)}}Z(!1,`unknown type: ${e}`,"type",e)}encodeType(e){const t=this.#s.get(e);return Z(t,`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return Ee(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(Nr(e))return r(e,t);const n=Pr(e).array;if(n)return Z(-1===n.count||n.count===t.length,`array length mismatch; expected length ${n.count}`,"value",t),t.map(e=>this._visit(n.prefix,e,r));const o=this.types[e];if(o)return o.reduce((e,{name:n,type:o})=>(e[n]=this._visit(o,t[n],r),e),{});Z(!1,`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new Lr(e)}static getPrimaryType(e){return Lr.from(e).primaryType}static hashStruct(e,t,r){return Lr.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){if(null==e[r])continue;const n=wr[r];Z(n,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:n})}return t.sort((e,t)=>Rr.indexOf(e.name)-Rr.indexOf(t.name)),Lr.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return le(["0x1901",Lr.hashDomain(e),Lr.from(t).hash(r)])}static hash(e,t,r){return Ee(Lr.encode(e,t,r))}static async resolveNames(e,t,r,n){e=Object.assign({},e);for(const t in e)null==e[t]&&delete e[t];const o={};e.verifyingContract&&!se(e.verifyingContract,20)&&(o[e.verifyingContract]="0x");const i=Lr.from(t);i.visit(r,(e,t)=>("address"!==e||se(t,20)||(o[t]="0x"),t));for(const e in o)o[e]=await n(e);return e.verifyingContract&&o[e.verifyingContract]&&(e.verifyingContract=o[e.verifyingContract]),{domain:e,value:r=i.visit(r,(e,t)=>"address"===e&&o[t]?o[t]:t)}}static getPayload(e,t,r){Lr.hashDomain(e);const n={},o=[];Rr.forEach(t=>{const r=e[t];null!=r&&(n[t]=_r[t](r),o.push({name:t,type:wr[t]}))});const i=Lr.from(t);t=i.types;const s=Object.assign({},t);return Z(null==s.EIP712Domain,"types must not contain EIP712Domain type","types.EIP712Domain",t),s.EIP712Domain=o,i.encode(r),{types:s,domain:n,primaryType:i.primaryType,message:i.visit(r,(e,t)=>{if(e.match(/^bytes(\d*)/))return ue(oe(t));if(e.match(/^u?int/))return Dt(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return Z("string"==typeof t,"invalid string","value",t),t}Z(!1,"unsupported type","type",e)})}}}const Dr="0x0000000000000000000000000000000000000000";function Ur(e,r,n,o){i(e);const s=T({dkLen:32,asyncTick:10},o),{c:a,dkLen:c,asyncTick:u}=s;if(t(a),t(c),t(u),a<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const l=S(r),f=S(n),h=new Uint8Array(c),d=ut.create(e,l),p=d._cloneInto().update(f);return{c:a,dkLen:c,asyncTick:u,DK:h,PRF:d,PRFSalt:p}}function xr(e,t,r,n,o){return e.destroy(),t.destroy(),n&&n.destroy(),o.fill(0),r}function Gr(e,t,r,n){const{c:o,dkLen:i,DK:s,PRF:a,PRFSalt:c}=Ur(e,t,r,n);let u;const l=new Uint8Array(4),f=v(l),h=new Uint8Array(a.outputLen);for(let e=1,t=0;t<i;e++,t+=a.outputLen){const r=s.subarray(t,t+a.outputLen);f.setInt32(0,e,!1),(u=c._cloneInto(u)).update(l).digestInto(h),r.set(h.subarray(0,r.length));for(let e=1;e<o;e++){a._cloneInto(u).update(h).digestInto(h);for(let e=0;e<r.length;e++)r[e]^=h[e]}}return xr(a,c,s,u,h)}const[Fr,kr]=(()=>y.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))))(),Br=new Uint32Array(80),Mr=new Uint32Array(80);class jr extends be{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:o,Cl:i,Dh:s,Dl:a,Eh:c,El:u,Fh:l,Fl:f,Gh:h,Gl:d,Hh:p,Hl:g}=this;return[e,t,r,n,o,i,s,a,c,u,l,f,h,d,p,g]}set(e,t,r,n,o,i,s,a,c,u,l,f,h,d,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|o,this.Cl=0|i,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|u,this.Fh=0|l,this.Fl=0|f,this.Gh=0|h,this.Gl=0|d,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let r=0;r<16;r++,t+=4)Br[r]=e.getUint32(t),Mr[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|Br[e-15],r=0|Mr[e-15],n=y.rotrSH(t,r,1)^y.rotrSH(t,r,8)^y.shrSH(t,r,7),o=y.rotrSL(t,r,1)^y.rotrSL(t,r,8)^y.shrSL(t,r,7),i=0|Br[e-2],s=0|Mr[e-2],a=y.rotrSH(i,s,19)^y.rotrBH(i,s,61)^y.shrSH(i,s,6),c=y.rotrSL(i,s,19)^y.rotrBL(i,s,61)^y.shrSL(i,s,6),u=y.add4L(o,c,Mr[e-7],Mr[e-16]),l=y.add4H(u,n,a,Br[e-7],Br[e-16]);Br[e]=0|l,Mr[e]=0|u}let{Ah:r,Al:n,Bh:o,Bl:i,Ch:s,Cl:a,Dh:c,Dl:u,Eh:l,El:f,Fh:h,Fl:d,Gh:p,Gl:g,Hh:m,Hl:E}=this;for(let e=0;e<80;e++){const t=y.rotrSH(l,f,14)^y.rotrSH(l,f,18)^y.rotrBH(l,f,41),b=y.rotrSL(l,f,14)^y.rotrSL(l,f,18)^y.rotrBL(l,f,41),v=l&h^~l&p,O=f&d^~f&g,I=y.add5L(E,b,O,kr[e],Mr[e]),A=y.add5H(I,m,t,v,Fr[e],Br[e]),S=0|I,w=y.rotrSH(r,n,28)^y.rotrBH(r,n,34)^y.rotrBH(r,n,39),R=y.rotrSL(r,n,28)^y.rotrBL(r,n,34)^y.rotrBL(r,n,39),T=r&o^r&s^o&s,_=n&i^n&a^i&a;m=0|p,E=0|g,p=0|h,g=0|d,h=0|l,d=0|f,({h:l,l:f}=y.add(0|c,0|u,0|A,0|S)),c=0|s,u=0|a,s=0|o,a=0|i,o=0|r,i=0|n;const N=y.add3L(S,R,_);r=y.add3H(N,A,w,T),n=0|N}({h:r,l:n}=y.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:o,l:i}=y.add(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:a}=y.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=y.add(0|this.Dh,0|this.Dl,0|c,0|u)),({h:l,l:f}=y.add(0|this.Eh,0|this.El,0|l,0|f)),({h,l:d}=y.add(0|this.Fh,0|this.Fl,0|h,0|d)),({h:p,l:g}=y.add(0|this.Gh,0|this.Gl,0|p,0|g)),({h:m,l:E}=y.add(0|this.Hh,0|this.Hl,0|m,0|E)),this.set(r,n,o,i,s,a,c,u,l,f,h,d,p,g,m,E)}roundClean(){Br.fill(0),Mr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Kr=_(()=>new jr);const Vr=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw new Error("unable to locate global object")}(),$r=Vr.crypto||Vr.msCrypto;function Hr(e){switch(e){case"sha256":return Re.create();case"sha512":return Kr.create()}Z(!1,"invalid hashing algorithm name","algorithm",e)}const Yr=function(e){return Hr("sha256").update(e).digest()},qr=function(e){return Hr("sha512").update(e).digest()};let zr=Yr,Wr=qr,Jr=!1,Xr=!1;function Qr(e){const t=oe(e,"data");return ue(zr(t))}function Zr(e){const t=oe(e,"data");return ue(Wr(t))}function en(e){let t=e.toString(16);for(;t.length<2;)t="0"+t;return"0x"+t}function tn(e,t,r){let n=0;for(let o=0;o<r;o++)n=256*n+e[t+o];return n}function rn(e,t,r,n){const o=[];for(;r<t+1+n;){const i=nn(e,r);o.push(i.result),Q((r+=i.consumed)<=t+1+n,"child data too short","BUFFER_OVERRUN",{buffer:e,length:n,offset:t})}return{consumed:1+n,result:o}}function nn(e,t){Q(0!==e.length,"data too short","BUFFER_OVERRUN",{buffer:e,length:0,offset:1});const r=t=>{Q(t<=e.length,"data short segment too short","BUFFER_OVERRUN",{buffer:e,length:e.length,offset:t})};if(e[t]>=248){const n=e[t]-247;r(t+1+n);const o=tn(e,t+1,n);return r(t+1+n+o),rn(e,t,t+1+n,n+o)}if(e[t]>=192){const n=e[t]-192;return r(t+1+n),rn(e,t,t+1,n)}if(e[t]>=184){const n=e[t]-183;r(t+1+n);const o=tn(e,t+1,n);r(t+1+n+o);return{consumed:1+n+o,result:ue(e.slice(t+1+n,t+1+n+o))}}if(e[t]>=128){const n=e[t]-128;r(t+1+n);return{consumed:1+n,result:ue(e.slice(t+1,t+1+n))}}return{consumed:1,result:en(e[t])}}function on(e){const t=oe(e,"data"),r=nn(t,0);return Z(r.consumed===t.length,"unexpected junk after rlp payload","data",e),r.result}function sn(e,t){return{address:sr(e),storageKeys:t.map((e,t)=>(Z(se(e,32),"invalid slot",`storageKeys[${t}]`,e),e.toLowerCase()))}}function an(e){if(Array.isArray(e))return e.map((t,r)=>Array.isArray(t)?(Z(2===t.length,"invalid slot set",`value[${r}]`,t),sn(t[0],t[1])):(Z(null!=t&&"object"==typeof t,"invalid address-slot set","value",e),sn(t.address,t.storageKeys)));Z(null!=e&&"object"==typeof e,"invalid access list","value",e);const t=Object.keys(e).map(t=>{const r=e[t].reduce((e,t)=>(e[t]=!0,e),{});return sn(t,Object.keys(r).sort())});return t.sort((e,t)=>e.address.localeCompare(t.address)),t}function cn(e){let t;return t="string"==typeof e?Zt.computePublicKey(e,!1):e.publicKey,sr(Ee("0x"+t.substring(4)).substring(26))}Qr._=Yr,Qr.lock=function(){Jr=!0},Qr.register=function(e){if(Jr)throw new Error("sha256 is locked");zr=e},Object.freeze(Qr),Zr._=qr,Zr.lock=function(){Xr=!0},Zr.register=function(e){if(Xr)throw new Error("sha512 is locked");Wr=e},Object.freeze(Qr);const un=BigInt(0),ln=BigInt(2),fn=BigInt(27),hn=BigInt(28),dn=BigInt(35),pn=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),gn=Symbol.for("nodejs.util.inspect.custom"),yn=131072,mn=128;function En(e,t){let r=e.toString(16);for(;r.length<2;)r="0"+r;return r+=Qr(t).substring(4),"0x"+r}function bn(e){return"0x"===e?null:sr(e)}function vn(e,t){try{return an(e)}catch(r){Z(!1,r.message,t,e)}}function On(e,t){try{if(!Array.isArray(e))throw new Error("authorizationList: invalid array");const t=[];for(let r=0;r<e.length;r++){const n=e[r];if(!Array.isArray(n))throw new Error(`authorization[${r}]: invalid array`);if(6!==n.length)throw new Error(`authorization[${r}]: wrong length`);if(!n[1])throw new Error(`authorization[${r}]: null address`);t.push({address:bn(n[1]),nonce:An(n[2],"nonce"),chainId:An(n[0],"chainId"),signature:Qt.from({yParity:In(n[3],"yParity"),r:pe(n[4],32),s:pe(n[5],32)})})}return t}catch(r){Z(!1,r.message,t,e)}}function In(e,t){return"0x"===e?0:Ft(e,t)}function An(e,t){if("0x"===e)return un;const r=Dt(e,t);return Z(r<=pn,"value exceeds uint size",t,r),r}function Sn(e,t){const r=Dt(e,"value"),n=Bt(r);return Z(n.length<=32,"value too large",`tx.${t}`,r),n}function wn(e){return an(e).map(e=>[e.address,e.storageKeys])}function Rn(e,t){Z(Array.isArray(e),`invalid ${t}`,"value",e);for(let t=0;t<e.length;t++)Z(se(e[t],32),"invalid ${ param } hash",`value[${t}]`,e[t]);return e}function Tn(e,t){let r;try{if(r=In(t[0],"yParity"),0!==r&&1!==r)throw new Error("bad yParity")}catch(e){Z(!1,"invalid yParity","yParity",t[0])}const n=pe(t[1],32),o=pe(t[2],32),i=Qt.from({r:n,s:o,yParity:r});e.signature=i}class _n{#u;#l;#f;#h;#d;#p;#g;#y;#m;#E;#b;#v;#O;#I;#A;#S;#w;#R;get type(){return this.#u}set type(e){switch(e){case null:this.#u=null;break;case 0:case"legacy":this.#u=0;break;case 1:case"berlin":case"eip-2930":this.#u=1;break;case 2:case"london":case"eip-1559":this.#u=2;break;case 3:case"cancun":case"eip-4844":this.#u=3;break;case 4:case"pectra":case"eip-7702":this.#u=4;break;default:Z(!1,"unsupported transaction type","type",e)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844";case 4:return"eip-7702"}return null}get to(){const e=this.#l;return null==e&&3===this.type?Dr:e}set to(e){this.#l=null==e?null:sr(e)}get nonce(){return this.#h}set nonce(e){this.#h=Ft(e,"value")}get gasLimit(){return this.#d}set gasLimit(e){this.#d=Dt(e)}get gasPrice(){const e=this.#p;return null!=e||0!==this.type&&1!==this.type?e:un}set gasPrice(e){this.#p=null==e?null:Dt(e,"gasPrice")}get maxPriorityFeePerGas(){const e=this.#g;return null==e?2===this.type||3===this.type?un:null:e}set maxPriorityFeePerGas(e){this.#g=null==e?null:Dt(e,"maxPriorityFeePerGas")}get maxFeePerGas(){const e=this.#y;return null==e?2===this.type||3===this.type?un:null:e}set maxFeePerGas(e){this.#y=null==e?null:Dt(e,"maxFeePerGas")}get data(){return this.#f}set data(e){this.#f=ue(e)}get value(){return this.#m}set value(e){this.#m=Dt(e,"value")}get chainId(){return this.#E}set chainId(e){this.#E=Dt(e)}get signature(){return this.#b||null}set signature(e){this.#b=null==e?null:Qt.from(e)}isValid(){const e=this.signature;if(e&&!e.isValid())return!1;const t=this.authorizationList;if(t)for(const e of t)if(!e.signature.isValid())return!1;return!0}get accessList(){const e=this.#v||null;return null==e?1===this.type||2===this.type||3===this.type?[]:null:e}set accessList(e){this.#v=null==e?null:an(e)}get authorizationList(){const e=this.#w||null;return null==e&&4===this.type?[]:e}set authorizationList(e){this.#w=null==e?null:e.map(e=>{return{address:sr((t=e).address),nonce:Dt(null!=t.nonce?t.nonce:0),chainId:Dt(null!=t.chainId?t.chainId:0),signature:Qt.from(t.signature)};var t})}get maxFeePerBlobGas(){const e=this.#O;return null==e&&3===this.type?un:e}set maxFeePerBlobGas(e){this.#O=null==e?null:Dt(e,"maxFeePerBlobGas")}get blobVersionedHashes(){let e=this.#I;return null==e&&3===this.type?[]:e}set blobVersionedHashes(e){if(null!=e){Z(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let t=0;t<e.length;t++)Z(se(e[t],32),"invalid blobVersionedHash",`value[${t}]`,e[t])}this.#I=e}get blobs(){return null==this.#S?null:this.#S.map(e=>Object.assign({},e))}set blobs(e){if(null==e)return void(this.#S=null);const t=[],r=[];for(let n=0;n<e.length;n++){const o=e[n];if(ae(o)){Q(this.#A,"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let e=oe(o);if(Z(e.length<=yn,"blob is too large",`blobs[${n}]`,o),e.length!==yn){const t=new Uint8Array(yn);t.set(e),e=t}const i=this.#A.blobToKzgCommitment(e),s=ue(this.#A.computeBlobKzgProof(e,i));t.push({data:ue(e),commitment:ue(i),proof:s}),r.push(En(1,i))}else{const e=ue(o.data),n=ue(o.commitment),i=ue(o.proof);t.push({data:e,commitment:n,proof:i}),r.push(En(1,n))}}this.#S=t,this.#I=r}get kzg(){return this.#A}set kzg(e){this.#A=null==e?null:function(e){return{blobToKzgCommitment:t=>{if("computeBlobProof"in e){if("blobToKzgCommitment"in e&&"function"==typeof e.blobToKzgCommitment)return oe(e.blobToKzgCommitment(ue(t)))}else if("blobToKzgCommitment"in e&&"function"==typeof e.blobToKzgCommitment)return oe(e.blobToKzgCommitment(t));if("blobToKZGCommitment"in e&&"function"==typeof e.blobToKZGCommitment)return oe(e.blobToKZGCommitment(ue(t)));Z(!1,"unsupported KZG library","kzg",e)},computeBlobKzgProof:(t,r)=>"computeBlobProof"in e&&"function"==typeof e.computeBlobProof?oe(e.computeBlobProof(ue(t),ue(r))):"computeBlobKzgProof"in e&&"function"==typeof e.computeBlobKzgProof?e.computeBlobKzgProof(t,r):"computeBlobKZGProof"in e&&"function"==typeof e.computeBlobKZGProof?oe(e.computeBlobKZGProof(ue(t),ue(r))):void Z(!1,"unsupported KZG library","kzg",e)}}(e)}get blobWrapperVersion(){return this.#R}set blobWrapperVersion(e){this.#R=e}constructor(){this.#u=null,this.#l=null,this.#h=0,this.#d=un,this.#p=null,this.#g=null,this.#y=null,this.#f="0x",this.#m=un,this.#E=un,this.#b=null,this.#v=null,this.#O=null,this.#I=null,this.#A=null,this.#S=null,this.#w=null,this.#R=null}get hash(){return null==this.signature?null:Ee(this.#T(!0,!1))}get unsignedHash(){return Ee(this.unsignedSerialized)}get from(){return null==this.signature?null:(e=this.unsignedHash,t=this.signature.getCanonical(),cn(Zt.recoverPublicKey(e,t)));var e,t}get fromPublicKey(){return null==this.signature?null:Zt.recoverPublicKey(this.unsignedHash,this.signature.getCanonical())}isSigned(){return null!=this.signature}#T(e,t){Q(!e||null!=this.signature,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const r=e?this.signature:null;switch(this.inferType()){case 0:return function(e,t){const r=[Sn(e.nonce,"nonce"),Sn(e.gasPrice||0,"gasPrice"),Sn(e.gasLimit,"gasLimit"),e.to||"0x",Sn(e.value,"value"),e.data];let n=un;if(e.chainId!=un)n=Dt(e.chainId,"tx.chainId"),Z(!t||null==t.networkV||t.legacyChainId===n,"tx.chainId/sig.v mismatch","sig",t);else if(e.signature){const t=e.signature.legacyChainId;null!=t&&(n=t)}if(!t)return n!==un&&(r.push(Bt(n)),r.push("0x"),r.push("0x")),gr(r);let o=BigInt(27+t.yParity);return n!==un?o=Qt.getChainIdV(n,t.v):BigInt(t.v)!==o&&Z(!1,"tx.chainId/sig.v mismatch","sig",t),r.push(Bt(o)),r.push(Bt(t.r)),r.push(Bt(t._s)),gr(r)}(this,r);case 1:return function(e,t){const r=[Sn(e.chainId,"chainId"),Sn(e.nonce,"nonce"),Sn(e.gasPrice||0,"gasPrice"),Sn(e.gasLimit,"gasLimit"),e.to||"0x",Sn(e.value,"value"),e.data,wn(e.accessList||[])];return t&&(r.push(Sn(t.yParity,"recoveryParam")),r.push(Bt(t.r)),r.push(Bt(t.s))),le(["0x01",gr(r)])}(this,r);case 2:return function(e,t){const r=[Sn(e.chainId,"chainId"),Sn(e.nonce,"nonce"),Sn(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Sn(e.maxFeePerGas||0,"maxFeePerGas"),Sn(e.gasLimit,"gasLimit"),e.to||"0x",Sn(e.value,"value"),e.data,wn(e.accessList||[])];return t&&(r.push(Sn(t.yParity,"yParity")),r.push(Bt(t.r)),r.push(Bt(t.s))),le(["0x02",gr(r)])}(this,r);case 3:return function(e,t,r){const n=[Sn(e.chainId,"chainId"),Sn(e.nonce,"nonce"),Sn(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Sn(e.maxFeePerGas||0,"maxFeePerGas"),Sn(e.gasLimit,"gasLimit"),e.to||Dr,Sn(e.value,"value"),e.data,wn(e.accessList||[]),Sn(e.maxFeePerBlobGas||0,"maxFeePerBlobGas"),Rn(e.blobVersionedHashes||[],"blobVersionedHashes")];if(t&&(n.push(Sn(t.yParity,"yParity")),n.push(Bt(t.r)),n.push(Bt(t.s)),r)){if(null!=e.blobWrapperVersion){const t=Bt(e.blobWrapperVersion),o=[];for(const{proof:e}of r){const t=oe(e),r=t.length/mn;for(let e=0;e<t.length;e+=r)o.push(t.subarray(e,e+r))}return le(["0x03",gr([n,t,r.map(e=>e.data),r.map(e=>e.commitment),o])])}return le(["0x03",gr([n,r.map(e=>e.data),r.map(e=>e.commitment),r.map(e=>e.proof)])])}return le(["0x03",gr(n)])}(this,r,t?this.blobs:null);case 4:return function(e,t){const r=[Sn(e.chainId,"chainId"),Sn(e.nonce,"nonce"),Sn(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Sn(e.maxFeePerGas||0,"maxFeePerGas"),Sn(e.gasLimit,"gasLimit"),e.to||"0x",Sn(e.value,"value"),e.data,wn(e.accessList||[]),(n=e.authorizationList||[],n.map(e=>[Sn(e.chainId,"chainId"),e.address,Sn(e.nonce,"nonce"),Sn(e.signature.yParity,"yParity"),Bt(e.signature.r),Bt(e.signature._s)]))];var n;return t&&(r.push(Sn(t.yParity,"yParity")),r.push(Bt(t.r)),r.push(Bt(t.s))),le(["0x04",gr(r)])}(this,r)}Q(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})}get serialized(){return this.#T(!0,!0)}get unsignedSerialized(){return this.#T(!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=null!=this.gasPrice,t=null!=this.maxFeePerGas||null!=this.maxPriorityFeePerGas,r=null!=this.accessList,n=null!=this.#O||this.#I;null!=this.maxFeePerGas&&null!=this.maxPriorityFeePerGas&&Q(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),Q(!t||0!==this.type&&1!==this.type,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),Q(0!==this.type||!r,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const o=[];return null!=this.type?o.push(this.type):this.authorizationList&&this.authorizationList.length?o.push(4):t?o.push(2):e?(o.push(1),r||o.push(0)):r?(o.push(1),o.push(2)):(n&&this.to||(o.push(0),o.push(1),o.push(2)),o.push(3)),o.sort(),o}isLegacy(){return 0===this.type}isBerlin(){return 1===this.type}isLondon(){return 2===this.type}isCancun(){return 3===this.type}clone(){return _n.from(this)}toJSON(){const e=e=>null==e?null:e.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}[gn](){return this.toString()}toString(){const e=[],t=t=>{let r=this[t];"string"==typeof r&&(r=JSON.stringify(r)),e.push(`${t}: ${r}`)};this.type&&t("type"),t("to"),t("data"),t("nonce"),t("gasLimit"),t("value"),null!=this.chainId&&t("chainId"),this.signature&&(t("from"),e.push(`signature: ${this.signature.toString()}`));const r=this.authorizationList;if(r){const t=[];for(const e of r){const r=[];r.push(`address: ${JSON.stringify(e.address)}`),null!=e.nonce&&r.push(`nonce: ${e.nonce}`),null!=e.chainId&&r.push(`chainId: ${e.chainId}`),e.signature&&r.push(`signature: ${e.signature.toString()}`),t.push(`Authorization { ${r.join(", ")} }`)}e.push(`authorizations: [ ${t.join(", ")} ]`)}return`Transaction { ${e.join(", ")} }`}static from(e){if(null==e)return new _n;if("string"==typeof e){const t=oe(e);if(t[0]>=127)return _n.from(function(e){const t=on(e);Z(Array.isArray(t)&&(9===t.length||6===t.length),"invalid field count for legacy transaction","data",e);const r={type:0,nonce:In(t[0],"nonce"),gasPrice:An(t[1],"gasPrice"),gasLimit:An(t[2],"gasLimit"),to:bn(t[3]),value:An(t[4],"value"),data:ue(t[5]),chainId:un};if(6===t.length)return r;const n=An(t[6],"v"),o=An(t[7],"r"),i=An(t[8],"s");if(o===un&&i===un)r.chainId=n;else{let e=(n-dn)/ln;e<un&&(e=un),r.chainId=e,Z(e!==un||n===fn||n===hn,"non-canonical legacy v","v",t[6]),r.signature=Qt.from({r:pe(t[7],32),s:pe(t[8],32),v:n})}return r}(t));switch(t[0]){case 1:return _n.from(function(e){const t=on(oe(e).slice(1));Z(Array.isArray(t)&&(8===t.length||11===t.length),"invalid field count for transaction type: 1","data",ue(e));const r={type:1,chainId:An(t[0],"chainId"),nonce:In(t[1],"nonce"),gasPrice:An(t[2],"gasPrice"),gasLimit:An(t[3],"gasLimit"),to:bn(t[4]),value:An(t[5],"value"),data:ue(t[6]),accessList:vn(t[7],"accessList")};return 8===t.length||Tn(r,t.slice(8)),r}(t));case 2:return _n.from(function(e){const t=on(oe(e).slice(1));Z(Array.isArray(t)&&(9===t.length||12===t.length),"invalid field count for transaction type: 2","data",ue(e));const r={type:2,chainId:An(t[0],"chainId"),nonce:In(t[1],"nonce"),maxPriorityFeePerGas:An(t[2],"maxPriorityFeePerGas"),maxFeePerGas:An(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:An(t[4],"gasLimit"),to:bn(t[5]),value:An(t[6],"value"),data:ue(t[7]),accessList:vn(t[8],"accessList")};return 9===t.length||Tn(r,t.slice(9)),r}(t));case 3:return _n.from(function(e){let t=on(oe(e).slice(1)),r="3",n=null,o=null;if(4===t.length&&Array.isArray(t[0])){r="3 (network format)";const e=t[1],n=t[2],i=t[3];Z(Array.isArray(e),"invalid network format: blobs not an array","fields[1]",e),Z(Array.isArray(n),"invalid network format: commitments not an array","fields[2]",n),Z(Array.isArray(i),"invalid network format: proofs not an array","fields[3]",i),Z(e.length===n.length,"invalid network format: blobs/commitments length mismatch","fields",t),Z(e.length===i.length,"invalid network format: blobs/proofs length mismatch","fields",t),o=[];for(let r=0;r<t[1].length;r++)o.push({data:e[r],commitment:n[r],proof:i[r]});t=t[0]}else if(5===t.length&&Array.isArray(t[0])){r="3 (EIP-7594 network format)",n=Ft(t[1]);const e=t[2],i=t[3],s=t[4];Z(1===n,`unsupported EIP-7594 network format version: ${n}`,"fields[1]",n),Z(Array.isArray(e),"invalid EIP-7594 network format: blobs not an array","fields[2]",e),Z(Array.isArray(i),"invalid EIP-7594 network format: commitments not an array","fields[3]",i),Z(Array.isArray(s),"invalid EIP-7594 network format: proofs not an array","fields[4]",s),Z(e.length===i.length,"invalid network format: blobs/commitments length mismatch","fields",t),Z(e.length*mn===s.length,"invalid network format: blobs/proofs length mismatch","fields",t),o=[];for(let t=0;t<e.length;t++){const r=[];for(let e=0;e<mn;e++)r.push(s[t*mn+e]);o.push({data:e[t],commitment:i[t],proof:le(r)})}t=t[0]}Z(Array.isArray(t)&&(11===t.length||14===t.length),`invalid field count for transaction type: ${r}`,"data",ue(e));const i={type:3,chainId:An(t[0],"chainId"),nonce:In(t[1],"nonce"),maxPriorityFeePerGas:An(t[2],"maxPriorityFeePerGas"),maxFeePerGas:An(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:An(t[4],"gasLimit"),to:bn(t[5]),value:An(t[6],"value"),data:ue(t[7]),accessList:vn(t[8],"accessList"),maxFeePerBlobGas:An(t[9],"maxFeePerBlobGas"),blobVersionedHashes:t[10],blobWrapperVersion:n};o&&(i.blobs=o),Z(null!=i.to,`invalid address for transaction type: ${r}`,"data",e),Z(Array.isArray(i.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",e);for(let t=0;t<i.blobVersionedHashes.length;t++)Z(se(i.blobVersionedHashes[t],32),`invalid blobVersionedHash at index ${t}: must be length 32`,"data",e);return 11===t.length||Tn(i,t.slice(11)),i}(t));case 4:return _n.from(function(e){const t=on(oe(e).slice(1));Z(Array.isArray(t)&&(10===t.length||13===t.length),"invalid field count for transaction type: 4","data",ue(e));const r={type:4,chainId:An(t[0],"chainId"),nonce:In(t[1],"nonce"),maxPriorityFeePerGas:An(t[2],"maxPriorityFeePerGas"),maxFeePerGas:An(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:An(t[4],"gasLimit"),to:bn(t[5]),value:An(t[6],"value"),data:ue(t[7]),accessList:vn(t[8],"accessList"),authorizationList:On(t[9],"authorizationList")};return 10===t.length||Tn(r,t.slice(10)),r}(t))}Q(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const t=new _n;return null!=e.type&&(t.type=e.type),null!=e.to&&(t.to=e.to),null!=e.nonce&&(t.nonce=e.nonce),null!=e.gasLimit&&(t.gasLimit=e.gasLimit),null!=e.gasPrice&&(t.gasPrice=e.gasPrice),null!=e.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas),null!=e.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null!=e.maxFeePerBlobGas&&(t.maxFeePerBlobGas=e.maxFeePerBlobGas),null!=e.data&&(t.data=e.data),null!=e.value&&(t.value=e.value),null!=e.chainId&&(t.chainId=e.chainId),null!=e.signature&&(t.signature=Qt.from(e.signature)),null!=e.accessList&&(t.accessList=e.accessList),null!=e.authorizationList&&(t.authorizationList=e.authorizationList),null!=e.blobVersionedHashes&&(t.blobVersionedHashes=e.blobVersionedHashes),null!=e.kzg&&(t.kzg=e.kzg),null!=e.blobWrapperVersion&&(t.blobWrapperVersion=e.blobWrapperVersion),null!=e.blobs&&(t.blobs=e.blobs),null!=e.hash&&(Z(t.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),Z(t.hash===e.hash,"hash mismatch","tx",e)),null!=e.from&&(Z(t.isSigned(),"unsigned transaction cannot define '.from'","tx",e),Z(t.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),t}}BigInt(0);function Nn(e){const t={};e.to&&(t.to=e.to),e.from&&(t.from=e.from),e.data&&(t.data=ue(e.data));const r="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const n of r)n in e&&null!=e[n]&&(t[n]=Dt(e[n],`request.${n}`));const n="type,nonce".split(/,/);for(const r of n)r in e&&null!=e[r]&&(t[r]=Ft(e[r],`request.${r}`));return e.accessList&&(t.accessList=an(e.accessList)),e.authorizationList&&(t.authorizationList=e.authorizationList.slice()),"blockTag"in e&&(t.blockTag=e.blockTag),"enableCcipRead"in e&&(t.enableCcipRead=!!e.enableCcipRead),"customData"in e&&(t.customData=e.customData),"blobVersionedHashes"in e&&e.blobVersionedHashes&&(t.blobVersionedHashes=e.blobVersionedHashes.slice()),"kzg"in e&&(t.kzg=e.kzg),"blobWrapperVersion"in e&&(t.blobWrapperVersion=e.blobWrapperVersion),"blobs"in e&&e.blobs&&(t.blobs=e.blobs.map(e=>ae(e)?ue(e):Object.assign({},e))),t}Symbol.iterator;Symbol.iterator;function Cn(e,t){if(e.provider)return e.provider;Q(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:t})}async function Pn(e,t){let r=Nn(t);if(null!=r.to&&(r.to=cr(r.to,e)),null!=r.from){const t=r.from;r.from=Promise.all([e.getAddress(),cr(t,e)]).then(([e,t])=>(Z(e.toLowerCase()===t.toLowerCase(),"transaction from mismatch","tx.from",t),e))}else r.from=e.getAddress();return await z(r)}class Ln{provider;constructor(e){W(this,{provider:e||null})}async getNonce(e){return Cn(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await Pn(this,e)}async populateTransaction(e){const t=Cn(this,"populateTransaction"),r=await Pn(this,e);null==r.nonce&&(r.nonce=await this.getNonce("pending")),null==r.gasLimit&&(r.gasLimit=await this.estimateGas(r));const n=await this.provider.getNetwork();if(null!=r.chainId){Z(Dt(r.chainId)===n.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else r.chainId=n.chainId;const o=null!=r.maxFeePerGas||null!=r.maxPriorityFeePerGas;if(null==r.gasPrice||2!==r.type&&!o?0!==r.type&&1!==r.type||!o||Z(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e):Z(!1,"eip-1559 transaction do not support gasPrice","tx",e),2!==r.type&&null!=r.type||null==r.maxFeePerGas||null==r.maxPriorityFeePerGas)if(0===r.type||1===r.type){const e=await t.getFeeData();Q(null!=e.gasPrice,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),null==r.gasPrice&&(r.gasPrice=e.gasPrice)}else{const e=await t.getFeeData();if(null==r.type)if(null!=e.maxFeePerGas&&null!=e.maxPriorityFeePerGas)if(r.authorizationList&&r.authorizationList.length?r.type=4:r.type=2,null!=r.gasPrice){const e=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=e,r.maxPriorityFeePerGas=e}else null==r.maxFeePerGas&&(r.maxFeePerGas=e.maxFeePerGas),null==r.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=e.maxPriorityFeePerGas);else null!=e.gasPrice?(Q(!o,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),null==r.gasPrice&&(r.gasPrice=e.gasPrice),r.type=0):Q(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else 2!==r.type&&3!==r.type&&4!==r.type||(null==r.maxFeePerGas&&(r.maxFeePerGas=e.maxFeePerGas),null==r.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=e.maxPriorityFeePerGas))}else r.type=2;return await z(r)}async populateAuthorization(e){const t=Object.assign({},e);return null==t.chainId&&(t.chainId=(await Cn(this,"getNetwork").getNetwork()).chainId),null==t.nonce&&(t.nonce=await this.getNonce()),t}async estimateGas(e){return Cn(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return Cn(this,"call").call(await this.populateCall(e))}async resolveName(e){const t=Cn(this,"resolveName");return await t.resolveName(e)}async sendTransaction(e){const t=Cn(this,"sendTransaction"),r=await this.populateTransaction(e);delete r.from;const n=_n.from(r);return await t.broadcastTransaction(await this.signTransaction(n))}authorize(e){Q(!1,"authorization not implemented for this signer","UNSUPPORTED_OPERATION",{operation:"authorize"})}}class Dn extends Ln{address;constructor(e,t){super(t),W(this,{address:e})}async getAddress(){return this.address}connect(e){return new Dn(this.address,e)}#_(e,t){Q(!1,`VoidSigner cannot sign ${e}`,"UNSUPPORTED_OPERATION",{operation:t})}async signTransaction(e){this.#_("transactions","signTransaction")}async signMessage(e){this.#_("messages","signMessage")}async signTypedData(e,t,r){this.#_("typed-data","signTypedData")}}class Un extends Ln{address;#N;constructor(e,t){super(t),Z(e&&"function"==typeof e.sign,"invalid private key","privateKey","[ REDACTED ]"),this.#N=e;W(this,{address:cn(this.signingKey.publicKey)})}get signingKey(){return this.#N}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(e){return new Un(this.#N,e)}async signTransaction(e){e=Nn(e);const{to:t,from:r}=await z({to:e.to?cr(e.to,this):void 0,from:e.from?cr(e.from,this):void 0});null!=t&&(e.to=t),null!=r&&(e.from=r),null!=e.from&&(Z(sr(e.from)===this.address,"transaction from address mismatch","tx.from",e.from),delete e.from);const n=_n.from(e);return n.signature=this.signingKey.sign(n.unsignedHash),n.serialized}async signMessage(e){return this.signMessageSync(e)}signMessageSync(e){return this.signingKey.sign(fr(e)).serialized}authorizeSync(e){Z("string"==typeof e.address,"invalid address for authorizeSync","auth.address",e);const t=this.signingKey.sign(yr(e));return Object.assign({},{address:sr(e.address),nonce:Dt(e.nonce||0),chainId:Dt(e.chainId||0)},{signature:t})}async authorize(e){return e=Object.assign({},e,{address:await cr(e.address,this)}),this.authorizeSync(await this.populateAuthorization(e))}async signTypedData(e,t,r){const n=await Lr.resolveNames(e,t,r,async e=>{Q(null!=this.provider,"cannot resolve ENS names without a provider","UNSUPPORTED_OPERATION",{operation:"resolveName",info:{name:e}});const t=await this.provider.resolveName(e);return Q(null!=t,"unconfigured ENS name","UNCONFIGURED_NAME",{value:e}),t});return this.signingKey.sign(Lr.hash(n.domain,t,n.value)).serialized}}let xn=!1;const Gn=function(e,t,r){return function(e,t){const r={sha256:Re,sha512:Kr}[e];return Z(null!=r,"invalid hmac algorithm","algorithm",e),ut.create(r,t)}(e,t).update(r).digest()};let Fn=Gn;function kn(e,t,r){const n=oe(t,"key"),o=oe(r,"data");return ue(Fn(e,n,o))}kn._=Gn,kn.lock=function(){xn=!0},kn.register=function(e){if(xn)throw new Error("computeHmac is locked");Fn=e},Object.freeze(kn);const Bn=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Mn=Uint8Array.from({length:16},(e,t)=>t);let jn=[Mn],Kn=[Mn.map(e=>(9*e+5)%16)];for(let e=0;e<4;e++)for(let t of[jn,Kn])t.push(t[e].map(e=>Bn[e]));const Vn=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>new Uint8Array(e)),$n=jn.map((e,t)=>e.map(e=>Vn[t][e])),Hn=Kn.map((e,t)=>e.map(e=>Vn[t][e])),Yn=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),qn=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),zn=(e,t)=>e<<t|e>>>32-t;function Wn(e,t,r,n){return 0===e?t^r^n:1===e?t&r|~t&n:2===e?(t|~r)^n:3===e?t&n|r&~n:t^(r|~n)}const Jn=new Uint32Array(16);class Xn extends be{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:r,h3:n,h4:o}=this;return[e,t,r,n,o]}set(e,t,r,n,o){this.h0=0|e,this.h1=0|t,this.h2=0|r,this.h3=0|n,this.h4=0|o}process(e,t){for(let r=0;r<16;r++,t+=4)Jn[r]=e.getUint32(t,!0);let r=0|this.h0,n=r,o=0|this.h1,i=o,s=0|this.h2,a=s,c=0|this.h3,u=c,l=0|this.h4,f=l;for(let e=0;e<5;e++){const t=4-e,h=Yn[e],d=qn[e],p=jn[e],g=Kn[e],y=$n[e],m=Hn[e];for(let t=0;t<16;t++){const n=zn(r+Wn(e,o,s,c)+Jn[p[t]]+h,y[t])+l|0;r=l,l=c,c=0|zn(s,10),s=o,o=n}for(let e=0;e<16;e++){const r=zn(n+Wn(t,i,a,u)+Jn[g[e]]+d,m[e])+f|0;n=f,f=u,u=0|zn(a,10),a=i,i=r}}this.set(this.h1+s+u|0,this.h2+c+f|0,this.h3+l+n|0,this.h4+r+i|0,this.h0+o+a|0)}roundClean(){Jn.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const Qn=_(()=>new Xn);let Zn=!1;const eo=function(e){return Qn(e)};let to=eo;function ro(e){const t=oe(e,"data");return ue(to(t))}ro._=eo,ro.lock=function(){Zn=!0},ro.register=function(e){if(Zn)throw new TypeError("ripemd160 is locked");to=e},Object.freeze(ro);let no=!1;const oo=function(e){return new Uint8Array(function(e){Q(null!=$r,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"}),Z(Number.isInteger(e)&&e>0&&e<=1024,"invalid length","length",e);const t=new Uint8Array(e);return $r.getRandomValues(t),t}(e))};let io=oo;function so(e){return io(e)}so._=oo,so.lock=function(){no=!0},so.register=function(e){if(no)throw new Error("randomBytes is locked");io=e},Object.freeze(so);const ao="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";let co=null;function uo(e){if(null==co){co={};for(let e=0;e<58;e++)co[ao[e]]=BigInt(e)}const t=co[e];return Z(null!=t,"invalid base58 value","letter",e),t}const lo=BigInt(0),fo=BigInt(58);const ho=" !#$%&'()*+,-./<=>?@[]^_`{|}~",po=/^[a-z]*$/i;function go(e,t){let r=97;return e.reduce((e,n)=>(n===t?r++:n.match(po)?e.push(String.fromCharCode(r)+n):(r=97,e.push(n)),e),[])}function yo(e){return Z("0"===e[0],"unsupported auwl data","data",e),function(e,t){for(let r=28;r>=0;r--)e=e.split(ho[r]).join(t.substring(2*r,2*r+2));const r=[],n=e.replace(/(:|([0-9])|([A-Z][a-z]*))/g,(e,t,n,o)=>{if(n)for(let e=parseInt(n);e>=0;e--)r.push(";");else r.push(t.toLowerCase());return""});if(n)throw new Error(`leftovers: ${JSON.stringify(n)}`);return go(go(r,";"),":")}(e.substring(59),e.substring(1,59))}class mo{locale;constructor(e){W(this,{locale:e})}split(e){return e.toLowerCase().split(/\s+/g)}join(e){return e.join(" ")}}class Eo extends mo{#f;#C;constructor(e,t,r){super(e),this.#f=t,this.#C=r,this.#P=null}get _data(){return this.#f}_decodeWords(){return yo(this.#f)}#P;#L(){if(null==this.#P){const e=this._decodeWords();if(mr(e.join("\n")+"\n")!==this.#C)throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`);this.#P=e}return this.#P}getWord(e){const t=this.#L();return Z(e>=0&&e<t.length,`invalid word index: ${e}`,"index",e),t[e]}getWordIndex(e){return this.#L().indexOf(e)}}let bo=null;class vo extends Eo{constructor(){super("en","0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN<aNn RRelyRga(R*lSeS-SketTt!3A^AnAutyCau'ComeEfF%eG(Ha=H(dLie=LowLtN^Nef./TrayTt Twe&Y#d3Cyc!DKeNdOlogyRdR`Tt _{AdeAmeAnketA,EakE[IndOodO[omOu'UeUrUsh_rdAtDyIlMbNeNusOkO,Rd R(gRrowSsTtomUn)XY_{etA(AndA[A=EadEezeI{Id+IefIghtIngIskOccoliOk&OnzeOomO` OwnUsh2Bb!DdyD+tFf$oIldLbLkL!tNd!Nk Rd&Rg R,SS(e[SyTt Y Zz:Bba+B(B!CtusGeKe~LmM aMpNN$N)lNdyNn#NoeNvasNy#Pab!P.$Pta(RRb#RdRgoRpetRryRtSeShS(o/!Su$TT$ogT^Teg%yTt!UghtU'Ut]Ve3Il(gL yM|NsusNturyRe$Rta(_irAlkAmp]An+AosApt Ar+A'AtEapE{Ee'EfErryE,I{&IefIldIm}yOi)Oo'R#-U{!UnkUrn0G?Nnam#Rc!Tiz&TyVil_imApArifyAwAyE<ErkEv I{I|IffImbIn-IpO{OgO'O`OudOwnUbUmpU, Ut^_^A,C#utDeFfeeIlInL!@L%LumnMb(eMeMf%tM-Mm#Mp<yNc tNdu@NfirmNg*[N}@Nsid NtrolNv()OkOlPp PyR$ReRnR*@/Tt#U^UntryUp!Ur'Us(V Yo>_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gShUght WnY3AlBa>BrisCadeCemb CideCl(eC%a>C*a'ErF&'F(eFyG*eLayLiv M<dMi'Ni$Nti,NyP?tP&dPos.P`PutyRi=ScribeS tSignSkSpair/royTailTe@VelopVi)Vo>3AgramAlAm#dAryCeE'lEtFf G.$Gn.yLemmaNn NosaurRe@RtSag*eScov Sea'ShSmi[S%d Splay/<)V tVideV%)Zzy5Ct%Cum|G~Lph(Ma(Na>NkeyN%OrSeUb!Ve_ftAg#AmaA,-AwEamE[IftIllInkIpI=OpUmY2CkMbNeR(g/T^Ty1Arf1Nam-:G G!RlyRnR`Sily/Sy1HoOlogyOnomy0GeItUca>1F%t0G1GhtTh 2BowD E@r-Eg<tEm|Eph<tEvat%I>Se0B?kBodyBra)Er+Ot]PloyPow Pty0Ab!A@DD![D%'EmyErgyF%)Ga+G(eH<)JoyLi,OughR-hRollSu*T Ti*TryVelope1Isode0U$Uip0AA'OdeOs]R%Upt0CapeSayS&)Ta>0Ern$H-s1Id&)IlOkeOl=1A@Amp!Ce[Ch<+C.eCludeCu'Ecu>Erci'Hau,Hib.I!I,ItOt-P<dPe@Pi*Pla(Po'P*[T&dTra0EEbrow:Br-CeCultyDeIntI`~L'MeMilyMousNNcyNtasyRmSh]TT$Th TigueUltV%.e3Atu*Bru?yD $EEdElMa!N)/iv$T^V W3B Ct]EldGu*LeLmLt N$NdNeNg NishReRmR,Sc$ShTT}[X_gAmeAshAtAv%EeIghtIpOatO{O%Ow UidUshY_mCusGIlLd~owOdOtR)Re,R+tRkRtu}RumRw?dSsil/ UndX_gi!AmeEqu|EshI&dIn+OgOntO,OwnOz&U.2ElNNnyRna)RyTu*:D+tInLaxy~ yMePRa+Rba+Rd&Rl-Rm|SSpTeTh U+Ze3N $NiusN*Nt!Nu(e/u*2O,0AntFtGg!Ng RaffeRlVe_dAn)A*A[IdeImp'ObeOomOryO=OwUe_tDde[LdOdO'RillaSpelSsipV nWn_bA)A(AntApeA[Av.yEatE&IdIefItOc yOupOwUnt_rdE[IdeIltIt?N3M:B.IrLfMm M, NdPpyRb%RdRshR=,TVeWkZ?d3AdAl`ArtAvyD+hogIght~oLmetLpNRo3Dd&Gh~NtPRe/%y5BbyCkeyLdLeLiday~owMeNeyOdPeRnRr%R'Sp.$/TelUrV 5BGeM<Mb!M%Nd*dNgryNtRd!RryRtSb<d3Brid:1EOn0EaEntifyLe2N%e4LLeg$L}[0A+Ita>M&'Mu}Pa@Po'Pro=Pul'0ChCludeComeC*a'DexD-a>Do%Du,ryF<tFl-tF%mHa!H .Iti$Je@JuryMa>N Noc|PutQuiryS<eSe@SideSpi*/$lTa@T e,ToVe,V.eVol=3On0L<dOla>Sue0Em1Ory:CketGu?RZz3AlousAns~yWel9BInKeUr}yY5D+I)MpNg!Ni%Nk/:Ng?oo3EnEpT^upY3CkDD}yNdNgdomSsTT^&TeTt&Wi4EeIfeO{Ow:BBelB%Dd DyKeMpNgua+PtopR+T T(UghUndryVaWWnWsu.Y Zy3Ad AfArnA=Ctu*FtGG$G&dIsu*M#NdNg`NsOp?dSs#Tt Vel3ArB tyBr?yC&'FeFtGhtKeMbM.NkOnQuid/Tt!VeZ?d5AdAnB, C$CkG-NelyNgOpTt yUdUn+VeY$5CkyGga+Mb N?N^Xury3R-s:Ch(eDG-G}tIdIlInJ%KeMm$NNa+Nda>NgoNs]Nu$P!Rb!R^Rg(R(eRketRria+SkSs/ T^T i$ThTrixTt XimumZe3AdowAnAsu*AtCh<-D$DiaLodyLtMb M%yNt]NuRcyR+R.RryShSsa+T$Thod3Dd!DnightLk~]M-NdNimumN%Nu>Rac!Rr%S ySs/akeXXedXtu*5Bi!DelDifyMM|N.%NkeyN, N`OnR$ReRn(gSqu.oTh T]T%Unta(U'VeVie5ChFf(LeLtiplySc!SeumShroomS-/Tu$3Self/ yTh:I=MePk(Rrow/yT]Tu*3ArCkEdGati=G!@I` PhewR=/TTw%kUtr$V WsXt3CeGht5B!I'M(eeOd!Rm$R`SeTab!TeTh(gTi)VelW5C!?Mb R'T:K0EyJe@Li+Scu*S =Ta(Vious0CurE<Tob 0Or1FF Fi)T&2L1Ay0DI=Ymp-0It0CeEI#L(eLy1EnEraIn]Po'T]1An+B.Ch?dD D(?yG<I|Ig($Ph<0Tr-h0H 0Tdo%T TputTside0AlEnEr0NN 0Yg&0/ 0O}:CtDd!GeIrLa)LmNdaNelN-N` P RadeR|RkRrotRtySsT^ThTi|TrolTt nU'VeYm|3A)AnutArAs<tL-<NN$tyNcilOp!Pp Rfe@Rm.Rs#T2O}OtoRa'Ys-$0AnoCn-Ctu*E)GGe#~LotNkO} Pe/olT^Zza_)A}tA,-A>AyEa'Ed+U{UgUn+2EmEtIntL?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOg<OtOwUsh0AllArtI!OkeOo`0A{AkeApIffOw0ApCc Ci$CkDaFtL?Ldi LidLut]L=Me#eNgOnRryRtUlUndUpUr)U`0A)A*Ati$AwnEakEci$EedEllEndH eI)Id IkeInIr.L.OilOns%O#OrtOtRayReadR(gY0Ua*UeezeUir*l_b!AdiumAffA+AirsAmpAndArtA>AyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NN<tNnisNtRm/Xt_nkAtEmeEnE%yE*EyIngIsOughtReeRi=RowUmbUnd 0CketDeG LtMb MeNyPRedSsueT!5A,BaccoDayDdl EGe` I!tK&MatoM%rowNeNgueNightOlO`PP-Pp!R^RnadoRtoi'SsT$Uri,W?dW WnY_{AdeAff-Ag-A(Ansf ApAshA=lAyEatEeEndI$IbeI{Igg ImIpOphyOub!U{UeUlyUmpetU,U`Y2BeIt]Mb!NaN}lRkeyRnRt!1El=EntyI)InI,O1PeP-$:5Ly5B*lla0Ab!Awa*C!Cov D DoFairFoldHappyIf%mIqueItIv 'KnownLo{TilUsu$Veil1Da>GradeHoldOnP Set1B<Ge0A+EEdEfulE![U$0Il.y:C<tCuumGueLidL!yL=NNishP%Rious/Ult3H-!L=tNd%Ntu*NueRbRifyRs]RyS'lT <3Ab!Br<tCiousCt%yDeoEw~a+Nta+Ol(Rtu$RusSaS.Su$T$Vid5C$I)IdLc<oLumeTeYa+:GeG#ItLk~LnutNtRfa*RmRri%ShSp/eT VeY3Al`Ap#ArA'lA` BDd(gEk&dIrdLcome/T_!AtEatEelEnE*IpIsp 0DeD`FeLd~NNdowNeNgNkNn Nt ReSdomSeShT}[5LfM<Nd OdOlRdRkRldRryR`_pE{E,!I,I>Ong::Rd3Ar~ow9UUngU`:3BraRo9NeO","0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60")}static wordlist(){return null==bo&&(bo=new vo),bo}}let Oo=!1;const Io=function(e,t,r,n,o){return function(e,t,r,n,o){const i={sha256:Re,sha512:Kr}[o];return Z(null!=i,"invalid pbkdf2 algorithm","algorithm",o),Gr(i,e,t,{c:r,dkLen:n})}(e,t,r,n,o)};let Ao=Io;function So(e,t,r,n,o){const i=oe(e,"password"),s=oe(t,"salt");return ue(Ao(i,s,r,n,o))}function wo(e){return(1<<e)-1<<8-e&255}function Ro(e){return(1<<e)-1&255}function To(e,t){te("NFKD"),null==t&&(t=vo.wordlist());const r=t.split(e);Z(r.length%3==0&&r.length>=12&&r.length<=24,"invalid mnemonic length","mnemonic","[ REDACTED ]");const n=new Uint8Array(Math.ceil(11*r.length/8));let o=0;for(let e=0;e<r.length;e++){let i=t.getWordIndex(r[e].normalize("NFKD"));Z(i>=0,`invalid mnemonic word at index ${e}`,"mnemonic","[ REDACTED ]");for(let e=0;e<11;e++)i&1<<10-e&&(n[o>>3]|=1<<7-o%8),o++}const i=32*r.length/3,s=wo(r.length/3);return Z((oe(Qr(n.slice(0,i/8)))[0]&s)===(n[n.length-1]&s),"invalid mnemonic checksum","mnemonic","[ REDACTED ]"),ue(n.slice(0,i/8))}function _o(e,t){Z(e.length%4==0&&e.length>=16&&e.length<=32,"invalid entropy size","entropy","[ REDACTED ]"),null==t&&(t=vo.wordlist());const r=[0];let n=11;for(let t=0;t<e.length;t++)n>8?(r[r.length-1]<<=8,r[r.length-1]|=e[t],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=e[t]>>8-n,r.push(e[t]&Ro(8-n)),n+=3);const o=e.length/4,i=parseInt(Qr(e).substring(2,4),16)&wo(o);return r[r.length-1]<<=o,r[r.length-1]|=i>>8-o,t.join(r.map(e=>t.getWord(e)))}So._=Io,So.lock=function(){Oo=!0},So.register=function(e){if(Oo)throw new Error("pbkdf2 is locked");Ao=e},Object.freeze(So);const No={};class Co{phrase;password;wordlist;entropy;constructor(e,t,r,n,o){null==n&&(n=""),null==o&&(o=vo.wordlist()),re(e,No,"Mnemonic"),W(this,{phrase:r,password:n,wordlist:o,entropy:t})}computeSeed(){const e=lr("mnemonic"+this.password,"NFKD");return So(lr(this.phrase,"NFKD"),e,2048,64,"sha512")}static fromPhrase(e,t,r){const n=To(e,r);return e=_o(oe(n),r),new Co(No,n,e,t,r)}static fromEntropy(e,t,r){const n=oe(e,"entropy"),o=_o(n,r);return new Co(No,ue(n),o,t,r)}static entropyToPhrase(e,t){return _o(oe(e,"entropy"),t)}static phraseToEntropy(e,t){return To(e,t)}static isValidMnemonic(e,t){try{return To(e,t),!0}catch(e){}return!1}}
|
|
21
21
|
/*! MIT License. Copyright 2015-2022 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */
|
|
22
|
-
var Po,Lo,Do,Uo=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},xo=function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r};const Go={16:10,24:12,32:14},Fo=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],ko=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],Bo=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],Mo=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],jo=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],Ko=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],Vo=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],$o=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],Ho=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],Yo=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],qo=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],zo=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Wo=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Jo=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Xo=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Qo(e){const t=[];for(let r=0;r<e.length;r+=4)t.push(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]);return t}class Zo{get key(){return Uo(this,Po,"f").slice()}constructor(e){if(Po.set(this,void 0),Lo.set(this,void 0),Do.set(this,void 0),!(this instanceof Zo))throw Error("AES must be instanitated with `new`");xo(this,Po,new Uint8Array(e),"f");const t=Go[this.key.length];if(null==t)throw new TypeError("invalid key size (must be 16, 24 or 32 bytes)");xo(this,Do,[],"f"),xo(this,Lo,[],"f");for(let e=0;e<=t;e++)Uo(this,Do,"f").push([0,0,0,0]),Uo(this,Lo,"f").push([0,0,0,0]);const r=4*(t+1),n=this.key.length/4,o=Qo(this.key);let i;for(let e=0;e<n;e++)i=e>>2,Uo(this,Do,"f")[i][e%4]=o[e],Uo(this,Lo,"f")[t-i][e%4]=o[e];let s,a=0,c=n;for(;c<r;){if(s=o[n-1],o[0]^=ko[s>>16&255]<<24^ko[s>>8&255]<<16^ko[255&s]<<8^ko[s>>24&255]^Fo[a]<<24,a+=1,8!=n)for(let e=1;e<n;e++)o[e]^=o[e-1];else{for(let e=1;e<n/2;e++)o[e]^=o[e-1];s=o[n/2-1],o[n/2]^=ko[255&s]^ko[s>>8&255]<<8^ko[s>>16&255]<<16^ko[s>>24&255]<<24;for(let e=n/2+1;e<n;e++)o[e]^=o[e-1]}let e,i,u=0;for(;u<n&&c<r;)e=c>>2,i=c%4,Uo(this,Do,"f")[e][i]=o[u],Uo(this,Lo,"f")[t-e][i]=o[u++],c++}for(let e=1;e<t;e++)for(let t=0;t<4;t++)s=Uo(this,Lo,"f")[e][t],Uo(this,Lo,"f")[e][t]=zo[s>>24&255]^Wo[s>>16&255]^Jo[s>>8&255]^Xo[255&s]}encrypt(e){if(16!=e.length)throw new TypeError("invalid plaintext size (must be 16 bytes)");const t=Uo(this,Do,"f").length-1,r=[0,0,0,0];let n=Qo(e);for(let e=0;e<4;e++)n[e]^=Uo(this,Do,"f")[0][e];for(let e=1;e<t;e++){for(let t=0;t<4;t++)r[t]=Mo[n[t]>>24&255]^jo[n[(t+1)%4]>>16&255]^Ko[n[(t+2)%4]>>8&255]^Vo[255&n[(t+3)%4]]^Uo(this,Do,"f")[e][t];n=r.slice()}const o=new Uint8Array(16);let i=0;for(let e=0;e<4;e++)i=Uo(this,Do,"f")[t][e],o[4*e]=255&(ko[n[e]>>24&255]^i>>24),o[4*e+1]=255&(ko[n[(e+1)%4]>>16&255]^i>>16),o[4*e+2]=255&(ko[n[(e+2)%4]>>8&255]^i>>8),o[4*e+3]=255&(ko[255&n[(e+3)%4]]^i);return o}decrypt(e){if(16!=e.length)throw new TypeError("invalid ciphertext size (must be 16 bytes)");const t=Uo(this,Lo,"f").length-1,r=[0,0,0,0];let n=Qo(e);for(let e=0;e<4;e++)n[e]^=Uo(this,Lo,"f")[0][e];for(let e=1;e<t;e++){for(let t=0;t<4;t++)r[t]=$o[n[t]>>24&255]^Ho[n[(t+3)%4]>>16&255]^Yo[n[(t+2)%4]>>8&255]^qo[255&n[(t+1)%4]]^Uo(this,Lo,"f")[e][t];n=r.slice()}const o=new Uint8Array(16);let i=0;for(let e=0;e<4;e++)i=Uo(this,Lo,"f")[t][e],o[4*e]=255&(Bo[n[e]>>24&255]^i>>24),o[4*e+1]=255&(Bo[n[(e+3)%4]>>16&255]^i>>16),o[4*e+2]=255&(Bo[n[(e+2)%4]>>8&255]^i>>8),o[4*e+3]=255&(Bo[255&n[(e+1)%4]]^i);return o}}Po=new WeakMap,Lo=new WeakMap,Do=new WeakMap;class ei{constructor(e,t,r){if(r&&!(this instanceof r))throw new Error(`${e} must be instantiated with "new"`);Object.defineProperties(this,{aes:{enumerable:!0,value:new Zo(t)},name:{enumerable:!0,value:e}})}}var ti,ri,ni=function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r},oi=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class ii extends ei{constructor(e,t){if(super("ECC",e,ii),ti.set(this,void 0),ri.set(this,void 0),t){if(t.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");ni(this,ti,new Uint8Array(t),"f")}else ni(this,ti,new Uint8Array(16),"f");ni(this,ri,this.iv,"f")}get iv(){return new Uint8Array(oi(this,ti,"f"))}encrypt(e){if(e.length%16)throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)");const t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=16){for(let t=0;t<16;t++)oi(this,ri,"f")[t]^=e[r+t];ni(this,ri,this.aes.encrypt(oi(this,ri,"f")),"f"),t.set(oi(this,ri,"f"),r)}return t}decrypt(e){if(e.length%16)throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)");const t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=16){const n=this.aes.decrypt(e.subarray(r,r+16));for(let o=0;o<16;o++)t[r+o]=n[o]^oi(this,ri,"f")[o],oi(this,ri,"f")[o]=e[r+o]}return t}}ti=new WeakMap,ri=new WeakMap;var si,ai=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};new WeakMap,si=new WeakMap,new WeakSet;var ci,ui,li,fi=function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r},hi=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class di extends ei{constructor(e,t){super("CTR",e,di),ci.set(this,void 0),ui.set(this,void 0),li.set(this,void 0),fi(this,li,new Uint8Array(16),"f"),hi(this,li,"f").fill(0),fi(this,ci,hi(this,li,"f"),"f"),fi(this,ui,16,"f"),null==t&&(t=1),"number"==typeof t?this.setCounterValue(t):this.setCounterBytes(t)}get counter(){return new Uint8Array(hi(this,li,"f"))}setCounterValue(e){if(!Number.isInteger(e)||e<0||e>Number.MAX_SAFE_INTEGER)throw new TypeError("invalid counter initial integer value");for(let t=15;t>=0;--t)hi(this,li,"f")[t]=e%256,e=Math.floor(e/256)}setCounterBytes(e){if(16!==e.length)throw new TypeError("invalid counter initial Uint8Array value length");hi(this,li,"f").set(e)}increment(){for(let e=15;e>=0;e--){if(255!==hi(this,li,"f")[e]){hi(this,li,"f")[e]++;break}hi(this,li,"f")[e]=0}}encrypt(e){var t,r;const n=new Uint8Array(e);for(let e=0;e<n.length;e++)16===hi(this,ui,"f")&&(fi(this,ci,this.aes.encrypt(hi(this,li,"f")),"f"),fi(this,ui,0,"f"),this.increment()),n[e]^=hi(this,ci,"f")[(fi(this,ui,(r=hi(this,ui,"f"),t=r++,r),"f"),t)];return n}decrypt(e){return this.encrypt(e)}}ci=new WeakMap,ui=new WeakMap,li=new WeakMap;new WeakMap,new WeakMap,new WeakMap;const pi=(e,t)=>e<<t|e>>>32-t;function gi(e,t,r,n,o,i){let s=e[t++]^r[n++],a=e[t++]^r[n++],c=e[t++]^r[n++],u=e[t++]^r[n++],l=e[t++]^r[n++],f=e[t++]^r[n++],h=e[t++]^r[n++],d=e[t++]^r[n++],p=e[t++]^r[n++],g=e[t++]^r[n++],y=e[t++]^r[n++],m=e[t++]^r[n++],E=e[t++]^r[n++],b=e[t++]^r[n++],v=e[t++]^r[n++],O=e[t++]^r[n++],I=s,A=a,S=c,w=u,R=l,T=f,_=h,N=d,C=p,P=g,L=y,D=m,U=E,x=b,G=v,F=O;for(let e=0;e<8;e+=2)R^=pi(I+U|0,7),C^=pi(R+I|0,9),U^=pi(C+R|0,13),I^=pi(U+C|0,18),P^=pi(T+A|0,7),x^=pi(P+T|0,9),A^=pi(x+P|0,13),T^=pi(A+x|0,18),G^=pi(L+_|0,7),S^=pi(G+L|0,9),_^=pi(S+G|0,13),L^=pi(_+S|0,18),w^=pi(F+D|0,7),N^=pi(w+F|0,9),D^=pi(N+w|0,13),F^=pi(D+N|0,18),A^=pi(I+w|0,7),S^=pi(A+I|0,9),w^=pi(S+A|0,13),I^=pi(w+S|0,18),_^=pi(T+R|0,7),N^=pi(_+T|0,9),R^=pi(N+_|0,13),T^=pi(R+N|0,18),D^=pi(L+P|0,7),C^=pi(D+L|0,9),P^=pi(C+D|0,13),L^=pi(P+C|0,18),U^=pi(F+G|0,7),x^=pi(U+F|0,9),G^=pi(x+U|0,13),F^=pi(G+x|0,18);o[i++]=s+I|0,o[i++]=a+A|0,o[i++]=c+S|0,o[i++]=u+w|0,o[i++]=l+R|0,o[i++]=f+T|0,o[i++]=h+_|0,o[i++]=d+N|0,o[i++]=p+C|0,o[i++]=g+P|0,o[i++]=y+L|0,o[i++]=m+D|0,o[i++]=E+U|0,o[i++]=b+x|0,o[i++]=v+G|0,o[i++]=O+F|0}function yi(e,t,r,n,o){let i=n+0,s=n+16*o;for(let n=0;n<16;n++)r[s+n]=e[t+16*(2*o-1)+n];for(let n=0;n<o;n++,i+=16,t+=16)gi(r,s,e,t,r,i),n>0&&(s+=16),gi(r,i,e,t+=16,r,s)}function mi(e,r,n){const o=T({dkLen:32,asyncTick:10,maxmem:1073742848},n),{N:i,r:s,p:a,dkLen:c,asyncTick:u,maxmem:l,onProgress:f}=o;if(t(i),t(s),t(a),t(c),t(u),t(l),void 0!==f&&"function"!=typeof f)throw new Error("progressCb should be function");const h=128*s,d=h/4;if(i<=1||i&i-1||i>=2**(h/8)||i>2**32)throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32");if(a<0||a>137438953440/h)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(c<0||c>137438953440)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");const p=h*(i+a);if(p>l)throw new Error(`Scrypt: parameters too large, ${p} (128 * r * (N + p)) > ${l} (maxmem)`);const g=Gr(Re,e,r,{c:1,dkLen:h*a}),y=b(g),m=b(new Uint8Array(h*i)),E=b(new Uint8Array(h));let v=()=>{};if(f){const e=2*i*a,t=Math.max(Math.floor(e/1e4),1);let r=0;v=()=>{r++,!f||r%t&&r!==e||f(r/e)}}return{N:i,r:s,p:a,dkLen:c,blockSize32:d,V:m,B32:y,B:g,tmp:E,blockMixCb:v,asyncTick:u}}function Ei(e,t,r,n,o){const i=Gr(Re,e,r,{c:1,dkLen:t});return r.fill(0),n.fill(0),o.fill(0),i}let bi=!1,vi=!1;const Oi=async function(e,t,r,n,o,i,s){return await async function(e,t,r){const{N:n,r:o,p:i,dkLen:s,blockSize32:a,V:c,B32:u,B:l,tmp:f,blockMixCb:h,asyncTick:d}=mi(e,t,r);for(let e=0;e<i;e++){const t=a*e;for(let e=0;e<a;e++)c[e]=u[t+e];let r=0;await A(n-1,d,()=>{yi(c,r,c,r+=a,o),h()}),yi(c,(n-1)*a,u,t,o),h(),await A(n,d,()=>{const e=u[t+a-16]%n;for(let r=0;r<a;r++)f[r]=u[t+r]^c[e*a+r];yi(f,0,u,t,o),h()})}return Ei(e,s,l,c,f)}(e,t,{N:r,r:n,p:o,dkLen:i,onProgress:s})},Ii=function(e,t,r,n,o,i){return function(e,t,r){const{N:n,r:o,p:i,dkLen:s,blockSize32:a,V:c,B32:u,B:l,tmp:f,blockMixCb:h}=mi(e,t,r);for(let e=0;e<i;e++){const t=a*e;for(let e=0;e<a;e++)c[e]=u[t+e];for(let e=0,t=0;e<n-1;e++)yi(c,t,c,t+=a,o),h();yi(c,(n-1)*a,u,t,o),h();for(let e=0;e<n;e++){const e=u[t+a-16]%n;for(let r=0;r<a;r++)f[r]=u[t+r]^c[e*a+r];yi(f,0,u,t,o),h()}}return Ei(e,s,l,c,f)}(e,t,{N:r,r:n,p:o,dkLen:i})};let Ai=Oi,Si=Ii;async function wi(e,t,r,n,o,i,s){const a=oe(e,"passwd"),c=oe(t,"salt");return ue(await Ai(a,c,r,n,o,i,s))}function Ri(e,t,r,n,o,i){const s=oe(e,"passwd"),a=oe(t,"salt");return ue(Si(s,a,r,n,o,i))}function Ti(e){const t=oe(e,"randomBytes");t[6]=15&t[6]|64,t[8]=63&t[8]|128;const r=ue(t);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}function _i(e){return"string"!=typeof e||e.startsWith("0x")||(e="0x"+e),ie(e)}function Ni(e,t){for(e=String(e);e.length<t;)e="0"+e;return e}function Ci(e){return"string"==typeof e?lr(e,"NFKC"):ie(e)}function Pi(e,t){const r=t.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);Z(null!=r,"invalid path","path",t);const n=r[1],o=r[3],i="!"===r[4];let s=e;for(const e of n.toLowerCase().split(".")){if(Array.isArray(s)){if(!e.match(/^[0-9]+$/))break;s=s[parseInt(e)]}else if("object"==typeof s){let t=null;for(const r in s)if(r.toLowerCase()===e){t=s[r];break}s=t}else s=null;if(null==s)break}if(Z(!i||null!=s,"missing required value","path",n),o&&null!=s){if("int"===o){if("string"==typeof s&&s.match(/^-?[0-9]+$/))return parseInt(s);if(Number.isSafeInteger(s))return s}if("number"===o&&"string"==typeof s&&s.match(/^-?[0-9.]*$/))return parseFloat(s);if("data"===o&&"string"==typeof s)return _i(s);if("array"===o&&Array.isArray(s))return s;if(o===typeof s)return s;Z(!1,`wrong type found for ${o} `,"path",n)}return s}wi._=Oi,wi.lock=function(){vi=!0},wi.register=function(e){if(vi)throw new Error("scrypt is locked");Ai=e},Object.freeze(wi),Ri._=Ii,Ri.lock=function(){bi=!0},Ri.register=function(e){if(bi)throw new Error("scryptSync is locked");Si=e},Object.freeze(Ri);const Li="m/44'/60'/0'/0/0";function Di(e){try{const t=JSON.parse(e);if(3===(null!=t.version?parseInt(t.version):0))return!0}catch(e){}return!1}function Ui(e,t){const r=oe(t),n=Pi(e,"crypto.ciphertext:data!");Z(ue(Ee(le([r.slice(16,32),n]))).substring(2)===Pi(e,"crypto.mac:string!").toLowerCase(),"incorrect password","password","[ REDACTED ]");const o=function(e,t,r){if("aes-128-ctr"===Pi(e,"crypto.cipher:string")){const n=Pi(e,"crypto.cipherparams.iv:data!");return ue(new di(t,n).decrypt(r))}Q(!1,"unsupported cipher","UNSUPPORTED_OPERATION",{operation:"decrypt"})}(e,r.slice(0,16),n),i=cn(o);if(e.address){let t=e.address.toLowerCase();t.startsWith("0x")||(t="0x"+t),Z(sr(t)===i,"keystore address/privateKey mismatch","address",e.address)}const s={address:i,privateKey:o};if("0.1"===Pi(e,"x-ethers.version:string")){const t=r.slice(32,64),n=Pi(e,"x-ethers.mnemonicCiphertext:data!"),o=Pi(e,"x-ethers.mnemonicCounter:data!"),i=new di(t,o);s.mnemonic={path:Pi(e,"x-ethers.path:string")||Li,locale:Pi(e,"x-ethers.locale:string")||"en",entropy:ue(oe(i.decrypt(n)))}}return s}function xi(e){const t=Pi(e,"crypto.kdf:string");if(t&&"string"==typeof t){if("scrypt"===t.toLowerCase()){const r=Pi(e,"crypto.kdfparams.salt:data!"),n=Pi(e,"crypto.kdfparams.n:int!"),o=Pi(e,"crypto.kdfparams.r:int!"),i=Pi(e,"crypto.kdfparams.p:int!");Z(n>0&&!(n&n-1),"invalid kdf.N","kdf.N",n),Z(o>0&&i>0,"invalid kdf","kdf",t);const s=Pi(e,"crypto.kdfparams.dklen:int!");return Z(32===s,"invalid kdf.dklen","kdf.dflen",s),{name:"scrypt",salt:r,N:n,r:o,p:i,dkLen:64}}if("pbkdf2"===t.toLowerCase()){const t=Pi(e,"crypto.kdfparams.salt:data!"),r=Pi(e,"crypto.kdfparams.prf:string!"),n=r.split("-").pop();Z("sha256"===n||"sha512"===n,"invalid kdf.pdf","kdf.pdf",r);const o=Pi(e,"crypto.kdfparams.c:int!"),i=Pi(e,"crypto.kdfparams.dklen:int!");return Z(32===i,"invalid kdf.dklen","kdf.dklen",i),{name:"pbkdf2",salt:t,count:o,dkLen:i,algorithm:n}}}Z(!1,"unsupported key-derivation function","kdf",t)}function Gi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Fi(e){const t=null!=e.salt?oe(e.salt,"options.salt"):so(32);let r=1<<17,n=8,o=1;return e.scrypt&&(e.scrypt.N&&(r=e.scrypt.N),e.scrypt.r&&(n=e.scrypt.r),e.scrypt.p&&(o=e.scrypt.p)),Z("number"==typeof r&&r>0&&Number.isSafeInteger(r)&&(BigInt(r)&BigInt(r-1))===BigInt(0),"invalid scrypt N parameter","options.N",r),Z("number"==typeof n&&n>0&&Number.isSafeInteger(n),"invalid scrypt r parameter","options.r",n),Z("number"==typeof o&&o>0&&Number.isSafeInteger(o),"invalid scrypt p parameter","options.p",o),{name:"scrypt",dkLen:32,salt:t,N:r,r:n,p:o}}function ki(e,t,r,n){const o=oe(r.privateKey,"privateKey"),i=null!=n.iv?oe(n.iv,"options.iv"):so(16);Z(16===i.length,"invalid options.iv length","options.iv",n.iv);const s=null!=n.uuid?oe(n.uuid,"options.uuid"):so(16);Z(16===s.length,"invalid options.uuid length","options.uuid",n.iv);const a=e.slice(0,16),c=e.slice(16,32),u=oe(new di(a,i).encrypt(o)),l=Ee(le([c,u])),f={address:r.address.substring(2).toLowerCase(),id:Ti(s),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:ue(i).substring(2)},ciphertext:ue(u).substring(2),kdf:"scrypt",kdfparams:{salt:ue(t.salt).substring(2),n:t.N,dklen:32,p:t.p,r:t.r},mac:l.substring(2)}};if(r.mnemonic){const t=null!=n.client?n.client:`ethers/${Y}`,o=r.mnemonic.path||Li,i=r.mnemonic.locale||"en",s=e.slice(32,64),a=oe(r.mnemonic.entropy,"account.mnemonic.entropy"),c=so(16),u=oe(new di(s,c).encrypt(a)),l=new Date,h="UTC--"+(l.getUTCFullYear()+"-"+Ni(l.getUTCMonth()+1,2)+"-"+Ni(l.getUTCDate(),2)+"T"+Ni(l.getUTCHours(),2)+"-"+Ni(l.getUTCMinutes(),2)+"-"+Ni(l.getUTCSeconds(),2)+".0Z")+"--"+f.address;f["x-ethers"]={client:t,gethFilename:h,path:o,locale:i,mnemonicCounter:ue(c).substring(2),mnemonicCiphertext:ue(u).substring(2),version:"0.1"}}return JSON.stringify(f)}function Bi(e,t,r){null==r&&(r={});const n=Ci(t),o=Fi(r);return ki(oe(Ri(n,o.salt,o.N,o.r,o.p,64)),o,e,r)}async function Mi(e,t,r){null==r&&(r={});const n=Ci(t),o=Fi(r);return ki(oe(await wi(n,o.salt,o.N,o.r,o.p,64,r.progressCallback)),o,e,r)}const ji="m/44'/60'/0'/0/0",Ki=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]),Vi=2147483648,$i=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");function Hi(e,t){let r="";for(;e;)r="0123456789abcdef"[e%16]+r,e=Math.trunc(e/16);for(;r.length<2*t;)r="0"+r;return"0x"+r}function Yi(e){const t=oe(e);return function(e){const t=oe(e);let r=Gt(t),n="";for(;r;)n=ao[Number(r%fo)]+n,r/=fo;for(let e=0;e<t.length&&!t[e];e++)n=ao[0]+n;return n}(le([t,he(Qr(Qr(t)),0,4)]))}const qi={};function zi(e,t,r,n){const o=new Uint8Array(37);e&Vi?(Q(null!=n,"cannot derive child of neutered node","UNSUPPORTED_OPERATION",{operation:"deriveChild"}),o.set(oe(n),1)):o.set(oe(r));for(let t=24;t>=0;t-=8)o[33+(t>>3)]=e>>24-t&255;const i=oe(kn("sha512",t,o));return{IL:i.slice(0,32),IR:i.slice(32)}}function Wi(e,t){const r=t.split("/");Z(r.length>0,"invalid path","path",t),"m"===r[0]&&(Z(0===e.depth,`cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${e.depth}`,"path",t),r.shift());let n=e;for(let e=0;e<r.length;e++){const t=r[e];if(t.match(/^[0-9]+'$/)){const r=parseInt(t.substring(0,t.length-1));Z(r<Vi,"invalid path index",`path[${e}]`,t),n=n.deriveChild(Vi+r)}else if(t.match(/^[0-9]+$/)){const r=parseInt(t);Z(r<Vi,"invalid path index",`path[${e}]`,t),n=n.deriveChild(r)}else Z(!1,"invalid path component",`path[${e}]`,t)}return n}class Ji extends Un{publicKey;fingerprint;parentFingerprint;mnemonic;chainCode;path;index;depth;constructor(e,t,r,n,o,i,s,a,c){super(t,c),re(e,qi,"HDNodeWallet"),W(this,{publicKey:t.compressedPublicKey});W(this,{parentFingerprint:r,fingerprint:he(ro(Qr(this.publicKey)),0,4),chainCode:n,path:o,index:i,depth:s}),W(this,{mnemonic:a})}connect(e){return new Ji(qi,this.signingKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.mnemonic,e)}#D(){const e={address:this.address,privateKey:this.privateKey},t=this.mnemonic;return this.path&&t&&"en"===t.wordlist.locale&&""===t.password&&(e.mnemonic={path:this.path,locale:"en",entropy:t.entropy}),e}async encrypt(e,t){return await Mi(this.#D(),e,{progressCallback:t})}encryptSync(e){return Bi(this.#D(),e)}get extendedKey(){return Q(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),Yi(le(["0x0488ADE4",Hi(this.depth,1),this.parentFingerprint,Hi(this.index,4),this.chainCode,le(["0x00",this.privateKey])]))}hasPath(){return null!=this.path}neuter(){return new Xi(qi,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.provider)}deriveChild(e){const t=Ft(e,"index");Z(t<=4294967295,"invalid index","index",t);let r=this.path;r&&(r+="/"+(2147483647&t),t&Vi&&(r+="'"));const{IR:n,IL:o}=zi(t,this.chainCode,this.publicKey,this.privateKey),i=new Zt(kt((Gt(o)+BigInt(this.privateKey))%$i,32));return new Ji(qi,i,this.fingerprint,ue(n),r,t,this.depth+1,this.mnemonic,this.provider)}derivePath(e){return Wi(this,e)}static#U(e,t){Z(ae(e),"invalid seed","seed","[REDACTED]");const r=oe(e,"seed");Z(r.length>=16&&r.length<=64,"invalid seed","seed","[REDACTED]");const n=oe(kn("sha512",Ki,r)),o=new Zt(ue(n.slice(0,32)));return new Ji(qi,o,"0x00000000",ue(n.slice(32)),"m",0,0,t,null)}static fromExtendedKey(e){const t=Bt(function(e){let t=lo;for(let r=0;r<e.length;r++)t*=fo,t+=uo(e[r]);return t}(e));Z(82===t.length||Yi(t.slice(0,78))===e,"invalid extended key","extendedKey","[ REDACTED ]");const r=t[4],n=ue(t.slice(5,9)),o=parseInt(ue(t.slice(9,13)).substring(2),16),i=ue(t.slice(13,45)),s=t.slice(45,78);switch(ue(t.slice(0,4))){case"0x0488b21e":case"0x043587cf":{const e=ue(s);return new Xi(qi,cn(e),e,n,i,null,o,r,null)}case"0x0488ade4":case"0x04358394 ":if(0!==s[0])break;return new Ji(qi,new Zt(s.slice(1)),n,i,null,o,r,null,null)}Z(!1,"invalid extended key prefix","extendedKey","[ REDACTED ]")}static createRandom(e,t,r){null==e&&(e=""),null==t&&(t=ji),null==r&&(r=vo.wordlist());const n=Co.fromEntropy(so(16),e,r);return Ji.#U(n.computeSeed(),n).derivePath(t)}static fromMnemonic(e,t){return t||(t=ji),Ji.#U(e.computeSeed(),e).derivePath(t)}static fromPhrase(e,t,r,n){null==t&&(t=""),null==r&&(r=ji),null==n&&(n=vo.wordlist());const o=Co.fromPhrase(e,t,n);return Ji.#U(o.computeSeed(),o).derivePath(r)}static fromSeed(e){return Ji.#U(e,null)}}class Xi extends Dn{publicKey;fingerprint;parentFingerprint;chainCode;path;index;depth;constructor(e,t,r,n,o,i,s,a,c){super(t,c),re(e,qi,"HDNodeVoidWallet"),W(this,{publicKey:r});W(this,{publicKey:r,fingerprint:he(ro(Qr(r)),0,4),parentFingerprint:n,chainCode:o,path:i,index:s,depth:a})}connect(e){return new Xi(qi,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,e)}get extendedKey(){return Q(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),Yi(le(["0x0488B21E",Hi(this.depth,1),this.parentFingerprint,Hi(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return null!=this.path}deriveChild(e){const t=Ft(e,"index");Z(t<=4294967295,"invalid index","index",t);let r=this.path;r&&(r+="/"+(2147483647&t),t&Vi&&(r+="'"));const{IR:n,IL:o}=zi(t,this.chainCode,this.publicKey,null),i=Zt.addPoints(o,this.publicKey,!0),s=cn(i);return new Xi(qi,s,i,this.fingerprint,ue(n),r,t,this.depth+1,this.provider)}derivePath(e){return Wi(this,e)}}function Qi(e){try{if(JSON.parse(e).encseed)return!0}catch(e){}return!1}function Zi(e,t){const r=JSON.parse(e),n=Ci(t),o=sr(Pi(r,"ethaddr:string!")),i=_i(Pi(r,"encseed:string!"));Z(i&&i.length%16==0,"invalid encseed","json",e);const s=oe(So(n,n,2e3,32,"sha256")).slice(0,16),a=i.slice(0,16),c=i.slice(16),u=function(e){if(e.length<16)throw new TypeError("PKCS#7 invalid length");const t=e[e.length-1];if(t>16)throw new TypeError("PKCS#7 padding byte out of range");const r=e.length-t;for(let n=0;n<t;n++)if(e[r+n]!==t)throw new TypeError("PKCS#7 invalid padding byte");return new Uint8Array(e.subarray(0,r))}(oe(new ii(s,a).decrypt(c)));let l="";for(let e=0;e<u.length;e++)l+=String.fromCharCode(u[e]);return{address:o,privateKey:mr(l)}}function es(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}class ts extends Un{constructor(e,t){"string"!=typeof e||e.startsWith("0x")||(e="0x"+e),super("string"==typeof e?new Zt(e):e,t)}connect(e){return new ts(this.signingKey,e)}async encrypt(e,t){const r={address:this.address,privateKey:this.privateKey};return await Mi(r,e,{progressCallback:t})}encryptSync(e){return Bi({address:this.address,privateKey:this.privateKey},e)}static#x(e){if(Z(e,"invalid JSON wallet","json","[ REDACTED ]"),"mnemonic"in e&&e.mnemonic&&"en"===e.mnemonic.locale){const t=Co.fromEntropy(e.mnemonic.entropy),r=Ji.fromMnemonic(t,e.mnemonic.path);if(r.address===e.address&&r.privateKey===e.privateKey)return r;console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key")}const t=new ts(e.privateKey);return Z(t.address===e.address,"address/privateKey mismatch","json","[ REDACTED ]"),t}static async fromEncryptedJson(e,t,r){let n=null;return Di(e)?n=await async function(e,t,r){const n=JSON.parse(e),o=Ci(t),i=xi(n);if("pbkdf2"===i.name){r&&(r(0),await Gi(0));const{salt:e,count:t,dkLen:s,algorithm:a}=i,c=So(o,e,t,s,a);return r&&(r(1),await Gi(0)),Ui(n,c)}Q("scrypt"===i.name,"cannot be reached","UNKNOWN_ERROR",{params:i});const{salt:s,N:a,r:c,p:u,dkLen:l}=i;return Ui(n,await wi(o,s,a,c,u,l,r))}(e,t,r):Qi(e)&&(r&&(r(0),await es(0)),n=Zi(e,t),r&&(r(1),await es(0))),ts.#x(n)}static fromEncryptedJsonSync(e,t){let r=null;return Di(e)?r=function(e,t){const r=JSON.parse(e),n=Ci(t),o=xi(r);if("pbkdf2"===o.name){const{salt:e,count:t,dkLen:i,algorithm:s}=o;return Ui(r,So(n,e,t,i,s))}Q("scrypt"===o.name,"cannot be reached","UNKNOWN_ERROR",{params:o});const{salt:i,N:s,r:a,p:c,dkLen:u}=o;return Ui(r,Ri(n,i,s,a,c,u))}(e,t):Qi(e)?r=Zi(e,t):Z(!1,"invalid JSON wallet","json","[ REDACTED ]"),ts.#x(r)}static createRandom(e){const t=Ji.createRandom();return e?t.connect(e):t}static fromPhrase(e,t){const r=Ji.fromPhrase(e);return t?r.connect(t):r}}var rs=r(455),ns=r(952),os=r(770);function is(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return ss(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ss(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw i}}}}function ss(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function as(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return cs(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(cs(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,cs(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,cs(f,"constructor",u),cs(u,"constructor",c),c.displayName="GeneratorFunction",cs(u,o,"GeneratorFunction"),cs(f),cs(f,o,"Generator"),cs(f,n,function(){return this}),cs(f,"toString",function(){return"[object Generator]"}),(as=function(){return{w:i,m:h}})()}function cs(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}cs=function(e,t,r,n){function i(t,r){cs(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},cs(e,t,r,n)}function us(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function ls(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?us(Object(r),!0).forEach(function(t){fs(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):us(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function fs(e,t,r){return(t=ys(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hs(e){return hs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hs(e)}function ds(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ps(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ys(n.key),n)}}function gs(e,t,r){return t&&ps(e.prototype,t),r&&ps(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ys(e){var t=function(e,t){if("object"!=hs(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=hs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==hs(t)?t:t+""}function ms(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function Es(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){ms(i,n,o,s,a,"next",e)}function a(e){ms(i,n,o,s,a,"throw",e)}s(void 0)})}}var bs=[],vs=!1,Os="0.4.1";function Is(e){return new Promise(function(t,r){bs.push({task:e,resolve:t,reject:r}),As()})}function As(){return Ss.apply(this,arguments)}function Ss(){return(Ss=Es(as().m(function e(){var t,r,n;return as().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!vs){e.n=1;break}return e.a(2);case 1:if(t=bs.shift()){e.n=2;break}return e.a(2);case 2:return vs=!0,e.p=3,e.n=4,t.task();case 4:r=e.v,t.resolve(r),e.n=6;break;case 5:e.p=5,n=e.v,t.reject(n);case 6:return e.p=6,vs=!1,As(),e.f(6);case 7:return e.a(2)}},e,null,[[3,5,6,7]])}))).apply(this,arguments)}var ws=function(){function e(t,r){var n,o=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(ds(this,e),this.applicationId=t,this.providerId=r,this.sessionId="",this.signature="",this.timestamp=Date.now().toString(),this.parameters={},this.context={contextAddress:"0x0",contextMessage:"sample context"},this.redirectUrl="",this.sdkVersion="ext-".concat(Os),this.resolvedProviderVersion="",this.jsonProofResponse=!1,this.extensionID=i.extensionID||"",this.providerVersion=i.providerVersion||"",this.acceptAiProviders=!!i.acceptAiProviders,this.callbackUrl=i.callbackUrl||"",this._backgroundInitialized=!1,this._ctx=null,this._listeners={started:new Set,completed:new Set,error:new Set,progress:new Set},this._boundWindowListener=this._handleWindowMessage.bind(this),window.addEventListener("message",this._boundWindowListener),this._mode="undefined"!=typeof chrome&&chrome.runtime&&"chrome-extension:"===(null===(n=location)||void 0===n?void 0:n.protocol)?"extension":"web","extension"===this._mode){this._boundChromeHandler=function(e){var t=e||{},r=t.action,n=t.data,i=t.error,s=null==n?void 0:n.sessionId;if(!o.sessionId||o.sessionId===s)if("PROOF_SUBMITTED"===r){var a=(null==n?void 0:n.formattedProofs)||(null==n?void 0:n.proof)||n;o._emit("completed",a)}else"PROOF_SUBMISSION_FAILED"!==r&&"PROOF_GENERATION_FAILED"!==r||o._emit("error",i||new Error("Verification failed"))};try{chrome.runtime.onMessage.addListener(this._boundChromeHandler)}catch(e){}}}return gs(e,[{key:"setAppCallbackUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e||"string"!=typeof e)throw new Error("callbackUrl must be a non-empty string");this.callbackUrl=e,this.jsonProofResponse=!!t}},{key:"setRedirectUrl",value:function(e){if(!e||"string"!=typeof e)throw new Error("redirectUrl must be a non-empty string");this.redirectUrl=e}},{key:"addContext",value:function(e,t){if(!e||!t)throw new Error("Both address and message are required");this.context={contextAddress:String(e),contextMessage:String(t)}}},{key:"setParams",value:function(e){if(!e||"object"!==hs(e))throw new Error("params must be an object");this.parameters=ls(ls({},this.parameters),e)}},{key:"getStatusUrl",value:function(){if(!this.sessionId)throw new Error("Session not initialized");return ns.Sn.STATUS_URL(this.sessionId)}},{key:"on",value:function(e,t){var r=this;if(!this._listeners[e])throw new Error("Unknown event: ".concat(e));return this._listeners[e].add(t),function(){return r.off(e,t)}}},{key:"off",value:function(e,t){this._listeners[e]&&this._listeners[e].delete(t)}},{key:"startVerification",value:(i=Es(as().m(function e(){var t=this;return as().w(function(e){for(;;)if(0===e.n)return e.a(2,Is(function(){return t._startVerificationInternal()}))},e)})),function(){return i.apply(this,arguments)})},{key:"cancel",value:(o=Es(as().m(function e(){var t,r=this,n=arguments;return as().w(function(e){for(;;)switch(e.n){case 0:if(t=n.length>0&&void 0!==n[0]?n[0]:5e3,this.sessionId){e.n=1;break}return e.a(2);case 1:return e.a(2,new Promise(function(e){var n=!1,o=r.on("error",function(){n||(n=!0,o(),e(!0))});window.postMessage({action:ns.vQ.CANCEL_VERIFICATION,messageId:r.sessionId,extensionID:r.extensionID},"*"),setTimeout(function(){n||(o(),e(!1))},t)}))}},e,this)})),function(){return o.apply(this,arguments)})},{key:"_startVerificationInternal",value:(n=Es(as().m(function e(){var t,r,n=this;return as().w(function(e){for(;;)switch(e.n){case 0:if(this.sessionId){e.n=1;break}throw new Error("Session not initialized");case 1:if(this.signature){e.n=2;break}throw new Error("Signature not set");case 2:return t={sessionId:this.sessionId,providerId:this.providerId,applicationId:this.applicationId,signature:this.signature,timestamp:this.timestamp,callbackUrl:this.callbackUrl||"",context:JSON.stringify(this.context||{}),parameters:this.parameters||{},redirectUrl:this.redirectUrl||"",acceptAiProviders:!!this.acceptAiProviders,sdkVersion:this.sdkVersion,providerVersion:this.providerVersion||"",resolvedProviderVersion:this.resolvedProviderVersion||"",jsonProofResponse:!!this.jsonProofResponse},r=this.sessionId,e.a(2,new Promise(function(e,o){var i=n.on("started",function(){}),s=n.on("completed",function(t){c(),e(t)}),a=n.on("error",function(e){c(),o(e)}),c=function(){i&&i(),s&&s(),a&&a()};if("extension"===n._mode)try{chrome.runtime.sendMessage({action:"START_VERIFICATION",source:"content-script",target:"background",data:t},function(e){e&&e.success&&n._emit("started",{sessionId:n.sessionId,messageId:r})})}catch(e){n._emit("error",e instanceof Error?e:new Error(String(e)))}else{if(!n.extensionID)return void n._emit("error",new Error("extensionID is required when running on a web page"));window.postMessage({action:ns.vQ.START_VERIFICATION,messageId:r,data:t,extensionID:n.extensionID},"*")}}))}},e,this)})),function(){return n.apply(this,arguments)})},{key:"dispose",value:function(){var e;if(window.removeEventListener("message",this._boundWindowListener),this._boundChromeHandler&&null!==(e=chrome)&&void 0!==e&&null!==(e=e.runtime)&&void 0!==e&&null!==(e=e.onMessage)&&void 0!==e&&e.removeListener)try{chrome.runtime.onMessage.removeListener(this._boundChromeHandler)}catch(e){}this._listeners.started.clear(),this._listeners.completed.clear(),this._listeners.error.clear(),this._listeners.progress.clear()}},{key:"_initSession",value:(r=Es(as().m(function e(t){var r,n;return as().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,fetch("".concat(ns.fn,"/api/sdk/init/session/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});case 1:return r=e.v,e.n=2,r.json().catch(function(){return{}});case 2:if(n=e.v,r.ok){e.n=3;break}throw new Error((null==n?void 0:n.message)||"Failed to initialize session");case 3:return e.a(2,n)}},e)})),function(e){return r.apply(this,arguments)})},{key:"_emit",value:function(e,t){if(this._listeners[e]){var r,n=is(this._listeners[e]);try{for(n.s();!(r=n.n()).done;){var o=r.value;try{o(t)}catch(e){}}}catch(e){n.e(e)}finally{n.f()}}}},{key:"_handleWindowMessage",value:function(e){if(e.source===window){var t=e.data||{},r=t.action,n=t.messageId,o=t.data,i=t.error;if(!this.sessionId||this.sessionId===n)if(r!==ns.vQ.VERIFICATION_COMPLETED)r!==ns.vQ.VERIFICATION_FAILED?r!==ns.vQ.VERIFICATION_STARTED||this._emit("started",{sessionId:this.sessionId,messageId:n}):this._emit("error",i||new Error("Verification failed"));else{var s=(null==o?void 0:o.proofs)||(null==o?void 0:o.formattedProofs)||o;this._emit("completed",s)}}}}],[{key:"init",value:(t=Es(as().m(function t(r,n,o){var i,s,a,c,u,l,f,h=arguments;return as().w(function(t){for(;;)switch(t.n){case 0:if(i=h.length>3&&void 0!==h[3]?h[3]:{},r&&"string"==typeof r){t.n=1;break}throw new Error("applicationId must be a non-empty string");case 1:if(n&&"string"==typeof n){t.n=2;break}throw new Error("appSecret must be a non-empty string");case 2:if(o&&"string"==typeof o){t.n=3;break}throw new Error("providerId must be a non-empty string");case 3:return s=new e(r,o,i),a='{"providerId":"'.concat(o,'","timestamp":"').concat(s.timestamp,'"}'),c=Ee((new TextEncoder).encode(a)),u=new ts(n),t.n=4,u.signMessage(oe(c));case 4:return l=t.v,s.signature=l,t.n=5,s._initSession({providerId:o,appId:r,timestamp:s.timestamp,signature:l,versionNumber:s.providerVersion||""});case 5:return f=t.v,s.sessionId=f.sessionId||"",s.resolvedProviderVersion=f.resolvedProviderVersion||"",t.a(2,s)}},t)})),function(e,r,n){return t.apply(this,arguments)})},{key:"fromJsonString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="string"==typeof e?JSON.parse(e):e;return this.fromConfig(r,t)}},{key:"fromConfig",value:function(t){var r,n,o,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t||"object"!==hs(t))throw new Error("invalid config");var a=new e(String(t.applicationId||""),String(t.providerId||""),s||{});return a.sessionId=String(t.sessionId||""),a.signature=String(t.signature||""),a.timestamp=String(t.timeStamp||t.timestamp||Date.now()),a.parameters=t.parameters||{},a.context=t.context||a.context,a.callbackUrl=String(t.appCallbackUrl||t.callbackUrl||""),a.jsonProofResponse=!!(null!==(r=t.jsonProofResponse)&&void 0!==r?r:a.jsonProofResponse),a.resolvedProviderVersion=String(t.resolvedProviderVersion||""),a.providerVersion=String(t.providerVersion||""),a.redirectUrl=String(t.redirectUrl||""),a.acceptAiProviders=!!(null!==(n=null!==(o=t.acceptAiProviders)&&void 0!==o?o:null===(i=t.options)||void 0===i?void 0:i.acceptAiProviders)&&void 0!==n?n:a.acceptAiProviders),null!=s&&s.extensionID&&(a.extensionID=String(s.extensionID)),a}}]);var t,r,n,o,i}(),Rs=function(){return gs(function e(){var t;ds(this,e),this._backgroundInitialized=!1,this._ctx=null,this._mode="undefined"!=typeof chrome&&chrome.runtime&&"chrome-extension:"===(null===(t=location)||void 0===t?void 0:t.protocol)?"extension":"web"},[{key:"initializeBackground",value:function(){if(this._backgroundInitialized)return this._ctx;try{var e=(0,rs.A)();return this._backgroundInitialized=!0,this._ctx=e,e}catch(e){throw e}}},{key:"isExtensionInstalled",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.extensionID,r=e.timeout,n=void 0===r?500:r;return new Promise(function(e){var r="reclaim-check-".concat(Date.now()),o=function(t){var n,i;t.source===window&&(null===(n=t.data)||void 0===n?void 0:n.action)===ns.vQ.EXTENSION_RESPONSE&&(null===(i=t.data)||void 0===i?void 0:i.messageId)===r&&(window.removeEventListener("message",o),e(!!t.data.installed))};window.addEventListener("message",o),window.postMessage({action:ns.vQ.CHECK_EXTENSION,extensionID:t,messageId:r},"*"),setTimeout(function(){window.removeEventListener("message",o),e(!1)},n)})}},{key:"getVersion",value:function(){return Os}},{key:"init",value:(e=Es(as().m(function e(t,r,n){var o,i=arguments;return as().w(function(e){for(;;)switch(e.n){case 0:return o=i.length>3&&void 0!==i[3]?i[3]:{},e.n=1,ws.init(t,r,n,o);case 1:return e.a(2,e.v)}},e)})),function(t,r,n){return e.apply(this,arguments)})},{key:"fromJsonString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ws.fromJsonString(e,t)}},{key:"setLogConfig",value:function(e,t){os.Ow.setConfig(e);try{var n;if("extension"===this._mode&&"undefined"!=typeof chrome&&null!==(n=chrome.storage)&&void 0!==n&&n.local){var o=r(859).LOG_CONFIG_STORAGE_KEY;return void chrome.storage.local.set(fs({},o,ls(ls({},os.Ow.config),e)))}}catch(e){}window.postMessage({action:ns.vQ.SET_LOG_CONFIG,extensionID:t,data:{config:e}},"*")}},{key:"getLogConfig",value:function(){return os.Ow.config}}]);var e}(),Ts=new Rs;const _s=Rs})(),module.exports=n})();
|
|
22
|
+
var Po,Lo,Do,Uo=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},xo=function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r};const Go={16:10,24:12,32:14},Fo=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],ko=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],Bo=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],Mo=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],jo=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],Ko=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],Vo=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],$o=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],Ho=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],Yo=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],qo=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],zo=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Wo=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Jo=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Xo=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Qo(e){const t=[];for(let r=0;r<e.length;r+=4)t.push(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]);return t}class Zo{get key(){return Uo(this,Po,"f").slice()}constructor(e){if(Po.set(this,void 0),Lo.set(this,void 0),Do.set(this,void 0),!(this instanceof Zo))throw Error("AES must be instanitated with `new`");xo(this,Po,new Uint8Array(e),"f");const t=Go[this.key.length];if(null==t)throw new TypeError("invalid key size (must be 16, 24 or 32 bytes)");xo(this,Do,[],"f"),xo(this,Lo,[],"f");for(let e=0;e<=t;e++)Uo(this,Do,"f").push([0,0,0,0]),Uo(this,Lo,"f").push([0,0,0,0]);const r=4*(t+1),n=this.key.length/4,o=Qo(this.key);let i;for(let e=0;e<n;e++)i=e>>2,Uo(this,Do,"f")[i][e%4]=o[e],Uo(this,Lo,"f")[t-i][e%4]=o[e];let s,a=0,c=n;for(;c<r;){if(s=o[n-1],o[0]^=ko[s>>16&255]<<24^ko[s>>8&255]<<16^ko[255&s]<<8^ko[s>>24&255]^Fo[a]<<24,a+=1,8!=n)for(let e=1;e<n;e++)o[e]^=o[e-1];else{for(let e=1;e<n/2;e++)o[e]^=o[e-1];s=o[n/2-1],o[n/2]^=ko[255&s]^ko[s>>8&255]<<8^ko[s>>16&255]<<16^ko[s>>24&255]<<24;for(let e=n/2+1;e<n;e++)o[e]^=o[e-1]}let e,i,u=0;for(;u<n&&c<r;)e=c>>2,i=c%4,Uo(this,Do,"f")[e][i]=o[u],Uo(this,Lo,"f")[t-e][i]=o[u++],c++}for(let e=1;e<t;e++)for(let t=0;t<4;t++)s=Uo(this,Lo,"f")[e][t],Uo(this,Lo,"f")[e][t]=zo[s>>24&255]^Wo[s>>16&255]^Jo[s>>8&255]^Xo[255&s]}encrypt(e){if(16!=e.length)throw new TypeError("invalid plaintext size (must be 16 bytes)");const t=Uo(this,Do,"f").length-1,r=[0,0,0,0];let n=Qo(e);for(let e=0;e<4;e++)n[e]^=Uo(this,Do,"f")[0][e];for(let e=1;e<t;e++){for(let t=0;t<4;t++)r[t]=Mo[n[t]>>24&255]^jo[n[(t+1)%4]>>16&255]^Ko[n[(t+2)%4]>>8&255]^Vo[255&n[(t+3)%4]]^Uo(this,Do,"f")[e][t];n=r.slice()}const o=new Uint8Array(16);let i=0;for(let e=0;e<4;e++)i=Uo(this,Do,"f")[t][e],o[4*e]=255&(ko[n[e]>>24&255]^i>>24),o[4*e+1]=255&(ko[n[(e+1)%4]>>16&255]^i>>16),o[4*e+2]=255&(ko[n[(e+2)%4]>>8&255]^i>>8),o[4*e+3]=255&(ko[255&n[(e+3)%4]]^i);return o}decrypt(e){if(16!=e.length)throw new TypeError("invalid ciphertext size (must be 16 bytes)");const t=Uo(this,Lo,"f").length-1,r=[0,0,0,0];let n=Qo(e);for(let e=0;e<4;e++)n[e]^=Uo(this,Lo,"f")[0][e];for(let e=1;e<t;e++){for(let t=0;t<4;t++)r[t]=$o[n[t]>>24&255]^Ho[n[(t+3)%4]>>16&255]^Yo[n[(t+2)%4]>>8&255]^qo[255&n[(t+1)%4]]^Uo(this,Lo,"f")[e][t];n=r.slice()}const o=new Uint8Array(16);let i=0;for(let e=0;e<4;e++)i=Uo(this,Lo,"f")[t][e],o[4*e]=255&(Bo[n[e]>>24&255]^i>>24),o[4*e+1]=255&(Bo[n[(e+3)%4]>>16&255]^i>>16),o[4*e+2]=255&(Bo[n[(e+2)%4]>>8&255]^i>>8),o[4*e+3]=255&(Bo[255&n[(e+1)%4]]^i);return o}}Po=new WeakMap,Lo=new WeakMap,Do=new WeakMap;class ei{constructor(e,t,r){if(r&&!(this instanceof r))throw new Error(`${e} must be instantiated with "new"`);Object.defineProperties(this,{aes:{enumerable:!0,value:new Zo(t)},name:{enumerable:!0,value:e}})}}var ti,ri,ni=function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r},oi=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class ii extends ei{constructor(e,t){if(super("ECC",e,ii),ti.set(this,void 0),ri.set(this,void 0),t){if(t.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");ni(this,ti,new Uint8Array(t),"f")}else ni(this,ti,new Uint8Array(16),"f");ni(this,ri,this.iv,"f")}get iv(){return new Uint8Array(oi(this,ti,"f"))}encrypt(e){if(e.length%16)throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)");const t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=16){for(let t=0;t<16;t++)oi(this,ri,"f")[t]^=e[r+t];ni(this,ri,this.aes.encrypt(oi(this,ri,"f")),"f"),t.set(oi(this,ri,"f"),r)}return t}decrypt(e){if(e.length%16)throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)");const t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=16){const n=this.aes.decrypt(e.subarray(r,r+16));for(let o=0;o<16;o++)t[r+o]=n[o]^oi(this,ri,"f")[o],oi(this,ri,"f")[o]=e[r+o]}return t}}ti=new WeakMap,ri=new WeakMap;var si,ai=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};new WeakMap,si=new WeakMap,new WeakSet;var ci,ui,li,fi=function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r},hi=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class di extends ei{constructor(e,t){super("CTR",e,di),ci.set(this,void 0),ui.set(this,void 0),li.set(this,void 0),fi(this,li,new Uint8Array(16),"f"),hi(this,li,"f").fill(0),fi(this,ci,hi(this,li,"f"),"f"),fi(this,ui,16,"f"),null==t&&(t=1),"number"==typeof t?this.setCounterValue(t):this.setCounterBytes(t)}get counter(){return new Uint8Array(hi(this,li,"f"))}setCounterValue(e){if(!Number.isInteger(e)||e<0||e>Number.MAX_SAFE_INTEGER)throw new TypeError("invalid counter initial integer value");for(let t=15;t>=0;--t)hi(this,li,"f")[t]=e%256,e=Math.floor(e/256)}setCounterBytes(e){if(16!==e.length)throw new TypeError("invalid counter initial Uint8Array value length");hi(this,li,"f").set(e)}increment(){for(let e=15;e>=0;e--){if(255!==hi(this,li,"f")[e]){hi(this,li,"f")[e]++;break}hi(this,li,"f")[e]=0}}encrypt(e){var t,r;const n=new Uint8Array(e);for(let e=0;e<n.length;e++)16===hi(this,ui,"f")&&(fi(this,ci,this.aes.encrypt(hi(this,li,"f")),"f"),fi(this,ui,0,"f"),this.increment()),n[e]^=hi(this,ci,"f")[(fi(this,ui,(r=hi(this,ui,"f"),t=r++,r),"f"),t)];return n}decrypt(e){return this.encrypt(e)}}ci=new WeakMap,ui=new WeakMap,li=new WeakMap;new WeakMap,new WeakMap,new WeakMap;const pi=(e,t)=>e<<t|e>>>32-t;function gi(e,t,r,n,o,i){let s=e[t++]^r[n++],a=e[t++]^r[n++],c=e[t++]^r[n++],u=e[t++]^r[n++],l=e[t++]^r[n++],f=e[t++]^r[n++],h=e[t++]^r[n++],d=e[t++]^r[n++],p=e[t++]^r[n++],g=e[t++]^r[n++],y=e[t++]^r[n++],m=e[t++]^r[n++],E=e[t++]^r[n++],b=e[t++]^r[n++],v=e[t++]^r[n++],O=e[t++]^r[n++],I=s,A=a,S=c,w=u,R=l,T=f,_=h,N=d,C=p,P=g,L=y,D=m,U=E,x=b,G=v,F=O;for(let e=0;e<8;e+=2)R^=pi(I+U|0,7),C^=pi(R+I|0,9),U^=pi(C+R|0,13),I^=pi(U+C|0,18),P^=pi(T+A|0,7),x^=pi(P+T|0,9),A^=pi(x+P|0,13),T^=pi(A+x|0,18),G^=pi(L+_|0,7),S^=pi(G+L|0,9),_^=pi(S+G|0,13),L^=pi(_+S|0,18),w^=pi(F+D|0,7),N^=pi(w+F|0,9),D^=pi(N+w|0,13),F^=pi(D+N|0,18),A^=pi(I+w|0,7),S^=pi(A+I|0,9),w^=pi(S+A|0,13),I^=pi(w+S|0,18),_^=pi(T+R|0,7),N^=pi(_+T|0,9),R^=pi(N+_|0,13),T^=pi(R+N|0,18),D^=pi(L+P|0,7),C^=pi(D+L|0,9),P^=pi(C+D|0,13),L^=pi(P+C|0,18),U^=pi(F+G|0,7),x^=pi(U+F|0,9),G^=pi(x+U|0,13),F^=pi(G+x|0,18);o[i++]=s+I|0,o[i++]=a+A|0,o[i++]=c+S|0,o[i++]=u+w|0,o[i++]=l+R|0,o[i++]=f+T|0,o[i++]=h+_|0,o[i++]=d+N|0,o[i++]=p+C|0,o[i++]=g+P|0,o[i++]=y+L|0,o[i++]=m+D|0,o[i++]=E+U|0,o[i++]=b+x|0,o[i++]=v+G|0,o[i++]=O+F|0}function yi(e,t,r,n,o){let i=n+0,s=n+16*o;for(let n=0;n<16;n++)r[s+n]=e[t+16*(2*o-1)+n];for(let n=0;n<o;n++,i+=16,t+=16)gi(r,s,e,t,r,i),n>0&&(s+=16),gi(r,i,e,t+=16,r,s)}function mi(e,r,n){const o=T({dkLen:32,asyncTick:10,maxmem:1073742848},n),{N:i,r:s,p:a,dkLen:c,asyncTick:u,maxmem:l,onProgress:f}=o;if(t(i),t(s),t(a),t(c),t(u),t(l),void 0!==f&&"function"!=typeof f)throw new Error("progressCb should be function");const h=128*s,d=h/4;if(i<=1||i&i-1||i>=2**(h/8)||i>2**32)throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32");if(a<0||a>137438953440/h)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(c<0||c>137438953440)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");const p=h*(i+a);if(p>l)throw new Error(`Scrypt: parameters too large, ${p} (128 * r * (N + p)) > ${l} (maxmem)`);const g=Gr(Re,e,r,{c:1,dkLen:h*a}),y=b(g),m=b(new Uint8Array(h*i)),E=b(new Uint8Array(h));let v=()=>{};if(f){const e=2*i*a,t=Math.max(Math.floor(e/1e4),1);let r=0;v=()=>{r++,!f||r%t&&r!==e||f(r/e)}}return{N:i,r:s,p:a,dkLen:c,blockSize32:d,V:m,B32:y,B:g,tmp:E,blockMixCb:v,asyncTick:u}}function Ei(e,t,r,n,o){const i=Gr(Re,e,r,{c:1,dkLen:t});return r.fill(0),n.fill(0),o.fill(0),i}let bi=!1,vi=!1;const Oi=async function(e,t,r,n,o,i,s){return await async function(e,t,r){const{N:n,r:o,p:i,dkLen:s,blockSize32:a,V:c,B32:u,B:l,tmp:f,blockMixCb:h,asyncTick:d}=mi(e,t,r);for(let e=0;e<i;e++){const t=a*e;for(let e=0;e<a;e++)c[e]=u[t+e];let r=0;await A(n-1,d,()=>{yi(c,r,c,r+=a,o),h()}),yi(c,(n-1)*a,u,t,o),h(),await A(n,d,()=>{const e=u[t+a-16]%n;for(let r=0;r<a;r++)f[r]=u[t+r]^c[e*a+r];yi(f,0,u,t,o),h()})}return Ei(e,s,l,c,f)}(e,t,{N:r,r:n,p:o,dkLen:i,onProgress:s})},Ii=function(e,t,r,n,o,i){return function(e,t,r){const{N:n,r:o,p:i,dkLen:s,blockSize32:a,V:c,B32:u,B:l,tmp:f,blockMixCb:h}=mi(e,t,r);for(let e=0;e<i;e++){const t=a*e;for(let e=0;e<a;e++)c[e]=u[t+e];for(let e=0,t=0;e<n-1;e++)yi(c,t,c,t+=a,o),h();yi(c,(n-1)*a,u,t,o),h();for(let e=0;e<n;e++){const e=u[t+a-16]%n;for(let r=0;r<a;r++)f[r]=u[t+r]^c[e*a+r];yi(f,0,u,t,o),h()}}return Ei(e,s,l,c,f)}(e,t,{N:r,r:n,p:o,dkLen:i})};let Ai=Oi,Si=Ii;async function wi(e,t,r,n,o,i,s){const a=oe(e,"passwd"),c=oe(t,"salt");return ue(await Ai(a,c,r,n,o,i,s))}function Ri(e,t,r,n,o,i){const s=oe(e,"passwd"),a=oe(t,"salt");return ue(Si(s,a,r,n,o,i))}function Ti(e){const t=oe(e,"randomBytes");t[6]=15&t[6]|64,t[8]=63&t[8]|128;const r=ue(t);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}function _i(e){return"string"!=typeof e||e.startsWith("0x")||(e="0x"+e),ie(e)}function Ni(e,t){for(e=String(e);e.length<t;)e="0"+e;return e}function Ci(e){return"string"==typeof e?lr(e,"NFKC"):ie(e)}function Pi(e,t){const r=t.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);Z(null!=r,"invalid path","path",t);const n=r[1],o=r[3],i="!"===r[4];let s=e;for(const e of n.toLowerCase().split(".")){if(Array.isArray(s)){if(!e.match(/^[0-9]+$/))break;s=s[parseInt(e)]}else if("object"==typeof s){let t=null;for(const r in s)if(r.toLowerCase()===e){t=s[r];break}s=t}else s=null;if(null==s)break}if(Z(!i||null!=s,"missing required value","path",n),o&&null!=s){if("int"===o){if("string"==typeof s&&s.match(/^-?[0-9]+$/))return parseInt(s);if(Number.isSafeInteger(s))return s}if("number"===o&&"string"==typeof s&&s.match(/^-?[0-9.]*$/))return parseFloat(s);if("data"===o&&"string"==typeof s)return _i(s);if("array"===o&&Array.isArray(s))return s;if(o===typeof s)return s;Z(!1,`wrong type found for ${o} `,"path",n)}return s}wi._=Oi,wi.lock=function(){vi=!0},wi.register=function(e){if(vi)throw new Error("scrypt is locked");Ai=e},Object.freeze(wi),Ri._=Ii,Ri.lock=function(){bi=!0},Ri.register=function(e){if(bi)throw new Error("scryptSync is locked");Si=e},Object.freeze(Ri);const Li="m/44'/60'/0'/0/0";function Di(e){try{const t=JSON.parse(e);if(3===(null!=t.version?parseInt(t.version):0))return!0}catch(e){}return!1}function Ui(e,t){const r=oe(t),n=Pi(e,"crypto.ciphertext:data!");Z(ue(Ee(le([r.slice(16,32),n]))).substring(2)===Pi(e,"crypto.mac:string!").toLowerCase(),"incorrect password","password","[ REDACTED ]");const o=function(e,t,r){if("aes-128-ctr"===Pi(e,"crypto.cipher:string")){const n=Pi(e,"crypto.cipherparams.iv:data!");return ue(new di(t,n).decrypt(r))}Q(!1,"unsupported cipher","UNSUPPORTED_OPERATION",{operation:"decrypt"})}(e,r.slice(0,16),n),i=cn(o);if(e.address){let t=e.address.toLowerCase();t.startsWith("0x")||(t="0x"+t),Z(sr(t)===i,"keystore address/privateKey mismatch","address",e.address)}const s={address:i,privateKey:o};if("0.1"===Pi(e,"x-ethers.version:string")){const t=r.slice(32,64),n=Pi(e,"x-ethers.mnemonicCiphertext:data!"),o=Pi(e,"x-ethers.mnemonicCounter:data!"),i=new di(t,o);s.mnemonic={path:Pi(e,"x-ethers.path:string")||Li,locale:Pi(e,"x-ethers.locale:string")||"en",entropy:ue(oe(i.decrypt(n)))}}return s}function xi(e){const t=Pi(e,"crypto.kdf:string");if(t&&"string"==typeof t){if("scrypt"===t.toLowerCase()){const r=Pi(e,"crypto.kdfparams.salt:data!"),n=Pi(e,"crypto.kdfparams.n:int!"),o=Pi(e,"crypto.kdfparams.r:int!"),i=Pi(e,"crypto.kdfparams.p:int!");Z(n>0&&!(n&n-1),"invalid kdf.N","kdf.N",n),Z(o>0&&i>0,"invalid kdf","kdf",t);const s=Pi(e,"crypto.kdfparams.dklen:int!");return Z(32===s,"invalid kdf.dklen","kdf.dflen",s),{name:"scrypt",salt:r,N:n,r:o,p:i,dkLen:64}}if("pbkdf2"===t.toLowerCase()){const t=Pi(e,"crypto.kdfparams.salt:data!"),r=Pi(e,"crypto.kdfparams.prf:string!"),n=r.split("-").pop();Z("sha256"===n||"sha512"===n,"invalid kdf.pdf","kdf.pdf",r);const o=Pi(e,"crypto.kdfparams.c:int!"),i=Pi(e,"crypto.kdfparams.dklen:int!");return Z(32===i,"invalid kdf.dklen","kdf.dklen",i),{name:"pbkdf2",salt:t,count:o,dkLen:i,algorithm:n}}}Z(!1,"unsupported key-derivation function","kdf",t)}function Gi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Fi(e){const t=null!=e.salt?oe(e.salt,"options.salt"):so(32);let r=1<<17,n=8,o=1;return e.scrypt&&(e.scrypt.N&&(r=e.scrypt.N),e.scrypt.r&&(n=e.scrypt.r),e.scrypt.p&&(o=e.scrypt.p)),Z("number"==typeof r&&r>0&&Number.isSafeInteger(r)&&(BigInt(r)&BigInt(r-1))===BigInt(0),"invalid scrypt N parameter","options.N",r),Z("number"==typeof n&&n>0&&Number.isSafeInteger(n),"invalid scrypt r parameter","options.r",n),Z("number"==typeof o&&o>0&&Number.isSafeInteger(o),"invalid scrypt p parameter","options.p",o),{name:"scrypt",dkLen:32,salt:t,N:r,r:n,p:o}}function ki(e,t,r,n){const o=oe(r.privateKey,"privateKey"),i=null!=n.iv?oe(n.iv,"options.iv"):so(16);Z(16===i.length,"invalid options.iv length","options.iv",n.iv);const s=null!=n.uuid?oe(n.uuid,"options.uuid"):so(16);Z(16===s.length,"invalid options.uuid length","options.uuid",n.iv);const a=e.slice(0,16),c=e.slice(16,32),u=oe(new di(a,i).encrypt(o)),l=Ee(le([c,u])),f={address:r.address.substring(2).toLowerCase(),id:Ti(s),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:ue(i).substring(2)},ciphertext:ue(u).substring(2),kdf:"scrypt",kdfparams:{salt:ue(t.salt).substring(2),n:t.N,dklen:32,p:t.p,r:t.r},mac:l.substring(2)}};if(r.mnemonic){const t=null!=n.client?n.client:`ethers/${Y}`,o=r.mnemonic.path||Li,i=r.mnemonic.locale||"en",s=e.slice(32,64),a=oe(r.mnemonic.entropy,"account.mnemonic.entropy"),c=so(16),u=oe(new di(s,c).encrypt(a)),l=new Date,h="UTC--"+(l.getUTCFullYear()+"-"+Ni(l.getUTCMonth()+1,2)+"-"+Ni(l.getUTCDate(),2)+"T"+Ni(l.getUTCHours(),2)+"-"+Ni(l.getUTCMinutes(),2)+"-"+Ni(l.getUTCSeconds(),2)+".0Z")+"--"+f.address;f["x-ethers"]={client:t,gethFilename:h,path:o,locale:i,mnemonicCounter:ue(c).substring(2),mnemonicCiphertext:ue(u).substring(2),version:"0.1"}}return JSON.stringify(f)}function Bi(e,t,r){null==r&&(r={});const n=Ci(t),o=Fi(r);return ki(oe(Ri(n,o.salt,o.N,o.r,o.p,64)),o,e,r)}async function Mi(e,t,r){null==r&&(r={});const n=Ci(t),o=Fi(r);return ki(oe(await wi(n,o.salt,o.N,o.r,o.p,64,r.progressCallback)),o,e,r)}const ji="m/44'/60'/0'/0/0",Ki=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]),Vi=2147483648,$i=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");function Hi(e,t){let r="";for(;e;)r="0123456789abcdef"[e%16]+r,e=Math.trunc(e/16);for(;r.length<2*t;)r="0"+r;return"0x"+r}function Yi(e){const t=oe(e);return function(e){const t=oe(e);let r=Gt(t),n="";for(;r;)n=ao[Number(r%fo)]+n,r/=fo;for(let e=0;e<t.length&&!t[e];e++)n=ao[0]+n;return n}(le([t,he(Qr(Qr(t)),0,4)]))}const qi={};function zi(e,t,r,n){const o=new Uint8Array(37);e&Vi?(Q(null!=n,"cannot derive child of neutered node","UNSUPPORTED_OPERATION",{operation:"deriveChild"}),o.set(oe(n),1)):o.set(oe(r));for(let t=24;t>=0;t-=8)o[33+(t>>3)]=e>>24-t&255;const i=oe(kn("sha512",t,o));return{IL:i.slice(0,32),IR:i.slice(32)}}function Wi(e,t){const r=t.split("/");Z(r.length>0,"invalid path","path",t),"m"===r[0]&&(Z(0===e.depth,`cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${e.depth}`,"path",t),r.shift());let n=e;for(let e=0;e<r.length;e++){const t=r[e];if(t.match(/^[0-9]+'$/)){const r=parseInt(t.substring(0,t.length-1));Z(r<Vi,"invalid path index",`path[${e}]`,t),n=n.deriveChild(Vi+r)}else if(t.match(/^[0-9]+$/)){const r=parseInt(t);Z(r<Vi,"invalid path index",`path[${e}]`,t),n=n.deriveChild(r)}else Z(!1,"invalid path component",`path[${e}]`,t)}return n}class Ji extends Un{publicKey;fingerprint;parentFingerprint;mnemonic;chainCode;path;index;depth;constructor(e,t,r,n,o,i,s,a,c){super(t,c),re(e,qi,"HDNodeWallet"),W(this,{publicKey:t.compressedPublicKey});W(this,{parentFingerprint:r,fingerprint:he(ro(Qr(this.publicKey)),0,4),chainCode:n,path:o,index:i,depth:s}),W(this,{mnemonic:a})}connect(e){return new Ji(qi,this.signingKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.mnemonic,e)}#D(){const e={address:this.address,privateKey:this.privateKey},t=this.mnemonic;return this.path&&t&&"en"===t.wordlist.locale&&""===t.password&&(e.mnemonic={path:this.path,locale:"en",entropy:t.entropy}),e}async encrypt(e,t){return await Mi(this.#D(),e,{progressCallback:t})}encryptSync(e){return Bi(this.#D(),e)}get extendedKey(){return Q(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),Yi(le(["0x0488ADE4",Hi(this.depth,1),this.parentFingerprint,Hi(this.index,4),this.chainCode,le(["0x00",this.privateKey])]))}hasPath(){return null!=this.path}neuter(){return new Xi(qi,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.provider)}deriveChild(e){const t=Ft(e,"index");Z(t<=4294967295,"invalid index","index",t);let r=this.path;r&&(r+="/"+(2147483647&t),t&Vi&&(r+="'"));const{IR:n,IL:o}=zi(t,this.chainCode,this.publicKey,this.privateKey),i=new Zt(kt((Gt(o)+BigInt(this.privateKey))%$i,32));return new Ji(qi,i,this.fingerprint,ue(n),r,t,this.depth+1,this.mnemonic,this.provider)}derivePath(e){return Wi(this,e)}static#U(e,t){Z(ae(e),"invalid seed","seed","[REDACTED]");const r=oe(e,"seed");Z(r.length>=16&&r.length<=64,"invalid seed","seed","[REDACTED]");const n=oe(kn("sha512",Ki,r)),o=new Zt(ue(n.slice(0,32)));return new Ji(qi,o,"0x00000000",ue(n.slice(32)),"m",0,0,t,null)}static fromExtendedKey(e){const t=Bt(function(e){let t=lo;for(let r=0;r<e.length;r++)t*=fo,t+=uo(e[r]);return t}(e));Z(82===t.length||Yi(t.slice(0,78))===e,"invalid extended key","extendedKey","[ REDACTED ]");const r=t[4],n=ue(t.slice(5,9)),o=parseInt(ue(t.slice(9,13)).substring(2),16),i=ue(t.slice(13,45)),s=t.slice(45,78);switch(ue(t.slice(0,4))){case"0x0488b21e":case"0x043587cf":{const e=ue(s);return new Xi(qi,cn(e),e,n,i,null,o,r,null)}case"0x0488ade4":case"0x04358394 ":if(0!==s[0])break;return new Ji(qi,new Zt(s.slice(1)),n,i,null,o,r,null,null)}Z(!1,"invalid extended key prefix","extendedKey","[ REDACTED ]")}static createRandom(e,t,r){null==e&&(e=""),null==t&&(t=ji),null==r&&(r=vo.wordlist());const n=Co.fromEntropy(so(16),e,r);return Ji.#U(n.computeSeed(),n).derivePath(t)}static fromMnemonic(e,t){return t||(t=ji),Ji.#U(e.computeSeed(),e).derivePath(t)}static fromPhrase(e,t,r,n){null==t&&(t=""),null==r&&(r=ji),null==n&&(n=vo.wordlist());const o=Co.fromPhrase(e,t,n);return Ji.#U(o.computeSeed(),o).derivePath(r)}static fromSeed(e){return Ji.#U(e,null)}}class Xi extends Dn{publicKey;fingerprint;parentFingerprint;chainCode;path;index;depth;constructor(e,t,r,n,o,i,s,a,c){super(t,c),re(e,qi,"HDNodeVoidWallet"),W(this,{publicKey:r});W(this,{publicKey:r,fingerprint:he(ro(Qr(r)),0,4),parentFingerprint:n,chainCode:o,path:i,index:s,depth:a})}connect(e){return new Xi(qi,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,e)}get extendedKey(){return Q(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),Yi(le(["0x0488B21E",Hi(this.depth,1),this.parentFingerprint,Hi(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return null!=this.path}deriveChild(e){const t=Ft(e,"index");Z(t<=4294967295,"invalid index","index",t);let r=this.path;r&&(r+="/"+(2147483647&t),t&Vi&&(r+="'"));const{IR:n,IL:o}=zi(t,this.chainCode,this.publicKey,null),i=Zt.addPoints(o,this.publicKey,!0),s=cn(i);return new Xi(qi,s,i,this.fingerprint,ue(n),r,t,this.depth+1,this.provider)}derivePath(e){return Wi(this,e)}}function Qi(e){try{if(JSON.parse(e).encseed)return!0}catch(e){}return!1}function Zi(e,t){const r=JSON.parse(e),n=Ci(t),o=sr(Pi(r,"ethaddr:string!")),i=_i(Pi(r,"encseed:string!"));Z(i&&i.length%16==0,"invalid encseed","json",e);const s=oe(So(n,n,2e3,32,"sha256")).slice(0,16),a=i.slice(0,16),c=i.slice(16),u=function(e){if(e.length<16)throw new TypeError("PKCS#7 invalid length");const t=e[e.length-1];if(t>16)throw new TypeError("PKCS#7 padding byte out of range");const r=e.length-t;for(let n=0;n<t;n++)if(e[r+n]!==t)throw new TypeError("PKCS#7 invalid padding byte");return new Uint8Array(e.subarray(0,r))}(oe(new ii(s,a).decrypt(c)));let l="";for(let e=0;e<u.length;e++)l+=String.fromCharCode(u[e]);return{address:o,privateKey:mr(l)}}function es(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}class ts extends Un{constructor(e,t){"string"!=typeof e||e.startsWith("0x")||(e="0x"+e),super("string"==typeof e?new Zt(e):e,t)}connect(e){return new ts(this.signingKey,e)}async encrypt(e,t){const r={address:this.address,privateKey:this.privateKey};return await Mi(r,e,{progressCallback:t})}encryptSync(e){return Bi({address:this.address,privateKey:this.privateKey},e)}static#x(e){if(Z(e,"invalid JSON wallet","json","[ REDACTED ]"),"mnemonic"in e&&e.mnemonic&&"en"===e.mnemonic.locale){const t=Co.fromEntropy(e.mnemonic.entropy),r=Ji.fromMnemonic(t,e.mnemonic.path);if(r.address===e.address&&r.privateKey===e.privateKey)return r;console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key")}const t=new ts(e.privateKey);return Z(t.address===e.address,"address/privateKey mismatch","json","[ REDACTED ]"),t}static async fromEncryptedJson(e,t,r){let n=null;return Di(e)?n=await async function(e,t,r){const n=JSON.parse(e),o=Ci(t),i=xi(n);if("pbkdf2"===i.name){r&&(r(0),await Gi(0));const{salt:e,count:t,dkLen:s,algorithm:a}=i,c=So(o,e,t,s,a);return r&&(r(1),await Gi(0)),Ui(n,c)}Q("scrypt"===i.name,"cannot be reached","UNKNOWN_ERROR",{params:i});const{salt:s,N:a,r:c,p:u,dkLen:l}=i;return Ui(n,await wi(o,s,a,c,u,l,r))}(e,t,r):Qi(e)&&(r&&(r(0),await es(0)),n=Zi(e,t),r&&(r(1),await es(0))),ts.#x(n)}static fromEncryptedJsonSync(e,t){let r=null;return Di(e)?r=function(e,t){const r=JSON.parse(e),n=Ci(t),o=xi(r);if("pbkdf2"===o.name){const{salt:e,count:t,dkLen:i,algorithm:s}=o;return Ui(r,So(n,e,t,i,s))}Q("scrypt"===o.name,"cannot be reached","UNKNOWN_ERROR",{params:o});const{salt:i,N:s,r:a,p:c,dkLen:u}=o;return Ui(r,Ri(n,i,s,a,c,u))}(e,t):Qi(e)?r=Zi(e,t):Z(!1,"invalid JSON wallet","json","[ REDACTED ]"),ts.#x(r)}static createRandom(e){const t=Ji.createRandom();return e?t.connect(e):t}static fromPhrase(e,t){const r=Ji.fromPhrase(e);return t?r.connect(t):r}}var rs=r(455),ns=r(952),os=r(770);function is(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return ss(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ss(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw i}}}}function ss(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function as(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return cs(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(cs(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,cs(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,cs(f,"constructor",u),cs(u,"constructor",c),c.displayName="GeneratorFunction",cs(u,o,"GeneratorFunction"),cs(f),cs(f,o,"Generator"),cs(f,n,function(){return this}),cs(f,"toString",function(){return"[object Generator]"}),(as=function(){return{w:i,m:h}})()}function cs(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}cs=function(e,t,r,n){function i(t,r){cs(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},cs(e,t,r,n)}function us(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function ls(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?us(Object(r),!0).forEach(function(t){fs(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):us(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function fs(e,t,r){return(t=ys(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hs(e){return hs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hs(e)}function ds(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ps(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ys(n.key),n)}}function gs(e,t,r){return t&&ps(e.prototype,t),r&&ps(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ys(e){var t=function(e,t){if("object"!=hs(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=hs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==hs(t)?t:t+""}function ms(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function Es(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){ms(i,n,o,s,a,"next",e)}function a(e){ms(i,n,o,s,a,"throw",e)}s(void 0)})}}var bs=[],vs=!1,Os="0.4.3";function Is(e){return new Promise(function(t,r){bs.push({task:e,resolve:t,reject:r}),As()})}function As(){return Ss.apply(this,arguments)}function Ss(){return(Ss=Es(as().m(function e(){var t,r,n;return as().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!vs){e.n=1;break}return e.a(2);case 1:if(t=bs.shift()){e.n=2;break}return e.a(2);case 2:return vs=!0,e.p=3,e.n=4,t.task();case 4:r=e.v,t.resolve(r),e.n=6;break;case 5:e.p=5,n=e.v,t.reject(n);case 6:return e.p=6,vs=!1,As(),e.f(6);case 7:return e.a(2)}},e,null,[[3,5,6,7]])}))).apply(this,arguments)}var ws=function(){function e(t,r){var n,o=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(ds(this,e),this.applicationId=t,this.providerId=r,this.sessionId="",this.signature="",this.timestamp=Date.now().toString(),this.parameters={},this.context={contextAddress:"0x0",contextMessage:"sample context"},this.redirectUrl="",this.sdkVersion="ext-".concat(Os),this.resolvedProviderVersion="",this.jsonProofResponse=!1,this.extensionID=i.extensionID||"",this.providerVersion=i.providerVersion||"",this.acceptAiProviders=!!i.acceptAiProviders,this.callbackUrl=i.callbackUrl||"",this._backgroundInitialized=!1,this._ctx=null,this._listeners={started:new Set,completed:new Set,error:new Set,progress:new Set},this._boundWindowListener=this._handleWindowMessage.bind(this),window.addEventListener("message",this._boundWindowListener),this._mode="undefined"!=typeof chrome&&chrome.runtime&&"chrome-extension:"===(null===(n=location)||void 0===n?void 0:n.protocol)?"extension":"web","extension"===this._mode){this._boundChromeHandler=function(e){var t=e||{},r=t.action,n=t.data,i=t.error,s=null==n?void 0:n.sessionId;if(!o.sessionId||o.sessionId===s)if("PROOF_SUBMITTED"===r){var a=(null==n?void 0:n.formattedProofs)||(null==n?void 0:n.proof)||n;o._emit("completed",a)}else"PROOF_SUBMISSION_FAILED"!==r&&"PROOF_GENERATION_FAILED"!==r||o._emit("error",i||new Error("Verification failed"))};try{chrome.runtime.onMessage.addListener(this._boundChromeHandler)}catch(e){}}}return gs(e,[{key:"setAppCallbackUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e||"string"!=typeof e)throw new Error("callbackUrl must be a non-empty string");this.callbackUrl=e,this.jsonProofResponse=!!t}},{key:"setRedirectUrl",value:function(e){if(!e||"string"!=typeof e)throw new Error("redirectUrl must be a non-empty string");this.redirectUrl=e}},{key:"addContext",value:function(e,t){if(!e||!t)throw new Error("Both address and message are required");this.context={contextAddress:String(e),contextMessage:String(t)}}},{key:"setParams",value:function(e){if(!e||"object"!==hs(e))throw new Error("params must be an object");this.parameters=ls(ls({},this.parameters),e)}},{key:"getStatusUrl",value:function(){if(!this.sessionId)throw new Error("Session not initialized");return ns.Sn.STATUS_URL(this.sessionId)}},{key:"on",value:function(e,t){var r=this;if(!this._listeners[e])throw new Error("Unknown event: ".concat(e));return this._listeners[e].add(t),function(){return r.off(e,t)}}},{key:"off",value:function(e,t){this._listeners[e]&&this._listeners[e].delete(t)}},{key:"startVerification",value:(i=Es(as().m(function e(){var t=this;return as().w(function(e){for(;;)if(0===e.n)return e.a(2,Is(function(){return t._startVerificationInternal()}))},e)})),function(){return i.apply(this,arguments)})},{key:"cancel",value:(o=Es(as().m(function e(){var t,r=this,n=arguments;return as().w(function(e){for(;;)switch(e.n){case 0:if(t=n.length>0&&void 0!==n[0]?n[0]:5e3,this.sessionId){e.n=1;break}return e.a(2);case 1:return e.a(2,new Promise(function(e){var n=!1,o=r.on("error",function(){n||(n=!0,o(),e(!0))});window.postMessage({action:ns.vQ.CANCEL_VERIFICATION,messageId:r.sessionId,extensionID:r.extensionID},"*"),setTimeout(function(){n||(o(),e(!1))},t)}))}},e,this)})),function(){return o.apply(this,arguments)})},{key:"_startVerificationInternal",value:(n=Es(as().m(function e(){var t,r,n=this;return as().w(function(e){for(;;)switch(e.n){case 0:if(this.sessionId){e.n=1;break}throw new Error("Session not initialized");case 1:if(this.signature){e.n=2;break}throw new Error("Signature not set");case 2:return t={sessionId:this.sessionId,providerId:this.providerId,applicationId:this.applicationId,signature:this.signature,timestamp:this.timestamp,callbackUrl:this.callbackUrl||"",context:JSON.stringify(this.context||{}),parameters:this.parameters||{},redirectUrl:this.redirectUrl||"",acceptAiProviders:!!this.acceptAiProviders,sdkVersion:this.sdkVersion,providerVersion:this.providerVersion||"",resolvedProviderVersion:this.resolvedProviderVersion||"",jsonProofResponse:!!this.jsonProofResponse},r=this.sessionId,e.a(2,new Promise(function(e,o){var i=n.on("started",function(){}),s=n.on("completed",function(t){c(),e(t)}),a=n.on("error",function(e){c(),o(e)}),c=function(){i&&i(),s&&s(),a&&a()};if("extension"===n._mode)try{chrome.runtime.sendMessage({action:"START_VERIFICATION",source:"content-script",target:"background",data:t},function(e){e&&e.success&&n._emit("started",{sessionId:n.sessionId,messageId:r})})}catch(e){n._emit("error",e instanceof Error?e:new Error(String(e)))}else{if(!n.extensionID)return void n._emit("error",new Error("extensionID is required when running on a web page"));window.postMessage({action:ns.vQ.START_VERIFICATION,messageId:r,data:t,extensionID:n.extensionID},"*")}}))}},e,this)})),function(){return n.apply(this,arguments)})},{key:"dispose",value:function(){var e;if(window.removeEventListener("message",this._boundWindowListener),this._boundChromeHandler&&null!==(e=chrome)&&void 0!==e&&null!==(e=e.runtime)&&void 0!==e&&null!==(e=e.onMessage)&&void 0!==e&&e.removeListener)try{chrome.runtime.onMessage.removeListener(this._boundChromeHandler)}catch(e){}this._listeners.started.clear(),this._listeners.completed.clear(),this._listeners.error.clear(),this._listeners.progress.clear()}},{key:"_initSession",value:(r=Es(as().m(function e(t){var r,n;return as().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,fetch("".concat(ns.fn,"/api/sdk/init/session/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});case 1:return r=e.v,e.n=2,r.json().catch(function(){return{}});case 2:if(n=e.v,r.ok){e.n=3;break}throw new Error((null==n?void 0:n.message)||"Failed to initialize session");case 3:return e.a(2,n)}},e)})),function(e){return r.apply(this,arguments)})},{key:"_emit",value:function(e,t){if(this._listeners[e]){var r,n=is(this._listeners[e]);try{for(n.s();!(r=n.n()).done;){var o=r.value;try{o(t)}catch(e){}}}catch(e){n.e(e)}finally{n.f()}}}},{key:"_handleWindowMessage",value:function(e){if(e.source===window){var t=e.data||{},r=t.action,n=t.messageId,o=t.data,i=t.error;if(!this.sessionId||this.sessionId===n)if(r!==ns.vQ.VERIFICATION_COMPLETED)r!==ns.vQ.VERIFICATION_FAILED?r!==ns.vQ.VERIFICATION_STARTED||this._emit("started",{sessionId:this.sessionId,messageId:n}):this._emit("error",i||new Error("Verification failed"));else{var s=(null==o?void 0:o.proofs)||(null==o?void 0:o.formattedProofs)||o;this._emit("completed",s)}}}}],[{key:"init",value:(t=Es(as().m(function t(r,n,o){var i,s,a,c,u,l,f,h=arguments;return as().w(function(t){for(;;)switch(t.n){case 0:if(i=h.length>3&&void 0!==h[3]?h[3]:{},r&&"string"==typeof r){t.n=1;break}throw new Error("applicationId must be a non-empty string");case 1:if(n&&"string"==typeof n){t.n=2;break}throw new Error("appSecret must be a non-empty string");case 2:if(o&&"string"==typeof o){t.n=3;break}throw new Error("providerId must be a non-empty string");case 3:return s=new e(r,o,i),a='{"providerId":"'.concat(o,'","timestamp":"').concat(s.timestamp,'"}'),c=Ee((new TextEncoder).encode(a)),u=new ts(n),t.n=4,u.signMessage(oe(c));case 4:return l=t.v,s.signature=l,t.n=5,s._initSession({providerId:o,appId:r,timestamp:s.timestamp,signature:l,versionNumber:s.providerVersion||""});case 5:return f=t.v,s.sessionId=f.sessionId||"",s.resolvedProviderVersion=f.resolvedProviderVersion||"",t.a(2,s)}},t)})),function(e,r,n){return t.apply(this,arguments)})},{key:"fromJsonString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="string"==typeof e?JSON.parse(e):e;return this.fromConfig(r,t)}},{key:"fromConfig",value:function(t){var r,n,o,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t||"object"!==hs(t))throw new Error("invalid config");var a=new e(String(t.applicationId||""),String(t.providerId||""),s||{});return a.sessionId=String(t.sessionId||""),a.signature=String(t.signature||""),a.timestamp=String(t.timeStamp||t.timestamp||Date.now()),a.parameters=t.parameters||{},a.context=t.context||a.context,a.callbackUrl=String(t.appCallbackUrl||t.callbackUrl||""),a.jsonProofResponse=!!(null!==(r=t.jsonProofResponse)&&void 0!==r?r:a.jsonProofResponse),a.resolvedProviderVersion=String(t.resolvedProviderVersion||""),a.providerVersion=String(t.providerVersion||""),a.redirectUrl=String(t.redirectUrl||""),a.acceptAiProviders=!!(null!==(n=null!==(o=t.acceptAiProviders)&&void 0!==o?o:null===(i=t.options)||void 0===i?void 0:i.acceptAiProviders)&&void 0!==n?n:a.acceptAiProviders),null!=s&&s.extensionID&&(a.extensionID=String(s.extensionID)),a}}]);var t,r,n,o,i}(),Rs=function(){return gs(function e(){var t;ds(this,e),this._backgroundInitialized=!1,this._ctx=null,this._mode="undefined"!=typeof chrome&&chrome.runtime&&"chrome-extension:"===(null===(t=location)||void 0===t?void 0:t.protocol)?"extension":"web"},[{key:"initializeBackground",value:function(){if(this._backgroundInitialized)return this._ctx;try{var e=(0,rs.A)();return this._backgroundInitialized=!0,this._ctx=e,e}catch(e){throw e}}},{key:"isExtensionInstalled",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.extensionID,r=e.timeout,n=void 0===r?500:r;return new Promise(function(e){var r="reclaim-check-".concat(Date.now()),o=function(t){var n,i;t.source===window&&(null===(n=t.data)||void 0===n?void 0:n.action)===ns.vQ.EXTENSION_RESPONSE&&(null===(i=t.data)||void 0===i?void 0:i.messageId)===r&&(window.removeEventListener("message",o),e(!!t.data.installed))};window.addEventListener("message",o),window.postMessage({action:ns.vQ.CHECK_EXTENSION,extensionID:t,messageId:r},"*"),setTimeout(function(){window.removeEventListener("message",o),e(!1)},n)})}},{key:"getVersion",value:function(){return Os}},{key:"init",value:(e=Es(as().m(function e(t,r,n){var o,i=arguments;return as().w(function(e){for(;;)switch(e.n){case 0:return o=i.length>3&&void 0!==i[3]?i[3]:{},e.n=1,ws.init(t,r,n,o);case 1:return e.a(2,e.v)}},e)})),function(t,r,n){return e.apply(this,arguments)})},{key:"fromJsonString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ws.fromJsonString(e,t)}},{key:"setLogConfig",value:function(e,t){os.Ow.setConfig(e);try{var n;if("extension"===this._mode&&"undefined"!=typeof chrome&&null!==(n=chrome.storage)&&void 0!==n&&n.local){var o=r(859).LOG_CONFIG_STORAGE_KEY;return void chrome.storage.local.set(fs({},o,ls(ls({},os.Ow.config),e)))}}catch(e){}window.postMessage({action:ns.vQ.SET_LOG_CONFIG,extensionID:t,data:{config:e}},"*")}},{key:"getLogConfig",value:function(){return os.Ow.config}}]);var e}(),Ts=new Rs;const _s=Rs})(),module.exports=n})();
|
|
23
23
|
//# sourceMappingURL=JoclaimExtensionSDK-mv2.bundle.js.map
|