@reclaimprotocol/browser-extension-sdk
Version:
This guide will walk you through integrating the Reclaim Protocol Browser Extension SDK into your own browser extension or web application. It covers installation, manifest configuration, background initialization, content script setup, and how to trigg
23 lines • 302 kB
JavaScript
(()=>{var e={10:(e,t,r)=>{"use strict";r.d(t,{a:()=>a});var n=r(385);function o(){/*! 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",s=r.toStringTag||"@@toStringTag";function a(r,n,o,s){var a=n&&n.prototype instanceof u?n:u,l=Object.create(a.prototype);return i(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,o,s),!0),l}var c={};function u(){}function l(){}function f(){}t=Object.getPrototypeOf;var h=[][n]?t(t([][n]())):(i(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,i(e,s,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=f,i(d,"constructor",f),i(f,"constructor",l),l.displayName="GeneratorFunction",i(f,s,"GeneratorFunction"),i(d),i(d,s,"Generator"),i(d,n,function(){return this}),i(d,"toString",function(){return"[object Generator]"}),(o=function(){return{w:a,m:p}})()}function i(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}i=function(e,t,r,n){function s(t,r){i(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:(s("next",0),s("throw",1),s("return",2))},i(e,t,r,n)}function s(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 a(e,t,r,n){return c.apply(this,arguments)}function c(){var e;return e=o().m(function e(t,r,i,s){var a,c,u,l,f,h,d,p,y,g,m,b,E,v,w,S;return o().w(function(e){for(;;)switch(e.p=e.n){case 0:a=r.action,c=r.source,u=r.target,l=r.data,e.p=1,w=a,e.n=w===t.MESSAGE_ACTIONS.CONTENT_SCRIPT_LOADED?2:w===t.MESSAGE_ACTIONS.REQUEST_PROVIDER_DATA?4:w===t.MESSAGE_ACTIONS.CHECK_IF_MANAGED_TAB?5:w===t.MESSAGE_ACTIONS.START_VERIFICATION?6:w===t.MESSAGE_ACTIONS.CANCEL_VERIFICATION?11:w===t.MESSAGE_ACTIONS.OFFSCREEN_DOCUMENT_READY?15:w===t.MESSAGE_ACTIONS.CLOSE_CURRENT_TAB?16:w===t.MESSAGE_ACTIONS.FILTERED_REQUEST_FOUND?17:w===t.MESSAGE_ACTIONS.GET_CURRENT_TAB_ID?23:24;break;case 2:if(c!==t.MESSAGE_SOURCES.CONTENT_SCRIPT||u!==t.MESSAGE_SOURCES.BACKGROUND){e.n=3;break}return h=(null===(f=i.tab)||void 0===f?void 0:f.id)&&t.managedTabs.has(i.tab.id),chrome.tabs.sendMessage(i.tab.id,{action:t.MESSAGE_ACTIONS.SHOULD_INITIALIZE,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{shouldInitialize:h}}).catch(function(e){return t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error sending initialization status:",e)}),h&&t.initPopupMessage&&t.initPopupMessage.has(i.tab.id)&&(d=t.initPopupMessage.get(i.tab.id),chrome.tabs.sendMessage(i.tab.id,d.message).then(function(){chrome.runtime.lastError&&t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error sending (pending) SHOW_PROVIDER_VERIFICATION_POPUP to tab ".concat(i.tab.id,":"),chrome.runtime.lastError.message)}).catch(function(e){return t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error sending (pending) SHOW_PROVIDER_VERIFICATION_POPUP to tab ".concat(i.tab.id," (promise catch):"),e)})),h&&t.providerDataMessage&&t.providerDataMessage.has(i.tab.id)&&(p=t.providerDataMessage.get(i.tab.id),chrome.tabs.sendMessage(i.tab.id,p.message).then(function(){chrome.runtime.lastError&&t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error sending (pending) PROVIDER_DATA_READY to tab ".concat(i.tab.id,":"),chrome.runtime.lastError.message)}).catch(function(e){return t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error sending (pending) PROVIDER_DATA_READY to tab ".concat(i.tab.id," (promise catch):"),e)}),t.providerDataMessage.delete(i.tab.id)),s({success:!0}),e.a(3,25);case 3:return e.a(3,25);case 4:return c===t.MESSAGE_SOURCES.CONTENT_SCRIPT&&u===t.MESSAGE_SOURCES.BACKGROUND&&(t.loggerService.log({message:"Content script requested provider data",type:t.LOG_TYPES.BACKGROUND,sessionId:t.sessionId||"unknown",providerId:t.httpProviderId||"unknown",appId:t.appId||"unknown"}),console.log({sender:i,ctx:t,REQUEST_PROVIDER_DATA:"REQUEST_PROVIDER_DATA"}),null!==(y=i.tab)&&void 0!==y&&y.id&&t.managedTabs.has(i.tab.id)&&t.providerData&&t.parameters&&t.sessionId&&void 0!==t.callbackUrl?(t.loggerService.log({message:"Sending the following provider data to content script: "+JSON.stringify(t.providerData),type:t.LOG_TYPES.BACKGROUND,sessionId:t.sessionId||"unknown",providerId:t.httpProviderId||"unknown",appId:t.appId||"unknown"}),s({success:!0,data:{providerData:t.providerData,parameters:t.parameters,sessionId:t.sessionId,callbackUrl:t.callbackUrl,httpProviderId:t.httpProviderId,appId:t.appId}})):s({success:!1,error:"Provider data not available or tab not managed"})),e.a(3,25);case 5:return c===t.MESSAGE_SOURCES.CONTENT_SCRIPT&&u===t.MESSAGE_SOURCES.BACKGROUND&&(m=(null===(g=i.tab)||void 0===g?void 0:g.id)&&t.managedTabs.has(i.tab.id),s({success:!0,isManaged:m})),e.a(3,25);case 6:if(c!==t.MESSAGE_SOURCES.CONTENT_SCRIPT||u!==t.MESSAGE_SOURCES.BACKGROUND){e.n=9;break}if(console.log("START VERIFICATION FROM BACKGROUND",{data:l}),t.loggerService.log({message:"Starting a new verification with data: "+JSON.stringify(l),type:t.LOG_TYPES.BACKGROUND,sessionId:l.sessionId||"unknown",providerId:l.providerId||"unknown",appId:l.applicationId||"unknown"}),t.loggerService.startFlushInterval(),!t.activeSessionId||t.activeSessionId===l.sessionId){e.n=7;break}return s({success:!1,error:"Another verification is in progress"}),e.a(3,25);case 7:return t.activeSessionId=l.sessionId||t.activeSessionId,i.tab&&i.tab.id&&(t.originalTabId=i.tab.id),e.n=8,n.startVerification(t,l);case 8:b=e.v,s({success:!0,result:b}),e.n=10;break;case 9:s({success:!1,error:"Action not supported"});case 10:return e.a(3,25);case 11:if(c!==t.MESSAGE_SOURCES.CONTENT_SCRIPT||u!==t.MESSAGE_SOURCES.BACKGROUND){e.n=13;break}return e.n=12,n.cancelSession(t,null==l?void 0:l.sessionId);case 12:s({success:!0}),e.n=14;break;case 13:s({success:!1,error:"Action not supported"});case 14:return e.a(3,25);case 15:return c===t.MESSAGE_SOURCES.OFFSCREEN&&u===t.MESSAGE_SOURCES.BACKGROUND?s({success:!0}):s({success:!1,error:"Action not supported"}),e.a(3,25);case 16:return c===t.MESSAGE_SOURCES.CONTENT_SCRIPT&&u===t.MESSAGE_SOURCES.BACKGROUND?i.tab&&i.tab.id?chrome.tabs.remove(i.tab.id,function(){chrome.runtime.lastError?(t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error closing tab:",chrome.runtime.lastError.message),s({success:!1,error:chrome.runtime.lastError.message})):(t.managedTabs.has(i.tab.id)&&t.managedTabs.delete(i.tab.id),s({success:!0}))}):(t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] CLOSE_CURRENT_TAB: No tab ID provided by sender."),s({success:!1,error:"No tab ID found to close."})):s({success:!1,error:"Action not supported"}),e.a(2,!0);case 17:if(c!==t.MESSAGE_SOURCES.CONTENT_SCRIPT||u!==t.MESSAGE_SOURCES.BACKGROUND){e.n=21;break}if(!t.filteredRequests.has(l.criteria.requestHash)){e.n=18;break}s({success:!0,result:t.filteredRequests.get(l.criteria.requestHash)}),e.n=20;break;case 18:return t.filteredRequests.set(l.criteria.requestHash,l.request),e.n=19,t.processFilteredRequest(l.request,l.criteria,l.sessionId,l.loginUrl);case 19:E=e.v,s({success:!0,result:E});case 20:e.n=22;break;case 21:s({success:!1,error:"Action not supported"});case 22:return e.a(3,25);case 23:return c===t.MESSAGE_SOURCES.CONTENT_SCRIPT&&u===t.MESSAGE_SOURCES.BACKGROUND?s({success:!0,tabId:null===(v=i.tab)||void 0===v?void 0:v.id}):s({success:!1,error:"Action not supported"}),e.a(3,25);case 24:s({success:!1,error:"Action not supported"});case 25:e.n=27;break;case 26:e.p=26,S=e.v,t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error handling ".concat(a,":"),S),s({success:!1,error:S.message});case 27:return e.a(2,!0)}},e,null,[[1,26]])}),c=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){s(i,n,o,a,c,"next",e)}function c(e){s(i,n,o,a,c,"throw",e)}a(void 0)})},c.apply(this,arguments)}},251:(e,t)=>{
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
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,y=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*y}},254:(e,t,r)=>{"use strict";r.d(t,{A:()=>ve});r(997);var n=r(952),o=r(856);function i(){/*! 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 a(r,n,o,i){var a=n&&n.prototype instanceof u?n:u,l=Object.create(a.prototype);return s(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,o,i),!0),l}var c={};function u(){}function l(){}function f(){}t=Object.getPrototypeOf;var h=[][n]?t(t([][n]())):(s(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,s(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=f,s(d,"constructor",f),s(f,"constructor",l),l.displayName="GeneratorFunction",s(f,o,"GeneratorFunction"),s(d),s(d,o,"Generator"),s(d,n,function(){return this}),s(d,"toString",function(){return"[object Generator]"}),(i=function(){return{w:a,m:p}})()}function s(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}s=function(e,t,r,n){function i(t,r){s(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))},s(e,t,r,n)}function a(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 c(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){a(i,n,o,s,c,"next",e)}function c(e){a(i,n,o,s,c,"throw",e)}s(void 0)})}}var u=function(){var e=c(i().m(function e(t,r,s){var a,c,u;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,fetch("".concat(n.Sn.PROVIDER_URL(t)));case 1:if((a=e.v).ok){e.n=2;break}throw new Error("Failed to fetch provider data");case 2:return o.Ow.log({message:"Successfully fetched provider data from the backend: "+JSON.stringify(a),type:o.D_.FETCH_DATA,sessionId:r,providerId:t,appId:s}),e.n=3,a.json();case 3:return c=e.v,e.a(2,null==c?void 0:c.providers);case 4:throw e.p=4,u=e.v,o.Ow.logError({error:"Error fetching provider data: "+u.toString(),type:o.D_.FETCH_DATA,sessionId:r,providerId:t,appId:s}),o.w9.error(o.Ey.FETCH,"Error fetching provider data:",u),u;case 5:return e.a(2)}},e,null,[[0,4]])}));return function(t,r,n){return e.apply(this,arguments)}}(),l=function(){var e=c(i().m(function e(t,r,s,a){var c,u,l;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,console.log({sessionId:t,status:r,providerId:s,appId:a},"updateSessionStatus"),e.n=1,fetch("".concat(n.Sn.UPDATE_SESSION_STATUS()),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:t,status:r})});case 1:if(c=e.v,console.log({response:c},"updateSessionStatus response"),c.ok){e.n=2;break}throw new Error("Failed to update session status");case 2:return o.Ow.log({message:"Successfully updated session status: "+r,type:o.D_.FETCH_DATA,sessionId:t,providerId:s,appId:a}),e.n=3,c.json();case 3:return u=e.v,console.log({res:u},"updateSessionStatus res"),e.a(2,u);case 4:throw e.p=4,l=e.v,console.log({error:l},"updateSessionStatus error"),o.Ow.logError({error:"Error updating session status: "+l.toString(),type:o.D_.FETCH_DATA,sessionId:t,providerId:s,appId:a}),l;case 5:return e.a(2)}},e,null,[[0,4]])}));return function(t,r,n,o){return e.apply(this,arguments)}}(),f=function(){var e=c(i().m(function e(t,r,s,a,c){var u,f,h,d,p;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,u=JSON.stringify(t),f=encodeURIComponent(u),e.n=1,fetch(r,{method:"POST",headers:{"Content-Type":"text/plain"},body:f});case 1:return h=e.v,e.n=2,h.text();case 2:if(d=e.v,h.ok){e.n=4;break}return e.n=3,l(s,n.Ew.PROOF_SUBMISSION_FAILED);case 3:throw new Error("Failed to submit proof to Callback and update session status");case 4:return o.Ow.log({message:"Successfully submitted proof to Callback and updated session status",type:o.D_.FETCH_DATA,sessionId:s,providerId:a,appId:c}),e.n=5,l(s,n.Ew.PROOF_SUBMITTED);case 5:return e.a(2,d);case 6:throw e.p=6,p=e.v,o.Ow.logError({error:"Error submitting proof to Callback: "+p.toString(),type:o.D_.FETCH_DATA,sessionId:s,providerId:a,appId:c}),o.w9.error(o.Ey.FETCH,"Error submitting proof to Callback:",p),p;case 7:return e.a(2)}},e,null,[[0,6]])}));return function(t,r,n,o,i){return e.apply(this,arguments)}}();function h(){/*! 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 d(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]())):(d(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,d(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,d(f,"constructor",u),d(u,"constructor",c),c.displayName="GeneratorFunction",d(u,o,"GeneratorFunction"),d(f),d(f,o,"Generator"),d(f,n,function(){return this}),d(f,"toString",function(){return"[object Generator]"}),(h=function(){return{w:i,m:p}})()}function d(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}d=function(e,t,r,n){function i(t,r){d(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))},d(e,t,r,n)}function p(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 y(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){p(i,n,o,s,a,"next",e)}function a(e){p(i,n,o,s,a,"throw",e)}s(void 0)})}}var g=!1,m=null,b=null,E=function(e){(null==e?void 0:e.action)===n.wx.OFFSCREEN_DOCUMENT_READY&&(null==e?void 0:e.source)===n.J_.OFFSCREEN&&(null==e?void 0:e.target)===n.J_.BACKGROUND&&(o.w9.info(o.Ey.OFFSCREEN,"Received offscreen ready signal (global listener)."),g=!0,m&&(clearTimeout(m),m=null))},v=function(){"undefined"!=typeof chrome&&chrome.runtime&&chrome.runtime.onMessage&&chrome.runtime.onMessage.addListener&&chrome.runtime.onMessage.hasListener&&(chrome.runtime.onMessage.hasListener(E)?o.w9.info(o.Ey.OFFSCREEN,"Global listener already attached."):chrome.runtime.onMessage.addListener(E))},w=function(){"undefined"!=typeof chrome&&chrome.runtime&&chrome.runtime.onMessage&&chrome.runtime.onMessage.addListener&&chrome.runtime.onMessage.hasListener&&(chrome.runtime.onMessage.hasListener(E)?o.w9.info(o.Ey.OFFSCREEN,"Global listener already attached."):chrome.runtime.onMessage.addListener(E))};function S(){return I.apply(this,arguments)}function I(){return(I=y(h().m(function e(){var t,r;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=chrome.runtime.getURL("reclaim-browser-extension-sdk/offscreen/offscreen.html"),o.w9.info(o.Ey.OFFSCREEN,"Attempting to create offscreen document with URL:",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:o.w9.info(o.Ey.OFFSCREEN,"Offscreen document creation initiated."),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}o.w9.warn(o.Ey.OFFSCREEN,"Offscreen document already exists or creation was attempted by another part."),e.n=5;break;case 4:throw o.w9.error(o.Ey.OFFSCREEN,"Error creating offscreen document:",r),r;case 5:return e.a(2)}},e,null,[[1,3]])}))).apply(this,arguments)}function O(){return A.apply(this,arguments)}function A(){return A=y(h().m(function e(){var t,r=arguments;return h().w(function(e){for(;;)switch(e.n){case 0:if(t=r.length>0&&void 0!==r[0]?r[0]:15e3,console.log("waitForOffscreenReadyInternal",{offscreenReady:g}),!g){e.n=1;break}return o.w9.info(o.Ey.OFFSCREEN," Already ready (waitForOffscreenReadyInternal check)"),e.a(2,!0);case 1:o.w9.info(o.Ey.OFFSCREEN," Waiting for offscreen document to be ready (timeout:- ".concat(t,"ms)..."));try{console.log("Sending ping to offscreen document..."),chrome.runtime.sendMessage({action:n.wx.PING_OFFSCREEN,source:n.J_.BACKGROUND,target:n.J_.OFFSCREEN}),console.log("Ping sent to offscreen document")}catch(e){o.w9.warn(o.Ey.OFFSCREEN," Synchronous error sending ping:",e)}return e.a(2,new Promise(function(e){if(g)return o.w9.info(o.Ey.OFFSCREEN,"Became ready while setting up promise."),void e(!0);var r=function(t){t.action===n.wx.OFFSCREEN_DOCUMENT_READY&&t.source===n.J_.OFFSCREEN&&t.target===n.J_.BACKGROUND&&(g=!0,clearTimeout(i),chrome.runtime.onMessage.removeListener(r),m===i&&(m=null),e(!0))};chrome.runtime.onMessage.addListener(r),m&&clearTimeout(m);var i=setTimeout(function(){chrome.runtime.onMessage.removeListener(r),o.w9.error(o.Ey.OFFSCREEN," Timed out waiting for offscreen document after ".concat(t,"ms.")),m===i&&(m=null),e(!1)},t);m=i}))}},e)})),A.apply(this,arguments)}function T(){return R.apply(this,arguments)}function R(){return(R=y(h().m(function e(){return h().w(function(e){for(;;)switch(e.n){case 0:if(!g){e.n=1;break}return o.w9.info(o.Ey.OFFSCREEN,"Document already confirmed ready."),e.a(2,!0);case 1:if(!b){e.n=2;break}return o.w9.info(o.Ey.OFFSCREEN," Creation already in progress, awaiting..."),e.n=2,b;case 2:if(!chrome.runtime.getContexts){e.n=6;break}return e.n=3,chrome.runtime.getContexts({contextTypes:["OFFSCREEN_DOCUMENT"]});case 3:if(!(e.v.length>0)){e.n=6;break}if(o.w9.info(o.Ey.OFFSCREEN,"Offscreen document context found."),!g){e.n=4;break}return e.a(2,!0);case 4:return o.w9.info(o.Ey.OFFSCREEN,"Context exists, but not marked ready. Waiting for signal..."),e.n=5,O(5e3);case 5:return e.a(2,e.v);case 6:if(b){e.n=7;break}return o.w9.info(o.Ey.OFFSCREEN,"No existing context/promise, initiating creation."),b=S().finally(function(){console.log("OFFSCREEN CREATION PROMISE FINISHED",b),b=null}),e.n=7,b;case 7:return e.n=8,O(5e4);case 8:if(e.v){e.n=9;break}throw new Error("Failed to initialize or confirm offscreen document readiness.");case 9:return o.w9.info(o.Ey.OFFSCREEN,"Offscreen document ensured to be ready."),e.a(2,!0)}},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 N(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]())):(N(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,N(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,N(f,"constructor",u),N(u,"constructor",c),c.displayName="GeneratorFunction",N(u,o,"GeneratorFunction"),N(f),N(f,o,"Generator"),N(f,n,function(){return this}),N(f,"toString",function(){return"[object Generator]"}),(P=function(){return{w:i,m:h}})()}function N(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}N=function(e,t,r,n){function i(t,r){N(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))},N(e,t,r,n)}function C(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}"undefined"!=typeof chrome&&chrome.runtime&&chrome.runtime.onMessage&&w(),w();var _=function(){var e,t=(e=P().m(function e(t){var r;return P().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,o.w9.info(o.Ey.PROOF,"[PROOF-GENERATOR] Starting proof generation with data:",t),t){e.n=1;break}throw new Error("No claim data provided for proof generation");case 1:return e.n=2,T();case 2:return e.a(2,new Promise(function(e,r){var i=setTimeout(function(){o.w9.error(o.Ey.PROOF,"[PROOF-GENERATOR] Timeout waiting for offscreen document to generate proof"),r({success:!1,error:"Timeout waiting for offscreen document to generate proof"})},6e4),s=function(t){if(t.action===n.wx.GENERATE_PROOF_RESPONSE&&t.source===n.J_.OFFSCREEN&&t.target===n.J_.BACKGROUND){if(clearTimeout(i),chrome.runtime.onMessage.removeListener(s),!t.success)return o.w9.error(o.Ey.PROOF,"[PROOF-GENERATOR] Proof generation failed:",t.error),void e({success:!1,error:t.error||"Unknown error in proof generation"});o.w9.info(o.Ey.PROOF,"[PROOF-GENERATOR] Proof generation successful"),e(t)}};chrome.runtime.onMessage.addListener(s),chrome.runtime.sendMessage({action:n.wx.GENERATE_PROOF,source:n.J_.BACKGROUND,target:n.J_.OFFSCREEN,data:t},function(){chrome.runtime.lastError&&(clearTimeout(i),chrome.runtime.onMessage.removeListener(s),o.w9.error(o.Ey.PROOF,"[PROOF-GENERATOR] Error sending message to offscreen document:",chrome.runtime.lastError),r({success:!1,error:chrome.runtime.lastError.message||"Error communicating with offscreen document"}))})}));case 3:return e.p=3,r=e.v,o.w9.error(o.Ey.PROOF,"[PROOF-GENERATOR] Error in proof generation process:",r),e.a(2,{success:!1,error:r.message||"Unknown error in proof generation process"})}},e,null,[[0,3]])}),function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){C(i,n,o,s,a,"next",e)}function a(e){C(i,n,o,s,a,"throw",e)}s(void 0)})});return function(e){return t.apply(this,arguments)}}(),L=r(573),k=function(e,t){try{if(!t.startsWith("$"))return null;for(var r=t.startsWith("$.")?t.substring(2):t.substring(1),n=[],i="",s=!1,a=0;a<r.length;a++){var c=r[a];if("["===c)i&&(n.push(i),i=""),s=!0;else if("]"===c){if(s&&i){var u=i.replace(/['"]/g,"");n.push(parseInt(u,10)),i=""}s=!1}else"."!==c||s?i+=c:i&&(n.push(i),i="")}i&&n.push(i);for(var l=e,f=0,h=n;f<h.length;f++){var d=h[f];if(null==l)return null;l=l[d]}return l}catch(e){return o.w9.error(o.Ey.CLAIM,"[PARAMS-EXTRACTOR-UTILS] Error extracting JSON value with path ".concat(t,":"),e),null}},U=function(e,t){try{var r=t.replace(/^\/\//,"").replace(/\/@/," ").split("/"),n=r[r.length-1],i=new RegExp("<".concat(n,"[^>]*>(.*?)</").concat(n,">"),"i"),s=e.match(i);return s?s[1]:null}catch(e){return o.w9.error(o.Ey.CLAIM,"[PARAMS-EXTRACTOR-UTILS] Error extracting HTML value with XPath ".concat(t,":"),e),null}};function x(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return F(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)?F(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 F(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 B(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.replace(/[[\]()*+?.,\\^$|#]/g,"\\$&"),o=function(e){for(var t,r=/{{(\w+)}}/g,n=[];null!==(t=r.exec(e));)n.push(t[1]);return n}(e),i=[],s=x(o);try{for(s.s();!(t=s.n()).done;){var a=t.value;if(r[a])n=n.replace("{{".concat(a,"}}"),r[a]);else{i.push(a);var c=a.endsWith("GRD")?"(.*)":"(.*?)";n=n.replace("{{".concat(a,"}}"),c)}}}catch(e){s.e(e)}finally{s.f()}return{pattern:n,allVars:o,unsubstitutedVars:i}}function D(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 G(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)?G(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 G(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 M(e){return M="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},M(e)}var j=function(e){return e?(e.match(/{{([^}]+)}}/g)||[]).map(function(e){return e.substring(2,e.length-2)}):[]},K=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e||!t)return r;var n=j(e),o=B(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},V=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e||!t)return r;var n=j(e),o=B(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},$=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};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 o.w9.warn(o.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=j(c.value);if(0===l.length)return;var f=u;if(f){var h=null;if(f.jsonPath&&i)h=k(i,f.jsonPath);else if(f.xPath&&!s)h=U(e,f.xPath);else if(f.regex){var d=e.match(new RegExp(f.regex));d&&d.length>1&&(h=d[1])}null!==h&&("object"===M(h)&&null!==h?n[l[0]]=JSON.stringify(h):n[l[0]]=String(h))}}}catch(e){o.w9.error(o.Ey.CLAIM,"[PARAM-EXTRACTOR] Error extracting params from response:",e)}return n},H=function(e){var t={},r={};return Object.entries(e||{}).forEach(function(e){var n=D(e,2),o=n[0],i=n[1];o.toLowerCase().includes("secret")?r[o]=i:t[o]=i}),{publicParams:t,secretParams:r}};function z(e){return z="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},z(e)}function q(){/*! 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 W(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]())):(W(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,W(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,W(f,"constructor",u),W(u,"constructor",c),c.displayName="GeneratorFunction",W(u,o,"GeneratorFunction"),W(f),W(f,o,"Generator"),W(f,n,function(){return this}),W(f,"toString",function(){return"[object Generator]"}),(q=function(){return{w:i,m:h}})()}function W(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}W=function(e,t,r,n){function i(t,r){W(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))},W(e,t,r,n)}function Y(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 J(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Y(Object(r),!0).forEach(function(t){Z(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Y(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Z(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=z(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=z(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==z(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Q(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 X(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)?X(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 X(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 ee(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 te=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")},re=function(){return new Promise(function(e,t){var r=setTimeout(function(){chrome.runtime.onMessage.removeListener(i),t(new Error("Timeout: No response from offscreen document for private key request."))},1e4),i=function(s,a){return s.action!==n.wx.GET_PRIVATE_KEY_RESPONSE||s.source!==n.J_.OFFSCREEN||s.target!==n.J_.BACKGROUND||(clearTimeout(r),chrome.runtime.onMessage.removeListener(i),s.success&&s.privateKey?(o.w9.info(o.Ey.CLAIM,"[CLAIM-CREATOR] Received private key from offscreen document"),e(s.privateKey)):(o.w9.error(o.Ey.CLAIM,"[CLAIM-CREATOR] Failed to get private key from offscreen:",s.error),t(new Error(s.error||"Unknown error getting private key from offscreen document."))),!1)};chrome.runtime.onMessage.addListener(i),o.w9.info(o.Ey.CLAIM,"[CLAIM-CREATOR] Requesting private key from offscreen document"),chrome.runtime.sendMessage({action:n.wx.GET_PRIVATE_KEY,source:n.J_.BACKGROUND,target:n.J_.OFFSCREEN},function(e){chrome.runtime.lastError&&(clearTimeout(r),chrome.runtime.onMessage.removeListener(i),o.w9.error(o.Ey.CLAIM,"[CLAIM-CREATOR] Error sending GET_PRIVATE_KEY message:",chrome.runtime.lastError.message),t(new Error("Error sending message to offscreen document: ".concat(chrome.runtime.lastError.message))))})})},ne=function(){var e,t=(e=q().m(function e(t,r,n,i){var s,a,c,u,l,f,h,d,p,y,g,m,b,E,v,w,S;return q().w(function(e){for(;;)switch(e.p=e.n){case 0:return o.w9.info(o.Ey.CLAIM,"[CLAIM-CREATOR] Creating claim object from request data"),e.p=1,o.w9.info(o.Ey.CLAIM,"[CLAIM-CREATOR] Ensuring offscreen document is ready..."),e.n=2,T();case 2:o.w9.info(o.Ey.CLAIM,"[CLAIM-CREATOR] Offscreen document is ready."),e.n=4;break;case 3:throw e.p=3,w=e.v,o.w9.error(o.Ey.CLAIM,"[CLAIM-CREATOR] Failed to ensure offscreen document:",w),new Error("Failed to initialize offscreen document: ".concat(w.message));case 4:return e.n=5,te();case 5:return c=e.v,u=["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"],f={},(l={}).url="TEMPLATE"===r.urlType?r.url:t.url,l.method=t.method||"GET",t.headers&&(o.w9.info(o.Ey.CLAIM,"[CLAIM-CREATOR] request.headers: ",t.headers),h={"Sec-Fetch-Mode":"same-origin","Sec-Fetch-Site":"same-origin","User-Agent":c},d={Referer:null!=i?i:""},Object.entries(t.headers).forEach(function(e){var t=Q(e,2),r=t[0],n=t[1],o=r.toLowerCase();u.includes(o)?h[r]=n:d[r]=n}),Object.keys(h).length>0&&(l.headers=h),Object.keys(d).length>0&&(f.headers=d)),null!=r&&null!==(s=r.bodySniff)&&void 0!==s&&s.enabled&&t.body&&(l.body=null==r||null===(p=r.bodySniff)||void 0===p?void 0:p.template),t.cookieStr&&(f.cookieStr=t.cookieStr),y={},"TEMPLATE"===r.urlType&&t.url&&(y=J(J({},y),K(r.url,t.url))),null!=r&&null!==(a=r.bodySniff)&&void 0!==a&&a.enabled&&t.body&&(y=J(J({},y),V(r.bodySniff.template,t.body))),t.responseText&&r.responseMatches&&(y=J(J({},y),$(t.responseText,r.responseMatches,r.responseRedactions||[]))),g=H(y),m=g.publicParams,b=g.secretParams,Object.keys(m).length>0&&(l.paramValues=m),Object.keys(b).length>0&&(f.paramValues=b),r.responseMatches&&(l.responseMatches=r.responseMatches.map(function(e){return{value:e.value,type:e.type||"contains",invert:e.invert||!1}})),r.responseRedactions&&(l.responseRedactions=r.responseRedactions.map(function(e){var t={};return Object.entries(e).forEach(function(e){var r=Q(e,2),n=r[0],o=r[1];"hash"!==n&&("jsonPath"!==n&&"xPath"!==n||o&&""!==o)&&(t[n]=o)}),t})),r.responseSelections&&(l.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&&(l.additionalClientOptions=r.additionalClientOptions),e.p=6,e.n=7,re();case 7:E=e.v,e.n=9;break;case 8:throw e.p=8,S=e.v,o.w9.error(o.Ey.CLAIM,"[CLAIM-CREATOR] Could not obtain private key:",S),new Error("Could not obtain owner private key: ".concat(S.message));case 9:return v={name:"http",sessionId:n,params:l,secretParams:f,ownerPrivateKey:E,client:{url:"wss://attestor.reclaimprotocol.org/ws"}},console.log("claimObject",v),o.w9.info(o.Ey.CLAIM,"[CLAIM-CREATOR] Claim object created successfully"),e.a(2,v)}},e,null,[[6,8],[1,3]])}),function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){ee(i,n,o,s,a,"next",e)}function a(e){ee(i,n,o,s,a,"throw",e)}s(void 0)})});return function(e,r,n,o){return t.apply(this,arguments)}}();function oe(e){return oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},oe(e)}function ie(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,se(n.key),n)}}function se(e){var t=function(e,t){if("object"!=oe(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=oe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==oe(t)?t:t+""}var ae=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;o.w9.info(o.Ey.SESSION_TIMER,"[SESSION TIMER] Starting session timer"),this.clearSessionTimer(),this.sessionTimerStartTime=Date.now(),this.sessionTimer=setTimeout(function(){null!==e.sessionTimer?(o.w9.error(o.Ey.SESSION_TIMER,"[SESSION TIMER] Session timer expired"),e.onSessionTimeout&&e.onSessionTimeout("Session timeout: No proofs generated within time limit")):o.w9.info(o.Ey.SESSION_TIMER,"[SESSION TIMER] Timer was already cleared, ignoring timeout")},this.sessionTimerDuration)}},{key:"resetSessionTimer",value:function(){o.w9.info(o.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){o.w9.info(o.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&&(o.w9.info(o.Ey.SESSION_TIMER,"[SESSION TIMER] Resuming session timer with remaining time:",this.sessionTimerRemainingTime),this.sessionTimer=setTimeout(function(){o.w9.error(o.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(){o.w9.info(o.Ey.SESSION_TIMER,"[SESSION TIMER] Clearing all timers"),this.clearSessionTimer(),this.sessionTimerPaused=!1,this.sessionTimerRemainingTime=0,this.sessionTimerStartTime=0}},{key:"setTimerDuration",value:function(e){e&&"number"==typeof e&&(this.sessionTimerDuration=e)}}])&&ie(e.prototype,t),r&&ie(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}(),ce=r(10),ue=r(385);function le(){/*! 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 fe(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]())):(fe(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,fe(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,fe(f,"constructor",u),fe(u,"constructor",c),c.displayName="GeneratorFunction",fe(u,o,"GeneratorFunction"),fe(f),fe(f,o,"Generator"),fe(f,n,function(){return this}),fe(f,"toString",function(){return"[object Generator]"}),(le=function(){return{w:i,m:h}})()}function fe(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}fe=function(e,t,r,n){function i(t,r){fe(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))},fe(e,t,r,n)}function he(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 de(e,t,r){e.proofGenerationQueue.push({claimData:t,requestHash:r}),e.isProcessingQueue||(e.sessionTimerManager.pauseSessionTimer(),pe(e))}function pe(e){return ye.apply(this,arguments)}function ye(){var e;return e=le().m(function e(t){var r,n,i,s;return le().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!t.isProcessingQueue&&0!==t.proofGenerationQueue.length){e.n=3;break}if(0!==t.proofGenerationQueue.length){e.n=2;break}if(t.generatedProofs.size!==t.providerData.requestData.length){e.n=1;break}return t.sessionTimerManager.clearAllTimers(),setTimeout(function(){return t.submitProofs()},0),e.a(2);case 1:t.sessionTimerManager.resumeSessionTimer();case 2:return e.a(2);case 3:return t.isProcessingQueue=!0,r=t.proofGenerationQueue.shift(),e.p=4,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:r.requestHash}}),t.loggerService.log({message:"Queued proof generation request for request hash: ".concat(r.requestHash),type:t.LOG_TYPES.BACKGROUND,sessionId:t.sessionId||"unknown",providerId:t.httpProviderId||"unknown",appId:t.appId||"unknown"}),e.n=5,t.generateProof(r.claimData);case 5:if((n=e.v).success){e.n=6;break}return t.failSession("Proof generation failed: "+n.error,r.requestHash),e.a(2);case 6:(i=n.proof)&&(t.generatedProofs.has(r.requestHash)||t.generatedProofs.set(r.requestHash,i),t.loggerService.log({message:"Proof generation successful for request hash: ".concat(r.requestHash),type:t.LOG_TYPES.BACKGROUND,sessionId:t.sessionId||"unknown",providerId:t.httpProviderId||"unknown",appId:t.appId||"unknown"}),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:r.requestHash}}),t.sessionTimerManager.resetSessionTimer()),e.n=8;break;case 7:return e.p=7,s=e.v,o.w9.error(o.Ey.BACKGROUND,"Error processing proof generation queue item:",s),t.loggerService.logError({error:"Proof generation failed for request hash: ".concat(r.requestHash),type:t.LOG_TYPES.BACKGROUND,sessionId:t.sessionId||"unknown",providerId:t.httpProviderId||"unknown",appId:t.appId||"unknown"}),t.failSession("Proof generation failed: "+s.message,r.requestHash),e.a(2);case 8:return e.p=8,t.isProcessingQueue=!1,t.proofGenerationQueue.length>0?pe(t):t.generatedProofs.size===t.providerData.requestData.length?(t.sessionTimerManager.clearAllTimers(),setTimeout(function(){return t.submitProofs()},0)):t.sessionTimerManager.resumeSessionTimer(),e.f(8);case 9:return e.a(2)}},e,null,[[4,7,8,9]])}),ye=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){he(i,n,o,s,a,"next",e)}function a(e){he(i,n,o,s,a,"throw",e)}s(void 0)})},ye.apply(this,arguments)}var ge=r(887);function me(){/*! 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]"}),(me=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 Ee(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 ve(){console.log("🚀 BACKGROUND INIT FUNCTION CALLED"),v();var e={activeTabId:null,providerData:null,parameters:null,httpProviderId:null,appId:null,sessionId:null,callbackUrl:null,originalTabId:null,managedTabs:new Set,generatedProofs:new Map,filteredRequests:new Map,proofGenerationQueue:[],isProcessingQueue:!1,firstRequestReceived:!1,initPopupMessage:new Map,providerDataMessage:new Map,activeSessionId:null,sessionTimerManager:new ae,fetchProviderData:u,updateSessionStatus:l,submitProofOnCallback:f,RECLAIM_SESSION_STATUS:n.Ew,MESSAGE_ACTIONS:n.wx,MESSAGE_SOURCES:n.J_,generateProof:_,formatProof:L.c,createClaimObject:ne,loggerService:o.Ow,LOG_TYPES:o.D_,debugLogger:o.w9,DebugLogType:o.Ey,processFilteredRequest:null,failSession:(null,function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return ue.failSession.apply(ue,[e].concat(r))}),submitProofs:(null,function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return ue.submitProofs.apply(ue,[e].concat(r))})};return e.processFilteredRequest=function(){var t,r=(t=me().m(function t(r,n,i,s){var a,c,u,l;return me().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,e.firstRequestReceived||(e.firstRequestReceived=!0,e.sessionTimerManager.startSessionTimer()),e.loggerService.log({message:"Received filtered request ".concat(r.url," from content script for request hash: ").concat(n.requestHash),type:e.LOG_TYPES.BACKGROUND,sessionId:e.sessionId||"unknown",providerId:e.httpProviderId||"unknown",appId:e.appId||"unknown"}),t.n=1,ge.W(r.url,e.debugLogger,e.DebugLogType);case 1:return(a=t.v)&&(r.cookieStr=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}}),c=null,t.p=2,t.n=3,e.createClaimObject(r,n,i,s);case 3:c=t.v,t.n=5;break;case 4:return t.p=4,u=t.v,o.w9.error(o.Ey.BACKGROUND,"Error creating claim object:",u),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: "+u.message,n.requestHash),t.a(2,{success:!1,error:u.message});case 5:return console.log({claimData:c}),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}}),e.loggerService.log({message:"Claim Object creation successful for request hash: ".concat(n.requestHash),type:e.LOG_TYPES.BACKGROUND,sessionId:e.sessionId||"unknown",providerId:e.httpProviderId||"unknown",appId:e.appId||"unknown"})),de(e,c,n.requestHash),t.a(2,{success:!0,message:"Proof generation queued"});case 6:return t.p=6,l=t.v,o.w9.error(o.Ey.BACKGROUND,"Error processing filtered request:",l),e.failSession("Error processing request: "+l.message,n.requestHash),t.a(2,{success:!1,error:l.message})}},t,null,[[2,4],[0,6]])}),function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function s(e){Ee(i,n,o,s,a,"next",e)}function a(e){Ee(i,n,o,s,a,"throw",e)}s(void 0)})});return function(e,t,n,o){return r.apply(this,arguments)}}(),e.sessionTimerManager.setCallbacks(e.failSession),e.sessionTimerManager.setTimerDuration(3e4),chrome.runtime.onMessage.addListener(function(t,r,n){return console.log("background.js chrome.runtime.onMessage.addListener",{message:t,sender:r,sendResponse:n}),ce.a(e,t,r,n),!0}),chrome.tabs.onRemoved.addListener(function(t){e.managedTabs.has(t)&&e.managedTabs.delete(t)}),console.log("🚀 BACKGROUND INITIALIZATION COMPLETE"),e}},287:(e,t,r)=>{"use strict";
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
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|y(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(Y(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(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);const o=function(e){if(c.isBuffer(e)){const t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||J(e.length)?a(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function f(e){return l(e),a(e<0?0:0|p(e))}function h(e){const t=e.length<0?0:0|p(e.length),r=a(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function d(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,c.prototype),n}function p(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function y(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(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 z(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:z(e).length;t=(""+t).toLowerCase(),o=!0}}function g(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 T(this,t,r);case"ascii":return P(this,t,r);case"latin1":case"binary":return N(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:E(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):E(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function E(e,t,r,n,o){let i,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){let n=-1;for(i=r;i<a;i++)if(u(e,i)===u(t,-1===n?0:i-n)){if(-1===n&&(n=i),i-n+1===c)return n*s}else-1!==n&&(i-=i-n),n=-1}else for(r+c>a&&(r=a-c),i=r;i>=0;i--){let r=!0;for(let n=0;n<c;n++)if(u(e,i+n)!==u(t,n)){r=!1;break}if(r)return i}return-1}function v(e,t,r,n){r=Number(r)||0;const o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;const i=t.length;let s;for(n>i/2&&(n=i/2),s=0;s<n;++s){const n=parseInt(t.substr(2*s,2),16);if(J(n))return s;e[r+s]=n}return s}function w(e,t,r,n){return W(z(t,e.length-r),e,r,n)}function S(e,t,r,n){return W(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 I(e,t,r,n){return W(q(t),e,r,n)}function O(e,t,r,n){return W(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 A(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function T(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<=R)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=R));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(Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),Y(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(Y(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=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)m(this,t,t+1);return this},c.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},c.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?T(this,0,e):g.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(Y(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 b(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return b(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 w(this,e,t,r);case"ascii":case"latin1":case"binary":return S(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(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 R=4096;function P(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+=Z[e[n]];return o}function _(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 k(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 F(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 B(e,t,r,n,i){return t=+t,r>>>=0,i||F(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function D(e,t,r,n,i){return t=+t,r>>>=0,i||F(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){k(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){k(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||k(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||k(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||k(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||k(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||k(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);k(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);k(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||k(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||k(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||k(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||k(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||k(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 B(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return B(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return D(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return D(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 G={};function M(e,t,r){G[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 G.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 G.ERR_INVALID_ARG_TYPE(t,"number",e)}function $(e,t,r){if(Math.floor(e)!==e)throw V(e,r),new G.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new G.ERR_BUFFER_OUT_OF_BOUNDS;throw new G.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 z(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 W(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 Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const Z=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?X:e}function X(){throw new Error("BigInt not supported")}},296:(e,t,r)=>{"use strict";r.r(t),r.d(t,{WebSocket:()=>p,default:()=>y});var n,o=r(856);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 y=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")},385:(e,t,r)=>{"use strict";function n(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 o(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)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 s,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw s}}}}function o(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 i(){/*! 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 a(r,n,o,i){var a=n&&n.prototype instanceof u?n:u,l=Object.create(a.prototype);return s(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,o,i),!0),l}var c={};function u(){}function l(){}function f(){}t=Object.getPrototypeOf;var h=[][n]?t(t([][n]())):(s(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,s(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=f,s(d,"constructor",f),s(f,"constructor",l),l.displayName="GeneratorFunction",s(f,o,"GeneratorFunction"),s(d),s(d,o,"Generator"),s(d,n,function(){return this}),s(d,"toString",function(){return"[object Generator]"}),(i=function(){return{w:a,m:p}})()}function s(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}s=function(e,t,r,n){function i(t,r){s(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))},s(e,t,r,n)}function a(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 c(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){a(i,n,o,s,c,"next",e)}function c(e){a(i,n,o,s,c,"throw",e)}s(void 0)})}}function u(e,t){return l.apply(this,arguments)}function l(){return(l=c(i().m(function e(t,r){var n,o,s;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,t.providerData=null,t.parameters=null,t.httpProviderId=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.sessionTimerManager.clearAllTimers(),t.firstRequestReceived=!1,r.providerId){e.n=1;break}throw new Error("Provider ID not found");case 1:return t.loggerService.log({message:"Fetching provider data from the backend for provider Id "+r.providerId,type:t.LOG_TYPES.BACKGROUND,sessionId:r.sessionId||"unknown",providerId:r.providerId||"unknown",appId:r.applicationId||"unknown"}),e.n=2,t.fetchProviderData(r.providerId,r.sessionId,r.applicationId);case 2:if(n=e.v,t.providerData=n,t.httpProviderId=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),n){e.n=3;break}throw new Error("Provider data not found");case 3:return o=n.loginUrl,chrome.tabs.create({url:o},function(e){var n,o,i;t.activeTabId=e.id,t.loggerService.log({message:"New tab created",type:t.LOG_TYPES.BACKGROUND,sessionId:r.sessionId||"unknown",providerId:r.providerId||"unknown",appId:r.applicationId||"unknown"}),t.managedTabs.add(e.id);var s=(null===(n=t.providerData)||void 0===n?void 0:n.name)||"Default Provider",a=(null===(o=t.providerData)||void 0===o?void 0:o.description)||"Default Description",c=(null===(i=t.providerData)||void 0===i||null===(i=i.verificationConfig)||void 0===i?void 0:i.dataRequired)||"Default Data",u=t.sessionId||"unknown";if(e.id){var l={action:t.MESSAGE_ACTIONS.SHOW_PROVIDER_VERIFICATION_POPUP,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{providerName:s,description:a,dataRequired:c,sessionId:u}},f={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,httpProviderId:t.httpProviderId,appId:t.appId}};t.initPopupMessage||(t.initPopupMessage=new Map),t.initPopupMessage.set(e.id,{message:l}),t.providerDataMessage.set(e.id,{message:f})}else t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] New tab does not have an ID, cannot queue message for popup.");t.updateSessionStatus(r.sessionId,t.RECLAIM_SESSION_STATUS.USER_STARTED_VERIFICATION,r.providerId,r.applicationId).catch(function(e){t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error updating session status:",e)})}),e.a(2,{success:!0,message:"Verification started, redirecting to provider login page"});case 4:throw e.p=4,s=e.v,t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error starting verification:",s),t.activeSessionId=null,s;case 5:return e.a(2)}},e,null,[[0,4]])}))).apply(this,arguments)}function f(e,t,r){return h.apply(this,arguments)}function h(){return(h=c(i().m(function e(t,r,n){var o;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Failing session:",r),t.loggerService.logError({error:"Session failed: ".concat(r),type:t.LOG_TYPES.BACKGROUND,sessionId:t.sessionId||"unknown",providerId:t.httpProviderId||"unknown",appId:t.appId||"unknown"}),t.sessionTimerManager.clearAllTimers(),!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.httpProviderId,t.appId);case 2:e.n=4;break;case 3:e.p=3,o=e.v,t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error updating session status to failed:",o);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){t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error notifying content script of session failure:",e)}),!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,e.v;case 8:return e.p=8,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,e.v;case 11:t.proofGenerationQueue=[],t.isProcessingQueue=!1,t.activeSessionId=null;case 12:return e.a(2)}},e,null,[[8,10],[5,7],[1,3]])}))).apply(this,arguments)}function d(e){return p.apply(this,arguments)}function p(){return(p=c(i().m(function e(t){var r,o,s,a,u,l,f,h,d,p,y,g;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,t.sessionTimerManager.clearAllTimers(),0!==t.generatedProofs.size){e.n=1;break}return e.a(2);case 1:if(t.generatedProofs.size===t.providerData.requestData.length){e.n=2;break}return e.a(2);case 2:r=[],o=n(t.providerData.requestData);try{for(o.s();!(s=o.n()).done;)a=s.value,t.generatedProofs.has(a.requestHash)&&(u=t.generatedProofs.get(a.requestHash),l=t.formatProof(u,a),r.push(l))}catch(e){o.e(e)}finally{o.f()}if(f=!1,!(t.callbackUrl&&"string"==typeof t.callbackUrl&&t.callbackUrl.length>0)){e.n=15;break}return e.p=3,e.n=4,t.submitProofOnCallback(r,t.callbackUrl,t.sessionId,t.httpProviderId,t.appId);case 4:f=!0,e.n=14;break;case 5:return e.p=5,h=e.v,e.p=6,e.n=7,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:h.message,sessionId:t.sessionId}});case 7:e.n=9;break;case 8:e.p=8,e.v;case 9: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:h.message,sessionId:t.sessionId}}),e.p=10,e.n=11,chrome.runtime.sendMessage({action:t.MESSAGE_ACTIONS.PROOF_SUBMISSION_FAILED,data:{error:h.message,sessionId:t.sessionId}});case 11:e.n=13;break;case 12:e.p=12,e.v;case 13:throw t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error submitting my poor proofs:",h),h;case 14:e.n=19;break;case 15:if(!t.sessionId){e.n=19;break}return e.p=16,e.n=17,t.updateSessionStatus(t.sessionId,t.RECLAIM_SESSION_STATUS.PROOF_GENERATION_SUCCESS,t.httpProviderId,t.appId);case 17:e.n=19;break;case 18:e.p=18,d=e.v,t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error updating status to PROOF_GENERATION_SUCCESS:",d);case 19:if(!t.activeTabId){e.n=23;break}return e.p=20,e.n=21,chrome.tabs.sendMessage(t.activeTabId,{action:t.MESSAGE_ACTIONS.PROOF_SUBMITTED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{formattedProofs:r,submitted:f,sessionId:t.sessionId}});case 21:e.n=23;break;case 22:e.p=22,p=e.v,t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error notifying content script:",p);case 23:if(!t.originalTabId){e.n=27;break}return e.p=24,e.n=25,chrome.tabs.sendMessage(t.originalTabId,{action:t.MESSAGE_ACTIONS.PROOF_SUBMITTED,source:t.MESSAGE_SOURCES.BACKGROUND,target:t.MESSAGE_SOURCES.CONTENT_SCRIPT,data:{formattedProofs:r,submitted:f,sessionId:t.sessionId}});case 25:e.n=27;break;case 26:e.p=26,y=e.v,t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error notifying original tab:",y);case 27:return e.p=27,e.n=28,chrome.runtime.sendMessage({action:t.MESSAGE_ACTIONS.PROOF_SUBMITTED,data:{formattedProofs:r,submitted:f,sessionId:t.sessionId}});case 28:e.n=30;break;case 29:e.p=29,e.v;case 30:if(t.originalTabId)try{setTimeout(c(i().m(function e(){return i().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,chrome.tabs.update(t.originalTabId,{active:!0});case 1:if(!t.activeTabId){e.n=3;break}return e.n=2,chrome.tabs.remove(t.activeTabId);case 2:t.activeTabId=null;case 3:t.originalTabId=null;case 4:return e.a(2)}},e)})),3e3)}catch(e){t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error navigating back or closing tab:",e)}else if(t.activeTabId)try{setTimeout(c(i().m(function e(){return i().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,chrome.tabs.remove(t.activeTabId);case 1:t.activeTabId=null;case 2:return e.a(2)}},e)})),3e3)}catch(e){}return t.activeSessionId=null,e.a(2,{success:!0});case 31:throw e.p=31,g=e.v,t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error submitting proof:",g),t.activeSessionId=null,g;case 32:return e.a(2)}},e,null,[[27,29],[24,26],[20,22],[16,18],[10,12],[6,8],[3,5],[0,31]])}))).apply(this,arguments)}function y(e,t){return g.apply(this,arguments)}function g(){return(g=c(i().m(function e(t,r){var n,o,s,a;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,t.sessionTimerManager.clearAllTimers(),!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.httpProviderId,t.appId);case 2:e.n=4;break;case 3:e.p=3,n=e.v,t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error updating status on cancel:",n);case 4:if(!t.activeTabId){e.n=8;break}return e.p=5,e.n=6,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 6:e.n=8;break;case 7:e.p=7,o=e.v,t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error notifying content on cancel:",o);case 8:if(!t.originalTabId){e.n=12;break}return e.p=9,e.n=10,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 10:e.n=12;break;case 11:e.p=11,e.v;case 12:return e.p=12,e.n=13,chrome.runtime.sendMessage({action:t.MESSAGE_ACTIONS.PROOF_GENERATION_FAILED,data:{error:"Cancelled by user",sessionId:t.sessionId}});case 13:e.n=15;break;case 14:e.p=14,e.v;case 15:if(!t.originalTabId){e.n=16;break}try{setTimeout(c(i().m(function e(){return i().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){t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error closing tab on cancel:",e)}e.n=20;break;case 16:if(!t.activeTabId){e.n=20;break}return e.p=17,e.n=18,chrome.tabs.remove(t.activeTabId);case 18:t.activeTabId=null,e.n=20;break;case 19:e.p=19,s=e.v,t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error closing active tab on cancel:",s);case 20:t.proofGenerationQueue=[],t.isProcessingQueue=!1,t.providerData=null,t.parameters=null,t.httpProviderId=null,t.appId=null,t.sessionId=null,t.callbackUrl=null,t.managedTabs.clear(),t.activeSessionId=null,e.n=22;break;case 21:e.p=21,a=e.v,t.activeSessionId=null,t.debugLogger.error(t.DebugLogType.BACKGROUND,"[BACKGROUND] Error during cancelSession:",a);case 22:return e.a(2)}},e,null,[[17,19],[12,14],[9,11],[5,7],[1,3],[0,21]])}))).apply(this,arguments)}r.r(t),r.d(t,{cancelSession:()=>y,failSession:()=>f,startVerification:()=>u,submitProofs:()=>d})},526:(e,t)=>{"use strict";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},573:(e,t,r)=>{"use strict";r.d(t,{c:()=>n});var n=function(e,t){return{identifier:e.claim.identifier,claimData:e.claim,signatures:[o(e.signatures.claimSignature)],witnesses:[{id:e.signatures.attestorAddress,url:"wss://attestor.reclaimprotocol.org/ws"}],taskId:null,publicData:null,providerRequest:t}},o=function(e){if(!e)return"";var t=Object.values(e).map(function(e){return e.toString(16).padStart(2,"0")}).join("");return"0x".concat(t)}},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}},856:(e,t,r)=>{"use strict";r.d(t,{Ey:()=>S,D_:()=>o,w9:()=>I,Ow:()=>b});var n="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"};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){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,a(n.key),n)}}function a(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+""}var c=function(){function e(t){var r=t.sessionId,n=t.providerId,o=t.appId,i=t.logLine,s=t.type,a=t.time,c=void 0===a?null:a;!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.time=c||new Date}return t=e,n=[{key:"fromDateTimeToTimeStamp",value:function(e){return(1e6*e.getTime()).toString()}},{key:"fromError",value:function(t){var r=t.sessionId,n=t.providerId,o=t.appId,i=t.error,s=t.type,a=t.message,c=void 0===a?"":a,u=i.stack||"",l=i.message||i.toString();return new e({sessionId:r,providerId:n,appId:o,logLine:c?"".concat(c,": ").concat(l,"\n").concat(u):"".concat(l,"\n").concat(u),type:s,time:new Date})}}],(r=[{key:"toJson",value:function(){return{logLine:this.logLine,ts:e.fromDateTimeToTimeStamp(this.time),type:this.type,sessionId:this.sessionId,providerId:this.providerId,appId:this.appId}}}])&&s(t.prototype,r),n&&s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,n}();function u(e){return u="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},u(e)}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){return function(e){if(Array.isArray(e))return d(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 d(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)?d(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 d(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 p(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 y(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){p(i,n,o,s,a,"next",e)}function a(e){p(i,n,o,s,a,"throw",e)}s(void 0)})}}function g(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,m(n.key),n)}}function m(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=u(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u(t)?t:t+""}var b=new(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.logs=[],this.isSending=!1,this.maxBatchSize=20,this.flushInterval=5e3,this.flushIntervalId=null,this.startFlushInterval()},t=[{key:"startFlushInterval",value:function(){var e=this;this.flushIntervalId&&clearInterval(this.flushIntervalId),this.flushIntervalId=setInterval(function(){e.flush()},this.flushInterval)}},{key:"stopFlushInterval",value:function(){this.flushIntervalId&&(clearInterval(this.flushIntervalId),this.flushIntervalId=null)}},{key:"addLog",value:function(e){this.logs.push(e),this.logs.length>=this.maxBatchSize&&this.flush()}},{key:"log",value:function(e){var t=e.sessionId,r=e.providerId,n=e.appId,o=e.message,i=e.type,s=new c({sessionId:t,providerId:r,appId:n,logLine:o,type:i});this.addLog(s)}},{key:"logError",value:function(e){var t=e.sessionId,r=e.providerId,n=e.appId,o=e.error,i=e.type,s=e.message,a=c.fromError({sessionId:t,providerId:r,appId:n,error:o,type:i,message:s});this.addLog(a)}},{key:"flush",value:(s=y(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=h(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(h(this.logs),h(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 s.apply(this,arguments)})},{key:"getDeviceLoggingId",value:(i=y(l().m(function e(){var t;return l().w(function(e){for(;;)if(0===e.n)return t=crypto.randomUUID(),e.a(2,t)},e)})),function(){return i.apply(this,arguments)})},{key:"sendLogs",value:(o=y(l().m(function e(t){var r,o,i,s,a,c,u,f,h,d,p;return l().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,t&&0!==t.length){e.n=1;break}return e.a(2);case 1:return r=t.map(function(e){return e.toJson()}),s=JSON,a=r,e.n=2,this.getDeviceLoggingId();case 2:return c=e.v,u={logs:a,source:"reclaim-extension",deviceId:c},o=s.stringify.call(s,u),e.n=3,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:o});case 3:if((i=e.v).ok){e.n=5;break}return f=console,h="Failed to send ".concat(t.length," logs [").concat(new Blob([o]).size," B] (batch ").concat(t.length,")"),e.n=4,i.text();case 4:d=e.v,f.error.call(f,h,d);case 5:e.n=7;break;case 6:e.p=6,p=e.v,console.error("Failed to send logs (batch ".concat(t.length,")"),p);case 7:return e.a(2)}},e,this,[[0,6]])})),function(e){return o.apply(this,arguments)})}],t&&g(e.prototype,t),r&&g(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r,o,i,s}());function E(e){return E="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},E(e)}function v(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,w(n.key),n)}}function w(e){var t=function(e,t){if("object"!=E(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=E(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==E(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"}),I=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&&v(t.prototype,r),n&&v(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,n}()),O=r(606);void 0!==O&&O.env?I.disable():I.enable()},887:(e,t,r)=>{"use strict";function n(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",s=r.toStringTag||"@@toStringTag";function a(r,n,i,s){var a=n&&n.prototype instanceof u?n:u,l=Object.create(a.prototype);return o(l,"_invoke",function(r,n,o){var i,s,a,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,s=0,a=e,h.n=r,c}};function d(r,n){for(s=r,a=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(a=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(s=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,s=0))}if(o||r>1)return c;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),s=l,a=p;(t=s<2?e:a)||!f;){i||(s?s<3?(s>1&&(h.n=-1),d(s,a)):h.n=a:h.v=a);try{if(u=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,a)))throw TypeError("iterator result is not an object");if(!t.done)return t;a=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(f=h.n<0)?a:r.call(n,h))!==c)break}catch(t){i=e,s=1,a=t}finally{u=1}}return{value:t,done:f}}}(r,i,s),!0),l}var c={};function u(){}function l(){}function f(){}t=Object.getPrototypeOf;var h=[][i]?t(t([][i]())):(o(t={},i,function(){return this}),t),d=f.prototype=u.prototype=Object.create(h);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,o(e,s,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=f,o(d,"constructor",f),o(f,"constructor",l),l.displayName="GeneratorFunction",o(f,s,"GeneratorFunction"),o(d),o(d,s,"Generator"),o(d,i,function(){return this}),o(d,"toString",function(){return"[object Generator]"}),(n=function(){return{w:a,m:p}})()}function o(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}o=function(e,t,r,n){function s(t,r){o(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(s("next",0),s("throw",1),s("return",2))},o(e,t,r,n)}function i(e){return function(e){if(Array.isArray(e))return s(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 s(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)?s(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 s(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 a(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 c(e,t,r){return u.apply(this,arguments)}function u(){var e;return e=n().m(function e(t,r,o){var s,a,c,u,f,h,d,p,y,g,m,b,E,v,w,S,I,O,A;return n().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.warn(o.BACKGROUND,"[BACKGROUND] Chrome cookies API not available"),e.a(2,null);case 1:return s=new URL(t),a=s.hostname,c=[],e.n=2,chrome.cookies.getAll({domain:a});case 2:u=e.v,c.push.apply(c,i(u)),f=a.split("."),h=1;case 3:if(!(h<f.length)){e.n=8;break}return d="."+f.slice(h).join("."),e.p=4,e.n=5,chrome.cookies.getAll({domain:d});case 5:p=e.v,c.push.apply(c,i(p)),e.n=7;break;case 6:e.p=6,I=e.v,r.warn(o.BACKGROUND,"[BACKGROUND] Could not get cookies for parent domain ".concat(d,":"),I);case 7:h++,e.n=3;break;case 8:return e.p=8,e.n=9,chrome.cookies.getAll({url:t});case 9:y=e.v,c.push.apply(c,i(y)),e.n=11;break;case 10:e.p=10,O=e.v,r.warn(o.BACKGROUND,"[BACKGROUND] Could not get cookies by URL ".concat(t,":"),O);case 11:for(g=[],m=new Set,b=0,E=c;b<E.length;b++)v=E[b],w="".concat(v.name,"|").concat(v.domain,"|").concat(v.path),m.has(w)||l(v,s,r,o)&&(m.add(w),g.push(v));if(!(g.length>0)){e.n=12;break}return g.sort(function(e,t){return e.path.length!==t.path.length?t.path.length-e.path.length:(e.creationDate||0)-(t.creationDate||0)}),S=g.map(function(e){return"".concat(e.name,"=").concat(e.value)}).join("; "),e.a(2,S);case 12:return e.a(2,null);case 13:return e.p=13,A=e.v,r.error(o.BACKGROUND,"[BACKGROUND] Error getting cookies for URL:",A),e.a(2,null)}},e,null,[[8,10],[4,6],[0,13]])}),u=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){a(i,n,o,s,c,"next",e)}function c(e){a(i,n,o,s,c,"throw",e)}s(void 0)})},u.apply(this,arguments)}function l(e,t,r,n){try{var o=e.domain.startsWith(".")?e.domain.substring(1):e.domain,i=t.hostname;if(!(i===o||i.endsWith("."+o)||e.domain.startsWith(".")&&i.endsWith(e.domain.substring(1))))return!1;var s=e.path||"/";if(!t.pathname.startsWith(s))return!1;var a="https:"===t.protocol;return!(e.secure&&!a)&&!(e.expirationDate&&e.expirationDate<Date.now()/1e3)}catch(e){return r.warn(n.BACKGROUND,"[BACKGROUND] Error checking cookie inclusion:",e),!1}}r.d(t,{W:()=>c})},952:(e,t,r)=>{"use strict";r.d(t,{Sn:()=>o,fn:()=>n,wx:()=>c,J_:()=>a,vQ:()=>i,Ew:()=>s});var n="https://api.reclaimprotocol.org",o={PROVIDER_URL:function(e){return"".concat(n,"/api/providers/").concat(e)},SUBMIT_PROOF:function(e){return"".concat(n,"/session/").concat(e,"/proof")},UPDATE_SESSION_STATUS:function(){return"".concat(n,"/api/sdk/update/session/")},STATUS_URL:function(e){return"".concat(n,"/api/sdk/status/").concat(e)}},i={CHECK_EXTENSION:"RECLAIM_EXTENSION_CHECK",EXTENSION_RESPONSE:"RECLAIM_EXTENSION_RESPONSE",START_VERIFICATION:"RECLAIM_START_VERIFICATION",VERIFICATION_STARTED:"RECLAIM_VERIFICATION_STARTED",VERIFICATION_COMPLETED:"RECLAIM_VERIFICATION_COMPLETED",VERIFICATION_FAILED:"RECLAIM_VERIFICATION_FAILED",CANCEL_VERIFICATION:"RECLAIM_CANCEL_VERIFICATION"},s={SESSION_INIT:"SESSION_INIT",SESSION_STARTED:"SESSION_STARTED",USER_INIT_VERIFICATION:"USER_INIT_VERIFICATION",USER_STARTED_VERIFICATION:"USER_STARTED_VERIFICATION",PROOF_GENERATION_STARTED:"PROOF_GENERATION_STARTED",PROOF_GENERATION_SUCCESS:"PROOF_GENERATION_SUCCESS",PROOF_GENERATION_FAILED:"PROOF_GENERATION_FAILED",PROOF_SUBMITTED:"PROOF_SUBMITTED",PROOF_SUBMISSION_FAILED:"PROOF_SUBMISSION_FAILED",PROOF_MANUAL_VERIFICATION_SUBMITED:"PROOF_MANUAL_VERIFICATION_SUBMITED"},a={CONTENT_SCRIPT:"content-script",BACKGROUND:"background",OFFSCREEN:"offscreen"},c={START_VERIFICATION:"START_VERIFICATION",CANCEL_VERIFICATION:"CANCEL_VERIFICATION",GENERATE_PROOF_REQUEST:"GENERATE_PROOF_REQUEST",CLAIM_CREATION_REQUESTED:"CLAIM_CREATION_REQUESTED",CLAIM_CREATION_SUCCESS:"CLAIM_CREATION_SUCCESS",CLAIM_CREATION_FAILED:"CLAIM_CREATION_FAILED",PROOF_GENERATION_STARTED:"PROOF_GENERATION_STARTED",PROOF_GENERATION_SUCCESS:"PROOF_GENERATION_SUCCESS",PROOF_GENERATION_FAILED:"PROOF_GENERATION_FAILED",PROOF_SUBMITTED:"PROOF_SUBMITTED",PROOF_SUBMISSION_FAILED:"PROOF_SUBMISSION_FAILED",GENERATE_PROOF:"GENERATE_PROOF",GENERATED_PROOF_RESPONSE:"GENERATED_PROOF_RESPONSE",GENERATE_CLAIM_ON_ATTESTOR:"GENERATE_CLAIM_ON_ATTESTOR",GET_PRIVATE_KEY:"GET_PRIVATE_KEY",GET_PRIVATE_KEY_RESPONSE:"GET_PRIVATE_KEY_RESPONSE",SHOW_PROVIDER_VERIFICATION_POPUP:"SHOW_PROVIDER_VERIFICATION_POPUP",OFFSCREEN_DOCUMENT_READY:"OFFSCREEN_DOCUMENT_READY",GENERATE_PROOF_RESPONSE:"GENERATE_PROOF_RESPONSE",PING_OFFSCREEN:"PING_OFFSCREEN",CLOSE_CURRENT_TAB:"CLOSE_CURRENT_TAB",GET_CURRENT_TAB_ID:"GET_CURRENT_TAB_ID",REQUEST_PROVIDER_DATA:"REQUEST_PROVIDER_DATA",PROVIDER_DATA_READY:"PROVIDER_DATA_READY",CONTENT_SCRIPT_LOADED:"CONTENT_SCRIPT_LOADED",SHOULD_INITIALIZE:"SHOULD_INITIALIZE",CHECK_IF_MANAGED_TAB:"CHECK_IF_MANAGED_TAB",FILTERED_REQUEST_FOUND:"FILTERED_REQUEST_FOUND",INTERCEPTED_REQUEST:"INTERCEPTED_REQUEST",INTERCEPTED_RESPONSE:"INTERCEPTED_RESPONSE"}},997:(e,t,r)=>{"use strict";var n=r(287),o=r(606),i=r.n(o),s=r(856);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")(),y="undefined"==typeof window,g="undefined"!=typeof document&&void 0!==document.contentType;if(p.Buffer=p.Buffer||n.hp,p.process=p.process||i(),void 0!==p.WebSocket||g)g?s.w9.info(s.Ey.POLYFILLS,"Skipping WebSocket in content script context"):s.w9.info(s.Ey.POLYFILLS,"Using native WebSocket implementation");else try{var m=r(296).WebSocket;p.WebSocket=m,s.w9.info(s.Ey.POLYFILLS,"WebSocket polyfill added to global")}catch(e){s.w9.warn(s.Ey.POLYFILLS,"Failed to load WebSocket polyfill:",e)}if(p.process&&(p.process.browser=!0),"function"!=typeof p.require)p.require=function(e){switch(e){case"ws":if(g)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 b=p.require;p.require=function(e){if("ws"===e){if(g)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 b(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)})}),!y){var E=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;E.prototype=v.prototype;try{Object.getOwnPropertyNames(v).forEach(function(e){if("prototype"!==e&&"constructor"!==e)try{E[e]=v[e]}catch(e){}})}catch(e){s.w9.warn(s.Ey.POLYFILLS,"Could not copy all URL static properties:",e)}try{p.URL=E}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={};(()=>{"use strict";r.r(n),r.d(n,{ReclaimExtensionProofRequest:()=>Es,default:()=>Ss,reclaimExtensionSDK:()=>ws});var e={};r.r(e),r.d(e,{OG:()=>Ke,My:()=>ke,Ph:()=>Fe,lX:()=>Be,Id:()=>je,fg:()=>He,qj:()=>Me,aT:()=>xe,lq:()=>De,z:()=>Ge,Q5:()=>qe});r(997);var t=r(254),o=r(952);function i(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function s(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 a(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");i(e.outputLen),i(e.blockLen)}function c(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 u(e,t){s(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}const l=BigInt(2**32-1),f=BigInt(32);function h(e,t=!1){return t?{h:Number(e&l),l:Number(e>>f&l)}:{h:0|Number(e>>f&l),l:0|Number(e&l)}}function d(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}=h(e[o],t);[r[o],n[o]]=[i,s]}return[r,n]}const p=(e,t,r)=>e<<r|t>>>32-r,y=(e,t,r)=>t<<r|e>>>32-r,g=(e,t,r)=>t<<r-32|e>>>64-r,m=(e,t,r)=>e<<r-32|t>>>64-r;const b={fromBig:h,split:d,toBig:(e,t)=>BigInt(e>>>0)<<f|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:p,rotlSL:y,rotlBH:g,rotlBL:m,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)},E="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,v=e=>e instanceof Uint8Array,w=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),S=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 O=async()=>{};async function A(e,t,r){let n=Date.now();for(let o=0;o<e;o++){r(o);const e=Date.now()-n;e>=0&&e<t||(await O(),n+=e)}}function T(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)),!v(e))throw new Error("expected Uint8Array, got "+typeof e);return e}class R{clone(){return this._cloneInto()}}const P={}.toString;function N(e,t){if(void 0!==t&&"[object Object]"!==P.call(t))throw new Error("Options should be object or undefined");return Object.assign(e,t)}function C(e){const t=t=>e().update(T(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function _(e=32){if(E&&"function"==typeof E.getRandomValues)return E.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}const[L,k,U]=[[],[],[]],x=BigInt(0),F=BigInt(1),B=BigInt(2),D=BigInt(7),G=BigInt(256),M=BigInt(113);for(let e=0,t=F,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],L.push(2*(5*n+r)),k.push((e+1)*(e+2)/2%64);let o=x;for(let e=0;e<7;e++)t=(t<<F^(t>>D)*M)%G,t&B&&(o^=F<<(F<<BigInt(e))-F);U.push(o)}const[j,K]=d(U,!0),V=(e,t,r)=>r>32?g(e,t,r):p(e,t,r),$=(e,t,r)=>r>32?m(e,t,r):y(e,t,r);class H extends R{constructor(e,t,r,n=!1,o=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,i(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=w(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=V(i,s,1)^r[n],c=$(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=k[r],i=V(t,o,n),s=$(t,o,n),a=L[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]^=j[n],e[1]^=K[n]}r.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){c(this);const{blockLen:t,state:r}=this,n=(e=T(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){c(this,!1),s(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 i(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(u(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 H(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 z=(e,t,r)=>C(()=>new H(t,e,r)),q=z(1,136,32),W="6.15.0";function Y(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 J(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 Z(e,t,r){for(let n in t){let o=t[n];const i=r?r[n]:null;i&&Y(o,i,n),Object.defineProperty(e,n,{enumerable:!0,value:o,writable:!1})}}function Q(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=>Q(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 Q(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=>`${Q(r,t)}: ${Q(e[r],t)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function X(e,t,r){let n,o=e;{const n=[];if(r){if("message"in r||"code"in r||"name"in r)throw new Error(`value will overwrite populated values: ${Q(r)}`);for(const e in r){if("shortMessage"===e)continue;const t=r[e];n.push(e+"="+Q(t))}}n.push(`code=${t}`),n.push(`version=${W}`),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 Z(n,{code:t}),r&&Object.assign(n,r),null==n.shortMessage&&Z(n,{shortMessage:o}),n}function ee(e,t,r,n){if(!e)throw X(t,r,n)}function te(e,t,r,n){ee(e,t,"INVALID_ARGUMENT",{argument:r,value:n})}const re=["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 ne(e){ee(re.indexOf(e)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:e}})}function oe(e,t,r){if(null==r&&(r=""),e!==t){let e=r,t="new";r&&(e+=".",t+=" "+r),ee(!1,`private constructor; use ${e}from* methods`,"UNSUPPORTED_OPERATION",{operation:t})}}function ie(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}te(!1,"invalid BytesLike value",t||"value",e)}function se(e,t){return ie(e,t,!1)}function ae(e,t){return ie(e,t,!0)}function ce(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 ue(e){return ce(e,!0)||e instanceof Uint8Array}const le="0123456789abcdef";function fe(e){const t=se(e);let r="0x";for(let e=0;e<t.length;e++){const n=t[e];r+=le[(240&n)>>4]+le[15&n]}return r}function he(e){return"0x"+e.map(e=>fe(e).substring(2)).join("")}function de(e){return ce(e,!0)?(e.length-2)/2:se(e).length}function pe(e,t,r){const n=se(e);return null!=r&&r>n.length&&ee(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r}),fe(n.slice(null==t?0:t,null==r?n.length:r))}function ye(e,t,r){const n=se(e);ee(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),fe(o)}function ge(e,t){return ye(e,t,!0)}let me=!1;const be=function(e){return q(e)};let Ee=be;function ve(e){const t=se(e,"data");return fe(Ee(t))}ve._=be,ve.lock=function(){me=!0},ve.register=function(e){if(me)throw new TypeError("keccak256 is locked");Ee=e},Object.freeze(ve);class we 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=S(this.buffer)}update(e){c(this);const{view:t,buffer:r,blockLen:n}=this,o=(e=T(e)).length;for(let i=0;i<o;){const s=Math.min(n-this.pos,o-i);if(s===n){const t=S(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){c(this),u(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=S(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/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 Se=(e,t,r)=>e&t^~e&r,Ie=(e,t,r)=>e&t^e&r^t&r,Oe=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ae=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Te=new Uint32Array(64);class Re extends we{constructor(){super(64,32,8,!1),this.A=0|Ae[0],this.B=0|Ae[1],this.C=0|Ae[2],this.D=0|Ae[3],this.E=0|Ae[4],this.F=0|Ae[5],this.G=0|Ae[6],this.H=0|Ae[7]}get(){const{A:e,B:t,C:r,D:n,E:o,F:i,G:s,H:a}=this;return[e,t,r,n,o,i,s,a]}set(e,t,r,n,o,i,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)Te[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=Te[e-15],r=Te[e-2],n=I(t,7)^I(t,18)^t>>>3,o=I(r,17)^I(r,19)^r>>>10;Te[e]=o+Te[e-7]+n+Te[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))+Se(s,a,c)+Oe[e]+Te[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(){Te.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Pe=C(()=>new Re),Ne=(BigInt(0),BigInt(1)),Ce=BigInt(2),_e=e=>e instanceof Uint8Array,Le=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ke(e){if(!_e(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=Le[e[r]];return t}function Ue(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}function xe(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 Fe(e){return Ue(ke(e))}function Be(e){if(!_e(e))throw new Error("Uint8Array expected");return Ue(ke(Uint8Array.from(e).reverse()))}function De(e,t){return xe(e.toString(16).padStart(2*t,"0"))}function Ge(e,t){return De(e,t).reverse()}function Me(e,t,r){let n;if("string"==typeof t)try{n=xe(t)}catch(r){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${r}`)}else{if(!_e(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 je(...e){const t=new Uint8Array(e.reduce((e,t)=>e+t.length,0));let r=0;return e.forEach(e=>{if(!_e(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length}),t}const Ke=e=>(Ce<<BigInt(e-1))-Ne,Ve=e=>new Uint8Array(e),$e=e=>Uint8Array.from(e);function He(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=Ve(e),o=Ve(e),i=0;const s=()=>{n.fill(1),o.fill(0),i=0},a=(...e)=>r(o,n,...e),c=(e=Ve())=>{o=a($e([0]),e),n=a(),0!==e.length&&(o=a($e([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 je(...r)};return(e,t)=>{let r;for(s(),c(e);!(r=t(u()));)c();return s(),r}}const ze={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 qe(e,t,r={}){const n=(t,r,n)=>{const o=ze[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}
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
const We=BigInt(0),Ye=BigInt(1),Je=BigInt(2),Ze=BigInt(3),Qe=BigInt(4),Xe=BigInt(5),et=BigInt(8);BigInt(9),BigInt(16);function tt(e,t){const r=e%t;return r>=We?r:t+r}function rt(e,t,r){if(r<=We||t<We)throw new Error("Expected power/modulo > 0");if(r===Ye)return We;let n=Ye;for(;t>We;)t&Ye&&(n=n*e%r),e=e*e%r,t>>=Ye;return n}function nt(e,t,r){let n=e;for(;t-- >We;)n*=n,n%=r;return n}function ot(e,t){if(e===We||t<=We)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=tt(e,t),n=t,o=We,i=Ye,s=Ye,a=We;for(;r!==We;){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!==Ye)throw new Error("invert: does not exist");return tt(o,t)}function it(e){if(e%Qe===Ze){const t=(e+Ye)/Qe;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%et===Xe){const t=(e-Xe)/et;return function(e,r){const n=e.mul(r,Je),o=e.pow(n,t),i=e.mul(r,o),s=e.mul(e.mul(i,Je),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-Ye)/Je;let r,n,o;for(r=e-Ye,n=0;r%Je===We;r/=Je,n++);for(o=Je;o<e&&rt(o,t,e)!==e-Ye;o++);if(1===n){const t=(e+Ye)/Qe;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+Ye)/Je;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,Ye<<BigInt(a-t-1));c=e.sqr(r),u=e.mul(u,r),l=e.mul(l,c),a=t}return u}}(e)}const st=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function at(e,t){const r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function ct(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 ut(e){const t=ct(e);return t+Math.ceil(t/2)}class lt extends R{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,a(e);const r=T(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 c(this),this.iHash.update(e),this}digestInto(e){c(this),s(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 ft=(e,t,r)=>new lt(e,t).update(r).digest();ft.create=(e,t)=>new lt(e,t);
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
const ht=BigInt(0),dt=BigInt(1);function pt(e){return qe(e.Fp,st.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),qe(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...at(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}const{Ph:yt,aT:gt}=e,mt={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:t}=mt;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:yt(n),l:e.subarray(r+2)}},toSig(e){const{Err:t}=mt,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}=mt._parseInt(r.subarray(2)),{d:s,l:a}=mt._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}`}},bt=BigInt(0),Et=BigInt(1),vt=(BigInt(2),BigInt(3));BigInt(4);function wt(e){const t=
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
function(e){const t=pt(e);qe(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 je(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&&bt<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=ke(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:Fe(Me("private key",e,n))}catch(t){throw new Error(`private key must be ${n} bytes, hex or bigint, not ${typeof e}`)}return o&&(s=tt(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(Me("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,vt),{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),y=r.mul(i,s);return y=r.add(y,y),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(y,c),l=r.mul(o,l),p=r.mul(e,p),y=r.sub(h,p),y=r.mul(e,y),y=r.add(y,l),l=r.add(h,h),h=r.add(l,h),h=r.add(h,p),h=r.mul(h,y),u=r.add(u,h),p=r.mul(s,a),p=r.add(p,p),h=r.mul(p,y),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,y=r.mul(t.b,vt);let g=r.mul(n,s),m=r.mul(o,a),b=r.mul(i,c),E=r.add(n,o),v=r.add(s,a);E=r.mul(E,v),v=r.add(g,m),E=r.sub(E,v),v=r.add(n,i);let w=r.add(s,c);return v=r.mul(v,w),w=r.add(g,b),v=r.sub(v,w),w=r.add(o,i),u=r.add(a,c),w=r.mul(w,u),u=r.add(m,b),w=r.sub(w,u),d=r.mul(p,v),u=r.mul(y,b),d=r.add(u,d),u=r.sub(m,d),d=r.add(m,d),h=r.mul(u,d),m=r.add(g,g),m=r.add(m,g),b=r.mul(p,b),v=r.mul(y,v),m=r.add(m,b),b=r.sub(g,b),b=r.mul(p,b),v=r.add(v,b),g=r.mul(m,v),h=r.add(h,g),g=r.mul(w,v),u=r.mul(E,u),u=r.sub(u,g),g=r.mul(E,m),d=r.mul(w,d),d=r.add(d,g),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===bt)return n;if(a(e),e===Et)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>bt||u>bt;)s&Et&&(l=l.add(p)),u&Et&&(h=h.add(p)),p=p.double(),s>>=Et,u>>=Et;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!==bt&&t!==Et&&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===Et)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===Et?this:r?r(f,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return this.assertValidity(),n(f,this,e)}toHex(e=!0){return ke(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>ht;)r&dt&&(n=n.add(o)),o=o.double(),r>>=dt;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+=dt);const s=t,d=t+Math.abs(n)-1,p=e%2!=0,y=n<0;0===n?u=u.add(r(p,o[s])):c=c.add(r(y,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 St(e){const t=function(e){const t=pt(e);return qe(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 tt(e,n)}function a(e){return ot(e,n)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:f}=wt({...t,toBytes(e,t,n){const o=t.toAffine(),i=r.toBytes(o.x),s=je;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=Fe(s);if(!(bt<(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&Et)===Et)&&(o=r.neg(o)),{x:e,y:o}}var a}}),h=e=>ke(De(e,t.nByteLength));function d(e){return e>n>>Et}const p=(e,t,r)=>Fe(e.slice(t,r));class y{constructor(e,t,r){this.r=e,this.s=t,this.recovery=r,this.assertValidity()}static fromCompact(e){const r=t.nByteLength;return e=Me("compactSignature",e,2*r),new y(p(e,0,r),p(e,r,2*r))}static fromDER(e){const{r:t,s:r}=mt.toSig(Me("DER",e));return new y(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 y(this.r,this.s,e)}recoverPublicKey(e){const{r:n,s:o,recovery:i}=this,u=E(Me("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),y=s(-u*p),g=s(o*p),m=c.BASE.multiplyAndAddUnsafe(d,y,g);if(!m)throw new Error("point at infinify");return m.assertValidity(),m}hasHighS(){return d(this.s)}normalizeS(){return this.hasHighS()?new y(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return xe(this.toDERHex())}toDERHex(){return mt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return xe(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const g={isValidPrivateKey(e){try{return u(e),!0}catch(e){return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const e=ut(t.n);return function(e,t,r=!1){const n=e.length,o=ct(t),i=ut(t);if(n<16||n<i||n>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);const s=tt(r?Fe(e):Be(e),t-Ye)+Ye;return r?Ge(s,o):De(s,o)}(t.randomBytes(e),t.n)},precompute:(e=8,t=c.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function m(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 b=t.bits2int||function(e){const r=Fe(e),n=8*e.length-t.nBitLength;return n>0?r>>BigInt(n):r},E=t.bits2int_modN||function(e){return s(b(e))},v=Ke(t.nBitLength);function w(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(bt<=e&&e<v))throw new Error(`bigint expected < 2^${t.nBitLength}`);return De(e,t.nByteLength)}function S(e,n,o=I){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:g}=o;null==h&&(h=!0),e=Me("msgHash",e),p&&(e=Me("prehashed msgHash",i(e)));const m=E(e),v=u(n),S=[w(v),w(m)];if(null!=g){const e=!0===g?l(r.BYTES):g;S.push(Me("extraEntropy",e))}const O=je(...S),A=m;return{seed:O,k2sig:function(e){const t=b(e);if(!f(t))return;const r=a(t),n=c.BASE.multiply(t).toAffine(),o=s(n.x);if(o===bt)return;const i=s(r*s(A+o*v));if(i===bt)return;let u=(n.x===o?0:2)|Number(n.y&Et),l=i;return h&&d(i)&&(l=function(e){return d(e)?s(-e):e}(i),u^=1),new y(o,l,u)}}}const I={lowS:t.lowS,prehash:!1},O={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(m(e))throw new Error("first arg must be private key");if(!m(t))throw new Error("second arg must be public key");return c.fromHex(t).multiply(u(e)).toRawBytes(r)},sign:function(e,r,n=I){const{seed:o,k2sig:i}=S(e,r,n),s=t;return He(s.hash.outputLen,s.nByteLength,s.hmac)(o,i)},verify:function(e,r,n,o=O){const i=e;if(r=Me("msgHash",r),n=Me("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=y.fromDER(i)}catch(e){if(!(e instanceof mt.Err))throw e;f=y.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 y(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,g=E(r),m=a(p),b=s(g*m),v=s(d*m),w=c.BASE.multiplyAndAddUnsafe(h,b,v)?.toAffine();return!!w&&s(w.x)===d},ProjectivePoint:c,Signature:y,utils:g}}
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
function It(e){return{hash:e,hmac:(t,...r)=>ft(e,t,function(...e){const t=new Uint8Array(e.reduce((e,t)=>e+t.length,0));let r=0;return e.forEach(e=>{if(!v(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length}),t}(...r)),randomBytes:_}}
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
const Ot=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),At=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Tt=BigInt(1),Rt=BigInt(2),Pt=(e,t)=>(e+t/Rt)/t;function Nt(e){const t=Ot,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=nt(l,r,t)*l%t,h=nt(f,r,t)*l%t,d=nt(h,Rt,t)*u%t,p=nt(d,o,t)*d%t,y=nt(p,i,t)*p%t,g=nt(y,a,t)*y%t,m=nt(g,c,t)*g%t,b=nt(m,a,t)*y%t,E=nt(b,r,t)*l%t,v=nt(E,s,t)*p%t,w=nt(v,n,t)*u%t,S=nt(w,Rt,t);if(!Ct.eql(Ct.sqr(S),e))throw new Error("Cannot find square root");return S}const Ct=function(e,t,r=!1,n={}){if(e<=We)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:o,nByteLength:i}=at(e,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=it(e),a=Object.freeze({ORDER:e,BITS:o,BYTES:i,MASK:Ke(o),ZERO:We,ONE:Ye,create:t=>tt(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return We<=t&&t<e},is0:e=>e===We,isOdd:e=>(e&Ye)===Ye,neg:t=>tt(-t,e),eql:(e,t)=>e===t,sqr:t=>tt(t*t,e),add:(t,r)=>tt(t+r,e),sub:(t,r)=>tt(t-r,e),mul:(t,r)=>tt(t*r,e),pow:(e,t)=>function(e,t,r){if(r<We)throw new Error("Expected power > 0");if(r===We)return e.ONE;if(r===Ye)return t;let n=e.ONE,o=t;for(;r>We;)r&Ye&&(n=e.mul(n,o)),o=e.sqr(o),r>>=Ye;return n}(a,e,t),div:(t,r)=>tt(t*ot(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>ot(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?Ge(e,i):De(e,i),fromBytes:e=>{if(e.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${e.length}`);return r?Be(e):Fe(e)}});return Object.freeze(a)}(Ot,void 0,void 0,{sqrt:Nt}),_t=function(e,t){const r=t=>St({...e,...It(t)});return Object.freeze({...r(t),create:r})}({a:BigInt(0),b:BigInt(7),Fp:Ct,n:At,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=At,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Tt*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=r,s=BigInt("0x100000000000000000000000000000000"),a=Pt(i*e,t),c=Pt(-n*e,t);let u=tt(e-a*r-c*o,t),l=tt(-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}}}},Pe);BigInt(0);_t.ProjectivePoint;const Lt=BigInt(0),kt=BigInt(1),Ut=9007199254740991;function xt(e,t){switch(typeof e){case"bigint":return e;case"number":return te(Number.isInteger(e),"underflow",t||"value",e),te(e>=-Ut&&e<=Ut,"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){te(!1,`invalid BigNumberish string: ${r.message}`,t||"value",e)}}te(!1,"invalid BigNumberish value",t||"value",e)}function Ft(e,t){const r=xt(e,t);return ee(r>=Lt,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:e}),r}const Bt="0123456789abcdef";function Dt(e){if(e instanceof Uint8Array){let t="0x0";for(const r of e)t+=Bt[r>>4],t+=Bt[15&r];return BigInt(t)}return xt(e)}function Gt(e,t){switch(typeof e){case"bigint":return te(e>=-Ut&&e<=Ut,"overflow",t||"value",e),Number(e);case"number":return te(Number.isInteger(e),"underflow",t||"value",e),te(e>=-Ut&&e<=Ut,"overflow",t||"value",e),e;case"string":try{if(""===e)throw new Error("empty string");return Gt(BigInt(e),t)}catch(r){te(!1,`invalid numeric string: ${r.message}`,t||"value",e)}}te(!1,"invalid numeric value",t||"value",e)}function Mt(e,t){let r=Ft(e,"value").toString(16);if(null==t)r.length%2&&(r="0"+r);else{const n=Gt(t,"width");for(ee(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 jt(e){const t=Ft(e,"value");if(t===Lt)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 Kt="0x0000000000000000000000000000000000000000000000000000000000000000",Vt=BigInt(0),$t=BigInt(1),Ht=BigInt(2),zt=BigInt(27),qt=BigInt(28),Wt=BigInt(35),Yt={};function Jt(e){return ge(jt(e),32)}class Zt{#e;#t;#r;#n;get r(){return this.#e}set r(e){te(32===de(e),"invalid r","value",e),this.#e=fe(e)}get s(){return te(parseInt(this.#t.substring(0,3))<8,"non-canonical s; use ._s","s",this.#t),this.#t}set s(e){te(32===de(e),"invalid s","value",e),this.#t=fe(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=Gt(e,"value");te(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:Zt.getChainId(e)}get yParity(){return 27===this.v?0:1}get yParityAndS(){const e=se(this.s);return this.yParity&&(e[0]|=128),fe(e)}get compactSerialized(){return he([this.r,this.yParityAndS])}get serialized(){return he([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(e,t,r,n){oe(e,Yt,"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 Zt(Yt,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=xt(e,"v");return t==zt||t==qt?Vt:(te(t>=Wt,"invalid EIP-155 v","v",e),(t-Wt)/Ht)}static getChainIdV(e,t){return xt(e)*Ht+BigInt(35+t-27)}static getNormalizedV(e){const t=xt(e);return t===Vt||t===zt?27:t===$t||t===qt?28:(te(t>=Wt,"invalid v","v",e),t&$t?27:28)}static from(e){function t(t,r){te(t,r,"signature",e)}if(null==e)return new Zt(Yt,Kt,Kt,27);if("string"==typeof e){const r=se(e,"signature");if(64===r.length){const e=fe(r.slice(0,32)),t=r.slice(32,64),n=128&t[0]?28:27;return t[0]&=127,new Zt(Yt,e,fe(t),n)}if(65===r.length){const e=fe(r.slice(0,32)),t=fe(r.slice(32,64)),n=Zt.getNormalizedV(r[64]);return new Zt(Yt,e,t,n)}t(!1,"invalid raw signature length")}if(e instanceof Zt)return e.clone();const r=e.r;t(null!=r,"missing r");const n=Jt(r),o=function(e,r){if(null!=e)return Jt(e);if(null!=r){t(ce(r,32),"invalid yParityAndS");const e=se(r);return e[0]&=127,fe(e)}t(!1,"missing s")}(e.s,e.yParityAndS),{networkV:i,v:s}=function(e,r,n){if(null!=e){const t=xt(e);return{networkV:t>=Wt?t:void 0,v:Zt.getNormalizedV(t)}}if(null!=r)return t(ce(r,32),"invalid yParityAndS"),{v:128&se(r)[0]?28:27};if(null!=n){switch(Gt(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 Zt(Yt,n,o,s);return i&&(a.#n=i),t(null==e.yParity||Gt(e.yParity,"sig.yParity")===a.yParity,"yParity mismatch"),t(null==e.yParityAndS||e.yParityAndS===a.yParityAndS,"yParityAndS mismatch"),a}}class Qt{#o;constructor(e){te(32===de(e),"invalid private key","privateKey","[REDACTED]"),this.#o=fe(e)}get privateKey(){return this.#o}get publicKey(){return Qt.computePublicKey(this.#o)}get compressedPublicKey(){return Qt.computePublicKey(this.#o,!0)}sign(e){te(32===de(e),"invalid digest length","digest",e);const t=_t.sign(ae(e),ae(this.#o),{lowS:!0});return Zt.from({r:Mt(t.r,32),s:Mt(t.s,32),v:t.recovery?28:27})}computeSharedSecret(e){const t=Qt.computePublicKey(e);return fe(_t.getSharedSecret(ae(this.#o),se(t),!1))}static computePublicKey(e,t){let r=se(e,"key");if(32===r.length){return fe(_t.getPublicKey(r,!!t))}if(64===r.length){const e=new Uint8Array(65);e[0]=4,e.set(r,1),r=e}return fe(_t.ProjectivePoint.fromHex(r).toRawBytes(t))}static recoverPublicKey(e,t){te(32===de(e),"invalid digest length","digest",e);const r=Zt.from(t);let n=_t.Signature.fromCompact(ae(he([r.r,r.s])));n=n.addRecoveryBit(r.yParity);const o=n.recoverPublicKey(ae(e));return te(null!=o,"invalid signature for digest","signature",t),"0x"+o.toHex(!1)}static addPoints(e,t,r){const n=_t.ProjectivePoint.fromHex(Qt.computePublicKey(e).substring(2)),o=_t.ProjectivePoint.fromHex(Qt.computePublicKey(t).substring(2));return"0x"+n.add(o).toHex(!!r)}}const Xt=BigInt(0),er=BigInt(36);function tr(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=se(ve(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 rr={};for(let e=0;e<10;e++)rr[String(e)]=String(e);for(let e=0;e<26;e++)rr[String.fromCharCode(65+e)]=String(10+e);function nr(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map(e=>rr[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 or=function(){const e={};for(let t=0;t<36;t++){e["0123456789abcdefghijklmnopqrstuvwxyz"[t]]=BigInt(t)}return e}();function ir(e){if(te("string"==typeof e,"invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/)){e.startsWith("0x")||(e="0x"+e);const t=tr(e);return te(!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}$/)){te(e.substring(2,4)===nr(e),"bad icap checksum","address",e);let t=function(e){e=e.toLowerCase();let t=Xt;for(let r=0;r<e.length;r++)t=t*er+or[e[r]];return t}(e.substring(4)).toString(16);for(;t.length<40;)t="0"+t;return tr("0x"+t)}te(!1,"invalid address","address",e)}async function sr(e,t){const r=await t;return null!=r&&"0x0000000000000000000000000000000000000000"!==r||(ee("string"!=typeof e,"unconfigured name","UNCONFIGURED_NAME",{value:e}),te(!1,"invalid AddressLike value; did not resolve to a value address","target",e)),ir(r)}function ar(e,t){return"string"==typeof e?e.match(/^0x[0-9a-f]{40}$/i)?ir(e):(ee(null!=t,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),sr(e,t.resolveName(e))):(r=e)&&"function"==typeof r.getAddress?sr(e,e.getAddress()):e&&"function"==typeof e.then?sr(e,e):void te(!1,"unsupported addressable value","target",e);var r}function cr(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){te(!1,`invalid codepoint at offset ${t}; ${e}`,"bytes",r)},ignore:cr,replace:function(e,t,r,n,o){return"OVERLONG"===e?(te("number"==typeof o,"invalid bad code point for replacement","badCodepoint",o),n.push(o),0):(n.push(65533),cr(e,t,r))}});function ur(e,t){te("string"==typeof e,"invalid string value","str",e),null!=t&&(ne(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);te(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 lr(e){return"string"==typeof e&&(e=ur(e)),ve(he([ur("Ethereum Signed Message:\n"),ur(String(e.length)),e]))}function fr(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function hr(e){if(Array.isArray(e)){let t=[];if(e.forEach(function(e){t=t.concat(hr(e))}),t.length<=55)return t.unshift(192+t.length),t;const r=fr(t.length);return r.unshift(247+r.length),r.concat(t)}const t=Array.prototype.slice.call(se(e,"object"));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const r=fr(t.length);return r.unshift(183+r.length),r.concat(t)}const dr="0123456789abcdef";function pr(e){let t="0x";for(const r of hr(e))t+=dr[r>>4],t+=dr[15&r];return t}function yr(e){return te("string"==typeof e.address,"invalid address for hashAuthorization","auth.address",e),ve(he(["0x05",pr([null!=e.chainId?jt(e.chainId):"0x",ir(e.address),null!=e.nonce?jt(e.nonce):"0x"])]))}function gr(e){return ve(ur(e))}const mr=new Uint8Array(32);mr.fill(0);const br=BigInt(-1),Er=BigInt(0),vr=BigInt(1),wr=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Sr=Mt(vr,32),Ir=Mt(Er,32),Or={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Ar=["name","version","chainId","verifyingContract","salt"];function Tr(e){return function(t){return te("string"==typeof t,`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const Rr={name:Tr("name"),version:Tr("version"),chainId:function(e){const t=xt(e,"domain.chainId");return te(t>=0,"invalid chain ID","domain.chainId",e),Number.isSafeInteger(t)?Number(t):function(e){let t=fe(ue(e)?e:jt(e)).substring(2);for(;t.startsWith("0");)t=t.substring(1);return""===t&&(t="0"),"0x"+t}(t)},verifyingContract:function(e){try{return ir(e).toLowerCase()}catch(e){}te(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){const t=se(e,"domain.salt");return te(32===t.length,'invalid domain value "salt"',"domain.salt",e),fe(t)}};function Pr(e){{const t=e.match(/^(u?)int(\d+)$/);if(t){const r=""===t[1],n=parseInt(t[2]);te(n%8==0&&0!==n&&n<=256&&t[2]===String(n),"invalid numeric width","type",e);const o=function(e,t){const r=Ft(e,"value"),n=BigInt(Gt(t,"bits"));return r&(kt<<n)-kt}(wr,r?n-1:n),i=r?(o+vr)*br:Er;return function(t){const n=xt(t,"value");return te(n>=i&&n<=o,`value out-of-bounds for ${e}`,"value",n),Mt(r?function(e,t){let r=xt(e,"value");const n=BigInt(Gt(t,"width")),o=kt<<n-kt;if(r<Lt)return r=-r,ee(r<=o,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:e}),(~r&(kt<<n)-kt)+kt;return ee(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 te(0!==r&&r<=32&&t[1]===String(r),"invalid bytes width","type",e),function(t){return te(se(t).length===r,`invalid length for ${e}`,"value",t),function(e){const t=se(e),r=t.length%32;return r?he([t,mr.slice(r)]):fe(t)}(t)}}}switch(e){case"address":return function(e){return ge(ir(e),32)};case"bool":return function(e){return e?Sr:Ir};case"bytes":return function(e){return ve(e)};case"string":return function(e){return gr(e)}}return null}function Nr(e,t){return`${e}(${t.map(({name:e,type:t})=>t+" "+e).join(",")})`}function Cr(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 _r{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}=Cr(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]){te(!i.has(s.name),`duplicate variable name ${JSON.stringify(s.name)} in ${JSON.stringify(n)}`,"types",e),i.add(s.name);const o=Cr(s.type).base;te(o!==n,`circular type reference to ${JSON.stringify(o)}`,"types",e);Pr(o)||(te(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);te(0!==i.length,"missing primary type","types",e),te(1===i.length,`ambiguous primary types or unused types: ${i.map(e=>JSON.stringify(e)).join(", ")}`,"types",e),Z(this,{primaryType:i[0]}),function o(i,s){te(!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,Nr(e,o[e])+r.map(e=>Nr(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=Pr(e);if(t)return t}const t=Cr(e).array;if(t){const e=t.prefix,r=this.getEncoder(e);return n=>{te(-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(ve)),ve(he(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)?ve(n):n});return n.unshift(t),he(n)}}te(!1,`unknown type: ${e}`,"type",e)}encodeType(e){const t=this.#s.get(e);return te(t,`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return ve(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(Pr(e))return r(e,t);const n=Cr(e).array;if(n)return te(-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),{});te(!1,`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new _r(e)}static getPrimaryType(e){return _r.from(e).primaryType}static hashStruct(e,t,r){return _r.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){if(null==e[r])continue;const n=Or[r];te(n,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:n})}return t.sort((e,t)=>Ar.indexOf(e.name)-Ar.indexOf(t.name)),_r.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return he(["0x1901",_r.hashDomain(e),_r.from(t).hash(r)])}static hash(e,t,r){return ve(_r.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&&!ce(e.verifyingContract,20)&&(o[e.verifyingContract]="0x");const i=_r.from(t);i.visit(r,(e,t)=>("address"!==e||ce(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){_r.hashDomain(e);const n={},o=[];Ar.forEach(t=>{const r=e[t];null!=r&&(n[t]=Rr[t](r),o.push({name:t,type:Or[t]}))});const i=_r.from(t);t=i.types;const s=Object.assign({},t);return te(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 fe(se(t));if(e.match(/^u?int/))return xt(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return te("string"==typeof t,"invalid string","value",t),t}te(!1,"unsupported type","type",e)})}}}const Lr="0x0000000000000000000000000000000000000000";function kr(e,t,r,n){a(e);const o=N({dkLen:32,asyncTick:10},n),{c:s,dkLen:c,asyncTick:u}=o;if(i(s),i(c),i(u),s<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const l=T(t),f=T(r),h=new Uint8Array(c),d=ft.create(e,l),p=d._cloneInto().update(f);return{c:s,dkLen:c,asyncTick:u,DK:h,PRF:d,PRFSalt:p}}function Ur(e,t,r,n,o){return e.destroy(),t.destroy(),n&&n.destroy(),o.fill(0),r}function xr(e,t,r,n){const{c:o,dkLen:i,DK:s,PRF:a,PRFSalt:c}=kr(e,t,r,n);let u;const l=new Uint8Array(4),f=S(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 Ur(a,c,s,u,h)}const[Fr,Br]=(()=>b.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))))(),Dr=new Uint32Array(80),Gr=new Uint32Array(80);class Mr extends we{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:y}=this;return[e,t,r,n,o,i,s,a,c,u,l,f,h,d,p,y]}set(e,t,r,n,o,i,s,a,c,u,l,f,h,d,p,y){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|y}process(e,t){for(let r=0;r<16;r++,t+=4)Dr[r]=e.getUint32(t),Gr[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|Dr[e-15],r=0|Gr[e-15],n=b.rotrSH(t,r,1)^b.rotrSH(t,r,8)^b.shrSH(t,r,7),o=b.rotrSL(t,r,1)^b.rotrSL(t,r,8)^b.shrSL(t,r,7),i=0|Dr[e-2],s=0|Gr[e-2],a=b.rotrSH(i,s,19)^b.rotrBH(i,s,61)^b.shrSH(i,s,6),c=b.rotrSL(i,s,19)^b.rotrBL(i,s,61)^b.shrSL(i,s,6),u=b.add4L(o,c,Gr[e-7],Gr[e-16]),l=b.add4H(u,n,a,Dr[e-7],Dr[e-16]);Dr[e]=0|l,Gr[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:y,Hh:g,Hl:m}=this;for(let e=0;e<80;e++){const t=b.rotrSH(l,f,14)^b.rotrSH(l,f,18)^b.rotrBH(l,f,41),E=b.rotrSL(l,f,14)^b.rotrSL(l,f,18)^b.rotrBL(l,f,41),v=l&h^~l&p,w=f&d^~f&y,S=b.add5L(m,E,w,Br[e],Gr[e]),I=b.add5H(S,g,t,v,Fr[e],Dr[e]),O=0|S,A=b.rotrSH(r,n,28)^b.rotrBH(r,n,34)^b.rotrBH(r,n,39),T=b.rotrSL(r,n,28)^b.rotrBL(r,n,34)^b.rotrBL(r,n,39),R=r&o^r&s^o&s,P=n&i^n&a^i&a;g=0|p,m=0|y,p=0|h,y=0|d,h=0|l,d=0|f,({h:l,l:f}=b.add(0|c,0|u,0|I,0|O)),c=0|s,u=0|a,s=0|o,a=0|i,o=0|r,i=0|n;const N=b.add3L(O,T,P);r=b.add3H(N,I,A,R),n=0|N}({h:r,l:n}=b.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:o,l:i}=b.add(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:a}=b.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=b.add(0|this.Dh,0|this.Dl,0|c,0|u)),({h:l,l:f}=b.add(0|this.Eh,0|this.El,0|l,0|f)),({h,l:d}=b.add(0|this.Fh,0|this.Fl,0|h,0|d)),({h:p,l:y}=b.add(0|this.Gh,0|this.Gl,0|p,0|y)),({h:g,l:m}=b.add(0|this.Hh,0|this.Hl,0|g,0|m)),this.set(r,n,o,i,s,a,c,u,l,f,h,d,p,y,g,m)}roundClean(){Dr.fill(0),Gr.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 jr=C(()=>new Mr);const Kr=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")}(),Vr=Kr.crypto||Kr.msCrypto;function $r(e){switch(e){case"sha256":return Pe.create();case"sha512":return jr.create()}te(!1,"invalid hashing algorithm name","algorithm",e)}const Hr=function(e){return $r("sha256").update(e).digest()},zr=function(e){return $r("sha512").update(e).digest()};let qr=Hr,Wr=zr,Yr=!1,Jr=!1;function Zr(e){const t=se(e,"data");return fe(qr(t))}function Qr(e){const t=se(e,"data");return fe(Wr(t))}function Xr(e){let t=e.toString(16);for(;t.length<2;)t="0"+t;return"0x"+t}function en(e,t,r){let n=0;for(let o=0;o<r;o++)n=256*n+e[t+o];return n}function tn(e,t,r,n){const o=[];for(;r<t+1+n;){const i=rn(e,r);o.push(i.result),ee((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 rn(e,t){ee(0!==e.length,"data too short","BUFFER_OVERRUN",{buffer:e,length:0,offset:1});const r=t=>{ee(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=en(e,t+1,n);return r(t+1+n+o),tn(e,t,t+1+n,n+o)}if(e[t]>=192){const n=e[t]-192;return r(t+1+n),tn(e,t,t+1,n)}if(e[t]>=184){const n=e[t]-183;r(t+1+n);const o=en(e,t+1,n);r(t+1+n+o);return{consumed:1+n+o,result:fe(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:fe(e.slice(t+1,t+1+n))}}return{consumed:1,result:Xr(e[t])}}function nn(e){const t=se(e,"data"),r=rn(t,0);return te(r.consumed===t.length,"unexpected junk after rlp payload","data",e),r.result}function on(e,t){return{address:ir(e),storageKeys:t.map((e,t)=>(te(ce(e,32),"invalid slot",`storageKeys[${t}]`,e),e.toLowerCase()))}}function sn(e){if(Array.isArray(e))return e.map((t,r)=>Array.isArray(t)?(te(2===t.length,"invalid slot set",`value[${r}]`,t),on(t[0],t[1])):(te(null!=t&&"object"==typeof t,"invalid address-slot set","value",e),on(t.address,t.storageKeys)));te(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 on(t,Object.keys(r).sort())});return t.sort((e,t)=>e.address.localeCompare(t.address)),t}function an(e){let t;return t="string"==typeof e?Qt.computePublicKey(e,!1):e.publicKey,ir(ve("0x"+t.substring(4)).substring(26))}Zr._=Hr,Zr.lock=function(){Yr=!0},Zr.register=function(e){if(Yr)throw new Error("sha256 is locked");qr=e},Object.freeze(Zr),Qr._=zr,Qr.lock=function(){Jr=!0},Qr.register=function(e){if(Jr)throw new Error("sha512 is locked");Wr=e},Object.freeze(Zr);const cn=BigInt(0),un=BigInt(2),ln=BigInt(27),fn=BigInt(28),hn=BigInt(35),dn=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),pn=131072;function yn(e,t){let r=e.toString(16);for(;r.length<2;)r="0"+r;return r+=Zr(t).substring(4),"0x"+r}function gn(e){return"0x"===e?null:ir(e)}function mn(e,t){try{return sn(e)}catch(r){te(!1,r.message,t,e)}}function bn(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:vn(n[2],"nonce"),chainId:vn(n[0],"chainId"),signature:Zt.from({yParity:En(n[3],"yParity"),r:ge(n[4],32),s:ge(n[5],32)})})}return t}catch(r){te(!1,r.message,t,e)}}function En(e,t){return"0x"===e?0:Gt(e,t)}function vn(e,t){if("0x"===e)return cn;const r=xt(e,t);return te(r<=dn,"value exceeds uint size",t,r),r}function wn(e,t){const r=xt(e,"value"),n=jt(r);return te(n.length<=32,"value too large",`tx.${t}`,r),n}function Sn(e){return sn(e).map(e=>[e.address,e.storageKeys])}function In(e,t){te(Array.isArray(e),`invalid ${t}`,"value",e);for(let t=0;t<e.length;t++)te(ce(e[t],32),"invalid ${ param } hash",`value[${t}]`,e[t]);return e}function On(e,t){let r;try{if(r=En(t[0],"yParity"),0!==r&&1!==r)throw new Error("bad yParity")}catch(e){te(!1,"invalid yParity","yParity",t[0])}const n=ge(t[1],32),o=ge(t[2],32),i=Zt.from({r:n,s:o,yParity:r});e.signature=i}class An{#u;#l;#f;#h;#d;#p;#y;#g;#m;#b;#E;#v;#w;#S;#I;#O;#A;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:te(!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?Lr:e}set to(e){this.#l=null==e?null:ir(e)}get nonce(){return this.#h}set nonce(e){this.#h=Gt(e,"value")}get gasLimit(){return this.#d}set gasLimit(e){this.#d=xt(e)}get gasPrice(){const e=this.#p;return null!=e||0!==this.type&&1!==this.type?e:cn}set gasPrice(e){this.#p=null==e?null:xt(e,"gasPrice")}get maxPriorityFeePerGas(){const e=this.#y;return null==e?2===this.type||3===this.type?cn:null:e}set maxPriorityFeePerGas(e){this.#y=null==e?null:xt(e,"maxPriorityFeePerGas")}get maxFeePerGas(){const e=this.#g;return null==e?2===this.type||3===this.type?cn:null:e}set maxFeePerGas(e){this.#g=null==e?null:xt(e,"maxFeePerGas")}get data(){return this.#f}set data(e){this.#f=fe(e)}get value(){return this.#m}set value(e){this.#m=xt(e,"value")}get chainId(){return this.#b}set chainId(e){this.#b=xt(e)}get signature(){return this.#E||null}set signature(e){this.#E=null==e?null:Zt.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:sn(e)}get authorizationList(){const e=this.#A||null;return null==e&&4===this.type?[]:e}set authorizationList(e){this.#A=null==e?null:e.map(e=>{return{address:ir((t=e).address),nonce:xt(null!=t.nonce?t.nonce:0),chainId:xt(null!=t.chainId?t.chainId:0),signature:Zt.from(t.signature)};var t})}get maxFeePerBlobGas(){const e=this.#w;return null==e&&3===this.type?cn:e}set maxFeePerBlobGas(e){this.#w=null==e?null:xt(e,"maxFeePerBlobGas")}get blobVersionedHashes(){let e=this.#S;return null==e&&3===this.type?[]:e}set blobVersionedHashes(e){if(null!=e){te(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let t=0;t<e.length;t++)te(ce(e[t],32),"invalid blobVersionedHash",`value[${t}]`,e[t])}this.#S=e}get blobs(){return null==this.#O?null:this.#O.map(e=>Object.assign({},e))}set blobs(e){if(null==e)return void(this.#O=null);const t=[],r=[];for(let n=0;n<e.length;n++){const o=e[n];if(ue(o)){ee(this.#I,"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let e=se(o);if(te(e.length<=pn,"blob is too large",`blobs[${n}]`,o),e.length!==pn){const t=new Uint8Array(pn);t.set(e),e=t}const i=this.#I.blobToKzgCommitment(e),s=fe(this.#I.computeBlobKzgProof(e,i));t.push({data:fe(e),commitment:fe(i),proof:s}),r.push(yn(1,i))}else{const e=fe(o.commitment);t.push({data:fe(o.data),commitment:e,proof:fe(o.proof)}),r.push(yn(1,e))}}this.#O=t,this.#S=r}get kzg(){return this.#I}set kzg(e){this.#I=null==e?null:function(e){return{blobToKzgCommitment:t=>{if("computeBlobProof"in e){if("blobToKzgCommitment"in e&&"function"==typeof e.blobToKzgCommitment)return se(e.blobToKzgCommitment(fe(t)))}else if("blobToKzgCommitment"in e&&"function"==typeof e.blobToKzgCommitment)return se(e.blobToKzgCommitment(t));if("blobToKZGCommitment"in e&&"function"==typeof e.blobToKZGCommitment)return se(e.blobToKZGCommitment(fe(t)));te(!1,"unsupported KZG library","kzg",e)},computeBlobKzgProof:(t,r)=>"computeBlobProof"in e&&"function"==typeof e.computeBlobProof?se(e.computeBlobProof(fe(t),fe(r))):"computeBlobKzgProof"in e&&"function"==typeof e.computeBlobKzgProof?e.computeBlobKzgProof(t,r):"computeBlobKZGProof"in e&&"function"==typeof e.computeBlobKZGProof?se(e.computeBlobKZGProof(fe(t),fe(r))):void te(!1,"unsupported KZG library","kzg",e)}}(e)}constructor(){this.#u=null,this.#l=null,this.#h=0,this.#d=cn,this.#p=null,this.#y=null,this.#g=null,this.#f="0x",this.#m=cn,this.#b=cn,this.#E=null,this.#v=null,this.#w=null,this.#S=null,this.#I=null,this.#O=null,this.#A=null}get hash(){return null==this.signature?null:ve(this.#T(!0,!1))}get unsignedHash(){return ve(this.unsignedSerialized)}get from(){return null==this.signature?null:(e=this.unsignedHash,t=this.signature,an(Qt.recoverPublicKey(e,t)));var e,t}get fromPublicKey(){return null==this.signature?null:Qt.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return null!=this.signature}#T(e,t){ee(!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=[wn(e.nonce,"nonce"),wn(e.gasPrice||0,"gasPrice"),wn(e.gasLimit,"gasLimit"),e.to||"0x",wn(e.value,"value"),e.data];let n=cn;if(e.chainId!=cn)n=xt(e.chainId,"tx.chainId"),te(!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!==cn&&(r.push(jt(n)),r.push("0x"),r.push("0x")),pr(r);let o=BigInt(27+t.yParity);return n!==cn?o=Zt.getChainIdV(n,t.v):BigInt(t.v)!==o&&te(!1,"tx.chainId/sig.v mismatch","sig",t),r.push(jt(o)),r.push(jt(t.r)),r.push(jt(t.s)),pr(r)}(this,r);case 1:return function(e,t){const r=[wn(e.chainId,"chainId"),wn(e.nonce,"nonce"),wn(e.gasPrice||0,"gasPrice"),wn(e.gasLimit,"gasLimit"),e.to||"0x",wn(e.value,"value"),e.data,Sn(e.accessList||[])];return t&&(r.push(wn(t.yParity,"recoveryParam")),r.push(jt(t.r)),r.push(jt(t.s))),he(["0x01",pr(r)])}(this,r);case 2:return function(e,t){const r=[wn(e.chainId,"chainId"),wn(e.nonce,"nonce"),wn(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),wn(e.maxFeePerGas||0,"maxFeePerGas"),wn(e.gasLimit,"gasLimit"),e.to||"0x",wn(e.value,"value"),e.data,Sn(e.accessList||[])];return t&&(r.push(wn(t.yParity,"yParity")),r.push(jt(t.r)),r.push(jt(t.s))),he(["0x02",pr(r)])}(this,r);case 3:return function(e,t,r){const n=[wn(e.chainId,"chainId"),wn(e.nonce,"nonce"),wn(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),wn(e.maxFeePerGas||0,"maxFeePerGas"),wn(e.gasLimit,"gasLimit"),e.to||Lr,wn(e.value,"value"),e.data,Sn(e.accessList||[]),wn(e.maxFeePerBlobGas||0,"maxFeePerBlobGas"),In(e.blobVersionedHashes||[],"blobVersionedHashes")];return t&&(n.push(wn(t.yParity,"yParity")),n.push(jt(t.r)),n.push(jt(t.s)),r)?he(["0x03",pr([n,r.map(e=>e.data),r.map(e=>e.commitment),r.map(e=>e.proof)])]):he(["0x03",pr(n)])}(this,r,t?this.blobs:null);case 4:return function(e,t){const r=[wn(e.chainId,"chainId"),wn(e.nonce,"nonce"),wn(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),wn(e.maxFeePerGas||0,"maxFeePerGas"),wn(e.gasLimit,"gasLimit"),e.to||"0x",wn(e.value,"value"),e.data,Sn(e.accessList||[]),(n=e.authorizationList||[],n.map(e=>[wn(e.chainId,"chainId"),e.address,wn(e.nonce,"nonce"),wn(e.signature.yParity,"yParity"),jt(e.signature.r),jt(e.signature.s)]))];var n;return t&&(r.push(wn(t.yParity,"yParity")),r.push(jt(t.r)),r.push(jt(t.s))),he(["0x04",pr(r)])}(this,r)}ee(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})}get serialized(){return this.#T(!0,!0)}get unsignedSerialized(){return this.#T(!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=null!=this.gasPrice,t=null!=this.maxFeePerGas||null!=this.maxPriorityFeePerGas,r=null!=this.accessList,n=null!=this.#w||this.#S;null!=this.maxFeePerGas&&null!=this.maxPriorityFeePerGas&&ee(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),ee(!t||0!==this.type&&1!==this.type,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),ee(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 An.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 An;if("string"==typeof e){const t=se(e);if(t[0]>=127)return An.from(function(e){const t=nn(e);te(Array.isArray(t)&&(9===t.length||6===t.length),"invalid field count for legacy transaction","data",e);const r={type:0,nonce:En(t[0],"nonce"),gasPrice:vn(t[1],"gasPrice"),gasLimit:vn(t[2],"gasLimit"),to:gn(t[3]),value:vn(t[4],"value"),data:fe(t[5]),chainId:cn};if(6===t.length)return r;const n=vn(t[6],"v"),o=vn(t[7],"r"),i=vn(t[8],"s");if(o===cn&&i===cn)r.chainId=n;else{let e=(n-hn)/un;e<cn&&(e=cn),r.chainId=e,te(e!==cn||n===ln||n===fn,"non-canonical legacy v","v",t[6]),r.signature=Zt.from({r:ge(t[7],32),s:ge(t[8],32),v:n})}return r}(t));switch(t[0]){case 1:return An.from(function(e){const t=nn(se(e).slice(1));te(Array.isArray(t)&&(8===t.length||11===t.length),"invalid field count for transaction type: 1","data",fe(e));const r={type:1,chainId:vn(t[0],"chainId"),nonce:En(t[1],"nonce"),gasPrice:vn(t[2],"gasPrice"),gasLimit:vn(t[3],"gasLimit"),to:gn(t[4]),value:vn(t[5],"value"),data:fe(t[6]),accessList:mn(t[7],"accessList")};return 8===t.length||On(r,t.slice(8)),r}(t));case 2:return An.from(function(e){const t=nn(se(e).slice(1));te(Array.isArray(t)&&(9===t.length||12===t.length),"invalid field count for transaction type: 2","data",fe(e));const r={type:2,chainId:vn(t[0],"chainId"),nonce:En(t[1],"nonce"),maxPriorityFeePerGas:vn(t[2],"maxPriorityFeePerGas"),maxFeePerGas:vn(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:vn(t[4],"gasLimit"),to:gn(t[5]),value:vn(t[6],"value"),data:fe(t[7]),accessList:mn(t[8],"accessList")};return 9===t.length||On(r,t.slice(9)),r}(t));case 3:return An.from(function(e){let t=nn(se(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];te(Array.isArray(e),"invalid network format: blobs not an array","fields[1]",e),te(Array.isArray(o),"invalid network format: commitments not an array","fields[2]",o),te(Array.isArray(i),"invalid network format: proofs not an array","fields[3]",i),te(e.length===o.length,"invalid network format: blobs/commitments length mismatch","fields",t),te(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]}te(Array.isArray(t)&&(11===t.length||14===t.length),`invalid field count for transaction type: ${r}`,"data",fe(e));const o={type:3,chainId:vn(t[0],"chainId"),nonce:En(t[1],"nonce"),maxPriorityFeePerGas:vn(t[2],"maxPriorityFeePerGas"),maxFeePerGas:vn(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:vn(t[4],"gasLimit"),to:gn(t[5]),value:vn(t[6],"value"),data:fe(t[7]),accessList:mn(t[8],"accessList"),maxFeePerBlobGas:vn(t[9],"maxFeePerBlobGas"),blobVersionedHashes:t[10]};n&&(o.blobs=n),te(null!=o.to,`invalid address for transaction type: ${r}`,"data",e),te(Array.isArray(o.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",e);for(let t=0;t<o.blobVersionedHashes.length;t++)te(ce(o.blobVersionedHashes[t],32),`invalid blobVersionedHash at index ${t}: must be length 32`,"data",e);return 11===t.length||On(o,t.slice(11)),o}(t));case 4:return An.from(function(e){const t=nn(se(e).slice(1));te(Array.isArray(t)&&(10===t.length||13===t.length),"invalid field count for transaction type: 4","data",fe(e));const r={type:4,chainId:vn(t[0],"chainId"),nonce:En(t[1],"nonce"),maxPriorityFeePerGas:vn(t[2],"maxPriorityFeePerGas"),maxFeePerGas:vn(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:vn(t[4],"gasLimit"),to:gn(t[5]),value:vn(t[6],"value"),data:fe(t[7]),accessList:mn(t[8],"accessList"),authorizationList:bn(t[9],"authorizationList")};return 10===t.length||On(r,t.slice(10)),r}(t))}ee(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const t=new An;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=Zt.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&&(te(t.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),te(t.hash===e.hash,"hash mismatch","tx",e)),null!=e.from&&(te(t.isSigned(),"unsigned transaction cannot define '.from'","tx",e),te(t.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),t}}BigInt(0);function Tn(e){const t={};e.to&&(t.to=e.to),e.from&&(t.from=e.from),e.data&&(t.data=fe(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]=xt(e[n],`request.${n}`));const n="type,nonce".split(/,/);for(const r of n)r in e&&null!=e[r]&&(t[r]=Gt(e[r],`request.${r}`));return e.accessList&&(t.accessList=sn(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=>ue(e)?fe(e):Object.assign({},e))),t}Symbol.iterator;Symbol.iterator;function Rn(e,t){if(e.provider)return e.provider;ee(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:t})}async function Pn(e,t){let r=Tn(t);if(null!=r.to&&(r.to=ar(r.to,e)),null!=r.from){const t=r.from;r.from=Promise.all([e.getAddress(),ar(t,e)]).then(([e,t])=>(te(e.toLowerCase()===t.toLowerCase(),"transaction from mismatch","tx.from",t),e))}else r.from=e.getAddress();return await J(r)}class Nn{provider;constructor(e){Z(this,{provider:e||null})}async getNonce(e){return Rn(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await Pn(this,e)}async populateTransaction(e){const t=Rn(this,"populateTransaction"),r=await Pn(this,e);null==r.nonce&&(r.nonce=await this.getNonce("pending")),null==r.gasLimit&&(r.gasLimit=await this.estimateGas(r));const n=await this.provider.getNetwork();if(null!=r.chainId){te(xt(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||te(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e):te(!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();ee(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?(ee(!o,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),null==r.gasPrice&&(r.gasPrice=e.gasPrice),r.type=0):ee(!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 J(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=An.from(r);return await t.broadcastTransaction(await this.signTransaction(n))}authorize(e){ee(!1,"authorization not implemented for this signer","UNSUPPORTED_OPERATION",{operation:"authorize"})}}class Cn extends Nn{address;constructor(e,t){super(t),Z(this,{address:e})}async getAddress(){return this.address}connect(e){return new Cn(this.address,e)}#R(e,t){ee(!1,`VoidSigner cannot sign ${e}`,"UNSUPPORTED_OPERATION",{operation:t})}async signTransaction(e){this.#R("transactions","signTransaction")}async signMessage(e){this.#R("messages","signMessage")}async signTypedData(e,t,r){this.#R("typed-data","signTypedData")}}class _n extends Nn{address;#P;constructor(e,t){super(t),te(e&&"function"==typeof e.sign,"invalid private key","privateKey","[ REDACTED ]"),this.#P=e;Z(this,{address:an(this.signingKey.publicKey)})}get signingKey(){return this.#P}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(e){return new _n(this.#P,e)}async signTransaction(e){e=Tn(e);const{to:t,from:r}=await J({to:e.to?ar(e.to,this):void 0,from:e.from?ar(e.from,this):void 0});null!=t&&(e.to=t),null!=r&&(e.from=r),null!=e.from&&(te(ir(e.from)===this.address,"transaction from address mismatch","tx.from",e.from),delete e.from);const n=An.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(lr(e)).serialized}authorizeSync(e){te("string"==typeof e.address,"invalid address for authorizeSync","auth.address",e);const t=this.signingKey.sign(yr(e));return Object.assign({},{address:ir(e.address),nonce:xt(e.nonce||0),chainId:xt(e.chainId||0)},{signature:t})}async authorize(e){return e=Object.assign({},e,{address:await ar(e.address,this)}),this.authorizeSync(await this.populateAuthorization(e))}async signTypedData(e,t,r){const n=await _r.resolveNames(e,t,r,async e=>{ee(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 ee(null!=t,"unconfigured ENS name","UNCONFIGURED_NAME",{value:e}),t});return this.signingKey.sign(_r.hash(n.domain,t,n.value)).serialized}}let Ln=!1;const kn=function(e,t,r){return function(e,t){const r={sha256:Pe,sha512:jr}[e];return te(null!=r,"invalid hmac algorithm","algorithm",e),ft.create(r,t)}(e,t).update(r).digest()};let Un=kn;function xn(e,t,r){const n=se(t,"key"),o=se(r,"data");return fe(Un(e,n,o))}xn._=kn,xn.lock=function(){Ln=!0},xn.register=function(e){if(Ln)throw new Error("computeHmac is locked");Un=e},Object.freeze(xn);const Fn=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Bn=Uint8Array.from({length:16},(e,t)=>t);let Dn=[Bn],Gn=[Bn.map(e=>(9*e+5)%16)];for(let e=0;e<4;e++)for(let t of[Dn,Gn])t.push(t[e].map(e=>Fn[e]));const Mn=[[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)),jn=Dn.map((e,t)=>e.map(e=>Mn[t][e])),Kn=Gn.map((e,t)=>e.map(e=>Mn[t][e])),Vn=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),$n=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),Hn=(e,t)=>e<<t|e>>>32-t;function zn(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 qn=new Uint32Array(16);class Wn extends we{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)qn[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=Vn[e],d=$n[e],p=Dn[e],y=Gn[e],g=jn[e],m=Kn[e];for(let t=0;t<16;t++){const n=Hn(r+zn(e,o,s,c)+qn[p[t]]+h,g[t])+l|0;r=l,l=c,c=0|Hn(s,10),s=o,o=n}for(let e=0;e<16;e++){const r=Hn(n+zn(t,i,a,u)+qn[y[e]]+d,m[e])+f|0;n=f,f=u,u=0|Hn(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(){qn.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const Yn=C(()=>new Wn);let Jn=!1;const Zn=function(e){return Yn(e)};let Qn=Zn;function Xn(e){const t=se(e,"data");return fe(Qn(t))}Xn._=Zn,Xn.lock=function(){Jn=!0},Xn.register=function(e){if(Jn)throw new TypeError("ripemd160 is locked");Qn=e},Object.freeze(Xn);let eo=!1;const to=function(e){return new Uint8Array(function(e){ee(null!=Vr,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"}),te(Number.isInteger(e)&&e>0&&e<=1024,"invalid length","length",e);const t=new Uint8Array(e);return Vr.getRandomValues(t),t}(e))};let ro=to;function no(e){return ro(e)}no._=to,no.lock=function(){eo=!0},no.register=function(e){if(eo)throw new Error("randomBytes is locked");ro=e},Object.freeze(no);const oo="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";let io=null;function so(e){if(null==io){io={};for(let e=0;e<58;e++)io[oo[e]]=BigInt(e)}const t=io[e];return te(null!=t,"invalid base58 value","letter",e),t}const ao=BigInt(0),co=BigInt(58);const uo=" !#$%&'()*+,-./<=>?@[]^_`{|}~",lo=/^[a-z]*$/i;function fo(e,t){let r=97;return e.reduce((e,n)=>(n===t?r++:n.match(lo)?e.push(String.fromCharCode(r)+n):(r=97,e.push(n)),e),[])}function ho(e){return te("0"===e[0],"unsupported auwl data","data",e),function(e,t){for(let r=28;r>=0;r--)e=e.split(uo[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 fo(fo(r,";"),":")}(e.substring(59),e.substring(1,59))}class po{locale;constructor(e){Z(this,{locale:e})}split(e){return e.toLowerCase().split(/\s+/g)}join(e){return e.join(" ")}}class yo extends po{#f;#N;constructor(e,t,r){super(e),this.#f=t,this.#N=r,this.#C=null}get _data(){return this.#f}_decodeWords(){return ho(this.#f)}#C;#_(){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.#_();return te(e>=0&&e<t.length,`invalid word index: ${e}`,"index",e),t[e]}getWordIndex(e){return this.#_().indexOf(e)}}let go=null;class mo extends yo{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 mo),go}}let bo=!1;const Eo=function(e,t,r,n,o){return function(e,t,r,n,o){const i={sha256:Pe,sha512:jr}[o];return te(null!=i,"invalid pbkdf2 algorithm","algorithm",o),xr(i,e,t,{c:r,dkLen:n})}(e,t,r,n,o)};let vo=Eo;function wo(e,t,r,n,o){const i=se(e,"password"),s=se(t,"salt");return fe(vo(i,s,r,n,o))}function So(e){return(1<<e)-1<<8-e&255}function Io(e){return(1<<e)-1&255}function Oo(e,t){ne("NFKD"),null==t&&(t=mo.wordlist());const r=t.split(e);te(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"));te(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=So(r.length/3);return te((se(Zr(n.slice(0,i/8)))[0]&s)===(n[n.length-1]&s),"invalid mnemonic checksum","mnemonic","[ REDACTED ]"),fe(n.slice(0,i/8))}function Ao(e,t){te(e.length%4==0&&e.length>=16&&e.length<=32,"invalid entropy size","entropy","[ REDACTED ]"),null==t&&(t=mo.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(Zr(e).substring(2,4),16)&So(o);return r[r.length-1]<<=o,r[r.length-1]|=i>>8-o,t.join(r.map(e=>t.getWord(e)))}wo._=Eo,wo.lock=function(){bo=!0},wo.register=function(e){if(bo)throw new Error("pbkdf2 is locked");vo=e},Object.freeze(wo);const To={};class Ro{phrase;password;wordlist;entropy;constructor(e,t,r,n,o){null==n&&(n=""),null==o&&(o=mo.wordlist()),oe(e,To,"Mnemonic"),Z(this,{phrase:r,password:n,wordlist:o,entropy:t})}computeSeed(){const e=ur("mnemonic"+this.password,"NFKD");return wo(ur(this.phrase,"NFKD"),e,2048,64,"sha512")}static fromPhrase(e,t,r){const n=Oo(e,r);return e=Ao(se(n),r),new Ro(To,n,e,t,r)}static fromEntropy(e,t,r){const n=se(e,"entropy"),o=Ao(n,r);return new Ro(To,fe(n),o,t,r)}static entropyToPhrase(e,t){return Ao(se(e,"entropy"),t)}static phraseToEntropy(e,t){return Oo(e,t)}static isValidMnemonic(e,t){try{return Oo(e,t),!0}catch(e){}return!1}}
/*! MIT License. Copyright 2015-2022 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */
var Po,No,Co,_o=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)},Lo=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 ko={16:10,24:12,32:14},Uo=[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],xo=[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],Fo=[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],Bo=[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],Do=[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],Go=[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],Mo=[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],jo=[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],Ko=[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],Vo=[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],$o=[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],Ho=[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],zo=[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],qo=[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],Wo=[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 Yo(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 Jo{get key(){return _o(this,Po,"f").slice()}constructor(e){if(Po.set(this,void 0),No.set(this,void 0),Co.set(this,void 0),!(this instanceof Jo))throw Error("AES must be instanitated with `new`");Lo(this,Po,new Uint8Array(e),"f");const t=ko[this.key.length];if(null==t)throw new TypeError("invalid key size (must be 16, 24 or 32 bytes)");Lo(this,Co,[],"f"),Lo(this,No,[],"f");for(let e=0;e<=t;e++)_o(this,Co,"f").push([0,0,0,0]),_o(this,No,"f").push([0,0,0,0]);const r=4*(t+1),n=this.key.length/4,o=Yo(this.key);let i;for(let e=0;e<n;e++)i=e>>2,_o(this,Co,"f")[i][e%4]=o[e],_o(this,No,"f")[t-i][e%4]=o[e];let s,a=0,c=n;for(;c<r;){if(s=o[n-1],o[0]^=xo[s>>16&255]<<24^xo[s>>8&255]<<16^xo[255&s]<<8^xo[s>>24&255]^Uo[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]^=xo[255&s]^xo[s>>8&255]<<8^xo[s>>16&255]<<16^xo[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,_o(this,Co,"f")[e][i]=o[u],_o(this,No,"f")[t-e][i]=o[u++],c++}for(let e=1;e<t;e++)for(let t=0;t<4;t++)s=_o(this,No,"f")[e][t],_o(this,No,"f")[e][t]=Ho[s>>24&255]^zo[s>>16&255]^qo[s>>8&255]^Wo[255&s]}encrypt(e){if(16!=e.length)throw new TypeError("invalid plaintext size (must be 16 bytes)");const t=_o(this,Co,"f").length-1,r=[0,0,0,0];let n=Yo(e);for(let e=0;e<4;e++)n[e]^=_o(this,Co,"f")[0][e];for(let e=1;e<t;e++){for(let t=0;t<4;t++)r[t]=Bo[n[t]>>24&255]^Do[n[(t+1)%4]>>16&255]^Go[n[(t+2)%4]>>8&255]^Mo[255&n[(t+3)%4]]^_o(this,Co,"f")[e][t];n=r.slice()}const o=new Uint8Array(16);let i=0;for(let e=0;e<4;e++)i=_o(this,Co,"f")[t][e],o[4*e]=255&(xo[n[e]>>24&255]^i>>24),o[4*e+1]=255&(xo[n[(e+1)%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+3)%4]]^i);return o}decrypt(e){if(16!=e.length)throw new TypeError("invalid ciphertext size (must be 16 bytes)");const t=_o(this,No,"f").length-1,r=[0,0,0,0];let n=Yo(e);for(let e=0;e<4;e++)n[e]^=_o(this,No,"f")[0][e];for(let e=1;e<t;e++){for(let t=0;t<4;t++)r[t]=jo[n[t]>>24&255]^Ko[n[(t+3)%4]>>16&255]^Vo[n[(t+2)%4]>>8&255]^$o[255&n[(t+1)%4]]^_o(this,No,"f")[e][t];n=r.slice()}const o=new Uint8Array(16);let i=0;for(let e=0;e<4;e++)i=_o(this,No,"f")[t][e],o[4*e]=255&(Fo[n[e]>>24&255]^i>>24),o[4*e+1]=255&(Fo[n[(e+3)%4]>>16&255]^i>>16),o[4*e+2]=255&(Fo[n[(e+2)%4]>>8&255]^i>>8),o[4*e+3]=255&(Fo[255&n[(e+1)%4]]^i);return o}}Po=new WeakMap,No=new WeakMap,Co=new WeakMap;class Zo{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 Jo(t)},name:{enumerable:!0,value:e}})}}var Qo,Xo,ei=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},ti=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 ri extends Zo{constructor(e,t){if(super("ECC",e,ri),Qo.set(this,void 0),Xo.set(this,void 0),t){if(t.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");ei(this,Qo,new Uint8Array(t),"f")}else ei(this,Qo,new Uint8Array(16),"f");ei(this,Xo,this.iv,"f")}get iv(){return new Uint8Array(ti(this,Qo,"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++)ti(this,Xo,"f")[t]^=e[r+t];ei(this,Xo,this.aes.encrypt(ti(this,Xo,"f")),"f"),t.set(ti(this,Xo,"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]^ti(this,Xo,"f")[o],ti(this,Xo,"f")[o]=e[r+o]}return t}}Qo=new WeakMap,Xo=new WeakMap;var ni,oi=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};new WeakMap,ni=new WeakMap,new WeakSet;var ii,si,ai,ci=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},ui=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 li extends Zo{constructor(e,t){super("CTR",e,li),ii.set(this,void 0),si.set(this,void 0),ai.set(this,void 0),ci(this,ai,new Uint8Array(16),"f"),ui(this,ai,"f").fill(0),ci(this,ii,ui(this,ai,"f"),"f"),ci(this,si,16,"f"),null==t&&(t=1),"number"==typeof t?this.setCounterValue(t):this.setCounterBytes(t)}get counter(){return new Uint8Array(ui(this,ai,"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)ui(this,ai,"f")[t]=e%256,e=Math.floor(e/256)}setCounterBytes(e){if(16!==e.length)throw new TypeError("invalid counter initial Uint8Array value length");ui(this,ai,"f").set(e)}increment(){for(let e=15;e>=0;e--){if(255!==ui(this,ai,"f")[e]){ui(this,ai,"f")[e]++;break}ui(this,ai,"f")[e]=0}}encrypt(e){var t,r;const n=new Uint8Array(e);for(let e=0;e<n.length;e++)16===ui(this,si,"f")&&(ci(this,ii,this.aes.encrypt(ui(this,ai,"f")),"f"),ci(this,si,0,"f"),this.increment()),n[e]^=ui(this,ii,"f")[(ci(this,si,(r=ui(this,si,"f"),t=r++,r),"f"),t)];return n}decrypt(e){return this.encrypt(e)}}ii=new WeakMap,si=new WeakMap,ai=new WeakMap;new WeakMap,new WeakMap,new WeakMap;const fi=(e,t)=>e<<t|e>>>32-t;function hi(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++],y=e[t++]^r[n++],g=e[t++]^r[n++],m=e[t++]^r[n++],b=e[t++]^r[n++],E=e[t++]^r[n++],v=e[t++]^r[n++],w=e[t++]^r[n++],S=s,I=a,O=c,A=u,T=l,R=f,P=h,N=d,C=p,_=y,L=g,k=m,U=b,x=E,F=v,B=w;for(let e=0;e<8;e+=2)T^=fi(S+U|0,7),C^=fi(T+S|0,9),U^=fi(C+T|0,13),S^=fi(U+C|0,18),_^=fi(R+I|0,7),x^=fi(_+R|0,9),I^=fi(x+_|0,13),R^=fi(I+x|0,18),F^=fi(L+P|0,7),O^=fi(F+L|0,9),P^=fi(O+F|0,13),L^=fi(P+O|0,18),A^=fi(B+k|0,7),N^=fi(A+B|0,9),k^=fi(N+A|0,13),B^=fi(k+N|0,18),I^=fi(S+A|0,7),O^=fi(I+S|0,9),A^=fi(O+I|0,13),S^=fi(A+O|0,18),P^=fi(R+T|0,7),N^=fi(P+R|0,9),T^=fi(N+P|0,13),R^=fi(T+N|0,18),k^=fi(L+_|0,7),C^=fi(k+L|0,9),_^=fi(C+k|0,13),L^=fi(_+C|0,18),U^=fi(B+F|0,7),x^=fi(U+B|0,9),F^=fi(x+U|0,13),B^=fi(F+x|0,18);o[i++]=s+S|0,o[i++]=a+I|0,o[i++]=c+O|0,o[i++]=u+A|0,o[i++]=l+T|0,o[i++]=f+R|0,o[i++]=h+P|0,o[i++]=d+N|0,o[i++]=p+C|0,o[i++]=y+_|0,o[i++]=g+L|0,o[i++]=m+k|0,o[i++]=b+U|0,o[i++]=E+x|0,o[i++]=v+F|0,o[i++]=w+B|0}function di(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)hi(r,s,e,t,r,i),n>0&&(s+=16),hi(r,i,e,t+=16,r,s)}function pi(e,t,r){const n=N({dkLen:32,asyncTick:10,maxmem:1073742848},r),{N:o,r:s,p:a,dkLen:c,asyncTick:u,maxmem:l,onProgress:f}=n;if(i(o),i(s),i(a),i(c),i(u),i(l),void 0!==f&&"function"!=typeof f)throw new Error("progressCb should be function");const h=128*s,d=h/4;if(o<=1||o&o-1||o>=2**(h/8)||o>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*(o+a);if(p>l)throw new Error(`Scrypt: parameters too large, ${p} (128 * r * (N + p)) > ${l} (maxmem)`);const y=xr(Pe,e,t,{c:1,dkLen:h*a}),g=w(y),m=w(new Uint8Array(h*o)),b=w(new Uint8Array(h));let E=()=>{};if(f){const e=2*o*a,t=Math.max(Math.floor(e/1e4),1);let r=0;E=()=>{r++,!f||r%t&&r!==e||f(r/e)}}return{N:o,r:s,p:a,dkLen:c,blockSize32:d,V:m,B32:g,B:y,tmp:b,blockMixCb:E,asyncTick:u}}function yi(e,t,r,n,o){const i=xr(Pe,e,r,{c:1,dkLen:t});return r.fill(0),n.fill(0),o.fill(0),i}let gi=!1,mi=!1;const bi=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}=pi(e,t,r);for(let e=0;e<i;e++){const t=a*e;for(let e=0;e<a;e++)c[e]=u[t+e];let r=0;await A(n-1,d,()=>{di(c,r,c,r+=a,o),h()}),di(c,(n-1)*a,u,t,o),h(),await A(n,d,()=>{const e=u[t+a-16]%n;for(let r=0;r<a;r++)f[r]=u[t+r]^c[e*a+r];di(f,0,u,t,o),h()})}return yi(e,s,l,c,f)}(e,t,{N:r,r:n,p:o,dkLen:i,onProgress:s})},Ei=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}=pi(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++)di(c,t,c,t+=a,o),h();di(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];di(f,0,u,t,o),h()}}return yi(e,s,l,c,f)}(e,t,{N:r,r:n,p:o,dkLen:i})};let vi=bi,wi=Ei;async function Si(e,t,r,n,o,i,s){const a=se(e,"passwd"),c=se(t,"salt");return fe(await vi(a,c,r,n,o,i,s))}function Ii(e,t,r,n,o,i){const s=se(e,"passwd"),a=se(t,"salt");return fe(wi(s,a,r,n,o,i))}function Oi(e){const t=se(e,"randomBytes");t[6]=15&t[6]|64,t[8]=63&t[8]|128;const r=fe(t);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}function Ai(e){return"string"!=typeof e||e.startsWith("0x")||(e="0x"+e),ae(e)}function Ti(e,t){for(e=String(e);e.length<t;)e="0"+e;return e}function Ri(e){return"string"==typeof e?ur(e,"NFKC"):ae(e)}function Pi(e,t){const r=t.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);te(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(te(!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 Ai(s);if("array"===o&&Array.isArray(s))return s;if(o===typeof s)return s;te(!1,`wrong type found for ${o} `,"path",n)}return s}Si._=bi,Si.lock=function(){mi=!0},Si.register=function(e){if(mi)throw new Error("scrypt is locked");vi=e},Object.freeze(Si),Ii._=Ei,Ii.lock=function(){gi=!0},Ii.register=function(e){if(gi)throw new Error("scryptSync is locked");wi=e},Object.freeze(Ii);const Ni="m/44'/60'/0'/0/0";function Ci(e){try{const t=JSON.parse(e);if(3===(null!=t.version?parseInt(t.version):0))return!0}catch(e){}return!1}function _i(e,t){const r=se(t),n=Pi(e,"crypto.ciphertext:data!");te(fe(ve(he([r.slice(16,32),n]))).substring(2)===Pi(e,"crypto.mac:string!").toLowerCase(),"incorrect password","password","[ REDACTED ]");const o=function(e,t,r){if("aes-128-ctr"===Pi(e,"crypto.cipher:string")){const n=Pi(e,"crypto.cipherparams.iv:data!");return fe(new li(t,n).decrypt(r))}ee(!1,"unsupported cipher","UNSUPPORTED_OPERATION",{operation:"decrypt"})}(e,r.slice(0,16),n),i=an(o);if(e.address){let t=e.address.toLowerCase();t.startsWith("0x")||(t="0x"+t),te(ir(t)===i,"keystore address/privateKey mismatch","address",e.address)}const s={address:i,privateKey:o};if("0.1"===Pi(e,"x-ethers.version:string")){const t=r.slice(32,64),n=Pi(e,"x-ethers.mnemonicCiphertext:data!"),o=Pi(e,"x-ethers.mnemonicCounter:data!"),i=new li(t,o);s.mnemonic={path:Pi(e,"x-ethers.path:string")||Ni,locale:Pi(e,"x-ethers.locale:string")||"en",entropy:fe(se(i.decrypt(n)))}}return s}function Li(e){const t=Pi(e,"crypto.kdf:string");if(t&&"string"==typeof t){if("scrypt"===t.toLowerCase()){const r=Pi(e,"crypto.kdfparams.salt:data!"),n=Pi(e,"crypto.kdfparams.n:int!"),o=Pi(e,"crypto.kdfparams.r:int!"),i=Pi(e,"crypto.kdfparams.p:int!");te(n>0&&!(n&n-1),"invalid kdf.N","kdf.N",n),te(o>0&&i>0,"invalid kdf","kdf",t);const s=Pi(e,"crypto.kdfparams.dklen:int!");return te(32===s,"invalid kdf.dklen","kdf.dflen",s),{name:"scrypt",salt:r,N:n,r:o,p:i,dkLen:64}}if("pbkdf2"===t.toLowerCase()){const t=Pi(e,"crypto.kdfparams.salt:data!"),r=Pi(e,"crypto.kdfparams.prf:string!"),n=r.split("-").pop();te("sha256"===n||"sha512"===n,"invalid kdf.pdf","kdf.pdf",r);const o=Pi(e,"crypto.kdfparams.c:int!"),i=Pi(e,"crypto.kdfparams.dklen:int!");return te(32===i,"invalid kdf.dklen","kdf.dklen",i),{name:"pbkdf2",salt:t,count:o,dkLen:i,algorithm:n}}}te(!1,"unsupported key-derivation function","kdf",t)}function ki(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Ui(e){const t=null!=e.salt?se(e.salt,"options.salt"):no(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)),te("number"==typeof r&&r>0&&Number.isSafeInteger(r)&&(BigInt(r)&BigInt(r-1))===BigInt(0),"invalid scrypt N parameter","options.N",r),te("number"==typeof n&&n>0&&Number.isSafeInteger(n),"invalid scrypt r parameter","options.r",n),te("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 xi(e,t,r,n){const o=se(r.privateKey,"privateKey"),i=null!=n.iv?se(n.iv,"options.iv"):no(16);te(16===i.length,"invalid options.iv length","options.iv",n.iv);const s=null!=n.uuid?se(n.uuid,"options.uuid"):no(16);te(16===s.length,"invalid options.uuid length","options.uuid",n.iv);const a=e.slice(0,16),c=e.slice(16,32),u=se(new li(a,i).encrypt(o)),l=ve(he([c,u])),f={address:r.address.substring(2).toLowerCase(),id:Oi(s),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:fe(i).substring(2)},ciphertext:fe(u).substring(2),kdf:"scrypt",kdfparams:{salt:fe(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/${W}`,o=r.mnemonic.path||Ni,i=r.mnemonic.locale||"en",s=e.slice(32,64),a=se(r.mnemonic.entropy,"account.mnemonic.entropy"),c=no(16),u=se(new li(s,c).encrypt(a)),l=new Date,h="UTC--"+(l.getUTCFullYear()+"-"+Ti(l.getUTCMonth()+1,2)+"-"+Ti(l.getUTCDate(),2)+"T"+Ti(l.getUTCHours(),2)+"-"+Ti(l.getUTCMinutes(),2)+"-"+Ti(l.getUTCSeconds(),2)+".0Z")+"--"+f.address;f["x-ethers"]={client:t,gethFilename:h,path:o,locale:i,mnemonicCounter:fe(c).substring(2),mnemonicCiphertext:fe(u).substring(2),version:"0.1"}}return JSON.stringify(f)}function Fi(e,t,r){null==r&&(r={});const n=Ri(t),o=Ui(r);return xi(se(Ii(n,o.salt,o.N,o.r,o.p,64)),o,e,r)}async function Bi(e,t,r){null==r&&(r={});const n=Ri(t),o=Ui(r);return xi(se(await Si(n,o.salt,o.N,o.r,o.p,64,r.progressCallback)),o,e,r)}const Di="m/44'/60'/0'/0/0",Gi=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]),Mi=2147483648,ji=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");function Ki(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 Vi(e){const t=se(e);return function(e){const t=se(e);let r=Dt(t),n="";for(;r;)n=oo[Number(r%co)]+n,r/=co;for(let e=0;e<t.length&&!t[e];e++)n=oo[0]+n;return n}(he([t,pe(Zr(Zr(t)),0,4)]))}const $i={};function Hi(e,t,r,n){const o=new Uint8Array(37);e&Mi?(ee(null!=n,"cannot derive child of neutered node","UNSUPPORTED_OPERATION",{operation:"deriveChild"}),o.set(se(n),1)):o.set(se(r));for(let t=24;t>=0;t-=8)o[33+(t>>3)]=e>>24-t&255;const i=se(xn("sha512",t,o));return{IL:i.slice(0,32),IR:i.slice(32)}}function zi(e,t){const r=t.split("/");te(r.length>0,"invalid path","path",t),"m"===r[0]&&(te(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));te(r<Mi,"invalid path index",`path[${e}]`,t),n=n.deriveChild(Mi+r)}else if(t.match(/^[0-9]+$/)){const r=parseInt(t);te(r<Mi,"invalid path index",`path[${e}]`,t),n=n.deriveChild(r)}else te(!1,"invalid path component",`path[${e}]`,t)}return n}class qi extends _n{publicKey;fingerprint;parentFingerprint;mnemonic;chainCode;path;index;depth;constructor(e,t,r,n,o,i,s,a,c){super(t,c),oe(e,$i,"HDNodeWallet"),Z(this,{publicKey:t.compressedPublicKey});Z(this,{parentFingerprint:r,fingerprint:pe(Xn(Zr(this.publicKey)),0,4),chainCode:n,path:o,index:i,depth:s}),Z(this,{mnemonic:a})}connect(e){return new qi($i,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 Bi(this.#L(),e,{progressCallback:t})}encryptSync(e){return Fi(this.#L(),e)}get extendedKey(){return ee(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),Vi(he(["0x0488ADE4",Ki(this.depth,1),this.parentFingerprint,Ki(this.index,4),this.chainCode,he(["0x00",this.privateKey])]))}hasPath(){return null!=this.path}neuter(){return new Wi($i,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.provider)}deriveChild(e){const t=Gt(e,"index");te(t<=4294967295,"invalid index","index",t);let r=this.path;r&&(r+="/"+(2147483647&t),t&Mi&&(r+="'"));const{IR:n,IL:o}=Hi(t,this.chainCode,this.publicKey,this.privateKey),i=new Qt(Mt((Dt(o)+BigInt(this.privateKey))%ji,32));return new qi($i,i,this.fingerprint,fe(n),r,t,this.depth+1,this.mnemonic,this.provider)}derivePath(e){return zi(this,e)}static#k(e,t){te(ue(e),"invalid seed","seed","[REDACTED]");const r=se(e,"seed");te(r.length>=16&&r.length<=64,"invalid seed","seed","[REDACTED]");const n=se(xn("sha512",Gi,r)),o=new Qt(fe(n.slice(0,32)));return new qi($i,o,"0x00000000",fe(n.slice(32)),"m",0,0,t,null)}static fromExtendedKey(e){const t=jt(function(e){let t=ao;for(let r=0;r<e.length;r++)t*=co,t+=so(e[r]);return t}(e));te(82===t.length||Vi(t.slice(0,78))===e,"invalid extended key","extendedKey","[ REDACTED ]");const r=t[4],n=fe(t.slice(5,9)),o=parseInt(fe(t.slice(9,13)).substring(2),16),i=fe(t.slice(13,45)),s=t.slice(45,78);switch(fe(t.slice(0,4))){case"0x0488b21e":case"0x043587cf":{const e=fe(s);return new Wi($i,an(e),e,n,i,null,o,r,null)}case"0x0488ade4":case"0x04358394 ":if(0!==s[0])break;return new qi($i,new Qt(s.slice(1)),n,i,null,o,r,null,null)}te(!1,"invalid extended key prefix","extendedKey","[ REDACTED ]")}static createRandom(e,t,r){null==e&&(e=""),null==t&&(t=Di),null==r&&(r=mo.wordlist());const n=Ro.fromEntropy(no(16),e,r);return qi.#k(n.computeSeed(),n).derivePath(t)}static fromMnemonic(e,t){return t||(t=Di),qi.#k(e.computeSeed(),e).derivePath(t)}static fromPhrase(e,t,r,n){null==t&&(t=""),null==r&&(r=Di),null==n&&(n=mo.wordlist());const o=Ro.fromPhrase(e,t,n);return qi.#k(o.computeSeed(),o).derivePath(r)}static fromSeed(e){return qi.#k(e,null)}}class Wi extends Cn{publicKey;fingerprint;parentFingerprint;chainCode;path;index;depth;constructor(e,t,r,n,o,i,s,a,c){super(t,c),oe(e,$i,"HDNodeVoidWallet"),Z(this,{publicKey:r});Z(this,{publicKey:r,fingerprint:pe(Xn(Zr(r)),0,4),parentFingerprint:n,chainCode:o,path:i,index:s,depth:a})}connect(e){return new Wi($i,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,e)}get extendedKey(){return ee(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),Vi(he(["0x0488B21E",Ki(this.depth,1),this.parentFingerprint,Ki(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return null!=this.path}deriveChild(e){const t=Gt(e,"index");te(t<=4294967295,"invalid index","index",t);let r=this.path;r&&(r+="/"+(2147483647&t),t&Mi&&(r+="'"));const{IR:n,IL:o}=Hi(t,this.chainCode,this.publicKey,null),i=Qt.addPoints(o,this.publicKey,!0),s=an(i);return new Wi($i,s,i,this.fingerprint,fe(n),r,t,this.depth+1,this.provider)}derivePath(e){return zi(this,e)}}function Yi(e){try{if(JSON.parse(e).encseed)return!0}catch(e){}return!1}function Ji(e,t){const r=JSON.parse(e),n=Ri(t),o=ir(Pi(r,"ethaddr:string!")),i=Ai(Pi(r,"encseed:string!"));te(i&&i.length%16==0,"invalid encseed","json",e);const s=se(wo(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))}(se(new ri(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 Zi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}class Qi extends _n{constructor(e,t){"string"!=typeof e||e.startsWith("0x")||(e="0x"+e),super("string"==typeof e?new Qt(e):e,t)}connect(e){return new Qi(this.signingKey,e)}async encrypt(e,t){const r={address:this.address,privateKey:this.privateKey};return await Bi(r,e,{progressCallback:t})}encryptSync(e){return Fi({address:this.address,privateKey:this.privateKey},e)}static#U(e){if(te(e,"invalid JSON wallet","json","[ REDACTED ]"),"mnemonic"in e&&e.mnemonic&&"en"===e.mnemonic.locale){const t=Ro.fromEntropy(e.mnemonic.entropy),r=qi.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 Qi(e.privateKey);return te(t.address===e.address,"address/privateKey mismatch","json","[ REDACTED ]"),t}static async fromEncryptedJson(e,t,r){let n=null;return Ci(e)?n=await async function(e,t,r){const n=JSON.parse(e),o=Ri(t),i=Li(n);if("pbkdf2"===i.name){r&&(r(0),await ki(0));const{salt:e,count:t,dkLen:s,algorithm:a}=i,c=wo(o,e,t,s,a);return r&&(r(1),await ki(0)),_i(n,c)}ee("scrypt"===i.name,"cannot be reached","UNKNOWN_ERROR",{params:i});const{salt:s,N:a,r:c,p:u,dkLen:l}=i;return _i(n,await Si(o,s,a,c,u,l,r))}(e,t,r):Yi(e)&&(r&&(r(0),await Zi(0)),n=Ji(e,t),r&&(r(1),await Zi(0))),Qi.#U(n)}static fromEncryptedJsonSync(e,t){let r=null;return Ci(e)?r=function(e,t){const r=JSON.parse(e),n=Ri(t),o=Li(r);if("pbkdf2"===o.name){const{salt:e,count:t,dkLen:i,algorithm:s}=o;return _i(r,wo(n,e,t,i,s))}ee("scrypt"===o.name,"cannot be reached","UNKNOWN_ERROR",{params:o});const{salt:i,N:s,r:a,p:c,dkLen:u}=o;return _i(r,Ii(n,i,s,a,c,u))}(e,t):Yi(e)?r=Ji(e,t):te(!1,"invalid JSON wallet","json","[ REDACTED ]"),Qi.#U(r)}static createRandom(e){const t=qi.createRandom();return e?t.connect(e):t}static fromPhrase(e,t){const r=qi.fromPhrase(e);return t?r.connect(t):r}}function Xi(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 es(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)?es(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 es(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 ts(){/*! 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 rs(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]())):(rs(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,rs(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,rs(f,"constructor",u),rs(u,"constructor",c),c.displayName="GeneratorFunction",rs(u,o,"GeneratorFunction"),rs(f),rs(f,o,"Generator"),rs(f,n,function(){return this}),rs(f,"toString",function(){return"[object Generator]"}),(ts=function(){return{w:i,m:h}})()}function rs(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}rs=function(e,t,r,n){function i(t,r){rs(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))},rs(e,t,r,n)}function ns(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 os(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ns(Object(r),!0).forEach(function(t){is(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ns(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function is(e,t,r){return(t=ls(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ss(e){return ss="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},ss(e)}function as(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cs(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,ls(n.key),n)}}function us(e,t,r){return t&&cs(e.prototype,t),r&&cs(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ls(e){var t=function(e,t){if("object"!=ss(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=ss(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==ss(t)?t:t+""}function fs(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 hs(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){fs(i,n,o,s,a,"next",e)}function a(e){fs(i,n,o,s,a,"throw",e)}s(void 0)})}}var ds=[],ps=!1,ys="0.0.1";function gs(e){return new Promise(function(t,r){ds.push({task:e,resolve:t,reject:r}),ms()})}function ms(){return bs.apply(this,arguments)}function bs(){return(bs=hs(ts().m(function e(){var t,r,n;return ts().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!ps){e.n=1;break}return e.a(2);case 1:if(t=ds.shift()){e.n=2;break}return e.a(2);case 2:return ps=!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,ps=!1,ms(),e.f(6);case 7:return e.a(2)}},e,null,[[3,5,6,7]])}))).apply(this,arguments)}var Es=function(){function e(t,r){var n,o=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(as(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(ys),this.resolvedProviderVersion="",this.jsonProofResponse=!1,this.extensionID=i.extensionID||"",this.providerVersion=i.providerVersion||"",this.acceptAiProviders=!!i.acceptAiProviders,this.callbackUrl=i.callbackUrl||"",this._backgroundInitialized=!1,this._ctx=null,this._listeners={started:new Set,completed:new Set,error:new Set,progress:new Set},this._boundWindowListener=this._handleWindowMessage.bind(this),window.addEventListener("message",this._boundWindowListener),this._mode="undefined"!=typeof chrome&&chrome.runtime&&"chrome-extension:"===(null===(n=location)||void 0===n?void 0:n.protocol)?"extension":"web","extension"===this._mode){this._boundChromeHandler=function(e){var t=e||{},r=t.action,n=t.data,i=t.error,s=null==n?void 0:n.sessionId;if(!o.sessionId||o.sessionId===s)if("PROOF_SUBMITTED"===r){var a=(null==n?void 0:n.formattedProofs)||(null==n?void 0:n.proof)||n;o._emit("completed",a)}else"PROOF_SUBMISSION_FAILED"!==r&&"PROOF_GENERATION_FAILED"!==r||o._emit("error",i||new Error("Verification failed"))};try{chrome.runtime.onMessage.addListener(this._boundChromeHandler)}catch(e){}}}return us(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"!==ss(e))throw new Error("params must be an object");this.parameters=os(os({},this.parameters),e)}},{key:"getStatusUrl",value:function(){if(!this.sessionId)throw new Error("Session not initialized");return null!==o.Sn&&void 0!==o.Sn&&o.Sn.STATUS_URL?o.Sn.STATUS_URL(this.sessionId):"".concat(o.fn,"/api/sdk/status/").concat(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:(s=hs(ts().m(function e(){var t=this;return ts().w(function(e){for(;;)if(0===e.n)return e.a(2,gs(function(){return t._startVerificationInternal()}))},e)})),function(){return s.apply(this,arguments)})},{key:"cancel",value:(i=hs(ts().m(function e(){var t,r=this,n=arguments;return ts().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,i=r.on("error",function(){n||(n=!0,i(),e(!0))});window.postMessage({action:o.vQ.CANCEL_VERIFICATION,messageId:r.sessionId,extensionID:r.extensionID},"*"),setTimeout(function(){n||(i(),e(!1))},t)}))}},e,this)})),function(){return i.apply(this,arguments)})},{key:"_startVerificationInternal",value:(n=hs(ts().m(function e(){var t,r,n=this;return ts().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,i){var s=n.on("started",function(){}),a=n.on("completed",function(t){u(),e(t)}),c=n.on("error",function(e){u(),i(e)}),u=function(){s&&s(),a&&a(),c&&c()};if("extension"===n._mode)try{chrome.runtime.sendMessage({action:"START_VERIFICATION",source:"content-script",target:"background",data:t},function(e){e&&e.success&&n._emit("started",{sessionId:n.sessionId,messageId:r})})}catch(e){n._emit("error",e instanceof Error?e:new Error(String(e)))}else{if(!n.extensionID)return void n._emit("error",new Error("extensionID is required when running on a web page"));window.postMessage({action:o.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=hs(ts().m(function e(t){var r,n;return ts().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,fetch("".concat(o.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=Xi(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,i=t.data,s=t.error;if(!this.sessionId||this.sessionId===n)if(r!==o.vQ.VERIFICATION_COMPLETED)r!==o.vQ.VERIFICATION_FAILED?r!==o.vQ.VERIFICATION_STARTED||this._emit("started",{sessionId:this.sessionId,messageId:n}):this._emit("error",s||new Error("Verification failed"));else{var a=(null==i?void 0:i.proofs)||(null==i?void 0:i.formattedProofs)||i;this._emit("completed",a)}}}}],[{key:"init",value:(t=hs(ts().m(function t(r,n,o){var i,s,a,c,u,l,f,h=arguments;return ts().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=ve((new TextEncoder).encode(a)),u=new Qi(n),t.n=4,u.signMessage(se(c));case 4:return l=t.v,s.signature=l,t.n=5,s._initSession({providerId:o,appId:r,timestamp:s.timestamp,signature:l,versionNumber:s.providerVersion||""});case 5:return f=t.v,s.sessionId=f.sessionId||"",s.resolvedProviderVersion=f.resolvedProviderVersion||"",t.a(2,s)}},t)})),function(e,r,n){return t.apply(this,arguments)})}]);var t,r,n,i,s}(),vs=function(){return us(function e(){var t;as(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,t.A)();return console.log("CONTEXT INITIALIZED",e),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()),i=function(t){var n,s;t.source===window&&(null===(n=t.data)||void 0===n?void 0:n.action)===o.vQ.EXTENSION_RESPONSE&&(null===(s=t.data)||void 0===s?void 0:s.messageId)===r&&(window.removeEventListener("message",i),e(!!t.data.installed))};window.addEventListener("message",i),window.postMessage({action:o.vQ.CHECK_EXTENSION,extensionID:t,messageId:r},"*"),setTimeout(function(){window.removeEventListener("message",i),e(!1)},n)})}},{key:"getVersion",value:function(){return ys}},{key:"init",value:(e=hs(ts().m(function e(t,r,n){var o,i=arguments;return ts().w(function(e){for(;;)switch(e.n){case 0:return o=i.length>3&&void 0!==i[3]?i[3]:{},e.n=1,Es.init(t,r,n,o);case 1:return e.a(2,e.v)}},e)})),function(t,r,n){return e.apply(this,arguments)})}]);var e}(),ws=new vs;const Ss=vs})(),module.exports=n})();
//# sourceMappingURL=ReclaimExtensionSDK-mv2.bundle.js.map