PageSourceSearch

https://yaqeeninstitute.org/_next/static/chunks/1226.d20e18932be61519.js

js yaqeeninstitute.org collected 2026-09-24 09:22:19 UTC 27,283 bytes, 1 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f18fd497-6599-456d-a310-aa521355ec55",e._sentryDebugIdIdentifier="sentry-dbid-f18fd497-6599-456d-a310-aa521355ec55")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1226],{30102:(e,t,a)=>{a.d(t,{o:()=>r});var s=a(14232),n=a(37598);let r=()=>{let e=(0,s.useContext)(n.A);if(!e)throw Error("usePopupManagerContext must be used within a PopupManagerProvider");return e}},71226:(e,t,a)=>{a.r(t),a.d(t,{ChatBot:()=>D});var s=a(66284),n=a(14232),r=a(54587),o=a.n(r),i=a(89099),l=a(36708),c=a(18125),u=a(1811),d=a(46070),h=a(69158),m=a(52916),p=a(9361),g=a(82083),f=a(30102),b=a(90525),v=a(35149),x=a(18012),y=a(77966),_=a(17802),A=a(57002),j=a(96370),k=a(97998),S=a(19090),w=a(69174),q=a(98866),C=a(6143),N=a(92850),T=a(46520),I=a(323),W=a(13484),Q=a(37876);let E=e=>{let{onSubmit:t,isDisabled:a}=e,{0:s,1:r}
1=(0,n.useState)(""),{0:o,1:i}=(0,n.useState)(""),{0:l,1:c}=(0,n.useState)(!1),u=(0,n.useRef)(null),{seedText:d,clearSeedText:h}=(0,_.r)();(0,n.useEffect)(()=>{d&&(r(d),h())},[d,h]);let m=()=>{c(!0);let e=(e=>e.trim().length<5?"Message must be at least 5 characters":/^[a-zA-Z0-9\s.,!?'"()\-_@#$%&*:;`]+$/.test(e)?null:"Message can only contain letters, numbers, and common punctuation")(s);if(e)return void i(e);i(""),t(s.trim()),r(""),u.current&&(u.current.style.height="auto")};return(0,Q.jsxs)(Q.Fragment,{children:[o&&l&&(0,Q.jsx)("p",{className:"text-red-500 text-xs text-center px-3 pb-1 bg-white",children:o}),(0,Q.jsxs)("div",{className:"aqsa-chat-input-row",children:[(0,Q.jsx)("textarea",{ref:u,value:s,onChange:e=>{let t=e.target;r(t.value),t.style.height="auto",t.style.height=Math.min(t.scrollHeight,100)+"px"},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),m())},disabled:a,placeholder:"Ask AQSA anything…",className:"aqsa-chat-textarea",rows:1,"aria-label":"Message input",id:"message-input"}),(0,Q.jsx)("button",{type:"button",onClick:m,disabled:a,className:"aqsa-chat-send-btn","aria-label":"Send message",children:(0,Q.jsx)("svg",{viewBox:"0 0 17 17",fill:"none",children:(0,Q.jsx)("path",{d:"M15 8.5L2 2L5.5 8.5L2 15L15 8.5Z",fill:"white"})})})]})]})};var O=a(59373),L=a(78814),B=a(65083),$=a(77657);let P=e=>{let{variant:t,message:a,messageId:s,isReopen:r,ws:i,ctaAction:u,reaction:d,onReaction:h,isWriting:m,idToken:p,linkMetadataCache:g,setLinkMetadataCache:f,handleNonAuthBookmarkItem:_,handleQuickAction:A,showDisclaimer:j,isLoggedIn:S,userPseudoId:C,chatSessionId:N,contentMetadataRef:T,saveAqsaBookmark:I,deleteAqsaBookmark:E,isAqsaBookmarked:P}=e,{0:M,1:R}=(0,n.useState)(d),{firebaseAuth:{initAuth:K}}=(0,B.m9)(),D=(0,b.A)(k.z.AQSA_RECOMMENDATIONS_AB_TEST),V=(0,y.sf)(),H=e=>{var t;if(!s)return;(null==(t=i.current)?void 0:t.readyState())===WebSocket.OPEN&&i.current.send(JSON.stringify({uuid:s,thumbsUpDown:e,action:"reaction"})),null==h||h(s,e),R(e);let a=e?"thumbs_up":"thumbs_down";V.capture("chatbot_reaction",{prompt_variant:"v4",surface:W.K.Widget,user_pseudo_id:C,chat_session_id:N,reaction:a}),(0,x.$s)("reaction","chatbot",a+("v1"===D?":v1":""),!1,{surface:W.K.Widget}),(0,q.wG)("AQSA Response Rating",{"AQSA interaction location":"chat popup","Rating type":a?"thumbs_up":"thumbs_down"})},F=(0,O.A)(a,"assistant"===t&&!r&&s?5:0),z="assistant"===t;return(0,Q.jsxs)("div",{className:"aqsa-chat-msg-row",children:[(0,Q.jsx)("div",{className:"aqsa-msg-name-label",children:z?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(o(),{src:"/static/images/icons/aqsa-avatar.svg",alt:"",width:12,height:12,"aria-hidden":!0}),(0,Q.jsx)("span",{children:"AQSA"})]}):(0,Q.jsx)("span",{children:"You"})}),(0,Q.jsxs)("div",{className:"aqsa-chat-msg-body",children:[(0,Q.jsxs)("div",{className:`aqsa-chat-bubble${z?"":" aqsa-chat-bubble--user"}`,children:[(0,Q.jsxs)(w.EY,{as:"div",fontSize:"text-sm",fontFamily:z?"font-source-serif-pro":"font-proxima-nova",color:z?"text-gray-900":"text-white",className:z?"":"whitespace-pre-line",lineHeight:"leading-5",weight:"font-medium",children:[z&&u&&(0,$.c)(a,_,p,g,f,T),z&&!u&&(0,$.c)(F,_,p,g,f,T),!z&&(0,Q.jsx)("span",{dangerouslySetInnerHTML:{__html:a}})]}),u&&"button"===u.type&&Array.isArray(u.buttons)&&(0,Q.jsx)("div",{className:"flex flex-col gap-2 mt-4",children:u.buttons.map((e,t)=>{let a=`w-full py-2 px-3 bg-yaqeen-primary-1000 hover:bg-blue-100 text-[#1E88FF] text-sm font-semibold rounded-md flex items-center justify-center gap-2 ${m?"opacity-50 cursor-not-allowed":""}`;return e.href?(0,Q.jsx)(w.qh,{className:a,href:e.href,onClick:()=>{let t="Button";if("string"==typeof e.text)t=e.text;else if(n.isValidElement(e.text)){var a;t=(null==(a=e.text.props.children)?void 0:a.filter(e=>"string"==typeof e).join(""))||"Button"}(0,x.$s)("button_click","chatbot",t,!1,{surface:W.K.Widget})},children:e.text},`button-${t}`):(0,Q.jsx)(w.$n,{className:a,onPress:()=>{A(e.message,e.slug,e.contentType,e.action);let t="Button";if("string"==typeof e.text)t=e.text;else if(n.isValidElement(e.text)){var a;t=(null==(a=e.text.props.children)?void 0:a.filter(e=>"string"==typeof e).join(""))||"Button"}let s=(0,q.N2)(t);(0,x.$s)("button_click","chatbot",`length: ${s}`,!1,{surface:W.K.Widget}),(0,q.wG)("Ask AQSA",{"AQSA interaction location":"chat popup","AQSA query type":"suggestion","AQSA query length bucket":s})},isDisabled:m,children:e.text},`button-${t}`)})})]}),z&&s&&(0,Q.jsxs)("div",{className:"flex items-center gap-3 mt-1 pl-1",children:[(0,Q.jsx)(w.$n,{className:`hover:text-green-500 ${!0===M?"text-green-500":"text-gray-300"}`,onPress:()=>H(!0),children:(0,Q.jsx)(c.g,{icon:l.Wcv,fontSize:14})}),(0,Q.jsx)(w.$n,{className:`hover:text-red-500 ${!1===M?"text-red-500":"text-gray-300"}`,onPress:()=>H(!1),children:(0,Q.jsx)(c.g,{icon:l.lS9,fontSize:14})}),(0,Q.jsx)(w.$n,{className:`hover:text-carrot-600 ${P(s)?"text-carrot-600":"text-gray-300"}`,onPress:()=>
1{if(!S)return void K();let e=P(s);e?E(s):I(s,a,N);let t=e?"remove":"save";V.capture("chatbot_bookmark",{prompt_variant:"v4",surface:W.K.Widget,user_pseudo_id:C,chat_session_id:N,action:t}),(0,x.$s)("chatbot","bookmark",t+("v1"===D?":v1":""),!1,{surface:W.K.Widget}),(0,q.wG)("AQSA Bookmark",{"AQSA interaction location":"chat popup","Bookmark action":t})},children:(0,Q.jsx)(c.g,{icon:P(s)?v.G0:L.G0,fontSize:14})})]}),j&&(0,Q.jsxs)("p",{className:"aqsa-inline-disclaimer",children:["AQSA can make mistakes. By chatting with AQSA, you consent to Yaqeen Institute's"," ",(0,Q.jsx)(w.qh,{href:"/privacy-policy?int_source=yaqeeninstitute.org&int_campaign=aqsa&int_content=popup_chat",target:"_blank",children:"privacy policy"}),"."]})]})]})},M=e=>{let{handleQuickAction:t,isLoggedIn:a}=e;return(0,Q.jsxs)("div",{className:"aqsa-chat-suggestions",children:[(0,Q.jsxs)("button",{className:"aqsa-suggestion-chip",onClick:()=>{t("Can you recommend a Yaqeen video for me to watch?",void 0,"Video"),(0,q.wG)("Ask AQSA",{"AQSA interaction location":"chat popup","AQSA query type":"suggestion","AQSA suggestion":"Recommend a video"})},children:[(0,Q.jsx)("svg",{viewBox:"0 0 12 12",fill:"none",width:"12",height:"12",children:(0,Q.jsx)("path",{d:"M2 2L10 6L2 10V2Z",fill:"currentColor"})}),"Recommend a video"]}),(0,Q.jsxs)("button",{className:"aqsa-suggestion-chip",onClick:()=>{t("Can you recommend a Yaqeen ebook for me to read?",void 0,"Book"),(0,q.wG)("Ask AQSA",{"AQSA interaction location":"chat popup","AQSA query type":"suggestion","AQSA suggestion":"Recommend an ebook"})},children:[(0,Q.jsxs)("svg",{viewBox:"0 0 12 12",fill:"none",width:"12",height:"12",children:[(0,Q.jsx)("path",{d:"M2 1.5C2 1.5 4 1 6 2V10.5C4 9.5 2 10 2 10V1.5Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),(0,Q.jsx)("path",{d:"M10 1.5C10 1.5 8 1 6 2V10.5C8 9.5 10 10 10 10V1.5Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})]}),"Recommend an ebook"]}),(0,Q.jsxs)("button",{className:"aqsa-suggestion-chip",onClick:()=>{t("Can you recommend a Yaqeen paper for me to read?",void 0,"Paper"),(0,q.wG)("Ask AQSA",{"AQSA interaction location":"chat popup","AQSA query type":"suggestion","AQSA suggestion":"Recommend a paper"})},children:[(0,Q.jsxs)("svg",{viewBox:"0 0 12 12",fill:"none",width:"12",height:"12",children:[(0,Q.jsx)("rect",{x:"1.5",y:"1",width:"7",height:"10",rx:"1",stroke:"currentColor",strokeWidth:"1.2"}),(0,Q.jsx)("path",{d:"M9.5 3L11 4.5V11H4",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Q.jsx)("path",{d:"M3.5 4H7M3.5 6H7M3.5 8H5.5",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"})]}),"Recommend a paper"]}),(0,Q.jsxs)("button",{className:"aqsa-suggestion-chip",onClick:()=>{t("Can you recommend a dua that I can recite?",void 0,"Dua"),(0,q.wG)("Ask AQSA",{"AQSA interaction location":"chat popup","AQSA query type":"suggestion","AQSA suggestion":"Recommend a du'a"})},children:[(0,Q.jsx)("svg",{viewBox:"0 0 12 12",fill:"none",width:"12",height:"12",style:{transform:"rotate(180deg)"},children:(0,Q.jsx)("path",{d:"M9 2.5C7.5 2 5.5 2.8 4.5 4.5C3.5 6.2 4 8.2 5.5 9.5C3 9.2 1.5 7.2 2 5C2.5 2.8 4.8 1.5 7 2C7.7 2.2 8.4 2.3 9 2.5Z",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round",fill:"none"})}),"Recommend a du'a"]}),(0,Q.jsxs)("div",{style:{display:"flex",gap:"7px",width:"100%"},children:[(0,Q.jsxs)("a",{className:"aqsa-suggestion-chip",href:`/ask-aqsa?ampli_source=redirect${!a?"&init_auth=true":""}`,style:{flex:1,justifyContent:"center"},children:[(0,Q.jsx)("svg",{viewBox:"0 0 12 12",fill:"none",width:"12",height:"12",children:(0,Q.jsx)("path",{d:"M1.5 2C1.5 1.72 1.72 1.5 2 1.5H10C10.28 1.5 10.5 1.72 10.5 2V7.5C10.5 7.78 10.28 8 10 8H4L1.5 10.5V2Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})}),"See previous conversations"]}),(0,Q.jsxs)("a",{className:"aqsa-suggestion-chip",href:"/dashboard?tab=aqsa-favorites",style:{flex:1,justifyContent:"center"},children:[(0,Q.jsx)("svg",{viewBox:"0 0 12 12",fill:"none",width:"12",height:"12",children:(0,Q.jsx)("path",{d:"M2.5 1.5H9.5V11L6 8.5L2.5 11V1.5Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})}),"Show saved responses"]})]})]})};function R(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,s)}return a}function K(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};
1t%2?R(Object(a),!0).forEach(function(t){(0,s.A)(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):R(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}let D=()=>{let{post:e,isOpen:t,openChatBot:a,closeChatBot:s}=(0,_.r)(),{completePopup:r,dismissPopup:O}=(0,f.o)(),{0:L,1:B}=(0,n.useState)(null),{0:$,1:R}=(0,n.useState)((0,T.b)()),{0:D,1:V}=(0,n.useState)(!1),{0:H,1:F}=(0,n.useState)(!1),{firebaseAuth:z}=(0,I.m)(),{initAuth:G,userInfo:U}=z,{bookmarkContext:Y}=(0,S.l)(),{saveAqsaBookmark:Z,deleteAqsaBookmark:J,isAqsaBookmarked:X}=Y,{0:ee,1:et}=(0,n.useState)(null),{0:ea,1:es}=(0,n.useState)(!1),{0:en,1:er}=(0,n.useState)(!1),{0:eo,1:ei}=(0,n.useState)(!1),el=(0,n.useRef)(null),ec=(0,n.useRef)(null),{0:eu,1:ed}=(0,n.useState)(null),eh=(0,n.useRef)(null),{0:em,1:ep}=(0,n.useState)([]),eg=(0,i.useRouter)(),{0:ef,1:eb}=(0,n.useState)(!1),{0:ev,1:ex}=(0,n.useState)(!1),{0:ey,1:e_}=(0,n.useState)(!1),{0:eA,1:ej}=(0,n.useState)(null),{0:ek,1:eS}=(0,n.useState)(!1),{0:ew,1:eq}=(0,n.useState)({}),eC=(0,b.A)(k.z.AQSA_RECOMMENDATIONS_AB_TEST),eN=(0,b.A)(k.z.AQSA_PAPER_BUTTONS_AB_TEST),{0:eT,1:eI}=(0,n.useState)(!1),eW=(0,y.sf)(),eQ=(0,n.useRef)(em),eE=(0,n.useRef)({});(0,n.useEffect)(()=>{eQ.current=em},[em]);let eO=async(t,a,n,r)=>{var o,i,l,c,u;let d;if((null==(o=el.current)?void 0:o.readyState())!==WebSocket.OPEN)return;let h=null==e||null==(i=e.contentType)||null==(i=i.find(e=>0===e.parent))?void 0:i.slug,m=h===A.xj.Paper||h===A.xj.Publication;if(a?d={key:"slug",value:a}:n&&(d={key:"contentType",value:n}),"listen"===r){eW.capture("aqsa_listen_button_click",{user_pseudo_id:eu,chat_session_id:L,paper_title:null==e?void 0:e.title}),s(),setTimeout(()=>{let e=document.querySelector("[data-audio-player]");if(e){e.scrollIntoView({behavior:"smooth",block:"center"});let t=e.querySelector(".rhap_play-pause-button")||e.querySelector('[class*="play"]')||e.querySelector('button[aria-label*="play"]');t&&t.click()}},100);return}if("read_summary"===r){eW.capture("aqsa_read_summary_button_click",{user_pseudo_id:eu,chat_session_id:L,paper_title:null==e?void 0:e.title}),s(),setTimeout(()=>{if(!(null!=e&&e.summary))return void window.scrollTo({top:0,behavior:"smooth"});let t=Array.from(document.querySelectorAll("#reading-mode-tabs button")).find(e=>{var t,a;return(null==(t=e.textContent)?void 0:t.toLowerCase().includes("summary"))||(null==(a=e.textContent)?void 0:a.toLowerCase().includes("short"))});t?(t.click(),setTimeout(()=>{t.scrollIntoView({behavior:"smooth",block:"start"})},200)):window.scrollTo({top:0,behavior:"smooth"})},100);return}m&&"v1"!==eN&&eW.capture("aqsa_summarize_button_click",{user_pseudo_id:eu,chat_session_id:L,paper_title:null==e?void 0:e.title}),(0,x.$s)("quick_action","chatbot","",!1,K(K({},d),{},{surface:W.K.Widget})),eW.capture("chatbot_quick_action",{prompt_variant:"v4",surface:W.K.Widget,user_pseudo_id:eu,chat_session_id:L,filter_key:null==(l=d)?void 0:l.key,filter_value:null==(c=d)?void 0:c.value});let p=null;if(null!=U&&U.user)try{(p=await U.user.getIdToken())!==eA&&ej(p)}catch(e){console.error("Failed to refresh Firebase token before chat send:",e)}if((null==(u=el.current)?void 0:u.readyState())!==WebSocket.OPEN)return;let g=K({variant:"user",action:"chat",userPseudoId:eu,chatSessionId:L,conversationId:$,message:t,source:"yaqeen-web-chat",filterBy:d,useCache:!0,promptVariant:"v4",abTest:eC},p&&{token:p});el.current.send(JSON.stringify(g)),F(!0),ei(!0),ep(e=>[...e,{variant:"user",message:t.split("<title>")[0].trim(),sessionId:ee,userPseudoId:eu,chatSessionId:L,conversationId:$,promptVariant:"v4"}])},eL=(e,t,a)=>{C.Cj.setItem(C.UT.ChatbotBookmarkItem,{type:t,item:e,url:a},C.fI.OneHour),C.Cj.setItem(C.UT.ChatbotMetadataLinkCache,ew,C.fI.OneHour);let s=em.slice(1).slice(-20);C.Cj.setItem(C.UT.ChatbotLastXChats,s,C.fI.OneHour),G()},eB=(0,n.useCallback)(()=>{let e=C.Cj.getItem(C.UT.ChatbotBookmarkItem),t=C.Cj.getItem(C.UT.ChatbotLastXChats),a=C.Cj.getItem(C.UT.ChatbotMetadataLinkCache);if(e){let{type:t,url:s}=e;a&&0===Object.keys(ew).length?(a[s]=K(K({},a[s]),{},{["bookmark"===t?"isBookmarked":"isLiked"]:!0,triggerType:t}),eq(a)):eq(e=>K(K({},e),{},{[s]:K(K({},e[s]),{},{["bookmark"===t?"isBookmarked":"isLiked"]:!0,triggerType:t})}))}em.length<=1&&(null==t?void 0:t.length)>0&&ep(e=>[...e,...t]),C.Cj.removeItem(C.UT.ChatbotBookmarkItem),C.Cj.removeItem(C.UT.ChatbotLastXChats),C.Cj.removeItem(C.UT.ChatbotMetadataLinkCache)},[ew,em]),e$=async t=>{var a,s;(0,x.$s)("submit","chatbot","",!1,{surface:W.K.Widget}),eW.capture("chatbot_message_submitted",{prompt_variant:"v4",surface:W.K.Widget,user_pseudo_id:eu,chat_session_id:L}),(0,q.wG)("Ask AQSA",{"AQSA interaction location":"chat popup","AQSA query type":"custom","AQSA query length bucket":(0,q.N2)(t)}),ei(!0),F(!0);let n={variant:"user",message:t,sessionId:ee,userPseudoId:eu,chatSessionId:L,conversationId:$};ep(e=>[...e,n]);let o=eA;if(null!=U&&U.user)try{(o=await U.user.getIdToken())!==eA&&ej(o)}catch(e){console.error("Failed to refresh Firebase token before chat send:",e)}if((null==(a=el.current)?void 0:a.readyState())===WebSocket.OPEN){let t=null==e?void 0:e.slug,a={url:window.location.href,title:document.title,de
1scription:(null==(s=document.querySelector('meta[name="description"]'))?void 0:s.content)??""},r=K(K(K({},n),{},{action:"chat",userPseudoId:eu,source:"yaqeen-web-chat",promptVariant:"v4"},t&&{filterBy:{key:"slug",value:t}}),{},{pageContext:a},o&&{token:o});el.current.send(JSON.stringify(r))}r(g.e.AqsaAiChatAssistant),setTimeout(()=>{var e;null==(e=document.getElementById("message-input"))||e.focus()},100)};(0,n.useEffect)(()=>{var t;let a=null==e||null==(t=e.contentType)||null==(t=t.find(e=>0===e.parent))?void 0:t.slug,s=[A.xj.Paper,A.xj.Blog].includes(a),n={variant:"assistant",message:`<span class="aqsa-welcome-greeting">Assalamu Alaikum! 👋</span><br><br>I'm AQSA — Yaqeen's AI assistant. Ask me anything about our papers, videos, blogs or curriculum.${e&&s?`<br><br>I notice you're reading <b>${e.title}</b>.`:""}`,chatSessionId:L,conversationId:$,ctaAction:{type:"button",buttons:(t=>{let n=a===A.xj.Paper||a===A.xj.Publication,r=a===A.xj.Blog,o=null==e||null==(t=e.acf)?void 0:t.paperAudio,i=[],d=u.q.some(t=>t.slug===(null==e?void 0:e.slug)),h=n&&!d;return h&&"v1"===eN?o?(i.push({text:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(c.g,{icon:l.ijD}),"Listen"]}),slug:null==e?void 0:e.slug,contentType:"Audio",message:"Listen to this paper",action:"listen"}),null!=e&&e.summary&&i.push({text:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(c.g,{icon:v.Ti,className:"mr-2"}),"Read Summary"]}),slug:null==e?void 0:e.slug,contentType:"Summary",message:"Show me the summary",action:"read_summary"})):null!=e&&e.summary&&i.push({text:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(c.g,{icon:v.Ti}),"Read Summary"]}),slug:null==e?void 0:e.slug,contentType:"Summary",message:"Show me the summary",action:"read_summary"}):h||n?i.push({text:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(c.g,{icon:v.p7}),e&&s?"Summarize this paper":"Recommend a paper"]}),slug:null==e?void 0:e.slug,contentType:"Paper",message:e?`Summarize this paper <title>${e.title}</title>`:"Can you recommend a Yaqeen paper for me to read?"}):r&&e&&i.push({text:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(c.g,{icon:v.p7}),"Summarize this blog"]}),slug:e.slug,contentType:"Blog",message:`Summarize this blog <title>${e.title}</title>`}),i})()}};0===em.length?ep([n]):ep(e=>[n,...e.slice(1)])},[L,e,$,eN]),(0,n.useEffect)(()=>{(async e=>{if(!(null!=(e=U.user)&&e.email)||U.authState!==p.j_.VerifiedAuth){eA&&ej(null),eS(!1);return}eS(!0),eA||U.user.getIdToken().then(e=>{ej(e),eB()})})()},[U,eA,eB]),(0,n.useEffect)(()=>{eu||(0,x.OG)().then(e=>{e&&((0,x.qy)("client_id").then(e=>{ed(e)}),(0,x.qy)("session_id").then(e=>{B(e)}).catch(e=>{console.error("Error getting session id",e),B((0,T.b)())}))})},[eu]),(0,n.useEffect)(()=>{$||R((0,T.b)())},[$]),(0,n.useEffect)(()=>{var e,a;if(t&&(null==(e=el.current)?void 0:e.readyState())!==WebSocket.OPEN&&!ef)return ec.current&&setTimeout(()=>{ec.current&&(ec.current.scrollTop=ec.current.scrollHeight)},100),el.current=new N.A({url:d.M,onOpen:()=>{console.debug("Connected to WebSocket"),es(!1)},onMessage:e=>{let{data:t}=e;try{let e=JSON.parse(t);if("object"!=typeof e)return;if(e.done){F(!1),(0,x.$s)("finished_response","chatbot","",!1,{surface:W.K.Widget}),eW.capture("chatbot_finished_response",{prompt_variant:"v4",surface:W.K.Widget,user_pseudo_id:eu,chat_session_id:L}),setTimeout(()=>{(0,q.wG)("AQSA response",K(K({"AQSA responded":"yes","AQSA interaction location":"chat popup"},eE.current.contentName&&{"content name":eE.current.contentName}),eE.current.contentId&&{"content id":eE.current.contentId})),eE.current={contentName:null,contentId:null}},2e3);let e=eQ.current[eQ.current.length-1].message.match(/https?:\/\/[\w.-]+(?:\.[\w\.-]+)+(?:[\w\-._~:/?#[\]@!$&'()*+,;=]+)/g);e&&e.forEach(e=>{let t=e.replaceAll("amp;","");t.includes("/search")||((0,x.$s)("content_impression","chatbot",t,!1,{surface:W.K.Widget}),eW.capture("chatbot_content_impression",{prompt_variant:"v4",surface:W.K.Widget,user_pseudo_id:eu,chat_session_id:L,content_url:t}))});return}if(!e.message)return;ep(t=>{if(eh.current!==e.messageId)return eh.current=e.messageId,[...t,{variant:"assistant",message:e.message,messageId:e.messageId,sessionId:e.sessionId,chatSessionId:L,conversationId:$}];{let a=[...t],s=a[a.length-1];return a[a.length-1]=K(K({},s),{},{message:s.message+e.message}),a}}),et(e.sessionId),ei(!1)}catch(e){console.error("Error parsing WebSocket data:",e),ei(!1)}},onClose:()=>{console.debug("WebSocket connection closed"),ei(!1)},onError:e=>{console.error("WebSocket error:",e),ei(!1)},onFailedRetry:()=>{ei(!1),es(!0),console.error("WebSocket failed to connect after 5 attempts")}}),D?(0,x.$s)("reopened","chatbot","",!1,{surface:W.K.Widget}):(eT||((0,q.mi)(ek),eI(!0)),(0,x.$s)("opened","chatbot","",!1,{surface:W.K.Widget}),V(!0)),()=>{console.debug("[ChatBot WS Cleanup] Closing WebSocket due to isOpen change or unmount"),el.current&&((0,x.$s)("closed","chatbot","",!1,{surface:W.K.Widget}),eW.capture("chatbot_closed",{prompt_variant:"v4",surface:W.K.Widget,user_pseudo_id:eu,chat_session_id:L}),el.current.closeAndDelete(),el.current=null)};(null==(a=el.current)?void 0:a.readyState())===WebSocket.OPEN&&(console.debug("[ChatBot WS] Closing WebSocket because isOpen is false"),el.current.closeAndDelete(),el.current=null)},[t,ef]),(0,n.useEffect)(()=>
1{if(ec.current){let e=setTimeout(()=>{ec.current&&(ec.current.scrollTop=ec.current.scrollHeight)},100);return()=>clearTimeout(e)}},[em]),(0,n.useEffect)(()=>{"1"!=eg.query._aqsa||en||((0,x.$s)("auto_open","chatbot","from_query",!1,{surface:W.K.Widget}),a(),er(!0),console.debug("Query param forcing Chatbot open, skipping CTA schedule if active."))},[eg.query._aqsa,en,a]),(0,n.useEffect)(()=>{let e=null;return t&&(console.debug("[ChatBot Timeout] Starting 60s completion timer"),e=setTimeout(()=>{console.debug("[ChatBot Timeout] Timed out after 60s, completing CTA..."),r(g.e.AqsaAiChatAssistant)},6e4)),()=>{e&&(console.debug("[ChatBot Timeout] Clearing completion timer."),clearTimeout(e))}},[t,r]),(0,n.useEffect)(()=>{let e=["/ask-aqsa","/search","/explore",...Object.values(j.ci).map(e=>`/${e}`)],t=["/topic","/tag","/team"],a=()=>{let a=e.includes(eg.pathname)||t.some(e=>eg.pathname.startsWith(e)),s="read"===new URLSearchParams(window.location.search).get("mode");ex(a||s)};return a(),window.addEventListener("urlchange",a),window.addEventListener("popstate",a),eg.events.on("routeChangeComplete",a),()=>{window.removeEventListener("urlchange",a),window.removeEventListener("popstate",a),eg.events.off("routeChangeComplete",a)}},[eg.pathname,eg.events]),(0,n.useEffect)(()=>{let e=()=>{window.scrollY<=80?e_(!1):e_(!0)};return window.addEventListener("scroll",e,{passive:!0}),()=>window.removeEventListener("scroll",e)},[]);let eP=(0,n.useCallback)(()=>{var e;s(),setTimeout(()=>{O(g.e.AqsaAiChatAssistant)},50),(0,q.wG)("Close AQSA popup",{"User location":(null==(e=window)||null==(e=e.location)?void 0:e.pathname)||"unknown"})},[s,O]),eM=(e,t)=>{ep(a=>a.map(a=>a.messageId===e?K(K({},a),{},{reaction:t}):a))};if(ev){var eR;return null==(eR=el.current)||eR.closeAndDelete(),el.current=null,null}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(h.N,{children:t&&(0,Q.jsxs)(m.m.div,{variants:{hidden:{scale:.85,y:20,opacity:0},visible:{scale:1,y:0,opacity:1},exit:{scale:.85,y:20,opacity:0}},initial:"hidden",animate:"visible",exit:"exit",transition:{duration:.3,type:"spring",damping:20,stiffness:280},style:{transformOrigin:"bottom right"},className:"aqsa-chat-window",role:"dialog","aria-modal":"true","aria-labelledby":"aqsa-chat-title",children:[(0,Q.jsxs)("div",{className:"aqsa-chat-header",children:[(0,Q.jsx)("div",{className:"aqsa-chat-header-avatar","aria-hidden":"true",children:(0,Q.jsx)(o(),{src:"/static/images/icons/aqsa-avatar.svg",alt:"Yaqeen",width:22,height:22})}),(0,Q.jsxs)("div",{className:"aqsa-chat-header-info",children:[(0,Q.jsx)("div",{className:"aqsa-chat-header-name",id:"aqsa-chat-title",children:"AQSA"}),(0,Q.jsxs)("div",{className:"aqsa-chat-header-status",children:[(0,Q.jsx)("span",{className:"aqsa-status-dot","aria-hidden":"true"}),"Online \xb7 Yaqeen AI Assistant"]})]}),(0,Q.jsxs)("div",{className:"aqsa-chat-header-actions",children:[(0,Q.jsx)(w.qh,{href:"/ask-aqsa?ampli_source=redirect",target:"_blank",onClick:()=>{(0,x.$s)("standalone_page","chatbot","",!1,{surface:W.K.Widget}),eW.capture("chatbot_standalone_page",{surface:W.K.Widget,user_pseudo_id:eu,chat_session_id:L})},className:"aqsa-chat-header-btn","aria-label":"Open full AQSA page",children:(0,Q.jsx)(c.g,{icon:v.Ju,fontSize:13})}),(0,Q.jsx)("button",{className:"aqsa-chat-header-btn",onClick:()=>eP(),"aria-label":"Minimise chat",children:(0,Q.jsx)("svg",{viewBox:"0 0 14 4",fill:"none",children:(0,Q.jsx)("path",{d:"M1 2H13",stroke:"white",strokeWidth:"2.5",strokeLinecap:"round"})})})]})]}),em.length<=1&&(0,Q.jsx)(M,{handleQuickAction:eO,isLoggedIn:ek}),(0,Q.jsxs)("div",{id:"chat-body",ref:ec,className:"aqsa-chat-messages",onWheel:e=>e.stopPropagation(),onTouchMove:e=>{if(e.stopPropagation(),ec.current){let t=0===ec.current.scrollTop,a=ec.current.scrollHeight-ec.current.scrollTop===ec.current.clientHeight;(t&&e.touches[0].clientY>0||a&&e.touches[0].clientY<0)&&e.preventDefault()}},children:[em.map((e,t)=>(0,Q.jsx)(P,K(K({},e),{},{showDisclaimer:0===t&&"assistant"===e.variant,reaction:e.reaction,onReaction:eM,sessionId:ee,userPseudoId:eu,isReopen:D,chatSessionId:L,ws:el,isWriting:H,idToken:eA,isLoggedIn:ek,handleNonAuthBookmarkItem:eL,linkMetadataCache:ew,setLinkMetadataCache:eq,handleQuickAction:eO,contentMetadataRef:eE,saveAqsaBookmark:Z,deleteAqsaBookmark:J,isAqsaBookmarked:X}),e.messageId||t)),eo&&(0,Q.jsxs)("div",{className:"aqsa-typing-indicator",children:[(0,Q.jsxs)("div",{className:"aqsa-msg-name-label",children:[(0,Q.jsx)(o(),{src:"/static/images/icons/aqsa-avatar.svg",alt:"",width:12,height:12,"aria-hidden":!0}),(0,Q.jsx)("span",{children:"AQSA"})]}),(0,Q.jsxs)("div",{className:"aqsa-typing-dots",children:[(0,Q.jsx)("div",{className:"aqsa-typing-dot"}),(0,Q.jsx)("div",{className:"aqsa-typing-dot"}),(0,Q.jsx)("div",{className:"aqsa-typing-dot"})]})]})]}),ea&&(0,Q.jsx)("p",{className:"text-red-500 text-xs text-center px-3 py-1",children:"Chat disconnected. Please try again later."}),(0,Q.jsx)(E,{onSubmit:e$,isDisabled:eo||H})]},"aqsa-chat")}),!t&&(0,Q.jsxs)("button",{className:`aqsa-fab${ey?" aqsa-fab--collapsed":""}`,"aria-label":"Chat with AQSA – AI Assistant",onClick:()=>{eb(!0),setTimeout(()=>{var e;(0,x.$s)("click_open","chatbot","",!1,{surface:W.K.Widget}),(0,q.wG)("View AQSA popup",{"User location":(null==(e=window)||null==(e=e.location)?void 0:e.pathname)||"unknown"}),eW.capture("chatbot_open",{prompt_variant:"v4",surface:W.K.Widget,user_pseudo_id:eu,chat_session_id:L}),a()},10),setTimeout(()=>{eb(!1)},1e3)},children:[(0,Q.jsx)("span",{className:"aqsa-fab__pulse","aria-hidden":"true"}),(0,Q.jsx)("span",{className:"aqsa-fab__pulse aqsa-fab__pulse--2","aria-hidden":"true"}),(0,Q.jsxs)("span",{className:"aqsa-fab__icon",children:[(0,Q.jsx)("span",{className:"aqsa-fab__notif","aria-hidden":"true"}),(0,Q.jsxs)("span",{className:"aqsa-fab__dots","aria-hidden":"true",children:[(0,Q.jsx)("span",{className:"aqsa-fab__dot"}),(0,Q.jsx)("span",{className:"aqsa-fab__dot"}),(0,Q.jsx)("span",{className:"aqsa-fab__dot"})]})]}),(0,Q.jsxs)("span",{className:"aqsa-fab__text",children:[(0,Q.jsx)("span",{className:"aqsa-fab__eyebrow",children:"AI Assistant"}),(0,Q.jsx)("span",{className:"aqsa-fab__name",children:"Chat with AQSA"})]})]})]})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.