(function () { 'use strict'; const API = 'https://hermes.squaremcp.com/api/chat'; const BRAND = '#6c47ff'; const BRAND_DARK = '#5535e0'; const css = ` #smcp-btn { position: fixed; bottom: 24px; right: 24px; z-index: 9998; width: 56px; height: 56px; border-radius: 50%; background: ${BRAND}; border: none; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,0.18); display: flex; align-items: center; justify-content: center; transition: background 0.2s; } #smcp-btn:hover { background: ${BRAND_DARK}; } #smcp-btn svg { width: 26px; height: 26px; } #smcp-window { position: fixed; bottom: 92px; right: 24px; z-index: 9999; width: 360px; height: 520px; border-radius: 16px; background: #fff; box-shadow: 0 8px 40px rgba(0,0,0,0.18); display: flex; flex-direction: column; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; } #smcp-window.hidden { display: none; } #smcp-header { background: ${BRAND}; color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; flex-shrink: 0; } #smcp-header span { flex: 1; } #smcp-close { background: none; border: none; color: #fff; cursor: pointer; font-size: 20px; line-height: 1; padding: 0; } #smcp-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; } .smcp-msg { max-width: 80%; padding: 9px 13px; border-radius: 12px; line-height: 1.45; word-break: break-word; } .smcp-msg.bot { background: #f1f0fe; color: #1a1a2e; border-bottom-left-radius: 4px; align-self: flex-start; } .smcp-msg.user { background: ${BRAND}; color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; } .smcp-msg.typing { color: #888; font-style: italic; } #smcp-input-row { padding: 10px 12px; border-top: 1px solid #eee; display: flex; gap: 8px; flex-shrink: 0; } #smcp-input { flex: 1; border: 1px solid #ddd; border-radius: 8px; padding: 8px 12px; font-size: 14px; outline: none; font-family: inherit; resize: none; line-height: 1.4; } #smcp-input:focus { border-color: ${BRAND}; } #smcp-send { background: ${BRAND}; color: #fff; border: none; border-radius: 8px; padding: 0 14px; cursor: pointer; font-size: 18px; transition: background 0.2s; } #smcp-send:hover { background: ${BRAND_DARK}; } #smcp-send:disabled { background: #ccc; cursor: default; } @media (max-width: 420px) { #smcp-window { width: calc(100vw - 24px); right: 12px; bottom: 80px; } } `; const WELCOME = "Hi! I'm the SquareMCP assistant. Ask me anything about connecting your AI agent to social platforms."; function inject() { const style = document.createElement('style'); style.textContent = css; document.head.appendChild(style); document.body.insertAdjacentHTML('beforeend', `