trex-proxy-browser-extension-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of trex-proxy-browser-extension-sdk might be problematic. Click here for more details.
- package/build/343.bundle.js +2 -0
- package/build/343.bundle.js.map +1 -0
- package/build/ReclaimExtensionSDK-mv2.bundle.js +23 -0
- package/build/ReclaimExtensionSDK-mv2.bundle.js.map +1 -0
- package/build/ReclaimExtensionSDK.bundle.js +23 -0
- package/build/ReclaimExtensionSDK.bundle.js.map +1 -0
- package/build/background/background-mv2.bundle.js +11 -0
- package/build/background/background-mv2.bundle.js.map +1 -0
- package/build/background/background.bundle.js +11 -0
- package/build/background/background.bundle.js.map +1 -0
- package/build/content/components/reclaim-provider-verification-popup.css +676 -0
- package/build/content/components/reclaim-provider-verification-popup.html +139 -0
- package/build/content/content.bundle.js +11 -0
- package/build/content/content.bundle.js.map +1 -0
- package/build/interceptor/injection-scripts.bundle.js +2 -0
- package/build/interceptor/injection-scripts.bundle.js.map +1 -0
- package/build/interceptor/network-interceptor.bundle.js +2 -0
- package/build/interceptor/network-interceptor.bundle.js.map +1 -0
- package/build/offscreen/offscreen.bundle.js +133 -0
- package/build/offscreen/offscreen.bundle.js.map +1 -0
- package/build/offscreen/offscreen.html +15 -0
- package/build/scripts/download-circuits.js +1 -0
- package/build/scripts/install-assets.js +2 -0
- package/index.d.ts +2 -0
- package/package.json +169 -0
- package/readme.md +441 -0
- package/src/types/globals.d.ts +1 -0
- package/src/types/index.d.ts +62 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var e={153:(e,t,r)=>{r.d(t,{Ey:()=>s,Ru:()=>c.EVENT_TYPES,E$:()=>c.LOG_LEVEL,D_:()=>c.LOG_TYPES,w9:()=>a});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=new(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=r(859),u=r(606);void 0!==u&&u.env?a.disable():a.enable()},251:(e,t)=>{
|
|
2
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
3
|
+
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}},287:(e,t,r)=>{
|
|
4
|
+
/*!
|
|
5
|
+
* The buffer module from node.js, for the browser.
|
|
6
|
+
*
|
|
7
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
8
|
+
* @license MIT
|
|
9
|
+
*/
|
|
10
|
+
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(X(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(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(X(e,SharedArrayBuffer)||e&&X(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||W(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)||X(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 E(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function m(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),W(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(W(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(X(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),X(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(X(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)E(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)E(this,t,t+3),E(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)E(this,t,t+7),E(this,t+1,t+6),E(this,t+2,t+5),E(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(X(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 m(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return m(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+=J[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 X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function W(e){return e!=e}const J=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")}},296:(e,t,r)=>{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")},379:(e,t,r)=>{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)}}()},526:(e,t)=>{t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,i=a(e),s=i[0],c=i[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,c)),l=0,f=c>0?s-4:s;for(r=0;r<f;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===c&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],s=16383,a=0,c=n-o;a<c;a+=s)i.push(u(e,a,a+s>c?c:a+s));1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=i[s],n[i.charCodeAt(s)]=s;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function u(e,t,r){for(var n,o=[],i=t;i<r;i+=3)n=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),o.push(c(n));return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},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}},735:(e,t,r)=>{r.d(t,{A:()=>Ct});var n={};r.r(n),r.d(n,{cancelSession:()=>ze,failSession:()=>$e,startVerification:()=>Ke,submitProofs:()=>Ye});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 E(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 m=(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&&(m.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))},S=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 w(){return R.apply(this,arguments)}function R(){return(R=E(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("trex-browser-extension-sdk/offscreen/offscreen.html"),m.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}m.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 m.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 T(){return _.apply(this,arguments)}function _(){return _=E(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 m.info({message:"[OFFSCREEN-MANAGER] Already ready (waitForOffscreenReadyInternal check)",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),e.a(2,!0);case 1:m.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){m.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 m.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),m.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)})),_.apply(this,arguments)}function N(e){return C.apply(this,arguments)}function C(){return C=E(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=5;break}return e.n=3,chrome.runtime.getContexts({contextTypes:["OFFSCREEN_DOCUMENT"]});case 3:if(!(e.v.length>0)){e.n=5;break}return e.n=4,chrome.offscreen.closeDocument();case 4:b=!1;case 5:if(O){e.n=6;break}return t.info({message:"[OFFSCREEN-MANAGER] No existing context/promise, initiating creation.",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.OFFSCREEN}),O=w().finally(function(){O=null}),e.n=6,O;case 6:return e.n=7,T(5e4);case 7:if(e.v){e.n=8;break}throw new Error("Failed to initialize or confirm offscreen document readiness.");case 8: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)})),C.apply(this,arguments)}function P(){return L.apply(this,arguments)}function L(){return(L=E(p().m(function e(){return p().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,chrome.offscreen.closeDocument();case 1:e.n=3;break;case 2:e.p=2,e.v;case 3:b=!1;case 4:return e.a(2)}},e,null,[[0,2]])}))).apply(this,arguments)}function D(){/*! 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 U(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]())):(U(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,U(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,U(f,"constructor",u),U(u,"constructor",c),c.displayName="GeneratorFunction",U(u,o,"GeneratorFunction"),U(f),U(f,o,"Generator"),U(f,n,function(){return this}),U(f,"toString",function(){return"[object Generator]"}),(D=function(){return{w:i,m:h}})()}function U(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}U=function(e,t,r,n){function i(t,r){U(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))},U(e,t,r,n)}function x(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 G(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){x(i,n,o,s,a,"next",e)}function a(e){x(i,n,o,s,a,"throw",e)}s(void 0)})}}"undefined"!=typeof chrome&&chrome.runtime&&chrome.runtime.onMessage&&S(),S();var F=function(){var e=G(D().m(function e(t,r){var n,i;return D().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(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}),P().then(function(){return 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 G(D().m(function r(){return D().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,P();case 1:e({success:!1,error:t.error||"Unknown error in proof generation"});case 2:return r.a(2)}},r)}))();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 G(D().m(function t(){return D().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,P();case 1:e({success:!1,error:u});case 2:return t.a(2)}},t)}))();n.info({message:"[PROOF-GENERATOR] Proof generation successful",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.PROOF}),G(D().m(function r(){return D().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,P();case 1:e(t);case 2:return r.a(2)}},r)}))()}};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}}),P().then(function(){return 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.n=5,P();case 5:return e.a(2,{success:!1,error:i.message||"Unknown error in proof generation process"})}},e,null,[[1,4]])}));return function(t,r){return e.apply(this,arguments)}}(),k=function(e,t){var r;return{identifier:e.claim.identifier,claimData:e.claim,signatures:[B(e.signatures.claimSignature)],witnesses:[{id:e.signatures.attestorAddress,url:o.oW}],taskId:null,publicData:null!==(r=e.publicData)&&void 0!==r?r:null,providerRequest:t}},B=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)},M=r(153);class j{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+j.version}static addUnaryOp(e){return j.max_unop_len=Math.max(e.length,j.max_unop_len),j.unary_ops[e]=1,j}static addBinaryOp(e,t,r){return j.max_binop_len=Math.max(e.length,j.max_binop_len),j.binary_ops[e]=t,r?j.right_associative.add(e):j.right_associative.delete(e),j}static addIdentifierChar(e){return j.additional_identifier_chars.add(e),j}static addLiteral(e,t){return j.literals[e]=t,j}static removeUnaryOp(e){return delete j.unary_ops[e],e.length===j.max_unop_len&&(j.max_unop_len=j.getMaxKeyLen(j.unary_ops)),j}static removeAllUnaryOps(){return j.unary_ops={},j.max_unop_len=0,j}static removeIdentifierChar(e){return j.additional_identifier_chars.delete(e),j}static removeBinaryOp(e){return delete j.binary_ops[e],e.length===j.max_binop_len&&(j.max_binop_len=j.getMaxKeyLen(j.binary_ops)),j.right_associative.delete(e),j}static removeAllBinaryOps(){return j.binary_ops={},j.max_binop_len=0,j}static removeLiteral(e){return delete j.literals[e],j}static removeAllLiterals(){return j.literals={},j}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 j(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 j.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!j.binary_ops[String.fromCharCode(e)]||j.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return j.isIdentifierStart(e)||j.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(j.hooks[e]){const r={context:this,node:t};return j.hooks.run(e,r),r.node}return t}searchHook(e){if(j.hooks[e]){const t={context:this};return j.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===j.SPACE_CODE||e===j.TAB_CODE||e===j.LF_CODE||e===j.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:j.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===j.SEMCOL_CODE||t===j.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,j.max_binop_len),t=e.length;for(;t>0;){if(j.binary_ops.hasOwnProperty(e)&&(!j.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!j.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:j.binaryPrecedence(t),right_a:j.right_associative.has(t)},s=this.gobbleToken(),s||this.throwError("Expected expression after "+t),n=[i,o,s];t=this.gobbleBinaryOp();){if(r=j.binaryPrecedence(t),0===r){this.index-=t.length;break}o={value:t,prec:r,right_a:j.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:j.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:j.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,j.isDecimalDigit(e)||e===j.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===j.SQUOTE_CODE||e===j.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(e===j.OBRACK_CODE)n=this.gobbleArray();else{for(t=this.expr.substr(this.index,j.max_unop_len),r=t.length;r>0;){if(j.unary_ops.hasOwnProperty(t)&&(!j.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!j.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:j.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--r)}j.isIdentifierStart(e)?(n=this.gobbleIdentifier(),j.literals.hasOwnProperty(n.name)?n={type:j.LITERAL,value:j.literals[n.name],raw:n.name}:n.name===j.this_str&&(n={type:j.THIS_EXP})):e===j.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===j.PERIOD_CODE||t===j.OBRACK_CODE||t===j.OPAREN_CODE||t===j.QUMARK_CODE;){let r;if(t===j.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==j.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===j.OBRACK_CODE?((e={type:j.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),t=this.code,t!==j.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===j.OPAREN_CODE?e={type:j.CALL_EXP,arguments:this.gobbleArguments(j.CPAREN_CODE),callee:e}:(t===j.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),e={type:j.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(;j.isDecimalDigit(this.code);)r+=this.expr.charAt(this.index++);if(this.code===j.PERIOD_CODE)for(r+=this.expr.charAt(this.index++);j.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++));j.isDecimalDigit(this.code);)r+=this.expr.charAt(this.index++);j.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+r+this.char+")")}return t=this.code,j.isIdentifierStart(t)?this.throwError("Variable names cannot start with a number ("+r+this.char+")"):(t===j.PERIOD_CODE||1===r.length&&r.charCodeAt(0)===j.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:j.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:j.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(j.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,j.isIdentifierPart(e));)this.index++;return{type:j.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===j.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(o===j.COMMA_CODE){if(this.index++,n++,n!==t.length)if(e===j.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===j.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!==j.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return r||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(j.CPAREN_CODE);if(this.code===j.CPAREN_CODE)return this.index++,1===e.length?e[0]:!!e.length&&{type:j.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:j.ARRAY_EXP,elements:this.gobbleArguments(j.CBRACK_CODE)}}}const K=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(j,{hooks:K,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)})}}(j),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"}),j.max_unop_len=j.getMaxKeyLen(j.unary_ops),j.max_binop_len=j.getMaxKeyLen(j.binary_ops);const V=e=>new j(e).parse(),$=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(j).filter(e=>!$.includes(e)&&void 0===V[e]).forEach(e=>{V[e]=j[e]}),V.Jsep=j;var H={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 :")}})}};V.plugins.register(H);var Y={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 q={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[43,45],assignmentPrecedence:.9,init(e){const t=[e.IDENTIFIER,e.MEMBER_EXP];function r(e){q.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)})}q.assignmentOperators.forEach(t=>e.addBinaryOp(t,q.assignmentPrecedence,!0)),e.hooks.add("gobble-token",function(e){const r=this.code;q.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;q.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)})}};V.plugins.register(Y,q),V.addUnaryOp("typeof"),V.addLiteral("null",null),V.addLiteral("undefined",void 0);const z=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),X={evalAst(e,t){switch(e.type){case"BinaryExpression":case"LogicalExpression":return X.evalBinaryExpression(e,t);case"Compound":return X.evalCompound(e,t);case"ConditionalExpression":return X.evalConditionalExpression(e,t);case"Identifier":return X.evalIdentifier(e,t);case"Literal":return X.evalLiteral(e,t);case"MemberExpression":return X.evalMemberExpression(e,t);case"UnaryExpression":return X.evalUnaryExpression(e,t);case"ArrayExpression":return X.evalArrayExpression(e,t);case"CallExpression":return X.evalCallExpression(e,t);case"AssignmentExpression":return X.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](X.evalAst(e.left,t),()=>X.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=X.evalAst(o,t)}return r},evalConditionalExpression:(e,t)=>X.evalAst(e.test,t)?X.evalAst(e.consequent,t):X.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?X.evalAst(e.property):e.property.name),n=X.evalAst(e.object,t);if(null==n)throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);if(!Object.hasOwn(n,r)&&z.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=>-X.evalAst(e,t),"!":e=>!X.evalAst(e,t),"~":e=>~X.evalAst(e,t),"+":e=>+X.evalAst(e,t),typeof:e=>typeof X.evalAst(e,t)}[e.operator](e.argument)),evalArrayExpression:(e,t)=>e.elements.map(e=>X.evalAst(e,t)),evalCallExpression(e,t){const r=e.arguments.map(e=>X.evalAst(e,t));return X.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=X.evalAst(e.right,t);return t[r]=n,t[r]}};function W(e,t){return(e=e.slice()).push(t),e}function J(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],W(r,u),t,u,i,s));else if("*"===u)this._walk(t,e=>{h(this._trace(l,t[e],W(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],W(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:W(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],W(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],W(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(J(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],W(r,e),t,e,i,s,!0))}else if(u.includes(",")){const e=u.split(",");for(const s of e)h(this._trace(J(s,l),t,r,n,o,i,!0))}else!a&&t&&Object.hasOwn(t,u)&&h(this._trace(l,t[u],W(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(J(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=V(this.code)}runInNewContext(e){const t=Object.assign(Object.create(null),e);return X.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 ee=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 M.w9.error(M.Ey.CLAIM,"[PARAMS-EXTRACTOR-UTILS] Error extracting JSON value with path ".concat(t,":"),e)}},te=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 M.w9.error(M.Ey.CLAIM,"[PARAMS-EXTRACTOR-UTILS] Error extracting HTML value with XPath ".concat(t,":"),e)}};function re(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 ne(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)?ne(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 ne(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 oe(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=re(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 ie(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 se(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)?se(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 se(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 ae(e){return ae="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},ae(e)}var ce=function(e){return e?(e.match(/{{([^}]+)}}/g)||[]).map(function(e){return e.substring(2,e.length-2)}):[]},ue=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e||!t)return r;var n=ce(e),o=oe(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},le=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e||!t)return r;var n=ce(e),o=oe(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},fe=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 M.w9.warn(M.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=ce(c.value);if(0===l.length)return;var f=u;if(f){var h=null;if(f.jsonPath&&i)h=ee(i,f.jsonPath);else if(f.xPath&&!s)h=te(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"===ae(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:M.E$.INFO,type:M.D_.CLAIM_CREATION,eventType:M.Ru.CLAIM_PARAMETER_VALIDATION_FAILED_EXCEPTION,meta:{error:e}})}return n},he=function(e){var t={},r={};return Object.entries(e||{}).forEach(function(e){var n=ie(e,2),o=n[0],i=n[1];o.toLowerCase().includes("secret")?r[o]=i:t[o]=i}),{publicParams:t,secretParams:r}},de=r(379);function pe(){/*! 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 ge(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]())):(ge(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,ge(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,ge(f,"constructor",u),ge(u,"constructor",c),c.displayName="GeneratorFunction",ge(u,o,"GeneratorFunction"),ge(f),ge(f,o,"Generator"),ge(f,n,function(){return this}),ge(f,"toString",function(){return"[object Generator]"}),(pe=function(){return{w:i,m:h}})()}function ge(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}ge=function(e,t,r,n){function i(t,r){ge(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))},ge(e,t,r,n)}function ye(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 Ee(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ye(Object(r),!0).forEach(function(t){me(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ye(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function me(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=be(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=be(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==be(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function be(e){return be="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},be(e)}function ve(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 Oe(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)?Oe(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 Oe(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 Ie(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 Ae=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")},Se=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))))})})},we=function(){var e,t=(e=pe().m(function e(t,r){var n,i,a,c,u,l,f,h,d,p,g,y,E,m,b,v,O,I,A,S,w,R,T=arguments;return pe().w(function(e){for(;;)switch(e.p=e.n){case 0:return a=T.length>2&&void 0!==T[2]?T[2]:"unknown",c=T.length>3&&void 0!==T[3]?T[3]:"unknown",u=T.length>4?T[4]:void 0,(l=T.length>5?T[5]:void 0).setContext({sessionId:a,providerId:c,type:s.LOG_TYPES.CLAIM_CREATION}),l.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,N(l);case 2:l.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,w=e.v,l.error({message:"[CLAIM-CREATOR] Failed to ensure offscreen document: "+(null==w?void 0:w.message),logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION,eventType:s.EVENT_TYPES.OFFSCREEN_DOCUMENT_NOT_READY_EXCEPTION,meta:{error:null==w?void 0:w.message,request:t,providerData:r,sessionId:a,loginUrl:u}}),new Error("Failed to initialize offscreen document: ".concat(w.message));case 4:return f="undefined"!=typeof navigator&&navigator.userAgent||Ae(),h=["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"],p={},(d={}).url="TEMPLATE"===r.urlType?r.url:t.url,d.method=t.method||"GET",t.headers&&(g={"Sec-Fetch-Mode":"same-origin","Sec-Fetch-Site":"same-origin","User-Agent":f},y={Referer:t.referer&&String(t.referer)||u||origin||""},Object.entries(t.headers).forEach(function(e){var t=ve(e,2),r=t[0],n=t[1],o=r.toLowerCase();h.includes(o)?g[r]=n:y[r]=n}),Object.keys(g).length>0&&(d.headers=g),Object.keys(y).length>0&&(p.headers=y)),t.body&&(null!=r&&null!==(E=r.bodySniff)&&void 0!==E&&E.enabled?d.body=r.bodySniff.template:d.body=t.body),t.cookieStr&&(p.cookieStr=t.cookieStr),m={},null!=t&&t.extractedParams&&"object"===be(t.extractedParams)&&(m=Ee(Ee({},m),t.extractedParams)),"TEMPLATE"===r.urlType&&t.url&&(m=Ee(Ee({},m),ue(r.url,t.url))),null!=r&&null!==(n=r.bodySniff)&&void 0!==n&&n.enabled&&t.body&&(m=Ee(Ee({},m),le(r.bodySniff.template,t.body))),t.responseText&&r.responseMatches&&(m=Ee(Ee({},m),fe(t.responseText,r.responseMatches,r.responseRedactions||[]))),b=he(m),v=b.publicParams,O=b.secretParams,Object.keys(v).length>0&&(d.paramValues=v),Object.keys(O).length>0&&(p.paramValues=O),r.responseMatches&&(d.responseMatches=r.responseMatches.map(function(e){return{value:e.value,type:e.type||"contains",invert:e.invert||!1}})),r.responseRedactions&&(d.responseRedactions=r.responseRedactions.map(function(e){var t={};return Object.entries(e).forEach(function(e){var r=ve(e,2),n=r[0],o=r[1];"hash"!==n&&("jsonPath"!==n&&"xPath"!==n||o&&""!==o)&&(t[n]=o)}),t})),r.responseSelections&&(d.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&&(d.additionalClientOptions=r.additionalClientOptions),e.p=5,e.n=6,Se(a,c,l);case 6:I=e.v,e.n=8;break;case 7:throw e.p=7,R=e.v,l.error({message:"[CLAIM-CREATOR] Error obtaining owner private key: "+R.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(R.message));case 8:if("{{DYNAMIC_GEO}}"!==(A=null!==(i=null==r?void 0:r.geoLocation)&&void 0!==i?i:"")){e.n=10;break}return e.n=9,(0,de.C)();case 9:A=e.v;case 10:return l.log({message:"[CLAIM-CREATOR] Geo location: "+A,logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.CLAIM_CREATION}),d.geoLocation=A,S={name:"http",sessionId:a,params:d,secretParams:p,ownerPrivateKey:I,client:{url:o.oW}},l.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}),l.log({message:"[CLAIM-CREATOR] Claim object: "+JSON.stringify(S,null,2),logLevel:s.LOG_LEVEL.ALL,type:s.LOG_TYPES.CLAIM_CREATION}),e.a(2,S)}},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){Ie(i,n,o,s,a,"next",e)}function a(e){Ie(i,n,o,s,a,"throw",e)}s(void 0)})});return function(e,r){return t.apply(this,arguments)}}();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)}function Te(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,_e(n.key),n)}}function _e(e){var t=function(e,t){if("object"!=Re(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=Re(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Re(t)?t:t+""}var Ne=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;M.w9.info(M.Ey.SESSION_TIMER,"[SESSION TIMER] Starting session timer"),this.clearSessionTimer(),this.sessionTimerStartTime=Date.now(),this.sessionTimer=setTimeout(function(){null!==e.sessionTimer?(M.w9.error(M.Ey.SESSION_TIMER,"[SESSION TIMER] Session timer expired"),e.onSessionTimeout&&e.onSessionTimeout("Session timeout: No proofs generated within time limit")):M.w9.info(M.Ey.SESSION_TIMER,"[SESSION TIMER] Timer was already cleared, ignoring timeout")},this.sessionTimerDuration)}},{key:"resetSessionTimer",value:function(){M.w9.info(M.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){M.w9.info(M.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&&(M.w9.info(M.Ey.SESSION_TIMER,"[SESSION TIMER] Resuming session timer with remaining time:",this.sessionTimerRemainingTime),this.sessionTimer=setTimeout(function(){M.w9.error(M.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(){M.w9.info(M.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)}}])&&Te(e.prototype,t),r&&Te(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}();function Ce(e){return Ce="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},Ce(e)}function Pe(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)||Ge(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 Le(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 De(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Le(Object(r),!0).forEach(function(t){Ue(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Le(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Ue(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=Ce(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=Ce(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Ce(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xe(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Ge(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 Ge(e,t){if(e){if("string"==typeof e)return Fe(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)?Fe(e,t):void 0}}function Fe(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 ke(){/*! 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 Be(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]())):(Be(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,Be(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,Be(f,"constructor",u),Be(u,"constructor",c),c.displayName="GeneratorFunction",Be(u,o,"GeneratorFunction"),Be(f),Be(f,o,"Generator"),Be(f,n,function(){return this}),Be(f,"toString",function(){return"[object Generator]"}),(ke=function(){return{w:i,m:h}})()}function Be(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Be=function(e,t,r,n){function i(t,r){Be(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))},Be(e,t,r,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)}function je(e){return 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)})}}function Ke(e,t){return Ve.apply(this,arguments)}function Ve(){return Ve=je(ke().m(function e(t,r){var n,o,i,s;return ke().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:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.D_.BACKGROUND});n.info({message:"[BACKGROUND] Starting verification with session id: ".concat(t.sessionId),logLevel:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.D_.BACKGROUND}),t.activeSessionId=null,s;case 6:return e.a(2)}},e,null,[[1,5]])})),Ve.apply(this,arguments)}function $e(e,t,r){return He.apply(this,arguments)}function He(){return He=je(ke().m(function e(t,r,n){var o,i,s,a;return ke().w(function(e){for(;;)switch(e.p=e.n){case 0:if((o=t.bgLogger).setContext({type:M.D_.BACKGROUND,sessionId:t.sessionId||"unknown",providerId:t.providerId||"unknown",appId:t.appId||"unknown"}),o.log({message:"[BACKGROUND] Failing session: ".concat(r),logLevel:M.E$.INFO,type:M.D_.BACKGROUND,eventType:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.D_.BACKGROUND});case 8:return e.p=8,o.info({message:"[BACKGROUND] Proof generation failed, Broadcasting to popup/options pages: ".concat(r),logLevel:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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]])})),He.apply(this,arguments)}function Ye(e){return qe.apply(this,arguments)}function qe(){return qe=je(ke().m(function e(t){var r,n,o,i,s,a,c,u,l,f,h,d,p,g,y,E,m,b,v,O,I,A,S,w,R;return ke().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:M.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=xe(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=xe(t.generatedProofs.entries()),e.p=5,h.s();case 6:if((d=h.n()).done){e.n=9;break}if(p=Pe(d.value,2),g=p[0],y=p[1],!a.has(g)){e.n=7;break}return e.a(3,8);case 7:E=t.providerRequestsByHash.get(g)||{url:"",expectedPageUrl:"",urlType:"EXACT",method:"GET",responseMatches:[],responseRedactions:[],requestHash:g},s.push(t.formatProof(y,E));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(m=s.map(function(e){var r;return De(De({},e),{},{publicData:null!==(r=t.publicData)&&void 0!==r?r:null})}),r.info({message:"[BACKGROUND] Submitting proofs ".concat(JSON.stringify(m)),logLevel:M.E$.INFO,type:M.D_.BACKGROUND,eventType:M.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:M.E$.INFO,type:M.D_.BACKGROUND,eventType:M.Ru.SUBMITTING_PROOF_TO_CALLBACK_URL}),e.n=14,t.submitProofOnCallback(m,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:M.E$.INFO,type:M.D_.BACKGROUND,eventType:M.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:M.E$.INFO,type:M.D_.BACKGROUND,eventType:M.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:M.E$.INFO,type:M.D_.BACKGROUND,eventType:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.D_.BACKGROUND,eventType:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.D_.BACKGROUND});case 37:return e.p=37,r.log({message:"[BACKGROUND] Proof submitted, Broadcasting to runtime",logLevel:M.E$.INFO,type:M.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(je(ke().m(function e(){return ke().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,chrome.tabs.update(t.originalTabId,{active:!0});case 1:t.activeTabId&&(t.activeTabId=null),t.originalTabId=null;case 2: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:M.E$.INFO,type:M.D_.BACKGROUND})}else if(t.activeTabId)try{setTimeout(je(ke().m(function e(){return ke().w(function(e){for(;;)switch(e.n){case 0:t.activeTabId=null;case 1: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:M.E$.INFO,type:M.D_.BACKGROUND,eventType:M.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]])})),qe.apply(this,arguments)}function ze(e){return Xe.apply(this,arguments)}function Xe(){return Xe=je(ke().m(function e(t){var r,n,o,i,s,a,c;return ke().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=t.bgLogger,e.p=1,r.setContext({type:M.D_.BACKGROUND,sessionId:t.sessionId||"unknown",providerId:t.providerId||"unknown",appId:t.appId||"unknown"}),r.log({message:"[BACKGROUND] Cancelling session",logLevel:M.E$.INFO,type:M.D_.BACKGROUND,eventType:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.D_.BACKGROUND});case 13:return e.p=13,r.log({message:"[BACKGROUND] Proof generation failed, Broadcasting to runtime on cancel",logLevel:M.E$.INFO,type:M.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:M.E$.INFO,type:M.D_.BACKGROUND});case 16:if(!t.originalTabId){e.n=17;break}try{setTimeout(je(ke().m(function e(){return ke().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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.D_.BACKGROUND});case 23:return e.a(2)}},e,null,[[18,20],[13,15],[10,12],[6,8],[2,4],[1,22]])})),Xe.apply(this,arguments)}function We(){/*! 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 Je(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]())):(Je(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,Je(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,Je(f,"constructor",u),Je(u,"constructor",c),c.displayName="GeneratorFunction",Je(u,o,"GeneratorFunction"),Je(f),Je(f,o,"Generator"),Je(f,n,function(){return this}),Je(f,"toString",function(){return"[object Generator]"}),(We=function(){return{w:i,m:h}})()}function Je(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Je=function(e,t,r,n){function i(t,r){Je(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))},Je(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=We().m(function e(t,r,n,o){var i,s,a,c,u,l,f,h,d,p,g,y,E,m,b,v,O,I,A,S,w,R,T,_,N,C,P,L,D,U,x,G,F,k;return We().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:M.D_.BACKGROUND,sessionId:t.sessionId||"unknown",providerId:t.providerId||"unknown",appId:t.appId||"unknown"}),e.p=1,x=a,e.n=x===t.MESSAGE_ACTIONS.CONTENT_SCRIPT_LOADED?2:x===t.MESSAGE_ACTIONS.REQUEST_PROVIDER_DATA?4:x===t.MESSAGE_ACTIONS.CHECK_IF_MANAGED_TAB?5:x===t.MESSAGE_ACTIONS.START_VERIFICATION?6:x===t.MESSAGE_ACTIONS.CANCEL_VERIFICATION?12:x===t.MESSAGE_ACTIONS.OFFSCREEN_DOCUMENT_READY?16:x===t.MESSAGE_ACTIONS.CLOSE_CURRENT_TAB?17:x===t.MESSAGE_ACTIONS.FILTERED_REQUEST_FOUND?18:x===t.MESSAGE_ACTIONS.GET_CURRENT_TAB_ID?24:x===t.MESSAGE_ACTIONS.UPDATE_PUBLIC_DATA?25:x===t.MESSAGE_ACTIONS.UPDATE_EXPECT_MANY_CLAIMS?26:x===t.MESSAGE_ACTIONS.GET_PARAMETERS?33:x===t.MESSAGE_ACTIONS.REPORT_PROVIDER_ERROR?34:x===t.MESSAGE_ACTIONS.REQUEST_CLAIM?38:x===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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.D_.BACKGROUND,eventType:M.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:M.E$.INFO,type:M.D_.BACKGROUND,eventType:M.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:M.E$.INFO,type:M.D_.BACKGROUND,eventType:M.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:M.E$.INFO,type:M.D_.BACKGROUND,eventType:M.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:M.E$.INFO,type:M.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:M.D_.BACKGROUND}),f.info({message:"[BACKGROUND] Content script requested provider data",logLevel:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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&&(m=(null===(E=n.tab)||void 0===E?void 0:E.id)&&t.managedTabs.has(n.tab.id),f.info({message:"[BACKGROUND] Checking if tab is managed: "+m,logLevel:M.E$.INFO,type:M.D_.BACKGROUND}),o({success:!0,isManaged:m})),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:M.D_.BACKGROUND}),f.info({message:"Starting new verification using Reclaim Extension SDK",logLevel:M.E$.INFO,type:M.D_.BACKGROUND,eventType:M.Ru.IS_RECLAIM_EXTENSION_SDK}),f.info({message:"[BACKGROUND] Starting new verification flow with data: "+JSON.stringify(l),logLevel:M.E$.INFO,type:M.D_.BACKGROUND,eventType:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.D_.BACKGROUND}),e.n=9,Ke(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:M.E$.INFO,type:M.D_.BACKGROUND}),e.n=13,ze(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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.D_.BACKGROUND}),o({success:!0})):(f.error({message:"[BACKGROUND] OFFSCREEN_DOCUMENT_READY: Action not supported",logLevel:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.D_.BACKGROUND}),o({success:!0}))}):(f.error({message:"[BACKGROUND] CLOSE_CURRENT_TAB: No tab ID provided by sender.",logLevel:M.E$.INFO,type:M.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:M.E$.INFO,type:M.D_.BACKGROUND,eventType:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.D_.BACKGROUND}),o({success:!0,parameters:t.parameters||{}})):(f.error({message:"[BACKGROUND] UPDATE_EXPECT_MANY_CLAIMS: Tab is not managed by extension",logLevel:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.D_.BACKGROUND}),o({success:!0,result:T}),e.n=43;break;case 42:e.p=42,G=e.v,f.error({message:"[BACKGROUND] Request claim processing failed: "+(null==G?void 0:G.message),logLevel:M.E$.INFO,type:M.D_.BACKGROUND}),o({success:!1,error:(null==G?void 0:G.message)||String(G)});case 43:e.n=45;break;case 44:f.error({message:"[BACKGROUND] REQUEST_CLAIM: Tab is not managed by extension",logLevel:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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,F=e.v,f.error({message:"[BACKGROUND] INJECT_VIA_SCRIPTING failed: "+(null==F?void 0:F.message),logLevel:M.E$.INFO,type:M.D_.BACKGROUND,meta:{e:F}}),o({success:!1,error:(null==F?void 0:F.message)||String(F)});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:M.E$.INFO,type:M.D_.BACKGROUND}),o({success:!1,error:"Action not supported"});case 57:e.n=59;break;case 58:e.p=58,k=e.v,f.error({message:"[BACKGROUND] Error handling "+a+": "+(null==k?void 0:k.message),logLevel:M.E$.INFO,type:M.D_.BACKGROUND,meta:{error:k}}),o({success:!1,error:k.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 et(e){return et="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},et(e)}function tt(){/*! 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 rt(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]())):(rt(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,rt(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,rt(f,"constructor",u),rt(u,"constructor",c),c.displayName="GeneratorFunction",rt(u,o,"GeneratorFunction"),rt(f),rt(f,o,"Generator"),rt(f,n,function(){return this}),rt(f,"toString",function(){return"[object Generator]"}),(tt=function(){return{w:i,m:h}})()}function rt(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}rt=function(e,t,r,n){function i(t,r){rt(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))},rt(e,t,r,n)}function nt(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 ot(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?nt(Object(r),!0).forEach(function(t){it(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nt(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function it(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=et(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=et(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==et(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function st(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 at(e,t,r){e.proofGenerationQueue.push({claimData:t,requestHash:r}),e.isProcessingQueue||(e.sessionTimerManager.pauseSessionTimer(),ct(e))}function ct(e){return ut.apply(this,arguments)}function ut(){var e;return e=tt().m(function e(t){var r,n,o,i,s,a,c,u,l,f,h;return tt().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:M.D_.BACKGROUND}),!t.aborted){e.n=1;break}return r.info({message:"[BACKGROUND] Proof generation queue aborted",logLevel:M.E$.INFO,type:M.D_.BACKGROUND,eventType:M.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:M.E$.INFO,type:M.D_.BACKGROUND,eventType:M.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:M.E$.INFO,type:M.D_.BACKGROUND}),e.n=6,t.generateProof(ot(ot({},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:M.E$.INFO,type:M.D_.BACKGROUND,eventType:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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:M.E$.INFO,type:M.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?ct(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]])}),ut=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){st(i,n,o,s,a,"next",e)}function a(e){st(i,n,o,s,a,"throw",e)}s(void 0)})},ut.apply(this,arguments)}function lt(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=pt(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 ft(){/*! 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 ht(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]())):(ht(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,ht(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,ht(f,"constructor",u),ht(u,"constructor",c),c.displayName="GeneratorFunction",ht(u,o,"GeneratorFunction"),ht(f),ht(f,o,"Generator"),ht(f,n,function(){return this}),ht(f,"toString",function(){return"[object Generator]"}),(ft=function(){return{w:i,m:h}})()}function ht(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}ht=function(e,t,r,n){function i(t,r){ht(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))},ht(e,t,r,n)}function dt(e){return function(e){if(Array.isArray(e))return gt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||pt(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 pt(e,t){if(e){if("string"==typeof e)return gt(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)?gt(e,t):void 0}}function gt(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 yt(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 Et(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){yt(i,n,o,s,a,"next",e)}function a(e){yt(i,n,o,s,a,"throw",e)}s(void 0)})}}function mt(e,t){return bt.apply(this,arguments)}function bt(){return bt=Et(ft().m(function e(t,r){var n,o,i,s,a,c,u,l,f,h,d,p,g,y,E,m,b,v,O,I,A,S,w,R,T,_,N,C,P,L,D,U,x,G,F,k,B,j,K,V,$,H,Y,q,z,X,W,J;return ft().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:M.E$.INFO,type:M.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)),dt(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 dt(r)},l=function(){var e=Et(ft().m(function e(){var t;return ft().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=Et(ft().m(function e(t){var n;return ft().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:M.E$.INFO,type:M.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 vt(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:E=e.v,m=[],b=function(e){var t=JSON.stringify(e);m.some(function(e){return JSON.stringify(e)===t})||m.push(e)},v=u(o),O=c(o),I=lt(E);try{for(I.s();!(A=I.n()).done;){S=A.value.id,w=lt(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}),_=lt(v);try{for(_.s();!(N=_.n()).done;){C=N.value,P=lt(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=lt(O);try{for(U.s();!(x=U.n()).done;)G=x.value,b({url:t,partitionKey:{topLevelSite:G},storeId:S})}catch(e){U.e(e)}finally{U.f()}}}catch(e){I.e(e)}finally{I.f()}return e.n=3,Promise.all(m.map(function(e){return f(e)}));case 3:F=e.v,k=lt(F);try{for(k.s();!(B=k.n()).done;)j=B.value,y.push.apply(y,dt(j))}catch(e){k.e(e)}finally{k.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!==(X=dt(V.values())).length){e.n=8;break}return e.a(2,null);case 8:return X.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}),W=X.map(function(e){return"".concat(e.name,"=").concat(e.value)}).join("; "),e.a(2,W||null);case 9:return e.p=9,J=e.v,r.error({message:"[BACKGROUND] Error getting cookies for URL: "+(null==J?void 0:J.message),logLevel:M.E$.INFO,type:M.D_.BACKGROUND,meta:{error:null==J?void 0:J.message}}),e.a(2,null)}},e,null,[[0,9]])})),bt.apply(this,arguments)}function vt(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:M.E$.INFO,type:M.D_.BACKGROUND,meta:{error:null==e?void 0:e.message}}),!1}}function Ot(){/*! 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 It(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]())):(It(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,It(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,It(f,"constructor",u),It(u,"constructor",c),c.displayName="GeneratorFunction",It(u,o,"GeneratorFunction"),It(f),It(f,o,"Generator"),It(f,n,function(){return this}),It(f,"toString",function(){return"[object Generator]"}),(Ot=function(){return{w:i,m:h}})()}function It(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}It=function(e,t,r,n){function i(t,r){It(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))},It(e,t,r,n)}function At(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 St(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?At(Object(r),!0).forEach(function(t){wt(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):At(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function wt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=_t(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_t(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rt(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 Tt(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){Rt(i,n,o,s,a,"next",e)}function a(e){Rt(i,n,o,s,a,"throw",e)}s(void 0)})}}function _t(e){return _t="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},_t(e)}var Nt=(0,i.y8)({sessionId:"unknown",providerId:"unknown",appId:"unknown",source:"reclaim-extension-sdk"});function Ct(){A();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 Ne,fetchProviderData:f,updateSessionStatus:h,submitProofOnCallback:d,RECLAIM_SESSION_STATUS:o.Ew,MESSAGE_ACTIONS:o.wx,MESSAGE_SOURCES:o.J_,generateProof:F,formatProof:k,createClaimObject:we,loggerService:i.Ow,bgLogger:Nt,debugLogger:M.w9,DebugLogType:M.Ey,processFilteredRequest:null,failSession:null,submitProofs:null};Nt.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"===_t(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 Nt.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 $e.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 Ye.apply(n,[e].concat(r))},e.processFilteredRequest=function(){var t=Tt(Ot().m(function t(r,n,o,i){var a,c,u,l,f,h,d,p;return Ot().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()),Nt.setContext({sessionId:e.sessionId||"unknown",providerId:e.providerId||"unknown",appId:e.appId||"unknown",type:s.LOG_TYPES.BACKGROUND}),Nt.info({message:"[BACKGROUND] Filtering request for request hash: ".concat(n.requestHash),logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND}),t.n=2,mt(r.url,e.bgLogger);case 2:return(a=t.v)&&(r.cookieStr=a),Nt.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}}),Nt.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=St(St({},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,Nt.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}}),Nt.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),at(e,c,n.requestHash),Nt.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,Nt.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=Tt(Ot().m(function t(r){var n,o;return Ot().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,Nt.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)}}()),Nt.info({message:"[BACKGROUND] 🚀 Background initialization complete",logLevel:s.LOG_LEVEL.INFO,type:s.LOG_TYPES.BACKGROUND}),e}},770:(e,t,r)=>{r.d(t,{y8:()=>O,Ow:()=>v});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){E(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 E(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 m(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=new(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([n.DEVICE_ID_STORAGE_KEY]);case 2:if(!(t=e.v)[n.DEVICE_ID_STORAGE_KEY]){e.n=3;break}return this.deviceId=t[n.DEVICE_ID_STORAGE_KEY],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(E({},n.DEVICE_ID_STORAGE_KEY,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,u;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:u=e.v,a.error.call(a,c,u);case 5:return e.a(2)}},e,this)})),function(e){return o.apply(this,arguments)})}],t&&m(e.prototype,t),r&&m(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r,o,i,s}()),O=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=y({sessionId:"unknown",providerId:"unknown",appId:"unknown",source:(null===(e=v.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){v.log(y(y({},r),e))},info:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};v.log(y(y({},r),{},{logLevel:"INFO"},e))},debug:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};v.log(y(y({},r),{},{logLevel:"DEBUG"},e))},all:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};v.log(y(y({},r),{},{logLevel:"ALL"},e))},error:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};v.log(y(y({},r),{},{logLevel:"ALL"},e))}}}},859:(e,t,r)=>{r.r(t),r.d(t,{DEFAULT_LOG_CONFIG:()=>u,DEVICE_ID_STORAGE_KEY:()=>f,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:"https://logs.reclaimprotocol.org/api/business-logs/logDump"},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="TREX_reclaim_extension_sdk_log_config",f="TREX_reclaim_device_id"},952:(e,t,r)=>{r.d(t,{Sn:()=>i,oW:()=>o,fn:()=>n,wx:()=>u,J_:()=>c,vQ:()=>s,Ew:()=>a});var n="https://api.reclaimprotocol.org",o="ws://localhost:8001/ws",i={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)}},s={CHECK_EXTENSION:"TREX_RECLAIM_EXTENSION_CHECK",EXTENSION_RESPONSE:"TREX_RECLAIM_EXTENSION_RESPONSE",START_VERIFICATION:"TREX_RECLAIM_START_VERIFICATION",VERIFICATION_STARTED:"TREX_RECLAIM_VERIFICATION_STARTED",VERIFICATION_COMPLETED:"TREX_RECLAIM_VERIFICATION_COMPLETED",VERIFICATION_FAILED:"TREX_RECLAIM_VERIFICATION_FAILED",CANCEL_VERIFICATION:"TREX_RECLAIM_CANCEL_VERIFICATION",SET_PUBLIC_DATA:"TREX_RECLAIM_SET_PUBLIC_DATA",PARAMETERS_UPDATE:"TREX_RECLAIM_PARAMETERS_UPDATE",PARAMETERS_GET:"TREX_RECLAIM_PARAMETERS_GET",REPORT_PROVIDER_ERROR:"TREX_RECLAIM_REPORT_PROVIDER_ERROR",SET_EXPECT_MANY_CLAIMS:"TREX_RECLAIM_SET_EXPECT_MANY_CLAIMS",REQUEST_CLAIM:"TREX_RECLAIM_REQUEST_CLAIM",SET_LOG_CONFIG:"TREX_RECLAIM_SET_LOG_CONFIG"},a={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"},c={CONTENT_SCRIPT:"TREX_content-script",BACKGROUND:"TREX_background",OFFSCREEN:"TREX_offscreen",INJECTION_SCRIPT:"TREX_injection-script"},u={START_VERIFICATION:"TREX_START_VERIFICATION",CANCEL_VERIFICATION:"TREX_CANCEL_VERIFICATION",GENERATE_PROOF_REQUEST:"TREX_GENERATE_PROOF_REQUEST",CLAIM_CREATION_REQUESTED:"TREX_CLAIM_CREATION_REQUESTED",CLAIM_CREATION_SUCCESS:"TREX_CLAIM_CREATION_SUCCESS",CLAIM_CREATION_FAILED:"TREX_CLAIM_CREATION_FAILED",PROOF_GENERATION_STARTED:"TREX_PROOF_GENERATION_STARTED",PROOF_GENERATION_SUCCESS:"TREX_PROOF_GENERATION_SUCCESS",PROOF_GENERATION_FAILED:"TREX_PROOF_GENERATION_FAILED",PROOF_SUBMITTED:"TREX_PROOF_SUBMITTED",PROOF_SUBMISSION_FAILED:"TREX_PROOF_SUBMISSION_FAILED",GENERATE_PROOF:"TREX_GENERATE_PROOF",GENERATED_PROOF_RESPONSE:"TREX_GENERATED_PROOF_RESPONSE",GENERATE_CLAIM_ON_ATTESTOR:"TREX_GENERATE_CLAIM_ON_ATTESTOR",GET_PRIVATE_KEY:"TREX_GET_PRIVATE_KEY",GET_PRIVATE_KEY_RESPONSE:"TREX_GET_PRIVATE_KEY_RESPONSE",SHOW_PROVIDER_VERIFICATION_POPUP:"TREX_SHOW_PROVIDER_VERIFICATION_POPUP",OFFSCREEN_DOCUMENT_READY:"TREX_OFFSCREEN_DOCUMENT_READY",GENERATE_PROOF_RESPONSE:"TREX_GENERATE_PROOF_RESPONSE",PING_OFFSCREEN:"TREX_PING_OFFSCREEN",CLOSE_CURRENT_TAB:"TREX_CLOSE_CURRENT_TAB",GET_CURRENT_TAB_ID:"TREX_GET_CURRENT_TAB_ID",REQUEST_PROVIDER_DATA:"TREX_REQUEST_PROVIDER_DATA",PROVIDER_DATA_READY:"TREX_PROVIDER_DATA_READY",CONTENT_SCRIPT_LOADED:"TREX_CONTENT_SCRIPT_LOADED",SHOULD_INITIALIZE:"TREX_SHOULD_INITIALIZE",CHECK_IF_MANAGED_TAB:"TREX_CHECK_IF_MANAGED_TAB",FILTERED_REQUEST_FOUND:"TREX_FILTERED_REQUEST_FOUND",INTERCEPTED_REQUEST_AND_RESPONSE:"TREX_INTERCEPTED_REQUEST_AND_RESPONSE",UPDATE_PUBLIC_DATA:"TREX_UPDATE_PUBLIC_DATA",UPDATE_EXPECT_MANY_CLAIMS:"TREX_UPDATE_EXPECT_MANY_CLAIMS",GET_PARAMETERS:"TREX_GET_PARAMETERS",REPORT_PROVIDER_ERROR:"TREX_REPORT_PROVIDER_ERROR",REQUEST_CLAIM:"TREX_REQUEST_CLAIM",INJECT_VIA_SCRIPTING:"TREX_INJECT_VIA_SCRIPTING",GET_PROVIDER_ID:"TREX_GET_PROVIDER_ID",PROVIDER_ID_RESPONSE:"TREX_PROVIDER_ID_RESPONSE"}},997:(e,t,r)=>{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 E=r(296).WebSocket;p.WebSocket=E,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 m=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 m(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()}},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.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={};r.r(n),r.d(n,{OG:()=>je,My:()=>Le,Ph:()=>xe,lX:()=>Ge,Id:()=>Me,fg:()=>$e,qj:()=>Be,aT:()=>Ue,lq:()=>Fe,z:()=>ke,Q5:()=>Ye});r(997);function o(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function i(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 s(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");o(e.outputLen),o(e.blockLen)}function a(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 c(e,t){i(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}const u=BigInt(2**32-1),l=BigInt(32);function f(e,t=!1){return t?{h:Number(e&u),l:Number(e>>l&u)}:{h:0|Number(e>>l&u),l:0|Number(e&u)}}function h(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}=f(e[o],t);[r[o],n[o]]=[i,s]}return[r,n]}const d=(e,t,r)=>e<<r|t>>>32-r,p=(e,t,r)=>t<<r|e>>>32-r,g=(e,t,r)=>t<<r-32|e>>>64-r,y=(e,t,r)=>e<<r-32|t>>>64-r;const E={fromBig:f,split:h,toBig:(e,t)=>BigInt(e>>>0)<<l|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:d,rotlSL:p,rotlBH:g,rotlBL:y,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,b=e=>e instanceof Uint8Array,v=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),O=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),I=(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 A=async()=>{};async function S(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 A(),n+=e)}}function w(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)),!b(e))throw new Error("expected Uint8Array, got "+typeof e);return e}class R{clone(){return this._cloneInto()}}const T={}.toString;function _(e,t){if(void 0!==t&&"[object Object]"!==T.call(t))throw new Error("Options should be object or undefined");return Object.assign(e,t)}function N(e){const t=t=>e().update(w(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function C(e=32){if(m&&"function"==typeof m.getRandomValues)return m.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}const[P,L,D]=[[],[],[]],U=BigInt(0),x=BigInt(1),G=BigInt(2),F=BigInt(7),k=BigInt(256),B=BigInt(113);for(let e=0,t=x,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],P.push(2*(5*n+r)),L.push((e+1)*(e+2)/2%64);let o=U;for(let e=0;e<7;e++)t=(t<<x^(t>>F)*B)%k,t&G&&(o^=x<<(x<<BigInt(e))-x);D.push(o)}const[M,j]=h(D,!0),K=(e,t,r)=>r>32?g(e,t,r):d(e,t,r),V=(e,t,r)=>r>32?y(e,t,r):p(e,t,r);class $ extends R{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,o(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=v(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=K(i,s,1)^r[n],c=V(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=L[r],i=K(t,o,n),s=V(t,o,n),a=P[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]^=M[n],e[1]^=j[n]}r.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){a(this);const{blockLen:t,state:r}=this,n=(e=w(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){a(this,!1),i(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 o(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(c(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 $(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 H=(e,t,r)=>N(()=>new $(t,e,r)),Y=H(1,136,32),q="6.15.0";function z(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 X(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&&z(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 Q(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=${q}`),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 Z(e,t,r,n){if(!e)throw Q(t,r,n)}function ee(e,t,r,n){Z(e,t,"INVALID_ARGUMENT",{argument:r,value:n})}const te=["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 re(e){Z(te.indexOf(e)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:e}})}function ne(e,t,r){if(null==r&&(r=""),e!==t){let e=r,t="new";r&&(e+=".",t+=" "+r),Z(!1,`private constructor; use ${e}from* methods`,"UNSUPPORTED_OPERATION",{operation:t})}}function oe(e,t,r){if(e instanceof Uint8Array)return r?new Uint8Array(e):e;if("string"==typeof e&&e.match(/^0x(?:[0-9a-f][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}ee(!1,"invalid BytesLike value",t||"value",e)}function ie(e,t){return oe(e,t,!1)}function se(e,t){return oe(e,t,!0)}function ae(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 ce(e){return ae(e,!0)||e instanceof Uint8Array}const ue="0123456789abcdef";function le(e){const t=ie(e);let r="0x";for(let e=0;e<t.length;e++){const n=t[e];r+=ue[(240&n)>>4]+ue[15&n]}return r}function fe(e){return"0x"+e.map(e=>le(e).substring(2)).join("")}function he(e){return ae(e,!0)?(e.length-2)/2:ie(e).length}function de(e,t,r){const n=ie(e);return null!=r&&r>n.length&&Z(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r}),le(n.slice(null==t?0:t,null==r?n.length:r))}function pe(e,t,r){const n=ie(e);Z(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),le(o)}function ge(e,t){return pe(e,t,!0)}let ye=!1;const Ee=function(e){return Y(e)};let me=Ee;function be(e){const t=ie(e,"data");return le(me(t))}be._=Ee,be.lock=function(){ye=!0},be.register=function(e){if(ye)throw new TypeError("keccak256 is locked");me=e},Object.freeze(be);class ve extends R{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=O(this.buffer)}update(e){a(this);const{view:t,buffer:r,blockLen:n}=this,o=(e=w(e)).length;for(let i=0;i<o;){const s=Math.min(n-this.pos,o-i);if(s===n){const t=O(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){a(this),c(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 s=O(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++)s.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 Oe=(e,t,r)=>e&t^~e&r,Ie=(e,t,r)=>e&t^e&r^t&r,Ae=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]),Se=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),we=new Uint32Array(64);class Re extends ve{constructor(){super(64,32,8,!1),this.A=0|Se[0],this.B=0|Se[1],this.C=0|Se[2],this.D=0|Se[3],this.E=0|Se[4],this.F=0|Se[5],this.G=0|Se[6],this.H=0|Se[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)we[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=we[e-15],r=we[e-2],n=I(t,7)^I(t,18)^t>>>3,o=I(r,17)^I(r,19)^r>>>10;we[e]=o+we[e-7]+n+we[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+(I(s,6)^I(s,11)^I(s,25))+Oe(s,a,c)+Ae[e]+we[e]|0,l=(I(r,2)^I(r,13)^I(r,22))+Ie(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(){we.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Te=N(()=>new Re),_e=(BigInt(0),BigInt(1)),Ne=BigInt(2),Ce=e=>e instanceof Uint8Array,Pe=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Le(e){if(!Ce(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=Pe[e[r]];return t}function De(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}function Ue(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 xe(e){return De(Le(e))}function Ge(e){if(!Ce(e))throw new Error("Uint8Array expected");return De(Le(Uint8Array.from(e).reverse()))}function Fe(e,t){return Ue(e.toString(16).padStart(2*t,"0"))}function ke(e,t){return Fe(e,t).reverse()}function Be(e,t,r){let n;if("string"==typeof t)try{n=Ue(t)}catch(r){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${r}`)}else{if(!Ce(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 Me(...e){const t=new Uint8Array(e.reduce((e,t)=>e+t.length,0));let r=0;return e.forEach(e=>{if(!Ce(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length}),t}const je=e=>(Ne<<BigInt(e-1))-_e,Ke=e=>new Uint8Array(e),Ve=e=>Uint8Array.from(e);function $e(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=Ke(e),o=Ke(e),i=0;const s=()=>{n.fill(1),o.fill(0),i=0},a=(...e)=>r(o,n,...e),c=(e=Ke())=>{o=a(Ve([0]),e),n=a(),0!==e.length&&(o=a(Ve([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 Me(...r)};return(e,t)=>{let r;for(s(),c(e);!(r=t(u()));)c();return s(),r}}const He={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 Ye(e,t,r={}){const n=(t,r,n)=>{const o=He[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
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
12
|
+
const qe=BigInt(0),ze=BigInt(1),Xe=BigInt(2),We=BigInt(3),Je=BigInt(4),Qe=BigInt(5),Ze=BigInt(8);BigInt(9),BigInt(16);function et(e,t){const r=e%t;return r>=qe?r:t+r}function tt(e,t,r){if(r<=qe||t<qe)throw new Error("Expected power/modulo > 0");if(r===ze)return qe;let n=ze;for(;t>qe;)t&ze&&(n=n*e%r),e=e*e%r,t>>=ze;return n}function rt(e,t,r){let n=e;for(;t-- >qe;)n*=n,n%=r;return n}function nt(e,t){if(e===qe||t<=qe)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=et(e,t),n=t,o=qe,i=ze,s=ze,a=qe;for(;r!==qe;){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!==ze)throw new Error("invert: does not exist");return et(o,t)}function ot(e){if(e%Je===We){const t=(e+ze)/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%Ze===Qe){const t=(e-Qe)/Ze;return function(e,r){const n=e.mul(r,Xe),o=e.pow(n,t),i=e.mul(r,o),s=e.mul(e.mul(i,Xe),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-ze)/Xe;let r,n,o;for(r=e-ze,n=0;r%Xe===qe;r/=Xe,n++);for(o=Xe;o<e&&tt(o,t,e)!==e-ze;o++);if(1===n){const t=(e+ze)/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+ze)/Xe;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,ze<<BigInt(a-t-1));c=e.sqr(r),u=e.mul(u,r),l=e.mul(l,c),a=t}return u}}(e)}const it=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function st(e,t){const r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function at(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 ct(e){const t=at(e);return t+Math.ceil(t/2)}class ut extends R{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,s(e);const r=w(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 a(this),this.iHash.update(e),this}digestInto(e){a(this),i(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 lt=(e,t,r)=>new ut(e,t).update(r).digest();lt.create=(e,t)=>new ut(e,t);
|
|
13
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
14
|
+
const ft=BigInt(0),ht=BigInt(1);function dt(e){return Ye(e.Fp,it.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),Ye(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...st(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}const{Ph:pt,aT:gt}=n,yt={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:t}=yt;if(e.length<2||2!==e[0])throw new t("Invalid signature integer tag");const r=e[1],n=e.subarray(2,r+2);if(!r||n.length!==r)throw new t("Invalid signature integer: wrong length");if(128&n[0])throw new t("Invalid signature integer: negative");if(0===n[0]&&!(128&n[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:pt(n),l:e.subarray(r+2)}},toSig(e){const{Err:t}=yt,r="string"==typeof e?gt(e):e;if(!(r instanceof Uint8Array))throw new Error("ui8a expected");let n=r.length;if(n<2||48!=r[0])throw new t("Invalid signature tag");if(r[1]!==n-2)throw new t("Invalid signature: incorrect length");const{d:o,l:i}=yt._parseInt(r.subarray(2)),{d:s,l:a}=yt._parseInt(i);if(a.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s}},hexFromSig(e){const t=e=>8&Number.parseInt(e[0],16)?"00"+e:e,r=e=>{const t=e.toString(16);return 1&t.length?`0${t}`:t},n=t(r(e.s)),o=t(r(e.r)),i=n.length/2,s=o.length/2,a=r(i),c=r(s);return`30${r(s+i+4)}02${c}${o}02${a}${n}`}},Et=BigInt(0),mt=BigInt(1),bt=(BigInt(2),BigInt(3));BigInt(4);function vt(e){const t=
|
|
15
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
16
|
+
function(e){const t=dt(e);Ye(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:o}=t;if(r){if(!n.eql(o,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:r}=t,n=t.toBytes||((e,t,n)=>{const o=t.toAffine();return Me(Uint8Array.from([4]),r.toBytes(o.x),r.toBytes(o.y))}),o=t.fromBytes||(e=>{const t=e.subarray(1);return{x:r.fromBytes(t.subarray(0,r.BYTES)),y:r.fromBytes(t.subarray(r.BYTES,2*r.BYTES))}});function i(e){const{a:n,b:o}=t,i=r.sqr(e),s=r.mul(i,e);return r.add(r.add(s,r.mul(e,n)),o)}if(!r.eql(r.sqr(t.Gy),i(t.Gx)))throw new Error("bad generator point: equation left != right");function s(e){return"bigint"==typeof e&&Et<e&&e<t.n}function a(e){if(!s(e))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function c(e){const{allowedPrivateKeyLengths:r,nByteLength:n,wrapPrivateKey:o,n:i}=t;if(r&&"bigint"!=typeof e){if(e instanceof Uint8Array&&(e=Le(e)),"string"!=typeof e||!r.includes(e.length))throw new Error("Invalid key");e=e.padStart(2*n,"0")}let s;try{s="bigint"==typeof e?e:xe(Be("private key",e,n))}catch(t){throw new Error(`private key must be ${n} bytes, hex or bigint, not ${typeof e}`)}return o&&(s=et(s,i)),a(s),s}const u=new Map;function l(e){if(!(e instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(e,t,n){if(this.px=e,this.py=t,this.pz=n,null==e||!r.isValid(e))throw new Error("x required");if(null==t||!r.isValid(t))throw new Error("y required");if(null==n||!r.isValid(n))throw new Error("z required")}static fromAffine(e){const{x:t,y:n}=e||{};if(!e||!r.isValid(t)||!r.isValid(n))throw new Error("invalid affine point");if(e instanceof f)throw new Error("projective point not allowed");const o=e=>r.eql(e,r.ZERO);return o(t)&&o(n)?f.ZERO:new f(t,n,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=r.invertBatch(e.map(e=>e.pz));return e.map((e,r)=>e.toAffine(t[r])).map(f.fromAffine)}static fromHex(e){const t=f.fromAffine(o(Be("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return f.BASE.multiply(c(e))}_setWindowSize(e){this._WINDOW_SIZE=e,u.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:e,y:n}=this.toAffine();if(!r.isValid(e)||!r.isValid(n))throw new Error("bad point: x or y not FE");const o=r.sqr(n),s=i(e);if(!r.eql(o,s))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:e}=this.toAffine();if(r.isOdd)return!r.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){l(e);const{px:t,py:n,pz:o}=this,{px:i,py:s,pz:a}=e,c=r.eql(r.mul(t,a),r.mul(i,o)),u=r.eql(r.mul(n,a),r.mul(s,o));return c&&u}negate(){return new f(this.px,r.neg(this.py),this.pz)}double(){const{a:e,b:n}=t,o=r.mul(n,bt),{px:i,py:s,pz:a}=this;let c=r.ZERO,u=r.ZERO,l=r.ZERO,h=r.mul(i,i),d=r.mul(s,s),p=r.mul(a,a),g=r.mul(i,s);return g=r.add(g,g),l=r.mul(i,a),l=r.add(l,l),c=r.mul(e,l),u=r.mul(o,p),u=r.add(c,u),c=r.sub(d,u),u=r.add(d,u),u=r.mul(c,u),c=r.mul(g,c),l=r.mul(o,l),p=r.mul(e,p),g=r.sub(h,p),g=r.mul(e,g),g=r.add(g,l),l=r.add(h,h),h=r.add(l,h),h=r.add(h,p),h=r.mul(h,g),u=r.add(u,h),p=r.mul(s,a),p=r.add(p,p),h=r.mul(p,g),c=r.sub(c,h),l=r.mul(p,d),l=r.add(l,l),l=r.add(l,l),new f(c,u,l)}add(e){l(e);const{px:n,py:o,pz:i}=this,{px:s,py:a,pz:c}=e;let u=r.ZERO,h=r.ZERO,d=r.ZERO;const p=t.a,g=r.mul(t.b,bt);let y=r.mul(n,s),E=r.mul(o,a),m=r.mul(i,c),b=r.add(n,o),v=r.add(s,a);b=r.mul(b,v),v=r.add(y,E),b=r.sub(b,v),v=r.add(n,i);let O=r.add(s,c);return v=r.mul(v,O),O=r.add(y,m),v=r.sub(v,O),O=r.add(o,i),u=r.add(a,c),O=r.mul(O,u),u=r.add(E,m),O=r.sub(O,u),d=r.mul(p,v),u=r.mul(g,m),d=r.add(u,d),u=r.sub(E,d),d=r.add(E,d),h=r.mul(u,d),E=r.add(y,y),E=r.add(E,y),m=r.mul(p,m),v=r.mul(g,v),E=r.add(E,m),m=r.sub(y,m),m=r.mul(p,m),v=r.add(v,m),y=r.mul(E,v),h=r.add(h,y),y=r.mul(O,v),u=r.mul(b,u),u=r.sub(u,y),y=r.mul(b,E),d=r.mul(O,d),d=r.add(d,y),new f(u,h,d)}subtract(e){return this.add(e.negate())}is0(){return this.equals(f.ZERO)}wNAF(e){return d.wNAFCached(this,u,e,e=>{const t=r.invertBatch(e.map(e=>e.pz));return e.map((e,r)=>e.toAffine(t[r])).map(f.fromAffine)})}multiplyUnsafe(e){const n=f.ZERO;if(e===Et)return n;if(a(e),e===mt)return this;const{endo:o}=t;if(!o)return d.unsafeLadder(this,e);let{k1neg:i,k1:s,k2neg:c,k2:u}=o.splitScalar(e),l=n,h=n,p=this;for(;s>Et||u>Et;)s&mt&&(l=l.add(p)),u&mt&&(h=h.add(p)),p=p.double(),s>>=mt,u>>=mt;return i&&(l=l.negate()),c&&(h=h.negate()),h=new f(r.mul(h.px,o.beta),h.py,h.pz),l.add(h)}multiply(e){a(e);let n,o,i=e;const{endo:s}=t;if(s){const{k1neg:e,k1:t,k2neg:a,k2:c}=s.splitScalar(i);let{p:u,f:l}=this.wNAF(t),{p:h,f:p}=this.wNAF(c);u=d.constTimeNegate(e,u),h=d.constTimeNegate(a,h),h=new f(r.mul(h.px,s.beta),h.py,h.pz),n=u.add(h),o=l.add(p)}else{const{p:e,f:t}=this.wNAF(i);n=e,o=t}return f.normalizeZ([n,o])[0]}multiplyAndAddUnsafe(e,t,r){const n=f.BASE,o=(e,t)=>t!==Et&&t!==mt&&e.equals(n)?e.multiply(t):e.multiplyUnsafe(t),i=o(this,t).add(o(e,r));return i.is0()?void 0:i}toAffine(e){const{px:t,py:n,pz:o}=this,i=this.is0();null==e&&(e=i?r.ONE:r.inv(o));const s=r.mul(t,e),a=r.mul(n,e),c=r.mul(o,e);if(i)return{x:r.ZERO,y:r.ZERO};if(!r.eql(c,r.ONE))throw new Error("invZ was invalid");return{x:s,y:a}}isTorsionFree(){const{h:e,isTorsionFree:r}=t;if(e===mt)return!0;if(r)return r(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:r}=t;return e===mt?this:r?r(f,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return this.assertValidity(),n(f,this,e)}toHex(e=!0){return Le(this.toRawBytes(e))}}f.BASE=new f(t.Gx,t.Gy,r.ONE),f.ZERO=new f(r.ZERO,r.ONE,r.ZERO);const h=t.nBitLength,d=function(e,t){const r=(e,t)=>{const r=t.negate();return e?r:t},n=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:r,unsafeLadder(t,r){let n=e.ZERO,o=t;for(;r>ft;)r&ht&&(n=n.add(o)),o=o.double(),r>>=ht;return n},precomputeWindow(e,t){const{windows:r,windowSize:o}=n(t),i=[];let s=e,a=s;for(let e=0;e<r;e++){a=s,i.push(a);for(let e=1;e<o;e++)a=a.add(s),i.push(a);s=a.double()}return i},wNAF(t,o,i){const{windows:s,windowSize:a}=n(t);let c=e.ZERO,u=e.BASE;const l=BigInt(2**t-1),f=2**t,h=BigInt(t);for(let e=0;e<s;e++){const t=e*a;let n=Number(i&l);i>>=h,n>a&&(n-=f,i+=ht);const s=t,d=t+Math.abs(n)-1,p=e%2!=0,g=n<0;0===n?u=u.add(r(p,o[s])):c=c.add(r(g,o[d]))}return{p:c,f:u}},wNAFCached(e,t,r,n){const o=e._WINDOW_SIZE||1;let i=t.get(e);return i||(i=this.precomputeWindow(e,o),1!==o&&t.set(e,n(i))),this.wNAF(o,i,r)}}}(f,t.endo?Math.ceil(h/2):h);return{CURVE:t,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:i,isWithinCurveOrder:s}}function Ot(e){const t=function(e){const t=dt(e);return Ye(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:r,n}=t,o=r.BYTES+1,i=2*r.BYTES+1;function s(e){return et(e,n)}function a(e){return nt(e,n)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:f}=vt({...t,toBytes(e,t,n){const o=t.toAffine(),i=r.toBytes(o.x),s=Me;return n?s(Uint8Array.from([t.hasEvenY()?2:3]),i):s(Uint8Array.from([4]),i,r.toBytes(o.y))},fromBytes(e){const t=e.length,n=e[0],s=e.subarray(1);if(t!==o||2!==n&&3!==n){if(t===i&&4===n){return{x:r.fromBytes(s.subarray(0,r.BYTES)),y:r.fromBytes(s.subarray(r.BYTES,2*r.BYTES))}}throw new Error(`Point of length ${t} was invalid. Expected ${o} compressed bytes or ${i} uncompressed bytes`)}{const e=xe(s);if(!(Et<(a=e)&&a<r.ORDER))throw new Error("Point is not on curve");const t=l(e);let o=r.sqrt(t);return!(1&~n)!==((o&mt)===mt)&&(o=r.neg(o)),{x:e,y:o}}var a}}),h=e=>Le(Fe(e,t.nByteLength));function d(e){return e>n>>mt}const p=(e,t,r)=>xe(e.slice(t,r));class g{constructor(e,t,r){this.r=e,this.s=t,this.recovery=r,this.assertValidity()}static fromCompact(e){const r=t.nByteLength;return e=Be("compactSignature",e,2*r),new g(p(e,0,r),p(e,r,2*r))}static fromDER(e){const{r:t,s:r}=yt.toSig(Be("DER",e));return new g(t,r)}assertValidity(){if(!f(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!f(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(e){return new g(this.r,this.s,e)}recoverPublicKey(e){const{r:n,s:o,recovery:i}=this,u=b(Be("msgHash",e));if(null==i||![0,1,2,3].includes(i))throw new Error("recovery id invalid");const l=2===i||3===i?n+t.n:n;if(l>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const f=1&i?"03":"02",d=c.fromHex(f+h(l)),p=a(l),g=s(-u*p),y=s(o*p),E=c.BASE.multiplyAndAddUnsafe(d,g,y);if(!E)throw new Error("point at infinify");return E.assertValidity(),E}hasHighS(){return d(this.s)}normalizeS(){return this.hasHighS()?new g(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return Ue(this.toDERHex())}toDERHex(){return yt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Ue(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const y={isValidPrivateKey(e){try{return u(e),!0}catch(e){return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const e=ct(t.n);return function(e,t,r=!1){const n=e.length,o=at(t),i=ct(t);if(n<16||n<i||n>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);const s=et(r?xe(e):Ge(e),t-ze)+ze;return r?ke(s,o):Fe(s,o)}(t.randomBytes(e),t.n)},precompute:(e=8,t=c.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function E(e){const t=e instanceof Uint8Array,r="string"==typeof e,n=(t||r)&&e.length;return t?n===o||n===i:r?n===2*o||n===2*i:e instanceof c}const m=t.bits2int||function(e){const r=xe(e),n=8*e.length-t.nBitLength;return n>0?r>>BigInt(n):r},b=t.bits2int_modN||function(e){return s(m(e))},v=je(t.nBitLength);function O(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(Et<=e&&e<v))throw new Error(`bigint expected < 2^${t.nBitLength}`);return Fe(e,t.nByteLength)}function I(e,n,o=A){if(["recovered","canonical"].some(e=>e in o))throw new Error("sign() legacy options not supported");const{hash:i,randomBytes:l}=t;let{lowS:h,prehash:p,extraEntropy:y}=o;null==h&&(h=!0),e=Be("msgHash",e),p&&(e=Be("prehashed msgHash",i(e)));const E=b(e),v=u(n),I=[O(v),O(E)];if(null!=y){const e=!0===y?l(r.BYTES):y;I.push(Be("extraEntropy",e))}const S=Me(...I),w=E;return{seed:S,k2sig:function(e){const t=m(e);if(!f(t))return;const r=a(t),n=c.BASE.multiply(t).toAffine(),o=s(n.x);if(o===Et)return;const i=s(r*s(w+o*v));if(i===Et)return;let u=(n.x===o?0:2)|Number(n.y&mt),l=i;return h&&d(i)&&(l=function(e){return d(e)?s(-e):e}(i),u^=1),new g(o,l,u)}}}const A={lowS:t.lowS,prehash:!1},S={lowS:t.lowS,prehash:!1};return c.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return c.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,r=!0){if(E(e))throw new Error("first arg must be private key");if(!E(t))throw new Error("second arg must be public key");return c.fromHex(t).multiply(u(e)).toRawBytes(r)},sign:function(e,r,n=A){const{seed:o,k2sig:i}=I(e,r,n),s=t;return $e(s.hash.outputLen,s.nByteLength,s.hmac)(o,i)},verify:function(e,r,n,o=S){const i=e;if(r=Be("msgHash",r),n=Be("publicKey",n),"strict"in o)throw new Error("options.strict was renamed to lowS");const{lowS:u,prehash:l}=o;let f,h;try{if("string"==typeof i||i instanceof Uint8Array)try{f=g.fromDER(i)}catch(e){if(!(e instanceof yt.Err))throw e;f=g.fromCompact(i)}else{if("object"!=typeof i||"bigint"!=typeof i.r||"bigint"!=typeof i.s)throw new Error("PARSE");{const{r:e,s:t}=i;f=new g(e,t)}}h=c.fromHex(n)}catch(e){if("PARSE"===e.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(u&&f.hasHighS())return!1;l&&(r=t.hash(r));const{r:d,s:p}=f,y=b(r),E=a(p),m=s(y*E),v=s(d*E),O=c.BASE.multiplyAndAddUnsafe(h,m,v)?.toAffine();return!!O&&s(O.x)===d},ProjectivePoint:c,Signature:g,utils:y}}
|
|
17
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
18
|
+
function It(e){return{hash:e,hmac:(t,...r)=>lt(e,t,function(...e){const t=new Uint8Array(e.reduce((e,t)=>e+t.length,0));let r=0;return e.forEach(e=>{if(!b(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length}),t}(...r)),randomBytes:C}}
|
|
19
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
20
|
+
const At=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),St=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),wt=BigInt(1),Rt=BigInt(2),Tt=(e,t)=>(e+t/Rt)/t;function _t(e){const t=At,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=rt(l,r,t)*l%t,h=rt(f,r,t)*l%t,d=rt(h,Rt,t)*u%t,p=rt(d,o,t)*d%t,g=rt(p,i,t)*p%t,y=rt(g,a,t)*g%t,E=rt(y,c,t)*y%t,m=rt(E,a,t)*g%t,b=rt(m,r,t)*l%t,v=rt(b,s,t)*p%t,O=rt(v,n,t)*u%t,I=rt(O,Rt,t);if(!Nt.eql(Nt.sqr(I),e))throw new Error("Cannot find square root");return I}const Nt=function(e,t,r=!1,n={}){if(e<=qe)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:o,nByteLength:i}=st(e,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=ot(e),a=Object.freeze({ORDER:e,BITS:o,BYTES:i,MASK:je(o),ZERO:qe,ONE:ze,create:t=>et(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return qe<=t&&t<e},is0:e=>e===qe,isOdd:e=>(e&ze)===ze,neg:t=>et(-t,e),eql:(e,t)=>e===t,sqr:t=>et(t*t,e),add:(t,r)=>et(t+r,e),sub:(t,r)=>et(t-r,e),mul:(t,r)=>et(t*r,e),pow:(e,t)=>function(e,t,r){if(r<qe)throw new Error("Expected power > 0");if(r===qe)return e.ONE;if(r===ze)return t;let n=e.ONE,o=t;for(;r>qe;)r&ze&&(n=e.mul(n,o)),o=e.sqr(o),r>>=ze;return n}(a,e,t),div:(t,r)=>et(t*nt(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>nt(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?ke(e,i):Fe(e,i),fromBytes:e=>{if(e.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${e.length}`);return r?Ge(e):xe(e)}});return Object.freeze(a)}(At,void 0,void 0,{sqrt:_t}),Ct=function(e,t){const r=t=>Ot({...e,...It(t)});return Object.freeze({...r(t),create:r})}({a:BigInt(0),b:BigInt(7),Fp:Nt,n:St,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=St,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-wt*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=r,s=BigInt("0x100000000000000000000000000000000"),a=Tt(i*e,t),c=Tt(-n*e,t);let u=et(e-a*r-c*o,t),l=et(-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}}}},Te);BigInt(0);Ct.ProjectivePoint;const Pt=BigInt(0),Lt=BigInt(1),Dt=9007199254740991;function Ut(e,t){switch(typeof e){case"bigint":return e;case"number":return ee(Number.isInteger(e),"underflow",t||"value",e),ee(e>=-Dt&&e<=Dt,"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){ee(!1,`invalid BigNumberish string: ${r.message}`,t||"value",e)}}ee(!1,"invalid BigNumberish value",t||"value",e)}function xt(e,t){const r=Ut(e,t);return Z(r>=Pt,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:e}),r}const Gt="0123456789abcdef";function Ft(e){if(e instanceof Uint8Array){let t="0x0";for(const r of e)t+=Gt[r>>4],t+=Gt[15&r];return BigInt(t)}return Ut(e)}function kt(e,t){switch(typeof e){case"bigint":return ee(e>=-Dt&&e<=Dt,"overflow",t||"value",e),Number(e);case"number":return ee(Number.isInteger(e),"underflow",t||"value",e),ee(e>=-Dt&&e<=Dt,"overflow",t||"value",e),e;case"string":try{if(""===e)throw new Error("empty string");return kt(BigInt(e),t)}catch(r){ee(!1,`invalid numeric string: ${r.message}`,t||"value",e)}}ee(!1,"invalid numeric value",t||"value",e)}function Bt(e,t){let r=xt(e,"value").toString(16);if(null==t)r.length%2&&(r="0"+r);else{const n=kt(t,"width");for(Z(2*n>=r.length,`value exceeds width (${n} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:e});r.length<2*n;)r="0"+r}return"0x"+r}function Mt(e){const t=xt(e,"value");if(t===Pt)return new Uint8Array([]);let r=t.toString(16);r.length%2&&(r="0"+r);const n=new Uint8Array(r.length/2);for(let e=0;e<n.length;e++){const t=2*e;n[e]=parseInt(r.substring(t,t+2),16)}return n}const jt="0x0000000000000000000000000000000000000000000000000000000000000000",Kt=BigInt(0),Vt=BigInt(1),$t=BigInt(2),Ht=BigInt(27),Yt=BigInt(28),qt=BigInt(35),zt={};function Xt(e){return ge(Mt(e),32)}class Wt{#e;#t;#r;#n;get r(){return this.#e}set r(e){ee(32===he(e),"invalid r","value",e),this.#e=le(e)}get s(){return ee(parseInt(this.#t.substring(0,3))<8,"non-canonical s; use ._s","s",this.#t),this.#t}set s(e){ee(32===he(e),"invalid s","value",e),this.#t=le(e)}get _s(){return this.#t}isValid(){return parseInt(this.#t.substring(0,3))<8}get v(){return this.#r}set v(e){const t=kt(e,"value");ee(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:Wt.getChainId(e)}get yParity(){return 27===this.v?0:1}get yParityAndS(){const e=ie(this.s);return this.yParity&&(e[0]|=128),le(e)}get compactSerialized(){return fe([this.r,this.yParityAndS])}get serialized(){return fe([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(e,t,r,n){ne(e,zt,"Signature"),this.#e=t,this.#t=r,this.#r=n,this.#n=null}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this._s}"${this.isValid()?"":', valid: "false"'}, yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new Wt(zt,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}}static getChainId(e){const t=Ut(e,"v");return t==Ht||t==Yt?Kt:(ee(t>=qt,"invalid EIP-155 v","v",e),(t-qt)/$t)}static getChainIdV(e,t){return Ut(e)*$t+BigInt(35+t-27)}static getNormalizedV(e){const t=Ut(e);return t===Kt||t===Ht?27:t===Vt||t===Yt?28:(ee(t>=qt,"invalid v","v",e),t&Vt?27:28)}static from(e){function t(t,r){ee(t,r,"signature",e)}if(null==e)return new Wt(zt,jt,jt,27);if("string"==typeof e){const r=ie(e,"signature");if(64===r.length){const e=le(r.slice(0,32)),t=r.slice(32,64),n=128&t[0]?28:27;return t[0]&=127,new Wt(zt,e,le(t),n)}if(65===r.length){const e=le(r.slice(0,32)),t=le(r.slice(32,64)),n=Wt.getNormalizedV(r[64]);return new Wt(zt,e,t,n)}t(!1,"invalid raw signature length")}if(e instanceof Wt)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(ae(r,32),"invalid yParityAndS");const e=ie(r);return e[0]&=127,le(e)}t(!1,"missing s")}(e.s,e.yParityAndS),{networkV:i,v:s}=function(e,r,n){if(null!=e){const t=Ut(e);return{networkV:t>=qt?t:void 0,v:Wt.getNormalizedV(t)}}if(null!=r)return t(ae(r,32),"invalid yParityAndS"),{v:128&ie(r)[0]?28:27};if(null!=n){switch(kt(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 Wt(zt,n,o,s);return i&&(a.#n=i),t(null==e.yParity||kt(e.yParity,"sig.yParity")===a.yParity,"yParity mismatch"),t(null==e.yParityAndS||e.yParityAndS===a.yParityAndS,"yParityAndS mismatch"),a}}class Jt{#o;constructor(e){ee(32===he(e),"invalid private key","privateKey","[REDACTED]"),this.#o=le(e)}get privateKey(){return this.#o}get publicKey(){return Jt.computePublicKey(this.#o)}get compressedPublicKey(){return Jt.computePublicKey(this.#o,!0)}sign(e){ee(32===he(e),"invalid digest length","digest",e);const t=Ct.sign(se(e),se(this.#o),{lowS:!0});return Wt.from({r:Bt(t.r,32),s:Bt(t.s,32),v:t.recovery?28:27})}computeSharedSecret(e){const t=Jt.computePublicKey(e);return le(Ct.getSharedSecret(se(this.#o),ie(t),!1))}static computePublicKey(e,t){let r=ie(e,"key");if(32===r.length){return le(Ct.getPublicKey(r,!!t))}if(64===r.length){const e=new Uint8Array(65);e[0]=4,e.set(r,1),r=e}return le(Ct.ProjectivePoint.fromHex(r).toRawBytes(t))}static recoverPublicKey(e,t){ee(32===he(e),"invalid digest length","digest",e);const r=Wt.from(t);let n=Ct.Signature.fromCompact(se(fe([r.r,r.s])));n=n.addRecoveryBit(r.yParity);const o=n.recoverPublicKey(se(e));return ee(null!=o,"invalid signature for digest","signature",t),"0x"+o.toHex(!1)}static addPoints(e,t,r){const n=Ct.ProjectivePoint.fromHex(Jt.computePublicKey(e).substring(2)),o=Ct.ProjectivePoint.fromHex(Jt.computePublicKey(t).substring(2));return"0x"+n.add(o).toHex(!!r)}}const Qt=BigInt(0),Zt=BigInt(36);function er(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=ie(be(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 tr={};for(let e=0;e<10;e++)tr[String(e)]=String(e);for(let e=0;e<26;e++)tr[String.fromCharCode(65+e)]=String(10+e);function rr(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map(e=>tr[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 nr=function(){const e={};for(let t=0;t<36;t++){e["0123456789abcdefghijklmnopqrstuvwxyz"[t]]=BigInt(t)}return e}();function or(e){if(ee("string"==typeof e,"invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/)){e.startsWith("0x")||(e="0x"+e);const t=er(e);return ee(!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}$/)){ee(e.substring(2,4)===rr(e),"bad icap checksum","address",e);let t=function(e){e=e.toLowerCase();let t=Qt;for(let r=0;r<e.length;r++)t=t*Zt+nr[e[r]];return t}(e.substring(4)).toString(16);for(;t.length<40;)t="0"+t;return er("0x"+t)}ee(!1,"invalid address","address",e)}async function ir(e,t){const r=await t;return null!=r&&"0x0000000000000000000000000000000000000000"!==r||(Z("string"!=typeof e,"unconfigured name","UNCONFIGURED_NAME",{value:e}),ee(!1,"invalid AddressLike value; did not resolve to a value address","target",e)),or(r)}function sr(e,t){return"string"==typeof e?e.match(/^0x[0-9a-f]{40}$/i)?or(e):(Z(null!=t,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),ir(e,t.resolveName(e))):(r=e)&&"function"==typeof r.getAddress?ir(e,e.getAddress()):e&&"function"==typeof e.then?ir(e,e):void ee(!1,"unsupported addressable value","target",e);var r}function ar(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){ee(!1,`invalid codepoint at offset ${t}; ${e}`,"bytes",r)},ignore:ar,replace:function(e,t,r,n,o){return"OVERLONG"===e?(ee("number"==typeof o,"invalid bad code point for replacement","badCodepoint",o),n.push(o),0):(n.push(65533),ar(e,t,r))}});function cr(e,t){ee("string"==typeof e,"invalid string value","str",e),null!=t&&(re(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);ee(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 ur(e){return"string"==typeof e&&(e=cr(e)),be(fe([cr("Ethereum Signed Message:\n"),cr(String(e.length)),e]))}function lr(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function fr(e){if(Array.isArray(e)){let t=[];if(e.forEach(function(e){t=t.concat(fr(e))}),t.length<=55)return t.unshift(192+t.length),t;const r=lr(t.length);return r.unshift(247+r.length),r.concat(t)}const t=Array.prototype.slice.call(ie(e,"object"));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const r=lr(t.length);return r.unshift(183+r.length),r.concat(t)}const hr="0123456789abcdef";function dr(e){let t="0x";for(const r of fr(e))t+=hr[r>>4],t+=hr[15&r];return t}function pr(e){return ee("string"==typeof e.address,"invalid address for hashAuthorization","auth.address",e),be(fe(["0x05",dr([null!=e.chainId?Mt(e.chainId):"0x",or(e.address),null!=e.nonce?Mt(e.nonce):"0x"])]))}function gr(e){return be(cr(e))}const yr=new Uint8Array(32);yr.fill(0);const Er=BigInt(-1),mr=BigInt(0),br=BigInt(1),vr=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Or=Bt(br,32),Ir=Bt(mr,32),Ar={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Sr=["name","version","chainId","verifyingContract","salt"];function wr(e){return function(t){return ee("string"==typeof t,`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const Rr={name:wr("name"),version:wr("version"),chainId:function(e){const t=Ut(e,"domain.chainId");return ee(t>=0,"invalid chain ID","domain.chainId",e),Number.isSafeInteger(t)?Number(t):function(e){let t=le(ce(e)?e:Mt(e)).substring(2);for(;t.startsWith("0");)t=t.substring(1);return""===t&&(t="0"),"0x"+t}(t)},verifyingContract:function(e){try{return or(e).toLowerCase()}catch(e){}ee(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){const t=ie(e,"domain.salt");return ee(32===t.length,'invalid domain value "salt"',"domain.salt",e),le(t)}};function Tr(e){{const t=e.match(/^(u?)int(\d+)$/);if(t){const r=""===t[1],n=parseInt(t[2]);ee(n%8==0&&0!==n&&n<=256&&t[2]===String(n),"invalid numeric width","type",e);const o=function(e,t){const r=xt(e,"value"),n=BigInt(kt(t,"bits"));return r&(Lt<<n)-Lt}(vr,r?n-1:n),i=r?(o+br)*Er:mr;return function(t){const n=Ut(t,"value");return ee(n>=i&&n<=o,`value out-of-bounds for ${e}`,"value",n),Bt(r?function(e,t){let r=Ut(e,"value");const n=BigInt(kt(t,"width")),o=Lt<<n-Lt;if(r<Pt)return r=-r,Z(r<=o,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:e}),(~r&(Lt<<n)-Lt)+Lt;return Z(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 ee(0!==r&&r<=32&&t[1]===String(r),"invalid bytes width","type",e),function(t){return ee(ie(t).length===r,`invalid length for ${e}`,"value",t),function(e){const t=ie(e),r=t.length%32;return r?fe([t,yr.slice(r)]):le(t)}(t)}}}switch(e){case"address":return function(e){return ge(or(e),32)};case"bool":return function(e){return e?Or:Ir};case"bytes":return function(e){return be(e)};case"string":return function(e){return gr(e)}}return null}function _r(e,t){return`${e}(${t.map(({name:e,type:t})=>t+" "+e).join(",")})`}function Nr(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 Cr{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}=Nr(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]){ee(!i.has(s.name),`duplicate variable name ${JSON.stringify(s.name)} in ${JSON.stringify(n)}`,"types",e),i.add(s.name);const o=Nr(s.type).base;ee(o!==n,`circular type reference to ${JSON.stringify(o)}`,"types",e);Tr(o)||(ee(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);ee(0!==i.length,"missing primary type","types",e),ee(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){ee(!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,_r(e,o[e])+r.map(e=>_r(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=Tr(e);if(t)return t}const t=Nr(e).array;if(t){const e=t.prefix,r=this.getEncoder(e);return n=>{ee(-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(be)),be(fe(o))}}const r=this.types[e];if(r){const t=gr(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)?be(n):n});return n.unshift(t),fe(n)}}ee(!1,`unknown type: ${e}`,"type",e)}encodeType(e){const t=this.#s.get(e);return ee(t,`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return be(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(Tr(e))return r(e,t);const n=Nr(e).array;if(n)return ee(-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),{});ee(!1,`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new Cr(e)}static getPrimaryType(e){return Cr.from(e).primaryType}static hashStruct(e,t,r){return Cr.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){if(null==e[r])continue;const n=Ar[r];ee(n,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:n})}return t.sort((e,t)=>Sr.indexOf(e.name)-Sr.indexOf(t.name)),Cr.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return fe(["0x1901",Cr.hashDomain(e),Cr.from(t).hash(r)])}static hash(e,t,r){return be(Cr.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&&!ae(e.verifyingContract,20)&&(o[e.verifyingContract]="0x");const i=Cr.from(t);i.visit(r,(e,t)=>("address"!==e||ae(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){Cr.hashDomain(e);const n={},o=[];Sr.forEach(t=>{const r=e[t];null!=r&&(n[t]=Rr[t](r),o.push({name:t,type:Ar[t]}))});const i=Cr.from(t);t=i.types;const s=Object.assign({},t);return ee(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 le(ie(t));if(e.match(/^u?int/))return Ut(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return ee("string"==typeof t,"invalid string","value",t),t}ee(!1,"unsupported type","type",e)})}}}const Pr="0x0000000000000000000000000000000000000000";function Lr(e,t,r,n){s(e);const i=_({dkLen:32,asyncTick:10},n),{c:a,dkLen:c,asyncTick:u}=i;if(o(a),o(c),o(u),a<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const l=w(t),f=w(r),h=new Uint8Array(c),d=lt.create(e,l),p=d._cloneInto().update(f);return{c:a,dkLen:c,asyncTick:u,DK:h,PRF:d,PRFSalt:p}}function Dr(e,t,r,n,o){return e.destroy(),t.destroy(),n&&n.destroy(),o.fill(0),r}function Ur(e,t,r,n){const{c:o,dkLen:i,DK:s,PRF:a,PRFSalt:c}=Lr(e,t,r,n);let u;const l=new Uint8Array(4),f=O(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 Dr(a,c,s,u,h)}const[xr,Gr]=(()=>E.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))))(),Fr=new Uint32Array(80),kr=new Uint32Array(80);class Br extends ve{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)Fr[r]=e.getUint32(t),kr[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|Fr[e-15],r=0|kr[e-15],n=E.rotrSH(t,r,1)^E.rotrSH(t,r,8)^E.shrSH(t,r,7),o=E.rotrSL(t,r,1)^E.rotrSL(t,r,8)^E.shrSL(t,r,7),i=0|Fr[e-2],s=0|kr[e-2],a=E.rotrSH(i,s,19)^E.rotrBH(i,s,61)^E.shrSH(i,s,6),c=E.rotrSL(i,s,19)^E.rotrBL(i,s,61)^E.shrSL(i,s,6),u=E.add4L(o,c,kr[e-7],kr[e-16]),l=E.add4H(u,n,a,Fr[e-7],Fr[e-16]);Fr[e]=0|l,kr[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:y,Hl:m}=this;for(let e=0;e<80;e++){const t=E.rotrSH(l,f,14)^E.rotrSH(l,f,18)^E.rotrBH(l,f,41),b=E.rotrSL(l,f,14)^E.rotrSL(l,f,18)^E.rotrBL(l,f,41),v=l&h^~l&p,O=f&d^~f&g,I=E.add5L(m,b,O,Gr[e],kr[e]),A=E.add5H(I,y,t,v,xr[e],Fr[e]),S=0|I,w=E.rotrSH(r,n,28)^E.rotrBH(r,n,34)^E.rotrBH(r,n,39),R=E.rotrSL(r,n,28)^E.rotrBL(r,n,34)^E.rotrBL(r,n,39),T=r&o^r&s^o&s,_=n&i^n&a^i&a;y=0|p,m=0|g,p=0|h,g=0|d,h=0|l,d=0|f,({h:l,l:f}=E.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=E.add3L(S,R,_);r=E.add3H(N,A,w,T),n=0|N}({h:r,l:n}=E.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:o,l:i}=E.add(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:a}=E.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=E.add(0|this.Dh,0|this.Dl,0|c,0|u)),({h:l,l:f}=E.add(0|this.Eh,0|this.El,0|l,0|f)),({h,l:d}=E.add(0|this.Fh,0|this.Fl,0|h,0|d)),({h:p,l:g}=E.add(0|this.Gh,0|this.Gl,0|p,0|g)),({h:y,l:m}=E.add(0|this.Hh,0|this.Hl,0|y,0|m)),this.set(r,n,o,i,s,a,c,u,l,f,h,d,p,g,y,m)}roundClean(){Fr.fill(0),kr.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 Mr=N(()=>new Br);const jr=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}(),Kr=jr.crypto||jr.msCrypto;function Vr(e){switch(e){case"sha256":return Te.create();case"sha512":return Mr.create()}ee(!1,"invalid hashing algorithm name","algorithm",e)}const $r=function(e){return Vr("sha256").update(e).digest()},Hr=function(e){return Vr("sha512").update(e).digest()};let Yr=$r,qr=Hr,zr=!1,Xr=!1;function Wr(e){const t=ie(e,"data");return le(Yr(t))}function Jr(e){const t=ie(e,"data");return le(qr(t))}function Qr(e){let t=e.toString(16);for(;t.length<2;)t="0"+t;return"0x"+t}function Zr(e,t,r){let n=0;for(let o=0;o<r;o++)n=256*n+e[t+o];return n}function en(e,t,r,n){const o=[];for(;r<t+1+n;){const i=tn(e,r);o.push(i.result),Z((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 tn(e,t){Z(0!==e.length,"data too short","BUFFER_OVERRUN",{buffer:e,length:0,offset:1});const r=t=>{Z(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=Zr(e,t+1,n);return r(t+1+n+o),en(e,t,t+1+n,n+o)}if(e[t]>=192){const n=e[t]-192;return r(t+1+n),en(e,t,t+1,n)}if(e[t]>=184){const n=e[t]-183;r(t+1+n);const o=Zr(e,t+1,n);r(t+1+n+o);return{consumed:1+n+o,result:le(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:le(e.slice(t+1,t+1+n))}}return{consumed:1,result:Qr(e[t])}}function rn(e){const t=ie(e,"data"),r=tn(t,0);return ee(r.consumed===t.length,"unexpected junk after rlp payload","data",e),r.result}function nn(e,t){return{address:or(e),storageKeys:t.map((e,t)=>(ee(ae(e,32),"invalid slot",`storageKeys[${t}]`,e),e.toLowerCase()))}}function on(e){if(Array.isArray(e))return e.map((t,r)=>Array.isArray(t)?(ee(2===t.length,"invalid slot set",`value[${r}]`,t),nn(t[0],t[1])):(ee(null!=t&&"object"==typeof t,"invalid address-slot set","value",e),nn(t.address,t.storageKeys)));ee(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 nn(t,Object.keys(r).sort())});return t.sort((e,t)=>e.address.localeCompare(t.address)),t}function sn(e){let t;return t="string"==typeof e?Jt.computePublicKey(e,!1):e.publicKey,or(be("0x"+t.substring(4)).substring(26))}Wr._=$r,Wr.lock=function(){zr=!0},Wr.register=function(e){if(zr)throw new Error("sha256 is locked");Yr=e},Object.freeze(Wr),Jr._=Hr,Jr.lock=function(){Xr=!0},Jr.register=function(e){if(Xr)throw new Error("sha512 is locked");qr=e},Object.freeze(Wr);const an=BigInt(0),cn=BigInt(2),un=BigInt(27),ln=BigInt(28),fn=BigInt(35),hn=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),dn=131072;function pn(e,t){let r=e.toString(16);for(;r.length<2;)r="0"+r;return r+=Wr(t).substring(4),"0x"+r}function gn(e){return"0x"===e?null:or(e)}function yn(e,t){try{return on(e)}catch(r){ee(!1,r.message,t,e)}}function En(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:gn(n[1]),nonce:bn(n[2],"nonce"),chainId:bn(n[0],"chainId"),signature:Wt.from({yParity:mn(n[3],"yParity"),r:ge(n[4],32),s:ge(n[5],32)})})}return t}catch(r){ee(!1,r.message,t,e)}}function mn(e,t){return"0x"===e?0:kt(e,t)}function bn(e,t){if("0x"===e)return an;const r=Ut(e,t);return ee(r<=hn,"value exceeds uint size",t,r),r}function vn(e,t){const r=Ut(e,"value"),n=Mt(r);return ee(n.length<=32,"value too large",`tx.${t}`,r),n}function On(e){return on(e).map(e=>[e.address,e.storageKeys])}function In(e,t){ee(Array.isArray(e),`invalid ${t}`,"value",e);for(let t=0;t<e.length;t++)ee(ae(e[t],32),"invalid ${ param } hash",`value[${t}]`,e[t]);return e}function An(e,t){let r;try{if(r=mn(t[0],"yParity"),0!==r&&1!==r)throw new Error("bad yParity")}catch(e){ee(!1,"invalid yParity","yParity",t[0])}const n=ge(t[1],32),o=ge(t[2],32),i=Wt.from({r:n,s:o,yParity:r});e.signature=i}class Sn{#u;#l;#f;#h;#d;#p;#g;#y;#E;#m;#b;#v;#O;#I;#A;#S;#w;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:ee(!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?Pr:e}set to(e){this.#l=null==e?null:or(e)}get nonce(){return this.#h}set nonce(e){this.#h=kt(e,"value")}get gasLimit(){return this.#d}set gasLimit(e){this.#d=Ut(e)}get gasPrice(){const e=this.#p;return null!=e||0!==this.type&&1!==this.type?e:an}set gasPrice(e){this.#p=null==e?null:Ut(e,"gasPrice")}get maxPriorityFeePerGas(){const e=this.#g;return null==e?2===this.type||3===this.type?an:null:e}set maxPriorityFeePerGas(e){this.#g=null==e?null:Ut(e,"maxPriorityFeePerGas")}get maxFeePerGas(){const e=this.#y;return null==e?2===this.type||3===this.type?an:null:e}set maxFeePerGas(e){this.#y=null==e?null:Ut(e,"maxFeePerGas")}get data(){return this.#f}set data(e){this.#f=le(e)}get value(){return this.#E}set value(e){this.#E=Ut(e,"value")}get chainId(){return this.#m}set chainId(e){this.#m=Ut(e)}get signature(){return this.#b||null}set signature(e){this.#b=null==e?null:Wt.from(e)}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:on(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:or((t=e).address),nonce:Ut(null!=t.nonce?t.nonce:0),chainId:Ut(null!=t.chainId?t.chainId:0),signature:Wt.from(t.signature)};var t})}get maxFeePerBlobGas(){const e=this.#O;return null==e&&3===this.type?an:e}set maxFeePerBlobGas(e){this.#O=null==e?null:Ut(e,"maxFeePerBlobGas")}get blobVersionedHashes(){let e=this.#I;return null==e&&3===this.type?[]:e}set blobVersionedHashes(e){if(null!=e){ee(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let t=0;t<e.length;t++)ee(ae(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(ce(o)){Z(this.#A,"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let e=ie(o);if(ee(e.length<=dn,"blob is too large",`blobs[${n}]`,o),e.length!==dn){const t=new Uint8Array(dn);t.set(e),e=t}const i=this.#A.blobToKzgCommitment(e),s=le(this.#A.computeBlobKzgProof(e,i));t.push({data:le(e),commitment:le(i),proof:s}),r.push(pn(1,i))}else{const e=le(o.commitment);t.push({data:le(o.data),commitment:e,proof:le(o.proof)}),r.push(pn(1,e))}}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 ie(e.blobToKzgCommitment(le(t)))}else if("blobToKzgCommitment"in e&&"function"==typeof e.blobToKzgCommitment)return ie(e.blobToKzgCommitment(t));if("blobToKZGCommitment"in e&&"function"==typeof e.blobToKZGCommitment)return ie(e.blobToKZGCommitment(le(t)));ee(!1,"unsupported KZG library","kzg",e)},computeBlobKzgProof:(t,r)=>"computeBlobProof"in e&&"function"==typeof e.computeBlobProof?ie(e.computeBlobProof(le(t),le(r))):"computeBlobKzgProof"in e&&"function"==typeof e.computeBlobKzgProof?e.computeBlobKzgProof(t,r):"computeBlobKZGProof"in e&&"function"==typeof e.computeBlobKZGProof?ie(e.computeBlobKZGProof(le(t),le(r))):void ee(!1,"unsupported KZG library","kzg",e)}}(e)}constructor(){this.#u=null,this.#l=null,this.#h=0,this.#d=an,this.#p=null,this.#g=null,this.#y=null,this.#f="0x",this.#E=an,this.#m=an,this.#b=null,this.#v=null,this.#O=null,this.#I=null,this.#A=null,this.#S=null,this.#w=null}get hash(){return null==this.signature?null:be(this.#R(!0,!1))}get unsignedHash(){return be(this.unsignedSerialized)}get from(){return null==this.signature?null:(e=this.unsignedHash,t=this.signature,sn(Jt.recoverPublicKey(e,t)));var e,t}get fromPublicKey(){return null==this.signature?null:Jt.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return null!=this.signature}#R(e,t){Z(!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=[vn(e.nonce,"nonce"),vn(e.gasPrice||0,"gasPrice"),vn(e.gasLimit,"gasLimit"),e.to||"0x",vn(e.value,"value"),e.data];let n=an;if(e.chainId!=an)n=Ut(e.chainId,"tx.chainId"),ee(!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!==an&&(r.push(Mt(n)),r.push("0x"),r.push("0x")),dr(r);let o=BigInt(27+t.yParity);return n!==an?o=Wt.getChainIdV(n,t.v):BigInt(t.v)!==o&&ee(!1,"tx.chainId/sig.v mismatch","sig",t),r.push(Mt(o)),r.push(Mt(t.r)),r.push(Mt(t.s)),dr(r)}(this,r);case 1:return function(e,t){const r=[vn(e.chainId,"chainId"),vn(e.nonce,"nonce"),vn(e.gasPrice||0,"gasPrice"),vn(e.gasLimit,"gasLimit"),e.to||"0x",vn(e.value,"value"),e.data,On(e.accessList||[])];return t&&(r.push(vn(t.yParity,"recoveryParam")),r.push(Mt(t.r)),r.push(Mt(t.s))),fe(["0x01",dr(r)])}(this,r);case 2:return function(e,t){const r=[vn(e.chainId,"chainId"),vn(e.nonce,"nonce"),vn(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),vn(e.maxFeePerGas||0,"maxFeePerGas"),vn(e.gasLimit,"gasLimit"),e.to||"0x",vn(e.value,"value"),e.data,On(e.accessList||[])];return t&&(r.push(vn(t.yParity,"yParity")),r.push(Mt(t.r)),r.push(Mt(t.s))),fe(["0x02",dr(r)])}(this,r);case 3:return function(e,t,r){const n=[vn(e.chainId,"chainId"),vn(e.nonce,"nonce"),vn(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),vn(e.maxFeePerGas||0,"maxFeePerGas"),vn(e.gasLimit,"gasLimit"),e.to||Pr,vn(e.value,"value"),e.data,On(e.accessList||[]),vn(e.maxFeePerBlobGas||0,"maxFeePerBlobGas"),In(e.blobVersionedHashes||[],"blobVersionedHashes")];return t&&(n.push(vn(t.yParity,"yParity")),n.push(Mt(t.r)),n.push(Mt(t.s)),r)?fe(["0x03",dr([n,r.map(e=>e.data),r.map(e=>e.commitment),r.map(e=>e.proof)])]):fe(["0x03",dr(n)])}(this,r,t?this.blobs:null);case 4:return function(e,t){const r=[vn(e.chainId,"chainId"),vn(e.nonce,"nonce"),vn(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),vn(e.maxFeePerGas||0,"maxFeePerGas"),vn(e.gasLimit,"gasLimit"),e.to||"0x",vn(e.value,"value"),e.data,On(e.accessList||[]),(n=e.authorizationList||[],n.map(e=>[vn(e.chainId,"chainId"),e.address,vn(e.nonce,"nonce"),vn(e.signature.yParity,"yParity"),Mt(e.signature.r),Mt(e.signature.s)]))];var n;return t&&(r.push(vn(t.yParity,"yParity")),r.push(Mt(t.r)),r.push(Mt(t.s))),fe(["0x04",dr(r)])}(this,r)}Z(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})}get serialized(){return this.#R(!0,!0)}get unsignedSerialized(){return this.#R(!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&&Z(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),Z(!t||0!==this.type&&1!==this.type,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),Z(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 Sn.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}}static from(e){if(null==e)return new Sn;if("string"==typeof e){const t=ie(e);if(t[0]>=127)return Sn.from(function(e){const t=rn(e);ee(Array.isArray(t)&&(9===t.length||6===t.length),"invalid field count for legacy transaction","data",e);const r={type:0,nonce:mn(t[0],"nonce"),gasPrice:bn(t[1],"gasPrice"),gasLimit:bn(t[2],"gasLimit"),to:gn(t[3]),value:bn(t[4],"value"),data:le(t[5]),chainId:an};if(6===t.length)return r;const n=bn(t[6],"v"),o=bn(t[7],"r"),i=bn(t[8],"s");if(o===an&&i===an)r.chainId=n;else{let e=(n-fn)/cn;e<an&&(e=an),r.chainId=e,ee(e!==an||n===un||n===ln,"non-canonical legacy v","v",t[6]),r.signature=Wt.from({r:ge(t[7],32),s:ge(t[8],32),v:n})}return r}(t));switch(t[0]){case 1:return Sn.from(function(e){const t=rn(ie(e).slice(1));ee(Array.isArray(t)&&(8===t.length||11===t.length),"invalid field count for transaction type: 1","data",le(e));const r={type:1,chainId:bn(t[0],"chainId"),nonce:mn(t[1],"nonce"),gasPrice:bn(t[2],"gasPrice"),gasLimit:bn(t[3],"gasLimit"),to:gn(t[4]),value:bn(t[5],"value"),data:le(t[6]),accessList:yn(t[7],"accessList")};return 8===t.length||An(r,t.slice(8)),r}(t));case 2:return Sn.from(function(e){const t=rn(ie(e).slice(1));ee(Array.isArray(t)&&(9===t.length||12===t.length),"invalid field count for transaction type: 2","data",le(e));const r={type:2,chainId:bn(t[0],"chainId"),nonce:mn(t[1],"nonce"),maxPriorityFeePerGas:bn(t[2],"maxPriorityFeePerGas"),maxFeePerGas:bn(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:bn(t[4],"gasLimit"),to:gn(t[5]),value:bn(t[6],"value"),data:le(t[7]),accessList:yn(t[8],"accessList")};return 9===t.length||An(r,t.slice(9)),r}(t));case 3:return Sn.from(function(e){let t=rn(ie(e).slice(1)),r="3",n=null;if(4===t.length&&Array.isArray(t[0])){r="3 (network format)";const e=t[1],o=t[2],i=t[3];ee(Array.isArray(e),"invalid network format: blobs not an array","fields[1]",e),ee(Array.isArray(o),"invalid network format: commitments not an array","fields[2]",o),ee(Array.isArray(i),"invalid network format: proofs not an array","fields[3]",i),ee(e.length===o.length,"invalid network format: blobs/commitments length mismatch","fields",t),ee(e.length===i.length,"invalid network format: blobs/proofs length mismatch","fields",t),n=[];for(let r=0;r<t[1].length;r++)n.push({data:e[r],commitment:o[r],proof:i[r]});t=t[0]}ee(Array.isArray(t)&&(11===t.length||14===t.length),`invalid field count for transaction type: ${r}`,"data",le(e));const o={type:3,chainId:bn(t[0],"chainId"),nonce:mn(t[1],"nonce"),maxPriorityFeePerGas:bn(t[2],"maxPriorityFeePerGas"),maxFeePerGas:bn(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:bn(t[4],"gasLimit"),to:gn(t[5]),value:bn(t[6],"value"),data:le(t[7]),accessList:yn(t[8],"accessList"),maxFeePerBlobGas:bn(t[9],"maxFeePerBlobGas"),blobVersionedHashes:t[10]};n&&(o.blobs=n),ee(null!=o.to,`invalid address for transaction type: ${r}`,"data",e),ee(Array.isArray(o.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",e);for(let t=0;t<o.blobVersionedHashes.length;t++)ee(ae(o.blobVersionedHashes[t],32),`invalid blobVersionedHash at index ${t}: must be length 32`,"data",e);return 11===t.length||An(o,t.slice(11)),o}(t));case 4:return Sn.from(function(e){const t=rn(ie(e).slice(1));ee(Array.isArray(t)&&(10===t.length||13===t.length),"invalid field count for transaction type: 4","data",le(e));const r={type:4,chainId:bn(t[0],"chainId"),nonce:mn(t[1],"nonce"),maxPriorityFeePerGas:bn(t[2],"maxPriorityFeePerGas"),maxFeePerGas:bn(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:bn(t[4],"gasLimit"),to:gn(t[5]),value:bn(t[6],"value"),data:le(t[7]),accessList:yn(t[8],"accessList"),authorizationList:En(t[9],"authorizationList")};return 10===t.length||An(r,t.slice(10)),r}(t))}Z(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const t=new Sn;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=Wt.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.blobs&&(t.blobs=e.blobs),null!=e.hash&&(ee(t.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),ee(t.hash===e.hash,"hash mismatch","tx",e)),null!=e.from&&(ee(t.isSigned(),"unsigned transaction cannot define '.from'","tx",e),ee(t.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),t}}BigInt(0);function wn(e){const t={};e.to&&(t.to=e.to),e.from&&(t.from=e.from),e.data&&(t.data=le(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]=Ut(e[n],`request.${n}`));const n="type,nonce".split(/,/);for(const r of n)r in e&&null!=e[r]&&(t[r]=kt(e[r],`request.${r}`));return e.accessList&&(t.accessList=on(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),"blobs"in e&&e.blobs&&(t.blobs=e.blobs.map(e=>ce(e)?le(e):Object.assign({},e))),t}Symbol.iterator;Symbol.iterator;function Rn(e,t){if(e.provider)return e.provider;Z(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:t})}async function Tn(e,t){let r=wn(t);if(null!=r.to&&(r.to=sr(r.to,e)),null!=r.from){const t=r.from;r.from=Promise.all([e.getAddress(),sr(t,e)]).then(([e,t])=>(ee(e.toLowerCase()===t.toLowerCase(),"transaction from mismatch","tx.from",t),e))}else r.from=e.getAddress();return await X(r)}class _n{provider;constructor(e){W(this,{provider:e||null})}async getNonce(e){return Rn(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await Tn(this,e)}async populateTransaction(e){const t=Rn(this,"populateTransaction"),r=await Tn(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){ee(Ut(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||ee(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e):ee(!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();Z(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?(Z(!o,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),null==r.gasPrice&&(r.gasPrice=e.gasPrice),r.type=0):Z(!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 X(r)}async populateAuthorization(e){const t=Object.assign({},e);return null==t.chainId&&(t.chainId=(await Rn(this,"getNetwork").getNetwork()).chainId),null==t.nonce&&(t.nonce=await this.getNonce()),t}async estimateGas(e){return Rn(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return Rn(this,"call").call(await this.populateCall(e))}async resolveName(e){const t=Rn(this,"resolveName");return await t.resolveName(e)}async sendTransaction(e){const t=Rn(this,"sendTransaction"),r=await this.populateTransaction(e);delete r.from;const n=Sn.from(r);return await t.broadcastTransaction(await this.signTransaction(n))}authorize(e){Z(!1,"authorization not implemented for this signer","UNSUPPORTED_OPERATION",{operation:"authorize"})}}class Nn extends _n{address;constructor(e,t){super(t),W(this,{address:e})}async getAddress(){return this.address}connect(e){return new Nn(this.address,e)}#T(e,t){Z(!1,`VoidSigner cannot sign ${e}`,"UNSUPPORTED_OPERATION",{operation:t})}async signTransaction(e){this.#T("transactions","signTransaction")}async signMessage(e){this.#T("messages","signMessage")}async signTypedData(e,t,r){this.#T("typed-data","signTypedData")}}class Cn extends _n{address;#_;constructor(e,t){super(t),ee(e&&"function"==typeof e.sign,"invalid private key","privateKey","[ REDACTED ]"),this.#_=e;W(this,{address:sn(this.signingKey.publicKey)})}get signingKey(){return this.#_}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(e){return new Cn(this.#_,e)}async signTransaction(e){e=wn(e);const{to:t,from:r}=await X({to:e.to?sr(e.to,this):void 0,from:e.from?sr(e.from,this):void 0});null!=t&&(e.to=t),null!=r&&(e.from=r),null!=e.from&&(ee(or(e.from)===this.address,"transaction from address mismatch","tx.from",e.from),delete e.from);const n=Sn.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(ur(e)).serialized}authorizeSync(e){ee("string"==typeof e.address,"invalid address for authorizeSync","auth.address",e);const t=this.signingKey.sign(pr(e));return Object.assign({},{address:or(e.address),nonce:Ut(e.nonce||0),chainId:Ut(e.chainId||0)},{signature:t})}async authorize(e){return e=Object.assign({},e,{address:await sr(e.address,this)}),this.authorizeSync(await this.populateAuthorization(e))}async signTypedData(e,t,r){const n=await Cr.resolveNames(e,t,r,async e=>{Z(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 Z(null!=t,"unconfigured ENS name","UNCONFIGURED_NAME",{value:e}),t});return this.signingKey.sign(Cr.hash(n.domain,t,n.value)).serialized}}let Pn=!1;const Ln=function(e,t,r){return function(e,t){const r={sha256:Te,sha512:Mr}[e];return ee(null!=r,"invalid hmac algorithm","algorithm",e),lt.create(r,t)}(e,t).update(r).digest()};let Dn=Ln;function Un(e,t,r){const n=ie(t,"key"),o=ie(r,"data");return le(Dn(e,n,o))}Un._=Ln,Un.lock=function(){Pn=!0},Un.register=function(e){if(Pn)throw new Error("computeHmac is locked");Dn=e},Object.freeze(Un);const xn=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Gn=Uint8Array.from({length:16},(e,t)=>t);let Fn=[Gn],kn=[Gn.map(e=>(9*e+5)%16)];for(let e=0;e<4;e++)for(let t of[Fn,kn])t.push(t[e].map(e=>xn[e]));const Bn=[[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)),Mn=Fn.map((e,t)=>e.map(e=>Bn[t][e])),jn=kn.map((e,t)=>e.map(e=>Bn[t][e])),Kn=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Vn=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),$n=(e,t)=>e<<t|e>>>32-t;function Hn(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 Yn=new Uint32Array(16);class qn extends ve{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)Yn[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=Kn[e],d=Vn[e],p=Fn[e],g=kn[e],y=Mn[e],E=jn[e];for(let t=0;t<16;t++){const n=$n(r+Hn(e,o,s,c)+Yn[p[t]]+h,y[t])+l|0;r=l,l=c,c=0|$n(s,10),s=o,o=n}for(let e=0;e<16;e++){const r=$n(n+Hn(t,i,a,u)+Yn[g[e]]+d,E[e])+f|0;n=f,f=u,u=0|$n(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(){Yn.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const zn=N(()=>new qn);let Xn=!1;const Wn=function(e){return zn(e)};let Jn=Wn;function Qn(e){const t=ie(e,"data");return le(Jn(t))}Qn._=Wn,Qn.lock=function(){Xn=!0},Qn.register=function(e){if(Xn)throw new TypeError("ripemd160 is locked");Jn=e},Object.freeze(Qn);let Zn=!1;const eo=function(e){return new Uint8Array(function(e){Z(null!=Kr,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"}),ee(Number.isInteger(e)&&e>0&&e<=1024,"invalid length","length",e);const t=new Uint8Array(e);return Kr.getRandomValues(t),t}(e))};let to=eo;function ro(e){return to(e)}ro._=eo,ro.lock=function(){Zn=!0},ro.register=function(e){if(Zn)throw new Error("randomBytes is locked");to=e},Object.freeze(ro);const no="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";let oo=null;function io(e){if(null==oo){oo={};for(let e=0;e<58;e++)oo[no[e]]=BigInt(e)}const t=oo[e];return ee(null!=t,"invalid base58 value","letter",e),t}const so=BigInt(0),ao=BigInt(58);const co=" !#$%&'()*+,-./<=>?@[]^_`{|}~",uo=/^[a-z]*$/i;function lo(e,t){let r=97;return e.reduce((e,n)=>(n===t?r++:n.match(uo)?e.push(String.fromCharCode(r)+n):(r=97,e.push(n)),e),[])}function fo(e){return ee("0"===e[0],"unsupported auwl data","data",e),function(e,t){for(let r=28;r>=0;r--)e=e.split(co[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 lo(lo(r,";"),":")}(e.substring(59),e.substring(1,59))}class ho{locale;constructor(e){W(this,{locale:e})}split(e){return e.toLowerCase().split(/\s+/g)}join(e){return e.join(" ")}}class po extends ho{#f;#N;constructor(e,t,r){super(e),this.#f=t,this.#N=r,this.#C=null}get _data(){return this.#f}_decodeWords(){return fo(this.#f)}#C;#P(){if(null==this.#C){const e=this._decodeWords();if(gr(e.join("\n")+"\n")!==this.#N)throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`);this.#C=e}return this.#C}getWord(e){const t=this.#P();return ee(e>=0&&e<t.length,`invalid word index: ${e}`,"index",e),t[e]}getWordIndex(e){return this.#P().indexOf(e)}}let go=null;class yo extends po{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==go&&(go=new yo),go}}let Eo=!1;const mo=function(e,t,r,n,o){return function(e,t,r,n,o){const i={sha256:Te,sha512:Mr}[o];return ee(null!=i,"invalid pbkdf2 algorithm","algorithm",o),Ur(i,e,t,{c:r,dkLen:n})}(e,t,r,n,o)};let bo=mo;function vo(e,t,r,n,o){const i=ie(e,"password"),s=ie(t,"salt");return le(bo(i,s,r,n,o))}function Oo(e){return(1<<e)-1<<8-e&255}function Io(e){return(1<<e)-1&255}function Ao(e,t){re("NFKD"),null==t&&(t=yo.wordlist());const r=t.split(e);ee(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"));ee(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=Oo(r.length/3);return ee((ie(Wr(n.slice(0,i/8)))[0]&s)===(n[n.length-1]&s),"invalid mnemonic checksum","mnemonic","[ REDACTED ]"),le(n.slice(0,i/8))}function So(e,t){ee(e.length%4==0&&e.length>=16&&e.length<=32,"invalid entropy size","entropy","[ REDACTED ]"),null==t&&(t=yo.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]&Io(8-n)),n+=3);const o=e.length/4,i=parseInt(Wr(e).substring(2,4),16)&Oo(o);return r[r.length-1]<<=o,r[r.length-1]|=i>>8-o,t.join(r.map(e=>t.getWord(e)))}vo._=mo,vo.lock=function(){Eo=!0},vo.register=function(e){if(Eo)throw new Error("pbkdf2 is locked");bo=e},Object.freeze(vo);const wo={};class Ro{phrase;password;wordlist;entropy;constructor(e,t,r,n,o){null==n&&(n=""),null==o&&(o=yo.wordlist()),ne(e,wo,"Mnemonic"),W(this,{phrase:r,password:n,wordlist:o,entropy:t})}computeSeed(){const e=cr("mnemonic"+this.password,"NFKD");return vo(cr(this.phrase,"NFKD"),e,2048,64,"sha512")}static fromPhrase(e,t,r){const n=Ao(e,r);return e=So(ie(n),r),new Ro(wo,n,e,t,r)}static fromEntropy(e,t,r){const n=ie(e,"entropy"),o=So(n,r);return new Ro(wo,le(n),o,t,r)}static entropyToPhrase(e,t){return So(ie(e,"entropy"),t)}static phraseToEntropy(e,t){return Ao(e,t)}static isValidMnemonic(e,t){try{return Ao(e,t),!0}catch(e){}return!1}}
|
|
21
|
+
/*! MIT License. Copyright 2015-2022 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */
|
|
22
|
+
var To,_o,No,Co=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)},Po=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 Lo={16:10,24:12,32:14},Do=[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],Uo=[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],xo=[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],Go=[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],Fo=[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],Bo=[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],Mo=[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],jo=[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],Ko=[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],Vo=[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],$o=[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],Ho=[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],Yo=[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],qo=[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 zo(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 Xo{get key(){return Co(this,To,"f").slice()}constructor(e){if(To.set(this,void 0),_o.set(this,void 0),No.set(this,void 0),!(this instanceof Xo))throw Error("AES must be instanitated with `new`");Po(this,To,new Uint8Array(e),"f");const t=Lo[this.key.length];if(null==t)throw new TypeError("invalid key size (must be 16, 24 or 32 bytes)");Po(this,No,[],"f"),Po(this,_o,[],"f");for(let e=0;e<=t;e++)Co(this,No,"f").push([0,0,0,0]),Co(this,_o,"f").push([0,0,0,0]);const r=4*(t+1),n=this.key.length/4,o=zo(this.key);let i;for(let e=0;e<n;e++)i=e>>2,Co(this,No,"f")[i][e%4]=o[e],Co(this,_o,"f")[t-i][e%4]=o[e];let s,a=0,c=n;for(;c<r;){if(s=o[n-1],o[0]^=Uo[s>>16&255]<<24^Uo[s>>8&255]<<16^Uo[255&s]<<8^Uo[s>>24&255]^Do[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]^=Uo[255&s]^Uo[s>>8&255]<<8^Uo[s>>16&255]<<16^Uo[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,Co(this,No,"f")[e][i]=o[u],Co(this,_o,"f")[t-e][i]=o[u++],c++}for(let e=1;e<t;e++)for(let t=0;t<4;t++)s=Co(this,_o,"f")[e][t],Co(this,_o,"f")[e][t]=$o[s>>24&255]^Ho[s>>16&255]^Yo[s>>8&255]^qo[255&s]}encrypt(e){if(16!=e.length)throw new TypeError("invalid plaintext size (must be 16 bytes)");const t=Co(this,No,"f").length-1,r=[0,0,0,0];let n=zo(e);for(let e=0;e<4;e++)n[e]^=Co(this,No,"f")[0][e];for(let e=1;e<t;e++){for(let t=0;t<4;t++)r[t]=Go[n[t]>>24&255]^Fo[n[(t+1)%4]>>16&255]^ko[n[(t+2)%4]>>8&255]^Bo[255&n[(t+3)%4]]^Co(this,No,"f")[e][t];n=r.slice()}const o=new Uint8Array(16);let i=0;for(let e=0;e<4;e++)i=Co(this,No,"f")[t][e],o[4*e]=255&(Uo[n[e]>>24&255]^i>>24),o[4*e+1]=255&(Uo[n[(e+1)%4]>>16&255]^i>>16),o[4*e+2]=255&(Uo[n[(e+2)%4]>>8&255]^i>>8),o[4*e+3]=255&(Uo[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=Co(this,_o,"f").length-1,r=[0,0,0,0];let n=zo(e);for(let e=0;e<4;e++)n[e]^=Co(this,_o,"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+3)%4]>>16&255]^Ko[n[(t+2)%4]>>8&255]^Vo[255&n[(t+1)%4]]^Co(this,_o,"f")[e][t];n=r.slice()}const o=new Uint8Array(16);let i=0;for(let e=0;e<4;e++)i=Co(this,_o,"f")[t][e],o[4*e]=255&(xo[n[e]>>24&255]^i>>24),o[4*e+1]=255&(xo[n[(e+3)%4]>>16&255]^i>>16),o[4*e+2]=255&(xo[n[(e+2)%4]>>8&255]^i>>8),o[4*e+3]=255&(xo[255&n[(e+1)%4]]^i);return o}}To=new WeakMap,_o=new WeakMap,No=new WeakMap;class Wo{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 Xo(t)},name:{enumerable:!0,value:e}})}}var Jo,Qo,Zo=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},ei=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 ti extends Wo{constructor(e,t){if(super("ECC",e,ti),Jo.set(this,void 0),Qo.set(this,void 0),t){if(t.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");Zo(this,Jo,new Uint8Array(t),"f")}else Zo(this,Jo,new Uint8Array(16),"f");Zo(this,Qo,this.iv,"f")}get iv(){return new Uint8Array(ei(this,Jo,"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++)ei(this,Qo,"f")[t]^=e[r+t];Zo(this,Qo,this.aes.encrypt(ei(this,Qo,"f")),"f"),t.set(ei(this,Qo,"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]^ei(this,Qo,"f")[o],ei(this,Qo,"f")[o]=e[r+o]}return t}}Jo=new WeakMap,Qo=new WeakMap;var ri,ni=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,ri=new WeakMap,new WeakSet;var oi,ii,si,ai=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},ci=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 ui extends Wo{constructor(e,t){super("CTR",e,ui),oi.set(this,void 0),ii.set(this,void 0),si.set(this,void 0),ai(this,si,new Uint8Array(16),"f"),ci(this,si,"f").fill(0),ai(this,oi,ci(this,si,"f"),"f"),ai(this,ii,16,"f"),null==t&&(t=1),"number"==typeof t?this.setCounterValue(t):this.setCounterBytes(t)}get counter(){return new Uint8Array(ci(this,si,"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)ci(this,si,"f")[t]=e%256,e=Math.floor(e/256)}setCounterBytes(e){if(16!==e.length)throw new TypeError("invalid counter initial Uint8Array value length");ci(this,si,"f").set(e)}increment(){for(let e=15;e>=0;e--){if(255!==ci(this,si,"f")[e]){ci(this,si,"f")[e]++;break}ci(this,si,"f")[e]=0}}encrypt(e){var t,r;const n=new Uint8Array(e);for(let e=0;e<n.length;e++)16===ci(this,ii,"f")&&(ai(this,oi,this.aes.encrypt(ci(this,si,"f")),"f"),ai(this,ii,0,"f"),this.increment()),n[e]^=ci(this,oi,"f")[(ai(this,ii,(r=ci(this,ii,"f"),t=r++,r),"f"),t)];return n}decrypt(e){return this.encrypt(e)}}oi=new WeakMap,ii=new WeakMap,si=new WeakMap;new WeakMap,new WeakMap,new WeakMap;const li=(e,t)=>e<<t|e>>>32-t;function fi(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++],E=e[t++]^r[n++],m=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=E,U=m,x=b,G=v,F=O;for(let e=0;e<8;e+=2)R^=li(I+U|0,7),C^=li(R+I|0,9),U^=li(C+R|0,13),I^=li(U+C|0,18),P^=li(T+A|0,7),x^=li(P+T|0,9),A^=li(x+P|0,13),T^=li(A+x|0,18),G^=li(L+_|0,7),S^=li(G+L|0,9),_^=li(S+G|0,13),L^=li(_+S|0,18),w^=li(F+D|0,7),N^=li(w+F|0,9),D^=li(N+w|0,13),F^=li(D+N|0,18),A^=li(I+w|0,7),S^=li(A+I|0,9),w^=li(S+A|0,13),I^=li(w+S|0,18),_^=li(T+R|0,7),N^=li(_+T|0,9),R^=li(N+_|0,13),T^=li(R+N|0,18),D^=li(L+P|0,7),C^=li(D+L|0,9),P^=li(C+D|0,13),L^=li(P+C|0,18),U^=li(F+G|0,7),x^=li(U+F|0,9),G^=li(x+U|0,13),F^=li(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++]=E+D|0,o[i++]=m+U|0,o[i++]=b+x|0,o[i++]=v+G|0,o[i++]=O+F|0}function hi(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)fi(r,s,e,t,r,i),n>0&&(s+=16),fi(r,i,e,t+=16,r,s)}function di(e,t,r){const n=_({dkLen:32,asyncTick:10,maxmem:1073742848},r),{N:i,r:s,p:a,dkLen:c,asyncTick:u,maxmem:l,onProgress:f}=n;if(o(i),o(s),o(a),o(c),o(u),o(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=Ur(Te,e,t,{c:1,dkLen:h*a}),y=v(g),E=v(new Uint8Array(h*i)),m=v(new Uint8Array(h));let b=()=>{};if(f){const e=2*i*a,t=Math.max(Math.floor(e/1e4),1);let r=0;b=()=>{r++,!f||r%t&&r!==e||f(r/e)}}return{N:i,r:s,p:a,dkLen:c,blockSize32:d,V:E,B32:y,B:g,tmp:m,blockMixCb:b,asyncTick:u}}function pi(e,t,r,n,o){const i=Ur(Te,e,r,{c:1,dkLen:t});return r.fill(0),n.fill(0),o.fill(0),i}let gi=!1,yi=!1;const Ei=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}=di(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 S(n-1,d,()=>{hi(c,r,c,r+=a,o),h()}),hi(c,(n-1)*a,u,t,o),h(),await S(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];hi(f,0,u,t,o),h()})}return pi(e,s,l,c,f)}(e,t,{N:r,r:n,p:o,dkLen:i,onProgress:s})},mi=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}=di(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++)hi(c,t,c,t+=a,o),h();hi(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];hi(f,0,u,t,o),h()}}return pi(e,s,l,c,f)}(e,t,{N:r,r:n,p:o,dkLen:i})};let bi=Ei,vi=mi;async function Oi(e,t,r,n,o,i,s){const a=ie(e,"passwd"),c=ie(t,"salt");return le(await bi(a,c,r,n,o,i,s))}function Ii(e,t,r,n,o,i){const s=ie(e,"passwd"),a=ie(t,"salt");return le(vi(s,a,r,n,o,i))}function Ai(e){const t=ie(e,"randomBytes");t[6]=15&t[6]|64,t[8]=63&t[8]|128;const r=le(t);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}function Si(e){return"string"!=typeof e||e.startsWith("0x")||(e="0x"+e),se(e)}function wi(e,t){for(e=String(e);e.length<t;)e="0"+e;return e}function Ri(e){return"string"==typeof e?cr(e,"NFKC"):se(e)}function Ti(e,t){const r=t.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);ee(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(ee(!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 Si(s);if("array"===o&&Array.isArray(s))return s;if(o===typeof s)return s;ee(!1,`wrong type found for ${o} `,"path",n)}return s}Oi._=Ei,Oi.lock=function(){yi=!0},Oi.register=function(e){if(yi)throw new Error("scrypt is locked");bi=e},Object.freeze(Oi),Ii._=mi,Ii.lock=function(){gi=!0},Ii.register=function(e){if(gi)throw new Error("scryptSync is locked");vi=e},Object.freeze(Ii);const _i="m/44'/60'/0'/0/0";function Ni(e){try{const t=JSON.parse(e);if(3===(null!=t.version?parseInt(t.version):0))return!0}catch(e){}return!1}function Ci(e,t){const r=ie(t),n=Ti(e,"crypto.ciphertext:data!");ee(le(be(fe([r.slice(16,32),n]))).substring(2)===Ti(e,"crypto.mac:string!").toLowerCase(),"incorrect password","password","[ REDACTED ]");const o=function(e,t,r){if("aes-128-ctr"===Ti(e,"crypto.cipher:string")){const n=Ti(e,"crypto.cipherparams.iv:data!");return le(new ui(t,n).decrypt(r))}Z(!1,"unsupported cipher","UNSUPPORTED_OPERATION",{operation:"decrypt"})}(e,r.slice(0,16),n),i=sn(o);if(e.address){let t=e.address.toLowerCase();t.startsWith("0x")||(t="0x"+t),ee(or(t)===i,"keystore address/privateKey mismatch","address",e.address)}const s={address:i,privateKey:o};if("0.1"===Ti(e,"x-ethers.version:string")){const t=r.slice(32,64),n=Ti(e,"x-ethers.mnemonicCiphertext:data!"),o=Ti(e,"x-ethers.mnemonicCounter:data!"),i=new ui(t,o);s.mnemonic={path:Ti(e,"x-ethers.path:string")||_i,locale:Ti(e,"x-ethers.locale:string")||"en",entropy:le(ie(i.decrypt(n)))}}return s}function Pi(e){const t=Ti(e,"crypto.kdf:string");if(t&&"string"==typeof t){if("scrypt"===t.toLowerCase()){const r=Ti(e,"crypto.kdfparams.salt:data!"),n=Ti(e,"crypto.kdfparams.n:int!"),o=Ti(e,"crypto.kdfparams.r:int!"),i=Ti(e,"crypto.kdfparams.p:int!");ee(n>0&&!(n&n-1),"invalid kdf.N","kdf.N",n),ee(o>0&&i>0,"invalid kdf","kdf",t);const s=Ti(e,"crypto.kdfparams.dklen:int!");return ee(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=Ti(e,"crypto.kdfparams.salt:data!"),r=Ti(e,"crypto.kdfparams.prf:string!"),n=r.split("-").pop();ee("sha256"===n||"sha512"===n,"invalid kdf.pdf","kdf.pdf",r);const o=Ti(e,"crypto.kdfparams.c:int!"),i=Ti(e,"crypto.kdfparams.dklen:int!");return ee(32===i,"invalid kdf.dklen","kdf.dklen",i),{name:"pbkdf2",salt:t,count:o,dkLen:i,algorithm:n}}}ee(!1,"unsupported key-derivation function","kdf",t)}function Li(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Di(e){const t=null!=e.salt?ie(e.salt,"options.salt"):ro(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)),ee("number"==typeof r&&r>0&&Number.isSafeInteger(r)&&(BigInt(r)&BigInt(r-1))===BigInt(0),"invalid scrypt N parameter","options.N",r),ee("number"==typeof n&&n>0&&Number.isSafeInteger(n),"invalid scrypt r parameter","options.r",n),ee("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 Ui(e,t,r,n){const o=ie(r.privateKey,"privateKey"),i=null!=n.iv?ie(n.iv,"options.iv"):ro(16);ee(16===i.length,"invalid options.iv length","options.iv",n.iv);const s=null!=n.uuid?ie(n.uuid,"options.uuid"):ro(16);ee(16===s.length,"invalid options.uuid length","options.uuid",n.iv);const a=e.slice(0,16),c=e.slice(16,32),u=ie(new ui(a,i).encrypt(o)),l=be(fe([c,u])),f={address:r.address.substring(2).toLowerCase(),id:Ai(s),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:le(i).substring(2)},ciphertext:le(u).substring(2),kdf:"scrypt",kdfparams:{salt:le(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/${q}`,o=r.mnemonic.path||_i,i=r.mnemonic.locale||"en",s=e.slice(32,64),a=ie(r.mnemonic.entropy,"account.mnemonic.entropy"),c=ro(16),u=ie(new ui(s,c).encrypt(a)),l=new Date,h="UTC--"+(l.getUTCFullYear()+"-"+wi(l.getUTCMonth()+1,2)+"-"+wi(l.getUTCDate(),2)+"T"+wi(l.getUTCHours(),2)+"-"+wi(l.getUTCMinutes(),2)+"-"+wi(l.getUTCSeconds(),2)+".0Z")+"--"+f.address;f["x-ethers"]={client:t,gethFilename:h,path:o,locale:i,mnemonicCounter:le(c).substring(2),mnemonicCiphertext:le(u).substring(2),version:"0.1"}}return JSON.stringify(f)}function xi(e,t,r){null==r&&(r={});const n=Ri(t),o=Di(r);return Ui(ie(Ii(n,o.salt,o.N,o.r,o.p,64)),o,e,r)}async function Gi(e,t,r){null==r&&(r={});const n=Ri(t),o=Di(r);return Ui(ie(await Oi(n,o.salt,o.N,o.r,o.p,64,r.progressCallback)),o,e,r)}const Fi="m/44'/60'/0'/0/0",ki=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]),Bi=2147483648,Mi=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");function ji(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 Ki(e){const t=ie(e);return function(e){const t=ie(e);let r=Ft(t),n="";for(;r;)n=no[Number(r%ao)]+n,r/=ao;for(let e=0;e<t.length&&!t[e];e++)n=no[0]+n;return n}(fe([t,de(Wr(Wr(t)),0,4)]))}const Vi={};function $i(e,t,r,n){const o=new Uint8Array(37);e&Bi?(Z(null!=n,"cannot derive child of neutered node","UNSUPPORTED_OPERATION",{operation:"deriveChild"}),o.set(ie(n),1)):o.set(ie(r));for(let t=24;t>=0;t-=8)o[33+(t>>3)]=e>>24-t&255;const i=ie(Un("sha512",t,o));return{IL:i.slice(0,32),IR:i.slice(32)}}function Hi(e,t){const r=t.split("/");ee(r.length>0,"invalid path","path",t),"m"===r[0]&&(ee(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));ee(r<Bi,"invalid path index",`path[${e}]`,t),n=n.deriveChild(Bi+r)}else if(t.match(/^[0-9]+$/)){const r=parseInt(t);ee(r<Bi,"invalid path index",`path[${e}]`,t),n=n.deriveChild(r)}else ee(!1,"invalid path component",`path[${e}]`,t)}return n}class Yi extends Cn{publicKey;fingerprint;parentFingerprint;mnemonic;chainCode;path;index;depth;constructor(e,t,r,n,o,i,s,a,c){super(t,c),ne(e,Vi,"HDNodeWallet"),W(this,{publicKey:t.compressedPublicKey});W(this,{parentFingerprint:r,fingerprint:de(Qn(Wr(this.publicKey)),0,4),chainCode:n,path:o,index:i,depth:s}),W(this,{mnemonic:a})}connect(e){return new Yi(Vi,this.signingKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.mnemonic,e)}#L(){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 Gi(this.#L(),e,{progressCallback:t})}encryptSync(e){return xi(this.#L(),e)}get extendedKey(){return Z(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),Ki(fe(["0x0488ADE4",ji(this.depth,1),this.parentFingerprint,ji(this.index,4),this.chainCode,fe(["0x00",this.privateKey])]))}hasPath(){return null!=this.path}neuter(){return new qi(Vi,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.provider)}deriveChild(e){const t=kt(e,"index");ee(t<=4294967295,"invalid index","index",t);let r=this.path;r&&(r+="/"+(2147483647&t),t&Bi&&(r+="'"));const{IR:n,IL:o}=$i(t,this.chainCode,this.publicKey,this.privateKey),i=new Jt(Bt((Ft(o)+BigInt(this.privateKey))%Mi,32));return new Yi(Vi,i,this.fingerprint,le(n),r,t,this.depth+1,this.mnemonic,this.provider)}derivePath(e){return Hi(this,e)}static#D(e,t){ee(ce(e),"invalid seed","seed","[REDACTED]");const r=ie(e,"seed");ee(r.length>=16&&r.length<=64,"invalid seed","seed","[REDACTED]");const n=ie(Un("sha512",ki,r)),o=new Jt(le(n.slice(0,32)));return new Yi(Vi,o,"0x00000000",le(n.slice(32)),"m",0,0,t,null)}static fromExtendedKey(e){const t=Mt(function(e){let t=so;for(let r=0;r<e.length;r++)t*=ao,t+=io(e[r]);return t}(e));ee(82===t.length||Ki(t.slice(0,78))===e,"invalid extended key","extendedKey","[ REDACTED ]");const r=t[4],n=le(t.slice(5,9)),o=parseInt(le(t.slice(9,13)).substring(2),16),i=le(t.slice(13,45)),s=t.slice(45,78);switch(le(t.slice(0,4))){case"0x0488b21e":case"0x043587cf":{const e=le(s);return new qi(Vi,sn(e),e,n,i,null,o,r,null)}case"0x0488ade4":case"0x04358394 ":if(0!==s[0])break;return new Yi(Vi,new Jt(s.slice(1)),n,i,null,o,r,null,null)}ee(!1,"invalid extended key prefix","extendedKey","[ REDACTED ]")}static createRandom(e,t,r){null==e&&(e=""),null==t&&(t=Fi),null==r&&(r=yo.wordlist());const n=Ro.fromEntropy(ro(16),e,r);return Yi.#D(n.computeSeed(),n).derivePath(t)}static fromMnemonic(e,t){return t||(t=Fi),Yi.#D(e.computeSeed(),e).derivePath(t)}static fromPhrase(e,t,r,n){null==t&&(t=""),null==r&&(r=Fi),null==n&&(n=yo.wordlist());const o=Ro.fromPhrase(e,t,n);return Yi.#D(o.computeSeed(),o).derivePath(r)}static fromSeed(e){return Yi.#D(e,null)}}class qi extends Nn{publicKey;fingerprint;parentFingerprint;chainCode;path;index;depth;constructor(e,t,r,n,o,i,s,a,c){super(t,c),ne(e,Vi,"HDNodeVoidWallet"),W(this,{publicKey:r});W(this,{publicKey:r,fingerprint:de(Qn(Wr(r)),0,4),parentFingerprint:n,chainCode:o,path:i,index:s,depth:a})}connect(e){return new qi(Vi,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,e)}get extendedKey(){return Z(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),Ki(fe(["0x0488B21E",ji(this.depth,1),this.parentFingerprint,ji(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return null!=this.path}deriveChild(e){const t=kt(e,"index");ee(t<=4294967295,"invalid index","index",t);let r=this.path;r&&(r+="/"+(2147483647&t),t&Bi&&(r+="'"));const{IR:n,IL:o}=$i(t,this.chainCode,this.publicKey,null),i=Jt.addPoints(o,this.publicKey,!0),s=sn(i);return new qi(Vi,s,i,this.fingerprint,le(n),r,t,this.depth+1,this.provider)}derivePath(e){return Hi(this,e)}}function zi(e){try{if(JSON.parse(e).encseed)return!0}catch(e){}return!1}function Xi(e,t){const r=JSON.parse(e),n=Ri(t),o=or(Ti(r,"ethaddr:string!")),i=Si(Ti(r,"encseed:string!"));ee(i&&i.length%16==0,"invalid encseed","json",e);const s=ie(vo(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))}(ie(new ti(s,a).decrypt(c)));let l="";for(let e=0;e<u.length;e++)l+=String.fromCharCode(u[e]);return{address:o,privateKey:gr(l)}}function Wi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}class Ji extends Cn{constructor(e,t){"string"!=typeof e||e.startsWith("0x")||(e="0x"+e),super("string"==typeof e?new Jt(e):e,t)}connect(e){return new Ji(this.signingKey,e)}async encrypt(e,t){const r={address:this.address,privateKey:this.privateKey};return await Gi(r,e,{progressCallback:t})}encryptSync(e){return xi({address:this.address,privateKey:this.privateKey},e)}static#U(e){if(ee(e,"invalid JSON wallet","json","[ REDACTED ]"),"mnemonic"in e&&e.mnemonic&&"en"===e.mnemonic.locale){const t=Ro.fromEntropy(e.mnemonic.entropy),r=Yi.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 Ji(e.privateKey);return ee(t.address===e.address,"address/privateKey mismatch","json","[ REDACTED ]"),t}static async fromEncryptedJson(e,t,r){let n=null;return Ni(e)?n=await async function(e,t,r){const n=JSON.parse(e),o=Ri(t),i=Pi(n);if("pbkdf2"===i.name){r&&(r(0),await Li(0));const{salt:e,count:t,dkLen:s,algorithm:a}=i,c=vo(o,e,t,s,a);return r&&(r(1),await Li(0)),Ci(n,c)}Z("scrypt"===i.name,"cannot be reached","UNKNOWN_ERROR",{params:i});const{salt:s,N:a,r:c,p:u,dkLen:l}=i;return Ci(n,await Oi(o,s,a,c,u,l,r))}(e,t,r):zi(e)&&(r&&(r(0),await Wi(0)),n=Xi(e,t),r&&(r(1),await Wi(0))),Ji.#U(n)}static fromEncryptedJsonSync(e,t){let r=null;return Ni(e)?r=function(e,t){const r=JSON.parse(e),n=Ri(t),o=Pi(r);if("pbkdf2"===o.name){const{salt:e,count:t,dkLen:i,algorithm:s}=o;return Ci(r,vo(n,e,t,i,s))}Z("scrypt"===o.name,"cannot be reached","UNKNOWN_ERROR",{params:o});const{salt:i,N:s,r:a,p:c,dkLen:u}=o;return Ci(r,Ii(n,i,s,a,c,u))}(e,t):zi(e)?r=Xi(e,t):ee(!1,"invalid JSON wallet","json","[ REDACTED ]"),Ji.#U(r)}static createRandom(e){const t=Yi.createRandom();return e?t.connect(e):t}static fromPhrase(e,t){const r=Yi.fromPhrase(e);return t?r.connect(t):r}}var Qi=r(735),Zi=r(952),es=r(770);function ts(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 rs(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)?rs(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 rs(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 ns(){/*! 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 os(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]())):(os(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,os(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,os(f,"constructor",u),os(u,"constructor",c),c.displayName="GeneratorFunction",os(u,o,"GeneratorFunction"),os(f),os(f,o,"Generator"),os(f,n,function(){return this}),os(f,"toString",function(){return"[object Generator]"}),(ns=function(){return{w:i,m:h}})()}function os(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}os=function(e,t,r,n){function i(t,r){os(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))},os(e,t,r,n)}function is(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 ss(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?is(Object(r),!0).forEach(function(t){as(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):is(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function as(e,t,r){return(t=hs(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cs(e){return cs="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},cs(e)}function us(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ls(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,hs(n.key),n)}}function fs(e,t,r){return t&&ls(e.prototype,t),r&&ls(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function hs(e){var t=function(e,t){if("object"!=cs(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=cs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==cs(t)?t:t+""}function ds(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 ps(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){ds(i,n,o,s,a,"next",e)}function a(e){ds(i,n,o,s,a,"throw",e)}s(void 0)})}}var gs=[],ys=!1,Es="0.1.0";function ms(e){return new Promise(function(t,r){gs.push({task:e,resolve:t,reject:r}),bs()})}function bs(){return vs.apply(this,arguments)}function vs(){return(vs=ps(ns().m(function e(){var t,r,n;return ns().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!ys){e.n=1;break}return e.a(2);case 1:if(t=gs.shift()){e.n=2;break}return e.a(2);case 2:return ys=!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,ys=!1,bs(),e.f(6);case 7:return e.a(2)}},e,null,[[3,5,6,7]])}))).apply(this,arguments)}var Os=function(){function e(t,r){var n,o=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(us(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(Es),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(r===Zi.wx.PROOF_SUBMITTED){var a=(null==n?void 0:n.formattedProofs)||(null==n?void 0:n.proof)||n;o._emit("completed",a)}else r!==Zi.wx.PROOF_SUBMISSION_FAILED&&r!==Zi.wx.PROOF_GENERATION_FAILED||o._emit("error",i||new Error("Verification failed"))};try{chrome.runtime.onMessage.addListener(this._boundChromeHandler)}catch(e){}}}return fs(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"!==cs(e))throw new Error("params must be an object");this.parameters=ss(ss({},this.parameters),e)}},{key:"getStatusUrl",value:function(){if(!this.sessionId)throw new Error("Session not initialized");return console.log("getStatusUrl is :",Zi.Sn.STATUS_URL(this.sessionId)),Zi.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=ps(ns().m(function e(){var t=this;return ns().w(function(e){for(;;)if(0===e.n)return e.a(2,ms(function(){return t._startVerificationInternal()}))},e)})),function(){return i.apply(this,arguments)})},{key:"cancel",value:(o=ps(ns().m(function e(){var t,r=this,n=arguments;return ns().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:Zi.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=ps(ns().m(function e(){var t,r,n=this;return ns().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(console.log("templateData is :",t),console.log("_mode is :",n._mode),"extension"===n._mode)try{chrome.runtime.sendMessage({action:Zi.wx.START_VERIFICATION,source:Zi.J_.CONTENT_SCRIPT,target:Zi.J_.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:Zi.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=ps(ns().m(function e(t){var r,n;return ns().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,fetch("".concat(Zi.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=ts(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!==Zi.vQ.VERIFICATION_COMPLETED)r!==Zi.vQ.VERIFICATION_FAILED?r!==Zi.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=ps(ns().m(function t(r,n,o){var i,s,a,c,u,l,f,h=arguments;return ns().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=be((new TextEncoder).encode(a)),u=new Ji(n),t.n=4,u.signMessage(ie(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||"",console.log("调用后端 /api/sdk/init/session/ 拿到的结果是 :",f),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"!==cs(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}(),Is=function(){return fs(function e(){var t;us(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,Qi.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)===Zi.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:Zi.vQ.CHECK_EXTENSION,extensionID:t,messageId:r},"*"),setTimeout(function(){window.removeEventListener("message",o),e(!1)},n)})}},{key:"getVersion",value:function(){return Es}},{key:"init",value:(e=ps(ns().m(function e(t,r,n){var o,i=arguments;return ns().w(function(e){for(;;)switch(e.n){case 0:return o=i.length>3&&void 0!==i[3]?i[3]:{},e.n=1,Os.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 Os.fromJsonString(e,t)}},{key:"setLogConfig",value:function(e,t){es.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(as({},o,ss(ss({},es.Ow.config),e)))}}catch(e){}window.postMessage({action:Zi.vQ.SET_LOG_CONFIG,extensionID:t,data:{config:e}},"*")}},{key:"getLogConfig",value:function(){return es.Ow.config}}]);var e}(),As=new Is,Ss=As;const ws=Is;export{Os as TrexExtensionProofRequest,ws as default,Ss as reclaimExtensionSDK,As as trexReclaimExtensionSDK};
|
|
23
|
+
//# sourceMappingURL=ReclaimExtensionSDK.bundle.js.map
|