@ihoomanai/chat-widget 2.5.13 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- const e={serverUrl:"https://api.ihooman.ai",theme:"light",position:"bottom-right",title:"Chat Support",subtitle:"We typically reply within minutes",welcomeMessage:"Hi there! 👋 How can we help you today?",placeholder:"Type a message...",primaryColor:"#00aeff",gradientFrom:"#00aeff",gradientTo:"#0066ff",showTimestamps:!0,showTypingIndicator:!0,enableSounds:!0,enableFileUpload:!0,startOpen:!1,persistSession:!0,zIndex:9999,width:380,height:560,buttonSize:60,borderRadius:16,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',avatarUrl:"",poweredBy:!0},t='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>',o='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',n='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="22" y1="2" x2="11" y2="13"></line><polygon points="22 2 15 22 11 13 2 9 22 2"></polygon></svg>',i='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"></path></svg>',a='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"></line></svg>',s='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="11" width="18" height="10" rx="2"></rect><circle cx="12" cy="5" r="2"></circle><path d="M12 7v4"></path></svg>',r='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>',d='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><line x1="10" y1="9" x2="8" y2="9"></line></svg>',l='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>',c='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>';let p={widgetId:"",...e},m={isOpen:!1,isConnected:!1,messages:[],sessionId:null,visitorId:null,unreadCount:0},h="chat",g=!1,u={};const b={};let f=null,x=null,y=0;let w=!1;function v(e=""){return e+Math.random().toString(36).slice(2,14)+Date.now().toString(36)}function V(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}function k(e,t){const o="ihooman_chat_"+e;try{if(void 0===t){const e=localStorage.getItem(o);return e?JSON.parse(e):null}return null===t?(localStorage.removeItem(o),null):(localStorage.setItem(o,JSON.stringify(t)),t)}catch{return null}}function A(e,t){(b[e]||[]).forEach(o=>{try{o(t)}catch(t){console.error(`Error in ${e} event handler:`,t)}});const o=`on${e.charAt(0).toUpperCase()}${e.slice(1)}`,n=p[o];if("function"==typeof n)try{n(t)}catch(e){console.error(`Error in ${o} callback:`,e)}}function $(){const e=document.createElement("style");e.id="ihooman-widget-styles",e.textContent=function(){const{primaryColor:e,gradientFrom:t,gradientTo:o,fontFamily:n,borderRadius:i,zIndex:a,width:s,height:r,buttonSize:d}=p,l="dark"===p.theme,c=l?"#1a1a2e":"#ffffff",m=l?"#e4e4e7":"#1f2937",h=l?"#71717a":"#6b7280",g=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.08)",u=l?"#16162a":"#f9fafb",b=`linear-gradient(135deg, ${t}, ${o})`,f=l?"#252542":"#f1f5f9",x=p.position?.includes("right")??!0,y=p.position?.includes("bottom")??!0;return`\n .ihooman-widget * { box-sizing: border-box; margin: 0; padding: 0; }\n .ihooman-widget { font-family: ${n}; font-size: 14px; line-height: 1.5; color: ${m}; -webkit-font-smoothing: antialiased; }\n .ihooman-widget button { border-radius: 8px; }\n .ihooman-toggle { position: fixed; ${x?"right: 20px":"left: 20px"}; ${y?"bottom: 20px":"top: 20px"}; width: ${d}px; height: ${d}px; border-radius: 50% !important; background: linear-gradient(135deg, ${t}, ${o}); border: none; cursor: pointer; z-index: ${a}; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 20px rgba(0, 174, 255, 0.35); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); overflow: hidden; }\n .ihooman-toggle:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(0, 174, 255, 0.45); }\n .ihooman-toggle:active { transform: scale(0.95); }\n .ihooman-toggle::before { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(255,255,255,0.2), transparent); border-radius: 50%; }\n .ihooman-toggle svg { width: 26px; height: 26px; color: white; transition: transform 0.3s ease, opacity 0.2s ease; position: relative; z-index: 1; }\n .ihooman-toggle .chat-icon { display: flex; align-items: center; justify-content: center; transition: transform 0.3s ease, opacity 0.2s ease; }\n .ihooman-toggle .close-icon { position: absolute; display: flex; align-items: center; justify-content: center; transform: rotate(-90deg) scale(0); opacity: 0; transition: transform 0.3s ease, opacity 0.2s ease; }\n .ihooman-toggle.open .chat-icon { transform: rotate(90deg) scale(0); opacity: 0; }\n .ihooman-toggle.open .close-icon { transform: rotate(0) scale(1); opacity: 1; }\n .ihooman-pulse { position: absolute; inset: 0; border-radius: 50%; background: ${e}; animation: ihooman-pulse 2s ease-out infinite; }\n @keyframes ihooman-pulse { 0% { transform: scale(1); opacity: 0.5; } 100% { transform: scale(1.6); opacity: 0; } }\n .ihooman-toggle.open .ihooman-pulse { display: none; }\n .ihooman-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px; background: #ef4444; color: white; font-size: 11px; font-weight: 600; border-radius: 10px; display: flex; align-items: center; justify-content: center; z-index: 2; }\n .ihooman-badge:empty { display: none; }\n .ihooman-window { position: fixed; ${x?"right: 20px":"left: 20px"}; ${y?"bottom: 90px":"top: 90px"}; width: ${s}px; height: ${r}px; max-height: calc(100vh - 120px); z-index: ${(a??9999)-1}; display: flex; flex-direction: column; opacity: 0; visibility: hidden; transform: translateY(20px) scale(0.95); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); overscroll-behavior: contain; }\n .ihooman-window.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }\n .ihooman-container { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; border-radius: ${i}px; overflow: hidden; }\n .ihooman-container::before { content: ''; position: absolute; inset: 0; background: ${c}; opacity: 0.97; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: ${i}px; border: 1px solid ${g}; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); }\n .ihooman-container > * { position: relative; z-index: 1; }\n .ihooman-header { padding: 16px 20px; background: linear-gradient(135deg, ${t}, ${o}); color: white; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }\n .ihooman-header-avatar { width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }\n .ihooman-header-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }\n .ihooman-header-avatar svg { width: 22px; height: 22px; }\n .ihooman-header-info { flex: 1; min-width: 0; }\n .ihooman-header-title { font-size: 16px; font-weight: 600; margin-bottom: 2px; }\n .ihooman-header-status { display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: 0.9; }\n .ihooman-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }\n .ihooman-status-dot.offline { background: #f59e0b; }\n .ihooman-header-actions { display: flex; gap: 8px; }\n .ihooman-header-btn { width: 32px; height: 32px; border-radius: 8px !important; background: rgba(255,255,255,0.15); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; color: white; transition: background 0.2s; }\n .ihooman-header-btn:hover { background: rgba(255,255,255,0.25); }\n .ihooman-header-btn svg { width: 16px; height: 16px; }\n .ihooman-messages { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: ${c}; overscroll-behavior: contain; min-height: 0; }\n .ihooman-messages::-webkit-scrollbar { width: 6px; }\n .ihooman-messages::-webkit-scrollbar-track { background: transparent; }\n .ihooman-messages::-webkit-scrollbar-thumb { background: ${g}; border-radius: 3px; }\n .ihooman-message { display: flex; flex-direction: column; max-width: 85%; animation: ihooman-fadeIn 0.3s ease; }\n @keyframes ihooman-fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }\n .ihooman-message.user { align-self: flex-end; align-items: flex-end; }\n .ihooman-message.bot { align-self: flex-start; align-items: flex-start; }\n .ihooman-message-content { padding: 12px 16px; border-radius: 16px; word-wrap: break-word; }\n .ihooman-message.user .ihooman-message-content { background: ${b}; color: white; border-bottom-right-radius: 4px; }\n .ihooman-message.bot .ihooman-message-content { background: ${f}; color: ${m}; border-bottom-left-radius: 4px; }\n .ihooman-message-content code { background: rgba(0,0,0,0.1); padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 13px; }\n .ihooman-message-time { font-size: 11px; color: ${h}; margin-top: 4px; padding: 0 4px; }\n .ihooman-typing { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: ${f}; border-radius: 16px; border-bottom-left-radius: 4px; max-width: 80px; align-self: flex-start; }\n .ihooman-typing-dots { display: flex; gap: 4px; }\n .ihooman-typing-dot { width: 8px; height: 8px; background: ${h}; border-radius: 50%; animation: ihooman-typing 1.4s infinite; }\n .ihooman-typing-dot:nth-child(2) { animation-delay: 0.2s; }\n .ihooman-typing-dot:nth-child(3) { animation-delay: 0.4s; }\n @keyframes ihooman-typing { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }\n .ihooman-input-area { padding: 12px 16px; background: ${c}; border-top: 1px solid ${g}; flex-shrink: 0; }\n .ihooman-input-wrapper { display: flex; align-items: flex-end; gap: 8px; background: ${u}; border: 1px solid ${g}; border-radius: 12px; padding: 8px 12px; transition: border-color 0.2s, box-shadow 0.2s; }\n .ihooman-input-wrapper:focus-within { border-color: ${e}; box-shadow: 0 0 0 3px rgba(0, 174, 255, 0.1); }\n .ihooman-input { flex: 1; border: none; background: transparent; font-family: inherit; font-size: 14px; color: ${m}; resize: none; max-height: 100px; outline: none; line-height: 1.4; }\n .ihooman-input::placeholder { color: ${h}; }\n .ihooman-input-btn { width: 36px; height: 36px; border-radius: 10px; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; background: transparent; color: ${h}; }\n .ihooman-input-btn:hover { background: ${g}; color: ${m}; }\n .ihooman-input-btn.send { background: linear-gradient(135deg, ${t}, ${o}); color: white; }\n .ihooman-input-btn.send:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(0, 174, 255, 0.3); }\n .ihooman-input-btn.send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }\n .ihooman-input-btn svg { width: 18px; height: 18px; }\n .ihooman-file-input { display: none; }\n .ihooman-powered { text-align: center; padding: 8px; font-size: 11px; color: ${h}; background: ${c}; }\n .ihooman-powered a { color: ${e}; text-decoration: none; }\n .ihooman-error { padding: 16px; text-align: center; color: #ef4444; background: ${c}; }\n .ihooman-escalation-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }\n .ihooman-widget .ihooman-escalation-btn { display: inline-flex !important; align-items: center !important; gap: 8px !important; padding: 10px 18px !important; border-radius: 8px !important; border: none !important; cursor: pointer !important; font-family: inherit !important; font-size: 13px !important; font-weight: 500 !important; transition: all 0.2s ease !important; width: auto !important; height: auto !important; min-width: 120px !important; }\n .ihooman-widget .ihooman-escalation-btn svg { width: 16px !important; height: 16px !important; flex-shrink: 0 !important; }\n .ihooman-widget .ihooman-escalation-btn.primary { background: linear-gradient(135deg, ${t}, ${o}) !important; color: white !important; }\n .ihooman-widget .ihooman-escalation-btn.primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 174, 255, 0.3); }\n .ihooman-widget .ihooman-escalation-btn.secondary { background: ${l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.05)"} !important; color: ${m} !important; border: 1px solid ${g} !important; }\n .ihooman-widget .ihooman-escalation-btn.secondary:hover { background: ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.08)"} !important; }\n .ihooman-widget .ihooman-escalation-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }\n .ihooman-status-bar { padding: 10px 16px; text-align: center; font-size: 13px; display: none; }\n .ihooman-status-bar.show { display: block; }\n .ihooman-status-bar.waiting { background: #fef3c7; color: #92400e; }\n .ihooman-status-bar.connected { background: #dcfce7; color: #166534; }\n .ihooman-chat-view { display: flex; flex-direction: column; flex: 1; overflow: hidden; min-height: 0; }\n .ihooman-chat-view.hidden { display: none; }\n .ihooman-ticket-view { display: none; flex-direction: column; padding: 20px; gap: 16px; background: ${c}; flex: 1; overflow-y: auto; min-height: 0; }\n .ihooman-ticket-view.show { display: flex; }\n .ihooman-ticket-title { font-size: 18px; font-weight: 600; color: ${m}; margin: 0; display: flex; align-items: center; gap: 8px; }\n .ihooman-ticket-subtitle { font-size: 13px; color: ${h}; margin: 0; }\n .ihooman-ticket-input { padding: 12px 14px; border: 1px solid ${g}; border-radius: 10px; font-size: 14px; font-family: inherit; background: ${u}; color: ${m}; outline: none; transition: border-color 0.2s; }\n .ihooman-ticket-input:focus { border-color: ${e}; }\n .ihooman-ticket-input::placeholder { color: ${h}; }\n .ihooman-ticket-textarea { min-height: 100px; resize: vertical; }\n .ihooman-ticket-submit { padding: 14px; background: linear-gradient(135deg, ${t}, ${o}); color: white; border: none; border-radius: 10px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s; }\n .ihooman-ticket-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 174, 255, 0.3); }\n .ihooman-ticket-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }\n .ihooman-ticket-back { padding: 10px; background: transparent; color: ${h}; border: 1px solid ${g}; border-radius: 10px; font-size: 13px; cursor: pointer; transition: all 0.2s; }\n .ihooman-ticket-back:hover { background: ${l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.03)"}; }\n .ihooman-history-view { display: none; flex-direction: column; flex: 1; overflow: hidden; background: ${c}; }\n .ihooman-history-view.show { display: flex; }\n .ihooman-history-header { padding: 12px 16px; border-bottom: 1px solid ${g}; display: flex; justify-content: space-between; align-items: center; }\n .ihooman-history-title { font-size: 14px; font-weight: 600; color: ${m}; margin: 0; }\n .ihooman-history-new { display: inline-flex; align-items: center; gap: 4px; background: linear-gradient(135deg, ${t}, ${o}); color: white; border: none; padding: 8px 16px; border-radius: 8px !important; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; }\n .ihooman-history-new:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0, 174, 255, 0.3); }\n .ihooman-history-new svg { width: 14px; height: 14px; flex-shrink: 0; }\n .ihooman-history-list { flex: 1; overflow-y: auto; padding: 8px; overscroll-behavior: contain; }\n .ihooman-history-item { padding: 12px; border: 1px solid ${g}; border-radius: 8px; margin-bottom: 6px; cursor: pointer; transition: all 0.2s; background: ${c}; }\n .ihooman-history-item:hover { background: ${l?"rgba(255,255,255,0.05)":"#f8fafc"}; }\n .ihooman-history-item.active { background: ${l?"rgba(0, 174, 255, 0.1)":"#eff6ff"}; border-color: ${e}; }\n .ihooman-history-preview { font-size: 13px; color: ${m}; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n .ihooman-history-meta { font-size: 11px; color: ${h}; margin-top: 4px; display: flex; justify-content: space-between; }\n .ihooman-history-empty { padding: 40px; text-align: center; color: ${h}; font-size: 14px; }\n .ihooman-preset-questions { padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 6px; background: ${c}; border-top: 1px solid ${g}; }\n .ihooman-preset-questions:empty { display: none; }\n .ihooman-preset-questions.hidden { display: none !important; }\n .ihooman-widget .ihooman-preset-btn { display: inline-flex !important; align-items: center !important; gap: 4px !important; padding: 6px 12px !important; border-radius: 6px !important; border: 1px solid ${g} !important; background: ${l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)"} !important; color: ${m} !important; font-size: 12px !important; font-weight: 500 !important; cursor: pointer !important; transition: all 0.2s !important; white-space: nowrap !important; width: auto !important; height: auto !important; min-width: 0 !important; aspect-ratio: auto !important; }\n .ihooman-widget .ihooman-preset-btn:hover { background: ${l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.05)"} !important; border-color: ${e} !important; }\n .ihooman-widget .ihooman-preset-btn .icon { font-size: 12px !important; flex-shrink: 0 !important; }\n @media (max-width: 480px) { .ihooman-window { width: calc(100vw - 20px); height: calc(100vh - 100px); left: 10px; right: 10px; bottom: 80px; max-height: none; } .ihooman-toggle { ${x?"right: 16px":"left: 16px"}; bottom: 16px; } }\n `}(),document.head.appendChild(e);const r=document.createElement("div");r.className="ihooman-widget",r.innerHTML=`\n <button class="ihooman-toggle" aria-label="Open chat">\n <span class="ihooman-pulse"></span>\n <span class="ihooman-badge"></span>\n <span class="chat-icon">${t}</span>\n <span class="close-icon">${o}</span>\n </button>\n <div class="ihooman-window" role="dialog" aria-label="Chat window">\n <div class="ihooman-container">\n <div class="ihooman-header">\n <div class="ihooman-header-avatar">${p.avatarUrl?`<img src="${V(p.avatarUrl)}" alt="Support">`:s}</div>\n <div class="ihooman-header-info">\n <div class="ihooman-header-title">${V(p.title||"Chat Support")}</div>\n <div class="ihooman-header-status"><span class="ihooman-status-dot"></span><span class="ihooman-status-text">Online</span></div>\n </div>\n <div class="ihooman-header-actions">\n <button class="ihooman-header-btn" data-action="history" title="Chat history">${l}</button>\n <button class="ihooman-header-btn" data-action="refresh" title="New conversation">${c}</button>\n <button class="ihooman-header-btn" data-action="minimize" title="Minimize">${a}</button>\n </div>\n </div>\n \n \x3c!-- Chat View --\x3e\n <div class="ihooman-chat-view">\n <div class="ihooman-status-bar"></div>\n <div class="ihooman-messages" role="log" aria-live="polite"></div>\n <div class="ihooman-preset-questions"></div>\n <div class="ihooman-input-area">\n <div class="ihooman-input-wrapper">\n ${p.enableFileUpload?`<button class="ihooman-input-btn attach" title="Attach file">${i}</button><input type="file" class="ihooman-file-input">`:""}\n <textarea class="ihooman-input" placeholder="${V(p.placeholder||"Type a message...")}" rows="1" aria-label="Message input"></textarea>\n <button class="ihooman-input-btn send" title="Send message" disabled>${n}</button>\n </div>\n </div>\n </div>\n \n \x3c!-- Ticket Form View --\x3e\n <div class="ihooman-ticket-view">\n <h4 class="ihooman-ticket-title">📝 Submit a Ticket</h4>\n <p class="ihooman-ticket-subtitle">We'll get back to you via email</p>\n <input class="ihooman-ticket-input" id="ihooman-ticket-name" placeholder="Your name" required>\n <input class="ihooman-ticket-input" id="ihooman-ticket-email" type="email" placeholder="Your email" required>\n <textarea class="ihooman-ticket-input ihooman-ticket-textarea" id="ihooman-ticket-issue" placeholder="Describe your issue..."></textarea>\n <button class="ihooman-ticket-submit" id="ihooman-ticket-submit">Submit Ticket</button>\n <button class="ihooman-ticket-back" id="ihooman-ticket-back">← Back to Chat</button>\n </div>\n \n \x3c!-- History View --\x3e\n <div class="ihooman-history-view">\n <div class="ihooman-history-header">\n <span class="ihooman-history-title">Your Conversations</span>\n <button class="ihooman-history-new" style="all: revert; display: inline-flex !important; align-items: center !important; gap: 4px !important; background: linear-gradient(135deg, ${p.gradientFrom}, ${p.gradientTo}) !important; color: white !important; border: none !important; padding: 6px 10px !important; border-radius: 6px !important; font-size: 12px !important; font-weight: 500 !important; cursor: pointer !important; width: auto !important; height: auto !important; min-width: 0 !important; aspect-ratio: auto !important;">${c} New Chat</button>\n </div>\n <div class="ihooman-history-list"></div>\n </div>\n \n ${p.poweredBy?'<div class="ihooman-powered">Powered by <a href="https://ihooman.ai" target="_blank" rel="noopener">Ihooman AI</a></div>':""}\n </div>\n </div>\n `,document.body.appendChild(r),u={widget:r,toggle:r.querySelector(".ihooman-toggle"),badge:r.querySelector(".ihooman-badge"),window:r.querySelector(".ihooman-window"),chatView:r.querySelector(".ihooman-chat-view"),ticketView:r.querySelector(".ihooman-ticket-view"),historyView:r.querySelector(".ihooman-history-view"),historyList:r.querySelector(".ihooman-history-list"),historyNewBtn:r.querySelector(".ihooman-history-new"),messages:r.querySelector(".ihooman-messages"),presetQuestions:r.querySelector(".ihooman-preset-questions"),input:r.querySelector(".ihooman-input"),sendBtn:r.querySelector(".ihooman-input-btn.send"),attachBtn:r.querySelector(".ihooman-input-btn.attach"),fileInput:r.querySelector(".ihooman-file-input"),statusDot:r.querySelector(".ihooman-status-dot"),statusText:r.querySelector(".ihooman-status-text"),statusBar:r.querySelector(".ihooman-status-bar"),ticketName:r.querySelector("#ihooman-ticket-name"),ticketEmail:r.querySelector("#ihooman-ticket-email"),ticketIssue:r.querySelector("#ihooman-ticket-issue"),ticketSubmitBtn:r.querySelector("#ihooman-ticket-submit"),ticketBackBtn:r.querySelector("#ihooman-ticket-back")},function(){if(!u.toggle||!u.sendBtn||!u.input)return;u.toggle.addEventListener("click",J),u.sendBtn.addEventListener("click",O),u.input.addEventListener("input",()=>{u.sendBtn&&(u.sendBtn.disabled=!u.input?.value.trim()),u.input&&(u.input.style.height="auto",u.input.style.height=Math.min(u.input.scrollHeight,100)+"px")}),u.input.addEventListener("keydown",e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),u.sendBtn?.disabled||O())}),u.attachBtn&&u.fileInput&&(u.attachBtn.addEventListener("click",()=>u.fileInput?.click()),u.fileInput.addEventListener("change",N));u.widget?.querySelector('[data-action="refresh"]')?.addEventListener("click",G),u.widget?.querySelector('[data-action="minimize"]')?.addEventListener("click",R),u.widget?.querySelector('[data-action="history"]')?.addEventListener("click",C),u.ticketSubmitBtn&&u.ticketSubmitBtn.addEventListener("click",L);u.ticketBackBtn&&u.ticketBackBtn.addEventListener("click",()=>T("chat"));u.historyNewBtn&&u.historyNewBtn.addEventListener("click",()=>{G(),T("chat")})}()}function S(e,t="bot",o={}){const n={id:v("msg_"),content:e,sender:t,timestamp:new Date,metadata:o};if(m.messages.push(n),!u.messages)return n;const i=document.createElement("div");i.className=`ihooman-message ${t}`;const a="bot"===t&&!0===o?.escalation_offered;let s="";if(a){const e="all: revert; display: inline-flex !important; align-items: center !important; justify-content: center !important; gap: 6px !important; padding: 8px 12px !important; border-radius: 6px !important; border: none !important; cursor: pointer !important; font-size: 12px !important; font-weight: 500 !important; line-height: 1.2 !important; width: auto !important; height: auto !important; min-width: 0 !important; min-height: 0 !important; max-width: none !important; max-height: none !important; aspect-ratio: auto !important; box-sizing: border-box !important;";s=`\n <div class="ihooman-escalation-actions" style="display: flex !important; gap: 8px !important; margin-top: 10px !important; flex-wrap: wrap !important;">\n <button class="ihooman-escalation-btn primary" data-action="live-agent" style="${`${e} background: linear-gradient(135deg, ${p.gradientFrom}, ${p.gradientTo}) !important; color: white !important;`}">\n ${r}\n <span>Talk to Agent</span>\n </button>\n <button class="ihooman-escalation-btn secondary" data-action="create-ticket" style="${`${e} background: rgba(0,0,0,0.05) !important; color: inherit !important; border: 1px solid rgba(0,0,0,0.1) !important;`}">\n ${d}\n <span>Create Ticket</span>\n </button>\n </div>\n `}var l,c;if(i.innerHTML=`\n <div class="ihooman-message-content">${c=e,c?V(c).replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/`(.*?)`/g,"<code>$1</code>").replace(/\n/g,"<br>"):""}</div>\n ${s}\n ${p.showTimestamps?`<div class="ihooman-message-time">${l=n.timestamp,new Date(l).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}</div>`:""}\n `,a){const e=i.querySelector('[data-action="live-agent"]'),t=i.querySelector('[data-action="create-ticket"]');e&&e.addEventListener("click",()=>I("live-agent")),t&&t.addEventListener("click",()=>I("create-ticket"))}const h=u.messages.querySelector(".ihooman-typing");return h&&h.remove(),u.messages.appendChild(i),u.messages.scrollTop=u.messages.scrollHeight,"bot"!==t||m.isOpen||(m.unreadCount++,u.badge&&(u.badge.textContent=String(m.unreadCount)),p.enableSounds&&function(){try{const e=new Audio("data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4Ljc2LjEwMAAAAAAAAAAAAAAA//tQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAAACAAABhgC7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7//////////////////////////////////////////////////////////////////8AAAAATGF2YzU4LjEzAAAAAAAAAAAAAAAAJAAAAAAAAAAAAYYNBrP/AAAAAAAAAAAAAAAAAAAAAP/7UMQAA8AAAaQAAAAgAAA0gAAABExBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tQxBKDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU=");e.volume=.3,e.play().catch(()=>{})}catch{}}()),A("message",n),n}function _(){u.presetQuestions&&0!==K.length?(u.presetQuestions.innerHTML=K.map(e=>`\n <button class="ihooman-preset-btn" data-question-id="${V(e.id)}" data-question-text="${V(e.text)}">\n ${e.icon?`<span class="icon">${V(e.icon)}</span>`:""}\n <span>${V(e.text)}</span>\n </button>\n `).join(""),u.presetQuestions.querySelectorAll(".ihooman-preset-btn").forEach(e=>{e.addEventListener("click",()=>{const t=e.dataset.questionText;t&&function(e){j(),S(e,"user"),M(),F(e)}(t)})})):u.presetQuestions&&(u.presetQuestions.innerHTML="")}function I(e){document.querySelectorAll(".ihooman-escalation-btn").forEach(e=>e.disabled=!0),"live-agent"===e?async function(){if(!m.sessionId)return void S("Please send a message first to start a conversation.","bot",{is_system_message:!0});const e=u.widget?.querySelector('[data-action="live-agent"]');e&&(e.disabled=!0,e.innerHTML='<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg> Connecting...');try{const e=await fetch(`${p.serverUrl}/api/widget/live-agent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({widget_id:p.widgetId,session_id:m.sessionId,visitor_id:m.visitorId})}),t=await e.json();g=!0,t.position_in_queue&&t.position_in_queue>1?B("waiting",`⏳ Waiting for agent (Position: #${t.position_in_queue})`):B("waiting","⏳ Connecting to live support..."),z()}catch(e){console.error("Error requesting live agent:",e),S("❌ Unable to connect to live support. Please try again.","bot",{is_system_message:!0})}e&&(e.disabled=!1,e.innerHTML='<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg> Live Agent')}():"create-ticket"===e&&(T("ticket"),setTimeout(()=>u.ticketName?.focus(),100))}function T(e){h=e,u.chatView&&u.chatView.classList.toggle("hidden","chat"!==e),u.ticketView&&u.ticketView.classList.toggle("show","ticket"===e),u.historyView&&u.historyView.classList.toggle("show","history"===e),"history"===e&&async function(){if(!u.historyList||!m.visitorId)return;u.historyList.innerHTML='<div class="ihooman-history-empty">Loading...</div>';try{const e=await fetch(`${p.serverUrl}/api/widget/conversations?widget_id=${p.widgetId}&visitor_id=${m.visitorId}&limit=20`);if(!e.ok)throw new Error("Failed to load history");const t=await e.json();if(!t.length)return void(u.historyList.innerHTML='<div class="ihooman-history-empty">No conversations yet</div>');u.historyList.innerHTML=t.map(e=>`\n <div class="ihooman-history-item ${e.session_id===m.sessionId?"active":""}" data-session-id="${e.session_id}">\n <div class="ihooman-history-preview">${V(e.preview||"New conversation")}</div>\n <div class="ihooman-history-meta">\n <span>${e.message_count} msgs</span>\n <span>${"pending"===e.status?"🟡 Pending":"closed"===e.status?"✓ Closed":""} ${function(e){const t=Date.now()-new Date(e).getTime();return t<6e4?"now":t<36e5?Math.floor(t/6e4)+"m":t<864e5?Math.floor(t/36e5)+"h":Math.floor(t/864e5)+"d"}(e.updated_at)}</span>\n </div>\n </div>\n `).join(""),u.historyList.querySelectorAll(".ihooman-history-item").forEach(e=>{e.addEventListener("click",()=>{const t=e.dataset.sessionId;t&&async function(e){m.sessionId=e,p.persistSession&&k("session_id",e);u.messages&&(u.messages.innerHTML="");g=!1,q(),B("hidden"),w=!0,f&&(f.close(),f=null);H(),T("chat"),await async function(e){try{const t=await fetch(`${p.serverUrl}/api/widget/transcript/${e}?widget_id=${p.widgetId}`);if(!t.ok)throw new Error("Failed to load messages");const o=await t.json();u.messages&&(u.messages.innerHTML=""),o.messages&&o.messages.length>0?o.messages.forEach(e=>{const t="user"===e.sender_type?"user":"bot";S(e.content,t,e.extra_data||{})}):p.welcomeMessage&&S(p.welcomeMessage,"bot"),"pending"===o.status?(g=!0,z(),B("waiting","⏳ Waiting for agent...")):"closed"===o.status&&B("hidden")}catch(e){console.error("Error loading conversation messages:",e),p.welcomeMessage&&S(p.welcomeMessage,"bot")}}(e)}(t)})})}catch(e){console.error("Error loading conversation history:",e),u.historyList.innerHTML='<div class="ihooman-history-empty">Failed to load history</div>'}}()}function C(){T("history"===h?"chat":"history")}function B(e,t){u.statusBar&&("hidden"!==e?(u.statusBar.classList.add("show"),u.statusBar.classList.remove("waiting","connected"),u.statusBar.classList.add(e),t&&(u.statusBar.textContent=t)):u.statusBar.classList.remove("show"))}async function L(){const e=u.ticketName?.value.trim(),t=u.ticketEmail?.value.trim(),o=u.ticketIssue?.value.trim();if(e&&t){u.ticketSubmitBtn&&(u.ticketSubmitBtn.disabled=!0,u.ticketSubmitBtn.textContent="Submitting...");try{const n=await fetch(`${p.serverUrl}/api/widget/submit-ticket`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({widget_id:p.widgetId,session_id:m.sessionId,user_name:e,user_email:t,issue:o||"No description provided"})}),i=await n.json();u.ticketName&&(u.ticketName.value=""),u.ticketEmail&&(u.ticketEmail.value=""),u.ticketIssue&&(u.ticketIssue.value=""),T("chat");S(`✅ Ticket submitted! We'll contact you at ${t}. Reference: #${i.ticket_id?i.ticket_id.slice(0,8):"submitted"}`,"bot",{is_system_message:!0})}catch(e){console.error("Error submitting ticket:",e),S("❌ Error submitting ticket. Please try again.","bot",{is_system_message:!0})}u.ticketSubmitBtn&&(u.ticketSubmitBtn.disabled=!1,u.ticketSubmitBtn.textContent="Submit Ticket")}else alert("Please fill in your name and email")}let E=null;function z(){E||(E=setInterval(async()=>{if(m.sessionId&&g)try{try{const e=await fetch(`${p.serverUrl}/api/widget/escalation-status/${m.sessionId}?widget_id=${p.widgetId}`);if(e.ok){const t=await e.json();t.escalated&&("in_progress"===t.ticket_status?B("connected","🟢 Connected to live agent"):"open"===t.ticket_status?t.position_in_queue&&t.position_in_queue>1?B("waiting",`⏳ Waiting for agent (Position: #${t.position_in_queue})`):B("waiting","⏳ Waiting for agent..."):"closed"!==t.ticket_status&&"resolved"!==t.ticket_status||(g=!1,q(),B("hidden"),S("This conversation has been closed. Thank you for contacting us!","bot",{is_system_message:!0})))}}catch{}}catch(e){console.error("Error polling for messages:",e)}else q()},3e3))}function q(){E&&(clearInterval(E),E=null)}function M(){if(!p.showTypingIndicator||!u.messages)return;if(u.messages.querySelector(".ihooman-typing"))return;const e=document.createElement("div");e.className="ihooman-typing",e.innerHTML='<div class="ihooman-typing-dots"><span class="ihooman-typing-dot"></span><span class="ihooman-typing-dot"></span><span class="ihooman-typing-dot"></span></div>',u.messages.appendChild(e),u.messages.scrollTop=u.messages.scrollHeight}function U(){const e=u.messages?.querySelector(".ihooman-typing");e&&e.remove()}function O(){const e=u.input?.value.trim();e&&(j(),u.input&&(u.input.value="",u.input.style.height="auto"),u.sendBtn&&(u.sendBtn.disabled=!0),S(e,"user"),M(),F(e))}function j(){u.presetQuestions&&u.presetQuestions.classList.add("hidden")}async function F(e){if(f&&f.readyState===WebSocket.OPEN)f.send(JSON.stringify({type:"message",content:e}));else try{const t=await fetch(`${p.serverUrl}/api/v1/public/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e,session_id:m.sessionId,visitor_id:m.visitorId,widget_id:p.widgetId})}),o=await t.json();U(),o.session_id&&(m.sessionId=o.session_id,p.persistSession&&k("session_id",m.sessionId)),o.response&&S(o.response,"bot",{sources:o.sources,confidence:o.confidence})}catch(e){U(),S("Sorry, something went wrong. Please try again.","bot"),A("error",e)}}function N(e){const t=e.target,o=t.files?.[0];if(!o)return;S(`📎 Uploading: ${o.name}...`,"user"),M();const n=new FormData;n.append("file",o),n.append("session_id",m.sessionId||""),n.append("visitor_id",m.visitorId||""),n.append("widget_id",p.widgetId),fetch(`${p.serverUrl}/api/upload`,{method:"POST",body:n}).then(e=>e.json()).then(e=>{U(),e.message&&S(e.message,"bot")}).catch(()=>{U(),S("Failed to upload file.","bot")}),t.value=""}function H(e){if(!p.serverUrl&&!e)return;let t;if(p.widgetId){const e=p.serverUrl?.replace(/^http/,"ws"),o=new URLSearchParams({widget_id:p.widgetId});m.visitorId&&o.append("visitor_id",m.visitorId),m.sessionId&&o.append("session_id",m.sessionId),t=`${e}/public/ws?${o.toString()}`}else t=e||p.serverUrl?.replace(/^http/,"ws")+"/ws";try{W(),f=new WebSocket(t),f.onopen=()=>{m.isConnected=!0,y=0,Q(!0),A("connected"),W(),P=setInterval(()=>{if(f&&f.readyState===WebSocket.OPEN)try{f.send(JSON.stringify({type:"ping"}))}catch(e){console.warn("Failed to send heartbeat ping:",e)}},25e3)},f.onclose=t=>{if(m.isConnected=!1,Q(!1),W(),A("disconnected"),console.log(`WebSocket closed: code=${t.code}, reason=${t.reason||"none"}, wasClean=${t.wasClean}`),w)w=!1;else if(m.isOpen)if(y<5){y++;const t=Math.min(1e3*Math.pow(2,y),3e4);console.log(`WebSocket reconnecting in ${t}ms (attempt ${y}/5)`),setTimeout(()=>H(e),t)}else console.warn("WebSocket reconnection failed, falling back to polling"),D()},f.onerror=e=>{console.error("WebSocket error:",e)},f.onmessage=e=>{try{const t=JSON.parse(e.data);if("connected"===t.type)t.session_id&&(m.sessionId=t.session_id,p.persistSession&&k("session_id",m.sessionId)),t.visitor_id&&(m.visitorId=t.visitor_id,p.persistSession&&k("visitor_id",m.visitorId)),t.welcome_message&&0===m.messages.length&&S(t.welcome_message,"bot");else if("message"===t.type){U();const e="user"===t.sender?"user":"bot";S(t.content,e,{confidence:t.confidence,agent_name:t.agent_name,escalation_offered:t.escalation_offered,escalated:t.escalated})}else"typing"===t.type?t.is_typing?M():U():"pong"===t.type||"error"===t.type&&(console.error("WebSocket server error:",t.message),A("error",{message:t.message}))}catch{}}}catch{console.warn("WebSocket not supported, using polling"),D()}}let P=null;function W(){P&&(clearInterval(P),P=null)}function D(){x||(x=setInterval(async()=>{if(m.sessionId)try{const e=await fetch(`${p.serverUrl}/api/messages?session_id=${m.sessionId}&since=${Date.now()-5e3}&widget_id=${p.widgetId}`),t=await e.json();t.messages&&t.messages.forEach(e=>{m.messages.find(t=>t.id===e.id)||S(e.content,e.sender_type,e.metadata)})}catch{}},5e3))}function Q(e){u.statusDot&&u.statusDot.classList.toggle("offline",!e),u.statusText&&(u.statusText.textContent=e?"Online":"Offline")}function Y(){m.isOpen||(m.isOpen=!0,m.unreadCount=0,u.badge&&(u.badge.textContent=""),u.toggle&&u.toggle.classList.add("open"),u.window&&u.window.classList.add("open"),setTimeout(()=>u.input?.focus(),300),A("open"))}function R(){m.isOpen&&(m.isOpen=!1,u.toggle&&u.toggle.classList.remove("open"),u.window&&u.window.classList.remove("open"),A("close"))}function J(){m.isOpen?R():Y()}function G(){m.sessionId=null,m.visitorId=null,m.messages=[],g=!1,k("session_id",null),m.visitorId=v("v_"),k("visitor_id",m.visitorId),u.messages&&(u.messages.innerHTML=""),B("hidden"),q(),y=0,f&&(w=!0,f.close(),f=null),H(),p.welcomeMessage&&S(p.welcomeMessage,"bot"),A("newConversation")}let K=[];async function Z(t){if(!t.widgetId)return console.error("IhoomanChat: widgetId is required"),null;p={...e,...t},m.visitorId=k("visitor_id")||v("v_"),k("visitor_id",m.visitorId),p.persistSession&&(m.sessionId=k("session_id"));const o=p.serverUrl||"https://api.ihooman.ai",n=await async function(e,t){try{const o=await fetch(`${t}/api/widget/config?widget_id=${encodeURIComponent(e)}`);return o.ok?await o.json():{success:!1,error:(await o.json().catch(()=>({}))).error||`HTTP ${o.status}`}}catch(e){return{success:!1,error:"Unable to connect. Please check your internet connection."}}}(p.widgetId,o);let i;var a;return n.success&&n.config?(a=n.config,p.title=a.title||p.title,p.subtitle=a.subtitle||p.subtitle,p.welcomeMessage=a.welcomeMessage||p.welcomeMessage,p.placeholder=a.placeholder||p.placeholder,p.position=a.position||p.position,a.theme&&(p.primaryColor=a.theme.primaryColor||p.primaryColor,p.gradientFrom=a.theme.gradientFrom||p.gradientFrom,p.gradientTo=a.theme.gradientTo||p.gradientTo,p.fontFamily=a.theme.fontFamily||p.fontFamily,a.theme.borderRadius&&(p.borderRadius=parseInt(a.theme.borderRadius,10)||p.borderRadius)),a.behavior&&(p.startOpen=a.behavior.startOpen??p.startOpen,p.showTypingIndicator=a.behavior.showTypingIndicator??p.showTypingIndicator,p.showTimestamps=a.behavior.showTimestamps??p.showTimestamps,p.enableSounds=a.behavior.enableSounds??p.enableSounds,p.enableFileUpload=a.behavior.enableFileUpload??p.enableFileUpload,p.persistSession=a.behavior.persistSession??p.persistSession),a.branding&&(p.avatarUrl=a.branding.avatarUrl||p.avatarUrl,p.poweredBy=a.branding.poweredBy??p.poweredBy),a.presetQuestions&&Array.isArray(a.presetQuestions)&&(K=a.presetQuestions),i=n.chatEndpoint):n.error&&(console.warn("IhoomanChat: Could not fetch server config:",n.error),"Widget not authorized for this domain"===n.error&&console.error("IhoomanChat: Widget configuration error. Please contact support.")),$(),_(),m.messages.forEach(e=>S(e.content,e.sender,e.metadata)),0===m.messages.length&&p.welcomeMessage&&S(p.welcomeMessage,"bot"),H(i),p.startOpen&&setTimeout(Y,500),A("ready"),X}const X={init:Z,open:Y,close:R,toggle:J,destroy:function(){W(),q(),w=!0,f&&(f.close(),f=null),x&&(clearInterval(x),x=null),u.widget&&u.widget.remove();const e=document.getElementById("ihooman-widget-styles");e&&e.remove(),m={isOpen:!1,isConnected:!1,messages:[],sessionId:null,visitorId:null,unreadCount:0},u={},y=0,w=!1},sendMessage:function(e){e.trim()&&(u.input&&(u.input.value=e),O())},setUser:function(e){e.name&&k("user_name",e.name),e.email&&k("user_email",e.email),e.metadata&&k("user_metadata",e.metadata)},clearHistory:function(){G()},on:function(e,t){b[e]||(b[e]=[]),b[e].push(t)},off:function(e,t){b[e]&&(b[e]=b[e].filter(e=>e!==t))},getState:function(){return{...m}},version:"2.0.0"},ee=X;function te(){return{...X}}!function(){if("undefined"==typeof document)return;let e=document.currentScript;if(!e){const t=document.getElementsByTagName("script");for(let o=0;o<t.length;o++)if(t[o].src&&t[o].src.includes("ihooman")){e=t[o];break}}if(!e)return;const t=e.getAttribute("data-widget-id");if(t){const o={widgetId:t},n=e.getAttribute("data-server-url");n&&(o.serverUrl=n);const i=e.getAttribute("data-theme");"light"!==i&&"dark"!==i||(o.theme=i);const a=e.getAttribute("data-position");a&&(o.position=a);"true"===e.getAttribute("data-start-open")&&(o.startOpen=!0),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>Z(o)):Z(o)}}(),"undefined"!=typeof window&&(window.IhoomanChat=ee);export{ee as IhoomanChat,te as createWidgetInstance,ee as default};
1
+ const e={serverUrl:"https://api.ihooman.ai",theme:"light",position:"bottom-right",title:"Chat Support",subtitle:"We typically reply within minutes",welcomeMessage:"Hi there! 👋 How can we help you today?",placeholder:"Type a message...",primaryColor:"#00aeff",gradientFrom:"#00aeff",gradientTo:"#0066ff",showTimestamps:!0,showTypingIndicator:!0,enableSounds:!0,enableFileUpload:!0,startOpen:!1,persistSession:!0,zIndex:9999,width:380,height:560,buttonSize:60,borderRadius:16,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',avatarUrl:"",poweredBy:!0},t='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>',n='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',o='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="22" y1="2" x2="11" y2="13"></line><polygon points="22 2 15 22 11 13 2 9 22 2"></polygon></svg>',i='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"></path></svg>',a='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"></line></svg>',s='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="11" width="18" height="10" rx="2"></rect><circle cx="12" cy="5" r="2"></circle><path d="M12 7v4"></path></svg>',r='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>',d='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><line x1="10" y1="9" x2="8" y2="9"></line></svg>',l='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>',c='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>';let p={widgetId:"",...e},m={isOpen:!1,isConnected:!1,messages:[],sessionId:null,visitorId:null,unreadCount:0},h="chat",g=!1,u={};const b={};let f=null,x=null,y=0;let w=!1;function v(e=""){return e+Math.random().toString(36).slice(2,14)+Date.now().toString(36)}function V(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}function k(e,t){const n="ihooman_chat_"+e;try{if(void 0===t){const e=localStorage.getItem(n);return e?JSON.parse(e):null}return null===t?(localStorage.removeItem(n),null):(localStorage.setItem(n,JSON.stringify(t)),t)}catch{return null}}function A(e,t){(b[e]||[]).forEach(n=>{try{n(t)}catch(t){console.error(`Error in ${e} event handler:`,t)}});const n=`on${e.charAt(0).toUpperCase()}${e.slice(1)}`,o=p[n];if("function"==typeof o)try{o(t)}catch(e){console.error(`Error in ${n} callback:`,e)}}function $(){const e=document.createElement("style");e.id="ihooman-widget-styles",e.textContent=function(){const{primaryColor:e,gradientFrom:t,gradientTo:n,fontFamily:o,borderRadius:i,zIndex:a,width:s,height:r,buttonSize:d}=p,l="dark"===p.theme,c=l?"#1a1a2e":"#ffffff",m=l?"#e4e4e7":"#1f2937",h=l?"#71717a":"#6b7280",g=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.08)",u=l?"#16162a":"#f9fafb",b=`linear-gradient(135deg, ${t}, ${n})`,f=l?"#252542":"#f1f5f9",x=p.position?.includes("right")??!0,y=p.position?.includes("bottom")??!0;return`\n .ihooman-widget * { box-sizing: border-box; margin: 0; padding: 0; }\n .ihooman-widget { font-family: ${o}; font-size: 14px; line-height: 1.5; color: ${m}; -webkit-font-smoothing: antialiased; }\n .ihooman-widget button { border-radius: 8px; }\n .ihooman-toggle { position: fixed; ${x?"right: 20px":"left: 20px"}; ${y?"bottom: 20px":"top: 20px"}; width: ${d}px; height: ${d}px; border-radius: 50% !important; background: linear-gradient(135deg, ${t}, ${n}); border: none; cursor: pointer; z-index: ${a}; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 20px rgba(0, 174, 255, 0.35); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); overflow: hidden; }\n .ihooman-toggle:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(0, 174, 255, 0.45); }\n .ihooman-toggle:active { transform: scale(0.95); }\n .ihooman-toggle::before { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(255,255,255,0.2), transparent); border-radius: 50%; }\n .ihooman-toggle svg { width: 26px; height: 26px; color: white; transition: transform 0.3s ease, opacity 0.2s ease; position: relative; z-index: 1; }\n .ihooman-toggle .chat-icon { display: flex; align-items: center; justify-content: center; transition: transform 0.3s ease, opacity 0.2s ease; }\n .ihooman-toggle .close-icon { position: absolute; display: flex; align-items: center; justify-content: center; transform: rotate(-90deg) scale(0); opacity: 0; transition: transform 0.3s ease, opacity 0.2s ease; }\n .ihooman-toggle.open .chat-icon { transform: rotate(90deg) scale(0); opacity: 0; }\n .ihooman-toggle.open .close-icon { transform: rotate(0) scale(1); opacity: 1; }\n .ihooman-pulse { position: absolute; inset: 0; border-radius: 50%; background: ${e}; animation: ihooman-pulse 2s ease-out infinite; }\n @keyframes ihooman-pulse { 0% { transform: scale(1); opacity: 0.5; } 100% { transform: scale(1.6); opacity: 0; } }\n .ihooman-toggle.open .ihooman-pulse { display: none; }\n .ihooman-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px; background: #ef4444; color: white; font-size: 11px; font-weight: 600; border-radius: 10px; display: flex; align-items: center; justify-content: center; z-index: 2; }\n .ihooman-badge:empty { display: none; }\n .ihooman-window { position: fixed; ${x?"right: 20px":"left: 20px"}; ${y?"bottom: 90px":"top: 90px"}; width: ${s}px; height: ${r}px; min-height: ${r}px; max-height: ${r}px; z-index: ${(a??9999)-1}; display: flex; flex-direction: column; opacity: 0; visibility: hidden; transform: translateY(20px) scale(0.95); transition: opacity 0.3s, visibility 0.3s, transform 0.3s; overscroll-behavior: contain; }\n .ihooman-window.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }\n .ihooman-container { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; border-radius: ${i}px; overflow: hidden; flex-shrink: 0; }\n .ihooman-container::before { content: ''; position: absolute; inset: 0; background: ${c}; opacity: 0.97; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: ${i}px; border: 1px solid ${g}; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); }\n .ihooman-container > * { position: relative; z-index: 1; }\n .ihooman-header { padding: 16px 20px; background: linear-gradient(135deg, ${t}, ${n}); color: white; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }\n .ihooman-header-avatar { width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }\n .ihooman-header-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }\n .ihooman-header-avatar svg { width: 22px; height: 22px; }\n .ihooman-header-info { flex: 1; min-width: 0; }\n .ihooman-header-title { font-size: 16px; font-weight: 600; margin-bottom: 2px; }\n .ihooman-header-status { display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: 0.9; }\n .ihooman-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }\n .ihooman-status-dot.offline { background: #f59e0b; }\n .ihooman-header-actions { display: flex; gap: 8px; }\n .ihooman-header-btn { width: 32px; height: 32px; border-radius: 8px !important; background: rgba(255,255,255,0.15); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; color: white; transition: background 0.2s; }\n .ihooman-header-btn:hover { background: rgba(255,255,255,0.25); }\n .ihooman-header-btn svg { width: 16px; height: 16px; }\n .ihooman-messages { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: ${c}; overscroll-behavior: contain; min-height: 0; }\n .ihooman-messages::-webkit-scrollbar { width: 6px; }\n .ihooman-messages::-webkit-scrollbar-track { background: transparent; }\n .ihooman-messages::-webkit-scrollbar-thumb { background: ${g}; border-radius: 3px; }\n .ihooman-message { display: flex; flex-direction: column; max-width: 85%; animation: ihooman-fadeIn 0.3s ease; }\n @keyframes ihooman-fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }\n .ihooman-message.user { align-self: flex-end; align-items: flex-end; }\n .ihooman-message.bot { align-self: flex-start; align-items: flex-start; }\n .ihooman-message-content { padding: 12px 16px; border-radius: 16px; word-wrap: break-word; }\n .ihooman-message.user .ihooman-message-content { background: ${b}; color: white; border-bottom-right-radius: 4px; }\n .ihooman-message.bot .ihooman-message-content { background: ${f}; color: ${m}; border-bottom-left-radius: 4px; }\n .ihooman-message-content code { background: rgba(0,0,0,0.1); padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 13px; }\n .ihooman-message-time { font-size: 11px; color: ${h}; margin-top: 4px; padding: 0 4px; }\n .ihooman-typing { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: ${f}; border-radius: 16px; border-bottom-left-radius: 4px; max-width: 80px; align-self: flex-start; }\n .ihooman-typing-dots { display: flex; gap: 4px; }\n .ihooman-typing-dot { width: 8px; height: 8px; background: ${h}; border-radius: 50%; animation: ihooman-typing 1.4s infinite; }\n .ihooman-typing-dot:nth-child(2) { animation-delay: 0.2s; }\n .ihooman-typing-dot:nth-child(3) { animation-delay: 0.4s; }\n @keyframes ihooman-typing { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }\n .ihooman-input-area { padding: 12px 16px; background: ${c}; border-top: 1px solid ${g}; flex-shrink: 0; }\n .ihooman-input-wrapper { display: flex; align-items: flex-end; gap: 8px; background: ${u}; border: 1px solid ${g}; border-radius: 12px; padding: 8px 12px; transition: border-color 0.2s, box-shadow 0.2s; }\n .ihooman-input-wrapper:focus-within { border-color: ${e}; box-shadow: 0 0 0 3px rgba(0, 174, 255, 0.1); }\n .ihooman-input { flex: 1; border: none; background: transparent; font-family: inherit; font-size: 14px; color: ${m}; resize: none; max-height: 100px; outline: none; line-height: 1.4; }\n .ihooman-input::placeholder { color: ${h}; }\n .ihooman-input-btn { width: 36px; height: 36px; border-radius: 10px; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; background: transparent; color: ${h}; }\n .ihooman-input-btn:hover { background: ${g}; color: ${m}; }\n .ihooman-input-btn.send { background: linear-gradient(135deg, ${t}, ${n}); color: white; }\n .ihooman-input-btn.send:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(0, 174, 255, 0.3); }\n .ihooman-input-btn.send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }\n .ihooman-input-btn svg { width: 18px; height: 18px; }\n .ihooman-file-input { display: none; }\n .ihooman-powered { text-align: center; padding: 8px; font-size: 11px; color: ${h}; background: ${c}; }\n .ihooman-powered a { color: ${e}; text-decoration: none; }\n .ihooman-error { padding: 16px; text-align: center; color: #ef4444; background: ${c}; }\n .ihooman-escalation-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }\n .ihooman-widget .ihooman-escalation-btn { display: inline-flex !important; align-items: center !important; gap: 8px !important; padding: 10px 18px !important; border-radius: 8px !important; border: none !important; cursor: pointer !important; font-family: inherit !important; font-size: 13px !important; font-weight: 500 !important; transition: all 0.2s ease !important; width: auto !important; height: auto !important; min-width: 120px !important; }\n .ihooman-widget .ihooman-escalation-btn svg { width: 16px !important; height: 16px !important; flex-shrink: 0 !important; }\n .ihooman-widget .ihooman-escalation-btn.primary { background: linear-gradient(135deg, ${t}, ${n}) !important; color: white !important; }\n .ihooman-widget .ihooman-escalation-btn.primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 174, 255, 0.3); }\n .ihooman-widget .ihooman-escalation-btn.secondary { background: ${l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.05)"} !important; color: ${m} !important; border: 1px solid ${g} !important; }\n .ihooman-widget .ihooman-escalation-btn.secondary:hover { background: ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.08)"} !important; }\n .ihooman-widget .ihooman-escalation-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }\n .ihooman-status-bar { padding: 10px 16px; text-align: center; font-size: 13px; display: none; }\n .ihooman-status-bar.show { display: block; }\n .ihooman-status-bar.waiting { background: #fef3c7; color: #92400e; }\n .ihooman-status-bar.connected { background: #dcfce7; color: #166534; }\n .ihooman-chat-view { display: flex; flex-direction: column; flex: 1; overflow: hidden; min-height: 0; }\n .ihooman-chat-view.hidden { display: none; }\n .ihooman-ticket-view { display: none; flex-direction: column; padding: 20px; gap: 16px; background: ${c}; flex: 1; overflow-y: auto; min-height: 0; }\n .ihooman-ticket-view.show { display: flex; }\n .ihooman-ticket-title { font-size: 18px; font-weight: 600; color: ${m}; margin: 0; display: flex; align-items: center; gap: 8px; }\n .ihooman-ticket-subtitle { font-size: 13px; color: ${h}; margin: 0; }\n .ihooman-ticket-input { padding: 12px 14px; border: 1px solid ${g}; border-radius: 10px; font-size: 14px; font-family: inherit; background: ${u}; color: ${m}; outline: none; transition: border-color 0.2s; }\n .ihooman-ticket-input:focus { border-color: ${e}; }\n .ihooman-ticket-input::placeholder { color: ${h}; }\n .ihooman-ticket-textarea { min-height: 100px; resize: vertical; }\n .ihooman-ticket-submit { padding: 14px; background: linear-gradient(135deg, ${t}, ${n}); color: white; border: none; border-radius: 10px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s; }\n .ihooman-ticket-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 174, 255, 0.3); }\n .ihooman-ticket-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }\n .ihooman-ticket-back { padding: 10px; background: transparent; color: ${h}; border: 1px solid ${g}; border-radius: 10px; font-size: 13px; cursor: pointer; transition: all 0.2s; }\n .ihooman-ticket-back:hover { background: ${l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.03)"}; }\n .ihooman-history-view { display: none; flex-direction: column; flex: 1; overflow: hidden; background: ${c}; }\n .ihooman-history-view.show { display: flex; }\n .ihooman-history-header { padding: 12px 16px; border-bottom: 1px solid ${g}; display: flex; justify-content: space-between; align-items: center; }\n .ihooman-history-title { font-size: 14px; font-weight: 600; color: ${m}; margin: 0; }\n .ihooman-history-new { display: inline-flex; align-items: center; gap: 4px; background: linear-gradient(135deg, ${t}, ${n}); color: white; border: none; padding: 8px 16px; border-radius: 8px !important; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; }\n .ihooman-history-new:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0, 174, 255, 0.3); }\n .ihooman-history-new svg { width: 14px; height: 14px; flex-shrink: 0; }\n .ihooman-history-list { flex: 1; overflow-y: auto; padding: 8px; overscroll-behavior: contain; }\n .ihooman-history-item { padding: 12px; border: 1px solid ${g}; border-radius: 8px; margin-bottom: 6px; cursor: pointer; transition: all 0.2s; background: ${c}; }\n .ihooman-history-item:hover { background: ${l?"rgba(255,255,255,0.05)":"#f8fafc"}; }\n .ihooman-history-item.active { background: ${l?"rgba(0, 174, 255, 0.1)":"#eff6ff"}; border-color: ${e}; }\n .ihooman-history-preview { font-size: 13px; color: ${m}; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n .ihooman-history-meta { font-size: 11px; color: ${h}; margin-top: 4px; display: flex; justify-content: space-between; }\n .ihooman-history-empty { padding: 40px; text-align: center; color: ${h}; font-size: 14px; }\n .ihooman-preset-questions { padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 6px; background: ${c}; border-top: 1px solid ${g}; }\n .ihooman-preset-questions:empty { display: none; }\n .ihooman-preset-questions.hidden { display: none !important; }\n .ihooman-widget .ihooman-preset-btn { display: inline-flex !important; align-items: center !important; gap: 4px !important; padding: 6px 12px !important; border-radius: 6px !important; border: 1px solid ${g} !important; background: ${l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)"} !important; color: ${m} !important; font-size: 12px !important; font-weight: 500 !important; cursor: pointer !important; transition: all 0.2s !important; white-space: nowrap !important; width: auto !important; height: auto !important; min-width: 0 !important; aspect-ratio: auto !important; }\n .ihooman-widget .ihooman-preset-btn:hover { background: ${l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.05)"} !important; border-color: ${e} !important; }\n .ihooman-widget .ihooman-preset-btn .icon { font-size: 12px !important; flex-shrink: 0 !important; }\n @media (max-width: 480px) { .ihooman-window { width: calc(100vw - 20px); height: calc(100vh - 100px); min-height: 400px; max-height: calc(100vh - 100px); left: 10px; right: 10px; bottom: 80px; } .ihooman-toggle { ${x?"right: 16px":"left: 16px"}; bottom: 16px; } }\n `}(),document.head.appendChild(e);const r=document.createElement("div");r.className="ihooman-widget",r.innerHTML=`\n <button class="ihooman-toggle" aria-label="Open chat">\n <span class="ihooman-pulse"></span>\n <span class="ihooman-badge"></span>\n <span class="chat-icon">${t}</span>\n <span class="close-icon">${n}</span>\n </button>\n <div class="ihooman-window" role="dialog" aria-label="Chat window">\n <div class="ihooman-container">\n <div class="ihooman-header">\n <div class="ihooman-header-avatar">${p.avatarUrl?`<img src="${V(p.avatarUrl)}" alt="Support">`:s}</div>\n <div class="ihooman-header-info">\n <div class="ihooman-header-title">${V(p.title||"Chat Support")}</div>\n <div class="ihooman-header-status"><span class="ihooman-status-dot"></span><span class="ihooman-status-text">Online</span></div>\n </div>\n <div class="ihooman-header-actions">\n <button class="ihooman-header-btn" data-action="history" title="Chat history">${l}</button>\n <button class="ihooman-header-btn" data-action="refresh" title="New conversation">${c}</button>\n <button class="ihooman-header-btn" data-action="minimize" title="Minimize">${a}</button>\n </div>\n </div>\n \n \x3c!-- Chat View --\x3e\n <div class="ihooman-chat-view">\n <div class="ihooman-status-bar"></div>\n <div class="ihooman-messages" role="log" aria-live="polite"></div>\n <div class="ihooman-preset-questions"></div>\n <div class="ihooman-input-area">\n <div class="ihooman-input-wrapper">\n ${p.enableFileUpload?`<button class="ihooman-input-btn attach" title="Attach file">${i}</button><input type="file" class="ihooman-file-input">`:""}\n <textarea class="ihooman-input" placeholder="${V(p.placeholder||"Type a message...")}" rows="1" aria-label="Message input"></textarea>\n <button class="ihooman-input-btn send" title="Send message" disabled>${o}</button>\n </div>\n </div>\n </div>\n \n \x3c!-- Ticket Form View --\x3e\n <div class="ihooman-ticket-view">\n <h4 class="ihooman-ticket-title">📝 Submit a Ticket</h4>\n <p class="ihooman-ticket-subtitle">We'll get back to you via email</p>\n <input class="ihooman-ticket-input" id="ihooman-ticket-name" placeholder="Your name" required>\n <input class="ihooman-ticket-input" id="ihooman-ticket-email" type="email" placeholder="Your email" required>\n <textarea class="ihooman-ticket-input ihooman-ticket-textarea" id="ihooman-ticket-issue" placeholder="Describe your issue..."></textarea>\n <button class="ihooman-ticket-submit" id="ihooman-ticket-submit">Submit Ticket</button>\n <button class="ihooman-ticket-back" id="ihooman-ticket-back">← Back to Chat</button>\n </div>\n \n \x3c!-- History View --\x3e\n <div class="ihooman-history-view">\n <div class="ihooman-history-header">\n <span class="ihooman-history-title">Your Conversations</span>\n <button class="ihooman-history-new" style="all: revert; display: inline-flex !important; align-items: center !important; gap: 4px !important; background: linear-gradient(135deg, ${p.gradientFrom}, ${p.gradientTo}) !important; color: white !important; border: none !important; padding: 6px 10px !important; border-radius: 6px !important; font-size: 12px !important; font-weight: 500 !important; cursor: pointer !important; width: auto !important; height: auto !important; min-width: 0 !important; aspect-ratio: auto !important;">${c} New Chat</button>\n </div>\n <div class="ihooman-history-list"></div>\n </div>\n \n ${p.poweredBy?'<div class="ihooman-powered">Powered by <a href="https://ihooman.ai" target="_blank" rel="noopener">Ihooman AI</a></div>':""}\n </div>\n </div>\n `,document.body.appendChild(r),u={widget:r,toggle:r.querySelector(".ihooman-toggle"),badge:r.querySelector(".ihooman-badge"),window:r.querySelector(".ihooman-window"),chatView:r.querySelector(".ihooman-chat-view"),ticketView:r.querySelector(".ihooman-ticket-view"),historyView:r.querySelector(".ihooman-history-view"),historyList:r.querySelector(".ihooman-history-list"),historyNewBtn:r.querySelector(".ihooman-history-new"),messages:r.querySelector(".ihooman-messages"),presetQuestions:r.querySelector(".ihooman-preset-questions"),input:r.querySelector(".ihooman-input"),sendBtn:r.querySelector(".ihooman-input-btn.send"),attachBtn:r.querySelector(".ihooman-input-btn.attach"),fileInput:r.querySelector(".ihooman-file-input"),statusDot:r.querySelector(".ihooman-status-dot"),statusText:r.querySelector(".ihooman-status-text"),statusBar:r.querySelector(".ihooman-status-bar"),ticketName:r.querySelector("#ihooman-ticket-name"),ticketEmail:r.querySelector("#ihooman-ticket-email"),ticketIssue:r.querySelector("#ihooman-ticket-issue"),ticketSubmitBtn:r.querySelector("#ihooman-ticket-submit"),ticketBackBtn:r.querySelector("#ihooman-ticket-back")},function(){if(!u.toggle||!u.sendBtn||!u.input)return;u.toggle.addEventListener("click",J),u.sendBtn.addEventListener("click",O),u.input.addEventListener("input",()=>{u.sendBtn&&(u.sendBtn.disabled=!u.input?.value.trim()),u.input&&(u.input.style.height="auto",u.input.style.height=Math.min(u.input.scrollHeight,100)+"px")}),u.input.addEventListener("keydown",e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),u.sendBtn?.disabled||O())}),u.attachBtn&&u.fileInput&&(u.attachBtn.addEventListener("click",()=>u.fileInput?.click()),u.fileInput.addEventListener("change",N));u.widget?.querySelector('[data-action="refresh"]')?.addEventListener("click",G),u.widget?.querySelector('[data-action="minimize"]')?.addEventListener("click",R),u.widget?.querySelector('[data-action="history"]')?.addEventListener("click",C),u.ticketSubmitBtn&&u.ticketSubmitBtn.addEventListener("click",L);u.ticketBackBtn&&u.ticketBackBtn.addEventListener("click",()=>T("chat"));u.historyNewBtn&&u.historyNewBtn.addEventListener("click",()=>{G(),T("chat")})}()}function S(e,t="bot",n={}){const o={id:v("msg_"),content:e,sender:t,timestamp:new Date,metadata:n};if(m.messages.push(o),!u.messages)return o;const i=document.createElement("div");i.className=`ihooman-message ${t}`;const a="bot"===t&&!0===n?.escalation_offered;let s="";if(a){const e="all: revert; display: inline-flex !important; align-items: center !important; justify-content: center !important; gap: 6px !important; padding: 8px 12px !important; border-radius: 6px !important; border: none !important; cursor: pointer !important; font-size: 12px !important; font-weight: 500 !important; line-height: 1.2 !important; width: auto !important; height: auto !important; min-width: 0 !important; min-height: 0 !important; max-width: none !important; max-height: none !important; aspect-ratio: auto !important; box-sizing: border-box !important;";s=`\n <div class="ihooman-escalation-actions" style="display: flex !important; gap: 8px !important; margin-top: 10px !important; flex-wrap: wrap !important;">\n <button class="ihooman-escalation-btn primary" data-action="live-agent" style="${`${e} background: linear-gradient(135deg, ${p.gradientFrom}, ${p.gradientTo}) !important; color: white !important;`}">\n ${r}\n <span>Talk to Agent</span>\n </button>\n <button class="ihooman-escalation-btn secondary" data-action="create-ticket" style="${`${e} background: rgba(0,0,0,0.05) !important; color: inherit !important; border: 1px solid rgba(0,0,0,0.1) !important;`}">\n ${d}\n <span>Create Ticket</span>\n </button>\n </div>\n `}var l,c;if(i.innerHTML=`\n <div class="ihooman-message-content">${c=e,c?V(c).replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/`(.*?)`/g,"<code>$1</code>").replace(/\n/g,"<br>"):""}</div>\n ${s}\n ${p.showTimestamps?`<div class="ihooman-message-time">${l=o.timestamp,new Date(l).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}</div>`:""}\n `,a){const e=i.querySelector('[data-action="live-agent"]'),t=i.querySelector('[data-action="create-ticket"]');e&&e.addEventListener("click",()=>I("live-agent")),t&&t.addEventListener("click",()=>I("create-ticket"))}const h=u.messages.querySelector(".ihooman-typing");return h&&h.remove(),u.messages.appendChild(i),u.messages.scrollTop=u.messages.scrollHeight,"bot"!==t||m.isOpen||(m.unreadCount++,u.badge&&(u.badge.textContent=String(m.unreadCount)),p.enableSounds&&function(){try{const e=new Audio("data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4Ljc2LjEwMAAAAAAAAAAAAAAA//tQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAAACAAABhgC7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7//////////////////////////////////////////////////////////////////8AAAAATGF2YzU4LjEzAAAAAAAAAAAAAAAAJAAAAAAAAAAAAYYNBrP/AAAAAAAAAAAAAAAAAAAAAP/7UMQAA8AAAaQAAAAgAAA0gAAABExBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tQxBKDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU=");e.volume=.3,e.play().catch(()=>{})}catch{}}()),A("message",o),o}function _(){u.presetQuestions&&0!==K.length?(u.presetQuestions.innerHTML=K.map(e=>`\n <button class="ihooman-preset-btn" data-question-id="${V(e.id)}" data-question-text="${V(e.text)}">\n ${e.icon?`<span class="icon">${V(e.icon)}</span>`:""}\n <span>${V(e.text)}</span>\n </button>\n `).join(""),u.presetQuestions.querySelectorAll(".ihooman-preset-btn").forEach(e=>{e.addEventListener("click",()=>{const t=e.dataset.questionText;t&&function(e){j(),S(e,"user"),M(),F(e)}(t)})})):u.presetQuestions&&(u.presetQuestions.innerHTML="")}function I(e){document.querySelectorAll(".ihooman-escalation-btn").forEach(e=>e.disabled=!0),"live-agent"===e?async function(){if(!m.sessionId)return void S("Please send a message first to start a conversation.","bot",{is_system_message:!0});const e=u.widget?.querySelector('[data-action="live-agent"]');e&&(e.disabled=!0,e.innerHTML='<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg> Connecting...');try{const e=await fetch(`${p.serverUrl}/api/widget/live-agent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({widget_id:p.widgetId,session_id:m.sessionId,visitor_id:m.visitorId})}),t=await e.json();g=!0,t.position_in_queue&&t.position_in_queue>1?B("waiting",`⏳ Waiting for agent (Position: #${t.position_in_queue})`):B("waiting","⏳ Connecting to live support..."),q()}catch(e){console.error("Error requesting live agent:",e),S("❌ Unable to connect to live support. Please try again.","bot",{is_system_message:!0})}e&&(e.disabled=!1,e.innerHTML='<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg> Live Agent')}():"create-ticket"===e&&(T("ticket"),setTimeout(()=>u.ticketName?.focus(),100))}function T(e){h=e,u.chatView&&u.chatView.classList.toggle("hidden","chat"!==e),u.ticketView&&u.ticketView.classList.toggle("show","ticket"===e),u.historyView&&u.historyView.classList.toggle("show","history"===e),"history"===e&&async function(){if(!u.historyList||!m.visitorId)return;u.historyList.innerHTML='<div class="ihooman-history-empty">Loading...</div>';try{const e=await fetch(`${p.serverUrl}/api/widget/conversations?widget_id=${p.widgetId}&visitor_id=${m.visitorId}&limit=20`);if(!e.ok)throw new Error("Failed to load history");const t=await e.json();if(!t.length)return void(u.historyList.innerHTML='<div class="ihooman-history-empty">No conversations yet</div>');u.historyList.innerHTML=t.map(e=>`\n <div class="ihooman-history-item ${e.session_id===m.sessionId?"active":""}" data-session-id="${e.session_id}">\n <div class="ihooman-history-preview">${V(e.preview||"New conversation")}</div>\n <div class="ihooman-history-meta">\n <span>${e.message_count} msgs</span>\n <span>${"pending"===e.status?"🟡 Pending":"closed"===e.status?"✓ Closed":""} ${function(e){const t=Date.now()-new Date(e).getTime();return t<6e4?"now":t<36e5?Math.floor(t/6e4)+"m":t<864e5?Math.floor(t/36e5)+"h":Math.floor(t/864e5)+"d"}(e.updated_at)}</span>\n </div>\n </div>\n `).join(""),u.historyList.querySelectorAll(".ihooman-history-item").forEach(e=>{e.addEventListener("click",()=>{const t=e.dataset.sessionId;t&&async function(e){m.sessionId=e,p.persistSession&&k("session_id",e);u.messages&&(u.messages.innerHTML="");g=!1,z(),B("hidden"),w=!0,f&&(f.close(),f=null);H(),T("chat"),await async function(e){try{const t=await fetch(`${p.serverUrl}/api/widget/transcript/${e}?widget_id=${p.widgetId}`);if(!t.ok)throw new Error("Failed to load messages");const n=await t.json();u.messages&&(u.messages.innerHTML=""),n.messages&&n.messages.length>0?n.messages.forEach(e=>{const t="user"===e.sender_type?"user":"bot";S(e.content,t,e.extra_data||{})}):p.welcomeMessage&&S(p.welcomeMessage,"bot"),"pending"===n.status?(g=!0,q(),B("waiting","⏳ Waiting for agent...")):"closed"===n.status&&B("hidden")}catch(e){console.error("Error loading conversation messages:",e),p.welcomeMessage&&S(p.welcomeMessage,"bot")}}(e)}(t)})})}catch(e){console.error("Error loading conversation history:",e),u.historyList.innerHTML='<div class="ihooman-history-empty">Failed to load history</div>'}}()}function C(){T("history"===h?"chat":"history")}function B(e,t){u.statusBar&&("hidden"!==e?(u.statusBar.classList.add("show"),u.statusBar.classList.remove("waiting","connected"),u.statusBar.classList.add(e),t&&(u.statusBar.textContent=t)):u.statusBar.classList.remove("show"))}async function L(){const e=u.ticketName?.value.trim(),t=u.ticketEmail?.value.trim(),n=u.ticketIssue?.value.trim();if(e&&t){u.ticketSubmitBtn&&(u.ticketSubmitBtn.disabled=!0,u.ticketSubmitBtn.textContent="Submitting...");try{const o=await fetch(`${p.serverUrl}/api/widget/submit-ticket`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({widget_id:p.widgetId,session_id:m.sessionId,user_name:e,user_email:t,issue:n||"No description provided"})}),i=await o.json();u.ticketName&&(u.ticketName.value=""),u.ticketEmail&&(u.ticketEmail.value=""),u.ticketIssue&&(u.ticketIssue.value=""),T("chat");S(`✅ Ticket submitted! We'll contact you at ${t}. Reference: #${i.ticket_id?i.ticket_id.slice(0,8):"submitted"}`,"bot",{is_system_message:!0})}catch(e){console.error("Error submitting ticket:",e),S("❌ Error submitting ticket. Please try again.","bot",{is_system_message:!0})}u.ticketSubmitBtn&&(u.ticketSubmitBtn.disabled=!1,u.ticketSubmitBtn.textContent="Submit Ticket")}else alert("Please fill in your name and email")}let E=null;function q(){E||(E=setInterval(async()=>{if(m.sessionId&&g)try{try{const e=await fetch(`${p.serverUrl}/api/widget/escalation-status/${m.sessionId}?widget_id=${p.widgetId}`);if(e.ok){const t=await e.json();t.escalated&&("in_progress"===t.ticket_status?B("connected","🟢 Connected to live agent"):"open"===t.ticket_status?t.position_in_queue&&t.position_in_queue>1?B("waiting",`⏳ Waiting for agent (Position: #${t.position_in_queue})`):B("waiting","⏳ Waiting for agent..."):"closed"!==t.ticket_status&&"resolved"!==t.ticket_status||(g=!1,z(),B("hidden"),S("This conversation has been closed. Thank you for contacting us!","bot",{is_system_message:!0})))}}catch{}}catch(e){console.error("Error polling for messages:",e)}else z()},3e3))}function z(){E&&(clearInterval(E),E=null)}function M(){if(!p.showTypingIndicator||!u.messages)return;if(u.messages.querySelector(".ihooman-typing"))return;const e=document.createElement("div");e.className="ihooman-typing",e.innerHTML='<div class="ihooman-typing-dots"><span class="ihooman-typing-dot"></span><span class="ihooman-typing-dot"></span><span class="ihooman-typing-dot"></span></div>',u.messages.appendChild(e),u.messages.scrollTop=u.messages.scrollHeight}function U(){const e=u.messages?.querySelector(".ihooman-typing");e&&e.remove()}function O(){const e=u.input?.value.trim();e&&(j(),u.input&&(u.input.value="",u.input.style.height="auto"),u.sendBtn&&(u.sendBtn.disabled=!0),S(e,"user"),M(),F(e))}function j(){u.presetQuestions&&u.presetQuestions.classList.add("hidden")}async function F(e){if(f&&f.readyState===WebSocket.OPEN)f.send(JSON.stringify({type:"message",content:e}));else try{const t=await fetch(`${p.serverUrl}/api/v1/public/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e,session_id:m.sessionId,visitor_id:m.visitorId,widget_id:p.widgetId})}),n=await t.json();U(),n.session_id&&(m.sessionId=n.session_id,p.persistSession&&k("session_id",m.sessionId)),n.response&&S(n.response,"bot",{sources:n.sources,confidence:n.confidence})}catch(e){U(),S("Sorry, something went wrong. Please try again.","bot"),A("error",e)}}function N(e){const t=e.target,n=t.files?.[0];if(!n)return;S(`📎 Uploading: ${n.name}...`,"user"),M();const o=new FormData;o.append("file",n),o.append("session_id",m.sessionId||""),o.append("visitor_id",m.visitorId||""),o.append("widget_id",p.widgetId),fetch(`${p.serverUrl}/api/upload`,{method:"POST",body:o}).then(e=>e.json()).then(e=>{U(),e.message&&S(e.message,"bot")}).catch(()=>{U(),S("Failed to upload file.","bot")}),t.value=""}function H(e){if(!p.serverUrl&&!e)return;let t;if(p.widgetId){const e=p.serverUrl?.replace(/^http/,"ws"),n=new URLSearchParams({widget_id:p.widgetId});m.visitorId&&n.append("visitor_id",m.visitorId),m.sessionId&&n.append("session_id",m.sessionId),t=`${e}/public/ws?${n.toString()}`}else t=e||p.serverUrl?.replace(/^http/,"ws")+"/ws";try{W(),f=new WebSocket(t),f.onopen=()=>{m.isConnected=!0,y=0,Q(!0),A("connected"),W(),P=setInterval(()=>{if(f&&f.readyState===WebSocket.OPEN)try{f.send(JSON.stringify({type:"ping"}))}catch(e){console.warn("Failed to send heartbeat ping:",e)}},25e3)},f.onclose=t=>{if(m.isConnected=!1,Q(!1),W(),A("disconnected"),console.log(`WebSocket closed: code=${t.code}, reason=${t.reason||"none"}, wasClean=${t.wasClean}`),w)w=!1;else if(m.isOpen)if(y<5){y++;const t=Math.min(1e3*Math.pow(2,y),3e4);console.log(`WebSocket reconnecting in ${t}ms (attempt ${y}/5)`),setTimeout(()=>H(e),t)}else console.warn("WebSocket reconnection failed, falling back to polling"),D()},f.onerror=e=>{console.error("WebSocket error:",e)},f.onmessage=e=>{try{const t=JSON.parse(e.data);if("connected"===t.type)t.session_id&&(m.sessionId=t.session_id,p.persistSession&&k("session_id",m.sessionId)),t.visitor_id&&(m.visitorId=t.visitor_id,p.persistSession&&k("visitor_id",m.visitorId)),t.welcome_message&&0===m.messages.length&&S(t.welcome_message,"bot");else if("message"===t.type){U();const e="user"===t.sender?"user":"bot";S(t.content,e,{confidence:t.confidence,agent_name:t.agent_name,escalation_offered:t.escalation_offered,escalated:t.escalated})}else"typing"===t.type?t.is_typing?M():U():"pong"===t.type||"error"===t.type&&(console.error("WebSocket server error:",t.message),A("error",{message:t.message}))}catch{}}}catch{console.warn("WebSocket not supported, using polling"),D()}}let P=null;function W(){P&&(clearInterval(P),P=null)}function D(){x||(x=setInterval(async()=>{if(m.sessionId)try{const e=await fetch(`${p.serverUrl}/api/messages?session_id=${m.sessionId}&since=${Date.now()-5e3}&widget_id=${p.widgetId}`),t=await e.json();t.messages&&t.messages.forEach(e=>{m.messages.find(t=>t.id===e.id)||S(e.content,e.sender_type,e.metadata)})}catch{}},5e3))}function Q(e){u.statusDot&&u.statusDot.classList.toggle("offline",!e),u.statusText&&(u.statusText.textContent=e?"Online":"Offline")}function Y(){m.isOpen||(m.isOpen=!0,m.unreadCount=0,u.badge&&(u.badge.textContent=""),u.toggle&&u.toggle.classList.add("open"),u.window&&u.window.classList.add("open"),setTimeout(()=>u.input?.focus(),300),A("open"))}function R(){m.isOpen&&(m.isOpen=!1,u.toggle&&u.toggle.classList.remove("open"),u.window&&u.window.classList.remove("open"),A("close"))}function J(){m.isOpen?R():Y()}function G(){m.sessionId=null,m.visitorId=null,m.messages=[],g=!1,k("session_id",null),m.visitorId=v("v_"),k("visitor_id",m.visitorId),u.messages&&(u.messages.innerHTML=""),B("hidden"),z(),y=0,f&&(w=!0,f.close(),f=null),H(),p.welcomeMessage&&S(p.welcomeMessage,"bot"),A("newConversation")}let K=[];async function Z(t){if(!t.widgetId)return console.error("IhoomanChat: widgetId is required"),null;p={...e,...t},m.visitorId=k("visitor_id")||v("v_"),k("visitor_id",m.visitorId),p.persistSession&&(m.sessionId=k("session_id"));const n=p.serverUrl||"https://api.ihooman.ai",o=await async function(e,t){try{const n=await fetch(`${t}/api/widget/config?widget_id=${encodeURIComponent(e)}`);return n.ok?await n.json():{success:!1,error:(await n.json().catch(()=>({}))).error||`HTTP ${n.status}`}}catch(e){return{success:!1,error:"Unable to connect. Please check your internet connection."}}}(p.widgetId,n);let i;var a;return o.success&&o.config?(a=o.config,p.title=a.title||p.title,p.subtitle=a.subtitle||p.subtitle,p.welcomeMessage=a.welcomeMessage||p.welcomeMessage,p.placeholder=a.placeholder||p.placeholder,p.position=a.position||p.position,a.theme&&(p.primaryColor=a.theme.primaryColor||p.primaryColor,p.gradientFrom=a.theme.gradientFrom||p.gradientFrom,p.gradientTo=a.theme.gradientTo||p.gradientTo,p.fontFamily=a.theme.fontFamily||p.fontFamily,a.theme.borderRadius&&(p.borderRadius=parseInt(a.theme.borderRadius,10)||p.borderRadius)),a.behavior&&(p.startOpen=a.behavior.startOpen??p.startOpen,p.showTypingIndicator=a.behavior.showTypingIndicator??p.showTypingIndicator,p.showTimestamps=a.behavior.showTimestamps??p.showTimestamps,p.enableSounds=a.behavior.enableSounds??p.enableSounds,p.enableFileUpload=a.behavior.enableFileUpload??p.enableFileUpload,p.persistSession=a.behavior.persistSession??p.persistSession),a.branding&&(p.avatarUrl=a.branding.avatarUrl||p.avatarUrl,p.poweredBy=a.branding.poweredBy??p.poweredBy),a.presetQuestions&&Array.isArray(a.presetQuestions)&&(K=a.presetQuestions),i=o.chatEndpoint):o.error&&(console.warn("IhoomanChat: Could not fetch server config:",o.error),"Widget not authorized for this domain"===o.error&&console.error("IhoomanChat: Widget configuration error. Please contact support.")),$(),_(),m.messages.forEach(e=>S(e.content,e.sender,e.metadata)),0===m.messages.length&&p.welcomeMessage&&S(p.welcomeMessage,"bot"),H(i),p.startOpen&&setTimeout(Y,500),A("ready"),X}const X={init:Z,open:Y,close:R,toggle:J,destroy:function(){W(),z(),w=!0,f&&(f.close(),f=null),x&&(clearInterval(x),x=null),u.widget&&u.widget.remove();const e=document.getElementById("ihooman-widget-styles");e&&e.remove(),m={isOpen:!1,isConnected:!1,messages:[],sessionId:null,visitorId:null,unreadCount:0},u={},y=0,w=!1},sendMessage:function(e){e.trim()&&(u.input&&(u.input.value=e),O())},setUser:function(e){e.name&&k("user_name",e.name),e.email&&k("user_email",e.email),e.metadata&&k("user_metadata",e.metadata)},clearHistory:function(){G()},on:function(e,t){b[e]||(b[e]=[]),b[e].push(t)},off:function(e,t){b[e]&&(b[e]=b[e].filter(e=>e!==t))},getState:function(){return{...m}},version:"2.0.0"},ee=X;function te(){return{...X}}!function(){if("undefined"==typeof document)return;let e=document.currentScript;if(!e){const t=document.getElementsByTagName("script");for(let n=0;n<t.length;n++)if(t[n].src&&t[n].src.includes("ihooman")){e=t[n];break}}if(!e)return;const t=e.getAttribute("data-widget-id");if(t){const n={widgetId:t},o=e.getAttribute("data-server-url");o&&(n.serverUrl=o);const i=e.getAttribute("data-theme");"light"!==i&&"dark"!==i||(n.theme=i);const a=e.getAttribute("data-position");a&&(n.position=a);"true"===e.getAttribute("data-start-open")&&(n.startOpen=!0),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>Z(n)):Z(n)}}(),"undefined"!=typeof window&&(window.IhoomanChat=ee);export{ee as IhoomanChat,te as createWidgetInstance,ee as default};
2
2
  //# sourceMappingURL=index.esm.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.min.js","sources":["../src/widget.ts"],"sourcesContent":[null],"names":["defaultConfig","serverUrl","theme","position","title","subtitle","welcomeMessage","placeholder","primaryColor","gradientFrom","gradientTo","showTimestamps","showTypingIndicator","enableSounds","enableFileUpload","startOpen","persistSession","zIndex","width","height","buttonSize","borderRadius","fontFamily","avatarUrl","poweredBy","icons","config","widgetId","state","isOpen","isConnected","messages","sessionId","visitorId","unreadCount","currentView","isLiveAgentMode","elements","eventListeners","ws","pollInterval","reconnectAttempts","intentionalDisconnect","generateId","prefix","Math","random","toString","slice","Date","now","escapeHtml","text","div","document","createElement","textContent","innerHTML","storage","key","value","fullKey","undefined","item","localStorage","getItem","JSON","parse","removeItem","setItem","stringify","emit","event","data","forEach","fn","e","console","error","callbackName","charAt","toUpperCase","callback","createWidget","styleEl","id","isDark","bgColor","textColor","mutedColor","borderColor","inputBg","messageBgUser","messageBgBot","positionRight","includes","positionBottom","generateStyles","head","appendChild","widget","className","body","toggle","querySelector","badge","window","chatView","ticketView","historyView","historyList","historyNewBtn","presetQuestions","input","sendBtn","attachBtn","fileInput","statusDot","statusText","statusBar","ticketName","ticketEmail","ticketIssue","ticketSubmitBtn","ticketBackBtn","addEventListener","handleSendClick","disabled","trim","style","min","scrollHeight","shiftKey","preventDefault","click","handleFileSelect","startNewConversation","close","toggleHistoryView","handleSubmitTicket","showView","setupEventListeners","addMessage","content","sender","metadata","message","timestamp","push","el","showEscalationButtons","escalation_offered","escalationButtonsHtml","btnBaseStyle","date","replace","toLocaleTimeString","hour","minute","liveAgentBtn","ticketBtn","handleEscalationAction","typing","remove","scrollTop","String","audio","Audio","volume","play","catch","playSound","renderPresetQuestions","length","map","q","icon","join","querySelectorAll","btn","questionText","dataset","hidePresetQuestions","showTyping","sendMessageToServer","handlePresetQuestionClick","action","async","is_system_message","liveBtn","response","fetch","method","headers","widget_id","session_id","visitor_id","json","position_in_queue","updateStatusBar","startLiveAgentPolling","handleRequestLiveAgent","setTimeout","focus","view","classList","ok","Error","conversations","conv","preview","message_count","status","diff","getTime","floor","timeAgo","updated_at","stopLiveAgentPolling","connectWebSocket","msg","sender_type","extra_data","loadConversationMessages","switchToConversation","loadConversationHistory","add","name","email","issue","user_name","user_email","ticket_id","alert","liveAgentPollInterval","setInterval","escResponse","escData","escalated","ticket_status","clearInterval","hideTyping","readyState","WebSocket","OPEN","send","type","sources","confidence","target","file","files","formData","FormData","append","then","r","chatEndpoint","wsUrl","baseWsUrl","params","URLSearchParams","stopHeartbeat","onopen","updateStatus","heartbeatInterval","warn","onclose","log","code","reason","wasClean","delay","pow","startPolling","onerror","onmessage","welcome_message","agent_name","is_typing","find","m","online","open","init","userConfig","configResponse","encodeURIComponent","success","fetchWidgetConfig","serverConfig","parseInt","behavior","branding","Array","isArray","publicAPI","destroy","styles","getElementById","sendMessage","setUser","user","clearHistory","on","off","filter","getState","version","IhoomanChat","createWidgetInstance","script","currentScript","scripts","getElementsByTagName","i","src","getAttribute","autoConfig"],"mappings":"AA2BA,MAMMA,EAAuC,CAC3CC,UAAW,yBACXC,MAAO,QACPC,SAAU,eACVC,MAAO,eACPC,SAAU,oCACVC,eAAgB,0CAChBC,YAAa,oBACbC,aAAc,UACdC,aAAc,UACdC,WAAY,UACZC,gBAAgB,EAChBC,qBAAqB,EACrBC,cAAc,EACdC,kBAAkB,EAClBC,WAAW,EACXC,gBAAgB,EACh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,CAzCD,GA4CsB,oBAAXpN,SACRA,OAA8C2M,YAAcA"}
