PageSourceSearch

https://forum.effectivealtruism.org/_next/static/chunks/bb8e790481913012.js

js effectivealtruism.org collected 2026-10-02 02:15:20 UTC 65,607 bytes, 9 lines download raw bytes

1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="6fe8c2cf-9955-b4b5-d601-e8b5b6cbccc9")}catch(e){}}();
2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,118455,e=>{"use strict";var t=e.i(843476),a=e.i(271645),n=e.i(209840),s=e.i(312348),r=e.i(72262);e.i(250825);let l=e.i(492327).z.enum(["auto","default","dark"]),i=(0,a.createContext)(null),o={auto:"theme-auto",default:"theme-light",dark:"theme-dark"};e.s(["ThemeProvider",0,({children:e})=>{let[c,d]=(0,r.useCookiesWithConsent)(["theme"]),{currentUser:u}=(0,n.useCurrentUser)(),[m,h]=(0,a.useState)(u?.theme?.name??((e,t="auto")=>l.safeParse(e).success?e:t)(c.theme)),p=(0,a.useCallback)(async e=>{h(e),d("theme",e,{maxAge:31536e4}),u&&await s.rpc.users.updateTheme({theme:e})},[u,d]);return(0,a.useEffect)(()=>{let e=document.body;e&&(e.classList.remove(...Object.values(o)),e.classList.add(o[m]))},[m]),(0,t.jsx)(i.Provider,{value:{theme:m,updateTheme:p},children:(0,t.jsx)("div",{"data-component":"ThemeProvider",className:o[m],children:e})})},"useTheme",0,()=>{let e=(0,a.useContext)(i);if(!e)throw Error("Theme context not found");return e}],118455)},155727,e=>{"use strict";var t=e.i(843476),a=e.i(618566),n=e.i(271645);let s=(0,n.createContext)(null);e.s(["MobileNavProvider",0,({children:e})=>{let r=(0,a.usePathname)(),[l,i]=(0,n.useState)(!1),o=(0,n.useCallback)(()=>i(!0),[]),c=(0,n.useCallback)(()=>i(!1),[]);return(0,t.jsx)(s.Provider,{value:{isMobileNavOpen:l,openMobileNav:o,closeMobileNav:c,showMobileNavOnDesktop:"/"!==r},children:e})},"useMobileNav",0,()=>{let e=(0,n.useContext)(s);if(!e)throw Error("Mobile nav context not found");return e}])},378231,e=>{"use strict";var t=e.i(843476),a=e.i(271645),n=e.i(160478),n=n,s=e.i(556624),r=e.i(870202);function l({initialCookies:e,children:l}){let i=(0,a.useMemo)(()=>new n.default(e),[e]);return(0,a.useEffect)(()=>{(0,r.initRecaptcha)()},[]),(0,t.jsx)(s.CookiesProvider,{defaultSetOptions:{path:"/"},cookies:i,children:l})}e.s(["default",()=>l],378231)},999769,e=>{"use strict";var t=e.i(271645),a=Object.defineProperty,n=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,l=(e,t,n)=>t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,i=(e,t)=>{for(var a in t||(t={}))s.call(t,a)&&l(e,a,t[a]);if(n)for(var a of n(t))r.call(t,a)&&l(e,a,t[a]);return e},o=(e,t)=>{let a="[react-use-intercom]";switch(e){case"info":default:console.log(`${a} ${t}`);break;case"warn":console.warn(`${a} ${t}`);break;case"error":console.error(`${a} ${t}`)}},c="u"<typeof window,d=e=>(Object.keys(e).forEach(t=>{e[t]&&"object"==typeof e[t]?d(e[t]):void 0===e[t]&&delete e[t]}),e),u=(e,...t)=>{if(!c&&window.Intercom)return window.Intercom.apply(null,[e,...t]);o("error",`${e} Intercom instance is not initalized yet`)},m=t.createContext(void 0),h=e=>i({company_id:e.companyId,name:e.name,created_at:e.createdAt,plan:e.plan,monthly_spend:e.monthlySpend,user_count:e.userCount,size:e.size,website:e.website,industry:e.industry},e.customAttributes),p=e=>{var t;let a;return d(i(i({},{custom_launcher_selector:e.customLauncherSelector,alignment:e.alignment,vertical_padding:e.verticalPadding,horizontal_padding:e.horizontalPadding,z_index:e.zIndex,hide_default_launcher:e.hideDefaultLauncher,session_duration:e.sessionDuration,action_color:e.actionColor,background_color:e.backgroundColor}),i({email:e.email,user_id:e.userId,created_at:e.createdAt,name:e.name,phone:e.phone,last_request_at:e.lastRequestAt,unsubscribed_from_emails:e.unsubscribedFromEmails,language_override:e.languageOverride,utm_campaign:e.utmCampaign,utm_content:e.utmContent,utm_medium:e.utmMedium,utm_source:e.utmSource,utm_term:e.utmTerm,avatar:e.avatar&&{type:(a=e.avatar).type,image_url:a.imageUrl},user_hash:e.userHash,company:e.company&&h(e.company),companies:null==(t=e.companies)?void 0:t.map(h),intercom_user_jwt:e.intercomUserJwt},e.customAttributes)))},f=e=>{var{appId:a,autoBoot:l=!1,autoBootProps:d,children:h,onHide:f,onShow:g,onUnreadCountChange:x,onUserEmailSupplied:w,shouldInitialize:v=!c,apiBase:y,initializeDelay:b,cspNonce:j}=e,k=((e,t)=>{var a={};for(var l in e)s.call(e,l)&&0>t.indexOf(l)&&(a[l]=e[l]);if(null!=e&&n)for(var l of n(e))0>t.indexOf(l)&&r.call(e,l)&&(a[l]=e[l]);return a})(e,["appId","autoBoot","autoBootProps","children","onHide","onShow","onUnreadCountChange","onUserEmailSupplied","shouldInitialize","apiBase","initializeDelay","cspNonce"]);let N=t.useRef(!1),C=t.useRef(!1),[S,E]=t.useState(!1),I=Object.keys(k).filter(e=>!e.startsWith("data-"));I.length>0&&o("warn",`some invalid props were passed to IntercomProvider. Please check following props: ${I.join(", ")}.`);let P=t.useCallback(e=>{if(!window.Intercom&&!v)return void o("warn","Intercom instance is not initialized because `shouldInitialize` is set to `false` in `IntercomProvider`");if(N.current)return;u("onHide",()=>{E(!1),null==f||f()}),u("onShow",()=>{E(!0),null==g||g()}),u("onUserEmailSupplied",w),x&&u("onUnreadCountChange",x);let t=i(i({app_id:a}
2,y&&{api_base:y}),e&&p(e));window.intercomSettings=t,u("boot",t),N.current=!0},[y,a,f,g,x,w,v]);c||!v||C.current||(((e,t=0,a)=>{var n=window,s=n.Intercom;if("function"==typeof s)s("reattach_activator"),s("update",n.intercomSettings);else{var r=document,l=function(){l.c(arguments)};l.q=[],l.c=function(e){l.q.push(e)},n.Intercom=l;var i=function(){setTimeout(function(){var t=r.createElement("script");t.type="text/javascript",t.async=!0,a&&t.setAttribute("nonce",a),t.src="https://widget.intercom.io/widget/"+e;var n=r.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n)},t)};"complete"===document.readyState?i():n.attachEvent?n.attachEvent("onload",i):n.addEventListener("load",i,!1)}})(a,b,j),l&&P(d),C.current=!0);let T=t.useCallback((e,t)=>window.Intercom||v?N.current?t():void o("warn",`"${e}" was called but Intercom has not booted yet. Please call 'boot' before calling '${e}' or set 'autoBoot' to true in the IntercomProvider.`):void o("warn","Intercom instance is not initialized because `shouldInitialize` is set to `false` in `IntercomProvider`"),[v]),A=t.useCallback(()=>{N.current&&(u("shutdown"),delete window.intercomSettings,N.current=!1)},[]),_=t.useCallback(()=>{N.current&&(u("shutdown"),delete window.Intercom,delete window.intercomSettings,N.current=!1)},[]),O=t.useCallback(()=>{T("update",()=>{u("update",{last_request_at:Math.floor(new Date().getTime()/1e3)})})},[T]),R=t.useCallback(e=>{T("update",()=>{if(!e)return void O();let t=p(e);window.intercomSettings=i(i({},window.intercomSettings),t),u("update",t)})},[T,O]),M=t.useCallback(()=>{T("hide",()=>{u("hide")})},[T]),L=t.useCallback(()=>{T("show",()=>u("show"))},[T]),U=t.useCallback(()=>{T("showMessages",()=>{u("showMessages")})},[T]),H=t.useCallback(e=>{T("showNewMessage",()=>{e?u("showNewMessage",e):u("showNewMessage")})},[T]),z=t.useCallback(()=>T("getVisitorId",()=>u("getVisitorId")),[T]),D=t.useCallback(e=>{T("startTour",()=>{u("startTour",e)})},[T]),B=t.useCallback(e=>{T("startChecklist",()=>{u("startChecklist",e)})},[T]),$=t.useCallback((e,t)=>{T("trackEvent",()=>{t?u("trackEvent",e,t):u("trackEvent",e)})},[T]),F=t.useCallback(e=>T("showArticle",()=>{u("showArticle",e)}),[T]),q=t.useCallback(e=>T("showSpace",()=>{u("showSpace",e)}),[T]),Y=t.useCallback(e=>{T("startSurvey",()=>{u("startSurvey",e)})},[T]),V=t.useCallback(e=>T("showNews",()=>{u("showNews",e)}),[T]),Z=t.useCallback(e=>T("showTicket",()=>{u("showTicket",e)}),[T]),K=t.useCallback(e=>T("showConversation",()=>{u("showConversation",e)}),[T]),G=t.useMemo(()=>({boot:P,shutdown:A,hardShutdown:_,update:R,hide:M,show:L,isOpen:S,showMessages:U,showNewMessage:H,getVisitorId:z,startTour:D,startChecklist:B,trackEvent:$,showArticle:F,startSurvey:Y,showSpace:q,showNews:V,showTicket:Z,showConversation:K}),[P,A,_,R,M,L,S,U,H,z,D,B,$,F,Y,q,V,Z,K]);return t.createElement(m.Provider,{value:G},h)},g=()=>(()=>{let e=t.useContext(m);if(void 0===e)throw Error('"useIntercom" must be used within `IntercomProvider`.');return e})();e.s(["IntercomProvider",()=>f,"useIntercom",()=>g])},982310,e=>{"use strict";var t=e.i(843476),a=e.i(999769);function n({children:e}){return(0,t.jsx)(a.IntercomProvider,{appId:"xycbzvda",autoBoot:!1,children:e})}e.s(["default",()=>n])},648445,e=>{"use strict";var t=e.i(843476),a=e.i(543489);function n({children:e}){return(0,t.jsx)(a.FloatingTree,{children:e})}e.s(["default",()=>n])},316371,e=>{"use strict";let t;var a=e.i(843476),n=e.i(271645),s=e.i(713249),r=e.i(195358),l=e.i(209840),i=e.i(155727),o=e.i(207670),c=e.i(657688);let d=n.forwardRef(function({title:e,titleId:t,...a},s){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},a),e?n.createElement("title",{id:t},e):null,n.createElement("path",{fillRule:"evenodd",d:"M3 6.75A.75.75 0 0 1 3.75 6h16.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 6.75ZM3 12a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 12Zm0 5.25a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"}))}),u=n.forwardRef(function({title:e,titleId:t,...a},s){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},a),e?n.createElement("title",{id:t},e):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"}))});var m=e.i(442346),h=e.i(201278),p=e.i(662537),f=e.i(270435),g=e.i(312348),x=e.i(68340),w=e.i(618003),v=e.i(154727),y=e.i(144950),b=e.i(374009),j=e.i(705766),k=e.i(872159),N=e.i(324140),C=e.i(347782),S=e.i(504816),E=e.i(124506),I=e.i(17796),P=e.i(56228),T=e.i(840128),A=e.i(87753),_=e.i(991844);function O({comment:e,placement:t="bottom-start",As:n="div",className:s,children:r}){return e?(0,a.jsx)(_.default,{placement:t,As:n,className:s,popover:!0,tooltipClassName:"px-3! py-2! w-[360px]",title:(0,a.jsxs)("div",{"data-component":"CommentsTooltip",children:[e.post?.title&&(0,a.jsx)(N.default,{style:"postTitle",className:"mb-2",children:e.post.t
2itle}),(0,a.jsx)(T.CommentsListProvider,{comments:[e],children:(0,a.jsx)(A.default,{})})]}),children:r}):(0,a.jsx)(a.Fragment,{children:r})}var R=e.i(494e3);function M({commentId:e,placement:t,As:s="div",className:r,children:l}){let[i,o]=(0,n.useState)(null),[c,d]=(0,n.useState)(!1),u=(0,n.useCallback)(()=>d(!0),[]),m=(0,n.useCallback)(async()=>{if(!e)return void o(null);try{let t=await g.rpc.comments.listById({_id:e});o(t)}catch(t){console.error(`Error fetching comment ${e}:`,t),(0,p.captureException)(t)}},[e]);return((0,n.useEffect)(()=>{d(!1)},[e]),(0,n.useEffect)(()=>{c&&m()},[c,m]),e)?i?(0,a.jsx)(O,{As:s,placement:t,className:r,comment:i,children:l}):(0,a.jsx)(_.default,{As:s,placement:t,className:r,popover:!0,tooltipClassName:"px-3! py-2! w-[360px] ",title:(0,a.jsx)(R.default,{}),children:(0,a.jsx)(s,{onMouseEnter:u,children:l})}):(0,a.jsx)(a.Fragment,{children:l})}var L=e.i(366994);let U=e=>{console.error(e),(0,p.captureException)(e)},H=e=>{if(!e)return[];let t={};for(let a in e){let n=e[a];if("number"==typeof n){let e=(0,S.getReactionByName)(a);e?t[a]={reaction:e,userCount:n}:console.error("Invalid private reactionType:",a)}else{let e=(0,S.getReactionByName)(a);e?t[a]={reaction:e,users:n.map(({displayName:e,slug:t})=>({displayName:e,slug:t}))}:console.error("Invalid public reactionType:",a)}}return Object.values(t).map(({reaction:e,users:t=[],userCount:n})=>({reaction:e,users:t.length?((e,t=3)=>{let n=e.map(e=>(0,a.jsx)(C.default,{href:(0,f.userGetProfileUrl)({user:{slug:e.slug}}),children:e.displayName},e.slug));if(n.length<2)return n[0];let s=n.slice(0,Math.min(t,n.length-1)),r=n.length<=t?n[n.length-1]:`${n.length-t} more`;return(0,a.jsxs)(a.Fragment,{children:[s.reduce((e,t)=>null===e?[t]:[...e,", ",t],null)," and ",r]})})(t):`${n} ${1===n?"person":"people"}`,tooltip:t.length>1?`${t.slice(0,-1).map(({displayName:e})=>e).join(", ")} and ${t[t.length-1].displayName}`:t[0]?.displayName}))};function z({postKarmaChange:e,commentKarmaChange:t,tagRevisionKarmaChange:n}){let s,r,l=[];if(e){let t=(0,I.postGetPageUrl)({post:{_id:e.postId,slug:e.slug}});s=e.scoreChange,l=H(e.addedReacts),r=(0,a.jsx)(L.default,{postId:e.postId,As:"span",children:(0,a.jsx)(C.default,{href:t,children:e.title})})}else if(t){s=t.scoreChange,l=H(t.addedReacts);let{postId:e,postSlug:n,postTitle:i,tagSlug:o,tagName:c}=t;if(e&&n&&i)r=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(M,{As:"span",commentId:t.commentId,children:(0,a.jsx)(C.default,{href:(0,E.commentGetPageUrlFromIds)(t),children:"comment"})})," ","on"," ",(0,a.jsx)(L.default,{postId:t.postId,As:"span",children:(0,a.jsx)(C.default,{href:(0,I.postGetPageUrl)({post:{_id:e,slug:n}}),children:i})})]});else if(o)r=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(C.default,{href:(0,E.commentGetPageUrlFromIds)(t),children:"comment"})," on"," ",(0,a.jsx)(C.default,{href:(0,P.tagGetPageUrl)({tag:{slug:o}}),children:c})]});else{let e=JSON.stringify(t);return U(Error(`Invalid commentKarmaChange ${e}`)),null}}else if(n){if(!n.tagName||!n.tagSlug){let e=JSON.stringify(n);return U(Error(`Invalid tagRevisionKarmaChange ${e}`)),null}s=n.scoreChange,r=(0,a.jsx)(C.default,{href:(0,P.tagGetPageUrl)({tag:{slug:n.tagSlug}}),children:n.tagName})}else{let a=JSON.stringify({postKarmaChange:e,commentKarmaChange:t,tagRevisionKarmaChange:n});return U(Error(`Invalid karma change: ${a}`)),null}return(0,a.jsxs)(v.AnalyticsContext,{pageSubSectionContext:"karmaChange",children:[0!==s&&(0,a.jsxs)("div",{className:"flex gap-3 items-start pl-1",children:[(0,a.jsx)(x.default,{className:"text-karma-star w-5 min-w-5 mt-1"}),(0,a.jsxs)(N.default,{className:"text-gray-600 [&_a]:text-gray-1000 [&>*]:inline grow",children:[(0,a.jsxs)("span",{className:"mr-[6px]",children:[s<0?String(s):`+${s}`," karma"]}),r]})]}),l.map(({reaction:e,users:n,tooltip:s},l)=>(0,a.jsxs)("div",{className:"flex gap-3 items-start pl-1",children:[(0,a.jsx)(_.default,{title:e.label,children:(0,a.jsx)(e.Component,{className:"text-primary w-5 min-w-5 mt-1"})}),(0,a.jsxs)(N.default,{className:"text-gray-600 [&_a]:text-gray-1000 [&>*]:inline grow",children:[(0,a.jsx)(_.default,{title:s,placement:"bottom",children:n})," ","reacted to ",t&&"your"," ",r]})]},l))]})}function D({karmaChanges:e,truncateAt:t}
2){let[s,r]=(0,n.useState)(void 0!==t&&t>0&&(e?.posts.length??0)+(e?.comments.length??0)+(e?.tagRevisions.length??0)>t),l=(0,n.useCallback)(()=>r(!1),[]),i=e?.posts,o=e?.comments,c=e?.tagRevisions;if(s&&void 0!==t){let e=t;i=i?.slice(0,e);let a=i?.reduce((e,t)=>e+ +(0!==t.scoreChange)+(Object.keys(t.addedReacts??{}).length??0),0)??0;if(i&&a>=e)a>e&&i.pop(),o=[],c=[];else{e-=a,o=o?.slice(0,e);let t=o?.reduce((e,t)=>e+ +(0!==t.scoreChange)+(Object.keys(t.addedReacts??{}).length??0),0)??0;o&&t>=e?(t>e&&o.pop(),c=[]):(e-=t,c=c?.slice(0,e))}}return(0,a.jsxs)("div",{"data-component":"KarmaChangeList",className:"flex flex-col gap-2 items-start",children:[i?.map(e=>(0,a.jsx)(z,{postKarmaChange:e},e._id)),o?.map(e=>(0,a.jsx)(z,{commentKarmaChange:e},e._id)),c?.map(e=>(0,a.jsx)(z,{tagRevisionKarmaChange:e},e._id)),s&&(0,a.jsx)(N.default,{As:"button",onClick:l,className:" cursor-pointer text-gray-600 hover:text-gray-1000 font-[600]! ",children:"Show more"})]})}let B={realtime:"appear in real time",daily:"are batched daily",weekly:"are batched weekly",disabled:"are disabled"};function $({karmaChanges:e,className:t}){let{currentUser:s}=(0,l.useCurrentUser)(),r=(0,n.useMemo)(()=>!!e&&!!(e.posts?.length||e.comments?.length||e.tagRevisions?.length),[e]),i=e?.todaysKarmaChanges,c=(0,n.useMemo)(()=>!!i&&!!(i.posts?.length||i.comments?.length||i.tagRevisions?.length),[i]),d=e?.thisWeeksKarmaChanges,u=(0,n.useMemo)(()=>!!d&&!!(d.posts?.length||d.comments?.length||d.tagRevisions?.length),[d]);if(!s)return null;let{karmaChangeNotifierSettings:{updateFrequency:m}}=s;return(0,a.jsxs)("section",{"data-component":"KarmaAndReactsNotifications",className:(0,o.default)("flex flex-col gap-4",t),children:[(0,a.jsx)(N.default,{style:"sectionTitleSmall",children:"Karma & reacts"}),!r&&!c&&!u&&(0,a.jsx)(N.default,{style:"bodySmall",className:"italic text-gray-600",children:"No new karma or reacts"}),r&&(0,a.jsx)(D,{karmaChanges:e}),c&&(0,a.jsxs)("div",{children:[(0,a.jsx)(N.default,{style:"bodySmall",className:"font-[600]! text-gray-600 mb-[6px]",children:"Today"}),(0,a.jsx)(D,{karmaChanges:i,truncateAt:3})]}),u&&(0,a.jsxs)("div",{children:[(0,a.jsx)(N.default,{style:"bodySmall",className:"font-[600]! text-gray-600 mb-[6px]",children:"This week"}),(0,a.jsx)(D,{karmaChanges:d??void 0,truncateAt:2})]}),(0,a.jsxs)(N.default,{style:"bodySmall",className:"text-gray-600",children:["Notifications ",B[m],"."," ",(0,a.jsx)(C.default,{href:"/account?highlightField=auto_subscribe_to_my_posts",className:"font-[600] text-primary-dark hover:opacity-70",children:"Change settings"})]})]})}function F(){return(0,a.jsxs)("div",{"data-component":"NotificationDisplaySkeleton",className:"flex gap-2 mt-2 mb-4 pl-2 pr-1",children:[(0,a.jsx)("div",{className:"w-6 h-6 min-w-6 bg-gray-200 rounded-full"}),(0,a.jsxs)("div",{className:"grow",children:[(0,a.jsx)("div",{className:"w-20 h-4 bg-gray-100 rounded mb-2"}),(0,a.jsx)("div",{className:"w-60 h-4 bg-gray-300 rounded"})]}),(0,a.jsx)("div",{className:"w-8 h-3 bg-gray-100 rounded"})]})}var q=e.i(219919),Y=e.i(102115),V=e.i(974031);new V.TupleSet(["post","comment","user","message","tagRel","sequence","localgroup","dialogueCheck","dialogueMatchPreference"]);let Z=n.forwardRef(function({title:e,titleId:t,...a},s){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},a),e?n.createElement("title",{id:t},e):null,n.createElement("path",{d:"M1 8.74c0 .983.713 1.825 1.69 1.943.764.092 1.534.164 2.31.216v2.351a.75.75 0 0 0 1.28.53l2.51-2.51c.182-.181.427-.286.684-.294a44.298 44.298 0 0 0 3.837-.293C14.287 10.565 15 9.723 15 8.74V4.26c0-.983-.713-1.825-1.69-1.943a44.447 44.447 0 0 0-10.62 0C1.712 2.435 1 3.277 1 4.26v4.482Z"}))}),K=n.forwardRef(function({title:e,titleId:t,...a},s){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},a),e?n.createElement("title",{id:t},e):null,n.createElement("path",{d:"M2.5 3.5A1.5 1.5 0 0 1 4 2h4.879a1.5 1.5 0 0 1 1.06.44l3.122 3.12a1.5 1.5 0 0 1 .439 1.061V12.5A1.5 1.5 0 0 1 12 14H4a1.5 1.5 0 0 1-1.5-1.5v-9Z"}))});var G=e.i(923816);let W=n.forwardRef(function({title:e,titleId:t,...a},s){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},a),e?n.createElement("title",{id:t},e):null,n.createElement("path",{fillRule:"evenodd",d:"M3.75 3.5c0 .563.186 1.082.5 1.5H2a1 1 0 0 0 0 2h5.25V5h1.5v2H14a1 1 0 1 0 0-2h-2.25A2.5 2.5 0 0 0 8 1.714 2.5 2.5 0 0 0 3.75 3.5Zm3.499 0v-.038A1 1 0 1 0 6.25 4.5h1l-.001-1Zm2.5-1a1 1 0 0 0-1 .962l.001.038v1h.999a1 1 0 0 0 0-2Z",clipRule:"evenodd"}),n.createElement("path",{d:"M7.25 8.5H2V12a2 2 0 0 0 2 2h3.25V8.5ZM8.75 14V8.5H14V12a2 2 0 0 1-2 2H8.75Z"}))});var J=e.i(33469),X=e.i(736032);let Q=({notification:{post:e,comment:t},children:n})=>t?(0,a.jsx)(M,{commentId:t._id,placement:"left-start",children:n}):e?(0,a.jsx)(J.default,{post:e,placement:"left-start",children:n}):(0,a.jsx)(a.Fragment,{children:n});function ee({notification:e}){let{message:t,type:n,viewed:s,createdAt:r}=e,l="wrapped"===e.type?{Icon:W,className:"wrapped-notification"}:"commentAwarded"===e.type?{Icon:G.default,className:"bg-always-black text-karma-star"}:e.comment?{Icon:Z,className:"bg-gray-600"}:{Icon:K,className:"bg-(--color-primary)"};return(0,a.jsx)(v.AnalyticsContext,{pageSubSectionContext:"notificationsPageItem",children:(0,a.jsx)(Q,{notification:e,children:(0,a.jsxs)(C.default,{"data-component":"NotificationDisplay",href:(({link:e,type:t,post:a,comment:n,user:s,localgroup:r,sequence:l})=>e||("emailVerificationRequired"===t?"/resendVerificationEmail":n?(0,E.commentGetPageUrl)({comment:n}):a?(0,I.postGetPageUrl)({post:a}):l?(0,Y.sequenceGetPageUrl)({sequence:l}):r?(({localgroup:e})=>`/groups/${e._id}`)({localgroup:r}):s?(0,f.userGetProfileUrl)({user:s}):(console.error("Invalid notification type"),"#")))(e),className:" flex gap-2 text-gray-600 p-[6px_8px] rounded cursor-pointer hover:bg-gray-100 ",children:[(0,a.jsx)("div",{className:(0,o.default)("flex items-center justify-center text-always-w
2hite rounded-full","w-[24px] min-w-[24px] h-[24px]",l.className),children:(0,a.jsx)(l.Icon,{className:"w-[14px] h-[14px] min-w-[14px] min-h-[14px]"})}),(0,a.jsxs)("div",{className:"flex grow",children:[(0,a.jsxs)("div",{className:"grow",children:[(0,a.jsx)(N.default,{style:"bodySmall",children:(e=>{switch(e){case"newRSVP":return"New RSVP";case"newShortform":return"New Quick take";case"coauthorRequestNotification":return"Co-author requested";case"coauthorAcceptNotification":return"Co-author accepted";default:let t=e.replace(/([A-Z])/g," $1");return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}})(n)}),(0,a.jsx)(N.default,{style:"bodySmall",className:(0,o.default)("text-gray-1000",!s&&"font-[600]"),children:t})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[!s&&(0,a.jsx)("div",{className:" w-[10px] min-w-[10px] h-[10px] min-h-[10px] mt-[5px] rounded-full bg-primary "}),r&&(0,a.jsx)(X.default,{time:r,textStyle:"bodySmall"})]})]})]})})})}var et=e.i(217275),ea=e.i(495632);function en({karmaChanges:e,onOpen:t,className:s,children:r}){let[l,i]=(0,n.useState)(!1),[o,c]=(0,n.useState)([]),[d,u]=(0,n.use
2State)(!0),m=(0,n.useCallback)(async e=>{try{c(t=>{if(t.length>=e)return t;let a=[...t];for(;a.length<=e;)a.push(null);return a});let t=await g.rpc.notifications.list({offset:20*e,limit:20});c(a=>{let n=[...a];for(;n.length<=e;)n.push(null);return null===n[e]&&(n[e]=t),n}),t.length<20&&u(!1)}catch(e){j.default.error("Failed to load notifications"),console.error(e)}},[]);(0,n.useEffect)(()=>{m(0)},[m]);let h=(0,n.useMemo)(()=>(0,b.default)(()=>{d&&m(o.length)},1e3),[d,o.length,m]);(0,n.useEffect)(()=>()=>h.cancel(),[h]);let p=(0,n.useCallback)(a=>{a&&(g.rpc.users.checkNotifications({hasKarmaChanges:!!e,openedAt:new Date,endDate:e?.endDate??new Date}),t?.())},[e,t]),f=(0,n.useCallback)(async()=>{i(!0),await g.rpc.notifications.markAllAsRead(),i(!1),c([])},[]),x=o.some(e=>!e);return(0,a.jsx)(v.AnalyticsContext,{pageSectionContext:"notificationsPopover",children:(0,a.jsx)(ea.default,{className:s,onToggleOpen:p,placement:"bottom",menu:(0,a.jsxs)("div",{"data-component":"NotificationsDropdown",className:" bg-surface-floating rounded shadow-lg px-2 py-3 border border-gray-100 w-[400px] max-w-full max-h-[90vh] overflow-y-auto ",children:[(0,a.jsxs)("div",{className:"px-2",children:[(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsx)(N.default,{className:"text-[24px] font-[600] mb-6 grow",children:"Notifications"}),(0,a.jsx)(et.default,{items:[{title:"Mark all as read",onClick:f,loading:l},{title:"Keyword alerts",href:"/keywords"},{title:"Notification settings",href:"/account?highlightField=auto_subscribe_to_my_posts"}],children:(0,a.jsx)("button",{className:"cursor-pointer hover:bg-item-hover rounded p-1",children:(0,a.jsx)(k.default,{className:"w-6"})})})]}),(0,a.jsx)($,{karmaChanges:e,className:"mb-6"}),(0,a.jsx)(N.default,{style:"sectionTitleSmall",className:"mb-4",children:"Posts & comments"})]}),o.map((e,t)=>e?e.map(e=>(0,a.jsx)(ee,{notification:e},e._id)):(0,y.default)(20).map(e=>(0,a.jsx)(F,{},`${t}${e}`))),d&&!x&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(q.default,{onTrigger:h}),(0,y.default)(20).map(e=>(0,a.jsx)(F,{},e))]}),!d&&(0,a.jsx)(N.default,{className:"text-gray-600 text-center mt-8 mb-6",children:"No more notifications"})]}),children:r})})}function es({Icon:e,description:t,onClick:n}){return(0,a.jsx)(_.default,{title:(0,a.jsx)(N.default,{style:"bodySmall",children:t}),placement:"bottom",children:(0,a.jsx)("button",{"data-component":"HeaderButton",className:"cursor-pointer hover:bg-item-hover rounded p-1.5",onClick:n,children:(0,a.jsx)(e,{className:"w-[24px] text-gray-600"})})})}function er(){let{currentUser:e}=(0,l.useCurrentUser)(),[t,s]=(0,n.useState)(null),[r,i]=(0,n.useState)(0),c=(0,n.useCallback)(async()=>{if(!e){s(null),i(0);return}try{let[e,t]=await Promise.all([g.rpc.users.karmaChanges({}),g.rpc.notifications.countUnread()]);s(e),i(t)}catch(e){(0,p.captureException)(e),console.error("Error fetching karma changes:",e)}},[e]);if((({callback:e,intervalMs:t,pollWhileTabInactive:a,dependencies:s=[]})=>{let r=(0,n.useRef)(e);(0,n.useEffect)(()=>{r.current=e},[e]),(0,n.useEffect)(()=>{let e=null,n=()=>{r.current()},s=()=>{e||(e=setInterval(n,t))},l=()=>{e&&(clearInterval(e),e=null)},i=()=>{a||("visible"===document.visibilityState?(n(),s()):l())};return n(),(a||"visible"===document.visibilityState)&&s(),a||document.addEventListener("visibilitychange",i),()=>{l(),a||document.removeEventListener("visibilitychange",i)}},[t,a,...s])})({callback:c,intervalMs:6e4}),!e)return null;let d=(0,f.userHasKarmaChange)(e,t),u=r>0;return(0,a.jsxs)(en,{karmaChanges:t,onOpen:c,className:"relative",children:[u&&(0,a.jsx)(N.default,{style:"bodySmall",className:" absolute top-[-2px] right-[2px] bg-primary rounded-[50%] px-[1px] min-w-[19px] text-center font-[600]! pointer-events-none text-always-w
2hite ",children:r}),d&&(0,a.jsx)(x.default,{className:(0,o.default)("w-4 text-karma-star absolute rotate-[345deg]",u?"top-[-8] right-[10px]":"top-0 right-[6px]")}),(0,a.jsx)(es,{Icon:w.default,description:"Notifications"})]},r)}var el=e.i(118455),ei=e.i(669430);let eo=n.forwardRef(function({title:e,titleId:t,...a},s){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},a),e?n.createElement("title",{id:t},e):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"}))}),ec=n.forwardRef(function({title:e,titleId:t,...a},s){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},a),e?n.createElement("title",{id:t},e):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10"}))}),ed=n.forwardRef(function({title:e,titleId:t,...a},s){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},a),e?n.createElement("title",{id:t},e):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"}),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))});var eu=e.i(608368),em=e.i(602966),eh=e.i(40031);let ep=n.forwardRef(function({title:e,titleId:t,...a},s){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},a),e?n.createElement("title",{id:t},e):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z"}))});var ef=e.i(225769),eg=e.i(673512),ex=e.i(798740),ew=e.i(63685),ev=e.i(460887),ey=e.i(990877),eb=e.i(710007);function ej({open:e,onClose:t}){let{tagProps:n,editorProps:{loading:s,editorRef:r,contents:l,onSubmit:i,onKeyDown:o,onChange:c}}=(0,eg.useNewQuickTake)({onSuccess:t});return(0,a.jsx)(ey.default,{open:e,onClose:t,noPadding:!0,children:(0,a.jsxs)("div",{"data-component":"QuickTakePopover",className:"w-[750px] max-w-full",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mx-8 mt-6 mb-4",children:[(0,a.jsx)(N.default,{style:"sectionTitleLarge",children:"New quick take"}),(0,a.jsx)("button",{onClick:t,className:"cursor-pointer",children:(0,a.jsx)(ex.default,{className:"w-5"})})]}),(0,a.jsx)("form",{onSubmit:i,onKeyDown:o,className:"w-full",children:(0,a.jsxs)("div",{className:"flex flex-col gap-1 [&_.ck.ck-content]:min-h-[100px] w-full",children:[(0,a.jsx)(ev.default,{formType:"new",collectionName:"Comments",fieldName:"
2contents",placeholder:"Share exploratory, draft-stage, rough thoughts...",value:l,onChange:c,commentStyles:!0,commentEditor:!0,hideControls:!0,ref:r,className:"w-full grow px-8"}),(0,a.jsx)(ew.default,{...n,className:"px-8"}),(0,a.jsx)("hr",{className:"border-t-gray-200 my-4"}),(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2 mx-8 mb-6",children:[(0,a.jsx)(eb.default,{variant:"greyFilled",onClick:t,children:"Cancel"}),(0,a.jsx)(eb.default,{type:"submit",loading:s,children:"Publish"})]})]})})]})})}let ek=()=>(0,a.jsx)(eh.default,{className:"w-4 text-primary"});function eN({children:e}){let{currentUser:t}=(0,l.useCurrentUser)(),{theme:s,updateTheme:r}=(0,el.useTheme)(),[i,o]=(0,n.useState)(!1),c=(0,n.useCallback)(()=>(0,a.jsx)(ef.default,{user:t,size:24}),[t]),d=(0,n.useCallback)(()=>o(!0),[]),u=(0,n.useCallback)(()=>o(!1),[]),m=(0,n.useCallback)(async()=>{await g.rpc.users.logout(),ei.default.reset(),window.location.reload()},[]);return t?.displayName?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(et.default,{placement:"bottom-end",className:"w-[214px] max-w-full",items:[{title:t.displayName,Icon:c,href:(0,f.userGetProfileUrl)({user:t})},"divider",{title:"Write new",Icon:ec,submenu:[{title:"Post",href:"/newPost"},{title:"Question",href:"/newPost?question=true"},{title:"Quick take",onClick:d},"divider",{title:"Event",href:"/newPost?eventForm=true"},{title:"Sequence",href:"/sequencesnew"}]},{title:"Theme",Icon:ep,submenu:[{title:"Auto",onClick:r.bind(null,"auto"),afterNode:"auto"===s?(0,a.jsx)(ek,{}):void 0},{title:"Light",onClick:r.bind(null,"default"),afterNode:"default"===s?(0,a.jsx)(ek,{}):void 0},{title:"Dark",onClick:r.bind(null,"dark"),afterNode:"dark"===s?(0,a.jsx)(ek,{}):void 0}]},{title:"Saved & read",Icon:eu.default,href:"/saved"},{title:"Post stats",Icon:em.default,href:(0,f.userGetStatsUrl)(t)},{title:"Settings",Icon:ed,href:"/account"},...t.isAdmin?[{title:"Admin",Icon:eo,href:"/admin"}]:[],"divider",{title:"Logout",onClick:m}],children:(0,a.jsx)("div",{"data-component":"UserDropdownMenu",children:e})}),(0,a.jsx)(ej,{open:i,onClose:u})]}):null}e.i(167225);var eC=e.i(46306);class eS extends Error{policy;constructor(e,t){super(e||"Something went wrong"),this.policy=t}}class eE{async post(e,t){let a=await fetch(e,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}});if(200!==a.status){let e=await a.json(),t=e.error||e.description||e.error_description||"Something went wrong";throw"."===t[t.length-1]&&(t=t.slice(0,-1)),new eS(t,e.policy)}}async signup(e,t){await this.post("/api/auth/signup",{email:e,password:t})}googleLogin(){let e=encodeURIComponent(window.location.href);window.location.href=`/api/auth?returnTo=${e}&connection=google-oauth2`}getClientSettings(){return{domain:"login.effectivealtruism.org",clientId:"XB2eN03HX6mJjOWYBAsw4o3hRPnhfo5q",connection:"Username-Password-Authentication"}}async resetPassword(e){if(!e)throw new eS("Enter your email above to receive password reset instructions");let t=this.getClientSettings(),a=(0,eC.combineUrls)(`https://${t.domain}`,"/dbconnections/change_password");await this.post(a,{client_id:t.clientId,connection:t.connection,email:e})}}var eI=e.i(35592);let eP=({tree:e})=>(0,a.jsx)("ul",{children:e.map(({root:e,content:t})=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("li",{children:e}),(0,a.jsx)(eP,{tree:t})]}))});function eT({policy:e}){return e?(0,a.jsx)("div",{className:"text-left",children:(0,a.jsx)(eP,{tree:(e=>{let t=[],a=[t];for(let t of e.split("\n")){let e=t.search(/\S/),n=t.trim(),s=n.match(/(\*\s*)?(.*)/)?.[2]??n;if(s){let t=[];a[e].push({root:s,content:t}),a[++e]=t}}return t})(e)})}):null}let eA=n.forwardRef(function({title:e,titleId:t,...a},s){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},a),e?n.createElement("title",{id:t},e):null,n.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),n.createElement("path",{fillRule:"evenodd",d:"M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.
269.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 0 1 0-1.113ZM17.25 12a5.25 5.25 0 1 1-10.5 0 5.25 5.25 0 0 1 10.5 0Z",clipRule:"evenodd"}))}),e_=n.forwardRef(function({title:e,titleId:t,...a},s){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},a),e?n.createElement("title",{id:t},e):null,n.createElement("path",{d:"M3.53 2.47a.75.75 0 0 0-1.06 1.06l18 18a.75.75 0 1 0 1.06-1.06l-18-18ZM22.676 12.553a11.249 11.249 0 0 1-2.631 4.31l-3.099-3.099a5.25 5.25 0 0 0-6.71-6.71L7.759 4.577a11.217 11.217 0 0 1 4.242-.827c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113Z"}),n.createElement("path",{d:"M15.75 12c0 .18-.013.357-.037.53l-4.244-4.243A3.75 3.75 0 0 1 15.75 12ZM12.53 15.713l-4.243-4.244a3.75 3.75 0 0 0 4.244 4.243Z"}),n.createElement("path",{d:"M6.75 12c0-.619.107-1.213.304-1.764l-3.1-3.1a11.25 11.25 0 0 0-2.63 4.31c-.12.362-.12.752 0 1.114 1.489 4.467 5.704 7.69 10.675 7.69 1.5 0 2.933-.294 4.242-.827l-2.477-2.477A5.25 5.25 0 0 1 6.75 12Z"}))});function eO({value:e,onChange:t,testId:n,placeholder:s,name:r,autoFocus:l,secure:i,onToggleRevealed:o}){return(0,a.jsxs)("div",{className:`
3        flex items-center gap-3 w-full rounded bg-login-input px-[17px]
4      `,children:[(0,a.jsx)("input",{type:"hidden"===i?"password":"text",placeholder:s,name:r,value:e,onChange:t,"data-testid":n,autoFocus:l,className:`
5          grow py-[15px] text-gray-1000 text-[14px] font-sans font-[500]
6          placeholder:text-gray-600 outline-none
7        `}),i&&(0,a.jsx)("revealed"===i?e_:eA,{onClick:o,title:"Reveal password",className:"w-4 cursor-pointer text-gray-600"})]})}function eR(){let{loginAction:e,setLoginAction:r}=(0,s.useLoginPopoverContext)(),i=!!e,o="signup"===e,d=(t||(t=new eE),t),[u,m]=(0,n.useState)(""),[h,f]=(0,n.useState)(""),[x,w]=(0,n.useState)(!1),[y,b]=(0,n.useState)(!1),[j,k]=(0,n.useState)(null),[S,E]=(0,n.useState)(null),[I,P]=(0,n.useState)(null),[T,A]=(0,n.useTransition)(),{setCurrentUser:_}=(0,l.useCurrentUser)(),O=(0,n.useCallback)(e=>{m(e.target.value)},[]),R=(0,n.useCallback)(e=>{f(e.target.value)},[]),M=(0,n.useCallback)(()=>{w(e=>!e)},[]),L=(0,n.useCallback)(async()=>{A(async()=>{try{E(null),P(null),k(null),await d.resetPassword(u),k("Password reset email sent")}catch(t){console.error(t),(0,p.captureException)(t,{tags:{component:"EALoginPopover",action:e||"unknown"},extra:{email:u,isSignup:o,isResettingPassword:y}}),E(t.description||t.message||String(t)||"An error occurred")}})},[d,u,e,o,y]),U=(0,n.useCallback)(async()=>{k(null),E(null),P(null);let e=new URLSearchParams({client_id:"XB2eN03HX6mJjOWYBAsw4o3hRPnhfo5q",response_type:"code",scope:"openid profile email",redirect_uri:`${window.location.origin}/auth/auth0/callback-v2`,connection:"google-oauth2",state:btoa(JSON.stringify({returnTo:window.location.pathname+window.location.search}))});window.location.href=`https://login.effectivealtruism.org/authorize?${e}`},[]),H=(0,n.useCallback)(()=>{b(!0)},[]),z=(0,n.useCallback)(()=>{r("login")},[r]),D=(0,n.useCallback)(()=>{r("signup")},[r]),B=(0,n.useCallback)(()=>{r(null)},[r]);(0,n.useEffect)(()=>{i||(m(""),f(""),w(!1),k(null),E(null),P(null),b(!1))},[i]);let $=o?"Sign up to get more from the EA Forum":"Welcome back",F=!!u&&(!!h||y)&&!T;return(0,a.jsx)(ey.default,{open:i,onClose:B,background:"blurred",className:"w-[386px]",children:(0,a.jsx)(v.AnalyticsContext,{pageElementContext:"loginPopover",children:(0,a.jsxs)("div",{className:"w-full flex flex-col gap-6 items-center text-center relative","data-component":"LoginPopover",children:[(0,a.jsx)(ex.default,{onClick:B,className:"cursor-pointer w-[20px] text-gray-600 absolute right-0 top-0"}),(0,a.jsx)(eI.default,{className:"w-[52px] text-primary-dark"}),(0,a.jsx)(N.default,{className:"text-[24px] font-[600]",children:$}),(0,a.jsxs)("form",{action:t=>{A(async()=>{if(k(null),E(null),P(null),y)return L();let a=t.get("email"),n=t.get("password");if(!a||!n)return void E("Email and password are required");if("string"!=typeof a||"string"!=typeof n)return void E("Invalid field values");try{let e=await g.rpc.users.login({email:a,password:n,isSignup:o});e?.redirect?window.location.href=e.redirect:e?.ok&&e?.currentUser?_(e.currentUser):(console.error("Login error:",e),E(e?.error??"Something went wrong"))}catch(t){console.error(t),(0,p.captureException)(t,{tags:{component:"EALoginPopover",action:e||"unknown"},extra:{email:a,isSignup:o,isResettingPassword:y}}),E(t.description||t.message||String(t)||"An error occurred"),P(t.policy??null)}})},className:"flex flex-col gap-2 w-full",children:[(0,a.jsx)(eO,{value:u,onChange:O,placeholder:"Email",n
7ame:"email",testId:"login-email-input",autoFocus:!0}),(0,a.jsx)(eO,{value:h,onChange:R,placeholder:"Password",name:"password",testId:"login-password-input",secure:x?"revealed":"hidden",onToggleRevealed:M}),!o&&!y&&(0,a.jsx)(N.default,{className:"mt-1 mb-2 font-[600] text-primary",children:(0,a.jsx)("a",{className:"cursor-pointer",onClick:H,children:"Forgot password?"})}),j&&(0,a.jsx)(N.default,{className:"mb-1",children:j}),S&&(0,a.jsxs)(N.default,{className:"mb-4 text-red-500",children:[S,I&&(0,a.jsx)(eT,{policy:I})]}),(0,a.jsx)(eb.default,{type:"submit",loading:T,disabled:!F,testId:"login-submit",className:"w-full h-[50px] px-[17px] py-[15px] font-[600]",children:y?"Request password reset":o?"Sign up":"Login"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 w-full text-gray-600",children:[(0,a.jsx)("span",{className:"grow border-t border-gray-600"}),(0,a.jsx)(N.default,{As:"span",style:"bodySmall",children:"OR"}),(0,a.jsx)("span",{className:"grow border-t border-gray-600"})]}),(0,a.jsxs)(eb.default,{variant:"greyOutlined",onClick:U,className:" w-full h-[50px] p-4 font-[600] flex gap-2 items-center justify-center ",children:[(0,a.jsx)(c.default,{src:"/googleLogo.png",alt:"Continue with google",width:20,height:20,className:"w-5 h-5"}),"Continue with Google"]}),o?(0,a.jsxs)(N.default,{children:["Already have an account?"," ",(0,a.jsx)("a",{onClick:z,className:" text-primary hover:text-primary-dark font-[700] cursor-pointer select-none ",children:"Login"})]}):(0,a.jsxs)(N.default,{children:["Don't have an account?"," ",(0,a.jsx)("a",{onClick:D,className:" text-primary hover:text-primary-dark font-[700] cursor-pointer select-none ",children:"Sign up"})]}),o&&(0,a.jsxs)(N.default,{style:"bodySmall",className:"color-gray-600 mt-2",children:["By creating an EA Forum account, you agree to the"," ",(0,a.jsx)(C.default,{openInNewTab:!0,href:"/termsOfUse",className:"underline hover:no-underline",children:"Terms of Use"})," ","and"," ",(0,a.jsx)(C.default,{openInNewTab:!0,href:"/privacyPolicy",className:"underline hover:no-underline",children:"Privacy Policy"}),"."]})]})})})}var eM=e.i(618566),eL=e.i(912822);function eU({href:e,Icon:t,leading:n,selected:s,children:r}){return(0,a.jsxs)(N.default,{style:"bodySmall",className:(0,o.default)("py-1 px-2 rounded flex text-gray-600","hover:bg-surface-floating-hover hover:text-gray-800",s&&"bg-surface-floating-hover text-gray-800"),children:[n??(t?(0,a.jsx)(t,{className:"w-5 shrink-0 self-start ml-1 mr-3 mt-0.5"}):null),(0,a.jsx)(C.default,{href:e,className:"block grow min-w-0 break-words",children:r})]})}function eH({user:e,selected:t}){return(0,a.jsx)(eU,{selected:t,href:(0,f.userGetProfileUrl)({user:e,from:"search_autocomplete"}),leading:(0,a.jsx)("span",{className:"flex items-center ml-1 mr-3",children:(0,a.jsx)(ef.default,{user:e,size:20})}),children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("span",{children:e.displayName}),(0,a.jsx)(X.default,{textStyle:"bodySmall",As:"span",time:e.createdAt}),(0,a.jsxs)("span",{children:[e.karma," karma"]})]})})}let ez=n.forwardRef(function({title:e,titleId:t,...a},s){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},a),e?n.createElement("title",{id:t},e):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"}))});function eD({post:e,selected:t}){return(0,a.jsx)(eU,{selected:t,href:(0,I.postGetPageUrl)({post:e}),Icon:ez,children:(0,a.jsxs)("div",{children:[(0,a.jsx)(N.default,{style:"postTitle",className:"text-gray-800",children:e.title}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("span",{children:e.authorDisplayName}),(0,a.jsx)(X.default,{textStyle:"bodySmall",As:"span",time:e.postedAt}),(0,a.jsxs)("span",{children:[e.baseScore," karma"]})]}),(0,a.jsx)("div",{className:"line-clamp-2",children:e.body})]})})}var eB=e.i(844806);function e$({tag:e,selected:t}){return(0,a.jsx)(eU,{selected:t,href:(0,P.tagGetPageUrl)({tag:e,from:"search_autocomplete"}),Icon:eB.default,children:(0,a.jsxs)("div",{children:[(0,a.jsx)(N.default,{style:"postTitle",className:"text-gray-800",children:e.name}),(0,a.jsx)("div",{className:"line-clamp-2",children:e.description})]})})}var eF=e.i(27175);function eq({comment:e,selected:t}){return(0,a.jsx)(eU,{selected:t,href:(0,E.commentGetPageUrlFromIds)({commentId:e._id,postId:e.postId,postSlug:e.postSlug,tagSlug:e.tagSlug,tagCommentType:e.tagCommentType}),Icon:eF.default,children:(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("span",{children:e.authorDisplayName}),(0,a.jsx)(X.default,{textStyle:"bodySmall",As:"span",time:e.postedAt}),(0,a.jsxs)("span",{children:[e.baseScore," karma"]})]}),(0,a.jsx)("div",{className:"line-clamp-2",children:e.body})]})})}let eY=n.forwardRef(function({title:e,titleId:t,...a},s){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},a),e?n.createElement("title",{id:t},e):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6.042A8.967 8.967 0 0 0 6 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 0 1 6 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 0 1 6-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0 0 18 18a8.967 8.967 0 0 0-6 2.292m0-14.25v14.25"}))});function eV({sequence:e,selected:t}){return(0,a.jsx)(eU,{selected:t,href:(0,Y.sequenceGetPageUrl)({sequence:e}),Icon:eY,children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(N.default,{style:"postTitle",className:"text-gray-800",children:e.title}),(0,a.jsx)("span",{children:e.authorDisplayName}),(0,a.jsx)(X.default,{textStyle:"bodySmall",As:"span",time:e.createdAt})]})})}let eZ=["users","posts","tags","comments","sequences"];function eK({onClose:e}){let t=(0,eM.usePathname)(),s=(0,eM.useRouter)(),r=(0,eL.getSearchClient)(),[l,i]=(0,n.use
7State)(""),[c,d]=(0,n.useState)(!1),[m,h]=(0,n.useState)({}),[p,f]=(0,n.useState)(-1),g=(0,n.useRef)(null),x=(0,n.useRef)(null),w=(0,n.useRef)(0),v=(0,n.useRef)(null);(0,n.useEffect)(()=>{i(""),f(-1)},[t]);let y=(0,n.useCallback)(e=>{let t=e.target.value;d(!0),i(t),h({}),f(-1);let a=++w.current;(async()=>{let e=await r.search(eZ.map(e=>({indexName:e,query:t,params:{query:t,hitsPerPage:3,page:0}})));if(a===w.current){let t={};for(let a=0;a<eZ.length;a++){let n=eZ[a],s=e[a].hits;s.length&&(t[n]=s)}d(!1),h(t)}})()},[r]);(0,n.useEffect)(()=>{g.current?.focus()},[]);let b=!!Object.values(m).flat().length,j=m.users?.length??0,k=m.posts?.length??0,S=m.tags?.length??0,E=m.comments?.length??0,I=m.sequences?.length??0,P=j+k,T=P+S,A=T+E,_=A+I,O=(0,n.useCallback)(e=>x.current?.querySelectorAll("a")[e],[]);(0,n.useEffect)(()=>{p<0||O(p)?.scrollIntoView({block:"nearest"})},[p,O]);let M=(0,n.useCallback)(t=>{"Escape"===t.key?e():l&&("ArrowDown"===t.key?(t.preventDefault(),b&&f(e=>Math.min(e+1,_))):"ArrowUp"===t.key?(t.preventDefault(),f(e=>Math.max(e-1,-1))):"Enter"===t.key&&(t.preventDefault(),b&&p>=0?O(p)?.click():s.push(`/search?query=${encodeURIComponent(l)}`),e()))},[l,b,p,_,s,e,O]),L=(0,n.useCallback)(e=>{let t=v.current,a=!t||t.x!==e.clientX||t.y!==e.clientY;v.current={x:e.clientX,y:e.clientY},a&&f(e=>-1===e?e:-1)},[]);return(0,a.jsxs)("div",{"data-component":"HeaderSearch",className:"flex gap-2 items-center",children:[(0,a.jsx)(u,{className:"w-[24px] text-gray-600"}),(0,a.jsx)("input",{value:l,onChange:y,onKeyDown:M,ref:g,placeholder:"Search here...",className:" w-[100px] sm:w-[160px] md:w-[220px] outline-none font-sans text-[14px] "}),(0,a.jsx)("button",{onClick:e,className:"cursor-pointer p-2 rounded hover:bg-item-hover",children:(0,a.jsx)(ex.default,{className:"w-[20px] text-gray-600"})}),l&&(0,a.jsxs)("div",{className:" absolute top-[70px] right-0 w-[440px] max-w-full bg-surface-floating shadow ",children:[c&&(0,a.jsx)("div",{className:"w-full flex justify-center py-6",children:(0,a.jsx)(R.default,{})}),b&&!c&&(0,a.jsxs)("div",{ref:x,onMouseMove:L,className:" flex flex-col gap-[1px] bg-gray-300 overflow-y-auto overflow-x-hidden overscroll-contain max-h-[calc(100vh-70px)] [&>*]:bg-surface-floating [&>*]:p-2 ",children:[m.users&&m.users.length>0&&(0,a.jsx)("div",{children:m.users.map((e,t)=>(0,a.jsx)(eH,{user:e,selected:p===t},e._id))}),m.posts&&m.posts.length>0&&(0,a.jsx)("div",{children:m.posts.map((e,t)=>(0,a.jsx)(eD,{post:e,selected:p===j+t},e._id))}),m.tags&&m.tags.length>0&&(0,a.jsx)("div",{children:m.tags.map((e,t)=>(0,a.jsx)(e$,{tag:e,selected:p===P+t},e._id))}),m.comments&&m.comments.length>0&&(0,a.jsx)("div",{children:m.comments.map((e,t)=>(0,a.jsx)(eq,{comment:e,selected:p===T+t},e._id))}),m.sequences&&m.sequences.length>0&&(0,a.jsx)("div",{children:m.sequences.map((e,t)=>(0,a.jsx)(eV,{sequence:e,selected:p===A+t},e._id))}),(0,a.jsx)(N.default,{style:"bodyMedium",className:(0,o.default)("flex justify-center rounded",p===_&&"bg-surface-floating-hover"),children:(0,a.jsx)(C.default,{href:`/search?query=${encodeURIComponent(l)}`,className:"text-primary font-[600] hover:opacity-60",children:"See all results"})})]}),!b&&!c&&(0,a.jsx)("div",{className:"w-full flex justify-center py-6",children:(0,a.jsx)(N.default,{style:"sectionTitleSmall",children:"No results"})})]})]})}var eG=n;let eW=()=>{},eJ=(e,t)=>{if(Object.is(e,t))return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;let a=Object.keys(e),n=Object.keys(t);if(a.length!==n.length)return!1;let s=Object.prototype.hasOwnProperty.bind(t);for(let n=0;n<a.length;n++){let r=a[n];if(!s(r)||!Object.is(e[r],t[r]))return!1}return!0};class eX extends eG.Component{static defaultProps={parent:()=>window,disableInlineStyles:!1,disable:!1,upTolerance:5,downTolerance:0,onPin:eW,onUnpin:eW,onUnfix:eW,wrapperStyle:{},pinStart:0,calcHeightOnResize:!0};currentScrollY;lastKnownScrollY;scrollTicking;resizeTicking;inner;static getDerivedStateFromProps(e,t){return e.disable&&"unfixed"!==t.state?{translateY:0,className:"headroom headroom--unfixed headroom-disable-animation",animation:!1,state:"unfixed"}:null}constructor(e){super(e),this.currentScrollY=0,this.lastKnownScrollY=0,this.scrollTicking=!1,this.resizeTicking=!1,this.state={state:"unfixed",translateY:0,className:"headroom headroom--unfixed",height:e.height}}componentDidMount(){this.setHeightOffset(),!this.props.disable&&(this.props.parent().addEventListener("scroll",this.handleScroll),this.props.calcHeightOnResize&&this.props.parent().addEventListener("resize",this.handleResize))}shouldComponentUpdate(e,t){return!eJ(this.props,e)||!eJ(this.state,t)}componentDidUpdate(e,t){e.children!==this.props.children&&this.setHeightOffset(),!e.disable&&this.props.disable?(this.props.parent().removeEventListener("scroll",this.handleScroll),this.props.parent().removeEventListener("resize",this.handleResize),"unfixed"!==t.state&&"unfixed"===this.state.state&&this.props.onUnfix()):e.disable&&!this.props.disable&&(this.props.parent().addEventListener("scroll",this.handleScroll),this.props.calcHeightOnResize&&this.props.parent().addEventListener("resize",this.handleResize))}componentWillUnmount(){this.props.parent().removeEventListener("scroll",this.handleScroll),window.removeEventListener("scroll",this.handleScroll),this.props.parent().removeEventListener("resize",this.handleResize)}setRef=e=>this.inner=e;setHeightOffset=()=>{this.resizeTicking=!1};getScrollY=()=>{let e=this.props.parent();return"pageYOffset"in e&&void 0!==e.pageYOffset?e.pageYOffset:"scrollTop"in e&&void 0!==e.scrollTop?e.scrollTop:(document.documentElement||document.body.parentNode||document.body).scrollTop};
7getViewportHeight=()=>window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;getDocumentHeight=()=>{let e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,t.scrollHeight,e.offsetHeight,t.offsetHeight,e.clientHeight,t.clientHeight)};getElementPhysicalHeight=e=>Math.max(e.offsetHeight,e.clientHeight);getElementHeight=e=>Math.max(e.scrollHeight,e.offsetHeight,e.clientHeight);getScrollerPhysicalHeight=()=>{let e=this.props.parent();return e===window||e===document.body?this.getViewportHeight():this.getElementPhysicalHeight(e)};getScrollerHeight=()=>{let e=this.props.parent();return e===window||e===document.body?this.getDocumentHeight():this.getElementHeight(e)};isOutOfBound=e=>{let t=this.getScrollerPhysicalHeight(),a=this.getScrollerHeight();return e<0||e+t>a};handleScroll=()=>{this.scrollTicking||(this.scrollTicking=!0,requestAnimationFrame(this.update))};handleResize=()=>{this.resizeTicking||(this.resizeTicking=!0,requestAnimationFrame(this.setHeightOffset))};unpin=()=>{this.props.onUnpin(),this.setState({translateY:"-100%",className:"headroom headroom--unpinned",animation:!0,state:"unpinned"})};unpinSnap=()=>{this.props.onUnpin(),this.setState({translateY:"-100%",className:"headroom headroom--unpinned headroom-disable-animation",animation:!1,state:"unpinned"})};pin=()=>{this.props.onPin(),this.setState({translateY:0,className:"headroom headroom--pinned",animation:!0,state:"pinned"})};unfix=()=>{this.props.onUnfix(),this.setState({translateY:0,className:"headroom headroom--unfixed headroom-disable-animation",animation:!1,state:"unfixed"})};update=()=>{if(this.currentScrollY=this.getScrollY(),!this.isOutOfBound(this.currentScrollY)){let{action:e}=((e=0,t=0,a={},n={})=>{let s=t>=e?"down":"up",r=Math.abs(t-e);if(a.disable)return{action:"none",scrollDirection:s,distanceScrolled:r};if(t<=a.pinStart&&"unfixed"!==n.state)return{action:"unfix",scrollDirection:s,distanceScrolled:r};if(t<=n.height&&"down"===s&&"unfixed"===n.state)return{action:"none",scrollDirection:s,distanceScrolled:r};if(t>n.height+a.pinStart&&"down"===s&&"unfixed"===n.state)return{action:"unpin-snap",scrollDirection:s,distanceScrolled:r};if("down"===s&&["pinned","unfixed"].indexOf(n.state)>=0&&t>n.height+a.pinStart&&r>a.downTolerance)return{action:"unpin",scrollDirection:s,distanceScrolled:r};else if("up"===s&&r>a.upTolerance&&0>["pinned","unfixed"].indexOf(n.state))return{action:"pin",scrollDirection:s,distanceScrolled:r};else if("up"===s&&t<=n.height&&0>["pinned","unfixed"].indexOf(n.state))return{action:"pin",scrollDirection:s,distanceScrolled:r};else return{action:"none",scrollDirection:s,distanceScrolled:r}})(this.lastKnownScrollY,this.currentScrollY,this.props,this.state);"pin"===e?this.pin():"unpin"===e?this.unpin():"unpin-snap"===e?this.unpinSnap():"unfix"===e&&this.unfix()}this.lastKnownScrollY=this.currentScrollY,this.scrollTicking=!1};render(){let{className:e,...t}=this.props;delete t.onUnpin,delete t.onPin,delete t.onUnfix,delete t.disableInlineStyles,delete t.disable,delete t.parent,delete t.children,delete t.height,delete t.upTolerance,delete t.downTolerance,delete t.pinStart,delete t.calcHeightOnResize;let{style:n,wrapperStyle:s,...r}=t,l={position:this.props.disable||"unfixed"===this.state.state?"relative":"fixed",top:0,left:0,right:0,zIndex:1,WebkitTransform:`translate3D(0, ${this.state.translateY}, 0)`,msTransform:`translate3D(0, ${this.state.translateY}, 0)`,transform:`translate3D(0, ${this.state.translateY}, 0)`},i=this.state.className;this.state.animation&&(l={...l,WebkitTransition:"all .2s ease-in-out",MozTransition:"all .2s ease-in-out",OTransition:"all .2s ease-in-out",transition:"all .2s ease-in-out"},i+=" headroom--scrolled"),l=this.props.disableInlineStyles?n:{...l,...n};let o={...s,height:this.state.height?this.state.height:null},c=e?`${e} headroom-wrapper`:"headroom-wrapper";return(0,a.jsx)("div",{style:o,className:c,"data-component":"Headroom",children:(0,a.jsx)("div",{ref:this.setRef,...r,style:l,className:i,children:this.props.children})})}}function eQ({stayAtTop:e}
7){let[t,p]=(0,n.useState)(!0),f=(0,n.useCallback)(()=>p(!0),[]),g=(0,n.useCallback)(()=>p(!1),[]),{onLogin:x,onSignup:w}=(0,s.useLoginPopoverContext)(),{openMobileNav:v,showMobileNavOnDesktop:y}=(0,i.useMobileNav)(),{currentUser:b}=(0,l.useCurrentUser)(),[j,k]=(0,n.useState)(!1),S=(0,n.useCallback)(()=>k(e=>!e),[]);return(0,a.jsx)("div",{className:"w-full","data-component":"Header",children:(0,a.jsx)(eX,{disableInlineStyles:!0,downTolerance:10,upTolerance:10,height:66,onUnfix:f,onUnpin:g,disable:e,className:"headroom-root",children:(0,a.jsx)("header",{className:(0,o.default)("static bg-gray-50 shadow-xs text-gray-1000 w-full","h-[66px]"),children:(0,a.jsxs)("nav",{className:"w-full mx-auto h-full px-2 sm:px-5 flex items-center",children:[(0,a.jsx)("button",{"aria-label":"Toggle navigation menu",onClick:v,className:(0,o.default)("cursor-pointer hover:bg-item-hover p-1.5 rounded",!y&&"mobile-nav:hidden"),children:(0,a.jsx)(d,{className:"w-6"})}),(0,a.jsx)(N.default,{style:"logo",className:"grow flex items-center",children:(0,a.jsxs)(C.default,{href:"/",className:"inline-flex items-center gap-1",children:[(0,a.jsx)(c.default,{src:(0,r.getSiteLogoUrl)(100),alt:"Effective Altruism Forum",width:34,height:34}),(0,a.jsxs)("span",{className:"translate-y-px",children:[(0,a.jsx)("span",{className:"hidden md:inline",children:"Effective Altruism Forum"}),(0,a.jsx)("span",{className:"max-[330px]:hidden md:hidden inline",children:"EA Forum"})]})]})}),(0,a.jsxs)("div",{className:"flex gap-2 items-center",children:[j?(0,a.jsx)(eK,{onClose:S}):(0,a.jsx)(es,{Icon:u,description:"Search",onClick:S}),b?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(er,{}),(0,a.jsx)(C.default,{href:"/inbox",className:"hover:opacity-100!",children:(0,a.jsx)(es,{Icon:m.default,description:"Messages"})}),(0,a.jsx)(eN,{children:(0,a.jsxs)("button",{className:" cursor-pointer hover:bg-item-hover rounded h-9 px-1.5 flex items-center gap-1 ",children:[(0,a.jsx)(ef.default,{user:b,size:32}),(0,a.jsx)(h.default,{className:"w-[16px] text-gray-600"})]})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eb.default,{variant:"greyFilled",onClick:x,children:"Login"}),(0,a.jsx)(eb.default,{variant:"primaryFilled",onClick:w,className:"max-sm:hidden",children:"Sign up"}),(0,a.jsx)(eR,{})]})]})]})})})})}e.s(["default",()=>eQ],316371)},414277,e=>{"use strict";var t=e.i(843476),a=e.i(271645),n=e.i(618566),s=e.i(155727),r=e.i(207670),l=e.i(767614);function i(){let e=(0,n.usePathname)(),i=(0,n.useSearchParams)(),{isMobileNavOpen:o,closeMobileNav:c}=(0,s.useMobileNav)();return(0,a.useEffect)(()=>{if(!o)return;let e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[o]),(0,a.useEffect)(()=>{if(o){let e=e=>{"Escape"===e.key&&c()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}},[o,c]),(0,a.useEffect)(()=>{c()},[c,e,i]),(0,t.jsxs)("div",{"data-component":"MobileNav",className:(0,r.default)("fixed inset-0 z-(--zindex-mobile-nav) w-full h-screen",o?"pointer-events-auto":"pointer-events-none"),children:[(0,t.jsx)("div",{onClick:c,className:(0,r.default)("absolute w-full h-full inset-0 bg-popover-dim","transition-opacity duration-300",o?"opacity-100":"opacity-0")}),(0,t.jsx)("div",{role:"dialog","aria-modal":"true",className:(0,r.default)("absolute top-0 left-0 h-full w-[280px] max-w-full","bg-gray-0 shadow-lg px-6 py-4","transform transition-transform duration-300 ease-out",o?"translate-x-0":"-translate-x-full"),children:(0,t.jsx)(l.default,{})})]})}e.s(["default",()=>i],414277)},215858,e=>{"use strict";var t=e.i(271645),a=e.i(999769),n=e.i(904540),s=e.i(209840);function r(){let{boot:e,hardShutdown:r}=(0,a.useIntercom)(),{currentUser:l}=(0,s.useCurrentUser)(),{cookiePreferences:i}=(0,n.useCookiePreferences)(),o=i.includes("functional");return(0,t.useLayoutEffect)(()=>{if(!o){console.log("Not showing Intercom because functional cookies are not allowed"),r();return}let t={zIndex:100};l&&!l.hideIntercom?e({...t,userId:l._id,email:l.email??void 0,name:l.displayName}):l?r():e(t)},[l,o,"xycbzvda",e,r]),null}e.s(["default",()=>r])},195981,e=>{"use strict";var t=e.i(271645),a=e.i(618566);e.i(843476);var n=e.i(154727),s=e.i(31980),r=e.i(352448);e.i(167225);var l=e.i(870202),i=e.i(269823);let o=null;function c(){let{captureEvent:e}=(0,n.useTracking)(),c=(0,a.usePathname)(),d=(0,a.useSearchParams)(),u=`${c}${d.toString()?`?${d}`:""}`;return(0,t.useEffect)(()=>{let t;if(!document.cookie.split("; ").find(e=>e.startsWith(r.CLIENT_ID_COOKIE))){let e=(0,i.randomId)();document.cookie=`${r.CLIENT_ID_COOKIE}
7=${e}; path=/; max-age=315360000`}window.tabId||(window.tabId=(0,i.randomId)()),function(e,t,a,n,s){if(e[n]=e[n]||[],e[n]?.[0]?.["gtm.start"])return console.warn("googleTagManagerInit has already run, aborting");e[n].push({"gtm.start":new Date().getTime(),event:"gtm.js"});let r=t.getElementsByTagName(a)[0],l=t.createElement(a);l.async=!0,l.src="https://www.googletagmanager.com/gtm.js?id="+s,r.parentNode.insertBefore(l,r)}(window,document,"script","dataLayer","GTM-5VK8D73"),(0,l.initRecaptcha)();let a=new URLSearchParams(document.location?.search);e("pageLoadFinished",{url:document.location?.href,referrer:document.referrer,utmSource:a.get("utm_source"),utmMedium:a.get("utm_medium"),utmCampaign:a.get("utm_campaign"),utmContent:a.get("utm_content"),utmTerm:a.get("utm_term"),utmUserId:a.get("utm_user_id"),browserProps:(0,s.getBrowserProperties)(),prefersDarkMode:(t=s.isClient&&"matchMedia"in window?window.matchMedia("(prefers-color-scheme: dark)"):{matches:!1,addEventListener:()=>{},removeEventListener:()=>{}},t?.matches??!1),performance:{memory:window.performance?.memory?.usedJSHeapSize,timeOrigin:window.performance?.timeOrigin,timing:window.performance?.timing?.toJSON?.()}})},[]),(0,t.useEffect)(()=>{u!==o&&(o&&e("navigate",{from:o,to:u}),o=u)},[u]),null}e.s(["default",()=>c],195981)},292937,e=>{"use strict";let t=(0,e.i(770703).default)(()=>e.A(838630),{loadableGenerated:{modules:[502982]},ssr:!1});e.s(["default",0,t])},925358,e=>{"use strict";var t=e.i(271645),a=e.i(87941),n=e.i(154727),s=e.i(31980);function r(){(()=>{let{captureEvent:e}=(0,n.useTracking)();(0,t.useEffect)(()=>{let t=()=>{e("beforeUnloadFired"),(0,a.flushClientEvents)(!0)};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[e])})();let{pageIsVisible:e}=(()=>{let{captureEvent:e}=(0,n.useTracking)(),a=s.isClient?document:null,[r,l]=(0,t.useState)(!a?.hidden),[i,o]=(0,t.useState)(a?.visibilityState);return(0,t.useEffect)(()=>{i&&e("pageVisibilityChange",{isVisible:r,visibilityState:i})},[]),(0,t.useEffect)(()=>{if(!a)return;let t=()=>{let t=!a.hidden,n=a.visibilityState;l(t),o(n),e("pageVisibilityChange",{isVisible:t,visibilityState:n})};return window.addEventListener("visibilitychange",t),()=>window.addEventListener("visibilitychange",t)},[a,e]),{pageIsVisible:r,pageVisibilityState:i}})(),{userIsIdle:r}=((e=60)=>{let{captureEvent:a}=(0,n.useTracking)(),[s,r]=(0,t.useState)(!1),l=(0,t.useRef)(null),i=(0,t.useCallback)(()=>{a("idlenessDetection",{state:"inactive"}),r(!0)},[a,r]),o=(0,t.useCallback)(()=>{r(!1),clearTimeout(l.current),l.current=setTimeout(i,1e3*e),s&&a("idlenessDetection",{state:"active"})},[s,r,a,i,e]);return(0,t.useEffect)(()=>{let e=["mousemove","keypress","scroll"];for(let t in e)window.addEventListener(t,o);return()=>{for(let t in e)window.removeEventListener(t,o)}},[o]),(0,t.useEffect)(()=>(o(),()=>clearTimeout(l.current)),[]),{userIsIdle:s}})(60),{setTimerIsActive:l}=((e=[10,30],a=60)=>{let{captureEvent:s}=(0,n.useTracking)(),[r,l]=(0,t.useState)(0),[i,o]=(0,t.useState)(!0),[c,d]=e,u=(0,t.useRef)(null),m=(0,t.useCallback)(()=>{l(0),o(!1)},[]);return(0,t.useEffect)(()=>{if(i){let e=r<a?c:d;u.current=setInterval(()=>{l(r+e),s("timerEvent",{seconds:r+e,increment:e})},1e3*e)}else i||0===r||clearInterval(u.current);return()=>clearInterval(u.current)},[i,o,r,s,c,d,a]),{seconds:r,isActive:i,setTimerIsActive:o,reset:m}})([10,30],60);return(0,t.useEffect)(()=>
7{l(e&&!r)},[e,r,l]),null}e.s(["default",()=>r])},348e3,e=>{"use strict";var t=e.i(843476),a=e.i(271645),n=e.i(174080),s=e.i(209840),r=e.i(72262),l=e.i(270435);let i="prefer_ea_forum_v3";var o=e.i(312348),c=e.i(705766),d=e.i(607383);function u(){let[e,u]=(0,a.useState)(!1),{showNewSiteToggle:m,preferNewSite:h,setPreferNewSite:p}=(()=>{let{currentUser:e}=(0,s.useCurrentUser)(),[t,n]=(0,r.useCookiesWithConsent)([i]),o=(0,l.userIsRealAdmin)(e)||(0,l.userIsAdminOrMod)(e),c=t[i];return{showNewSiteToggle:o,preferNewSite:"true"===c||!0===c,setPreferNewSite:(0,a.useCallback)(e=>{let t=new Date;t.setFullYear(t.getFullYear()+1),n(i,e?"true":"false",{path:"/",expires:t}),window.location.reload()},[n])}})(),{showAdminToggle:f,isAdmin:g,setAdmin:x}=(()=>{let{currentUser:e}=(0,s.useCurrentUser)(),[t,n]=(0,a.useState)(!!e?.isAdmin);return{showAdminToggle:(0,l.userIsRealAdmin)(e),isAdmin:t,setAdmin:(0,a.useCallback)(async()=>{let e=c.default.loading("Toggling admin powers...");try{n(e=>!e),await o.rpc.users.toggleAdmin(),window.location.reload()}catch(e){n(e=>!e),console.error(e),c.default.error(e instanceof Error?e.message:"Something went wrong")}finally{c.default.dismiss(e)}},[])}})();(0,a.useEffect)(()=>{u(!0)},[]);let w=m||f;return e&&w?(0,n.createPortal)((0,t.jsxs)("div",{"data-component":"SiteToggle",className:" fixed left-5 bottom-5 z-(--zindex-site-toggle) bg-gray-200/90 rounded-lg shadow p-3 flex flex-col gap-2.5 font-sans text-[13px] max-sm:hidden print:hidden ",children:[f&&(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsxs)("span",{className:"font-medium text-gray-900",children:["Admin ",g?"on":"off"]}),(0,t.jsx)(d.default,{value:g,setValue:x})]}),m&&(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("span",{className:"font-medium text-gray-900",children:"Prefer new site"}),(0,t.jsx)(d.default,{value:h,setValue:p})]})]}),document.body):null}e.s(["default",()=>u],348e3)}]);
8
9//# debugId=6fe8c2cf-9955-b4b5-d601-e8b5b6cbccc9

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.