diff --git a/snaps-simulator/staging/main.js b/snaps-simulator/staging/main.js
index 421835aad5..21b8ceee5a 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"}tablerow(e){return`
${e}
`}tablecell(e,t){let r=t.header?"th":"td",n=t.align?`<${r} align="${t.align}">`:`<${r}>`;return n+e+`${r}>
-`}strong(e){return`${e}`}em(e){return`${e}`}codespan(e){return`${e}
`}br(){return"
"}del(e){return`${e}`}link(e,t,r){let n=oo(e);if(null===n)return r;let i='"+r+""}image(e,t,r){let n=oo(e);if(null===n)return r;let i=`"}text(e){return e}}class oG{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,r){return""+r}image(e,t,r){return""+r}br(){return""}}class oZ{options;renderer;textRenderer;constructor(e){this.options=e||i4,this.options.renderer=this.options.renderer||new oH,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new oG}static parse(e,t){let r=new oZ(t);return r.parse(e)}static parseInline(e,t){let r=new oZ(t);return r.parseInline(e)}parse(e,t=!0){let r="";for(let n=0;n"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 oH(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 oc(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 oX;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];oX.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 oQ.lex(e,t??this.defaults)}parser(e,t){return oZ.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:
"+ot(r.message+"",!0)+"
";return t?Promise.resolve(e):e}if(t)return Promise.reject(r);throw r}}}let o1=new o0;function o2(e,t){return o1.parse(e,t)}o2.options=o2.setOptions=function(e){return o1.setOptions(e),o2.defaults=o1.defaults,i4=o2.defaults,o2},o2.getDefaults=i3,o2.defaults=i4,o2.use=function(...e){return o1.use(...e),o2.defaults=o1.defaults,i4=o2.defaults,o2},o2.walkTokens=function(e,t){return o1.walkTokens(e,t)},o2.parseInline=o1.parseInline,o2.Parser=oZ,o2.parser=oZ.parse,o2.Renderer=oH,o2.TextRenderer=oG,o2.Lexer=oQ,o2.lexer=oQ.lex,o2.Tokenizer=oc,o2.Hooks=oX,o2.parse=o2,o2.options,o2.setOptions,o2.use;let o3=o2.walkTokens;o2.parseInline,oZ.parse;let o4=oQ.lex;function o6(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r0?o9(e.tokens.flatMap(at)):e.href});case"text":return e.text;case"strong":return iW(iZ,{children:ae(e.tokens)});case"em":return iW(iX,{children:ae(e.tokens)});default:return null}}function ar(e,t){try{var r=new URL(e);(0,d.assert)(o7.includes(r.protocol),"Protocol must be one of: ".concat(o7.join(", "),"."));var n="mailto:"===r.protocol?r.pathname.split("@")[1]:r.hostname;(0,d.assert)(!t(n),"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 an(e){return(0,d.hasProperty)(e.props,"children")}function ai(e){return!!e&&!0!==e}function ao(e){if(an(e)){if(Array.isArray(e.props.children))return e.props.children.filter(ai).flat(1/0);if(e.props.children)return[e.props.children]}return[]}function aa(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=aa(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,d.hasProperty)(e,"props")&&(0,d.isPlainObject)(e.props)&&(0,d.hasProperty)(e.props,"children")){var p=ao(e),_=!0,f=!1,m=void 0;try{for(var h,y=p[Symbol.iterator]();!(_=(h=y.next()).done);_=!0){var g=h.value;if((0,d.isPlainObject)(g)){var b=aa(g,t,r+1);if(void 0!==b)return b}}}catch(e){f=!0,m=e}finally{try{_||null==y.return||y.return()}finally{if(f)throw m}}}}function as(e){return Object.entries(e).filter(function(e){return"children"!==o5(e,1)[0]}).sort(function(e,t){var r=o5(e,1)[0],n=o5(t,1)[0];return r.localeCompare(n)}).map(function(e){var t=o5(e,2),r=t[0],n=t[1];return" ".concat(r,"=").concat("string"==typeof n?'"'.concat(n,'"'):"{".concat(JSON.stringify(n),"}"))}).join("")}var al=r(8261),au=r.n(al),ac=r(9691),ap=r.n(ac);function a_(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r1?"move":"default",children:[(0,_.jsx)(P,{icon:r.data.type.toLowerCase(),width:"16px"}),(0,_.jsx)(k.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,_.jsx)(P,{icon:"cross",width:"11px",marginX:"0.5",marginLeft:"auto",cursor:"pointer",onClick:function(){null==o||o(r)}})]})};function ab(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function av(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,_.jsx)(n$.Tree,{ref:n,tree:t,rootId:0,render:function(e,r){var n=r.depth,a=r.isDragging;return t.length<=1?(0,_.jsx)(aP,{}):(0,_.jsx)(aO,{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 ad(t);case"Form":return af(t);case"Field":return am(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,_.jsx)(k.Box,{width:"100%",height:"20px"})}})})},aB=function(e){var t=e.snapName,r=F(rZ),n=r&&new Blob([r.value],{type:"image/svg+xml"}),i=n&&URL.createObjectURL(n);return(0,_.jsxs)(k.Box,{position:"relative",children:[(0,_.jsx)(k.Avatar,{src:i,name:t.slice(0,1).toUpperCase(),fontSize:"md",background:"background.alternative",color:"text.alternative",size:"sm",margin:"1"}),(0,_.jsx)(P,{icon:"snap",width:"16px",height:"16px",position:"absolute",bottom:"0px",right:"0px"})]})},aU=function(e){var t=e.snapName,r=e.snapId;return(0,_.jsxs)(k.Flex,{gap:"2",marginX:"4",marginY:"4",border:"1px solid",borderColor:"border.default",borderRadius:"32px",padding:"1",alignItems:"center",children:[(0,_.jsx)(aB,{snapName:t}),(0,_.jsxs)(k.Flex,{direction:"column",justify:"center",children:[(0,_.jsx)(k.Text,{fontSize:"sm",lineHeight:"157%",fontFamily:"custom",children:t}),(0,_.jsx)(k.Text,{fontSize:"xs",lineHeight:"167%",fontFamily:"custom",color:"text.alternative",children:r})]})]})},aq=function(e){var t=e.snapName,r=e.snapId,n=e.children,i=e.showAuthorship;return(0,_.jsxs)(k.Flex,{direction:"column",boxShadow:"lg",maxWidth:"360px",height:"600px",paddingY:"4",overflowY:"scroll",children:[(void 0===i||i)&&(0,_.jsx)(aU,{snapName:t,snapId:r}),n]})};!function(e){e.Content="content",e.Error="error",e.Insights="insights"}(cm||(cm={}));var aJ=function(e,t){switch(e){case cm.Insights:return"Insights from ".concat(t);case cm.Error:return"Error from ".concat(t);default:return"Content from ".concat(t)}},a$=function(e){var t=e.type,r=e.snapName,n=e.children,i=t===cm.Error;return(0,_.jsxs)(k.Box,{border:"1px solid",borderColor:"border.default",borderRadius:"md",backgroundColor:i?"error.muted":void 0,children:[(0,_.jsxs)(k.Flex,{direction:"row",alignItems:"center",padding:"1.5",borderBottom:"1px solid",borderColor:"border.default",children:[(0,_.jsx)(P,{icon:i?"snapError":"snap",width:"16px",marginRight:"1"}),(0,_.jsx)(k.Text,{fontFamily:"custom",fontSize:"xs",color:i?"text.error":void 0,children:aJ(t,r)})]}),(0,_.jsx)(k.Box,{padding:"3",children:n})]})};function aK(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r{let t=sl();ss(!0);try{let r=!1,n=so(()=>{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=>{ss(t),e(r)},e=>{ss(t),r(e)})}};return ss(t),n}catch(e){throw ss(t),e}},sc=function(){return(0,sn.BX)(...arguments)};Object.keys(sn.BX).forEach(e=>{sc[e]=function(){return sn.BX[e](...arguments)}});let sp=sc.mouseEnter,s_=sc.mouseLeave;sc.mouseEnter=function(){return sp(...arguments),sc.mouseOver(...arguments)},sc.mouseLeave=function(){return s_(...arguments),sc.mouseOut(...arguments)};let sd=sc.pointerEnter,sf=sc.pointerLeave;sc.pointerEnter=function(){return sd(...arguments),sc.pointerOver(...arguments)},sc.pointerLeave=function(){return sf(...arguments),sc.pointerOut(...arguments)};let sm=sc.select;sc.select=(e,t)=>{sm(e,t),e.focus(),sc.keyUp(e,t)};let sh=sc.blur,sy=sc.focus;sc.blur=function(){return sc.focusOut(...arguments),sh(...arguments)},sc.focus=function(){return sc.focusIn(...arguments),sy(...arguments)},(0,sn.jQ)({unstable_advanceTimersWrapper:e=>su(e),asyncWrapper:async e=>{let t=sl();ss(!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{ss(t)}},eventWrapper:e=>{let t;return su(()=>{t=e()}),t}});let sg=new Set,sb=[];function sv(){sb.forEach(e=>{let{root:t,container:r}=e;su(()=>{t.unmount()}),r.parentNode===document.body&&document.body.removeChild(r)}),sb.length=0,sg.clear()}if((void 0===si||!si.env?.RTL_SKIP_AUTO_CLEANUP)&&("function"==typeof afterEach?afterEach(()=>{sv()}):"function"==typeof teardown&&teardown(()=>{sv()}),"function"==typeof beforeAll&&"function"==typeof afterAll)){let e=sl();beforeAll(()=>{e=sl(),ss(!0)}),afterAll(()=>{ss(e)})}var sx=r(3151),sD=r(966),sS=r.n(sD),sE={primary:"primary",destructive:"outline"},sT=function(e){var t,r=e.node,n=e.id;iV(r),(0,d.assert)("Button"===r.type,"Expected value to be a button component.");var i=st().handleEvent,o=r.props;return(0,_.jsx)(k.Button,{width:"100%",variant:sE[null!==(t=o.variant)&&void 0!==t?t:"primary"],marginBottom:"4",type:o.type,onClick:function(e){o.type===cd.Button&&e.preventDefault(),i({event:ch.ButtonClickEvent,name:o.name})},children:o.children},"".concat(n,"-button"))},sw=function(e){var t=e.node,r=e.id,n=e.form,i=st(),o=i.handleInputChange,a=i.getValue;iV(t),(0,d.assert)("Input"===t.type,"Expected value to be an input component.");var s=t.props,l=a(s.name,n);return(0,_.jsx)(k.Input,{value:l,type:s.type,placeholder:s.placeholder,onChange:function(e){o(s.name,e.target.value,n)}},"".concat(r,"-input"))},sA={Bold:function(e){var t=e.node,r=e.id;return iV(t),(0,d.assert)("Bold"===t.type,"Expected value to be a bold component."),(0,_.jsx)(k.Text,{fontFamily:"custom",fontSize:"sm",paddingBottom:"1",as:"b",children:sM(ao(t),r)},"".concat(r,"-text"))},Box:function(e){var t=e.node,r=e.id;return iV(t),(0,d.assert)("Box"===t.type,"Expected value to be a Box component."),(0,_.jsx)(k.Box,{children:ao(t).map(function(e,t){return(0,_.jsx)(sC,{node:e},"".concat(r,"-panel-child-").concat(t))})},r)},Button:sT,Copyable:function(e){var t=e.node,r=e.id;iV(t),(0,d.assert)("Copyable"===t.type,"Expected value to be a copyable component.");var n=t.props;return(0,_.jsx)(aY,{value:n.value},"".concat(r,"-copyable"))},Divider:function(e){var t=e.id;return(0,_.jsx)(k.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;iV(t),(0,d.assert)("Field"===t.type,"Expected value to be a field component.");var i=ao(t),o=i[0],a=i[1],s=t.props;return(0,_.jsxs)(k.FormControl,{isInvalid:!!s.error,children:[s.label&&(0,_.jsx)(k.FormLabel,{children:s.label}),(0,_.jsx)(sw,{id:r,node:o,form:n}),a&&(0,_.jsx)(sT,{id:r,node:a}),(0,_.jsx)(k.FormErrorMessage,{children:s.error})]},"".concat(r,"-field"))},Form:function(e){var t=e.node,r=e.id;iV(t),(0,d.assert)("Form"===t.type,"Expected value to be a form component.");var n=st().handleEvent,i=t.props;return(0,_.jsx)(k.Box,{as:"form",onSubmit:function(e){e.preventDefault(),n({event:ch.FormSubmitEvent,name:i.name})},children:ao(t).map(function(e,n){return(0,_.jsx)(sC,{node:e,form:t.props.name},"".concat(r,"-form-child-").concat(n))})},r)},Heading:function(e){var t=e.node,r=e.id;iV(t),(0,d.assert)("Heading"===t.type,"Expected value to be a heading component.");var n=t.props;return(0,_.jsx)(k.Heading,{fontFamily:"custom",fontSize:"x-large",fontWeight:"bold",paddingBottom:"4",children:n.children},"".concat(r,"-heading"))},Input:sw,Italic:function(e){var t=e.node,r=e.id;return iV(t),(0,d.assert)("Italic"===t.type,"Expected value to be an italic component."),(0,_.jsx)(k.Text,{fontFamily:"custom",fontSize:"sm",paddingBottom:"1",as:"i",children:sM(ao(t),r)},r)},Link:function(e){var t=e.node,r=e.id;iV(t),(0,d.assert)("Link"===t.type,"Expected value to be a link component.");var n=t.props;return(0,_.jsxs)(k.Link,{href:n.href,target:"_blank",fontFamily:"custom",fontSize:"sm",isExternal:!0,color:"link.default",display:"inline",children:[sM(ao(t),r),(0,_.jsx)(P,{icon:"linkOut",width:"14px",marginLeft:"2px",display:"inline",verticalAlign:"middle"})]})},Spinner:function(e){var t=e.id;return(0,_.jsx)(k.Spinner,{},"".concat(t,"-spinner"))},Text:function(e){var t=e.node,r=e.id;return iV(t),(0,d.assert)("Text"===t.type,"Expected value to be a text component."),(0,_.jsx)(k.Text,{fontFamily:"custom",fontSize:"sm",paddingBottom:"1",children:sM(ao(t),r)},r)},Image:function(e){var t=e.id,r=e.node;iV(r),(0,d.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,_.jsx)(k.Image,{src:i,alt:n.alt},"".concat(t,"-image"))}},sC=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:sj(i,t),s=sA[t.type];if(!s)throw Error("Unknown component type: ".concat(t.type,"."));return(0,_.jsx)(s,{id:a,node:t,form:r},a)};function sM(e,t){return e.map(function(e,r){return"string"==typeof e?(0,sx.unescape)(e):(0,_.jsx)(sC,{id:"".concat(t,"-text-child-").concat(r),node:e},"".concat(t,"-text-child-").concat(r))})}var sN=sS()(function(e){var t=e.type,r=e.props.name,n=function(e){if(!an(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,d.remove0x)((0,d.bytesToHex)(eM(JSON.stringify({type:t,name:null!=r?r:null,children:n}))))});function sj(e,t){var r,n=sN(t),i=(null!==(r=e[n])&&void 0!==r?r:0)+1;return e[n]=i,"".concat(n,"_").concat(i)}var sk=function(e){var t=e.content,r=sj({},t);return(0,_.jsx)(se,{children:(0,_.jsx)(sC,{node:t,id:r})})};function sI(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,_.jsx)(nz,{cursor:"pointer",onClick:function(){r(n)},children:t})},lv=function(e){var t=e.onClick;return(0,_.jsxs)(k.Box,{marginBottom:"4",children:[(0,_.jsx)(k.Text,{fontWeight:"500",fontSize:"xs",marginBottom:"1",children:"Transaction presets"}),(0,_.jsx)(k.Flex,{gap:"2",children:lg.map(function(e,r){var n,i,o=e.name,a=e.transaction;return(0,m.createElement)(lb,(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 lS={chainId:"eip155:1",origin:"metamask.io",from:"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",to:"0x9f2817015caF6607C1198fB943A8241652EE8906",value:"0.01",gas:"21000",nonce:"5",maxFeePerGas:"10",maxPriorityFeePerGas:"1",data:"0x"},lE=function(){var e,t,r,n,i,o,a,s,l,u,c,p=F(lf).request,d=null!==(c=null==p?void 0:p.params)&&void 0!==c?c:{},f=d.chainId,m=d.transactionOrigin,h=d.transaction;lS.chainId,lS.origin;var y=lD(lS,["chainId","origin"]),g=(0,s3.useForm)({defaultValues:lx({chainId:null!=f?f:lS.chainId,transactionOrigin:null!=m?m:lS.origin},null!=h?h:y)}),b=g.handleSubmit,v=g.register,x=g.setValue,D=g.formState.errors,S=j();return(0,_.jsxs)(k.Flex,{as:"form",flexDirection:"column",flex:"1",onSubmit:b(function(e){var t=e.chainId,r=e.transactionOrigin,n=lD(e,["chainId","transactionOrigin"]);S(rq({origin:"",handler:u8.OnTransaction,request:{jsonrpc:"2.0",method:"onTransaction",params:{chainId:t,transaction:ly(n),transactionOrigin:r}}}))}),id:"request-form",children:[(0,_.jsx)(lv,{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,_.jsxs)(k.Flex,{gap:"2",children:[(0,_.jsxs)(k.FormControl,{isInvalid:!!D.chainId,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"chainId",children:"Chain ID"}),(0,_.jsx)(k.Input,lx({id:"chainId",placeholder:lS.chainId,fontFamily:"code"},v("chainId"))),(0,_.jsx)(k.FormErrorMessage,{children:null===(e=D.chainId)||void 0===e?void 0:e.message})]}),(0,_.jsxs)(k.FormControl,{isInvalid:!!D.transactionOrigin,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"origin",children:"Transaction Origin"}),(0,_.jsx)(k.Input,lx({id:"origin",placeholder:lS.origin,fontFamily:"code"},v("transactionOrigin"))),(0,_.jsx)(k.FormErrorMessage,{children:null===(t=D.transactionOrigin)||void 0===t?void 0:t.message})]})]}),(0,_.jsxs)(k.FormControl,{isInvalid:!!D.from,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"from",children:"From Address"}),(0,_.jsx)(k.Input,lx({id:"from",placeholder:lS.from,fontFamily:"code"},v("from"))),(0,_.jsx)(k.FormErrorMessage,{children:null===(r=D.from)||void 0===r?void 0:r.message})]}),(0,_.jsxs)(k.FormControl,{isInvalid:!!D.to,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"to",children:"To Address"}),(0,_.jsx)(k.Input,lx({id:"to",placeholder:lS.to,fontFamily:"code"},v("to"))),(0,_.jsx)(k.FormErrorMessage,{children:null===(n=D.to)||void 0===n?void 0:n.message})]}),(0,_.jsxs)(k.FormControl,{isInvalid:!!D.value,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"value",children:"Value"}),(0,_.jsxs)(k.InputGroup,{children:[(0,_.jsx)(k.Input,lx({id:"value",placeholder:lS.value,fontFamily:"code"},v("value"))),(0,_.jsx)(k.InputRightAddon,{children:"ETH",fontSize:"sm"})]}),(0,_.jsx)(k.FormErrorMessage,{children:null===(i=D.value)||void 0===i?void 0:i.message})]}),(0,_.jsxs)(k.Flex,{gap:"2",children:[(0,_.jsxs)(k.FormControl,{isInvalid:!!D.gas,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"gas",children:"Gas Limit"}),(0,_.jsx)(k.Input,lx({id:"gas",placeholder:lS.gas,fontFamily:"code"},v("gas"))),(0,_.jsx)(k.FormErrorMessage,{children:null===(o=D.gas)||void 0===o?void 0:o.message})]}),(0,_.jsxs)(k.FormControl,{isInvalid:!!D.nonce,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"nonce",children:"Nonce"}),(0,_.jsx)(k.Input,lx({id:"nonce",placeholder:lS.nonce,fontFamily:"code"},v("nonce"))),(0,_.jsx)(k.FormErrorMessage,{children:null===(a=D.nonce)||void 0===a?void 0:a.message})]})]}),(0,_.jsxs)(k.Flex,{gap:"2",children:[(0,_.jsxs)(k.FormControl,{isInvalid:!!D.maxFeePerGas,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"maxFeePerGas",children:"Max Fee Per Gas"}),(0,_.jsxs)(k.InputGroup,{children:[(0,_.jsx)(k.Input,lx({id:"maxFeePerGas",placeholder:lS.maxFeePerGas,fontFamily:"code"},v("maxFeePerGas"))),(0,_.jsx)(k.InputRightAddon,{children:"GWEI",fontSize:"sm"})]}),(0,_.jsx)(k.FormErrorMessage,{children:null===(s=D.maxFeePerGas)||void 0===s?void 0:s.message})]}),(0,_.jsxs)(k.FormControl,{isInvalid:!!D.maxPriorityFeePerGas,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"maxPriorityFeePerGas",children:"Max Priority Fee Per Gas"}),(0,_.jsxs)(k.InputGroup,{children:[(0,_.jsx)(k.Input,lx({id:"maxPriorityFeePerGas",placeholder:lS.maxPriorityFeePerGas,fontFamily:"code"},v("maxPriorityFeePerGas"))),(0,_.jsx)(k.InputRightAddon,{children:"GWEI",fontSize:"sm"})]}),(0,_.jsx)(k.FormErrorMessage,{children:null===(l=D.maxPriorityFeePerGas)||void 0===l?void 0:l.message})]})]}),(0,_.jsxs)(k.FormControl,{isInvalid:!!D.data,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"data",children:"Data"}),(0,_.jsx)(k.Textarea,lx({id:"data",placeholder:lS.data,fontFamily:"code"},v("data"))),(0,_.jsx)(k.FormErrorMessage,{children:null===(u=D.data)||void 0===u?void 0:u.message})]})]})},lT=(0,h.createHashRouter)((0,h.createRoutesFromElements)((0,_.jsxs)(h.Route,{element:(0,_.jsx)(function(){return(0,_.jsxs)(k.Flex,{direction:"column",height:"100vh",children:[(0,_.jsx)(r9,{}),(0,_.jsxs)(k.Flex,{direction:"row",flex:"1",overflow:"hidden",children:[(0,_.jsx)(nv,{}),(0,_.jsxs)(k.Flex,{direction:"column",width:"full",children:[(0,_.jsx)(k.Flex,{flex:"1",overflow:"hidden",children:(0,_.jsx)(h.Outlet,{})}),(0,_.jsx)(Y,{})]})]})]})},{}),children:[(0,_.jsx)(h.Route,{path:"/",element:(0,_.jsx)(h.Navigate,{to:"/handler/".concat(u8.OnRpcRequest),replace:!0})}),(0,_.jsx)(h.Route,{path:"/builder",element:(0,_.jsx)(function(){var e,t,r=sz((0,m.useState)(2),2),n=r[0],i=r[1],o=sz((0,m.useState)([{id:1,parent:0,text:"Box",droppable:!0,data:nS({children:null})}]),2),a=o[0],s=o[1];return(0,_.jsx)(k.Flex,{width:"100%",direction:"column",overflow:"hidden",children:(0,_.jsxs)(k.Flex,{direction:"row",flex:"1",overflow:"hidden",children:[(0,_.jsx)(k.Flex,{direction:"column",flex:"1",width:"50%",overflow:"hidden",children:(0,_.jsxs)(k.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,_.jsx)(k.TabList,{children:(0,_.jsx)(k.Tab,{children:"Builder"})}),(0,_.jsx)(k.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:(0,_.jsxs)(k.TabPanel,{display:"flex",flexDirection:"column",flex:"1",overflowY:"auto",children:[(0,_.jsx)(nJ,{nextId:n,incrementId:function(){i(function(e){return e+1})}}),(0,_.jsx)(az,{items:a,setItems:s})]})})]})}),(0,_.jsx)(k.Box,{display:"flex",flexDirection:"column",flex:"1",width:"50%",borderLeft:"1px solid",borderColor:"border.default",children:(0,_.jsxs)(k.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,_.jsxs)(k.TabList,{children:[(0,_.jsx)(k.Tab,{children:"Result"}),(0,_.jsx)(k.Tab,{children:"Code"})]}),(0,_.jsxs)(k.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,_.jsx)(k.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"4",children:(0,_.jsx)(sL,{items:a})}),(0,_.jsx)(k.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"0",children:(0,_.jsx)(nC,{border:"none",value:(t=(function e(t){var r=new Set;r.add(t.type);var n=ao(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),an(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=ay(a)).join(", "),ap().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,d.hasProperty)(o,"children")){var s=e(o.children,r+1);return"".concat(n,"<").concat(i).concat(as(o),">\n").concat(s).concat(n,"").concat(i,">").concat(a)}return"".concat(n,"<").concat(i).concat(as(o)," />").concat(a)}(e),");\n"),{parser:"typescript",plugins:[au()],printWidth:80,tabWidth:2,singleQuote:!0,trailingComma:"all"})),language:"typescript",options:{readOnly:!0}})})]})]})})]})})},{})}),(0,_.jsx)(h.Route,{path:"/manifest",element:(0,_.jsx)(function(){var e=F(r3);return(0,_.jsx)(k.Flex,{width:"100%",direction:"column",overflow:"hidden",children:(0,_.jsxs)(k.Flex,{direction:"row",flex:"1",overflow:"hidden",children:[(0,_.jsx)(k.Flex,{direction:"column",flex:"1",width:"50%",overflow:"hidden",children:(0,_.jsxs)(k.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,_.jsx)(k.TabList,{children:(0,_.jsx)(k.Tab,{children:"Validation"})}),(0,_.jsx)(k.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:(0,_.jsx)(k.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"0",children:(0,_.jsx)(sq,{})})})]})}),(0,_.jsx)(k.Box,{display:"flex",flexDirection:"column",flex:"1",width:"50%",borderLeft:"1px solid",borderColor:"border.default",children:(0,_.jsxs)(k.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,_.jsx)(k.TabList,{children:(0,_.jsx)(k.Tab,{children:"Manifest"})}),(0,_.jsx)(k.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:(0,_.jsx)(k.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"0",children:(0,_.jsx)(nC,{border:"none",value:JSON.stringify(e,null,2),options:{readOnly:!0,wordWrap:"on"}})})})]})})]})})},{})}),(0,_.jsxs)(h.Route,{path:"/handler",element:(0,_.jsx)(function(){var e,t=function(e){if(Array.isArray(e))return e}(e=(0,m.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 s5(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 s5(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=F(rX);return(0,_.jsx)(k.Flex,{width:"100%",direction:"column",overflow:"hidden",children:(0,_.jsxs)(k.Flex,{direction:"row",flex:"1",overflow:"hidden",children:[(0,_.jsx)(sJ,{isTest:!1,children:(0,_.jsx)(k.Flex,{direction:"column",flex:"1",width:"50%",overflow:"hidden",children:(0,_.jsxs)(k.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",isLazy:!0,onChange:n,children:[(0,_.jsx)(sZ,{}),(0,_.jsxs)(k.TabList,{alignItems:"center",children:[(0,_.jsx)(k.Tab,{children:"Request"}),(0,_.jsx)(k.Tab,{children:"History"}),0===r&&(0,_.jsx)(k.Box,{marginLeft:"auto",children:(0,_.jsx)(sG,{})})]}),(0,_.jsxs)(k.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,_.jsx)(k.TabPanel,{display:"flex",flexDirection:"column",flex:"1",overflowY:"auto","data-testid":"tab-request",children:(0,_.jsx)(h.Outlet,{})}),(0,_.jsx)(k.TabPanel,{padding:"0",display:"flex",flexDirection:"column",flex:"1",overflowY:"auto",children:(0,_.jsx)(sW,{})})]})]})})}),(0,_.jsx)(k.Box,{display:"flex",flexDirection:"column",flex:"1",width:"50%",borderLeft:"1px solid",borderColor:"border.default",children:(0,_.jsxs)(k.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,_.jsx)(sZ,{}),(0,_.jsx)(sX,{}),(0,_.jsxs)(k.TabList,{children:[(0,_.jsx)(k.Tab,{children:"Response"}),i&&(0,_.jsx)(k.Tab,{children:"UI"})]}),(0,_.jsxs)(k.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,_.jsx)(k.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"0","data-testid":"tab-response",children:(0,_.jsx)(s0,{})}),i&&(0,_.jsx)(k.TabPanel,{overflowY:"auto","data-testid":"tab-ui",children:(0,_.jsx)(s6,{})})]})]})})]})})},{}),children:[(0,_.jsx)(h.Route,{path:"/handler/".concat(u8.OnRpcRequest),element:(0,_.jsx)(function(){return(0,_.jsx)(lr,{})},{})}),(0,_.jsx)(h.Route,{path:"/handler/".concat(u8.OnCronjob),element:(0,_.jsx)(function(){return(0,_.jsx)(lc,{})},{})}),(0,_.jsx)(h.Route,{path:"/handler/".concat(u8.OnTransaction),element:(0,_.jsx)(function(){return(0,_.jsx)(lE,{})},{})})]})]})));function lw(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:uR(e)?2:uz(e)?3:0}function uF(e,t){return 2===uP(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function uL(e,t,r){var n=uP(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function uR(e){return cT&&e instanceof Map}function uz(e){return cw&&e instanceof Set}function uB(e){return e.o||e.t}function uU(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=cI(e);delete t[cN];for(var r=ck(t),n=0;n1&&(e.set=e.add=e.clear=e.delete=uJ),Object.freeze(e),t&&uO(e,function(e,t){return uq(t,!0)},!0)),e}function uJ(){uj(2)}function u$(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function uK(e){var t=cO[e];return t||uj(18,e),t}function uY(e,t){t&&(uK("Patches"),e.u=[],e.s=[],e.v=t)}function uV(e){uW(e),e.p.forEach(uH),e.p=null}function uW(e){e===cS&&(cS=e.l)}function uQ(e){return cS={p:[],l:cS,h:e,m:!0,_:0}}function uH(e){var t=e[cN];0===t.i||1===t.i?t.j():t.g=!0}function uG(e,t){t._=t.p.length;var r=t.p[0],n=void 0!==e&&e!==r;return t.h.O||uK("ES5").S(t,e,n),n?(r[cN].P&&(uV(t),uj(4)),uI(e)&&(e=uZ(t,e),t.l||u0(t,e)),t.u&&uK("Patches").M(r[cN].t,e,t.u,t.s)):e=uZ(t,r,[]),uV(t),t.u&&t.v(t.u,t.s),e!==cC?e:void 0}function uZ(e,t,r){if(u$(t))return t;var n=t[cN];if(!n)return uO(t,function(i,o){return uX(e,n,t,i,o,r)},!0),t;if(n.A!==e)return t;if(!n.P)return u0(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var i=4===n.i||5===n.i?n.o=uU(n.k):n.o,o=i,a=!1;3===n.i&&(o=new Set(i),i.clear(),a=!0),uO(o,function(t,o){return uX(e,n,i,t,o,r,a)}),u0(e,i,!1),r&&e.u&&uK("Patches").N(n,r,e.u,e.s)}return n.o}function uX(e,t,r,n,i,o,a){if(uk(i)){var s=uZ(e,i,o&&t&&3!==t.i&&!uF(t.R,n)?o.concat(n):void 0);if(uL(r,n,s),!uk(s))return;e.m=!1}else a&&r.add(i);if(uI(i)&&!u$(i)){if(!e.h.D&&e._<1)return;uZ(e,i),t&&t.A.l||u0(e,i)}}function u0(e,t,r){void 0===r&&(r=!1),!e.l&&e.h.D&&e.m&&uq(t,r)}function u1(e,t){var r=e[cN];return(r?uB(r):e)[t]}function u2(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 u3(e){e.P||(e.P=!0,e.l&&u3(e.l))}function u4(e){e.o||(e.o=uU(e.t))}function u6(e,t,r){var n,i,o,a,s,l,u,c=uR(t)?uK("MapSet").F(t,r):uz(t)?uK("MapSet").T(t,r):e.O?(o=i={i:(n=Array.isArray(t))?1:0,A:r?r.A:cS,P:!1,I:!1,R:{},l:r,t:t,k:null,o:null,j:null,C:!1},a=cP,n&&(o=[i],a=cF),l=(s=Proxy.revocable(o,a)).revoke,u=s.proxy,i.k=u,i.j=l,u):uK("ES5").J(t,r);return(r?r.A:cS).p.push(c),c}function u5(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return uU(e)}var u8,u7,u9,ce,ct,cr,cn,ci,co,ca,cs,cl,cu,cc,cp,c_,cd,cf,cm,ch,cy,cg,cb,cv,cx,cD,cS,cE="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),cT="undefined"!=typeof Map,cw="undefined"!=typeof Set,cA="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,cC=cE?Symbol.for("immer-nothing"):((cD={})["immer-nothing"]=!0,cD),cM=cE?Symbol.for("immer-draftable"):"__$immer_draftable",cN=cE?Symbol.for("immer-state"):"__$immer_state",cj=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),ck="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,cI=Object.getOwnPropertyDescriptors||function(e){var t={};return ck(e).forEach(function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)}),t},cO={},cP={get:function(e,t){if(t===cN)return e;var r,n,i=uB(e);if(!uF(i,t))return(n=u2(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||!uI(o)?o:o===u1(e.t,t)?(u4(e),e.o[t]=u6(e.A.h,o,e)):o},has:function(e,t){return t in uB(e)},ownKeys:function(e){return Reflect.ownKeys(uB(e))},set:function(e,t,r){var n=u2(uB(e),t);if(null==n?void 0:n.set)return n.set.call(e.k,r),!0;if(!e.P){var i=u1(uB(e),t),o=null==i?void 0:i[cN];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||uF(e.t,t)))return!0;u4(e),u3(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!==u1(e.t,t)||t in e.t?(e.R[t]=!1,u4(e),u3(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=uB(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(){uj(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){uj(12)}},cF={};uO(cP,function(e,t){cF[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),cF.deleteProperty=function(e,t){return cF.set.call(this,e,t,void 0)},cF.set=function(e,t,r){return cP.set.call(this,e[0],t,r,e[0])};var cL=new(function(){function e(e){var t=this;this.O=cA,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=uK("Patches").$;return uk(e)?i(e,t):this.produce(e,function(e){return i(e,t)})},e}());cL.produce,cL.produceWithPatches.bind(cL),cL.setAutoFreeze.bind(cL),cL.setUseProxies.bind(cL),cL.applyPatches.bind(cL),cL.createDraft.bind(cL),cL.finishDraft.bind(cL);let cR=(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 cz(e){var t;return(0,d.isPlainObject)(e)&&(0,d.hasProperty)(e,"type")&&(0,d.hasProperty)(e,"props")&&(0,d.hasProperty)(e,"key")?e:(t=function e(t){switch(t.type){case cc.Panel:return t.children.reduce(function(t,r){return t+e(r)},0);case cc.Row:return e(t.value);case cc.Text:return t.value.length;default:return 0}}(e),(0,d.assert)(t<=5e4,"The text in a Snap UI may not be larger than ".concat(50," kB.")),function e(t){switch(t.type){case cc.Address:return iW(i0,{address:t.value});case cc.Button:return iW(nO,{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 cc.Copyable:return iW(nk,{value:t.value,sensitive:t.sensitive});case cc.Divider:return iW(nj,{});case cc.Form:return iW(nP,{name:t.name,children:o9(t.children.map(e))});case cc.Heading:return iW(nM,{children:t.value});case cc.Image:return iW(nI,{src:t.value});case cc.Input:return iW(nF,{label:t.label,error:t.error,children:iW(nL,{name:t.name,type:t.inputType,value:t.value,placeholder:t.placeholder})});case cc.Panel:return iW(nS,{children:o9(t.children.map(e))});case cc.Row:return iW(i1,{label:t.label,variant:t.variant,children:e(t.value)});case cc.Spinner:return iW(i2,{});case cc.Text:var r,n;return iW(nN,{children:o9((r=o4(t.value,{gfm:!1}),n=[],o3(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 o6(e)}(t=r.flatMap(at))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||o8(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,d.assertExhaustive)(t)}}(e))}function cB(e,t){(0,d.assert)(void 0===e[t],'Duplicate component names are not allowed, found multiple instances of: "'.concat(t,'".'))}function cU(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=ao(e)[0])||void 0===t?void 0:t.props.value;case"RadioGroup":return null===(r=ao(e)[0])||void 0===r?void 0:r.props.value;case"Selector":return null===(n=ao(e)[0])||void 0===n?void 0:n.props.value;case"Checkbox":return!1;default:return null}}(t))&&void 0!==o?o:null}function cq(e,t){var r={},n=[];return aa(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){cB(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];cB(a,t.props.name),a[t.props.name]=cU(e,t,o.name);return}("Input"===t.type||"Dropdown"===t.type||"RadioGroup"===t.type||"FileInput"===t.type||"Checkbox"===t.type||"Selector"===t.type)&&(cB(r,t.props.name),r[t.props.name]=cU(e,t))}),r}function cJ(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c$(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 cK(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){c$(o,n,i,a,s,"next",e)}function s(e){c$(o,n,i,a,s,"throw",e)}a(void 0)})}}function cY(e,t,r){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return r}function cV(e,t){(function(e,t){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function cW(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]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===n[2]||n[2],[4,new Promise(function(n,i){var o=document.createElement("iframe");o.setAttribute("id",t),o.setAttribute("data-testid","snaps-iframe"),r&&o.setAttribute("sandbox","allow-scripts"),o.setAttribute("src",e),document.body.appendChild(o),o.addEventListener("load",function(){o.contentWindow?n(o.contentWindow):i(Error('iframe.contentWindow not present on load for job "'.concat(t,'".')))})})];case 1:return[2,i.sent()]}})},(pp=function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){pc(o,n,i,a,s,"next",e)}function s(e){pc(o,n,i,a,s,"throw",e)}a(void 0)})}).apply(this,arguments)}var p_=r(9952),pd=r.n(p_),pf={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},pm={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};function ph(e,t="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(e)){let t=e.toString();if((0,d.hasProperty)(pm,t))return pm[t].message;if(e>=-32099&&e<=-32e3)return"Unspecified server error."}return t}function py(e){return Object.getOwnPropertyNames(e).reduce((t,r)=>{let n=e[r];return(0,d.isValidJson)(n)&&(t[r]=n),t},{})}ph(pf.rpc.internal);var pg=r(7847),pb=r.n(pg),pv=class extends Error{constructor(e,t,r){var n=(...e)=>{super(...e)};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,d.isObject)(e)&&(0,d.hasProperty)(e,"cause")&&(0,d.isObject)(e.cause)})(r)?(n(t,{cause:r.cause}),(0,d.hasProperty)(this,"cause")||Object.assign(this,{cause:r.cause})):n(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,d.isPlainObject)(this.data)&&(t.data.cause=Array.isArray(e=this.data.cause)?e.map(e=>(0,d.isValidJson)(e)?e:(0,d.isObject)(e)?py(e):null):(0,d.isObject)(e)?py(e):(0,d.isValidJson)(e)?e:null)),this.stack&&(t.stack=this.stack),t}toString(){return pb()(this.serialize(),pD,2)}},px=class extends pv{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 pD(e,t){if("[Circular]"!==t)return t}var pS={parse:e=>pT(pf.rpc.parse,e),invalidRequest:e=>pT(pf.rpc.invalidRequest,e),invalidParams:e=>pT(pf.rpc.invalidParams,e),methodNotFound:e=>pT(pf.rpc.methodNotFound,e),internal:e=>pT(pf.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 pT(t,e)},invalidInput:e=>pT(pf.rpc.invalidInput,e),resourceNotFound:e=>pT(pf.rpc.resourceNotFound,e),resourceUnavailable:e=>pT(pf.rpc.resourceUnavailable,e),transactionRejected:e=>pT(pf.rpc.transactionRejected,e),methodNotSupported:e=>pT(pf.rpc.methodNotSupported,e),limitExceeded:e=>pT(pf.rpc.limitExceeded,e)},pE={userRejectedRequest:e=>pw(pf.provider.userRejectedRequest,e),unauthorized:e=>pw(pf.provider.unauthorized,e),unsupportedMethod:e=>pw(pf.provider.unsupportedMethod,e),disconnected:e=>pw(pf.provider.disconnected,e),chainDisconnected:e=>pw(pf.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 px(t,r,n)}};function pT(e,t){let[r,n]=pA(t);return new pv(e,r??ph(e),n)}function pw(e,t){let[r,n]=pA(t);return new px(e,r??ph(e),n)}function pA(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 pC(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,d.assert)("paused"===this.status||"running"===this.status,Error("Tried to cancel a not running Timer")),this.onFinish(!1)}},{key:"finish",value:function(){(0,d.assert)("finished"!==this.status,Error("Tried to finish a finished Timer.")),this.onFinish(!0)}},{key:"pause",value:function(){(0,d.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,d.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,d.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,d.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()}}],pk(r.prototype,e),t&&pk(r,t),r}();function pO(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 pP(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){pO(o,n,i,a,s,"next",e)}function s(e){pO(o,n,i,a,s,"throw",e)}a(void 0)})}}function pF(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]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}})),_H(i,_C.targetName,_y(function(e){return{caveats:[{type:u9.KeyringOrigin,value:e}]}})),_H(i,_J.targetName,_y(function(e){return!e||!(0,d.isObject)(e)||(0,d.isObject)(e)&&0===Object.keys(e).length?{caveats:null}:{caveats:[{type:u9.SignatureOrigin,value:(0,d.hasProperty)(e,"allowSignatureOrigin")&&e.allowSignatureOrigin}]}})),_H(i,_j.targetName,_h),_H(i,_T.targetName,_h),i);_H(o={},u8.OnRpcRequest,_B.targetName),_H(o,u8.OnTransaction,_Y.targetName),_H(o,u8.OnCronjob,_v.targetName),_H(o,u8.OnNameLookup,_O.targetName),_H(o,u8.OnInstall,_j.targetName),_H(o,u8.OnUpdate,_j.targetName),_H(o,u8.OnKeyringRequest,_C.targetName),_H(o,u8.OnHomePage,_T.targetName),_H(o,u8.OnSignature,_J.targetName),_H(o,u8.OnUserInput,null);let _0=BigInt(4294967296-1),_1=BigInt(32),_2=(e,t,r)=>e<>>32-r,_3=(e,t,r)=>t<>>32-r,_4=(e,t,r)=>t<>>64-r,_6=(e,t,r)=>e<>>64-r,_5=[],_8=[],_7=[],_9=BigInt(0),de=BigInt(1),dt=BigInt(2),dr=BigInt(7),dn=BigInt(256),di=BigInt(113);for(let e=0,t=de,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],_5.push(2*(5*n+r)),_8.push((e+1)*(e+2)/2%64);let i=_9;for(let e=0;e<7;e++)(t=(t<>dr)*di)%dn)&dt&&(i^=de<<(de<>_1&_0)}:{h:0|Number(e>>_1&_0),l:0|Number(e&_0)}}(e[i],t);[r[i],n[i]]=[o,a]}return[r,n]}(_7,!0),dl=(e,t,r)=>r>32?_4(e,t,r):_2(e,t,r),du=(e,t,r)=>r>32?_6(e,t,r):_3(e,t,r);class dc extends ev{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,eu(r),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ed(this.state)}keccak(){eh||eg(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=dl(o,a,1)^r[n],l=du(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=_8[r],o=dl(t,i,n),a=du(t,i,n),s=_5[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]^=da[n],e[1]^=ds[n]}r.fill(0)}(this.state32,this.rounds),eh||eg(this.state32),this.posOut=0,this.pos=0}update(e){ep(this);let{blockLen:t,state:r}=this;e=eb(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 eu(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(e_(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 dc(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 dp=ex(()=>new dc(136,1,32));function d_(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}(dp((0,d.concatBytes)([a,dp(s)]))),[4,e9.SLIP10Node.fromDerivationPath({derivationPath:[i,"bip32:".concat(o)].concat(dm(l)),curve:"secp256k1"})];case 1:return u=c.sent().privateKey,(0,d.assert)(u,"Failed to derive the entropy."),[2,(0,d.add0x)(u)]}})})).apply(this,arguments)}function db(e){return dv.apply(this,arguments)}function dv(){return(dv=df(function(e){var t,r,n,i;return dh(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,d.assertExhaustive)(e)}}(t),[4,e9.SLIP10Node.fromDerivationPath({curve:t,derivationPath:[r].concat(dm(n.slice(1).map(function(e){return"".concat(i,":").concat(e)})))})];case 1:return[2,o.sent()]}})})).apply(this,arguments)}function dx(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 dD="snap_getBip32Entropy",dS=Object.freeze({targetName:dD,specificationBuilder:function(e){var t,r,n,i,o=e.methodHooks;return{permissionType:ts.PermissionType.RestrictedMethod,targetName:dD,allowedCaveats:[u9.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 pS.invalidParams({message:'Invalid "coinType" parameter. Coin type must be a non-negative integer.'});if(tD.includes(e.coinType))throw pS.invalidParams({message:"Coin type ".concat(e.coinType," is forbidden.")})}var dz=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}({},u9.PermittedCoinTypes,Object.freeze({type:u9.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,d.isObject)(e))throw pS.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(u).includes(i))throw pS.invalidParams({message:'Must specify a valid manage state "operation".'});if(void 0!==a&&"boolean"!=typeof a)throw pS.invalidParams({message:'"encrypted" parameter must be a boolean if specified.'});if(i===u.UpdateState){if(!(0,d.isObject)(o))throw pS.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,d.getJsonSize)(o)}catch(e){throw pS.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 pS.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!==u.ClearState))return[3,2];return[4,n(!0)];case 1:f.sent(),f.label=2;case 2:switch(c.operation){case u.ClearState:return[3,3];case u.GetState:return[3,4];case u.UpdateState:return[3,6]}return[3,8];case 3:return i(l,_),[2,null];case 4:return[4,o(l,_)];case 5:return[2,f.sent()];case 6:return[4,a(l,c.newState,_)];case 7:return f.sent(),[2,null];case 8:throw pS.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){fI(o,n,i,a,s,"next",e)}function s(e){fI(o,n,i,a,s,"throw",e)}a(void 0)})},function(e){return r.apply(this,arguments)}),subjectTypes:[ts.SubjectType.Snap]}},methodHooks:{getUnlockPromise:!0,clearSnapState:!0,getSnapState:!0,updateSnapState:!0}});function fF(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 fL="snap_notify",fR=Object.freeze({targetName:fL,specificationBuilder:function(e){var t,r,n,i,o,a,s=e.allowedCaveats,l=e.methodHooks;return{permissionType:ts.PermissionType.RestrictedMethod,targetName:fL,allowedCaveats:void 0===s?null:s,methodImplementation:(n=l.showNativeNotification,i=l.showInAppNotification,o=l.isOnPhishingList,a=l.maybeUpdatePhishingList,t=function(e){var t,r,s;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 pS.invalidParams({message:'Must specify a non-empty string "message" less than 50 characters long.'});if(t===cb.InApp&&(n||r.length>=500))throw pS.invalidParams({message:'Must specify a non-empty string "message" less than 500 characters long.'});return e}(t),[4,a()];case 1:switch(l.sent(),function(e,t){var r=(a=o4(e,{gfm:!1}),s=[],o3(a,function(e){"link"===e.type&&s.push(e)}),s),n=!0,i=!1,o=void 0;try{for(var a,s,l,u=r[Symbol.iterator]();!(n=(l=u.next()).done);n=!0){var c=l.value;ar(c.href,t)}}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}}(s.message,o),s.type){case cb.Native:return[3,2];case cb.InApp:return[3,4]}return[3,6];case 2:return[4,n(r,s)];case 3:case 5:return[2,l.sent()];case 4:return[4,i(r,s)];case 6:throw pS.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){fF(o,n,i,a,s,"next",e)}function s(e){fF(o,n,i,a,s,"throw",e)}a(void 0)})},function(e){return r.apply(this,arguments)}),subjectTypes:[ts.SubjectType.Snap]}},methodHooks:{showNativeNotification:!0,showInAppNotification:!0,isOnPhishingList:!0,maybeUpdatePhishingList:!0}});function fz(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var fB=(fz(c={},fo.targetName,fo),fz(c,dS.targetName,dS),fz(c,dA.targetName,dA),fz(c,dN.targetName,dN),fz(c,fD.targetName,fD),fz(c,dF.targetName,dF),fz(c,fP.targetName,fP),fz(c,fR.targetName,fR),fz(c,fk.targetName,fk),fz(c,fT.targetName,fT),fz(c,fC.targetName,fC),c);function fU(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]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]:p.Base64,[4,uf(r6)];case 1:if(n=s.sent(),i=tJ(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,up(mv,o,t)];case 2:return[2,s.sent()]}})}function mN(e,t){return mS(this,function(r){switch(r.label){case 0:return[4,uf(rW)];case 1:return[4,up([r.sent(),"createInterface"],e,t)];case 2:return[2,r.sent()]}})}function mj(e,t){return mS(this,function(r){switch(r.label){case 0:return[4,uf(rW)];case 1:return[4,up([r.sent(),"getInterface"],e,t)];case 2:return[2,r.sent()]}})}function mk(e,t,r){return mS(this,function(n){switch(n.label){case 0:return[4,uf(rW)];case 1:return[4,up([n.sent(),"updateInterface"],e,t,r)];case 2:return n.sent(),[4,up(mj,e,t)];case 3:return[4,ul(rF(mD({id:t},n.sent())))];case 4:return n.sent(),[2]}})}function mI(e,t){return mS(this,function(r){switch(r.label){case 0:return[4,uf(rW)];case 1:return[4,up([r.sent(),"getInterface"],e,t)];case 2:return[2,r.sent().state]}})}function mO(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 mP(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){mO(o,n,i,a,s,"next",e)}function s(e){mO(o,n,i,a,s,"throw",e)}a(void 0)})}}function mF(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),ht(this,"cache",new Map),ht(this,"validatedManifest",void 0),ht(this,"url",void 0),ht(this,"fetchFn",void 0),ht(this,"fetchOptions",void 0),(0,d.assertStruct)(e.toString(),e3,"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 m9(function(){var t,r,n,i,o;return hr(this,function(a){switch(a.label){case 0:if(e.validatedManifest)return[2,e.validatedManifest.clone()];return t=new URL(ce.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=e8(n=a.sent()),o=new eP({value:n,result:tq(i),path:ce.Manifest,data:{canonicalPath:t}}),e.validatedManifest=o,[2,e.manifest()]}})})()}},{key:"fetch",value:function(e){var t=this;return m9(function(){var r,n,i,o,a,s,l,u,c,p,_;return hr(this,function(f){switch(f.label){case 0:if(r=tJ(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 eP({value:"",path:r,data:{canonicalPath:u}}),[4,c.blob()];case 4:return _=f.sent(),(0,d.assert)(!t.cache.has(r),"Corrupted cache, multiple files with same path."),t.cache.set(r,{file:p,contents:_}),[2,t.fetch(r)]}})})()}},{key:"root",get:function(){return new URL(this.url)}},{key:"toCanonical",value:function(e){return(0,d.assert)(!e.startsWith("/"),"Tried to parse absolute path."),new URL(e,this.url)}}],he(r.prototype,e),t&&he(r,t),r}();function hi(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 ho(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){hi(o,n,i,a,s,"next",e)}function s(e){hi(o,n,i,a,s,"throw",e)}a(void 0)})}}function ha(e,t,r){if(!t.has(e))throw TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function hs(e,t){var r=ha(e,t,"get");return r.get?r.get.call(e):r.value}function hl(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,hc),hc.set(this,{writable:!0,value:void 0}),(0,d.assertStruct)(e.toString(),e1,"Invalid Snap Id"),(0,d.assert)(void 0===o.fetchOptions,"Currently adding fetch options to local: is unsupported."),i=new hn(new URL(e.toString().slice(ct.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=hA(function(e,t){var r,n,i,o,a,s,l;return hM(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 eZ.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=hA(function(e,t){var r,n,i,o,a,s,l;return hM(this,function(u){return(r=t.sourceCode,l=hC(tU.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 hj(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=oo(e);if(null===n)return r;let i='"+r+""}image(e,t,r){let n=oo(e);if(null===n)return r;let i=`"}text(e){return e}}class oG{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,r){return""+r}image(e,t,r){return""+r}br(){return""}}class oZ{options;renderer;textRenderer;constructor(e){this.options=e||i4,this.options.renderer=this.options.renderer||new oH,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new oG}static parse(e,t){let r=new oZ(t);return r.parse(e)}static parseInline(e,t){let r=new oZ(t);return r.parseInline(e)}parse(e,t=!0){let r="";for(let n=0;n"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 oH(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 oc(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 oX;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];oX.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 oQ.lex(e,t??this.defaults)}parser(e,t){return oZ.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:
"+ot(r.message+"",!0)+"
";return t?Promise.resolve(e):e}if(t)return Promise.reject(r);throw r}}}let o1=new o0;function o2(e,t){return o1.parse(e,t)}o2.options=o2.setOptions=function(e){return o1.setOptions(e),o2.defaults=o1.defaults,i4=o2.defaults,o2},o2.getDefaults=i3,o2.defaults=i4,o2.use=function(...e){return o1.use(...e),o2.defaults=o1.defaults,i4=o2.defaults,o2},o2.walkTokens=function(e,t){return o1.walkTokens(e,t)},o2.parseInline=o1.parseInline,o2.Parser=oZ,o2.parser=oZ.parse,o2.Renderer=oH,o2.TextRenderer=oG,o2.Lexer=oQ,o2.lexer=oQ.lex,o2.Tokenizer=oc,o2.Hooks=oX,o2.parse=o2,o2.options,o2.setOptions,o2.use;let o3=o2.walkTokens;o2.parseInline,oZ.parse;let o4=oQ.lex;function o6(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r0?o9(e.tokens.flatMap(at)):e.href});case"text":return e.text;case"strong":return iW(iZ,{children:ae(e.tokens)});case"em":return iW(iX,{children:ae(e.tokens)});default:return null}}function ar(e,t){try{var r=new URL(e);(0,d.assert)(o7.includes(r.protocol),"Protocol must be one of: ".concat(o7.join(", "),"."));var n="mailto:"===r.protocol?r.pathname.split("@")[1]:r.hostname;(0,d.assert)(!t(n),"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 an(e){return(0,d.hasProperty)(e.props,"children")}function ai(e){return!!e&&!0!==e}function ao(e){if(an(e)){if(Array.isArray(e.props.children))return e.props.children.filter(ai).flat(1/0);if(e.props.children)return[e.props.children]}return[]}function aa(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=aa(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,d.hasProperty)(e,"props")&&(0,d.isPlainObject)(e.props)&&(0,d.hasProperty)(e.props,"children")){var p=ao(e),_=!0,f=!1,m=void 0;try{for(var h,y=p[Symbol.iterator]();!(_=(h=y.next()).done);_=!0){var g=h.value;if((0,d.isPlainObject)(g)){var b=aa(g,t,r+1);if(void 0!==b)return b}}}catch(e){f=!0,m=e}finally{try{_||null==y.return||y.return()}finally{if(f)throw m}}}}function as(e){return Object.entries(e).filter(function(e){return"children"!==o5(e,1)[0]}).sort(function(e,t){var r=o5(e,1)[0],n=o5(t,1)[0];return r.localeCompare(n)}).map(function(e){var t=o5(e,2),r=t[0],n=t[1];return" ".concat(r,"=").concat("string"==typeof n?'"'.concat(n,'"'):"{".concat(JSON.stringify(n),"}"))}).join("")}var al=r(8261),au=r.n(al),ac=r(9691),ap=r.n(ac);function a_(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r1?"move":"default",children:[(0,_.jsx)(P,{icon:r.data.type.toLowerCase(),width:"16px"}),(0,_.jsx)(k.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,_.jsx)(P,{icon:"cross",width:"11px",marginX:"0.5",marginLeft:"auto",cursor:"pointer",onClick:function(){null==o||o(r)}})]})};function ab(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function av(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,_.jsx)(n$.Tree,{ref:n,tree:t,rootId:0,render:function(e,r){var n=r.depth,a=r.isDragging;return t.length<=1?(0,_.jsx)(aP,{}):(0,_.jsx)(aO,{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 ad(t);case"Form":return af(t);case"Field":return am(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,_.jsx)(k.Box,{width:"100%",height:"20px"})}})})},aB=function(e){var t=e.snapName,r=F(rZ),n=r&&new Blob([r.value],{type:"image/svg+xml"}),i=n&&URL.createObjectURL(n);return(0,_.jsxs)(k.Box,{position:"relative",children:[(0,_.jsx)(k.Avatar,{src:i,name:t.slice(0,1).toUpperCase(),fontSize:"md",background:"background.alternative",color:"text.alternative",size:"sm",margin:"1"}),(0,_.jsx)(P,{icon:"snap",width:"16px",height:"16px",position:"absolute",bottom:"0px",right:"0px"})]})},aU=function(e){var t=e.snapName,r=e.snapId;return(0,_.jsxs)(k.Flex,{gap:"2",marginX:"4",marginY:"4",border:"1px solid",borderColor:"border.default",borderRadius:"32px",padding:"1",alignItems:"center",children:[(0,_.jsx)(aB,{snapName:t}),(0,_.jsxs)(k.Flex,{direction:"column",justify:"center",children:[(0,_.jsx)(k.Text,{fontSize:"sm",lineHeight:"157%",fontFamily:"custom",children:t}),(0,_.jsx)(k.Text,{fontSize:"xs",lineHeight:"167%",fontFamily:"custom",color:"text.alternative",children:r})]})]})},aq=function(e){var t=e.snapName,r=e.snapId,n=e.children,i=e.showAuthorship;return(0,_.jsxs)(k.Flex,{direction:"column",boxShadow:"lg",maxWidth:"360px",height:"600px",paddingY:"4",overflowY:"scroll",children:[(void 0===i||i)&&(0,_.jsx)(aU,{snapName:t,snapId:r}),n]})};!function(e){e.Content="content",e.Error="error",e.Insights="insights"}(cm||(cm={}));var aJ=function(e,t){switch(e){case cm.Insights:return"Insights from ".concat(t);case cm.Error:return"Error from ".concat(t);default:return"Content from ".concat(t)}},a$=function(e){var t=e.type,r=e.snapName,n=e.children,i=t===cm.Error;return(0,_.jsxs)(k.Box,{border:"1px solid",borderColor:"border.default",borderRadius:"md",backgroundColor:i?"error.muted":void 0,children:[(0,_.jsxs)(k.Flex,{direction:"row",alignItems:"center",padding:"1.5",borderBottom:"1px solid",borderColor:"border.default",children:[(0,_.jsx)(P,{icon:i?"snapError":"snap",width:"16px",marginRight:"1"}),(0,_.jsx)(k.Text,{fontFamily:"custom",fontSize:"xs",color:i?"text.error":void 0,children:aJ(t,r)})]}),(0,_.jsx)(k.Box,{padding:"3",children:n})]})};function aK(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r{let t=sl();ss(!0);try{let r=!1,n=so(()=>{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=>{ss(t),e(r)},e=>{ss(t),r(e)})}};return ss(t),n}catch(e){throw ss(t),e}},sc=function(){return(0,sn.BX)(...arguments)};Object.keys(sn.BX).forEach(e=>{sc[e]=function(){return sn.BX[e](...arguments)}});let sp=sc.mouseEnter,s_=sc.mouseLeave;sc.mouseEnter=function(){return sp(...arguments),sc.mouseOver(...arguments)},sc.mouseLeave=function(){return s_(...arguments),sc.mouseOut(...arguments)};let sd=sc.pointerEnter,sf=sc.pointerLeave;sc.pointerEnter=function(){return sd(...arguments),sc.pointerOver(...arguments)},sc.pointerLeave=function(){return sf(...arguments),sc.pointerOut(...arguments)};let sm=sc.select;sc.select=(e,t)=>{sm(e,t),e.focus(),sc.keyUp(e,t)};let sh=sc.blur,sy=sc.focus;sc.blur=function(){return sc.focusOut(...arguments),sh(...arguments)},sc.focus=function(){return sc.focusIn(...arguments),sy(...arguments)},(0,sn.jQ)({unstable_advanceTimersWrapper:e=>su(e),asyncWrapper:async e=>{let t=sl();ss(!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{ss(t)}},eventWrapper:e=>{let t;return su(()=>{t=e()}),t}});let sg=new Set,sb=[];function sv(){sb.forEach(e=>{let{root:t,container:r}=e;su(()=>{t.unmount()}),r.parentNode===document.body&&document.body.removeChild(r)}),sb.length=0,sg.clear()}if((void 0===si||!si.env?.RTL_SKIP_AUTO_CLEANUP)&&("function"==typeof afterEach?afterEach(()=>{sv()}):"function"==typeof teardown&&teardown(()=>{sv()}),"function"==typeof beforeAll&&"function"==typeof afterAll)){let e=sl();beforeAll(()=>{e=sl(),ss(!0)}),afterAll(()=>{ss(e)})}var sx=r(3151),sD=r(966),sS=r.n(sD),sE={primary:"primary",destructive:"outline"},sT=function(e){var t,r=e.node,n=e.id;iV(r),(0,d.assert)("Button"===r.type,"Expected value to be a button component.");var i=st().handleEvent,o=r.props;return(0,_.jsx)(k.Button,{width:"100%",variant:sE[null!==(t=o.variant)&&void 0!==t?t:"primary"],marginBottom:"4",type:o.type,onClick:function(e){o.type===cd.Button&&e.preventDefault(),i({event:ch.ButtonClickEvent,name:o.name})},children:o.children},"".concat(n,"-button"))},sw=function(e){var t=e.node,r=e.id,n=e.form,i=st(),o=i.handleInputChange,a=i.getValue;iV(t),(0,d.assert)("Input"===t.type,"Expected value to be an input component.");var s=t.props,l=a(s.name,n);return(0,_.jsx)(k.Input,{value:l,type:s.type,placeholder:s.placeholder,onChange:function(e){o(s.name,e.target.value,n)}},"".concat(r,"-input"))},sA={Bold:function(e){var t=e.node,r=e.id;return iV(t),(0,d.assert)("Bold"===t.type,"Expected value to be a bold component."),(0,_.jsx)(k.Text,{fontFamily:"custom",fontSize:"sm",paddingBottom:"1",as:"b",children:sM(ao(t),r)},"".concat(r,"-text"))},Box:function(e){var t=e.node,r=e.id;return iV(t),(0,d.assert)("Box"===t.type,"Expected value to be a Box component."),(0,_.jsx)(k.Box,{children:ao(t).map(function(e,t){return(0,_.jsx)(sC,{node:e},"".concat(r,"-panel-child-").concat(t))})},r)},Button:sT,Copyable:function(e){var t=e.node,r=e.id;iV(t),(0,d.assert)("Copyable"===t.type,"Expected value to be a copyable component.");var n=t.props;return(0,_.jsx)(aY,{value:n.value},"".concat(r,"-copyable"))},Divider:function(e){var t=e.id;return(0,_.jsx)(k.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;iV(t),(0,d.assert)("Field"===t.type,"Expected value to be a field component.");var i=ao(t),o=i[0],a=i[1],s=t.props;return(0,_.jsxs)(k.FormControl,{isInvalid:!!s.error,children:[s.label&&(0,_.jsx)(k.FormLabel,{children:s.label}),(0,_.jsx)(sw,{id:r,node:o,form:n}),a&&(0,_.jsx)(sT,{id:r,node:a}),(0,_.jsx)(k.FormErrorMessage,{children:s.error})]},"".concat(r,"-field"))},Form:function(e){var t=e.node,r=e.id;iV(t),(0,d.assert)("Form"===t.type,"Expected value to be a form component.");var n=st().handleEvent,i=t.props;return(0,_.jsx)(k.Box,{as:"form",onSubmit:function(e){e.preventDefault(),n({event:ch.FormSubmitEvent,name:i.name})},children:ao(t).map(function(e,n){return(0,_.jsx)(sC,{node:e,form:t.props.name},"".concat(r,"-form-child-").concat(n))})},r)},Heading:function(e){var t=e.node,r=e.id;iV(t),(0,d.assert)("Heading"===t.type,"Expected value to be a heading component.");var n=t.props;return(0,_.jsx)(k.Heading,{fontFamily:"custom",fontSize:"x-large",fontWeight:"bold",paddingBottom:"4",children:n.children},"".concat(r,"-heading"))},Input:sw,Italic:function(e){var t=e.node,r=e.id;return iV(t),(0,d.assert)("Italic"===t.type,"Expected value to be an italic component."),(0,_.jsx)(k.Text,{fontFamily:"custom",fontSize:"sm",paddingBottom:"1",as:"i",children:sM(ao(t),r)},r)},Link:function(e){var t=e.node,r=e.id;iV(t),(0,d.assert)("Link"===t.type,"Expected value to be a link component.");var n=t.props;return(0,_.jsxs)(k.Link,{href:n.href,target:"_blank",fontFamily:"custom",fontSize:"sm",isExternal:!0,color:"link.default",display:"inline",children:[sM(ao(t),r),(0,_.jsx)(P,{icon:"linkOut",width:"14px",marginLeft:"2px",display:"inline",verticalAlign:"middle"})]})},Spinner:function(e){var t=e.id;return(0,_.jsx)(k.Spinner,{},"".concat(t,"-spinner"))},Text:function(e){var t=e.node,r=e.id;return iV(t),(0,d.assert)("Text"===t.type,"Expected value to be a text component."),(0,_.jsx)(k.Text,{fontFamily:"custom",fontSize:"sm",paddingBottom:"1",children:sM(ao(t),r)},r)},Image:function(e){var t=e.id,r=e.node;iV(r),(0,d.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,_.jsx)(k.Image,{src:i,alt:n.alt},"".concat(t,"-image"))}},sC=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:sj(i,t),s=sA[t.type];if(!s)throw Error("Unknown component type: ".concat(t.type,"."));return(0,_.jsx)(s,{id:a,node:t,form:r},a)};function sM(e,t){return e.map(function(e,r){return"string"==typeof e?(0,sx.unescape)(e):(0,_.jsx)(sC,{id:"".concat(t,"-text-child-").concat(r),node:e},"".concat(t,"-text-child-").concat(r))})}var sN=sS()(function(e){var t=e.type,r=e.props.name,n=function(e){if(!an(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,d.remove0x)((0,d.bytesToHex)(eM(JSON.stringify({type:t,name:null!=r?r:null,children:n}))))});function sj(e,t){var r,n=sN(t),i=(null!==(r=e[n])&&void 0!==r?r:0)+1;return e[n]=i,"".concat(n,"_").concat(i)}var sk=function(e){var t=e.content,r=sj({},t);return(0,_.jsx)(se,{children:(0,_.jsx)(sC,{node:t,id:r})})};function sI(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,_.jsx)(nz,{cursor:"pointer",onClick:function(){r(n)},children:t})},lv=function(e){var t=e.onClick;return(0,_.jsxs)(k.Box,{marginBottom:"4",children:[(0,_.jsx)(k.Text,{fontWeight:"500",fontSize:"xs",marginBottom:"1",children:"Transaction presets"}),(0,_.jsx)(k.Flex,{gap:"2",children:lg.map(function(e,r){var n,i,o=e.name,a=e.transaction;return(0,m.createElement)(lb,(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 lS={chainId:"eip155:1",origin:"metamask.io",from:"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",to:"0x9f2817015caF6607C1198fB943A8241652EE8906",value:"0.01",gas:"21000",nonce:"5",maxFeePerGas:"10",maxPriorityFeePerGas:"1",data:"0x"},lE=function(){var e,t,r,n,i,o,a,s,l,u,c,p=F(lf).request,d=null!==(c=null==p?void 0:p.params)&&void 0!==c?c:{},f=d.chainId,m=d.transactionOrigin,h=d.transaction;lS.chainId,lS.origin;var y=lD(lS,["chainId","origin"]),g=(0,s3.useForm)({defaultValues:lx({chainId:null!=f?f:lS.chainId,transactionOrigin:null!=m?m:lS.origin},null!=h?h:y)}),b=g.handleSubmit,v=g.register,x=g.setValue,D=g.formState.errors,S=j();return(0,_.jsxs)(k.Flex,{as:"form",flexDirection:"column",flex:"1",onSubmit:b(function(e){var t=e.chainId,r=e.transactionOrigin,n=lD(e,["chainId","transactionOrigin"]);S(rq({origin:"",handler:u8.OnTransaction,request:{jsonrpc:"2.0",method:"onTransaction",params:{chainId:t,transaction:ly(n),transactionOrigin:r}}}))}),id:"request-form",children:[(0,_.jsx)(lv,{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,_.jsxs)(k.Flex,{gap:"2",children:[(0,_.jsxs)(k.FormControl,{isInvalid:!!D.chainId,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"chainId",children:"Chain ID"}),(0,_.jsx)(k.Input,lx({id:"chainId",placeholder:lS.chainId,fontFamily:"code"},v("chainId"))),(0,_.jsx)(k.FormErrorMessage,{children:null===(e=D.chainId)||void 0===e?void 0:e.message})]}),(0,_.jsxs)(k.FormControl,{isInvalid:!!D.transactionOrigin,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"origin",children:"Transaction Origin"}),(0,_.jsx)(k.Input,lx({id:"origin",placeholder:lS.origin,fontFamily:"code"},v("transactionOrigin"))),(0,_.jsx)(k.FormErrorMessage,{children:null===(t=D.transactionOrigin)||void 0===t?void 0:t.message})]})]}),(0,_.jsxs)(k.FormControl,{isInvalid:!!D.from,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"from",children:"From Address"}),(0,_.jsx)(k.Input,lx({id:"from",placeholder:lS.from,fontFamily:"code"},v("from"))),(0,_.jsx)(k.FormErrorMessage,{children:null===(r=D.from)||void 0===r?void 0:r.message})]}),(0,_.jsxs)(k.FormControl,{isInvalid:!!D.to,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"to",children:"To Address"}),(0,_.jsx)(k.Input,lx({id:"to",placeholder:lS.to,fontFamily:"code"},v("to"))),(0,_.jsx)(k.FormErrorMessage,{children:null===(n=D.to)||void 0===n?void 0:n.message})]}),(0,_.jsxs)(k.FormControl,{isInvalid:!!D.value,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"value",children:"Value"}),(0,_.jsxs)(k.InputGroup,{children:[(0,_.jsx)(k.Input,lx({id:"value",placeholder:lS.value,fontFamily:"code"},v("value"))),(0,_.jsx)(k.InputRightAddon,{children:"ETH",fontSize:"sm"})]}),(0,_.jsx)(k.FormErrorMessage,{children:null===(i=D.value)||void 0===i?void 0:i.message})]}),(0,_.jsxs)(k.Flex,{gap:"2",children:[(0,_.jsxs)(k.FormControl,{isInvalid:!!D.gas,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"gas",children:"Gas Limit"}),(0,_.jsx)(k.Input,lx({id:"gas",placeholder:lS.gas,fontFamily:"code"},v("gas"))),(0,_.jsx)(k.FormErrorMessage,{children:null===(o=D.gas)||void 0===o?void 0:o.message})]}),(0,_.jsxs)(k.FormControl,{isInvalid:!!D.nonce,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"nonce",children:"Nonce"}),(0,_.jsx)(k.Input,lx({id:"nonce",placeholder:lS.nonce,fontFamily:"code"},v("nonce"))),(0,_.jsx)(k.FormErrorMessage,{children:null===(a=D.nonce)||void 0===a?void 0:a.message})]})]}),(0,_.jsxs)(k.Flex,{gap:"2",children:[(0,_.jsxs)(k.FormControl,{isInvalid:!!D.maxFeePerGas,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"maxFeePerGas",children:"Max Fee Per Gas"}),(0,_.jsxs)(k.InputGroup,{children:[(0,_.jsx)(k.Input,lx({id:"maxFeePerGas",placeholder:lS.maxFeePerGas,fontFamily:"code"},v("maxFeePerGas"))),(0,_.jsx)(k.InputRightAddon,{children:"GWEI",fontSize:"sm"})]}),(0,_.jsx)(k.FormErrorMessage,{children:null===(s=D.maxFeePerGas)||void 0===s?void 0:s.message})]}),(0,_.jsxs)(k.FormControl,{isInvalid:!!D.maxPriorityFeePerGas,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"maxPriorityFeePerGas",children:"Max Priority Fee Per Gas"}),(0,_.jsxs)(k.InputGroup,{children:[(0,_.jsx)(k.Input,lx({id:"maxPriorityFeePerGas",placeholder:lS.maxPriorityFeePerGas,fontFamily:"code"},v("maxPriorityFeePerGas"))),(0,_.jsx)(k.InputRightAddon,{children:"GWEI",fontSize:"sm"})]}),(0,_.jsx)(k.FormErrorMessage,{children:null===(l=D.maxPriorityFeePerGas)||void 0===l?void 0:l.message})]})]}),(0,_.jsxs)(k.FormControl,{isInvalid:!!D.data,children:[(0,_.jsx)(k.FormLabel,{htmlFor:"data",children:"Data"}),(0,_.jsx)(k.Textarea,lx({id:"data",placeholder:lS.data,fontFamily:"code"},v("data"))),(0,_.jsx)(k.FormErrorMessage,{children:null===(u=D.data)||void 0===u?void 0:u.message})]})]})},lT=(0,h.createHashRouter)((0,h.createRoutesFromElements)((0,_.jsxs)(h.Route,{element:(0,_.jsx)(function(){return(0,_.jsxs)(k.Flex,{direction:"column",height:"100vh",children:[(0,_.jsx)(r9,{}),(0,_.jsxs)(k.Flex,{direction:"row",flex:"1",overflow:"hidden",children:[(0,_.jsx)(nv,{}),(0,_.jsxs)(k.Flex,{direction:"column",width:"full",children:[(0,_.jsx)(k.Flex,{flex:"1",overflow:"hidden",children:(0,_.jsx)(h.Outlet,{})}),(0,_.jsx)(Y,{})]})]})]})},{}),children:[(0,_.jsx)(h.Route,{path:"/",element:(0,_.jsx)(h.Navigate,{to:"/handler/".concat(u8.OnRpcRequest),replace:!0})}),(0,_.jsx)(h.Route,{path:"/builder",element:(0,_.jsx)(function(){var e,t,r=sz((0,m.useState)(2),2),n=r[0],i=r[1],o=sz((0,m.useState)([{id:1,parent:0,text:"Box",droppable:!0,data:nS({children:null})}]),2),a=o[0],s=o[1];return(0,_.jsx)(k.Flex,{width:"100%",direction:"column",overflow:"hidden",children:(0,_.jsxs)(k.Flex,{direction:"row",flex:"1",overflow:"hidden",children:[(0,_.jsx)(k.Flex,{direction:"column",flex:"1",width:"50%",overflow:"hidden",children:(0,_.jsxs)(k.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,_.jsx)(k.TabList,{children:(0,_.jsx)(k.Tab,{children:"Builder"})}),(0,_.jsx)(k.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:(0,_.jsxs)(k.TabPanel,{display:"flex",flexDirection:"column",flex:"1",overflowY:"auto",children:[(0,_.jsx)(nJ,{nextId:n,incrementId:function(){i(function(e){return e+1})}}),(0,_.jsx)(az,{items:a,setItems:s})]})})]})}),(0,_.jsx)(k.Box,{display:"flex",flexDirection:"column",flex:"1",width:"50%",borderLeft:"1px solid",borderColor:"border.default",children:(0,_.jsxs)(k.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,_.jsxs)(k.TabList,{children:[(0,_.jsx)(k.Tab,{children:"Result"}),(0,_.jsx)(k.Tab,{children:"Code"})]}),(0,_.jsxs)(k.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,_.jsx)(k.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"4",children:(0,_.jsx)(sL,{items:a})}),(0,_.jsx)(k.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"0",children:(0,_.jsx)(nC,{border:"none",value:(t=(function e(t){var r=new Set;r.add(t.type);var n=ao(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),an(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=ay(a)).join(", "),ap().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,d.hasProperty)(o,"children")){var s=e(o.children,r+1);return"".concat(n,"<").concat(i).concat(as(o),">\n").concat(s).concat(n,"").concat(i,">").concat(a)}return"".concat(n,"<").concat(i).concat(as(o)," />").concat(a)}(e),");\n"),{parser:"typescript",plugins:[au()],printWidth:80,tabWidth:2,singleQuote:!0,trailingComma:"all"})),language:"typescript",options:{readOnly:!0}})})]})]})})]})})},{})}),(0,_.jsx)(h.Route,{path:"/manifest",element:(0,_.jsx)(function(){var e=F(r3);return(0,_.jsx)(k.Flex,{width:"100%",direction:"column",overflow:"hidden",children:(0,_.jsxs)(k.Flex,{direction:"row",flex:"1",overflow:"hidden",children:[(0,_.jsx)(k.Flex,{direction:"column",flex:"1",width:"50%",overflow:"hidden",children:(0,_.jsxs)(k.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,_.jsx)(k.TabList,{children:(0,_.jsx)(k.Tab,{children:"Validation"})}),(0,_.jsx)(k.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:(0,_.jsx)(k.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"0",children:(0,_.jsx)(sq,{})})})]})}),(0,_.jsx)(k.Box,{display:"flex",flexDirection:"column",flex:"1",width:"50%",borderLeft:"1px solid",borderColor:"border.default",children:(0,_.jsxs)(k.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,_.jsx)(k.TabList,{children:(0,_.jsx)(k.Tab,{children:"Manifest"})}),(0,_.jsx)(k.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:(0,_.jsx)(k.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"0",children:(0,_.jsx)(nC,{border:"none",value:JSON.stringify(e,null,2),options:{readOnly:!0,wordWrap:"on"}})})})]})})]})})},{})}),(0,_.jsxs)(h.Route,{path:"/handler",element:(0,_.jsx)(function(){var e,t=function(e){if(Array.isArray(e))return e}(e=(0,m.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 s5(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 s5(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=F(rX);return(0,_.jsx)(k.Flex,{width:"100%",direction:"column",overflow:"hidden",children:(0,_.jsxs)(k.Flex,{direction:"row",flex:"1",overflow:"hidden",children:[(0,_.jsx)(sJ,{isTest:!1,children:(0,_.jsx)(k.Flex,{direction:"column",flex:"1",width:"50%",overflow:"hidden",children:(0,_.jsxs)(k.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",isLazy:!0,onChange:n,children:[(0,_.jsx)(sZ,{}),(0,_.jsxs)(k.TabList,{alignItems:"center",children:[(0,_.jsx)(k.Tab,{children:"Request"}),(0,_.jsx)(k.Tab,{children:"History"}),0===r&&(0,_.jsx)(k.Box,{marginLeft:"auto",children:(0,_.jsx)(sG,{})})]}),(0,_.jsxs)(k.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,_.jsx)(k.TabPanel,{display:"flex",flexDirection:"column",flex:"1",overflowY:"auto","data-testid":"tab-request",children:(0,_.jsx)(h.Outlet,{})}),(0,_.jsx)(k.TabPanel,{padding:"0",display:"flex",flexDirection:"column",flex:"1",overflowY:"auto",children:(0,_.jsx)(sW,{})})]})]})})}),(0,_.jsx)(k.Box,{display:"flex",flexDirection:"column",flex:"1",width:"50%",borderLeft:"1px solid",borderColor:"border.default",children:(0,_.jsxs)(k.Tabs,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,_.jsx)(sZ,{}),(0,_.jsx)(sX,{}),(0,_.jsxs)(k.TabList,{children:[(0,_.jsx)(k.Tab,{children:"Response"}),i&&(0,_.jsx)(k.Tab,{children:"UI"})]}),(0,_.jsxs)(k.TabPanels,{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden",children:[(0,_.jsx)(k.TabPanel,{display:"flex",flexDirection:"column",flex:"1",padding:"0","data-testid":"tab-response",children:(0,_.jsx)(s0,{})}),i&&(0,_.jsx)(k.TabPanel,{overflowY:"auto","data-testid":"tab-ui",children:(0,_.jsx)(s6,{})})]})]})})]})})},{}),children:[(0,_.jsx)(h.Route,{path:"/handler/".concat(u8.OnRpcRequest),element:(0,_.jsx)(function(){return(0,_.jsx)(lr,{})},{})}),(0,_.jsx)(h.Route,{path:"/handler/".concat(u8.OnCronjob),element:(0,_.jsx)(function(){return(0,_.jsx)(lc,{})},{})}),(0,_.jsx)(h.Route,{path:"/handler/".concat(u8.OnTransaction),element:(0,_.jsx)(function(){return(0,_.jsx)(lE,{})},{})})]})]})));function lw(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:uR(e)?2:uz(e)?3:0}function uF(e,t){return 2===uP(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function uL(e,t,r){var n=uP(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function uR(e){return cT&&e instanceof Map}function uz(e){return cw&&e instanceof Set}function uB(e){return e.o||e.t}function uU(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=cI(e);delete t[cN];for(var r=ck(t),n=0;n1&&(e.set=e.add=e.clear=e.delete=uJ),Object.freeze(e),t&&uO(e,function(e,t){return uq(t,!0)},!0)),e}function uJ(){uj(2)}function u$(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function uK(e){var t=cO[e];return t||uj(18,e),t}function uY(e,t){t&&(uK("Patches"),e.u=[],e.s=[],e.v=t)}function uV(e){uW(e),e.p.forEach(uH),e.p=null}function uW(e){e===cS&&(cS=e.l)}function uQ(e){return cS={p:[],l:cS,h:e,m:!0,_:0}}function uH(e){var t=e[cN];0===t.i||1===t.i?t.j():t.g=!0}function uG(e,t){t._=t.p.length;var r=t.p[0],n=void 0!==e&&e!==r;return t.h.O||uK("ES5").S(t,e,n),n?(r[cN].P&&(uV(t),uj(4)),uI(e)&&(e=uZ(t,e),t.l||u0(t,e)),t.u&&uK("Patches").M(r[cN].t,e,t.u,t.s)):e=uZ(t,r,[]),uV(t),t.u&&t.v(t.u,t.s),e!==cC?e:void 0}function uZ(e,t,r){if(u$(t))return t;var n=t[cN];if(!n)return uO(t,function(i,o){return uX(e,n,t,i,o,r)},!0),t;if(n.A!==e)return t;if(!n.P)return u0(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var i=4===n.i||5===n.i?n.o=uU(n.k):n.o,o=i,a=!1;3===n.i&&(o=new Set(i),i.clear(),a=!0),uO(o,function(t,o){return uX(e,n,i,t,o,r,a)}),u0(e,i,!1),r&&e.u&&uK("Patches").N(n,r,e.u,e.s)}return n.o}function uX(e,t,r,n,i,o,a){if(uk(i)){var s=uZ(e,i,o&&t&&3!==t.i&&!uF(t.R,n)?o.concat(n):void 0);if(uL(r,n,s),!uk(s))return;e.m=!1}else a&&r.add(i);if(uI(i)&&!u$(i)){if(!e.h.D&&e._<1)return;uZ(e,i),t&&t.A.l||u0(e,i)}}function u0(e,t,r){void 0===r&&(r=!1),!e.l&&e.h.D&&e.m&&uq(t,r)}function u1(e,t){var r=e[cN];return(r?uB(r):e)[t]}function u2(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 u3(e){e.P||(e.P=!0,e.l&&u3(e.l))}function u4(e){e.o||(e.o=uU(e.t))}function u6(e,t,r){var n,i,o,a,s,l,u,c=uR(t)?uK("MapSet").F(t,r):uz(t)?uK("MapSet").T(t,r):e.O?(o=i={i:(n=Array.isArray(t))?1:0,A:r?r.A:cS,P:!1,I:!1,R:{},l:r,t:t,k:null,o:null,j:null,C:!1},a=cP,n&&(o=[i],a=cF),l=(s=Proxy.revocable(o,a)).revoke,u=s.proxy,i.k=u,i.j=l,u):uK("ES5").J(t,r);return(r?r.A:cS).p.push(c),c}function u5(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return uU(e)}var u8,u7,u9,ce,ct,cr,cn,ci,co,ca,cs,cl,cu,cc,cp,c_,cd,cf,cm,ch,cy,cg,cb,cv,cx,cD,cS,cE="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),cT="undefined"!=typeof Map,cw="undefined"!=typeof Set,cA="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,cC=cE?Symbol.for("immer-nothing"):((cD={})["immer-nothing"]=!0,cD),cM=cE?Symbol.for("immer-draftable"):"__$immer_draftable",cN=cE?Symbol.for("immer-state"):"__$immer_state",cj=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),ck="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,cI=Object.getOwnPropertyDescriptors||function(e){var t={};return ck(e).forEach(function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)}),t},cO={},cP={get:function(e,t){if(t===cN)return e;var r,n,i=uB(e);if(!uF(i,t))return(n=u2(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||!uI(o)?o:o===u1(e.t,t)?(u4(e),e.o[t]=u6(e.A.h,o,e)):o},has:function(e,t){return t in uB(e)},ownKeys:function(e){return Reflect.ownKeys(uB(e))},set:function(e,t,r){var n=u2(uB(e),t);if(null==n?void 0:n.set)return n.set.call(e.k,r),!0;if(!e.P){var i=u1(uB(e),t),o=null==i?void 0:i[cN];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||uF(e.t,t)))return!0;u4(e),u3(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!==u1(e.t,t)||t in e.t?(e.R[t]=!1,u4(e),u3(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=uB(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(){uj(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){uj(12)}},cF={};uO(cP,function(e,t){cF[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),cF.deleteProperty=function(e,t){return cF.set.call(this,e,t,void 0)},cF.set=function(e,t,r){return cP.set.call(this,e[0],t,r,e[0])};var cL=new(function(){function e(e){var t=this;this.O=cA,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=uK("Patches").$;return uk(e)?i(e,t):this.produce(e,function(e){return i(e,t)})},e}());cL.produce,cL.produceWithPatches.bind(cL),cL.setAutoFreeze.bind(cL),cL.setUseProxies.bind(cL),cL.applyPatches.bind(cL),cL.createDraft.bind(cL),cL.finishDraft.bind(cL);let cR=(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 cz(e){var t;return(0,d.isPlainObject)(e)&&(0,d.hasProperty)(e,"type")&&(0,d.hasProperty)(e,"props")&&(0,d.hasProperty)(e,"key")?e:(t=function e(t){switch(t.type){case cc.Panel:return t.children.reduce(function(t,r){return t+e(r)},0);case cc.Row:return e(t.value);case cc.Text:return t.value.length;default:return 0}}(e),(0,d.assert)(t<=5e4,"The text in a Snap UI may not be larger than ".concat(50," kB.")),function e(t){switch(t.type){case cc.Address:return iW(i0,{address:t.value});case cc.Button:return iW(nO,{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 cc.Copyable:return iW(nk,{value:t.value,sensitive:t.sensitive});case cc.Divider:return iW(nj,{});case cc.Form:return iW(nP,{name:t.name,children:o9(t.children.map(e))});case cc.Heading:return iW(nM,{children:t.value});case cc.Image:return iW(nI,{src:t.value});case cc.Input:return iW(nF,{label:t.label,error:t.error,children:iW(nL,{name:t.name,type:t.inputType,value:t.value,placeholder:t.placeholder})});case cc.Panel:return iW(nS,{children:o9(t.children.map(e))});case cc.Row:return iW(i1,{label:t.label,variant:t.variant,children:e(t.value)});case cc.Spinner:return iW(i2,{});case cc.Text:var r,n;return iW(nN,{children:o9((r=o4(t.value,{gfm:!1}),n=[],o3(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 o6(e)}(t=r.flatMap(at))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||o8(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,d.assertExhaustive)(t)}}(e))}function cB(e,t){(0,d.assert)(void 0===e[t],'Duplicate component names are not allowed, found multiple instances of: "'.concat(t,'".'))}function cU(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=ao(e)[0])||void 0===t?void 0:t.props.value;case"RadioGroup":return null===(r=ao(e)[0])||void 0===r?void 0:r.props.value;case"Selector":return null===(n=ao(e)[0])||void 0===n?void 0:n.props.value;case"Checkbox":return!1;default:return null}}(t))&&void 0!==o?o:null}function cq(e,t){var r={},n=[];return aa(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){cB(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];cB(a,t.props.name),a[t.props.name]=cU(e,t,o.name);return}("Input"===t.type||"Dropdown"===t.type||"RadioGroup"===t.type||"FileInput"===t.type||"Checkbox"===t.type||"Selector"===t.type)&&(cB(r,t.props.name),r[t.props.name]=cU(e,t))}),r}function cJ(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c$(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 cK(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){c$(o,n,i,a,s,"next",e)}function s(e){c$(o,n,i,a,s,"throw",e)}a(void 0)})}}function cY(e,t,r){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return r}function cV(e,t){(function(e,t){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function cW(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]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===n[2]||n[2],[4,new Promise(function(n,i){var o=document.createElement("iframe");o.setAttribute("id",t),o.setAttribute("data-testid","snaps-iframe"),r&&o.setAttribute("sandbox","allow-scripts"),o.setAttribute("src",e),document.body.appendChild(o),o.addEventListener("load",function(){o.contentWindow?n(o.contentWindow):i(Error('iframe.contentWindow not present on load for job "'.concat(t,'".')))})})];case 1:return[2,i.sent()]}})},(pp=function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){pc(o,n,i,a,s,"next",e)}function s(e){pc(o,n,i,a,s,"throw",e)}a(void 0)})}).apply(this,arguments)}var p_=r(9952),pd=r.n(p_),pf={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},pm={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};function ph(e,t="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(e)){let t=e.toString();if((0,d.hasProperty)(pm,t))return pm[t].message;if(e>=-32099&&e<=-32e3)return"Unspecified server error."}return t}function py(e){return Object.getOwnPropertyNames(e).reduce((t,r)=>{let n=e[r];return(0,d.isValidJson)(n)&&(t[r]=n),t},{})}ph(pf.rpc.internal);var pg=r(7847),pb=r.n(pg),pv=class extends Error{constructor(e,t,r){var n=(...e)=>{super(...e)};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,d.isObject)(e)&&(0,d.hasProperty)(e,"cause")&&(0,d.isObject)(e.cause)})(r)?(n(t,{cause:r.cause}),(0,d.hasProperty)(this,"cause")||Object.assign(this,{cause:r.cause})):n(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,d.isPlainObject)(this.data)&&(t.data.cause=Array.isArray(e=this.data.cause)?e.map(e=>(0,d.isValidJson)(e)?e:(0,d.isObject)(e)?py(e):null):(0,d.isObject)(e)?py(e):(0,d.isValidJson)(e)?e:null)),this.stack&&(t.stack=this.stack),t}toString(){return pb()(this.serialize(),pD,2)}},px=class extends pv{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 pD(e,t){if("[Circular]"!==t)return t}var pS={parse:e=>pT(pf.rpc.parse,e),invalidRequest:e=>pT(pf.rpc.invalidRequest,e),invalidParams:e=>pT(pf.rpc.invalidParams,e),methodNotFound:e=>pT(pf.rpc.methodNotFound,e),internal:e=>pT(pf.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 pT(t,e)},invalidInput:e=>pT(pf.rpc.invalidInput,e),resourceNotFound:e=>pT(pf.rpc.resourceNotFound,e),resourceUnavailable:e=>pT(pf.rpc.resourceUnavailable,e),transactionRejected:e=>pT(pf.rpc.transactionRejected,e),methodNotSupported:e=>pT(pf.rpc.methodNotSupported,e),limitExceeded:e=>pT(pf.rpc.limitExceeded,e)},pE={userRejectedRequest:e=>pw(pf.provider.userRejectedRequest,e),unauthorized:e=>pw(pf.provider.unauthorized,e),unsupportedMethod:e=>pw(pf.provider.unsupportedMethod,e),disconnected:e=>pw(pf.provider.disconnected,e),chainDisconnected:e=>pw(pf.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 px(t,r,n)}};function pT(e,t){let[r,n]=pA(t);return new pv(e,r??ph(e),n)}function pw(e,t){let[r,n]=pA(t);return new px(e,r??ph(e),n)}function pA(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 pC(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,d.assert)("paused"===this.status||"running"===this.status,Error("Tried to cancel a not running Timer")),this.onFinish(!1)}},{key:"finish",value:function(){(0,d.assert)("finished"!==this.status,Error("Tried to finish a finished Timer.")),this.onFinish(!0)}},{key:"pause",value:function(){(0,d.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,d.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,d.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,d.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()}}],pk(r.prototype,e),t&&pk(r,t),r}();function pO(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 pP(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){pO(o,n,i,a,s,"next",e)}function s(e){pO(o,n,i,a,s,"throw",e)}a(void 0)})}}function pF(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]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}})),_H(i,_C.targetName,_y(function(e){return{caveats:[{type:u9.KeyringOrigin,value:e}]}})),_H(i,_J.targetName,_y(function(e){return!e||!(0,d.isObject)(e)||(0,d.isObject)(e)&&0===Object.keys(e).length?{caveats:null}:{caveats:[{type:u9.SignatureOrigin,value:(0,d.hasProperty)(e,"allowSignatureOrigin")&&e.allowSignatureOrigin}]}})),_H(i,_j.targetName,_h),_H(i,_T.targetName,_h),i);_H(o={},u8.OnRpcRequest,_B.targetName),_H(o,u8.OnTransaction,_Y.targetName),_H(o,u8.OnCronjob,_v.targetName),_H(o,u8.OnNameLookup,_O.targetName),_H(o,u8.OnInstall,_j.targetName),_H(o,u8.OnUpdate,_j.targetName),_H(o,u8.OnKeyringRequest,_C.targetName),_H(o,u8.OnHomePage,_T.targetName),_H(o,u8.OnSignature,_J.targetName),_H(o,u8.OnUserInput,null);let _0=BigInt(4294967296-1),_1=BigInt(32),_2=(e,t,r)=>e<>>32-r,_3=(e,t,r)=>t<>>32-r,_4=(e,t,r)=>t<>>64-r,_6=(e,t,r)=>e<>>64-r,_5=[],_8=[],_7=[],_9=BigInt(0),de=BigInt(1),dt=BigInt(2),dr=BigInt(7),dn=BigInt(256),di=BigInt(113);for(let e=0,t=de,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],_5.push(2*(5*n+r)),_8.push((e+1)*(e+2)/2%64);let i=_9;for(let e=0;e<7;e++)(t=(t<>dr)*di)%dn)&dt&&(i^=de<<(de<>_1&_0)}:{h:0|Number(e>>_1&_0),l:0|Number(e&_0)}}(e[i],t);[r[i],n[i]]=[o,a]}return[r,n]}(_7,!0),dl=(e,t,r)=>r>32?_4(e,t,r):_2(e,t,r),du=(e,t,r)=>r>32?_6(e,t,r):_3(e,t,r);class dc extends ev{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,eu(r),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ed(this.state)}keccak(){eh||eg(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=dl(o,a,1)^r[n],l=du(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=_8[r],o=dl(t,i,n),a=du(t,i,n),s=_5[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]^=da[n],e[1]^=ds[n]}r.fill(0)}(this.state32,this.rounds),eh||eg(this.state32),this.posOut=0,this.pos=0}update(e){ep(this);let{blockLen:t,state:r}=this;e=eb(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 eu(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(e_(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 dc(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 dp=ex(()=>new dc(136,1,32));function d_(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}(dp((0,d.concatBytes)([a,dp(s)]))),[4,e9.SLIP10Node.fromDerivationPath({derivationPath:[i,"bip32:".concat(o)].concat(dm(l)),curve:"secp256k1"})];case 1:return u=c.sent().privateKey,(0,d.assert)(u,"Failed to derive the entropy."),[2,(0,d.add0x)(u)]}})})).apply(this,arguments)}function db(e){return dv.apply(this,arguments)}function dv(){return(dv=df(function(e){var t,r,n,i;return dh(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,d.assertExhaustive)(e)}}(t),[4,e9.SLIP10Node.fromDerivationPath({curve:t,derivationPath:[r].concat(dm(n.slice(1).map(function(e){return"".concat(i,":").concat(e)})))})];case 1:return[2,o.sent()]}})})).apply(this,arguments)}function dx(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 dD="snap_getBip32Entropy",dS=Object.freeze({targetName:dD,specificationBuilder:function(e){var t,r,n,i,o=e.methodHooks;return{permissionType:ts.PermissionType.RestrictedMethod,targetName:dD,allowedCaveats:[u9.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 pS.invalidParams({message:'Invalid "coinType" parameter. Coin type must be a non-negative integer.'});if(tD.includes(e.coinType))throw pS.invalidParams({message:"Coin type ".concat(e.coinType," is forbidden.")})}var dz=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}({},u9.PermittedCoinTypes,Object.freeze({type:u9.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,d.isObject)(e))throw pS.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(u).includes(i))throw pS.invalidParams({message:'Must specify a valid manage state "operation".'});if(void 0!==a&&"boolean"!=typeof a)throw pS.invalidParams({message:'"encrypted" parameter must be a boolean if specified.'});if(i===u.UpdateState){if(!(0,d.isObject)(o))throw pS.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,d.getJsonSize)(o)}catch(e){throw pS.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 pS.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!==u.ClearState))return[3,2];return[4,n(!0)];case 1:f.sent(),f.label=2;case 2:switch(c.operation){case u.ClearState:return[3,3];case u.GetState:return[3,4];case u.UpdateState:return[3,6]}return[3,8];case 3:return i(l,_),[2,null];case 4:return[4,o(l,_)];case 5:return[2,f.sent()];case 6:return[4,a(l,c.newState,_)];case 7:return f.sent(),[2,null];case 8:throw pS.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){fI(o,n,i,a,s,"next",e)}function s(e){fI(o,n,i,a,s,"throw",e)}a(void 0)})},function(e){return r.apply(this,arguments)}),subjectTypes:[ts.SubjectType.Snap]}},methodHooks:{getUnlockPromise:!0,clearSnapState:!0,getSnapState:!0,updateSnapState:!0}});function fF(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 fL="snap_notify",fR=Object.freeze({targetName:fL,specificationBuilder:function(e){var t,r,n,i,o,a,s=e.allowedCaveats,l=e.methodHooks;return{permissionType:ts.PermissionType.RestrictedMethod,targetName:fL,allowedCaveats:void 0===s?null:s,methodImplementation:(n=l.showNativeNotification,i=l.showInAppNotification,o=l.isOnPhishingList,a=l.maybeUpdatePhishingList,t=function(e){var t,r,s;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 pS.invalidParams({message:'Must specify a non-empty string "message" less than 50 characters long.'});if(t===cb.InApp&&(n||r.length>=500))throw pS.invalidParams({message:'Must specify a non-empty string "message" less than 500 characters long.'});return e}(t),[4,a()];case 1:switch(l.sent(),function(e,t){var r=(a=o4(e,{gfm:!1}),s=[],o3(a,function(e){"link"===e.type&&s.push(e)}),s),n=!0,i=!1,o=void 0;try{for(var a,s,l,u=r[Symbol.iterator]();!(n=(l=u.next()).done);n=!0){var c=l.value;ar(c.href,t)}}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}}(s.message,o),s.type){case cb.Native:return[3,2];case cb.InApp:return[3,4]}return[3,6];case 2:return[4,n(r,s)];case 3:case 5:return[2,l.sent()];case 4:return[4,i(r,s)];case 6:throw pS.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){fF(o,n,i,a,s,"next",e)}function s(e){fF(o,n,i,a,s,"throw",e)}a(void 0)})},function(e){return r.apply(this,arguments)}),subjectTypes:[ts.SubjectType.Snap]}},methodHooks:{showNativeNotification:!0,showInAppNotification:!0,isOnPhishingList:!0,maybeUpdatePhishingList:!0}});function fz(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var fB=(fz(c={},fo.targetName,fo),fz(c,dS.targetName,dS),fz(c,dA.targetName,dA),fz(c,dN.targetName,dN),fz(c,fD.targetName,fD),fz(c,dF.targetName,dF),fz(c,fP.targetName,fP),fz(c,fR.targetName,fR),fz(c,fk.targetName,fk),fz(c,fT.targetName,fT),fz(c,fC.targetName,fC),c);function fU(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]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]:p.Base64,[4,uf(r6)];case 1:if(n=s.sent(),i=tJ(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,up(mv,o,t)];case 2:return[2,s.sent()]}})}function mN(e,t){return mS(this,function(r){switch(r.label){case 0:return[4,uf(rW)];case 1:return[4,up([r.sent(),"createInterface"],e,t)];case 2:return[2,r.sent()]}})}function mj(e,t){return mS(this,function(r){switch(r.label){case 0:return[4,uf(rW)];case 1:return[4,up([r.sent(),"getInterface"],e,t)];case 2:return[2,r.sent()]}})}function mk(e,t,r){return mS(this,function(n){switch(n.label){case 0:return[4,uf(rW)];case 1:return[4,up([n.sent(),"updateInterface"],e,t,r)];case 2:return n.sent(),[4,up(mj,e,t)];case 3:return[4,ul(rF(mD({id:t},n.sent())))];case 4:return n.sent(),[2]}})}function mI(e,t){return mS(this,function(r){switch(r.label){case 0:return[4,uf(rW)];case 1:return[4,up([r.sent(),"getInterface"],e,t)];case 2:return[2,r.sent().state]}})}function mO(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 mP(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){mO(o,n,i,a,s,"next",e)}function s(e){mO(o,n,i,a,s,"throw",e)}a(void 0)})}}function mF(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),ht(this,"cache",new Map),ht(this,"validatedManifest",void 0),ht(this,"url",void 0),ht(this,"fetchFn",void 0),ht(this,"fetchOptions",void 0),(0,d.assertStruct)(e.toString(),e3,"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 m9(function(){var t,r,n,i,o;return hr(this,function(a){switch(a.label){case 0:if(e.validatedManifest)return[2,e.validatedManifest.clone()];return t=new URL(ce.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=e8(n=a.sent()),o=new eP({value:n,result:tq(i),path:ce.Manifest,data:{canonicalPath:t}}),e.validatedManifest=o,[2,e.manifest()]}})})()}},{key:"fetch",value:function(e){var t=this;return m9(function(){var r,n,i,o,a,s,l,u,c,p,_;return hr(this,function(f){switch(f.label){case 0:if(r=tJ(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 eP({value:"",path:r,data:{canonicalPath:u}}),[4,c.blob()];case 4:return _=f.sent(),(0,d.assert)(!t.cache.has(r),"Corrupted cache, multiple files with same path."),t.cache.set(r,{file:p,contents:_}),[2,t.fetch(r)]}})})()}},{key:"root",get:function(){return new URL(this.url)}},{key:"toCanonical",value:function(e){return(0,d.assert)(!e.startsWith("/"),"Tried to parse absolute path."),new URL(e,this.url)}}],he(r.prototype,e),t&&he(r,t),r}();function hi(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 ho(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){hi(o,n,i,a,s,"next",e)}function s(e){hi(o,n,i,a,s,"throw",e)}a(void 0)})}}function ha(e,t,r){if(!t.has(e))throw TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function hs(e,t){var r=ha(e,t,"get");return r.get?r.get.call(e):r.value}function hl(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,hc),hc.set(this,{writable:!0,value:void 0}),(0,d.assertStruct)(e.toString(),e1,"Invalid Snap Id"),(0,d.assert)(void 0===o.fetchOptions,"Currently adding fetch options to local: is unsupported."),i=new hn(new URL(e.toString().slice(ct.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=hA(function(e,t){var r,n,i,o,a,s,l;return hM(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 eZ.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=hA(function(e,t){var r,n,i,o,a,s,l;return hM(this,function(u){return(r=t.sourceCode,l=hC(tU.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 hj(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]