diff --git a/snaps-simulator/staging/main.js b/snaps-simulator/staging/main.js index 5ad26308bc..2f8d5b1734 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=ou(e);if(null===n)return r;let i='"}image(e,t,r){let n=ou(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 o0(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 of(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 o3;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];o3.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 oX.lex(e,t??this.defaults)}parser(e,t){return o2.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:

"+oo(r.message+"",!0)+"
";return t?Promise.resolve(e):e}if(t)return Promise.reject(r);throw r}}}let o6=new o4;function o5(e,t){return o6.parse(e,t)}o5.options=o5.setOptions=function(e){return o6.setOptions(e),o5.defaults=o6.defaults,i7=o5.defaults,o5},o5.getDefaults=i8,o5.defaults=i7,o5.use=function(...e){return o6.use(...e),o5.defaults=o6.defaults,i7=o5.defaults,o5},o5.walkTokens=function(e,t){return o6.walkTokens(e,t)},o5.parseInline=o6.parseInline,o5.Parser=o2,o5.parser=o2.parse,o5.Renderer=o0,o5.TextRenderer=o1,o5.Lexer=oX,o5.lexer=oX.lex,o5.Tokenizer=of,o5.Hooks=o3,o5.parse=o5,o5.options,o5.setOptions,o5.use;let o8=o5.walkTokens;o5.parseInline,o2.parse;let o7=oX.lex;function o9(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?as(e.tokens.flatMap(au)):e.href});case"text":return e.text;case"strong":return iZ(i2,{children:al(e.tokens)});case"em":return iZ(i3,{children:al(e.tokens)});default:return null}}function ac(e,t,r){try{var n=new URL(e);if((0,_.assert)(aa.includes(n.protocol),"Protocol must be one of: ".concat(aa.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=ae(t.href.replace("metamask://","").split("/")),i=n[0],o=n.slice(1),a="/".concat(o.join("/"));switch(i){case"client":return(0,_.assert)(at.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=ae(a.slice(0,-1)),u=l[0],c=l.slice(2);t="".concat(u,"//").concat(c.join("/")),(0,_.assert)(ar.includes(s),"".concat(r," invalid snap path."))}else t=o?"".concat(a[0],"/").concat(a[1]):a[0],(0,_.assert)(o?3===a.length&&ar.includes(s):2===a.length&&ar.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 ap(e){return(0,_.hasProperty)(e.props,"children")}function a_(e){return!!e&&!0!==e}function ad(e){if(ap(e)){if(Array.isArray(e.props.children))return e.props.children.filter(a_).flat(1/0);if(e.props.children)return[e.props.children]}return[]}function af(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=af(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=ad(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=af(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 am(e){return Object.entries(e).filter(function(e){return"children"!==ai(e,1)[0]}).sort(function(e,t){var r=ai(e,1)[0],n=ai(t,1)[0];return r.localeCompare(n)}).map(function(e){var t=ai(e,2),r=t[0],n=t[1];return" ".concat(r,"=").concat("string"==typeof n?'"'.concat(n,'"'):"{".concat(JSON.stringify(n),"}"))}).join("")}var ah=r(8261),ay=r.n(ah),ag=r(9691),ab=r.n(ag);function av(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 aA(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function aC(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)(nJ.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)(aJ,{}):(0,p.jsx)(aq,{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 ax(t);case"Form":return aD(t);case"Field":return aS(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"})}})})},aW=function(e){var t=e.snapName,r=P(rG),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"})]})},aQ=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)(aW,{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})]})]})},aH=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)(aQ,{snapName:t,snapId:r}),n]})};!function(e){e.Content="content",e.Error="error",e.Insights="insights"}(cU||(cU={}));var aG=function(e,t){switch(e){case cU.Insights:return"Insights from ".concat(t);case cU.Error:return"Error from ".concat(t);default:return"Content from ".concat(t)}},aZ=function(e){var t=e.type,r=e.snapName,n=e.children,i=t===cU.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:aG(t,r)})]}),(0,p.jsx)(j.Box,{padding:"3",children:n})]})};function aX(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r{let t=sh();sm(!0);try{let r=!1,n=sd(()=>{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=>{sm(t),e(r)},e=>{sm(t),r(e)})}};return sm(t),n}catch(e){throw sm(t),e}},sg=function(){return(0,sp.BX)(...arguments)};Object.keys(sp.BX).forEach(e=>{sg[e]=function(){return sp.BX[e](...arguments)}});let sb=sg.mouseEnter,sv=sg.mouseLeave;sg.mouseEnter=function(){return sb(...arguments),sg.mouseOver(...arguments)},sg.mouseLeave=function(){return sv(...arguments),sg.mouseOut(...arguments)};let sx=sg.pointerEnter,sD=sg.pointerLeave;sg.pointerEnter=function(){return sx(...arguments),sg.pointerOver(...arguments)},sg.pointerLeave=function(){return sD(...arguments),sg.pointerOut(...arguments)};let sS=sg.select;sg.select=(e,t)=>{sS(e,t),e.focus(),sg.keyUp(e,t)};let sE=sg.blur,sT=sg.focus;sg.blur=function(){return sg.focusOut(...arguments),sE(...arguments)},sg.focus=function(){return sg.focusIn(...arguments),sT(...arguments)},(0,sp.jQ)({unstable_advanceTimersWrapper:e=>sy(e),asyncWrapper:async e=>{let t=sh();sm(!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{sm(t)}},eventWrapper:e=>{let t;return sy(()=>{t=e()}),t}});let sw=new Set,sA=[];function sC(){sA.forEach(e=>{let{root:t,container:r}=e;sy(()=>{t.unmount()}),r.parentNode===document.body&&document.body.removeChild(r)}),sA.length=0,sw.clear()}if((void 0===s_||!s_.env?.RTL_SKIP_AUTO_CLEANUP)&&("function"==typeof afterEach?afterEach(()=>{sC()}):"function"==typeof teardown&&teardown(()=>{sC()}),"function"==typeof beforeAll&&"function"==typeof afterAll)){let e=sh();beforeAll(()=>{e=sh(),sm(!0)}),afterAll(()=>{sm(e)})}var sM=r(2629),sN=r(344),sj=r.n(sN),sk={primary:"primary",destructive:"outline"},sI=function(e){var t,r=e.node,n=e.id;iG(r),(0,_.assert)("Button"===r.type,"Expected value to be a button component.");var i=su().handleEvent,o=r.props;return(0,p.jsx)(j.Button,{width:"100%",variant:sk[null!==(t=o.variant)&&void 0!==t?t:"primary"],marginBottom:"4",type:o.type,onClick:function(e){o.type===cz.Button&&e.preventDefault(),i({event:cq.ButtonClickEvent,name:o.name})},children:o.children},"".concat(n,"-button"))},sO=function(e){var t=e.node,r=e.id,n=e.form,i=su(),o=i.handleInputChange,a=i.getValue;iG(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"))},sP={Bold:function(e){var t=e.node,r=e.id;return iG(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:sL(ad(t),r)},"".concat(r,"-text"))},Box:function(e){var t=e.node,r=e.id;return iG(t),(0,_.assert)("Box"===t.type,"Expected value to be a Box component."),(0,p.jsx)(j.Box,{children:ad(t).map(function(e,t){return(0,p.jsx)(sF,{node:e},"".concat(r,"-panel-child-").concat(t))})},r)},Button:sI,Copyable:function(e){var t=e.node,r=e.id;iG(t),(0,_.assert)("Copyable"===t.type,"Expected value to be a copyable component.");var n=t.props;return(0,p.jsx)(a0,{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;iG(t),(0,_.assert)("Field"===t.type,"Expected value to be a field component.");var i=ad(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)(sO,{id:r,node:o,form:n}),a&&(0,p.jsx)(sI,{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;iG(t),(0,_.assert)("Form"===t.type,"Expected value to be a form component.");var n=su().handleEvent,i=t.props;return(0,p.jsx)(j.Box,{as:"form",onSubmit:function(e){e.preventDefault(),n({event:cq.FormSubmitEvent,name:i.name})},children:ad(t).map(function(e,n){return(0,p.jsx)(sF,{node:e,form:t.props.name},"".concat(r,"-form-child-").concat(n))})},r)},Heading:function(e){var t=e.node,r=e.id;iG(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:sO,Italic:function(e){var t=e.node,r=e.id;return iG(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:sL(ad(t),r)},r)},Link:function(e){var t=e.node,r=e.id;iG(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:[sL(ad(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 iG(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:sL(ad(t),r)},r)},Image:function(e){var t=e.id,r=e.node;iG(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"))}},sF=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:sz(i,t),s=sP[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 sL(e,t){return e.map(function(e,r){return"string"==typeof e?(0,sM.unescape)(e):(0,p.jsx)(sF,{id:"".concat(t,"-text-child-").concat(r),node:e},"".concat(t,"-text-child-").concat(r))})}var sR=sj()(function(e){var t=e.type,r=e.props.name,n=function(e){if(!ap(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 sz(e,t){var r,n=sR(t),i=(null!==(r=e[n])&&void 0!==r?r:0)+1;return e[n]=i,"".concat(n,"_").concat(i)}var sB=function(e){var t=e.content,r=sz({},t);return(0,p.jsx)(sl,{children:(0,p.jsx)(sF,{node:t,id:r})})};function sU(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)(nR,{cursor:"pointer",onClick:function(){r(n)},children:t})},lC=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:lw.map(function(e,r){var n,i,o=e.name,a=e.transaction;return(0,f.createElement)(lA,(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 lj={chainId:"eip155:1",origin:"metamask.io",from:"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",to:"0x9f2817015caF6607C1198fB943A8241652EE8906",value:"0.01",gas:"21000",nonce:"5",maxFeePerGas:"10",maxPriorityFeePerGas:"1",data:"0x"},lk=function(){var e,t,r,n,i,o,a,s,l,u,c,_=P(lD).request,d=null!==(c=null==_?void 0:_.params)&&void 0!==c?c:{},f=d.chainId,m=d.transactionOrigin,h=d.transaction;lj.chainId,lj.origin;var y=lN(lj,["chainId","origin"]),g=(0,lt.useForm)({defaultValues:lM({chainId:null!=f?f:lj.chainId,transactionOrigin:null!=m?m:lj.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=lN(e,["chainId","transactionOrigin"]);S(rU({origin:"",handler:cS.OnTransaction,request:{jsonrpc:"2.0",method:"onTransaction",params:{chainId:t,transaction:lT(n),transactionOrigin:r}}}))}),id:"request-form",children:[(0,p.jsx)(lC,{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,lM({id:"chainId",placeholder:lj.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,lM({id:"origin",placeholder:lj.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,lM({id:"from",placeholder:lj.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,lM({id:"to",placeholder:lj.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,lM({id:"value",placeholder:lj.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,lM({id:"gas",placeholder:lj.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,lM({id:"nonce",placeholder:lj.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,lM({id:"maxFeePerGas",placeholder:lj.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,lM({id:"maxPriorityFeePerGas",placeholder:lj.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,lM({id:"data",placeholder:lj.data,fontFamily:"code"},v("data"))),(0,p.jsx)(j.FormErrorMessage,{children:null===(u=D.data)||void 0===u?void 0:u.message})]})]})},lI=(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)(r7,{}),(0,p.jsxs)(j.Flex,{direction:"row",flex:"1",overflow:"hidden",children:[(0,p.jsx)(nb,{}),(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(cS.OnRpcRequest),replace:!0})}),(0,p.jsx)(m.Route,{path:"/builder",element:(0,p.jsx)(function(){var e,t,r=sV((0,f.useState)(2),2),n=r[0],i=r[1],o=sV((0,f.useState)([{id:1,parent:0,text:"Box",droppable:!0,data:nD({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)(nq,{nextId:n,incrementId:function(){i(function(e){return e+1})}}),(0,p.jsx)(aV,{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)(sK,{items:a})}),(0,p.jsx)(j.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"0",children:(0,p.jsx)(nA,{border:"none",value:(t=(function e(t){var r=new Set;r.add(t.type);var n=ad(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),ap(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=aT(a)).join(", "),ab().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(am(o),">\n").concat(s).concat(n,"").concat(a)}return"".concat(n,"<").concat(i).concat(am(o)," />").concat(a)}(e),");\n"),{parser:"typescript",plugins:[ay()],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(r2);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)(sH,{})})})]})}),(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)(nA,{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 li(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 li(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(rZ);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)(sG,{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)(s5,{}),(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)(s6,{})})]}),(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)(s2,{})})]})]})})}),(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)(s5,{}),(0,p.jsx)(s8,{}),(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)(s7,{})}),i&&(0,p.jsx)(j.TabPanel,{overflowY:"auto","data-testid":"tab-ui",children:(0,p.jsx)(ln,{})})]})]})})]})})},{}),children:[(0,p.jsx)(m.Route,{path:"/handler/".concat(cS.OnRpcRequest),element:(0,p.jsx)(function(){return(0,p.jsx)(lc,{})},{})}),(0,p.jsx)(m.Route,{path:"/handler/".concat(cS.OnCronjob),element:(0,p.jsx)(function(){return(0,p.jsx)(lg,{})},{})}),(0,p.jsx)(m.Route,{path:"/handler/".concat(cS.OnTransaction),element:(0,p.jsx)(function(){return(0,p.jsx)(lk,{})},{})})]})]})));function lO(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:ce(e)?2:ct(e)?3:0}function u7(e,t){return 2===u8(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function u9(e,t,r){var n=u8(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function ce(e){return cX&&e instanceof Map}function ct(e){return c0&&e instanceof Set}function cr(e){return e.o||e.t}function cn(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=c8(e);delete t[c4];for(var r=c5(t),n=0;n1&&(e.set=e.add=e.clear=e.delete=co),Object.freeze(e),t&&u5(e,function(e,t){return ci(t,!0)},!0)),e}function co(){u3(2)}function ca(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function cs(e){var t=c7[e];return t||u3(18,e),t}function cl(e,t){t&&(cs("Patches"),e.u=[],e.s=[],e.v=t)}function cu(e){cc(e),e.p.forEach(c_),e.p=null}function cc(e){e===cG&&(cG=e.l)}function cp(e){return cG={p:[],l:cG,h:e,m:!0,_:0}}function c_(e){var t=e[c4];0===t.i||1===t.i?t.j():t.g=!0}function cd(e,t){t._=t.p.length;var r=t.p[0],n=void 0!==e&&e!==r;return t.h.O||cs("ES5").S(t,e,n),n?(r[c4].P&&(cu(t),u3(4)),u6(e)&&(e=cf(t,e),t.l||ch(t,e)),t.u&&cs("Patches").M(r[c4].t,e,t.u,t.s)):e=cf(t,r,[]),cu(t),t.u&&t.v(t.u,t.s),e!==c2?e:void 0}function cf(e,t,r){if(ca(t))return t;var n=t[c4];if(!n)return u5(t,function(i,o){return cm(e,n,t,i,o,r)},!0),t;if(n.A!==e)return t;if(!n.P)return ch(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var i=4===n.i||5===n.i?n.o=cn(n.k):n.o,o=i,a=!1;3===n.i&&(o=new Set(i),i.clear(),a=!0),u5(o,function(t,o){return cm(e,n,i,t,o,r,a)}),ch(e,i,!1),r&&e.u&&cs("Patches").N(n,r,e.u,e.s)}return n.o}function cm(e,t,r,n,i,o,a){if(u4(i)){var s=cf(e,i,o&&t&&3!==t.i&&!u7(t.R,n)?o.concat(n):void 0);if(u9(r,n,s),!u4(s))return;e.m=!1}else a&&r.add(i);if(u6(i)&&!ca(i)){if(!e.h.D&&e._<1)return;cf(e,i),t&&t.A.l||ch(e,i)}}function ch(e,t,r){void 0===r&&(r=!1),!e.l&&e.h.D&&e.m&&ci(t,r)}function cy(e,t){var r=e[c4];return(r?cr(r):e)[t]}function cg(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 cb(e){e.P||(e.P=!0,e.l&&cb(e.l))}function cv(e){e.o||(e.o=cn(e.t))}function cx(e,t,r){var n,i,o,a,s,l,u,c=ce(t)?cs("MapSet").F(t,r):ct(t)?cs("MapSet").T(t,r):e.O?(o=i={i:(n=Array.isArray(t))?1:0,A:r?r.A:cG,P:!1,I:!1,R:{},l:r,t:t,k:null,o:null,j:null,C:!1},a=c9,n&&(o=[i],a=pe),l=(s=Proxy.revocable(o,a)).revoke,u=s.proxy,i.k=u,i.j=l,u):cs("ES5").J(t,r);return(r?r.A:cG).p.push(c),c}function cD(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return cn(e)}!function(e){e.Insight="Insight",e.Dialog="Dialog",e.Notification="Notification",e.HomePage="HomePage"}(cQ||(cQ={}));var cS,cE,cT,cw,cA,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="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),cX="undefined"!=typeof Map,c0="undefined"!=typeof Set,c1="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,c2=cZ?Symbol.for("immer-nothing"):((cH={})["immer-nothing"]=!0,cH),c3=cZ?Symbol.for("immer-draftable"):"__$immer_draftable",c4=cZ?Symbol.for("immer-state"):"__$immer_state",c6=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),c5="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,c8=Object.getOwnPropertyDescriptors||function(e){var t={};return c5(e).forEach(function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)}),t},c7={},c9={get:function(e,t){if(t===c4)return e;var r,n,i=cr(e);if(!u7(i,t))return(n=cg(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||!u6(o)?o:o===cy(e.t,t)?(cv(e),e.o[t]=cx(e.A.h,o,e)):o},has:function(e,t){return t in cr(e)},ownKeys:function(e){return Reflect.ownKeys(cr(e))},set:function(e,t,r){var n=cg(cr(e),t);if(null==n?void 0:n.set)return n.set.call(e.k,r),!0;if(!e.P){var i=cy(cr(e),t),o=null==i?void 0:i[c4];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||u7(e.t,t)))return!0;cv(e),cb(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!==cy(e.t,t)||t in e.t?(e.R[t]=!1,cv(e),cb(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=cr(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(){u3(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){u3(12)}},pe={};u5(c9,function(e,t){pe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),pe.deleteProperty=function(e,t){return pe.set.call(this,e,t,void 0)},pe.set=function(e,t,r){return c9.set.call(this,e[0],t,r,e[0])};var pt=new(function(){function e(e){var t=this;this.O=c1,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=cs("Patches").$;return u4(e)?i(e,t):this.produce(e,function(e){return i(e,t)})},e}());pt.produce,pt.produceWithPatches.bind(pt),pt.setAutoFreeze.bind(pt),pt.setUseProxies.bind(pt),pt.applyPatches.bind(pt),pt.createDraft.bind(pt),pt.finishDraft.bind(pt);let pr=(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 pn(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 cF.Panel:return t.children.reduce(function(t,r){return t+e(r)},0);case cF.Row:return e(t.value);case cF.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 cF.Address:return iZ(i4,{address:t.value});case cF.Button:return iZ(nI,{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 cF.Copyable:return iZ(nj,{value:t.value,sensitive:t.sensitive});case cF.Divider:return iZ(nN,{});case cF.Form:return iZ(nO,{name:t.name,children:as(t.children.map(e))});case cF.Heading:return iZ(nC,{children:t.value});case cF.Image:return iZ(nk,{src:t.value});case cF.Input:return iZ(nP,{label:t.label,error:t.error,children:iZ(nF,{name:t.name,type:t.inputType,value:t.value,placeholder:t.placeholder})});case cF.Panel:return iZ(nD,{children:as(t.children.map(e))});case cF.Row:return iZ(i6,{label:t.label,variant:t.variant,children:e(t.value)});case cF.Spinner:return iZ(i5,{});case cF.Text:var r,n;return iZ(nM,{children:as((r=o7(t.value,{gfm:!1}),n=[],o8(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 an(e)}(t=r.flatMap(au))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||ao(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 pi(e,t){(0,_.assert)(void 0===e[t],'Duplicate component names are not allowed, found multiple instances of: "'.concat(t,'".'))}function po(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=ad(e)[0])||void 0===t?void 0:t.props.value;case"RadioGroup":return null===(r=ad(e)[0])||void 0===r?void 0:r.props.value;case"Selector":return null===(n=ad(e)[0])||void 0===n?void 0:n.props.value;case"Checkbox":return!1;default:return null}}(t))&&void 0!==o?o:null}function pa(e,t){var r={},n=[];return af(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){pi(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];pi(a,t.props.name),a[t.props.name]=po(e,t,o.name);return}("Input"===t.type||"Dropdown"===t.type||"RadioGroup"===t.type||"FileInput"===t.type||"Checkbox"===t.type||"Selector"===t.type)&&(pi(r,t.props.name),r[t.props.name]=po(e,t))}),r}function ps(e){if(e){var t=e8(e);(0,_.assert)(t<=1e6,"A Snap interface context may not be larger than ".concat(1," MB."))}}function pl(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 pX(e){return Object.getOwnPropertyNames(e).reduce((t,r)=>{let n=e[r];return(0,_.isValidJson)(n)&&(t[r]=n),t},{})}pZ(pG);let p0=function(e){return e?.__esModule?e.default:e}(pW());class p1 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)?pX(e):null):(0,_.isObject)(e)?pX(e):(0,_.isValidJson)(e)?e:null)),this.stack&&(t.stack=this.stack),t}toString(){return p0(this.serialize(),p3,2)}}class p2 extends p1{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 p3(e,t){if("[Circular]"!==t)return t}function p4(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()}}],p7(r.prototype,e),t&&p7(r,t),r}();function _e(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 _t(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){_e(o,n,i,a,s,"next",e)}function s(e){_e(o,n,i,a,s,"throw",e)}a(void 0)})}}function _r(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]_Y(pQ.rpc.parse,e),invalidRequest:e=>_Y(pQ.rpc.invalidRequest,e),invalidParams:e=>_Y(pQ.rpc.invalidParams,e),methodNotFound:e=>_Y(pQ.rpc.methodNotFound,e),internal:e=>_Y(pQ.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 _Y(t,e)},invalidInput:e=>_Y(pQ.rpc.invalidInput,e),resourceNotFound:e=>_Y(pQ.rpc.resourceNotFound,e),resourceUnavailable:e=>_Y(pQ.rpc.resourceUnavailable,e),transactionRejected:e=>_Y(pQ.rpc.transactionRejected,e),methodNotSupported:e=>_Y(pQ.rpc.methodNotSupported,e),limitExceeded:e=>_Y(pQ.rpc.limitExceeded,e)},_K={userRejectedRequest:e=>_V(pQ.provider.userRejectedRequest,e),unauthorized:e=>_V(pQ.provider.unauthorized,e),unsupportedMethod:e=>_V(pQ.provider.unsupportedMethod,e),disconnected:e=>_V(pQ.provider.disconnected,e),chainDisconnected:e=>_V(pQ.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 p2(t,r,n)}};function _Y(e,t){let[r,n]=_W(t);return new p1(e,r??pZ(e),n)}function _V(e,t){let[r,n]=_W(t);return new p2(e,r??pZ(e),n)}function _W(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 _Q(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}})),dD(i,_9.targetName,_Z(function(e){return{caveats:[{type:cT.KeyringOrigin,value:e}]}})),dD(i,dm.targetName,_Z(function(e){return!e||!(0,_.isObject)(e)||(0,_.isObject)(e)&&0===Object.keys(e).length?{caveats:null}:{caveats:[{type:cT.SignatureOrigin,value:(0,_.hasProperty)(e,"allowSignatureOrigin")&&e.allowSignatureOrigin}]}})),dD(i,dr.targetName,_G),dD(i,_5.targetName,_G),i);dD(o={},cS.OnRpcRequest,d_.targetName),dD(o,cS.OnTransaction,dg.targetName),dD(o,cS.OnCronjob,_1.targetName),dD(o,cS.OnNameLookup,da.targetName),dD(o,cS.OnInstall,dr.targetName),dD(o,cS.OnUpdate,dr.targetName),dD(o,cS.OnKeyringRequest,_9.targetName),dD(o,cS.OnHomePage,_5.targetName),dD(o,cS.OnSignature,dm.targetName),dD(o,cS.OnUserInput,null);let dw=BigInt(4294967296-1),dA=BigInt(32),dC=(e,t,r)=>e<>>32-r,dM=(e,t,r)=>t<>>32-r,dN=(e,t,r)=>t<>>64-r,dj=(e,t,r)=>e<>>64-r,dk=[],dI=[],dO=[],dP=BigInt(0),dF=BigInt(1),dL=BigInt(2),dR=BigInt(7),dz=BigInt(256),dB=BigInt(113);for(let e=0,t=dF,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],dk.push(2*(5*n+r)),dI.push((e+1)*(e+2)/2%64);let i=dP;for(let e=0;e<7;e++)(t=(t<>dR)*dB)%dz)&dL&&(i^=dF<<(dF<>dA&dw)}:{h:0|Number(e>>dA&dw),l:0|Number(e&dw)}}(e[i],t);[r[i],n[i]]=[o,a]}return[r,n]}(dO,!0),dJ=(e,t,r)=>r>32?dN(e,t,r):dC(e,t,r),d$=(e,t,r)=>r>32?dj(e,t,r):dM(e,t,r);class dK 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=dJ(o,a,1)^r[n],l=d$(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=dI[r],o=dJ(t,i,n),a=d$(t,i,n),s=dk[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]^=dU[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 dK(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 dY=ev(()=>new dK(136,1,32));function dV(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}(dY((0,_.concatBytes)([a,dY(s)]))),[4,e7.SLIP10Node.fromDerivationPath({derivationPath:[i,"bip32:".concat(o)].concat(dH(l)),curve:"secp256k1"})];case 1:return u=c.sent().privateKey,(0,_.assert)(u,"Failed to derive the entropy."),[2,(0,_.add0x)(u)]}})})).apply(this,arguments)}function d0(e){return d1.apply(this,arguments)}function d1(){return(d1=dQ(function(e){var t,r,n,i;return dG(this,function(o){switch(o.label){case 0:return t=e.curve,r=e.secretRecoveryPhrase,n=e.path,i=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(dH(n.slice(1).map(function(e){return"".concat(i,":").concat(e)})))})];case 1:return[2,o.sent()]}})})).apply(this,arguments)}function d2(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 d3="snap_getBip32Entropy",d4=Object.freeze({targetName:d3,specificationBuilder:function(e){var t,r,n,i,o=e.methodHooks;return{permissionType:ta.PermissionType.RestrictedMethod,targetName:d3,allowedCaveats:[cT.PermittedDerivationPaths],methodImplementation:(n=o.getMnemonic,i=o.getUnlockPromise,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 _$.invalidParams({message:'Invalid "coinType" parameter. Coin type must be a non-negative integer.'});if(tx.includes(e.coinType))throw _$.invalidParams({message:"Coin type ".concat(e.coinType," is forbidden.")})}var fc=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}({},cT.PermittedCoinTypes,Object.freeze({type:cT.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 _$.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 _$.invalidParams({message:'Must specify a valid manage state "operation".'});if(void 0!==a&&"boolean"!=typeof a)throw _$.invalidParams({message:'"encrypted" parameter must be a boolean if specified.'});if(i===l.UpdateState){if(!(0,_.isObject)(o))throw _$.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 _$.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 _$.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 _$.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){fH(o,n,i,a,s,"next",e)}function s(e){fH(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 fX(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 f0="snap_notify",f1=Object.freeze({targetName:f0,specificationBuilder:function(e){var t,r,n,i,o,a,s,l=e.allowedCaveats,u=e.methodHooks;return{permissionType:ta.PermissionType.RestrictedMethod,targetName:f0,allowedCaveats:void 0===l?null:l,methodImplementation:(n=u.showNativeNotification,i=u.showInAppNotification,o=u.isOnPhishingList,a=u.maybeUpdatePhishingList,s=u.getSnap,t=function(e){var t,r,l;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 _$.invalidParams({message:'Must specify a non-empty string "message" less than 50 characters long.'});if(t===cK.InApp&&(n||r.length>=500))throw _$.invalidParams({message:'Must specify a non-empty string "message" less than 500 characters long.'});return e}(t),[4,a()];case 1:switch(u.sent(),function(e,t,r){var n=(s=o7(e,{gfm:!1}),l=[],o8(s,function(e){"link"===e.type&&l.push(e)}),l),i=!0,o=!1,a=void 0;try{for(var s,l,u,c=n[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var p=u.value;ac(p.href,t,r)}}catch(e){o=!0,a=e}finally{try{i||null==c.return||c.return()}finally{if(o)throw a}}}(l.message,o,s),l.type){case cK.Native:return[3,2];case cK.InApp:return[3,4]}return[3,6];case 2:return[4,n(r,l)];case 3:case 5:return[2,u.sent()];case 4:return[4,i(r,l)];case 6:throw _$.invalidParams({message:'Must specify a valid notification "type".'});case 7:return[2]}})},r=function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function a(e){fX(o,n,i,a,s,"next",e)}function s(e){fX(o,n,i,a,s,"throw",e)}a(void 0)})},function(e){return r.apply(this,arguments)}),subjectTypes:[ta.SubjectType.Snap]}},methodHooks:{showNativeNotification:!0,showInAppNotification:!0,isOnPhishingList:!0,maybeUpdatePhishingList:!0,getSnap:!0}});function f2(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var f3=(f2(u={},fD.targetName,fD),f2(u,d4.targetName,d4),f2(u,d7.targetName,d7),f2(u,ft.targetName,ft),f2(u,fz.targetName,fz),f2(u,fs.targetName,fs),f2(u,fZ.targetName,fZ),f2(u,f1.targetName,f1),f2(u,fQ.targetName,fQ),f2(u,fq.targetName,fq),f2(u,fK.targetName,fK),u);function f4(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]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,uD(r4)];case 1:if(n=s.sent(),i=tq(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,ub(mq,o,t)];case 2:return[2,s.sent()]}})}function mZ(e,t){return mK(this,function(r){switch(r.label){case 0:return[4,uD(rV)];case 1:return[4,ub([r.sent(),"createInterface"],e,t)];case 2:return[2,r.sent()]}})}function mX(e,t){return mK(this,function(r){switch(r.label){case 0:return[4,uD(rV)];case 1:return[4,ub([r.sent(),"getInterface"],e,t)];case 2:return[2,r.sent()]}})}function m0(e,t,r){return mK(this,function(n){switch(n.label){case 0:return[4,uD(rV)];case 1:return[4,ub([n.sent(),"updateInterface"],e,t,r)];case 2:return n.sent(),[4,ub(mX,e,t)];case 3:return[4,uh(rP(m$({id:t},n.sent())))];case 4:return n.sent(),[2]}})}function m1(e,t){return mK(this,function(r){switch(r.label){case 0:return[4,uD(rV)];case 1:return[4,ub([r.sent(),"getInterface"],e,t)];case 2:return[2,r.sent().state]}})}function m2(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 m3(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){m2(o,n,i,a,s,"next",e)}function s(e){m2(o,n,i,a,s,"throw",e)}a(void 0)})}}function m4(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),hS(this,"cache",new Map),hS(this,"validatedManifest",void 0),hS(this,"url",void 0),hS(this,"fetchFn",void 0),hS(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 hx(function(){var t,r,n,i,o;return hE(this,function(a){switch(a.label){case 0:if(e.validatedManifest)return[2,e.validatedManifest.clone()];return t=new URL(cw.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:tU(i),path:cw.Manifest,data:{canonicalPath:t}}),e.validatedManifest=o,[2,e.manifest()]}})})()}},{key:"fetch",value:function(e){var t=this;return hx(function(){var r,n,i,o,a,s,l,u,c,p,d;return hE(this,function(f){switch(f.label){case 0:if(r=tq(e),!(void 0!==(n=t.cache.get(r))))return[3,2];return i=n.file,o=n.contents,s=Uint8Array.bind,[4,o.arrayBuffer()];case 1:return a=new(s.apply(Uint8Array,[void 0,f.sent()])),(l=i.clone()).value=a,[2,l];case 2:return u=t.toCanonical(r).toString(),[4,t.fetchFn(u,t.fetchOptions)];case 3:if(!(c=f.sent()).ok)throw Error('Failed to fetch "'.concat(u,'". Status code: ').concat(c.status,"."));return p=new eO({value:"",path:r,data:{canonicalPath:u}}),[4,c.blob()];case 4:return d=f.sent(),(0,_.assert)(!t.cache.has(r),"Corrupted cache, multiple files with same path."),t.cache.set(r,{file:p,contents:d}),[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)}}],hD(r.prototype,e),t&&hD(r,t),r}();function hw(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 hA(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){hw(o,n,i,a,s,"next",e)}function s(e){hw(o,n,i,a,s,"throw",e)}a(void 0)})}}function hC(e,t,r){if(!t.has(e))throw TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function hM(e,t){var r=hC(e,t,"get");return r.get?r.get.call(e):r.value}function hN(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,hk),hk.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 hT(new URL(e.toString().slice(cA.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=hQ(function(e,t){var r,n,i,o,a,s,l;return hG(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=hQ(function(e,t){var r,n,i,o,a,s,l;return hG(this,function(u){return(r=t.sourceCode,l=hH(tB.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 hX(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=ou(e);if(null===n)return r;let i='
"}image(e,t,r){let n=ou(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 o0(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 of(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 o3;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];o3.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 oX.lex(e,t??this.defaults)}parser(e,t){return o2.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:

