@ihoomanai/chat-widget 3.0.3 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !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="https://api.ihooman.ai",o={serverUrl:t,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,presetQuestions:[],proactiveMessages:[],surveyConfig:null,locale:"en",allowLocalhost:!0},n={chat:'<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>',close:'<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>',send:'<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>',attach:'<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>',minimize:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"></line></svg>',bot:'<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>',agent:'<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>',ticket:'<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></svg>',history:'<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>',plus:'<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>',star:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"></path></svg>',starEmpty:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"></path></svg>',thumbUp:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"></path></svg>',thumbDown:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17"></path></svg>'};let i={widgetId:"",...o},a={isOpen:!1,isConnected:!1,messages:[],pendingMessages:[],sessionId:null,visitorId:null,unreadCount:0,view:"chat",connectionStatus:"disconnected",typingIndicator:!1,soundMuted:!1,escalationStatus:null,userInfo:null},s="chat",r=!1,c=[],l={},d=null,p=[],u={};const h={};let m=null,g=null,f=0;let b=!1,y=null,v=null;function x(e=""){return e+Math.random().toString(36).slice(2,14)+Date.now().toString(36)}function w(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}function k(e,t){const o="ihooman_chat_"+e;try{if(void 0===t){const e=localStorage.getItem(o);return e?JSON.parse(e):null}return null===t?(localStorage.removeItem(o),null):(localStorage.setItem(o,JSON.stringify(t)),t)}catch{return null}}function V(e,t){(h[e]||[]).forEach(o=>{try{o(t)}catch(t){console.error(`Error in ${e} handler:`,t)}});const o=`on${e.charAt(0).toUpperCase()}${e.slice(1)}`,n=i[o];if("function"==typeof n)try{n(t)}catch(e){console.error(`Error in ${o}:`,e)}}function $(){const e=window.scrollY||document.documentElement.scrollTop,t=document.documentElement.scrollHeight-window.innerHeight;return t>0?Math.round(e/t*100):0}function A(e){try{return new RegExp(e.replace(/\*/g,".*")).test(window.location.href)}catch{return window.location.href.includes(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:a,zIndex:s,width:r,height:c,buttonSize:l}=i,d="dark"===i.theme,p=d?"#1a1a2e":"#ffffff",u=d?"#e4e4e7":"#1f2937",h=d?"#71717a":"#6b7280",m=d?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.08)",g=d?"#16162a":"#f9fafb",f=`linear-gradient(135deg, ${t}, ${o})`,b=d?"#252542":"#f1f5f9",y=i.position?.includes("right")??!0,v=i.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: ${u}; -webkit-font-smoothing: antialiased; }\n .ihooman-widget button { all: unset; box-sizing: border-box; cursor: pointer; font-family: inherit; }\n .ihooman-toggle { position: fixed; ${y?"right: 20px":"left: 20px"}; ${v?"bottom: 20px":"top: 20px"}; width: ${l}px; height: ${l}px; border-radius: 50% !important; background: linear-gradient(135deg, ${t}, ${o}); border: none; cursor: pointer; z-index: ${s}; 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; ${y?"right: 20px":"left: 20px"}; ${v?"bottom: 90px":"top: 90px"}; width: ${r}px; height: ${c}px; min-height: ${c}px; max-height: ${c}px; z-index: ${(s??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: ${a}px; overflow: hidden; flex-shrink: 0; }\n .ihooman-container::before { content: ''; position: absolute; inset: 0; background: ${p}; opacity: 0.97; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: ${a}px; border: 1px solid ${m}; 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: 28px; height: 28px; border-radius: 6px; 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: 14px; height: 14px; }\n .ihooman-messages { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: ${p}; 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: ${m}; 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: ${u}; 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: ${p}; border-top: 1px solid ${m}; flex-shrink: 0; }\n .ihooman-input-wrapper { display: flex; align-items: flex-end; gap: 8px; background: ${g}; border: 1px solid ${m}; 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: ${u}; resize: none; max-height: 100px; outline: none; line-height: 1.4; }\n .ihooman-input::placeholder { color: ${h}; }\n .ihooman-input-btn { width: 32px; height: 32px; border-radius: 8px; 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: ${m}; color: ${u}; }\n .ihooman-input-btn.send { background: linear-gradient(135deg, ${t}, ${o}); color: white; }\n .ihooman-input-btn.send:hover { opacity: 0.9; }\n .ihooman-input-btn.send:disabled { opacity: 0.5; cursor: not-allowed; }\n .ihooman-input-btn svg { width: 16px; height: 16px; }\n .ihooman-file-input { display: none; }\n .ihooman-powered { text-align: center; padding: 8px; font-size: 11px; color: ${h}; background: ${p}; }\n .ihooman-powered a { color: ${e}; text-decoration: none; }\n .ihooman-escalation-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }\n .ihooman-escalation-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 6px; border: none; cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 500; transition: all 0.2s ease; line-height: 1.4; }\n .ihooman-escalation-btn svg { width: 14px; height: 14px; flex-shrink: 0; }\n .ihooman-escalation-btn.primary { background: linear-gradient(135deg, ${t}, ${o}); color: white; }\n .ihooman-escalation-btn.primary:hover { opacity: 0.9; }\n .ihooman-escalation-btn.secondary { background: ${d?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.05)"}; color: ${u}; border: 1px solid ${m}; }\n .ihooman-escalation-btn.secondary:hover { background: ${d?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.08)"}; }\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: ${p}; 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: ${u}; margin: 0; }\n .ihooman-ticket-subtitle { font-size: 13px; color: ${h}; margin: 0; }\n .ihooman-ticket-input { padding: 12px 14px; border: 1px solid ${m}; border-radius: 10px; font-size: 14px; font-family: inherit; background: ${g}; color: ${u}; 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 { display: flex; align-items: center; justify-content: center; padding: 12px; background: linear-gradient(135deg, ${t}, ${o}); color: white; border: none; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s; line-height: 1.4; }\n .ihooman-ticket-submit:hover { opacity: 0.9; }\n .ihooman-ticket-submit:disabled { opacity: 0.5; cursor: not-allowed; }\n .ihooman-ticket-back { display: flex; align-items: center; justify-content: center; padding: 10px; background: transparent; color: ${h}; border: 1px solid ${m}; border-radius: 8px; font-size: 13px; cursor: pointer; transition: all 0.2s; line-height: 1.4; }\n .ihooman-ticket-back:hover { background: ${d?"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: ${p}; }\n .ihooman-history-view.show { display: flex; }\n .ihooman-history-header { padding: 12px 16px; border-bottom: 1px solid ${m}; display: flex; justify-content: space-between; align-items: center; }\n .ihooman-history-title { font-size: 14px; font-weight: 600; color: ${u}; margin: 0; }\n .ihooman-history-new { display: inline-flex; align-items: center; justify-content: center; gap: 4px; background: linear-gradient(135deg, ${t}, ${o}); color: white; border: none; padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.2s; line-height: 1.4; }\n .ihooman-history-new:hover { opacity: 0.9; }\n .ihooman-history-new svg { width: 12px; height: 12px; 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 ${m}; border-radius: 8px; margin-bottom: 6px; cursor: pointer; transition: all 0.2s; background: ${p}; }\n .ihooman-history-item:hover { background: ${d?"rgba(255,255,255,0.05)":"#f8fafc"}; }\n .ihooman-history-item.active { background: ${d?"rgba(0, 174, 255, 0.1)":"#eff6ff"}; border-color: ${e}; }\n .ihooman-history-preview { font-size: 13px; color: ${u}; 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: ${p}; border-top: 1px solid ${m}; }\n .ihooman-preset-questions:empty { display: none; }\n .ihooman-preset-questions.hidden { display: none !important; }\n .ihooman-preset-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 6px 10px; border-radius: 6px; border: 1px solid ${m}; background: ${d?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)"}; color: ${u}; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.2s; white-space: nowrap; line-height: 1.4; }\n .ihooman-preset-btn:hover { background: ${d?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.05)"}; border-color: ${e}; }\n .ihooman-proactive-toast { position: fixed; ${y?"right: 20px":"left: 20px"}; ${v?"bottom: 90px":"top: 90px"}; max-width: 300px; padding: 16px; background: ${p}; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); z-index: ${(s??9999)-2}; opacity: 0; visibility: hidden; transform: translateY(10px); transition: all 0.3s ease; border: 1px solid ${m}; }\n .ihooman-proactive-toast.show { opacity: 1; visibility: visible; transform: translateY(0); }\n .ihooman-proactive-toast-content { font-size: 14px; color: ${u}; margin-bottom: 12px; }\n .ihooman-proactive-toast-actions { display: flex; gap: 8px; }\n .ihooman-proactive-toast-btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; line-height: 1.4; }\n .ihooman-proactive-toast-btn.primary { background: linear-gradient(135deg, ${t}, ${o}); color: white; border: none; }\n .ihooman-proactive-toast-btn.primary:hover { opacity: 0.9; }\n .ihooman-proactive-toast-btn.secondary { background: transparent; color: ${h}; border: 1px solid ${m}; }\n .ihooman-proactive-toast-btn.secondary:hover { background: ${d?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.03)"}; }\n .ihooman-survey-view { display: none; flex-direction: column; padding: 20px; gap: 16px; background: ${p}; flex: 1; align-items: center; justify-content: center; }\n .ihooman-survey-view.show { display: flex; }\n .ihooman-survey-question { font-size: 16px; font-weight: 600; color: ${u}; text-align: center; }\n .ihooman-survey-stars { display: flex; gap: 8px; }\n .ihooman-survey-star { width: 40px; height: 40px; cursor: pointer; color: ${h}; transition: all 0.2s; }\n .ihooman-survey-star:hover, .ihooman-survey-star.active { color: #fbbf24; transform: scale(1.1); }\n .ihooman-survey-star svg { width: 100%; height: 100%; }\n .ihooman-survey-comment { width: 100%; padding: 12px; border: 1px solid ${m}; border-radius: 8px; font-size: 14px; resize: none; min-height: 80px; background: ${g}; color: ${u}; }\n .ihooman-survey-submit { display: inline-flex; align-items: center; justify-content: center; padding: 10px 20px; background: linear-gradient(135deg, ${t}, ${o}); color: white; border: none; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; line-height: 1.4; }\n .ihooman-survey-submit:hover { opacity: 0.9; }\n .ihooman-survey-skip { display: inline-flex; align-items: center; justify-content: center; padding: 8px 16px; background: transparent; color: ${h}; border: none; font-size: 12px; cursor: pointer; line-height: 1.4; }\n .ihooman-survey-skip:hover { color: ${u}; }\n .ihooman-feedback-btns { display: flex; gap: 6px; margin-top: 6px; }\n .ihooman-feedback-btn { display: inline-flex; align-items: center; justify-content: center; padding: 4px 6px; border: 1px solid ${m}; border-radius: 4px; background: transparent; cursor: pointer; color: ${h}; transition: all 0.2s; }\n .ihooman-feedback-btn:hover { background: ${d?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.05)"}; }\n .ihooman-feedback-btn.active { background: ${e}; color: white; border-color: ${e}; }\n .ihooman-feedback-btn svg { width: 12px; height: 12px; }\n .ihooman-carousel { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; scroll-snap-type: x mandatory; }\n .ihooman-carousel::-webkit-scrollbar { height: 4px; }\n .ihooman-carousel-card { min-width: 200px; max-width: 250px; border: 1px solid ${m}; border-radius: 12px; overflow: hidden; scroll-snap-align: start; background: ${p}; }\n .ihooman-carousel-card img { width: 100%; height: 120px; object-fit: cover; }\n .ihooman-carousel-card-content { padding: 12px; }\n .ihooman-carousel-card-title { font-size: 14px; font-weight: 600; color: ${u}; margin-bottom: 4px; }\n .ihooman-carousel-card-desc { font-size: 12px; color: ${h}; margin-bottom: 8px; }\n .ihooman-carousel-card-btns { display: flex; flex-direction: column; gap: 6px; }\n .ihooman-carousel-card-btn { display: flex; align-items: center; justify-content: center; padding: 6px 10px; border: 1px solid ${m}; border-radius: 6px; background: transparent; color: ${u}; font-size: 11px; cursor: pointer; transition: all 0.2s; text-align: center; line-height: 1.4; }\n .ihooman-carousel-card-btn:hover { background: ${d?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.05)"}; border-color: ${e}; }\n .ihooman-quick-replies { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }\n .ihooman-quick-reply { display: inline-flex; align-items: center; justify-content: center; padding: 5px 10px; border: 1px solid ${e}; border-radius: 14px; background: transparent; color: ${e}; font-size: 11px; cursor: pointer; transition: all 0.2s; line-height: 1.4; }\n .ihooman-quick-reply:hover { background: ${e}; color: white; }\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 { ${y?"right: 16px":"left: 16px"}; bottom: 16px; } .ihooman-proactive-toast { left: 10px; right: 10px; max-width: none; } }\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">${n.chat}</span>\n <span class="close-icon">${n.close}</span>\n </button>\n <div class="ihooman-proactive-toast">\n <div class="ihooman-proactive-toast-content"></div>\n <div class="ihooman-proactive-toast-actions">\n <button class="ihooman-proactive-toast-btn primary">Chat Now</button>\n <button class="ihooman-proactive-toast-btn secondary">Dismiss</button>\n </div>\n </div>\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">${i.avatarUrl?`<img src="${w(i.avatarUrl)}" alt="Support">`:n.bot}</div>\n <div class="ihooman-header-info">\n <div class="ihooman-header-title">${w(i.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">${n.history}</button>\n <button class="ihooman-header-btn" data-action="refresh" title="New conversation">${n.plus}</button>\n <button class="ihooman-header-btn" data-action="minimize" title="Minimize">${n.minimize}</button>\n </div>\n </div>\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 ${i.enableFileUpload?`<button class="ihooman-input-btn attach" title="Attach file">${n.attach}</button><input type="file" class="ihooman-file-input">`:""}\n <textarea class="ihooman-input" placeholder="${w(i.placeholder||"Type a message...")}" rows="1" aria-label="Message input"></textarea>\n <button class="ihooman-input-btn send" title="Send message" disabled>${n.send}</button>\n </div>\n </div>\n </div>\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 <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">${n.plus} New Chat</button>\n </div>\n <div class="ihooman-history-list"></div>\n </div>\n <div class="ihooman-survey-view">\n <div class="ihooman-survey-question">${i.surveyConfig?.question||"How was your experience?"}</div>\n <div class="ihooman-survey-stars"></div>\n <textarea class="ihooman-survey-comment" placeholder="Any additional feedback? (optional)"></textarea>\n <button class="ihooman-survey-submit">Submit Feedback</button>\n <button class="ihooman-survey-skip">Skip</button>\n </div>\n ${i.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),u={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"),surveyView:t.querySelector(".ihooman-survey-view"),historyList:t.querySelector(".ihooman-history-list"),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"),proactiveToast:t.querySelector(".ihooman-proactive-toast")},function(){if(!u.toggle||!u.sendBtn||!u.input)return;u.toggle.addEventListener("click",ee),u.sendBtn.addEventListener("click",H),u.input.addEventListener("input",()=>{u.sendBtn&&(u.sendBtn.disabled=!u.input?.value.trim()),u.input&&(u.input.style.height="auto",u.input.style.height=Math.min(u.input.scrollHeight,100)+"px")}),u.input.addEventListener("keydown",e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),u.sendBtn?.disabled||H())}),u.attachBtn&&u.fileInput&&(u.attachBtn.addEventListener("click",()=>u.fileInput?.click()),u.fileInput.addEventListener("change",P));u.widget?.querySelector('[data-action="refresh"]')?.addEventListener("click",te),u.widget?.querySelector('[data-action="minimize"]')?.addEventListener("click",X),u.widget?.querySelector('[data-action="history"]')?.addEventListener("click",T),u.ticketSubmitBtn&&u.ticketSubmitBtn.addEventListener("click",M);u.ticketBackBtn&&u.ticketBackBtn.addEventListener("click",()=>q("chat"));const e=u.widget?.querySelector(".ihooman-history-new");e&&e.addEventListener("click",()=>{te(),q("chat")});const t=u.proactiveToast?.querySelector(".ihooman-proactive-toast-btn.primary"),o=u.proactiveToast?.querySelector(".ihooman-proactive-toast-btn.secondary");t&&t.addEventListener("click",()=>{W(),Z(),V("proactive:clicked")});o&&o.addEventListener("click",()=>{W()});const i=u.surveyView?.querySelector(".ihooman-survey-submit"),a=u.surveyView?.querySelector(".ihooman-survey-skip");i&&i.addEventListener("click",j);a&&a.addEventListener("click",()=>q("chat"));!function(){const e=u.surveyView?.querySelector(".ihooman-survey-stars");if(!e)return;let t=0;e.innerHTML="";for(let o=1;o<=5;o++){const i=document.createElement("div");i.className="ihooman-survey-star",i.innerHTML=n.starEmpty,i.dataset.rating=String(o),i.addEventListener("click",()=>{t=o,_(e,o)}),i.addEventListener("mouseenter",()=>_(e,o)),i.addEventListener("mouseleave",()=>_(e,t)),e.appendChild(i)}}()}()}function _(e,t){e.querySelectorAll(".ihooman-survey-star").forEach((e,o)=>{const i=e;o<t?(i.innerHTML=n.star,i.classList.add("active")):(i.innerHTML=n.starEmpty,i.classList.remove("active"))})}function I(e,t="bot",o={}){const s={id:x("msg_"),content:e,sender:t,timestamp:new Date,metadata:o};if(a.messages.push(s),!u.messages)return s;const r=document.createElement("div");r.className=`ihooman-message ${t}`;const c="bot"===t&&!0===o?.escalation_offered;let l="";c&&(l=`\n <div class="ihooman-escalation-actions">\n <button class="ihooman-escalation-btn primary" data-action="live-agent">${n.agent}<span>Talk to Agent</span></button>\n <button class="ihooman-escalation-btn secondary" data-action="create-ticket">${n.ticket}<span>Create Ticket</span></button>\n </div>\n `);let d="";o?.quick_replies&&o.quick_replies.length>0&&(d=`<div class="ihooman-quick-replies">${o.quick_replies.map(e=>`<button class="ihooman-quick-reply" data-text="${w(e.text)}">${w(e.text)}</button>`).join("")}</div>`);let p="";var h,m;"bot"!==t||o?.is_system_message||(p=`\n <div class="ihooman-feedback-btns">\n <button class="ihooman-feedback-btn" data-feedback="up" title="Helpful">${n.thumbUp}</button>\n <button class="ihooman-feedback-btn" data-feedback="down" title="Not helpful">${n.thumbDown}</button>\n </div>\n `),r.innerHTML=`\n <div class="ihooman-message-content">${m=e,m?w(m).replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/`(.*?)`/g,"<code>$1</code>").replace(/\[(.*?)\]\((.*?)\)/g,'<a href="$2" target="_blank" rel="noopener">$1</a>').replace(/\n/g,"<br>"):""}</div>\n ${l}\n ${d}\n ${p}\n ${i.showTimestamps?`<div class="ihooman-message-time">${h=s.timestamp,new Date(h).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}</div>`:""}\n `,c&&(r.querySelector('[data-action="live-agent"]')?.addEventListener("click",()=>L("live-agent")),r.querySelector('[data-action="create-ticket"]')?.addEventListener("click",()=>L("create-ticket"))),r.querySelectorAll(".ihooman-quick-reply").forEach(e=>{e.addEventListener("click",()=>{const t=e.dataset.text;t&&(D(),I(t,"user"),U(),N(t))})}),r.querySelectorAll(".ihooman-feedback-btn").forEach(e=>{e.addEventListener("click",()=>{const t=e.dataset.feedback;r.querySelectorAll(".ihooman-feedback-btn").forEach(e=>e.classList.remove("active")),e.classList.add("active"),async function(e,t){try{await fetch(`${i.serverUrl}/api/widget/feedback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({widget_id:i.widgetId,message_id:e,session_id:a.sessionId,feedback_type:t})})}catch(e){console.error("Error submitting feedback:",e)}}(s.id,"up"===t?"positive":"negative")})});const g=u.messages.querySelector(".ihooman-typing");return g&&g.remove(),u.messages.appendChild(r),u.messages.scrollTop=u.messages.scrollHeight,"bot"!==t||a.isOpen||(a.unreadCount++,u.badge&&(u.badge.textContent=String(a.unreadCount)),i.enableSounds&&function(){try{const e=new Audio("data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4Ljc2LjEwMAAAAAAAAAAAAAAA//tQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAAACAAABhgC7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7//////////////////////////////////////////////////////////////////8AAAAATGF2YzU4LjEzAAAAAAAAAAAAAAAAJAAAAAAAAAAAAYYNBrP/AAAAAAAAAAAAAAAAAAAAAP/7UMQAA8AAAaQAAAAgAAA0gAAABExBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tQxBKDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU=");e.volume=.3,e.play().catch(()=>{})}catch{}}()),V("message",s),s}function C(){console.debug("[IhoomanChat] Rendering preset questions:",p.length),u.presetQuestions&&0!==p.length?(u.presetQuestions.innerHTML=p.map(e=>`\n <button class="ihooman-preset-btn" data-question-id="${w(e.id)}" data-question-text="${w(e.text)}">\n ${e.icon||e.emoji?`<span class="icon">${w(e.icon||e.emoji||"")}</span>`:""}\n <span>${w(e.text)}</span>\n </button>\n `).join(""),u.presetQuestions.querySelectorAll(".ihooman-preset-btn").forEach(e=>{e.addEventListener("click",()=>{const t=e.dataset.questionText;t&&function(e){D(),I(e,"user"),U(),N(e)}(t)})})):u.presetQuestions&&(u.presetQuestions.innerHTML="")}function L(e){document.querySelectorAll(".ihooman-escalation-btn").forEach(e=>e.disabled=!0),"live-agent"===e?async function(){if(!a.sessionId)return void I("Please send a message first to start a conversation.","bot",{is_system_message:!0});try{const e=await fetch(`${i.serverUrl}/api/widget/live-agent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({widget_id:i.widgetId,session_id:a.sessionId,visitor_id:a.visitorId})}),t=await e.json();r=!0,a.escalationStatus={active:!0,type:"live_agent",queuePosition:t.position_in_queue},t.position_in_queue&&t.position_in_queue>1?E("waiting",`⏳ Waiting for agent (Position: #${t.position_in_queue})`):E("waiting","⏳ Connecting to live support..."),z(),V("escalation:start",{type:"live_agent"})}catch(e){console.error("Error requesting live agent:",e),I("❌ Unable to connect to live support. Please try again.","bot",{is_system_message:!0})}}():"create-ticket"===e&&q("ticket")}function q(e){s=e,a.view=e,u.chatView&&u.chatView.classList.toggle("hidden","chat"!==e),u.ticketView&&u.ticketView.classList.toggle("show","ticket"===e),u.historyView&&u.historyView.classList.toggle("show","history"===e),u.surveyView&&u.surveyView.classList.toggle("show","survey"===e),"history"===e&&async function(){if(!u.historyList||!a.visitorId)return;u.historyList.innerHTML='<div class="ihooman-history-empty">Loading...</div>';try{const e=await fetch(`${i.serverUrl}/api/widget/conversations?widget_id=${i.widgetId}&visitor_id=${a.visitorId}&limit=20`);if(!e.ok)throw new Error("Failed to load history");const t=await e.json();if(!t.length)return void(u.historyList.innerHTML='<div class="ihooman-history-empty">No conversations yet</div>');u.historyList.innerHTML=t.map(e=>`\n <div class="ihooman-history-item ${e.session_id===a.sessionId?"active":""}" data-session-id="${e.session_id}">\n <div class="ihooman-history-preview">${w(e.preview||"New conversation")}</div>\n <div class="ihooman-history-meta">\n <span>${e.message_count} msgs</span>\n <span>${"pending"===e.status?"🟡 Pending":"closed"===e.status?"✓ Closed":""} ${function(e){const t=Date.now()-new Date(e).getTime();return t<6e4?"now":t<36e5?Math.floor(t/6e4)+"m":t<864e5?Math.floor(t/36e5)+"h":Math.floor(t/864e5)+"d"}(e.updated_at)}</span>\n </div>\n </div>\n `).join(""),u.historyList.querySelectorAll(".ihooman-history-item").forEach(e=>{e.addEventListener("click",()=>{const t=e.dataset.sessionId;t&&async function(e){a.sessionId=e,i.persistSession&&k("session_id",e);u.messages&&(u.messages.innerHTML="");r=!1,B(),E("hidden"),b=!0,m&&(m.close(),m=null);R(),q("chat"),await async function(e){try{const t=await fetch(`${i.serverUrl}/api/widget/transcript/${e}?widget_id=${i.widgetId}`);if(!t.ok)throw new Error("Failed to load messages");const o=await t.json();u.messages&&(u.messages.innerHTML=""),o.messages&&o.messages.length>0?o.messages.forEach(e=>{const t="user"===e.sender_type?"user":"bot";I(e.content,t,e.extra_data||{})}):i.welcomeMessage&&I(i.welcomeMessage,"bot"),"pending"===o.status&&(r=!0,z(),E("waiting","⏳ Waiting for agent..."))}catch(e){console.error("Error loading conversation messages:",e),i.welcomeMessage&&I(i.welcomeMessage,"bot")}}(e)}(t)})})}catch(e){console.error("Error loading conversation history:",e),u.historyList.innerHTML='<div class="ihooman-history-empty">Failed to load history</div>'}}()}function T(){q("history"===s?"chat":"history")}function E(e,t){u.statusBar&&("hidden"!==e?(u.statusBar.classList.add("show"),u.statusBar.classList.remove("waiting","connected"),u.statusBar.classList.add(e),t&&(u.statusBar.textContent=t)):u.statusBar.classList.remove("show"))}async function M(){const e=u.ticketName?.value.trim(),t=u.ticketEmail?.value.trim(),o=u.ticketIssue?.value.trim();if(e&&t){u.ticketSubmitBtn&&(u.ticketSubmitBtn.disabled=!0,u.ticketSubmitBtn.textContent="Submitting...");try{const n=await fetch(`${i.serverUrl}/api/widget/submit-ticket`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({widget_id:i.widgetId,session_id:a.sessionId,user_name:e,user_email:t,issue:o||"No description provided"})}),s=await n.json();u.ticketName&&(u.ticketName.value=""),u.ticketEmail&&(u.ticketEmail.value=""),u.ticketIssue&&(u.ticketIssue.value=""),q("chat");I(`✅ Ticket submitted! We'll contact you at ${t}. Reference: #${s.ticket_id?s.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})}u.ticketSubmitBtn&&(u.ticketSubmitBtn.disabled=!1,u.ticketSubmitBtn.textContent="Submit Ticket")}else alert("Please fill in your name and email")}function z(){v||(v=setInterval(async()=>{if(a.sessionId&&r)try{const e=await fetch(`${i.serverUrl}/api/widget/escalation-status/${a.sessionId}?widget_id=${i.widgetId}`);if(e.ok){const t=await e.json();t.escalated&&("in_progress"===t.ticket_status?E("connected","🟢 Connected to live agent"):"open"===t.ticket_status?E("waiting",t.position_in_queue>1?`⏳ Waiting for agent (Position: #${t.position_in_queue})`:"⏳ Waiting for agent..."):"closed"!==t.ticket_status&&"resolved"!==t.ticket_status||(r=!1,B(),E("hidden"),I("This conversation has been closed. Thank you for contacting us!","bot",{is_system_message:!0}),V("escalation:end",{type:"live_agent"})))}}catch{}else B()},3e3))}function B(){v&&(clearInterval(v),v=null)}async function j(){const e=u.surveyView?.querySelector(".ihooman-survey-stars"),t=e?.querySelectorAll(".ihooman-survey-star.active"),o=t?.length||0,n=u.surveyView?.querySelector(".ihooman-survey-comment")?.value;if(0!==o)try{await fetch(`${i.serverUrl}/api/widget/survey-response`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({widget_id:i.widgetId,survey_id:i.surveyConfig?.id,session_id:a.sessionId,rating:o,comment:n})}),k("survey_completed_"+a.sessionId,!0),V("survey:submitted",{rating:o,comment:n}),I(i.surveyConfig?.thankYouMessage||"Thank you for your feedback!","bot",{is_system_message:!0}),q("chat")}catch(e){console.error("Error submitting survey:",e)}else alert("Please select a rating")}function U(){if(!i.showTypingIndicator||!u.messages)return;if(u.messages.querySelector(".ihooman-typing"))return;const e=document.createElement("div");e.className="ihooman-typing",e.innerHTML='<div class="ihooman-typing-dots"><span class="ihooman-typing-dot"></span><span class="ihooman-typing-dot"></span><span class="ihooman-typing-dot"></span></div>',u.messages.appendChild(e),u.messages.scrollTop=u.messages.scrollHeight}function O(){const e=u.messages?.querySelector(".ihooman-typing");e&&e.remove()}function H(){const e=u.input?.value.trim();e&&(D(),u.input&&(u.input.value="",u.input.style.height="auto"),u.sendBtn&&(u.sendBtn.disabled=!0),I(e,"user"),U(),N(e))}function D(){u.presetQuestions&&u.presetQuestions.classList.add("hidden")}async function N(e){if(m&&m.readyState===WebSocket.OPEN)m.send(JSON.stringify({type:"message",content:e}));else try{const t=await fetch(`${i.serverUrl}/api/v1/public/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e,session_id:a.sessionId,visitor_id:a.visitorId,widget_id:i.widgetId})}),o=await t.json();O(),o.session_id&&(a.sessionId=o.session_id,i.persistSession&&k("session_id",a.sessionId)),o.response&&I(o.response,"bot",{sources:o.sources,confidence:o.confidence,escalation_offered:o.escalation_offered,quick_replies:o.quick_replies})}catch(e){O(),I("Sorry, something went wrong. Please try again.","bot"),V("error",e)}}function P(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",a.sessionId||""),n.append("visitor_id",a.visitorId||""),n.append("widget_id",i.widgetId),fetch(`${i.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 Q(){i.proactiveMessages&&0!==i.proactiveMessages.length?(console.debug("[IhoomanChat] Initializing proactive messages:",i.proactiveMessages.length),c=k("shown_proactive")||[],l=k("proactive_cooldowns")||{},d=setInterval(F,5e3),window.addEventListener("scroll",F),document.addEventListener("mouseout",e=>{e.clientY<=0&&function(){if(a.isOpen||!i.proactiveMessages)return;const e=i.proactiveMessages.filter(e=>"exit_intent"===e.trigger.type&&!c.includes(e.id));e.length>0&&Y(e[0])}()})):console.debug("[IhoomanChat] No proactive messages configured")}function F(){if(a.isOpen||!i.proactiveMessages)return;const e=Date.now();for(const t of i.proactiveMessages){if(c.includes(t.id))continue;const o=l[t.id];if(o&&e-o<60*t.cooldownMinutes*1e3)continue;if(t.startDate&&new Date(t.startDate)>new Date)continue;if(t.endDate&&new Date(t.endDate)<new Date)continue;let n=!1;switch(t.trigger.type){case"time":const o="number"==typeof t.trigger.value?t.trigger.value:parseInt(String(t.trigger.value),10);e-(k("page_load_time")||e)>=1e3*o&&(n=!0);break;case"scroll":const i="number"==typeof t.trigger.value?t.trigger.value:parseInt(String(t.trigger.value),10);$()>=i&&(n=!0);break;case"url_pattern":A(String(t.trigger.value))&&(n=!0)}if(n){Y(t);break}}}function Y(e){if(c.push(e.id),l[e.id]=Date.now(),k("shown_proactive",c),k("proactive_cooldowns",l),u.proactiveToast){const t=u.proactiveToast.querySelector(".ihooman-proactive-toast-content");t&&(t.textContent=e.message),u.proactiveToast.classList.add("show"),V("proactive:shown",e),e.autoOpen&&setTimeout(()=>{W(),Z()},3e3)}}function W(){u.proactiveToast&&u.proactiveToast.classList.remove("show")}function R(e){if(!i.serverUrl&&!e)return;let t;if(i.widgetId){const e=i.serverUrl?.replace(/^http/,"ws"),o=new URLSearchParams({widget_id:i.widgetId});a.visitorId&&o.append("visitor_id",a.visitorId),a.sessionId&&o.append("session_id",a.sessionId),t=`${e}/public/ws?${o.toString()}`}else t=e||i.serverUrl?.replace(/^http/,"ws")+"/ws";try{J(),m=new WebSocket(t),m.onopen=()=>{a.isConnected=!0,a.connectionStatus="connected",f=0,K(!0),V("connected"),J(),y=setInterval(()=>{if(m&&m.readyState===WebSocket.OPEN)try{m.send(JSON.stringify({type:"ping"}))}catch{}},25e3)},m.onclose=t=>{if(a.isConnected=!1,a.connectionStatus="disconnected",K(!1),J(),V("disconnected"),b)b=!1;else if(a.isOpen)if(f<5){f++;const t=Math.min(1e3*Math.pow(2,f),3e4);setTimeout(()=>R(e),t)}else G()},m.onerror=e=>{console.error("WebSocket error:",e)},m.onmessage=e=>{try{const t=JSON.parse(e.data);if("connected"===t.type)t.session_id&&(a.sessionId=t.session_id,i.persistSession&&k("session_id",a.sessionId)),t.visitor_id&&(a.visitorId=t.visitor_id,i.persistSession&&k("visitor_id",a.visitorId)),t.welcome_message&&0===a.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,quick_replies:t.quick_replies})}else"typing"===t.type?t.is_typing?U():O():"pong"===t.type||"error"===t.type&&(console.error("WebSocket server error:",t.message),V("error",{message:t.message}))}catch{}}}catch{G()}}function J(){y&&(clearInterval(y),y=null)}function G(){g||(g=setInterval(async()=>{if(a.sessionId)try{const e=await fetch(`${i.serverUrl}/api/messages?session_id=${a.sessionId}&since=${Date.now()-5e3}&widget_id=${i.widgetId}`),t=await e.json();t.messages&&t.messages.forEach(e=>{a.messages.find(t=>t.id===e.id)||I(e.content,e.sender_type,e.metadata)})}catch{}},5e3))}function K(e){u.statusDot&&u.statusDot.classList.toggle("offline",!e),u.statusText&&(u.statusText.textContent=e?"Online":"Offline")}function Z(){a.isOpen||(a.isOpen=!0,a.unreadCount=0,u.badge&&(u.badge.textContent=""),u.toggle&&u.toggle.classList.add("open"),u.window&&u.window.classList.add("open"),W(),setTimeout(()=>u.input?.focus(),300),V("open"))}function X(){if(a.isOpen){if(a.isOpen=!1,u.toggle&&u.toggle.classList.remove("open"),u.window&&u.window.classList.remove("open"),i.surveyConfig&&a.messages.length>=4){a.sessionId&&k("survey_completed_"+a.sessionId)||setTimeout(()=>{a.isOpen||(i.surveyConfig&&(a.sessionId&&k("survey_completed_"+a.sessionId)||a.messages.length<4||(q("survey"),V("survey:shown",i.surveyConfig))),Z())},500)}V("close")}}function ee(){a.isOpen?X():Z()}function te(){a.sessionId=null,a.visitorId=null,a.messages=[],r=!1,k("session_id",null),a.visitorId=x("v_"),k("visitor_id",a.visitorId),u.messages&&(u.messages.innerHTML=""),E("hidden"),B(),f=0,m&&(b=!0,m.close(),m=null),R(),i.welcomeMessage&&I(i.welcomeMessage,"bot"),u.presetQuestions&&u.presetQuestions.classList.remove("hidden"),C(),V("newConversation")}function oe(e){i.title=e.title||i.title,i.subtitle=e.subtitle||i.subtitle,i.welcomeMessage=e.welcomeMessage||i.welcomeMessage,i.placeholder=e.placeholder||i.placeholder,i.position=e.position||i.position,e.theme&&(i.primaryColor=e.theme.primaryColor||i.primaryColor,i.gradientFrom=e.theme.gradientFrom||i.gradientFrom,i.gradientTo=e.theme.gradientTo||i.gradientTo,i.fontFamily=e.theme.fontFamily||i.fontFamily,e.theme.borderRadius&&(i.borderRadius=parseInt(e.theme.borderRadius,10)||i.borderRadius)),e.behavior&&(i.startOpen=e.behavior.startOpen??i.startOpen,i.showTypingIndicator=e.behavior.showTypingIndicator??i.showTypingIndicator,i.showTimestamps=e.behavior.showTimestamps??i.showTimestamps,i.enableSounds=e.behavior.enableSounds??i.enableSounds,i.enableFileUpload=e.behavior.enableFileUpload??i.enableFileUpload,i.persistSession=e.behavior.persistSession??i.persistSession),e.branding&&(i.avatarUrl=e.branding.avatarUrl||i.avatarUrl,i.logoUrl=e.branding.logoUrl||i.logoUrl,i.poweredBy=e.branding.poweredBy??i.poweredBy,i.customCss=e.branding.customCss||i.customCss),e.size&&(i.width=e.size.width||i.width,i.height=e.size.height||i.height,i.buttonSize=e.size.buttonSize||i.buttonSize),e.presetQuestions&&Array.isArray(e.presetQuestions)&&(console.debug("[IhoomanChat] Server config presetQuestions:",e.presetQuestions.length),p=e.presetQuestions.map(e=>({id:e.id,text:e.text,icon:e.icon,emoji:e.icon})),i.presetQuestions=p),e.proactiveMessages&&Array.isArray(e.proactiveMessages)&&(console.debug("[IhoomanChat] Server config proactiveMessages:",e.proactiveMessages.length),i.proactiveMessages=e.proactiveMessages.filter(e=>!1!==e.isActive).map(e=>({id:e.id,message:e.message,trigger:{type:e.trigger.type,value:"time"===e.trigger.type||"scroll"===e.trigger.type?parseInt(e.trigger.value,10)||30:e.trigger.value},autoOpen:e.autoOpen||!1,cooldownMinutes:e.cooldownMinutes||60}))),e.surveyConfig&&!1!==e.surveyConfig.isActive&&(console.debug("[IhoomanChat] Server config surveyConfig:",e.surveyConfig.id),i.surveyConfig={id:e.surveyConfig.id,type:e.surveyConfig.type,question:e.surveyConfig.question,followUpQuestion:e.surveyConfig.followUpQuestion,thankYouMessage:e.surveyConfig.thankYouMessage}),e.buttonStyling&&(console.debug("[IhoomanChat] Server config buttonStyling:",Object.keys(e.buttonStyling)),i.buttonStyling=e.buttonStyling,function(e){const t="ihooman-button-styling";let o=document.getElementById(t);o||(o=document.createElement("style"),o.id=t,document.head.appendChild(o));const n=(e,t)=>{if(!t)return"";const o=t.backgroundColor||"",n=t.textColor||"",i=t.borderColor||"transparent";return`\n ${e} {\n ${o?`background-color: ${o} !important;`:""}\n ${n?`color: ${n} !important;`:""}\n border: ${t.borderWidth||0}px solid ${i} !important;\n border-radius: ${t.borderRadius||8}px !important;\n padding: ${t.paddingVertical||8}px ${t.paddingHorizontal||16}px !important;\n font-size: ${t.fontSize||13}px !important;\n font-weight: ${function(e){switch(e){case"normal":return 400;case"medium":default:return 500;case"semibold":return 600;case"bold":return 700}}(t.fontWeight||"medium")} !important;\n }\n `};let i="";e.primary&&(i+=n(".ihooman-send-btn, .ihooman-proactive-toast-btn.primary, .ihooman-survey-submit",e.primary)),e.secondary&&(i+=n(".ihooman-proactive-toast-btn.secondary, .ihooman-survey-skip, .ihooman-escalation-btn.secondary",e.secondary)),e.presetQuestions&&(i+=n(".ihooman-preset-btn",e.presetQuestions)),e.quickReplies&&(i+=n(".ihooman-quick-reply-btn",e.quickReplies)),e.feedback&&(i+=n(".ihooman-feedback-btn",e.feedback)),e.headerActions&&(i+=n(".ihooman-header-btn",e.headerActions)),e.escalation&&(i+=n(".ihooman-escalation-btn.primary",e.escalation)),e.cardActions&&(i+=n(".ihooman-card-btn",e.cardActions)),o.textContent=i}(e.buttonStyling))}async function ne(e){if(!e.widgetId)return console.error("IhoomanChat: widgetId is required"),null;i={...o,...e},a.visitorId=k("visitor_id")||x("v_"),k("visitor_id",a.visitorId),i.persistSession&&(a.sessionId=k("session_id")),k("page_load_time")||k("page_load_time",Date.now());const n=i.serverUrl||t,s=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."}}}(i.widgetId,n);let r;return s.success&&s.config?(oe(s.config),r=s.chatEndpoint):s.error&&(console.warn("IhoomanChat: Could not fetch server config:",s.error),"Widget not authorized for this domain"===s.error&&console.error("IhoomanChat: Widget configuration error. Please contact support.")),S(),C(),a.messages.forEach(e=>I(e.content,"user"===e.sender?"user":"bot",e.metadata)),0===a.messages.length&&i.welcomeMessage&&I(i.welcomeMessage,"bot"),R(r),Q(),i.startOpen&&setTimeout(Z,500),V("ready"),ie}const ie={init:ne,open:Z,close:X,toggle:ee,isOpen:function(){return a.isOpen},destroy:function(){J(),B(),d&&(clearInterval(d),d=null),window.removeEventListener("scroll",F),b=!0,m&&(m.close(),m=null),g&&(clearInterval(g),g=null),u.widget&&u.widget.remove();const e=document.getElementById("ihooman-widget-styles");e&&e.remove(),a={isOpen:!1,isConnected:!1,messages:[],sessionId:null,visitorId:null,unreadCount:0},u={},f=0,b=!1},sendMessage:function(e){e.trim()&&(u.input&&(u.input.value=e),H())},setUser:function(e){a.userInfo=e,e.name&&k("user_name",e.name),e.email&&k("user_email",e.email),e.metadata&&k("user_metadata",e.metadata)},clearUser:function(){a.userInfo=null,k("user_name",null),k("user_email",null),k("user_metadata",null)},clearHistory:function(){te()},on:function(e,t){h[e]||(h[e]=[]),h[e].push(t)},off:function(e,t){h[e]&&(h[e]=h[e].filter(e=>e!==t))},getState:function(){return{...a}},getConfig:function(){return{...i}},version:"3.0.2"},ae=ie;!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",()=>ne(o)):ne(o)}}(),"undefined"!=typeof window&&(window.IhoomanChat=ae),e.IhoomanChat=ae,e.createWidgetInstance=function(){return{...ie}},e.default=ae,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="https://api.ihooman.ai",o={serverUrl:t,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,presetQuestions:[],proactiveMessages:[],surveyConfig:null,locale:"en",allowLocalhost:!0},n={chat:'<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>',close:'<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>',send:'<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>',attach:'<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>',minimize:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"></line></svg>',bot:'<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>',agent:'<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>',ticket:'<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></svg>',history:'<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>',plus:'<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>',star:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"></path></svg>',starEmpty:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"></path></svg>',thumbUp:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"></path></svg>',thumbDown:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17"></path></svg>'};let i={widgetId:"",...o},a={isOpen:!1,isConnected:!1,messages:[],pendingMessages:[],sessionId:null,visitorId:null,unreadCount:0,view:"chat",connectionStatus:"disconnected",typingIndicator:!1,soundMuted:!1,escalationStatus:null,userInfo:null},s="chat",r=!1,c=[],l={},d=null,p=[],u={};const h={};let m=null,g=null,f=0;let b=!1,y=null,v=null;function x(e=""){return e+Math.random().toString(36).slice(2,14)+Date.now().toString(36)}function w(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}function k(e,t){const o="ihooman_chat_"+e;try{if(void 0===t){const e=localStorage.getItem(o);return e?JSON.parse(e):null}return null===t?(localStorage.removeItem(o),null):(localStorage.setItem(o,JSON.stringify(t)),t)}catch{return null}}function V(e,t){(h[e]||[]).forEach(o=>{try{o(t)}catch(t){console.error(`Error in ${e} handler:`,t)}});const o=`on${e.charAt(0).toUpperCase()}${e.slice(1)}`,n=i[o];if("function"==typeof n)try{n(t)}catch(e){console.error(`Error in ${o}:`,e)}}function $(){const e=window.scrollY||document.documentElement.scrollTop,t=document.documentElement.scrollHeight-window.innerHeight;return t>0?Math.round(e/t*100):0}function A(e){try{return new RegExp(e.replace(/\*/g,".*")).test(window.location.href)}catch{return window.location.href.includes(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:a,zIndex:s,width:r,height:c,buttonSize:l}=i,d="dark"===i.theme,p=d?"#1a1a2e":"#ffffff",u=d?"#e4e4e7":"#1f2937",h=d?"#71717a":"#6b7280",m=d?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.08)",g=d?"#16162a":"#f9fafb",f=`linear-gradient(135deg, ${t}, ${o})`,b=d?"#252542":"#f1f5f9",y=i.position?.includes("right")??!0,v=i.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: ${u}; -webkit-font-smoothing: antialiased; }\n .ihooman-widget button:not(.ihooman-toggle) { all: unset; box-sizing: border-box; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; justify-content: center; }\n .ihooman-toggle { position: fixed !important; ${y?"right: 20px":"left: 20px"}; ${v?"bottom: 20px":"top: 20px"}; width: ${l}px !important; height: ${l}px !important; border-radius: 50% !important; background: linear-gradient(135deg, ${t}, ${o}) !important; border: none !important; cursor: pointer; z-index: ${s}; display: flex !important; 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; ${y?"right: 20px":"left: 20px"}; ${v?"bottom: 90px":"top: 90px"}; width: ${r}px; height: ${c}px; min-height: ${c}px; max-height: ${c}px; z-index: ${(s??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: ${a}px; overflow: hidden; flex-shrink: 0; }\n .ihooman-container::before { content: ''; position: absolute; inset: 0; background: ${p}; opacity: 0.97; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: ${a}px; border: 1px solid ${m}; 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: 28px; height: 28px; border-radius: 6px; 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: 14px; height: 14px; }\n .ihooman-messages { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: ${p}; 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: ${m}; 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: ${u}; 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: ${p}; border-top: 1px solid ${m}; flex-shrink: 0; }\n .ihooman-input-wrapper { display: flex; align-items: flex-end; gap: 8px; background: ${g}; border: 1px solid ${m}; 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: ${u}; resize: none; max-height: 100px; outline: none; line-height: 1.4; }\n .ihooman-input::placeholder { color: ${h}; }\n .ihooman-input-btn { width: 32px; height: 32px; border-radius: 8px; 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: ${m}; color: ${u}; }\n .ihooman-input-btn.send { background: linear-gradient(135deg, ${t}, ${o}); color: white; }\n .ihooman-input-btn.send:hover { opacity: 0.9; }\n .ihooman-input-btn.send:disabled { opacity: 0.5; cursor: not-allowed; }\n .ihooman-input-btn svg { width: 16px; height: 16px; }\n .ihooman-file-input { display: none; }\n .ihooman-powered { text-align: center; padding: 8px; font-size: 11px; color: ${h}; background: ${p}; }\n .ihooman-powered a { color: ${e}; text-decoration: none; }\n .ihooman-escalation-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }\n .ihooman-escalation-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 6px; border: none; cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 500; transition: all 0.2s ease; line-height: 1.4; }\n .ihooman-escalation-btn svg { width: 14px; height: 14px; flex-shrink: 0; }\n .ihooman-escalation-btn.primary { background: linear-gradient(135deg, ${t}, ${o}); color: white; }\n .ihooman-escalation-btn.primary:hover { opacity: 0.9; }\n .ihooman-escalation-btn.secondary { background: ${d?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.05)"}; color: ${u}; border: 1px solid ${m}; }\n .ihooman-escalation-btn.secondary:hover { background: ${d?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.08)"}; }\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: ${p}; 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: ${u}; margin: 0; }\n .ihooman-ticket-subtitle { font-size: 13px; color: ${h}; margin: 0; }\n .ihooman-ticket-input { padding: 12px 14px; border: 1px solid ${m}; border-radius: 10px; font-size: 14px; font-family: inherit; background: ${g}; color: ${u}; 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 { display: flex; align-items: center; justify-content: center; padding: 12px; background: linear-gradient(135deg, ${t}, ${o}); color: white; border: none; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s; line-height: 1.4; }\n .ihooman-ticket-submit:hover { opacity: 0.9; }\n .ihooman-ticket-submit:disabled { opacity: 0.5; cursor: not-allowed; }\n .ihooman-ticket-back { display: flex; align-items: center; justify-content: center; padding: 10px; background: transparent; color: ${h}; border: 1px solid ${m}; border-radius: 8px; font-size: 13px; cursor: pointer; transition: all 0.2s; line-height: 1.4; }\n .ihooman-ticket-back:hover { background: ${d?"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: ${p}; }\n .ihooman-history-view.show { display: flex; }\n .ihooman-history-header { padding: 12px 16px; border-bottom: 1px solid ${m}; display: flex; justify-content: space-between; align-items: center; }\n .ihooman-history-title { font-size: 14px; font-weight: 600; color: ${u}; margin: 0; }\n .ihooman-history-new { display: inline-flex; align-items: center; justify-content: center; gap: 4px; background: linear-gradient(135deg, ${t}, ${o}); color: white; border: none; padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.2s; line-height: 1.4; }\n .ihooman-history-new:hover { opacity: 0.9; }\n .ihooman-history-new svg { width: 12px; height: 12px; 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 ${m}; border-radius: 8px; margin-bottom: 6px; cursor: pointer; transition: all 0.2s; background: ${p}; }\n .ihooman-history-item:hover { background: ${d?"rgba(255,255,255,0.05)":"#f8fafc"}; }\n .ihooman-history-item.active { background: ${d?"rgba(0, 174, 255, 0.1)":"#eff6ff"}; border-color: ${e}; }\n .ihooman-history-preview { font-size: 13px; color: ${u}; 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: ${p}; border-top: 1px solid ${m}; }\n .ihooman-preset-questions:empty { display: none; }\n .ihooman-preset-questions.hidden { display: none !important; }\n .ihooman-preset-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 6px 10px; border-radius: 6px; border: 1px solid ${m}; background: ${d?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)"}; color: ${u}; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.2s; white-space: nowrap; line-height: 1.4; }\n .ihooman-preset-btn:hover { background: ${d?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.05)"}; border-color: ${e}; }\n .ihooman-proactive-toast { position: fixed; ${y?"right: 20px":"left: 20px"}; ${v?"bottom: 90px":"top: 90px"}; max-width: 300px; padding: 16px; background: ${p}; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); z-index: ${(s??9999)-2}; opacity: 0; visibility: hidden; transform: translateY(10px); transition: all 0.3s ease; border: 1px solid ${m}; }\n .ihooman-proactive-toast.show { opacity: 1; visibility: visible; transform: translateY(0); }\n .ihooman-proactive-toast-content { font-size: 14px; color: ${u}; margin-bottom: 12px; }\n .ihooman-proactive-toast-actions { display: flex; gap: 8px; }\n .ihooman-proactive-toast-btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; line-height: 1.4; }\n .ihooman-proactive-toast-btn.primary { background: linear-gradient(135deg, ${t}, ${o}); color: white; border: none; }\n .ihooman-proactive-toast-btn.primary:hover { opacity: 0.9; }\n .ihooman-proactive-toast-btn.secondary { background: transparent; color: ${h}; border: 1px solid ${m}; }\n .ihooman-proactive-toast-btn.secondary:hover { background: ${d?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.03)"}; }\n .ihooman-survey-view { display: none; flex-direction: column; padding: 20px; gap: 16px; background: ${p}; flex: 1; align-items: center; justify-content: center; }\n .ihooman-survey-view.show { display: flex; }\n .ihooman-survey-question { font-size: 16px; font-weight: 600; color: ${u}; text-align: center; }\n .ihooman-survey-stars { display: flex; gap: 8px; }\n .ihooman-survey-star { width: 40px; height: 40px; cursor: pointer; color: ${h}; transition: all 0.2s; }\n .ihooman-survey-star:hover, .ihooman-survey-star.active { color: #fbbf24; transform: scale(1.1); }\n .ihooman-survey-star svg { width: 100%; height: 100%; }\n .ihooman-survey-comment { width: 100%; padding: 12px; border: 1px solid ${m}; border-radius: 8px; font-size: 14px; resize: none; min-height: 80px; background: ${g}; color: ${u}; }\n .ihooman-survey-submit { display: inline-flex; align-items: center; justify-content: center; padding: 10px 20px; background: linear-gradient(135deg, ${t}, ${o}); color: white; border: none; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; line-height: 1.4; }\n .ihooman-survey-submit:hover { opacity: 0.9; }\n .ihooman-survey-skip { display: inline-flex; align-items: center; justify-content: center; padding: 8px 16px; background: transparent; color: ${h}; border: none; font-size: 12px; cursor: pointer; line-height: 1.4; }\n .ihooman-survey-skip:hover { color: ${u}; }\n .ihooman-feedback-btns { display: flex; gap: 6px; margin-top: 6px; }\n .ihooman-feedback-btn { display: inline-flex; align-items: center; justify-content: center; padding: 4px 6px; border: 1px solid ${m}; border-radius: 4px; background: transparent; cursor: pointer; color: ${h}; transition: all 0.2s; }\n .ihooman-feedback-btn:hover { background: ${d?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.05)"}; }\n .ihooman-feedback-btn.active { background: ${e}; color: white; border-color: ${e}; }\n .ihooman-feedback-btn svg { width: 12px; height: 12px; }\n .ihooman-carousel { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; scroll-snap-type: x mandatory; }\n .ihooman-carousel::-webkit-scrollbar { height: 4px; }\n .ihooman-carousel-card { min-width: 200px; max-width: 250px; border: 1px solid ${m}; border-radius: 12px; overflow: hidden; scroll-snap-align: start; background: ${p}; }\n .ihooman-carousel-card img { width: 100%; height: 120px; object-fit: cover; }\n .ihooman-carousel-card-content { padding: 12px; }\n .ihooman-carousel-card-title { font-size: 14px; font-weight: 600; color: ${u}; margin-bottom: 4px; }\n .ihooman-carousel-card-desc { font-size: 12px; color: ${h}; margin-bottom: 8px; }\n .ihooman-carousel-card-btns { display: flex; flex-direction: column; gap: 6px; }\n .ihooman-carousel-card-btn { display: flex; align-items: center; justify-content: center; padding: 6px 10px; border: 1px solid ${m}; border-radius: 6px; background: transparent; color: ${u}; font-size: 11px; cursor: pointer; transition: all 0.2s; text-align: center; line-height: 1.4; }\n .ihooman-carousel-card-btn:hover { background: ${d?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.05)"}; border-color: ${e}; }\n .ihooman-quick-replies { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }\n .ihooman-quick-reply { display: inline-flex; align-items: center; justify-content: center; padding: 5px 10px; border: 1px solid ${e}; border-radius: 14px; background: transparent; color: ${e}; font-size: 11px; cursor: pointer; transition: all 0.2s; line-height: 1.4; }\n .ihooman-quick-reply:hover { background: ${e}; color: white; }\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 { ${y?"right: 16px":"left: 16px"}; bottom: 16px; } .ihooman-proactive-toast { left: 10px; right: 10px; max-width: none; } }\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">${n.chat}</span>\n <span class="close-icon">${n.close}</span>\n </button>\n <div class="ihooman-proactive-toast">\n <div class="ihooman-proactive-toast-content"></div>\n <div class="ihooman-proactive-toast-actions">\n <button class="ihooman-proactive-toast-btn primary">Chat Now</button>\n <button class="ihooman-proactive-toast-btn secondary">Dismiss</button>\n </div>\n </div>\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">${i.avatarUrl?`<img src="${w(i.avatarUrl)}" alt="Support">`:n.bot}</div>\n <div class="ihooman-header-info">\n <div class="ihooman-header-title">${w(i.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">${n.history}</button>\n <button class="ihooman-header-btn" data-action="refresh" title="New conversation">${n.plus}</button>\n <button class="ihooman-header-btn" data-action="minimize" title="Minimize">${n.minimize}</button>\n </div>\n </div>\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 ${i.enableFileUpload?`<button class="ihooman-input-btn attach" title="Attach file">${n.attach}</button><input type="file" class="ihooman-file-input">`:""}\n <textarea class="ihooman-input" placeholder="${w(i.placeholder||"Type a message...")}" rows="1" aria-label="Message input"></textarea>\n <button class="ihooman-input-btn send" title="Send message" disabled>${n.send}</button>\n </div>\n </div>\n </div>\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 <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">${n.plus} New Chat</button>\n </div>\n <div class="ihooman-history-list"></div>\n </div>\n <div class="ihooman-survey-view">\n <div class="ihooman-survey-question">${i.surveyConfig?.question||"How was your experience?"}</div>\n <div class="ihooman-survey-stars"></div>\n <textarea class="ihooman-survey-comment" placeholder="Any additional feedback? (optional)"></textarea>\n <button class="ihooman-survey-submit">Submit Feedback</button>\n <button class="ihooman-survey-skip">Skip</button>\n </div>\n ${i.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),u={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"),surveyView:t.querySelector(".ihooman-survey-view"),historyList:t.querySelector(".ihooman-history-list"),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"),proactiveToast:t.querySelector(".ihooman-proactive-toast")},function(){if(!u.toggle||!u.sendBtn||!u.input)return;u.toggle.addEventListener("click",ee),u.sendBtn.addEventListener("click",H),u.input.addEventListener("input",()=>{u.sendBtn&&(u.sendBtn.disabled=!u.input?.value.trim()),u.input&&(u.input.style.height="auto",u.input.style.height=Math.min(u.input.scrollHeight,100)+"px")}),u.input.addEventListener("keydown",e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),u.sendBtn?.disabled||H())}),u.attachBtn&&u.fileInput&&(u.attachBtn.addEventListener("click",()=>u.fileInput?.click()),u.fileInput.addEventListener("change",P));u.widget?.querySelector('[data-action="refresh"]')?.addEventListener("click",te),u.widget?.querySelector('[data-action="minimize"]')?.addEventListener("click",X),u.widget?.querySelector('[data-action="history"]')?.addEventListener("click",T),u.ticketSubmitBtn&&u.ticketSubmitBtn.addEventListener("click",M);u.ticketBackBtn&&u.ticketBackBtn.addEventListener("click",()=>q("chat"));const e=u.widget?.querySelector(".ihooman-history-new");e&&e.addEventListener("click",()=>{te(),q("chat")});const t=u.proactiveToast?.querySelector(".ihooman-proactive-toast-btn.primary"),o=u.proactiveToast?.querySelector(".ihooman-proactive-toast-btn.secondary");t&&t.addEventListener("click",()=>{W(),Z(),V("proactive:clicked")});o&&o.addEventListener("click",()=>{W()});const i=u.surveyView?.querySelector(".ihooman-survey-submit"),a=u.surveyView?.querySelector(".ihooman-survey-skip");i&&i.addEventListener("click",j);a&&a.addEventListener("click",()=>q("chat"));!function(){const e=u.surveyView?.querySelector(".ihooman-survey-stars");if(!e)return;let t=0;e.innerHTML="";for(let o=1;o<=5;o++){const i=document.createElement("div");i.className="ihooman-survey-star",i.innerHTML=n.starEmpty,i.dataset.rating=String(o),i.addEventListener("click",()=>{t=o,_(e,o)}),i.addEventListener("mouseenter",()=>_(e,o)),i.addEventListener("mouseleave",()=>_(e,t)),e.appendChild(i)}}()}()}function _(e,t){e.querySelectorAll(".ihooman-survey-star").forEach((e,o)=>{const i=e;o<t?(i.innerHTML=n.star,i.classList.add("active")):(i.innerHTML=n.starEmpty,i.classList.remove("active"))})}function I(e,t="bot",o={}){const s={id:x("msg_"),content:e,sender:t,timestamp:new Date,metadata:o};if(a.messages.push(s),!u.messages)return s;const r=document.createElement("div");r.className=`ihooman-message ${t}`;const c="bot"===t&&!0===o?.escalation_offered;let l="";c&&(l=`\n <div class="ihooman-escalation-actions">\n <button class="ihooman-escalation-btn primary" data-action="live-agent">${n.agent}<span>Talk to Agent</span></button>\n <button class="ihooman-escalation-btn secondary" data-action="create-ticket">${n.ticket}<span>Create Ticket</span></button>\n </div>\n `);let d="";o?.quick_replies&&o.quick_replies.length>0&&(d=`<div class="ihooman-quick-replies">${o.quick_replies.map(e=>`<button class="ihooman-quick-reply" data-text="${w(e.text)}">${w(e.text)}</button>`).join("")}</div>`);let p="";var h,m;"bot"!==t||o?.is_system_message||(p=`\n <div class="ihooman-feedback-btns">\n <button class="ihooman-feedback-btn" data-feedback="up" title="Helpful">${n.thumbUp}</button>\n <button class="ihooman-feedback-btn" data-feedback="down" title="Not helpful">${n.thumbDown}</button>\n </div>\n `),r.innerHTML=`\n <div class="ihooman-message-content">${m=e,m?w(m).replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/`(.*?)`/g,"<code>$1</code>").replace(/\[(.*?)\]\((.*?)\)/g,'<a href="$2" target="_blank" rel="noopener">$1</a>').replace(/\n/g,"<br>"):""}</div>\n ${l}\n ${d}\n ${p}\n ${i.showTimestamps?`<div class="ihooman-message-time">${h=s.timestamp,new Date(h).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}</div>`:""}\n `,c&&(r.querySelector('[data-action="live-agent"]')?.addEventListener("click",()=>L("live-agent")),r.querySelector('[data-action="create-ticket"]')?.addEventListener("click",()=>L("create-ticket"))),r.querySelectorAll(".ihooman-quick-reply").forEach(e=>{e.addEventListener("click",()=>{const t=e.dataset.text;t&&(D(),I(t,"user"),U(),N(t))})}),r.querySelectorAll(".ihooman-feedback-btn").forEach(e=>{e.addEventListener("click",()=>{const t=e.dataset.feedback;r.querySelectorAll(".ihooman-feedback-btn").forEach(e=>e.classList.remove("active")),e.classList.add("active"),async function(e,t){try{await fetch(`${i.serverUrl}/api/widget/feedback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({widget_id:i.widgetId,message_id:e,session_id:a.sessionId,feedback_type:t})})}catch(e){console.error("Error submitting feedback:",e)}}(s.id,"up"===t?"positive":"negative")})});const g=u.messages.querySelector(".ihooman-typing");return g&&g.remove(),u.messages.appendChild(r),u.messages.scrollTop=u.messages.scrollHeight,"bot"!==t||a.isOpen||(a.unreadCount++,u.badge&&(u.badge.textContent=String(a.unreadCount)),i.enableSounds&&function(){try{const e=new Audio("data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4Ljc2LjEwMAAAAAAAAAAAAAAA//tQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAAACAAABhgC7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7//////////////////////////////////////////////////////////////////8AAAAATGF2YzU4LjEzAAAAAAAAAAAAAAAAJAAAAAAAAAAAAYYNBrP/AAAAAAAAAAAAAAAAAAAAAP/7UMQAA8AAAaQAAAAgAAA0gAAABExBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tQxBKDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU=");e.volume=.3,e.play().catch(()=>{})}catch{}}()),V("message",s),s}function C(){console.debug("[IhoomanChat] Rendering preset questions:",p.length),u.presetQuestions&&0!==p.length?(u.presetQuestions.innerHTML=p.map(e=>`\n <button class="ihooman-preset-btn" data-question-id="${w(e.id)}" data-question-text="${w(e.text)}">\n ${e.icon||e.emoji?`<span class="icon">${w(e.icon||e.emoji||"")}</span>`:""}\n <span>${w(e.text)}</span>\n </button>\n `).join(""),u.presetQuestions.querySelectorAll(".ihooman-preset-btn").forEach(e=>{e.addEventListener("click",()=>{const t=e.dataset.questionText;t&&function(e){D(),I(e,"user"),U(),N(e)}(t)})})):u.presetQuestions&&(u.presetQuestions.innerHTML="")}function L(e){document.querySelectorAll(".ihooman-escalation-btn").forEach(e=>e.disabled=!0),"live-agent"===e?async function(){if(!a.sessionId)return void I("Please send a message first to start a conversation.","bot",{is_system_message:!0});try{const e=await fetch(`${i.serverUrl}/api/widget/live-agent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({widget_id:i.widgetId,session_id:a.sessionId,visitor_id:a.visitorId})}),t=await e.json();r=!0,a.escalationStatus={active:!0,type:"live_agent",queuePosition:t.position_in_queue},t.position_in_queue&&t.position_in_queue>1?E("waiting",`⏳ Waiting for agent (Position: #${t.position_in_queue})`):E("waiting","⏳ Connecting to live support..."),z(),V("escalation:start",{type:"live_agent"})}catch(e){console.error("Error requesting live agent:",e),I("❌ Unable to connect to live support. Please try again.","bot",{is_system_message:!0})}}():"create-ticket"===e&&q("ticket")}function q(e){s=e,a.view=e,u.chatView&&u.chatView.classList.toggle("hidden","chat"!==e),u.ticketView&&u.ticketView.classList.toggle("show","ticket"===e),u.historyView&&u.historyView.classList.toggle("show","history"===e),u.surveyView&&u.surveyView.classList.toggle("show","survey"===e),"history"===e&&async function(){if(!u.historyList||!a.visitorId)return;u.historyList.innerHTML='<div class="ihooman-history-empty">Loading...</div>';try{const e=await fetch(`${i.serverUrl}/api/widget/conversations?widget_id=${i.widgetId}&visitor_id=${a.visitorId}&limit=20`);if(!e.ok)throw new Error("Failed to load history");const t=await e.json();if(!t.length)return void(u.historyList.innerHTML='<div class="ihooman-history-empty">No conversations yet</div>');u.historyList.innerHTML=t.map(e=>`\n <div class="ihooman-history-item ${e.session_id===a.sessionId?"active":""}" data-session-id="${e.session_id}">\n <div class="ihooman-history-preview">${w(e.preview||"New conversation")}</div>\n <div class="ihooman-history-meta">\n <span>${e.message_count} msgs</span>\n <span>${"pending"===e.status?"🟡 Pending":"closed"===e.status?"✓ Closed":""} ${function(e){const t=Date.now()-new Date(e).getTime();return t<6e4?"now":t<36e5?Math.floor(t/6e4)+"m":t<864e5?Math.floor(t/36e5)+"h":Math.floor(t/864e5)+"d"}(e.updated_at)}</span>\n </div>\n </div>\n `).join(""),u.historyList.querySelectorAll(".ihooman-history-item").forEach(e=>{e.addEventListener("click",()=>{const t=e.dataset.sessionId;t&&async function(e){a.sessionId=e,i.persistSession&&k("session_id",e);u.messages&&(u.messages.innerHTML="");r=!1,B(),E("hidden"),b=!0,m&&(m.close(),m=null);R(),q("chat"),await async function(e){try{const t=await fetch(`${i.serverUrl}/api/widget/transcript/${e}?widget_id=${i.widgetId}`);if(!t.ok)throw new Error("Failed to load messages");const o=await t.json();u.messages&&(u.messages.innerHTML=""),o.messages&&o.messages.length>0?o.messages.forEach(e=>{const t="user"===e.sender_type?"user":"bot";I(e.content,t,e.extra_data||{})}):i.welcomeMessage&&I(i.welcomeMessage,"bot"),"pending"===o.status&&(r=!0,z(),E("waiting","⏳ Waiting for agent..."))}catch(e){console.error("Error loading conversation messages:",e),i.welcomeMessage&&I(i.welcomeMessage,"bot")}}(e)}(t)})})}catch(e){console.error("Error loading conversation history:",e),u.historyList.innerHTML='<div class="ihooman-history-empty">Failed to load history</div>'}}()}function T(){q("history"===s?"chat":"history")}function E(e,t){u.statusBar&&("hidden"!==e?(u.statusBar.classList.add("show"),u.statusBar.classList.remove("waiting","connected"),u.statusBar.classList.add(e),t&&(u.statusBar.textContent=t)):u.statusBar.classList.remove("show"))}async function M(){const e=u.ticketName?.value.trim(),t=u.ticketEmail?.value.trim(),o=u.ticketIssue?.value.trim();if(e&&t){u.ticketSubmitBtn&&(u.ticketSubmitBtn.disabled=!0,u.ticketSubmitBtn.textContent="Submitting...");try{const n=await fetch(`${i.serverUrl}/api/widget/submit-ticket`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({widget_id:i.widgetId,session_id:a.sessionId,user_name:e,user_email:t,issue:o||"No description provided"})}),s=await n.json();u.ticketName&&(u.ticketName.value=""),u.ticketEmail&&(u.ticketEmail.value=""),u.ticketIssue&&(u.ticketIssue.value=""),q("chat");I(`✅ Ticket submitted! We'll contact you at ${t}. Reference: #${s.ticket_id?s.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})}u.ticketSubmitBtn&&(u.ticketSubmitBtn.disabled=!1,u.ticketSubmitBtn.textContent="Submit Ticket")}else alert("Please fill in your name and email")}function z(){v||(v=setInterval(async()=>{if(a.sessionId&&r)try{const e=await fetch(`${i.serverUrl}/api/widget/escalation-status/${a.sessionId}?widget_id=${i.widgetId}`);if(e.ok){const t=await e.json();t.escalated&&("in_progress"===t.ticket_status?E("connected","🟢 Connected to live agent"):"open"===t.ticket_status?E("waiting",t.position_in_queue>1?`⏳ Waiting for agent (Position: #${t.position_in_queue})`:"⏳ Waiting for agent..."):"closed"!==t.ticket_status&&"resolved"!==t.ticket_status||(r=!1,B(),E("hidden"),I("This conversation has been closed. Thank you for contacting us!","bot",{is_system_message:!0}),V("escalation:end",{type:"live_agent"})))}}catch{}else B()},3e3))}function B(){v&&(clearInterval(v),v=null)}async function j(){const e=u.surveyView?.querySelector(".ihooman-survey-stars"),t=e?.querySelectorAll(".ihooman-survey-star.active"),o=t?.length||0,n=u.surveyView?.querySelector(".ihooman-survey-comment")?.value;if(0!==o)try{await fetch(`${i.serverUrl}/api/widget/survey-response`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({widget_id:i.widgetId,survey_id:i.surveyConfig?.id,session_id:a.sessionId,rating:o,comment:n})}),k("survey_completed_"+a.sessionId,!0),V("survey:submitted",{rating:o,comment:n}),I(i.surveyConfig?.thankYouMessage||"Thank you for your feedback!","bot",{is_system_message:!0}),q("chat")}catch(e){console.error("Error submitting survey:",e)}else alert("Please select a rating")}function U(){if(!i.showTypingIndicator||!u.messages)return;if(u.messages.querySelector(".ihooman-typing"))return;const e=document.createElement("div");e.className="ihooman-typing",e.innerHTML='<div class="ihooman-typing-dots"><span class="ihooman-typing-dot"></span><span class="ihooman-typing-dot"></span><span class="ihooman-typing-dot"></span></div>',u.messages.appendChild(e),u.messages.scrollTop=u.messages.scrollHeight}function O(){const e=u.messages?.querySelector(".ihooman-typing");e&&e.remove()}function H(){const e=u.input?.value.trim();e&&(D(),u.input&&(u.input.value="",u.input.style.height="auto"),u.sendBtn&&(u.sendBtn.disabled=!0),I(e,"user"),U(),N(e))}function D(){u.presetQuestions&&u.presetQuestions.classList.add("hidden")}async function N(e){if(m&&m.readyState===WebSocket.OPEN)m.send(JSON.stringify({type:"message",content:e}));else try{const t=await fetch(`${i.serverUrl}/api/v1/public/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e,session_id:a.sessionId,visitor_id:a.visitorId,widget_id:i.widgetId})}),o=await t.json();O(),o.session_id&&(a.sessionId=o.session_id,i.persistSession&&k("session_id",a.sessionId)),o.response&&I(o.response,"bot",{sources:o.sources,confidence:o.confidence,escalation_offered:o.escalation_offered,quick_replies:o.quick_replies})}catch(e){O(),I("Sorry, something went wrong. Please try again.","bot"),V("error",e)}}function P(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",a.sessionId||""),n.append("visitor_id",a.visitorId||""),n.append("widget_id",i.widgetId),fetch(`${i.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 Q(){i.proactiveMessages&&0!==i.proactiveMessages.length?(console.debug("[IhoomanChat] Initializing proactive messages:",i.proactiveMessages.length),c=k("shown_proactive")||[],l=k("proactive_cooldowns")||{},d=setInterval(F,5e3),window.addEventListener("scroll",F),document.addEventListener("mouseout",e=>{e.clientY<=0&&function(){if(a.isOpen||!i.proactiveMessages)return;const e=i.proactiveMessages.filter(e=>"exit_intent"===e.trigger.type&&!c.includes(e.id));e.length>0&&Y(e[0])}()})):console.debug("[IhoomanChat] No proactive messages configured")}function F(){if(a.isOpen||!i.proactiveMessages)return;const e=Date.now();for(const t of i.proactiveMessages){if(c.includes(t.id))continue;const o=l[t.id];if(o&&e-o<60*t.cooldownMinutes*1e3)continue;if(t.startDate&&new Date(t.startDate)>new Date)continue;if(t.endDate&&new Date(t.endDate)<new Date)continue;let n=!1;switch(t.trigger.type){case"time":const o="number"==typeof t.trigger.value?t.trigger.value:parseInt(String(t.trigger.value),10);e-(k("page_load_time")||e)>=1e3*o&&(n=!0);break;case"scroll":const i="number"==typeof t.trigger.value?t.trigger.value:parseInt(String(t.trigger.value),10);$()>=i&&(n=!0);break;case"url_pattern":A(String(t.trigger.value))&&(n=!0)}if(n){Y(t);break}}}function Y(e){if(c.push(e.id),l[e.id]=Date.now(),k("shown_proactive",c),k("proactive_cooldowns",l),u.proactiveToast){const t=u.proactiveToast.querySelector(".ihooman-proactive-toast-content");t&&(t.textContent=e.message),u.proactiveToast.classList.add("show"),V("proactive:shown",e),e.autoOpen&&setTimeout(()=>{W(),Z()},3e3)}}function W(){u.proactiveToast&&u.proactiveToast.classList.remove("show")}function R(e){if(!i.serverUrl&&!e)return;let t;if(i.widgetId){const e=i.serverUrl?.replace(/^http/,"ws"),o=new URLSearchParams({widget_id:i.widgetId});a.visitorId&&o.append("visitor_id",a.visitorId),a.sessionId&&o.append("session_id",a.sessionId),t=`${e}/public/ws?${o.toString()}`}else t=e||i.serverUrl?.replace(/^http/,"ws")+"/ws";try{J(),m=new WebSocket(t),m.onopen=()=>{a.isConnected=!0,a.connectionStatus="connected",f=0,K(!0),V("connected"),J(),y=setInterval(()=>{if(m&&m.readyState===WebSocket.OPEN)try{m.send(JSON.stringify({type:"ping"}))}catch{}},25e3)},m.onclose=t=>{if(a.isConnected=!1,a.connectionStatus="disconnected",K(!1),J(),V("disconnected"),b)b=!1;else if(a.isOpen)if(f<5){f++;const t=Math.min(1e3*Math.pow(2,f),3e4);setTimeout(()=>R(e),t)}else G()},m.onerror=e=>{console.error("WebSocket error:",e)},m.onmessage=e=>{try{const t=JSON.parse(e.data);if("connected"===t.type)t.session_id&&(a.sessionId=t.session_id,i.persistSession&&k("session_id",a.sessionId)),t.visitor_id&&(a.visitorId=t.visitor_id,i.persistSession&&k("visitor_id",a.visitorId)),t.welcome_message&&0===a.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,quick_replies:t.quick_replies})}else"typing"===t.type?t.is_typing?U():O():"pong"===t.type||"error"===t.type&&(console.error("WebSocket server error:",t.message),V("error",{message:t.message}))}catch{}}}catch{G()}}function J(){y&&(clearInterval(y),y=null)}function G(){g||(g=setInterval(async()=>{if(a.sessionId)try{const e=await fetch(`${i.serverUrl}/api/messages?session_id=${a.sessionId}&since=${Date.now()-5e3}&widget_id=${i.widgetId}`),t=await e.json();t.messages&&t.messages.forEach(e=>{a.messages.find(t=>t.id===e.id)||I(e.content,e.sender_type,e.metadata)})}catch{}},5e3))}function K(e){u.statusDot&&u.statusDot.classList.toggle("offline",!e),u.statusText&&(u.statusText.textContent=e?"Online":"Offline")}function Z(){a.isOpen||(a.isOpen=!0,a.unreadCount=0,u.badge&&(u.badge.textContent=""),u.toggle&&u.toggle.classList.add("open"),u.window&&u.window.classList.add("open"),W(),setTimeout(()=>u.input?.focus(),300),V("open"))}function X(){if(a.isOpen){if(a.isOpen=!1,u.toggle&&u.toggle.classList.remove("open"),u.window&&u.window.classList.remove("open"),i.surveyConfig&&a.messages.length>=4){a.sessionId&&k("survey_completed_"+a.sessionId)||setTimeout(()=>{a.isOpen||(i.surveyConfig&&(a.sessionId&&k("survey_completed_"+a.sessionId)||a.messages.length<4||(q("survey"),V("survey:shown",i.surveyConfig))),Z())},500)}V("close")}}function ee(){a.isOpen?X():Z()}function te(){a.sessionId=null,a.visitorId=null,a.messages=[],r=!1,k("session_id",null),a.visitorId=x("v_"),k("visitor_id",a.visitorId),u.messages&&(u.messages.innerHTML=""),E("hidden"),B(),f=0,m&&(b=!0,m.close(),m=null),R(),i.welcomeMessage&&I(i.welcomeMessage,"bot"),u.presetQuestions&&u.presetQuestions.classList.remove("hidden"),C(),V("newConversation")}function oe(e){i.title=e.title||i.title,i.subtitle=e.subtitle||i.subtitle,i.welcomeMessage=e.welcomeMessage||i.welcomeMessage,i.placeholder=e.placeholder||i.placeholder,i.position=e.position||i.position,e.theme&&(i.primaryColor=e.theme.primaryColor||i.primaryColor,i.gradientFrom=e.theme.gradientFrom||i.gradientFrom,i.gradientTo=e.theme.gradientTo||i.gradientTo,i.fontFamily=e.theme.fontFamily||i.fontFamily,e.theme.borderRadius&&(i.borderRadius=parseInt(e.theme.borderRadius,10)||i.borderRadius)),e.behavior&&(i.startOpen=e.behavior.startOpen??i.startOpen,i.showTypingIndicator=e.behavior.showTypingIndicator??i.showTypingIndicator,i.showTimestamps=e.behavior.showTimestamps??i.showTimestamps,i.enableSounds=e.behavior.enableSounds??i.enableSounds,i.enableFileUpload=e.behavior.enableFileUpload??i.enableFileUpload,i.persistSession=e.behavior.persistSession??i.persistSession),e.branding&&(i.avatarUrl=e.branding.avatarUrl||i.avatarUrl,i.logoUrl=e.branding.logoUrl||i.logoUrl,i.poweredBy=e.branding.poweredBy??i.poweredBy,i.customCss=e.branding.customCss||i.customCss),e.size&&(i.width=e.size.width||i.width,i.height=e.size.height||i.height,i.buttonSize=e.size.buttonSize||i.buttonSize),e.presetQuestions&&Array.isArray(e.presetQuestions)&&(console.debug("[IhoomanChat] Server config presetQuestions:",e.presetQuestions.length),p=e.presetQuestions.map(e=>({id:e.id,text:e.text,icon:e.icon,emoji:e.icon})),i.presetQuestions=p),e.proactiveMessages&&Array.isArray(e.proactiveMessages)&&(console.debug("[IhoomanChat] Server config proactiveMessages:",e.proactiveMessages.length),i.proactiveMessages=e.proactiveMessages.filter(e=>!1!==e.isActive).map(e=>({id:e.id,message:e.message,trigger:{type:e.trigger.type,value:"time"===e.trigger.type||"scroll"===e.trigger.type?parseInt(e.trigger.value,10)||30:e.trigger.value},autoOpen:e.autoOpen||!1,cooldownMinutes:e.cooldownMinutes||60}))),e.surveyConfig&&!1!==e.surveyConfig.isActive&&(console.debug("[IhoomanChat] Server config surveyConfig:",e.surveyConfig.id),i.surveyConfig={id:e.surveyConfig.id,type:e.surveyConfig.type,question:e.surveyConfig.question,followUpQuestion:e.surveyConfig.followUpQuestion,thankYouMessage:e.surveyConfig.thankYouMessage}),e.buttonStyling&&(console.debug("[IhoomanChat] Server config buttonStyling:",Object.keys(e.buttonStyling)),i.buttonStyling=e.buttonStyling,function(e){const t="ihooman-button-styling";let o=document.getElementById(t);o||(o=document.createElement("style"),o.id=t,document.head.appendChild(o));const n=(e,t)=>{if(!t)return"";const o=t.backgroundColor||"",n=t.textColor||"",i=t.borderColor||"transparent";return`\n ${e} {\n ${o?`background-color: ${o} !important;`:""}\n ${n?`color: ${n} !important;`:""}\n border: ${t.borderWidth||0}px solid ${i} !important;\n border-radius: ${t.borderRadius||8}px !important;\n padding: ${t.paddingVertical||8}px ${t.paddingHorizontal||16}px !important;\n font-size: ${t.fontSize||13}px !important;\n font-weight: ${function(e){switch(e){case"normal":return 400;case"medium":default:return 500;case"semibold":return 600;case"bold":return 700}}(t.fontWeight||"medium")} !important;\n }\n `};let i="";e.primary&&(i+=n(".ihooman-send-btn, .ihooman-proactive-toast-btn.primary, .ihooman-survey-submit",e.primary)),e.secondary&&(i+=n(".ihooman-proactive-toast-btn.secondary, .ihooman-survey-skip, .ihooman-escalation-btn.secondary",e.secondary)),e.presetQuestions&&(i+=n(".ihooman-preset-btn",e.presetQuestions)),e.quickReplies&&(i+=n(".ihooman-quick-reply-btn",e.quickReplies)),e.feedback&&(i+=n(".ihooman-feedback-btn",e.feedback)),e.headerActions&&(i+=n(".ihooman-header-btn",e.headerActions)),e.escalation&&(i+=n(".ihooman-escalation-btn.primary",e.escalation)),e.cardActions&&(i+=n(".ihooman-card-btn",e.cardActions)),o.textContent=i}(e.buttonStyling))}async function ne(e){if(!e.widgetId)return console.error("IhoomanChat: widgetId is required"),null;i={...o,...e},a.visitorId=k("visitor_id")||x("v_"),k("visitor_id",a.visitorId),i.persistSession&&(a.sessionId=k("session_id")),k("page_load_time")||k("page_load_time",Date.now());const n=i.serverUrl||t,s=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."}}}(i.widgetId,n);let r;return s.success&&s.config?(oe(s.config),r=s.chatEndpoint):s.error&&(console.warn("IhoomanChat: Could not fetch server config:",s.error),"Widget not authorized for this domain"===s.error&&console.error("IhoomanChat: Widget configuration error. Please contact support.")),S(),C(),a.messages.forEach(e=>I(e.content,"user"===e.sender?"user":"bot",e.metadata)),0===a.messages.length&&i.welcomeMessage&&I(i.welcomeMessage,"bot"),R(r),Q(),i.startOpen&&setTimeout(Z,500),V("ready"),ie}const ie={init:ne,open:Z,close:X,toggle:ee,isOpen:function(){return a.isOpen},destroy:function(){J(),B(),d&&(clearInterval(d),d=null),window.removeEventListener("scroll",F),b=!0,m&&(m.close(),m=null),g&&(clearInterval(g),g=null),u.widget&&u.widget.remove();const e=document.getElementById("ihooman-widget-styles");e&&e.remove(),a={isOpen:!1,isConnected:!1,messages:[],sessionId:null,visitorId:null,unreadCount:0},u={},f=0,b=!1},sendMessage:function(e){e.trim()&&(u.input&&(u.input.value=e),H())},setUser:function(e){a.userInfo=e,e.name&&k("user_name",e.name),e.email&&k("user_email",e.email),e.metadata&&k("user_metadata",e.metadata)},clearUser:function(){a.userInfo=null,k("user_name",null),k("user_email",null),k("user_metadata",null)},clearHistory:function(){te()},on:function(e,t){h[e]||(h[e]=[]),h[e].push(t)},off:function(e,t){h[e]&&(h[e]=h[e].filter(e=>e!==t))},getState:function(){return{...a}},getConfig:function(){return{...i}},version:"3.0.2"},ae=ie;!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",()=>ne(o)):ne(o)}}(),"undefined"!=typeof window&&(window.IhoomanChat=ae),e.IhoomanChat=ae,e.createWidgetInstance=function(){return{...ie}},e.default=ae,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":["DEFAULT_SERVER_URL","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","presetQuestions","proactiveMessages","surveyConfig","locale","allowLocalhost","icons","chat","close","send","attach","minimize","bot","agent","ticket","history","plus","star","starEmpty","thumbUp","thumbDown","config","widgetId","state","isOpen","isConnected","messages","pendingMessages","sessionId","visitorId","unreadCount","view","connectionStatus","typingIndicator","soundMuted","escalationStatus","userInfo","currentView","isLiveAgentMode","shownProactiveIds","proactiveCooldowns","proactiveCheckInterval","elements","eventListeners","ws","pollInterval","reconnectAttempts","intentionalDisconnect","heartbeatInterval","liveAgentPollInterval","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","getCurrentScrollDepth","scrollTop","window","scrollY","documentElement","scrollHeight","innerHeight","round","matchUrlPattern","pattern","RegExp","replace","test","location","href","includes","createWidget","styleEl","id","isDark","bgColor","textColor","mutedColor","borderColor","inputBg","messageBgUser","messageBgBot","positionRight","positionBottom","generateStyles","head","appendChild","widget","className","question","body","toggle","querySelector","badge","chatView","ticketView","historyView","surveyView","historyList","input","sendBtn","attachBtn","fileInput","statusDot","statusText","statusBar","ticketName","ticketEmail","ticketIssue","ticketSubmitBtn","ticketBackBtn","proactiveToast","addEventListener","handleSendClick","disabled","trim","style","min","shiftKey","preventDefault","click","handleFileSelect","startNewConversation","toggleHistoryView","handleSubmitTicket","showView","historyNewBtn","proactivePrimaryBtn","proactiveSecondaryBtn","hideProactiveToast","open","surveySubmitBtn","surveySkipBtn","handleSurveySubmit","starsContainer","selectedRating","i","dataset","rating","String","updateStars","initializeSurveyStars","setupEventListeners","container","querySelectorAll","index","starEl","classList","add","remove","addMessage","content","sender","metadata","message","timestamp","push","el","showEscalationButtons","escalation_offered","escalationButtonsHtml","quickRepliesHtml","quick_replies","length","map","qr","join","feedbackHtml","date","is_system_message","toLocaleTimeString","hour","minute","handleEscalationAction","btn","hidePresetQuestions","showTyping","sendMessageToServer","feedback","b","async","messageId","feedbackType","fetch","method","headers","widget_id","message_id","session_id","feedback_type","submitFeedback","typing","audio","Audio","volume","play","catch","playSound","renderPresetQuestions","debug","q","icon","emoji","questionText","handlePresetQuestionClick","action","response","visitor_id","json","active","type","queuePosition","position_in_queue","updateStatusBar","startLiveAgentPolling","handleRequestLiveAgent","ok","Error","conversations","conv","preview","message_count","status","diff","getTime","floor","timeAgo","updated_at","stopLiveAgentPolling","connectWebSocket","msg","sender_type","extra_data","loadConversationMessages","switchToConversation","loadConversationHistory","name","email","issue","user_name","user_email","ticket_id","alert","setInterval","escalated","ticket_status","clearInterval","activeStars","comment","survey_id","thankYouMessage","hideTyping","readyState","WebSocket","OPEN","sources","confidence","target","file","files","formData","FormData","append","then","r","initializeProactiveMessages","checkProactiveTriggers","clientY","exitIntentMessages","filter","pm","trigger","showProactiveMessage","checkExitIntentTrigger","lastShown","cooldownMinutes","startDate","endDate","triggered","timeValue","parseInt","scrollValue","autoOpen","setTimeout","chatEndpoint","wsUrl","baseWsUrl","params","URLSearchParams","stopHeartbeat","onopen","updateStatus","onclose","delay","pow","startPolling","onerror","onmessage","welcome_message","agent_name","is_typing","find","m","online","focus","applyServerConfig","serverConfig","behavior","branding","logoUrl","customCss","size","Array","isArray","isActive","followUpQuestion","buttonStyling","Object","keys","styleId","getElementById","generateButtonCSS","selector","bg","backgroundColor","color","borderWidth","paddingVertical","paddingHorizontal","fontSize","weight","getFontWeightValue","fontWeight","css","primary","secondary","quickReplies","headerActions","escalation","cardActions","applyButtonStyling","init","userConfig","configResponse","encodeURIComponent","success","fetchWidgetConfig","warn","publicAPI","destroy","removeEventListener","styles","sendMessage","setUser","user","clearUser","clearHistory","on","off","getState","getConfig","version","IhoomanChat","script","currentScript","scripts","getElementsByTagName","src","getAttribute","autoConfig"],"mappings":"kPAqBA,MAEMA,EAAqB,yBAErBC,EAAuC,CAC3CC,UAAWF,EACXG,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,I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IAAKD,EAAQ,CACX,MAAME,EAAUnV,SAASoV,qBAAqB,UAC9C,IAAK,IAAItO,EAAI,EAAGA,EAAIqO,EAAQ1M,OAAQ3B,IAClC,GAAIqO,EAAQrO,GAAGuO,KAAOF,EAAQrO,GAAGuO,IAAIzS,SAAS,WAAY,CACxDqS,EAASE,EAAQrO,GACjB,KACF,CAEJ,CAEA,IAAKmO,EAAQ,OAEb,MAAMxX,EAAWwX,EAAOK,aAAa,kBACrC,GAAI7X,EAAU,CACZ,MAAM8X,EAA2D,CAAE9X,YAE7D7C,EAAYqa,EAAOK,aAAa,mBAClC1a,IAAW2a,EAAW3a,UAAYA,GAEtC,MAAMC,EAAQoa,EAAOK,aAAa,cACpB,UAAVza,GAA+B,SAAVA,IAAkB0a,EAAW1a,MAAQA,GAE9D,MAAMC,EAAWma,EAAOK,aAAa,iBACjCxa,IAAUya,EAAWza,SAAWA,GAGlB,SADAma,EAAOK,aAAa,qBACZC,EAAW7Z,WAAY,GAErB,YAAxBsE,SAASkO,WACXlO,SAASsF,iBAAiB,mBAAoB,IAAMqO,GAAK4B,IAEzD5B,GAAK4B,EAET,CACD,CAvCD,GAyCsB,oBAAXxT,SACRA,OAA8CiT,YAAcA,uDAjD7D,MAAO,IAAKd,GACd"}
1
+ {"version":3,"file":"index.umd.min.js","sources":["../src/widget.ts"],"sourcesContent":[null],"names":["DEFAULT_SERVER_URL","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","presetQuestions","proactiveMessages","surveyConfig","locale","allowLocalhost","icons","chat","close","send","attach","minimize","bot","agent","ticket","history","plus","star","starEmpty","thumbUp","thumbDown","config","widgetId","state","isOpen","isConnected","messages","pendingMessages","sessionId","visitorId","unreadCount","view","connectionStatus","typingIndicator","soundMuted","escalationStatus","userInfo","currentView","isLiveAgentMode","shownProactiveIds","proactiveCooldowns","proactiveCheckInterval","elements","eventListeners","ws","pollInterval","reconnectAttempts","intentionalDisconnect","heartbeatInterval","liveAgentPollInterval","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","getCurrentScrollDepth","scrollTop","window","scrollY","documentElement","scrollHeight","innerHeight","round","matchUrlPattern","pattern","RegExp","replace","test","location","href","includes","createWidget","styleEl","id","isDark","bgColor","textColor","mutedColor","borderColor","inputBg","messageBgUser","messageBgBot","positionRight","positionBottom","generateStyles","head","appendChild","widget","className","question","body","toggle","querySelector","badge","chatView","ticketView","historyView","surveyView","historyList","input","sendBtn","attachBtn","fileInput","statusDot","statusText","statusBar","ticketName","ticketEmail","ticketIssue","ticketSubmitBtn","ticketBackBtn","proactiveToast","addEventListener","handleSendClick","disabled","trim","style","min","shiftKey","preventDefault","click","handleFileSelect","startNewConversation","toggleHistoryView","handleSubmitTicket","showView","historyNewBtn","proactivePrimaryBtn","proactiveSecondaryBtn","hideProactiveToast","open","surveySubmitBtn","surveySkipBtn","handleSurveySubmit","starsContainer","selectedRating","i","dataset","rating","String","updateStars","initializeSurveyStars","setupEventListeners","container","querySelectorAll","index","starEl","classList","add","remove","addMessage","content","sender","metadata","message","timestamp","push","el","showEscalationButtons","escalation_offered","escalationButtonsHtml","quickRepliesHtml","quick_replies","length","map","qr","join","feedbackHtml","date","is_system_message","toLocaleTimeString","hour","minute","handleEscalationAction","btn","hidePresetQuestions","showTyping","sendMessageToServer","feedback","b","async","messageId","feedbackType","fetch","method","headers","widget_id","message_id","session_id","feedback_type","submitFeedback","typing","audio","Audio","volume","play","catch","playSound","renderPresetQuestions","debug","q","icon","emoji","questionText","handlePresetQuestionClick","action","response","visitor_id","json","active","type","queuePosition","position_in_queue","updateStatusBar","startLiveAgentPolling","handleRequestLiveAgent","ok","Error","conversations","conv","preview","message_count","status","diff","getTime","floor","timeAgo","updated_at","stopLiveAgentPolling","connectWebSocket","msg","sender_type","extra_data","loadConversationMessages","switchToConversation","loadConversationHistory","name","email","issue","user_name","user_email","ticket_id","alert","setInterval","escalated","ticket_status","clearInterval","activeStars","comment","survey_id","thankYouMessage","hideTyping","readyState","WebSocket","OPEN","sources","confidence","target","file","files","formData","FormData","append","then","r","initializeProactiveMessages","checkProactiveTriggers","clientY","exitIntentMessages","filter","pm","trigger","showProactiveMessage","checkExitIntentTrigger","lastShown","cooldownMinutes","startDate","endDate","triggered","timeValue","parseInt","scrollValue","autoOpen","setTimeout","chatEndpoint","wsUrl","baseWsUrl","params","URLSearchParams","stopHeartbeat","onopen","updateStatus","onclose","delay","pow","startPolling","onerror","onmessage","welcome_message","agent_name","is_typing","find","m","online","focus","applyServerConfig","serverConfig","behavior","branding","logoUrl","customCss","size","Array","isArray","isActive","followUpQuestion","buttonStyling","Object","keys","styleId","getElementById","generateButtonCSS","selector","bg","backgroundColor","color","borderWidth","paddingVertical","paddingHorizontal","fontSize","weight","getFontWeightValue","fontWeight","css","primary","secondary","quickReplies","headerActions","escalation","cardActions","applyButtonStyling","init","userConfig","configResponse","encodeURIComponent","success","fetchWidgetConfig","warn","publicAPI","destroy","removeEventListener","styles","sendMessage","setUser","user","clearUser","clearHistory","on","off","getState","getConfig","version","IhoomanChat","script","currentScript","scripts","getElementsByTagName","src","getAttribute","autoConfig"],"mappings":"kPAqBA,MAEMA,EAAqB,yBAErBC,EAAuC,CAC3CC,UAAWF,EACXG,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,I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D,IAAKD,EAAQ,CACX,MAAME,EAAUnV,SAASoV,qBAAqB,UAC9C,IAAK,IAAItO,EAAI,EAAGA,EAAIqO,EAAQ1M,OAAQ3B,IAClC,GAAIqO,EAAQrO,GAAGuO,KAAOF,EAAQrO,GAAGuO,IAAIzS,SAAS,WAAY,CACxDqS,EAASE,EAAQrO,GACjB,KACF,CAEJ,CAEA,IAAKmO,EAAQ,OAEb,MAAMxX,EAAWwX,EAAOK,aAAa,kBACrC,GAAI7X,EAAU,CACZ,MAAM8X,EAA2D,CAAE9X,YAE7D7C,EAAYqa,EAAOK,aAAa,mBAClC1a,IAAW2a,EAAW3a,UAAYA,GAEtC,MAAMC,EAAQoa,EAAOK,aAAa,cACpB,UAAVza,GAA+B,SAAVA,IAAkB0a,EAAW1a,MAAQA,GAE9D,MAAMC,EAAWma,EAAOK,aAAa,iBACjCxa,IAAUya,EAAWza,SAAWA,GAGlB,SADAma,EAAOK,aAAa,qBACZC,EAAW7Z,WAAY,GAErB,YAAxBsE,SAASkO,WACXlO,SAASsF,iBAAiB,mBAAoB,IAAMqO,GAAK4B,IAEzD5B,GAAK4B,EAET,CACD,CAvCD,GAyCsB,oBAAXxT,SACRA,OAA8CiT,YAAcA,uDAjD7D,MAAO,IAAKd,GACd"}
package/cdn/manifest.json CHANGED
@@ -1,24 +1,24 @@
1
1
  {
2
2
  "name": "@ihoomanai/chat-widget",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "majorVersion": "v3",
5
- "fullVersion": "v3.0.3",
6
- "buildDate": "2026-02-03T13:23:23.280Z",
5
+ "fullVersion": "v3.0.4",
6
+ "buildDate": "2026-02-03T13:35:10.089Z",
7
7
  "description": "Universal chat support widget for any website - secure Widget ID based initialization",
8
8
  "files": {
9
9
  "chat.min.js": {
10
- "sri": "sha384-AKmthtXpWE6nQW4jy50vgiHVRh0ffjUeewcL7i32VuCksPDi0daCD6eYxe4Lw5It",
10
+ "sri": "sha384-6Nn1RCdAbwtL1Kqj5CiwTg4G8dlV5M8lJg7GJqf6IkbG6znJ9qjzgPI3/wJefJIE",
11
11
  "urls": {
12
12
  "major": "cdn.ihooman.ai/widget/v3/chat.min.js",
13
- "full": "cdn.ihooman.ai/widget/v3.0.3/chat.min.js",
13
+ "full": "cdn.ihooman.ai/widget/v3.0.4/chat.min.js",
14
14
  "latest": "cdn.ihooman.ai/widget/latest/chat.min.js"
15
15
  }
16
16
  },
17
17
  "chat.js": {
18
- "sri": "sha384-fu1e2C2Y62iohAUuIqExsQoK4op89wCFIbu9T+ZDDssAVlpM/H0p8MPw6YaELn/k",
18
+ "sri": "sha384-V5rxKlLrU8+BMc7pbnFJfwQUxT4iXEtpMpM0DkR0Cggat0anJm+cuDor3CbMnTiW",
19
19
  "urls": {
20
20
  "major": "cdn.ihooman.ai/widget/v3/chat.js",
21
- "full": "cdn.ihooman.ai/widget/v3.0.3/chat.js",
21
+ "full": "cdn.ihooman.ai/widget/v3.0.4/chat.js",
22
22
  "latest": "cdn.ihooman.ai/widget/latest/chat.js"
23
23
  }
24
24
  }
@@ -27,7 +27,7 @@
27
27
  "baseUrl": "https://cdn.ihooman.ai/widget",
28
28
  "versions": {
29
29
  "major": "https://cdn.ihooman.ai/widget/v3/",
30
- "full": "https://cdn.ihooman.ai/widget/v3.0.3/",
30
+ "full": "https://cdn.ihooman.ai/widget/v3.0.4/",
31
31
  "latest": "https://cdn.ihooman.ai/widget/latest/"
32
32
  },
33
33
  "cacheHeaders": {
@@ -36,7 +36,7 @@
36
36
  }
37
37
  },
38
38
  "installation": {
39
- "html": "<script src=\"https://cdn.ihooman.ai/widget/v3.0.3/chat.min.js\"\n integrity=\"sha384-AKmthtXpWE6nQW4jy50vgiHVRh0ffjUeewcL7i32VuCksPDi0daCD6eYxe4Lw5It\"\n crossorigin=\"anonymous\"></script>\n<script>\n IhoomanChat.init({\n widgetId: 'YOUR_WIDGET_ID'\n });\n</script>",
39
+ "html": "<script src=\"https://cdn.ihooman.ai/widget/v3.0.4/chat.min.js\"\n integrity=\"sha384-6Nn1RCdAbwtL1Kqj5CiwTg4G8dlV5M8lJg7GJqf6IkbG6znJ9qjzgPI3/wJefJIE\"\n crossorigin=\"anonymous\"></script>\n<script>\n IhoomanChat.init({\n widgetId: 'YOUR_WIDGET_ID'\n });\n</script>",
40
40
  "htmlLatest": "<script src=\"https://cdn.ihooman.ai/widget/latest/chat.min.js\"></script>\n<script>\n IhoomanChat.init({\n widgetId: 'YOUR_WIDGET_ID'\n });\n</script>"
41
41
  }
42
42
  }
package/cdn/v3/chat.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @ihoomanai/chat-widget v3.0.3
2
+ * @ihoomanai/chat-widget v3.0.4
3
3
  * Universal chat support widget for any website - secure Widget ID based initialization
4
4
  *
5
5
  * @license MIT
@@ -200,8 +200,8 @@
200
200
  return `
201
201
  .ihooman-widget * { box-sizing: border-box; margin: 0; padding: 0; }
202
202
  .ihooman-widget { font-family: ${fontFamily}; font-size: 14px; line-height: 1.5; color: ${textColor}; -webkit-font-smoothing: antialiased; }
203
- .ihooman-widget button { all: unset; box-sizing: border-box; cursor: pointer; font-family: inherit; }
204
- .ihooman-toggle { position: fixed; ${positionRight ? 'right: 20px' : 'left: 20px'}; ${positionBottom ? 'bottom: 20px' : 'top: 20px'}; width: ${buttonSize}px; height: ${buttonSize}px; border-radius: 50% !important; background: linear-gradient(135deg, ${gradientFrom}, ${gradientTo}); border: none; cursor: pointer; z-index: ${zIndex}; 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; }
203
+ .ihooman-widget button:not(.ihooman-toggle) { all: unset; box-sizing: border-box; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; justify-content: center; }
204
+ .ihooman-toggle { position: fixed !important; ${positionRight ? 'right: 20px' : 'left: 20px'}; ${positionBottom ? 'bottom: 20px' : 'top: 20px'}; width: ${buttonSize}px !important; height: ${buttonSize}px !important; border-radius: 50% !important; background: linear-gradient(135deg, ${gradientFrom}, ${gradientTo}) !important; border: none !important; cursor: pointer; z-index: ${zIndex}; display: flex !important; 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; }
205
205
  .ihooman-toggle:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(0, 174, 255, 0.45); }
206
206
  .ihooman-toggle:active { transform: scale(0.95); }
207
207
  .ihooman-toggle::before { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(255,255,255,0.2), transparent); border-radius: 50%; }