1
+ {"version":3,"file":"index.esm.min.js","sources":["../src/widget.ts"],"sourcesContent":[null],"names":["defaultConfig","serverUrl","theme","position","title","subtitle","welcomeMessage","placeholder","primaryColor","gradientFrom","gradientTo","showTimestamps","showTypingIndicator","enableSounds","enableFileUpload","startOpen","persistSession","zIndex","width","height","buttonSize","borderRadius","fontFamily","avatarUrl","poweredBy","icons","config","widgetId","state","isOpen","isConnected","messages","sessionId","visitorId","unreadCount","currentView","isLiveAgentMode","elements","eventListeners","ws","pollInterval","reconnectAttempts","intentionalDisconnect","generateId","prefix","Math","random","toString","slice","Date","now","escapeHtml","text","div","document","createElement","textContent","innerHTML","storage","key","value","fullKey","undefined","item","localStorage","getItem","JSON","parse","removeItem","setItem","stringify","emit","event","data","forEach","fn","e","console","error","callbackName","charAt","toUpperCase","callback","createWidget","styleEl","id","isDark","bgColor","textColor","mutedColor","borderColor","inputBg","messageBgUser","messageBgBot","positionRight","includes","positionBottom","generateStyles","head","appendChild","widget","className","body","toggle","querySelector","badge","window","chatView","ticketView","historyView","historyList","historyNewBtn","presetQuestions","input","sendBtn","attachBtn","fileInput","statusDot","statusText","statusBar","ticketName","ticketEmail","ticketIssue","ticketSubmitBtn","ticketBackBtn","addEventListener","handleSendClick","disabled","trim","style","min","scrollHeight","shiftKey","preventDefault","click","handleFileSelect","startNewConversation","close","toggleHistoryView","handleSubmitTicket","showView","setupEventListeners","addMessage","content","sender","metadata","message","timestamp","push","el","showEscalationButtons","escalation_offered","escalationButtonsHtml","btnBaseStyle","date","replace","toLocaleTimeString","hour","minute","liveAgentBtn","ticketBtn","handleEscalationAction","typing","remove","scrollTop","String","audio","Audio","volume","play","catch","playSound","renderPresetQuestions","length","map","q","icon","join","querySelectorAll","btn","questionText","dataset","hidePresetQuestions","showTyping","sendMessageToServer","handlePresetQuestionClick","action","async","is_system_message","liveBtn","response","fetch","method","headers","widget_id","session_id","visitor_id","json","position_in_queue","updateStatusBar","startLiveAgentPolling","handleRequestLiveAgent","setTimeout","focus","view","classList","ok","Error","conversations","conv","preview","message_count","status","diff","getTime","floor","timeAgo","updated_at","stopLiveAgentPolling","connectWebSocket","msg","sender_type","extra_data","loadConversationMessages","switchToConversation","loadConversationHistory","add","name","email","issue","user_name","user_email","ticket_id","alert","liveAgentPollInterval","setInterval","escResponse","escData","escalated","ticket_status","clearInterval","hideTyping","readyState","WebSocket","OPEN","send","type","sources","confidence","target","file","files","formData","FormData","append","then","r","chatEndpoint","wsUrl","baseWsUrl","params","URLSearchParams","stopHeartbeat","onopen","updateStatus","heartbeatInterval","warn","onclose","log","code","reason","wasClean","delay","pow","startPolling","onerror","onmessage","welcome_message","agent_name","is_typing","find","m","online","open","init","userConfig","configResponse","encodeURIComponent","success","fetchWidgetConfig","serverConfig","parseInt","behavior","branding","Array","isArray","publicAPI","destroy","styles","getElementById","sendMessage","setUser","user","clearHistory","on","off","filter","getState","version","IhoomanChat","createWidgetInstance","script","currentScript","scripts","getElementsByTagName","i","src","getAttribute","autoConfig"],"mappings":"AA2BA,MAMMA,EAAuC,CAC3CC,UAAW,yBACXC,MAAO,QACPC,SAAU,eACVC,MAAO,eACPC,SAAU,oCACVC,eAAgB,0CAChBC,YAAa,oBACbC,aAAc,UACdC,aAAc,UACdC,WAAY,UACZC,gBAAgB,EAChBC,qBAAqB,EACrBC,cAAc,EACdC,kBAAkB,EAClBC,WAAW,EACXC,gBAAgB,EAChBC,OAAQ,KACRC,MAAO,IACPC,OAAQ,IACRC,WAAY,GACZC,aAAc,GACdC,WAAY,oEACZC,UAAW,GACXC,WAAW,GAOPC,EACE,oKADFA,EAEG,2KAFHA,EAGE,uLAHFA,EAII,wNAJJA,EAKM,iIALNA,EAOC,4MAPDA,EAQG,sLARHA,EASI,2VATJA,EAUK,4KAVLA,EAYE,6KAMR,IAAIC,EAAuB,CAAEC,SAAU,MAAO3B,GAC1C4B,EAAqB,CACvBC,QAAQ,EACRC,aAAa,EACb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AO0O,OAAQvO,GAAOA,IAAOO,GAExE,EAqNEiO,SAhNF,WACE,MAAO,IAAKvR,EACd,EA+MEwR,QAzxDc,SA+xDHC,GAA8Bb,WAK3Bc,KACd,MAAO,IAAKd,EACd,EAUA,WACE,GAAwB,oBAAblP,SAA0B,OAErC,IAAIiQ,EAAmCjQ,SAASkQ,cAEhD,IAAKD,EAAQ,CACX,MAAME,EAAUnQ,SAASoQ,qBAAqB,UAC9C,IAAK,IAAIC,EAAI,EAAGA,EAAIF,EAAQ5I,OAAQ8I,IAClC,GAAIF,EAAQE,GAAGC,KAAOH,EAAQE,GAAGC,IAAI7N,SAAS,WAAY,CACxDwN,EAASE,EAAQE,GACjB,KACF,CAEJ,CAEA,IAAKJ,EAAQ,OAEb,MAAM5R,EAAW4R,EAAOM,aAAa,kBACrC,GAAIlS,EAAU,CACZ,MAAMmS,EAA2D,CAAEnS,YAG7D1B,EAAYsT,EAAOM,aAAa,mBAClC5T,IAAW6T,EAAW7T,UAAYA,GAEtC,MAAMC,EAAQqT,EAAOM,aAAa,cACpB,UAAV3T,GAA+B,SAAVA,IAAkB4T,EAAW5T,MAAQA,GAE9D,MAAMC,EAAWoT,EAAOM,aAAa,iBACjC1T,IAAU2T,EAAW3T,SAAWA,GAGlB,SADAoT,EAAOM,aAAa,qBACZC,EAAW/S,WAAY,GAGrB,YAAxBuC,SAAS4L,WACX5L,SAASuE,iBAAiB,mBAAoB,IAAM+J,EAAKkC,IAEzDlC,EAAKkC,EAET,CACD,CAzCD,GA4CsB,oBAAXpN,SACRA,OAA8C2M,YAAcA"}
package/dist/index.umd.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @ihoomanai/chat-widget v2.5.13
2
+ * @ihoomanai/chat-widget v3.0.0
3
3
  * Universal chat support widget for any website - secure Widget ID based initialization
