From a451dbae10f6600df10e77a7648b128f88f70dfb Mon Sep 17 00:00:00 2001 From: FrederikBolding Date: Tue, 17 Dec 2024 12:57:05 +0000 Subject: [PATCH] deploy: aa5f7a141fcf2f75ffaca0cdefb9a87252ba2c29 --- snaps-simulator/staging/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snaps-simulator/staging/main.js b/snaps-simulator/staging/main.js index b6e676b7fb..d18631ed0b 100644 --- a/snaps-simulator/staging/main.js +++ b/snaps-simulator/staging/main.js @@ -202,4 +202,4 @@ ${e} `}table(e,t){return t&&(t=`${t}`),"\n\n"+e+"\n"+t+"
\n"}tablerow(e){return` ${e} `}tablecell(e,t){let r=t.header?"th":"td",n=t.align?`<${r} align="${t.align}">`:`<${r}>`;return n+e+` -`}strong(e){return`${e}`}em(e){return`${e}`}codespan(e){return`${e}`}br(){return"
"}del(e){return`${e}`}link(e,t,r){let n=of(e);if(null===n)return r;let i='"}image(e,t,r){let n=of(e);if(null===n)return r;let i=`${r}"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""));continue;case"code":r+=this.renderer.code(i.text,i.lang,!!i.escaped);continue;case"table":{let e="",t="";for(let e=0;e0&&"paragraph"===t.tokens[0].type?(t.tokens[0].text=e+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&"text"===t.tokens[0].tokens[0].type&&(t.tokens[0].tokens[0].text=e+" "+t.tokens[0].tokens[0].text)):t.tokens.unshift({type:"text",text:e+" "}):s+=e+" "}s+=this.parse(t.tokens,n),o+=this.renderer.listitem(s,a,!!r)}r+=this.renderer.list(o,e,t);continue}case"html":r+=this.renderer.html(i.text,i.block);continue;case"paragraph":r+=this.renderer.paragraph(this.parseInline(i.tokens));continue;case"text":{let o=i,a=o.tokens?this.parseInline(o.tokens):o.text;for(;n+1{let i=e[n].flat(1/0);r=r.concat(this.walkTokens(i,t))}):e.tokens&&(r=r.concat(this.walkTokens(e.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let r={...e};if(r.async=this.defaults.async||r.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error("extension name required");if("renderer"in e){let r=t.renderers[e.name];r?t.renderers[e.name]=function(...t){let n=e.renderer.apply(this,t);return!1===n&&(n=r.apply(this,t)),n}:t.renderers[e.name]=e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw Error("extension level must be 'block' or 'inline'");let r=t[e.level];r?r.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),r.extensions=t),e.renderer){let t=this.defaults.renderer||new o6(this.defaults);for(let r in e.renderer){if(!(r in t))throw Error(`renderer '${r}' does not exist`);if("options"===r)continue;let n=e.renderer[r],i=t[r];t[r]=(...e)=>{let r=n.apply(t,e);return!1===r&&(r=i.apply(t,e)),r||""}}r.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new ob(this.defaults);for(let r in e.tokenizer){if(!(r in t))throw Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let n=e.tokenizer[r],i=t[r];t[r]=(...e)=>{let r=n.apply(t,e);return!1===r&&(r=i.apply(t,e)),r}}r.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new o7;for(let r in e.hooks){if(!(r in t))throw Error(`hook '${r}' does not exist`);if("options"===r)continue;let n=e.hooks[r],i=t[r];o7.passThroughHooks.has(r)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(n.call(t,e)).then(e=>i.call(t,e));let r=n.call(t,e);return i.call(t,r)}:t[r]=(...e)=>{let r=n.apply(t,e);return!1===r&&(r=i.apply(t,e)),r}}r.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,n=e.walkTokens;r.walkTokens=function(e){let r=[];return r.push(n.call(this,e)),t&&(r=r.concat(t.call(this,e))),r}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return o4.lex(e,t??this.defaults)}parser(e,t){return o8.parse(e,t??this.defaults)}#e(e,t){return(r,n)=>{let i={...n},o={...this.defaults,...i};!0===this.defaults.async&&!1===i.async&&(o.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),o.async=!0);let a=this.#t(!!o.silent,!!o.async);if(null==r)return a(Error("marked(): input parameter is undefined or null"));if("string"!=typeof r)return a(Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));if(o.hooks&&(o.hooks.options=o),o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(r):r).then(t=>e(t,o)).then(e=>o.hooks?o.hooks.processAllTokens(e):e).then(e=>o.walkTokens?Promise.all(this.walkTokens(e,o.walkTokens)).then(()=>e):e).then(e=>t(e,o)).then(e=>o.hooks?o.hooks.postprocess(e):e).catch(a);try{o.hooks&&(r=o.hooks.preprocess(r));let n=e(r,o);o.hooks&&(n=o.hooks.processAllTokens(n)),o.walkTokens&&this.walkTokens(n,o.walkTokens);let i=t(n,o);return o.hooks&&(i=o.hooks.postprocess(i)),i}catch(e){return a(e)}}}#t(e,t){return r=>{if(r.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="

An error occurred:

"+oc(r.message+"",!0)+"
";return t?Promise.resolve(e):e}if(t)return Promise.reject(r);throw r}}}let ae=new o9;function at(e,t){return ae.parse(e,t)}at.options=at.setOptions=function(e){return ae.setOptions(e),at.defaults=ae.defaults,on=at.defaults,at},at.getDefaults=or,at.defaults=on,at.use=function(...e){return ae.use(...e),at.defaults=ae.defaults,on=at.defaults,at},at.walkTokens=function(e,t){return ae.walkTokens(e,t)},at.parseInline=ae.parseInline,at.Parser=o8,at.parser=o8.parse,at.Renderer=o6,at.TextRenderer=o5,at.Lexer=o4,at.lexer=o4.lex,at.Tokenizer=ob,at.Hooks=o7,at.parse=at,at.options,at.setOptions,at.use;let ar=at.walkTokens;at.parseInline,o8.parse;let an=o4.lex;function ai(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);re.length)&&(t=e.length);for(var r=0,n=Array(t);r0?a_(e.tokens.flatMap(af)):e.href});case"text":return e.text;case"strong":return i3(i8,{children:ad(e.tokens)});case"em":return i3(i7,{children:ad(e.tokens)});default:return null}}function am(e,t,r){try{var n=new URL(e);if((0,_.assert)(ap.includes(n.protocol),"Protocol must be one of: ".concat(ap.join(", "),".")),"metamask:"===n.protocol){var i=function(e){var t=new URL(e),r=t.protocol;if("metamask:"!==r)throw Error('Unable to parse URL. Expected the protocol to be "metamask:", but received "'.concat(r,'".'));var n=ao(t.href.replace("metamask://","").split("/")),i=n[0],o=n.slice(1),a="/".concat(o.join("/"));switch(i){case"client":return(0,_.assert)(aa.includes(a),'Unable to navigate to "'.concat(a,'". The provided path is not allowed.')),{authority:i,path:a};case"snap":return function(e){var t,r="Invalid MetaMask url:",n=e6(e.slice(1)),i=e.slice(1).startsWith("npm:")?"npm:":"local:",o=n.startsWith("@"),a=n.split("/"),s="/".concat(a[a.length-1]);if("local:"===i){var l=ao(a.slice(0,-1)),u=l[0],c=l.slice(2);t="".concat(u,"//").concat(c.join("/")),(0,_.assert)(as.includes(s),"".concat(r," invalid snap path."))}else t=o?"".concat(a[0],"/").concat(a[1]):a[0],(0,_.assert)(o?3===a.length&&as.includes(s):2===a.length&&as.includes(s),"".concat(r," invalid snap path."));var p="".concat(i).concat(t);return(0,_.assertStruct)(p,e3,"Invalid snap ID"),{authority:"snap",snapId:p,path:s}}(a);default:throw Error('Expected "metamask:" URL to start with "client" or "snap", but received "'.concat(i,'".'))}}(e);i.snapId&&(0,_.assert)(r(i.snapId),"The Snap being navigated to is not installed.")}else if("mailto:"===n.protocol){var o=n.pathname.split(","),a=!0,s=!1,l=void 0;try{for(var u,c=o[Symbol.iterator]();!(a=(u=c.next()).done);a=!0){var p=u.value.split("@")[1];(0,_.assert)(!p.includes(":"));var d="https://".concat(p);(0,_.assert)(!t(d),"The specified URL is not allowed.")}}catch(e){s=!0,l=e}finally{try{a||null==c.return||c.return()}finally{if(s)throw l}}return}(0,_.assert)(!t(n.href),"The specified URL is not allowed.")}catch(e){throw Error("Invalid URL: ".concat((null==e?void 0:e.code)==="ERR_ASSERTION"?e.message:"Unable to parse URL."))}}function ah(e){return(0,_.hasProperty)(e.props,"children")}function ay(e){return!!e&&!0!==e}function ag(e){if(ah(e)){if(Array.isArray(e.props.children))return e.props.children.filter(ay).flat(1/0);if(e.props.children)return[e.props.children]}return[]}function ab(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(Array.isArray(e)){var n=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value,u=ab(l,t,r);if(void 0!==u)return u}}catch(e){i=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return}var c=t(e,r);if(void 0!==c)return c;if((0,_.hasProperty)(e,"props")&&(0,_.isPlainObject)(e.props)&&(0,_.hasProperty)(e.props,"children")){var p=ag(e),d=!0,f=!1,m=void 0;try{for(var h,y=p[Symbol.iterator]();!(d=(h=y.next()).done);d=!0){var g=h.value;if((0,_.isPlainObject)(g)){var b=ab(g,t,r+1);if(void 0!==b)return b}}}catch(e){f=!0,m=e}finally{try{d||null==y.return||y.return()}finally{if(f)throw m}}}}function av(e){return Object.entries(e).filter(function(e){return"children"!==au(e,1)[0]}).sort(function(e,t){var r=au(e,1)[0],n=au(t,1)[0];return r.localeCompare(n)}).map(function(e){var t=au(e,2),r=t[0],n=t[1];return" ".concat(r,"=").concat("string"==typeof n?'"'.concat(n,'"'):"{".concat(JSON.stringify(n),"}"))}).join("")}var ax=r(8261),aD=r.n(ax),aS=r(9691),aE=r.n(aS);function aT(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r1?"move":"default",children:[(0,p.jsx)(O,{icon:r.data.type.toLowerCase(),width:"16px"}),(0,p.jsx)(j.Text,{fontWeight:"500",fontSize:"sm",textTransform:"capitalize",color:"text.muted",display:"inline-block",minWidth:"65px",children:r.data.type}),i,Number(r.id)>=2&&(0,p.jsx)(O,{icon:"cross",width:"11px",marginX:"0.5",marginLeft:"auto",cursor:"pointer",onClick:function(){null==o||o(r)}})]})};function ak(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function aI(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:[];return function(){for(var n=arguments.length,i=Array(n),o=0;oe.length)&&(t=e.length);for(var r=0,n=Array(t);re.length)&&(t=e.length);for(var r=0,n=Array(t);re.length)&&(t=e.length);for(var r=0,n=Array(t);r ul":{display:"flex",flexDirection:"column",flex:1,marginY:"4","& > li":{display:"flex",flexDirection:"column",flex:1,marginTop:"0"}},ul:{listStyleType:"none"},li:{marginTop:"2"}},children:(0,p.jsx)(n4.Tree,{ref:n,tree:t,rootId:0,render:function(e,r){var n=r.depth,a=r.isDragging;return t.length<=1?(0,p.jsx)(aW,{}):(0,p.jsx)(aV,{node:e,depth:n,onChange:i,onClose:o,isDragging:a})},insertDroppableFirst:!1,canDrag:function(e){return!!e&&Number(e.id)>=2},canDrop:function(e,t){var r=t.dropTarget,n=t.dropTargetId,i=t.dragSource;return!!n&&null!=i&&!!i.data&&function(e,t){if(!e||!t)return!1;switch(e.type){case"Box":return aw(t);case"Form":return aA(t);case"Field":return aC(t);default:return!1}}(null==r?void 0:r.data,null==i?void 0:i.data)&&(null==r?void 0:r.droppable)&&Number(n)>0},onDrop:function(e){r(e)},initialOpen:!0,sort:!1,extraAcceptTypes:["template"],placeholderRender:function(){return(0,p.jsx)(j.Box,{width:"100%",height:"20px"})}})})},aX=function(e){var t=e.snapName,r=P(nr),n=r&&new Blob([r.value],{type:"image/svg+xml"}),i=n&&URL.createObjectURL(n);return(0,p.jsxs)(j.Box,{position:"relative",children:[(0,p.jsx)(j.Avatar,{src:i,name:t.slice(0,1).toUpperCase(),fontSize:"md",background:"background.alternative",color:"text.alternative",size:"sm",margin:"1"}),(0,p.jsx)(O,{icon:"snap",width:"16px",height:"16px",position:"absolute",bottom:"0px",right:"0px"})]})},a0=function(e){var t=e.snapName,r=e.snapId;return(0,p.jsxs)(j.Flex,{gap:"2",marginX:"4",marginY:"4",border:"1px solid",borderColor:"border.default",borderRadius:"32px",padding:"1",alignItems:"center",children:[(0,p.jsx)(aX,{snapName:t}),(0,p.jsxs)(j.Flex,{direction:"column",justify:"center",children:[(0,p.jsx)(j.Text,{fontSize:"sm",lineHeight:"157%",fontFamily:"custom",children:t}),(0,p.jsx)(j.Text,{fontSize:"xs",lineHeight:"167%",fontFamily:"custom",color:"text.alternative",children:r})]})]})},a1=function(e){var t=e.snapName,r=e.snapId,n=e.children,i=e.showAuthorship;return(0,p.jsxs)(j.Flex,{direction:"column",boxShadow:"lg",maxWidth:"360px",height:"600px",paddingY:"4",overflowY:"scroll",children:[(void 0===i||i)&&(0,p.jsx)(a0,{snapName:t,snapId:r}),n]})};!function(e){e.Content="content",e.Error="error",e.Insights="insights"}(cY||(cY={}));var a2=function(e,t){switch(e){case cY.Insights:return"Insights from ".concat(t);case cY.Error:return"Error from ".concat(t);default:return"Content from ".concat(t)}},a3=function(e){var t=e.type,r=e.snapName,n=e.children,i=t===cY.Error;return(0,p.jsxs)(j.Box,{border:"1px solid",borderColor:"border.default",borderRadius:"md",backgroundColor:i?"error.muted":void 0,children:[(0,p.jsxs)(j.Flex,{direction:"row",alignItems:"center",padding:"1.5",borderBottom:"1px solid",borderColor:"border.default",children:[(0,p.jsx)(O,{icon:i?"snapError":"snap",width:"16px",marginRight:"1"}),(0,p.jsx)(j.Text,{fontFamily:"custom",fontSize:"xs",color:i?"text.error":void 0,children:a2(t,r)})]}),(0,p.jsx)(j.Box,{padding:"3",children:n})]})};function a4(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r{let t=sx();sv(!0);try{let r=!1,n=sg(()=>{let t=e();return null!==t&&"object"==typeof t&&"function"==typeof t.then&&(r=!0),t});if(r)return{then:(e,r)=>{n.then(r=>{sv(t),e(r)},e=>{sv(t),r(e)})}};return sv(t),n}catch(e){throw sv(t),e}},sS=function(){return(0,sh.BX)(...arguments)};Object.keys(sh.BX).forEach(e=>{sS[e]=function(){return sh.BX[e](...arguments)}});let sE=sS.mouseEnter,sT=sS.mouseLeave;sS.mouseEnter=function(){return sE(...arguments),sS.mouseOver(...arguments)},sS.mouseLeave=function(){return sT(...arguments),sS.mouseOut(...arguments)};let sw=sS.pointerEnter,sA=sS.pointerLeave;sS.pointerEnter=function(){return sw(...arguments),sS.pointerOver(...arguments)},sS.pointerLeave=function(){return sA(...arguments),sS.pointerOut(...arguments)};let sC=sS.select;sS.select=(e,t)=>{sC(e,t),e.focus(),sS.keyUp(e,t)};let sM=sS.blur,sN=sS.focus;sS.blur=function(){return sS.focusOut(...arguments),sM(...arguments)},sS.focus=function(){return sS.focusIn(...arguments),sN(...arguments)},(0,sh.jQ)({unstable_advanceTimersWrapper:e=>sD(e),asyncWrapper:async e=>{let t=sx();sv(!1);try{let t=await e();return await new Promise(e=>{setTimeout(()=>{e()},0),"undefined"!=typeof jest&&null!==jest&&(!0===setTimeout._isMockFunction||Object.prototype.hasOwnProperty.call(setTimeout,"clock"))&&jest.advanceTimersByTime(0)}),t}finally{sv(t)}},eventWrapper:e=>{let t;return sD(()=>{t=e()}),t}});let sj=new Set,sk=[];function sI(){sk.forEach(e=>{let{root:t,container:r}=e;sD(()=>{t.unmount()}),r.parentNode===document.body&&document.body.removeChild(r)}),sk.length=0,sj.clear()}if((void 0===sy||!sy.env?.RTL_SKIP_AUTO_CLEANUP)&&("function"==typeof afterEach?afterEach(()=>{sI()}):"function"==typeof teardown&&teardown(()=>{sI()}),"function"==typeof beforeAll&&"function"==typeof afterAll)){let e=sx();beforeAll(()=>{e=sx(),sv(!0)}),afterAll(()=>{sv(e)})}var sO=r(1742),sP=r(1970),sF=r.n(sP),sL={primary:"primary",destructive:"outline"},sR=function(e){var t,r=e.node,n=e.id;i2(r),(0,_.assert)("Button"===r.type,"Expected value to be a button component.");var i=sf().handleEvent,o=r.props;return(0,p.jsx)(j.Button,{width:"100%",variant:sL[null!==(t=o.variant)&&void 0!==t?t:"primary"],marginBottom:"4",type:o.type,onClick:function(e){o.type===c$.Button&&e.preventDefault(),i({event:cV.ButtonClickEvent,name:o.name})},children:o.children},"".concat(n,"-button"))},sz=function(e){var t=e.node,r=e.id,n=e.form,i=sf(),o=i.handleInputChange,a=i.getValue;i2(t),(0,_.assert)("Input"===t.type,"Expected value to be an input component.");var s=t.props,l=a(s.name,n);return(0,p.jsx)(j.Input,{value:l,type:s.type,placeholder:s.placeholder,onChange:function(e){o(s.name,e.target.value,n)}},"".concat(r,"-input"))},sB={Bold:function(e){var t=e.node,r=e.id;return i2(t),(0,_.assert)("Bold"===t.type,"Expected value to be a bold component."),(0,p.jsx)(j.Text,{fontFamily:"custom",fontSize:"sm",paddingBottom:"1",as:"b",children:sq(ag(t),r)},"".concat(r,"-text"))},Box:function(e){var t=e.node,r=e.id;return i2(t),(0,_.assert)("Box"===t.type,"Expected value to be a Box component."),(0,p.jsx)(j.Box,{children:ag(t).map(function(e,t){return(0,p.jsx)(sU,{node:e},"".concat(r,"-panel-child-").concat(t))})},r)},Button:sR,Copyable:function(e){var t=e.node,r=e.id;i2(t),(0,_.assert)("Copyable"===t.type,"Expected value to be a copyable component.");var n=t.props;return(0,p.jsx)(a6,{value:n.value},"".concat(r,"-copyable"))},Divider:function(e){var t=e.id;return(0,p.jsx)(j.Divider,{orientation:"horizontal",marginTop:"3",marginBottom:"4",borderColor:"border.default"},"".concat(t,"-divider"))},Field:function(e){var t=e.node,r=e.id,n=e.form;i2(t),(0,_.assert)("Field"===t.type,"Expected value to be a field component.");var i=ag(t),o=i[0],a=i[1],s=t.props;return(0,p.jsxs)(j.FormControl,{isInvalid:!!s.error,children:[s.label&&(0,p.jsx)(j.FormLabel,{children:s.label}),(0,p.jsx)(sz,{id:r,node:o,form:n}),a&&(0,p.jsx)(sR,{id:r,node:a}),(0,p.jsx)(j.FormErrorMessage,{children:s.error})]},"".concat(r,"-field"))},Form:function(e){var t=e.node,r=e.id;i2(t),(0,_.assert)("Form"===t.type,"Expected value to be a form component.");var n=sf().handleEvent,i=t.props;return(0,p.jsx)(j.Box,{as:"form",onSubmit:function(e){e.preventDefault(),n({event:cV.FormSubmitEvent,name:i.name})},children:ag(t).map(function(e,n){return(0,p.jsx)(sU,{node:e,form:t.props.name},"".concat(r,"-form-child-").concat(n))})},r)},Heading:function(e){var t=e.node,r=e.id;i2(t),(0,_.assert)("Heading"===t.type,"Expected value to be a heading component.");var n=t.props;return(0,p.jsx)(j.Heading,{fontFamily:"custom",fontSize:"x-large",fontWeight:"bold",paddingBottom:"4",children:n.children},"".concat(r,"-heading"))},Input:sz,Italic:function(e){var t=e.node,r=e.id;return i2(t),(0,_.assert)("Italic"===t.type,"Expected value to be an italic component."),(0,p.jsx)(j.Text,{fontFamily:"custom",fontSize:"sm",paddingBottom:"1",as:"i",children:sq(ag(t),r)},r)},Link:function(e){var t=e.node,r=e.id;i2(t),(0,_.assert)("Link"===t.type,"Expected value to be a link component.");var n=t.props;return(0,p.jsxs)(j.Link,{href:n.href,target:"_blank",fontFamily:"custom",fontSize:"sm",isExternal:!0,color:"link.default",display:"inline",children:[sq(ag(t),r),(0,p.jsx)(O,{icon:"linkOut",width:"14px",marginLeft:"2px",display:"inline",verticalAlign:"middle"})]})},Spinner:function(e){var t=e.id;return(0,p.jsx)(j.Spinner,{},"".concat(t,"-spinner"))},Text:function(e){var t=e.node,r=e.id;return i2(t),(0,_.assert)("Text"===t.type,"Expected value to be a text component."),(0,p.jsx)(j.Text,{fontFamily:"custom",fontSize:"sm",paddingBottom:"1",children:sq(ag(t),r)},r)},Image:function(e){var t=e.id,r=e.node;i2(r),(0,_.assert)("Image"===r.type,"Expected value to be a image component.");var n=r.props,i="data:image/svg+xml;utf8,".concat(encodeURIComponent(n.src));return(0,p.jsx)(j.Image,{src:i,alt:n.alt},"".concat(t,"-image"))}},sU=function(e){var t=e.node,r=e.form,n=e.map,i=void 0===n?{}:n,o=e.id;if(!t)return null;var a=null!=o?o:s$(i,t),s=sB[t.type];if(!s)throw Error("Unknown component type: ".concat(t.type,"."));return(0,p.jsx)(s,{id:a,node:t,form:r},a)};function sq(e,t){return e.map(function(e,r){return"string"==typeof e?(0,sO.unescape)(e):(0,p.jsx)(sU,{id:"".concat(t,"-text-child-").concat(r),node:e},"".concat(t,"-text-child-").concat(r))})}var sJ=sF()(function(e){var t=e.type,r=e.props.name,n=function(e){if(!ah(e))return null;var t,r=e.props.children;return"string"==typeof r?r.slice(0,5e3):Array.isArray(r)?r.map(function(e){return{type:null!==(t=null==e?void 0:e.type)&&void 0!==t?t:null}}):r}(e);return(0,_.remove0x)((0,_.bytesToHex)(eC(JSON.stringify({type:t,name:null!=r?r:null,children:n}))))});function s$(e,t){var r,n=sJ(t),i=(null!==(r=e[n])&&void 0!==r?r:0)+1;return e[n]=i,"".concat(n,"_").concat(i)}var sK=function(e){var t=e.content,r=s$({},t);return(0,p.jsx)(sd,{children:(0,p.jsx)(sU,{node:t,id:r})})};function sY(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=Array(t);re.length)&&(t=e.length);for(var r=0,n=Array(t);re.length)&&(t=e.length);for(var r=0,n=Array(t);re.length)&&(t=e.length);for(var r=0,n=Array(t);r=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,["name","onClick"]);return(0,p.jsx)(nX,{cursor:"pointer",onClick:function(){r(n)},children:t})},lI=function(e){var t=e.onClick;return(0,p.jsxs)(j.Box,{marginBottom:"4",children:[(0,p.jsx)(j.Text,{fontWeight:"500",fontSize:"xs",marginBottom:"1",children:"Transaction presets"}),(0,p.jsx)(j.Flex,{gap:"2",children:lj.map(function(e,r){var n,i,o=e.name,a=e.transaction;return(0,f.createElement)(lk,(n=function(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var lF={chainId:"eip155:1",origin:"metamask.io",from:"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",to:"0x9f2817015caF6607C1198fB943A8241652EE8906",value:"0.01",gas:"21000",nonce:"5",maxFeePerGas:"10",maxPriorityFeePerGas:"1",data:"0x"},lL=function(){var e,t,r,n,i,o,a,s,l,u,c,_=P(lA).request,d=null!==(c=null==_?void 0:_.params)&&void 0!==c?c:{},f=d.chainId,m=d.transactionOrigin,h=d.transaction;lF.chainId,lF.origin;var y=lP(lF,["chainId","origin"]),g=(0,la.useForm)({defaultValues:lO({chainId:null!=f?f:lF.chainId,transactionOrigin:null!=m?m:lF.origin},null!=h?h:y)}),b=g.handleSubmit,v=g.register,x=g.setValue,D=g.formState.errors,S=N();return(0,p.jsxs)(j.Flex,{as:"form",flexDirection:"column",flex:"1",onSubmit:b(function(e){var t=e.chainId,r=e.transactionOrigin,n=lP(e,["chainId","transactionOrigin"]);S(r2({origin:"",handler:cC.OnTransaction,request:{jsonrpc:"2.0",method:"onTransaction",params:{chainId:t,transaction:lN(n),transactionOrigin:r}}}))}),id:"request-form",children:[(0,p.jsx)(lI,{onClick:function(e){x("chainId",e.chainId),x("transactionOrigin",e.transactionOrigin),x("from",e.from),x("to",e.to),x("value",e.value),x("data",e.data),x("gas",e.gas),x("maxFeePerGas",e.maxFeePerGas),x("maxPriorityFeePerGas",e.maxPriorityFeePerGas),x("nonce",e.nonce)}}),(0,p.jsxs)(j.Flex,{gap:"2",children:[(0,p.jsxs)(j.FormControl,{isInvalid:!!D.chainId,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"chainId",children:"Chain ID"}),(0,p.jsx)(j.Input,lO({id:"chainId",placeholder:lF.chainId,fontFamily:"code"},v("chainId"))),(0,p.jsx)(j.FormErrorMessage,{children:null===(e=D.chainId)||void 0===e?void 0:e.message})]}),(0,p.jsxs)(j.FormControl,{isInvalid:!!D.transactionOrigin,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"origin",children:"Transaction Origin"}),(0,p.jsx)(j.Input,lO({id:"origin",placeholder:lF.origin,fontFamily:"code"},v("transactionOrigin"))),(0,p.jsx)(j.FormErrorMessage,{children:null===(t=D.transactionOrigin)||void 0===t?void 0:t.message})]})]}),(0,p.jsxs)(j.FormControl,{isInvalid:!!D.from,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"from",children:"From Address"}),(0,p.jsx)(j.Input,lO({id:"from",placeholder:lF.from,fontFamily:"code"},v("from"))),(0,p.jsx)(j.FormErrorMessage,{children:null===(r=D.from)||void 0===r?void 0:r.message})]}),(0,p.jsxs)(j.FormControl,{isInvalid:!!D.to,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"to",children:"To Address"}),(0,p.jsx)(j.Input,lO({id:"to",placeholder:lF.to,fontFamily:"code"},v("to"))),(0,p.jsx)(j.FormErrorMessage,{children:null===(n=D.to)||void 0===n?void 0:n.message})]}),(0,p.jsxs)(j.FormControl,{isInvalid:!!D.value,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"value",children:"Value"}),(0,p.jsxs)(j.InputGroup,{children:[(0,p.jsx)(j.Input,lO({id:"value",placeholder:lF.value,fontFamily:"code"},v("value"))),(0,p.jsx)(j.InputRightAddon,{children:"ETH",fontSize:"sm"})]}),(0,p.jsx)(j.FormErrorMessage,{children:null===(i=D.value)||void 0===i?void 0:i.message})]}),(0,p.jsxs)(j.Flex,{gap:"2",children:[(0,p.jsxs)(j.FormControl,{isInvalid:!!D.gas,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"gas",children:"Gas Limit"}),(0,p.jsx)(j.Input,lO({id:"gas",placeholder:lF.gas,fontFamily:"code"},v("gas"))),(0,p.jsx)(j.FormErrorMessage,{children:null===(o=D.gas)||void 0===o?void 0:o.message})]}),(0,p.jsxs)(j.FormControl,{isInvalid:!!D.nonce,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"nonce",children:"Nonce"}),(0,p.jsx)(j.Input,lO({id:"nonce",placeholder:lF.nonce,fontFamily:"code"},v("nonce"))),(0,p.jsx)(j.FormErrorMessage,{children:null===(a=D.nonce)||void 0===a?void 0:a.message})]})]}),(0,p.jsxs)(j.Flex,{gap:"2",children:[(0,p.jsxs)(j.FormControl,{isInvalid:!!D.maxFeePerGas,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"maxFeePerGas",children:"Max Fee Per Gas"}),(0,p.jsxs)(j.InputGroup,{children:[(0,p.jsx)(j.Input,lO({id:"maxFeePerGas",placeholder:lF.maxFeePerGas,fontFamily:"code"},v("maxFeePerGas"))),(0,p.jsx)(j.InputRightAddon,{children:"GWEI",fontSize:"sm"})]}),(0,p.jsx)(j.FormErrorMessage,{children:null===(s=D.maxFeePerGas)||void 0===s?void 0:s.message})]}),(0,p.jsxs)(j.FormControl,{isInvalid:!!D.maxPriorityFeePerGas,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"maxPriorityFeePerGas",children:"Max Priority Fee Per Gas"}),(0,p.jsxs)(j.InputGroup,{children:[(0,p.jsx)(j.Input,lO({id:"maxPriorityFeePerGas",placeholder:lF.maxPriorityFeePerGas,fontFamily:"code"},v("maxPriorityFeePerGas"))),(0,p.jsx)(j.InputRightAddon,{children:"GWEI",fontSize:"sm"})]}),(0,p.jsx)(j.FormErrorMessage,{children:null===(l=D.maxPriorityFeePerGas)||void 0===l?void 0:l.message})]})]}),(0,p.jsxs)(j.FormControl,{isInvalid:!!D.data,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"data",children:"Data"}),(0,p.jsx)(j.Textarea,lO({id:"data",placeholder:lF.data,fontFamily:"code"},v("data"))),(0,p.jsx)(j.FormErrorMessage,{children:null===(u=D.data)||void 0===u?void 0:u.message})]})]})},lR=(0,m.createHashRouter)((0,m.createRoutesFromElements)((0,p.jsxs)(m.Route,{element:(0,p.jsx)(function(){return(0,p.jsxs)(j.Flex,{direction:"column",height:"100vh",children:[(0,p.jsx)(nd,{}),(0,p.jsxs)(j.Flex,{direction:"row",flex:"1",overflow:"hidden",children:[(0,p.jsx)(nO,{}),(0,p.jsxs)(j.Flex,{direction:"column",width:"full",children:[(0,p.jsx)(j.Flex,{flex:"1",overflow:"hidden",children:(0,p.jsx)(m.Outlet,{})}),(0,p.jsx)(K,{})]})]})]})},{}),children:[(0,p.jsx)(m.Route,{path:"/",element:(0,p.jsx)(m.Navigate,{to:"/handler/".concat(cC.OnRpcRequest),replace:!0})}),(0,p.jsx)(m.Route,{path:"/builder",element:(0,p.jsx)(function(){var e,t,r=sZ((0,f.useState)(2),2),n=r[0],i=r[1],o=sZ((0,f.useState)([{id:1,parent:0,text:"Box",droppable:!0,data:nL({children:null})}]),2),a=o[0],s=o[1];return(0,p.jsx)(j.Flex,{width:"100%",direction:"column",overflow:"hidden",children:(0,p.jsxs)(j.Flex,{direction:"row",flex:"1",overflow:"hidden",children:[(0,p.jsx)(j.Flex,{direction:"column",flex:"1",width:"50%",overflow:"hidden",children:(0,p.jsxs)(j.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,p.jsx)(j.TabList,{children:(0,p.jsx)(j.Tab,{children:"Builder"})}),(0,p.jsx)(j.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:(0,p.jsxs)(j.TabPanel,{display:"flex",flexDirection:"column",flex:"1",overflowY:"auto",children:[(0,p.jsx)(n3,{nextId:n,incrementId:function(){i(function(e){return e+1})}}),(0,p.jsx)(aZ,{items:a,setItems:s})]})})]})}),(0,p.jsx)(j.Box,{display:"flex",flexDirection:"column",flex:"1",width:"50%",borderLeft:"1px solid",borderColor:"border.default",children:(0,p.jsxs)(j.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,p.jsxs)(j.TabList,{children:[(0,p.jsx)(j.Tab,{children:"Result"}),(0,p.jsx)(j.Tab,{children:"Code"})]}),(0,p.jsxs)(j.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,p.jsx)(j.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"4",children:(0,p.jsx)(sH,{items:a})}),(0,p.jsx)(j.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"0",children:(0,p.jsx)(nq,{border:"none",value:(t=(function e(t){var r=new Set;r.add(t.type);var n=ag(t),i=!0,o=!1,a=void 0;try{for(var s,l=n[Symbol.iterator]();!(i=(s=l.next()).done);i=!0){var u=s.value;if("string"!=typeof u&&(r.add(u.type),ah(t))){var c=e(u),p=!0,_=!1,d=void 0;try{for(var f,m=c[Symbol.iterator]();!(p=(f=m.next()).done);p=!0){var h=f.value;r.add(h)}}catch(e){_=!0,d=e}finally{try{p||null==m.return||m.return()}finally{if(_)throw d}}}}}catch(e){o=!0,a=e}finally{try{i||null==l.return||l.return()}finally{if(o)throw a}}return Array.from(r).sort(function(e,t){return e.localeCompare(t)})})(e=aN(a)).join(", "),aE().format("\n import { ".concat(t," } from '@metamask/snaps-sdk/jsx';\n\n const Component = () => (").concat(function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(Array.isArray(t))return t.map(function(t){return e(t,r)}).join("");var n=" ".repeat(r);if("string"==typeof t)return"".concat(n).concat(t,"\n");if(!t)return"";var i=t.type,o=t.props,a=r>0?"\n":"";if((0,_.hasProperty)(o,"children")){var s=e(o.children,r+1);return"".concat(n,"<").concat(i).concat(av(o),">\n").concat(s).concat(n,"").concat(a)}return"".concat(n,"<").concat(i).concat(av(o)," />").concat(a)}(e),");\n"),{parser:"typescript",plugins:[aD()],printWidth:80,tabWidth:2,singleQuote:!0,trailingComma:"all"})),language:"typescript",options:{readOnly:!0}})})]})]})})]})})},{})}),(0,p.jsx)(m.Route,{path:"/manifest",element:(0,p.jsx)(function(){var e=P(ns);return(0,p.jsx)(j.Flex,{width:"100%",direction:"column",overflow:"hidden",children:(0,p.jsxs)(j.Flex,{direction:"row",flex:"1",overflow:"hidden",children:[(0,p.jsx)(j.Flex,{direction:"column",flex:"1",width:"50%",overflow:"hidden",children:(0,p.jsxs)(j.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,p.jsx)(j.TabList,{children:(0,p.jsx)(j.Tab,{children:"Validation"})}),(0,p.jsx)(j.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:(0,p.jsx)(j.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"0",children:(0,p.jsx)(s1,{})})})]})}),(0,p.jsx)(j.Box,{display:"flex",flexDirection:"column",flex:"1",width:"50%",borderLeft:"1px solid",borderColor:"border.default",children:(0,p.jsxs)(j.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,p.jsx)(j.TabList,{children:(0,p.jsx)(j.Tab,{children:"Manifest"})}),(0,p.jsx)(j.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:(0,p.jsx)(j.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"0",children:(0,p.jsx)(nq,{border:"none",value:JSON.stringify(e,null,2),options:{readOnly:!0,wordWrap:"on"}})})})]})})]})})},{})}),(0,p.jsxs)(m.Route,{path:"/handler",element:(0,p.jsx)(function(){var e,t=function(e){if(Array.isArray(e))return e}(e=(0,f.useState)(0))||function(e,t){var r,n,i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(r=i.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){s=!0,n=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw n}}return o}}(e,2)||function(e,t){if(e){if("string"==typeof e)return lu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return lu(e,t)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),r=t[0],n=t[1],i=P(nn);return(0,p.jsx)(j.Flex,{width:"100%",direction:"column",overflow:"hidden",children:(0,p.jsxs)(j.Flex,{direction:"row",flex:"1",overflow:"hidden",children:[(0,p.jsx)(s2,{isTest:!1,children:(0,p.jsx)(j.Flex,{direction:"column",flex:"1",width:"50%",overflow:"hidden",children:(0,p.jsxs)(j.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",isLazy:!0,onChange:n,children:[(0,p.jsx)(lt,{}),(0,p.jsxs)(j.TabList,{alignItems:"center",children:[(0,p.jsx)(j.Tab,{children:"Request"}),(0,p.jsx)(j.Tab,{children:"History"}),0===r&&(0,p.jsx)(j.Box,{marginLeft:"auto",children:(0,p.jsx)(le,{})})]}),(0,p.jsxs)(j.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,p.jsx)(j.TabPanel,{display:"flex",flexDirection:"column",flex:"1",overflowY:"auto","data-testid":"tab-request",children:(0,p.jsx)(m.Outlet,{})}),(0,p.jsx)(j.TabPanel,{padding:"0",display:"flex",flexDirection:"column",flex:"1",overflowY:"auto",children:(0,p.jsx)(s8,{})})]})]})})}),(0,p.jsx)(j.Box,{display:"flex",flexDirection:"column",flex:"1",width:"50%",borderLeft:"1px solid",borderColor:"border.default",children:(0,p.jsxs)(j.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,p.jsx)(lt,{}),(0,p.jsx)(lr,{}),(0,p.jsxs)(j.TabList,{children:[(0,p.jsx)(j.Tab,{children:"Response"}),i&&(0,p.jsx)(j.Tab,{children:"UI"})]}),(0,p.jsxs)(j.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,p.jsx)(j.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"0","data-testid":"tab-response",children:(0,p.jsx)(ln,{})}),i&&(0,p.jsx)(j.TabPanel,{overflowY:"auto","data-testid":"tab-ui",children:(0,p.jsx)(ll,{})})]})]})})]})})},{}),children:[(0,p.jsx)(m.Route,{path:"/handler/".concat(cC.OnRpcRequest),element:(0,p.jsx)(function(){return(0,p.jsx)(lm,{})},{})}),(0,p.jsx)(m.Route,{path:"/handler/".concat(cC.OnCronjob),element:(0,p.jsx)(function(){return(0,p.jsx)(lS,{})},{})}),(0,p.jsx)(m.Route,{path:"/handler/".concat(cC.OnTransaction),element:(0,p.jsx)(function(){return(0,p.jsx)(lL,{})},{})})]})]})));function lz(e){for(var t=1;t1?t-1:0),n=1;n1?t-1:0),n=1;n1?t-1:0),n=1;n2?r-2:0),i=2;i2?i-2:0),a=2;a2?r-2:0),i=2;i1?t-1:0),n=1;n3?t.i-4:t.i:Array.isArray(e)?1:co(e)?2:ca(e)?3:0}function cn(e,t){return 2===cr(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ci(e,t,r){var n=cr(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function co(e){return c4&&e instanceof Map}function ca(e){return c6&&e instanceof Set}function cs(e){return e.o||e.t}function cl(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=pr(e);delete t[c9];for(var r=pt(t),n=0;n1&&(e.set=e.add=e.clear=e.delete=cc),Object.freeze(e),t&&ct(e,function(e,t){return cu(t,!0)},!0)),e}function cc(){u7(2)}function cp(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function c_(e){var t=pn[e];return t||u7(18,e),t}function cd(e,t){t&&(c_("Patches"),e.u=[],e.s=[],e.v=t)}function cf(e){cm(e),e.p.forEach(cy),e.p=null}function cm(e){e===c2&&(c2=e.l)}function ch(e){return c2={p:[],l:c2,h:e,m:!0,_:0}}function cy(e){var t=e[c9];0===t.i||1===t.i?t.j():t.g=!0}function cg(e,t){t._=t.p.length;var r=t.p[0],n=void 0!==e&&e!==r;return t.h.O||c_("ES5").S(t,e,n),n?(r[c9].P&&(cf(t),u7(4)),ce(e)&&(e=cb(t,e),t.l||cx(t,e)),t.u&&c_("Patches").M(r[c9].t,e,t.u,t.s)):e=cb(t,r,[]),cf(t),t.u&&t.v(t.u,t.s),e!==c8?e:void 0}function cb(e,t,r){if(cp(t))return t;var n=t[c9];if(!n)return ct(t,function(i,o){return cv(e,n,t,i,o,r)},!0),t;if(n.A!==e)return t;if(!n.P)return cx(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var i=4===n.i||5===n.i?n.o=cl(n.k):n.o,o=i,a=!1;3===n.i&&(o=new Set(i),i.clear(),a=!0),ct(o,function(t,o){return cv(e,n,i,t,o,r,a)}),cx(e,i,!1),r&&e.u&&c_("Patches").N(n,r,e.u,e.s)}return n.o}function cv(e,t,r,n,i,o,a){if(u9(i)){var s=cb(e,i,o&&t&&3!==t.i&&!cn(t.R,n)?o.concat(n):void 0);if(ci(r,n,s),!u9(s))return;e.m=!1}else a&&r.add(i);if(ce(i)&&!cp(i)){if(!e.h.D&&e._<1)return;cb(e,i),t&&t.A.l||cx(e,i)}}function cx(e,t,r){void 0===r&&(r=!1),!e.l&&e.h.D&&e.m&&cu(t,r)}function cD(e,t){var r=e[c9];return(r?cs(r):e)[t]}function cS(e,t){if(t in e)for(var r=Object.getPrototypeOf(e);r;){var n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Object.getPrototypeOf(r)}}function cE(e){e.P||(e.P=!0,e.l&&cE(e.l))}function cT(e){e.o||(e.o=cl(e.t))}function cw(e,t,r){var n,i,o,a,s,l,u,c=co(t)?c_("MapSet").F(t,r):ca(t)?c_("MapSet").T(t,r):e.O?(o=i={i:(n=Array.isArray(t))?1:0,A:r?r.A:c2,P:!1,I:!1,R:{},l:r,t:t,k:null,o:null,j:null,C:!1},a=pi,n&&(o=[i],a=po),l=(s=Proxy.revocable(o,a)).revoke,u=s.proxy,i.k=u,i.j=l,u):c_("ES5").J(t,r);return(r?r.A:c2).p.push(c),c}function cA(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return cl(e)}!function(e){e.Insight="Insight",e.Dialog="Dialog",e.Notification="Notification",e.HomePage="HomePage"}(c0||(c0={}));var cC,cM,cN,cj,ck,cI,cO,cP,cF,cL,cR,cz,cB,cU,cq,cJ,c$,cK,cY,cV,cW,cQ,cH,cG,cZ,cX,c0,c1,c2,c3="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),c4="undefined"!=typeof Map,c6="undefined"!=typeof Set,c5="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,c8=c3?Symbol.for("immer-nothing"):((c1={})["immer-nothing"]=!0,c1),c7=c3?Symbol.for("immer-draftable"):"__$immer_draftable",c9=c3?Symbol.for("immer-state"):"__$immer_state",pe=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),pt="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,pr=Object.getOwnPropertyDescriptors||function(e){var t={};return pt(e).forEach(function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)}),t},pn={},pi={get:function(e,t){if(t===c9)return e;var r,n,i=cs(e);if(!cn(i,t))return(n=cS(i,t))?"value"in n?n.value:null===(r=n.get)||void 0===r?void 0:r.call(e.k):void 0;var o=i[t];return e.I||!ce(o)?o:o===cD(e.t,t)?(cT(e),e.o[t]=cw(e.A.h,o,e)):o},has:function(e,t){return t in cs(e)},ownKeys:function(e){return Reflect.ownKeys(cs(e))},set:function(e,t,r){var n=cS(cs(e),t);if(null==n?void 0:n.set)return n.set.call(e.k,r),!0;if(!e.P){var i=cD(cs(e),t),o=null==i?void 0:i[c9];if(o&&o.t===r)return e.o[t]=r,e.R[t]=!1,!0;if((r===i?0!==r||1/r==1/i:r!=r&&i!=i)&&(void 0!==r||cn(e.t,t)))return!0;cT(e),cE(e)}return e.o[t]===r&&(void 0!==r||t in e.o)||Number.isNaN(r)&&Number.isNaN(e.o[t])||(e.o[t]=r,e.R[t]=!0),!0},deleteProperty:function(e,t){return void 0!==cD(e.t,t)||t in e.t?(e.R[t]=!1,cT(e),cE(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=cs(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty:function(){u7(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){u7(12)}},po={};ct(pi,function(e,t){po[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),po.deleteProperty=function(e,t){return po.set.call(this,e,t,void 0)},po.set=function(e,t,r){return pi.set.call(this,e[0],t,r,e[0])};var pa=new(function(){function e(e){var t=this;this.O=c5,this.D=!0,this.produce=function(e,r,n){if("function"==typeof e&&"function"!=typeof r){var i,o=r;return r=e,function(e){var n=this;void 0===e&&(e=o);for(var i=arguments.length,a=Array(i>1?i-1:0),s=1;s1?n-1:0),o=1;o=0;r--){var r,n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));var i=c_("Patches").$;return u9(e)?i(e,t):this.produce(e,function(e){return i(e,t)})},e}());pa.produce,pa.produceWithPatches.bind(pa),pa.setAutoFreeze.bind(pa),pa.setUseProxies.bind(pa),pa.applyPatches.bind(pa),pa.createDraft.bind(pa),pa.finishDraft.bind(pa);let ps=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((e,t)=>((t&=63)<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),"");function pl(e){var t;return(0,_.isPlainObject)(e)&&(0,_.hasProperty)(e,"type")&&(0,_.hasProperty)(e,"props")&&(0,_.hasProperty)(e,"key")?e:(t=function e(t){switch(t.type){case cU.Panel:return t.children.reduce(function(t,r){return t+e(r)},0);case cU.Row:return e(t.value);case cU.Text:return t.value.length;default:return 0}}(e),(0,_.assert)(t<=5e4,"The text in a Snap UI may not be larger than ".concat(50," kB.")),function e(t){switch(t.type){case cU.Address:return i3(i9,{address:t.value});case cU.Button:return i3(nW,{name:t.name,variant:function(e){switch(e){case"primary":return"primary";case"secondary":return"destructive";default:return}}(t.variant),type:t.buttonType,children:t.value});case cU.Copyable:return i3(nY,{value:t.value,sensitive:t.sensitive});case cU.Divider:return i3(nK,{});case cU.Form:return i3(nQ,{name:t.name,children:a_(t.children.map(e))});case cU.Heading:return i3(nJ,{children:t.value});case cU.Image:return i3(nV,{src:t.value});case cU.Input:return i3(nH,{label:t.label,error:t.error,children:i3(nG,{name:t.name,type:t.inputType,value:t.value,placeholder:t.placeholder})});case cU.Panel:return i3(nL,{children:a_(t.children.map(e))});case cU.Row:return i3(oe,{label:t.label,variant:t.variant,children:e(t.value)});case cU.Spinner:return i3(ot,{});case cU.Text:var r,n;return i3(n$,{children:a_((r=an(t.value,{gfm:!1}),n=[],ar(r,function(e){if("paragraph"===e.type){n.length>0&&n.push("\n\n");var t,r=e.tokens;n.push.apply(n,function(e){if(Array.isArray(e))return al(e)}(t=r.flatMap(af))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||ac(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}}),n.filter(function(e){return null!==e})))});default:return(0,_.assertExhaustive)(t)}}(e))}function pu(e,t){(0,_.assert)(void 0===e[t],'Duplicate component names are not allowed, found multiple instances of: "'.concat(t,'".'))}function pc(e,t,r){var n,i,o,a=r?e[r]:e,s=null==a?void 0:a[t.props.name];return"FileInput"===t.type?null!=s?s:null:null!==(o=null!==(i=null!==(n="Checkbox"===t.type?t.props.checked:t.props.value)&&void 0!==n?n:s)&&void 0!==i?i:function(e){var t,r,n;switch(e.type){case"Dropdown":return null===(t=ag(e)[0])||void 0===t?void 0:t.props.value;case"RadioGroup":return null===(r=ag(e)[0])||void 0===r?void 0:r.props.value;case"Selector":return null===(n=ag(e)[0])||void 0===n?void 0:n.props.value;case"Checkbox":return!1;default:return null}}(t))&&void 0!==o?o:null}function pp(e,t){var r={},n=[];return ab(t,function(t,i){var o=n[n.length-1];if(o&&i<=o.depth&&(n.pop(),o=n[n.length-1]),"Form"===t.type){pu(r,t.props.name),n.push({name:t.props.name,depth:i}),r[t.props.name]={};return}if(o&&("Input"===t.type||"Dropdown"===t.type||"RadioGroup"===t.type||"FileInput"===t.type||"Checkbox"===t.type||"Selector"===t.type)){var a=r[o.name];pu(a,t.props.name),a[t.props.name]=pc(e,t,o.name);return}("Input"===t.type||"Dropdown"===t.type||"RadioGroup"===t.type||"FileInput"===t.type||"Checkbox"===t.type||"Selector"===t.type)&&(pu(r,t.props.name),r[t.props.name]=pc(e,t))}),r}function p_(e){if(e){var t=e8(e);(0,_.assert)(t<=1e6,"A Snap interface context may not be larger than ".concat(1," MB."))}}function pd(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=-32099&&e<=-32e3)return"Unspecified server error."}return t}function p4(e){return Object.getOwnPropertyNames(e).reduce((t,r)=>{let n=e[r];return(0,_.isValidJson)(n)&&(t[r]=n),t},{})}p3(p2);let p6=function(e){return e?.__esModule?e.default:e}(pX());class p5 extends Error{constructor(e,t,r){if(!Number.isInteger(e))throw Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw Error('"message" must be a non-empty string.');(function(e){return(0,_.isObject)(e)&&(0,_.hasProperty)(e,"cause")&&(0,_.isObject)(e.cause)})(r)?(super(t,{cause:r.cause}),(0,_.hasProperty)(this,"cause")||Object.assign(this,{cause:r.cause})):super(t),void 0!==r&&(this.data=r),this.code=e}serialize(){var e;let t={code:this.code,message:this.message};return void 0!==this.data&&(t.data=this.data,(0,_.isPlainObject)(this.data)&&(t.data.cause=Array.isArray(e=this.data.cause)?e.map(e=>(0,_.isValidJson)(e)?e:(0,_.isObject)(e)?p4(e):null):(0,_.isObject)(e)?p4(e):(0,_.isValidJson)(e)?e:null)),this.stack&&(t.stack=this.stack),t}toString(){return p6(this.serialize(),p7,2)}}class p8 extends p5{constructor(e,t,r){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}}function p7(e,t){if("[Circular]"!==t)return t}function p9(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r1?r-1:0),i=1;i=0,TypeError("Can't start a timer with negative time")),this.state={value:"stopped",remaining:e}}return e=[{key:"status",get:function(){return this.state.value}},{key:"remaining",get:function(){return this.state.remaining}},{key:"cancel",value:function(){(0,_.assert)("paused"===this.status||"running"===this.status,Error("Tried to cancel a not running Timer")),this.onFinish(!1)}},{key:"finish",value:function(){(0,_.assert)("finished"!==this.status,Error("Tried to finish a finished Timer.")),this.onFinish(!0)}},{key:"pause",value:function(){(0,_.assert)("running"===this.state.value,Error("Tried to pause a not running Timer"));var e=this.state,t=e.callback,r=e.start,n=e.timeout,i=e.remaining;void 0!==n&&clearTimeout(n),this.state={value:"paused",callback:t,remaining:i-(Date.now()-r)}}},{key:"start",value:function(e){(0,_.assert)("stopped"===this.state.value,Error("Tried to start an already running Timer"));var t=this.state.remaining;this.state={value:"paused",remaining:t,callback:e},this.resume()}},{key:"resume",value:function(){var e,t=this;(0,_.assert)("paused"===this.state.value,Error("Tried to resume not paused Timer"));var r=this.state,n=r.remaining,i=r.callback,o=Date.now();n!==Number.POSITIVE_INFINITY&&(e=setTimeout(function(){return t.onFinish(!0)},n)),this.state={value:"running",callback:i,remaining:n,start:o,timeout:e}}},{key:"onFinish",value:function(e){(0,_.assert)("running"===this.state.value||"paused"===this.state.value),"running"===this.state.value&&void 0!==this.state.timeout&&clearTimeout(this.state.timeout);var t=this.state,r=t.callback,n=t.remaining;this.state={value:"finished",remaining:"running"===this.state.value?n-(Date.now()-this.state.start):n},e&&r()}}],_n(r.prototype,e),t&&_n(r,t),r}();function _o(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,i)}function _a(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){_o(o,n,i,a,s,"next",e)}function s(e){_o(o,n,i,a,s,"throw",e)}a(void 0)})}}function _s(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]e.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]_G(p0.rpc.parse,e),invalidRequest:e=>_G(p0.rpc.invalidRequest,e),invalidParams:e=>_G(p0.rpc.invalidParams,e),methodNotFound:e=>_G(p0.rpc.methodNotFound,e),internal:e=>_G(p0.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum RPC Server errors must provide single object argument.");let{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw Error('"code" must be an integer such that: -32099 <= code <= -32005');return _G(t,e)},invalidInput:e=>_G(p0.rpc.invalidInput,e),resourceNotFound:e=>_G(p0.rpc.resourceNotFound,e),resourceUnavailable:e=>_G(p0.rpc.resourceUnavailable,e),transactionRejected:e=>_G(p0.rpc.transactionRejected,e),methodNotSupported:e=>_G(p0.rpc.methodNotSupported,e),limitExceeded:e=>_G(p0.rpc.limitExceeded,e)},_H={userRejectedRequest:e=>_Z(p0.provider.userRejectedRequest,e),unauthorized:e=>_Z(p0.provider.unauthorized,e),unsupportedMethod:e=>_Z(p0.provider.unsupportedMethod,e),disconnected:e=>_Z(p0.provider.disconnected,e),chainDisconnected:e=>_Z(p0.provider.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum Provider custom errors must provide single object argument.");let{code:t,message:r,data:n}=e;if(!r||"string"!=typeof r)throw Error('"message" must be a nonempty string');return new p8(t,r,n)}};function _G(e,t){let[r,n]=_X(t);return new p5(e,r??p3(e),n)}function _Z(e,t){let[r,n]=_X(t);return new p8(e,r??p3(e),n)}function _X(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){let{message:t,data:r}=e;if(t&&"string"!=typeof t)throw Error("Must specify string message.");return[t??void 0,r]}}return[]}function _0(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(t,["maxRequestTime"]));return a?(n=function(e){for(var t=1;t0),{caveats:t}})),dM(i,di.targetName,_3(function(e){return{caveats:[{type:cN.KeyringOrigin,value:e}]}})),dM(i,dD.targetName,_3(function(e){return!e||!(0,_.isObject)(e)||(0,_.isObject)(e)&&0===Object.keys(e).length?{caveats:null}:{caveats:[{type:cN.SignatureOrigin,value:(0,_.hasProperty)(e,"allowSignatureOrigin")&&e.allowSignatureOrigin}]}})),dM(i,dl.targetName,_2),dM(i,dt.targetName,_2),dM(i,dv.targetName,_2),i);dM(o={},cC.OnRpcRequest,dy.targetName),dM(o,cC.OnTransaction,dT.targetName),dM(o,cC.OnCronjob,_5.targetName),dM(o,cC.OnNameLookup,dp.targetName),dM(o,cC.OnInstall,dl.targetName),dM(o,cC.OnUpdate,dl.targetName),dM(o,cC.OnKeyringRequest,di.targetName),dM(o,cC.OnHomePage,dt.targetName),dM(o,cC.OnSettingsPage,dv.targetName),dM(o,cC.OnSignature,dD.targetName),dM(o,cC.OnUserInput,null);let dI=BigInt(4294967296-1),dO=BigInt(32),dP=(e,t,r)=>e<>>32-r,dF=(e,t,r)=>t<>>32-r,dL=(e,t,r)=>t<>>64-r,dR=(e,t,r)=>e<>>64-r,dz=[],dB=[],dU=[],dq=BigInt(0),dJ=BigInt(1),d$=BigInt(2),dK=BigInt(7),dY=BigInt(256),dV=BigInt(113);for(let e=0,t=dJ,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],dz.push(2*(5*n+r)),dB.push((e+1)*(e+2)/2%64);let i=dq;for(let e=0;e<7;e++)(t=(t<>dK)*dV)%dY)&d$&&(i^=dJ<<(dJ<>dO&dI)}:{h:0|Number(e>>dO&dI),l:0|Number(e&dI)}}(e[i],t);[r[i],n[i]]=[o,a]}return[r,n]}(dU,!0),dH=(e,t,r)=>r>32?dL(e,t,r):dP(e,t,r),dG=(e,t,r)=>r>32?dR(e,t,r):dF(e,t,r);class dZ extends eb{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,el(r),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=e_(this.state)}keccak(){em||ey(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let n=(t+8)%10,i=(t+2)%10,o=r[i],a=r[i+1],s=dH(o,a,1)^r[n],l=dG(o,a,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=s,e[t+r+1]^=l}let t=e[2],i=e[3];for(let r=0;r<24;r++){let n=dB[r],o=dH(t,i,n),a=dG(t,i,n),s=dz[r];t=e[s],i=e[s+1],e[s]=o,e[s+1]=a}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=dW[n],e[1]^=dQ[n]}r.fill(0)}(this.state32,this.rounds),em||ey(this.state32),this.posOut=0,this.pos=0}update(e){ec(this);let{blockLen:t,state:r}=this;e=eg(e);let n=e.length;for(let i=0;i=r&&this.keccak();let o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return el(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(ep(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:o}=this;return e||(e=new dZ(t,r,n,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=o,e.destroyed=this.destroyed,e}}let dX=ev(()=>new dZ(136,1,32));function d0(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]>>0;t.push("bip32:".concat(i-2147483648,"'"))}return t}(dX((0,_.concatBytes)([s,dX(l)]))),[4,e7.SLIP10Node.fromDerivationPath({derivationPath:[i,"bip32:".concat(o)].concat(d3(u)),curve:"secp256k1"},a)];case 1:return c=p.sent().privateKey,(0,_.assert)(c,"Failed to derive the entropy."),[2,(0,_.add0x)(c)]}})})).apply(this,arguments)}function d8(e){return d7.apply(this,arguments)}function d7(){return(d7=d2(function(e){var t,r,n,i,o;return d4(this,function(a){switch(a.label){case 0:return t=e.curve,r=e.secretRecoveryPhrase,n=e.path,i=e.cryptographicFunctions,o=function(e){switch(e){case"secp256k1":return"bip32";case"ed25519":return"slip10";case"ed25519Bip32":return"cip3";default:return(0,_.assertExhaustive)(e)}}(t),[4,e7.SLIP10Node.fromDerivationPath({curve:t,derivationPath:[r].concat(d3(n.slice(1).map(function(e){return"".concat(o,":").concat(e)})))},i)];case 1:return[2,a.sent()]}})})).apply(this,arguments)}function d9(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,i)}var fe="snap_getBip32Entropy",ft=Object.freeze({targetName:fe,specificationBuilder:function(e){var t,r,n,i,o,a=e.methodHooks;return{permissionType:ta.PermissionType.RestrictedMethod,targetName:fe,allowedCaveats:[cN.PermittedDerivationPaths],methodImplementation:(n=a.getMnemonic,i=a.getUnlockPromise,o=a.getClientCryptography,t=function(e){var t,r;return function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]2147483647)throw _Q.invalidParams({message:'Invalid "coinType" parameter. Coin type must be a non-negative integer.'});if(tF.includes(e.coinType))throw _Q.invalidParams({message:"Coin type ".concat(e.coinType," is forbidden.")})}var fy=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}({},cN.PermittedCoinTypes,Object.freeze({type:cN.PermittedCoinTypes,decorator:function(e,t){var r,n;return r=function(r){var n;return function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]2&&void 0!==arguments[2]?arguments[2]:104857600;if(!(0,_.isObject)(e))throw _Q.invalidParams({message:"Expected params to be a single object."});var i=e.operation,o=e.newState,a=e.encrypted;if(!i||"string"!=typeof i||!Object.values(l).includes(i))throw _Q.invalidParams({message:'Must specify a valid manage state "operation".'});if(void 0!==a&&"boolean"!=typeof a)throw _Q.invalidParams({message:'"encrypted" parameter must be a boolean if specified.'});if(i===l.UpdateState){if(!(0,_.isObject)(o))throw _Q.invalidParams({message:"Invalid ".concat(t,' "updateState" parameter: The new state must be a plain object.'),data:{receivedNewState:void 0===o?"undefined":o}});try{r=(0,_.getJsonSize)(o)}catch(e){throw _Q.invalidParams({message:"Invalid ".concat(t,' "updateState" parameter: The new state must be JSON serializable.'),data:{receivedNewState:void 0===o?"undefined":o}})}if(r>n)throw _Q.invalidParams({message:"Invalid ".concat(t,' "updateState" parameter: The new state must not exceed ').concat(n," bytes in size."),data:{receivedNewState:void 0===o?"undefined":o}})}return e}(r,s)).encrypted)||void 0===p||p)&&c.operation!==l.ClearState))return[3,2];return[4,n(!0)];case 1:f.sent(),f.label=2;case 2:switch(c.operation){case l.ClearState:return[3,3];case l.GetState:return[3,4];case l.UpdateState:return[3,6]}return[3,8];case 3:return i(u,d),[2,null];case 4:return[4,o(u,d)];case 5:return[2,f.sent()];case 6:return[4,a(u,c.newState,d)];case 7:return f.sent(),[2,null];case 8:throw _Q.invalidParams("Invalid ".concat(s,' operation: "').concat(c.operation,'"'));case 9:return[2]}})},r=function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function a(e){f3(o,n,i,a,s,"next",e)}function s(e){f3(o,n,i,a,s,"throw",e)}a(void 0)})},function(e){return r.apply(this,arguments)}),subjectTypes:[ta.SubjectType.Snap]}},methodHooks:{getUnlockPromise:!0,clearSnapState:!0,getSnapState:!0,updateSnapState:!0}});function f5(e){return(0,_.isObject)(e)&&(0,_.hasProperty)(e,"message")&&"string"==typeof e.message?e.message:String(e)}function f8(e){if((0,_.isObject)(e)&&(0,_.hasProperty)(e,"stack")&&"string"==typeof e.stack)return e.stack}function f7(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,i)}var f9="snap_notify",me=(0,Q.object)({type:tE(cH.Native),message:(0,Q.string)()}),mt=tT([(0,Q.object)({type:tE(cH.InApp),message:(0,Q.string)()}),(0,Q.object)({type:tE(cH.InApp),message:(0,Q.string)(),content:u5,title:(0,Q.string)(),footerLink:(0,Q.optional)((0,Q.object)({href:(0,Q.string)(),text:(0,Q.string)()}))}),me]),mr=Object.freeze({targetName:f9,specificationBuilder:function(e){var t,r,n,i,o,a,s,l,u=e.allowedCaveats,c=e.methodHooks;return{permissionType:ta.PermissionType.RestrictedMethod,targetName:f9,allowedCaveats:void 0===u?null:u,methodImplementation:(n=c.showNativeNotification,i=c.showInAppNotification,o=c.isOnPhishingList,a=c.maybeUpdatePhishingList,s=c.createInterface,l=c.getSnap,t=function(e){var t,r,u,c;return function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=50))throw _Q.invalidParams({message:'Must specify a non-empty string "message" less than 50 characters long.'});if(n===cH.InApp&&(o||i.length>=500))throw _Q.invalidParams({message:'Must specify a non-empty string "message" less than 500 characters long.'});try{var a=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];(0,_.assert)(t.schema,"Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`."),(0,_.assert)(t.schema.length>0,"Expected a non-empty array of structs.");var i=t.schema.map(function(e){return e.schema[r]}),o=(0,Q.type)(tN({},r,tT(i))),a=tj((0,Q.validate)(e,o,{coerce:n}),1)[0];if(a)throw Error(tI(o,a.failures()[0],!1));var s=t.schema.filter(function(t){return(0,Q.is)(e[r],t.schema[r])});(0,_.assert)(s.length>0,"Expected a struct to match the value.");var l=s.map(function(t){return(0,Q.validate)(e,t,{coerce:n})}),u=l.find(function(e){return!tj(e,1)[0]});if(u)return u[1];throw(0,_.assert)(l[0][0],"Expected at least one error."),Error(tI(t,l.reduce(function(e,t){var r=tj(t,1)[0];return((0,_.assert)(r,"Expected an error."),r.failures().lengthe.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]e.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1&&void 0!==a[1]?a[1]:c.Base64,[4,uA(nu)];case 1:if(n=s.sent(),i=t3(e),!(o=null===(r=n.find(function(e){return e.path===i}))||void 0===r?void 0:r.toString("base64")))return[2,null];return[4,uE(mZ,o,t)];case 2:return[2,s.sent()]}})}function m7(e,t){return m1(this,function(r){switch(r.label){case 0:return[4,uA(r7)];case 1:return[4,uE([r.sent(),"createInterface"],e,t)];case 2:return[2,r.sent()]}})}function m9(e,t){return m1(this,function(r){switch(r.label){case 0:return[4,uA(r7)];case 1:return[4,uE([r.sent(),"getInterface"],e,t)];case 2:return[2,r.sent()]}})}function he(e,t,r){return m1(this,function(n){switch(n.label){case 0:return[4,uA(r7)];case 1:return[4,uE([n.sent(),"updateInterface"],e,t,r)];case 2:return n.sent(),[4,uE(m9,e,t)];case 3:return[4,ux(rH(m0({id:t},n.sent())))];case 4:return n.sent(),[2]}})}function ht(e,t){return m1(this,function(r){switch(r.label){case 0:return[4,uA(r7)];case 1:return[4,uE([r.sent(),"getInterface"],e,t)];case 2:return[2,r.sent().state]}})}function hr(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,i)}function hn(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){hr(o,n,i,a,s,"next",e)}function s(e){hr(o,n,i,a,s,"throw",e)}a(void 0)})}}function hi(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]e.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]e.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]2?r-2:0),i=2;i0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1&&void 0!==arguments[1]?arguments[1]:{};(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")})(this,r),hI(this,"cache",new Map),hI(this,"validatedManifest",void 0),hI(this,"url",void 0),hI(this,"fetchFn",void 0),hI(this,"fetchOptions",void 0),(0,_.assertStruct)(e.toString(),e2,"Invalid Snap Id: "),this.fetchFn=null!==(t=n.fetch)&&void 0!==t?t:globalThis.fetch.bind(void 0),this.fetchOptions=n.fetchOptions,this.url=e}return e=[{key:"manifest",value:function(){var e=this;return hj(function(){var t,r,n,i,o;return hO(this,function(a){switch(a.label){case 0:if(e.validatedManifest)return[2,e.validatedManifest.clone()];return t=new URL(cj.Manifest,e.url).toString(),[4,e.fetchFn(t,e.fetchOptions)];case 1:if(!(r=a.sent()).ok)throw Error('Failed to fetch "'.concat(t,'". Status code: ').concat(r.status,"."));return[4,r.text()];case 2:return i=e5(n=a.sent()),o=new eO({value:n,result:t2(i),path:cj.Manifest,data:{canonicalPath:t}}),e.validatedManifest=o,[2,e.manifest()]}})})()}},{key:"fetch",value:function(e){var t=this;return hj(function(){var r,n,i,o,a,s;return hO(this,function(l){switch(l.label){case 0:if(r=t3(e),void 0!==(n=t.cache.get(r)))return[2,n.clone()];return i=t.toCanonical(r).toString(),[4,t.fetchFn(i,t.fetchOptions)];case 1:if(!(o=l.sent()).ok)throw Error('Failed to fetch "'.concat(i,'". Status code: ').concat(o.status,"."));return[4,o.arrayBuffer()];case 2:return a=l.sent(),s=new eO({value:new Uint8Array(a),path:r,data:{canonicalPath:i}}),(0,_.assert)(!t.cache.has(r),"Corrupted cache, multiple files with same path."),t.cache.set(r,s),[2,t.fetch(r)]}})})()}},{key:"root",get:function(){return new URL(this.url)}},{key:"toCanonical",value:function(e){return(0,_.assert)(!e.startsWith("/"),"Tried to parse absolute path."),new URL(e,this.url)}}],hk(r.prototype,e),t&&hk(r,t),r}();function hF(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,i)}function hL(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){hF(o,n,i,a,s,"next",e)}function s(e){hF(o,n,i,a,s,"throw",e)}a(void 0)})}}function hR(e,t,r){if(!t.has(e))throw TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function hz(e,t){var r=hR(e,t,"get");return r.get?r.get.call(e):r.value}function hB(e,t){for(var r=0;r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1&&void 0!==arguments[1]?arguments[1]:{};(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")})(this,r),function(e,t){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object")}(this,hq),hq.set(this,{writable:!0,value:void 0}),(0,_.assertStruct)(e.toString(),e0,"Invalid Snap Id"),(0,_.assert)(void 0===o.fetchOptions,"Currently adding fetch options to local: is unsupported."),i=new hP(new URL(e.toString().slice(ck.local.length)),(t=function(e){for(var t=1;t0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]e.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0?[2,r.join("\n")]:[2,!0]})});return function(t,r){return e.apply(this,arguments)}}()},{name:"Checksum",manifestName:"source.shasum",validator:function(){var e=h6(function(e,t){var r,n,i,o,a,s,l;return h8(this,function(u){switch(u.label){case 0:if(r=t.sourceCode,n=t.icon,i=t.auxiliaryFiles,o=t.localizationFiles,!e)return[3,2];return s=null===(a=e.result)||void 0===a?void 0:a.source.shasum,[4,function(e){return eG.apply(this,arguments)}({manifest:e,sourceCode:r,svgIcon:n,auxiliaryFiles:i,localizationFiles:o})];case 1:if(l=u.sent(),s!==l)return[2,'Checksum mismatch - expected "'.concat(l,'" got "').concat(s,'"')];u.label=2;case 2:return[2,!0]}})});return function(t,r){return e.apply(this,arguments)}}()},{name:"Bundle",manifestName:"filePath",validator:function(){var e=h6(function(e,t){var r,n,i,o,a,s,l;return h8(this,function(u){return(r=t.sourceCode,l=h5(t1.schema.source.schema.location.schema.npm.schema.filePath.validate(null===(s=e)||void 0===s?void 0:null===(a=s.result)||void 0===a?void 0:null===(o=a.source)||void 0===o?void 0:null===(i=o.location)||void 0===i?void 0:null===(n=i.npm)||void 0===n?void 0:n.filePath),1)[0])?[2,l.message]:r?[2,!0]:[2,"Unable to load bundle."]})});return function(t,r){return e.apply(this,arguments)}}()}];function h9(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]${e}`}em(e){return`${e}`}codespan(e){return`${e}`}br(){return"
"}del(e){return`${e}`}link(e,t,r){let n=of(e);if(null===n)return r;let i='
"}image(e,t,r){let n=of(e);if(null===n)return r;let i=`${r}"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""));continue;case"code":r+=this.renderer.code(i.text,i.lang,!!i.escaped);continue;case"table":{let e="",t="";for(let e=0;e0&&"paragraph"===t.tokens[0].type?(t.tokens[0].text=e+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&"text"===t.tokens[0].tokens[0].type&&(t.tokens[0].tokens[0].text=e+" "+t.tokens[0].tokens[0].text)):t.tokens.unshift({type:"text",text:e+" "}):s+=e+" "}s+=this.parse(t.tokens,n),o+=this.renderer.listitem(s,a,!!r)}r+=this.renderer.list(o,e,t);continue}case"html":r+=this.renderer.html(i.text,i.block);continue;case"paragraph":r+=this.renderer.paragraph(this.parseInline(i.tokens));continue;case"text":{let o=i,a=o.tokens?this.parseInline(o.tokens):o.text;for(;n+1{let i=e[n].flat(1/0);r=r.concat(this.walkTokens(i,t))}):e.tokens&&(r=r.concat(this.walkTokens(e.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let r={...e};if(r.async=this.defaults.async||r.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error("extension name required");if("renderer"in e){let r=t.renderers[e.name];r?t.renderers[e.name]=function(...t){let n=e.renderer.apply(this,t);return!1===n&&(n=r.apply(this,t)),n}:t.renderers[e.name]=e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw Error("extension level must be 'block' or 'inline'");let r=t[e.level];r?r.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),r.extensions=t),e.renderer){let t=this.defaults.renderer||new o6(this.defaults);for(let r in e.renderer){if(!(r in t))throw Error(`renderer '${r}' does not exist`);if("options"===r)continue;let n=e.renderer[r],i=t[r];t[r]=(...e)=>{let r=n.apply(t,e);return!1===r&&(r=i.apply(t,e)),r||""}}r.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new ob(this.defaults);for(let r in e.tokenizer){if(!(r in t))throw Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let n=e.tokenizer[r],i=t[r];t[r]=(...e)=>{let r=n.apply(t,e);return!1===r&&(r=i.apply(t,e)),r}}r.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new o7;for(let r in e.hooks){if(!(r in t))throw Error(`hook '${r}' does not exist`);if("options"===r)continue;let n=e.hooks[r],i=t[r];o7.passThroughHooks.has(r)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(n.call(t,e)).then(e=>i.call(t,e));let r=n.call(t,e);return i.call(t,r)}:t[r]=(...e)=>{let r=n.apply(t,e);return!1===r&&(r=i.apply(t,e)),r}}r.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,n=e.walkTokens;r.walkTokens=function(e){let r=[];return r.push(n.call(this,e)),t&&(r=r.concat(t.call(this,e))),r}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return o4.lex(e,t??this.defaults)}parser(e,t){return o8.parse(e,t??this.defaults)}#e(e,t){return(r,n)=>{let i={...n},o={...this.defaults,...i};!0===this.defaults.async&&!1===i.async&&(o.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),o.async=!0);let a=this.#t(!!o.silent,!!o.async);if(null==r)return a(Error("marked(): input parameter is undefined or null"));if("string"!=typeof r)return a(Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));if(o.hooks&&(o.hooks.options=o),o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(r):r).then(t=>e(t,o)).then(e=>o.hooks?o.hooks.processAllTokens(e):e).then(e=>o.walkTokens?Promise.all(this.walkTokens(e,o.walkTokens)).then(()=>e):e).then(e=>t(e,o)).then(e=>o.hooks?o.hooks.postprocess(e):e).catch(a);try{o.hooks&&(r=o.hooks.preprocess(r));let n=e(r,o);o.hooks&&(n=o.hooks.processAllTokens(n)),o.walkTokens&&this.walkTokens(n,o.walkTokens);let i=t(n,o);return o.hooks&&(i=o.hooks.postprocess(i)),i}catch(e){return a(e)}}}#t(e,t){return r=>{if(r.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="

An error occurred:

"+oc(r.message+"",!0)+"
";return t?Promise.resolve(e):e}if(t)return Promise.reject(r);throw r}}}let ae=new o9;function at(e,t){return ae.parse(e,t)}at.options=at.setOptions=function(e){return ae.setOptions(e),at.defaults=ae.defaults,on=at.defaults,at},at.getDefaults=or,at.defaults=on,at.use=function(...e){return ae.use(...e),at.defaults=ae.defaults,on=at.defaults,at},at.walkTokens=function(e,t){return ae.walkTokens(e,t)},at.parseInline=ae.parseInline,at.Parser=o8,at.parser=o8.parse,at.Renderer=o6,at.TextRenderer=o5,at.Lexer=o4,at.lexer=o4.lex,at.Tokenizer=ob,at.Hooks=o7,at.parse=at,at.options,at.setOptions,at.use;let ar=at.walkTokens;at.parseInline,o8.parse;let an=o4.lex;function ai(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);re.length)&&(t=e.length);for(var r=0,n=Array(t);r0?a_(e.tokens.flatMap(af)):e.href});case"text":return e.text;case"strong":return i3(i8,{children:ad(e.tokens)});case"em":return i3(i7,{children:ad(e.tokens)});default:return null}}function am(e,t,r){try{var n=new URL(e);if((0,_.assert)(ap.includes(n.protocol),"Protocol must be one of: ".concat(ap.join(", "),".")),"metamask:"===n.protocol){var i=function(e){var t=new URL(e),r=t.protocol;if("metamask:"!==r)throw Error('Unable to parse URL. Expected the protocol to be "metamask:", but received "'.concat(r,'".'));var n=ao(t.href.replace("metamask://","").split("/")),i=n[0],o=n.slice(1),a="/".concat(o.join("/"));switch(i){case"client":return(0,_.assert)(aa.includes(a),'Unable to navigate to "'.concat(a,'". The provided path is not allowed.')),{authority:i,path:a};case"snap":return function(e){var t,r="Invalid MetaMask url:",n=e6(e.slice(1)),i=e.slice(1).startsWith("npm:")?"npm:":"local:",o=n.startsWith("@"),a=n.split("/"),s="/".concat(a[a.length-1]);if("local:"===i){var l=ao(a.slice(0,-1)),u=l[0],c=l.slice(2);t="".concat(u,"//").concat(c.join("/")),(0,_.assert)(as.includes(s),"".concat(r," invalid snap path."))}else t=o?"".concat(a[0],"/").concat(a[1]):a[0],(0,_.assert)(o?3===a.length&&as.includes(s):2===a.length&&as.includes(s),"".concat(r," invalid snap path."));var p="".concat(i).concat(t);return(0,_.assertStruct)(p,e3,"Invalid snap ID"),{authority:"snap",snapId:p,path:s}}(a);default:throw Error('Expected "metamask:" URL to start with "client" or "snap", but received "'.concat(i,'".'))}}(e);i.snapId&&(0,_.assert)(r(i.snapId),"The Snap being navigated to is not installed.")}else if("mailto:"===n.protocol){var o=n.pathname.split(","),a=!0,s=!1,l=void 0;try{for(var u,c=o[Symbol.iterator]();!(a=(u=c.next()).done);a=!0){var p=u.value.split("@")[1];(0,_.assert)(!p.includes(":"));var d="https://".concat(p);(0,_.assert)(!t(d),"The specified URL is not allowed.")}}catch(e){s=!0,l=e}finally{try{a||null==c.return||c.return()}finally{if(s)throw l}}return}(0,_.assert)(!t(n.href),"The specified URL is not allowed.")}catch(e){throw Error("Invalid URL: ".concat((null==e?void 0:e.code)==="ERR_ASSERTION"?e.message:"Unable to parse URL."))}}function ah(e){return(0,_.hasProperty)(e.props,"children")}function ay(e){return!!e&&!0!==e}function ag(e){if(ah(e)){if(Array.isArray(e.props.children))return e.props.children.filter(ay).flat(1/0);if(e.props.children)return[e.props.children]}return[]}function ab(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(Array.isArray(e)){var n=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value,u=ab(l,t,r);if(void 0!==u)return u}}catch(e){i=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return}var c=t(e,r);if(void 0!==c)return c;if((0,_.hasProperty)(e,"props")&&(0,_.isPlainObject)(e.props)&&(0,_.hasProperty)(e.props,"children")){var p=ag(e),d=!0,f=!1,m=void 0;try{for(var h,y=p[Symbol.iterator]();!(d=(h=y.next()).done);d=!0){var g=h.value;if((0,_.isPlainObject)(g)){var b=ab(g,t,r+1);if(void 0!==b)return b}}}catch(e){f=!0,m=e}finally{try{d||null==y.return||y.return()}finally{if(f)throw m}}}}function av(e){return Object.entries(e).filter(function(e){return"children"!==au(e,1)[0]}).sort(function(e,t){var r=au(e,1)[0],n=au(t,1)[0];return r.localeCompare(n)}).map(function(e){var t=au(e,2),r=t[0],n=t[1];return" ".concat(r,"=").concat("string"==typeof n?'"'.concat(n,'"'):"{".concat(JSON.stringify(n),"}"))}).join("")}var ax=r(8261),aD=r.n(ax),aS=r(9691),aE=r.n(aS);function aT(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r1?"move":"default",children:[(0,p.jsx)(O,{icon:r.data.type.toLowerCase(),width:"16px"}),(0,p.jsx)(j.Text,{fontWeight:"500",fontSize:"sm",textTransform:"capitalize",color:"text.muted",display:"inline-block",minWidth:"65px",children:r.data.type}),i,Number(r.id)>=2&&(0,p.jsx)(O,{icon:"cross",width:"11px",marginX:"0.5",marginLeft:"auto",cursor:"pointer",onClick:function(){null==o||o(r)}})]})};function ak(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function aI(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:[];return function(){for(var n=arguments.length,i=Array(n),o=0;oe.length)&&(t=e.length);for(var r=0,n=Array(t);re.length)&&(t=e.length);for(var r=0,n=Array(t);re.length)&&(t=e.length);for(var r=0,n=Array(t);r ul":{display:"flex",flexDirection:"column",flex:1,marginY:"4","& > li":{display:"flex",flexDirection:"column",flex:1,marginTop:"0"}},ul:{listStyleType:"none"},li:{marginTop:"2"}},children:(0,p.jsx)(n4.Tree,{ref:n,tree:t,rootId:0,render:function(e,r){var n=r.depth,a=r.isDragging;return t.length<=1?(0,p.jsx)(aW,{}):(0,p.jsx)(aV,{node:e,depth:n,onChange:i,onClose:o,isDragging:a})},insertDroppableFirst:!1,canDrag:function(e){return!!e&&Number(e.id)>=2},canDrop:function(e,t){var r=t.dropTarget,n=t.dropTargetId,i=t.dragSource;return!!n&&null!=i&&!!i.data&&function(e,t){if(!e||!t)return!1;switch(e.type){case"Box":return aw(t);case"Form":return aA(t);case"Field":return aC(t);default:return!1}}(null==r?void 0:r.data,null==i?void 0:i.data)&&(null==r?void 0:r.droppable)&&Number(n)>0},onDrop:function(e){r(e)},initialOpen:!0,sort:!1,extraAcceptTypes:["template"],placeholderRender:function(){return(0,p.jsx)(j.Box,{width:"100%",height:"20px"})}})})},aX=function(e){var t=e.snapName,r=P(nr),n=r&&new Blob([r.value],{type:"image/svg+xml"}),i=n&&URL.createObjectURL(n);return(0,p.jsxs)(j.Box,{position:"relative",children:[(0,p.jsx)(j.Avatar,{src:i,name:t.slice(0,1).toUpperCase(),fontSize:"md",background:"background.alternative",color:"text.alternative",size:"sm",margin:"1"}),(0,p.jsx)(O,{icon:"snap",width:"16px",height:"16px",position:"absolute",bottom:"0px",right:"0px"})]})},a0=function(e){var t=e.snapName,r=e.snapId;return(0,p.jsxs)(j.Flex,{gap:"2",marginX:"4",marginY:"4",border:"1px solid",borderColor:"border.default",borderRadius:"32px",padding:"1",alignItems:"center",children:[(0,p.jsx)(aX,{snapName:t}),(0,p.jsxs)(j.Flex,{direction:"column",justify:"center",children:[(0,p.jsx)(j.Text,{fontSize:"sm",lineHeight:"157%",fontFamily:"custom",children:t}),(0,p.jsx)(j.Text,{fontSize:"xs",lineHeight:"167%",fontFamily:"custom",color:"text.alternative",children:r})]})]})},a1=function(e){var t=e.snapName,r=e.snapId,n=e.children,i=e.showAuthorship;return(0,p.jsxs)(j.Flex,{direction:"column",boxShadow:"lg",maxWidth:"360px",height:"600px",paddingY:"4",overflowY:"scroll",children:[(void 0===i||i)&&(0,p.jsx)(a0,{snapName:t,snapId:r}),n]})};!function(e){e.Content="content",e.Error="error",e.Insights="insights"}(cY||(cY={}));var a2=function(e,t){switch(e){case cY.Insights:return"Insights from ".concat(t);case cY.Error:return"Error from ".concat(t);default:return"Content from ".concat(t)}},a3=function(e){var t=e.type,r=e.snapName,n=e.children,i=t===cY.Error;return(0,p.jsxs)(j.Box,{border:"1px solid",borderColor:"border.default",borderRadius:"md",backgroundColor:i?"error.muted":void 0,children:[(0,p.jsxs)(j.Flex,{direction:"row",alignItems:"center",padding:"1.5",borderBottom:"1px solid",borderColor:"border.default",children:[(0,p.jsx)(O,{icon:i?"snapError":"snap",width:"16px",marginRight:"1"}),(0,p.jsx)(j.Text,{fontFamily:"custom",fontSize:"xs",color:i?"text.error":void 0,children:a2(t,r)})]}),(0,p.jsx)(j.Box,{padding:"3",children:n})]})};function a4(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r{let t=sx();sv(!0);try{let r=!1,n=sg(()=>{let t=e();return null!==t&&"object"==typeof t&&"function"==typeof t.then&&(r=!0),t});if(r)return{then:(e,r)=>{n.then(r=>{sv(t),e(r)},e=>{sv(t),r(e)})}};return sv(t),n}catch(e){throw sv(t),e}},sS=function(){return(0,sh.BX)(...arguments)};Object.keys(sh.BX).forEach(e=>{sS[e]=function(){return sh.BX[e](...arguments)}});let sE=sS.mouseEnter,sT=sS.mouseLeave;sS.mouseEnter=function(){return sE(...arguments),sS.mouseOver(...arguments)},sS.mouseLeave=function(){return sT(...arguments),sS.mouseOut(...arguments)};let sw=sS.pointerEnter,sA=sS.pointerLeave;sS.pointerEnter=function(){return sw(...arguments),sS.pointerOver(...arguments)},sS.pointerLeave=function(){return sA(...arguments),sS.pointerOut(...arguments)};let sC=sS.select;sS.select=(e,t)=>{sC(e,t),e.focus(),sS.keyUp(e,t)};let sM=sS.blur,sN=sS.focus;sS.blur=function(){return sS.focusOut(...arguments),sM(...arguments)},sS.focus=function(){return sS.focusIn(...arguments),sN(...arguments)},(0,sh.jQ)({unstable_advanceTimersWrapper:e=>sD(e),asyncWrapper:async e=>{let t=sx();sv(!1);try{let t=await e();return await new Promise(e=>{setTimeout(()=>{e()},0),"undefined"!=typeof jest&&null!==jest&&(!0===setTimeout._isMockFunction||Object.prototype.hasOwnProperty.call(setTimeout,"clock"))&&jest.advanceTimersByTime(0)}),t}finally{sv(t)}},eventWrapper:e=>{let t;return sD(()=>{t=e()}),t}});let sj=new Set,sk=[];function sI(){sk.forEach(e=>{let{root:t,container:r}=e;sD(()=>{t.unmount()}),r.parentNode===document.body&&document.body.removeChild(r)}),sk.length=0,sj.clear()}if((void 0===sy||!sy.env?.RTL_SKIP_AUTO_CLEANUP)&&("function"==typeof afterEach?afterEach(()=>{sI()}):"function"==typeof teardown&&teardown(()=>{sI()}),"function"==typeof beforeAll&&"function"==typeof afterAll)){let e=sx();beforeAll(()=>{e=sx(),sv(!0)}),afterAll(()=>{sv(e)})}var sO=r(1742),sP=r(1970),sF=r.n(sP),sL={primary:"primary",destructive:"outline"},sR=function(e){var t,r=e.node,n=e.id;i2(r),(0,_.assert)("Button"===r.type,"Expected value to be a button component.");var i=sf().handleEvent,o=r.props;return(0,p.jsx)(j.Button,{width:"100%",variant:sL[null!==(t=o.variant)&&void 0!==t?t:"primary"],marginBottom:"4",type:o.type,onClick:function(e){o.type===c$.Button&&e.preventDefault(),i({event:cV.ButtonClickEvent,name:o.name})},children:o.children},"".concat(n,"-button"))},sz=function(e){var t=e.node,r=e.id,n=e.form,i=sf(),o=i.handleInputChange,a=i.getValue;i2(t),(0,_.assert)("Input"===t.type,"Expected value to be an input component.");var s=t.props,l=a(s.name,n);return(0,p.jsx)(j.Input,{value:l,type:s.type,placeholder:s.placeholder,onChange:function(e){o(s.name,e.target.value,n)}},"".concat(r,"-input"))},sB={Bold:function(e){var t=e.node,r=e.id;return i2(t),(0,_.assert)("Bold"===t.type,"Expected value to be a bold component."),(0,p.jsx)(j.Text,{fontFamily:"custom",fontSize:"sm",paddingBottom:"1",as:"b",children:sq(ag(t),r)},"".concat(r,"-text"))},Box:function(e){var t=e.node,r=e.id;return i2(t),(0,_.assert)("Box"===t.type,"Expected value to be a Box component."),(0,p.jsx)(j.Box,{children:ag(t).map(function(e,t){return(0,p.jsx)(sU,{node:e},"".concat(r,"-panel-child-").concat(t))})},r)},Button:sR,Copyable:function(e){var t=e.node,r=e.id;i2(t),(0,_.assert)("Copyable"===t.type,"Expected value to be a copyable component.");var n=t.props;return(0,p.jsx)(a6,{value:n.value},"".concat(r,"-copyable"))},Divider:function(e){var t=e.id;return(0,p.jsx)(j.Divider,{orientation:"horizontal",marginTop:"3",marginBottom:"4",borderColor:"border.default"},"".concat(t,"-divider"))},Field:function(e){var t=e.node,r=e.id,n=e.form;i2(t),(0,_.assert)("Field"===t.type,"Expected value to be a field component.");var i=ag(t),o=i[0],a=i[1],s=t.props;return(0,p.jsxs)(j.FormControl,{isInvalid:!!s.error,children:[s.label&&(0,p.jsx)(j.FormLabel,{children:s.label}),(0,p.jsx)(sz,{id:r,node:o,form:n}),a&&(0,p.jsx)(sR,{id:r,node:a}),(0,p.jsx)(j.FormErrorMessage,{children:s.error})]},"".concat(r,"-field"))},Form:function(e){var t=e.node,r=e.id;i2(t),(0,_.assert)("Form"===t.type,"Expected value to be a form component.");var n=sf().handleEvent,i=t.props;return(0,p.jsx)(j.Box,{as:"form",onSubmit:function(e){e.preventDefault(),n({event:cV.FormSubmitEvent,name:i.name})},children:ag(t).map(function(e,n){return(0,p.jsx)(sU,{node:e,form:t.props.name},"".concat(r,"-form-child-").concat(n))})},r)},Heading:function(e){var t=e.node,r=e.id;i2(t),(0,_.assert)("Heading"===t.type,"Expected value to be a heading component.");var n=t.props;return(0,p.jsx)(j.Heading,{fontFamily:"custom",fontSize:"x-large",fontWeight:"bold",paddingBottom:"4",children:n.children},"".concat(r,"-heading"))},Input:sz,Italic:function(e){var t=e.node,r=e.id;return i2(t),(0,_.assert)("Italic"===t.type,"Expected value to be an italic component."),(0,p.jsx)(j.Text,{fontFamily:"custom",fontSize:"sm",paddingBottom:"1",as:"i",children:sq(ag(t),r)},r)},Link:function(e){var t=e.node,r=e.id;i2(t),(0,_.assert)("Link"===t.type,"Expected value to be a link component.");var n=t.props;return(0,p.jsxs)(j.Link,{href:n.href,target:"_blank",fontFamily:"custom",fontSize:"sm",isExternal:!0,color:"link.default",display:"inline",children:[sq(ag(t),r),(0,p.jsx)(O,{icon:"linkOut",width:"14px",marginLeft:"2px",display:"inline",verticalAlign:"middle"})]})},Spinner:function(e){var t=e.id;return(0,p.jsx)(j.Spinner,{},"".concat(t,"-spinner"))},Text:function(e){var t=e.node,r=e.id;return i2(t),(0,_.assert)("Text"===t.type,"Expected value to be a text component."),(0,p.jsx)(j.Text,{fontFamily:"custom",fontSize:"sm",paddingBottom:"1",children:sq(ag(t),r)},r)},Image:function(e){var t=e.id,r=e.node;i2(r),(0,_.assert)("Image"===r.type,"Expected value to be a image component.");var n=r.props,i="data:image/svg+xml;utf8,".concat(encodeURIComponent(n.src));return(0,p.jsx)(j.Image,{src:i,alt:n.alt},"".concat(t,"-image"))}},sU=function(e){var t=e.node,r=e.form,n=e.map,i=void 0===n?{}:n,o=e.id;if(!t)return null;var a=null!=o?o:s$(i,t),s=sB[t.type];if(!s)throw Error("Unknown component type: ".concat(t.type,"."));return(0,p.jsx)(s,{id:a,node:t,form:r},a)};function sq(e,t){return e.map(function(e,r){return"string"==typeof e?(0,sO.unescape)(e):(0,p.jsx)(sU,{id:"".concat(t,"-text-child-").concat(r),node:e},"".concat(t,"-text-child-").concat(r))})}var sJ=sF()(function(e){var t=e.type,r=e.props.name,n=function(e){if(!ah(e))return null;var t,r=e.props.children;return"string"==typeof r?r.slice(0,5e3):Array.isArray(r)?r.map(function(e){return{type:null!==(t=null==e?void 0:e.type)&&void 0!==t?t:null}}):r}(e);return(0,_.remove0x)((0,_.bytesToHex)(eC(JSON.stringify({type:t,name:null!=r?r:null,children:n}))))});function s$(e,t){var r,n=sJ(t),i=(null!==(r=e[n])&&void 0!==r?r:0)+1;return e[n]=i,"".concat(n,"_").concat(i)}var sK=function(e){var t=e.content,r=s$({},t);return(0,p.jsx)(sd,{children:(0,p.jsx)(sU,{node:t,id:r})})};function sY(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=Array(t);re.length)&&(t=e.length);for(var r=0,n=Array(t);re.length)&&(t=e.length);for(var r=0,n=Array(t);re.length)&&(t=e.length);for(var r=0,n=Array(t);r=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,["name","onClick"]);return(0,p.jsx)(nX,{cursor:"pointer",onClick:function(){r(n)},children:t})},lI=function(e){var t=e.onClick;return(0,p.jsxs)(j.Box,{marginBottom:"4",children:[(0,p.jsx)(j.Text,{fontWeight:"500",fontSize:"xs",marginBottom:"1",children:"Transaction presets"}),(0,p.jsx)(j.Flex,{gap:"2",children:lj.map(function(e,r){var n,i,o=e.name,a=e.transaction;return(0,f.createElement)(lk,(n=function(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var lF={chainId:"eip155:1",origin:"metamask.io",from:"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",to:"0x9f2817015caF6607C1198fB943A8241652EE8906",value:"0.01",gas:"21000",nonce:"5",maxFeePerGas:"10",maxPriorityFeePerGas:"1",data:"0x"},lL=function(){var e,t,r,n,i,o,a,s,l,u,c,_=P(lA).request,d=null!==(c=null==_?void 0:_.params)&&void 0!==c?c:{},f=d.chainId,m=d.transactionOrigin,h=d.transaction;lF.chainId,lF.origin;var y=lP(lF,["chainId","origin"]),g=(0,la.useForm)({defaultValues:lO({chainId:null!=f?f:lF.chainId,transactionOrigin:null!=m?m:lF.origin},null!=h?h:y)}),b=g.handleSubmit,v=g.register,x=g.setValue,D=g.formState.errors,S=N();return(0,p.jsxs)(j.Flex,{as:"form",flexDirection:"column",flex:"1",onSubmit:b(function(e){var t=e.chainId,r=e.transactionOrigin,n=lP(e,["chainId","transactionOrigin"]);S(r2({origin:"",handler:cC.OnTransaction,request:{jsonrpc:"2.0",method:"onTransaction",params:{chainId:t,transaction:lN(n),transactionOrigin:r}}}))}),id:"request-form",children:[(0,p.jsx)(lI,{onClick:function(e){x("chainId",e.chainId),x("transactionOrigin",e.transactionOrigin),x("from",e.from),x("to",e.to),x("value",e.value),x("data",e.data),x("gas",e.gas),x("maxFeePerGas",e.maxFeePerGas),x("maxPriorityFeePerGas",e.maxPriorityFeePerGas),x("nonce",e.nonce)}}),(0,p.jsxs)(j.Flex,{gap:"2",children:[(0,p.jsxs)(j.FormControl,{isInvalid:!!D.chainId,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"chainId",children:"Chain ID"}),(0,p.jsx)(j.Input,lO({id:"chainId",placeholder:lF.chainId,fontFamily:"code"},v("chainId"))),(0,p.jsx)(j.FormErrorMessage,{children:null===(e=D.chainId)||void 0===e?void 0:e.message})]}),(0,p.jsxs)(j.FormControl,{isInvalid:!!D.transactionOrigin,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"origin",children:"Transaction Origin"}),(0,p.jsx)(j.Input,lO({id:"origin",placeholder:lF.origin,fontFamily:"code"},v("transactionOrigin"))),(0,p.jsx)(j.FormErrorMessage,{children:null===(t=D.transactionOrigin)||void 0===t?void 0:t.message})]})]}),(0,p.jsxs)(j.FormControl,{isInvalid:!!D.from,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"from",children:"From Address"}),(0,p.jsx)(j.Input,lO({id:"from",placeholder:lF.from,fontFamily:"code"},v("from"))),(0,p.jsx)(j.FormErrorMessage,{children:null===(r=D.from)||void 0===r?void 0:r.message})]}),(0,p.jsxs)(j.FormControl,{isInvalid:!!D.to,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"to",children:"To Address"}),(0,p.jsx)(j.Input,lO({id:"to",placeholder:lF.to,fontFamily:"code"},v("to"))),(0,p.jsx)(j.FormErrorMessage,{children:null===(n=D.to)||void 0===n?void 0:n.message})]}),(0,p.jsxs)(j.FormControl,{isInvalid:!!D.value,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"value",children:"Value"}),(0,p.jsxs)(j.InputGroup,{children:[(0,p.jsx)(j.Input,lO({id:"value",placeholder:lF.value,fontFamily:"code"},v("value"))),(0,p.jsx)(j.InputRightAddon,{children:"ETH",fontSize:"sm"})]}),(0,p.jsx)(j.FormErrorMessage,{children:null===(i=D.value)||void 0===i?void 0:i.message})]}),(0,p.jsxs)(j.Flex,{gap:"2",children:[(0,p.jsxs)(j.FormControl,{isInvalid:!!D.gas,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"gas",children:"Gas Limit"}),(0,p.jsx)(j.Input,lO({id:"gas",placeholder:lF.gas,fontFamily:"code"},v("gas"))),(0,p.jsx)(j.FormErrorMessage,{children:null===(o=D.gas)||void 0===o?void 0:o.message})]}),(0,p.jsxs)(j.FormControl,{isInvalid:!!D.nonce,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"nonce",children:"Nonce"}),(0,p.jsx)(j.Input,lO({id:"nonce",placeholder:lF.nonce,fontFamily:"code"},v("nonce"))),(0,p.jsx)(j.FormErrorMessage,{children:null===(a=D.nonce)||void 0===a?void 0:a.message})]})]}),(0,p.jsxs)(j.Flex,{gap:"2",children:[(0,p.jsxs)(j.FormControl,{isInvalid:!!D.maxFeePerGas,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"maxFeePerGas",children:"Max Fee Per Gas"}),(0,p.jsxs)(j.InputGroup,{children:[(0,p.jsx)(j.Input,lO({id:"maxFeePerGas",placeholder:lF.maxFeePerGas,fontFamily:"code"},v("maxFeePerGas"))),(0,p.jsx)(j.InputRightAddon,{children:"GWEI",fontSize:"sm"})]}),(0,p.jsx)(j.FormErrorMessage,{children:null===(s=D.maxFeePerGas)||void 0===s?void 0:s.message})]}),(0,p.jsxs)(j.FormControl,{isInvalid:!!D.maxPriorityFeePerGas,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"maxPriorityFeePerGas",children:"Max Priority Fee Per Gas"}),(0,p.jsxs)(j.InputGroup,{children:[(0,p.jsx)(j.Input,lO({id:"maxPriorityFeePerGas",placeholder:lF.maxPriorityFeePerGas,fontFamily:"code"},v("maxPriorityFeePerGas"))),(0,p.jsx)(j.InputRightAddon,{children:"GWEI",fontSize:"sm"})]}),(0,p.jsx)(j.FormErrorMessage,{children:null===(l=D.maxPriorityFeePerGas)||void 0===l?void 0:l.message})]})]}),(0,p.jsxs)(j.FormControl,{isInvalid:!!D.data,children:[(0,p.jsx)(j.FormLabel,{htmlFor:"data",children:"Data"}),(0,p.jsx)(j.Textarea,lO({id:"data",placeholder:lF.data,fontFamily:"code"},v("data"))),(0,p.jsx)(j.FormErrorMessage,{children:null===(u=D.data)||void 0===u?void 0:u.message})]})]})},lR=(0,m.createHashRouter)((0,m.createRoutesFromElements)((0,p.jsxs)(m.Route,{element:(0,p.jsx)(function(){return(0,p.jsxs)(j.Flex,{direction:"column",height:"100vh",children:[(0,p.jsx)(nd,{}),(0,p.jsxs)(j.Flex,{direction:"row",flex:"1",overflow:"hidden",children:[(0,p.jsx)(nO,{}),(0,p.jsxs)(j.Flex,{direction:"column",width:"full",children:[(0,p.jsx)(j.Flex,{flex:"1",overflow:"hidden",children:(0,p.jsx)(m.Outlet,{})}),(0,p.jsx)(K,{})]})]})]})},{}),children:[(0,p.jsx)(m.Route,{path:"/",element:(0,p.jsx)(m.Navigate,{to:"/handler/".concat(cC.OnRpcRequest),replace:!0})}),(0,p.jsx)(m.Route,{path:"/builder",element:(0,p.jsx)(function(){var e,t,r=sZ((0,f.useState)(2),2),n=r[0],i=r[1],o=sZ((0,f.useState)([{id:1,parent:0,text:"Box",droppable:!0,data:nL({children:null})}]),2),a=o[0],s=o[1];return(0,p.jsx)(j.Flex,{width:"100%",direction:"column",overflow:"hidden",children:(0,p.jsxs)(j.Flex,{direction:"row",flex:"1",overflow:"hidden",children:[(0,p.jsx)(j.Flex,{direction:"column",flex:"1",width:"50%",overflow:"hidden",children:(0,p.jsxs)(j.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,p.jsx)(j.TabList,{children:(0,p.jsx)(j.Tab,{children:"Builder"})}),(0,p.jsx)(j.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:(0,p.jsxs)(j.TabPanel,{display:"flex",flexDirection:"column",flex:"1",overflowY:"auto",children:[(0,p.jsx)(n3,{nextId:n,incrementId:function(){i(function(e){return e+1})}}),(0,p.jsx)(aZ,{items:a,setItems:s})]})})]})}),(0,p.jsx)(j.Box,{display:"flex",flexDirection:"column",flex:"1",width:"50%",borderLeft:"1px solid",borderColor:"border.default",children:(0,p.jsxs)(j.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,p.jsxs)(j.TabList,{children:[(0,p.jsx)(j.Tab,{children:"Result"}),(0,p.jsx)(j.Tab,{children:"Code"})]}),(0,p.jsxs)(j.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,p.jsx)(j.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"4",children:(0,p.jsx)(sH,{items:a})}),(0,p.jsx)(j.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"0",children:(0,p.jsx)(nq,{border:"none",value:(t=(function e(t){var r=new Set;r.add(t.type);var n=ag(t),i=!0,o=!1,a=void 0;try{for(var s,l=n[Symbol.iterator]();!(i=(s=l.next()).done);i=!0){var u=s.value;if("string"!=typeof u&&(r.add(u.type),ah(t))){var c=e(u),p=!0,_=!1,d=void 0;try{for(var f,m=c[Symbol.iterator]();!(p=(f=m.next()).done);p=!0){var h=f.value;r.add(h)}}catch(e){_=!0,d=e}finally{try{p||null==m.return||m.return()}finally{if(_)throw d}}}}}catch(e){o=!0,a=e}finally{try{i||null==l.return||l.return()}finally{if(o)throw a}}return Array.from(r).sort(function(e,t){return e.localeCompare(t)})})(e=aN(a)).join(", "),aE().format("\n import { ".concat(t," } from '@metamask/snaps-sdk/jsx';\n\n const Component = () => (").concat(function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(Array.isArray(t))return t.map(function(t){return e(t,r)}).join("");var n=" ".repeat(r);if("string"==typeof t)return"".concat(n).concat(t,"\n");if(!t)return"";var i=t.type,o=t.props,a=r>0?"\n":"";if((0,_.hasProperty)(o,"children")){var s=e(o.children,r+1);return"".concat(n,"<").concat(i).concat(av(o),">\n").concat(s).concat(n,"").concat(a)}return"".concat(n,"<").concat(i).concat(av(o)," />").concat(a)}(e),");\n"),{parser:"typescript",plugins:[aD()],printWidth:80,tabWidth:2,singleQuote:!0,trailingComma:"all"})),language:"typescript",options:{readOnly:!0}})})]})]})})]})})},{})}),(0,p.jsx)(m.Route,{path:"/manifest",element:(0,p.jsx)(function(){var e=P(ns);return(0,p.jsx)(j.Flex,{width:"100%",direction:"column",overflow:"hidden",children:(0,p.jsxs)(j.Flex,{direction:"row",flex:"1",overflow:"hidden",children:[(0,p.jsx)(j.Flex,{direction:"column",flex:"1",width:"50%",overflow:"hidden",children:(0,p.jsxs)(j.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,p.jsx)(j.TabList,{children:(0,p.jsx)(j.Tab,{children:"Validation"})}),(0,p.jsx)(j.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:(0,p.jsx)(j.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"0",children:(0,p.jsx)(s1,{})})})]})}),(0,p.jsx)(j.Box,{display:"flex",flexDirection:"column",flex:"1",width:"50%",borderLeft:"1px solid",borderColor:"border.default",children:(0,p.jsxs)(j.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,p.jsx)(j.TabList,{children:(0,p.jsx)(j.Tab,{children:"Manifest"})}),(0,p.jsx)(j.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:(0,p.jsx)(j.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"0",children:(0,p.jsx)(nq,{border:"none",value:JSON.stringify(e,null,2),options:{readOnly:!0,wordWrap:"on"}})})})]})})]})})},{})}),(0,p.jsxs)(m.Route,{path:"/handler",element:(0,p.jsx)(function(){var e,t=function(e){if(Array.isArray(e))return e}(e=(0,f.useState)(0))||function(e,t){var r,n,i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(r=i.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){s=!0,n=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw n}}return o}}(e,2)||function(e,t){if(e){if("string"==typeof e)return lu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return lu(e,t)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),r=t[0],n=t[1],i=P(nn);return(0,p.jsx)(j.Flex,{width:"100%",direction:"column",overflow:"hidden",children:(0,p.jsxs)(j.Flex,{direction:"row",flex:"1",overflow:"hidden",children:[(0,p.jsx)(s2,{isTest:!1,children:(0,p.jsx)(j.Flex,{direction:"column",flex:"1",width:"50%",overflow:"hidden",children:(0,p.jsxs)(j.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",isLazy:!0,onChange:n,children:[(0,p.jsx)(lt,{}),(0,p.jsxs)(j.TabList,{alignItems:"center",children:[(0,p.jsx)(j.Tab,{children:"Request"}),(0,p.jsx)(j.Tab,{children:"History"}),0===r&&(0,p.jsx)(j.Box,{marginLeft:"auto",children:(0,p.jsx)(le,{})})]}),(0,p.jsxs)(j.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,p.jsx)(j.TabPanel,{display:"flex",flexDirection:"column",flex:"1",overflowY:"auto","data-testid":"tab-request",children:(0,p.jsx)(m.Outlet,{})}),(0,p.jsx)(j.TabPanel,{padding:"0",display:"flex",flexDirection:"column",flex:"1",overflowY:"auto",children:(0,p.jsx)(s8,{})})]})]})})}),(0,p.jsx)(j.Box,{display:"flex",flexDirection:"column",flex:"1",width:"50%",borderLeft:"1px solid",borderColor:"border.default",children:(0,p.jsxs)(j.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,p.jsx)(lt,{}),(0,p.jsx)(lr,{}),(0,p.jsxs)(j.TabList,{children:[(0,p.jsx)(j.Tab,{children:"Response"}),i&&(0,p.jsx)(j.Tab,{children:"UI"})]}),(0,p.jsxs)(j.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,p.jsx)(j.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"0","data-testid":"tab-response",children:(0,p.jsx)(ln,{})}),i&&(0,p.jsx)(j.TabPanel,{overflowY:"auto","data-testid":"tab-ui",children:(0,p.jsx)(ll,{})})]})]})})]})})},{}),children:[(0,p.jsx)(m.Route,{path:"/handler/".concat(cC.OnRpcRequest),element:(0,p.jsx)(function(){return(0,p.jsx)(lm,{})},{})}),(0,p.jsx)(m.Route,{path:"/handler/".concat(cC.OnCronjob),element:(0,p.jsx)(function(){return(0,p.jsx)(lS,{})},{})}),(0,p.jsx)(m.Route,{path:"/handler/".concat(cC.OnTransaction),element:(0,p.jsx)(function(){return(0,p.jsx)(lL,{})},{})})]})]})));function lz(e){for(var t=1;t1?t-1:0),n=1;n1?t-1:0),n=1;n1?t-1:0),n=1;n2?r-2:0),i=2;i2?i-2:0),a=2;a2?r-2:0),i=2;i1?t-1:0),n=1;n3?t.i-4:t.i:Array.isArray(e)?1:co(e)?2:ca(e)?3:0}function cn(e,t){return 2===cr(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ci(e,t,r){var n=cr(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function co(e){return c4&&e instanceof Map}function ca(e){return c6&&e instanceof Set}function cs(e){return e.o||e.t}function cl(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=pr(e);delete t[c9];for(var r=pt(t),n=0;n1&&(e.set=e.add=e.clear=e.delete=cc),Object.freeze(e),t&&ct(e,function(e,t){return cu(t,!0)},!0)),e}function cc(){u7(2)}function cp(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function c_(e){var t=pn[e];return t||u7(18,e),t}function cd(e,t){t&&(c_("Patches"),e.u=[],e.s=[],e.v=t)}function cf(e){cm(e),e.p.forEach(cy),e.p=null}function cm(e){e===c2&&(c2=e.l)}function ch(e){return c2={p:[],l:c2,h:e,m:!0,_:0}}function cy(e){var t=e[c9];0===t.i||1===t.i?t.j():t.g=!0}function cg(e,t){t._=t.p.length;var r=t.p[0],n=void 0!==e&&e!==r;return t.h.O||c_("ES5").S(t,e,n),n?(r[c9].P&&(cf(t),u7(4)),ce(e)&&(e=cb(t,e),t.l||cx(t,e)),t.u&&c_("Patches").M(r[c9].t,e,t.u,t.s)):e=cb(t,r,[]),cf(t),t.u&&t.v(t.u,t.s),e!==c8?e:void 0}function cb(e,t,r){if(cp(t))return t;var n=t[c9];if(!n)return ct(t,function(i,o){return cv(e,n,t,i,o,r)},!0),t;if(n.A!==e)return t;if(!n.P)return cx(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var i=4===n.i||5===n.i?n.o=cl(n.k):n.o,o=i,a=!1;3===n.i&&(o=new Set(i),i.clear(),a=!0),ct(o,function(t,o){return cv(e,n,i,t,o,r,a)}),cx(e,i,!1),r&&e.u&&c_("Patches").N(n,r,e.u,e.s)}return n.o}function cv(e,t,r,n,i,o,a){if(u9(i)){var s=cb(e,i,o&&t&&3!==t.i&&!cn(t.R,n)?o.concat(n):void 0);if(ci(r,n,s),!u9(s))return;e.m=!1}else a&&r.add(i);if(ce(i)&&!cp(i)){if(!e.h.D&&e._<1)return;cb(e,i),t&&t.A.l||cx(e,i)}}function cx(e,t,r){void 0===r&&(r=!1),!e.l&&e.h.D&&e.m&&cu(t,r)}function cD(e,t){var r=e[c9];return(r?cs(r):e)[t]}function cS(e,t){if(t in e)for(var r=Object.getPrototypeOf(e);r;){var n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Object.getPrototypeOf(r)}}function cE(e){e.P||(e.P=!0,e.l&&cE(e.l))}function cT(e){e.o||(e.o=cl(e.t))}function cw(e,t,r){var n,i,o,a,s,l,u,c=co(t)?c_("MapSet").F(t,r):ca(t)?c_("MapSet").T(t,r):e.O?(o=i={i:(n=Array.isArray(t))?1:0,A:r?r.A:c2,P:!1,I:!1,R:{},l:r,t:t,k:null,o:null,j:null,C:!1},a=pi,n&&(o=[i],a=po),l=(s=Proxy.revocable(o,a)).revoke,u=s.proxy,i.k=u,i.j=l,u):c_("ES5").J(t,r);return(r?r.A:c2).p.push(c),c}function cA(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return cl(e)}!function(e){e.Insight="Insight",e.Dialog="Dialog",e.Notification="Notification",e.HomePage="HomePage"}(c0||(c0={}));var cC,cM,cN,cj,ck,cI,cO,cP,cF,cL,cR,cz,cB,cU,cq,cJ,c$,cK,cY,cV,cW,cQ,cH,cG,cZ,cX,c0,c1,c2,c3="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),c4="undefined"!=typeof Map,c6="undefined"!=typeof Set,c5="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,c8=c3?Symbol.for("immer-nothing"):((c1={})["immer-nothing"]=!0,c1),c7=c3?Symbol.for("immer-draftable"):"__$immer_draftable",c9=c3?Symbol.for("immer-state"):"__$immer_state",pe=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),pt="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,pr=Object.getOwnPropertyDescriptors||function(e){var t={};return pt(e).forEach(function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)}),t},pn={},pi={get:function(e,t){if(t===c9)return e;var r,n,i=cs(e);if(!cn(i,t))return(n=cS(i,t))?"value"in n?n.value:null===(r=n.get)||void 0===r?void 0:r.call(e.k):void 0;var o=i[t];return e.I||!ce(o)?o:o===cD(e.t,t)?(cT(e),e.o[t]=cw(e.A.h,o,e)):o},has:function(e,t){return t in cs(e)},ownKeys:function(e){return Reflect.ownKeys(cs(e))},set:function(e,t,r){var n=cS(cs(e),t);if(null==n?void 0:n.set)return n.set.call(e.k,r),!0;if(!e.P){var i=cD(cs(e),t),o=null==i?void 0:i[c9];if(o&&o.t===r)return e.o[t]=r,e.R[t]=!1,!0;if((r===i?0!==r||1/r==1/i:r!=r&&i!=i)&&(void 0!==r||cn(e.t,t)))return!0;cT(e),cE(e)}return e.o[t]===r&&(void 0!==r||t in e.o)||Number.isNaN(r)&&Number.isNaN(e.o[t])||(e.o[t]=r,e.R[t]=!0),!0},deleteProperty:function(e,t){return void 0!==cD(e.t,t)||t in e.t?(e.R[t]=!1,cT(e),cE(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=cs(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty:function(){u7(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){u7(12)}},po={};ct(pi,function(e,t){po[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),po.deleteProperty=function(e,t){return po.set.call(this,e,t,void 0)},po.set=function(e,t,r){return pi.set.call(this,e[0],t,r,e[0])};var pa=new(function(){function e(e){var t=this;this.O=c5,this.D=!0,this.produce=function(e,r,n){if("function"==typeof e&&"function"!=typeof r){var i,o=r;return r=e,function(e){var n=this;void 0===e&&(e=o);for(var i=arguments.length,a=Array(i>1?i-1:0),s=1;s1?n-1:0),o=1;o=0;r--){var r,n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));var i=c_("Patches").$;return u9(e)?i(e,t):this.produce(e,function(e){return i(e,t)})},e}());pa.produce,pa.produceWithPatches.bind(pa),pa.setAutoFreeze.bind(pa),pa.setUseProxies.bind(pa),pa.applyPatches.bind(pa),pa.createDraft.bind(pa),pa.finishDraft.bind(pa);let ps=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((e,t)=>((t&=63)<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),"");function pl(e){var t;return(0,_.isPlainObject)(e)&&(0,_.hasProperty)(e,"type")&&(0,_.hasProperty)(e,"props")&&(0,_.hasProperty)(e,"key")?e:(t=function e(t){switch(t.type){case cU.Panel:return t.children.reduce(function(t,r){return t+e(r)},0);case cU.Row:return e(t.value);case cU.Text:return t.value.length;default:return 0}}(e),(0,_.assert)(t<=5e4,"The text in a Snap UI may not be larger than ".concat(50," kB.")),function e(t){switch(t.type){case cU.Address:return i3(i9,{address:t.value});case cU.Button:return i3(nW,{name:t.name,variant:function(e){switch(e){case"primary":return"primary";case"secondary":return"destructive";default:return}}(t.variant),type:t.buttonType,children:t.value});case cU.Copyable:return i3(nY,{value:t.value,sensitive:t.sensitive});case cU.Divider:return i3(nK,{});case cU.Form:return i3(nQ,{name:t.name,children:a_(t.children.map(e))});case cU.Heading:return i3(nJ,{children:t.value});case cU.Image:return i3(nV,{src:t.value});case cU.Input:return i3(nH,{label:t.label,error:t.error,children:i3(nG,{name:t.name,type:t.inputType,value:t.value,placeholder:t.placeholder})});case cU.Panel:return i3(nL,{children:a_(t.children.map(e))});case cU.Row:return i3(oe,{label:t.label,variant:t.variant,children:e(t.value)});case cU.Spinner:return i3(ot,{});case cU.Text:var r,n;return i3(n$,{children:a_((r=an(t.value,{gfm:!1}),n=[],ar(r,function(e){if("paragraph"===e.type){n.length>0&&n.push("\n\n");var t,r=e.tokens;n.push.apply(n,function(e){if(Array.isArray(e))return al(e)}(t=r.flatMap(af))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||ac(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}}),n.filter(function(e){return null!==e})))});default:return(0,_.assertExhaustive)(t)}}(e))}function pu(e,t){(0,_.assert)(void 0===e[t],'Duplicate component names are not allowed, found multiple instances of: "'.concat(t,'".'))}function pc(e,t,r){var n,i,o,a=r?e[r]:e,s=null==a?void 0:a[t.props.name];return"FileInput"===t.type?null!=s?s:null:null!==(o=null!==(i=null!==(n="Checkbox"===t.type?t.props.checked:t.props.value)&&void 0!==n?n:s)&&void 0!==i?i:function(e){var t,r,n;switch(e.type){case"Dropdown":return null===(t=ag(e)[0])||void 0===t?void 0:t.props.value;case"RadioGroup":return null===(r=ag(e)[0])||void 0===r?void 0:r.props.value;case"Selector":return null===(n=ag(e)[0])||void 0===n?void 0:n.props.value;case"Checkbox":return!1;default:return null}}(t))&&void 0!==o?o:null}function pp(e,t){var r={},n=[];return ab(t,function(t,i){var o=n[n.length-1];if(o&&i<=o.depth&&(n.pop(),o=n[n.length-1]),"Form"===t.type){pu(r,t.props.name),n.push({name:t.props.name,depth:i}),r[t.props.name]={};return}if(o&&("Input"===t.type||"Dropdown"===t.type||"RadioGroup"===t.type||"FileInput"===t.type||"Checkbox"===t.type||"Selector"===t.type)){var a=r[o.name];pu(a,t.props.name),a[t.props.name]=pc(e,t,o.name);return}("Input"===t.type||"Dropdown"===t.type||"RadioGroup"===t.type||"FileInput"===t.type||"Checkbox"===t.type||"Selector"===t.type)&&(pu(r,t.props.name),r[t.props.name]=pc(e,t))}),r}function p_(e){if(e){var t=e8(e);(0,_.assert)(t<=1e6,"A Snap interface context may not be larger than ".concat(1," MB."))}}function pd(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=-32099&&e<=-32e3)return"Unspecified server error."}return t}function p4(e){return Object.getOwnPropertyNames(e).reduce((t,r)=>{let n=e[r];return(0,_.isValidJson)(n)&&(t[r]=n),t},{})}p3(p2);let p6=function(e){return e?.__esModule?e.default:e}(pX());class p5 extends Error{constructor(e,t,r){if(!Number.isInteger(e))throw Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw Error('"message" must be a non-empty string.');(function(e){return(0,_.isObject)(e)&&(0,_.hasProperty)(e,"cause")&&(0,_.isObject)(e.cause)})(r)?(super(t,{cause:r.cause}),(0,_.hasProperty)(this,"cause")||Object.assign(this,{cause:r.cause})):super(t),void 0!==r&&(this.data=r),this.code=e}serialize(){var e;let t={code:this.code,message:this.message};return void 0!==this.data&&(t.data=this.data,(0,_.isPlainObject)(this.data)&&(t.data.cause=Array.isArray(e=this.data.cause)?e.map(e=>(0,_.isValidJson)(e)?e:(0,_.isObject)(e)?p4(e):null):(0,_.isObject)(e)?p4(e):(0,_.isValidJson)(e)?e:null)),this.stack&&(t.stack=this.stack),t}toString(){return p6(this.serialize(),p7,2)}}class p8 extends p5{constructor(e,t,r){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}}function p7(e,t){if("[Circular]"!==t)return t}function p9(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r1?r-1:0),i=1;i=0,TypeError("Can't start a timer with negative time")),this.state={value:"stopped",remaining:e}}return e=[{key:"status",get:function(){return this.state.value}},{key:"remaining",get:function(){return this.state.remaining}},{key:"cancel",value:function(){(0,_.assert)("paused"===this.status||"running"===this.status,Error("Tried to cancel a not running Timer")),this.onFinish(!1)}},{key:"finish",value:function(){(0,_.assert)("finished"!==this.status,Error("Tried to finish a finished Timer.")),this.onFinish(!0)}},{key:"pause",value:function(){(0,_.assert)("running"===this.state.value,Error("Tried to pause a not running Timer"));var e=this.state,t=e.callback,r=e.start,n=e.timeout,i=e.remaining;void 0!==n&&clearTimeout(n),this.state={value:"paused",callback:t,remaining:i-(Date.now()-r)}}},{key:"start",value:function(e){(0,_.assert)("stopped"===this.state.value,Error("Tried to start an already running Timer"));var t=this.state.remaining;this.state={value:"paused",remaining:t,callback:e},this.resume()}},{key:"resume",value:function(){var e,t=this;(0,_.assert)("paused"===this.state.value,Error("Tried to resume not paused Timer"));var r=this.state,n=r.remaining,i=r.callback,o=Date.now();n!==Number.POSITIVE_INFINITY&&(e=setTimeout(function(){return t.onFinish(!0)},n)),this.state={value:"running",callback:i,remaining:n,start:o,timeout:e}}},{key:"onFinish",value:function(e){(0,_.assert)("running"===this.state.value||"paused"===this.state.value),"running"===this.state.value&&void 0!==this.state.timeout&&clearTimeout(this.state.timeout);var t=this.state,r=t.callback,n=t.remaining;this.state={value:"finished",remaining:"running"===this.state.value?n-(Date.now()-this.state.start):n},e&&r()}}],_n(r.prototype,e),t&&_n(r,t),r}();function _o(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,i)}function _a(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){_o(o,n,i,a,s,"next",e)}function s(e){_o(o,n,i,a,s,"throw",e)}a(void 0)})}}function _s(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]e.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]_G(p0.rpc.parse,e),invalidRequest:e=>_G(p0.rpc.invalidRequest,e),invalidParams:e=>_G(p0.rpc.invalidParams,e),methodNotFound:e=>_G(p0.rpc.methodNotFound,e),internal:e=>_G(p0.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum RPC Server errors must provide single object argument.");let{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw Error('"code" must be an integer such that: -32099 <= code <= -32005');return _G(t,e)},invalidInput:e=>_G(p0.rpc.invalidInput,e),resourceNotFound:e=>_G(p0.rpc.resourceNotFound,e),resourceUnavailable:e=>_G(p0.rpc.resourceUnavailable,e),transactionRejected:e=>_G(p0.rpc.transactionRejected,e),methodNotSupported:e=>_G(p0.rpc.methodNotSupported,e),limitExceeded:e=>_G(p0.rpc.limitExceeded,e)},_H={userRejectedRequest:e=>_Z(p0.provider.userRejectedRequest,e),unauthorized:e=>_Z(p0.provider.unauthorized,e),unsupportedMethod:e=>_Z(p0.provider.unsupportedMethod,e),disconnected:e=>_Z(p0.provider.disconnected,e),chainDisconnected:e=>_Z(p0.provider.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum Provider custom errors must provide single object argument.");let{code:t,message:r,data:n}=e;if(!r||"string"!=typeof r)throw Error('"message" must be a nonempty string');return new p8(t,r,n)}};function _G(e,t){let[r,n]=_X(t);return new p5(e,r??p3(e),n)}function _Z(e,t){let[r,n]=_X(t);return new p8(e,r??p3(e),n)}function _X(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){let{message:t,data:r}=e;if(t&&"string"!=typeof t)throw Error("Must specify string message.");return[t??void 0,r]}}return[]}function _0(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(t,["maxRequestTime"]));return a?(n=function(e){for(var t=1;t0),{caveats:t}})),dM(i,di.targetName,_3(function(e){return{caveats:[{type:cN.KeyringOrigin,value:e}]}})),dM(i,dD.targetName,_3(function(e){return!e||!(0,_.isObject)(e)||(0,_.isObject)(e)&&0===Object.keys(e).length?{caveats:null}:{caveats:[{type:cN.SignatureOrigin,value:(0,_.hasProperty)(e,"allowSignatureOrigin")&&e.allowSignatureOrigin}]}})),dM(i,dl.targetName,_2),dM(i,dt.targetName,_2),dM(i,dv.targetName,_2),i);dM(o={},cC.OnRpcRequest,dy.targetName),dM(o,cC.OnTransaction,dT.targetName),dM(o,cC.OnCronjob,_5.targetName),dM(o,cC.OnNameLookup,dp.targetName),dM(o,cC.OnInstall,dl.targetName),dM(o,cC.OnUpdate,dl.targetName),dM(o,cC.OnKeyringRequest,di.targetName),dM(o,cC.OnHomePage,dt.targetName),dM(o,cC.OnSettingsPage,dv.targetName),dM(o,cC.OnSignature,dD.targetName),dM(o,cC.OnUserInput,null);let dI=BigInt(4294967296-1),dO=BigInt(32),dP=(e,t,r)=>e<>>32-r,dF=(e,t,r)=>t<>>32-r,dL=(e,t,r)=>t<>>64-r,dR=(e,t,r)=>e<>>64-r,dz=[],dB=[],dU=[],dq=BigInt(0),dJ=BigInt(1),d$=BigInt(2),dK=BigInt(7),dY=BigInt(256),dV=BigInt(113);for(let e=0,t=dJ,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],dz.push(2*(5*n+r)),dB.push((e+1)*(e+2)/2%64);let i=dq;for(let e=0;e<7;e++)(t=(t<>dK)*dV)%dY)&d$&&(i^=dJ<<(dJ<>dO&dI)}:{h:0|Number(e>>dO&dI),l:0|Number(e&dI)}}(e[i],t);[r[i],n[i]]=[o,a]}return[r,n]}(dU,!0),dH=(e,t,r)=>r>32?dL(e,t,r):dP(e,t,r),dG=(e,t,r)=>r>32?dR(e,t,r):dF(e,t,r);class dZ extends eb{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,el(r),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=e_(this.state)}keccak(){em||ey(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let n=(t+8)%10,i=(t+2)%10,o=r[i],a=r[i+1],s=dH(o,a,1)^r[n],l=dG(o,a,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=s,e[t+r+1]^=l}let t=e[2],i=e[3];for(let r=0;r<24;r++){let n=dB[r],o=dH(t,i,n),a=dG(t,i,n),s=dz[r];t=e[s],i=e[s+1],e[s]=o,e[s+1]=a}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=dW[n],e[1]^=dQ[n]}r.fill(0)}(this.state32,this.rounds),em||ey(this.state32),this.posOut=0,this.pos=0}update(e){ec(this);let{blockLen:t,state:r}=this;e=eg(e);let n=e.length;for(let i=0;i=r&&this.keccak();let o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return el(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(ep(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:o}=this;return e||(e=new dZ(t,r,n,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=o,e.destroyed=this.destroyed,e}}let dX=ev(()=>new dZ(136,1,32));function d0(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]>>0;t.push("bip32:".concat(i-2147483648,"'"))}return t}(dX((0,_.concatBytes)([s,dX(l)]))),[4,e7.SLIP10Node.fromDerivationPath({derivationPath:[i,"bip32:".concat(o)].concat(d3(u)),curve:"secp256k1"},a)];case 1:return c=p.sent().privateKey,(0,_.assert)(c,"Failed to derive the entropy."),[2,(0,_.add0x)(c)]}})})).apply(this,arguments)}function d8(e){return d7.apply(this,arguments)}function d7(){return(d7=d2(function(e){var t,r,n,i,o;return d4(this,function(a){switch(a.label){case 0:return t=e.curve,r=e.secretRecoveryPhrase,n=e.path,i=e.cryptographicFunctions,o=function(e){switch(e){case"secp256k1":return"bip32";case"ed25519":return"slip10";case"ed25519Bip32":return"cip3";default:return(0,_.assertExhaustive)(e)}}(t),[4,e7.SLIP10Node.fromDerivationPath({curve:t,derivationPath:[r].concat(d3(n.slice(1).map(function(e){return"".concat(o,":").concat(e)})))},i)];case 1:return[2,a.sent()]}})})).apply(this,arguments)}function d9(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,i)}var fe="snap_getBip32Entropy",ft=Object.freeze({targetName:fe,specificationBuilder:function(e){var t,r,n,i,o,a=e.methodHooks;return{permissionType:ta.PermissionType.RestrictedMethod,targetName:fe,allowedCaveats:[cN.PermittedDerivationPaths],methodImplementation:(n=a.getMnemonic,i=a.getUnlockPromise,o=a.getClientCryptography,t=function(e){var t,r;return function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]2147483647)throw _Q.invalidParams({message:'Invalid "coinType" parameter. Coin type must be a non-negative integer.'});if(tF.includes(e.coinType))throw _Q.invalidParams({message:"Coin type ".concat(e.coinType," is forbidden.")})}var fy=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}({},cN.PermittedCoinTypes,Object.freeze({type:cN.PermittedCoinTypes,decorator:function(e,t){var r,n;return r=function(r){var n;return function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]2&&void 0!==arguments[2]?arguments[2]:104857600;if(!(0,_.isObject)(e))throw _Q.invalidParams({message:"Expected params to be a single object."});var i=e.operation,o=e.newState,a=e.encrypted;if(!i||"string"!=typeof i||!Object.values(l).includes(i))throw _Q.invalidParams({message:'Must specify a valid manage state "operation".'});if(void 0!==a&&"boolean"!=typeof a)throw _Q.invalidParams({message:'"encrypted" parameter must be a boolean if specified.'});if(i===l.UpdateState){if(!(0,_.isObject)(o))throw _Q.invalidParams({message:"Invalid ".concat(t,' "updateState" parameter: The new state must be a plain object.'),data:{receivedNewState:void 0===o?"undefined":o}});try{r=(0,_.getJsonSize)(o)}catch(e){throw _Q.invalidParams({message:"Invalid ".concat(t,' "updateState" parameter: The new state must be JSON serializable.'),data:{receivedNewState:void 0===o?"undefined":o}})}if(r>n)throw _Q.invalidParams({message:"Invalid ".concat(t,' "updateState" parameter: The new state must not exceed ').concat(n," bytes in size."),data:{receivedNewState:void 0===o?"undefined":o}})}return e}(r,s)).encrypted)||void 0===p||p)&&c.operation!==l.ClearState))return[3,2];return[4,n(!0)];case 1:f.sent(),f.label=2;case 2:switch(c.operation){case l.ClearState:return[3,3];case l.GetState:return[3,4];case l.UpdateState:return[3,6]}return[3,8];case 3:return i(u,d),[2,null];case 4:return[4,o(u,d)];case 5:return[2,f.sent()];case 6:return[4,a(u,c.newState,d)];case 7:return f.sent(),[2,null];case 8:throw _Q.invalidParams("Invalid ".concat(s,' operation: "').concat(c.operation,'"'));case 9:return[2]}})},r=function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function a(e){f3(o,n,i,a,s,"next",e)}function s(e){f3(o,n,i,a,s,"throw",e)}a(void 0)})},function(e){return r.apply(this,arguments)}),subjectTypes:[ta.SubjectType.Snap]}},methodHooks:{getUnlockPromise:!0,clearSnapState:!0,getSnapState:!0,updateSnapState:!0}});function f5(e){return(0,_.isObject)(e)&&(0,_.hasProperty)(e,"message")&&"string"==typeof e.message?e.message:String(e)}function f8(e){if((0,_.isObject)(e)&&(0,_.hasProperty)(e,"stack")&&"string"==typeof e.stack)return e.stack}function f7(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,i)}var f9="snap_notify",me=(0,Q.object)({type:tE(cH.Native),message:(0,Q.string)()}),mt=tT([(0,Q.object)({type:tE(cH.InApp),message:(0,Q.string)()}),(0,Q.object)({type:tE(cH.InApp),message:(0,Q.string)(),content:u5,title:(0,Q.string)(),footerLink:(0,Q.optional)((0,Q.object)({href:(0,Q.string)(),text:(0,Q.string)()}))}),me]),mr=Object.freeze({targetName:f9,specificationBuilder:function(e){var t,r,n,i,o,a,s,l,u=e.allowedCaveats,c=e.methodHooks;return{permissionType:ta.PermissionType.RestrictedMethod,targetName:f9,allowedCaveats:void 0===u?null:u,methodImplementation:(n=c.showNativeNotification,i=c.showInAppNotification,o=c.isOnPhishingList,a=c.maybeUpdatePhishingList,s=c.createInterface,l=c.getSnap,t=function(e){var t,r,u,c;return function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=50))throw _Q.invalidParams({message:'Must specify a non-empty string "message" less than 50 characters long.'});if(n===cH.InApp&&(o||i.length>=500))throw _Q.invalidParams({message:'Must specify a non-empty string "message" less than 500 characters long.'});try{var a=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];(0,_.assert)(t.schema,"Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`."),(0,_.assert)(t.schema.length>0,"Expected a non-empty array of structs.");var i=t.schema.map(function(e){return e.schema[r]}),o=(0,Q.type)(tN({},r,tT(i))),a=tj((0,Q.validate)(e,o,{coerce:n}),1)[0];if(a)throw Error(tI(o,a.failures()[0],!1));var s=t.schema.filter(function(t){return(0,Q.is)(e[r],t.schema[r])});(0,_.assert)(s.length>0,"Expected a struct to match the value.");var l=s.map(function(t){return(0,Q.validate)(e,t,{coerce:n})}),u=l.find(function(e){return!tj(e,1)[0]});if(u)return u[1];throw(0,_.assert)(l[0][0],"Expected at least one error."),Error(tI(t,l.reduce(function(e,t){var r=tj(t,1)[0];return((0,_.assert)(r,"Expected an error."),r.failures().lengthe.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]e.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1&&void 0!==a[1]?a[1]:c.Base64,[4,uA(nu)];case 1:if(n=s.sent(),i=t3(e),!(o=null===(r=n.find(function(e){return e.path===i}))||void 0===r?void 0:r.toString("base64")))return[2,null];return[4,uE(mZ,o,t)];case 2:return[2,s.sent()]}})}function m7(e,t){return m1(this,function(r){switch(r.label){case 0:return[4,uA(r7)];case 1:return[4,uE([r.sent(),"createInterface"],e,t)];case 2:return[2,r.sent()]}})}function m9(e,t){return m1(this,function(r){switch(r.label){case 0:return[4,uA(r7)];case 1:return[4,uE([r.sent(),"getInterface"],e,t)];case 2:return[2,r.sent()]}})}function he(e,t,r){return m1(this,function(n){switch(n.label){case 0:return[4,uA(r7)];case 1:return[4,uE([n.sent(),"updateInterface"],e,t,r)];case 2:return n.sent(),[4,uE(m9,e,t)];case 3:return[4,ux(rH(m0({id:t},n.sent())))];case 4:return n.sent(),[2]}})}function ht(e,t){return m1(this,function(r){switch(r.label){case 0:return[4,uA(r7)];case 1:return[4,uE([r.sent(),"getInterface"],e,t)];case 2:return[2,r.sent().state]}})}function hr(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,i)}function hn(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){hr(o,n,i,a,s,"next",e)}function s(e){hr(o,n,i,a,s,"throw",e)}a(void 0)})}}function hi(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]e.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]e.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]2?r-2:0),i=2;i0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1&&void 0!==arguments[1]?arguments[1]:{};(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")})(this,r),hI(this,"cache",new Map),hI(this,"validatedManifest",void 0),hI(this,"url",void 0),hI(this,"fetchFn",void 0),hI(this,"fetchOptions",void 0),(0,_.assertStruct)(e.toString(),e2,"Invalid Snap Id: "),this.fetchFn=null!==(t=n.fetch)&&void 0!==t?t:globalThis.fetch.bind(void 0),this.fetchOptions=n.fetchOptions,this.url=e}return e=[{key:"manifest",value:function(){var e=this;return hj(function(){var t,r,n,i,o;return hO(this,function(a){switch(a.label){case 0:if(e.validatedManifest)return[2,e.validatedManifest.clone()];return t=new URL(cj.Manifest,e.url).toString(),[4,e.fetchFn(t,e.fetchOptions)];case 1:if(!(r=a.sent()).ok)throw Error('Failed to fetch "'.concat(t,'". Status code: ').concat(r.status,"."));return[4,r.text()];case 2:return i=e5(n=a.sent()),o=new eO({value:n,result:t2(i),path:cj.Manifest,data:{canonicalPath:t}}),e.validatedManifest=o,[2,e.manifest()]}})})()}},{key:"fetch",value:function(e){var t=this;return hj(function(){var r,n,i,o,a,s;return hO(this,function(l){switch(l.label){case 0:if(r=t3(e),void 0!==(n=t.cache.get(r)))return[2,n.clone()];return i=t.toCanonical(r).toString(),[4,t.fetchFn(i,t.fetchOptions)];case 1:if(!(o=l.sent()).ok)throw Error('Failed to fetch "'.concat(i,'". Status code: ').concat(o.status,"."));return[4,o.arrayBuffer()];case 2:return a=l.sent(),s=new eO({value:new Uint8Array(a),path:r,data:{canonicalPath:i}}),(0,_.assert)(!t.cache.has(r),"Corrupted cache, multiple files with same path."),t.cache.set(r,s),[2,t.fetch(r)]}})})()}},{key:"root",get:function(){return new URL(this.url)}},{key:"toCanonical",value:function(e){return(0,_.assert)(!e.startsWith("/"),"Tried to parse absolute path."),new URL(e,this.url)}}],hk(r.prototype,e),t&&hk(r,t),r}();function hF(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,i)}function hL(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){hF(o,n,i,a,s,"next",e)}function s(e){hF(o,n,i,a,s,"throw",e)}a(void 0)})}}function hR(e,t,r){if(!t.has(e))throw TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function hz(e,t){var r=hR(e,t,"get");return r.get?r.get.call(e):r.value}function hB(e,t){for(var r=0;r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1&&void 0!==arguments[1]?arguments[1]:{};(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")})(this,r),function(e,t){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object")}(this,hq),hq.set(this,{writable:!0,value:void 0}),(0,_.assertStruct)(e.toString(),e0,"Invalid Snap Id"),(0,_.assert)(void 0===o.fetchOptions,"Currently adding fetch options to local: is unsupported."),i=new hP(new URL(e.toString().slice(ck.local.length)),(t=function(e){for(var t=1;t0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]e.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0?[2,r.join("\n")]:[2,!0]})});return function(t,r){return e.apply(this,arguments)}}()},{name:"Checksum",manifestName:"source.shasum",validator:function(){var e=h6(function(e,t){var r,n,i,o,a,s,l;return h8(this,function(u){switch(u.label){case 0:if(r=t.sourceCode,n=t.icon,i=t.auxiliaryFiles,o=t.localizationFiles,!e)return[3,2];return s=null===(a=e.result)||void 0===a?void 0:a.source.shasum,[4,function(e){return eG.apply(this,arguments)}({manifest:e,sourceCode:r,svgIcon:n,auxiliaryFiles:i,localizationFiles:o})];case 1:if(l=u.sent(),s!==l)return[2,'Checksum mismatch - expected "'.concat(l,'" got "').concat(s,'"')];u.label=2;case 2:return[2,!0]}})});return function(t,r){return e.apply(this,arguments)}}()},{name:"Bundle",manifestName:"filePath",validator:function(){var e=h6(function(e,t){var r,n,i,o,a,s,l;return h8(this,function(u){return(r=t.sourceCode,l=h5(t1.schema.source.schema.location.schema.npm.schema.filePath.validate(null===(s=e)||void 0===s?void 0:null===(a=s.result)||void 0===a?void 0:null===(o=a.source)||void 0===o?void 0:null===(i=o.location)||void 0===i?void 0:null===(n=i.npm)||void 0===n?void 0:n.filePath),1)[0])?[2,l.message]:r?[2,!0]:[2,"Unable to load bundle."]})});return function(t,r){return e.apply(this,arguments)}}()}];function h9(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]