@eshal-bot/chat-widget 0.2.33 → 0.2.34

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.
@@ -17,4 +17,4 @@ var Ve={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
17
17
  *
18
18
  * This source code is licensed under the ISC license.
19
19
  * See the LICENSE file in the root directory of this source tree.
20
- */let pt=null;function ht(e){i(()=>{if(!ct||!e)return;const t=e.split(",")[0]?.trim();if(!t||gt.has(t))return;if((e=>{const t=e.trim().toLowerCase();return!t||!!dt.has(t)||ut.some(e=>t.includes(e))})(t))return void gt.add(t);let o=!0;return(async()=>{try{pt||(pt=import("./chat-widget-webfontloader-BK8fca15.esm.js").then(function(e){return e.w}));const e=await pt,r=e&&"default"in e?e.default:e,a=(e=>e.trim().replace(/\s+/g,"+"))(t);r.load({google:{families:[`${a}:300,400,500,600,700`]},fontactive:e=>{o&&gt.add(e)},fontinactive:e=>{o&&gt.add(e),console.warn(`Warning: failed to load Google Font: ${e}`)}})}catch(e){console.error("Warning: WebFont loader error:",e)}})(),()=>{o=!1}},[e])}function mt(e){return"string"==typeof e&&/^https?:\/\//i.test(e)?e:void 0}const bt="__eshalChatWidgetCitationContext",ft="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:void 0,wt=ft?ft[bt]||(ft[bt]=l(null)):l(null);function yt(e){return!!e&&(function(e){return!!e&&String(e.source_id||e.sourceid||"").startsWith("attachment:")}(e)?"string"==typeof e.url&&e.url.length>0:!("string"!=typeof(t=e.url)||!t.includes("/api/v1/sharepoint/file/"))||Boolean(e.source_id));var t}function vt(e,t){return"string"!=typeof e||""===e?"":/^https?:\/\//i.test(e)?e:t?`${String(t).replace(/\/$/,"")}${e.startsWith("/")?"":"/"}${e}`:e}function kt(e){if(!/%[0-9a-f]{2}/i.test(e))return e;try{return decodeURIComponent(e)}catch{return e}}function xt(e){if(!e)return null;const t=/(?:^|;)\s*filename\*\s*=\s*([^;]+)/i.exec(e);if(t){const e=/^\s*"?([^']*)'[^']*'([^"]*)"?\s*$/.exec(t[1]),o=e?function(e,t){try{return/^utf-8$/i.test(e)?decodeURIComponent(t):t.replace(/%([0-9a-f]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16)))}catch{return null}}(e[1],e[2]):null;if(o)return o}const o=/(?:^|;)\s*filename\s*=\s*"((?:[^"\\]|\\.)*)"/i.exec(e);if(o)return kt(o[1].replace(/\\(.)/g,"$1"))||null;const r=/(?:^|;)\s*filename\s*=\s*([^;]+)/i.exec(e);return r&&kt(r[1].trim())||null}function Ct(){return import("./chat-widget-MarkdownRenderer-u47jw-Lf.esm.js")}const St=d(Ct);class Mt extends e.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){console.error("[widget] markdown chunk failed to load, showing plain text:",e)}render(){return this.state.failed?this.props.fallback:this.props.children}}const Tt=/(```|`[^`]+`|(^|\n)\s{0,3}#{1,6}\s|(^|\n)\s*[-*+]\s|(^|\n)\s*\d+\.\s|(^|\n)\s*>\s|\[[^\]]*\]\([^)]*\)|\*\*|__|~~|(^|\n)\s*\||\[\d+\])/;const Ft=({content:e,isDark:t,textColor:o,fontFamily:r,fontSize:a})=>g("p",{className:"leading-relaxed [&:first-child]:!mt-0 whitespace-pre-wrap break-words",style:{color:o||(t?"#f3f4f6":"#1A1A1A"),fontFamily:r||"Inter",fontSize:a||"14px",margin:0,lineHeight:"1.6",padding:0,overflowWrap:"break-word"},children:e}),zt=({content:e,isStreaming:t,isDark:a=!1,isRtl:n=!1,textColor:s,fontFamily:l,fontSize:d,onButtonClick:u,provideCitations:h=!0})=>{const[m,b]=o(""),[f,w]=o(!1),y=r(e),v=r(0),k=r(null),x=r(0);i(()=>{if(e!==y.current){if(y.current=e,v.current>=e.length)return b(e),void w(!1);e.length<m.length&&(v.current=0,b(""))}if(!t)return b(e),w(!1),void(k.current&&cancelAnimationFrame(k.current));w(!0);const o=t=>{if(t-x.current<16)k.current=requestAnimationFrame(o);else if(x.current=t,v.current<e.length){const t=Math.max(2,Math.floor(4*Math.random())),r=Math.min(v.current+t,e.length);b(e.slice(0,r)),v.current=r,k.current=requestAnimationFrame(o)}else w(!1)};return k.current=requestAnimationFrame(o),()=>{k.current&&cancelAnimationFrame(k.current)}},[e,t]);const C="string"==typeof(S=m)&&0!==S.length&&Tt.test(S);var S;return p("div",{className:"relative",dir:"auto",style:{textAlign:n?"right":"left",color:s||(a?"#f3f4f6":"#1A1A1A"),fontFamily:l||"Inter",fontSize:d||"14px",margin:0,padding:0},children:[C?g(Mt,{fallback:g(Ft,{content:m,isDark:a,textColor:s,fontFamily:l,fontSize:d}),children:g(c,{fallback:g(Ft,{content:m,isDark:a,textColor:s,fontFamily:l,fontSize:d}),children:g(St,{content:m,isStreaming:t,isDark:a,isRtl:n,textColor:s,fontFamily:l,fontSize:d,onButtonClick:u,provideCitations:h})})}):g(Ft,{content:m,isDark:a,textColor:s,fontFamily:l,fontSize:d}),f&&g("span",{className:"inline-block w-1.5 h-4 bg-blue-500 ms-0.5 animate-pulse align-text-bottom",style:{animationDuration:"0.8s"}})]})},Pt=({isDark:e,t:t})=>p("div",{className:"flex gap-1.5",role:"status","aria-label":t("agentIsTyping"),children:[g("div",{className:`w-2 h-2 rounded-full ${e?"bg-gray-500":"bg-gray-400"} animate-bounce`,style:{animationDelay:"0ms"},"aria-hidden":"true"}),g("div",{className:`w-2 h-2 rounded-full ${e?"bg-gray-500":"bg-gray-400"} animate-bounce`,style:{animationDelay:"150ms"},"aria-hidden":"true"}),g("div",{className:`w-2 h-2 rounded-full ${e?"bg-gray-500":"bg-gray-400"} animate-bounce`,style:{animationDelay:"300ms"},"aria-hidden":"true"})]}),Lt=({question:e,options:t,onDecision:o,disabled:r,isDark:a=!1})=>p("div",{className:"mt-3 p-3 rounded-lg border "+(a?"bg-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200"),children:[g("p",{className:"text-sm font-medium mb-2 "+(a?"text-gray-100":"text-gray-900"),children:e}),g("div",{className:"space-y-2",children:t.map(e=>g("button",{onClick:()=>o(e.id,e.label),disabled:r,className:"w-full text-left px-3 py-2 text-sm rounded transition-all "+(a?"bg-gray-800 border border-gray-700 hover:bg-blue-900/50 hover:border-blue-600 disabled:opacity-50 disabled:cursor-not-allowed":"bg-white border border-gray-300 hover:bg-blue-50 hover:border-blue-400 disabled:opacity-50 disabled:cursor-not-allowed"),children:e.label},e.id))})]});function At({content:e,isDark:t,t:r}){const i=r?r("copyMessage"):"Copy message",n=r?r("copied"):"Copied",[s,l]=o(!1),c=a(()=>{e&&(navigator.clipboard?.writeText(e).catch(()=>{}),l(!0),setTimeout(()=>l(!1),1500))},[e]);return g("button",{type:"button",onClick:c,className:"p-0.5 rounded transition-colors "+(t?"text-gray-500 hover:text-gray-300":"text-gray-400 hover:text-gray-600"),style:{border:"none",background:"transparent",appearance:"none",WebkitAppearance:"none",cursor:"pointer"},"aria-label":s?n:i,title:s?n:i,children:s?g(He,{className:"w-3 h-3 text-green-500"}):g(Ye,{className:"w-3 h-3"})})}const jt=({message:t,formatTime:i,isDark:n,primaryColor:s,agentMessageBubbleColor:l,resolvedAgentBubbleColor:c,textColor:d,assistantTextColor:u,fontFamily:m,agentMessageBubbleFontFamily:b,agentMessageBubbleFontSize:f,fontSize:w,isRtl:y,onDecision:v,companyLogo:k,conciergeName:x,companyName:C,apiBaseUrl:S,getAuthToken:M,onPromptSuggestionClick:T,allowFeedback:F=!0,provideCitations:z=!0,onFeedback:P,headerTextColor:L,t:A})=>{const j="string"==typeof t.content?t.content:"",N=t.isProcessing&&(!j||0===j.length),R=ee(j,y),[I,B]=o(()=>t?.feedback??null),[E,D]=o(!1),[V,O]=o(null),[$,U]=o(""),q=r(null),H=a(e=>{if(P&&j){if(I===e)return B(null),D(!1),O(null),U(""),void P(j,null);if("like"===e)return B("like"),D(!1),O(null),U(""),void P(j,"like");B(null),O("dislike"),D(!0),U(""),setTimeout(()=>q.current?.focus(),100)}},[I,P,j]),_=a(()=>{P&&j&&V&&(B(V),P(j,V,$.trim()||void 0),D(!1),U(""),O(null))},[P,j,V,$]),W=a(()=>{D(!1),U(""),O(null)},[]),K=!0===t?.isError,Y=K?n?"rgba(239,68,68,0.15)":"#fee2e2":null!=c?c:null!=l?l:n?"#1f2937":"#FFFFFF",Q=null!=l&&"#ffffff"!==l&&"#FFFFFF"!==l&&"#1f2937"!==l,J=K?n?"#fca5a5":"#991b1b":null!=u?u:null!=d?d:n?"#f3f4f6":"#1A1A1A",G=null!=b?b:null!=m?m:"Inter",Z=null!=f?f:null!=w?w:"14px";ht(G);const{onSourceActivate:X,downloadingKey:te}=function({apiBaseUrl:t,getAuthToken:o}){const[r,a]=e.useState(null);return{onSourceActivate:e.useCallback(async e=>{if(!e)return;const r=e.url||e.source_id||e.sourceid||e.source_name||"",i=String(e.source_id||e.sourceid||"").startsWith("attachment:"),n="string"==typeof e.url&&e.url.includes("/api/v1/sharepoint/file/"),s="file"===e.source_type||n||i||!(!e.source_id&&!e.sourceid)&&!e.url;if(!s){const t=mt(e.url);if(t)try{window.open(t,"_blank","noopener,noreferrer")}catch{}return}if(t||i){a(r),console.debug("[widget] citation download starting:",{source_id:e.source_id||e.sourceid,source_name:e.source_name,source_type:e.source_type,isAttachment:i,isSharePointProxy:n,isFileLike:s});try{let r;if(i){if(!e.url)throw new Error("attachment has no URL");const a={};if("function"==typeof o){const e=await o();e&&(a.Authorization=`Bearer ${e}`)}r=await fetch(vt(e.url,t),{method:"GET",headers:a,credentials:"include"})}else if(n){const a=vt(e.url,t),i={};if("function"==typeof o){const e=await o();e&&(i.Authorization=`Bearer ${e}`)}r=await fetch(a,{method:"GET",headers:i,credentials:"include"})}else{const a=`${t.replace(/\/$/,"")}/api/v1/support/file-download`,i={"Content-Type":"application/json"};if("function"==typeof o){const e=await o();e&&(i.Authorization=`Bearer ${e}`)}r=await fetch(a,{method:"POST",headers:i,credentials:"include",body:JSON.stringify({source_id:e.source_id||e.sourceid,file_name:e.url||"",source_name:e.source_name||""})})}if(!r.ok){const e=await r.json().catch(()=>({}));throw new Error(e.details||e.error||r.statusText)}const a=await r.blob(),s=r.headers.get("content-disposition");let l=e.source_name||"download";i||(l=xt(s)||l);const c=document.createElement("a"),d=URL.createObjectURL(a);c.href=d,c.download=l,document.body.appendChild(c),c.click(),c.remove(),URL.revokeObjectURL(d)}catch(e){console.error("[widget] source download failed:",e)}finally{a(null)}}else console.warn("[widget] citation download skipped: apiBaseUrl missing and source is not an attachment (no fallback URL to fetch). Source:",e)},[t,o]),downloadingKey:r}}({apiBaseUrl:S,getAuthToken:M}),oe=e.useMemo(()=>({sources:t.sources||[],sourcesPreliminary:!!t.sourcesPreliminary,onSourceActivate:X,downloadingKey:te,textColor:J,t:A}),[t.sources,t.sourcesPreliminary,X,te,J,A]);return g(wt.Provider,{value:oe,children:p("div",{className:"flex gap-3 flex-row animate-in min-w-0",children:[g("div",{className:"flex-shrink-0 mt-1",children:g("div",{className:"w-8 h-8 rounded-full overflow-hidden flex items-center justify-center",style:{backgroundColor:s||"#2563eb"},children:g("div",k?{className:"w-full h-full bg-white/10 flex items-center justify-center",children:g("img",{src:k,alt:x||C||"Assistant avatar",className:"object-contain rounded-full",style:{width:"100%",height:"100%"}})}:{className:"w-full h-full flex items-center justify-center",style:{fontSize:"18px",fontFamily:m||"Inter",color:L||"#FFFFFF"},children:(x||"A").charAt(0).toUpperCase()})})}),p("div",{className:"flex flex-col items-start min-w-0 max-w-[75%]",children:[g("div",{className:"rounded-2xl px-4 py-2.5 shadow-sm border rounded-tl-sm rtl:rounded-tl-2xl rtl:rounded-tr-sm min-w-0 max-w-full overflow-hidden "+(Q?"border-transparent":n?"border-gray-700":"border-gray-200"),style:{backgroundColor:Y,color:J,fontFamily:G,fontSize:Z,direction:R?"rtl":"ltr",textAlign:R?"right":"left",...Q?{borderColor:`${Y}33`}:{}},children:N?g(Pt,{isDark:n,t:A}):g(h,{children:t.requiresDecision&&t.decisionData&&v?p("div",{children:[j&&g("div",{className:"mb-3",children:g(zt,{content:j,isStreaming:t.isProcessing,isDark:n,isRtl:R,textColor:J,fontFamily:G,fontSize:Z,onButtonClick:T,provideCitations:z})}),g(Lt,{question:t.decisionData.question,options:t.decisionData.options,onDecision:(e,o)=>v(t.decisionData.decisionId,e,o),disabled:!!t.decisionResponse,isDark:n}),t.decisionResponse&&p("div",{className:"mt-2 text-xs "+(n?"text-gray-400":"text-gray-500"),children:["Selected: ",t.decisionResponse.selectedOption]})]}):j?g(h,{children:g(zt,{content:j,isStreaming:t.isProcessing,isDark:n,isRtl:R,textColor:J,fontFamily:G,fontSize:Z,onButtonClick:T,provideCitations:z})}):null})}),p("div",{className:"flex items-center gap-1.5 mt-1.5 px-1",children:[g("p",{className:"text-xs leading-none "+(n?"text-gray-400":"text-gray-500"),dir:"auto",children:i(t.timestamp)}),!N&&!t.isProcessing&&j&&g(At,{content:j,isDark:n,t:A}),!1!==F&&P&&!N&&!t.isProcessing&&j&&"welcome"!==t.type&&!t.isWelcome&&p("div",{className:"flex items-center gap-0.5 ms-0.5",children:[g("button",{type:"button",onClick:()=>H("like"),className:"p-0.5 rounded transition-colors "+("like"===I||"like"===V?"text-green-500":n?"text-gray-500 hover:text-gray-300":"text-gray-400 hover:text-gray-600"),style:{border:"none",background:"transparent",appearance:"none",WebkitAppearance:"none",cursor:"pointer"},"aria-label":A("like"),"aria-pressed":"like"===I,children:g(st,{className:"w-3 h-3"})}),g("button",{type:"button",onClick:()=>H("dislike"),className:"p-0.5 rounded transition-colors "+("dislike"===I||"dislike"===V?"text-red-500":n?"text-gray-500 hover:text-gray-300":"text-gray-400 hover:text-gray-600"),style:{border:"none",background:"transparent",appearance:"none",WebkitAppearance:"none",cursor:"pointer"},"aria-label":A("dislike"),"aria-pressed":"dislike"===I,children:g(nt,{className:"w-3 h-3"})})]})]}),E&&"dislike"===V&&p("div",{className:"mt-2 w-full rounded-xl border p-3 shadow "+(n?"bg-gray-800 border-gray-700":"bg-white border-gray-200"),style:{direction:y?"rtl":"ltr"},children:[g("textarea",{ref:q,value:$,onChange:e=>U(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key?(e.preventDefault(),_()):"Escape"===e.key&&(e.preventDefault(),W())},placeholder:A("feedbackPlaceholder"),"aria-label":A("feedbackPlaceholder"),rows:2,className:"w-full resize-none rounded-lg border px-2 py-1.5 text-xs focus:outline-none focus:ring-1 "+(n?"bg-gray-900 border-gray-700 text-gray-100 placeholder-gray-500 focus:ring-gray-600":"bg-white border-gray-200 text-gray-900 placeholder-gray-400 focus:ring-gray-300"),style:{fontFamily:G,textAlign:y?"right":"left"}}),p("div",{className:"flex items-center justify-end gap-1.5 mt-1.5",children:[g("button",{type:"button",onClick:W,className:"text-xs px-2 py-1 rounded transition-colors "+(n?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),style:{border:"none",background:"transparent",cursor:"pointer"},children:A("cancel")}),g("button",{type:"button",onClick:_,className:"text-xs px-2.5 py-1 rounded text-white transition-opacity hover:opacity-90",style:{backgroundColor:s||"#2563eb",border:"none",cursor:"pointer"},children:A("submit")})]})]})]})]})})},Nt=({message:e,formatTime:t,userMessageBoxColor:o,primaryColor:r,resolvedUserMessageColor:a,textColor:i,userTextColor:n,fontFamily:s,userMessageBubbleFontFamily:l,userMessageBubbleFontSize:c,fontSize:d,isDark:u,isRtl:h,t:m,onRetryMessage:b})=>{const f=null!=a?a:null!=o?o:null!=r?r:"#2563eb",w=null!=n?n:null!=i?i:"#FFFFFF",y=null!=l?l:null!=s?s:"Inter",v=null!=c?c:null!=d?d:"14px",k=ee("string"==typeof e?.content?e.content:"",h);ht(y);const x=Array.isArray(e.attachments)?e.attachments:[];return g("div",{className:"flex gap-3 flex-row-reverse animate-in",children:p("div",{className:"flex flex-col items-end max-w-[75%]",children:[x.length>0&&g("div",{className:"mb-1.5 flex flex-wrap justify-end gap-1.5",children:x.map((e,t)=>String(e.mimeType||"").startsWith("image/")&&e.url?g("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"block rounded-md overflow-hidden",style:{maxWidth:160},title:e.filename,children:g("img",{src:e.url,alt:e.filename||"attachment",style:{maxWidth:160,maxHeight:160,display:"block"}})},e.storageKey||t):p("span",{className:"inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs",style:{backgroundColor:u?"#1f2937":"#f3f4f6",color:u?"#e5e7eb":"#374151",border:"1px solid "+(u?"#374151":"#e5e7eb"),maxWidth:200},title:e.filename,children:[g(Je,{size:12}),g("span",{className:"truncate",style:{maxWidth:140,direction:"ltr"},children:e.filename})]},e.storageKey||t))}),e.content&&""!==e.content.trim()&&g("div",{className:"rounded-2xl px-4 py-2.5 shadow-lg "+(k?"rounded-tl-sm":"rounded-tr-sm"),dir:"auto",style:{background:`linear-gradient(135deg, ${f} 0%, ${f}dd 100%)`,fontFamily:y,direction:k?"rtl":"ltr",textAlign:k?"right":"left"},children:g("p",{className:"whitespace-pre-wrap break-words",dir:"auto",style:{color:w,fontFamily:y,fontSize:v,lineHeight:"1.5",textAlign:k?"right":"left",overflowWrap:"break-word",margin:0,padding:0},children:e.content})}),p("div",{className:"flex items-center gap-1.5 mt-1.5 px-1",children:[g("p",{className:"text-xs leading-none "+(u?"text-gray-400":"text-gray-500"),dir:"auto",children:t(e.timestamp)}),e.content&&""!==e.content.trim()&&g(At,{content:e.content,isDark:u,t:m})]}),"failed"===e.status&&p("div",{className:"flex items-center gap-1.5 mt-1 px-1","data-testid":"message-failed-state",children:[g("span",{className:"text-xs leading-none",style:{color:"#dc2626"},dir:"auto",children:m("messageNotDelivered")}),"function"==typeof b&&g("button",{type:"button",onClick:()=>b(e),className:"text-xs leading-none font-medium underline",style:{color:"#dc2626"},dir:"auto",children:m("retrySend")})]})]})})},Rt=({message:e,isDark:o,primaryColor:r,agentMessageBubbleColor:a,userMessageBoxColor:i,resolvedUserMessageColor:n,resolvedAgentBubbleColor:s,textColor:l,assistantTextColor:c,userTextColor:d,fontFamily:u,agentMessageBubbleFontFamily:p,agentMessageBubbleFontSize:h,userMessageBubbleFontFamily:m,userMessageBubbleFontSize:b,fontSize:f,formatTime:w,isRtl:y,onDecision:v,companyLogo:k,conciergeName:x,companyName:C,apiBaseUrl:S,getAuthToken:M,onPromptSuggestionClick:T,allowFeedback:F,provideCitations:z,onFeedback:P,headerTextColor:L,onRetryMessage:A,defaultLanguage:j="en"})=>{const N=t(()=>re(j),[j]);return e?"user"===e.role?g(Nt,{message:e,formatTime:w,userMessageBoxColor:i,primaryColor:r,resolvedUserMessageColor:n,textColor:l,userTextColor:d,fontFamily:u,userMessageBubbleFontFamily:m,userMessageBubbleFontSize:b,fontSize:f,isDark:o,isRtl:y,t:N,onRetryMessage:A}):g(jt,{message:e,formatTime:w,isDark:o,primaryColor:r,agentMessageBubbleColor:a,resolvedAgentBubbleColor:s,textColor:l,assistantTextColor:c,fontFamily:u,agentMessageBubbleFontFamily:p,agentMessageBubbleFontSize:h,fontSize:f,isRtl:y,onDecision:v,companyLogo:k,conciergeName:x,companyName:C,apiBaseUrl:S,getAuthToken:M,onPromptSuggestionClick:T,allowFeedback:F,provideCitations:z,onFeedback:P,headerTextColor:L,t:N}):null};var It=e.memo(Rt);const Bt=(e,t,o)=>Number.isNaN(e)?t:Math.min(Math.max(e,t),o),Et=e=>{if(!e)return null;const t=(e=>e?.trim().toLowerCase()??"")(e),o=(e=>{const t=e.match(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i);if(!t)return null;let o=t[1];3===o.length&&(o=o.split("").map(e=>`${e}${e}`).join(""));const r=parseInt(o.slice(0,2),16),a=parseInt(o.slice(2,4),16),i=parseInt(o.slice(4,6),16);return[r,a,i].some(e=>Number.isNaN(e))?null:{r:r,g:a,b:i}})(t);if(o)return o;const r=(e=>{const t=e.match(/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(\d*\.?\d+))?\s*\)$/i);return t?{r:Bt(Number.parseInt(t[1],10),0,255),g:Bt(Number.parseInt(t[2],10),0,255),b:Bt(Number.parseInt(t[3],10),0,255)}:null})(t);return r||null},Dt=({r:e,g:t,b:o})=>{const r=e=>{const t=Bt(Math.round(e),0,255).toString(16);return 1===t.length?`0${t}`:t};return`#${r(e)}${r(t)}${r(o)}`},Vt=(e,t,o)=>{const r=Bt(o,0,1);return{r:Math.round(e.r+(t.r-e.r)*r),g:Math.round(e.g+(t.g-e.g)*r),b:Math.round(e.b+(t.b-e.b)*r)}},Ot=(e,t)=>{const o=Bt(t,0,1);return`rgba(${Bt(Math.round(e.r),0,255)}, ${Bt(Math.round(e.g),0,255)}, ${Bt(Math.round(e.b),0,255)}, ${o})`},$t={background:"#f8fafc",hoverBackground:"#f1f5f9",border:"#e2e8f0",hoverBorder:"#cbd5f5",shadow:"0 4px 12px rgba(15, 23, 42, 0.08)",hoverShadow:"0 6px 20px rgba(15, 23, 42, 0.14)"},Ut={background:"#1f2937",hoverBackground:"#27364a",border:"#334155",hoverBorder:"#3b4c63",shadow:"0 4px 12px rgba(15, 23, 42, 0.45)",hoverShadow:"0 6px 20px rgba(15, 23, 42, 0.55)"},qt=(e,t)=>{const o=Et(e);if(!o)return(e=>e?Ut:$t)(t);const r=(({r:e,g:t,b:o})=>{const r=[e,t,o].map(e=>{const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return.2126*r[0]+.7152*r[1]+.0722*r[2]})(o),a=Et("#0f172a")??{r:15,g:23,b:42},i=Et(t?"#f8fafc":"#f9fafb")??{r:249,g:250,b:251},n=Et(t?"#334155":"#e2e8f0")??{r:226,g:232,b:240};let s,l;if(r>=.6){const e=t?.5:.7,r=Math.min(1,e+.15);s=Vt(o,a,e),l=Vt(o,a,r)}else if(r<=.35){const e=t?.9:.8,r=Math.min(1,e+(t?.05:.12));s=Vt(o,i,e),l=Vt(o,i,r)}else{const e=t?.45:.6,r=Math.min(1,e+.1);s=Vt(o,n,e),l=Vt(o,n,r)}const c=Vt(o,s,.65),d=Vt(o,l,.7),u=`0 4px 12px ${Ot(o,t?.28:.12)}`,g=`0 6px 20px ${Ot(o,t?.35:.18)}`;return{background:Dt(s),hoverBackground:Dt(l),border:Dt(c),hoverBorder:Dt(d),shadow:u,hoverShadow:g}},Ht=({questions:e,isDark:t,palette:n,resolvedTextColor:s,fontFamily:l,fontSize:c,isRtl:d,onQuestionClick:u,applyHoverState:h,headingLabel:m,defaultLanguage:b})=>{const f=r(null),[w,y]=o(!1),[v,k]=o(!1),x=a(()=>{const e=f.current;if(!e)return;const{scrollLeft:t,scrollWidth:o,clientWidth:r}=e;y(Math.abs(t)>1),k(Math.abs(t)+r<o-1)},[]);i(()=>{x();const e=f.current;if(!e)return;const t=new ResizeObserver(x);return t.observe(e),()=>t.disconnect()},[x,e]);const C=a(e=>{const t=f.current;if(!t)return;const o="left"===e?-150:150;t.scrollBy({left:d?-o:o,behavior:"smooth"})},[d]),S=t?"rgba(31,41,55,0.85)":"rgba(255,255,255,0.85)",M=t?"#e5e7eb":"#374151",T=t?"#4b5563":"#d1d5db";return p("div",{className:"px-4 py-4 border-t "+(t?"border-gray-700/50":"border-gray-200/60"),children:[p("div",{className:"text-xs mb-3 font-semibold tracking-wide uppercase "+(t?"text-gray-400":"text-gray-500"),children:[m||"Quick questions",":"]}),p("div",{className:"flex items-center gap-1.5",children:[g("button",{onClick:()=>C("left"),disabled:!w,"aria-label":oe(b,"scrollLeft"),className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-full shadow-sm transition-all duration-200 hover:shadow-md active:scale-95",style:{backgroundColor:S,border:`1px solid ${T}`,color:M,backdropFilter:"blur(4px)",opacity:w?1:.35,cursor:w?"pointer":"default"},children:g(_e,{size:16})}),g("div",{ref:f,onScroll:x,className:"flex-1 flex gap-3 overflow-x-auto pb-2",style:{scrollBehavior:"smooth",WebkitOverflowScrolling:"touch",scrollbarWidth:"none",msOverflowStyle:"none"},children:e.map((e,t)=>{const o=ee(e,d);return p("button",{onClick:()=>u?.(e),className:"group relative text-sm px-5 py-2.5 rounded-full font-medium transition-all duration-300 hover:scale-105 active:scale-95 whitespace-nowrap flex-shrink-0 overflow-hidden backdrop-blur-sm "+(o?"text-right":"text-left"),style:{direction:o?"rtl":"ltr",backgroundColor:n.background,border:`1.5px solid ${n.border}`,boxShadow:n.shadow},onMouseEnter:e=>{h(e.currentTarget,!0),e.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:e=>{h(e.currentTarget,!1),e.currentTarget.style.transform="translateY(0)"},children:[g("div",{className:"absolute inset-0 bg-gradient-to-br from-white/0 via-white/5 to-white/10 opacity-0 group-hover:opacity-100 transition-opacity duration-300 rounded-xl"}),g("span",{className:"relative z-10",style:{direction:o?"rtl":"ltr",color:s,fontFamily:l,fontSize:c,textAlign:o?"right":"left"},children:e})]},t)})}),g("button",{onClick:()=>C("right"),disabled:!v,"aria-label":oe(b,"scrollRight"),className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-full shadow-sm transition-all duration-200 hover:shadow-md active:scale-95",style:{backgroundColor:S,border:`1px solid ${T}`,color:M,backdropFilter:"blur(4px)",opacity:v?1:.35,cursor:v?"pointer":"default"},children:g(We,{size:16})})]})]})},_t=({questions:e=[],isDark:o=!1,primaryColor:r="#2563eb",onQuestionClick:a,isTyping:i=!1,layout:n="vertical",fontFamily:s="Inter",fontSize:l="14px",textColor:c,isRtl:d=!1,questionTextColor:u,questionBoxColor:h,resolvedUserMessageColor:m,userMessageBoxColor:b,userTextColor:f,headingLabel:w,defaultLanguage:y="en"})=>{if(!e.length||i)return null;const v=u??c??(o?"#f3f4f6":"#111827"),k=t(()=>qt(v,o),[v,o]);if("horizontal"===n)return g(Ht,{questions:e,isDark:o,palette:k,resolvedTextColor:v,fontFamily:s,fontSize:l,isRtl:d,onQuestionClick:a,applyHoverState:(e,t)=>{e.style.backgroundColor=t?k.hoverBackground:k.background,e.style.borderColor=t?k.hoverBorder:k.border,e.style.boxShadow=t?k.hoverShadow:k.shadow},headingLabel:w,defaultLanguage:y});const x=m??b??r??"#2563eb",C=f??c??"#FFFFFF";return p("div",{style:{paddingInlineStart:"50px"},children:[w?g("div",{className:"mb-2",style:{color:o?"#9ca3af":"#6b7280",fontFamily:s,fontSize:`calc(${l} - 1px)`},children:w}):null,g("div",{className:"flex flex-wrap gap-2",children:e.map((e,t)=>{const o=ee(e,d);return g("button",{onClick:()=>a?.(e),className:"transition-all duration-200 active:scale-[0.97]",style:{direction:o?"rtl":"ltr",fontFamily:s,fontSize:l,color:C,backgroundColor:x,border:"none",borderRadius:"9999px",padding:"5px 14px",fontWeight:500,lineHeight:"1.4",whiteSpace:"normal",textAlign:o?"right":"left"},children:e},t)})})]})},Wt=({active:e=!1,processing:t=!1,deviceId:o,barWidth:a=3,barGap:n=1,barRadius:s=1.5,barColor:l,fadeEdges:c=!0,fadeWidth:d=24,barHeight:u=4,height:h=64,sensitivity:m=1,smoothingTimeConstant:b=.8,fftSize:f=256,historySize:w=60,updateRate:y=30,mode:v="static",onError:k,onStreamReady:x,onStreamEnd:C,className:S,...M})=>{const T=r(null),F=r(null),z=r([]),P=r(null),L=r(null),A=r(null),j=r(0),N=r(0),R=r(null),I=r([]),B=r(0),E=r([]),D=r(!0),V=r(null),O=r(0),$="number"==typeof h?`${h}px`:h;return i(()=>{const e=T.current,t=F.current;if(!e||!t)return;const o=new ResizeObserver(()=>{const o=t.getBoundingClientRect(),r=window.devicePixelRatio||1;e.width=o.width*r,e.height=o.height*r,e.style.width=`${o.width}px`,e.style.height=`${o.height}px`;const a=e.getContext("2d");a&&a.scale(r,r),V.current=null,O.current=o.width,D.current=!0});return o.observe(t),()=>o.disconnect()},[]),i(()=>{if(t&&!e){let e=0;B.current=0;const t=()=>{e+=.03,B.current=Math.min(1,B.current+.02);const o=[],r=Math.floor((F.current?.getBoundingClientRect().width||200)/(a+n));if("static"===v){const t=Math.floor(r/2);for(let a=0;a<r;a++){const r=(a-t)/t,i=1-.4*Math.abs(r),n=(.2+(.25*Math.sin(1.5*e+3*r)+.2*Math.sin(.8*e-2*r)+.15*Math.cos(2*e+r)))*i;let s=n;if(I.current.length>0&&B.current<1){const e=Math.min(a,I.current.length-1);s=(I.current[e]||0)*(1-B.current)+n*B.current}o.push(Math.max(.05,Math.min(1,s)))}}else for(let t=0;t<r;t++){const a=(t-r/2)/(r/2),i=1-.4*Math.abs(a),n=(.2+(.25*Math.sin(1.5*e+.15*t)+.2*Math.sin(.8*e-.1*t)+.15*Math.cos(2*e+.05*t)))*i;let s=n;if(I.current.length>0&&B.current<1){const e=Math.floor(t/r*I.current.length);s=(I.current[e]||0)*(1-B.current)+n*B.current}o.push(Math.max(.05,Math.min(1,s)))}"static"===v?E.current=o:z.current=o,D.current=!0,R.current=requestAnimationFrame(t)};return t(),()=>{R.current&&cancelAnimationFrame(R.current)}}if(!e&&!t){if("static"===v?E.current.length>0:z.current.length>0){let e=0;const t=()=>{e+=.03,e<1?("static"===v?E.current=E.current.map(t=>t*(1-e)):z.current=z.current.map(t=>t*(1-e)),D.current=!0,requestAnimationFrame(t)):"static"===v?E.current=[]:z.current=[]};t()}}},[t,e,a,n,v]),i(()=>{if(!e)return A.current&&(A.current.getTracks().forEach(e=>e.stop()),A.current=null,C?.()),L.current&&"closed"!==L.current.state&&(L.current.close(),L.current=null),void(j.current&&(cancelAnimationFrame(j.current),j.current=0));return(async()=>{try{const e=await navigator.mediaDevices.getUserMedia({audio:o?{deviceId:{exact:o},echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});A.current=e,x?.(e);const t=new(window.AudioContext||window.webkitAudioContext),r=t.createAnalyser();r.fftSize=f,r.smoothingTimeConstant=b;t.createMediaStreamSource(e).connect(r),L.current=t,P.current=r,z.current=[]}catch(e){k?.(e)}})(),()=>{A.current&&(A.current.getTracks().forEach(e=>e.stop()),A.current=null,C?.()),L.current&&"closed"!==L.current.state&&(L.current.close(),L.current=null),j.current&&(cancelAnimationFrame(j.current),j.current=0)}},[e,o,f,b,k,x,C]),i(()=>{const o=T.current;if(!o)return;const r=o.getContext("2d");if(!r)return;let i;const g=p=>{const h=o.getBoundingClientRect();if(e&&p-N.current>y&&(N.current=p,P.current)){const e=new Uint8Array(P.current.frequencyBinCount);if(P.current.getByteFrequencyData(e),"static"===v){const t=Math.floor(.05*e.length),o=Math.floor(.4*e.length),r=e.slice(t,o),i=Math.floor(h.width/(a+n)),s=Math.floor(i/2),l=[];for(let e=s-1;e>=0;e--){const t=Math.floor(e/s*r.length),o=Math.min(1,r[t]/255*m);l.push(Math.max(.05,o))}for(let e=0;e<s;e++){const t=Math.floor(e/s*r.length),o=Math.min(1,r[t]/255*m);l.push(Math.max(.05,o))}E.current=l,I.current=l}else{let t=0;const o=Math.floor(.05*e.length),r=Math.floor(.4*e.length),a=e.slice(o,r);for(let e=0;e<a.length;e++)t+=a[e];const i=t/a.length/255*m;z.current.push(Math.min(1,Math.max(.05,i))),I.current=[...z.current],z.current.length>w&&z.current.shift()}D.current=!0}if(!D.current&&!e)return void(i=requestAnimationFrame(g));D.current=e,r.clearRect(0,0,h.width,h.height);const b=l||getComputedStyle(o).color||"#000",f=a+n,k=Math.floor(h.width/f),x=h.height/2;if("static"===v){const o=t||e||E.current.length>0?E.current:[];for(let e=0;e<k&&e<o.length;e++){const t=o[e]||.1,i=e*f,n=Math.max(u,t*h.height*.8),l=x-n/2;r.fillStyle=b,r.globalAlpha=.4+.6*t,s>0?(r.beginPath(),r.roundRect(i,l,a,n,s),r.fill()):r.fillRect(i,l,a,n)}}else for(let e=0;e<k&&e<z.current.length;e++){const t=z.current.length-1-e,o=z.current[t]||.1,i=h.width-(e+1)*f,n=Math.max(u,o*h.height*.8),l=x-n/2;r.fillStyle=b,r.globalAlpha=.4+.6*o,s>0?(r.beginPath(),r.roundRect(i,l,a,n,s),r.fill()):r.fillRect(i,l,a,n)}if(c&&d>0&&h.width>0){if(!V.current||O.current!==h.width){const e=r.createLinearGradient(0,0,h.width,0),t=Math.min(.3,d/h.width);e.addColorStop(0,"rgba(255,255,255,1)"),e.addColorStop(t,"rgba(255,255,255,0)"),e.addColorStop(1-t,"rgba(255,255,255,0)"),e.addColorStop(1,"rgba(255,255,255,1)"),V.current=e,O.current=h.width}r.globalCompositeOperation="destination-out",r.fillStyle=V.current,r.fillRect(0,0,h.width,h.height),r.globalCompositeOperation="source-over"}r.globalAlpha=1,i=requestAnimationFrame(g)};return i=requestAnimationFrame(g),()=>{i&&cancelAnimationFrame(i)}},[e,t,m,y,w,a,u,n,s,l,c,d,v]),p("div",{className:ge("relative h-full w-full",S),ref:F,style:{height:$},"aria-label":e?"Live audio waveform":t?"Processing audio":"Audio waveform idle",role:"img",...M,children:[!e&&!t&&g("div",{className:"border-muted-foreground/20 absolute top-1/2 right-0 left-0 -translate-y-1/2 border-t-2 border-dotted"}),g("canvas",{className:"block h-full w-full",ref:T,"aria-hidden":"true"})]})},Kt=Object.freeze(["bar","line","area","pie","donut","scatter","bubble","radar","radial-bar","radial","radialbar","treemap","funnel","sankey","composed","waterfall","gauge","histogram","kpi"]);function Yt(e){return String(e||"").trim().toLowerCase().replace(/_/g,"-")}const Qt=/\b(?:field|fields|column|columns|table|tables|sql|summed?|aggregat\w*|averaged?|counted)\b/i,Jt=/[A-Za-z_]\w*\.[A-Za-z_]\w*/;function Gt(e){if("string"!=typeof e)return"";let t,o=e.trim();do{t=o,o=o.replace(/\s*\(([^()]*)\)\s*$/,function(e,t){return Qt.test(t)||Jt.test(t)?"":e}).trim()}while(o!==t);return o}const Zt=new Set(["yes","approve","approved","confirm"]),Xt=new Set(["no","decline","declined","cancel"]),eo=/^[A-Za-z0-9_.:-]{1,128}$/;function to(e){if("string"!=typeof e)return null;const t=e.trim();return eo.test(t)?t:null}function oo(e,t){return null!=e?e:t}function ro(e,t){if(!e||"object"!=typeof e)return null;const o=to(oo(e.tool_call_id,e.toolCallId));if(!o)return null;const r=function(e){if(!e||"object"!=typeof e)return null;if("boolean"==typeof e.approved)return e.approved;const t=String(oo(e.value,"")).trim().toLowerCase();return!!Zt.has(t)||!Xt.has(t)&&null}(t);return null===r?null:{tool_call_id:o,invocation_id:to(oo(e.invocation_id,e.invocationId))||"",approved:r}}const ao=/\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)|(https?:\/\/[^\s<>()]+[^\s<>().,;:!?'"])/g;function io(e){if(!e)return null;const t=String(e),o=[];let r,a=0;for(ao.lastIndex=0;null!==(r=ao.exec(t));){const e=r.index,i=void 0!==r[1]?r[1]:r[3],n=mt(void 0!==r[2]?r[2]:r[3]);n&&(e>a&&o.push({type:"text",value:t.slice(a,e)}),o.push({type:"link",label:i,href:n}),a=e+r[0].length)}return 0===o.length?null:(a<t.length&&o.push({type:"text",value:t.slice(a)}),o)}function no(e){return String(oo(e,"")).trim().toLowerCase()}function so(e,t){if(null==t)return null;const o=no(t);if(!o)return null;const r=e||[];for(let e=0;e<r.length;e+=1){const t=r[e];if(no(t?t.value:void 0)===o||no(t?t.label:void 0)===o)return String(oo(oo(t.value,t.label),""))}return null}function lo(e,t){const o=e||[];for(let e=t+1;e<o.length;e+=1){const t=o[e];if(t&&"user"===t.role&&!t.sendFailed)return"string"==typeof t.content?t.content:String(oo(t.content,""))}}const co=e.createContext(void 0),uo=({messages:e=[],liveJoined:o=[],isDark:n,primaryColor:s,isLoading:l,agentMessageBubbleColor:c,userMessageBoxColor:d,textColor:u,assistantTextColor:m,userTextColor:b,fontFamily:f,agentMessageBubbleFontFamily:w,agentMessageBubbleFontSize:y,userMessageBubbleFontFamily:v,userMessageBubbleFontSize:k,fontSize:x,formatTime:C,isRtl:S=!1,defaultLanguage:M="en",quickQuestions:T=[],shouldShowQuickQuestions:F=!1,onQuickQuestion:P,quickQuestionsLayout:L="vertical",onDecision:A,disclaimerEnabled:j=!1,disclaimerText:N,disclaimerPosition:R="top",disclaimerLinkUrl:I,disclaimerLinkLabel:B,resolvedAgentBubbleColor:E,resolvedUserMessageColor:D,resolvedTextColor:V,isVoiceSessionActive:O=!1,voiceStatus:$="idle",messagesContainerRef:U,companyLogo:q,chatbotAvatarEnabled:H,chatbotAvatar:_,conciergeName:W,companyName:K,apiBaseUrl:Y,getAuthToken:Q,onPromptSuggestionClick:J,conversationResetKey:G,allowFeedback:Z,provideCitations:X,onFeedback:te,headerTextColor:re,onRetryMessage:ae,beforePromptsSlot:ie=null,promptsSlot:ne=null,quickQuestionsHeadingLabel:se})=>{const ce=r(null),de=r(!0),ge=r(!1),pe=t(()=>e.map(e=>`${e.id}:${e.content?.length??0}:${e.isProcessing?1:0}`).join("|"),[e]),he=a(()=>{const e=U?.current;if(!e)return;const t=e.scrollHeight-e.scrollTop-e.clientHeight;de.current=t<160},[U]);i(()=>{const e=U?.current;if(e)return e.addEventListener("scroll",he,{passive:!0}),he(),()=>{e.removeEventListener("scroll",he)}},[he,U]),i(()=>{G&&(de.current=!0,ge.current=!1)},[G]),i(()=>{if(ge.current||0===e.length||"undefined"==typeof window)return;ge.current=!0;let t,o=!1;const r=window.requestAnimationFrame(()=>{o||(t=window.requestAnimationFrame(()=>{o||(ce.current?.scrollIntoView({behavior:"instant",block:"end"}),de.current=!0)}))});return()=>{o=!0,window.cancelAnimationFrame(r),window.cancelAnimationFrame(t)}},[0===e.length]),i(()=>{if(!de.current)return;if("undefined"==typeof window)return;let e=!1;const t=window.requestAnimationFrame(()=>{e||ce.current?.scrollIntoView({behavior:"smooth",block:"end"})});return()=>{e=!0,window.cancelAnimationFrame(t)}},[pe,l]),i(()=>{if(!O||"connected"!==$)return;if("undefined"==typeof window)return;let e=!1;const t=window.requestAnimationFrame(()=>{e||ce.current?.scrollIntoView({behavior:"smooth",block:"end"})});return()=>{e=!0,window.cancelAnimationFrame(t)}},[O,$]);const me=t(()=>ue(I),[I]),be=t(()=>function(e,t=[]){const o=new Map;if(!Array.isArray(e))return o;const r=new Set((Array.isArray(t)?t:[]).map(e=>e?.name).filter(Boolean));for(const t of e){const e=le(t);if(!e||!t.id)continue;const a=!r.has(e);r.add(e),o.set(t.id,{name:e,joined:a})}return o}(e,o),[e,o]),fe=t(()=>function(e,t=[]){const o=new Map,r=Array.isArray(t)?t:[],a=r[r.length-1]?.id;for(const t of Array.isArray(e)?e:[]){if(!t?.name)continue;const e=t.afterMessageId&&r.some(e=>e.id===t.afterMessageId)?t.afterMessageId:a;if(!e)continue;const i=o.get(e)||[];i.push(t.name),o.set(e,i)}return o}(o,e),[o,e]),we=(e,t)=>g("div",{role:"status","data-testid":"agent-joined-line",style:{textAlign:"center",fontSize:"12px",opacity:.7,margin:"8px 0"},children:oe(M,"agentJoinedConversation").replace("{name}",e)},t),ye=t(()=>ee(N,S),[N,S]);return p(h,{children:[j&&N&&"top"===R&&g("div",{className:"flex justify-center",children:g("div",{className:"rounded-lg px-2 py-1 ",style:{color:n?"#d1d5db":"#6b7280",fontFamily:null!=f?f:"Inter",fontSize:null!=x?`calc(${x} - 2px)`:"12px",direction:ye?"rtl":"ltr",textAlign:"center",borderColor:n?"#374151":"#e5e7eb"},children:p("p",{className:"leading-relaxed whitespace-pre-wrap break-words inline",dir:ye?"rtl":"ltr",style:{color:n?"#d1d5db":"#6b7280",fontFamily:null!=f?f:"Inter",fontSize:null!=x?`calc(${x} - 2px)`:"12px"},children:[N,me&&B&&g("a",{href:me,target:"_blank",rel:"noopener noreferrer",title:me,style:{color:n?"#93c5fd":"#2563eb",marginInlineStart:"4px",verticalAlign:"middle",display:"inline-flex",alignItems:"center"},children:B})]})})}),e.map((t,o)=>{const r=be.get(t.id);return p(co.Provider,{value:"assistant"===t.role?lo(e,o):void 0,children:[r?.joined&&we(r.name),r&&g("div",{"data-testid":"agent-sender-name",style:{fontSize:"12px",fontWeight:600,opacity:.8,margin:"0 0 2px 4px",textAlign:S?"right":"left"},children:r.name}),g(It,{message:t,isDark:n,primaryColor:s,agentMessageBubbleColor:c,userMessageBoxColor:d,resolvedUserMessageColor:D,resolvedAgentBubbleColor:E,textColor:u,assistantTextColor:m,userTextColor:b,fontFamily:f,agentMessageBubbleFontFamily:w,agentMessageBubbleFontSize:y,userMessageBubbleFontFamily:v,userMessageBubbleFontSize:k,fontSize:x,formatTime:C,isRtl:ee(t.content,S),onDecision:A,onPromptSuggestionClick:J,companyLogo:H&&_?_:q,conciergeName:W,companyName:K,apiBaseUrl:Y,getAuthToken:Q,allowFeedback:Z,provideCitations:X,onFeedback:te,headerTextColor:re,onRetryMessage:ae,defaultLanguage:M}),(fe.get(t.id)||[]).map(e=>we(e,`live-join-${e}`))]},t.id)}),(()=>{const t=e[e.length-1],o=l&&"user"===t?.role,r=e.some(e=>"assistant"===e.role&&(e.isProcessing||!e.content));return o&&!r?g(It,{message:z(),isDark:n,primaryColor:s,agentMessageBubbleColor:c,resolvedAgentBubbleColor:E,userMessageBoxColor:d,textColor:u,assistantTextColor:m,userTextColor:b,fontFamily:f,agentMessageBubbleFontFamily:w,agentMessageBubbleFontSize:y,userMessageBubbleFontFamily:v,userMessageBubbleFontSize:k,fontSize:x,formatTime:C,isRtl:S,onDecision:A,companyLogo:H&&_?_:q,conciergeName:W,companyName:K,apiBaseUrl:Y,getAuthToken:Q,headerTextColor:re,defaultLanguage:M},"skeleton-waiting"):null})(),ie,ne?g("div",{className:"pt-1",children:ne}):F&&T.length>0&&g("div",{className:"pt-1",children:g(_t,{questions:T,isDark:n,primaryColor:s,onQuestionClick:P,isTyping:l,layout:L,fontFamily:f,fontSize:x,textColor:u,isRtl:S,questionTextColor:m,questionBoxColor:c,resolvedUserMessageColor:D,userMessageBoxColor:d,userTextColor:b,headingLabel:se,defaultLanguage:M})}),O&&"connected"===$&&!l&&g("div",{className:"flex gap-3 flex-row-reverse animate-in",children:g("div",{className:"flex flex-col items-end max-w-[75%] w-full",children:p("div",{className:"rounded-2xl px-4 py-2.5 shadow-lg rounded-tr-sm w-full",style:{background:`linear-gradient(135deg, ${D||s||"#2563eb"} 0%, ${D||s||"#2563eb"}dd 100%)`,width:"100px"},children:[g("span",{className:"sr-only",children:"Listening for voice input"}),g(Wt,{active:!0,barWidth:2,barHeight:4,barGap:2,barColor:b||V||"#FFFFFF",height:20,fadeEdges:!0,className:"min-w-[60px]","aria-hidden":"true"})]})})}),g("div",{ref:ce,className:"h-px"})]})},go=new Set(["size_exceeded","file_too_large","mime_not_allowed"]),po=[["application/pdf","PDF"],["image/jpeg","JPG"],["image/png","PNG"],["image/gif","GIF"],["image/webp","WEBP"],["application/msword","DOC"],["application/vnd.openxmlformats-officedocument.wordprocessingml.document","DOCX"],["application/vnd.ms-excel","XLS"],["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","XLSX"],["text/csv","CSV"],["text/plain","TXT"]];const ho=(e,t)=>e.replace(/\{(\w+)\}/g,(e,o)=>t[o]??""),mo=e=>{const t=Math.max(0,Number(e)||0)/1048576;return String(t>=10?Math.round(t):Math.round(10*t)/10)};function bo(e,t,o={}){const r=String(o.fileUploadMaxSizeMB??"");if("mime_not_allowed"===t.code){const t=function(e){const t=new Set((e||[]).map(e=>String(e).toLowerCase()));return po.filter(([e])=>t.has(e)).map(([,e])=>e).join(", ")}(o.fileUploadAllowedMimes);return ho(e("attachmentTypeNotAllowed"),{types:t||"PDF"})}if("file_too_large"===t.code)return ho(e("attachmentFileTooLarge"),{max_mb:String(o.fileUploadMaxFileMB??r)});const a=Number(t.usedBytes)||0;return a>0?ho(e("attachmentLimitReachedUsed"),{max_mb:r,used_mb:mo(a)}):ho(e("attachmentLimitReached"),{max_mb:r})}function fo(e,t){return String(e||"").replace(/\/+$/,"")+(t.startsWith("/")?t:`/${t}`)}function wo({apiEndpoint:e,conversationId:t,size:o,authHeader:r}){fetch(fo(e,"/api/v1/chat-attachments/release"),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversationId:t,size:o})}).catch(()=>{})}function yo({orgId:e,conversationId:i,config:n,apiEndpoint:s,authHeader:l,onError:c,onRejected:d}){const[u,g]=o([]),p=r(new Map),h=r(0),m=r(u);m.current=u;const b=r({conversationId:i,bytes:0});b.current.conversationId!==i&&(b.current={conversationId:i,bytes:0});const f=a(()=>(h.current+=1,`att-${Date.now()}-${h.current}`),[]),w=a((e,t)=>{g(o=>o.map(o=>o.id===e?{...o,...t}:o))},[]),y=a((e,t,o)=>{if(d&&go.has(t)){const o=m.current.find(t=>t.id===e);return g(t=>t.filter(t=>t.id!==e)),void d({code:t,filename:o?.filename,size:o?.size,usedBytes:Math.max(0,b.current.bytes)})}const r={status:"error",error:{code:t,message:o}};g(t=>{const o=t.map(t=>t.id===e?{...t,...r}:t),a=o.find(t=>t.id===e);return a&&c&&c(a),o})},[c,d]),v=a((e,t)=>{if(!n?.fileUploadEnabled)return{ok:!1,code:"feature_disabled",message:"File uploads are not enabled for this organization."};if(t>=n.fileUploadMaxFiles)return{ok:!1,code:"too_many_files",message:`Max ${n.fileUploadMaxFiles} files per message.`};const o=1024*n.fileUploadMaxSizeMB*1024;if(b.current.bytes+e.size>o){return{ok:!1,code:"size_exceeded",message:`This conversation has already used ${(b.current.bytes/1048576).toFixed(1)} MB of its ${n.fileUploadMaxSizeMB} MB upload limit - this file won't fit.`}}const r=(e.type||"").toLowerCase(),a=new Set((n.fileUploadAllowedMimes||[]).map(e=>String(e).toLowerCase()));return a.size>0&&!a.has(r)?{ok:!1,code:"mime_not_allowed",message:`File type "${e.type||"unknown"}" is not allowed.`}:{ok:!0}},[n]),k=a(async(e,t)=>{let o;try{o=await fetch(fo(s,"/api/v1/chat-attachments/presign"),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",...l?{Authorization:l}:{}},body:JSON.stringify({filename:t.name,mimeType:t.type,size:t.size,conversationId:i})})}catch(o){return b.current.bytes=Math.max(0,b.current.bytes-t.size),void y(e,"network","Network error while requesting upload.")}if(!o.ok){let r="Upload rejected by the server.",a="unknown";try{const e=await o.json();e?.error&&(r=e.error),e?.code&&(a=function(e){switch(e){case"feature_disabled":case"size_exceeded":case"mime_not_allowed":case"storage_unavailable":case"file_too_large":return e;case"session_exceeded":return"size_exceeded";default:return"unknown"}}(e.code))}catch{}return b.current.bytes=Math.max(0,b.current.bytes-t.size),void y(e,a,r)}let r=0;const a=()=>{r>0&&(wo({apiEndpoint:s,conversationId:i,size:r,authHeader:l}),r=0,w(e,{reservedBytes:0}))},n=()=>{b.current.bytes=Math.max(0,b.current.bytes-t.size)};let c;try{c=await o.json()}catch{return wo({apiEndpoint:s,conversationId:i,size:t.size,authHeader:l}),n(),w(e,{reservedBytes:0}),void y(e,"unknown","Malformed presign response.")}let d,u;("boolean"==typeof c.reserved?c.reserved:!c.useMultipart)&&(r=t.size,w(e,{reservedBytes:t.size}));try{if(c.useMultipart){const o=await function({url:e,file:t,conversationId:o,authHeader:r,onProgress:a,registerXhr:i}){return new Promise((r,n)=>{const s=new XMLHttpRequest;i(s),s.open("POST",e,!0),s.withCredentials=!0;const l=new FormData;l.append("conversationId",o),l.append("file",t,t.name),s.upload.onprogress=e=>{e.lengthComputable&&a(Math.round(e.loaded/e.total*100))},s.onload=()=>{if(s.status>=200&&s.status<300)try{const e=JSON.parse(s.responseText);r({url:"string"==typeof e?.url?e.url:void 0,storageKey:"string"==typeof e?.storageKey?e.storageKey:void 0})}catch{r({})}else n(new Error(`upload_status_${s.status}`))},s.onerror=()=>n(new Error("network")),s.onabort=()=>n({aborted:!0}),s.send(l)})}({url:fo(s,"/api/v1/chat-attachments/multipart"),file:t,conversationId:i,authHeader:l,onProgress:t=>w(e,{progress:t}),registerXhr:t=>p.current.set(e,t)});d=o.url,u=o.storageKey,r=t.size,w(e,{reservedBytes:t.size})}else{if(!c.uploadUrl)throw new Error("presign_missing_target");{await function({url:e,file:t,onProgress:o,registerXhr:r}){return new Promise((a,i)=>{const n=new XMLHttpRequest;r(n),n.open("PUT",e,!0),n.setRequestHeader("x-ms-blob-type","BlockBlob"),t.type&&n.setRequestHeader("Content-Type",t.type),n.upload.onprogress=e=>{e.lengthComputable&&o(Math.round(e.loaded/e.total*100))},n.onload=()=>{n.status>=200&&n.status<300?a():i(new Error(`upload_status_${n.status}`))},n.onerror=()=>i(new Error("network")),n.onabort=()=>i({aborted:!0}),n.send(t)})}({url:c.uploadUrl,file:t,onProgress:t=>w(e,{progress:t}),registerXhr:t=>p.current.set(e,t)});const o=await async function({apiEndpoint:e,storageKey:t,filename:o,mimeType:r,authHeader:a}){let i;try{i=await fetch(fo(e,"/api/v1/chat-attachments/confirm"),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",...a?{Authorization:a}:{}},body:JSON.stringify({storageKey:t,filename:o,mimeType:r})})}catch{return{ok:!1,code:"network",message:"Network error while verifying upload."}}if(i.ok)return{ok:!0};let n="Upload rejected - file content did not match its declared type.",s="content_mismatch";try{const e=await i.json();e?.error&&(n=e.error),"password_protected"===e?.code&&(s="password_protected")}catch{}return{ok:!1,code:s,message:n}}({apiEndpoint:s,storageKey:c.storageKey,filename:t.name,mimeType:t.type,authHeader:l});if(!o.ok)return p.current.delete(e),a(),n(),void y(e,o.code,o.message)}}}catch(t){if(p.current.delete(e),t&&t.aborted)return;return a(),n(),void y(e,"network","Upload failed. Please retry.")}p.current.delete(e),w(e,{status:"ready",progress:100,storageKey:u||c.storageKey,...d?{url:d}:{}})},[s,l,i,y,w]),x=a(async e=>{const t=Array.from(e);for(const e of t){const t=m.current.filter(e=>"error"!==e.status).length,o=v(e,t),r=f();if(!o.ok&&d&&go.has(o.code)){d({code:o.code,filename:e.name,size:e.size,usedBytes:Math.max(0,b.current.bytes)});continue}if(!o.ok){const t={id:r,filename:e.name,size:e.size,mimeType:e.type,status:"error",error:{code:o.code,message:o.message}};g(e=>(c&&c(t),[...e,t]));continue}const a={id:r,filename:e.name,size:e.size,mimeType:e.type,status:"uploading",progress:0,reservedBytes:0};g(e=>[...e,a]),b.current.bytes+=e.size,k(r,e)}},[v,k,f,c,d]),C=a(e=>{const t=p.current.get(e);t&&(t.abort(),p.current.delete(e));const o=m.current.find(t=>t.id===e);o&&o.reservedBytes>0&&(wo({apiEndpoint:s,conversationId:i,size:o.reservedBytes,authHeader:l}),b.current.bytes=Math.max(0,b.current.bytes-o.reservedBytes)),g(t=>t.filter(t=>t.id!==e))},[s,l,i]),S=a(()=>{for(const e of p.current.values())e.abort();p.current.clear(),g([])},[]),M=t(()=>u.some(e=>"validating"===e.status||"uploading"===e.status),[u]),T=a(()=>u.filter(e=>"ready"===e.status&&"string"==typeof e.storageKey).map(e=>({filename:e.filename,mimeType:e.mimeType,size:e.size,storageKey:e.storageKey,url:e.url})),[u]);return{attachments:u,addFiles:x,removeAttachment:C,clearAll:S,isBusy:M,toSendPayload:T}}function vo(e){if(!e||e<1024)return`${e||0} B`;const t=["KB","MB","GB"];let o=e/1024,r=0;for(;o>=1024&&r<t.length-1;)o/=1024,r+=1;return`${o.toFixed(o>=10?0:1)} ${t[r]}`}function ko({attachment:e,onRemove:t,isDark:o,removeLabel:r="Remove attachment"}){const a="error"===e.status,i="uploading"===e.status,n="ready"===e.status,s=a?o?"rgba(239,68,68,0.15)":"#fee2e2":o?"#1f2937":"#f3f4f6",l=a?o?"#b91c1c":"#fca5a5":o?"#374151":"#e5e7eb",c=a?o?"#fca5a5":"#b91c1c":o?"#e5e7eb":"#374151",d=a?`${e.filename} - ${e.error?.message||"error"}`:i?`${e.filename} - uploading`:`${e.filename} - ready`;return p("div",{className:"inline-flex items-center gap-2 rounded-full pl-2 pr-1 py-1 text-xs",style:{backgroundColor:s,border:`1px solid ${l}`,color:c,maxWidth:240},role:"group",title:a?e.error?.message:e.filename,"aria-label":d,children:[a?g(Ke,{size:12,"aria-hidden":"true"}):i?g(Ge,{size:12,className:"animate-spin","aria-hidden":"true"}):g(Je,{size:12,"aria-hidden":"true"}),g("span",{className:"truncate",style:{maxWidth:140,direction:"ltr"},children:e.filename}),n&&g("span",{className:"opacity-70 text-chip",children:vo(e.size)}),i&&"number"==typeof e.progress&&p("span",{className:"opacity-70 text-chip",children:[e.progress,"%"]}),g("button",{type:"button",onClick:()=>t(e.id),className:"w-4 h-4 rounded-full inline-flex items-center justify-center",style:{backgroundColor:"transparent",border:"none",color:c,cursor:"pointer"},"aria-label":r,children:g(lt,{size:12})})]})}function xo({prompts:t,getDisplayText:o,detectDirection:r,ambientIsRtl:a,wrapperProps:i,stackProps:n,getKey:s,getChipProps:l,onChipClick:c,onSelect:d,before:u,after:g}){const p=e.createElement("div",n,t.map((t,i)=>{const n=o(t),u=r(n,a);return e.createElement("button",{key:s(t,i),type:"button",...l({prompt:t,index:i,displayText:n,chipIsRtl:u}),onClick:e=>{c&&c(t,i),d(t,i,e)}},n)}));return null==u&&null==g?e.createElement("div",i,p):e.createElement("div",i,u,p,g)}const Co=({suggestions:e,onSuggestionClick:t,promptPrimary:o,promptTextColor:r,promptFontFamily:a,promptFontSize:i,isRtl:n,t:s,questionDisplay:l=!0})=>g(xo,{prompts:e,getDisplayText:e=>((e,t=!0)=>{if(!e||"string"==typeof e)return e||"";const o="string"==typeof e.text?e.text:"";if(!t)return o;const r="string"==typeof e.submitText?e.submitText.trim():"";return r&&r!==o?r:o})(e,l),detectDirection:ee,ambientIsRtl:n,wrapperProps:{className:"mb-2 px-5"},stackProps:{className:"flex flex-col gap-2",role:"group","aria-label":s("suggestedQuestions")},getKey:(e,t)=>`${e.text||e}-${t}`,getChipProps:({chipIsRtl:e})=>({dir:e?"rtl":"ltr",className:"block w-full rounded-2xl px-4 py-2 border-0 transition-transform duration-150 active:scale-[0.99] "+(e?"text-right":"text-left"),style:{direction:e?"rtl":"ltr",textAlign:e?"right":"left",background:`linear-gradient(135deg, ${o} 0%, ${o}dd 100%)`,color:r,fontFamily:a,fontSize:i}}),onSelect:(e,o)=>t(e.submitText||e.text||e,e,o)}),So=({onStopGeneration:e,inputValue:n,setInputValue:s,onSend:l,isDark:c,primaryColor:d,isOpen:u,isMinimized:b,isLoading:f,isConversationLoading:w=!1,placeholder:y,textColor:v,fontFamily:k,fontSize:x,isRtl:C=!1,csatVisible:S=!1,enableVoiceInteraction:M=!1,isVoiceSessionActive:T=!1,voiceStatus:F="idle",voiceError:z=null,onVoiceToggle:P,onBidiSubmit:L,disclaimerEnabled:A=!1,disclaimerText:j,disclaimerPosition:N="top",disclaimerLinkUrl:R,disclaimerLinkLabel:I,showPoweredBy:B=!0,onboardingQuestions:E=[],onboardingActive:D=!1,onboardingCompleted:V=!1,userMessageBubbleFontFamily:O,onboardingEnabled:$=!1,userMessageBubbleFontSize:U,userMessageBoxColor:q,resolvedUserMessageColor:H,userTextColor:K,promptSuggestions:Y,onPromptSuggestionClick:Q,autoPromptQuestionDisplay:G=!0,tagSelectorNode:Z=null,showResolveButton:X=!1,onResolve:te,defaultLanguage:oe="en",chatFeatures:ae,apiEndpoint:ie,organizationId:ne,conversationId:se,onSynthesizeAssistantMessage:le})=>{const ce=t(()=>re(oe),[oe]),de=t(()=>function(e){const t=J(e),o=W[t]||_;return{beforeBrand:o.poweredByBefore??o.poweredBy??_.poweredByBefore,afterBrand:o.poweredByAfter??""}}(oe),[oe]),pe=t(()=>ee(n,C),[n,C]),[he,me]=o(!1),[be,fe]=o(!1),we=t(()=>({fileUploadEnabled:ae?.fileUploadEnabled??!1,fileUploadMaxSizeMB:ae?.fileUploadMaxSizeMB??10,fileUploadMaxFiles:ae?.fileUploadMaxFiles??3,fileUploadAllowedMimes:ae?.fileUploadAllowedMimes??[]}),[ae]),{attachments:ye,addFiles:ve,removeAttachment:ke,clearAll:xe,isBusy:Ce,toSendPayload:Se}=yo({orgId:ne,conversationId:se,config:we,apiEndpoint:ie,authHeader:void 0,onRejected:le?e=>le(bo(ce,e,{...we,fileUploadMaxFileMB:ae?.fileUploadMaxFileMB??25})):void 0}),Me=r(null),Te=r(new Set);i(()=>{if(!T||!se||!ie)return;const e=Se().filter(e=>e.storageKey&&!Te.current.has(e.storageKey));e.length&&(e.forEach(e=>Te.current.add(e.storageKey)),fetch(`${String(ie).replace(/\/$/,"")}/api/v1/chat-attachments/ingest`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversationId:se,attachments:e.map(e=>({storageKey:e.storageKey}))})}).catch(()=>{}))},[T,se,ie,ye,Se]);const Fe=!!we.fileUploadEnabled&&!!ie,ze=ye.length>=we.fileUploadMaxFiles,Pe=`Max ${we.fileUploadMaxFiles} files per message.`,Le=t(()=>we.fileUploadAllowedMimes.length>0?we.fileUploadAllowedMimes.join(","):void 0,[we.fileUploadAllowedMimes]),[Ae,je]=o({top:0,left:0,placement:"top",arrowOffset:0}),[Ne,Re]=o(!1),Ie=r(null),Be=r(null),Ee=r(null),De=r(null);ht(k),ht(O),i(()=>{u&&!b&&Be.current?.focus()},[u,b]),i(()=>{const e=Be.current;if(e){e.style.height="auto";const t=e.scrollHeight,o=n.trim().length>0?20:48,r=Math.max(o,Math.min(t,120));e.style.height=`${r}px`}},[n]);const Ve=a(()=>{const e=Se();e.length>0?(l(void 0,e),xe()):l()},[Se,xe,l]),Oe=ye.some(e=>"ready"===e.status),$e=!n.trim()&&!Oe||f||w||Ce,Ue=c?"#374151":"#e5e7eb",He=E&&E.length>0,_e=S||w||$&&(He&&!V)||"connecting"===F,We=S?ce("pleaseSubmitRatingFirst"):He?D?ce("completeOnboardingToEnableVoice"):V?"":ce("sendMessageToCompleteOnboarding"):"",Ke=()=>{if(!Ee.current)return;const e=Ee.current.getBoundingClientRect(),t=220,o=e.top,r=window.innerHeight-e.bottom;let a="top",i=0,n=0;o>=73?(a="top",i=e.top-60-5-8,n=e.right-t,n<10&&(n=10),n+t>window.innerWidth-10&&(n=window.innerWidth-t-10)):r>=68?(a="bottom",i=e.bottom+8,n=e.right-t,n<10&&(n=10),n+t>window.innerWidth-10&&(n=window.innerWidth-t-10)):(a="top",i=Math.max(10,e.top-60-5-8),n=e.right-t,n<10&&(n=10),n+t>window.innerWidth-10&&(n=window.innerWidth-t-10));return{top:i,left:n,placement:a,arrowOffset:e.left+e.width/2-n}};i(()=>{if(be&&We){const e=()=>{const e=Ke();je(e)};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}}},[be,We]),i(()=>()=>{Ie.current&&clearTimeout(Ie.current)},[]);const Ye=null!=H?H:null!=q?q:null!=d?d:"#2563eb",Qe=null!=K?K:null!=v?v:"#FFFFFF",Je=null!=O?O:null!=k?k:"Inter",Ze=null!=U?U:null!=x?x:null,Xe=Ze?`calc(${Ze} - 2px)`:"12px",tt=ue(R);return p("div",{className:"py-4 flex-shrink-0 relative "+(c?"bg-gray-900":"bg-white"),style:{overflow:"visible"},children:[Z||Y.length>0&&Q&&g(Co,{suggestions:Y,onSuggestionClick:Q,questionDisplay:G,promptPrimary:Ye,promptTextColor:Qe,promptFontFamily:Je,promptFontSize:Xe,isRtl:C,t:ce}),g("div",{className:"my-4",style:{height:"1px",backgroundColor:Ue}}),Fe&&ye.length>0&&g("div",{className:"px-5 mb-2 flex flex-wrap gap-1.5",children:ye.map(e=>g(ko,{attachment:e,onRemove:ke,isDark:c,removeLabel:ce("removeAttachment")},e.id))}),p("div",{className:"flex items-center px-5 gap-1.5",children:[Fe&&g("input",{ref:Me,type:"file",multiple:!0,accept:Le,"aria-label":ce("uploadFile"),className:"hidden",style:{display:"none"},onChange:e=>{const t=e.target.files;t&&t.length&&!ze&&ve(t),e.currentTarget.value=""}}),p("div",{className:`flex-1 flex items-center gap-1 px-1 min-h-[48px] ${c?"bg-gray-800":"bg-gray-50"} rounded-2xl transition-all duration-200`,style:{borderStyle:"solid",borderColor:n&&n.trim().length>0?d||"#2563eb":Ue,borderWidth:n&&n.trim().length>0?"2px":"1px"},children:[Fe&&p("div",{className:"relative group shrink-0",children:[g("button",{type:"button",onClick:()=>Me.current&&Me.current.click(),disabled:S||w||f||ze,"aria-label":ze?Pe:"Attach file",title:ze?Pe:"Attach file",className:`h-8 w-8 rounded-lg flex items-center justify-center transition-colors duration-200 ${c?"text-gray-300 hover:bg-gray-700":"text-gray-500 hover:bg-gray-200"} disabled:opacity-40 disabled:cursor-not-allowed`,style:{border:"none"},children:g(et,{className:"w-4 h-4"})}),ze&&g("div",{role:"tooltip",className:"pointer-events-none absolute bottom-full left-1/2 -translate-x-1/2 mb-2 opacity-0 group-hover:opacity-100 transition-opacity px-3 py-1.5 text-xs rounded-lg whitespace-nowrap shadow-lg "+(c?"bg-gray-700 text-gray-100":"bg-gray-800 text-white"),children:Pe})]}),g("div",{className:"relative flex-1 flex items-center min-w-0",children:g("textarea",{id:"chat-widget-input",ref:Be,"aria-label":y||ce("typeYourMessage"),value:n,onChange:e=>{s(e.target.value)},onFocus:()=>me(!0),onBlur:()=>me(!1),onKeyDown:e=>{if("Enter"===e.key&&!e.shiftKey){if(e.preventDefault(),T&&L&&!Oe)return void L();if($e)return;Ve()}},placeholder:w?ce("agentIsLoading"):y||ce("typeYourMessage"),rows:1,disabled:S||w||f||T&&"connected"!==F,dir:pe?"rtl":"ltr",className:`w-full px-3 bg-transparent rounded-xl leading-normal ${c?"text-gray-100":"text-gray-900"} placeholder-gray-400 resize-none outline-none scrollbar-hide break-words`,style:{height:"auto",maxHeight:"120px",minHeight:"48px",paddingTop:n.trim().length>0?"12px":"0px",paddingBottom:n.trim().length>0?"12px":"0px",lineHeight:n.trim().length>0?"1.4":"48px",fontFamily:O||k||"Inter",fontSize:x||"14px",color:c?"#F3F4F6":"#1F2937",textAlign:pe?"right":"left",direction:pe?"rtl":"ltr",wordSpacing:"0",letterSpacing:"0"}})}),M&&p("div",{className:"relative shrink-0",onMouseEnter:()=>{if(_e&&We){Ie.current&&(clearTimeout(Ie.current),Ie.current=null);const e=Ke();je(e),fe(!0)}},onMouseLeave:()=>{Ie.current&&(clearTimeout(Ie.current),Ie.current=null),fe(!1)},children:[g("button",{style:{border:"none"},ref:Ee,type:"button",onClick:P,"aria-label":ce(T?"stopVoiceInput":"startVoiceInput"),className:`h-8 w-8 rounded-lg flex items-center justify-center transition-colors duration-200 ${T?"bg-red-500 text-white hover:bg-red-600":c?"text-gray-300 hover:bg-gray-700":"text-gray-500 hover:bg-gray-200"} ${_e?"opacity-60 cursor-not-allowed":""}`,disabled:_e,children:"connecting"===F?g(Ge,{className:"w-4 h-4 animate-spin"}):g(qe,{className:"w-4 h-4"})}),be&&We&&"undefined"!=typeof document&&m(p("div",{ref:De,className:"px-3 py-1.5 text-xs shadow-md pointer-events-none",style:{position:"fixed",top:`${Ae.top}px`,left:`${Ae.left}px`,maxWidth:"220px",whiteSpace:"normal",wordWrap:"break-word",minWidth:"180px",zIndex:999999,backgroundColor:c?"#1f2937":"#ffffff",color:c?"#f3f4f6":"#111827",border:c?"1px solid #374151":"1px solid #e5e7eb",borderRadius:"top"===Ae.placement?"6px 6px 6px 6px":"6px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",overflow:"visible"},children:[g("div",{className:"text-left leading-relaxed",children:We}),"top"===Ae.placement&&p(h,{children:[g("div",{style:{position:"absolute",top:"100%",left:`${Ae.arrowOffset}px`,transform:"translateX(-50%)",width:0,height:0,borderLeft:"6px solid transparent",borderRight:"6px solid transparent",borderTop:c?"6px solid #374151":"6px solid #e5e7eb",pointerEvents:"none"}}),g("div",{style:{position:"absolute",top:"100%",left:`${Ae.arrowOffset}px`,transform:"translateX(-50%)",marginTop:"-1px",width:0,height:0,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderTop:c?"5px solid #1f2937":"5px solid #ffffff",pointerEvents:"none"}})]}),"bottom"===Ae.placement&&p(h,{children:[g("div",{className:"absolute bottom-full",style:{left:`${Ae.arrowOffset}px`,transform:"translateX(-50%)",width:0,height:0,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderBottom:c?"5px solid #374151":"5px solid #e5e7eb"}}),g("div",{className:"absolute bottom-full -mb-px",style:{left:`${Ae.arrowOffset}px`,transform:"translateX(-50%)",width:0,height:0,borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderBottom:c?"4px solid #1f2937":"4px solid #ffffff"}})]})]}),document.body)]})]}),g("button",f&&!T&&"function"==typeof e?{onClick:e,className:"h-10 w-10 flex-shrink-0 rounded-xl transition-all duration-200 flex items-center justify-center shadow-md scale-100",style:{backgroundColor:d,color:"white",border:"none"},"aria-label":ce("stopGenerating"),children:g(rt,{className:"w-3.5 h-3.5",fill:"currentColor"})}:{onClick:T&&L&&!Oe?L:Ve,disabled:S||$e||T&&"connected"!==F,className:"h-10 w-10 flex-shrink-0 rounded-xl transition-all duration-200 flex items-center justify-center shadow-md disabled:opacity-40 disabled:cursor-not-allowed disabled:shadow-none "+(n.trim()?"scale-100":"scale-95"),style:{backgroundColor:n.trim()?d:c?"#374151":"#e5e7eb",color:n.trim()?"white":"#9ca3af",border:"none"},"aria-label":ce("sendMessage"),children:g(ot,{className:"w-4 h-4 transition-transform",style:C?{transform:"rotate(-90deg)"}:void 0})})]}),T&&p("p",{"aria-live":"polite",className:`text-xs mt-2 px-5 ${"connected"===F?"text-status-success":"text-gray-500"} flex items-center gap-1`,children:[g("span",{className:"w-1.5 h-1.5 rounded-full bg-current inline-flex"}),ce("connected"===F?"voiceSessionLive":"connectingVoice")]}),z&&g("p",{role:"alert",className:"text-xs mt-1 px-5 text-status-error",children:ce(z)===z?ce("voiceUnavailable"):ce(z)}),A&&j&&"footer"===N&&p("p",{className:"text-xs mt-2 px-5 text-center",style:{color:c?"#d1d5db":"#6b7280",fontFamily:k||"Inter",fontSize:x?`calc(${x} - 2px)`:"12px",direction:C?"rtl":"ltr"},dir:C?"rtl":"ltr",children:[j,tt&&I&&g("a",{href:tt,target:"_blank",rel:"noopener noreferrer",title:tt,style:{color:c?"#93c5fd":"#2563eb",marginInlineStart:"4px",verticalAlign:"middle",display:"inline-flex",alignItems:"center"},children:I})]}),B&&g("div",{className:"mt-1.5 flex justify-center",children:g("a",{href:"https://eshal.ai",target:"_blank",rel:"noopener noreferrer",className:"no-underline",children:p("span",{dir:"ltr",className:"inline-flex items-center gap-1.5 py-1.5 px-3",children:[de.beforeBrand&&g("span",{className:ge("font-sans text-[10px] font-medium",c?"text-gray-400":"text-gray-500"),children:de.beforeBrand}),Ne?g("span",{className:ge("font-sans text-[10px] font-semibold",c?"text-gray-300":"text-gray-600"),children:"ESHAL"}):g("img",{src:c?"data:image/svg+xml,%3csvg width='219' height='54' xmlns='http://www.w3.org/2000/svg' version='1.0'%3e%3cg class='layer'%3e%3ctitle%3eEshal Logo%3c/title%3e%3cg clip-path='url(%23a)' transform='translate(-.708 -1.076)'%3e%3cg clip-path='url(%23b)'%3e%3cpath d='M21.79 54.75h4.5l3.93-.56 4.49-1.4 3.38-1.97 2.81-2.25 2.24-2.81 2.25-3.93 1.13-3.09v-.85l-3.65-1.12h-.57l-1.96 4.5-1.97 3.09-2.81 2.53-3.93 1.96-3.38.85-2.81.28h-2.81l-4.21-.57-3.94-1.4-2.81-1.97-2.25-2.24-1.96-3.38-1.41-4.21-.56-3.37-.28-3.1v-3.65l.56-5.06 1.12-4.21 1.97-3.94 2.53-2.81 2.25-1.68 2.81-1.41 3.37-.84 2.25-.28H26l4.78.84 4.5 2.25 2.53 2.53 1.4 2.53.56 2.53-.28 3.65-1.12 2.25-1.41 1.69-1.4.55-1.13-4.21-1.68-2.81-1.97-1.97-3.09-1.4-1.12-.28h-5.34l-3.09 1.12-2.25 1.69-1.41 1.97-.84 3.09.28 3.08 1.4 2.82 1.97 1.96 2.81 1.41 2.25.56 4.78.28 3.09-.28.84-.28-1.12 3.09-1.69 1.97-2.25.84h-3.65l-2.81-1.12-1.68-1.41-3.38 2.25.56 1.13 1.13 1.4 2.81 1.69 2.81.84h4.78l2.81-.84 2.53-1.69 1.96-2.25L35 34.8l.84-4.5 3.65-2.24 2.53-2.53 1.69-3.09.56-2.25.28-2.81-.56-3.93-1.12-2.82-2.25-3.09-3.09-2.81-4.22-2.25-4.5-1.12-2.52-.28h-4.5l-3.93.56-4.5 1.41-3.38 1.96-3.37 3.1-2.52 3.65-1.97 4.49-1.13 4.78-.28 2.25v9.27l.84 5.06 1.69 4.78 1.69 3.09 2.25 2.81 2.8 2.53 2.82 1.69 5.06 1.68zm1.12-27.54-2.53-.84-1.4-1.12-.84-1.69.28-2.53 1.12-1.4 2.25-1.13H26l2.81 1.41 1.41 1.97.84 2.8v2.25l-1.12.28zm0 0' fill='white'/%3e%3c/g%3e%3c/g%3e%3cpath d='M82.381 38.435v6.48h-27.06V9.965h26.41v6.5h-18.36v7.57h16.22v6.3h-16.22v8.1zm16.432 7.07c-2.77 0-5.44-.37-8.02-1.11-2.57-.75-4.65-1.72-6.22-2.92l2.75-6.09c1.5 1.09 3.28 1.98 5.34 2.64 2.07.67 4.13 1 6.19 1q3.45 0 5.1-1.02t1.65-2.73c0-.83-.33-1.52-.98-2.06-.65-.55-1.48-1-2.5-1.33-1.01-.33-2.39-.7-4.11-1.1-2.67-.63-4.85-1.26-6.55-1.89s-3.15-1.64-4.37-3.04c-1.21-1.41-1.82-3.27-1.82-5.6 0-2.03.55-3.86 1.64-5.51 1.11-1.66 2.76-2.96 4.97-3.92 2.22-.97 4.93-1.46 8.13-1.46 2.22 0 4.4.27 6.53.8s4 1.3 5.59 2.3l-2.5 6.14c-3.23-1.82-6.45-2.74-9.67-2.74-2.27 0-3.95.37-5.03 1.1-1.07.73-1.61 1.69-1.61 2.89q0 1.8 1.86 2.67c1.25.59 3.16 1.16 5.72 1.72 2.66.63 4.85 1.27 6.55 1.9 1.69.63 3.14 1.63 4.36 2.99 1.21 1.37 1.82 3.21 1.82 5.55 0 2-.56 3.82-1.67 5.46q-1.68 2.475-5.01 3.93c-2.23.95-4.95 1.43-8.14 1.43m50.913-35.54v34.95h-8.08v-14.33h-15.88v14.33h-8.09V9.965h8.09v13.78h15.88V9.965zm29.811 27.47h-16.22l-3.1 7.48h-8.29l15.58-34.95h7.98l15.62 34.95h-8.48zm-2.55-6.15-5.55-13.37-5.53 13.37zm16.274-21.32h8.09v28.36h17.52v6.59h-25.61zm0 0' fill='white'/%3e%3c/g%3e%3c/svg%3e":"data:image/svg+xml,%3csvg width='219' height='54' xmlns='http://www.w3.org/2000/svg' version='1.0'%3e%3cg class='layer'%3e%3ctitle%3eEshal Logo%3c/title%3e%3cg clip-path='url(%23a)' transform='translate(-.708 -1.076)'%3e%3cg clip-path='url(%23b)'%3e%3cpath d='M21.79 54.75h4.5l3.93-.56 4.49-1.4 3.38-1.97 2.81-2.25 2.24-2.81 2.25-3.93 1.13-3.09v-.85l-3.65-1.12h-.57l-1.96 4.5-1.97 3.09-2.81 2.53-3.93 1.96-3.38.85-2.81.28h-2.81l-4.21-.57-3.94-1.4-2.81-1.97-2.25-2.24-1.96-3.38-1.41-4.21-.56-3.37-.28-3.1v-3.65l.56-5.06 1.12-4.21 1.97-3.94 2.53-2.81 2.25-1.68 2.81-1.41 3.37-.84 2.25-.28H26l4.78.84 4.5 2.25 2.53 2.53 1.4 2.53.56 2.53-.28 3.65-1.12 2.25-1.41 1.69-1.4.55-1.13-4.21-1.68-2.81-1.97-1.97-3.09-1.4-1.12-.28h-5.34l-3.09 1.12-2.25 1.69-1.41 1.97-.84 3.09.28 3.08 1.4 2.82 1.97 1.96 2.81 1.41 2.25.56 4.78.28 3.09-.28.84-.28-1.12 3.09-1.69 1.97-2.25.84h-3.65l-2.81-1.12-1.68-1.41-3.38 2.25.56 1.13 1.13 1.4 2.81 1.69 2.81.84h4.78l2.81-.84 2.53-1.69 1.96-2.25L35 34.8l.84-4.5 3.65-2.24 2.53-2.53 1.69-3.09.56-2.25.28-2.81-.56-3.93-1.12-2.82-2.25-3.09-3.09-2.81-4.22-2.25-4.5-1.12-2.52-.28h-4.5l-3.93.56-4.5 1.41-3.38 1.96-3.37 3.1-2.52 3.65-1.97 4.49-1.13 4.78-.28 2.25v9.27l.84 5.06 1.69 4.78 1.69 3.09 2.25 2.81 2.8 2.53 2.82 1.69 5.06 1.68zm1.12-27.54-2.53-.84-1.4-1.12-.84-1.69.28-2.53 1.12-1.4 2.25-1.13H26l2.81 1.41 1.41 1.97.84 2.8v2.25l-1.12.28zm0 0' fill='black'/%3e%3c/g%3e%3c/g%3e%3cpath d='M82.381 38.435v6.48h-27.06V9.965h26.41v6.5h-18.36v7.57h16.22v6.3h-16.22v8.1zm16.432 7.07c-2.77 0-5.44-.37-8.02-1.11-2.57-.75-4.65-1.72-6.22-2.92l2.75-6.09c1.5 1.09 3.28 1.98 5.34 2.64 2.07.67 4.13 1 6.19 1q3.45 0 5.1-1.02t1.65-2.73c0-.83-.33-1.52-.98-2.06-.65-.55-1.48-1-2.5-1.33-1.01-.33-2.39-.7-4.11-1.1-2.67-.63-4.85-1.26-6.55-1.89s-3.15-1.64-4.37-3.04c-1.21-1.41-1.82-3.27-1.82-5.6 0-2.03.55-3.86 1.64-5.51 1.11-1.66 2.76-2.96 4.97-3.92 2.22-.97 4.93-1.46 8.13-1.46 2.22 0 4.4.27 6.53.8s4 1.3 5.59 2.3l-2.5 6.14c-3.23-1.82-6.45-2.74-9.67-2.74-2.27 0-3.95.37-5.03 1.1-1.07.73-1.61 1.69-1.61 2.89q0 1.8 1.86 2.67c1.25.59 3.16 1.16 5.72 1.72 2.66.63 4.85 1.27 6.55 1.9 1.69.63 3.14 1.63 4.36 2.99 1.21 1.37 1.82 3.21 1.82 5.55 0 2-.56 3.82-1.67 5.46q-1.68 2.475-5.01 3.93c-2.23.95-4.95 1.43-8.14 1.43m50.913-35.54v34.95h-8.08v-14.33h-15.88v14.33h-8.09V9.965h8.09v13.78h15.88V9.965zm29.811 27.47h-16.22l-3.1 7.48h-8.29l15.58-34.95h7.98l15.62 34.95h-8.48zm-2.55-6.15-5.55-13.37-5.53 13.37zm16.274-21.32h8.09v28.36h17.52v6.59h-25.61zm0 0' fill='black'/%3e%3c/g%3e%3c/svg%3e",alt:"ESHAL",className:ge("h-3",c?"opacity-60":"opacity-50"),onError:()=>Re(!0)}),de.afterBrand&&g("span",{className:ge("font-sans text-[10px] font-medium",c?"text-gray-400":"text-gray-500"),children:de.afterBrand})]})})})]})},Mo=["sun","mon","tue","wed","thu","fri","sat"];function To(e){if(!e||"string"!=typeof e)return null;const t=e.match(/^(\d{1,2}):(\d{2})/);if(!t)return null;const o=parseInt(t[1],10),r=parseInt(t[2],10);return Number.isNaN(o)||Number.isNaN(r)?null:60*o+r}function Fo(e,t=new Date,o={}){if(!e||!e.showStatus)return null;const r=o.online||"Online now",a=o.officeOpen||"Online now",i=o.offlineFallback||"Offline";if("officeHours"!==e.statusMode)return{online:!0,label:r};const n=e.officeHours||{},{dayKey:s,minutes:l}=function(e,t){try{const o=new Intl.DateTimeFormat("en-US",{timeZone:e||void 0,weekday:"short",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(t),r=(o.find(e=>"weekday"===e.type)||{}).value||"";let a=parseInt((o.find(e=>"hour"===e.type)||{}).value||"0",10);const i=parseInt((o.find(e=>"minute"===e.type)||{}).value||"0",10);return 24===a&&(a=0),{dayKey:r.slice(0,3).toLowerCase(),minutes:60*a+i}}catch{return{dayKey:Mo[t.getDay()],minutes:60*t.getHours()+t.getMinutes()}}}(n.timezone,t),c=Array.isArray(n.days)?n.days.map(e=>String(e).slice(0,3).toLowerCase()):[],d=To(n.open),u=To(n.close);if(c.includes(s)&&(null!=d&&null!=u&&(d<=u?l>=d&&l<u:l>=d||l<u))){return{online:!0,label:(n.onlineMessage||"").trim()||a}}return{online:!1,label:(n.offlineMessage||"").trim()||i}}const zo='[role="menuitem"]';function Po(e){const t=e&&"function"==typeof e.getRootNode?e.getRootNode():null;return t&&t.activeElement||document.activeElement}function Lo(e,t){return e?Array.from(e.querySelectorAll(t)).filter(e=>!e.disabled&&"true"!==e.getAttribute("aria-disabled")):[]}function Ao(e,t,o=zo){const{key:r}=e;if("ArrowDown"!==r&&"ArrowUp"!==r&&"Home"!==r&&"End"!==r)return!1;const a=Lo(t,o);if(0===a.length)return!1;e.preventDefault();const i=a.indexOf(Po(t));let n;return n="Home"===r?0:"End"===r?a.length-1:"ArrowDown"===r?i<0?0:(i+1)%a.length:i<0?a.length-1:(i-1+a.length)%a.length,a[n].focus(),!0}const jo=({conciergeName:e,companyName:a,companyLogo:n,primaryColor:s,isDark:l,isMinimized:c=!1,textColor:d,fontFamily:u,fontSize:h,onToggleTheme:m,onMinimize:b,onClose:f,headerTextBold:w=!1,headerTextItalic:y=!1,headerTextColor:v,headerFontFamily:k,headerFontSize:x,subtitle:C=null,showStatus:S=!1,statusMode:M="always",officeHours:T=null,onRefreshChat:F,onCopyChat:z,defaultLanguage:P="en"})=>{const L=s,A=v||"#FFFFFF",j=k||u||"Inter",N=x||h;ht(j);const R=t(()=>re(P),[P]),I=G(P),B=t(()=>ee(C,I),[C,I]),E=t(()=>Fo({showStatus:S,statusMode:M,officeHours:T}),[S,M,T]),[D,V]=o(!1),O=r(null),$=r(null);i(()=>{if(!D)return;const e=e=>{O.current&&!e.composedPath().includes(O.current)&&V(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[D]);const U=r(!1);i(()=>{if(D){U.current=!0;const e=O.current?.querySelector('[role="menuitem"]');e?.focus()}else U.current&&(U.current=!1,$.current?.focus())},[D]);const q=A;return p("div",{className:`text-white ${c?"px-4 py-2.5":"px-3 py-4"} flex items-center justify-between relative overflow-visible rounded-t-2xl z-[60]`,style:{background:L,fontFamily:j},children:[p("div",{className:"flex items-center gap-3 flex-1 min-w-0 pl-1",children:[p("div",{className:"relative w-11 h-11 flex-shrink-0",children:[g("div",{className:"w-full h-full rounded-full overflow-hidden flex items-center justify-center bg-white/20",children:n?g("img",{src:n,alt:"Logo",style:{display:"block",width:"100%",height:"100%",objectFit:"contain"},loading:"lazy"}):g("span",{className:"text-lg font-semibold leading-none",style:{color:q},children:(e||a||"")?.charAt(0)?.toUpperCase()})}),E?g("span",{title:E.label,className:ge("absolute bottom-0 h-3 w-3 rounded-full ring-2 ring-white",I?"left-0":"right-0"),style:{backgroundColor:E.online?"#22c55e":"#9ca3af",boxShadow:E.online?"0 0 0 3px rgba(34,197,94,0.25)":"none"},"aria-hidden":"true"}):null]}),p("div",{className:"flex flex-col justify-center min-w-0",style:{fontFamily:j},children:[g("h3",{title:e,className:ge("font-semibold leading-snug truncate",w&&"font-bold",y&&"italic"),style:{fontSize:N?`calc(${N} + 2px)`:"15px",color:q},children:e}),C?g("p",{title:C,className:"leading-snug truncate opacity-75",dir:B?"rtl":"ltr",style:{fontSize:"12px",color:q,textAlign:B?"right":"left"},children:C}):null]})]}),p("div",{className:"flex items-center gap-0 relative z-10 text-white flex-shrink-0 ml-1",children:[p("div",{className:"relative",ref:O,children:[g("button",{type:"button",ref:$,"aria-label":R("menu"),"aria-expanded":D,"aria-haspopup":"true",onClick:()=>V(e=>!e),onKeyDown:e=>{"Escape"===e.key&&D&&(e.preventDefault(),V(!1))},className:"inline-flex h-7 w-7 items-center justify-center cursor-pointer transition-opacity duration-200 hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/40 rounded-full border-0 bg-transparent p-0",style:{color:q},children:g(Qe,{className:"w-4 h-4",strokeWidth:1.6})}),D&&p("div",{role:"menu","aria-label":R("menu"),tabIndex:-1,dir:I?"rtl":"ltr",onKeyDown:e=>{if("Escape"===e.key)return e.preventDefault(),void V(!1);Ao(e,O.current)||function(e,t,o=zo){if("Tab"!==e.key)return!1;const r=Lo(t,o);if(0===r.length)return!1;const a=r[0],i=r[r.length-1],n=Po(t);e.shiftKey&&n===a?(e.preventDefault(),i.focus()):!e.shiftKey&&n===i&&(e.preventDefault(),a.focus())}(e,O.current)},className:`absolute top-full mt-1 w-44 rounded-xl border shadow-lg py-1 z-[9999] animate-in fade-in slide-in-from-top-1 duration-150 ${I?"left-0":"right-0"} ${l?"bg-gray-800 border-gray-700":"bg-white border-gray-200"}`,style:{fontFamily:j},children:[p("button",{role:"menuitem",onClick:()=>{V(!1),F?.()},className:"flex items-center gap-2.5 w-full px-3 py-2 text-sm leading-5 transition-colors cursor-pointer "+(l?"text-gray-200 hover:bg-gray-700":"text-gray-700 hover:bg-gray-50"),style:{fontFamily:j,fontSize:"14px",border:"none",background:"transparent",appearance:"none",WebkitAppearance:"none",textAlign:I?"right":"left"},children:[g(tt,{className:"w-3.5 h-3.5 flex-shrink-0"}),R("refreshChat")]}),p("button",{role:"menuitem",onClick:()=>{V(!1),z?.()},className:"flex items-center gap-2.5 w-full px-3 py-2 text-sm leading-5 transition-colors cursor-pointer "+(l?"text-gray-200 hover:bg-gray-700":"text-gray-700 hover:bg-gray-50"),style:{fontFamily:j,fontSize:"14px",border:"none",background:"transparent",appearance:"none",WebkitAppearance:"none",textAlign:I?"right":"left"},children:[g(Ye,{className:"w-3.5 h-3.5 flex-shrink-0"}),R("copyChat")]}),p("button",{role:"menuitem",onClick:()=>{V(!1),m?.()},className:"flex items-center gap-2.5 w-full px-3 py-2 text-sm leading-5 transition-colors cursor-pointer "+(l?"text-gray-200 hover:bg-gray-700":"text-gray-700 hover:bg-gray-50"),style:{fontFamily:j,fontSize:"14px",border:"none",background:"transparent",appearance:"none",WebkitAppearance:"none",textAlign:I?"right":"left"},children:[g(l?it:Xe,{className:"w-3.5 h-3.5 flex-shrink-0"}),R(l?"lightMode":"nightMode")]})]})]}),g("button",{type:"button","aria-label":R("close"),onClick:f,className:"inline-flex h-7 w-7 items-center justify-center cursor-pointer transition-opacity duration-200 hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/40 rounded-full border-0 bg-transparent p-0",style:{color:q},children:g(lt,{className:"w-3.5 h-3.5",strokeWidth:1.6})})]})]})},No=({questions:e=[],collapsiblePrompt:a,onSubmit:i,primaryColor:n="#2563eb",isRtl:s=!1,isDark:l=!1,defaultLanguage:c="en",fontFamily:d})=>{const u=t(()=>re(c),[c]),[h,m]=o({}),[b,f]=o({}),[w,y]=o(!1),v=r({}),k=[...e].sort((e,t)=>he(e.fieldType)-he(t.fieldType));return g("div",{className:"flex flex-col items-center justify-center p-6 h-full min-h-0 z-50 relative ",style:{...d?{fontFamily:d}:{},...l?{backgroundColor:"#10141C"}:{}},children:p("div",{className:"w-full max-w-sm rounded-2xl shadow-xl border p-8 transition-colors duration-300 bg-white border-gray-100",style:l?{backgroundColor:"#1E232B",border:"1px solid #2A303C"}:void 0,children:[a&&g("div",{className:"mb-4 text-start",children:g("h3",{className:"transition-colors duration-300 text-sm font-semibold mb-1 "+(l?"text-white":"text-[#4A5568]"),children:a})}),p("form",{onSubmit:async e=>{e.preventDefault();const t=(()=>{const e={};return k.forEach(t=>{const o=t.fieldType||"question",r=(h[o]??"").trim(),a=t.collectionPrompt||t.askToType||t.question||t.label||o,i=!0===t.required||"true"===t.required;r?("fullName"!==o&&"name"!==o||r.length<2&&(e[o]=u("nameInvalid")),"email"!==o||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)||(e[o]=u("emailInvalid")),"phone"!==o&&"mobileno"!==o||/^[+]?[\d\s-]{8,15}$/.test(r)||(e[o]=u("phoneInvalid"))):i&&(e[o]="email"===o?u("emailRequired"):"fullName"===o||"name"===o?u("nameRequired"):"phone"===o||"mobileno"===o?u("phoneRequired"):`${a} ${u("fieldRequiredSuffix")}`)}),f(e),e})();if(Object.keys(t).length>0){const e=k.map((e,t)=>e.fieldType||`question_${t}`).find(e=>t[e]);return void v.current[e]?.focus()}y(!0);try{await i(h)}finally{y(!1)}},className:"space-y-4",noValidate:!0,children:[k.map((e,t)=>{const o=e.fieldType||`question_${t}`,r=e.collectionPrompt||e.askToType||e.question||e.label;if(!r?.trim())return null;let a="text";"email"===o&&(a="email"),"phone"!==o&&"mobileno"!==o||(a="tel");const i=(o||"").toLowerCase(),n="fullname"===i||"name"===i||"username"===i,c="phone"===i||"mobileno"===i,d="email"===i?u("onboardingEmailPlaceholder"):n?u("onboardingNamePlaceholder"):c?u("onboardingPhonePlaceholder"):r,w=b[o],y="w-full h-12 rounded-xl text-base md:text-sm px-3 py-1 outline-none border transition-colors focus:ring-0 "+(l?"text-white placeholder:text-[#A2A9B2] focus:border-[#5A6069]":"bg-gray-50/30 focus:bg-white text-gray-900 placeholder:text-gray-500 focus:border-[#B0B0B0]"),k=w?"!border-status-error focus:!border-status-error":"",x=`onboarding-field-${o}`,C=`${x}-error`;return p("div",{children:[g("label",{htmlFor:x,className:"sr-only",children:r}),g("input",{id:x,ref:e=>{v.current[o]=e},placeholder:d,type:a,value:h[o]??"",onChange:e=>((e,t)=>{m(o=>({...o,[e]:t})),b[e]&&f(t=>{const o={...t};return delete o[e],o})})(o,e.target.value),className:`${y} ${k}`,"aria-invalid":w?"true":"false","aria-describedby":w?C:void 0,style:{direction:s?"rtl":"ltr",fontFamily:"inherit",...l?{backgroundColor:"#272C35",borderWidth:"1px",borderStyle:"solid",borderColor:w?void 0:"#3F444C"}:{borderWidth:"1px",borderStyle:"solid",borderColor:w?void 0:"#E0E0E0"}}}),w&&g("p",{id:C,role:"alert",className:"mt-1 text-xs text-status-error px-1",children:b[o]})]},o)}),g("button",{type:"submit",disabled:w,"aria-busy":w,"aria-label":w?u("submitting"):void 0,className:"w-full h-12 inline-flex items-center justify-center text-sm border-none font-semibold shadow-xl hover:shadow-xl hover:scale-[1.02] active:scale-[0.98] transition-all rounded-xl mt-4 text-white",style:{backgroundColor:n,fontFamily:"inherit"},children:w?g(Ge,{className:"w-5 h-5 animate-spin","aria-hidden":"true"}):u("startChat")})]})]})})},Ro=({categories:e=[],selectedCategoryId:n=null,onSelect:s,isDark:l=!1,primaryColor:c="#2563eb",fontFamily:d="Inter",isRtl:u=!1,defaultLanguage:h="en"})=>{const m=t(()=>re(h),[h]),b=r(null),[f,w]=o(!1),[y,v]=o(!1),k=a(()=>{const e=b.current;if(!e)return;const{scrollLeft:t,scrollWidth:o,clientWidth:r}=e;w(Math.abs(t)>1),v(Math.abs(t)+r<o-1)},[]);i(()=>{k();const e=b.current;if(!e)return;const t=new ResizeObserver(k);return t.observe(e),()=>t.disconnect()},[k,e]);const x=a(e=>{const t=b.current;if(!t)return;const o="left"===e?-150:150;t.scrollBy({left:u?-o:o,behavior:"smooth"})},[u]);if(!Array.isArray(e)||0===e.length)return null;const C=l?"rgba(31,41,55,0.85)":"rgba(255,255,255,0.95)",S=l?"#e5e7eb":"#374151",M=l?"#4b5563":"#d1d5db";return p("div",{className:"flex-shrink-0 px-2 py-2 border-b flex items-center gap-1",style:{backgroundColor:l?"#111827":"#ffffff",borderColor:l?"#374151":"#e5e7eb",fontFamily:d,direction:u?"rtl":"ltr"},role:"region","aria-label":m("filterByCategory"),children:[g("button",{type:"button",onClick:()=>x("left"),disabled:!f,"aria-label":m("scrollCategoriesLeft"),className:"flex-shrink-0 flex items-center justify-center w-6 h-6 rounded-full transition-all duration-200",style:{backgroundColor:C,border:`1px solid ${M}`,color:S,opacity:f?1:.3,cursor:f?"pointer":"default"},children:g(_e,{size:14})}),g("div",{ref:b,onScroll:k,className:"flex-1 flex gap-2 overflow-x-auto",style:{scrollBehavior:"smooth",WebkitOverflowScrolling:"touch",scrollbarWidth:"none",msOverflowStyle:"none"},children:e.map(e=>{const t=n===e.id;return g("button",{type:"button",onClick:()=>s?.(t?null:e.id),"aria-pressed":t,className:"flex-shrink-0 inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium transition-all duration-150 whitespace-nowrap",style:{backgroundColor:l?"#1f2937":"#ffffff",border:t?`1.5px solid ${c}`:"1px solid "+(l?"#374151":"#e5e7eb"),color:t?c:l?"#e5e7eb":"#374151",fontFamily:d},children:g("span",{children:e.label})},e.id)})}),g("button",{type:"button",onClick:()=>x("right"),disabled:!y,"aria-label":m("scrollCategoriesRight"),className:"flex-shrink-0 flex items-center justify-center w-6 h-6 rounded-full transition-all duration-200",style:{backgroundColor:C,border:`1px solid ${M}`,color:S,opacity:y?1:.3,cursor:y?"pointer":"default"},children:g(We,{size:14})})]})},Io=({categories:e=[],selectedCategoryId:t=null,onSelect:o,isDark:r=!1,primaryColor:a="#2563eb",fontFamily:i="Inter",fontSize:n="14px",isRtl:s=!1,label:l="Choose a topic to get started:",regionLabel:c="Category filter"})=>{if(!Array.isArray(e)||0===e.length)return null;return p("div",{className:"pl-[50px] pt-1",style:{direction:s?"rtl":"ltr",paddingLeft:s?0:50,paddingRight:s?50:void 0},role:"region","aria-label":c,children:[g("div",{className:"mb-2",style:{color:r?"#9ca3af":"#6b7280",fontFamily:i,fontSize:`calc(${n} - 1px)`},children:l}),g("div",{className:"flex flex-wrap gap-2",children:e.map(e=>{const s=t===e.id;return g("button",{type:"button",onClick:()=>o?.(s?null:e.id),"aria-pressed":s,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full transition-all duration-150 hover:scale-[1.02] active:scale-[0.98]",style:{backgroundColor:r?"#1f2937":"#ffffff",border:s?`1.5px solid ${a}`:"1px solid "+(r?"#374151":"#e5e7eb"),color:s?a:r?"#e5e7eb":"#374151",fontFamily:i,fontSize:`calc(${n} - 1px)`,fontWeight:500},children:e.label},e.id)})})]})};const Bo=[{value:"😡",label:"😡",bg:"bg-red-200"},{value:"😕",label:"😕",bg:"bg-orange-200"},{value:"😐",label:"😐",bg:"bg-yellow-200"},{value:"😊",label:"😊",bg:"bg-green-200"},{value:"😍",label:"😍",bg:"bg-pink-200"}],Eo=[{value:"positive",label:"👍"},{value:"negative",label:"👎"}],Do=[{value:"1",label:"1"},{value:"2",label:"2"},{value:"3",label:"3"},{value:"4",label:"4"},{value:"5",label:"5"}],Vo=[{value:"1",label:"⭐"},{value:"2",label:"⭐"},{value:"3",label:"⭐"},{value:"4",label:"⭐"},{value:"5",label:"⭐"}],Oo=({format:e="EMOJI",prompt:r="How was your experience?",onRating:a,disabled:i=!1,isDark:n=!1,primaryColor:s="#2563eb",defaultLanguage:l="en"})=>{const c=t(()=>re(l),[l]),[d,u]=o(null),[h,m]=o(null),[b,f]=o(!1),w=async t=>{if(!i&&!b){u(t),f(!0);try{a&&a(t,e)}finally{f(!1)}}},y=(()=>{switch(e){case"THUMBS":return Eo;case"NUMERIC":return Do;case"STARS":return Vo;default:return Bo}})();return p("div",{className:ge("transition-all duration-200 rounded-xl px-4",n?"bg-slate-800/50":"bg-slate-50/50"),children:[g("p",{className:ge("text-sm font-semibold text-center mb-3",n?"text-gray-300":"text-gray-500/80"),children:r}),p("div",{className:"flex justify-center items-center",children:["EMOJI"===e&&g("div",{className:"flex gap-2 justify-center items-center",children:y.map(e=>g("button",{onClick:()=>w(e.value),disabled:i||b,className:ge("flex items-center justify-center text-2xl transition-transform","bg-transparent border-0 p-0 cursor-pointer","hover:scale-110 active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed","focus:outline-none focus:ring-0","rounded-md focus-visible:ring-2 focus-visible:ring-blue-700",d===e.value?"":"opacity-80"),children:g("span",{role:"img","aria-label":`${c("rate")} ${e.value}`,children:e.label})},e.value))}),"THUMBS"===e&&g("div",{className:"flex gap-6 justify-center items-center",role:"group","aria-label":c("rateExperience"),children:y.map(e=>g("button",{"aria-label":1===e.value?c("thumbsUp"):c("thumbsDown"),onClick:()=>w(e.value),disabled:i||b,className:ge("w-10 h-10 rounded-xl border flex items-center justify-center shadow-md text-2xl transition-all","hover:scale-105 active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed","drop-shadow-md",n?"bg-gray-700 border-gray-600 hover:bg-gray-600":"bg-white border-gray-100 hover:bg-gray-50",d===e.value&&"ring-2 ring-primary/40 scale-110"),style:{borderColor:d===e.value?s:void 0},children:g("span",{className:"drop-shadow-md","aria-hidden":"true",children:e.label})},e.value))}),"NUMERIC"===e&&g("div",{className:"flex gap-2 justify-center items-center",role:"group","aria-label":c("rateExperience"),children:y.map(e=>g("button",{"aria-label":`${c("rate")} ${e.value}`,onClick:()=>w(e.value),disabled:i||b,className:ge("w-10 h-10 rounded-lg flex items-center justify-center text-sm font-semibold transition-all","hover:scale-105 active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed",d===e.value?"ring-2 ring-primary/40 scale-110 shadow-md text-white":n?"bg-gray-700 border border-gray-600 text-gray-300 hover:bg-gray-600":"bg-white border border-gray-200 text-gray-700 hover:bg-gray-50"),style:{backgroundColor:d===e.value?s:void 0,borderColor:d===e.value?s:void 0},children:e.label},e.value))}),"STARS"===e&&g("div",{className:"flex gap-2 justify-center items-center",onMouseLeave:()=>m(null),children:y.map(e=>{const t=h===e.value;return g("button",{onClick:()=>w(e.value),onMouseEnter:()=>m(e.value),disabled:i||b,className:ge("flex items-center justify-center text-2xl","bg-transparent border-0 p-0 cursor-pointer focus:outline-none","rounded-md focus-visible:ring-2 focus-visible:ring-blue-700","disabled:opacity-50 disabled:cursor-not-allowed"),style:{transform:t?"scale(1.25)":"scale(1)",filter:t?"brightness(1.1) drop-shadow(0 2px 4px rgba(0,0,0,0.15))":"none",opacity:t?1:.6,transition:"all 0.2s ease"},"aria-label":`${c("rate")} ${e.value}`,children:g("span",{"aria-hidden":"true",children:e.label})},e.value)})})]}),b&&g("p",{"aria-live":"polite",className:ge("text-xs mt-3 text-center",n?"text-slate-400":"text-slate-500"),children:c("submittingFeedback")})]})};async function $o({apiBaseUrl:e,conversationId:t,chip:o,submitText:r,position:a,source:i="widget",getAuthToken:n,enabled:s=!0}={}){try{if(!1===s)return!1;if(!e||"string"!=typeof e)return!1;if(!t||"string"!=typeof t)return!1;const l=function({chip:e,submitText:t,position:o,conversationId:r,source:a="widget"}={}){const i=e&&"object"==typeof e,n=i&&"string"==typeof e.text?e.text:"",s="string"==typeof t&&t?t:i&&"string"==typeof e.submitText?e.submitText:"string"==typeof e?e:"",l=n||s;if(!l)return null;const c={conversationId:r,chipText:l,submitText:s||void 0,position:Number.isInteger(o)?o:void 0,source:a},d=i?e?.promptId:void 0;return"string"==typeof d&&d&&(c.promptId=d),c}({chip:o,submitText:r,position:a,conversationId:t,source:i});if(!l)return!1;const c=`${e.replace(/\/$/,"")}/api/v1/support/chip-click`,d=JSON.stringify(l);let u;if("function"==typeof n)try{u=await n()}catch{u=void 0}if(!u&&"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon&&"undefined"!=typeof Blob)try{if(navigator.sendBeacon(c,new Blob([d],{type:"application/json"})))return!0}catch{}if("function"!=typeof fetch)return!1;const g={"Content-Type":"application/json"};return u&&(g.Authorization=`Bearer ${u}`),await fetch(c,{method:"POST",headers:g,credentials:"include",keepalive:!0,body:d}),!0}catch{return!1}}const Uo="#ffffff",qo="#f5f5f5",Ho="#000000",_o="#1f2937",Wo="#f3f4f6",Ko="#2563eb",Yo="eshal:widget:size",Qo=(e,t)=>!e||(e=>e?.trim().toLowerCase())(e)===t,Jo=e=>(e instanceof Date?e:new Date(e)).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}).replace(/am|pm/i,e=>e.toUpperCase()),Go=e=>{const t=(e||"EMOJI").toString().trim().toUpperCase();return"THUMBS"===t||"THUMB"===t?"THUMBS":"STARS"===t||"STAR"===t?"STARS":"NUMERIC"===t||"NUMBER"===t?"NUMERIC":"EMOJI"},Zo=({isOpen:e,isMinimized:n,isDark:s,onStopGeneration:l,primaryColor:c,textColor:d,conciergeName:u,companyName:m,companyLogo:b,chatbotAvatarEnabled:f,chatbotAvatar:w,messages:y,isLoading:v,isConversationLoading:k=!1,inputValue:x,setInputValue:C,onSend:S,onDirectSend:M,onToggleTheme:T,onMinimize:F,onClose:z,quickQuestions:P=[],quickQuestionsEnabled:L,onQuickQuestion:A,quickQuestionsLayout:j="vertical",agentMessageBubbleColor:N,userMessageBoxColor:R,assistantTextColor:I,userTextColor:B,fontFamily:E="Inter",agentMessageBubbleFontFamily:D,agentMessageBubbleFontSize:V,userMessageBubbleFontFamily:O,userMessageBubbleFontSize:$,fontSize:U="14px",defaultLanguage:q="en",onDecision:H,headerTextBold:_=!1,headerTextItalic:W=!1,headerTextColor:K,headerFontFamily:Y,headerFontSize:Q,subtitle:J=null,showStatus:Z=!1,statusMode:X="always",officeHours:ee=null,enableVoiceInteraction:te=!1,isVoiceSessionActive:oe=!1,voiceStatus:ae="idle",voiceError:ie=null,voiceConclusionForCsat:ne=!1,onVoiceToggle:se,onBidiSubmit:le,disclaimerEnabled:ce=!1,disclaimerText:de,disclaimerPosition:ue="top",disclaimerLinkUrl:pe,disclaimerLinkLabel:he,showPoweredBy:be=!0,apiBaseUrl:fe,apiKey:we,getAuthToken:ye,conversationId:ve,conciergeId:xe,onboardingQuestions:Ce=[],onboardingActive:Se=!1,onboardingCompleted:Me=!1,onOnboardingFormSubmit:Te,collectionPrompt:Fe,csatEnabled:ze=!1,csatFormat:Pe="EMOJI",csatPrompt:Le="How was your experience?",csatRequest:Ae=null,liveJoined:je=[],onPromptSuggestionClick:Ne,onboardingEnabled:Re=!1,onResetConversation:Ie,sessionExpiringSoon:Be=!1,autoPromptEnabled:Ee=!0,autoPromptQuestionDisplay:De=!0,autoPromptClickTelemetry:Ve=!0,allowFeedback:Oe=!0,provideCitations:$e=!0,onFeedback:Ue,onRetryMessage:qe,onRefreshChat:He,onCopyChat:_e,filterCategories:We=[],showFilterStep:Ke=!1,widgetFilter:Ye=null,onWidgetFilterChange:Qe,onSynthesizeAssistantMessage:Je,launcherPosition:Ge="bottom-right",chatFeatures:Ze,organizationId:Xe})=>{ht(E);const et=r(null),tt=r(null),ot=t(()=>re(q),[q]);i(()=>{tt.current?.focus()},[]);const rt=a((e,t,o)=>{$o({apiBaseUrl:fe,conversationId:ve,chip:t,submitText:null==e?void 0:String(e),position:o,source:"widget",getAuthToken:ye,enabled:Ve})},[fe,ye,ve,Ve]),it=a((e,t,o)=>{t&&"object"==typeof t&&rt(e,t,o);const r=o&&"object"==typeof o&&o.toolConfirmation?o.toolConfirmation:null;Ne?Ne(e):r?M?.(e,void 0,{toolConfirmation:r}):M?.(e)},[Ne,M,rt]),nt=Ge.includes("right"),st=Ge.includes("bottom"),[lt,ct]=o(()=>{if("undefined"==typeof window)return null;try{const e=window.localStorage.getItem(Yo);if(!e)return null;const t=JSON.parse(e);if("number"==typeof t?.width&&"number"==typeof t?.height&&t.width>=320&&t.height>=400)return t}catch{}return null}),dt=r(null),ut=r({x:0,y:0}),gt=r({width:380,height:650});i(()=>{const e=e=>{const t=dt.current;if(!t)return;const o=e.clientX-ut.current.x,r=e.clientY-ut.current.y,a={...gt.current},i=.92*window.innerWidth,n=.85*window.innerHeight;if("corner"===t||"horizontal"===t){const e=nt?gt.current.width-o:gt.current.width+o;a.width=Math.min(Math.max(320,e),i)}if("corner"===t||"vertical"===t){const e=st?gt.current.height-r:gt.current.height+r;a.height=Math.min(Math.max(400,e),n)}ct(a)},t=()=>{dt.current&&(dt.current=null,document.body.style.cursor="",document.body.style.userSelect="")};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[nt,st]),i(()=>{if(lt)try{window.localStorage.setItem(Yo,JSON.stringify(lt))}catch{}},[lt]);const pt=(e,t)=>{t.preventDefault(),t.stopPropagation(),dt.current=e,ut.current={x:t.clientX,y:t.clientY},gt.current=lt??{width:380,height:650};const o={corner:nt===st?"nwse-resize":"nesw-resize",horizontal:"ew-resize",vertical:"ns-resize"};document.body.style.cursor=o[e],document.body.style.userSelect="none"},[mt,bt]=o(!1),[ft,wt]=o(()=>{try{return ke(Xe)?.csatSubmitted??!1}catch{return!1}}),[yt,vt]=o(!1),[kt,xt]=o(!1),[Ct,St]=o(0),[Mt,Tt]=o(""),[Ft,zt]=o(!1),[Pt,Lt]=o(!1);i(()=>{e||(vt(!1),St(0),Tt(""),Lt(!1))},[e]),i(()=>{vt(!1),St(0),Tt(""),Lt(!1)},[ve]),i(()=>{try{const e=ke(Xe)?.csatSubmitted??!1;wt(e),e&&bt(!1)}catch{}},[ve]),function(e,t=[],o={}){const{enabled:a=!0,threshold:n=30,behavior:s="smooth",delay:l=0}=o,c=r(!0);r(0),i(()=>{if(!a||!e.current)return;const t=e.current,o=()=>{const e=t.scrollHeight-t.scrollTop-t.clientHeight;c.current=e<n},r=()=>{o()};t.addEventListener("scroll",r,{passive:!0}),o();const i=setTimeout(()=>{c.current&&t&&t.scrollTo({top:t.scrollHeight,behavior:s})},l);return()=>{t.removeEventListener("scroll",r),clearTimeout(i)}},[e,a,n,s,l,...t])}(et,[y,v],{enabled:!0,threshold:30,behavior:"smooth",delay:0});const At=G(q),jt=t(()=>s?Qo(N,Uo)?_o:N||_o:N||Uo,[N,s]),Nt=t(()=>s?Qo(d,Ho)?Wo:d||Wo:d||Ho,[s,d]),Rt=t(()=>s?Qo(R,qo)?c||Ko:R||c||Ko:R||qo,[s,c,R]),It=ot(kt?"conversationResolved":"typeYourMessage"),Bt=y?.some?.(e=>"user"===e.role),Et=t(()=>(y||[]).filter(e=>"user"===e.role).length,[y]),[Dt,Vt]=o(0),Ot=Ye?.category?(We||[]).find(e=>e.id===Ye.category):null,$t=a(e=>{if(!Qe)return;const t=Ye?.category||null;if(e){if(Qe({category:e,tags:[]}),Vt(Et),!Bt&&e!==t&&Je){const t=(We||[]).find(t=>t.id===e),o=t?.label||e,r=ot("categoryTopicsHeading").replace("{category}",o);Je(r,{replaceMarker:"category-intro"})}}else Qe(null)},[Qe,Ye,Et,We,Bt,Je,ot]);a(e=>{const t=Ye?.category||Ot?.id;t&&Qe&&Qe({category:t,tags:[e]}),M&&M(e)},[Ye,Ot,Qe,M]);const Ut=Array.isArray(We)&&We.length>0,qt=Ut&&!Bt&&!Ye?.category,Ht=!Bt&&P.length>0&&L&&!Ye?.category,_t=Ce&&Ce.length>0,Wt=Boolean(ze),Kt=Re&&_t&&!Me,Yt=a(async()=>{if(Wt&&!Ft&&!kt&&0!==Ct){zt(!0),Lt(!1);try{const e={"Content-Type":"application/json"};if("function"==typeof ye){const t=await ye();t&&(e.Authorization=`Bearer ${t}`)}const t=Go(Pe),o=await fetch(`${fe.replace(/\/$/,"")}/api/v1/support/csat`,{method:"POST",headers:e,credentials:"include",body:JSON.stringify({conversationId:ve,rating:String(Ct),ratingFormat:t,conciergeId:xe,feedback:Mt||void 0})});o.ok?(vt(!1),St(0),Tt(""),Qe&&Qe(null),He?He():Ie&&Ie()):(console.error("Failed to submit resolve feedback:",await o.text()),Lt(!0))}catch(e){console.error("Error submitting resolve feedback:",e),Lt(!0)}finally{zt(!1)}}},[Wt,Ft,kt,Ct,Mt,ve,ye,xe,fe,Pe,Ie,He,Qe]),Qt=a(()=>{if(!Wt||!ve||!Bt)return Qe&&Qe(null),He?He():Ie&&Ie(),void z?.();yt?(vt(!1),z?.()):kt?z?.():vt(!0)},[Wt,ve,Bt,yt,kt,z,Qe,He,Ie]);i(()=>{Wt||(yt&&vt(!1),kt&&xt(!1),0!==Ct&&St(0),Mt&&Tt(""))},[Wt,yt,kt,Ct,Mt]);const Jt=t(()=>{if(!y||!Array.isArray(y))return[];for(let e=y.length-1;e>=0;e-=1)if("assistant"===y[e]?.role){const t=y[e].prompts;return Array.isArray(t)?t:[]}return[]},[y]),Gt=r([]);i(()=>{Jt.length>0?Gt.current=Jt:y&&0!==y.length&&y.some(e=>"user"===e.role)||(Gt.current=[])},[Jt,y]);const Zt=r(Et);i(()=>{Et!==Zt.current&&(Zt.current=Et,Gt.current=[])},[Et]);const Xt=Array.isArray(y)&&y.some(e=>"user"===e?.role),eo=Jt.length>0?Jt:Xt?Gt.current:[];i(()=>{if(!ze)return;if(!mt)return;if(ft)return;const e=et.current;if(!e)return;const t=window.requestAnimationFrame(()=>{e.scrollTo({top:e.scrollHeight,behavior:"smooth"})});return()=>{window.cancelAnimationFrame(t)}},[mt,ze,ft]);const to=()=>{const e=Go(Pe);if("STARS"===e)return g("div",{className:"flex justify-center gap-2 mb-5",role:"group","aria-label":ot("rateExperience"),children:[1,2,3,4,5].map(e=>g("button",{"aria-label":`${ot("rate")} ${e}`,onClick:()=>St(e),className:"transition-all duration-150 hover:scale-110 active:scale-95 bg-transparent border-0 p-0 cursor-pointer",disabled:Ft,children:g(at,{className:ge("w-8 h-8 transition-colors",e<=Ct?"text-yellow-400 drop-shadow-sm":s?"text-gray-600":"text-gray-300"),fill:e<=Ct?"#FBBF24":"none"})},e))});if("THUMBS"===e)return g("div",{className:"flex gap-4 justify-center mb-5",role:"group","aria-label":ot("rateExperience"),children:[{value:"positive",emoji:"👍"},{value:"negative",emoji:"👎"}].map(e=>g("button",{"aria-label":"positive"===e.value?ot("thumbsUp"):ot("thumbsDown"),onClick:()=>St(e.value),disabled:Ft,className:ge("w-12 h-12 rounded-xl border flex items-center justify-center text-2xl transition-all hover:scale-105 active:scale-95",Ct===e.value?"ring-2 ring-blue-300 scale-110 shadow-lg":"",s?"bg-gray-700 border-gray-600 hover:bg-gray-600":"bg-white border-gray-200 hover:bg-gray-50"),children:g("span",{className:"drop-shadow-md",children:e.emoji})},e.value))});return g("div",{className:"flex gap-2 justify-center items-center mb-5",role:"group","aria-label":ot("rateExperience"),children:[{value:1,emoji:"😡"},{value:2,emoji:"😕"},{value:3,emoji:"😐"},{value:4,emoji:"😊"},{value:5,emoji:"😍"}].map(e=>g("button",{"aria-label":`${ot("rate")} ${e.value}`,onClick:()=>St(e.value),disabled:Ft,className:ge("rounded-full w-10 h-10 flex items-center justify-center text-xl transition-all hover:scale-110 active:scale-95 bg-transparent border-0 p-0 cursor-pointer",Ct===e.value?"ring-2 ring-blue-100 scale-125 bg-gradient-to-b from-yellow-200 to-yellow-400 shadow-md":"grayscale-[0.3] opacity-80 hover:grayscale-0"),children:g("span",{role:"img","aria-label":`${ot("rate")} ${e.value}`,className:"drop-shadow-sm filter",children:e.emoji})},e.value))})};if(!e)return null;const oo=!n&&lt?{width:lt.width,height:lt.height,maxWidth:"92vw",maxHeight:"85vh"}:void 0;return p("div",{dir:At?"rtl":"ltr",className:"relative flex-shrink-0 z-50 "+(n?"w-80 h-auto":""),style:oo,children:[!n&&p(h,{children:[g("div",{onMouseDown:e=>pt("horizontal",e),className:"absolute top-0 h-full w-1.5 cursor-ew-resize hover:bg-blue-500/20 transition-colors z-[70] "+(nt?"left-0":"right-0"),"aria-hidden":!0}),g("div",{onMouseDown:e=>pt("vertical",e),className:"absolute left-0 w-full h-1.5 cursor-ns-resize hover:bg-blue-500/20 transition-colors z-[70] "+(st?"top-0":"bottom-0"),"aria-hidden":!0})]}),p("div",{id:"chat-window-panel",ref:tt,role:"dialog","aria-modal":"true","aria-label":ot("openChat"),tabIndex:-1,className:`relative focus:outline-none ${lt||n?"":"w-[380px]"} ${lt||n?"":"h-[650px]"} ${n?"w-80 h-auto":""} ${lt&&!n?"w-full h-full":""} max-w-[92vw] border rounded-2xl shadow-2xl bg-white border-gray-200 flex flex-col ${n?"":"max-h-[85vh]"} overflow-hidden ${s?"bg-gray-900 border-gray-700":""}`,children:[!n&&g("div",{onMouseDown:e=>pt("corner",e),"aria-hidden":"true",className:`absolute w-4 h-4 ${nt===st?"cursor-nwse-resize":"cursor-nesw-resize"} text-gray-400 hover:text-blue-500 transition-colors z-[71] flex p-0.5 ${st?"top-0 items-start":"bottom-0 items-end"} ${nt?"left-0 justify-start":"right-0 justify-end"}`,children:g("svg",{viewBox:"0 0 12 12",className:"w-3 h-3 "+(st&&nt?"rotate-180":st?"-rotate-90":nt?"rotate-90":""),"aria-hidden":!0,children:g("path",{d:"M11 1 L1 11 M11 5 L5 11 M11 9 L9 11",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"})})}),g(jo,{conciergeName:u,companyName:m,companyLogo:b,primaryColor:c,isDark:s,isMinimized:n,textColor:Nt,fontFamily:E,fontSize:U,onToggleTheme:T,onMinimize:F,onClose:Qt,headerTextBold:_,headerTextItalic:W,headerTextColor:K,headerFontFamily:Y,headerFontSize:Q,subtitle:J,showStatus:Z,statusMode:X,officeHours:ee,onRefreshChat:He,onCopyChat:_e,defaultLanguage:q}),!n&&Ut&&!qt&&!(yt&&!kt)&&!(Se&&!Me)&&g(Ro,{categories:We,selectedCategoryId:Ye?.category||null,onSelect:$t,isDark:s,primaryColor:c,fontFamily:E,isRtl:At,defaultLanguage:q}),!n&&p(h,{children:[g("div",{ref:et,role:"log","aria-live":"polite",className:`chat-messages flex-1 overflow-y-auto px-3 py-4 space-y-4 ${s?"bg-gray-900":"bg-gradient-to-b from-gray-50/50 to-white"} break-words`,children:yt&&!kt?g("div",{className:"animate-in slide-in-from-top-4 fade-in duration-300 mt-4 mx-2",children:p("div",{className:ge("w-full rounded-3xl p-6 shadow-lg",s?"bg-gray-800 shadow-black/20":"bg-white shadow-gray-200/80"),children:[g("p",{className:ge("text-sm font-medium text-center mb-5 [font-family:inherit]",s?"text-gray-300":"text-gray-500"),children:Le||ot("feedbackPrompt")}),to(),g("textarea",{"aria-label":ot("feedbackPlaceholder"),value:Mt,onChange:e=>{e.target.value.length<=1e3&&Tt(e.target.value)},maxLength:1e3,placeholder:ot("feedbackPlaceholder"),rows:4,disabled:Ft,className:ge("w-full rounded-xl border px-4 py-3 text-sm [font-family:inherit] resize-none outline-none transition-colors mb-5",s?"bg-gray-700 border-gray-600 text-gray-100 placeholder-gray-400":"bg-gray-50 border-gray-200 text-gray-900 placeholder-gray-400")}),p("div",{className:"relative group",children:[g("button",{onClick:Yt,disabled:0===Ct||Ft,"aria-describedby":0===Ct?"resolve-rating-hint":void 0,className:ge("w-full py-3.5 rounded-xl text-sm font-semibold [font-family:inherit] transition-all duration-200 border-none outline-none focus:outline-none active:outline-none focus:ring-0 active:ring-0","disabled:opacity-50 disabled:cursor-not-allowed","focus-visible:ring-2 focus-visible:ring-blue-700",s?"bg-gray-700 text-gray-100 hover:bg-gray-600":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:ot(Ft?"submitting":"submitFeedback")}),0===Ct&&!Ft&&g("div",{id:"resolve-rating-hint",role:"tooltip",className:"absolute -top-8 left-1/2 -translate-x-1/2 whitespace-nowrap px-2 py-1 rounded-md text-xs bg-gray-800 text-white opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:ot("selectRatingFirst")})]}),Pt&&!Ft&&p("div",{role:"alert",className:"mt-3 text-center text-sm",children:[g("p",{className:s?"text-red-300":"text-red-700",children:ot("feedbackSendFailed")}),g("button",{type:"button",onClick:()=>{vt(!1),Lt(!1)},className:ge("mt-1 underline bg-transparent border-none [font-family:inherit] focus-visible:ring-2 focus-visible:ring-blue-700",s?"text-gray-200":"text-gray-700"),children:ot("backToChat")})]})]})}):Se&&!Me&&Te?g(No,{questions:Ce,onPromptSuggestionClick:it,collapsiblePrompt:Fe,onSubmit:Te,primaryColor:c,isRtl:At,isDark:s,defaultLanguage:q,fontFamily:E}):p(h,{children:[Be&&g("div",{role:"status",className:"mx-3 mt-1 mb-2 rounded-lg px-3 py-2 text-xs font-medium "+(s?"bg-amber-900/40 text-amber-200 border border-amber-700/50":"bg-amber-50 text-amber-800 border border-amber-200"),children:ot("sessionExpiringSoon")}),g(uo,{messages:y,liveJoined:je,isDark:s,primaryColor:c,isLoading:v,agentMessageBubbleColor:N,userMessageBoxColor:R,textColor:d,assistantTextColor:I,userTextColor:B,fontFamily:E,agentMessageBubbleFontFamily:D,agentMessageBubbleFontSize:V,userMessageBubbleFontFamily:O,userMessageBubbleFontSize:$,fontSize:U,formatTime:Jo,isRtl:At,defaultLanguage:q,quickQuestions:P,shouldShowQuickQuestions:Ht,onQuickQuestion:A??M,quickQuestionsLayout:j,onDecision:H,disclaimerEnabled:ce,disclaimerText:de,disclaimerPosition:ue,disclaimerLinkUrl:pe,disclaimerLinkLabel:he,resolvedAgentBubbleColor:jt,resolvedUserMessageColor:Rt,resolvedTextColor:Nt,isVoiceSessionActive:oe,voiceStatus:ae,messagesContainerRef:et,companyLogo:b,chatbotAvatarEnabled:f,chatbotAvatar:w,conciergeName:u,companyName:m,apiBaseUrl:fe,getAuthToken:ye,onPromptSuggestionClick:it,conversationResetKey:ve,allowFeedback:Oe,provideCitations:$e,onFeedback:Ue,onRetryMessage:qe,headerTextColor:K,beforePromptsSlot:qt?g(Io,{categories:We,selectedCategoryId:Ye?.category||null,onSelect:$t,isDark:s,primaryColor:c,fontFamily:E,fontSize:U,isRtl:At,label:ot("chooseTopicLabel"),regionLabel:ot("categoryFilter")}):null,quickQuestionsHeadingLabel:Ut?ot("quickQuestionsHeadingLabel"):void 0}),(mt&&ze||Ae)&&!ft&&g("div",{className:"","data-testid":"widget-csat-card",children:g(Oo,{format:Go(Ae?.format||Pe),prompt:Ae?.prompt||Le||ot("howWasYourExperience"),onRating:async(e,t)=>{wt(!0),bt(!1),(e=>{try{const t=ke(e);if(!t)return;t.csatSubmitted=!0,localStorage.setItem(`${me}_${e}`,JSON.stringify(t))}catch{}})(Xe);try{const o={"Content-Type":"application/json"};if("function"==typeof ye){const e=await ye();e&&(o.Authorization=`Bearer ${e}`)}const r=await fetch(`${fe.replace(/\/$/,"")}/api/v1/support/csat`,{method:"POST",headers:o,credentials:"include",body:JSON.stringify({conversationId:ve,rating:e,ratingFormat:t,conciergeId:xe})});r.ok||console.error("CSAT submission failed:",await r.text())}catch(e){console.error("CSAT submission error:",e)}},disabled:!1,isDark:s,primaryColor:c,defaultLanguage:q})})]})}),!(Se&&!Me)&&g(So,{onSynthesizeAssistantMessage:Je,onStopGeneration:l,inputValue:x,setInputValue:C,onSend:S,isDark:s,primaryColor:c,isOpen:e,isMinimized:n,isLoading:v,isConversationLoading:k,placeholder:It,textColor:Nt,fontFamily:E,userMessageBubbleFontFamily:O,userMessageBubbleFontSize:$,fontSize:U,isRtl:At,csatVisible:mt&&ze&&!ft||Wt&&(yt||kt),enableVoiceInteraction:te,isVoiceSessionActive:oe,voiceStatus:ae,voiceError:ie,onVoiceToggle:se,onBidiSubmit:le,disclaimerEnabled:ce,disclaimerText:de,disclaimerPosition:ue,disclaimerLinkUrl:pe,disclaimerLinkLabel:he,showPoweredBy:be,defaultLanguage:q,onboardingQuestions:Ce,onboardingActive:Se,onboardingCompleted:Me,onboardingEnabled:Re,userMessageBoxColor:R,resolvedUserMessageColor:Rt,userTextColor:B,promptSuggestions:yt||kt||!1===Ee||v?[]:eo,onPromptSuggestionClick:it,autoPromptQuestionDisplay:De,tagSelectorNode:null,showResolveButton:Wt&&Bt&&!kt&&!yt&&!mt&&!Kt,onResolve:()=>{Wt&&vt(!0)},chatFeatures:Ze,apiEndpoint:fe,organizationId:Xe,conversationId:ve})]})]})]})},Xo=new Map;const er={whatsapp:["wa.me","api.whatsapp.com"],telegram:["t.me"],messenger:["m.me"],instagram:["ig.me","instagram.com","www.instagram.com"]},tr={whatsapp:"WhatsApp",telegram:"Telegram",messenger:"Messenger",instagram:"Instagram"};const or=n(({isDark:e,primaryColor:n,onToggle:s,textColor:l,headerTextColor:c,defaultLanguage:d="en",isOpen:u=!1,className:h,channelLinks:m},b)=>{const f=t(()=>re(d),[d]),w=t(()=>function(e){if(!Array.isArray(e))return[];const t=[];for(let o=0;o<e.length;o+=1){const r=e[o];if(!r||"object"!=typeof r)continue;const a="string"==typeof r.type?r.type.toLowerCase():"",i=Object.prototype.hasOwnProperty.call(er,a)?er[a]:void 0;if(!i||"string"!=typeof r.url)continue;let n;try{n=new URL(r.url)}catch(e){continue}"https:"===n.protocol&&-1!==i.indexOf(n.hostname.toLowerCase())&&t.push({type:a,url:n.toString(),label:"string"==typeof r.label&&r.label.trim()?r.label.trim():tr[a]})}return t}(m),[m]),[y,v]=o(!1),k=w.length>0,x=r(null),C=r(null),S=a(e=>{C.current=e,"function"==typeof b?b(e):b&&(b.current=e)},[b]),M=k&&y&&!u;i(()=>{M&&function(e,t=zo){const[o]=Lo(e,t);o?.focus()}(x.current)},[M]);const T=n,F=c||"#FFFFFF",z={display:"block",width:"100%",padding:"8px 12px",textAlign:"start",fontSize:"14px",color:e?"#F1F5F9":"#0F172A",background:"transparent",border:"none",borderRadius:"6px",textDecoration:"none",cursor:"pointer"};return p("div",{className:`relative ${h||""}`,children:[M&&p("div",{ref:x,role:"menu","aria-label":f("chooseChannel"),tabIndex:-1,onKeyDown:e=>{if("Escape"===e.key)return e.preventDefault(),v(!1),void C.current?.focus();Ao(e,x.current)},"data-testid":"channel-picker",style:{position:"absolute",bottom:"76px",right:0,minWidth:"180px",padding:"6px",borderRadius:"8px",border:"1px solid "+(e?"#334155":"#E2E8F0"),background:e?"#1E293B":"#FFFFFF",boxShadow:"0 10px 30px rgba(15, 23, 42, 0.15)"},children:[g("button",{type:"button",role:"menuitem",style:z,onClick:()=>{v(!1),s?.()},children:f("chatHere")}),w.map(e=>g("a",{role:"menuitem",href:e.url,target:"_blank",rel:"noopener noreferrer",style:z,onClick:()=>v(!1),children:e.label},`${e.type}-${e.url}`))]}),p("button",{ref:S,onClick:()=>{!k||u?s?.():v(e=>!e)},className:"group relative w-16 h-16 rounded-full shadow-2xl transition-all duration-300 flex items-center justify-center text-white overflow-hidden hover:scale-110",style:{background:`linear-gradient(135deg, ${T} 0%, ${T}dd 100%)`,boxShadow:`0 10px 30px ${T}40`,border:"none"},"aria-label":f(u?"closeChat":"openChat"),"aria-expanded":k&&y||u,"aria-haspopup":k?"menu":void 0,"aria-controls":"chat-window-panel",children:[g("div",{className:"absolute inset-0 rounded-full bg-white/20 scale-0 group-hover:scale-100 transition-transform duration-500"}),g("div",{className:"relative z-10 transition-transform duration-300",children:g(Ze,{className:"w-7 h-7",style:{color:F}})})]})]})});or.displayName="ToggleButton";const rr="0.2.33",ar=function(e){if(null==e)return nr;if("function"==typeof e)return ir(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let o=-1;for(;++o<e.length;)t[o]=ar(e[o]);return ir(r);function r(...e){let o=-1;for(;++o<t.length;)if(t[o].apply(this,e))return!0;return!1}}(e):function(e){const t=e;return ir(o);function o(o){const r=o;let a;for(a in e)if(r[a]!==t[a])return!1;return!0}}(e);if("string"==typeof e)return function(e){return ir(t);function t(t){return t&&t.type===e}}(e);throw new Error("Expected function, string, or object as test")};function ir(e){return function(t,o,r){return Boolean(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof o?o:void 0,r||void 0))}}function nr(){return!0}const sr=[],lr=!0,cr=!1;function dr(e,t,o,r){let a;"function"==typeof t&&"function"!=typeof o?(r=o,o=t):a=t;const i=ar(a),n=r?-1:1;!function e(a,s,l){const c=a&&"object"==typeof a?a:{};if("string"==typeof c.type){const e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(d,"name",{value:"node ("+a.type+(e?"<"+e+">":"")+")"})}return d;function d(){let c,d,u,g=sr;if((!t||i(a,s,l[l.length-1]||void 0))&&(g=function(e){if(Array.isArray(e))return e;if("number"==typeof e)return[lr,e];return null==e?sr:[e]}(o(a,l)),g[0]===cr))return g;if("children"in a&&a.children){const t=a;if(t.children&&"skip"!==g[0])for(d=(r?t.children.length:-1)+n,u=l.concat(t);d>-1&&d<t.children.length;){const o=t.children[d];if(c=e(o,d,u)(),c[0]===cr)return c;d="number"==typeof c[1]?c[1]:d+n}}return g}}(e,void 0,[])()}function ur(e,t,o,r){let a,i,n;"function"==typeof t&&"function"!=typeof o?(i=void 0,n=t,a=o):(i=t,n=o,a=r),dr(e,i,function(e,t){const o=t[t.length-1],r=o?o.children.indexOf(e):void 0;return n(e,r,o)},a)}let gr=null;const pr=new Set;function hr(e,t){if("string"!=typeof e||""===e.trim())return!0;let o;try{o=new URL(e.trim(),t.apiOrigin||"http://relative.invalid")}catch{return!1}return!(!t.apiOrigin||o.origin!==t.apiOrigin)||"https:"===o.protocol&&!o.username&&!o.password&&t.hosts.has(o.hostname.toLowerCase())}function mr(e){const t=gr;if(!t||hr(e,t))return e;if("report"===t.mode){let t=String(e);try{t=new URL(String(e)).host}catch{}return pr.has(t)||(pr.add(t),console.warn(`[eshal-widget] would block an image from ${t}`)),e}}function br(){return e=>{const t=gr;t&&ur(e,"element",(e,o,r)=>{if("img"!==e.tagName||!r||void 0===o)return;const a=e.properties&&e.properties.src;if(hr(a,t))return;if("report"===t.mode){let e=String(a);try{e=new URL(String(a)).host}catch{}return void(pr.has(e)||(pr.add(e),console.warn(`[eshal-widget] would block an image from ${e}`)))}const i=e.properties&&"string"==typeof e.properties.alt?e.properties.alt:"";return r.children.splice(o,1,{type:"text",value:i}),o})}}const fr=({getAuthToken:n,apiBaseUrl:s,darkMode:l,primaryColor:c,position:d,companyName:u,conciergeName:h,companyLogo:m,welcomeMessage:b,quickQuestions:f,quickQuestionsEnabled:w,quickQuestionsLayout:y="vertical",textColor:v,agentMessageBubbleColor:k,userMessageBoxColor:x,assistantTextColor:C,userTextColor:S,fontFamily:M,fontSize:T,defaultLanguage:F,apiKey:z,agentMessageBubbleFontFamily:P,agentMessageBubbleFontSize:L,userMessageBubbleFontFamily:A,userMessageBubbleFontSize:j,autoOpen:N=!1,openDelay:R=0,locale:I,className:B="",headerTextBold:E,headerTextItalic:D,enableVoiceInteraction:V,disclaimerEnabled:O,disclaimerText:$,disclaimerPosition:U,disclaimerLinkUrl:q,disclaimerLinkLabel:H,showPoweredBy:_,onboardingQuestions:W,collectionPrompt:K,allowedDomains:Y,onboardingEnabled:Q,wsBaseUrl:J,channelLinks:G})=>{const[Z,X]=o(null),[ee,te]=o(!0),[oe,re]=o(null),[ae,ie]=o(!1),ne=e.useRef(!1);i(()=>{if(ne.current)return;(async()=>{if(!s)return re("apiBaseUrl is required"),void te(!1);try{te(!0);const e=await(async(e,t)=>{if(!e)throw new Error("apiBaseUrl is required");try{const o=e.replace(/\/$/,""),r=rr?`${o}/api/v1/deploy-agent?wv=${encodeURIComponent(rr)}`:`${o}/api/v1/deploy-agent`,a={"Content-Type":"application/json"};if("function"==typeof t){const e=await t();e&&(a.Authorization=`Bearer ${e}`)}const i=await fetch(r,{method:"GET",headers:a,credentials:"include"});if(404===i.status)return null;if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);return await i.json()}catch(e){throw console.error("Failed to fetch agent configuration:",e),e}})(s,n);if(null===e)return ne.current=!0,ie(!0),X(null),void re(null);!function(e,t){if(!e||"report"!==e.mode&&"enforce"!==e.mode)return void(gr=null);let o="";try{o=new URL(t).origin}catch{o=""}gr={mode:e.mode,hosts:new Set((Array.isArray(e.hosts)?e.hosts:[]).map(e=>String(e).toLowerCase())),apiOrigin:o}}(e.chatImagePolicy,s),X(e),re(null)}catch(e){console.error("Failed to load agent configuration:",e),re(e.message||"Failed to load configuration")}finally{te(!1)}})()},[s,n]);const se=t(()=>{if(!Z)return null;const e=Z.config??{},t=e.identity??{},o=e.branding??{},r=e.typography??{},a=e.messages??{},i=e.voice??{},n=e.onboarding??{},s=e.disclaimer??{},g=e.csat??{},p=e.inactivity??{},y=e.behavior??{},z=e.security??{},N=e.layout??{},R=function(e,t){return e??t?.defaultLocale??t?.config?.messages?.defaultLocale??"en"}(F,Z),I=a.bundles?.[R]??{},B=a.bundles?.en??{},J={welcome:I.welcome||B.welcome,fallback:I.fallback||B.fallback,quickQuestions:Array.isArray(I.quickQuestions)&&I.quickQuestions.length>0?I.quickQuestions:B.quickQuestions},X=Y??z.allowedDomains??(z.domains??[]).map(e=>"string"==typeof e?e:e.domain).filter(Boolean)??[];return{darkMode:l??!1,primaryColor:c??o.brandColor??"#2563eb",companyName:u??t.companyName??"Support Team",conciergeName:h??t.conciergeName,companyLogo:m??o.avatar??null,chatbotAvatarEnabled:o.chatbotAvatarEnabled??!1,chatbotAvatar:o.chatbotAvatar??null,welcomeMessage:b??J.welcome??"Hi! How can we help?",fallbackMessage:J.fallback,quickQuestions:f??J.quickQuestions??[],quickQuestionsEnabled:w??a.quickQuestionsEnabled,textColor:v??"#000000",agentMessageBubbleColor:k??r.agentMessageBubbleColor,userMessageBoxColor:x??r.userMessageBoxColor,assistantTextColor:C??r.assistantTextColor??"#000000",userTextColor:S??r.userTextColor??"#000000",fontFamily:M??r.agentMessageBubbleFontFamily??"Inter",fontSize:T??r.agentMessageBubbleFontSize??"14px",defaultLanguage:R,headerTextBold:E??r.headerTextBold??!1,headerTextItalic:D??r.headerTextItalic??!1,headerTextColor:r.headerTextColor??"#FFFFFF",headerFontFamily:r.headerFontFamily,headerFontSize:r.headerFontSize,subtitle:t.subtitle??null,showStatus:t.showStatus??!1,statusMode:t.statusMode??"always",officeHours:t.officeHours??null,enableVoiceInteraction:V??i.enableVoiceInteraction??!1,disclaimerEnabled:O??s.enabled??!1,disclaimerText:$??s.text,disclaimerPosition:U??(ee=s.position,ee?ee.toLowerCase():"top"),disclaimerLinkUrl:ue(q??s.linkUrl),disclaimerLinkLabel:H??s.linkLabel,showPoweredBy:_??o.showPoweredBy??!0,onboardingQuestions:W??n.questions??[],collectionPrompt:K??n.collapsiblePrompt??"Before we begin, I need to verify your details.",allowedDomains:X,launcherPosition:d??(e=>e?e.toLowerCase().replace(/_/g,"-"):"bottom-right")(N.launcherPosition),onboardingEnabled:Q??n.enabled??!1,inactivityTimeoutValue:p.timeoutValue??null,inactivityTimeoutUnit:p.timeoutUnit??null,agentMessageBubbleFontFamily:P??r.agentMessageBubbleFontFamily??M??"Inter",agentMessageBubbleFontSize:L??r.agentMessageBubbleFontSize??T??"14px",userMessageBubbleFontFamily:A??r.userMessageBubbleFontFamily??M??"Inter",userMessageBubbleFontSize:j??r.userMessageBubbleFontSize??T??"14px",csatEnabled:g.enabled??!1,csatFormat:g.format??"EMOJI",csatPrompt:g.prompt??"How was your experience?",autoPromptEnabled:y.autoPromptEnabled??!0,autoPromptQuestionDisplay:y.autoPromptQuestionDisplay??!0,autoPromptClickTelemetry:y.autoPromptClickTelemetry??!0,allowFeedback:y.allowFeedback??!0,provideCitations:y.provideCitations??!0,organizationId:Z.organizationId??null,chatFeatures:e.chatFeatures??null,channelLinks:G??e.channelLinks??null};var ee},[G,Z,l,c,d,u,h,m,b,f,w,v,k,x,C,S,M,T,F,E,D,V,O,$,U,H,q,_,W,Q,K,Y,P,L,A,j]),le=t(()=>!se||((e=[])=>{if("undefined"==typeof window)return!1;const t=window.location.hostname.toLowerCase(),o=window.location.host.toLowerCase();return!(!e||0===e.length)&&e.some(e=>{const r=e.toLowerCase().trim();return r.includes(":")?o===r:t===r||t.endsWith("."+r)})})(se.allowedDomains),[se]),ce=t(()=>({welcomeMessage:"Hi! How can we help?",quickQuestions:[],apiBaseUrl:s||"",apiKey:z||"",getAuthToken:n,autoOpen:!1,openDelay:0,darkMode:!1,enableVoiceInteraction:!1,onboardingQuestions:[],onboardingEnabled:!1,collectionPrompt:void 0}),[s,z,n]),{isOpen:de,isMinimized:ge,isDark:pe,messages:he,inputValue:me,isLoading:be,widgetRef:fe,setInputValue:we,handleSend:ye,stopGeneration:ve,handleQuickQuestion:ke,sendMessage:xe,retryMessage:Ce,toggleChat:Se,toggleTheme:Me,toggleMinimize:Te,closeChat:Fe,handleDecision:ze,isVoiceSessionActive:Pe,voiceStatus:Le,voiceError:Ae,voiceConclusionForCsat:je,handleVoiceToggle:Ne,sendBidiTextMessage:Re,onboardingActive:Ie,onboardingCompleted:Ee,handleOnboardingFormSubmit:De,conversationId:Ve,resetConversation:Oe,sessionExpiringSoon:$e,updateMessageFeedback:Ue,widgetFilter:qe,setWidgetFilter:He,addAssistantMessage:_e,csatRequest:We,liveJoined:Ke}=Be(se?{welcomeMessage:se.welcomeMessage,fallbackMessage:se.fallbackMessage,quickQuestions:se.quickQuestions,apiBaseUrl:s,wsBaseUrl:J??Z?.wsBaseUrl,apiKey:z,locale:se.defaultLanguage||I,organizationId:se.organizationId,getAuthToken:n,autoOpen:N,openDelay:R,darkMode:se.darkMode,enableVoiceInteraction:se.enableVoiceInteraction,onboardingQuestions:se.onboardingQuestions,onboardingEnabled:se.onboardingEnabled,collectionPrompt:se.collectionPrompt,provideCitations:se.provideCitations,inactivityTimeoutValue:se.inactivityTimeoutValue,inactivityTimeoutUnit:se.inactivityTimeoutUnit,messageLimits:Z?.messageLimits}:ce),Ye=r(null),Qe=r(de);i(()=>{Qe.current&&!de&&Ye.current?.focus(),Qe.current=de},[de]);const Je=a((e,t,o)=>{if(Ue(e,t),!Ve||!s)return;const r=s.replace(/\/$/,"");(async()=>{try{const a={"Content-Type":"application/json"};if("function"==typeof n){const e=await n();e&&(a.Authorization=`Bearer ${e}`)}await fetch(`${r}/api/v1/support/feedback`,{method:"POST",headers:a,credentials:"include",body:JSON.stringify({messageContent:e,conversationId:Ve,feedback:t,feedbackText:o})})}catch(e){console.error("Feedback submission error:",e)}})()},[Ve,s,n,Ue]),Ge=a(()=>{Oe&&Oe()},[Oe]),{categories:Ze,hasFilters:Xe}=function(e,r){const a=!!e,[n,s]=o({categories:[],loading:a,error:null});i(()=>{if(!e)return void s({categories:[],loading:!1,error:null});const t=r?`${e}|__session__`:`${e}|__proxy__`,o=Xo.get(t);if(o)return void s({categories:o,loading:!1,error:null});let a=!1;s(e=>({...e,loading:!0,error:null}));const i=`${e.replace(/\/$/,"")}/api/v1/widget/filters`;return(async()=>{try{const e={Accept:"application/json"};if("function"==typeof r){const t=await r();t&&(e.Authorization=`Bearer ${t}`)}const o=await fetch(i,{method:"GET",headers:e});if(!o.ok)throw new Error(`filter catalog HTTP ${o.status}`);const n=await o.json(),l=Array.isArray(n?.categories)?n.categories:[];if(a)return;Xo.set(t,l),s({categories:l,loading:!1,error:null})}catch(e){if(a)return;console.warn("[useFilterCatalog] catalog fetch failed:",e),s({categories:[],loading:!1,error:e})}})(),()=>{a=!0}},[e,r]);const l=t(()=>Array.isArray(n.categories)&&n.categories.length>0,[n.categories]);return{...n,hasFilters:l}}(s,n),et=a(()=>{const e=he.filter(e=>e.content&&""!==e.content.trim()).map(e=>`${"user"===e.role?"You":se?.conciergeName||"Assistant"}: ${e.content}`).join("\n\n");e&&navigator.clipboard.writeText(e).catch(()=>{})},[he,se?.conciergeName]);if(i(()=>{fe.current&&se&&(fe.current.style.setProperty("--cw-primary",se.primaryColor),se.fontFamily&&fe.current.style.setProperty("--cw-font-family",se.fontFamily),se.textColor&&fe.current.style.setProperty("--cw-text-color",se.textColor))},[se,fe]),ee)return null;if(ae)return null;if(oe||!se)return console.error("ChatWidget configuration error:",oe),null;if(!le)return null;const tt={"bottom-right":"bottom-5 right-5","bottom-left":"bottom-5 left-5","top-right":"top-5 right-5","top-left":"top-5 left-5"};return g("div",{id:"chat-widget-root",children:p("div",{ref:fe,className:`chat-widget-root fixed flex flex-col ${se.launcherPosition?.includes("left")?"items-start":"items-end"} z-[999999] ${pe?"dark":""} ${B} ${tt[se.launcherPosition]||tt["bottom-right"]}`,children:[g(Zo,{isOpen:de,isMinimized:ge,isDark:pe,launcherPosition:se.launcherPosition,primaryColor:se.primaryColor,textColor:se.textColor,companyName:se.companyName,conciergeName:se.conciergeName,companyLogo:se.companyLogo,chatbotAvatarEnabled:se.chatbotAvatarEnabled,chatbotAvatar:se.chatbotAvatar,messages:he,isLoading:be,inputValue:me,setInputValue:we,onSend:ye,onStopGeneration:ve,onDirectSend:xe,onToggleTheme:Me,onMinimize:Te,onClose:Fe,quickQuestions:se.quickQuestions,quickQuestionsEnabled:se.quickQuestionsEnabled,onQuickQuestion:ke,quickQuestionsLayout:y,agentMessageBubbleColor:se.agentMessageBubbleColor,userMessageBoxColor:se.userMessageBoxColor,assistantTextColor:se.assistantTextColor,userTextColor:se.userTextColor,fontFamily:se.fontFamily,agentMessageBubbleFontFamily:se.agentMessageBubbleFontFamily,agentMessageBubbleFontSize:se.agentMessageBubbleFontSize,userMessageBubbleFontFamily:se.userMessageBubbleFontFamily,userMessageBubbleFontSize:se.userMessageBubbleFontSize,fontSize:se.fontSize,defaultLanguage:se.defaultLanguage||I,onDecision:ze,headerTextBold:se.headerTextBold,headerTextItalic:se.headerTextItalic,headerTextColor:se.headerTextColor,headerFontFamily:se.headerFontFamily,headerFontSize:se.headerFontSize,subtitle:se.subtitle,showStatus:se.showStatus,statusMode:se.statusMode,officeHours:se.officeHours,enableVoiceInteraction:se.enableVoiceInteraction,isVoiceSessionActive:Pe,voiceStatus:Le,voiceError:Ae,voiceConclusionForCsat:je,onVoiceToggle:Ne,onBidiSubmit:()=>Re(me),disclaimerEnabled:se.disclaimerEnabled,disclaimerText:se.disclaimerText,disclaimerPosition:se.disclaimerPosition,disclaimerLinkUrl:se.disclaimerLinkUrl,disclaimerLinkLabel:se.disclaimerLinkLabel,showPoweredBy:se.showPoweredBy,apiBaseUrl:s,apiKey:z,getAuthToken:n,conversationId:Ve,conciergeId:Z?.conciergeId??Z?.id,onboardingQuestions:se.onboardingQuestions,onboardingActive:Ie,onboardingCompleted:Ee,onOnboardingFormSubmit:De,collectionPrompt:se.collectionPrompt,csatEnabled:se.csatEnabled,csatFormat:se.csatFormat,csatPrompt:se.csatPrompt,csatRequest:We,liveJoined:Ke,onboardingEnabled:se.onboardingEnabled,onResetConversation:Oe,sessionExpiringSoon:$e,autoPromptEnabled:se.autoPromptEnabled,autoPromptQuestionDisplay:se.autoPromptQuestionDisplay,autoPromptClickTelemetry:se.autoPromptClickTelemetry,allowFeedback:se.allowFeedback,provideCitations:se.provideCitations,onFeedback:Je,onRetryMessage:Ce,onRefreshChat:Ge,onCopyChat:et,filterCategories:Ze,showFilterStep:Xe,widgetFilter:qe,onWidgetFilterChange:He,onSynthesizeAssistantMessage:_e,chatFeatures:se.chatFeatures,organizationId:se.organizationId}),g(or,{ref:Ye,isDark:pe,primaryColor:se.primaryColor,onToggle:Se,textColor:se.textColor,headerTextColor:se.headerTextColor,defaultLanguage:se.defaultLanguage||I,isOpen:de,className:de?"hidden":void 0,channelLinks:se.channelLinks})]})})};function wr(t){const o=r(null),a=r(null);return i(()=>{const e=o.current;if(!e||e.shadowRoot)return;const t=e.attachShadow({mode:"open"}),r=document.createElement("style");r.textContent=":host { all: initial; display: block; }",t.appendChild(r);const i=document.createElement("style");i.textContent='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.chat-widget-root{--cw-primary:#1d4ed8;--cw-primary-hover:#1e40af;--cw-status-success:160 84% 39%;--cw-status-success-bg:152 81% 96%;--cw-status-warning:35 100% 50%;--cw-status-warning-bg:34 100% 95%;--cw-status-error:350 89% 60%;--cw-status-error-bg:356 100% 97%;--cw-status-info:199 89% 48%;--cw-status-info-bg:204 100% 97%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}.chat-widget-root.dark{--cw-status-success:158 64% 52%;--cw-status-success-bg:152 36% 14%;--cw-status-warning:38 92% 60%;--cw-status-warning-bg:36 33% 14%;--cw-status-error:350 89% 65%;--cw-status-error-bg:356 33% 16%;--cw-status-info:199 89% 58%;--cw-status-info-bg:204 33% 14%}.\\!container{width:100%!important}.container{width:100%}@media (min-width:640px){.\\!container{max-width:640px!important}.container{max-width:640px}}@media (min-width:768px){.\\!container{max-width:768px!important}.container{max-width:768px}}@media (min-width:1024px){.\\!container{max-width:1024px!important}.container{max-width:1024px}}@media (min-width:1280px){.\\!container{max-width:1280px!important}.container{max-width:1280px}}@media (min-width:1536px){.\\!container{max-width:1536px!important}.container{max-width:1536px}}#chat-widget-root .chat-widget-root *{box-sizing:border-box;margin:0;padding:0}#chat-widget-root .chat-messages::-webkit-scrollbar{width:6px}#chat-widget-root .chat-messages::-webkit-scrollbar-track{background:transparent}#chat-widget-root .chat-messages::-webkit-scrollbar-thumb{background:rgba(156,163,175,.5);border-radius:10px}#chat-widget-root .chat-messages::-webkit-scrollbar-thumb:hover{background:rgba(156,163,175,.7)}#chat-widget-root .dark .chat-messages::-webkit-scrollbar-thumb{background:rgba(75,85,99,.5)}#chat-widget-root .dark .chat-messages::-webkit-scrollbar-thumb:hover{background:rgba(75,85,99,.7)}#chat-widget-root .sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#chat-widget-root .pointer-events-none{pointer-events:none}#chat-widget-root .visible{visibility:visible}#chat-widget-root .invisible{visibility:hidden}#chat-widget-root .collapse{visibility:collapse}#chat-widget-root .static{position:static}#chat-widget-root .fixed{position:fixed}#chat-widget-root .absolute{position:absolute}#chat-widget-root .relative{position:relative}#chat-widget-root .sticky{position:sticky}#chat-widget-root .inset-0{inset:0}#chat-widget-root .-top-8{top:-2rem}#chat-widget-root .bottom-0{bottom:0}#chat-widget-root .bottom-5{bottom:1.25rem}#chat-widget-root .bottom-full{bottom:100%}#chat-widget-root .left-0{left:0}#chat-widget-root .left-1\\/2{left:50%}#chat-widget-root .left-5{left:1.25rem}#chat-widget-root .right-0{right:0}#chat-widget-root .right-5{right:1.25rem}#chat-widget-root .top-0{top:0}#chat-widget-root .top-1\\/2{top:50%}#chat-widget-root .top-5{top:1.25rem}#chat-widget-root .top-full{top:100%}#chat-widget-root .isolate{isolation:isolate}#chat-widget-root .z-10{z-index:10}#chat-widget-root .z-50{z-index:50}#chat-widget-root .z-\\[60\\]{z-index:60}#chat-widget-root .z-\\[70\\]{z-index:70}#chat-widget-root .z-\\[71\\]{z-index:71}#chat-widget-root .z-\\[999999\\]{z-index:999999}#chat-widget-root .z-\\[9999\\]{z-index:9999}#chat-widget-root .m-0{margin:0}#chat-widget-root .mx-2{margin-left:.5rem;margin-right:.5rem}#chat-widget-root .mx-3{margin-left:.75rem;margin-right:.75rem}#chat-widget-root .my-3{margin-bottom:.75rem;margin-top:.75rem}#chat-widget-root .my-4{margin-bottom:1rem;margin-top:1rem}#chat-widget-root .-mb-px{margin-bottom:-1px}#chat-widget-root .mb-1{margin-bottom:.25rem}#chat-widget-root .mb-1\\.5{margin-bottom:.375rem}#chat-widget-root .mb-2{margin-bottom:.5rem}#chat-widget-root .mb-3{margin-bottom:.75rem}#chat-widget-root .mb-4{margin-bottom:1rem}#chat-widget-root .mb-5{margin-bottom:1.25rem}#chat-widget-root .ml-1{margin-left:.25rem}#chat-widget-root .ms-0\\.5{margin-inline-start:.125rem}#chat-widget-root .mt-0\\.5{margin-top:.125rem}#chat-widget-root .mt-1{margin-top:.25rem}#chat-widget-root .mt-1\\.5{margin-top:.375rem}#chat-widget-root .mt-2{margin-top:.5rem}#chat-widget-root .mt-3{margin-top:.75rem}#chat-widget-root .mt-4{margin-top:1rem}#chat-widget-root .block{display:block}#chat-widget-root .inline-block{display:inline-block}#chat-widget-root .inline{display:inline}#chat-widget-root .flex{display:flex}#chat-widget-root .inline-flex{display:inline-flex}#chat-widget-root .table{display:table}#chat-widget-root .grid{display:grid}#chat-widget-root .hidden{display:none}#chat-widget-root .h-1\\.5{height:.375rem}#chat-widget-root .h-10{height:2.5rem}#chat-widget-root .h-11{height:2.75rem}#chat-widget-root .h-12{height:3rem}#chat-widget-root .h-16{height:4rem}#chat-widget-root .h-2{height:.5rem}#chat-widget-root .h-3{height:.75rem}#chat-widget-root .h-3\\.5{height:.875rem}#chat-widget-root .h-4{height:1rem}#chat-widget-root .h-5{height:1.25rem}#chat-widget-root .h-6{height:1.5rem}#chat-widget-root .h-7{height:1.75rem}#chat-widget-root .h-8{height:2rem}#chat-widget-root .h-\\[650px\\]{height:650px}#chat-widget-root .h-auto{height:auto}#chat-widget-root .h-full{height:100%}#chat-widget-root .h-px{height:1px}#chat-widget-root .max-h-\\[85vh\\]{max-height:85vh}#chat-widget-root .min-h-0{min-height:0}#chat-widget-root .min-h-\\[48px\\]{min-height:48px}#chat-widget-root .w-1\\.5{width:.375rem}#chat-widget-root .w-10{width:2.5rem}#chat-widget-root .w-11{width:2.75rem}#chat-widget-root .w-12{width:3rem}#chat-widget-root .w-16{width:4rem}#chat-widget-root .w-2{width:.5rem}#chat-widget-root .w-3{width:.75rem}#chat-widget-root .w-3\\.5{width:.875rem}#chat-widget-root .w-4{width:1rem}#chat-widget-root .w-44{width:11rem}#chat-widget-root .w-5{width:1.25rem}#chat-widget-root .w-6{width:1.5rem}#chat-widget-root .w-7{width:1.75rem}#chat-widget-root .w-8{width:2rem}#chat-widget-root .w-80{width:20rem}#chat-widget-root .w-96{width:24rem}#chat-widget-root .w-\\[380px\\]{width:380px}#chat-widget-root .w-full{width:100%}#chat-widget-root .min-w-0{min-width:0}#chat-widget-root .min-w-\\[60px\\]{min-width:60px}#chat-widget-root .min-w-full{min-width:100%}#chat-widget-root .max-w-\\[75\\%\\]{max-width:75%}#chat-widget-root .max-w-\\[92vw\\]{max-width:92vw}#chat-widget-root .max-w-full{max-width:100%}#chat-widget-root .max-w-none{max-width:none}#chat-widget-root .max-w-sm{max-width:24rem}#chat-widget-root .max-w-xs{max-width:20rem}#chat-widget-root .flex-1{flex:1 1 0%}#chat-widget-root .flex-shrink-0,#chat-widget-root .shrink-0{flex-shrink:0}#chat-widget-root .grow{flex-grow:1}#chat-widget-root .border-collapse{border-collapse:collapse}#chat-widget-root .-translate-x-1\\/2{--tw-translate-x:-50%}#chat-widget-root .-translate-x-1\\/2,#chat-widget-root .-translate-y-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .-translate-y-1\\/2{--tw-translate-y:-50%}#chat-widget-root .-rotate-90{--tw-rotate:-90deg}#chat-widget-root .-rotate-90,#chat-widget-root .rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .rotate-180{--tw-rotate:180deg}#chat-widget-root .rotate-90{--tw-rotate:90deg}#chat-widget-root .rotate-90,#chat-widget-root .scale-0{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .scale-0{--tw-scale-x:0;--tw-scale-y:0}#chat-widget-root .scale-100{--tw-scale-x:1;--tw-scale-y:1}#chat-widget-root .scale-100,#chat-widget-root .scale-110{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .scale-110{--tw-scale-x:1.1;--tw-scale-y:1.1}#chat-widget-root .scale-125{--tw-scale-x:1.25;--tw-scale-y:1.25}#chat-widget-root .scale-125,#chat-widget-root .scale-95{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .scale-95{--tw-scale-x:.95;--tw-scale-y:.95}#chat-widget-root .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}}#chat-widget-root .animate-bounce{animation:bounce 1s infinite}@keyframes pulse{50%{opacity:.5}}#chat-widget-root .animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(1turn)}}#chat-widget-root .animate-spin{animation:spin 1s linear infinite}#chat-widget-root .cursor-ew-resize{cursor:ew-resize}#chat-widget-root .cursor-nesw-resize{cursor:nesw-resize}#chat-widget-root .cursor-not-allowed{cursor:not-allowed}#chat-widget-root .cursor-ns-resize{cursor:ns-resize}#chat-widget-root .cursor-nwse-resize{cursor:nwse-resize}#chat-widget-root .cursor-pointer{cursor:pointer}#chat-widget-root .resize-none{resize:none}#chat-widget-root .resize{resize:both}#chat-widget-root .list-decimal{list-style-type:decimal}#chat-widget-root .list-disc{list-style-type:disc}#chat-widget-root .list-none{list-style-type:none}#chat-widget-root .flex-row{flex-direction:row}#chat-widget-root .flex-row-reverse{flex-direction:row-reverse}#chat-widget-root .flex-col{flex-direction:column}#chat-widget-root .flex-wrap{flex-wrap:wrap}#chat-widget-root .items-start{align-items:flex-start}#chat-widget-root .items-end{align-items:flex-end}#chat-widget-root .items-center{align-items:center}#chat-widget-root .justify-start{justify-content:flex-start}#chat-widget-root .justify-end{justify-content:flex-end}#chat-widget-root .justify-center{justify-content:center}#chat-widget-root .justify-between{justify-content:space-between}#chat-widget-root .gap-0{gap:0}#chat-widget-root .gap-0\\.5{gap:.125rem}#chat-widget-root .gap-1{gap:.25rem}#chat-widget-root .gap-1\\.5{gap:.375rem}#chat-widget-root .gap-2{gap:.5rem}#chat-widget-root .gap-2\\.5{gap:.625rem}#chat-widget-root .gap-3{gap:.75rem}#chat-widget-root .gap-4{gap:1rem}#chat-widget-root .gap-6{gap:1.5rem}#chat-widget-root :is(.space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#chat-widget-root :is(.space-y-4>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#chat-widget-root .overflow-hidden{overflow:hidden}#chat-widget-root .overflow-visible{overflow:visible}#chat-widget-root .overflow-x-auto{overflow-x:auto}#chat-widget-root .overflow-y-auto{overflow-y:auto}#chat-widget-root .truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#chat-widget-root .whitespace-nowrap{white-space:nowrap}#chat-widget-root .whitespace-pre-wrap{white-space:pre-wrap}#chat-widget-root .break-words{overflow-wrap:break-word}#chat-widget-root .break-all{word-break:break-all}#chat-widget-root .rounded{border-radius:.25rem}#chat-widget-root .rounded-2xl{border-radius:1rem}#chat-widget-root .rounded-3xl{border-radius:1.5rem}#chat-widget-root .rounded-full{border-radius:9999px}#chat-widget-root .rounded-lg{border-radius:.5rem}#chat-widget-root .rounded-md{border-radius:.375rem}#chat-widget-root .rounded-xl{border-radius:.75rem}#chat-widget-root .rounded-t-2xl{border-top-left-radius:1rem;border-top-right-radius:1rem}#chat-widget-root .rounded-tl-sm{border-top-left-radius:.125rem}#chat-widget-root .rounded-tr-sm{border-top-right-radius:.125rem}#chat-widget-root .border{border-width:1px}#chat-widget-root .border-0{border-width:0}#chat-widget-root .border-b{border-bottom-width:1px}#chat-widget-root .border-l-4{border-left-width:4px}#chat-widget-root .border-t{border-top-width:1px}#chat-widget-root .border-t-2{border-top-width:2px}#chat-widget-root .border-dotted{border-style:dotted}#chat-widget-root .border-none{border-style:none}#chat-widget-root .\\!border-status-error{border-color:hsl(var(--cw-status-error))!important}#chat-widget-root .border-amber-200{--tw-border-opacity:1;border-color:rgb(253 230 138/var(--tw-border-opacity,1))}#chat-widget-root .border-amber-700\\/50{border-color:rgba(180,83,9,.5)}#chat-widget-root .border-blue-200{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity,1))}#chat-widget-root .border-blue-700\\/50{border-color:rgba(29,78,216,.5)}#chat-widget-root .border-gray-100{--tw-border-opacity:1;border-color:rgb(243 244 246/var(--tw-border-opacity,1))}#chat-widget-root .border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}#chat-widget-root .border-gray-200\\/60{border-color:rgba(229,231,235,.6)}#chat-widget-root .border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}#chat-widget-root .border-gray-600{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity,1))}#chat-widget-root .border-gray-700{--tw-border-opacity:1;border-color:rgb(55 65 81/var(--tw-border-opacity,1))}#chat-widget-root .border-gray-700\\/50{border-color:rgba(55,65,81,.5)}#chat-widget-root .border-transparent{border-color:transparent}#chat-widget-root .bg-amber-50{--tw-bg-opacity:1;background-color:rgb(255 251 235/var(--tw-bg-opacity,1))}#chat-widget-root .bg-amber-900\\/40{background-color:rgba(120,53,15,.4)}#chat-widget-root .bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}#chat-widget-root .bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}#chat-widget-root .bg-blue-900\\/30{background-color:rgba(30,58,138,.3)}#chat-widget-root .bg-current{background-color:currentColor}#chat-widget-root .bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gray-50\\/30{background-color:rgba(249,250,251,.3)}#chat-widget-root .bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gray-700\\/50{background-color:rgba(55,65,81,.5)}#chat-widget-root .bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gray-800\\/50{background-color:rgba(31,41,55,.5)}#chat-widget-root .bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}#chat-widget-root .bg-green-200{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity,1))}#chat-widget-root .bg-orange-200{--tw-bg-opacity:1;background-color:rgb(254 215 170/var(--tw-bg-opacity,1))}#chat-widget-root .bg-pink-200{--tw-bg-opacity:1;background-color:rgb(251 207 232/var(--tw-bg-opacity,1))}#chat-widget-root .bg-red-200{--tw-bg-opacity:1;background-color:rgb(254 202 202/var(--tw-bg-opacity,1))}#chat-widget-root .bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}#chat-widget-root .bg-slate-50\\/50{background-color:rgba(248,250,252,.5)}#chat-widget-root .bg-slate-800\\/50{background-color:rgba(30,41,59,.5)}#chat-widget-root .bg-transparent{background-color:transparent}#chat-widget-root .bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}#chat-widget-root .bg-white\\/10{background-color:hsla(0,0%,100%,.1)}#chat-widget-root .bg-white\\/20{background-color:hsla(0,0%,100%,.2)}#chat-widget-root .bg-yellow-200{--tw-bg-opacity:1;background-color:rgb(254 240 138/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}#chat-widget-root .bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}#chat-widget-root .from-gray-50\\/50{--tw-gradient-from:rgba(249,250,251,.5) var(--tw-gradient-from-position);--tw-gradient-to:rgba(249,250,251,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}#chat-widget-root .from-white\\/0{--tw-gradient-from:hsla(0,0%,100%,0) var(--tw-gradient-from-position);--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}#chat-widget-root .from-white\\/10{--tw-gradient-from:hsla(0,0%,100%,.1) var(--tw-gradient-from-position);--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}#chat-widget-root .from-yellow-200{--tw-gradient-from:#fef08a var(--tw-gradient-from-position);--tw-gradient-to:hsla(53,98%,77%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}#chat-widget-root .via-white\\/5{--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),hsla(0,0%,100%,.05) var(--tw-gradient-via-position),var(--tw-gradient-to)}#chat-widget-root .to-white{--tw-gradient-to:#fff var(--tw-gradient-to-position)}#chat-widget-root .to-white\\/10{--tw-gradient-to:hsla(0,0%,100%,.1) var(--tw-gradient-to-position)}#chat-widget-root .to-yellow-400{--tw-gradient-to:#facc15 var(--tw-gradient-to-position)}#chat-widget-root .object-contain{-o-object-fit:contain;object-fit:contain}#chat-widget-root .p-0{padding:0}#chat-widget-root .p-0\\.5{padding:.125rem}#chat-widget-root .p-3{padding:.75rem}#chat-widget-root .p-5{padding:1.25rem}#chat-widget-root .p-6{padding:1.5rem}#chat-widget-root .p-8{padding:2rem}#chat-widget-root .px-1{padding-left:.25rem;padding-right:.25rem}#chat-widget-root .px-2{padding-left:.5rem;padding-right:.5rem}#chat-widget-root .px-2\\.5{padding-left:.625rem;padding-right:.625rem}#chat-widget-root .px-3{padding-left:.75rem;padding-right:.75rem}#chat-widget-root .px-4{padding-left:1rem;padding-right:1rem}#chat-widget-root .px-5{padding-left:1.25rem;padding-right:1.25rem}#chat-widget-root .py-1{padding-bottom:.25rem;padding-top:.25rem}#chat-widget-root .py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}#chat-widget-root .py-12{padding-bottom:3rem;padding-top:3rem}#chat-widget-root .py-2{padding-bottom:.5rem;padding-top:.5rem}#chat-widget-root .py-2\\.5{padding-bottom:.625rem;padding-top:.625rem}#chat-widget-root .py-3{padding-bottom:.75rem;padding-top:.75rem}#chat-widget-root .py-3\\.5{padding-bottom:.875rem;padding-top:.875rem}#chat-widget-root .py-4{padding-bottom:1rem;padding-top:1rem}#chat-widget-root .pb-1{padding-bottom:.25rem}#chat-widget-root .pb-2{padding-bottom:.5rem}#chat-widget-root .pl-1{padding-left:.25rem}#chat-widget-root .pl-2{padding-left:.5rem}#chat-widget-root .pl-4{padding-left:1rem}#chat-widget-root .pl-\\[50px\\]{padding-left:50px}#chat-widget-root .pr-1{padding-right:.25rem}#chat-widget-root .pt-1{padding-top:.25rem}#chat-widget-root .text-left{text-align:left}#chat-widget-root .text-center{text-align:center}#chat-widget-root .text-right{text-align:right}#chat-widget-root .text-start{text-align:start}#chat-widget-root .align-text-bottom{vertical-align:text-bottom}#chat-widget-root .font-sans{font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}#chat-widget-root .text-2xl{font-size:1.5rem;line-height:2rem}#chat-widget-root .text-\\[10px\\]{font-size:10px}#chat-widget-root .text-base{font-size:1rem;line-height:1.5rem}#chat-widget-root .text-chip{font-size:11px;letter-spacing:0;line-height:1.4}#chat-widget-root .text-h4{font-size:18px;letter-spacing:0;line-height:1.3}#chat-widget-root .text-lg{font-size:1.125rem;line-height:1.75rem}#chat-widget-root .text-sm{font-size:.875rem;line-height:1.25rem}#chat-widget-root .text-xl{font-size:1.25rem;line-height:1.75rem}#chat-widget-root .text-xs{font-size:.75rem;line-height:1rem}#chat-widget-root .font-bold{font-weight:700}#chat-widget-root .font-medium{font-weight:500}#chat-widget-root .font-semibold{font-weight:600}#chat-widget-root .uppercase{text-transform:uppercase}#chat-widget-root .lowercase{text-transform:lowercase}#chat-widget-root .italic{font-style:italic}#chat-widget-root .tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}#chat-widget-root .leading-5{line-height:1.25rem}#chat-widget-root .leading-none{line-height:1}#chat-widget-root .leading-normal{line-height:1.5}#chat-widget-root .leading-relaxed{line-height:1.625}#chat-widget-root .leading-snug{line-height:1.375}#chat-widget-root .tracking-wide{letter-spacing:.025em}#chat-widget-root .text-\\[\\#4A5568\\]{--tw-text-opacity:1;color:rgb(74 85 104/var(--tw-text-opacity,1))}#chat-widget-root .text-amber-200{--tw-text-opacity:1;color:rgb(253 230 138/var(--tw-text-opacity,1))}#chat-widget-root .text-amber-800{--tw-text-opacity:1;color:rgb(146 64 14/var(--tw-text-opacity,1))}#chat-widget-root .text-current{color:currentColor}#chat-widget-root .text-gray-100{--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-200{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-500\\/80{color:hsla(220,9%,46%,.8)}#chat-widget-root .text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}#chat-widget-root .text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}#chat-widget-root .text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}#chat-widget-root .text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}#chat-widget-root .text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}#chat-widget-root .text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity,1))}#chat-widget-root .text-slate-500{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}#chat-widget-root .text-status-error{color:hsl(var(--cw-status-error))}#chat-widget-root .text-status-success{color:hsl(var(--cw-status-success))}#chat-widget-root .text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}#chat-widget-root .text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21/var(--tw-text-opacity,1))}#chat-widget-root .underline{text-decoration-line:underline}#chat-widget-root .no-underline{text-decoration-line:none}#chat-widget-root .placeholder-gray-400::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity,1))}#chat-widget-root .placeholder-gray-400::placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity,1))}#chat-widget-root .placeholder-gray-500::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(107 114 128/var(--tw-placeholder-opacity,1))}#chat-widget-root .placeholder-gray-500::placeholder{--tw-placeholder-opacity:1;color:rgb(107 114 128/var(--tw-placeholder-opacity,1))}#chat-widget-root .opacity-0{opacity:0}#chat-widget-root .opacity-50{opacity:.5}#chat-widget-root .opacity-60{opacity:.6}#chat-widget-root .opacity-70{opacity:.7}#chat-widget-root .opacity-75{opacity:.75}#chat-widget-root .opacity-80{opacity:.8}#chat-widget-root .shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}#chat-widget-root .shadow,#chat-widget-root .shadow-2xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#chat-widget-root .shadow-2xl{--tw-shadow:0 25px 50px -12px rgba(0,0,0,.25);--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color)}#chat-widget-root .shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}#chat-widget-root .shadow-lg,#chat-widget-root .shadow-md{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#chat-widget-root .shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}#chat-widget-root .shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}#chat-widget-root .shadow-sm,#chat-widget-root .shadow-xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#chat-widget-root .shadow-xl{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color)}#chat-widget-root .shadow-black\\/20{--tw-shadow-color:rgba(0,0,0,.2);--tw-shadow:var(--tw-shadow-colored)}#chat-widget-root .shadow-gray-200\\/80{--tw-shadow-color:rgba(229,231,235,.8);--tw-shadow:var(--tw-shadow-colored)}#chat-widget-root .outline-none{outline:2px solid transparent;outline-offset:2px}#chat-widget-root .outline{outline-style:solid}#chat-widget-root .ring{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color)}#chat-widget-root .ring,#chat-widget-root .ring-2{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#chat-widget-root .ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)}#chat-widget-root .ring-blue-100{--tw-ring-opacity:1;--tw-ring-color:rgb(219 234 254/var(--tw-ring-opacity,1))}#chat-widget-root .ring-blue-300{--tw-ring-opacity:1;--tw-ring-color:rgb(147 197 253/var(--tw-ring-opacity,1))}#chat-widget-root .ring-white{--tw-ring-opacity:1;--tw-ring-color:rgb(255 255 255/var(--tw-ring-opacity,1))}#chat-widget-root .blur{--tw-blur:blur(8px)}#chat-widget-root .blur,#chat-widget-root .drop-shadow{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}#chat-widget-root .drop-shadow{--tw-drop-shadow:drop-shadow(0 1px 2px rgba(0,0,0,.1)) drop-shadow(0 1px 1px rgba(0,0,0,.06))}#chat-widget-root .drop-shadow-md{--tw-drop-shadow:drop-shadow(0 4px 3px rgba(0,0,0,.07)) drop-shadow(0 2px 2px rgba(0,0,0,.06))}#chat-widget-root .drop-shadow-md,#chat-widget-root .drop-shadow-sm{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}#chat-widget-root .drop-shadow-sm{--tw-drop-shadow:drop-shadow(0 1px 1px rgba(0,0,0,.05))}#chat-widget-root .grayscale-\\[0\\.3\\]{--tw-grayscale:grayscale(0.3)}#chat-widget-root .filter,#chat-widget-root .grayscale-\\[0\\.3\\]{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}#chat-widget-root .backdrop-blur-sm{--tw-backdrop-blur:blur(4px);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}#chat-widget-root .transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}#chat-widget-root .transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#chat-widget-root .transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}#chat-widget-root .transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}#chat-widget-root .transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}#chat-widget-root .duration-150{transition-duration:.15s}#chat-widget-root .duration-200{transition-duration:.2s}#chat-widget-root .duration-300{transition-duration:.3s}#chat-widget-root .duration-500{transition-duration:.5s}#chat-widget-root :is(#chat-widget-root .animate-in){animation:slideIn .3s ease-out}#chat-widget-root :is(#chat-widget-root .transition-all){transition-duration:.3s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#chat-widget-root .\\[font-family\\:inherit\\]{font-family:inherit}#chat-widget-root .placeholder\\:text-\\[\\#A2A9B2\\]::-moz-placeholder{--tw-text-opacity:1;color:rgb(162 169 178/var(--tw-text-opacity,1))}#chat-widget-root .placeholder\\:text-\\[\\#A2A9B2\\]::placeholder{--tw-text-opacity:1;color:rgb(162 169 178/var(--tw-text-opacity,1))}#chat-widget-root .placeholder\\:text-gray-500::-moz-placeholder{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}#chat-widget-root .placeholder\\:text-gray-500::placeholder{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}#chat-widget-root .hover\\:scale-105:hover{--tw-scale-x:1.05;--tw-scale-y:1.05}#chat-widget-root .hover\\:scale-105:hover,#chat-widget-root .hover\\:scale-110:hover{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .hover\\:scale-110:hover{--tw-scale-x:1.1;--tw-scale-y:1.1}#chat-widget-root .hover\\:scale-\\[1\\.02\\]:hover{--tw-scale-x:1.02;--tw-scale-y:1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .hover\\:border-blue-400:hover{--tw-border-opacity:1;border-color:rgb(96 165 250/var(--tw-border-opacity,1))}#chat-widget-root .hover\\:border-blue-600:hover{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}#chat-widget-root .hover\\:bg-blue-50:hover{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}#chat-widget-root .hover\\:bg-blue-500\\/20:hover{background-color:rgba(59,130,246,.2)}#chat-widget-root .hover\\:bg-blue-900\\/50:hover{background-color:rgba(30,58,138,.5)}#chat-widget-root .hover\\:bg-gray-200:hover{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}#chat-widget-root .hover\\:bg-gray-50:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}#chat-widget-root .hover\\:bg-gray-600:hover{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity,1))}#chat-widget-root .hover\\:bg-gray-700:hover{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}#chat-widget-root .hover\\:bg-red-600:hover{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}#chat-widget-root .hover\\:bg-transparent:hover{background-color:transparent}#chat-widget-root .hover\\:text-blue-500:hover{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}#chat-widget-root .hover\\:text-gray-200:hover{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}#chat-widget-root .hover\\:text-gray-300:hover{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}#chat-widget-root .hover\\:text-gray-600:hover{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}#chat-widget-root .hover\\:text-gray-700:hover{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}#chat-widget-root .hover\\:underline:hover{text-decoration-line:underline}#chat-widget-root .hover\\:opacity-80:hover{opacity:.8}#chat-widget-root .hover\\:opacity-90:hover{opacity:.9}#chat-widget-root .hover\\:shadow-md:hover{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}#chat-widget-root .hover\\:shadow-md:hover,#chat-widget-root .hover\\:shadow-xl:hover{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#chat-widget-root .hover\\:shadow-xl:hover{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color)}#chat-widget-root .hover\\:grayscale-0:hover{--tw-grayscale:grayscale(0);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}#chat-widget-root .focus\\:\\!border-status-error:focus{border-color:hsl(var(--cw-status-error))!important}#chat-widget-root .focus\\:border-\\[\\#5A6069\\]:focus{--tw-border-opacity:1;border-color:rgb(90 96 105/var(--tw-border-opacity,1))}#chat-widget-root .focus\\:border-\\[\\#B0B0B0\\]:focus{--tw-border-opacity:1;border-color:rgb(176 176 176/var(--tw-border-opacity,1))}#chat-widget-root .focus\\:bg-white:focus{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}#chat-widget-root .focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}#chat-widget-root .focus\\:ring-0:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color)}#chat-widget-root .focus\\:ring-0:focus,#chat-widget-root .focus\\:ring-1:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#chat-widget-root .focus\\:ring-1:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color)}#chat-widget-root .focus\\:ring-gray-300:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(209 213 219/var(--tw-ring-opacity,1))}#chat-widget-root .focus\\:ring-gray-600:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(75 85 99/var(--tw-ring-opacity,1))}#chat-widget-root .focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}#chat-widget-root .focus-visible\\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#chat-widget-root .focus-visible\\:ring-blue-700:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(29 78 216/var(--tw-ring-opacity,1))}#chat-widget-root .focus-visible\\:ring-white\\/40:focus-visible{--tw-ring-color:hsla(0,0%,100%,.4)}#chat-widget-root .active\\:scale-95:active{--tw-scale-x:.95;--tw-scale-y:.95}#chat-widget-root .active\\:scale-95:active,#chat-widget-root .active\\:scale-\\[0\\.97\\]:active{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .active\\:scale-\\[0\\.97\\]:active{--tw-scale-x:0.97;--tw-scale-y:0.97}#chat-widget-root .active\\:scale-\\[0\\.98\\]:active{--tw-scale-x:0.98;--tw-scale-y:0.98}#chat-widget-root .active\\:scale-\\[0\\.98\\]:active,#chat-widget-root .active\\:scale-\\[0\\.99\\]:active{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .active\\:scale-\\[0\\.99\\]:active{--tw-scale-x:0.99;--tw-scale-y:0.99}#chat-widget-root .active\\:outline-none:active{outline:2px solid transparent;outline-offset:2px}#chat-widget-root .active\\:ring-0:active{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#chat-widget-root .disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}#chat-widget-root .disabled\\:opacity-40:disabled{opacity:.4}#chat-widget-root .disabled\\:opacity-50:disabled{opacity:.5}#chat-widget-root .disabled\\:shadow-none:disabled{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#chat-widget-root :is(.group:hover .group-hover\\:scale-100){--tw-scale-x:1;--tw-scale-y:1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root :is(.group:hover .group-hover\\:opacity-100){opacity:1}#chat-widget-root .dark\\:text-gray-300:is(.dark *){--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}#chat-widget-root .dark\\:text-gray-400:is(.dark *){--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}@media (min-width:768px){#chat-widget-root .md\\:text-sm{font-size:.875rem;line-height:1.25rem}}#chat-widget-root .rtl\\:rounded-tl-2xl:where([dir=rtl],[dir=rtl] *){border-top-left-radius:1rem}#chat-widget-root .rtl\\:rounded-tr-sm:where([dir=rtl],[dir=rtl] *){border-top-right-radius:.125rem}#chat-widget-root .\\[\\&\\:first-child\\]\\:\\!mt-0:first-child{margin-top:0!important}#chat-widget-root :is(.\\[\\&\\>\\*\\:first-child\\]\\:\\!mt-0>:first-child){margin-top:0!important}#chat-widget-root :is(.\\[\\&\\>\\*\\:last-child\\]\\:\\!mb-0>:last-child){margin-bottom:0!important}\n.chat-widget-root{position:fixed;z-index:999999}.chat-widget-container{color:var(--cw-text-color,inherit);font-family:var(\n --cw-font-family,-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif\n )}#chat-widget-root .chat-messages p{overflow-wrap:anywhere;word-break:break-word}textarea#chat-widget-input::-moz-placeholder{border:none;line-height:48px;outline:none}textarea#chat-widget-input::placeholder{border:none;line-height:48px;outline:none}textarea#chat-widget-input{border:none;line-height:48px;outline:none}@keyframes slideIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes bounce{0%,to{transform:translateY(0)}50%{transform:translateY(-5px)}}#chat-widget-root .scrollbar-hide{-ms-overflow-style:none;scrollbar-width:none}#chat-widget-root .scrollbar-hide::-webkit-scrollbar{display:none}#chat-widget-root .slim-scrollbar-x{scrollbar-width:thin}#chat-widget-root .slim-scrollbar-x::-webkit-scrollbar{height:3px!important}#chat-widget-root .slim-scrollbar-x::-webkit-scrollbar-track{background:transparent!important}#chat-widget-root .slim-scrollbar-x::-webkit-scrollbar-thumb{background:#d1d5db!important;border-radius:2px!important}#chat-widget-root .slim-scrollbar-x::-webkit-scrollbar-thumb:hover{background:#9ca3af!important}@media print{.chat-widget-root{display:none!important}}',t.appendChild(i);const n=document.createElement("div");n.id="chat-widget-mount",t.appendChild(n),a.current=u(n)},[]),i(()=>{a.current?.render(e.createElement(fr,t))}),i(()=>()=>{const e=a.current;a.current=null,queueMicrotask(()=>e?.unmount())},[]),g("div",{ref:o,id:"chat-widget-host"})}export{Kt as A,cr as E,Je as F,Ge as L,wr as S,wt as W,ar as a,dr as b,Ue as c,mt as d,co as e,yt as f,io as l,so as m,Yt as n,mr as p,br as r,Gt as s,ro as t,ur as v};
20
+ */let pt=null;function ht(e){i(()=>{if(!ct||!e)return;const t=e.split(",")[0]?.trim();if(!t||gt.has(t))return;if((e=>{const t=e.trim().toLowerCase();return!t||!!dt.has(t)||ut.some(e=>t.includes(e))})(t))return void gt.add(t);let o=!0;return(async()=>{try{pt||(pt=import("./chat-widget-webfontloader-BK8fca15.esm.js").then(function(e){return e.w}));const e=await pt,r=e&&"default"in e?e.default:e,a=(e=>e.trim().replace(/\s+/g,"+"))(t);r.load({google:{families:[`${a}:300,400,500,600,700`]},fontactive:e=>{o&&gt.add(e)},fontinactive:e=>{o&&gt.add(e),console.warn(`Warning: failed to load Google Font: ${e}`)}})}catch(e){console.error("Warning: WebFont loader error:",e)}})(),()=>{o=!1}},[e])}function mt(e){return"string"==typeof e&&/^https?:\/\//i.test(e)?e:void 0}const bt="__eshalChatWidgetCitationContext",ft="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:void 0,wt=ft?ft[bt]||(ft[bt]=l(null)):l(null);function yt(e){return!!e&&(function(e){return!!e&&String(e.source_id||e.sourceid||"").startsWith("attachment:")}(e)?"string"==typeof e.url&&e.url.length>0:!("string"!=typeof(t=e.url)||!t.includes("/api/v1/sharepoint/file/"))||Boolean(e.source_id));var t}function vt(e,t){return"string"!=typeof e||""===e?"":/^https?:\/\//i.test(e)?e:t?`${String(t).replace(/\/$/,"")}${e.startsWith("/")?"":"/"}${e}`:e}function kt(e){if(!/%[0-9a-f]{2}/i.test(e))return e;try{return decodeURIComponent(e)}catch{return e}}function xt(e){if(!e)return null;const t=/(?:^|;)\s*filename\*\s*=\s*([^;]+)/i.exec(e);if(t){const e=/^\s*"?([^']*)'[^']*'([^"]*)"?\s*$/.exec(t[1]),o=e?function(e,t){try{return/^utf-8$/i.test(e)?decodeURIComponent(t):t.replace(/%([0-9a-f]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16)))}catch{return null}}(e[1],e[2]):null;if(o)return o}const o=/(?:^|;)\s*filename\s*=\s*"((?:[^"\\]|\\.)*)"/i.exec(e);if(o)return kt(o[1].replace(/\\(.)/g,"$1"))||null;const r=/(?:^|;)\s*filename\s*=\s*([^;]+)/i.exec(e);return r&&kt(r[1].trim())||null}function Ct(){return import("./chat-widget-MarkdownRenderer-Ck05zMtk.esm.js")}const St=d(Ct);class Mt extends e.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){console.error("[widget] markdown chunk failed to load, showing plain text:",e)}render(){return this.state.failed?this.props.fallback:this.props.children}}const Tt=/(```|`[^`]+`|(^|\n)\s{0,3}#{1,6}\s|(^|\n)\s*[-*+]\s|(^|\n)\s*\d+\.\s|(^|\n)\s*>\s|\[[^\]]*\]\([^)]*\)|\*\*|__|~~|(^|\n)\s*\||\[\d+\])/;const Ft=({content:e,isDark:t,textColor:o,fontFamily:r,fontSize:a})=>g("p",{className:"leading-relaxed [&:first-child]:!mt-0 whitespace-pre-wrap break-words",style:{color:o||(t?"#f3f4f6":"#1A1A1A"),fontFamily:r||"Inter",fontSize:a||"14px",margin:0,lineHeight:"1.6",padding:0,overflowWrap:"break-word"},children:e}),zt=({content:e,isStreaming:t,isDark:a=!1,isRtl:n=!1,textColor:s,fontFamily:l,fontSize:d,onButtonClick:u,provideCitations:h=!0})=>{const[m,b]=o(""),[f,w]=o(!1),y=r(e),v=r(0),k=r(null),x=r(0);i(()=>{if(e!==y.current){if(y.current=e,v.current>=e.length)return b(e),void w(!1);e.length<m.length&&(v.current=0,b(""))}if(!t)return b(e),w(!1),void(k.current&&cancelAnimationFrame(k.current));w(!0);const o=t=>{if(t-x.current<16)k.current=requestAnimationFrame(o);else if(x.current=t,v.current<e.length){const t=Math.max(2,Math.floor(4*Math.random())),r=Math.min(v.current+t,e.length);b(e.slice(0,r)),v.current=r,k.current=requestAnimationFrame(o)}else w(!1)};return k.current=requestAnimationFrame(o),()=>{k.current&&cancelAnimationFrame(k.current)}},[e,t]);const C="string"==typeof(S=m)&&0!==S.length&&Tt.test(S);var S;return p("div",{className:"relative",dir:"auto",style:{textAlign:n?"right":"left",color:s||(a?"#f3f4f6":"#1A1A1A"),fontFamily:l||"Inter",fontSize:d||"14px",margin:0,padding:0},children:[C?g(Mt,{fallback:g(Ft,{content:m,isDark:a,textColor:s,fontFamily:l,fontSize:d}),children:g(c,{fallback:g(Ft,{content:m,isDark:a,textColor:s,fontFamily:l,fontSize:d}),children:g(St,{content:m,isStreaming:t,isDark:a,isRtl:n,textColor:s,fontFamily:l,fontSize:d,onButtonClick:u,provideCitations:h})})}):g(Ft,{content:m,isDark:a,textColor:s,fontFamily:l,fontSize:d}),f&&g("span",{className:"inline-block w-1.5 h-4 bg-blue-500 ms-0.5 animate-pulse align-text-bottom",style:{animationDuration:"0.8s"}})]})},Pt=({isDark:e,t:t})=>p("div",{className:"flex gap-1.5",role:"status","aria-label":t("agentIsTyping"),children:[g("div",{className:`w-2 h-2 rounded-full ${e?"bg-gray-500":"bg-gray-400"} animate-bounce`,style:{animationDelay:"0ms"},"aria-hidden":"true"}),g("div",{className:`w-2 h-2 rounded-full ${e?"bg-gray-500":"bg-gray-400"} animate-bounce`,style:{animationDelay:"150ms"},"aria-hidden":"true"}),g("div",{className:`w-2 h-2 rounded-full ${e?"bg-gray-500":"bg-gray-400"} animate-bounce`,style:{animationDelay:"300ms"},"aria-hidden":"true"})]}),Lt=({question:e,options:t,onDecision:o,disabled:r,isDark:a=!1})=>p("div",{className:"mt-3 p-3 rounded-lg border "+(a?"bg-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200"),children:[g("p",{className:"text-sm font-medium mb-2 "+(a?"text-gray-100":"text-gray-900"),children:e}),g("div",{className:"space-y-2",children:t.map(e=>g("button",{onClick:()=>o(e.id,e.label),disabled:r,className:"w-full text-left px-3 py-2 text-sm rounded transition-all "+(a?"bg-gray-800 border border-gray-700 hover:bg-blue-900/50 hover:border-blue-600 disabled:opacity-50 disabled:cursor-not-allowed":"bg-white border border-gray-300 hover:bg-blue-50 hover:border-blue-400 disabled:opacity-50 disabled:cursor-not-allowed"),children:e.label},e.id))})]});function At({content:e,isDark:t,t:r}){const i=r?r("copyMessage"):"Copy message",n=r?r("copied"):"Copied",[s,l]=o(!1),c=a(()=>{e&&(navigator.clipboard?.writeText(e).catch(()=>{}),l(!0),setTimeout(()=>l(!1),1500))},[e]);return g("button",{type:"button",onClick:c,className:"p-0.5 rounded transition-colors "+(t?"text-gray-500 hover:text-gray-300":"text-gray-400 hover:text-gray-600"),style:{border:"none",background:"transparent",appearance:"none",WebkitAppearance:"none",cursor:"pointer"},"aria-label":s?n:i,title:s?n:i,children:s?g(He,{className:"w-3 h-3 text-green-500"}):g(Ye,{className:"w-3 h-3"})})}const jt=({message:t,formatTime:i,isDark:n,primaryColor:s,agentMessageBubbleColor:l,resolvedAgentBubbleColor:c,textColor:d,assistantTextColor:u,fontFamily:m,agentMessageBubbleFontFamily:b,agentMessageBubbleFontSize:f,fontSize:w,isRtl:y,onDecision:v,companyLogo:k,conciergeName:x,companyName:C,apiBaseUrl:S,getAuthToken:M,onPromptSuggestionClick:T,allowFeedback:F=!0,provideCitations:z=!0,onFeedback:P,headerTextColor:L,t:A})=>{const j="string"==typeof t.content?t.content:"",N=t.isProcessing&&(!j||0===j.length),R=ee(j,y),[I,B]=o(()=>t?.feedback??null),[E,D]=o(!1),[V,O]=o(null),[$,U]=o(""),q=r(null),H=a(e=>{if(P&&j){if(I===e)return B(null),D(!1),O(null),U(""),void P(j,null);if("like"===e)return B("like"),D(!1),O(null),U(""),void P(j,"like");B(null),O("dislike"),D(!0),U(""),setTimeout(()=>q.current?.focus(),100)}},[I,P,j]),_=a(()=>{P&&j&&V&&(B(V),P(j,V,$.trim()||void 0),D(!1),U(""),O(null))},[P,j,V,$]),W=a(()=>{D(!1),U(""),O(null)},[]),K=!0===t?.isError,Y=K?n?"rgba(239,68,68,0.15)":"#fee2e2":null!=c?c:null!=l?l:n?"#1f2937":"#FFFFFF",Q=null!=l&&"#ffffff"!==l&&"#FFFFFF"!==l&&"#1f2937"!==l,J=K?n?"#fca5a5":"#991b1b":null!=u?u:null!=d?d:n?"#f3f4f6":"#1A1A1A",G=null!=b?b:null!=m?m:"Inter",Z=null!=f?f:null!=w?w:"14px";ht(G);const{onSourceActivate:X,downloadingKey:te}=function({apiBaseUrl:t,getAuthToken:o}){const[r,a]=e.useState(null);return{onSourceActivate:e.useCallback(async e=>{if(!e)return;const r=e.url||e.source_id||e.sourceid||e.source_name||"",i=String(e.source_id||e.sourceid||"").startsWith("attachment:"),n="string"==typeof e.url&&e.url.includes("/api/v1/sharepoint/file/"),s="file"===e.source_type||n||i||!(!e.source_id&&!e.sourceid)&&!e.url;if(!s){const t=mt(e.url);if(t)try{window.open(t,"_blank","noopener,noreferrer")}catch{}return}if(t||i){a(r),console.debug("[widget] citation download starting:",{source_id:e.source_id||e.sourceid,source_name:e.source_name,source_type:e.source_type,isAttachment:i,isSharePointProxy:n,isFileLike:s});try{let r;if(i){if(!e.url)throw new Error("attachment has no URL");const a={};if("function"==typeof o){const e=await o();e&&(a.Authorization=`Bearer ${e}`)}r=await fetch(vt(e.url,t),{method:"GET",headers:a,credentials:"include"})}else if(n){const a=vt(e.url,t),i={};if("function"==typeof o){const e=await o();e&&(i.Authorization=`Bearer ${e}`)}r=await fetch(a,{method:"GET",headers:i,credentials:"include"})}else{const a=`${t.replace(/\/$/,"")}/api/v1/support/file-download`,i={"Content-Type":"application/json"};if("function"==typeof o){const e=await o();e&&(i.Authorization=`Bearer ${e}`)}r=await fetch(a,{method:"POST",headers:i,credentials:"include",body:JSON.stringify({source_id:e.source_id||e.sourceid,file_name:e.url||"",source_name:e.source_name||""})})}if(!r.ok){const e=await r.json().catch(()=>({}));throw new Error(e.details||e.error||r.statusText)}const a=await r.blob(),s=r.headers.get("content-disposition");let l=e.source_name||"download";i||(l=xt(s)||l);const c=document.createElement("a"),d=URL.createObjectURL(a);c.href=d,c.download=l,document.body.appendChild(c),c.click(),c.remove(),URL.revokeObjectURL(d)}catch(e){console.error("[widget] source download failed:",e)}finally{a(null)}}else console.warn("[widget] citation download skipped: apiBaseUrl missing and source is not an attachment (no fallback URL to fetch). Source:",e)},[t,o]),downloadingKey:r}}({apiBaseUrl:S,getAuthToken:M}),oe=e.useMemo(()=>({sources:t.sources||[],sourcesPreliminary:!!t.sourcesPreliminary,onSourceActivate:X,downloadingKey:te,textColor:J,t:A}),[t.sources,t.sourcesPreliminary,X,te,J,A]);return g(wt.Provider,{value:oe,children:p("div",{className:"flex gap-3 flex-row animate-in min-w-0",children:[g("div",{className:"flex-shrink-0 mt-1",children:g("div",{className:"w-8 h-8 rounded-full overflow-hidden flex items-center justify-center",style:{backgroundColor:s||"#2563eb"},children:g("div",k?{className:"w-full h-full bg-white/10 flex items-center justify-center",children:g("img",{src:k,alt:x||C||"Assistant avatar",className:"object-contain rounded-full",style:{width:"100%",height:"100%"}})}:{className:"w-full h-full flex items-center justify-center",style:{fontSize:"18px",fontFamily:m||"Inter",color:L||"#FFFFFF"},children:(x||"A").charAt(0).toUpperCase()})})}),p("div",{className:"flex flex-col items-start min-w-0 max-w-[75%]",children:[g("div",{className:"rounded-2xl px-4 py-2.5 shadow-sm border rounded-tl-sm rtl:rounded-tl-2xl rtl:rounded-tr-sm min-w-0 max-w-full overflow-hidden "+(Q?"border-transparent":n?"border-gray-700":"border-gray-200"),style:{backgroundColor:Y,color:J,fontFamily:G,fontSize:Z,direction:R?"rtl":"ltr",textAlign:R?"right":"left",...Q?{borderColor:`${Y}33`}:{}},children:N?g(Pt,{isDark:n,t:A}):g(h,{children:t.requiresDecision&&t.decisionData&&v?p("div",{children:[j&&g("div",{className:"mb-3",children:g(zt,{content:j,isStreaming:t.isProcessing,isDark:n,isRtl:R,textColor:J,fontFamily:G,fontSize:Z,onButtonClick:T,provideCitations:z})}),g(Lt,{question:t.decisionData.question,options:t.decisionData.options,onDecision:(e,o)=>v(t.decisionData.decisionId,e,o),disabled:!!t.decisionResponse,isDark:n}),t.decisionResponse&&p("div",{className:"mt-2 text-xs "+(n?"text-gray-400":"text-gray-500"),children:["Selected: ",t.decisionResponse.selectedOption]})]}):j?g(h,{children:g(zt,{content:j,isStreaming:t.isProcessing,isDark:n,isRtl:R,textColor:J,fontFamily:G,fontSize:Z,onButtonClick:T,provideCitations:z})}):null})}),p("div",{className:"flex items-center gap-1.5 mt-1.5 px-1",children:[g("p",{className:"text-xs leading-none "+(n?"text-gray-400":"text-gray-500"),dir:"auto",children:i(t.timestamp)}),!N&&!t.isProcessing&&j&&g(At,{content:j,isDark:n,t:A}),!1!==F&&P&&!N&&!t.isProcessing&&j&&"welcome"!==t.type&&!t.isWelcome&&p("div",{className:"flex items-center gap-0.5 ms-0.5",children:[g("button",{type:"button",onClick:()=>H("like"),className:"p-0.5 rounded transition-colors "+("like"===I||"like"===V?"text-green-500":n?"text-gray-500 hover:text-gray-300":"text-gray-400 hover:text-gray-600"),style:{border:"none",background:"transparent",appearance:"none",WebkitAppearance:"none",cursor:"pointer"},"aria-label":A("like"),"aria-pressed":"like"===I,children:g(st,{className:"w-3 h-3"})}),g("button",{type:"button",onClick:()=>H("dislike"),className:"p-0.5 rounded transition-colors "+("dislike"===I||"dislike"===V?"text-red-500":n?"text-gray-500 hover:text-gray-300":"text-gray-400 hover:text-gray-600"),style:{border:"none",background:"transparent",appearance:"none",WebkitAppearance:"none",cursor:"pointer"},"aria-label":A("dislike"),"aria-pressed":"dislike"===I,children:g(nt,{className:"w-3 h-3"})})]})]}),E&&"dislike"===V&&p("div",{className:"mt-2 w-full rounded-xl border p-3 shadow "+(n?"bg-gray-800 border-gray-700":"bg-white border-gray-200"),style:{direction:y?"rtl":"ltr"},children:[g("textarea",{ref:q,value:$,onChange:e=>U(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key?(e.preventDefault(),_()):"Escape"===e.key&&(e.preventDefault(),W())},placeholder:A("feedbackPlaceholder"),"aria-label":A("feedbackPlaceholder"),rows:2,className:"w-full resize-none rounded-lg border px-2 py-1.5 text-xs focus:outline-none focus:ring-1 "+(n?"bg-gray-900 border-gray-700 text-gray-100 placeholder-gray-500 focus:ring-gray-600":"bg-white border-gray-200 text-gray-900 placeholder-gray-400 focus:ring-gray-300"),style:{fontFamily:G,textAlign:y?"right":"left"}}),p("div",{className:"flex items-center justify-end gap-1.5 mt-1.5",children:[g("button",{type:"button",onClick:W,className:"text-xs px-2 py-1 rounded transition-colors "+(n?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),style:{border:"none",background:"transparent",cursor:"pointer"},children:A("cancel")}),g("button",{type:"button",onClick:_,className:"text-xs px-2.5 py-1 rounded text-white transition-opacity hover:opacity-90",style:{backgroundColor:s||"#2563eb",border:"none",cursor:"pointer"},children:A("submit")})]})]})]})]})})},Nt=({message:e,formatTime:t,userMessageBoxColor:o,primaryColor:r,resolvedUserMessageColor:a,textColor:i,userTextColor:n,fontFamily:s,userMessageBubbleFontFamily:l,userMessageBubbleFontSize:c,fontSize:d,isDark:u,isRtl:h,t:m,onRetryMessage:b})=>{const f=null!=a?a:null!=o?o:null!=r?r:"#2563eb",w=null!=n?n:null!=i?i:"#FFFFFF",y=null!=l?l:null!=s?s:"Inter",v=null!=c?c:null!=d?d:"14px",k=ee("string"==typeof e?.content?e.content:"",h);ht(y);const x=Array.isArray(e.attachments)?e.attachments:[];return g("div",{className:"flex gap-3 flex-row-reverse animate-in",children:p("div",{className:"flex flex-col items-end max-w-[75%]",children:[x.length>0&&g("div",{className:"mb-1.5 flex flex-wrap justify-end gap-1.5",children:x.map((e,t)=>String(e.mimeType||"").startsWith("image/")&&e.url?g("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"block rounded-md overflow-hidden",style:{maxWidth:160},title:e.filename,children:g("img",{src:e.url,alt:e.filename||"attachment",style:{maxWidth:160,maxHeight:160,display:"block"}})},e.storageKey||t):p("span",{className:"inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs",style:{backgroundColor:u?"#1f2937":"#f3f4f6",color:u?"#e5e7eb":"#374151",border:"1px solid "+(u?"#374151":"#e5e7eb"),maxWidth:200},title:e.filename,children:[g(Je,{size:12}),g("span",{className:"truncate",style:{maxWidth:140,direction:"ltr"},children:e.filename})]},e.storageKey||t))}),e.content&&""!==e.content.trim()&&g("div",{className:"rounded-2xl px-4 py-2.5 shadow-lg "+(k?"rounded-tl-sm":"rounded-tr-sm"),dir:"auto",style:{background:`linear-gradient(135deg, ${f} 0%, ${f}dd 100%)`,fontFamily:y,direction:k?"rtl":"ltr",textAlign:k?"right":"left"},children:g("p",{className:"whitespace-pre-wrap break-words",dir:"auto",style:{color:w,fontFamily:y,fontSize:v,lineHeight:"1.5",textAlign:k?"right":"left",overflowWrap:"break-word",margin:0,padding:0},children:e.content})}),p("div",{className:"flex items-center gap-1.5 mt-1.5 px-1",children:[g("p",{className:"text-xs leading-none "+(u?"text-gray-400":"text-gray-500"),dir:"auto",children:t(e.timestamp)}),e.content&&""!==e.content.trim()&&g(At,{content:e.content,isDark:u,t:m})]}),"failed"===e.status&&p("div",{className:"flex items-center gap-1.5 mt-1 px-1","data-testid":"message-failed-state",children:[g("span",{className:"text-xs leading-none",style:{color:"#dc2626"},dir:"auto",children:m("messageNotDelivered")}),"function"==typeof b&&g("button",{type:"button",onClick:()=>b(e),className:"text-xs leading-none font-medium underline",style:{color:"#dc2626"},dir:"auto",children:m("retrySend")})]})]})})},Rt=({message:e,isDark:o,primaryColor:r,agentMessageBubbleColor:a,userMessageBoxColor:i,resolvedUserMessageColor:n,resolvedAgentBubbleColor:s,textColor:l,assistantTextColor:c,userTextColor:d,fontFamily:u,agentMessageBubbleFontFamily:p,agentMessageBubbleFontSize:h,userMessageBubbleFontFamily:m,userMessageBubbleFontSize:b,fontSize:f,formatTime:w,isRtl:y,onDecision:v,companyLogo:k,conciergeName:x,companyName:C,apiBaseUrl:S,getAuthToken:M,onPromptSuggestionClick:T,allowFeedback:F,provideCitations:z,onFeedback:P,headerTextColor:L,onRetryMessage:A,defaultLanguage:j="en"})=>{const N=t(()=>re(j),[j]);return e?"user"===e.role?g(Nt,{message:e,formatTime:w,userMessageBoxColor:i,primaryColor:r,resolvedUserMessageColor:n,textColor:l,userTextColor:d,fontFamily:u,userMessageBubbleFontFamily:m,userMessageBubbleFontSize:b,fontSize:f,isDark:o,isRtl:y,t:N,onRetryMessage:A}):g(jt,{message:e,formatTime:w,isDark:o,primaryColor:r,agentMessageBubbleColor:a,resolvedAgentBubbleColor:s,textColor:l,assistantTextColor:c,fontFamily:u,agentMessageBubbleFontFamily:p,agentMessageBubbleFontSize:h,fontSize:f,isRtl:y,onDecision:v,companyLogo:k,conciergeName:x,companyName:C,apiBaseUrl:S,getAuthToken:M,onPromptSuggestionClick:T,allowFeedback:F,provideCitations:z,onFeedback:P,headerTextColor:L,t:N}):null};var It=e.memo(Rt);const Bt=(e,t,o)=>Number.isNaN(e)?t:Math.min(Math.max(e,t),o),Et=e=>{if(!e)return null;const t=(e=>e?.trim().toLowerCase()??"")(e),o=(e=>{const t=e.match(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i);if(!t)return null;let o=t[1];3===o.length&&(o=o.split("").map(e=>`${e}${e}`).join(""));const r=parseInt(o.slice(0,2),16),a=parseInt(o.slice(2,4),16),i=parseInt(o.slice(4,6),16);return[r,a,i].some(e=>Number.isNaN(e))?null:{r:r,g:a,b:i}})(t);if(o)return o;const r=(e=>{const t=e.match(/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(\d*\.?\d+))?\s*\)$/i);return t?{r:Bt(Number.parseInt(t[1],10),0,255),g:Bt(Number.parseInt(t[2],10),0,255),b:Bt(Number.parseInt(t[3],10),0,255)}:null})(t);return r||null},Dt=({r:e,g:t,b:o})=>{const r=e=>{const t=Bt(Math.round(e),0,255).toString(16);return 1===t.length?`0${t}`:t};return`#${r(e)}${r(t)}${r(o)}`},Vt=(e,t,o)=>{const r=Bt(o,0,1);return{r:Math.round(e.r+(t.r-e.r)*r),g:Math.round(e.g+(t.g-e.g)*r),b:Math.round(e.b+(t.b-e.b)*r)}},Ot=(e,t)=>{const o=Bt(t,0,1);return`rgba(${Bt(Math.round(e.r),0,255)}, ${Bt(Math.round(e.g),0,255)}, ${Bt(Math.round(e.b),0,255)}, ${o})`},$t={background:"#f8fafc",hoverBackground:"#f1f5f9",border:"#e2e8f0",hoverBorder:"#cbd5f5",shadow:"0 4px 12px rgba(15, 23, 42, 0.08)",hoverShadow:"0 6px 20px rgba(15, 23, 42, 0.14)"},Ut={background:"#1f2937",hoverBackground:"#27364a",border:"#334155",hoverBorder:"#3b4c63",shadow:"0 4px 12px rgba(15, 23, 42, 0.45)",hoverShadow:"0 6px 20px rgba(15, 23, 42, 0.55)"},qt=(e,t)=>{const o=Et(e);if(!o)return(e=>e?Ut:$t)(t);const r=(({r:e,g:t,b:o})=>{const r=[e,t,o].map(e=>{const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return.2126*r[0]+.7152*r[1]+.0722*r[2]})(o),a=Et("#0f172a")??{r:15,g:23,b:42},i=Et(t?"#f8fafc":"#f9fafb")??{r:249,g:250,b:251},n=Et(t?"#334155":"#e2e8f0")??{r:226,g:232,b:240};let s,l;if(r>=.6){const e=t?.5:.7,r=Math.min(1,e+.15);s=Vt(o,a,e),l=Vt(o,a,r)}else if(r<=.35){const e=t?.9:.8,r=Math.min(1,e+(t?.05:.12));s=Vt(o,i,e),l=Vt(o,i,r)}else{const e=t?.45:.6,r=Math.min(1,e+.1);s=Vt(o,n,e),l=Vt(o,n,r)}const c=Vt(o,s,.65),d=Vt(o,l,.7),u=`0 4px 12px ${Ot(o,t?.28:.12)}`,g=`0 6px 20px ${Ot(o,t?.35:.18)}`;return{background:Dt(s),hoverBackground:Dt(l),border:Dt(c),hoverBorder:Dt(d),shadow:u,hoverShadow:g}},Ht=({questions:e,isDark:t,palette:n,resolvedTextColor:s,fontFamily:l,fontSize:c,isRtl:d,onQuestionClick:u,applyHoverState:h,headingLabel:m,defaultLanguage:b})=>{const f=r(null),[w,y]=o(!1),[v,k]=o(!1),x=a(()=>{const e=f.current;if(!e)return;const{scrollLeft:t,scrollWidth:o,clientWidth:r}=e;y(Math.abs(t)>1),k(Math.abs(t)+r<o-1)},[]);i(()=>{x();const e=f.current;if(!e)return;const t=new ResizeObserver(x);return t.observe(e),()=>t.disconnect()},[x,e]);const C=a(e=>{const t=f.current;if(!t)return;const o="left"===e?-150:150;t.scrollBy({left:d?-o:o,behavior:"smooth"})},[d]),S=t?"rgba(31,41,55,0.85)":"rgba(255,255,255,0.85)",M=t?"#e5e7eb":"#374151",T=t?"#4b5563":"#d1d5db";return p("div",{className:"px-4 py-4 border-t "+(t?"border-gray-700/50":"border-gray-200/60"),children:[p("div",{className:"text-xs mb-3 font-semibold tracking-wide uppercase "+(t?"text-gray-400":"text-gray-500"),children:[m||"Quick questions",":"]}),p("div",{className:"flex items-center gap-1.5",children:[g("button",{onClick:()=>C("left"),disabled:!w,"aria-label":oe(b,"scrollLeft"),className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-full shadow-sm transition-all duration-200 hover:shadow-md active:scale-95",style:{backgroundColor:S,border:`1px solid ${T}`,color:M,backdropFilter:"blur(4px)",opacity:w?1:.35,cursor:w?"pointer":"default"},children:g(_e,{size:16})}),g("div",{ref:f,onScroll:x,className:"flex-1 flex gap-3 overflow-x-auto pb-2",style:{scrollBehavior:"smooth",WebkitOverflowScrolling:"touch",scrollbarWidth:"none",msOverflowStyle:"none"},children:e.map((e,t)=>{const o=ee(e,d);return p("button",{onClick:()=>u?.(e),className:"group relative text-sm px-5 py-2.5 rounded-full font-medium transition-all duration-300 hover:scale-105 active:scale-95 whitespace-nowrap flex-shrink-0 overflow-hidden backdrop-blur-sm "+(o?"text-right":"text-left"),style:{direction:o?"rtl":"ltr",backgroundColor:n.background,border:`1.5px solid ${n.border}`,boxShadow:n.shadow},onMouseEnter:e=>{h(e.currentTarget,!0),e.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:e=>{h(e.currentTarget,!1),e.currentTarget.style.transform="translateY(0)"},children:[g("div",{className:"absolute inset-0 bg-gradient-to-br from-white/0 via-white/5 to-white/10 opacity-0 group-hover:opacity-100 transition-opacity duration-300 rounded-xl"}),g("span",{className:"relative z-10",style:{direction:o?"rtl":"ltr",color:s,fontFamily:l,fontSize:c,textAlign:o?"right":"left"},children:e})]},t)})}),g("button",{onClick:()=>C("right"),disabled:!v,"aria-label":oe(b,"scrollRight"),className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-full shadow-sm transition-all duration-200 hover:shadow-md active:scale-95",style:{backgroundColor:S,border:`1px solid ${T}`,color:M,backdropFilter:"blur(4px)",opacity:v?1:.35,cursor:v?"pointer":"default"},children:g(We,{size:16})})]})]})},_t=({questions:e=[],isDark:o=!1,primaryColor:r="#2563eb",onQuestionClick:a,isTyping:i=!1,layout:n="vertical",fontFamily:s="Inter",fontSize:l="14px",textColor:c,isRtl:d=!1,questionTextColor:u,questionBoxColor:h,resolvedUserMessageColor:m,userMessageBoxColor:b,userTextColor:f,headingLabel:w,defaultLanguage:y="en"})=>{if(!e.length||i)return null;const v=u??c??(o?"#f3f4f6":"#111827"),k=t(()=>qt(v,o),[v,o]);if("horizontal"===n)return g(Ht,{questions:e,isDark:o,palette:k,resolvedTextColor:v,fontFamily:s,fontSize:l,isRtl:d,onQuestionClick:a,applyHoverState:(e,t)=>{e.style.backgroundColor=t?k.hoverBackground:k.background,e.style.borderColor=t?k.hoverBorder:k.border,e.style.boxShadow=t?k.hoverShadow:k.shadow},headingLabel:w,defaultLanguage:y});const x=m??b??r??"#2563eb",C=f??c??"#FFFFFF";return p("div",{style:{paddingInlineStart:"50px"},children:[w?g("div",{className:"mb-2",style:{color:o?"#9ca3af":"#6b7280",fontFamily:s,fontSize:`calc(${l} - 1px)`},children:w}):null,g("div",{className:"flex flex-wrap gap-2",children:e.map((e,t)=>{const o=ee(e,d);return g("button",{onClick:()=>a?.(e),className:"transition-all duration-200 active:scale-[0.97]",style:{direction:o?"rtl":"ltr",fontFamily:s,fontSize:l,color:C,backgroundColor:x,border:"none",borderRadius:"9999px",padding:"5px 14px",fontWeight:500,lineHeight:"1.4",whiteSpace:"normal",textAlign:o?"right":"left"},children:e},t)})})]})},Wt=({active:e=!1,processing:t=!1,deviceId:o,barWidth:a=3,barGap:n=1,barRadius:s=1.5,barColor:l,fadeEdges:c=!0,fadeWidth:d=24,barHeight:u=4,height:h=64,sensitivity:m=1,smoothingTimeConstant:b=.8,fftSize:f=256,historySize:w=60,updateRate:y=30,mode:v="static",onError:k,onStreamReady:x,onStreamEnd:C,className:S,...M})=>{const T=r(null),F=r(null),z=r([]),P=r(null),L=r(null),A=r(null),j=r(0),N=r(0),R=r(null),I=r([]),B=r(0),E=r([]),D=r(!0),V=r(null),O=r(0),$="number"==typeof h?`${h}px`:h;return i(()=>{const e=T.current,t=F.current;if(!e||!t)return;const o=new ResizeObserver(()=>{const o=t.getBoundingClientRect(),r=window.devicePixelRatio||1;e.width=o.width*r,e.height=o.height*r,e.style.width=`${o.width}px`,e.style.height=`${o.height}px`;const a=e.getContext("2d");a&&a.scale(r,r),V.current=null,O.current=o.width,D.current=!0});return o.observe(t),()=>o.disconnect()},[]),i(()=>{if(t&&!e){let e=0;B.current=0;const t=()=>{e+=.03,B.current=Math.min(1,B.current+.02);const o=[],r=Math.floor((F.current?.getBoundingClientRect().width||200)/(a+n));if("static"===v){const t=Math.floor(r/2);for(let a=0;a<r;a++){const r=(a-t)/t,i=1-.4*Math.abs(r),n=(.2+(.25*Math.sin(1.5*e+3*r)+.2*Math.sin(.8*e-2*r)+.15*Math.cos(2*e+r)))*i;let s=n;if(I.current.length>0&&B.current<1){const e=Math.min(a,I.current.length-1);s=(I.current[e]||0)*(1-B.current)+n*B.current}o.push(Math.max(.05,Math.min(1,s)))}}else for(let t=0;t<r;t++){const a=(t-r/2)/(r/2),i=1-.4*Math.abs(a),n=(.2+(.25*Math.sin(1.5*e+.15*t)+.2*Math.sin(.8*e-.1*t)+.15*Math.cos(2*e+.05*t)))*i;let s=n;if(I.current.length>0&&B.current<1){const e=Math.floor(t/r*I.current.length);s=(I.current[e]||0)*(1-B.current)+n*B.current}o.push(Math.max(.05,Math.min(1,s)))}"static"===v?E.current=o:z.current=o,D.current=!0,R.current=requestAnimationFrame(t)};return t(),()=>{R.current&&cancelAnimationFrame(R.current)}}if(!e&&!t){if("static"===v?E.current.length>0:z.current.length>0){let e=0;const t=()=>{e+=.03,e<1?("static"===v?E.current=E.current.map(t=>t*(1-e)):z.current=z.current.map(t=>t*(1-e)),D.current=!0,requestAnimationFrame(t)):"static"===v?E.current=[]:z.current=[]};t()}}},[t,e,a,n,v]),i(()=>{if(!e)return A.current&&(A.current.getTracks().forEach(e=>e.stop()),A.current=null,C?.()),L.current&&"closed"!==L.current.state&&(L.current.close(),L.current=null),void(j.current&&(cancelAnimationFrame(j.current),j.current=0));return(async()=>{try{const e=await navigator.mediaDevices.getUserMedia({audio:o?{deviceId:{exact:o},echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});A.current=e,x?.(e);const t=new(window.AudioContext||window.webkitAudioContext),r=t.createAnalyser();r.fftSize=f,r.smoothingTimeConstant=b;t.createMediaStreamSource(e).connect(r),L.current=t,P.current=r,z.current=[]}catch(e){k?.(e)}})(),()=>{A.current&&(A.current.getTracks().forEach(e=>e.stop()),A.current=null,C?.()),L.current&&"closed"!==L.current.state&&(L.current.close(),L.current=null),j.current&&(cancelAnimationFrame(j.current),j.current=0)}},[e,o,f,b,k,x,C]),i(()=>{const o=T.current;if(!o)return;const r=o.getContext("2d");if(!r)return;let i;const g=p=>{const h=o.getBoundingClientRect();if(e&&p-N.current>y&&(N.current=p,P.current)){const e=new Uint8Array(P.current.frequencyBinCount);if(P.current.getByteFrequencyData(e),"static"===v){const t=Math.floor(.05*e.length),o=Math.floor(.4*e.length),r=e.slice(t,o),i=Math.floor(h.width/(a+n)),s=Math.floor(i/2),l=[];for(let e=s-1;e>=0;e--){const t=Math.floor(e/s*r.length),o=Math.min(1,r[t]/255*m);l.push(Math.max(.05,o))}for(let e=0;e<s;e++){const t=Math.floor(e/s*r.length),o=Math.min(1,r[t]/255*m);l.push(Math.max(.05,o))}E.current=l,I.current=l}else{let t=0;const o=Math.floor(.05*e.length),r=Math.floor(.4*e.length),a=e.slice(o,r);for(let e=0;e<a.length;e++)t+=a[e];const i=t/a.length/255*m;z.current.push(Math.min(1,Math.max(.05,i))),I.current=[...z.current],z.current.length>w&&z.current.shift()}D.current=!0}if(!D.current&&!e)return void(i=requestAnimationFrame(g));D.current=e,r.clearRect(0,0,h.width,h.height);const b=l||getComputedStyle(o).color||"#000",f=a+n,k=Math.floor(h.width/f),x=h.height/2;if("static"===v){const o=t||e||E.current.length>0?E.current:[];for(let e=0;e<k&&e<o.length;e++){const t=o[e]||.1,i=e*f,n=Math.max(u,t*h.height*.8),l=x-n/2;r.fillStyle=b,r.globalAlpha=.4+.6*t,s>0?(r.beginPath(),r.roundRect(i,l,a,n,s),r.fill()):r.fillRect(i,l,a,n)}}else for(let e=0;e<k&&e<z.current.length;e++){const t=z.current.length-1-e,o=z.current[t]||.1,i=h.width-(e+1)*f,n=Math.max(u,o*h.height*.8),l=x-n/2;r.fillStyle=b,r.globalAlpha=.4+.6*o,s>0?(r.beginPath(),r.roundRect(i,l,a,n,s),r.fill()):r.fillRect(i,l,a,n)}if(c&&d>0&&h.width>0){if(!V.current||O.current!==h.width){const e=r.createLinearGradient(0,0,h.width,0),t=Math.min(.3,d/h.width);e.addColorStop(0,"rgba(255,255,255,1)"),e.addColorStop(t,"rgba(255,255,255,0)"),e.addColorStop(1-t,"rgba(255,255,255,0)"),e.addColorStop(1,"rgba(255,255,255,1)"),V.current=e,O.current=h.width}r.globalCompositeOperation="destination-out",r.fillStyle=V.current,r.fillRect(0,0,h.width,h.height),r.globalCompositeOperation="source-over"}r.globalAlpha=1,i=requestAnimationFrame(g)};return i=requestAnimationFrame(g),()=>{i&&cancelAnimationFrame(i)}},[e,t,m,y,w,a,u,n,s,l,c,d,v]),p("div",{className:ge("relative h-full w-full",S),ref:F,style:{height:$},"aria-label":e?"Live audio waveform":t?"Processing audio":"Audio waveform idle",role:"img",...M,children:[!e&&!t&&g("div",{className:"border-muted-foreground/20 absolute top-1/2 right-0 left-0 -translate-y-1/2 border-t-2 border-dotted"}),g("canvas",{className:"block h-full w-full",ref:T,"aria-hidden":"true"})]})},Kt=Object.freeze(["bar","line","area","pie","donut","scatter","bubble","radar","radial-bar","radial","radialbar","treemap","funnel","sankey","composed","waterfall","gauge","histogram","kpi"]);function Yt(e){return String(e||"").trim().toLowerCase().replace(/_/g,"-")}const Qt=/\b(?:field|fields|column|columns|table|tables|sql|summed?|aggregat\w*|averaged?|counted)\b/i,Jt=/[A-Za-z_]\w*\.[A-Za-z_]\w*/;function Gt(e){if("string"!=typeof e)return"";let t,o=e.trim();do{t=o,o=o.replace(/\s*\(([^()]*)\)\s*$/,function(e,t){return Qt.test(t)||Jt.test(t)?"":e}).trim()}while(o!==t);return o}const Zt=new Set(["yes","approve","approved","confirm"]),Xt=new Set(["no","decline","declined","cancel"]),eo=/^[A-Za-z0-9_.:-]{1,128}$/;function to(e){if("string"!=typeof e)return null;const t=e.trim();return eo.test(t)?t:null}function oo(e,t){return null!=e?e:t}function ro(e,t){if(!e||"object"!=typeof e)return null;const o=to(oo(e.tool_call_id,e.toolCallId));if(!o)return null;const r=function(e){if(!e||"object"!=typeof e)return null;if("boolean"==typeof e.approved)return e.approved;const t=String(oo(e.value,"")).trim().toLowerCase();return!!Zt.has(t)||!Xt.has(t)&&null}(t);return null===r?null:{tool_call_id:o,invocation_id:to(oo(e.invocation_id,e.invocationId))||"",approved:r}}const ao=/\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)|(https?:\/\/[^\s<>()]+[^\s<>().,;:!?'"])/g;function io(e){if(!e)return null;const t=String(e),o=[];let r,a=0;for(ao.lastIndex=0;null!==(r=ao.exec(t));){const e=r.index,i=void 0!==r[1]?r[1]:r[3],n=mt(void 0!==r[2]?r[2]:r[3]);n&&(e>a&&o.push({type:"text",value:t.slice(a,e)}),o.push({type:"link",label:i,href:n}),a=e+r[0].length)}return 0===o.length?null:(a<t.length&&o.push({type:"text",value:t.slice(a)}),o)}function no(e){return String(oo(e,"")).trim().toLowerCase()}function so(e,t){if(null==t)return null;const o=no(t);if(!o)return null;const r=e||[];for(let e=0;e<r.length;e+=1){const t=r[e];if(no(t?t.value:void 0)===o||no(t?t.label:void 0)===o)return String(oo(oo(t.value,t.label),""))}return null}function lo(e,t){const o=e||[];for(let e=t+1;e<o.length;e+=1){const t=o[e];if(t&&"user"===t.role&&!t.sendFailed)return"string"==typeof t.content?t.content:String(oo(t.content,""))}}const co=e.createContext(void 0),uo=({messages:e=[],liveJoined:o=[],isDark:n,primaryColor:s,isLoading:l,agentMessageBubbleColor:c,userMessageBoxColor:d,textColor:u,assistantTextColor:m,userTextColor:b,fontFamily:f,agentMessageBubbleFontFamily:w,agentMessageBubbleFontSize:y,userMessageBubbleFontFamily:v,userMessageBubbleFontSize:k,fontSize:x,formatTime:C,isRtl:S=!1,defaultLanguage:M="en",quickQuestions:T=[],shouldShowQuickQuestions:F=!1,onQuickQuestion:P,quickQuestionsLayout:L="vertical",onDecision:A,disclaimerEnabled:j=!1,disclaimerText:N,disclaimerPosition:R="top",disclaimerLinkUrl:I,disclaimerLinkLabel:B,resolvedAgentBubbleColor:E,resolvedUserMessageColor:D,resolvedTextColor:V,isVoiceSessionActive:O=!1,voiceStatus:$="idle",messagesContainerRef:U,companyLogo:q,chatbotAvatarEnabled:H,chatbotAvatar:_,conciergeName:W,companyName:K,apiBaseUrl:Y,getAuthToken:Q,onPromptSuggestionClick:J,conversationResetKey:G,allowFeedback:Z,provideCitations:X,onFeedback:te,headerTextColor:re,onRetryMessage:ae,beforePromptsSlot:ie=null,promptsSlot:ne=null,quickQuestionsHeadingLabel:se})=>{const ce=r(null),de=r(!0),ge=r(!1),pe=t(()=>e.map(e=>`${e.id}:${e.content?.length??0}:${e.isProcessing?1:0}`).join("|"),[e]),he=a(()=>{const e=U?.current;if(!e)return;const t=e.scrollHeight-e.scrollTop-e.clientHeight;de.current=t<160},[U]);i(()=>{const e=U?.current;if(e)return e.addEventListener("scroll",he,{passive:!0}),he(),()=>{e.removeEventListener("scroll",he)}},[he,U]),i(()=>{G&&(de.current=!0,ge.current=!1)},[G]),i(()=>{if(ge.current||0===e.length||"undefined"==typeof window)return;ge.current=!0;let t,o=!1;const r=window.requestAnimationFrame(()=>{o||(t=window.requestAnimationFrame(()=>{o||(ce.current?.scrollIntoView({behavior:"instant",block:"end"}),de.current=!0)}))});return()=>{o=!0,window.cancelAnimationFrame(r),window.cancelAnimationFrame(t)}},[0===e.length]),i(()=>{if(!de.current)return;if("undefined"==typeof window)return;let e=!1;const t=window.requestAnimationFrame(()=>{e||ce.current?.scrollIntoView({behavior:"smooth",block:"end"})});return()=>{e=!0,window.cancelAnimationFrame(t)}},[pe,l]),i(()=>{if(!O||"connected"!==$)return;if("undefined"==typeof window)return;let e=!1;const t=window.requestAnimationFrame(()=>{e||ce.current?.scrollIntoView({behavior:"smooth",block:"end"})});return()=>{e=!0,window.cancelAnimationFrame(t)}},[O,$]);const me=t(()=>ue(I),[I]),be=t(()=>function(e,t=[]){const o=new Map;if(!Array.isArray(e))return o;const r=new Set((Array.isArray(t)?t:[]).map(e=>e?.name).filter(Boolean));for(const t of e){const e=le(t);if(!e||!t.id)continue;const a=!r.has(e);r.add(e),o.set(t.id,{name:e,joined:a})}return o}(e,o),[e,o]),fe=t(()=>function(e,t=[]){const o=new Map,r=Array.isArray(t)?t:[],a=r[r.length-1]?.id;for(const t of Array.isArray(e)?e:[]){if(!t?.name)continue;const e=t.afterMessageId&&r.some(e=>e.id===t.afterMessageId)?t.afterMessageId:a;if(!e)continue;const i=o.get(e)||[];i.push(t.name),o.set(e,i)}return o}(o,e),[o,e]),we=(e,t)=>g("div",{role:"status","data-testid":"agent-joined-line",style:{textAlign:"center",fontSize:"12px",opacity:.7,margin:"8px 0"},children:oe(M,"agentJoinedConversation").replace("{name}",e)},t),ye=t(()=>ee(N,S),[N,S]);return p(h,{children:[j&&N&&"top"===R&&g("div",{className:"flex justify-center",children:g("div",{className:"rounded-lg px-2 py-1 ",style:{color:n?"#d1d5db":"#6b7280",fontFamily:null!=f?f:"Inter",fontSize:null!=x?`calc(${x} - 2px)`:"12px",direction:ye?"rtl":"ltr",textAlign:"center",borderColor:n?"#374151":"#e5e7eb"},children:p("p",{className:"leading-relaxed whitespace-pre-wrap break-words inline",dir:ye?"rtl":"ltr",style:{color:n?"#d1d5db":"#6b7280",fontFamily:null!=f?f:"Inter",fontSize:null!=x?`calc(${x} - 2px)`:"12px"},children:[N,me&&B&&g("a",{href:me,target:"_blank",rel:"noopener noreferrer",title:me,style:{color:n?"#93c5fd":"#2563eb",marginInlineStart:"4px",verticalAlign:"middle",display:"inline-flex",alignItems:"center"},children:B})]})})}),e.map((t,o)=>{const r=be.get(t.id);return p(co.Provider,{value:"assistant"===t.role?lo(e,o):void 0,children:[r?.joined&&we(r.name),r&&g("div",{"data-testid":"agent-sender-name",style:{fontSize:"12px",fontWeight:600,opacity:.8,margin:"0 0 2px 4px",textAlign:S?"right":"left"},children:r.name}),g(It,{message:t,isDark:n,primaryColor:s,agentMessageBubbleColor:c,userMessageBoxColor:d,resolvedUserMessageColor:D,resolvedAgentBubbleColor:E,textColor:u,assistantTextColor:m,userTextColor:b,fontFamily:f,agentMessageBubbleFontFamily:w,agentMessageBubbleFontSize:y,userMessageBubbleFontFamily:v,userMessageBubbleFontSize:k,fontSize:x,formatTime:C,isRtl:ee(t.content,S),onDecision:A,onPromptSuggestionClick:J,companyLogo:H&&_?_:q,conciergeName:W,companyName:K,apiBaseUrl:Y,getAuthToken:Q,allowFeedback:Z,provideCitations:X,onFeedback:te,headerTextColor:re,onRetryMessage:ae,defaultLanguage:M}),(fe.get(t.id)||[]).map(e=>we(e,`live-join-${e}`))]},t.id)}),(()=>{const t=e[e.length-1],o=l&&"user"===t?.role,r=e.some(e=>"assistant"===e.role&&(e.isProcessing||!e.content));return o&&!r?g(It,{message:z(),isDark:n,primaryColor:s,agentMessageBubbleColor:c,resolvedAgentBubbleColor:E,userMessageBoxColor:d,textColor:u,assistantTextColor:m,userTextColor:b,fontFamily:f,agentMessageBubbleFontFamily:w,agentMessageBubbleFontSize:y,userMessageBubbleFontFamily:v,userMessageBubbleFontSize:k,fontSize:x,formatTime:C,isRtl:S,onDecision:A,companyLogo:H&&_?_:q,conciergeName:W,companyName:K,apiBaseUrl:Y,getAuthToken:Q,headerTextColor:re,defaultLanguage:M},"skeleton-waiting"):null})(),ie,ne?g("div",{className:"pt-1",children:ne}):F&&T.length>0&&g("div",{className:"pt-1",children:g(_t,{questions:T,isDark:n,primaryColor:s,onQuestionClick:P,isTyping:l,layout:L,fontFamily:f,fontSize:x,textColor:u,isRtl:S,questionTextColor:m,questionBoxColor:c,resolvedUserMessageColor:D,userMessageBoxColor:d,userTextColor:b,headingLabel:se,defaultLanguage:M})}),O&&"connected"===$&&!l&&g("div",{className:"flex gap-3 flex-row-reverse animate-in",children:g("div",{className:"flex flex-col items-end max-w-[75%] w-full",children:p("div",{className:"rounded-2xl px-4 py-2.5 shadow-lg rounded-tr-sm w-full",style:{background:`linear-gradient(135deg, ${D||s||"#2563eb"} 0%, ${D||s||"#2563eb"}dd 100%)`,width:"100px"},children:[g("span",{className:"sr-only",children:"Listening for voice input"}),g(Wt,{active:!0,barWidth:2,barHeight:4,barGap:2,barColor:b||V||"#FFFFFF",height:20,fadeEdges:!0,className:"min-w-[60px]","aria-hidden":"true"})]})})}),g("div",{ref:ce,className:"h-px"})]})},go=new Set(["size_exceeded","file_too_large","mime_not_allowed"]),po=[["application/pdf","PDF"],["image/jpeg","JPG"],["image/png","PNG"],["image/gif","GIF"],["image/webp","WEBP"],["application/msword","DOC"],["application/vnd.openxmlformats-officedocument.wordprocessingml.document","DOCX"],["application/vnd.ms-excel","XLS"],["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","XLSX"],["text/csv","CSV"],["text/plain","TXT"]];const ho=(e,t)=>e.replace(/\{(\w+)\}/g,(e,o)=>t[o]??""),mo=e=>{const t=Math.max(0,Number(e)||0)/1048576;return String(t>=10?Math.round(t):Math.round(10*t)/10)};function bo(e,t,o={}){const r=String(o.fileUploadMaxSizeMB??"");if("mime_not_allowed"===t.code){const t=function(e){const t=new Set((e||[]).map(e=>String(e).toLowerCase()));return po.filter(([e])=>t.has(e)).map(([,e])=>e).join(", ")}(o.fileUploadAllowedMimes);return ho(e("attachmentTypeNotAllowed"),{types:t||"PDF"})}if("file_too_large"===t.code)return ho(e("attachmentFileTooLarge"),{max_mb:String(o.fileUploadMaxFileMB??r)});const a=Number(t.usedBytes)||0;return a>0?ho(e("attachmentLimitReachedUsed"),{max_mb:r,used_mb:mo(a)}):ho(e("attachmentLimitReached"),{max_mb:r})}function fo(e,t){return String(e||"").replace(/\/+$/,"")+(t.startsWith("/")?t:`/${t}`)}function wo({apiEndpoint:e,conversationId:t,size:o,authHeader:r}){fetch(fo(e,"/api/v1/chat-attachments/release"),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversationId:t,size:o})}).catch(()=>{})}function yo({orgId:e,conversationId:i,config:n,apiEndpoint:s,authHeader:l,onError:c,onRejected:d}){const[u,g]=o([]),p=r(new Map),h=r(0),m=r(u);m.current=u;const b=r({conversationId:i,bytes:0});b.current.conversationId!==i&&(b.current={conversationId:i,bytes:0});const f=a(()=>(h.current+=1,`att-${Date.now()}-${h.current}`),[]),w=a((e,t)=>{g(o=>o.map(o=>o.id===e?{...o,...t}:o))},[]),y=a((e,t,o)=>{if(d&&go.has(t)){const o=m.current.find(t=>t.id===e);return g(t=>t.filter(t=>t.id!==e)),void d({code:t,filename:o?.filename,size:o?.size,usedBytes:Math.max(0,b.current.bytes)})}const r={status:"error",error:{code:t,message:o}};g(t=>{const o=t.map(t=>t.id===e?{...t,...r}:t),a=o.find(t=>t.id===e);return a&&c&&c(a),o})},[c,d]),v=a((e,t)=>{if(!n?.fileUploadEnabled)return{ok:!1,code:"feature_disabled",message:"File uploads are not enabled for this organization."};if(t>=n.fileUploadMaxFiles)return{ok:!1,code:"too_many_files",message:`Max ${n.fileUploadMaxFiles} files per message.`};const o=1024*n.fileUploadMaxSizeMB*1024;if(b.current.bytes+e.size>o){return{ok:!1,code:"size_exceeded",message:`This conversation has already used ${(b.current.bytes/1048576).toFixed(1)} MB of its ${n.fileUploadMaxSizeMB} MB upload limit - this file won't fit.`}}const r=(e.type||"").toLowerCase(),a=new Set((n.fileUploadAllowedMimes||[]).map(e=>String(e).toLowerCase()));return a.size>0&&!a.has(r)?{ok:!1,code:"mime_not_allowed",message:`File type "${e.type||"unknown"}" is not allowed.`}:{ok:!0}},[n]),k=a(async(e,t)=>{let o;try{o=await fetch(fo(s,"/api/v1/chat-attachments/presign"),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",...l?{Authorization:l}:{}},body:JSON.stringify({filename:t.name,mimeType:t.type,size:t.size,conversationId:i})})}catch(o){return b.current.bytes=Math.max(0,b.current.bytes-t.size),void y(e,"network","Network error while requesting upload.")}if(!o.ok){let r="Upload rejected by the server.",a="unknown";try{const e=await o.json();e?.error&&(r=e.error),e?.code&&(a=function(e){switch(e){case"feature_disabled":case"size_exceeded":case"mime_not_allowed":case"storage_unavailable":case"file_too_large":return e;case"session_exceeded":return"size_exceeded";default:return"unknown"}}(e.code))}catch{}return b.current.bytes=Math.max(0,b.current.bytes-t.size),void y(e,a,r)}let r=0;const a=()=>{r>0&&(wo({apiEndpoint:s,conversationId:i,size:r,authHeader:l}),r=0,w(e,{reservedBytes:0}))},n=()=>{b.current.bytes=Math.max(0,b.current.bytes-t.size)};let c;try{c=await o.json()}catch{return wo({apiEndpoint:s,conversationId:i,size:t.size,authHeader:l}),n(),w(e,{reservedBytes:0}),void y(e,"unknown","Malformed presign response.")}let d,u;("boolean"==typeof c.reserved?c.reserved:!c.useMultipart)&&(r=t.size,w(e,{reservedBytes:t.size}));try{if(c.useMultipart){const o=await function({url:e,file:t,conversationId:o,authHeader:r,onProgress:a,registerXhr:i}){return new Promise((r,n)=>{const s=new XMLHttpRequest;i(s),s.open("POST",e,!0),s.withCredentials=!0;const l=new FormData;l.append("conversationId",o),l.append("file",t,t.name),s.upload.onprogress=e=>{e.lengthComputable&&a(Math.round(e.loaded/e.total*100))},s.onload=()=>{if(s.status>=200&&s.status<300)try{const e=JSON.parse(s.responseText);r({url:"string"==typeof e?.url?e.url:void 0,storageKey:"string"==typeof e?.storageKey?e.storageKey:void 0})}catch{r({})}else n(new Error(`upload_status_${s.status}`))},s.onerror=()=>n(new Error("network")),s.onabort=()=>n({aborted:!0}),s.send(l)})}({url:fo(s,"/api/v1/chat-attachments/multipart"),file:t,conversationId:i,authHeader:l,onProgress:t=>w(e,{progress:t}),registerXhr:t=>p.current.set(e,t)});d=o.url,u=o.storageKey,r=t.size,w(e,{reservedBytes:t.size})}else{if(!c.uploadUrl)throw new Error("presign_missing_target");{await function({url:e,file:t,onProgress:o,registerXhr:r}){return new Promise((a,i)=>{const n=new XMLHttpRequest;r(n),n.open("PUT",e,!0),n.setRequestHeader("x-ms-blob-type","BlockBlob"),t.type&&n.setRequestHeader("Content-Type",t.type),n.upload.onprogress=e=>{e.lengthComputable&&o(Math.round(e.loaded/e.total*100))},n.onload=()=>{n.status>=200&&n.status<300?a():i(new Error(`upload_status_${n.status}`))},n.onerror=()=>i(new Error("network")),n.onabort=()=>i({aborted:!0}),n.send(t)})}({url:c.uploadUrl,file:t,onProgress:t=>w(e,{progress:t}),registerXhr:t=>p.current.set(e,t)});const o=await async function({apiEndpoint:e,storageKey:t,filename:o,mimeType:r,authHeader:a}){let i;try{i=await fetch(fo(e,"/api/v1/chat-attachments/confirm"),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",...a?{Authorization:a}:{}},body:JSON.stringify({storageKey:t,filename:o,mimeType:r})})}catch{return{ok:!1,code:"network",message:"Network error while verifying upload."}}if(i.ok)return{ok:!0};let n="Upload rejected - file content did not match its declared type.",s="content_mismatch";try{const e=await i.json();e?.error&&(n=e.error),"password_protected"===e?.code&&(s="password_protected")}catch{}return{ok:!1,code:s,message:n}}({apiEndpoint:s,storageKey:c.storageKey,filename:t.name,mimeType:t.type,authHeader:l});if(!o.ok)return p.current.delete(e),a(),n(),void y(e,o.code,o.message)}}}catch(t){if(p.current.delete(e),t&&t.aborted)return;return a(),n(),void y(e,"network","Upload failed. Please retry.")}p.current.delete(e),w(e,{status:"ready",progress:100,storageKey:u||c.storageKey,...d?{url:d}:{}})},[s,l,i,y,w]),x=a(async e=>{const t=Array.from(e);for(const e of t){const t=m.current.filter(e=>"error"!==e.status).length,o=v(e,t),r=f();if(!o.ok&&d&&go.has(o.code)){d({code:o.code,filename:e.name,size:e.size,usedBytes:Math.max(0,b.current.bytes)});continue}if(!o.ok){const t={id:r,filename:e.name,size:e.size,mimeType:e.type,status:"error",error:{code:o.code,message:o.message}};g(e=>(c&&c(t),[...e,t]));continue}const a={id:r,filename:e.name,size:e.size,mimeType:e.type,status:"uploading",progress:0,reservedBytes:0};g(e=>[...e,a]),b.current.bytes+=e.size,k(r,e)}},[v,k,f,c,d]),C=a(e=>{const t=p.current.get(e);t&&(t.abort(),p.current.delete(e));const o=m.current.find(t=>t.id===e);o&&o.reservedBytes>0&&(wo({apiEndpoint:s,conversationId:i,size:o.reservedBytes,authHeader:l}),b.current.bytes=Math.max(0,b.current.bytes-o.reservedBytes)),g(t=>t.filter(t=>t.id!==e))},[s,l,i]),S=a(()=>{for(const e of p.current.values())e.abort();p.current.clear(),g([])},[]),M=t(()=>u.some(e=>"validating"===e.status||"uploading"===e.status),[u]),T=a(()=>u.filter(e=>"ready"===e.status&&"string"==typeof e.storageKey).map(e=>({filename:e.filename,mimeType:e.mimeType,size:e.size,storageKey:e.storageKey,url:e.url})),[u]);return{attachments:u,addFiles:x,removeAttachment:C,clearAll:S,isBusy:M,toSendPayload:T}}function vo(e){if(!e||e<1024)return`${e||0} B`;const t=["KB","MB","GB"];let o=e/1024,r=0;for(;o>=1024&&r<t.length-1;)o/=1024,r+=1;return`${o.toFixed(o>=10?0:1)} ${t[r]}`}function ko({attachment:e,onRemove:t,isDark:o,removeLabel:r="Remove attachment"}){const a="error"===e.status,i="uploading"===e.status,n="ready"===e.status,s=a?o?"rgba(239,68,68,0.15)":"#fee2e2":o?"#1f2937":"#f3f4f6",l=a?o?"#b91c1c":"#fca5a5":o?"#374151":"#e5e7eb",c=a?o?"#fca5a5":"#b91c1c":o?"#e5e7eb":"#374151",d=a?`${e.filename} - ${e.error?.message||"error"}`:i?`${e.filename} - uploading`:`${e.filename} - ready`;return p("div",{className:"inline-flex items-center gap-2 rounded-full pl-2 pr-1 py-1 text-xs",style:{backgroundColor:s,border:`1px solid ${l}`,color:c,maxWidth:240},role:"group",title:a?e.error?.message:e.filename,"aria-label":d,children:[a?g(Ke,{size:12,"aria-hidden":"true"}):i?g(Ge,{size:12,className:"animate-spin","aria-hidden":"true"}):g(Je,{size:12,"aria-hidden":"true"}),g("span",{className:"truncate",style:{maxWidth:140,direction:"ltr"},children:e.filename}),n&&g("span",{className:"opacity-70 text-chip",children:vo(e.size)}),i&&"number"==typeof e.progress&&p("span",{className:"opacity-70 text-chip",children:[e.progress,"%"]}),g("button",{type:"button",onClick:()=>t(e.id),className:"w-4 h-4 rounded-full inline-flex items-center justify-center",style:{backgroundColor:"transparent",border:"none",color:c,cursor:"pointer"},"aria-label":r,children:g(lt,{size:12})})]})}function xo({prompts:t,getDisplayText:o,detectDirection:r,ambientIsRtl:a,wrapperProps:i,stackProps:n,getKey:s,getChipProps:l,onChipClick:c,onSelect:d,before:u,after:g}){const p=e.createElement("div",n,t.map((t,i)=>{const n=o(t),u=r(n,a);return e.createElement("button",{key:s(t,i),type:"button",...l({prompt:t,index:i,displayText:n,chipIsRtl:u}),onClick:e=>{c&&c(t,i),d(t,i,e)}},n)}));return null==u&&null==g?e.createElement("div",i,p):e.createElement("div",i,u,p,g)}const Co=({suggestions:e,onSuggestionClick:t,promptPrimary:o,promptTextColor:r,promptFontFamily:a,promptFontSize:i,isRtl:n,t:s,questionDisplay:l=!0})=>g(xo,{prompts:e,getDisplayText:e=>((e,t=!0)=>{if(!e||"string"==typeof e)return e||"";const o="string"==typeof e.text?e.text:"";if(!t)return o;const r="string"==typeof e.submitText?e.submitText.trim():"";return r&&r!==o?r:o})(e,l),detectDirection:ee,ambientIsRtl:n,wrapperProps:{className:"mb-2 px-5"},stackProps:{className:"flex flex-col gap-2",role:"group","aria-label":s("suggestedQuestions")},getKey:(e,t)=>`${e.text||e}-${t}`,getChipProps:({chipIsRtl:e})=>({dir:e?"rtl":"ltr",className:"block w-full rounded-2xl px-4 py-2 border-0 transition-transform duration-150 active:scale-[0.99] "+(e?"text-right":"text-left"),style:{direction:e?"rtl":"ltr",textAlign:e?"right":"left",background:`linear-gradient(135deg, ${o} 0%, ${o}dd 100%)`,color:r,fontFamily:a,fontSize:i}}),onSelect:(e,o)=>t(e.submitText||e.text||e,e,o)}),So=({onStopGeneration:e,inputValue:n,setInputValue:s,onSend:l,isDark:c,primaryColor:d,isOpen:u,isMinimized:b,isLoading:f,isConversationLoading:w=!1,placeholder:y,textColor:v,fontFamily:k,fontSize:x,isRtl:C=!1,csatVisible:S=!1,enableVoiceInteraction:M=!1,isVoiceSessionActive:T=!1,voiceStatus:F="idle",voiceError:z=null,onVoiceToggle:P,onBidiSubmit:L,disclaimerEnabled:A=!1,disclaimerText:j,disclaimerPosition:N="top",disclaimerLinkUrl:R,disclaimerLinkLabel:I,showPoweredBy:B=!0,onboardingQuestions:E=[],onboardingActive:D=!1,onboardingCompleted:V=!1,userMessageBubbleFontFamily:O,onboardingEnabled:$=!1,userMessageBubbleFontSize:U,userMessageBoxColor:q,resolvedUserMessageColor:H,userTextColor:K,promptSuggestions:Y,onPromptSuggestionClick:Q,autoPromptQuestionDisplay:G=!0,tagSelectorNode:Z=null,showResolveButton:X=!1,onResolve:te,defaultLanguage:oe="en",chatFeatures:ae,apiEndpoint:ie,organizationId:ne,conversationId:se,onSynthesizeAssistantMessage:le})=>{const ce=t(()=>re(oe),[oe]),de=t(()=>function(e){const t=J(e),o=W[t]||_;return{beforeBrand:o.poweredByBefore??o.poweredBy??_.poweredByBefore,afterBrand:o.poweredByAfter??""}}(oe),[oe]),pe=t(()=>ee(n,C),[n,C]),[he,me]=o(!1),[be,fe]=o(!1),we=t(()=>({fileUploadEnabled:ae?.fileUploadEnabled??!1,fileUploadMaxSizeMB:ae?.fileUploadMaxSizeMB??10,fileUploadMaxFiles:ae?.fileUploadMaxFiles??3,fileUploadAllowedMimes:ae?.fileUploadAllowedMimes??[]}),[ae]),{attachments:ye,addFiles:ve,removeAttachment:ke,clearAll:xe,isBusy:Ce,toSendPayload:Se}=yo({orgId:ne,conversationId:se,config:we,apiEndpoint:ie,authHeader:void 0,onRejected:le?e=>le(bo(ce,e,{...we,fileUploadMaxFileMB:ae?.fileUploadMaxFileMB??25})):void 0}),Me=r(null),Te=r(new Set);i(()=>{if(!T||!se||!ie)return;const e=Se().filter(e=>e.storageKey&&!Te.current.has(e.storageKey));e.length&&(e.forEach(e=>Te.current.add(e.storageKey)),fetch(`${String(ie).replace(/\/$/,"")}/api/v1/chat-attachments/ingest`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversationId:se,attachments:e.map(e=>({storageKey:e.storageKey}))})}).catch(()=>{}))},[T,se,ie,ye,Se]);const Fe=!!we.fileUploadEnabled&&!!ie,ze=ye.length>=we.fileUploadMaxFiles,Pe=`Max ${we.fileUploadMaxFiles} files per message.`,Le=t(()=>we.fileUploadAllowedMimes.length>0?we.fileUploadAllowedMimes.join(","):void 0,[we.fileUploadAllowedMimes]),[Ae,je]=o({top:0,left:0,placement:"top",arrowOffset:0}),[Ne,Re]=o(!1),Ie=r(null),Be=r(null),Ee=r(null),De=r(null);ht(k),ht(O),i(()=>{u&&!b&&Be.current?.focus()},[u,b]),i(()=>{const e=Be.current;if(e){e.style.height="auto";const t=e.scrollHeight,o=n.trim().length>0?20:48,r=Math.max(o,Math.min(t,120));e.style.height=`${r}px`}},[n]);const Ve=a(()=>{const e=Se();e.length>0?(l(void 0,e),xe()):l()},[Se,xe,l]),Oe=ye.some(e=>"ready"===e.status),$e=!n.trim()&&!Oe||f||w||Ce,Ue=c?"#374151":"#e5e7eb",He=E&&E.length>0,_e=S||w||$&&(He&&!V)||"connecting"===F,We=S?ce("pleaseSubmitRatingFirst"):He?D?ce("completeOnboardingToEnableVoice"):V?"":ce("sendMessageToCompleteOnboarding"):"",Ke=()=>{if(!Ee.current)return;const e=Ee.current.getBoundingClientRect(),t=220,o=e.top,r=window.innerHeight-e.bottom;let a="top",i=0,n=0;o>=73?(a="top",i=e.top-60-5-8,n=e.right-t,n<10&&(n=10),n+t>window.innerWidth-10&&(n=window.innerWidth-t-10)):r>=68?(a="bottom",i=e.bottom+8,n=e.right-t,n<10&&(n=10),n+t>window.innerWidth-10&&(n=window.innerWidth-t-10)):(a="top",i=Math.max(10,e.top-60-5-8),n=e.right-t,n<10&&(n=10),n+t>window.innerWidth-10&&(n=window.innerWidth-t-10));return{top:i,left:n,placement:a,arrowOffset:e.left+e.width/2-n}};i(()=>{if(be&&We){const e=()=>{const e=Ke();je(e)};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}}},[be,We]),i(()=>()=>{Ie.current&&clearTimeout(Ie.current)},[]);const Ye=null!=H?H:null!=q?q:null!=d?d:"#2563eb",Qe=null!=K?K:null!=v?v:"#FFFFFF",Je=null!=O?O:null!=k?k:"Inter",Ze=null!=U?U:null!=x?x:null,Xe=Ze?`calc(${Ze} - 2px)`:"12px",tt=ue(R);return p("div",{className:"pt-4 pb-1 flex-shrink-0 relative "+(c?"bg-gray-900":"bg-white"),style:{overflow:"visible"},children:[Z||Y.length>0&&Q&&g(Co,{suggestions:Y,onSuggestionClick:Q,questionDisplay:G,promptPrimary:Ye,promptTextColor:Qe,promptFontFamily:Je,promptFontSize:Xe,isRtl:C,t:ce}),g("div",{className:"my-4",style:{height:"1px",backgroundColor:Ue}}),Fe&&ye.length>0&&g("div",{className:"px-5 mb-2 flex flex-wrap gap-1.5",children:ye.map(e=>g(ko,{attachment:e,onRemove:ke,isDark:c,removeLabel:ce("removeAttachment")},e.id))}),p("div",{className:"flex items-center px-5 gap-1.5",children:[Fe&&g("input",{ref:Me,type:"file",multiple:!0,accept:Le,"aria-label":ce("uploadFile"),className:"hidden",style:{display:"none"},onChange:e=>{const t=e.target.files;t&&t.length&&!ze&&ve(t),e.currentTarget.value=""}}),p("div",{className:`flex-1 flex items-center gap-1 px-1 min-h-[48px] ${c?"bg-gray-800":"bg-gray-50"} rounded-2xl transition-all duration-200`,style:{borderStyle:"solid",borderColor:n&&n.trim().length>0?d||"#2563eb":Ue,borderWidth:n&&n.trim().length>0?"2px":"1px"},children:[Fe&&p("div",{className:"relative group shrink-0",children:[g("button",{type:"button",onClick:()=>Me.current&&Me.current.click(),disabled:S||w||f||ze,"aria-label":ze?Pe:"Attach file",title:ze?Pe:"Attach file",className:`h-8 w-8 rounded-lg flex items-center justify-center transition-colors duration-200 ${c?"text-gray-300 hover:bg-gray-700":"text-gray-500 hover:bg-gray-200"} disabled:opacity-40 disabled:cursor-not-allowed`,style:{border:"none"},children:g(et,{className:"w-4 h-4"})}),ze&&g("div",{role:"tooltip",className:"pointer-events-none absolute bottom-full left-1/2 -translate-x-1/2 mb-2 opacity-0 group-hover:opacity-100 transition-opacity px-3 py-1.5 text-xs rounded-lg whitespace-nowrap shadow-lg "+(c?"bg-gray-700 text-gray-100":"bg-gray-800 text-white"),children:Pe})]}),g("div",{className:"relative flex-1 flex items-center min-w-0",children:g("textarea",{id:"chat-widget-input",ref:Be,"aria-label":y||ce("typeYourMessage"),value:n,onChange:e=>{s(e.target.value)},onFocus:()=>me(!0),onBlur:()=>me(!1),onKeyDown:e=>{if("Enter"===e.key&&!e.shiftKey){if(e.preventDefault(),T&&L&&!Oe)return void L();if($e)return;Ve()}},placeholder:w?ce("agentIsLoading"):y||ce("typeYourMessage"),rows:1,disabled:S||w||f||T&&"connected"!==F,dir:pe?"rtl":"ltr",className:`w-full px-3 bg-transparent rounded-xl leading-normal ${c?"text-gray-100":"text-gray-900"} placeholder-gray-400 resize-none outline-none scrollbar-hide break-words`,style:{height:"auto",maxHeight:"120px",minHeight:"48px",paddingTop:n.trim().length>0?"12px":"0px",paddingBottom:n.trim().length>0?"12px":"0px",lineHeight:n.trim().length>0?"1.4":"48px",fontFamily:O||k||"Inter",fontSize:x||"14px",color:c?"#F3F4F6":"#1F2937",textAlign:pe?"right":"left",direction:pe?"rtl":"ltr",wordSpacing:"0",letterSpacing:"0"}})}),M&&p("div",{className:"relative shrink-0",onMouseEnter:()=>{if(_e&&We){Ie.current&&(clearTimeout(Ie.current),Ie.current=null);const e=Ke();je(e),fe(!0)}},onMouseLeave:()=>{Ie.current&&(clearTimeout(Ie.current),Ie.current=null),fe(!1)},children:[g("button",{style:{border:"none"},ref:Ee,type:"button",onClick:P,"aria-label":ce(T?"stopVoiceInput":"startVoiceInput"),className:`h-8 w-8 rounded-lg flex items-center justify-center transition-colors duration-200 ${T?"bg-red-500 text-white hover:bg-red-600":c?"text-gray-300 hover:bg-gray-700":"text-gray-500 hover:bg-gray-200"} ${_e?"opacity-60 cursor-not-allowed":""}`,disabled:_e,children:"connecting"===F?g(Ge,{className:"w-4 h-4 animate-spin"}):g(qe,{className:"w-4 h-4"})}),be&&We&&"undefined"!=typeof document&&m(p("div",{ref:De,className:"px-3 py-1.5 text-xs shadow-md pointer-events-none",style:{position:"fixed",top:`${Ae.top}px`,left:`${Ae.left}px`,maxWidth:"220px",whiteSpace:"normal",wordWrap:"break-word",minWidth:"180px",zIndex:999999,backgroundColor:c?"#1f2937":"#ffffff",color:c?"#f3f4f6":"#111827",border:c?"1px solid #374151":"1px solid #e5e7eb",borderRadius:"top"===Ae.placement?"6px 6px 6px 6px":"6px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",overflow:"visible"},children:[g("div",{className:"text-left leading-relaxed",children:We}),"top"===Ae.placement&&p(h,{children:[g("div",{style:{position:"absolute",top:"100%",left:`${Ae.arrowOffset}px`,transform:"translateX(-50%)",width:0,height:0,borderLeft:"6px solid transparent",borderRight:"6px solid transparent",borderTop:c?"6px solid #374151":"6px solid #e5e7eb",pointerEvents:"none"}}),g("div",{style:{position:"absolute",top:"100%",left:`${Ae.arrowOffset}px`,transform:"translateX(-50%)",marginTop:"-1px",width:0,height:0,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderTop:c?"5px solid #1f2937":"5px solid #ffffff",pointerEvents:"none"}})]}),"bottom"===Ae.placement&&p(h,{children:[g("div",{className:"absolute bottom-full",style:{left:`${Ae.arrowOffset}px`,transform:"translateX(-50%)",width:0,height:0,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderBottom:c?"5px solid #374151":"5px solid #e5e7eb"}}),g("div",{className:"absolute bottom-full -mb-px",style:{left:`${Ae.arrowOffset}px`,transform:"translateX(-50%)",width:0,height:0,borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderBottom:c?"4px solid #1f2937":"4px solid #ffffff"}})]})]}),document.body)]})]}),g("button",f&&!T&&"function"==typeof e?{onClick:e,className:"h-10 w-10 flex-shrink-0 rounded-xl transition-all duration-200 flex items-center justify-center shadow-md scale-100",style:{backgroundColor:d,color:"white",border:"none"},"aria-label":ce("stopGenerating"),children:g(rt,{className:"w-3.5 h-3.5",fill:"currentColor"})}:{onClick:T&&L&&!Oe?L:Ve,disabled:S||$e||T&&"connected"!==F,className:"h-10 w-10 flex-shrink-0 rounded-xl transition-all duration-200 flex items-center justify-center shadow-md disabled:opacity-40 disabled:cursor-not-allowed disabled:shadow-none "+(n.trim()?"scale-100":"scale-95"),style:{backgroundColor:n.trim()?d:c?"#374151":"#e5e7eb",color:n.trim()?"white":"#9ca3af",border:"none"},"aria-label":ce("sendMessage"),children:g(ot,{className:"w-4 h-4 transition-transform",style:C?{transform:"rotate(-90deg)"}:void 0})})]}),T&&p("p",{"aria-live":"polite",className:`text-xs mt-2 px-5 ${"connected"===F?"text-status-success":"text-gray-500"} flex items-center gap-1`,children:[g("span",{className:"w-1.5 h-1.5 rounded-full bg-current inline-flex"}),ce("connected"===F?"voiceSessionLive":"connectingVoice")]}),z&&g("p",{role:"alert",className:"text-xs mt-1 px-5 text-status-error",children:ce(z)===z?ce("voiceUnavailable"):ce(z)}),A&&j&&"footer"===N&&p("p",{className:"text-xs mt-2 px-5 text-center",style:{color:c?"#d1d5db":"#6b7280",fontFamily:k||"Inter",fontSize:x?`calc(${x} - 2px)`:"12px",direction:C?"rtl":"ltr"},dir:C?"rtl":"ltr",children:[j,tt&&I&&g("a",{href:tt,target:"_blank",rel:"noopener noreferrer",title:tt,style:{color:c?"#93c5fd":"#2563eb",marginInlineStart:"4px",verticalAlign:"middle",display:"inline-flex",alignItems:"center"},children:I})]}),B&&g("div",{className:"mt-1.5 flex justify-center",children:g("a",{href:"https://eshal.ai",target:"_blank",rel:"noopener noreferrer",className:"no-underline",children:p("span",{dir:"ltr",className:"inline-flex items-center gap-1.5 py-0.5 px-3",children:[de.beforeBrand&&g("span",{className:ge("font-sans text-[10px] font-medium",c?"text-gray-400":"text-gray-500"),children:de.beforeBrand}),Ne?g("span",{className:ge("font-sans text-[10px] font-semibold",c?"text-gray-300":"text-gray-600"),children:"ESHAL"}):g("img",{src:c?"data:image/svg+xml,%3csvg width='219' height='54' xmlns='http://www.w3.org/2000/svg' version='1.0'%3e%3cg class='layer'%3e%3ctitle%3eEshal Logo%3c/title%3e%3cg clip-path='url(%23a)' transform='translate(-.708 -1.076)'%3e%3cg clip-path='url(%23b)'%3e%3cpath d='M21.79 54.75h4.5l3.93-.56 4.49-1.4 3.38-1.97 2.81-2.25 2.24-2.81 2.25-3.93 1.13-3.09v-.85l-3.65-1.12h-.57l-1.96 4.5-1.97 3.09-2.81 2.53-3.93 1.96-3.38.85-2.81.28h-2.81l-4.21-.57-3.94-1.4-2.81-1.97-2.25-2.24-1.96-3.38-1.41-4.21-.56-3.37-.28-3.1v-3.65l.56-5.06 1.12-4.21 1.97-3.94 2.53-2.81 2.25-1.68 2.81-1.41 3.37-.84 2.25-.28H26l4.78.84 4.5 2.25 2.53 2.53 1.4 2.53.56 2.53-.28 3.65-1.12 2.25-1.41 1.69-1.4.55-1.13-4.21-1.68-2.81-1.97-1.97-3.09-1.4-1.12-.28h-5.34l-3.09 1.12-2.25 1.69-1.41 1.97-.84 3.09.28 3.08 1.4 2.82 1.97 1.96 2.81 1.41 2.25.56 4.78.28 3.09-.28.84-.28-1.12 3.09-1.69 1.97-2.25.84h-3.65l-2.81-1.12-1.68-1.41-3.38 2.25.56 1.13 1.13 1.4 2.81 1.69 2.81.84h4.78l2.81-.84 2.53-1.69 1.96-2.25L35 34.8l.84-4.5 3.65-2.24 2.53-2.53 1.69-3.09.56-2.25.28-2.81-.56-3.93-1.12-2.82-2.25-3.09-3.09-2.81-4.22-2.25-4.5-1.12-2.52-.28h-4.5l-3.93.56-4.5 1.41-3.38 1.96-3.37 3.1-2.52 3.65-1.97 4.49-1.13 4.78-.28 2.25v9.27l.84 5.06 1.69 4.78 1.69 3.09 2.25 2.81 2.8 2.53 2.82 1.69 5.06 1.68zm1.12-27.54-2.53-.84-1.4-1.12-.84-1.69.28-2.53 1.12-1.4 2.25-1.13H26l2.81 1.41 1.41 1.97.84 2.8v2.25l-1.12.28zm0 0' fill='white'/%3e%3c/g%3e%3c/g%3e%3cpath d='M82.381 38.435v6.48h-27.06V9.965h26.41v6.5h-18.36v7.57h16.22v6.3h-16.22v8.1zm16.432 7.07c-2.77 0-5.44-.37-8.02-1.11-2.57-.75-4.65-1.72-6.22-2.92l2.75-6.09c1.5 1.09 3.28 1.98 5.34 2.64 2.07.67 4.13 1 6.19 1q3.45 0 5.1-1.02t1.65-2.73c0-.83-.33-1.52-.98-2.06-.65-.55-1.48-1-2.5-1.33-1.01-.33-2.39-.7-4.11-1.1-2.67-.63-4.85-1.26-6.55-1.89s-3.15-1.64-4.37-3.04c-1.21-1.41-1.82-3.27-1.82-5.6 0-2.03.55-3.86 1.64-5.51 1.11-1.66 2.76-2.96 4.97-3.92 2.22-.97 4.93-1.46 8.13-1.46 2.22 0 4.4.27 6.53.8s4 1.3 5.59 2.3l-2.5 6.14c-3.23-1.82-6.45-2.74-9.67-2.74-2.27 0-3.95.37-5.03 1.1-1.07.73-1.61 1.69-1.61 2.89q0 1.8 1.86 2.67c1.25.59 3.16 1.16 5.72 1.72 2.66.63 4.85 1.27 6.55 1.9 1.69.63 3.14 1.63 4.36 2.99 1.21 1.37 1.82 3.21 1.82 5.55 0 2-.56 3.82-1.67 5.46q-1.68 2.475-5.01 3.93c-2.23.95-4.95 1.43-8.14 1.43m50.913-35.54v34.95h-8.08v-14.33h-15.88v14.33h-8.09V9.965h8.09v13.78h15.88V9.965zm29.811 27.47h-16.22l-3.1 7.48h-8.29l15.58-34.95h7.98l15.62 34.95h-8.48zm-2.55-6.15-5.55-13.37-5.53 13.37zm16.274-21.32h8.09v28.36h17.52v6.59h-25.61zm0 0' fill='white'/%3e%3c/g%3e%3c/svg%3e":"data:image/svg+xml,%3csvg width='219' height='54' xmlns='http://www.w3.org/2000/svg' version='1.0'%3e%3cg class='layer'%3e%3ctitle%3eEshal Logo%3c/title%3e%3cg clip-path='url(%23a)' transform='translate(-.708 -1.076)'%3e%3cg clip-path='url(%23b)'%3e%3cpath d='M21.79 54.75h4.5l3.93-.56 4.49-1.4 3.38-1.97 2.81-2.25 2.24-2.81 2.25-3.93 1.13-3.09v-.85l-3.65-1.12h-.57l-1.96 4.5-1.97 3.09-2.81 2.53-3.93 1.96-3.38.85-2.81.28h-2.81l-4.21-.57-3.94-1.4-2.81-1.97-2.25-2.24-1.96-3.38-1.41-4.21-.56-3.37-.28-3.1v-3.65l.56-5.06 1.12-4.21 1.97-3.94 2.53-2.81 2.25-1.68 2.81-1.41 3.37-.84 2.25-.28H26l4.78.84 4.5 2.25 2.53 2.53 1.4 2.53.56 2.53-.28 3.65-1.12 2.25-1.41 1.69-1.4.55-1.13-4.21-1.68-2.81-1.97-1.97-3.09-1.4-1.12-.28h-5.34l-3.09 1.12-2.25 1.69-1.41 1.97-.84 3.09.28 3.08 1.4 2.82 1.97 1.96 2.81 1.41 2.25.56 4.78.28 3.09-.28.84-.28-1.12 3.09-1.69 1.97-2.25.84h-3.65l-2.81-1.12-1.68-1.41-3.38 2.25.56 1.13 1.13 1.4 2.81 1.69 2.81.84h4.78l2.81-.84 2.53-1.69 1.96-2.25L35 34.8l.84-4.5 3.65-2.24 2.53-2.53 1.69-3.09.56-2.25.28-2.81-.56-3.93-1.12-2.82-2.25-3.09-3.09-2.81-4.22-2.25-4.5-1.12-2.52-.28h-4.5l-3.93.56-4.5 1.41-3.38 1.96-3.37 3.1-2.52 3.65-1.97 4.49-1.13 4.78-.28 2.25v9.27l.84 5.06 1.69 4.78 1.69 3.09 2.25 2.81 2.8 2.53 2.82 1.69 5.06 1.68zm1.12-27.54-2.53-.84-1.4-1.12-.84-1.69.28-2.53 1.12-1.4 2.25-1.13H26l2.81 1.41 1.41 1.97.84 2.8v2.25l-1.12.28zm0 0' fill='black'/%3e%3c/g%3e%3c/g%3e%3cpath d='M82.381 38.435v6.48h-27.06V9.965h26.41v6.5h-18.36v7.57h16.22v6.3h-16.22v8.1zm16.432 7.07c-2.77 0-5.44-.37-8.02-1.11-2.57-.75-4.65-1.72-6.22-2.92l2.75-6.09c1.5 1.09 3.28 1.98 5.34 2.64 2.07.67 4.13 1 6.19 1q3.45 0 5.1-1.02t1.65-2.73c0-.83-.33-1.52-.98-2.06-.65-.55-1.48-1-2.5-1.33-1.01-.33-2.39-.7-4.11-1.1-2.67-.63-4.85-1.26-6.55-1.89s-3.15-1.64-4.37-3.04c-1.21-1.41-1.82-3.27-1.82-5.6 0-2.03.55-3.86 1.64-5.51 1.11-1.66 2.76-2.96 4.97-3.92 2.22-.97 4.93-1.46 8.13-1.46 2.22 0 4.4.27 6.53.8s4 1.3 5.59 2.3l-2.5 6.14c-3.23-1.82-6.45-2.74-9.67-2.74-2.27 0-3.95.37-5.03 1.1-1.07.73-1.61 1.69-1.61 2.89q0 1.8 1.86 2.67c1.25.59 3.16 1.16 5.72 1.72 2.66.63 4.85 1.27 6.55 1.9 1.69.63 3.14 1.63 4.36 2.99 1.21 1.37 1.82 3.21 1.82 5.55 0 2-.56 3.82-1.67 5.46q-1.68 2.475-5.01 3.93c-2.23.95-4.95 1.43-8.14 1.43m50.913-35.54v34.95h-8.08v-14.33h-15.88v14.33h-8.09V9.965h8.09v13.78h15.88V9.965zm29.811 27.47h-16.22l-3.1 7.48h-8.29l15.58-34.95h7.98l15.62 34.95h-8.48zm-2.55-6.15-5.55-13.37-5.53 13.37zm16.274-21.32h8.09v28.36h17.52v6.59h-25.61zm0 0' fill='black'/%3e%3c/g%3e%3c/svg%3e",alt:"ESHAL",className:ge("h-3",c?"opacity-60":"opacity-50"),onError:()=>Re(!0)}),de.afterBrand&&g("span",{className:ge("font-sans text-[10px] font-medium",c?"text-gray-400":"text-gray-500"),children:de.afterBrand})]})})})]})},Mo=["sun","mon","tue","wed","thu","fri","sat"];function To(e){if(!e||"string"!=typeof e)return null;const t=e.match(/^(\d{1,2}):(\d{2})/);if(!t)return null;const o=parseInt(t[1],10),r=parseInt(t[2],10);return Number.isNaN(o)||Number.isNaN(r)?null:60*o+r}function Fo(e,t=new Date,o={}){if(!e||!e.showStatus)return null;const r=o.online||"Online now",a=o.officeOpen||"Online now",i=o.offlineFallback||"Offline";if("officeHours"!==e.statusMode)return{online:!0,label:r};const n=e.officeHours||{},{dayKey:s,minutes:l}=function(e,t){try{const o=new Intl.DateTimeFormat("en-US",{timeZone:e||void 0,weekday:"short",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(t),r=(o.find(e=>"weekday"===e.type)||{}).value||"";let a=parseInt((o.find(e=>"hour"===e.type)||{}).value||"0",10);const i=parseInt((o.find(e=>"minute"===e.type)||{}).value||"0",10);return 24===a&&(a=0),{dayKey:r.slice(0,3).toLowerCase(),minutes:60*a+i}}catch{return{dayKey:Mo[t.getDay()],minutes:60*t.getHours()+t.getMinutes()}}}(n.timezone,t),c=Array.isArray(n.days)?n.days.map(e=>String(e).slice(0,3).toLowerCase()):[],d=To(n.open),u=To(n.close);if(c.includes(s)&&(null!=d&&null!=u&&(d<=u?l>=d&&l<u:l>=d||l<u))){return{online:!0,label:(n.onlineMessage||"").trim()||a}}return{online:!1,label:(n.offlineMessage||"").trim()||i}}const zo='[role="menuitem"]';function Po(e){const t=e&&"function"==typeof e.getRootNode?e.getRootNode():null;return t&&t.activeElement||document.activeElement}function Lo(e,t){return e?Array.from(e.querySelectorAll(t)).filter(e=>!e.disabled&&"true"!==e.getAttribute("aria-disabled")):[]}function Ao(e,t,o=zo){const{key:r}=e;if("ArrowDown"!==r&&"ArrowUp"!==r&&"Home"!==r&&"End"!==r)return!1;const a=Lo(t,o);if(0===a.length)return!1;e.preventDefault();const i=a.indexOf(Po(t));let n;return n="Home"===r?0:"End"===r?a.length-1:"ArrowDown"===r?i<0?0:(i+1)%a.length:i<0?a.length-1:(i-1+a.length)%a.length,a[n].focus(),!0}const jo=({conciergeName:e,companyName:a,companyLogo:n,primaryColor:s,isDark:l,isMinimized:c=!1,textColor:d,fontFamily:u,fontSize:h,onToggleTheme:m,onMinimize:b,onClose:f,headerTextBold:w=!1,headerTextItalic:y=!1,headerTextColor:v,headerFontFamily:k,headerFontSize:x,subtitle:C=null,showStatus:S=!1,statusMode:M="always",officeHours:T=null,onRefreshChat:F,onCopyChat:z,defaultLanguage:P="en"})=>{const L=s,A=v||"#FFFFFF",j=k||u||"Inter",N=x||h;ht(j);const R=t(()=>re(P),[P]),I=G(P),B=t(()=>ee(C,I),[C,I]),E=t(()=>Fo({showStatus:S,statusMode:M,officeHours:T}),[S,M,T]),[D,V]=o(!1),O=r(null),$=r(null);i(()=>{if(!D)return;const e=e=>{O.current&&!e.composedPath().includes(O.current)&&V(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[D]);const U=r(!1);i(()=>{if(D){U.current=!0;const e=O.current?.querySelector('[role="menuitem"]');e?.focus()}else U.current&&(U.current=!1,$.current?.focus())},[D]);const q=A;return p("div",{className:`text-white ${c?"px-4 py-2.5":"px-3 py-4"} flex items-center justify-between relative overflow-visible rounded-t-2xl z-[60]`,style:{background:L,fontFamily:j},children:[p("div",{className:"flex items-center gap-3 flex-1 min-w-0 pl-1",children:[p("div",{className:"relative w-11 h-11 flex-shrink-0",children:[g("div",{className:"w-full h-full rounded-full overflow-hidden flex items-center justify-center bg-white/20",children:n?g("img",{src:n,alt:"Logo",style:{display:"block",width:"100%",height:"100%",objectFit:"contain"},loading:"lazy"}):g("span",{className:"text-lg font-semibold leading-none",style:{color:q},children:(e||a||"")?.charAt(0)?.toUpperCase()})}),E?g("span",{title:E.label,className:ge("absolute bottom-0 h-3 w-3 rounded-full ring-2 ring-white",I?"left-0":"right-0"),style:{backgroundColor:E.online?"#22c55e":"#9ca3af",boxShadow:E.online?"0 0 0 3px rgba(34,197,94,0.25)":"none"},"aria-hidden":"true"}):null]}),p("div",{className:"flex flex-col justify-center min-w-0",style:{fontFamily:j},children:[g("h3",{title:e,className:ge("font-semibold leading-snug truncate",w&&"font-bold",y&&"italic"),style:{fontSize:N?`calc(${N} + 2px)`:"15px",color:q},children:e}),C?g("p",{title:C,className:"leading-snug truncate opacity-75",dir:B?"rtl":"ltr",style:{fontSize:"12px",color:q,textAlign:B?"right":"left"},children:C}):null]})]}),p("div",{className:"flex items-center gap-0 relative z-10 text-white flex-shrink-0 ml-1",children:[p("div",{className:"relative",ref:O,children:[g("button",{type:"button",ref:$,"aria-label":R("menu"),"aria-expanded":D,"aria-haspopup":"true",onClick:()=>V(e=>!e),onKeyDown:e=>{"Escape"===e.key&&D&&(e.preventDefault(),V(!1))},className:"inline-flex h-7 w-7 items-center justify-center cursor-pointer transition-opacity duration-200 hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/40 rounded-full border-0 bg-transparent p-0",style:{color:q},children:g(Qe,{className:"w-4 h-4",strokeWidth:1.6})}),D&&p("div",{role:"menu","aria-label":R("menu"),tabIndex:-1,dir:I?"rtl":"ltr",onKeyDown:e=>{if("Escape"===e.key)return e.preventDefault(),void V(!1);Ao(e,O.current)||function(e,t,o=zo){if("Tab"!==e.key)return!1;const r=Lo(t,o);if(0===r.length)return!1;const a=r[0],i=r[r.length-1],n=Po(t);e.shiftKey&&n===a?(e.preventDefault(),i.focus()):!e.shiftKey&&n===i&&(e.preventDefault(),a.focus())}(e,O.current)},className:`absolute top-full mt-1 w-44 rounded-xl border shadow-lg py-1 z-[9999] animate-in fade-in slide-in-from-top-1 duration-150 ${I?"left-0":"right-0"} ${l?"bg-gray-800 border-gray-700":"bg-white border-gray-200"}`,style:{fontFamily:j},children:[p("button",{role:"menuitem",onClick:()=>{V(!1),F?.()},className:"flex items-center gap-2.5 w-full px-3 py-2 text-sm leading-5 transition-colors cursor-pointer "+(l?"text-gray-200 hover:bg-gray-700":"text-gray-700 hover:bg-gray-50"),style:{fontFamily:j,fontSize:"14px",border:"none",background:"transparent",appearance:"none",WebkitAppearance:"none",textAlign:I?"right":"left"},children:[g(tt,{className:"w-3.5 h-3.5 flex-shrink-0"}),R("refreshChat")]}),p("button",{role:"menuitem",onClick:()=>{V(!1),z?.()},className:"flex items-center gap-2.5 w-full px-3 py-2 text-sm leading-5 transition-colors cursor-pointer "+(l?"text-gray-200 hover:bg-gray-700":"text-gray-700 hover:bg-gray-50"),style:{fontFamily:j,fontSize:"14px",border:"none",background:"transparent",appearance:"none",WebkitAppearance:"none",textAlign:I?"right":"left"},children:[g(Ye,{className:"w-3.5 h-3.5 flex-shrink-0"}),R("copyChat")]}),p("button",{role:"menuitem",onClick:()=>{V(!1),m?.()},className:"flex items-center gap-2.5 w-full px-3 py-2 text-sm leading-5 transition-colors cursor-pointer "+(l?"text-gray-200 hover:bg-gray-700":"text-gray-700 hover:bg-gray-50"),style:{fontFamily:j,fontSize:"14px",border:"none",background:"transparent",appearance:"none",WebkitAppearance:"none",textAlign:I?"right":"left"},children:[g(l?it:Xe,{className:"w-3.5 h-3.5 flex-shrink-0"}),R(l?"lightMode":"nightMode")]})]})]}),g("button",{type:"button","aria-label":R("close"),onClick:f,className:"inline-flex h-7 w-7 items-center justify-center cursor-pointer transition-opacity duration-200 hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/40 rounded-full border-0 bg-transparent p-0",style:{color:q},children:g(lt,{className:"w-3.5 h-3.5",strokeWidth:1.6})})]})]})},No=({questions:e=[],collapsiblePrompt:a,onSubmit:i,primaryColor:n="#2563eb",isRtl:s=!1,isDark:l=!1,defaultLanguage:c="en",fontFamily:d})=>{const u=t(()=>re(c),[c]),[h,m]=o({}),[b,f]=o({}),[w,y]=o(!1),v=r({}),k=[...e].sort((e,t)=>he(e.fieldType)-he(t.fieldType));return g("div",{className:"flex flex-col items-center justify-center p-6 h-full min-h-0 z-50 relative ",style:{...d?{fontFamily:d}:{},...l?{backgroundColor:"#10141C"}:{}},children:p("div",{className:"w-full max-w-sm rounded-2xl shadow-xl border p-8 transition-colors duration-300 bg-white border-gray-100",style:l?{backgroundColor:"#1E232B",border:"1px solid #2A303C"}:void 0,children:[a&&g("div",{className:"mb-4 text-start",children:g("h3",{className:"transition-colors duration-300 text-sm font-semibold mb-1 "+(l?"text-white":"text-[#4A5568]"),children:a})}),p("form",{onSubmit:async e=>{e.preventDefault();const t=(()=>{const e={};return k.forEach(t=>{const o=t.fieldType||"question",r=(h[o]??"").trim(),a=t.collectionPrompt||t.askToType||t.question||t.label||o,i=!0===t.required||"true"===t.required;r?("fullName"!==o&&"name"!==o||r.length<2&&(e[o]=u("nameInvalid")),"email"!==o||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)||(e[o]=u("emailInvalid")),"phone"!==o&&"mobileno"!==o||/^[+]?[\d\s-]{8,15}$/.test(r)||(e[o]=u("phoneInvalid"))):i&&(e[o]="email"===o?u("emailRequired"):"fullName"===o||"name"===o?u("nameRequired"):"phone"===o||"mobileno"===o?u("phoneRequired"):`${a} ${u("fieldRequiredSuffix")}`)}),f(e),e})();if(Object.keys(t).length>0){const e=k.map((e,t)=>e.fieldType||`question_${t}`).find(e=>t[e]);return void v.current[e]?.focus()}y(!0);try{await i(h)}finally{y(!1)}},className:"space-y-4",noValidate:!0,children:[k.map((e,t)=>{const o=e.fieldType||`question_${t}`,r=e.collectionPrompt||e.askToType||e.question||e.label;if(!r?.trim())return null;let a="text";"email"===o&&(a="email"),"phone"!==o&&"mobileno"!==o||(a="tel");const i=(o||"").toLowerCase(),n="fullname"===i||"name"===i||"username"===i,c="phone"===i||"mobileno"===i,d="email"===i?u("onboardingEmailPlaceholder"):n?u("onboardingNamePlaceholder"):c?u("onboardingPhonePlaceholder"):r,w=b[o],y="w-full h-12 rounded-xl text-base md:text-sm px-3 py-1 outline-none border transition-colors focus:ring-0 "+(l?"text-white placeholder:text-[#A2A9B2] focus:border-[#5A6069]":"bg-gray-50/30 focus:bg-white text-gray-900 placeholder:text-gray-500 focus:border-[#B0B0B0]"),k=w?"!border-status-error focus:!border-status-error":"",x=`onboarding-field-${o}`,C=`${x}-error`;return p("div",{children:[g("label",{htmlFor:x,className:"sr-only",children:r}),g("input",{id:x,ref:e=>{v.current[o]=e},placeholder:d,type:a,value:h[o]??"",onChange:e=>((e,t)=>{m(o=>({...o,[e]:t})),b[e]&&f(t=>{const o={...t};return delete o[e],o})})(o,e.target.value),className:`${y} ${k}`,"aria-invalid":w?"true":"false","aria-describedby":w?C:void 0,style:{direction:s?"rtl":"ltr",fontFamily:"inherit",...l?{backgroundColor:"#272C35",borderWidth:"1px",borderStyle:"solid",borderColor:w?void 0:"#3F444C"}:{borderWidth:"1px",borderStyle:"solid",borderColor:w?void 0:"#E0E0E0"}}}),w&&g("p",{id:C,role:"alert",className:"mt-1 text-xs text-status-error px-1",children:b[o]})]},o)}),g("button",{type:"submit",disabled:w,"aria-busy":w,"aria-label":w?u("submitting"):void 0,className:"w-full h-12 inline-flex items-center justify-center text-sm border-none font-semibold shadow-xl hover:shadow-xl hover:scale-[1.02] active:scale-[0.98] transition-all rounded-xl mt-4 text-white",style:{backgroundColor:n,fontFamily:"inherit"},children:w?g(Ge,{className:"w-5 h-5 animate-spin","aria-hidden":"true"}):u("startChat")})]})]})})},Ro=({categories:e=[],selectedCategoryId:n=null,onSelect:s,isDark:l=!1,primaryColor:c="#2563eb",fontFamily:d="Inter",isRtl:u=!1,defaultLanguage:h="en"})=>{const m=t(()=>re(h),[h]),b=r(null),[f,w]=o(!1),[y,v]=o(!1),k=a(()=>{const e=b.current;if(!e)return;const{scrollLeft:t,scrollWidth:o,clientWidth:r}=e;w(Math.abs(t)>1),v(Math.abs(t)+r<o-1)},[]);i(()=>{k();const e=b.current;if(!e)return;const t=new ResizeObserver(k);return t.observe(e),()=>t.disconnect()},[k,e]);const x=a(e=>{const t=b.current;if(!t)return;const o="left"===e?-150:150;t.scrollBy({left:u?-o:o,behavior:"smooth"})},[u]);if(!Array.isArray(e)||0===e.length)return null;const C=l?"rgba(31,41,55,0.85)":"rgba(255,255,255,0.95)",S=l?"#e5e7eb":"#374151",M=l?"#4b5563":"#d1d5db";return p("div",{className:"flex-shrink-0 px-2 py-2 border-b flex items-center gap-1",style:{backgroundColor:l?"#111827":"#ffffff",borderColor:l?"#374151":"#e5e7eb",fontFamily:d,direction:u?"rtl":"ltr"},role:"region","aria-label":m("filterByCategory"),children:[g("button",{type:"button",onClick:()=>x("left"),disabled:!f,"aria-label":m("scrollCategoriesLeft"),className:"flex-shrink-0 flex items-center justify-center w-6 h-6 rounded-full transition-all duration-200",style:{backgroundColor:C,border:`1px solid ${M}`,color:S,opacity:f?1:.3,cursor:f?"pointer":"default"},children:g(_e,{size:14})}),g("div",{ref:b,onScroll:k,className:"flex-1 flex gap-2 overflow-x-auto",style:{scrollBehavior:"smooth",WebkitOverflowScrolling:"touch",scrollbarWidth:"none",msOverflowStyle:"none"},children:e.map(e=>{const t=n===e.id;return g("button",{type:"button",onClick:()=>s?.(t?null:e.id),"aria-pressed":t,className:"flex-shrink-0 inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium transition-all duration-150 whitespace-nowrap",style:{backgroundColor:l?"#1f2937":"#ffffff",border:t?`1.5px solid ${c}`:"1px solid "+(l?"#374151":"#e5e7eb"),color:t?c:l?"#e5e7eb":"#374151",fontFamily:d},children:g("span",{children:e.label})},e.id)})}),g("button",{type:"button",onClick:()=>x("right"),disabled:!y,"aria-label":m("scrollCategoriesRight"),className:"flex-shrink-0 flex items-center justify-center w-6 h-6 rounded-full transition-all duration-200",style:{backgroundColor:C,border:`1px solid ${M}`,color:S,opacity:y?1:.3,cursor:y?"pointer":"default"},children:g(We,{size:14})})]})},Io=({categories:e=[],selectedCategoryId:t=null,onSelect:o,isDark:r=!1,primaryColor:a="#2563eb",fontFamily:i="Inter",fontSize:n="14px",isRtl:s=!1,label:l="Choose a topic to get started:",regionLabel:c="Category filter"})=>{if(!Array.isArray(e)||0===e.length)return null;return p("div",{className:"pl-[50px] pt-1",style:{direction:s?"rtl":"ltr",paddingLeft:s?0:50,paddingRight:s?50:void 0},role:"region","aria-label":c,children:[g("div",{className:"mb-2",style:{color:r?"#9ca3af":"#6b7280",fontFamily:i,fontSize:`calc(${n} - 1px)`},children:l}),g("div",{className:"flex flex-wrap gap-2",children:e.map(e=>{const s=t===e.id;return g("button",{type:"button",onClick:()=>o?.(s?null:e.id),"aria-pressed":s,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full transition-all duration-150 hover:scale-[1.02] active:scale-[0.98]",style:{backgroundColor:r?"#1f2937":"#ffffff",border:s?`1.5px solid ${a}`:"1px solid "+(r?"#374151":"#e5e7eb"),color:s?a:r?"#e5e7eb":"#374151",fontFamily:i,fontSize:`calc(${n} - 1px)`,fontWeight:500},children:e.label},e.id)})})]})};const Bo=[{value:"😡",label:"😡",bg:"bg-red-200"},{value:"😕",label:"😕",bg:"bg-orange-200"},{value:"😐",label:"😐",bg:"bg-yellow-200"},{value:"😊",label:"😊",bg:"bg-green-200"},{value:"😍",label:"😍",bg:"bg-pink-200"}],Eo=[{value:"positive",label:"👍"},{value:"negative",label:"👎"}],Do=[{value:"1",label:"1"},{value:"2",label:"2"},{value:"3",label:"3"},{value:"4",label:"4"},{value:"5",label:"5"}],Vo=[{value:"1",label:"⭐"},{value:"2",label:"⭐"},{value:"3",label:"⭐"},{value:"4",label:"⭐"},{value:"5",label:"⭐"}],Oo=({format:e="EMOJI",prompt:r="How was your experience?",onRating:a,disabled:i=!1,isDark:n=!1,primaryColor:s="#2563eb",defaultLanguage:l="en"})=>{const c=t(()=>re(l),[l]),[d,u]=o(null),[h,m]=o(null),[b,f]=o(!1),w=async t=>{if(!i&&!b){u(t),f(!0);try{a&&a(t,e)}finally{f(!1)}}},y=(()=>{switch(e){case"THUMBS":return Eo;case"NUMERIC":return Do;case"STARS":return Vo;default:return Bo}})();return p("div",{className:ge("transition-all duration-200 rounded-xl px-4",n?"bg-slate-800/50":"bg-slate-50/50"),children:[g("p",{className:ge("text-sm font-semibold text-center mb-3",n?"text-gray-300":"text-gray-500/80"),children:r}),p("div",{className:"flex justify-center items-center",children:["EMOJI"===e&&g("div",{className:"flex gap-2 justify-center items-center",children:y.map(e=>g("button",{onClick:()=>w(e.value),disabled:i||b,className:ge("flex items-center justify-center text-2xl transition-transform","bg-transparent border-0 p-0 cursor-pointer","hover:scale-110 active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed","focus:outline-none focus:ring-0","rounded-md focus-visible:ring-2 focus-visible:ring-blue-700",d===e.value?"":"opacity-80"),children:g("span",{role:"img","aria-label":`${c("rate")} ${e.value}`,children:e.label})},e.value))}),"THUMBS"===e&&g("div",{className:"flex gap-6 justify-center items-center",role:"group","aria-label":c("rateExperience"),children:y.map(e=>g("button",{"aria-label":1===e.value?c("thumbsUp"):c("thumbsDown"),onClick:()=>w(e.value),disabled:i||b,className:ge("w-10 h-10 rounded-xl border flex items-center justify-center shadow-md text-2xl transition-all","hover:scale-105 active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed","drop-shadow-md",n?"bg-gray-700 border-gray-600 hover:bg-gray-600":"bg-white border-gray-100 hover:bg-gray-50",d===e.value&&"ring-2 ring-primary/40 scale-110"),style:{borderColor:d===e.value?s:void 0},children:g("span",{className:"drop-shadow-md","aria-hidden":"true",children:e.label})},e.value))}),"NUMERIC"===e&&g("div",{className:"flex gap-2 justify-center items-center",role:"group","aria-label":c("rateExperience"),children:y.map(e=>g("button",{"aria-label":`${c("rate")} ${e.value}`,onClick:()=>w(e.value),disabled:i||b,className:ge("w-10 h-10 rounded-lg flex items-center justify-center text-sm font-semibold transition-all","hover:scale-105 active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed",d===e.value?"ring-2 ring-primary/40 scale-110 shadow-md text-white":n?"bg-gray-700 border border-gray-600 text-gray-300 hover:bg-gray-600":"bg-white border border-gray-200 text-gray-700 hover:bg-gray-50"),style:{backgroundColor:d===e.value?s:void 0,borderColor:d===e.value?s:void 0},children:e.label},e.value))}),"STARS"===e&&g("div",{className:"flex gap-2 justify-center items-center",onMouseLeave:()=>m(null),children:y.map(e=>{const t=h===e.value;return g("button",{onClick:()=>w(e.value),onMouseEnter:()=>m(e.value),disabled:i||b,className:ge("flex items-center justify-center text-2xl","bg-transparent border-0 p-0 cursor-pointer focus:outline-none","rounded-md focus-visible:ring-2 focus-visible:ring-blue-700","disabled:opacity-50 disabled:cursor-not-allowed"),style:{transform:t?"scale(1.25)":"scale(1)",filter:t?"brightness(1.1) drop-shadow(0 2px 4px rgba(0,0,0,0.15))":"none",opacity:t?1:.6,transition:"all 0.2s ease"},"aria-label":`${c("rate")} ${e.value}`,children:g("span",{"aria-hidden":"true",children:e.label})},e.value)})})]}),b&&g("p",{"aria-live":"polite",className:ge("text-xs mt-3 text-center",n?"text-slate-400":"text-slate-500"),children:c("submittingFeedback")})]})};async function $o({apiBaseUrl:e,conversationId:t,chip:o,submitText:r,position:a,source:i="widget",getAuthToken:n,enabled:s=!0}={}){try{if(!1===s)return!1;if(!e||"string"!=typeof e)return!1;if(!t||"string"!=typeof t)return!1;const l=function({chip:e,submitText:t,position:o,conversationId:r,source:a="widget"}={}){const i=e&&"object"==typeof e,n=i&&"string"==typeof e.text?e.text:"",s="string"==typeof t&&t?t:i&&"string"==typeof e.submitText?e.submitText:"string"==typeof e?e:"",l=n||s;if(!l)return null;const c={conversationId:r,chipText:l,submitText:s||void 0,position:Number.isInteger(o)?o:void 0,source:a},d=i?e?.promptId:void 0;return"string"==typeof d&&d&&(c.promptId=d),c}({chip:o,submitText:r,position:a,conversationId:t,source:i});if(!l)return!1;const c=`${e.replace(/\/$/,"")}/api/v1/support/chip-click`,d=JSON.stringify(l);let u;if("function"==typeof n)try{u=await n()}catch{u=void 0}if(!u&&"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon&&"undefined"!=typeof Blob)try{if(navigator.sendBeacon(c,new Blob([d],{type:"application/json"})))return!0}catch{}if("function"!=typeof fetch)return!1;const g={"Content-Type":"application/json"};return u&&(g.Authorization=`Bearer ${u}`),await fetch(c,{method:"POST",headers:g,credentials:"include",keepalive:!0,body:d}),!0}catch{return!1}}const Uo="#ffffff",qo="#f5f5f5",Ho="#000000",_o="#1f2937",Wo="#f3f4f6",Ko="#2563eb",Yo="eshal:widget:size",Qo=(e,t)=>!e||(e=>e?.trim().toLowerCase())(e)===t,Jo=e=>(e instanceof Date?e:new Date(e)).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}).replace(/am|pm/i,e=>e.toUpperCase()),Go=e=>{const t=(e||"EMOJI").toString().trim().toUpperCase();return"THUMBS"===t||"THUMB"===t?"THUMBS":"STARS"===t||"STAR"===t?"STARS":"NUMERIC"===t||"NUMBER"===t?"NUMERIC":"EMOJI"},Zo=({isOpen:e,isMinimized:n,isDark:s,onStopGeneration:l,primaryColor:c,textColor:d,conciergeName:u,companyName:m,companyLogo:b,chatbotAvatarEnabled:f,chatbotAvatar:w,messages:y,isLoading:v,isConversationLoading:k=!1,inputValue:x,setInputValue:C,onSend:S,onDirectSend:M,onToggleTheme:T,onMinimize:F,onClose:z,quickQuestions:P=[],quickQuestionsEnabled:L,onQuickQuestion:A,quickQuestionsLayout:j="vertical",agentMessageBubbleColor:N,userMessageBoxColor:R,assistantTextColor:I,userTextColor:B,fontFamily:E="Inter",agentMessageBubbleFontFamily:D,agentMessageBubbleFontSize:V,userMessageBubbleFontFamily:O,userMessageBubbleFontSize:$,fontSize:U="14px",defaultLanguage:q="en",onDecision:H,headerTextBold:_=!1,headerTextItalic:W=!1,headerTextColor:K,headerFontFamily:Y,headerFontSize:Q,subtitle:J=null,showStatus:Z=!1,statusMode:X="always",officeHours:ee=null,enableVoiceInteraction:te=!1,isVoiceSessionActive:oe=!1,voiceStatus:ae="idle",voiceError:ie=null,voiceConclusionForCsat:ne=!1,onVoiceToggle:se,onBidiSubmit:le,disclaimerEnabled:ce=!1,disclaimerText:de,disclaimerPosition:ue="top",disclaimerLinkUrl:pe,disclaimerLinkLabel:he,showPoweredBy:be=!0,apiBaseUrl:fe,apiKey:we,getAuthToken:ye,conversationId:ve,conciergeId:xe,onboardingQuestions:Ce=[],onboardingActive:Se=!1,onboardingCompleted:Me=!1,onOnboardingFormSubmit:Te,collectionPrompt:Fe,csatEnabled:ze=!1,csatFormat:Pe="EMOJI",csatPrompt:Le="How was your experience?",csatRequest:Ae=null,liveJoined:je=[],onPromptSuggestionClick:Ne,onboardingEnabled:Re=!1,onResetConversation:Ie,sessionExpiringSoon:Be=!1,autoPromptEnabled:Ee=!0,autoPromptQuestionDisplay:De=!0,autoPromptClickTelemetry:Ve=!0,allowFeedback:Oe=!0,provideCitations:$e=!0,onFeedback:Ue,onRetryMessage:qe,onRefreshChat:He,onCopyChat:_e,filterCategories:We=[],showFilterStep:Ke=!1,widgetFilter:Ye=null,onWidgetFilterChange:Qe,onSynthesizeAssistantMessage:Je,launcherPosition:Ge="bottom-right",chatFeatures:Ze,organizationId:Xe})=>{ht(E);const et=r(null),tt=r(null),ot=t(()=>re(q),[q]);i(()=>{tt.current?.focus()},[]);const rt=a((e,t,o)=>{$o({apiBaseUrl:fe,conversationId:ve,chip:t,submitText:null==e?void 0:String(e),position:o,source:"widget",getAuthToken:ye,enabled:Ve})},[fe,ye,ve,Ve]),it=a((e,t,o)=>{t&&"object"==typeof t&&rt(e,t,o);const r=o&&"object"==typeof o&&o.toolConfirmation?o.toolConfirmation:null;Ne?Ne(e):r?M?.(e,void 0,{toolConfirmation:r}):M?.(e)},[Ne,M,rt]),nt=Ge.includes("right"),st=Ge.includes("bottom"),[lt,ct]=o(()=>{if("undefined"==typeof window)return null;try{const e=window.localStorage.getItem(Yo);if(!e)return null;const t=JSON.parse(e);if("number"==typeof t?.width&&"number"==typeof t?.height&&t.width>=320&&t.height>=400)return t}catch{}return null}),dt=r(null),ut=r({x:0,y:0}),gt=r({width:380,height:650});i(()=>{const e=e=>{const t=dt.current;if(!t)return;const o=e.clientX-ut.current.x,r=e.clientY-ut.current.y,a={...gt.current},i=.92*window.innerWidth,n=.85*window.innerHeight;if("corner"===t||"horizontal"===t){const e=nt?gt.current.width-o:gt.current.width+o;a.width=Math.min(Math.max(320,e),i)}if("corner"===t||"vertical"===t){const e=st?gt.current.height-r:gt.current.height+r;a.height=Math.min(Math.max(400,e),n)}ct(a)},t=()=>{dt.current&&(dt.current=null,document.body.style.cursor="",document.body.style.userSelect="")};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[nt,st]),i(()=>{if(lt)try{window.localStorage.setItem(Yo,JSON.stringify(lt))}catch{}},[lt]);const pt=(e,t)=>{t.preventDefault(),t.stopPropagation(),dt.current=e,ut.current={x:t.clientX,y:t.clientY},gt.current=lt??{width:380,height:650};const o={corner:nt===st?"nwse-resize":"nesw-resize",horizontal:"ew-resize",vertical:"ns-resize"};document.body.style.cursor=o[e],document.body.style.userSelect="none"},[mt,bt]=o(!1),[ft,wt]=o(()=>{try{return ke(Xe)?.csatSubmitted??!1}catch{return!1}}),[yt,vt]=o(!1),[kt,xt]=o(!1),[Ct,St]=o(0),[Mt,Tt]=o(""),[Ft,zt]=o(!1),[Pt,Lt]=o(!1);i(()=>{e||(vt(!1),St(0),Tt(""),Lt(!1))},[e]),i(()=>{vt(!1),St(0),Tt(""),Lt(!1)},[ve]),i(()=>{try{const e=ke(Xe)?.csatSubmitted??!1;wt(e),e&&bt(!1)}catch{}},[ve]),function(e,t=[],o={}){const{enabled:a=!0,threshold:n=30,behavior:s="smooth",delay:l=0}=o,c=r(!0);r(0),i(()=>{if(!a||!e.current)return;const t=e.current,o=()=>{const e=t.scrollHeight-t.scrollTop-t.clientHeight;c.current=e<n},r=()=>{o()};t.addEventListener("scroll",r,{passive:!0}),o();const i=setTimeout(()=>{c.current&&t&&t.scrollTo({top:t.scrollHeight,behavior:s})},l);return()=>{t.removeEventListener("scroll",r),clearTimeout(i)}},[e,a,n,s,l,...t])}(et,[y,v],{enabled:!0,threshold:30,behavior:"smooth",delay:0});const At=G(q),jt=t(()=>s?Qo(N,Uo)?_o:N||_o:N||Uo,[N,s]),Nt=t(()=>s?Qo(d,Ho)?Wo:d||Wo:d||Ho,[s,d]),Rt=t(()=>s?Qo(R,qo)?c||Ko:R||c||Ko:R||qo,[s,c,R]),It=ot(kt?"conversationResolved":"typeYourMessage"),Bt=y?.some?.(e=>"user"===e.role),Et=t(()=>(y||[]).filter(e=>"user"===e.role).length,[y]),[Dt,Vt]=o(0),Ot=Ye?.category?(We||[]).find(e=>e.id===Ye.category):null,$t=a(e=>{if(!Qe)return;const t=Ye?.category||null;if(e){if(Qe({category:e,tags:[]}),Vt(Et),!Bt&&e!==t&&Je){const t=(We||[]).find(t=>t.id===e),o=t?.label||e,r=ot("categoryTopicsHeading").replace("{category}",o);Je(r,{replaceMarker:"category-intro"})}}else Qe(null)},[Qe,Ye,Et,We,Bt,Je,ot]);a(e=>{const t=Ye?.category||Ot?.id;t&&Qe&&Qe({category:t,tags:[e]}),M&&M(e)},[Ye,Ot,Qe,M]);const Ut=Array.isArray(We)&&We.length>0,qt=Ut&&!Bt&&!Ye?.category,Ht=!Bt&&P.length>0&&L&&!Ye?.category,_t=Ce&&Ce.length>0,Wt=Boolean(ze),Kt=Re&&_t&&!Me,Yt=a(async()=>{if(Wt&&!Ft&&!kt&&0!==Ct){zt(!0),Lt(!1);try{const e={"Content-Type":"application/json"};if("function"==typeof ye){const t=await ye();t&&(e.Authorization=`Bearer ${t}`)}const t=Go(Pe),o=await fetch(`${fe.replace(/\/$/,"")}/api/v1/support/csat`,{method:"POST",headers:e,credentials:"include",body:JSON.stringify({conversationId:ve,rating:String(Ct),ratingFormat:t,conciergeId:xe,feedback:Mt||void 0})});o.ok?(vt(!1),St(0),Tt(""),Qe&&Qe(null),He?He():Ie&&Ie()):(console.error("Failed to submit resolve feedback:",await o.text()),Lt(!0))}catch(e){console.error("Error submitting resolve feedback:",e),Lt(!0)}finally{zt(!1)}}},[Wt,Ft,kt,Ct,Mt,ve,ye,xe,fe,Pe,Ie,He,Qe]),Qt=a(()=>{if(!Wt||!ve||!Bt)return Qe&&Qe(null),He?He():Ie&&Ie(),void z?.();yt?(vt(!1),z?.()):kt?z?.():vt(!0)},[Wt,ve,Bt,yt,kt,z,Qe,He,Ie]);i(()=>{Wt||(yt&&vt(!1),kt&&xt(!1),0!==Ct&&St(0),Mt&&Tt(""))},[Wt,yt,kt,Ct,Mt]);const Jt=t(()=>{if(!y||!Array.isArray(y))return[];for(let e=y.length-1;e>=0;e-=1)if("assistant"===y[e]?.role){const t=y[e].prompts;return Array.isArray(t)?t:[]}return[]},[y]),Gt=r([]);i(()=>{Jt.length>0?Gt.current=Jt:y&&0!==y.length&&y.some(e=>"user"===e.role)||(Gt.current=[])},[Jt,y]);const Zt=r(Et);i(()=>{Et!==Zt.current&&(Zt.current=Et,Gt.current=[])},[Et]);const Xt=Array.isArray(y)&&y.some(e=>"user"===e?.role),eo=Jt.length>0?Jt:Xt?Gt.current:[];i(()=>{if(!ze)return;if(!mt)return;if(ft)return;const e=et.current;if(!e)return;const t=window.requestAnimationFrame(()=>{e.scrollTo({top:e.scrollHeight,behavior:"smooth"})});return()=>{window.cancelAnimationFrame(t)}},[mt,ze,ft]);const to=()=>{const e=Go(Pe);if("STARS"===e)return g("div",{className:"flex justify-center gap-2 mb-5",role:"group","aria-label":ot("rateExperience"),children:[1,2,3,4,5].map(e=>g("button",{"aria-label":`${ot("rate")} ${e}`,onClick:()=>St(e),className:"transition-all duration-150 hover:scale-110 active:scale-95 bg-transparent border-0 p-0 cursor-pointer",disabled:Ft,children:g(at,{className:ge("w-8 h-8 transition-colors",e<=Ct?"text-yellow-400 drop-shadow-sm":s?"text-gray-600":"text-gray-300"),fill:e<=Ct?"#FBBF24":"none"})},e))});if("THUMBS"===e)return g("div",{className:"flex gap-4 justify-center mb-5",role:"group","aria-label":ot("rateExperience"),children:[{value:"positive",emoji:"👍"},{value:"negative",emoji:"👎"}].map(e=>g("button",{"aria-label":"positive"===e.value?ot("thumbsUp"):ot("thumbsDown"),onClick:()=>St(e.value),disabled:Ft,className:ge("w-12 h-12 rounded-xl border flex items-center justify-center text-2xl transition-all hover:scale-105 active:scale-95",Ct===e.value?"ring-2 ring-blue-300 scale-110 shadow-lg":"",s?"bg-gray-700 border-gray-600 hover:bg-gray-600":"bg-white border-gray-200 hover:bg-gray-50"),children:g("span",{className:"drop-shadow-md",children:e.emoji})},e.value))});return g("div",{className:"flex gap-2 justify-center items-center mb-5",role:"group","aria-label":ot("rateExperience"),children:[{value:1,emoji:"😡"},{value:2,emoji:"😕"},{value:3,emoji:"😐"},{value:4,emoji:"😊"},{value:5,emoji:"😍"}].map(e=>g("button",{"aria-label":`${ot("rate")} ${e.value}`,onClick:()=>St(e.value),disabled:Ft,className:ge("rounded-full w-10 h-10 flex items-center justify-center text-xl transition-all hover:scale-110 active:scale-95 bg-transparent border-0 p-0 cursor-pointer",Ct===e.value?"ring-2 ring-blue-100 scale-125 bg-gradient-to-b from-yellow-200 to-yellow-400 shadow-md":"grayscale-[0.3] opacity-80 hover:grayscale-0"),children:g("span",{role:"img","aria-label":`${ot("rate")} ${e.value}`,className:"drop-shadow-sm filter",children:e.emoji})},e.value))})};if(!e)return null;const oo=!n&&lt?{width:lt.width,height:lt.height,maxWidth:"92vw",maxHeight:"85vh"}:void 0;return p("div",{dir:At?"rtl":"ltr",className:"relative flex-shrink-0 z-50 "+(n?"w-80 h-auto":""),style:oo,children:[!n&&p(h,{children:[g("div",{onMouseDown:e=>pt("horizontal",e),className:"absolute top-0 h-full w-1.5 cursor-ew-resize hover:bg-blue-500/20 transition-colors z-[70] "+(nt?"left-0":"right-0"),"aria-hidden":!0}),g("div",{onMouseDown:e=>pt("vertical",e),className:"absolute left-0 w-full h-1.5 cursor-ns-resize hover:bg-blue-500/20 transition-colors z-[70] "+(st?"top-0":"bottom-0"),"aria-hidden":!0})]}),p("div",{id:"chat-window-panel",ref:tt,role:"dialog","aria-modal":"true","aria-label":ot("openChat"),tabIndex:-1,className:`relative focus:outline-none ${lt||n?"":"w-[380px]"} ${lt||n?"":"h-[650px]"} ${n?"w-80 h-auto":""} ${lt&&!n?"w-full h-full":""} max-w-[92vw] border rounded-2xl shadow-2xl bg-white border-gray-200 flex flex-col ${n?"":"max-h-[85vh]"} overflow-hidden ${s?"bg-gray-900 border-gray-700":""}`,children:[!n&&g("div",{onMouseDown:e=>pt("corner",e),"aria-hidden":"true",className:`absolute w-4 h-4 ${nt===st?"cursor-nwse-resize":"cursor-nesw-resize"} text-gray-400 hover:text-blue-500 transition-colors z-[71] flex p-0.5 ${st?"top-0 items-start":"bottom-0 items-end"} ${nt?"left-0 justify-start":"right-0 justify-end"}`,children:g("svg",{viewBox:"0 0 12 12",className:"w-3 h-3 "+(st&&nt?"rotate-180":st?"-rotate-90":nt?"rotate-90":""),"aria-hidden":!0,children:g("path",{d:"M11 1 L1 11 M11 5 L5 11 M11 9 L9 11",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"})})}),g(jo,{conciergeName:u,companyName:m,companyLogo:b,primaryColor:c,isDark:s,isMinimized:n,textColor:Nt,fontFamily:E,fontSize:U,onToggleTheme:T,onMinimize:F,onClose:Qt,headerTextBold:_,headerTextItalic:W,headerTextColor:K,headerFontFamily:Y,headerFontSize:Q,subtitle:J,showStatus:Z,statusMode:X,officeHours:ee,onRefreshChat:He,onCopyChat:_e,defaultLanguage:q}),!n&&Ut&&!qt&&!(yt&&!kt)&&!(Se&&!Me)&&g(Ro,{categories:We,selectedCategoryId:Ye?.category||null,onSelect:$t,isDark:s,primaryColor:c,fontFamily:E,isRtl:At,defaultLanguage:q}),!n&&p(h,{children:[g("div",{ref:et,role:"log","aria-live":"polite",className:`chat-messages flex-1 overflow-y-auto px-3 py-4 space-y-4 ${s?"bg-gray-900":"bg-gradient-to-b from-gray-50/50 to-white"} break-words`,children:yt&&!kt?g("div",{className:"animate-in slide-in-from-top-4 fade-in duration-300 mt-4 mx-2",children:p("div",{className:ge("w-full rounded-3xl p-6 shadow-lg",s?"bg-gray-800 shadow-black/20":"bg-white shadow-gray-200/80"),children:[g("p",{className:ge("text-sm font-medium text-center mb-5 [font-family:inherit]",s?"text-gray-300":"text-gray-500"),children:Le||ot("feedbackPrompt")}),to(),g("textarea",{"aria-label":ot("feedbackPlaceholder"),value:Mt,onChange:e=>{e.target.value.length<=1e3&&Tt(e.target.value)},maxLength:1e3,placeholder:ot("feedbackPlaceholder"),rows:4,disabled:Ft,className:ge("w-full rounded-xl border px-4 py-3 text-sm [font-family:inherit] resize-none outline-none transition-colors mb-5",s?"bg-gray-700 border-gray-600 text-gray-100 placeholder-gray-400":"bg-gray-50 border-gray-200 text-gray-900 placeholder-gray-400")}),p("div",{className:"relative group",children:[g("button",{onClick:Yt,disabled:0===Ct||Ft,"aria-describedby":0===Ct?"resolve-rating-hint":void 0,className:ge("w-full py-3.5 rounded-xl text-sm font-semibold [font-family:inherit] transition-all duration-200 border-none outline-none focus:outline-none active:outline-none focus:ring-0 active:ring-0","disabled:opacity-50 disabled:cursor-not-allowed","focus-visible:ring-2 focus-visible:ring-blue-700",s?"bg-gray-700 text-gray-100 hover:bg-gray-600":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:ot(Ft?"submitting":"submitFeedback")}),0===Ct&&!Ft&&g("div",{id:"resolve-rating-hint",role:"tooltip",className:"absolute -top-8 left-1/2 -translate-x-1/2 whitespace-nowrap px-2 py-1 rounded-md text-xs bg-gray-800 text-white opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:ot("selectRatingFirst")})]}),Pt&&!Ft&&p("div",{role:"alert",className:"mt-3 text-center text-sm",children:[g("p",{className:s?"text-red-300":"text-red-700",children:ot("feedbackSendFailed")}),g("button",{type:"button",onClick:()=>{vt(!1),Lt(!1)},className:ge("mt-1 underline bg-transparent border-none [font-family:inherit] focus-visible:ring-2 focus-visible:ring-blue-700",s?"text-gray-200":"text-gray-700"),children:ot("backToChat")})]})]})}):Se&&!Me&&Te?g(No,{questions:Ce,onPromptSuggestionClick:it,collapsiblePrompt:Fe,onSubmit:Te,primaryColor:c,isRtl:At,isDark:s,defaultLanguage:q,fontFamily:E}):p(h,{children:[Be&&g("div",{role:"status",className:"mx-3 mt-1 mb-2 rounded-lg px-3 py-2 text-xs font-medium "+(s?"bg-amber-900/40 text-amber-200 border border-amber-700/50":"bg-amber-50 text-amber-800 border border-amber-200"),children:ot("sessionExpiringSoon")}),g(uo,{messages:y,liveJoined:je,isDark:s,primaryColor:c,isLoading:v,agentMessageBubbleColor:N,userMessageBoxColor:R,textColor:d,assistantTextColor:I,userTextColor:B,fontFamily:E,agentMessageBubbleFontFamily:D,agentMessageBubbleFontSize:V,userMessageBubbleFontFamily:O,userMessageBubbleFontSize:$,fontSize:U,formatTime:Jo,isRtl:At,defaultLanguage:q,quickQuestions:P,shouldShowQuickQuestions:Ht,onQuickQuestion:A??M,quickQuestionsLayout:j,onDecision:H,disclaimerEnabled:ce,disclaimerText:de,disclaimerPosition:ue,disclaimerLinkUrl:pe,disclaimerLinkLabel:he,resolvedAgentBubbleColor:jt,resolvedUserMessageColor:Rt,resolvedTextColor:Nt,isVoiceSessionActive:oe,voiceStatus:ae,messagesContainerRef:et,companyLogo:b,chatbotAvatarEnabled:f,chatbotAvatar:w,conciergeName:u,companyName:m,apiBaseUrl:fe,getAuthToken:ye,onPromptSuggestionClick:it,conversationResetKey:ve,allowFeedback:Oe,provideCitations:$e,onFeedback:Ue,onRetryMessage:qe,headerTextColor:K,beforePromptsSlot:qt?g(Io,{categories:We,selectedCategoryId:Ye?.category||null,onSelect:$t,isDark:s,primaryColor:c,fontFamily:E,fontSize:U,isRtl:At,label:ot("chooseTopicLabel"),regionLabel:ot("categoryFilter")}):null,quickQuestionsHeadingLabel:Ut?ot("quickQuestionsHeadingLabel"):void 0}),(mt&&ze||Ae)&&!ft&&g("div",{className:"","data-testid":"widget-csat-card",children:g(Oo,{format:Go(Ae?.format||Pe),prompt:Ae?.prompt||Le||ot("howWasYourExperience"),onRating:async(e,t)=>{wt(!0),bt(!1),(e=>{try{const t=ke(e);if(!t)return;t.csatSubmitted=!0,localStorage.setItem(`${me}_${e}`,JSON.stringify(t))}catch{}})(Xe);try{const o={"Content-Type":"application/json"};if("function"==typeof ye){const e=await ye();e&&(o.Authorization=`Bearer ${e}`)}const r=await fetch(`${fe.replace(/\/$/,"")}/api/v1/support/csat`,{method:"POST",headers:o,credentials:"include",body:JSON.stringify({conversationId:ve,rating:e,ratingFormat:t,conciergeId:xe})});r.ok||console.error("CSAT submission failed:",await r.text())}catch(e){console.error("CSAT submission error:",e)}},disabled:!1,isDark:s,primaryColor:c,defaultLanguage:q})})]})}),!(Se&&!Me)&&g(So,{onSynthesizeAssistantMessage:Je,onStopGeneration:l,inputValue:x,setInputValue:C,onSend:S,isDark:s,primaryColor:c,isOpen:e,isMinimized:n,isLoading:v,isConversationLoading:k,placeholder:It,textColor:Nt,fontFamily:E,userMessageBubbleFontFamily:O,userMessageBubbleFontSize:$,fontSize:U,isRtl:At,csatVisible:mt&&ze&&!ft||Wt&&(yt||kt),enableVoiceInteraction:te,isVoiceSessionActive:oe,voiceStatus:ae,voiceError:ie,onVoiceToggle:se,onBidiSubmit:le,disclaimerEnabled:ce,disclaimerText:de,disclaimerPosition:ue,disclaimerLinkUrl:pe,disclaimerLinkLabel:he,showPoweredBy:be,defaultLanguage:q,onboardingQuestions:Ce,onboardingActive:Se,onboardingCompleted:Me,onboardingEnabled:Re,userMessageBoxColor:R,resolvedUserMessageColor:Rt,userTextColor:B,promptSuggestions:yt||kt||!1===Ee||v?[]:eo,onPromptSuggestionClick:it,autoPromptQuestionDisplay:De,tagSelectorNode:null,showResolveButton:Wt&&Bt&&!kt&&!yt&&!mt&&!Kt,onResolve:()=>{Wt&&vt(!0)},chatFeatures:Ze,apiEndpoint:fe,organizationId:Xe,conversationId:ve})]})]})]})},Xo=new Map;const er={whatsapp:["wa.me","api.whatsapp.com"],telegram:["t.me"],messenger:["m.me"],instagram:["ig.me","instagram.com","www.instagram.com"]},tr={whatsapp:"WhatsApp",telegram:"Telegram",messenger:"Messenger",instagram:"Instagram"};const or=n(({isDark:e,primaryColor:n,onToggle:s,textColor:l,headerTextColor:c,defaultLanguage:d="en",isOpen:u=!1,className:h,channelLinks:m},b)=>{const f=t(()=>re(d),[d]),w=t(()=>function(e){if(!Array.isArray(e))return[];const t=[];for(let o=0;o<e.length;o+=1){const r=e[o];if(!r||"object"!=typeof r)continue;const a="string"==typeof r.type?r.type.toLowerCase():"",i=Object.prototype.hasOwnProperty.call(er,a)?er[a]:void 0;if(!i||"string"!=typeof r.url)continue;let n;try{n=new URL(r.url)}catch(e){continue}"https:"===n.protocol&&-1!==i.indexOf(n.hostname.toLowerCase())&&t.push({type:a,url:n.toString(),label:"string"==typeof r.label&&r.label.trim()?r.label.trim():tr[a]})}return t}(m),[m]),[y,v]=o(!1),k=w.length>0,x=r(null),C=r(null),S=a(e=>{C.current=e,"function"==typeof b?b(e):b&&(b.current=e)},[b]),M=k&&y&&!u;i(()=>{M&&function(e,t=zo){const[o]=Lo(e,t);o?.focus()}(x.current)},[M]);const T=n,F=c||"#FFFFFF",z={display:"block",width:"100%",padding:"8px 12px",textAlign:"start",fontSize:"14px",color:e?"#F1F5F9":"#0F172A",background:"transparent",border:"none",borderRadius:"6px",textDecoration:"none",cursor:"pointer"};return p("div",{className:`relative ${h||""}`,children:[M&&p("div",{ref:x,role:"menu","aria-label":f("chooseChannel"),tabIndex:-1,onKeyDown:e=>{if("Escape"===e.key)return e.preventDefault(),v(!1),void C.current?.focus();Ao(e,x.current)},"data-testid":"channel-picker",style:{position:"absolute",bottom:"76px",right:0,minWidth:"180px",padding:"6px",borderRadius:"8px",border:"1px solid "+(e?"#334155":"#E2E8F0"),background:e?"#1E293B":"#FFFFFF",boxShadow:"0 10px 30px rgba(15, 23, 42, 0.15)"},children:[g("button",{type:"button",role:"menuitem",style:z,onClick:()=>{v(!1),s?.()},children:f("chatHere")}),w.map(e=>g("a",{role:"menuitem",href:e.url,target:"_blank",rel:"noopener noreferrer",style:z,onClick:()=>v(!1),children:e.label},`${e.type}-${e.url}`))]}),p("button",{ref:S,onClick:()=>{!k||u?s?.():v(e=>!e)},className:"group relative w-16 h-16 rounded-full shadow-2xl transition-all duration-300 flex items-center justify-center text-white overflow-hidden hover:scale-110",style:{background:`linear-gradient(135deg, ${T} 0%, ${T}dd 100%)`,boxShadow:`0 10px 30px ${T}40`,border:"none"},"aria-label":f(u?"closeChat":"openChat"),"aria-expanded":k&&y||u,"aria-haspopup":k?"menu":void 0,"aria-controls":"chat-window-panel",children:[g("div",{className:"absolute inset-0 rounded-full bg-white/20 scale-0 group-hover:scale-100 transition-transform duration-500"}),g("div",{className:"relative z-10 transition-transform duration-300",children:g(Ze,{className:"w-7 h-7",style:{color:F}})})]})]})});or.displayName="ToggleButton";const rr="0.2.34",ar=function(e){if(null==e)return nr;if("function"==typeof e)return ir(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let o=-1;for(;++o<e.length;)t[o]=ar(e[o]);return ir(r);function r(...e){let o=-1;for(;++o<t.length;)if(t[o].apply(this,e))return!0;return!1}}(e):function(e){const t=e;return ir(o);function o(o){const r=o;let a;for(a in e)if(r[a]!==t[a])return!1;return!0}}(e);if("string"==typeof e)return function(e){return ir(t);function t(t){return t&&t.type===e}}(e);throw new Error("Expected function, string, or object as test")};function ir(e){return function(t,o,r){return Boolean(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof o?o:void 0,r||void 0))}}function nr(){return!0}const sr=[],lr=!0,cr=!1;function dr(e,t,o,r){let a;"function"==typeof t&&"function"!=typeof o?(r=o,o=t):a=t;const i=ar(a),n=r?-1:1;!function e(a,s,l){const c=a&&"object"==typeof a?a:{};if("string"==typeof c.type){const e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(d,"name",{value:"node ("+a.type+(e?"<"+e+">":"")+")"})}return d;function d(){let c,d,u,g=sr;if((!t||i(a,s,l[l.length-1]||void 0))&&(g=function(e){if(Array.isArray(e))return e;if("number"==typeof e)return[lr,e];return null==e?sr:[e]}(o(a,l)),g[0]===cr))return g;if("children"in a&&a.children){const t=a;if(t.children&&"skip"!==g[0])for(d=(r?t.children.length:-1)+n,u=l.concat(t);d>-1&&d<t.children.length;){const o=t.children[d];if(c=e(o,d,u)(),c[0]===cr)return c;d="number"==typeof c[1]?c[1]:d+n}}return g}}(e,void 0,[])()}function ur(e,t,o,r){let a,i,n;"function"==typeof t&&"function"!=typeof o?(i=void 0,n=t,a=o):(i=t,n=o,a=r),dr(e,i,function(e,t){const o=t[t.length-1],r=o?o.children.indexOf(e):void 0;return n(e,r,o)},a)}let gr=null;const pr=new Set;function hr(e,t){if("string"!=typeof e||""===e.trim())return!0;let o;try{o=new URL(e.trim(),t.apiOrigin||"http://relative.invalid")}catch{return!1}return!(!t.apiOrigin||o.origin!==t.apiOrigin)||"https:"===o.protocol&&!o.username&&!o.password&&t.hosts.has(o.hostname.toLowerCase())}function mr(e){const t=gr;if(!t||hr(e,t))return e;if("report"===t.mode){let t=String(e);try{t=new URL(String(e)).host}catch{}return pr.has(t)||(pr.add(t),console.warn(`[eshal-widget] would block an image from ${t}`)),e}}function br(){return e=>{const t=gr;t&&ur(e,"element",(e,o,r)=>{if("img"!==e.tagName||!r||void 0===o)return;const a=e.properties&&e.properties.src;if(hr(a,t))return;if("report"===t.mode){let e=String(a);try{e=new URL(String(a)).host}catch{}return void(pr.has(e)||(pr.add(e),console.warn(`[eshal-widget] would block an image from ${e}`)))}const i=e.properties&&"string"==typeof e.properties.alt?e.properties.alt:"";return r.children.splice(o,1,{type:"text",value:i}),o})}}const fr=({getAuthToken:n,apiBaseUrl:s,darkMode:l,primaryColor:c,position:d,companyName:u,conciergeName:h,companyLogo:m,welcomeMessage:b,quickQuestions:f,quickQuestionsEnabled:w,quickQuestionsLayout:y="vertical",textColor:v,agentMessageBubbleColor:k,userMessageBoxColor:x,assistantTextColor:C,userTextColor:S,fontFamily:M,fontSize:T,defaultLanguage:F,apiKey:z,agentMessageBubbleFontFamily:P,agentMessageBubbleFontSize:L,userMessageBubbleFontFamily:A,userMessageBubbleFontSize:j,autoOpen:N=!1,openDelay:R=0,locale:I,className:B="",headerTextBold:E,headerTextItalic:D,enableVoiceInteraction:V,disclaimerEnabled:O,disclaimerText:$,disclaimerPosition:U,disclaimerLinkUrl:q,disclaimerLinkLabel:H,showPoweredBy:_,onboardingQuestions:W,collectionPrompt:K,allowedDomains:Y,onboardingEnabled:Q,wsBaseUrl:J,channelLinks:G})=>{const[Z,X]=o(null),[ee,te]=o(!0),[oe,re]=o(null),[ae,ie]=o(!1),ne=e.useRef(!1);i(()=>{if(ne.current)return;(async()=>{if(!s)return re("apiBaseUrl is required"),void te(!1);try{te(!0);const e=await(async(e,t)=>{if(!e)throw new Error("apiBaseUrl is required");try{const o=e.replace(/\/$/,""),r=rr?`${o}/api/v1/deploy-agent?wv=${encodeURIComponent(rr)}`:`${o}/api/v1/deploy-agent`,a={"Content-Type":"application/json"};if("function"==typeof t){const e=await t();e&&(a.Authorization=`Bearer ${e}`)}const i=await fetch(r,{method:"GET",headers:a,credentials:"include"});if(404===i.status)return null;if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);return await i.json()}catch(e){throw console.error("Failed to fetch agent configuration:",e),e}})(s,n);if(null===e)return ne.current=!0,ie(!0),X(null),void re(null);!function(e,t){if(!e||"report"!==e.mode&&"enforce"!==e.mode)return void(gr=null);let o="";try{o=new URL(t).origin}catch{o=""}gr={mode:e.mode,hosts:new Set((Array.isArray(e.hosts)?e.hosts:[]).map(e=>String(e).toLowerCase())),apiOrigin:o}}(e.chatImagePolicy,s),X(e),re(null)}catch(e){console.error("Failed to load agent configuration:",e),re(e.message||"Failed to load configuration")}finally{te(!1)}})()},[s,n]);const se=t(()=>{if(!Z)return null;const e=Z.config??{},t=e.identity??{},o=e.branding??{},r=e.typography??{},a=e.messages??{},i=e.voice??{},n=e.onboarding??{},s=e.disclaimer??{},g=e.csat??{},p=e.inactivity??{},y=e.behavior??{},z=e.security??{},N=e.layout??{},R=function(e,t){return e??t?.defaultLocale??t?.config?.messages?.defaultLocale??"en"}(F,Z),I=a.bundles?.[R]??{},B=a.bundles?.en??{},J={welcome:I.welcome||B.welcome,fallback:I.fallback||B.fallback,quickQuestions:Array.isArray(I.quickQuestions)&&I.quickQuestions.length>0?I.quickQuestions:B.quickQuestions},X=Y??z.allowedDomains??(z.domains??[]).map(e=>"string"==typeof e?e:e.domain).filter(Boolean)??[];return{darkMode:l??!1,primaryColor:c??o.brandColor??"#2563eb",companyName:u??t.companyName??"Support Team",conciergeName:h??t.conciergeName,companyLogo:m??o.avatar??null,chatbotAvatarEnabled:o.chatbotAvatarEnabled??!1,chatbotAvatar:o.chatbotAvatar??null,welcomeMessage:b??J.welcome??"Hi! How can we help?",fallbackMessage:J.fallback,quickQuestions:f??J.quickQuestions??[],quickQuestionsEnabled:w??a.quickQuestionsEnabled,textColor:v??"#000000",agentMessageBubbleColor:k??r.agentMessageBubbleColor,userMessageBoxColor:x??r.userMessageBoxColor,assistantTextColor:C??r.assistantTextColor??"#000000",userTextColor:S??r.userTextColor??"#000000",fontFamily:M??r.agentMessageBubbleFontFamily??"Inter",fontSize:T??r.agentMessageBubbleFontSize??"14px",defaultLanguage:R,headerTextBold:E??r.headerTextBold??!1,headerTextItalic:D??r.headerTextItalic??!1,headerTextColor:r.headerTextColor??"#FFFFFF",headerFontFamily:r.headerFontFamily,headerFontSize:r.headerFontSize,subtitle:t.subtitle??null,showStatus:t.showStatus??!1,statusMode:t.statusMode??"always",officeHours:t.officeHours??null,enableVoiceInteraction:V??i.enableVoiceInteraction??!1,disclaimerEnabled:O??s.enabled??!1,disclaimerText:$??s.text,disclaimerPosition:U??(ee=s.position,ee?ee.toLowerCase():"top"),disclaimerLinkUrl:ue(q??s.linkUrl),disclaimerLinkLabel:H??s.linkLabel,showPoweredBy:_??o.showPoweredBy??!0,onboardingQuestions:W??n.questions??[],collectionPrompt:K??n.collapsiblePrompt??"Before we begin, I need to verify your details.",allowedDomains:X,launcherPosition:d??(e=>e?e.toLowerCase().replace(/_/g,"-"):"bottom-right")(N.launcherPosition),onboardingEnabled:Q??n.enabled??!1,inactivityTimeoutValue:p.timeoutValue??null,inactivityTimeoutUnit:p.timeoutUnit??null,agentMessageBubbleFontFamily:P??r.agentMessageBubbleFontFamily??M??"Inter",agentMessageBubbleFontSize:L??r.agentMessageBubbleFontSize??T??"14px",userMessageBubbleFontFamily:A??r.userMessageBubbleFontFamily??M??"Inter",userMessageBubbleFontSize:j??r.userMessageBubbleFontSize??T??"14px",csatEnabled:g.enabled??!1,csatFormat:g.format??"EMOJI",csatPrompt:g.prompt??"How was your experience?",autoPromptEnabled:y.autoPromptEnabled??!0,autoPromptQuestionDisplay:y.autoPromptQuestionDisplay??!0,autoPromptClickTelemetry:y.autoPromptClickTelemetry??!0,allowFeedback:y.allowFeedback??!0,provideCitations:y.provideCitations??!0,organizationId:Z.organizationId??null,chatFeatures:e.chatFeatures??null,channelLinks:G??e.channelLinks??null};var ee},[G,Z,l,c,d,u,h,m,b,f,w,v,k,x,C,S,M,T,F,E,D,V,O,$,U,H,q,_,W,Q,K,Y,P,L,A,j]),le=t(()=>!se||((e=[])=>{if("undefined"==typeof window)return!1;const t=window.location.hostname.toLowerCase(),o=window.location.host.toLowerCase();return!(!e||0===e.length)&&e.some(e=>{const r=e.toLowerCase().trim();return r.includes(":")?o===r:t===r||t.endsWith("."+r)})})(se.allowedDomains),[se]),ce=t(()=>({welcomeMessage:"Hi! How can we help?",quickQuestions:[],apiBaseUrl:s||"",apiKey:z||"",getAuthToken:n,autoOpen:!1,openDelay:0,darkMode:!1,enableVoiceInteraction:!1,onboardingQuestions:[],onboardingEnabled:!1,collectionPrompt:void 0}),[s,z,n]),{isOpen:de,isMinimized:ge,isDark:pe,messages:he,inputValue:me,isLoading:be,widgetRef:fe,setInputValue:we,handleSend:ye,stopGeneration:ve,handleQuickQuestion:ke,sendMessage:xe,retryMessage:Ce,toggleChat:Se,toggleTheme:Me,toggleMinimize:Te,closeChat:Fe,handleDecision:ze,isVoiceSessionActive:Pe,voiceStatus:Le,voiceError:Ae,voiceConclusionForCsat:je,handleVoiceToggle:Ne,sendBidiTextMessage:Re,onboardingActive:Ie,onboardingCompleted:Ee,handleOnboardingFormSubmit:De,conversationId:Ve,resetConversation:Oe,sessionExpiringSoon:$e,updateMessageFeedback:Ue,widgetFilter:qe,setWidgetFilter:He,addAssistantMessage:_e,csatRequest:We,liveJoined:Ke}=Be(se?{welcomeMessage:se.welcomeMessage,fallbackMessage:se.fallbackMessage,quickQuestions:se.quickQuestions,apiBaseUrl:s,wsBaseUrl:J??Z?.wsBaseUrl,apiKey:z,locale:se.defaultLanguage||I,organizationId:se.organizationId,getAuthToken:n,autoOpen:N,openDelay:R,darkMode:se.darkMode,enableVoiceInteraction:se.enableVoiceInteraction,onboardingQuestions:se.onboardingQuestions,onboardingEnabled:se.onboardingEnabled,collectionPrompt:se.collectionPrompt,provideCitations:se.provideCitations,inactivityTimeoutValue:se.inactivityTimeoutValue,inactivityTimeoutUnit:se.inactivityTimeoutUnit,messageLimits:Z?.messageLimits}:ce),Ye=r(null),Qe=r(de);i(()=>{Qe.current&&!de&&Ye.current?.focus(),Qe.current=de},[de]);const Je=a((e,t,o)=>{if(Ue(e,t),!Ve||!s)return;const r=s.replace(/\/$/,"");(async()=>{try{const a={"Content-Type":"application/json"};if("function"==typeof n){const e=await n();e&&(a.Authorization=`Bearer ${e}`)}await fetch(`${r}/api/v1/support/feedback`,{method:"POST",headers:a,credentials:"include",body:JSON.stringify({messageContent:e,conversationId:Ve,feedback:t,feedbackText:o})})}catch(e){console.error("Feedback submission error:",e)}})()},[Ve,s,n,Ue]),Ge=a(()=>{Oe&&Oe()},[Oe]),{categories:Ze,hasFilters:Xe}=function(e,r){const a=!!e,[n,s]=o({categories:[],loading:a,error:null});i(()=>{if(!e)return void s({categories:[],loading:!1,error:null});const t=r?`${e}|__session__`:`${e}|__proxy__`,o=Xo.get(t);if(o)return void s({categories:o,loading:!1,error:null});let a=!1;s(e=>({...e,loading:!0,error:null}));const i=`${e.replace(/\/$/,"")}/api/v1/widget/filters`;return(async()=>{try{const e={Accept:"application/json"};if("function"==typeof r){const t=await r();t&&(e.Authorization=`Bearer ${t}`)}const o=await fetch(i,{method:"GET",headers:e});if(!o.ok)throw new Error(`filter catalog HTTP ${o.status}`);const n=await o.json(),l=Array.isArray(n?.categories)?n.categories:[];if(a)return;Xo.set(t,l),s({categories:l,loading:!1,error:null})}catch(e){if(a)return;console.warn("[useFilterCatalog] catalog fetch failed:",e),s({categories:[],loading:!1,error:e})}})(),()=>{a=!0}},[e,r]);const l=t(()=>Array.isArray(n.categories)&&n.categories.length>0,[n.categories]);return{...n,hasFilters:l}}(s,n),et=a(()=>{const e=he.filter(e=>e.content&&""!==e.content.trim()).map(e=>`${"user"===e.role?"You":se?.conciergeName||"Assistant"}: ${e.content}`).join("\n\n");e&&navigator.clipboard.writeText(e).catch(()=>{})},[he,se?.conciergeName]);if(i(()=>{fe.current&&se&&(fe.current.style.setProperty("--cw-primary",se.primaryColor),se.fontFamily&&fe.current.style.setProperty("--cw-font-family",se.fontFamily),se.textColor&&fe.current.style.setProperty("--cw-text-color",se.textColor))},[se,fe]),ee)return null;if(ae)return null;if(oe||!se)return console.error("ChatWidget configuration error:",oe),null;if(!le)return null;const tt={"bottom-right":"bottom-5 right-5","bottom-left":"bottom-5 left-5","top-right":"top-5 right-5","top-left":"top-5 left-5"};return g("div",{id:"chat-widget-root",children:p("div",{ref:fe,className:`chat-widget-root fixed flex flex-col ${se.launcherPosition?.includes("left")?"items-start":"items-end"} z-[999999] ${pe?"dark":""} ${B} ${tt[se.launcherPosition]||tt["bottom-right"]}`,children:[g(Zo,{isOpen:de,isMinimized:ge,isDark:pe,launcherPosition:se.launcherPosition,primaryColor:se.primaryColor,textColor:se.textColor,companyName:se.companyName,conciergeName:se.conciergeName,companyLogo:se.companyLogo,chatbotAvatarEnabled:se.chatbotAvatarEnabled,chatbotAvatar:se.chatbotAvatar,messages:he,isLoading:be,inputValue:me,setInputValue:we,onSend:ye,onStopGeneration:ve,onDirectSend:xe,onToggleTheme:Me,onMinimize:Te,onClose:Fe,quickQuestions:se.quickQuestions,quickQuestionsEnabled:se.quickQuestionsEnabled,onQuickQuestion:ke,quickQuestionsLayout:y,agentMessageBubbleColor:se.agentMessageBubbleColor,userMessageBoxColor:se.userMessageBoxColor,assistantTextColor:se.assistantTextColor,userTextColor:se.userTextColor,fontFamily:se.fontFamily,agentMessageBubbleFontFamily:se.agentMessageBubbleFontFamily,agentMessageBubbleFontSize:se.agentMessageBubbleFontSize,userMessageBubbleFontFamily:se.userMessageBubbleFontFamily,userMessageBubbleFontSize:se.userMessageBubbleFontSize,fontSize:se.fontSize,defaultLanguage:se.defaultLanguage||I,onDecision:ze,headerTextBold:se.headerTextBold,headerTextItalic:se.headerTextItalic,headerTextColor:se.headerTextColor,headerFontFamily:se.headerFontFamily,headerFontSize:se.headerFontSize,subtitle:se.subtitle,showStatus:se.showStatus,statusMode:se.statusMode,officeHours:se.officeHours,enableVoiceInteraction:se.enableVoiceInteraction,isVoiceSessionActive:Pe,voiceStatus:Le,voiceError:Ae,voiceConclusionForCsat:je,onVoiceToggle:Ne,onBidiSubmit:()=>Re(me),disclaimerEnabled:se.disclaimerEnabled,disclaimerText:se.disclaimerText,disclaimerPosition:se.disclaimerPosition,disclaimerLinkUrl:se.disclaimerLinkUrl,disclaimerLinkLabel:se.disclaimerLinkLabel,showPoweredBy:se.showPoweredBy,apiBaseUrl:s,apiKey:z,getAuthToken:n,conversationId:Ve,conciergeId:Z?.conciergeId??Z?.id,onboardingQuestions:se.onboardingQuestions,onboardingActive:Ie,onboardingCompleted:Ee,onOnboardingFormSubmit:De,collectionPrompt:se.collectionPrompt,csatEnabled:se.csatEnabled,csatFormat:se.csatFormat,csatPrompt:se.csatPrompt,csatRequest:We,liveJoined:Ke,onboardingEnabled:se.onboardingEnabled,onResetConversation:Oe,sessionExpiringSoon:$e,autoPromptEnabled:se.autoPromptEnabled,autoPromptQuestionDisplay:se.autoPromptQuestionDisplay,autoPromptClickTelemetry:se.autoPromptClickTelemetry,allowFeedback:se.allowFeedback,provideCitations:se.provideCitations,onFeedback:Je,onRetryMessage:Ce,onRefreshChat:Ge,onCopyChat:et,filterCategories:Ze,showFilterStep:Xe,widgetFilter:qe,onWidgetFilterChange:He,onSynthesizeAssistantMessage:_e,chatFeatures:se.chatFeatures,organizationId:se.organizationId}),g(or,{ref:Ye,isDark:pe,primaryColor:se.primaryColor,onToggle:Se,textColor:se.textColor,headerTextColor:se.headerTextColor,defaultLanguage:se.defaultLanguage||I,isOpen:de,className:de?"hidden":void 0,channelLinks:se.channelLinks})]})})};function wr(t){const o=r(null),a=r(null);return i(()=>{const e=o.current;if(!e||e.shadowRoot)return;const t=e.attachShadow({mode:"open"}),r=document.createElement("style");r.textContent=":host { all: initial; display: block; }",t.appendChild(r);const i=document.createElement("style");i.textContent='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.chat-widget-root{--cw-primary:#1d4ed8;--cw-primary-hover:#1e40af;--cw-status-success:160 84% 39%;--cw-status-success-bg:152 81% 96%;--cw-status-warning:35 100% 50%;--cw-status-warning-bg:34 100% 95%;--cw-status-error:350 89% 60%;--cw-status-error-bg:356 100% 97%;--cw-status-info:199 89% 48%;--cw-status-info-bg:204 100% 97%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}.chat-widget-root.dark{--cw-status-success:158 64% 52%;--cw-status-success-bg:152 36% 14%;--cw-status-warning:38 92% 60%;--cw-status-warning-bg:36 33% 14%;--cw-status-error:350 89% 65%;--cw-status-error-bg:356 33% 16%;--cw-status-info:199 89% 58%;--cw-status-info-bg:204 33% 14%}.\\!container{width:100%!important}.container{width:100%}@media (min-width:640px){.\\!container{max-width:640px!important}.container{max-width:640px}}@media (min-width:768px){.\\!container{max-width:768px!important}.container{max-width:768px}}@media (min-width:1024px){.\\!container{max-width:1024px!important}.container{max-width:1024px}}@media (min-width:1280px){.\\!container{max-width:1280px!important}.container{max-width:1280px}}@media (min-width:1536px){.\\!container{max-width:1536px!important}.container{max-width:1536px}}#chat-widget-root .chat-widget-root *{box-sizing:border-box;margin:0;padding:0}#chat-widget-root .chat-messages::-webkit-scrollbar{width:6px}#chat-widget-root .chat-messages::-webkit-scrollbar-track{background:transparent}#chat-widget-root .chat-messages::-webkit-scrollbar-thumb{background:rgba(156,163,175,.5);border-radius:10px}#chat-widget-root .chat-messages::-webkit-scrollbar-thumb:hover{background:rgba(156,163,175,.7)}#chat-widget-root .dark .chat-messages::-webkit-scrollbar-thumb{background:rgba(75,85,99,.5)}#chat-widget-root .dark .chat-messages::-webkit-scrollbar-thumb:hover{background:rgba(75,85,99,.7)}#chat-widget-root .sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#chat-widget-root .pointer-events-none{pointer-events:none}#chat-widget-root .visible{visibility:visible}#chat-widget-root .invisible{visibility:hidden}#chat-widget-root .collapse{visibility:collapse}#chat-widget-root .static{position:static}#chat-widget-root .fixed{position:fixed}#chat-widget-root .absolute{position:absolute}#chat-widget-root .relative{position:relative}#chat-widget-root .sticky{position:sticky}#chat-widget-root .inset-0{inset:0}#chat-widget-root .-top-8{top:-2rem}#chat-widget-root .bottom-0{bottom:0}#chat-widget-root .bottom-5{bottom:1.25rem}#chat-widget-root .bottom-full{bottom:100%}#chat-widget-root .left-0{left:0}#chat-widget-root .left-1\\/2{left:50%}#chat-widget-root .left-5{left:1.25rem}#chat-widget-root .right-0{right:0}#chat-widget-root .right-5{right:1.25rem}#chat-widget-root .top-0{top:0}#chat-widget-root .top-1\\/2{top:50%}#chat-widget-root .top-5{top:1.25rem}#chat-widget-root .top-full{top:100%}#chat-widget-root .isolate{isolation:isolate}#chat-widget-root .z-10{z-index:10}#chat-widget-root .z-50{z-index:50}#chat-widget-root .z-\\[60\\]{z-index:60}#chat-widget-root .z-\\[70\\]{z-index:70}#chat-widget-root .z-\\[71\\]{z-index:71}#chat-widget-root .z-\\[999999\\]{z-index:999999}#chat-widget-root .z-\\[9999\\]{z-index:9999}#chat-widget-root .m-0{margin:0}#chat-widget-root .mx-2{margin-left:.5rem;margin-right:.5rem}#chat-widget-root .mx-3{margin-left:.75rem;margin-right:.75rem}#chat-widget-root .my-3{margin-bottom:.75rem;margin-top:.75rem}#chat-widget-root .my-4{margin-bottom:1rem;margin-top:1rem}#chat-widget-root .-mb-px{margin-bottom:-1px}#chat-widget-root .mb-1{margin-bottom:.25rem}#chat-widget-root .mb-1\\.5{margin-bottom:.375rem}#chat-widget-root .mb-2{margin-bottom:.5rem}#chat-widget-root .mb-3{margin-bottom:.75rem}#chat-widget-root .mb-4{margin-bottom:1rem}#chat-widget-root .mb-5{margin-bottom:1.25rem}#chat-widget-root .ml-1{margin-left:.25rem}#chat-widget-root .ms-0\\.5{margin-inline-start:.125rem}#chat-widget-root .mt-0\\.5{margin-top:.125rem}#chat-widget-root .mt-1{margin-top:.25rem}#chat-widget-root .mt-1\\.5{margin-top:.375rem}#chat-widget-root .mt-2{margin-top:.5rem}#chat-widget-root .mt-3{margin-top:.75rem}#chat-widget-root .mt-4{margin-top:1rem}#chat-widget-root .block{display:block}#chat-widget-root .inline-block{display:inline-block}#chat-widget-root .inline{display:inline}#chat-widget-root .flex{display:flex}#chat-widget-root .inline-flex{display:inline-flex}#chat-widget-root .table{display:table}#chat-widget-root .grid{display:grid}#chat-widget-root .hidden{display:none}#chat-widget-root .h-1\\.5{height:.375rem}#chat-widget-root .h-10{height:2.5rem}#chat-widget-root .h-11{height:2.75rem}#chat-widget-root .h-12{height:3rem}#chat-widget-root .h-16{height:4rem}#chat-widget-root .h-2{height:.5rem}#chat-widget-root .h-3{height:.75rem}#chat-widget-root .h-3\\.5{height:.875rem}#chat-widget-root .h-4{height:1rem}#chat-widget-root .h-5{height:1.25rem}#chat-widget-root .h-6{height:1.5rem}#chat-widget-root .h-7{height:1.75rem}#chat-widget-root .h-8{height:2rem}#chat-widget-root .h-\\[650px\\]{height:650px}#chat-widget-root .h-auto{height:auto}#chat-widget-root .h-full{height:100%}#chat-widget-root .h-px{height:1px}#chat-widget-root .max-h-\\[85vh\\]{max-height:85vh}#chat-widget-root .min-h-0{min-height:0}#chat-widget-root .min-h-\\[48px\\]{min-height:48px}#chat-widget-root .w-1\\.5{width:.375rem}#chat-widget-root .w-10{width:2.5rem}#chat-widget-root .w-11{width:2.75rem}#chat-widget-root .w-12{width:3rem}#chat-widget-root .w-16{width:4rem}#chat-widget-root .w-2{width:.5rem}#chat-widget-root .w-3{width:.75rem}#chat-widget-root .w-3\\.5{width:.875rem}#chat-widget-root .w-4{width:1rem}#chat-widget-root .w-44{width:11rem}#chat-widget-root .w-5{width:1.25rem}#chat-widget-root .w-6{width:1.5rem}#chat-widget-root .w-7{width:1.75rem}#chat-widget-root .w-8{width:2rem}#chat-widget-root .w-80{width:20rem}#chat-widget-root .w-96{width:24rem}#chat-widget-root .w-\\[380px\\]{width:380px}#chat-widget-root .w-full{width:100%}#chat-widget-root .min-w-0{min-width:0}#chat-widget-root .min-w-\\[60px\\]{min-width:60px}#chat-widget-root .min-w-full{min-width:100%}#chat-widget-root .max-w-\\[75\\%\\]{max-width:75%}#chat-widget-root .max-w-\\[92vw\\]{max-width:92vw}#chat-widget-root .max-w-full{max-width:100%}#chat-widget-root .max-w-none{max-width:none}#chat-widget-root .max-w-sm{max-width:24rem}#chat-widget-root .max-w-xs{max-width:20rem}#chat-widget-root .flex-1{flex:1 1 0%}#chat-widget-root .flex-shrink-0,#chat-widget-root .shrink-0{flex-shrink:0}#chat-widget-root .grow{flex-grow:1}#chat-widget-root .border-collapse{border-collapse:collapse}#chat-widget-root .-translate-x-1\\/2{--tw-translate-x:-50%}#chat-widget-root .-translate-x-1\\/2,#chat-widget-root .-translate-y-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .-translate-y-1\\/2{--tw-translate-y:-50%}#chat-widget-root .-rotate-90{--tw-rotate:-90deg}#chat-widget-root .-rotate-90,#chat-widget-root .rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .rotate-180{--tw-rotate:180deg}#chat-widget-root .rotate-90{--tw-rotate:90deg}#chat-widget-root .rotate-90,#chat-widget-root .scale-0{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .scale-0{--tw-scale-x:0;--tw-scale-y:0}#chat-widget-root .scale-100{--tw-scale-x:1;--tw-scale-y:1}#chat-widget-root .scale-100,#chat-widget-root .scale-110{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .scale-110{--tw-scale-x:1.1;--tw-scale-y:1.1}#chat-widget-root .scale-125{--tw-scale-x:1.25;--tw-scale-y:1.25}#chat-widget-root .scale-125,#chat-widget-root .scale-95{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .scale-95{--tw-scale-x:.95;--tw-scale-y:.95}#chat-widget-root .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}}#chat-widget-root .animate-bounce{animation:bounce 1s infinite}@keyframes pulse{50%{opacity:.5}}#chat-widget-root .animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(1turn)}}#chat-widget-root .animate-spin{animation:spin 1s linear infinite}#chat-widget-root .cursor-ew-resize{cursor:ew-resize}#chat-widget-root .cursor-nesw-resize{cursor:nesw-resize}#chat-widget-root .cursor-not-allowed{cursor:not-allowed}#chat-widget-root .cursor-ns-resize{cursor:ns-resize}#chat-widget-root .cursor-nwse-resize{cursor:nwse-resize}#chat-widget-root .cursor-pointer{cursor:pointer}#chat-widget-root .resize-none{resize:none}#chat-widget-root .resize{resize:both}#chat-widget-root .list-decimal{list-style-type:decimal}#chat-widget-root .list-disc{list-style-type:disc}#chat-widget-root .list-none{list-style-type:none}#chat-widget-root .flex-row{flex-direction:row}#chat-widget-root .flex-row-reverse{flex-direction:row-reverse}#chat-widget-root .flex-col{flex-direction:column}#chat-widget-root .flex-wrap{flex-wrap:wrap}#chat-widget-root .items-start{align-items:flex-start}#chat-widget-root .items-end{align-items:flex-end}#chat-widget-root .items-center{align-items:center}#chat-widget-root .justify-start{justify-content:flex-start}#chat-widget-root .justify-end{justify-content:flex-end}#chat-widget-root .justify-center{justify-content:center}#chat-widget-root .justify-between{justify-content:space-between}#chat-widget-root .gap-0{gap:0}#chat-widget-root .gap-0\\.5{gap:.125rem}#chat-widget-root .gap-1{gap:.25rem}#chat-widget-root .gap-1\\.5{gap:.375rem}#chat-widget-root .gap-2{gap:.5rem}#chat-widget-root .gap-2\\.5{gap:.625rem}#chat-widget-root .gap-3{gap:.75rem}#chat-widget-root .gap-4{gap:1rem}#chat-widget-root .gap-6{gap:1.5rem}#chat-widget-root :is(.space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#chat-widget-root :is(.space-y-4>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#chat-widget-root .overflow-hidden{overflow:hidden}#chat-widget-root .overflow-visible{overflow:visible}#chat-widget-root .overflow-x-auto{overflow-x:auto}#chat-widget-root .overflow-y-auto{overflow-y:auto}#chat-widget-root .truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#chat-widget-root .whitespace-nowrap{white-space:nowrap}#chat-widget-root .whitespace-pre-wrap{white-space:pre-wrap}#chat-widget-root .break-words{overflow-wrap:break-word}#chat-widget-root .break-all{word-break:break-all}#chat-widget-root .rounded{border-radius:.25rem}#chat-widget-root .rounded-2xl{border-radius:1rem}#chat-widget-root .rounded-3xl{border-radius:1.5rem}#chat-widget-root .rounded-full{border-radius:9999px}#chat-widget-root .rounded-lg{border-radius:.5rem}#chat-widget-root .rounded-md{border-radius:.375rem}#chat-widget-root .rounded-xl{border-radius:.75rem}#chat-widget-root .rounded-t-2xl{border-top-left-radius:1rem;border-top-right-radius:1rem}#chat-widget-root .rounded-tl-sm{border-top-left-radius:.125rem}#chat-widget-root .rounded-tr-sm{border-top-right-radius:.125rem}#chat-widget-root .border{border-width:1px}#chat-widget-root .border-0{border-width:0}#chat-widget-root .border-b{border-bottom-width:1px}#chat-widget-root .border-l-4{border-left-width:4px}#chat-widget-root .border-t{border-top-width:1px}#chat-widget-root .border-t-2{border-top-width:2px}#chat-widget-root .border-dotted{border-style:dotted}#chat-widget-root .border-none{border-style:none}#chat-widget-root .\\!border-status-error{border-color:hsl(var(--cw-status-error))!important}#chat-widget-root .border-amber-200{--tw-border-opacity:1;border-color:rgb(253 230 138/var(--tw-border-opacity,1))}#chat-widget-root .border-amber-700\\/50{border-color:rgba(180,83,9,.5)}#chat-widget-root .border-blue-200{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity,1))}#chat-widget-root .border-blue-700\\/50{border-color:rgba(29,78,216,.5)}#chat-widget-root .border-gray-100{--tw-border-opacity:1;border-color:rgb(243 244 246/var(--tw-border-opacity,1))}#chat-widget-root .border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}#chat-widget-root .border-gray-200\\/60{border-color:rgba(229,231,235,.6)}#chat-widget-root .border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}#chat-widget-root .border-gray-600{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity,1))}#chat-widget-root .border-gray-700{--tw-border-opacity:1;border-color:rgb(55 65 81/var(--tw-border-opacity,1))}#chat-widget-root .border-gray-700\\/50{border-color:rgba(55,65,81,.5)}#chat-widget-root .border-transparent{border-color:transparent}#chat-widget-root .bg-amber-50{--tw-bg-opacity:1;background-color:rgb(255 251 235/var(--tw-bg-opacity,1))}#chat-widget-root .bg-amber-900\\/40{background-color:rgba(120,53,15,.4)}#chat-widget-root .bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}#chat-widget-root .bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}#chat-widget-root .bg-blue-900\\/30{background-color:rgba(30,58,138,.3)}#chat-widget-root .bg-current{background-color:currentColor}#chat-widget-root .bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gray-50\\/30{background-color:rgba(249,250,251,.3)}#chat-widget-root .bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gray-700\\/50{background-color:rgba(55,65,81,.5)}#chat-widget-root .bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gray-800\\/50{background-color:rgba(31,41,55,.5)}#chat-widget-root .bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}#chat-widget-root .bg-green-200{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity,1))}#chat-widget-root .bg-orange-200{--tw-bg-opacity:1;background-color:rgb(254 215 170/var(--tw-bg-opacity,1))}#chat-widget-root .bg-pink-200{--tw-bg-opacity:1;background-color:rgb(251 207 232/var(--tw-bg-opacity,1))}#chat-widget-root .bg-red-200{--tw-bg-opacity:1;background-color:rgb(254 202 202/var(--tw-bg-opacity,1))}#chat-widget-root .bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}#chat-widget-root .bg-slate-50\\/50{background-color:rgba(248,250,252,.5)}#chat-widget-root .bg-slate-800\\/50{background-color:rgba(30,41,59,.5)}#chat-widget-root .bg-transparent{background-color:transparent}#chat-widget-root .bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}#chat-widget-root .bg-white\\/10{background-color:hsla(0,0%,100%,.1)}#chat-widget-root .bg-white\\/20{background-color:hsla(0,0%,100%,.2)}#chat-widget-root .bg-yellow-200{--tw-bg-opacity:1;background-color:rgb(254 240 138/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}#chat-widget-root .bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}#chat-widget-root .from-gray-50\\/50{--tw-gradient-from:rgba(249,250,251,.5) var(--tw-gradient-from-position);--tw-gradient-to:rgba(249,250,251,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}#chat-widget-root .from-white\\/0{--tw-gradient-from:hsla(0,0%,100%,0) var(--tw-gradient-from-position);--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}#chat-widget-root .from-white\\/10{--tw-gradient-from:hsla(0,0%,100%,.1) var(--tw-gradient-from-position);--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}#chat-widget-root .from-yellow-200{--tw-gradient-from:#fef08a var(--tw-gradient-from-position);--tw-gradient-to:hsla(53,98%,77%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}#chat-widget-root .via-white\\/5{--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),hsla(0,0%,100%,.05) var(--tw-gradient-via-position),var(--tw-gradient-to)}#chat-widget-root .to-white{--tw-gradient-to:#fff var(--tw-gradient-to-position)}#chat-widget-root .to-white\\/10{--tw-gradient-to:hsla(0,0%,100%,.1) var(--tw-gradient-to-position)}#chat-widget-root .to-yellow-400{--tw-gradient-to:#facc15 var(--tw-gradient-to-position)}#chat-widget-root .object-contain{-o-object-fit:contain;object-fit:contain}#chat-widget-root .p-0{padding:0}#chat-widget-root .p-0\\.5{padding:.125rem}#chat-widget-root .p-3{padding:.75rem}#chat-widget-root .p-5{padding:1.25rem}#chat-widget-root .p-6{padding:1.5rem}#chat-widget-root .p-8{padding:2rem}#chat-widget-root .px-1{padding-left:.25rem;padding-right:.25rem}#chat-widget-root .px-2{padding-left:.5rem;padding-right:.5rem}#chat-widget-root .px-2\\.5{padding-left:.625rem;padding-right:.625rem}#chat-widget-root .px-3{padding-left:.75rem;padding-right:.75rem}#chat-widget-root .px-4{padding-left:1rem;padding-right:1rem}#chat-widget-root .px-5{padding-left:1.25rem;padding-right:1.25rem}#chat-widget-root .py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}#chat-widget-root .py-1{padding-bottom:.25rem;padding-top:.25rem}#chat-widget-root .py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}#chat-widget-root .py-12{padding-bottom:3rem;padding-top:3rem}#chat-widget-root .py-2{padding-bottom:.5rem;padding-top:.5rem}#chat-widget-root .py-2\\.5{padding-bottom:.625rem;padding-top:.625rem}#chat-widget-root .py-3{padding-bottom:.75rem;padding-top:.75rem}#chat-widget-root .py-3\\.5{padding-bottom:.875rem;padding-top:.875rem}#chat-widget-root .py-4{padding-bottom:1rem;padding-top:1rem}#chat-widget-root .pb-1{padding-bottom:.25rem}#chat-widget-root .pb-2{padding-bottom:.5rem}#chat-widget-root .pl-1{padding-left:.25rem}#chat-widget-root .pl-2{padding-left:.5rem}#chat-widget-root .pl-4{padding-left:1rem}#chat-widget-root .pl-\\[50px\\]{padding-left:50px}#chat-widget-root .pr-1{padding-right:.25rem}#chat-widget-root .pt-1{padding-top:.25rem}#chat-widget-root .pt-4{padding-top:1rem}#chat-widget-root .text-left{text-align:left}#chat-widget-root .text-center{text-align:center}#chat-widget-root .text-right{text-align:right}#chat-widget-root .text-start{text-align:start}#chat-widget-root .align-text-bottom{vertical-align:text-bottom}#chat-widget-root .font-sans{font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}#chat-widget-root .text-2xl{font-size:1.5rem;line-height:2rem}#chat-widget-root .text-\\[10px\\]{font-size:10px}#chat-widget-root .text-base{font-size:1rem;line-height:1.5rem}#chat-widget-root .text-chip{font-size:11px;letter-spacing:0;line-height:1.4}#chat-widget-root .text-h4{font-size:18px;letter-spacing:0;line-height:1.3}#chat-widget-root .text-lg{font-size:1.125rem;line-height:1.75rem}#chat-widget-root .text-sm{font-size:.875rem;line-height:1.25rem}#chat-widget-root .text-xl{font-size:1.25rem;line-height:1.75rem}#chat-widget-root .text-xs{font-size:.75rem;line-height:1rem}#chat-widget-root .font-bold{font-weight:700}#chat-widget-root .font-medium{font-weight:500}#chat-widget-root .font-semibold{font-weight:600}#chat-widget-root .uppercase{text-transform:uppercase}#chat-widget-root .lowercase{text-transform:lowercase}#chat-widget-root .italic{font-style:italic}#chat-widget-root .tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}#chat-widget-root .leading-5{line-height:1.25rem}#chat-widget-root .leading-none{line-height:1}#chat-widget-root .leading-normal{line-height:1.5}#chat-widget-root .leading-relaxed{line-height:1.625}#chat-widget-root .leading-snug{line-height:1.375}#chat-widget-root .tracking-wide{letter-spacing:.025em}#chat-widget-root .text-\\[\\#4A5568\\]{--tw-text-opacity:1;color:rgb(74 85 104/var(--tw-text-opacity,1))}#chat-widget-root .text-amber-200{--tw-text-opacity:1;color:rgb(253 230 138/var(--tw-text-opacity,1))}#chat-widget-root .text-amber-800{--tw-text-opacity:1;color:rgb(146 64 14/var(--tw-text-opacity,1))}#chat-widget-root .text-current{color:currentColor}#chat-widget-root .text-gray-100{--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-200{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-500\\/80{color:hsla(220,9%,46%,.8)}#chat-widget-root .text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}#chat-widget-root .text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}#chat-widget-root .text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}#chat-widget-root .text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}#chat-widget-root .text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}#chat-widget-root .text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity,1))}#chat-widget-root .text-slate-500{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}#chat-widget-root .text-status-error{color:hsl(var(--cw-status-error))}#chat-widget-root .text-status-success{color:hsl(var(--cw-status-success))}#chat-widget-root .text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}#chat-widget-root .text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21/var(--tw-text-opacity,1))}#chat-widget-root .underline{text-decoration-line:underline}#chat-widget-root .no-underline{text-decoration-line:none}#chat-widget-root .placeholder-gray-400::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity,1))}#chat-widget-root .placeholder-gray-400::placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity,1))}#chat-widget-root .placeholder-gray-500::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(107 114 128/var(--tw-placeholder-opacity,1))}#chat-widget-root .placeholder-gray-500::placeholder{--tw-placeholder-opacity:1;color:rgb(107 114 128/var(--tw-placeholder-opacity,1))}#chat-widget-root .opacity-0{opacity:0}#chat-widget-root .opacity-50{opacity:.5}#chat-widget-root .opacity-60{opacity:.6}#chat-widget-root .opacity-70{opacity:.7}#chat-widget-root .opacity-75{opacity:.75}#chat-widget-root .opacity-80{opacity:.8}#chat-widget-root .shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}#chat-widget-root .shadow,#chat-widget-root .shadow-2xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#chat-widget-root .shadow-2xl{--tw-shadow:0 25px 50px -12px rgba(0,0,0,.25);--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color)}#chat-widget-root .shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}#chat-widget-root .shadow-lg,#chat-widget-root .shadow-md{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#chat-widget-root .shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}#chat-widget-root .shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}#chat-widget-root .shadow-sm,#chat-widget-root .shadow-xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#chat-widget-root .shadow-xl{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color)}#chat-widget-root .shadow-black\\/20{--tw-shadow-color:rgba(0,0,0,.2);--tw-shadow:var(--tw-shadow-colored)}#chat-widget-root .shadow-gray-200\\/80{--tw-shadow-color:rgba(229,231,235,.8);--tw-shadow:var(--tw-shadow-colored)}#chat-widget-root .outline-none{outline:2px solid transparent;outline-offset:2px}#chat-widget-root .outline{outline-style:solid}#chat-widget-root .ring{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color)}#chat-widget-root .ring,#chat-widget-root .ring-2{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#chat-widget-root .ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)}#chat-widget-root .ring-blue-100{--tw-ring-opacity:1;--tw-ring-color:rgb(219 234 254/var(--tw-ring-opacity,1))}#chat-widget-root .ring-blue-300{--tw-ring-opacity:1;--tw-ring-color:rgb(147 197 253/var(--tw-ring-opacity,1))}#chat-widget-root .ring-white{--tw-ring-opacity:1;--tw-ring-color:rgb(255 255 255/var(--tw-ring-opacity,1))}#chat-widget-root .blur{--tw-blur:blur(8px)}#chat-widget-root .blur,#chat-widget-root .drop-shadow{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}#chat-widget-root .drop-shadow{--tw-drop-shadow:drop-shadow(0 1px 2px rgba(0,0,0,.1)) drop-shadow(0 1px 1px rgba(0,0,0,.06))}#chat-widget-root .drop-shadow-md{--tw-drop-shadow:drop-shadow(0 4px 3px rgba(0,0,0,.07)) drop-shadow(0 2px 2px rgba(0,0,0,.06))}#chat-widget-root .drop-shadow-md,#chat-widget-root .drop-shadow-sm{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}#chat-widget-root .drop-shadow-sm{--tw-drop-shadow:drop-shadow(0 1px 1px rgba(0,0,0,.05))}#chat-widget-root .grayscale-\\[0\\.3\\]{--tw-grayscale:grayscale(0.3)}#chat-widget-root .filter,#chat-widget-root .grayscale-\\[0\\.3\\]{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}#chat-widget-root .backdrop-blur-sm{--tw-backdrop-blur:blur(4px);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}#chat-widget-root .transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}#chat-widget-root .transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#chat-widget-root .transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}#chat-widget-root .transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}#chat-widget-root .transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}#chat-widget-root .duration-150{transition-duration:.15s}#chat-widget-root .duration-200{transition-duration:.2s}#chat-widget-root .duration-300{transition-duration:.3s}#chat-widget-root .duration-500{transition-duration:.5s}#chat-widget-root :is(#chat-widget-root .animate-in){animation:slideIn .3s ease-out}#chat-widget-root :is(#chat-widget-root .transition-all){transition-duration:.3s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#chat-widget-root .\\[font-family\\:inherit\\]{font-family:inherit}#chat-widget-root .placeholder\\:text-\\[\\#A2A9B2\\]::-moz-placeholder{--tw-text-opacity:1;color:rgb(162 169 178/var(--tw-text-opacity,1))}#chat-widget-root .placeholder\\:text-\\[\\#A2A9B2\\]::placeholder{--tw-text-opacity:1;color:rgb(162 169 178/var(--tw-text-opacity,1))}#chat-widget-root .placeholder\\:text-gray-500::-moz-placeholder{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}#chat-widget-root .placeholder\\:text-gray-500::placeholder{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}#chat-widget-root .hover\\:scale-105:hover{--tw-scale-x:1.05;--tw-scale-y:1.05}#chat-widget-root .hover\\:scale-105:hover,#chat-widget-root .hover\\:scale-110:hover{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .hover\\:scale-110:hover{--tw-scale-x:1.1;--tw-scale-y:1.1}#chat-widget-root .hover\\:scale-\\[1\\.02\\]:hover{--tw-scale-x:1.02;--tw-scale-y:1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .hover\\:border-blue-400:hover{--tw-border-opacity:1;border-color:rgb(96 165 250/var(--tw-border-opacity,1))}#chat-widget-root .hover\\:border-blue-600:hover{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}#chat-widget-root .hover\\:bg-blue-50:hover{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}#chat-widget-root .hover\\:bg-blue-500\\/20:hover{background-color:rgba(59,130,246,.2)}#chat-widget-root .hover\\:bg-blue-900\\/50:hover{background-color:rgba(30,58,138,.5)}#chat-widget-root .hover\\:bg-gray-200:hover{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}#chat-widget-root .hover\\:bg-gray-50:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}#chat-widget-root .hover\\:bg-gray-600:hover{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity,1))}#chat-widget-root .hover\\:bg-gray-700:hover{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}#chat-widget-root .hover\\:bg-red-600:hover{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}#chat-widget-root .hover\\:bg-transparent:hover{background-color:transparent}#chat-widget-root .hover\\:text-blue-500:hover{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}#chat-widget-root .hover\\:text-gray-200:hover{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}#chat-widget-root .hover\\:text-gray-300:hover{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}#chat-widget-root .hover\\:text-gray-600:hover{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}#chat-widget-root .hover\\:text-gray-700:hover{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}#chat-widget-root .hover\\:underline:hover{text-decoration-line:underline}#chat-widget-root .hover\\:opacity-80:hover{opacity:.8}#chat-widget-root .hover\\:opacity-90:hover{opacity:.9}#chat-widget-root .hover\\:shadow-md:hover{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}#chat-widget-root .hover\\:shadow-md:hover,#chat-widget-root .hover\\:shadow-xl:hover{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#chat-widget-root .hover\\:shadow-xl:hover{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color)}#chat-widget-root .hover\\:grayscale-0:hover{--tw-grayscale:grayscale(0);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}#chat-widget-root .focus\\:\\!border-status-error:focus{border-color:hsl(var(--cw-status-error))!important}#chat-widget-root .focus\\:border-\\[\\#5A6069\\]:focus{--tw-border-opacity:1;border-color:rgb(90 96 105/var(--tw-border-opacity,1))}#chat-widget-root .focus\\:border-\\[\\#B0B0B0\\]:focus{--tw-border-opacity:1;border-color:rgb(176 176 176/var(--tw-border-opacity,1))}#chat-widget-root .focus\\:bg-white:focus{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}#chat-widget-root .focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}#chat-widget-root .focus\\:ring-0:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color)}#chat-widget-root .focus\\:ring-0:focus,#chat-widget-root .focus\\:ring-1:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#chat-widget-root .focus\\:ring-1:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color)}#chat-widget-root .focus\\:ring-gray-300:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(209 213 219/var(--tw-ring-opacity,1))}#chat-widget-root .focus\\:ring-gray-600:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(75 85 99/var(--tw-ring-opacity,1))}#chat-widget-root .focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}#chat-widget-root .focus-visible\\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#chat-widget-root .focus-visible\\:ring-blue-700:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(29 78 216/var(--tw-ring-opacity,1))}#chat-widget-root .focus-visible\\:ring-white\\/40:focus-visible{--tw-ring-color:hsla(0,0%,100%,.4)}#chat-widget-root .active\\:scale-95:active{--tw-scale-x:.95;--tw-scale-y:.95}#chat-widget-root .active\\:scale-95:active,#chat-widget-root .active\\:scale-\\[0\\.97\\]:active{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .active\\:scale-\\[0\\.97\\]:active{--tw-scale-x:0.97;--tw-scale-y:0.97}#chat-widget-root .active\\:scale-\\[0\\.98\\]:active{--tw-scale-x:0.98;--tw-scale-y:0.98}#chat-widget-root .active\\:scale-\\[0\\.98\\]:active,#chat-widget-root .active\\:scale-\\[0\\.99\\]:active{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .active\\:scale-\\[0\\.99\\]:active{--tw-scale-x:0.99;--tw-scale-y:0.99}#chat-widget-root .active\\:outline-none:active{outline:2px solid transparent;outline-offset:2px}#chat-widget-root .active\\:ring-0:active{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#chat-widget-root .disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}#chat-widget-root .disabled\\:opacity-40:disabled{opacity:.4}#chat-widget-root .disabled\\:opacity-50:disabled{opacity:.5}#chat-widget-root .disabled\\:shadow-none:disabled{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#chat-widget-root :is(.group:hover .group-hover\\:scale-100){--tw-scale-x:1;--tw-scale-y:1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root :is(.group:hover .group-hover\\:opacity-100){opacity:1}#chat-widget-root .dark\\:text-gray-300:is(.dark *){--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}#chat-widget-root .dark\\:text-gray-400:is(.dark *){--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}@media (min-width:768px){#chat-widget-root .md\\:text-sm{font-size:.875rem;line-height:1.25rem}}#chat-widget-root .rtl\\:rounded-tl-2xl:where([dir=rtl],[dir=rtl] *){border-top-left-radius:1rem}#chat-widget-root .rtl\\:rounded-tr-sm:where([dir=rtl],[dir=rtl] *){border-top-right-radius:.125rem}#chat-widget-root .\\[\\&\\:first-child\\]\\:\\!mt-0:first-child{margin-top:0!important}#chat-widget-root :is(.\\[\\&\\>\\*\\:first-child\\]\\:\\!mt-0>:first-child){margin-top:0!important}#chat-widget-root :is(.\\[\\&\\>\\*\\:last-child\\]\\:\\!mb-0>:last-child){margin-bottom:0!important}\n.chat-widget-root{position:fixed;z-index:999999}.chat-widget-container{color:var(--cw-text-color,inherit);font-family:var(\n --cw-font-family,-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif\n )}#chat-widget-root .chat-messages p{overflow-wrap:anywhere;word-break:break-word}textarea#chat-widget-input::-moz-placeholder{border:none;line-height:48px;outline:none}textarea#chat-widget-input::placeholder{border:none;line-height:48px;outline:none}textarea#chat-widget-input{border:none;line-height:48px;outline:none}@keyframes slideIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes bounce{0%,to{transform:translateY(0)}50%{transform:translateY(-5px)}}#chat-widget-root .scrollbar-hide{-ms-overflow-style:none;scrollbar-width:none}#chat-widget-root .scrollbar-hide::-webkit-scrollbar{display:none}#chat-widget-root .slim-scrollbar-x{scrollbar-width:thin}#chat-widget-root .slim-scrollbar-x::-webkit-scrollbar{height:3px!important}#chat-widget-root .slim-scrollbar-x::-webkit-scrollbar-track{background:transparent!important}#chat-widget-root .slim-scrollbar-x::-webkit-scrollbar-thumb{background:#d1d5db!important;border-radius:2px!important}#chat-widget-root .slim-scrollbar-x::-webkit-scrollbar-thumb:hover{background:#9ca3af!important}@media print{.chat-widget-root{display:none!important}}',t.appendChild(i);const n=document.createElement("div");n.id="chat-widget-mount",t.appendChild(n),a.current=u(n)},[]),i(()=>{a.current?.render(e.createElement(fr,t))}),i(()=>()=>{const e=a.current;a.current=null,queueMicrotask(()=>e?.unmount())},[]),g("div",{ref:o,id:"chat-widget-host"})}export{Kt as A,cr as E,Je as F,Ge as L,wr as S,wt as W,ar as a,dr as b,Ue as c,mt as d,co as e,yt as f,io as l,so as m,Yt as n,mr as p,br as r,Gt as s,ro as t,ur as v};