@ihoomanai/chat-widget 2.5.13 → 2.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +4 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/widget.ts +3 -3
package/dist/index.umd.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).IhoomanChat={})}(this,function(e){"use strict";const t={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},o='<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>',i='<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>',a='<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>',s='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"></line></svg>',r='<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>',d='<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>',l='<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>',c='<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>',p='<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 m={widgetId:"",...t},h={isOpen:!1,isConnected:!1,messages:[],sessionId:null,visitorId:null,unreadCount:0},u="chat",g=!1,f={};const b={};let x=null,y=null,w=0;let v=!1;function V(e=""){return e+Math.random().toString(36).slice(2,14)+Date.now().toString(36)}function k(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}function A(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 $(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=m[o];if("function"==typeof n)try{n(t)}catch(e){console.error(`Error in ${o} callback:`,e)}}function S(){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}=m,l="dark"===m.theme,c=l?"#1a1a2e":"#ffffff",p=l?"#e4e4e7":"#1f2937",h=l?"#71717a":"#6b7280",u=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.08)",g=l?"#16162a":"#f9fafb",f=`linear-gradient(135deg, ${t}, ${o})`,b=l?"#252542":"#f1f5f9",x=m.position?.includes("right")??!0,y=m.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: ${p}; -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 ${u}; 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: ${u}; 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: ${f}; color: white; border-bottom-right-radius: 4px; }\n .ihooman-message.bot .ihooman-message-content { background: ${b}; color: ${p}; 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: ${b}; 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 ${u}; flex-shrink: 0; }\n .ihooman-input-wrapper { display: flex; align-items: flex-end; gap: 8px; background: ${g}; border: 1px solid ${u}; 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: ${p}; 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: ${u}; color: ${p}; }\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: ${p} !important; border: 1px solid ${u} !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: ${p}; 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 ${u}; border-radius: 10px; font-size: 14px; font-family: inherit; background: ${g}; color: ${p}; 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 ${u}; 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 ${u}; display: flex; justify-content: space-between; align-items: center; }\n .ihooman-history-title { font-size: 14px; font-weight: 600; color: ${p}; 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 ${u}; 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: ${p}; 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 ${u}; }\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 ${u} !important; background: ${l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)"} !important; color: ${p} !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 t=document.createElement("div");t.className="ihooman-widget",t.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">${o}</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">${m.avatarUrl?`<img src="${k(m.avatarUrl)}" alt="Support">`:r}</div>\n <div class="ihooman-header-info">\n <div class="ihooman-header-title">${k(m.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">${c}</button>\n <button class="ihooman-header-btn" data-action="refresh" title="New conversation">${p}</button>\n <button class="ihooman-header-btn" data-action="minimize" title="Minimize">${s}</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 ${m.enableFileUpload?`<button class="ihooman-input-btn attach" title="Attach file">${a}</button><input type="file" class="ihooman-file-input">`:""}\n <textarea class="ihooman-input" placeholder="${k(m.placeholder||"Type a message...")}" rows="1" aria-label="Message input"></textarea>\n <button class="ihooman-input-btn send" title="Send message" disabled>${i}</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, ${m.gradientFrom}, ${m.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;">${p} New Chat</button>\n </div>\n <div class="ihooman-history-list"></div>\n </div>\n \n ${m.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(t),f={widget:t,toggle:t.querySelector(".ihooman-toggle"),badge:t.querySelector(".ihooman-badge"),window:t.querySelector(".ihooman-window"),chatView:t.querySelector(".ihooman-chat-view"),ticketView:t.querySelector(".ihooman-ticket-view"),historyView:t.querySelector(".ihooman-history-view"),historyList:t.querySelector(".ihooman-history-list"),historyNewBtn:t.querySelector(".ihooman-history-new"),messages:t.querySelector(".ihooman-messages"),presetQuestions:t.querySelector(".ihooman-preset-questions"),input:t.querySelector(".ihooman-input"),sendBtn:t.querySelector(".ihooman-input-btn.send"),attachBtn:t.querySelector(".ihooman-input-btn.attach"),fileInput:t.querySelector(".ihooman-file-input"),statusDot:t.querySelector(".ihooman-status-dot"),statusText:t.querySelector(".ihooman-status-text"),statusBar:t.querySelector(".ihooman-status-bar"),ticketName:t.querySelector("#ihooman-ticket-name"),ticketEmail:t.querySelector("#ihooman-ticket-email"),ticketIssue:t.querySelector("#ihooman-ticket-issue"),ticketSubmitBtn:t.querySelector("#ihooman-ticket-submit"),ticketBackBtn:t.querySelector("#ihooman-ticket-back")},function(){if(!f.toggle||!f.sendBtn||!f.input)return;f.toggle.addEventListener("click",G),f.sendBtn.addEventListener("click",j),f.input.addEventListener("input",()=>{f.sendBtn&&(f.sendBtn.disabled=!f.input?.value.trim()),f.input&&(f.input.style.height="auto",f.input.style.height=Math.min(f.input.scrollHeight,100)+"px")}),f.input.addEventListener("keydown",e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),f.sendBtn?.disabled||j())}),f.attachBtn&&f.fileInput&&(f.attachBtn.addEventListener("click",()=>f.fileInput?.click()),f.fileInput.addEventListener("change",H));f.widget?.querySelector('[data-action="refresh"]')?.addEventListener("click",K),f.widget?.querySelector('[data-action="minimize"]')?.addEventListener("click",J),f.widget?.querySelector('[data-action="history"]')?.addEventListener("click",B),f.ticketSubmitBtn&&f.ticketSubmitBtn.addEventListener("click",E);f.ticketBackBtn&&f.ticketBackBtn.addEventListener("click",()=>C("chat"));f.historyNewBtn&&f.historyNewBtn.addEventListener("click",()=>{K(),C("chat")})}()}function I(e,t="bot",o={}){const n={id:V("msg_"),content:e,sender:t,timestamp:new Date,metadata:o};if(h.messages.push(n),!f.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, ${m.gradientFrom}, ${m.gradientTo}) !important; color: white !important;`}">\n ${d}\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 ${l}\n <span>Create Ticket</span>\n </button>\n </div>\n `}var r,c;if(i.innerHTML=`\n <div class="ihooman-message-content">${c=e,c?k(c).replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/`(.*?)`/g,"<code>$1</code>").replace(/\n/g,"<br>"):""}</div>\n ${s}\n ${m.showTimestamps?`<div class="ihooman-message-time">${r=n.timestamp,new Date(r).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",()=>T("live-agent")),t&&t.addEventListener("click",()=>T("create-ticket"))}const p=f.messages.querySelector(".ihooman-typing");return p&&p.remove(),f.messages.appendChild(i),f.messages.scrollTop=f.messages.scrollHeight,"bot"!==t||h.isOpen||(h.unreadCount++,f.badge&&(f.badge.textContent=String(h.unreadCount)),m.enableSounds&&function(){try{const e=new Audio("data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4Ljc2LjEwMAAAAAAAAAAAAAAA//tQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAAACAAABhgC7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7//////////////////////////////////////////////////////////////////8AAAAATGF2YzU4LjEzAAAAAAAAAAAAAAAAJAAAAAAAAAAAAYYNBrP/AAAAAAAAAAAAAAAAAAAAAP/7UMQAA8AAAaQAAAAgAAA0gAAABExBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tQxBKDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU=");e.volume=.3,e.play().catch(()=>{})}catch{}}()),$("message",n),n}function _(){f.presetQuestions&&0!==Z.length?(f.presetQuestions.innerHTML=Z.map(e=>`\n <button class="ihooman-preset-btn" data-question-id="${k(e.id)}" data-question-text="${k(e.text)}">\n ${e.icon?`<span class="icon">${k(e.icon)}</span>`:""}\n <span>${k(e.text)}</span>\n </button>\n `).join(""),f.presetQuestions.querySelectorAll(".ihooman-preset-btn").forEach(e=>{e.addEventListener("click",()=>{const t=e.dataset.questionText;t&&function(e){F(),I(e,"user"),U(),N(e)}(t)})})):f.presetQuestions&&(f.presetQuestions.innerHTML="")}function T(e){document.querySelectorAll(".ihooman-escalation-btn").forEach(e=>e.disabled=!0),"live-agent"===e?async function(){if(!h.sessionId)return void I("Please send a message first to start a conversation.","bot",{is_system_message:!0});const e=f.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(`${m.serverUrl}/api/widget/live-agent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({widget_id:m.widgetId,session_id:h.sessionId,visitor_id:h.visitorId})}),t=await e.json();g=!0,t.position_in_queue&&t.position_in_queue>1?L("waiting",`⏳ Waiting for agent (Position: #${t.position_in_queue})`):L("waiting","⏳ Connecting to live support..."),q()}catch(e){console.error("Error requesting live agent:",e),I("❌ 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&&(C("ticket"),setTimeout(()=>f.ticketName?.focus(),100))}function C(e){u=e,f.chatView&&f.chatView.classList.toggle("hidden","chat"!==e),f.ticketView&&f.ticketView.classList.toggle("show","ticket"===e),f.historyView&&f.historyView.classList.toggle("show","history"===e),"history"===e&&async function(){if(!f.historyList||!h.visitorId)return;f.historyList.innerHTML='<div class="ihooman-history-empty">Loading...</div>';try{const e=await fetch(`${m.serverUrl}/api/widget/conversations?widget_id=${m.widgetId}&visitor_id=${h.visitorId}&limit=20`);if(!e.ok)throw new Error("Failed to load history");const t=await e.json();if(!t.length)return void(f.historyList.innerHTML='<div class="ihooman-history-empty">No conversations yet</div>');f.historyList.innerHTML=t.map(e=>`\n <div class="ihooman-history-item ${e.session_id===h.sessionId?"active":""}" data-session-id="${e.session_id}">\n <div class="ihooman-history-preview">${k(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(""),f.historyList.querySelectorAll(".ihooman-history-item").forEach(e=>{e.addEventListener("click",()=>{const t=e.dataset.sessionId;t&&async function(e){h.sessionId=e,m.persistSession&&A("session_id",e);f.messages&&(f.messages.innerHTML="");g=!1,M(),L("hidden"),v=!0,x&&(x.close(),x=null);P(),C("chat"),await async function(e){try{const t=await fetch(`${m.serverUrl}/api/widget/transcript/${e}?widget_id=${m.widgetId}`);if(!t.ok)throw new Error("Failed to load messages");const o=await t.json();f.messages&&(f.messages.innerHTML=""),o.messages&&o.messages.length>0?o.messages.forEach(e=>{const t="user"===e.sender_type?"user":"bot";I(e.content,t,e.extra_data||{})}):m.welcomeMessage&&I(m.welcomeMessage,"bot"),"pending"===o.status?(g=!0,q(),L("waiting","⏳ Waiting for agent...")):"closed"===o.status&&L("hidden")}catch(e){console.error("Error loading conversation messages:",e),m.welcomeMessage&&I(m.welcomeMessage,"bot")}}(e)}(t)})})}catch(e){console.error("Error loading conversation history:",e),f.historyList.innerHTML='<div class="ihooman-history-empty">Failed to load history</div>'}}()}function B(){C("history"===u?"chat":"history")}function L(e,t){f.statusBar&&("hidden"!==e?(f.statusBar.classList.add("show"),f.statusBar.classList.remove("waiting","connected"),f.statusBar.classList.add(e),t&&(f.statusBar.textContent=t)):f.statusBar.classList.remove("show"))}async function E(){const e=f.ticketName?.value.trim(),t=f.ticketEmail?.value.trim(),o=f.ticketIssue?.value.trim();if(e&&t){f.ticketSubmitBtn&&(f.ticketSubmitBtn.disabled=!0,f.ticketSubmitBtn.textContent="Submitting...");try{const n=await fetch(`${m.serverUrl}/api/widget/submit-ticket`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({widget_id:m.widgetId,session_id:h.sessionId,user_name:e,user_email:t,issue:o||"No description provided"})}),i=await n.json();f.ticketName&&(f.ticketName.value=""),f.ticketEmail&&(f.ticketEmail.value=""),f.ticketIssue&&(f.ticketIssue.value=""),C("chat");I(`✅ 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),I("❌ Error submitting ticket. Please try again.","bot",{is_system_message:!0})}f.ticketSubmitBtn&&(f.ticketSubmitBtn.disabled=!1,f.ticketSubmitBtn.textContent="Submit Ticket")}else alert("Please fill in your name and email")}let z=null;function q(){z||(z=setInterval(async()=>{if(h.sessionId&&g)try{try{const e=await fetch(`${m.serverUrl}/api/widget/escalation-status/${h.sessionId}?widget_id=${m.widgetId}`);if(e.ok){const t=await e.json();t.escalated&&("in_progress"===t.ticket_status?L("connected","🟢 Connected to live agent"):"open"===t.ticket_status?t.position_in_queue&&t.position_in_queue>1?L("waiting",`⏳ Waiting for agent (Position: #${t.position_in_queue})`):L("waiting","⏳ Waiting for agent..."):"closed"!==t.ticket_status&&"resolved"!==t.ticket_status||(g=!1,M(),L("hidden"),I("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 M()},3e3))}function M(){z&&(clearInterval(z),z=null)}function U(){if(!m.showTypingIndicator||!f.messages)return;if(f.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>',f.messages.appendChild(e),f.messages.scrollTop=f.messages.scrollHeight}function O(){const e=f.messages?.querySelector(".ihooman-typing");e&&e.remove()}function j(){const e=f.input?.value.trim();e&&(F(),f.input&&(f.input.value="",f.input.style.height="auto"),f.sendBtn&&(f.sendBtn.disabled=!0),I(e,"user"),U(),N(e))}function F(){f.presetQuestions&&f.presetQuestions.classList.add("hidden")}async function N(e){if(x&&x.readyState===WebSocket.OPEN)x.send(JSON.stringify({type:"message",content:e}));else try{const t=await fetch(`${m.serverUrl}/api/v1/public/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e,session_id:h.sessionId,visitor_id:h.visitorId,widget_id:m.widgetId})}),o=await t.json();O(),o.session_id&&(h.sessionId=o.session_id,m.persistSession&&A("session_id",h.sessionId)),o.response&&I(o.response,"bot",{sources:o.sources,confidence:o.confidence})}catch(e){O(),I("Sorry, something went wrong. Please try again.","bot"),$("error",e)}}function H(e){const t=e.target,o=t.files?.[0];if(!o)return;I(`📎 Uploading: ${o.name}...`,"user"),U();const n=new FormData;n.append("file",o),n.append("session_id",h.sessionId||""),n.append("visitor_id",h.visitorId||""),n.append("widget_id",m.widgetId),fetch(`${m.serverUrl}/api/upload`,{method:"POST",body:n}).then(e=>e.json()).then(e=>{O(),e.message&&I(e.message,"bot")}).catch(()=>{O(),I("Failed to upload file.","bot")}),t.value=""}function P(e){if(!m.serverUrl&&!e)return;let t;if(m.widgetId){const e=m.serverUrl?.replace(/^http/,"ws"),o=new URLSearchParams({widget_id:m.widgetId});h.visitorId&&o.append("visitor_id",h.visitorId),h.sessionId&&o.append("session_id",h.sessionId),t=`${e}/public/ws?${o.toString()}`}else t=e||m.serverUrl?.replace(/^http/,"ws")+"/ws";try{D(),x=new WebSocket(t),x.onopen=()=>{h.isConnected=!0,w=0,Y(!0),$("connected"),D(),W=setInterval(()=>{if(x&&x.readyState===WebSocket.OPEN)try{x.send(JSON.stringify({type:"ping"}))}catch(e){console.warn("Failed to send heartbeat ping:",e)}},25e3)},x.onclose=t=>{if(h.isConnected=!1,Y(!1),D(),$("disconnected"),console.log(`WebSocket closed: code=${t.code}, reason=${t.reason||"none"}, wasClean=${t.wasClean}`),v)v=!1;else if(h.isOpen)if(w<5){w++;const t=Math.min(1e3*Math.pow(2,w),3e4);console.log(`WebSocket reconnecting in ${t}ms (attempt ${w}/5)`),setTimeout(()=>P(e),t)}else console.warn("WebSocket reconnection failed, falling back to polling"),Q()},x.onerror=e=>{console.error("WebSocket error:",e)},x.onmessage=e=>{try{const t=JSON.parse(e.data);if("connected"===t.type)t.session_id&&(h.sessionId=t.session_id,m.persistSession&&A("session_id",h.sessionId)),t.visitor_id&&(h.visitorId=t.visitor_id,m.persistSession&&A("visitor_id",h.visitorId)),t.welcome_message&&0===h.messages.length&&I(t.welcome_message,"bot");else if("message"===t.type){O();const e="user"===t.sender?"user":"bot";I(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?U():O():"pong"===t.type||"error"===t.type&&(console.error("WebSocket server error:",t.message),$("error",{message:t.message}))}catch{}}}catch{console.warn("WebSocket not supported, using polling"),Q()}}let W=null;function D(){W&&(clearInterval(W),W=null)}function Q(){y||(y=setInterval(async()=>{if(h.sessionId)try{const e=await fetch(`${m.serverUrl}/api/messages?session_id=${h.sessionId}&since=${Date.now()-5e3}&widget_id=${m.widgetId}`),t=await e.json();t.messages&&t.messages.forEach(e=>{h.messages.find(t=>t.id===e.id)||I(e.content,e.sender_type,e.metadata)})}catch{}},5e3))}function Y(e){f.statusDot&&f.statusDot.classList.toggle("offline",!e),f.statusText&&(f.statusText.textContent=e?"Online":"Offline")}function R(){h.isOpen||(h.isOpen=!0,h.unreadCount=0,f.badge&&(f.badge.textContent=""),f.toggle&&f.toggle.classList.add("open"),f.window&&f.window.classList.add("open"),setTimeout(()=>f.input?.focus(),300),$("open"))}function J(){h.isOpen&&(h.isOpen=!1,f.toggle&&f.toggle.classList.remove("open"),f.window&&f.window.classList.remove("open"),$("close"))}function G(){h.isOpen?J():R()}function K(){h.sessionId=null,h.visitorId=null,h.messages=[],g=!1,A("session_id",null),h.visitorId=V("v_"),A("visitor_id",h.visitorId),f.messages&&(f.messages.innerHTML=""),L("hidden"),M(),w=0,x&&(v=!0,x.close(),x=null),P(),m.welcomeMessage&&I(m.welcomeMessage,"bot"),$("newConversation")}let Z=[];async function X(e){if(!e.widgetId)return console.error("IhoomanChat: widgetId is required"),null;m={...t,...e},h.visitorId=A("visitor_id")||V("v_"),A("visitor_id",h.visitorId),m.persistSession&&(h.sessionId=A("session_id"));const o=m.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."}}}(m.widgetId,o);let i;var a;return n.success&&n.config?(a=n.config,m.title=a.title||m.title,m.subtitle=a.subtitle||m.subtitle,m.welcomeMessage=a.welcomeMessage||m.welcomeMessage,m.placeholder=a.placeholder||m.placeholder,m.position=a.position||m.position,a.theme&&(m.primaryColor=a.theme.primaryColor||m.primaryColor,m.gradientFrom=a.theme.gradientFrom||m.gradientFrom,m.gradientTo=a.theme.gradientTo||m.gradientTo,m.fontFamily=a.theme.fontFamily||m.fontFamily,a.theme.borderRadius&&(m.borderRadius=parseInt(a.theme.borderRadius,10)||m.borderRadius)),a.behavior&&(m.startOpen=a.behavior.startOpen??m.startOpen,m.showTypingIndicator=a.behavior.showTypingIndicator??m.showTypingIndicator,m.showTimestamps=a.behavior.showTimestamps??m.showTimestamps,m.enableSounds=a.behavior.enableSounds??m.enableSounds,m.enableFileUpload=a.behavior.enableFileUpload??m.enableFileUpload,m.persistSession=a.behavior.persistSession??m.persistSession),a.branding&&(m.avatarUrl=a.branding.avatarUrl||m.avatarUrl,m.poweredBy=a.branding.poweredBy??m.poweredBy),a.presetQuestions&&Array.isArray(a.presetQuestions)&&(Z=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.")),S(),_(),h.messages.forEach(e=>I(e.content,e.sender,e.metadata)),0===h.messages.length&&m.welcomeMessage&&I(m.welcomeMessage,"bot"),P(i),m.startOpen&&setTimeout(R,500),$("ready"),ee}const ee={init:X,open:R,close:J,toggle:G,destroy:function(){D(),M(),v=!0,x&&(x.close(),x=null),y&&(clearInterval(y),y=null),f.widget&&f.widget.remove();const e=document.getElementById("ihooman-widget-styles");e&&e.remove(),h={isOpen:!1,isConnected:!1,messages:[],sessionId:null,visitorId:null,unreadCount:0},f={},w=0,v=!1},sendMessage:function(e){e.trim()&&(f.input&&(f.input.value=e),j())},setUser:function(e){e.name&&A("user_name",e.name),e.email&&A("user_email",e.email),e.metadata&&A("user_metadata",e.metadata)},clearHistory:function(){K()},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{...h}},version:"2.0.0"},te=ee;!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",()=>X(o)):X(o)}}(),"undefined"!=typeof window&&(window.IhoomanChat=te),e.IhoomanChat=te,e.createWidgetInstance=function(){return{...ee}},e.default=te,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).IhoomanChat={})}(this,function(e){"use strict";const t={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},o='<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>',i='<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>',a='<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>',s='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"></line></svg>',r='<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>',d='<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>',l='<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>',c='<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>',p='<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 m={widgetId:"",...t},h={isOpen:!1,isConnected:!1,messages:[],sessionId:null,visitorId:null,unreadCount:0},g="chat",u=!1,f={};const b={};let x=null,y=null,w=0;let v=!1;function V(e=""){return e+Math.random().toString(36).slice(2,14)+Date.now().toString(36)}function k(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}function A(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 $(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=m[o];if("function"==typeof n)try{n(t)}catch(e){console.error(`Error in ${o} callback:`,e)}}function S(){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}=m,l="dark"===m.theme,c=l?"#1a1a2e":"#ffffff",p=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",f=`linear-gradient(135deg, ${t}, ${o})`,b=l?"#252542":"#f1f5f9",x=m.position?.includes("right")??!0,y=m.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: ${p}; -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; 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}, ${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: ${f}; color: white; border-bottom-right-radius: 4px; }\n .ihooman-message.bot .ihooman-message-content { background: ${b}; color: ${p}; 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: ${b}; 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: ${p}; 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: ${p}; }\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: ${p} !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: ${p}; 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: ${p}; 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: ${p}; 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: ${p}; 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: ${p} !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 t=document.createElement("div");t.className="ihooman-widget",t.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">${o}</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">${m.avatarUrl?`<img src="${k(m.avatarUrl)}" alt="Support">`:r}</div>\n <div class="ihooman-header-info">\n <div class="ihooman-header-title">${k(m.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">${c}</button>\n <button class="ihooman-header-btn" data-action="refresh" title="New conversation">${p}</button>\n <button class="ihooman-header-btn" data-action="minimize" title="Minimize">${s}</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 ${m.enableFileUpload?`<button class="ihooman-input-btn attach" title="Attach file">${a}</button><input type="file" class="ihooman-file-input">`:""}\n <textarea class="ihooman-input" placeholder="${k(m.placeholder||"Type a message...")}" rows="1" aria-label="Message input"></textarea>\n <button class="ihooman-input-btn send" title="Send message" disabled>${i}</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, ${m.gradientFrom}, ${m.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;">${p} New Chat</button>\n </div>\n <div class="ihooman-history-list"></div>\n </div>\n \n ${m.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(t),f={widget:t,toggle:t.querySelector(".ihooman-toggle"),badge:t.querySelector(".ihooman-badge"),window:t.querySelector(".ihooman-window"),chatView:t.querySelector(".ihooman-chat-view"),ticketView:t.querySelector(".ihooman-ticket-view"),historyView:t.querySelector(".ihooman-history-view"),historyList:t.querySelector(".ihooman-history-list"),historyNewBtn:t.querySelector(".ihooman-history-new"),messages:t.querySelector(".ihooman-messages"),presetQuestions:t.querySelector(".ihooman-preset-questions"),input:t.querySelector(".ihooman-input"),sendBtn:t.querySelector(".ihooman-input-btn.send"),attachBtn:t.querySelector(".ihooman-input-btn.attach"),fileInput:t.querySelector(".ihooman-file-input"),statusDot:t.querySelector(".ihooman-status-dot"),statusText:t.querySelector(".ihooman-status-text"),statusBar:t.querySelector(".ihooman-status-bar"),ticketName:t.querySelector("#ihooman-ticket-name"),ticketEmail:t.querySelector("#ihooman-ticket-email"),ticketIssue:t.querySelector("#ihooman-ticket-issue"),ticketSubmitBtn:t.querySelector("#ihooman-ticket-submit"),ticketBackBtn:t.querySelector("#ihooman-ticket-back")},function(){if(!f.toggle||!f.sendBtn||!f.input)return;f.toggle.addEventListener("click",G),f.sendBtn.addEventListener("click",j),f.input.addEventListener("input",()=>{f.sendBtn&&(f.sendBtn.disabled=!f.input?.value.trim()),f.input&&(f.input.style.height="auto",f.input.style.height=Math.min(f.input.scrollHeight,100)+"px")}),f.input.addEventListener("keydown",e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),f.sendBtn?.disabled||j())}),f.attachBtn&&f.fileInput&&(f.attachBtn.addEventListener("click",()=>f.fileInput?.click()),f.fileInput.addEventListener("change",H));f.widget?.querySelector('[data-action="refresh"]')?.addEventListener("click",K),f.widget?.querySelector('[data-action="minimize"]')?.addEventListener("click",J),f.widget?.querySelector('[data-action="history"]')?.addEventListener("click",B),f.ticketSubmitBtn&&f.ticketSubmitBtn.addEventListener("click",E);f.ticketBackBtn&&f.ticketBackBtn.addEventListener("click",()=>C("chat"));f.historyNewBtn&&f.historyNewBtn.addEventListener("click",()=>{K(),C("chat")})}()}function I(e,t="bot",o={}){const n={id:V("msg_"),content:e,sender:t,timestamp:new Date,metadata:o};if(h.messages.push(n),!f.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, ${m.gradientFrom}, ${m.gradientTo}) !important; color: white !important;`}">\n ${d}\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 ${l}\n <span>Create Ticket</span>\n </button>\n </div>\n `}var r,c;if(i.innerHTML=`\n <div class="ihooman-message-content">${c=e,c?k(c).replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/`(.*?)`/g,"<code>$1</code>").replace(/\n/g,"<br>"):""}</div>\n ${s}\n ${m.showTimestamps?`<div class="ihooman-message-time">${r=n.timestamp,new Date(r).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",()=>T("live-agent")),t&&t.addEventListener("click",()=>T("create-ticket"))}const p=f.messages.querySelector(".ihooman-typing");return p&&p.remove(),f.messages.appendChild(i),f.messages.scrollTop=f.messages.scrollHeight,"bot"!==t||h.isOpen||(h.unreadCount++,f.badge&&(f.badge.textContent=String(h.unreadCount)),m.enableSounds&&function(){try{const e=new Audio("data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4Ljc2LjEwMAAAAAAAAAAAAAAA//tQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAAACAAABhgC7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7//////////////////////////////////////////////////////////////////8AAAAATGF2YzU4LjEzAAAAAAAAAAAAAAAAJAAAAAAAAAAAAYYNBrP/AAAAAAAAAAAAAAAAAAAAAP/7UMQAA8AAAaQAAAAgAAA0gAAABExBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tQxBKDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU=");e.volume=.3,e.play().catch(()=>{})}catch{}}()),$("message",n),n}function _(){f.presetQuestions&&0!==Z.length?(f.presetQuestions.innerHTML=Z.map(e=>`\n <button class="ihooman-preset-btn" data-question-id="${k(e.id)}" data-question-text="${k(e.text)}">\n ${e.icon?`<span class="icon">${k(e.icon)}</span>`:""}\n <span>${k(e.text)}</span>\n </button>\n `).join(""),f.presetQuestions.querySelectorAll(".ihooman-preset-btn").forEach(e=>{e.addEventListener("click",()=>{const t=e.dataset.questionText;t&&function(e){F(),I(e,"user"),U(),N(e)}(t)})})):f.presetQuestions&&(f.presetQuestions.innerHTML="")}function T(e){document.querySelectorAll(".ihooman-escalation-btn").forEach(e=>e.disabled=!0),"live-agent"===e?async function(){if(!h.sessionId)return void I("Please send a message first to start a conversation.","bot",{is_system_message:!0});const e=f.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(`${m.serverUrl}/api/widget/live-agent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({widget_id:m.widgetId,session_id:h.sessionId,visitor_id:h.visitorId})}),t=await e.json();u=!0,t.position_in_queue&&t.position_in_queue>1?L("waiting",`⏳ Waiting for agent (Position: #${t.position_in_queue})`):L("waiting","⏳ Connecting to live support..."),z()}catch(e){console.error("Error requesting live agent:",e),I("❌ 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&&(C("ticket"),setTimeout(()=>f.ticketName?.focus(),100))}function C(e){g=e,f.chatView&&f.chatView.classList.toggle("hidden","chat"!==e),f.ticketView&&f.ticketView.classList.toggle("show","ticket"===e),f.historyView&&f.historyView.classList.toggle("show","history"===e),"history"===e&&async function(){if(!f.historyList||!h.visitorId)return;f.historyList.innerHTML='<div class="ihooman-history-empty">Loading...</div>';try{const e=await fetch(`${m.serverUrl}/api/widget/conversations?widget_id=${m.widgetId}&visitor_id=${h.visitorId}&limit=20`);if(!e.ok)throw new Error("Failed to load history");const t=await e.json();if(!t.length)return void(f.historyList.innerHTML='<div class="ihooman-history-empty">No conversations yet</div>');f.historyList.innerHTML=t.map(e=>`\n <div class="ihooman-history-item ${e.session_id===h.sessionId?"active":""}" data-session-id="${e.session_id}">\n <div class="ihooman-history-preview">${k(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(""),f.historyList.querySelectorAll(".ihooman-history-item").forEach(e=>{e.addEventListener("click",()=>{const t=e.dataset.sessionId;t&&async function(e){h.sessionId=e,m.persistSession&&A("session_id",e);f.messages&&(f.messages.innerHTML="");u=!1,M(),L("hidden"),v=!0,x&&(x.close(),x=null);P(),C("chat"),await async function(e){try{const t=await fetch(`${m.serverUrl}/api/widget/transcript/${e}?widget_id=${m.widgetId}`);if(!t.ok)throw new Error("Failed to load messages");const o=await t.json();f.messages&&(f.messages.innerHTML=""),o.messages&&o.messages.length>0?o.messages.forEach(e=>{const t="user"===e.sender_type?"user":"bot";I(e.content,t,e.extra_data||{})}):m.welcomeMessage&&I(m.welcomeMessage,"bot"),"pending"===o.status?(u=!0,z(),L("waiting","⏳ Waiting for agent...")):"closed"===o.status&&L("hidden")}catch(e){console.error("Error loading conversation messages:",e),m.welcomeMessage&&I(m.welcomeMessage,"bot")}}(e)}(t)})})}catch(e){console.error("Error loading conversation history:",e),f.historyList.innerHTML='<div class="ihooman-history-empty">Failed to load history</div>'}}()}function B(){C("history"===g?"chat":"history")}function L(e,t){f.statusBar&&("hidden"!==e?(f.statusBar.classList.add("show"),f.statusBar.classList.remove("waiting","connected"),f.statusBar.classList.add(e),t&&(f.statusBar.textContent=t)):f.statusBar.classList.remove("show"))}async function E(){const e=f.ticketName?.value.trim(),t=f.ticketEmail?.value.trim(),o=f.ticketIssue?.value.trim();if(e&&t){f.ticketSubmitBtn&&(f.ticketSubmitBtn.disabled=!0,f.ticketSubmitBtn.textContent="Submitting...");try{const n=await fetch(`${m.serverUrl}/api/widget/submit-ticket`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({widget_id:m.widgetId,session_id:h.sessionId,user_name:e,user_email:t,issue:o||"No description provided"})}),i=await n.json();f.ticketName&&(f.ticketName.value=""),f.ticketEmail&&(f.ticketEmail.value=""),f.ticketIssue&&(f.ticketIssue.value=""),C("chat");I(`✅ 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),I("❌ Error submitting ticket. Please try again.","bot",{is_system_message:!0})}f.ticketSubmitBtn&&(f.ticketSubmitBtn.disabled=!1,f.ticketSubmitBtn.textContent="Submit Ticket")}else alert("Please fill in your name and email")}let q=null;function z(){q||(q=setInterval(async()=>{if(h.sessionId&&u)try{try{const e=await fetch(`${m.serverUrl}/api/widget/escalation-status/${h.sessionId}?widget_id=${m.widgetId}`);if(e.ok){const t=await e.json();t.escalated&&("in_progress"===t.ticket_status?L("connected","🟢 Connected to live agent"):"open"===t.ticket_status?t.position_in_queue&&t.position_in_queue>1?L("waiting",`⏳ Waiting for agent (Position: #${t.position_in_queue})`):L("waiting","⏳ Waiting for agent..."):"closed"!==t.ticket_status&&"resolved"!==t.ticket_status||(u=!1,M(),L("hidden"),I("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 M()},3e3))}function M(){q&&(clearInterval(q),q=null)}function U(){if(!m.showTypingIndicator||!f.messages)return;if(f.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>',f.messages.appendChild(e),f.messages.scrollTop=f.messages.scrollHeight}function O(){const e=f.messages?.querySelector(".ihooman-typing");e&&e.remove()}function j(){const e=f.input?.value.trim();e&&(F(),f.input&&(f.input.value="",f.input.style.height="auto"),f.sendBtn&&(f.sendBtn.disabled=!0),I(e,"user"),U(),N(e))}function F(){f.presetQuestions&&f.presetQuestions.classList.add("hidden")}async function N(e){if(x&&x.readyState===WebSocket.OPEN)x.send(JSON.stringify({type:"message",content:e}));else try{const t=await fetch(`${m.serverUrl}/api/v1/public/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e,session_id:h.sessionId,visitor_id:h.visitorId,widget_id:m.widgetId})}),o=await t.json();O(),o.session_id&&(h.sessionId=o.session_id,m.persistSession&&A("session_id",h.sessionId)),o.response&&I(o.response,"bot",{sources:o.sources,confidence:o.confidence})}catch(e){O(),I("Sorry, something went wrong. Please try again.","bot"),$("error",e)}}function H(e){const t=e.target,o=t.files?.[0];if(!o)return;I(`📎 Uploading: ${o.name}...`,"user"),U();const n=new FormData;n.append("file",o),n.append("session_id",h.sessionId||""),n.append("visitor_id",h.visitorId||""),n.append("widget_id",m.widgetId),fetch(`${m.serverUrl}/api/upload`,{method:"POST",body:n}).then(e=>e.json()).then(e=>{O(),e.message&&I(e.message,"bot")}).catch(()=>{O(),I("Failed to upload file.","bot")}),t.value=""}function P(e){if(!m.serverUrl&&!e)return;let t;if(m.widgetId){const e=m.serverUrl?.replace(/^http/,"ws"),o=new URLSearchParams({widget_id:m.widgetId});h.visitorId&&o.append("visitor_id",h.visitorId),h.sessionId&&o.append("session_id",h.sessionId),t=`${e}/public/ws?${o.toString()}`}else t=e||m.serverUrl?.replace(/^http/,"ws")+"/ws";try{D(),x=new WebSocket(t),x.onopen=()=>{h.isConnected=!0,w=0,Y(!0),$("connected"),D(),W=setInterval(()=>{if(x&&x.readyState===WebSocket.OPEN)try{x.send(JSON.stringify({type:"ping"}))}catch(e){console.warn("Failed to send heartbeat ping:",e)}},25e3)},x.onclose=t=>{if(h.isConnected=!1,Y(!1),D(),$("disconnected"),console.log(`WebSocket closed: code=${t.code}, reason=${t.reason||"none"}, wasClean=${t.wasClean}`),v)v=!1;else if(h.isOpen)if(w<5){w++;const t=Math.min(1e3*Math.pow(2,w),3e4);console.log(`WebSocket reconnecting in ${t}ms (attempt ${w}/5)`),setTimeout(()=>P(e),t)}else console.warn("WebSocket reconnection failed, falling back to polling"),Q()},x.onerror=e=>{console.error("WebSocket error:",e)},x.onmessage=e=>{try{const t=JSON.parse(e.data);if("connected"===t.type)t.session_id&&(h.sessionId=t.session_id,m.persistSession&&A("session_id",h.sessionId)),t.visitor_id&&(h.visitorId=t.visitor_id,m.persistSession&&A("visitor_id",h.visitorId)),t.welcome_message&&0===h.messages.length&&I(t.welcome_message,"bot");else if("message"===t.type){O();const e="user"===t.sender?"user":"bot";I(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?U():O():"pong"===t.type||"error"===t.type&&(console.error("WebSocket server error:",t.message),$("error",{message:t.message}))}catch{}}}catch{console.warn("WebSocket not supported, using polling"),Q()}}let W=null;function D(){W&&(clearInterval(W),W=null)}function Q(){y||(y=setInterval(async()=>{if(h.sessionId)try{const e=await fetch(`${m.serverUrl}/api/messages?session_id=${h.sessionId}&since=${Date.now()-5e3}&widget_id=${m.widgetId}`),t=await e.json();t.messages&&t.messages.forEach(e=>{h.messages.find(t=>t.id===e.id)||I(e.content,e.sender_type,e.metadata)})}catch{}},5e3))}function Y(e){f.statusDot&&f.statusDot.classList.toggle("offline",!e),f.statusText&&(f.statusText.textContent=e?"Online":"Offline")}function R(){h.isOpen||(h.isOpen=!0,h.unreadCount=0,f.badge&&(f.badge.textContent=""),f.toggle&&f.toggle.classList.add("open"),f.window&&f.window.classList.add("open"),setTimeout(()=>f.input?.focus(),300),$("open"))}function J(){h.isOpen&&(h.isOpen=!1,f.toggle&&f.toggle.classList.remove("open"),f.window&&f.window.classList.remove("open"),$("close"))}function G(){h.isOpen?J():R()}function K(){h.sessionId=null,h.visitorId=null,h.messages=[],u=!1,A("session_id",null),h.visitorId=V("v_"),A("visitor_id",h.visitorId),f.messages&&(f.messages.innerHTML=""),L("hidden"),M(),w=0,x&&(v=!0,x.close(),x=null),P(),m.welcomeMessage&&I(m.welcomeMessage,"bot"),$("newConversation")}let Z=[];async function X(e){if(!e.widgetId)return console.error("IhoomanChat: widgetId is required"),null;m={...t,...e},h.visitorId=A("visitor_id")||V("v_"),A("visitor_id",h.visitorId),m.persistSession&&(h.sessionId=A("session_id"));const o=m.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."}}}(m.widgetId,o);let i;var a;return n.success&&n.config?(a=n.config,m.title=a.title||m.title,m.subtitle=a.subtitle||m.subtitle,m.welcomeMessage=a.welcomeMessage||m.welcomeMessage,m.placeholder=a.placeholder||m.placeholder,m.position=a.position||m.position,a.theme&&(m.primaryColor=a.theme.primaryColor||m.primaryColor,m.gradientFrom=a.theme.gradientFrom||m.gradientFrom,m.gradientTo=a.theme.gradientTo||m.gradientTo,m.fontFamily=a.theme.fontFamily||m.fontFamily,a.theme.borderRadius&&(m.borderRadius=parseInt(a.theme.borderRadius,10)||m.borderRadius)),a.behavior&&(m.startOpen=a.behavior.startOpen??m.startOpen,m.showTypingIndicator=a.behavior.showTypingIndicator??m.showTypingIndicator,m.showTimestamps=a.behavior.showTimestamps??m.showTimestamps,m.enableSounds=a.behavior.enableSounds??m.enableSounds,m.enableFileUpload=a.behavior.enableFileUpload??m.enableFileUpload,m.persistSession=a.behavior.persistSession??m.persistSession),a.branding&&(m.avatarUrl=a.branding.avatarUrl||m.avatarUrl,m.poweredBy=a.branding.poweredBy??m.poweredBy),a.presetQuestions&&Array.isArray(a.presetQuestions)&&(Z=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.")),S(),_(),h.messages.forEach(e=>I(e.content,e.sender,e.metadata)),0===h.messages.length&&m.welcomeMessage&&I(m.welcomeMessage,"bot"),P(i),m.startOpen&&setTimeout(R,500),$("ready"),ee}const ee={init:X,open:R,close:J,toggle:G,destroy:function(){D(),M(),v=!0,x&&(x.close(),x=null),y&&(clearInterval(y),y=null),f.widget&&f.widget.remove();const e=document.getElementById("ihooman-widget-styles");e&&e.remove(),h={isOpen:!1,isConnected:!1,messages:[],sessionId:null,visitorId:null,unreadCount:0},f={},w=0,v=!1},sendMessage:function(e){e.trim()&&(f.input&&(f.input.value=e),j())},setUser:function(e){e.name&&A("user_name",e.name),e.email&&A("user_email",e.email),e.metadata&&A("user_metadata",e.metadata)},clearHistory:function(){K()},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{...h}},version:"2.0.0"},te=ee;!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",()=>X(o)):X(o)}}(),"undefined"!=typeof window&&(window.IhoomanChat=te),e.IhoomanChat=te,e.createWidgetInstance=function(){return{...ee}},e.default=te,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
2
2
|
//# sourceMappingURL=index.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.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","script","currentScript","scripts","getElementsByTagName","i","src","getAttribute","autoConfig"],"mappings":"kPA2BA,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,EACbC,SAAU,GACVC,UAAW,KACXC,UAAW,KACXC,YAAa,GAOXC,EAA0B,OAC1BC,GAAkB,EA+BlBC,EAA2B,CAAA,EAC/B,MAAMC,EAAkD,CAAA,EAKxD,IAAIC,EAAuB,KACvBC,EAAsD,KACtDC,EAAoB,EAExB,IAAIC,GAAwB,EAU5B,SAASC,EAAWC,EAAS,IAC3B,OAAOA,EAASC,KAAKC,SAASC,SAAS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AIF,EAAQ3I,OAAQ6I,IAClC,GAAIF,EAAQE,GAAGC,KAAOH,EAAQE,GAAGC,IAAI5N,SAAS,WAAY,CACxDuN,EAASE,EAAQE,GACjB,KACF,CAEJ,CAEA,IAAKJ,EAAQ,OAEb,MAAM3R,EAAW2R,EAAOM,aAAa,kBACrC,GAAIjS,EAAU,CACZ,MAAMkS,EAA2D,CAAElS,YAG7D1B,EAAYqT,EAAOM,aAAa,mBAClC3T,IAAW4T,EAAW5T,UAAYA,GAEtC,MAAMC,EAAQoT,EAAOM,aAAa,cACpB,UAAV1T,GAA+B,SAAVA,IAAkB2T,EAAW3T,MAAQA,GAE9D,MAAMC,EAAWmT,EAAOM,aAAa,iBACjCzT,IAAU0T,EAAW1T,SAAWA,GAGlB,SADAmT,EAAOM,aAAa,qBACZC,EAAW9S,WAAY,GAGrB,YAAxBuC,SAAS4L,WACX5L,SAASuE,iBAAiB,mBAAoB,IAAM+J,EAAKiC,IAEzDjC,EAAKiC,EAET,CACD,CAzCD,GA4CsB,oBAAXnN,SACRA,OAA8C2M,YAAcA,uDAxD7D,MAAO,IAAKb,GACd"}
|
|
1
|
+
{"version":3,"file":"index.umd.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","script","currentScript","scripts","getElementsByTagName","i","src","getAttribute","autoConfig"],"mappings":"kPA2BA,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,EACbC,SAAU,GACVC,UAAW,KACXC,UAAW,KACXC,YAAa,GAOXC,EAA0B,OAC1BC,GAAkB,EA+BlBC,EAA2B,CAAA,EAC/B,MAAMC,EAAkD,CAAA,EAKxD,IAAIC,EAAuB,KACvBC,EAAsD,KACtDC,EAAoB,EAExB,IAAIC,GAAwB,EAU5B,SAASC,EAAWC,EAAS,IAC3B,OAAOA,EAASC,KAAKC,SAASC,SAAS,IAAIC,MAAM,EAAG,IAAMC,KAAKC,MAAMH,SAAS,GAChF,CAYA,SAASI,EAAWC,GAClB,MAAMC,EAAMC,SAASC,cAAc,OAEnC,OADAF,EAAIG,YAAcJ,EACXC,EAAII,SACb,CAiBA,SAASC,EAAWC,EAAaC,GAC/B,MAAMC,EA5Je,gBA4JYF,EACjC,IACE,QAAcG,IAAVF,EAAqB,CACvB,MAAMG,EAAOC,aAAaC,QAAQJ,GAClC,OAAOE,EAAOG,KAAKC,MAAMJ,GAAQ,IACnC,C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,MAAMC,EAAQoT,EAAOM,aAAa,cACpB,UAAV1T,GAA+B,SAAVA,IAAkB2T,EAAW3T,MAAQA,GAE9D,MAAMC,EAAWmT,EAAOM,aAAa,iBACjCzT,IAAU0T,EAAW1T,SAAWA,GAGlB,SADAmT,EAAOM,aAAa,qBACZC,EAAW9S,WAAY,GAGrB,YAAxBuC,SAAS4L,WACX5L,SAASuE,iBAAiB,mBAAoB,IAAM+J,EAAKiC,IAEzDjC,EAAKiC,EAET,CACD,CAzCD,GA4CsB,oBAAXnN,SACRA,OAA8C2M,YAAcA,uDAxD7D,MAAO,IAAKb,GACd"}
|
package/package.json
CHANGED
package/src/widget.ts
CHANGED
|
@@ -275,9 +275,9 @@ function generateStyles(): string {
|
|
|
275
275
|
.ihooman-toggle.open .ihooman-pulse { display: none; }
|
|
276
276
|
.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; }
|
|
277
277
|
.ihooman-badge:empty { display: none; }
|
|
278
|
-
.ihooman-window { position: fixed; ${positionRight ? 'right: 20px' : 'left: 20px'}; ${positionBottom ? 'bottom: 90px' : 'top: 90px'}; width: ${width}px; height: ${height}px;
|
|
278
|
+
.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; }
|
|
279
279
|
.ihooman-window.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
|
|
280
|
-
.ihooman-container { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; border-radius: ${borderRadius}px; overflow: hidden; }
|
|
280
|
+
.ihooman-container { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; border-radius: ${borderRadius}px; overflow: hidden; flex-shrink: 0; }
|
|
281
281
|
.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); }
|
|
282
282
|
.ihooman-container > * { position: relative; z-index: 1; }
|
|
283
283
|
.ihooman-header { padding: 16px 20px; background: linear-gradient(135deg, ${gradientFrom}, ${gradientTo}); color: white; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
|
|
@@ -374,7 +374,7 @@ function generateStyles(): string {
|
|
|
374
374
|
.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; }
|
|
375
375
|
.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; }
|
|
376
376
|
.ihooman-widget .ihooman-preset-btn .icon { font-size: 12px !important; flex-shrink: 0 !important; }
|
|
377
|
-
@media (max-width: 480px) { .ihooman-window { width: calc(100vw - 20px); height: calc(100vh - 100px); left: 10px; right: 10px; bottom: 80px;
|
|
377
|
+
@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; } }
|
|
378
378
|
`;
|
|
379
379
|
}
|
|
380
380
|
|