rise-wallet 0.3.1 → 0.3.3-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/bin/{commands-DupUUwJ9.js → commands-B8imwW1l.js} +4 -4
- package/dist/cli/bin/index.js +1 -1
- package/dist/core/Chains.d.ts +14 -283
- package/dist/core/Chains.d.ts.map +1 -1
- package/dist/core/Dialog.d.ts.map +1 -1
- package/dist/core/Dialog.js +4 -3
- package/dist/core/Dialog.js.map +1 -1
- package/dist/core/Porto.d.ts +14 -283
- package/dist/core/Porto.d.ts.map +1 -1
- package/dist/core/internal/_generated/chains.d.ts +1 -1
- package/dist/core/internal/_generated/chains.d.ts.map +1 -1
- package/dist/core/internal/_generated/chains.js +1 -1
- package/dist/core/internal/_generated/chains.js.map +1 -1
- package/dist/core/react-native/Porto.d.ts +14 -283
- package/dist/core/react-native/Porto.d.ts.map +1 -1
- package/dist/remote/Events.d.ts.map +1 -1
- package/dist/remote/Events.js +4 -3
- package/dist/remote/Events.js.map +1 -1
- package/dist/remote/Porto.d.ts +16 -283
- package/dist/remote/Porto.d.ts.map +1 -1
- package/dist/remote/internal/methodPolicies.d.ts +4 -0
- package/dist/remote/internal/methodPolicies.d.ts.map +1 -1
- package/dist/remote/internal/methodPolicies.js +7 -0
- package/dist/remote/internal/methodPolicies.js.map +1 -1
- package/dist/tsconfig.tmp.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/core/Dialog.ts +6 -3
- package/src/core/internal/_generated/chains.ts +1 -1
- package/src/remote/Events.ts +7 -4
- package/src/remote/internal/methodPolicies.ts +9 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import*as e from"node:fs";import*as t from"node:os";import*as n from"node:path";import{setTimeout as r}from"node:timers/promises";import{stripVTControlCharacters as i}from"node:util";import a,{stdin as o,stdout as s}from"node:process";import*as c from"node:readline";import l from"node:readline";import{Writable as u}from"node:stream";import{BaseError as d,createClient as f,createTransport as p,custom as m,defineChain as h,fallback as g,getAddress as _,getTypesForEIP712Domain as v,hashMessage as y,hashTypedData as b,http as x,numberToHex as S,withCache as C,zeroAddress as w}from"viem";import*as ee from"viem/actions";import{getEip712Domain as te,verifyHash as ne,waitForCallsStatus as T}from"viem/actions";import{anvil as re,baseSepolia as ie,riseTestnet as ae}from"viem/chains";import*as oe from"ox/AbiFunction";import*as se from"ox/AbiParameters";import*as E from"ox/Address";import*as ce from"ox/Bytes";import*as le from"ox/Hash";import*as D from"ox/Hex";import*as ue from"ox/Json";import*as de from"ox/P256";import*as O from"ox/PublicKey";import*as k from"ox/Secp256k1";import*as fe from"ox/Signature";import*as pe from"ox/TypedData";import*as me from"ox/Value";import*as he from"ox/WebAuthnP256";import*as ge from"ox/WebCryptoP256";import*as _e from"mipd";import*as ve from"mipd-postmessage/child";import*as A from"zod/mini";import{z as j}from"zod/mini";import*as ye from"ox/Errors";import{toAccount as be}from"viem/accounts";import*as xe from"mipd-postmessage/parent";import*as M from"ox/Provider";import*as Se from"node:url";import{Json as Ce}from"ox";import*as we from"node:http";import*as Te from"ox/AbiItem";import*as Ee from"ox/RpcRequest";import*as De from"ox/RpcResponse";import*as Oe from"ox/RpcSchema";import*as ke from"ox/Siwe";import*as Ae from"ox/PersonalMessage";import*as je from"ox/AbiError";import"ox/Authorization";import{getExecuteError as Me}from"viem/experimental/erc7821";import*as Ne from"ox/erc8010/SignatureErc8010";import{devtools as Pe,persist as Fe,subscribeWithSelector as Ie}from"zustand/middleware";import{createStore as Le}from"zustand/vanilla";import{createStore as Re,del as ze,get as Be,set as Ve}from"idb-keyval";var He=Object.create,Ue=Object.defineProperty,We=Object.getOwnPropertyDescriptor,Ge=Object.getOwnPropertyNames,Ke=Object.getPrototypeOf,qe=Object.prototype.hasOwnProperty,Je=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ye=(e,t)=>{let n={};for(var r in e)Ue(n,r,{get:e[r],enumerable:!0});return t&&Ue(n,Symbol.toStringTag,{value:`Module`}),n},Xe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Ge(t),a=0,o=i.length,s;a<o;a++)s=i[a],!qe.call(e,s)&&s!==n&&Ue(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=We(t,s))||r.enumerable});return e},Ze=(e,t,n)=>(n=e==null?{}:He(Ke(e)),Xe(t||!e||!e.__esModule?Ue(n,`default`,{value:e,enumerable:!0}):n,e)),Qe=Je(((e,t)=>{let n={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`};t.exports={cursor:n,scroll:{up:(e=1)=>`\x1B[S`.repeat(e),down:(e=1)=>`\x1B[T`.repeat(e)},erase:{screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let r=0;r<e;r++)t+=this.line+(r<e-1?n.up():``);return e&&(t+=n.left),t}},beep:`\x07`}})),$e=Je(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c})),N=Qe(),P=Ze($e(),1);function et({onlyFirst:e=!1}={}){let t=[`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))`,`(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))`].join(`|`);return new RegExp(t,e?void 0:`g`)}const tt=et();function nt(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(tt,``)}function rt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var it={exports:{}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(e){var t=e.charCodeAt(0),n=e.length==2?e.charCodeAt(1):0,r=t;return 55296<=t&&t<=56319&&56320<=n&&n<=57343&&(t&=1023,n&=1023,r=t<<10|n,r+=65536),r==12288||65281<=r&&r<=65376||65504<=r&&r<=65510?`F`:r==8361||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?`H`:4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?`W`:32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||r==172||r==175||10214<=r&&r<=10221||10629<=r&&r<=10630?`Na`:r==161||r==164||167<=r&&r<=168||r==170||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||r==198||r==208||215<=r&&r<=216||222<=r&&r<=225||r==230||232<=r&&r<=234||236<=r&&r<=237||r==240||242<=r&&r<=243||247<=r&&r<=250||r==252||r==254||r==257||r==273||r==275||r==283||294<=r&&r<=295||r==299||305<=r&&r<=307||r==312||319<=r&&r<=322||r==324||328<=r&&r<=331||r==333||338<=r&&r<=339||358<=r&&r<=359||r==363||r==462||r==464||r==466||r==468||r==470||r==472||r==474||r==476||r==593||r==609||r==708||r==711||713<=r&&r<=715||r==717||r==720||728<=r&&r<=731||r==733||r==735||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||r==1025||1040<=r&&r<=1103||r==1105||r==8208||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||r==8240||8242<=r&&r<=8243||r==8245||r==8251||r==8254||r==8308||r==8319||8321<=r&&r<=8324||r==8364||r==8451||r==8453||r==8457||r==8467||r==8470||8481<=r&&r<=8482||r==8486||r==8491||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||r==8585||8592<=r&&r<=8601||8632<=r&&r<=8633||r==8658||r==8660||r==8679||r==8704||8706<=r&&r<=8707||8711<=r&&r<=8712||r==8715||r==8719||r==8721||r==8725||r==8730||8733<=r&&r<=8736||r==8739||r==8741||8743<=r&&r<=8748||r==8750||8756<=r&&r<=8759||8764<=r&&r<=8765||r==8776||r==8780||r==8786||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||r==8853||r==8857||r==8869||r==8895||r==8978||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||r==9675||9678<=r&&r<=9681||9698<=r&&r<=9701||r==9711||9733<=r&&r<=9734||r==9737||9742<=r&&r<=9743||9748<=r&&r<=9749||r==9756||r==9758||r==9792||r==9794||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||r==9839||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||r==9955||9960<=r&&r<=9983||r==10045||r==10071||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||r==65533||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?`A`:`N`},t.characterLength=function(e){var t=this.eastAsianWidth(e);return t==`F`||t==`W`||t==`A`?2:1};function n(e){return e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(e){for(var t=n(e),r=0,i=0;i<t.length;i++)r+=this.characterLength(t[i]);return r},t.slice=function(e,r,i){textLen=t.length(e),r||=0,i||=1,r<0&&(r=textLen+r),i<0&&(i=textLen+i);for(var a=``,o=0,s=n(e),c=0;c<s.length;c++){var l=s[c],u=t.length(l);if(o>=r-(u==2?1:0))if(o+u<=i)a+=l;else break;o+=u}return a}})(it);var at=it.exports;const ot=rt(at),st=rt(function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\u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BC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2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E\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g});function ct(e,t={}){if(typeof e!=`string`||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=nt(e),e.length===0))return 0;e=e.replace(st(),` `);let n=t.ambiguousIsNarrow?1:2,r=0;for(let t of e){let e=t.codePointAt(0);if(!(e<=31||e>=127&&e<=159||e>=768&&e<=879))switch(ot.eastAsianWidth(t)){case`F`:case`W`:r+=2;break;case`A`:r+=n;break;default:r+=1}}return r}const lt=(e=0)=>t=>`\x1B[${t+e}m`,ut=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,dt=(e=0)=>(t,n,r)=>`\x1B[${38+e};2;${t};${n};${r}m`,F={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(F.modifier);const ft=Object.keys(F.color),pt=Object.keys(F.bgColor);[...ft,...pt];function mt(){let e=new Map;for(let[t,n]of Object.entries(F)){for(let[t,r]of Object.entries(n))F[t]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},n[t]=F[t],e.set(r[0],r[1]);Object.defineProperty(F,t,{value:n,enumerable:!1})}return Object.defineProperty(F,`codes`,{value:e,enumerable:!1}),F.color.close=`\x1B[39m`,F.bgColor.close=`\x1B[49m`,F.color.ansi=lt(),F.color.ansi256=ut(),F.color.ansi16m=dt(),F.bgColor.ansi=lt(10),F.bgColor.ansi256=ut(10),F.bgColor.ansi16m=dt(10),Object.defineProperties(F,{rgbToAnsi256:{value:(e,t,n)=>e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>F.rgbToAnsi256(...F.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,r;if(e>=232)t=((e-232)*10+8)/255,n=t,r=t;else{e-=16;let i=e%36;t=Math.floor(e/36)/5,n=Math.floor(i/6)/5,r=i%6/5}let i=Math.max(t,n,r)*2;if(i===0)return 30;let a=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>F.ansi256ToAnsi(F.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>F.ansi256ToAnsi(F.hexToAnsi256(e)),enumerable:!1}}),F}const ht=mt(),gt=new Set([`\x1B`,``]),_t=`]8;;`,vt=e=>`${gt.values().next().value}[${e}m`,yt=e=>`${gt.values().next().value}${_t}${e}`,bt=e=>e.split(` `).map(e=>ct(e)),xt=(e,t,n)=>{let r=[...t],i=!1,a=!1,o=ct(nt(e[e.length-1]));for(let[t,s]of r.entries()){let c=ct(s);if(o+c<=n?e[e.length-1]+=s:(e.push(s),o=0),gt.has(s)&&(i=!0,a=r.slice(t+1).join(``).startsWith(_t)),i){a?s===`\x07`&&(i=!1,a=!1):s===`m`&&(i=!1);continue}o+=c,o===n&&t<r.length-1&&(e.push(``),o=0)}!o&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},St=e=>{let t=e.split(` `),n=t.length;for(;n>0&&!(ct(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Ct=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=bt(e),s=[``];for(let[r,i]of e.split(` `).entries()){n.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let e=ct(s[s.length-1]);if(r!==0&&(e>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),e=0),(e>0||n.trim===!1)&&(s[s.length-1]+=` `,e++)),n.hard&&o[r]>t){let n=t-e,a=1+Math.floor((o[r]-n-1)/t);Math.floor((o[r]-1)/t)<a&&s.push(``),xt(s,i,t);continue}if(e+o[r]>t&&e>0&&o[r]>0){if(n.wordWrap===!1&&e<t){xt(s,i,t);continue}s.push(``)}if(e+o[r]>t&&n.wordWrap===!1){xt(s,i,t);continue}s[s.length-1]+=i}n.trim!==!1&&(s=s.map(e=>St(e)));let c=[...s.join(`
|
|
1
|
+
import*as e from"node:fs";import*as t from"node:os";import*as n from"node:path";import{setTimeout as r}from"node:timers/promises";import{stripVTControlCharacters as i}from"node:util";import a,{stdin as o,stdout as s}from"node:process";import*as c from"node:readline";import l from"node:readline";import{Writable as u}from"node:stream";import{BaseError as d,createClient as f,createTransport as p,custom as m,defineChain as h,fallback as g,getAddress as _,getTypesForEIP712Domain as v,hashMessage as y,hashTypedData as b,http as x,numberToHex as S,withCache as C,zeroAddress as w}from"viem";import*as ee from"viem/actions";import{getEip712Domain as te,verifyHash as ne,waitForCallsStatus as T}from"viem/actions";import{anvil as re,riseTestnet as ie,sepolia as ae}from"viem/chains";import*as oe from"ox/AbiFunction";import*as se from"ox/AbiParameters";import*as E from"ox/Address";import*as ce from"ox/Bytes";import*as le from"ox/Hash";import*as D from"ox/Hex";import*as ue from"ox/Json";import*as de from"ox/P256";import*as O from"ox/PublicKey";import*as k from"ox/Secp256k1";import*as fe from"ox/Signature";import*as pe from"ox/TypedData";import*as me from"ox/Value";import*as he from"ox/WebAuthnP256";import*as ge from"ox/WebCryptoP256";import*as _e from"mipd";import*as ve from"mipd-postmessage/child";import*as A from"zod/mini";import{z as j}from"zod/mini";import*as ye from"ox/Errors";import{toAccount as be}from"viem/accounts";import*as xe from"mipd-postmessage/parent";import*as M from"ox/Provider";import*as Se from"node:url";import{Json as Ce}from"ox";import*as we from"node:http";import*as Te from"ox/AbiItem";import*as Ee from"ox/RpcRequest";import*as De from"ox/RpcResponse";import*as Oe from"ox/RpcSchema";import*as ke from"ox/Siwe";import*as Ae from"ox/PersonalMessage";import*as je from"ox/AbiError";import"ox/Authorization";import{getExecuteError as Me}from"viem/experimental/erc7821";import*as Ne from"ox/erc8010/SignatureErc8010";import{devtools as Pe,persist as Fe,subscribeWithSelector as Ie}from"zustand/middleware";import{createStore as Le}from"zustand/vanilla";import{createStore as Re,del as ze,get as Be,set as Ve}from"idb-keyval";var He=Object.create,Ue=Object.defineProperty,We=Object.getOwnPropertyDescriptor,Ge=Object.getOwnPropertyNames,Ke=Object.getPrototypeOf,qe=Object.prototype.hasOwnProperty,Je=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ye=(e,t)=>{let n={};for(var r in e)Ue(n,r,{get:e[r],enumerable:!0});return t&&Ue(n,Symbol.toStringTag,{value:`Module`}),n},Xe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Ge(t),a=0,o=i.length,s;a<o;a++)s=i[a],!qe.call(e,s)&&s!==n&&Ue(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=We(t,s))||r.enumerable});return e},Ze=(e,t,n)=>(n=e==null?{}:He(Ke(e)),Xe(t||!e||!e.__esModule?Ue(n,`default`,{value:e,enumerable:!0}):n,e)),Qe=Je(((e,t)=>{let n={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`};t.exports={cursor:n,scroll:{up:(e=1)=>`\x1B[S`.repeat(e),down:(e=1)=>`\x1B[T`.repeat(e)},erase:{screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let r=0;r<e;r++)t+=this.line+(r<e-1?n.up():``);return e&&(t+=n.left),t}},beep:`\x07`}})),$e=Je(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c})),N=Qe(),P=Ze($e(),1);function et({onlyFirst:e=!1}={}){let t=[`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))`,`(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))`].join(`|`);return new RegExp(t,e?void 0:`g`)}const tt=et();function nt(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(tt,``)}function rt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var it={exports:{}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(e){var t=e.charCodeAt(0),n=e.length==2?e.charCodeAt(1):0,r=t;return 55296<=t&&t<=56319&&56320<=n&&n<=57343&&(t&=1023,n&=1023,r=t<<10|n,r+=65536),r==12288||65281<=r&&r<=65376||65504<=r&&r<=65510?`F`:r==8361||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?`H`:4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?`W`:32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||r==172||r==175||10214<=r&&r<=10221||10629<=r&&r<=10630?`Na`:r==161||r==164||167<=r&&r<=168||r==170||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||r==198||r==208||215<=r&&r<=216||222<=r&&r<=225||r==230||232<=r&&r<=234||236<=r&&r<=237||r==240||242<=r&&r<=243||247<=r&&r<=250||r==252||r==254||r==257||r==273||r==275||r==283||294<=r&&r<=295||r==299||305<=r&&r<=307||r==312||319<=r&&r<=322||r==324||328<=r&&r<=331||r==333||338<=r&&r<=339||358<=r&&r<=359||r==363||r==462||r==464||r==466||r==468||r==470||r==472||r==474||r==476||r==593||r==609||r==708||r==711||713<=r&&r<=715||r==717||r==720||728<=r&&r<=731||r==733||r==735||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||r==1025||1040<=r&&r<=1103||r==1105||r==8208||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||r==8240||8242<=r&&r<=8243||r==8245||r==8251||r==8254||r==8308||r==8319||8321<=r&&r<=8324||r==8364||r==8451||r==8453||r==8457||r==8467||r==8470||8481<=r&&r<=8482||r==8486||r==8491||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||r==8585||8592<=r&&r<=8601||8632<=r&&r<=8633||r==8658||r==8660||r==8679||r==8704||8706<=r&&r<=8707||8711<=r&&r<=8712||r==8715||r==8719||r==8721||r==8725||r==8730||8733<=r&&r<=8736||r==8739||r==8741||8743<=r&&r<=8748||r==8750||8756<=r&&r<=8759||8764<=r&&r<=8765||r==8776||r==8780||r==8786||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||r==8853||r==8857||r==8869||r==8895||r==8978||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||r==9675||9678<=r&&r<=9681||9698<=r&&r<=9701||r==9711||9733<=r&&r<=9734||r==9737||9742<=r&&r<=9743||9748<=r&&r<=9749||r==9756||r==9758||r==9792||r==9794||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||r==9839||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||r==9955||9960<=r&&r<=9983||r==10045||r==10071||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||r==65533||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?`A`:`N`},t.characterLength=function(e){var t=this.eastAsianWidth(e);return t==`F`||t==`W`||t==`A`?2:1};function n(e){return e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(e){for(var t=n(e),r=0,i=0;i<t.length;i++)r+=this.characterLength(t[i]);return r},t.slice=function(e,r,i){textLen=t.length(e),r||=0,i||=1,r<0&&(r=textLen+r),i<0&&(i=textLen+i);for(var a=``,o=0,s=n(e),c=0;c<s.length;c++){var l=s[c],u=t.length(l);if(o>=r-(u==2?1:0))if(o+u<=i)a+=l;else break;o+=u}return a}})(it);var at=it.exports;const ot=rt(at),st=rt(function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uD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DBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\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uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g});function ct(e,t={}){if(typeof e!=`string`||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=nt(e),e.length===0))return 0;e=e.replace(st(),` `);let n=t.ambiguousIsNarrow?1:2,r=0;for(let t of e){let e=t.codePointAt(0);if(!(e<=31||e>=127&&e<=159||e>=768&&e<=879))switch(ot.eastAsianWidth(t)){case`F`:case`W`:r+=2;break;case`A`:r+=n;break;default:r+=1}}return r}const lt=(e=0)=>t=>`\x1B[${t+e}m`,ut=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,dt=(e=0)=>(t,n,r)=>`\x1B[${38+e};2;${t};${n};${r}m`,F={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(F.modifier);const ft=Object.keys(F.color),pt=Object.keys(F.bgColor);[...ft,...pt];function mt(){let e=new Map;for(let[t,n]of Object.entries(F)){for(let[t,r]of Object.entries(n))F[t]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},n[t]=F[t],e.set(r[0],r[1]);Object.defineProperty(F,t,{value:n,enumerable:!1})}return Object.defineProperty(F,`codes`,{value:e,enumerable:!1}),F.color.close=`\x1B[39m`,F.bgColor.close=`\x1B[49m`,F.color.ansi=lt(),F.color.ansi256=ut(),F.color.ansi16m=dt(),F.bgColor.ansi=lt(10),F.bgColor.ansi256=ut(10),F.bgColor.ansi16m=dt(10),Object.defineProperties(F,{rgbToAnsi256:{value:(e,t,n)=>e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>F.rgbToAnsi256(...F.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,r;if(e>=232)t=((e-232)*10+8)/255,n=t,r=t;else{e-=16;let i=e%36;t=Math.floor(e/36)/5,n=Math.floor(i/6)/5,r=i%6/5}let i=Math.max(t,n,r)*2;if(i===0)return 30;let a=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>F.ansi256ToAnsi(F.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>F.ansi256ToAnsi(F.hexToAnsi256(e)),enumerable:!1}}),F}const ht=mt(),gt=new Set([`\x1B`,``]),_t=`]8;;`,vt=e=>`${gt.values().next().value}[${e}m`,yt=e=>`${gt.values().next().value}${_t}${e}`,bt=e=>e.split(` `).map(e=>ct(e)),xt=(e,t,n)=>{let r=[...t],i=!1,a=!1,o=ct(nt(e[e.length-1]));for(let[t,s]of r.entries()){let c=ct(s);if(o+c<=n?e[e.length-1]+=s:(e.push(s),o=0),gt.has(s)&&(i=!0,a=r.slice(t+1).join(``).startsWith(_t)),i){a?s===`\x07`&&(i=!1,a=!1):s===`m`&&(i=!1);continue}o+=c,o===n&&t<r.length-1&&(e.push(``),o=0)}!o&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},St=e=>{let t=e.split(` `),n=t.length;for(;n>0&&!(ct(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Ct=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=bt(e),s=[``];for(let[r,i]of e.split(` `).entries()){n.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let e=ct(s[s.length-1]);if(r!==0&&(e>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),e=0),(e>0||n.trim===!1)&&(s[s.length-1]+=` `,e++)),n.hard&&o[r]>t){let n=t-e,a=1+Math.floor((o[r]-n-1)/t);Math.floor((o[r]-1)/t)<a&&s.push(``),xt(s,i,t);continue}if(e+o[r]>t&&e>0&&o[r]>0){if(n.wordWrap===!1&&e<t){xt(s,i,t);continue}s.push(``)}if(e+o[r]>t&&n.wordWrap===!1){xt(s,i,t);continue}s[s.length-1]+=i}n.trim!==!1&&(s=s.map(e=>St(e)));let c=[...s.join(`
|
|
2
2
|
`)];for(let[e,t]of c.entries()){if(r+=t,gt.has(t)){let{groups:t}=RegExp(`(?:\\[(?<code>\\d+)m|\\${_t}(?<uri>.*))`).exec(c.slice(e).join(``))||{groups:{}};if(t.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}let n=ht.codes.get(Number(i));c[e+1]===`
|
|
3
3
|
`?(a&&(r+=yt(``)),i&&n&&(r+=vt(n))):t===`
|
|
4
4
|
`&&(i&&n&&(r+=vt(i)),a&&(r+=yt(a)))}return r};function wt(e,t,n){return String(e).normalize().replace(/\r\n/g,`
|
|
@@ -31,7 +31,7 @@ ${$t}${t.trimStart()}`),n=3+i(t.trimStart()).length)}process.stdout.write(`
|
|
|
31
31
|
`);process.stdout.write(N.cursor.move(-999,e.length-1)),process.stdout.write(N.erase.down(e.length))},g=e=>e.replace(/\.+$/,``),_=e=>{let t=(performance.now()-e)/1e3,n=Math.floor(t/60),r=Math.floor(t%60);return n>0?`[${n}m ${r}s]`:`[${r}s]`},v=(u=``)=>{o=!0,i=jt(),s=g(u),l=performance.now(),process.stdout.write(`${P.default.gray(R)}
|
|
32
32
|
`);let d=0,f=0;p(),a=setInterval(()=>{if(r&&s===c)return;h(),c=s;let n=P.default.magenta(t[d]);if(r)process.stdout.write(`${n} ${s}...`);else if(e===`timer`)process.stdout.write(`${n} ${s} ${_(l)}`);else{let e=`.`.repeat(Math.floor(f)).slice(0,3);process.stdout.write(`${n} ${s}${e}`)}d=d+1<t.length?d+1:0,f=f<t.length?f+.125:0},n)},y=(t=``,n=0)=>{o=!1,clearInterval(a),h();let r=n===0?P.default.green(Vt):n===1?P.default.red(zt):P.default.red(Bt);s=g(t??s),e===`timer`?process.stdout.write(`${r} ${s} ${_(l)}
|
|
33
33
|
`):process.stdout.write(`${r} ${s}
|
|
34
|
-
`),m(),i()};return{start:v,stop:y,message:(e=``)=>{s=g(e??s)}}};var nn=Ye({
|
|
34
|
+
`),m(),i()};return{start:v,stop:y,message:(e=``)=>{s=g(e??s)}}};var nn=Ye({riseTestnet:()=>ie,sepolia:()=>ae});const rn=[ie,...Object.values(nn).filter(e=>e.id!==ie.id)],an=re;({...an}),{...an};const on=`0x3232323232323232323232323232323232323232`,sn=`0x32323232`,cn=ve.createStore(),ln=_e.createStore();async function un(e){let t=cn.getProviders().filter(e=>e.info.rdns!==`com.risechain.wallet`);return ln.getProviders().filter(e=>e.info.rdns!==`com.risechain.wallet`).find(t=>t.info.rdns===e.rdns)??t.find(t=>t.info.rdns===e.rdns)}const dn={p256:`p256`,secp256k1:`secp256k1`,webauthnp256:`webauthn-p256`},fn={admin:`admin`,normal:`session`},pn={0:`minute`,1:`hour`,2:`day`,3:`week`,4:`month`,5:`year`},mn={address:`secp256k1`,eip1193provider:`secp256k1`,p256:`p256`,secp256k1:`secp256k1`,"webauthn-p256":`webauthnp256`},hn={admin:`admin`,session:`normal`},gn={address:2,eip1193provider:2,p256:0,secp256k1:2,"webauthn-p256":1},_n={day:2,hour:1,minute:0,month:4,week:3,year:5};function vn(e={}){let t=de.randomPrivateKey();return wn({...e,privateKey:t})}function yn(e={}){let t=k.randomPrivateKey();return En({...e,privateKey:t})}async function bn(e){let{createFn:t,label:n,rpId:r,userId:i}=e,a=await he.createCredential({authenticatorSelection:{requireResidentKey:!0,residentKey:`required`,userVerification:`required`},createFn:t,extensions:{credProps:!0},rp:r?{id:r,name:r}:void 0,user:{displayName:n,id:new Uint8Array(i??ce.fromString(n)),name:n}});return Dn({...e,credential:{id:a.id,publicKey:a.publicKey},id:i?ce.toHex(i):O.toHex(a.publicKey,{includePrefix:!1})})}function xn(e={}){let t=de.randomPrivateKey();return On({...e,privateKey:t})}async function Sn(e={}){let t=await ge.createKeyPair();return kn({...e,keyPair:t})}async function Cn(e){let{rdns:t}=e,{provider:n=void 0}=await un({rdns:t})??{};if(!n)throw Error(`No provider found`);let[r]=await n.request({method:`eth_requestAccounts`});if(!r)throw Error(`No account found`);return An({...e,account:r})}function B(e,t={}){let{chainId:n=e.chainId}=t,{expiry:r=0,id:i,prehash:a=!1,role:o=`admin`,type:s}=e,c=(()=>{let t=e.publicKey;return t===`0x`?t:s===`secp256k1`||s===`address`||s===`eip1193provider`?D.size(t)===20||D.toBigInt(D.slice(t,0,12))===0n?D.slice(t,-20):E.fromPublicKey(O.fromHex(t)):t})();return{...e,chainId:n,expiry:r,hash:jn({publicKey:c,type:s}),id:(i??c).toLowerCase(),prehash:a,publicKey:c.toLowerCase(),role:o,type:s}}function wn(e){let{chainId:t,expiry:n,feeToken:r,permissions:i,privateKey:a,role:o}=e;return B({chainId:t,expiry:n,feeToken:r,permissions:i,privateKey(){return a},publicKey:O.toHex(de.getPublicKey({privateKey:a}),{includePrefix:!1}),role:o,type:`p256`})}function Tn(e,t){let{chainId:n}=t,{publicKey:r}=e,i=D.size(r)===20||D.toBigInt(D.slice(r,0,12))===0n,a={};for(let t of e.permissions)t.type===`call`&&(a.calls??=[],a.calls.push({signature:t.selector,to:t.to===on?void 0:t.to})),t.type===`spend`&&(a.spend??=[],a.spend.push({limit:t.limit,period:t.period,token:t.token}));return B({chainId:n,expiry:e.expiry,permissions:a,publicKey:e.publicKey,role:fn[e.role],type:i?`address`:dn[e.type]})}function En(e){let{privateKey:t,role:n}=e,r=e.publicKey?e.publicKey:t?E.fromPublicKey(k.getPublicKey({privateKey:t})):e.address.toLowerCase();return B({expiry:e.expiry??0,feeToken:e.feeToken,permissions:e.permissions,privateKey:t?()=>t:void 0,publicKey:r,role:n,type:`secp256k1`})}function Dn(e){let{credential:t,id:n,rpId:r}=e,i=O.toHex(t.publicKey,{includePrefix:!1});return B({chainId:e.chainId,expiry:e.expiry??0,feeToken:e.feeToken,id:n,permissions:e.permissions,privateKey:{credential:t,rpId:r},publicKey:i,role:e.role,type:`webauthn-p256`})}function On(e){let{privateKey:t}=e,n=O.toHex(de.getPublicKey({privateKey:t}),{includePrefix:!1});return B({chainId:e.chainId,expiry:e.expiry??0,feeToken:e.feeToken,permissions:e.permissions,privateKey:{privateKey(){return t}},publicKey:n,role:e.role,type:`webauthn-p256`})}function kn(e){let{chainId:t,expiry:n,feeToken:r,keyPair:i,permissions:a,role:o}=e,{privateKey:s}=i;return B({chainId:t,expiry:n,feeToken:r,permissions:a,prehash:!0,privateKey:s,publicKey:O.toHex(i.publicKey,{includePrefix:!1}),role:o,type:`p256`})}function An(e){let{account:t,rdns:n}=e;return B({...e,privateKey:{rdns:n},publicKey:t,type:`eip1193provider`})}function jn(e){let{type:t}=e,n=Mn(e.publicKey);return le.keccak256(se.encode([{type:`uint8`},{type:`bytes32`}],[gn[t],le.keccak256(n)]))}function Mn(e){return D.size(e)<32?D.padLeft(e,32):e}async function V(e,t){let{address:n,storage:r,webAuthn:i,wrap:a=!0,typedData:o}=t,{privateKey:s,publicKey:c,type:l}=e;if(!s)throw Error(`Key does not have a private key to sign with.
|
|
35
35
|
|
|
36
36
|
Key:
|
|
37
37
|
`+ue.stringify(e,null,2));let u=n?pe.getSignPayload({domain:{verifyingContract:n},message:{digest:t.payload},primaryType:`ERC1271Sign`,types:{ERC1271Sign:[{name:`digest`,type:`bytes32`}]}}):t.payload,[d,f]=await(async()=>{if(l===`p256`){let{privateKey:t}=e;if(typeof t==`function`)return[fe.toHex(de.sign({payload:u,privateKey:t()})),!1];if(t instanceof CryptoKey)return[fe.toHex(await ge.sign({payload:u,privateKey:t})),!0]}if(l===`secp256k1`)return[fe.toHex(k.sign({payload:u,privateKey:s()})),!1];if(l===`webauthn-p256`){if(s.privateKey){let{payload:e,metadata:t}=he.getSignPayload({challenge:u,origin:`https://ithaca.xyz`,rpId:`ithaca.xyz`}),{r:n,s:r}=de.sign({hash:!0,payload:e,privateKey:s.privateKey()});return[In({metadata:t,signature:{r:n,s:r}}),!1]}let{credential:t,rpId:n}=s,a=`porto.webauthnVerified.${e.hash}`,o=Date.now(),c=!0;if(r){let e=await r.getItem(a);c=!e||o-e>6e5}let{signature:{r:l,s:d},raw:f,metadata:p}=await he.sign({challenge:u,credentialId:t.id,getFn:i?.getFn,rpId:n,userVerification:c?`required`:`preferred`}),m=f.response;if(!m?.userHandle)throw Error(`No user handle in response`,{cause:{response:m}});let h=ce.toHex(new Uint8Array(m.userHandle));if(e.id&&E.validate(e.id)&&!E.isEqual(e.id,h))throw Error(`supplied webauthn key "${e.id}" does not match signature webauthn key "${h}"`,{cause:{id:h,key:e}});return c&&r&&await r.setItem(a,o),[In({metadata:p,signature:{r:l,s:d}}),!1]}if(l===`eip1193provider`){let{provider:t=void 0}=await un({rdns:s.rdns})??{};if(!t)throw Error(`No provider found for key "${e.id}"`);if(!o)return[await t.request({method:`personal_sign`,params:[u,c]}),!1];if(o.domain?.chainId){let e=o.domain.chainId;try{await t.request({method:`wallet_switchEthereumChain`,params:[{chainId:`0x${o.domain.chainId.toString(16)}`}]})}catch(n){if(`code`in n&&n.code===4902){let n=await import(`viem/chains`),r=Object.values(n).find(t=>t.id===e);if(!r)throw Error(`Not connected to chain ${o.domain.chainId}`);await t.request({method:`wallet_addEthereumChain`,params:[{blockExplorerUrls:r.blockExplorers?.default.url?[r.blockExplorers.default.url]:void 0,chainId:`0x${r.id.toString(16)}`,chainName:r.name,nativeCurrency:{decimals:r.nativeCurrency.decimals,name:r.nativeCurrency.name,symbol:r.nativeCurrency.symbol},rpcUrls:r.rpcUrls.default.http}]})}else throw n}}return[await t.request({method:`eth_signTypedData_v4`,params:[c,JSON.stringify({...o,types:{EIP712Domain:v({domain:o.domain}),...o.types}})]}),!1]}throw Error(`Key type "${l}" is not supported.\n\nKey:\n`+ue.stringify(e,null,2))})();return a?Ln(d,{keyType:l,prehash:f,publicKey:c}):d}function Nn(e,t={}){let{expiry:n=0,prehash:r=!1,publicKey:i,role:a=`admin`,type:o}=e,{feeTokens:s,orchestrator:c}=t,l=Object.entries(Pn(e,{feeTokens:s})).map(([e,t])=>{if(e===`calls`)return t.map(({signature:e,to:t})=>({selector:e?D.validate(e)?e:oe.getSelector(e):sn,to:t??on,type:`call`}));if(e!==`feeToken`){if(e===`spend`)return t.map(({limit:e,period:t,token:n})=>({limit:e,period:t,token:n,type:`spend`}));throw Error(`Invalid permission type "${e}".`)}}).flat().filter(Boolean);return e.role===`session`&&c&&l.push({selector:sn,to:c,type:`call`}),{expiry:n,permissions:l??[],prehash:r,publicKey:Mn(i),role:hn[a],type:mn[o]}}function Pn(e,t){let{permissions:n}=e,r=n?.calls?[...n.calls]:[],i=n?.spend?[...n.spend]:[],a=t.feeTokens?.filter(e=>e.feeToken);if(a&&a.length>0){let t=Fn(e,{feeTokens:a});if(t){let e=-1,n=_n.year;for(let r=0;r<i.length;r++){let a=i[r];if(a.token&&E.isEqual(t.address,a.token)){e=r;break}if(!a.token&&t.address===w){e=r;break}let o=_n[a.period];o<n&&(n=o)}e===-1?typeof n==`number`&&i.unshift({limit:t.value,period:pn[n],token:t.address}):(i[e]={...i[e],limit:i[e].limit+t.value},i.unshift(i.splice(e,1)[0]))}}return{...n,calls:r,spend:i}}function Fn(e,t){let{feeTokens:n}=t;if(!e.feeToken)return;let r=n.find(t=>e.feeToken.symbol===t.symbol?!0:!e.feeToken.symbol||e.feeToken.symbol===`native`?t.address===w:!1);if(!r)return;let i=me.from(e.feeToken.limit,r.decimals);return{...r,value:i}}function In(e){let{metadata:t,signature:n}=e;return se.encode(se.from([`struct WebAuthnAuth { bytes authenticatorData; string clientDataJSON; uint256 challengeIndex; uint256 typeIndex; bytes32 r; bytes32 s; }`,`WebAuthnAuth auth`]),[{authenticatorData:t.authenticatorData,challengeIndex:BigInt(t.challengeIndex),clientDataJSON:t.clientDataJSON,r:D.fromNumber(n.r,{size:32}),s:D.fromNumber(n.s,{size:32}),typeIndex:BigInt(t.typeIndex)}])}function Ln(e,t){let{keyType:n,prehash:r=!1,publicKey:i}=t,a=jn({publicKey:i,type:n});return se.encodePacked([`bytes`,`bytes32`,`bool`],[e,a,r])}const H=()=>A.templateLiteral([`0x`,A.string()],{message:`Needs string in format ^0x[A-Fa-f0-9]{40}$.`}),U=()=>A.templateLiteral([`0x`,A.string()],{message:`Needs string in format ^0x[A-Fa-f0-9]+$.`}),W=()=>A.codec(U(),A.number(),{decode:e=>D.toNumber(e),encode:e=>D.fromNumber(e)}),G=()=>A.codec(U(),A.bigint({message:`Required bigint`}),{decode:e=>D.toBigInt(e),encode:e=>D.fromNumber(e)});function Rn(e){return A.union(e)}var zn=class extends ye.BaseError{name=`Schema.ValidationError`};function Bn(e){let t=e,n=`Validation failed with ${t.issues.length} error${t.issues.length===1?``:`s`}:`;n+=`
|
|
@@ -44,7 +44,7 @@ Key:
|
|
|
44
44
|
background: transparent!important;
|
|
45
45
|
}
|
|
46
46
|
`,f.appendChild(h),f.appendChild(p),xe.expose({child:p.contentWindow,origin:d.origin,store:i});let g=Zi({from:Xi(window,{targetOrigin:d.origin}),to:Xi(p.contentWindow,{targetOrigin:d.origin}),waitForReady:!0});s?._setup(g,!0);let _=window.matchMedia(`(max-width: 460px)`),v=()=>{g.send(`__internal`,{type:`resize`,width:_.matches?460:461})};_.addEventListener(`change`,v),g.on(`ready`,t=>{let n=e.internal.store.getState().chainIds.filter(e=>t.chainIds.includes(e));n.length===0&&(n=t.chainIds),c.setState(e=>({...e,chainIds:n})),g.send(`__internal`,{chainIds:n,mode:`iframe`,referrer:aa(),theme:o,type:`init`}),v()}),g.on(`rpc-response`,e=>{r([e._request])&&(p.src=p.src),sa(c,e)}),g.on(`__internal`,e=>{e.type===`switch`&&e.mode===`popup`&&(l.open(),l.syncRequests(c.getState().requestQueue))});let y=null,b=null,x=()=>oa(c),S=e=>{e.key===`Escape`&&oa(c)},C=new MutationObserver(e=>{for(let t of e){if(t.type!==`attributes`)continue;let e=t.attributeName;e&&e===`inert`&&f.removeAttribute(e)}});C.observe(f,{attributeOldValue:!0,attributes:!0});let w=!1,ee=()=>{w&&(w=!1,f.removeEventListener(`click`,x),document.removeEventListener(`keydown`,S),f.style.pointerEvents=`none`,b?.focus(),b=null,Object.assign(document.body.style,y??``),document.body.style.overflow=y?.overflow??``)},te=()=>{w||(w=!0,f.addEventListener(`click`,x),document.addEventListener(`keydown`,S),p.focus(),f.style.pointerEvents=`auto`,y=Object.assign({},document.body.style),document.body.style.overflow=`hidden`)},ne=!1,T=()=>{ne||(ne=!0,document.activeElement instanceof HTMLElement&&(b=document.activeElement),f.removeAttribute(`hidden`),f.removeAttribute(`aria-closed`),f.showModal())},re=()=>{if(ne){ne=!1,f.setAttribute(`hidden`,`true`),f.setAttribute(`aria-closed`,`true`),f.close();for(let e of f.parentNode?Array.from(f.parentNode.children):[])e!==f&&e.hasAttribute(`inert`)&&e.removeAttribute(`inert`)}};return{close(){l.close(),u=!1,g.send(`__internal`,{mode:`iframe`,referrer:aa(),type:`init`}),re(),ee()},destroy(){l.close(),u=!1,ee(),re(),l.destroy(),g.destroy(),f.remove(),C.disconnect(),_.removeEventListener(`change`,v)},open(){u||(u=!0,T(),te(),g.send(`__internal`,{mode:`iframe`,referrer:aa(),type:`init`}))},async secure(){let{trustedHosts:e}=await g.waitForReady(),n=(()=>{if(t)return!0;let e=window.location.protocol.startsWith(`https`);return e||zi.warnOnce(`Detected insecure protocol (HTTP).`,`\n\nThe Porto iframe is not supported on HTTP origins (${window.location.origin})`,`due to lack of WebAuthn support.`,`See https://porto.sh/sdk#secure-origins-https for more information.`),e})(),r=Li(),i=!!e?.includes(window.location.hostname),a=!!(r||i);return a||zi.warnOnce([`Warning: Browser does not support IntersectionObserver v2 or host "${d.hostname}" is not trusted by Porto.`,`This may result in the dialog falling back to a popup.`,``,`Add "${d.hostname}" to the trusted hosts list to enable iframe dialog: https://github.com/ithacaxyz/porto/edit/main/src/trusted-hosts.ts`].join(`
|
|
47
|
-
`)),{frame:a,host:i,protocol:n}},async syncRequests(e){let{methodPolicies:t}=await g.waitForReady(),n=await this.secure(),i=e?.every(e=>t?.find(t=>t.method===e.request.method)?.modes?.headless===!0),a=r(e.map(e=>e.request));if(!i&&(a||!n.protocol||!n.frame))l.syncRequests(e);else{let n=e.some(e=>ia(e.request,{methodPolicies:t,targetOrigin:d.origin}));!u&&n&&this.open(),g.send(`rpc-requests`,e)}}}},supportsHeadless:!0})}function ta(e={}){if(typeof window>`u`)return na();let{type:t=`auto`,size:n=ra}=e;return $i({name:`popup`,setup(e){let{host:r,internal:i,themeController:a}=e,{store:o}=i,s=new URL(r),c=null,l=t===`page`||t===`auto`&&Ui()?`page`:`popup`;function u(){c&&oa(o)}let d=(()=>{let e=setInterval(()=>{c?.closed&&oa(o)},100);return()=>clearInterval(e)})(),f;return a?._setup(null,!0),{close(){c&&=(c.close(),null)},destroy(){this.close(),window.removeEventListener(`focus`,u),f?.destroy(),d()},open(){if(l===`popup`){let e=(window.innerWidth-n.width)/2+window.screenX,t=window.screenY+100;c=window.open(ca(r),`_blank`,`width=${n.width},height=${n.height},left=${e},top=${t}`)}else c=window.open(ca(r),`_blank`);if(!c)throw Error(`Failed to open popup`);f=Zi({from:Xi(window,{targetOrigin:s.origin}),to:Xi(c,{targetOrigin:s.origin}),waitForReady:!0}),a?._setup(f,!1),f.send(`__internal`,{mode:l===`page`?`page`:`popup`,referrer:aa(),theme:a?.getTheme()??e.theme,type:`init`}),f.on(`rpc-response`,e=>sa(o,e)),window.removeEventListener(`focus`,u),window.addEventListener(`focus`,u)},async secure(){return{frame:!0,host:!0,protocol:!0}},async syncRequests(e){e.some(e=>ia(e.request))&&((!c||c.closed)&&this.open(),c?.focus()),f?.send(`rpc-requests`,e)}}},supportsHeadless:!1})}function na(){return $i({name:`noop`,setup(){return{close(){},destroy(){},open(){},async secure(){return{frame:!0,host:!0,protocol:!0}},async syncRequests(){}}},supportsHeadless:!0})}const ra={height:282,width:360};function ia(e,t={}){let{methodPolicies:n,targetOrigin:r}=t,i=n?.find(t=>t.method===e.method);return i&&i.modes?.headless
|
|
47
|
+
`)),{frame:a,host:i,protocol:n}},async syncRequests(e){let{methodPolicies:t}=await g.waitForReady(),n=await this.secure(),i=e?.every(e=>t?.find(t=>t.method===e.request.method)?.modes?.headless===!0),a=r(e.map(e=>e.request));if(!i&&(a||!n.protocol||!n.frame))l.syncRequests(e);else{let n=e.some(e=>ia(e.request,{methodPolicies:t,targetOrigin:d.origin}));!u&&n&&this.open(),g.send(`rpc-requests`,e)}}}},supportsHeadless:!0})}function ta(e={}){if(typeof window>`u`)return na();let{type:t=`auto`,size:n=ra}=e;return $i({name:`popup`,setup(e){let{host:r,internal:i,themeController:a}=e,{store:o}=i,s=new URL(r),c=null,l=t===`page`||t===`auto`&&Ui()?`page`:`popup`;function u(){c&&oa(o)}let d=(()=>{let e=setInterval(()=>{c?.closed&&oa(o)},100);return()=>clearInterval(e)})(),f;return a?._setup(null,!0),{close(){c&&=(c.close(),null)},destroy(){this.close(),window.removeEventListener(`focus`,u),f?.destroy(),d()},open(){if(l===`popup`){let e=(window.innerWidth-n.width)/2+window.screenX,t=window.screenY+100;c=window.open(ca(r),`_blank`,`width=${n.width},height=${n.height},left=${e},top=${t}`)}else c=window.open(ca(r),`_blank`);if(!c)throw Error(`Failed to open popup`);f=Zi({from:Xi(window,{targetOrigin:s.origin}),to:Xi(c,{targetOrigin:s.origin}),waitForReady:!0}),a?._setup(f,!1),f.send(`__internal`,{mode:l===`page`?`page`:`popup`,referrer:aa(),theme:a?.getTheme()??e.theme,type:`init`}),f.on(`rpc-response`,e=>sa(o,e)),window.removeEventListener(`focus`,u),window.addEventListener(`focus`,u)},async secure(){return{frame:!0,host:!0,protocol:!0}},async syncRequests(e){e.some(e=>ia(e.request))&&((!c||c.closed)&&this.open(),c?.focus()),f?.send(`rpc-requests`,e)}}},supportsHeadless:!1})}function na(){return $i({name:`noop`,setup(){return{close(){},destroy(){},open(){},async secure(){return{frame:!0,host:!0,protocol:!0}},async syncRequests(){}}},supportsHeadless:!0})}const ra={height:282,width:360};function ia(e,t={}){let{methodPolicies:n,targetOrigin:r}=t,i=n?.find(t=>t.method===e.method);return i&&i.modes?.headless?(typeof i.modes.headless==`object`&&(i.modes.headless.sameOrigin&&r===window.location.origin||i.modes.headless.privilegedOrigins?.some(e=>window.location.origin.endsWith(e))),!1):!0}function aa(){return{icon:(()=>{let e=document.querySelector(`link[rel="icon"][media="(prefers-color-scheme: dark)"]`)?.href,t=document.querySelector(`link[rel="icon"][media="(prefers-color-scheme: light)"]`)?.href??document.querySelector(`link[rel="icon"]`)?.href;return e&&t&&e!==t?{dark:e,light:t}:window.matchMedia(`(prefers-color-scheme: dark)`).matches?e:t})(),title:document.title}}function oa(e){e.setState(e=>({...e,requestQueue:e.requestQueue.map(e=>({account:e.account,error:new M.UserRejectedRequestError,request:e.request,status:`error`}))}))}function sa(e,t){e.setState(e=>({...e,requestQueue:e.requestQueue.map(e=>e.request.id===t.id?t.error?{account:e.account,error:t.error,request:e.request,status:`error`}:{account:e.account,request:e.request,result:t.result,status:`success`}:e)}))}function ca(e){let t=new URL(e),n=new URLSearchParams(window.location.search);for(let[e,r]of n.entries())e.startsWith(`porto.`)&&t.searchParams.set(e.slice(6),r);return t.toString()}function la(e){let t=we.createServer(e);return new Promise((e,n)=>{t.on(`error`,n),t.listen(()=>{let{port:n}=t.address();e(Object.assign(t,{closeAsync(){return new Promise((e,n)=>t.close(t=>t?n(t):e(void 0)))},url:`http://localhost:${n}`}))})})}async function ua(){let e=new Map,t=new Set,n=new Set,r=await la((r,i)=>{let a=Se.parse(r.url,!0);if(i.setHeader(`Access-Control-Allow-Origin`,`*`),i.setHeader(`Access-Control-Allow-Methods`,`GET, POST, OPTIONS`),i.setHeader(`Access-Control-Allow-Headers`,`Content-Type`),i.setHeader(`Access-Control-Allow-Private-Network`,`true`),r.method===`OPTIONS`){i.writeHead(200),i.end();return}if(r.method===`GET`&&a.pathname===`/`){i.writeHead(200,{"Access-Control-Allow-Origin":`*`,"Cache-Control":`no-cache`,Connection:`keep-alive`,"Content-Type":`text/event-stream`}),t.add(i),r.on(`close`,()=>t.delete(i));return}if(r.method===`POST`&&a.pathname===`/`){let t=``;r.on(`data`,e=>t+=e.toString()),r.on(`end`,()=>{try{let n=JSON.parse(t);if(n.topic&&n.payload!==void 0){let t=e.get(n.topic);if(t){let e={data:n,origin:`http://localhost`};for(let r of t)r(n.payload,e)}}i.writeHead(200,{"Content-Type":`text/plain`}),i.end(`ok`)}catch{i.writeHead(400,{"Content-Type":`text/plain`}),i.end(`Invalid JSON`)}})}else r.method===`GET`&&a.pathname===`/.well-known/keys`?(i.writeHead(200,{"Access-Control-Allow-Origin":`*`,"Content-Type":`application/json`}),i.end(JSON.stringify({keys:Array.from(n)}))):(i.writeHead(404,{"Content-Type":`text/plain`}),i.end(`not found`))}),i=r.url,a=Wi(),o={destroy(){e.clear();for(let e of t)try{e.end()}catch{}t.clear(),r.close()},on(t,n){return e.has(t)||e.set(t,new Set),e.get(t).add(n),()=>{let r=e.get(t);r&&(r.delete(n),r.size===0&&e.delete(t))}},registerPublicKey(e){n.add(e)},relayUrl:i,async send(e,n){let r=qi(),i={id:r,payload:n,topic:e},a=`data: ${Ce.stringify(i)}\n\n`;for(let e of t)try{e.write(a)}catch{t.delete(e)}return{id:r,payload:n,topic:e}},async sendAsync(){throw Error(`Not implemented`)},waitForReady(){return o.on(`ready`,a.resolve),a.promise}};return o}const X=await ua();async function da(){let e=!1;return $i({name:`cli`,setup(t){return X.on(`rpc-response`,e=>{sa(t.internal.store,e)}),X.on(`ready`,()=>{let{store:e}=t.internal,n=e.getState().requestQueue.map(e=>e.status===`pending`?e:void 0).filter(Boolean);X.send(`rpc-requests`,n)}),{close(){},destroy(){X.destroy()},open(){let n=new URLSearchParams([[`relayUrl`,X.relayUrl]]),r=t.host.replace(/\/$/,``)+`/?`+n.toString();console.log(`
|
|
48
48
|
|
|
49
49
|
Open the URL below in your browser to continue:`),console.log(`\n${r}\n`),e=!0},async secure(){return{frame:!0,host:!0,protocol:!0}},async syncRequests(t){if(t.length>1)throw Error("renderer (`cli`) does not support multiple requests.");t[0]?.request&&(e||this.open(),await X.waitForReady(),X.send(`rpc-requests`,t))}}},supportsHeadless:!0})}function fa(e){return{...e,setup:e.setup??(()=>()=>{})}}async function pa(e){let{account:t,calls:n,permissionsId:r}=e;if(r!==void 0){if(r===null)return;let e=t.keys?.find(e=>e.publicKey===r&&e.privateKey);if(!e)throw Error(`permission (id: ${r}) does not exist.`);return e}let i=t.keys?.find(e=>!e.privateKey||e.role!==`session`||e.expiry<BigInt(Math.floor(Date.now()/1e3))?!1:!!n.every(t=>e.permissions?.calls?.some(e=>{if(e.to&&e.to!==t.to)return!1;if(e.signature){if(!t.data)return!1;let n=D.slice(t.data,0,4);if(D.validate(e.signature))return e.signature===n;if(Te.getSelector(e.signature)!==n)return!1}return!0}))),a=t.keys?.find(e=>e.role===`admin`&&e.privateKey);return i??a}const ma=Vr;function ha(e,t){let{chainId:n,expiry:r,permissions:i,id:a,publicKey:o,type:s}=e,{address:c}=t;return{address:c,chainId:n,expiry:r,id:a,key:{publicKey:o,type:s},permissions:i??{}}}function ga(e){let{chainId:t,expiry:n,key:r}=e;return B({chainId:t,expiry:n,permissions:e.permissions??{},publicKey:r.publicKey,role:`session`,type:r.type})}const _a=Hr;function va(e){let{expiry:t,feeToken:n,permissions:r,publicKey:i,type:a}=e;return{expiry:t,feeToken:n??null,key:{publicKey:i,type:a},permissions:r??{}}}async function Z(e,t={}){if(!e)return;let n={chainId:t.chainId??e.chainId,expiry:e.expiry??0,feeToken:e.feeToken,permissions:Pn(e,{feeTokens:t.feeTokens}),role:`session`};if(e?.key)return B({...n,publicKey:e.key.publicKey,type:e.key.type??`secp256k1`});if(typeof globalThis.crypto?.subtle?.generateKey==`function`)try{return await Sn(n)}catch(e){if(!ya(e))throw e}return vn(n)}function ya(e){if(!(e instanceof Error))return!1;let t=e.message?.toLowerCase()??``;return e.name===`TypeError`||e.name===`ReferenceError`||t.includes(`subtle`)||t.includes(`generatekey`)}async function ba(e){let{address:t,authUrl:n,message:r,signature:i}=e,{chainId:a}=ke.parseMessage(r);return await fetch(n.verify,{body:JSON.stringify({address:t,chainId:a,message:r,signature:i,walletAddress:t}),credentials:`include`,headers:{"Content-Type":`application/json`},method:`POST`}).then(e=>e.json())}async function xa(e,t,n){let{chainId:r=e.chain?.id,domain:i,uri:a,resources:o,version:s=`1`}=t,{address:c}=n,l=t.authUrl?Sa(t.authUrl):void 0;if(!r)throw Error("`chainId` is required.");if(!i)throw Error("`domain` is required.");if(!t.nonce&&!l?.nonce)throw Error("`nonce` or `authUrl.nonce` is required.");if(!a)throw Error("`uri` is required.");let u=await(async()=>{if(t.nonce)return t.nonce;if(!l?.nonce)throw Error("`nonce` or `authUrl.nonce` is required.");let e=await(await fetch(l.nonce,{body:JSON.stringify({address:c,chainId:r,walletAddress:c}),headers:{"Content-Type":`application/json`},method:`POST`})).json().catch(()=>void 0);if(!e?.nonce)throw Error("`nonce` or `authUrl.nonce` is required.");return e.nonce})();return ke.createMessage({...t,address:n.address,chainId:r,domain:i,nonce:u,resources:o,uri:a,version:s})}function Sa(e,t=``){if(!e)return;let n=(()=>{if(typeof e==`string`){let t=e.replace(/\/$/,``);return{logout:t+`/logout`,nonce:t+`/nonce`,verify:t+`/verify`}}return e})();return{logout:Ca(n.logout,t),nonce:Ca(n.nonce,t),verify:Ca(n.verify,t)}}function Ca(e,t){return!t||!e.startsWith(`/`)?e:t+e}async function wa(e,t){let{account:n=e.account}=t,r=n?Y(n):void 0;if(!r)throw Error(`account is required.`);let{domain:{name:i,version:a}}=await te(e,{address:r.address});if(!e.chain)throw Error(`client.chain is required`);return{chainId:e.chain.id,name:i,verifyingContract:r.address,version:a}}async function Ta(e,t){try{let n=`wallet_getAuthorization`,r=await C(()=>e.request({method:n,params:[A.encode(wr.Parameters,t)]}),{cacheKey:`${e.uid}.${n}.${t.address}`});return A.decode(wr.Response,r)}catch(e){throw Q(e),e}}async function Ea(e,t={}){let n=(()=>{if(t.chainId)return[t.chainId];if(t.chainIds!==`all`)return t.chainIds?t.chainIds:[e.chain.id]})();try{let r=`wallet_getCapabilities`,i=await C(()=>e.request({method:r,params:n?[n]:void 0},{retryCount:0}),{cacheKey:`${e.uid}.${r}.${n?.join(`,`)}`}),a=t.raw?i:A.decode(Tr.Response,i);return t.chainIds?a:Object.values(a)[0]}catch(e){throw Q(e),e}}async function Da(e,t){let{account:n,assetFilter:r,assetTypeFilter:i,chainFilter:a}=t;try{let t=await e.request({method:`wallet_getAssets`,params:[A.encode(Er.Parameters,{account:n,assetFilter:r,assetTypeFilter:i,chainFilter:a})]}),o=A.decode(Er.Response,t),s=Object.entries(o).reduce((e,[t,n])=>(e[D.toNumber(t)]=n,e),{}),c={};for(let e of Object.values(s))for(let t of e){let e=JSON.stringify(t.metadata);c[e]={...t,balance:t.balance+(c[e]?.balance??0n)}}return{...s,0:Object.values(c)}}catch(e){throw Q(e),e}}async function Oa(e,t){let{id:n}=t;try{let t=await e.request({method:`wallet_getCallsStatus`,params:[n]});return A.decode(Dr.Response,t)}catch(e){throw Q(e),e}}async function ka(e,t){let{keyHash:n}=t;try{let t=await e.request({method:`wallet_getAccount`,params:[A.encode(Sr.Parameters,{keyHash:n})]});return A.decode(Sr.Response,t)}catch(e){throw Q(e),e}}async function Aa(e,t){let{address:n,chainIds:r}=t;try{let t=await e.request({method:`wallet_getKeys`,params:[A.encode(Or.Parameters,{address:n,chainIds:r})]});return A.decode(Or.Response,t)}catch(e){throw Q(e),e}}async function ja(e){let t=`health`,n=await C(()=>e.request({method:t}),{cacheKey:`${e.uid}.${t}`});return A.decode(br.Response,n)}async function Ma(e,t){let{address:n,capabilities:r,chain:i=e.chain,key:a}=t,o=t.calls.map(e=>({data:e.abi?oe.encodeData(oe.fromAbi(e.abi,e.functionName),e.args):e.data??`0x`,to:e.to,value:e.value??0n}));try{let t=await e.request({method:`wallet_prepareCalls`,params:[A.encode(kr.Parameters,{calls:o,capabilities:{...r,meta:{...r?.meta}},chainId:i?.id,from:n,key:a?{prehash:a.prehash,publicKey:a.publicKey,type:a.type}:void 0})]},{retryCount:0});return Object.assign(A.decode(kr.Response,t),{_raw:t})}catch(e){throw Q(e),Ba(e,{calls:t.calls}),e}}async function Na(e,t){let{address:n,chain:r=e.chain,delegation:i,...a}=t;try{let t=await e.request({method:`wallet_prepareUpgradeAccount`,params:[A.encode(Ar.Parameters,Gi({address:n,capabilities:a,chainId:r?.id,delegation:i}))]},{retryCount:0});return A.decode(Ar.Response,t)}catch(e){throw Q(e),Ba(e),e}}async function Pa(e,t){let{capabilities:n,context:r,key:i,signature:a}=t;try{let t=await e.request({method:`wallet_sendPreparedCalls`,params:[A.encode(Mr.Parameters,{capabilities:n,context:{preCall:r.preCall,quote:r.quote},key:i?{prehash:i.prehash,publicKey:i.publicKey,type:i.type}:void 0,signature:a})]},{retryCount:0});return A.decode(Mr.Response,t)}catch(e){throw Q(e),Ba(e),e}}async function Fa(e,t){let{email:n,walletAddress:r}=t;try{let t=await e.request({method:`account_setEmail`,params:[A.encode(gr.Parameters,{email:n,walletAddress:r})]},{retryCount:0});return A.decode(gr.Response,t)}catch(e){throw Q(e),Ba(e),e}}async function Ia(e,t){let{context:n,signatures:r}=t;try{await e.request({method:`wallet_upgradeAccount`,params:[A.encode(Nr.Parameters,{context:n,signatures:r})]},{retryCount:0})}catch(e){throw Q(e),Ba(e),e}}async function La(e,t){let{chainId:n,email:r,signature:i,token:a,walletAddress:o}=t;try{let t=await e.request({method:`account_verifyEmail`,params:[A.encode(vr.Parameters,{chainId:n,email:r,signature:i,token:a,walletAddress:o})]},{retryCount:0});return A.decode(vr.Response,t)}catch(e){throw Q(e),Ba(e),e}}async function Ra(e,t){let{signature:n}=t,{signature:r,capabilities:{feeSignature:i,...a},...o}=t.response,s=Va({capabilities:a,...o}),c=le.keccak256(D.fromString(JSON.stringify(s))),l=k.recoverAddress({payload:c,signature:fe.fromHex(n)}),{quoteSigner:u}=await ja(e);return l===u}async function za(e,t){let{address:n,chain:r=e.chain,digest:i,signature:a}=t;try{async function t(){return{proof:null,valid:await ne(e,{address:n,hash:i,signature:a})}}let o=await(async()=>{let o=await e.request({method:`wallet_verifySignature`,params:[A.encode(Pr.Parameters,{address:n,chainId:r?.id,digest:i,signature:a})]},{retryCount:0}).catch(t);return o.valid?o:t()})();return A.decode(Pr.Response,o)}catch(e){throw Q(e),e}}function Ba(e,{calls:t}={}){if(!(e instanceof d))return;let n=e=>{try{if(e.name===`ContractFunctionExecutionError`){let t=e.cause.name===`ContractFunctionRevertedError`?e.cause.data:void 0;if(t)return je.fromAbi([t.abiItem],t.errorName)}let t=e.walk(e=>!(e instanceof Error)&&e.code===3);if(!t)return;let{data:n,message:r}=t;return n===`0xd0d5039b`?je.from(`error Unauthorized()`):{inputs:[],name:(r??n).split(`(`)[0],type:`error`}}catch{return}},r=Me(e,{calls:t??[]}),i=n(r);if(!(r===e&&!i))throw new Ha(Object.assign(r,{abiError:i}))}function Va(e){if(typeof e==`object`&&e){if(Array.isArray(e))return e.map(Va);let t={};for(let n of Object.keys(e).sort())t[n]=Va(e[n]);return t}return e}function Q(e){if(e.name===`$ZodError`)throw Bn(e)}var Ha=class extends ye.BaseError{name=`Rpc.ExecutionError`;abiError;constructor(e){super(`An error occurred while executing calls.`,{cause:e,metaMessages:[e.abiError&&`Reason: `+e.abiError.name].filter(Boolean)}),this.abiError=e.abiError}};async function Ua(e,t){let{account:n=e.account,chainIds:r}=t,i=n?Y(n):void 0;if(!i)throw Error(`account is required.`);let a=await Aa(e,{address:i.address,chainIds:r});return Object.entries(a).flatMap(([e,t])=>t.map(t=>Tn(t,{chainId:Number(e)})))}async function Wa(e,t){let{account:n=e.account,calls:r,chain:i=e.chain,feePayer:a,merchantUrl:o,nonce:s,preCalls:c,requiredFunds:l,revokeKeys:u}=t,d=n?Y(n):void 0,p=t.key??(d?Pi(d,{role:`admin`}):void 0),m=t.authorizeKeys?.some(e=>e.role===`session`),{contracts:h,fees:{tokens:g}}=await Ea(e,{chainId:i?.id}),_=m?h.orchestrator.address:void 0,v=(t.authorizeKeys??[]).map(e=>Nn(e,{feeTokens:g,orchestrator:_})),y=t.feeToken?t.feeToken:p?.permissions?.spend?.[0]?.token,b=typeof c==`boolean`?c:!1,S=typeof c==`object`?c.map(({context:e,signature:t})=>({...e.preCall,signature:t})):void 0,C={address:d?.address,calls:r??[],capabilities:{authorizeKeys:v,meta:{feePayer:a,feeToken:y,nonce:s},preCall:b,preCalls:S,requiredFunds:l,revokeKeys:u?.map(e=>({hash:e.hash}))},chain:i,key:p?Nn(p,{feeTokens:g}):void 0},w=await(async()=>o?await Ma(f({chain:e.chain,transport:x(o)}),C).catch(t=>(console.error(t),Ma(e,C))):await Ma(e,C))(),{capabilities:ee,context:te,digest:ne,signature:T,typedData:re}=w;if(o&&!await Ra(e,{response:w._raw,signature:T}))throw Error(`cannot verify integrity of \`wallet_prepareCalls\` response from ${o}`);return{capabilities:{...ee,quote:te.quote},context:te,digest:ne,key:p,typedData:re}}async function Ga(e,t){let{address:n,authorizeKeys:r,chain:i=e.chain}=t;if(!i)throw Error(`chain is required.`);let{contracts:a,fees:{tokens:o}}=await Ea(e,{chainId:i.id}),s=t.delegation??a.accountProxy.address,c=r.some(e=>e.role===`session`)?a.orchestrator.address:void 0,{capabilities:l,chainId:u,context:d,digests:f,typedData:p}=await Na(e,{address:n,authorizeKeys:r.map(e=>{let t=e.role===`session`?e.permissions:{};return Nn({...e,permissions:t},{feeTokens:o,orchestrator:c})}),chain:i,delegation:s}),m=Y({address:n,keys:r});return{capabilities:l,chainId:u,context:{...d,account:m},digests:f,typedData:p}}async function Ka(e,t){let{account:n=e.account,chain:r=e.chain,webAuthn:i}=t;if(!r)throw Error("`chain` is required.");let a=n?Y(n):void 0;if(!a)throw Error("`account` is required.");let o=t.key??Pi(a,t);if(!o&&!a.sign)throw Error("`key` or `account` with `sign` is required");let s=await Promise.all((t.preCalls??[]).map(async n=>{if(n.signature)return n;let{authorizeKeys:o,key:s,calls:c,revokeKeys:l}=n,{context:u,digest:d,typedData:f}=await Wa(e,{account:a,authorizeKeys:o,calls:c,chain:r,feeToken:t.feeToken,key:s,preCalls:!0,revokeKeys:l});return{context:u,signature:await V(s,{address:null,payload:d,typedData:f,webAuthn:i})}})),{capabilities:c,context:l,digest:u,typedData:d}=await Wa(e,{...t,account:a,chain:r,key:o,preCalls:s}),f=await(async()=>o?await V(o,{address:null,payload:u,typedData:d,webAuthn:i,wrap:!1}):await a.sign({hash:u}))();return await qa(e,{capabilities:c.feeSignature?{feeSignature:c.feeSignature}:void 0,context:l,key:o,signature:f})}async function qa(e,t){let{capabilities:n,context:r,key:i,signature:a}=t;return await Pa(e,{capabilities:n,context:r,key:i?Nn(i):void 0,signature:a})}async function Ja(e,t){let{email:n,walletAddress:r}=t;return await Fa(e,{email:n,walletAddress:r})}async function Ya(e,t){if(t.account){let{account:n}=t,r=[...n.keys??[],...t.authorizeKeys??[]].filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t),{digests:i,...a}=await Ga(e,{...t,address:n.address,authorizeKeys:r}),o={auth:await n.sign({hash:i.auth}),exec:await n.sign({hash:i.exec})};return await Ya(e,{...a,signatures:o})}let{context:n,signatures:r}=t,i=Y(n.account);return await Ia(e,{context:n,signatures:r}),i}async function Xa(e,t){let{chainId:n,email:r,signature:i,token:a,walletAddress:o}=t;return await La(e,{chainId:n,email:r,signature:i,token:a,walletAddress:o})}async function Za(e,t){let{address:n}=t,{authorization:r,data:i,to:a}=await Ta(e,{address:n});return Ne.wrap({authorization:{...r,nonce:BigInt(r.nonce),r:BigInt(r.r),s:BigInt(r.s)},data:i,signature:t.signature,to:a})}function Qa(e,t){let{tokens:n}=t,r=n.filter(e=>e.interop);return e.map(e=>{if(e.address)return e;let t=r.find(t=>t.symbol===e.symbol);if(!t)throw Error(`interop token not found: ${e.symbol}`);return{address:t.address,value:me.from(e.value,t.decimals)}})}async function $(e,t){let{chain:n=e.chain}=t??{};return await Ea(e,{chainId:n?.id}).then(e=>e.fees.tokens)}async function $a(e,t){let{addressOrSymbol:n}=t;return(await $(e,t)).find($a.predicate(n))}(function(e){function t(e){return t=>e?E.validate(e)?E.isEqual(t.address,e):e===`native`?t.address===w:e===t.symbol:!1}e.predicate=t})($a||={});async function eo(e,t){let{chain:n=e.chain,store:r}=t??{},i=r?.getState()??{},a=t?.addressOrSymbol??i.feeToken;return(await $(e,{chain:n}).then(e=>e.filter(e=>e.feeToken)))?.find(e=>a?a===`native`&&e.address===w||E.validate(a)&&E.isEqual(e.address,a)?!0:a===e.symbol:!1)}function to(e={}){let t=e,{mock:n,multichain:r=!0,webAuthn:i}=t,a,o,s=(()=>{if(t.keystoreHost!==`self`&&!(typeof window<`u`&&window.location?.hostname===`localhost`))return t.keystoreHost})();return fa({actions:{async addFunds(){throw new M.UnsupportedMethodError},async createAccount(e){let{admins:t,email:r,label:o,permissions:c,internal:l,signInWithEthereum:u,providerRdns:d}=e,{client:f}=l,p=Ni(k.randomPrivateKey()),m=await $(f),h=n?xn():d?await Cn({rdns:d}):await bn({createFn:i?.createFn,label:o||`${p.address.slice(0,8)}\u2026${p.address.slice(-6)}`,rpId:s,userId:ce.from(p.address)}),g=await Z(c,{chainId:f.chain.id,feeTokens:m}),_=t?.map(e=>B(e)),{address:v}=d?await ka(f,{keyHash:h.hash}):{address:null},y=v?Y({address:v,keys:[h,..._??[],...g?[g]:[]]}):await Ya(f,{account:p,authorizeKeys:[h,..._??[],...g?[g]:[]]});if(v&&g){let{context:e,digest:t,typedData:n}=await Wa(f,{account:y,authorizeKeys:[g],key:h,preCalls:!0});await qa(f,{context:e,key:h,signature:await V(h,{address:null,payload:t,typedData:n})})}a=p.address,r&&o&&await Ja(f,{email:o,walletAddress:y.address});let b=await(async()=>{if(!u)return;let e=await xa(f,u,{address:y.address}),t=await Fi(p,{payload:Ae.getSignPayload(D.fromString(e))});return{message:e,signature:await Za(f,{address:y.address,signature:t})}})();return{account:{...y,signInWithEthereum:b}}},async getAccountVersion(e){let{address:t,internal:n}=e,{client:r}=n,{contracts:i}=await Ea(r),{accountImplementation:a}=i,o=await wa(r,{account:Y(a)}).then(e=>e.version),s=await wa(r,{account:t}).then(e=>e.version).catch(()=>o);if(!s||!o)throw Error(`version not found.`);return{current:s,latest:o}},async getAssets(e){let{account:t,chainFilter:n,assetFilter:r,assetTypeFilter:i,internal:a}=e,{client:o}=a;return await Da(o,{account:t,assetFilter:r,assetTypeFilter:i,chainFilter:n})},async getCallsStatus(e){let{id:t,internal:n}=e,{client:r}=n,i=await Oa(r,{id:t});return{atomic:!0,chainId:D.fromNumber(r.chain.id),id:t,receipts:i.receipts?.map(e=>({blockHash:e.blockHash,blockNumber:D.fromNumber(e.blockNumber),gasUsed:D.fromNumber(e.gasUsed),logs:e.logs,status:e.status,transactionHash:e.transactionHash})),status:i.status,version:`1.0`}},async getCapabilities(e){let{chainIds:t,internal:n}=e,{client:i}=n,a={atomic:{status:`supported`},atomicBatch:{supported:!0},feeToken:{supported:!0,tokens:[]},merchant:{supported:!0},permissions:{supported:!0},requiredFunds:{supported:!!r,tokens:[]}},o=await Ea(i,{chainIds:t?t.map(e=>D.toNumber(e)):`all`,raw:!0});return Object.entries(o).reduce((e,[t,n])=>({...e,[t]:{...a,...n,feeToken:{supported:!0,tokens:n.fees.tokens},requiredFunds:{supported:!!r,tokens:r?n.fees.tokens.filter(e=>e.interop):[]}}}),{})},async getKeys(e){let{account:t,chainIds:n,internal:r}=e,{client:i}=r;return Ki([...await Ua(i,{account:t,chainIds:n}),...t.keys??[]],e=>e.publicKey)},async grantAdmin(e){let{account:t,internal:n}=e,{client:r}=n,a=B(e.key,{chainId:r.chain.id}),o=await eo(r,{addressOrSymbol:e.feeToken,store:n.store}),{id:s}=await Ka(r,{account:t,authorizeKeys:[a],feeToken:o?.address,webAuthn:i});return await T(r,{id:s,pollingInterval:500}),{key:a}},async grantPermissions(e){let{account:t,internal:n,permissions:r}=e,{client:i}=n,a=await $(i),o=await Z(r,{chainId:i.chain.id,feeTokens:a});if(!o)throw Error(`key to authorize not found.`);let s=t.keys?.find(e=>e.role===`admin`&&e.privateKey);if(!s)throw Error(`admin key not found.`);let{context:c,digest:l,typedData:u}=await Wa(i,{account:t,authorizeKeys:[o],key:s,preCalls:!0});return await qa(i,{context:c,key:s,signature:await V(s,{address:null,payload:l,typedData:u})}),{key:o}},async loadAccounts(e){let{internal:t,permissions:r,signInWithEthereum:o,providerRdns:c}=e,{client:l}=t,u=await $(l),d=await Z(r,{chainId:l.chain.id,feeTokens:u}),{digest:f,digestType:p,message:m}=await(async()=>{if(o&&e.address){let t=await xa(l,o,{address:e.address});return{context:void 0,digest:Ae.getSignPayload(D.fromString(t)),digestType:`siwe`,message:t}}return{context:void 0,digest:`0x`,message:void 0}})(),{address:h,credentialId:g,webAuthnSignature:_,rdns:v,providerSignature:y}=await(async()=>{if(n){if(!a)throw Error(`address_internal not found.`);return{address:a,credentialId:void 0}}if(e.address&&e.key){if(`credentialId`in e.key)return{address:e.address,credentialId:e.key.credentialId};if(`rdns`in e.key)return{address:e.address,rdns:e.key.rdns}}if(c){let e=await Cn({rdns:c}),t=await ka(l,{keyHash:e.hash});if(t.address){let n=f===`0x`?void 0:await V(e,{address:null,payload:m,wrap:!0});return{address:t.address,providerSignature:n,rdns:c}}throw Error(`No account found for external wallet ${e.publicKey}`)}let t=await he.sign({challenge:f,getFn:i?.getFn,rpId:s}),r=t.raw.response;return{address:ce.toHex(new Uint8Array(r.userHandle)),credentialId:t.raw.id,webAuthnSignature:t}})(),b=v??c,x=Y({address:h,keys:[...await Ua(l,{account:h,chainIds:[l.chain.id]}),...d?[d]:[]].map((e,t)=>{if(t===0){if(e.type===`webauthn-p256`)return Dn({...e,credential:{id:g,publicKey:O.fromHex(e.publicKey)},id:h,rpId:s});if(e.type===`address`&&b)return An({...e,account:e.publicKey,rdns:b})}return e})}),S=Pi(x,{role:`admin`}),C=await(async()=>{if(f!==`0x`)return _?Ln(In(_),{keyType:`webauthn-p256`,publicKey:S.publicKey}):y||await V(S,{address:x.address,payload:f})})();if(d){let{context:e,digest:t,typedData:n}=await Wa(l,{account:x,authorizeKeys:[d],preCalls:!0});await qa(l,{context:e,key:S,signature:await V(S,{address:null,payload:t,typedData:n})})}let w=await(async()=>{if(o){if(p===`siwe`&&m&&C)return{message:m,signature:await Za(l,{address:x.address,signature:C})};{let e=await xa(l,o,{address:x.address}),t=await Fi(x,{payload:b?e:Ae.getSignPayload(D.fromString(e)),role:`admin`});return{message:e,signature:await Za(l,{address:x.address,signature:t})}}}})();return{accounts:[{...x,signInWithEthereum:w}]}},async prepareCalls(e){let{account:t,calls:n,internal:i,merchantUrl:a}=e,{client:o}=i,s=e.key??await pa({account:t,calls:n});if(!s)throw Error(`cannot find authorized key to sign with.`);let[c,l]=await Promise.all([$(o),eo(o,{addressOrSymbol:e.feeToken,store:i.store})]),u=Qa(e.requiredFunds??[],{tokens:c}),{capabilities:d,context:f,digest:p,typedData:m}=await Wa(o,{account:t,calls:n,feeToken:l?.address,key:s,merchantUrl:a,requiredFunds:r?u:void 0}),h=f.quote?.quotes??[],g=h[h.length-1];return{account:t,capabilities:{...d,quote:f.quote},chainId:o.chain.id,context:{...f,account:t,calls:n,nonce:g?.intent.nonce},digest:p,key:s,typedData:m}},async prepareUpgradeAccount(e){let{address:t,email:r,label:a,internal:c,permissions:l}=e,{client:u}=c,[d,f]=await Promise.all([$(u),eo(u,{store:c.store})]),p=n?xn():await bn({createFn:i?.createFn,label:a||`${t.slice(0,8)}\u2026${t.slice(-6)}`,rpId:s,userId:ce.from(t)}),m=await Z(l,{chainId:u.chain.id,feeTokens:d}),{context:h,digests:g}=await Ga(u,{address:t,authorizeKeys:[p,...m?[m]:[]],feeToken:f?.address});return r&&(o=a),{context:h,digests:g}},async revokeAdmin(e){let{account:t,id:n,internal:r}=e,{client:a}=r,o=t.keys?.find(e=>e.id===n);if(o){if(o.type===`webauthn-p256`&&t.keys?.filter(e=>e.type===`webauthn-p256`).length===1)throw Error(`revoke the only WebAuthn key left.`);try{let{id:n}=await Ka(a,{account:t,feeToken:(await eo(a,{addressOrSymbol:e.feeToken,store:r.store}))?.address,revokeKeys:[o],webAuthn:i});await T(a,{id:n})}catch(e){let t=e;if(t.name===`Rpc.ExecutionError`&&t.abiError?.name===`KeyDoesNotExist`)return;throw e}}},async revokePermissions(e){let{account:t,id:n,internal:r}=e,{client:a}=r,o=t.keys?.find(e=>e.id===n);if(o){if(o.role===`admin`)throw Error(`cannot revoke admins.`);try{let{id:n}=await Ka(a,{account:t,feeToken:(await eo(a,{addressOrSymbol:e.feeToken,store:r.store}))?.address,revokeKeys:[o],webAuthn:i});await T(a,{id:n})}catch(e){let t=e;if(t.name===`Rpc.ExecutionError`&&t.abiError?.name===`KeyDoesNotExist`)return;throw e}}},async sendCalls(e){let{account:t,asTxHash:n,calls:a,internal:o,merchantUrl:s}=e,{client:c}=o,l=await pa({account:t,calls:a,permissionsId:e.permissionsId}),[u,d]=await Promise.all([$(c),eo(c,{addressOrSymbol:e.feeToken,store:o.store})]),f=Qa(e.requiredFunds??[],{tokens:u}),p=await Ka(c,{account:t,calls:a,feeToken:d?.address,key:l,merchantUrl:s,requiredFunds:r?f:void 0,webAuthn:i});if(n){let{id:e,receipts:t,status:n}=await T(c,{id:p.id,pollingInterval:500});if(!t?.[0])throw n===`success`?new M.UnknownBundleIdError({message:`Call bundle with id: `+e+` not found.`}):new De.TransactionRejectedError({message:`Transaction failed under call bundle id: `+e+`.`});return{id:t[0].transactionHash}}return p},async sendPreparedCalls(e){let{context:t,key:n,internal:r,signature:i}=e,{client:a}=r,{id:o}=await qa(a,{context:t,key:n,signature:i});return o},async signPersonalMessage(e){let{account:t,data:n,internal:r}=e,{client:a}=r,o=t.keys?.find(e=>e.role===`admin`&&e.privateKey);if(!o)throw Error(`cannot find admin key to sign with.`);let s=await Fi(t,{key:o,payload:Ae.getSignPayload(n),webAuthn:i});return Za(a,{address:t.address,signature:s})},async signTypedData(e){let{account:t,internal:n}=e,{client:r}=n,a=t.keys?.find(e=>e.role===`admin`&&e.privateKey);if(!a)throw Error(`cannot find admin key to sign with.`);let o=ue.parse(e.data),s=o.domain?.name===`Orchestrator`,c=await Fi(t,{key:a,payload:pe.getSignPayload(o),replaySafe:!s,typedData:o,webAuthn:i});return s?c:Za(r,{address:t.address,signature:c})},async upgradeAccount(e){let{account:t,context:n,internal:r,signatures:i}=e,{client:a}=r;return await Ya(a,{context:n,signatures:i}),o&&await Ja(a,{email:o,walletAddress:t.address}),{account:t}},async verifyEmail(e){let{account:t,chainId:n,email:r,token:a,internal:o,walletAddress:s}=e,{client:c}=o,l=t.keys?.find(e=>e.role===`admin`&&e.privateKey);if(!l)throw Error(`cannot find admin key to sign with.`);return await Xa(c,{chainId:n,email:r,signature:await Fi(t,{key:l,payload:le.keccak256(D.fromString(`${r}${a}`)),webAuthn:i}),token:a,walletAddress:s})}},config:e,name:`rpc`})}function no(e={}){let{fallback:t=to(),host:n=Qi.prod,renderer:r=ea(),theme:i,themeController:a}=e,o=new Set,s=Ee.createStore();function c(e){return M.from({async request(t){let n=s.prepare(t);return e.setState(e=>{let t=e.accounts[0],r=t?.keys?.find(e=>e.role===`admin`&&e.type===`webauthn-p256`);return{...e,requestQueue:[...e.requestQueue,{account:t?{address:t.address,key:r?{credentialId:r?.credentialId,publicKey:r.publicKey}:void 0}:void 0,request:n,status:`pending`}]}}),new Promise((t,r)=>{let i=a=>{let s=a.find(e=>e.request.id===n.id);if(!s&&a.length===0){o.delete(i),r(new M.UserRejectedRequestError);return}s&&(s.status!==`success`&&s.status!==`error`||(o.delete(i),s.status===`success`?t(s.result):r(M.parseError(s.error)),e.setState(e=>({...e,requestQueue:e.requestQueue.filter(e=>e.request.id!==n.id)}))))};o.add(i)})}},{schema:Oe.from()})}return fa({actions:{async addFunds(e){let{internal:t}=e,{request:n,store:r}=t;if(n.method!==`wallet_addFunds`)throw Error(`Cannot add funds for method: `+n.method);return await c(r).request(n)},async createAccount(e){let{internal:t}=e,{client:n,config:r,request:i,store:a}=t,{storage:o}=r,s=c(a);return{account:await(async()=>{if(i.method===`wallet_connect`){let[{capabilities:e,chainIds:t}]=i._decoded.params??[{}],a=io(e?.signInWithEthereum?.authUrl??r.authUrl,{storage:o}),c=i.params?.[0]?.capabilities?.signInWithEthereum,l=await Z(e?.grantPermissions,{chainId:n.chain.id}),u=l?A.encode(_a,va(l)):void 0,{accounts:d}=await s.request({...i,params:[{capabilities:{...i.params?.[0]?.capabilities,grantPermissions:u,signInWithEthereum:a||c?{...c,authUrl:a}:void 0},chainIds:t?.map(e=>D.fromNumber(e))}]}),[f]=d;if(!f)throw Error(`no account found.`);let p=f.capabilities?.admins?.map(e=>B(e,{chainId:n.chain.id})).filter(Boolean),m=f.capabilities?.permissions?.map(e=>{try{let t=ga(A.decode(ma,e));return t.id===l?.id?{...t,...l,permissions:t.permissions}:t}catch{return}}).filter(Boolean),h=await(async()=>{if(!f.capabilities?.signInWithEthereum)return;let{message:e,signature:t}=f.capabilities.signInWithEthereum;if(!a)return{message:e,signature:t};let{token:n}=await ba({address:f.address,authUrl:a,message:e,signature:t});return{message:e,signature:t,token:n}})();return{...Y({address:f.address,keys:[...p??[],...m??[]]}),signInWithEthereum:h}}throw Error(`Account creation not supported on method: ${i.method}`)})()}},async disconnect(e){let{internal:t}=e,{config:n}=t,{storage:r}=n,i=await r.getItem(`porto.authUrl`)||void 0,a=io(n.authUrl??i,{storage:r});a&&await fetch(a.logout,{credentials:`include`,method:`POST`}).catch(()=>{})},async getAccountVersion(e){let{internal:n}=e,{store:i,request:a}=n;if(a.method!==`wallet_getAccountVersion`)throw Error(`Cannot get version for method: `+a.method);return r.supportsHeadless?await c(i).request(a):t.actions.getAccountVersion(e)},async getAssets(e){let{internal:n}=e,{store:i,request:a}=n;if(a.method!==`wallet_getAssets`)throw Error(`Cannot get assets for method: `+a.method);if(!r.supportsHeadless)return t.actions.getAssets(e);let o=await c(i).request(a);return A.decode(Ti.Response,o)},async getCallsStatus(e){let{internal:n}=e,{store:i,request:a}=n;if(a.method!==`wallet_getCallsStatus`)throw Error(`Cannot get status for method: `+a.method);return r.supportsHeadless?await c(i).request(a):t.actions.getCallsStatus(e)},async getCapabilities(e){let{internal:n}=e,{store:i,request:a}=n;if(a.method!==`wallet_getCapabilities`)throw Error(`Cannot get capabilities for method: `+a.method);return r.supportsHeadless?await c(i).request(a):t.actions.getCapabilities(e)},async getKeys(e){let{account:n,chainIds:i,internal:a}=e,{store:o}=a;return Ki([...await(async()=>{if(!r.supportsHeadless)return t.actions.getKeys(e);let a=await c(o).request({method:`wallet_getKeys`,params:[A.encode(Oi.Parameters,{address:n.address,chainIds:i})]});return A.decode(Oi.Response,a)})(),...n.keys??[]],e=>e.publicKey)},async grantAdmin(e){let{internal:t}=e,{request:n,store:r}=t;if(n.method!==`wallet_grantAdmin`)throw Error(`Cannot authorize admin for method: `+n.method);let[i]=n._decoded.params,a=B(i.key);if(!a)throw Error(`no key found.`);let o=await ro(t,e);return await c(r).request({method:`wallet_grantAdmin`,params:[{...n.params?.[0],capabilities:{...n.params?.[0]?.capabilities,feeToken:o}}]}),{key:a}},async grantPermissions(e){let{internal:t}=e,{client:n,request:r,store:i}=t;if(r.method!==`wallet_grantPermissions`)throw Error(`Cannot grant permissions for method: `+r.method);let[{address:a,...o}]=r._decoded.params,s=await Z(o,{chainId:n.chain.id});if(!s)throw Error(`no key found.`);let l=A.encode(_a,va(s));return await c(i).request({method:`wallet_grantPermissions`,params:[l]}),{key:s}},async loadAccounts(e){let{internal:t}=e,{client:n,config:r,store:i}=t,{storage:a}=r,o=c(i),s=t.request;if(s.method!==`wallet_connect`&&s.method!==`eth_requestAccounts`)throw Error(`Cannot load accounts for method: `+s.method);return{accounts:await(async()=>{let[e]=s._decoded.params??[],{capabilities:t}=e??{},i=io(t?.signInWithEthereum?.authUrl??r.authUrl,{storage:a}),c=s.params?.[0]?.capabilities?.signInWithEthereum,l=await Z(t?.grantPermissions,{chainId:n.chain.id}),u=l?A.encode(_a,va(l)):void 0,{accounts:d}=await o.request({method:`wallet_connect`,params:[{...s.params?.[0],capabilities:{...s.params?.[0]?.capabilities,grantPermissions:u,signInWithEthereum:i||c?{...c,authUrl:i}:void 0}}]});return Promise.all(d.map(async e=>{let t=e.capabilities?.admins?.map(e=>B(e)).filter(Boolean),n=e.capabilities?.permissions?.map(e=>{try{let t=ga(A.decode(ma,e));return t.id===l?.id?{...t,...l,permissions:t.permissions}:t}catch{return}}).filter(Boolean),r=await(async()=>{if(!e.capabilities?.signInWithEthereum)return;let{message:t,signature:n}=e.capabilities.signInWithEthereum;if(!i)return{message:t,signature:n};let{token:r}=await ba({address:e.address,authUrl:i,message:t,signature:n});return{message:t,signature:n,token:r}})();return{...Y({address:e.address,keys:[...t??[],...n??[]]}),signInWithEthereum:r}}))})()}},async prepareCalls(e){let{account:n,internal:i}=e,{store:a,request:o}=i;if(o.method!==`wallet_prepareCalls`)throw Error(`Cannot prepare calls for method: `+o.method);if(!r.supportsHeadless)return t.actions.prepareCalls(e);let s=await ro(i,e),l=c(a),u=A.decode(J.Response,await l.request({...o,params:[{...o.params?.[0],capabilities:{...o.params?.[0]?.capabilities,feeToken:s}}]}));return{account:n,chainId:Number(u.chainId),context:u.context,digest:u.digest,key:u.key,typedData:u.typedData}},async prepareUpgradeAccount(e){let{internal:n}=e,{client:i,store:a,request:o}=n;if(o.method!==`wallet_prepareUpgradeAccount`)throw Error(`Cannot prepare upgrade for method: `+o.method);if(!r.supportsHeadless)return t.actions.prepareUpgradeAccount(e);let[{capabilities:s}]=o._decoded.params??[{}],l=await Z(s?.grantPermissions,{chainId:i.chain.id}),u=l?A.encode(_a,va(l)):void 0,{context:d,digests:f}=await c(a).request({...o,params:[{...o.params?.[0],capabilities:{...o.params?.[0]?.capabilities,grantPermissions:u}}]}),p=d.account.keys?.map(e=>e.id===l?.id?{...e,...l}:e);return{context:{...d,account:{...d.account,keys:p}},digests:f}},async revokeAdmin(e){let{account:t,id:n,internal:r}=e,{store:i,request:a}=r;if(a.method!==`wallet_revokeAdmin`)throw Error(`Cannot revoke admin for method: `+a.method);let o=t.keys?.find(e=>e.id===n);if(!o)return;if(o.type===`webauthn-p256`&&t.keys?.filter(e=>e.type===`webauthn-p256`).length===1)throw Error(`revoke the only WebAuthn key left.`);let s=await ro(r,e);return await c(i).request({...a,params:[{...a.params?.[0],capabilities:{...a.params?.[0]?.capabilities,feeToken:s}}]})},async revokePermissions(e){let{account:t,id:n,internal:r}=e,{store:i,request:a}=r;if(a.method!==`wallet_revokePermissions`)throw Error(`Cannot revoke permissions for method: `+a.method);let o=t.keys?.find(e=>e.id===n);if(o){if(o.role===`admin`)throw Error(`cannot revoke permissions.`);return await c(i).request(a)}},async sendCalls(e){let{account:n,asTxHash:i,calls:a,internal:o,merchantUrl:s,requiredFunds:l}=e,{client:u,store:d,request:f}=o,p=c(d),m=await ro(o,e),h=await pa({account:n,calls:a,permissionsId:e.permissionsId});if(h&&h.role===`session`){if(!r.supportsHeadless)return t.actions.sendCalls(e);try{let e=await p.request(A.encode(J.Request,{method:`wallet_prepareCalls`,params:[{calls:a,capabilities:{...f._decoded.method===`wallet_sendCalls`?f._decoded.params?.[0]?.capabilities:void 0,feeToken:m,merchantUrl:s,requiredFunds:l},chainId:u.chain.id,from:n.address,key:h}]})),t=e.capabilities?.quote?.quotes??[];if(t.some((e,n)=>n===t.length-1&&t.length>1?!1:D.toBigInt(e.feeTokenDeficit)>0n))throw Error(`insufficient funds`);let r=await V(h,{address:null,payload:e.digest,wrap:!1}),o=(await p.request({method:`wallet_sendPreparedCalls`,params:[{...e,signature:r}]}))[0];if(!o)throw Error(`id not found`);if(i){let{id:e,receipts:t,status:n}=await T(u,{id:o.id,pollingInterval:500});if(!t?.[0])throw n===`success`?new M.UnknownBundleIdError({message:`Call bundle with id: `+e+` not found.`}):new De.TransactionRejectedError({message:`Transaction failed under call bundle id: `+e+`.`});return{id:t[0].transactionHash}}return o}catch{}}if(f.method===`eth_sendTransaction`)return{id:await p.request({...f,params:[{...f.params?.[0],capabilities:{feeToken:m,merchantUrl:s}}]})};if(f.method===`wallet_sendCalls`)return await p.request({method:`wallet_sendCalls`,params:[{...f.params?.[0],capabilities:{...f.params?.[0]?.capabilities,feeToken:m,merchantUrl:s}}]});throw Error(`Cannot execute for method: `+f.method)},async sendPreparedCalls(e){let{internal:n}=e,{store:i,request:a}=n;if(a.method!==`wallet_sendPreparedCalls`)throw Error(`Cannot send prepared calls for method: `+a.method);if(!r.supportsHeadless)return t.actions.sendPreparedCalls(e);let o=(await c(i).request(a))[0]?.id;if(!o)throw Error(`id not found`);return o},async signPersonalMessage(e){let{internal:t}=e,{store:n,request:r}=t;if(r.method!==`personal_sign`)throw Error(`Cannot sign personal message for method: `+r.method);return await c(n).request(r)},async signTypedData(e){let{internal:t}=e,{store:n,request:r}=t;if(r.method!==`eth_signTypedData_v4`)throw Error(`Cannot sign typed data for method: `+r.method);return await c(n).request(r)},async switchChain(e){let{internal:t}=e,{store:n,request:i}=t;if(i.method!==`wallet_switchEthereumChain`)throw Error(`Cannot switch chain for method: `+i.method);if(r.supportsHeadless)return await c(n).request(i)},async upgradeAccount(e){let{account:t,internal:n}=e,{store:r,request:i}=n;if(i.method!==`wallet_upgradeAccount`)throw Error(`Cannot upgrade account for method: `+i.method);return await c(r).request(i),{account:t}},async verifyEmail(e){let{internal:t}=e,{request:n,store:r}=t;if(n.method!==`account_verifyEmail`)throw Error(`Cannot verify email for method: `+n.method);return await c(r).request(n)}},config:e,name:`dialog`,setup(e){let{internal:t}=e,{store:s}=t,c=r.setup({host:n,internal:t,theme:i,themeController:a}),l=s.subscribe(e=>e.requestQueue,e=>{for(let t of o)t(e);let t=e.map(e=>e.status===`pending`?e:void 0).filter(Boolean);c.syncRequests(t).catch(()=>{}),t.length===0&&c.close()});return()=>{l(),c.destroy()}}})}async function ro(e,t){let{config:{feeToken:n}}=e,{feeToken:r}=t??{};return r??n}function io(e,{storage:t}){if(!e)return;let n=Sa(e,typeof window<`u`?window.location.origin:void 0);return n&&t.setItem(`porto.authUrl`,n),n}const ao={anvil:{http:`http://localhost:9119`},prod:{http:`https://relay.wallet.risechain.com`},stg:{http:`https://stg.relay.wallet.risechain.com`}};function oo(e){return t=>{let n=e.public(t),r=e.relay(t);return p({key:oo.type,name:`Relay Proxy`,async request({method:e,params:t},i){return so(e)?r.request({method:e,params:t},i):n.request({method:e,params:t},i)},type:oo.type})}}(function(e){e.type=`relayProxy`})(oo||={});function so(e){return!!(e.startsWith(`wallet_`)||e.startsWith(`account_`)||e===`health`)}const co=new Map;function lo(e,t={}){let{config:n,id:r,store:i}=e._internal,{chains:a,relay:o}=n,s=i.getState(),c=t.chainId??s.chainIds[0],l=a.find(e=>e.id===c);if(!l)throw Error([`Could not find a compatible Porto chain on the given chain configuration.`,``,`Provided chains: [${a.map(e=>`${e.name} (id: ${e.id})`).join(`, `)}]`,`Needed chain (id): ${c}`,`Please add this chain (id) to your chain configuration.`].join(`
|
|
50
|
-
`));let u=oo({public:n.transports[l.id]??g(l.rpcUrls.default.http.map(e=>x(e))),relay:o}),d=[r,ue.stringify(l)].filter(Boolean).join(`:`);if(co.has(d))return co.get(d);let p=f({...t,chain:l,pollingInterval:1e3,transport:u});return co.set(d,p),p}const uo=A.discriminatedUnion(`method`,[ii.Request,oi.Request,si.Request,ci.Request,li.Request,ui.Request,di.Request,hi.Request,fi.Request,gi.Request,pi.Request,mi.Request,ki.Request,_i.Request,vi.Request,bi.Request,xi.Request,Si.Request,Ci.Request,wi.Request,Ti.Request,Ei.Request,Di.Request,Oi.Request,J.Request,Ai.Request,ji.Request,yi.Request,Mi.Request]);function fo(e,t){let n=A.safeParse(e,t);if(n.error){let e=n.error.issues.at(0);throw e?.code===`invalid_union`&&e.note===`No matching discriminator`?new De.MethodNotSupportedError:new De.InvalidParamsError(Bn(n.error))}return{...t,_decoded:n.data}}async function po(e){e.persist.hasHydrated()||await new Promise(t=>{e.persist.onFinishHydration(()=>t(!0)),setTimeout(()=>t(!0),100)})}function mo(e){if(e)return e.startsWith(`/`)?`${window.location.origin}${e}`:e}function ho(e){let{config:t,getMode:n,id:r,store:i}=e,{announceProvider:a}=t;function o(e={}){let a=s(),o=e.request??fo(uo,{method:`wallet_getCapabilities`,params:e.chainIds?[void 0,e.chainIds]:void 0});return C(()=>n().actions.getCapabilities({chainIds:e.chainIds,internal:{client:a,config:t,request:o,store:i}}),{cacheKey:`getCapabilities.${r}.${e.chainIds?.join(`,`)}`})}function s(t){let n=typeof t==`string`?D.toNumber(t):t;return lo({_internal:e},{chainId:n})}let c=new Map,l=[],u=M.createEmitter(),d=M.from({...u,async request(e){return await po(i),Ji(async()=>{let r;try{r=fo(uo,e)}catch(t){let n=t;if(!(n instanceof De.MethodNotSupportedError))throw n;if(e.method.startsWith(`wallet_`))throw new M.UnsupportedMethodError;return s().request(e)}let a=i.getState();switch(r.method){case`account_verifyEmail`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[e]=r._decoded.params,{chainId:o,email:c,token:l,walletAddress:u}=e,d=s(o);if(o&&o!==d.chain.id)throw new M.ChainDisconnectedError;let f=u?a.accounts.find(e=>E.isEqual(e.address,u)):a.accounts[0];if(!f)throw new M.UnauthorizedError;return await n().actions.verifyEmail({account:f,chainId:o,email:c,internal:{client:d,config:t,request:r,store:i},token:l,walletAddress:u})}case`wallet_addFunds`:{if(a.accounts.length===0)throw new M.DisconnectedError;let{address:e,value:o,token:c}=r.params[0]??{},l=e?a.accounts.find(t=>E.isEqual(t.address,e)):a.accounts[0];if(!l)throw new M.UnauthorizedError;let d=s(),f=await n().actions.addFunds({address:l.address,internal:{client:d,config:t,request:r,store:i},token:c,value:o});return u.emit(`message`,{data:null,type:`assetsChanged`}),f}case`eth_accounts`:if(a.accounts.length===0)throw new M.DisconnectedError;return a.accounts.map(yo);case`eth_chainId`:return D.fromNumber(a.chainIds[0]);case`eth_requestAccounts`:{if(a.accounts.length>0&&c.get(`eth_requestAccounts`))return a.accounts.map(yo);let e=s(),{accounts:o}=await n().actions.loadAccounts({internal:{client:e,config:t,request:r,store:i}});return i.setState(e=>({...e,accounts:o})),u.emit(`connect`,{chainId:D.fromNumber(e.chain.id)}),c.set(`eth_requestAccounts`,!0),setTimeout(()=>c.delete(`eth_requestAccounts`),1e3),o.map(yo)}case`eth_sendTransaction`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[{capabilities:e,chainId:o,data:c=`0x`,from:l,to:u,value:d}]=r._decoded.params,f=s(o);if(o&&o!==f.chain.id)throw new M.ChainDisconnectedError;let p=l?a.accounts.find(e=>E.isEqual(e.address,l)):a.accounts[0];if(!p)throw new M.UnauthorizedError;let{id:m}=await n().actions.sendCalls({account:p,asTxHash:!0,calls:[{data:c,to:u,value:d}],internal:{client:f,config:t,request:r,store:i},merchantUrl:mo(t.merchantUrl??e?.merchantUrl)});return m}case`eth_signTypedData_v4`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[e,o]=r._decoded.params,c=a.accounts.find(t=>E.isEqual(t.address,e));if(!c)throw new M.UnauthorizedError;let l=s();return await n().actions.signTypedData({account:c,data:o,internal:{client:l,config:t,request:r,store:i}})}case`wallet_grantAdmin`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[{address:e,capabilities:o,chainId:c,key:l}]=r._decoded.params??[{}],d=e?a.accounts.find(t=>E.isEqual(t.address,e)):a.accounts[0];if(!d)throw new M.UnauthorizedError;let f=s(c);if(_o([...d.keys??[]])?.some(e=>e.publicKey?.toLowerCase()===l.publicKey.toLowerCase()))throw new De.InvalidParamsError({message:`Key already granted as admin.`});let{key:p}=await n().actions.grantAdmin({account:d,feeToken:o?.feeToken,internal:{client:f,config:t,request:r,store:i},key:l});i.setState(e=>{let t=e.accounts.findIndex(e=>d?E.isEqual(e.address,d.address):!0);return t===-1?e:{...e,accounts:e.accounts.map((e,n)=>n===t?{...e,keys:[...e.keys??[],p]}:e)}});let m=_o([...d.keys??[],p]);return u.emit(`message`,{data:null,type:`adminsChanged`}),A.encode(pi.Response,{address:d.address,chainId:f.chain.id,key:m.at(-1)})}case`wallet_grantPermissions`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[{address:e,chainId:o,...c}]=r._decoded.params??[{}],l=e?a.accounts.find(t=>E.isEqual(t.address,e)):a.accounts[0];if(!l)throw new M.UnauthorizedError;let d=s(o),{key:f}=await n().actions.grantPermissions({account:l,internal:{client:d,config:t,request:r,store:i},permissions:c});return i.setState(e=>{let t=e.accounts.findIndex(e=>l?E.isEqual(e.address,l.address):!0);return t===-1?e:{...e,accounts:e.accounts.map((e,n)=>n===t?{...e,keys:[...e.keys??[],f]}:e)}}),u.emit(`message`,{data:null,type:`permissionsChanged`}),A.encode(mi.Response,{...ha(f,{address:l.address})})}case`wallet_getAdmins`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[{address:e,chainId:o}]=r._decoded.params??[{}],c=e?a.accounts.find(t=>E.isEqual(t.address,e)):a.accounts[0];if(!c)throw new M.UnauthorizedError;let l=s(o),u=_o(await n().actions.getKeys({account:c,internal:{client:l,config:t,request:r,store:i}}));return A.encode(fi.Response,{address:c.address,chainId:l.chain.id,keys:u})}case`wallet_prepareUpgradeAccount`:{let[{address:e,capabilities:a,chainId:o}]=r._decoded.params??[{}],{email:c,label:u,grantPermissions:d}=a??{},f=s(o),{context:p,digests:m}=await n().actions.prepareUpgradeAccount({address:e,email:c,internal:{client:f,config:t,request:r,store:i},label:u,permissions:d});return l.push(p.account),{context:p,digests:m}}case`wallet_getAccountVersion`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[{address:e}]=r._decoded.params??[{}],o=e?a.accounts.find(t=>E.isEqual(t.address,e)):a.accounts[0];if(!o)throw new M.UnauthorizedError;let c=s(),{current:l,latest:u}=await n().actions.getAccountVersion({address:o.address,internal:{client:c,config:t,request:r,store:i}});return{current:l,latest:u}}case`wallet_getKeys`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[{address:e,chainIds:o}]=r._decoded.params??[{}],c=a.accounts.find(t=>E.isEqual(t.address,e));if(!c)throw new M.UnauthorizedError;let l=s(),u=await n().actions.getKeys({account:c,chainIds:o,internal:{client:l,config:t,request:r,store:i}});return A.encode(Oi.Response,u)}case`wallet_getPermissions`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[{address:e,chainIds:o}]=r._decoded.params??[{}],c=e?a.accounts.find(t=>E.isEqual(t.address,e)):a.accounts[0];if(!c)throw new M.UnauthorizedError;let l=s();return vo(await n().actions.getKeys({account:c,chainIds:o,internal:{client:l,config:t,request:r,store:i}}),{address:c.address})}case`wallet_revokeAdmin`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[{address:e,capabilities:o,id:c}]=r._decoded.params,l=e?a.accounts.find(t=>E.isEqual(t.address,e)):a.accounts[0];if(!l)throw new M.UnauthorizedError;let d=s();await n().actions.revokeAdmin({account:l,feeToken:o?.feeToken,id:c,internal:{client:d,config:t,request:r,store:i}});let f=l.keys?.filter(e=>e.id.toLowerCase()!==c.toLowerCase());i.setState(e=>({...e,accounts:e.accounts.map(e=>E.isEqual(e.address,l.address)?{...e,keys:f}:e)})),u.emit(`message`,{data:null,type:`adminsChanged`});return}case`wallet_revokePermissions`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[{address:e,capabilities:o,id:c}]=r._decoded.params,l=e?a.accounts.find(t=>E.isEqual(t.address,e)):a.accounts[0];if(!l)throw new M.UnauthorizedError;let d=s();await n().actions.revokePermissions({account:l,feeToken:o?.feeToken,id:c,internal:{client:d,config:t,request:r,store:i}});let f=l.keys?.filter(e=>e.id.toLowerCase()!==c.toLowerCase());i.setState(e=>({...e,accounts:e.accounts.map(e=>E.isEqual(e.address,l.address)?{...e,keys:f}:e)})),u.emit(`message`,{data:null,type:`permissionsChanged`});return}case`wallet_upgradeAccount`:{let[{context:e,signatures:a}]=r._decoded.params??[{}],o=s(),c=l.find(t=>E.isEqual(t.address,e.account.address));if(!c)throw new M.UnauthorizedError;let{account:d}=await n().actions.upgradeAccount({account:c,context:e,internal:{client:o,config:t,request:r,store:i},signatures:a}),f=_o(d.keys??[]),p=vo(d.keys??[],{address:d.address});return i.setState(e=>({...e,accounts:[d]})),u.emit(`connect`,{chainId:D.fromNumber(o.chain.id)}),{address:d.address,capabilities:{admins:f,...p.length>0?{permissions:p}:{}}}}case`porto_ping`:return`pong`;case`personal_sign`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[e,o]=r._decoded.params,c=a.accounts.find(e=>E.isEqual(e.address,o));if(!c)throw new M.UnauthorizedError;let l=s();return await n().actions.signPersonalMessage({account:c,data:e,internal:{client:l,config:t,request:r,store:i}})}case`wallet_connect`:{let[{capabilities:e,chainIds:o}]=r._decoded.params??[{}],c=s(o?.[0]),l=c.chain.id,{createAccount:d,email:f,grantAdmins:p,grantPermissions:m,selectAccount:h,signInWithEthereum:g,providerRdns:_}=e??{},v={client:c,config:t,request:r,store:i},{accounts:y}=await(async()=>{if(f||d){let{label:e=void 0}=typeof d==`object`?d:{},{account:t}=await n().actions.createAccount({admins:p,email:f,internal:v,label:e,permissions:m,providerRdns:_,signInWithEthereum:g});return{accounts:[t]}}let e=a.accounts[0],{address:t,key:r}=(()=>{if(h)return typeof h==`object`?h:{address:void 0,key:void 0};for(let t of e?.keys??[]){if(t.type===`webauthn-p256`&&t.role===`admin`)return{address:e?.address,key:{credentialId:t.credentialId??t.privateKey?.credential?.id,publicKey:t.publicKey}};if(t.type===`eip1193provider`&&t.role===`admin`&&!_)return{address:e?.address,key:{rdns:t.privateKey?.rdns}}}return{address:void 0,key:void 0}})(),i={internal:v,permissions:m,providerRdns:_,signInWithEthereum:g};try{return await n().actions.loadAccounts({address:t,key:r,...i})}catch(e){if(e instanceof M.UserRejectedRequestError)throw e;if(t&&r)return await n().actions.loadAccounts(i);throw e}})();i.setState(e=>({...e,accounts:y}));let b=[l,...i.getState().chainIds.filter(e=>e!==l)];return u.emit(`connect`,{chainId:D.fromNumber(b[0])}),{accounts:y.map(e=>({address:yo(e),capabilities:{admins:e.keys?_o(e.keys):[],permissions:e.keys?vo(e.keys,{address:e.address}):[],...e.signInWithEthereum&&{signInWithEthereum:e.signInWithEthereum}}})),chainIds:b.map(e=>D.fromNumber(e))}}case`wallet_disconnect`:{let e=s();await n().actions.disconnect?.({internal:{client:e,config:t,request:r,store:i}}),i.setState(e=>({...e,accounts:[]})),u.emit(`disconnect`,new M.DisconnectedError);return}case`wallet_getAssets`:{let[e]=r._decoded.params??[],{account:a,chainFilter:o,assetFilter:c,assetTypeFilter:l}=e,u=s(),d=await n().actions.getAssets({account:a,assetFilter:c,assetTypeFilter:l,chainFilter:o,internal:{client:u,config:t,request:r,store:i}}),f=Object.entries(d).reduce((e,[t,n])=>(e[D.fromNumber(Number(t))]=n,e),{});return A.encode(Ti.Response,f)}case`wallet_getCallsStatus`:{let[e]=r._decoded.params??[],a=s();return await n().actions.getCallsStatus({id:e,internal:{client:a,config:t,request:r,store:i}})}case`wallet_getCapabilities`:{let[e,t]=r.params??[];return await o({chainIds:t,request:r})}case`wallet_prepareCalls`:{let[e]=r._decoded.params,{calls:o,capabilities:c,chainId:l,key:u,from:d}=e,f=s(l),p=d??a.accounts[0];if(!p)throw new M.UnauthorizedError;if(l&&l!==f.chain.id)throw new M.ChainDisconnectedError;let{digest:m,...h}=await n().actions.prepareCalls({account:Y(p),calls:o,feeToken:c?.feeToken,internal:{client:f,config:t,request:r,store:i},key:u,merchantUrl:mo(t.merchantUrl??c?.merchantUrl),requiredFunds:c?.requiredFunds});return A.encode(J.Response,{capabilities:h.capabilities,chainId:D.fromNumber(h.chainId??f.chain.id),context:{...h.context,account:{address:h.account.address},calls:h.context.calls??[],nonce:h.context.nonce??0n},digest:m,key:h.key,typedData:h.typedData})}case`wallet_sendPreparedCalls`:{let[e]=r._decoded.params,{chainId:a,context:o,key:c,signature:l}=e,{account:u}=e.context,d=s(a);if(a&&D.toNumber(a)!==d.chain.id)throw new M.ChainDisconnectedError;return[{id:await n().actions.sendPreparedCalls({account:Y(u),context:o,internal:{client:d,config:t,request:r,store:i},key:c,signature:l})}]}case`wallet_sendCalls`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[e]=r._decoded.params,{calls:o,capabilities:c,chainId:l,from:u}=e,d=s(l);if(l&&l!==d.chain.id)throw new M.ChainDisconnectedError;let f=u?a.accounts.find(e=>E.isEqual(e.address,u)):a.accounts[0];if(!f)throw new M.UnauthorizedError;let{id:p}=await n().actions.sendCalls({account:f,calls:o,feeToken:c?.feeToken,internal:{client:d,config:t,request:r,store:i},merchantUrl:mo(t.merchantUrl??c?.merchantUrl),permissionsId:c?.permissions?.id,requiredFunds:c?.requiredFunds});return{id:p}}case`wallet_switchEthereumChain`:{let[e]=r._decoded.params,{chainId:a}=e,o=D.toNumber(a);if(!t.chains.find(e=>e.id===o))throw new M.UnsupportedChainIdError;let c=s(a);await n().actions.switchChain?.({chainId:c.chain.id,internal:{client:c,config:t,request:r,store:i}}),i.setState(e=>({...e,chainIds:[o,...e.chainIds.filter(e=>e!==o)]}));return}case`wallet_verifySignature`:{let[e]=r._decoded.params,{address:t,chainId:n,digest:i,signature:a}=e,o=s(n);return{...await za(o,{address:t,digest:i,signature:a}),address:t,chainId:D.fromNumber(o.chain.id)}}}},{enabled:[`eth_accounts`,`eth_chainId`,`eth_requestAccounts`,`wallet_getAssets`,`wallet_getCapabilities`,`wallet_getKeys`,`wallet_getPermissions`,`wallet_getAccountVersion`,`wallet_connect`].includes(e.method),id:ue.stringify(e)})}});function f(){let e=()=>{},t=()=>{};po(i).then(()=>{o().catch(()=>{}),e(),e=i.subscribe(e=>e.accounts,e=>{u.emit(`accountsChanged`,e.map(yo))},{equalityFn:(e,t)=>e.every((e,n)=>e.address===t[n]?.address)}),t(),t=i.subscribe(e=>e.chainIds[0],(e,t)=>{e!==t&&u.emit(`chainChanged`,D.fromNumber(e))})});let n=go(d,a);return()=>{e(),t(),n()}}let p=f();return Object.assign(d,{_internal:{destroy:p}})}function go(e,t){if(!t||typeof window>`u`||!window.dispatchEvent)return()=>{};let{icon:n=`data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDIyIiBoZWlnaHQ9IjQyMiIgdmlld0JveD0iMCAwIDQyMiA0MjIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSI0MjIiIGhlaWdodD0iNDIyIiBmaWxsPSJibGFjayIvPgo8ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfMV8xNSkiPgo8cGF0aCBkPSJNODEgMjg2LjM2NkM4MSAyODAuODkzIDg1LjQ1MDUgMjc2LjQ1NSA5MC45NDA0IDI3Ni40NTVIMzI5LjUxMUMzMzUuMDAxIDI3Ni40NTUgMzM5LjQ1MiAyODAuODkzIDMzOS40NTIgMjg2LjM2NlYzMDYuMTg4QzMzOS40NTIgMzExLjY2MiAzMzUuMDAxIDMxNi4wOTkgMzI5LjUxMS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IDEyMS44NCAyNzkuODA4IDEyMS44NEgzMTEuNjE4QzMxNy4xMDggMTIxLjg0IDMyMS41NTggMTI2LjI3OCAzMjEuNTU4IDEzMS43NTJWMTYxLjQ4NUMzMjEuNTU4IDE2Ni45NTkgMzE3LjEwOCAxNzEuMzk2IDMxMS42MTggMTcxLjM5NkgyNzkuODA4QzI3NC4zMTggMTcxLjM5NiAyNjkuODY4IDE2Ni45NTkgMjY5Ljg2OCAxNjEuNDg1VjEzMS43NTJaIiBmaWxsPSJ3aGl0ZSIvPgo8L2c+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzFfMTUiPgo8cmVjdCB3aWR0aD0iMjU5IiBoZWlnaHQ9IjIxMyIgZmlsbD0id2hpdGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDgxIDEwNCkiLz4KPC9jbGlwUGF0aD4KPC9kZWZzPgo8L3N2Zz4K`,name:r=`Rise Wallet`,rdns:i=`com.risechain.wallet`}=typeof t==`object`?t:{};return _e.announceProvider({info:{icon:n,name:r,rdns:i,uuid:qi()},provider:e})}function _o(e){return e.map(e=>{if(e.role===`admin`)try{return A.encode(fi.Key,{id:e.id??e.publicKey,publicKey:e.publicKey,type:e.type,...e.type===`webauthn-p256`?{credentialId:e.privateKey?.credential?.id,privateKey:{credential:{id:e.privateKey?.credential?.id},rpId:e.privateKey?.rpId}}:{}})}catch{return}}).filter(Boolean)}function vo(e,{address:t}){return e.map(e=>{if(e.chainId&&e.role===`session`&&!(e.expiry>0&&e.expiry<BigInt(Math.floor(Date.now()/1e3))))try{return A.encode(ma,ha(e,{address:t}))}catch{return}}).filter(Boolean)}function yo(e){return _(e.address)}function bo(e){return e}function xo(){let e=typeof indexedDB<`u`?Re(`porto`,`store`):void 0;return bo({async getItem(t){let n=await Be(t,e);return n===null?null:n},async removeItem(t){await ze(t,e)},async setItem(t,n){await Ve(t,Gi(n),e)},sizeLimit:1024*1024*50})}function So(){let e=new Map;return bo({getItem(t){return e.get(t)??null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,n)},sizeLimit:1/0})}const Co=typeof window<`u`&&typeof document<`u`,wo={announceProvider:!0,chains:rn,mode:Co?no({host:Qi.prod}):to(),relay:x(ao.prod.http),storage:Co&&typeof indexedDB<`u`?xo():So(),storageKey:`risewallet.store`};function To(e={}){let t=e.chains??wo.chains,n=Object.fromEntries(t.map(t=>[t.id,e.transports?.[t.id]??x()])),r={announceProvider:e.announceProvider??wo.announceProvider,authUrl:e.authUrl,chains:t,feeToken:e.feeToken,merchantUrl:e.merchantUrl,mode:e.mode??wo.mode,relay:e.relay??wo.relay,storage:e.storage??wo.storage,storageKey:e.storageKey??wo.storageKey,transports:n},i=Le(Pe(Ie(Fe(e=>({accounts:[],chainIds:r.chains.map(e=>e.id),feeToken:r.feeToken,requestQueue:[]}),{merge(e,t){let n=e,i=r.chains.find(e=>e.id===n.chainIds[0])?.id??r.chains[0].id,a=[i,...r.chains.map(e=>e.id).filter(e=>e!==i)];return{...t,...n,chainIds:a}},name:r.storageKey,partialize:e=>({accounts:e.accounts.map(e=>Gi(e)),chainIds:e.chainIds}),storage:r.storage,version:5})))),a=r.mode,o={config:r,getMode(){return a},id:qi(),setMode(e){return c?.(),a=e,c=e.setup({internal:o}),c},store:i},s=ho(o),c=a===null?()=>{}:a.setup({internal:o});return{_internal:o,config:r,destroy(){c(),s._internal.destroy()},provider:s}}const Eo=new Map;function Do(e,t={}){let{provider:n}=e,{id:r}=e._internal,i=[`provider`,r].filter(Boolean).join(`:`);if(Eo.has(i))return Eo.get(i);let a=f({...t,pollingInterval:1e3,transport:m(n)});return Eo.set(i,a),a}async function Oo(e={}){let{dialog:t}=e;return Do(To({announceProvider:!1,chains:[ae],mode:no({host:t?new URL(`/dialog`,`https://`+t).toString():void 0,renderer:await da()})}),{chain:ae})}async function ko(i,a){let o=await Oo(a);Qt(`Create a Porto Account`);let s=tn(),c=a.adminKey?yn():void 0,l;if(c)try{let r=n.join(t.tmpdir(),`porto`);e.mkdirSync(r,{mode:448,recursive:!0}),l=n.join(r,`admin-key-${Date.now()}-${Math.random().toString(36).slice(2)}.key`),e.writeFileSync(l,c.privateKey(),{mode:384})}catch{}let u=!!c;function d(e,t){if(!u)return process.exit(1);try{s.stop(`Interrupted.`)}catch{}if(t){let n=t instanceof Error?t.message:String(t);z.info(`${e??`Error`}: ${n}`)}c&&(l?z.info(`Admin key saved securely to temporary file: ${l}`):z.warn(`Admin key could not be saved to a temporary file. Please rerun to generate a new key.`)),u=!1,process.exit(1)}let f=()=>d(`SIGINT`),p=()=>d(`SIGTERM`),m=e=>d(`uncaughtException`,e),h=e=>d(`unhandledRejection`,e),g=()=>{u&&=(c&&(l?z.info(`Admin key saved securely to temporary file:\n${l}`):z.warn(`Admin key could not be saved to a temporary file. Please rerun to generate a new key.`)),!1)};c&&(process.on(`SIGINT`,f),process.on(`SIGTERM`,p),process.on(`uncaughtException`,m),process.on(`unhandledRejection`,h),process.on(`exit`,g)),c&&X.registerPublicKey(c.publicKey);let _=ae.id;s.start(`Creating account...`);let{accounts:v}=await Ii(o,{chainIds:[_],createAccount:!0,grantAdmins:c?[{publicKey:c.publicKey,type:c.type}]:void 0});if(s.stop(`Account created.`),s.start(`Onramping...`),await o.request({method:`wallet_addFunds`,params:[{address:v[0].address,token:a.testnet?void 0:`0x0000000000000000000000000000000000000000`}]}),s.stop(`Onramped.`),X.send(`success`,{content:`You have successfully created an account.`,title:`Account created`}),c){let{digest:e,...t}=await o.request({method:`wallet_prepareCalls`,params:[{calls:[],chainId:S(_),key:c}]}),n=await V(c,{address:null,payload:e,wrap:!1}),r=await o.request({method:`wallet_sendPreparedCalls`,params:[{...t,signature:n}]});s.start(`Initializing account...`),await ee.waitForCallsStatus(o,{id:r[0].id,throwOnFailure:!0}),s.stop(`Account initialized.`)}if(c){let t=await Zt({initialValue:!1,message:`Reveal private key? (This will be visible in terminal)`});if(z.info(`Address: `+v[0].address),t)z.info(`Private key: `+c?.privateKey());else{let t=n.join(import.meta.dirname,`${v[0].address}.key`);e.writeFileSync(t,c?.privateKey(),{mode:384}),e.chmodSync(t,384),z.info(`Private key saved securely to: ${t}`)}if(l)try{e.rmSync(l)}catch{}}z.info(`Manage your account at: https://id.porto.sh`),u=!1,c&&(process.off(`SIGINT`,f),process.off(`SIGTERM`,p),process.off(`uncaughtException`,m),process.off(`unhandledRejection`,h),process.off(`exit`,g)),await r(1e3),process.exit(0)}export{ko as createAccount};
|
|
50
|
+
`));let u=oo({public:n.transports[l.id]??g(l.rpcUrls.default.http.map(e=>x(e))),relay:o}),d=[r,ue.stringify(l)].filter(Boolean).join(`:`);if(co.has(d))return co.get(d);let p=f({...t,chain:l,pollingInterval:1e3,transport:u});return co.set(d,p),p}const uo=A.discriminatedUnion(`method`,[ii.Request,oi.Request,si.Request,ci.Request,li.Request,ui.Request,di.Request,hi.Request,fi.Request,gi.Request,pi.Request,mi.Request,ki.Request,_i.Request,vi.Request,bi.Request,xi.Request,Si.Request,Ci.Request,wi.Request,Ti.Request,Ei.Request,Di.Request,Oi.Request,J.Request,Ai.Request,ji.Request,yi.Request,Mi.Request]);function fo(e,t){let n=A.safeParse(e,t);if(n.error){let e=n.error.issues.at(0);throw e?.code===`invalid_union`&&e.note===`No matching discriminator`?new De.MethodNotSupportedError:new De.InvalidParamsError(Bn(n.error))}return{...t,_decoded:n.data}}async function po(e){e.persist.hasHydrated()||await new Promise(t=>{e.persist.onFinishHydration(()=>t(!0)),setTimeout(()=>t(!0),100)})}function mo(e){if(e)return e.startsWith(`/`)?`${window.location.origin}${e}`:e}function ho(e){let{config:t,getMode:n,id:r,store:i}=e,{announceProvider:a}=t;function o(e={}){let a=s(),o=e.request??fo(uo,{method:`wallet_getCapabilities`,params:e.chainIds?[void 0,e.chainIds]:void 0});return C(()=>n().actions.getCapabilities({chainIds:e.chainIds,internal:{client:a,config:t,request:o,store:i}}),{cacheKey:`getCapabilities.${r}.${e.chainIds?.join(`,`)}`})}function s(t){let n=typeof t==`string`?D.toNumber(t):t;return lo({_internal:e},{chainId:n})}let c=new Map,l=[],u=M.createEmitter(),d=M.from({...u,async request(e){return await po(i),Ji(async()=>{let r;try{r=fo(uo,e)}catch(t){let n=t;if(!(n instanceof De.MethodNotSupportedError))throw n;if(e.method.startsWith(`wallet_`))throw new M.UnsupportedMethodError;return s().request(e)}let a=i.getState();switch(r.method){case`account_verifyEmail`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[e]=r._decoded.params,{chainId:o,email:c,token:l,walletAddress:u}=e,d=s(o);if(o&&o!==d.chain.id)throw new M.ChainDisconnectedError;let f=u?a.accounts.find(e=>E.isEqual(e.address,u)):a.accounts[0];if(!f)throw new M.UnauthorizedError;return await n().actions.verifyEmail({account:f,chainId:o,email:c,internal:{client:d,config:t,request:r,store:i},token:l,walletAddress:u})}case`wallet_addFunds`:{if(a.accounts.length===0)throw new M.DisconnectedError;let{address:e,value:o,token:c}=r.params[0]??{},l=e?a.accounts.find(t=>E.isEqual(t.address,e)):a.accounts[0];if(!l)throw new M.UnauthorizedError;let d=s(),f=await n().actions.addFunds({address:l.address,internal:{client:d,config:t,request:r,store:i},token:c,value:o});return u.emit(`message`,{data:null,type:`assetsChanged`}),f}case`eth_accounts`:if(a.accounts.length===0)throw new M.DisconnectedError;return a.accounts.map(yo);case`eth_chainId`:return D.fromNumber(a.chainIds[0]);case`eth_requestAccounts`:{if(a.accounts.length>0&&c.get(`eth_requestAccounts`))return a.accounts.map(yo);let e=s(),{accounts:o}=await n().actions.loadAccounts({internal:{client:e,config:t,request:r,store:i}});return i.setState(e=>({...e,accounts:o})),u.emit(`connect`,{chainId:D.fromNumber(e.chain.id)}),c.set(`eth_requestAccounts`,!0),setTimeout(()=>c.delete(`eth_requestAccounts`),1e3),o.map(yo)}case`eth_sendTransaction`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[{capabilities:e,chainId:o,data:c=`0x`,from:l,to:u,value:d}]=r._decoded.params,f=s(o);if(o&&o!==f.chain.id)throw new M.ChainDisconnectedError;let p=l?a.accounts.find(e=>E.isEqual(e.address,l)):a.accounts[0];if(!p)throw new M.UnauthorizedError;let{id:m}=await n().actions.sendCalls({account:p,asTxHash:!0,calls:[{data:c,to:u,value:d}],internal:{client:f,config:t,request:r,store:i},merchantUrl:mo(t.merchantUrl??e?.merchantUrl)});return m}case`eth_signTypedData_v4`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[e,o]=r._decoded.params,c=a.accounts.find(t=>E.isEqual(t.address,e));if(!c)throw new M.UnauthorizedError;let l=s();return await n().actions.signTypedData({account:c,data:o,internal:{client:l,config:t,request:r,store:i}})}case`wallet_grantAdmin`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[{address:e,capabilities:o,chainId:c,key:l}]=r._decoded.params??[{}],d=e?a.accounts.find(t=>E.isEqual(t.address,e)):a.accounts[0];if(!d)throw new M.UnauthorizedError;let f=s(c);if(_o([...d.keys??[]])?.some(e=>e.publicKey?.toLowerCase()===l.publicKey.toLowerCase()))throw new De.InvalidParamsError({message:`Key already granted as admin.`});let{key:p}=await n().actions.grantAdmin({account:d,feeToken:o?.feeToken,internal:{client:f,config:t,request:r,store:i},key:l});i.setState(e=>{let t=e.accounts.findIndex(e=>d?E.isEqual(e.address,d.address):!0);return t===-1?e:{...e,accounts:e.accounts.map((e,n)=>n===t?{...e,keys:[...e.keys??[],p]}:e)}});let m=_o([...d.keys??[],p]);return u.emit(`message`,{data:null,type:`adminsChanged`}),A.encode(pi.Response,{address:d.address,chainId:f.chain.id,key:m.at(-1)})}case`wallet_grantPermissions`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[{address:e,chainId:o,...c}]=r._decoded.params??[{}],l=e?a.accounts.find(t=>E.isEqual(t.address,e)):a.accounts[0];if(!l)throw new M.UnauthorizedError;let d=s(o),{key:f}=await n().actions.grantPermissions({account:l,internal:{client:d,config:t,request:r,store:i},permissions:c});return i.setState(e=>{let t=e.accounts.findIndex(e=>l?E.isEqual(e.address,l.address):!0);return t===-1?e:{...e,accounts:e.accounts.map((e,n)=>n===t?{...e,keys:[...e.keys??[],f]}:e)}}),u.emit(`message`,{data:null,type:`permissionsChanged`}),A.encode(mi.Response,{...ha(f,{address:l.address})})}case`wallet_getAdmins`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[{address:e,chainId:o}]=r._decoded.params??[{}],c=e?a.accounts.find(t=>E.isEqual(t.address,e)):a.accounts[0];if(!c)throw new M.UnauthorizedError;let l=s(o),u=_o(await n().actions.getKeys({account:c,internal:{client:l,config:t,request:r,store:i}}));return A.encode(fi.Response,{address:c.address,chainId:l.chain.id,keys:u})}case`wallet_prepareUpgradeAccount`:{let[{address:e,capabilities:a,chainId:o}]=r._decoded.params??[{}],{email:c,label:u,grantPermissions:d}=a??{},f=s(o),{context:p,digests:m}=await n().actions.prepareUpgradeAccount({address:e,email:c,internal:{client:f,config:t,request:r,store:i},label:u,permissions:d});return l.push(p.account),{context:p,digests:m}}case`wallet_getAccountVersion`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[{address:e}]=r._decoded.params??[{}],o=e?a.accounts.find(t=>E.isEqual(t.address,e)):a.accounts[0];if(!o)throw new M.UnauthorizedError;let c=s(),{current:l,latest:u}=await n().actions.getAccountVersion({address:o.address,internal:{client:c,config:t,request:r,store:i}});return{current:l,latest:u}}case`wallet_getKeys`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[{address:e,chainIds:o}]=r._decoded.params??[{}],c=a.accounts.find(t=>E.isEqual(t.address,e));if(!c)throw new M.UnauthorizedError;let l=s(),u=await n().actions.getKeys({account:c,chainIds:o,internal:{client:l,config:t,request:r,store:i}});return A.encode(Oi.Response,u)}case`wallet_getPermissions`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[{address:e,chainIds:o}]=r._decoded.params??[{}],c=e?a.accounts.find(t=>E.isEqual(t.address,e)):a.accounts[0];if(!c)throw new M.UnauthorizedError;let l=s();return vo(await n().actions.getKeys({account:c,chainIds:o,internal:{client:l,config:t,request:r,store:i}}),{address:c.address})}case`wallet_revokeAdmin`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[{address:e,capabilities:o,id:c}]=r._decoded.params,l=e?a.accounts.find(t=>E.isEqual(t.address,e)):a.accounts[0];if(!l)throw new M.UnauthorizedError;let d=s();await n().actions.revokeAdmin({account:l,feeToken:o?.feeToken,id:c,internal:{client:d,config:t,request:r,store:i}});let f=l.keys?.filter(e=>e.id.toLowerCase()!==c.toLowerCase());i.setState(e=>({...e,accounts:e.accounts.map(e=>E.isEqual(e.address,l.address)?{...e,keys:f}:e)})),u.emit(`message`,{data:null,type:`adminsChanged`});return}case`wallet_revokePermissions`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[{address:e,capabilities:o,id:c}]=r._decoded.params,l=e?a.accounts.find(t=>E.isEqual(t.address,e)):a.accounts[0];if(!l)throw new M.UnauthorizedError;let d=s();await n().actions.revokePermissions({account:l,feeToken:o?.feeToken,id:c,internal:{client:d,config:t,request:r,store:i}});let f=l.keys?.filter(e=>e.id.toLowerCase()!==c.toLowerCase());i.setState(e=>({...e,accounts:e.accounts.map(e=>E.isEqual(e.address,l.address)?{...e,keys:f}:e)})),u.emit(`message`,{data:null,type:`permissionsChanged`});return}case`wallet_upgradeAccount`:{let[{context:e,signatures:a}]=r._decoded.params??[{}],o=s(),c=l.find(t=>E.isEqual(t.address,e.account.address));if(!c)throw new M.UnauthorizedError;let{account:d}=await n().actions.upgradeAccount({account:c,context:e,internal:{client:o,config:t,request:r,store:i},signatures:a}),f=_o(d.keys??[]),p=vo(d.keys??[],{address:d.address});return i.setState(e=>({...e,accounts:[d]})),u.emit(`connect`,{chainId:D.fromNumber(o.chain.id)}),{address:d.address,capabilities:{admins:f,...p.length>0?{permissions:p}:{}}}}case`porto_ping`:return`pong`;case`personal_sign`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[e,o]=r._decoded.params,c=a.accounts.find(e=>E.isEqual(e.address,o));if(!c)throw new M.UnauthorizedError;let l=s();return await n().actions.signPersonalMessage({account:c,data:e,internal:{client:l,config:t,request:r,store:i}})}case`wallet_connect`:{let[{capabilities:e,chainIds:o}]=r._decoded.params??[{}],c=s(o?.[0]),l=c.chain.id,{createAccount:d,email:f,grantAdmins:p,grantPermissions:m,selectAccount:h,signInWithEthereum:g,providerRdns:_}=e??{},v={client:c,config:t,request:r,store:i},{accounts:y}=await(async()=>{if(f||d){let{label:e=void 0}=typeof d==`object`?d:{},{account:t}=await n().actions.createAccount({admins:p,email:f,internal:v,label:e,permissions:m,providerRdns:_,signInWithEthereum:g});return{accounts:[t]}}let e=a.accounts[0],{address:t,key:r}=(()=>{if(h)return typeof h==`object`?h:{address:void 0,key:void 0};for(let t of e?.keys??[]){if(t.type===`webauthn-p256`&&t.role===`admin`)return{address:e?.address,key:{credentialId:t.credentialId??t.privateKey?.credential?.id,publicKey:t.publicKey}};if(t.type===`eip1193provider`&&t.role===`admin`&&!_)return{address:e?.address,key:{rdns:t.privateKey?.rdns}}}return{address:void 0,key:void 0}})(),i={internal:v,permissions:m,providerRdns:_,signInWithEthereum:g};try{return await n().actions.loadAccounts({address:t,key:r,...i})}catch(e){if(e instanceof M.UserRejectedRequestError)throw e;if(t&&r)return await n().actions.loadAccounts(i);throw e}})();i.setState(e=>({...e,accounts:y}));let b=[l,...i.getState().chainIds.filter(e=>e!==l)];return u.emit(`connect`,{chainId:D.fromNumber(b[0])}),{accounts:y.map(e=>({address:yo(e),capabilities:{admins:e.keys?_o(e.keys):[],permissions:e.keys?vo(e.keys,{address:e.address}):[],...e.signInWithEthereum&&{signInWithEthereum:e.signInWithEthereum}}})),chainIds:b.map(e=>D.fromNumber(e))}}case`wallet_disconnect`:{let e=s();await n().actions.disconnect?.({internal:{client:e,config:t,request:r,store:i}}),i.setState(e=>({...e,accounts:[]})),u.emit(`disconnect`,new M.DisconnectedError);return}case`wallet_getAssets`:{let[e]=r._decoded.params??[],{account:a,chainFilter:o,assetFilter:c,assetTypeFilter:l}=e,u=s(),d=await n().actions.getAssets({account:a,assetFilter:c,assetTypeFilter:l,chainFilter:o,internal:{client:u,config:t,request:r,store:i}}),f=Object.entries(d).reduce((e,[t,n])=>(e[D.fromNumber(Number(t))]=n,e),{});return A.encode(Ti.Response,f)}case`wallet_getCallsStatus`:{let[e]=r._decoded.params??[],a=s();return await n().actions.getCallsStatus({id:e,internal:{client:a,config:t,request:r,store:i}})}case`wallet_getCapabilities`:{let[e,t]=r.params??[];return await o({chainIds:t,request:r})}case`wallet_prepareCalls`:{let[e]=r._decoded.params,{calls:o,capabilities:c,chainId:l,key:u,from:d}=e,f=s(l),p=d??a.accounts[0];if(!p)throw new M.UnauthorizedError;if(l&&l!==f.chain.id)throw new M.ChainDisconnectedError;let{digest:m,...h}=await n().actions.prepareCalls({account:Y(p),calls:o,feeToken:c?.feeToken,internal:{client:f,config:t,request:r,store:i},key:u,merchantUrl:mo(t.merchantUrl??c?.merchantUrl),requiredFunds:c?.requiredFunds});return A.encode(J.Response,{capabilities:h.capabilities,chainId:D.fromNumber(h.chainId??f.chain.id),context:{...h.context,account:{address:h.account.address},calls:h.context.calls??[],nonce:h.context.nonce??0n},digest:m,key:h.key,typedData:h.typedData})}case`wallet_sendPreparedCalls`:{let[e]=r._decoded.params,{chainId:a,context:o,key:c,signature:l}=e,{account:u}=e.context,d=s(a);if(a&&D.toNumber(a)!==d.chain.id)throw new M.ChainDisconnectedError;return[{id:await n().actions.sendPreparedCalls({account:Y(u),context:o,internal:{client:d,config:t,request:r,store:i},key:c,signature:l})}]}case`wallet_sendCalls`:{if(a.accounts.length===0)throw new M.DisconnectedError;let[e]=r._decoded.params,{calls:o,capabilities:c,chainId:l,from:u}=e,d=s(l);if(l&&l!==d.chain.id)throw new M.ChainDisconnectedError;let f=u?a.accounts.find(e=>E.isEqual(e.address,u)):a.accounts[0];if(!f)throw new M.UnauthorizedError;let{id:p}=await n().actions.sendCalls({account:f,calls:o,feeToken:c?.feeToken,internal:{client:d,config:t,request:r,store:i},merchantUrl:mo(t.merchantUrl??c?.merchantUrl),permissionsId:c?.permissions?.id,requiredFunds:c?.requiredFunds});return{id:p}}case`wallet_switchEthereumChain`:{let[e]=r._decoded.params,{chainId:a}=e,o=D.toNumber(a);if(!t.chains.find(e=>e.id===o))throw new M.UnsupportedChainIdError;let c=s(a);await n().actions.switchChain?.({chainId:c.chain.id,internal:{client:c,config:t,request:r,store:i}}),i.setState(e=>({...e,chainIds:[o,...e.chainIds.filter(e=>e!==o)]}));return}case`wallet_verifySignature`:{let[e]=r._decoded.params,{address:t,chainId:n,digest:i,signature:a}=e,o=s(n);return{...await za(o,{address:t,digest:i,signature:a}),address:t,chainId:D.fromNumber(o.chain.id)}}}},{enabled:[`eth_accounts`,`eth_chainId`,`eth_requestAccounts`,`wallet_getAssets`,`wallet_getCapabilities`,`wallet_getKeys`,`wallet_getPermissions`,`wallet_getAccountVersion`,`wallet_connect`].includes(e.method),id:ue.stringify(e)})}});function f(){let e=()=>{},t=()=>{};po(i).then(()=>{o().catch(()=>{}),e(),e=i.subscribe(e=>e.accounts,e=>{u.emit(`accountsChanged`,e.map(yo))},{equalityFn:(e,t)=>e.every((e,n)=>e.address===t[n]?.address)}),t(),t=i.subscribe(e=>e.chainIds[0],(e,t)=>{e!==t&&u.emit(`chainChanged`,D.fromNumber(e))})});let n=go(d,a);return()=>{e(),t(),n()}}let p=f();return Object.assign(d,{_internal:{destroy:p}})}function go(e,t){if(!t||typeof window>`u`||!window.dispatchEvent)return()=>{};let{icon:n=`data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDIyIiBoZWlnaHQ9IjQyMiIgdmlld0JveD0iMCAwIDQyMiA0MjIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSI0MjIiIGhlaWdodD0iNDIyIiBmaWxsPSJibGFjayIvPgo8ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfMV8xNSkiPgo8cGF0aCBkPSJNODEgMjg2LjM2NkM4MSAyODAuODkzID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MUgzMjkuNTExQzMzNS4wMDEgMzE2LjEwMSAzMzkuNDUyIDMxMS42NjIgMzM5LjQ1MiAzMDYuMTg4VjI4Ni4zNjZaIiBmaWxsPSJ3aGl0ZSIvPgo8cGF0aCBkPSJNMjY5Ljg2OCAxMzEuNzUyQzI2OS44NjggMTI2LjI3OCAyNzQuMzE4IDEyMS44NCAyNzkuODA4IDEyMS44NEgzMTEuNjE4QzMxNy4xMDggMTIxLjg0IDMyMS41NTggMTI2LjI3OCAzMjEuNTU4IDEzMS43NTJWMTYxLjQ4NUMzMjEuNTU4IDE2Ni45NTkgMzE3LjEwOCAxNzEuMzk2IDMxMS42MTggMTcxLjM5NkgyNzkuODA4QzI3NC4zMTggMTcxLjM5NiAyNjkuODY4IDE2Ni45NTkgMjY5Ljg2OCAxNjEuNDg1VjEzMS43NTJaIiBmaWxsPSJ3aGl0ZSIvPgo8L2c+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzFfMTUiPgo8cmVjdCB3aWR0aD0iMjU5IiBoZWlnaHQ9IjIxMyIgZmlsbD0id2hpdGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDgxIDEwNCkiLz4KPC9jbGlwUGF0aD4KPC9kZWZzPgo8L3N2Zz4K`,name:r=`Rise Wallet`,rdns:i=`com.risechain.wallet`}=typeof t==`object`?t:{};return _e.announceProvider({info:{icon:n,name:r,rdns:i,uuid:qi()},provider:e})}function _o(e){return e.map(e=>{if(e.role===`admin`)try{return A.encode(fi.Key,{id:e.id??e.publicKey,publicKey:e.publicKey,type:e.type,...e.type===`webauthn-p256`?{credentialId:e.privateKey?.credential?.id,privateKey:{credential:{id:e.privateKey?.credential?.id},rpId:e.privateKey?.rpId}}:{}})}catch{return}}).filter(Boolean)}function vo(e,{address:t}){return e.map(e=>{if(e.chainId&&e.role===`session`&&!(e.expiry>0&&e.expiry<BigInt(Math.floor(Date.now()/1e3))))try{return A.encode(ma,ha(e,{address:t}))}catch{return}}).filter(Boolean)}function yo(e){return _(e.address)}function bo(e){return e}function xo(){let e=typeof indexedDB<`u`?Re(`porto`,`store`):void 0;return bo({async getItem(t){let n=await Be(t,e);return n===null?null:n},async removeItem(t){await ze(t,e)},async setItem(t,n){await Ve(t,Gi(n),e)},sizeLimit:1024*1024*50})}function So(){let e=new Map;return bo({getItem(t){return e.get(t)??null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,n)},sizeLimit:1/0})}const Co=typeof window<`u`&&typeof document<`u`,wo={announceProvider:!0,chains:rn,mode:Co?no({host:Qi.prod}):to(),relay:x(ao.prod.http),storage:Co&&typeof indexedDB<`u`?xo():So(),storageKey:`risewallet.store`};function To(e={}){let t=e.chains??wo.chains,n=Object.fromEntries(t.map(t=>[t.id,e.transports?.[t.id]??x()])),r={announceProvider:e.announceProvider??wo.announceProvider,authUrl:e.authUrl,chains:t,feeToken:e.feeToken,merchantUrl:e.merchantUrl,mode:e.mode??wo.mode,relay:e.relay??wo.relay,storage:e.storage??wo.storage,storageKey:e.storageKey??wo.storageKey,transports:n},i=Le(Pe(Ie(Fe(e=>({accounts:[],chainIds:r.chains.map(e=>e.id),feeToken:r.feeToken,requestQueue:[]}),{merge(e,t){let n=e,i=r.chains.find(e=>e.id===n.chainIds[0])?.id??r.chains[0].id,a=[i,...r.chains.map(e=>e.id).filter(e=>e!==i)];return{...t,...n,chainIds:a}},name:r.storageKey,partialize:e=>({accounts:e.accounts.map(e=>Gi(e)),chainIds:e.chainIds}),storage:r.storage,version:5})))),a=r.mode,o={config:r,getMode(){return a},id:qi(),setMode(e){return c?.(),a=e,c=e.setup({internal:o}),c},store:i},s=ho(o),c=a===null?()=>{}:a.setup({internal:o});return{_internal:o,config:r,destroy(){c(),s._internal.destroy()},provider:s}}const Eo=new Map;function Do(e,t={}){let{provider:n}=e,{id:r}=e._internal,i=[`provider`,r].filter(Boolean).join(`:`);if(Eo.has(i))return Eo.get(i);let a=f({...t,pollingInterval:1e3,transport:m(n)});return Eo.set(i,a),a}async function Oo(e={}){let{dialog:t}=e;return Do(To({announceProvider:!1,chains:[ie],mode:no({host:t?new URL(`/dialog`,`https://`+t).toString():void 0,renderer:await da()})}),{chain:ie})}async function ko(i,a){let o=await Oo(a);Qt(`Create a Porto Account`);let s=tn(),c=a.adminKey?yn():void 0,l;if(c)try{let r=n.join(t.tmpdir(),`porto`);e.mkdirSync(r,{mode:448,recursive:!0}),l=n.join(r,`admin-key-${Date.now()}-${Math.random().toString(36).slice(2)}.key`),e.writeFileSync(l,c.privateKey(),{mode:384})}catch{}let u=!!c;function d(e,t){if(!u)return process.exit(1);try{s.stop(`Interrupted.`)}catch{}if(t){let n=t instanceof Error?t.message:String(t);z.info(`${e??`Error`}: ${n}`)}c&&(l?z.info(`Admin key saved securely to temporary file: ${l}`):z.warn(`Admin key could not be saved to a temporary file. Please rerun to generate a new key.`)),u=!1,process.exit(1)}let f=()=>d(`SIGINT`),p=()=>d(`SIGTERM`),m=e=>d(`uncaughtException`,e),h=e=>d(`unhandledRejection`,e),g=()=>{u&&=(c&&(l?z.info(`Admin key saved securely to temporary file:\n${l}`):z.warn(`Admin key could not be saved to a temporary file. Please rerun to generate a new key.`)),!1)};c&&(process.on(`SIGINT`,f),process.on(`SIGTERM`,p),process.on(`uncaughtException`,m),process.on(`unhandledRejection`,h),process.on(`exit`,g)),c&&X.registerPublicKey(c.publicKey);let _=ie.id;s.start(`Creating account...`);let{accounts:v}=await Ii(o,{chainIds:[_],createAccount:!0,grantAdmins:c?[{publicKey:c.publicKey,type:c.type}]:void 0});if(s.stop(`Account created.`),s.start(`Onramping...`),await o.request({method:`wallet_addFunds`,params:[{address:v[0].address,token:a.testnet?void 0:`0x0000000000000000000000000000000000000000`}]}),s.stop(`Onramped.`),X.send(`success`,{content:`You have successfully created an account.`,title:`Account created`}),c){let{digest:e,...t}=await o.request({method:`wallet_prepareCalls`,params:[{calls:[],chainId:S(_),key:c}]}),n=await V(c,{address:null,payload:e,wrap:!1}),r=await o.request({method:`wallet_sendPreparedCalls`,params:[{...t,signature:n}]});s.start(`Initializing account...`),await ee.waitForCallsStatus(o,{id:r[0].id,throwOnFailure:!0}),s.stop(`Account initialized.`)}if(c){let t=await Zt({initialValue:!1,message:`Reveal private key? (This will be visible in terminal)`});if(z.info(`Address: `+v[0].address),t)z.info(`Private key: `+c?.privateKey());else{let t=n.join(import.meta.dirname,`${v[0].address}.key`);e.writeFileSync(t,c?.privateKey(),{mode:384}),e.chmodSync(t,384),z.info(`Private key saved securely to: ${t}`)}if(l)try{e.rmSync(l)}catch{}}z.info(`Manage your account at: https://id.porto.sh`),u=!1,c&&(process.off(`SIGINT`,f),process.off(`SIGTERM`,p),process.off(`uncaughtException`,m),process.off(`unhandledRejection`,h),process.off(`exit`,g)),await r(1e3),process.exit(0)}export{ko as createAccount};
|
package/dist/cli/bin/index.js
CHANGED
|
@@ -6,4 +6,4 @@ import{EventEmitter as e}from"events";function t(e){return e==null?[]:Array.isAr
|
|
|
6
6
|
`)}),i&&(a=i(a)||a),console.log(a.map(e=>e.title?`${e.title}:
|
|
7
7
|
${e.body}`:e.body).join(`
|
|
8
8
|
|
|
9
|
-
`))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;t&&console.log(`${e}/${t} ${_}`)}checkRequiredArgs(){let e=this.args.filter(e=>e.required).length;if(this.cli.args.length<e)throw new m(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions){for(let n of Object.keys(e))if(n!==`--`&&!this.hasOption(n)&&!t.hasOption(n))throw new m(`Unknown option \`${n.length>1?`--${n}`:`-${n}`}\``)}}checkOptionValue(){let{options:e,globalCommand:t}=this.cli,n=[...t.options,...this.options];for(let t of n){let r=e[t.name.split(`.`)[0]];if(t.required){let e=n.some(e=>e.negated&&e.names.includes(t.name));if(r===!0||r===!1&&!e)throw new m(`option \`${t.rawName}\` value is missing`)}}}},y=class extends v{constructor(e){super(`@@global@@`,``,{},e)}},b=Object.assign,x=class extends e{constructor(e=``){super(),this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new y(this),this.globalCommand.usage(`<command> [options]`)}usage(e){return this.globalCommand.usage(e),this}command(e,t,n){let r=new v(e,t||``,n,this);return r.globalCommand=this.globalCommand,this.commands.push(r),r}option(e,t,n){return this.globalCommand.option(e,t,n),this}help(e){return this.globalCommand.option(`-h, --help`,`Display this message`),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,t=`-v, --version`){return this.globalCommand.version(e,t),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){this.matchedCommand?this.matchedCommand.outputHelp():this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:t},n,r){return this.args=e,this.options=t,n&&(this.matchedCommand=n),r&&(this.matchedCommandName=r),this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(e=g,{run:t=!0}={}){this.rawArgs=e,this.name||=e[1]?f(e[1]):`cli`;let n=!0;for(let t of this.commands){let r=this.mri(e.slice(2),t),i=r.args[0];if(t.isMatched(i)){n=!1;let e=b(b({},r),{args:r.args.slice(1)});this.setParsedInfo(e,t,i),this.emit(`command:${i}`,t)}}if(n){for(let t of this.commands)if(t.name===``){n=!1;let r=this.mri(e.slice(2),t);this.setParsedInfo(r,t),this.emit(`command:!`,t)}}if(n){let t=this.mri(e.slice(2));this.setParsedInfo(t)}this.options.help&&this.showHelpOnExit&&(this.outputHelp(),t=!1,this.unsetMatchedCommand()),this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null&&(this.outputVersion(),t=!1,this.unsetMatchedCommand());let r={args:this.args,options:this.options};return t&&this.runMatchedCommand(),!this.matchedCommand&&this.args[0]&&this.emit(`command:*`),r}mri(e,t){let n=[...this.globalCommand.options,...t?t.options:[]],i=o(n),a=[],s=e.indexOf(`--`);s>-1&&(a=e.slice(s+1),e=e.slice(0,s));let c=r(e,i);c=Object.keys(c).reduce((e,t)=>b(b({},e),{[p(t)]:c[t]}),{_:[]});let l=c._,f={"--":a},m=t&&t.config.ignoreOptionDefaultValue?t.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,h=Object.create(null);for(let e of n){if(!m&&e.config.default!==void 0)for(let t of e.names)f[t]=e.config.default;Array.isArray(e.config.type)&&h[e.name]===void 0&&(h[e.name]=Object.create(null),h[e.name].shouldTransform=!0,h[e.name].transformFunction=e.config.type[0])}for(let e of Object.keys(c))e!==`_`&&(u(f,e.split(`.`),c[e]),d(f,h));return{args:l,options:f}}runMatchedCommand(){let{args:e,options:t,matchedCommand:n}=this;if(!n||!n.commandAction)return;n.checkUnknownOptions(),n.checkOptionValue(),n.checkRequiredArgs();let r=[];return n.args.forEach((t,n)=>{t.variadic?r.push(e.slice(n)):r.push(e[n])}),r.push(t),n.commandAction.apply(this,r)}};const S=(e=``)=>new x(e);var C=`0.3.1`;const w=S(`porto`);w.command(`[root]`,`Display usage`).action(()=>{w.outputHelp(),process.exit(0)}),w.command(`onboard [alias: o]`,`Create a Porto Account`).alias(`o`).option(`-a, --admin-key`,`Create and provision an additional admin key for server access`,{default:!1}).option(`-d, --dialog <hostname>`,`Dialog hostname`,{default:`id.porto.sh`}).option(`-t, --testnet`,`Onboard via testnet`,{default:!1}).action(async(e,t)=>(await import(`./commands-
|
|
9
|
+
`))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;t&&console.log(`${e}/${t} ${_}`)}checkRequiredArgs(){let e=this.args.filter(e=>e.required).length;if(this.cli.args.length<e)throw new m(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions){for(let n of Object.keys(e))if(n!==`--`&&!this.hasOption(n)&&!t.hasOption(n))throw new m(`Unknown option \`${n.length>1?`--${n}`:`-${n}`}\``)}}checkOptionValue(){let{options:e,globalCommand:t}=this.cli,n=[...t.options,...this.options];for(let t of n){let r=e[t.name.split(`.`)[0]];if(t.required){let e=n.some(e=>e.negated&&e.names.includes(t.name));if(r===!0||r===!1&&!e)throw new m(`option \`${t.rawName}\` value is missing`)}}}},y=class extends v{constructor(e){super(`@@global@@`,``,{},e)}},b=Object.assign,x=class extends e{constructor(e=``){super(),this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new y(this),this.globalCommand.usage(`<command> [options]`)}usage(e){return this.globalCommand.usage(e),this}command(e,t,n){let r=new v(e,t||``,n,this);return r.globalCommand=this.globalCommand,this.commands.push(r),r}option(e,t,n){return this.globalCommand.option(e,t,n),this}help(e){return this.globalCommand.option(`-h, --help`,`Display this message`),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,t=`-v, --version`){return this.globalCommand.version(e,t),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){this.matchedCommand?this.matchedCommand.outputHelp():this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:t},n,r){return this.args=e,this.options=t,n&&(this.matchedCommand=n),r&&(this.matchedCommandName=r),this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(e=g,{run:t=!0}={}){this.rawArgs=e,this.name||=e[1]?f(e[1]):`cli`;let n=!0;for(let t of this.commands){let r=this.mri(e.slice(2),t),i=r.args[0];if(t.isMatched(i)){n=!1;let e=b(b({},r),{args:r.args.slice(1)});this.setParsedInfo(e,t,i),this.emit(`command:${i}`,t)}}if(n){for(let t of this.commands)if(t.name===``){n=!1;let r=this.mri(e.slice(2),t);this.setParsedInfo(r,t),this.emit(`command:!`,t)}}if(n){let t=this.mri(e.slice(2));this.setParsedInfo(t)}this.options.help&&this.showHelpOnExit&&(this.outputHelp(),t=!1,this.unsetMatchedCommand()),this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null&&(this.outputVersion(),t=!1,this.unsetMatchedCommand());let r={args:this.args,options:this.options};return t&&this.runMatchedCommand(),!this.matchedCommand&&this.args[0]&&this.emit(`command:*`),r}mri(e,t){let n=[...this.globalCommand.options,...t?t.options:[]],i=o(n),a=[],s=e.indexOf(`--`);s>-1&&(a=e.slice(s+1),e=e.slice(0,s));let c=r(e,i);c=Object.keys(c).reduce((e,t)=>b(b({},e),{[p(t)]:c[t]}),{_:[]});let l=c._,f={"--":a},m=t&&t.config.ignoreOptionDefaultValue?t.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,h=Object.create(null);for(let e of n){if(!m&&e.config.default!==void 0)for(let t of e.names)f[t]=e.config.default;Array.isArray(e.config.type)&&h[e.name]===void 0&&(h[e.name]=Object.create(null),h[e.name].shouldTransform=!0,h[e.name].transformFunction=e.config.type[0])}for(let e of Object.keys(c))e!==`_`&&(u(f,e.split(`.`),c[e]),d(f,h));return{args:l,options:f}}runMatchedCommand(){let{args:e,options:t,matchedCommand:n}=this;if(!n||!n.commandAction)return;n.checkUnknownOptions(),n.checkOptionValue(),n.checkRequiredArgs();let r=[];return n.args.forEach((t,n)=>{t.variadic?r.push(e.slice(n)):r.push(e[n])}),r.push(t),n.commandAction.apply(this,r)}};const S=(e=``)=>new x(e);var C=`0.3.3-beta.1`;const w=S(`porto`);w.command(`[root]`,`Display usage`).action(()=>{w.outputHelp(),process.exit(0)}),w.command(`onboard [alias: o]`,`Create a Porto Account`).alias(`o`).option(`-a, --admin-key`,`Create and provision an additional admin key for server access`,{default:!1}).option(`-d, --dialog <hostname>`,`Dialog hostname`,{default:`id.porto.sh`}).option(`-t, --testnet`,`Onboard via testnet`,{default:!1}).action(async(e,t)=>(await import(`./commands-B8imwW1l.js`)).createAccount(null,t)),w.help(),w.version(C),w.parse();export{};
|