4
4
  *
5
5
  * @license MIT
@@ -216,9 +216,9 @@
216
216
  .ihooman-toggle.open .ihooman-pulse { display: none; }
217
217
  .ihooman-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px; background: #ef4444; color: white; font-size: 11px; font-weight: 600; border-radius: 10px; display: flex; align-items: center; justify-content: center; z-index: 2; }
218
218
  .ihooman-badge:empty { display: none; }
219
- .ihooman-window { position: fixed; ${positionRight ? 'right: 20px' : 'left: 20px'}; ${positionBottom ? 'bottom: 90px' : 'top: 90px'}; width: ${width}px; height: ${height}px; max-height: calc(100vh - 120px); z-index: ${(zIndex ?? 9999) - 1}; display: flex; flex-direction: column; opacity: 0; visibility: hidden; transform: translateY(20px) scale(0.95); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); overscroll-behavior: contain; }
219
+ .ihooman-window { position: fixed; ${positionRight ? 'right: 20px' : 'left: 20px'}; ${positionBottom ? 'bottom: 90px' : 'top: 90px'}; width: ${width}px; height: ${height}px; min-height: ${height}px; max-height: ${height}px; z-index: ${(zIndex ?? 9999) - 1}; display: flex; flex-direction: column; opacity: 0; visibility: hidden; transform: translateY(20px) scale(0.95); transition: opacity 0.3s, visibility 0.3s, transform 0.3s; overscroll-behavior: contain; }
220
220
  .ihooman-window.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
