1import{c as Te,p as je,j as s,i as we,l as E,f as z,af as Ee,a7 as Ae,G as ve,bK as Re,d as V,P as W}from"./C24N-clC.js";import{r as u,m as Ne,ab as Le}from"./BrrVqsAE.js";import{a as ke,u as Ie}from"./DS3sXihf.js";import{u as ie,q as oe,k as _e,e as $,j as Pe,i as Ce}from"./9b1usi3Q.js";import{l as Oe,s as Fe,f as De,S as Ue,m as He,a as Me,u as Be,R as Ke,k as Ge,i as Qe,n as Ye,j as ze}from"./CW4roYO5.js";import{a as Ve,E as We}from"./DGGsHMn2.js";import{F as $e,a as qe,b as Xe,c as q,h as X,m as w}from"./BHzBVsL_.js";import{t as Je,p as J,b as Z,d as ee,f as te,e as se,A as Ze,F as et,g as ae}from"./sp2-1P-s.js";import{E as tt}from"./DzyhG0K4.js";import{u as st}from"./BTnryCeH.js";import{S as at,s as it,a as ot}from"./9Ccared6.js";import{u as nt}from"./mkVWBkeh.js";import{c as rt,t as lt}from"./BXzwYZf3.js";import{S as ct}from"./C8UGb0ca.js";import{b as dt}from"./1sO-Udnc.js";import{u as ut}from"./CvTaaWpV.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"all-0.0.1680"};var a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="d70f188d-9e9c-43e9-a162-2bfb42493d71",t._sentryDebugIdIdentifier="sentry-dbid-d70f188d-9e9c-43e9-a162-2bfb42493d71")}catch{}})();const A=Te()(je((t,a)=>({byAccount:{},setTraits:(i,r,n)=>t({byAccount:{...a().byAccount,[i]:{...a().byAccount[i]??{},[r]:n}}})}),{name:"retail-strategy-traits",version:1}));function Ot(){const t=ie(),a=A(i=>i.setTraits);return(i,r)=>a(t,i,r)}const gt=[];function ft(t){const a=ie(),i=A(n=>{var c;return t?(c=n.byAccount[a])==null?void 0:c[t]:void 0}),r=A(n=>n.setTraits);return{traits:i??gt,setTraits:n=>{t&&r(a,t,n)}}}function mt(t){const a=oe(t.id),i=_e().strategies.find(n=>n.id===t.id),r=ft(a?void 0:t.id);return{traits:a?i==null?void 0:i.traits:r.traits}}function Ft(t,a,i){a&&(oe(i)?a.traits.length&&t.update(i,{traits:a.traits}):t.setEngineTraits(i,a.traits),a.id!==i&&t.remove(a.id))}function St({isOpen:t,onConfirm:a,onClose:i}){const r=st(c=>c.setUpsellSheetOpen);u.useEffect(()=>(r(t),()=>r(!1)),[t,r]);const n=Oe(t);return s.jsx(Fe,{open:n,onOpenChange:c=>!c&&i(),repositionInputs:!1,children:s.jsx(De,{className:z(Me,"outline-none"),children:s.jsx(Ue,{children:s.jsxs("div",{className:"lg:flex lg:min-h-full lg:flex-col lg:justify-end",children:[s.jsxs("div",{className:"flex flex-col items-center px-4 pt-2 text-center",children:[s.jsx(we,{variant:"success",className:"mb-4",children:"Exclusive offer"}),s.jsx("h2",{className:"type-page-title mb-3 text-primary",children:"Youâve unlocked unlimited strategy monitoring"}),s.jsxs("p",{className:"type-body-small mb-6 text-muted",children:["Enjoy a trial of Alfa Premium access on us!"," ",s.jsx("span",{className:"font-medium text-primary",children:"No credit card required."})," After your Premium trial, youâll move into basic with limited monitoring."]})]}),s.jsx("div",{className:He,children:s.jsx(E,{type:"button",className:z(Ee,"h-12 w-full focus-visible:ring-0"),onClick:a,children:"Great, continue"})})]})})})})}function pt({strategy:t,isFollowed:a,onToggle:i,isToggling:r,onClose:n}){const c=mt(t);return s.jsx(at,{strategy:t,onToggleFollow:i,isFollowed:a,isToggling:r,subscribeOnly:!0,traits:c.traits,onExitEditor:n})}function bt(){var B,K;const[t,a]=u.useState(()=>new Set),[i,r]=u.useState(()=>new Set),{strategyId:n=null}=ke(),[c,v]=u.useState(()=>new Set),g=u.useRef(new Set),[f,h]=u.useState(null),[R,N]=u.useState(!1),l=$("explore",{tagId:null,keepPreviousPages:!0}),ne=(((B=$("following").data)==null?void 0:B.strategies)??[]).filter(e=>e.subscribed).length,re=Pe(),L=nt(),k=dt(),y=Ce(n??void 0),I=(((K=l.data)==null?void 0:K.strategies)??[]).map(e=>rt(e)),x=e=>e.response.subscribed||c.has(e.id),m=I.filter(e=>!x(e)),_=Je(m),P=e=>{const o=e==="tickers"?m:te(m,i);return e==="industries"?o:se(o,t)},le=J(Z(P("industries")),t),ce=J(ee(P("tickers")),i),de=Z(m).length,ue=ee(m).length,C=te(se(I,t),i),p=t.size>0||i.size>0,ge=e=>a(o=>ae(o,e)),fe=e=>r(o=>ae(o,e)),O=()=>{a(new Set),r(new Set)},me=We,T=ut(e=>e.setHeaderAction);u.useEffect(()=>(T(null),()=>T(null)),[T]);const S=Ve(C.filter(e=>!x(e)),me),j=l.isLoading&&S.length===0,F=Be(j),d=y.data?lt(y.data.strategy,y.data.links):C.find(e=>e.id===n),D=Ie(),b=()=>D(V(W.explore)),U=e=>D(`${V(W.explore)}/${e}`),Se=!n,H=(e,o)=>{g.current.add(e),v(new Set(g.current)),re.mutate({strategyID:e,subscribed:!1},{onError:()=>{g.current.delete(e),v(new Set(g.current)),L(e),o==null||o()}})},M=e=>{var Y;const o=(d==null?void 0:d.id)===e?d.response:(Y=l.data)==null?void 0:Y.strategies.find(xe=>xe.strategy_id===e);if(!o||o.subscribed||g.current.has(e))return!1;const G=ne>=2;if(G&&!X()&&w(),!G&&!X())return h(e),!1;const{title:Q}=o,ye=it(Q);return H(e,()=>ot(ye,Q)),!0},pe=e=>{R||(N(!0),window.setTimeout(()=>{const o=M(e);N(!1),o&&b()},et))},be=()=>{f&&H(f),w(),h(null),b()},he=()=>{f&&L(f),w(),h(null)};return s.jsxs(Ae,{pinnedHeader:!0,header:s.jsxs(ze,{direction:k,children:[s.jsx(ve,{title:"Explore",className:`mb-5 ${Re}`}),j?s.jsx($e,{}):s.jsxs(qe,{children:[s.jsx(Xe,{shown:p,onReset:O}),s.jsx(q,{icon:Ne,totalOptions:de,label:"Sectors",alwaysSearchable:!0,emptyLabel:"All sectors",options:le.map(e=>({value:e.label,label:e.label,count:e.count})),selected:t,onToggle:ge,onClear:()=>a(new Set)}),s.jsx(q,{icon:Le,totalOptions:ue,label:"Stocks",options:ce.map(e=>{var o;return{value:e.label,label:e.label,count:e.count,symbol:e.label,subtitle:(o=_[e.label])==null?void 0:o.name,holding:_[e.label]}}),selected:i,onToggle:fe,onClear:()=>r(new Set)})]})]}),children:[s.jsx(Ke,{activeKey:"explore",direction:k,variant:"tab",children:s.jsx(Ge,{isOpen:!!d,onClose:b,sheetKey:n,base:s.jsx(s.Fragment,{children:s.jsx(Qe,{loading:j||F,skeleton:F?s.jsx(Ye,{}):null,children:()=>s.jsxs("div",{className:"flex flex-col",children:[S.length===0&&p&&l.hasNextPage&&s.jsx(E,{type:"button",variant:"secondary",className:"mx-auto mt-4",disabled:l.isFetchingNextPage,onClick:()=>void l.fetchNextPage(),children:l.isFetchingNextPage?"Loading":"Load more"}),S.length===0&&p?s.jsx(tt,{title:"No strategies match these filters",description:"Load more to search the rest of the catalog, or clear the filters.",actionLabel:"Clear filters",onAction:O}):s.jsx(Ze,{showThumbnail:!0,showAuthor:!1,hideAction:!0,strategies:S,isFollowed:()=>!1,onToggle:M,onOpen:U}),!(S.length===0&&p)&&l.hasNextPage&&s.jsx(E,{type:"button",variant:"secondary",className:"mx-auto mt-4",disabled:l.isFetchingNextPage,onClick:()=>void l.fetchNextPage(),children:l.isFetchingNextPage?"Loading":"Load more"})]})})}),sheet:d&&s.jsx("div",{className:"px-4",children:s.jsx(pt,{strategy:d,isFollowed:x(d),onToggle:pe,isToggling:R,onClose:b})})})}),s.jsx(ct,{listVisible:Se,onOpenStrategy:U}),s.jsx(St,{isOpen:!!f,onConfirm:be,onClose:he})]})}const Dt=Object.freeze(Object.defineProperty({__proto__:null,RetailWebExplorePage:bt},Symbol.toStringTag,{value:"Module"}));
1export{Dt as E,Ft as r,Ot as u};
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.