"+oo(r.message+"",!0)+"
";return t?Promise.resolve(e):e}if(t)return Promise.reject(r);throw r}}}let o6=new o4;function o5(e,t){return o6.parse(e,t)}o5.options=o5.setOptions=function(e){return o6.setOptions(e),o5.defaults=o6.defaults,i7=o5.defaults,o5},o5.getDefaults=i8,o5.defaults=i7,o5.use=function(...e){return o6.use(...e),o5.defaults=o6.defaults,i7=o5.defaults,o5},o5.walkTokens=function(e,t){return o6.walkTokens(e,t)},o5.parseInline=o6.parseInline,o5.Parser=o2,o5.parser=o2.parse,o5.Renderer=o0,o5.TextRenderer=o1,o5.Lexer=oX,o5.lexer=oX.lex,o5.Tokenizer=of,o5.Hooks=o3,o5.parse=o5,o5.options,o5.setOptions,o5.use;let o8=o5.walkTokens;o5.parseInline,o2.parse;let o7=oX.lex;function o9(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?as(e.tokens.flatMap(au)):e.href});case"text":return e.text;case"strong":return iZ(i2,{children:al(e.tokens)});case"em":return iZ(i3,{children:al(e.tokens)});default:return null}}function ac(e,t,r){try{var n=new URL(e);if((0,_.assert)(aa.includes(n.protocol),"Protocol must be one of: ".concat(aa.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=ae(t.href.replace("metamask://","").split("/")),i=n[0],o=n.slice(1),a="/".concat(o.join("/"));switch(i){case"client":return(0,_.assert)(at.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=ae(a.slice(0,-1)),u=l[0],c=l.slice(2);t="".concat(u,"//").concat(c.join("/")),(0,_.assert)(ar.includes(s),"".concat(r," invalid snap path."))}else t=o?"".concat(a[0],"/").concat(a[1]):a[0],(0,_.assert)(o?3===a.length&&ar.includes(s):2===a.length&&ar.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 ap(e){return(0,_.hasProperty)(e.props,"children")}function a_(e){return!!e&&!0!==e}function ad(e){if(ap(e)){if(Array.isArray(e.props.children))return e.props.children.filter(a_).flat(1/0);if(e.props.children)return[e.props.children]}return[]}function af(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=af(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=ad(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=af(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 am(e){return Object.entries(e).filter(function(e){return"children"!==ai(e,1)[0]}).sort(function(e,t){var r=ai(e,1)[0],n=ai(t,1)[0];return r.localeCompare(n)}).map(function(e){var t=ai(e,2),r=t[0],n=t[1];return" ".concat(r,"=").concat("string"==typeof n?'"'.concat(n,'"'):"{".concat(JSON.stringify(n),"}"))}).join("")}var ah=r(8261),ay=r.n(ah),ag=r(9691),ab=r.n(ag);function av(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 aA(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function aC(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)(nJ.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)(aJ,{}):(0,p.jsx)(aq,{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 ax(t);case"Form":return aD(t);case"Field":return aS(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"})}})})},aW=function(e){var t=e.snapName,r=P(rG),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"})]})},aQ=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)(aW,{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})]})]})},aH=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)(aQ,{snapName:t,snapId:r}),n]})};!function(e){e.Content="content",e.Error="error",e.Insights="insights"}(cU||(cU={}));var aG=function(e,t){switch(e){case cU.Insights:return"Insights from ".concat(t);case cU.Error:return"Error from ".concat(t);default:return"Content from ".concat(t)}},aZ=function(e){var t=e.type,r=e.snapName,n=e.children,i=t===cU.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:aG(t,r)})]}),(0,p.jsx)(j.Box,{padding:"3",children:n})]})};function aX(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r{let t=sh();sm(!0);try{let r=!1,n=sd(()=>{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=>{sm(t),e(r)},e=>{sm(t),r(e)})}};return sm(t),n}catch(e){throw sm(t),e}},sg=function(){return(0,sp.BX)(...arguments)};Object.keys(sp.BX).forEach(e=>{sg[e]=function(){return sp.BX[e](...arguments)}});let sb=sg.mouseEnter,sv=sg.mouseLeave;sg.mouseEnter=function(){return sb(...arguments),sg.mouseOver(...arguments)},sg.mouseLeave=function(){return sv(...arguments),sg.mouseOut(...arguments)};let sx=sg.pointerEnter,sD=sg.pointerLeave;sg.pointerEnter=function(){return sx(...arguments),sg.pointerOver(...arguments)},sg.pointerLeave=function(){return sD(...arguments),sg.pointerOut(...arguments)};let sS=sg.select;sg.select=(e,t)=>{sS(e,t),e.focus(),sg.keyUp(e,t)};let sE=sg.blur,sT=sg.focus;sg.blur=function(){return sg.focusOut(...arguments),sE(...arguments)},sg.focus=function(){return sg.focusIn(...arguments),sT(...arguments)},(0,sp.jQ)({unstable_advanceTimersWrapper:e=>sy(e),asyncWrapper:async e=>{let t=sh();sm(!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{sm(t)}},eventWrapper:e=>{let t;return sy(()=>{t=e()}),t}});let sw=new Set,sA=[];function sC(){sA.forEach(e=>{let{root:t,container:r}=e;sy(()=>{t.unmount()}),r.parentNode===document.body&&document.body.removeChild(r)}),sA.length=0,sw.clear()}if((void 0===s_||!s_.env?.RTL_SKIP_AUTO_CLEANUP)&&("function"==typeof afterEach?afterEach(()=>{sC()}):"function"==typeof teardown&&teardown(()=>{sC()}),"function"==typeof beforeAll&&"function"==typeof afterAll)){let e=sh();beforeAll(()=>{e=sh(),sm(!0)}),afterAll(()=>{sm(e)})}var sM=r(2629),sN=r(344),sj=r.n(sN),sk={primary:"primary",destructive:"outline"},sI=function(e){var t,r=e.node,n=e.id;iG(r),(0,_.assert)("Button"===r.type,"Expected value to be a button component.");var i=su().handleEvent,o=r.props;return(0,p.jsx)(j.Button,{width:"100%",variant:sk[null!==(t=o.variant)&&void 0!==t?t:"primary"],marginBottom:"4",type:o.type,onClick:function(e){o.type===cz.Button&&e.preventDefault(),i({event:cq.ButtonClickEvent,name:o.name})},children:o.children},"".concat(n,"-button"))},sO=function(e){var t=e.node,r=e.id,n=e.form,i=su(),o=i.handleInputChange,a=i.getValue;iG(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"))},sP={Bold:function(e){var t=e.node,r=e.id;return iG(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:sL(ad(t),r)},"".concat(r,"-text"))},Box:function(e){var t=e.node,r=e.id;return iG(t),(0,_.assert)("Box"===t.type,"Expected value to be a Box component."),(0,p.jsx)(j.Box,{children:ad(t).map(function(e,t){return(0,p.jsx)(sF,{node:e},"".concat(r,"-panel-child-").concat(t))})},r)},Button:sI,Copyable:function(e){var t=e.node,r=e.id;iG(t),(0,_.assert)("Copyable"===t.type,"Expected value to be a copyable component.");var n=t.props;return(0,p.jsx)(a0,{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;iG(t),(0,_.assert)("Field"===t.type,"Expected value to be a field component.");var i=ad(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)(sO,{id:r,node:o,form:n}),a&&(0,p.jsx)(sI,{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;iG(t),(0,_.assert)("Form"===t.type,"Expected value to be a form component.");var n=su().handleEvent,i=t.props;return(0,p.jsx)(j.Box,{as:"form",onSubmit:function(e){e.preventDefault(),n({event:cq.FormSubmitEvent,name:i.name})},children:ad(t).map(function(e,n){return(0,p.jsx)(sF,{node:e,form:t.props.name},"".concat(r,"-form-child-").concat(n))})},r)},Heading:function(e){var t=e.node,r=e.id;iG(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:sO,Italic:function(e){var t=e.node,r=e.id;return iG(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:sL(ad(t),r)},r)},Link:function(e){var t=e.node,r=e.id;iG(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:[sL(ad(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 iG(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:sL(ad(t),r)},r)},Image:function(e){var t=e.id,r=e.node;iG(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"))}},sF=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:sz(i,t),s=sP[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 sL(e,t){return e.map(function(e,r){return"string"==typeof e?(0,sM.unescape)(e):(0,p.jsx)(sF,{id:"".concat(t,"-text-child-").concat(r),node:e},"".concat(t,"-text-child-").concat(r))})}var sR=sj()(function(e){var t=e.type,r=e.props.name,n=function(e){if(!ap(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 sz(e,t){var r,n=sR(t),i=(null!==(r=e[n])&&void 0!==r?r:0)+1;return e[n]=i,"".concat(n,"_").concat(i)}var sB=function(e){var t=e.content,r=sz({},t);return(0,p.jsx)(sl,{children:(0,p.jsx)(sF,{node:t,id:r})})};function sU(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)(nR,{cursor:"pointer",onClick:function(){r(n)},children:t})},lC=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:lw.map(function(e,r){var n,i,o=e.name,a=e.transaction;return(0,f.createElement)(lA,(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 lj={chainId:"eip155:1",origin:"metamask.io",from:"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",to:"0x9f2817015caF6607C1198fB943A8241652EE8906",value:"0.01",gas:"21000",nonce:"5",maxFeePerGas:"10",maxPriorityFeePerGas:"1",data:"0x"},lk=function(){var e,t,r,n,i,o,a,s,l,u,c,_=P(lD).request,d=null!==(c=null==_?void 0:_.params)&&void 0!==c?c:{},f=d.chainId,m=d.transactionOrigin,h=d.transaction;lj.chainId,lj.origin;var y=lN(lj,["chainId","origin"]),g=(0,lt.useForm)({defaultValues:lM({chainId:null!=f?f:lj.chainId,transactionOrigin:null!=m?m:lj.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=lN(e,["chainId","transactionOrigin"]);S(rU({origin:"",handler:cS.OnTransaction,request:{jsonrpc:"2.0",method:"onTransaction",params:{chainId:t,transaction:lT(n),transactionOrigin:r}}}))}),id:"request-form",children:[(0,p.jsx)(lC,{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,lM({id:"chainId",placeholder:lj.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,lM({id:"origin",placeholder:lj.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,lM({id:"from",placeholder:lj.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,lM({id:"to",placeholder:lj.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,lM({id:"value",placeholder:lj.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,lM({id:"gas",placeholder:lj.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,lM({id:"nonce",placeholder:lj.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,lM({id:"maxFeePerGas",placeholder:lj.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,lM({id:"maxPriorityFeePerGas",placeholder:lj.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,lM({id:"data",placeholder:lj.data,fontFamily:"code"},v("data"))),(0,p.jsx)(j.FormErrorMessage,{children:null===(u=D.data)||void 0===u?void 0:u.message})]})]})},lI=(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)(r7,{}),(0,p.jsxs)(j.Flex,{direction:"row",flex:"1",overflow:"hidden",children:[(0,p.jsx)(nb,{}),(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(cS.OnRpcRequest),replace:!0})}),(0,p.jsx)(m.Route,{path:"/builder",element:(0,p.jsx)(function(){var e,t,r=sV((0,f.useState)(2),2),n=r[0],i=r[1],o=sV((0,f.useState)([{id:1,parent:0,text:"Box",droppable:!0,data:nD({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)(nq,{nextId:n,incrementId:function(){i(function(e){return e+1})}}),(0,p.jsx)(aV,{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)(sK,{items:a})}),(0,p.jsx)(j.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"0",children:(0,p.jsx)(nA,{border:"none",value:(t=(function e(t){var r=new Set;r.add(t.type);var n=ad(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),ap(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=aT(a)).join(", "),ab().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(am(o),">\n").concat(s).concat(n,"").concat(a)}return"".concat(n,"<").concat(i).concat(am(o)," />").concat(a)}(e),");\n"),{parser:"typescript",plugins:[ay()],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(r2);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)(sH,{})})})]})}),(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)(nA,{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 li(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 li(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(rZ);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)(sG,{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)(s5,{}),(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)(s6,{})})]}),(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)(s2,{})})]})]})})}),(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)(s5,{}),(0,p.jsx)(s8,{}),(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)(s7,{})}),i&&(0,p.jsx)(j.TabPanel,{overflowY:"auto","data-testid":"tab-ui",children:(0,p.jsx)(ln,{})})]})]})})]})})},{}),children:[(0,p.jsx)(m.Route,{path:"/handler/".concat(cS.OnRpcRequest),element:(0,p.jsx)(function(){return(0,p.jsx)(lc,{})},{})}),(0,p.jsx)(m.Route,{path:"/handler/".concat(cS.OnCronjob),element:(0,p.jsx)(function(){return(0,p.jsx)(lg,{})},{})}),(0,p.jsx)(m.Route,{path:"/handler/".concat(cS.OnTransaction),element:(0,p.jsx)(function(){return(0,p.jsx)(lk,{})},{})})]})]})));function lO(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:ce(e)?2:ct(e)?3:0}function u7(e,t){return 2===u8(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function u9(e,t,r){var n=u8(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function ce(e){return cX&&e instanceof Map}function ct(e){return c0&&e instanceof Set}function cr(e){return e.o||e.t}function cn(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=c8(e);delete t[c4];for(var r=c5(t),n=0;n1&&(e.set=e.add=e.clear=e.delete=co),Object.freeze(e),t&&u5(e,function(e,t){return ci(t,!0)},!0)),e}function co(){u3(2)}function ca(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function cs(e){var t=c7[e];return t||u3(18,e),t}function cl(e,t){t&&(cs("Patches"),e.u=[],e.s=[],e.v=t)}function cu(e){cc(e),e.p.forEach(c_),e.p=null}function cc(e){e===cG&&(cG=e.l)}function cp(e){return cG={p:[],l:cG,h:e,m:!0,_:0}}function c_(e){var t=e[c4];0===t.i||1===t.i?t.j():t.g=!0}function cd(e,t){t._=t.p.length;var r=t.p[0],n=void 0!==e&&e!==r;return t.h.O||cs("ES5").S(t,e,n),n?(r[c4].P&&(cu(t),u3(4)),u6(e)&&(e=cf(t,e),t.l||ch(t,e)),t.u&&cs("Patches").M(r[c4].t,e,t.u,t.s)):e=cf(t,r,[]),cu(t),t.u&&t.v(t.u,t.s),e!==c2?e:void 0}function cf(e,t,r){if(ca(t))return t;var n=t[c4];if(!n)return u5(t,function(i,o){return cm(e,n,t,i,o,r)},!0),t;if(n.A!==e)return t;if(!n.P)return ch(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var i=4===n.i||5===n.i?n.o=cn(n.k):n.o,o=i,a=!1;3===n.i&&(o=new Set(i),i.clear(),a=!0),u5(o,function(t,o){return cm(e,n,i,t,o,r,a)}),ch(e,i,!1),r&&e.u&&cs("Patches").N(n,r,e.u,e.s)}return n.o}function cm(e,t,r,n,i,o,a){if(u4(i)){var s=cf(e,i,o&&t&&3!==t.i&&!u7(t.R,n)?o.concat(n):void 0);if(u9(r,n,s),!u4(s))return;e.m=!1}else a&&r.add(i);if(u6(i)&&!ca(i)){if(!e.h.D&&e._<1)return;cf(e,i),t&&t.A.l||ch(e,i)}}function ch(e,t,r){void 0===r&&(r=!1),!e.l&&e.h.D&&e.m&&ci(t,r)}function cy(e,t){var r=e[c4];return(r?cr(r):e)[t]}function cg(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 cb(e){e.P||(e.P=!0,e.l&&cb(e.l))}function cv(e){e.o||(e.o=cn(e.t))}function cx(e,t,r){var n,i,o,a,s,l,u,c=ce(t)?cs("MapSet").F(t,r):ct(t)?cs("MapSet").T(t,r):e.O?(o=i={i:(n=Array.isArray(t))?1:0,A:r?r.A:cG,P:!1,I:!1,R:{},l:r,t:t,k:null,o:null,j:null,C:!1},a=c9,n&&(o=[i],a=pe),l=(s=Proxy.revocable(o,a)).revoke,u=s.proxy,i.k=u,i.j=l,u):cs("ES5").J(t,r);return(r?r.A:cG).p.push(c),c}function cD(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return cn(e)}!function(e){e.Insight="Insight",e.Dialog="Dialog",e.Notification="Notification",e.HomePage="HomePage"}(cQ||(cQ={}));var cS,cE,cT,cw,cA,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="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),cX="undefined"!=typeof Map,c0="undefined"!=typeof Set,c1="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,c2=cZ?Symbol.for("immer-nothing"):((cH={})["immer-nothing"]=!0,cH),c3=cZ?Symbol.for("immer-draftable"):"__$immer_draftable",c4=cZ?Symbol.for("immer-state"):"__$immer_state",c6=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),c5="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,c8=Object.getOwnPropertyDescriptors||function(e){var t={};return c5(e).forEach(function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)}),t},c7={},c9={get:function(e,t){if(t===c4)return e;var r,n,i=cr(e);if(!u7(i,t))return(n=cg(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||!u6(o)?o:o===cy(e.t,t)?(cv(e),e.o[t]=cx(e.A.h,o,e)):o},has:function(e,t){return t in cr(e)},ownKeys:function(e){return Reflect.ownKeys(cr(e))},set:function(e,t,r){var n=cg(cr(e),t);if(null==n?void 0:n.set)return n.set.call(e.k,r),!0;if(!e.P){var i=cy(cr(e),t),o=null==i?void 0:i[c4];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||u7(e.t,t)))return!0;cv(e),cb(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!==cy(e.t,t)||t in e.t?(e.R[t]=!1,cv(e),cb(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=cr(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(){u3(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){u3(12)}},pe={};u5(c9,function(e,t){pe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),pe.deleteProperty=function(e,t){return pe.set.call(this,e,t,void 0)},pe.set=function(e,t,r){return c9.set.call(this,e[0],t,r,e[0])};var pt=new(function(){function e(e){var t=this;this.O=c1,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=cs("Patches").$;return u4(e)?i(e,t):this.produce(e,function(e){return i(e,t)})},e}());pt.produce,pt.produceWithPatches.bind(pt),pt.setAutoFreeze.bind(pt),pt.setUseProxies.bind(pt),pt.applyPatches.bind(pt),pt.createDraft.bind(pt),pt.finishDraft.bind(pt);let pr=(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 pn(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 cF.Panel:return t.children.reduce(function(t,r){return t+e(r)},0);case cF.Row:return e(t.value);case cF.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 cF.Address:return iZ(i4,{address:t.value});case cF.Button:return iZ(nI,{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 cF.Copyable:return iZ(nj,{value:t.value,sensitive:t.sensitive});case cF.Divider:return iZ(nN,{});case cF.Form:return iZ(nO,{name:t.name,children:as(t.children.map(e))});case cF.Heading:return iZ(nC,{children:t.value});case cF.Image:return iZ(nk,{src:t.value});case cF.Input:return iZ(nP,{label:t.label,error:t.error,children:iZ(nF,{name:t.name,type:t.inputType,value:t.value,placeholder:t.placeholder})});case cF.Panel:return iZ(nD,{children:as(t.children.map(e))});case cF.Row:return iZ(i6,{label:t.label,variant:t.variant,children:e(t.value)});case cF.Spinner:return iZ(i5,{});case cF.Text:var r,n;return iZ(nM,{children:as((r=o7(t.value,{gfm:!1}),n=[],o8(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 an(e)}(t=r.flatMap(au))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||ao(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 pi(e,t){(0,_.assert)(void 0===e[t],'Duplicate component names are not allowed, found multiple instances of: "'.concat(t,'".'))}function po(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=ad(e)[0])||void 0===t?void 0:t.props.value;case"RadioGroup":return null===(r=ad(e)[0])||void 0===r?void 0:r.props.value;case"Selector":return null===(n=ad(e)[0])||void 0===n?void 0:n.props.value;case"Checkbox":return!1;default:return null}}(t))&&void 0!==o?o:null}function pa(e,t){var r={},n=[];return af(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){pi(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];pi(a,t.props.name),a[t.props.name]=po(e,t,o.name);return}("Input"===t.type||"Dropdown"===t.type||"RadioGroup"===t.type||"FileInput"===t.type||"Checkbox"===t.type||"Selector"===t.type)&&(pi(r,t.props.name),r[t.props.name]=po(e,t))}),r}function ps(e){if(e){var t=e8(e);(0,_.assert)(t<=1e6,"A Snap interface context may not be larger than ".concat(1," MB."))}}function pl(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 pX(e){return Object.getOwnPropertyNames(e).reduce((t,r)=>{let n=e[r];return(0,_.isValidJson)(n)&&(t[r]=n),t},{})}pZ(pG);let p0=function(e){return e?.__esModule?e.default:e}(pW());class p1 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)?pX(e):null):(0,_.isObject)(e)?pX(e):(0,_.isValidJson)(e)?e:null)),this.stack&&(t.stack=this.stack),t}toString(){return p0(this.serialize(),p3,2)}}class p2 extends p1{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 p3(e,t){if("[Circular]"!==t)return t}function p4(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()}}],p7(r.prototype,e),t&&p7(r,t),r}();function _e(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 _t(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){_e(o,n,i,a,s,"next",e)}function s(e){_e(o,n,i,a,s,"throw",e)}a(void 0)})}}function _r(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]_Y(pQ.rpc.parse,e),invalidRequest:e=>_Y(pQ.rpc.invalidRequest,e),invalidParams:e=>_Y(pQ.rpc.invalidParams,e),methodNotFound:e=>_Y(pQ.rpc.methodNotFound,e),internal:e=>_Y(pQ.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 _Y(t,e)},invalidInput:e=>_Y(pQ.rpc.invalidInput,e),resourceNotFound:e=>_Y(pQ.rpc.resourceNotFound,e),resourceUnavailable:e=>_Y(pQ.rpc.resourceUnavailable,e),transactionRejected:e=>_Y(pQ.rpc.transactionRejected,e),methodNotSupported:e=>_Y(pQ.rpc.methodNotSupported,e),limitExceeded:e=>_Y(pQ.rpc.limitExceeded,e)},_K={userRejectedRequest:e=>_V(pQ.provider.userRejectedRequest,e),unauthorized:e=>_V(pQ.provider.unauthorized,e),unsupportedMethod:e=>_V(pQ.provider.unsupportedMethod,e),disconnected:e=>_V(pQ.provider.disconnected,e),chainDisconnected:e=>_V(pQ.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 p2(t,r,n)}};function _Y(e,t){let[r,n]=_W(t);return new p1(e,r??pZ(e),n)}function _V(e,t){let[r,n]=_W(t);return new p2(e,r??pZ(e),n)}function _W(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 _Q(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}})),dD(i,_9.targetName,_Z(function(e){return{caveats:[{type:cT.KeyringOrigin,value:e}]}})),dD(i,dm.targetName,_Z(function(e){return!e||!(0,_.isObject)(e)||(0,_.isObject)(e)&&0===Object.keys(e).length?{caveats:null}:{caveats:[{type:cT.SignatureOrigin,value:(0,_.hasProperty)(e,"allowSignatureOrigin")&&e.allowSignatureOrigin}]}})),dD(i,dr.targetName,_G),dD(i,_5.targetName,_G),i);dD(o={},cS.OnRpcRequest,d_.targetName),dD(o,cS.OnTransaction,dg.targetName),dD(o,cS.OnCronjob,_1.targetName),dD(o,cS.OnNameLookup,da.targetName),dD(o,cS.OnInstall,dr.targetName),dD(o,cS.OnUpdate,dr.targetName),dD(o,cS.OnKeyringRequest,_9.targetName),dD(o,cS.OnHomePage,_5.targetName),dD(o,cS.OnSignature,dm.targetName),dD(o,cS.OnUserInput,null);let dw=BigInt(4294967296-1),dA=BigInt(32),dC=(e,t,r)=>e<>>32-r,dM=(e,t,r)=>t<>>32-r,dN=(e,t,r)=>t<>>64-r,dj=(e,t,r)=>e<>>64-r,dk=[],dI=[],dO=[],dP=BigInt(0),dF=BigInt(1),dL=BigInt(2),dR=BigInt(7),dz=BigInt(256),dB=BigInt(113);for(let e=0,t=dF,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],dk.push(2*(5*n+r)),dI.push((e+1)*(e+2)/2%64);let i=dP;for(let e=0;e<7;e++)(t=(t<>dR)*dB)%dz)&dL&&(i^=dF<<(dF<>dA&dw)}:{h:0|Number(e>>dA&dw),l:0|Number(e&dw)}}(e[i],t);[r[i],n[i]]=[o,a]}return[r,n]}(dO,!0),dJ=(e,t,r)=>r>32?dN(e,t,r):dC(e,t,r),d$=(e,t,r)=>r>32?dj(e,t,r):dM(e,t,r);class dK 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=dJ(o,a,1)^r[n],l=d$(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=dI[r],o=dJ(t,i,n),a=d$(t,i,n),s=dk[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]^=dU[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 dK(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 dY=ev(()=>new dK(136,1,32));function dV(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}(dY((0,_.concatBytes)([a,dY(s)]))),[4,e7.SLIP10Node.fromDerivationPath({derivationPath:[i,"bip32:".concat(o)].concat(dH(l)),curve:"secp256k1"})];case 1:return u=c.sent().privateKey,(0,_.assert)(u,"Failed to derive the entropy."),[2,(0,_.add0x)(u)]}})})).apply(this,arguments)}function d0(e){return d1.apply(this,arguments)}function d1(){return(d1=dQ(function(e){var t,r,n,i;return dG(this,function(o){switch(o.label){case 0:return t=e.curve,r=e.secretRecoveryPhrase,n=e.path,i=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(dH(n.slice(1).map(function(e){return"".concat(i,":").concat(e)})))})];case 1:return[2,o.sent()]}})})).apply(this,arguments)}function d2(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 d3="snap_getBip32Entropy",d4=Object.freeze({targetName:d3,specificationBuilder:function(e){var t,r,n,i,o=e.methodHooks;return{permissionType:ta.PermissionType.RestrictedMethod,targetName:d3,allowedCaveats:[cT.PermittedDerivationPaths],methodImplementation:(n=o.getMnemonic,i=o.getUnlockPromise,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 _$.invalidParams({message:'Invalid "coinType" parameter. Coin type must be a non-negative integer.'});if(tx.includes(e.coinType))throw _$.invalidParams({message:"Coin type ".concat(e.coinType," is forbidden.")})}var fc=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}({},cT.PermittedCoinTypes,Object.freeze({type:cT.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 _$.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 _$.invalidParams({message:'Must specify a valid manage state "operation".'});if(void 0!==a&&"boolean"!=typeof a)throw _$.invalidParams({message:'"encrypted" parameter must be a boolean if specified.'});if(i===l.UpdateState){if(!(0,_.isObject)(o))throw _$.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 _$.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 _$.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 _$.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){fH(o,n,i,a,s,"next",e)}function s(e){fH(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 fX(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 f0="snap_notify",f1=Object.freeze({targetName:f0,specificationBuilder:function(e){var t,r,n,i,o,a,s,l=e.allowedCaveats,u=e.methodHooks;return{permissionType:ta.PermissionType.RestrictedMethod,targetName:f0,allowedCaveats:void 0===l?null:l,methodImplementation:(n=u.showNativeNotification,i=u.showInAppNotification,o=u.isOnPhishingList,a=u.maybeUpdatePhishingList,s=u.getSnap,t=function(e){var t,r,l;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 _$.invalidParams({message:'Must specify a non-empty string "message" less than 50 characters long.'});if(t===cK.InApp&&(n||r.length>=500))throw _$.invalidParams({message:'Must specify a non-empty string "message" less than 500 characters long.'});return e}(t),[4,a()];case 1:switch(u.sent(),function(e,t,r){var n=(s=o7(e,{gfm:!1}),l=[],o8(s,function(e){"link"===e.type&&l.push(e)}),l),i=!0,o=!1,a=void 0;try{for(var s,l,u,c=n[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var p=u.value;ac(p.href,t,r)}}catch(e){o=!0,a=e}finally{try{i||null==c.return||c.return()}finally{if(o)throw a}}}(l.message,o,s),l.type){case cK.Native:return[3,2];case cK.InApp:return[3,4]}return[3,6];case 2:return[4,n(r,l)];case 3:case 5:return[2,u.sent()];case 4:return[4,i(r,l)];case 6:throw _$.invalidParams({message:'Must specify a valid notification "type".'});case 7:return[2]}})},r=function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function a(e){fX(o,n,i,a,s,"next",e)}function s(e){fX(o,n,i,a,s,"throw",e)}a(void 0)})},function(e){return r.apply(this,arguments)}),subjectTypes:[ta.SubjectType.Snap]}},methodHooks:{showNativeNotification:!0,showInAppNotification:!0,isOnPhishingList:!0,maybeUpdatePhishingList:!0,getSnap:!0}});function f2(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var f3=(f2(u={},fD.targetName,fD),f2(u,d4.targetName,d4),f2(u,d7.targetName,d7),f2(u,ft.targetName,ft),f2(u,fz.targetName,fz),f2(u,fs.targetName,fs),f2(u,fZ.targetName,fZ),f2(u,f1.targetName,f1),f2(u,fQ.targetName,fQ),f2(u,fq.targetName,fq),f2(u,fK.targetName,fK),u);function f4(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]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,uD(r4)];case 1:if(n=s.sent(),i=tq(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,ub(mq,o,t)];case 2:return[2,s.sent()]}})}function mZ(e,t){return mK(this,function(r){switch(r.label){case 0:return[4,uD(rV)];case 1:return[4,ub([r.sent(),"createInterface"],e,t)];case 2:return[2,r.sent()]}})}function mX(e,t){return mK(this,function(r){switch(r.label){case 0:return[4,uD(rV)];case 1:return[4,ub([r.sent(),"getInterface"],e,t)];case 2:return[2,r.sent()]}})}function m0(e,t,r){return mK(this,function(n){switch(n.label){case 0:return[4,uD(rV)];case 1:return[4,ub([n.sent(),"updateInterface"],e,t,r)];case 2:return n.sent(),[4,ub(mX,e,t)];case 3:return[4,uh(rP(m$({id:t},n.sent())))];case 4:return n.sent(),[2]}})}function m1(e,t){return mK(this,function(r){switch(r.label){case 0:return[4,uD(rV)];case 1:return[4,ub([r.sent(),"getInterface"],e,t)];case 2:return[2,r.sent().state]}})}function m2(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 m3(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){m2(o,n,i,a,s,"next",e)}function s(e){m2(o,n,i,a,s,"throw",e)}a(void 0)})}}function m4(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),hS(this,"cache",new Map),hS(this,"validatedManifest",void 0),hS(this,"url",void 0),hS(this,"fetchFn",void 0),hS(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 hx(function(){var t,r,n,i,o;return hE(this,function(a){switch(a.label){case 0:if(e.validatedManifest)return[2,e.validatedManifest.clone()];return t=new URL(cw.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:tU(i),path:cw.Manifest,data:{canonicalPath:t}}),e.validatedManifest=o,[2,e.manifest()]}})})()}},{key:"fetch",value:function(e){var t=this;return hx(function(){var r,n,i,o,a,s;return hE(this,function(l){switch(l.label){case 0:if(r=tq(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)}}],hD(r.prototype,e),t&&hD(r,t),r}();function hw(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 hA(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){hw(o,n,i,a,s,"next",e)}function s(e){hw(o,n,i,a,s,"throw",e)}a(void 0)})}}function hC(e,t,r){if(!t.has(e))throw TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function hM(e,t){var r=hC(e,t,"get");return r.get?r.get.call(e):r.value}function hN(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,hk),hk.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 hT(new URL(e.toString().slice(cA.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=hQ(function(e,t){var r,n,i,o,a,s,l;return hG(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=hQ(function(e,t){var r,n,i,o,a,s,l;return hG(this,function(u){return(r=t.sourceCode,l=hH(tB.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 hX(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]