keyring-chatbot-agent-sdk-test 0.0.15 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,40 +1,103 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".chat-button{cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 12px #00000026;transition:all .3s ease;border-radius:16px}.chat-button:hover{transform:scale(1.1);box-shadow:0 6px 16px #0003}.chat-button:active{transform:scale(.95)}.chat-modal-overlay{position:fixed;top:0;left:0;width:100%;height:100%;background:transparent;display:flex;align-items:flex-end;justify-content:flex-end;z-index:9999;pointer-events:all;animation:fadeIn .2s ease}.chat-modal-overlay.chat-modal-overlay--left{justify-content:flex-start}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.chat-modal{width:90%;max-width:480px;height:700px;max-height:calc(100dvh - 64px);background:#f5f5f7;border-radius:14px;display:flex;flex-direction:column;overflow:hidden;box-shadow:0 20px 60px #0000004d;margin:20px;pointer-events:all;animation:slideUp .3s ease}@keyframes slideUp{0%{transform:translateY(30px);opacity:0}to{transform:translateY(0);opacity:1}}.chat-modal-header{background:#fff;padding:16px 20px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #e5e5e7}.chat-modal-header-left{display:flex;align-items:center;gap:12px}.keyring-logo{width:32px;height:32px}.chat-modal-header h3{margin:0;font-size:18px;font-weight:700;color:#1a1a1d}.close-button{background:transparent;border:none;cursor:pointer;padding:8px;border-radius:8px;color:#666;transition:all .2s}.close-button:hover{background:#f5f5f7;color:#000}.chat-user-info{background:#fff;padding:12px 20px;display:flex;align-items:center;gap:10px;border-bottom:1px solid #e5e5e7}.user-avatar{width:20px;height:20px;border-radius:50%}.user-avatar img{border-radius:50%}.user-wallet,.user-wallet a{font-size:14px;font-weight:500;color:#1a1a1d}.copy-address-btn{display:flex;align-items:center;justify-content:center;background:none;border:none;cursor:pointer;padding:3px;color:#999;border-radius:4px;transition:color .15s,background .15s;line-height:0}@media(min-width:640px){.copy-address-btn:hover{color:#1a1a1d;background:#f0f0f0}}.chat-modal-messages-wrapper{position:relative;flex:1;overflow:hidden;display:flex;flex-direction:column}.chat-modal-messages{flex:1;padding:20px;overflow-y:auto;display:flex;flex-direction:column;gap:12px}.date-separator{text-align:center;font-size:12px;font-weight:600;color:#666;background:#e5e5e7;padding:6px 16px;border-radius:12px;align-self:center;width:fit-content;margin:8px auto}.message{display:flex;animation:messageSlide .3s ease;position:relative}.message:hover .message-reply-button{opacity:1}@keyframes messageSlide{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.message-reply-button{position:absolute;top:50%;transform:translateY(-50%);background:#fff;border:1px solid #e5e5e7;border-radius:8px;padding:6px;cursor:pointer;opacity:0;transition:all .2s;box-shadow:0 2px 8px #0000001a;z-index:10}.message-bot .message-reply-button{right:20px}.message-user .message-reply-button{left:20px}.message-reply-button:hover{background:#f5f5f7;transform:translateY(-50%) scale(1.1)}.message-reply-button svg{display:block;width:16px;height:16px;color:#666}.message-bot{justify-content:flex-start}.message-user{justify-content:flex-end}.message-bubble{max-width:85%;padding:14px 16px;border-radius:20px}.message-bot .message-bubble{background:#fff;box-shadow:0 2px 8px #0000000f;border-bottom-left-radius:4px}.message-user .message-bubble{background:#5b7fff;color:#fff;border-bottom-right-radius:4px}.message-reply-to{background:#0000000d;padding:8px 12px;border-radius:6px;margin-bottom:8px;border-left:3px solid #5b7fff}.message-bot .message-reply-to{background:#f5f5f7}.message-user .message-reply-to{background:#ffffff26;border-left-color:#ffffff80}.message-reply-to-label{font-size:11px;font-weight:600;margin-bottom:4px}.message-bot .message-reply-to-label{color:#5b7fff}.message-user .message-reply-to-label{color:#ffffffe6}.message-reply-to-text{font-size:12px;opacity:.8;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.message-text{font-size:14px;line-height:1.5;margin-bottom:6px;word-wrap:break-word;white-space:pre-line}.message-bot .message-text{color:#1a1a1d}.message-user .message-text{color:#fff}.message-buttons{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px;margin-bottom:8px}.message-button{flex:1 1 calc(50% - 4px);min-width:100px;padding:10px 16px;background:#fffffff2;border:1px solid #e0e0e0;border-radius:12px;font-size:13px;font-weight:500;color:#1a1a1d;cursor:pointer;transition:all .2s ease;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.message-button.full-width{flex:1 1 100%;text-align:center;white-space:normal;padding:12px 16px;font-size:14px}@media(min-width:640px){.message-button:hover{background:#fff;border-color:#007aff;color:#007aff;transform:translateY(-1px);box-shadow:0 2px 8px #007aff26}.message-button:active{transform:translateY(0);box-shadow:0 1px 4px #007aff1a}}.message-user .message-button{background:#fff3;border-color:#ffffff4d;color:#fff}.message-user .message-button:hover{background:#ffffff4d;border-color:#ffffff80}.message-timestamp{font-size:11px;color:#999;display:flex;align-items:center;gap:4px;justify-content:flex-end}.message-user .message-timestamp{color:#ffffffb3}.check-icon{width:14px;height:14px}.typing-indicator .message-bubble{padding:12px 18px;display:flex;gap:6px;min-width:60px}.typing-dot{width:8px;height:8px;border-radius:50%;background:#999;animation:typingDot 1.4s infinite ease-in-out}.typing-dot:nth-child(1){animation-delay:0s}.typing-dot:nth-child(2){animation-delay:.2s}.typing-dot:nth-child(3){animation-delay:.4s}@keyframes typingDot{0%,60%,to{transform:translateY(0);opacity:.7}30%{transform:translateY(-8px);opacity:1}}.suggestions-container{display:flex;flex-direction:column;gap:10px;margin-top:8px}.suggestion-button{background:#d4d8f0;border:none;padding:12px 16px;border-radius:16px;display:flex;gap:12px;cursor:pointer;transition:all .2s;font-size:14px;font-weight:500;color:#1a1a1d;width:100%;text-align:center;align-items:center;justify-content:center}.suggestion-button:hover{background:#c5caeb;transform:translateY(-1px)}.suggestion-icon{font-size:18px}.chat-modal-input{padding:16px 20px;background:#fff;border-top:1px solid #e5e5e7;display:flex;flex-direction:column;gap:12px;box-shadow:0 -5px 8px 4px #0000000d}.reply-preview{background:#f5f5f7;padding:10px 14px;border-radius:6px;border-left:3px solid #5b7fff;display:flex;justify-content:space-between;align-items:flex-start;gap:10px}.reply-preview-content{flex:1;min-width:0}.reply-preview-label{font-size:11px;color:#5b7fff;font-weight:600;margin-bottom:4px}.reply-preview-text{font-size:13px;color:#666;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.reply-preview-close{background:transparent;border:none;cursor:pointer;padding:2px;color:#999;transition:color .2s;flex-shrink:0}.reply-preview-close:hover{color:#666}.chat-modal-input-row{display:flex;gap:12px;align-items:center}.chat-modal-input input{flex:1;padding:14px 18px;border:1px solid #e5e5e7;border-radius:24px;outline:none;font-size:16px;color:#1a1a1d;transition:all .2s}.chat-modal-input input::placeholder{color:#999}.chat-modal-input input:focus{border-color:#5b7fff;box-shadow:0 0 0 3px #5b7fff1a}.chat-modal-input input:disabled{opacity:.6;cursor:not-allowed;background:#f5f5f7}.send-button{width:44px;height:44px;border-radius:50%;background:#5b7fff;border:none;color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.send-button:hover:not(:disabled){background:#4a6fee;transform:scale(1.05)}.send-button:disabled{opacity:.4;cursor:not-allowed}.chat-modal-messages::-webkit-scrollbar{width:6px}.chat-modal-messages::-webkit-scrollbar-thumb{background:#d1d1d6;border-radius:3px}@media(max-width:640px){.chat-modal{width:100%;height:100dvh;max-height:100dvh;border-radius:0;margin:0}}.action-status{margin-top:8px;padding:6px 10px;border-radius:6px;font-size:.8em;font-weight:500}.action-status-submitted{background:#fef3c7;color:#92400e;border:1px solid #fde68a}.action-status-success{background:#d1fae5;color:#065f46;border:1px solid #a7f3d0}.action-status-fail{background:#fee2e2;color:#991b1b;border:1px solid #fca5a5}.message-content{display:block;word-wrap:break-word;overflow-wrap:break-word;max-width:100%;overflow:hidden;font-size:inherit;line-height:1.5}.mc-line{min-height:1.2em;word-break:break-word}.mc-empty-line{height:.5em}.mc-heading{font-weight:600;margin:.3em 0;word-break:break-word}.mc-h1{font-size:1.4em}.mc-h2{font-size:1.2em}.mc-h3{font-size:1.05em}.mc-inline-code{background:#afb8c133;padding:1px 5px;border-radius:3px;font-family:Monaco,Menlo,Ubuntu Mono,Consolas,monospace;font-size:.88em}.mc-codeblock{background:#f6f8fa;border:1px solid #d0d7de;border-radius:6px;margin:6px 0;overflow:hidden;max-width:100%}.mc-codeblock-lang{background:#e8ecf0;padding:3px 10px;font-size:.75em;font-weight:600;color:#57606a;text-transform:uppercase;font-family:Monaco,Menlo,monospace;border-bottom:1px solid #d0d7de}.mc-codeblock pre{margin:0;padding:10px;overflow-x:auto}.mc-codeblock code{font-family:Monaco,Menlo,Ubuntu Mono,Consolas,monospace;font-size:.85em;line-height:1.5;color:#24292f;white-space:pre}.mc-link{color:#0969da;text-decoration:none;word-break:break-word}.mc-link:hover{text-decoration:underline}.mc-image{max-width:150px;width:150px;height:150px;object-fit:contain;border-radius:8px;margin:8px 0;display:block}.mc-image-inline{width:20px;height:20px;border-radius:50%;margin:0 4px;display:inline-block;vertical-align:middle;object-fit:cover}.mc-blockquote{margin:4px 0;padding:2px 0 2px 12px;color:#57606a;border-left:3px solid #d0d7de}.mc-hr{height:1px;border:0;background:#d0d7de;margin:.4em 0}.message-content strong{font-weight:600}.message-content del{text-decoration:line-through}.action-form{background:#f8f9fb;border:1px solid #e2e6ea;border-radius:10px;padding:12px;margin-top:8px}.action-form-title{font-weight:600;font-size:.9em;margin-bottom:10px;color:#1a1a2e;display:flex;align-items:center;gap:6px}.action-form-general-error{background:#fef2f2;border:1px solid #fecaca;border-radius:8px;padding:10px 12px;margin-bottom:10px;font-size:.8em;color:#dc2626;font-weight:500;display:flex;align-items:center;gap:6px}.action-form-fields{display:flex;flex-direction:column;gap:8px}.action-form-field{display:flex;flex-direction:column;gap:3px}.action-form-field label{font-size:.75em;font-weight:500;color:#6b7280}.action-form-field input,.action-form-field textarea{padding:8px 10px;border:1px solid #d1d5db;border-radius:6px;font-size:16px;background:#fff;color:#1a1a2e;outline:none;transition:border-color .2s;font-family:inherit}.action-form-field textarea{resize:none;word-break:break-all}.action-form-field input:focus,.action-form-field textarea:focus{border-color:#6c5ce7;box-shadow:0 0 0 2px #6c5ce726}.action-form-field input.error,.action-form-field textarea.error{border-color:#ef4444}.action-form-field input.readonly,.action-form-field textarea.readonly{background:#f3f4f6;color:#6b7280;cursor:not-allowed;border-color:#e5e7eb}.action-form-field .field-error{font-size:.7em;color:#ef4444;margin-top:1px}.action-form-actions{display:flex;gap:8px;margin-top:10px}.action-form-submit{flex:1;padding:8px 14px;background:#6c5ce7;color:#fff;border:none;border-radius:6px;font-size:.85em;font-weight:500;cursor:pointer;transition:background .2s}.action-form-submit:hover:not(:disabled){background:#5a4bd1}.action-form-submit:disabled{background:#a5b4fc;cursor:not-allowed}.action-form-cancel{padding:8px 14px;background:transparent;color:#6b7280;border:1px solid #d1d5db;border-radius:6px;font-size:.85em;font-weight:500;cursor:pointer;transition:all .2s}.action-form-cancel:hover{background:#f3f4f6;color:#374151}.action-form-token-info{background:#eef2ff;border:1px solid #c7d2fe;border-radius:8px;padding:8px 10px;margin-bottom:10px}.token-info-row{display:flex;align-items:center;gap:8px}.token-info-logo{border-radius:50%;flex-shrink:0}.token-info-details{display:flex;flex-direction:column;gap:2px;min-width:0}.token-info-name{font-size:.8em;font-weight:600;color:#1a1a2e;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.token-info-balance{font-size:.75em;color:#4b5563}.token-info-usd{color:#6c5ce7;font-weight:500}.action-form-field-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:4px}.action-form-field-header label{margin-bottom:0}.action-form-pct-btns{display:inline-flex;gap:4px}.action-form-pct-btn{padding:1px 6px;font-size:.7em;font-weight:600;color:#6c5ce7;background:#eef2ff;border:1px solid #c7d2fe;border-radius:4px;cursor:pointer;transition:all .15s}@media(min-width:640px){.action-form-pct-btn:hover:not(:disabled){background:#6c5ce7;color:#fff}}.action-form-pct-btn:disabled{opacity:.5;cursor:not-allowed}.action-form-max-btn{font-weight:700}.scroll-to-bottom-btn{position:absolute;bottom:16px;right:20px;background:#1a1a1dd6;color:#fff;border:1px solid rgba(255,255,255,.12);border-radius:50%;width:36px;height:36px;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 12px #00000040;z-index:20;transition:background .15s,transform .15s,box-shadow .15s;animation:fadeInUp .18s ease}@keyframes fadeInUp{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@media(min-width:640px){.scroll-to-bottom-btn:hover{background:#2d2d35;box-shadow:0 6px 16px #0000004d;transform:scale(1.08)}}.scroll-to-bottom-btn:active{transform:scale(.96)}")),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
2
- (function(pt,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],I):(pt=typeof globalThis<"u"?globalThis:pt||self,I(pt.ChatWidgetSDK={},pt.jsxRuntime,pt.React))})(this,(function(pt,I,re){"use strict";const Ur="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHAAAABwCAYAAADG4PRLAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAfXSURBVHgB7Z1LbFRVGMe/c4YCAmKrEFiQWIIrNm13RE0olLRuTCq4w4C6Mbopo9GltFsVpmxQN1pJ2MkjcSMESrsgYdd2w8rGkrCA8GjFVintzPH878wZjrfzujPTe88p3y+ZzMydOxO4//s9z3dvBTWB7sxsqyTqF2q5k4R8nUh06s2thQeTZyZ4qOwU0bqJFkHjv6fbZqhBBNVJIJqiASFUN94SExl98CeVEsONiBlZQEu4E8QW1kTUSAvJoahCRhLw4OnZkyzc6qItcnD087ahWvevScB3MrPty6QuKaJOYuJgpoXEgVqsUVbboef07PElUhMsXqy045j3ZB72V9uxooCHtMskoUaIXWYS6GMuLyFsVdqprAuFeEqoQWISp1JcLClg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erqAqvThnLmWgWXGSbaH2OnvDWmVG6QhDhOTFMwwi2THC6sDtVMZAENebea7daJ7AAX/nUzprP98XqEM9QtoI0RUyjRqS2zg/Kxsp2YAFhYfnhMTeo3d5RQOsalLtcrms1//TyUbJOo0HUAAAAASUVORK5CYII=",Dr=re.memo(({onClick:e})=>{const t=n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),e())};return I.jsx("button",{className:"chat-button",onClick:e,onKeyDown:t,"aria-label":"Open chat",title:"Open chat support",type:"button",children:I.jsx("img",{src:Ur,width:56,height:56,alt:"Ask AI"})})});function at(e){const t={formatters:void 0,fees:void 0,serializers:void 0,...e};function n(s){return r=>{const a=typeof r=="function"?r(s):r,o={...s,...a};return Object.assign(o,{extend:n(o)})}}return Object.assign(t,{extend:n(t)})}const os="2.45.1";let vn={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${os}`};class fe extends Error{constructor(t,n={}){const s=n.cause instanceof fe?n.cause.details:n.cause?.message?n.cause.message:n.details,r=n.cause instanceof fe&&n.cause.docsPath||n.docsPath,a=vn.getDocsUrl?.({...n,docsPath:r}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...s?[`Details: ${s}`]:[],...vn.version?[`Version: ${vn.version}`]:[]].join(`
3
- `);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=s,this.docsPath=r,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=os}walk(t){return as(this,t)}}function as(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?as(e.cause,t):t?null:e}class An extends fe{constructor({max:t,min:n,signed:s,size:r,value:a}){super(`Number "${a}" is not in safe ${r?`${r*8}-bit ${s?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class Fr extends fe{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Bt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function Ve(e){return Bt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function tn(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,s=0;for(let r=0;r<n.length-1&&n[t==="left"?r:n.length-r-1].toString()==="0";r++)s++;return n=t==="left"?n.slice(s):n.slice(0,n.length-s),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}class is extends fe{constructor({offset:t,position:n,size:s}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${s}).`,{name:"SliceOffsetOutOfBoundsError"})}}class cs extends fe{constructor({size:t,targetSize:n,type:s}){super(`${s.charAt(0).toUpperCase()}${s.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}function Pt(e,{dir:t,size:n=32}={}){return typeof e=="string"?ht(e,{dir:t,size:n}):Mr(e,{dir:t,size:n})}function ht(e,{dir:t,size:n=32}={}){if(n===null)return e;const s=e.replace("0x","");if(s.length>n*2)throw new cs({size:Math.ceil(s.length/2),targetSize:n,type:"hex"});return`0x${s[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function Mr(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new cs({size:e.length,targetSize:n,type:"bytes"});const s=new Uint8Array(n);for(let r=0;r<n;r++){const a=t==="right";s[a?r:n-r-1]=e[a?r:e.length-r-1]}return s}const _r=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Nt(e,t={}){return typeof e=="number"||typeof e=="bigint"?le(e,t):typeof e=="string"?ds(e,t):typeof e=="boolean"?ls(e,t):it(e,t)}function ls(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Ot(n,{size:t.size}),Pt(n,{size:t.size})):n}function it(e,t={}){let n="";for(let r=0;r<e.length;r++)n+=_r[e[r]];const s=`0x${n}`;return typeof t.size=="number"?(Ot(s,{size:t.size}),Pt(s,{dir:"right",size:t.size})):s}function le(e,t={}){const{signed:n,size:s}=t,r=BigInt(e);let a;s?n?a=(1n<<BigInt(s)*8n-1n)-1n:a=2n**(BigInt(s)*8n)-1n:typeof e=="number"&&(a=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof a=="bigint"&&n?-a-1n:0;if(a&&r>a||r<o){const T=typeof e=="bigint"?"n":"";throw new An({max:a?`${a}${T}`:void 0,min:`${o}${T}`,signed:n,size:s,value:`${e}${T}`})}const c=`0x${(n&&r<0?(1n<<BigInt(s*8))+BigInt(r):r).toString(16)}`;return s?Pt(c,{size:s}):c}const Lr=new TextEncoder;function ds(e,t={}){const n=Lr.encode(e);return it(n,t)}const Hr=new TextEncoder;function kn(e,t={}){return typeof e=="number"||typeof e=="bigint"?Vr(e,t):typeof e=="boolean"?Rr(e,t):Bt(e)?At(e,t):fs(e,t)}function Rr(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(Ot(n,{size:t.size}),Pt(n,{size:t.size})):n}const ct={zero:48,nine:57,A:65,F:70,a:97,f:102};function us(e){if(e>=ct.zero&&e<=ct.nine)return e-ct.zero;if(e>=ct.A&&e<=ct.F)return e-(ct.A-10);if(e>=ct.a&&e<=ct.f)return e-(ct.a-10)}function At(e,t={}){let n=e;t.size&&(Ot(n,{size:t.size}),n=Pt(n,{dir:"right",size:t.size}));let s=n.slice(2);s.length%2&&(s=`0${s}`);const r=s.length/2,a=new Uint8Array(r);for(let o=0,c=0;o<r;o++){const T=us(s.charCodeAt(c++)),C=us(s.charCodeAt(c++));if(T===void 0||C===void 0)throw new fe(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);a[o]=T*16+C}return a}function Vr(e,t){const n=le(e,t);return At(n)}function fs(e,t={}){const n=Hr.encode(e);return typeof t.size=="number"?(Ot(n,{size:t.size}),Pt(n,{dir:"right",size:t.size})):n}function Ot(e,{size:t}){if(Ve(e)>t)throw new Fr({givenSize:Ve(e),maxSize:t})}function Ut(e,t={}){const{signed:n}=t;t.size&&Ot(e,{size:t.size});const s=BigInt(e);if(!n)return s;const r=(e.length-2)/2,a=(1n<<BigInt(r)*8n-1n)-1n;return s<=a?s:s-BigInt(`0x${"f".padStart(r*2,"f")}`)-1n}function nn(e,t={}){const n=Ut(e,t),s=Number(n);if(!Number.isSafeInteger(s))throw new An({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${n}n`});return s}function xn(e,t){return({exclude:n,format:s})=>({exclude:n,format:(r,a)=>{const o=t(r,a);if(n)for(const c of n)delete o[c];return{...o,...s(r,a)}},type:e})}const ps={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Tn(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?nn(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?nn(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?ps[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(n.authorizationList=Gr(e.authorizationList)),n.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof n.v=="bigint"){if(n.v===0n||n.v===27n)return 0;if(n.v===1n||n.v===28n)return 1;if(n.v>=35n)return n.v%2n===0n?1:0}})(),n.type==="legacy"&&(delete n.accessList,delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.yParity),n.type==="eip2930"&&(delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas),n.type==="eip1559"&&delete n.maxFeePerBlobGas,n}const Wr=xn("transaction",Tn);function Gr(e){return e.map(t=>({address:t.address,chainId:Number(t.chainId),nonce:Number(t.nonce),r:t.r,s:t.s,yParity:Number(t.yParity)}))}function zr(e,t){const n=(e.transactions??[]).map(s=>typeof s=="string"?s:Tn(s));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:n,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}const Yr=xn("block",zr);function jr(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}const qr={"0x0":"reverted","0x1":"success"};function Jr(e,t){const n={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(s=>jr(s)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?nn(e.transactionIndex):null,status:e.status?qr[e.status]:null,type:e.type?ps[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const Xr=xn("transactionReceipt",Jr),Kr={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Zr(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=Qr(e.authorizationList)),typeof e.accessList<"u"&&(n.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(n.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?n.blobs=e.blobs.map(s=>it(s)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=le(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=le(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=le(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=le(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=le(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=le(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=Kr[e.type]),typeof e.value<"u"&&(n.value=le(e.value)),n}function Qr(e){return e.map(t=>({address:t.address,r:t.r?le(BigInt(t.r)):t.r,s:t.s?le(BigInt(t.s)):t.s,chainId:le(t.chainId),nonce:le(t.nonce),...typeof t.yParity<"u"?{yParity:le(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:le(t.v)}:{}}))}const Dt=2n**256n-1n;function Ft(e){return typeof e[0]=="string"?kt(e):$r(e)}function $r(e){let t=0;for(const r of e)t+=r.length;const n=new Uint8Array(t);let s=0;for(const r of e)n.set(r,s),s+=r.length;return n}function kt(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}class hs extends fe{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class eo extends fe{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class to extends fe{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const no={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new to({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new eo({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new hs({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new hs({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function ms(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(no);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function xt(e,t="hex"){const n=gs(e),s=ms(new Uint8Array(n.length));return n.encode(s),t==="hex"?it(s.bytes):s.bytes}function gs(e){return Array.isArray(e)?so(e.map(t=>gs(t))):ro(e)}function so(e){const t=e.reduce((r,a)=>r+a.length,0),n=bs(t);return{length:t<=55?1+t:1+n+t,encode(r){t<=55?r.pushByte(192+t):(r.pushByte(247+n),n===1?r.pushUint8(t):n===2?r.pushUint16(t):n===3?r.pushUint24(t):r.pushUint32(t));for(const{encode:a}of e)a(r)}}}function ro(e){const t=typeof e=="string"?At(e):e,n=bs(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length,encode(r){t.length===1&&t[0]<128?r.pushBytes(t):t.length<=55?(r.pushByte(128+t.length),r.pushBytes(t)):(r.pushByte(183+n),n===1?r.pushUint8(t.length):n===2?r.pushUint16(t.length):n===3?r.pushUint24(t.length):r.pushUint32(t.length),r.pushBytes(t))}}}function bs(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new fe("Length is too large.")}const oo={gwei:9,wei:18},ao={ether:-9,wei:9};function Ue(e,t){let n=e.toString();const s=n.startsWith("-");s&&(n=n.slice(1)),n=n.padStart(t,"0");let[r,a]=[n.slice(0,n.length-t),n.slice(n.length-t)];return a=a.replace(/(0+)$/,""),`${s?"-":""}${r||"0"}${a?`.${a}`:""}`}function io(e,t="wei"){return Ue(e,oo[t])}function Tt(e,t="wei"){return Ue(e,ao[t])}function ws(e){const t=Object.entries(e).map(([s,r])=>r===void 0||r===!1?null:[s,r]).filter(Boolean),n=t.reduce((s,[r])=>Math.max(s,r.length),0);return t.map(([s,r])=>` ${`${s}:`.padEnd(n+1)} ${r}`).join(`
4
- `)}class co extends fe{constructor({v:t}){super(`Invalid \`v\` value "${t}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class lo extends fe{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",ws(t),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class uo extends fe{constructor({storageKey:t}){super(`Size for storage key "${t}" is invalid. Expected 32 bytes. Got ${Math.floor((t.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}}function fo(e){if(!e||e.length===0)return[];const t=[];for(const n of e){const{chainId:s,nonce:r,...a}=n,o=n.address;t.push([s?Nt(s):"0x",o,r?Nt(r):"0x",...Gt({},a)])}return t}function ys(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),s=typeof e.blobs[0]=="string"?e.blobs.map(a=>At(a)):e.blobs,r=[];for(const a of s)r.push(Uint8Array.from(t.blobToKzgCommitment(a)));return n==="bytes"?r:r.map(a=>it(a))}function vs(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),s=typeof e.blobs[0]=="string"?e.blobs.map(o=>At(o)):e.blobs,r=typeof e.commitments[0]=="string"?e.commitments.map(o=>At(o)):e.commitments,a=[];for(let o=0;o<s.length;o++){const c=s[o],T=r[o];a.push(Uint8Array.from(t.computeBlobKzgProof(c,T)))}return n==="bytes"?a:a.map(o=>it(o))}function po(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function As(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Ht(e,...t){if(!po(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function sn(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function ks(e,t){Ht(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function ho(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Rt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function En(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function nt(e,t){return e<<32-t|e>>>t}const mo=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function go(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function bo(e){for(let t=0;t<e.length;t++)e[t]=go(e[t]);return e}const xs=mo?e=>e:bo;function wo(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Sn(e){return typeof e=="string"&&(e=wo(e)),Ht(e),e}class Ts{}function Es(e){const t=s=>e().update(Sn(s)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function yo(e,t,n,s){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,s);const r=BigInt(32),a=BigInt(4294967295),o=Number(n>>r&a),c=Number(n&a),T=s?4:0,C=s?0:4;e.setUint32(t+T,o,s),e.setUint32(t+C,c,s)}function vo(e,t,n){return e&t^~e&n}function Ao(e,t,n){return e&t^e&n^t&n}class ko extends Ts{constructor(t,n,s,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=s,this.isLE=r,this.buffer=new Uint8Array(t),this.view=En(this.buffer)}update(t){sn(this),t=Sn(t),Ht(t);const{view:n,buffer:s,blockLen:r}=this,a=t.length;for(let o=0;o<a;){const c=Math.min(r-this.pos,a-o);if(c===r){const T=En(t);for(;r<=a-o;o+=r)this.process(T,o);continue}s.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===r&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){sn(this),ks(t,this),this.finished=!0;const{buffer:n,view:s,blockLen:r,isLE:a}=this;let{pos:o}=this;n[o++]=128,Rt(this.buffer.subarray(o)),this.padOffset>r-o&&(this.process(s,0),o=0);for(let L=o;L<r;L++)n[L]=0;yo(s,r-8,BigInt(this.length*8),a),this.process(s,0);const c=En(t),T=this.outputLen;if(T%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const C=T/4,N=this.get();if(C>N.length)throw new Error("_sha2: outputLen bigger than state");for(let L=0;L<C;L++)c.setUint32(4*L,N[L],a)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const s=t.slice(0,n);return this.destroy(),s}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:s,length:r,finished:a,destroyed:o,pos:c}=this;return t.destroyed=o,t.finished=a,t.length=r,t.pos=c,r%n&&t.buffer.set(s),t}clone(){return this._cloneInto()}}const mt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),rn=BigInt(2**32-1),Ss=BigInt(32);function xo(e,t=!1){return t?{h:Number(e&rn),l:Number(e>>Ss&rn)}:{h:Number(e>>Ss&rn)|0,l:Number(e&rn)|0}}function To(e,t=!1){const n=e.length;let s=new Uint32Array(n),r=new Uint32Array(n);for(let a=0;a<n;a++){const{h:o,l:c}=xo(e[a],t);[s[a],r[a]]=[o,c]}return[s,r]}const Eo=(e,t,n)=>e<<n|t>>>32-n,So=(e,t,n)=>t<<n|e>>>32-n,Io=(e,t,n)=>t<<n-32|e>>>64-n,Co=(e,t,n)=>e<<n-32|t>>>64-n,Bo=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),gt=new Uint32Array(64);class Po extends ko{constructor(t=32){super(64,t,8,!1),this.A=mt[0]|0,this.B=mt[1]|0,this.C=mt[2]|0,this.D=mt[3]|0,this.E=mt[4]|0,this.F=mt[5]|0,this.G=mt[6]|0,this.H=mt[7]|0}get(){const{A:t,B:n,C:s,D:r,E:a,F:o,G:c,H:T}=this;return[t,n,s,r,a,o,c,T]}set(t,n,s,r,a,o,c,T){this.A=t|0,this.B=n|0,this.C=s|0,this.D=r|0,this.E=a|0,this.F=o|0,this.G=c|0,this.H=T|0}process(t,n){for(let L=0;L<16;L++,n+=4)gt[L]=t.getUint32(n,!1);for(let L=16;L<64;L++){const m=gt[L-15],k=gt[L-2],x=nt(m,7)^nt(m,18)^m>>>3,g=nt(k,17)^nt(k,19)^k>>>10;gt[L]=g+gt[L-7]+x+gt[L-16]|0}let{A:s,B:r,C:a,D:o,E:c,F:T,G:C,H:N}=this;for(let L=0;L<64;L++){const m=nt(c,6)^nt(c,11)^nt(c,25),k=N+m+vo(c,T,C)+Bo[L]+gt[L]|0,g=(nt(s,2)^nt(s,13)^nt(s,22))+Ao(s,r,a)|0;N=C,C=T,T=c,c=o+k|0,o=a,a=r,r=s,s=k+g|0}s=s+this.A|0,r=r+this.B|0,a=a+this.C|0,o=o+this.D|0,c=c+this.E|0,T=T+this.F|0,C=C+this.G|0,N=N+this.H|0,this.set(s,r,a,o,c,T,C,N)}roundClean(){Rt(gt)}destroy(){this.set(0,0,0,0,0,0,0,0),Rt(this.buffer)}}const No=Es(()=>new Po);function Oo(e,t){return No(Bt(e,{strict:!1})?kn(e):e)}function Uo(e){const{commitment:t,version:n=1}=e,s=e.to??(typeof t=="string"?"hex":"bytes"),r=Oo(t);return r.set([n],0),s==="bytes"?r:it(r)}function Do(e){const{commitments:t,version:n}=e,s=e.to??(typeof t[0]=="string"?"hex":"bytes"),r=[];for(const a of t)r.push(Uo({commitment:a,to:s,version:n}));return r}const Is=6,Cs=32,In=4096,Bs=Cs*In,Ps=Bs*Is-1-1*In*Is,Ns=1;class Fo extends fe{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class Os extends fe{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class Mo extends fe{constructor({hash:t,size:n}){super(`Versioned hash "${t}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${n}`],name:"InvalidVersionedHashSizeError"})}}class _o extends fe{constructor({hash:t,version:n}){super(`Versioned hash "${t}" version is invalid.`,{metaMessages:[`Expected: ${Ns}`,`Received: ${n}`],name:"InvalidVersionedHashVersionError"})}}function Lo(e){const t=e.to??(typeof e.data=="string"?"hex":"bytes"),n=typeof e.data=="string"?At(e.data):e.data,s=Ve(n);if(!s)throw new Os;if(s>Ps)throw new Fo({maxSize:Ps,size:s});const r=[];let a=!0,o=0;for(;a;){const c=ms(new Uint8Array(Bs));let T=0;for(;T<In;){const C=n.slice(o,o+(Cs-1));if(c.pushByte(0),c.pushBytes(C),C.length<31){c.pushByte(128),a=!1;break}T++,o+=31}r.push(c)}return t==="bytes"?r.map(c=>c.bytes):r.map(c=>it(c.bytes))}function Ho(e){const{data:t,kzg:n,to:s}=e,r=e.blobs??Lo({data:t,to:s}),a=e.commitments??ys({blobs:r,kzg:n,to:s}),o=e.proofs??vs({blobs:r,commitments:a,kzg:n,to:s}),c=[];for(let T=0;T<r.length;T++)c.push({blob:r[T],commitment:a[T],proof:o[T]});return c}class st extends fe{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class on extends fe{constructor({chainId:t}){super(typeof t=="number"?`Chain ID "${t}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}class Mt extends fe{constructor({cause:t,message:n}={}){const s=n?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${s?`with reason: ${s}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(Mt,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Mt,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});class Et extends fe{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Tt(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(Et,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class Cn extends fe{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Tt(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Cn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class Bn extends fe{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty(Bn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Pn extends fe{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
5
- `),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(Pn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Nn extends fe{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(Nn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class On extends fe{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
6
- `),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(On,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Un extends fe{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(Un,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Dn extends fe{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(Dn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Fn extends fe{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Fn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Vt extends fe{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:s}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Tt(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${s?` = ${Tt(s)} gwei`:""}).`].join(`
7
- `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(Vt,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Us extends fe{constructor({cause:t}){super(`An error occurred while executing: ${t?.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}class Ds extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const s=this.keys().next().value;s&&this.delete(s)}return this}}const Ro=BigInt(0),Wt=BigInt(1),Vo=BigInt(2),Wo=BigInt(7),Go=BigInt(256),zo=BigInt(113),Fs=[],Ms=[],_s=[];for(let e=0,t=Wt,n=1,s=0;e<24;e++){[n,s]=[s,(2*n+3*s)%5],Fs.push(2*(5*s+n)),Ms.push((e+1)*(e+2)/2%64);let r=Ro;for(let a=0;a<7;a++)t=(t<<Wt^(t>>Wo)*zo)%Go,t&Vo&&(r^=Wt<<(Wt<<BigInt(a))-Wt);_s.push(r)}const Ls=To(_s,!0),Yo=Ls[0],jo=Ls[1],Hs=(e,t,n)=>n>32?Io(e,t,n):Eo(e,t,n),Rs=(e,t,n)=>n>32?Co(e,t,n):So(e,t,n);function qo(e,t=24){const n=new Uint32Array(10);for(let s=24-t;s<24;s++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,T=(o+2)%10,C=n[T],N=n[T+1],L=Hs(C,N,1)^n[c],m=Rs(C,N,1)^n[c+1];for(let k=0;k<50;k+=10)e[o+k]^=L,e[o+k+1]^=m}let r=e[2],a=e[3];for(let o=0;o<24;o++){const c=Ms[o],T=Hs(r,a,c),C=Rs(r,a,c),N=Fs[o];r=e[N],a=e[N+1],e[N]=T,e[N+1]=C}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)n[c]=e[o+c];for(let c=0;c<10;c++)e[o+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=Yo[s],e[1]^=jo[s]}Rt(n)}class Mn extends Ts{constructor(t,n,s,r=!1,a=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=s,this.enableXOF=r,this.rounds=a,As(s),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=ho(this.state)}clone(){return this._cloneInto()}keccak(){xs(this.state32),qo(this.state32,this.rounds),xs(this.state32),this.posOut=0,this.pos=0}update(t){sn(this),t=Sn(t),Ht(t);const{blockLen:n,state:s}=this,r=t.length;for(let a=0;a<r;){const o=Math.min(n-this.pos,r-a);for(let c=0;c<o;c++)s[this.pos++]^=t[a++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:s,blockLen:r}=this;t[s]^=n,(n&128)!==0&&s===r-1&&this.keccak(),t[r-1]^=128,this.keccak()}writeInto(t){sn(this,!1),Ht(t),this.finish();const n=this.state,{blockLen:s}=this;for(let r=0,a=t.length;r<a;){this.posOut>=s&&this.keccak();const o=Math.min(s-this.posOut,a-r);t.set(n.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return As(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ks(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Rt(this.state)}_cloneInto(t){const{blockLen:n,suffix:s,outputLen:r,rounds:a,enableXOF:o}=this;return t||(t=new Mn(n,s,r,o,a)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=s,t.outputLen=r,t.enableXOF=o,t.destroyed=this.destroyed,t}}const Jo=(e,t,n)=>Es(()=>new Mn(t,e,n)),Xo=Jo(1,136,256/8);function Vs(e,t){const n=t||"hex",s=Xo(Bt(e,{strict:!1})?kn(e):e);return n==="bytes"?s:Nt(s)}const _n=new Ds(8192);function Ko(e,t){if(_n.has(`${e}.${t}`))return _n.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),s=Vs(fs(n),"bytes"),r=n.split("");for(let o=0;o<40;o+=2)s[o>>1]>>4>=8&&r[o]&&(r[o]=r[o].toUpperCase()),(s[o>>1]&15)>=8&&r[o+1]&&(r[o+1]=r[o+1].toUpperCase());const a=`0x${r.join("")}`;return _n.set(`${e}.${t}`,a),a}const Zo=/^0x[a-fA-F0-9]{40}$/,Ln=new Ds(8192);function Re(e,t){const{strict:n=!0}=t??{},s=`${e}.${n}`;if(Ln.has(s))return Ln.get(s);const r=Zo.test(e)?e.toLowerCase()===e?!0:n?Ko(e)===e:!0:!1;return Ln.set(s,r),r}function Hn(e,t,n,{strict:s}={}){return Bt(e,{strict:!1})?$o(e,t,n,{strict:s}):Qo(e,t,n,{strict:s})}function Ws(e,t){if(typeof t=="number"&&t>0&&t>Ve(e)-1)throw new is({offset:t,position:"start",size:Ve(e)})}function Gs(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Ve(e)!==n-t)throw new is({offset:n,position:"end",size:Ve(e)})}function Qo(e,t,n,{strict:s}={}){Ws(e,t);const r=e.slice(t,n);return s&&Gs(r,t,n),r}function $o(e,t,n,{strict:s}={}){Ws(e,t);const r=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return s&&Gs(r,t,n),r}function ea(e){const{authorizationList:t}=e;if(t)for(const n of t){const{chainId:s}=n,r=n.address;if(!Re(r))throw new st({address:r});if(s<0)throw new on({chainId:s})}Rn(e)}function ta(e){const{blobVersionedHashes:t}=e;if(t){if(t.length===0)throw new Os;for(const n of t){const s=Ve(n),r=nn(Hn(n,0,1));if(s!==32)throw new Mo({hash:n,size:s});if(r!==Ns)throw new _o({hash:n,version:r})}}Rn(e)}function Rn(e){const{chainId:t,maxPriorityFeePerGas:n,maxFeePerGas:s,to:r}=e;if(t<=0)throw new on({chainId:t});if(r&&!Re(r))throw new st({address:r});if(s&&s>Dt)throw new Et({maxFeePerGas:s});if(n&&s&&n>s)throw new Vt({maxFeePerGas:s,maxPriorityFeePerGas:n})}function na(e){const{chainId:t,maxPriorityFeePerGas:n,gasPrice:s,maxFeePerGas:r,to:a}=e;if(t<=0)throw new on({chainId:t});if(a&&!Re(a))throw new st({address:a});if(n||r)throw new fe("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(s&&s>Dt)throw new Et({maxFeePerGas:s})}function sa(e){const{chainId:t,maxPriorityFeePerGas:n,gasPrice:s,maxFeePerGas:r,to:a}=e;if(a&&!Re(a))throw new st({address:a});if(typeof t<"u"&&t<=0)throw new on({chainId:t});if(n||r)throw new fe("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(s&&s>Dt)throw new Et({maxFeePerGas:s})}function ra(e){if(e.type)return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.blobs<"u"||typeof e.blobVersionedHashes<"u"||typeof e.maxFeePerBlobGas<"u"||typeof e.sidecars<"u")return"eip4844";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new lo({transaction:e})}function an(e){if(!e||e.length===0)return[];const t=[];for(let n=0;n<e.length;n++){const{address:s,storageKeys:r}=e[n];for(let a=0;a<r.length;a++)if(r[a].length-2!==64)throw new uo({storageKey:r[a]});if(!Re(s,{strict:!1}))throw new st({address:s});t.push([s,r])}return t}function oa(e,t){const n=ra(e);return n==="eip1559"?ca(e,t):n==="eip2930"?la(e,t):n==="eip4844"?ia(e,t):n==="eip7702"?aa(e,t):da(e,t)}function aa(e,t){const{authorizationList:n,chainId:s,gas:r,nonce:a,to:o,value:c,maxFeePerGas:T,maxPriorityFeePerGas:C,accessList:N,data:L}=e;ea(e);const m=an(N),k=fo(n);return kt(["0x04",xt([le(s),a?le(a):"0x",C?le(C):"0x",T?le(T):"0x",r?le(r):"0x",o??"0x",c?le(c):"0x",L??"0x",m,k,...Gt(e,t)])])}function ia(e,t){const{chainId:n,gas:s,nonce:r,to:a,value:o,maxFeePerBlobGas:c,maxFeePerGas:T,maxPriorityFeePerGas:C,accessList:N,data:L}=e;ta(e);let m=e.blobVersionedHashes,k=e.sidecars;if(e.blobs&&(typeof m>"u"||typeof k>"u")){const Q=typeof e.blobs[0]=="string"?e.blobs:e.blobs.map(ge=>it(ge)),oe=e.kzg,ye=ys({blobs:Q,kzg:oe});if(typeof m>"u"&&(m=Do({commitments:ye})),typeof k>"u"){const ge=vs({blobs:Q,commitments:ye,kzg:oe});k=Ho({blobs:Q,commitments:ye,proofs:ge})}}const x=an(N),g=[le(n),r?le(r):"0x",C?le(C):"0x",T?le(T):"0x",s?le(s):"0x",a??"0x",o?le(o):"0x",L??"0x",x,c?le(c):"0x",m??[],...Gt(e,t)],B=[],ue=[],D=[];if(k)for(let Q=0;Q<k.length;Q++){const{blob:oe,commitment:ye,proof:ge}=k[Q];B.push(oe),ue.push(ye),D.push(ge)}return kt(["0x03",xt(k?[g,B,ue,D]:g)])}function ca(e,t){const{chainId:n,gas:s,nonce:r,to:a,value:o,maxFeePerGas:c,maxPriorityFeePerGas:T,accessList:C,data:N}=e;Rn(e);const L=an(C),m=[le(n),r?le(r):"0x",T?le(T):"0x",c?le(c):"0x",s?le(s):"0x",a??"0x",o?le(o):"0x",N??"0x",L,...Gt(e,t)];return kt(["0x02",xt(m)])}function la(e,t){const{chainId:n,gas:s,data:r,nonce:a,to:o,value:c,accessList:T,gasPrice:C}=e;na(e);const N=an(T),L=[le(n),a?le(a):"0x",C?le(C):"0x",s?le(s):"0x",o??"0x",c?le(c):"0x",r??"0x",N,...Gt(e,t)];return kt(["0x01",xt(L)])}function da(e,t){const{chainId:n=0,gas:s,data:r,nonce:a,to:o,value:c,gasPrice:T}=e;sa(e);let C=[a?le(a):"0x",T?le(T):"0x",s?le(s):"0x",o??"0x",c?le(c):"0x",r??"0x"];if(t){const N=(()=>{if(t.v>=35n)return(t.v-35n)/2n>0?t.v:27n+(t.v===35n?0n:1n);if(n>0)return BigInt(n*2)+BigInt(35n+t.v-27n);const k=27n+(t.v===27n?0n:1n);if(t.v!==k)throw new co({v:t.v});return k})(),L=tn(t.r),m=tn(t.s);C=[...C,le(N),L==="0x00"?"0x":L,m==="0x00"?"0x":m]}else n>0&&(C=[...C,le(n),"0x","0x"]);return xt(C)}function Gt(e,t){const n=t??e,{v:s,yParity:r}=n;if(typeof n.r>"u")return[];if(typeof n.s>"u")return[];if(typeof s>"u"&&typeof r>"u")return[];const a=tn(n.r),o=tn(n.s);return[typeof r=="number"?r?le(1):"0x":s===0n?"0x":s===1n?le(1):s===27n?"0x":le(1),a==="0x00"?"0x":a,o==="0x00"?"0x":o]}const ua={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},fa={block:Yr({format(e){return{transactions:e.transactions?.map(n=>{if(typeof n=="string")return n;const s=Tn(n);return s.typeHex==="0x7e"&&(s.isSystemTx=n.isSystemTx,s.mint=n.mint?Ut(n.mint):void 0,s.sourceHash=n.sourceHash,s.type="deposit"),s}),stateRoot:e.stateRoot}}}),transaction:Wr({format(e){const t={};return e.type==="0x7e"&&(t.isSystemTx=e.isSystemTx,t.mint=e.mint?Ut(e.mint):void 0,t.sourceHash=e.sourceHash,t.type="deposit"),t}}),transactionReceipt:Xr({format(e){return{l1GasPrice:e.l1GasPrice?Ut(e.l1GasPrice):null,l1GasUsed:e.l1GasUsed?Ut(e.l1GasUsed):null,l1Fee:e.l1Fee?Ut(e.l1Fee):null,l1FeeScalar:e.l1FeeScalar?Number(e.l1FeeScalar):null}}})};function pa(e,t){return ga(e)?ma(e):oa(e,t)}const ha={transaction:pa};function ma(e){ba(e);const{sourceHash:t,data:n,from:s,gas:r,isSystemTx:a,mint:o,to:c,value:T}=e,C=[t,s,c??"0x",o?Nt(o):"0x",T?Nt(T):"0x",r?Nt(r):"0x",a?"0x1":"0x",n??"0x"];return kt(["0x7e",xt(C)])}function ga(e){return e.type==="deposit"||typeof e.sourceHash<"u"}function ba(e){const{from:t,to:n}=e;if(t&&!Re(t))throw new st({address:t});if(n&&!Re(n))throw new st({address:n})}const cn={blockTime:2e3,contracts:ua,formatters:fa,serializers:ha},wa=at({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:250,rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),ya=at({id:43114,name:"Avalanche",blockTime:1700,nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{default:{name:"SnowTrace",url:"https://snowtrace.io",apiUrl:"https://api.snowtrace.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:11907934}}}),zt=1,zs=at({...cn,id:8453,name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://basescan.org",apiUrl:"https://api.basescan.org/api"}},contracts:{...cn.contracts,disputeGameFactory:{[zt]:{address:"0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e"}},l2OutputOracle:{[zt]:{address:"0x56315b90c40730925ec5485cf004d835058518A0"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:5022},portal:{[zt]:{address:"0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",blockCreated:17482143}},l1StandardBridge:{[zt]:{address:"0x3154Cf16ccdb4C6d922629664174b904d80F2C35",blockCreated:17482143}}},sourceId:zt});({...zs});const va=at({id:56,name:"BNB Smart Chain",blockTime:750,nativeCurrency:{decimals:18,name:"BNB",symbol:"BNB"},rpcUrls:{default:{http:["https://56.rpc.thirdweb.com"]}},blockExplorers:{default:{name:"BscScan",url:"https://bscscan.com",apiUrl:"https://api.bscscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:15921452}}});function Vn(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}class Aa extends fe{constructor({docsPath:t}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(`
8
- `),{docsPath:t,docsSlug:"account",name:"AccountNotFoundError"})}}function Wn(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new Ba(e.type);return`${e.name}(${Ys(e.inputs,{includeName:t})})`}function Ys(e,{includeName:t=!1}={}){return e?e.map(n=>ka(n,{includeName:t})).join(t?", ":","):""}function ka(e,{includeName:t}){return e.type.startsWith("tuple")?`(${Ys(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}class xa extends fe{constructor({expectedLength:t,givenLength:n,type:s}){super([`ABI encoding array length mismatch for type ${s}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
9
- `),{name:"AbiEncodingArrayLengthMismatchError"})}}class Ta extends fe{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${Ve(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class Ea extends fe{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
10
- `),{name:"AbiEncodingLengthMismatchError"})}}class js extends fe{constructor(t,{docsPath:n}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
11
- `),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class Sa extends fe{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${Wn(t.abiItem)}\`, and`,`\`${n.type}\` in \`${Wn(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class Ia extends fe{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
12
- `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class Ca extends fe{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
13
- `),{name:"InvalidArrayError"})}}class Ba extends fe{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
14
- `),{name:"InvalidDefinitionTypeError"})}}const Pa=e=>Vs(kn(e));function Na(e){return Pa(e)}function Oa(e,t){return e.exec(t)?.groups}const qs=/^tuple(?<array>(\[(\d*)\])*)$/;function Gn(e){let t=e.type;if(qs.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let r=0;r<n;r++){const a=e.components[r];t+=Gn(a),r<n-1&&(t+=", ")}const s=Oa(qs,e.type);return t+=`)${s?.array||""}`,Gn({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Yt(e){let t="";const n=e.length;for(let s=0;s<n;s++){const r=e[s];t+=Gn(r),s!==n-1&&(t+=", ")}return t}function Ua(e){return e.type==="function"?`function ${e.name}(${Yt(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${Yt(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Yt(e.inputs)})`:e.type==="error"?`error ${e.name}(${Yt(e.inputs)})`:e.type==="constructor"?`constructor(${Yt(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}function Da(e){let t=!0,n="",s=0,r="",a=!1;for(let o=0;o<e.length;o++){const c=e[o];if(["(",")",","].includes(c)&&(t=!0),c==="("&&s++,c===")"&&s--,!!t){if(s===0){if(c===" "&&["event","function",""].includes(r))r="";else if(r+=c,c===")"){a=!0;break}continue}if(c===" "){e[o-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}r+=c,n+=c}}if(!a)throw new fe("Unable to normalize signature.");return r}const Fa=e=>{const t=typeof e=="string"?e:Ua(e);return Da(t)};function Js(e){return Na(Fa(e))}const Xs=e=>Hn(Js(e),0,4),Ma=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function _a(e,t){if(e.length!==t.length)throw new Ea({expectedLength:e.length,givenLength:t.length});const n=La({params:e,values:t}),s=Yn(n);return s.length===0?"0x":s}function La({params:e,values:t}){const n=[];for(let s=0;s<e.length;s++)n.push(zn({param:e[s],value:t[s]}));return n}function zn({param:e,value:t}){const n=ja(e.type);if(n){const[s,r]=n;return Ra(t,{length:s,param:{...e,type:r}})}if(e.type==="tuple")return Ya(t,{param:e});if(e.type==="address")return Ha(t);if(e.type==="bool")return Wa(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const s=e.type.startsWith("int"),[,,r="256"]=Ma.exec(e.type)??[];return Ga(t,{signed:s,size:Number(r)})}if(e.type.startsWith("bytes"))return Va(t,{param:e});if(e.type==="string")return za(t);throw new Ia(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Yn(e){let t=0;for(let a=0;a<e.length;a++){const{dynamic:o,encoded:c}=e[a];o?t+=32:t+=Ve(c)}const n=[],s=[];let r=0;for(let a=0;a<e.length;a++){const{dynamic:o,encoded:c}=e[a];o?(n.push(le(t+r,{size:32})),s.push(c),r+=Ve(c)):n.push(c)}return Ft([...n,...s])}function Ha(e){if(!Re(e))throw new st({address:e});return{dynamic:!1,encoded:ht(e.toLowerCase())}}function Ra(e,{length:t,param:n}){const s=t===null;if(!Array.isArray(e))throw new Ca(e);if(!s&&e.length!==t)throw new xa({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let r=!1;const a=[];for(let o=0;o<e.length;o++){const c=zn({param:n,value:e[o]});c.dynamic&&(r=!0),a.push(c)}if(s||r){const o=Yn(a);if(s){const c=le(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?Ft([c,o]):c}}if(r)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:Ft(a.map(({encoded:o})=>o))}}function Va(e,{param:t}){const[,n]=t.type.split("bytes"),s=Ve(e);if(!n){let r=e;return s%32!==0&&(r=ht(r,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Ft([ht(le(s,{size:32})),r])}}if(s!==Number.parseInt(n,10))throw new Ta({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:ht(e,{dir:"right"})}}function Wa(e){if(typeof e!="boolean")throw new fe(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:ht(ls(e))}}function Ga(e,{signed:t,size:n=256}){if(typeof n=="number"){const s=2n**(BigInt(n)-(t?1n:0n))-1n,r=t?-s-1n:0n;if(e>s||e<r)throw new An({max:s.toString(),min:r.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:le(e,{size:32,signed:t})}}function za(e){const t=ds(e),n=Math.ceil(Ve(t)/32),s=[];for(let r=0;r<n;r++)s.push(ht(Hn(t,r*32,(r+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Ft([ht(le(Ve(t),{size:32})),...s])}}function Ya(e,{param:t}){let n=!1;const s=[];for(let r=0;r<t.components.length;r++){const a=t.components[r],o=Array.isArray(e)?r:a.name,c=zn({param:a,value:e[o]});s.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Yn(s):Ft(s.map(({encoded:r})=>r))}}function ja(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const qa=Js;function Ja(e){const{abi:t,args:n=[],name:s}=e,r=Bt(s,{strict:!1}),a=t.filter(c=>r?c.type==="function"?Xs(c)===s:c.type==="event"?qa(c)===s:!1:"name"in c&&c.name===s);if(a.length===0)return;if(a.length===1)return a[0];let o;for(const c of a){if(!("inputs"in c))continue;if(!n||n.length===0){if(!c.inputs||c.inputs.length===0)return c;continue}if(!c.inputs||c.inputs.length===0||c.inputs.length!==n.length)continue;if(n.every((C,N)=>{const L="inputs"in c&&c.inputs[N];return L?jn(C,L):!1})){if(o&&"inputs"in o&&o.inputs){const C=Ks(c.inputs,o.inputs,n);if(C)throw new Sa({abiItem:c,type:C[0]},{abiItem:o,type:C[1]})}o=c}}return o||a[0]}function jn(e,t){const n=typeof e,s=t.type;switch(s){case"address":return Re(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return s==="tuple"&&"components"in t?Object.values(t.components).every((r,a)=>n==="object"&&jn(Object.values(e)[a],r)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(s)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(s)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(s)?Array.isArray(e)&&e.every(r=>jn(r,{...t,type:s.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Ks(e,t,n){for(const s in e){const r=e[s],a=t[s];if(r.type==="tuple"&&a.type==="tuple"&&"components"in r&&"components"in a)return Ks(r.components,a.components,n[s]);const o=[r.type,a.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?Re(n[s],{strict:!1}):o.includes("address")&&o.includes("bytes")?Re(n[s],{strict:!1}):!1)return o}}function Zs(e){return e.reduce((t,{slot:n,value:s})=>`${t} ${n}: ${s}
15
- `,"")}function Xa(e){return e.reduce((t,{address:n,...s})=>{let r=`${t} ${n}:
16
- `;return s.nonce&&(r+=` nonce: ${s.nonce}
17
- `),s.balance&&(r+=` balance: ${s.balance}
18
- `),s.code&&(r+=` code: ${s.code}
19
- `),s.state&&(r+=` state:
20
- `,r+=Zs(s.state)),s.stateDiff&&(r+=` stateDiff:
21
- `,r+=Zs(s.stateDiff)),r},` State Override:
22
- `).slice(0,-1)}class Ka extends fe{constructor(t,{account:n,docsPath:s,chain:r,data:a,gas:o,gasPrice:c,maxFeePerGas:T,maxPriorityFeePerGas:C,nonce:N,to:L,value:m,stateOverride:k}){const x=n?Vn(n):void 0;let g=ws({from:x?.address,to:L,value:typeof m<"u"&&`${io(m)} ${r?.nativeCurrency?.symbol||"ETH"}`,data:a,gas:o,gasPrice:typeof c<"u"&&`${Tt(c)} gwei`,maxFeePerGas:typeof T<"u"&&`${Tt(T)} gwei`,maxPriorityFeePerGas:typeof C<"u"&&`${Tt(C)} gwei`,nonce:N});k&&(g+=`
23
- ${Xa(k)}`),super(t.shortMessage,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",g].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}function Za(e,t){const n=(e.details||"").toLowerCase(),s=e instanceof fe?e.walk(r=>r?.code===Mt.code):e;return s instanceof fe?new Mt({cause:e,message:s.details}):Mt.nodeMessage.test(n)?new Mt({cause:e,message:e.details}):Et.nodeMessage.test(n)?new Et({cause:e,maxFeePerGas:t?.maxFeePerGas}):Cn.nodeMessage.test(n)?new Cn({cause:e,maxFeePerGas:t?.maxFeePerGas}):Bn.nodeMessage.test(n)?new Bn({cause:e,nonce:t?.nonce}):Pn.nodeMessage.test(n)?new Pn({cause:e,nonce:t?.nonce}):Nn.nodeMessage.test(n)?new Nn({cause:e,nonce:t?.nonce}):On.nodeMessage.test(n)?new On({cause:e}):Un.nodeMessage.test(n)?new Un({cause:e,gas:t?.gas}):Dn.nodeMessage.test(n)?new Dn({cause:e,gas:t?.gas}):Fn.nodeMessage.test(n)?new Fn({cause:e}):Vt.nodeMessage.test(n)?new Vt({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new Us({cause:e})}function Qa(e,{docsPath:t,...n}){const s=(()=>{const r=Za(e,n);return r instanceof Us?e:r})();return new Ka(s,{docsPath:t,...n})}function $a(e,{format:t}){if(!t)return{};const n={};function s(a){const o=Object.keys(a);for(const c of o)c in e&&(n[c]=e[c]),a[c]&&typeof a[c]=="object"&&!Array.isArray(a[c])&&s(a[c])}const r=t(e||{});return s(r),n}function ei(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:s,to:r}=e,a=t?Vn(t):void 0;if(a&&!Re(a.address))throw new st({address:a.address});if(r&&!Re(r))throw new st({address:r});if(n&&n>Dt)throw new Et({maxFeePerGas:n});if(s&&n&&s>n)throw new Vt({maxFeePerGas:n,maxPriorityFeePerGas:s})}async function ti(e,t){const{account:n=e.account}=t;if(!n)throw new Aa;const s=Vn(n);try{const{accessList:r,blockNumber:a,blockTag:o,data:c,gas:T,gasPrice:C,maxFeePerGas:N,maxPriorityFeePerGas:L,nonce:m,to:k,value:x,...g}=t,ue=(typeof a=="bigint"?le(a):void 0)||o;ei(t);const D=e.chain?.formatters?.transactionRequest?.format,oe=(D||Zr)({...$a(g,{format:D}),account:s,accessList:r,data:c,gas:T,gasPrice:C,maxFeePerGas:N,maxPriorityFeePerGas:L,nonce:m,to:k,value:x},"estimateGas"),{baseFeePerGas:ye,gasLimit:ge,priorityFeePerGas:Ce}=await e.request({method:"linea_estimateGas",params:ue?[oe,ue]:[oe]});return{baseFeePerGas:BigInt(ye),gasLimit:BigInt(ge),priorityFeePerGas:BigInt(Ce)}}catch(r){throw Qa(r,{...t,account:s,chain:e.chain})}}const ni={fees:{estimateFeesPerGas:Qs,async maxPriorityFeePerGas({block:e,client:t,request:n}){const s=await Qs({block:e,client:t,multiply:r=>r,request:n,type:"eip1559"});return s?.maxPriorityFeePerGas?s.maxPriorityFeePerGas:null}}};async function Qs({client:e,multiply:t,request:n,type:s}){try{const r=await ti(e,{...n,account:n?.account}),{priorityFeePerGas:a}=r,c=t(BigInt(r.baseFeePerGas))+a;return s==="legacy"?{gasPrice:c}:{maxFeePerGas:c,maxPriorityFeePerGas:a}}catch{return null}}const si=at({...ni,id:59144,name:"Linea Mainnet",blockTime:2e3,nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build",apiUrl:"https://api.lineascan.build/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:42},ensRegistry:{address:"0x50130b669B28C339991d8676FA73CF122a121267",blockCreated:6682888},ensUniversalResolver:{address:"0x4D41762915F83c76EcaF6776d9b08076aA32b492",blockCreated:22222151}},ensTlds:[".linea.eth"],testnet:!1}),ri=at({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:12e3,rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensUniversalResolver:{address:"0xeeeeeeee14d718c2b47d9923deab1335e144eeee",blockCreated:23085558},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),jt=1,oi=at({...cn,id:10,name:"OP Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.optimism.io"]}},blockExplorers:{default:{name:"Optimism Explorer",url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io/api"}},contracts:{...cn.contracts,disputeGameFactory:{[jt]:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{[jt]:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{[jt]:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{[jt]:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId:jt}),ai=at({id:137,name:"Polygon",blockTime:2e3,nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://polygon-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.etherscan.io/v2/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}}),$s="/docs/contract/encodeFunctionData";function ii(e){const{abi:t,args:n,functionName:s}=e;let r=t[0];if(s){const a=Ja({abi:t,args:n,name:s});if(!a)throw new js(s,{docsPath:$s});r=a}if(r.type!=="function")throw new js(void 0,{docsPath:$s});return{abi:[r],functionName:Xs(Wn(r))}}function bt(e){const{args:t}=e,{abi:n,functionName:s}=e.abi.length===1&&e.functionName?.startsWith("0x")?e:ii(e),r=n[0],a=s,o="inputs"in r&&r.inputs?_a(r.inputs,t??[]):void 0;return kt([a,o??"0x"])}const wt={1:{...ri,logo:"https://cryptologos.cc/logos/ethereum-eth-logo.png?v=024",chainId:1,chainType:"ether",chainTypeMoralis:"eth",tokenTrendingDefault:["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"]},10:{...oi,logo:"https://cryptologos.cc/logos/optimism-ethereum-op-logo.png?v=024",chainId:10,chainType:"optimism",chainTypeMoralis:"optimism",tokenTrendingDefault:["0x4200000000000000000000000000000000000006","0x68f180fcce6836688e9084f035309e29bf0a2095","0xc47da4cb96ce65a96844a01bfae509f9d5454534"]},56:{...va,logo:"https://cryptologos.cc/logos/bnb-bnb-logo.png?v=024",chainId:56,chainType:"bsc",chainTypeMoralis:"bsc",tokenTrendingDefault:["0x2170ed0880ac9a755fd29b2688956bd959f933f8","0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c"]},137:{...ai,logo:"https://cryptologos.cc/logos/polygon-matic-logo.png?v=024",chainId:137,chainType:"matic",chainTypeMoralis:"polygon",tokenTrendingDefault:["0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6"]},8453:{...zs,logo:"https://icons.llamao.fi/icons/chains/rsz_base.jpg",chainId:8453,chainType:"base",chainTypeMoralis:"base",tokenTrendingDefault:["0x4200000000000000000000000000000000000006","0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf","0xc47da4cb96ce65a96844a01bfae509f9d5454534"]},42161:{...wa,logo:"https://cryptologos.cc/logos/arbitrum-arb-logo.png?v=024",chainId:42161,chainType:"arbitrum",chainTypeMoralis:"arbitrum",tokenTrendingDefault:["0x82af49447d8a07e3bd95bd0d56f35241523fbab1","0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f"]},43114:{...ya,logo:"https://cryptologos.cc/logos/avalanche-avax-logo.png?v=024",chainId:43114,chainType:"avax",chainTypeMoralis:"avalanche",tokenTrendingDefault:["0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB","0x0555E30da8f98308EdB960aa94C0Db47230d2B9c"]},59144:{...si,logo:"https://icons.llamao.fi/icons/chains/rsz_linea.jpg",chainId:59144,chainType:"linea",chainTypeMoralis:"linea",tokenTrendingDefault:["0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f","0x3aab2285ddcddad8edf438c1bab47e1a9d05a9b4"]}},ci=e=>{const t=new Date,n=new Date(t);n.setDate(n.getDate()-1);const s=new Date(e);return s.setHours(0,0,0,0),t.setHours(0,0,0,0),n.setHours(0,0,0,0),s.getTime()===t.getTime()?"Today":s.getTime()===n.getTime()?"Yesterday":s.toLocaleDateString("en-US",{month:"short",day:"numeric",year:s.getFullYear()!==t.getFullYear()?"numeric":void 0})},lt=e=>new Promise(t=>setTimeout(t,e||0)),li=(e,t=5,n=5)=>(e=e||"",e?.length<=t+n?e:`${e.substr(0,t)}...${e.substr(e.length-n,n)}`),di=e=>{if(!e)return"";const t=wt[e];return t?t.chainTypeMoralis:""},ui=e=>{if(!e)return"";const t=wt[e];return t?t.chainType:""},St={getItem(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}},setItem(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}},removeItem(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(e)}catch{}},get length(){if(typeof window>"u")return 0;try{return window.localStorage.length}catch{return 0}},key(e){if(typeof window>"u")return null;try{return window.localStorage.key(e)}catch{return null}}};class fi extends fe{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function dt(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new fi({value:e});let[n,s="0"]=e.split(".");const r=n.startsWith("-");if(r&&(n=n.slice(1)),s=s.replace(/(0+)$/,""),t===0)Math.round(+`.${s}`)===1&&(n=`${BigInt(n)+1n}`),s="";else if(s.length>t){const[a,o,c]=[s.slice(0,t-1),s.slice(t-1,t),s.slice(t)],T=Math.round(+`${o}.${c}`);T>9?s=`${BigInt(a)+BigInt(1)}0`.padStart(a.length+1,"0"):s=`${a}${T}`,s.length>t&&(s=s.slice(1),n=`${BigInt(n)+1n}`),s=s.slice(0,t)}else s=s.padEnd(t,"0");return BigInt(`${r?"-":""}${n}${s}`)}const pi="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",qe="0x0000000000000000000000000000000000000000",hi=({address:e,chainId:t})=>{const[n,s]=re.useState(!1),r=re.useCallback(()=>{if(!e)return;const a=e,o=()=>{s(!0),setTimeout(()=>s(!1),2e3)};try{navigator.clipboard.writeText(a).then(o).catch(()=>{const c=document.createElement("input");c.value=a,document.body.appendChild(c),c.select(),document.execCommand("copy"),c.remove(),o()})}catch{const c=document.createElement("input");c.value=a,document.body.appendChild(c),c.select(),document.execCommand("copy"),c.remove(),o()}},[e]);return I.jsx(I.Fragment,{children:Re(e||"")&&I.jsxs("div",{className:"chat-user-info",children:[t&&wt[t]?.logo&&I.jsx("div",{className:"user-avatar",children:I.jsx("img",{src:wt[t].logo||"",alt:"Chain",width:20,height:20})}),I.jsx("span",{className:"user-wallet",children:I.jsx("a",{href:wt[t]?.blockExplorers?.default?.url+"/address/"+e,target:"_blank",rel:"noopener noreferrer",children:li(e)||"Not connected"})}),I.jsx("button",{className:"copy-address-btn",onClick:r,"aria-label":"Copy wallet address",type:"button",title:n?"Copied!":"Copy address",children:n?I.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:I.jsx("path",{d:"M13.3333 4L6 11.3333L2.66667 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):I.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:[I.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),I.jsx("path",{d:"M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})})},He=[];for(let e=0;e<256;++e)He.push((e+256).toString(16).slice(1));function mi(e,t=0){return(He[e[t+0]]+He[e[t+1]]+He[e[t+2]]+He[e[t+3]]+"-"+He[e[t+4]]+He[e[t+5]]+"-"+He[e[t+6]]+He[e[t+7]]+"-"+He[e[t+8]]+He[e[t+9]]+"-"+He[e[t+10]]+He[e[t+11]]+He[e[t+12]]+He[e[t+13]]+He[e[t+14]]+He[e[t+15]]).toLowerCase()}let qn;const gi=new Uint8Array(16);function bi(){if(!qn){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");qn=crypto.getRandomValues.bind(crypto)}return qn(gi)}const er={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function wi(e,t,n){e=e||{};const s=e.random??e.rng?.()??bi();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,mi(s)}function tr(e,t,n){return er.randomUUID&&!e?er.randomUUID():wi(e)}const yi="chat_widget_messages",nr=re.createContext(void 0),Jn=()=>{const e=re.useContext(nr);if(!e)throw new Error("useConnect must be used within ConnectProvider");return{...e,chainData:wt[e.account?.chainId]||void 0,chainId:e.account?.chainId||void 0,chainType:ui(e.account?.chainId||void 0),chainTypeMoralis:di(e.account?.chainId||void 0)}},vi=({children:e,initialAccount:t})=>I.jsx(nr.Provider,{value:{account:t||null},children:e}),Xn=yi,sr=200,_t=[{id:tr(),text:`**Welcome! 🚀**
24
- You're connected and ready to explore DeFi! I can help you trade, check prices, and analyze your portfolio when you need it.`,sender:"bot",timestamp:new Date}];function Ai(e,t){return e&&t?`${e}_${t}`:""}function rr(e){return e.map(t=>({...t,timestamp:new Date(t.timestamp)}))}function or(){const e=St.getItem(Xn);if(!e)return null;try{const t=JSON.parse(e);if(t&&t.owner!==void 0&&Array.isArray(t.messages))return{owner:t.owner,messages:rr(t.messages)};if(Array.isArray(t))return{owner:"",messages:rr(t)}}catch{}return null}function ln(e,t){St.setItem(Xn,JSON.stringify({owner:e,messages:t}))}function ki(){const{account:e}=Jn(),t=Ai(e?.address,e?.chainId),[n,s]=re.useState(()=>t||"pending"),[r,a]=re.useState(()=>{const N=or();return t?N&&N.owner===t?N.messages:_t:N?.messages??_t});if(n==="pending"&&t){const N=or();N&&N.owner===t?a(N.messages):ln(t,r),s(t)}else n!=="pending"&&t&&n!==t&&(a(_t),ln(t,_t),s(t));re.useEffect(()=>{n!=="pending"&&ln(n,r)},[r,n]),re.useEffect(()=>{const N=[];for(let L=0;L<St.length;L++){const m=St.key(L);m&&m.startsWith(Xn+"_")&&N.push(m)}N.forEach(L=>St.removeItem(L))},[]);const o=(N,L,m,k,x)=>{const g=m?r.find(ue=>ue.id===m):void 0,B={id:tr(),text:N,sender:L,timestamp:new Date,...g&&{replyTo:{id:g.id,text:g.text,sender:g.sender}},...k&&{buttons:k},...x&&{actionData:x}};return a(ue=>{const D=[...ue,B];return D.length>sr?D.slice(D.length-sr):D}),B},c=(N,L)=>{a(m=>m.map(k=>k.id===N&&k.actionData?{...k,actionData:{...k.actionData,status:L}}:k))},T=(N,L)=>{a(m=>m.map(k=>k.id===N?{...k,text:L}:k))},C=re.useCallback(()=>{a(_t),ln(t,_t)},[t]);return{messages:r,setMessages:a,addMessage:o,updateMessageAction:c,updateMessageText:T,clearMessages:C}}const ar=re.createContext(void 0),xi=()=>{const e=re.useContext(ar);if(!e)throw new Error("useConfig must be used within ConfigProvider");return e},Ti=({children:e,initialConfig:t})=>I.jsx(ar.Provider,{value:{config:t||null},children:e}),ir=re.createContext(void 0),Ei=({children:e,initialLanguage:t="en"})=>{const[n,s]=re.useState(t);return re.useEffect(()=>{t&&s(t)},[t]),I.jsx(ir.Provider,{value:{language:n,setLanguage:s},children:e})},Si=()=>{const e=re.useContext(ir);if(!e)throw new Error("useLanguage must be used within a LanguageProvider");return e};var Ii=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Kn=Math.ceil,Je=Math.floor,We="[BigNumber Error] ",cr=We+"Number primitive has more than 15 significant digits: ",tt=1e14,he=14,Zn=9007199254740991,Qn=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],yt=1e7,Me=1e9;function lr(e){var t,n,s,r=D.prototype={constructor:D,toString:null,valueOf:null},a=new D(1),o=20,c=4,T=-7,C=21,N=-1e7,L=1e7,m=!1,k=1,x=0,g={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},B="0123456789abcdefghijklmnopqrstuvwxyz",ue=!0;function D(i,l){var u,w,p,v,S,h,b,E,y=this;if(!(y instanceof D))return new D(i,l);if(l==null){if(i&&i._isBigNumber===!0){y.s=i.s,!i.c||i.e>L?y.c=y.e=null:i.e<N?y.c=[y.e=0]:(y.e=i.e,y.c=i.c.slice());return}if((h=typeof i=="number")&&i*0==0){if(y.s=1/i<0?(i=-i,-1):1,i===~~i){for(v=0,S=i;S>=10;S/=10,v++);v>L?y.c=y.e=null:(y.e=v,y.c=[i]);return}E=String(i)}else{if(!Ii.test(E=String(i)))return s(y,E,h);y.s=E.charCodeAt(0)==45?(E=E.slice(1),-1):1}(v=E.indexOf("."))>-1&&(E=E.replace(".","")),(S=E.search(/e/i))>0?(v<0&&(v=S),v+=+E.slice(S+1),E=E.substring(0,S)):v<0&&(v=E.length)}else{if(Ne(l,2,B.length,"Base"),l==10&&ue)return y=new D(i),ge(y,o+y.e+1,c);if(E=String(i),h=typeof i=="number"){if(i*0!=0)return s(y,E,h,l);if(y.s=1/i<0?(E=E.slice(1),-1):1,D.DEBUG&&E.replace(/^0\.0*|\./,"").length>15)throw Error(cr+i)}else y.s=E.charCodeAt(0)===45?(E=E.slice(1),-1):1;for(u=B.slice(0,l),v=S=0,b=E.length;S<b;S++)if(u.indexOf(w=E.charAt(S))<0){if(w=="."){if(S>v){v=b;continue}}else if(!p&&(E==E.toUpperCase()&&(E=E.toLowerCase())||E==E.toLowerCase()&&(E=E.toUpperCase()))){p=!0,S=-1,v=0;continue}return s(y,String(i),h,l)}h=!1,E=n(E,l,10,y.s),(v=E.indexOf("."))>-1?E=E.replace(".",""):v=E.length}for(S=0;E.charCodeAt(S)===48;S++);for(b=E.length;E.charCodeAt(--b)===48;);if(E=E.slice(S,++b)){if(b-=S,h&&D.DEBUG&&b>15&&(i>Zn||i!==Je(i)))throw Error(cr+y.s*i);if((v=v-S-1)>L)y.c=y.e=null;else if(v<N)y.c=[y.e=0];else{if(y.e=v,y.c=[],S=(v+1)%he,v<0&&(S+=he),S<b){for(S&&y.c.push(+E.slice(0,S)),b-=he;S<b;)y.c.push(+E.slice(S,S+=he));S=he-(E=E.slice(S)).length}else S-=b;for(;S--;E+="0");y.c.push(+E)}}else y.c=[y.e=0]}D.clone=lr,D.ROUND_UP=0,D.ROUND_DOWN=1,D.ROUND_CEIL=2,D.ROUND_FLOOR=3,D.ROUND_HALF_UP=4,D.ROUND_HALF_DOWN=5,D.ROUND_HALF_EVEN=6,D.ROUND_HALF_CEIL=7,D.ROUND_HALF_FLOOR=8,D.EUCLID=9,D.config=D.set=function(i){var l,u;if(i!=null)if(typeof i=="object"){if(i.hasOwnProperty(l="DECIMAL_PLACES")&&(u=i[l],Ne(u,0,Me,l),o=u),i.hasOwnProperty(l="ROUNDING_MODE")&&(u=i[l],Ne(u,0,8,l),c=u),i.hasOwnProperty(l="EXPONENTIAL_AT")&&(u=i[l],u&&u.pop?(Ne(u[0],-Me,0,l),Ne(u[1],0,Me,l),T=u[0],C=u[1]):(Ne(u,-Me,Me,l),T=-(C=u<0?-u:u))),i.hasOwnProperty(l="RANGE"))if(u=i[l],u&&u.pop)Ne(u[0],-Me,-1,l),Ne(u[1],1,Me,l),N=u[0],L=u[1];else if(Ne(u,-Me,Me,l),u)N=-(L=u<0?-u:u);else throw Error(We+l+" cannot be zero: "+u);if(i.hasOwnProperty(l="CRYPTO"))if(u=i[l],u===!!u)if(u)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))m=u;else throw m=!u,Error(We+"crypto unavailable");else m=u;else throw Error(We+l+" not true or false: "+u);if(i.hasOwnProperty(l="MODULO_MODE")&&(u=i[l],Ne(u,0,9,l),k=u),i.hasOwnProperty(l="POW_PRECISION")&&(u=i[l],Ne(u,0,Me,l),x=u),i.hasOwnProperty(l="FORMAT"))if(u=i[l],typeof u=="object")g=u;else throw Error(We+l+" not an object: "+u);if(i.hasOwnProperty(l="ALPHABET"))if(u=i[l],typeof u=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(u))ue=u.slice(0,10)=="0123456789",B=u;else throw Error(We+l+" invalid: "+u)}else throw Error(We+"Object expected: "+i);return{DECIMAL_PLACES:o,ROUNDING_MODE:c,EXPONENTIAL_AT:[T,C],RANGE:[N,L],CRYPTO:m,MODULO_MODE:k,POW_PRECISION:x,FORMAT:g,ALPHABET:B}},D.isBigNumber=function(i){if(!i||i._isBigNumber!==!0)return!1;if(!D.DEBUG)return!0;var l,u,w=i.c,p=i.e,v=i.s;e:if({}.toString.call(w)=="[object Array]"){if((v===1||v===-1)&&p>=-Me&&p<=Me&&p===Je(p)){if(w[0]===0){if(p===0&&w.length===1)return!0;break e}if(l=(p+1)%he,l<1&&(l+=he),String(w[0]).length==l){for(l=0;l<w.length;l++)if(u=w[l],u<0||u>=tt||u!==Je(u))break e;if(u!==0)return!0}}}else if(w===null&&p===null&&(v===null||v===1||v===-1))return!0;throw Error(We+"Invalid BigNumber: "+i)},D.maximum=D.max=function(){return oe(arguments,-1)},D.minimum=D.min=function(){return oe(arguments,1)},D.random=(function(){var i=9007199254740992,l=Math.random()*i&2097151?function(){return Je(Math.random()*i)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(u){var w,p,v,S,h,b=0,E=[],y=new D(a);if(u==null?u=o:Ne(u,0,Me),S=Kn(u/he),m)if(crypto.getRandomValues){for(w=crypto.getRandomValues(new Uint32Array(S*=2));b<S;)h=w[b]*131072+(w[b+1]>>>11),h>=9e15?(p=crypto.getRandomValues(new Uint32Array(2)),w[b]=p[0],w[b+1]=p[1]):(E.push(h%1e14),b+=2);b=S/2}else if(crypto.randomBytes){for(w=crypto.randomBytes(S*=7);b<S;)h=(w[b]&31)*281474976710656+w[b+1]*1099511627776+w[b+2]*4294967296+w[b+3]*16777216+(w[b+4]<<16)+(w[b+5]<<8)+w[b+6],h>=9e15?crypto.randomBytes(7).copy(w,b):(E.push(h%1e14),b+=7);b=S/7}else throw m=!1,Error(We+"crypto unavailable");if(!m)for(;b<S;)h=l(),h<9e15&&(E[b++]=h%1e14);for(S=E[--b],u%=he,S&&u&&(h=Qn[he-u],E[b]=Je(S/h)*h);E[b]===0;E.pop(),b--);if(b<0)E=[v=0];else{for(v=-1;E[0]===0;E.splice(0,1),v-=he);for(b=1,h=E[0];h>=10;h/=10,b++);b<he&&(v-=he-b)}return y.e=v,y.c=E,y}})(),D.sum=function(){for(var i=1,l=arguments,u=new D(l[0]);i<l.length;)u=u.plus(l[i++]);return u},n=(function(){var i="0123456789";function l(u,w,p,v){for(var S,h=[0],b,E=0,y=u.length;E<y;){for(b=h.length;b--;h[b]*=w);for(h[0]+=v.indexOf(u.charAt(E++)),S=0;S<h.length;S++)h[S]>p-1&&(h[S+1]==null&&(h[S+1]=0),h[S+1]+=h[S]/p|0,h[S]%=p)}return h.reverse()}return function(u,w,p,v,S){var h,b,E,y,O,q,ne,me,xe=u.indexOf("."),Te=o,W=c;for(xe>=0&&(y=x,x=0,u=u.replace(".",""),me=new D(w),q=me.pow(u.length-xe),x=y,me.c=l(ut(Ke(q.c),q.e,"0"),10,p,i),me.e=me.c.length),ne=l(u,w,p,S?(h=B,i):(h=i,B)),E=y=ne.length;ne[--y]==0;ne.pop());if(!ne[0])return h.charAt(0);if(xe<0?--E:(q.c=ne,q.e=E,q.s=v,q=t(q,me,Te,W,p),ne=q.c,O=q.r,E=q.e),b=E+Te+1,xe=ne[b],y=p/2,O=O||b<0||ne[b+1]!=null,O=W<4?(xe!=null||O)&&(W==0||W==(q.s<0?3:2)):xe>y||xe==y&&(W==4||O||W==6&&ne[b-1]&1||W==(q.s<0?8:7)),b<1||!ne[0])u=O?ut(h.charAt(1),-Te,h.charAt(0)):h.charAt(0);else{if(ne.length=b,O)for(--p;++ne[--b]>p;)ne[b]=0,b||(++E,ne=[1].concat(ne));for(y=ne.length;!ne[--y];);for(xe=0,u="";xe<=y;u+=h.charAt(ne[xe++]));u=ut(u,E,h.charAt(0))}return u}})(),t=(function(){function i(w,p,v){var S,h,b,E,y=0,O=w.length,q=p%yt,ne=p/yt|0;for(w=w.slice();O--;)b=w[O]%yt,E=w[O]/yt|0,S=ne*b+E*q,h=q*b+S%yt*yt+y,y=(h/v|0)+(S/yt|0)+ne*E,w[O]=h%v;return y&&(w=[y].concat(w)),w}function l(w,p,v,S){var h,b;if(v!=S)b=v>S?1:-1;else for(h=b=0;h<v;h++)if(w[h]!=p[h]){b=w[h]>p[h]?1:-1;break}return b}function u(w,p,v,S){for(var h=0;v--;)w[v]-=h,h=w[v]<p[v]?1:0,w[v]=h*S+w[v]-p[v];for(;!w[0]&&w.length>1;w.splice(0,1));}return function(w,p,v,S,h){var b,E,y,O,q,ne,me,xe,Te,W,be,Ie,_e,Qe,Ye,Le,Ge,Fe=w.s==p.s?1:-1,Oe=w.c,Ee=p.c;if(!Oe||!Oe[0]||!Ee||!Ee[0])return new D(!w.s||!p.s||(Oe?Ee&&Oe[0]==Ee[0]:!Ee)?NaN:Oe&&Oe[0]==0||!Ee?Fe*0:Fe/0);for(xe=new D(Fe),Te=xe.c=[],E=w.e-p.e,Fe=v+E+1,h||(h=tt,E=Xe(w.e/he)-Xe(p.e/he),Fe=Fe/he|0),y=0;Ee[y]==(Oe[y]||0);y++);if(Ee[y]>(Oe[y]||0)&&E--,Fe<0)Te.push(1),O=!0;else{for(Qe=Oe.length,Le=Ee.length,y=0,Fe+=2,q=Je(h/(Ee[0]+1)),q>1&&(Ee=i(Ee,q,h),Oe=i(Oe,q,h),Le=Ee.length,Qe=Oe.length),_e=Le,W=Oe.slice(0,Le),be=W.length;be<Le;W[be++]=0);Ge=Ee.slice(),Ge=[0].concat(Ge),Ye=Ee[0],Ee[1]>=h/2&&Ye++;do{if(q=0,b=l(Ee,W,Le,be),b<0){if(Ie=W[0],Le!=be&&(Ie=Ie*h+(W[1]||0)),q=Je(Ie/Ye),q>1)for(q>=h&&(q=h-1),ne=i(Ee,q,h),me=ne.length,be=W.length;l(ne,W,me,be)==1;)q--,u(ne,Le<me?Ge:Ee,me,h),me=ne.length,b=1;else q==0&&(b=q=1),ne=Ee.slice(),me=ne.length;if(me<be&&(ne=[0].concat(ne)),u(W,ne,be,h),be=W.length,b==-1)for(;l(Ee,W,Le,be)<1;)q++,u(W,Le<be?Ge:Ee,be,h),be=W.length}else b===0&&(q++,W=[0]);Te[y++]=q,W[0]?W[be++]=Oe[_e]||0:(W=[Oe[_e]],be=1)}while((_e++<Qe||W[0]!=null)&&Fe--);O=W[0]!=null,Te[0]||Te.splice(0,1)}if(h==tt){for(y=1,Fe=Te[0];Fe>=10;Fe/=10,y++);ge(xe,v+(xe.e=y+E*he-1)+1,S,O)}else xe.e=E,xe.r=+O;return xe}})();function Q(i,l,u,w){var p,v,S,h,b;if(u==null?u=c:Ne(u,0,8),!i.c)return i.toString();if(p=i.c[0],S=i.e,l==null)b=Ke(i.c),b=w==1||w==2&&(S<=T||S>=C)?un(b,S):ut(b,S,"0");else if(i=ge(new D(i),l,u),v=i.e,b=Ke(i.c),h=b.length,w==1||w==2&&(l<=v||v<=T)){for(;h<l;b+="0",h++);b=un(b,v)}else if(l-=S+(w===2&&v>S),b=ut(b,v,"0"),v+1>h){if(--l>0)for(b+=".";l--;b+="0");}else if(l+=v-h,l>0)for(v+1==h&&(b+=".");l--;b+="0");return i.s<0&&p?"-"+b:b}function oe(i,l){for(var u,w,p=1,v=new D(i[0]);p<i.length;p++)w=new D(i[p]),(!w.s||(u=It(v,w))===l||u===0&&v.s===l)&&(v=w);return v}function ye(i,l,u){for(var w=1,p=l.length;!l[--p];l.pop());for(p=l[0];p>=10;p/=10,w++);return(u=w+u*he-1)>L?i.c=i.e=null:u<N?i.c=[i.e=0]:(i.e=u,i.c=l),i}s=(function(){var i=/^(-?)0([xbo])(?=\w[\w.]*$)/i,l=/^([^.]+)\.$/,u=/^\.([^.]+)$/,w=/^-?(Infinity|NaN)$/,p=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(v,S,h,b){var E,y=h?S:S.replace(p,"");if(w.test(y))v.s=isNaN(y)?null:y<0?-1:1;else{if(!h&&(y=y.replace(i,function(O,q,ne){return E=(ne=ne.toLowerCase())=="x"?16:ne=="b"?2:8,!b||b==E?q:O}),b&&(E=b,y=y.replace(l,"$1").replace(u,"0.$1")),S!=y))return new D(y,E);if(D.DEBUG)throw Error(We+"Not a"+(b?" base "+b:"")+" number: "+S);v.s=null}v.c=v.e=null}})();function ge(i,l,u,w){var p,v,S,h,b,E,y,O=i.c,q=Qn;if(O){e:{for(p=1,h=O[0];h>=10;h/=10,p++);if(v=l-p,v<0)v+=he,S=l,b=O[E=0],y=Je(b/q[p-S-1]%10);else if(E=Kn((v+1)/he),E>=O.length)if(w){for(;O.length<=E;O.push(0));b=y=0,p=1,v%=he,S=v-he+1}else break e;else{for(b=h=O[E],p=1;h>=10;h/=10,p++);v%=he,S=v-he+p,y=S<0?0:Je(b/q[p-S-1]%10)}if(w=w||l<0||O[E+1]!=null||(S<0?b:b%q[p-S-1]),w=u<4?(y||w)&&(u==0||u==(i.s<0?3:2)):y>5||y==5&&(u==4||w||u==6&&(v>0?S>0?b/q[p-S]:0:O[E-1])%10&1||u==(i.s<0?8:7)),l<1||!O[0])return O.length=0,w?(l-=i.e+1,O[0]=q[(he-l%he)%he],i.e=-l||0):O[0]=i.e=0,i;if(v==0?(O.length=E,h=1,E--):(O.length=E+1,h=q[he-v],O[E]=S>0?Je(b/q[p-S]%q[S])*h:0),w)for(;;)if(E==0){for(v=1,S=O[0];S>=10;S/=10,v++);for(S=O[0]+=h,h=1;S>=10;S/=10,h++);v!=h&&(i.e++,O[0]==tt&&(O[0]=1));break}else{if(O[E]+=h,O[E]!=tt)break;O[E--]=0,h=1}for(v=O.length;O[--v]===0;O.pop());}i.e>L?i.c=i.e=null:i.e<N&&(i.c=[i.e=0])}return i}function Ce(i){var l,u=i.e;return u===null?i.toString():(l=Ke(i.c),l=u<=T||u>=C?un(l,u):ut(l,u,"0"),i.s<0?"-"+l:l)}return r.absoluteValue=r.abs=function(){var i=new D(this);return i.s<0&&(i.s=1),i},r.comparedTo=function(i,l){return It(this,new D(i,l))},r.decimalPlaces=r.dp=function(i,l){var u,w,p,v=this;if(i!=null)return Ne(i,0,Me),l==null?l=c:Ne(l,0,8),ge(new D(v),i+v.e+1,l);if(!(u=v.c))return null;if(w=((p=u.length-1)-Xe(this.e/he))*he,p=u[p])for(;p%10==0;p/=10,w--);return w<0&&(w=0),w},r.dividedBy=r.div=function(i,l){return t(this,new D(i,l),o,c)},r.dividedToIntegerBy=r.idiv=function(i,l){return t(this,new D(i,l),0,1)},r.exponentiatedBy=r.pow=function(i,l){var u,w,p,v,S,h,b,E,y,O=this;if(i=new D(i),i.c&&!i.isInteger())throw Error(We+"Exponent not an integer: "+Ce(i));if(l!=null&&(l=new D(l)),h=i.e>14,!O.c||!O.c[0]||O.c[0]==1&&!O.e&&O.c.length==1||!i.c||!i.c[0])return y=new D(Math.pow(+Ce(O),h?i.s*(2-dn(i)):+Ce(i))),l?y.mod(l):y;if(b=i.s<0,l){if(l.c?!l.c[0]:!l.s)return new D(NaN);w=!b&&O.isInteger()&&l.isInteger(),w&&(O=O.mod(l))}else{if(i.e>9&&(O.e>0||O.e<-1||(O.e==0?O.c[0]>1||h&&O.c[1]>=24e7:O.c[0]<8e13||h&&O.c[0]<=9999975e7)))return v=O.s<0&&dn(i)?-0:0,O.e>-1&&(v=1/v),new D(b?1/v:v);x&&(v=Kn(x/he+2))}for(h?(u=new D(.5),b&&(i.s=1),E=dn(i)):(p=Math.abs(+Ce(i)),E=p%2),y=new D(a);;){if(E){if(y=y.times(O),!y.c)break;v?y.c.length>v&&(y.c.length=v):w&&(y=y.mod(l))}if(p){if(p=Je(p/2),p===0)break;E=p%2}else if(i=i.times(u),ge(i,i.e+1,1),i.e>14)E=dn(i);else{if(p=+Ce(i),p===0)break;E=p%2}O=O.times(O),v?O.c&&O.c.length>v&&(O.c.length=v):w&&(O=O.mod(l))}return w?y:(b&&(y=a.div(y)),l?y.mod(l):v?ge(y,x,c,S):y)},r.integerValue=function(i){var l=new D(this);return i==null?i=c:Ne(i,0,8),ge(l,l.e+1,i)},r.isEqualTo=r.eq=function(i,l){return It(this,new D(i,l))===0},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(i,l){return It(this,new D(i,l))>0},r.isGreaterThanOrEqualTo=r.gte=function(i,l){return(l=It(this,new D(i,l)))===1||l===0},r.isInteger=function(){return!!this.c&&Xe(this.e/he)>this.c.length-2},r.isLessThan=r.lt=function(i,l){return It(this,new D(i,l))<0},r.isLessThanOrEqualTo=r.lte=function(i,l){return(l=It(this,new D(i,l)))===-1||l===0},r.isNaN=function(){return!this.s},r.isNegative=function(){return this.s<0},r.isPositive=function(){return this.s>0},r.isZero=function(){return!!this.c&&this.c[0]==0},r.minus=function(i,l){var u,w,p,v,S=this,h=S.s;if(i=new D(i,l),l=i.s,!h||!l)return new D(NaN);if(h!=l)return i.s=-l,S.plus(i);var b=S.e/he,E=i.e/he,y=S.c,O=i.c;if(!b||!E){if(!y||!O)return y?(i.s=-l,i):new D(O?S:NaN);if(!y[0]||!O[0])return O[0]?(i.s=-l,i):new D(y[0]?S:c==3?-0:0)}if(b=Xe(b),E=Xe(E),y=y.slice(),h=b-E){for((v=h<0)?(h=-h,p=y):(E=b,p=O),p.reverse(),l=h;l--;p.push(0));p.reverse()}else for(w=(v=(h=y.length)<(l=O.length))?h:l,h=l=0;l<w;l++)if(y[l]!=O[l]){v=y[l]<O[l];break}if(v&&(p=y,y=O,O=p,i.s=-i.s),l=(w=O.length)-(u=y.length),l>0)for(;l--;y[u++]=0);for(l=tt-1;w>h;){if(y[--w]<O[w]){for(u=w;u&&!y[--u];y[u]=l);--y[u],y[w]+=tt}y[w]-=O[w]}for(;y[0]==0;y.splice(0,1),--E);return y[0]?ye(i,y,E):(i.s=c==3?-1:1,i.c=[i.e=0],i)},r.modulo=r.mod=function(i,l){var u,w,p=this;return i=new D(i,l),!p.c||!i.s||i.c&&!i.c[0]?new D(NaN):!i.c||p.c&&!p.c[0]?new D(p):(k==9?(w=i.s,i.s=1,u=t(p,i,0,3),i.s=w,u.s*=w):u=t(p,i,0,k),i=p.minus(u.times(i)),!i.c[0]&&k==1&&(i.s=p.s),i)},r.multipliedBy=r.times=function(i,l){var u,w,p,v,S,h,b,E,y,O,q,ne,me,xe,Te,W=this,be=W.c,Ie=(i=new D(i,l)).c;if(!be||!Ie||!be[0]||!Ie[0])return!W.s||!i.s||be&&!be[0]&&!Ie||Ie&&!Ie[0]&&!be?i.c=i.e=i.s=null:(i.s*=W.s,!be||!Ie?i.c=i.e=null:(i.c=[0],i.e=0)),i;for(w=Xe(W.e/he)+Xe(i.e/he),i.s*=W.s,b=be.length,O=Ie.length,b<O&&(me=be,be=Ie,Ie=me,p=b,b=O,O=p),p=b+O,me=[];p--;me.push(0));for(xe=tt,Te=yt,p=O;--p>=0;){for(u=0,q=Ie[p]%Te,ne=Ie[p]/Te|0,S=b,v=p+S;v>p;)E=be[--S]%Te,y=be[S]/Te|0,h=ne*E+y*q,E=q*E+h%Te*Te+me[v]+u,u=(E/xe|0)+(h/Te|0)+ne*y,me[v--]=E%xe;me[v]=u}return u?++w:me.splice(0,1),ye(i,me,w)},r.negated=function(){var i=new D(this);return i.s=-i.s||null,i},r.plus=function(i,l){var u,w=this,p=w.s;if(i=new D(i,l),l=i.s,!p||!l)return new D(NaN);if(p!=l)return i.s=-l,w.minus(i);var v=w.e/he,S=i.e/he,h=w.c,b=i.c;if(!v||!S){if(!h||!b)return new D(p/0);if(!h[0]||!b[0])return b[0]?i:new D(h[0]?w:p*0)}if(v=Xe(v),S=Xe(S),h=h.slice(),p=v-S){for(p>0?(S=v,u=b):(p=-p,u=h),u.reverse();p--;u.push(0));u.reverse()}for(p=h.length,l=b.length,p-l<0&&(u=b,b=h,h=u,l=p),p=0;l;)p=(h[--l]=h[l]+b[l]+p)/tt|0,h[l]=tt===h[l]?0:h[l]%tt;return p&&(h=[p].concat(h),++S),ye(i,h,S)},r.precision=r.sd=function(i,l){var u,w,p,v=this;if(i!=null&&i!==!!i)return Ne(i,1,Me),l==null?l=c:Ne(l,0,8),ge(new D(v),i,l);if(!(u=v.c))return null;if(p=u.length-1,w=p*he+1,p=u[p]){for(;p%10==0;p/=10,w--);for(p=u[0];p>=10;p/=10,w++);}return i&&v.e+1>w&&(w=v.e+1),w},r.shiftedBy=function(i){return Ne(i,-Zn,Zn),this.times("1e"+i)},r.squareRoot=r.sqrt=function(){var i,l,u,w,p,v=this,S=v.c,h=v.s,b=v.e,E=o+4,y=new D("0.5");if(h!==1||!S||!S[0])return new D(!h||h<0&&(!S||S[0])?NaN:S?v:1/0);if(h=Math.sqrt(+Ce(v)),h==0||h==1/0?(l=Ke(S),(l.length+b)%2==0&&(l+="0"),h=Math.sqrt(+l),b=Xe((b+1)/2)-(b<0||b%2),h==1/0?l="5e"+b:(l=h.toExponential(),l=l.slice(0,l.indexOf("e")+1)+b),u=new D(l)):u=new D(h+""),u.c[0]){for(b=u.e,h=b+E,h<3&&(h=0);;)if(p=u,u=y.times(p.plus(t(v,p,E,1))),Ke(p.c).slice(0,h)===(l=Ke(u.c)).slice(0,h))if(u.e<b&&--h,l=l.slice(h-3,h+1),l=="9999"||!w&&l=="4999"){if(!w&&(ge(p,p.e+o+2,0),p.times(p).eq(v))){u=p;break}E+=4,h+=4,w=1}else{(!+l||!+l.slice(1)&&l.charAt(0)=="5")&&(ge(u,u.e+o+2,1),i=!u.times(u).eq(v));break}}return ge(u,u.e+o+1,c,i)},r.toExponential=function(i,l){return i!=null&&(Ne(i,0,Me),i++),Q(this,i,l,1)},r.toFixed=function(i,l){return i!=null&&(Ne(i,0,Me),i=i+this.e+1),Q(this,i,l)},r.toFormat=function(i,l,u){var w,p=this;if(u==null)i!=null&&l&&typeof l=="object"?(u=l,l=null):i&&typeof i=="object"?(u=i,i=l=null):u=g;else if(typeof u!="object")throw Error(We+"Argument not an object: "+u);if(w=p.toFixed(i,l),p.c){var v,S=w.split("."),h=+u.groupSize,b=+u.secondaryGroupSize,E=u.groupSeparator||"",y=S[0],O=S[1],q=p.s<0,ne=q?y.slice(1):y,me=ne.length;if(b&&(v=h,h=b,b=v,me-=v),h>0&&me>0){for(v=me%h||h,y=ne.substr(0,v);v<me;v+=h)y+=E+ne.substr(v,h);b>0&&(y+=E+ne.slice(v)),q&&(y="-"+y)}w=O?y+(u.decimalSeparator||"")+((b=+u.fractionGroupSize)?O.replace(new RegExp("\\d{"+b+"}\\B","g"),"$&"+(u.fractionGroupSeparator||"")):O):y}return(u.prefix||"")+w+(u.suffix||"")},r.toFraction=function(i){var l,u,w,p,v,S,h,b,E,y,O,q,ne=this,me=ne.c;if(i!=null&&(h=new D(i),!h.isInteger()&&(h.c||h.s!==1)||h.lt(a)))throw Error(We+"Argument "+(h.isInteger()?"out of range: ":"not an integer: ")+Ce(h));if(!me)return new D(ne);for(l=new D(a),E=u=new D(a),w=b=new D(a),q=Ke(me),v=l.e=q.length-ne.e-1,l.c[0]=Qn[(S=v%he)<0?he+S:S],i=!i||h.comparedTo(l)>0?v>0?l:E:h,S=L,L=1/0,h=new D(q),b.c[0]=0;y=t(h,l,0,1),p=u.plus(y.times(w)),p.comparedTo(i)!=1;)u=w,w=p,E=b.plus(y.times(p=E)),b=p,l=h.minus(y.times(p=l)),h=p;return p=t(i.minus(u),w,0,1),b=b.plus(p.times(E)),u=u.plus(p.times(w)),b.s=E.s=ne.s,v=v*2,O=t(E,w,v,c).minus(ne).abs().comparedTo(t(b,u,v,c).minus(ne).abs())<1?[E,w]:[b,u],L=S,O},r.toNumber=function(){return+Ce(this)},r.toPrecision=function(i,l){return i!=null&&Ne(i,1,Me),Q(this,i,l,2)},r.toString=function(i){var l,u=this,w=u.s,p=u.e;return p===null?w?(l="Infinity",w<0&&(l="-"+l)):l="NaN":(i==null?l=p<=T||p>=C?un(Ke(u.c),p):ut(Ke(u.c),p,"0"):i===10&&ue?(u=ge(new D(u),o+p+1,c),l=ut(Ke(u.c),u.e,"0")):(Ne(i,2,B.length,"Base"),l=n(ut(Ke(u.c),p,"0"),10,i,w,!0)),w<0&&u.c[0]&&(l="-"+l)),l},r.valueOf=r.toJSON=function(){return Ce(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,e!=null&&D.set(e),D}function Xe(e){var t=e|0;return e>0||e===t?t:t-1}function Ke(e){for(var t,n,s=1,r=e.length,a=e[0]+"";s<r;){for(t=e[s++]+"",n=he-t.length;n--;t="0"+t);a+=t}for(r=a.length;a.charCodeAt(--r)===48;);return a.slice(0,r+1||1)}function It(e,t){var n,s,r=e.c,a=t.c,o=e.s,c=t.s,T=e.e,C=t.e;if(!o||!c)return null;if(n=r&&!r[0],s=a&&!a[0],n||s)return n?s?0:-c:o;if(o!=c)return o;if(n=o<0,s=T==C,!r||!a)return s?0:!r^n?1:-1;if(!s)return T>C^n?1:-1;for(c=(T=r.length)<(C=a.length)?T:C,o=0;o<c;o++)if(r[o]!=a[o])return r[o]>a[o]^n?1:-1;return T==C?0:T>C^n?1:-1}function Ne(e,t,n,s){if(e<t||e>n||e!==Je(e))throw Error(We+(s||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function dn(e){var t=e.c.length-1;return Xe(e.e/he)==t&&e.c[t]%2!=0}function un(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function ut(e,t,n){var s,r;if(t<0){for(r=n+".";++t;r+=n);e=r+e}else if(s=e.length,++t>s){for(r=n,t-=s;--t;r+=n);e+=r}else t<s&&(e=e.slice(0,t)+"."+e.slice(t));return e}var de=lr();class fn{baseUrl;constructor(t){this.baseUrl=t}buildUrl(t,n){const s=new URL(t,this.baseUrl);return n&&Object.entries(n).forEach(([r,a])=>{a!=null&&s.searchParams.append(r,String(a))}),s.toString()}async get(t,n={}){const s=this.buildUrl(t,n.query),r=await fetch(s,{method:"GET",headers:n.headers||{}});if(!r.ok){let o=null;try{o=await r.json()}catch{try{const T=await r.text();T&&(o={message:T})}catch{}}const c=new Error(o?.message||o?.errorMessage||`HTTP ${r.status}: ${r.statusText}`);throw c.status=r.status,c.statusText=r.statusText,o&&(c.data=o),c}return{data:await r.json(),status:r.status}}async post(t,n,s={}){const r=this.buildUrl(t,s.query),a=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",...s.headers},body:JSON.stringify(n)});if(!a.ok){let c=null;try{c=await a.json()}catch{try{const C=await a.text();C&&(c={message:C})}catch{}}const T=new Error(c?.message||c?.errorMessage||`HTTP ${a.status}: ${a.statusText}`);throw T.status=a.status,T.statusText=a.statusText,c&&(T.data=c),T}return{data:await a.json(),status:a.status}}}const Ci="https://deep-index.moralis.io";function qt(){return"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJub25jZSI6ImY4NmY0Yzc2LTA3MDQtNGEwZS04YTA0LWUwODllOGQxMGZjZCIsIm9yZ0lkIjoiMzk0MDAyIiwidXNlcklkIjoiNDA0ODUzIiwidHlwZUlkIjoiYjQyODExOTQtOGQ0Yi00NjkxLTlhZjItNjU4ODE2NzExYmRjIiwidHlwZSI6IlBST0pFQ1QiLCJpYXQiOjE3MTY4NjQyNTYsImV4cCI6NDg3MjYyNDI1Nn0.V8crfBIBardAnZkc05FD0hQIJBeZxMqvzRnYExVtnF8"}function Jt(e){return{"X-API-Key":e,Accept:"application/json"}}const Xt=new fn(Ci);async function rt(e){const{address:t,chain:n="base",token_addresses:s,exclude_spam:r,exclude_unverified_contracts:a}=e;if(!t)throw new Error("Address is required");try{const o=qt(),c={chain:n,exclude_spam:r??!1,exclude_unverified_contracts:a??!1};s&&(c.token_addresses=s);const C=(await Xt.get(`/api/v2.2/wallets/${encodeURIComponent(t)}/tokens`,{query:c,headers:Jt(o)})).data;return C?.result?.length>0&&(C.result=C.result.filter(N=>new de(N?.balance||0).gt(0)),C.result=C.result.map(N=>({...N,token_address:N.token_address===pi?qe:N.token_address}))),{success:!0,data:C}}catch(o){const c=o instanceof Error?o.message:"Unknown error";return console.error("❌ Error fetching token balances:",c),{success:!1,error:c}}}async function Bi(e){const{address:t,chain:n="base"}=e;if(!t)throw new Error("Token address is required");try{const s=qt(),[r,a]=await Promise.allSettled([Xt.get("/api/v2.2/erc20/metadata",{query:{chain:n,addresses:[t]},headers:Jt(s)}),Xt.get(`/api/v2.2/erc20/${encodeURIComponent(t)}/price`,{query:{chain:n,include:"percent_change"},headers:Jt(s)})]),o=r.status==="fulfilled"?r.value.data:[];if(!o||o.length===0)return{success:!1,error:"Token metadata not found"};const c=o[0],T=a.status==="fulfilled"?a.value.data?.usdPrice??void 0:void 0;return{success:!0,data:{token_address:c.token_address,name:c.name,symbol:c.symbol,decimals:c.decimals,logo:c.logo||c.thumbnail,thumbnail:c.thumbnail,usd_price:T}}}catch(s){const r=s instanceof Error?s.message:"Unknown error";return console.error("❌ Error fetching token metadata:",r),{success:!1,error:r}}}async function Pi(e){const{prompt:t,model:n="gpt-4.1-mini",stream:s=!1,systemPrompt:r}=e;if(!t)throw new Error("Prompt is required");try{const a=qt(),o=new fn("https://cortex-api.moralis.io"),c=r?`${r}
2
+ (function(pt,B){typeof exports=="object"&&typeof module<"u"?B(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],B):(pt=typeof globalThis<"u"?globalThis:pt||self,B(pt.ChatWidgetSDK={},pt.jsxRuntime,pt.React))})(this,(function(pt,B,se){"use strict";const _s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHAAAABwCAYAAADG4PRLAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAfXSURBVHgB7Z1LbFRVGMe/c4YCAmKrEFiQWIIrNm13RE0olLRuTCq4w4C6Mbopo9GltFsVpmxQN1pJ2MkjcSMESrsgYdd2w8rGkrCA8GjFVintzPH878wZjrfzujPTe88p3y+ZzMydOxO4//s9z3dvBTWB7sxsqyTqF2q5k4R8nUh06s2thQeTZyZ4qOwU0bqJFkHjv6fbZqhBBNVJIJqiASFUN94SExl98CeVEsONiBlZQEu4E8QW1kTUSAvJoahCRhLw4OnZkyzc6qItcnD087ahWvevScB3MrPty6QuKaJOYuJgpoXEgVqsUVbboef07PElUhMsXqy045j3ZB72V9uxooCHtMskoUaIXWYS6GMuLyFsVdqprAuFeEqoQWISp1JcLClgz3fadFPyEjHuIMWH1wfafglvXiEgEhb4X2K36RpzOrHpCic2K2KgFu8GsXgu0opKILzxfwIeygfMdmKcBJXAwVOPBu1tRRdacJ1/EuM6c1kSu8fSbXN4U7TAJZUdJMYHWmUud8K8CSyQrc87ilYYWOCzXLabGJ8oWmEgoJRygBivEFLsD57ZffqLdqNtkt2nv8hctl8qIXiVwVOE1k5KITqI8RTRjiSmnRg/EdTBAvpNa9UVecZpWEDfYQE9hwX0HBbQc1jAEFs2CLp2oi14dOxaR67DAoZ4c09L8XXHrhZyHRYwxFt71hdf9+5dT67DAlrs2Cq1gM+tbqd+77obZQEtju17qaZtLsECFji2byP1lXCZsMAvezcHyY2LuJ9mrSKbtShva5fZu3dDRVcJYfH5uVv/0tTdZbr/JEeuIHoyjxV5CA4+Duye7Skdq1JV9z87/g9NP8gGr5FpHunaWHd8w+9cmHhKV28/o6Tx0gIPd20IYlMUtza/+Pw8Pa6/C+HrBd/9SrtVF6zRuxiIWPXZ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NbBbY7Ov5ooC6L0pmeb+wv+vigdgEXI2LMmvBXKC5VonVp5kuSF+V+7I0A1gRrqG/oFcwfLCkenHiPjGV5kWbcS38WsbpMoLFq46zArJ4teGkgCxe7TgnIIsXDacEZPGi44yALF59OLEeiNaVbwupruCEBbJ49cPLSZ7DAnoOC+g5LKDnsICeI/VSxBwx3iIFC+gzM9qFqklifGVG5hTdIcZPlJqSQrEFektKTsicTF0mxkuyORqXY+k2JDFjxHiFrh4mtXYzQR0ocmqcGK8QUgzjORBwWcphrgf9Au4Tz4GAcKM6HT1DjCeIEbhPvCq20tgK/SFLNGReFwVkK/QDRWrIWB9YcXuHg5nHE3pjJzHOoT3kzGj61d32thWrETkS77ErdQ9oorU5EN6+QsC8eebSxDiFoNxHtus0lFwPHE1vGxHa1xLjBIh719PbSnbMKt7i6FDm0aAicZKYxIB4o+nXBst9XvUeVT2Zh/2K5M96x1ZiYiOfh+TS8IaV9qvpJmPdmdl2SeqG3rmdmFUHfU4kk6ViXphIf8ubXerqAqvThnLmWgWXGSbaH2OnvDWmVG6QhDhOTFMwwi2THC6sDtVMZAENebea7daJ7AAX/nUzprP98XqEM9QtoI0RUyjRqS2zg/Kxsp2YAFhYfnhMTeo3d5RQOsalLtcrms1//TyUbJOo0HUAAAAASUVORK5CYII=",co={en:{chatTitle:"Keyring Agent",closeChat:"Close chat",messagePlaceholder:"Message ....",sendMessage:"Send message",botIsTyping:"Bot is typing",canIHelpYou:"Can I help you with anything?",replyToMessage:"Reply to message",replyingTo:"Replying to",replyingToYou:"You",replyingToAgent:"Keyring Agent",cancelReply:"Cancel reply",suggestionAskText:"Ask a question",suggestionAskUserMessage:"I have a question",suggestionAskBotReply:"Ask me anything",suggestionBuyText:"Buy trending token",walletConnectedChainUnsupported:"Your wallet is connected but the chain is not supported for trading. Please switch to a supported chain to see trending tokens.",walletNotConnected:"Please connect your wallet to see trending tokens.",actionProcessing:"⏳ Processing transaction...",actionSuccess:" Transaction completed",actionFail:"❌ Action cancelled or failed",txSubmitted:"⏳ Transaction submitted. Waiting for confirmation...",txConfirmed:"✅ Transaction confirmed!",txReverted:"❌ Transaction reverted on-chain.",txTimeout:"⚠️ Transaction submitted but confirmation timed out. Please check manually.",txSuccessful:"✅ Transaction successful!",txFailed:"Transaction failed. Please try again.",txNoHandler:"⚠️ No transaction handler configured.",txInsufficientGas:"⚠️ **Insufficient {symbol} for gas!** You have {balance} {symbol} but need ~{fee} {symbol} for the transaction fee. Please top up your wallet and try again.",txError:"❌ Error: {message}",swapConfirmButton:"Confirm",swapConfirmValue:"Confirm swap",swapReadyToProceed:"Ready to proceed with the swap?",swapEstimationError:"⚠️ Unable to get swap estimation. Error: {error}",formCancel:"Cancel",formExecute:"🚀 Execute",formProcessing:"⏳ Processing...",formBalance:"Balance:",formTokenNotFound:"Token not found in your wallet.",formNoBalance:"You have no {symbol} balance in your wallet.",formInsufficientBalance:"Insufficient balance. Available: {balance} {symbol}",formFieldRequired:"{field} is required",formInvalidAddress:"Invalid address (0x + 40 hex chars)",formMustBePositive:"Must be a positive number",formMustBeValidNumber:"Must be a valid number",openChat:"Open chat",openChatTitle:"Open chat support",walletBalanceSpendable:"This is the spendable balance of your wallet on {chain} chain. Please choose the coins you want to use for this trade.",walletNoTokensFound:"Sorry, I couldn't find any tokens in your wallet on {chain} chain. Please make sure you have some tokens to trade.",walletFetchFailed:"Sorry, I could not fetch your wallet balance. Please try again.",walletFetchError:"Sorry, I encountered an error fetching your wallet balance.",insufficientFeeToken:"Insufficient fee. Please ensure you have enough {symbol} to cover the transaction fees, or select a different token.",selectAmountOf:`📊 Select the amount of {symbol} to use:
3
+
4
+ Available: {balance} {symbol}`,swapFeeWarning:`
5
+ ⚠️ **Insufficient {symbol} for fees!**
6
+ You have {balance} {symbol} but need ~{needed} {symbol}.
7
+ `,swapNeedApprove:"You need to approve {symbol} first before swapping.",swapApproveButton:"Approve {symbol}",swapApproveValue:"Approve {symbol} for swap",swapNoSourceToken:"⚠️ You don't have the source token in your wallet or balance is 0.",swapSelectAmount:`Swap {from} → {to}
8
+
9
+ Select the amount of {from} to swap:
10
+
11
+ Available: {balance} {from}`,swapApprovalRequired:`⚠️ Token approval required before swapping.
12
+
13
+ Step 1: Approve {symbol}
14
+ Step 2: Confirm Swap`,swapEstimationFailed:"⚠️ Failed to get swap estimation. Please try again.",swapInsufficientNativeBalance:"⚠️ Insufficient balance! You have {balance} {symbol} but need {amount}. Please top up your wallet or reduce the amount.",swapTokenNotInWallet:"⚠️ You don't have {symbol} in your wallet. Please acquire some first before swapping.",swapInsufficientTokenBalance:"⚠️ Insufficient balance! You have {balance} {symbol} but need {amount}. Please reduce the amount or add more tokens.",selectAmountToSwap:`📊 Select the amount of {symbol} to swap:
15
+
16
+ Available: {balance} {symbol}`,couldNotLoadTokenList:"⚠️ Could not load token list. Please specify the destination token.",trendingTokensForReceive:"📈 Trending tokens on {chain} chain. Pick the token you want to receive:",txProcessing:"⚙️ Transaction processing... Please wait.",txConfirmedSwap:"✅ Transaction confirmed! Your swap has been completed.",txRevertedSwap:"❌ Transaction reverted on-chain. Please try again.",txSuccessfulSwap:"✅ Transaction successful! Your swap has been completed.",txDataNotAvailable:"⚠️ Transaction data not available.",approvalDataNotAvailable:"⚠️ Approval data not available.",approving:"Approving {symbol}... Please confirm in your wallet.",approvalSuccess:"✅ {symbol} approved successfully!",approvalConfirmSwap:"Now you can execute the swap.",confirmSwapButton:"Confirm Swap",approvalFailed:"❌ Approval failed. Please try again.",couldNotFetchBalance:"⚠️ Could not fetch your wallet balance.",couldNotLoadBalance:"⚠️ Could not load balance. Please try again.",couldNotFetchBalanceRetry:"⚠️ Could not fetch your balance. Please try again.",nftSendReview:`📤 Send **{name}** ({standard} #{tokenId})
17
+
18
+ Please review and fill in the recipient address below:`,nftCollectionHeader:`🖼️ Your NFT Collection ({count} items):
19
+
20
+ {list}
21
+
22
+ Select an NFT to send:`,nftNoCollection:"🖼️ You don't have any NFTs in your wallet on this chain.",nftFetchError:"Sorry, I encountered an error fetching your NFTs.",trendingTokensHeader:"📈 Here is the list of tokens that are currently trending upwards on {chain} chain",trendingTokensQuestion:`
23
+ Is there any token you want to buy?`,trendingTokensError:"Sorry, I encountered an error fetching trending tokens.",errorProcessingRequest:"Sorry, I encountered an error processing your request.",buttonBuyWith:"Buy with {symbol}",buttonUsePercent:"Use {percent}% of {symbol}",buttonBuyToken:"Buy {name} ({symbol})",buttonSendNft:"Send {name}",buttonSwapTo:"Swap to {name} ({symbol})",buttonBuySymbol:"Buy {symbol}"},ja:{chatTitle:"Keyringエージェント",closeChat:"チャットを閉じる",messagePlaceholder:"メッセージ....",sendMessage:"メッセージを送信",botIsTyping:"ボットが入力中",canIHelpYou:"何かお手伝いできますか?",replyToMessage:"メッセージに返信",replyingTo:"返信先:",replyingToYou:"あなた",replyingToAgent:"Keyringエージェント",cancelReply:"返信をキャンセル",suggestionAskText:"質問する",suggestionAskUserMessage:"質問があります",suggestionAskBotReply:"何でも聞いてください",suggestionBuyText:"トレンドトークンを購入",walletConnectedChainUnsupported:"ウォレットは接続されていますが、このチェーンは取引に対応していません。対応チェーンに切り替えてトレンドトークンを確認してください。",walletNotConnected:"トレンドトークンを確認するにはウォレットを接続してください。",actionProcessing:"⏳ トランザクション処理中...",actionSuccess:"✅ トランザクション完了",actionFail:"❌ アクションがキャンセルまたは失敗しました",txSubmitted:"⏳ トランザクションを送信しました。確認をお待ちください...",txConfirmed:"✅ トランザクションが確認されました!",txReverted:"❌ トランザクションはオンチェーンでリバートされました。",txTimeout:"⚠️ トランザクションは送信されましたが、確認がタイムアウトしました。手動で確認してください。",txSuccessful:"✅ トランザクションが成功しました!",txFailed:"トランザクションが失敗しました。もう一度お試しください。",txNoHandler:"⚠️ トランザクションハンドラが設定されていません。",txInsufficientGas:"⚠️ **ガス代の{symbol}が不足しています!** {symbol}の残高は{balance}ですが、取引手数料として約{fee} {symbol}が必要です。ウォレットをチャージして再試行してください。",txError:"❌ エラー:{message}",swapConfirmButton:"確認",swapConfirmValue:"スワップを確認",swapReadyToProceed:"スワップを実行する準備ができていますか?",swapEstimationError:"⚠️ スワップの見積もりを取得できませんでした。エラー:{error}",formCancel:"キャンセル",formExecute:"🚀 実行",formProcessing:"⏳ 処理中...",formBalance:"残高:",formTokenNotFound:"ウォレットにトークンが見つかりませんでした。",formNoBalance:"ウォレットに{symbol}の残高がありません。",formInsufficientBalance:"残高が不足しています。利用可能:{balance} {symbol}",formFieldRequired:"{field}は必須です",formInvalidAddress:"無効なアドレス(0x + 40桁の16進数)",formMustBePositive:"正の数値を入力してください",formMustBeValidNumber:"有効な数値を入力してください",openChat:"チャットを開く",openChatTitle:"チャットサポートを開く",walletBalanceSpendable:"{chain}チェーンのウォレットの利用可能残高です。この取引に使用するコインを選択してください。",walletNoTokensFound:"申し訳ありませんが、{chain}チェーンのウォレットにトークンが見つかりませんでした。取引用のトークンがあることをご確認ください。",walletFetchFailed:"ウォレット残高を取得できませんでした。もう一度お試しください。",walletFetchError:"ウォレット残高の取得中にエラーが発生しました。",insufficientFeeToken:"手数料が不足しています。{symbol}が取引手数料をカバーするのに十分であることを確認するか、別のトークンを選択してください。",selectAmountOf:`📊 使用する{symbol}の量を選択:
24
+
25
+ 利用可能: {balance} {symbol}`,swapFeeWarning:`
26
+ ⚠️ **手数料の{symbol}が不足しています!**
27
+ {symbol}の残高は{balance}ですが、約{needed} {symbol}が必要です。
28
+ `,swapNeedApprove:"スワップ前に{symbol}の承認が必要です。",swapApproveButton:"{symbol}を承認",swapApproveValue:"スワップのために{symbol}を承認",swapNoSourceToken:"⚠️ ウォレットにソーストークンがないか、残高が0です。",swapSelectAmount:`Swap {from} → {to}
29
+
30
+ スワップする{from}の量を選択:
31
+
32
+ 利用可能: {balance} {from}`,swapApprovalRequired:`⚠️ スワップ前にトークンの承認が必要です。
33
+
34
+ ステップ1: {symbol}を承認
35
+ ステップ2: スワップを確認`,swapEstimationFailed:"⚠️ スワップの見積もりを取得できませんでした。もう一度お試しください。",swapInsufficientNativeBalance:"⚠️ 残高不足!{symbol}の残高は{balance}ですが、{amount}が必要です。ウォレットをチャージするか、金額を減らしてください。",swapTokenNotInWallet:"⚠️ ウォレットに{symbol}がありません。スワップ前に取得してください。",swapInsufficientTokenBalance:"⚠️ 残高不足!{balance} {symbol}しかありませんが、{amount}が必要です。金額を減らすかトークンを追加してください。",selectAmountToSwap:`📊 スワップする{symbol}の量を選択:
36
+
37
+ 利用可能: {balance} {symbol}`,couldNotLoadTokenList:"⚠️ トークンリストを読み込めませんでした。宛先トークンを指定してください。",trendingTokensForReceive:"📈 {chain}チェーンのトレンドトークン。受け取りたいトークンを選択してください:",txProcessing:"⚙️ トランザクション処理中... お待ちください。",txConfirmedSwap:"✅ トランザクションが確認されました!スワップが完了しました。",txRevertedSwap:"❌ トランザクションはオンチェーンでリバートされました。もう一度お試しください。",txSuccessfulSwap:"✅ トランザクションが成功しました!スワップが完了しました。",txDataNotAvailable:"⚠️ トランザクションデータが利用できません。",approvalDataNotAvailable:"⚠️ 承認データが利用できません。",approving:"{symbol}を承認中... ウォレットで確認してください。",approvalSuccess:"✅ {symbol}が正常に承認されました!",approvalConfirmSwap:"スワップを実行できるようになりました。",confirmSwapButton:"スワップを確認",approvalFailed:"❌ 承認に失敗しました。もう一度お試しください。",couldNotFetchBalance:"⚠️ ウォレット残高を取得できませんでした。",couldNotLoadBalance:"⚠️ 残高を読み込めませんでした。もう一度お試しください。",couldNotFetchBalanceRetry:"⚠️ 残高を取得できませんでした。もう一度お試しください。",nftSendReview:`📤 **{name}**を送信 ({standard} #{tokenId})
38
+
39
+ 受取人のアドレスを確認・入力してください:`,nftCollectionHeader:`🖼️ あなたのNFTコレクション({count}件):
40
+
41
+ {list}
42
+
43
+ 送信するNFTを選択:`,nftNoCollection:"🖼️ このチェーンのウォレットにNFTがありません。",nftFetchError:"NFTの取得中にエラーが発生しました。",trendingTokensHeader:"📈 {chain}チェーンで現在上昇トレンドのトークン一覧です",trendingTokensQuestion:`
44
+ 購入したいトークンはありますか?`,trendingTokensError:"トレンドトークンの取得中にエラーが発生しました。",errorProcessingRequest:"リクエストの処理中にエラーが発生しました。",buttonBuyWith:"{symbol}で購入",buttonUsePercent:"{symbol}の{percent}%を使用",buttonBuyToken:"{name}({symbol})を購入",buttonSendNft:"{name}を送信",buttonSwapTo:"{name}({symbol})にスワップ",buttonBuySymbol:"{symbol}を購入"},cn:{chatTitle:"Keyring 助手",closeChat:"关闭聊天",messagePlaceholder:"消息....",sendMessage:"发送消息",botIsTyping:"机器人正在输入",canIHelpYou:"有什么可以帮您的吗?",replyToMessage:"回复消息",replyingTo:"回复",replyingToYou:"你",replyingToAgent:"Keyring 助手",cancelReply:"取消回复",suggestionAskText:"提问",suggestionAskUserMessage:"我有一个问题",suggestionAskBotReply:"请随时提问",suggestionBuyText:"购买热门代币",walletConnectedChainUnsupported:"您的钱包已连接,但该链不支持交易。请切换到受支持的链以查看热门代币。",walletNotConnected:"请连接钱包以查看热门代币。",actionProcessing:"⏳ 交易处理中...",actionSuccess:"✅ 交易完成",actionFail:"❌ 操作已取消或失败",txSubmitted:"⏳ 交易已提交,等待确认...",txConfirmed:"✅ 交易已确认!",txReverted:"❌ 交易在链上已回滚。",txTimeout:"⚠️ 交易已提交,但确认超时,请手动检查。",txSuccessful:"✅ 交易成功!",txFailed:"交易失败,请重试。",txNoHandler:"⚠️ 未配置交易处理程序。",txInsufficientGas:"⚠️ **{symbol}不足以支付Gas费!** 您有 {balance} {symbol},但需要约 {fee} {symbol} 作为交易费用。请充值钱包后重试。",txError:"❌ 错误:{message}",swapConfirmButton:"确认",swapConfirmValue:"确认兑换",swapReadyToProceed:"准备好进行兑换了吗?",swapEstimationError:"⚠️ 无法获取兑换估算。错误:{error}",formCancel:"取消",formExecute:"🚀 执行",formProcessing:"⏳ 处理中...",formBalance:"余额:",formTokenNotFound:"您的钱包中未找到该代币。",formNoBalance:"您的钱包中没有 {symbol} 余额。",formInsufficientBalance:"余额不足。可用:{balance} {symbol}",formFieldRequired:"{field}为必填项",formInvalidAddress:"无效地址(0x + 40个十六进制字符)",formMustBePositive:"必须为正数",formMustBeValidNumber:"必须为有效数字",openChat:"打开聊天",openChatTitle:"打开聊天支持",walletBalanceSpendable:"这是您在{chain}链上钱包的可用余额。请选择您要用于此交易的代币。",walletNoTokensFound:"抱歉,在{chain}链上您的钱包中找不到任何代币。请确保您有一些代币可以交易。",walletFetchFailed:"无法获取钱包余额,请重试。",walletFetchError:"获取钱包余额时遇到错误。",insufficientFeeToken:"手续费不足。请确保您有足够的 {symbol} 支付交易手续费,或选择其他代币。",selectAmountOf:`📊 选择要使用的 {symbol} 数量:
45
+
46
+ 可用: {balance} {symbol}`,swapFeeWarning:`
47
+ ⚠️ **{symbol}不足以支付手续费!**
48
+ 您有 {balance} {symbol},但需要约 {needed} {symbol}。
49
+ `,swapNeedApprove:"兑换前需要先授权 {symbol}。",swapApproveButton:"授权 {symbol}",swapApproveValue:"授权 {symbol} 用于兑换",swapNoSourceToken:"⚠️ 您的钱包中没有源代币或余额为0。",swapSelectAmount:`兑换 {from} → {to}
50
+
51
+ 选择要兑换的 {from} 数量:
52
+
53
+ 可用: {balance} {from}`,swapApprovalRequired:`⚠️ 兑换前需要代币授权。
54
+
55
+ 第1步:授权 {symbol}
56
+ 第2步:确认兑换`,swapEstimationFailed:"⚠️ 获取兑换估算失败,请重试。",swapInsufficientNativeBalance:"⚠️ 余额不足!您有 {balance} {symbol},但需要 {amount}。请充值钱包或减少金额。",swapTokenNotInWallet:"⚠️ 您的钱包中没有 {symbol}。请先获取一些再进行兑换。",swapInsufficientTokenBalance:"⚠️ 余额不足!您有 {balance} {symbol},但需要 {amount}。请减少金额或添加更多代币。",selectAmountToSwap:`📊 选择要兑换的 {symbol} 数量:
57
+
58
+ 可用: {balance} {symbol}`,couldNotLoadTokenList:"⚠️ 无法加载代币列表。请指定目标代币。",trendingTokensForReceive:"📈 {chain}链上的热门代币。请选择您想接收的代币:",txProcessing:"⚙️ 交易处理中... 请稍候。",txConfirmedSwap:"✅ 交易已确认!您的兑换已完成。",txRevertedSwap:"❌ 交易在链上已回滚,请重试。",txSuccessfulSwap:"✅ 交易成功!您的兑换已完成。",txDataNotAvailable:"⚠️ 交易数据不可用。",approvalDataNotAvailable:"⚠️ 授权数据不可用。",approving:"正在授权 {symbol}... 请在钱包中确认。",approvalSuccess:"✅ {symbol} 授权成功!",approvalConfirmSwap:"现在您可以执行兑换了。",confirmSwapButton:"确认兑换",approvalFailed:"❌ 授权失败,请重试。",couldNotFetchBalance:"⚠️ 无法获取钱包余额。",couldNotLoadBalance:"⚠️ 无法加载余额,请重试。",couldNotFetchBalanceRetry:"⚠️ 无法获取余额,请重试。",nftSendReview:`📤 发送 **{name}** ({standard} #{tokenId})
59
+
60
+ 请检查并填写收件人地址:`,nftCollectionHeader:`🖼️ 您的NFT收藏({count}件):
61
+
62
+ {list}
63
+
64
+ 选择要发送的NFT:`,nftNoCollection:"🖼️ 您在此链的钱包中没有NFT。",nftFetchError:"获取NFT时遇到错误。",trendingTokensHeader:"📈 以下是{chain}链上目前上涨趋势的代币列表",trendingTokensQuestion:`
65
+ 您想购买哪个代币?`,trendingTokensError:"获取热门代币时遇到错误。",errorProcessingRequest:"处理您的请求时遇到错误。",buttonBuyWith:"用{symbol}购买",buttonUsePercent:"使用{symbol}的{percent}%",buttonBuyToken:"购买{name}({symbol})",buttonSendNft:"发送{name}",buttonSwapTo:"兑换至{name}({symbol})",buttonBuySymbol:"购买{symbol}"}};function lo(e,t){return co[t]?.[e]??co.en[e]??e}function Ls(e,t){return e.replace(/\{(\w+)\}/g,(n,o)=>t[o]??`{${o}}`)}const uo=se.createContext(void 0),Rs=({children:e,initialLanguage:t="en"})=>{const[n,o]=se.useState(t);se.useEffect(()=>{t&&o(t)},[t]);const s=se.useCallback(a=>lo(a,n),[n]),r=se.useCallback((a,l)=>Ls(lo(a,n),l),[n]);return B.jsx(uo.Provider,{value:{language:n,setLanguage:o,t:s,ti:r},children:e})},kn=()=>{const e=se.useContext(uo);if(!e)throw new Error("useLanguage must be used within a LanguageProvider");return e},Hs=se.memo(({onClick:e})=>{const{t}=kn(),n=o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),e())};return B.jsx("button",{className:"chat-button",onClick:e,onKeyDown:n,"aria-label":t("openChat"),title:t("openChatTitle"),type:"button",children:B.jsx("img",{src:_s,width:56,height:56,alt:"Ask AI"})})});function rt(e){const t={formatters:void 0,fees:void 0,serializers:void 0,...e};function n(o){return s=>{const r=typeof s=="function"?s(o):s,a={...o,...r};return Object.assign(a,{extend:n(a)})}}return Object.assign(t,{extend:n(t)})}const fo="2.45.1";let Tn={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${fo}`};class pe extends Error{constructor(t,n={}){const o=n.cause instanceof pe?n.cause.details:n.cause?.message?n.cause.message:n.details,s=n.cause instanceof pe&&n.cause.docsPath||n.docsPath,r=Tn.getDocsUrl?.({...n,docsPath:s}),a=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...r?[`Docs: ${r}`]:[],...o?[`Details: ${o}`]:[],...Tn.version?[`Version: ${Tn.version}`]:[]].join(`
66
+ `);super(a,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=o,this.docsPath=s,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=fo}walk(t){return po(this,t)}}function po(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?po(e.cause,t):t?null:e}class xn extends pe{constructor({max:t,min:n,signed:o,size:s,value:r}){super(`Number "${r}" is not in safe ${s?`${s*8}-bit ${o?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class Vs extends pe{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Nt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function Ve(e){return Nt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function nn(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,o=0;for(let s=0;s<n.length-1&&n[t==="left"?s:n.length-s-1].toString()==="0";s++)o++;return n=t==="left"?n.slice(o):n.slice(0,n.length-o),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}class mo extends pe{constructor({offset:t,position:n,size:o}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${o}).`,{name:"SliceOffsetOutOfBoundsError"})}}class ho extends pe{constructor({size:t,targetSize:n,type:o}){super(`${o.charAt(0).toUpperCase()}${o.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}function Pt(e,{dir:t,size:n=32}={}){return typeof e=="string"?mt(e,{dir:t,size:n}):Ws(e,{dir:t,size:n})}function mt(e,{dir:t,size:n=32}={}){if(n===null)return e;const o=e.replace("0x","");if(o.length>n*2)throw new ho({size:Math.ceil(o.length/2),targetSize:n,type:"hex"});return`0x${o[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function Ws(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new ho({size:e.length,targetSize:n,type:"bytes"});const o=new Uint8Array(n);for(let s=0;s<n;s++){const r=t==="right";o[r?s:n-s-1]=e[r?s:e.length-s-1]}return o}const Gs=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Ft(e,t={}){return typeof e=="number"||typeof e=="bigint"?de(e,t):typeof e=="string"?bo(e,t):typeof e=="boolean"?go(e,t):at(e,t)}function go(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Ut(n,{size:t.size}),Pt(n,{size:t.size})):n}function at(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=Gs[e[s]];const o=`0x${n}`;return typeof t.size=="number"?(Ut(o,{size:t.size}),Pt(o,{dir:"right",size:t.size})):o}function de(e,t={}){const{signed:n,size:o}=t,s=BigInt(e);let r;o?n?r=(1n<<BigInt(o)*8n-1n)-1n:r=2n**(BigInt(o)*8n)-1n:typeof e=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const a=typeof r=="bigint"&&n?-r-1n:0;if(r&&s>r||s<a){const f=typeof e=="bigint"?"n":"";throw new xn({max:r?`${r}${f}`:void 0,min:`${a}${f}`,signed:n,size:o,value:`${e}${f}`})}const l=`0x${(n&&s<0?(1n<<BigInt(o*8))+BigInt(s):s).toString(16)}`;return o?Pt(l,{size:o}):l}const $s=new TextEncoder;function bo(e,t={}){const n=$s.encode(e);return at(n,t)}const zs=new TextEncoder;function En(e,t={}){return typeof e=="number"||typeof e=="bigint"?Ys(e,t):typeof e=="boolean"?qs(e,t):Nt(e)?vt(e,t):yo(e,t)}function qs(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(Ut(n,{size:t.size}),Pt(n,{size:t.size})):n}const it={zero:48,nine:57,A:65,F:70,a:97,f:102};function wo(e){if(e>=it.zero&&e<=it.nine)return e-it.zero;if(e>=it.A&&e<=it.F)return e-(it.A-10);if(e>=it.a&&e<=it.f)return e-(it.a-10)}function vt(e,t={}){let n=e;t.size&&(Ut(n,{size:t.size}),n=Pt(n,{dir:"right",size:t.size}));let o=n.slice(2);o.length%2&&(o=`0${o}`);const s=o.length/2,r=new Uint8Array(s);for(let a=0,l=0;a<s;a++){const f=wo(o.charCodeAt(l++)),S=wo(o.charCodeAt(l++));if(f===void 0||S===void 0)throw new pe(`Invalid byte sequence ("${o[l-2]}${o[l-1]}" in "${o}").`);r[a]=f*16+S}return r}function Ys(e,t){const n=de(e,t);return vt(n)}function yo(e,t={}){const n=zs.encode(e);return typeof t.size=="number"?(Ut(n,{size:t.size}),Pt(n,{dir:"right",size:t.size})):n}function Ut(e,{size:t}){if(Ve(e)>t)throw new Vs({givenSize:Ve(e),maxSize:t})}function Ot(e,t={}){const{signed:n}=t;t.size&&Ut(e,{size:t.size});const o=BigInt(e);if(!n)return o;const s=(e.length-2)/2,r=(1n<<BigInt(s)*8n-1n)-1n;return o<=r?o:o-BigInt(`0x${"f".padStart(s*2,"f")}`)-1n}function on(e,t={}){const n=Ot(e,t),o=Number(n);if(!Number.isSafeInteger(o))throw new xn({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${n}n`});return o}function Sn(e,t){return({exclude:n,format:o})=>({exclude:n,format:(s,r)=>{const a=t(s,r);if(n)for(const l of n)delete a[l];return{...a,...o(s,r)}},type:e})}const vo={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Cn(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?on(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?on(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?vo[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(n.authorizationList=Js(e.authorizationList)),n.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof n.v=="bigint"){if(n.v===0n||n.v===27n)return 0;if(n.v===1n||n.v===28n)return 1;if(n.v>=35n)return n.v%2n===0n?1:0}})(),n.type==="legacy"&&(delete n.accessList,delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.yParity),n.type==="eip2930"&&(delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas),n.type==="eip1559"&&delete n.maxFeePerBlobGas,n}const js=Sn("transaction",Cn);function Js(e){return e.map(t=>({address:t.address,chainId:Number(t.chainId),nonce:Number(t.nonce),r:t.r,s:t.s,yParity:Number(t.yParity)}))}function Xs(e,t){const n=(e.transactions??[]).map(o=>typeof o=="string"?o:Cn(o));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:n,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}const Ks=Sn("block",Xs);function Zs(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}const Qs={"0x0":"reverted","0x1":"success"};function er(e,t){const n={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(o=>Zs(o)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?on(e.transactionIndex):null,status:e.status?Qs[e.status]:null,type:e.type?vo[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const tr=Sn("transactionReceipt",er),nr={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function or(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=sr(e.authorizationList)),typeof e.accessList<"u"&&(n.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(n.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?n.blobs=e.blobs.map(o=>at(o)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=de(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=de(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=de(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=de(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=de(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=de(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=nr[e.type]),typeof e.value<"u"&&(n.value=de(e.value)),n}function sr(e){return e.map(t=>({address:t.address,r:t.r?de(BigInt(t.r)):t.r,s:t.s?de(BigInt(t.s)):t.s,chainId:de(t.chainId),nonce:de(t.nonce),...typeof t.yParity<"u"?{yParity:de(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:de(t.v)}:{}}))}const Dt=2n**256n-1n;function Mt(e){return typeof e[0]=="string"?At(e):rr(e)}function rr(e){let t=0;for(const s of e)t+=s.length;const n=new Uint8Array(t);let o=0;for(const s of e)n.set(s,o),o+=s.length;return n}function At(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}class Ao extends pe{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class ar extends pe{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class ir extends pe{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const cr={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new ir({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new ar({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Ao({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new Ao({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function ko(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(cr);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function kt(e,t="hex"){const n=To(e),o=ko(new Uint8Array(n.length));return n.encode(o),t==="hex"?at(o.bytes):o.bytes}function To(e){return Array.isArray(e)?lr(e.map(t=>To(t))):dr(e)}function lr(e){const t=e.reduce((s,r)=>s+r.length,0),n=xo(t);return{length:t<=55?1+t:1+n+t,encode(s){t<=55?s.pushByte(192+t):(s.pushByte(247+n),n===1?s.pushUint8(t):n===2?s.pushUint16(t):n===3?s.pushUint24(t):s.pushUint32(t));for(const{encode:r}of e)r(s)}}}function dr(e){const t=typeof e=="string"?vt(e):e,n=xo(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length,encode(s){t.length===1&&t[0]<128?s.pushBytes(t):t.length<=55?(s.pushByte(128+t.length),s.pushBytes(t)):(s.pushByte(183+n),n===1?s.pushUint8(t.length):n===2?s.pushUint16(t.length):n===3?s.pushUint24(t.length):s.pushUint32(t.length),s.pushBytes(t))}}}function xo(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new pe("Length is too large.")}const ur={gwei:9,wei:18},fr={ether:-9,wei:9};function Ue(e,t){let n=e.toString();const o=n.startsWith("-");o&&(n=n.slice(1)),n=n.padStart(t,"0");let[s,r]=[n.slice(0,n.length-t),n.slice(n.length-t)];return r=r.replace(/(0+)$/,""),`${o?"-":""}${s||"0"}${r?`.${r}`:""}`}function pr(e,t="wei"){return Ue(e,ur[t])}function Tt(e,t="wei"){return Ue(e,fr[t])}function Eo(e){const t=Object.entries(e).map(([o,s])=>s===void 0||s===!1?null:[o,s]).filter(Boolean),n=t.reduce((o,[s])=>Math.max(o,s.length),0);return t.map(([o,s])=>` ${`${o}:`.padEnd(n+1)} ${s}`).join(`
67
+ `)}class mr extends pe{constructor({v:t}){super(`Invalid \`v\` value "${t}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class hr extends pe{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Eo(t),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class gr extends pe{constructor({storageKey:t}){super(`Size for storage key "${t}" is invalid. Expected 32 bytes. Got ${Math.floor((t.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}}function br(e){if(!e||e.length===0)return[];const t=[];for(const n of e){const{chainId:o,nonce:s,...r}=n,a=n.address;t.push([o?Ft(o):"0x",a,s?Ft(s):"0x",...zt({},r)])}return t}function So(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),o=typeof e.blobs[0]=="string"?e.blobs.map(r=>vt(r)):e.blobs,s=[];for(const r of o)s.push(Uint8Array.from(t.blobToKzgCommitment(r)));return n==="bytes"?s:s.map(r=>at(r))}function Co(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),o=typeof e.blobs[0]=="string"?e.blobs.map(a=>vt(a)):e.blobs,s=typeof e.commitments[0]=="string"?e.commitments.map(a=>vt(a)):e.commitments,r=[];for(let a=0;a<o.length;a++){const l=o[a],f=s[a];r.push(Uint8Array.from(t.computeBlobKzgProof(l,f)))}return n==="bytes"?r:r.map(a=>at(a))}function wr(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Bo(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Vt(e,...t){if(!wr(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function sn(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Io(e,t){Vt(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function yr(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Wt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Bn(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function tt(e,t){return e<<32-t|e>>>t}const vr=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Ar(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function kr(e){for(let t=0;t<e.length;t++)e[t]=Ar(e[t]);return e}const No=vr?e=>e:kr;function Tr(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function In(e){return typeof e=="string"&&(e=Tr(e)),Vt(e),e}class Po{}function Fo(e){const t=o=>e().update(In(o)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function xr(e,t,n,o){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,o);const s=BigInt(32),r=BigInt(4294967295),a=Number(n>>s&r),l=Number(n&r),f=o?4:0,S=o?0:4;e.setUint32(t+f,a,o),e.setUint32(t+S,l,o)}function Er(e,t,n){return e&t^~e&n}function Sr(e,t,n){return e&t^e&n^t&n}class Cr extends Po{constructor(t,n,o,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=o,this.isLE=s,this.buffer=new Uint8Array(t),this.view=Bn(this.buffer)}update(t){sn(this),t=In(t),Vt(t);const{view:n,buffer:o,blockLen:s}=this,r=t.length;for(let a=0;a<r;){const l=Math.min(s-this.pos,r-a);if(l===s){const f=Bn(t);for(;s<=r-a;a+=s)this.process(f,a);continue}o.set(t.subarray(a,a+l),this.pos),this.pos+=l,a+=l,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){sn(this),Io(t,this),this.finished=!0;const{buffer:n,view:o,blockLen:s,isLE:r}=this;let{pos:a}=this;n[a++]=128,Wt(this.buffer.subarray(a)),this.padOffset>s-a&&(this.process(o,0),a=0);for(let _=a;_<s;_++)n[_]=0;xr(o,s-8,BigInt(this.length*8),r),this.process(o,0);const l=Bn(t),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const S=f/4,N=this.get();if(S>N.length)throw new Error("_sha2: outputLen bigger than state");for(let _=0;_<S;_++)l.setUint32(4*_,N[_],r)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const o=t.slice(0,n);return this.destroy(),o}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:o,length:s,finished:r,destroyed:a,pos:l}=this;return t.destroyed=a,t.finished=r,t.length=s,t.pos=l,s%n&&t.buffer.set(o),t}clone(){return this._cloneInto()}}const ht=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),rn=BigInt(2**32-1),Uo=BigInt(32);function Br(e,t=!1){return t?{h:Number(e&rn),l:Number(e>>Uo&rn)}:{h:Number(e>>Uo&rn)|0,l:Number(e&rn)|0}}function Ir(e,t=!1){const n=e.length;let o=new Uint32Array(n),s=new Uint32Array(n);for(let r=0;r<n;r++){const{h:a,l}=Br(e[r],t);[o[r],s[r]]=[a,l]}return[o,s]}const Nr=(e,t,n)=>e<<n|t>>>32-n,Pr=(e,t,n)=>t<<n|e>>>32-n,Fr=(e,t,n)=>t<<n-32|e>>>64-n,Ur=(e,t,n)=>e<<n-32|t>>>64-n,Or=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),gt=new Uint32Array(64);class Dr extends Cr{constructor(t=32){super(64,t,8,!1),this.A=ht[0]|0,this.B=ht[1]|0,this.C=ht[2]|0,this.D=ht[3]|0,this.E=ht[4]|0,this.F=ht[5]|0,this.G=ht[6]|0,this.H=ht[7]|0}get(){const{A:t,B:n,C:o,D:s,E:r,F:a,G:l,H:f}=this;return[t,n,o,s,r,a,l,f]}set(t,n,o,s,r,a,l,f){this.A=t|0,this.B=n|0,this.C=o|0,this.D=s|0,this.E=r|0,this.F=a|0,this.G=l|0,this.H=f|0}process(t,n){for(let _=0;_<16;_++,n+=4)gt[_]=t.getUint32(n,!1);for(let _=16;_<64;_++){const b=gt[_-15],E=gt[_-2],v=tt(b,7)^tt(b,18)^b>>>3,C=tt(E,17)^tt(E,19)^E>>>10;gt[_]=C+gt[_-7]+v+gt[_-16]|0}let{A:o,B:s,C:r,D:a,E:l,F:f,G:S,H:N}=this;for(let _=0;_<64;_++){const b=tt(l,6)^tt(l,11)^tt(l,25),E=N+b+Er(l,f,S)+Or[_]+gt[_]|0,C=(tt(o,2)^tt(o,13)^tt(o,22))+Sr(o,s,r)|0;N=S,S=f,f=l,l=a+E|0,a=r,r=s,s=o,o=E+C|0}o=o+this.A|0,s=s+this.B|0,r=r+this.C|0,a=a+this.D|0,l=l+this.E|0,f=f+this.F|0,S=S+this.G|0,N=N+this.H|0,this.set(o,s,r,a,l,f,S,N)}roundClean(){Wt(gt)}destroy(){this.set(0,0,0,0,0,0,0,0),Wt(this.buffer)}}const Mr=Fo(()=>new Dr);function _r(e,t){return Mr(Nt(e,{strict:!1})?En(e):e)}function Lr(e){const{commitment:t,version:n=1}=e,o=e.to??(typeof t=="string"?"hex":"bytes"),s=_r(t);return s.set([n],0),o==="bytes"?s:at(s)}function Rr(e){const{commitments:t,version:n}=e,o=e.to??(typeof t[0]=="string"?"hex":"bytes"),s=[];for(const r of t)s.push(Lr({commitment:r,to:o,version:n}));return s}const Oo=6,Do=32,Nn=4096,Mo=Do*Nn,_o=Mo*Oo-1-1*Nn*Oo,Lo=1;class Hr extends pe{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class Ro extends pe{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class Vr extends pe{constructor({hash:t,size:n}){super(`Versioned hash "${t}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${n}`],name:"InvalidVersionedHashSizeError"})}}class Wr extends pe{constructor({hash:t,version:n}){super(`Versioned hash "${t}" version is invalid.`,{metaMessages:[`Expected: ${Lo}`,`Received: ${n}`],name:"InvalidVersionedHashVersionError"})}}function Gr(e){const t=e.to??(typeof e.data=="string"?"hex":"bytes"),n=typeof e.data=="string"?vt(e.data):e.data,o=Ve(n);if(!o)throw new Ro;if(o>_o)throw new Hr({maxSize:_o,size:o});const s=[];let r=!0,a=0;for(;r;){const l=ko(new Uint8Array(Mo));let f=0;for(;f<Nn;){const S=n.slice(a,a+(Do-1));if(l.pushByte(0),l.pushBytes(S),S.length<31){l.pushByte(128),r=!1;break}f++,a+=31}s.push(l)}return t==="bytes"?s.map(l=>l.bytes):s.map(l=>at(l.bytes))}function $r(e){const{data:t,kzg:n,to:o}=e,s=e.blobs??Gr({data:t,to:o}),r=e.commitments??So({blobs:s,kzg:n,to:o}),a=e.proofs??Co({blobs:s,commitments:r,kzg:n,to:o}),l=[];for(let f=0;f<s.length;f++)l.push({blob:s[f],commitment:r[f],proof:a[f]});return l}class nt extends pe{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class an extends pe{constructor({chainId:t}){super(typeof t=="number"?`Chain ID "${t}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}class _t extends pe{constructor({cause:t,message:n}={}){const o=n?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${o?`with reason: ${o}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(_t,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(_t,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});class xt extends pe{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Tt(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(xt,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class Pn extends pe{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Tt(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Pn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class Fn extends pe{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty(Fn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Un extends pe{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
68
+ `),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(Un,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class On extends pe{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(On,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Dn extends pe{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
69
+ `),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(Dn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Mn extends pe{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(Mn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class _n extends pe{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(_n,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Ln extends pe{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Ln,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Gt extends pe{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:o}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Tt(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${o?` = ${Tt(o)} gwei`:""}).`].join(`
70
+ `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(Gt,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Ho extends pe{constructor({cause:t}){super(`An error occurred while executing: ${t?.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}class Vo extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const o=this.keys().next().value;o&&this.delete(o)}return this}}const zr=BigInt(0),$t=BigInt(1),qr=BigInt(2),Yr=BigInt(7),jr=BigInt(256),Jr=BigInt(113),Wo=[],Go=[],$o=[];for(let e=0,t=$t,n=1,o=0;e<24;e++){[n,o]=[o,(2*n+3*o)%5],Wo.push(2*(5*o+n)),Go.push((e+1)*(e+2)/2%64);let s=zr;for(let r=0;r<7;r++)t=(t<<$t^(t>>Yr)*Jr)%jr,t&qr&&(s^=$t<<($t<<BigInt(r))-$t);$o.push(s)}const zo=Ir($o,!0),Xr=zo[0],Kr=zo[1],qo=(e,t,n)=>n>32?Fr(e,t,n):Nr(e,t,n),Yo=(e,t,n)=>n>32?Ur(e,t,n):Pr(e,t,n);function Zr(e,t=24){const n=new Uint32Array(10);for(let o=24-t;o<24;o++){for(let a=0;a<10;a++)n[a]=e[a]^e[a+10]^e[a+20]^e[a+30]^e[a+40];for(let a=0;a<10;a+=2){const l=(a+8)%10,f=(a+2)%10,S=n[f],N=n[f+1],_=qo(S,N,1)^n[l],b=Yo(S,N,1)^n[l+1];for(let E=0;E<50;E+=10)e[a+E]^=_,e[a+E+1]^=b}let s=e[2],r=e[3];for(let a=0;a<24;a++){const l=Go[a],f=qo(s,r,l),S=Yo(s,r,l),N=Wo[a];s=e[N],r=e[N+1],e[N]=f,e[N+1]=S}for(let a=0;a<50;a+=10){for(let l=0;l<10;l++)n[l]=e[a+l];for(let l=0;l<10;l++)e[a+l]^=~n[(l+2)%10]&n[(l+4)%10]}e[0]^=Xr[o],e[1]^=Kr[o]}Wt(n)}class Rn extends Po{constructor(t,n,o,s=!1,r=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=o,this.enableXOF=s,this.rounds=r,Bo(o),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=yr(this.state)}clone(){return this._cloneInto()}keccak(){No(this.state32),Zr(this.state32,this.rounds),No(this.state32),this.posOut=0,this.pos=0}update(t){sn(this),t=In(t),Vt(t);const{blockLen:n,state:o}=this,s=t.length;for(let r=0;r<s;){const a=Math.min(n-this.pos,s-r);for(let l=0;l<a;l++)o[this.pos++]^=t[r++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:o,blockLen:s}=this;t[o]^=n,(n&128)!==0&&o===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){sn(this,!1),Vt(t),this.finish();const n=this.state,{blockLen:o}=this;for(let s=0,r=t.length;s<r;){this.posOut>=o&&this.keccak();const a=Math.min(o-this.posOut,r-s);t.set(n.subarray(this.posOut,this.posOut+a),s),this.posOut+=a,s+=a}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Bo(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Io(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Wt(this.state)}_cloneInto(t){const{blockLen:n,suffix:o,outputLen:s,rounds:r,enableXOF:a}=this;return t||(t=new Rn(n,o,s,a,r)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=o,t.outputLen=s,t.enableXOF=a,t.destroyed=this.destroyed,t}}const Qr=(e,t,n)=>Fo(()=>new Rn(t,e,n)),ea=Qr(1,136,256/8);function jo(e,t){const n=t||"hex",o=ea(Nt(e,{strict:!1})?En(e):e);return n==="bytes"?o:Ft(o)}const Hn=new Vo(8192);function ta(e,t){if(Hn.has(`${e}.${t}`))return Hn.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),o=jo(yo(n),"bytes"),s=n.split("");for(let a=0;a<40;a+=2)o[a>>1]>>4>=8&&s[a]&&(s[a]=s[a].toUpperCase()),(o[a>>1]&15)>=8&&s[a+1]&&(s[a+1]=s[a+1].toUpperCase());const r=`0x${s.join("")}`;return Hn.set(`${e}.${t}`,r),r}const na=/^0x[a-fA-F0-9]{40}$/,Vn=new Vo(8192);function Le(e,t){const{strict:n=!0}=t??{},o=`${e}.${n}`;if(Vn.has(o))return Vn.get(o);const s=na.test(e)?e.toLowerCase()===e?!0:n?ta(e)===e:!0:!1;return Vn.set(o,s),s}function Wn(e,t,n,{strict:o}={}){return Nt(e,{strict:!1})?sa(e,t,n,{strict:o}):oa(e,t,n,{strict:o})}function Jo(e,t){if(typeof t=="number"&&t>0&&t>Ve(e)-1)throw new mo({offset:t,position:"start",size:Ve(e)})}function Xo(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Ve(e)!==n-t)throw new mo({offset:n,position:"end",size:Ve(e)})}function oa(e,t,n,{strict:o}={}){Jo(e,t);const s=e.slice(t,n);return o&&Xo(s,t,n),s}function sa(e,t,n,{strict:o}={}){Jo(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&Xo(s,t,n),s}function ra(e){const{authorizationList:t}=e;if(t)for(const n of t){const{chainId:o}=n,s=n.address;if(!Le(s))throw new nt({address:s});if(o<0)throw new an({chainId:o})}Gn(e)}function aa(e){const{blobVersionedHashes:t}=e;if(t){if(t.length===0)throw new Ro;for(const n of t){const o=Ve(n),s=on(Wn(n,0,1));if(o!==32)throw new Vr({hash:n,size:o});if(s!==Lo)throw new Wr({hash:n,version:s})}}Gn(e)}function Gn(e){const{chainId:t,maxPriorityFeePerGas:n,maxFeePerGas:o,to:s}=e;if(t<=0)throw new an({chainId:t});if(s&&!Le(s))throw new nt({address:s});if(o&&o>Dt)throw new xt({maxFeePerGas:o});if(n&&o&&n>o)throw new Gt({maxFeePerGas:o,maxPriorityFeePerGas:n})}function ia(e){const{chainId:t,maxPriorityFeePerGas:n,gasPrice:o,maxFeePerGas:s,to:r}=e;if(t<=0)throw new an({chainId:t});if(r&&!Le(r))throw new nt({address:r});if(n||s)throw new pe("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(o&&o>Dt)throw new xt({maxFeePerGas:o})}function ca(e){const{chainId:t,maxPriorityFeePerGas:n,gasPrice:o,maxFeePerGas:s,to:r}=e;if(r&&!Le(r))throw new nt({address:r});if(typeof t<"u"&&t<=0)throw new an({chainId:t});if(n||s)throw new pe("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(o&&o>Dt)throw new xt({maxFeePerGas:o})}function la(e){if(e.type)return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.blobs<"u"||typeof e.blobVersionedHashes<"u"||typeof e.maxFeePerBlobGas<"u"||typeof e.sidecars<"u")return"eip4844";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new hr({transaction:e})}function cn(e){if(!e||e.length===0)return[];const t=[];for(let n=0;n<e.length;n++){const{address:o,storageKeys:s}=e[n];for(let r=0;r<s.length;r++)if(s[r].length-2!==64)throw new gr({storageKey:s[r]});if(!Le(o,{strict:!1}))throw new nt({address:o});t.push([o,s])}return t}function da(e,t){const n=la(e);return n==="eip1559"?pa(e,t):n==="eip2930"?ma(e,t):n==="eip4844"?fa(e,t):n==="eip7702"?ua(e,t):ha(e,t)}function ua(e,t){const{authorizationList:n,chainId:o,gas:s,nonce:r,to:a,value:l,maxFeePerGas:f,maxPriorityFeePerGas:S,accessList:N,data:_}=e;ra(e);const b=cn(N),E=br(n);return At(["0x04",kt([de(o),r?de(r):"0x",S?de(S):"0x",f?de(f):"0x",s?de(s):"0x",a??"0x",l?de(l):"0x",_??"0x",b,E,...zt(e,t)])])}function fa(e,t){const{chainId:n,gas:o,nonce:s,to:r,value:a,maxFeePerBlobGas:l,maxFeePerGas:f,maxPriorityFeePerGas:S,accessList:N,data:_}=e;aa(e);let b=e.blobVersionedHashes,E=e.sidecars;if(e.blobs&&(typeof b>"u"||typeof E>"u")){const q=typeof e.blobs[0]=="string"?e.blobs:e.blobs.map(ye=>at(ye)),K=e.kzg,he=So({blobs:q,kzg:K});if(typeof b>"u"&&(b=Rr({commitments:he})),typeof E>"u"){const ye=Co({blobs:q,commitments:he,kzg:K});E=$r({blobs:q,commitments:he,proofs:ye})}}const v=cn(N),C=[de(n),s?de(s):"0x",S?de(S):"0x",f?de(f):"0x",o?de(o):"0x",r??"0x",a?de(a):"0x",_??"0x",v,l?de(l):"0x",b??[],...zt(e,t)],D=[],J=[],I=[];if(E)for(let q=0;q<E.length;q++){const{blob:K,commitment:he,proof:ye}=E[q];D.push(K),J.push(he),I.push(ye)}return At(["0x03",kt(E?[C,D,J,I]:C)])}function pa(e,t){const{chainId:n,gas:o,nonce:s,to:r,value:a,maxFeePerGas:l,maxPriorityFeePerGas:f,accessList:S,data:N}=e;Gn(e);const _=cn(S),b=[de(n),s?de(s):"0x",f?de(f):"0x",l?de(l):"0x",o?de(o):"0x",r??"0x",a?de(a):"0x",N??"0x",_,...zt(e,t)];return At(["0x02",kt(b)])}function ma(e,t){const{chainId:n,gas:o,data:s,nonce:r,to:a,value:l,accessList:f,gasPrice:S}=e;ia(e);const N=cn(f),_=[de(n),r?de(r):"0x",S?de(S):"0x",o?de(o):"0x",a??"0x",l?de(l):"0x",s??"0x",N,...zt(e,t)];return At(["0x01",kt(_)])}function ha(e,t){const{chainId:n=0,gas:o,data:s,nonce:r,to:a,value:l,gasPrice:f}=e;ca(e);let S=[r?de(r):"0x",f?de(f):"0x",o?de(o):"0x",a??"0x",l?de(l):"0x",s??"0x"];if(t){const N=(()=>{if(t.v>=35n)return(t.v-35n)/2n>0?t.v:27n+(t.v===35n?0n:1n);if(n>0)return BigInt(n*2)+BigInt(35n+t.v-27n);const E=27n+(t.v===27n?0n:1n);if(t.v!==E)throw new mr({v:t.v});return E})(),_=nn(t.r),b=nn(t.s);S=[...S,de(N),_==="0x00"?"0x":_,b==="0x00"?"0x":b]}else n>0&&(S=[...S,de(n),"0x","0x"]);return kt(S)}function zt(e,t){const n=t??e,{v:o,yParity:s}=n;if(typeof n.r>"u")return[];if(typeof n.s>"u")return[];if(typeof o>"u"&&typeof s>"u")return[];const r=nn(n.r),a=nn(n.s);return[typeof s=="number"?s?de(1):"0x":o===0n?"0x":o===1n?de(1):o===27n?"0x":de(1),r==="0x00"?"0x":r,a==="0x00"?"0x":a]}const ga={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},ba={block:Ks({format(e){return{transactions:e.transactions?.map(n=>{if(typeof n=="string")return n;const o=Cn(n);return o.typeHex==="0x7e"&&(o.isSystemTx=n.isSystemTx,o.mint=n.mint?Ot(n.mint):void 0,o.sourceHash=n.sourceHash,o.type="deposit"),o}),stateRoot:e.stateRoot}}}),transaction:js({format(e){const t={};return e.type==="0x7e"&&(t.isSystemTx=e.isSystemTx,t.mint=e.mint?Ot(e.mint):void 0,t.sourceHash=e.sourceHash,t.type="deposit"),t}}),transactionReceipt:tr({format(e){return{l1GasPrice:e.l1GasPrice?Ot(e.l1GasPrice):null,l1GasUsed:e.l1GasUsed?Ot(e.l1GasUsed):null,l1Fee:e.l1Fee?Ot(e.l1Fee):null,l1FeeScalar:e.l1FeeScalar?Number(e.l1FeeScalar):null}}})};function wa(e,t){return Aa(e)?va(e):da(e,t)}const ya={transaction:wa};function va(e){ka(e);const{sourceHash:t,data:n,from:o,gas:s,isSystemTx:r,mint:a,to:l,value:f}=e,S=[t,o,l??"0x",a?Ft(a):"0x",f?Ft(f):"0x",s?Ft(s):"0x",r?"0x1":"0x",n??"0x"];return At(["0x7e",kt(S)])}function Aa(e){return e.type==="deposit"||typeof e.sourceHash<"u"}function ka(e){const{from:t,to:n}=e;if(t&&!Le(t))throw new nt({address:t});if(n&&!Le(n))throw new nt({address:n})}const ln={blockTime:2e3,contracts:ga,formatters:ba,serializers:ya},Ta=rt({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:250,rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),xa=rt({id:43114,name:"Avalanche",blockTime:1700,nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{default:{name:"SnowTrace",url:"https://snowtrace.io",apiUrl:"https://api.snowtrace.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:11907934}}}),qt=1,Ko=rt({...ln,id:8453,name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://basescan.org",apiUrl:"https://api.basescan.org/api"}},contracts:{...ln.contracts,disputeGameFactory:{[qt]:{address:"0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e"}},l2OutputOracle:{[qt]:{address:"0x56315b90c40730925ec5485cf004d835058518A0"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:5022},portal:{[qt]:{address:"0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",blockCreated:17482143}},l1StandardBridge:{[qt]:{address:"0x3154Cf16ccdb4C6d922629664174b904d80F2C35",blockCreated:17482143}}},sourceId:qt});({...Ko});const Ea=rt({id:56,name:"BNB Smart Chain",blockTime:750,nativeCurrency:{decimals:18,name:"BNB",symbol:"BNB"},rpcUrls:{default:{http:["https://56.rpc.thirdweb.com"]}},blockExplorers:{default:{name:"BscScan",url:"https://bscscan.com",apiUrl:"https://api.bscscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:15921452}}});function $n(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}class Sa extends pe{constructor({docsPath:t}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(`
71
+ `),{docsPath:t,docsSlug:"account",name:"AccountNotFoundError"})}}function zn(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new Oa(e.type);return`${e.name}(${Zo(e.inputs,{includeName:t})})`}function Zo(e,{includeName:t=!1}={}){return e?e.map(n=>Ca(n,{includeName:t})).join(t?", ":","):""}function Ca(e,{includeName:t}){return e.type.startsWith("tuple")?`(${Zo(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}class Ba extends pe{constructor({expectedLength:t,givenLength:n,type:o}){super([`ABI encoding array length mismatch for type ${o}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
72
+ `),{name:"AbiEncodingArrayLengthMismatchError"})}}class Ia extends pe{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${Ve(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class Na extends pe{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
73
+ `),{name:"AbiEncodingLengthMismatchError"})}}class Qo extends pe{constructor(t,{docsPath:n}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
74
+ `),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class Pa extends pe{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${zn(t.abiItem)}\`, and`,`\`${n.type}\` in \`${zn(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class Fa extends pe{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
75
+ `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class Ua extends pe{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
76
+ `),{name:"InvalidArrayError"})}}class Oa extends pe{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
77
+ `),{name:"InvalidDefinitionTypeError"})}}const Da=e=>jo(En(e));function Ma(e){return Da(e)}function _a(e,t){return e.exec(t)?.groups}const es=/^tuple(?<array>(\[(\d*)\])*)$/;function qn(e){let t=e.type;if(es.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let s=0;s<n;s++){const r=e.components[s];t+=qn(r),s<n-1&&(t+=", ")}const o=_a(es,e.type);return t+=`)${o?.array||""}`,qn({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Yt(e){let t="";const n=e.length;for(let o=0;o<n;o++){const s=e[o];t+=qn(s),o!==n-1&&(t+=", ")}return t}function La(e){return e.type==="function"?`function ${e.name}(${Yt(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${Yt(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Yt(e.inputs)})`:e.type==="error"?`error ${e.name}(${Yt(e.inputs)})`:e.type==="constructor"?`constructor(${Yt(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}function Ra(e){let t=!0,n="",o=0,s="",r=!1;for(let a=0;a<e.length;a++){const l=e[a];if(["(",")",","].includes(l)&&(t=!0),l==="("&&o++,l===")"&&o--,!!t){if(o===0){if(l===" "&&["event","function",""].includes(s))s="";else if(s+=l,l===")"){r=!0;break}continue}if(l===" "){e[a-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}s+=l,n+=l}}if(!r)throw new pe("Unable to normalize signature.");return s}const Ha=e=>{const t=typeof e=="string"?e:La(e);return Ra(t)};function ts(e){return Ma(Ha(e))}const ns=e=>Wn(ts(e),0,4),Va=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function Wa(e,t){if(e.length!==t.length)throw new Na({expectedLength:e.length,givenLength:t.length});const n=Ga({params:e,values:t}),o=jn(n);return o.length===0?"0x":o}function Ga({params:e,values:t}){const n=[];for(let o=0;o<e.length;o++)n.push(Yn({param:e[o],value:t[o]}));return n}function Yn({param:e,value:t}){const n=Ka(e.type);if(n){const[o,s]=n;return za(t,{length:o,param:{...e,type:s}})}if(e.type==="tuple")return Xa(t,{param:e});if(e.type==="address")return $a(t);if(e.type==="bool")return Ya(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const o=e.type.startsWith("int"),[,,s="256"]=Va.exec(e.type)??[];return ja(t,{signed:o,size:Number(s)})}if(e.type.startsWith("bytes"))return qa(t,{param:e});if(e.type==="string")return Ja(t);throw new Fa(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function jn(e){let t=0;for(let r=0;r<e.length;r++){const{dynamic:a,encoded:l}=e[r];a?t+=32:t+=Ve(l)}const n=[],o=[];let s=0;for(let r=0;r<e.length;r++){const{dynamic:a,encoded:l}=e[r];a?(n.push(de(t+s,{size:32})),o.push(l),s+=Ve(l)):n.push(l)}return Mt([...n,...o])}function $a(e){if(!Le(e))throw new nt({address:e});return{dynamic:!1,encoded:mt(e.toLowerCase())}}function za(e,{length:t,param:n}){const o=t===null;if(!Array.isArray(e))throw new Ua(e);if(!o&&e.length!==t)throw new Ba({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let s=!1;const r=[];for(let a=0;a<e.length;a++){const l=Yn({param:n,value:e[a]});l.dynamic&&(s=!0),r.push(l)}if(o||s){const a=jn(r);if(o){const l=de(r.length,{size:32});return{dynamic:!0,encoded:r.length>0?Mt([l,a]):l}}if(s)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Mt(r.map(({encoded:a})=>a))}}function qa(e,{param:t}){const[,n]=t.type.split("bytes"),o=Ve(e);if(!n){let s=e;return o%32!==0&&(s=mt(s,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Mt([mt(de(o,{size:32})),s])}}if(o!==Number.parseInt(n,10))throw new Ia({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:mt(e,{dir:"right"})}}function Ya(e){if(typeof e!="boolean")throw new pe(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:mt(go(e))}}function ja(e,{signed:t,size:n=256}){if(typeof n=="number"){const o=2n**(BigInt(n)-(t?1n:0n))-1n,s=t?-o-1n:0n;if(e>o||e<s)throw new xn({max:o.toString(),min:s.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:de(e,{size:32,signed:t})}}function Ja(e){const t=bo(e),n=Math.ceil(Ve(t)/32),o=[];for(let s=0;s<n;s++)o.push(mt(Wn(t,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Mt([mt(de(Ve(t),{size:32})),...o])}}function Xa(e,{param:t}){let n=!1;const o=[];for(let s=0;s<t.components.length;s++){const r=t.components[s],a=Array.isArray(e)?s:r.name,l=Yn({param:r,value:e[a]});o.push(l),l.dynamic&&(n=!0)}return{dynamic:n,encoded:n?jn(o):Mt(o.map(({encoded:s})=>s))}}function Ka(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Za=ts;function Qa(e){const{abi:t,args:n=[],name:o}=e,s=Nt(o,{strict:!1}),r=t.filter(l=>s?l.type==="function"?ns(l)===o:l.type==="event"?Za(l)===o:!1:"name"in l&&l.name===o);if(r.length===0)return;if(r.length===1)return r[0];let a;for(const l of r){if(!("inputs"in l))continue;if(!n||n.length===0){if(!l.inputs||l.inputs.length===0)return l;continue}if(!l.inputs||l.inputs.length===0||l.inputs.length!==n.length)continue;if(n.every((S,N)=>{const _="inputs"in l&&l.inputs[N];return _?Jn(S,_):!1})){if(a&&"inputs"in a&&a.inputs){const S=os(l.inputs,a.inputs,n);if(S)throw new Pa({abiItem:l,type:S[0]},{abiItem:a,type:S[1]})}a=l}}return a||r[0]}function Jn(e,t){const n=typeof e,o=t.type;switch(o){case"address":return Le(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return o==="tuple"&&"components"in t?Object.values(t.components).every((s,r)=>n==="object"&&Jn(Object.values(e)[r],s)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(o)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(o)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(o)?Array.isArray(e)&&e.every(s=>Jn(s,{...t,type:o.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function os(e,t,n){for(const o in e){const s=e[o],r=t[o];if(s.type==="tuple"&&r.type==="tuple"&&"components"in s&&"components"in r)return os(s.components,r.components,n[o]);const a=[s.type,r.type];if(a.includes("address")&&a.includes("bytes20")?!0:a.includes("address")&&a.includes("string")?Le(n[o],{strict:!1}):a.includes("address")&&a.includes("bytes")?Le(n[o],{strict:!1}):!1)return a}}function ss(e){return e.reduce((t,{slot:n,value:o})=>`${t} ${n}: ${o}
78
+ `,"")}function ei(e){return e.reduce((t,{address:n,...o})=>{let s=`${t} ${n}:
79
+ `;return o.nonce&&(s+=` nonce: ${o.nonce}
80
+ `),o.balance&&(s+=` balance: ${o.balance}
81
+ `),o.code&&(s+=` code: ${o.code}
82
+ `),o.state&&(s+=` state:
83
+ `,s+=ss(o.state)),o.stateDiff&&(s+=` stateDiff:
84
+ `,s+=ss(o.stateDiff)),s},` State Override:
85
+ `).slice(0,-1)}class ti extends pe{constructor(t,{account:n,docsPath:o,chain:s,data:r,gas:a,gasPrice:l,maxFeePerGas:f,maxPriorityFeePerGas:S,nonce:N,to:_,value:b,stateOverride:E}){const v=n?$n(n):void 0;let C=Eo({from:v?.address,to:_,value:typeof b<"u"&&`${pr(b)} ${s?.nativeCurrency?.symbol||"ETH"}`,data:r,gas:a,gasPrice:typeof l<"u"&&`${Tt(l)} gwei`,maxFeePerGas:typeof f<"u"&&`${Tt(f)} gwei`,maxPriorityFeePerGas:typeof S<"u"&&`${Tt(S)} gwei`,nonce:N});E&&(C+=`
86
+ ${ei(E)}`),super(t.shortMessage,{cause:t,docsPath:o,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",C].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}function ni(e,t){const n=(e.details||"").toLowerCase(),o=e instanceof pe?e.walk(s=>s?.code===_t.code):e;return o instanceof pe?new _t({cause:e,message:o.details}):_t.nodeMessage.test(n)?new _t({cause:e,message:e.details}):xt.nodeMessage.test(n)?new xt({cause:e,maxFeePerGas:t?.maxFeePerGas}):Pn.nodeMessage.test(n)?new Pn({cause:e,maxFeePerGas:t?.maxFeePerGas}):Fn.nodeMessage.test(n)?new Fn({cause:e,nonce:t?.nonce}):Un.nodeMessage.test(n)?new Un({cause:e,nonce:t?.nonce}):On.nodeMessage.test(n)?new On({cause:e,nonce:t?.nonce}):Dn.nodeMessage.test(n)?new Dn({cause:e}):Mn.nodeMessage.test(n)?new Mn({cause:e,gas:t?.gas}):_n.nodeMessage.test(n)?new _n({cause:e,gas:t?.gas}):Ln.nodeMessage.test(n)?new Ln({cause:e}):Gt.nodeMessage.test(n)?new Gt({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new Ho({cause:e})}function oi(e,{docsPath:t,...n}){const o=(()=>{const s=ni(e,n);return s instanceof Ho?e:s})();return new ti(o,{docsPath:t,...n})}function si(e,{format:t}){if(!t)return{};const n={};function o(r){const a=Object.keys(r);for(const l of a)l in e&&(n[l]=e[l]),r[l]&&typeof r[l]=="object"&&!Array.isArray(r[l])&&o(r[l])}const s=t(e||{});return o(s),n}function ri(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:o,to:s}=e,r=t?$n(t):void 0;if(r&&!Le(r.address))throw new nt({address:r.address});if(s&&!Le(s))throw new nt({address:s});if(n&&n>Dt)throw new xt({maxFeePerGas:n});if(o&&n&&o>n)throw new Gt({maxFeePerGas:n,maxPriorityFeePerGas:o})}async function ai(e,t){const{account:n=e.account}=t;if(!n)throw new Sa;const o=$n(n);try{const{accessList:s,blockNumber:r,blockTag:a,data:l,gas:f,gasPrice:S,maxFeePerGas:N,maxPriorityFeePerGas:_,nonce:b,to:E,value:v,...C}=t,J=(typeof r=="bigint"?de(r):void 0)||a;ri(t);const I=e.chain?.formatters?.transactionRequest?.format,K=(I||or)({...si(C,{format:I}),account:o,accessList:s,data:l,gas:f,gasPrice:S,maxFeePerGas:N,maxPriorityFeePerGas:_,nonce:b,to:E,value:v},"estimateGas"),{baseFeePerGas:he,gasLimit:ye,priorityFeePerGas:Be}=await e.request({method:"linea_estimateGas",params:J?[K,J]:[K]});return{baseFeePerGas:BigInt(he),gasLimit:BigInt(ye),priorityFeePerGas:BigInt(Be)}}catch(s){throw oi(s,{...t,account:o,chain:e.chain})}}const ii={fees:{estimateFeesPerGas:rs,async maxPriorityFeePerGas({block:e,client:t,request:n}){const o=await rs({block:e,client:t,multiply:s=>s,request:n,type:"eip1559"});return o?.maxPriorityFeePerGas?o.maxPriorityFeePerGas:null}}};async function rs({client:e,multiply:t,request:n,type:o}){try{const s=await ai(e,{...n,account:n?.account}),{priorityFeePerGas:r}=s,l=t(BigInt(s.baseFeePerGas))+r;return o==="legacy"?{gasPrice:l}:{maxFeePerGas:l,maxPriorityFeePerGas:r}}catch{return null}}const ci=rt({...ii,id:59144,name:"Linea Mainnet",blockTime:2e3,nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build",apiUrl:"https://api.lineascan.build/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:42},ensRegistry:{address:"0x50130b669B28C339991d8676FA73CF122a121267",blockCreated:6682888},ensUniversalResolver:{address:"0x4D41762915F83c76EcaF6776d9b08076aA32b492",blockCreated:22222151}},ensTlds:[".linea.eth"],testnet:!1}),li=rt({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:12e3,rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensUniversalResolver:{address:"0xeeeeeeee14d718c2b47d9923deab1335e144eeee",blockCreated:23085558},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),jt=1,di=rt({...ln,id:10,name:"OP Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.optimism.io"]}},blockExplorers:{default:{name:"Optimism Explorer",url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io/api"}},contracts:{...ln.contracts,disputeGameFactory:{[jt]:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{[jt]:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{[jt]:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{[jt]:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId:jt}),ui=rt({id:137,name:"Polygon",blockTime:2e3,nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://polygon-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.etherscan.io/v2/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}}),as="/docs/contract/encodeFunctionData";function fi(e){const{abi:t,args:n,functionName:o}=e;let s=t[0];if(o){const r=Qa({abi:t,args:n,name:o});if(!r)throw new Qo(o,{docsPath:as});s=r}if(s.type!=="function")throw new Qo(void 0,{docsPath:as});return{abi:[s],functionName:ns(zn(s))}}function bt(e){const{args:t}=e,{abi:n,functionName:o}=e.abi.length===1&&e.functionName?.startsWith("0x")?e:fi(e),s=n[0],r=o,a="inputs"in s&&s.inputs?Wa(s.inputs,t??[]):void 0;return At([r,a??"0x"])}const ct={1:{...li,logo:"https://cryptologos.cc/logos/ethereum-eth-logo.png?v=024",chainId:1,chainType:"ether",chainTypeMoralis:"eth",tokenTrendingDefault:["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"]},10:{...di,logo:"https://cryptologos.cc/logos/optimism-ethereum-op-logo.png?v=024",chainId:10,chainType:"optimism",chainTypeMoralis:"optimism",tokenTrendingDefault:["0x4200000000000000000000000000000000000006","0x68f180fcce6836688e9084f035309e29bf0a2095","0xc47da4cb96ce65a96844a01bfae509f9d5454534"]},56:{...Ea,logo:"https://cryptologos.cc/logos/bnb-bnb-logo.png?v=024",chainId:56,chainType:"bsc",chainTypeMoralis:"bsc",tokenTrendingDefault:["0x2170ed0880ac9a755fd29b2688956bd959f933f8","0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c"]},137:{...ui,logo:"https://cryptologos.cc/logos/polygon-matic-logo.png?v=024",chainId:137,chainType:"matic",chainTypeMoralis:"polygon",tokenTrendingDefault:["0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6"]},8453:{...Ko,logo:"https://icons.llamao.fi/icons/chains/rsz_base.jpg",chainId:8453,chainType:"base",chainTypeMoralis:"base",tokenTrendingDefault:["0x4200000000000000000000000000000000000006","0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf","0xc47da4cb96ce65a96844a01bfae509f9d5454534"]},42161:{...Ta,logo:"https://cryptologos.cc/logos/arbitrum-arb-logo.png?v=024",chainId:42161,chainType:"arbitrum",chainTypeMoralis:"arbitrum",tokenTrendingDefault:["0x82af49447d8a07e3bd95bd0d56f35241523fbab1","0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f"]},43114:{...xa,logo:"https://cryptologos.cc/logos/avalanche-avax-logo.png?v=024",chainId:43114,chainType:"avax",chainTypeMoralis:"avalanche",tokenTrendingDefault:["0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB","0x0555E30da8f98308EdB960aa94C0Db47230d2B9c"]},59144:{...ci,logo:"https://icons.llamao.fi/icons/chains/rsz_linea.jpg",chainId:59144,chainType:"linea",chainTypeMoralis:"linea",tokenTrendingDefault:["0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f","0x3aab2285ddcddad8edf438c1bab47e1a9d05a9b4"]}},pi=e=>{const t=new Date,n=new Date(t);n.setDate(n.getDate()-1);const o=new Date(e);return o.setHours(0,0,0,0),t.setHours(0,0,0,0),n.setHours(0,0,0,0),o.getTime()===t.getTime()?"Today":o.getTime()===n.getTime()?"Yesterday":o.toLocaleDateString("en-US",{month:"short",day:"numeric",year:o.getFullYear()!==t.getFullYear()?"numeric":void 0})},lt=e=>new Promise(t=>setTimeout(t,e||0)),mi=(e,t=5,n=5)=>(e=e||"",e?.length<=t+n?e:`${e.substr(0,t)}...${e.substr(e.length-n,n)}`),hi=e=>{if(!e)return"";const t=ct[e];return t?t.chainTypeMoralis:""},gi=e=>{if(!e)return"";const t=ct[e];return t?t.chainType:""},Et={getItem(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}},setItem(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}},removeItem(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(e)}catch{}},get length(){if(typeof window>"u")return 0;try{return window.localStorage.length}catch{return 0}},key(e){if(typeof window>"u")return null;try{return window.localStorage.key(e)}catch{return null}}};class bi extends pe{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function dt(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new bi({value:e});let[n,o="0"]=e.split(".");const s=n.startsWith("-");if(s&&(n=n.slice(1)),o=o.replace(/(0+)$/,""),t===0)Math.round(+`.${o}`)===1&&(n=`${BigInt(n)+1n}`),o="";else if(o.length>t){const[r,a,l]=[o.slice(0,t-1),o.slice(t-1,t),o.slice(t)],f=Math.round(+`${a}.${l}`);f>9?o=`${BigInt(r)+BigInt(1)}0`.padStart(r.length+1,"0"):o=`${r}${f}`,o.length>t&&(o=o.slice(1),n=`${BigInt(n)+1n}`),o=o.slice(0,t)}else o=o.padEnd(t,"0");return BigInt(`${s?"-":""}${n}${o}`)}const wi="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Ye="0x0000000000000000000000000000000000000000",is=se.createContext(void 0),Xn=()=>{const e=se.useContext(is);if(!e)throw new Error("useConnect must be used within ConnectProvider");return{...e,chainData:ct[e.account?.chainId]||void 0,chainId:e.account?.chainId||void 0,chainType:gi(e.account?.chainId||void 0),chainTypeMoralis:hi(e.account?.chainId||void 0),isChainSupported:!!ct[e.account?.chainId]}},yi=({children:e,initialAccount:t})=>B.jsx(is.Provider,{value:{account:t||null},children:e}),vi=({address:e,chainId:t})=>{const[n,o]=se.useState(!1),{isChainSupported:s}=Xn(),r=se.useCallback(()=>{if(!e)return;const a=e,l=()=>{o(!0),setTimeout(()=>o(!1),2e3)};try{navigator.clipboard.writeText(a).then(l).catch(()=>{const f=document.createElement("input");f.value=a,document.body.appendChild(f),f.select(),document.execCommand("copy"),f.remove(),l()})}catch{const f=document.createElement("input");f.value=a,document.body.appendChild(f),f.select(),document.execCommand("copy"),f.remove(),l()}},[e]);return B.jsx(B.Fragment,{children:Le(e||"")&&B.jsxs("div",{className:"chat-user-info",children:[t&&ct[t]?.logo&&B.jsx("div",{className:"user-avatar",children:B.jsx("img",{src:ct[t].logo||"",alt:"Chain",width:20,height:20})}),B.jsx("span",{className:"user-wallet",children:B.jsx("a",{style:{pointerEvents:s?"auto":"none"},href:ct[t]?.blockExplorers?.default?.url+"/address/"+e,target:"_blank",rel:"noopener noreferrer",children:mi(e)||"Not connected"})}),B.jsx("button",{className:"copy-address-btn",onClick:r,"aria-label":"Copy wallet address",type:"button",title:n?"Copied!":"Copy address",children:n?B.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:B.jsx("path",{d:"M13.3333 4L6 11.3333L2.66667 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):B.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:[B.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),B.jsx("path",{d:"M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})})},Re=[];for(let e=0;e<256;++e)Re.push((e+256).toString(16).slice(1));function Ai(e,t=0){return(Re[e[t+0]]+Re[e[t+1]]+Re[e[t+2]]+Re[e[t+3]]+"-"+Re[e[t+4]]+Re[e[t+5]]+"-"+Re[e[t+6]]+Re[e[t+7]]+"-"+Re[e[t+8]]+Re[e[t+9]]+"-"+Re[e[t+10]]+Re[e[t+11]]+Re[e[t+12]]+Re[e[t+13]]+Re[e[t+14]]+Re[e[t+15]]).toLowerCase()}let Kn;const ki=new Uint8Array(16);function Ti(){if(!Kn){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Kn=crypto.getRandomValues.bind(crypto)}return Kn(ki)}const cs={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function xi(e,t,n){e=e||{};const o=e.random??e.rng?.()??Ti();if(o.length<16)throw new Error("Random bytes length must be >= 16");return o[6]=o[6]&15|64,o[8]=o[8]&63|128,Ai(o)}function ls(e,t,n){return cs.randomUUID&&!e?cs.randomUUID():xi(e)}const Zn="chat_widget_messages",ds=200,Lt=[{id:ls(),text:`**Welcome! 🚀**
87
+ You're connected and ready to explore DeFi! I can help you trade, check prices, and analyze your portfolio when you need it.`,sender:"bot",timestamp:new Date}];function Ei(e,t){return e&&t?`${e}_${t}`:""}function us(e){return e.map(t=>({...t,timestamp:new Date(t.timestamp)}))}function fs(){const e=Et.getItem(Zn);if(!e)return null;try{const t=JSON.parse(e);if(t&&t.owner!==void 0&&Array.isArray(t.messages))return{owner:t.owner,messages:us(t.messages)};if(Array.isArray(t))return{owner:"",messages:us(t)}}catch{}return null}function dn(e,t){Et.setItem(Zn,JSON.stringify({owner:e,messages:t}))}function Si(){const{account:e}=Xn(),t=Ei(e?.address,e?.chainId),[n,o]=se.useState(()=>t||"pending"),[s,r]=se.useState(()=>{const N=fs();return t?N&&N.owner===t?N.messages:Lt:N?.messages??Lt});if(n==="pending"&&t){const N=fs();N&&N.owner===t?r(N.messages):dn(t,s),o(t)}else n!=="pending"&&t&&n!==t&&(r(Lt),dn(t,Lt),o(t));se.useEffect(()=>{n!=="pending"&&dn(n,s)},[s,n]),se.useEffect(()=>{const N=[];for(let _=0;_<Et.length;_++){const b=Et.key(_);b&&b.startsWith(Zn+"_")&&N.push(b)}N.forEach(_=>Et.removeItem(_))},[]);const a=(N,_,b,E,v)=>{const C=b?s.find(J=>J.id===b):void 0,D={id:ls(),text:N,sender:_,timestamp:new Date,...C&&{replyTo:{id:C.id,text:C.text,sender:C.sender}},...E&&{buttons:E},...v&&{actionData:v}};return r(J=>{const I=[...J,D];return I.length>ds?I.slice(I.length-ds):I}),D},l=(N,_)=>{r(b=>b.map(E=>E.id===N&&E.actionData?{...E,actionData:{...E.actionData,status:_}}:E))},f=(N,_)=>{r(b=>b.map(E=>E.id===N?{...E,text:_}:E))},S=se.useCallback(()=>{r(Lt),dn(t,Lt)},[t]);return{messages:s,setMessages:r,addMessage:a,updateMessageAction:l,updateMessageText:f,clearMessages:S}}const ps=se.createContext(void 0),Ci=()=>{const e=se.useContext(ps);if(!e)throw new Error("useConfig must be used within ConfigProvider");return e},Bi=({children:e,initialConfig:t})=>B.jsx(ps.Provider,{value:{config:t||null},children:e});var Ii=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Qn=Math.ceil,je=Math.floor,We="[BigNumber Error] ",ms=We+"Number primitive has more than 15 significant digits: ",Qe=1e14,be=14,eo=9007199254740991,to=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],wt=1e7,_e=1e9;function hs(e){var t,n,o,s=I.prototype={constructor:I,toString:null,valueOf:null},r=new I(1),a=20,l=4,f=-7,S=21,N=-1e7,_=1e7,b=!1,E=1,v=0,C={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},D="0123456789abcdefghijklmnopqrstuvwxyz",J=!0;function I(i,d){var c,g,m,w,y,h,k,A,T=this;if(!(T instanceof I))return new I(i,d);if(d==null){if(i&&i._isBigNumber===!0){T.s=i.s,!i.c||i.e>_?T.c=T.e=null:i.e<N?T.c=[T.e=0]:(T.e=i.e,T.c=i.c.slice());return}if((h=typeof i=="number")&&i*0==0){if(T.s=1/i<0?(i=-i,-1):1,i===~~i){for(w=0,y=i;y>=10;y/=10,w++);w>_?T.c=T.e=null:(T.e=w,T.c=[i]);return}A=String(i)}else{if(!Ii.test(A=String(i)))return o(T,A,h);T.s=A.charCodeAt(0)==45?(A=A.slice(1),-1):1}(w=A.indexOf("."))>-1&&(A=A.replace(".","")),(y=A.search(/e/i))>0?(w<0&&(w=y),w+=+A.slice(y+1),A=A.substring(0,y)):w<0&&(w=A.length)}else{if(Ie(d,2,D.length,"Base"),d==10&&J)return T=new I(i),ye(T,a+T.e+1,l);if(A=String(i),h=typeof i=="number"){if(i*0!=0)return o(T,A,h,d);if(T.s=1/i<0?(A=A.slice(1),-1):1,I.DEBUG&&A.replace(/^0\.0*|\./,"").length>15)throw Error(ms+i)}else T.s=A.charCodeAt(0)===45?(A=A.slice(1),-1):1;for(c=D.slice(0,d),w=y=0,k=A.length;y<k;y++)if(c.indexOf(g=A.charAt(y))<0){if(g=="."){if(y>w){w=k;continue}}else if(!m&&(A==A.toUpperCase()&&(A=A.toLowerCase())||A==A.toLowerCase()&&(A=A.toUpperCase()))){m=!0,y=-1,w=0;continue}return o(T,String(i),h,d)}h=!1,A=n(A,d,10,T.s),(w=A.indexOf("."))>-1?A=A.replace(".",""):w=A.length}for(y=0;A.charCodeAt(y)===48;y++);for(k=A.length;A.charCodeAt(--k)===48;);if(A=A.slice(y,++k)){if(k-=y,h&&I.DEBUG&&k>15&&(i>eo||i!==je(i)))throw Error(ms+T.s*i);if((w=w-y-1)>_)T.c=T.e=null;else if(w<N)T.c=[T.e=0];else{if(T.e=w,T.c=[],y=(w+1)%be,w<0&&(y+=be),y<k){for(y&&T.c.push(+A.slice(0,y)),k-=be;y<k;)T.c.push(+A.slice(y,y+=be));y=be-(A=A.slice(y)).length}else y-=k;for(;y--;A+="0");T.c.push(+A)}}else T.c=[T.e=0]}I.clone=hs,I.ROUND_UP=0,I.ROUND_DOWN=1,I.ROUND_CEIL=2,I.ROUND_FLOOR=3,I.ROUND_HALF_UP=4,I.ROUND_HALF_DOWN=5,I.ROUND_HALF_EVEN=6,I.ROUND_HALF_CEIL=7,I.ROUND_HALF_FLOOR=8,I.EUCLID=9,I.config=I.set=function(i){var d,c;if(i!=null)if(typeof i=="object"){if(i.hasOwnProperty(d="DECIMAL_PLACES")&&(c=i[d],Ie(c,0,_e,d),a=c),i.hasOwnProperty(d="ROUNDING_MODE")&&(c=i[d],Ie(c,0,8,d),l=c),i.hasOwnProperty(d="EXPONENTIAL_AT")&&(c=i[d],c&&c.pop?(Ie(c[0],-_e,0,d),Ie(c[1],0,_e,d),f=c[0],S=c[1]):(Ie(c,-_e,_e,d),f=-(S=c<0?-c:c))),i.hasOwnProperty(d="RANGE"))if(c=i[d],c&&c.pop)Ie(c[0],-_e,-1,d),Ie(c[1],1,_e,d),N=c[0],_=c[1];else if(Ie(c,-_e,_e,d),c)N=-(_=c<0?-c:c);else throw Error(We+d+" cannot be zero: "+c);if(i.hasOwnProperty(d="CRYPTO"))if(c=i[d],c===!!c)if(c)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))b=c;else throw b=!c,Error(We+"crypto unavailable");else b=c;else throw Error(We+d+" not true or false: "+c);if(i.hasOwnProperty(d="MODULO_MODE")&&(c=i[d],Ie(c,0,9,d),E=c),i.hasOwnProperty(d="POW_PRECISION")&&(c=i[d],Ie(c,0,_e,d),v=c),i.hasOwnProperty(d="FORMAT"))if(c=i[d],typeof c=="object")C=c;else throw Error(We+d+" not an object: "+c);if(i.hasOwnProperty(d="ALPHABET"))if(c=i[d],typeof c=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(c))J=c.slice(0,10)=="0123456789",D=c;else throw Error(We+d+" invalid: "+c)}else throw Error(We+"Object expected: "+i);return{DECIMAL_PLACES:a,ROUNDING_MODE:l,EXPONENTIAL_AT:[f,S],RANGE:[N,_],CRYPTO:b,MODULO_MODE:E,POW_PRECISION:v,FORMAT:C,ALPHABET:D}},I.isBigNumber=function(i){if(!i||i._isBigNumber!==!0)return!1;if(!I.DEBUG)return!0;var d,c,g=i.c,m=i.e,w=i.s;e:if({}.toString.call(g)=="[object Array]"){if((w===1||w===-1)&&m>=-_e&&m<=_e&&m===je(m)){if(g[0]===0){if(m===0&&g.length===1)return!0;break e}if(d=(m+1)%be,d<1&&(d+=be),String(g[0]).length==d){for(d=0;d<g.length;d++)if(c=g[d],c<0||c>=Qe||c!==je(c))break e;if(c!==0)return!0}}}else if(g===null&&m===null&&(w===null||w===1||w===-1))return!0;throw Error(We+"Invalid BigNumber: "+i)},I.maximum=I.max=function(){return K(arguments,-1)},I.minimum=I.min=function(){return K(arguments,1)},I.random=(function(){var i=9007199254740992,d=Math.random()*i&2097151?function(){return je(Math.random()*i)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(c){var g,m,w,y,h,k=0,A=[],T=new I(r);if(c==null?c=a:Ie(c,0,_e),y=Qn(c/be),b)if(crypto.getRandomValues){for(g=crypto.getRandomValues(new Uint32Array(y*=2));k<y;)h=g[k]*131072+(g[k+1]>>>11),h>=9e15?(m=crypto.getRandomValues(new Uint32Array(2)),g[k]=m[0],g[k+1]=m[1]):(A.push(h%1e14),k+=2);k=y/2}else if(crypto.randomBytes){for(g=crypto.randomBytes(y*=7);k<y;)h=(g[k]&31)*281474976710656+g[k+1]*1099511627776+g[k+2]*4294967296+g[k+3]*16777216+(g[k+4]<<16)+(g[k+5]<<8)+g[k+6],h>=9e15?crypto.randomBytes(7).copy(g,k):(A.push(h%1e14),k+=7);k=y/7}else throw b=!1,Error(We+"crypto unavailable");if(!b)for(;k<y;)h=d(),h<9e15&&(A[k++]=h%1e14);for(y=A[--k],c%=be,y&&c&&(h=to[be-c],A[k]=je(y/h)*h);A[k]===0;A.pop(),k--);if(k<0)A=[w=0];else{for(w=-1;A[0]===0;A.splice(0,1),w-=be);for(k=1,h=A[0];h>=10;h/=10,k++);k<be&&(w-=be-k)}return T.e=w,T.c=A,T}})(),I.sum=function(){for(var i=1,d=arguments,c=new I(d[0]);i<d.length;)c=c.plus(d[i++]);return c},n=(function(){var i="0123456789";function d(c,g,m,w){for(var y,h=[0],k,A=0,T=c.length;A<T;){for(k=h.length;k--;h[k]*=g);for(h[0]+=w.indexOf(c.charAt(A++)),y=0;y<h.length;y++)h[y]>m-1&&(h[y+1]==null&&(h[y+1]=0),h[y+1]+=h[y]/m|0,h[y]%=m)}return h.reverse()}return function(c,g,m,w,y){var h,k,A,T,F,H,re,ge,ke=c.indexOf("."),xe=a,G=l;for(ke>=0&&(T=v,v=0,c=c.replace(".",""),ge=new I(g),H=ge.pow(c.length-ke),v=T,ge.c=d(ut(Xe(H.c),H.e,"0"),10,m,i),ge.e=ge.c.length),re=d(c,g,m,y?(h=D,i):(h=i,D)),A=T=re.length;re[--T]==0;re.pop());if(!re[0])return h.charAt(0);if(ke<0?--A:(H.c=re,H.e=A,H.s=w,H=t(H,ge,xe,G,m),re=H.c,F=H.r,A=H.e),k=A+xe+1,ke=re[k],T=m/2,F=F||k<0||re[k+1]!=null,F=G<4?(ke!=null||F)&&(G==0||G==(H.s<0?3:2)):ke>T||ke==T&&(G==4||F||G==6&&re[k-1]&1||G==(H.s<0?8:7)),k<1||!re[0])c=F?ut(h.charAt(1),-xe,h.charAt(0)):h.charAt(0);else{if(re.length=k,F)for(--m;++re[--k]>m;)re[k]=0,k||(++A,re=[1].concat(re));for(T=re.length;!re[--T];);for(ke=0,c="";ke<=T;c+=h.charAt(re[ke++]));c=ut(c,A,h.charAt(0))}return c}})(),t=(function(){function i(g,m,w){var y,h,k,A,T=0,F=g.length,H=m%wt,re=m/wt|0;for(g=g.slice();F--;)k=g[F]%wt,A=g[F]/wt|0,y=re*k+A*H,h=H*k+y%wt*wt+T,T=(h/w|0)+(y/wt|0)+re*A,g[F]=h%w;return T&&(g=[T].concat(g)),g}function d(g,m,w,y){var h,k;if(w!=y)k=w>y?1:-1;else for(h=k=0;h<w;h++)if(g[h]!=m[h]){k=g[h]>m[h]?1:-1;break}return k}function c(g,m,w,y){for(var h=0;w--;)g[w]-=h,h=g[w]<m[w]?1:0,g[w]=h*y+g[w]-m[w];for(;!g[0]&&g.length>1;g.splice(0,1));}return function(g,m,w,y,h){var k,A,T,F,H,re,ge,ke,xe,G,we,Se,Ge,et,He,De,ze,Me=g.s==m.s?1:-1,Ne=g.c,Te=m.c;if(!Ne||!Ne[0]||!Te||!Te[0])return new I(!g.s||!m.s||(Ne?Te&&Ne[0]==Te[0]:!Te)?NaN:Ne&&Ne[0]==0||!Te?Me*0:Me/0);for(ke=new I(Me),xe=ke.c=[],A=g.e-m.e,Me=w+A+1,h||(h=Qe,A=Je(g.e/be)-Je(m.e/be),Me=Me/be|0),T=0;Te[T]==(Ne[T]||0);T++);if(Te[T]>(Ne[T]||0)&&A--,Me<0)xe.push(1),F=!0;else{for(et=Ne.length,De=Te.length,T=0,Me+=2,H=je(h/(Te[0]+1)),H>1&&(Te=i(Te,H,h),Ne=i(Ne,H,h),De=Te.length,et=Ne.length),Ge=De,G=Ne.slice(0,De),we=G.length;we<De;G[we++]=0);ze=Te.slice(),ze=[0].concat(ze),He=Te[0],Te[1]>=h/2&&He++;do{if(H=0,k=d(Te,G,De,we),k<0){if(Se=G[0],De!=we&&(Se=Se*h+(G[1]||0)),H=je(Se/He),H>1)for(H>=h&&(H=h-1),re=i(Te,H,h),ge=re.length,we=G.length;d(re,G,ge,we)==1;)H--,c(re,De<ge?ze:Te,ge,h),ge=re.length,k=1;else H==0&&(k=H=1),re=Te.slice(),ge=re.length;if(ge<we&&(re=[0].concat(re)),c(G,re,we,h),we=G.length,k==-1)for(;d(Te,G,De,we)<1;)H++,c(G,De<we?ze:Te,we,h),we=G.length}else k===0&&(H++,G=[0]);xe[T++]=H,G[0]?G[we++]=Ne[Ge]||0:(G=[Ne[Ge]],we=1)}while((Ge++<et||G[0]!=null)&&Me--);F=G[0]!=null,xe[0]||xe.splice(0,1)}if(h==Qe){for(T=1,Me=xe[0];Me>=10;Me/=10,T++);ye(ke,w+(ke.e=T+A*be-1)+1,y,F)}else ke.e=A,ke.r=+F;return ke}})();function q(i,d,c,g){var m,w,y,h,k;if(c==null?c=l:Ie(c,0,8),!i.c)return i.toString();if(m=i.c[0],y=i.e,d==null)k=Xe(i.c),k=g==1||g==2&&(y<=f||y>=S)?fn(k,y):ut(k,y,"0");else if(i=ye(new I(i),d,c),w=i.e,k=Xe(i.c),h=k.length,g==1||g==2&&(d<=w||w<=f)){for(;h<d;k+="0",h++);k=fn(k,w)}else if(d-=y+(g===2&&w>y),k=ut(k,w,"0"),w+1>h){if(--d>0)for(k+=".";d--;k+="0");}else if(d+=w-h,d>0)for(w+1==h&&(k+=".");d--;k+="0");return i.s<0&&m?"-"+k:k}function K(i,d){for(var c,g,m=1,w=new I(i[0]);m<i.length;m++)g=new I(i[m]),(!g.s||(c=St(w,g))===d||c===0&&w.s===d)&&(w=g);return w}function he(i,d,c){for(var g=1,m=d.length;!d[--m];d.pop());for(m=d[0];m>=10;m/=10,g++);return(c=g+c*be-1)>_?i.c=i.e=null:c<N?i.c=[i.e=0]:(i.e=c,i.c=d),i}o=(function(){var i=/^(-?)0([xbo])(?=\w[\w.]*$)/i,d=/^([^.]+)\.$/,c=/^\.([^.]+)$/,g=/^-?(Infinity|NaN)$/,m=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(w,y,h,k){var A,T=h?y:y.replace(m,"");if(g.test(T))w.s=isNaN(T)?null:T<0?-1:1;else{if(!h&&(T=T.replace(i,function(F,H,re){return A=(re=re.toLowerCase())=="x"?16:re=="b"?2:8,!k||k==A?H:F}),k&&(A=k,T=T.replace(d,"$1").replace(c,"0.$1")),y!=T))return new I(T,A);if(I.DEBUG)throw Error(We+"Not a"+(k?" base "+k:"")+" number: "+y);w.s=null}w.c=w.e=null}})();function ye(i,d,c,g){var m,w,y,h,k,A,T,F=i.c,H=to;if(F){e:{for(m=1,h=F[0];h>=10;h/=10,m++);if(w=d-m,w<0)w+=be,y=d,k=F[A=0],T=je(k/H[m-y-1]%10);else if(A=Qn((w+1)/be),A>=F.length)if(g){for(;F.length<=A;F.push(0));k=T=0,m=1,w%=be,y=w-be+1}else break e;else{for(k=h=F[A],m=1;h>=10;h/=10,m++);w%=be,y=w-be+m,T=y<0?0:je(k/H[m-y-1]%10)}if(g=g||d<0||F[A+1]!=null||(y<0?k:k%H[m-y-1]),g=c<4?(T||g)&&(c==0||c==(i.s<0?3:2)):T>5||T==5&&(c==4||g||c==6&&(w>0?y>0?k/H[m-y]:0:F[A-1])%10&1||c==(i.s<0?8:7)),d<1||!F[0])return F.length=0,g?(d-=i.e+1,F[0]=H[(be-d%be)%be],i.e=-d||0):F[0]=i.e=0,i;if(w==0?(F.length=A,h=1,A--):(F.length=A+1,h=H[be-w],F[A]=y>0?je(k/H[m-y]%H[y])*h:0),g)for(;;)if(A==0){for(w=1,y=F[0];y>=10;y/=10,w++);for(y=F[0]+=h,h=1;y>=10;y/=10,h++);w!=h&&(i.e++,F[0]==Qe&&(F[0]=1));break}else{if(F[A]+=h,F[A]!=Qe)break;F[A--]=0,h=1}for(w=F.length;F[--w]===0;F.pop());}i.e>_?i.c=i.e=null:i.e<N&&(i.c=[i.e=0])}return i}function Be(i){var d,c=i.e;return c===null?i.toString():(d=Xe(i.c),d=c<=f||c>=S?fn(d,c):ut(d,c,"0"),i.s<0?"-"+d:d)}return s.absoluteValue=s.abs=function(){var i=new I(this);return i.s<0&&(i.s=1),i},s.comparedTo=function(i,d){return St(this,new I(i,d))},s.decimalPlaces=s.dp=function(i,d){var c,g,m,w=this;if(i!=null)return Ie(i,0,_e),d==null?d=l:Ie(d,0,8),ye(new I(w),i+w.e+1,d);if(!(c=w.c))return null;if(g=((m=c.length-1)-Je(this.e/be))*be,m=c[m])for(;m%10==0;m/=10,g--);return g<0&&(g=0),g},s.dividedBy=s.div=function(i,d){return t(this,new I(i,d),a,l)},s.dividedToIntegerBy=s.idiv=function(i,d){return t(this,new I(i,d),0,1)},s.exponentiatedBy=s.pow=function(i,d){var c,g,m,w,y,h,k,A,T,F=this;if(i=new I(i),i.c&&!i.isInteger())throw Error(We+"Exponent not an integer: "+Be(i));if(d!=null&&(d=new I(d)),h=i.e>14,!F.c||!F.c[0]||F.c[0]==1&&!F.e&&F.c.length==1||!i.c||!i.c[0])return T=new I(Math.pow(+Be(F),h?i.s*(2-un(i)):+Be(i))),d?T.mod(d):T;if(k=i.s<0,d){if(d.c?!d.c[0]:!d.s)return new I(NaN);g=!k&&F.isInteger()&&d.isInteger(),g&&(F=F.mod(d))}else{if(i.e>9&&(F.e>0||F.e<-1||(F.e==0?F.c[0]>1||h&&F.c[1]>=24e7:F.c[0]<8e13||h&&F.c[0]<=9999975e7)))return w=F.s<0&&un(i)?-0:0,F.e>-1&&(w=1/w),new I(k?1/w:w);v&&(w=Qn(v/be+2))}for(h?(c=new I(.5),k&&(i.s=1),A=un(i)):(m=Math.abs(+Be(i)),A=m%2),T=new I(r);;){if(A){if(T=T.times(F),!T.c)break;w?T.c.length>w&&(T.c.length=w):g&&(T=T.mod(d))}if(m){if(m=je(m/2),m===0)break;A=m%2}else if(i=i.times(c),ye(i,i.e+1,1),i.e>14)A=un(i);else{if(m=+Be(i),m===0)break;A=m%2}F=F.times(F),w?F.c&&F.c.length>w&&(F.c.length=w):g&&(F=F.mod(d))}return g?T:(k&&(T=r.div(T)),d?T.mod(d):w?ye(T,v,l,y):T)},s.integerValue=function(i){var d=new I(this);return i==null?i=l:Ie(i,0,8),ye(d,d.e+1,i)},s.isEqualTo=s.eq=function(i,d){return St(this,new I(i,d))===0},s.isFinite=function(){return!!this.c},s.isGreaterThan=s.gt=function(i,d){return St(this,new I(i,d))>0},s.isGreaterThanOrEqualTo=s.gte=function(i,d){return(d=St(this,new I(i,d)))===1||d===0},s.isInteger=function(){return!!this.c&&Je(this.e/be)>this.c.length-2},s.isLessThan=s.lt=function(i,d){return St(this,new I(i,d))<0},s.isLessThanOrEqualTo=s.lte=function(i,d){return(d=St(this,new I(i,d)))===-1||d===0},s.isNaN=function(){return!this.s},s.isNegative=function(){return this.s<0},s.isPositive=function(){return this.s>0},s.isZero=function(){return!!this.c&&this.c[0]==0},s.minus=function(i,d){var c,g,m,w,y=this,h=y.s;if(i=new I(i,d),d=i.s,!h||!d)return new I(NaN);if(h!=d)return i.s=-d,y.plus(i);var k=y.e/be,A=i.e/be,T=y.c,F=i.c;if(!k||!A){if(!T||!F)return T?(i.s=-d,i):new I(F?y:NaN);if(!T[0]||!F[0])return F[0]?(i.s=-d,i):new I(T[0]?y:l==3?-0:0)}if(k=Je(k),A=Je(A),T=T.slice(),h=k-A){for((w=h<0)?(h=-h,m=T):(A=k,m=F),m.reverse(),d=h;d--;m.push(0));m.reverse()}else for(g=(w=(h=T.length)<(d=F.length))?h:d,h=d=0;d<g;d++)if(T[d]!=F[d]){w=T[d]<F[d];break}if(w&&(m=T,T=F,F=m,i.s=-i.s),d=(g=F.length)-(c=T.length),d>0)for(;d--;T[c++]=0);for(d=Qe-1;g>h;){if(T[--g]<F[g]){for(c=g;c&&!T[--c];T[c]=d);--T[c],T[g]+=Qe}T[g]-=F[g]}for(;T[0]==0;T.splice(0,1),--A);return T[0]?he(i,T,A):(i.s=l==3?-1:1,i.c=[i.e=0],i)},s.modulo=s.mod=function(i,d){var c,g,m=this;return i=new I(i,d),!m.c||!i.s||i.c&&!i.c[0]?new I(NaN):!i.c||m.c&&!m.c[0]?new I(m):(E==9?(g=i.s,i.s=1,c=t(m,i,0,3),i.s=g,c.s*=g):c=t(m,i,0,E),i=m.minus(c.times(i)),!i.c[0]&&E==1&&(i.s=m.s),i)},s.multipliedBy=s.times=function(i,d){var c,g,m,w,y,h,k,A,T,F,H,re,ge,ke,xe,G=this,we=G.c,Se=(i=new I(i,d)).c;if(!we||!Se||!we[0]||!Se[0])return!G.s||!i.s||we&&!we[0]&&!Se||Se&&!Se[0]&&!we?i.c=i.e=i.s=null:(i.s*=G.s,!we||!Se?i.c=i.e=null:(i.c=[0],i.e=0)),i;for(g=Je(G.e/be)+Je(i.e/be),i.s*=G.s,k=we.length,F=Se.length,k<F&&(ge=we,we=Se,Se=ge,m=k,k=F,F=m),m=k+F,ge=[];m--;ge.push(0));for(ke=Qe,xe=wt,m=F;--m>=0;){for(c=0,H=Se[m]%xe,re=Se[m]/xe|0,y=k,w=m+y;w>m;)A=we[--y]%xe,T=we[y]/xe|0,h=re*A+T*H,A=H*A+h%xe*xe+ge[w]+c,c=(A/ke|0)+(h/xe|0)+re*T,ge[w--]=A%ke;ge[w]=c}return c?++g:ge.splice(0,1),he(i,ge,g)},s.negated=function(){var i=new I(this);return i.s=-i.s||null,i},s.plus=function(i,d){var c,g=this,m=g.s;if(i=new I(i,d),d=i.s,!m||!d)return new I(NaN);if(m!=d)return i.s=-d,g.minus(i);var w=g.e/be,y=i.e/be,h=g.c,k=i.c;if(!w||!y){if(!h||!k)return new I(m/0);if(!h[0]||!k[0])return k[0]?i:new I(h[0]?g:m*0)}if(w=Je(w),y=Je(y),h=h.slice(),m=w-y){for(m>0?(y=w,c=k):(m=-m,c=h),c.reverse();m--;c.push(0));c.reverse()}for(m=h.length,d=k.length,m-d<0&&(c=k,k=h,h=c,d=m),m=0;d;)m=(h[--d]=h[d]+k[d]+m)/Qe|0,h[d]=Qe===h[d]?0:h[d]%Qe;return m&&(h=[m].concat(h),++y),he(i,h,y)},s.precision=s.sd=function(i,d){var c,g,m,w=this;if(i!=null&&i!==!!i)return Ie(i,1,_e),d==null?d=l:Ie(d,0,8),ye(new I(w),i,d);if(!(c=w.c))return null;if(m=c.length-1,g=m*be+1,m=c[m]){for(;m%10==0;m/=10,g--);for(m=c[0];m>=10;m/=10,g++);}return i&&w.e+1>g&&(g=w.e+1),g},s.shiftedBy=function(i){return Ie(i,-eo,eo),this.times("1e"+i)},s.squareRoot=s.sqrt=function(){var i,d,c,g,m,w=this,y=w.c,h=w.s,k=w.e,A=a+4,T=new I("0.5");if(h!==1||!y||!y[0])return new I(!h||h<0&&(!y||y[0])?NaN:y?w:1/0);if(h=Math.sqrt(+Be(w)),h==0||h==1/0?(d=Xe(y),(d.length+k)%2==0&&(d+="0"),h=Math.sqrt(+d),k=Je((k+1)/2)-(k<0||k%2),h==1/0?d="5e"+k:(d=h.toExponential(),d=d.slice(0,d.indexOf("e")+1)+k),c=new I(d)):c=new I(h+""),c.c[0]){for(k=c.e,h=k+A,h<3&&(h=0);;)if(m=c,c=T.times(m.plus(t(w,m,A,1))),Xe(m.c).slice(0,h)===(d=Xe(c.c)).slice(0,h))if(c.e<k&&--h,d=d.slice(h-3,h+1),d=="9999"||!g&&d=="4999"){if(!g&&(ye(m,m.e+a+2,0),m.times(m).eq(w))){c=m;break}A+=4,h+=4,g=1}else{(!+d||!+d.slice(1)&&d.charAt(0)=="5")&&(ye(c,c.e+a+2,1),i=!c.times(c).eq(w));break}}return ye(c,c.e+a+1,l,i)},s.toExponential=function(i,d){return i!=null&&(Ie(i,0,_e),i++),q(this,i,d,1)},s.toFixed=function(i,d){return i!=null&&(Ie(i,0,_e),i=i+this.e+1),q(this,i,d)},s.toFormat=function(i,d,c){var g,m=this;if(c==null)i!=null&&d&&typeof d=="object"?(c=d,d=null):i&&typeof i=="object"?(c=i,i=d=null):c=C;else if(typeof c!="object")throw Error(We+"Argument not an object: "+c);if(g=m.toFixed(i,d),m.c){var w,y=g.split("."),h=+c.groupSize,k=+c.secondaryGroupSize,A=c.groupSeparator||"",T=y[0],F=y[1],H=m.s<0,re=H?T.slice(1):T,ge=re.length;if(k&&(w=h,h=k,k=w,ge-=w),h>0&&ge>0){for(w=ge%h||h,T=re.substr(0,w);w<ge;w+=h)T+=A+re.substr(w,h);k>0&&(T+=A+re.slice(w)),H&&(T="-"+T)}g=F?T+(c.decimalSeparator||"")+((k=+c.fractionGroupSize)?F.replace(new RegExp("\\d{"+k+"}\\B","g"),"$&"+(c.fractionGroupSeparator||"")):F):T}return(c.prefix||"")+g+(c.suffix||"")},s.toFraction=function(i){var d,c,g,m,w,y,h,k,A,T,F,H,re=this,ge=re.c;if(i!=null&&(h=new I(i),!h.isInteger()&&(h.c||h.s!==1)||h.lt(r)))throw Error(We+"Argument "+(h.isInteger()?"out of range: ":"not an integer: ")+Be(h));if(!ge)return new I(re);for(d=new I(r),A=c=new I(r),g=k=new I(r),H=Xe(ge),w=d.e=H.length-re.e-1,d.c[0]=to[(y=w%be)<0?be+y:y],i=!i||h.comparedTo(d)>0?w>0?d:A:h,y=_,_=1/0,h=new I(H),k.c[0]=0;T=t(h,d,0,1),m=c.plus(T.times(g)),m.comparedTo(i)!=1;)c=g,g=m,A=k.plus(T.times(m=A)),k=m,d=h.minus(T.times(m=d)),h=m;return m=t(i.minus(c),g,0,1),k=k.plus(m.times(A)),c=c.plus(m.times(g)),k.s=A.s=re.s,w=w*2,F=t(A,g,w,l).minus(re).abs().comparedTo(t(k,c,w,l).minus(re).abs())<1?[A,g]:[k,c],_=y,F},s.toNumber=function(){return+Be(this)},s.toPrecision=function(i,d){return i!=null&&Ie(i,1,_e),q(this,i,d,2)},s.toString=function(i){var d,c=this,g=c.s,m=c.e;return m===null?g?(d="Infinity",g<0&&(d="-"+d)):d="NaN":(i==null?d=m<=f||m>=S?fn(Xe(c.c),m):ut(Xe(c.c),m,"0"):i===10&&J?(c=ye(new I(c),a+m+1,l),d=ut(Xe(c.c),c.e,"0")):(Ie(i,2,D.length,"Base"),d=n(ut(Xe(c.c),m,"0"),10,i,g,!0)),g<0&&c.c[0]&&(d="-"+d)),d},s.valueOf=s.toJSON=function(){return Be(this)},s._isBigNumber=!0,s[Symbol.toStringTag]="BigNumber",s[Symbol.for("nodejs.util.inspect.custom")]=s.valueOf,e!=null&&I.set(e),I}function Je(e){var t=e|0;return e>0||e===t?t:t-1}function Xe(e){for(var t,n,o=1,s=e.length,r=e[0]+"";o<s;){for(t=e[o++]+"",n=be-t.length;n--;t="0"+t);r+=t}for(s=r.length;r.charCodeAt(--s)===48;);return r.slice(0,s+1||1)}function St(e,t){var n,o,s=e.c,r=t.c,a=e.s,l=t.s,f=e.e,S=t.e;if(!a||!l)return null;if(n=s&&!s[0],o=r&&!r[0],n||o)return n?o?0:-l:a;if(a!=l)return a;if(n=a<0,o=f==S,!s||!r)return o?0:!s^n?1:-1;if(!o)return f>S^n?1:-1;for(l=(f=s.length)<(S=r.length)?f:S,a=0;a<l;a++)if(s[a]!=r[a])return s[a]>r[a]^n?1:-1;return f==S?0:f>S^n?1:-1}function Ie(e,t,n,o){if(e<t||e>n||e!==je(e))throw Error(We+(o||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function un(e){var t=e.c.length-1;return Je(e.e/be)==t&&e.c[t]%2!=0}function fn(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function ut(e,t,n){var o,s;if(t<0){for(s=n+".";++t;s+=n);e=s+e}else if(o=e.length,++t>o){for(s=n,t-=o;--t;s+=n);e+=s}else t<o&&(e=e.slice(0,t)+"."+e.slice(t));return e}var ue=hs();class pn{baseUrl;constructor(t){this.baseUrl=t}buildUrl(t,n){const o=new URL(t,this.baseUrl);return n&&Object.entries(n).forEach(([s,r])=>{r!=null&&o.searchParams.append(s,String(r))}),o.toString()}async get(t,n={}){const o=this.buildUrl(t,n.query),s=await fetch(o,{method:"GET",headers:n.headers||{}});if(!s.ok){let a=null;try{a=await s.json()}catch{try{const f=await s.text();f&&(a={message:f})}catch{}}const l=new Error(a?.message||a?.errorMessage||`HTTP ${s.status}: ${s.statusText}`);throw l.status=s.status,l.statusText=s.statusText,a&&(l.data=a),l}return{data:await s.json(),status:s.status}}async post(t,n,o={}){const s=this.buildUrl(t,o.query),r=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",...o.headers},body:JSON.stringify(n)});if(!r.ok){let l=null;try{l=await r.json()}catch{try{const S=await r.text();S&&(l={message:S})}catch{}}const f=new Error(l?.message||l?.errorMessage||`HTTP ${r.status}: ${r.statusText}`);throw f.status=r.status,f.statusText=r.statusText,l&&(f.data=l),f}return{data:await r.json(),status:r.status}}}const Ni="https://deep-index.moralis.io";function Jt(){return"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJub25jZSI6ImY4NmY0Yzc2LTA3MDQtNGEwZS04YTA0LWUwODllOGQxMGZjZCIsIm9yZ0lkIjoiMzk0MDAyIiwidXNlcklkIjoiNDA0ODUzIiwidHlwZUlkIjoiYjQyODExOTQtOGQ0Yi00NjkxLTlhZjItNjU4ODE2NzExYmRjIiwidHlwZSI6IlBST0pFQ1QiLCJpYXQiOjE3MTY4NjQyNTYsImV4cCI6NDg3MjYyNDI1Nn0.V8crfBIBardAnZkc05FD0hQIJBeZxMqvzRnYExVtnF8"}function Xt(e){return{"X-API-Key":e,Accept:"application/json"}}const Kt=new pn(Ni);async function ot(e){const{address:t,chain:n="base",token_addresses:o,exclude_spam:s,exclude_unverified_contracts:r}=e;if(!t)throw new Error("Address is required");try{const a=Jt(),l={chain:n,exclude_spam:s??!1,exclude_unverified_contracts:r??!1};o&&(l.token_addresses=o);const S=(await Kt.get(`/api/v2.2/wallets/${encodeURIComponent(t)}/tokens`,{query:l,headers:Xt(a)})).data;return S?.result?.length>0&&(S.result=S.result.filter(N=>new ue(N?.balance||0).gt(0)),S.result=S.result.map(N=>({...N,token_address:N.token_address===wi?Ye:N.token_address}))),{success:!0,data:S}}catch(a){const l=a instanceof Error?a.message:"Unknown error";return console.error("❌ Error fetching token balances:",l),{success:!1,error:l}}}async function Pi(e){const{address:t,chain:n="base"}=e;if(!t)throw new Error("Token address is required");try{const o=Jt(),[s,r]=await Promise.allSettled([Kt.get("/api/v2.2/erc20/metadata",{query:{chain:n,addresses:[t]},headers:Xt(o)}),Kt.get(`/api/v2.2/erc20/${encodeURIComponent(t)}/price`,{query:{chain:n,include:"percent_change"},headers:Xt(o)})]),a=s.status==="fulfilled"?s.value.data:[];if(!a||a.length===0)return{success:!1,error:"Token metadata not found"};const l=a[0],f=r.status==="fulfilled"?r.value.data?.usdPrice??void 0:void 0;return{success:!0,data:{token_address:l.token_address,name:l.name,symbol:l.symbol,decimals:l.decimals,logo:l.logo||l.thumbnail,thumbnail:l.thumbnail,usd_price:f}}}catch(o){const s=o instanceof Error?o.message:"Unknown error";return console.error("❌ Error fetching token metadata:",s),{success:!1,error:s}}}async function Fi(e){const{prompt:t,model:n="gpt-4.1-mini",stream:o=!1,systemPrompt:s}=e;if(!t)throw new Error("Prompt is required");try{const r=Jt(),a=new pn("https://cortex-api.moralis.io"),l=s?`${s}
25
88
 
26
89
  ---
27
90
 
28
- User: ${t}`:t;return{success:!0,data:(await o.post("/chat",{prompt:c,model:n,stream:s},{headers:{"X-API-Key":a,Accept:"application/json","Content-Type":"application/json"}})).data}}catch(a){const o=a instanceof Error?a.message:"Unknown error";return console.error("❌ Error chatting with Cortex AI:",o),{success:!1,error:o}}}async function Ni(e){const{address:t,chain:n="base"}=e;if(!t)throw new Error("Contract address is required");try{const s=qt();return{success:!0,data:(await Xt.get(`/api/v2.2/nft/${encodeURIComponent(t)}/metadata`,{query:{chain:n},headers:Jt(s)})).data}}catch(s){const r=s instanceof Error?s.message:"Unknown error";return console.error("❌ Error fetching NFT contract metadata:",r),{success:!1,error:r}}}async function Oi(e){const{address:t,chain:n="base",limit:s=20,exclude_spam:r=!0,cursor:a}=e;if(!t)throw new Error("Address is required");try{const o=qt(),c={chain:n,format:"decimal",limit:s,exclude_spam:r,media_items:!0,normalizeMetadata:!0};return a&&(c.cursor=a),{success:!0,data:(await Xt.get(`/api/v2.2/${encodeURIComponent(t)}/nft`,{query:c,headers:Jt(o)})).data}}catch(o){const c=o instanceof Error?o.message:"Unknown error";return console.error("❌ Error fetching NFTs:",c),{success:!1,error:c}}}const Ui="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAx8SURBVHgB7VprbFzFFT5n9kmoil0JiUqVsuYX/7BRSeL+aOyKivKjxYYEmpbWNlQpUYvsQAtBVPHdoBYFodgWIiAK8ppWysOVbFrRh0qxUyE5BlQ7/VEqVYo3P6qq6iMbpYTEu3dOz7zuY72Jr51NIrU59u597NyZ+ea8zx2A63Sd/qcI4QoQTfW0QC3fDrLWpS4BUxUAeQwfmFyEa0xNB0xHtw9yrx7DbAlH4WGI1FkZBHq47egEXCNqGmCa3NbF3Q0z0K7IXbLD1I+zBCh24/Yjb8JVpssGTIe+WoCUP8TYbufemKvYzkdSghwcTUsKgQfnJfCrRdwxXYarRM0X6XHW3w3Ze1ln+xlTV4MWFMo4mkUBKkK6NoG9Vx74ugHfNjNXyJ/nk/P5ymJvR6VRGzpyfw+AGOFRCoF4o8BA0s0MrBQg6zdccf1eE+CWhYWWDedrg7mqP5StYUtOAuVqgHy+mPFpOi/lxK97O8v1z7Eh6+fDMH8KcdFuOCV+nnqvlEVPDLhlbq6QQpzJ+lhgkMBgQR2zPlBegfYB8vzJkvBguTYxvSMOnA71FECkPcbal0C3FZUgw/rdZDFPDPjG9+eXGGQhr0DWCHI+8keB5nMpiO9hzoGuQZnPvTce2rxCPDXwVHaEdfzeOKcvwnlkN7b9aBGaRIkAZxbm+pmz43kGmVXcVUB9ZHE2INUnq6/1Aqh7xB8+4lLmAtx3cOemFeJJh1jMBYu51m9YiTcqBUSzPPBAM7idCHBu4b2ZtISteQaTrTmuohZpw2Ut2vqYl0YC1OJ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HrC6J7iK5I3MFfKcGWVr2J9zXNX7uMDu+TIc15ytBbt+IIOyrXD3/gq/SoP17t5xdFUBO3rhhfmeDTUYYbCFnNmqqEQ5AGu3O2mxzlRp922vbhmFJtE1Aezo9R+qLY1imAEWAo5arud8qqRqtLvjYGcJmkjXFLCjo9677bnl9Nasj60swpSuyWOfgPxix2jHZYnvdbpO/wf0X652D+/dGV80AAAAAElFTkSuQmCC",Di="data:image/svg+xml,%3csvg%20width='36'%20height='36'%20viewBox='0%200%2036%2036'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3crect%20width='36'%20height='36'%20rx='18'%20fill='%232358B2'/%3e%3cmask%20id='mask0_1924_16177'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='11'%20y='10'%20width='17'%20height='16'%3e%3crect%20x='11.334'%20y='10'%20width='16'%20height='16'%20fill='url(%23pattern0_1924_16177)'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_1924_16177)'%3e%3crect%20x='11.334'%20y='10'%20width='16'%20height='16'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3cpattern%20id='pattern0_1924_16177'%20patternContentUnits='objectBoundingBox'%20width='1'%20height='1'%3e%3cuse%20xlink:href='%23image0_1924_16177'%20transform='scale(0.00195312)'/%3e%3c/pattern%3e%3cimage%20id='image0_1924_16177'%20width='512'%20height='512'%20preserveAspectRatio='none'%20xlink:href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOgAAADoABlffMYAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURBVHic7d13uGRlme7/79M0ijnrKM6ImHAMmHXGgB7zKJhzAAMgZjFg4DfnzO8ISM4gKIKIEgwImAAjiAQRCSoCCgaCgOQcn/PHu5reNHt37121qt61qr6f6+pLbLr3vi/Seuqtp947MhN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nZgmG1pVwAAAABJRU5ErkJggg=='/%3e%3c/defs%3e%3c/svg%3e";class Fi extends fn{constructor(){super("https://wallet-api.pantograph.app")}async getTokensDetails(t,n="base"){try{if(!t||!Array.isArray(t)||t.length===0)throw new Error("Addresses must be a non-empty array");const s=t.join(","),r=await this.get(`/keyrings/tokens/${n}/v2`,{query:{addresses:s}});return Array.isArray(r.data)&&(r.data=r.data.filter((a,o,c)=>o===c.findIndex(T=>T.address.toLowerCase()===a.address.toLowerCase())),Array.isArray(t)&&t.length>0&&(r.data=r.data.filter(a=>t.some(o=>o.toLowerCase()===a.address.toLowerCase())),r.data.sort((a,o)=>t.findIndex(c=>c.toLowerCase()===a.address.toLowerCase())-t.findIndex(c=>c.toLowerCase()===o.address.toLowerCase())))),r}catch(s){throw console.error("❌ Error getting tokens details:",s instanceof Error?s.message:s),s}}async getTokenDetail(t,n="base"){try{if(!t)throw new Error("Address is required");const s=await this.getTokensDetails([t],n);return{data:s.data[0]||null,status:s.status}}catch(s){throw console.error(`❌ Error getting token detail for ${t}:`,s instanceof Error?s.message:s),s}}async getTopGainers(t="base",n="24h",s=3){try{return await this.get(`/token-list/top-gainers/${t}`,{query:{duration:n,limit:s}})}catch(r){throw console.error("❌ Error getting top gainers:",r instanceof Error?r.message:r),r}}}const Ze=new Fi,Mi="https://dln.debridge.finance",_i=new fn(Mi);async function $n(e){const{chainId:t,tokenIn:n,tokenInAmount:s,tokenOut:r,accesstoken:a,slippage:o="auto",tokenOutRecipient:c}=e;if(!t||!n||!s||!r)throw new Error("Missing required parameters: chainId, tokenIn, tokenInAmount, tokenOut");try{const N=(await(await fetch("https://exchange-api.keyring.app/admin/setting?configs=others",{method:"GET"})).json())?.others||{},L=N?.AFFILIATE_FEE_PERENT,m=N?.AFFILIATE_FEE_RECIPIENT,k=await _i.get("/v1.0/chain/transaction",{query:{chainId:String(t),tokenIn:n,tokenInAmount:s,tokenOut:r,slippage:String(o),tokenOutRecipient:c,accesstoken:a,affiliateFeePercent:L,affiliateFeeRecipient:m}});if(k.data?.error)throw new Error(`DeBridge API Error: ${k.data.error}`);return console.log("✅ Quote retrieved successfully"),{success:!0,data:k.data}}catch(T){let C=T instanceof Error?T.message:"Unknown error";const N=T;N.data?.errorMessage?C=N.data.errorMessage:N.response?.data?.errorMessage?C=N.response.data.errorMessage:N.data?.message?C=N.data.message:N.response?.data?.message&&(C=N.response.data.message);const L=N.status||N.response?.status||N.statusCode||N.data?.status;return console.error("📋 Error details:",{errorMessage:C,errorCode:N.data?.errorCode,errorId:N.data?.errorId,status:L,reqId:N.data?.reqId,fullError:{message:N.message,status:N.status,statusCode:N.statusCode}}),{success:!1,error:T instanceof Error?T.message:"Unknown error",status:L,errorMessage:C,errorCode:N.data?.errorCode,errorId:N.data?.errorId}}}function vt(e){const t=[],n=/!\[([^\]]*)\]\(([^)]+)\)|\[([^\]]*)\]\(([^)]+)\)|(https?:\/\/[^\s<>]+)|\*\*(.+?)\*\*|__(.+?)__|\*(.+?)\*|_(.+?)_|~~(.+?)~~|`([^`]+)`/g;let s=0,r;for(;(r=n.exec(e))!==null;)r.index>s&&t.push(e.slice(s,r.index)),r[1]!==void 0||r[2]!==void 0?t.push(I.jsx("img",{src:r[2],alt:r[1],className:"mc-image"},r.index)):r[3]!==void 0?t.push(I.jsx("a",{href:r[4],target:"_blank",rel:"noopener noreferrer",className:"mc-link",children:r[3]},r.index)):r[5]!==void 0?t.push(I.jsx("a",{href:r[5],target:"_blank",rel:"noopener noreferrer",className:"mc-link",children:r[5]},r.index)):r[6]!==void 0?t.push(I.jsx("strong",{children:vt(r[6])},r.index)):r[7]!==void 0?t.push(I.jsx("strong",{children:vt(r[7])},r.index)):r[8]!==void 0?t.push(I.jsx("em",{children:vt(r[8])},r.index)):r[9]!==void 0?t.push(I.jsx("em",{children:vt(r[9])},r.index)):r[10]!==void 0?t.push(I.jsx("del",{children:vt(r[10])},r.index)):r[11]!==void 0&&t.push(I.jsx("code",{className:"mc-inline-code",children:r[11]},r.index)),s=r.index+r[0].length;return s<e.length&&t.push(e.slice(s)),t.length>0?t:[e]}const Li=({content:e})=>{const t=e.split(`
29
- `),n=[];let s=0;for(;s<t.length;){const r=t[s];if(r.trimStart().startsWith("```")){const o=r.trimStart().slice(3)?.trim(),c=[];for(s++;s<t.length&&!t[s].trimStart().startsWith("```");)c.push(t[s]),s++;n.push(I.jsxs("div",{className:"mc-codeblock",children:[o&&I.jsx("div",{className:"mc-codeblock-lang",children:o}),I.jsx("pre",{children:I.jsx("code",{children:c.join(`
30
- `)})})]},`code-${s}`)),s++;continue}if(/^(\s*[-*_]\s*){3,}$/.test(r)){n.push(I.jsx("hr",{className:"mc-hr"},`hr-${s}`)),s++;continue}const a=r.match(/^(#{1,3})\s+(.+)/);if(a){const o=a[1].length,c=a[2];n.push(I.jsx("div",{className:`mc-heading mc-h${o}`,children:vt(c)},`h-${s}`)),s++;continue}if(r.trimStart().startsWith("> ")){const o=[];for(;s<t.length&&t[s].trimStart().startsWith("> ");)o.push(t[s].replace(/^\s*>\s?/,"")),s++;n.push(I.jsx("div",{className:"mc-blockquote",children:o.map((c,T)=>I.jsx("div",{children:vt(c)},T))},`bq-${s}`));continue}if(r?.trim()===""){n.push(I.jsx("div",{className:"mc-empty-line"},`empty-${s}`)),s++;continue}n.push(I.jsx("div",{className:"mc-line",children:vt(r)},`line-${s}`)),s++}return I.jsx("div",{className:"message-content",children:n})},Hi={send_native:{label:"Send Native Token",description:"Send native token (ETH, BNB, MATIC, etc.) to an address",fields:[{key:"to_address",label:"Recipient Address",type:"address",placeholder:"0x...",required:!0,validation:"address"},{key:"amount",label:"Amount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"}]},send_token:{label:"Send Token (ERC20)",description:"Send an ERC20 token to an address",fields:[{key:"contract_address",label:"Token Contract",type:"address",placeholder:"0x... token contract",required:!0,validation:"address",editable:!1},{key:"token_symbol",label:"Token Symbol",type:"text",placeholder:"e.g. USDC",required:!1,editable:!1},{key:"to_address",label:"Recipient Address",type:"address",placeholder:"0x...",required:!0,validation:"address"},{key:"amount",label:"Amount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"},{key:"decimals",label:"Decimals",type:"number",placeholder:"18",required:!1,editable:!1}]},swap_token:{label:"Swap Token",description:"Swap one token for another",fields:[{key:"token_in",label:"From Token",type:"address",placeholder:"0x... or native",required:!0,editable:!1},{key:"token_in_symbol",label:"From Symbol",type:"text",placeholder:"e.g. ETH",required:!1,editable:!1},{key:"token_out",label:"To Token",type:"address",placeholder:"0x...",required:!0,editable:!1},{key:"token_out_symbol",label:"To Symbol",type:"text",placeholder:"e.g. USDC",required:!1,editable:!1},{key:"token_in_decimals",label:"From Decimals",type:"number",placeholder:"18",required:!1,editable:!1},{key:"token_out_decimals",label:"To Decimals",type:"number",placeholder:"18",required:!1,editable:!1},{key:"amount",label:"Amount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"}]},approve_token:{label:"Approve Token",description:"Approve a spender to use your tokens",fields:[{key:"contract_address",label:"Token Contract",type:"address",placeholder:"0x... token contract",required:!0,validation:"address",editable:!1},{key:"token_symbol",label:"Token Symbol",type:"text",placeholder:"e.g. USDC",required:!1,editable:!1},{key:"spender_address",label:"Spender Address",type:"address",placeholder:"0x... spender contract",required:!0,validation:"address",editable:!1},{key:"amount",label:"Amount (empty = unlimited)",type:"amount",placeholder:"0.0 or leave empty for max",required:!1,validation:"amount"},{key:"decimals",label:"Decimals",type:"number",placeholder:"18",required:!1,editable:!1}]},wrap_native:{label:"Wrap Native Token",description:"Wrap native token (ETH → WETH)",fields:[{key:"amount",label:"Amount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"}]},unwrap_native:{label:"Unwrap Native Token",description:"Unwrap native token (WETH → ETH)",fields:[{key:"amount",label:"Amount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"}]},send_nft:{label:"Send NFT",description:"Transfer an ERC721 or ERC1155 NFT to another address",fields:[{key:"contract_address",label:"NFT Contract",type:"address",placeholder:"0x... NFT contract",required:!0,validation:"address",editable:!1},{key:"token_id",label:"Token ID",type:"text",placeholder:"e.g. 1234",required:!0,editable:!1},{key:"to_address",label:"Recipient Address",type:"address",placeholder:"0x...",required:!0,validation:"address"},{key:"token_standard",label:"Token Standard",type:"text",placeholder:"ERC721 or ERC1155",required:!0,editable:!1},{key:"amount",label:"Amount",type:"text",placeholder:"1",required:!1},{key:"nft_name",label:"NFT Name",type:"text",placeholder:"e.g. Bored Ape #1234",required:!1,editable:!1}]}};function Ri(e){return Re(e)}function es(e){if(!e||e?.trim()==="")return!1;const t=parseFloat(e);return!isNaN(t)&&t>0}const Vi={send_native:"💸",send_token:"📤",swap_token:"🔄",approve_token:"✅",wrap_native:"📦",unwrap_native:"📭"},Wi=({action:e,initialValues:t,onSubmit:n,onCancel:s,isSubmitting:r=!1,tokenInfo:a})=>{const o=Hi[e],[c,T]=re.useState(()=>{if(!o)return{};const g={};return o.fields.forEach(B=>{g[B.key]=t[B.key]||""}),g}),[C]=re.useState(()=>["send_native","send_token","swap_token"].includes(e)&&!a&&c.contract_address?"Token not found in your wallet.":null),[N,L]=re.useState(()=>{const g={};if(["send_native","send_token","swap_token"].includes(e)&&a){const ue=parseFloat(a.balanceFormatted||"0");if(ue<=0)g.amount=`You have no ${a.symbol} balance in your wallet.`;else{const D=t.amount?.trim();D&&es(D)&&parseFloat(D)>ue&&(g.amount=`Insufficient balance. Available: ${a.balanceFormatted} ${a.symbol}`)}}return g}),m=re.useCallback((g,B)=>{T(ue=>({...ue,[g]:B})),N[g]&&L(ue=>{const D={...ue};return delete D[g],D})},[N]),k=re.useCallback(()=>{if(!o)return!1;const g={};return o.fields.forEach(B=>{const ue=c[B.key]?.trim()||"";if(B.required&&!ue){g[B.key]=`${B.label} is required`;return}if(ue){if(B.validation==="address"&&!Ri(ue)&&(g[B.key]="Invalid address (0x + 40 hex chars)"),B.validation==="amount"&&!es(ue)&&(g[B.key]="Must be a positive number"),B.key==="amount"&&ue&&es(ue)&&a?.balanceFormatted){const D=parseFloat(ue),Q=parseFloat(a.balanceFormatted);D>Q&&(g[B.key]=`Insufficient balance. Available: ${a.balanceFormatted} ${a.symbol}`)}B.validation==="positive_number"&&(isNaN(Number(ue))||Number(ue)<0)&&(g[B.key]="Must be a valid number")}}),L(g),Object.keys(g).length===0},[o,c,a]),x=re.useCallback(()=>{k()&&n(e,c)},[k,n,e,c]);return o?I.jsxs("div",{className:"action-form",children:[I.jsxs("div",{className:"action-form-title",children:[I.jsx("span",{children:Vi[e]||"⚙️"}),I.jsx("span",{children:o.label})]}),C&&I.jsxs("div",{className:"action-form-general-error",children:["⚠️ ",C]}),a&&I.jsx("div",{className:"action-form-token-info",children:I.jsxs("div",{className:"token-info-row",children:[a.logo&&I.jsx("img",{src:a.logo,alt:a.symbol,className:"token-info-logo",width:20,height:20}),I.jsxs("div",{className:"token-info-details",children:[I.jsxs("span",{className:"token-info-name",children:[a.name," (",a.symbol,")"]}),I.jsxs("span",{className:"token-info-balance",children:["Balance:"," ",de(a.balanceFormatted).decimalPlaces(8,de.ROUND_DOWN).toFormat()," ",a.symbol,a.usdValue!==void 0&&I.jsxs("span",{className:"token-info-usd",children:[" ","≈ $",a.usdValue.toFixed(2)]})]})]})]})}),I.jsx("div",{className:"action-form-fields",children:o.fields.map(g=>g.key==="amount"&&e==="send_nft"&&c.token_standard?.toUpperCase()!=="ERC1155"?null:I.jsxs("div",{className:"action-form-field",children:[I.jsxs("div",{className:"action-form-field-header",children:[I.jsxs("label",{children:[g.label,g.required&&" *"]}),g.key==="amount"&&a&&e!=="send_nft"&&I.jsxs("div",{className:"action-form-pct-btns",children:[[25,50,75].map(B=>I.jsxs("button",{type:"button",className:"action-form-pct-btn",onClick:()=>m("amount",(parseFloat(a.balanceFormatted)*B/100).toString()),disabled:r,children:[B,"%"]},B)),I.jsx("button",{type:"button",className:"action-form-pct-btn action-form-max-btn",onClick:()=>m("amount",a.balanceFormatted),disabled:r,children:"MAX"})]})]}),(()=>{const B=g.editable===!1&&!!t[g.key],ue=r||B,D=[N[g.key]?"error":"",B?"readonly":""].filter(Boolean).join(" ");return g.type==="address"?I.jsx("textarea",{rows:2,placeholder:g.placeholder,value:c[g.key]||"",onChange:Q=>m(g.key,Q.target.value),className:D,disabled:ue}):I.jsx("input",{type:g.type==="number"?"number":"text",placeholder:g.placeholder,value:c[g.key]||"",onChange:Q=>m(g.key,Q.target.value),className:D,disabled:ue})})(),N[g.key]&&I.jsx("span",{className:"field-error",children:N[g.key]})]},g.key))}),I.jsxs("div",{className:"action-form-actions",children:[I.jsx("button",{className:"action-form-cancel",onClick:s,type:"button",disabled:r,children:"Cancel"}),I.jsx("button",{className:"action-form-submit",onClick:x,type:"button",disabled:r,children:r?"⏳ Processing...":"🚀 Execute"})]})]}):null},Gi=({scrollContainerRef:e,threshold:t=200})=>{const[n,s]=re.useState(!1);re.useEffect(()=>{const a=e.current;if(!a)return;const o=()=>{const{scrollTop:c,scrollHeight:T,clientHeight:C}=a,N=T-c-C;s(N>t)};return a.addEventListener("scroll",o,{passive:!0}),o(),()=>{a.removeEventListener("scroll",o)}},[e,t]);const r=()=>{e.current?.scrollTo({top:e.current.scrollHeight,behavior:"smooth"})};return n?I.jsx("button",{className:"scroll-to-bottom-btn",onClick:r,"aria-label":"Scroll to bottom",type:"button",children:I.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:I.jsx("path",{d:"M9 3V15M9 15L4 10M9 15L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}):null};function zi(e){const{walletAddress:t,chainName:n,chainId:s,nativeSymbol:r}=e;return t?t&&!wt[s]?`You are a Web3 wallet assistant for the Keyring crypto EVM wallet app.
91
+ User: ${t}`:t;return{success:!0,data:(await a.post("/chat",{prompt:l,model:n,stream:o},{headers:{"X-API-Key":r,Accept:"application/json","Content-Type":"application/json"}})).data}}catch(r){const a=r instanceof Error?r.message:"Unknown error";return console.error("❌ Error chatting with Cortex AI:",a),{success:!1,error:a}}}async function Ui(e){const{address:t,chain:n="base"}=e;if(!t)throw new Error("Contract address is required");try{const o=Jt();return{success:!0,data:(await Kt.get(`/api/v2.2/nft/${encodeURIComponent(t)}/metadata`,{query:{chain:n},headers:Xt(o)})).data}}catch(o){const s=o instanceof Error?o.message:"Unknown error";return console.error("❌ Error fetching NFT contract metadata:",s),{success:!1,error:s}}}async function Oi(e){const{address:t,chain:n="base",limit:o=20,exclude_spam:s=!0,cursor:r}=e;if(!t)throw new Error("Address is required");try{const a=Jt(),l={chain:n,format:"decimal",limit:o,exclude_spam:s,media_items:!0,normalizeMetadata:!0};return r&&(l.cursor=r),{success:!0,data:(await Kt.get(`/api/v2.2/${encodeURIComponent(t)}/nft`,{query:l,headers:Xt(a)})).data}}catch(a){const l=a instanceof Error?a.message:"Unknown error";return console.error("❌ Error fetching NFTs:",l),{success:!1,error:l}}}const Di="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAx8SURBVHgB7VprbFzFFT5n9kmoil0JiUqVsuYX/7BRSeL+aOyKivKjxYYEmpbWNlQpUYvsQAtBVPHdoBYFodgWIiAK8ppWysOVbFrRh0qxUyE5BlQ7/VEqVYo3P6qq6iMbpYTEu3dOz7zuY72Jr51NIrU59u597NyZ+ea8zx2A63Sd/qcI4QoQTfW0QC3fDrLWpS4BUxUAeQwfmFyEa0xNB0xHtw9yrx7DbAlH4WGI1FkZBHq47egEXCNqGmCa3NbF3Q0z0K7IXbLD1I+zBCh24/Yjb8JVpssGTIe+WoCUP8TYbufemKvYzkdSghwcTUsKgQfnJfCrRdwxXYarRM0X6XHW3w3Ze1ln+xlTV4MWFMo4mkUBKkK6NoG9Vx74ugHfNjNXyJ/nk/P5ymJvR6VRGzpyfw+AGOFRCoF4o8BA0s0MrBQg6zdccf1eE+CWhYWWDedrg7mqP5StYUtOAuVqgHy+mPFpOi/lxK97O8v1z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I+mGx/V1MAO/pl751F8Pn9Eck3LHtMgmXfJwcv1o3A96BIvfOTfcf/fWT4+JKoLZ9mdFstIFcjiufFjgjbQ1HmSM6vfgESUlMBK1L7sw5/rbNfVPEOdl2nzKSsDkoKQIf6ia18swDubbmlSAhlDVdKb3HQm1j1zh/deAzOVTvWstFlzX5srfTYq3P9WRLDWR826p0/1XCrU66m94lg3uwAIrUXxGyNUruEACO7g8qF1zerCEzt6hvXgFNiCO87cmKN02k+h+vpxZ2dJV8qSy73IdUvMOk6ClC4Syt4z2QbmIPN0o7c38eFugncPtm9HrC6J7iK5I3MFfKcGWVr2J9zXNX7uMDu+TIc15ytBbt+IIOyrXD3/gq/SoP17t5xdFUBO3rhhfmeDTUYYbCFnNmqqEQ5AGu3O2mxzlRp922vbhmFJtE1Aezo9R+qLY1imAEWAo5arud8qqRqtLvjYGcJmkjXFLCjo9677bnl9Nasj60swpSuyWOfgPxix2jHZYnvdbpO/wf0X652D+/dGV80AAAAAElFTkSuQmCC",Mi="data:image/svg+xml,%3csvg%20width='36'%20height='36'%20viewBox='0%200%2036%2036'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3crect%20width='36'%20height='36'%20rx='18'%20fill='%232358B2'/%3e%3cmask%20id='mask0_1924_16177'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='11'%20y='10'%20width='17'%20height='16'%3e%3crect%20x='11.334'%20y='10'%20width='16'%20height='16'%20fill='url(%23pattern0_1924_16177)'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_1924_16177)'%3e%3crect%20x='11.334'%20y='10'%20width='16'%20height='16'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3cpattern%20id='pattern0_1924_16177'%20patternContentUnits='objectBoundingBox'%20width='1'%20height='1'%3e%3cuse%20xlink:href='%23image0_1924_16177'%20transform='scale(0.00195312)'/%3e%3c/pattern%3e%3cimage%20id='image0_1924_16177'%20width='512'%20height='512'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YF7hLlRALdwKwG3CAlbySpD6rNgDcFiDiAcAHgXcCq1UNM7trKZ/h3z0zT6odRpKkNlQfAGaKiH8HXtH8eDawuFKUG4GjgO8C+2XmFZVySJI0Ep0aAGaKiHsBL6EMAy8HHjjib3ku8EPg+8BPMvPqEX8/SZKq6ewAMFNEBPB0ykCwOvDgGT/uz8KWCW8G/gT8fsaP07yiV5I0TXoxACxPRCymnA7MHAoeAFwPXAFcOeN/LwPOycwb66SVJKkbej8ASJKkhevr5/AlSdIQHAAkSZpCDgCSJE0hBwBJkqaQA4AkSVPo/wH9hnZgmG1pVwAAAABJRU5ErkJggg=='/%3e%3c/defs%3e%3c/svg%3e";class _i extends pn{constructor(){super("https://wallet-api.pantograph.app")}async getTokensDetails(t,n="base"){try{if(!t||!Array.isArray(t)||t.length===0)throw new Error("Addresses must be a non-empty array");const o=t.join(","),s=await this.get(`/keyrings/tokens/${n}/v2`,{query:{addresses:o}});return Array.isArray(s.data)&&(s.data=s.data.filter((r,a,l)=>a===l.findIndex(f=>f.address.toLowerCase()===r.address.toLowerCase())),Array.isArray(t)&&t.length>0&&(s.data=s.data.filter(r=>t.some(a=>a.toLowerCase()===r.address.toLowerCase())),s.data.sort((r,a)=>t.findIndex(l=>l.toLowerCase()===r.address.toLowerCase())-t.findIndex(l=>l.toLowerCase()===a.address.toLowerCase())))),s}catch(o){throw console.error("❌ Error getting tokens details:",o instanceof Error?o.message:o),o}}async getTokenDetail(t,n="base"){try{if(!t)throw new Error("Address is required");const o=await this.getTokensDetails([t],n);return{data:o.data[0]||null,status:o.status}}catch(o){throw console.error(`❌ Error getting token detail for ${t}:`,o instanceof Error?o.message:o),o}}async getTopGainers(t="base",n="24h",o=3){try{return await this.get(`/token-list/top-gainers/${t}`,{query:{duration:n,limit:o}})}catch(s){throw console.error("❌ Error getting top gainers:",s instanceof Error?s.message:s),s}}}const Ke=new _i,Li="https://dln.debridge.finance",Ri=new pn(Li);async function no(e){const{chainId:t,tokenIn:n,tokenInAmount:o,tokenOut:s,accesstoken:r,slippage:a="auto",tokenOutRecipient:l}=e;if(!t||!n||!o||!s)throw new Error("Missing required parameters: chainId, tokenIn, tokenInAmount, tokenOut");try{const N=(await(await fetch("https://exchange-api.keyring.app/admin/setting?configs=others",{method:"GET"})).json())?.others||{},_=N?.AFFILIATE_FEE_PERENT,b=N?.AFFILIATE_FEE_RECIPIENT,E=await Ri.get("/v1.0/chain/transaction",{query:{chainId:String(t),tokenIn:n,tokenInAmount:o,tokenOut:s,slippage:String(a),tokenOutRecipient:l,accesstoken:r,affiliateFeePercent:_,affiliateFeeRecipient:b}});if(E.data?.error)throw new Error(`DeBridge API Error: ${E.data.error}`);return console.log("✅ Quote retrieved successfully"),{success:!0,data:E.data}}catch(f){let S=f instanceof Error?f.message:"Unknown error";const N=f;N.data?.errorMessage?S=N.data.errorMessage:N.response?.data?.errorMessage?S=N.response.data.errorMessage:N.data?.message?S=N.data.message:N.response?.data?.message&&(S=N.response.data.message);const _=N.status||N.response?.status||N.statusCode||N.data?.status;return console.error("📋 Error details:",{errorMessage:S,errorCode:N.data?.errorCode,errorId:N.data?.errorId,status:_,reqId:N.data?.reqId,fullError:{message:N.message,status:N.status,statusCode:N.statusCode}}),{success:!1,error:f instanceof Error?f.message:"Unknown error",status:_,errorMessage:S,errorCode:N.data?.errorCode,errorId:N.data?.errorId}}}function yt(e){const t=[],n=/!\[([^\]]*)\]\(([^)]+)\)|\[([^\]]*)\]\(([^)]+)\)|(https?:\/\/[^\s<>]+)|\*\*(.+?)\*\*|__(.+?)__|\*(.+?)\*|_(.+?)_|~~(.+?)~~|`([^`]+)`/g;let o=0,s;for(;(s=n.exec(e))!==null;)s.index>o&&t.push(e.slice(o,s.index)),s[1]!==void 0||s[2]!==void 0?t.push(B.jsx("img",{src:s[2],alt:s[1],className:"mc-image"},s.index)):s[3]!==void 0?t.push(B.jsx("a",{href:s[4],target:"_blank",rel:"noopener noreferrer",className:"mc-link",children:s[3]},s.index)):s[5]!==void 0?t.push(B.jsx("a",{href:s[5],target:"_blank",rel:"noopener noreferrer",className:"mc-link",children:s[5]},s.index)):s[6]!==void 0?t.push(B.jsx("strong",{children:yt(s[6])},s.index)):s[7]!==void 0?t.push(B.jsx("strong",{children:yt(s[7])},s.index)):s[8]!==void 0?t.push(B.jsx("em",{children:yt(s[8])},s.index)):s[9]!==void 0?t.push(B.jsx("em",{children:yt(s[9])},s.index)):s[10]!==void 0?t.push(B.jsx("del",{children:yt(s[10])},s.index)):s[11]!==void 0&&t.push(B.jsx("code",{className:"mc-inline-code",children:s[11]},s.index)),o=s.index+s[0].length;return o<e.length&&t.push(e.slice(o)),t.length>0?t:[e]}const Hi=({content:e})=>{const t=e.split(`
92
+ `),n=[];let o=0;for(;o<t.length;){const s=t[o];if(s.trimStart().startsWith("```")){const a=s.trimStart().slice(3)?.trim(),l=[];for(o++;o<t.length&&!t[o].trimStart().startsWith("```");)l.push(t[o]),o++;n.push(B.jsxs("div",{className:"mc-codeblock",children:[a&&B.jsx("div",{className:"mc-codeblock-lang",children:a}),B.jsx("pre",{children:B.jsx("code",{children:l.join(`
93
+ `)})})]},`code-${o}`)),o++;continue}if(/^(\s*[-*_]\s*){3,}$/.test(s)){n.push(B.jsx("hr",{className:"mc-hr"},`hr-${o}`)),o++;continue}const r=s.match(/^(#{1,3})\s+(.+)/);if(r){const a=r[1].length,l=r[2];n.push(B.jsx("div",{className:`mc-heading mc-h${a}`,children:yt(l)},`h-${o}`)),o++;continue}if(s.trimStart().startsWith("> ")){const a=[];for(;o<t.length&&t[o].trimStart().startsWith("> ");)a.push(t[o].replace(/^\s*>\s?/,"")),o++;n.push(B.jsx("div",{className:"mc-blockquote",children:a.map((l,f)=>B.jsx("div",{children:yt(l)},f))},`bq-${o}`));continue}if(s?.trim()===""){n.push(B.jsx("div",{className:"mc-empty-line"},`empty-${o}`)),o++;continue}n.push(B.jsx("div",{className:"mc-line",children:yt(s)},`line-${o}`)),o++}return B.jsx("div",{className:"message-content",children:n})},Vi={send_native:{label:"Send Native Token",description:"Send native token (ETH, BNB, MATIC, etc.) to an address",fields:[{key:"to_address",label:"Recipient Address",type:"address",placeholder:"0x...",required:!0,validation:"address"},{key:"amount",label:"Amount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"}]},send_token:{label:"Send Token (ERC20)",description:"Send an ERC20 token to an address",fields:[{key:"contract_address",label:"Token Contract",type:"address",placeholder:"0x... token contract",required:!0,validation:"address",editable:!1},{key:"token_symbol",label:"Token Symbol",type:"text",placeholder:"e.g. USDC",required:!1,editable:!1},{key:"to_address",label:"Recipient Address",type:"address",placeholder:"0x...",required:!0,validation:"address"},{key:"amount",label:"Amount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"},{key:"decimals",label:"Decimals",type:"number",placeholder:"18",required:!1,editable:!1}]},swap_token:{label:"Swap Token",description:"Swap one token for another",fields:[{key:"token_in",label:"From Token",type:"address",placeholder:"0x... or native",required:!0,editable:!1},{key:"token_in_symbol",label:"From Symbol",type:"text",placeholder:"e.g. ETH",required:!1,editable:!1},{key:"token_out",label:"To Token",type:"address",placeholder:"0x...",required:!0,editable:!1},{key:"token_out_symbol",label:"To Symbol",type:"text",placeholder:"e.g. USDC",required:!1,editable:!1},{key:"token_in_decimals",label:"From Decimals",type:"number",placeholder:"18",required:!1,editable:!1},{key:"token_out_decimals",label:"To Decimals",type:"number",placeholder:"18",required:!1,editable:!1},{key:"amount",label:"Amount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"}]},approve_token:{label:"Approve Token",description:"Approve a spender to use your tokens",fields:[{key:"contract_address",label:"Token Contract",type:"address",placeholder:"0x... token contract",required:!0,validation:"address",editable:!1},{key:"token_symbol",label:"Token Symbol",type:"text",placeholder:"e.g. USDC",required:!1,editable:!1},{key:"spender_address",label:"Spender Address",type:"address",placeholder:"0x... spender contract",required:!0,validation:"address",editable:!1},{key:"amount",label:"Amount (empty = unlimited)",type:"amount",placeholder:"0.0 or leave empty for max",required:!1,validation:"amount"},{key:"decimals",label:"Decimals",type:"number",placeholder:"18",required:!1,editable:!1}]},wrap_native:{label:"Wrap Native Token",description:"Wrap native token (ETH → WETH)",fields:[{key:"amount",label:"Amount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"}]},unwrap_native:{label:"Unwrap Native Token",description:"Unwrap native token (WETH → ETH)",fields:[{key:"amount",label:"Amount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"}]},send_nft:{label:"Send NFT",description:"Transfer an ERC721 or ERC1155 NFT to another address",fields:[{key:"contract_address",label:"NFT Contract",type:"address",placeholder:"0x... NFT contract",required:!0,validation:"address",editable:!1},{key:"token_id",label:"Token ID",type:"text",placeholder:"e.g. 1234",required:!0,editable:!1},{key:"to_address",label:"Recipient Address",type:"address",placeholder:"0x...",required:!0,validation:"address"},{key:"token_standard",label:"Token Standard",type:"text",placeholder:"ERC721 or ERC1155",required:!0,editable:!1},{key:"amount",label:"Amount",type:"text",placeholder:"1",required:!1},{key:"nft_name",label:"NFT Name",type:"text",placeholder:"e.g. Bored Ape #1234",required:!1,editable:!1}]}};function Wi(e){return Le(e)}function oo(e){if(!e||e?.trim()==="")return!1;const t=parseFloat(e);return!isNaN(t)&&t>0}const Gi={send_native:"💸",send_token:"📤",swap_token:"🔄",approve_token:"✅",wrap_native:"📦",unwrap_native:"📭"},$i=({action:e,initialValues:t,onSubmit:n,onCancel:o,isSubmitting:s=!1,tokenInfo:r})=>{const{t:a,ti:l}=kn(),f=Vi[e],[S,N]=se.useState(()=>{if(!f)return{};const J={};return f.fields.forEach(I=>{J[I.key]=t[I.key]||""}),J}),[_]=se.useState(()=>["send_native","send_token","swap_token"].includes(e)&&!r&&S.contract_address?a("formTokenNotFound"):null),[b,E]=se.useState(()=>{const J={};if(["send_native","send_token","swap_token"].includes(e)&&r){const q=parseFloat(r.balanceFormatted||"0");if(q<=0)J.amount=l("formNoBalance",{symbol:r.symbol??""});else{const K=t.amount?.trim();K&&oo(K)&&parseFloat(K)>q&&(J.amount=l("formInsufficientBalance",{balance:r.balanceFormatted,symbol:r.symbol??""}))}}return J}),v=se.useCallback((J,I)=>{N(q=>({...q,[J]:I})),b[J]&&E(q=>{const K={...q};return delete K[J],K})},[b]),C=se.useCallback(()=>{if(!f)return!1;const J={};return f.fields.forEach(I=>{const q=S[I.key]?.trim()||"";if(I.required&&!q){J[I.key]=l("formFieldRequired",{field:I.label});return}if(q){if(I.validation==="address"&&!Wi(q)&&(J[I.key]=a("formInvalidAddress")),I.validation==="amount"&&!oo(q)&&(J[I.key]=a("formMustBePositive")),I.key==="amount"&&q&&oo(q)&&r?.balanceFormatted){const K=parseFloat(q),he=parseFloat(r.balanceFormatted);K>he&&(J[I.key]=l("formInsufficientBalance",{balance:r.balanceFormatted,symbol:r.symbol??""}))}I.validation==="positive_number"&&(isNaN(Number(q))||Number(q)<0)&&(J[I.key]=a("formMustBeValidNumber"))}}),E(J),Object.keys(J).length===0},[f,S,r,a,l]),D=se.useCallback(()=>{C()&&n(e,S)},[C,n,e,S]);return f?B.jsxs("div",{className:"action-form",children:[B.jsxs("div",{className:"action-form-title",children:[B.jsx("span",{children:Gi[e]||"⚙️"}),B.jsx("span",{children:f.label})]}),_&&B.jsxs("div",{className:"action-form-general-error",children:["⚠️ ",_]}),r&&B.jsx("div",{className:"action-form-token-info",children:B.jsxs("div",{className:"token-info-row",children:[r.logo&&B.jsx("img",{src:r.logo,alt:r.symbol,className:"token-info-logo",width:20,height:20}),B.jsxs("div",{className:"token-info-details",children:[B.jsxs("span",{className:"token-info-name",children:[r.name," (",r.symbol,")"]}),B.jsxs("span",{className:"token-info-balance",children:[a("formBalance")," ",ue(r.balanceFormatted).decimalPlaces(8,ue.ROUND_DOWN).toFormat()," ",r.symbol,r.usdValue!==void 0&&B.jsxs("span",{className:"token-info-usd",children:[" ","≈ $",r.usdValue.toFixed(2)]})]})]})]})}),B.jsx("div",{className:"action-form-fields",children:f.fields.map(J=>J.key==="amount"&&e==="send_nft"&&S.token_standard?.toUpperCase()!=="ERC1155"?null:B.jsxs("div",{className:"action-form-field",children:[B.jsxs("div",{className:"action-form-field-header",children:[B.jsxs("label",{children:[J.label,J.required&&" *"]}),J.key==="amount"&&r&&e!=="send_nft"&&B.jsxs("div",{className:"action-form-pct-btns",children:[[25,50,75].map(I=>B.jsxs("button",{type:"button",className:"action-form-pct-btn",onClick:()=>v("amount",(parseFloat(r.balanceFormatted)*I/100).toString()),disabled:s,children:[I,"%"]},I)),B.jsx("button",{type:"button",className:"action-form-pct-btn action-form-max-btn",onClick:()=>v("amount",r.balanceFormatted),disabled:s,children:"MAX"})]})]}),(()=>{const I=J.editable===!1&&!!t[J.key],q=s||I,K=[b[J.key]?"error":"",I?"readonly":""].filter(Boolean).join(" ");return J.type==="address"?B.jsx("textarea",{rows:2,placeholder:J.placeholder,value:S[J.key]||"",onChange:he=>v(J.key,he.target.value),className:K,disabled:q}):B.jsx("input",{type:J.type==="number"?"number":"text",placeholder:J.placeholder,value:S[J.key]||"",onChange:he=>v(J.key,he.target.value),className:K,disabled:q})})(),b[J.key]&&B.jsx("span",{className:"field-error",children:b[J.key]})]},J.key))}),B.jsxs("div",{className:"action-form-actions",children:[B.jsx("button",{className:"action-form-cancel",onClick:o,type:"button",disabled:s,children:a("formCancel")}),B.jsx("button",{className:"action-form-submit",onClick:D,type:"button",disabled:s,children:a(s?"formProcessing":"formExecute")})]})]}):null},zi=({scrollContainerRef:e,threshold:t=200})=>{const[n,o]=se.useState(!1);se.useEffect(()=>{const r=e.current;if(!r)return;const a=()=>{const{scrollTop:l,scrollHeight:f,clientHeight:S}=r,N=f-l-S;o(N>t)};return r.addEventListener("scroll",a,{passive:!0}),a(),()=>{r.removeEventListener("scroll",a)}},[e,t]);const s=()=>{e.current?.scrollTo({top:e.current.scrollHeight,behavior:"smooth"})};return n?B.jsx("button",{className:"scroll-to-bottom-btn",onClick:s,"aria-label":"Scroll to bottom",type:"button",children:B.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:B.jsx("path",{d:"M9 3V15M9 15L4 10M9 15L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}):null};function qi(e){const{walletAddress:t,chainName:n,chainId:o,nativeSymbol:s}=e;return t?t&&!ct[o]?`You are a Web3 wallet assistant for the Keyring crypto EVM wallet app.
31
94
  The user's wallet address is: ${t}
32
- The user is selected on (chainId: ${s}) an UNSUPPORTED chain.
95
+ The user is selected on (chainId: ${o}) an UNSUPPORTED chain.
33
96
 
34
97
  ## YOUR ROLE:
35
98
  - You are a friendly, knowledgeable assistant that can talk about ANY topic naturally
36
99
  - You can freely answer general questions, discuss crypto tokens, prices, market info, token details, etc. — these do NOT require a supported chain
37
- - **BLOCKED on unsupported chain** — if the user asks for any of the following, politely inform them that chain (chainId: ${s}) is not currently supported and the action cannot be performed:
100
+ - **BLOCKED on unsupported chain** — if the user asks for any of the following, politely inform them that chain (chainId: ${o}) is not currently supported and the action cannot be performed:
38
101
  - Checking THEIR OWN balance ("what is my balance?", "how much ETH do I have?")
39
102
  - Sending tokens or NFTs
40
103
  - Swapping or buying tokens
@@ -58,8 +121,8 @@ User: ${t}`:t;return{success:!0,data:(await o.post("/chat",{prompt:c,model:n,str
58
121
  - ALWAYS respond with raw JSON only, never wrap in \`\`\`json code blocks
59
122
  - **CRITICAL - LANGUAGE**: Always respond in the SAME language the user writes in. English → English. Vietnamese → Vietnamese. NEVER use Chinese or any other language unless the user wrote in that language.`:`You are a Web3 wallet assistant for the Keyring crypto EVM wallet app.
60
123
  The user's wallet address is: ${t}
61
- The user is on chain: ${n} (chainId: ${s})
62
- Native token: ${r}
124
+ The user is on chain: ${n} (chainId: ${o})
125
+ Native token: ${s}
63
126
 
64
127
  ## YOUR ROLE:
65
128
  - You are a friendly, knowledgeable assistant that can talk about ANY topic naturally
@@ -68,7 +131,7 @@ Native token: ${r}
68
131
  - When user asks about general topics (weather, coding, history, math, etc.), respond naturally using the "chat" action
69
132
  - You will receive CONVERSATION HISTORY to maintain context. Use it to understand what the user is referring to
70
133
  - NEVER confuse a general conversation with a wallet action. Only use wallet actions when user EXPLICITLY wants to perform a crypto operation
71
- - **CRITICAL: contract_address is a REQUIRED field — you MUST always include it in the JSON response with the ACTUAL contract address on the current chain (chainId: ${s}). NEVER leave it empty. You MUST look up and provide the correct contract address for the token on this chain. You know common tokens like USDC, USDT, DAI, WETH, LINK, UNI, AAVE, etc. on major chains — always provide the correct address. If the token genuinely does not exist on this chain, inform the user instead of proceeding with the action.**
134
+ - **CRITICAL: contract_address is a REQUIRED field — you MUST always include it in the JSON response with the ACTUAL contract address on the current chain (chainId: ${o}). NEVER leave it empty. You MUST look up and provide the correct contract address for the token on this chain. You know common tokens like USDC, USDT, DAI, WETH, LINK, UNI, AAVE, etc. on major chains — always provide the correct address. If the token genuinely does not exist on this chain, inform the user instead of proceeding with the action.**
72
135
  - **CRITICAL ACTION RULE: When user requests a wallet operation (swap, send, buy, approve, wrap, unwrap), you MUST return that action type IMMEDIATELY — even if some parameters are missing. DO NOT return a "chat" action to ask for missing details. Simply leave the missing parameters as empty string "". Your prompt for more info (e.g., asking for recipient address) goes in the "message" field of the wallet action itself. For example: If user says "swap DAI to USDC", you MUST return {"action":"swap_token",...} directly, NOT {"action":"chat",...}. If user says "send WETH", you MUST return {"action":"send_token","parameters":{"contract_address":"<WETH address>","to_address":"","amount":"","decimals":"18","token_symbol":"WETH"}} with empty to_address and amount, NOT a chat response.**
73
136
 
74
137
  ## RESPONSE FORMAT:
@@ -110,7 +173,7 @@ Rules for suggested_actions:
110
173
  Whenever your "chat" response mentions, lists, or discusses specific tokens/coins (e.g., trending tokens, token details, token recommendations, price discussions, asking about a token), you MUST include a "token_mentions" array with each token's info so the user can quickly buy them.
111
174
  Each entry: { "symbol": "<TOKEN_SYMBOL>" (REQUIRED), "contract_address": "<actual address>" (REQUIRED), "decimals": <number> (REQUIRED) }
112
175
  - You MUST include ALL crypto tokens mentioned in your response in token_mentions.
113
- - You MUST provide the actual contract_address for each token on chainId ${s}. NEVER leave contract_address empty.
176
+ - You MUST provide the actual contract_address for each token on chainId ${o}. NEVER leave contract_address empty.
114
177
  - You MUST provide the accurate decimals for each token.
115
178
  - Only include tokens that are actual tradeable crypto tokens mentioned in your response
116
179
  - Do NOT include token_mentions for general greetings, non-crypto conversations, or balance checks
@@ -119,36 +182,36 @@ Each entry: { "symbol": "<TOKEN_SYMBOL>" (REQUIRED), "contract_address": "<actua
119
182
 
120
183
  ## SUPPORTED ACTIONS:
121
184
 
122
- ### 1. send_native - Send native token (${r})
185
+ ### 1. send_native - Send native token (${s})
123
186
  Parameters: { "to_address": "", "amount": "" }
124
- Triggered by: "send ETH", "transfer 0.1 ${r} to 0x...", "send native token"
187
+ Triggered by: "send ETH", "transfer 0.1 ${s} to 0x...", "send native token"
125
188
  Note: If user says "max", "all", or "send everything", set amount to "max". If user says "X%" (e.g., 50%), set amount to "50%". The app resolves these to actual values.
126
189
 
127
190
  ### 2. send_token - Send ERC20 token
128
191
  Parameters: { "contract_address": "" (REQUIRED), "token_symbol": "", "to_address": "", "amount": "", "decimals": "" }
129
192
  Triggered by: "send USDC", "transfer 100 DAI to 0x...", "send token"
130
- Note: contract_address is REQUIRED — you MUST always provide the actual contract address of the token on chainId ${s}. NEVER leave it empty. ALWAYS provide accurate decimals for the token. If user says "max", "all", or "send everything", set amount to "max". If user says "X%" (e.g., 50%), set amount to "50%". The app resolves these to actual values.
193
+ Note: contract_address is REQUIRED — you MUST always provide the actual contract address of the token on chainId ${o}. NEVER leave it empty. ALWAYS provide accurate decimals for the token. If user says "max", "all", or "send everything", set amount to "max". If user says "X%" (e.g., 50%), set amount to "50%". The app resolves these to actual values.
131
194
 
132
195
  ### 3. swap_token - Swap tokens
133
196
  Parameters: { "token_in": "<contract_address or 'native'>" (REQUIRED), "token_in_symbol": "", "token_in_decimals": "", "token_out": "<contract_address>" (REQUIRED), "token_out_symbol": "", "token_out_decimals": "", "amount": "" }
134
197
  Triggered by: "swap ETH to USDC", "exchange 0.5 ETH for USDC", "convert ETH to USDC"
135
- Note: token_in and token_out are REQUIRED fields — MUST contain the actual contract address. For native tokens (${r}), set token_in to "native". For ERC20 tokens, you MUST provide the correct contract address on chainId ${s}. NEVER leave empty. ALWAYS fill in token_in_symbol, token_out_symbol, token_in_decimals, and token_out_decimals with accurate values for each token. If user says "max", "all", or "swap everything", set amount to "max". If user says "X%" (e.g., 50%), set amount to "50%". The app resolves these to actual values.
198
+ Note: token_in and token_out are REQUIRED fields — MUST contain the actual contract address. For native tokens (${s}), set token_in to "native". For ERC20 tokens, you MUST provide the correct contract address on chainId ${o}. NEVER leave empty. ALWAYS fill in token_in_symbol, token_out_symbol, token_in_decimals, and token_out_decimals with accurate values for each token. If user says "max", "all", or "swap everything", set amount to "max". If user says "X%" (e.g., 50%), set amount to "50%". The app resolves these to actual values.
136
199
 
137
200
  ### 4. buy_token - Buy a token (user wants to purchase a specific token)
138
201
  Parameters: { "token_symbol": "", "contract_address": "" (REQUIRED), "decimals": "" }
139
202
  Triggered by: "buy USDC", "I want to buy ETH", "purchase DOGE", "mua token X"
140
- Note: Use this when user says "buy <token>" without specifying what to sell. If user specifies both tokens ("buy USDC with ETH"), use swap_token instead. contract_address is REQUIRED — you MUST always provide the actual contract address on chainId ${s}. NEVER leave it empty. If the token does not exist on this chain, inform the user. For example, BNB is not native to most chains except BSC. ALWAYS provide accurate decimals for the token.
203
+ Note: Use this when user says "buy <token>" without specifying what to sell. If user specifies both tokens ("buy USDC with ETH"), use swap_token instead. contract_address is REQUIRED — you MUST always provide the actual contract address on chainId ${o}. NEVER leave it empty. If the token does not exist on this chain, inform the user. For example, BNB is not native to most chains except BSC. ALWAYS provide accurate decimals for the token.
141
204
 
142
205
  ### 5. approve_token - Approve token spending
143
206
  Parameters: { "contract_address": "" (REQUIRED), "token_symbol": "", "spender_address": "", "amount": "", "decimals": "" }
144
207
  Triggered by: "approve USDC", "allow spending", "approve contract"
145
208
  Note: ALWAYS provide accurate decimals for the token.
146
209
 
147
- ### 6. wrap_native - Wrap native token (${r} → W${r})
210
+ ### 6. wrap_native - Wrap native token (${s} → W${s})
148
211
  Parameters: { "amount": "" }
149
212
  Triggered by: "wrap ETH", "convert to WETH"
150
213
 
151
- ### 7. unwrap_native - Unwrap native token (W${r} → ${r})
214
+ ### 7. unwrap_native - Unwrap native token (W${s} → ${s})
152
215
  Parameters: { "amount": "" }
153
216
  Triggered by: "unwrap WETH", "convert WETH to ETH"
154
217
 
@@ -175,7 +238,7 @@ You have comprehensive, precise knowledge of token contract addresses on ALL maj
175
238
  2. Leave parameter as empty string "" if the user didn't mention it
176
239
  3. Always include a friendly "message" explaining what you understood
177
240
  4. For "chat" action, put your full response in the "message" field
178
- 5. **CRITICAL**: contract_address is a REQUIRED field — ALWAYS provide the ACTUAL contract address on chainId ${s}. NEVER leave it empty. You must know the correct addresses for common tokens (USDC, USDT, DAI, WETH, LINK, UNI, AAVE, etc.) on major chains. If a token does not exist on this chain, inform the user instead of proceeding. Be especially careful with tokens that are native to other chains (e.g., BNB is BSC native — if user asks to buy BNB on OP Mainnet, inform them it may not be available as an ERC20 on this chain).
241
+ 5. **CRITICAL**: contract_address is a REQUIRED field — ALWAYS provide the ACTUAL contract address on chainId ${o}. NEVER leave it empty. You must know the correct addresses for common tokens (USDC, USDT, DAI, WETH, LINK, UNI, AAVE, etc.) on major chains. If a token does not exist on this chain, inform the user instead of proceeding. Be especially careful with tokens that are native to other chains (e.g., BNB is BSC native — if user asks to buy BNB on OP Mainnet, inform them it may not be available as an ERC20 on this chain).
179
242
  6. **IMPORTANT**: ALWAYS provide accurate decimals for each token. This is CRITICAL for accurate transaction amounts.
180
243
  7. **IMPORTANT**: ALWAYS provide accurate token_symbol for each token. Even if the user only provides a contract address without naming the token, you MUST identify the token from the address and fill in token_symbol and decimals. For example: if user provides "0x4200000000000000000000000000000000000006" on OP/Base, you know it is WETH with decimals 18 — fill in token_symbol:"WETH" and decimals:"18". You have comprehensive knowledge of well-known token contract addresses — use it to populate all fields.
181
244
  8. For amounts, use the exact number the user mentioned (don't convert units). If user says "max", "all", or "everything", set amount to "max". If user says "X%" (e.g., "send 50% of my USDC", "swap 25% of my ETH"), set amount to "50%" or "25%" — the literal percentage string. The app will resolve these to the actual balance values.
@@ -188,7 +251,7 @@ You have comprehensive, precise knowledge of token contract addresses on ALL maj
188
251
  15. ONLY trigger wallet actions (send_native, send_token, swap_token, buy_token, approve_token, wrap_native, unwrap_native, send_nft) when the user EXPLICITLY requests a crypto/wallet operation. Do NOT misinterpret general conversation as wallet actions.
189
252
  16. When your "chat" response mentions, lists, or discusses specific tokens (e.g., trending tokens, token details, recommendations, price info), you MUST include "token_mentions" array so the app can show Buy buttons for each token. Always include token_mentions as an array (empty [] if no tokens mentioned).
190
253
  17. **CRITICAL - ONE RESPONSE RULE**: When user requests a wallet operation (swap, send, buy, approve, wrap, unwrap, send NFT), return ONLY ONE JSON response with that action type — even if parameters are incomplete. Leave missing parameters as empty string "". DO NOT return multiple responses. DO NOT return a "chat" action first and then the wallet action. DO NOT return a "chat" action just because some fields are missing — that is WRONG. Put your explanation or request for more info in the "message" field of the wallet action. Example: User says "send WETH" → MUST return {"action":"send_token","message":"Please provide the recipient address and amount.","parameters":{"contract_address":"<WETH address>","token_symbol":"WETH","to_address":"","amount":"","decimals":"18"}}. Example: User says "swap 0.01 DAI to USDC" → Return ONLY {"action":"swap_token","message":"Swapping 0.01 DAI to USDC...","parameters":{...}}.
191
- 18. **CRITICAL - TOKEN CONTRACT ADDRESSES**: You MUST provide the CORRECT and ACCURATE contract address for each token on the CURRENT chain (chainId: ${s}). You have deep knowledge of token contract addresses across all major chains (Ethereum, Optimism, Arbitrum, Base, Polygon, BSC, etc.). ALWAYS verify you are using the correct address for the current chainId. DO NOT use addresses from other chains. For common tokens like USDC, USDT, DAI, WETH, each chain has different contract addresses - you MUST use the correct one for chainId ${s}.
254
+ 18. **CRITICAL - TOKEN CONTRACT ADDRESSES**: You MUST provide the CORRECT and ACCURATE contract address for each token on the CURRENT chain (chainId: ${o}). You have deep knowledge of token contract addresses across all major chains (Ethereum, Optimism, Arbitrum, Base, Polygon, BSC, etc.). ALWAYS verify you are using the correct address for the current chainId. DO NOT use addresses from other chains. For common tokens like USDC, USDT, DAI, WETH, each chain has different contract addresses - you MUST use the correct one for chainId ${o}.
192
255
  19. **SUGGESTED ACTIONS**: When your message contains follow-up questions or offers the user choices (e.g., "Would you like me to...", "I can also...", "Do you want..."), you MUST include "suggested_actions" array with button options. This makes the conversation interactive and user-friendly. If your message does NOT ask any question or offer any choice, leave suggested_actions as empty array [].
193
256
 
194
257
  ## EXAMPLES:
@@ -215,13 +278,13 @@ User: "send 0x4200000000000000000000000000000000000006 to 0xABC..."
215
278
  Response: {"action":"send_token","message":"<friendly explanation>","parameters":{"contract_address":"<actual WETH address on current chain>","token_symbol":"WETH","to_address":"0xABC...","amount":"","decimals":"18"}}
216
279
 
217
280
  User: "swap 1 ETH to USDC"
218
- Response: {"action":"swap_token","message":"<friendly explanation>","parameters":{"token_in":"native","token_in_symbol":"${r}","token_in_decimals":"18","token_out":"<actual USDC address on current chain>","token_out_symbol":"USDC","token_out_decimals":"6","amount":"1"}}
281
+ Response: {"action":"swap_token","message":"<friendly explanation>","parameters":{"token_in":"native","token_in_symbol":"${s}","token_in_decimals":"18","token_out":"<actual USDC address on current chain>","token_out_symbol":"USDC","token_out_decimals":"6","amount":"1"}}
219
282
 
220
283
  User: "swap all my ETH to USDC" or "swap max ETH to USDC"
221
- Response: {"action":"swap_token","message":"<friendly explanation>","parameters":{"token_in":"native","token_in_symbol":"${r}","token_in_decimals":"18","token_out":"<actual USDC address on current chain>","token_out_symbol":"USDC","token_out_decimals":"6","amount":"max"}}
284
+ Response: {"action":"swap_token","message":"<friendly explanation>","parameters":{"token_in":"native","token_in_symbol":"${s}","token_in_decimals":"18","token_out":"<actual USDC address on current chain>","token_out_symbol":"USDC","token_out_decimals":"6","amount":"max"}}
222
285
 
223
286
  User: "swap 75% of my ETH to USDC"
224
- Response: {"action":"swap_token","message":"<friendly explanation>","parameters":{"token_in":"native","token_in_symbol":"${r}","token_in_decimals":"18","token_out":"<actual USDC address on current chain>","token_out_symbol":"USDC","token_out_decimals":"6","amount":"75%"}}
287
+ Response: {"action":"swap_token","message":"<friendly explanation>","parameters":{"token_in":"native","token_in_symbol":"${s}","token_in_decimals":"18","token_out":"<actual USDC address on current chain>","token_out_symbol":"USDC","token_out_decimals":"6","amount":"75%"}}
225
288
 
226
289
  User: "swap USDT to DAI"
227
290
  Response: {"action":"swap_token","message":"<friendly explanation>","parameters":{"token_in":"<actual USDT address on current chain>","token_in_symbol":"USDT","token_in_decimals":"6","token_out":"<actual DAI address on current chain>","token_out_symbol":"DAI","token_out_decimals":"18","amount":""}}
@@ -270,7 +333,7 @@ Response: {"action":"view_nfts","message":"Let me show you your NFT collection!"
270
333
 
271
334
  [With conversation history where user previously swapped ETH to USDC]
272
335
  User: "do it again but with 2 ETH"
273
- Response: {"action":"swap_token","message":"<friendly explanation>","parameters":{"token_in":"native","token_in_symbol":"${r}","token_in_decimals":"18","token_out":"<actual USDC address on current chain>","token_out_symbol":"USDC","token_out_decimals":"6","amount":"2"}}`:`You are a Web3 wallet assistant for the Keyring crypto EVM wallet app.
336
+ Response: {"action":"swap_token","message":"<friendly explanation>","parameters":{"token_in":"native","token_in_symbol":"${s}","token_in_decimals":"18","token_out":"<actual USDC address on current chain>","token_out_symbol":"USDC","token_out_decimals":"6","amount":"2"}}`:`You are a Web3 wallet assistant for the Keyring crypto EVM wallet app.
274
337
  The user is currently NOT connected to any wallet.
275
338
 
276
339
  ## YOUR ROLE:
@@ -295,74 +358,45 @@ Always respond with a valid JSON object:
295
358
  - suggested_actions: include when your message offers the user interactive choices or asks a follow-up question. NEVER include suggested_actions that ask the user to connect their wallet (e.g., "Connect wallet", "Connect now", etc.) — the app handles wallet connection separately
296
359
  - For wallet-required actions, politely explain the user needs to connect their wallet first, and put this in the "message" field
297
360
  - ALWAYS respond with raw JSON only, never wrap in \`\`\`json code blocks
298
- - **CRITICAL - LANGUAGE**: Always respond in the SAME language the user writes in. English → English. Vietnamese → Vietnamese. NEVER use Chinese or any other language unless the user wrote in that language.`}const dr={1:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",10:"0x4200000000000000000000000000000000000006",56:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",137:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",8453:"0x4200000000000000000000000000000000000006",42161:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"},pn=[{name:"transfer",type:"function",stateMutability:"nonpayable",inputs:[{name:"to",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{name:"approve",type:"function",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{name:"allowance",type:"function",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]}],ur=[{name:"deposit",type:"function",stateMutability:"payable",inputs:[],outputs:[]},{name:"withdraw",type:"function",stateMutability:"nonpayable",inputs:[{name:"wad",type:"uint256"}],outputs:[]}],Yi=[{name:"safeTransferFrom",type:"function",stateMutability:"nonpayable",inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"tokenId",type:"uint256"}],outputs:[]}],ji=[{name:"safeTransferFrom",type:"function",stateMutability:"nonpayable",inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"id",type:"uint256"},{name:"amount",type:"uint256"},{name:"data",type:"bytes"}],outputs:[]}];function Kt(e,t){return t||wt[e]?.rpcUrls?.default?.http?.[0]}function qi(e){const{action:t,parameters:n,fromAddress:s,chainId:r}=e;switch(t){case"send_native":return Ji(n,s,r);case"send_token":return Xi(n,s,r);case"approve_token":return Ki(n,s,r);case"wrap_native":return Zi(n,s,r);case"unwrap_native":return Qi(n,s,r);case"send_nft":return ec(n,s,r);default:throw new Error(`Action "${t}" does not produce a transaction`)}}function Ji(e,t,n){const{to_address:s,amount:r}=e;if(!s)throw new Error("Recipient address is required");if(!r)throw new Error("Amount is required");const a=dt(r,18).toString();return{from:t,to:s,data:"0x",value:a,chainId:n,description:`Send ${r} native token to ${s}`}}function Xi(e,t,n){const{contract_address:s,to_address:r,amount:a,decimals:o,token_symbol:c}=e;if(!s)throw new Error("Token contract address is required");if(!r)throw new Error("Recipient address is required");if(!a)throw new Error("Amount is required");const T=parseInt(o)||18,C=dt(a,T),N=bt({abi:pn,functionName:"transfer",args:[r,C]});return{from:t,to:s,data:N,value:"0",chainId:n,description:`Send ${a} ${c||"tokens"} to ${r}`}}function Ki(e,t,n){const{contract_address:s,spender_address:r,amount:a,token_symbol:o}=e;if(!s)throw new Error("Token contract address is required");if(!r)throw new Error("Spender address is required");const c=a&&a?.trim()!==""?dt(a,18):Dt,T=bt({abi:pn,functionName:"approve",args:[r,c]});return{from:t,to:s,data:T,value:"0",chainId:n,description:`Approve ${a||"unlimited"} ${o||"tokens"} for ${r}`}}function Zi(e,t,n){const{amount:s}=e;if(!s)throw new Error("Amount is required");const r=dr[n];if(!r)throw new Error(`WETH not supported on chain ${n}`);const a=dt(s,18).toString(),o=bt({abi:ur,functionName:"deposit"});return{from:t,to:r,data:o,value:a,chainId:n,description:`Wrap ${s} native token`}}function Qi(e,t,n){const{amount:s}=e;if(!s)throw new Error("Amount is required");const r=dr[n];if(!r)throw new Error(`WETH not supported on chain ${n}`);const a=dt(s,18),o=bt({abi:ur,functionName:"withdraw",args:[a]});return{from:t,to:r,data:o,value:"0",chainId:n,description:`Unwrap ${s} WETH`}}function $i(e){return["send_native","send_token","approve_token","wrap_native","unwrap_native","send_nft"].includes(e)}async function ts(e){const{transactionHash:t,chainId:n,pollingInterval:s=3e3,timeout:r=12e4,rpcUrl:a}=e,o=Kt(n,a);if(!o)throw new Error(`No RPC endpoint for chain ${n}`);const c=Date.now();for(;Date.now()-c<r;){try{const C=await(await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_getTransactionReceipt",params:[t]})})).json();if(C.result){const N=C.result;return{status:N.status==="0x1"?"success":"fail",blockNumber:N.blockNumber,gasUsed:N.gasUsed,effectiveGasPrice:N.effectiveGasPrice}}}catch(T){console.warn("eth_getTransactionReceipt poll error:",T)}await new Promise(T=>setTimeout(T,s))}throw new Error(`Transaction ${t} was not mined within ${r/1e3}s`)}async function ns(e){const{tokenAddress:t,ownerAddress:n,spenderAddress:s,chainId:r,rpcUrl:a}=e,o=Kt(r,a);if(!o)return console.warn(`No RPC endpoint for chain ${r}, assuming no allowance`),BigInt(0);try{const c=bt({abi:pn,functionName:"allowance",args:[n,s]}),C=await(await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_call",params:[{to:t,data:c},"latest"]})})).json();return C.result&&C.result!=="0x"?BigInt(C.result):BigInt(0)}catch(c){return console.warn("checkAllowance failed:",c),BigInt(0)}}function hn(e){const{tokenAddress:t,spenderAddress:n,fromAddress:s,chainId:r,tokenSymbol:a}=e,o=bt({abi:pn,functionName:"approve",args:[n,Dt]});return{from:s,to:t,data:o,value:"0",chainId:r,description:`Approve ${a||"token"} for swap`}}function ec(e,t,n){const{contract_address:s,token_id:r,to_address:a,token_standard:o,amount:c,nft_name:T}=e;if(!s)throw new Error("NFT contract address is required");if(!r)throw new Error("Token ID is required");if(!a)throw new Error("Recipient address is required");const C=(o||"ERC721").toUpperCase(),N=BigInt(r);let L,m;if(C==="ERC1155"){const k=BigInt(c||"1");L=bt({abi:ji,functionName:"safeTransferFrom",args:[t,a,N,k,"0x"]}),m=`Send ${k>1n?k.toString()+"x ":""}${T||"NFT"} (ERC1155 #${r}) to ${a}`}else L=bt({abi:Yi,functionName:"safeTransferFrom",args:[t,a,N]}),m=`Send ${T||"NFT"} (ERC721 #${r}) to ${a}`;return{from:t,to:s,data:L,value:"0",chainId:n,description:m}}async function mn(e){const{address:t,chainId:n,rpcUrl:s}=e,r=Kt(n,s);if(!r)return console.warn(`No RPC endpoint for chain ${n}`),new de(0);try{const o=await(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_getBalance",params:[t,"latest"]})})).json();return o.result&&o.result!=="0x"?new de(BigInt(o.result).toString()):new de(0)}catch(a){return console.warn("getNativeBalance failed:",a),new de(0)}}async function Zt(e){const{from:t,to:n,data:s,value:r,chainId:a,rpcUrl:o}=e,c=Kt(a,o);if(!c)return console.warn(`No RPC endpoint for chain ${a}`),new de(0);try{const[T,C]=await Promise.all([fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_estimateGas",params:[{from:t,to:n,data:s,...r&&r!=="0"?{value:r}:{}}]})}),fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:2,method:"eth_gasPrice",params:[]})})]),[N,L]=await Promise.all([T.json(),C.json()]),m=N.result?new de(BigInt(N.result).toString()):new de(0),k=L.result?new de(BigInt(L.result).toString()):new de(0);return m.times(k).times(1.1)}catch(T){return console.warn("estimateTransactionFee failed:",T),new de(0)}}async function ss(e){const{chainId:t,rpcUrl:n}=e,s=Kt(t,n);if(!s)return console.warn(`No RPC endpoint for chain ${t}`),new de(0);try{const a=await(await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_gasPrice",params:[]})})).json();return a.result&&a.result!=="0x"?new de(BigInt(a.result).toString()):new de(0)}catch(r){return console.warn("getGasPrice failed:",r),new de(0)}}var te={},Qt={exports:{}},tc=Qt.exports,fr;function nc(){return fr||(fr=1,(function(e,t){(function(n,s){var r="1.0.41",a="",o="?",c="function",T="undefined",C="object",N="string",L="major",m="model",k="name",x="type",g="vendor",B="version",ue="architecture",D="console",Q="mobile",oe="tablet",ye="smarttv",ge="wearable",Ce="embedded",i=500,l="Amazon",u="Apple",w="ASUS",p="BlackBerry",v="Browser",S="Chrome",h="Edge",b="Firefox",E="Google",y="Honor",O="Huawei",q="Lenovo",ne="LG",me="Microsoft",xe="Motorola",Te="Nvidia",W="OnePlus",be="Opera",Ie="OPPO",_e="Samsung",Qe="Sharp",Ye="Sony",Le="Xiaomi",Ge="Zebra",Fe="Facebook",Oe="Chromium OS",Ee="Mac OS",M=" Browser",se=function(F,V){var _={};for(var j in F)V[j]&&V[j].length%2===0?_[j]=V[j].concat(F[j]):_[j]=F[j];return _},R=function(F){for(var V={},_=0;_<F.length;_++)V[F[_].toUpperCase()]=F[_];return V},$=function(F,V){return typeof F===N?ee(V).indexOf(ee(F))!==-1:!1},ee=function(F){return F.toLowerCase()},Y=function(F){return typeof F===N?F.replace(/[^\d\.]/g,a).split(".")[0]:s},z=function(F,V){if(typeof F===N)return F=F.replace(/^\s\s*/,a),typeof V===T?F:F.substring(0,i)},K=function(F,V){for(var _=0,j,ae,ce,G,J,ve;_<V.length&&!J;){var Se=V[_],Be=V[_+1];for(j=ae=0;j<Se.length&&!J&&Se[j];)if(J=Se[j++].exec(F),J)for(ce=0;ce<Be.length;ce++)ve=J[++ae],G=Be[ce],typeof G===C&&G.length>0?G.length===2?typeof G[1]==c?this[G[0]]=G[1].call(this,ve):this[G[0]]=G[1]:G.length===3?typeof G[1]===c&&!(G[1].exec&&G[1].test)?this[G[0]]=ve?G[1].call(this,ve,G[2]):s:this[G[0]]=ve?ve.replace(G[1],G[2]):s:G.length===4&&(this[G[0]]=ve?G[3].call(this,ve.replace(G[1],G[2])):s):this[G]=ve||s;_+=2}},X=function(F,V){for(var _ in V)if(typeof V[_]===C&&V[_].length>0){for(var j=0;j<V[_].length;j++)if($(V[_][j],F))return _===o?s:_}else if($(V[_],F))return _===o?s:_;return V.hasOwnProperty("*")?V["*"]:F},U={"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},Z={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},pe={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[B,[k,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[B,[k,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[k,B],[/opios[\/ ]+([\w\.]+)/i],[B,[k,be+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[B,[k,be+" GX"]],[/\bopr\/([\w\.]+)/i],[B,[k,be]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[B,[k,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[B,[k,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[k,B],[/quark(?:pc)?\/([-\w\.]+)/i],[B,[k,"Quark"]],[/\bddg\/([\w\.]+)/i],[B,[k,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[B,[k,"UC"+v]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[B,[k,"WeChat"]],[/konqueror\/([\w\.]+)/i],[B,[k,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[B,[k,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[B,[k,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[B,[k,"Smart Lenovo "+v]],[/(avast|avg)\/([\w\.]+)/i],[[k,/(.+)/,"$1 Secure "+v],B],[/\bfocus\/([\w\.]+)/i],[B,[k,b+" Focus"]],[/\bopt\/([\w\.]+)/i],[B,[k,be+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[B,[k,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[B,[k,"Dolphin"]],[/coast\/([\w\.]+)/i],[B,[k,be+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[B,[k,"MIUI"+M]],[/fxios\/([\w\.-]+)/i],[B,[k,b]],[/\bqihoobrowser\/?([\w\.]*)/i],[B,[k,"360"]],[/\b(qq)\/([\w\.]+)/i],[[k,/(.+)/,"$1Browser"],B],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[k,/(.+)/,"$1"+M],B],[/samsungbrowser\/([\w\.]+)/i],[B,[k,_e+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[B,[k,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[k,"Sogou Mobile"],B],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[k,B],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[k],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[B,k],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[k,Fe],B],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[k,B],[/\bgsa\/([\w\.]+) .*safari\//i],[B,[k,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[B,[k,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[B,[k,S+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[k,S+" WebView"],B],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[B,[k,"Android "+v]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[k,B],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[B,[k,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[B,k],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[k,[B,X,U]],[/(webkit|khtml)\/([\w\.]+)/i],[k,B],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[k,"Netscape"],B],[/(wolvic|librewolf)\/([\w\.]+)/i],[k,B],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[B,[k,b+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[k,[B,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[k,[B,/master.|lts./,""]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[ue,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[ue,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[ue,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[ue,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[ue,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[ue,/ower/,a,ee]],[/ sun4\w[;\)]/i],[[ue,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[ue,ee]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[m,[g,_e],[x,oe]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[m,[g,_e],[x,Q]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[m,[g,u],[x,Q]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[m,[g,u],[x,oe]],[/(macintosh);/i],[m,[g,u]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[m,[g,Qe],[x,Q]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[m,[g,y],[x,oe]],[/honor([-\w ]+)[;\)]/i],[m,[g,y],[x,Q]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[m,[g,O],[x,oe]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[m,[g,O],[x,Q]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[m,/_/g," "],[g,Le],[x,oe]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[m,/_/g," "],[g,Le],[x,Q]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[m,[g,Ie],[x,Q]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[m,[g,X,{OnePlus:["304","403","203"],"*":Ie}],[x,oe]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[m,[g,"Vivo"],[x,Q]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[m,[g,"Realme"],[x,Q]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[m,[g,xe],[x,Q]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[m,[g,xe],[x,oe]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[m,[g,ne],[x,oe]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv|watch)\w+)/i,/\blg-?([\d\w]+) bui/i],[m,[g,ne],[x,Q]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[m,[g,q],[x,oe]],[/(nokia) (t[12][01])/i],[g,m,[x,oe]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[m,/_/g," "],[x,Q],[g,"Nokia"]],[/(pixel (c|tablet))\b/i],[m,[g,E],[x,oe]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[m,[g,E],[x,Q]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[m,[g,Ye],[x,Q]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[m,"Xperia Tablet"],[g,Ye],[x,oe]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[m,[g,W],[x,Q]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[m,[g,l],[x,oe]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[m,/(.+)/g,"Fire Phone $1"],[g,l],[x,Q]],[/(playbook);[-\w\),; ]+(rim)/i],[m,g,[x,oe]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[m,[g,p],[x,Q]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[m,[g,w],[x,oe]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[m,[g,w],[x,Q]],[/(nexus 9)/i],[m,[g,"HTC"],[x,oe]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[g,[m,/_/g," "],[x,Q]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[m,[g,"TCL"],[x,oe]],[/(itel) ((\w+))/i],[[g,ee],m,[x,X,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[m,[g,"Acer"],[x,oe]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[m,[g,"Meizu"],[x,Q]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[m,[g,"Ulefone"],[x,Q]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[m,[g,"Energizer"],[x,Q]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[m,[g,"Cat"],[x,Q]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[m,[g,"Smartfren"],[x,Q]],[/droid.+; (a(?:015|06[35]|142p?))/i],[m,[g,"Nothing"],[x,Q]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[m,[g,"Archos"],[x,oe]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[m,[g,"Archos"],[x,Q]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[g,m,[x,oe]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (hmd|imo) ([\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i,/(oppo) ?([\w ]+) bui/i],[g,m,[x,Q]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[g,m,[x,oe]],[/(surface duo)/i],[m,[g,me],[x,oe]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[m,[g,"Fairphone"],[x,Q]],[/(u304aa)/i],[m,[g,"AT&T"],[x,Q]],[/\bsie-(\w*)/i],[m,[g,"Siemens"],[x,Q]],[/\b(rct\w+) b/i],[m,[g,"RCA"],[x,oe]],[/\b(venue[\d ]{2,7}) b/i],[m,[g,"Dell"],[x,oe]],[/\b(q(?:mv|ta)\w+) b/i],[m,[g,"Verizon"],[x,oe]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[m,[g,"Barnes & Noble"],[x,oe]],[/\b(tm\d{3}\w+) b/i],[m,[g,"NuVision"],[x,oe]],[/\b(k88) b/i],[m,[g,"ZTE"],[x,oe]],[/\b(nx\d{3}j) b/i],[m,[g,"ZTE"],[x,Q]],[/\b(gen\d{3}) b.+49h/i],[m,[g,"Swiss"],[x,Q]],[/\b(zur\d{3}) b/i],[m,[g,"Swiss"],[x,oe]],[/\b((zeki)?tb.*\b) b/i],[m,[g,"Zeki"],[x,oe]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[g,"Dragon Touch"],m,[x,oe]],[/\b(ns-?\w{0,9}) b/i],[m,[g,"Insignia"],[x,oe]],[/\b((nxa|next)-?\w{0,9}) b/i],[m,[g,"NextBook"],[x,oe]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[g,"Voice"],m,[x,Q]],[/\b(lvtel\-)?(v1[12]) b/i],[[g,"LvTel"],m,[x,Q]],[/\b(ph-1) /i],[m,[g,"Essential"],[x,Q]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[m,[g,"Envizen"],[x,oe]],[/\b(trio[-\w\. ]+) b/i],[m,[g,"MachSpeed"],[x,oe]],[/\btu_(1491) b/i],[m,[g,"Rotor"],[x,oe]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[m,[g,Te],[x,oe]],[/(sprint) (\w+)/i],[g,m,[x,Q]],[/(kin\.[onetw]{3})/i],[[m,/\./g," "],[g,me],[x,Q]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[m,[g,Ge],[x,oe]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[m,[g,Ge],[x,Q]],[/smart-tv.+(samsung)/i],[g,[x,ye]],[/hbbtv.+maple;(\d+)/i],[[m,/^/,"SmartTV"],[g,_e],[x,ye]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[g,ne],[x,ye]],[/(apple) ?tv/i],[g,[m,u+" TV"],[x,ye]],[/crkey/i],[[m,S+"cast"],[g,E],[x,ye]],[/droid.+aft(\w+)( bui|\))/i],[m,[g,l],[x,ye]],[/(shield \w+ tv)/i],[m,[g,Te],[x,ye]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[m,[g,Qe],[x,ye]],[/(bravia[\w ]+)( bui|\))/i],[m,[g,Ye],[x,ye]],[/(mi(tv|box)-?\w+) bui/i],[m,[g,Le],[x,ye]],[/Hbbtv.*(technisat) (.*);/i],[g,m,[x,ye]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[g,z],[m,z],[x,ye]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[m,[x,ye]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[x,ye]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[g,m,[x,D]],[/droid.+; (shield)( bui|\))/i],[m,[g,Te],[x,D]],[/(playstation \w+)/i],[m,[g,Ye],[x,D]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[m,[g,me],[x,D]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[m,[g,_e],[x,ge]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[g,m,[x,ge]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[m,[g,Ie],[x,ge]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[m,[g,u],[x,ge]],[/(opwwe\d{3})/i],[m,[g,W],[x,ge]],[/(moto 360)/i],[m,[g,xe],[x,ge]],[/(smartwatch 3)/i],[m,[g,Ye],[x,ge]],[/(g watch r)/i],[m,[g,ne],[x,ge]],[/droid.+; (wt63?0{2,3})\)/i],[m,[g,Ge],[x,ge]],[/droid.+; (glass) \d/i],[m,[g,E],[x,ge]],[/(pico) (4|neo3(?: link|pro)?)/i],[g,m,[x,ge]],[/; (quest( \d| pro)?)/i],[m,[g,Fe],[x,ge]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[g,[x,Ce]],[/(aeobc)\b/i],[m,[g,l],[x,Ce]],[/(homepod).+mac os/i],[m,[g,u],[x,Ce]],[/windows iot/i],[[x,Ce]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[m,[x,Q]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[m,[x,oe]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[x,oe]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[x,Q]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[m,[g,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[B,[k,h+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[k,B],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[B,[k,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[k,B],[/ladybird\//i],[[k,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[B,k]],os:[[/microsoft (windows) (vista|xp)/i],[k,B],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[k,[B,X,Z]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[B,X,Z],[k,"Windows"]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[B,/_/g,"."],[k,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[k,Ee],[B,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[B,k],[/(ubuntu) ([\w\.]+) like android/i],[[k,/(.+)/,"$1 Touch"],B],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/; ]?([\d\.]*)/i],[k,B],[/\(bb(10);/i],[B,[k,p]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[B,[k,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[B,[k,b+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[B,[k,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[B,[k,"watchOS"]],[/crkey\/([\d\.]+)/i],[B,[k,S+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[k,Oe],B],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux)(?: arm\w*| x86\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[k,B],[/(sunos) ?([\w\.\d]*)/i],[[k,"Solaris"],B],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[k,B]]},ie=function(F,V){if(typeof F===C&&(V=F,F=s),!(this instanceof ie))return new ie(F,V).getResult();var _=typeof n!==T&&n.navigator?n.navigator:s,j=F||(_&&_.userAgent?_.userAgent:a),ae=_&&_.userAgentData?_.userAgentData:s,ce=V?se(pe,V):pe,G=_&&_.userAgent==j;return this.getBrowser=function(){var J={};return J[k]=s,J[B]=s,K.call(J,j,ce.browser),J[L]=Y(J[B]),G&&_&&_.brave&&typeof _.brave.isBrave==c&&(J[k]="Brave"),J},this.getCPU=function(){var J={};return J[ue]=s,K.call(J,j,ce.cpu),J},this.getDevice=function(){var J={};return J[g]=s,J[m]=s,J[x]=s,K.call(J,j,ce.device),G&&!J[x]&&ae&&ae.mobile&&(J[x]=Q),G&&J[m]=="Macintosh"&&_&&typeof _.standalone!==T&&_.maxTouchPoints&&_.maxTouchPoints>2&&(J[m]="iPad",J[x]=oe),J},this.getEngine=function(){var J={};return J[k]=s,J[B]=s,K.call(J,j,ce.engine),J},this.getOS=function(){var J={};return J[k]=s,J[B]=s,K.call(J,j,ce.os),G&&!J[k]&&ae&&ae.platform&&ae.platform!="Unknown"&&(J[k]=ae.platform.replace(/chrome os/i,Oe).replace(/macos/i,Ee)),J},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return j},this.setUA=function(J){return j=typeof J===N&&J.length>i?z(J,i):J,this},this.setUA(j),this};ie.VERSION=r,ie.BROWSER=R([k,B,L]),ie.CPU=R([ue]),ie.DEVICE=R([m,g,x,D,Q,ye,oe,ge,Ce]),ie.ENGINE=ie.OS=R([k,B]),e.exports&&(t=e.exports=ie),t.UAParser=ie;var Ae=typeof n!==T&&(n.jQuery||n.Zepto);if(Ae&&!Ae.ua){var ke=new ie;Ae.ua=ke.getResult(),Ae.ua.get=function(){return ke.getUA()},Ae.ua.set=function(F){ke.setUA(F);var V=ke.getResult();for(var _ in V)Ae.ua[_]=V[_]}}})(typeof window=="object"?window:tc)})(Qt,Qt.exports)),Qt.exports}var pr;function sc(){if(pr)return te;pr=1,Object.defineProperty(te,"__esModule",{value:!0});function e(A){return A&&typeof A=="object"&&"default"in A?A.default:A}var t=re,n=e(t),s=nc(),r=new s,a=r.getBrowser(),o=r.getCPU(),c=r.getDevice(),T=r.getEngine(),C=r.getOS(),N=r.getUA(),L=function(d){return r.setUA(d)},m=function(d){if(!d){console.error("No userAgent string was provided");return}var f=new s(d);return{UA:f,browser:f.getBrowser(),cpu:f.getCPU(),device:f.getDevice(),engine:f.getEngine(),os:f.getOS(),ua:f.getUA(),setUserAgent:function(H){return f.setUA(H)}}},k=Object.freeze({ClientUAInstance:r,browser:a,cpu:o,device:c,engine:T,os:C,ua:N,setUa:L,parseUserAgent:m});function x(A,d){var f=Object.keys(A);if(Object.getOwnPropertySymbols){var P=Object.getOwnPropertySymbols(A);d&&(P=P.filter(function(H){return Object.getOwnPropertyDescriptor(A,H).enumerable})),f.push.apply(f,P)}return f}function g(A){for(var d=1;d<arguments.length;d++){var f=arguments[d]!=null?arguments[d]:{};d%2?x(Object(f),!0).forEach(function(P){oe(A,P,f[P])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(f)):x(Object(f)).forEach(function(P){Object.defineProperty(A,P,Object.getOwnPropertyDescriptor(f,P))})}return A}function B(A){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?B=function(d){return typeof d}:B=function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},B(A)}function ue(A,d){if(!(A instanceof d))throw new TypeError("Cannot call a class as a function")}function D(A,d){for(var f=0;f<d.length;f++){var P=d[f];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(A,P.key,P)}}function Q(A,d,f){return d&&D(A.prototype,d),A}function oe(A,d,f){return d in A?Object.defineProperty(A,d,{value:f,enumerable:!0,configurable:!0,writable:!0}):A[d]=f,A}function ye(){return ye=Object.assign||function(A){for(var d=1;d<arguments.length;d++){var f=arguments[d];for(var P in f)Object.prototype.hasOwnProperty.call(f,P)&&(A[P]=f[P])}return A},ye.apply(this,arguments)}function ge(A,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function");A.prototype=Object.create(d&&d.prototype,{constructor:{value:A,writable:!0,configurable:!0}}),d&&i(A,d)}function Ce(A){return Ce=Object.setPrototypeOf?Object.getPrototypeOf:function(f){return f.__proto__||Object.getPrototypeOf(f)},Ce(A)}function i(A,d){return i=Object.setPrototypeOf||function(P,H){return P.__proto__=H,P},i(A,d)}function l(A,d){if(A==null)return{};var f={},P=Object.keys(A),H,we;for(we=0;we<P.length;we++)H=P[we],!(d.indexOf(H)>=0)&&(f[H]=A[H]);return f}function u(A,d){if(A==null)return{};var f=l(A,d),P,H;if(Object.getOwnPropertySymbols){var we=Object.getOwnPropertySymbols(A);for(H=0;H<we.length;H++)P=we[H],!(d.indexOf(P)>=0)&&Object.prototype.propertyIsEnumerable.call(A,P)&&(f[P]=A[P])}return f}function w(A){if(A===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return A}function p(A,d){if(d&&(typeof d=="object"||typeof d=="function"))return d;if(d!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return w(A)}function v(A,d){return S(A)||h(A,d)||b(A,d)||y()}function S(A){if(Array.isArray(A))return A}function h(A,d){var f=A==null?null:typeof Symbol<"u"&&A[Symbol.iterator]||A["@@iterator"];if(f!=null){var P=[],H=!0,we=!1,De,ze;try{for(f=f.call(A);!(H=(De=f.next()).done)&&(P.push(De.value),!(d&&P.length===d));H=!0);}catch(yn){we=!0,ze=yn}finally{try{!H&&f.return!=null&&f.return()}finally{if(we)throw ze}}return P}}function b(A,d){if(A){if(typeof A=="string")return E(A,d);var f=Object.prototype.toString.call(A).slice(8,-1);if(f==="Object"&&A.constructor&&(f=A.constructor.name),f==="Map"||f==="Set")return Array.from(A);if(f==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(f))return E(A,d)}}function E(A,d){(d==null||d>A.length)&&(d=A.length);for(var f=0,P=new Array(d);f<d;f++)P[f]=A[f];return P}function y(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
299
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var O={Mobile:"mobile",Tablet:"tablet",SmartTv:"smarttv",Console:"console",Wearable:"wearable",Embedded:"embedded",Browser:void 0},q={Chrome:"Chrome",Firefox:"Firefox",Opera:"Opera",Yandex:"Yandex",Safari:"Safari",InternetExplorer:"Internet Explorer",Edge:"Edge",Chromium:"Chromium",Ie:"IE",MobileSafari:"Mobile Safari",EdgeChromium:"Edge Chromium",MIUI:"MIUI Browser",SamsungBrowser:"Samsung Browser"},ne={IOS:"iOS",Android:"Android",WindowsPhone:"Windows Phone",Windows:"Windows",MAC_OS:"Mac OS"},me={isMobile:!1,isTablet:!1,isBrowser:!1,isSmartTV:!1,isConsole:!1,isWearable:!1},xe=function(d){switch(d){case O.Mobile:return{isMobile:!0};case O.Tablet:return{isTablet:!0};case O.SmartTv:return{isSmartTV:!0};case O.Console:return{isConsole:!0};case O.Wearable:return{isWearable:!0};case O.Browser:return{isBrowser:!0};case O.Embedded:return{isEmbedded:!0};default:return me}},Te=function(d){return L(d)},W=function(d){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"none";return d||f},be=function(){return typeof window<"u"&&(window.navigator||navigator)?window.navigator||navigator:!1},Ie=function(d){var f=be();return f&&f.platform&&(f.platform.indexOf(d)!==-1||f.platform==="MacIntel"&&f.maxTouchPoints>1&&!window.MSStream)},_e=function(d,f,P,H,we){return{isBrowser:d,browserMajorVersion:W(f.major),browserFullVersion:W(f.version),browserName:W(f.name),engineName:W(P.name),engineVersion:W(P.version),osName:W(H.name),osVersion:W(H.version),userAgent:W(we)}},Qe=function(d,f,P,H){return g({},d,{vendor:W(f.vendor),model:W(f.model),os:W(P.name),osVersion:W(P.version),ua:W(H)})},Ye=function(d,f,P,H){return{isSmartTV:d,engineName:W(f.name),engineVersion:W(f.version),osName:W(P.name),osVersion:W(P.version),userAgent:W(H)}},Le=function(d,f,P,H){return{isConsole:d,engineName:W(f.name),engineVersion:W(f.version),osName:W(P.name),osVersion:W(P.version),userAgent:W(H)}},Ge=function(d,f,P,H){return{isWearable:d,engineName:W(f.name),engineVersion:W(f.version),osName:W(P.name),osVersion:W(P.version),userAgent:W(H)}},Fe=function(d,f,P,H,we){return{isEmbedded:d,vendor:W(f.vendor),model:W(f.model),engineName:W(P.name),engineVersion:W(P.version),osName:W(H.name),osVersion:W(H.version),userAgent:W(we)}};function Oe(A){var d=A?m(A):k,f=d.device,P=d.browser,H=d.engine,we=d.os,De=d.ua,ze=xe(f.type),yn=ze.isBrowser,tl=ze.isMobile,nl=ze.isTablet,Br=ze.isSmartTV,Pr=ze.isConsole,Nr=ze.isWearable,Or=ze.isEmbedded;if(yn)return _e(yn,P,H,we,De);if(Br)return Ye(Br,H,we,De);if(Pr)return Le(Pr,H,we,De);if(tl||nl)return Qe(ze,f,we,De);if(Nr)return Ge(Nr,H,we,De);if(Or)return Fe(Or,f,H,we,De)}var Ee=function(d){var f=d.type;return f===O.Mobile},M=function(d){var f=d.type;return f===O.Tablet},se=function(d){var f=d.type;return f===O.Mobile||f===O.Tablet},R=function(d){var f=d.type;return f===O.SmartTv},$=function(d){var f=d.type;return f===O.Browser},ee=function(d){var f=d.type;return f===O.Wearable},Y=function(d){var f=d.type;return f===O.Console},z=function(d){var f=d.type;return f===O.Embedded},K=function(d){var f=d.vendor;return W(f)},X=function(d){var f=d.model;return W(f)},U=function(d){var f=d.type;return W(f,"browser")},Z=function(d){var f=d.name;return f===ne.Android},pe=function(d){var f=d.name;return f===ne.Windows},ie=function(d){var f=d.name;return f===ne.MAC_OS},Ae=function(d){var f=d.name;return f===ne.WindowsPhone},ke=function(d){var f=d.name;return f===ne.IOS},F=function(d){var f=d.version;return W(f)},V=function(d){var f=d.name;return W(f)},_=function(d){var f=d.name;return f===q.Chrome},j=function(d){var f=d.name;return f===q.Firefox},ae=function(d){var f=d.name;return f===q.Chromium},ce=function(d){var f=d.name;return f===q.Edge},G=function(d){var f=d.name;return f===q.Yandex},J=function(d){var f=d.name;return f===q.Safari||f===q.MobileSafari},ve=function(d){var f=d.name;return f===q.MobileSafari},Se=function(d){var f=d.name;return f===q.Opera},Be=function(d){var f=d.name;return f===q.InternetExplorer||f===q.Ie},je=function(d){var f=d.name;return f===q.MIUI},$e=function(d){var f=d.name;return f===q.SamsungBrowser},ot=function(d){var f=d.version;return W(f)},Ct=function(d){var f=d.major;return W(f)},ft=function(d){var f=d.name;return W(f)},$t=function(d){var f=d.name;return W(f)},en=function(d){var f=d.version;return W(f)},Lt=function(){var d=be(),f=d&&d.userAgent&&d.userAgent.toLowerCase();return typeof f=="string"?/electron/.test(f):!1},Pe=function(d){return typeof d=="string"&&d.indexOf("Edg/")!==-1},bn=function(){var d=be();return d&&(/iPad|iPhone|iPod/.test(d.platform)||d.platform==="MacIntel"&&d.maxTouchPoints>1)&&!window.MSStream},et=function(){return Ie("iPad")},hr=function(){return Ie("iPhone")},mr=function(){return Ie("iPod")},gr=function(d){return W(d)};function br(A){var d=A||k,f=d.device,P=d.browser,H=d.os,we=d.engine,De=d.ua;return{isSmartTV:R(f),isConsole:Y(f),isWearable:ee(f),isEmbedded:z(f),isMobileSafari:ve(P)||et(),isChromium:ae(P),isMobile:se(f)||et(),isMobileOnly:Ee(f),isTablet:M(f)||et(),isBrowser:$(f),isDesktop:$(f),isAndroid:Z(H),isWinPhone:Ae(H),isIOS:ke(H)||et(),isChrome:_(P),isFirefox:j(P),isSafari:J(P),isOpera:Se(P),isIE:Be(P),osVersion:F(H),osName:V(H),fullBrowserVersion:ot(P),browserVersion:Ct(P),browserName:ft(P),mobileVendor:K(f),mobileModel:X(f),engineName:$t(we),engineVersion:en(we),getUA:gr(De),isEdge:ce(P)||Pe(De),isYandex:G(P),deviceType:U(f),isIOS13:bn(),isIPad13:et(),isIPhone13:hr(),isIPod13:mr(),isElectron:Lt(),isEdgeChromium:Pe(De),isLegacyEdge:ce(P)&&!Pe(De),isWindows:pe(H),isMacOs:ie(H),isMIUI:je(P),isSamsungBrowser:$e(P)}}var wr=R(c),yr=Y(c),vr=ee(c),ic=z(c),cc=ve(a)||et(),lc=ae(a),wn=se(c)||et(),Ar=Ee(c),kr=M(c)||et(),xr=$(c),dc=$(c),Tr=Z(C),Er=Ae(C),Sr=ke(C)||et(),uc=_(a),fc=j(a),pc=J(a),hc=Se(a),Ir=Be(a),mc=F(C),gc=V(C),bc=ot(a),wc=Ct(a),yc=ft(a),vc=K(c),Ac=X(c),kc=$t(T),xc=en(T),Tc=gr(N),Ec=ce(a)||Pe(N),Sc=G(a),Ic=U(c),Cc=bn(),Bc=et(),Pc=hr(),Nc=mr(),Oc=Lt(),Uc=Pe(N),Dc=ce(a)&&!Pe(N),Fc=pe(C),Mc=ie(C),_c=je(a),Lc=$e(a),Hc=function(d){if(!d||typeof d!="string"){console.error("No valid user agent string was provided");return}var f=m(d),P=f.device,H=f.browser,we=f.os,De=f.engine,ze=f.ua;return br({device:P,browser:H,os:we,engine:De,ua:ze})},Rc=function(d){var f=d.renderWithFragment,P=d.children,H=u(d,["renderWithFragment","children"]);return Tr?f?n.createElement(t.Fragment,null,P):n.createElement("div",H,P):null},Vc=function(d){var f=d.renderWithFragment,P=d.children,H=u(d,["renderWithFragment","children"]);return xr?f?n.createElement(t.Fragment,null,P):n.createElement("div",H,P):null},Wc=function(d){var f=d.renderWithFragment,P=d.children,H=u(d,["renderWithFragment","children"]);return Ir?f?n.createElement(t.Fragment,null,P):n.createElement("div",H,P):null},Gc=function(d){var f=d.renderWithFragment,P=d.children,H=u(d,["renderWithFragment","children"]);return Sr?f?n.createElement(t.Fragment,null,P):n.createElement("div",H,P):null},zc=function(d){var f=d.renderWithFragment,P=d.children,H=u(d,["renderWithFragment","children"]);return wn?f?n.createElement(t.Fragment,null,P):n.createElement("div",H,P):null},Yc=function(d){var f=d.renderWithFragment,P=d.children,H=u(d,["renderWithFragment","children"]);return kr?f?n.createElement(t.Fragment,null,P):n.createElement("div",H,P):null},jc=function(d){var f=d.renderWithFragment,P=d.children,H=u(d,["renderWithFragment","children"]);return Er?f?n.createElement(t.Fragment,null,P):n.createElement("div",H,P):null},qc=function(d){var f=d.renderWithFragment,P=d.children;d.viewClassName,d.style;var H=u(d,["renderWithFragment","children","viewClassName","style"]);return Ar?f?n.createElement(t.Fragment,null,P):n.createElement("div",H,P):null},Jc=function(d){var f=d.renderWithFragment,P=d.children,H=u(d,["renderWithFragment","children"]);return wr?f?n.createElement(t.Fragment,null,P):n.createElement("div",H,P):null},Xc=function(d){var f=d.renderWithFragment,P=d.children,H=u(d,["renderWithFragment","children"]);return yr?f?n.createElement(t.Fragment,null,P):n.createElement("div",H,P):null},Kc=function(d){var f=d.renderWithFragment,P=d.children,H=u(d,["renderWithFragment","children"]);return vr?f?n.createElement(t.Fragment,null,P):n.createElement("div",H,P):null},Zc=function(d){var f=d.renderWithFragment,P=d.children;d.viewClassName,d.style;var H=d.condition,we=u(d,["renderWithFragment","children","viewClassName","style","condition"]);return H?f?n.createElement(t.Fragment,null,P):n.createElement("div",we,P):null};function Qc(A){return(function(d){ge(f,d);function f(P){var H;return ue(this,f),H=p(this,Ce(f).call(this,P)),H.isEventListenerAdded=!1,H.handleOrientationChange=H.handleOrientationChange.bind(w(H)),H.onOrientationChange=H.onOrientationChange.bind(w(H)),H.onPageLoad=H.onPageLoad.bind(w(H)),H.state={isLandscape:!1,isPortrait:!1},H}return Q(f,[{key:"handleOrientationChange",value:function(){this.isEventListenerAdded||(this.isEventListenerAdded=!0);var H=window.innerWidth>window.innerHeight?90:0;this.setState({isPortrait:H===0,isLandscape:H===90})}},{key:"onOrientationChange",value:function(){this.handleOrientationChange()}},{key:"onPageLoad",value:function(){this.handleOrientationChange()}},{key:"componentDidMount",value:function(){(typeof window>"u"?"undefined":B(window))!==void 0&&wn&&(this.isEventListenerAdded?window.removeEventListener("load",this.onPageLoad,!1):(this.handleOrientationChange(),window.addEventListener("load",this.onPageLoad,!1)),window.addEventListener("resize",this.onOrientationChange,!1))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.onOrientationChange,!1)}},{key:"render",value:function(){return n.createElement(A,ye({},this.props,{isLandscape:this.state.isLandscape,isPortrait:this.state.isPortrait}))}}]),f})(n.Component)}function $c(){var A=t.useState(function(){var we=window.innerWidth>window.innerHeight?90:0;return{isPortrait:we===0,isLandscape:we===90,orientation:we===0?"portrait":"landscape"}}),d=v(A,2),f=d[0],P=d[1],H=t.useCallback(function(){var we=window.innerWidth>window.innerHeight?90:0,De={isPortrait:we===0,isLandscape:we===90,orientation:we===0?"portrait":"landscape"};f.orientation!==De.orientation&&P(De)},[f.orientation]);return t.useEffect(function(){return(typeof window>"u"?"undefined":B(window))!==void 0&&wn&&(H(),window.addEventListener("load",H,!1),window.addEventListener("resize",H,!1)),function(){window.removeEventListener("resize",H,!1),window.removeEventListener("load",H,!1)}},[H]),f}function Cr(A){var d=A||window.navigator.userAgent;return m(d)}function el(A){var d=A||window.navigator.userAgent,f=Cr(d),P=br(f);return[P,f]}return te.AndroidView=Rc,te.BrowserTypes=q,te.BrowserView=Vc,te.ConsoleView=Xc,te.CustomView=Zc,te.IEView=Wc,te.IOSView=Gc,te.MobileOnlyView=qc,te.MobileView=zc,te.OsTypes=ne,te.SmartTVView=Jc,te.TabletView=Yc,te.WearableView=Kc,te.WinPhoneView=jc,te.browserName=yc,te.browserVersion=wc,te.deviceDetect=Oe,te.deviceType=Ic,te.engineName=kc,te.engineVersion=xc,te.fullBrowserVersion=bc,te.getSelectorsByUserAgent=Hc,te.getUA=Tc,te.isAndroid=Tr,te.isBrowser=xr,te.isChrome=uc,te.isChromium=lc,te.isConsole=yr,te.isDesktop=dc,te.isEdge=Ec,te.isEdgeChromium=Uc,te.isElectron=Oc,te.isEmbedded=ic,te.isFirefox=fc,te.isIE=Ir,te.isIOS=Sr,te.isIOS13=Cc,te.isIPad13=Bc,te.isIPhone13=Pc,te.isIPod13=Nc,te.isLegacyEdge=Dc,te.isMIUI=_c,te.isMacOs=Mc,te.isMobile=wn,te.isMobileOnly=Ar,te.isMobileSafari=cc,te.isOpera=hc,te.isSafari=pc,te.isSamsungBrowser=Lc,te.isSmartTV=wr,te.isTablet=kr,te.isWearable=vr,te.isWinPhone=Er,te.isWindows=Fc,te.isYandex=Sc,te.mobileModel=Ac,te.mobileVendor=vc,te.osName=gc,te.osVersion=mc,te.parseUserAgent=m,te.setUserAgent=Te,te.useDeviceData=Cr,te.useDeviceSelectors=el,te.useMobileOrientation=$c,te.withOrientationChange=Qc,te}var gn=sc();function rs(e,t){if(!e)return e;const n=e.toLowerCase().trim();if(n==="max"||n==="all")return t||e;const s=n.match(/^(\d+(?:\.\d+)?)%$/);if(s){const r=parseFloat(s[1])/100;return((parseFloat(t)||0)*r).toFixed(8).replace(/\.?0+$/,"")||"0"}return e}const rc=({isOpen:e,onClose:t,onTransaction:n,position:s="bottom-right"})=>{const{language:r}=Si();console.log("🚀 ~ ChatModal ~ language:",r);const{messages:a,addMessage:o,updateMessageAction:c,updateMessageText:T}=ki(),[C,N]=re.useState(""),[L,m]=re.useState(!1),[k,x]=re.useState(!0),[g,B]=re.useState(null),ue=re.useRef(null),D=re.useRef(null),Q=re.useRef(null),oe=re.useRef(null),ye=re.useRef(null),ge=re.useRef(!1),Ce=re.useRef(k);re.useEffect(()=>{Ce.current=k},[k]);const{account:i,chainData:l,chainType:u,chainTypeMoralis:w,chainId:p}=Jn(),v=Jn();console.log("🚀 ~ ChatModal ~ connect:",v);const{config:S}=xi(),h=p&&S?.rpcUrls?.[p]||void 0,b=re.useCallback(()=>{const M=St.getItem("dataBuyToken");if(M)try{return JSON.parse(M)}catch{return{srcTokenAddress:"",descTokenAddress:"",amount:"",srcTokenDecimals:18,descTokenDecimals:18}}return{srcTokenAddress:"",descTokenAddress:"",amount:"",srcTokenDecimals:18,descTokenDecimals:18}},[]),E=re.useCallback(M=>{St.setItem("dataBuyToken",JSON.stringify(M))},[]),y=re.useCallback(M=>{const R={...b(),...M};E(R)},[b,E]),O=re.useCallback(M=>{B(M),gn.isDesktop&&Q.current?.focus()},[]),q=re.useCallback(async(M,se)=>{y({descTokenAddress:M,descTokenDecimals:se||18});try{m(!0);const R=await rt({address:i?.address||"",chain:w});if(R?.success&&R?.data?.result){const $=R.data.result;if($?.length>0){const ee=$.map(Y=>({id:Y.token_address,text:`${Y.name}: ${Y.balance_formatted} ${Y.symbol} ($${de(Y.usd_value||0)?.decimalPlaces(2).toFormat()||"0"})`,value:`Buy with ${Y.symbol}`,action:"click_balance_item_user_to_buy_button",fullWidth:!0,extraData:{tokenAddress:Y.token_address,symbol:Y.symbol,balance:Y.balance_formatted,usdValue:Y.usd_value,decimals:Y.decimals}}));o(`This is the spendable balance of your wallet on ${l?.name||"unknown"} chain. Please choose the coins you want to use for this trade.`,"bot",void 0,ee)}else o(`Sorry, I couldn't find any tokens in your wallet on ${l?.name||"unknown"} chain. Please make sure you have some tokens to trade.`,"bot")}else o("Sorry, I could not fetch your wallet balance. Please try again.","bot")}catch(R){console.error("Error fetching wallet balance:",R),o("Sorry, I encountered an error fetching your wallet balance.","bot")}finally{m(!1)}},[y,i?.address,w,o,l?.name]),ne=re.useCallback(async(M,se,R,$)=>{const ee=[25,50,75,100];y({srcTokenAddress:M,srcTokenDecimals:$||18});let Y=R||"0";if(M===qe)try{const K=await ss({chainId:p,rpcUrl:h});if(K.isGreaterThan(0)){const X=K.times(1e6),Z=new de(dt(R,$||18).toString()).minus(X);Z.isGreaterThan(0)?Y=de(Ue(BigInt(Z.toFixed(0)),18)).toFixed():Y="0"}}catch(K){console.warn("getGasPrice for swap native fee deduction failed:",K)}const z=ee.map(K=>({id:`percent-${K}`,text:`${K}%`,value:`Use ${K}% of ${se}`,action:"select_percent",extraData:{percent:K,tokenAddress:M,tokenSymbol:se,tokenBalance:Y}}));if(de(Y).isZero()){o(`Insufficient fee. Please ensure you have enough ${se} to cover the transaction fees, or select a different token.`,"bot");return}o(`📊 Select the amount of ${se} to use:
300
-
301
- Available: ${Y} ${se}`,"bot",void 0,z)},[o,p,h,y]),me=re.useCallback(async(M,se)=>{y({amount:(parseFloat(se)*(M/100)).toFixed(6)});const R=b(),$=dt(R.amount,R.srcTokenDecimals||18).toString(),ee=await $n({chainId:p,tokenIn:R.srcTokenAddress,tokenInAmount:$,tokenOut:R.descTokenAddress,tokenOutRecipient:i?.address||"",slippage:"auto",accesstoken:"d6c45897b8f6"});if(ee.success&&ee.data){const Y=ee.data,z=Y.tokenIn,K=Y.tokenOut,X=de(Ue(BigInt(z.amount||0),z.decimals)).decimalPlaces(6).toFormat(),U=de(Ue(BigInt(K.amount||0),K.decimals)).decimalPlaces(6).toFormat(),Z=R.srcTokenAddress===qe||R.srcTokenAddress==="";let pe=!1;if(!Z&&i?.address&&Y.tx?.to)try{const ae=await ns({tokenAddress:R.srcTokenAddress,ownerAddress:i.address,spenderAddress:Y.tx.to,chainId:p,rpcUrl:h});pe=de(ae.toString()).isLessThan($)}catch(ae){console.warn("Allowance check failed:",ae),pe=!0}const ie=Y.estimatedTransactionFee?.total?de(Y.estimatedTransactionFee.total):de(0);let Ae=de(0);if(pe&&i?.address)try{const ae=hn({tokenAddress:R.srcTokenAddress,spenderAddress:Y.tx?.to||"",fromAddress:i.address,chainId:p});Ae=await Zt({from:i.address,to:ae.to,data:ae.data,chainId:p,rpcUrl:h})}catch(ae){console.warn("Approve fee estimation failed:",ae)}const ke=ie.plus(Ae),F=l?.nativeCurrency?.symbol||"native";let V="",_=!1;if(i?.address&&ke.isGreaterThan(0))try{const ae=await mn({address:i.address,chainId:p,rpcUrl:h});if(ae.isLessThan(ke)){_=!0;const ce=de(Ue(BigInt(ae.toFixed(0)),18)).decimalPlaces(6).toFormat(),G=de(Ue(BigInt(ke.toFixed(0)),18)).decimalPlaces(6).toFormat();V=`
302
- ⚠️ **Insufficient ${F} for fees!**
303
- You have ${ce} ${F} but need ~${G} ${F}.
304
- `}}catch(ae){console.warn("Fee balance check failed:",ae)}const j=`From: ${X} ${z.symbol}
361
+ - **CRITICAL - LANGUAGE**: Always respond in the SAME language the user writes in. English → English. Vietnamese → Vietnamese. NEVER use Chinese or any other language unless the user wrote in that language.`}const gs={1:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",10:"0x4200000000000000000000000000000000000006",56:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",137:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",8453:"0x4200000000000000000000000000000000000006",42161:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"},mn=[{name:"transfer",type:"function",stateMutability:"nonpayable",inputs:[{name:"to",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{name:"approve",type:"function",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{name:"allowance",type:"function",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]}],bs=[{name:"deposit",type:"function",stateMutability:"payable",inputs:[],outputs:[]},{name:"withdraw",type:"function",stateMutability:"nonpayable",inputs:[{name:"wad",type:"uint256"}],outputs:[]}],Yi=[{name:"safeTransferFrom",type:"function",stateMutability:"nonpayable",inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"tokenId",type:"uint256"}],outputs:[]}],ji=[{name:"safeTransferFrom",type:"function",stateMutability:"nonpayable",inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"id",type:"uint256"},{name:"amount",type:"uint256"},{name:"data",type:"bytes"}],outputs:[]}];function Zt(e,t){return t||ct[e]?.rpcUrls?.default?.http?.[0]}function Ji(e){const{action:t,parameters:n,fromAddress:o,chainId:s}=e;switch(t){case"send_native":return Xi(n,o,s);case"send_token":return Ki(n,o,s);case"approve_token":return Zi(n,o,s);case"wrap_native":return Qi(n,o,s);case"unwrap_native":return ec(n,o,s);case"send_nft":return nc(n,o,s);default:throw new Error(`Action "${t}" does not produce a transaction`)}}function Xi(e,t,n){const{to_address:o,amount:s}=e;if(!o)throw new Error("Recipient address is required");if(!s)throw new Error("Amount is required");const r=dt(s,18).toString();return{from:t,to:o,data:"0x",value:r,chainId:n,description:`Send ${s} native token to ${o}`}}function Ki(e,t,n){const{contract_address:o,to_address:s,amount:r,decimals:a,token_symbol:l}=e;if(!o)throw new Error("Token contract address is required");if(!s)throw new Error("Recipient address is required");if(!r)throw new Error("Amount is required");const f=parseInt(a)||18,S=dt(r,f),N=bt({abi:mn,functionName:"transfer",args:[s,S]});return{from:t,to:o,data:N,value:"0",chainId:n,description:`Send ${r} ${l||"tokens"} to ${s}`}}function Zi(e,t,n){const{contract_address:o,spender_address:s,amount:r,token_symbol:a}=e;if(!o)throw new Error("Token contract address is required");if(!s)throw new Error("Spender address is required");const l=r&&r?.trim()!==""?dt(r,18):Dt,f=bt({abi:mn,functionName:"approve",args:[s,l]});return{from:t,to:o,data:f,value:"0",chainId:n,description:`Approve ${r||"unlimited"} ${a||"tokens"} for ${s}`}}function Qi(e,t,n){const{amount:o}=e;if(!o)throw new Error("Amount is required");const s=gs[n];if(!s)throw new Error(`WETH not supported on chain ${n}`);const r=dt(o,18).toString(),a=bt({abi:bs,functionName:"deposit"});return{from:t,to:s,data:a,value:r,chainId:n,description:`Wrap ${o} native token`}}function ec(e,t,n){const{amount:o}=e;if(!o)throw new Error("Amount is required");const s=gs[n];if(!s)throw new Error(`WETH not supported on chain ${n}`);const r=dt(o,18),a=bt({abi:bs,functionName:"withdraw",args:[r]});return{from:t,to:s,data:a,value:"0",chainId:n,description:`Unwrap ${o} WETH`}}function tc(e){return["send_native","send_token","approve_token","wrap_native","unwrap_native","send_nft"].includes(e)}async function so(e){const{transactionHash:t,chainId:n,pollingInterval:o=3e3,timeout:s=12e4,rpcUrl:r}=e,a=Zt(n,r);if(!a)throw new Error(`No RPC endpoint for chain ${n}`);const l=Date.now();for(;Date.now()-l<s;){try{const S=await(await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_getTransactionReceipt",params:[t]})})).json();if(S.result){const N=S.result;return{status:N.status==="0x1"?"success":"fail",blockNumber:N.blockNumber,gasUsed:N.gasUsed,effectiveGasPrice:N.effectiveGasPrice}}}catch(f){console.warn("eth_getTransactionReceipt poll error:",f)}await new Promise(f=>setTimeout(f,o))}throw new Error(`Transaction ${t} was not mined within ${s/1e3}s`)}async function ro(e){const{tokenAddress:t,ownerAddress:n,spenderAddress:o,chainId:s,rpcUrl:r}=e,a=Zt(s,r);if(!a)return console.warn(`No RPC endpoint for chain ${s}, assuming no allowance`),BigInt(0);try{const l=bt({abi:mn,functionName:"allowance",args:[n,o]}),S=await(await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_call",params:[{to:t,data:l},"latest"]})})).json();return S.result&&S.result!=="0x"?BigInt(S.result):BigInt(0)}catch(l){return console.warn("checkAllowance failed:",l),BigInt(0)}}function hn(e){const{tokenAddress:t,spenderAddress:n,fromAddress:o,chainId:s,tokenSymbol:r}=e,a=bt({abi:mn,functionName:"approve",args:[n,Dt]});return{from:o,to:t,data:a,value:"0",chainId:s,description:`Approve ${r||"token"} for swap`}}function nc(e,t,n){const{contract_address:o,token_id:s,to_address:r,token_standard:a,amount:l,nft_name:f}=e;if(!o)throw new Error("NFT contract address is required");if(!s)throw new Error("Token ID is required");if(!r)throw new Error("Recipient address is required");const S=(a||"ERC721").toUpperCase(),N=BigInt(s);let _,b;if(S==="ERC1155"){const E=BigInt(l||"1");_=bt({abi:ji,functionName:"safeTransferFrom",args:[t,r,N,E,"0x"]}),b=`Send ${E>1n?E.toString()+"x ":""}${f||"NFT"} (ERC1155 #${s}) to ${r}`}else _=bt({abi:Yi,functionName:"safeTransferFrom",args:[t,r,N]}),b=`Send ${f||"NFT"} (ERC721 #${s}) to ${r}`;return{from:t,to:o,data:_,value:"0",chainId:n,description:b}}async function gn(e){const{address:t,chainId:n,rpcUrl:o}=e,s=Zt(n,o);if(!s)return console.warn(`No RPC endpoint for chain ${n}`),new ue(0);try{const a=await(await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_getBalance",params:[t,"latest"]})})).json();return a.result&&a.result!=="0x"?new ue(BigInt(a.result).toString()):new ue(0)}catch(r){return console.warn("getNativeBalance failed:",r),new ue(0)}}async function Qt(e){const{from:t,to:n,data:o,value:s,chainId:r,rpcUrl:a}=e,l=Zt(r,a);if(!l)return console.warn(`No RPC endpoint for chain ${r}`),new ue(0);try{const[f,S]=await Promise.all([fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_estimateGas",params:[{from:t,to:n,data:o,...s&&s!=="0"?{value:s}:{}}]})}),fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:2,method:"eth_gasPrice",params:[]})})]),[N,_]=await Promise.all([f.json(),S.json()]),b=N.result?new ue(BigInt(N.result).toString()):new ue(0),E=_.result?new ue(BigInt(_.result).toString()):new ue(0);return b.times(E).times(1.1)}catch(f){return console.warn("estimateTransactionFee failed:",f),new ue(0)}}async function ao(e){const{chainId:t,rpcUrl:n}=e,o=Zt(t,n);if(!o)return console.warn(`No RPC endpoint for chain ${t}`),new ue(0);try{const r=await(await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_gasPrice",params:[]})})).json();return r.result&&r.result!=="0x"?new ue(BigInt(r.result).toString()):new ue(0)}catch(s){return console.warn("getGasPrice failed:",s),new ue(0)}}var ee={},en={exports:{}},oc=en.exports,ws;function sc(){return ws||(ws=1,(function(e,t){(function(n,o){var s="1.0.41",r="",a="?",l="function",f="undefined",S="object",N="string",_="major",b="model",E="name",v="type",C="vendor",D="version",J="architecture",I="console",q="mobile",K="tablet",he="smarttv",ye="wearable",Be="embedded",i=500,d="Amazon",c="Apple",g="ASUS",m="BlackBerry",w="Browser",y="Chrome",h="Edge",k="Firefox",A="Google",T="Honor",F="Huawei",H="Lenovo",re="LG",ge="Microsoft",ke="Motorola",xe="Nvidia",G="OnePlus",we="Opera",Se="OPPO",Ge="Samsung",et="Sharp",He="Sony",De="Xiaomi",ze="Zebra",Me="Facebook",Ne="Chromium OS",Te="Mac OS",Ct=" Browser",Rt=function(ie,le){var O={};for(var z in ie)le[z]&&le[z].length%2===0?O[z]=le[z].concat(ie[z]):O[z]=ie[z];return O},M=function(ie){for(var le={},O=0;O<ie.length;O++)le[ie[O].toUpperCase()]=ie[O];return le},te=function(ie,le){return typeof ie===N?R(le).indexOf(R(ie))!==-1:!1},R=function(ie){return ie.toLowerCase()},ne=function(ie){return typeof ie===N?ie.replace(/[^\d\.]/g,r).split(".")[0]:o},oe=function(ie,le){if(typeof ie===N)return ie=ie.replace(/^\s\s*/,r),typeof le===f?ie:ie.substring(0,i)},$=function(ie,le){for(var O=0,z,Q,ae,j,V,ce;O<le.length&&!V;){var Ae=le[O],Ce=le[O+1];for(z=Q=0;z<Ae.length&&!V&&Ae[z];)if(V=Ae[z++].exec(ie),V)for(ae=0;ae<Ce.length;ae++)ce=V[++Q],j=Ce[ae],typeof j===S&&j.length>0?j.length===2?typeof j[1]==l?this[j[0]]=j[1].call(this,ce):this[j[0]]=j[1]:j.length===3?typeof j[1]===l&&!(j[1].exec&&j[1].test)?this[j[0]]=ce?j[1].call(this,ce,j[2]):o:this[j[0]]=ce?ce.replace(j[1],j[2]):o:j.length===4&&(this[j[0]]=ce?j[3].call(this,ce.replace(j[1],j[2])):o):this[j]=ce||o;O+=2}},W=function(ie,le){for(var O in le)if(typeof le[O]===S&&le[O].length>0){for(var z=0;z<le[O].length;z++)if(te(le[O][z],ie))return O===a?o:O}else if(te(le[O],ie))return O===a?o:O;return le.hasOwnProperty("*")?le["*"]:ie},Z={"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},X={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},U={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[D,[E,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[D,[E,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[E,D],[/opios[\/ ]+([\w\.]+)/i],[D,[E,we+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[D,[E,we+" GX"]],[/\bopr\/([\w\.]+)/i],[D,[E,we]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[D,[E,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[D,[E,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[E,D],[/quark(?:pc)?\/([-\w\.]+)/i],[D,[E,"Quark"]],[/\bddg\/([\w\.]+)/i],[D,[E,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[D,[E,"UC"+w]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[D,[E,"WeChat"]],[/konqueror\/([\w\.]+)/i],[D,[E,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[D,[E,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[D,[E,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[D,[E,"Smart Lenovo "+w]],[/(avast|avg)\/([\w\.]+)/i],[[E,/(.+)/,"$1 Secure "+w],D],[/\bfocus\/([\w\.]+)/i],[D,[E,k+" Focus"]],[/\bopt\/([\w\.]+)/i],[D,[E,we+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[D,[E,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[D,[E,"Dolphin"]],[/coast\/([\w\.]+)/i],[D,[E,we+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[D,[E,"MIUI"+Ct]],[/fxios\/([\w\.-]+)/i],[D,[E,k]],[/\bqihoobrowser\/?([\w\.]*)/i],[D,[E,"360"]],[/\b(qq)\/([\w\.]+)/i],[[E,/(.+)/,"$1Browser"],D],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[E,/(.+)/,"$1"+Ct],D],[/samsungbrowser\/([\w\.]+)/i],[D,[E,Ge+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[D,[E,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[E,"Sogou Mobile"],D],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[E,D],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[E],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[D,E],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[E,Me],D],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[E,D],[/\bgsa\/([\w\.]+) .*safari\//i],[D,[E,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[D,[E,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[D,[E,y+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[E,y+" WebView"],D],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[D,[E,"Android "+w]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[E,D],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[D,[E,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[D,E],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[E,[D,W,Z]],[/(webkit|khtml)\/([\w\.]+)/i],[E,D],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[E,"Netscape"],D],[/(wolvic|librewolf)\/([\w\.]+)/i],[E,D],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[D,[E,k+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[E,[D,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[E,[D,/master.|lts./,""]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[J,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[J,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[J,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[J,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[J,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[J,/ower/,r,R]],[/ sun4\w[;\)]/i],[[J,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[J,R]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[b,[C,Ge],[v,K]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[b,[C,Ge],[v,q]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[b,[C,c],[v,q]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[b,[C,c],[v,K]],[/(macintosh);/i],[b,[C,c]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[b,[C,et],[v,q]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[b,[C,T],[v,K]],[/honor([-\w ]+)[;\)]/i],[b,[C,T],[v,q]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[b,[C,F],[v,K]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[b,[C,F],[v,q]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[b,/_/g," "],[C,De],[v,K]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[b,/_/g," "],[C,De],[v,q]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[b,[C,Se],[v,q]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[b,[C,W,{OnePlus:["304","403","203"],"*":Se}],[v,K]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[b,[C,"Vivo"],[v,q]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[b,[C,"Realme"],[v,q]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[b,[C,ke],[v,q]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[b,[C,ke],[v,K]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[b,[C,re],[v,K]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv|watch)\w+)/i,/\blg-?([\d\w]+) bui/i],[b,[C,re],[v,q]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[b,[C,H],[v,K]],[/(nokia) (t[12][01])/i],[C,b,[v,K]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[b,/_/g," "],[v,q],[C,"Nokia"]],[/(pixel (c|tablet))\b/i],[b,[C,A],[v,K]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[b,[C,A],[v,q]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[b,[C,He],[v,q]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[b,"Xperia Tablet"],[C,He],[v,K]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[b,[C,G],[v,q]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[b,[C,d],[v,K]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[b,/(.+)/g,"Fire Phone $1"],[C,d],[v,q]],[/(playbook);[-\w\),; ]+(rim)/i],[b,C,[v,K]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[b,[C,m],[v,q]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[b,[C,g],[v,K]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[b,[C,g],[v,q]],[/(nexus 9)/i],[b,[C,"HTC"],[v,K]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[C,[b,/_/g," "],[v,q]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[b,[C,"TCL"],[v,K]],[/(itel) ((\w+))/i],[[C,R],b,[v,W,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[b,[C,"Acer"],[v,K]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[b,[C,"Meizu"],[v,q]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[b,[C,"Ulefone"],[v,q]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[b,[C,"Energizer"],[v,q]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[b,[C,"Cat"],[v,q]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[b,[C,"Smartfren"],[v,q]],[/droid.+; (a(?:015|06[35]|142p?))/i],[b,[C,"Nothing"],[v,q]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[b,[C,"Archos"],[v,K]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[b,[C,"Archos"],[v,q]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[C,b,[v,K]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (hmd|imo) ([\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i,/(oppo) ?([\w ]+) bui/i],[C,b,[v,q]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[C,b,[v,K]],[/(surface duo)/i],[b,[C,ge],[v,K]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[b,[C,"Fairphone"],[v,q]],[/(u304aa)/i],[b,[C,"AT&T"],[v,q]],[/\bsie-(\w*)/i],[b,[C,"Siemens"],[v,q]],[/\b(rct\w+) b/i],[b,[C,"RCA"],[v,K]],[/\b(venue[\d ]{2,7}) b/i],[b,[C,"Dell"],[v,K]],[/\b(q(?:mv|ta)\w+) b/i],[b,[C,"Verizon"],[v,K]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[b,[C,"Barnes & Noble"],[v,K]],[/\b(tm\d{3}\w+) b/i],[b,[C,"NuVision"],[v,K]],[/\b(k88) b/i],[b,[C,"ZTE"],[v,K]],[/\b(nx\d{3}j) b/i],[b,[C,"ZTE"],[v,q]],[/\b(gen\d{3}) b.+49h/i],[b,[C,"Swiss"],[v,q]],[/\b(zur\d{3}) b/i],[b,[C,"Swiss"],[v,K]],[/\b((zeki)?tb.*\b) b/i],[b,[C,"Zeki"],[v,K]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[C,"Dragon Touch"],b,[v,K]],[/\b(ns-?\w{0,9}) b/i],[b,[C,"Insignia"],[v,K]],[/\b((nxa|next)-?\w{0,9}) b/i],[b,[C,"NextBook"],[v,K]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[C,"Voice"],b,[v,q]],[/\b(lvtel\-)?(v1[12]) b/i],[[C,"LvTel"],b,[v,q]],[/\b(ph-1) /i],[b,[C,"Essential"],[v,q]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[b,[C,"Envizen"],[v,K]],[/\b(trio[-\w\. ]+) b/i],[b,[C,"MachSpeed"],[v,K]],[/\btu_(1491) b/i],[b,[C,"Rotor"],[v,K]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[b,[C,xe],[v,K]],[/(sprint) (\w+)/i],[C,b,[v,q]],[/(kin\.[onetw]{3})/i],[[b,/\./g," "],[C,ge],[v,q]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[b,[C,ze],[v,K]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[b,[C,ze],[v,q]],[/smart-tv.+(samsung)/i],[C,[v,he]],[/hbbtv.+maple;(\d+)/i],[[b,/^/,"SmartTV"],[C,Ge],[v,he]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[C,re],[v,he]],[/(apple) ?tv/i],[C,[b,c+" TV"],[v,he]],[/crkey/i],[[b,y+"cast"],[C,A],[v,he]],[/droid.+aft(\w+)( bui|\))/i],[b,[C,d],[v,he]],[/(shield \w+ tv)/i],[b,[C,xe],[v,he]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[b,[C,et],[v,he]],[/(bravia[\w ]+)( bui|\))/i],[b,[C,He],[v,he]],[/(mi(tv|box)-?\w+) bui/i],[b,[C,De],[v,he]],[/Hbbtv.*(technisat) (.*);/i],[C,b,[v,he]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[C,oe],[b,oe],[v,he]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[b,[v,he]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[v,he]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[C,b,[v,I]],[/droid.+; (shield)( bui|\))/i],[b,[C,xe],[v,I]],[/(playstation \w+)/i],[b,[C,He],[v,I]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[b,[C,ge],[v,I]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[b,[C,Ge],[v,ye]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[C,b,[v,ye]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[b,[C,Se],[v,ye]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[b,[C,c],[v,ye]],[/(opwwe\d{3})/i],[b,[C,G],[v,ye]],[/(moto 360)/i],[b,[C,ke],[v,ye]],[/(smartwatch 3)/i],[b,[C,He],[v,ye]],[/(g watch r)/i],[b,[C,re],[v,ye]],[/droid.+; (wt63?0{2,3})\)/i],[b,[C,ze],[v,ye]],[/droid.+; (glass) \d/i],[b,[C,A],[v,ye]],[/(pico) (4|neo3(?: link|pro)?)/i],[C,b,[v,ye]],[/; (quest( \d| pro)?)/i],[b,[C,Me],[v,ye]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[C,[v,Be]],[/(aeobc)\b/i],[b,[C,d],[v,Be]],[/(homepod).+mac os/i],[b,[C,c],[v,Be]],[/windows iot/i],[[v,Be]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[b,[v,q]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[b,[v,K]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[v,K]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[v,q]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[b,[C,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[D,[E,h+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[E,D],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[D,[E,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[E,D],[/ladybird\//i],[[E,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[D,E]],os:[[/microsoft (windows) (vista|xp)/i],[E,D],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[E,[D,W,X]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[D,W,X],[E,"Windows"]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[D,/_/g,"."],[E,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[E,Te],[D,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[D,E],[/(ubuntu) ([\w\.]+) like android/i],[[E,/(.+)/,"$1 Touch"],D],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/; ]?([\d\.]*)/i],[E,D],[/\(bb(10);/i],[D,[E,m]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[D,[E,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[D,[E,k+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[D,[E,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[D,[E,"watchOS"]],[/crkey\/([\d\.]+)/i],[D,[E,y+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[E,Ne],D],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux)(?: arm\w*| x86\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[E,D],[/(sunos) ?([\w\.\d]*)/i],[[E,"Solaris"],D],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[E,D]]},Y=function(ie,le){if(typeof ie===S&&(le=ie,ie=o),!(this instanceof Y))return new Y(ie,le).getResult();var O=typeof n!==f&&n.navigator?n.navigator:o,z=ie||(O&&O.userAgent?O.userAgent:r),Q=O&&O.userAgentData?O.userAgentData:o,ae=le?Rt(U,le):U,j=O&&O.userAgent==z;return this.getBrowser=function(){var V={};return V[E]=o,V[D]=o,$.call(V,z,ae.browser),V[_]=ne(V[D]),j&&O&&O.brave&&typeof O.brave.isBrave==l&&(V[E]="Brave"),V},this.getCPU=function(){var V={};return V[J]=o,$.call(V,z,ae.cpu),V},this.getDevice=function(){var V={};return V[C]=o,V[b]=o,V[v]=o,$.call(V,z,ae.device),j&&!V[v]&&Q&&Q.mobile&&(V[v]=q),j&&V[b]=="Macintosh"&&O&&typeof O.standalone!==f&&O.maxTouchPoints&&O.maxTouchPoints>2&&(V[b]="iPad",V[v]=K),V},this.getEngine=function(){var V={};return V[E]=o,V[D]=o,$.call(V,z,ae.engine),V},this.getOS=function(){var V={};return V[E]=o,V[D]=o,$.call(V,z,ae.os),j&&!V[E]&&Q&&Q.platform&&Q.platform!="Unknown"&&(V[E]=Q.platform.replace(/chrome os/i,Ne).replace(/macos/i,Te)),V},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return z},this.setUA=function(V){return z=typeof V===N&&V.length>i?oe(V,i):V,this},this.setUA(z),this};Y.VERSION=s,Y.BROWSER=M([E,D,_]),Y.CPU=M([J]),Y.DEVICE=M([b,C,v,I,q,he,K,ye,Be]),Y.ENGINE=Y.OS=M([E,D]),e.exports&&(t=e.exports=Y),t.UAParser=Y;var fe=typeof n!==f&&(n.jQuery||n.Zepto);if(fe&&!fe.ua){var me=new Y;fe.ua=me.getResult(),fe.ua.get=function(){return me.getUA()},fe.ua.set=function(ie){me.setUA(ie);var le=me.getResult();for(var O in le)fe.ua[O]=le[O]}}})(typeof window=="object"?window:oc)})(en,en.exports)),en.exports}var ys;function rc(){if(ys)return ee;ys=1,Object.defineProperty(ee,"__esModule",{value:!0});function e(x){return x&&typeof x=="object"&&"default"in x?x.default:x}var t=se,n=e(t),o=sc(),s=new o,r=s.getBrowser(),a=s.getCPU(),l=s.getDevice(),f=s.getEngine(),S=s.getOS(),N=s.getUA(),_=function(u){return s.setUA(u)},b=function(u){if(!u){console.error("No userAgent string was provided");return}var p=new o(u);return{UA:p,browser:p.getBrowser(),cpu:p.getCPU(),device:p.getDevice(),engine:p.getEngine(),os:p.getOS(),ua:p.getUA(),setUserAgent:function(L){return p.setUA(L)}}},E=Object.freeze({ClientUAInstance:s,browser:r,cpu:a,device:l,engine:f,os:S,ua:N,setUa:_,parseUserAgent:b});function v(x,u){var p=Object.keys(x);if(Object.getOwnPropertySymbols){var P=Object.getOwnPropertySymbols(x);u&&(P=P.filter(function(L){return Object.getOwnPropertyDescriptor(x,L).enumerable})),p.push.apply(p,P)}return p}function C(x){for(var u=1;u<arguments.length;u++){var p=arguments[u]!=null?arguments[u]:{};u%2?v(Object(p),!0).forEach(function(P){K(x,P,p[P])}):Object.getOwnPropertyDescriptors?Object.defineProperties(x,Object.getOwnPropertyDescriptors(p)):v(Object(p)).forEach(function(P){Object.defineProperty(x,P,Object.getOwnPropertyDescriptor(p,P))})}return x}function D(x){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?D=function(u){return typeof u}:D=function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},D(x)}function J(x,u){if(!(x instanceof u))throw new TypeError("Cannot call a class as a function")}function I(x,u){for(var p=0;p<u.length;p++){var P=u[p];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(x,P.key,P)}}function q(x,u,p){return u&&I(x.prototype,u),x}function K(x,u,p){return u in x?Object.defineProperty(x,u,{value:p,enumerable:!0,configurable:!0,writable:!0}):x[u]=p,x}function he(){return he=Object.assign||function(x){for(var u=1;u<arguments.length;u++){var p=arguments[u];for(var P in p)Object.prototype.hasOwnProperty.call(p,P)&&(x[P]=p[P])}return x},he.apply(this,arguments)}function ye(x,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function");x.prototype=Object.create(u&&u.prototype,{constructor:{value:x,writable:!0,configurable:!0}}),u&&i(x,u)}function Be(x){return Be=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},Be(x)}function i(x,u){return i=Object.setPrototypeOf||function(P,L){return P.__proto__=L,P},i(x,u)}function d(x,u){if(x==null)return{};var p={},P=Object.keys(x),L,ve;for(ve=0;ve<P.length;ve++)L=P[ve],!(u.indexOf(L)>=0)&&(p[L]=x[L]);return p}function c(x,u){if(x==null)return{};var p=d(x,u),P,L;if(Object.getOwnPropertySymbols){var ve=Object.getOwnPropertySymbols(x);for(L=0;L<ve.length;L++)P=ve[L],!(u.indexOf(P)>=0)&&Object.prototype.propertyIsEnumerable.call(x,P)&&(p[P]=x[P])}return p}function g(x){if(x===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x}function m(x,u){if(u&&(typeof u=="object"||typeof u=="function"))return u;if(u!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return g(x)}function w(x,u){return y(x)||h(x,u)||k(x,u)||T()}function y(x){if(Array.isArray(x))return x}function h(x,u){var p=x==null?null:typeof Symbol<"u"&&x[Symbol.iterator]||x["@@iterator"];if(p!=null){var P=[],L=!0,ve=!1,Oe,$e;try{for(p=p.call(x);!(L=(Oe=p.next()).done)&&(P.push(Oe.value),!(u&&P.length===u));L=!0);}catch(An){ve=!0,$e=An}finally{try{!L&&p.return!=null&&p.return()}finally{if(ve)throw $e}}return P}}function k(x,u){if(x){if(typeof x=="string")return A(x,u);var p=Object.prototype.toString.call(x).slice(8,-1);if(p==="Object"&&x.constructor&&(p=x.constructor.name),p==="Map"||p==="Set")return Array.from(x);if(p==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(p))return A(x,u)}}function A(x,u){(u==null||u>x.length)&&(u=x.length);for(var p=0,P=new Array(u);p<u;p++)P[p]=x[p];return P}function T(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
362
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var F={Mobile:"mobile",Tablet:"tablet",SmartTv:"smarttv",Console:"console",Wearable:"wearable",Embedded:"embedded",Browser:void 0},H={Chrome:"Chrome",Firefox:"Firefox",Opera:"Opera",Yandex:"Yandex",Safari:"Safari",InternetExplorer:"Internet Explorer",Edge:"Edge",Chromium:"Chromium",Ie:"IE",MobileSafari:"Mobile Safari",EdgeChromium:"Edge Chromium",MIUI:"MIUI Browser",SamsungBrowser:"Samsung Browser"},re={IOS:"iOS",Android:"Android",WindowsPhone:"Windows Phone",Windows:"Windows",MAC_OS:"Mac OS"},ge={isMobile:!1,isTablet:!1,isBrowser:!1,isSmartTV:!1,isConsole:!1,isWearable:!1},ke=function(u){switch(u){case F.Mobile:return{isMobile:!0};case F.Tablet:return{isTablet:!0};case F.SmartTv:return{isSmartTV:!0};case F.Console:return{isConsole:!0};case F.Wearable:return{isWearable:!0};case F.Browser:return{isBrowser:!0};case F.Embedded:return{isEmbedded:!0};default:return ge}},xe=function(u){return _(u)},G=function(u){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"none";return u||p},we=function(){return typeof window<"u"&&(window.navigator||navigator)?window.navigator||navigator:!1},Se=function(u){var p=we();return p&&p.platform&&(p.platform.indexOf(u)!==-1||p.platform==="MacIntel"&&p.maxTouchPoints>1&&!window.MSStream)},Ge=function(u,p,P,L,ve){return{isBrowser:u,browserMajorVersion:G(p.major),browserFullVersion:G(p.version),browserName:G(p.name),engineName:G(P.name),engineVersion:G(P.version),osName:G(L.name),osVersion:G(L.version),userAgent:G(ve)}},et=function(u,p,P,L){return C({},u,{vendor:G(p.vendor),model:G(p.model),os:G(P.name),osVersion:G(P.version),ua:G(L)})},He=function(u,p,P,L){return{isSmartTV:u,engineName:G(p.name),engineVersion:G(p.version),osName:G(P.name),osVersion:G(P.version),userAgent:G(L)}},De=function(u,p,P,L){return{isConsole:u,engineName:G(p.name),engineVersion:G(p.version),osName:G(P.name),osVersion:G(P.version),userAgent:G(L)}},ze=function(u,p,P,L){return{isWearable:u,engineName:G(p.name),engineVersion:G(p.version),osName:G(P.name),osVersion:G(P.version),userAgent:G(L)}},Me=function(u,p,P,L,ve){return{isEmbedded:u,vendor:G(p.vendor),model:G(p.model),engineName:G(P.name),engineVersion:G(P.version),osName:G(L.name),osVersion:G(L.version),userAgent:G(ve)}};function Ne(x){var u=x?b(x):E,p=u.device,P=u.browser,L=u.engine,ve=u.os,Oe=u.ua,$e=ke(p.type),An=$e.isBrowser,ol=$e.isMobile,sl=$e.isTablet,Us=$e.isSmartTV,Os=$e.isConsole,Ds=$e.isWearable,Ms=$e.isEmbedded;if(An)return Ge(An,P,L,ve,Oe);if(Us)return He(Us,L,ve,Oe);if(Os)return De(Os,L,ve,Oe);if(ol||sl)return et($e,p,ve,Oe);if(Ds)return ze(Ds,L,ve,Oe);if(Ms)return Me(Ms,p,L,ve,Oe)}var Te=function(u){var p=u.type;return p===F.Mobile},Ct=function(u){var p=u.type;return p===F.Tablet},Rt=function(u){var p=u.type;return p===F.Mobile||p===F.Tablet},M=function(u){var p=u.type;return p===F.SmartTv},te=function(u){var p=u.type;return p===F.Browser},R=function(u){var p=u.type;return p===F.Wearable},ne=function(u){var p=u.type;return p===F.Console},oe=function(u){var p=u.type;return p===F.Embedded},$=function(u){var p=u.vendor;return G(p)},W=function(u){var p=u.model;return G(p)},Z=function(u){var p=u.type;return G(p,"browser")},X=function(u){var p=u.name;return p===re.Android},U=function(u){var p=u.name;return p===re.Windows},Y=function(u){var p=u.name;return p===re.MAC_OS},fe=function(u){var p=u.name;return p===re.WindowsPhone},me=function(u){var p=u.name;return p===re.IOS},ie=function(u){var p=u.version;return G(p)},le=function(u){var p=u.name;return G(p)},O=function(u){var p=u.name;return p===H.Chrome},z=function(u){var p=u.name;return p===H.Firefox},Q=function(u){var p=u.name;return p===H.Chromium},ae=function(u){var p=u.name;return p===H.Edge},j=function(u){var p=u.name;return p===H.Yandex},V=function(u){var p=u.name;return p===H.Safari||p===H.MobileSafari},ce=function(u){var p=u.name;return p===H.MobileSafari},Ae=function(u){var p=u.name;return p===H.Opera},Ce=function(u){var p=u.name;return p===H.InternetExplorer||p===H.Ie},Pe=function(u){var p=u.name;return p===H.MIUI},Fe=function(u){var p=u.name;return p===H.SamsungBrowser},qe=function(u){var p=u.version;return G(p)},Ze=function(u){var p=u.major;return G(p)},st=function(u){var p=u.name;return G(p)},Bt=function(u){var p=u.name;return G(p)},It=function(u){var p=u.version;return G(p)},tn=function(){var u=we(),p=u&&u.userAgent&&u.userAgent.toLowerCase();return typeof p=="string"?/electron/.test(p):!1},ft=function(u){return typeof u=="string"&&u.indexOf("Edg/")!==-1},Ht=function(){var u=we();return u&&(/iPad|iPhone|iPod/.test(u.platform)||u.platform==="MacIntel"&&u.maxTouchPoints>1)&&!window.MSStream},Ee=function(){return Se("iPad")},wn=function(){return Se("iPhone")},yn=function(){return Se("iPod")},vs=function(u){return G(u)};function As(x){var u=x||E,p=u.device,P=u.browser,L=u.os,ve=u.engine,Oe=u.ua;return{isSmartTV:M(p),isConsole:ne(p),isWearable:R(p),isEmbedded:oe(p),isMobileSafari:ce(P)||Ee(),isChromium:Q(P),isMobile:Rt(p)||Ee(),isMobileOnly:Te(p),isTablet:Ct(p)||Ee(),isBrowser:te(p),isDesktop:te(p),isAndroid:X(L),isWinPhone:fe(L),isIOS:me(L)||Ee(),isChrome:O(P),isFirefox:z(P),isSafari:V(P),isOpera:Ae(P),isIE:Ce(P),osVersion:ie(L),osName:le(L),fullBrowserVersion:qe(P),browserVersion:Ze(P),browserName:st(P),mobileVendor:$(p),mobileModel:W(p),engineName:Bt(ve),engineVersion:It(ve),getUA:vs(Oe),isEdge:ae(P)||ft(Oe),isYandex:j(P),deviceType:Z(p),isIOS13:Ht(),isIPad13:Ee(),isIPhone13:wn(),isIPod13:yn(),isElectron:tn(),isEdgeChromium:ft(Oe),isLegacyEdge:ae(P)&&!ft(Oe),isWindows:U(L),isMacOs:Y(L),isMIUI:Pe(P),isSamsungBrowser:Fe(P)}}var ks=M(l),Ts=ne(l),xs=R(l),lc=oe(l),dc=ce(r)||Ee(),uc=Q(r),vn=Rt(l)||Ee(),Es=Te(l),Ss=Ct(l)||Ee(),Cs=te(l),fc=te(l),Bs=X(S),Is=fe(S),Ns=me(S)||Ee(),pc=O(r),mc=z(r),hc=V(r),gc=Ae(r),Ps=Ce(r),bc=ie(S),wc=le(S),yc=qe(r),vc=Ze(r),Ac=st(r),kc=$(l),Tc=W(l),xc=Bt(f),Ec=It(f),Sc=vs(N),Cc=ae(r)||ft(N),Bc=j(r),Ic=Z(l),Nc=Ht(),Pc=Ee(),Fc=wn(),Uc=yn(),Oc=tn(),Dc=ft(N),Mc=ae(r)&&!ft(N),_c=U(S),Lc=Y(S),Rc=Pe(r),Hc=Fe(r),Vc=function(u){if(!u||typeof u!="string"){console.error("No valid user agent string was provided");return}var p=b(u),P=p.device,L=p.browser,ve=p.os,Oe=p.engine,$e=p.ua;return As({device:P,browser:L,os:ve,engine:Oe,ua:$e})},Wc=function(u){var p=u.renderWithFragment,P=u.children,L=c(u,["renderWithFragment","children"]);return Bs?p?n.createElement(t.Fragment,null,P):n.createElement("div",L,P):null},Gc=function(u){var p=u.renderWithFragment,P=u.children,L=c(u,["renderWithFragment","children"]);return Cs?p?n.createElement(t.Fragment,null,P):n.createElement("div",L,P):null},$c=function(u){var p=u.renderWithFragment,P=u.children,L=c(u,["renderWithFragment","children"]);return Ps?p?n.createElement(t.Fragment,null,P):n.createElement("div",L,P):null},zc=function(u){var p=u.renderWithFragment,P=u.children,L=c(u,["renderWithFragment","children"]);return Ns?p?n.createElement(t.Fragment,null,P):n.createElement("div",L,P):null},qc=function(u){var p=u.renderWithFragment,P=u.children,L=c(u,["renderWithFragment","children"]);return vn?p?n.createElement(t.Fragment,null,P):n.createElement("div",L,P):null},Yc=function(u){var p=u.renderWithFragment,P=u.children,L=c(u,["renderWithFragment","children"]);return Ss?p?n.createElement(t.Fragment,null,P):n.createElement("div",L,P):null},jc=function(u){var p=u.renderWithFragment,P=u.children,L=c(u,["renderWithFragment","children"]);return Is?p?n.createElement(t.Fragment,null,P):n.createElement("div",L,P):null},Jc=function(u){var p=u.renderWithFragment,P=u.children;u.viewClassName,u.style;var L=c(u,["renderWithFragment","children","viewClassName","style"]);return Es?p?n.createElement(t.Fragment,null,P):n.createElement("div",L,P):null},Xc=function(u){var p=u.renderWithFragment,P=u.children,L=c(u,["renderWithFragment","children"]);return ks?p?n.createElement(t.Fragment,null,P):n.createElement("div",L,P):null},Kc=function(u){var p=u.renderWithFragment,P=u.children,L=c(u,["renderWithFragment","children"]);return Ts?p?n.createElement(t.Fragment,null,P):n.createElement("div",L,P):null},Zc=function(u){var p=u.renderWithFragment,P=u.children,L=c(u,["renderWithFragment","children"]);return xs?p?n.createElement(t.Fragment,null,P):n.createElement("div",L,P):null},Qc=function(u){var p=u.renderWithFragment,P=u.children;u.viewClassName,u.style;var L=u.condition,ve=c(u,["renderWithFragment","children","viewClassName","style","condition"]);return L?p?n.createElement(t.Fragment,null,P):n.createElement("div",ve,P):null};function el(x){return(function(u){ye(p,u);function p(P){var L;return J(this,p),L=m(this,Be(p).call(this,P)),L.isEventListenerAdded=!1,L.handleOrientationChange=L.handleOrientationChange.bind(g(L)),L.onOrientationChange=L.onOrientationChange.bind(g(L)),L.onPageLoad=L.onPageLoad.bind(g(L)),L.state={isLandscape:!1,isPortrait:!1},L}return q(p,[{key:"handleOrientationChange",value:function(){this.isEventListenerAdded||(this.isEventListenerAdded=!0);var L=window.innerWidth>window.innerHeight?90:0;this.setState({isPortrait:L===0,isLandscape:L===90})}},{key:"onOrientationChange",value:function(){this.handleOrientationChange()}},{key:"onPageLoad",value:function(){this.handleOrientationChange()}},{key:"componentDidMount",value:function(){(typeof window>"u"?"undefined":D(window))!==void 0&&vn&&(this.isEventListenerAdded?window.removeEventListener("load",this.onPageLoad,!1):(this.handleOrientationChange(),window.addEventListener("load",this.onPageLoad,!1)),window.addEventListener("resize",this.onOrientationChange,!1))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.onOrientationChange,!1)}},{key:"render",value:function(){return n.createElement(x,he({},this.props,{isLandscape:this.state.isLandscape,isPortrait:this.state.isPortrait}))}}]),p})(n.Component)}function tl(){var x=t.useState(function(){var ve=window.innerWidth>window.innerHeight?90:0;return{isPortrait:ve===0,isLandscape:ve===90,orientation:ve===0?"portrait":"landscape"}}),u=w(x,2),p=u[0],P=u[1],L=t.useCallback(function(){var ve=window.innerWidth>window.innerHeight?90:0,Oe={isPortrait:ve===0,isLandscape:ve===90,orientation:ve===0?"portrait":"landscape"};p.orientation!==Oe.orientation&&P(Oe)},[p.orientation]);return t.useEffect(function(){return(typeof window>"u"?"undefined":D(window))!==void 0&&vn&&(L(),window.addEventListener("load",L,!1),window.addEventListener("resize",L,!1)),function(){window.removeEventListener("resize",L,!1),window.removeEventListener("load",L,!1)}},[L]),p}function Fs(x){var u=x||window.navigator.userAgent;return b(u)}function nl(x){var u=x||window.navigator.userAgent,p=Fs(u),P=As(p);return[P,p]}return ee.AndroidView=Wc,ee.BrowserTypes=H,ee.BrowserView=Gc,ee.ConsoleView=Kc,ee.CustomView=Qc,ee.IEView=$c,ee.IOSView=zc,ee.MobileOnlyView=Jc,ee.MobileView=qc,ee.OsTypes=re,ee.SmartTVView=Xc,ee.TabletView=Yc,ee.WearableView=Zc,ee.WinPhoneView=jc,ee.browserName=Ac,ee.browserVersion=vc,ee.deviceDetect=Ne,ee.deviceType=Ic,ee.engineName=xc,ee.engineVersion=Ec,ee.fullBrowserVersion=yc,ee.getSelectorsByUserAgent=Vc,ee.getUA=Sc,ee.isAndroid=Bs,ee.isBrowser=Cs,ee.isChrome=pc,ee.isChromium=uc,ee.isConsole=Ts,ee.isDesktop=fc,ee.isEdge=Cc,ee.isEdgeChromium=Dc,ee.isElectron=Oc,ee.isEmbedded=lc,ee.isFirefox=mc,ee.isIE=Ps,ee.isIOS=Ns,ee.isIOS13=Nc,ee.isIPad13=Pc,ee.isIPhone13=Fc,ee.isIPod13=Uc,ee.isLegacyEdge=Mc,ee.isMIUI=Rc,ee.isMacOs=Lc,ee.isMobile=vn,ee.isMobileOnly=Es,ee.isMobileSafari=dc,ee.isOpera=gc,ee.isSafari=hc,ee.isSamsungBrowser=Hc,ee.isSmartTV=ks,ee.isTablet=Ss,ee.isWearable=xs,ee.isWinPhone=Is,ee.isWindows=_c,ee.isYandex=Bc,ee.mobileModel=Tc,ee.mobileVendor=kc,ee.osName=wc,ee.osVersion=bc,ee.parseUserAgent=b,ee.setUserAgent=xe,ee.useDeviceData=Fs,ee.useDeviceSelectors=nl,ee.useMobileOrientation=tl,ee.withOrientationChange=el,ee}var bn=rc();function io(e,t){if(!e)return e;const n=e.toLowerCase().trim();if(n==="max"||n==="all")return t||e;const o=n.match(/^(\d+(?:\.\d+)?)%$/);if(o){const s=parseFloat(o[1])/100;return((parseFloat(t)||0)*s).toFixed(8).replace(/\.?0+$/,"")||"0"}return e}const ac=({isOpen:e,onClose:t,onTransaction:n,position:o="bottom-right",modalChatStyle:s={}})=>{const{t:r,ti:a}=kn(),{messages:l,addMessage:f,updateMessageAction:S,updateMessageText:N}=Si(),[_,b]=se.useState(""),[E,v]=se.useState(!1),[C,D]=se.useState(!0),[J,I]=se.useState(null),q=se.useRef(null),K=se.useRef(null),he=se.useRef(null),ye=se.useRef(null),Be=se.useRef(null),i=se.useRef(!1),d=se.useRef(C);se.useEffect(()=>{d.current=C},[C]);const{account:c,chainData:g,chainType:m,chainTypeMoralis:w,chainId:y,isChainSupported:h}=Xn(),{config:k}=Ci(),A=y&&k?.rpcUrls?.[y]||void 0,T=se.useCallback(()=>{const M=Et.getItem("dataBuyToken");if(M)try{return JSON.parse(M)}catch{return{srcTokenAddress:"",descTokenAddress:"",amount:"",srcTokenDecimals:18,descTokenDecimals:18}}return{srcTokenAddress:"",descTokenAddress:"",amount:"",srcTokenDecimals:18,descTokenDecimals:18}},[]),F=se.useCallback(M=>{Et.setItem("dataBuyToken",JSON.stringify(M))},[]),H=se.useCallback(M=>{const R={...T(),...M};F(R)},[T,F]),re=se.useCallback(M=>{I(M),bn.isDesktop&&he.current?.focus()},[]),ge=se.useCallback(async(M,te)=>{H({descTokenAddress:M,descTokenDecimals:te||18});try{v(!0);const R=await ot({address:c?.address||"",chain:w});if(R?.success&&R?.data?.result){const ne=R.data.result;if(ne?.length>0){const oe=ne.map($=>({id:$.token_address,text:`${$.name}: ${$.balance_formatted} ${$.symbol} ($${ue($.usd_value||0)?.decimalPlaces(2).toFormat()||"0"})`,value:a("buttonBuyWith",{symbol:$.symbol}),action:"click_balance_item_user_to_buy_button",fullWidth:!0,extraData:{tokenAddress:$.token_address,symbol:$.symbol,balance:$.balance_formatted,usdValue:$.usd_value,decimals:$.decimals}}));f(a("walletBalanceSpendable",{chain:g?.name||"unknown"}),"bot",void 0,oe)}else f(a("walletNoTokensFound",{chain:g?.name||"unknown"}),"bot")}else f(r("walletFetchFailed"),"bot")}catch(R){console.error("Error fetching wallet balance:",R),f(r("walletFetchError"),"bot")}finally{v(!1)}},[H,c?.address,w,f,g?.name,r,a]),ke=se.useCallback(async(M,te,R,ne)=>{const oe=[25,50,75,100];H({srcTokenAddress:M,srcTokenDecimals:ne||18});let $=R||"0";if(M===Ye)try{const Z=await ao({chainId:y,rpcUrl:A});if(Z.isGreaterThan(0)){const X=Z.times(1e6),Y=new ue(dt(R,ne||18).toString()).minus(X);Y.isGreaterThan(0)?$=ue(Ue(BigInt(Y.toFixed(0)),18)).toFixed():$="0"}}catch(Z){console.warn("getGasPrice for swap native fee deduction failed:",Z)}const W=oe.map(Z=>({id:`percent-${Z}`,text:`${Z}%`,value:a("buttonUsePercent",{percent:String(Z),symbol:te}),action:"select_percent",extraData:{percent:Z,tokenAddress:M,tokenSymbol:te,tokenBalance:$}}));if(ue($).isZero()){f(a("insufficientFeeToken",{symbol:te}),"bot");return}f(a("selectAmountOf",{symbol:te,balance:$}),"bot",void 0,W)},[f,y,A,H,a]),xe=se.useCallback(async(M,te)=>{H({amount:(parseFloat(te)*(M/100)).toFixed(6)});const R=T(),ne=dt(R.amount,R.srcTokenDecimals||18).toString(),oe=await no({chainId:y,tokenIn:R.srcTokenAddress,tokenInAmount:ne,tokenOut:R.descTokenAddress,tokenOutRecipient:c?.address||"",slippage:"auto",accesstoken:"d6c45897b8f6"});if(oe.success&&oe.data){const $=oe.data,W=$.tokenIn,Z=$.tokenOut,X=ue(Ue(BigInt(W.amount||0),W.decimals)).decimalPlaces(6).toFormat(),U=ue(Ue(BigInt(Z.amount||0),Z.decimals)).decimalPlaces(6).toFormat(),Y=R.srcTokenAddress===Ye||R.srcTokenAddress==="";let fe=!1;if(!Y&&c?.address&&$.tx?.to)try{const j=await ro({tokenAddress:R.srcTokenAddress,ownerAddress:c.address,spenderAddress:$.tx.to,chainId:y,rpcUrl:A});fe=ue(j.toString()).isLessThan(ne)}catch(j){console.warn("Allowance check failed:",j),fe=!0}const me=$.estimatedTransactionFee?.total?ue($.estimatedTransactionFee.total):ue(0);let ie=ue(0);if(fe&&c?.address)try{const j=hn({tokenAddress:R.srcTokenAddress,spenderAddress:$.tx?.to||"",fromAddress:c.address,chainId:y});ie=await Qt({from:c.address,to:j.to,data:j.data,chainId:y,rpcUrl:A})}catch(j){console.warn("Approve fee estimation failed:",j)}const le=me.plus(ie),O=g?.nativeCurrency?.symbol||"native";let z="",Q=!1;if(c?.address&&le.isGreaterThan(0))try{const j=await gn({address:c.address,chainId:y,rpcUrl:A});if(j.isLessThan(le)){Q=!0;const V=ue(Ue(BigInt(j.toFixed(0)),18)).decimalPlaces(6).toFormat(),ce=ue(Ue(BigInt(le.toFixed(0)),18)).decimalPlaces(6).toFormat();z=a("swapFeeWarning",{symbol:O,balance:V,needed:ce})}}catch(j){console.warn("Fee balance check failed:",j)}const ae=`From: ${X} ${W.symbol}
305
363
  ⬇️
306
- To: ${U} ${K.symbol}
364
+ To: ${U} ${Z.symbol}
307
365
 
308
- `+V+`
309
- `;if(_)o(j,"bot");else if(pe){const ae=j+`You need to approve ${z.symbol} first before swapping.`,ce=[{id:"approve-for-swap",text:`Approve ${z.symbol}`,value:`Approve ${z.symbol} for swap`,action:"approve_for_swap",fullWidth:!0,extraData:{tokenAddress:R.srcTokenAddress,spenderAddress:Y.tx.to,tokenSymbol:z.symbol,tx:Y.tx}}];o(ae,"bot",void 0,ce)}else{const ae=[{id:"confirm-swap",text:"Confirm",value:"Confirm swap",action:"confirm_swap",extraData:{tx:Y.tx}}];o(j+"Ready to proceed with the swap?","bot",void 0,ae)}}else o(`⚠️ Unable to get swap estimation. Error: ${ee.errorMessage||ee.error||"Unknown error"}`,"bot")},[b,y,o,p,i?.address,l?.nativeCurrency?.symbol,h]),xe=re.useCallback(async(M,se,R)=>{try{if(se==="suggested_action"){oe.current=M,N(M);return}if(o(M,"user"),x(!1),m(!0),se)switch(await lt(500),se){case"click_buy_item_token_button":await q(R?.tokenAddress||"",R?.decimals||18);break;case"click_balance_item_user_to_buy_button":await ne(R?.tokenAddress||"",R?.symbol||"",R?.balance||"",R?.decimals||18);break;case"select_percent":await me(R?.percent||0,R?.tokenBalance||"");break;case"confirm_swap":if(R?.tx&&n){const $=R.tx,ee={from:i?.address||"",to:$.to,data:$.data,value:$.value,chainId:p},Y=o("⚙️ Transaction processing... Please wait.","bot");try{const z=await n(ee);if(z.status==="success"&&z.transactionHash){const K=l?.blockExplorers?.default?.url,X=K?`
310
- [View on Explorer](${K}/tx/${z.transactionHash})`:`
311
- Tx: ${z.transactionHash}`;T(Y.id,`⏳ Transaction submitted. Waiting for confirmation...${X}`);try{await lt(2e3),(await ts({transactionHash:z.transactionHash,chainId:p||1,rpcUrl:h})).status==="success"?T(Y.id,`✅ Transaction confirmed! Your swap has been completed.${X}`):T(Y.id,`❌ Transaction reverted on-chain. Please try again.${X}`)}catch(U){console.warn("Transaction tracking timeout:",U),T(Y.id,`⚠️ Transaction submitted but confirmation timed out. Please check manually.${X}`)}}else if(z.status==="success")T(Y.id,"✅ Transaction successful! Your swap has been completed.");else{const K=z.error?`
312
- Error: ${z.error}`:"";T(Y.id,`Transaction failed. Please try again.${K}`)}}catch(z){console.error("Transaction error:",z),T(Y.id,"Transaction failed. Please try again.")}}else o("⚠️ Transaction data not available.","bot");break;case"approve_for_swap":{const $=R?.tokenAddress||"",ee=R?.spenderAddress||"",Y=R?.tokenSymbol||"token",z=R?.tx;if(!$||!ee||!n){o("⚠️ Approval data not available.","bot");break}const K=hn({tokenAddress:$,spenderAddress:ee,fromAddress:i?.address||"",chainId:p,tokenSymbol:Y}),X={from:K.from,to:K.to,data:K.data,value:K.value,chainId:K.chainId};o(`Approving ${Y}... Please confirm in your wallet.`,"bot");try{const U=await n(X);let Z=U.status==="success";if(U.status==="success"&&U.transactionHash)try{Z=(await ts({transactionHash:U.transactionHash,chainId:p||1,rpcUrl:h})).status==="success"}catch(pe){console.warn("Approval tracking timeout:",pe),Z=!0}if(Z)o(`✅ ${Y} approved successfully!`,"bot"),o("Now you can execute the swap.","bot",void 0,[{id:"confirm-swap-after-approve",text:"Confirm Swap",value:"Confirm swap",action:"confirm_swap",fullWidth:!0,extraData:{tx:z}}]);else{const pe=U.error?`
313
- Error: ${U.error}`:"";o(`❌ Approval failed. Please try again.${pe}`,"bot")}}catch(U){console.error("Approval error:",U),o("❌ Approval failed. Please try again.","bot")}break}case"click_swap_dest_token":{const $=R?.tokenAddress||"",ee=R?.symbol||"",Y=R?.decimals||18;y({descTokenAddress:$,descTokenDecimals:Y});const K=b().srcTokenAddress||"",X=K===qe;try{const U=await rt({address:i?.address||"",chain:w});if(U?.success&&U?.data?.result){const Z=U.data.result;let pe="",ie="0";if(X){const Ae=Z.find(ke=>ke.native_token);pe=l?.nativeCurrency?.symbol||"ETH",ie=Ae?.balance_formatted||"0"}else{const Ae=Z.find(ke=>ke.token_address.toLowerCase()===K.toLowerCase());Ae&&(pe=Ae.symbol,ie=Ae.balance_formatted)}if(pe&&parseFloat(ie)>0){const ke=[25,50,75,100].map(F=>({id:`percent-${F}`,text:`${F}%`,value:`Use ${F}% of ${pe}`,action:"select_percent",extraData:{percent:F,tokenAddress:K,tokenSymbol:pe,tokenBalance:ie}}));o(`Swap ${pe} ${ee}
314
-
315
- Select the amount of ${pe} to swap:
316
-
317
- Available: ${ie} ${pe}`,"bot",void 0,ke)}else o("⚠️ You don't have the source token in your wallet or balance is 0.","bot")}else o("⚠️ Could not fetch your wallet balance.","bot")}catch(U){console.error("Error in click_swap_dest_token:",U),o("⚠️ Could not load balance. Please try again.","bot")}break}case"select_nft_to_send":{const $=R?.name||"NFT",ee=R?.contractAddress||"",Y=R?.tokenId||"",z=R?.tokenStandard||"ERC721",K=R?.amount||"1",X={contract_address:ee,token_id:Y,to_address:"",token_standard:z,amount:z==="ERC1155"?K:"1",nft_name:$};o(`📤 Send **${$}** (${z} #${Y})
318
-
319
- Please review and fill in the recipient address below:`,"bot",void 0,void 0,{action:"send_nft",parameters:X,status:"pending"});break}default:o(`Action "${se}" executed for: ${M}`,"bot")}else await lt(500),o(`Received: ${M}`,"bot");m(!1),gn.isDesktop&&Q.current?.focus()}catch($){o("Sorry, I encountered an error processing your request.","bot"),m(!1),console.error("Error handling button click:",$)}},[i?.address,o,T,l?.blockExplorers?.default?.url,l?.nativeCurrency?.symbol,p,w,b,q,ne,n,me,y,h]),Te=re.useCallback(async()=>{try{m(!0);const M=l?.tokenTrendingDefault||[],[se,R]=await Promise.allSettled([Ze.getTopGainers(u,"24h",5),Ze.getTokensDetails(M,u)]);let $=[];se.status==="fulfilled"&&se.value?.data?$=[...se.value.data]:console.warn("⚠️ Top gainers failed:"),R.status==="fulfilled"&&R.value?.data?$=[...R.value.data,...$]:console.warn("⚠️ Default tokens failed:"),$=$.filter((z,K,X)=>K===X.findIndex(U=>U.address.toLowerCase()===z.address.toLowerCase()));const ee=$.map(z=>({id:z?.symbol,text:z?.symbol,value:`Buy ${z.name} (${z?.symbol})`,action:"click_buy_item_token_button",extraData:{tokenAddress:z?.address||"",symbol:z?.symbol||"",decimals:z?.decimals||18}}));await lt(1e3),m(!1),o(`📈 Here is the list of tokens that are currently trending upwards on ${l?.name||"Unknown"} chain`,"bot");const Y=$.map((z,K)=>`${K+1}. ${z.name} (${z?.auditGoplus?.token_symbol||z.symbol||"Unknown"})
320
- $${de(z?.price||0).decimalPlaces(4).toFormat()} (${z.price_change_percentage_24h||z.priceChange}%)
366
+ `+z+`
367
+ `;if(Q)f(ae,"bot");else if(fe){const j=ae+a("swapNeedApprove",{symbol:W.symbol}),V=[{id:"approve-for-swap",text:a("swapApproveButton",{symbol:W.symbol}),value:a("swapApproveValue",{symbol:W.symbol}),action:"approve_for_swap",fullWidth:!0,extraData:{tokenAddress:R.srcTokenAddress,spenderAddress:$.tx.to,tokenSymbol:W.symbol,tx:$.tx}}];f(j,"bot",void 0,V)}else{const j=[{id:"confirm-swap",text:r("swapConfirmButton"),value:r("swapConfirmValue"),action:"confirm_swap",extraData:{tx:$.tx}}];f(ae+r("swapReadyToProceed"),"bot",void 0,j)}}else f(a("swapEstimationError",{error:oe.errorMessage||oe.error||"Unknown error"}),"bot")},[T,H,f,y,c?.address,g?.nativeCurrency?.symbol,A,r,a]),G=se.useCallback(async(M,te,R)=>{try{if(te==="suggested_action"){ye.current=M,b(M);return}if(f(M,"user"),D(!1),v(!0),te)switch(await lt(500),te){case"click_buy_item_token_button":await ge(R?.tokenAddress||"",R?.decimals||18);break;case"click_balance_item_user_to_buy_button":await ke(R?.tokenAddress||"",R?.symbol||"",R?.balance||"",R?.decimals||18);break;case"select_percent":await xe(R?.percent||0,R?.tokenBalance||"");break;case"confirm_swap":if(R?.tx&&n){const ne=R.tx,oe={from:c?.address||"",to:ne.to,data:ne.data,value:ne.value,chainId:y},$=f(r("txProcessing"),"bot");try{const W=await n(oe);if(W.status==="success"&&W.transactionHash){const Z=g?.blockExplorers?.default?.url,X=Z?`
368
+ [View on Explorer](${Z}/tx/${W.transactionHash})`:`
369
+ Tx: ${W.transactionHash}`;N($.id,r("txSubmitted")+X);try{await lt(2e3),(await so({transactionHash:W.transactionHash,chainId:y||1,rpcUrl:A})).status==="success"?N($.id,r("txConfirmedSwap")+X):N($.id,r("txRevertedSwap")+X)}catch(U){console.warn("Transaction tracking timeout:",U),N($.id,r("txTimeout")+X)}}else if(W.status==="success")N($.id,r("txSuccessfulSwap"));else{const Z=W.error?`
370
+ Error: ${W.error}`:"";N($.id,r("txFailed")+Z)}}catch(W){console.error("Transaction error:",W),N($.id,r("txFailed"))}}else f(r("txDataNotAvailable"),"bot");break;case"approve_for_swap":{const ne=R?.tokenAddress||"",oe=R?.spenderAddress||"",$=R?.tokenSymbol||"token",W=R?.tx;if(!ne||!oe||!n){f(r("approvalDataNotAvailable"),"bot");break}const Z=hn({tokenAddress:ne,spenderAddress:oe,fromAddress:c?.address||"",chainId:y,tokenSymbol:$}),X={from:Z.from,to:Z.to,data:Z.data,value:Z.value,chainId:Z.chainId};f(a("approving",{symbol:$}),"bot");try{const U=await n(X);let Y=U.status==="success";if(U.status==="success"&&U.transactionHash)try{Y=(await so({transactionHash:U.transactionHash,chainId:y||1,rpcUrl:A})).status==="success"}catch(fe){console.warn("Approval tracking timeout:",fe),Y=!0}if(Y){f(a("approvalSuccess",{symbol:$}),"bot");const fe=[{id:"confirm-swap-after-approve",text:r("confirmSwapButton"),value:r("swapConfirmValue"),action:"confirm_swap",fullWidth:!0,extraData:{tx:W}}];f(r("approvalConfirmSwap"),"bot",void 0,fe)}else{const fe=U.error?`
371
+ Error: ${U.error}`:"";f(r("approvalFailed")+fe,"bot")}}catch(U){console.error("Approval error:",U),f(r("approvalFailed"),"bot")}break}case"click_swap_dest_token":{const ne=R?.tokenAddress||"",oe=R?.symbol||"",$=R?.decimals||18;H({descTokenAddress:ne,descTokenDecimals:$});const Z=T().srcTokenAddress||"",X=Z===Ye;try{const U=await ot({address:c?.address||"",chain:w});if(U?.success&&U?.data?.result){const Y=U.data.result;let fe="",me="0";if(X){const ie=Y.find(le=>le.native_token);fe=g?.nativeCurrency?.symbol||"ETH",me=ie?.balance_formatted||"0"}else{const ie=Y.find(le=>le.token_address.toLowerCase()===Z.toLowerCase());ie&&(fe=ie.symbol,me=ie.balance_formatted)}if(fe&&parseFloat(me)>0){const le=[25,50,75,100].map(O=>({id:`percent-${O}`,text:`${O}%`,value:a("buttonUsePercent",{percent:String(O),symbol:fe}),action:"select_percent",extraData:{percent:O,tokenAddress:Z,tokenSymbol:fe,tokenBalance:me}}));f(a("swapSelectAmount",{from:fe,to:oe,balance:me}),"bot",void 0,le)}else f(r("swapNoSourceToken"),"bot")}else f(r("couldNotFetchBalance"),"bot")}catch(U){console.error("Error in click_swap_dest_token:",U),f(r("couldNotLoadBalance"),"bot")}break}case"select_nft_to_send":{const ne=R?.name||"NFT",oe=R?.contractAddress||"",$=R?.tokenId||"",W=R?.tokenStandard||"ERC721",Z=R?.amount||"1",X={contract_address:oe,token_id:$,to_address:"",token_standard:W,amount:W==="ERC1155"?Z:"1",nft_name:ne};f(a("nftSendReview",{name:ne,standard:W,tokenId:$}),"bot",void 0,void 0,{action:"send_nft",parameters:X,status:"pending"});break}default:f(`Action "${te}" executed for: ${M}`,"bot")}else await lt(500),f(`Received: ${M}`,"bot");v(!1),bn.isDesktop&&he.current?.focus()}catch(ne){f(r("errorProcessingRequest"),"bot"),v(!1),console.error("Error handling button click:",ne)}},[c?.address,f,N,g?.blockExplorers?.default?.url,g?.nativeCurrency?.symbol,y,w,T,ge,ke,n,xe,H,A,r,a]),we=se.useCallback(async()=>{try{v(!0);const M=g?.tokenTrendingDefault||[],[te,R]=await Promise.allSettled([Ke.getTopGainers(m,"24h",5),Ke.getTokensDetails(M,m)]);let ne=[];te.status==="fulfilled"&&te.value?.data?ne=[...te.value.data]:console.warn("⚠️ Top gainers failed:"),R.status==="fulfilled"&&R.value?.data?ne=[...R.value.data,...ne]:console.warn("⚠️ Default tokens failed:"),ne=ne.filter((W,Z,X)=>Z===X.findIndex(U=>U.address.toLowerCase()===W.address.toLowerCase()));const oe=ne.map(W=>({id:W?.symbol,text:W?.symbol,value:a("buttonBuyToken",{name:W.name,symbol:W?.symbol||""}),action:"click_buy_item_token_button",extraData:{tokenAddress:W?.address||"",symbol:W?.symbol||"",decimals:W?.decimals||18}}));await lt(1e3),v(!1),f(a("trendingTokensHeader",{chain:g?.name||"Unknown"}),"bot");const $=ne.map((W,Z)=>`${Z+1}. ${W.name} (${W?.auditGoplus?.token_symbol||W.symbol||"Unknown"})
372
+ $${ue(W?.price||0).decimalPlaces(4).toFormat()} (${W.price_change_percentage_24h||W.priceChange}%)
321
373
 
322
374
  ---
323
375
  `).join(`
324
- `);o(`${Y}
325
- Is there any token you want to buy?`,"bot",void 0,ee)}catch(M){console.error("Error fetching trending tokens:",M),o("Sorry, I encountered an error fetching trending tokens.","bot")}finally{m(!1)}},[o,l?.name,l?.tokenTrendingDefault,u]),W=re.useCallback(async()=>{try{m(!0);const M=await Oi({address:i?.address||"",chain:w,limit:100,exclude_spam:!0});if(M?.success&&M?.data?.result&&M.data.result.length>0){const se=M.data.result,R=se.map(ee=>{const Y=ee.normalized_metadata?.name||ee.name||`#${ee.token_id}`,z=ee.normalized_metadata?.image||ee.media?.original_media_url||"";return{id:`${ee.token_address}-${ee.token_id}`,text:`${Y} (${ee.symbol||ee.contract_type}) - ${ee.token_id}`,value:`Send ${Y}`,action:"select_nft_to_send",fullWidth:!0,extraData:{contractAddress:ee.token_address,tokenId:ee.token_id,tokenStandard:ee.contract_type,name:Y,symbol:ee.symbol,amount:ee.amount,image:z}}}),$=se.map((ee,Y)=>{const z=ee.normalized_metadata?.name||ee.name||`#${ee.token_id}`,K=ee.contract_type==="ERC1155"?` (x${ee.amount})`:"",X=ee.normalized_metadata?.image||ee.media?.original_media_url||"",U=X?`![${z}](${X})
326
- `:"🖼️ ";return`${Y+1}. ${U}**${z}**${K}
327
- ${ee.symbol||ee.contract_type} | Token ID: ${ee.token_id}`}).join(`
328
-
329
- `);await lt(500),m(!1),o(`🖼️ Your NFT Collection (${se.length} items):
376
+ `);f(`${$}${r("trendingTokensQuestion")}`,"bot",void 0,oe)}catch(M){console.error("Error fetching trending tokens:",M),f(r("trendingTokensError"),"bot")}finally{v(!1)}},[f,g?.name,g?.tokenTrendingDefault,m,r,a]),Se=se.useCallback(async()=>{try{v(!0);const M=await Oi({address:c?.address||"",chain:w,limit:100,exclude_spam:!0});if(M?.success&&M?.data?.result&&M.data.result.length>0){const te=M.data.result,R=te.map(oe=>{const $=oe.normalized_metadata?.name||oe.name||`#${oe.token_id}`,W=oe.normalized_metadata?.image||oe.media?.original_media_url||"";return{id:`${oe.token_address}-${oe.token_id}`,text:`${$} (${oe.symbol||oe.contract_type}) - ${oe.token_id}`,value:a("buttonSendNft",{name:$}),action:"select_nft_to_send",fullWidth:!0,extraData:{contractAddress:oe.token_address,tokenId:oe.token_id,tokenStandard:oe.contract_type,name:$,symbol:oe.symbol,amount:oe.amount,image:W}}}),ne=te.map((oe,$)=>{const W=oe.normalized_metadata?.name||oe.name||`#${oe.token_id}`,Z=oe.contract_type==="ERC1155"?` (x${oe.amount})`:"",X=oe.normalized_metadata?.image||oe.media?.original_media_url||"",U=X?`![${W}](${X})
377
+ `:"🖼️ ";return`${$+1}. ${U}**${W}**${Z}
378
+ ${oe.symbol||oe.contract_type} | Token ID: ${oe.token_id}`}).join(`
330
379
 
331
- ${$}
332
-
333
- Select an NFT to send:`,"bot",void 0,R)}else m(!1),o("🖼️ You don't have any NFTs in your wallet on this chain.","bot")}catch(M){console.error("Error fetching NFTs:",M),m(!1),o("Sorry, I encountered an error fetching your NFTs.","bot")}},[i?.address,w,o]),be=re.useMemo(()=>[{id:"ask",icon:"❓",text:"Ask a question",action:async()=>{x(!1),m(!0),o("I have a question","user"),await lt(1e3),m(!1),o("Ask me anything","bot")}},{id:"buy",icon:"💰",text:"Buy trending token",action:async()=>{x(!1),o("Buy trending token","user"),Re(i?.address||"")?await Te():(m(!0),await lt(1e3),o("Please connect your wallet to see trending tokens.","bot"),m(!1))}}],[o,i?.address,Te]),Ie=M=>{if(M===0)return!0;const se=a[M],R=a[M-1],$=new Date(se.timestamp),ee=new Date(R.timestamp);return $.setHours(0,0,0,0),ee.setHours(0,0,0,0),$.getTime()!==ee.getTime()};re.useEffect(()=>{ue.current?.scrollIntoView({behavior:"smooth"})},[a]),re.useEffect(()=>{e?(Q.current&&gn.isDesktop&&Q.current.focus(),ue.current?.scrollIntoView({behavior:"instant"}),ge.current&&ye.current?Date.now()-ye.current>1e4&&x(!0):x(!0),ye.current=null,ge.current=!1,setTimeout(()=>{ue.current?.scrollIntoView({behavior:"smooth"})},50)):(ye.current=Date.now(),ge.current=!Ce.current)},[e]),re.useEffect(()=>{const M=se=>{se.key==="Escape"&&e&&t()};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[e,t]);const _e=re.useCallback(async()=>{if(C?.trim()===""||L)return;const M=g,se=o(C?.trim(),"user",g?.id);N(""),B(null),m(!0),x(!1),m(!0);try{const R=zi({walletAddress:i?.address||void 0,chainName:l?.name||void 0,chainId:p||void 0,nativeSymbol:l?.nativeCurrency?.symbol||void 0}),$=a.slice(-20);let ee="";if($.length>0){ee=`
380
+ `);await lt(500),v(!1),f(a("nftCollectionHeader",{count:String(te.length),list:ne}),"bot",void 0,R)}else v(!1),f(r("nftNoCollection"),"bot")}catch(M){console.error("Error fetching NFTs:",M),v(!1),f(r("nftFetchError"),"bot")}},[c?.address,w,f,r,a]),Ge=se.useMemo(()=>[{id:"ask",icon:"❓",text:r("suggestionAskText"),action:async()=>{D(!1),v(!0),f(r("suggestionAskUserMessage"),"user"),await lt(1e3),v(!1),f(r("suggestionAskBotReply"),"bot")}},{id:"buy",icon:"💰",text:r("suggestionBuyText"),action:async()=>{D(!1),f(r("suggestionBuyText"),"user"),Le(c?.address||"")&&h?await we():(v(!0),await lt(1e3),Le(c?.address||"")&&!h?f(r("walletConnectedChainUnsupported"),"bot"):f(r("walletNotConnected"),"bot"),v(!1))}}],[f,c?.address,we,r,h]),et=M=>{if(M===0)return!0;const te=l[M],R=l[M-1],ne=new Date(te.timestamp),oe=new Date(R.timestamp);return ne.setHours(0,0,0,0),oe.setHours(0,0,0,0),ne.getTime()!==oe.getTime()};se.useEffect(()=>{q.current?.scrollIntoView({behavior:"smooth"})},[l]),se.useEffect(()=>{e?(he.current&&bn.isDesktop&&he.current.focus(),q.current?.scrollIntoView({behavior:"instant"}),i.current&&Be.current?Date.now()-Be.current>1e4&&D(!0):D(!0),Be.current=null,i.current=!1,setTimeout(()=>{q.current?.scrollIntoView({behavior:"smooth"})},50)):(Be.current=Date.now(),i.current=!d.current)},[e]),se.useEffect(()=>{const M=te=>{te.key==="Escape"&&e&&t()};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[e,t]);const He=se.useCallback(async()=>{if(_?.trim()===""||E)return;const M=J,te=f(_?.trim(),"user",J?.id);b(""),I(null),v(!0),D(!1),v(!0);try{const R=qi({walletAddress:c?.address||void 0,chainName:g?.name||void 0,chainId:y||void 0,nativeSymbol:g?.nativeCurrency?.symbol||void 0}),ne=l.slice(-20);let oe="";if(ne.length>0){oe=`
334
381
 
335
382
  ## CONVERSATION HISTORY:
336
- `;for(const K of $)if(K.sender==="user")ee+=`User: ${K.text}
337
- `;else{const X=K.text.length>400?K.text.substring(0,400)+"...":K.text;ee+=`Assistant: ${X}
338
- `}ee+=`
383
+ `;for(const Z of ne)if(Z.sender==="user")oe+=`User: ${Z.text}
384
+ `;else{const X=Z.text.length>400?Z.text.substring(0,400)+"...":Z.text;oe+=`Assistant: ${X}
385
+ `}oe+=`
339
386
  ---
340
- `}let Y=C?.trim();M&&(Y=`[Replying to ${M.sender==="user"?"my previous":"your"} message: "${M.text}"]
387
+ `}let $=_?.trim();M&&($=`[Replying to ${M.sender==="user"?"my previous":"your"} message: "${M.text}"]
341
388
 
342
- ${Y}`);const z=await Pi({prompt:Y,model:"gpt-4.1-mini",stream:!1,systemPrompt:R+ee});if(z.success&&z.data){const K=z.data.text||"";let X=null;try{let U=K?.trim();U.startsWith("```json")?U=U.replace(/^```json\s*/,"").replace(/\s*```$/,""):U.startsWith("```")&&(U=U.replace(/^```\s*/,"").replace(/\s*```$/,"")),X=JSON.parse(U)}catch{X=null}if(X&&X.action&&X.action!=="chat")if(X.action==="buy_token"){const U=X.parameters?.token_symbol||"";let Z=X.parameters?.contract_address||"",pe=18;if(Z)try{const ie=await Ze.getTokensDetails([Z],u);ie?.data?.[0]&&(pe=ie.data[0].decimals||18)}catch(ie){console.warn("getTokensDetails for buy_token failed:",ie)}if(!Z&&U&&i?.address)try{const ie=await rt({address:i.address,chain:w});if(ie?.success&&ie?.data?.result){const Ae=ie.data.result,ke=Ae.find(F=>F.token_address.toLowerCase()===Z.toLowerCase())||Ae.find(F=>F.symbol.toUpperCase()===U.toUpperCase());ke&&(Z=ke.token_address,pe=ke.decimals)}if(!Z){const Ae=l.tokenTrendingDefault||[],[ke,F]=await Promise.allSettled([Ze.getTopGainers(u,"24h",10),Ze.getTokensDetails(Ae,u)]),V=[];ke.status==="fulfilled"&&ke.value?.data&&V.push(...ke.value.data),F.status==="fulfilled"&&F.value?.data&&V.push(...F.value.data);const _=V.find(j=>j.address?.toLowerCase()===Z.toLowerCase())||V.find(j=>j.symbol?.toUpperCase()===U.toUpperCase());_&&(Z=_.address,pe=_.decimals||18)}}catch(ie){console.warn("Token lookup for buy failed:",ie)}Z?(o(X.message||`🛒 I'll help you buy ${U}. Let me show your available tokens to trade with.`,"bot",se.id),await q(Z,pe)):(o(X.message||`I couldn't find the token "${U}" on this chain. Here are the trending tokens you can buy:`,"bot",se.id),await Te())}else if(X.action==="swap_token"){const U={...X.parameters||{}},Z=U.token_in==="native"||U.token_in_symbol?.toUpperCase()===l?.nativeCurrency?.symbol?.toUpperCase(),pe=U.token_out==="native"||U.token_out_symbol?.toUpperCase()===l?.nativeCurrency?.symbol?.toUpperCase();if(pe&&(U.token_out=qe),!Z&&(U.token_in||U.token_in_symbol)&&i?.address)try{const F=await rt({address:i.address,chain:w});if(F?.success&&F?.data?.result){const V=F.data.result,_=U.token_in?V.find(j=>j.token_address.toLowerCase()===U.token_in.toLowerCase()):V.find(j=>j.symbol.toUpperCase()===U.token_in_symbol.toUpperCase());_&&(U.token_in=_.token_address,U.token_in_decimals=String(_.decimals))}}catch(F){console.warn("Resolve token_in failed:",F)}if(!pe&&(U.token_out||U.token_out_symbol)&&i?.address)try{const F=await rt({address:i.address,chain:w});if(F?.success&&F?.data?.result){const V=F.data.result,_=U.token_out?V.find(j=>j.token_address.toLowerCase()===U.token_out.toLowerCase()):V.find(j=>j.symbol.toUpperCase()===U.token_out_symbol.toUpperCase());_&&(U.token_out=_.token_address,U.token_out_decimals=String(_.decimals))}}catch(F){console.warn("Resolve token_out failed:",F)}const ie=!!(U.token_in||Z),Ae=!!U.token_out,ke=!!U.amount;if(ie&&Ae&&ke){o(X.message||"🔄 Preparing your swap...","bot",se.id);try{const F=[];U.token_out&&F.push(U.token_out),U.token_in&&!Z&&F.push(U.token_in);let V=18,_=18;if(F.length>0)try{const G=await Ze.getTokensDetails(F,u);if(G?.data)for(const J of G.data)!Z&&J.address.toLowerCase()===U.token_in?.toLowerCase()&&(V=J.decimals||18),J.address.toLowerCase()===U.token_out?.toLowerCase()&&(_=J.decimals||18)}catch(G){console.warn("getTokensDetails failed, using default decimals:",G)}if(i?.address)try{const G=await rt({address:i.address,chain:w});if(G?.success&&G?.data?.result){const J=G.data.result;if(Z){const ve=J.find($e=>$e.native_token);let Se=ve?.balance_formatted||"0";try{const $e=await ss({chainId:p,rpcUrl:h});if($e.isGreaterThan(0)){const ot=$e.times(1e6),ft=new de(ve?.balance||"0").minus(ot);ft.isGreaterThan(0)?Se=de(Ue(BigInt(ft.toFixed(0)),ve?.decimals||18)).toFixed():Se="0"}}catch($e){console.warn("getGasPrice for swap native fee deduction failed:",$e)}U.amount=rs(U.amount,Se);const Be=parseFloat(Se),je=parseFloat(U.amount);if(Be<je){o(`⚠️ Insufficient balance! You have ${Be.toFixed(6)} ${l?.nativeCurrency?.symbol||"native"} but need ${U.amount}. Please top up your wallet or reduce the amount.`,"bot"),m(!1);return}}else{const ve=J.find(je=>je.token_address.toLowerCase()===U.token_in?.toLowerCase());if(!ve){o(`⚠️ You don't have ${U.token_in_symbol||U.token_in} in your wallet. Please acquire some first before swapping.`,"bot"),m(!1);return}U.amount=rs(U.amount,ve.balance_formatted||"0");const Se=parseFloat(ve.balance_formatted||"0"),Be=parseFloat(U.amount);if(Se<Be){o(`⚠️ Insufficient balance! You have ${Se.toFixed(6)} ${ve.symbol} (~$${ve.usd_value?.toFixed(2)||"0"}) but need ${U.amount}. Please reduce the amount or add more tokens.`,"bot"),m(!1);return}}}}catch(G){console.warn("Balance check failed:",G)}const j=Z?qe:U.token_in;y({srcTokenAddress:j,descTokenAddress:U.token_out,amount:U.amount,srcTokenDecimals:V,descTokenDecimals:_});const ae=dt(U.amount,V).toString(),ce=await $n({chainId:p,tokenIn:j,tokenInAmount:ae,tokenOut:U.token_out,tokenOutRecipient:i?.address||"",slippage:"auto",accesstoken:"d6c45897b8f6"});if(ce.success&&ce.data){const G=ce.data,J=G.tokenIn,ve=G.tokenOut,Se=de(Ue(BigInt(J.amount||0),J.decimals)).decimalPlaces(6).toFormat(),Be=de(Ue(BigInt(ve.amount||0),ve.decimals)).decimalPlaces(6).toFormat();let je=!1;if(!Z&&i?.address&&G.tx?.to)try{const Pe=await ns({tokenAddress:j,ownerAddress:i.address,spenderAddress:G.tx.to,chainId:p,rpcUrl:h});je=de(Pe.toString()).isLessThan(ae)}catch(Pe){console.warn("Allowance check failed (CASE 1):",Pe),je=!0}const $e=G.estimatedTransactionFee?.total?de(G.estimatedTransactionFee.total):de(0);let ot=de(0);if(je&&i?.address)try{const Pe=hn({tokenAddress:j,spenderAddress:G.tx?.to||"",fromAddress:i.address,chainId:p});ot=await Zt({from:i.address,to:Pe.to,data:Pe.data,chainId:p,rpcUrl:h})}catch(Pe){console.warn("Approve fee estimation failed:",Pe)}const Ct=$e.plus(ot),ft=l?.nativeCurrency?.symbol||"native";let $t="",en=!1;if(i?.address&&Ct.isGreaterThan(0))try{const Pe=await mn({address:i.address,chainId:p,rpcUrl:h});if(Pe.isLessThan(Ct)){en=!0;const bn=de(Ue(BigInt(Pe.toFixed(0)),18)).decimalPlaces(6).toFormat(),et=de(Ue(BigInt(Ct.toFixed(0)),18)).decimalPlaces(6).toFormat();$t=`
343
- ⚠️ **Insufficient ${ft} for fees!**
344
- You have ${bn} ${ft} but need ~${et} ${ft}.
345
- `}}catch(Pe){console.warn("Fee balance check failed:",Pe)}const Lt=`From: ${Se} ${J.symbol}
389
+ ${$}`);const W=await Fi({prompt:$,model:"gpt-4.1-mini",stream:!1,systemPrompt:R+oe});if(W.success&&W.data){const Z=W.data.text||"";let X=null;try{let U=Z?.trim();U.startsWith("```json")?U=U.replace(/^```json\s*/,"").replace(/\s*```$/,""):U.startsWith("```")&&(U=U.replace(/^```\s*/,"").replace(/\s*```$/,"")),X=JSON.parse(U)}catch{X=null}if(X&&X.action&&X.action!=="chat")if(X.action==="buy_token"){const U=X.parameters?.token_symbol||"";let Y=X.parameters?.contract_address||"",fe=18;if(Y)try{const me=await Ke.getTokensDetails([Y],m);me?.data?.[0]&&(fe=me.data[0].decimals||18)}catch(me){console.warn("getTokensDetails for buy_token failed:",me)}if(!Y&&U&&c?.address)try{const me=await ot({address:c.address,chain:w});if(me?.success&&me?.data?.result){const ie=me.data.result,le=ie.find(O=>O.token_address.toLowerCase()===Y.toLowerCase())||ie.find(O=>O.symbol.toUpperCase()===U.toUpperCase());le&&(Y=le.token_address,fe=le.decimals)}if(!Y){const ie=g.tokenTrendingDefault||[],[le,O]=await Promise.allSettled([Ke.getTopGainers(m,"24h",10),Ke.getTokensDetails(ie,m)]),z=[];le.status==="fulfilled"&&le.value?.data&&z.push(...le.value.data),O.status==="fulfilled"&&O.value?.data&&z.push(...O.value.data);const Q=z.find(ae=>ae.address?.toLowerCase()===Y.toLowerCase())||z.find(ae=>ae.symbol?.toUpperCase()===U.toUpperCase());Q&&(Y=Q.address,fe=Q.decimals||18)}}catch(me){console.warn("Token lookup for buy failed:",me)}Y?(f(X.message||`🛒 I'll help you buy ${U}. Let me show your available tokens to trade with.`,"bot",te.id),await ge(Y,fe)):(f(X.message||`I couldn't find the token "${U}" on this chain. Here are the trending tokens you can buy:`,"bot",te.id),await we())}else if(X.action==="swap_token"){const U={...X.parameters||{}},Y=U.token_in==="native"||U.token_in_symbol?.toUpperCase()===g?.nativeCurrency?.symbol?.toUpperCase(),fe=U.token_out==="native"||U.token_out_symbol?.toUpperCase()===g?.nativeCurrency?.symbol?.toUpperCase();if(fe&&(U.token_out=Ye),!Y&&(U.token_in||U.token_in_symbol)&&c?.address)try{const O=await ot({address:c.address,chain:w});if(O?.success&&O?.data?.result){const z=O.data.result,Q=U.token_in?z.find(ae=>ae.token_address.toLowerCase()===U.token_in.toLowerCase()):z.find(ae=>ae.symbol.toUpperCase()===U.token_in_symbol.toUpperCase());Q&&(U.token_in=Q.token_address,U.token_in_decimals=String(Q.decimals))}}catch(O){console.warn("Resolve token_in failed:",O)}if(!fe&&(U.token_out||U.token_out_symbol)&&c?.address)try{const O=await ot({address:c.address,chain:w});if(O?.success&&O?.data?.result){const z=O.data.result,Q=U.token_out?z.find(ae=>ae.token_address.toLowerCase()===U.token_out.toLowerCase()):z.find(ae=>ae.symbol.toUpperCase()===U.token_out_symbol.toUpperCase());Q&&(U.token_out=Q.token_address,U.token_out_decimals=String(Q.decimals))}}catch(O){console.warn("Resolve token_out failed:",O)}const me=!!(U.token_in||Y),ie=!!U.token_out,le=!!U.amount;if(me&&ie&&le){f(X.message||"🔄 Preparing your swap...","bot",te.id);try{const O=[];U.token_out&&O.push(U.token_out),U.token_in&&!Y&&O.push(U.token_in);let z=18,Q=18;if(O.length>0)try{const ce=await Ke.getTokensDetails(O,m);if(ce?.data)for(const Ae of ce.data)!Y&&Ae.address.toLowerCase()===U.token_in?.toLowerCase()&&(z=Ae.decimals||18),Ae.address.toLowerCase()===U.token_out?.toLowerCase()&&(Q=Ae.decimals||18)}catch(ce){console.warn("getTokensDetails failed, using default decimals:",ce)}if(c?.address)try{const ce=await ot({address:c.address,chain:w});if(ce?.success&&ce?.data?.result){const Ae=ce.data.result;if(Y){const Ce=Ae.find(Ze=>Ze.native_token);let Pe=Ce?.balance_formatted||"0";try{const Ze=await ao({chainId:y,rpcUrl:A});if(Ze.isGreaterThan(0)){const st=Ze.times(1e6),It=new ue(Ce?.balance||"0").minus(st);It.isGreaterThan(0)?Pe=ue(Ue(BigInt(It.toFixed(0)),Ce?.decimals||18)).toFixed():Pe="0"}}catch(Ze){console.warn("getGasPrice for swap native fee deduction failed:",Ze)}U.amount=io(U.amount,Pe);const Fe=parseFloat(Pe),qe=parseFloat(U.amount);if(Fe<qe){f(a("swapInsufficientNativeBalance",{balance:Fe.toFixed(6),symbol:g?.nativeCurrency?.symbol||"native",amount:U.amount}),"bot"),v(!1);return}}else{const Ce=Ae.find(qe=>qe.token_address.toLowerCase()===U.token_in?.toLowerCase());if(!Ce){f(a("swapTokenNotInWallet",{symbol:U.token_in_symbol||U.token_in}),"bot"),v(!1);return}U.amount=io(U.amount,Ce.balance_formatted||"0");const Pe=parseFloat(Ce.balance_formatted||"0"),Fe=parseFloat(U.amount);if(Pe<Fe){f(a("swapInsufficientTokenBalance",{balance:Pe.toFixed(6),symbol:Ce.symbol,amount:U.amount}),"bot"),v(!1);return}}}}catch(ce){console.warn("Balance check failed:",ce)}const ae=Y?Ye:U.token_in;H({srcTokenAddress:ae,descTokenAddress:U.token_out,amount:U.amount,srcTokenDecimals:z,descTokenDecimals:Q});const j=dt(U.amount,z).toString(),V=await no({chainId:y,tokenIn:ae,tokenInAmount:j,tokenOut:U.token_out,tokenOutRecipient:c?.address||"",slippage:"auto",accesstoken:"d6c45897b8f6"});if(V.success&&V.data){const ce=V.data,Ae=ce.tokenIn,Ce=ce.tokenOut,Pe=ue(Ue(BigInt(Ae.amount||0),Ae.decimals)).decimalPlaces(6).toFormat(),Fe=ue(Ue(BigInt(Ce.amount||0),Ce.decimals)).decimalPlaces(6).toFormat();let qe=!1;if(!Y&&c?.address&&ce.tx?.to)try{const Ee=await ro({tokenAddress:ae,ownerAddress:c.address,spenderAddress:ce.tx.to,chainId:y,rpcUrl:A});qe=ue(Ee.toString()).isLessThan(j)}catch(Ee){console.warn("Allowance check failed (CASE 1):",Ee),qe=!0}const Ze=ce.estimatedTransactionFee?.total?ue(ce.estimatedTransactionFee.total):ue(0);let st=ue(0);if(qe&&c?.address)try{const Ee=hn({tokenAddress:ae,spenderAddress:ce.tx?.to||"",fromAddress:c.address,chainId:y});st=await Qt({from:c.address,to:Ee.to,data:Ee.data,chainId:y,rpcUrl:A})}catch(Ee){console.warn("Approve fee estimation failed:",Ee)}const Bt=Ze.plus(st),It=g?.nativeCurrency?.symbol||"native";let tn="",ft=!1;if(c?.address&&Bt.isGreaterThan(0))try{const Ee=await gn({address:c.address,chainId:y,rpcUrl:A});if(Ee.isLessThan(Bt)){ft=!0;const wn=ue(Ue(BigInt(Ee.toFixed(0)),18)).decimalPlaces(6).toFormat(),yn=ue(Ue(BigInt(Bt.toFixed(0)),18)).decimalPlaces(6).toFormat();tn=a("swapFeeWarning",{symbol:It,balance:wn,needed:yn})}}catch(Ee){console.warn("Fee balance check failed:",Ee)}const Ht=`From: ${Pe} ${Ae.symbol}
346
390
  ⬇️
347
- To: ${Be} ${ve.symbol}
348
-
349
- `+$t+`
350
- `;if(en)o(Lt,"bot");else if(je){const Pe=[{id:"approve-for-swap",text:`Approve ${J.symbol}`,value:`Approve ${J.symbol} for swap`,action:"approve_for_swap",fullWidth:!0,extraData:{tokenAddress:j,spenderAddress:G.tx.to,tokenSymbol:J.symbol,tx:G.tx}}];o(Lt+`You need to approve ${J.symbol} first before swapping.`,"bot",void 0,Pe)}else{const Pe=[{id:"confirm-swap",text:"Yes",value:"Confirm swap",action:"confirm_swap",extraData:{tx:G.tx}}];o(Lt+"Ready to proceed with the swap?","bot",void 0,Pe)}}else o(`⚠️ Unable to get swap estimation. Error: ${ce.errorMessage||ce.error||"Unknown error"}`,"bot")}catch(F){console.error("Swap estimation error:",F),o("⚠️ Failed to get swap estimation. Please try again.","bot")}}else if(ie&&Ae&&!ke){let F=Z?18:parseInt(U.token_in_decimals||"18",10),V=parseInt(U.token_out_decimals||"18",10);const _=[];if(U.token_out&&_.push(U.token_out),U.token_in&&!Z&&_.push(U.token_in),_.length>0)try{const j=await Ze.getTokensDetails(_,u);if(j?.data)for(const ae of j.data)!Z&&ae.address.toLowerCase()===U.token_in?.toLowerCase()&&(F=ae.decimals||F),ae.address.toLowerCase()===U.token_out?.toLowerCase()&&(V=ae.decimals||V)}catch(j){console.warn("getTokensDetails failed in CASE 2, using fallback decimals:",j)}if(y({descTokenAddress:U.token_out,descTokenDecimals:V}),Z)try{const j=await rt({address:i?.address||"",chain:w});if(j?.success&&j?.data?.result){const ce=j.data.result.find(Be=>Be.native_token),G=l?.nativeCurrency?.symbol||"ETH";let J=ce?.balance_formatted||"0";try{const Be=await ss({chainId:p,rpcUrl:h});if(Be.isGreaterThan(0)){const je=Be.times(1e6),ot=new de(ce?.balance||"0").minus(je);ot.isGreaterThan(0)?J=de(Ue(BigInt(ot.toFixed(0)),ce?.decimals||18)).toFixed():J="0"}}catch(Be){console.warn("getGasPrice for swap native fee deduction (CASE 2) failed:",Be)}y({srcTokenAddress:qe,srcTokenDecimals:F});const Se=[25,50,75,100].map(Be=>({id:`percent-${Be}`,text:`${Be}%`,value:`Use ${Be}% of ${G}`,action:"select_percent",extraData:{percent:Be,tokenAddress:qe,tokenSymbol:G,tokenBalance:J}}));o(`📊 Select the amount of ${G} to swap:
391
+ To: ${Fe} ${Ce.symbol}
351
392
 
352
- Available: ${J} ${G}`,"bot",se.id,Se)}else o("⚠️ Could not fetch your wallet balance. Please try again.","bot")}catch(j){console.warn("Native balance fetch failed:",j),o("⚠️ Could not fetch your balance. Please try again.","bot")}else{const j=U.token_in_symbol||"Token";y({srcTokenAddress:U.token_in,srcTokenDecimals:F});try{const ae=await rt({address:i?.address||"",chain:w});if(ae?.success&&ae?.data?.result){const G=ae.data.result.find(Se=>Se.token_address.toLowerCase()===U.token_in?.toLowerCase());if(!G){o(`⚠️ You don't have ${j} in your wallet. Please acquire some first before swapping.`,"bot"),m(!1);return}const ve=[25,50,75,100].map(Se=>({id:`percent-${Se}`,text:`${Se}%`,value:`Use ${Se}% of ${G.symbol}`,action:"select_percent",extraData:{percent:Se,tokenAddress:G.token_address,tokenSymbol:G.symbol,tokenBalance:G.balance_formatted}}));o(`📊 Select the amount of ${G.symbol} to swap:
353
-
354
- Available: ${G.balance_formatted} ${G.symbol} (~$${G.usd_value?.toFixed(2)||"0"})`,"bot",se.id,ve)}else o("⚠️ Could not fetch your wallet balance. Please try again.","bot")}catch(ae){console.warn("Token balance fetch failed:",ae),o("⚠️ Could not fetch your balance. Please try again.","bot")}}}else if(!ie&&Ae){o(X.message||"🔄 Please choose which token you want to swap from:","bot",se.id);let F=parseInt(U.token_out_decimals||"18",10);if(U.token_out)try{const V=await Ze.getTokensDetails([U.token_out],u);V?.data?.[0]&&(F=V.data[0].decimals||F)}catch(V){console.warn("getTokensDetails failed in CASE 3, using fallback:",V)}await q(U.token_out,F)}else if(ie&&!Ae){let F=Z?18:parseInt(U.token_in_decimals||"18",10);if(U.token_in&&!Z)try{const V=await Ze.getTokensDetails([U.token_in],u);V?.data?.[0]&&(F=V.data[0].decimals||F)}catch(V){console.warn("getTokensDetails failed in CASE 4, using fallback:",V)}y(Z?{srcTokenAddress:qe,srcTokenDecimals:18}:{srcTokenAddress:U.token_in,srcTokenDecimals:F}),o(X.message||`🔄 You want to swap ${U.token_in_symbol||"your token"}. Please choose which token you want to receive:`,"bot",se.id);try{m(!0);const V=l?.tokenTrendingDefault||[],[_,j]=await Promise.allSettled([Ze.getTopGainers(u,"24h",5),Ze.getTokensDetails(V,u)]);let ae=[];_.status==="fulfilled"&&_.value?.data&&(ae=[..._.value.data]),j.status==="fulfilled"&&j.value?.data&&(ae=[...j.value.data,...ae]),ae=ae.filter((G,J,ve)=>J===ve.findIndex(Se=>Se.address.toLowerCase()===G.address.toLowerCase()));const ce=ae.map(G=>({id:G?.symbol,text:G?.symbol,value:`Swap to ${G.name} (${G?.symbol})`,action:"click_swap_dest_token",extraData:{tokenAddress:G?.address||"",symbol:G?.symbol||"",decimals:G?.decimals||18}}));o(`📈 Trending tokens on ${l?.name||"Unknown"} chain. Pick the token you want to receive:`,"bot",void 0,ce)}catch(V){console.error("Error fetching trending tokens for swap:",V),o("⚠️ Could not load token list. Please specify the destination token.","bot")}finally{m(!1)}}else o(X.message||'🔄 I need more details for your swap. Please specify which tokens you want to swap (e.g. "Swap 1 ETH to USDC").',"bot",se.id)}else if(X.action==="view_nfts")o(X.message||"🖼️ Let me show you your NFT collection!","bot",se.id),await W();else{const U=$i(X.action);let Z={...X.parameters||{}},pe;const ie=["send_token","approve_token"].includes(X.action)&&(Z.contract_address||Z.token_symbol),Ae=X.action==="send_native",ke=X.action==="send_nft"&&Z.contract_address;if(ie&&i?.address)try{const F=await rt({address:i.address,chain:w});if(F?.success&&F?.data?.result){const V=F.data.result,_=Z.contract_address?V.find(j=>j.token_address.toLowerCase()===Z.contract_address.toLowerCase()):V.find(j=>j.symbol.toUpperCase()===Z.token_symbol.toUpperCase());_&&(Z={...Z,contract_address:_.token_address,decimals:String(_.decimals)},pe={symbol:_.symbol,name:_.name,balance:_.balance,balanceFormatted:_.balance_formatted,usdValue:_.usd_value,usdPrice:_.usd_price,decimals:_.decimals,logo:_.logo||_.thumbnail,contractAddress:_.token_address})}}catch(F){console.warn("Token enrichment failed:",F)}if(ie&&!pe&&Z.contract_address)try{const F=await Bi({address:Z.contract_address,chain:w});if(F?.success&&F?.data){const V=F.data;pe={symbol:V.symbol,name:V.name,balance:"0",balanceFormatted:"0",usdPrice:V.usd_price,decimals:V.decimals,logo:V.logo,contractAddress:Z.contract_address},Z={...Z,decimals:String(V.decimals)}}}catch(F){console.warn("Token metadata fallback failed:",F)}if(Ae&&i?.address)try{const F=await rt({address:i.address,chain:w});if(F?.success&&F?.data?.result){const _=F.data.result.find(j=>j.native_token);if(_){let j=_.balance_formatted,ae=_.balance;try{const ce=new de(_.balance),G="0x"+BigInt(ce.toFixed(0)).toString(16),J=await Zt({from:i.address,to:i.address,data:"0x",value:G,chainId:p,rpcUrl:h});if(J.isGreaterThan(0)){const ve=ce.minus(J);ve.isGreaterThan(0)?(ae=ve.toFixed(0),j=de(Ue(BigInt(ve.toFixed(0)),_.decimals)).toFixed()):(ae="0",j="0")}}catch(ce){console.warn("Estimate send fee for send_native failed:",ce)}pe={symbol:_.symbol,name:_.name,balance:ae,balanceFormatted:j,usdValue:_.usd_value,usdPrice:_.usd_price,decimals:_.decimals,logo:_.logo||_.thumbnail,contractAddress:qe}}}}catch(F){console.warn("Native token balance fetch failed:",F)}if(ke)try{const F=await Ni({address:Z.contract_address,chain:w});if(F?.success&&F?.data){const V=F.data;V.contract_type&&(Z={...Z,token_standard:V.contract_type}),!Z.nft_name&&V.name&&(Z={...Z,nft_name:V.name})}}catch(F){console.warn("NFT contract metadata fetch failed:",F)}if(Z.amount&&pe?.balanceFormatted&&(X.action==="send_token"||X.action==="send_native")&&(Z.amount=rs(Z.amount,pe.balanceFormatted)),U){const F=X.message||"Please review and complete the form below.";o(F,"bot",se.id,void 0,{action:X.action,parameters:Z,status:"pending",tokenInfo:pe})}else o(X.message||K,"bot",se.id)}else if(X&&X.action==="chat"){const U=X.token_mentions||[],Z=X.suggested_actions||[],pe=[];U.length>0&&U.forEach(ie=>{pe.push({id:`buy-${ie.symbol}`,text:`💰 Buy ${ie.symbol}`,value:`Buy ${ie.symbol}`,action:"click_buy_item_token_button",extraData:{tokenAddress:ie.contract_address||"",symbol:ie.symbol,decimals:ie.decimals||18},fullWidth:!0})}),Z.length>0&&Z.forEach((ie,Ae)=>{pe.push({id:`suggested-${Ae}-${ie.label}`,text:ie.label,value:ie.prompt,action:"suggested_action",fullWidth:!0})}),pe.length>0?o(X.message||K,"bot",se.id,pe):o(X.message||K,"bot",se.id)}else o(K,"bot",se.id)}else o("Sorry, I encountered an error processing your request.","bot",se.id)}catch(R){console.error("Error getting AI response:",R),o("Sorry, I encountered an error processing your request.","bot",se.id)}m(!1),await lt(50),gn.isDesktop&&Q.current?.focus()},[C,L,a,o,g,i?.address,l?.name,l?.nativeCurrency?.symbol,l?.tokenTrendingDefault,p,u,w,q,Te,W,y,h]);re.useEffect(()=>{oe.current&&C===oe.current&&(oe.current=null,_e())},[C,_e]);const Qe=re.useCallback(async(M,se,R)=>{try{if(c(R,"submitted"),M==="swap_token"){let $=18;if(se.token_in&&se.token_in!==qe)try{const z=await Ze.getTokensDetails([se.token_in],u);z?.data?.[0]&&($=z.data[0].decimals||18)}catch(z){console.warn("getTokensDetails failed in ActionForm swap, using default 18:",z)}const ee=dt(se.amount||"0",$).toString(),Y=await $n({chainId:p,tokenIn:se.token_in||"",tokenInAmount:ee,tokenOut:se.token_out||"",tokenOutRecipient:i?.address||"",slippage:"auto",accesstoken:"d6c45897b8f6"});if(Y.success&&Y.data){const z=Y.data,K=z.tokenIn,X=z.tokenOut,U=de(Ue(BigInt(K.amount||0),K.decimals)).decimalPlaces(6).toFormat(),Z=de(Ue(BigInt(X.amount||0),X.decimals)).decimalPlaces(6).toFormat(),pe=!se.token_in||se.token_in===qe;let ie=!1;if(!pe&&i?.address&&z.tx?.to)try{const ce=await ns({tokenAddress:se.token_in,ownerAddress:i.address,spenderAddress:z.tx.to,chainId:p,rpcUrl:h});ie=de(ce.toString()).isLessThan(ee)}catch(ce){console.warn("Allowance check failed in ActionForm swap:",ce)}const Ae=z.estimatedTransactionFee?.total?de(z.estimatedTransactionFee.total):de(0);let ke=de(0);if(ie&&i?.address)try{const ce=hn({tokenAddress:se.token_in,spenderAddress:z.tx?.to||"",fromAddress:i.address,chainId:p});ke=await Zt({from:i.address,to:ce.to,data:ce.data,chainId:p,rpcUrl:h})}catch(ce){console.warn("Approve fee estimation failed:",ce)}const F=Ae.plus(ke),V=l?.nativeCurrency?.symbol||"native";let _="",j=!1;if(i?.address&&F.isGreaterThan(0))try{const ce=await mn({address:i.address,chainId:p,rpcUrl:h});if(ce.isLessThan(F)){j=!0;const G=de(Ue(BigInt(ce.toFixed(0)),18)).decimalPlaces(6).toFormat(),J=de(Ue(BigInt(F.toFixed(0)),18)).decimalPlaces(6).toFormat();_=`
355
- ⚠️ **Insufficient ${V} for fees!**
356
- You have ${G} ${V} but need ~${J} ${V}.
357
- `}}catch(ce){console.warn("Fee balance check failed:",ce)}const ae=`From: ${U} ${K.symbol}
393
+ `+tn+`
394
+ `;if(ft)f(Ht,"bot");else if(qe){const Ee=[{id:"approve-for-swap",text:a("swapApproveButton",{symbol:Ae.symbol}),value:a("swapApproveValue",{symbol:Ae.symbol}),action:"approve_for_swap",fullWidth:!0,extraData:{tokenAddress:ae,spenderAddress:ce.tx.to,tokenSymbol:Ae.symbol,tx:ce.tx}}];f(Ht+a("swapNeedApprove",{symbol:Ae.symbol}),"bot",void 0,Ee)}else{const Ee=[{id:"confirm-swap",text:"Yes",value:r("swapConfirmValue"),action:"confirm_swap",extraData:{tx:ce.tx}}];f(Ht+r("swapReadyToProceed"),"bot",void 0,Ee)}}else f(a("swapEstimationError",{error:V.errorMessage||V.error||"Unknown error"}),"bot")}catch(O){console.error("Swap estimation error:",O),f(r("swapEstimationFailed"),"bot")}}else if(me&&ie&&!le){let O=Y?18:parseInt(U.token_in_decimals||"18",10),z=parseInt(U.token_out_decimals||"18",10);const Q=[];if(U.token_out&&Q.push(U.token_out),U.token_in&&!Y&&Q.push(U.token_in),Q.length>0)try{const ae=await Ke.getTokensDetails(Q,m);if(ae?.data)for(const j of ae.data)!Y&&j.address.toLowerCase()===U.token_in?.toLowerCase()&&(O=j.decimals||O),j.address.toLowerCase()===U.token_out?.toLowerCase()&&(z=j.decimals||z)}catch(ae){console.warn("getTokensDetails failed in CASE 2, using fallback decimals:",ae)}if(H({descTokenAddress:U.token_out,descTokenDecimals:z}),Y)try{const ae=await ot({address:c?.address||"",chain:w});if(ae?.success&&ae?.data?.result){const V=ae.data.result.find(Fe=>Fe.native_token),ce=g?.nativeCurrency?.symbol||"ETH";let Ae=V?.balance_formatted||"0";try{const Fe=await ao({chainId:y,rpcUrl:A});if(Fe.isGreaterThan(0)){const qe=Fe.times(1e6),st=new ue(V?.balance||"0").minus(qe);st.isGreaterThan(0)?Ae=ue(Ue(BigInt(st.toFixed(0)),V?.decimals||18)).toFixed():Ae="0"}}catch(Fe){console.warn("getGasPrice for swap native fee deduction (CASE 2) failed:",Fe)}H({srcTokenAddress:Ye,srcTokenDecimals:O});const Pe=[25,50,75,100].map(Fe=>({id:`percent-${Fe}`,text:`${Fe}%`,value:a("buttonUsePercent",{percent:String(Fe),symbol:ce}),action:"select_percent",extraData:{percent:Fe,tokenAddress:Ye,tokenSymbol:ce,tokenBalance:Ae}}));f(a("selectAmountToSwap",{symbol:ce,balance:Ae}),"bot",te.id,Pe)}else f(r("couldNotFetchBalance"),"bot")}catch(ae){console.warn("Native balance fetch failed:",ae),f(r("couldNotFetchBalanceRetry"),"bot")}else{const ae=U.token_in_symbol||"Token";H({srcTokenAddress:U.token_in,srcTokenDecimals:O});try{const j=await ot({address:c?.address||"",chain:w});if(j?.success&&j?.data?.result){const ce=j.data.result.find(Pe=>Pe.token_address.toLowerCase()===U.token_in?.toLowerCase());if(!ce){f(a("swapTokenNotInWallet",{symbol:ae}),"bot"),v(!1);return}const Ce=[25,50,75,100].map(Pe=>({id:`percent-${Pe}`,text:`${Pe}%`,value:a("buttonUsePercent",{percent:String(Pe),symbol:ce.symbol}),action:"select_percent",extraData:{percent:Pe,tokenAddress:ce.token_address,tokenSymbol:ce.symbol,tokenBalance:ce.balance_formatted}}));f(a("selectAmountToSwap",{symbol:ce.symbol,balance:`${ce.balance_formatted} (~$${ce.usd_value?.toFixed(2)||"0"})`}),"bot",te.id,Ce)}else f(r("couldNotFetchBalance"),"bot")}catch(j){console.warn("Token balance fetch failed:",j),f(r("couldNotFetchBalanceRetry"),"bot")}}}else if(!me&&ie){f(X.message||"🔄 Please choose which token you want to swap from:","bot",te.id);let O=parseInt(U.token_out_decimals||"18",10);if(U.token_out)try{const z=await Ke.getTokensDetails([U.token_out],m);z?.data?.[0]&&(O=z.data[0].decimals||O)}catch(z){console.warn("getTokensDetails failed in CASE 3, using fallback:",z)}await ge(U.token_out,O)}else if(me&&!ie){let O=Y?18:parseInt(U.token_in_decimals||"18",10);if(U.token_in&&!Y)try{const z=await Ke.getTokensDetails([U.token_in],m);z?.data?.[0]&&(O=z.data[0].decimals||O)}catch(z){console.warn("getTokensDetails failed in CASE 4, using fallback:",z)}H(Y?{srcTokenAddress:Ye,srcTokenDecimals:18}:{srcTokenAddress:U.token_in,srcTokenDecimals:O}),f(X.message||`🔄 You want to swap ${U.token_in_symbol||"your token"}. Please choose which token you want to receive:`,"bot",te.id);try{v(!0);const z=g?.tokenTrendingDefault||[],[Q,ae]=await Promise.allSettled([Ke.getTopGainers(m,"24h",5),Ke.getTokensDetails(z,m)]);let j=[];Q.status==="fulfilled"&&Q.value?.data&&(j=[...Q.value.data]),ae.status==="fulfilled"&&ae.value?.data&&(j=[...ae.value.data,...j]),j=j.filter((ce,Ae,Ce)=>Ae===Ce.findIndex(Pe=>Pe.address.toLowerCase()===ce.address.toLowerCase()));const V=j.map(ce=>({id:ce?.symbol,text:ce?.symbol,value:a("buttonSwapTo",{name:ce.name,symbol:ce?.symbol||""}),action:"click_swap_dest_token",extraData:{tokenAddress:ce?.address||"",symbol:ce?.symbol||"",decimals:ce?.decimals||18}}));f(a("trendingTokensForReceive",{chain:g?.name||"Unknown"}),"bot",void 0,V)}catch(z){console.error("Error fetching trending tokens for swap:",z),f(r("couldNotLoadTokenList"),"bot")}finally{v(!1)}}else f(X.message||'🔄 I need more details for your swap. Please specify which tokens you want to swap (e.g. "Swap 1 ETH to USDC").',"bot",te.id)}else if(X.action==="view_nfts")f(X.message||"🖼️ Let me show you your NFT collection!","bot",te.id),await Se();else{const U=tc(X.action);let Y={...X.parameters||{}},fe;const me=["send_token","approve_token"].includes(X.action)&&(Y.contract_address||Y.token_symbol),ie=X.action==="send_native",le=X.action==="send_nft"&&Y.contract_address;if(me&&c?.address)try{const O=await ot({address:c.address,chain:w});if(O?.success&&O?.data?.result){const z=O.data.result,Q=Y.contract_address?z.find(ae=>ae.token_address.toLowerCase()===Y.contract_address.toLowerCase()):z.find(ae=>ae.symbol.toUpperCase()===Y.token_symbol.toUpperCase());Q&&(Y={...Y,contract_address:Q.token_address,decimals:String(Q.decimals)},fe={symbol:Q.symbol,name:Q.name,balance:Q.balance,balanceFormatted:Q.balance_formatted,usdValue:Q.usd_value,usdPrice:Q.usd_price,decimals:Q.decimals,logo:Q.logo||Q.thumbnail,contractAddress:Q.token_address})}}catch(O){console.warn("Token enrichment failed:",O)}if(me&&!fe&&Y.contract_address)try{const O=await Pi({address:Y.contract_address,chain:w});if(O?.success&&O?.data){const z=O.data;fe={symbol:z.symbol,name:z.name,balance:"0",balanceFormatted:"0",usdPrice:z.usd_price,decimals:z.decimals,logo:z.logo,contractAddress:Y.contract_address},Y={...Y,decimals:String(z.decimals)}}}catch(O){console.warn("Token metadata fallback failed:",O)}if(ie&&c?.address)try{const O=await ot({address:c.address,chain:w});if(O?.success&&O?.data?.result){const Q=O.data.result.find(ae=>ae.native_token);if(Q){let ae=Q.balance_formatted,j=Q.balance;try{const V=new ue(Q.balance),ce="0x"+BigInt(V.toFixed(0)).toString(16),Ae=await Qt({from:c.address,to:c.address,data:"0x",value:ce,chainId:y,rpcUrl:A});if(Ae.isGreaterThan(0)){const Ce=V.minus(Ae);Ce.isGreaterThan(0)?(j=Ce.toFixed(0),ae=ue(Ue(BigInt(Ce.toFixed(0)),Q.decimals)).toFixed()):(j="0",ae="0")}}catch(V){console.warn("Estimate send fee for send_native failed:",V)}fe={symbol:Q.symbol,name:Q.name,balance:j,balanceFormatted:ae,usdValue:Q.usd_value,usdPrice:Q.usd_price,decimals:Q.decimals,logo:Q.logo||Q.thumbnail,contractAddress:Ye}}}}catch(O){console.warn("Native token balance fetch failed:",O)}if(le)try{const O=await Ui({address:Y.contract_address,chain:w});if(O?.success&&O?.data){const z=O.data;z.contract_type&&(Y={...Y,token_standard:z.contract_type}),!Y.nft_name&&z.name&&(Y={...Y,nft_name:z.name})}}catch(O){console.warn("NFT contract metadata fetch failed:",O)}if(Y.amount&&fe?.balanceFormatted&&(X.action==="send_token"||X.action==="send_native")&&(Y.amount=io(Y.amount,fe.balanceFormatted)),U){const O=X.message||"Please review and complete the form below.";f(O,"bot",te.id,void 0,{action:X.action,parameters:Y,status:"pending",tokenInfo:fe})}else f(X.message||Z,"bot",te.id)}else if(X&&X.action==="chat"){const U=X.token_mentions||[],Y=X.suggested_actions||[],fe=[];U.length>0&&U.forEach(me=>{fe.push({id:`buy-${me.symbol}`,text:`💰 Buy ${me.symbol}`,value:a("buttonBuySymbol",{symbol:me.symbol}),action:"click_buy_item_token_button",extraData:{tokenAddress:me.contract_address||"",symbol:me.symbol,decimals:me.decimals||18},fullWidth:!0})}),Y.length>0&&Y.forEach((me,ie)=>{fe.push({id:`suggested-${ie}-${me.label}`,text:me.label,value:me.prompt,action:"suggested_action",fullWidth:!0})}),fe.length>0?f(X.message||Z,"bot",te.id,fe):f(X.message||Z,"bot",te.id)}else f(Z,"bot",te.id)}else f(r("errorProcessingRequest"),"bot",te.id)}catch(R){console.error("Error getting AI response:",R),f(r("errorProcessingRequest"),"bot",te.id)}v(!1),await lt(50),bn.isDesktop&&he.current?.focus()},[_,E,l,f,J,c?.address,g?.name,g?.nativeCurrency?.symbol,g?.tokenTrendingDefault,y,m,w,ge,we,Se,H,A,r,a]);se.useEffect(()=>{ye.current&&_===ye.current&&(ye.current=null,He())},[_,He]);const De=se.useCallback(async(M,te,R)=>{try{if(S(R,"submitted"),M==="swap_token"){let ne=18;if(te.token_in&&te.token_in!==Ye)try{const W=await Ke.getTokensDetails([te.token_in],m);W?.data?.[0]&&(ne=W.data[0].decimals||18)}catch(W){console.warn("getTokensDetails failed in ActionForm swap, using default 18:",W)}const oe=dt(te.amount||"0",ne).toString(),$=await no({chainId:y,tokenIn:te.token_in||"",tokenInAmount:oe,tokenOut:te.token_out||"",tokenOutRecipient:c?.address||"",slippage:"auto",accesstoken:"d6c45897b8f6"});if($.success&&$.data){const W=$.data,Z=W.tokenIn,X=W.tokenOut,U=ue(Ue(BigInt(Z.amount||0),Z.decimals)).decimalPlaces(6).toFormat(),Y=ue(Ue(BigInt(X.amount||0),X.decimals)).decimalPlaces(6).toFormat(),fe=!te.token_in||te.token_in===Ye;let me=!1;if(!fe&&c?.address&&W.tx?.to)try{const V=await ro({tokenAddress:te.token_in,ownerAddress:c.address,spenderAddress:W.tx.to,chainId:y,rpcUrl:A});me=ue(V.toString()).isLessThan(oe)}catch(V){console.warn("Allowance check failed in ActionForm swap:",V)}const ie=W.estimatedTransactionFee?.total?ue(W.estimatedTransactionFee.total):ue(0);let le=ue(0);if(me&&c?.address)try{const V=hn({tokenAddress:te.token_in,spenderAddress:W.tx?.to||"",fromAddress:c.address,chainId:y});le=await Qt({from:c.address,to:V.to,data:V.data,chainId:y,rpcUrl:A})}catch(V){console.warn("Approve fee estimation failed:",V)}const O=ie.plus(le),z=g?.nativeCurrency?.symbol||"native";let Q="",ae=!1;if(c?.address&&O.isGreaterThan(0))try{const V=await gn({address:c.address,chainId:y,rpcUrl:A});if(V.isLessThan(O)){ae=!0;const ce=ue(Ue(BigInt(V.toFixed(0)),18)).decimalPlaces(6).toFormat(),Ae=ue(Ue(BigInt(O.toFixed(0)),18)).decimalPlaces(6).toFormat();Q=a("swapFeeWarning",{symbol:z,balance:ce,needed:Ae})}}catch(V){console.warn("Fee balance check failed:",V)}const j=`From: ${U} ${Z.symbol}
358
395
  ⬇️
359
- To: ${Z} ${X.symbol}
360
-
361
- `+_+`
362
- `;if(j)c(R,"fail"),o(ae,"bot");else if(ie){const ce=[{id:"approve-swap-actionform",text:`Approve ${K.symbol}`,value:`Approve ${K.symbol} for swap`,action:"approve_for_swap",extraData:{tokenAddress:se.token_in,spenderAddress:z.tx.to,tokenSymbol:K.symbol,tx:z.tx},fullWidth:!0}];c(R,"success"),o(ae+`⚠️ Token approval required before swapping.
396
+ To: ${Y} ${X.symbol}
363
397
 
364
- Step 1: Approve ${K.symbol}
365
- Step 2: Confirm Swap`,"bot",void 0,ce)}else{const ce=[{id:"confirm-swap-actionform",text:"Yes",value:"Confirm swap",action:"confirm_swap",extraData:{tx:z.tx}}];c(R,"success"),o(ae+"Ready to proceed with the swap?","bot",void 0,ce)}}else c(R,"fail"),o(`⚠️ Unable to get swap estimation. Error: ${Y.errorMessage||Y.error||"Unknown error"}`,"bot")}else{const $=qi({action:M,parameters:se,fromAddress:i?.address||"",chainId:p||1}),ee={from:$.from,to:$.to,data:$.data,value:$.value,chainId:$.chainId};if((M==="send_token"||M==="send_native"||M==="send_nft")&&i?.address)try{const Y=l?.nativeCurrency?.symbol||"native",z=await Zt({from:$.from,to:$.to,data:$.data,value:$.value&&$.value!=="0"?`0x${BigInt($.value).toString(16)}`:void 0,chainId:p,rpcUrl:h});if(z.isGreaterThan(0)){const K=await mn({address:i.address,chainId:p,rpcUrl:h});if(K.isLessThan(z)){const X=de(Ue(BigInt(K.toFixed(0)),18)).decimalPlaces(6).toFormat(),U=de(Ue(BigInt(z.toFixed(0)),18)).decimalPlaces(6).toFormat();c(R,"fail"),o(`⚠️ **Insufficient ${Y} for gas!** You have ${X} ${Y} but need ~${U} ${Y} for the transaction fee. Please top up your wallet and try again.`,"bot");return}}}catch(Y){console.warn("Pre-execution fee check failed:",Y)}if(n){const Y=await n(ee);if(Y.status==="success"&&Y.transactionHash){const z=l?.blockExplorers?.default?.url,K=z?`
366
- [View on Explorer](${z}/tx/${Y.transactionHash})`:`
367
- Tx: ${Y.transactionHash}`,X=o(`⏳ Transaction submitted. Waiting for confirmation...${K}`,"bot");try{await lt(2e3),(await ts({transactionHash:Y.transactionHash,chainId:p||1,rpcUrl:h})).status==="success"?(c(R,"success"),T(X.id,`✅ Transaction confirmed!${K}`)):(c(R,"fail"),T(X.id,`❌ Transaction reverted on-chain.${K}`))}catch(U){console.warn("Transaction tracking timeout:",U),c(R,"success"),o(`⚠️ Transaction submitted but confirmation timed out. Please check manually.${K}`,"bot")}}else if(Y.status==="success")c(R,"success"),o("✅ Transaction successful!","bot");else{c(R,"fail");const z=Y.error?`
368
- Error: ${Y.error}`:"";o(`Transaction failed. Please try again.${z}`,"bot")}}else c(R,"fail"),o("⚠️ No transaction handler configured.","bot")}}catch($){console.error("Action form submit error:",$),c(R,"fail"),o(`❌ Error: ${$ instanceof Error?$.message:"Unknown error"}`,"bot")}},[c,p,i?.address,u,o,n,l?.blockExplorers?.default?.url,l?.nativeCurrency?.symbol,T,h]),Ye=re.useCallback(M=>{c(M,"fail")},[c]),[Le,Ge]=re.useState({}),Fe=re.useCallback(async(M,se,R)=>{Ge($=>({...$,[R]:!0}));try{await Qe(M,se,R)}finally{Ge($=>({...$,[R]:!1}))}},[Qe]),Oe=re.useCallback(M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),_e())},[_e]),Ee=re.useCallback(()=>{const M=window.getSelection();M&&M.toString().length>0||t()},[t]);return e?I.jsx("div",{className:`chat-modal-overlay${s==="bottom-left"?" chat-modal-overlay--left":""}`,onClick:Ee,role:"dialog","aria-modal":"true","aria-labelledby":"chat-modal-title",children:I.jsxs("div",{className:"chat-modal",onClick:M=>M.stopPropagation(),children:[I.jsxs("div",{className:"chat-modal-header",children:[I.jsxs("div",{className:"chat-modal-header-left",children:[I.jsx("div",{className:"keyring-logo",children:I.jsx("img",{src:Ui,alt:"Keyring Logo",width:40,height:40})}),I.jsx("h3",{id:"chat-modal-title",children:"Keyring Agent"})]}),I.jsx("button",{className:"close-button",onClick:t,"aria-label":"Close chat",type:"button",children:I.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:I.jsx("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),I.jsx(hi,{address:i?.address,chainId:l?.chainId}),I.jsxs("div",{className:"chat-modal-messages-wrapper",children:[I.jsxs("div",{className:"chat-modal-messages",ref:D,role:"log","aria-live":"polite",children:[a.map((M,se)=>I.jsxs("div",{children:[Ie(se)&&I.jsx("div",{className:"date-separator",children:ci(M.timestamp)}),I.jsxs("div",{className:`message ${M.sender==="user"?"message-user":"message-bot"}`,role:"article",children:[I.jsx("button",{className:"message-reply-button",onClick:()=>O(M),"aria-label":"Reply to message",type:"button",children:I.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:I.jsx("path",{d:"M3.5 8.5L1 6L3.5 3.5M1.5 6H10C12.2091 6 14 7.79086 14 10V13",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),I.jsxs("div",{className:"message-bubble",children:[M.replyTo&&I.jsxs("div",{className:"message-reply-to",children:[I.jsxs("div",{className:"message-reply-to-label",children:["Replying to"," ",M.replyTo.sender==="user"?"You":"Keyring Agent"]}),I.jsx("div",{className:"message-reply-to-text",children:M.replyTo.text})]}),I.jsx("div",{className:"message-text",children:I.jsx(Li,{content:M.text})}),M.buttons&&M.buttons.length>0&&I.jsx("div",{className:"message-buttons",children:M.buttons.map(R=>I.jsx("button",{className:`message-button ${R.fullWidth?"full-width":""} ${R.action==="suggested_action"?"suggested-action":""}`,onClick:()=>xe(R.value,R.action,R?.extraData),type:"button",children:R.text},R.id))}),M.actionData&&M.actionData.status==="pending"&&I.jsx(Wi,{action:M.actionData.action,initialValues:M.actionData.parameters,onSubmit:(R,$)=>Fe(R,$,M.id),onCancel:()=>Ye(M.id),isSubmitting:Le[M.id]||!1,tokenInfo:M.actionData.tokenInfo}),M.actionData&&M.actionData.status==="submitted"&&I.jsx("div",{className:"action-status action-status-submitted",children:"⏳ Processing transaction..."}),M.actionData&&M.actionData.status==="success"&&I.jsx("div",{className:"action-status action-status-success",children:"✅ Transaction completed"}),M.actionData&&M.actionData.status==="fail"&&I.jsx("div",{className:"action-status action-status-fail",children:"❌ Action cancelled or failed"}),I.jsxs("div",{className:"message-timestamp",children:[M.timestamp.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}),M.sender==="user"&&I.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"check-icon",children:I.jsx("path",{d:"M13.3333 4L6 11.3333L2.66667 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})]})]},M.id)),L&&I.jsx("div",{className:"message message-bot typing-indicator",role:"status","aria-label":"Bot is typing",children:I.jsxs("div",{className:"message-bubble",children:[I.jsx("span",{className:"typing-dot"}),I.jsx("span",{className:"typing-dot"}),I.jsx("span",{className:"typing-dot"})]})}),(k||a.length===1)&&I.jsxs(I.Fragment,{children:[I.jsx("div",{className:"message message-bot",role:"article",children:I.jsx("div",{className:"message-bubble",children:I.jsx("div",{className:"message-text",children:"Can I help you with anything?"})})}),I.jsx("div",{className:"suggestions-container",children:be.map(M=>I.jsxs("button",{className:"suggestion-button",onClick:M.action,type:"button",children:[I.jsx("span",{className:"suggestion-icon",children:M.icon}),I.jsx("span",{className:"suggestion-text",children:M.text})]},M.id))})]}),I.jsx("div",{ref:ue})]}),I.jsx(Gi,{scrollContainerRef:D})]}),I.jsxs("div",{className:"chat-modal-input",children:[g&&I.jsxs("div",{className:"reply-preview",children:[I.jsxs("div",{className:"reply-preview-content",children:[I.jsxs("div",{className:"reply-preview-label",children:["Replying to"," ",g.sender==="user"?"You":"Keyring Agent"]}),I.jsx("div",{className:"reply-preview-text",children:g.text})]}),I.jsx("button",{className:"reply-preview-close",onClick:()=>B(null),"aria-label":"Cancel reply",type:"button",children:I.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:I.jsx("path",{d:"M12 4L4 12M4 4L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),I.jsxs("div",{className:"chat-modal-input-row",children:[I.jsx("input",{ref:Q,type:"text",placeholder:"Message ....",value:C,onChange:M=>N(M.target.value),onKeyPress:Oe,disabled:L,"aria-label":"Message input"}),I.jsx("button",{className:"send-button",onClick:_e,"aria-label":"Send message",disabled:L||C?.trim()==="",type:"button",children:I.jsx("img",{src:Di,alt:"Send",width:44,height:44})})]})]})]})}):null},oc=({position:e,theme:t,defaultOpen:n,onOpen:s,onClose:r,onTransaction:a})=>{const[o,c]=re.useState(n);re.useEffect(()=>{n&&s&&s()},[]),re.useEffect(()=>{if(typeof window>"u")return;const m=document.body,k=document.documentElement;return!!o?(m.style.overscrollBehavior="none",k.style.overscrollBehavior="none"):(m.style.overscrollBehavior="auto",k.style.overscrollBehavior="auto"),()=>{m.style.overscrollBehavior="auto",k.style.overscrollBehavior="auto"}},[o]);const T=re.useCallback(()=>{c(!0),s?.()},[s]),C=re.useCallback(()=>{c(!1),r?.()},[r]),N=re.useCallback(()=>{o?C():T()},[o,T,C]),L={position:"fixed",[e==="bottom-right"?"right":"left"]:"20px",bottom:"20px",zIndex:t.zIndex??9999};return I.jsxs("div",{style:L,role:"complementary","aria-label":"Chat widget",children:[I.jsx(Dr,{onClick:N}),I.jsx(rc,{isOpen:o,onClose:C,onTransaction:a,position:e})]})},ac=({position:e="bottom-right",theme:t={},defaultOpen:n=!1,onOpen:s,onClose:r,account:a,onTransaction:o,language:c="en",rpcUrls:T})=>{const C={position:e,theme:t,rpcUrls:T};return console.log("🚀 ~ ChatWidget ~ account:",a),typeof window>"u"?null:I.jsx(Ti,{initialConfig:C,children:I.jsx(vi,{initialAccount:a,children:I.jsx(Ei,{initialLanguage:c,children:I.jsx(oc,{position:e,theme:t,defaultOpen:n,onOpen:s,onClose:r,onTransaction:o})})})})};pt.ChatWidget=ac,Object.defineProperty(pt,Symbol.toStringTag,{value:"Module"})}));
398
+ `+Q+`
399
+ `;if(ae)S(R,"fail"),f(j,"bot");else if(me){const V=[{id:"approve-swap-actionform",text:a("swapApproveButton",{symbol:Z.symbol}),value:a("swapApproveValue",{symbol:Z.symbol}),action:"approve_for_swap",extraData:{tokenAddress:te.token_in,spenderAddress:W.tx.to,tokenSymbol:Z.symbol,tx:W.tx},fullWidth:!0}];S(R,"success"),f(j+a("swapApprovalRequired",{symbol:Z.symbol}),"bot",void 0,V)}else{const V=[{id:"confirm-swap-actionform",text:"Yes",value:r("swapConfirmValue"),action:"confirm_swap",extraData:{tx:W.tx}}];S(R,"success"),f(j+r("swapReadyToProceed"),"bot",void 0,V)}}else S(R,"fail"),f(a("swapEstimationError",{error:$.errorMessage||$.error||"Unknown error"}),"bot")}else{const ne=Ji({action:M,parameters:te,fromAddress:c?.address||"",chainId:y||1}),oe={from:ne.from,to:ne.to,data:ne.data,value:ne.value,chainId:ne.chainId};if((M==="send_token"||M==="send_native"||M==="send_nft")&&c?.address)try{const $=g?.nativeCurrency?.symbol||"native",W=await Qt({from:ne.from,to:ne.to,data:ne.data,value:ne.value&&ne.value!=="0"?`0x${BigInt(ne.value).toString(16)}`:void 0,chainId:y,rpcUrl:A});if(W.isGreaterThan(0)){const Z=await gn({address:c.address,chainId:y,rpcUrl:A});if(Z.isLessThan(W)){const X=ue(Ue(BigInt(Z.toFixed(0)),18)).decimalPlaces(6).toFormat(),U=ue(Ue(BigInt(W.toFixed(0)),18)).decimalPlaces(6).toFormat();S(R,"fail"),f(a("txInsufficientGas",{symbol:$,balance:X,fee:U}),"bot");return}}}catch($){console.warn("Pre-execution fee check failed:",$)}if(n){const $=await n(oe);if($.status==="success"&&$.transactionHash){const W=g?.blockExplorers?.default?.url,Z=W?`
400
+ [View on Explorer](${W}/tx/${$.transactionHash})`:`
401
+ Tx: ${$.transactionHash}`,X=f(r("txSubmitted")+Z,"bot");try{await lt(2e3),(await so({transactionHash:$.transactionHash,chainId:y||1,rpcUrl:A})).status==="success"?(S(R,"success"),N(X.id,r("txConfirmed")+Z)):(S(R,"fail"),N(X.id,r("txReverted")+Z))}catch(U){console.warn("Transaction tracking timeout:",U),S(R,"success"),f(r("txTimeout")+Z,"bot")}}else if($.status==="success")S(R,"success"),f(r("txSuccessful"),"bot");else{S(R,"fail");const W=$.error?`
402
+ Error: ${$.error}`:"";f(r("txFailed")+W,"bot")}}else S(R,"fail"),f(r("txNoHandler"),"bot")}}catch(ne){console.error("Action form submit error:",ne),S(R,"fail"),f(a("txError",{message:ne instanceof Error?ne.message:"Unknown error"}),"bot")}},[S,y,c?.address,m,f,n,g?.blockExplorers?.default?.url,g?.nativeCurrency?.symbol,N,A,r,a]),ze=se.useCallback(M=>{S(M,"fail")},[S]),[Me,Ne]=se.useState({}),Te=se.useCallback(async(M,te,R)=>{Ne(ne=>({...ne,[R]:!0}));try{await De(M,te,R)}finally{Ne(ne=>({...ne,[R]:!1}))}},[De]),Ct=se.useCallback(M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),He())},[He]),Rt=se.useCallback(()=>{const M=window.getSelection();M&&M.toString().length>0||t()},[t]);return e?B.jsx("div",{className:`chat-modal-overlay${o==="bottom-left"?" chat-modal-overlay--left":""}`,onClick:Rt,role:"dialog","aria-modal":"true","aria-labelledby":"chat-modal-title",children:B.jsxs("div",{className:"chat-modal",style:s,onClick:M=>M.stopPropagation(),children:[B.jsxs("div",{className:"chat-modal-header",children:[B.jsxs("div",{className:"chat-modal-header-left",children:[B.jsx("div",{className:"keyring-logo",children:B.jsx("img",{src:Di,alt:"Keyring Logo",width:40,height:40})}),B.jsx("h3",{id:"chat-modal-title",children:r("chatTitle")})]}),B.jsx("button",{className:"close-button",onClick:t,"aria-label":r("closeChat"),type:"button",children:B.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:B.jsx("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),B.jsx(vi,{address:c?.address,chainId:g?.chainId}),B.jsxs("div",{className:"chat-modal-messages-wrapper",children:[B.jsxs("div",{className:"chat-modal-messages",ref:K,role:"log","aria-live":"polite",children:[l.map((M,te)=>B.jsxs("div",{children:[et(te)&&B.jsx("div",{className:"date-separator",children:pi(M.timestamp)}),B.jsxs("div",{className:`message ${M.sender==="user"?"message-user":"message-bot"}`,role:"article",children:[B.jsx("button",{className:"message-reply-button",onClick:()=>re(M),"aria-label":r("replyToMessage"),type:"button",children:B.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:B.jsx("path",{d:"M3.5 8.5L1 6L3.5 3.5M1.5 6H10C12.2091 6 14 7.79086 14 10V13",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),B.jsxs("div",{className:"message-bubble",children:[M.replyTo&&B.jsxs("div",{className:"message-reply-to",children:[B.jsxs("div",{className:"message-reply-to-label",children:[r("replyingTo")," ",M.replyTo.sender==="user"?r("replyingToYou"):r("replyingToAgent")]}),B.jsx("div",{className:"message-reply-to-text",children:M.replyTo.text})]}),B.jsx("div",{className:"message-text",children:B.jsx(Hi,{content:M.text})}),M.buttons&&M.buttons.length>0&&B.jsx("div",{className:"message-buttons",children:M.buttons.map(R=>B.jsx("button",{className:`message-button ${R.fullWidth?"full-width":""} ${R.action==="suggested_action"?"suggested-action":""}`,onClick:()=>G(R.value,R.action,R?.extraData),type:"button",children:R.text},R.id))}),M.actionData&&M.actionData.status==="pending"&&B.jsx($i,{action:M.actionData.action,initialValues:M.actionData.parameters,onSubmit:(R,ne)=>Te(R,ne,M.id),onCancel:()=>ze(M.id),isSubmitting:Me[M.id]||!1,tokenInfo:M.actionData.tokenInfo}),M.actionData&&M.actionData.status==="submitted"&&B.jsx("div",{className:"action-status action-status-submitted",children:r("actionProcessing")}),M.actionData&&M.actionData.status==="success"&&B.jsx("div",{className:"action-status action-status-success",children:r("actionSuccess")}),M.actionData&&M.actionData.status==="fail"&&B.jsx("div",{className:"action-status action-status-fail",children:r("actionFail")}),B.jsxs("div",{className:"message-timestamp",children:[M.timestamp.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}),M.sender==="user"&&B.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"check-icon",children:B.jsx("path",{d:"M13.3333 4L6 11.3333L2.66667 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})]})]},M.id)),E&&B.jsx("div",{className:"message message-bot typing-indicator",role:"status","aria-label":r("botIsTyping"),children:B.jsxs("div",{className:"message-bubble",children:[B.jsx("span",{className:"typing-dot"}),B.jsx("span",{className:"typing-dot"}),B.jsx("span",{className:"typing-dot"})]})}),(C||l.length===1)&&B.jsxs(B.Fragment,{children:[B.jsx("div",{className:"message message-bot",role:"article",children:B.jsx("div",{className:"message-bubble",children:B.jsx("div",{className:"message-text",children:r("canIHelpYou")})})}),B.jsx("div",{className:"suggestions-container",children:Ge.map(M=>B.jsxs("button",{className:"suggestion-button",onClick:M.action,type:"button",children:[B.jsx("span",{className:"suggestion-icon",children:M.icon}),B.jsx("span",{className:"suggestion-text",children:M.text})]},M.id))})]}),B.jsx("div",{ref:q})]}),B.jsx(zi,{scrollContainerRef:K})]}),B.jsxs("div",{className:"chat-modal-input",children:[J&&B.jsxs("div",{className:"reply-preview",children:[B.jsxs("div",{className:"reply-preview-content",children:[B.jsxs("div",{className:"reply-preview-label",children:[r("replyingTo")," ",J.sender==="user"?r("replyingToYou"):r("replyingToAgent")]}),B.jsx("div",{className:"reply-preview-text",children:J.text})]}),B.jsx("button",{className:"reply-preview-close",onClick:()=>I(null),"aria-label":r("cancelReply"),type:"button",children:B.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:B.jsx("path",{d:"M12 4L4 12M4 4L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),B.jsxs("div",{className:"chat-modal-input-row",children:[B.jsx("input",{ref:he,type:"text",placeholder:r("messagePlaceholder"),value:_,onChange:M=>b(M.target.value),onKeyPress:Ct,disabled:E,"aria-label":"Message input"}),B.jsx("button",{className:"send-button",onClick:He,"aria-label":r("sendMessage"),disabled:E||_?.trim()==="",type:"button",children:B.jsx("img",{src:Mi,alt:"Send",width:44,height:44})})]})]})]})}):null},ic=({position:e,theme:t,defaultOpen:n,onOpen:o,onClose:s,onTransaction:r})=>{const[a,l]=se.useState(n);se.useEffect(()=>{n&&o&&o()},[]),se.useEffect(()=>{if(typeof window>"u")return;const b=document.body,E=document.documentElement;return!!a?(b.style.overscrollBehavior="none",E.style.overscrollBehavior="none"):(b.style.overscrollBehavior="auto",E.style.overscrollBehavior="auto"),()=>{b.style.overscrollBehavior="auto",E.style.overscrollBehavior="auto"}},[a]);const f=se.useCallback(()=>{l(!0),o?.()},[o]),S=se.useCallback(()=>{l(!1),s?.()},[s]),N=se.useCallback(()=>{a?S():f()},[a,f,S]),_={position:"fixed",[e==="bottom-right"?"right":"left"]:"20px",bottom:"20px",zIndex:t.zIndex??9999};return B.jsxs("div",{style:_,role:"complementary","aria-label":"Chat widget",children:[B.jsx(Hs,{onClick:N}),B.jsx(ac,{isOpen:a,onClose:S,onTransaction:r,position:e,modalChatStyle:t.modalChatStyle})]})},cc=({position:e="bottom-right",theme:t={},defaultOpen:n=!1,onOpen:o,onClose:s,account:r,onTransaction:a,language:l="en",rpcUrls:f})=>{const S={position:e,theme:t,rpcUrls:f};return typeof window>"u"?null:B.jsx(Bi,{initialConfig:S,children:B.jsx(yi,{initialAccount:r,children:B.jsx(Rs,{initialLanguage:l,children:B.jsx(ic,{position:e,theme:t,defaultOpen:n,onOpen:o,onClose:s,onTransaction:a})})})})};pt.ChatWidget=cc,Object.defineProperty(pt,Symbol.toStringTag,{value:"Module"})}));