UNPKG

mind-link-ai-widget

Version:

A react widget for React Web and React-Native Mobile integrations.

10 lines (9 loc) 21.1 kB
"use strict";const i=require("react"),S=require("react-icons/io5");var F={exports:{}},$={};/** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var oe;function je(){if(oe)return $;oe=1;var s=i,a=Symbol.for("react.element"),d=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,w=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,I={key:!0,ref:!0,__self:!0,__source:!0};function g(N,c,f){var p,v={},x=null,o=null;f!==void 0&&(x=""+f),c.key!==void 0&&(x=""+c.key),c.ref!==void 0&&(o=c.ref);for(p in c)l.call(c,p)&&!I.hasOwnProperty(p)&&(v[p]=c[p]);if(N&&N.defaultProps)for(p in c=N.defaultProps,c)v[p]===void 0&&(v[p]=c[p]);return{$$typeof:a,type:N,key:x,ref:o,props:v,_owner:w.current}}return $.Fragment=d,$.jsx=g,$.jsxs=g,$}var re;function we(){return re||(re=1,F.exports=je()),F.exports}var e=we();const j=[];for(let s=0;s<256;++s)j.push((s+256).toString(16).slice(1));function Ne(s,a=0){return(j[s[a+0]]+j[s[a+1]]+j[s[a+2]]+j[s[a+3]]+"-"+j[s[a+4]]+j[s[a+5]]+"-"+j[s[a+6]]+j[s[a+7]]+"-"+j[s[a+8]]+j[s[a+9]]+"-"+j[s[a+10]]+j[s[a+11]]+j[s[a+12]]+j[s[a+13]]+j[s[a+14]]+j[s[a+15]]).toLowerCase()}let X;const ve=new Uint8Array(16);function ye(){if(!X){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");X=crypto.getRandomValues.bind(crypto)}return X(ve)}const Se=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),le={randomUUID:Se};function Ie(s,a,d){if(le.randomUUID&&!s)return le.randomUUID();s=s||{};const l=s.random??s.rng?.()??ye();if(l.length<16)throw new Error("Random bytes length must be >= 16");return l[6]=l[6]&15|64,l[8]=l[8]&63|128,Ne(l)}const ke=k();function k(){return Ie()}function Ce(){const s=new Date().getHours();return s<12?"Good Morning":s<18?"Good Afternoon":"Good Evening"}function Y(s,a=1){return s.slice().sort(()=>.5-Math.random()).slice(0,a)}function _e(s){const a=s.replace(/\D/g,"");return a.length===10?`(${a.slice(0,3)}) ${a.slice(3,6)}-${a.slice(6)}`:a.length===11&&a.startsWith("1")?`+1 (${a.slice(1,4)}) ${a.slice(4,7)}-${a.slice(7)}`:s}function ue(s){return s.replace(/\w\S*/g,a=>a.charAt(0).toUpperCase()+a.slice(1).toLowerCase())}const G="https://uat.api-az.carelonhealth.com/mindlink/api/v1",K="carelon-bh-mobile",Q="2f8c1e7a-4b3d-4e2a-9c6a-8a1f7b2c5d9e";async function Re(s,a){const d=`${G}/behive/intents-and-entities`,l=await fetch(d,{method:"POST",headers:{Authorization:`Bearer ${s}`,apikey:Q,"sender-app":K,"Content-Type":"application/json",accept:"application/json","x-csid":ke},body:JSON.stringify({query:a})});if(!l.ok)throw new Error("Network error");return l.json()}async function de(s,a){const d=`${G}/behive/crediblemind/suggest`,l=await fetch(d,{method:"POST",headers:{Authorization:`Bearer ${s}`,apikey:Q,"sender-app":K,"Content-Type":"application/json",accept:"application/json"},body:JSON.stringify({query:a})});if(!l.ok)throw new Error("Network error");return l.json()}async function Ee(s,a){const d=`${G}/behive/providers/search`,l=await fetch(d,{method:"POST",headers:{Authorization:`Bearer ${s}`,apikey:Q,"sender-app":K,"Content-Type":"application/json",accept:"application/json"},body:JSON.stringify(a)});if(!l.ok)throw new Error("Network error");return l.json()}const Te=({children:s,className:a})=>e.jsx("span",{className:a,onClick:()=>console.warn("Navigation not supported"),children:s}),he="var(--carelon-purple)",J=(s=new Date)=>s.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}),Me=({showGreeting:s,onStartChat:a,chipToSend:d,onChipSent:l,chips:w=[],selectedChipIdx:I=null,handleChipClick:g,token:N})=>{const[c,f]=i.useState([]),[p,v]=i.useState(""),[x,o]=i.useState(!1),[t,h]=i.useState(!1),[y,r]=i.useState(!1),[_,U]=i.useState(!1),[b,O]=i.useState([]),[L,q]=i.useState(null),[z,me]=i.useState([]),[Z,ee]=i.useState(!0),te=30,V=i.useRef(null),pe=i.useRef(null),se=i.useRef(null),ne=i.useRef(null),B=i.useRef(null),W=async n=>{if(!(n||p.trim())||x)return;s&&a(),U(!0);const u=n||p,T={id:k()+"-user",sender:"user",text:u,timestamp:new Date};f(m=>[...m,T]),v(""),o(!0),ee(!0);try{pe.current=se.current,ne.current=B.current;const m=await Re(N,T.text);se.current=m.intent,B.current=m.slots.specialty;const R=m?.slots_fulfillment?.status??!0;ee(R);const D=m?.followup?.prompt??null,P=m?.followup?.options??[];me(P);const ce=m.smalltalk,H=m.hybridtalk;if(R&&m.intent!=="provider_search_intent"&&f(C=>[...C,{id:k()+"-bot-smalltalk",sender:"bot",text:ce||H,timestamp:new Date}]),R&&m.intent==="health_content_intent"&&m.slots.content_query){const C=await de(N,m.slots.content_query);C?.crediblemind?.length?f(M=>[...M,{id:k()+"-bot-healthcontent-richinfo",sender:"bot",crediblemind:C.crediblemind,timestamp:new Date}]):f(M=>[...M,{id:k()+"-bot-smalltalk",sender:"bot",text:"Sorry! There are no health content suggestions for your query.",timestamp:new Date}])}else if(R&&m.intent==="provider_search_intent"){let C=null;ne.current!==B.current&&(C=await de(N,m.query)),C?.crediblemind?.length?f(E=>[...E,{id:k()+"-bot-healthcontent-richinfo-with-text",sender:"bot",text:H,crediblemind:C.crediblemind,timestamp:new Date}]):f(E=>[...E,{id:k()+"-bot-smalltalk",sender:"bot",text:ce||H,timestamp:new Date}]);const M=await Ee(N,{gender:m.slots.gender,specialty:m.slots.specialty,provider_type:m.slots.provider_type,location:m.slots.location,language:m.slots.language});M?.providers?.length?f(E=>[...E,{id:k()+"-bot-providersearch-richinfo",sender:"bot",providers:M.providers,timestamp:new Date}]):f(E=>[...E,{id:k()+"-bot-smalltalk",sender:"bot",text:"Sorry! There are no providers available for your search criteria.",timestamp:new Date}])}f(C=>[...C,{id:k()+"-bot-followup",sender:"bot",text:D||void 0,timestamp:new Date}])}catch{f(m=>[...m,{id:k()+"-bot-smalltalk",sender:"bot",text:"Sorry! There was a problem interacting with my system. Please try again in a while.",timestamp:new Date}])}finally{o(!1)}};i.useEffect(()=>{V.current?.scrollIntoView({behavior:"smooth"})},[c,x]),i.useEffect(()=>{d&&!_&&(W(d),U(!0),s&&a(),typeof l=="function"&&l())},[d]);const[ae,ie]=i.useState(!1);i.useEffect(()=>{if(!ae){if(!s&&c.length>b.length){const n=c[b.length];if(n.sender==="bot"){let u="",T=0;ie(!0);const m=typeof n.text=="string"?n.text:"",R=()=>{m&&T<m.length?(u+=m[T],O(D=>{const P=[...D];return P[P.length-1]={...n,text:u},P}),T++,setTimeout(R,te)):ie(!1)};O(D=>[...D,{...n,text:""}]),setTimeout(R,te)}else O(u=>[...u,n])}V.current?.scrollIntoView({behavior:"smooth"})}},[c,s,b,b.length,ae]);const fe=i.useMemo(()=>"John!",[]),xe=i.useMemo(()=>Y(["Hi","Hey","Hello",Ce()]),[]),be=i.useMemo(()=>Y(["How can I help you today?","What can I do for you today?"]),[]),ge=(()=>{if(!z||z.length===0||b.length===0)return!1;const n=b[b.length-1];return n.sender==="bot"&&n.id.includes("-bot-followup")&&n.text&&c.length===b.length&&c[c.length-1].id===n.id&&c[c.length-1].text===n.text})();return e.jsxs("div",{className:"chat",children:[!L&&e.jsxs("div",{className:"chat-area",children:[e.jsx("div",{className:"chat-header"}),e.jsxs("div",{className:"chat-body",children:[!s&&e.jsx("div",{className:"chat-conversations",children:!s&&!L&&e.jsxs("div",{className:"chat-messages",children:[b.map((n,u)=>e.jsx(i.Fragment,{children:e.jsxs("div",{className:n.sender==="user"?"chat-user-msg":"chat-bot-msg",children:[n.text&&e.jsxs("div",{className:"message-content",children:[e.jsx("div",{className:"message-text",children:n.text}),n.timestamp&&(!n.id.includes("-bot-")||c.length>u&&b.length>u&&c[u].id===n.id&&c[u].text===n.text&&b[u].text===n.text)&&e.jsx("div",{className:"message-timestamp",children:J(new Date(n.timestamp))})]}),Z&&n.crediblemind&&Array.isArray(n.crediblemind)&&n.crediblemind.length>0&&(!n.id.includes("-bot-smalltalk")&&!n.id.includes("-bot-healthcontent-richinfo-with-text")||c.length>u&&b.length>u&&c[u].id===n.id&&c[u].text===n.text&&b[u].text===n.text)&&e.jsxs("div",{className:"crediblemind-cards",children:[e.jsx("div",{className:"cards-header",children:e.jsx("div",{className:"cards-title",children:"📚 Helpful Resources"})}),e.jsx(Ae,{items:n.crediblemind,onItemClick:q}),n.timestamp&&e.jsx("div",{className:"message-timestamp message-timestamp-cards",children:J(new Date(n.timestamp))})]}),Z&&n.providers&&Array.isArray(n.providers)&&n.providers.length>0&&(!n.id.includes("-bot-smalltalk")&&!n.id.includes("-bot-healthcontent-richinfo")&&!n.id.includes("-bot-healthcontent-richinfo-with-text")||c.length>u&&b.length>u&&c[u].id===n.id&&c[u].text===n.text&&b[u].text===n.text)&&e.jsxs("div",{className:"provider-cards",children:[e.jsx("div",{className:"cards-header",children:e.jsx("div",{className:"cards-title",children:"👩‍⚕️ Healthcare Providers"})}),e.jsx(De,{providers:n.providers,setIframeUrl:q}),n.timestamp&&e.jsx("div",{className:"message-timestamp message-timestamp-cards",children:J(new Date(n.timestamp))})]})]})},n.id+"-"+u)),ge&&e.jsx("div",{className:"chat-suggestion-options",children:e.jsx("div",{className:"followup-suggestion-chips",children:z.map(n=>e.jsx("button",{className:"followup-suggestion-chip",tabIndex:0,onClick:()=>W(n),children:n},n))})}),x&&e.jsxs("div",{className:"chat-bot-msg loading",children:[e.jsx("span",{className:"loader-dot",children:"•"}),e.jsx("span",{className:"loader-dot",children:"•"}),e.jsx("span",{className:"loader-dot",children:"•"})]}),e.jsx("div",{ref:V})]})}),s&&e.jsxs("div",{className:"chat-greeting-chips",children:[e.jsxs("div",{className:"chat-greeting",children:[e.jsxs("div",{className:"greeting-main",children:[xe,",",e.jsx("span",{className:"greeting-name",children:fe})]}),e.jsx("div",{className:"greeting-sub",children:be})]}),e.jsx("div",{className:"chat-suggestion-chips chat-main-chips",children:e.jsx("div",{className:"suggestion-chips",children:w.map((n,u)=>e.jsx("button",{className:`suggestion-chip${I===u?" selected":""}`,tabIndex:0,onClick:()=>g&&g(u),children:n},n))})})]})]}),e.jsx("div",{className:"chat-footer",children:e.jsxs("div",{className:"chat-actions",children:[e.jsxs("div",{className:"chat-input-row",children:[e.jsx("input",{className:"chat-input",type:"text",placeholder:"Ask anything",value:p,onChange:n=>v(n.target.value),onKeyDown:n=>{n.key==="Enter"&&W()},disabled:x,"aria-label":"Type your message"}),e.jsx("button",{className:"chat-mic-btn","aria-label":"Voice input",onClick:()=>{r(!0),h(!1)},disabled:x||s&&!d,children:e.jsx(S.IoMic,{className:"chat-footer-icon"})}),e.jsx("button",{className:"chat-send-btn",onClick:()=>W(),disabled:x||!p.trim()&&s&&!d,"aria-label":"Send message",children:e.jsx(S.IoArrowUp,{className:"chat-footer-icon"})})]}),y&&e.jsx("div",{className:"chat-popup-overlay",tabIndex:-1,"aria-modal":"true",role:"dialog",children:e.jsxs("div",{className:"chat-popup-modal",children:[e.jsx("button",{className:"chat-popup-close",onClick:()=>{r(!1),typeof window.onChatBack=="function"&&window.onChatBack()},"aria-label":"Close",children:"×"}),e.jsx("div",{className:"chat-popup-icon animate-mic",children:e.jsx(S.IoMic,{size:36,color:he})}),e.jsx("div",{className:"chat-popup-title",children:"Listening..."}),e.jsx("div",{className:"chat-popup-desc",children:"Speak your query and we'll convert it to text. (Animation here)"})]})}),t&&e.jsx("div",{className:"chat-popup-overlay",tabIndex:-1,"aria-modal":"true",role:"dialog",children:e.jsxs("div",{className:"chat-popup-modal",children:[e.jsx("button",{className:"chat-popup-close",onClick:()=>{h(!1),typeof window.onChatBack=="function"&&window.onChatBack()},"aria-label":"Close",children:"×"}),e.jsx("div",{className:"chat-popup-icon animate-attachment",children:e.jsx(S.IoAttach,{size:36,color:he})}),e.jsx("div",{className:"chat-popup-title",children:"Upload a file or image"}),e.jsx("input",{type:"file",className:"chat-popup-file"}),e.jsx("div",{className:"chat-popup-desc",children:"Choose a file or image to upload. (Animation here)"})]})})]})})]}),e.jsx("div",{className:"chat-ext-links-iframe",children:L&&e.jsx("div",{className:"iframe-modal-overlay",children:e.jsxs("div",{className:"iframe-modal",children:[e.jsx("button",{className:"iframe-modal-close",onClick:()=>{q(null),typeof window.onChatBack=="function"&&window.onChatBack()},children:e.jsx(S.IoClose,{})}),e.jsx("iframe",{src:L,title:"External Content",style:{width:"100%",height:"100vh",border:"none"}})]})})})]})};function Ae({items:s,onItemClick:a}){const[d,l]=i.useState(0),[w,I]=i.useState(window.innerWidth<=768),g=i.useRef(null);i.useEffect(()=>{const o=()=>I(window.innerWidth<=768);return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]);const c=(()=>{if(w)return 1;const o=window.innerWidth*.8,h=Math.floor(o/288);return Math.min(h,s.length)})(),f=w?s.length:c>=s.length?1:Math.ceil(s.length/c),p=o=>l(Math.min(o,f-1)),v=i.useRef(0),x=o=>{const t=v.current-o;Math.abs(t)>50&&(t>0&&d<f-1?l(h=>h+1):t<0&&d>0&&l(h=>h-1))};return e.jsxs("div",{className:"cards-carousel",children:[e.jsx("div",{className:"carousel-container",ref:g,onTouchStart:o=>v.current=o.touches[0].clientX,onTouchEnd:o=>x(o.changedTouches[0].clientX),onMouseDown:o=>v.current=o.clientX,onMouseUp:o=>x(o.clientX),children:e.jsx("div",{className:"carousel-track",style:{transform:`translateX(-${d*(w?100:c>=s.length?0:100/c)}%)`},children:s.map(o=>{const t=o.content_type==="Video";return e.jsx("div",{className:"carousel-item",children:e.jsxs("a",{href:o.content_url,className:"crediblemind-card",onClick:h=>{h.preventDefault(),a(o.content_url)},children:[e.jsxs("div",{className:"card-image",children:[e.jsx("img",{src:`${o.image_url}`,alt:""}),e.jsx("div",{className:"card-type-badge",children:o.content_type})]}),e.jsxs("div",{className:`card-content card-content-${o.content_type.toLowerCase()}`,children:[e.jsx("h4",{className:"card-title",children:o.title}),e.jsx("div",{className:"card-action",children:e.jsxs("span",{className:"action-text",children:[t?"Watch":"Read"," →"]})})]})]})},o.entry_id)})})}),f>1&&e.jsx("div",{className:"carousel-indicators",children:Array.from({length:f},(o,t)=>e.jsx("button",{className:`carousel-indicator ${t===d?"active":""}`,onClick:()=>p(t)},t))})]})}function De({providers:s,setIframeUrl:a}){const[d,l]=i.useState(0),[w,I]=i.useState(window.innerWidth<=768),[g,N]=i.useState(1),c=i.useRef(null),f=i.useCallback(()=>{if(window.innerWidth<=768)return 1;const t=window.innerWidth*.8,y=Math.floor(t/312);return Math.max(1,Math.min(y,s.length))},[s.length]);i.useEffect(()=>{const t=()=>{I(window.innerWidth<=768),N(f())};return N(f()),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[f]),i.useEffect(()=>{const t=()=>{if(c.current){const y=c.current.querySelectorAll(".provider-card");y.forEach(_=>_.style.height="auto");const r=Math.max(...Array.from(y).map(_=>_.scrollHeight));y.forEach(_=>_.style.height=`${r}px`)}},h=setTimeout(t,100);return window.addEventListener("resize",t),()=>{clearTimeout(h),window.removeEventListener("resize",t)}},[s]);const p=w?s.length:g>=s.length?1:Math.ceil(s.length/g),v=t=>l(Math.min(t,p-1)),x=i.useRef(0),o=t=>{const h=x.current-t;Math.abs(h)>50&&(h>0&&d<p-1?l(y=>y+1):h<0&&d>0&&l(y=>y-1))};return e.jsxs("div",{className:"provider-carousel",children:[e.jsx("div",{className:"carousel-container",ref:c,onTouchStart:t=>x.current=t.touches[0].clientX,onTouchEnd:t=>o(t.changedTouches[0].clientX),onMouseDown:t=>x.current=t.clientX,onMouseUp:t=>o(t.clientX),children:e.jsx("div",{className:"carousel-track",style:{transform:`translateX(-${d*(w?100:g>=s.length?0:100/g)}%)`},children:s.map((t,h)=>{const y=`${t.name.firstName?.[0]||""}${t.name.lastName?.[0]||""}`.toUpperCase();return e.jsx("div",{className:"carousel-item",children:e.jsxs("div",{className:"provider-card",children:[e.jsxs("div",{className:"provider-header-horizontal",children:[e.jsx("span",{className:"provider-logo-circle fixed-width-span",children:y}),e.jsxs("span",{className:"provider-name",children:[t.name.firstName," ",t.name.lastName]}),e.jsx("span",{className:"provider-title right-align",children:t.title})]}),e.jsxs("div",{className:"provider-details",children:[e.jsxs("div",{className:"provider-address",children:[e.jsxs("span",{className:"provider-icon address-icon",children:[e.jsx(S.IoLocationSharp,{})," "]}),e.jsxs("span",{className:"provider-link",onClick:()=>{const r=`${t.contact.address.addr1}, ${t.contact.address.city}, ${t.contact.address.state} ${t.contact.address.zip}`;window.open(`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(r)}`,"_blank")},children:[t.contact.address.addr1,", ",t.contact.address.city,", ",t.contact.address.state," ",t.contact.address.zip]})]}),e.jsxs("div",{className:"provider-contact",children:[t.contact.phone&&t.contact.phone!=="Not Available"&&e.jsxs("span",{children:[e.jsx(S.IoCall,{className:"provider-icon"}),e.jsx("a",{href:`tel:${t.contact.phone}`,target:"_blank",rel:"noopener noreferrer",className:"provider-link",children:_e(t.contact.phone)})]}),t.contact.officeEmail&&t.contact.officeEmail!=="Not Available"&&e.jsxs("span",{children:[e.jsx(S.IoMail,{className:"provider-icon"}),e.jsx("a",{href:`mailto:${t.contact.officeEmail}`,className:"provider-link-blank",children:t.contact.officeEmail})]}),t.contact.website&&t.contact.website!=="Not Available"&&(t.contact.website.startsWith("/")?e.jsx(Te,{to:t.contact.website,className:"provider-link-blank",children:t.contact.website}):e.jsxs("span",{children:[e.jsx(S.IoGlobe,{className:"provider-icon"}),e.jsx("a",{href:t.contact.website.startsWith("http")?t.contact.website:`https://${t.contact.website}`,className:"provider-link-blank",onClick:r=>{r.preventDefault(),a(t.contact.website.startsWith("http")?t.contact.website:`https://${t.contact.website}`)},children:t.contact.website})]}))]}),t.languages&&t.languages.length>0&&e.jsxs("div",{className:"provider-languages",children:[e.jsx("span",{className:"provider-icon",children:e.jsx(S.IoLanguage,{})}),t.languages.map(r=>ue(r)).join(", ")]}),t.yellowLabels&&t.yellowLabels.length>0&&e.jsx("div",{className:"provider-labels",children:t.yellowLabels.filter(r=>!r.notAvailable).map(r=>r.icon==="accepting-new-patients"?e.jsx(A,{icon:e.jsx(S.IoPersonAdd,{className:"provider-label-icon"}),tooltip:r.label||"Accepting new patients"},r.icon):r.icon==="public-transportation"?e.jsx(A,{icon:e.jsx(S.IoBus,{className:"provider-label-icon"}),tooltip:r.label||"Public transportation available"},r.icon):r.icon==="wheelchair-accessible"?e.jsx(A,{icon:e.jsx(S.IoAccessibility,{className:"provider-label-icon"}),tooltip:r.label||"Wheelchair accessible"},r.icon):r.icon==="telehealth-provider"?e.jsx(A,{icon:e.jsx(S.IoVideocam,{className:"provider-label-icon"}),tooltip:r.label||"Telehealth provider"},r.icon):r.icon==="medicaid-provider"?e.jsx(A,{icon:e.jsx(S.IoMedkit,{className:"provider-label-icon"}),tooltip:r.label||"Medicaid provider"},r.icon):e.jsx(A,{icon:null,tooltip:r.label||r.icon,children:r.label||r.icon},r.icon))})]}),t.onlineAppointmentScheduleFlag==1&&e.jsx("button",{className:"provider-request-appt-btn",onClick:()=>{},children:" Request an appointment"})]})},(t.providerId?t.providerId:`${t.name.firstName}-${t.name.lastName}`)+"-"+h)})})}),p>1&&e.jsx("div",{className:"carousel-indicators",children:Array.from({length:p},(t,h)=>e.jsx("button",{className:`carousel-indicator ${h===d?"active":""}`,onClick:()=>v(h)},h))})]})}function A({icon:s,tooltip:a,children:d}){const[l,w]=i.useState(!1);let I;const g=()=>{w(!0),clearTimeout(I),I=setTimeout(()=>w(!1),5e3)},N=()=>{w(!1),clearTimeout(I)};return e.jsxs("span",{className:"provider-label",onClick:g,onMouseEnter:g,onMouseLeave:N,children:[s,d,l&&e.jsx("span",{className:"provider-label-tooltip",children:ue(a)})]})}function Pe({product:s="eap",client:a="bcbsnc",channel:d="mobile",isLoggedIn:l=!1,token:w="",user:I={},config:g={}}){const c=Y(["I feel stressed","Tips for anxiety","My benefits","Work-life balance advice","Mindfulness techniques","Dealing with burnout","Healthy habits","Managing emotions","Productivity tips","Positive thinking","Social support","Self care routines","Goal setting","Time management","Sleep hygiene","Stress relief","Mental wellness","Emotional balance","Find providers near me","Find counselors near me","Find therapists near me"],4),[f,p]=i.useState(null),[v,x]=i.useState(!1),[o,t]=i.useState(null),h=i.useRef(null),y=()=>{h.current&&(x(h.current.chatStarted),p(h.current.selectedChipIdx),t(h.current.chipToSend))};i.useEffect(()=>(window.onChatBack=y,()=>{window.onChatBack=void 0}),[]);const r=b=>{p(b),t(c[b]),x(!0)},_=()=>{p(null),t(null)},U=()=>x(!0);return e.jsxs("div",{className:"mind-link-ai-widget theme-light app-root",children:[e.jsx("div",{className:"app-body",children:e.jsx(Me,{showGreeting:!v,onStartChat:U,chipToSend:o,onChipSent:_,chips:c,selectedChipIdx:f,handleChipClick:r,user:I,product:s,client:a,channel:d,isLoggedIn:l,token:w,config:g})}),e.jsx("footer",{className:"app-footer"})]})}module.exports=Pe;