1"use strict";(this.webpackChunkFusion_components=this.webpackChunkFusion_components||[]).push([[4678,7142],{17030:function(e,t,s){s.r(t);var a=s(40809),n=s(81862),r=s.n(n),o=s(78299),i=s(40761),l=s(85349);const c="#fusion-app";function d(){document.querySelector(c).removeAttribute("inert")}function u({ariaLabel:e,children:t,heading:s="",id:n,isOpen:u,onAfterClose:m,onAfterOpen:h,onRequestClose:p}){const f=(0,a.useRef)(void 0),g=(0,a.useCallback)(()=>{document.querySelector(c).setAttribute("inert",""),f?.current?.focus(),(0,i.Ak)(h)},[h]),y=(0,a.useCallback)(()=>{d(),(0,i.Ak)(p)},[p]),b=(0,a.useCallback)(()=>{d(),(0,i.Ak)(m)},[m]);return(0,l.jsx)(r(),{bodyOpenClassName:"u-no-scroll",className:"tgam-sliding-modal__content",closeTimeoutMS:300,contentLabel:e,id:n,isOpen:u,onAfterClose:b,onAfterOpen:g,onRequestClose:y,overlayClassName:{base:"tgam-sliding-modal__overlay",afterOpen:"tgam-sliding-modal__overlay--open",beforeClose:"tgam-sliding-modal__overlay--close"},portalClassName:"tgam-sliding-modal__portal",shouldCloseOnEsc:!0,shouldCloseOnOverlayClick:!0,shouldReturnFocusAfterClose:!0,children:(0,l.jsx)("div",{className:"tgam-sliding-modal__body",children:(0,l.jsxs)("div",{className:"tgam-sliding-modal__body-content",children:[(0,l.jsxs)("div",{className:"tgam-sliding-modal__body-header",children:[s&&(0,l.jsx)("h2",{className:"tgam-sliding-modal__body-heading text-gmb-4",children:s}),(0,l.jsx)(o.Ay,{reference:f,"aria-label":"Close",className:"tgam-sliding-modal__close-button",icon:"close",onClick:y,analytics:{fid:"tgam-sliding-modal",action:"close modal"}})]}),(0,l.jsx)("div",{className:"tgam-sliding-modal__body-scroll-area",children:t}),s&&(0,l.jsx)("div",{className:"tgam-sliding-modal__body-footer"})]})})})}r().setAppElement(c),u.displayName="SlidingModal",t.default=u},9917:function(e,t,s){s.d(t,{Q:function(){return o}});var a=s(40809),n=s(94566),r=s(85349);function o({animatedScroll:e=!0,children:t,endText:s="Skip to end of list",id:o,startText:i="Skip to start of list"}){const l=(0,a.useRef)(null),c=(0,a.useRef)(null);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("a",{ref:l,className:"c-skip-link c-skip-link--bypass c-skip-link--bypass--start",id:`skip-start-${o}`,href:`#skip-end-${o}`,onClick:t=>{t.preventDefault(),c?.current&&(c.current.focus({preventScroll:!0}),c.current.scrollIntoView({behavior:e&&!n.tT?"smooth":"instant",block:"start"}))},children:i}),t,(0,r.jsx)("a",{ref:c,className:"c-skip-link c-skip-link--bypass c-skip-link--bypass--end",id:`skip-end-${o}`,href:`#skip-start-${o}`,onClick:t=>{t.preventDefault(),l?.current&&(l.current.focus({preventScroll:!0}),l.current.scrollIntoView({behavior:e&&!n.tT?"smooth":"instant",block:"start"}))},children:s})]})}o.displayName="SkipLinkBypass"},64511:function(e,t,s){s.r(t),s.d(t,{default:function(){return sn}});var a=s(40809),n=s(91565),r=s(78299),o=s(40734),i=s(58758),l=s(51344),c=s(37796),d=s(29705),u=s(94011),m=s(85040),h=s(22374),p=s(20484),f=s(37173),g=s(81862),y=s.n(g),b=s(60814),x=s(60760),w=s(60720),v=s(40761),C=s(30137),N=s(13376),A=s(85349);const k="news-assistant-onboarding-modal",_="#fusion-app";y().setAppElement(_);const j=(0,N.FU)("/images/news-assistant/onboarding-modal"),S="news-assistant-onboarding-preload-slide-1",O=[{label:"News Assistant",heading:"Start by typing a query",image:`${j}/desktop/slide-1.gif?v=3`,imageMobile:`${j}/mobile/slide-1.gif?v=3`,content:"Enter a topic, stock, author, or question. The assistant can find articles, add stocks to your Watchlist, follow topics or authors, and give market updates."},{label:"News Assistant",heading:"Best matches and All articles",image:`${j}/desktop/slide-2.gif?v=3`,imageMobile:`${j}/mobile/slide-2.gif?v=3`,content:"âBest matchesâ shows relevant matches grouped by type of articles. âAll articlesâ displays the complete list of related stories."},{label:"News Assistant",heading:"Ask a follow-up",image:`${j}/desktop/slide-3.gif?v=3`,imageMobile:`${j}/mobile/slide-3.gif?v=3`,content:"Type follow-up questions to adjust or expand your search results."},{label:"News Assistant",heading:"Filter your results",image:`${j}/desktop/slide-4.gif?v=3`,imageMobile:`${j}/mobile/slide-4.gif?v=3`,content:"In âAll articles,â apply filters for date, section, or author to narrow down your results."},{label:"News Assistant",heading:"New chat",image:`${j}/desktop/slide-5.gif?v=3`,imageMobile:`${j}/mobile/slide-5.gif?v=3`,content:"Begin a new search or question anytime. Your current chat will be cleared permanently, so make sure youâre ready to move on."}],I=O.length;function P(){document.querySelector(_).removeAttribute("inert")}function D({isOpen:e,onAfterClose:t,onRequestClose:s,showStartScreen:n}){const{isAppview:o}=(0,m.f)(),[i,l]=(0,a.useState)(1),c=(0,a.useRef)(null),d=(0,a.useRef)(null),u=(0,a.useRef)(null),h=(0,a.useRef)(null),[p,f]=(0,a.useState)(!1),g=n&&!p,N=(0,x.N)({query:`(max-width: ${(0,C.D0)(600)})`})||!1;(0,a.useEffect)(()=>
1{if(!g)return;const e=N?O[0].imageMobile:O[0].image;let t=document.getElementById(S);return t||(t=document.createElement("link"),t.id=S,t.rel="preload",t.as="image",t.fetchPriority="high",document.head.appendChild(t)),t.href=e,()=>{document.getElementById(S)?.remove()}},[N,g]),(0,a.useEffect)(()=>{if(!e||!c.current)return;const t=document.querySelectorAll(".news-assistant-modal .slide"),s=document.querySelector(`.news-assistant-modal .slide:nth-of-type(${i})`),a=i>1?i-1:0;c.current.style.transform=`translateX(${a>0?"-"+100*a:0}%)`,d.current.disabled&&(d.current.blur(),u.current.focus()),t.forEach(e=>{e.classList.remove("active"),e.removeAttribute("aria-live")}),s.classList.add("active"),s.setAttribute("aria-live","polite")},[i,e]);const j=(0,a.useCallback)(()=>{l(i>1?i-1:1)},[i]),D=(0,a.useCallback)(()=>{l(i!==I?i+1:I)},[i]),E=(0,a.useCallback)(()=>{P(),(0,v.Ak)(s)},[s]),R=(0,a.useCallback)(()=>{P(),l(1),(0,v.Ak)(t)},[t]),T=(0,a.useCallback)(()=>{document.querySelector(_).setAttribute("inert",""),h.current.focus()},[]),F=(0,A.jsxs)("div",{className:"news-assistant-modal__start-screen",children:[(0,A.jsx)("div",{className:"news-assistant-modal__start-screen-label text-gml-2",children:o?"Early Access":"Beta"}),(0,A.jsx)(b.A,{className:"news-assistant-modal__start-screen-heading",element:"h2",heading:"News Assistant",headingType:w.v.PR_2}),(0,A.jsxs)("h3",{className:"news-assistant-modal__start-screen-subheading text-gmb-3",children:["Find everything that matters",(0,A.jsx)("br",{}),"without leaving search."]}),(0,A.jsx)("p",{className:"news-assistant-modal__start-screen-text text-gmr-2",children:"Search for articles, follow your favourite authors, do financial research, and add stocks to your Watchlist."}),(0,A.jsxs)("div",{className:"news-assistant-modal__start-screen-buttons",children:[(0,A.jsx)(r.Ay,{analytics:{fid:k,action:"close modal"},onClick:E,theme:r.ox.GREY,variant:r.Ck.OUTLINE,children:"Search now"}),(0,A.jsx)(r.Ay,{analytics:{fid:k,action:"start tutorial"},onClick:()=>{f(!0),requestAnimationFrame(()=>h.current?.focus())},children:"Start tutorial"})]})]}),$=(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("ul",{id:"news-assistant-modal-slides",className:"news-assistant-modal__slides",ref:c,children:O.map((e,t)=>(0,A.jsxs)("li",{className:"slide",children:[e.image&&(0,A.jsx)("div",{className:"slide-image",children:(0,A.jsxs)("picture",{children:[(0,A.jsx)("source",{media:`(max-width: ${(0,C.D0)(600)})`,srcSet:e.imageMobile}),(0,A.jsx)("img",{src:e.image,alt:e.heading})]})}),(0,A.jsxs)("div",{className:"slide-content",children:[e.label&&(0,A.jsx)("div",{className:"slide-label text-gml-2",children:e.label}),(0,A.jsx)("div",{className:"slide-heading text-gmb-3",children:e.heading}),(0,A.jsx)("div",{className:"slide-desc text-gmr-3",children:e.content})]})]},`slide-${t}`))}),(0,A.jsxs)("div",{className:"news-assistant-modal__nav",children:[(0,A.jsxs)("span",{className:"text-gmr-2",children:[i," of ",I]}),(0,A.jsxs)("div",{className:"nav-buttons",children:[(0,A.jsx)(r.Ay,{analytics:{fid:k,action:"previous slide"},"aria-controls":"news-assistant-modal-slides","aria-label":"Previous slide",className:"slide-nav-button prev-button",disabled:1===i,icon:"back",onClick:j,reference:u}),(0,A.jsx)(r.Ay,{analytics:{fid:k,action:"next slide"},"aria-controls":"news-assistant-modal-slides","aria-label":"Next slide",className:"slide-nav-button next-button",disabled:i===I,icon:"forward",onClick:D,reference:d})]})]})]});return(0,A.jsxs)(y(),{bodyOpenClassName:"u-no-scroll",className:{base:"news-assistant-modal",afterOpen:"news-assistant-modal--open",beforeClose:"news-assistant-modal--close"},closeTimeoutMS:300,contentLabel:"News Assistant Onboarding",id:"news-assistant-modal",isOpen:e,onAfterClose:R,onAfterOpen:T,onRequestClose:E,overlayClassName:"news-assistant-modal-overlay",shouldCloseOnEsc:!0,shouldCloseOnOverlayClick:!0,shouldReturnFocusAfterClose:!0,children:[(0,A.jsx)(r.Ay,{analytics:{fid:k,action:"close modal"},"aria-label":"Close",className:"news-assistant-modal__close-button",icon:"close",id:"news-assistant-modal-close",onClick:E,reference:h}),g?F:$]})}D.displayName="NewsAssistantOnboardingModal";var E=s(21143),R=s.n(E),T=s(88951);const F=R().div.withConfig({displayName:"NewsAssistantstyles__MenuRoot",componentId:"sc-1o2gz9o-0"})(["width:100%;padding-inline:16px;background-color:var(--color-white-100);@media (min-width:","){padding-inline:48px;}"],(0,C.D0)(T.fi.lg)),$=R().div.withConfig({displayName:"NewsAssistantstyles__MenuNav",componentId:"sc-1o2gz9o-1"})(["width:100%;max-width:var(--tgam-page-max-width,unset);height:44px;margin-inline:auto;position:relative;"]),M=R().div.withConfig({displayName:"NewsAssistantstyles__MenuNavInner",componentId:"sc-1o2gz9o-2"})(['width:100%;max-width:var(--tgam-news-assistant-max-inner-width,unset);height:44px;margin-inline:auto;display:flex;justify-content:space-between;align-items:center;> *:last-child{position:absolute;right:0;margin-left:auto;padding-right:0;}.tgam-scrollable-tabs{[role="tablist"]{margin-block:0;padding-block:0;}[role="tab"]{border-bottom-width:2px;color:var(--color-grey-800);text-transform:none;font-family:GMsans-Web-Regular,Helvetica,Arial,Verdana,sans-serif;font-size:1rem;line-height:1.5;@media (min-width:','){font-size:1.125rem;line-height:1.33;}&[aria-selected="true"]{border-bottom-color:var(--color-red-500);}&:focus-visible{outline-offset:2px;}}}'],(0,C.D0)(T.fi.lg)),L=R().div.withConfig({displayName:"NewsAssistantstyles__PortalContent",componentId:"sc-1o2gz9o-3"})(["height:100%;--search-bar-height:152px;@media (min-width:","){--search-bar-height:128px;}",";.tgam-scrollable-tabs{min-height:calc(100% - var(--search-bar-height) - env(safe-area-inset-bottom,0));}"],(0,C.D0)(480),e=>e.$stickySearch&&"\n padding-bottom: calc(var(--search-bar-height) + env(safe-area-inset-bottom, 0));\n "),q=/\[[^\]]+\]/g;function U({inputRef:e,inputValue:t,setInputValue:s}){const n=(0,a.useRef)(!1);n.current&&t.search(q)<0&&(n.current=!1);const r=(0,a.useCallback)(t=>{const a=/\[([^\]]+)\]/.exec(t);n.current=!!a,s(t),e.current?.focus(),requestAnimationFrame(()=>{e.current&&(a?e.current.setSelectionRange(a.index,a.index):e.current.setSelectionRange(t.length,t.length))})},[e,s]),o=(0,a.useCallback)(a=>{const r=a.target.value;if(n.current&&r!==t&&t.search(q)>=0){const o=a.target.selectionStart??r.length,i=r.length-t.length,l=t.replace(q,""),c=i>0?r.slice(o-i,o):"",d=function(e,t){let s=0,a=0;const n=new RegExp(q);let r;for(;null!==(r=n.exec(t));){const t=r.index,n=t+r[0].length;if(e<=t)return s+=e-a,s;if(e>t&&e<=n)return s+=t-a,s;s+=t-a,a=n}const o=t.replace(q,"").length-(t.length-e);return Math.max(o,0)}(Math.min(o-i,t.length),t),u=l.slice(0,d)+c+l.slice(d),m=d+c.length;s(u),n.current=!1,requestAnimationFrame(()=>{e.current?.setSelectionRange(m,m)})}else s(r)},[e,t,s]),i=(0,a.useCallback)(e=>n.current?e.replace(q,""):e,[]);return{handleInputChange:o,handlePromptClick:r,hasPromptPlaceholder:n.current,stripPlaceholders:i}}var B=s(41944),W=s(35838),z=s(27620),H=s(28782);const Q="#fusion-app";function Y({ariaLabel:e,children:t,heading:s,id:n,isOpen:o,onRequestClose:i,onAfterClose:l}){const{scrollbarWidth:c}=(0,H.z)();(0,a.useEffect)(()=>(document.body.style.setProperty("--scroll-padding",`${c}px`),()=>{document.body.style.removeProperty("--scroll-padding")}),[c]);const d=(0,a.useCallback)(()=>{document.querySelector(Q)?.setAttribute("inert","")},[]),u=(0,a.useCallback)(()=>{document.querySelector(Q)?.removeAttribute("inert"),document.body.style.setProperty("--scroll-padding","0p
1x"),l?.()},[l]);return(0,A.jsx)(y(),{id:n,isOpen:o,className:"tgam-modal-content",overlayClassName:"tgam-modal-overlay",bodyOpenClassName:"u-no-scroll",shouldCloseOnEsc:!0,shouldCloseOnOverlayClick:!0,contentLabel:e,onRequestClose:i,onAfterClose:u,onAfterOpen:d,children:(0,A.jsxs)("div",{className:"tgam-modal-container",children:[(0,A.jsxs)("div",{className:"tgam-modal-header",children:[s&&(0,A.jsx)("h2",{className:"tgam-modal-heading text-gmb-4",children:s}),(0,A.jsx)(r.Ay,{"aria-label":"Close modal",className:"tgam-modal-button-close",icon:"close",onClick:i})]}),(0,A.jsx)("div",{className:"tgam-modal-body-scroll-area",children:(0,A.jsx)("div",{className:"tgam-modal-body",children:t})})]})})}y().setAppElement(Q),Y.displayName="Modal";var V=s(17030);function G({analytics:e={},isOpen:t,onAfterClose:s,onRequestClose:a,onSwitchBack:n}){const o=(0,x.N)({query:`(min-width: ${T.fi.md}px)`})||!1,i="Leave News Assistant?",l="Youâre returning to the classic search experience. You can return to News Assistant anytime.",c=(0,A.jsx)(r.Ay,{fullWidth:!0,onClick:n,analytics:e,children:"SWITCH BACK"});return o?(0,A.jsxs)(Y,{ariaLabel:"Switch to classic search",heading:i,id:"news-assistant-switch-modal-desktop",isOpen:t,onAfterClose:s,onRequestClose:a,children:[(0,A.jsx)("p",{className:"mt-0 mb-16",children:l}),c]}):(0,A.jsxs)(V.default,{id:"news-assistant-switch-modal-mobile",ariaLabel:"Switch to classic search",heading:i,isOpen:t,onAfterClose:s,onRequestClose:a,children:[(0,A.jsx)("p",{className:"mt-8 mb-24",children:l}),c]})}G.displayName="NewsAssistantSwitchModal";const J=R().ul.withConfig({displayName:"NewsAssistantPromptsstyles__Prompts",componentId:"sc-kvqkqp-0"})(["width:100%;list-style:none;margin:40px 0 0;padding:0;display:flex;flex-direction:column;align-self:flex-end;align-items:flex-end;gap:8px;align-self:end;@media (min-width:","){margin-top:16px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-self:auto;align-items:stretch;gap:8px;align-self:unset;}"],(0,C.D0)(T.fi.sm)),K=R().li.withConfig({displayName:"NewsAssistantPromptsstyles__PromptItem",componentId:"sc-kvqkqp-1"})(["margin:0;width:100%;display:flex;justify-content:flex-end;@media (min-width:","){width:auto;display:block;}"],(0,C.D0)(T.fi.sm)),X=R().button.withConfig({displayName:"NewsAssistantPromptsstyles__PromptButton",componentId:"sc-kvqkqp-2"})(["color:var(--color-grey-700);width:auto;max-width:100%;border:0;border-radius:16px;background-color:var(--color-grey-100);cursor:pointer;padding:8px 16px;@media (min-width:","){width:100%;max-width:none;padding:0.5rem 16px;}&:hover{background-color:var(--color-grey-200);}&:focus-visible{outline:2px solid var(--color-alias-focus-ring-default);outline-offset:0;}"],(0,C.D0)(T.fi.sm));function Z({items:e,onClick:t}){return!!e?.length&&(0,A.jsx)(J,{"aria-label":"Suggested prompts",className:"tgam-news-assistant-prompts",children:e.map(e=>(0,A.jsx)(K,{children:(0,A.jsx)(X,{"aria-label":`Auto-fill search field with "${e}"`,"data-sophi-action":"search prompt","data-sophi-feature":"search-prompt","data-sophi-label":`Auto-fill search field with "${e}"`,className:"text-gmr-4",type:"button",onClick:()=>t(e),children:e})},e))})}Z.displayName="NewsAssistantPrompts";const ee=R().div.withConfig({displayName:"NewsAssistantWelcomeScreenstyles__WelcomeScreen",componentId:"sc-yt78d1-0"})(["width:100%;height:100%;margin-inline:auto;padding-top:24px;display:grid;gap:8px;align-content:stretch;grid-template-rows:1fr auto auto;.tgam-news-assistant-prompts{order:2;}.tgam-news-assistant-search-bar{order:3;}@media (min-width:","){align-content:center;grid-template-rows:unset;padding-bottom:24px;.tgam-news-assistant-prompts{order:3;}&& .tgam-news-assistant-search-bar{order:2;padding-block:0;}}"],(0,C.D0)(T.fi.md)),te=R().div.withConfig({displayName:"NewsAssistantWelcomeScreenstyles__WelcomeText",componentId:"sc-yt78d1-1"})(["width:100%;display:flex;flex-direction:column;align-items:center;text-align:center;align-self:center;@media (min-width:","){align-self:unset;}"],(0,C.D0)(T.fi.md)),se=R()(b.A).withConfig({displayName:"NewsAssistantWelcomeScreenstyles__WelcomeHeading",componentId:"sc-yt78d1-2"})([".text-pr-2{color:var(--color-grey-800);@media (min-width:","){font-size:3rem;line-height:1.17;}}"],(0,C.D0)(T.fi.sm)),ae=R().h3.withConfig({displayName:"NewsAssistantWelcomeScreenstyles__WelcomeSubTitle",componentId:"sc-yt78d1-3"})(["color:var(--color-grey-800);margin:40px 0 0;text-wrap:balance;@media (max-width:","){font-size:1.5rem;line-height:1.25;}"],(0,C.D0)(T.fi.sm-1)),ne=R().p.withConfig({displayName:"NewsAssistantWelcomeScreenstyles__WelcomeDescription",componentId:"sc-yt78d1-4"})(["margin:8px 0 0;text-wrap:balance;@media (max-width:","){font-size:1rem;line-height:1.5;}"],(0,C.D0)(T.fi.sm-1)),re=R().a.withConfig({displayName:"NewsAssistantWelcomeScreenstyles__WelcomeSwitchLink",componentId:"sc-yt78d1-5"})(["cursor:pointer;display:inline-block;margin-top:8px;color:var(--color-grey-500);text-decoration:underline;text-underline-offset:0.12em;&:hover,&:focus-visible{color:var(--color-grey-800);}@media (min-width:","){margin-bottom:16px;}@media (min-width:","){margin-bottom:40px;}"],(0,C.D0)(T.fi.sm),(0,C.D0)(T.fi.md));var oe=s(67592),ie=s.n(oe),le=s(89211),ce=s(94566);function de(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,a)}return s}function ue(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};
1t%2?de(Object(s),!0).forEach(function(t){me(e,t,s[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):de(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}function me(e,t,s){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var a=s.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}const he=60,pe=6e5,fe=new Map;function ge(e){if(!ce.Sw)return!1;const t=Date.now();for(const[e,s]of fe)t-s>=pe&&fe.delete(e);const s=fe.get(e);return!!(s&&t-s<pe)||(fe.set(e,t),!1)}const ye=e=>["Working on it...","Looking into this for you...","Gathering the details..."][e];function be(e){try{return e.replace(/\\n/g,"\n")}catch(t){return e}}const xe=new Intl.DateTimeFormat("en-CA",{timeZone:le.CC,year:"numeric",month:"2-digit",day:"2-digit"});const we=["fiftyTwoWkHigh","fiftyTwoWkLow","globe_page","high","lastPrice","low","marketCapitalization","netChange","open","peRatio","percentChange","ticker"];function ve({resultData:e,index:t=0}){return we.reduce((s,a)=>{if(void 0===e?.[a])return s;const n=Array.isArray(e[a])?e[a]?.[t]??null:e?.[a]??null;return(0,v.gD)(n)?s:ue(ue({},s),{},{[a]:n})},{})}function Ce(e){return ie().sanitize(e,{ADD_ATTR:["rel","target"]})}function Ne({children:e,onPromptClick:t}){const[s,n]=(0,a.useState)(!1),r=(0,a.useRef)(null),{isAppview:o}=(0,m.f)(),i=o?"tgam://www.theglobeandmail.com/search/classic":"/search/?optedIn=false",{newsAssistantChatHeading:l,newsAssistantChatDescription:c,newsAssistantAutofillPrompt1:d,newsAssistantAutofillPrompt2:u,newsAssistantAutofillPrompt3:h,newsAssistantAutofillPrompt4:p}=(0,W.V)(),f=[d,u,h,p].filter(Boolean),g=(0,a.useCallback)(e=>{e.preventDefault(),n(!0)},[]),y=(0,a.useCallback)(()=>{n(!1)},[]),b=(0,a.useCallback)(()=>{r.current?.focus()},[]),x=(0,a.useCallback)(()=>{n(!1),window.location.href=i},[i]);return(0,A.jsxs)(ee,{className:"tgam-news-assistant-welcome-screen",children:[(0,A.jsxs)(te,{children:[(0,A.jsx)(B.E,{text:o?"Early Access":"Beta",variant:"breaking",className:"mb-16"}),(0,A.jsx)(z.R,{scrollMarginTop:he,children:(0,A.jsx)(se,{heading:"News Assistant",headingType:w.v.PR_2,element:"h2"})}),l&&(0,A.jsx)(ae,{className:"text-gmb-2",children:l}),c&&(0,A.jsx)(ne,{className:"text-gmr-3",children:c}),(0,A.jsx)(re,{ref:r,href:i,"data-sophi-feature":"search-toggle-modal",onClick:g,className:"text-gmb-6",children:"Switch to classic search"})]}),e,!!f?.length&&(0,A.jsx)(Z,{items:f,onClick:t}),(0,A.jsx)(G,{analytics:{fid:"search-toggle",action:"search toggle"},isOpen:s,onAfterClose:b,onRequestClose:y,onSwitchBack:x})]})}ie().addHook("uponSanitizeElement",e=>{(function(e){return e.nodeType===Node.ELEMENT_NODE})(e)&&"A"===e.tagName&&(e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer"))}),Ne.displayName="NewsAssistantWelcomeScreen";var Ae=s(9917);const ke=R().span.withConfig({displayName:"NewsAssistantFilterChipstyles__ChipIconWrapper",componentId:"sc-1cs959l-0"})(["position:relative;display:inline-flex;align-items:center;justify-content:center;width:13px;height:13px;flex-shrink:0;transition:width 400ms cubic-bezier(0.5,2,0.3,0.8),height 400ms cubic-bezier(0.5,2,0.3,0.8);svg{position:absolute;transition:opacity 200ms ease,transform 200ms ease;}"]),_e=(0,E.css)(["background-color:var(--color-fin-blue-200);color:var(--color-fin-blue-700);.news-assistant-filter-chip__icon--active{fill:var(--color-fin-blue-700);opacity:1;transform:scale(1);}.news-assistant-filter-chip__icon--default{opacity:0;transform:scale(0.6);}&:hover{background-color:var(--color-fin-blue-300);color:var(--color-fin-blue-800);}","{width:16px;height:16px;}"],ke),je=(0,E.css)(["background-color:var(--color-grey-100);color:var(--color-grey-700);.news-assistant-filter-chip__icon--active{opacity:0;transform:scale(0.6);}.news-assistant-filter-chip__icon--default{opacity:1;transform:scale(1);}&:hover{background-color:var(--color-grey-200);}","{width:13px;height:13px;}"],ke),Se=R().button.withConfig({displayName:"NewsAssistantFilterChipstyles__ChipButton",componentId:"sc-1cs959l-1"})(["align-items:center;display:inline-flex;gap:6px;padding:6px 12px;border:none;border-radius:50px;cursor:pointer;white-space:nowrap;transition:background-color 200ms ease,color 200ms ease;"," &:focus-visible{outline:2px solid var(--color-alias-focus-ring-default);outline-offset:2px;}"],({$isActive:e})=>e?_e:je);var Oe=s(9458);function Ie({isActive:e,label:t,onClick:s}){const a=e?`remove-${t}`:`add-${t}`;return(0,A.jsxs)(Se,{className:"text-gmr-4",$isActive:e,"aria-pressed":e,"data-sophi-feature":"search-filters","data-sophi-label":a,onClick:s,type:"button",children:[(0,A.jsxs)(ke,{children:[(0,A.jsx)(Oe.A,{className:"news-assistant-filter-chip__icon--default",symbol
1:"add",width:"13",height:"13"}),(0,A.jsx)(Oe.A,{className:"news-assistant-filter-chip__icon--active",symbol:"circle-check",width:"16",height:"16"})]}),t]})}Ie.displayName="NewsAssistantFilterChip";const Pe=(0,E.keyframes)(["from{opacity:0;transform:translate(-50%,-50%) scale(0.95);}to{opacity:1;transform:translate(-50%,-50%) scale(1);}"]),De=(0,E.keyframes)(["from{opacity:0;}to{opacity:0.2;}"]),Ee=(0,E.createGlobalStyle)(["#news-assistant-filter-modal-desktop{animation:"," 250ms cubic-bezier(0.32,0.72,0,1) forwards;width:37.5rem;}.tgam-modal-overlay:has(#news-assistant-filter-modal-desktop){&::after{background-color:var(--color-black-100);opacity:0;animation:"," 200ms ease forwards;}}"],Pe,De),Re=R().div.withConfig({displayName:"NewsAssistantFilterModalstyles__FilterModalContent",componentId:"sc-1w6pd78-0"})(["display:flex;flex-direction:column;height:100%;position:relative;"]),Te=R().div.withConfig({displayName:"NewsAssistantFilterModalstyles__FilterModalScrollArea",componentId:"sc-1w6pd78-1"})(["flex:1;overflow-y:auto;padding-bottom:var(--space-16);"]),Fe=R().fieldset.withConfig({displayName:"NewsAssistantFilterModalstyles__FilterCategory",componentId:"sc-1w6pd78-2"})(["border:none;margin:0;padding:0;& + &{margin-top:24px;}"]),$e=R().legend.withConfig({displayName:"NewsAssistantFilterModalstyles__FilterCategoryLabel",componentId:"sc-1w6pd78-3"})(["font-family:GMsans-Web-Bold,Helvetica,Arial,Verdana,sans-serif;font-size:1rem;line-height:1.5;color:var(--color-grey-800);margin-bottom:var(--space-8);padding:0;"]),Me=R().div.withConfig({displayName:"NewsAssistantFilterModalstyles__FilterChipGroup",componentId:"sc-1w6pd78-4"})(["display:flex;flex-wrap:wrap;gap:var(--space-8);"]),Le=R().div.withConfig({displayName:"NewsAssistantFilterModalstyles__CustomDateFields",componentId:"sc-1w6pd78-5"})(["display:flex;gap:var(--space-16);margin-top:var(--space-8);align-items:flex-start;"]),qe=R().div.withConfig({displayName:"NewsAssistantFilterModalstyles__CustomDateField",componentId:"sc-1w6pd78-6"})(["flex:1;min-width:0;"]),Ue=R().label.withConfig({displayName:"NewsAssistantFilterModalstyles__CustomDateLabel",componentId:"sc-1w6pd78-7"})(["display:block;color:var(--color-grey-700);margin-bottom:4px;"]),Be=R().input.withConfig({displayName:"NewsAssistantFilterModalstyles__CustomDateInput",componentId:"sc-1w6pd78-8"})(["width:100%;height:40px;padding:var(--space-8) 12px;border:1px solid ",";border-radius:4px;color:var(--color-grey-800);background-color:var(--color-white-100);appearance:none;&:focus{outline:2px solid var(--color-alias-focus-ring-default);outline-offset:2px;}"],e=>e.$hasError?"var(--color-red-500)":"var(--color-grey-400)"),We=R().p.withConfig({displayName:"NewsAssistantFilterModalstyles__CustomDateError",componentId:"sc-1w6pd78-9"})(["margin:var(--space-8) 0 0;color:var(--color-red-500);"]),ze=R().div.withConfig({displayName:"NewsAssistantFilterModalstyles__FilterModalFooter",componentId:"sc-1w6pd78-10"})(["display:flex;gap:12px;padding-top:var(--space-16);border-top:1px solid var(--color-grey-200);"]),He={RESULTS:"results",WELCOME:"welcome"},Qe={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ONE_YEAR:"1y",CUSTOM:"custom"},Ye={[Qe.ONE_DAY]:"Past 24 hours",[Qe.ONE_WEEK]:"Past week",[Qe.ONE_MONTH]:"Past month",[Qe.ONE_YEAR]:"Past year",[Qe.CUSTOM]:"Custom range"},Ve=["isOpen","onAfterClose","onClose"];function Ge(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,a)}return s}function Je(e,t,s){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var a=s.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}y().setAppElement("#fusion-app");const Ke=[Qe.ONE_DAY,Qe.ONE_WEEK,Qe.ONE_MONTH,Qe.ONE_YEAR,Qe.CUSTOM];function Xe({availableAuthors:e,availableSections:t,customDateError:s,draftFilters:a,onApply:n,onReset:o,onSetCustomDateFrom:i,onSetCustomDateTo:l,onSetDateRange:c,onToggleAuthor:d,onToggleSection:u}){const m=a.dateRange===Qe.CUSTOM,h=s.toLowerCase().includes("from"),p=function(e=new Date){const t=xe.formatToParts(e),s=Number(t.find(e=>"year"===e.type)?.value),a=Number(t.find(e=>"month"===e.type)?.value),n=Number(t.find(e=>"day"===e.type)?.value);return`${s}
1-${String(a).padStart(2,"0")}-${String(n).padStart(2,"0")}`}();return(0,A.jsxs)(Re,{children:[(0,A.jsx)(Ae.Q,{id:"news-assistant-filters-bypass",startText:"Skip search filters",endText:"Jump to search filters",children:(0,A.jsxs)(Te,{children:[(0,A.jsxs)(Fe,{children:[(0,A.jsx)($e,{children:"Date range"}),(0,A.jsx)(Me,{children:Ke.map(e=>(0,A.jsx)(Ie,{isActive:a.dateRange===e,label:Ye[e],onClick:()=>c(e)},e))}),m&&(0,A.jsxs)(Le,{children:[(0,A.jsxs)(qe,{children:[(0,A.jsx)(Ue,{className:"text-gmr-4",htmlFor:"news-assistant-filter-date-from",children:"From"}),(0,A.jsx)(Be,{className:"text-gmr-4",$hasError:h,id:"news-assistant-filter-date-from",max:p,onChange:e=>i(e.target.value),type:"date",value:a.customDateFrom}),h&&(0,A.jsx)(We,{className:"text-gmr-4",role:"alert",children:s})]}),(0,A.jsxs)(qe,{children:[(0,A.jsx)(Ue,{className:"text-gmr-4",htmlFor:"news-assistant-filter-date-to",children:"To"}),(0,A.jsx)(Be,{className:"text-gmr-4",id:"news-assistant-filter-date-to",max:p,onChange:e=>l(e.target.value),type:"date",value:a.customDateTo})]})]})]}),t.length>0&&(0,A.jsxs)(Fe,{children:[(0,A.jsx)($e,{children:"Section"}),(0,A.jsx)(Me,{children:t.map(e=>(0,A.jsx)(Ie,{isActive:a.sections.includes(e),label:e,onClick:()=>u(e)},e))})]}),e.length>0&&(0,A.jsxs)(Fe,{children:[(0,A.jsx)($e,{children:"Author"}),(0,A.jsx)(Me,{children:e.map(e=>(0,A.jsx)(Ie,{isActive:a.authors.includes(e),label:e,onClick:()=>d(e)},e))})]})]})}),(0,A.jsxs)(ze,{children:[(0,A.jsx)(r.Ay,{analytics:{fid:"search filters"},fullWidth:!0,onClick:o,theme:r.ox.GREY,variant:"outline",children:"Clear filters"}),(0,A.jsx)(r.Ay,{analytics:{fid:"search filters"},fullWidth:!0,onClick:n,children:"Apply filter"})]})]})}function Ze(e){const{isOpen:t,onAfterClose:s,onClose:a}=e,n=function(e,t){if(null==e)return{};var s,a,n=function(e,t){if(null==e)return{};var s={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(-1!==t.indexOf(a))continue;s[a]=e[a]}return s}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)s=r[a],-1===t.indexOf(s)&&{}.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}(e,Ve),o=(0,x.N)({query:T.C9.md.replace("@media ","")})||!1,i=(0,A.jsx)(Xe,function(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?Ge(Object(s),!0).forEach(function(t){Je(e,t,s[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):Ge(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}({},n));return o?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Ee,{}),(0,A.jsx)(y(),{bodyOpenClassName:"u-no-scroll",className:"tgam-modal-content",contentLabel:"Filter results",id:"news-assistant-filter-modal-desktop",isOpen:t,onAfterClose:s,onRequestClose:a,overlayClassName:"tgam-modal-overlay",shouldCloseOnEsc:!0,shouldCloseOnOverlayClick:!0,shouldReturnFocusAfterClose:!0,children:(0,A.jsxs)("div",{className:"tgam-modal-container",children:[(0,A.jsxs)("div",{className:"tgam-modal-header",children:[(0,A.jsx)("h2",{className:"tgam-modal-heading text-gmb-5",children:"Filter"}),(0,A.jsx)(r.Ay,{"aria-label":"Close modal",className:"tgam-modal-button-close",icon:"close",onClick:a})]}),(0,A.jsx)("div",{className:"tgam-modal-body-scroll-area",children:(0,A.jsx)("div",{className:"tgam-modal-body",children:i})})]})})]}):(0,A.jsx)(V.default,{ariaLabel:"Filter results",heading:"Filter",id:"news-assistant-filter-modal-mobile",isOpen:t,onAfterClose:s,onRequestClose:a,children:i})}Xe.displayName="FilterModalBody",Ze.displayName="NewsAssistantFilterModal";const et={ARCHIVE_SEARCH:"archive_search",AUTHOR:"author",CANNOT:"cannot",COMMODITY:"commodity",COMPANY:"company",DIRECT_LINK:"direct_link",FINANCIAL:"financial",FOREX:"forex",PERSONALIZED:"personalized"},tt=e=>"object"==typeof e&&null!==e&&!Array.isArray(e)&&Object.values(et).includes(e.category),st=e=>tt(e)&&e.category===et.ARCHIVE_SEARCH,at=e=>tt(e)&&e.category===et.AUTHOR,nt=e=>tt(e)&&e.category===et.CANNOT,rt=e=>tt(e)&&e.category===et.COMMODITY,ot=e=>tt(e)&&e.category===et.COMPANY,it=e=>tt(e)&&e.category===et.DIRECT_LINK,lt=e=>tt(e)&&e.category===et.FINANCIAL,ct=e=>tt(e)&&e.category===et.FOREX,dt=e=>tt(e)&&e.category===et.PERSONALIZED,ut=e=>tt(e)&&"result"in e&&"object"==typeof e.result&&null!==e.result&&!Array.isArray(e.result),mt=e=>ut(e)&&"all_articles"in e.result&&Array.isArray(e.result.all_articles),ht=e=>!!e&&"object"==typeof e&&!Array.isArray(e)&&"content_id"in e;var pt=s(8174);function ft(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,a)}return s}function gt(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};
1t%2?ft(Object(s),!0).forEach(function(t){yt(e,t,s[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):ft(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}function yt(e,t,s){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var a=s.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}const bt={dateRange:null,customDateFrom:"",customDateTo:"",sections:[],authors:[]};function xt(e){return e.split(/\s+and\s+/i).map(e=>e.trim()).filter(Boolean)}function wt(e){const t=new Map,s=new Map;for(const a of e){const e=a?.trim();if(!e)continue;const n=e.toLowerCase();t.set(n,(t.get(n)||0)+1),s.has(n)||s.set(n,(0,pt.Nt)(e))}return[...t.entries()].sort((e,t)=>t[1]-e[1]).map(([e])=>s.get(e))}function vt({searchResults:e}){const t=(0,a.useMemo)(()=>function(e){const t=new Set;return e.filter(e=>{const s=e.content_id;return!(!s||t.has(s)||(t.add(s),0))})}((mt(e)?e?.result?.all_articles??[]:[]).filter(e=>"inside-the-globe"!==e?.section?.trim()?.toLowerCase()&&!e?.url?.startsWith("/inside-the-globe"))),[e]),[s,n]=(0,a.useState)(bt),[r,o]=(0,a.useState)(bt),[i,l]=(0,a.useState)(!1),[c,d]=(0,a.useState)("");(0,a.useEffect)(()=>{n(bt),o(bt),l(!1),d("")},[e]);const u=(0,a.useMemo)(()=>wt(t.map(e=>{const t=e.section?.trim()??"";return"investing/personal-finance"===t.toLowerCase()?"Personal Finance":t}).filter(Boolean)),[t]),m=(0,a.useMemo)(()=>wt(t.flatMap(e=>Array.isArray(e.bylines)?e.bylines:[]).filter(Boolean).flatMap(xt)).slice(0,20).map(e=>(0,pt.Nt)(e,!0)),[t]),h=(0,a.useMemo)(()=>null!==s.dateRange||s.sections.length>0||s.authors.length>0,[s]),p=(0,a.useCallback)(()=>{o(gt({},s)),d(""),l(!0)},[s]),f=(0,a.useCallback)(()=>{l(!1)},[]),g=(0,a.useCallback)(e=>{o(t=>{const s=t.dateRange===e?null:e;return gt(gt({},t),{},{dateRange:s},s!==Qe.CUSTOM&&{customDateFrom:"",customDateTo:""})}),d("")},[]),y=(0,a.useCallback)(e=>{o(t=>gt(gt({},t),{},{sections:t.sections.includes(e)?t.sections.filter(t=>t!==e):[...t.sections,e]}))},[]),b=(0,a.useCallback)(e=>{o(t=>gt(gt({},t),{},{authors:t.authors.includes(e)?t.authors.filter(t=>t!==e):[...t.authors,e]}))},[]),x=(0,a.useCallback)(e=>{o(t=>gt(gt({},t),{},{customDateFrom:e})),d("")},[]),w=(0,a.useCallback)(e=>{o(t=>gt(gt({},t),{},{customDateTo:e})),d("")},[]),v=(0,a.useCallback)(()=>{r.dateRange!==Qe.CUSTOM||r.customDateFrom?r.dateRange===Qe.CUSTOM&&r.customDateFrom&&r.customDateTo&&new Date(r.customDateFrom)>new Date(r.customDateTo)?d('"From" date must be before "To" date'):(n(gt({},r)),l(!1)):d("The from field is required")},[r]),C=(0,a.useCallback)(()=>{o(bt),d("")},[]),N=(0,a.useCallback)((e,t)=>{n(s=>"dateRange"===e?gt(gt({},s),{},{dateRange:null,customDateFrom:"",customDateTo:""}):"section"===e&&t?gt(gt({},s),{},{sections:s.sections.filter(e=>e!==t)}):"author"===e&&t?gt(gt({},s),{},{authors:s.authors.filter(e=>e!==t)}):s)},[]),A=(0,a.useMemo)(()=>h?t.filter(e=>{if(s.dateRange){const t=e.publish_date?new Date(e.publish_date):null;if(!t||isNaN(t.getTime()))return!1;if(s.dateRange===Qe.CUSTOM){if(s.customDateFrom&&t<new Date(s.customDateFrom))return!1;if(s.customDateTo){const e=new Date(s.customDateTo);if(e.setUTCHours(23,59,59,999),t>e)return!1}}else{const e=function(e){const t=new Date,s=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());switch(e){case Qe.ONE_DAY:return new Date(s-864e5);case Qe.ONE_WEEK:return new Date(s-6048e5);case Qe.ONE_MONTH:{const e=new Date(Date.UTC(t.getFullYear(),t.getMonth()-1,1)),s=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+1,0)).getUTCDate();return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),Math.min(t.getDate(),s)))}case Qe.ONE_YEAR:{const e=new Date(Date.UTC(t.getFullYear()-1,t.getMonth(),1)),s=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+1,0)).getUTCDate();return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),Math.min(t.getDate(),s)))}default:return null}}(s.dateRange);if(e&&t<e)return!1}}return!(s.sections.length>0&&!s.sections.some(t=>t.toLowerCase()===(e.section||"").toLowerCase()))&&!(s.authors.length>0&&(!Array.isArray(e.bylines)||!e.bylines.flatMap(xt).some(e=>s.authors.some(t=>t.toLowerCase()===e.toLowerCase()))))}):t,[t,s,h]);return{appliedFilters:s,availableAuthors:m,availableSections:u,applyFilters:v,closeFilterModal:f,customDateError:c,draftFilters:r,filteredArticles:A,hasActiveFilters:h,isFilterModalOpen:i,openFilterModal:p,removeAppliedFilter:N,resetFilters:C,setDraftAuthor:b,setDraftCustomDateFrom:x,setDraftCustomDateTo:w,setDraftDateRange:g,setDraftSection:y}}var Ct=s(76755);const Nt=(0,E.keyframes)(["0%,100%{opacity:1;}50%{opacity:0.4;}"]),At=(0,E.css)(["background:var(--color-grey-200);border-radius:4px;"]),kt=R().div.withConfig({displayName:"NewsAssistantStoryCardSkeletonstyles__SkeletonCard",componentId:"sc-1xm5k5c-0"})(["animation:"," 1.5s ease-in-out infinite;display:flex;gap:16px;"],Nt),_t=R().div.withConfig({displayName:"NewsAssistantStoryCardSkeletonstyles__SkeletonLeftCol",componentId:"sc-1xm5k5c-1"})(["flex:1;display:flex;flex-direction:column;gap:16px;"]),jt=R().div.withConfig({displayName:"NewsAssistantStoryCardSkeletonstyles__SkeletonLeftColMiddle",componentId:"sc-1xm5k5c-2"})(["display:flex;flex-direction:column;gap:6px;"]),St=R().div.withConfig({displayName:"NewsAssistantStoryCardSkeletonstyles__SkeletonLeftColTop",componentId:"sc-1xm5k5c-3"})([""," width:100%;max-width:100px;height:10px;"],At),Ot=R().div.withConfig({displayName:"NewsAssistantStoryCardSkeletonstyles__SkeletonLeftColBottom",componentId:"sc-1xm5k5c-4"})([""," width:100%;max-width:100px;height:16px;"],At),It=R().div.withConfig({displayName:"NewsAssistantStoryCardSkeletonstyles__SkeletonBar",componentId:"sc-1xm5k5c-5"})([""," height:16px;"],At),Pt=R().div.withConfig({displayName:"NewsAssistantStoryCardSkeletonstyles__SkeletonImage",componentId:"sc-1xm5k5c-6"})([""," width:100px;height:100px;"],At);function Dt(){return(0,A.jsxs)(kt,{className:"tgam-card-container",children:[(0,A.jsxs)(_t,{children:[(0,A.jsx)(St,{}),(0,A.jsxs)(jt,{children:[(0,A.jsx)(It,{}),(0,A.jsx)(It,{}),(0,A.jsx)(It,{})]}),(0,A.jsx)(Ot,{})]}),(0,A.jsx)(Pt,{})]})}Dt.displayName="NewsAssistantStoryCardSkeleton";var Et=s(13287),Rt=s(66274),Tt=s(37150),Ft=s(16805),$t=s(23134),Mt=s(26998),Lt=s(61021),qt=s(80436),Ut=s(86153),Bt=s(67591),Wt=s(71019),zt=s(86058),Ht=s(63488),Qt=s(9009),Yt=s(99818);function Vt(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,a)}return s}function Gt(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};
1t%2?Vt(Object(s),!0).forEach(function(t){Jt(e,t,s[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):Vt(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}function Jt(e,t,s){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var a=s.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}const Kt="tgam-card-news-assistant-standard";function Xt({analytics:e={},className:t,componentId:s,photoDataLgScreen:a,photoDataSmScreen:n,story:r}){const o=r.headlines.basic,i=r.subheadlines.basic,l=r.owner.sponsored,c={label:r?.label,primarySite:(0,zt.ik)(r),storyType:r?.type},d=(0,Wt.lN)(c);l&&(d.text="Sponsor content",d.variant=Qt.xb.TOPIC);const u=new Date(r.publishedDate),m=""===r.publishedDate||Number.isNaN(u.getTime())?null:(0,Yt.K)(u),h=(0,Lt.M)({featuredMediaType:"basic",isSponsored:l,mainPhoto:r.mainPhoto,promoItems:r.promo_items,isGreyTheme:!1}),p=(0,Mt.z)({canonicalUrl:r.canonical_url,className:`${Kt}__photo--sm-screen`,openInNewTab:!0,photoData:n}),f=(0,Mt.z)({canonicalUrl:r.canonical_url,className:`${Kt}__photo--lg-screen`,openInNewTab:!0,photoData:a}),g=(0,Et.A)([Kt,{[`${Kt}--sponsored`]:l,[`${Kt}--no-photo-sm-screen`]:!h&&!p,[`${Kt}--no-photo-lg-screen`]:!h&&!f},t]);return(0,A.jsx)(qt.A,{children:(0,A.jsx)("div",{className:`${Kt}__root`,children:(0,A.jsxs)("article",{className:g,"data-sophi-feature":e?.fid,"data-card-style":Ht.cj.DEFAULT,"data-card-type":Kt,"data-content-id":r._id,"data-sophi-label":o,children:[(0,A.jsxs)("div",{className:`${Kt}__headline-area`,children:[(0,A.jsx)("div",{className:`${Kt}__headline-area__labels`,children:(0,A.jsx)(B.E,Gt(Gt({},d),{},{isSponsored:l}))}),(0,A.jsx)(Ut.A,{canonicalUrl:r.canonical_url,openInNewTab:!0,children:o}),!l&&(0,A.jsx)(Bt.A,{children:i}),(0,A.jsx)(Ft.I,{credits:r?.credits?.by,labelData:d,subtype:r?.subtype??"",storyOwner:r?.owner,ignoreStaffOrFreelance:!0,debugType:"NewsAssistantStoryCardStandard"})]}),(0,A.jsx)("div",{className:`${Kt}__media-area`,children:h||(0,A.jsxs)(A.Fragment,{children:[p,f]})}),(0,A.jsxs)("div",{className:`${Kt}__tools-area`,children:[!l&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("time",{className:(0,Et.A)(["text-gmr-5",`${Kt}__tools-area__time`]),dateTime:r.publishedDate&&!Number.isNaN(u.getTime())?(0,le.$8)(u):void 0,title:r.publishedDate&&!Number.isNaN(u.getTime())?u.toLocaleString("en-CA",{timeZone:le.CC}):void 0,children:m}),(0,A.jsx)($t.N,{story:r})]}),(0,A.jsx)(Rt.L,{componentId:s,story:r,analytics:e}),(0,A.jsx)(Tt.E,{componentId:s,story:r,analytics:e})]})]})})})}Xt.displayName="NewsAssistantStoryCardStandard";var Zt=s(41714);function es(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,a)}return s}function ts(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?es(Object(s),!0).forEach(function(t){ss(e,t,s[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):es(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}function ss(e,t,s){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var a=s.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}const as="tgam-card-news-assistant-with-date";function ns({analytics:e={},className:t,componentId:s,photoDataLgScreen:a,photoDataSmScreen:n,story:r}){const{_id:o,publishedDate:i,canonical_url:l,type:c,subtype:d,credits:u,headlines:m,label:h}=r,{basic:p}=m||{},{by:f}=u||{},g=r.owner.sponsored,y={label:h,primarySite:(0,zt.ik)(r),storyType:c},b=(0,Wt.lN)(y);g&&(b.text="Sponsor content",b.variant=Qt.xb.TOPIC);const x=(0,Mt.z)({canonicalUrl:l,className:`${as}__photo--sm-screen`,openInNewTab:!0,photoData:n}),w=(0,Mt.z)({canonicalUrl:l,className:`${as}__photo--lg-screen`,openInNewTab:!0,photoData:a}),v=(0,Et.A)([as,{[`${as}--sponsored`]:g},t]);return(0,A.jsx)(qt.A,{children:(0,A.jsxs)("article",{className:v,"data-sophi-feature":e?.fid,"data-card-style":Ht.cj.DEFAULT,"data-card-type":as,"data-content-id":o,"data-sophi-label":p,children:[!g&&(0,A.jsx)(Zt.A,{publishedDate:i,display:"block",dateClasses:(0,Et.A)(["text-gmr-5",`${as}__date`])}),(0,A.jsxs)("div",{className:`${as}__media-area`,children:[x,w]}),(0,A.jsxs)("div",{className:`${as}__headline-area`,children:[(0,A.jsx)(B.E,ts(ts({},b),{},{isSponsored:g})),(0,A.jsx)(Ut.A,{canonicalUrl:l,openInNewTab:!0,children:p})]}),(0,A.jsx)(Ft.I,{credits:f,ignoreStaffOrFreelance:!0,labelData:b,storyOwner:r?.owner,subtype:d,debugType:"NewsAssistantStoryCardWithDate",className:`${as}__bylines`}),(0,A.jsxs)("div",{className:`${as}__tools-area`,children:[!g&&(0,A.jsx)($t.N,{story:r}),(0,A.jsx)(Rt.L,{componentId:s,story:r,analytics:e}),(0,A.jsx)(Tt.E,{componentId:s,story:r,analytics:e})]})]})})}ns.displayName="NewsAssistantStoryCardWithDate";var rs=s(60392),os=s(29297),is=s(77833),ls=s(57817),cs=s(12675);const ds=(0,cs.A)("[NewsAssistantStoryCard]");function us({cardType:e,contentId:t,dataId:s=1,onSettled:n,tabName:r}){const[o,i]=(0,a.useState)(null),[l,c]=(0,a.useState)(!0),[d,u]=(0,a.useState)(!1),m=(0,a.useRef)(null),h=(0,a.useCallback)(()=>{m.current&&(m.current.abort(),m.current=null)},[]);if((0,a.useEffect)(()=>()=>{h()}
1,[h]),(0,Ct.S)(()=>{!async function(){m.current&&(ds.debug(`Cancelling unfulfilled request for ${t}`),h());const e=new AbortController;m.current=e,c(!0);try{const a=encodeURIComponent(JSON.stringify({id:t,env:"prod"})),r=await fetch(`/pf/api/v3/content/fetch/content-by-content-id-news?query=${a}&_website=tgam`,{signal:e.signal});if(m.current===e&&!e.signal.aborted){const e=await(0,is.Xt)(r);i(e),(0,v.Ak)(n,[t,s,!0])}}catch(a){if(a instanceof Error&&"AbortError"===a.name)return void ds.debug(`Request cancelled for ${t}`,a);m.current===e&&!e.signal.aborted&&(ds.error(`Error fetching ${t}`,a instanceof Error?a.message:String(a)),u(!0),(0,v.Ak)(n,[t,s,!1]))}finally{const t=m.current===e;t&&(m.current=null),t&&!e.signal.aborted&&c(!1)}}()},[h,t,s,n],!0),l)return(0,A.jsx)(Dt,{});const p=!!o&&Object.keys(o).length>0;if(d||!p)return(0,A.jsx)("div",{className:"tgam-news-assistant-card--error"});const f=(0,os.f)(o,rs.Y.ARC),{defaultSource:g,mobileSource:y}=(0,ls.n)(f),b={fid:`search: ${"best-matches"===r?"best-match":r}`};return"standard"===e?(0,A.jsx)(Xt,{analytics:b,componentId:`news-assistant-standard-card-${f?._id||""}`,photoDataLgScreen:{aspectRatio:"3:2",source:g},photoDataSmScreen:{aspectRatio:"1:1",source:y||g},story:f}):(0,A.jsx)(ns,{analytics:b,componentId:`news-assistant-date-card-${f?._id||""}`,photoDataLgScreen:{aspectRatio:"3:2",source:g},photoDataSmScreen:{aspectRatio:"1:1",source:y||g},story:f})}us.displayName="NewsAssistantStoryCard";const ms=R().div.withConfig({displayName:"NewsAssistantActiveFiltersstyles__ActiveFiltersBar",componentId:"sc-5ska68-0"})(["display:flex;gap:var(--space-8);overflow-x:auto;padding:0;scrollbar-width:thin;&::-webkit-scrollbar{height:4px;}&::-webkit-scrollbar-thumb{background-color:var(--color-grey-300);border-radius:2px;}"]),hs=R().button.withConfig({displayName:"NewsAssistantActiveFiltersstyles__ActiveFilterChip",componentId:"sc-5ska68-1"})(["display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border:none;border-radius:50px;cursor:pointer;white-space:nowrap;background-color:var(--color-grey-100);color:var(--color-grey-700);transition:background-color 150ms ease,color 150ms ease;svg{flex-shrink:0;fill:var(--color-grey-700);}&:hover{background-color:var(--color-grey-200);color:var(--color-grey-800);svg{fill:var(--color-grey-800);}}&:focus-visible{outline:2px solid var(--color-alias-focus-ring-default);outline-offset:2px;}"]);var ps=s(50508);function fs({appliedFilters:e,onRemoveFilter:t}){const s=[];if(e.dateRange){let a=Ye[e.dateRange];if(e.dateRange===Qe.CUSTOM){a=`${e.customDateFrom||"â¦"} â ${e.customDateTo||"â¦"}`}s.push({key:"date",label:a,onRemove:()=>t("dateRange")})}for(const a of e.sections)s.push({key:`section-${a}`,label:a,onRemove:()=>t("section",a)});for(const a of e.authors)s.push({key:`author-${a}`,label:a,onRemove:()=>t("author",a)});return 0===s.length?null:(0,A.jsx)(ms,{"aria-label":"Active filters",children:s.map(e=>(0,A.jsxs)(hs,{className:"text-gmr-4","aria-label":`Remove filter: ${e.label}`,onClick:e.onRemove,"data-sophi-feature":(0,ps.Uv)("search-filters"),"data-sophi-label":`remove-${e.label}`,type:"button",children:[e.label,(0,A.jsx)(Oe.A,{symbol:"close",width:"10",height:"10"})]},e.key))})}fs.displayName="NewsAssistantActiveFilters";var gs=s(5334);const ys=R().div.withConfig({displayName:"NewsAssistantPanelstyles__PanelRoot",componentId:"sc-1oaxfgt-0"})(["display:grid;grid-template-columns:1fr;gap:var(--space-16);width:100%;margin:0;background-color:var(--color-white);padding:var(--space-16) 0 0 0;text-align:left;min-height:5rem;position:relative;&:focus-visible{outline:2px solid var(--color-alias-focus-ring-default);outline-offset:2px;}"]),bs=R()(gs.S).withConfig({displayName:"NewsAssistantPanelstyles__CardContainer",componentId:"sc-1oaxfgt-1"})([".tgam-layout-floating-borders__item:has(.tgam-news-assistant-card--error){display:none;}.tgam-layout-floating-borders__item:not(:has(~ div .tgam-card-container))::after{display:none;}"]),xs=R().div.withConfig({displayName:"NewsAssistantPanelAllArticlesstyles__ErrorMessage",componentId:"sc-1tm5qig-0"})(["padding-top:16px;display:flex;flex-direction:column;justify-content:center;text-align:center;gap:8px;&:focus-visible{outline:2px solid var(--color-alias-focus-ring-default);outline-offset:0;}"]),ws=R()(r.Ay).withConfig({displayName:"NewsAssistantPanelAllArticlesstyles__FilterButton",componentId:"sc-1tm5qig-1"})(["&&{background-color:var(--color-white-100);color:var(--color-grey-700);text-transform:uppercase;
1.tgam-button__icon{fill:var(--color-grey-700);}&:hover,&:focus{background-color:var(--color-grey-100);}}"]),vs=R().div.withConfig({displayName:"NewsAssistantPanelAllArticlesstyles__PaginationContainer",componentId:"sc-1tm5qig-2"})(["position:relative;.c-skip-link--bypass--end{top:0;bottom:unset;left:unset;right:0;}"]),Cs=R().div.withConfig({displayName:"NewsAssistantPanelAllArticlesstyles__ResultsHeader",componentId:"sc-1tm5qig-3"})(["display:flex;justify-content:space-between;align-items:center;"]),Ns=R().p.withConfig({displayName:"NewsAssistantPanelAllArticlesstyles__ResultsInfo",componentId:"sc-1tm5qig-4"})(["color:var(--color-grey-600);scroll-margin-top:60px;&:focus-visible{outline:2px solid var(--color-alias-focus-ring-default);outline-offset:0;}"]),As=R().div.withConfig({displayName:"NewsAssistantPanelAllArticlesstyles__ResultsMessage",componentId:"sc-1tm5qig-5"})(["display:flex;flex-direction:column;justify-content:center;text-align:center;gap:8px;"]),ks=R().section.withConfig({displayName:"NewsAssistantPanelAllArticlesstyles__ResultsSection",componentId:"sc-1tm5qig-6"})(["position:relative;"]);var _s=s(9659);const js=(0,cs.A)("[NewsAssistantPanelAllArticles]"),Ss=10,Os=1e3,Is={IDLE:"idle",LOADING:"loading",ERROR:"error",NO_RESULTS:"noResults"};function Ps({appliedFilters:e,filterButtonRef:t,hasActiveFilters:s,isActivePanel:n,onOpenFilterModal:o,onRemoveFilter:i,resultsSkipLinkPrimaryTargetId:l,searchCanceled:c,searchError:d,searchPending:u,searchQueryPending:m,searchQueryResolved:h,setStatusMessage:p,storyData:f}){const[g,y]=(0,a.useState)(Is.IDLE),b=(0,a.useRef)(null),x=(0,a.useMemo)(()=>{const{dateRange:t,customDateFrom:s,sections:a=[],authors:n=[]}=e;let r=[...a,...n].length;return t&&t!==Qe.CUSTOM&&(r+=1),t&&t===Qe.CUSTOM&&s&&(r+=1),r},[e]),w=(0,a.useMemo)(()=>{const{dateRange:t,customDateFrom:s,customDateTo:a,sections:n,authors:r}=e;return JSON.stringify({dateRange:t,customDateFrom:s,customDateTo:a,sections:n,authors:r})},[e]),v=(0,a.useMemo)(()=>f.map(e=>e?.content_id).filter(e=>!!e),[f]),C=(0,a.useRef)(v),[N,k]=(0,a.useState)(0),_=(0,a.useRef)(N),j=(0,a.useCallback)(e=>{k(e-1)},[]),S=(0,a.useMemo)(()=>C.current!==v?v.length>0?Is.LOADING:Is.NO_RESULTS:_.current!==N?Is.LOADING:g,[v,N,g]),O=!u&&S===Is.ERROR,I=!u&&S===Is.NO_RESULTS,P=!u&&(S===Is.IDLE||S===Is.LOADING),D=(0,a.useCallback)(e=>{const t=e?`<strong>${m}</strong>`:`"${m}"`,s=e?`<strong>${h}</strong>`:`"${h}"`,a=!e&&x>0?` with ${x} applied ${1!==x?"filters":"filter"}`:"",n=`Searching for ${t}`;if(u)return n;if(c)return`Search for ${t} was canceled`;if(d)return`Error occurred while searching for ${s}`;if(!u){if(S===Is.LOADING)return n;if(S===Is.ERROR)return`Failed to fetch results for ${s}`;if(S===Is.NO_RESULTS)return`No results available for ${s}`;if(S===Is.IDLE){const e=`Showing ${f.length} ${1!==f.length?"results":"result"}`;return h?`${e} for ${s}${a}`:`${e}${a}`}}return js.warn("No status message"),""},[x,c,d,u,m,h,S,f.length]),E=D(!1),R=D(!0);(0,a.useEffect)(()=>{n&&E&&p(E)},[E,w,n,p]);const T=(0,a.useRef)(1),F=(0,a.useRef)(1),[$,M]=(0,a.useState)([]),L=(0,a.useRef)(0),q=(0,a.useRef)(0),U=(0,a.useRef)(0),B=(0,a.useRef)(0),W=(0,a.useRef)(void 0),z=(0,a.useCallback)(e=>{clearTimeout(W.current);const t=Date.now()-B.current,s=Os-t;s>0?W.current=setTimeout(()=>y(e),s):y(e)},[]);(0,a.useEffect)(()=>()=>clearTimeout(W.current),[]);const H=(0,a.useCallback)((e,t,s)=>{if(0!==L.current)if(t===F.current){if(q.current+=1,s||(U.current+=1),U.current===L.current)return js.debug("Failed to fetch any stories"),L.current=0,void z(Is.ERROR);q.current===L.current&&(js.debug("Fetched all stories"),L.current=0,z(Is.IDLE))}else js.debug(`Fetched inactive story: ${e} (${t})`);else js.debug(`Late settled event ignored: ${e}`)},[z]),Q=(0,a.useMemo)(()=>$.map((e,t)=>(0,A.jsx)(us,{cardType:"date",contentId:e,dataId:F.current,onSettled:H,tabName:"all"},`${e}-${F.current}-${t}`)),[$,H]);return(0,a.useEffect)(()=>{clearTimeout(W.current);if(C.current!==v&&(C.current=v,T.current+=1,js.debug(`Search fingerprint changed: ${T.current}`),0!==N))return void k(0);F.current+=1,js.debug(`Page fingerprint changed: ${F.current}`),_.current=N;const e=v.length;if(0===e)return js.debug("No content IDs"),y(Is.NO_RESULTS),void M([]);const t=N+1,s=N*Ss,a=s+Ss,n=v.slice(s,a);q.current=0,U.current=0,0===n.length?(js.debug(`Page ${t}: No content IDs to fetch (${s+1} to ${a}) of ${e}`),y(Is.NO_RESULTS),M([])):(js.debug(`Page ${t}: Fetching ${n.length} stories (${s+1} to ${a}) of ${e}â¦`),B.current=Date.now(),y(Is.LOADING),L.current=n.length,M(n))},[v,N]),(0,A.jsxs)(ys,{children:[(0,A.jsxs)(Cs,{children:[(0,A.jsx)(Ns,{id:l,ref:b,tabIndex:-1,
1children:(0,A.jsx)("span",{dangerouslySetInnerHTML:{__html:Ce(R)}})}),(P||I)&&(0,A.jsx)(ws,{analytics:{fid:"search filters"},"aria-label":"Filter results",className:"text-gml-2",icon:"customize",onClick:o,reference:t,variant:r.Ck.PILL,children:"Filter"})]}),d?(0,A.jsx)(xs,{children:(0,A.jsx)("h2",{className:"text-gmb-3 mv-0",children:"Please try again"})}):(0,A.jsxs)(A.Fragment,{children:[s&&(0,A.jsx)(fs,{appliedFilters:e,onRemoveFilter:i}),I&&(0,A.jsxs)(As,{children:[(0,A.jsx)("h2",{className:"text-gmb-3 mv-0",children:"Switch to Best matches"}),(0,A.jsx)("p",{className:"text-gmr-3 mv-0",children:"There are no results to show in All articles. You might find relevant results in Best matches."})]}),O&&(0,A.jsxs)(As,{children:[(0,A.jsx)("h2",{className:"text-gmb-3 mv-0",children:"An error occurred"}),(0,A.jsx)("p",{className:"text-gmr-3 mv-0",children:"Please try again."})]}),(0,A.jsx)(ks,{"aria-busy":u||S===Is.LOADING,children:P&&$.length>0?(0,A.jsx)(Ae.Q,{id:"tgam-news-assistant-results-bypass",startText:"Skip search results",endText:"Jump to search results",children:(0,A.jsx)(bs,{children:Q})}):(0,A.jsx)(bs,{children:Q})}),P&&(0,A.jsx)(vs,{children:(0,A.jsx)(Ae.Q,{id:"tgam-news-assistant-pagination-bypass",startText:"Skip pagination links",endText:"Jump to pagination links",children:(0,A.jsx)(_s.A,{dataId:`id-${T.current}`,displayItemsCount:!1,itemLabel:"results",numberOfItemsPerPage:Ss,onClick:()=>{ce.Sw&&window.scrollTo(0,0)},onPageChange:j,pageLimit:0,sophiFeature:"search",spaMode:!0,total:v.length})})})]})]})}function Ds({animatedScroll:e=!0,className:t,linkText:s,targetId:a}){if(!s||!a)return;const n=(0,Et.A)(["c-skip-link","c-skip-link--standalone",t]);return(0,A.jsx)("a",{href:`#${a}`,className:n,onClick:t=>{t.preventDefault();const s=document.getElementById(a);s&&(s.focus({preventScroll:!0}),s.scrollIntoView({behavior:e&&!ce.tT?"smooth":"instant",block:"start"}))},children:s})}Ps.displayName="NewsAssistantPanelAllArticles",Ds.displayName="SkipLinkStandalone";const Es=R().div.withConfig({displayName:"NewsAssistantAuthorCardstyles__AuthorCardsContainer",componentId:"sc-fsb0z6-0"})(["display:flex;gap:var(--space-16);"]),Rs=R().article.withConfig({displayName:"NewsAssistantAuthorCardstyles__AuthorCardWrapper",componentId:"sc-fsb0z6-1"})(["border-radius:8px;box-shadow:0 1px 7px rgba(0,0,0,0.05),0 0 16px rgba(0,0,0,0.05);flex:auto;padding:var(--space-16);"]),Ts=R().div.withConfig({displayName:"NewsAssistantAuthorCardstyles__AuthorInfo",componentId:"sc-fsb0z6-2"})(["display:flex;align-items:center;gap:var(--space-16);"]),Fs=R().img.withConfig({displayName:"NewsAssistantAuthorCardstyles__AuthorPortrait",componentId:"sc-fsb0z6-3"})(["width:50px;height:50px;border-radius:50%;object-fit:cover;flex-shrink:0;"]),$s=R().div.withConfig({displayName:"NewsAssistantAuthorCardstyles__AuthorDetails",componentId:"sc-fsb0z6-4"})(["display:flex;flex-direction:column;gap:var(--space-4);"]),Ms=R().a.withConfig({displayName:"NewsAssistantAuthorCardstyles__AuthorName",componentId:"sc-fsb0z6-5"})(["display:inline-flex;align-items:center;gap:var(--space-4);color:var(--color-grey-800);text-decoration:none;svg{width:12px;height:12px;flex-shrink:0;transform:rotate(-90deg);}&:hover{text-decoration:underline;}"]),Ls=R().span.withConfig({displayName:"NewsAssistantAuthorCardstyles__AuthorBeat",componentId:"sc-fsb0z6-6"})(["color:var(--color-grey-700);"]),qs=R().div.withConfig({displayName:"NewsAssistantAuthorCardstyles__AboutToggle",componentId:"sc-fsb0z6-7"})(["margin-top:var(--space-16);"]),Us=R().button.withConfig({displayName:"NewsAssistantAuthorCardstyles__ToggleButton",componentId:"sc-fsb0z6-8"})(["display:flex;align-items:center;justify-content:space-between;background:var(--color-grey-100);border:none;border-radius:8px;padding:",' var(--space-16);cursor:pointer;width:100%;text-align:left;svg{width:12px;height:12px;transition:transform 0.2s ease;flex-shrink:0;margin-left:auto;}&[aria-expanded="true"]{border-radius:8px 8px 0 0;svg{transform:rotate(180deg);}}'],(0,C.D0)(12)),Bs=R().span.withConfig({displayName:"NewsAssistantAuthorCardstyles__ToggleHeading",componentId:"sc-fsb
10z6-9"})(["color:var(--color-grey-700);"]),Ws=R().div.withConfig({displayName:"NewsAssistantAuthorCardstyles__BioCollapsible",componentId:"sc-fsb0z6-10"})(["display:grid;grid-template-rows:",";transition:grid-template-rows 0.3s ease;"],({$open:e})=>e?"1fr":"0fr"),zs=R().div.withConfig({displayName:"NewsAssistantAuthorCardstyles__BioContent",componentId:"sc-fsb0z6-11"})(["overflow:hidden;min-height:0;"]),Hs=R().div.withConfig({displayName:"NewsAssistantAuthorCardstyles__BioContentInner",componentId:"sc-fsb0z6-12"})(["padding:"," var(--space-16);background:var(--color-grey-100);color:var(--color-grey-700);p{margin:0 0 var(--space-8);&:last-child{margin-bottom:0;}}a{color:var(--color-grey-800);text-decoration:underline;&:hover{text-decoration:none;}}ul,ol{margin:0 0 var(--space-8);padding-left:var(--space-16);&:last-child{margin-bottom:0;}}li{margin-bottom:var(--space-4);}strong,b{font-weight:700;}em,i{font-style:italic;}"],(0,C.D0)(12));function Qs({author:e,showBio:t}){const[s,n]=(0,a.useState)(!1),r=e.Byline?`author-bio-${e.Byline.replace(/\s+/g,"-").toLowerCase()}`:void 0;return(0,A.jsxs)(Rs,{children:[(0,A.jsxs)(Ts,{children:[e.ImageUrl200&&(0,A.jsx)(Fs,{src:e.ImageUrl200,alt:e.Byline||"Author"}),(0,A.jsxs)($s,{children:[e.Byline&&(e.BioPage?(0,A.jsxs)(Ms,{className:"text-gml-1",href:e.BioPage,"data-sophi-feature":`search: ${e.Byline}`,rel:"noopener noreferrer",target:"_blank",children:[e.Byline,(0,A.jsx)(Oe.A,{symbol:"dropdown-chevron",width:"12",height:"12"})]}):(0,A.jsx)(Ms,{as:"span",className:"text-gml-1",children:e.Byline})),e.beat&&(0,A.jsx)(Ls,{className:"text-gmr-4",children:e.beat})]})]}),t&&e.longBio&&(0,A.jsxs)(qs,{children:[(0,A.jsxs)(Us,{"aria-controls":r,"aria-expanded":s,"data-sophi-feature":e.Byline?`search: ${e.Byline}`:"search",onClick:()=>n(!s),children:[(0,A.jsx)(Bs,{className:"text-gmb-6",children:"About the author"}),(0,A.jsx)(Oe.A,{symbol:"dropdown-chevron",width:"12",height:"12"})]}),(0,A.jsx)(Ws,{$open:s,children:(0,A.jsx)(zs,{children:(0,A.jsx)(Hs,{className:"text-gmr-4",id:r,role:"region",dangerouslySetInnerHTML:{__html:Ce(e.longBio)}})})})]})]})}function Ys({authors:e}){if(!e.length)return null;const t=e.length>1;return(0,A.jsx)(Es,{"data-multi":t,children:e.map((e,s)=>(0,A.jsx)(Qs,{author:e,showBio:!t},e.Byline||e.BioPage||s))})}Qs.displayName="NewsAssistantAuthorCard",Ys.displayName="NewsAssistantAuthorCards";const Vs=R().p.withConfig({displayName:"AnimatedLoadingText__LoadingText",componentId:"sc-vb7qbd-0"})(["color:var(--color-grey-400);margin:0;padding:var(--space-8) 0;height:auto;overflow:hidden;white-space:nowrap;display:inline-block;",""],({$typing:e})=>e&&(0,E.css)(["animation:"," 5s linear 0s 1 forwards,"," 5s linear 3s infinite;"],e,e));function Gs(){const e=(0,a.useRef)(null),[t,s]=(0,a.useState)(""),[n,r]=(0,a.useState)(null),o=(0,a.useRef)(null);return(0,a.useLayoutEffect)(()=>{if(e.current){const t=function(e){const t=document.createElement("canvas").getContext("2d");return t.font=getComputedStyle(e).font,[...e.textContent||""].map(e=>t.measureText(e).width)}(e.current);r(function(e){if(0===e.length)return(0,E.keyframes)(["from{width:0}to{width:100%}"]);const t=e.reduce((e,t)=>e+t,0),s=e.reduce((s,a,n)=>{const r=(e.slice(0,n+1).reduce((e,t)=>e+t,0)/t*100).toFixed(4);return s+` ${r}% { width: ${r}% }\n`},"from { width: 0 }\n")+"to { width: 100% }";return(0,E.keyframes)(["",""],s)}(t))}},[t]),(0,a.useEffect)(()=>{const e=setTimeout(()=>{const e=Math.floor(3*Math.random()),t=ye(e);s(t),o.current=setInterval(()=>{const e=Math.floor(3*Math.random()),t=ye(e);s(t)},5e3)},8e3),t=Math.floor(3*Math.random()),a=ye(t);return s(a),()=>{clearTimeout(e),o.current&&clearInterval(o.current)}},[]),(0,A.jsx)(Vs,{ref:e,className:"text-gmr-3","aria-hidden":"true",$typing:n,children:t})}Gs.displayName="AnimatedLoadingText";var Js=s(15710);const Ks=(0,cs.A)("[NewsAssistantChatChunks]");function Xs(e,t){switch(t.type){case"CLEAR":return[];case"APPEND":return[...e.filter(e=>!e.isLoadingPlaceholder),t.chunk];default:return e}}var Zs=s(43396),ea=s(91602),ta=s(89429),sa=s(16422);const aa=["symbol"];const na=(0,cs.A)("[useBarchartChart]");function ra(e){let{symbol:t}=e,s=function(e,t){if(null==e)return{};var s,a,n=function(e,t){if(null==e)return{};var s={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(-1!==t.indexOf(a))continue;s[a]=e[a]}return s}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)s=r[a],-1===t.indexOf(s)&&{}.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}(e,aa);
1const[n,r]=(0,a.useState)(""),o=new URLSearchParams({symbol:t});for(const[e,t]of Object.entries(s))null!=t&&o.set(e,String(t));const i=`${sa.Ky}?${o.toString()}`;return(0,a.useEffect)(()=>{t&&fetch(i).then(e=>e.ok?e.json():(na.error(`Chart fetch failed: ${e.status} ${e.statusText}`),null)).then(e=>r(e?.imageUrl??"")).catch(e=>{na.error("Chart fetch error",e),r("")})},[i,t]),n}const oa=R().div.withConfig({displayName:"NewsAssistantFinancialCardstyles__FinancialCardContainer",componentId:"sc-1mvifl1-0"})(["width:100%;max-width:",";"],(0,C.D0)(740)),ia=R().div.withConfig({displayName:"NewsAssistantFinancialCardstyles__CardContainer",componentId:"sc-1mvifl1-1"})(["border-radius:8px;padding:16px;display:flex;flex-direction:column;gap:16px;background-color:var(--color-white-100);box-shadow:0 1px 7px rgb(0 0 0 / 5%),0 0 16px rgb(0 0 0 / 5%);"]),la=R().div.withConfig({displayName:"NewsAssistantFinancialCardstyles__CompanyInfo",componentId:"sc-1mvifl1-2"})(["display:flex;flex-direction:column;gap:4px;"]),ca=R().span.withConfig({displayName:"NewsAssistantFinancialCardstyles__CompanyNameTicker",componentId:"sc-1mvifl1-3"})(["color:var(--color-grey-600);"]),da=R().div.withConfig({displayName:"NewsAssistantFinancialCardstyles__Row",componentId:"sc-1mvifl1-4"})(["display:flex;align-items:flex-start;justify-content:space-between;gap:4px;"]),ua=R().span.withConfig({displayName:"NewsAssistantFinancialCardstyles__StockPrice",componentId:"sc-1mvifl1-5"})(["color:var(--color-grey-800);"]),ma=R().span.withConfig({displayName:"NewsAssistantFinancialCardstyles__InfoText",componentId:"sc-1mvifl1-6"})(["color:var(--color-grey-700);"]),ha=R().span.withConfig({displayName:"NewsAssistantFinancialCardstyles__PriceChange",componentId:"sc-1mvifl1-7"})(["color:",";"],({$positive:e})=>e?"var(--color-green-200)":"var(--color-red-500)"),pa=R().div.withConfig({displayName:"NewsAssistantFinancialCardstyles__ChartContainer",componentId:"sc-1mvifl1-8"})(["width:100%;height:auto;border-bottom:1px solid var(--color-grey-200);overflow:hidden;padding-bottom:16px;img{width:100%;height:100%;object-fit:contain;}"]),fa=R().div.withConfig({displayName:"NewsAssistantFinancialCardstyles__FinancialInfoGrid",componentId:"sc-1mvifl1-9"})(["display:grid;grid-template-columns:repeat(3,1fr);gap:40px;"]),ga=R().div.withConfig({displayName:"NewsAssistantFinancialCardstyles__InfoColumn",componentId:"sc-1mvifl1-10"})(["display:flex;flex-direction:column;gap:4px;"]),ya=R().div.withConfig({displayName:"NewsAssistantFinancialCardstyles__InfoRow",componentId:"sc-1mvifl1-11"})(["display:flex;justify-content:space-between;align-items:baseline;flex-direction:column;","{gap:4px;flex-direction:row;}","{flex-direction:row;}"],T.C9.md,T.C9.lg),ba=R().span.withConfig({displayName:"NewsAssistantFinancialCardstyles__InfoLabel",componentId:"sc-1mvifl1-12"})(["color:var(--color-grey-500);"]),xa=R().span.withConfig({displayName:"NewsAssistantFinancialCardstyles__InfoValue",componentId:"sc-1mvifl1-13"})(["color:var(--color-grey-800);","{text-align:right;}"],T.C9.lg),wa=R().div.withConfig({displayName:"NewsAssistantFinancialCardstyles__ButtonRow",componentId:"sc-1mvifl1-14"})(["display:grid;gap:8px;grid-template-columns:1fr 1fr;"]),va=(0,cs.A)("[NewsAssistantFinancialCard]"),Ca="tgam-card-news-assistant-financial";function Na(e,t){return Array.isArray(e)?e[0]??t:e}function Aa(e,t=2){return Na(e,0).toFixed(t)}function ka(e){const t=Na(e,0);return t>=1e9?`${(t/1e9)?.toFixed(2)}B`:t>=1e6?`${(t/1e6)?.toFixed(2)}M`:t?.toLocaleString("en-US")}function _a({className:e,financialData:t}){const s=t?.ticker?.symbol??"",n=t?.ticker?.exchange??"",o=t?.ticker?.name??"",i=ra({symbol
1:s,width:700}),l=Na(t?.netChange,0)>0,c=l?"+":"",d=Na(t?.globe_page,"")||"",u=d?d.replace(/\/([^/]+)\/?$/,"/full-chart/$1/"):"",m=(0,a.useMemo)(()=>{const e=[{label:"Open",value:Aa(t?.open)},{label:"High",value:Aa(t?.high)},{label:"Low",value:Aa(t?.low)},{label:"Mkt Cap",value:ka(t?.marketCapitalization)},{label:"P/E Ratio",value:Aa(t?.peRatio)},{label:"52W Range",value:(0,A.jsxs)(A.Fragment,{children:[Aa(t?.fiftyTwoWkLow)," -"," ",Aa(t?.fiftyTwoWkHigh)]})}],s=Math.ceil(e.length/3);return[e.slice(0,s),e.slice(s,2*s),e.slice(2*s)]},[t]);(0,a.useEffect)(()=>{va.info(`Rendering financial card for ${s}`)},[s]);const h=t?.lastPrice?Aa(t.lastPrice||0):null;return(0,A.jsx)(oa,{className:e,children:(0,A.jsxs)(ia,{className:`${Ca}--container`,children:[(0,A.jsxs)(la,{children:[(0,A.jsxs)(da,{children:[(0,A.jsxs)(ca,{className:"text-gmr-4",children:[o," ",s&&`(${s})`]}),n&&(0,A.jsx)(ma,{className:"text-gmr-5",children:n})]}),(0,A.jsx)(da,{children:(0,A.jsx)(ua,{className:"text-gmb-3",children:h?`$${h}`:"Price unavailable"})}),(0,A.jsxs)(ha,{$positive:l,className:"text-gmr-4",children:[l?"+":"-","$",Aa(Math.abs(Na(t?.netChange,0)))," (",c,Aa(t?.percentChange),"%)"]})]}),(0,A.jsx)(pa,{children:i?(0,A.jsx)("img",{src:i,alt:`5-day price chart for ${o} (${s})`,loading:"lazy"}):(0,A.jsx)(ta.RN,{style:{width:"100%",height:"285px"}})}),(0,A.jsx)(fa,{children:m.map((e,t)=>(0,A.jsx)(ga,{children:e.map(e=>(0,A.jsxs)(ya,{children:[(0,A.jsx)(ba,{className:"text-gmr-4",children:e.label}),(0,A.jsx)(xa,{className:"text-gmb-6",children:e.value})]},e.label))},t))}),(u||d)&&(0,A.jsxs)(wa,{className:`${Ca}--button-row`,children:[(0,A.jsx)(r.Ay,{analytics:{fid:`Stock Quote: ${s} (${o})`},href:u,rel:"noopener noreferrer",target:"_blank",theme:r.ox.TEAL,variant:r.Ck.OUTLINE,children:"Full chart"}),(0,A.jsx)(r.Ay,{analytics:{fid:`Stock Quote: ${s} (${o})`},href:d,rel:"noopener noreferrer",target:"_blank",theme:r.ox.TEAL,variant:r.Ck.OUTLINE,children:"Stock page"})]})]})})}_a.displayName="NewsAssistantFinancialCard";const ja=R().div.withConfig({displayName:"NewsAssistantPanelBestMatchesstyles__FeedbackCta",componentId:"sc-8bxxqh-0"})(["display:flex;justify-content:flex-end;"]),Sa=R().span.withConfig({displayName:"NewsAssistantPanelBestMatchesstyles__HelpUsImprove",componentId:"sc-8bxxqh-1"})(["text-transform:none;"]),Oa=R().section.withConfig({displayName:"NewsAssistantPanelBestMatchesstyles__Panel",componentId:"sc-8bxxqh-2"})(["display:grid;padding:0;margin:0;grid-template-columns:minmax(0,1fr);gap:24px;scroll-margin-top:","px;position:relative;&:focus-visible{outline:none;.news-assistant-query-pill{outline:2px solid var(--color-alias-focus-ring-default);}}"],he),Ia=R()(r.Ay).withConfig({displayName:"NewsAssistantPanelBestMatchesstyles__ShareYourFeedback",componentId:"sc-8bxxqh-3"})(["text-transform:none;text-decoration:underline;font-size:",";line-height:",";.tgam-button__content{order:1;}.tgam-button__icon{order:2;}"],(0,C.D0)(14),(0,C.D0)(20)),Pa=R().hr.withConfig({displayName:"NewsAssistantPanelBestMatchesstyles__ResultSplit",componentId:"sc-8bxxqh-4"})(["width:100%;height:0;margin:0;border:0;border-top:1px solid var(--color-grey-500);"]),Da=R().p.withConfig({displayName:"NewsAssistantPanelBestMatchesstyles__Text",componentId:"sc-8bxxqh-5"})(["margin:0;padding:0;white-space:pre-wrap;a{color:var(--color-grey-700);}a:visited{color:var(--color-grey-500);}a:hover,a:focus,a:active{color:var(--color-red-500);}"]),Ea=R().p.withConfig({displayName:"NewsAssistantPanelBestMatchesstyles__QueryPill",componentId:"sc-8bxxqh-6"})(["display:grid;justify-self:end;background-color:var(--color-grey-100);padding:8px 16px;margin:0;border-radius:16px;color:var(--color-grey-800);width:auto;"]),Ra=R()(Zs.A).withConfig({displayName:"NewsAssistantPanelBestMatchesstyles__FinancialCardsCarousel",componentId:"sc-8bxxqh-7"})([".tgam-carousel__slides{margin-inline:-6px;padding:6px;align-items:stretch;border-top:none;display:flex;flex-direction:row;flex-wrap:nowrap;gap:16px;overflow-x:auto;overflow-y:hidden;}"," ","{","}"],(0,ea.M6)(1,48),T.C9.sm,(0,ea.M6)(1,64)),Ta=R()(_a).withConfig({displayName:"NewsAssistantPanelBestMatchesstyles__FinancialCard",componentId:"sc-8bxxqh-8"})(["",""],({$standalone:e})=>!e&&"\n height: 100%;\n flex-shrink: 0;\n\n .tgam-card-news-assistant-financial--container {\n height: 100%;\n }\n .tgam-card-news-assistant-financial--button-row {\n margin-top: auto;\n }\n "),Fa=R().p.withConfig({displayName:"NewsAssistantPanelBestMatchesstyles__Disclaimer",componentId:"sc-8bxxqh-9"})(["margin-top:8px;color:var(--color-grey-500);font-style:italic;white-space:pre-line;a{color:var(--color-grey-500);text-decoration:underline;&:hover{color:var(--color-grey-700);}}"]),$a=(0,cs.A)("[NewsAssistantPanelBestMatches]");
1function Ma({isActivePanel:e,onChatChunksCleared:t,searchCanceled:s,searchError:n,searchPending:r,searchQueryPending:o,searchQueryResolved:i,searchResults:l,setResultsSkipLinkTargetId:c,setStatusMessage:d,shouldClearChatChunks:u}){const{newsAssistantFinancialDisclaimer:m}=(0,W.V)(),[h,p]=(0,a.useState)(!1);(0,a.useEffect)(()=>p(e),[e]);const f=function({isActivePanel:e,onChatChunksCleared:t=Js.lQ,onScrolledToCurrentChunk:s=Js.lQ,searchCanceled:n,searchError:r,searchPending:o,searchQueryPending:i,searchQueryResolved:l,searchResults:c,setResultsSkipLinkTargetId:d,shouldClearChatChunks:u,shouldScrollToCurrentChunk:m=!1}){const[h,p]=(0,a.useReducer)(Xs,[]),f=(0,a.useRef)(i);f.current=i;const g=(0,a.useRef)(l);g.current=l,(0,a.useEffect)(()=>{u&&(p({type:"CLEAR"}),t())},[t,u]);const[y,b]=(0,a.useState)(""),x=(0,a.useCallback)((t,s=!1)=>{if(!t)return void Ks.warn("Chunk not found:",t);if(d(t?.id||""),!e)return;const a=t.getBoundingClientRect();if(he+a.height>window.innerHeight)Ks.info("Scrolling chunk into view:",t),t.scrollIntoView({behavior:ce.tT||s?"instant":"smooth",block:"start"});else{const e=document.querySelector(".tgam-layout__body");if(!e)return;Ks.info("Scrolling content to bottom:",e),e?.scrollIntoView({behavior:ce.tT||s?"instant":"smooth",block:"end"})}},[e,d]);return(0,a.useEffect)(()=>{if(m){const e=document.querySelectorAll("[data-chat-chunk]"),t=e.length?e[e.length-1]:null;x(t,!0),s()}},[s,x,m]),(0,a.useEffect)(()=>{if(!y)return;const t=setTimeout(()=>{const t=`[data-chat-chunk="${CSS.escape((0,pt.Yv)(y))}"]`,s=document.querySelectorAll(t),a=s.length?s[s.length-1]:null;e?x(a):b(""),b("")},100);return()=>{void 0!==t&&clearTimeout(t)}},[y,e,x]),(0,a.useEffect)(()=>{if(o){const e={query:f.current,content:[],isLoadingPlaceholder:!0};Ks.info("Adding placeholder chunk",e),p({type:"APPEND",chunk:e}),b(e.query)}},[o]),(0,a.useEffect)(()=>{if(n){const e={query:f.current,content:"Stopped generating response.",isLoadingPlaceholder:!1};Ks.info("Adding canceled chunk",e),p({type:"APPEND",chunk:e}),b(e.query)}},[n]),(0,a.useEffect)(()=>{if(r){const e={query:g.current,content:"An error occurred. Please try again.",isLoadingPlaceholder:!1};Ks.info("Adding API error chunk",e),p({type:"APPEND",chunk:e}),b(e.query)}},[r]),(0,a.useEffect)(()=>{const e=c?.chatResponse,t=c?.response;if(!e&&!t)return;const s=g.current;if(t){const e={query:s,content:be(t),isLoadingPlaceholder:!1};return Ks.info("Adding response error chunk",e),p({type:"APPEND",chunk:e}),void b(e.query)}if(Ks.info("Received new search results chat response",{searchResults:c,errorResponse:t,chatResponse:e}),at(c)){const e=c?.chatResponse,{best_matches:t=[],intro:a="",outro:n=""}=e||{},r={query:s,content:t?.length?t:[],intro:a??"",outro:n??"",authors:e?[e]:void 0,isLoadingPlaceholder:!1};return Ks.info("Adding author chunk",r),p({type:"APPEND",chunk:r}),void b(r.query)}if(rt(c)){const e=c?.chatResponse,{body:t="",intro:a="",outro:n=""}=e||{},r={query:s,content:be(t),intro:a??"",outro:n??"",isLoadingPlaceholder:!1};return Ks.info("Adding commodity chunk",r),p({type:"APPEND",chunk:r}),void b(r.query)}if(ot(c)){const e=c?.chatResponse,{best_matches:t=[],ticker:a=[],intro:n="",outro:r=""}=e||{},o=t?.length?t:[],i=[],l=(Array.isArray(a)?a:[]).map(e=>e?.symbol);l.forEach((t,s)=>{if(1===l.length&&t&&""!==t&&ge(t))return;const a=ve({resultData:e,index:s});i.push(a)});const d={query:s,content:o,intro:n??"",outro:r??"",financialData:i.length?i:void 0,isLoadingPlaceholder:!1};return Ks.info("Adding company chunk",d),p({type:"APPEND",chunk:d}),void b(d.query)}if(it(c)){const e=c?.chatResponse,{body:t=[],intro:a="",outro:n=""}=e||{},r={query:s,content:t?.length?t:[],intro:a??"",outro:n??"",isLoadingPlaceholder:!1};return Ks.info("Adding direct link chunk",r),p({type:"APPEND",chunk:r}),void b(r.query)}if(lt(c)){const e=c?.chatResponse,{body:t,intro:a="",outro:n=""}=e||{},r="string"==typeof t,o=(0,v.Gv)(t)&&!Array.isArray(t)&&!r,i=Array.isArray(t)&&t.length>0&&t.every(ht);let l="";if(r)l=be(t);else if(i)l=t;else if(o){const{generated_response:e=""}=t||{};l=(e?be(e):null)||""}const d=[];if(o){const e=Array.isArray(t?.ticker)?t.ticker:[];e.forEach((s,a)=>
1{if(1===e.length){const{symbol:e=""}=s;if(e&&""!==e&&ge(e))return}const n=ve({resultData:t,index:a});d.push(n)})}const u={query:s,content:l,intro:a??"",outro:n??"",financialData:d.length?d:void 0,isLoadingPlaceholder:!1};return Ks.info("Adding financial chunk",u),p({type:"APPEND",chunk:u}),void b(u.query)}if(st(c)){const e=c?.chatResponse,{best_matches:t=[],intro:a="",outro:n=""}=e||{},r=t??[],o={query:s,content:r,intro:a??"",outro:n??"",clarificationPrompt:c?.result?.clarification_prompt??"",isLoadingPlaceholder:!1};return Ks.info({queryResolved:s,content:r,archiveChunk:o}),Ks.info("Adding archive chunk",o),p({type:"APPEND",chunk:o}),void b(o.query)}if(nt(c)){const e=c?.chatResponse,{body:t="",intro:a="",outro:n=""}=e||{},r=be(t),o={query:s,content:r,intro:a??"",outro:n??"",isLoadingPlaceholder:!1};return Ks.info({queryResolved:s,content:r,cannotChunk:o}),Ks.info("Adding cannot chunk",o),p({type:"APPEND",chunk:o}),void b(o.query)}if(ct(c)){const e=c?.chatResponse,{body:t="",intro:a="",outro:n=""}=e||{},r=be(t),o={query:s,content:r,intro:a??"",outro:n??"",isLoadingPlaceholder:!1};return Ks.info({queryResolved:s,content:r,forexChunk:o}),Ks.info("Adding forex chunk",o),p({type:"APPEND",chunk:o}),void b(o.query)}if(dt(c)){const e=c?.chatResponse,{body:t="",intro:a="",outro:n=""}=e||{},r="string"==typeof t?be(t):t,o={query:s,content:r,intro:a??"",outro:n??"",isLoadingPlaceholder:!1};return Ks.info({queryResolved:s,content:r,personalizedChunk:o}),Ks.info("Adding personalized chunk",o),p({type:"APPEND",chunk:o}),void b(o.query)}},[c]),h}({isActivePanel:e,onChatChunksCleared:t,onScrolledToCurrentChunk:()=>p(!1),searchCanceled:s,searchError:n,searchPending:r,searchQueryPending:o,searchQueryResolved:i,searchResults:l,setResultsSkipLinkTargetId:c,shouldClearChatChunks:u,shouldScrollToCurrentChunk:h}),g=(0,a.useMemo)(()=>{const e=`"${o}"`,t=`"${i}"`,a=l?.chatResponse,c=l?.response;return r?`Searching for ${e}`:s?`Search for ${e} was canceled`:n||!r&&c?`Error occurred while searching for ${t}`:!r&&a?`Showing results for ${t}`:($a.warn("No status message"),"")},[o,i,l?.chatResponse,l?.response,r,s,n]);return(0,a.useEffect)(()=>{e&&g&&d(g)},[g,d,e]),(0,A.jsxs)(ys,{children:[f.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Ds,{linkText:"Skip to search form",targetId:"tgam-news-assistant-search-field"}),f.map(({intro:e,outro:t,clarificationPrompt:s,content:a,query:n,authors:r,financialData:o,isLoadingPlaceholder:i},l)=>{const c=Array.isArray(a),d="string"==typeof a,u=(0,pt.Yv)(n),h=r?r.filter(e=>!!e?.Byline?.trim()):null,p=e?.trim()||"",f=t?.trim()||"",g=s?.trim()||"",y=m&&(0,A.jsx)(Fa,{className:"text-gmr-6",dangerouslySetInnerHTML:{__html:Ce(m)}}),b=o?.length&&o.length>1?(0,A.jsxs)("div",{children:[(0,A.jsx)(Ra,{itemsData:o,children:({itemData:e,index:t})=>(0,A.jsx)(Ta,{$standalone:!1,financialData:e},e?.ticker?.symbol||e?.ticker?.name||t)}),y]}):o?.length?(0,A.jsxs)("div",{children:[(0,A.jsx)(Ta,{$standalone:!0,financialData:o[0]}),y]}):null,x=(0,A.jsxs)(A.Fragment,{children:[i&&(0,A.jsx)(Gs,{}),b,h&&(0,A.jsx)(Ys,{authors:h}),!!p&&(0,A.jsx)(Da,{className:"text-gmr-3",dangerouslySetInnerHTML:{__html:Ce(p)}}),!!g&&(0,A.jsx)(Da,{className:"text-gmr-3",dangerouslySetInnerHTML:{__html:Ce(g)}}),c&&(0,A.jsx)(bs,{children:a.map((e,t)=>(0,A.jsx)(us,{cardType:"standard",contentId:e.content_id,tabName:"best-matches"},e.content_id??e.url??`result-card-${t}`))}),d&&(0,A.jsx)(Da,{className:"text-gmr-3",dangerouslySetInnerHTML:{__html:Ce(a)}}),!!f&&(0,A.jsx)(Da,{className:"text-gmr-3",dangerouslySetInnerHTML:{__html:Ce(f)}}),(0,A.jsx)(Pa,{"aria-hidden":"true"})]}),w=!!o||!!r||c&&a.length>0;return(0,A.jsxs)(Oa,{id:`chat-chunk-${u}-${l}`,tabIndex:0,"aria-label":n?`Showing results for "${n}"`:"No results","data-chat-chunk":u,children:[(0,A.jsx)(Ea,{className:"news-assistant-query-pill text-gmr-3",children:n||"No results"}),w?(0,A.jsx)(Ae.Q,{id:`news-assistant-chat-chunk-${u}-${l}-skip-link`,startText:`Skip "${n}" results`,endText:`Jump to "${n}" results`,children:x}):x]},`chat-chunk-${u}-${l}`)})]}),(0,A.jsxs)(ja,{children:[(0,A.jsx)("p",{className:"text-gmr-6",children:(0,A.jsx)(Sa,{children:"Help us improve - "})}),(0,A.jsx)(Ia,{analytics:{fid:"share-your-feedback"},href:"https://docs.google.com/forms/d/e/1FAIpQLSdd3WK8YuQwpqSJLWJNnIjSYs4kZrgcUnFuFDaBUsG36PxJkw/viewform",icon:"external-link",rel:"noopener noreferrer",target:"_blank",children:"Share your feedback"})]})]})}Ma.displayName="NewsAssistantPanelBestMatches";
1var La=s(81199),qa=s(29167);const Ua="news-assistant-panel-all-articles";R().p.withConfig({displayName:"NewsAssistantSearchstyles__ErrorMessage",componentId:"sc-cfpxsl-0"})(["margin-block:0 8px;color:var(--color-red-500);"]),R().p.withConfig({displayName:"NewsAssistantSearchstyles__SearchingMessage",componentId:"sc-cfpxsl-1"})(["margin-block:0 8px;"]);const Ba=R().div.withConfig({displayName:"NewsAssistantSearchstyles__SearchBar",componentId:"sc-cfpxsl-2"})(["padding-block:16px;height:var(--search-bar-height);position:relative;",";"],e=>e.$isSticky&&"\n width: 100vw;\n padding-inline: var(--tgam-page-margin, 0);\n background-color: var(--color-white-100);\n position: fixed;\n bottom: 0; /* Fallback value */\n bottom: env(safe-area-inset-bottom, 0);\n left: 0;\n z-index: 2;\n\n .tgam-news-assistant-search-inner {\n max-width: var(--tgam-news-assistant-max-inner-width, unset);\n margin-inline: auto;\n }\n "),Wa=R().div.withConfig({displayName:"NewsAssistantSearchstyles__SearchFields",componentId:"sc-cfpxsl-3"})(["width:100%;position:relative;"]),za=R().input.withConfig({displayName:"NewsAssistantSearchstyles__SearchField",componentId:"sc-cfpxsl-4"})(["height:64px;padding:12px 66px 12px 11px;border:1px solid var(--color-grey-400);border-radius:8px;color:",";caret-color:var(--color-grey-800);font-size:1.125rem;&::placeholder{color:var(--color-grey-400);}&::-webkit-search-decoration,&::-webkit-search-cancel-button,&::-webkit-search-results-button,&::-webkit-search-results-decoration{display:none;}"],e=>e.$hasOverlay?"transparent":"var(--color-grey-800)"),Ha=R().div.withConfig({displayName:"NewsAssistantSearchstyles__SearchFieldOverlay",componentId:"sc-cfpxsl-5"})(["position:absolute;top:0;left:0;right:66px;height:64px;padding:12px 0 12px 12px;font-size:1.125rem;letter-spacing:0.01875rem;line-height:normal;display:flex;align-items:center;pointer-events:none;overflow:hidden;white-space:nowrap;"]),Qa=R().span.withConfig({displayName:"NewsAssistantSearchstyles__OverlayPlaceholder",componentId:"sc-cfpxsl-6"})(["color:var(--color-grey-400);padding:0 4px;"]),Ya=(0,E.keyframes)(["to{transform:rotate(360deg);}"]),Va=R()(r.Ay).withConfig({displayName:"NewsAssistantSearchstyles__SubmitButton",componentId:"sc-cfpxsl-7"})(["&&{width:40px;height:40px;position:absolute;top:12px;right:12px;transition:none;.tgam-button__icon{transition:none;fill:var(--color-grey-500);}}&,&:hover,&:focus{background-color:var(--color-grey-300);}&:not(:disabled){background-color:var(--color-grey-800);.tgam-button__icon{fill:var(--color-grey-100);}}",""],e=>e.$isPending&&(0,E.css)(['&:not(:disabled){background:transparent;border:none;border-radius:8px;overflow:hidden;&::before{content:"";position:absolute;inset:-50%;background:conic-gradient( from 0deg,transparent 60%,var(--color-grey-800) 80%,transparent 100% );animation:',' 1.5s linear infinite;}&::after{content:"";position:absolute;inset:2px;border-radius:6px;background:var(--color-white-100);}.tgam-button__icon{position:relative;z-index:1;width:14px;height:14px;border-radius:2px;fill:var(--color-grey-800);}}'],Ya)),Ga=R().div.withConfig({displayName:"NewsAssistantSearchstyles__LegalDisclaimer",componentId:"sc-cfpxsl-8"})(["margin-top:8px;text-align:center;text-wrap:balance;color:var(--color-grey-500);"]),Ja=R()(Ds).withConfig({displayName:"NewsAssistantSearchstyles__SkipLinkStandaloneResults",componentId:"sc-cfpxsl-9"})(["margin:0 auto;top:unset;left:0;right:0;bottom:16px;&,&:focus-visible,&:active{width:fit-content;}"]);function Ka({disclaimer:e,hasPromptPlaceholder:t,inputRef:s,inputValue:a,isSticky:n,isSubmitDisabled:o,onChange:i,onSubmit:l,pending:c,placeholder:d,skipLinkTargetId:u}){const m=t&&a.search(q)>=0,h=c?{fid:"search-cancel",action:"search cancel"}:{fid:"search-submit",action:"search submit"};return(0,A.jsx)(Ba,{className:"tgam-news-assistant-search-bar",$isSticky:n,children:(0,A.jsxs)("div",{className:"tgam-news-assistant-search-inner",children:[(0,A.jsx)("form",{role:"search",onSubmit:l,children:(0,A.jsxs)(Wa,{children:[(0,A.jsx)("label",{htmlFor:"tgam-news-assistant-search-field",className:"u-visually-hidden",children:d}),(0,A.jsx)(za,{autoComplete:"off",ref:s,className:"c-form__control--text",id:"tgam-news-assistant-search-field",name:"q",type:"search",value:a,onChange:i,placeholder:d,$hasOverlay:m}),m&&(0,A.jsx)(Ha,{"aria-hidden":"true",className:"text-gmr-4",children:a.split(/(\[[^\]]+\])/).map((e,t)=>/^\[/.test(e)?(0,A.jsx)(Qa,{children:e},t):(0,A.jsx)("span",{children:e},t))}),(0,A.jsx)(Va,{$isPending:c,analytics:h,type:"submit",theme:r.ox.LIGHT,icon:c?"stop":"arrow-right","aria-label":c?"Abort search":"Submit search",disabled:o})]})}),!!u&&(0,A.jsx)(Ja,{linkText:"Skip to latest search results",targetId:u}),e&&(0,A.jsx)(Ga,{className:"text-gmr-4",children:e})]})})}Ka.displayName="NewsAssistantSearch";var Xa=s(11);const Za=(0,cs.A)("[NewsAssistant]");function en(e){const{query:t,signal:s}=e;return Za.info("onSubmitQuery - query:",t),!t||s?.aborted?(Za.info("onSubmitQuery - query is empty or signal is aborted"),Promise.resolve({query:t,results:null,error:!1})):(Za.info("onSubmitQuery - payload:",e),async function({query:e,userId:t,barchartToken:s,threadId:a="1",signal:n}){const r={query:e,userId:t||"default",threadId:a};return fetch(sa.Hi,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json","x-barchart-token":s||""},body:JSON.stringify(r),signal:n}).then(is.xJ).then(is.bt).then(e=>{try{return JSON.parse(e?.response??"{}")}catch(t){return e}}).catch(e=>{throw console.error(e),e})}(e).then(e=>(Za.info("onSubmitQuery - response:",e,typeof e),tt(e)?{query:t,results:e,error:!1}:(Za.error("onSubmitQuery - invalid response shape:",e),{query:t,results:null,error:!0}))).catch(e=>e instanceof Error&&"AbortError"===e.name?(Za.debug("onSubmitQuery - abort error"),{query:t,results:null,error:!1}):(Za.error("Query failed:",e),{query:t,results:null,error:!0})))}const tn=(0,cs.A)("[NewsAssistant]");function sn(){const{emitter:e}=(0,l.nm)(),{user:t}=(0,p.J)(),{hash:s}=(0,c.F)(),{isAppview:g}=(0,m.f)(),{vendor:y}=(0,f.U)(),b=y?.watchlist?.jwt,{sendAmplitudeEvent:x}=(0,i.l)(),[w,v]=(0,a.useState)(""),[C,N]=(0,a.useState)(!1),k=(0,a.useCallback)(e=>{N(!!C),v(C?`${e} `:e)},[C]),[_,j]=(0,a.useState)(""),[S,O]=(0,a.useState)(""),[I,P]=(0,a.useState)(!1),[E,R]=(0,a.useState)(!1),[T,q]=(0,a.useState)(!1),[B,W]=(0,a.useState)(null),[H,Q]=(0,a.useState)(""),Y=(0,a.useRef)(null),V=(0,a.useRef)(null),G=(0,a.useRef)(""),{handleInputChange:J,handlePromptClick:K,hasPromptPlaceholder:X,stripPlaceholders:Z}=U({inputRef:V,inputValue:H,setInputValue:Q});(0,a.useEffect)(()=>{G.current||(G.current=crypto.randomUUID())},[]);const[ee,te]=(0,a.useState)(He.WELCOME),se=(0,a.useRef)(!0);(0,a.useEffect)(()=>{let e;return se.current?se.current=!1:(T||ee===He.WELCOME)&&(e=setTimeout(()=>{tn.debug("Focusing search input"),V?.current?.focus()},100)),()=>{void 0!==e&&clearTimeout(e)}},[ee,T]);const[ae,ne]=(0,a.useState)(""),re=(0,a.useCallback)(e=>{ce.Sw&&e?ne(e):ne("")},[]);(0,a.useEffect)(()=>{ee===He.WELCOME&&ne("")},[ee]);const oe=(0,a.useCallback)((e=!0)=>{Y.current&&(Y.current.abort(),Y.current=null,e&&(tn.info("Request cancelled"),q(!1),P(!0)))},[]);(0,a.useEffect)(()=>()=>{oe(!1)},[oe]);const ie=(0,a.useCallback)(()=>oe(),[oe]);(0,d.i)(ie);const le=(0,a.useCallback)(async e=>{e.preventDefault(),Y.current&&(tn.info("onSubmit - cancel"),(0,n.flushSync)(()=>{oe()}));const a=Z(H).trim();if(tn.info("onSubmit - query:",a),!a)return;const r=new AbortController;Y.current=r,Q(""),te(He.RESULTS),q(!0),j(a),P(!1),R(!1),W(null);try{const{query:e,results:n,error:o}=await en({query:a,userId:g?s||"":t.id?.hash||"",barchartToken:b,threadId:G.current,signal:r.signal});Y.current===r&&!r.signal.aborted&&(O(a),n?(W(n),x({event:Xa.zc.siteSearch,data:{"page name":"Search: News Assistant","site search terms":[e],"site search results":ut(n)&&"len_results"in n.result?n.result?.len_results??0:0}})):o&&R(!0))}catch(e){Y.current===r&&(O(a),R(!0))}finally{Y.current===r&&(Y.current=null,q(!1))}},[oe,s,H,g,x,Z,t.id?.hash,b]),de=H.trim(),ue=!T&&!!!de?.length,[me,he]=(0,a.useState)(ee!==He.WELCOME);(0,a.useEffect)(()=>{he(ee!==He.WELCOME)},[ee]);const pe=(0,a.useCallback)(()=>{he(!1)},[]),ge=(0,a.useCallback)(()=>{ee!==He.WELCOME&&he(!0)},[ee]);(0,a.useEffect)(()=>(e.on("footer:visible",pe),e.on("footer:hidden",ge),()=>{e.off("footer:visible",pe),e.off("footer:hidden",ge)}),[e,ge,pe]);const ye=(0,a.useMemo)(()=>(0,A.jsx)(Ka,{disclaimer:ee===He.WELCOME?"Do not enter any personal information into this chat.":"Search results are AI curated and may not work as expected.",hasPromptPlaceholder:X,inputRef:V,inputValue:H,isSticky:me,isSubmitDisabled:ue,onChange:J,onSubmit:le,pending:T,placeholder:ee===He.WELCOME?"Ask anything here":"Ask a follow-up",skipLinkTargetId:ae}),[ee,J,X,H,ue,le,ae,T,me]),be=(0,a.useMemo)(()=>(0,A.jsx)(Ne,{onPromptClick:K,children:ye}),[K,ye]),[xe,we]=(0,a.useState)(!1),ve=(0,a.useCallback)(()=>{we(!1)},[]),{resultsNav:Ce,resultsScreen:Ae}=function({onChatChunksCleared:e,searchCanceled:t,searchError:s,searchForm:n,searchPending:r,searchQueryPending:o,searchQueryResolved:i,searchResults:l,setResultsSkipLinkTargetId:c,setStatusMessage:d,shouldClearChatChunks:u}){const m=(0,a.useRef)(null),{appliedFilters:h,availableAuthors:p,availableSections:f,applyFilters:g,closeFilterModal:y,customDateError:b,draftFilters:x,filteredArticles:w,hasActiveFilters:v,isFilterModalOpen:C,openFilterModal:N,removeAppliedFilter:k,resetFilters:_,setDraftAuthor:j,setDraftCustomDateFrom:S,setDraftCustomDateTo:O,setDraftDateRange:I,setDraftSection:P}=vt({searchResults:l}),D=(0,a.useCallback)(()=>{m.current?.focus()},[]),[E,R]=(0,a.useState)("");(0,a.useEffect)(()=>{u&&R("")},[u]);const T=(0,a.useMemo)(()=>[{id:"best-matches",label:"Best matches",content:a=>(0,A.jsx)(Ma,{isActivePanel:a,onChatChunksCleared:e,searchCanceled:t,searchError:s,searchPending:r,searchQueryPending:o,searchQueryResolved:i,searchResults:l,setResultsSkipLinkTargetId:R,setStatusMessage:d,shouldClearChatChunks:u})},{id:"all-articles",label:"All articles",content:e=>(0,A.jsx)(Ps,{appliedFilters:h,filterButtonRef:m,hasActiveFilters:v,isActivePanel:e,onOpenFilterModal:N,onRemoveFilter:k,resultsSkipLinkPrimaryTargetId:Ua,searchCanceled:t,searchError:s,searchPending:r,searchQueryPending:o,searchQueryResolved:i,setStatusMessage:d,storyData:w})}],[h,w,v,e,N,k,t,s,r,o,i,l,d,u]),F=(0,a.useMemo)(()=>T.map(({id:e,label:t})=>({id:e,label:t})),[T]),$=(0,a.useCallback)((e,t)=>T?.[e]?.content(t),[T]),{activeIndex:M,classNames:L,tabList:q,tabPanels:U}=(0,qa.P)({animated:!1,equalHeights:!1,id:"tgam-news-assistant-menu-tabs",onTabChange:()=>ce.Sw&&window.scrollTo(0,0),renderTabPanelItem:$,scrollable:!1,stretched:!1,tabListItems:F,theme:La.z.SIMPLE});return(0,a.useEffect)(()=>{const e=0===M?E:1===M?Ua:"";ce.Sw&&e&&document.getElementById(e)?c(e):c("")},[M,E,c]),{resultsNav:(0,A.jsx)(z.R,{children:(0,A.jsx)("div",{className:L,children:q})}),resultsScreen:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("div",{className:L,children:U}),n,(0,A.jsx)(Ze,{availableAuthors:p,availableSections:f,customDateError:b,draftFilters:x,isOpen:C,onApply:g,onAfterClose:D,onClose:y,onReset:_,onSetCustomDateFrom:S,onSetCustomDateTo:O,onSetDateRange:I,onToggleAuthor:j,onToggleSection:P})]})}}
1({onChatChunksCleared:ve,searchCanceled:I,searchError:E,searchForm:ye,searchPending:T,searchQueryPending:_,searchQueryResolved:S,searchResults:B,setResultsSkipLinkTargetId:re,setStatusMessage:k,shouldClearChatChunks:xe}),ke=(0,a.useMemo)(()=>({[He.WELCOME]:be,[He.RESULTS]:Ae}),[be,Ae]),_e=ce.Sw?document.getElementById(o.NEWS_ASSISTANT_PORTAL_ID):null,je=(0,A.jsxs)(L,{$stickySearch:me,children:[(0,A.jsx)("div",{role:"status","aria-atomic":"true","aria-live":"polite",className:"u-visually-hidden",children:w}),ke[ee]??be]}),Se=_e?(0,n.createPortal)(je,_e):null,Oe=(0,u.U)(u.is.mobileWideUp)||!1,[Ie,Pe]=(0,h.rX)("tgam.newsAssistantOnboardingModalDismissed",!1),[De,Ee]=(0,a.useState)(!1),[Re,Te]=(0,a.useState)(!1);(0,a.useEffect)(()=>{Ie||(Ee(!0),Te(!0))},[Ie]);const Fe=(0,a.useCallback)(()=>{Ee(!1),Pe(!0)},[Pe]),$e=(0,a.useCallback)(()=>{Te(!1)},[]),Me=(0,a.useCallback)(()=>{oe(),fe.clear(),G.current=crypto.randomUUID(),te(He.WELCOME),we(!0),Q(""),P(!1),R(!1),q(!1),O(""),j(""),W(null)},[oe]),Le=(0,A.jsx)(r.Ay,{"aria-label":Oe?void 0:"New chat",analytics:{fid:"new-chat",action:"new chat"},icon:"new-chat",onClick:Me,theme:r.ox.GREY,variant:r.Ck.ICON,children:Oe?"New chat":void 0}),qe=(0,A.jsx)(r.Ay,{icon:"help",theme:r.ox.GREY,variant:r.Ck.ICON,onClick:()=>{Ee(!0),Te(!1)},children:"Start Tutorial"});return(0,A.jsx)(F,{children:(0,A.jsx)($,{children:(0,A.jsxs)(M,{children:[ee===He.WELCOME?qe:(0,A.jsxs)(A.Fragment,{children:[Ce,Le]}),Se,(0,A.jsx)(D,{isOpen:De,onAfterClose:$e,onRequestClose:Fe,showStartScreen:Re})]})})})}sn.displayName="NewsAssistant"},81199:function(e,t,s){s.d(t,{z:function(){return a}});const a={CONDENSED:"condensed",DEFAULT:"default",FINANCIAL:"financial",SIMPLE:"simple"}},29167:function(e,t,s){s.d(t,{P:function(){return p}});var a=s(13287),n=s(40809),r=s(76755),o=s(22374),i=s(85349);const l=(0,n.memo)(({index:e,isActive:t,renderTabPanelItem:s})=>(0,i.jsx)(i.Fragment,{children:s(e,t)}));l.displayName="ScrollableTabsPanelRenderer";var c=s(81199),d=s(15710),u=s(94566),m=s(40761),h=s(22090);function p({activeIndexDefault:e=0,addUrlHashOnTabActivation:t=!1,animated:s=!0,className:p,containsFocusableElements:f=!0,equalHeights:g=!0,id:y,leadingContent:b,onTabChange:x=d.lQ,renderTabPanelItem:w,saveActiveTabIndex:v=!1,scrollable:C=!0,stretched:N=!0,tabListItems:A=[],theme:k=c.z.DEFAULT}){const _=(0,n.useMemo)(()=>A.map(()=>(0,n.createRef)()),[A]),j=(0,n.useMemo)(()=>A.map(()=>(0,n.createRef)()),[A]),[S,O]=(0,n.useState)(e),[I,P]=(0,o.rX)(`tgam.tabs-${y}-selected`,0),D=(0,n.useCallback)(e=>{_?.[e]?.current?.focus()},[_]),E=(0,n.useCallback)(e=>{window.location.hash=A?.[e]?.id||""},[A]),R=(0,n.useCallback)((e,a,n=!0)=>{e!==S&&-1!==e&&(s?(e=>{document.startViewTransition?document.startViewTransition(()=>O(e)):O(e)})(e):O(e),t&&n&&E(e),v&&P(e),a&&D(e),(0,m.Ak)(x,[e]))},[S,E,t,s,D,x,v,P]),T=(0,n.useCallback)(()=>{const e=window.location.hash;return e?e.slice(1):null},[]);(0,r.S)(()=>{let e=null;if(window.location.hash){const t=A.find(e=>e.id===T());void 0!==t&&(e=A.indexOf(t))}null===e&&A?.[I]&&(e=I),null!==e&&R(e,!1,!1)},[I,T,A,R],u.Sw);const F=(0,n.useCallback)(()=>S-1<0?A.length-1:S-1,[S,A.length]),$=(0,n.useCallback)(()=>S+1>=A.length?0:S+1,[S,A.length]),M=(0,n.useCallback)(()=>A.length-1,[A.length]),L=(0,n.useCallback)(()=>{R($(),!0)},[$,R]),q=(0,n.useCallback)(()=>{R(F(),!0)},[F,R]),U=(0,n.useCallback)(()=>{R(0,!0)},[R]),B=(0,n.useCallback)(()=>{R(M(),!0)},[M,R]),W=(0,n.useCallback)(e=>{let t=!1;switch(e.code){case h.Qu:q(),t=!0;break;case h.rn:L(),t=!0;break;case h.Uy:U(),t=!0;break;case h.Ot:B(),t=!0}t&&(e.stopPropagation(),e.preventDefault())},[U,B,L,q]),z=(0,n.useCallback)((e,t)=>{e.stopPropagation(),e.preventDefault(),R(t,!1)},[R]),H=(0,a.A)(["tgam-scrollable-tabs",{"tgam-scrollable-tabs--scrollable":C,"tgam-scrollable-tabs--stretched":N,"tgam-scrollable-tabs--equal-heights":g,"tgam-scrollable-tabs--animated":s,[`tgam-scrollable-tabs--theme-${k}`]:k},p]),Q=(0,i.jsx)("div",{role:"tablist","aria-label":"Use arrow keys to navigate through the tabs",children:A.map((e,t)=>{const s=`${y}-${e.id}`,a=`tab-${s}`,n=`panel-${s}`,r=S===t;return(0,i.jsx)("button",{id:a,ref:_[t],type:"button",role:"tab",tabIndex:r?void 0:-1,"aria-selected":r,"aria-controls":n,"data-sophi-feature":n,onKeyDown:W,onClick:e=>z(e,t),children:e.label},a)})}),Y=(0,i.jsxs)("div",{className:"tgam-scrollable-tabs__panels",children:[b,A.map((e,t)=>{const s=`${y}-${e.id}`,a=`tab-${s}`,n=`panel-${s}`,r=S===t;return(0,i.jsx)("section",{id:n,ref:j[t],role:"tabpanel",tabIndex:f?void 0:0,"aria-labelledby":a,"aria-hidden":!r,children:(0,i.jsx)(l,{index:t,isActive:r,renderTabPanelItem:w})},n)})]});return{activeIndex:S,classNames:H,tabList:Q,tabPanels:Y}}},28782:function(e,t,s){s.d(t,{z:function(){return n}});var a=s(94566);function n(){if(!a.Sw)return{scrollbarVisible:!1,scrollbarWidth:0};const e=window?.innerWidth||0,t=document?.body?.clientWidth||0;return{scrollbarVisible:e>t,scrollbarWidth:e-t}}}}]);
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.