keyring-chatbot-agent-sdk-test 0.0.19 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat-widget.es.js +3984 -3759
- package/dist/chat-widget.umd.js +78 -67
- package/dist/lib.d.ts +9 -0
- package/package.json +1 -1
package/dist/chat-widget.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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;overscroll-behavior:contain;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}@media(min-width:640px){.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 .action-form-field-label{margin-bottom:0;font-size:12px}.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(
|
|
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;overscroll-behavior:contain;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}@media(min-width:640px){.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 .action-form-field-label{margin-bottom:0;font-size:12px}.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}.action-form-nft-info{margin-bottom:10px;text-align:center;display:flex;align-items:center;justify-content:center}.nft-info-image{width:80px;height:80px;border-radius:8px;object-fit:contain;background:#e5e7eb}.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(gt,P){typeof exports=="object"&&typeof module<"u"?P(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],P):(gt=typeof globalThis<"u"?globalThis:gt||self,P(gt.ChatWidgetSDK={},gt.jsxRuntime,gt.React))})(this,(function(gt,P,ne){"use strict";const $s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHAAAABwCAYAAADG4PRLAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAfXSURBVHgB7Z1LbFRVGMe/c4YCAmKrEFiQWIIrNm13RE0olLRuTCq4w4C6Mbopo9GltFsVpmxQN1pJ2MkjcSMESrsgYdd2w8rGkrCA8GjFVintzPH878wZjrfzujPTe88p3y+ZzMydOxO4//s9z3dvBTWB7sxsqyTqF2q5k4R8nUh06s2thQeTZyZ4qOwU0bqJFkHjv6fbZqhBBNVJIJqiASFUN94SExl98CeVEsONiBlZQEu4E8QW1kTUSAvJoahCRhLw4OnZkyzc6qItcnD087ahWvevScB3MrPty6QuKaJOYuJgpoXEgVqsUVbboef07PElUhMsXqy045j3ZB72V9uxooCHtMskoUaIXWYS6GMuLyFsVdqprAuFeEqoQWISp1JcLClgz3fadFPyEjHuIMWH1wfafglvXiEgEhb4X2K36RpzOrHpCic2K2KgFu8GsXgu0opKILzxfwIeygfMdmKcBJXAwVOPBu1tRRdacJ1/EuM6c1kSu8fSbXN4U7TAJZUdJMYHWmUud8K8CSyQrc87ilYYWOCzXLabGJ8oWmEgoJRygBivEFLsD57ZffqLdqNtkt2nv8hctl8qIXiVwVOE1k5KITqI8RTRjiSmnRg/EdTBAvpNa9UVecZpWEDfYQE9hwX0HBbQc1jAEFs2CLp2oi14dOxaR67DAoZ4c09L8XXHrhZyHRYwxFt71hdf9+5dT67DAlrs2Cq1gM+tbqd+77obZQEtju17qaZtLsECFji2byP1lXCZsMAvezcHyY2LuJ9mrSKbtShva5fZu3dDRVcJYfH5uVv/0tTdZbr/JEeuIHoyjxV5CA4+Duye7Skdq1JV9z87/g9NP8gGr5FpHunaWHd8w+9cmHhKV28/o6Tx0gIPd20IYlMUt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XZrv8b48ticFZnOSibq2JCUS8ot0pkhrMurh4TaBNbBbY7Ov5ooC6L0pmeb+wv+vigdgEXI2LMmvBXKC5VonVp5kuSF+V+7I0A1gRrqG/oFcwfLCkenHiPjGV5kWbcS38WsbpMoLFq46zArJ4teGkgCxe7TgnIIsXDacEZPGi44yALF59OLEeiNaVbwupruCEBbJ49cPLSZ7DAnoOC+g5LKDnsICeI/VSxBwx3iIFC+gzM9qFqklifGVG5hTdIcZPlJqSQrEFektKTsicTF0mxkuyORqXY+k2JDFjxHiFrh4mtXYzQR0ocmqcGK8QUgzjORBwWcphrgf9Au4Tz4GAcKM6HT1DjCeIEbhPvCq20tgK/SFLNGReFwVkK/QDRWrIWB9YcXuHg5nHE3pjJzHOoT3kzGj61d32thWrETkS77ErdQ9oorU5EN6+QsC8eebSxDiFoNxHtus0lFwPHE1vGxHa1xLjBIh719PbSnbMKt7i6FDm0aAicZKYxIB4o+nXBst9XvUeVT2Zh/2K5M96x1ZiYiOfh+TS8IaV9qvpJmPdmdl2SeqG3rmdmFUHfU4kk6ViXphIf8ubXerqAqvThnLmWgWXGSbaH2OnvDWmVG6QhDhOTFMwwi2THC6sDtVMZAENebea7daJ7AAX/nUzprP98XqEM9QtoI0RUyjRqS2zg/Kxsp2YAFhYfnhMTeo3d5RQOsalLtcrms1//TyUbJOo0HUAAAAASUVORK5CYII=",po={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
3
|
|
|
4
4
|
Available: {balance} {symbol}`,swapFeeWarning:`
|
|
5
5
|
⚠️ **Insufficient {symbol} for fees!**
|
|
@@ -19,7 +19,7 @@ Please review and fill in the recipient address below:`,nftCollectionHeader:`
|
|
|
19
19
|
|
|
20
20
|
{list}
|
|
21
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:`
|
|
22
|
+
Select an NFT to send:`,nftNoCollection:"🖼️ You don't have any NFTs in your wallet on this chain.",nftNotFoundInWallet:`I couldn't find "{name}" in your NFT collection. Here are your NFTs:`,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
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}",viewBalancesLoading:"💰 Fetching your wallet balances...",viewBalancesHeader:`💰 Your token balances on {chain}:
|
|
24
24
|
|
|
25
25
|
{list}
|
|
@@ -44,7 +44,7 @@ Select a token to interact with:`,viewBalancesEmpty:"💰 You don't have any tok
|
|
|
44
44
|
|
|
45
45
|
{list}
|
|
46
46
|
|
|
47
|
-
送信するNFTを選択:`,nftNoCollection:"🖼️ このチェーンのウォレットにNFTがありません。",nftFetchError:"NFTの取得中にエラーが発生しました。",trendingTokensHeader:"📈 {chain}チェーンで現在上昇トレンドのトークン一覧です",trendingTokensQuestion:`
|
|
47
|
+
送信するNFTを選択:`,nftNoCollection:"🖼️ このチェーンのウォレットにNFTがありません。",nftNotFoundInWallet:"ウォレットに「{name}」が見つかりませんでした。以下はあなたのNFTです:",nftFetchError:"NFTの取得中にエラーが発生しました。",trendingTokensHeader:"📈 {chain}チェーンで現在上昇トレンドのトークン一覧です",trendingTokensQuestion:`
|
|
48
48
|
購入したいトークンはありますか?`,trendingTokensError:"トレンドトークンの取得中にエラーが発生しました。",errorProcessingRequest:"リクエストの処理中にエラーが発生しました。",buttonBuyWith:"{symbol}で購入",buttonUsePercent:"{symbol}の{percent}%を使用",buttonBuyToken:"{name}({symbol})を購入",buttonSendNft:"{name}を送信",buttonSwapTo:"{name}({symbol})にスワップ",buttonBuySymbol:"{symbol}を購入",viewBalancesLoading:"💰 ウォレット残高を取得中...",viewBalancesHeader:`💰 {chain}のトークン残高:
|
|
49
49
|
|
|
50
50
|
{list}
|
|
@@ -69,40 +69,40 @@ Select a token to interact with:`,viewBalancesEmpty:"💰 You don't have any tok
|
|
|
69
69
|
|
|
70
70
|
{list}
|
|
71
71
|
|
|
72
|
-
选择要发送的NFT:`,nftNoCollection:"🖼️ 您在此链的钱包中没有NFT。",nftFetchError:"获取NFT时遇到错误。",trendingTokensHeader:"📈 以下是{chain}链上目前上涨趋势的代币列表",trendingTokensQuestion:`
|
|
72
|
+
选择要发送的NFT:`,nftNoCollection:"🖼️ 您在此链的钱包中没有NFT。",nftNotFoundInWallet:'在您的NFT收藏中未找到"{name}"。以下是您的NFT:',nftFetchError:"获取NFT时遇到错误。",trendingTokensHeader:"📈 以下是{chain}链上目前上涨趋势的代币列表",trendingTokensQuestion:`
|
|
73
73
|
您想购买哪个代币?`,trendingTokensError:"获取热门代币时遇到错误。",errorProcessingRequest:"处理您的请求时遇到错误。",buttonBuyWith:"用{symbol}购买",buttonUsePercent:"使用{symbol}的{percent}%",buttonBuyToken:"购买{name}({symbol})",buttonSendNft:"发送{name}",buttonSwapTo:"兑换至{name}({symbol})",buttonBuySymbol:"购买{symbol}",viewBalancesLoading:"💰 正在获取钱包余额...",viewBalancesHeader:`💰 您在{chain}的代币余额:
|
|
74
74
|
|
|
75
75
|
{list}
|
|
76
76
|
|
|
77
|
-
选择要操作的代币:`,viewBalancesEmpty:"💰 您的钱包在此链上没有任何代币。",viewBalancesFetchError:"获取余额时遇到错误,请重试。",buttonSendToken:"发送{symbol}",buttonSwapToken:"兑换{symbol}",buttonBuyMoreToken:"购买更多{symbol}",actionSendNativeLabel:"发送原生代币",actionSendNativeDesc:"发送原生代币(ETH、BNB、MATIC 等)到某个地址",actionSendTokenLabel:"发送代币(ERC20)",actionSendTokenDesc:"将 ERC20 代币发送到某个地址",actionSwapTokenLabel:"兑换代币",actionSwapTokenDesc:"将一种代币兑换为另一种代币",actionApproveTokenLabel:"授权代币",actionApproveTokenDesc:"授权某地址使用您的代币",actionWrapNativeLabel:"包装原生代币",actionWrapNativeDesc:"包装原生代币(ETH → WETH)",actionUnwrapNativeLabel:"解包原生代币",actionUnwrapNativeDesc:"解包原生代币(WETH → ETH)",actionSendNftLabel:"发送 NFT",actionSendNftDesc:"将 ERC721 或 ERC1155 NFT 转移到另一个地址",fieldToAddress:"收款地址",fieldAmount:"数量",fieldTokenContract:"代币合约",fieldTokenSymbol:"代币符号",fieldDecimals:"小数位数",fieldTokenIn:"源代币",fieldTokenInSymbol:"源代币符号",fieldTokenOut:"目标代币",fieldTokenOutSymbol:"目标代币符号",fieldTokenInDecimals:"源代币小数位",fieldTokenOutDecimals:"目标代币小数位",fieldSpenderAddress:"授权地址",fieldAmountUnlimited:"数量(留空 = 无限授权)",fieldNftContract:"NFT 合约",fieldTokenId:"Token ID",fieldTokenStandard:"代币标准",fieldNftName:"NFT 名称",formMustBePositiveInteger:"必须是正整数",formAmountExceedsNft:"数量不能超过可用余额 {max}"}};function
|
|
78
|
-
`);super(r,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=mo}walk(t){return ho(this,t)}}function ho(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?ho(e.cause,t):t?null:e}class En extends pe{constructor({max:t,min:n,signed:o,size:s,value:a}){super(`Number "${a}" is not in safe ${s?`${s*8}-bit ${o?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class Hs extends pe{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Ft(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function We(e){return Ft(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function an(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 bo 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 wo 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 Dt(e,{dir:t,size:n=32}={}){return typeof e=="string"?wt(e,{dir:t,size:n}):Ws(e,{dir:t,size:n})}function wt(e,{dir:t,size:n=32}={}){if(n===null)return e;const o=e.replace("0x","");if(o.length>n*2)throw new wo({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 wo({size:e.length,targetSize:n,type:"bytes"});const o=new Uint8Array(n);for(let s=0;s<n;s++){const a=t==="right";o[a?s:n-s-1]=e[a?s:e.length-s-1]}return o}const Vs=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Ut(e,t={}){return typeof e=="number"||typeof e=="bigint"?de(e,t):typeof e=="string"?yo(e,t):typeof e=="boolean"?go(e,t):dt(e,t)}function go(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Ot(n,{size:t.size}),Dt(n,{size:t.size})):n}function dt(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=Vs[e[s]];const o=`0x${n}`;return typeof t.size=="number"?(Ot(o,{size:t.size}),Dt(o,{dir:"right",size:t.size})):o}function de(e,t={}){const{signed:n,size:o}=t,s=BigInt(e);let a;o?n?a=(1n<<BigInt(o)*8n-1n)-1n:a=2n**(BigInt(o)*8n)-1n:typeof e=="number"&&(a=BigInt(Number.MAX_SAFE_INTEGER));const r=typeof a=="bigint"&&n?-a-1n:0;if(a&&s>a||s<r){const d=typeof e=="bigint"?"n":"";throw new En({max:a?`${a}${d}`:void 0,min:`${r}${d}`,signed:n,size:o,value:`${e}${d}`})}const l=`0x${(n&&s<0?(1n<<BigInt(o*8))+BigInt(s):s).toString(16)}`;return o?Dt(l,{size:o}):l}const Gs=new TextEncoder;function yo(e,t={}){const n=Gs.encode(e);return dt(n,t)}const zs=new TextEncoder;function Nn(e,t={}){return typeof e=="number"||typeof e=="bigint"?Ys(e,t):typeof e=="boolean"?qs(e,t):Ft(e)?Tt(e,t):ko(e,t)}function qs(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(Ot(n,{size:t.size}),Dt(n,{size:t.size})):n}const ut={zero:48,nine:57,A:65,F:70,a:97,f:102};function vo(e){if(e>=ut.zero&&e<=ut.nine)return e-ut.zero;if(e>=ut.A&&e<=ut.F)return e-(ut.A-10);if(e>=ut.a&&e<=ut.f)return e-(ut.a-10)}function Tt(e,t={}){let n=e;t.size&&(Ot(n,{size:t.size}),n=Dt(n,{dir:"right",size:t.size}));let o=n.slice(2);o.length%2&&(o=`0${o}`);const s=o.length/2,a=new Uint8Array(s);for(let r=0,l=0;r<s;r++){const d=vo(o.charCodeAt(l++)),E=vo(o.charCodeAt(l++));if(d===void 0||E===void 0)throw new pe(`Invalid byte sequence ("${o[l-2]}${o[l-1]}" in "${o}").`);a[r]=d*16+E}return a}function Ys(e,t){const n=de(e,t);return Tt(n)}function ko(e,t={}){const n=zs.encode(e);return typeof t.size=="number"?(Ot(n,{size:t.size}),Dt(n,{dir:"right",size:t.size})):n}function Ot(e,{size:t}){if(We(e)>t)throw new Hs({givenSize:We(e),maxSize:t})}function Lt(e,t={}){const{signed:n}=t;t.size&&Ot(e,{size:t.size});const o=BigInt(e);if(!n)return o;const s=(e.length-2)/2,a=(1n<<BigInt(s)*8n-1n)-1n;return o<=a?o:o-BigInt(`0x${"f".padStart(s*2,"f")}`)-1n}function rn(e,t={}){const n=Lt(e,t),o=Number(n);if(!Number.isSafeInteger(o))throw new En({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${n}n`});return o}function Bn(e,t){return({exclude:n,format:o})=>({exclude:n,format:(s,a)=>{const r=t(s,a);if(n)for(const l of n)delete r[l];return{...r,...o(s,a)}},type:e})}const Ao={"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?rn(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?rn(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Ao[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=Bn("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=Bn("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 ea(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?rn(e.transactionIndex):null,status:e.status?Qs[e.status]:null,type:e.type?Ao[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const ta=Bn("transactionReceipt",ea),na={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function oa(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=sa(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=>dt(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=na[e.type]),typeof e.value<"u"&&(n.value=de(e.value)),n}function sa(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 Mt=2n**256n-1n;function _t(e){return typeof e[0]=="string"?xt(e):aa(e)}function aa(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 xt(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}class To extends pe{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class ra extends pe{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class ia extends pe{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const ca={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 ia({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new ra({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new To({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 To({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 xo(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(ca);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function St(e,t="hex"){const n=So(e),o=xo(new Uint8Array(n.length));return n.encode(o),t==="hex"?dt(o.bytes):o.bytes}function So(e){return Array.isArray(e)?la(e.map(t=>So(t))):da(e)}function la(e){const t=e.reduce((s,a)=>s+a.length,0),n=Eo(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:a}of e)a(s)}}}function da(e){const t=typeof e=="string"?Tt(e):e,n=Eo(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 Eo(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 ua={gwei:9,wei:18},fa={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,a]=[n.slice(0,n.length-t),n.slice(n.length-t)];return a=a.replace(/(0+)$/,""),`${o?"-":""}${s||"0"}${a?`.${a}`:""}`}function pa(e,t="wei"){return Ue(e,ua[t])}function Et(e,t="wei"){return Ue(e,fa[t])}function No(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(`
|
|
79
|
-
`)}class ma extends pe{constructor({v:t}){super(`Invalid \`v\` value "${t}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class ha extends pe{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",No(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 ba 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 wa(e){if(!e||e.length===0)return[];const t=[];for(const n of e){const{chainId:o,nonce:s,...a}=n,r=n.address;t.push([o?Ut(o):"0x",r,s?Ut(s):"0x",...jt({},a)])}return t}function Bo(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=>Tt(a)):e.blobs,s=[];for(const a of o)s.push(Uint8Array.from(t.blobToKzgCommitment(a)));return n==="bytes"?s:s.map(a=>dt(a))}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(r=>Tt(r)):e.blobs,s=typeof e.commitments[0]=="string"?e.commitments.map(r=>Tt(r)):e.commitments,a=[];for(let r=0;r<o.length;r++){const l=o[r],d=s[r];a.push(Uint8Array.from(t.computeBlobKzgProof(l,d)))}return n==="bytes"?a:a.map(r=>dt(r))}function ga(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Io(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Gt(e,...t){if(!ga(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 cn(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 Po(e,t){Gt(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function ya(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function zt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function In(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function rt(e,t){return e<<32-t|e>>>t}const va=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function ka(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Aa(e){for(let t=0;t<e.length;t++)e[t]=ka(e[t]);return e}const Fo=va?e=>e:Aa;function Ta(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Pn(e){return typeof e=="string"&&(e=Ta(e)),Gt(e),e}class Do{}function Uo(e){const t=o=>e().update(Pn(o)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function xa(e,t,n,o){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,o);const s=BigInt(32),a=BigInt(4294967295),r=Number(n>>s&a),l=Number(n&a),d=o?4:0,E=o?0:4;e.setUint32(t+d,r,o),e.setUint32(t+E,l,o)}function Sa(e,t,n){return e&t^~e&n}function Ea(e,t,n){return e&t^e&n^t&n}class Na extends Do{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=In(this.buffer)}update(t){cn(this),t=Pn(t),Gt(t);const{view:n,buffer:o,blockLen:s}=this,a=t.length;for(let r=0;r<a;){const l=Math.min(s-this.pos,a-r);if(l===s){const d=In(t);for(;s<=a-r;r+=s)this.process(d,r);continue}o.set(t.subarray(r,r+l),this.pos),this.pos+=l,r+=l,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){cn(this),Po(t,this),this.finished=!0;const{buffer:n,view:o,blockLen:s,isLE:a}=this;let{pos:r}=this;n[r++]=128,zt(this.buffer.subarray(r)),this.padOffset>s-r&&(this.process(o,0),r=0);for(let M=r;M<s;M++)n[M]=0;xa(o,s-8,BigInt(this.length*8),a),this.process(o,0);const l=In(t),d=this.outputLen;if(d%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const E=d/4,I=this.get();if(E>I.length)throw new Error("_sha2: outputLen bigger than state");for(let M=0;M<E;M++)l.setUint32(4*M,I[M],a)}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:a,destroyed:r,pos:l}=this;return t.destroyed=r,t.finished=a,t.length=s,t.pos=l,s%n&&t.buffer.set(o),t}clone(){return this._cloneInto()}}const gt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ln=BigInt(2**32-1),Oo=BigInt(32);function Ba(e,t=!1){return t?{h:Number(e&ln),l:Number(e>>Oo&ln)}:{h:Number(e>>Oo&ln)|0,l:Number(e&ln)|0}}function Ca(e,t=!1){const n=e.length;let o=new Uint32Array(n),s=new Uint32Array(n);for(let a=0;a<n;a++){const{h:r,l}=Ba(e[a],t);[o[a],s[a]]=[r,l]}return[o,s]}const Ia=(e,t,n)=>e<<n|t>>>32-n,Pa=(e,t,n)=>t<<n|e>>>32-n,Fa=(e,t,n)=>t<<n-32|e>>>64-n,Da=(e,t,n)=>e<<n-32|t>>>64-n,Ua=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]),yt=new Uint32Array(64);class Oa extends Na{constructor(t=32){super(64,t,8,!1),this.A=gt[0]|0,this.B=gt[1]|0,this.C=gt[2]|0,this.D=gt[3]|0,this.E=gt[4]|0,this.F=gt[5]|0,this.G=gt[6]|0,this.H=gt[7]|0}get(){const{A:t,B:n,C:o,D:s,E:a,F:r,G:l,H:d}=this;return[t,n,o,s,a,r,l,d]}set(t,n,o,s,a,r,l,d){this.A=t|0,this.B=n|0,this.C=o|0,this.D=s|0,this.E=a|0,this.F=r|0,this.G=l|0,this.H=d|0}process(t,n){for(let M=0;M<16;M++,n+=4)yt[M]=t.getUint32(n,!1);for(let M=16;M<64;M++){const w=yt[M-15],S=yt[M-2],g=rt(w,7)^rt(w,18)^w>>>3,N=rt(S,17)^rt(S,19)^S>>>10;yt[M]=N+yt[M-7]+g+yt[M-16]|0}let{A:o,B:s,C:a,D:r,E:l,F:d,G:E,H:I}=this;for(let M=0;M<64;M++){const w=rt(l,6)^rt(l,11)^rt(l,25),S=I+w+Sa(l,d,E)+Ua[M]+yt[M]|0,N=(rt(o,2)^rt(o,13)^rt(o,22))+Ea(o,s,a)|0;I=E,E=d,d=l,l=r+S|0,r=a,a=s,s=o,o=S+N|0}o=o+this.A|0,s=s+this.B|0,a=a+this.C|0,r=r+this.D|0,l=l+this.E|0,d=d+this.F|0,E=E+this.G|0,I=I+this.H|0,this.set(o,s,a,r,l,d,E,I)}roundClean(){zt(yt)}destroy(){this.set(0,0,0,0,0,0,0,0),zt(this.buffer)}}const La=Uo(()=>new Oa);function Ma(e,t){return La(Ft(e,{strict:!1})?Nn(e):e)}function _a(e){const{commitment:t,version:n=1}=e,o=e.to??(typeof t=="string"?"hex":"bytes"),s=Ma(t);return s.set([n],0),o==="bytes"?s:dt(s)}function Ra(e){const{commitments:t,version:n}=e,o=e.to??(typeof t[0]=="string"?"hex":"bytes"),s=[];for(const a of t)s.push(_a({commitment:a,to:o,version:n}));return s}const Lo=6,Mo=32,Fn=4096,_o=Mo*Fn,Ro=_o*Lo-1-1*Fn*Lo,$o=1;class $a extends pe{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class Ho extends pe{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class Ha extends pe{constructor({hash:t,size:n}){super(`Versioned hash "${t}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${n}`],name:"InvalidVersionedHashSizeError"})}}class Wa extends pe{constructor({hash:t,version:n}){super(`Versioned hash "${t}" version is invalid.`,{metaMessages:[`Expected: ${$o}`,`Received: ${n}`],name:"InvalidVersionedHashVersionError"})}}function Va(e){const t=e.to??(typeof e.data=="string"?"hex":"bytes"),n=typeof e.data=="string"?Tt(e.data):e.data,o=We(n);if(!o)throw new Ho;if(o>Ro)throw new $a({maxSize:Ro,size:o});const s=[];let a=!0,r=0;for(;a;){const l=xo(new Uint8Array(_o));let d=0;for(;d<Fn;){const E=n.slice(r,r+(Mo-1));if(l.pushByte(0),l.pushBytes(E),E.length<31){l.pushByte(128),a=!1;break}d++,r+=31}s.push(l)}return t==="bytes"?s.map(l=>l.bytes):s.map(l=>dt(l.bytes))}function Ga(e){const{data:t,kzg:n,to:o}=e,s=e.blobs??Va({data:t,to:o}),a=e.commitments??Bo({blobs:s,kzg:n,to:o}),r=e.proofs??Co({blobs:s,commitments:a,kzg:n,to:o}),l=[];for(let d=0;d<s.length;d++)l.push({blob:s[d],commitment:a[d],proof:r[d]});return l}class it 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 dn extends pe{constructor({chainId:t}){super(typeof t=="number"?`Chain ID "${t}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}class Rt 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(Rt,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Rt,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});class Nt extends pe{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Et(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(Nt,"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 Dn extends pe{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Et(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Dn,"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 Un 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(Un,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class On 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(`
|
|
80
|
-
`),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(
|
|
81
|
-
`),{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(
|
|
82
|
-
`),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(qt,"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 Wo 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 za=BigInt(0),Yt=BigInt(1),qa=BigInt(2),Ya=BigInt(7),ja=BigInt(256),Ja=BigInt(113),Go=[],zo=[],qo=[];for(let e=0,t=Yt,n=1,o=0;e<24;e++){[n,o]=[o,(2*n+3*o)%5],Go.push(2*(5*o+n)),zo.push((e+1)*(e+2)/2%64);let s=za;for(let a=0;a<7;a++)t=(t<<Yt^(t>>Ya)*Ja)%ja,t&qa&&(s^=Yt<<(Yt<<BigInt(a))-Yt);qo.push(s)}const Yo=Ca(qo,!0),Xa=Yo[0],Ka=Yo[1],jo=(e,t,n)=>n>32?Fa(e,t,n):Ia(e,t,n),Jo=(e,t,n)=>n>32?Da(e,t,n):Pa(e,t,n);function Za(e,t=24){const n=new Uint32Array(10);for(let o=24-t;o<24;o++){for(let r=0;r<10;r++)n[r]=e[r]^e[r+10]^e[r+20]^e[r+30]^e[r+40];for(let r=0;r<10;r+=2){const l=(r+8)%10,d=(r+2)%10,E=n[d],I=n[d+1],M=jo(E,I,1)^n[l],w=Jo(E,I,1)^n[l+1];for(let S=0;S<50;S+=10)e[r+S]^=M,e[r+S+1]^=w}let s=e[2],a=e[3];for(let r=0;r<24;r++){const l=zo[r],d=jo(s,a,l),E=Jo(s,a,l),I=Go[r];s=e[I],a=e[I+1],e[I]=d,e[I+1]=E}for(let r=0;r<50;r+=10){for(let l=0;l<10;l++)n[l]=e[r+l];for(let l=0;l<10;l++)e[r+l]^=~n[(l+2)%10]&n[(l+4)%10]}e[0]^=Xa[o],e[1]^=Ka[o]}zt(n)}class Hn extends Do{constructor(t,n,o,s=!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=o,this.enableXOF=s,this.rounds=a,Io(o),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=ya(this.state)}clone(){return this._cloneInto()}keccak(){Fo(this.state32),Za(this.state32,this.rounds),Fo(this.state32),this.posOut=0,this.pos=0}update(t){cn(this),t=Pn(t),Gt(t);const{blockLen:n,state:o}=this,s=t.length;for(let a=0;a<s;){const r=Math.min(n-this.pos,s-a);for(let l=0;l<r;l++)o[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:o,blockLen:s}=this;t[o]^=n,(n&128)!==0&&o===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){cn(this,!1),Gt(t),this.finish();const n=this.state,{blockLen:o}=this;for(let s=0,a=t.length;s<a;){this.posOut>=o&&this.keccak();const r=Math.min(o-this.posOut,a-s);t.set(n.subarray(this.posOut,this.posOut+r),s),this.posOut+=r,s+=r}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Io(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Po(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,zt(this.state)}_cloneInto(t){const{blockLen:n,suffix:o,outputLen:s,rounds:a,enableXOF:r}=this;return t||(t=new Hn(n,o,s,r,a)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=o,t.outputLen=s,t.enableXOF=r,t.destroyed=this.destroyed,t}}const Qa=(e,t,n)=>Uo(()=>new Hn(t,e,n)),er=Qa(1,136,256/8);function Xo(e,t){const n=t||"hex",o=er(Ft(e,{strict:!1})?Nn(e):e);return n==="bytes"?o:Ut(o)}const Wn=new Vo(8192);function tr(e,t){if(Wn.has(`${e}.${t}`))return Wn.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),o=Xo(ko(n),"bytes"),s=n.split("");for(let r=0;r<40;r+=2)o[r>>1]>>4>=8&&s[r]&&(s[r]=s[r].toUpperCase()),(o[r>>1]&15)>=8&&s[r+1]&&(s[r+1]=s[r+1].toUpperCase());const a=`0x${s.join("")}`;return Wn.set(`${e}.${t}`,a),a}const nr=/^0x[a-fA-F0-9]{40}$/,Vn=new Vo(8192);function Re(e,t){const{strict:n=!0}=t??{},o=`${e}.${n}`;if(Vn.has(o))return Vn.get(o);const s=nr.test(e)?e.toLowerCase()===e?!0:n?tr(e)===e:!0:!1;return Vn.set(o,s),s}function Gn(e,t,n,{strict:o}={}){return Ft(e,{strict:!1})?sr(e,t,n,{strict:o}):or(e,t,n,{strict:o})}function Ko(e,t){if(typeof t=="number"&&t>0&&t>We(e)-1)throw new bo({offset:t,position:"start",size:We(e)})}function Zo(e,t,n){if(typeof t=="number"&&typeof n=="number"&&We(e)!==n-t)throw new bo({offset:n,position:"end",size:We(e)})}function or(e,t,n,{strict:o}={}){Ko(e,t);const s=e.slice(t,n);return o&&Zo(s,t,n),s}function sr(e,t,n,{strict:o}={}){Ko(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&Zo(s,t,n),s}function ar(e){const{authorizationList:t}=e;if(t)for(const n of t){const{chainId:o}=n,s=n.address;if(!Re(s))throw new it({address:s});if(o<0)throw new dn({chainId:o})}zn(e)}function rr(e){const{blobVersionedHashes:t}=e;if(t){if(t.length===0)throw new Ho;for(const n of t){const o=We(n),s=rn(Gn(n,0,1));if(o!==32)throw new Ha({hash:n,size:o});if(s!==$o)throw new Wa({hash:n,version:s})}}zn(e)}function zn(e){const{chainId:t,maxPriorityFeePerGas:n,maxFeePerGas:o,to:s}=e;if(t<=0)throw new dn({chainId:t});if(s&&!Re(s))throw new it({address:s});if(o&&o>Mt)throw new Nt({maxFeePerGas:o});if(n&&o&&n>o)throw new qt({maxFeePerGas:o,maxPriorityFeePerGas:n})}function ir(e){const{chainId:t,maxPriorityFeePerGas:n,gasPrice:o,maxFeePerGas:s,to:a}=e;if(t<=0)throw new dn({chainId:t});if(a&&!Re(a))throw new it({address:a});if(n||s)throw new pe("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(o&&o>Mt)throw new Nt({maxFeePerGas:o})}function cr(e){const{chainId:t,maxPriorityFeePerGas:n,gasPrice:o,maxFeePerGas:s,to:a}=e;if(a&&!Re(a))throw new it({address:a});if(typeof t<"u"&&t<=0)throw new dn({chainId:t});if(n||s)throw new pe("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(o&&o>Mt)throw new Nt({maxFeePerGas:o})}function lr(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 ha({transaction:e})}function un(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 a=0;a<s.length;a++)if(s[a].length-2!==64)throw new ba({storageKey:s[a]});if(!Re(o,{strict:!1}))throw new it({address:o});t.push([o,s])}return t}function dr(e,t){const n=lr(e);return n==="eip1559"?pr(e,t):n==="eip2930"?mr(e,t):n==="eip4844"?fr(e,t):n==="eip7702"?ur(e,t):hr(e,t)}function ur(e,t){const{authorizationList:n,chainId:o,gas:s,nonce:a,to:r,value:l,maxFeePerGas:d,maxPriorityFeePerGas:E,accessList:I,data:M}=e;ar(e);const w=un(I),S=wa(n);return xt(["0x04",St([de(o),a?de(a):"0x",E?de(E):"0x",d?de(d):"0x",s?de(s):"0x",r??"0x",l?de(l):"0x",M??"0x",w,S,...jt(e,t)])])}function fr(e,t){const{chainId:n,gas:o,nonce:s,to:a,value:r,maxFeePerBlobGas:l,maxFeePerGas:d,maxPriorityFeePerGas:E,accessList:I,data:M}=e;rr(e);let w=e.blobVersionedHashes,S=e.sidecars;if(e.blobs&&(typeof w>"u"||typeof S>"u")){const G=typeof e.blobs[0]=="string"?e.blobs:e.blobs.map(ye=>dt(ye)),ne=e.kzg,he=Bo({blobs:G,kzg:ne});if(typeof w>"u"&&(w=Ra({commitments:he})),typeof S>"u"){const ye=Co({blobs:G,commitments:he,kzg:ne});S=Ga({blobs:G,commitments:he,proofs:ye})}}const g=un(I),N=[de(n),s?de(s):"0x",E?de(E):"0x",d?de(d):"0x",o?de(o):"0x",a??"0x",r?de(r):"0x",M??"0x",g,l?de(l):"0x",w??[],...jt(e,t)],L=[],K=[],B=[];if(S)for(let G=0;G<S.length;G++){const{blob:ne,commitment:he,proof:ye}=S[G];L.push(ne),K.push(he),B.push(ye)}return xt(["0x03",St(S?[N,L,K,B]:N)])}function pr(e,t){const{chainId:n,gas:o,nonce:s,to:a,value:r,maxFeePerGas:l,maxPriorityFeePerGas:d,accessList:E,data:I}=e;zn(e);const M=un(E),w=[de(n),s?de(s):"0x",d?de(d):"0x",l?de(l):"0x",o?de(o):"0x",a??"0x",r?de(r):"0x",I??"0x",M,...jt(e,t)];return xt(["0x02",St(w)])}function mr(e,t){const{chainId:n,gas:o,data:s,nonce:a,to:r,value:l,accessList:d,gasPrice:E}=e;ir(e);const I=un(d),M=[de(n),a?de(a):"0x",E?de(E):"0x",o?de(o):"0x",r??"0x",l?de(l):"0x",s??"0x",I,...jt(e,t)];return xt(["0x01",St(M)])}function hr(e,t){const{chainId:n=0,gas:o,data:s,nonce:a,to:r,value:l,gasPrice:d}=e;cr(e);let E=[a?de(a):"0x",d?de(d):"0x",o?de(o):"0x",r??"0x",l?de(l):"0x",s??"0x"];if(t){const I=(()=>{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 S=27n+(t.v===27n?0n:1n);if(t.v!==S)throw new ma({v:t.v});return S})(),M=an(t.r),w=an(t.s);E=[...E,de(I),M==="0x00"?"0x":M,w==="0x00"?"0x":w]}else n>0&&(E=[...E,de(n),"0x","0x"]);return St(E)}function jt(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 a=an(n.r),r=an(n.s);return[typeof s=="number"?s?de(1):"0x":o===0n?"0x":o===1n?de(1):o===27n?"0x":de(1),a==="0x00"?"0x":a,r==="0x00"?"0x":r]}const br={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},wr={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?Lt(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?Lt(e.mint):void 0,t.sourceHash=e.sourceHash,t.type="deposit"),t}}),transactionReceipt:ta({format(e){return{l1GasPrice:e.l1GasPrice?Lt(e.l1GasPrice):null,l1GasUsed:e.l1GasUsed?Lt(e.l1GasUsed):null,l1Fee:e.l1Fee?Lt(e.l1Fee):null,l1FeeScalar:e.l1FeeScalar?Number(e.l1FeeScalar):null}}})};function gr(e,t){return kr(e)?vr(e):dr(e,t)}const yr={transaction:gr};function vr(e){Ar(e);const{sourceHash:t,data:n,from:o,gas:s,isSystemTx:a,mint:r,to:l,value:d}=e,E=[t,o,l??"0x",r?Ut(r):"0x",d?Ut(d):"0x",s?Ut(s):"0x",a?"0x1":"0x",n??"0x"];return xt(["0x7e",St(E)])}function kr(e){return e.type==="deposit"||typeof e.sourceHash<"u"}function Ar(e){const{from:t,to:n}=e;if(t&&!Re(t))throw new it({address:t});if(n&&!Re(n))throw new it({address:n})}const fn={blockTime:2e3,contracts:br,formatters:wr,serializers:yr},Tr=lt({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}}}),xr=lt({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}}}),Jt=1,Qo=lt({...fn,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:{...fn.contracts,disputeGameFactory:{[Jt]:{address:"0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e"}},l2OutputOracle:{[Jt]:{address:"0x56315b90c40730925ec5485cf004d835058518A0"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:5022},portal:{[Jt]:{address:"0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",blockCreated:17482143}},l1StandardBridge:{[Jt]:{address:"0x3154Cf16ccdb4C6d922629664174b904d80F2C35",blockCreated:17482143}}},sourceId:Jt});({...Qo});const Sr=lt({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 qn(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}class Er 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(`
|
|
83
|
-
`),{docsPath:t,docsSlug:"account",name:"AccountNotFoundError"})}}function
|
|
84
|
-
`),{name:"AbiEncodingArrayLengthMismatchError"})}}class
|
|
85
|
-
`),{name:"AbiEncodingLengthMismatchError"})}}class
|
|
86
|
-
`),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class
|
|
87
|
-
`),{docsPath:n,name:"InvalidAbiEncodingType"})}}class
|
|
88
|
-
`),{name:"InvalidArrayError"})}}class
|
|
89
|
-
`),{name:"InvalidDefinitionTypeError"})}}const
|
|
90
|
-
`,"")}function
|
|
77
|
+
选择要操作的代币:`,viewBalancesEmpty:"💰 您的钱包在此链上没有任何代币。",viewBalancesFetchError:"获取余额时遇到错误,请重试。",buttonSendToken:"发送{symbol}",buttonSwapToken:"兑换{symbol}",buttonBuyMoreToken:"购买更多{symbol}",actionSendNativeLabel:"发送原生代币",actionSendNativeDesc:"发送原生代币(ETH、BNB、MATIC 等)到某个地址",actionSendTokenLabel:"发送代币(ERC20)",actionSendTokenDesc:"将 ERC20 代币发送到某个地址",actionSwapTokenLabel:"兑换代币",actionSwapTokenDesc:"将一种代币兑换为另一种代币",actionApproveTokenLabel:"授权代币",actionApproveTokenDesc:"授权某地址使用您的代币",actionWrapNativeLabel:"包装原生代币",actionWrapNativeDesc:"包装原生代币(ETH → WETH)",actionUnwrapNativeLabel:"解包原生代币",actionUnwrapNativeDesc:"解包原生代币(WETH → ETH)",actionSendNftLabel:"发送 NFT",actionSendNftDesc:"将 ERC721 或 ERC1155 NFT 转移到另一个地址",fieldToAddress:"收款地址",fieldAmount:"数量",fieldTokenContract:"代币合约",fieldTokenSymbol:"代币符号",fieldDecimals:"小数位数",fieldTokenIn:"源代币",fieldTokenInSymbol:"源代币符号",fieldTokenOut:"目标代币",fieldTokenOutSymbol:"目标代币符号",fieldTokenInDecimals:"源代币小数位",fieldTokenOutDecimals:"目标代币小数位",fieldSpenderAddress:"授权地址",fieldAmountUnlimited:"数量(留空 = 无限授权)",fieldNftContract:"NFT 合约",fieldTokenId:"Token ID",fieldTokenStandard:"代币标准",fieldNftName:"NFT 名称",formMustBePositiveInteger:"必须是正整数",formAmountExceedsNft:"数量不能超过可用余额 {max}"}};function mo(e,t){return po[t]?.[e]??po.en[e]??e}function Hs(e,t){return e.replace(/\{(\w+)\}/g,(n,o)=>t[o]??`{${o}}`)}const ho=ne.createContext(void 0),Ws=({children:e,initialLanguage:t="en"})=>{const[n,o]=ne.useState(t);ne.useEffect(()=>{t&&o(t)},[t]);const s=ne.useCallback(r=>mo(r,n),[n]),a=ne.useCallback((r,l)=>Hs(mo(r,n),l),[n]);return P.jsx(ho.Provider,{value:{language:n,setLanguage:o,t:s,ti:a},children:e})},En=()=>{const e=ne.useContext(ho);if(!e)throw new Error("useLanguage must be used within a LanguageProvider");return e},Vs=ne.memo(({onClick:e})=>{const{t}=En(),n=o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),e())};return P.jsx("button",{className:"chat-button",onClick:e,onKeyDown:n,"aria-label":t("openChat"),title:t("openChatTitle"),type:"button",children:P.jsx("img",{src:$s,width:56,height:56,alt:"Ask AI"})})});function ut(e){const t={formatters:void 0,fees:void 0,serializers:void 0,...e};function n(o){return s=>{const a=typeof s=="function"?s(o):s,r={...o,...a};return Object.assign(r,{extend:n(r)})}}return Object.assign(t,{extend:n(t)})}const bo="2.45.1";let Nn={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${bo}`};class ue extends Error{constructor(t,n={}){const o=n.cause instanceof ue?n.cause.details:n.cause?.message?n.cause.message:n.details,s=n.cause instanceof ue&&n.cause.docsPath||n.docsPath,a=Nn.getDocsUrl?.({...n,docsPath:s}),r=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...o?[`Details: ${o}`]:[],...Nn.version?[`Version: ${Nn.version}`]:[]].join(`
|
|
78
|
+
`);super(r,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=bo}walk(t){return go(this,t)}}function go(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?go(e.cause,t):t?null:e}class Cn extends ue{constructor({max:t,min:n,signed:o,size:s,value:a}){super(`Number "${a}" is not in safe ${s?`${s*8}-bit ${o?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class Gs extends ue{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Dt(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 Dt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function cn(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 wo extends ue{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 yo extends ue{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 _t(e,{dir:t,size:n=32}={}){return typeof e=="string"?wt(e,{dir:t,size:n}):zs(e,{dir:t,size:n})}function wt(e,{dir:t,size:n=32}={}){if(n===null)return e;const o=e.replace("0x","");if(o.length>n*2)throw new yo({size:Math.ceil(o.length/2),targetSize:n,type:"hex"});return`0x${o[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function zs(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new yo({size:e.length,targetSize:n,type:"bytes"});const o=new Uint8Array(n);for(let s=0;s<n;s++){const a=t==="right";o[a?s:n-s-1]=e[a?s:e.length-s-1]}return o}const qs=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Ut(e,t={}){return typeof e=="number"||typeof e=="bigint"?le(e,t):typeof e=="string"?ko(e,t):typeof e=="boolean"?vo(e,t):ft(e,t)}function vo(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Ot(n,{size:t.size}),_t(n,{size:t.size})):n}function ft(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=qs[e[s]];const o=`0x${n}`;return typeof t.size=="number"?(Ot(o,{size:t.size}),_t(o,{dir:"right",size:t.size})):o}function le(e,t={}){const{signed:n,size:o}=t,s=BigInt(e);let a;o?n?a=(1n<<BigInt(o)*8n-1n)-1n:a=2n**(BigInt(o)*8n)-1n:typeof e=="number"&&(a=BigInt(Number.MAX_SAFE_INTEGER));const r=typeof a=="bigint"&&n?-a-1n:0;if(a&&s>a||s<r){const d=typeof e=="bigint"?"n":"";throw new Cn({max:a?`${a}${d}`:void 0,min:`${r}${d}`,signed:n,size:o,value:`${e}${d}`})}const l=`0x${(n&&s<0?(1n<<BigInt(o*8))+BigInt(s):s).toString(16)}`;return o?_t(l,{size:o}):l}const Ys=new TextEncoder;function ko(e,t={}){const n=Ys.encode(e);return ft(n,t)}const js=new TextEncoder;function Bn(e,t={}){return typeof e=="number"||typeof e=="bigint"?Xs(e,t):typeof e=="boolean"?Js(e,t):Dt(e)?xt(e,t):To(e,t)}function Js(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(Ot(n,{size:t.size}),_t(n,{size:t.size})):n}const pt={zero:48,nine:57,A:65,F:70,a:97,f:102};function Ao(e){if(e>=pt.zero&&e<=pt.nine)return e-pt.zero;if(e>=pt.A&&e<=pt.F)return e-(pt.A-10);if(e>=pt.a&&e<=pt.f)return e-(pt.a-10)}function xt(e,t={}){let n=e;t.size&&(Ot(n,{size:t.size}),n=_t(n,{dir:"right",size:t.size}));let o=n.slice(2);o.length%2&&(o=`0${o}`);const s=o.length/2,a=new Uint8Array(s);for(let r=0,l=0;r<s;r++){const d=Ao(o.charCodeAt(l++)),T=Ao(o.charCodeAt(l++));if(d===void 0||T===void 0)throw new ue(`Invalid byte sequence ("${o[l-2]}${o[l-1]}" in "${o}").`);a[r]=d*16+T}return a}function Xs(e,t){const n=le(e,t);return xt(n)}function To(e,t={}){const n=js.encode(e);return typeof t.size=="number"?(Ot(n,{size:t.size}),_t(n,{dir:"right",size:t.size})):n}function Ot(e,{size:t}){if(Ve(e)>t)throw new Gs({givenSize:Ve(e),maxSize:t})}function Lt(e,t={}){const{signed:n}=t;t.size&&Ot(e,{size:t.size});const o=BigInt(e);if(!n)return o;const s=(e.length-2)/2,a=(1n<<BigInt(s)*8n-1n)-1n;return o<=a?o:o-BigInt(`0x${"f".padStart(s*2,"f")}`)-1n}function ln(e,t={}){const n=Lt(e,t),o=Number(n);if(!Number.isSafeInteger(o))throw new Cn({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${n}n`});return o}function In(e,t){return({exclude:n,format:o})=>({exclude:n,format:(s,a)=>{const r=t(s,a);if(n)for(const l of n)delete r[l];return{...r,...o(s,a)}},type:e})}const xo={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Pn(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?ln(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?ln(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?xo[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=Zs(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 Ks=In("transaction",Pn);function Zs(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 Qs(e,t){const n=(e.transactions??[]).map(o=>typeof o=="string"?o:Pn(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 ea=In("block",Qs);function ta(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 na={"0x0":"reverted","0x1":"success"};function oa(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=>ta(o)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?ln(e.transactionIndex):null,status:e.status?na[e.status]:null,type:e.type?xo[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const sa=In("transactionReceipt",oa),aa={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function ra(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=ia(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=>ft(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=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=aa[e.type]),typeof e.value<"u"&&(n.value=le(e.value)),n}function ia(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 Mt=2n**256n-1n;function Rt(e){return typeof e[0]=="string"?St(e):ca(e)}function ca(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 St(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}class So extends ue{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class la extends ue{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class da extends ue{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const ua={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 da({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new la({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new So({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 So({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 Eo(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(ua);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function Et(e,t="hex"){const n=No(e),o=Eo(new Uint8Array(n.length));return n.encode(o),t==="hex"?ft(o.bytes):o.bytes}function No(e){return Array.isArray(e)?fa(e.map(t=>No(t))):pa(e)}function fa(e){const t=e.reduce((s,a)=>s+a.length,0),n=Co(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:a}of e)a(s)}}}function pa(e){const t=typeof e=="string"?xt(e):e,n=Co(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 Co(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 ue("Length is too large.")}const ma={gwei:9,wei:18},ha={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,a]=[n.slice(0,n.length-t),n.slice(n.length-t)];return a=a.replace(/(0+)$/,""),`${o?"-":""}${s||"0"}${a?`.${a}`:""}`}function ba(e,t="wei"){return Ue(e,ma[t])}function Nt(e,t="wei"){return Ue(e,ha[t])}function Bo(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(`
|
|
79
|
+
`)}class ga extends ue{constructor({v:t}){super(`Invalid \`v\` value "${t}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class wa extends ue{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Bo(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 ya extends ue{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 va(e){if(!e||e.length===0)return[];const t=[];for(const n of e){const{chainId:o,nonce:s,...a}=n,r=n.address;t.push([o?Ut(o):"0x",r,s?Ut(s):"0x",...Jt({},a)])}return t}function Io(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=>xt(a)):e.blobs,s=[];for(const a of o)s.push(Uint8Array.from(t.blobToKzgCommitment(a)));return n==="bytes"?s:s.map(a=>ft(a))}function Po(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=>xt(r)):e.blobs,s=typeof e.commitments[0]=="string"?e.commitments.map(r=>xt(r)):e.commitments,a=[];for(let r=0;r<o.length;r++){const l=o[r],d=s[r];a.push(Uint8Array.from(t.computeBlobKzgProof(l,d)))}return n==="bytes"?a:a.map(r=>ft(r))}function ka(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Fo(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function zt(e,...t){if(!ka(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 dn(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 Do(e,t){zt(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Aa(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function qt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Fn(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function it(e,t){return e<<32-t|e>>>t}const Ta=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function xa(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Sa(e){for(let t=0;t<e.length;t++)e[t]=xa(e[t]);return e}const _o=Ta?e=>e:Sa;function Ea(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Dn(e){return typeof e=="string"&&(e=Ea(e)),zt(e),e}class Uo{}function Oo(e){const t=o=>e().update(Dn(o)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Na(e,t,n,o){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,o);const s=BigInt(32),a=BigInt(4294967295),r=Number(n>>s&a),l=Number(n&a),d=o?4:0,T=o?0:4;e.setUint32(t+d,r,o),e.setUint32(t+T,l,o)}function Ca(e,t,n){return e&t^~e&n}function Ba(e,t,n){return e&t^e&n^t&n}class Ia extends Uo{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=Fn(this.buffer)}update(t){dn(this),t=Dn(t),zt(t);const{view:n,buffer:o,blockLen:s}=this,a=t.length;for(let r=0;r<a;){const l=Math.min(s-this.pos,a-r);if(l===s){const d=Fn(t);for(;s<=a-r;r+=s)this.process(d,r);continue}o.set(t.subarray(r,r+l),this.pos),this.pos+=l,r+=l,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){dn(this),Do(t,this),this.finished=!0;const{buffer:n,view:o,blockLen:s,isLE:a}=this;let{pos:r}=this;n[r++]=128,qt(this.buffer.subarray(r)),this.padOffset>s-r&&(this.process(o,0),r=0);for(let M=r;M<s;M++)n[M]=0;Na(o,s-8,BigInt(this.length*8),a),this.process(o,0);const l=Fn(t),d=this.outputLen;if(d%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const T=d/4,C=this.get();if(T>C.length)throw new Error("_sha2: outputLen bigger than state");for(let M=0;M<T;M++)l.setUint32(4*M,C[M],a)}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:a,destroyed:r,pos:l}=this;return t.destroyed=r,t.finished=a,t.length=s,t.pos=l,s%n&&t.buffer.set(o),t}clone(){return this._cloneInto()}}const yt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),un=BigInt(2**32-1),Lo=BigInt(32);function Pa(e,t=!1){return t?{h:Number(e&un),l:Number(e>>Lo&un)}:{h:Number(e>>Lo&un)|0,l:Number(e&un)|0}}function Fa(e,t=!1){const n=e.length;let o=new Uint32Array(n),s=new Uint32Array(n);for(let a=0;a<n;a++){const{h:r,l}=Pa(e[a],t);[o[a],s[a]]=[r,l]}return[o,s]}const Da=(e,t,n)=>e<<n|t>>>32-n,_a=(e,t,n)=>t<<n|e>>>32-n,Ua=(e,t,n)=>t<<n-32|e>>>64-n,Oa=(e,t,n)=>e<<n-32|t>>>64-n,La=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]),vt=new Uint32Array(64);class Ma extends Ia{constructor(t=32){super(64,t,8,!1),this.A=yt[0]|0,this.B=yt[1]|0,this.C=yt[2]|0,this.D=yt[3]|0,this.E=yt[4]|0,this.F=yt[5]|0,this.G=yt[6]|0,this.H=yt[7]|0}get(){const{A:t,B:n,C:o,D:s,E:a,F:r,G:l,H:d}=this;return[t,n,o,s,a,r,l,d]}set(t,n,o,s,a,r,l,d){this.A=t|0,this.B=n|0,this.C=o|0,this.D=s|0,this.E=a|0,this.F=r|0,this.G=l|0,this.H=d|0}process(t,n){for(let M=0;M<16;M++,n+=4)vt[M]=t.getUint32(n,!1);for(let M=16;M<64;M++){const h=vt[M-15],x=vt[M-2],m=it(h,7)^it(h,18)^h>>>3,B=it(x,17)^it(x,19)^x>>>10;vt[M]=B+vt[M-7]+m+vt[M-16]|0}let{A:o,B:s,C:a,D:r,E:l,F:d,G:T,H:C}=this;for(let M=0;M<64;M++){const h=it(l,6)^it(l,11)^it(l,25),x=C+h+Ca(l,d,T)+La[M]+vt[M]|0,B=(it(o,2)^it(o,13)^it(o,22))+Ba(o,s,a)|0;C=T,T=d,d=l,l=r+x|0,r=a,a=s,s=o,o=x+B|0}o=o+this.A|0,s=s+this.B|0,a=a+this.C|0,r=r+this.D|0,l=l+this.E|0,d=d+this.F|0,T=T+this.G|0,C=C+this.H|0,this.set(o,s,a,r,l,d,T,C)}roundClean(){qt(vt)}destroy(){this.set(0,0,0,0,0,0,0,0),qt(this.buffer)}}const Ra=Oo(()=>new Ma);function $a(e,t){return Ra(Dt(e,{strict:!1})?Bn(e):e)}function Ha(e){const{commitment:t,version:n=1}=e,o=e.to??(typeof t=="string"?"hex":"bytes"),s=$a(t);return s.set([n],0),o==="bytes"?s:ft(s)}function Wa(e){const{commitments:t,version:n}=e,o=e.to??(typeof t[0]=="string"?"hex":"bytes"),s=[];for(const a of t)s.push(Ha({commitment:a,to:o,version:n}));return s}const Mo=6,Ro=32,_n=4096,$o=Ro*_n,Ho=$o*Mo-1-1*_n*Mo,Wo=1;class Va extends ue{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class Vo extends ue{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class Ga extends ue{constructor({hash:t,size:n}){super(`Versioned hash "${t}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${n}`],name:"InvalidVersionedHashSizeError"})}}class za extends ue{constructor({hash:t,version:n}){super(`Versioned hash "${t}" version is invalid.`,{metaMessages:[`Expected: ${Wo}`,`Received: ${n}`],name:"InvalidVersionedHashVersionError"})}}function qa(e){const t=e.to??(typeof e.data=="string"?"hex":"bytes"),n=typeof e.data=="string"?xt(e.data):e.data,o=Ve(n);if(!o)throw new Vo;if(o>Ho)throw new Va({maxSize:Ho,size:o});const s=[];let a=!0,r=0;for(;a;){const l=Eo(new Uint8Array($o));let d=0;for(;d<_n;){const T=n.slice(r,r+(Ro-1));if(l.pushByte(0),l.pushBytes(T),T.length<31){l.pushByte(128),a=!1;break}d++,r+=31}s.push(l)}return t==="bytes"?s.map(l=>l.bytes):s.map(l=>ft(l.bytes))}function Ya(e){const{data:t,kzg:n,to:o}=e,s=e.blobs??qa({data:t,to:o}),a=e.commitments??Io({blobs:s,kzg:n,to:o}),r=e.proofs??Po({blobs:s,commitments:a,kzg:n,to:o}),l=[];for(let d=0;d<s.length;d++)l.push({blob:s[d],commitment:a[d],proof:r[d]});return l}class ct extends ue{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 fn extends ue{constructor({chainId:t}){super(typeof t=="number"?`Chain ID "${t}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}class $t extends ue{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 Ct extends ue{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Nt(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(Ct,"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 Un extends ue{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Nt(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Un,"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 On extends ue{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(On,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Ln extends ue{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(`
|
|
80
|
+
`),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(Ln,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Mn extends ue{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(Mn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Rn extends ue{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
|
|
81
|
+
`),{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(Rn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class $n extends ue{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($n,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Hn extends ue{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(Hn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Wn extends ue{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Wn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Yt extends ue{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:o}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Nt(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${o?` = ${Nt(o)} gwei`:""}).`].join(`
|
|
82
|
+
`),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(Yt,"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 Go extends ue{constructor({cause:t}){super(`An error occurred while executing: ${t?.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}class zo 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 ja=BigInt(0),jt=BigInt(1),Ja=BigInt(2),Xa=BigInt(7),Ka=BigInt(256),Za=BigInt(113),qo=[],Yo=[],jo=[];for(let e=0,t=jt,n=1,o=0;e<24;e++){[n,o]=[o,(2*n+3*o)%5],qo.push(2*(5*o+n)),Yo.push((e+1)*(e+2)/2%64);let s=ja;for(let a=0;a<7;a++)t=(t<<jt^(t>>Xa)*Za)%Ka,t&Ja&&(s^=jt<<(jt<<BigInt(a))-jt);jo.push(s)}const Jo=Fa(jo,!0),Qa=Jo[0],er=Jo[1],Xo=(e,t,n)=>n>32?Ua(e,t,n):Da(e,t,n),Ko=(e,t,n)=>n>32?Oa(e,t,n):_a(e,t,n);function tr(e,t=24){const n=new Uint32Array(10);for(let o=24-t;o<24;o++){for(let r=0;r<10;r++)n[r]=e[r]^e[r+10]^e[r+20]^e[r+30]^e[r+40];for(let r=0;r<10;r+=2){const l=(r+8)%10,d=(r+2)%10,T=n[d],C=n[d+1],M=Xo(T,C,1)^n[l],h=Ko(T,C,1)^n[l+1];for(let x=0;x<50;x+=10)e[r+x]^=M,e[r+x+1]^=h}let s=e[2],a=e[3];for(let r=0;r<24;r++){const l=Yo[r],d=Xo(s,a,l),T=Ko(s,a,l),C=qo[r];s=e[C],a=e[C+1],e[C]=d,e[C+1]=T}for(let r=0;r<50;r+=10){for(let l=0;l<10;l++)n[l]=e[r+l];for(let l=0;l<10;l++)e[r+l]^=~n[(l+2)%10]&n[(l+4)%10]}e[0]^=Qa[o],e[1]^=er[o]}qt(n)}class Vn extends Uo{constructor(t,n,o,s=!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=o,this.enableXOF=s,this.rounds=a,Fo(o),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Aa(this.state)}clone(){return this._cloneInto()}keccak(){_o(this.state32),tr(this.state32,this.rounds),_o(this.state32),this.posOut=0,this.pos=0}update(t){dn(this),t=Dn(t),zt(t);const{blockLen:n,state:o}=this,s=t.length;for(let a=0;a<s;){const r=Math.min(n-this.pos,s-a);for(let l=0;l<r;l++)o[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:o,blockLen:s}=this;t[o]^=n,(n&128)!==0&&o===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){dn(this,!1),zt(t),this.finish();const n=this.state,{blockLen:o}=this;for(let s=0,a=t.length;s<a;){this.posOut>=o&&this.keccak();const r=Math.min(o-this.posOut,a-s);t.set(n.subarray(this.posOut,this.posOut+r),s),this.posOut+=r,s+=r}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Fo(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Do(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,qt(this.state)}_cloneInto(t){const{blockLen:n,suffix:o,outputLen:s,rounds:a,enableXOF:r}=this;return t||(t=new Vn(n,o,s,r,a)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=o,t.outputLen=s,t.enableXOF=r,t.destroyed=this.destroyed,t}}const nr=(e,t,n)=>Oo(()=>new Vn(t,e,n)),or=nr(1,136,256/8);function Zo(e,t){const n=t||"hex",o=or(Dt(e,{strict:!1})?Bn(e):e);return n==="bytes"?o:Ut(o)}const Gn=new zo(8192);function sr(e,t){if(Gn.has(`${e}.${t}`))return Gn.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),o=Zo(To(n),"bytes"),s=n.split("");for(let r=0;r<40;r+=2)o[r>>1]>>4>=8&&s[r]&&(s[r]=s[r].toUpperCase()),(o[r>>1]&15)>=8&&s[r+1]&&(s[r+1]=s[r+1].toUpperCase());const a=`0x${s.join("")}`;return Gn.set(`${e}.${t}`,a),a}const ar=/^0x[a-fA-F0-9]{40}$/,zn=new zo(8192);function Re(e,t){const{strict:n=!0}=t??{},o=`${e}.${n}`;if(zn.has(o))return zn.get(o);const s=ar.test(e)?e.toLowerCase()===e?!0:n?sr(e)===e:!0:!1;return zn.set(o,s),s}function qn(e,t,n,{strict:o}={}){return Dt(e,{strict:!1})?ir(e,t,n,{strict:o}):rr(e,t,n,{strict:o})}function Qo(e,t){if(typeof t=="number"&&t>0&&t>Ve(e)-1)throw new wo({offset:t,position:"start",size:Ve(e)})}function es(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Ve(e)!==n-t)throw new wo({offset:n,position:"end",size:Ve(e)})}function rr(e,t,n,{strict:o}={}){Qo(e,t);const s=e.slice(t,n);return o&&es(s,t,n),s}function ir(e,t,n,{strict:o}={}){Qo(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&es(s,t,n),s}function cr(e){const{authorizationList:t}=e;if(t)for(const n of t){const{chainId:o}=n,s=n.address;if(!Re(s))throw new ct({address:s});if(o<0)throw new fn({chainId:o})}Yn(e)}function lr(e){const{blobVersionedHashes:t}=e;if(t){if(t.length===0)throw new Vo;for(const n of t){const o=Ve(n),s=ln(qn(n,0,1));if(o!==32)throw new Ga({hash:n,size:o});if(s!==Wo)throw new za({hash:n,version:s})}}Yn(e)}function Yn(e){const{chainId:t,maxPriorityFeePerGas:n,maxFeePerGas:o,to:s}=e;if(t<=0)throw new fn({chainId:t});if(s&&!Re(s))throw new ct({address:s});if(o&&o>Mt)throw new Ct({maxFeePerGas:o});if(n&&o&&n>o)throw new Yt({maxFeePerGas:o,maxPriorityFeePerGas:n})}function dr(e){const{chainId:t,maxPriorityFeePerGas:n,gasPrice:o,maxFeePerGas:s,to:a}=e;if(t<=0)throw new fn({chainId:t});if(a&&!Re(a))throw new ct({address:a});if(n||s)throw new ue("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(o&&o>Mt)throw new Ct({maxFeePerGas:o})}function ur(e){const{chainId:t,maxPriorityFeePerGas:n,gasPrice:o,maxFeePerGas:s,to:a}=e;if(a&&!Re(a))throw new ct({address:a});if(typeof t<"u"&&t<=0)throw new fn({chainId:t});if(n||s)throw new ue("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(o&&o>Mt)throw new Ct({maxFeePerGas:o})}function fr(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 wa({transaction:e})}function pn(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 a=0;a<s.length;a++)if(s[a].length-2!==64)throw new ya({storageKey:s[a]});if(!Re(o,{strict:!1}))throw new ct({address:o});t.push([o,s])}return t}function pr(e,t){const n=fr(e);return n==="eip1559"?br(e,t):n==="eip2930"?gr(e,t):n==="eip4844"?hr(e,t):n==="eip7702"?mr(e,t):wr(e,t)}function mr(e,t){const{authorizationList:n,chainId:o,gas:s,nonce:a,to:r,value:l,maxFeePerGas:d,maxPriorityFeePerGas:T,accessList:C,data:M}=e;cr(e);const h=pn(C),x=va(n);return St(["0x04",Et([le(o),a?le(a):"0x",T?le(T):"0x",d?le(d):"0x",s?le(s):"0x",r??"0x",l?le(l):"0x",M??"0x",h,x,...Jt(e,t)])])}function hr(e,t){const{chainId:n,gas:o,nonce:s,to:a,value:r,maxFeePerBlobGas:l,maxFeePerGas:d,maxPriorityFeePerGas:T,accessList:C,data:M}=e;lr(e);let h=e.blobVersionedHashes,x=e.sidecars;if(e.blobs&&(typeof h>"u"||typeof x>"u")){const V=typeof e.blobs[0]=="string"?e.blobs:e.blobs.map(pe=>ft(pe)),X=e.kzg,fe=Io({blobs:V,kzg:X});if(typeof h>"u"&&(h=Wa({commitments:fe})),typeof x>"u"){const pe=Po({blobs:V,commitments:fe,kzg:X});x=Ya({blobs:V,commitments:fe,proofs:pe})}}const m=pn(C),B=[le(n),s?le(s):"0x",T?le(T):"0x",d?le(d):"0x",o?le(o):"0x",a??"0x",r?le(r):"0x",M??"0x",m,l?le(l):"0x",h??[],...Jt(e,t)],L=[],ke=[],N=[];if(x)for(let V=0;V<x.length;V++){const{blob:X,commitment:fe,proof:pe}=x[V];L.push(X),ke.push(fe),N.push(pe)}return St(["0x03",Et(x?[B,L,ke,N]:B)])}function br(e,t){const{chainId:n,gas:o,nonce:s,to:a,value:r,maxFeePerGas:l,maxPriorityFeePerGas:d,accessList:T,data:C}=e;Yn(e);const M=pn(T),h=[le(n),s?le(s):"0x",d?le(d):"0x",l?le(l):"0x",o?le(o):"0x",a??"0x",r?le(r):"0x",C??"0x",M,...Jt(e,t)];return St(["0x02",Et(h)])}function gr(e,t){const{chainId:n,gas:o,data:s,nonce:a,to:r,value:l,accessList:d,gasPrice:T}=e;dr(e);const C=pn(d),M=[le(n),a?le(a):"0x",T?le(T):"0x",o?le(o):"0x",r??"0x",l?le(l):"0x",s??"0x",C,...Jt(e,t)];return St(["0x01",Et(M)])}function wr(e,t){const{chainId:n=0,gas:o,data:s,nonce:a,to:r,value:l,gasPrice:d}=e;ur(e);let T=[a?le(a):"0x",d?le(d):"0x",o?le(o):"0x",r??"0x",l?le(l):"0x",s??"0x"];if(t){const C=(()=>{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 x=27n+(t.v===27n?0n:1n);if(t.v!==x)throw new ga({v:t.v});return x})(),M=cn(t.r),h=cn(t.s);T=[...T,le(C),M==="0x00"?"0x":M,h==="0x00"?"0x":h]}else n>0&&(T=[...T,le(n),"0x","0x"]);return Et(T)}function Jt(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 a=cn(n.r),r=cn(n.s);return[typeof s=="number"?s?le(1):"0x":o===0n?"0x":o===1n?le(1):o===27n?"0x":le(1),a==="0x00"?"0x":a,r==="0x00"?"0x":r]}const yr={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},vr={block:ea({format(e){return{transactions:e.transactions?.map(n=>{if(typeof n=="string")return n;const o=Pn(n);return o.typeHex==="0x7e"&&(o.isSystemTx=n.isSystemTx,o.mint=n.mint?Lt(n.mint):void 0,o.sourceHash=n.sourceHash,o.type="deposit"),o}),stateRoot:e.stateRoot}}}),transaction:Ks({format(e){const t={};return e.type==="0x7e"&&(t.isSystemTx=e.isSystemTx,t.mint=e.mint?Lt(e.mint):void 0,t.sourceHash=e.sourceHash,t.type="deposit"),t}}),transactionReceipt:sa({format(e){return{l1GasPrice:e.l1GasPrice?Lt(e.l1GasPrice):null,l1GasUsed:e.l1GasUsed?Lt(e.l1GasUsed):null,l1Fee:e.l1Fee?Lt(e.l1Fee):null,l1FeeScalar:e.l1FeeScalar?Number(e.l1FeeScalar):null}}})};function kr(e,t){return xr(e)?Tr(e):pr(e,t)}const Ar={transaction:kr};function Tr(e){Sr(e);const{sourceHash:t,data:n,from:o,gas:s,isSystemTx:a,mint:r,to:l,value:d}=e,T=[t,o,l??"0x",r?Ut(r):"0x",d?Ut(d):"0x",s?Ut(s):"0x",a?"0x1":"0x",n??"0x"];return St(["0x7e",Et(T)])}function xr(e){return e.type==="deposit"||typeof e.sourceHash<"u"}function Sr(e){const{from:t,to:n}=e;if(t&&!Re(t))throw new ct({address:t});if(n&&!Re(n))throw new ct({address:n})}const mn={blockTime:2e3,contracts:yr,formatters:vr,serializers:Ar},Er=ut({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}}}),Nr=ut({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}}}),Xt=1,ts=ut({...mn,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:{...mn.contracts,disputeGameFactory:{[Xt]:{address:"0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e"}},l2OutputOracle:{[Xt]:{address:"0x56315b90c40730925ec5485cf004d835058518A0"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:5022},portal:{[Xt]:{address:"0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",blockCreated:17482143}},l1StandardBridge:{[Xt]:{address:"0x3154Cf16ccdb4C6d922629664174b904d80F2C35",blockCreated:17482143}}},sourceId:Xt});({...ts});const Cr=ut({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 jn(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}class Br extends ue{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(`
|
|
83
|
+
`),{docsPath:t,docsSlug:"account",name:"AccountNotFoundError"})}}function Jn(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new Lr(e.type);return`${e.name}(${ns(e.inputs,{includeName:t})})`}function ns(e,{includeName:t=!1}={}){return e?e.map(n=>Ir(n,{includeName:t})).join(t?", ":","):""}function Ir(e,{includeName:t}){return e.type.startsWith("tuple")?`(${ns(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}class Pr extends ue{constructor({expectedLength:t,givenLength:n,type:o}){super([`ABI encoding array length mismatch for type ${o}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
|
|
84
|
+
`),{name:"AbiEncodingArrayLengthMismatchError"})}}class Fr extends ue{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${Ve(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class Dr extends ue{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
|
|
85
|
+
`),{name:"AbiEncodingLengthMismatchError"})}}class os extends ue{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(`
|
|
86
|
+
`),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class _r extends ue{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${Jn(t.abiItem)}\`, and`,`\`${n.type}\` in \`${Jn(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class Ur extends ue{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
|
|
87
|
+
`),{docsPath:n,name:"InvalidAbiEncodingType"})}}class Or extends ue{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
|
|
88
|
+
`),{name:"InvalidArrayError"})}}class Lr extends ue{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
|
|
89
|
+
`),{name:"InvalidDefinitionTypeError"})}}const Mr=e=>Zo(Bn(e));function Rr(e){return Mr(e)}function $r(e,t){return e.exec(t)?.groups}const ss=/^tuple(?<array>(\[(\d*)\])*)$/;function Xn(e){let t=e.type;if(ss.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let s=0;s<n;s++){const a=e.components[s];t+=Xn(a),s<n-1&&(t+=", ")}const o=$r(ss,e.type);return t+=`)${o?.array||""}`,Xn({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Kt(e){let t="";const n=e.length;for(let o=0;o<n;o++){const s=e[o];t+=Xn(s),o!==n-1&&(t+=", ")}return t}function Hr(e){return e.type==="function"?`function ${e.name}(${Kt(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${Kt(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Kt(e.inputs)})`:e.type==="error"?`error ${e.name}(${Kt(e.inputs)})`:e.type==="constructor"?`constructor(${Kt(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}function Wr(e){let t=!0,n="",o=0,s="",a=!1;for(let r=0;r<e.length;r++){const l=e[r];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===")"){a=!0;break}continue}if(l===" "){e[r-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}s+=l,n+=l}}if(!a)throw new ue("Unable to normalize signature.");return s}const Vr=e=>{const t=typeof e=="string"?e:Hr(e);return Wr(t)};function as(e){return Rr(Vr(e))}const rs=e=>qn(as(e),0,4),Gr=/^(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 zr(e,t){if(e.length!==t.length)throw new Dr({expectedLength:e.length,givenLength:t.length});const n=qr({params:e,values:t}),o=Zn(n);return o.length===0?"0x":o}function qr({params:e,values:t}){const n=[];for(let o=0;o<e.length;o++)n.push(Kn({param:e[o],value:t[o]}));return n}function Kn({param:e,value:t}){const n=ei(e.type);if(n){const[o,s]=n;return jr(t,{length:o,param:{...e,type:s}})}if(e.type==="tuple")return Qr(t,{param:e});if(e.type==="address")return Yr(t);if(e.type==="bool")return Xr(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const o=e.type.startsWith("int"),[,,s="256"]=Gr.exec(e.type)??[];return Kr(t,{signed:o,size:Number(s)})}if(e.type.startsWith("bytes"))return Jr(t,{param:e});if(e.type==="string")return Zr(t);throw new Ur(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Zn(e){let t=0;for(let a=0;a<e.length;a++){const{dynamic:r,encoded:l}=e[a];r?t+=32:t+=Ve(l)}const n=[],o=[];let s=0;for(let a=0;a<e.length;a++){const{dynamic:r,encoded:l}=e[a];r?(n.push(le(t+s,{size:32})),o.push(l),s+=Ve(l)):n.push(l)}return Rt([...n,...o])}function Yr(e){if(!Re(e))throw new ct({address:e});return{dynamic:!1,encoded:wt(e.toLowerCase())}}function jr(e,{length:t,param:n}){const o=t===null;if(!Array.isArray(e))throw new Or(e);if(!o&&e.length!==t)throw new Pr({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let s=!1;const a=[];for(let r=0;r<e.length;r++){const l=Kn({param:n,value:e[r]});l.dynamic&&(s=!0),a.push(l)}if(o||s){const r=Zn(a);if(o){const l=le(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?Rt([l,r]):l}}if(s)return{dynamic:!0,encoded:r}}return{dynamic:!1,encoded:Rt(a.map(({encoded:r})=>r))}}function Jr(e,{param:t}){const[,n]=t.type.split("bytes"),o=Ve(e);if(!n){let s=e;return o%32!==0&&(s=wt(s,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Rt([wt(le(o,{size:32})),s])}}if(o!==Number.parseInt(n,10))throw new Fr({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:wt(e,{dir:"right"})}}function Xr(e){if(typeof e!="boolean")throw new ue(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:wt(vo(e))}}function Kr(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 Cn({max:o.toString(),min:s.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:le(e,{size:32,signed:t})}}function Zr(e){const t=ko(e),n=Math.ceil(Ve(t)/32),o=[];for(let s=0;s<n;s++)o.push(wt(qn(t,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Rt([wt(le(Ve(t),{size:32})),...o])}}function Qr(e,{param:t}){let n=!1;const o=[];for(let s=0;s<t.components.length;s++){const a=t.components[s],r=Array.isArray(e)?s:a.name,l=Kn({param:a,value:e[r]});o.push(l),l.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Zn(o):Rt(o.map(({encoded:s})=>s))}}function ei(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const ti=as;function ni(e){const{abi:t,args:n=[],name:o}=e,s=Dt(o,{strict:!1}),a=t.filter(l=>s?l.type==="function"?rs(l)===o:l.type==="event"?ti(l)===o:!1:"name"in l&&l.name===o);if(a.length===0)return;if(a.length===1)return a[0];let r;for(const l of a){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((T,C)=>{const M="inputs"in l&&l.inputs[C];return M?Qn(T,M):!1})){if(r&&"inputs"in r&&r.inputs){const T=is(l.inputs,r.inputs,n);if(T)throw new _r({abiItem:l,type:T[0]},{abiItem:r,type:T[1]})}r=l}}return r||a[0]}function Qn(e,t){const n=typeof e,o=t.type;switch(o){case"address":return Re(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,a)=>n==="object"&&Qn(Object.values(e)[a],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=>Qn(s,{...t,type:o.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function is(e,t,n){for(const o in e){const s=e[o],a=t[o];if(s.type==="tuple"&&a.type==="tuple"&&"components"in s&&"components"in a)return is(s.components,a.components,n[o]);const r=[s.type,a.type];if(r.includes("address")&&r.includes("bytes20")?!0:r.includes("address")&&r.includes("string")?Re(n[o],{strict:!1}):r.includes("address")&&r.includes("bytes")?Re(n[o],{strict:!1}):!1)return r}}function cs(e){return e.reduce((t,{slot:n,value:o})=>`${t} ${n}: ${o}
|
|
90
|
+
`,"")}function oi(e){return e.reduce((t,{address:n,...o})=>{let s=`${t} ${n}:
|
|
91
91
|
`;return o.nonce&&(s+=` nonce: ${o.nonce}
|
|
92
92
|
`),o.balance&&(s+=` balance: ${o.balance}
|
|
93
93
|
`),o.code&&(s+=` code: ${o.code}
|
|
94
94
|
`),o.state&&(s+=` state:
|
|
95
|
-
`,s+=
|
|
96
|
-
`,s+=
|
|
97
|
-
`).slice(0,-1)}class
|
|
98
|
-
${ei(S)}`),super(t.shortMessage,{cause:t,docsPath:o,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",N].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===Rt.code):e;return o instanceof pe?new Rt({cause:e,message:o.details}):Rt.nodeMessage.test(n)?new Rt({cause:e,message:e.details}):Nt.nodeMessage.test(n)?new Nt({cause:e,maxFeePerGas:t?.maxFeePerGas}):Dn.nodeMessage.test(n)?new Dn({cause:e,maxFeePerGas:t?.maxFeePerGas}):Un.nodeMessage.test(n)?new Un({cause:e,nonce:t?.nonce}):On.nodeMessage.test(n)?new On({cause:e,nonce:t?.nonce}):Ln.nodeMessage.test(n)?new Ln({cause:e,nonce:t?.nonce}):Mn.nodeMessage.test(n)?new Mn({cause:e}):_n.nodeMessage.test(n)?new _n({cause:e,gas:t?.gas}):Rn.nodeMessage.test(n)?new Rn({cause:e,gas:t?.gas}):$n.nodeMessage.test(n)?new $n({cause:e}):qt.nodeMessage.test(n)?new qt({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new Wo({cause:e})}function oi(e,{docsPath:t,...n}){const o=(()=>{const s=ni(e,n);return s instanceof Wo?e:s})();return new ti(o,{docsPath:t,...n})}function si(e,{format:t}){if(!t)return{};const n={};function o(a){const r=Object.keys(a);for(const l of r)l in e&&(n[l]=e[l]),a[l]&&typeof a[l]=="object"&&!Array.isArray(a[l])&&o(a[l])}const s=t(e||{});return o(s),n}function ai(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:o,to:s}=e,a=t?qn(t):void 0;if(a&&!Re(a.address))throw new it({address:a.address});if(s&&!Re(s))throw new it({address:s});if(n&&n>Mt)throw new Nt({maxFeePerGas:n});if(o&&n&&o>n)throw new qt({maxFeePerGas:n,maxPriorityFeePerGas:o})}async function ri(e,t){const{account:n=e.account}=t;if(!n)throw new Er;const o=qn(n);try{const{accessList:s,blockNumber:a,blockTag:r,data:l,gas:d,gasPrice:E,maxFeePerGas:I,maxPriorityFeePerGas:M,nonce:w,to:S,value:g,...N}=t,K=(typeof a=="bigint"?de(a):void 0)||r;ai(t);const B=e.chain?.formatters?.transactionRequest?.format,ne=(B||oa)({...si(N,{format:B}),account:o,accessList:s,data:l,gas:d,gasPrice:E,maxFeePerGas:I,maxPriorityFeePerGas:M,nonce:w,to:S,value:g},"estimateGas"),{baseFeePerGas:he,gasLimit:ye,priorityFeePerGas:Ne}=await e.request({method:"linea_estimateGas",params:K?[ne,K]:[ne]});return{baseFeePerGas:BigInt(he),gasLimit:BigInt(ye),priorityFeePerGas:BigInt(Ne)}}catch(s){throw oi(s,{...t,account:o,chain:e.chain})}}const ii={fees:{estimateFeesPerGas:is,async maxPriorityFeePerGas({block:e,client:t,request:n}){const o=await is({block:e,client:t,multiply:s=>s,request:n,type:"eip1559"});return o?.maxPriorityFeePerGas?o.maxPriorityFeePerGas:null}}};async function is({client:e,multiply:t,request:n,type:o}){try{const s=await ri(e,{...n,account:n?.account}),{priorityFeePerGas:a}=s,l=t(BigInt(s.baseFeePerGas))+a;return o==="legacy"?{gasPrice:l}:{maxFeePerGas:l,maxPriorityFeePerGas:a}}catch{return null}}const ci=lt({...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=lt({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}}}),Kt=1,di=lt({...fn,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:{...fn.contracts,disputeGameFactory:{[Kt]:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{[Kt]:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{[Kt]:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{[Kt]:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId:Kt}),ui=lt({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}}}),cs="/docs/contract/encodeFunctionData";function fi(e){const{abi:t,args:n,functionName:o}=e;let s=t[0];if(o){const a=Qr({abi:t,args:n,name:o});if(!a)throw new ts(o,{docsPath:cs});s=a}if(s.type!=="function")throw new ts(void 0,{docsPath:cs});return{abi:[s],functionName:ss(Yn(s))}}function vt(e){const{args:t}=e,{abi:n,functionName:o}=e.abi.length===1&&e.functionName?.startsWith("0x")?e:fi(e),s=n[0],a=o,r="inputs"in s&&s.inputs?Wr(s.inputs,t??[]):void 0;return xt([a,r??"0x"])}const ft={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:{...Sr,logo:"https://cryptologos.cc/logos/bnb-bnb-logo.png?v=024",chainId:56,chainType:"bsc",chainTypeMoralis:"bsc",tokenTrendingDefault:["0x2170ed0880ac9a755fd29b2688956bd959f933f8","0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c"]},137:{...ui,rpcUrls:{default:{http:["https://polygon-bor-rpc.publicnode.com"]}},logo:"https://cryptologos.cc/logos/polygon-matic-logo.png?v=024",chainId:137,chainType:"matic",chainTypeMoralis:"polygon",tokenTrendingDefault:["0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6"]},8453:{...Qo,logo:"https://icons.llamao.fi/icons/chains/rsz_base.jpg",chainId:8453,chainType:"base",chainTypeMoralis:"base",tokenTrendingDefault:["0x4200000000000000000000000000000000000006","0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf","0xc47da4cb96ce65a96844a01bfae509f9d5454534"]},42161:{...Tr,logo:"https://cryptologos.cc/logos/arbitrum-arb-logo.png?v=024",chainId:42161,chainType:"arbitrum",chainTypeMoralis:"arbitrum",tokenTrendingDefault:["0x82af49447d8a07e3bd95bd0d56f35241523fbab1","0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f"]},43114:{...xr,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})},nt=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=ft[e];return t?t.chainTypeMoralis:""},bi=e=>{if(!e)return"";const t=ft[e];return t?t.chainType:""},Bt={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 wi extends pe{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function pt(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new wi({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[a,r,l]=[o.slice(0,t-1),o.slice(t-1,t),o.slice(t)],d=Math.round(+`${r}.${l}`);d>9?o=`${BigInt(a)+BigInt(1)}0`.padStart(a.length+1,"0"):o=`${a}${d}`,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 gi="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Ve="0x0000000000000000000000000000000000000000",ls=se.createContext(void 0),Zn=()=>{const e=se.useContext(ls);if(!e)throw new Error("useConnect must be used within ConnectProvider");return{...e,chainData:ft[e.account?.chainId]||void 0,chainId:e.account?.chainId||void 0,chainType:bi(e.account?.chainId||void 0),chainTypeMoralis:hi(e.account?.chainId||void 0),isChainSupported:!!ft[e.account?.chainId]}},yi=({children:e,initialAccount:t})=>C.jsx(ls.Provider,{value:{account:t||null},children:e}),vi=({address:e,chainId:t})=>{const[n,o]=se.useState(!1),{isChainSupported:s}=Zn(),a=se.useCallback(()=>{if(!e)return;const r=e,l=()=>{o(!0),setTimeout(()=>o(!1),2e3)};try{navigator.clipboard.writeText(r).then(l).catch(()=>{const d=document.createElement("input");d.value=r,document.body.appendChild(d),d.select(),document.execCommand("copy"),d.remove(),l()})}catch{const d=document.createElement("input");d.value=r,document.body.appendChild(d),d.select(),document.execCommand("copy"),d.remove(),l()}},[e]);return C.jsx(C.Fragment,{children:Re(e||"")&&C.jsxs("div",{className:"chat-user-info",children:[t&&ft[t]?.logo&&C.jsx("div",{className:"user-avatar",children:C.jsx("img",{src:ft[t].logo||"",alt:"Chain",width:20,height:20})}),C.jsx("span",{className:"user-wallet",children:C.jsx("a",{style:{pointerEvents:s?"auto":"none"},href:ft[t]?.blockExplorers?.default?.url+"/address/"+e,target:"_blank",rel:"noopener noreferrer",children:mi(e)||"Not connected"})}),C.jsx("button",{className:"copy-address-btn",onClick:a,"aria-label":"Copy wallet address",type:"button",title:n?"Copied!":"Copy address",children:n?C.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:C.jsx("path",{d:"M13.3333 4L6 11.3333L2.66667 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):C.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:[C.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),C.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"})]})})]})})},$e=[];for(let e=0;e<256;++e)$e.push((e+256).toString(16).slice(1));function ki(e,t=0){return($e[e[t+0]]+$e[e[t+1]]+$e[e[t+2]]+$e[e[t+3]]+"-"+$e[e[t+4]]+$e[e[t+5]]+"-"+$e[e[t+6]]+$e[e[t+7]]+"-"+$e[e[t+8]]+$e[e[t+9]]+"-"+$e[e[t+10]]+$e[e[t+11]]+$e[e[t+12]]+$e[e[t+13]]+$e[e[t+14]]+$e[e[t+15]]).toLowerCase()}let Qn;const Ai=new Uint8Array(16);function Ti(){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(Ai)}const ds={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,ki(o)}function us(e,t,n){return ds.randomUUID&&!e?ds.randomUUID():xi(e)}const eo="chat_widget_messages",fs=200,$t=[{id:us(),text:`**Welcome! 🚀**
|
|
99
|
-
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 Si(e,t){return e&&t?`${e}_${t}`:""}function ps(e){return e.map(t=>({...t,timestamp:new Date(t.timestamp)}))}function ms(){const e=Bt.getItem(eo);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:ps(t.messages)};if(Array.isArray(t))return{owner:"",messages:ps(t)}}catch{}return null}function pn(e,t){Bt.setItem(eo,JSON.stringify({owner:e,messages:t}))}function Ei(){const{account:e}=Zn(),t=Si(e?.address,e?.chainId),[n,o]=se.useState(()=>t||"pending"),[s,a]=se.useState(()=>{const I=ms();return t?I&&I.owner===t?I.messages:$t:I?.messages??$t});if(n==="pending"&&t){const I=ms();I&&I.owner===t?a(I.messages):pn(t,s),o(t)}else n!=="pending"&&t&&n!==t&&(a($t),pn(t,$t),o(t));se.useEffect(()=>{n!=="pending"&&pn(n,s)},[s,n]),se.useEffect(()=>{const I=[];for(let M=0;M<Bt.length;M++){const w=Bt.key(M);w&&w.startsWith(eo+"_")&&I.push(w)}I.forEach(M=>Bt.removeItem(M))},[]);const r=(I,M,w,S,g)=>{const N=w?s.find(K=>K.id===w):void 0,L={id:us(),text:I,sender:M,timestamp:new Date,...N&&{replyTo:{id:N.id,text:N.text,sender:N.sender}},...S&&{buttons:S},...g&&{actionData:g}};return a(K=>{const B=[...K,L];return B.length>fs?B.slice(B.length-fs):B}),L},l=(I,M)=>{a(w=>w.map(S=>S.id===I&&S.actionData?{...S,actionData:{...S.actionData,status:M}}:S))},d=(I,M)=>{a(w=>w.map(S=>S.id===I?{...S,text:M}:S))},E=se.useCallback(()=>{a($t),pn(t,$t)},[t]);return{messages:s,setMessages:a,addMessage:r,updateMessageAction:l,updateMessageText:d,clearMessages:E}}const hs=se.createContext(void 0),Ni=()=>{const e=se.useContext(hs);if(!e)throw new Error("useConfig must be used within ConfigProvider");return e},Bi=({children:e,initialConfig:t})=>C.jsx(hs.Provider,{value:{config:t||null},children:e});var Ci=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,to=Math.ceil,Ke=Math.floor,Ge="[BigNumber Error] ",bs=Ge+"Number primitive has more than 15 significant digits: ",ot=1e14,we=14,no=9007199254740991,oo=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],kt=1e7,_e=1e9;function ws(e){var t,n,o,s=B.prototype={constructor:B,toString:null,valueOf:null},a=new B(1),r=20,l=4,d=-7,E=21,I=-1e7,M=1e7,w=!1,S=1,g=0,N={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},L="0123456789abcdefghijklmnopqrstuvwxyz",K=!0;function B(c,u){var i,m,h,y,v,b,A,k,T=this;if(!(T instanceof B))return new B(c,u);if(u==null){if(c&&c._isBigNumber===!0){T.s=c.s,!c.c||c.e>M?T.c=T.e=null:c.e<I?T.c=[T.e=0]:(T.e=c.e,T.c=c.c.slice());return}if((b=typeof c=="number")&&c*0==0){if(T.s=1/c<0?(c=-c,-1):1,c===~~c){for(y=0,v=c;v>=10;v/=10,y++);y>M?T.c=T.e=null:(T.e=y,T.c=[c]);return}k=String(c)}else{if(!Ci.test(k=String(c)))return o(T,k,b);T.s=k.charCodeAt(0)==45?(k=k.slice(1),-1):1}(y=k.indexOf("."))>-1&&(k=k.replace(".","")),(v=k.search(/e/i))>0?(y<0&&(y=v),y+=+k.slice(v+1),k=k.substring(0,v)):y<0&&(y=k.length)}else{if(Ce(u,2,L.length,"Base"),u==10&&K)return T=new B(c),ye(T,r+T.e+1,l);if(k=String(c),b=typeof c=="number"){if(c*0!=0)return o(T,k,b,u);if(T.s=1/c<0?(k=k.slice(1),-1):1,B.DEBUG&&k.replace(/^0\.0*|\./,"").length>15)throw Error(bs+c)}else T.s=k.charCodeAt(0)===45?(k=k.slice(1),-1):1;for(i=L.slice(0,u),y=v=0,A=k.length;v<A;v++)if(i.indexOf(m=k.charAt(v))<0){if(m=="."){if(v>y){y=A;continue}}else if(!h&&(k==k.toUpperCase()&&(k=k.toLowerCase())||k==k.toLowerCase()&&(k=k.toUpperCase()))){h=!0,v=-1,y=0;continue}return o(T,String(c),b,u)}b=!1,k=n(k,u,10,T.s),(y=k.indexOf("."))>-1?k=k.replace(".",""):y=k.length}for(v=0;k.charCodeAt(v)===48;v++);for(A=k.length;k.charCodeAt(--A)===48;);if(k=k.slice(v,++A)){if(A-=v,b&&B.DEBUG&&A>15&&(c>no||c!==Ke(c)))throw Error(bs+T.s*c);if((y=y-v-1)>M)T.c=T.e=null;else if(y<I)T.c=[T.e=0];else{if(T.e=y,T.c=[],v=(y+1)%we,y<0&&(v+=we),v<A){for(v&&T.c.push(+k.slice(0,v)),A-=we;v<A;)T.c.push(+k.slice(v,v+=we));v=we-(k=k.slice(v)).length}else v-=A;for(;v--;k+="0");T.c.push(+k)}}else T.c=[T.e=0]}B.clone=ws,B.ROUND_UP=0,B.ROUND_DOWN=1,B.ROUND_CEIL=2,B.ROUND_FLOOR=3,B.ROUND_HALF_UP=4,B.ROUND_HALF_DOWN=5,B.ROUND_HALF_EVEN=6,B.ROUND_HALF_CEIL=7,B.ROUND_HALF_FLOOR=8,B.EUCLID=9,B.config=B.set=function(c){var u,i;if(c!=null)if(typeof c=="object"){if(c.hasOwnProperty(u="DECIMAL_PLACES")&&(i=c[u],Ce(i,0,_e,u),r=i),c.hasOwnProperty(u="ROUNDING_MODE")&&(i=c[u],Ce(i,0,8,u),l=i),c.hasOwnProperty(u="EXPONENTIAL_AT")&&(i=c[u],i&&i.pop?(Ce(i[0],-_e,0,u),Ce(i[1],0,_e,u),d=i[0],E=i[1]):(Ce(i,-_e,_e,u),d=-(E=i<0?-i:i))),c.hasOwnProperty(u="RANGE"))if(i=c[u],i&&i.pop)Ce(i[0],-_e,-1,u),Ce(i[1],1,_e,u),I=i[0],M=i[1];else if(Ce(i,-_e,_e,u),i)I=-(M=i<0?-i:i);else throw Error(Ge+u+" cannot be zero: "+i);if(c.hasOwnProperty(u="CRYPTO"))if(i=c[u],i===!!i)if(i)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))w=i;else throw w=!i,Error(Ge+"crypto unavailable");else w=i;else throw Error(Ge+u+" not true or false: "+i);if(c.hasOwnProperty(u="MODULO_MODE")&&(i=c[u],Ce(i,0,9,u),S=i),c.hasOwnProperty(u="POW_PRECISION")&&(i=c[u],Ce(i,0,_e,u),g=i),c.hasOwnProperty(u="FORMAT"))if(i=c[u],typeof i=="object")N=i;else throw Error(Ge+u+" not an object: "+i);if(c.hasOwnProperty(u="ALPHABET"))if(i=c[u],typeof i=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(i))K=i.slice(0,10)=="0123456789",L=i;else throw Error(Ge+u+" invalid: "+i)}else throw Error(Ge+"Object expected: "+c);return{DECIMAL_PLACES:r,ROUNDING_MODE:l,EXPONENTIAL_AT:[d,E],RANGE:[I,M],CRYPTO:w,MODULO_MODE:S,POW_PRECISION:g,FORMAT:N,ALPHABET:L}},B.isBigNumber=function(c){if(!c||c._isBigNumber!==!0)return!1;if(!B.DEBUG)return!0;var u,i,m=c.c,h=c.e,y=c.s;e:if({}.toString.call(m)=="[object Array]"){if((y===1||y===-1)&&h>=-_e&&h<=_e&&h===Ke(h)){if(m[0]===0){if(h===0&&m.length===1)return!0;break e}if(u=(h+1)%we,u<1&&(u+=we),String(m[0]).length==u){for(u=0;u<m.length;u++)if(i=m[u],i<0||i>=ot||i!==Ke(i))break e;if(i!==0)return!0}}}else if(m===null&&h===null&&(y===null||y===1||y===-1))return!0;throw Error(Ge+"Invalid BigNumber: "+c)},B.maximum=B.max=function(){return ne(arguments,-1)},B.minimum=B.min=function(){return ne(arguments,1)},B.random=(function(){var c=9007199254740992,u=Math.random()*c&2097151?function(){return Ke(Math.random()*c)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(i){var m,h,y,v,b,A=0,k=[],T=new B(a);if(i==null?i=r:Ce(i,0,_e),v=to(i/we),w)if(crypto.getRandomValues){for(m=crypto.getRandomValues(new Uint32Array(v*=2));A<v;)b=m[A]*131072+(m[A+1]>>>11),b>=9e15?(h=crypto.getRandomValues(new Uint32Array(2)),m[A]=h[0],m[A+1]=h[1]):(k.push(b%1e14),A+=2);A=v/2}else if(crypto.randomBytes){for(m=crypto.randomBytes(v*=7);A<v;)b=(m[A]&31)*281474976710656+m[A+1]*1099511627776+m[A+2]*4294967296+m[A+3]*16777216+(m[A+4]<<16)+(m[A+5]<<8)+m[A+6],b>=9e15?crypto.randomBytes(7).copy(m,A):(k.push(b%1e14),A+=7);A=v/7}else throw w=!1,Error(Ge+"crypto unavailable");if(!w)for(;A<v;)b=u(),b<9e15&&(k[A++]=b%1e14);for(v=k[--A],i%=we,v&&i&&(b=oo[we-i],k[A]=Ke(v/b)*b);k[A]===0;k.pop(),A--);if(A<0)k=[y=0];else{for(y=-1;k[0]===0;k.splice(0,1),y-=we);for(A=1,b=k[0];b>=10;b/=10,A++);A<we&&(y-=we-A)}return T.e=y,T.c=k,T}})(),B.sum=function(){for(var c=1,u=arguments,i=new B(u[0]);c<u.length;)i=i.plus(u[c++]);return i},n=(function(){var c="0123456789";function u(i,m,h,y){for(var v,b=[0],A,k=0,T=i.length;k<T;){for(A=b.length;A--;b[A]*=m);for(b[0]+=y.indexOf(i.charAt(k++)),v=0;v<b.length;v++)b[v]>h-1&&(b[v+1]==null&&(b[v+1]=0),b[v+1]+=b[v]/h|0,b[v]%=h)}return b.reverse()}return function(i,m,h,y,v){var b,A,k,T,F,V,re,be,ke=i.indexOf("."),xe=r,z=l;for(ke>=0&&(T=g,g=0,i=i.replace(".",""),be=new B(m),V=be.pow(i.length-ke),g=T,be.c=u(mt(Qe(V.c),V.e,"0"),10,h,c),be.e=be.c.length),re=u(i,m,h,v?(b=L,c):(b=c,L)),k=T=re.length;re[--T]==0;re.pop());if(!re[0])return b.charAt(0);if(ke<0?--k:(V.c=re,V.e=k,V.s=y,V=t(V,be,xe,z,h),re=V.c,F=V.r,k=V.e),A=k+xe+1,ke=re[A],T=h/2,F=F||A<0||re[A+1]!=null,F=z<4?(ke!=null||F)&&(z==0||z==(V.s<0?3:2)):ke>T||ke==T&&(z==4||F||z==6&&re[A-1]&1||z==(V.s<0?8:7)),A<1||!re[0])i=F?mt(b.charAt(1),-xe,b.charAt(0)):b.charAt(0);else{if(re.length=A,F)for(--h;++re[--A]>h;)re[A]=0,A||(++k,re=[1].concat(re));for(T=re.length;!re[--T];);for(ke=0,i="";ke<=T;i+=b.charAt(re[ke++]));i=mt(i,k,b.charAt(0))}return i}})(),t=(function(){function c(m,h,y){var v,b,A,k,T=0,F=m.length,V=h%kt,re=h/kt|0;for(m=m.slice();F--;)A=m[F]%kt,k=m[F]/kt|0,v=re*A+k*V,b=V*A+v%kt*kt+T,T=(b/y|0)+(v/kt|0)+re*k,m[F]=b%y;return T&&(m=[T].concat(m)),m}function u(m,h,y,v){var b,A;if(y!=v)A=y>v?1:-1;else for(b=A=0;b<y;b++)if(m[b]!=h[b]){A=m[b]>h[b]?1:-1;break}return A}function i(m,h,y,v){for(var b=0;y--;)m[y]-=b,b=m[y]<h[y]?1:0,m[y]=b*v+m[y]-h[y];for(;!m[0]&&m.length>1;m.splice(0,1));}return function(m,h,y,v,b){var A,k,T,F,V,re,be,ke,xe,z,ge,Se,He,st,je,Pe,ze,Me=m.s==h.s?1:-1,Fe=m.c,Ae=h.c;if(!Fe||!Fe[0]||!Ae||!Ae[0])return new B(!m.s||!h.s||(Fe?Ae&&Fe[0]==Ae[0]:!Ae)?NaN:Fe&&Fe[0]==0||!Ae?Me*0:Me/0);for(ke=new B(Me),xe=ke.c=[],k=m.e-h.e,Me=y+k+1,b||(b=ot,k=Ze(m.e/we)-Ze(h.e/we),Me=Me/we|0),T=0;Ae[T]==(Fe[T]||0);T++);if(Ae[T]>(Fe[T]||0)&&k--,Me<0)xe.push(1),F=!0;else{for(st=Fe.length,Pe=Ae.length,T=0,Me+=2,V=Ke(b/(Ae[0]+1)),V>1&&(Ae=c(Ae,V,b),Fe=c(Fe,V,b),Pe=Ae.length,st=Fe.length),He=Pe,z=Fe.slice(0,Pe),ge=z.length;ge<Pe;z[ge++]=0);ze=Ae.slice(),ze=[0].concat(ze),je=Ae[0],Ae[1]>=b/2&&je++;do{if(V=0,A=u(Ae,z,Pe,ge),A<0){if(Se=z[0],Pe!=ge&&(Se=Se*b+(z[1]||0)),V=Ke(Se/je),V>1)for(V>=b&&(V=b-1),re=c(Ae,V,b),be=re.length,ge=z.length;u(re,z,be,ge)==1;)V--,i(re,Pe<be?ze:Ae,be,b),be=re.length,A=1;else V==0&&(A=V=1),re=Ae.slice(),be=re.length;if(be<ge&&(re=[0].concat(re)),i(z,re,ge,b),ge=z.length,A==-1)for(;u(Ae,z,Pe,ge)<1;)V++,i(z,Pe<ge?ze:Ae,ge,b),ge=z.length}else A===0&&(V++,z=[0]);xe[T++]=V,z[0]?z[ge++]=Fe[He]||0:(z=[Fe[He]],ge=1)}while((He++<st||z[0]!=null)&&Me--);F=z[0]!=null,xe[0]||xe.splice(0,1)}if(b==ot){for(T=1,Me=xe[0];Me>=10;Me/=10,T++);ye(ke,y+(ke.e=T+k*we-1)+1,v,F)}else ke.e=k,ke.r=+F;return ke}})();function G(c,u,i,m){var h,y,v,b,A;if(i==null?i=l:Ce(i,0,8),!c.c)return c.toString();if(h=c.c[0],v=c.e,u==null)A=Qe(c.c),A=m==1||m==2&&(v<=d||v>=E)?hn(A,v):mt(A,v,"0");else if(c=ye(new B(c),u,i),y=c.e,A=Qe(c.c),b=A.length,m==1||m==2&&(u<=y||y<=d)){for(;b<u;A+="0",b++);A=hn(A,y)}else if(u-=v+(m===2&&y>v),A=mt(A,y,"0"),y+1>b){if(--u>0)for(A+=".";u--;A+="0");}else if(u+=y-b,u>0)for(y+1==b&&(A+=".");u--;A+="0");return c.s<0&&h?"-"+A:A}function ne(c,u){for(var i,m,h=1,y=new B(c[0]);h<c.length;h++)m=new B(c[h]),(!m.s||(i=Ct(y,m))===u||i===0&&y.s===u)&&(y=m);return y}function he(c,u,i){for(var m=1,h=u.length;!u[--h];u.pop());for(h=u[0];h>=10;h/=10,m++);return(i=m+i*we-1)>M?c.c=c.e=null:i<I?c.c=[c.e=0]:(c.e=i,c.c=u),c}o=(function(){var c=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,i=/^\.([^.]+)$/,m=/^-?(Infinity|NaN)$/,h=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(y,v,b,A){var k,T=b?v:v.replace(h,"");if(m.test(T))y.s=isNaN(T)?null:T<0?-1:1;else{if(!b&&(T=T.replace(c,function(F,V,re){return k=(re=re.toLowerCase())=="x"?16:re=="b"?2:8,!A||A==k?V:F}),A&&(k=A,T=T.replace(u,"$1").replace(i,"0.$1")),v!=T))return new B(T,k);if(B.DEBUG)throw Error(Ge+"Not a"+(A?" base "+A:"")+" number: "+v);y.s=null}y.c=y.e=null}})();function ye(c,u,i,m){var h,y,v,b,A,k,T,F=c.c,V=oo;if(F){e:{for(h=1,b=F[0];b>=10;b/=10,h++);if(y=u-h,y<0)y+=we,v=u,A=F[k=0],T=Ke(A/V[h-v-1]%10);else if(k=to((y+1)/we),k>=F.length)if(m){for(;F.length<=k;F.push(0));A=T=0,h=1,y%=we,v=y-we+1}else break e;else{for(A=b=F[k],h=1;b>=10;b/=10,h++);y%=we,v=y-we+h,T=v<0?0:Ke(A/V[h-v-1]%10)}if(m=m||u<0||F[k+1]!=null||(v<0?A:A%V[h-v-1]),m=i<4?(T||m)&&(i==0||i==(c.s<0?3:2)):T>5||T==5&&(i==4||m||i==6&&(y>0?v>0?A/V[h-v]:0:F[k-1])%10&1||i==(c.s<0?8:7)),u<1||!F[0])return F.length=0,m?(u-=c.e+1,F[0]=V[(we-u%we)%we],c.e=-u||0):F[0]=c.e=0,c;if(y==0?(F.length=k,b=1,k--):(F.length=k+1,b=V[we-y],F[k]=v>0?Ke(A/V[h-v]%V[v])*b:0),m)for(;;)if(k==0){for(y=1,v=F[0];v>=10;v/=10,y++);for(v=F[0]+=b,b=1;v>=10;v/=10,b++);y!=b&&(c.e++,F[0]==ot&&(F[0]=1));break}else{if(F[k]+=b,F[k]!=ot)break;F[k--]=0,b=1}for(y=F.length;F[--y]===0;F.pop());}c.e>M?c.c=c.e=null:c.e<I&&(c.c=[c.e=0])}return c}function Ne(c){var u,i=c.e;return i===null?c.toString():(u=Qe(c.c),u=i<=d||i>=E?hn(u,i):mt(u,i,"0"),c.s<0?"-"+u:u)}return s.absoluteValue=s.abs=function(){var c=new B(this);return c.s<0&&(c.s=1),c},s.comparedTo=function(c,u){return Ct(this,new B(c,u))},s.decimalPlaces=s.dp=function(c,u){var i,m,h,y=this;if(c!=null)return Ce(c,0,_e),u==null?u=l:Ce(u,0,8),ye(new B(y),c+y.e+1,u);if(!(i=y.c))return null;if(m=((h=i.length-1)-Ze(this.e/we))*we,h=i[h])for(;h%10==0;h/=10,m--);return m<0&&(m=0),m},s.dividedBy=s.div=function(c,u){return t(this,new B(c,u),r,l)},s.dividedToIntegerBy=s.idiv=function(c,u){return t(this,new B(c,u),0,1)},s.exponentiatedBy=s.pow=function(c,u){var i,m,h,y,v,b,A,k,T,F=this;if(c=new B(c),c.c&&!c.isInteger())throw Error(Ge+"Exponent not an integer: "+Ne(c));if(u!=null&&(u=new B(u)),b=c.e>14,!F.c||!F.c[0]||F.c[0]==1&&!F.e&&F.c.length==1||!c.c||!c.c[0])return T=new B(Math.pow(+Ne(F),b?c.s*(2-mn(c)):+Ne(c))),u?T.mod(u):T;if(A=c.s<0,u){if(u.c?!u.c[0]:!u.s)return new B(NaN);m=!A&&F.isInteger()&&u.isInteger(),m&&(F=F.mod(u))}else{if(c.e>9&&(F.e>0||F.e<-1||(F.e==0?F.c[0]>1||b&&F.c[1]>=24e7:F.c[0]<8e13||b&&F.c[0]<=9999975e7)))return y=F.s<0&&mn(c)?-0:0,F.e>-1&&(y=1/y),new B(A?1/y:y);g&&(y=to(g/we+2))}for(b?(i=new B(.5),A&&(c.s=1),k=mn(c)):(h=Math.abs(+Ne(c)),k=h%2),T=new B(a);;){if(k){if(T=T.times(F),!T.c)break;y?T.c.length>y&&(T.c.length=y):m&&(T=T.mod(u))}if(h){if(h=Ke(h/2),h===0)break;k=h%2}else if(c=c.times(i),ye(c,c.e+1,1),c.e>14)k=mn(c);else{if(h=+Ne(c),h===0)break;k=h%2}F=F.times(F),y?F.c&&F.c.length>y&&(F.c.length=y):m&&(F=F.mod(u))}return m?T:(A&&(T=a.div(T)),u?T.mod(u):y?ye(T,g,l,v):T)},s.integerValue=function(c){var u=new B(this);return c==null?c=l:Ce(c,0,8),ye(u,u.e+1,c)},s.isEqualTo=s.eq=function(c,u){return Ct(this,new B(c,u))===0},s.isFinite=function(){return!!this.c},s.isGreaterThan=s.gt=function(c,u){return Ct(this,new B(c,u))>0},s.isGreaterThanOrEqualTo=s.gte=function(c,u){return(u=Ct(this,new B(c,u)))===1||u===0},s.isInteger=function(){return!!this.c&&Ze(this.e/we)>this.c.length-2},s.isLessThan=s.lt=function(c,u){return Ct(this,new B(c,u))<0},s.isLessThanOrEqualTo=s.lte=function(c,u){return(u=Ct(this,new B(c,u)))===-1||u===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(c,u){var i,m,h,y,v=this,b=v.s;if(c=new B(c,u),u=c.s,!b||!u)return new B(NaN);if(b!=u)return c.s=-u,v.plus(c);var A=v.e/we,k=c.e/we,T=v.c,F=c.c;if(!A||!k){if(!T||!F)return T?(c.s=-u,c):new B(F?v:NaN);if(!T[0]||!F[0])return F[0]?(c.s=-u,c):new B(T[0]?v:l==3?-0:0)}if(A=Ze(A),k=Ze(k),T=T.slice(),b=A-k){for((y=b<0)?(b=-b,h=T):(k=A,h=F),h.reverse(),u=b;u--;h.push(0));h.reverse()}else for(m=(y=(b=T.length)<(u=F.length))?b:u,b=u=0;u<m;u++)if(T[u]!=F[u]){y=T[u]<F[u];break}if(y&&(h=T,T=F,F=h,c.s=-c.s),u=(m=F.length)-(i=T.length),u>0)for(;u--;T[i++]=0);for(u=ot-1;m>b;){if(T[--m]<F[m]){for(i=m;i&&!T[--i];T[i]=u);--T[i],T[m]+=ot}T[m]-=F[m]}for(;T[0]==0;T.splice(0,1),--k);return T[0]?he(c,T,k):(c.s=l==3?-1:1,c.c=[c.e=0],c)},s.modulo=s.mod=function(c,u){var i,m,h=this;return c=new B(c,u),!h.c||!c.s||c.c&&!c.c[0]?new B(NaN):!c.c||h.c&&!h.c[0]?new B(h):(S==9?(m=c.s,c.s=1,i=t(h,c,0,3),c.s=m,i.s*=m):i=t(h,c,0,S),c=h.minus(i.times(c)),!c.c[0]&&S==1&&(c.s=h.s),c)},s.multipliedBy=s.times=function(c,u){var i,m,h,y,v,b,A,k,T,F,V,re,be,ke,xe,z=this,ge=z.c,Se=(c=new B(c,u)).c;if(!ge||!Se||!ge[0]||!Se[0])return!z.s||!c.s||ge&&!ge[0]&&!Se||Se&&!Se[0]&&!ge?c.c=c.e=c.s=null:(c.s*=z.s,!ge||!Se?c.c=c.e=null:(c.c=[0],c.e=0)),c;for(m=Ze(z.e/we)+Ze(c.e/we),c.s*=z.s,A=ge.length,F=Se.length,A<F&&(be=ge,ge=Se,Se=be,h=A,A=F,F=h),h=A+F,be=[];h--;be.push(0));for(ke=ot,xe=kt,h=F;--h>=0;){for(i=0,V=Se[h]%xe,re=Se[h]/xe|0,v=A,y=h+v;y>h;)k=ge[--v]%xe,T=ge[v]/xe|0,b=re*k+T*V,k=V*k+b%xe*xe+be[y]+i,i=(k/ke|0)+(b/xe|0)+re*T,be[y--]=k%ke;be[y]=i}return i?++m:be.splice(0,1),he(c,be,m)},s.negated=function(){var c=new B(this);return c.s=-c.s||null,c},s.plus=function(c,u){var i,m=this,h=m.s;if(c=new B(c,u),u=c.s,!h||!u)return new B(NaN);if(h!=u)return c.s=-u,m.minus(c);var y=m.e/we,v=c.e/we,b=m.c,A=c.c;if(!y||!v){if(!b||!A)return new B(h/0);if(!b[0]||!A[0])return A[0]?c:new B(b[0]?m:h*0)}if(y=Ze(y),v=Ze(v),b=b.slice(),h=y-v){for(h>0?(v=y,i=A):(h=-h,i=b),i.reverse();h--;i.push(0));i.reverse()}for(h=b.length,u=A.length,h-u<0&&(i=A,A=b,b=i,u=h),h=0;u;)h=(b[--u]=b[u]+A[u]+h)/ot|0,b[u]=ot===b[u]?0:b[u]%ot;return h&&(b=[h].concat(b),++v),he(c,b,v)},s.precision=s.sd=function(c,u){var i,m,h,y=this;if(c!=null&&c!==!!c)return Ce(c,1,_e),u==null?u=l:Ce(u,0,8),ye(new B(y),c,u);if(!(i=y.c))return null;if(h=i.length-1,m=h*we+1,h=i[h]){for(;h%10==0;h/=10,m--);for(h=i[0];h>=10;h/=10,m++);}return c&&y.e+1>m&&(m=y.e+1),m},s.shiftedBy=function(c){return Ce(c,-no,no),this.times("1e"+c)},s.squareRoot=s.sqrt=function(){var c,u,i,m,h,y=this,v=y.c,b=y.s,A=y.e,k=r+4,T=new B("0.5");if(b!==1||!v||!v[0])return new B(!b||b<0&&(!v||v[0])?NaN:v?y:1/0);if(b=Math.sqrt(+Ne(y)),b==0||b==1/0?(u=Qe(v),(u.length+A)%2==0&&(u+="0"),b=Math.sqrt(+u),A=Ze((A+1)/2)-(A<0||A%2),b==1/0?u="5e"+A:(u=b.toExponential(),u=u.slice(0,u.indexOf("e")+1)+A),i=new B(u)):i=new B(b+""),i.c[0]){for(A=i.e,b=A+k,b<3&&(b=0);;)if(h=i,i=T.times(h.plus(t(y,h,k,1))),Qe(h.c).slice(0,b)===(u=Qe(i.c)).slice(0,b))if(i.e<A&&--b,u=u.slice(b-3,b+1),u=="9999"||!m&&u=="4999"){if(!m&&(ye(h,h.e+r+2,0),h.times(h).eq(y))){i=h;break}k+=4,b+=4,m=1}else{(!+u||!+u.slice(1)&&u.charAt(0)=="5")&&(ye(i,i.e+r+2,1),c=!i.times(i).eq(y));break}}return ye(i,i.e+r+1,l,c)},s.toExponential=function(c,u){return c!=null&&(Ce(c,0,_e),c++),G(this,c,u,1)},s.toFixed=function(c,u){return c!=null&&(Ce(c,0,_e),c=c+this.e+1),G(this,c,u)},s.toFormat=function(c,u,i){var m,h=this;if(i==null)c!=null&&u&&typeof u=="object"?(i=u,u=null):c&&typeof c=="object"?(i=c,c=u=null):i=N;else if(typeof i!="object")throw Error(Ge+"Argument not an object: "+i);if(m=h.toFixed(c,u),h.c){var y,v=m.split("."),b=+i.groupSize,A=+i.secondaryGroupSize,k=i.groupSeparator||"",T=v[0],F=v[1],V=h.s<0,re=V?T.slice(1):T,be=re.length;if(A&&(y=b,b=A,A=y,be-=y),b>0&&be>0){for(y=be%b||b,T=re.substr(0,y);y<be;y+=b)T+=k+re.substr(y,b);A>0&&(T+=k+re.slice(y)),V&&(T="-"+T)}m=F?T+(i.decimalSeparator||"")+((A=+i.fractionGroupSize)?F.replace(new RegExp("\\d{"+A+"}\\B","g"),"$&"+(i.fractionGroupSeparator||"")):F):T}return(i.prefix||"")+m+(i.suffix||"")},s.toFraction=function(c){var u,i,m,h,y,v,b,A,k,T,F,V,re=this,be=re.c;if(c!=null&&(b=new B(c),!b.isInteger()&&(b.c||b.s!==1)||b.lt(a)))throw Error(Ge+"Argument "+(b.isInteger()?"out of range: ":"not an integer: ")+Ne(b));if(!be)return new B(re);for(u=new B(a),k=i=new B(a),m=A=new B(a),V=Qe(be),y=u.e=V.length-re.e-1,u.c[0]=oo[(v=y%we)<0?we+v:v],c=!c||b.comparedTo(u)>0?y>0?u:k:b,v=M,M=1/0,b=new B(V),A.c[0]=0;T=t(b,u,0,1),h=i.plus(T.times(m)),h.comparedTo(c)!=1;)i=m,m=h,k=A.plus(T.times(h=k)),A=h,u=b.minus(T.times(h=u)),b=h;return h=t(c.minus(i),m,0,1),A=A.plus(h.times(k)),i=i.plus(h.times(m)),A.s=k.s=re.s,y=y*2,F=t(k,m,y,l).minus(re).abs().comparedTo(t(A,i,y,l).minus(re).abs())<1?[k,m]:[A,i],M=v,F},s.toNumber=function(){return+Ne(this)},s.toPrecision=function(c,u){return c!=null&&Ce(c,1,_e),G(this,c,u,2)},s.toString=function(c){var u,i=this,m=i.s,h=i.e;return h===null?m?(u="Infinity",m<0&&(u="-"+u)):u="NaN":(c==null?u=h<=d||h>=E?hn(Qe(i.c),h):mt(Qe(i.c),h,"0"):c===10&&K?(i=ye(new B(i),r+h+1,l),u=mt(Qe(i.c),i.e,"0")):(Ce(c,2,L.length,"Base"),u=n(mt(Qe(i.c),h,"0"),10,c,m,!0)),m<0&&i.c[0]&&(u="-"+u)),u},s.valueOf=s.toJSON=function(){return Ne(this)},s._isBigNumber=!0,s[Symbol.toStringTag]="BigNumber",s[Symbol.for("nodejs.util.inspect.custom")]=s.valueOf,e!=null&&B.set(e),B}function Ze(e){var t=e|0;return e>0||e===t?t:t-1}function Qe(e){for(var t,n,o=1,s=e.length,a=e[0]+"";o<s;){for(t=e[o++]+"",n=we-t.length;n--;t="0"+t);a+=t}for(s=a.length;a.charCodeAt(--s)===48;);return a.slice(0,s+1||1)}function Ct(e,t){var n,o,s=e.c,a=t.c,r=e.s,l=t.s,d=e.e,E=t.e;if(!r||!l)return null;if(n=s&&!s[0],o=a&&!a[0],n||o)return n?o?0:-l:r;if(r!=l)return r;if(n=r<0,o=d==E,!s||!a)return o?0:!s^n?1:-1;if(!o)return d>E^n?1:-1;for(l=(d=s.length)<(E=a.length)?d:E,r=0;r<l;r++)if(s[r]!=a[r])return s[r]>a[r]^n?1:-1;return d==E?0:d>E^n?1:-1}function Ce(e,t,n,o){if(e<t||e>n||e!==Ke(e))throw Error(Ge+(o||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function mn(e){var t=e.c.length-1;return Ze(e.e/we)==t&&e.c[t]%2!=0}function hn(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function mt(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 le=ws();class bn{baseUrl;constructor(t){this.baseUrl=t}buildUrl(t,n){const o=new URL(t,this.baseUrl);return n&&Object.entries(n).forEach(([s,a])=>{a!=null&&o.searchParams.append(s,String(a))}),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 r=null;try{r=await s.json()}catch{try{const d=await s.text();d&&(r={message:d})}catch{}}const l=new Error(r?.message||r?.errorMessage||`HTTP ${s.status}: ${s.statusText}`);throw l.status=s.status,l.statusText=s.statusText,r&&(l.data=r),l}return{data:await s.json(),status:s.status}}async post(t,n,o={}){const s=this.buildUrl(t,o.query),a=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",...o.headers},body:JSON.stringify(n)});if(!a.ok){let l=null;try{l=await a.json()}catch{try{const E=await a.text();E&&(l={message:E})}catch{}}const d=new Error(l?.message||l?.errorMessage||`HTTP ${a.status}: ${a.statusText}`);throw d.status=a.status,d.statusText=a.statusText,l&&(d.data=l),d}return{data:await a.json(),status:a.status}}}const Ii=.01,Pi="https://deep-index.moralis.io";function Zt(){return"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJub25jZSI6ImY4NmY0Yzc2LTA3MDQtNGEwZS04YTA0LWUwODllOGQxMGZjZCIsIm9yZ0lkIjoiMzk0MDAyIiwidXNlcklkIjoiNDA0ODUzIiwidHlwZUlkIjoiYjQyODExOTQtOGQ0Yi00NjkxLTlhZjItNjU4ODE2NzExYmRjIiwidHlwZSI6IlBST0pFQ1QiLCJpYXQiOjE3MTY4NjQyNTYsImV4cCI6NDg3MjYyNDI1Nn0.V8crfBIBardAnZkc05FD0hQIJBeZxMqvzRnYExVtnF8"}function Qt(e){return{"X-API-Key":e,Accept:"application/json"}}const en=new bn(Pi);async function Ye(e){const{address:t,chain:n="base",token_addresses:o,exclude_spam:s,exclude_unverified_contracts:a}=e;if(!t)throw new Error("Address is required");try{const r=Zt(),l={chain:n,exclude_spam:s??!1,exclude_unverified_contracts:a??!1};o&&(l.token_addresses=o);const E=(await en.get(`/api/v2.2/wallets/${encodeURIComponent(t)}/tokens`,{query:l,headers:Qt(r)})).data;return E?.result?.length>0&&(E.result=E.result.filter(I=>{const M=new le(I?.balance||0),w=new le(I?.usd_value||0);return M.gt(0)&&w.gte(Ii)}),E.result=E.result.map(I=>({...I,token_address:I.token_address===gi?Ve:I.token_address}))),{success:!0,data:E}}catch(r){const l=r instanceof Error?r.message:"Unknown error";return console.error("❌ Error fetching token balances:",l),{success:!1,error:l}}}async function Fi(e){const{address:t,chain:n="base"}=e;if(!t)throw new Error("Token address is required");try{const o=Zt(),[s,a]=await Promise.allSettled([en.get("/api/v2.2/erc20/metadata",{query:{chain:n,addresses:[t]},headers:Qt(o)}),en.get(`/api/v2.2/erc20/${encodeURIComponent(t)}/price`,{query:{chain:n,include:"percent_change"},headers:Qt(o)})]),r=s.status==="fulfilled"?s.value.data:[];if(!r||r.length===0)return{success:!1,error:"Token metadata not found"};const l=r[0],d=a.status==="fulfilled"?a.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:d}}}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 Di(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 a=Zt(),r=new bn("https://cortex-api.moralis.io"),l=s?`${s}
|
|
95
|
+
`,s+=cs(o.state)),o.stateDiff&&(s+=` stateDiff:
|
|
96
|
+
`,s+=cs(o.stateDiff)),s},` State Override:
|
|
97
|
+
`).slice(0,-1)}class si extends ue{constructor(t,{account:n,docsPath:o,chain:s,data:a,gas:r,gasPrice:l,maxFeePerGas:d,maxPriorityFeePerGas:T,nonce:C,to:M,value:h,stateOverride:x}){const m=n?jn(n):void 0;let B=Bo({from:m?.address,to:M,value:typeof h<"u"&&`${ba(h)} ${s?.nativeCurrency?.symbol||"ETH"}`,data:a,gas:r,gasPrice:typeof l<"u"&&`${Nt(l)} gwei`,maxFeePerGas:typeof d<"u"&&`${Nt(d)} gwei`,maxPriorityFeePerGas:typeof T<"u"&&`${Nt(T)} gwei`,nonce:C});x&&(B+=`
|
|
98
|
+
${oi(x)}`),super(t.shortMessage,{cause:t,docsPath:o,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",B].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}function ai(e,t){const n=(e.details||"").toLowerCase(),o=e instanceof ue?e.walk(s=>s?.code===$t.code):e;return o instanceof ue?new $t({cause:e,message:o.details}):$t.nodeMessage.test(n)?new $t({cause:e,message:e.details}):Ct.nodeMessage.test(n)?new Ct({cause:e,maxFeePerGas:t?.maxFeePerGas}):Un.nodeMessage.test(n)?new Un({cause:e,maxFeePerGas:t?.maxFeePerGas}):On.nodeMessage.test(n)?new On({cause:e,nonce:t?.nonce}):Ln.nodeMessage.test(n)?new Ln({cause:e,nonce:t?.nonce}):Mn.nodeMessage.test(n)?new Mn({cause:e,nonce:t?.nonce}):Rn.nodeMessage.test(n)?new Rn({cause:e}):$n.nodeMessage.test(n)?new $n({cause:e,gas:t?.gas}):Hn.nodeMessage.test(n)?new Hn({cause:e,gas:t?.gas}):Wn.nodeMessage.test(n)?new Wn({cause:e}):Yt.nodeMessage.test(n)?new Yt({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new Go({cause:e})}function ri(e,{docsPath:t,...n}){const o=(()=>{const s=ai(e,n);return s instanceof Go?e:s})();return new si(o,{docsPath:t,...n})}function ii(e,{format:t}){if(!t)return{};const n={};function o(a){const r=Object.keys(a);for(const l of r)l in e&&(n[l]=e[l]),a[l]&&typeof a[l]=="object"&&!Array.isArray(a[l])&&o(a[l])}const s=t(e||{});return o(s),n}function ci(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:o,to:s}=e,a=t?jn(t):void 0;if(a&&!Re(a.address))throw new ct({address:a.address});if(s&&!Re(s))throw new ct({address:s});if(n&&n>Mt)throw new Ct({maxFeePerGas:n});if(o&&n&&o>n)throw new Yt({maxFeePerGas:n,maxPriorityFeePerGas:o})}async function li(e,t){const{account:n=e.account}=t;if(!n)throw new Br;const o=jn(n);try{const{accessList:s,blockNumber:a,blockTag:r,data:l,gas:d,gasPrice:T,maxFeePerGas:C,maxPriorityFeePerGas:M,nonce:h,to:x,value:m,...B}=t,ke=(typeof a=="bigint"?le(a):void 0)||r;ci(t);const N=e.chain?.formatters?.transactionRequest?.format,X=(N||ra)({...ii(B,{format:N}),account:o,accessList:s,data:l,gas:d,gasPrice:T,maxFeePerGas:C,maxPriorityFeePerGas:M,nonce:h,to:x,value:m},"estimateGas"),{baseFeePerGas:fe,gasLimit:pe,priorityFeePerGas:Ce}=await e.request({method:"linea_estimateGas",params:ke?[X,ke]:[X]});return{baseFeePerGas:BigInt(fe),gasLimit:BigInt(pe),priorityFeePerGas:BigInt(Ce)}}catch(s){throw ri(s,{...t,account:o,chain:e.chain})}}const di={fees:{estimateFeesPerGas:ls,async maxPriorityFeePerGas({block:e,client:t,request:n}){const o=await ls({block:e,client:t,multiply:s=>s,request:n,type:"eip1559"});return o?.maxPriorityFeePerGas?o.maxPriorityFeePerGas:null}}};async function ls({client:e,multiply:t,request:n,type:o}){try{const s=await li(e,{...n,account:n?.account}),{priorityFeePerGas:a}=s,l=t(BigInt(s.baseFeePerGas))+a;return o==="legacy"?{gasPrice:l}:{maxFeePerGas:l,maxPriorityFeePerGas:a}}catch{return null}}const ui=ut({...di,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}),fi=ut({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}}}),Zt=1,pi=ut({...mn,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:{...mn.contracts,disputeGameFactory:{[Zt]:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{[Zt]:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{[Zt]:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{[Zt]:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId:Zt}),mi=ut({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}}}),ds="/docs/contract/encodeFunctionData";function hi(e){const{abi:t,args:n,functionName:o}=e;let s=t[0];if(o){const a=ni({abi:t,args:n,name:o});if(!a)throw new os(o,{docsPath:ds});s=a}if(s.type!=="function")throw new os(void 0,{docsPath:ds});return{abi:[s],functionName:rs(Jn(s))}}function kt(e){const{args:t}=e,{abi:n,functionName:o}=e.abi.length===1&&e.functionName?.startsWith("0x")?e:hi(e),s=n[0],a=o,r="inputs"in s&&s.inputs?zr(s.inputs,t??[]):void 0;return St([a,r??"0x"])}const lt={1:{...fi,logo:"https://cryptologos.cc/logos/ethereum-eth-logo.png?v=024",chainId:1,chainType:"ether",chainTypeMoralis:"eth",tokenTrendingDefault:["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"]},10:{...pi,logo:"https://cryptologos.cc/logos/optimism-ethereum-op-logo.png?v=024",chainId:10,chainType:"optimism",chainTypeMoralis:"optimism",tokenTrendingDefault:["0x4200000000000000000000000000000000000006","0x68f180fcce6836688e9084f035309e29bf0a2095","0xc47da4cb96ce65a96844a01bfae509f9d5454534"]},56:{...Cr,logo:"https://cryptologos.cc/logos/bnb-bnb-logo.png?v=024",chainId:56,chainType:"bsc",chainTypeMoralis:"bsc",tokenTrendingDefault:["0x2170ed0880ac9a755fd29b2688956bd959f933f8","0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c"]},137:{...mi,rpcUrls:{default:{http:["https://polygon-bor-rpc.publicnode.com"]}},logo:"https://cryptologos.cc/logos/polygon-matic-logo.png?v=024",chainId:137,chainType:"matic",chainTypeMoralis:"polygon",tokenTrendingDefault:["0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6"]},8453:{...ts,logo:"https://icons.llamao.fi/icons/chains/rsz_base.jpg",chainId:8453,chainType:"base",chainTypeMoralis:"base",tokenTrendingDefault:["0x4200000000000000000000000000000000000006","0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf","0xc47da4cb96ce65a96844a01bfae509f9d5454534"]},42161:{...Er,logo:"https://cryptologos.cc/logos/arbitrum-arb-logo.png?v=024",chainId:42161,chainType:"arbitrum",chainTypeMoralis:"arbitrum",tokenTrendingDefault:["0x82af49447d8a07e3bd95bd0d56f35241523fbab1","0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f"]},43114:{...Nr,logo:"https://cryptologos.cc/logos/avalanche-avax-logo.png?v=024",chainId:43114,chainType:"avax",chainTypeMoralis:"avalanche",tokenTrendingDefault:["0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB","0x0555E30da8f98308EdB960aa94C0Db47230d2B9c"]},59144:{...ui,logo:"https://icons.llamao.fi/icons/chains/rsz_linea.jpg",chainId:59144,chainType:"linea",chainTypeMoralis:"linea",tokenTrendingDefault:["0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f","0x3aab2285ddcddad8edf438c1bab47e1a9d05a9b4"]}},us=e=>Object.values(lt).find(n=>n.chainTypeMoralis===e)?.chainType||null,bi=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})},ot=e=>new Promise(t=>setTimeout(t,e||0)),gi=(e,t=5,n=5)=>(e=e||"",e?.length<=t+n?e:`${e.substr(0,t)}...${e.substr(e.length-n,n)}`),wi=e=>{if(!e)return"";const t=lt[e];return t?t.chainTypeMoralis:""},yi=e=>{if(!e)return"";const t=lt[e];return t?t.chainType:""},Bt={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 vi extends ue{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function mt(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new vi({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[a,r,l]=[o.slice(0,t-1),o.slice(t-1,t),o.slice(t)],d=Math.round(+`${r}.${l}`);d>9?o=`${BigInt(a)+BigInt(1)}0`.padStart(a.length+1,"0"):o=`${a}${d}`,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 ki="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Ge="0x0000000000000000000000000000000000000000",fs=ne.createContext(void 0),eo=()=>{const e=ne.useContext(fs);if(!e)throw new Error("useConnect must be used within ConnectProvider");return{...e,chainData:lt[e.account?.chainId]||void 0,chainId:e.account?.chainId||void 0,chainType:yi(e.account?.chainId||void 0),chainTypeMoralis:wi(e.account?.chainId||void 0),isChainSupported:!!lt[e.account?.chainId]}},Ai=({children:e,initialAccount:t})=>P.jsx(fs.Provider,{value:{account:t||null},children:e}),Ti=({address:e,chainId:t})=>{const[n,o]=ne.useState(!1),{isChainSupported:s}=eo(),a=ne.useCallback(()=>{if(!e)return;const r=e,l=()=>{o(!0),setTimeout(()=>o(!1),2e3)};try{navigator.clipboard.writeText(r).then(l).catch(()=>{const d=document.createElement("input");d.value=r,document.body.appendChild(d),d.select(),document.execCommand("copy"),d.remove(),l()})}catch{const d=document.createElement("input");d.value=r,document.body.appendChild(d),d.select(),document.execCommand("copy"),d.remove(),l()}},[e]);return P.jsx(P.Fragment,{children:Re(e||"")&&P.jsxs("div",{className:"chat-user-info",children:[t&<[t]?.logo&&P.jsx("div",{className:"user-avatar",children:P.jsx("img",{src:lt[t].logo||"",alt:"Chain",width:20,height:20})}),P.jsx("span",{className:"user-wallet",children:P.jsx("a",{style:{pointerEvents:s?"auto":"none"},href:lt[t]?.blockExplorers?.default?.url+"/address/"+e,target:"_blank",rel:"noopener noreferrer",children:gi(e)||"Not connected"})}),P.jsx("button",{className:"copy-address-btn",onClick:a,"aria-label":"Copy wallet address",type:"button",title:n?"Copied!":"Copy address",children:n?P.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:P.jsx("path",{d:"M13.3333 4L6 11.3333L2.66667 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):P.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:[P.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),P.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 xi(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 to;const Si=new Uint8Array(16);function Ei(){if(!to){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");to=crypto.getRandomValues.bind(crypto)}return to(Si)}const ps={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Ni(e,t,n){e=e||{};const o=e.random??e.rng?.()??Ei();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,xi(o)}function ms(e,t,n){return ps.randomUUID&&!e?ps.randomUUID():Ni(e)}const no="chat_widget_messages",hs=200,Ht=[{id:ms(),text:`**Welcome! 🚀**
|
|
99
|
+
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 Ci(e,t){return e&&t?`${e}_${t}`:""}function bs(e){return e.map(t=>({...t,timestamp:new Date(t.timestamp)}))}function gs(){const e=Bt.getItem(no);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:bs(t.messages)};if(Array.isArray(t))return{owner:"",messages:bs(t)}}catch{}return null}function hn(e,t){Bt.setItem(no,JSON.stringify({owner:e,messages:t}))}function Bi(){const{account:e}=eo(),t=Ci(e?.address,e?.chainId),[n,o]=ne.useState(()=>t||"pending"),[s,a]=ne.useState(()=>{const C=gs();return t?C&&C.owner===t?C.messages:Ht:C?.messages??Ht});if(n==="pending"&&t){const C=gs();C&&C.owner===t?a(C.messages):hn(t,s),o(t)}else n!=="pending"&&t&&n!==t&&(a(Ht),hn(t,Ht),o(t));ne.useEffect(()=>{n!=="pending"&&hn(n,s)},[s,n]),ne.useEffect(()=>{const C=[];for(let M=0;M<Bt.length;M++){const h=Bt.key(M);h&&h.startsWith(no+"_")&&C.push(h)}C.forEach(M=>Bt.removeItem(M))},[]);const r=(C,M,h,x,m)=>{const B=h?s.find(ke=>ke.id===h):void 0,L={id:ms(),text:C,sender:M,timestamp:new Date,...B&&{replyTo:{id:B.id,text:B.text,sender:B.sender}},...x&&{buttons:x},...m&&{actionData:m}};return a(ke=>{const N=[...ke,L];return N.length>hs?N.slice(N.length-hs):N}),L},l=(C,M)=>{a(h=>h.map(x=>x.id===C&&x.actionData?{...x,actionData:{...x.actionData,status:M}}:x))},d=(C,M)=>{a(h=>h.map(x=>x.id===C?{...x,text:M}:x))},T=ne.useCallback(()=>{a(Ht),hn(t,Ht)},[t]);return{messages:s,setMessages:a,addMessage:r,updateMessageAction:l,updateMessageText:d,clearMessages:T}}const ws=ne.createContext(void 0),Ii=()=>{const e=ne.useContext(ws);if(!e)throw new Error("useConfig must be used within ConfigProvider");return e},Pi=({children:e,initialConfig:t})=>P.jsx(ws.Provider,{value:{config:t||null},children:e});var Fi=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,oo=Math.ceil,Ze=Math.floor,ze="[BigNumber Error] ",ys=ze+"Number primitive has more than 15 significant digits: ",st=1e14,he=14,so=9007199254740991,ao=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],At=1e7,$e=1e9;function vs(e){var t,n,o,s=N.prototype={constructor:N,toString:null,valueOf:null},a=new N(1),r=20,l=4,d=-7,T=21,C=-1e7,M=1e7,h=!1,x=1,m=0,B={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},L="0123456789abcdefghijklmnopqrstuvwxyz",ke=!0;function N(c,u){var i,b,g,y,v,w,A,k,S=this;if(!(S instanceof N))return new N(c,u);if(u==null){if(c&&c._isBigNumber===!0){S.s=c.s,!c.c||c.e>M?S.c=S.e=null:c.e<C?S.c=[S.e=0]:(S.e=c.e,S.c=c.c.slice());return}if((w=typeof c=="number")&&c*0==0){if(S.s=1/c<0?(c=-c,-1):1,c===~~c){for(y=0,v=c;v>=10;v/=10,y++);y>M?S.c=S.e=null:(S.e=y,S.c=[c]);return}k=String(c)}else{if(!Fi.test(k=String(c)))return o(S,k,w);S.s=k.charCodeAt(0)==45?(k=k.slice(1),-1):1}(y=k.indexOf("."))>-1&&(k=k.replace(".","")),(v=k.search(/e/i))>0?(y<0&&(y=v),y+=+k.slice(v+1),k=k.substring(0,v)):y<0&&(y=k.length)}else{if(Ie(u,2,L.length,"Base"),u==10&&ke)return S=new N(c),pe(S,r+S.e+1,l);if(k=String(c),w=typeof c=="number"){if(c*0!=0)return o(S,k,w,u);if(S.s=1/c<0?(k=k.slice(1),-1):1,N.DEBUG&&k.replace(/^0\.0*|\./,"").length>15)throw Error(ys+c)}else S.s=k.charCodeAt(0)===45?(k=k.slice(1),-1):1;for(i=L.slice(0,u),y=v=0,A=k.length;v<A;v++)if(i.indexOf(b=k.charAt(v))<0){if(b=="."){if(v>y){y=A;continue}}else if(!g&&(k==k.toUpperCase()&&(k=k.toLowerCase())||k==k.toLowerCase()&&(k=k.toUpperCase()))){g=!0,v=-1,y=0;continue}return o(S,String(c),w,u)}w=!1,k=n(k,u,10,S.s),(y=k.indexOf("."))>-1?k=k.replace(".",""):y=k.length}for(v=0;k.charCodeAt(v)===48;v++);for(A=k.length;k.charCodeAt(--A)===48;);if(k=k.slice(v,++A)){if(A-=v,w&&N.DEBUG&&A>15&&(c>so||c!==Ze(c)))throw Error(ys+S.s*c);if((y=y-v-1)>M)S.c=S.e=null;else if(y<C)S.c=[S.e=0];else{if(S.e=y,S.c=[],v=(y+1)%he,y<0&&(v+=he),v<A){for(v&&S.c.push(+k.slice(0,v)),A-=he;v<A;)S.c.push(+k.slice(v,v+=he));v=he-(k=k.slice(v)).length}else v-=A;for(;v--;k+="0");S.c.push(+k)}}else S.c=[S.e=0]}N.clone=vs,N.ROUND_UP=0,N.ROUND_DOWN=1,N.ROUND_CEIL=2,N.ROUND_FLOOR=3,N.ROUND_HALF_UP=4,N.ROUND_HALF_DOWN=5,N.ROUND_HALF_EVEN=6,N.ROUND_HALF_CEIL=7,N.ROUND_HALF_FLOOR=8,N.EUCLID=9,N.config=N.set=function(c){var u,i;if(c!=null)if(typeof c=="object"){if(c.hasOwnProperty(u="DECIMAL_PLACES")&&(i=c[u],Ie(i,0,$e,u),r=i),c.hasOwnProperty(u="ROUNDING_MODE")&&(i=c[u],Ie(i,0,8,u),l=i),c.hasOwnProperty(u="EXPONENTIAL_AT")&&(i=c[u],i&&i.pop?(Ie(i[0],-$e,0,u),Ie(i[1],0,$e,u),d=i[0],T=i[1]):(Ie(i,-$e,$e,u),d=-(T=i<0?-i:i))),c.hasOwnProperty(u="RANGE"))if(i=c[u],i&&i.pop)Ie(i[0],-$e,-1,u),Ie(i[1],1,$e,u),C=i[0],M=i[1];else if(Ie(i,-$e,$e,u),i)C=-(M=i<0?-i:i);else throw Error(ze+u+" cannot be zero: "+i);if(c.hasOwnProperty(u="CRYPTO"))if(i=c[u],i===!!i)if(i)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))h=i;else throw h=!i,Error(ze+"crypto unavailable");else h=i;else throw Error(ze+u+" not true or false: "+i);if(c.hasOwnProperty(u="MODULO_MODE")&&(i=c[u],Ie(i,0,9,u),x=i),c.hasOwnProperty(u="POW_PRECISION")&&(i=c[u],Ie(i,0,$e,u),m=i),c.hasOwnProperty(u="FORMAT"))if(i=c[u],typeof i=="object")B=i;else throw Error(ze+u+" not an object: "+i);if(c.hasOwnProperty(u="ALPHABET"))if(i=c[u],typeof i=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(i))ke=i.slice(0,10)=="0123456789",L=i;else throw Error(ze+u+" invalid: "+i)}else throw Error(ze+"Object expected: "+c);return{DECIMAL_PLACES:r,ROUNDING_MODE:l,EXPONENTIAL_AT:[d,T],RANGE:[C,M],CRYPTO:h,MODULO_MODE:x,POW_PRECISION:m,FORMAT:B,ALPHABET:L}},N.isBigNumber=function(c){if(!c||c._isBigNumber!==!0)return!1;if(!N.DEBUG)return!0;var u,i,b=c.c,g=c.e,y=c.s;e:if({}.toString.call(b)=="[object Array]"){if((y===1||y===-1)&&g>=-$e&&g<=$e&&g===Ze(g)){if(b[0]===0){if(g===0&&b.length===1)return!0;break e}if(u=(g+1)%he,u<1&&(u+=he),String(b[0]).length==u){for(u=0;u<b.length;u++)if(i=b[u],i<0||i>=st||i!==Ze(i))break e;if(i!==0)return!0}}}else if(b===null&&g===null&&(y===null||y===1||y===-1))return!0;throw Error(ze+"Invalid BigNumber: "+c)},N.maximum=N.max=function(){return X(arguments,-1)},N.minimum=N.min=function(){return X(arguments,1)},N.random=(function(){var c=9007199254740992,u=Math.random()*c&2097151?function(){return Ze(Math.random()*c)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(i){var b,g,y,v,w,A=0,k=[],S=new N(a);if(i==null?i=r:Ie(i,0,$e),v=oo(i/he),h)if(crypto.getRandomValues){for(b=crypto.getRandomValues(new Uint32Array(v*=2));A<v;)w=b[A]*131072+(b[A+1]>>>11),w>=9e15?(g=crypto.getRandomValues(new Uint32Array(2)),b[A]=g[0],b[A+1]=g[1]):(k.push(w%1e14),A+=2);A=v/2}else if(crypto.randomBytes){for(b=crypto.randomBytes(v*=7);A<v;)w=(b[A]&31)*281474976710656+b[A+1]*1099511627776+b[A+2]*4294967296+b[A+3]*16777216+(b[A+4]<<16)+(b[A+5]<<8)+b[A+6],w>=9e15?crypto.randomBytes(7).copy(b,A):(k.push(w%1e14),A+=7);A=v/7}else throw h=!1,Error(ze+"crypto unavailable");if(!h)for(;A<v;)w=u(),w<9e15&&(k[A++]=w%1e14);for(v=k[--A],i%=he,v&&i&&(w=ao[he-i],k[A]=Ze(v/w)*w);k[A]===0;k.pop(),A--);if(A<0)k=[y=0];else{for(y=-1;k[0]===0;k.splice(0,1),y-=he);for(A=1,w=k[0];w>=10;w/=10,A++);A<he&&(y-=he-A)}return S.e=y,S.c=k,S}})(),N.sum=function(){for(var c=1,u=arguments,i=new N(u[0]);c<u.length;)i=i.plus(u[c++]);return i},n=(function(){var c="0123456789";function u(i,b,g,y){for(var v,w=[0],A,k=0,S=i.length;k<S;){for(A=w.length;A--;w[A]*=b);for(w[0]+=y.indexOf(i.charAt(k++)),v=0;v<w.length;v++)w[v]>g-1&&(w[v+1]==null&&(w[v+1]=0),w[v+1]+=w[v]/g|0,w[v]%=g)}return w.reverse()}return function(i,b,g,y,v){var w,A,k,S,D,z,se,me,Ae=i.indexOf("."),Se=r,j=l;for(Ae>=0&&(S=m,m=0,i=i.replace(".",""),me=new N(b),z=me.pow(i.length-Ae),m=S,me.c=u(ht(et(z.c),z.e,"0"),10,g,c),me.e=me.c.length),se=u(i,b,g,v?(w=L,c):(w=c,L)),k=S=se.length;se[--S]==0;se.pop());if(!se[0])return w.charAt(0);if(Ae<0?--k:(z.c=se,z.e=k,z.s=y,z=t(z,me,Se,j,g),se=z.c,D=z.r,k=z.e),A=k+Se+1,Ae=se[A],S=g/2,D=D||A<0||se[A+1]!=null,D=j<4?(Ae!=null||D)&&(j==0||j==(z.s<0?3:2)):Ae>S||Ae==S&&(j==4||D||j==6&&se[A-1]&1||j==(z.s<0?8:7)),A<1||!se[0])i=D?ht(w.charAt(1),-Se,w.charAt(0)):w.charAt(0);else{if(se.length=A,D)for(--g;++se[--A]>g;)se[A]=0,A||(++k,se=[1].concat(se));for(S=se.length;!se[--S];);for(Ae=0,i="";Ae<=S;i+=w.charAt(se[Ae++]));i=ht(i,k,w.charAt(0))}return i}})(),t=(function(){function c(b,g,y){var v,w,A,k,S=0,D=b.length,z=g%At,se=g/At|0;for(b=b.slice();D--;)A=b[D]%At,k=b[D]/At|0,v=se*A+k*z,w=z*A+v%At*At+S,S=(w/y|0)+(v/At|0)+se*k,b[D]=w%y;return S&&(b=[S].concat(b)),b}function u(b,g,y,v){var w,A;if(y!=v)A=y>v?1:-1;else for(w=A=0;w<y;w++)if(b[w]!=g[w]){A=b[w]>g[w]?1:-1;break}return A}function i(b,g,y,v){for(var w=0;y--;)b[y]-=w,w=b[y]<g[y]?1:0,b[y]=w*v+b[y]-g[y];for(;!b[0]&&b.length>1;b.splice(0,1));}return function(b,g,y,v,w){var A,k,S,D,z,se,me,Ae,Se,j,be,xe,We,at,Je,Fe,qe,Me=b.s==g.s?1:-1,De=b.c,Te=g.c;if(!De||!De[0]||!Te||!Te[0])return new N(!b.s||!g.s||(De?Te&&De[0]==Te[0]:!Te)?NaN:De&&De[0]==0||!Te?Me*0:Me/0);for(Ae=new N(Me),Se=Ae.c=[],k=b.e-g.e,Me=y+k+1,w||(w=st,k=Qe(b.e/he)-Qe(g.e/he),Me=Me/he|0),S=0;Te[S]==(De[S]||0);S++);if(Te[S]>(De[S]||0)&&k--,Me<0)Se.push(1),D=!0;else{for(at=De.length,Fe=Te.length,S=0,Me+=2,z=Ze(w/(Te[0]+1)),z>1&&(Te=c(Te,z,w),De=c(De,z,w),Fe=Te.length,at=De.length),We=Fe,j=De.slice(0,Fe),be=j.length;be<Fe;j[be++]=0);qe=Te.slice(),qe=[0].concat(qe),Je=Te[0],Te[1]>=w/2&&Je++;do{if(z=0,A=u(Te,j,Fe,be),A<0){if(xe=j[0],Fe!=be&&(xe=xe*w+(j[1]||0)),z=Ze(xe/Je),z>1)for(z>=w&&(z=w-1),se=c(Te,z,w),me=se.length,be=j.length;u(se,j,me,be)==1;)z--,i(se,Fe<me?qe:Te,me,w),me=se.length,A=1;else z==0&&(A=z=1),se=Te.slice(),me=se.length;if(me<be&&(se=[0].concat(se)),i(j,se,be,w),be=j.length,A==-1)for(;u(Te,j,Fe,be)<1;)z++,i(j,Fe<be?qe:Te,be,w),be=j.length}else A===0&&(z++,j=[0]);Se[S++]=z,j[0]?j[be++]=De[We]||0:(j=[De[We]],be=1)}while((We++<at||j[0]!=null)&&Me--);D=j[0]!=null,Se[0]||Se.splice(0,1)}if(w==st){for(S=1,Me=Se[0];Me>=10;Me/=10,S++);pe(Ae,y+(Ae.e=S+k*he-1)+1,v,D)}else Ae.e=k,Ae.r=+D;return Ae}})();function V(c,u,i,b){var g,y,v,w,A;if(i==null?i=l:Ie(i,0,8),!c.c)return c.toString();if(g=c.c[0],v=c.e,u==null)A=et(c.c),A=b==1||b==2&&(v<=d||v>=T)?gn(A,v):ht(A,v,"0");else if(c=pe(new N(c),u,i),y=c.e,A=et(c.c),w=A.length,b==1||b==2&&(u<=y||y<=d)){for(;w<u;A+="0",w++);A=gn(A,y)}else if(u-=v+(b===2&&y>v),A=ht(A,y,"0"),y+1>w){if(--u>0)for(A+=".";u--;A+="0");}else if(u+=y-w,u>0)for(y+1==w&&(A+=".");u--;A+="0");return c.s<0&&g?"-"+A:A}function X(c,u){for(var i,b,g=1,y=new N(c[0]);g<c.length;g++)b=new N(c[g]),(!b.s||(i=It(y,b))===u||i===0&&y.s===u)&&(y=b);return y}function fe(c,u,i){for(var b=1,g=u.length;!u[--g];u.pop());for(g=u[0];g>=10;g/=10,b++);return(i=b+i*he-1)>M?c.c=c.e=null:i<C?c.c=[c.e=0]:(c.e=i,c.c=u),c}o=(function(){var c=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,i=/^\.([^.]+)$/,b=/^-?(Infinity|NaN)$/,g=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(y,v,w,A){var k,S=w?v:v.replace(g,"");if(b.test(S))y.s=isNaN(S)?null:S<0?-1:1;else{if(!w&&(S=S.replace(c,function(D,z,se){return k=(se=se.toLowerCase())=="x"?16:se=="b"?2:8,!A||A==k?z:D}),A&&(k=A,S=S.replace(u,"$1").replace(i,"0.$1")),v!=S))return new N(S,k);if(N.DEBUG)throw Error(ze+"Not a"+(A?" base "+A:"")+" number: "+v);y.s=null}y.c=y.e=null}})();function pe(c,u,i,b){var g,y,v,w,A,k,S,D=c.c,z=ao;if(D){e:{for(g=1,w=D[0];w>=10;w/=10,g++);if(y=u-g,y<0)y+=he,v=u,A=D[k=0],S=Ze(A/z[g-v-1]%10);else if(k=oo((y+1)/he),k>=D.length)if(b){for(;D.length<=k;D.push(0));A=S=0,g=1,y%=he,v=y-he+1}else break e;else{for(A=w=D[k],g=1;w>=10;w/=10,g++);y%=he,v=y-he+g,S=v<0?0:Ze(A/z[g-v-1]%10)}if(b=b||u<0||D[k+1]!=null||(v<0?A:A%z[g-v-1]),b=i<4?(S||b)&&(i==0||i==(c.s<0?3:2)):S>5||S==5&&(i==4||b||i==6&&(y>0?v>0?A/z[g-v]:0:D[k-1])%10&1||i==(c.s<0?8:7)),u<1||!D[0])return D.length=0,b?(u-=c.e+1,D[0]=z[(he-u%he)%he],c.e=-u||0):D[0]=c.e=0,c;if(y==0?(D.length=k,w=1,k--):(D.length=k+1,w=z[he-y],D[k]=v>0?Ze(A/z[g-v]%z[v])*w:0),b)for(;;)if(k==0){for(y=1,v=D[0];v>=10;v/=10,y++);for(v=D[0]+=w,w=1;v>=10;v/=10,w++);y!=w&&(c.e++,D[0]==st&&(D[0]=1));break}else{if(D[k]+=w,D[k]!=st)break;D[k--]=0,w=1}for(y=D.length;D[--y]===0;D.pop());}c.e>M?c.c=c.e=null:c.e<C&&(c.c=[c.e=0])}return c}function Ce(c){var u,i=c.e;return i===null?c.toString():(u=et(c.c),u=i<=d||i>=T?gn(u,i):ht(u,i,"0"),c.s<0?"-"+u:u)}return s.absoluteValue=s.abs=function(){var c=new N(this);return c.s<0&&(c.s=1),c},s.comparedTo=function(c,u){return It(this,new N(c,u))},s.decimalPlaces=s.dp=function(c,u){var i,b,g,y=this;if(c!=null)return Ie(c,0,$e),u==null?u=l:Ie(u,0,8),pe(new N(y),c+y.e+1,u);if(!(i=y.c))return null;if(b=((g=i.length-1)-Qe(this.e/he))*he,g=i[g])for(;g%10==0;g/=10,b--);return b<0&&(b=0),b},s.dividedBy=s.div=function(c,u){return t(this,new N(c,u),r,l)},s.dividedToIntegerBy=s.idiv=function(c,u){return t(this,new N(c,u),0,1)},s.exponentiatedBy=s.pow=function(c,u){var i,b,g,y,v,w,A,k,S,D=this;if(c=new N(c),c.c&&!c.isInteger())throw Error(ze+"Exponent not an integer: "+Ce(c));if(u!=null&&(u=new N(u)),w=c.e>14,!D.c||!D.c[0]||D.c[0]==1&&!D.e&&D.c.length==1||!c.c||!c.c[0])return S=new N(Math.pow(+Ce(D),w?c.s*(2-bn(c)):+Ce(c))),u?S.mod(u):S;if(A=c.s<0,u){if(u.c?!u.c[0]:!u.s)return new N(NaN);b=!A&&D.isInteger()&&u.isInteger(),b&&(D=D.mod(u))}else{if(c.e>9&&(D.e>0||D.e<-1||(D.e==0?D.c[0]>1||w&&D.c[1]>=24e7:D.c[0]<8e13||w&&D.c[0]<=9999975e7)))return y=D.s<0&&bn(c)?-0:0,D.e>-1&&(y=1/y),new N(A?1/y:y);m&&(y=oo(m/he+2))}for(w?(i=new N(.5),A&&(c.s=1),k=bn(c)):(g=Math.abs(+Ce(c)),k=g%2),S=new N(a);;){if(k){if(S=S.times(D),!S.c)break;y?S.c.length>y&&(S.c.length=y):b&&(S=S.mod(u))}if(g){if(g=Ze(g/2),g===0)break;k=g%2}else if(c=c.times(i),pe(c,c.e+1,1),c.e>14)k=bn(c);else{if(g=+Ce(c),g===0)break;k=g%2}D=D.times(D),y?D.c&&D.c.length>y&&(D.c.length=y):b&&(D=D.mod(u))}return b?S:(A&&(S=a.div(S)),u?S.mod(u):y?pe(S,m,l,v):S)},s.integerValue=function(c){var u=new N(this);return c==null?c=l:Ie(c,0,8),pe(u,u.e+1,c)},s.isEqualTo=s.eq=function(c,u){return It(this,new N(c,u))===0},s.isFinite=function(){return!!this.c},s.isGreaterThan=s.gt=function(c,u){return It(this,new N(c,u))>0},s.isGreaterThanOrEqualTo=s.gte=function(c,u){return(u=It(this,new N(c,u)))===1||u===0},s.isInteger=function(){return!!this.c&&Qe(this.e/he)>this.c.length-2},s.isLessThan=s.lt=function(c,u){return It(this,new N(c,u))<0},s.isLessThanOrEqualTo=s.lte=function(c,u){return(u=It(this,new N(c,u)))===-1||u===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(c,u){var i,b,g,y,v=this,w=v.s;if(c=new N(c,u),u=c.s,!w||!u)return new N(NaN);if(w!=u)return c.s=-u,v.plus(c);var A=v.e/he,k=c.e/he,S=v.c,D=c.c;if(!A||!k){if(!S||!D)return S?(c.s=-u,c):new N(D?v:NaN);if(!S[0]||!D[0])return D[0]?(c.s=-u,c):new N(S[0]?v:l==3?-0:0)}if(A=Qe(A),k=Qe(k),S=S.slice(),w=A-k){for((y=w<0)?(w=-w,g=S):(k=A,g=D),g.reverse(),u=w;u--;g.push(0));g.reverse()}else for(b=(y=(w=S.length)<(u=D.length))?w:u,w=u=0;u<b;u++)if(S[u]!=D[u]){y=S[u]<D[u];break}if(y&&(g=S,S=D,D=g,c.s=-c.s),u=(b=D.length)-(i=S.length),u>0)for(;u--;S[i++]=0);for(u=st-1;b>w;){if(S[--b]<D[b]){for(i=b;i&&!S[--i];S[i]=u);--S[i],S[b]+=st}S[b]-=D[b]}for(;S[0]==0;S.splice(0,1),--k);return S[0]?fe(c,S,k):(c.s=l==3?-1:1,c.c=[c.e=0],c)},s.modulo=s.mod=function(c,u){var i,b,g=this;return c=new N(c,u),!g.c||!c.s||c.c&&!c.c[0]?new N(NaN):!c.c||g.c&&!g.c[0]?new N(g):(x==9?(b=c.s,c.s=1,i=t(g,c,0,3),c.s=b,i.s*=b):i=t(g,c,0,x),c=g.minus(i.times(c)),!c.c[0]&&x==1&&(c.s=g.s),c)},s.multipliedBy=s.times=function(c,u){var i,b,g,y,v,w,A,k,S,D,z,se,me,Ae,Se,j=this,be=j.c,xe=(c=new N(c,u)).c;if(!be||!xe||!be[0]||!xe[0])return!j.s||!c.s||be&&!be[0]&&!xe||xe&&!xe[0]&&!be?c.c=c.e=c.s=null:(c.s*=j.s,!be||!xe?c.c=c.e=null:(c.c=[0],c.e=0)),c;for(b=Qe(j.e/he)+Qe(c.e/he),c.s*=j.s,A=be.length,D=xe.length,A<D&&(me=be,be=xe,xe=me,g=A,A=D,D=g),g=A+D,me=[];g--;me.push(0));for(Ae=st,Se=At,g=D;--g>=0;){for(i=0,z=xe[g]%Se,se=xe[g]/Se|0,v=A,y=g+v;y>g;)k=be[--v]%Se,S=be[v]/Se|0,w=se*k+S*z,k=z*k+w%Se*Se+me[y]+i,i=(k/Ae|0)+(w/Se|0)+se*S,me[y--]=k%Ae;me[y]=i}return i?++b:me.splice(0,1),fe(c,me,b)},s.negated=function(){var c=new N(this);return c.s=-c.s||null,c},s.plus=function(c,u){var i,b=this,g=b.s;if(c=new N(c,u),u=c.s,!g||!u)return new N(NaN);if(g!=u)return c.s=-u,b.minus(c);var y=b.e/he,v=c.e/he,w=b.c,A=c.c;if(!y||!v){if(!w||!A)return new N(g/0);if(!w[0]||!A[0])return A[0]?c:new N(w[0]?b:g*0)}if(y=Qe(y),v=Qe(v),w=w.slice(),g=y-v){for(g>0?(v=y,i=A):(g=-g,i=w),i.reverse();g--;i.push(0));i.reverse()}for(g=w.length,u=A.length,g-u<0&&(i=A,A=w,w=i,u=g),g=0;u;)g=(w[--u]=w[u]+A[u]+g)/st|0,w[u]=st===w[u]?0:w[u]%st;return g&&(w=[g].concat(w),++v),fe(c,w,v)},s.precision=s.sd=function(c,u){var i,b,g,y=this;if(c!=null&&c!==!!c)return Ie(c,1,$e),u==null?u=l:Ie(u,0,8),pe(new N(y),c,u);if(!(i=y.c))return null;if(g=i.length-1,b=g*he+1,g=i[g]){for(;g%10==0;g/=10,b--);for(g=i[0];g>=10;g/=10,b++);}return c&&y.e+1>b&&(b=y.e+1),b},s.shiftedBy=function(c){return Ie(c,-so,so),this.times("1e"+c)},s.squareRoot=s.sqrt=function(){var c,u,i,b,g,y=this,v=y.c,w=y.s,A=y.e,k=r+4,S=new N("0.5");if(w!==1||!v||!v[0])return new N(!w||w<0&&(!v||v[0])?NaN:v?y:1/0);if(w=Math.sqrt(+Ce(y)),w==0||w==1/0?(u=et(v),(u.length+A)%2==0&&(u+="0"),w=Math.sqrt(+u),A=Qe((A+1)/2)-(A<0||A%2),w==1/0?u="5e"+A:(u=w.toExponential(),u=u.slice(0,u.indexOf("e")+1)+A),i=new N(u)):i=new N(w+""),i.c[0]){for(A=i.e,w=A+k,w<3&&(w=0);;)if(g=i,i=S.times(g.plus(t(y,g,k,1))),et(g.c).slice(0,w)===(u=et(i.c)).slice(0,w))if(i.e<A&&--w,u=u.slice(w-3,w+1),u=="9999"||!b&&u=="4999"){if(!b&&(pe(g,g.e+r+2,0),g.times(g).eq(y))){i=g;break}k+=4,w+=4,b=1}else{(!+u||!+u.slice(1)&&u.charAt(0)=="5")&&(pe(i,i.e+r+2,1),c=!i.times(i).eq(y));break}}return pe(i,i.e+r+1,l,c)},s.toExponential=function(c,u){return c!=null&&(Ie(c,0,$e),c++),V(this,c,u,1)},s.toFixed=function(c,u){return c!=null&&(Ie(c,0,$e),c=c+this.e+1),V(this,c,u)},s.toFormat=function(c,u,i){var b,g=this;if(i==null)c!=null&&u&&typeof u=="object"?(i=u,u=null):c&&typeof c=="object"?(i=c,c=u=null):i=B;else if(typeof i!="object")throw Error(ze+"Argument not an object: "+i);if(b=g.toFixed(c,u),g.c){var y,v=b.split("."),w=+i.groupSize,A=+i.secondaryGroupSize,k=i.groupSeparator||"",S=v[0],D=v[1],z=g.s<0,se=z?S.slice(1):S,me=se.length;if(A&&(y=w,w=A,A=y,me-=y),w>0&&me>0){for(y=me%w||w,S=se.substr(0,y);y<me;y+=w)S+=k+se.substr(y,w);A>0&&(S+=k+se.slice(y)),z&&(S="-"+S)}b=D?S+(i.decimalSeparator||"")+((A=+i.fractionGroupSize)?D.replace(new RegExp("\\d{"+A+"}\\B","g"),"$&"+(i.fractionGroupSeparator||"")):D):S}return(i.prefix||"")+b+(i.suffix||"")},s.toFraction=function(c){var u,i,b,g,y,v,w,A,k,S,D,z,se=this,me=se.c;if(c!=null&&(w=new N(c),!w.isInteger()&&(w.c||w.s!==1)||w.lt(a)))throw Error(ze+"Argument "+(w.isInteger()?"out of range: ":"not an integer: ")+Ce(w));if(!me)return new N(se);for(u=new N(a),k=i=new N(a),b=A=new N(a),z=et(me),y=u.e=z.length-se.e-1,u.c[0]=ao[(v=y%he)<0?he+v:v],c=!c||w.comparedTo(u)>0?y>0?u:k:w,v=M,M=1/0,w=new N(z),A.c[0]=0;S=t(w,u,0,1),g=i.plus(S.times(b)),g.comparedTo(c)!=1;)i=b,b=g,k=A.plus(S.times(g=k)),A=g,u=w.minus(S.times(g=u)),w=g;return g=t(c.minus(i),b,0,1),A=A.plus(g.times(k)),i=i.plus(g.times(b)),A.s=k.s=se.s,y=y*2,D=t(k,b,y,l).minus(se).abs().comparedTo(t(A,i,y,l).minus(se).abs())<1?[k,b]:[A,i],M=v,D},s.toNumber=function(){return+Ce(this)},s.toPrecision=function(c,u){return c!=null&&Ie(c,1,$e),V(this,c,u,2)},s.toString=function(c){var u,i=this,b=i.s,g=i.e;return g===null?b?(u="Infinity",b<0&&(u="-"+u)):u="NaN":(c==null?u=g<=d||g>=T?gn(et(i.c),g):ht(et(i.c),g,"0"):c===10&&ke?(i=pe(new N(i),r+g+1,l),u=ht(et(i.c),i.e,"0")):(Ie(c,2,L.length,"Base"),u=n(ht(et(i.c),g,"0"),10,c,b,!0)),b<0&&i.c[0]&&(u="-"+u)),u},s.valueOf=s.toJSON=function(){return Ce(this)},s._isBigNumber=!0,s[Symbol.toStringTag]="BigNumber",s[Symbol.for("nodejs.util.inspect.custom")]=s.valueOf,e!=null&&N.set(e),N}function Qe(e){var t=e|0;return e>0||e===t?t:t-1}function et(e){for(var t,n,o=1,s=e.length,a=e[0]+"";o<s;){for(t=e[o++]+"",n=he-t.length;n--;t="0"+t);a+=t}for(s=a.length;a.charCodeAt(--s)===48;);return a.slice(0,s+1||1)}function It(e,t){var n,o,s=e.c,a=t.c,r=e.s,l=t.s,d=e.e,T=t.e;if(!r||!l)return null;if(n=s&&!s[0],o=a&&!a[0],n||o)return n?o?0:-l:r;if(r!=l)return r;if(n=r<0,o=d==T,!s||!a)return o?0:!s^n?1:-1;if(!o)return d>T^n?1:-1;for(l=(d=s.length)<(T=a.length)?d:T,r=0;r<l;r++)if(s[r]!=a[r])return s[r]>a[r]^n?1:-1;return d==T?0:d>T^n?1:-1}function Ie(e,t,n,o){if(e<t||e>n||e!==Ze(e))throw Error(ze+(o||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function bn(e){var t=e.c.length-1;return Qe(e.e/he)==t&&e.c[t]%2!=0}function gn(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function ht(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 ce=vs();class Qt{baseUrl;constructor(t){this.baseUrl=t}buildUrl(t,n){const o=new URL(t,this.baseUrl);return n&&Object.entries(n).forEach(([s,a])=>{a!=null&&o.searchParams.append(s,String(a))}),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 r=null;try{r=await s.json()}catch{try{const d=await s.text();d&&(r={message:d})}catch{}}const l=new Error(r?.message||r?.errorMessage||`HTTP ${s.status}: ${s.statusText}`);throw l.status=s.status,l.statusText=s.statusText,r&&(l.data=r),l}return{data:await s.json(),status:s.status}}async post(t,n,o={}){const s=this.buildUrl(t,o.query),a=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",...o.headers},body:JSON.stringify(n)});if(!a.ok){let l=null;try{l=await a.json()}catch{try{const T=await a.text();T&&(l={message:T})}catch{}}const d=new Error(l?.message||l?.errorMessage||`HTTP ${a.status}: ${a.statusText}`);throw d.status=a.status,d.statusText=a.statusText,l&&(d.data=l),d}return{data:await a.json(),status:a.status}}}const Di=.01,ks=new Qt("https://wallet-api.pantograph.app"),_i="https://deep-index.moralis.io";function en(){return"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJub25jZSI6ImY4NmY0Yzc2LTA3MDQtNGEwZS04YTA0LWUwODllOGQxMGZjZCIsIm9yZ0lkIjoiMzk0MDAyIiwidXNlcklkIjoiNDA0ODUzIiwidHlwZUlkIjoiYjQyODExOTQtOGQ0Yi00NjkxLTlhZjItNjU4ODE2NzExYmRjIiwidHlwZSI6IlBST0pFQ1QiLCJpYXQiOjE3MTY4NjQyNTYsImV4cCI6NDg3MjYyNDI1Nn0.V8crfBIBardAnZkc05FD0hQIJBeZxMqvzRnYExVtnF8"}function tn(e){return{"X-API-Key":e,Accept:"application/json"}}const nn=new Qt(_i);async function je(e){const{address:t,chain:n="base",token_addresses:o,exclude_spam:s,exclude_unverified_contracts:a}=e;if(!t)throw new Error("Address is required");try{const r=en(),l={chain:n,exclude_spam:s??!1,exclude_unverified_contracts:a??!1};o&&(l.token_addresses=o);const T=(await nn.get(`/api/v2.2/wallets/${encodeURIComponent(t)}/tokens`,{query:l,headers:tn(r)})).data;if(T?.result?.length>0){T.result=T.result.filter(C=>new ce(C?.balance||0).gt(0)),T.result=T.result.map(C=>({...C,token_address:C.token_address===ki?Ge:C.token_address}));try{const C=us(n)??n,M=T.result.map(x=>x.token_address),h=await ks.get(`/keyrings/tokens/${C}/v2`,{query:{addresses:M.join(",")}});if(Array.isArray(h.data)){const x=new Map;for(const m of h.data)m.address&&m.price!=null&&x.set(m.address.toLowerCase(),parseFloat(String(m.price)));T.result=T.result.map(m=>{const B=x.get(m.token_address.toLowerCase());if(B==null)return m;const L=ce(m.balance_formatted||"0").multipliedBy(B).toNumber();return{...m,usd_price:B,usd_value:L}}),T.result=T.result.filter(m=>m.usd_value==null||new ce(m.usd_value).gte(Di))}}catch(C){console.warn("⚠️ Failed to fetch Pantograph prices:",C)}}return{success:!0,data:T}}catch(r){const l=r instanceof Error?r.message:"Unknown error";return console.error("❌ Error fetching token balances:",l),{success:!1,error:l}}}async function Ui(e){const{address:t,chain:n="base"}=e;if(!t)throw new Error("Token address is required");try{const o=us(n)??n,s=await ks.get(`/keyrings/tokens/${o}/v2`,{query:{addresses:t}}),r=(Array.isArray(s.data)?s.data:[]).find(x=>x.address?.toLowerCase()===t.toLowerCase())??null;if(r)return{success:!0,data:{token_address:r.address??t,name:r.name??"",symbol:r.symbol??"",decimals:r.decimals!=null?Number(r.decimals):18,logo:r.icon_image||r.logo,thumbnail:r.icon_image||r.logo,usd_price:r.price!=null?parseFloat(r.price):void 0,usd_price_24hr_percent_change:r.price_change_percentage_24h??void 0,usd_price_24hr_usd_change:r.price_change_24h??void 0}};console.warn("⚠️ Pantograph returned no result, falling back to Moralis API");const l=en(),[d,T]=await Promise.allSettled([nn.get("/api/v2.2/erc20/metadata",{query:{chain:n,addresses:[t]},headers:tn(l)}),nn.get(`/api/v2.2/erc20/${encodeURIComponent(t)}/price`,{query:{chain:n,include:"percent_change"},headers:tn(l)})]),C=d.status==="fulfilled"?d.value.data:[];if(!C||C.length===0)return{success:!1,error:"Token metadata not found"};const M=C[0],h=T.status==="fulfilled"?T.value.data:void 0;return{success:!0,data:{token_address:M.token_address,name:M.name,symbol:M.symbol,decimals:M.decimals,logo:M.logo||M.thumbnail,thumbnail:M.thumbnail,usd_price:h?.usdPrice??void 0,usd_price_24hr_percent_change:h?.["24hrPercentChange"]?parseFloat(h["24hrPercentChange"]):void 0,usd_price_24hr_usd_change:h?.usdPriceChange24hr??void 0}}}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 Oi(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 a=en(),r=new Qt("https://cortex-api.moralis.io"),l=s?`${s}
|
|
100
100
|
|
|
101
101
|
---
|
|
102
102
|
|
|
103
|
-
User: ${t}`:t;return{success:!0,data:(await r.post("/chat",{prompt:l,model:n,stream:o},{headers:{"X-API-Key":a,Accept:"application/json","Content-Type":"application/json"}})).data}}catch(a){const r=a instanceof Error?a.message:"Unknown error";return console.error("❌ Error chatting with Cortex AI:",r),{success:!1,error:r}}}async function Ui(e){const{address:t,chain:n="base"}=e;if(!t)throw new Error("Contract address is required");try{const o=Zt();return{success:!0,data:(await en.get(`/api/v2.2/nft/${encodeURIComponent(t)}/metadata`,{query:{chain:n},headers:Qt(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:a}=e;if(!t)throw new Error("Address is required");try{const r=Zt(),l={chain:n,format:"decimal",limit:o,exclude_spam:s,media_items:!0,normalizeMetadata:!0};return a&&(l.cursor=a),{success:!0,data:(await en.get(`/api/v2.2/${encodeURIComponent(t)}/nft`,{query:l,headers:Qt(r)})).data}}catch(r){const l=r instanceof Error?r.message:"Unknown error";return console.error("❌ Error fetching NFTs:",l),{success:!1,error:l}}}const Li="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAx8SURBVHgB7VprbFzFFT5n9kmoil0JiUqVsuYX/7BRSeL+aOyKivKjxYYEmpbWNlQpUYvsQAtBVPHdoBYFodgWIiAK8ppWysOVbFrRh0qxUyE5BlQ7/VEqVYo3P6qq6iMbpYTEu3dOz7zuY72Jr51NIrU59u597NyZ+ea8zx2A63Sd/qcI4QoQTfW0QC3fDrLWpS4BUxUAeQwfmFyEa0xNB0xHtw9yrx7DbAlH4WGI1FkZBHq47egEXCNqGmCa3NbF3Q0z0K7IXbLD1I+zBCh24/Yjb8JVpssGTIe+WoCUP8TYbufemKvYzkdSghwcTUsKgQfnJfCrRdwxXYarRM0X6XHW3w3Ze1ln+xlTV4MWFMo4mkUBKkK6NoG9Vx74ugHfNjNXyJ/nk/P5ymJvR6VRGzpyfw+AGOFRCoF4o8BA0s0MrBQg6zdccf1eE+CWhYWWDedrg7mqP5StYUtOAuVqgHy+mPFpOi/lxK97O8v1z7Eh6+fDMH8KcdFuOCV+nnqvlEVPDLhlbq6QQpzJ+lhg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fOTfcf/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'%20preserveAspectRatio='none'%20xlink:href='data:image/png;base64,iVBORw0KGgoAAAAN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trKZ/h3z0zT6odRpKkNlQfAGaKiH8HXtH8eDawuFKUG4GjgO8C+2XmFZVySJI0Ep0aAGaKiHsBL6EMAy8HHjjib3ku8EPg+8BPMvPqEX8/SZKq6ewAMFNEBPB0ykCwOvDgGT/uz8KWCW8G/gT8fsaP07yiV5I0TXoxACxPRCymnA7MHAoeAFwPXAFcOeN/LwPOycwb66SVJKkbej8ASJKkhevr5/AlSdIQHAAkSZpCDgCSJE0hBwBJkqaQA4AkSVPo/wH9hnZgmG1pVwAAAABJRU5ErkJggg=='/%3e%3c/defs%3e%3c/svg%3e";class _i extends bn{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((a,r,l)=>r===l.findIndex(d=>d.address.toLowerCase()===a.address.toLowerCase())),Array.isArray(t)&&t.length>0&&(s.data=s.data.filter(a=>t.some(r=>r.toLowerCase()===a.address.toLowerCase())),s.data.sort((a,r)=>t.findIndex(l=>l.toLowerCase()===a.address.toLowerCase())-t.findIndex(l=>l.toLowerCase()===r.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 et=new _i,Ri="https://dln.debridge.finance",$i=new bn(Ri);async function so(e){const{chainId:t,tokenIn:n,tokenInAmount:o,tokenOut:s,accesstoken:a,slippage:r="auto",tokenOutRecipient:l}=e;if(!t||!n||!o||!s)throw new Error("Missing required parameters: chainId, tokenIn, tokenInAmount, tokenOut");try{const I=(await(await fetch("https://exchange-api.keyring.app/admin/setting?configs=others",{method:"GET"})).json())?.others||{},M=I?.AFFILIATE_FEE_PERENT,w=I?.AFFILIATE_FEE_RECIPIENT,S=await $i.get("/v1.0/chain/transaction",{query:{chainId:String(t),tokenIn:n,tokenInAmount:o,tokenOut:s,slippage:String(r),tokenOutRecipient:l,accesstoken:a,affiliateFeePercent:M,affiliateFeeRecipient:w}});if(S.data?.error)throw new Error(`DeBridge API Error: ${S.data.error}`);return console.log("✅ Quote retrieved successfully"),{success:!0,data:S.data}}catch(d){let E=d instanceof Error?d.message:"Unknown error";const I=d;I.data?.errorMessage?E=I.data.errorMessage:I.response?.data?.errorMessage?E=I.response.data.errorMessage:I.data?.message?E=I.data.message:I.response?.data?.message&&(E=I.response.data.message);const M=I.status||I.response?.status||I.statusCode||I.data?.status;return console.error("📋 Error details:",{errorMessage:E,errorCode:I.data?.errorCode,errorId:I.data?.errorId,status:M,reqId:I.data?.reqId,fullError:{message:I.message,status:I.status,statusCode:I.statusCode}}),{success:!1,error:d instanceof Error?d.message:"Unknown error",status:M,errorMessage:E,errorCode:I.data?.errorCode,errorId:I.data?.errorId}}}function At(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(C.jsx("img",{src:s[2],alt:s[1],className:"mc-image"},s.index)):s[3]!==void 0?t.push(C.jsx("a",{href:s[4],target:"_blank",rel:"noopener noreferrer",className:"mc-link",children:s[3]},s.index)):s[5]!==void 0?t.push(C.jsx("a",{href:s[5],target:"_blank",rel:"noopener noreferrer",className:"mc-link",children:s[5]},s.index)):s[6]!==void 0?t.push(C.jsx("strong",{children:At(s[6])},s.index)):s[7]!==void 0?t.push(C.jsx("strong",{children:At(s[7])},s.index)):s[8]!==void 0?t.push(C.jsx("em",{children:At(s[8])},s.index)):s[9]!==void 0?t.push(C.jsx("em",{children:At(s[9])},s.index)):s[10]!==void 0?t.push(C.jsx("del",{children:At(s[10])},s.index)):s[11]!==void 0&&t.push(C.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(`
|
|
104
|
-
`),n=[];let o=0;for(;o<t.length;){const s=t[o];if(s.trimStart().startsWith("```")){const r=s.trimStart().slice(3)?.trim(),l=[];for(o++;o<t.length&&!t[o].trimStart().startsWith("```");)l.push(t[o]),o++;n.push(
|
|
105
|
-
`)})})]},`code-${o}`)),o++;continue}if(/^(\s*[-*_]\s*){3,}$/.test(s)){n.push(C.jsx("hr",{className:"mc-hr"},`hr-${o}`)),o++;continue}const a=s.match(/^(#{1,3})\s+(.+)/);if(a){const r=a[1].length,l=a[2];n.push(C.jsx("div",{className:`mc-heading mc-h${r}`,children:At(l)},`h-${o}`)),o++;continue}if(s.trimStart().startsWith("> ")){const r=[];for(;o<t.length&&t[o].trimStart().startsWith("> ");)r.push(t[o].replace(/^\s*>\s?/,"")),o++;n.push(C.jsx("div",{className:"mc-blockquote",children:r.map((l,d)=>C.jsx("div",{children:At(l)},d))},`bq-${o}`));continue}if(s?.trim()===""){n.push(C.jsx("div",{className:"mc-empty-line"},`empty-${o}`)),o++;continue}n.push(C.jsx("div",{className:"mc-line",children:At(s)},`line-${o}`)),o++}return C.jsx("div",{className:"message-content",children:n})},Wi={send_native:{label:"actionSendNativeLabel",description:"actionSendNativeDesc",fields:[{key:"to_address",label:"fieldToAddress",type:"address",placeholder:"0x...",required:!0,validation:"address"},{key:"amount",label:"fieldAmount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"}]},send_token:{label:"actionSendTokenLabel",description:"actionSendTokenDesc",fields:[{key:"contract_address",label:"fieldTokenContract",type:"address",placeholder:"0x... token contract",required:!0,validation:"address",editable:!1},{key:"token_symbol",label:"fieldTokenSymbol",type:"text",placeholder:"e.g. USDC",required:!1,editable:!1},{key:"to_address",label:"fieldToAddress",type:"address",placeholder:"0x...",required:!0,validation:"address"},{key:"amount",label:"fieldAmount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"},{key:"decimals",label:"fieldDecimals",type:"number",placeholder:"18",required:!1,editable:!1}]},swap_token:{label:"actionSwapTokenLabel",description:"actionSwapTokenDesc",fields:[{key:"token_in",label:"fieldTokenIn",type:"address",placeholder:"0x... or native",required:!0,editable:!1},{key:"token_in_symbol",label:"fieldTokenInSymbol",type:"text",placeholder:"e.g. ETH",required:!1,editable:!1},{key:"token_out",label:"fieldTokenOut",type:"address",placeholder:"0x...",required:!0,editable:!1},{key:"token_out_symbol",label:"fieldTokenOutSymbol",type:"text",placeholder:"e.g. USDC",required:!1,editable:!1},{key:"token_in_decimals",label:"fieldTokenInDecimals",type:"number",placeholder:"18",required:!1,editable:!1},{key:"token_out_decimals",label:"fieldTokenOutDecimals",type:"number",placeholder:"18",required:!1,editable:!1},{key:"amount",label:"fieldAmount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"}]},approve_token:{label:"actionApproveTokenLabel",description:"actionApproveTokenDesc",fields:[{key:"contract_address",label:"fieldTokenContract",type:"address",placeholder:"0x... token contract",required:!0,validation:"address",editable:!1},{key:"token_symbol",label:"fieldTokenSymbol",type:"text",placeholder:"e.g. USDC",required:!1,editable:!1},{key:"spender_address",label:"fieldSpenderAddress",type:"address",placeholder:"0x... spender contract",required:!0,validation:"address",editable:!1},{key:"amount",label:"fieldAmountUnlimited",type:"amount",placeholder:"0.0 or leave empty for max",required:!1,validation:"amount"},{key:"decimals",label:"fieldDecimals",type:"number",placeholder:"18",required:!1,editable:!1}]},wrap_native:{label:"actionWrapNativeLabel",description:"actionWrapNativeDesc",fields:[{key:"amount",label:"fieldAmount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"}]},unwrap_native:{label:"actionUnwrapNativeLabel",description:"actionUnwrapNativeDesc",fields:[{key:"amount",label:"fieldAmount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"}]},send_nft:{label:"actionSendNftLabel",description:"actionSendNftDesc",fields:[{key:"contract_address",label:"fieldNftContract",type:"address",placeholder:"0x... NFT contract",required:!0,validation:"address",editable:!1},{key:"token_id",label:"fieldTokenId",type:"text",placeholder:"e.g. 1234",required:!0,editable:!1},{key:"to_address",label:"fieldToAddress",type:"address",placeholder:"0x...",required:!0,validation:"address"},{key:"token_standard",label:"fieldTokenStandard",type:"text",placeholder:"ERC721 or ERC1155",required:!0,editable:!1},{key:"amount",label:"fieldAmount",type:"text",placeholder:"1",required:!0},{key:"nft_name",label:"fieldNftName",type:"text",placeholder:"e.g. Bored Ape #1234",required:!1,editable:!1}]}};function Vi(e){return Re(e)}function ao(e){if(!e||e?.trim()==="")return!1;const t=parseFloat(e);return!isNaN(t)&&t>0}const Gi=({action:e,initialValues:t,onSubmit:n,onCancel:o,isSubmitting:s=!1,tokenInfo:a})=>{const{t:r,ti:l}=xn(),d=Wi[e],[E,I]=se.useState(()=>{if(!d)return{};const K={};return d.fields.forEach(B=>{K[B.key]=t[B.key]||""}),K}),[M]=se.useState(()=>["send_native","send_token","swap_token"].includes(e)&&!a&&E.contract_address?r("formTokenNotFound"):null),[w,S]=se.useState(()=>{const K={};if(["send_native","send_token","swap_token"].includes(e)&&a){const G=parseFloat(a.balanceFormatted||"0");if(G<=0)K.amount=l("formNoBalance",{symbol:a.symbol??""});else{const ne=t.amount?.trim();ne&&ao(ne)&&parseFloat(ne)>G&&(K.amount=l("formInsufficientBalance",{balance:a.balanceFormatted,symbol:a.symbol??""}))}}return K}),g=se.useCallback((K,B)=>{I(G=>({...G,[K]:B})),w[K]&&S(G=>{const ne={...G};return delete ne[K],ne})},[w]),N=se.useCallback(()=>{if(!d)return!1;const K={};if(d.fields.forEach(B=>{const G=E[B.key]?.trim()||"";if(B.required&&!G&&!(e==="send_nft"&&B.key==="amount")){K[B.key]=l("formFieldRequired",{field:r(B.label)});return}if(G){if(B.validation==="address"&&!Vi(G)&&(K[B.key]=r("formInvalidAddress")),B.validation==="amount"&&!ao(G)&&(K[B.key]=r("formMustBePositive")),B.key==="amount"&&G&&ao(G)&&a?.balanceFormatted){const ne=parseFloat(G),he=parseFloat(a.balanceFormatted);ne>he&&(K[B.key]=l("formInsufficientBalance",{balance:a.balanceFormatted,symbol:a.symbol??""}))}B.validation==="positive_number"&&(isNaN(Number(G))||Number(G)<0)&&(K[B.key]=r("formMustBeValidNumber"))}}),e==="send_nft"&&E.token_standard?.toUpperCase()==="ERC1155"){const B=E.amount?.trim();if(!B)K.amount=l("formFieldRequired",{field:r("fieldAmount")});else if(!/^\d+$/.test(B)||parseInt(B,10)<1)K.amount=r("formMustBePositiveInteger");else{const G=parseInt(t.amount||"0",10);G>0&&parseInt(B,10)>G&&(K.amount=l("formAmountExceedsNft",{max:String(G)}))}}return S(K),Object.keys(K).length===0},[d,E,a,e,t,r,l]),L=se.useCallback(()=>{N()&&n(e,E)},[N,n,e,E]);return d?C.jsxs("div",{className:"action-form",children:[C.jsx("div",{className:"action-form-title",children:C.jsx("span",{children:r(d.label)})}),M&&C.jsxs("div",{className:"action-form-general-error",children:["⚠️ ",M]}),a&&C.jsx("div",{className:"action-form-token-info",children:C.jsxs("div",{className:"token-info-row",children:[a.logo&&C.jsx("img",{src:a.logo,alt:a.symbol,className:"token-info-logo",width:20,height:20}),C.jsxs("div",{className:"token-info-details",children:[C.jsxs("span",{className:"token-info-name",children:[a.name," (",a.symbol,")"]}),C.jsxs("span",{className:"token-info-balance",children:[r("formBalance")," ",le(a.balanceFormatted).decimalPlaces(8,le.ROUND_DOWN).toFormat()," ",a.symbol,a.usdValue!==void 0&&C.jsxs("span",{className:"token-info-usd",children:[" ","≈ $",a.usdValue.toFixed(2)]})]})]})]})}),C.jsx("div",{className:"action-form-fields",children:d.fields.map(K=>K.key==="amount"&&e==="send_nft"&&E.token_standard?.toUpperCase()!=="ERC1155"?null:C.jsxs("div",{className:"action-form-field",children:[C.jsxs("div",{className:"action-form-field-header",children:[C.jsxs("div",{className:"action-form-field-label",children:[r(K.label),K.required&&" *"]}),K.key==="amount"&&a&&e!=="send_nft"&&C.jsxs("div",{className:"action-form-pct-btns",children:[[25,50,75].map(B=>C.jsxs("button",{type:"button",className:"action-form-pct-btn",onClick:()=>g("amount",(parseFloat(a.balanceFormatted)*B/100).toString()),disabled:s,children:[B,"%"]},B)),C.jsx("button",{type:"button",className:"action-form-pct-btn action-form-max-btn",onClick:()=>g("amount",a.balanceFormatted),disabled:s,children:"MAX"})]})]}),(()=>{const B=K.editable===!1&&!!t[K.key],G=s||B,ne=[w[K.key]?"error":"",B?"readonly":""].filter(Boolean).join(" ");return K.type==="address"?C.jsx("textarea",{rows:2,placeholder:K.placeholder,value:E[K.key]||"",onChange:he=>g(K.key,he.target.value),className:ne,disabled:G}):C.jsx("input",{type:K.type==="number"?"number":"text",placeholder:K.placeholder,value:E[K.key]||"",onChange:he=>g(K.key,he.target.value),className:ne,disabled:G})})(),w[K.key]&&C.jsx("span",{className:"field-error",children:w[K.key]})]},K.key))}),C.jsxs("div",{className:"action-form-actions",children:[C.jsx("button",{className:"action-form-cancel",onClick:o,type:"button",disabled:s,children:r("formCancel")}),C.jsx("button",{className:"action-form-submit",onClick:L,type:"button",disabled:s,children:r(s?"formProcessing":"formExecute")})]})]}):null},zi=({scrollContainerRef:e,threshold:t=200})=>{const[n,o]=se.useState(!1);se.useEffect(()=>{const a=e.current;if(!a)return;const r=()=>{const{scrollTop:l,scrollHeight:d,clientHeight:E}=a,I=d-l-E;o(I>t)};return a.addEventListener("scroll",r,{passive:!0}),r(),()=>{a.removeEventListener("scroll",r)}},[e,t]);const s=()=>{e.current?.scrollTo({top:e.current.scrollHeight,behavior:"smooth"})};return n?C.jsx("button",{className:"scroll-to-bottom-btn",onClick:s,"aria-label":"Scroll to bottom",type:"button",children:C.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:C.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,walletTokens:a}=e;if(!t)return`You are a Web3 wallet assistant for the Keyring crypto EVM wallet app.
|
|
103
|
+
User: ${t}`:t;return{success:!0,data:(await r.post("/chat",{prompt:l,model:n,stream:o},{headers:{"X-API-Key":a,Accept:"application/json","Content-Type":"application/json"}})).data}}catch(a){const r=a instanceof Error?a.message:"Unknown error";return console.error("❌ Error chatting with Cortex AI:",r),{success:!1,error:r}}}async function Li(e){const{address:t,chain:n="base"}=e;if(!t)throw new Error("Contract address is required");try{const o=en();return{success:!0,data:(await nn.get(`/api/v2.2/nft/${encodeURIComponent(t)}/metadata`,{query:{chain:n},headers:tn(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 wn(e){const{address:t,chain:n="base",limit:o=20,exclude_spam:s=!0,cursor:a}=e;if(!t)throw new Error("Address is required");try{const r=en(),l={chain:n,format:"decimal",limit:o,exclude_spam:s,media_items:!0,normalizeMetadata:!0};return a&&(l.cursor=a),{success:!0,data:(await nn.get(`/api/v2.2/${encodeURIComponent(t)}/nft`,{query:l,headers:tn(r)})).data}}catch(r){const l=r instanceof Error?r.message:"Unknown error";return console.error("❌ Error fetching NFTs:",l),{success:!1,error:l}}}const Mi="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAx8SURBVHgB7VprbFzFFT5n9kmoil0JiUqVsuYX/7BRSeL+aOyK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xYkRAomzkwrXfAx/grCHhL53iitC7CiPOa4SG5ibDsDF2moebI+QmlnaX7h0fHGYt763EMTHEx0M+Mi9epg/jpLdJZRg5Z+ua6L6EKZ81qtDKvQugEvdnMqV5XdqDabheEd2Hk75rSnpVh64tXj40+9vBJ46/4d5ZtHez2/Ktp4yhM6MHF5A5KLPAihPjEQZpRotsSeM8m743UDVrR4T2dZ8JtDVWO2t3TmEE/dQMlkP78fntn7UmP9/vQr95RveeWuAUrVbj2b47hdP+NKoLaQGZu1jMTRlrtEiTbBXBZgRccZdKZG3axis6YYhOFkbHJoiyQbhQTvudH5pQMHPmio34s35eFcBlrI1nf0UxGbFJCM5uQ2iANRggR02YAVzfZ2lt/+yiYFumhDZ8PnoKQL0UOBfH/8pf3zUz9+NizQTXkLLYipcfX+OBpoUFgKDQmjmZrWgDI+mGx/V1MAO/pl751F8Pn9Eck3LHtMgmXfJwcv1o3A96BIvfOTfcf/fWT4+JKoLZ9mdFstIFcjiufFjgjbQ1HmSM6vfgESUlMBK1L7sw5/rbNfVPEOdl2nzKSsDkoKQIf6ia18swDubbmlSAhlDVdKb3HQm1j1zh/deAzOVTvWstFlzX5srfTYq3P9WRLDWR826p0/1XCrU66m94lg3uwAIrUXxGyNUruEACO7g8qF1zerCEzt6hvXgFNiCO87cmKN02k+h+vpxZ2dJV8qSy73IdUvMOk6ClC4Syt4z2QbmIPN0o7c38eFugncPtm9HrC6J7iK5I3MFfKcGWVr2J9zXNX7uMDu+TIc15ytBbt+IIOyrXD3/gq/SoP17t5xdFUBO3rhhfmeDTUYYbCFnNmqqEQ5AGu3O2mxzlRp922vbhmFJtE1Aezo9R+qLY1imAEWAo5arud8qqRqtLvjYGcJmkjXFLCjo9677bnl9Nasj60swpSuyWOfgPxix2jHZYnvdbpO/wf0X652D+/dGV80AAAAAElFTkSuQmCC",Ri="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/Seuqtp947MhNJkjRdFtUOIEmSxs8BQJKkKeQAIEnSFHIAkCRpCjkASJI0hRbXDjCoiFgMPBB40Iwf9wZimV96E/AP4PzmxwWZeeMYo0qS1DnRl48BRsSqwFrA85ofa3DHh/18JHAxcCrwmyU/MvPslqJKktR5nR0AImJ1lj7s1wJWH/G3vAw4EjgE+EFmXj7i7ydJUjWdGgAi4uXA2ykP/YdWjHITcBRlGDggMy+umEWSpNZVHwAiYmXgrcAngMdXDTO7G4ADgZ0z88TaYSRJakO1ASAi7glsAHwUWLVKiIU7FtgZ+FZm3lQ7jCRJgxr7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SRqFgQYAgMzcB/hUe1Gm3i+Bl2Xm0zPzkBzkaEaSpHka6C2A232BiI8DW+MdAYP6MaWS9xe1g0iSpsfQAwBARLwZ+Co2By7E9ygP/uNrB5EkTZ9WBgCAiHgBcDAWBy3PrcC3KZW8p9QOI0maXq0NAAAR8QTgEODhrX3RyXAL8A1gi8w8vXYYSZJaHQAAIuKewJ7Am1r9wv10I+WtkS9k5tm1w0iStETrA8BtXzjiPZSSmruO5Bt023XAl4GtMvPc2mEkSVrWyAYAgIhYA9gPeOrIvkm3XA3sDmybmRfWDiNJ0lxGOgAARMQiYH3g88D9R/rN6rkc2BnYITMvrR1GkqQVGfkAcNs3irgP8P8DGzE5Vwj/E9ge2CUzr6wdRpKk+RrbAHDbNyyfFPgf4FUMcRNhZRdQLj/aw0peSVIfjX0AuO0bRzwK2BhYF7hLlRALdwKwG3CAlbySpD6rNgDcFiDiAcAHgXcCq1UNM7trKZ/h3z0zT6odRpKkNlQfAGaKiH8HXtH8eDawuFKUG4GjgO8C+2XmFZVySJI0Ep0aAGaKiHsBL6EMAy8HHjjib3ku8EPg+8BPMvPqEX8/SZKq6ewAMFNEBPB0ykCwOvDgGT/uz8KWCW8G/gT8fsaP07yiV5I0TXoxACxPRCymnA7MHAoeAFwPXAFcOeN/LwPOycwb66SVJKkbej8ASJKkhevr5/AlSdIQHAAkSZpCDgCSJE0hBwBJkqaQA4AkSVPo/wH9hnZgmG1pVwAAAABJRU5ErkJggg=='/%3e%3c/defs%3e%3c/svg%3e";class $i extends Qt{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((a,r,l)=>r===l.findIndex(d=>d.address.toLowerCase()===a.address.toLowerCase())),Array.isArray(t)&&t.length>0&&(s.data=s.data.filter(a=>t.some(r=>r.toLowerCase()===a.address.toLowerCase())),s.data.sort((a,r)=>t.findIndex(l=>l.toLowerCase()===a.address.toLowerCase())-t.findIndex(l=>l.toLowerCase()===r.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 tt=new $i,Hi="https://dln.debridge.finance",Wi=new Qt(Hi);async function ro(e){const{chainId:t,tokenIn:n,tokenInAmount:o,tokenOut:s,accesstoken:a,slippage:r="auto",tokenOutRecipient:l}=e;if(!t||!n||!o||!s)throw new Error("Missing required parameters: chainId, tokenIn, tokenInAmount, tokenOut");try{const C=(await(await fetch("https://exchange-api.keyring.app/admin/setting?configs=others",{method:"GET"})).json())?.others||{},M=C?.AFFILIATE_FEE_PERENT,h=C?.AFFILIATE_FEE_RECIPIENT,x=await Wi.get("/v1.0/chain/transaction",{query:{chainId:String(t),tokenIn:n,tokenInAmount:o,tokenOut:s,slippage:String(r),tokenOutRecipient:l,accesstoken:a,affiliateFeePercent:M,affiliateFeeRecipient:h}});if(x.data?.error)throw new Error(`DeBridge API Error: ${x.data.error}`);return console.log("✅ Quote retrieved successfully"),{success:!0,data:x.data}}catch(d){let T=d instanceof Error?d.message:"Unknown error";const C=d;C.data?.errorMessage?T=C.data.errorMessage:C.response?.data?.errorMessage?T=C.response.data.errorMessage:C.data?.message?T=C.data.message:C.response?.data?.message&&(T=C.response.data.message);const M=C.status||C.response?.status||C.statusCode||C.data?.status;return console.error("📋 Error details:",{errorMessage:T,errorCode:C.data?.errorCode,errorId:C.data?.errorId,status:M,reqId:C.data?.reqId,fullError:{message:C.message,status:C.status,statusCode:C.statusCode}}),{success:!1,error:d instanceof Error?d.message:"Unknown error",status:M,errorMessage:T,errorCode:C.data?.errorCode,errorId:C.data?.errorId}}}function Tt(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(P.jsx("img",{src:s[2],alt:s[1],className:"mc-image"},s.index)):s[3]!==void 0?t.push(P.jsx("a",{href:s[4],target:"_blank",rel:"noopener noreferrer",className:"mc-link",children:s[3]},s.index)):s[5]!==void 0?t.push(P.jsx("a",{href:s[5],target:"_blank",rel:"noopener noreferrer",className:"mc-link",children:s[5]},s.index)):s[6]!==void 0?t.push(P.jsx("strong",{children:Tt(s[6])},s.index)):s[7]!==void 0?t.push(P.jsx("strong",{children:Tt(s[7])},s.index)):s[8]!==void 0?t.push(P.jsx("em",{children:Tt(s[8])},s.index)):s[9]!==void 0?t.push(P.jsx("em",{children:Tt(s[9])},s.index)):s[10]!==void 0?t.push(P.jsx("del",{children:Tt(s[10])},s.index)):s[11]!==void 0&&t.push(P.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 Vi=({content:e})=>{const t=e.split(`
|
|
104
|
+
`),n=[];let o=0;for(;o<t.length;){const s=t[o];if(s.trimStart().startsWith("```")){const r=s.trimStart().slice(3)?.trim(),l=[];for(o++;o<t.length&&!t[o].trimStart().startsWith("```");)l.push(t[o]),o++;n.push(P.jsxs("div",{className:"mc-codeblock",children:[r&&P.jsx("div",{className:"mc-codeblock-lang",children:r}),P.jsx("pre",{children:P.jsx("code",{children:l.join(`
|
|
105
|
+
`)})})]},`code-${o}`)),o++;continue}if(/^(\s*[-*_]\s*){3,}$/.test(s)){n.push(P.jsx("hr",{className:"mc-hr"},`hr-${o}`)),o++;continue}const a=s.match(/^(#{1,3})\s+(.+)/);if(a){const r=a[1].length,l=a[2];n.push(P.jsx("div",{className:`mc-heading mc-h${r}`,children:Tt(l)},`h-${o}`)),o++;continue}if(s.trimStart().startsWith("> ")){const r=[];for(;o<t.length&&t[o].trimStart().startsWith("> ");)r.push(t[o].replace(/^\s*>\s?/,"")),o++;n.push(P.jsx("div",{className:"mc-blockquote",children:r.map((l,d)=>P.jsx("div",{children:Tt(l)},d))},`bq-${o}`));continue}if(s?.trim()===""){n.push(P.jsx("div",{className:"mc-empty-line"},`empty-${o}`)),o++;continue}n.push(P.jsx("div",{className:"mc-line",children:Tt(s)},`line-${o}`)),o++}return P.jsx("div",{className:"message-content",children:n})},Gi={send_native:{label:"actionSendNativeLabel",description:"actionSendNativeDesc",fields:[{key:"to_address",label:"fieldToAddress",type:"address",placeholder:"0x...",required:!0,validation:"address"},{key:"amount",label:"fieldAmount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"}]},send_token:{label:"actionSendTokenLabel",description:"actionSendTokenDesc",fields:[{key:"contract_address",label:"fieldTokenContract",type:"address",placeholder:"0x... token contract",required:!0,validation:"address",editable:!1},{key:"token_symbol",label:"fieldTokenSymbol",type:"text",placeholder:"e.g. USDC",required:!1,editable:!1},{key:"to_address",label:"fieldToAddress",type:"address",placeholder:"0x...",required:!0,validation:"address"},{key:"amount",label:"fieldAmount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"},{key:"decimals",label:"fieldDecimals",type:"number",placeholder:"18",required:!1,editable:!1}]},swap_token:{label:"actionSwapTokenLabel",description:"actionSwapTokenDesc",fields:[{key:"token_in",label:"fieldTokenIn",type:"address",placeholder:"0x... or native",required:!0,editable:!1},{key:"token_in_symbol",label:"fieldTokenInSymbol",type:"text",placeholder:"e.g. ETH",required:!1,editable:!1},{key:"token_out",label:"fieldTokenOut",type:"address",placeholder:"0x...",required:!0,editable:!1},{key:"token_out_symbol",label:"fieldTokenOutSymbol",type:"text",placeholder:"e.g. USDC",required:!1,editable:!1},{key:"token_in_decimals",label:"fieldTokenInDecimals",type:"number",placeholder:"18",required:!1,editable:!1},{key:"token_out_decimals",label:"fieldTokenOutDecimals",type:"number",placeholder:"18",required:!1,editable:!1},{key:"amount",label:"fieldAmount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"}]},approve_token:{label:"actionApproveTokenLabel",description:"actionApproveTokenDesc",fields:[{key:"contract_address",label:"fieldTokenContract",type:"address",placeholder:"0x... token contract",required:!0,validation:"address",editable:!1},{key:"token_symbol",label:"fieldTokenSymbol",type:"text",placeholder:"e.g. USDC",required:!1,editable:!1},{key:"spender_address",label:"fieldSpenderAddress",type:"address",placeholder:"0x... spender contract",required:!0,validation:"address",editable:!1},{key:"amount",label:"fieldAmountUnlimited",type:"amount",placeholder:"0.0 or leave empty for max",required:!1,validation:"amount"},{key:"decimals",label:"fieldDecimals",type:"number",placeholder:"18",required:!1,editable:!1}]},wrap_native:{label:"actionWrapNativeLabel",description:"actionWrapNativeDesc",fields:[{key:"amount",label:"fieldAmount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"}]},unwrap_native:{label:"actionUnwrapNativeLabel",description:"actionUnwrapNativeDesc",fields:[{key:"amount",label:"fieldAmount",type:"amount",placeholder:"0.0",required:!0,validation:"amount"}]},send_nft:{label:"actionSendNftLabel",description:"actionSendNftDesc",fields:[{key:"contract_address",label:"fieldNftContract",type:"address",placeholder:"0x... NFT contract",required:!0,validation:"address",editable:!1},{key:"token_id",label:"fieldTokenId",type:"text",placeholder:"e.g. 1234",required:!0,editable:!1},{key:"to_address",label:"fieldToAddress",type:"address",placeholder:"0x...",required:!0,validation:"address"},{key:"token_standard",label:"fieldTokenStandard",type:"text",placeholder:"ERC721 or ERC1155",required:!0,editable:!1},{key:"amount",label:"fieldAmount",type:"text",placeholder:"1",required:!0},{key:"maxAmount",label:"fieldMaxAmount",type:"text",placeholder:"",required:!1,editable:!1,hidden:!0},{key:"nft_name",label:"fieldNftName",type:"text",placeholder:"e.g. Bored Ape #1234",required:!1,editable:!1}]}};function zi(e){return Re(e)}function io(e){if(!e||e?.trim()==="")return!1;const t=parseFloat(e);return!isNaN(t)&&t>0}const qi=({action:e,initialValues:t,onSubmit:n,onCancel:o,isSubmitting:s=!1,tokenInfo:a,nftInfo:r})=>{const{t:l,ti:d}=En(),T=Gi[e],[C,M]=ne.useState(()=>{if(!T)return{};const N={};return T.fields.forEach(V=>{N[V.key]=t[V.key]||""}),N}),[h]=ne.useState(()=>["send_native","send_token","swap_token"].includes(e)&&!a&&C.contract_address?l("formTokenNotFound"):null),[x,m]=ne.useState(()=>{const N={};if(["send_native","send_token","swap_token"].includes(e)&&a){const X=parseFloat(a.balanceFormatted||"0");if(X<=0)N.amount=d("formNoBalance",{symbol:a.symbol??""});else{const fe=t.amount?.trim();fe&&io(fe)&&parseFloat(fe)>X&&(N.amount=d("formInsufficientBalance",{balance:a.balanceFormatted,symbol:a.symbol??""}))}}return N}),B=ne.useCallback((N,V)=>{M(X=>({...X,[N]:V})),x[N]&&m(X=>{const fe={...X};return delete fe[N],fe})},[x]),L=ne.useCallback(()=>{if(!T)return!1;const N={};if(T.fields.forEach(V=>{const X=C[V.key]?.trim()||"";if(V.required&&!X&&!(e==="send_nft"&&V.key==="amount")){N[V.key]=d("formFieldRequired",{field:l(V.label)});return}if(X){if(V.validation==="address"&&!zi(X)&&(N[V.key]=l("formInvalidAddress")),V.validation==="amount"&&!io(X)&&(N[V.key]=l("formMustBePositive")),V.key==="amount"&&X&&io(X)&&a?.balanceFormatted){const fe=parseFloat(X),pe=parseFloat(a.balanceFormatted);fe>pe&&(N[V.key]=d("formInsufficientBalance",{balance:a.balanceFormatted,symbol:a.symbol??""}))}V.validation==="positive_number"&&(isNaN(Number(X))||Number(X)<0)&&(N[V.key]=l("formMustBeValidNumber"))}}),e==="send_nft"&&C.token_standard?.toUpperCase()==="ERC1155"){const V=C.amount?.trim();if(!V)N.amount=d("formFieldRequired",{field:l("fieldAmount")});else if(!/^\d+$/.test(V)||parseInt(V,10)<1)N.amount=l("formMustBePositiveInteger");else{const X=parseInt(t.maxAmount||"0",10);X>0&&parseInt(V,10)>X&&(N.amount=d("formAmountExceedsNft",{max:String(X)}))}}return m(N),Object.keys(N).length===0},[T,C,a,e,t,l,d]),ke=ne.useCallback(()=>{L()&&n(e,C)},[L,n,e,C]);return T?P.jsxs("div",{className:"action-form",children:[P.jsx("div",{className:"action-form-title",children:P.jsx("span",{children:l(T.label)})}),h&&P.jsxs("div",{className:"action-form-general-error",children:["⚠️ ",h]}),a&&P.jsx("div",{className:"action-form-token-info",children:P.jsxs("div",{className:"token-info-row",children:[a.logo&&P.jsx("img",{src:a.logo,alt:a.symbol,className:"token-info-logo",width:20,height:20}),P.jsxs("div",{className:"token-info-details",children:[P.jsxs("span",{className:"token-info-name",children:[a.name," (",a.symbol,")"]}),P.jsxs("span",{className:"token-info-balance",children:[l("formBalance")," ",ce(a.balanceFormatted).decimalPlaces(8,ce.ROUND_DOWN).toFormat()," ",a.symbol,a.usdValue!==void 0&&P.jsxs("span",{className:"token-info-usd",children:[" ","≈ $",a.usdValue.toFixed(2)]})]})]})]})}),r?.image&&P.jsx("div",{className:"action-form-nft-info",children:P.jsx("img",{src:r.image,alt:r.name,className:"nft-info-image",onError:N=>{N.target.style.display="none"}})}),P.jsx("div",{className:"action-form-fields",children:T.fields.map(N=>N.hidden||N.key==="amount"&&e==="send_nft"&&C.token_standard?.toUpperCase()!=="ERC1155"?null:P.jsxs("div",{className:"action-form-field",children:[P.jsxs("div",{className:"action-form-field-header",children:[P.jsxs("div",{className:"action-form-field-label",children:[l(N.label),N.required&&" *"]}),N.key==="amount"&&a&&e!=="send_nft"&&P.jsxs("div",{className:"action-form-pct-btns",children:[[25,50,75].map(V=>P.jsxs("button",{type:"button",className:"action-form-pct-btn",onClick:()=>B("amount",(parseFloat(a.balanceFormatted)*V/100).toString()),disabled:s,children:[V,"%"]},V)),P.jsx("button",{type:"button",className:"action-form-pct-btn action-form-max-btn",onClick:()=>B("amount",a.balanceFormatted),disabled:s,children:"MAX"})]})]}),(()=>{const V=N.editable===!1&&!!t[N.key],X=s||V,fe=[x[N.key]?"error":"",V?"readonly":""].filter(Boolean).join(" ");return N.type==="address"?P.jsx("textarea",{rows:2,placeholder:N.placeholder,value:C[N.key]||"",onChange:pe=>B(N.key,pe.target.value),className:fe,disabled:X}):P.jsx("input",{type:N.type==="number"?"number":"text",placeholder:N.placeholder,value:C[N.key]||"",onChange:pe=>B(N.key,pe.target.value),className:fe,disabled:X})})(),x[N.key]&&P.jsx("span",{className:"field-error",children:x[N.key]})]},N.key))}),P.jsxs("div",{className:"action-form-actions",children:[P.jsx("button",{className:"action-form-cancel",onClick:o,type:"button",disabled:s,children:l("formCancel")}),P.jsx("button",{className:"action-form-submit",onClick:ke,type:"button",disabled:s,children:l(s?"formProcessing":"formExecute")})]})]}):null},Yi=({scrollContainerRef:e,threshold:t=200})=>{const[n,o]=ne.useState(!1);ne.useEffect(()=>{const a=e.current;if(!a)return;const r=()=>{const{scrollTop:l,scrollHeight:d,clientHeight:T}=a,C=d-l-T;o(C>t)};return a.addEventListener("scroll",r,{passive:!0}),r(),()=>{a.removeEventListener("scroll",r)}},[e,t]);const s=()=>{e.current?.scrollTo({top:e.current.scrollHeight,behavior:"smooth"})};return n?P.jsx("button",{className:"scroll-to-bottom-btn",onClick:s,"aria-label":"Scroll to bottom",type:"button",children:P.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:P.jsx("path",{d:"M9 3V15M9 15L4 10M9 15L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}):null};function ji(e){const{walletAddress:t,chainName:n,chainId:o,nativeSymbol:s,walletTokens:a,walletNfts:r}=e;if(!t)return`You are a Web3 wallet assistant for the Keyring crypto EVM wallet app.
|
|
106
106
|
The user is currently NOT connected to any wallet.
|
|
107
107
|
|
|
108
108
|
## YOUR ROLE:
|
|
@@ -128,7 +128,7 @@ Always respond with a valid JSON object:
|
|
|
128
128
|
- **CRITICAL**: NEVER include any "Buy" actions (e.g., "Buy USDC", "Buy ETH", "Purchase token", etc.) in suggested_actions. The app handles Buy buttons separately. Only include non-buy actions in suggested_actions (e.g., "Send token", "Swap token", "Check balance", "Show my NFTs").
|
|
129
129
|
- For wallet-required actions, politely explain the user needs to connect their wallet first, and put this in the "message" field
|
|
130
130
|
- ALWAYS respond with raw JSON only, never wrap in \`\`\`json code blocks
|
|
131
|
-
- **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.`;if(t&&!
|
|
131
|
+
- **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.`;if(t&&!lt[o])return`You are a Web3 wallet assistant for the Keyring crypto EVM wallet app.
|
|
132
132
|
The user's wallet address is: ${t}
|
|
133
133
|
The user is selected on (chainId: ${o}) an UNSUPPORTED chain.
|
|
134
134
|
|
|
@@ -158,15 +158,20 @@ Always respond with a valid JSON object:
|
|
|
158
158
|
- **CRITICAL**: NEVER include any "Buy" actions (e.g., "Buy USDC", "Buy ETH", "Purchase token", etc.) in suggested_actions. The app handles Buy buttons separately. Only include non-buy actions in suggested_actions (e.g., "Send token", "Swap token", "Check balance", "Show my NFTs").
|
|
159
159
|
- For wallet-required actions, politely explain the user needs to connect their wallet first, and put this in the "message" field
|
|
160
160
|
- ALWAYS respond with raw JSON only, never wrap in \`\`\`json code blocks
|
|
161
|
-
- **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
|
|
161
|
+
- **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 l=a&&a.length>0?`
|
|
162
162
|
## USER'S CURRENT WALLET BALANCE:
|
|
163
|
-
${a.map(
|
|
163
|
+
${a.map(T=>{const C=T.usd_value!==void 0?` (~$${T.usd_value.toFixed(2)})`:"";return`- ${T.name} (${T.symbol}): ${T.balance_formatted}${C}${T.native_token?" [native]":` [${T.token_address}]`}`}).join(`
|
|
164
164
|
`)}
|
|
165
165
|
Use this balance data to accurately answer balance questions and to pre-fill token parameters in actions (contract_address, decimals, symbol). NEVER ask the user to provide token info that is already available above.
|
|
166
|
+
`:"",d=r&&r.length>0?`
|
|
167
|
+
## USER'S NFT COLLECTION:
|
|
168
|
+
${r.map(T=>{const C=T.contract_type==="ERC1155"?` (x${T.amount})`:"";return`- ${T.name}${C} | ${T.contract_type} | contract: ${T.token_address} | tokenId: ${T.token_id}`}).join(`
|
|
169
|
+
`)}
|
|
170
|
+
When the user wants to send an NFT by name, use this data to fill contract_address, token_id, token_standard, and nft_name accurately. NEVER guess or fabricate NFT contract addresses.
|
|
166
171
|
`:"";return`You are a Web3 wallet assistant for the Keyring crypto EVM wallet app.
|
|
167
172
|
The user's wallet address is: ${t}
|
|
168
173
|
The user is on chain: ${n} (chainId: ${o})
|
|
169
|
-
Native token: ${s}${
|
|
174
|
+
Native token: ${s}${l}${d}
|
|
170
175
|
## YOUR ROLE:
|
|
171
176
|
- You are a friendly, knowledgeable assistant that can talk about ANY topic naturally
|
|
172
177
|
- You also specialize in crypto wallet operations: send tokens, swap, approve, check balances, get token info
|
|
@@ -174,7 +179,7 @@ Native token: ${s}${r}
|
|
|
174
179
|
- When user asks about general topics (weather, coding, history, math, etc.), respond naturally using the "chat" action
|
|
175
180
|
- You will receive CONVERSATION HISTORY to maintain context. Use it to understand what the user is referring to
|
|
176
181
|
- NEVER confuse a general conversation with a wallet action. Only use wallet actions when user EXPLICITLY wants to perform a crypto operation
|
|
177
|
-
- **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.**
|
|
182
|
+
- **CRITICAL: For ERC20 token actions (send_token, swap_token, buy_token, approve_token), 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. EXCEPTION: For send_nft, contract_address is OPTIONAL — if the user refers to an NFT by name and you don't know the contract address, leave it as empty string "" and fill nft_name instead. NEVER make up or guess NFT contract addresses.**
|
|
178
183
|
- **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.**
|
|
179
184
|
|
|
180
185
|
## RESPONSE FORMAT:
|
|
@@ -259,9 +264,9 @@ Parameters: { "amount": "" }
|
|
|
259
264
|
Triggered by: "unwrap WETH", "convert WETH to ETH"
|
|
260
265
|
|
|
261
266
|
### 8. send_nft - Send/Transfer an NFT (ERC721 or ERC1155)
|
|
262
|
-
Parameters: { "contract_address": "" (
|
|
267
|
+
Parameters: { "contract_address": "" (OPTIONAL), "token_id": "" (OPTIONAL), "to_address": "" (REQUIRED), "token_standard": "ERC721 or ERC1155" (OPTIONAL), "amount": "" (for ERC1155 only, default 1), "nft_name": "" }
|
|
263
268
|
Triggered by: "send NFT", "transfer NFT #1234 to 0x...", "send my Bored Ape to...", "transfer ERC1155 token"
|
|
264
|
-
Note: token_standard is OPTIONAL. If the user specifies the standard or you confidently know it, include "ERC721" or "ERC1155". Otherwise, leave it as empty string "" — the app will automatically detect the correct standard by querying on-chain metadata. For ERC1155, amount defaults to "1" if not specified. contract_address
|
|
269
|
+
Note: token_standard is OPTIONAL. If the user specifies the standard or you confidently know it, include "ERC721" or "ERC1155". Otherwise, leave it as empty string "" — the app will automatically detect the correct standard by querying on-chain metadata. For ERC1155, amount defaults to "1" if not specified. **IMPORTANT**: For NFTs, you typically do NOT know the contract_address. If the user refers to an NFT by name (e.g., "send Shou Rikuto", "send my Bored Ape"), leave contract_address as empty string "" and put the NFT name in nft_name — the app will look it up from the user's wallet. Only provide contract_address if the user explicitly gives the contract address. NEVER make up or guess NFT contract addresses.
|
|
265
270
|
|
|
266
271
|
### 9. view_nfts - View/Show user's NFT collection
|
|
267
272
|
Parameters: {} (empty)
|
|
@@ -286,7 +291,7 @@ You have comprehensive, precise knowledge of token contract addresses on ALL maj
|
|
|
286
291
|
2. Leave parameter as empty string "" if the user didn't mention it
|
|
287
292
|
3. Always include a friendly "message" explaining what you understood
|
|
288
293
|
4. For "chat" action, put your full response in the "message" field
|
|
289
|
-
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).
|
|
294
|
+
5. **CRITICAL**: For ERC20 token actions, 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). **EXCEPTION: For send_nft, if you don't know the NFT contract address, leave it as empty string "" and provide nft_name instead. NEVER fabricate NFT addresses.**
|
|
290
295
|
6. **IMPORTANT**: ALWAYS provide accurate decimals for each token. This is CRITICAL for accurate transaction amounts.
|
|
291
296
|
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.
|
|
292
297
|
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.
|
|
@@ -371,58 +376,64 @@ User: "tell me about some random new token"
|
|
|
371
376
|
Response: {"action":"chat","message":"<cautious response>","parameters":{},"token_mentions":[]}
|
|
372
377
|
|
|
373
378
|
User: "send NFT #1234 from contract 0xABC... to 0xDEF..."
|
|
374
|
-
Response: {"action":"send_nft","message":"<friendly explanation>","parameters":{"contract_address":"0xABC...","token_id":"1234","to_address":"0xDEF...","token_standard":"
|
|
379
|
+
Response: {"action":"send_nft","message":"<friendly explanation>","parameters":{"contract_address":"0xABC...","token_id":"1234","to_address":"0xDEF...","token_standard":"","amount":"1","nft_name":""}}
|
|
380
|
+
|
|
381
|
+
User: "send Shou Rikuto tokenId 5"
|
|
382
|
+
Response: {"action":"send_nft","message":"<ask for recipient address>","parameters":{"contract_address":"","token_id":"5","to_address":"","token_standard":"","amount":"1","nft_name":"Shou Rikuto"}}
|
|
383
|
+
|
|
384
|
+
User: "send my Bored Ape #42 to 0xDEF..."
|
|
385
|
+
Response: {"action":"send_nft","message":"<friendly explanation>","parameters":{"contract_address":"","token_id":"42","to_address":"0xDEF...","token_standard":"","amount":"1","nft_name":"Bored Ape"}}
|
|
375
386
|
|
|
376
387
|
User: "transfer my ERC1155 token #5 (amount 3) from 0xNFT... to 0xBOB..."
|
|
377
|
-
Response: {"action":"send_nft","message":"<friendly explanation>","parameters":{"contract_address":"0xNFT...","token_id":"5","to_address":"0xBOB...","token_standard":"
|
|
388
|
+
Response: {"action":"send_nft","message":"<friendly explanation>","parameters":{"contract_address":"0xNFT...","token_id":"5","to_address":"0xBOB...","token_standard":"","amount":"3","nft_name":""}}
|
|
378
389
|
|
|
379
390
|
User: "show my NFTs" or "what NFTs do I have?"
|
|
380
391
|
Response: {"action":"view_nfts","message":"Let me show you your NFT collection!","parameters":{}}
|
|
381
392
|
|
|
382
393
|
[With conversation history where user previously swapped ETH to USDC]
|
|
383
394
|
User: "do it again but with 2 ETH"
|
|
384
|
-
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"}}`}const gs={1:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",10:"0x4200000000000000000000000000000000000006",56:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",137:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",8453:"0x4200000000000000000000000000000000000006",42161:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"},wn=[{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"}]}],ys=[{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 tn(e,t){return t||ft[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 a=pt(s,18).toString();return{from:t,to:o,data:"0x",value:a,chainId:n,description:`Send ${s} native token to ${o}`}}function Ki(e,t,n){const{contract_address:o,to_address:s,amount:a,decimals:r,token_symbol:l}=e;if(!o)throw new Error("Token contract address is required");if(!s)throw new Error("Recipient address is required");if(!a)throw new Error("Amount is required");const d=parseInt(r)||18,E=pt(a,d),I=vt({abi:wn,functionName:"transfer",args:[s,E]});return{from:t,to:o,data:I,value:"0",chainId:n,description:`Send ${a} ${l||"tokens"} to ${s}`}}function Zi(e,t,n){const{contract_address:o,spender_address:s,amount:a,token_symbol:r}=e;if(!o)throw new Error("Token contract address is required");if(!s)throw new Error("Spender address is required");const l=a&&a?.trim()!==""?pt(a,18):Mt,d=vt({abi:wn,functionName:"approve",args:[s,l]});return{from:t,to:o,data:d,value:"0",chainId:n,description:`Approve ${a||"unlimited"} ${r||"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 a=pt(o,18).toString(),r=vt({abi:ys,functionName:"deposit"});return{from:t,to:s,data:r,value:a,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 a=pt(o,18),r=vt({abi:ys,functionName:"withdraw",args:[a]});return{from:t,to:s,data:r,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 ro(e){const{transactionHash:t,chainId:n,pollingInterval:o=3e3,timeout:s=12e4,rpcUrl:a}=e,r=tn(n,a);if(!r)throw new Error(`No RPC endpoint for chain ${n}`);const l=Date.now();for(;Date.now()-l<s;){try{const E=await(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_getTransactionReceipt",params:[t]})})).json();if(E.result){const I=E.result;return{status:I.status==="0x1"?"success":"fail",blockNumber:I.blockNumber,gasUsed:I.gasUsed,effectiveGasPrice:I.effectiveGasPrice}}}catch(d){console.warn("eth_getTransactionReceipt poll error:",d)}await new Promise(d=>setTimeout(d,o))}throw new Error(`Transaction ${t} was not mined within ${s/1e3}s`)}async function io(e){const{tokenAddress:t,ownerAddress:n,spenderAddress:o,chainId:s,rpcUrl:a}=e,r=tn(s,a);if(!r)return console.warn(`No RPC endpoint for chain ${s}, assuming no allowance`),BigInt(0);try{const l=vt({abi:wn,functionName:"allowance",args:[n,o]}),E=await(await fetch(r,{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 E.result&&E.result!=="0x"?BigInt(E.result):BigInt(0)}catch(l){return console.warn("checkAllowance failed:",l),BigInt(0)}}function gn(e){const{tokenAddress:t,spenderAddress:n,fromAddress:o,chainId:s,tokenSymbol:a}=e,r=vt({abi:wn,functionName:"approve",args:[n,Mt]});return{from:o,to:t,data:r,value:"0",chainId:s,description:`Approve ${a||"token"} for swap`}}function nc(e,t,n){const{contract_address:o,token_id:s,to_address:a,token_standard:r,amount:l,nft_name:d}=e;if(!o)throw new Error("NFT contract address is required");if(!s)throw new Error("Token ID is required");if(!a)throw new Error("Recipient address is required");const E=(r||"ERC721").toUpperCase(),I=BigInt(s);let M,w;if(E==="ERC1155"){const S=BigInt(l||"1");M=vt({abi:ji,functionName:"safeTransferFrom",args:[t,a,I,S,"0x"]}),w=`Send ${S>1n?S.toString()+"x ":""}${d||"NFT"} (ERC1155 #${s}) to ${a}`}else M=vt({abi:Yi,functionName:"safeTransferFrom",args:[t,a,I]}),w=`Send ${d||"NFT"} (ERC721 #${s}) to ${a}`;return{from:t,to:o,data:M,value:"0",chainId:n,description:w}}async function yn(e){const{address:t,chainId:n,rpcUrl:o}=e,s=tn(n,o);if(!s)return console.warn(`No RPC endpoint for chain ${n}`),new le(0);try{const r=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 r.result&&r.result!=="0x"?new le(BigInt(r.result).toString()):new le(0)}catch(a){return console.warn("getNativeBalance failed:",a),new le(0)}}async function nn(e){const{from:t,to:n,data:o,value:s,chainId:a,rpcUrl:r}=e,l=tn(a,r);if(!l)return console.warn(`No RPC endpoint for chain ${a}`),new le(0);try{const[d,E]=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:[]})})]),[I,M]=await Promise.all([d.json(),E.json()]),w=I.result?new le(BigInt(I.result).toString()):new le(0),S=M.result?new le(BigInt(M.result).toString()):new le(0);return w.times(S).times(1.1)}catch(d){return console.warn("estimateTransactionFee failed:",d),new le(0)}}async function co(e){const{chainId:t,rpcUrl:n}=e,o=tn(t,n);if(!o)return console.warn(`No RPC endpoint for chain ${t}`),new le(0);try{const a=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 a.result&&a.result!=="0x"?new le(BigInt(a.result).toString()):new le(0)}catch(s){return console.warn("getGasPrice failed:",s),new le(0)}}var ae={},on={exports:{}},oc=on.exports,vs;function sc(){return vs||(vs=1,(function(e,t){(function(n,o){var s="1.0.41",a="",r="?",l="function",d="undefined",E="object",I="string",M="major",w="model",S="name",g="type",N="vendor",L="version",K="architecture",B="console",G="mobile",ne="tablet",he="smarttv",ye="wearable",Ne="embedded",c=500,u="Amazon",i="Apple",m="ASUS",h="BlackBerry",y="Browser",v="Chrome",b="Edge",A="Firefox",k="Google",T="Honor",F="Huawei",V="Lenovo",re="LG",be="Microsoft",ke="Motorola",xe="Nvidia",z="OnePlus",ge="Opera",Se="OPPO",He="Samsung",st="Sharp",je="Sony",Pe="Xiaomi",ze="Zebra",Me="Facebook",Fe="Chromium OS",Ae="Mac OS",It=" Browser",Wt=function(Q,J){var ee={};for(var fe in Q)J[fe]&&J[fe].length%2===0?ee[fe]=J[fe].concat(Q[fe]):ee[fe]=Q[fe];return ee},ht=function(Q){for(var J={},ee=0;ee<Q.length;ee++)J[Q[ee].toUpperCase()]=Q[ee];return J},O=function(Q,J){return typeof Q===I?Z(J).indexOf(Z(Q))!==-1:!1},Z=function(Q){return Q.toLowerCase()},$=function(Q){return typeof Q===I?Q.replace(/[^\d\.]/g,a).split(".")[0]:o},te=function(Q,J){if(typeof Q===I)return Q=Q.replace(/^\s\s*/,a),typeof J===d?Q:Q.substring(0,c)},X=function(Q,J){for(var ee=0,fe,j,oe,H,U,ce;ee<J.length&&!U;){var Ee=J[ee],ue=J[ee+1];for(fe=j=0;fe<Ee.length&&!U&&Ee[fe];)if(U=Ee[fe++].exec(Q),U)for(oe=0;oe<ue.length;oe++)ce=U[++j],H=ue[oe],typeof H===E&&H.length>0?H.length===2?typeof H[1]==l?this[H[0]]=H[1].call(this,ce):this[H[0]]=H[1]:H.length===3?typeof H[1]===l&&!(H[1].exec&&H[1].test)?this[H[0]]=ce?H[1].call(this,ce,H[2]):o:this[H[0]]=ce?ce.replace(H[1],H[2]):o:H.length===4&&(this[H[0]]=ce?H[3].call(this,ce.replace(H[1],H[2])):o):this[H]=ce||o;ee+=2}},W=function(Q,J){for(var ee in J)if(typeof J[ee]===E&&J[ee].length>0){for(var fe=0;fe<J[ee].length;fe++)if(O(J[ee][fe],Q))return ee===r?o:ee}else if(O(J[ee],Q))return ee===r?o:ee;return J.hasOwnProperty("*")?J["*"]:Q},q={"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},ie={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"},me={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[L,[S,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[L,[S,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[S,L],[/opios[\/ ]+([\w\.]+)/i],[L,[S,ge+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[L,[S,ge+" GX"]],[/\bopr\/([\w\.]+)/i],[L,[S,ge]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[L,[S,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[L,[S,"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],[S,L],[/quark(?:pc)?\/([-\w\.]+)/i],[L,[S,"Quark"]],[/\bddg\/([\w\.]+)/i],[L,[S,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[L,[S,"UC"+y]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[L,[S,"WeChat"]],[/konqueror\/([\w\.]+)/i],[L,[S,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[L,[S,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[L,[S,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[L,[S,"Smart Lenovo "+y]],[/(avast|avg)\/([\w\.]+)/i],[[S,/(.+)/,"$1 Secure "+y],L],[/\bfocus\/([\w\.]+)/i],[L,[S,A+" Focus"]],[/\bopt\/([\w\.]+)/i],[L,[S,ge+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[L,[S,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[L,[S,"Dolphin"]],[/coast\/([\w\.]+)/i],[L,[S,ge+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[L,[S,"MIUI"+It]],[/fxios\/([\w\.-]+)/i],[L,[S,A]],[/\bqihoobrowser\/?([\w\.]*)/i],[L,[S,"360"]],[/\b(qq)\/([\w\.]+)/i],[[S,/(.+)/,"$1Browser"],L],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[S,/(.+)/,"$1"+It],L],[/samsungbrowser\/([\w\.]+)/i],[L,[S,He+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[L,[S,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[S,"Sogou Mobile"],L],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[S,L],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[S],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[L,S],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[S,Me],L],[/(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],[S,L],[/\bgsa\/([\w\.]+) .*safari\//i],[L,[S,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[L,[S,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[L,[S,v+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[S,v+" WebView"],L],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[L,[S,"Android "+y]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[S,L],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[L,[S,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[L,S],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[S,[L,W,q]],[/(webkit|khtml)\/([\w\.]+)/i],[S,L],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[S,"Netscape"],L],[/(wolvic|librewolf)\/([\w\.]+)/i],[S,L],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[L,[S,A+" 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],[S,[L,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[S,[L,/master.|lts./,""]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[K,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[K,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[K,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[K,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[K,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[K,/ower/,a,Z]],[/ sun4\w[;\)]/i],[[K,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[K,Z]]],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],[w,[N,He],[g,ne]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[w,[N,He],[g,G]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[w,[N,i],[g,G]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[w,[N,i],[g,ne]],[/(macintosh);/i],[w,[N,i]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[w,[N,st],[g,G]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[w,[N,T],[g,ne]],[/honor([-\w ]+)[;\)]/i],[w,[N,T],[g,G]],[/\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],[w,[N,F],[g,ne]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[w,[N,F],[g,G]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[w,/_/g," "],[N,Pe],[g,ne]],[/\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],[[w,/_/g," "],[N,Pe],[g,G]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[w,[N,Se],[g,G]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[w,[N,W,{OnePlus:["304","403","203"],"*":Se}],[g,ne]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[w,[N,"Vivo"],[g,G]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[w,[N,"Realme"],[g,G]],[/\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],[w,[N,ke],[g,G]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[w,[N,ke],[g,ne]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[w,[N,re],[g,ne]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv|watch)\w+)/i,/\blg-?([\d\w]+) bui/i],[w,[N,re],[g,G]],[/(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],[w,[N,V],[g,ne]],[/(nokia) (t[12][01])/i],[N,w,[g,ne]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[w,/_/g," "],[g,G],[N,"Nokia"]],[/(pixel (c|tablet))\b/i],[w,[N,k],[g,ne]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[w,[N,k],[g,G]],[/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],[w,[N,je],[g,G]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[w,"Xperia Tablet"],[N,je],[g,ne]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[w,[N,z],[g,G]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[w,[N,u],[g,ne]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[w,/(.+)/g,"Fire Phone $1"],[N,u],[g,G]],[/(playbook);[-\w\),; ]+(rim)/i],[w,N,[g,ne]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[w,[N,h],[g,G]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[w,[N,m],[g,ne]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[w,[N,m],[g,G]],[/(nexus 9)/i],[w,[N,"HTC"],[g,ne]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[N,[w,/_/g," "],[g,G]],[/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],[w,[N,"TCL"],[g,ne]],[/(itel) ((\w+))/i],[[N,Z],w,[g,W,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[w,[N,"Acer"],[g,ne]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[w,[N,"Meizu"],[g,G]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[w,[N,"Ulefone"],[g,G]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[w,[N,"Energizer"],[g,G]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[w,[N,"Cat"],[g,G]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[w,[N,"Smartfren"],[g,G]],[/droid.+; (a(?:015|06[35]|142p?))/i],[w,[N,"Nothing"],[g,G]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[w,[N,"Archos"],[g,ne]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[w,[N,"Archos"],[g,G]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[N,w,[g,ne]],[/(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],[N,w,[g,G]],[/(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],[N,w,[g,ne]],[/(surface duo)/i],[w,[N,be],[g,ne]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[w,[N,"Fairphone"],[g,G]],[/(u304aa)/i],[w,[N,"AT&T"],[g,G]],[/\bsie-(\w*)/i],[w,[N,"Siemens"],[g,G]],[/\b(rct\w+) b/i],[w,[N,"RCA"],[g,ne]],[/\b(venue[\d ]{2,7}) b/i],[w,[N,"Dell"],[g,ne]],[/\b(q(?:mv|ta)\w+) b/i],[w,[N,"Verizon"],[g,ne]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[w,[N,"Barnes & Noble"],[g,ne]],[/\b(tm\d{3}\w+) b/i],[w,[N,"NuVision"],[g,ne]],[/\b(k88) b/i],[w,[N,"ZTE"],[g,ne]],[/\b(nx\d{3}j) b/i],[w,[N,"ZTE"],[g,G]],[/\b(gen\d{3}) b.+49h/i],[w,[N,"Swiss"],[g,G]],[/\b(zur\d{3}) b/i],[w,[N,"Swiss"],[g,ne]],[/\b((zeki)?tb.*\b) b/i],[w,[N,"Zeki"],[g,ne]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[N,"Dragon Touch"],w,[g,ne]],[/\b(ns-?\w{0,9}) b/i],[w,[N,"Insignia"],[g,ne]],[/\b((nxa|next)-?\w{0,9}) b/i],[w,[N,"NextBook"],[g,ne]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[N,"Voice"],w,[g,G]],[/\b(lvtel\-)?(v1[12]) b/i],[[N,"LvTel"],w,[g,G]],[/\b(ph-1) /i],[w,[N,"Essential"],[g,G]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[w,[N,"Envizen"],[g,ne]],[/\b(trio[-\w\. ]+) b/i],[w,[N,"MachSpeed"],[g,ne]],[/\btu_(1491) b/i],[w,[N,"Rotor"],[g,ne]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[w,[N,xe],[g,ne]],[/(sprint) (\w+)/i],[N,w,[g,G]],[/(kin\.[onetw]{3})/i],[[w,/\./g," "],[N,be],[g,G]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[w,[N,ze],[g,ne]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[w,[N,ze],[g,G]],[/smart-tv.+(samsung)/i],[N,[g,he]],[/hbbtv.+maple;(\d+)/i],[[w,/^/,"SmartTV"],[N,He],[g,he]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[N,re],[g,he]],[/(apple) ?tv/i],[N,[w,i+" TV"],[g,he]],[/crkey/i],[[w,v+"cast"],[N,k],[g,he]],[/droid.+aft(\w+)( bui|\))/i],[w,[N,u],[g,he]],[/(shield \w+ tv)/i],[w,[N,xe],[g,he]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[w,[N,st],[g,he]],[/(bravia[\w ]+)( bui|\))/i],[w,[N,je],[g,he]],[/(mi(tv|box)-?\w+) bui/i],[w,[N,Pe],[g,he]],[/Hbbtv.*(technisat) (.*);/i],[N,w,[g,he]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[N,te],[w,te],[g,he]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[w,[g,he]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[g,he]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[N,w,[g,B]],[/droid.+; (shield)( bui|\))/i],[w,[N,xe],[g,B]],[/(playstation \w+)/i],[w,[N,je],[g,B]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[w,[N,be],[g,B]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[w,[N,He],[g,ye]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[N,w,[g,ye]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[w,[N,Se],[g,ye]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[w,[N,i],[g,ye]],[/(opwwe\d{3})/i],[w,[N,z],[g,ye]],[/(moto 360)/i],[w,[N,ke],[g,ye]],[/(smartwatch 3)/i],[w,[N,je],[g,ye]],[/(g watch r)/i],[w,[N,re],[g,ye]],[/droid.+; (wt63?0{2,3})\)/i],[w,[N,ze],[g,ye]],[/droid.+; (glass) \d/i],[w,[N,k],[g,ye]],[/(pico) (4|neo3(?: link|pro)?)/i],[N,w,[g,ye]],[/; (quest( \d| pro)?)/i],[w,[N,Me],[g,ye]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[N,[g,Ne]],[/(aeobc)\b/i],[w,[N,u],[g,Ne]],[/(homepod).+mac os/i],[w,[N,i],[g,Ne]],[/windows iot/i],[[g,Ne]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[w,[g,G]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[w,[g,ne]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[g,ne]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[g,G]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[w,[N,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[L,[S,b+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[S,L],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[L,[S,"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],[S,L],[/ladybird\//i],[[S,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[L,S]],os:[[/microsoft (windows) (vista|xp)/i],[S,L],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[S,[L,W,ie]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[L,W,ie],[S,"Windows"]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[L,/_/g,"."],[S,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[S,Ae],[L,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[L,S],[/(ubuntu) ([\w\.]+) like android/i],[[S,/(.+)/,"$1 Touch"],L],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/; ]?([\d\.]*)/i],[S,L],[/\(bb(10);/i],[L,[S,h]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[L,[S,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[L,[S,A+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[L,[S,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[L,[S,"watchOS"]],[/crkey\/([\d\.]+)/i],[L,[S,v+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[S,Fe],L],[/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],[S,L],[/(sunos) ?([\w\.\d]*)/i],[[S,"Solaris"],L],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[S,L]]},_=function(Q,J){if(typeof Q===E&&(J=Q,Q=o),!(this instanceof _))return new _(Q,J).getResult();var ee=typeof n!==d&&n.navigator?n.navigator:o,fe=Q||(ee&&ee.userAgent?ee.userAgent:a),j=ee&&ee.userAgentData?ee.userAgentData:o,oe=J?Wt(me,J):me,H=ee&&ee.userAgent==fe;return this.getBrowser=function(){var U={};return U[S]=o,U[L]=o,X.call(U,fe,oe.browser),U[M]=$(U[L]),H&&ee&&ee.brave&&typeof ee.brave.isBrave==l&&(U[S]="Brave"),U},this.getCPU=function(){var U={};return U[K]=o,X.call(U,fe,oe.cpu),U},this.getDevice=function(){var U={};return U[N]=o,U[w]=o,U[g]=o,X.call(U,fe,oe.device),H&&!U[g]&&j&&j.mobile&&(U[g]=G),H&&U[w]=="Macintosh"&&ee&&typeof ee.standalone!==d&&ee.maxTouchPoints&&ee.maxTouchPoints>2&&(U[w]="iPad",U[g]=ne),U},this.getEngine=function(){var U={};return U[S]=o,U[L]=o,X.call(U,fe,oe.engine),U},this.getOS=function(){var U={};return U[S]=o,U[L]=o,X.call(U,fe,oe.os),H&&!U[S]&&j&&j.platform&&j.platform!="Unknown"&&(U[S]=j.platform.replace(/chrome os/i,Fe).replace(/macos/i,Ae)),U},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 fe},this.setUA=function(U){return fe=typeof U===I&&U.length>c?te(U,c):U,this},this.setUA(fe),this};_.VERSION=s,_.BROWSER=ht([S,L,M]),_.CPU=ht([K]),_.DEVICE=ht([w,N,g,B,G,he,ne,ye,Ne]),_.ENGINE=_.OS=ht([S,L]),e.exports&&(t=e.exports=_),t.UAParser=_;var D=typeof n!==d&&(n.jQuery||n.Zepto);if(D&&!D.ua){var Y=new _;D.ua=Y.getResult(),D.ua.get=function(){return Y.getUA()},D.ua.set=function(Q){Y.setUA(Q);var J=Y.getResult();for(var ee in J)D.ua[ee]=J[ee]}}})(typeof window=="object"?window:oc)})(on,on.exports)),on.exports}var ks;function ac(){if(ks)return ae;ks=1,Object.defineProperty(ae,"__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,a=s.getBrowser(),r=s.getCPU(),l=s.getDevice(),d=s.getEngine(),E=s.getOS(),I=s.getUA(),M=function(f){return s.setUA(f)},w=function(f){if(!f){console.error("No userAgent string was provided");return}var p=new o(f);return{UA:p,browser:p.getBrowser(),cpu:p.getCPU(),device:p.getDevice(),engine:p.getEngine(),os:p.getOS(),ua:p.getUA(),setUserAgent:function(R){return p.setUA(R)}}},S=Object.freeze({ClientUAInstance:s,browser:a,cpu:r,device:l,engine:d,os:E,ua:I,setUa:M,parseUserAgent:w});function g(x,f){var p=Object.keys(x);if(Object.getOwnPropertySymbols){var P=Object.getOwnPropertySymbols(x);f&&(P=P.filter(function(R){return Object.getOwnPropertyDescriptor(x,R).enumerable})),p.push.apply(p,P)}return p}function N(x){for(var f=1;f<arguments.length;f++){var p=arguments[f]!=null?arguments[f]:{};f%2?g(Object(p),!0).forEach(function(P){ne(x,P,p[P])}):Object.getOwnPropertyDescriptors?Object.defineProperties(x,Object.getOwnPropertyDescriptors(p)):g(Object(p)).forEach(function(P){Object.defineProperty(x,P,Object.getOwnPropertyDescriptor(p,P))})}return x}function L(x){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?L=function(f){return typeof f}:L=function(f){return f&&typeof Symbol=="function"&&f.constructor===Symbol&&f!==Symbol.prototype?"symbol":typeof f},L(x)}function K(x,f){if(!(x instanceof f))throw new TypeError("Cannot call a class as a function")}function B(x,f){for(var p=0;p<f.length;p++){var P=f[p];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(x,P.key,P)}}function G(x,f,p){return f&&B(x.prototype,f),x}function ne(x,f,p){return f in x?Object.defineProperty(x,f,{value:p,enumerable:!0,configurable:!0,writable:!0}):x[f]=p,x}function he(){return he=Object.assign||function(x){for(var f=1;f<arguments.length;f++){var p=arguments[f];for(var P in p)Object.prototype.hasOwnProperty.call(p,P)&&(x[P]=p[P])}return x},he.apply(this,arguments)}function ye(x,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function");x.prototype=Object.create(f&&f.prototype,{constructor:{value:x,writable:!0,configurable:!0}}),f&&c(x,f)}function Ne(x){return Ne=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},Ne(x)}function c(x,f){return c=Object.setPrototypeOf||function(P,R){return P.__proto__=R,P},c(x,f)}function u(x,f){if(x==null)return{};var p={},P=Object.keys(x),R,ve;for(ve=0;ve<P.length;ve++)R=P[ve],!(f.indexOf(R)>=0)&&(p[R]=x[R]);return p}function i(x,f){if(x==null)return{};var p=u(x,f),P,R;if(Object.getOwnPropertySymbols){var ve=Object.getOwnPropertySymbols(x);for(R=0;R<ve.length;R++)P=ve[R],!(f.indexOf(P)>=0)&&Object.prototype.propertyIsEnumerable.call(x,P)&&(p[P]=x[P])}return p}function m(x){if(x===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x}function h(x,f){if(f&&(typeof f=="object"||typeof f=="function"))return f;if(f!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return m(x)}function y(x,f){return v(x)||b(x,f)||A(x,f)||T()}function v(x){if(Array.isArray(x))return x}function b(x,f){var p=x==null?null:typeof Symbol<"u"&&x[Symbol.iterator]||x["@@iterator"];if(p!=null){var P=[],R=!0,ve=!1,Le,qe;try{for(p=p.call(x);!(R=(Le=p.next()).done)&&(P.push(Le.value),!(f&&P.length===f));R=!0);}catch(Tn){ve=!0,qe=Tn}finally{try{!R&&p.return!=null&&p.return()}finally{if(ve)throw qe}}return P}}function A(x,f){if(x){if(typeof x=="string")return k(x,f);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 k(x,f)}}function k(x,f){(f==null||f>x.length)&&(f=x.length);for(var p=0,P=new Array(f);p<f;p++)P[p]=x[p];return P}function T(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
385
|
-
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},V={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"},be={isMobile:!1,isTablet:!1,isBrowser:!1,isSmartTV:!1,isConsole:!1,isWearable:!1},ke=function(f){switch(f){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 be}},xe=function(f){return M(f)},z=function(f){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"none";return f||p},ge=function(){return typeof window<"u"&&(window.navigator||navigator)?window.navigator||navigator:!1},Se=function(f){var p=ge();return p&&p.platform&&(p.platform.indexOf(f)!==-1||p.platform==="MacIntel"&&p.maxTouchPoints>1&&!window.MSStream)},He=function(f,p,P,R,ve){return{isBrowser:f,browserMajorVersion:z(p.major),browserFullVersion:z(p.version),browserName:z(p.name),engineName:z(P.name),engineVersion:z(P.version),osName:z(R.name),osVersion:z(R.version),userAgent:z(ve)}},st=function(f,p,P,R){return N({},f,{vendor:z(p.vendor),model:z(p.model),os:z(P.name),osVersion:z(P.version),ua:z(R)})},je=function(f,p,P,R){return{isSmartTV:f,engineName:z(p.name),engineVersion:z(p.version),osName:z(P.name),osVersion:z(P.version),userAgent:z(R)}},Pe=function(f,p,P,R){return{isConsole:f,engineName:z(p.name),engineVersion:z(p.version),osName:z(P.name),osVersion:z(P.version),userAgent:z(R)}},ze=function(f,p,P,R){return{isWearable:f,engineName:z(p.name),engineVersion:z(p.version),osName:z(P.name),osVersion:z(P.version),userAgent:z(R)}},Me=function(f,p,P,R,ve){return{isEmbedded:f,vendor:z(p.vendor),model:z(p.model),engineName:z(P.name),engineVersion:z(P.version),osName:z(R.name),osVersion:z(R.version),userAgent:z(ve)}};function Fe(x){var f=x?w(x):S,p=f.device,P=f.browser,R=f.engine,ve=f.os,Le=f.ua,qe=ke(p.type),Tn=qe.isBrowser,ol=qe.isMobile,sl=qe.isTablet,Ds=qe.isSmartTV,Us=qe.isConsole,Os=qe.isWearable,Ls=qe.isEmbedded;if(Tn)return He(Tn,P,R,ve,Le);if(Ds)return je(Ds,R,ve,Le);if(Us)return Pe(Us,R,ve,Le);if(ol||sl)return st(qe,p,ve,Le);if(Os)return ze(Os,R,ve,Le);if(Ls)return Me(Ls,p,R,ve,Le)}var Ae=function(f){var p=f.type;return p===F.Mobile},It=function(f){var p=f.type;return p===F.Tablet},Wt=function(f){var p=f.type;return p===F.Mobile||p===F.Tablet},ht=function(f){var p=f.type;return p===F.SmartTv},O=function(f){var p=f.type;return p===F.Browser},Z=function(f){var p=f.type;return p===F.Wearable},$=function(f){var p=f.type;return p===F.Console},te=function(f){var p=f.type;return p===F.Embedded},X=function(f){var p=f.vendor;return z(p)},W=function(f){var p=f.model;return z(p)},q=function(f){var p=f.type;return z(p,"browser")},ie=function(f){var p=f.name;return p===re.Android},me=function(f){var p=f.name;return p===re.Windows},_=function(f){var p=f.name;return p===re.MAC_OS},D=function(f){var p=f.name;return p===re.WindowsPhone},Y=function(f){var p=f.name;return p===re.IOS},Q=function(f){var p=f.version;return z(p)},J=function(f){var p=f.name;return z(p)},ee=function(f){var p=f.name;return p===V.Chrome},fe=function(f){var p=f.name;return p===V.Firefox},j=function(f){var p=f.name;return p===V.Chromium},oe=function(f){var p=f.name;return p===V.Edge},H=function(f){var p=f.name;return p===V.Yandex},U=function(f){var p=f.name;return p===V.Safari||p===V.MobileSafari},ce=function(f){var p=f.name;return p===V.MobileSafari},Ee=function(f){var p=f.name;return p===V.Opera},ue=function(f){var p=f.name;return p===V.InternetExplorer||p===V.Ie},Te=function(f){var p=f.name;return p===V.MIUI},Be=function(f){var p=f.name;return p===V.SamsungBrowser},Ie=function(f){var p=f.version;return z(p)},De=function(f){var p=f.major;return z(p)},Je=function(f){var p=f.name;return z(p)},tt=function(f){var p=f.name;return z(p)},ct=function(f){var p=f.version;return z(p)},Pt=function(){var f=ge(),p=f&&f.userAgent&&f.userAgent.toLowerCase();return typeof p=="string"?/electron/.test(p):!1},at=function(f){return typeof f=="string"&&f.indexOf("Edg/")!==-1},sn=function(){var f=ge();return f&&(/iPad|iPhone|iPod/.test(f.platform)||f.platform==="MacIntel"&&f.maxTouchPoints>1)&&!window.MSStream},Xe=function(){return Se("iPad")},Vt=function(){return Se("iPhone")},Oe=function(){return Se("iPod")},vn=function(f){return z(f)};function kn(x){var f=x||S,p=f.device,P=f.browser,R=f.os,ve=f.engine,Le=f.ua;return{isSmartTV:ht(p),isConsole:$(p),isWearable:Z(p),isEmbedded:te(p),isMobileSafari:ce(P)||Xe(),isChromium:j(P),isMobile:Wt(p)||Xe(),isMobileOnly:Ae(p),isTablet:It(p)||Xe(),isBrowser:O(p),isDesktop:O(p),isAndroid:ie(R),isWinPhone:D(R),isIOS:Y(R)||Xe(),isChrome:ee(P),isFirefox:fe(P),isSafari:U(P),isOpera:Ee(P),isIE:ue(P),osVersion:Q(R),osName:J(R),fullBrowserVersion:Ie(P),browserVersion:De(P),browserName:Je(P),mobileVendor:X(p),mobileModel:W(p),engineName:tt(ve),engineVersion:ct(ve),getUA:vn(Le),isEdge:oe(P)||at(Le),isYandex:H(P),deviceType:q(p),isIOS13:sn(),isIPad13:Xe(),isIPhone13:Vt(),isIPod13:Oe(),isElectron:Pt(),isEdgeChromium:at(Le),isLegacyEdge:oe(P)&&!at(Le),isWindows:me(R),isMacOs:_(R),isMIUI:Te(P),isSamsungBrowser:Be(P)}}var As=ht(l),Ts=$(l),xs=Z(l),lc=te(l),dc=ce(a)||Xe(),uc=j(a),An=Wt(l)||Xe(),Ss=Ae(l),Es=It(l)||Xe(),Ns=O(l),fc=O(l),Bs=ie(E),Cs=D(E),Is=Y(E)||Xe(),pc=ee(a),mc=fe(a),hc=U(a),bc=Ee(a),Ps=ue(a),wc=Q(E),gc=J(E),yc=Ie(a),vc=De(a),kc=Je(a),Ac=X(l),Tc=W(l),xc=tt(d),Sc=ct(d),Ec=vn(I),Nc=oe(a)||at(I),Bc=H(a),Cc=q(l),Ic=sn(),Pc=Xe(),Fc=Vt(),Dc=Oe(),Uc=Pt(),Oc=at(I),Lc=oe(a)&&!at(I),Mc=me(E),_c=_(E),Rc=Te(a),$c=Be(a),Hc=function(f){if(!f||typeof f!="string"){console.error("No valid user agent string was provided");return}var p=w(f),P=p.device,R=p.browser,ve=p.os,Le=p.engine,qe=p.ua;return kn({device:P,browser:R,os:ve,engine:Le,ua:qe})},Wc=function(f){var p=f.renderWithFragment,P=f.children,R=i(f,["renderWithFragment","children"]);return Bs?p?n.createElement(t.Fragment,null,P):n.createElement("div",R,P):null},Vc=function(f){var p=f.renderWithFragment,P=f.children,R=i(f,["renderWithFragment","children"]);return Ns?p?n.createElement(t.Fragment,null,P):n.createElement("div",R,P):null},Gc=function(f){var p=f.renderWithFragment,P=f.children,R=i(f,["renderWithFragment","children"]);return Ps?p?n.createElement(t.Fragment,null,P):n.createElement("div",R,P):null},zc=function(f){var p=f.renderWithFragment,P=f.children,R=i(f,["renderWithFragment","children"]);return Is?p?n.createElement(t.Fragment,null,P):n.createElement("div",R,P):null},qc=function(f){var p=f.renderWithFragment,P=f.children,R=i(f,["renderWithFragment","children"]);return An?p?n.createElement(t.Fragment,null,P):n.createElement("div",R,P):null},Yc=function(f){var p=f.renderWithFragment,P=f.children,R=i(f,["renderWithFragment","children"]);return Es?p?n.createElement(t.Fragment,null,P):n.createElement("div",R,P):null},jc=function(f){var p=f.renderWithFragment,P=f.children,R=i(f,["renderWithFragment","children"]);return Cs?p?n.createElement(t.Fragment,null,P):n.createElement("div",R,P):null},Jc=function(f){var p=f.renderWithFragment,P=f.children;f.viewClassName,f.style;var R=i(f,["renderWithFragment","children","viewClassName","style"]);return Ss?p?n.createElement(t.Fragment,null,P):n.createElement("div",R,P):null},Xc=function(f){var p=f.renderWithFragment,P=f.children,R=i(f,["renderWithFragment","children"]);return As?p?n.createElement(t.Fragment,null,P):n.createElement("div",R,P):null},Kc=function(f){var p=f.renderWithFragment,P=f.children,R=i(f,["renderWithFragment","children"]);return Ts?p?n.createElement(t.Fragment,null,P):n.createElement("div",R,P):null},Zc=function(f){var p=f.renderWithFragment,P=f.children,R=i(f,["renderWithFragment","children"]);return xs?p?n.createElement(t.Fragment,null,P):n.createElement("div",R,P):null},Qc=function(f){var p=f.renderWithFragment,P=f.children;f.viewClassName,f.style;var R=f.condition,ve=i(f,["renderWithFragment","children","viewClassName","style","condition"]);return R?p?n.createElement(t.Fragment,null,P):n.createElement("div",ve,P):null};function el(x){return(function(f){ye(p,f);function p(P){var R;return K(this,p),R=h(this,Ne(p).call(this,P)),R.isEventListenerAdded=!1,R.handleOrientationChange=R.handleOrientationChange.bind(m(R)),R.onOrientationChange=R.onOrientationChange.bind(m(R)),R.onPageLoad=R.onPageLoad.bind(m(R)),R.state={isLandscape:!1,isPortrait:!1},R}return G(p,[{key:"handleOrientationChange",value:function(){this.isEventListenerAdded||(this.isEventListenerAdded=!0);var R=window.innerWidth>window.innerHeight?90:0;this.setState({isPortrait:R===0,isLandscape:R===90})}},{key:"onOrientationChange",value:function(){this.handleOrientationChange()}},{key:"onPageLoad",value:function(){this.handleOrientationChange()}},{key:"componentDidMount",value:function(){(typeof window>"u"?"undefined":L(window))!==void 0&&An&&(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"}}),f=y(x,2),p=f[0],P=f[1],R=t.useCallback(function(){var ve=window.innerWidth>window.innerHeight?90:0,Le={isPortrait:ve===0,isLandscape:ve===90,orientation:ve===0?"portrait":"landscape"};p.orientation!==Le.orientation&&P(Le)},[p.orientation]);return t.useEffect(function(){return(typeof window>"u"?"undefined":L(window))!==void 0&&An&&(R(),window.addEventListener("load",R,!1),window.addEventListener("resize",R,!1)),function(){window.removeEventListener("resize",R,!1),window.removeEventListener("load",R,!1)}},[R]),p}function Fs(x){var f=x||window.navigator.userAgent;return w(f)}function nl(x){var f=x||window.navigator.userAgent,p=Fs(f),P=kn(p);return[P,p]}return ae.AndroidView=Wc,ae.BrowserTypes=V,ae.BrowserView=Vc,ae.ConsoleView=Kc,ae.CustomView=Qc,ae.IEView=Gc,ae.IOSView=zc,ae.MobileOnlyView=Jc,ae.MobileView=qc,ae.OsTypes=re,ae.SmartTVView=Xc,ae.TabletView=Yc,ae.WearableView=Zc,ae.WinPhoneView=jc,ae.browserName=kc,ae.browserVersion=vc,ae.deviceDetect=Fe,ae.deviceType=Cc,ae.engineName=xc,ae.engineVersion=Sc,ae.fullBrowserVersion=yc,ae.getSelectorsByUserAgent=Hc,ae.getUA=Ec,ae.isAndroid=Bs,ae.isBrowser=Ns,ae.isChrome=pc,ae.isChromium=uc,ae.isConsole=Ts,ae.isDesktop=fc,ae.isEdge=Nc,ae.isEdgeChromium=Oc,ae.isElectron=Uc,ae.isEmbedded=lc,ae.isFirefox=mc,ae.isIE=Ps,ae.isIOS=Is,ae.isIOS13=Ic,ae.isIPad13=Pc,ae.isIPhone13=Fc,ae.isIPod13=Dc,ae.isLegacyEdge=Lc,ae.isMIUI=Rc,ae.isMacOs=_c,ae.isMobile=An,ae.isMobileOnly=Ss,ae.isMobileSafari=dc,ae.isOpera=bc,ae.isSafari=hc,ae.isSamsungBrowser=$c,ae.isSmartTV=As,ae.isTablet=Es,ae.isWearable=xs,ae.isWinPhone=Cs,ae.isWindows=Mc,ae.isYandex=Bc,ae.mobileModel=Tc,ae.mobileVendor=Ac,ae.osName=gc,ae.osVersion=wc,ae.parseUserAgent=w,ae.setUserAgent=xe,ae.useDeviceData=Fs,ae.useDeviceSelectors=nl,ae.useMobileOrientation=tl,ae.withOrientationChange=el,ae}var Ht=ac();function lo(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 rc=({isOpen:e,onClose:t,onTransaction:n,position:o="bottom-right",modalChatStyle:s={}})=>{const{t:a,ti:r}=xn(),{messages:l,addMessage:d,updateMessageAction:E,updateMessageText:I}=Ei(),[M,w]=se.useState(""),[S,g]=se.useState(!1),[N,L]=se.useState(!0),[K,B]=se.useState(null),G=se.useRef(null),ne=se.useRef(null),he=se.useRef(null),ye=se.useRef(null),Ne=se.useRef(null),c=se.useRef(!1),u=se.useRef(N);se.useEffect(()=>{u.current=N},[N]);const{account:i,chainData:m,chainType:h,chainTypeMoralis:y,chainId:v,isChainSupported:b}=Zn(),{config:A}=Ni(),k=v&&A?.rpcUrls?.[v]||void 0,T=se.useCallback(()=>{const O=Bt.getItem("dataBuyToken");if(O)try{return JSON.parse(O)}catch{return{srcTokenAddress:"",descTokenAddress:"",amount:"",srcTokenDecimals:18,descTokenDecimals:18}}return{srcTokenAddress:"",descTokenAddress:"",amount:"",srcTokenDecimals:18,descTokenDecimals:18}},[]),F=se.useCallback(O=>{Bt.setItem("dataBuyToken",JSON.stringify(O))},[]),V=se.useCallback(O=>{const $={...T(),...O};F($)},[T,F]),re=se.useCallback(O=>{B(O),Ht.isDesktop&&he.current?.focus()},[]),be=se.useCallback(async(O,Z)=>{V({descTokenAddress:O,descTokenDecimals:Z||18});try{g(!0);const $=await Ye({address:i?.address||"",chain:y});if($?.success&&$?.data?.result){const te=$.data.result;if(te?.length>0){const X=te.map(W=>({id:W.token_address,text:`${W.name}: ${W.balance_formatted} ${W.symbol} ($${le(W.usd_value||0)?.decimalPlaces(2).toFormat()||"0"})`,value:r("buttonBuyWith",{symbol:W.symbol}),action:"click_balance_item_user_to_buy_button",fullWidth:!0,extraData:{tokenAddress:W.token_address,symbol:W.symbol,balance:W.balance_formatted,usdValue:W.usd_value,decimals:W.decimals}}));d(r("walletBalanceSpendable",{chain:m?.name||"unknown"}),"bot",void 0,X)}else d(r("walletNoTokensFound",{chain:m?.name||"unknown"}),"bot")}else d(a("walletFetchFailed"),"bot")}catch($){console.error("Error fetching wallet balance:",$),d(a("walletFetchError"),"bot")}finally{g(!1)}},[V,i?.address,y,d,m?.name,a,r]),ke=se.useCallback(async(O,Z,$,te)=>{const X=[25,50,75,100];V({srcTokenAddress:O,srcTokenDecimals:te||18});let W=$||"0";if(O===Ve)try{const ie=await co({chainId:v,rpcUrl:k});if(ie.isGreaterThan(0)){const me=ie.times(1e6),D=new le(pt($,te||18).toString()).minus(me);D.isGreaterThan(0)?W=le(Ue(BigInt(D.toFixed(0)),18)).toFixed():W="0"}}catch(ie){console.warn("getGasPrice for swap native fee deduction failed:",ie)}const q=X.map(ie=>({id:`percent-${ie}`,text:`${ie}%`,value:r("buttonUsePercent",{percent:String(ie),symbol:Z}),action:"select_percent",extraData:{percent:ie,tokenAddress:O,tokenSymbol:Z,tokenBalance:W}}));if(le(W).isZero()){d(r("insufficientFeeToken",{symbol:Z}),"bot");return}d(r("selectAmountOf",{symbol:Z,balance:W}),"bot",void 0,q)},[d,v,k,V,r]),xe=se.useCallback(async(O,Z)=>{V({amount:(parseFloat(Z)*(O/100)).toFixed(6)});const $=T(),te=pt($.amount,$.srcTokenDecimals||18).toString(),X=await so({chainId:v,tokenIn:$.srcTokenAddress,tokenInAmount:te,tokenOut:$.descTokenAddress,tokenOutRecipient:i?.address||"",slippage:"auto",accesstoken:"d6c45897b8f6"});if(X.success&&X.data){const W=X.data,q=W.tokenIn,ie=W.tokenOut,me=le(Ue(BigInt(q.amount||0),q.decimals)).decimalPlaces(6).toFormat(),_=le(Ue(BigInt(ie.amount||0),ie.decimals)).decimalPlaces(6).toFormat(),D=$.srcTokenAddress===Ve||$.srcTokenAddress==="";let Y=!1;if(!D&&i?.address&&W.tx?.to)try{const U=await io({tokenAddress:$.srcTokenAddress,ownerAddress:i.address,spenderAddress:W.tx.to,chainId:v,rpcUrl:k});Y=le(U.toString()).isLessThan(te)}catch(U){console.warn("Allowance check failed:",U),Y=!0}const Q=W.estimatedTransactionFee?.total?le(W.estimatedTransactionFee.total):le(0);let J=le(0);if(Y&&i?.address)try{const U=gn({tokenAddress:$.srcTokenAddress,spenderAddress:W.tx?.to||"",fromAddress:i.address,chainId:v});J=await nn({from:i.address,to:U.to,data:U.data,chainId:v,rpcUrl:k})}catch(U){console.warn("Approve fee estimation failed:",U)}const ee=Q.plus(J),fe=m?.nativeCurrency?.symbol||"native";let j="",oe=!1;if(i?.address&&ee.isGreaterThan(0))try{const U=await yn({address:i.address,chainId:v,rpcUrl:k});if(U.isLessThan(ee)){oe=!0;const ce=le(Ue(BigInt(U.toFixed(0)),18)).decimalPlaces(6).toFormat(),Ee=le(Ue(BigInt(ee.toFixed(0)),18)).decimalPlaces(6).toFormat();j=r("swapFeeWarning",{symbol:fe,balance:ce,needed:Ee})}}catch(U){console.warn("Fee balance check failed:",U)}const H=`From: ${me} ${q.symbol}
|
|
395
|
+
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"}}`}const As={1:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",10:"0x4200000000000000000000000000000000000006",56:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",137:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",8453:"0x4200000000000000000000000000000000000006",42161:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"},yn=[{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"}]}],Ts=[{name:"deposit",type:"function",stateMutability:"payable",inputs:[],outputs:[]},{name:"withdraw",type:"function",stateMutability:"nonpayable",inputs:[{name:"wad",type:"uint256"}],outputs:[]}],Ji=[{name:"safeTransferFrom",type:"function",stateMutability:"nonpayable",inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"tokenId",type:"uint256"}],outputs:[]}],Xi=[{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 on(e,t){return t||lt[e]?.rpcUrls?.default?.http?.[0]}function Ki(e){const{action:t,parameters:n,fromAddress:o,chainId:s}=e;switch(t){case"send_native":return Zi(n,o,s);case"send_token":return Qi(n,o,s);case"approve_token":return ec(n,o,s);case"wrap_native":return tc(n,o,s);case"unwrap_native":return nc(n,o,s);case"send_nft":return sc(n,o,s);default:throw new Error(`Action "${t}" does not produce a transaction`)}}function Zi(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 a=mt(s,18).toString();return{from:t,to:o,data:"0x",value:a,chainId:n,description:`Send ${s} native token to ${o}`}}function Qi(e,t,n){const{contract_address:o,to_address:s,amount:a,decimals:r,token_symbol:l}=e;if(!o)throw new Error("Token contract address is required");if(!s)throw new Error("Recipient address is required");if(!a)throw new Error("Amount is required");const d=parseInt(r)||18,T=mt(a,d),C=kt({abi:yn,functionName:"transfer",args:[s,T]});return{from:t,to:o,data:C,value:"0",chainId:n,description:`Send ${a} ${l||"tokens"} to ${s}`}}function ec(e,t,n){const{contract_address:o,spender_address:s,amount:a,token_symbol:r}=e;if(!o)throw new Error("Token contract address is required");if(!s)throw new Error("Spender address is required");const l=a&&a?.trim()!==""?mt(a,18):Mt,d=kt({abi:yn,functionName:"approve",args:[s,l]});return{from:t,to:o,data:d,value:"0",chainId:n,description:`Approve ${a||"unlimited"} ${r||"tokens"} for ${s}`}}function tc(e,t,n){const{amount:o}=e;if(!o)throw new Error("Amount is required");const s=As[n];if(!s)throw new Error(`WETH not supported on chain ${n}`);const a=mt(o,18).toString(),r=kt({abi:Ts,functionName:"deposit"});return{from:t,to:s,data:r,value:a,chainId:n,description:`Wrap ${o} native token`}}function nc(e,t,n){const{amount:o}=e;if(!o)throw new Error("Amount is required");const s=As[n];if(!s)throw new Error(`WETH not supported on chain ${n}`);const a=mt(o,18),r=kt({abi:Ts,functionName:"withdraw",args:[a]});return{from:t,to:s,data:r,value:"0",chainId:n,description:`Unwrap ${o} WETH`}}function oc(e){return["send_native","send_token","approve_token","wrap_native","unwrap_native","send_nft"].includes(e)}async function co(e){const{transactionHash:t,chainId:n,pollingInterval:o=3e3,timeout:s=12e4,rpcUrl:a}=e,r=on(n,a);if(!r)throw new Error(`No RPC endpoint for chain ${n}`);const l=Date.now();for(;Date.now()-l<s;){try{const T=await(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_getTransactionReceipt",params:[t]})})).json();if(T.result){const C=T.result;return{status:C.status==="0x1"?"success":"fail",blockNumber:C.blockNumber,gasUsed:C.gasUsed,effectiveGasPrice:C.effectiveGasPrice}}}catch(d){console.warn("eth_getTransactionReceipt poll error:",d)}await new Promise(d=>setTimeout(d,o))}throw new Error(`Transaction ${t} was not mined within ${s/1e3}s`)}async function lo(e){const{tokenAddress:t,ownerAddress:n,spenderAddress:o,chainId:s,rpcUrl:a}=e,r=on(s,a);if(!r)return console.warn(`No RPC endpoint for chain ${s}, assuming no allowance`),BigInt(0);try{const l=kt({abi:yn,functionName:"allowance",args:[n,o]}),T=await(await fetch(r,{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 T.result&&T.result!=="0x"?BigInt(T.result):BigInt(0)}catch(l){return console.warn("checkAllowance failed:",l),BigInt(0)}}function vn(e){const{tokenAddress:t,spenderAddress:n,fromAddress:o,chainId:s,tokenSymbol:a}=e,r=kt({abi:yn,functionName:"approve",args:[n,Mt]});return{from:o,to:t,data:r,value:"0",chainId:s,description:`Approve ${a||"token"} for swap`}}function sc(e,t,n){const{contract_address:o,token_id:s,to_address:a,token_standard:r,amount:l,nft_name:d}=e;if(!o)throw new Error("NFT contract address is required");if(!s)throw new Error("Token ID is required");if(!a)throw new Error("Recipient address is required");const T=(r||"ERC721").toUpperCase(),C=BigInt(s);let M,h;if(T==="ERC1155"){const x=BigInt(l||"1");M=kt({abi:Xi,functionName:"safeTransferFrom",args:[t,a,C,x,"0x"]}),h=`Send ${x>1n?x.toString()+"x ":""}${d||"NFT"} (ERC1155 #${s}) to ${a}`}else M=kt({abi:Ji,functionName:"safeTransferFrom",args:[t,a,C]}),h=`Send ${d||"NFT"} (ERC721 #${s}) to ${a}`;return{from:t,to:o,data:M,value:"0",chainId:n,description:h}}async function kn(e){const{address:t,chainId:n,rpcUrl:o}=e,s=on(n,o);if(!s)return console.warn(`No RPC endpoint for chain ${n}`),new ce(0);try{const r=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 r.result&&r.result!=="0x"?new ce(BigInt(r.result).toString()):new ce(0)}catch(a){return console.warn("getNativeBalance failed:",a),new ce(0)}}async function sn(e){const{from:t,to:n,data:o,value:s,chainId:a,rpcUrl:r}=e,l=on(a,r);if(!l)return console.warn(`No RPC endpoint for chain ${a}`),new ce(0);try{const[d,T]=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:[]})})]),[C,M]=await Promise.all([d.json(),T.json()]),h=C.result?new ce(BigInt(C.result).toString()):new ce(0),x=M.result?new ce(BigInt(M.result).toString()):new ce(0);return h.times(x).times(1.1)}catch(d){return console.warn("estimateTransactionFee failed:",d),new ce(0)}}async function uo(e){const{chainId:t,rpcUrl:n}=e,o=on(t,n);if(!o)return console.warn(`No RPC endpoint for chain ${t}`),new ce(0);try{const a=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 a.result&&a.result!=="0x"?new ce(BigInt(a.result).toString()):new ce(0)}catch(s){return console.warn("getGasPrice failed:",s),new ce(0)}}var oe={},an={exports:{}},ac=an.exports,xs;function rc(){return xs||(xs=1,(function(e,t){(function(n,o){var s="1.0.41",a="",r="?",l="function",d="undefined",T="object",C="string",M="major",h="model",x="name",m="type",B="vendor",L="version",ke="architecture",N="console",V="mobile",X="tablet",fe="smarttv",pe="wearable",Ce="embedded",c=500,u="Amazon",i="Apple",b="ASUS",g="BlackBerry",y="Browser",v="Chrome",w="Edge",A="Firefox",k="Google",S="Honor",D="Huawei",z="Lenovo",se="LG",me="Microsoft",Ae="Motorola",Se="Nvidia",j="OnePlus",be="Opera",xe="OPPO",We="Samsung",at="Sharp",Je="Sony",Fe="Xiaomi",qe="Zebra",Me="Facebook",De="Chromium OS",Te="Mac OS",Pt=" Browser",Vt=function(O,Q){var H={};for(var te in O)Q[te]&&Q[te].length%2===0?H[te]=Q[te].concat(O[te]):H[te]=O[te];return H},bt=function(O){for(var Q={},H=0;H<O.length;H++)Q[O[H].toUpperCase()]=O[H];return Q},U=function(O,Q){return typeof O===C?Z(Q).indexOf(Z(O))!==-1:!1},Z=function(O){return O.toLowerCase()},G=function(O){return typeof O===C?O.replace(/[^\d\.]/g,a).split(".")[0]:o},ee=function(O,Q){if(typeof O===C)return O=O.replace(/^\s\s*/,a),typeof Q===d?O:O.substring(0,c)},K=function(O,Q){for(var H=0,te,we,ae,R,_,$;H<Q.length&&!_;){var ge=Q[H],Be=Q[H+1];for(te=we=0;te<ge.length&&!_&&ge[te];)if(_=ge[te++].exec(O),_)for(ae=0;ae<Be.length;ae++)$=_[++we],R=Be[ae],typeof R===T&&R.length>0?R.length===2?typeof R[1]==l?this[R[0]]=R[1].call(this,$):this[R[0]]=R[1]:R.length===3?typeof R[1]===l&&!(R[1].exec&&R[1].test)?this[R[0]]=$?R[1].call(this,$,R[2]):o:this[R[0]]=$?$.replace(R[1],R[2]):o:R.length===4&&(this[R[0]]=$?R[3].call(this,$.replace(R[1],R[2])):o):this[R]=$||o;H+=2}},q=function(O,Q){for(var H in Q)if(typeof Q[H]===T&&Q[H].length>0){for(var te=0;te<Q[H].length;te++)if(U(Q[H][te],O))return H===r?o:H}else if(U(Q[H],O))return H===r?o:H;return Q.hasOwnProperty("*")?Q["*"]:O},Y={"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},ie={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"},ye={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[L,[x,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[L,[x,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[x,L],[/opios[\/ ]+([\w\.]+)/i],[L,[x,be+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[L,[x,be+" GX"]],[/\bopr\/([\w\.]+)/i],[L,[x,be]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[L,[x,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[L,[x,"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],[x,L],[/quark(?:pc)?\/([-\w\.]+)/i],[L,[x,"Quark"]],[/\bddg\/([\w\.]+)/i],[L,[x,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[L,[x,"UC"+y]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[L,[x,"WeChat"]],[/konqueror\/([\w\.]+)/i],[L,[x,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[L,[x,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[L,[x,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[L,[x,"Smart Lenovo "+y]],[/(avast|avg)\/([\w\.]+)/i],[[x,/(.+)/,"$1 Secure "+y],L],[/\bfocus\/([\w\.]+)/i],[L,[x,A+" Focus"]],[/\bopt\/([\w\.]+)/i],[L,[x,be+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[L,[x,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[L,[x,"Dolphin"]],[/coast\/([\w\.]+)/i],[L,[x,be+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[L,[x,"MIUI"+Pt]],[/fxios\/([\w\.-]+)/i],[L,[x,A]],[/\bqihoobrowser\/?([\w\.]*)/i],[L,[x,"360"]],[/\b(qq)\/([\w\.]+)/i],[[x,/(.+)/,"$1Browser"],L],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[x,/(.+)/,"$1"+Pt],L],[/samsungbrowser\/([\w\.]+)/i],[L,[x,We+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[L,[x,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[x,"Sogou Mobile"],L],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[x,L],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[x],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[L,x],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[x,Me],L],[/(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],[x,L],[/\bgsa\/([\w\.]+) .*safari\//i],[L,[x,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[L,[x,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[L,[x,v+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[x,v+" WebView"],L],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[L,[x,"Android "+y]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[x,L],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[L,[x,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[L,x],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[x,[L,q,Y]],[/(webkit|khtml)\/([\w\.]+)/i],[x,L],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[x,"Netscape"],L],[/(wolvic|librewolf)\/([\w\.]+)/i],[x,L],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[L,[x,A+" 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],[x,[L,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[x,[L,/master.|lts./,""]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[ke,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[ke,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[ke,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[ke,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[ke,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[ke,/ower/,a,Z]],[/ sun4\w[;\)]/i],[[ke,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[ke,Z]]],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],[h,[B,We],[m,X]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[h,[B,We],[m,V]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[h,[B,i],[m,V]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[h,[B,i],[m,X]],[/(macintosh);/i],[h,[B,i]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[h,[B,at],[m,V]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[h,[B,S],[m,X]],[/honor([-\w ]+)[;\)]/i],[h,[B,S],[m,V]],[/\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],[h,[B,D],[m,X]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[h,[B,D],[m,V]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[h,/_/g," "],[B,Fe],[m,X]],[/\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],[[h,/_/g," "],[B,Fe],[m,V]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[h,[B,xe],[m,V]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[h,[B,q,{OnePlus:["304","403","203"],"*":xe}],[m,X]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[h,[B,"Vivo"],[m,V]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[h,[B,"Realme"],[m,V]],[/\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],[h,[B,Ae],[m,V]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[h,[B,Ae],[m,X]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[h,[B,se],[m,X]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv|watch)\w+)/i,/\blg-?([\d\w]+) bui/i],[h,[B,se],[m,V]],[/(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],[h,[B,z],[m,X]],[/(nokia) (t[12][01])/i],[B,h,[m,X]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[h,/_/g," "],[m,V],[B,"Nokia"]],[/(pixel (c|tablet))\b/i],[h,[B,k],[m,X]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[h,[B,k],[m,V]],[/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],[h,[B,Je],[m,V]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[h,"Xperia Tablet"],[B,Je],[m,X]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[h,[B,j],[m,V]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[h,[B,u],[m,X]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[h,/(.+)/g,"Fire Phone $1"],[B,u],[m,V]],[/(playbook);[-\w\),; ]+(rim)/i],[h,B,[m,X]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[h,[B,g],[m,V]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[h,[B,b],[m,X]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[h,[B,b],[m,V]],[/(nexus 9)/i],[h,[B,"HTC"],[m,X]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[B,[h,/_/g," "],[m,V]],[/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],[h,[B,"TCL"],[m,X]],[/(itel) ((\w+))/i],[[B,Z],h,[m,q,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[h,[B,"Acer"],[m,X]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[h,[B,"Meizu"],[m,V]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[h,[B,"Ulefone"],[m,V]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[h,[B,"Energizer"],[m,V]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[h,[B,"Cat"],[m,V]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[h,[B,"Smartfren"],[m,V]],[/droid.+; (a(?:015|06[35]|142p?))/i],[h,[B,"Nothing"],[m,V]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[h,[B,"Archos"],[m,X]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[h,[B,"Archos"],[m,V]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[B,h,[m,X]],[/(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],[B,h,[m,V]],[/(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],[B,h,[m,X]],[/(surface duo)/i],[h,[B,me],[m,X]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[h,[B,"Fairphone"],[m,V]],[/(u304aa)/i],[h,[B,"AT&T"],[m,V]],[/\bsie-(\w*)/i],[h,[B,"Siemens"],[m,V]],[/\b(rct\w+) b/i],[h,[B,"RCA"],[m,X]],[/\b(venue[\d ]{2,7}) b/i],[h,[B,"Dell"],[m,X]],[/\b(q(?:mv|ta)\w+) b/i],[h,[B,"Verizon"],[m,X]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[h,[B,"Barnes & Noble"],[m,X]],[/\b(tm\d{3}\w+) b/i],[h,[B,"NuVision"],[m,X]],[/\b(k88) b/i],[h,[B,"ZTE"],[m,X]],[/\b(nx\d{3}j) b/i],[h,[B,"ZTE"],[m,V]],[/\b(gen\d{3}) b.+49h/i],[h,[B,"Swiss"],[m,V]],[/\b(zur\d{3}) b/i],[h,[B,"Swiss"],[m,X]],[/\b((zeki)?tb.*\b) b/i],[h,[B,"Zeki"],[m,X]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[B,"Dragon Touch"],h,[m,X]],[/\b(ns-?\w{0,9}) b/i],[h,[B,"Insignia"],[m,X]],[/\b((nxa|next)-?\w{0,9}) b/i],[h,[B,"NextBook"],[m,X]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[B,"Voice"],h,[m,V]],[/\b(lvtel\-)?(v1[12]) b/i],[[B,"LvTel"],h,[m,V]],[/\b(ph-1) /i],[h,[B,"Essential"],[m,V]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[h,[B,"Envizen"],[m,X]],[/\b(trio[-\w\. ]+) b/i],[h,[B,"MachSpeed"],[m,X]],[/\btu_(1491) b/i],[h,[B,"Rotor"],[m,X]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[h,[B,Se],[m,X]],[/(sprint) (\w+)/i],[B,h,[m,V]],[/(kin\.[onetw]{3})/i],[[h,/\./g," "],[B,me],[m,V]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[h,[B,qe],[m,X]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[h,[B,qe],[m,V]],[/smart-tv.+(samsung)/i],[B,[m,fe]],[/hbbtv.+maple;(\d+)/i],[[h,/^/,"SmartTV"],[B,We],[m,fe]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[B,se],[m,fe]],[/(apple) ?tv/i],[B,[h,i+" TV"],[m,fe]],[/crkey/i],[[h,v+"cast"],[B,k],[m,fe]],[/droid.+aft(\w+)( bui|\))/i],[h,[B,u],[m,fe]],[/(shield \w+ tv)/i],[h,[B,Se],[m,fe]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[h,[B,at],[m,fe]],[/(bravia[\w ]+)( bui|\))/i],[h,[B,Je],[m,fe]],[/(mi(tv|box)-?\w+) bui/i],[h,[B,Fe],[m,fe]],[/Hbbtv.*(technisat) (.*);/i],[B,h,[m,fe]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[B,ee],[h,ee],[m,fe]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[h,[m,fe]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[m,fe]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[B,h,[m,N]],[/droid.+; (shield)( bui|\))/i],[h,[B,Se],[m,N]],[/(playstation \w+)/i],[h,[B,Je],[m,N]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[h,[B,me],[m,N]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[h,[B,We],[m,pe]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[B,h,[m,pe]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[h,[B,xe],[m,pe]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[h,[B,i],[m,pe]],[/(opwwe\d{3})/i],[h,[B,j],[m,pe]],[/(moto 360)/i],[h,[B,Ae],[m,pe]],[/(smartwatch 3)/i],[h,[B,Je],[m,pe]],[/(g watch r)/i],[h,[B,se],[m,pe]],[/droid.+; (wt63?0{2,3})\)/i],[h,[B,qe],[m,pe]],[/droid.+; (glass) \d/i],[h,[B,k],[m,pe]],[/(pico) (4|neo3(?: link|pro)?)/i],[B,h,[m,pe]],[/; (quest( \d| pro)?)/i],[h,[B,Me],[m,pe]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[B,[m,Ce]],[/(aeobc)\b/i],[h,[B,u],[m,Ce]],[/(homepod).+mac os/i],[h,[B,i],[m,Ce]],[/windows iot/i],[[m,Ce]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[h,[m,V]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[h,[m,X]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[m,X]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[m,V]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[h,[B,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[L,[x,w+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[x,L],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[L,[x,"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],[x,L],[/ladybird\//i],[[x,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[L,x]],os:[[/microsoft (windows) (vista|xp)/i],[x,L],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[x,[L,q,ie]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[L,q,ie],[x,"Windows"]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[L,/_/g,"."],[x,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[x,Te],[L,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[L,x],[/(ubuntu) ([\w\.]+) like android/i],[[x,/(.+)/,"$1 Touch"],L],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/; ]?([\d\.]*)/i],[x,L],[/\(bb(10);/i],[L,[x,g]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[L,[x,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[L,[x,A+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[L,[x,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[L,[x,"watchOS"]],[/crkey\/([\d\.]+)/i],[L,[x,v+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[x,De],L],[/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],[x,L],[/(sunos) ?([\w\.\d]*)/i],[[x,"Solaris"],L],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[x,L]]},re=function(O,Q){if(typeof O===T&&(Q=O,O=o),!(this instanceof re))return new re(O,Q).getResult();var H=typeof n!==d&&n.navigator?n.navigator:o,te=O||(H&&H.userAgent?H.userAgent:a),we=H&&H.userAgentData?H.userAgentData:o,ae=Q?Vt(ye,Q):ye,R=H&&H.userAgent==te;return this.getBrowser=function(){var _={};return _[x]=o,_[L]=o,K.call(_,te,ae.browser),_[M]=G(_[L]),R&&H&&H.brave&&typeof H.brave.isBrave==l&&(_[x]="Brave"),_},this.getCPU=function(){var _={};return _[ke]=o,K.call(_,te,ae.cpu),_},this.getDevice=function(){var _={};return _[B]=o,_[h]=o,_[m]=o,K.call(_,te,ae.device),R&&!_[m]&&we&&we.mobile&&(_[m]=V),R&&_[h]=="Macintosh"&&H&&typeof H.standalone!==d&&H.maxTouchPoints&&H.maxTouchPoints>2&&(_[h]="iPad",_[m]=X),_},this.getEngine=function(){var _={};return _[x]=o,_[L]=o,K.call(_,te,ae.engine),_},this.getOS=function(){var _={};return _[x]=o,_[L]=o,K.call(_,te,ae.os),R&&!_[x]&&we&&we.platform&&we.platform!="Unknown"&&(_[x]=we.platform.replace(/chrome os/i,De).replace(/macos/i,Te)),_},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 te},this.setUA=function(_){return te=typeof _===C&&_.length>c?ee(_,c):_,this},this.setUA(te),this};re.VERSION=s,re.BROWSER=bt([x,L,M]),re.CPU=bt([ke]),re.DEVICE=bt([h,B,m,N,V,fe,X,pe,Ce]),re.ENGINE=re.OS=bt([x,L]),e.exports&&(t=e.exports=re),t.UAParser=re;var J=typeof n!==d&&(n.jQuery||n.Zepto);if(J&&!J.ua){var I=new re;J.ua=I.getResult(),J.ua.get=function(){return I.getUA()},J.ua.set=function(O){I.setUA(O);var Q=I.getResult();for(var H in Q)J.ua[H]=Q[H]}}})(typeof window=="object"?window:ac)})(an,an.exports)),an.exports}var Ss;function ic(){if(Ss)return oe;Ss=1,Object.defineProperty(oe,"__esModule",{value:!0});function e(E){return E&&typeof E=="object"&&"default"in E?E.default:E}var t=ne,n=e(t),o=rc(),s=new o,a=s.getBrowser(),r=s.getCPU(),l=s.getDevice(),d=s.getEngine(),T=s.getOS(),C=s.getUA(),M=function(f){return s.setUA(f)},h=function(f){if(!f){console.error("No userAgent string was provided");return}var p=new o(f);return{UA:p,browser:p.getBrowser(),cpu:p.getCPU(),device:p.getDevice(),engine:p.getEngine(),os:p.getOS(),ua:p.getUA(),setUserAgent:function(W){return p.setUA(W)}}},x=Object.freeze({ClientUAInstance:s,browser:a,cpu:r,device:l,engine:d,os:T,ua:C,setUa:M,parseUserAgent:h});function m(E,f){var p=Object.keys(E);if(Object.getOwnPropertySymbols){var F=Object.getOwnPropertySymbols(E);f&&(F=F.filter(function(W){return Object.getOwnPropertyDescriptor(E,W).enumerable})),p.push.apply(p,F)}return p}function B(E){for(var f=1;f<arguments.length;f++){var p=arguments[f]!=null?arguments[f]:{};f%2?m(Object(p),!0).forEach(function(F){X(E,F,p[F])}):Object.getOwnPropertyDescriptors?Object.defineProperties(E,Object.getOwnPropertyDescriptors(p)):m(Object(p)).forEach(function(F){Object.defineProperty(E,F,Object.getOwnPropertyDescriptor(p,F))})}return E}function L(E){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?L=function(f){return typeof f}:L=function(f){return f&&typeof Symbol=="function"&&f.constructor===Symbol&&f!==Symbol.prototype?"symbol":typeof f},L(E)}function ke(E,f){if(!(E instanceof f))throw new TypeError("Cannot call a class as a function")}function N(E,f){for(var p=0;p<f.length;p++){var F=f[p];F.enumerable=F.enumerable||!1,F.configurable=!0,"value"in F&&(F.writable=!0),Object.defineProperty(E,F.key,F)}}function V(E,f,p){return f&&N(E.prototype,f),E}function X(E,f,p){return f in E?Object.defineProperty(E,f,{value:p,enumerable:!0,configurable:!0,writable:!0}):E[f]=p,E}function fe(){return fe=Object.assign||function(E){for(var f=1;f<arguments.length;f++){var p=arguments[f];for(var F in p)Object.prototype.hasOwnProperty.call(p,F)&&(E[F]=p[F])}return E},fe.apply(this,arguments)}function pe(E,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function");E.prototype=Object.create(f&&f.prototype,{constructor:{value:E,writable:!0,configurable:!0}}),f&&c(E,f)}function Ce(E){return Ce=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},Ce(E)}function c(E,f){return c=Object.setPrototypeOf||function(F,W){return F.__proto__=W,F},c(E,f)}function u(E,f){if(E==null)return{};var p={},F=Object.keys(E),W,ve;for(ve=0;ve<F.length;ve++)W=F[ve],!(f.indexOf(W)>=0)&&(p[W]=E[W]);return p}function i(E,f){if(E==null)return{};var p=u(E,f),F,W;if(Object.getOwnPropertySymbols){var ve=Object.getOwnPropertySymbols(E);for(W=0;W<ve.length;W++)F=ve[W],!(f.indexOf(F)>=0)&&Object.prototype.propertyIsEnumerable.call(E,F)&&(p[F]=E[F])}return p}function b(E){if(E===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return E}function g(E,f){if(f&&(typeof f=="object"||typeof f=="function"))return f;if(f!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return b(E)}function y(E,f){return v(E)||w(E,f)||A(E,f)||S()}function v(E){if(Array.isArray(E))return E}function w(E,f){var p=E==null?null:typeof Symbol<"u"&&E[Symbol.iterator]||E["@@iterator"];if(p!=null){var F=[],W=!0,ve=!1,Le,Ye;try{for(p=p.call(E);!(W=(Le=p.next()).done)&&(F.push(Le.value),!(f&&F.length===f));W=!0);}catch(Sn){ve=!0,Ye=Sn}finally{try{!W&&p.return!=null&&p.return()}finally{if(ve)throw Ye}}return F}}function A(E,f){if(E){if(typeof E=="string")return k(E,f);var p=Object.prototype.toString.call(E).slice(8,-1);if(p==="Object"&&E.constructor&&(p=E.constructor.name),p==="Map"||p==="Set")return Array.from(E);if(p==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(p))return k(E,f)}}function k(E,f){(f==null||f>E.length)&&(f=E.length);for(var p=0,F=new Array(f);p<f;p++)F[p]=E[p];return F}function S(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
396
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var D={Mobile:"mobile",Tablet:"tablet",SmartTv:"smarttv",Console:"console",Wearable:"wearable",Embedded:"embedded",Browser:void 0},z={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"},se={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},Ae=function(f){switch(f){case D.Mobile:return{isMobile:!0};case D.Tablet:return{isTablet:!0};case D.SmartTv:return{isSmartTV:!0};case D.Console:return{isConsole:!0};case D.Wearable:return{isWearable:!0};case D.Browser:return{isBrowser:!0};case D.Embedded:return{isEmbedded:!0};default:return me}},Se=function(f){return M(f)},j=function(f){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"none";return f||p},be=function(){return typeof window<"u"&&(window.navigator||navigator)?window.navigator||navigator:!1},xe=function(f){var p=be();return p&&p.platform&&(p.platform.indexOf(f)!==-1||p.platform==="MacIntel"&&p.maxTouchPoints>1&&!window.MSStream)},We=function(f,p,F,W,ve){return{isBrowser:f,browserMajorVersion:j(p.major),browserFullVersion:j(p.version),browserName:j(p.name),engineName:j(F.name),engineVersion:j(F.version),osName:j(W.name),osVersion:j(W.version),userAgent:j(ve)}},at=function(f,p,F,W){return B({},f,{vendor:j(p.vendor),model:j(p.model),os:j(F.name),osVersion:j(F.version),ua:j(W)})},Je=function(f,p,F,W){return{isSmartTV:f,engineName:j(p.name),engineVersion:j(p.version),osName:j(F.name),osVersion:j(F.version),userAgent:j(W)}},Fe=function(f,p,F,W){return{isConsole:f,engineName:j(p.name),engineVersion:j(p.version),osName:j(F.name),osVersion:j(F.version),userAgent:j(W)}},qe=function(f,p,F,W){return{isWearable:f,engineName:j(p.name),engineVersion:j(p.version),osName:j(F.name),osVersion:j(F.version),userAgent:j(W)}},Me=function(f,p,F,W,ve){return{isEmbedded:f,vendor:j(p.vendor),model:j(p.model),engineName:j(F.name),engineVersion:j(F.version),osName:j(W.name),osVersion:j(W.version),userAgent:j(ve)}};function De(E){var f=E?h(E):x,p=f.device,F=f.browser,W=f.engine,ve=f.os,Le=f.ua,Ye=Ae(p.type),Sn=Ye.isBrowser,al=Ye.isMobile,rl=Ye.isTablet,Os=Ye.isSmartTV,Ls=Ye.isConsole,Ms=Ye.isWearable,Rs=Ye.isEmbedded;if(Sn)return We(Sn,F,W,ve,Le);if(Os)return Je(Os,W,ve,Le);if(Ls)return Fe(Ls,W,ve,Le);if(al||rl)return at(Ye,p,ve,Le);if(Ms)return qe(Ms,W,ve,Le);if(Rs)return Me(Rs,p,W,ve,Le)}var Te=function(f){var p=f.type;return p===D.Mobile},Pt=function(f){var p=f.type;return p===D.Tablet},Vt=function(f){var p=f.type;return p===D.Mobile||p===D.Tablet},bt=function(f){var p=f.type;return p===D.SmartTv},U=function(f){var p=f.type;return p===D.Browser},Z=function(f){var p=f.type;return p===D.Wearable},G=function(f){var p=f.type;return p===D.Console},ee=function(f){var p=f.type;return p===D.Embedded},K=function(f){var p=f.vendor;return j(p)},q=function(f){var p=f.model;return j(p)},Y=function(f){var p=f.type;return j(p,"browser")},ie=function(f){var p=f.name;return p===se.Android},ye=function(f){var p=f.name;return p===se.Windows},re=function(f){var p=f.name;return p===se.MAC_OS},J=function(f){var p=f.name;return p===se.WindowsPhone},I=function(f){var p=f.name;return p===se.IOS},O=function(f){var p=f.version;return j(p)},Q=function(f){var p=f.name;return j(p)},H=function(f){var p=f.name;return p===z.Chrome},te=function(f){var p=f.name;return p===z.Firefox},we=function(f){var p=f.name;return p===z.Chromium},ae=function(f){var p=f.name;return p===z.Edge},R=function(f){var p=f.name;return p===z.Yandex},_=function(f){var p=f.name;return p===z.Safari||p===z.MobileSafari},$=function(f){var p=f.name;return p===z.MobileSafari},ge=function(f){var p=f.name;return p===z.Opera},Be=function(f){var p=f.name;return p===z.InternetExplorer||p===z.Ie},de=function(f){var p=f.name;return p===z.MIUI},Ee=function(f){var p=f.name;return p===z.SamsungBrowser},Pe=function(f){var p=f.version;return j(p)},Ne=function(f){var p=f.major;return j(p)},_e=function(f){var p=f.name;return j(p)},Xe=function(f){var p=f.name;return j(p)},nt=function(f){var p=f.version;return j(p)},dt=function(){var f=be(),p=f&&f.userAgent&&f.userAgent.toLowerCase();return typeof p=="string"?/electron/.test(p):!1},rt=function(f){return typeof f=="string"&&f.indexOf("Edg/")!==-1},Ft=function(){var f=be();return f&&(/iPad|iPhone|iPod/.test(f.platform)||f.platform==="MacIntel"&&f.maxTouchPoints>1)&&!window.MSStream},Ke=function(){return xe("iPad")},rn=function(){return xe("iPhone")},Gt=function(){return xe("iPod")},Oe=function(f){return j(f)};function An(E){var f=E||x,p=f.device,F=f.browser,W=f.os,ve=f.engine,Le=f.ua;return{isSmartTV:bt(p),isConsole:G(p),isWearable:Z(p),isEmbedded:ee(p),isMobileSafari:$(F)||Ke(),isChromium:we(F),isMobile:Vt(p)||Ke(),isMobileOnly:Te(p),isTablet:Pt(p)||Ke(),isBrowser:U(p),isDesktop:U(p),isAndroid:ie(W),isWinPhone:J(W),isIOS:I(W)||Ke(),isChrome:H(F),isFirefox:te(F),isSafari:_(F),isOpera:ge(F),isIE:Be(F),osVersion:O(W),osName:Q(W),fullBrowserVersion:Pe(F),browserVersion:Ne(F),browserName:_e(F),mobileVendor:K(p),mobileModel:q(p),engineName:Xe(ve),engineVersion:nt(ve),getUA:Oe(Le),isEdge:ae(F)||rt(Le),isYandex:R(F),deviceType:Y(p),isIOS13:Ft(),isIPad13:Ke(),isIPhone13:rn(),isIPod13:Gt(),isElectron:dt(),isEdgeChromium:rt(Le),isLegacyEdge:ae(F)&&!rt(Le),isWindows:ye(W),isMacOs:re(W),isMIUI:de(F),isSamsungBrowser:Ee(F)}}var Tn=bt(l),Es=G(l),Ns=Z(l),uc=ee(l),fc=$(a)||Ke(),pc=we(a),xn=Vt(l)||Ke(),Cs=Te(l),Bs=Pt(l)||Ke(),Is=U(l),mc=U(l),Ps=ie(T),Fs=J(T),Ds=I(T)||Ke(),hc=H(a),bc=te(a),gc=_(a),wc=ge(a),_s=Be(a),yc=O(T),vc=Q(T),kc=Pe(a),Ac=Ne(a),Tc=_e(a),xc=K(l),Sc=q(l),Ec=Xe(d),Nc=nt(d),Cc=Oe(C),Bc=ae(a)||rt(C),Ic=R(a),Pc=Y(l),Fc=Ft(),Dc=Ke(),_c=rn(),Uc=Gt(),Oc=dt(),Lc=rt(C),Mc=ae(a)&&!rt(C),Rc=ye(T),$c=re(T),Hc=de(a),Wc=Ee(a),Vc=function(f){if(!f||typeof f!="string"){console.error("No valid user agent string was provided");return}var p=h(f),F=p.device,W=p.browser,ve=p.os,Le=p.engine,Ye=p.ua;return An({device:F,browser:W,os:ve,engine:Le,ua:Ye})},Gc=function(f){var p=f.renderWithFragment,F=f.children,W=i(f,["renderWithFragment","children"]);return Ps?p?n.createElement(t.Fragment,null,F):n.createElement("div",W,F):null},zc=function(f){var p=f.renderWithFragment,F=f.children,W=i(f,["renderWithFragment","children"]);return Is?p?n.createElement(t.Fragment,null,F):n.createElement("div",W,F):null},qc=function(f){var p=f.renderWithFragment,F=f.children,W=i(f,["renderWithFragment","children"]);return _s?p?n.createElement(t.Fragment,null,F):n.createElement("div",W,F):null},Yc=function(f){var p=f.renderWithFragment,F=f.children,W=i(f,["renderWithFragment","children"]);return Ds?p?n.createElement(t.Fragment,null,F):n.createElement("div",W,F):null},jc=function(f){var p=f.renderWithFragment,F=f.children,W=i(f,["renderWithFragment","children"]);return xn?p?n.createElement(t.Fragment,null,F):n.createElement("div",W,F):null},Jc=function(f){var p=f.renderWithFragment,F=f.children,W=i(f,["renderWithFragment","children"]);return Bs?p?n.createElement(t.Fragment,null,F):n.createElement("div",W,F):null},Xc=function(f){var p=f.renderWithFragment,F=f.children,W=i(f,["renderWithFragment","children"]);return Fs?p?n.createElement(t.Fragment,null,F):n.createElement("div",W,F):null},Kc=function(f){var p=f.renderWithFragment,F=f.children;f.viewClassName,f.style;var W=i(f,["renderWithFragment","children","viewClassName","style"]);return Cs?p?n.createElement(t.Fragment,null,F):n.createElement("div",W,F):null},Zc=function(f){var p=f.renderWithFragment,F=f.children,W=i(f,["renderWithFragment","children"]);return Tn?p?n.createElement(t.Fragment,null,F):n.createElement("div",W,F):null},Qc=function(f){var p=f.renderWithFragment,F=f.children,W=i(f,["renderWithFragment","children"]);return Es?p?n.createElement(t.Fragment,null,F):n.createElement("div",W,F):null},el=function(f){var p=f.renderWithFragment,F=f.children,W=i(f,["renderWithFragment","children"]);return Ns?p?n.createElement(t.Fragment,null,F):n.createElement("div",W,F):null},tl=function(f){var p=f.renderWithFragment,F=f.children;f.viewClassName,f.style;var W=f.condition,ve=i(f,["renderWithFragment","children","viewClassName","style","condition"]);return W?p?n.createElement(t.Fragment,null,F):n.createElement("div",ve,F):null};function nl(E){return(function(f){pe(p,f);function p(F){var W;return ke(this,p),W=g(this,Ce(p).call(this,F)),W.isEventListenerAdded=!1,W.handleOrientationChange=W.handleOrientationChange.bind(b(W)),W.onOrientationChange=W.onOrientationChange.bind(b(W)),W.onPageLoad=W.onPageLoad.bind(b(W)),W.state={isLandscape:!1,isPortrait:!1},W}return V(p,[{key:"handleOrientationChange",value:function(){this.isEventListenerAdded||(this.isEventListenerAdded=!0);var W=window.innerWidth>window.innerHeight?90:0;this.setState({isPortrait:W===0,isLandscape:W===90})}},{key:"onOrientationChange",value:function(){this.handleOrientationChange()}},{key:"onPageLoad",value:function(){this.handleOrientationChange()}},{key:"componentDidMount",value:function(){(typeof window>"u"?"undefined":L(window))!==void 0&&xn&&(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(E,fe({},this.props,{isLandscape:this.state.isLandscape,isPortrait:this.state.isPortrait}))}}]),p})(n.Component)}function ol(){var E=t.useState(function(){var ve=window.innerWidth>window.innerHeight?90:0;return{isPortrait:ve===0,isLandscape:ve===90,orientation:ve===0?"portrait":"landscape"}}),f=y(E,2),p=f[0],F=f[1],W=t.useCallback(function(){var ve=window.innerWidth>window.innerHeight?90:0,Le={isPortrait:ve===0,isLandscape:ve===90,orientation:ve===0?"portrait":"landscape"};p.orientation!==Le.orientation&&F(Le)},[p.orientation]);return t.useEffect(function(){return(typeof window>"u"?"undefined":L(window))!==void 0&&xn&&(W(),window.addEventListener("load",W,!1),window.addEventListener("resize",W,!1)),function(){window.removeEventListener("resize",W,!1),window.removeEventListener("load",W,!1)}},[W]),p}function Us(E){var f=E||window.navigator.userAgent;return h(f)}function sl(E){var f=E||window.navigator.userAgent,p=Us(f),F=An(p);return[F,p]}return oe.AndroidView=Gc,oe.BrowserTypes=z,oe.BrowserView=zc,oe.ConsoleView=Qc,oe.CustomView=tl,oe.IEView=qc,oe.IOSView=Yc,oe.MobileOnlyView=Kc,oe.MobileView=jc,oe.OsTypes=se,oe.SmartTVView=Zc,oe.TabletView=Jc,oe.WearableView=el,oe.WinPhoneView=Xc,oe.browserName=Tc,oe.browserVersion=Ac,oe.deviceDetect=De,oe.deviceType=Pc,oe.engineName=Ec,oe.engineVersion=Nc,oe.fullBrowserVersion=kc,oe.getSelectorsByUserAgent=Vc,oe.getUA=Cc,oe.isAndroid=Ps,oe.isBrowser=Is,oe.isChrome=hc,oe.isChromium=pc,oe.isConsole=Es,oe.isDesktop=mc,oe.isEdge=Bc,oe.isEdgeChromium=Lc,oe.isElectron=Oc,oe.isEmbedded=uc,oe.isFirefox=bc,oe.isIE=_s,oe.isIOS=Ds,oe.isIOS13=Fc,oe.isIPad13=Dc,oe.isIPhone13=_c,oe.isIPod13=Uc,oe.isLegacyEdge=Mc,oe.isMIUI=Hc,oe.isMacOs=$c,oe.isMobile=xn,oe.isMobileOnly=Cs,oe.isMobileSafari=fc,oe.isOpera=wc,oe.isSafari=gc,oe.isSamsungBrowser=Wc,oe.isSmartTV=Tn,oe.isTablet=Bs,oe.isWearable=Ns,oe.isWinPhone=Fs,oe.isWindows=Rc,oe.isYandex=Ic,oe.mobileModel=Sc,oe.mobileVendor=xc,oe.osName=vc,oe.osVersion=yc,oe.parseUserAgent=h,oe.setUserAgent=Se,oe.useDeviceData=Us,oe.useDeviceSelectors=sl,oe.useMobileOrientation=ol,oe.withOrientationChange=nl,oe}var Wt=ic();function fo(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 cc=({isOpen:e,onClose:t,onTransaction:n,position:o="bottom-right",modalChatStyle:s={}})=>{const{t:a,ti:r}=En(),{messages:l,addMessage:d,updateMessageAction:T,updateMessageText:C}=Bi(),[M,h]=ne.useState(""),[x,m]=ne.useState(!1),[B,L]=ne.useState(!0),[ke,N]=ne.useState(null),V=ne.useRef(null),X=ne.useRef(null),fe=ne.useRef(null),pe=ne.useRef(null),Ce=ne.useRef(null),c=ne.useRef(!1),u=ne.useRef(B);ne.useEffect(()=>{u.current=B},[B]);const{account:i,chainData:b,chainType:g,chainTypeMoralis:y,chainId:v,isChainSupported:w}=eo(),{config:A}=Ii(),k=v&&A?.rpcUrls?.[v]||void 0,S=ne.useCallback(()=>{const U=Bt.getItem("dataBuyToken");if(U)try{return JSON.parse(U)}catch{return{srcTokenAddress:"",descTokenAddress:"",amount:"",srcTokenDecimals:18,descTokenDecimals:18}}return{srcTokenAddress:"",descTokenAddress:"",amount:"",srcTokenDecimals:18,descTokenDecimals:18}},[]),D=ne.useCallback(U=>{Bt.setItem("dataBuyToken",JSON.stringify(U))},[]),z=ne.useCallback(U=>{const G={...S(),...U};D(G)},[S,D]),se=ne.useCallback(U=>{N(U),Wt.isDesktop&&fe.current?.focus()},[]),me=ne.useCallback(async(U,Z)=>{z({descTokenAddress:U,descTokenDecimals:Z||18});try{m(!0);const G=await je({address:i?.address||"",chain:y});if(G?.success&&G?.data?.result){const ee=G.data.result;if(ee?.length>0){const K=ee.map(q=>({id:q.token_address,text:`${q.name}: ${q.balance_formatted} ${q.symbol} ($${ce(q.usd_value||0)?.decimalPlaces(2).toFormat()||"0"})`,value:r("buttonBuyWith",{symbol:q.symbol}),action:"click_balance_item_user_to_buy_button",fullWidth:!0,extraData:{tokenAddress:q.token_address,symbol:q.symbol,balance:q.balance_formatted,usdValue:q.usd_value,decimals:q.decimals}}));d(r("walletBalanceSpendable",{chain:b?.name||"unknown"}),"bot",void 0,K)}else d(r("walletNoTokensFound",{chain:b?.name||"unknown"}),"bot")}else d(a("walletFetchFailed"),"bot")}catch(G){console.error("Error fetching wallet balance:",G),d(a("walletFetchError"),"bot")}finally{m(!1)}},[z,i?.address,y,d,b?.name,a,r]),Ae=ne.useCallback(async(U,Z,G,ee)=>{const K=[25,50,75,100];z({srcTokenAddress:U,srcTokenDecimals:ee||18});let q=G||"0";if(U===Ge)try{const ie=await uo({chainId:v,rpcUrl:k});if(ie.isGreaterThan(0)){const ye=ie.times(1e6),J=new ce(mt(G,ee||18).toString()).minus(ye);J.isGreaterThan(0)?q=ce(Ue(BigInt(J.toFixed(0)),18)).toFixed():q="0"}}catch(ie){console.warn("getGasPrice for swap native fee deduction failed:",ie)}const Y=K.map(ie=>({id:`percent-${ie}`,text:`${ie}%`,value:r("buttonUsePercent",{percent:String(ie),symbol:Z}),action:"select_percent",extraData:{percent:ie,tokenAddress:U,tokenSymbol:Z,tokenBalance:q}}));if(ce(q).isZero()){d(r("insufficientFeeToken",{symbol:Z}),"bot");return}d(r("selectAmountOf",{symbol:Z,balance:q}),"bot",void 0,Y)},[d,v,k,z,r]),Se=ne.useCallback(async(U,Z)=>{z({amount:(parseFloat(Z)*(U/100)).toFixed(6)});const G=S(),ee=mt(G.amount,G.srcTokenDecimals||18).toString(),K=await ro({chainId:v,tokenIn:G.srcTokenAddress,tokenInAmount:ee,tokenOut:G.descTokenAddress,tokenOutRecipient:i?.address||"",slippage:"auto",accesstoken:"d6c45897b8f6"});if(K.success&&K.data){const q=K.data,Y=q.tokenIn,ie=q.tokenOut,ye=ce(Ue(BigInt(Y.amount||0),Y.decimals)).decimalPlaces(6).toFormat(),re=ce(Ue(BigInt(ie.amount||0),ie.decimals)).decimalPlaces(6).toFormat(),J=G.srcTokenAddress===Ge||G.srcTokenAddress==="";let I=!1;if(!J&&i?.address&&q.tx?.to)try{const _=await lo({tokenAddress:G.srcTokenAddress,ownerAddress:i.address,spenderAddress:q.tx.to,chainId:v,rpcUrl:k});I=ce(_.toString()).isLessThan(ee)}catch(_){console.warn("Allowance check failed:",_),I=!0}const O=q.estimatedTransactionFee?.total?ce(q.estimatedTransactionFee.total):ce(0);let Q=ce(0);if(I&&i?.address)try{const _=vn({tokenAddress:G.srcTokenAddress,spenderAddress:q.tx?.to||"",fromAddress:i.address,chainId:v});Q=await sn({from:i.address,to:_.to,data:_.data,chainId:v,rpcUrl:k})}catch(_){console.warn("Approve fee estimation failed:",_)}const H=O.plus(Q),te=b?.nativeCurrency?.symbol||"native";let we="",ae=!1;if(i?.address&&H.isGreaterThan(0))try{const _=await kn({address:i.address,chainId:v,rpcUrl:k});if(_.isLessThan(H)){ae=!0;const $=ce(Ue(BigInt(_.toFixed(0)),18)).decimalPlaces(6).toFormat(),ge=ce(Ue(BigInt(H.toFixed(0)),18)).decimalPlaces(6).toFormat();we=r("swapFeeWarning",{symbol:te,balance:$,needed:ge})}}catch(_){console.warn("Fee balance check failed:",_)}const R=`From: ${ye} ${Y.symbol}
|
|
386
397
|
⬇️
|
|
387
|
-
To: ${
|
|
398
|
+
To: ${re} ${ie.symbol}
|
|
388
399
|
|
|
389
|
-
`+
|
|
390
|
-
`;if(
|
|
391
|
-
[View on Explorer](${ie}/tx/${
|
|
392
|
-
Tx: ${
|
|
393
|
-
Error: ${
|
|
394
|
-
Error: ${
|
|
395
|
-
$${
|
|
400
|
+
`+we+`
|
|
401
|
+
`;if(ae)d(R,"bot");else if(I){const _=R+r("swapNeedApprove",{symbol:Y.symbol}),$=[{id:"approve-for-swap",text:r("swapApproveButton",{symbol:Y.symbol}),value:r("swapApproveValue",{symbol:Y.symbol}),action:"approve_for_swap",fullWidth:!0,extraData:{tokenAddress:G.srcTokenAddress,spenderAddress:q.tx.to,tokenSymbol:Y.symbol,tx:q.tx}}];d(_,"bot",void 0,$)}else{const _=[{id:"confirm-swap",text:a("swapConfirmButton"),value:a("swapConfirmValue"),action:"confirm_swap",extraData:{tx:q.tx}}];d(R+a("swapReadyToProceed"),"bot",void 0,_)}}else d(r("swapEstimationError",{error:K.errorMessage||K.error||"Unknown error"}),"bot")},[S,z,d,v,i?.address,b?.nativeCurrency?.symbol,k,a,r]),j=ne.useCallback(async(U,Z,G)=>{try{if(Z==="suggested_action"){pe.current=U,h(U);return}if(d(U,"user"),L(!1),m(!0),Z)switch(await ot(500),Z){case"click_buy_item_token_button":await me(G?.tokenAddress||"",G?.decimals||18);break;case"click_balance_item_user_to_buy_button":await Ae(G?.tokenAddress||"",G?.symbol||"",G?.balance||"",G?.decimals||18);break;case"select_percent":await Se(G?.percent||0,G?.tokenBalance||"");break;case"confirm_swap":if(G?.tx&&n){const ee=G.tx,K={from:i?.address||"",to:ee.to,data:ee.data,value:ee.value,chainId:v},q=d(a("txProcessing"),"bot");try{m(!1);const Y=await n(K);if(Y.status==="success"&&Y.transactionHash){const ie=b?.blockExplorers?.default?.url,ye=ie?`
|
|
402
|
+
[View on Explorer](${ie}/tx/${Y.transactionHash})`:`
|
|
403
|
+
Tx: ${Y.transactionHash}`;C(q.id,a("txSubmitted")+ye);try{await ot(2e3),(await co({transactionHash:Y.transactionHash,chainId:v||1,rpcUrl:k})).status==="success"?C(q.id,a("txConfirmedSwap")+ye):C(q.id,a("txRevertedSwap")+ye)}catch(re){console.warn("Transaction tracking timeout:",re),C(q.id,a("txTimeout")+ye)}}else if(Y.status==="success")C(q.id,a("txSuccessfulSwap"));else{const ie=Y.error?`
|
|
404
|
+
Error: ${Y.error}`:"";C(q.id,a("txFailed")+ie)}}catch(Y){console.error("Transaction error:",Y),C(q.id,a("txFailed"))}}else d(a("txDataNotAvailable"),"bot");break;case"approve_for_swap":{const ee=G?.tokenAddress||"",K=G?.spenderAddress||"",q=G?.tokenSymbol||"token",Y=G?.tx;if(!ee||!K||!n){d(a("approvalDataNotAvailable"),"bot");break}const ie=vn({tokenAddress:ee,spenderAddress:K,fromAddress:i?.address||"",chainId:v,tokenSymbol:q}),ye={from:ie.from,to:ie.to,data:ie.data,value:ie.value,chainId:ie.chainId};d(r("approving",{symbol:q}),"bot");try{m(!1);const re=await n(ye);let J=re.status==="success";if(re.status==="success"&&re.transactionHash)try{J=(await co({transactionHash:re.transactionHash,chainId:v||1,rpcUrl:k})).status==="success"}catch(I){console.warn("Approval tracking timeout:",I),J=!0}if(J){d(r("approvalSuccess",{symbol:q}),"bot");const I=[{id:"confirm-swap-after-approve",text:a("confirmSwapButton"),value:a("swapConfirmValue"),action:"confirm_swap",fullWidth:!0,extraData:{tx:Y}}];d(a("approvalConfirmSwap"),"bot",void 0,I)}else{const I=re.error?`
|
|
405
|
+
Error: ${re.error}`:"";d(a("approvalFailed")+I,"bot")}}catch(re){console.error("Approval error:",re),d(a("approvalFailed"),"bot")}break}case"click_swap_dest_token":{const ee=G?.tokenAddress||"",K=G?.symbol||"",q=G?.decimals||18;z({descTokenAddress:ee,descTokenDecimals:q});const ie=S().srcTokenAddress||"",ye=ie===Ge;try{const re=await je({address:i?.address||"",chain:y});if(re?.success&&re?.data?.result){const J=re.data.result;let I="",O="0";if(ye){const Q=J.find(H=>H.native_token);I=b?.nativeCurrency?.symbol||"ETH",O=Q?.balance_formatted||"0"}else{const Q=J.find(H=>H.token_address.toLowerCase()===ie.toLowerCase());Q&&(I=Q.symbol,O=Q.balance_formatted)}if(I&&parseFloat(O)>0){const H=[25,50,75,100].map(te=>({id:`percent-${te}`,text:`${te}%`,value:r("buttonUsePercent",{percent:String(te),symbol:I}),action:"select_percent",extraData:{percent:te,tokenAddress:ie,tokenSymbol:I,tokenBalance:O}}));d(r("swapSelectAmount",{from:I,to:K,balance:O}),"bot",void 0,H)}else d(a("swapNoSourceToken"),"bot")}else d(a("couldNotFetchBalance"),"bot")}catch(re){console.error("Error in click_swap_dest_token:",re),d(a("couldNotLoadBalance"),"bot")}break}case"select_nft_to_send":{const ee=G?.name||"NFT",K=G?.contractAddress||"",q=G?.tokenId||"",Y=G?.tokenStandard||"ERC721",ie=G?.amount||"1",ye=G?.image||"",re={contract_address:K,token_id:q,to_address:"",token_standard:Y,amount:"1",maxAmount:ie,nft_name:ee};d(r("nftSendReview",{name:ee,standard:Y,tokenId:q}),"bot",void 0,void 0,{action:"send_nft",parameters:re,status:"pending",nftInfo:{name:ee,image:ye||void 0,tokenId:q,contractAddress:K,tokenStandard:Y}});break}default:d(`Action "${Z}" executed for: ${U}`,"bot")}else await ot(500),d(`Received: ${U}`,"bot");m(!1),Wt.isDesktop&&fe.current?.focus()}catch(ee){d(a("errorProcessingRequest"),"bot"),m(!1),console.error("Error handling button click:",ee)}},[i?.address,d,C,b?.blockExplorers?.default?.url,b?.nativeCurrency?.symbol,v,y,S,me,Ae,n,Se,z,k,a,r]),be=ne.useCallback(async()=>{try{m(!0);const U=b?.tokenTrendingDefault||[],[Z,G]=await Promise.allSettled([tt.getTopGainers(g,"24h",5),tt.getTokensDetails(U,g)]);let ee=[];Z.status==="fulfilled"&&Z.value?.data?ee=[...Z.value.data]:console.warn("⚠️ Top gainers failed:"),G.status==="fulfilled"&&G.value?.data?ee=[...G.value.data,...ee]:console.warn("⚠️ Default tokens failed:"),ee=ee.filter((Y,ie,ye)=>ie===ye.findIndex(re=>re.address.toLowerCase()===Y.address.toLowerCase()));const K=ee.map(Y=>({id:Y?.symbol,text:Y?.symbol,value:r("buttonBuyToken",{name:Y.name,symbol:Y?.symbol||""}),action:"click_buy_item_token_button",extraData:{tokenAddress:Y?.address||"",symbol:Y?.symbol||"",decimals:Y?.decimals||18}}));await ot(1e3),m(!1),d(r("trendingTokensHeader",{chain:b?.name||"Unknown"}),"bot");const q=ee.map((Y,ie)=>`${ie+1}. ${Y.name} (${Y?.auditGoplus?.token_symbol||Y.symbol||"Unknown"})
|
|
406
|
+
$${ce(Y?.price||0).decimalPlaces(4).toFormat()} (${Y.price_change_percentage_24h||Y.priceChange}%)
|
|
396
407
|
|
|
397
408
|
---
|
|
398
409
|
`).join(`
|
|
399
|
-
`);d(`${
|
|
400
|
-
`:"🖼️ ";return`${
|
|
401
|
-
${
|
|
410
|
+
`);d(`${q}${a("trendingTokensQuestion")}`,"bot",void 0,K)}catch(U){console.error("Error fetching trending tokens:",U),d(a("trendingTokensError"),"bot")}finally{m(!1)}},[d,b?.name,b?.tokenTrendingDefault,g,a,r]),xe=ne.useCallback(async()=>{try{m(!0);const U=await wn({address:i?.address||"",chain:y,limit:100,exclude_spam:!1});if(U?.success&&U?.data?.result&&U.data.result.length>0){const Z=U.data.result,G=Z.map(K=>{const q=K.normalized_metadata?.name||K.name||`#${K.token_id}`,Y=K.normalized_metadata?.image||K.media?.original_media_url||"";return{id:`${K.token_address}-${K.token_id}`,text:`${q} (${K.symbol||K.contract_type}) - ${K.token_id}`,value:r("buttonSendNft",{name:q}),action:"select_nft_to_send",fullWidth:!0,extraData:{contractAddress:K.token_address,tokenId:K.token_id,tokenStandard:K.contract_type,name:q,symbol:K.symbol,amount:K.amount,image:Y}}}),ee=Z.map((K,q)=>{const Y=K.normalized_metadata?.name||K.name||`#${K.token_id}`,ie=K.contract_type==="ERC1155"?` (x${K.amount})`:"",ye=K.normalized_metadata?.image||K.media?.original_media_url||"",re=ye?`
|
|
411
|
+
`:"🖼️ ";return`${q+1}. ${re}**${Y}**${ie}
|
|
412
|
+
${K.symbol||K.contract_type} | Token ID: ${K.token_id}`}).join(`
|
|
402
413
|
|
|
403
|
-
`);await
|
|
404
|
-
Balance: ${
|
|
414
|
+
`);await ot(500),m(!1),d(r("nftCollectionHeader",{count:String(Z.length),list:ee}),"bot",void 0,G)}else m(!1),d(a("nftNoCollection"),"bot")}catch(U){console.error("Error fetching NFTs:",U),m(!1),d(a("nftFetchError"),"bot")}},[i?.address,y,d,a,r]),We=ne.useCallback(async()=>{try{m(!0);const U=await je({address:i?.address||"",chain:y});if(U?.success&&U?.data?.result&&U.data.result.length>0){const Z=U.data.result,G=Z.flatMap(K=>[{id:`send-${K.token_address}`,text:r("buttonSendToken",{symbol:K.symbol}),value:r("buttonSendToken",{symbol:K.symbol}),action:"suggested_action",fullWidth:!!Wt.isMobile},{id:`buy-more-${K.token_address}`,text:r("buttonBuyMoreToken",{symbol:K.symbol}),value:r("buttonBuyMoreToken",{symbol:K.symbol}),action:"suggested_action",fullWidth:!!Wt.isMobile}]),ee=Z.map((K,q)=>{const Y=K.usd_value!==void 0?` ≈ $${ce(K.usd_value).decimalPlaces(2).toFormat()}`:"";return`${q+1}. **${K.name}** (${K.symbol})
|
|
415
|
+
Balance: ${K.balance_formatted}${Y}`}).join(`
|
|
405
416
|
|
|
406
|
-
`);await
|
|
417
|
+
`);await ot(500),m(!1),d(r("viewBalancesHeader",{chain:b?.name||"this chain",list:ee}),"bot",void 0,G)}else m(!1),d(a("viewBalancesEmpty"),"bot")}catch(U){console.error("Error fetching balances:",U),m(!1),d(a("viewBalancesFetchError"),"bot")}},[i?.address,y,d,b?.name,a,r]),at=ne.useMemo(()=>[{id:"ask",icon:"❓",text:a("suggestionAskText"),action:async()=>{L(!1),m(!0),d(a("suggestionAskUserMessage"),"user"),await ot(1e3),m(!1),d(a("suggestionAskBotReply"),"bot")}},{id:"buy",icon:"💰",text:a("suggestionBuyText"),action:async()=>{L(!1),d(a("suggestionBuyText"),"user"),Re(i?.address||"")&&w?await be():(m(!0),await ot(1e3),Re(i?.address||"")&&!w?d(a("walletConnectedChainUnsupported"),"bot"):d(a("walletNotConnected"),"bot"),m(!1))}}],[d,i?.address,be,a,w]),Je=U=>{if(U===0)return!0;const Z=l[U],G=l[U-1],ee=new Date(Z.timestamp),K=new Date(G.timestamp);return ee.setHours(0,0,0,0),K.setHours(0,0,0,0),ee.getTime()!==K.getTime()};ne.useEffect(()=>{V.current?.scrollIntoView({behavior:"smooth"})},[l]),ne.useEffect(()=>{e?(fe.current&&Wt.isDesktop&&fe.current.focus(),V.current?.scrollIntoView({behavior:"instant"}),c.current&&Ce.current?Date.now()-Ce.current>1e4&&L(!0):L(!0),Ce.current=null,c.current=!1,setTimeout(()=>{V.current?.scrollIntoView({behavior:"smooth"})},50)):(Ce.current=Date.now(),c.current=!u.current)},[e]),ne.useEffect(()=>{const U=Z=>{Z.key==="Escape"&&e&&t()};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[e,t]);const Fe=ne.useCallback(async()=>{if(M?.trim()===""||x)return;const U=ke,Z=d(M?.trim(),"user",ke?.id);h(""),N(null),m(!0),L(!1),m(!0);try{let G,ee;if(i?.address&&w)try{const[re,J]=await Promise.allSettled([je({address:i.address,chain:y}),wn({address:i.address,chain:y,limit:50,exclude_spam:!0})]);re.status==="fulfilled"&&re.value?.success&&re.value?.data?.result&&(G=re.value.data.result.map(I=>({symbol:I.symbol,name:I.name,balance_formatted:I.balance_formatted,usd_value:I.usd_value,native_token:I.native_token,token_address:I.token_address}))),J.status==="fulfilled"&&J.value?.success&&J.value?.data?.result&&(ee=J.value.data.result.map(I=>({name:I.normalized_metadata?.name||I.name||`#${I.token_id}`,token_address:I.token_address,token_id:I.token_id,contract_type:I.contract_type||"",amount:I.amount||"1"})))}catch{}const K=ji({walletAddress:i?.address||void 0,chainName:b?.name||void 0,chainId:v||void 0,nativeSymbol:b?.nativeCurrency?.symbol||void 0,walletTokens:G,walletNfts:ee}),q=l.slice(-20);let Y="";if(q.length>0){Y=`
|
|
407
418
|
|
|
408
419
|
## CONVERSATION HISTORY:
|
|
409
|
-
`;for(const
|
|
410
|
-
`;else{const
|
|
411
|
-
`}
|
|
420
|
+
`;for(const re of q)if(re.sender==="user")Y+=`User: ${re.text}
|
|
421
|
+
`;else{const J=re.text.length>400?re.text.substring(0,400)+"...":re.text;Y+=`Assistant: ${J}
|
|
422
|
+
`}Y+=`
|
|
412
423
|
---
|
|
413
|
-
`}let
|
|
424
|
+
`}let ie=M?.trim();U&&(ie=`[Replying to ${U.sender==="user"?"my previous":"your"} message: "${U.text}"]
|
|
414
425
|
|
|
415
|
-
${
|
|
426
|
+
${ie}`);const ye=await Oi({prompt:ie,model:"gpt-4.1-mini",stream:!1,systemPrompt:K+Y});if(ye.success&&ye.data){const re=ye.data.text||"";let J=null;try{let I=re?.trim();I.startsWith("```json")?I=I.replace(/^```json\s*/,"").replace(/\s*```$/,""):I.startsWith("```")&&(I=I.replace(/^```\s*/,"").replace(/\s*```$/,"")),J=JSON.parse(I)}catch{J=null}if(J&&J.action&&J.action!=="chat")if(J.action==="buy_token"){const I=J.parameters?.token_symbol||"";let O=J.parameters?.contract_address||"",Q=18;if(O.toLowerCase()==="native"&&(O=Ge),O&&O!==Ge)try{const H=await tt.getTokensDetails([O],g);H?.data?.[0]&&(Q=H.data[0].decimals||18)}catch(H){console.warn("getTokensDetails for buy_token failed:",H)}if(!O&&I&&i?.address)try{const H=await je({address:i.address,chain:y});if(H?.success&&H?.data?.result){const te=H.data.result,we=te.find(ae=>ae.token_address.toLowerCase()===O.toLowerCase())||te.find(ae=>ae.symbol.toUpperCase()===I.toUpperCase());we&&(O=we.token_address,Q=we.decimals)}if(!O){const te=b.tokenTrendingDefault||[],[we,ae]=await Promise.allSettled([tt.getTopGainers(g,"24h",10),tt.getTokensDetails(te,g)]),R=[];we.status==="fulfilled"&&we.value?.data&&R.push(...we.value.data),ae.status==="fulfilled"&&ae.value?.data&&R.push(...ae.value.data);const _=R.find($=>$.address?.toLowerCase()===O.toLowerCase())||R.find($=>$.symbol?.toUpperCase()===I.toUpperCase());_&&(O=_.address,Q=_.decimals||18)}}catch(H){console.warn("Token lookup for buy failed:",H)}O?(d(J.message||`🛒 I'll help you buy ${I}. Let me show your available tokens to trade with.`,"bot",Z.id),await me(O,Q)):(d(J.message||`I couldn't find the token "${I}" on this chain. Here are the trending tokens you can buy:`,"bot",Z.id),await be())}else if(J.action==="swap_token"){const I={...J.parameters||{}},O=I.token_in==="native"||I.token_in_symbol?.toUpperCase()===b?.nativeCurrency?.symbol?.toUpperCase(),Q=I.token_out==="native"||I.token_out_symbol?.toUpperCase()===b?.nativeCurrency?.symbol?.toUpperCase();if(Q&&(I.token_out=Ge),!O&&(I.token_in||I.token_in_symbol)&&i?.address)try{const ae=await je({address:i.address,chain:y});if(ae?.success&&ae?.data?.result){const R=ae.data.result,_=I.token_in?R.find($=>$.token_address.toLowerCase()===I.token_in.toLowerCase()):R.find($=>$.symbol.toUpperCase()===I.token_in_symbol.toUpperCase());_&&(I.token_in=_.token_address,I.token_in_decimals=String(_.decimals))}}catch(ae){console.warn("Resolve token_in failed:",ae)}if(!Q&&(I.token_out||I.token_out_symbol)&&i?.address)try{const ae=await je({address:i.address,chain:y});if(ae?.success&&ae?.data?.result){const R=ae.data.result,_=I.token_out?R.find($=>$.token_address.toLowerCase()===I.token_out.toLowerCase()):R.find($=>$.symbol.toUpperCase()===I.token_out_symbol.toUpperCase());_&&(I.token_out=_.token_address,I.token_out_decimals=String(_.decimals))}}catch(ae){console.warn("Resolve token_out failed:",ae)}const H=!!(I.token_in||O),te=!!I.token_out,we=!!I.amount;if(H&&te&&we){d(J.message||"🔄 Preparing your swap...","bot",Z.id);try{const ae=[];I.token_out&&ae.push(I.token_out),I.token_in&&!O&&ae.push(I.token_in);let R=18,_=18;if(ae.length>0)try{const de=await tt.getTokensDetails(ae,g);if(de?.data)for(const Ee of de.data)!O&&Ee.address.toLowerCase()===I.token_in?.toLowerCase()&&(R=Ee.decimals||18),Ee.address.toLowerCase()===I.token_out?.toLowerCase()&&(_=Ee.decimals||18)}catch(de){console.warn("getTokensDetails failed, using default decimals:",de)}if(i?.address)try{const de=await je({address:i.address,chain:y});if(de?.success&&de?.data?.result){const Ee=de.data.result;if(O){const Pe=Ee.find(nt=>nt.native_token);let Ne=Pe?.balance_formatted||"0";try{const nt=await uo({chainId:v,rpcUrl:k});if(nt.isGreaterThan(0)){const dt=nt.times(1e6),Ft=new ce(Pe?.balance||"0").minus(dt);Ft.isGreaterThan(0)?Ne=ce(Ue(BigInt(Ft.toFixed(0)),Pe?.decimals||18)).toFixed():Ne="0"}}catch(nt){console.warn("getGasPrice for swap native fee deduction failed:",nt)}I.amount=fo(I.amount,Ne);const _e=parseFloat(Ne),Xe=parseFloat(I.amount);if(_e<Xe){d(r("swapInsufficientNativeBalance",{balance:_e.toFixed(6),symbol:b?.nativeCurrency?.symbol||"native",amount:I.amount}),"bot"),m(!1);return}}else{const Pe=Ee.find(Xe=>Xe.token_address.toLowerCase()===I.token_in?.toLowerCase());if(!Pe){d(r("swapTokenNotInWallet",{symbol:I.token_in_symbol||I.token_in}),"bot"),m(!1);return}I.amount=fo(I.amount,Pe.balance_formatted||"0");const Ne=parseFloat(Pe.balance_formatted||"0"),_e=parseFloat(I.amount);if(Ne<_e){d(r("swapInsufficientTokenBalance",{balance:Ne.toFixed(6),symbol:Pe.symbol,amount:I.amount}),"bot"),m(!1);return}}}}catch(de){console.warn("Balance check failed:",de)}const $=O?Ge:I.token_in;z({srcTokenAddress:$,descTokenAddress:I.token_out,amount:I.amount,srcTokenDecimals:R,descTokenDecimals:_});const ge=mt(I.amount,R).toString(),Be=await ro({chainId:v,tokenIn:$,tokenInAmount:ge,tokenOut:I.token_out,tokenOutRecipient:i?.address||"",slippage:"auto",accesstoken:"d6c45897b8f6"});if(Be.success&&Be.data){const de=Be.data,Ee=de.tokenIn,Pe=de.tokenOut,Ne=ce(Ue(BigInt(Ee.amount||0),Ee.decimals)).decimalPlaces(6).toFormat(),_e=ce(Ue(BigInt(Pe.amount||0),Pe.decimals)).decimalPlaces(6).toFormat();let Xe=!1;if(!O&&i?.address&&de.tx?.to)try{const Oe=await lo({tokenAddress:$,ownerAddress:i.address,spenderAddress:de.tx.to,chainId:v,rpcUrl:k});Xe=ce(Oe.toString()).isLessThan(ge)}catch(Oe){console.warn("Allowance check failed (CASE 1):",Oe),Xe=!0}const nt=de.estimatedTransactionFee?.total?ce(de.estimatedTransactionFee.total):ce(0);let dt=ce(0);if(Xe&&i?.address)try{const Oe=vn({tokenAddress:$,spenderAddress:de.tx?.to||"",fromAddress:i.address,chainId:v});dt=await sn({from:i.address,to:Oe.to,data:Oe.data,chainId:v,rpcUrl:k})}catch(Oe){console.warn("Approve fee estimation failed:",Oe)}const rt=nt.plus(dt),Ft=b?.nativeCurrency?.symbol||"native";let Ke="",rn=!1;if(i?.address&&rt.isGreaterThan(0))try{const Oe=await kn({address:i.address,chainId:v,rpcUrl:k});if(Oe.isLessThan(rt)){rn=!0;const An=ce(Ue(BigInt(Oe.toFixed(0)),18)).decimalPlaces(6).toFormat(),Tn=ce(Ue(BigInt(rt.toFixed(0)),18)).decimalPlaces(6).toFormat();Ke=r("swapFeeWarning",{symbol:Ft,balance:An,needed:Tn})}}catch(Oe){console.warn("Fee balance check failed:",Oe)}const Gt=`From: ${Ne} ${Ee.symbol}
|
|
416
427
|
⬇️
|
|
417
|
-
To: ${
|
|
428
|
+
To: ${_e} ${Pe.symbol}
|
|
418
429
|
|
|
419
|
-
`+
|
|
420
|
-
`;if(Xe)d(Vt,"bot");else if(Je){const Oe=[{id:"approve-for-swap",text:r("swapApproveButton",{symbol:Te.symbol}),value:r("swapApproveValue",{symbol:Te.symbol}),action:"approve_for_swap",fullWidth:!0,extraData:{tokenAddress:U,spenderAddress:ue.tx.to,tokenSymbol:Te.symbol,tx:ue.tx}}];d(Vt+r("swapNeedApprove",{symbol:Te.symbol}),"bot",void 0,Oe)}else{const Oe=[{id:"confirm-swap",text:"Yes",value:a("swapConfirmValue"),action:"confirm_swap",extraData:{tx:ue.tx}}];d(Vt+a("swapReadyToProceed"),"bot",void 0,Oe)}}else d(r("swapEstimationError",{error:Ee.errorMessage||Ee.error||"Unknown error"}),"bot")}catch(j){console.error("Swap estimation error:",j),d(a("swapEstimationFailed"),"bot")}}else if(J&&ee&&!fe){let j=Y?18:parseInt(D.token_in_decimals||"18",10),oe=parseInt(D.token_out_decimals||"18",10);const H=[];if(D.token_out&&H.push(D.token_out),D.token_in&&!Y&&H.push(D.token_in),H.length>0)try{const U=await et.getTokensDetails(H,h);if(U?.data)for(const ce of U.data)!Y&&ce.address.toLowerCase()===D.token_in?.toLowerCase()&&(j=ce.decimals||j),ce.address.toLowerCase()===D.token_out?.toLowerCase()&&(oe=ce.decimals||oe)}catch(U){console.warn("getTokensDetails failed in CASE 2, using fallback decimals:",U)}if(V({descTokenAddress:D.token_out,descTokenDecimals:oe}),Y)try{const U=await Ye({address:i?.address||"",chain:y});if(U?.success&&U?.data?.result){const Ee=U.data.result.find(De=>De.native_token),ue=m?.nativeCurrency?.symbol||"ETH";let Te=Ee?.balance_formatted||"0";try{const De=await co({chainId:v,rpcUrl:k});if(De.isGreaterThan(0)){const Je=De.times(1e6),ct=new le(Ee?.balance||"0").minus(Je);ct.isGreaterThan(0)?Te=le(Ue(BigInt(ct.toFixed(0)),Ee?.decimals||18)).toFixed():Te="0"}}catch(De){console.warn("getGasPrice for swap native fee deduction (CASE 2) failed:",De)}V({srcTokenAddress:Ve,srcTokenDecimals:j});const Ie=[25,50,75,100].map(De=>({id:`percent-${De}`,text:`${De}%`,value:r("buttonUsePercent",{percent:String(De),symbol:ue}),action:"select_percent",extraData:{percent:De,tokenAddress:Ve,tokenSymbol:ue,tokenBalance:Te}}));d(r("selectAmountToSwap",{symbol:ue,balance:Te}),"bot",Z.id,Ie)}else d(a("couldNotFetchBalance"),"bot")}catch(U){console.warn("Native balance fetch failed:",U),d(a("couldNotFetchBalanceRetry"),"bot")}else{const U=D.token_in_symbol||"Token";V({srcTokenAddress:D.token_in,srcTokenDecimals:j});try{const ce=await Ye({address:i?.address||"",chain:y});if(ce?.success&&ce?.data?.result){const ue=ce.data.result.find(Ie=>Ie.token_address.toLowerCase()===D.token_in?.toLowerCase());if(!ue){d(r("swapTokenNotInWallet",{symbol:U}),"bot"),g(!1);return}const Be=[25,50,75,100].map(Ie=>({id:`percent-${Ie}`,text:`${Ie}%`,value:r("buttonUsePercent",{percent:String(Ie),symbol:ue.symbol}),action:"select_percent",extraData:{percent:Ie,tokenAddress:ue.token_address,tokenSymbol:ue.symbol,tokenBalance:ue.balance_formatted}}));d(r("selectAmountToSwap",{symbol:ue.symbol,balance:`${ue.balance_formatted} (~$${ue.usd_value?.toFixed(2)||"0"})`}),"bot",Z.id,Be)}else d(a("couldNotFetchBalance"),"bot")}catch(ce){console.warn("Token balance fetch failed:",ce),d(a("couldNotFetchBalanceRetry"),"bot")}}}else if(!J&&ee){d(_.message||"🔄 Please choose which token you want to swap from:","bot",Z.id);let j=parseInt(D.token_out_decimals||"18",10);if(D.token_out)try{const oe=await et.getTokensDetails([D.token_out],h);oe?.data?.[0]&&(j=oe.data[0].decimals||j)}catch(oe){console.warn("getTokensDetails failed in CASE 3, using fallback:",oe)}await be(D.token_out,j)}else if(J&&!ee){let j=Y?18:parseInt(D.token_in_decimals||"18",10);if(D.token_in&&!Y)try{const oe=await et.getTokensDetails([D.token_in],h);oe?.data?.[0]&&(j=oe.data[0].decimals||j)}catch(oe){console.warn("getTokensDetails failed in CASE 4, using fallback:",oe)}V(Y?{srcTokenAddress:Ve,srcTokenDecimals:18}:{srcTokenAddress:D.token_in,srcTokenDecimals:j}),d(_.message||`🔄 You want to swap ${D.token_in_symbol||"your token"}. Please choose which token you want to receive:`,"bot",Z.id);try{g(!0);const oe=m?.tokenTrendingDefault||[],[H,U]=await Promise.allSettled([et.getTopGainers(h,"24h",5),et.getTokensDetails(oe,h)]);let ce=[];H.status==="fulfilled"&&H.value?.data&&(ce=[...H.value.data]),U.status==="fulfilled"&&U.value?.data&&(ce=[...U.value.data,...ce]),ce=ce.filter((ue,Te,Be)=>Te===Be.findIndex(Ie=>Ie.address.toLowerCase()===ue.address.toLowerCase()));const Ee=ce.map(ue=>({id:ue?.symbol,text:ue?.symbol,value:r("buttonSwapTo",{name:ue.name,symbol:ue?.symbol||""}),action:"click_swap_dest_token",extraData:{tokenAddress:ue?.address||"",symbol:ue?.symbol||"",decimals:ue?.decimals||18}}));d(r("trendingTokensForReceive",{chain:m?.name||"Unknown"}),"bot",void 0,Ee)}catch(oe){console.error("Error fetching trending tokens for swap:",oe),d(a("couldNotLoadTokenList"),"bot")}finally{g(!1)}}else d(_.message||'🔄 I need more details for your swap. Please specify which tokens you want to swap (e.g. "Swap 1 ETH to USDC").',"bot",Z.id)}else if(_.action==="view_balances")d(_.message||a("viewBalancesLoading"),"bot",Z.id),await He();else if(_.action==="view_nfts")d(_.message||"🖼️ Let me show you your NFT collection!","bot",Z.id),await Se();else if(_.action==="send_token"&&!_.parameters?.contract_address&&!_.parameters?.token_symbol&&i?.address){d("💰 Which token would you like to send?","bot",Z.id);try{g(!0);const D=await Ye({address:i.address,chain:y});if(D?.success&&D?.data?.result&&D.data.result.length>0){const Q=D.data.result.map(J=>({id:`send-select-${J.token_address}`,text:`Send ${J.name} (${J.symbol})`,value:`Send ${J.name} (${J.symbol})`,action:"suggested_action",fullWidth:!0}));await nt(500),g(!1),d(r("walletBalanceSpendable",{chain:m?.name||"this chain"}),"bot",void 0,Q)}else g(!1),d(r("walletNoTokensFound",{chain:m?.name||"this chain"}),"bot")}catch(D){console.warn("Failed to fetch balance for send_token picker:",D),g(!1),d(a("walletFetchError"),"bot")}}else if(_.action==="send_nft"&&!_.parameters?.contract_address&&!_.parameters?.token_id&&!_.parameters?.nft_name&&i?.address)d("Which NFT would you like to send?","bot",Z.id),await Se();else{const D=tc(_.action);let Y={..._.parameters||{}},Q;const J=["send_token","approve_token"].includes(_.action)&&(Y.contract_address||Y.token_symbol),ee=_.action==="send_native",fe=_.action==="send_nft"&&Y.contract_address;if(J&&i?.address)try{const j=await Ye({address:i.address,chain:y});if(j?.success&&j?.data?.result){const oe=j.data.result,H=Y.contract_address?oe.find(U=>U.token_address.toLowerCase()===Y.contract_address.toLowerCase()):oe.find(U=>U.symbol.toUpperCase()===Y.token_symbol.toUpperCase());H&&(Y={...Y,contract_address:H.token_address,decimals:String(H.decimals)},Q={symbol:H.symbol,name:H.name,balance:H.balance,balanceFormatted:H.balance_formatted,usdValue:H.usd_value,usdPrice:H.usd_price,decimals:H.decimals,logo:H.logo||H.thumbnail,contractAddress:H.token_address})}}catch(j){console.warn("Token enrichment failed:",j)}if(J&&!Q&&Y.contract_address)try{const j=await Fi({address:Y.contract_address,chain:y});if(j?.success&&j?.data){const oe=j.data;Q={symbol:oe.symbol,name:oe.name,balance:"0",balanceFormatted:"0",usdPrice:oe.usd_price,decimals:oe.decimals,logo:oe.logo,contractAddress:Y.contract_address},Y={...Y,decimals:String(oe.decimals)}}}catch(j){console.warn("Token metadata fallback failed:",j)}if(ee&&i?.address)try{const j=await Ye({address:i.address,chain:y});if(j?.success&&j?.data?.result){const H=j.data.result.find(U=>U.native_token);if(H){let U=H.balance_formatted,ce=H.balance;try{const Ee=new le(H.balance),ue="0x"+BigInt(Ee.toFixed(0)).toString(16),Te=await nn({from:i.address,to:i.address,data:"0x",value:ue,chainId:v,rpcUrl:k});if(Te.isGreaterThan(0)){const Be=Ee.minus(Te);Be.isGreaterThan(0)?(ce=Be.toFixed(0),U=le(Ue(BigInt(Be.toFixed(0)),H.decimals)).toFixed()):(ce="0",U="0")}}catch(Ee){console.warn("Estimate send fee for send_native failed:",Ee)}Q={symbol:H.symbol,name:H.name,balance:ce,balanceFormatted:U,usdValue:H.usd_value,usdPrice:H.usd_price,decimals:H.decimals,logo:H.logo||H.thumbnail,contractAddress:Ve}}}}catch(j){console.warn("Native token balance fetch failed:",j)}if(fe)try{const j=await Ui({address:Y.contract_address,chain:y});if(j?.success&&j?.data){const oe=j.data;oe.contract_type&&(Y={...Y,token_standard:oe.contract_type}),!Y.nft_name&&oe.name&&(Y={...Y,nft_name:oe.name})}}catch(j){console.warn("NFT contract metadata fetch failed:",j)}if(Y.amount&&Q?.balanceFormatted&&(_.action==="send_token"||_.action==="send_native")&&(Y.amount=lo(Y.amount,Q.balanceFormatted)),D){const j=_.message||"Please review and complete the form below.";d(j,"bot",Z.id,void 0,{action:_.action,parameters:Y,status:"pending",tokenInfo:Q})}else d(_.message||me,"bot",Z.id)}else if(_&&_.action==="chat"){const D=_.token_mentions||[],Y=_.suggested_actions||[],Q=[];D.length>0&&D.forEach(J=>{Q.push({id:`buy-${J.symbol}`,text:`💰 Buy ${J.symbol}`,value:r("buttonBuySymbol",{symbol:J.symbol}),action:"click_buy_item_token_button",extraData:{tokenAddress:J.contract_address||"",symbol:J.symbol,decimals:J.decimals||18},fullWidth:!0})}),Y.length>0&&Y.forEach((J,ee)=>{Q.push({id:`suggested-${ee}-${J.label}`,text:J.label,value:J.prompt,action:"suggested_action",fullWidth:!0})}),Q.length>0?d(_.message||me,"bot",Z.id,Q):d(_.message||me,"bot",Z.id)}else d(me,"bot",Z.id)}else d(a("errorProcessingRequest"),"bot",Z.id)}catch($){console.error("Error getting AI response:",$),d(a("errorProcessingRequest"),"bot",Z.id)}g(!1),await nt(50),Ht.isDesktop&&he.current?.focus()},[M,S,l,d,K,i?.address,m?.name,m?.nativeCurrency?.symbol,m?.tokenTrendingDefault,v,h,y,b,be,ge,Se,He,V,k,a,r]);se.useEffect(()=>{ye.current&&M===ye.current&&(ye.current=null,Pe())},[M,Pe]);const ze=se.useCallback(async(O,Z,$)=>{try{if(E($,"submitted"),O==="swap_token"){let te=18;if(Z.token_in&&Z.token_in!==Ve)try{const q=await et.getTokensDetails([Z.token_in],h);q?.data?.[0]&&(te=q.data[0].decimals||18)}catch(q){console.warn("getTokensDetails failed in ActionForm swap, using default 18:",q)}const X=pt(Z.amount||"0",te).toString(),W=await so({chainId:v,tokenIn:Z.token_in||"",tokenInAmount:X,tokenOut:Z.token_out||"",tokenOutRecipient:i?.address||"",slippage:"auto",accesstoken:"d6c45897b8f6"});if(W.success&&W.data){const q=W.data,ie=q.tokenIn,me=q.tokenOut,_=le(Ue(BigInt(ie.amount||0),ie.decimals)).decimalPlaces(6).toFormat(),D=le(Ue(BigInt(me.amount||0),me.decimals)).decimalPlaces(6).toFormat(),Y=!Z.token_in||Z.token_in===Ve;let Q=!1;if(!Y&&i?.address&&q.tx?.to)try{const ce=await io({tokenAddress:Z.token_in,ownerAddress:i.address,spenderAddress:q.tx.to,chainId:v,rpcUrl:k});Q=le(ce.toString()).isLessThan(X)}catch(ce){console.warn("Allowance check failed in ActionForm swap:",ce)}const J=q.estimatedTransactionFee?.total?le(q.estimatedTransactionFee.total):le(0);let ee=le(0);if(Q&&i?.address)try{const ce=gn({tokenAddress:Z.token_in,spenderAddress:q.tx?.to||"",fromAddress:i.address,chainId:v});ee=await nn({from:i.address,to:ce.to,data:ce.data,chainId:v,rpcUrl:k})}catch(ce){console.warn("Approve fee estimation failed:",ce)}const fe=J.plus(ee),j=m?.nativeCurrency?.symbol||"native";let oe="",H=!1;if(i?.address&&fe.isGreaterThan(0))try{const ce=await yn({address:i.address,chainId:v,rpcUrl:k});if(ce.isLessThan(fe)){H=!0;const Ee=le(Ue(BigInt(ce.toFixed(0)),18)).decimalPlaces(6).toFormat(),ue=le(Ue(BigInt(fe.toFixed(0)),18)).decimalPlaces(6).toFormat();oe=r("swapFeeWarning",{symbol:j,balance:Ee,needed:ue})}}catch(ce){console.warn("Fee balance check failed:",ce)}const U=`From: ${_} ${ie.symbol}
|
|
430
|
+
`+Ke+`
|
|
431
|
+
`;if(rn)d(Gt,"bot");else if(Xe){const Oe=[{id:"approve-for-swap",text:r("swapApproveButton",{symbol:Ee.symbol}),value:r("swapApproveValue",{symbol:Ee.symbol}),action:"approve_for_swap",fullWidth:!0,extraData:{tokenAddress:$,spenderAddress:de.tx.to,tokenSymbol:Ee.symbol,tx:de.tx}}];d(Gt+r("swapNeedApprove",{symbol:Ee.symbol}),"bot",void 0,Oe)}else{const Oe=[{id:"confirm-swap",text:"Yes",value:a("swapConfirmValue"),action:"confirm_swap",extraData:{tx:de.tx}}];d(Gt+a("swapReadyToProceed"),"bot",void 0,Oe)}}else d(r("swapEstimationError",{error:Be.errorMessage||Be.error||"Unknown error"}),"bot")}catch(ae){console.error("Swap estimation error:",ae),d(a("swapEstimationFailed"),"bot")}}else if(H&&te&&!we){let ae=O?18:parseInt(I.token_in_decimals||"18",10),R=parseInt(I.token_out_decimals||"18",10);const _=[];if(I.token_out&&_.push(I.token_out),I.token_in&&!O&&_.push(I.token_in),_.length>0)try{const $=await tt.getTokensDetails(_,g);if($?.data)for(const ge of $.data)!O&&ge.address.toLowerCase()===I.token_in?.toLowerCase()&&(ae=ge.decimals||ae),ge.address.toLowerCase()===I.token_out?.toLowerCase()&&(R=ge.decimals||R)}catch($){console.warn("getTokensDetails failed in CASE 2, using fallback decimals:",$)}if(z({descTokenAddress:I.token_out,descTokenDecimals:R}),O)try{const $=await je({address:i?.address||"",chain:y});if($?.success&&$?.data?.result){const Be=$.data.result.find(_e=>_e.native_token),de=b?.nativeCurrency?.symbol||"ETH";let Ee=Be?.balance_formatted||"0";try{const _e=await uo({chainId:v,rpcUrl:k});if(_e.isGreaterThan(0)){const Xe=_e.times(1e6),dt=new ce(Be?.balance||"0").minus(Xe);dt.isGreaterThan(0)?Ee=ce(Ue(BigInt(dt.toFixed(0)),Be?.decimals||18)).toFixed():Ee="0"}}catch(_e){console.warn("getGasPrice for swap native fee deduction (CASE 2) failed:",_e)}z({srcTokenAddress:Ge,srcTokenDecimals:ae});const Ne=[25,50,75,100].map(_e=>({id:`percent-${_e}`,text:`${_e}%`,value:r("buttonUsePercent",{percent:String(_e),symbol:de}),action:"select_percent",extraData:{percent:_e,tokenAddress:Ge,tokenSymbol:de,tokenBalance:Ee}}));d(r("selectAmountToSwap",{symbol:de,balance:Ee}),"bot",Z.id,Ne)}else d(a("couldNotFetchBalance"),"bot")}catch($){console.warn("Native balance fetch failed:",$),d(a("couldNotFetchBalanceRetry"),"bot")}else{const $=I.token_in_symbol||"Token";z({srcTokenAddress:I.token_in,srcTokenDecimals:ae});try{const ge=await je({address:i?.address||"",chain:y});if(ge?.success&&ge?.data?.result){const de=ge.data.result.find(Ne=>Ne.token_address.toLowerCase()===I.token_in?.toLowerCase());if(!de){d(r("swapTokenNotInWallet",{symbol:$}),"bot"),m(!1);return}const Pe=[25,50,75,100].map(Ne=>({id:`percent-${Ne}`,text:`${Ne}%`,value:r("buttonUsePercent",{percent:String(Ne),symbol:de.symbol}),action:"select_percent",extraData:{percent:Ne,tokenAddress:de.token_address,tokenSymbol:de.symbol,tokenBalance:de.balance_formatted}}));d(r("selectAmountToSwap",{symbol:de.symbol,balance:`${de.balance_formatted} (~$${de.usd_value?.toFixed(2)||"0"})`}),"bot",Z.id,Pe)}else d(a("couldNotFetchBalance"),"bot")}catch(ge){console.warn("Token balance fetch failed:",ge),d(a("couldNotFetchBalanceRetry"),"bot")}}}else if(!H&&te){d(J.message||"🔄 Please choose which token you want to swap from:","bot",Z.id);let ae=parseInt(I.token_out_decimals||"18",10);if(I.token_out)try{const R=await tt.getTokensDetails([I.token_out],g);R?.data?.[0]&&(ae=R.data[0].decimals||ae)}catch(R){console.warn("getTokensDetails failed in CASE 3, using fallback:",R)}await me(I.token_out,ae)}else if(H&&!te){let ae=O?18:parseInt(I.token_in_decimals||"18",10);if(I.token_in&&!O)try{const R=await tt.getTokensDetails([I.token_in],g);R?.data?.[0]&&(ae=R.data[0].decimals||ae)}catch(R){console.warn("getTokensDetails failed in CASE 4, using fallback:",R)}z(O?{srcTokenAddress:Ge,srcTokenDecimals:18}:{srcTokenAddress:I.token_in,srcTokenDecimals:ae}),d(J.message||`🔄 You want to swap ${I.token_in_symbol||"your token"}. Please choose which token you want to receive:`,"bot",Z.id);try{m(!0);const R=b?.tokenTrendingDefault||[],[_,$]=await Promise.allSettled([tt.getTopGainers(g,"24h",5),tt.getTokensDetails(R,g)]);let ge=[];_.status==="fulfilled"&&_.value?.data&&(ge=[..._.value.data]),$.status==="fulfilled"&&$.value?.data&&(ge=[...$.value.data,...ge]),ge=ge.filter((de,Ee,Pe)=>Ee===Pe.findIndex(Ne=>Ne.address.toLowerCase()===de.address.toLowerCase()));const Be=ge.map(de=>({id:de?.symbol,text:de?.symbol,value:r("buttonSwapTo",{name:de.name,symbol:de?.symbol||""}),action:"click_swap_dest_token",extraData:{tokenAddress:de?.address||"",symbol:de?.symbol||"",decimals:de?.decimals||18}}));d(r("trendingTokensForReceive",{chain:b?.name||"Unknown"}),"bot",void 0,Be)}catch(R){console.error("Error fetching trending tokens for swap:",R),d(a("couldNotLoadTokenList"),"bot")}finally{m(!1)}}else d(J.message||'🔄 I need more details for your swap. Please specify which tokens you want to swap (e.g. "Swap 1 ETH to USDC").',"bot",Z.id)}else if(J.action==="view_balances")d(J.message||a("viewBalancesLoading"),"bot",Z.id),await We();else if(J.action==="view_nfts")d(J.message||"🖼️ Let me show you your NFT collection!","bot",Z.id),await xe();else if(J.action==="send_token"&&!J.parameters?.contract_address&&!J.parameters?.token_symbol&&i?.address){d("💰 Which token would you like to send?","bot",Z.id);try{m(!0);const I=await je({address:i.address,chain:y});if(I?.success&&I?.data?.result&&I.data.result.length>0){const Q=I.data.result.map(H=>({id:`send-select-${H.token_address}`,text:`Send ${H.name} (${H.symbol})`,value:`Send ${H.name} (${H.symbol})`,action:"suggested_action",fullWidth:!0}));await ot(500),m(!1),d(r("walletBalanceSpendable",{chain:b?.name||"this chain"}),"bot",void 0,Q)}else m(!1),d(r("walletNoTokensFound",{chain:b?.name||"this chain"}),"bot")}catch(I){console.warn("Failed to fetch balance for send_token picker:",I),m(!1),d(a("walletFetchError"),"bot")}}else if(J.action==="send_nft"&&!J.parameters?.contract_address&&!J.parameters?.token_id&&!J.parameters?.nft_name&&i?.address)d("Which NFT would you like to send?","bot",Z.id),await xe();else if(J.action==="send_nft"&&!Re(J.parameters?.contract_address||"")&&(J.parameters?.nft_name||J.parameters?.token_id)&&i?.address)try{m(!0);const I=await wn({address:i.address,chain:y,limit:100,exclude_spam:!1});if(I?.success&&I?.data?.result){const O=I.data.result,Q=(J.parameters?.nft_name||"").toLowerCase(),H=J.parameters?.token_id||"",te=O.find(we=>{const ae=(we.normalized_metadata?.name||we.name||"").toLowerCase(),R=(we.name||"").toLowerCase(),_=Q&&(ae.includes(Q)||R.includes(Q)),$=H&&we.token_id===H;return Q&&H?_&&$:Q?_:$});if(te){const we=te.normalized_metadata?.name||te.name||`#${te.token_id}`,ae=te.normalized_metadata?.image||te.media?.original_media_url||"",R={contract_address:te.token_address,token_id:te.token_id,to_address:J.parameters?.to_address||"",token_standard:te.contract_type||"",amount:"1",maxAmount:te.amount||"1",nft_name:we};d(J.message||r("nftSendReview",{name:we,standard:te.contract_type||"NFT",tokenId:te.token_id}),"bot",Z.id,void 0,{action:"send_nft",parameters:R,status:"pending",nftInfo:{name:we,image:ae||void 0,tokenId:te.token_id,contractAddress:te.token_address,tokenStandard:te.contract_type||void 0}})}else d(J.message||r("nftNotFoundInWallet",{name:Q||H}),"bot",Z.id),await xe()}else d(a("nftNoCollection"),"bot",Z.id)}catch(I){console.error("NFT lookup by name failed:",I),d(a("nftFetchError"),"bot",Z.id)}finally{m(!1)}else{const I=oc(J.action);let O={...J.parameters||{}},Q,H;const te=["send_token","approve_token"].includes(J.action)&&(O.contract_address||O.token_symbol),we=J.action==="send_native",ae=J.action==="send_nft"&&O.contract_address;if(te&&i?.address)try{const R=await je({address:i.address,chain:y});if(R?.success&&R?.data?.result){const _=R.data.result,$=O.contract_address?_.find(ge=>ge.token_address.toLowerCase()===O.contract_address.toLowerCase()):_.find(ge=>ge.symbol.toUpperCase()===O.token_symbol.toUpperCase());$&&(O={...O,contract_address:$.token_address,decimals:String($.decimals)},Q={symbol:$.symbol,name:$.name,balance:$.balance,balanceFormatted:$.balance_formatted,usdValue:$.usd_value,usdPrice:$.usd_price,decimals:$.decimals,logo:$.logo||$.thumbnail,contractAddress:$.token_address})}}catch(R){console.warn("Token enrichment failed:",R)}if(te&&!Q&&O.contract_address)try{const R=await Ui({address:O.contract_address,chain:y});if(R?.success&&R?.data){const _=R.data;Q={symbol:_.symbol,name:_.name,balance:"0",balanceFormatted:"0",usdPrice:_.usd_price,decimals:_.decimals,logo:_.logo,contractAddress:O.contract_address},O={...O,decimals:String(_.decimals)}}}catch(R){console.warn("Token metadata fallback failed:",R)}if(we&&i?.address)try{const R=await je({address:i.address,chain:y});if(R?.success&&R?.data?.result){const $=R.data.result.find(ge=>ge.native_token);if($){let ge=$.balance_formatted,Be=$.balance;try{const de=new ce($.balance),Ee="0x"+BigInt(de.toFixed(0)).toString(16),Pe=await sn({from:i.address,to:i.address,data:"0x",value:Ee,chainId:v,rpcUrl:k});if(Pe.isGreaterThan(0)){const Ne=de.minus(Pe);Ne.isGreaterThan(0)?(Be=Ne.toFixed(0),ge=ce(Ue(BigInt(Ne.toFixed(0)),$.decimals)).toFixed()):(Be="0",ge="0")}}catch(de){console.warn("Estimate send fee for send_native failed:",de)}Q={symbol:$.symbol,name:$.name,balance:Be,balanceFormatted:ge,usdValue:$.usd_value,usdPrice:$.usd_price,decimals:$.decimals,logo:$.logo||$.thumbnail,contractAddress:Ge}}}}catch(R){console.warn("Native token balance fetch failed:",R)}if(ae){try{const R=await Li({address:O.contract_address,chain:y});if(R?.success&&R?.data){const _=R.data;_.contract_type&&(O={...O,token_standard:_.contract_type}),!O.nft_name&&_.name&&(O={...O,nft_name:_.name})}}catch(R){console.warn("NFT contract metadata fetch failed:",R)}if(i?.address)try{const R=await wn({address:i.address,chain:y,limit:100,exclude_spam:!1});if(R?.success&&R?.data?.result){const _=R.data.result.find($=>$.token_address.toLowerCase()===O.contract_address.toLowerCase()&&$.token_id===O.token_id);if(_){O={...O,amount:"1",maxAmount:_.amount||"1"};const $=_.normalized_metadata?.image||_.media?.original_media_url||"";H={name:_.normalized_metadata?.name||_.name||O.nft_name||`#${_.token_id}`,image:$||void 0,tokenId:_.token_id,contractAddress:_.token_address,tokenStandard:_.contract_type||O.token_standard||void 0}}}}catch(R){console.warn("NFT ownership lookup failed:",R)}}if(O.amount&&Q?.balanceFormatted&&(J.action==="send_token"||J.action==="send_native")&&(O.amount=fo(O.amount,Q.balanceFormatted)),I){const R=J.message||"Please review and complete the form below.";d(R,"bot",Z.id,void 0,{action:J.action,parameters:O,status:"pending",tokenInfo:Q,nftInfo:H})}else d(J.message||re,"bot",Z.id)}else if(J&&J.action==="chat"){const I=J.token_mentions||[],O=J.suggested_actions||[],Q=[];I.length>0&&I.forEach(H=>{Q.push({id:`buy-${H.symbol}`,text:`💰 Buy ${H.symbol}`,value:r("buttonBuySymbol",{symbol:H.symbol}),action:"click_buy_item_token_button",extraData:{tokenAddress:H.contract_address||"",symbol:H.symbol,decimals:H.decimals||18},fullWidth:!0})}),O.length>0&&O.forEach((H,te)=>{Q.push({id:`suggested-${te}-${H.label}`,text:H.label,value:H.prompt,action:"suggested_action",fullWidth:!0})}),Q.length>0?d(J.message||re,"bot",Z.id,Q):d(J.message||re,"bot",Z.id)}else d(re,"bot",Z.id)}else d(a("errorProcessingRequest"),"bot",Z.id)}catch(G){console.error("Error getting AI response:",G),d(a("errorProcessingRequest"),"bot",Z.id)}m(!1),await ot(50),Wt.isDesktop&&fe.current?.focus()},[M,x,l,d,ke,i?.address,b?.name,b?.nativeCurrency?.symbol,b?.tokenTrendingDefault,v,g,y,w,me,be,xe,We,z,k,a,r]);ne.useEffect(()=>{pe.current&&M===pe.current&&(pe.current=null,Fe())},[M,Fe]);const qe=ne.useCallback(async(U,Z,G)=>{try{if(T(G,"submitted"),U==="swap_token"){let ee=18;if(Z.token_in&&Z.token_in!==Ge)try{const Y=await tt.getTokensDetails([Z.token_in],g);Y?.data?.[0]&&(ee=Y.data[0].decimals||18)}catch(Y){console.warn("getTokensDetails failed in ActionForm swap, using default 18:",Y)}const K=mt(Z.amount||"0",ee).toString(),q=await ro({chainId:v,tokenIn:Z.token_in||"",tokenInAmount:K,tokenOut:Z.token_out||"",tokenOutRecipient:i?.address||"",slippage:"auto",accesstoken:"d6c45897b8f6"});if(q.success&&q.data){const Y=q.data,ie=Y.tokenIn,ye=Y.tokenOut,re=ce(Ue(BigInt(ie.amount||0),ie.decimals)).decimalPlaces(6).toFormat(),J=ce(Ue(BigInt(ye.amount||0),ye.decimals)).decimalPlaces(6).toFormat(),I=!Z.token_in||Z.token_in===Ge;let O=!1;if(!I&&i?.address&&Y.tx?.to)try{const $=await lo({tokenAddress:Z.token_in,ownerAddress:i.address,spenderAddress:Y.tx.to,chainId:v,rpcUrl:k});O=ce($.toString()).isLessThan(K)}catch($){console.warn("Allowance check failed in ActionForm swap:",$)}const Q=Y.estimatedTransactionFee?.total?ce(Y.estimatedTransactionFee.total):ce(0);let H=ce(0);if(O&&i?.address)try{const $=vn({tokenAddress:Z.token_in,spenderAddress:Y.tx?.to||"",fromAddress:i.address,chainId:v});H=await sn({from:i.address,to:$.to,data:$.data,chainId:v,rpcUrl:k})}catch($){console.warn("Approve fee estimation failed:",$)}const te=Q.plus(H),we=b?.nativeCurrency?.symbol||"native";let ae="",R=!1;if(i?.address&&te.isGreaterThan(0))try{const $=await kn({address:i.address,chainId:v,rpcUrl:k});if($.isLessThan(te)){R=!0;const ge=ce(Ue(BigInt($.toFixed(0)),18)).decimalPlaces(6).toFormat(),Be=ce(Ue(BigInt(te.toFixed(0)),18)).decimalPlaces(6).toFormat();ae=r("swapFeeWarning",{symbol:we,balance:ge,needed:Be})}}catch($){console.warn("Fee balance check failed:",$)}const _=`From: ${re} ${ie.symbol}
|
|
421
432
|
⬇️
|
|
422
|
-
To: ${
|
|
433
|
+
To: ${J} ${ye.symbol}
|
|
423
434
|
|
|
424
|
-
`+
|
|
425
|
-
`;if(
|
|
426
|
-
[View on Explorer](${
|
|
427
|
-
Tx: ${
|
|
428
|
-
Error: ${
|
|
435
|
+
`+ae+`
|
|
436
|
+
`;if(R)T(G,"fail"),d(_,"bot");else if(O){const $=[{id:"approve-swap-actionform",text:r("swapApproveButton",{symbol:ie.symbol}),value:r("swapApproveValue",{symbol:ie.symbol}),action:"approve_for_swap",extraData:{tokenAddress:Z.token_in,spenderAddress:Y.tx.to,tokenSymbol:ie.symbol,tx:Y.tx},fullWidth:!0}];T(G,"success"),d(_+r("swapApprovalRequired",{symbol:ie.symbol}),"bot",void 0,$)}else{const $=[{id:"confirm-swap-actionform",text:"Yes",value:a("swapConfirmValue"),action:"confirm_swap",extraData:{tx:Y.tx}}];T(G,"success"),d(_+a("swapReadyToProceed"),"bot",void 0,$)}}else T(G,"fail"),d(r("swapEstimationError",{error:q.errorMessage||q.error||"Unknown error"}),"bot")}else{const ee=Ki({action:U,parameters:Z,fromAddress:i?.address||"",chainId:v||1}),K={from:ee.from,to:ee.to,data:ee.data,value:ee.value,chainId:ee.chainId};if((U==="send_token"||U==="send_native"||U==="send_nft")&&i?.address)try{const q=b?.nativeCurrency?.symbol||"native",Y=await sn({from:ee.from,to:ee.to,data:ee.data,value:ee.value&&ee.value!=="0"?`0x${BigInt(ee.value).toString(16)}`:void 0,chainId:v,rpcUrl:k});if(Y.isGreaterThan(0)){const ie=await kn({address:i.address,chainId:v,rpcUrl:k});if(ie.isLessThan(Y)){const ye=ce(Ue(BigInt(ie.toFixed(0)),18)).decimalPlaces(6).toFormat(),re=ce(Ue(BigInt(Y.toFixed(0)),18)).decimalPlaces(6).toFormat();T(G,"fail"),d(r("txInsufficientGas",{symbol:q,balance:ye,fee:re}),"bot");return}}}catch(q){console.warn("Pre-execution fee check failed:",q)}if(n){m(!1);const q=await n(K);if(q.status==="success"&&q.transactionHash){const Y=b?.blockExplorers?.default?.url,ie=Y?`
|
|
437
|
+
[View on Explorer](${Y}/tx/${q.transactionHash})`:`
|
|
438
|
+
Tx: ${q.transactionHash}`,ye=d(a("txSubmitted")+ie,"bot");try{await ot(2e3),(await co({transactionHash:q.transactionHash,chainId:v||1,rpcUrl:k})).status==="success"?(T(G,"success"),C(ye.id,a("txConfirmed")+ie)):(T(G,"fail"),C(ye.id,a("txReverted")+ie))}catch(re){console.warn("Transaction tracking timeout:",re),T(G,"success"),d(a("txTimeout")+ie,"bot")}}else if(q.status==="success")T(G,"success"),d(a("txSuccessful"),"bot");else{T(G,"fail");const Y=q.error?`
|
|
439
|
+
Error: ${q.error}`:"";d(a("txFailed")+Y,"bot")}}else T(G,"fail"),d(a("txNoHandler"),"bot")}}catch(ee){console.error("Action form submit error:",ee),T(G,"fail"),d(r("txError",{message:ee instanceof Error?ee.message:"Unknown error"}),"bot")}},[T,v,i?.address,g,d,n,b?.blockExplorers?.default?.url,b?.nativeCurrency?.symbol,C,k,a,r]),Me=ne.useCallback(U=>{T(U,"fail")},[T]),[De,Te]=ne.useState({}),Pt=ne.useCallback(async(U,Z,G)=>{Te(ee=>({...ee,[G]:!0}));try{await qe(U,Z,G)}finally{Te(ee=>({...ee,[G]:!1}))}},[qe]),Vt=ne.useCallback(U=>{U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),Fe())},[Fe]),bt=ne.useCallback(()=>{const U=window.getSelection();U&&U.toString().length>0||t()},[t]);return e?P.jsx("div",{className:`chat-modal-overlay${o==="bottom-left"?" chat-modal-overlay--left":""}`,onClick:bt,role:"dialog","aria-modal":"true","aria-labelledby":"chat-modal-title",children:P.jsxs("div",{className:"chat-modal",style:s,onClick:U=>U.stopPropagation(),children:[P.jsxs("div",{className:"chat-modal-header",children:[P.jsxs("div",{className:"chat-modal-header-left",children:[P.jsx("div",{className:"keyring-logo",children:P.jsx("img",{src:Mi,alt:"Keyring Logo",width:40,height:40})}),P.jsx("h3",{id:"chat-modal-title",children:a("chatTitle")})]}),P.jsx("button",{className:"close-button",onClick:t,"aria-label":a("closeChat"),type:"button",children:P.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:P.jsx("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),P.jsx(Ti,{address:i?.address,chainId:b?.chainId}),P.jsxs("div",{className:"chat-modal-messages-wrapper",children:[P.jsxs("div",{className:"chat-modal-messages",ref:X,role:"log","aria-live":"polite",children:[l.map((U,Z)=>P.jsxs("div",{children:[Je(Z)&&P.jsx("div",{className:"date-separator",children:bi(U.timestamp)}),P.jsxs("div",{className:`message ${U.sender==="user"?"message-user":"message-bot"}`,role:"article",children:[P.jsx("button",{className:"message-reply-button",onClick:()=>se(U),"aria-label":a("replyToMessage"),type:"button",children:P.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:P.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"})})}),P.jsxs("div",{className:"message-bubble",children:[U.replyTo&&P.jsxs("div",{className:"message-reply-to",children:[P.jsxs("div",{className:"message-reply-to-label",children:[a("replyingTo")," ",U.replyTo.sender==="user"?a("replyingToYou"):a("replyingToAgent")]}),P.jsx("div",{className:"message-reply-to-text",children:U.replyTo.text})]}),P.jsx("div",{className:"message-text",children:P.jsx(Vi,{content:U.text})}),U.buttons&&U.buttons.length>0&&P.jsx("div",{className:"message-buttons",children:U.buttons.map(G=>P.jsx("button",{className:`message-button ${G.fullWidth?"full-width":""} ${G.action==="suggested_action"?"suggested-action":""}`,onClick:()=>j(G.value,G.action,G?.extraData),type:"button",children:G.text},G.id))}),U.actionData&&U.actionData.status==="pending"&&P.jsx(qi,{action:U.actionData.action,initialValues:U.actionData.parameters,onSubmit:(G,ee)=>Pt(G,ee,U.id),onCancel:()=>Me(U.id),isSubmitting:De[U.id]||!1,tokenInfo:U.actionData.tokenInfo,nftInfo:U.actionData.nftInfo}),U.actionData&&U.actionData.status==="submitted"&&P.jsx("div",{className:"action-status action-status-submitted",children:a("actionProcessing")}),U.actionData&&U.actionData.status==="success"&&P.jsx("div",{className:"action-status action-status-success",children:a("actionSuccess")}),U.actionData&&U.actionData.status==="fail"&&P.jsx("div",{className:"action-status action-status-fail",children:a("actionFail")}),P.jsxs("div",{className:"message-timestamp",children:[U.timestamp.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}),U.sender==="user"&&P.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"check-icon",children:P.jsx("path",{d:"M13.3333 4L6 11.3333L2.66667 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})]})]},U.id)),x&&P.jsx("div",{className:"message message-bot typing-indicator",role:"status","aria-label":a("botIsTyping"),children:P.jsxs("div",{className:"message-bubble",children:[P.jsx("span",{className:"typing-dot"}),P.jsx("span",{className:"typing-dot"}),P.jsx("span",{className:"typing-dot"})]})}),(B||l.length===1)&&P.jsxs(P.Fragment,{children:[P.jsx("div",{className:"message message-bot",role:"article",children:P.jsx("div",{className:"message-bubble",children:P.jsx("div",{className:"message-text",children:a("canIHelpYou")})})}),P.jsx("div",{className:"suggestions-container",children:at.map(U=>P.jsxs("button",{className:"suggestion-button",onClick:U.action,type:"button",children:[P.jsx("span",{className:"suggestion-icon",children:U.icon}),P.jsx("span",{className:"suggestion-text",children:U.text})]},U.id))})]}),P.jsx("div",{ref:V})]}),P.jsx(Yi,{scrollContainerRef:X})]}),P.jsxs("div",{className:"chat-modal-input",children:[ke&&P.jsxs("div",{className:"reply-preview",children:[P.jsxs("div",{className:"reply-preview-content",children:[P.jsxs("div",{className:"reply-preview-label",children:[a("replyingTo")," ",ke.sender==="user"?a("replyingToYou"):a("replyingToAgent")]}),P.jsx("div",{className:"reply-preview-text",children:ke.text})]}),P.jsx("button",{className:"reply-preview-close",onClick:()=>N(null),"aria-label":a("cancelReply"),type:"button",children:P.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:P.jsx("path",{d:"M12 4L4 12M4 4L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),P.jsxs("div",{className:"chat-modal-input-row",children:[P.jsx("input",{ref:fe,type:"text",placeholder:a("messagePlaceholder"),value:M,onChange:U=>h(U.target.value),onKeyPress:Vt,disabled:x,"aria-label":"Message input"}),P.jsx("button",{className:"send-button",onClick:Fe,"aria-label":a("sendMessage"),disabled:x||M?.trim()==="",type:"button",children:P.jsx("img",{src:Ri,alt:"Send",width:44,height:44})})]})]})]})}):null},lc=({position:e,theme:t,defaultOpen:n,onOpen:o,onClose:s,onTransaction:a})=>{const[r,l]=ne.useState(n);ne.useEffect(()=>{n&&o&&o()},[]),ne.useEffect(()=>{if(typeof window>"u")return;const h=document.body,x=document.documentElement,m=h.style.overscrollBehavior,B=x.style.overscrollBehavior,L=h.style.overflow;return r&&(h.style.overscrollBehavior="none",x.style.overscrollBehavior="none",h.style.overflow="hidden"),()=>{h.style.overscrollBehavior=m,x.style.overscrollBehavior=B,h.style.overflow=L}},[r]);const d=ne.useCallback(()=>{l(!0),o?.()},[o]),T=ne.useCallback(()=>{l(!1),s?.()},[s]),C=ne.useCallback(()=>{r?T():d()},[r,d,T]),M={position:"fixed",[e==="bottom-right"?"right":"left"]:"20px",bottom:"20px",zIndex:t.zIndex??9999};return P.jsxs("div",{style:M,role:"complementary","aria-label":"Chat widget",children:[P.jsx(Vs,{onClick:C}),P.jsx(cc,{isOpen:r,onClose:T,onTransaction:a,position:e,modalChatStyle:t.modalChatStyle})]})},dc=({position:e="bottom-right",theme:t={},defaultOpen:n=!1,onOpen:o,onClose:s,account:a,onTransaction:r,language:l="en",rpcUrls:d})=>{const T={position:e,theme:t,rpcUrls:d};return typeof window>"u"?null:P.jsx(Pi,{initialConfig:T,children:P.jsx(Ai,{initialAccount:a,children:P.jsx(Ws,{initialLanguage:l,children:P.jsx(lc,{position:e,theme:t,defaultOpen:n,onOpen:o,onClose:s,onTransaction:r})})})})};gt.ChatWidget=dc,Object.defineProperty(gt,Symbol.toStringTag,{value:"Module"})}));
|