221
- .ihooman-container { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; border-radius: ${borderRadius}px; overflow: hidden; }
221
+ .ihooman-container { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; border-radius: ${borderRadius}px; overflow: hidden; flex-shrink: 0; }
222
222
  .ihooman-container::before { content: ''; position: absolute; inset: 0; background: ${bgColor}; opacity: 0.97; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: ${borderRadius}px; border: 1px solid ${borderColor}; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); }
223
223
  .ihooman-container > * { position: relative; z-index: 1; }
224
224
  .ihooman-header { padding: 16px 20px; background: linear-gradient(135deg, ${gradientFrom}, ${gradientTo}); color: white; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
@@ -315,7 +315,7 @@
315
315
  .ihooman-widget .ihooman-preset-btn { display: inline-flex !important; align-items: center !important; gap: 4px !important; padding: 6px 12px !important; border-radius: 6px !important; border: 1px solid ${borderColor} !important; background: ${isDark ? 'rgba(255,255,255,0.05)' : 'rgba(0,0,0,0.02)'} !important; color: ${textColor} !important; font-size: 12px !important; font-weight: 500 !important; cursor: pointer !important; transition: all 0.2s !important; white-space: nowrap !important; width: auto !important; height: auto !important; min-width: 0 !important; aspect-ratio: auto !important; }
316
316
  .ihooman-widget .ihooman-preset-btn:hover { background: ${isDark ? 'rgba(255,255,255,0.1)' : 'rgba(0,0,0,0.05)'} !important; border-color: ${primaryColor} !important; }
317
317
  .ihooman-widget .ihooman-preset-btn .icon { font-size: 12px !important; flex-shrink: 0 !important; }
318
- @media (max-width: 480px) { .ihooman-window { width: calc(100vw - 20px); height: calc(100vh - 100px); left: 10px; right: 10px; bottom: 80px; max-height: none; } .ihooman-toggle { ${positionRight ? 'right: 16px' : 'left: 16px'}; bottom: 16px; } }
318
+ @media (max-width: 480px) { .ihooman-window { width: calc(100vw - 20px); height: calc(100vh - 100px); min-height: 400px; max-height: calc(100vh - 100px); left: 10px; right: 10px; bottom: 80px; } .ihooman-toggle { ${positionRight ? 'right: 16px' : 'left: 16px'}; bottom: 16px; } }
319
319
  `;
320
320
  }
321
321
  // ============================================================================
@@ -1664,6 +1664,17 @@
1664
1664
  * Universal chat support widget for any website.
1665
1665
  * Uses secure Widget ID based initialization - no API keys exposed in client code.
1666
1666
  *
1667
+ * Enhanced with professional features:
1668
+ * - Proactive messages with triggers (time, scroll, exit intent, URL pattern)
1669
+ * - Survey support (star, NPS, emoji ratings)
1670
+ * - Rich message types (carousel, forms, buttons, quick replies)
1671
+ * - Message feedback (thumbs up/down)
1672
+ * - Conversation history
1673
+ * - Live agent escalation
1674
+ * - Ticket submission
1675
+ * - Localization support
1676
+ * - Security features (domain validation, XSS prevention)
1677
+ *
1667
1678
  * @packageDocumentation
1668
1679
  */
1669
1680