@snf/access-qa-bot 3.3.13 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -37,12 +37,12 @@ var AccessQABot=function(Un){"use strict";var hn,V,$o,Mt,Jo,Zo,ei,ti,wr,xr,Er,ni
|
|
|
37
37
|
}
|
|
38
38
|
`),L.createElement("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"qa-bot-login-button ".concat(o?"qa-bot-header-login-button":""," ").concat(n),style:Object.assign(Object.assign({},s),r),onClick:()=>{i({type:"chatbot_login_clicked",loginUrl:t})}},"Log In"))},rp=()=>L.createElement("div",{className:"user-login-icon",style:{alignItems:"center",justifyContent:"center",width:"30px",height:"30px",borderRadius:"50%",backgroundColor:"var(--primaryColor, #1a5b6e)",marginRight:"5px",display:"flex"},role:"img","aria-label":"User logged in",title:"User logged in"},L.createElement("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false"},L.createElement("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),L.createElement("circle",{cx:"12",cy:"7",r:"4"}))),Oe=[];for(let e=0;e<256;++e)Oe.push((e+256).toString(16).slice(1));let Lo;const op=new Uint8Array(16);var cA={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function uA(e,t,n){var o;if(cA.randomUUID&&!e)return cA.randomUUID();const r=(e=e||{}).random??((o=e.rng)==null?void 0:o.call(e))??function(){if(!Lo){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Lo=crypto.getRandomValues.bind(crypto)}return Lo(op)}();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=15&r[6]|64,r[8]=63&r[8]|128,function(i,s=0){return(Oe[i[s+0]]+Oe[i[s+1]]+Oe[i[s+2]]+Oe[i[s+3]]+"-"+Oe[i[s+4]]+Oe[i[s+5]]+"-"+Oe[i[s+6]]+Oe[i[s+7]]+"-"+Oe[i[s+8]]+Oe[i[s+9]]+"-"+Oe[i[s+10]]+Oe[i[s+11]]+Oe[i[s+12]]+Oe[i[s+13]]+Oe[i[s+14]]+Oe[i[s+15]]).toLowerCase()}(r)}function Ft(){return typeof localStorage<"u"&&localStorage.getItem("QA_BOT_DEBUG")==="true"}const ip="background: #1a5b6e; color: white; padding: 2px 6px; border-radius: 3px;",ap="background: #7c3aed; color: white; padding: 2px 6px; border-radius: 3px;",sp="background: #059669; color: white; padding: 2px 6px; border-radius: 3px;",Ap="background: #f97316; color: white; padding: 2px 6px; border-radius: 3px;",lp="background: #f59e0b; color: #000; padding: 2px 6px; border-radius: 3px 0 0 3px; font-weight: bold;",cp="background: #fbbf24; color: #000; padding: 2px 6px; border-radius: 0 3px 3px 0;",up=()=>{Ft()&&console.log("%c QA Bot Core %c v".concat("0.2.31"," "),lp,cp)},dr=function(e){if(Ft()){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];console.log("%c[Session]%c ".concat(e),ip,"",...n)}},bt=function(e){if(Ft()){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];console.log("%c[History]%c ".concat(e),ap,"",...n)}},dp=(e,t)=>{Ft()&&console.log("%c[Message]%c ".concat(e),sp,"",t)},pr=function(e){if(Ft()){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];console.log("%c[Turnstile]%c ".concat(e),Ap,"",...n)}},Ro=function(){console.warn(...arguments)},Ne=function(){console.error(...arguments)},dA="qa_bot_session_messages",pA=()=>"qa_bot_session_".concat(uA()),Mn=()=>{try{const e=localStorage.getItem(dA);return e?JSON.parse(e):{}}catch{return{}}},pp=(e,t,n,r,o)=>{const i=Mn();if(!i[e]&&(i[e]={messages:[],startedAt:new Date().toISOString(),preview:""},bt("NEW session created",{sessionId:e.slice(-12)})),i[e].messages.some(l=>l.id===t))return void bt("DUPLICATE message skipped",{sessionId:e.slice(-12),messageId:t.slice(-8),sender:r});const s={id:t,content:n,sender:r,type:o,timestamp:Date.now()};i[e].messages.push(s),bt("MESSAGE added",{sessionId:e.slice(-12),messageId:t.slice(-8),sender:r,totalInSession:i[e].messages.length});const A=i[e].messages,a=A.find(l=>{var c;return l.sender.toLowerCase()==="bot"&&((c=l.content)===null||c===void 0?void 0:c.trim())&&l.content.length>=100});if(a){const l=a.content;i[e].preview=l.slice(0,50)+(l.length>50?"...":"")}else{const l=A.find(c=>{var u;return c.sender.toLowerCase()==="user"&&((u=c.content)===null||u===void 0?void 0:u.trim())});if(l&&!i[e].preview){const c=l.content;i[e].preview=c.slice(0,50)+(c.length>50?"...":"")}}(l=>{var c;const u=()=>Object.values(l).reduce((d,p)=>d+p.messages.length,0);for(;u()>100&&Object.keys(l).length>1;){const d=(c=Object.entries(l).sort((p,h)=>{let[,y]=p,[,f]=h;return new Date(y.startedAt).getTime()-new Date(f.startedAt).getTime()})[0])===null||c===void 0?void 0:c[0];if(!d)break;delete l[d]}localStorage.setItem(dA,JSON.stringify(l))})(i),bt("STORAGE state",{ourSessions:Object.keys(i).length,ourTotalMessages:Object.values(i).reduce((l,c)=>l+c.messages.length,0)})},fA=e=>{var t,n;return(n=(t=Mn()[e])===null||t===void 0?void 0:t.messages.length)!==null&&n!==void 0?n:0},fp=e=>{const t=Mn()[e];return t!=null&&t.startedAt?Date.now()-new Date(t.startedAt).getTime():0},hA=lt(void 0),hp=e=>{let{children:t,getSessionId:n,setSessionId:r,resetSession:o,clearResettingFlag:i}=e;return L.createElement(hA.Provider,{value:{getSessionId:n,setSessionId:r,resetSession:o,clearResettingFlag:i}},t)},Ho=()=>{const e=nt(hA);if(!e)throw new Error("useSession must be used within a SessionProvider");return e},gp=()=>{const[e,t]=Z(!1),[n,r]=Z([]),[o,i]=Z(null),[s,A]=Z(0),a=ie(null),l=ie(null),{replaceMessages:c}=Pn(),{toggleTextAreaDisabled:u}=Na(),{setSessionId:d,getSessionId:p}=Ho();$(()=>{var y,f;const b=g=>{a.current&&!a.current.contains(g.target)&&l.current&&!l.current.contains(g.target)&&t(!1)},v=(f=(y=a.current)===null||y===void 0?void 0:y.getRootNode())!==null&&f!==void 0?f:document;return e&&v.addEventListener("mousedown",b),()=>{v.removeEventListener("mousedown",b)}},[e]);const h=y=>{var f;const b=p();if(bt("RESTORE requested",{targetSession:y.slice(-12),currentSession:b==null?void 0:b.slice(-12)}),y===b)return bt("RESTORE skipped - already on this session"),void t(!1);const v=(k=>{var E;return((E=Mn()[k])===null||E===void 0?void 0:E.messages)||[]})(y).filter(k=>{var E;return(E=k.content)===null||E===void 0?void 0:E.trim()});bt("Stored messages from our localStorage",{count:v.length,ids:v.map(k=>k.id.slice(-8))});const g=v.map(k=>({id:k.id,content:k.content,sender:k.sender.toUpperCase(),type:k.type||"string",timestamp:new Date(k.timestamp).toISOString()}));var x;d(y),bt("Session ID updated",{newSession:y.slice(-12)}),c(g),bt("replaceMessages called",{count:g.length}),x=(f=l.current)===null||f===void 0?void 0:f.getRootNode(),setTimeout(()=>{const k=(x||document).querySelector(".rcb-chat-body-container");k&&k.querySelectorAll(".rcb-bot-message").forEach(E=>{var P;let D=E.innerHTML,Q=!1;D.includes("](")&&(D=D.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'),Q=!0),D.includes("<a href=")&&(D=D.replace(/<a\s+href=["']([^"']+)["'][^&]*>([^&]+)<\/a>/gi,'<a href="$1" target="_blank" rel="noopener noreferrer">$2</a>'),Q=!0),(D.includes("<a ")||!((P=E.textContent)===null||P===void 0)&&P.includes("<a href="))&&(E.textContent||"").includes("<a href=")&&(D=D.replace(/<a\s+href="([^"]+)"[^&]*>([^&]+)<\/a>/gi,'<a href="$1" target="_blank" rel="noopener noreferrer">$2</a>'),Q=!0),Q&&(E.innerHTML=D)})},50),u(!1),bt("Chat input enabled after restore"),t(!1)};return L.createElement("div",{style:{position:"relative"}},L.createElement("button",{ref:l,className:"history-button",onClick:()=>{if(!e&&(r((()=>{const y=Mn();return Object.entries(y).map(f=>{let[b,v]=f;return Object.assign({sessionId:b},v)}).sort((f,b)=>new Date(b.startedAt).getTime()-new Date(f.startedAt).getTime())})()),l.current)){const y=l.current.closest(".rcb-chat-window");if(y){const f=y.getBoundingClientRect(),b=l.current.getBoundingClientRect();i(f.width+3),A(f.right-b.right-18+4)}}t(!e)},style:{alignItems:"center",justifyContent:"center",width:"30px",height:"30px",borderRadius:"50%",backgroundColor:"var(--primaryColor, #1a5b6e)",marginRight:"18px",display:"flex",border:"none",cursor:"pointer",padding:0},"aria-label":"View chat history",title:"View chat history","aria-expanded":e,"aria-haspopup":"menu"},L.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false"},L.createElement("circle",{cx:"12",cy:"12",r:"10"}),L.createElement("polyline",{points:"12 6 12 12 16 14"}))),e&&L.createElement("div",{ref:a,role:"menu",style:{position:"absolute",right:s?"-".concat(s,"px"):"-18px",top:"100%",marginTop:"8px",width:o?"".concat(o,"px"):"550px",backgroundColor:"white",borderRadius:0,borderBottom:"3px solid var(--primaryColor, #1a5b6e)",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)",maxHeight:"250px",overflowY:"auto",zIndex:1e3}},n.length===0?L.createElement("div",{style:{padding:"12px 16px",color:"#666",fontSize:"14px",textAlign:"center"}},"No chat history"):n.map(y=>L.createElement("button",{key:y.sessionId,role:"menuitem",onClick:()=>h(y.sessionId),style:{width:"100%",padding:"10px 14px",border:"none",backgroundColor:"transparent",cursor:"pointer",textAlign:"left",display:"flex",flexDirection:"column",gap:"2px",borderBottom:"1px solid #eee"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="#f5f5f5"},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent"}},L.createElement("span",{style:{fontSize:"14px",color:"#333",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},y.preview||"New conversation"),L.createElement("span",{style:{fontSize:"12px",color:"#888"}},(f=>{const b=new Date(f),v=new Date().getTime()-b.getTime(),g=Math.floor(v/864e5);return g===0?b.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):g===1?"Yesterday":g<7?b.toLocaleDateString([],{weekday:"short"}):b.toLocaleDateString([],{month:"short",day:"numeric"})})(y.startedAt))))))};function Uo(){return Uo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Uo.apply(null,arguments)}const gA=({width:e=24,height:t=24,color:n="currentColor",children:r,...o})=>L.createElement("svg",Uo({xmlns:"http://www.w3.org/2000/svg",width:e,height:t,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false"},o),r),mp=e=>L.createElement(gA,e,L.createElement("path",{d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})),yp=()=>{const{restartFlow:e}=tr(),{setTextAreaValue:t}=Na(),{messages:n}=Pn(),{getSessionId:r,resetSession:o,clearResettingFlag:i}=Ho(),{trackEvent:s}=AA();return L.createElement("button",{onClick:async()=>{const A=r(),a=A?fA(A):0;s({type:"chatbot_new_chat",previousMessageCount:a}),o(),await t(""),await e(),setTimeout(()=>{i()},100)},tabIndex:0,"aria-label":"New chat conversation",style:{backgroundColor:"var(--primaryColor, #107180)",border:"none",color:"#ffffff",fontSize:"14px",cursor:"pointer",padding:"8px 12px",borderRadius:"4px",transition:"all 0.2s ease",display:"flex",alignItems:"center",gap:"6px",fontWeight:"500"},onMouseEnter:A=>{A.target.style.backgroundColor="var(--secondaryColor, #0d5f6b)"},onMouseLeave:A=>{A.target.style.backgroundColor="var(--primaryColor, #107180)"}},L.createElement(mp,{width:16,height:16}),"New Chat")};function Fo(e){if(typeof e=="string")return e;if(typeof e=="number")return String(e);if(!e)return"";if(Array.isArray(e))return e.map(Fo).join("");if(typeof e=="object"&&e!==null&&"props"in e){const t=e.props;if(t&&"children"in t)return Fo(t.children)}return""}const vp=()=>{const{getSessionId:e}=Ho(),t=K(n=>{var r;const o=(r=n.data)===null||r===void 0?void 0:r.message;if(!(o!=null&&o.id))return;const i=o.sender,s=o.type||"string";let A;if(A=typeof o.content=="string"?o.content:Fo(o.content),dp("TRACKED",{id:o.id,sender:i,content:A.substring(0,50)+(A.length>50?"...":"")}),A.includes("rcb-options-container")||!A.trim())return;const a=e();pp(a,o.id,A,i,s)},[e]);return $(()=>(window.addEventListener("rcb-pre-inject-message",t),()=>{window.removeEventListener("rcb-pre-inject-message",t)}),[t]),null},bp=()=>($(()=>{const e=i=>{if(!["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Enter"," ","Home","End"].includes(i.key))return;const s=document.activeElement;if(s&&(s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.contentEditable==="true"||s.classList.contains("rcb-chat-input-textarea")))return;const A=document.querySelector(".rcb-chat-window");if(!A)return;const a=Array.from(A.querySelectorAll(".rcb-message-container, .rcb-bot-message-container, .rcb-user-message-container")).filter(u=>u.offsetParent!==null);if(a.length>0){const u=a[a.length-1].querySelector(".rcb-checkbox-container");if(u&&u.offsetParent!==null){const d=Array.from(u.querySelectorAll(".rcb-checkbox-row-container")),p=u.querySelector(".rcb-checkbox-next-button");if(d.length>0){const h=[...d];return p&&h.push(p),void((y,f)=>{y.preventDefault();let b=-1;for(let g=0;g<f.length;g++)if(f[g]===document.activeElement||f[g].contains(document.activeElement)){b=g;break}b===-1&&(b=0);let v=b;switch(y.key){case"ArrowDown":case"ArrowRight":v=b<f.length-1?b+1:0;break;case"ArrowUp":case"ArrowLeft":v=b>0?b-1:f.length-1;break;case"Home":v=0;break;case"End":v=f.length-1;break;case"Enter":case" ":{const g=f[b],x=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window});return void g.dispatchEvent(x)}default:return}f[v].focus(),f[v].setAttribute("tabindex","0"),f[v].classList.add("keyboard-focused"),f.forEach((g,x)=>{x!==v&&(g.setAttribute("tabindex","-1"),g.classList.remove("keyboard-focused"))})})(i,h)}}}let l=[];if(a.length>0){const u=a[a.length-1],d=Array.from(u.querySelectorAll(".rcb-options-container")).filter(p=>p.offsetParent!==null);if(d.length>0){const p=d[d.length-1];l=Array.from(p.querySelectorAll(".rcb-options"))}}if(l.length===0)return;const c=l.findIndex(u=>u===document.activeElement);switch(i.key){case"ArrowDown":case"ArrowRight":{let u;i.preventDefault(),u=c<l.length-1?c+1:0,l[u].setAttribute("tabindex","0"),l.forEach((d,p)=>{p!==u&&(d.setAttribute("tabindex","-1"),d.classList.remove("keyboard-focused"))}),l[u].classList.add("keyboard-focused"),l[u].focus();break}case"ArrowUp":case"ArrowLeft":{let u;i.preventDefault(),u=c>0?c-1:l.length-1,l[u].setAttribute("tabindex","0"),l.forEach((d,p)=>{p!==u&&(d.setAttribute("tabindex","-1"),d.classList.remove("keyboard-focused"))}),l[u].classList.add("keyboard-focused"),l[u].focus();break}case"Enter":case" ":if(i.preventDefault(),document.activeElement&&l.includes(document.activeElement)){const u=document.activeElement;if(u.classList.contains("rcb-checkbox-row-container")||u.closest(".rcb-checkbox-row-container")){const d=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window});u.dispatchEvent(d);const p=u.querySelector(".rcb-checkbox-label"),h=p?p.textContent:u.textContent||"checkbox",y=u.querySelector(".rcb-checkbox-mark"),f=y&&y.style.backgroundColor?"checked":"unchecked";t(`${h} ${f}`)}else{const d=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window});u.dispatchEvent(d);const p=u.textContent||u.innerText;t(`Selected: ${p}`)}}break;case"Home":i.preventDefault(),l.length>0&&(l[0].setAttribute("tabindex","0"),l.forEach((u,d)=>{d!==0&&(u.setAttribute("tabindex","-1"),u.classList.remove("keyboard-focused"))}),l[0].classList.add("keyboard-focused"),l[0].focus());break;case"End":if(i.preventDefault(),l.length>0){const u=l.length-1;l[u].setAttribute("tabindex","0"),l.forEach((d,p)=>{p!==u&&(d.setAttribute("tabindex","-1"),d.classList.remove("keyboard-focused"))}),l[u].classList.add("keyboard-focused"),l[u].focus()}}},t=i=>{const s=document.createElement("div");s.setAttribute("aria-live","assertive"),s.setAttribute("aria-atomic","true"),s.className="sr-only",s.textContent=i,document.body.appendChild(s),setTimeout(()=>{document.body.contains(s)&&document.body.removeChild(s)},1e3)},n=(i=null)=>{let s=i;if(s||(s=document.querySelector(".rcb-chat-window"),s||(s=document.querySelector('[class*="rcb-chat"]')),s||(s=document.querySelector(".qa-bot"))),!s)return;const A=s.closest(".embedded-qa-bot")!==null,a=Array.from(s.querySelectorAll(".rcb-message-container, .rcb-bot-message-container, .rcb-user-message-container")).filter(d=>d.offsetParent!==null);if(a.length===0)return;const l=a[a.length-1],c=Array.from(l.querySelectorAll(".rcb-options-container")).filter(d=>d.offsetParent!==null);let u=[];if(c.length>0){const d=c[c.length-1];u=Array.from(d.querySelectorAll(".rcb-options"))}if(u.length===0){let d=l.querySelector(".rcb-checkbox-container");if(!d&&s&&(d=s.querySelector(".rcb-checkbox-container")),d&&d.offsetParent!==null){const p=Array.from(d.querySelectorAll(".rcb-checkbox-row-container")).filter(h=>h.offsetParent!==null&&h.style.display!=="none");if(p.length>0){const h=d.querySelector(".rcb-checkbox-next-button"),y=[...p];if(h&&h.offsetParent!==null&&y.push(h),y.forEach((f,b)=>{f.setAttribute("tabindex",b===0?"0":"-1"),b===0?f.classList.add("keyboard-focused"):f.classList.remove("keyboard-focused")}),p.length>1){d.querySelectorAll(".keyboard-nav-hint").forEach(b=>b.remove());const f=document.createElement("div");f.className="keyboard-nav-hint",f.textContent="Use arrow keys ↕ to navigate, Enter to select/deselect, or click any option",f.style.cssText="font-size: 12px !important; color: #666 !important; margin-bottom: 8px !important; font-style: italic !important; display: block !important;",d.insertBefore(f,d.firstChild)}return void setTimeout(()=>{y[0]&&y[0].offsetParent!==null&&!A&&y[0].focus()},150)}}}if(u.length>0){if(u.forEach((d,p)=>{const h=p===0?"0":"-1";d.setAttribute("tabindex",h),d.setAttribute("role","option"),d.setAttribute("aria-posinset",p+1),d.setAttribute("aria-setsize",u.length),p===0?d.classList.add("keyboard-focused"):d.classList.remove("keyboard-focused")}),u.length>1){const d=c.length>0?c[c.length-1]:null;if(d){d.querySelectorAll(".keyboard-nav-hint").forEach(h=>h.remove());const p=document.createElement("div");p.className="keyboard-nav-hint",p.textContent="Use arrow keys ↕ to navigate, Enter to select, or click any option",p.style.cssText="font-size: 12px !important; color: #666 !important; margin-bottom: 8px !important; font-style: italic !important; display: block !important;",d.insertBefore(p,d.firstChild)}}else{const d=c.length>0?c[c.length-1]:null;d&&d.querySelectorAll(".keyboard-nav-hint").forEach(p=>p.remove())}setTimeout(()=>{u[0]&&u[0].offsetParent!==null&&!A&&(u[0].focus(),u.length>1&&t(`${u.length} options available. Use arrow keys to navigate.`))},200)}},r=new MutationObserver(i=>{i.forEach(s=>{var A,a;if(s.type==="childList"){const l=Array.from(s.addedNodes),c=l.some(d=>{var p,h,y,f;return d.nodeType===Node.ELEMENT_NODE&&(((p=d.classList)==null?void 0:p.contains("rcb-options-container"))||((h=d.classList)==null?void 0:h.contains("rcb-options"))||((y=d.querySelector)==null?void 0:y.call(d,".rcb-options-container"))||((f=d.querySelector)==null?void 0:f.call(d,".rcb-options")))}),u=l.some(d=>{var p,h;return d.nodeType===Node.ELEMENT_NODE&&(((p=d.classList)==null?void 0:p.contains("rcb-checkbox-container"))||((h=d.querySelector)==null?void 0:h.call(d,".rcb-checkbox-container")))});if(c||u){let d=s.target;for(;d&&!((A=d.classList)!=null&&A.contains("qa-bot"))&&!((a=d.classList)!=null&&a.contains("rcb-chat-window"));)d=d.parentElement;(d||document).querySelectorAll(".rcb-options[tabindex], .rcb-checkbox-row-container[tabindex], .rcb-checkbox-next-button[tabindex]").forEach(p=>{p.setAttribute("tabindex","-1"),p.classList.remove("keyboard-focused")}),setTimeout(()=>n(d),100)}}})});r.observe(document.body,{childList:!0,subtree:!0}),document.addEventListener("keydown",e),n();const o=setInterval(()=>{document.querySelectorAll(".qa-bot").forEach(i=>{const s=i.querySelectorAll(".rcb-options-container .rcb-options").length>0,A=i.querySelectorAll(".rcb-checkbox-row-container").length>0;if(s){const a=i.querySelectorAll(".rcb-options[tabindex]").length;i.querySelectorAll(".rcb-options").length>a&&n(i)}if(A){const a=i.querySelectorAll(".rcb-checkbox-row-container[tabindex]").length;i.querySelectorAll(".rcb-checkbox-row-container").length>a&&n(i)}})},1e3);return()=>{document.removeEventListener("keydown",e),r.disconnect(),clearInterval(o)}},[]),null);let mA=!1,fr=null;function yA(){return mA?Promise.resolve():fr||(fr=new Promise((e,t)=>{const n=document.createElement("script");n.src="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit",n.async=!0,n.onload=()=>{mA=!0,pr("Script loaded"),e()},n.onerror=()=>{fr=null,t(new Error("Failed to load Turnstile script"))},document.head.appendChild(n)}),fr)}const On=e=>{if(!e||typeof e!="string")return e;let t=e.replace(/\[(https?:\/\/[^\s]+?)\]/gi,"[$1]($1)");return t=t.replace(new RegExp(`(?<!\\]\\(|href=["']|\\[)https?:\\/\\/[^\\s[\\]()]+`,"gi"),n=>{let r=n,o="";const i=r.match(/([.,;:!?]+)$/);return i&&(o=i[1],r=r.slice(0,-o.length)),"[".concat(r,"](").concat(r,")").concat(o)}),t},wp=e=>{let{siteKey:t,onVerify:n,onError:r}=e;const o=ie(null),i=ie(!1);return $(()=>{!i.current&&o.current&&(i.current=!0,yA().then(()=>{const s=window.turnstile;if(!s||!o.current)return Ne("Turnstile API not available after script load"),void(r==null||r());s.render(o.current,{sitekey:t,callback:A=>{pr("Visible challenge completed"),n(A)},"error-callback":()=>{Ne("Turnstile challenge failed"),r==null||r()},"expired-callback":()=>{Ne("Turnstile token expired"),r==null||r()}})}).catch(s=>{Ne("Failed to load Turnstile script:",s),r==null||r()}))},[t,n,r]),L.createElement("div",{style:{padding:"8px 16px"}},L.createElement("div",{ref:o,style:{borderRadius:"8px",overflow:"hidden"}}))};function vA(e){const{confidence:t,tools_used:n,metadata:r}=e;if(!(t||n&&n.length!==0))return"";const o=[];return t&&o.push("• Confidence: ".concat(t)),n&&n.length>0&&o.push("• Tools used: ".concat(n.join(", "))),r!=null&&r.agent&&o.push("• Agent: ".concat(r.agent)),`---
|
|
39
39
|
`.concat(o.join(`
|
|
40
|
-
`))}function xp(e){let{getState:t,onResubmit:n,trackEvent:r,loginUrl:o}=e;const[i,s]=L.useState(!1),A=t();return L.useEffect(()=>{if(!A.siteKey)return;s(!1);const a=setTimeout(()=>{A.token||(s(!0),r==null||r({type:"chatbot_turnstile_error"}))},5e3);return()=>clearTimeout(a)},[A.siteKey]),A.siteKey?i?L.createElement("div",{style:{padding:"8px 16px",fontSize:"14px",lineHeight:"1.5"}},L.createElement("p",{style:{margin:0}},"I'm having trouble verifying your session. Please try"," ",L.createElement("a",{href:"",onClick:a=>{a.preventDefault(),window.location.reload()},style:{color:"var(--primaryColor, #107180)"}},"refreshing the page"),", or"," ",L.createElement("a",{href:o,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--primaryColor, #107180)",fontWeight:"bold"}},"log in")," ","to continue.")):L.createElement(wp,{siteKey:A.siteKey,onVerify:a=>{A.token=a,r==null||r({type:"chatbot_turnstile_completed"}),n(a)},onError:()=>{Ro("Turnstile widget error (may auto-recover)")}}):null}const Ep="#1a5b6e",_p="#107180",kp="Arial, sans-serif",bA="Q&A Bot",Pp="/chat-icon.svg",Cp="Type your question here...",Sp="Select an option to continue",Dp=!1,Bp="Ask me a question!",wA="/login",Ip={general:{showHeader:!0,showFooter:!0},tooltip:{mode:"CLOSE"},chatInput:{disabled:!1,characterLimit:5e3,showCharacterCount:!1,allowNewline:!0,blockSpam:!1},chatWindow:{defaultOpen:!1,showScrollbar:!1},botBubble:{simulateStream:!0,streamSpeed:10,showAvatar:!1},userBubble:{showAvatar:!1},notification:{disabled:!0,showCount:!1},audio:{disabled:!0},emoji:{disabled:!0},fileAttachment:{disabled:!0}},zo=ze((e,t)=>{var n,r,o;const{apiKey:i,qaEndpoint:s,ratingEndpoint:A,capabilitiesEndpoint:a,agentRatingEndpoint:l,welcomeMessage:c,open:u,onOpenChange:d,isLoggedIn:p,allowAnonAccess:h=!1,actingUser:y,primaryColor:f,secondaryColor:b,botName:v,logo:g,placeholder:x,errorMessage:k,embedded:E,footerText:P,footerLink:D,tooltipText:Q,loginUrl:S,turnstileSiteKey:T,customFlow:C,onAnalyticsEvent:N}=e,U=ie("bot_".concat(Math.random().toString(36).substr(2,9)));$(()=>{up()},[]);const M=ie(null);M.current===null&&(M.current=pA(),dr("CREATED",M.current));const R=ie(!1),I=ie({getSessionId:()=>M.current,isResetting:()=>R.current}),O=function(F){const[Y,Ae]=Z(null),[oe,de]=Z("idle"),he=ie(null),ge=ie(null),Te=ie(!0),Je=K(()=>{const Me=window.turnstile;if(ge.current&&(Me!=null&&Me.remove)){try{Me.remove(ge.current)}catch{}ge.current=null}he.current&&(he.current.remove(),he.current=null)},[]);return $(()=>{if(Te.current=!0,!F)return de("idle"),void Ae(null);de("loading");const Me=document.createElement("div");return Me.style.position="fixed",Me.style.left="-9999px",Me.style.top="-9999px",Me.style.width="0",Me.style.height="0",Me.style.overflow="hidden",Me.setAttribute("aria-hidden","true"),document.body.appendChild(Me),he.current=Me,yA().then(()=>{if(!Te.current)return;const xt=window.turnstile;if(!xt||!he.current)return Ne("Turnstile API not available for silent verification"),void de("failed");const qt=xt.render(he.current,{sitekey:F,execution:"render","refresh-expired":"auto",callback:ke=>{Te.current&&(pr("Silent verification succeeded"),Ae(ke),de("verified"))},"error-callback":()=>{Te.current&&(Ne("Turnstile silent verification failed"),de("failed"))},"expired-callback":()=>{Te.current&&(pr("Token expired, awaiting refresh"),Ae(null),de("loading"))}});ge.current=qt}).catch(xt=>{Te.current&&(Ne("Failed to load Turnstile script for silent verification:",xt),de("failed"))}),()=>{Te.current=!1,Je()}},[F,Je]),{token:Y,status:oe}}(T),m=ie(null);m.current=O.token;const[z,w]=Z(p);$(()=>{w(p)},[p]);const G=E!==void 0?E:Dp,te=K(F=>{var Y;N&&N(Object.assign(Object.assign({},F),{timestamp:Date.now(),sessionId:(Y=M.current)!==null&&Y!==void 0?Y:void 0,pageUrl:typeof window<"u"?window.location.href:void 0,isEmbedded:G}))},[N,G]),ne=Se(()=>{const F=Object.assign({},Ip);F.general=Object.assign(Object.assign({},F.general),{primaryColor:f||Ep,secondaryColor:b||_p,fontFamily:kp,embedded:G});const Y=z===!1?[L.createElement(lA,{key:"login-button",loginUrl:S||wA,isHeaderButton:!0})]:[L.createElement(gp,{key:"history-button"}),L.createElement(rp,{key:"user-icon"})];F.header={title:L.createElement("span",{style:{fontSize:14,fontWeight:500}},v||bA),showAvatar:!0,avatar:g||Pp,buttons:[...Y,_e.CLOSE_CHAT_BUTTON]},F.chatInput=Object.assign(Object.assign({},F.chatInput),{disabled:!1,enabledPlaceholderText:x||Cp,disabledPlaceholderText:k||Sp}),F.tooltip=Object.assign(Object.assign({},F.tooltip),{text:Q||Bp});const Ae=P?D?L.createElement("a",{href:D,target:"_blank",rel:"noopener noreferrer",key:"footer-link"},P):L.createElement("span",{key:"footer-text"},P):null;return F.footer={text:Ae,buttons:[L.createElement(yp,{key:"new-chat-button"})]},F.chatWindow=Object.assign(Object.assign({},F.chatWindow),{defaultOpen:!!G}),F.event={rcbPreInjectMessage:!0,rcbPostInjectMessage:!0,rcbUserSubmitText:!0,rcbChangePath:!0,rcbToggleChatWindow:!0},F},[f,b,v,g,x,k,G,Q,z,S,P,D]),ue=ie(null),Ue=function(F){let Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Se(()=>{const Ae=(oe,de)=>{if(F.current){const he=getComputedStyle(F.current).getPropertyValue(oe);if(he&&he.trim()!=="")return he.trim();if(F.current.parentElement){const ge=getComputedStyle(F.current.parentElement).getPropertyValue(oe);if(ge&&ge.trim()!=="")return ge.trim()}}return de};return{primaryColor:Ae("--primaryColor",Y.primaryColor),secondaryColor:Ae("--secondaryColor",Y.secondaryColor),fontFamily:Ae("--fontFamily",Y.fontFamily)}},[F,Y])}(ue,ne.general);((F,Y)=>{$(()=>{Y.current&&(F?Y.current.classList.add("bot-logged-in"):Y.current.classList.remove("bot-logged-in"))},[F,Y])})(z!==!1,ue),(F=>{let{settings:Y,themeColors:Ae}=F;$(()=>{Ae&&(Object.entries(Ae).forEach(oe=>{let[de,he]=oe;he&&document.documentElement.style.setProperty("--".concat(de),he)}),Ae.primaryColor&&document.documentElement.style.setProperty("--rcb-header-background",Ae.primaryColor),Ae.secondaryColor&&document.documentElement.style.setProperty("--rcb-header-background-hover",Ae.secondaryColor))},[Ae]),$(()=>{var oe,de;!((oe=Y.header)===null||oe===void 0)&&oe.title&&typeof Y.header.title=="string"&&(Y.header.title=L.createElement("div",{key:"header-title"},L.createElement("h1",{className:"sr-only"},Y.header.title),L.createElement("span",{"aria-hidden":"true"},Y.header.title))),Y.device={desktopEnabled:!0,mobileEnabled:!0,applyMobileOptimizations:!1},Y.chatHistory={disabled:!0},Y.chatButton=Object.assign(Object.assign({},Y.chatButton),{icon:(de=Y.header)===null||de===void 0?void 0:de.avatar}),Y.event=Object.assign(Object.assign({},Y.event),{rcbToggleChatWindow:!0})},[Y])})({settings:ne,themeColors:Ue});const me=Se(()=>{const F=(Ae=>{let{endpoint:oe,ratingEndpoint:de,agentRatingEndpoint:he,apiKey:ge,sessionId:Te,isResetting:Je=()=>!1,isLoggedIn:Me,allowAnonAccess:xt=!1,loginUrl:qt="/login",trackEvent:ke,getTurnstileToken:Rn}=Ae;if(Me===!1&&!xt)return ke==null||ke({type:"chatbot_login_prompt_shown"}),{qa_loop:{message:"To ask questions, please log in first.",component:L.createElement(lA,{loginUrl:qt}),chatDisabled:!0,path:"qa_loop"}};let Ze=null,Et=null,Wt=!1;const be={siteKey:null,token:null,pendingQuery:null,needsChallenge:!1};let Pt=null;if(!oe)throw new Error("Q&A endpoint is required");return{qa_loop:{message:async Ce=>{var B;Pt=Ce.injectMessage.bind(Ce);const{userInput:W}=Ce;if(Je&&Je()||!W||W.trim()==="")return null;if(W==="👍 Helpful"||W==="👎 Not helpful"){if(Ze){const j=W==="👍 Helpful",se=Et==="agent"?he:de;if(se)try{const X={"Content-Type":"application/json"};ge&&(X["X-API-KEY"]=ge);const Pe=Te();Pe&&(X["X-Session-ID"]=Pe,X["X-Query-ID"]=Ze),await fetch(se,{method:"POST",headers:X,credentials:"include",body:JSON.stringify(Et==="agent"?{query_id:Ze,rating:j?"helpful":"not_helpful",session_id:Pe}:{sessionId:Pe,queryId:Ze,rating:j?1:0})}),ke==null||ke({type:"chatbot_rating_sent",queryId:Ze,rating:j?"helpful":"not_helpful"})}catch(X){Ne("Error sending feedback:",X)}}return"Thanks for the feedback!"}try{const j=uA();Ze=j,ke==null||ke({type:"chatbot_question_sent",queryId:j,questionLength:W.length});const se={"Content-Type":"application/json"};ge&&(se["X-API-KEY"]=ge);const X=Te();X&&(se["X-Session-ID"]=X,se["X-Query-ID"]=j);const Pe={query:W,session_id:X,question_id:j},st=Rn==null?void 0:Rn();st&&(Pe.turnstile_token=st),dr("SENT to API",{session_id:X,question_id:j});const Ge=Date.now(),Ye=await fetch(oe,{method:"POST",headers:se,credentials:"include",body:JSON.stringify(Pe)});if(!Ye.ok)throw new Error("API returned ".concat(Ye.status));if((Ye.headers.get("content-type")||"").includes("text/event-stream")){const vr=(B=Ye.body)===null||B===void 0?void 0:B.getReader();if(!vr)throw new Error("Response body is not readable");const Xo=new TextDecoder;let et="",un="",ut=!1;try{for(;;){const{done:tt,value:
|
|
40
|
+
`))}function xp(e){let{getState:t,onResubmit:n,trackEvent:r,loginUrl:o}=e;const[i,s]=L.useState(!1),A=t();return L.useEffect(()=>{if(!A.siteKey)return;s(!1);const a=setTimeout(()=>{A.token||(s(!0),r==null||r({type:"chatbot_turnstile_error"}))},5e3);return()=>clearTimeout(a)},[A.siteKey]),A.siteKey?i?L.createElement("div",{style:{padding:"8px 16px",fontSize:"14px",lineHeight:"1.5"}},L.createElement("p",{style:{margin:0}},"I'm having trouble verifying your session. Please try"," ",L.createElement("a",{href:"",onClick:a=>{a.preventDefault(),window.location.reload()},style:{color:"var(--primaryColor, #107180)"}},"refreshing the page"),", or"," ",L.createElement("a",{href:o,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--primaryColor, #107180)",fontWeight:"bold"}},"log in")," ","to continue.")):L.createElement(wp,{siteKey:A.siteKey,onVerify:a=>{A.token=a,r==null||r({type:"chatbot_turnstile_completed"}),n(a)},onError:()=>{Ro("Turnstile widget error (may auto-recover)")}}):null}const Ep="#1a5b6e",_p="#107180",kp="Arial, sans-serif",bA="Q&A Bot",Pp="/chat-icon.svg",Cp="Type your question here...",Sp="Select an option to continue",Dp=!1,Bp="Ask me a question!",wA="/login",Ip={general:{showHeader:!0,showFooter:!0},tooltip:{mode:"CLOSE"},chatInput:{disabled:!1,characterLimit:5e3,showCharacterCount:!1,allowNewline:!0,blockSpam:!1},chatWindow:{defaultOpen:!1,showScrollbar:!1},botBubble:{simulateStream:!0,streamSpeed:10,showAvatar:!1},userBubble:{showAvatar:!1},notification:{disabled:!0,showCount:!1},audio:{disabled:!0},emoji:{disabled:!0},fileAttachment:{disabled:!0}},zo=ze((e,t)=>{var n,r,o;const{apiKey:i,qaEndpoint:s,ratingEndpoint:A,capabilitiesEndpoint:a,agentRatingEndpoint:l,welcomeMessage:c,open:u,onOpenChange:d,isLoggedIn:p,allowAnonAccess:h=!1,actingUser:y,primaryColor:f,secondaryColor:b,botName:v,logo:g,placeholder:x,errorMessage:k,embedded:E,footerText:P,footerLink:D,tooltipText:Q,loginUrl:S,turnstileSiteKey:T,customFlow:C,onAnalyticsEvent:N}=e,U=ie("bot_".concat(Math.random().toString(36).substr(2,9)));$(()=>{up()},[]);const M=ie(null);M.current===null&&(M.current=pA(),dr("CREATED",M.current));const R=ie(!1),I=ie({getSessionId:()=>M.current,isResetting:()=>R.current}),O=function(F){const[Y,Ae]=Z(null),[oe,de]=Z("idle"),he=ie(null),ge=ie(null),Te=ie(!0),Je=K(()=>{const Me=window.turnstile;if(ge.current&&(Me!=null&&Me.remove)){try{Me.remove(ge.current)}catch{}ge.current=null}he.current&&(he.current.remove(),he.current=null)},[]);return $(()=>{if(Te.current=!0,!F)return de("idle"),void Ae(null);de("loading");const Me=document.createElement("div");return Me.style.position="fixed",Me.style.left="-9999px",Me.style.top="-9999px",Me.style.width="0",Me.style.height="0",Me.style.overflow="hidden",Me.setAttribute("aria-hidden","true"),document.body.appendChild(Me),he.current=Me,yA().then(()=>{if(!Te.current)return;const xt=window.turnstile;if(!xt||!he.current)return Ne("Turnstile API not available for silent verification"),void de("failed");const qt=xt.render(he.current,{sitekey:F,execution:"render","refresh-expired":"auto",callback:ke=>{Te.current&&(pr("Silent verification succeeded"),Ae(ke),de("verified"))},"error-callback":()=>{Te.current&&(Ne("Turnstile silent verification failed"),de("failed"))},"expired-callback":()=>{Te.current&&(pr("Token expired, awaiting refresh"),Ae(null),de("loading"))}});ge.current=qt}).catch(xt=>{Te.current&&(Ne("Failed to load Turnstile script for silent verification:",xt),de("failed"))}),()=>{Te.current=!1,Je()}},[F,Je]),{token:Y,status:oe}}(T),m=ie(null);m.current=O.token;const[z,w]=Z(p);$(()=>{w(p)},[p]);const G=E!==void 0?E:Dp,te=K(F=>{var Y;N&&N(Object.assign(Object.assign({},F),{timestamp:Date.now(),sessionId:(Y=M.current)!==null&&Y!==void 0?Y:void 0,pageUrl:typeof window<"u"?window.location.href:void 0,isEmbedded:G}))},[N,G]),ne=Se(()=>{const F=Object.assign({},Ip);F.general=Object.assign(Object.assign({},F.general),{primaryColor:f||Ep,secondaryColor:b||_p,fontFamily:kp,embedded:G});const Y=z===!1?[L.createElement(lA,{key:"login-button",loginUrl:S||wA,isHeaderButton:!0})]:[L.createElement(gp,{key:"history-button"}),L.createElement(rp,{key:"user-icon"})];F.header={title:L.createElement("span",{style:{fontSize:14,fontWeight:500}},v||bA),showAvatar:!0,avatar:g||Pp,buttons:[...Y,_e.CLOSE_CHAT_BUTTON]},F.chatInput=Object.assign(Object.assign({},F.chatInput),{disabled:!1,enabledPlaceholderText:x||Cp,disabledPlaceholderText:k||Sp}),F.tooltip=Object.assign(Object.assign({},F.tooltip),{text:Q||Bp});const Ae=P?D?L.createElement("a",{href:D,target:"_blank",rel:"noopener noreferrer",key:"footer-link"},P):L.createElement("span",{key:"footer-text"},P):null;return F.footer={text:Ae,buttons:[L.createElement(yp,{key:"new-chat-button"})]},F.chatWindow=Object.assign(Object.assign({},F.chatWindow),{defaultOpen:!!G}),F.event={rcbPreInjectMessage:!0,rcbPostInjectMessage:!0,rcbUserSubmitText:!0,rcbChangePath:!0,rcbToggleChatWindow:!0},F},[f,b,v,g,x,k,G,Q,z,S,P,D]),ue=ie(null),Ue=function(F){let Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Se(()=>{const Ae=(oe,de)=>{if(F.current){const he=getComputedStyle(F.current).getPropertyValue(oe);if(he&&he.trim()!=="")return he.trim();if(F.current.parentElement){const ge=getComputedStyle(F.current.parentElement).getPropertyValue(oe);if(ge&&ge.trim()!=="")return ge.trim()}}return de};return{primaryColor:Ae("--primaryColor",Y.primaryColor),secondaryColor:Ae("--secondaryColor",Y.secondaryColor),fontFamily:Ae("--fontFamily",Y.fontFamily)}},[F,Y])}(ue,ne.general);((F,Y)=>{$(()=>{Y.current&&(F?Y.current.classList.add("bot-logged-in"):Y.current.classList.remove("bot-logged-in"))},[F,Y])})(z!==!1,ue),(F=>{let{settings:Y,themeColors:Ae}=F;$(()=>{Ae&&(Object.entries(Ae).forEach(oe=>{let[de,he]=oe;he&&document.documentElement.style.setProperty("--".concat(de),he)}),Ae.primaryColor&&document.documentElement.style.setProperty("--rcb-header-background",Ae.primaryColor),Ae.secondaryColor&&document.documentElement.style.setProperty("--rcb-header-background-hover",Ae.secondaryColor))},[Ae]),$(()=>{var oe,de;!((oe=Y.header)===null||oe===void 0)&&oe.title&&typeof Y.header.title=="string"&&(Y.header.title=L.createElement("div",{key:"header-title"},L.createElement("h1",{className:"sr-only"},Y.header.title),L.createElement("span",{"aria-hidden":"true"},Y.header.title))),Y.device={desktopEnabled:!0,mobileEnabled:!0,applyMobileOptimizations:!1},Y.chatHistory={disabled:!0},Y.chatButton=Object.assign(Object.assign({},Y.chatButton),{icon:(de=Y.header)===null||de===void 0?void 0:de.avatar}),Y.event=Object.assign(Object.assign({},Y.event),{rcbToggleChatWindow:!0})},[Y])})({settings:ne,themeColors:Ue});const me=Se(()=>{const F=(Ae=>{let{endpoint:oe,ratingEndpoint:de,agentRatingEndpoint:he,apiKey:ge,sessionId:Te,isResetting:Je=()=>!1,isLoggedIn:Me,allowAnonAccess:xt=!1,loginUrl:qt="/login",trackEvent:ke,getTurnstileToken:Rn}=Ae;if(Me===!1&&!xt)return ke==null||ke({type:"chatbot_login_prompt_shown"}),{qa_loop:{message:"To ask questions, please log in first.",component:L.createElement(lA,{loginUrl:qt}),chatDisabled:!0,path:"qa_loop"}};let Ze=null,Et=null,Wt=!1;const be={siteKey:null,token:null,pendingQuery:null,needsChallenge:!1};let Pt=null;if(!oe)throw new Error("Q&A endpoint is required");return{qa_loop:{message:async Ce=>{var B;Pt=Ce.injectMessage.bind(Ce);const{userInput:W}=Ce;if(Je&&Je()||!W||W.trim()==="")return null;if(W==="👍 Helpful"||W==="👎 Not helpful"){if(Ze){const j=W==="👍 Helpful",se=Et==="agent"?he:de;if(se)try{const X={"Content-Type":"application/json"};ge&&(X["X-API-KEY"]=ge);const Pe=Te();Pe&&(X["X-Session-ID"]=Pe,X["X-Query-ID"]=Ze),await fetch(se,{method:"POST",headers:X,credentials:"include",body:JSON.stringify(Et==="agent"?{query_id:Ze,rating:j?"helpful":"not_helpful",session_id:Pe}:{sessionId:Pe,queryId:Ze,rating:j?1:0})}),ke==null||ke({type:"chatbot_rating_sent",queryId:Ze,rating:j?"helpful":"not_helpful"})}catch(X){Ne("Error sending feedback:",X)}}return"Thanks for the feedback!"}try{const j=uA();Ze=j,ke==null||ke({type:"chatbot_question_sent",queryId:j,questionLength:W.length});const se={"Content-Type":"application/json"};ge&&(se["X-API-KEY"]=ge);const X=Te();X&&(se["X-Session-ID"]=X,se["X-Query-ID"]=j);const Pe={query:W,session_id:X,question_id:j},st=Rn==null?void 0:Rn();st&&(Pe.turnstile_token=st),dr("SENT to API",{session_id:X,question_id:j});const Ge=Date.now(),Ye=await fetch(oe,{method:"POST",headers:se,credentials:"include",body:JSON.stringify(Pe)});if(!Ye.ok)throw new Error("API returned ".concat(Ye.status));if((Ye.headers.get("content-type")||"").includes("text/event-stream")){const vr=(B=Ye.body)===null||B===void 0?void 0:B.getReader();if(!vr)throw new Error("Response body is not readable");const Xo=new TextDecoder;let et="",un="",ut=!1;try{for(;;){const{done:tt,value:af}=await vr.read();if(tt)break;et+=Xo.decode(af,{stream:!0});let dn=et.indexOf(`
|
|
41
41
|
|
|
42
|
-
`);for(;dn!==-1;){const
|
|
42
|
+
`);for(;dn!==-1;){const sf=et.slice(0,dn);et=et.slice(dn+2);let pn,fn="",br="";for(const Fe of sf.split(`
|
|
43
43
|
`))Fe.startsWith("event: ")?fn=Fe.slice(7):Fe.startsWith("data: ")&&(br=Fe.slice(6));if(fn&&br){try{pn=JSON.parse(br)}catch{Ro("Failed to parse SSE data:",br),dn=et.indexOf(`
|
|
44
44
|
|
|
45
|
-
`);continue}if(fn==="status"){const Fe=pn.message||"Processing...";await Ce.streamMessage("_".concat(Fe,"_"),"BOT"),ut=!0}else if(fn==="token"){un+=pn.content||"";const Fe=On(un);await Ce.streamMessage(Fe,"BOT")}else if(fn==="done"){const Fe=pn.metadata||{};if(Et=Fe.rating_target||null,Wt=Fe.is_final_response===!0,un)console.log("[SSE DEBUG] done: tokenContent exists, skipping streamMessage, calling endStreamMessage"),await Ce.endStreamMessage("BOT");else{const PA=pn.response||"";if(PA){const
|
|
45
|
+
`);continue}if(fn==="status"){const Fe=pn.message||"Processing...";await Ce.streamMessage("_".concat(Fe,"_"),"BOT"),ut=!0}else if(fn==="token"){un+=pn.content||"";const Fe=On(un);await Ce.streamMessage(Fe,"BOT")}else if(fn==="done"){const Fe=pn.metadata||{};if(Et=Fe.rating_target||null,Wt=Fe.is_final_response===!0,un)console.log("[SSE DEBUG] done: tokenContent exists, skipping streamMessage, calling endStreamMessage"),await Ce.endStreamMessage("BOT");else{const PA=pn.response||"";if(PA){const Af=On(PA);await Ce.streamMessage(Af,"BOT"),ut=!0}ut&&await Ce.endStreamMessage("BOT")}}else if(fn==="error"){const Fe=pn.message||"An error occurred";Ne("SSE error event:",Fe),ut?(await Ce.streamMessage(Fe,"BOT"),await Ce.endStreamMessage("BOT")):await Ce.injectMessage(Fe)}dn=et.indexOf(`
|
|
46
46
|
|
|
47
47
|
`)}else dn=et.indexOf(`
|
|
48
48
|
|
|
@@ -55,10 +55,10 @@ var AccessQABot=function(Un){"use strict";var hn,V,$o,Mt,Jo,Zo,ei,ti,wr,xr,Er,ni
|
|
|
55
55
|
|
|
56
56
|
`)}}if(be.token=null,be.pendingQuery=null,be.needsChallenge=!1,be.siteKey=null,!Gt)throw new Error("No content received from stream");Et=Yt.rating_target||null,Wt=Yt.is_final_response===!0,Ze=se;const Vo=On(Gt);return await Pt(Vo),void(ke==null||ke({type:"chatbot_answer_received",queryId:se,success:!0,responseLength:Gt.length}))}const X=await j.json();if(X.requires_turnstile)return be.siteKey=X.site_key,be.token=null,void await Pt("Still verifying — please complete the challenge again.");be.token=null,be.pendingQuery=null,be.needsChallenge=!1,be.siteKey=null;const Pe=X.response||X.answer||X.text||X.message;if(!Pe)throw new Error("Invalid response format from API");const st=X.metadata||{};Et=st.rating_target||null,Wt=st.is_final_response===!0,Ze=se;const Ge=On(Pe),Ye=Ft()?vA(X):"",cn=Ye?"".concat(Ge,`
|
|
57
57
|
|
|
58
|
-
`).concat(Ye):Ge;await Pt(cn),ke==null||ke({type:"chatbot_answer_received",queryId:se,success:!0,responseLength:Pe.length})}catch(W){Ne("Error resubmitting after Turnstile:",W),be.token=null,be.pendingQuery=null,be.needsChallenge=!1,be.siteKey=null,await(Pt==null?void 0:Pt("I had trouble processing your question after verification. Please try again."))}},trackEvent:ke,loginUrl:qt}),path:"qa_loop"}}})({endpoint:s,ratingEndpoint:A,agentRatingEndpoint:l,apiKey:i,sessionId:I.current.getSessionId,isResetting:I.current.isResetting,isLoggedIn:z,allowAnonAccess:h,loginUrl:S||wA,trackEvent:te,getTurnstileToken:()=>m.current});return Object.assign(Object.assign({start:{message:c,renderMarkdown:["BOT"],transition:{duration:0},path:"qa_loop"}},F),C||{})},[i,s,A,l,c,z,h,S,C,y,te]),at=Se(()=>{return[()=>eu(Y),ep(),()=>tp(F)];var F,Y},[]);return $(()=>{const F=()=>{const Ae=document.querySelector(".rcb-chat-window");if(!Ae)return;const oe=Ae.querySelector(".rcb-send-button");oe&&(oe.hasAttribute("tabindex")||oe.setAttribute("tabindex","0"),oe.hasAttribute("data-keyboard-enabled")||(oe.setAttribute("data-keyboard-enabled","true"),oe.addEventListener("keydown",de=>{if(de.key==="Enter"||de.key===" "){de.preventDefault();const he=oe&&Object.keys(oe).find(Te=>Te.startsWith("__reactProps"));if(he){const Te=oe[he],Je=Te==null?void 0:Te.onMouseDown;if(Je&&typeof Je=="function")return void Je(de)}const ge=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window});oe.dispatchEvent(ge)}})))},Y=setInterval(F,1e3);return F(),()=>clearInterval(Y)},[]),bp(),$(()=>{const F=ue.current;if(!F)return;const Y=Ae=>{var oe,de,he;const ge=(de=(oe=Ae.target).closest)===null||de===void 0?void 0:de.call(oe,"a");ge&&ge.closest(".rcb-chat-body-container")&&(ge.classList.contains("qa-bot-login-button")||ge.closest(".rcb-options-container")||te({type:"chatbot_link_clicked",linkUrl:ge.href,linkText:((he=ge.textContent)===null||he===void 0?void 0:he.trim())||""}))};return F.addEventListener("click",Y),()=>F.removeEventListener("click",Y)},[te]),$(()=>{if(!G){const F=Y=>{const Ae=Y.data.newState;d==null||d(Ae);const oe=M.current;te(Ae?{type:"chatbot_open"}:{type:"chatbot_close",messageCount:oe?fA(oe):0,durationMs:oe?fp(oe):0})};return window.addEventListener("rcb-toggle-chat-window",F),()=>{window.removeEventListener("rcb-toggle-chat-window",F)}}},[G,d,te]),L.createElement("div",{className:"qa-bot ".concat(!((n=ne.general)===null||n===void 0)&&n.embedded?"embedded-qa-bot":""),ref:ue,role:"region","aria-label":"".concat(v||bA).concat(!((r=ne.general)===null||r===void 0)&&r.embedded?" - Embedded":"")},L.createElement(hp,{getSessionId:()=>M.current,setSessionId:F=>{const Y=M.current;M.current=F,dr("RESTORED","".concat(Y==null?void 0:Y.slice(-12)," -> ").concat(F.slice(-12)))},resetSession:()=>{const F=M.current;R.current=!0,M.current=pA(),dr("RESET","".concat(F==null?void 0:F.slice(-12)," -> ").concat(M.current.slice(-12)))},clearResettingFlag:()=>{R.current=!1}},L.createElement(np,{trackEvent:te},L.createElement(Ma,null,L.createElement("div",null,L.createElement(vp,null),L.createElement(aA,{ref:t,embedded:((o=ne.general)===null||o===void 0?void 0:o.embedded)||!1,currentOpen:u||!1,enabled:z!==!1,onSetEnabled:F=>w(!!F&&void 0)}),L.createElement(Oc,{key:"chatbot-".concat(U.current,"-").concat(z),settings:ne,flow:me,plugins:at}),L.createElement("div",{role:"status","aria-live":"polite","aria-label":"Bot response updates",className:"sr-only",id:"bot-live-region",style:{position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0}}),L.createElement("div",{id:"chat-input-help",className:"sr-only",style:{position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0}},"Type your message and press Enter to send. Use arrow keys to navigate through response options."))))))});zo.displayName="QABot",ra('.rcb-chat-window{height:800px!important;max-height:80vh!important;max-width:100%;width:550px!important}.rcb-chat-window .rcb-chat-header{align-items:center;display:flex;flex-direction:row;font-weight:700}.rcb-chat-window a{color:#000;font-weight:700;text-decoration:underline}.rcb-chat-window a:hover{color:var(--primaryColor,#107180)}.rcb-chat-window .rcb-bot-message a,.rcb-chat-window .rcb-bot-message a:link,.rcb-chat-window .rcb-bot-message a:visited{color:#fff!important;text-decoration:underline!important}.rcb-chat-window .rcb-bot-message a:hover{opacity:.85;text-decoration:underline!important}.rcb-chat-window .rcb-chat-input-textarea{overflow-y:auto}.rcb-chat-window .rcb-chat-footer-container{font-size:10px}.qa-bot .history-button,.qa-bot .user-login-icon{display:none!important}.qa-bot.bot-logged-in .history-button,.qa-bot.bot-logged-in .user-login-icon{display:flex!important;transform:scale(1.3) translateY(-2px)}.qa-bot.bot-logged-in .history-button:hover{opacity:.8}.qa-bot.bot-logged-in .history-button:focus{outline:2px solid #fff;outline-offset:2px}.embedded-qa-bot .rcb-chat-window{max-width:100%;width:100%!important}.qa-bot.hidden{display:none}.embedded-qa-bot .rcb-bot-message,.embedded-qa-bot .rcb-user-message{max-width:90%!important;word-break:break-word}.embedded-qa-bot .rcb-chat-input-textarea{width:100%!important}.qa-bot-container{max-width:100%;width:100%}.rcb-chat-tooltip{background-color:#1a5b6e;color:#fff}.rcb-chat-tooltip-tail{border-color:#0000 #0000 #0000 #1a5b6e}@keyframes phone-ring{0%{transform:translateX(0) translateY(0) rotate(0deg)}2%{transform:translateX(0) translateY(-8px) rotate(-2deg)}4%{transform:translateX(0) translateY(-6px) rotate(2deg)}6%{transform:translateX(0) translateY(-8px) rotate(-1deg)}8%{transform:translateX(0) translateY(-6px) rotate(1deg)}10%{transform:translateX(0) translateY(-8px) rotate(-2deg)}12%{transform:translateX(0) translateY(-6px) rotate(2deg)}20%{transform:translateX(0) translateY(0) rotate(0deg)}30%{transform:translateX(0) translateY(0) rotate(0deg)}40%{transform:translateX(0) translateY(0) rotate(0deg)}49%{transform:translateX(0) translateY(0) rotate(0deg)}50%{transform:translateX(0) translateY(-8px) rotate(-2deg)}52%{transform:translateX(0) translateY(-6px) rotate(2deg)}54%{transform:translateX(0) translateY(-8px) rotate(-1deg)}56%{transform:translateX(0) translateY(-6px) rotate(1deg)}58%{transform:translateX(0) translateY(-8px) rotate(-2deg)}60%{transform:translateX(0) translateY(-6px) rotate(2deg)}70%{transform:translateX(0) translateY(0) rotate(0deg)}to{transform:translateX(0) translateY(0) rotate(0deg)}}@media (max-width:768px){.rcb-chat-window{max-height:calc(100vh - 100px)!important;max-width:calc(100vw - 40px)!important;width:550px!important}.embedded-chat-container.open{height:400px}.embedded-chat-closed{font-size:14px;height:40px}.embedded-chat-open-btn{font-size:12px;padding:3px 10px}.rcb-bot-message,.rcb-user-message{max-width:85%!important}.rcb-chat-input-textarea{font-size:16px!important;min-height:44px!important}.rcb-chat-header{padding:12px 16px!important}}@media (max-width:480px){.rcb-chat-window{bottom:10px!important;left:10px!important;max-height:calc(100vh - 80px)!important;max-width:calc(100vw - 20px)!important;right:10px!important;width:calc(100vw - 20px)!important}.embedded-chat-container.open{height:350px}.rcb-bot-message,.rcb-user-message{margin-bottom:8px!important;max-width:90%!important}.rcb-chat-header{font-size:14px!important;padding:8px 12px!important}.rcb-chat-button{bottom:20px!important;height:50px!important;right:20px!important;width:50px!important}.rcb-chat-footer-container{font-size:9px!important;padding:8px 12px!important}}@media (max-width:360px){.rcb-chat-window{left:5px!important;max-width:calc(100vw - 10px)!important;right:5px!important;width:calc(100vw - 10px)!important}.rcb-chat-header{font-size:13px!important;padding:6px 8px!important}}.rcb-checkbox-container{display:flex!important;flex-wrap:wrap!important;gap:8px!important;margin-left:16px!important;max-width:100%!important;padding-top:12px!important}.rcb-checkbox-row-container{align-items:center!important;background-color:#fff!important;border:1px solid #d0d0d0!important;border-radius:6px!important;box-sizing:border-box!important;color:var(--primaryColor,#107180)!important;cursor:pointer!important;display:flex!important;flex:0 0 auto!important;font-size:14px!important;font-weight:400!important;margin:0!important;max-height:auto!important;min-height:auto!important;padding:8px 12px!important;text-align:center!important;transition:all .2s ease!important;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:auto!important}.rcb-checkbox-row-container:hover{background-color:#e8f4f8!important;border-color:var(--primaryColor,#107180)!important;box-shadow:0 2px 4px #10718033!important;transform:translateY(-1px)!important}.rcb-checkbox-row-container[data-checked=true]{background-color:var(--primaryColor,#107180)!important;border-color:var(--primaryColor,#107180)!important;color:#fff!important}.rcb-checkbox-row{margin-left:0!important}.rcb-checkbox-mark{height:14px!important;margin-right:6px!important;width:14px!important}.rcb-checkbox-label{font-size:13px!important;margin:0!important;white-space:nowrap!important}.rcb-checkbox-next-button{align-items:center!important;background-color:#fff!important;border:1px solid #d0d0d0!important;border-radius:6px!important;box-sizing:border-box!important;color:var(--secondaryColor,#107180)!important;cursor:pointer!important;display:flex!important;flex:0 0 auto!important;font-size:14px!important;font-weight:400!important;justify-content:center!important;line-height:24px!important;margin:0!important;max-height:auto!important;min-height:auto!important;padding:8px 12px!important;text-align:center!important;transition:all .2s ease!important;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:auto!important}.rcb-checkbox-next-button:hover{background-color:#e8f4f8!important;border-color:var(--secondaryColor,#107180)!important;box-shadow:0 2px 4px #10718033!important;transform:translateY(-1px)!important}.sr-only{clip:rect(0,0,0,0)!important;border:0!important;height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;white-space:nowrap!important;width:1px!important}.rcb-chat-input-send-button:focus,.rcb-chat-input-textarea:focus{outline:2px solid var(--primaryColor,#107180)!important;outline-offset:2px!important}.rcb-user-message{word-wrap:break-word!important;overflow:hidden!important;word-break:break-word!important}:focus-visible{outline:2px solid var(--primaryColor,#107180)!important;outline-offset:2px!important}.rcb-options-container{display:flex!important;flex-direction:row!important;flex-wrap:wrap!important;gap:8px!important;margin:16px!important;padding:0!important}.rcb-options{background-color:#fff!important;border:1px solid #d0d0d0!important;border-radius:6px!important;box-sizing:border-box!important;color:var(--secondaryColor,#107180)!important;cursor:pointer!important;flex:0 0 auto!important;font-size:14px!important;font-weight:400!important;outline:none!important;padding:8px 12px!important;text-align:center!important;transition:all .2s ease!important;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:auto!important}.rcb-options:hover{background-color:#e8f4f8!important;border-color:var(--secondaryColor,#107180)!important;box-shadow:0 2px 4px #10718033!important;transform:translateY(-1px)!important}.rcb-checkbox-next-button.keyboard-focused,.rcb-checkbox-next-button:focus,.rcb-checkbox-next-button:focus-visible,.rcb-checkbox-row-container.keyboard-focused,.rcb-checkbox-row-container:focus,.rcb-checkbox-row-container:focus-visible,.rcb-options.keyboard-focused,.rcb-options:focus,.rcb-options:focus-visible{background-color:#e8f4f8!important;border-color:var(--secondaryColor,#107180)!important;outline:none!important}.rcb-options:active{background-color:var(--secondaryColor,#107180)!important;border-color:var(--secondaryColor,#107180)!important;color:#fff!important;transform:translateY(0)!important}.keyboard-nav-hint{color:#666!important;font-size:12px!important;font-style:italic!important;margin-bottom:8px!important}@media (prefers-reduced-motion:reduce){.keyboard-nav-hint{display:none!important}}.rcb-options-container [role=button][tabindex="0"],.rcb-options-container button[tabindex="0"]{position:relative!important}.rcb-options-container [role=button][tabindex="0"]:after,.rcb-options-container button[tabindex="0"]:after{color:var(--secondaryColor,#107180)!important;content:"←"!important;font-size:16px!important;opacity:0!important;position:absolute!important;right:12px!important;top:50%!important;transform:translateY(-50%)!important;transition:opacity .2s ease!important}.rcb-options-container [role=button][tabindex="0"]:focus:after,.rcb-options-container button[tabindex="0"]:focus:after{opacity:1!important}.rcb-chat-input-send-button{cursor:pointer!important;opacity:1!important;pointer-events:auto!important;visibility:visible!important}.rcb-chat-input-send-button:not([tabindex]){-webkit-user-select:none;-moz-user-select:none;user-select:none}.rcb-chat-input-container [onclick],.rcb-chat-input-container [role=button],.rcb-chat-input-container div[style*=cursor],.rcb-chat-input-container svg:last-child,.rcb-chat-input-container>div:last-child{tabindex:0!important;cursor:pointer!important}.rcb-chat-footer{margin-top:4px!important;padding-top:0!important}.rcb-chat-footer-container{align-items:center!important;display:flex!important;margin-top:4px!important;padding-top:4px!important}.rcb-chat-footer-container button{order:1!important}.rcb-chat-footer-container a[href*=qa-bot-core]{tab-index:0!important;order:2!important}.rcb-chat-footer-container a[href*=feedback]{tab-index:0!important;order:3!important}@media (prefers-contrast:high){.rcb-chat-window a{background-color:#fff!important;border:1px solid #000!important;color:#000!important}}@media (prefers-reduced-motion:reduce){*{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}.rcb-chat-input-textarea{user-select:text!important}.rcb-chat-body-container,.rcb-chat-input-textarea,.rcb-chat-window{touch-action:pan-y!important}.embedded-qa-bot,.rcb-chat-window{-webkit-overflow-scrolling:touch!important}.embedded-qa-bot .rcb-chat-input-textarea{touch-action:pan-y!important;user-select:text!important}.embedded-qa-bot .rcb-chat-body-container,.embedded-qa-bot .rcb-chat-window{touch-action:pan-y!important}.rcb-chat-header-container{background:var(--primaryColor,#1a5b6e)!important;background:linear-gradient(135deg,var(--primaryColor,#1a5b6e) 0,var(--secondaryColor,#107180) 100%)!important}.rcb-toggle-button{align-items:center!important;background:var(--primaryColor,#1a5b6e)!important;display:flex!important;justify-content:center!important}.rcb-toggle-button svg{stroke:#fff!important;color:#fff!important}.rcb-toggle-button *,.rcb-toggle-button img,.rcb-toggle-button svg,.rcb-toggle-button>*{box-sizing:border-box!important;height:50px!important;left:0!important;margin:0 auto!important;max-height:50px!important;max-width:50px!important;min-height:50px!important;min-width:50px!important;padding:2px!important;position:relative!important;top:0!important;width:50px!important}.rcb-send-button{background-color:var(--primaryColor,#1a5b6e)!important}',{insertAt:"top"});const Tp=()=>{const[e,t]=Z(!1),n=()=>typeof navigator<"u"&&navigator.mediaDevices!==void 0&&typeof navigator.mediaDevices.getDisplayMedia=="function";return{captureScreenshot:async()=>{if(!n())throw new Error("Screen capture is not available in this environment");try{t(!0);const r=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser",cursor:"always",width:{ideal:1920},height:{ideal:1080}},audio:!1}),o=document.createElement("video");o.srcObject=r,await new Promise(c=>{o.onloadedmetadata=()=>{o.play(),c()}});const i=document.createElement("canvas");i.width=o.videoWidth,i.height=o.videoHeight;const s=i.getContext("2d");if(!s)throw new Error("Could not get canvas context");s.drawImage(o,0,0,i.width,i.height);const A=await new Promise(c=>i.toBlob(c,"image/png"));if(!A)throw new Error("Could not create image blob");const a=new Date().toISOString().replace(/[:.]/g,"-"),l=new File([A],"screenshot-".concat(a,".png"),{type:"image/png"});return r.getTracks().forEach(c=>c.stop()),t(!1),l}catch(r){throw Ne("Error capturing screenshot:",r),t(!1),r}},isCapturing:e,isScreenCaptureAvailable:n()}},Qp=e=>L.createElement(gA,e,L.createElement("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),L.createElement("polyline",{points:"17 8 12 3 7 8"}),L.createElement("line",{x1:"12",y1:"3",x2:"12",y2:"15"})),Mp=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{if(typeof r.result!="string")return void n(new Error("Failed to read file ".concat(e.name)));const o=r.result.split(",")[1];t({fileName:e.name,contentType:e.type,size:e.size,fileData:o})},r.onerror=()=>n(new Error("Failed to read file ".concat(e.name))),r.readAsDataURL(e)}),Op=e=>Promise.all(e.map(Mp)),Np=e=>e<1024?"".concat(e," B"):e<1048576?"".concat((e/1024).toFixed(1)," KB"):"".concat((e/1048576).toFixed(1)," MB"),hr=e=>{let{onFileUpload:t,maxSizeMB:n=10,acceptedTypes:r="image/*,application/pdf,text/*,.doc,.docx",enableScreenshot:o=!1,className:i}=e;const[s,A]=Z(!1),[a,l]=Z([]),[c,u]=Z(null),d=ie(null),{captureScreenshot:p,isCapturing:h,isScreenCaptureAvailable:y}=Tp(),f=E=>{const P=document.createElement("div");P.setAttribute("aria-live","assertive"),P.setAttribute("aria-atomic","true"),P.className="sr-only",P.textContent=E,document.body.appendChild(P),setTimeout(()=>document.body.removeChild(P),1e3)},b=E=>{if(!E||E.length===0)return void Ro("FileUploadComponent: No valid files provided to handleFiles");let P;try{P=Array.from(E)}catch(T){return Ne("FileUploadComponent: Error converting files to array:",T),void f("Error processing selected files. Please try again.")}const D=[...a,...P];l(D);const Q=P.length,S=P.map(T=>T.name).join(", ");f("".concat(Q," file").concat(Q>1?"s":""," selected: ").concat(S)),setTimeout(()=>{const T=document.querySelector(".rcb-chat-content");T&&(T.scrollTop=T.scrollHeight)},100),t&&t(D)},v=E=>{E.preventDefault(),E.stopPropagation(),E.type==="dragenter"||E.type==="dragover"?A(!0):E.type==="dragleave"&&A(!1)},g=()=>{try{d.current&&d.current.click()}catch(E){Ne("FileUploadComponent: Error in handleButtonClick:",E),f("Error opening file selection dialog. Please try again.")}},x=()=>{u(null)},k=o&&y;return L.createElement("div",{className:"file-upload-container ".concat(i||""),style:{padding:"16px",margin:"8px 0"}},k&&L.createElement("div",{style:{display:"flex",justifyContent:"center",marginBottom:"10px"}},L.createElement("button",{onClick:E=>{E.preventDefault(),(async()=>{try{const P=await p();b([P]),f("Screenshot captured successfully")}catch{f("Error capturing screenshot. Please try again.")}})()},disabled:h,"aria-describedby":"screenshot-help","aria-label":h?"Taking screenshot, please wait":"Take a screenshot to attach",style:{display:"flex",alignItems:"center",gap:"8px",backgroundColor:"#107180",color:"white",border:"none",borderRadius:"5px",padding:"8px 12px",cursor:h?"not-allowed":"pointer",fontSize:"14px",fontWeight:"500",boxShadow:"0 1px 3px rgba(0,0,0,0.2)"}},L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},L.createElement("path",{d:"M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"}),L.createElement("circle",{cx:"12",cy:"13",r:"4"})),h?"Taking screenshot...":"Take screenshot..."),L.createElement("span",{id:"screenshot-help",className:"sr-only"},"Captures the current screen and adds it as an attachment")),L.createElement("div",{className:"file-upload-dropzone ".concat(s?"active":""),onDragEnter:v,onDragLeave:v,onDragOver:v,onDrop:E=>{var P;E.preventDefault(),E.stopPropagation(),A(!1);try{!((P=E.dataTransfer)===null||P===void 0)&&P.files&&E.dataTransfer.files.length>0&&b(E.dataTransfer.files)}catch(D){Ne("FileUploadComponent: Error in handleDrop:",D),f("Error processing dropped files. Please try again.")}},role:"button",tabIndex:0,"aria-label":"File upload area. Click to select files or drag and drop files here.","aria-describedby":"upload-instructions",onKeyDown:E=>{E.key!=="Enter"&&E.key!==" "||(E.preventDefault(),g())},style:{padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",backgroundColor:s?"#f0f8ff":"#fafafa",transition:"all 0.3s ease"}},L.createElement("input",{ref:d,type:"file",className:"file-input",onChange:E=>{var P;try{!((P=E.target)===null||P===void 0)&&P.files&&E.target.files.length>0&&b(E.target.files)}catch(D){Ne("FileUploadComponent: Error in handleFileSelect:",D),f("Error processing selected files. Please try again.")}},multiple:!0,style:{display:"none"},"aria-label":"Select files to upload",accept:r}),L.createElement("div",{className:"upload-content",onClick:g,style:{cursor:"pointer",flexDirection:"column",alignItems:"center",display:"flex",textAlign:"center",padding:"12px"}},L.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"}},L.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"}},L.createElement(Qp,null),L.createElement("p",{style:{margin:0,fontWeight:"bold"}},"Upload Files")),L.createElement("p",{id:"upload-instructions",style:{margin:0,fontSize:"14px",color:"#666"}},"Drag and drop files here or click to select. (Max ",n,"MB each)")),a.length>0&&L.createElement("div",{className:"selected-files",style:{display:"flex",flexWrap:"wrap",gap:"8px",marginTop:"12px",alignItems:"center"}},L.createElement("span",{style:{fontWeight:400,color:"#888",fontSize:"13px",marginRight:"8px",alignSelf:"center"}},"Selected files:"),a.map((E,P)=>L.createElement("span",{key:P,style:{background:"#fff",color:"#107180",borderRadius:"5px",padding:"4px 12px",fontSize:"14px",marginRight:"4px",marginBottom:"4px",border:"1px solid #ccc",display:"flex",alignItems:"center",gap:"6px",cursor:"pointer"},onClick:D=>{D.stopPropagation(),(Q=>{u(Q)})(E)}},L.createElement("span",{onClick:D=>{D.stopPropagation(),(Q=>{const S=a.filter((T,C)=>C!==Q);l(S),t&&t(S)})(P)},style:{cursor:"pointer",color:"#888",fontWeight:"bold",fontSize:"15px",marginRight:"4px",userSelect:"none",lineHeight:1},title:"Remove file","aria-label":"Remove ".concat(E.name)},"×"),E.name," (",Np(E.size),")"))))),(()=>{if(!c)return null;const E=c.type.startsWith("image/"),P=c.type.startsWith("text/"),D=c.type==="application/pdf";return L.createElement("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.7)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:1e3},onClick:x},L.createElement("div",{style:{backgroundColor:"white",padding:"20px",borderRadius:"8px",maxWidth:"90%",maxHeight:"90%",overflow:"auto",position:"relative"},onClick:Q=>Q.stopPropagation()},L.createElement("button",{onClick:x,style:{position:"absolute",top:"10px",right:"10px",background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#666"}},"×"),L.createElement("h3",{style:{marginTop:0,marginBottom:"16px"}},c.name),E&&L.createElement("img",{src:URL.createObjectURL(c),alt:c.name,style:{maxWidth:"100%",maxHeight:"70vh"}}),P&&L.createElement("pre",{style:{whiteSpace:"pre-wrap",wordWrap:"break-word",maxHeight:"70vh",overflow:"auto",padding:"16px",backgroundColor:"#f5f5f5",borderRadius:"4px"}},URL.createObjectURL(c)),D&&L.createElement("iframe",{src:URL.createObjectURL(c),style:{width:"100%",height:"70vh",border:"none"},title:c.name}),!E&&!P&&!D&&L.createElement("div",{style:{padding:"20px",textAlign:"center"}},"Preview not available for this file type")))})())};function Lp(e,t){if(!t||Object.keys(t).length===0)return e;const n={};for(const[r,o]of Object.entries(e)){let i=Object.assign({},o);if(i.chatDisabled===void 0){const s=!(!i.options&&!i.checkboxes);i.chatDisabled=s}n[r]=i}return n}function gr(e){return async t=>{const n=await e(t);await t.injectMessage(n)}}const Rp=L.forwardRef((e,t)=>{const[n,r]=L.useState(e.defaultOpen||!1),o=L.useRef(null);return L.useImperativeHandle(t,()=>({addMessage:i=>{var s;(s=o.current)===null||s===void 0||s.addMessage(i)},setBotEnabled:i=>{var s;(s=o.current)===null||s===void 0||s.setBotEnabled(i)},openChat:()=>{var i;r(!0),(i=o.current)===null||i===void 0||i.openChat()},closeChat:()=>{var i;r(!1),(i=o.current)===null||i===void 0||i.closeChat()},toggleChat:()=>{var i;r(s=>!s),(i=o.current)===null||i===void 0||i.toggleChat()}}),[]),L.createElement(zo,{ref:o,apiKey:e.apiKey,qaEndpoint:e.qaEndpoint,ratingEndpoint:e.ratingEndpoint,welcomeMessage:e.welcomeMessage,primaryColor:e.primaryColor,secondaryColor:e.secondaryColor,botName:e.botName,logo:e.logo,placeholder:e.placeholder,errorMessage:e.errorMessage,embedded:e.embedded,isLoggedIn:e.isLoggedIn,allowAnonAccess:e.allowAnonAccess,turnstileSiteKey:e.turnstileSiteKey,open:n,onOpenChange:r,footerText:e.footerText,footerLink:e.footerLink,tooltipText:e.tooltipText,onAnalyticsEvent:e.onAnalyticsEvent})});Rp.displayName="ProgrammaticQABot";const wt={QA_ENDPOINT:"http://localhost:8000/api/v1/query",RATING_ENDPOINT:"https://access-ai-grace1-external.ccs.uky.edu/access/chat/rating/",AGENT_ENDPOINT:"http://localhost:8000/api/v1",get CAPABILITIES_ENDPOINT(){return`${this.AGENT_ENDPOINT}/capabilities`},get AGENT_RATING_ENDPOINT(){return`${this.AGENT_ENDPOINT}/rating`},METRICS_API_ENDPOINT:"https://access-ai-grace1-external.ccs.uky.edu/access/xdmod/chat/api/",METRICS_RATING_ENDPOINT:"https://access-ai-grace1-external.ccs.uky.edu/access/xdmod/chat/rating/",METRICS_QUESTIONS_URL:"https://metrics.access-ci.org/qa_bot_faq",NETLIFY_BASE_URL:"https://access-jsm-api.netlify.app",DEFAULT_API_KEY:"4nn5l4T4TnkMdzsK0AwAtnGRcheBDnjawuAT42LaOLc",TURNSTILE_SITE_KEY:"1x00000000000000000000BB",ALLOW_ANON_ACCESS:!0},zt={BOT_NAME:"ACCESS Q&A",LOGO:"https://support.access-ci.org/themes/contrib/asp-theme/images/icons/ACCESS-arrrow.svg",WELCOME_MESSAGE:`Hello! What can I help you with?
|
|
58
|
+
`).concat(Ye):Ge;await Pt(cn),ke==null||ke({type:"chatbot_answer_received",queryId:se,success:!0,responseLength:Pe.length})}catch(W){Ne("Error resubmitting after Turnstile:",W),be.token=null,be.pendingQuery=null,be.needsChallenge=!1,be.siteKey=null,await(Pt==null?void 0:Pt("I had trouble processing your question after verification. Please try again."))}},trackEvent:ke,loginUrl:qt}),path:"qa_loop"}}})({endpoint:s,ratingEndpoint:A,agentRatingEndpoint:l,apiKey:i,sessionId:I.current.getSessionId,isResetting:I.current.isResetting,isLoggedIn:z,allowAnonAccess:h,loginUrl:S||wA,trackEvent:te,getTurnstileToken:()=>m.current});return Object.assign(Object.assign({start:{message:c,renderMarkdown:["BOT"],transition:{duration:0},path:"qa_loop"}},F),C||{})},[i,s,A,l,c,z,h,S,C,y,te]),at=Se(()=>{return[()=>eu(Y),ep(),()=>tp(F)];var F,Y},[]);return $(()=>{const F=()=>{const Ae=document.querySelector(".rcb-chat-window");if(!Ae)return;const oe=Ae.querySelector(".rcb-send-button");oe&&(oe.hasAttribute("tabindex")||oe.setAttribute("tabindex","0"),oe.hasAttribute("data-keyboard-enabled")||(oe.setAttribute("data-keyboard-enabled","true"),oe.addEventListener("keydown",de=>{if(de.key==="Enter"||de.key===" "){de.preventDefault();const he=oe&&Object.keys(oe).find(Te=>Te.startsWith("__reactProps"));if(he){const Te=oe[he],Je=Te==null?void 0:Te.onMouseDown;if(Je&&typeof Je=="function")return void Je(de)}const ge=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window});oe.dispatchEvent(ge)}})))},Y=setInterval(F,1e3);return F(),()=>clearInterval(Y)},[]),bp(),$(()=>{const F=ue.current;if(!F)return;const Y=Ae=>{var oe,de,he;const ge=(de=(oe=Ae.target).closest)===null||de===void 0?void 0:de.call(oe,"a");ge&&ge.closest(".rcb-chat-body-container")&&(ge.classList.contains("qa-bot-login-button")||ge.closest(".rcb-options-container")||te({type:"chatbot_link_clicked",linkUrl:ge.href,linkText:((he=ge.textContent)===null||he===void 0?void 0:he.trim())||""}))};return F.addEventListener("click",Y),()=>F.removeEventListener("click",Y)},[te]),$(()=>{if(!G){const F=Y=>{const Ae=Y.data.newState;d==null||d(Ae);const oe=M.current;te(Ae?{type:"chatbot_open"}:{type:"chatbot_close",messageCount:oe?fA(oe):0,durationMs:oe?fp(oe):0})};return window.addEventListener("rcb-toggle-chat-window",F),()=>{window.removeEventListener("rcb-toggle-chat-window",F)}}},[G,d,te]),L.createElement("div",{className:"qa-bot ".concat(!((n=ne.general)===null||n===void 0)&&n.embedded?"embedded-qa-bot":""),ref:ue,role:"region","aria-label":"".concat(v||bA).concat(!((r=ne.general)===null||r===void 0)&&r.embedded?" - Embedded":"")},L.createElement(hp,{getSessionId:()=>M.current,setSessionId:F=>{const Y=M.current;M.current=F,dr("RESTORED","".concat(Y==null?void 0:Y.slice(-12)," -> ").concat(F.slice(-12)))},resetSession:()=>{const F=M.current;R.current=!0,M.current=pA(),dr("RESET","".concat(F==null?void 0:F.slice(-12)," -> ").concat(M.current.slice(-12)))},clearResettingFlag:()=>{R.current=!1}},L.createElement(np,{trackEvent:te},L.createElement(Ma,null,L.createElement("div",null,L.createElement(vp,null),L.createElement(aA,{ref:t,embedded:((o=ne.general)===null||o===void 0?void 0:o.embedded)||!1,currentOpen:u||!1,enabled:z!==!1,onSetEnabled:F=>w(!!F&&void 0)}),L.createElement(Oc,{key:"chatbot-".concat(U.current,"-").concat(z),settings:ne,flow:me,plugins:at}),L.createElement("div",{role:"status","aria-live":"polite","aria-label":"Bot response updates",className:"sr-only",id:"bot-live-region",style:{position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0}}),L.createElement("div",{id:"chat-input-help",className:"sr-only",style:{position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0}},"Type your message and press Enter to send. Use arrow keys to navigate through response options."))))))});zo.displayName="QABot",ra('.rcb-chat-window{height:800px!important;max-height:80vh!important;max-width:100%;width:550px!important}.rcb-chat-window .rcb-chat-header{align-items:center;display:flex;flex-direction:row;font-weight:700}.rcb-chat-window a{color:#000;font-weight:700;text-decoration:underline}.rcb-chat-window a:hover{color:var(--primaryColor,#107180)}.rcb-chat-window .rcb-bot-message a,.rcb-chat-window .rcb-bot-message a:link,.rcb-chat-window .rcb-bot-message a:visited{color:#fff!important;text-decoration:underline!important}.rcb-chat-window .rcb-bot-message a:hover{opacity:.85;text-decoration:underline!important}.rcb-chat-window .rcb-chat-input-textarea{overflow-y:auto}.rcb-chat-window .rcb-chat-footer-container{font-size:10px}.qa-bot .history-button,.qa-bot .user-login-icon{display:none!important}.qa-bot.bot-logged-in .history-button,.qa-bot.bot-logged-in .user-login-icon{display:flex!important;transform:scale(1.3) translateY(-2px)}.qa-bot.bot-logged-in .history-button:hover{opacity:.8}.qa-bot.bot-logged-in .history-button:focus{outline:2px solid #fff;outline-offset:2px}.embedded-qa-bot .rcb-chat-window{max-width:100%;width:100%!important}.qa-bot.hidden{display:none}.embedded-qa-bot .rcb-bot-message,.embedded-qa-bot .rcb-user-message{max-width:90%!important;word-break:break-word}.embedded-qa-bot .rcb-chat-input-textarea{width:100%!important}.qa-bot-container{max-width:100%;width:100%}.rcb-chat-tooltip{background-color:#1a5b6e;color:#fff}.rcb-chat-tooltip-tail{border-color:#0000 #0000 #0000 #1a5b6e}@keyframes phone-ring{0%{transform:translateX(0) translateY(0) rotate(0deg)}2%{transform:translateX(0) translateY(-8px) rotate(-2deg)}4%{transform:translateX(0) translateY(-6px) rotate(2deg)}6%{transform:translateX(0) translateY(-8px) rotate(-1deg)}8%{transform:translateX(0) translateY(-6px) rotate(1deg)}10%{transform:translateX(0) translateY(-8px) rotate(-2deg)}12%{transform:translateX(0) translateY(-6px) rotate(2deg)}20%{transform:translateX(0) translateY(0) rotate(0deg)}30%{transform:translateX(0) translateY(0) rotate(0deg)}40%{transform:translateX(0) translateY(0) rotate(0deg)}49%{transform:translateX(0) translateY(0) rotate(0deg)}50%{transform:translateX(0) translateY(-8px) rotate(-2deg)}52%{transform:translateX(0) translateY(-6px) rotate(2deg)}54%{transform:translateX(0) translateY(-8px) rotate(-1deg)}56%{transform:translateX(0) translateY(-6px) rotate(1deg)}58%{transform:translateX(0) translateY(-8px) rotate(-2deg)}60%{transform:translateX(0) translateY(-6px) rotate(2deg)}70%{transform:translateX(0) translateY(0) rotate(0deg)}to{transform:translateX(0) translateY(0) rotate(0deg)}}@media (max-width:768px){.rcb-chat-window{max-height:calc(100vh - 100px)!important;max-width:calc(100vw - 40px)!important;width:550px!important}.embedded-chat-container.open{height:400px}.embedded-chat-closed{font-size:14px;height:40px}.embedded-chat-open-btn{font-size:12px;padding:3px 10px}.rcb-bot-message,.rcb-user-message{max-width:85%!important}.rcb-chat-input-textarea{font-size:16px!important;min-height:44px!important}.rcb-chat-header{padding:12px 16px!important}}@media (max-width:480px){.rcb-chat-window{bottom:10px!important;left:10px!important;max-height:calc(100vh - 80px)!important;max-width:calc(100vw - 20px)!important;right:10px!important;width:calc(100vw - 20px)!important}.embedded-chat-container.open{height:350px}.rcb-bot-message,.rcb-user-message{margin-bottom:8px!important;max-width:90%!important}.rcb-chat-header{font-size:14px!important;padding:8px 12px!important}.rcb-chat-button{bottom:20px!important;height:50px!important;right:20px!important;width:50px!important}.rcb-chat-footer-container{font-size:9px!important;padding:8px 12px!important}}@media (max-width:360px){.rcb-chat-window{left:5px!important;max-width:calc(100vw - 10px)!important;right:5px!important;width:calc(100vw - 10px)!important}.rcb-chat-header{font-size:13px!important;padding:6px 8px!important}}.rcb-checkbox-container{display:flex!important;flex-wrap:wrap!important;gap:8px!important;margin-left:16px!important;max-width:100%!important;padding-top:12px!important}.rcb-checkbox-row-container{align-items:center!important;background-color:#fff!important;border:1px solid #d0d0d0!important;border-radius:6px!important;box-sizing:border-box!important;color:var(--primaryColor,#107180)!important;cursor:pointer!important;display:flex!important;flex:0 0 auto!important;font-size:14px!important;font-weight:400!important;margin:0!important;max-height:auto!important;min-height:auto!important;padding:8px 12px!important;text-align:center!important;transition:all .2s ease!important;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:auto!important}.rcb-checkbox-row-container:hover{background-color:#e8f4f8!important;border-color:var(--primaryColor,#107180)!important;box-shadow:0 2px 4px #10718033!important;transform:translateY(-1px)!important}.rcb-checkbox-row-container[data-checked=true]{background-color:var(--primaryColor,#107180)!important;border-color:var(--primaryColor,#107180)!important;color:#fff!important}.rcb-checkbox-row{margin-left:0!important}.rcb-checkbox-mark{height:14px!important;margin-right:6px!important;width:14px!important}.rcb-checkbox-label{font-size:13px!important;margin:0!important;white-space:nowrap!important}.rcb-checkbox-next-button{align-items:center!important;background-color:#fff!important;border:1px solid #d0d0d0!important;border-radius:6px!important;box-sizing:border-box!important;color:var(--secondaryColor,#107180)!important;cursor:pointer!important;display:flex!important;flex:0 0 auto!important;font-size:14px!important;font-weight:400!important;justify-content:center!important;line-height:24px!important;margin:0!important;max-height:auto!important;min-height:auto!important;padding:8px 12px!important;text-align:center!important;transition:all .2s ease!important;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:auto!important}.rcb-checkbox-next-button:hover{background-color:#e8f4f8!important;border-color:var(--secondaryColor,#107180)!important;box-shadow:0 2px 4px #10718033!important;transform:translateY(-1px)!important}.sr-only{clip:rect(0,0,0,0)!important;border:0!important;height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;white-space:nowrap!important;width:1px!important}.rcb-chat-input-send-button:focus,.rcb-chat-input-textarea:focus{outline:2px solid var(--primaryColor,#107180)!important;outline-offset:2px!important}.rcb-user-message{word-wrap:break-word!important;overflow:hidden!important;word-break:break-word!important}:focus-visible{outline:2px solid var(--primaryColor,#107180)!important;outline-offset:2px!important}.rcb-options-container{display:flex!important;flex-direction:row!important;flex-wrap:wrap!important;gap:8px!important;margin:16px!important;padding:0!important}.rcb-options{background-color:#fff!important;border:1px solid #d0d0d0!important;border-radius:6px!important;box-sizing:border-box!important;color:var(--secondaryColor,#107180)!important;cursor:pointer!important;flex:0 0 auto!important;font-size:14px!important;font-weight:400!important;outline:none!important;padding:8px 12px!important;text-align:center!important;transition:all .2s ease!important;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:auto!important}.rcb-options:hover{background-color:#e8f4f8!important;border-color:var(--secondaryColor,#107180)!important;box-shadow:0 2px 4px #10718033!important;transform:translateY(-1px)!important}.rcb-checkbox-next-button.keyboard-focused,.rcb-checkbox-next-button:focus,.rcb-checkbox-next-button:focus-visible,.rcb-checkbox-row-container.keyboard-focused,.rcb-checkbox-row-container:focus,.rcb-checkbox-row-container:focus-visible,.rcb-options.keyboard-focused,.rcb-options:focus,.rcb-options:focus-visible{background-color:#e8f4f8!important;border-color:var(--secondaryColor,#107180)!important;outline:none!important}.rcb-options:active{background-color:var(--secondaryColor,#107180)!important;border-color:var(--secondaryColor,#107180)!important;color:#fff!important;transform:translateY(0)!important}.keyboard-nav-hint{color:#666!important;font-size:12px!important;font-style:italic!important;margin-bottom:8px!important}@media (prefers-reduced-motion:reduce){.keyboard-nav-hint{display:none!important}}.rcb-options-container [role=button][tabindex="0"],.rcb-options-container button[tabindex="0"]{position:relative!important}.rcb-options-container [role=button][tabindex="0"]:after,.rcb-options-container button[tabindex="0"]:after{color:var(--secondaryColor,#107180)!important;content:"←"!important;font-size:16px!important;opacity:0!important;position:absolute!important;right:12px!important;top:50%!important;transform:translateY(-50%)!important;transition:opacity .2s ease!important}.rcb-options-container [role=button][tabindex="0"]:focus:after,.rcb-options-container button[tabindex="0"]:focus:after{opacity:1!important}.rcb-chat-input-send-button{cursor:pointer!important;opacity:1!important;pointer-events:auto!important;visibility:visible!important}.rcb-chat-input-send-button:not([tabindex]){-webkit-user-select:none;-moz-user-select:none;user-select:none}.rcb-chat-input-container [onclick],.rcb-chat-input-container [role=button],.rcb-chat-input-container div[style*=cursor],.rcb-chat-input-container svg:last-child,.rcb-chat-input-container>div:last-child{tabindex:0!important;cursor:pointer!important}.rcb-chat-footer{margin-top:4px!important;padding-top:0!important}.rcb-chat-footer-container{align-items:center!important;display:flex!important;margin-top:4px!important;padding-top:4px!important}.rcb-chat-footer-container button{order:1!important}.rcb-chat-footer-container a[href*=qa-bot-core]{tab-index:0!important;order:2!important}.rcb-chat-footer-container a[href*=feedback]{tab-index:0!important;order:3!important}@media (prefers-contrast:high){.rcb-chat-window a{background-color:#fff!important;border:1px solid #000!important;color:#000!important}}@media (prefers-reduced-motion:reduce){*{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}.rcb-chat-input-textarea{user-select:text!important}.rcb-chat-body-container,.rcb-chat-input-textarea,.rcb-chat-window{touch-action:pan-y!important}.embedded-qa-bot,.rcb-chat-window{-webkit-overflow-scrolling:touch!important}.embedded-qa-bot .rcb-chat-input-textarea{touch-action:pan-y!important;user-select:text!important}.embedded-qa-bot .rcb-chat-body-container,.embedded-qa-bot .rcb-chat-window{touch-action:pan-y!important}.rcb-chat-header-container{background:var(--primaryColor,#1a5b6e)!important;background:linear-gradient(135deg,var(--primaryColor,#1a5b6e) 0,var(--secondaryColor,#107180) 100%)!important}.rcb-toggle-button{align-items:center!important;background:var(--primaryColor,#1a5b6e)!important;display:flex!important;justify-content:center!important}.rcb-toggle-button svg{stroke:#fff!important;color:#fff!important}.rcb-toggle-button *,.rcb-toggle-button img,.rcb-toggle-button svg,.rcb-toggle-button>*{box-sizing:border-box!important;height:50px!important;left:0!important;margin:0 auto!important;max-height:50px!important;max-width:50px!important;min-height:50px!important;min-width:50px!important;padding:2px!important;position:relative!important;top:0!important;width:50px!important}.rcb-send-button{background-color:var(--primaryColor,#1a5b6e)!important}',{insertAt:"top"});const Tp=()=>{const[e,t]=Z(!1),n=()=>typeof navigator<"u"&&navigator.mediaDevices!==void 0&&typeof navigator.mediaDevices.getDisplayMedia=="function";return{captureScreenshot:async()=>{if(!n())throw new Error("Screen capture is not available in this environment");try{t(!0);const r=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser",cursor:"always",width:{ideal:1920},height:{ideal:1080}},audio:!1}),o=document.createElement("video");o.srcObject=r,await new Promise(c=>{o.onloadedmetadata=()=>{o.play(),c()}});const i=document.createElement("canvas");i.width=o.videoWidth,i.height=o.videoHeight;const s=i.getContext("2d");if(!s)throw new Error("Could not get canvas context");s.drawImage(o,0,0,i.width,i.height);const A=await new Promise(c=>i.toBlob(c,"image/png"));if(!A)throw new Error("Could not create image blob");const a=new Date().toISOString().replace(/[:.]/g,"-"),l=new File([A],"screenshot-".concat(a,".png"),{type:"image/png"});return r.getTracks().forEach(c=>c.stop()),t(!1),l}catch(r){throw Ne("Error capturing screenshot:",r),t(!1),r}},isCapturing:e,isScreenCaptureAvailable:n()}},Qp=e=>L.createElement(gA,e,L.createElement("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),L.createElement("polyline",{points:"17 8 12 3 7 8"}),L.createElement("line",{x1:"12",y1:"3",x2:"12",y2:"15"})),Mp=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{if(typeof r.result!="string")return void n(new Error("Failed to read file ".concat(e.name)));const o=r.result.split(",")[1];t({fileName:e.name,contentType:e.type,size:e.size,fileData:o})},r.onerror=()=>n(new Error("Failed to read file ".concat(e.name))),r.readAsDataURL(e)}),Op=e=>Promise.all(e.map(Mp)),Np=e=>e<1024?"".concat(e," B"):e<1048576?"".concat((e/1024).toFixed(1)," KB"):"".concat((e/1048576).toFixed(1)," MB"),hr=e=>{let{onFileUpload:t,maxSizeMB:n=10,acceptedTypes:r="image/*,application/pdf,text/*,.doc,.docx",enableScreenshot:o=!1,className:i}=e;const[s,A]=Z(!1),[a,l]=Z([]),[c,u]=Z(null),d=ie(null),{captureScreenshot:p,isCapturing:h,isScreenCaptureAvailable:y}=Tp(),f=E=>{const P=document.createElement("div");P.setAttribute("aria-live","assertive"),P.setAttribute("aria-atomic","true"),P.className="sr-only",P.textContent=E,document.body.appendChild(P),setTimeout(()=>document.body.removeChild(P),1e3)},b=E=>{if(!E||E.length===0)return void Ro("FileUploadComponent: No valid files provided to handleFiles");let P;try{P=Array.from(E)}catch(T){return Ne("FileUploadComponent: Error converting files to array:",T),void f("Error processing selected files. Please try again.")}const D=[...a,...P];l(D);const Q=P.length,S=P.map(T=>T.name).join(", ");f("".concat(Q," file").concat(Q>1?"s":""," selected: ").concat(S)),setTimeout(()=>{const T=document.querySelector(".rcb-chat-content");T&&(T.scrollTop=T.scrollHeight)},100),t&&t(D)},v=E=>{E.preventDefault(),E.stopPropagation(),E.type==="dragenter"||E.type==="dragover"?A(!0):E.type==="dragleave"&&A(!1)},g=()=>{try{d.current&&d.current.click()}catch(E){Ne("FileUploadComponent: Error in handleButtonClick:",E),f("Error opening file selection dialog. Please try again.")}},x=()=>{u(null)},k=o&&y;return L.createElement("div",{className:"file-upload-container ".concat(i||""),style:{padding:"16px",margin:"8px 0"}},k&&L.createElement("div",{style:{display:"flex",justifyContent:"center",marginBottom:"10px"}},L.createElement("button",{onClick:E=>{E.preventDefault(),(async()=>{try{const P=await p();b([P]),f("Screenshot captured successfully")}catch{f("Error capturing screenshot. Please try again.")}})()},disabled:h,"aria-describedby":"screenshot-help","aria-label":h?"Taking screenshot, please wait":"Take a screenshot to attach",style:{display:"flex",alignItems:"center",gap:"8px",backgroundColor:"#107180",color:"white",border:"none",borderRadius:"5px",padding:"8px 12px",cursor:h?"not-allowed":"pointer",fontSize:"14px",fontWeight:"500",boxShadow:"0 1px 3px rgba(0,0,0,0.2)"}},L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},L.createElement("path",{d:"M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"}),L.createElement("circle",{cx:"12",cy:"13",r:"4"})),h?"Taking screenshot...":"Take screenshot..."),L.createElement("span",{id:"screenshot-help",className:"sr-only"},"Captures the current screen and adds it as an attachment")),L.createElement("div",{className:"file-upload-dropzone ".concat(s?"active":""),onDragEnter:v,onDragLeave:v,onDragOver:v,onDrop:E=>{var P;E.preventDefault(),E.stopPropagation(),A(!1);try{!((P=E.dataTransfer)===null||P===void 0)&&P.files&&E.dataTransfer.files.length>0&&b(E.dataTransfer.files)}catch(D){Ne("FileUploadComponent: Error in handleDrop:",D),f("Error processing dropped files. Please try again.")}},role:"button",tabIndex:0,"aria-label":"File upload area. Click to select files or drag and drop files here.","aria-describedby":"upload-instructions",onKeyDown:E=>{E.key!=="Enter"&&E.key!==" "||(E.preventDefault(),g())},style:{padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",backgroundColor:s?"#f0f8ff":"#fafafa",transition:"all 0.3s ease"}},L.createElement("input",{ref:d,type:"file",className:"file-input",onChange:E=>{var P;try{!((P=E.target)===null||P===void 0)&&P.files&&E.target.files.length>0&&b(E.target.files)}catch(D){Ne("FileUploadComponent: Error in handleFileSelect:",D),f("Error processing selected files. Please try again.")}},multiple:!0,style:{display:"none"},"aria-label":"Select files to upload",accept:r}),L.createElement("div",{className:"upload-content",onClick:g,style:{cursor:"pointer",flexDirection:"column",alignItems:"center",display:"flex",textAlign:"center",padding:"12px"}},L.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"}},L.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"}},L.createElement(Qp,null),L.createElement("p",{style:{margin:0,fontWeight:"bold"}},"Upload Files")),L.createElement("p",{id:"upload-instructions",style:{margin:0,fontSize:"14px",color:"#666"}},"Drag and drop files here or click to select. (Max ",n,"MB each)")),a.length>0&&L.createElement("div",{className:"selected-files",style:{display:"flex",flexWrap:"wrap",gap:"8px",marginTop:"12px",alignItems:"center"}},L.createElement("span",{style:{fontWeight:400,color:"#888",fontSize:"13px",marginRight:"8px",alignSelf:"center"}},"Selected files:"),a.map((E,P)=>L.createElement("span",{key:P,style:{background:"#fff",color:"#107180",borderRadius:"5px",padding:"4px 12px",fontSize:"14px",marginRight:"4px",marginBottom:"4px",border:"1px solid #ccc",display:"flex",alignItems:"center",gap:"6px",cursor:"pointer"},onClick:D=>{D.stopPropagation(),(Q=>{u(Q)})(E)}},L.createElement("span",{onClick:D=>{D.stopPropagation(),(Q=>{const S=a.filter((T,C)=>C!==Q);l(S),t&&t(S)})(P)},style:{cursor:"pointer",color:"#888",fontWeight:"bold",fontSize:"15px",marginRight:"4px",userSelect:"none",lineHeight:1},title:"Remove file","aria-label":"Remove ".concat(E.name)},"×"),E.name," (",Np(E.size),")"))))),(()=>{if(!c)return null;const E=c.type.startsWith("image/"),P=c.type.startsWith("text/"),D=c.type==="application/pdf";return L.createElement("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.7)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:1e3},onClick:x},L.createElement("div",{style:{backgroundColor:"white",padding:"20px",borderRadius:"8px",maxWidth:"90%",maxHeight:"90%",overflow:"auto",position:"relative"},onClick:Q=>Q.stopPropagation()},L.createElement("button",{onClick:x,style:{position:"absolute",top:"10px",right:"10px",background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#666"}},"×"),L.createElement("h3",{style:{marginTop:0,marginBottom:"16px"}},c.name),E&&L.createElement("img",{src:URL.createObjectURL(c),alt:c.name,style:{maxWidth:"100%",maxHeight:"70vh"}}),P&&L.createElement("pre",{style:{whiteSpace:"pre-wrap",wordWrap:"break-word",maxHeight:"70vh",overflow:"auto",padding:"16px",backgroundColor:"#f5f5f5",borderRadius:"4px"}},URL.createObjectURL(c)),D&&L.createElement("iframe",{src:URL.createObjectURL(c),style:{width:"100%",height:"70vh",border:"none"},title:c.name}),!E&&!P&&!D&&L.createElement("div",{style:{padding:"20px",textAlign:"center"}},"Preview not available for this file type")))})())};function Lp(e,t){if(!t||Object.keys(t).length===0)return e;const n={};for(const[r,o]of Object.entries(e)){let i=Object.assign({},o);if(i.chatDisabled===void 0){const s=!(!i.options&&!i.checkboxes);i.chatDisabled=s}n[r]=i}return n}function gr(e){return async t=>{const n=await e(t);await t.injectMessage(n)}}const Rp=L.forwardRef((e,t)=>{const[n,r]=L.useState(e.defaultOpen||!1),o=L.useRef(null);return L.useImperativeHandle(t,()=>({addMessage:i=>{var s;(s=o.current)===null||s===void 0||s.addMessage(i)},setBotEnabled:i=>{var s;(s=o.current)===null||s===void 0||s.setBotEnabled(i)},openChat:()=>{var i;r(!0),(i=o.current)===null||i===void 0||i.openChat()},closeChat:()=>{var i;r(!1),(i=o.current)===null||i===void 0||i.closeChat()},toggleChat:()=>{var i;r(s=>!s),(i=o.current)===null||i===void 0||i.toggleChat()}}),[]),L.createElement(zo,{ref:o,apiKey:e.apiKey,qaEndpoint:e.qaEndpoint,ratingEndpoint:e.ratingEndpoint,welcomeMessage:e.welcomeMessage,primaryColor:e.primaryColor,secondaryColor:e.secondaryColor,botName:e.botName,logo:e.logo,placeholder:e.placeholder,errorMessage:e.errorMessage,embedded:e.embedded,isLoggedIn:e.isLoggedIn,allowAnonAccess:e.allowAnonAccess,turnstileSiteKey:e.turnstileSiteKey,open:n,onOpenChange:r,footerText:e.footerText,footerLink:e.footerLink,tooltipText:e.tooltipText,onAnalyticsEvent:e.onAnalyticsEvent})});Rp.displayName="ProgrammaticQABot";const wt={QA_ENDPOINT:"http://localhost:8000/api/v1/query",RATING_ENDPOINT:"https://access-ai-grace1-external.ccs.uky.edu/access/chat/rating/",AGENT_ENDPOINT:"http://localhost:8000/api/v1",get CAPABILITIES_ENDPOINT(){return`${this.AGENT_ENDPOINT}/capabilities`},get AGENT_RATING_ENDPOINT(){return`${this.AGENT_ENDPOINT}/rating`},METRICS_API_ENDPOINT:"https://access-ai-grace1-external.ccs.uky.edu/access/xdmod/chat/api/",METRICS_RATING_ENDPOINT:"https://access-ai-grace1-external.ccs.uky.edu/access/xdmod/chat/rating/",METRICS_QUESTIONS_URL:"https://metrics.access-ci.org/qa_bot_faq",NETLIFY_BASE_URL:"https://access-jsm-api.netlify.app",DEFAULT_API_KEY:"4nn5l4T4TnkMdzsK0AwAtnGRcheBDnjawuAT42LaOLc",TURNSTILE_SITE_KEY:"1x00000000000000000000BB",ALLOW_ANON_ACCESS:!0},zt={BOT_NAME:"ACCESS Q&A",LOGO:"https://support.access-ci.org/themes/contrib/asp-theme/images/icons/ACCESS-arrrow.svg",WELCOME_MESSAGE:`Hello! I can answer questions about ACCESS resources, allocations, software, system status, events, and more. Click <strong>Show my options</strong> to see example queries, or just type your question.
|
|
59
59
|
|
|
60
|
-
<em>This assistant is powered by AI. Responses may not always be accurate. Do not share passwords or secrets.</em> <a href="https://support.access-ci.org/tools/access-qa-tool/privacy">Privacy Notice</a>`,LOGIN_URL:"/login",PRIMARY_COLOR:"#1a5b6e",SECONDARY_COLOR:"#107180",TOOLTIP:"Ask me about ACCESS! 😊"},xA={SESSION_ID:"access-qa-bot-session-id"};function Hp(
|
|
61
|
-
Attachments: ${e.length} file(s) attached`:""}const ln={SUPPORT:17,LOGIN_ACCESS:30,LOGIN_PROVIDER:31,SECURITY:26};async function
|
|
60
|
+
<em>This assistant is powered by AI. Responses may not always be accurate. Do not share passwords or secrets.</em> <a href="https://support.access-ci.org/tools/access-qa-tool/privacy">Privacy Notice</a>`,LOGIN_URL:"/login",PRIMARY_COLOR:"#1a5b6e",SECONDARY_COLOR:"#107180",TOOLTIP:"Ask me about ACCESS! 😊"},xA={SESSION_ID:"access-qa-bot-session-id"};function Hp({welcome:e,trackEvent:t}){return{start:{message:e,renderHtml:["BOT"],options:["Show my options"],chatDisabled:!1,path:n=>(t({type:"chatbot_menu_selected",selection:n.userInput}),"qa_loop")}}}let jo=null;function Up(e){jo=e}function J(){return jo?jo.ticketForm||{}:(console.warn("Form context not available, returning empty form"),{})}function Le(e={}){const t=J();return{...t,email:e.email||t.email,name:e.name||t.name,accessId:e.accessId||t.accessId}}function qo(e){return e&&e.length>0?`
|
|
61
|
+
Attachments: ${e.length} file(s) attached`:""}const ln={SUPPORT:17,LOGIN_ACCESS:30,LOGIN_PROVIDER:31,SECURITY:26};async function Fp(e,t="support",n=[]){const o={support:ln.SUPPORT,general_help:ln.SUPPORT,loginAccess:ln.LOGIN_ACCESS,loginProvider:ln.LOGIN_PROVIDER,security:ln.SECURITY}[t]||ln.SUPPORT,s={serviceDeskId:t==="security"?3:2,requestTypeId:o,requestFieldValues:{...e}};return n.length>0&&(s.attachments=await Op(n)),s}async function zp(e,t){var o,i;const r=`${wt.NETLIFY_BASE_URL}/api/v1/${t}`;try{const s=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!s.ok){let a="";try{const l=await s.text();try{const c=JSON.parse(l);a=c.message||c.error||l}catch{a=l}}catch{a=`HTTP ${s.status} ${s.statusText}`}return s.status===403?a="The ticket service is temporarily unavailable. Please try again later or contact support directly.":s.status===404?a="Ticket service not found. Please try again later.":s.status===500?a="Server error. Please try again later.":s.status===401&&(a="Authentication error with the ticket service. Please contact support."),{success:!1,status:s.status,error:a}}const A=await s.json();return{success:!0,ticketKey:(o=A.data)==null?void 0:o.ticketKey,ticketUrl:(i=A.data)==null?void 0:i.ticketUrl}}catch(s){return{success:!1,error:s instanceof Error?s.message:"Unknown error"}}}async function mr(e,t,n=[]){try{const r=await Fp(e,t,n);return await zp(r,t==="security"?"security-incidents":"tickets")}catch(r){return{success:!1,error:r instanceof Error?r.message:"Unknown error"}}}function Wo(e,t="ticket"){return e?e.success?e.ticketUrl&&e.ticketKey?`Your ${t} has been submitted successfully.
|
|
62
62
|
|
|
63
63
|
Ticket: <a href="${e.ticketUrl}" target="_blank">${e.ticketKey}</a>
|
|
64
64
|
|
|
@@ -68,7 +68,7 @@ Our support team will review your request and respond accordingly. Thank you for
|
|
|
68
68
|
|
|
69
69
|
Please try again or contact our support team directly.`:`We apologize, but there was an error submitting your ${t}.
|
|
70
70
|
|
|
71
|
-
Please try again or contact our support team directly.`}function yr(e){return!e||e.trim()===""?{success:!1,promptContent:"Email is required",promptDuration:3e3,promptType:"error"}:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?{success:!0}:{success:!1,promptContent:"Please enter a valid email address",promptDuration:3e3,promptType:"error"}}function Nn(){return()=>({success:!0})}function Ln(e){return!e||e.trim()===""||e.trim().toLowerCase()==="skip"?"":e.trim()}function
|
|
71
|
+
Please try again or contact our support team directly.`}function yr(e){return!e||e.trim()===""?{success:!1,promptContent:"Email is required",promptDuration:3e3,promptType:"error"}:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?{success:!0}:{success:!1,promptContent:"Please enter a valid email address",promptDuration:3e3,promptType:"error"}}function Nn(){return()=>({success:!0})}function Ln(e){return!e||e.trim()===""||e.trim().toLowerCase()==="skip"?"":e.trim()}function jp({ticketForm:e,setTicketForm:t,userInfo:n,trackEvent:r}){let o=null;const i=async(A,a=[])=>{o=await mr(A,"loginAccess",a),o.success?(t(l=>({...l,ticketKey:o.ticketKey,ticketUrl:o.ticketUrl})),r({type:"chatbot_ticket_submitted",ticketType:"access_login",success:!0,ticketKey:o.ticketKey})):(t(l=>({...l,submissionError:o.error})),r({type:"chatbot_ticket_error",ticketType:"access_login",errorType:o.error||"unknown"}))};return{access_help:{message:`If you're having trouble logging into the ACCESS website, here are some common issues:
|
|
72
72
|
|
|
73
73
|
• Make sure you're using a supported browser (Chrome, Firefox, Safari)
|
|
74
74
|
• Clear your browser cookies and cache
|
|
@@ -83,7 +83,7 @@ Identity Provider: ${a.identityProvider||"Not provided"}
|
|
|
83
83
|
Browser: ${a.browser||"Not provided"}
|
|
84
84
|
Issue Description: ${a.description||"Not provided"}${c}
|
|
85
85
|
|
|
86
|
-
Would you like to submit this ticket?`},options:["Submit Ticket","Back to Main Menu"],renderHtml:["BOT","USER"],function:async A=>{if(A.userInput==="Submit Ticket"){const a=J(),l=Le(n),c={email:l.email||"",name:l.name||"",accessId:l.accessId||"",description:a.description||"",identityProvider:a.identityProvider||"",browser:a.browser||""};await i(c,a.uploadedFiles||[])}},path:A=>A.userInput==="Submit Ticket"?"access_login_success":"start"},access_login_success:{message:gr(()=>Wo(o,"ACCESS login ticket")),options:["Back to Main Menu"],renderHtml:["BOT"],path:"start"}}}function
|
|
86
|
+
Would you like to submit this ticket?`},options:["Submit Ticket","Back to Main Menu"],renderHtml:["BOT","USER"],function:async A=>{if(A.userInput==="Submit Ticket"){const a=J(),l=Le(n),c={email:l.email||"",name:l.name||"",accessId:l.accessId||"",description:a.description||"",identityProvider:a.identityProvider||"",browser:a.browser||""};await i(c,a.uploadedFiles||[])}},path:A=>A.userInput==="Submit Ticket"?"access_login_success":"start"},access_login_success:{message:gr(()=>Wo(o,"ACCESS login ticket")),options:["Back to Main Menu"],renderHtml:["BOT"],path:"start"}}}function qp({ticketForm:e,setTicketForm:t,userInfo:n,trackEvent:r}){let o=null;const i=async(A,a=[])=>{o=await mr(A,"loginProvider",a),o.success?(t(l=>({...l,ticketKey:o.ticketKey,ticketUrl:o.ticketUrl})),r({type:"chatbot_ticket_submitted",ticketType:"resource_login",success:!0,ticketKey:o.ticketKey})):(t(l=>({...l,submissionError:o.error})),r({type:"chatbot_ticket_error",ticketType:"resource_login",errorType:o.error||"unknown"}))};return{resource_help:{message:`If you're having trouble logging into an affiliated infrastructure or resource provider, here are some common issues:
|
|
87
87
|
|
|
88
88
|
• Ensure your allocation is active
|
|
89
89
|
• Confirm you have the correct username for that resource
|
|
@@ -98,7 +98,7 @@ Resource: ${a.resource||"Not provided"}
|
|
|
98
98
|
Resource User ID: ${a.userIdResource||"Not provided"}
|
|
99
99
|
Issue Description: ${a.description||"Not provided"}${c}
|
|
100
100
|
|
|
101
|
-
Would you like to submit this ticket?`},options:["Submit Ticket","Back to Main Menu"],function:async A=>{if(A.userInput==="Submit Ticket"){const a=J(),l=Le(n),c={email:l.email||"",name:l.name||"",accessId:l.accessId||"",accessResource:a.resource||"",description:a.description||"",userIdAtResource:a.userIdResource||""};await i(c,a.uploadedFiles||[])}},path:A=>A.userInput==="Submit Ticket"?"resource_login_success":"start"},resource_login_success:{message:gr(()=>Wo(o,"resource login ticket")),options:["Back to Main Menu"],renderHtml:["BOT"],path:"start"}}}const Gp=[" C, C++","Abaqus","ACCESS","ACCESS-credits","ACCESS-website","Accounts","ACLS","Adding users","Affiliations","Affinity Groups","AI","Algorithms","Allocation extension","Allocation Management","Allocation proposal","Allocation Time","Allocation users","AMBER","AMIE","Anaconda","Analysis","API","Application Status","ARCGIS","Architecture","Archiving","Astrophysics","ATLAS","Authentication","AWS","AZURE","Backup","BASH","Batch Jobs","Benchmarking","Big Data","Bioinformatics","Biology","Ceph","CFD","cgroups","CHARMM","Checkpoint","cilogon","citation","Cloud","Cloud Computing","Cloud Lab","Cloud Storage","Cluster Management","Cluster Support","CMMC","Community Outreach","Compiling","Composible Systems","Computataional Chemistry","COMSOL","Conda","Condo","Containers","Core dump","Core hours","CP2K","CPU architecture","CPU bound","CUDA","Cybersecurity","CYVERSE","Data","Data Storage","Data-access-protocols","Data-analysis","Data-compliance","Data-lifecycle","Data-management","Data-management-software","Data-provenance","Data-reproducibility","Data-retention","Data-science","Data-sharing","Data-transfer","Data-wrangling","Database-update","Debugging","Debugging, Optimizatio and Profiling","Deep-learning","Dependencies","Deployment","DFT","Distributed-computing","DNS","Docker","Documentation","DOI","DTN","Easybuild","Email","Encryption","Environment-modules","Errors","Extension","FastX","Federated-authentication","File transfers","File-formats","File-limits","File-systems","File-transfer","Finite-element-analysis","Firewall","Fortran","Frameworks and IDE's","GAMESS","Gateways","GATK","Gaussian","GCC","Genomics","GIS","Git","Globus","GPFS","GPU","Gravitational-waves","Gridengine","GROMACS","Hadoop","Hardware","Image-processing","Infiniband","Interactive-mode","Interconnect","IO-Issue","ISILON","Java","Jekyll","Jetstream","Job-accounting","Job-array","Job-charging","Job-failure","Job-sizing","Job-submission","Julia","Jupyterhub","Key-management","Kubernetes","KyRIC","LAMMPS","Library-paths","License","Linear-programming","Linux","LMOD","login","LSF","Lustre","Machine-learning","Management","Materials-science","Mathematica","MATLAB","Memory","Metadata","Modules","Molecular-dynamics","Monte-carlo","MPI","NAMD","NetCDF","Networking","Neural-networks","NFS","NLP","NoMachine","Nvidia","Oceanography","OnDemnad","Open-science-grid","Open-storage-network","OpenCV","Openfoam","OpenMP","OpenMPI","OpenSHIFT","Openstack","Optimization","OS","OSG","Parallelization","Parameter-sweeps","Paraview","Particle-physics","password","PBS","Pegasus","Pending-jobs","Performance-tuning","Permissions","Physiology","PIP","PODMAN","Portals","Pre-emption","Professional and Workforce Development","Professional-development","Profile","Profiling","Programming","Programming Languages","Programming-best-practices","Project-management","Project-renewal","Provisioning","Pthreads","Publication-database","Putty","Python","Pytorch","Quantum-computing","Quantum-mechanics","Quota","R","RDP","React","Reporting","Research-facilitation","Research-grants","Resources","Rstudio-server","S3","Samba","SAS","Scaling","Schedulers","Scheduling","Science DMZ","Science Gateways","Scikit-learn","Scratch","screen","scripting","SDN","Secure Computing and Data","Secure-data-architecture","Serverless-hpc","setup","sftp","SGE","Shell Scripting","Shifter","Singularity","SLURM","SMB","Smrtanalysis","Software Installations","Software-carpentry","SPACK","SPARK","Spectrum-scale","SPSS","SQL","SSH","Stampede2","STATA","Storage","Supplement","Support","TCP","Technical-training-for-hpc","Tensorflow","Terminal-emulation-and-window-management","Tickets","Timing-issue","TMUX","Tools","Training","Transfer SUs","Trinity","Tuning","Unix-environment","Upgrading","Vectorization","Version-control","vim","VNC","VPN","Workflow","Workforce-development","X11","Xalt","XDMoD","XML","XSEDE","I don't see a relevant keyword"],Yp=["ACES","Anvil","Bridges-2","DARWIN","Delta","DeltaAI","Derecho","Expanse","FASTER","Granite","Jetstream2","KyRIC","Launch","Neocortex","Ookami","Open Science Grid","Open Storage Network","Ranch","Stampede3"];function Kp({ticketForm:e,setTicketForm:t,userInfo:n,trackEvent:r}){let o=null;const i=async(A,a=[])=>{o=await mr(A,"support",a),o.success?(t(l=>({...l,ticketKey:o.ticketKey,ticketUrl:o.ticketUrl})),r({type:"chatbot_ticket_submitted",ticketType:"general_help",success:!0,ticketKey:o.ticketKey})):(t(l=>({...l,submissionError:o.error})),r({type:"chatbot_ticket_error",ticketType:"general_help",errorType:o.error||"unknown"}))};return{general_help_summary_subject:{message:"Provide a short title for your ticket.",function:A=>{const a=J();t({...a,summary:A.userInput,email:n.email||a.email,name:n.name||a.name,accessId:n.accessId||a.accessId}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"title"})},path:"general_help_category"},general_help_category:{message:"What type of issue are you experiencing?",options:["User Account Question","Allocation Question","User Support Question","CSSN/CCEP Question","Training Question","Metrics Question","OnDemand Question","Pegasus Question","XDMoD Question","Some Other Question"],function:A=>{const a=J();t({...a,category:A.userInput}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"category"})},path:"general_help_description"},general_help_description:{message:"Please describe your issue.",function:A=>{const a=J();t({...a,description:A.userInput}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"description"})},path:"general_help_attachment"},general_help_attachment:{message:"Would you like to attach a file to your ticket?",options:["Yes","No"],function:A=>{const a=J();t({...a,wantsAttachment:A.userInput}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"attachment_choice"})},path:A=>A.userInput==="Yes"?"general_help_upload":"general_help_resource"},general_help_upload:{message:"Please upload your file.",component:_(hr,{onFileUpload:A=>{t(a=>({...a,uploadedFiles:A})),A.forEach(a=>{r({type:"chatbot_file_uploaded",fileType:a.type||"unknown",fileSize:a.size})})},enableScreenshot:!0,maxSizeMB:10}),options:["Continue"],function:()=>{const A=J();t({...A,uploadConfirmed:!0}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"file_upload"})},path:"general_help_resource"},general_help_resource:{message:"Does your problem involve an ACCESS Resource?",options:["Yes","No"],function:A=>{const a=J();t({...a,involvesResource:A.userInput.toLowerCase()}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"resource_choice"})},path:A=>A.userInput==="Yes"?"general_help_resource_details":"general_help_keywords"},general_help_resource_details:{message:"Please select the ACCESS Resource involved with your issue:",options:Yp,function:A=>{const a=J();t({...a,resourceDetails:A.userInput}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"resource_selection"})},path:"general_help_user_id_at_resource"},general_help_user_id_at_resource:{message:"What is your User ID at the selected resource(s)? (Optional - press Enter to skip)",validateTextInput:Nn(),function:A=>{const a=J();t({...a,userIdAtResource:Ln(A.userInput)}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"resource_user_id"})},path:"general_help_keywords"},general_help_keywords:{message:"Please add up to 5 keywords to help route your ticket.",checkboxes:{items:Gp,min:0,max:5},function:A=>{const a=J();t({...a,keywords:A.userInput}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"keywords"})},path:A=>A.userInput&&A.userInput.includes("I don't see a relevant keyword")?"general_help_additional_keywords":"general_help_priority"},general_help_additional_keywords:{message:"Please enter additional keywords, separated by commas:",function:A=>{const a=J(),l=a.keywords||[],c=A.userInput,d=(Array.isArray(l)?[...l]:String(l).split(",").map(h=>h.trim())).filter(h=>h!=="I don't see a relevant keyword"),p=d.length>0?[...d,c].join(", "):c;t({...a,keywords:p,suggestedKeyword:c}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"additional_keywords"})},path:"general_help_priority"},general_help_priority:{message:"Please select a priority for your issue:",options:["Lowest","Low","Medium","High","Highest"],function:A=>{const a=J();t({...a,priority:A.userInput.toLowerCase()}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"priority"})},path:()=>{const A=Le(n);return A.email?A.name?A.accessId?"general_help_ticket_summary":"general_help_accessid":"general_help_name":"general_help_email"}},general_help_email:{message:"What is your email address?",validateTextInput:yr,function:A=>{const a=J();t({...a,email:A.userInput}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"email"})},path:()=>{const A=Le(n);return A.name?A.accessId?"general_help_ticket_summary":"general_help_accessid":"general_help_name"}},general_help_name:{message:"What is your name?",function:A=>{const a=J();t({...a,name:A.userInput}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"name"})},path:()=>Le(n).accessId?"general_help_ticket_summary":"general_help_accessid"},general_help_accessid:{message:"What is your ACCESS ID? (Optional - press Enter to skip)",validateTextInput:Nn(),function:A=>{const a=J();t({...a,accessId:Ln(A.userInput)}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"access_id"})},path:"general_help_ticket_summary"},general_help_ticket_summary:{message:A=>{const a=J(),l=Le(n),c=qo(a.uploadedFiles);let u=l.accessId;A.prevPath==="general_help_accessid"&&A.userInput&&(u=A.userInput);let d="";return a.involvesResource==="yes"&&(d=`
|
|
101
|
+
Would you like to submit this ticket?`},options:["Submit Ticket","Back to Main Menu"],function:async A=>{if(A.userInput==="Submit Ticket"){const a=J(),l=Le(n),c={email:l.email||"",name:l.name||"",accessId:l.accessId||"",accessResource:a.resource||"",description:a.description||"",userIdAtResource:a.userIdResource||""};await i(c,a.uploadedFiles||[])}},path:A=>A.userInput==="Submit Ticket"?"resource_login_success":"start"},resource_login_success:{message:gr(()=>Wo(o,"resource login ticket")),options:["Back to Main Menu"],renderHtml:["BOT"],path:"start"}}}const Wp=[" C, C++","Abaqus","ACCESS","ACCESS-credits","ACCESS-website","Accounts","ACLS","Adding users","Affiliations","Affinity Groups","AI","Algorithms","Allocation extension","Allocation Management","Allocation proposal","Allocation Time","Allocation users","AMBER","AMIE","Anaconda","Analysis","API","Application Status","ARCGIS","Architecture","Archiving","Astrophysics","ATLAS","Authentication","AWS","AZURE","Backup","BASH","Batch Jobs","Benchmarking","Big Data","Bioinformatics","Biology","Ceph","CFD","cgroups","CHARMM","Checkpoint","cilogon","citation","Cloud","Cloud Computing","Cloud Lab","Cloud Storage","Cluster Management","Cluster Support","CMMC","Community Outreach","Compiling","Composible Systems","Computataional Chemistry","COMSOL","Conda","Condo","Containers","Core dump","Core hours","CP2K","CPU architecture","CPU bound","CUDA","Cybersecurity","CYVERSE","Data","Data Storage","Data-access-protocols","Data-analysis","Data-compliance","Data-lifecycle","Data-management","Data-management-software","Data-provenance","Data-reproducibility","Data-retention","Data-science","Data-sharing","Data-transfer","Data-wrangling","Database-update","Debugging","Debugging, Optimizatio and Profiling","Deep-learning","Dependencies","Deployment","DFT","Distributed-computing","DNS","Docker","Documentation","DOI","DTN","Easybuild","Email","Encryption","Environment-modules","Errors","Extension","FastX","Federated-authentication","File transfers","File-formats","File-limits","File-systems","File-transfer","Finite-element-analysis","Firewall","Fortran","Frameworks and IDE's","GAMESS","Gateways","GATK","Gaussian","GCC","Genomics","GIS","Git","Globus","GPFS","GPU","Gravitational-waves","Gridengine","GROMACS","Hadoop","Hardware","Image-processing","Infiniband","Interactive-mode","Interconnect","IO-Issue","ISILON","Java","Jekyll","Jetstream","Job-accounting","Job-array","Job-charging","Job-failure","Job-sizing","Job-submission","Julia","Jupyterhub","Key-management","Kubernetes","KyRIC","LAMMPS","Library-paths","License","Linear-programming","Linux","LMOD","login","LSF","Lustre","Machine-learning","Management","Materials-science","Mathematica","MATLAB","Memory","Metadata","Modules","Molecular-dynamics","Monte-carlo","MPI","NAMD","NetCDF","Networking","Neural-networks","NFS","NLP","NoMachine","Nvidia","Oceanography","OnDemnad","Open-science-grid","Open-storage-network","OpenCV","Openfoam","OpenMP","OpenMPI","OpenSHIFT","Openstack","Optimization","OS","OSG","Parallelization","Parameter-sweeps","Paraview","Particle-physics","password","PBS","Pegasus","Pending-jobs","Performance-tuning","Permissions","Physiology","PIP","PODMAN","Portals","Pre-emption","Professional and Workforce Development","Professional-development","Profile","Profiling","Programming","Programming Languages","Programming-best-practices","Project-management","Project-renewal","Provisioning","Pthreads","Publication-database","Putty","Python","Pytorch","Quantum-computing","Quantum-mechanics","Quota","R","RDP","React","Reporting","Research-facilitation","Research-grants","Resources","Rstudio-server","S3","Samba","SAS","Scaling","Schedulers","Scheduling","Science DMZ","Science Gateways","Scikit-learn","Scratch","screen","scripting","SDN","Secure Computing and Data","Secure-data-architecture","Serverless-hpc","setup","sftp","SGE","Shell Scripting","Shifter","Singularity","SLURM","SMB","Smrtanalysis","Software Installations","Software-carpentry","SPACK","SPARK","Spectrum-scale","SPSS","SQL","SSH","Stampede2","STATA","Storage","Supplement","Support","TCP","Technical-training-for-hpc","Tensorflow","Terminal-emulation-and-window-management","Tickets","Timing-issue","TMUX","Tools","Training","Transfer SUs","Trinity","Tuning","Unix-environment","Upgrading","Vectorization","Version-control","vim","VNC","VPN","Workflow","Workforce-development","X11","Xalt","XDMoD","XML","XSEDE","I don't see a relevant keyword"],Gp=["ACES","Anvil","Bridges-2","DARWIN","Delta","DeltaAI","Derecho","Expanse","FASTER","Granite","Jetstream2","KyRIC","Launch","Neocortex","Ookami","Open Science Grid","Open Storage Network","Ranch","Stampede3"];function Yp({ticketForm:e,setTicketForm:t,userInfo:n,trackEvent:r}){let o=null;const i=async(A,a=[])=>{o=await mr(A,"support",a),o.success?(t(l=>({...l,ticketKey:o.ticketKey,ticketUrl:o.ticketUrl})),r({type:"chatbot_ticket_submitted",ticketType:"general_help",success:!0,ticketKey:o.ticketKey})):(t(l=>({...l,submissionError:o.error})),r({type:"chatbot_ticket_error",ticketType:"general_help",errorType:o.error||"unknown"}))};return{general_help_summary_subject:{message:"Provide a short title for your ticket.",function:A=>{const a=J();t({...a,summary:A.userInput,email:n.email||a.email,name:n.name||a.name,accessId:n.accessId||a.accessId}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"title"})},path:"general_help_category"},general_help_category:{message:"What type of issue are you experiencing?",options:["User Account Question","Allocation Question","User Support Question","CSSN/CCEP Question","Training Question","Metrics Question","OnDemand Question","Pegasus Question","XDMoD Question","Some Other Question"],function:A=>{const a=J();t({...a,category:A.userInput}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"category"})},path:"general_help_description"},general_help_description:{message:"Please describe your issue.",function:A=>{const a=J();t({...a,description:A.userInput}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"description"})},path:"general_help_attachment"},general_help_attachment:{message:"Would you like to attach a file to your ticket?",options:["Yes","No"],function:A=>{const a=J();t({...a,wantsAttachment:A.userInput}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"attachment_choice"})},path:A=>A.userInput==="Yes"?"general_help_upload":"general_help_resource"},general_help_upload:{message:"Please upload your file.",component:_(hr,{onFileUpload:A=>{t(a=>({...a,uploadedFiles:A})),A.forEach(a=>{r({type:"chatbot_file_uploaded",fileType:a.type||"unknown",fileSize:a.size})})},enableScreenshot:!0,maxSizeMB:10}),options:["Continue"],function:()=>{const A=J();t({...A,uploadConfirmed:!0}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"file_upload"})},path:"general_help_resource"},general_help_resource:{message:"Does your problem involve an ACCESS Resource?",options:["Yes","No"],function:A=>{const a=J();t({...a,involvesResource:A.userInput.toLowerCase()}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"resource_choice"})},path:A=>A.userInput==="Yes"?"general_help_resource_details":"general_help_keywords"},general_help_resource_details:{message:"Please select the ACCESS Resource involved with your issue:",options:Gp,function:A=>{const a=J();t({...a,resourceDetails:A.userInput}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"resource_selection"})},path:"general_help_user_id_at_resource"},general_help_user_id_at_resource:{message:"What is your User ID at the selected resource(s)? (Optional - press Enter to skip)",validateTextInput:Nn(),function:A=>{const a=J();t({...a,userIdAtResource:Ln(A.userInput)}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"resource_user_id"})},path:"general_help_keywords"},general_help_keywords:{message:"Please add up to 5 keywords to help route your ticket.",checkboxes:{items:Wp,min:0,max:5},function:A=>{const a=J();t({...a,keywords:A.userInput}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"keywords"})},path:A=>A.userInput&&A.userInput.includes("I don't see a relevant keyword")?"general_help_additional_keywords":"general_help_priority"},general_help_additional_keywords:{message:"Please enter additional keywords, separated by commas:",function:A=>{const a=J(),l=a.keywords||[],c=A.userInput,d=(Array.isArray(l)?[...l]:String(l).split(",").map(h=>h.trim())).filter(h=>h!=="I don't see a relevant keyword"),p=d.length>0?[...d,c].join(", "):c;t({...a,keywords:p,suggestedKeyword:c}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"additional_keywords"})},path:"general_help_priority"},general_help_priority:{message:"Please select a priority for your issue:",options:["Lowest","Low","Medium","High","Highest"],function:A=>{const a=J();t({...a,priority:A.userInput.toLowerCase()}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"priority"})},path:()=>{const A=Le(n);return A.email?A.name?A.accessId?"general_help_ticket_summary":"general_help_accessid":"general_help_name":"general_help_email"}},general_help_email:{message:"What is your email address?",validateTextInput:yr,function:A=>{const a=J();t({...a,email:A.userInput}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"email"})},path:()=>{const A=Le(n);return A.name?A.accessId?"general_help_ticket_summary":"general_help_accessid":"general_help_name"}},general_help_name:{message:"What is your name?",function:A=>{const a=J();t({...a,name:A.userInput}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"name"})},path:()=>Le(n).accessId?"general_help_ticket_summary":"general_help_accessid"},general_help_accessid:{message:"What is your ACCESS ID? (Optional - press Enter to skip)",validateTextInput:Nn(),function:A=>{const a=J();t({...a,accessId:Ln(A.userInput)}),r({type:"chatbot_ticket_step",ticketType:"general_help",step:"access_id"})},path:"general_help_ticket_summary"},general_help_ticket_summary:{message:A=>{const a=J(),l=Le(n),c=qo(a.uploadedFiles);let u=l.accessId;A.prevPath==="general_help_accessid"&&A.userInput&&(u=A.userInput);let d="";return a.involvesResource==="yes"&&(d=`
|
|
102
102
|
Resource: ${a.resourceDetails||"Not specified"}`,a.userIdAtResource&&(d+=`
|
|
103
103
|
User ID at Resource: ${a.userIdAtResource}`)),`Thank you for providing your issue details. Here's a summary:
|
|
104
104
|
|
|
@@ -111,7 +111,7 @@ Priority: ${a.priority||"Not provided"}
|
|
|
111
111
|
Keywords: ${a.keywords||"Not provided"}
|
|
112
112
|
Issue Description: ${a.description||"Not provided"}${d}${c}
|
|
113
113
|
|
|
114
|
-
Would you like to submit this ticket?`},options:["Submit Ticket","Back to Main Menu"],function:async A=>{if(A.userInput==="Submit Ticket"){const a=J(),l=Le(n),c={email:l.email||"",summary:a.summary||"General Support Ticket",description:a.description||"",priority:a.priority||"medium",accessId:l.accessId||"",name:l.name||"",issueType:a.category||"",hasResourceProblem:a.involvesResource==="yes"?"Yes":"No",userIdAtResource:a.userIdAtResource||"",resourceName:a.resourceDetails||"",keywords:a.keywords||"",noRelevantKeyword:a.suggestedKeyword?"checked":"",suggestedKeyword:a.suggestedKeyword||""};await i(c,a.uploadedFiles||[])}},path:A=>A.userInput==="Submit Ticket"?"general_help_success":"start"},general_help_success:{message:gr(()=>Wo(o,"support ticket")),options:["Back to Main Menu"],renderHtml:["BOT"],path:"start"}}}const
|
|
114
|
+
Would you like to submit this ticket?`},options:["Submit Ticket","Back to Main Menu"],function:async A=>{if(A.userInput==="Submit Ticket"){const a=J(),l=Le(n),c={email:l.email||"",summary:a.summary||"General Support Ticket",description:a.description||"",priority:a.priority||"medium",accessId:l.accessId||"",name:l.name||"",issueType:a.category||"",hasResourceProblem:a.involvesResource==="yes"?"Yes":"No",userIdAtResource:a.userIdAtResource||"",resourceName:a.resourceDetails||"",keywords:a.keywords||"",noRelevantKeyword:a.suggestedKeyword?"checked":"",suggestedKeyword:a.suggestedKeyword||""};await i(c,a.uploadedFiles||[])}},path:A=>A.userInput==="Submit Ticket"?"general_help_success":"start"},general_help_success:{message:gr(()=>Wo(o,"support ticket")),options:["Back to Main Menu"],renderHtml:["BOT"],path:"start"}}}const Kp={"Logging into ACCESS website":"access_login","Logging into a resource":"resource_login","Another question":"general_help"};function Vp({ticketForm:e,setTicketForm:t,userInfo:n,trackEvent:r}){const o=jp({ticketForm:e,setTicketForm:t,userInfo:n,trackEvent:r}),i=qp({ticketForm:e,setTicketForm:t,userInfo:n,trackEvent:r}),s=Yp({ticketForm:e,setTicketForm:t,userInfo:n,trackEvent:r});return{help_ticket:{message:"What is your help ticket related to?",options:["Logging into ACCESS website","Logging into a resource","Another question"],function:A=>{t(a=>({...a,ticketType:A.userInput})),r({type:"chatbot_ticket_started",ticketType:Kp[A.userInput]||A.userInput})},path:A=>A.userInput==="Logging into ACCESS website"?"access_help":A.userInput==="Logging into a resource"?"resource_help":A.userInput==="Another question"?"general_help_summary_subject":"help_ticket"},...o,...i,...s}}function jt(e){const t=J();return{...t,email:e.email||t.email,name:e.name||t.name,accessId:e.accessId||t.accessId}}function Xp(e){return e?e.success?e.ticketUrl&&e.ticketKey?`Your security incident report has been submitted successfully.
|
|
115
115
|
|
|
116
116
|
Ticket: <a href="${e.ticketUrl}" target="_blank">${e.ticketKey}</a>
|
|
117
117
|
|
|
@@ -121,7 +121,7 @@ Our cybersecurity team will review your report and respond accordingly. Thank yo
|
|
|
121
121
|
|
|
122
122
|
Please try again or contact our cybersecurity team directly.`:`We apologize, but there was an error submitting your security incident report.
|
|
123
123
|
|
|
124
|
-
Please try again or contact our cybersecurity team directly.`}function
|
|
124
|
+
Please try again or contact our cybersecurity team directly.`}function $p({ticketForm:e,setTicketForm:t,userInfo:n,trackEvent:r}){let o=null,i=null;const s=async(a,l=[],c)=>{i=await mr(a,"security",l),i.success?(t(u=>({...u,ticketKey:i.ticketKey,ticketUrl:i.ticketUrl})),r({type:"chatbot_security_submitted",success:!0,priority:c||"unknown",ticketKey:i.ticketKey})):(t(u=>({...u,submissionError:i.error})),r({type:"chatbot_ticket_error",ticketType:"security",errorType:i.error||"unknown"}))};return{security_incident:{message:"You're reporting a security incident. Please provide a brief summary of the security concern.",function:a=>{const l=J();t({...l,summary:a.userInput,email:n.email||l.email,name:n.name||l.name,accessId:n.accessId||l.accessId}),r({type:"chatbot_ticket_step",ticketType:"security",step:"summary"})},path:"security_priority"},security_priority:{message:"What is the priority level of this security incident?",options:["Critical","High","Medium","Low"],function:a=>{const l=J();t({...l,priority:a.userInput.toLowerCase()}),r({type:"chatbot_ticket_step",ticketType:"security",step:"priority"})},path:"security_description"},security_description:{message:"Please provide a detailed description of the security incident or concern.",function:a=>{const l=J();t({...l,description:a.userInput}),r({type:"chatbot_ticket_step",ticketType:"security",step:"description"})},path:"security_attachment"},security_attachment:{message:"Do you have any files (screenshots, logs, etc.) that would help with this security incident?",options:["Yes","No"],function:a=>{const l=J();t({...l,wantsAttachment:a.userInput}),r({type:"chatbot_ticket_step",ticketType:"security",step:"attachment_choice"})},path:a=>a.userInput==="Yes"?"security_upload":"security_contact_check"},security_upload:{message:"Please upload your files.",component:_(hr,{onFileUpload:a=>{t(l=>({...l,uploadedFiles:a})),a.forEach(l=>{r({type:"chatbot_file_uploaded",fileType:l.type||"unknown",fileSize:l.size})})},enableScreenshot:!0,maxSizeMB:10}),options:["Continue"],function:()=>{const a=J();t({...a,uploadConfirmed:!0}),r({type:"chatbot_ticket_step",ticketType:"security",step:"file_upload"})},path:"security_contact_check"},security_contact_check:{message:()=>{const a=jt(n);return a.name&&a.email&&a.accessId?`I have your contact information:
|
|
125
125
|
|
|
126
126
|
Name: ${a.name}
|
|
127
127
|
Email: ${a.email}
|
|
@@ -137,9 +137,9 @@ Email: ${c.email||"Not provided"}
|
|
|
137
137
|
ACCESS ID: ${d}
|
|
138
138
|
Description: ${c.description||"Not provided"}${u}
|
|
139
139
|
|
|
140
|
-
Would you like to submit this security incident report?`},options:["Submit Security Report","Back to Main Menu"],function:async a=>{if(a.userInput==="Submit Security Report"){const l=J(),c=jt(n),u={...l,name:c.name||l.name,email:c.email||l.email,accessId:o||c.accessId||l.accessId},d={summary:u.summary||"",priority:u.priority||"",description:u.description||"",name:u.name||"",email:u.email||"",accessId:u.accessId||""};await s(d,l.uploadedFiles||[],u.priority)}},path:a=>a.userInput==="Submit Security Report"?"security_success":"start"},security_success:{message:gr(()
|
|
140
|
+
Would you like to submit this security incident report?`},options:["Submit Security Report","Back to Main Menu"],function:async a=>{if(a.userInput==="Submit Security Report"){const l=J(),c=jt(n),u={...l,name:c.name||l.name,email:c.email||l.email,accessId:o||c.accessId||l.accessId},d={summary:u.summary||"",priority:u.priority||"",description:u.description||"",name:u.name||"",email:u.email||"",accessId:u.accessId||""};await s(d,l.uploadedFiles||[],u.priority)}},path:a=>a.userInput==="Submit Security Report"?"security_success":"start"},security_success:{message:gr(()=>Xp(i)),options:["Back to Main Menu"],renderHtml:["BOT"],path:"start"}}}const Re=[];for(let e=0;e<256;++e)Re.push((e+256).toString(16).slice(1));function Jp(e,t=0){return(Re[e[t+0]]+Re[e[t+1]]+Re[e[t+2]]+Re[e[t+3]]+"-"+Re[e[t+4]]+Re[e[t+5]]+"-"+Re[e[t+6]]+Re[e[t+7]]+"-"+Re[e[t+8]]+Re[e[t+9]]+"-"+Re[e[t+10]]+Re[e[t+11]]+Re[e[t+12]]+Re[e[t+13]]+Re[e[t+14]]+Re[e[t+15]]).toLowerCase()}let Go;const Zp=new Uint8Array(16);function ef(){if(!Go){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Go=crypto.getRandomValues.bind(crypto)}return Go(Zp)}const EA={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Yo(e,t,n){var o;if(EA.randomUUID&&!e)return EA.randomUUID();e=e||{};const r=e.random??((o=e.rng)==null?void 0:o.call(e))??ef();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Jp(r)}function cf(e){return e}function tf({sessionId:e,apiKey:t,trackEvent:n}){let r=null;return{metrics_intro:{message:`Please type your question about usage and performance metrics (XDMoD) below. You can see some <a target="_blank" href="${wt.METRICS_QUESTIONS_URL}">examples here</a>.
|
|
141
141
|
|
|
142
|
-
<em>This assistant is powered by AI. Responses may not always be accurate. Do not share passwords or secrets.</em> <a href="https://support.access-ci.org/tools/access-qa-tool/privacy">Privacy Notice</a>`,renderHtml:["BOT"],path:"metrics_loop"},metrics_loop:{message:async o=>{const{userInput:i}=o;if(i==="👍 Helpful"||i==="👎 Not helpful"){if(t&&e&&r){const A={"Content-Type":"application/json","X-Origin":"metrics","X-API-KEY":t,"X-Session-ID":e,"X-Query-ID":r,"X-Feedback":i==="👍 Helpful"?"1":"0"};try{await fetch(wt.METRICS_RATING_ENDPOINT,{method:"POST",headers:A})}catch(a){console.error("Error sending metrics feedback:",a)}}return"Thanks for the feedback! Ask another question about usage and performance metrics (XDMoD) or start a new chat."}else try{const s=Yo();r=s,n({type:"chatbot_metrics_question_sent",queryId:s});const A={"Content-Type":"application/json","X-Origin":"metrics","X-API-KEY":t,"X-Session-ID":e,"X-Query-ID":s},c=(await(await fetch(wt.METRICS_API_ENDPOINT,{method:"POST",headers:A,body:JSON.stringify({query:i})})).json()).response,u=c;return await o.injectMessage(u),setTimeout(async()=>{await o.injectMessage("Ask another question about usage and performance metrics (XDMoD) or start a new chat.")},100),null}catch(s){return console.error("Error in metrics flow:",s),"I'm sorry, there was an error processing your question. Please try again."}},renderMarkdown:["BOT"],options:o=>o.userInput==="👍 Helpful"||o.userInput==="👎 Not helpful"?[]:["👍 Helpful","👎 Not helpful"],chatDisabled:!1,path:"metrics_loop"}}}function
|
|
142
|
+
<em>This assistant is powered by AI. Responses may not always be accurate. Do not share passwords or secrets.</em> <a href="https://support.access-ci.org/tools/access-qa-tool/privacy">Privacy Notice</a>`,renderHtml:["BOT"],path:"metrics_loop"},metrics_loop:{message:async o=>{const{userInput:i}=o;if(i==="👍 Helpful"||i==="👎 Not helpful"){if(t&&e&&r){const A={"Content-Type":"application/json","X-Origin":"metrics","X-API-KEY":t,"X-Session-ID":e,"X-Query-ID":r,"X-Feedback":i==="👍 Helpful"?"1":"0"};try{await fetch(wt.METRICS_RATING_ENDPOINT,{method:"POST",headers:A})}catch(a){console.error("Error sending metrics feedback:",a)}}return"Thanks for the feedback! Ask another question about usage and performance metrics (XDMoD) or start a new chat."}else try{const s=Yo();r=s,n({type:"chatbot_metrics_question_sent",queryId:s});const A={"Content-Type":"application/json","X-Origin":"metrics","X-API-KEY":t,"X-Session-ID":e,"X-Query-ID":s},c=(await(await fetch(wt.METRICS_API_ENDPOINT,{method:"POST",headers:A,body:JSON.stringify({query:i})})).json()).response,u=c;return await o.injectMessage(u),setTimeout(async()=>{await o.injectMessage("Ask another question about usage and performance metrics (XDMoD) or start a new chat.")},100),null}catch(s){return console.error("Error in metrics flow:",s),"I'm sorry, there was an error processing your question. Please try again."}},renderMarkdown:["BOT"],options:o=>o.userInput==="👍 Helpful"||o.userInput==="👎 Not helpful"?[]:["👍 Helpful","👎 Not helpful"],chatDisabled:!1,path:"metrics_loop"}}}function nf(){if(typeof window>"u")return Yo();let e=localStorage.getItem(xA.SESSION_ID);return e||(e=Yo(),localStorage.setItem(xA.SESSION_ID,e)),e}const _A="access-qa-bot-shadow-overrides",rf=`
|
|
143
143
|
.rcb-checkbox-container {
|
|
144
144
|
display: flex !important;
|
|
145
145
|
flex-wrap: wrap !important;
|
|
@@ -276,5 +276,21 @@ Would you like to submit this security incident report?`},options:["Submit Secur
|
|
|
276
276
|
opacity: 0.85;
|
|
277
277
|
text-decoration: underline !important;
|
|
278
278
|
}
|
|
279
|
-
|
|
279
|
+
|
|
280
|
+
.rcb-bot-message ul,
|
|
281
|
+
.rcb-bot-message ol {
|
|
282
|
+
list-style-position: outside !important;
|
|
283
|
+
margin: 0.5em 0 !important;
|
|
284
|
+
padding-left: 1.5em !important;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.rcb-bot-message li {
|
|
288
|
+
margin-bottom: 0.25em !important;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.rcb-bot-message li > p {
|
|
292
|
+
display: inline !important;
|
|
293
|
+
margin: 0 !important;
|
|
294
|
+
}
|
|
295
|
+
`;function of(e){if(!e)return;const t=e.getRootNode();if(!(t instanceof ShadowRoot)||t.getElementById(_A))return;const n=document.createElement("style");n.id=_A,n.textContent=rf,t.appendChild(n)}const kA=ze((e,t)=>{const{apiKey:n=wt.DEFAULT_API_KEY,isLoggedIn:r=!1,loginUrl:o=zt.LOGIN_URL,userEmail:i,userName:s,accessId:A,actingUser:a,ringEffect:l,defaultOpen:c,onClose:u,open:d,onOpenChange:p,embedded:h=!1,welcome:y,qaEndpoint:f,ratingEndpoint:b,agentEndpoint:v,onAnalyticsEvent:g}=e,x=ie(null),k=ie(null),[E,P]=Z({}),[D,Q]=Z(null),S=Se(()=>({email:i,name:s,accessId:A}),[i,s,A]);$(()=>{of(k.current)},[]),$(()=>{Up({ticketForm:E,setTicketForm:P})},[E]);const T=v||wt.AGENT_ENDPOINT,C=`${T}/capabilities`,N=`${T}/rating`;$(()=>{T.includes("localhost")&&!window.location.hostname.includes("localhost")&&console.warn("[AccessQABot] VITE_AGENT_ENDPOINT not set — agent requests will go to localhost. Set VITE_AGENT_ENDPOINT in your environment.")},[T]),$(()=>{let m=!1;async function z(){try{const w=await fetch(C,{credentials:"include"});if(!w.ok)throw new Error(`Capabilities API returned ${w.status}`);const G=await w.json();m||Q(G)}catch(w){console.warn("Failed to fetch capabilities:",w),m||Q({categories:[],is_authenticated:!1})}}return z(),()=>{m=!0}},[C,r]),$(()=>{if(!r)return;let m=!1;const z=`${T}/capabilities/personalized`;async function w(){try{const G=await fetch(z,{credentials:"include"});if(!G.ok)return;const te=await G.json();m||console.debug("Personalized context loaded:",te)}catch{}}return w(),()=>{m=!0}},[T,r]),jn(t,()=>({addMessage:m=>{var z,w;(w=(z=x.current)==null?void 0:z.addMessage)==null||w.call(z,m)}}));const U=y||zt.WELCOME_MESSAGE,M=Se(()=>nf(),[]),R=K(m=>{g&&g({...m,type:m.type,timestamp:m.timestamp??Date.now(),sessionId:m.sessionId??M})},[g,M]),I=K(m=>{g&&g({...m,type:m.type,timestamp:typeof m.timestamp=="number"?m.timestamp:Date.now(),sessionId:typeof m.sessionId=="string"?m.sessionId:M})},[g,M]),O=Se(()=>{const m=Hp({welcome:U,trackEvent:R}),z=Vp({ticketForm:{},setTicketForm:P,userInfo:S,trackEvent:R}),w=$p({ticketForm:{},setTicketForm:P,userInfo:S,trackEvent:R}),G=tf({sessionId:M,apiKey:n,trackEvent:R}),te={...m,...z,...w,...G};return Lp(te,{disableOnOptions:!0})},[U,S,M,n,r,R,D]);return D?_("div",{ref:k,children:_(zo,{ref:x,isLoggedIn:r,allowAnonAccess:wt.ALLOW_ANON_ACCESS,actingUser:a,onAnalyticsEvent:I,apiKey:n,qaEndpoint:f||wt.QA_ENDPOINT,ratingEndpoint:b||wt.RATING_ENDPOINT,capabilitiesEndpoint:C,agentRatingEndpoint:N,botName:zt.BOT_NAME,logo:zt.LOGO,primaryColor:zt.PRIMARY_COLOR,secondaryColor:zt.SECONDARY_COLOR,welcomeMessage:U,tooltipText:zt.TOOLTIP,turnstileSiteKey:wt.TURNSTILE_SITE_KEY,loginUrl:o,open:d,onOpenChange:p,embedded:h,footerText:"AI-powered · Privacy Notice",footerLink:"https://support.access-ci.org/tools/access-qa-tool/privacy",customFlow:O})}):_("div",{ref:k})});kA.displayName="AccessQABot";function Ko(e){const{target:t,...n}=e;if(!t)throw new Error("qaBot: target element is required");const r=oi();let o=n.isLoggedIn||!1,i=n.open!==void 0?n.open:n.defaultOpen||!1;const s=cl(t),A=()=>{s.render(_(kA,{ref:r,...n,isLoggedIn:o,open:i,onOpenChange:a=>{var l;i=a,(l=n.onOpenChange)==null||l.call(n,a)}}))};return A(),{addMessage(a){var l;(l=r.current)==null||l.addMessage(a)},setBotIsLoggedIn(a){o=a,A()},openChat(){i=!0,A()},closeChat(){i=!1,A()},toggleChat(){i=!i,A()},destroy(){s.unmount()}}}return typeof window<"u"&&(window.qaBot=Ko),Un.default=Ko,Un.qaBot=Ko,Object.defineProperties(Un,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),Un}({});
|
|
280
296
|
//# sourceMappingURL=access-qa-bot.standalone.js.map
|