1!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b85b601b-7320-48b7-9d45-f980176a0092",e._sentryDebugIdIdentifier="sentry-dbid-b85b601b-7320-48b7-9d45-f980176a0092")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6538],{29308:(e,t,r)=>{"use strict";r.d(t,{default:()=>g,y:()=>p});var n=r(95155),s=r(12115),i=r(47536),o=r(2190),u=r(35837),a=r(71444);function c(e){if(!e)return"";let t="";for(let r of new Uint8Array(e))t+=String.fromCharCode(r);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function l(e){return`chat:lastSeenId:${e}`}function d(e){try{let t=sessionStorage.getItem(l(e));if(null===t)return null;let r=Number.parseInt(t,10);return Number.isFinite(r)?r:null}catch{return null}}let f=(0,s.createContext)(null);function p(){let e=(0,s.useContext)(f);if(!e)throw Error("useChatSession must be used within ChatSessionProvider");return e}function g({children:e}){let{loggedInEnv:t}=(0,i.ck)(),r=t?.loggedInUser._userView_header._userHeader_id??null,[p,m]=(0,s.useState)(!1),[h,v]=(0,s.useState)(!0),[b,w]=(0,s.useState)(0),_=(0,s.useRef)(null),y=(0,s.useRef)(new Map),C=(0,s.useRef)(new Set),I=(0,s.useRef)(new Set);(0,s.useEffect)(()=>{if(!r)return;let e=!1;return(async()=>{try{let t=await (0,o.U)(r);if(e)return;_.current=t,m(!0)}catch(e){console.error("Failed to initialize chat service:",e)}})(),()=>{e=!0}},[r]),(0,s.useEffect)(()=>{if(!p)return;let e=_.current;if(!e)return;let t=e.getDeviceId();!t||"serviceWorker"in navigator&&"PushManager"in window&&(async()=>{try{let e=await navigator.serviceWorker.ready,r=await e.pushManager.getSubscription();if(!r)return;let n=u.O.getClientApiClient((0,a.i)());await n.requestResult("/user/push-notifications/subscribe","post",{_pushSubscriptionInfo_endpoint:r.endpoint,_pushSubscriptionInfo_p256dh:c(r.getKey("p256dh")),_pushSubscriptionInfo_auth:c(r.getKey("auth")),_pushSubscriptionInfo_deviceId:t})}catch{}})()},[p]),(0,s.useEffect)(()=>{if(!p)return;let e=_.current;if(!e)return;let t=e.getDeviceId();if(!t)return;let r=!1,n=e=>{var r=e.message._messageView_id;let n=d(t);if(null===n||!(r<=n))try{sessionStorage.setItem(l(t),String(r))}catch{}let s=y.current.get(e.conversationId);if(s)for(let t of s)t(e);for(let t of C.current)t(e)};(async()=>{let e=d(t);if(null===e)return;let s=u.O.getClientApiClient((0,a.i)()),i=e;for(;!r;){let e=await s.requestResult("/user/chat/missed-messages","get",void 0,{deviceId:t,sinceId:String(i),limit:String(200)});if(r)return;if(!e.success)return void console.error("Failed to drain missed messages:",e.error);let{_missedMessagesResult_messages:o,_missedMessagesResult_hasMore:u}=e.data;for(let e of o)n({kind:"message",conversationId:e._messageView_conversationId,message:e});let a=o.at(-1);if(!u||!a)return;i=a._messageView_id}})();let{apiBaseUrl:s}=(0,a.i)(),i=new EventSource(`${s}/user/chat/sse?deviceId=${encodeURIComponent(t)}`,{withCredentials:!0});return i.onopen=()=>{v(!0),w(0)},i.onerror=()=>{v(!1),w(e=>e+1)},i.onmessage=e=>{try{let t=JSON.parse(e.data);switch(t.kind){case"message":n(t);return;case"participantAdded":case"participantRemoved":case"participantLeft":case"groupRenamed":for(let e of I.current)e(t);return;default:return}}catch(e){console.warn("Chat SSE: malformed event",e)}},()=>{r=!0,i.close()}},[p]);let S=(0,s.useCallback)((e,t)=>{let r=y.current,n=r.get(e);return n||(n=new Set,r.set(e,n)),n.add(t),()=>{let n=r.get(e);n&&(n.delete(t),0===n.size&&r.delete(e))}},[]),k=(0,s.useCallback)(e=>(C.current.add(e),()=>{C.current.delete(e)}),[]),E=(0,s.useCallback)(e=>(I.current.add(e),()=>{I.current.delete(e)}),[]),R=(0,s.useMemo)(()=>({service:_.current,serviceReady:p,sseConnected:h,sseFailures:b,subscribe:S,subscribeAllMessages:k,subscribeLifecycle:E}),[p,h,b,S,k,E]);return(0,n.jsx)(f.Provider,{value:R,children:e})}},47536:(e,t,r)=>{"use strict";r.d(t,{DB:()=>d,EnvProvider:()=>c,Gn:()=>a,ck:()=>l});var n=r(95155),s=r(12115),i=r(72859);let o=(0,s.createContext)(void 0),u=new Set;function a(e){(0,s.useEffect)(()=>(u.add(e),()=>{u.delete(e)}),[e])}function c({currentEnv:e,children:t}
1){let[r,a]=(0,s.useState)(e),l=(0,s.useRef)(e);return(0,s.useEffect)(()=>{let e=window.matchMedia("(prefers-color-scheme: dark)"),t=()=>{"system"===(0,i.$b)()&&(0,i.AZ)("system")};return e.addEventListener("change",t),()=>{e.removeEventListener("change",t)}},[]),(0,s.useEffect)(()=>{a(e)},[e]),(0,s.useEffect)(()=>{if(null===l.current&&null!==e){let t=e.loggedInUser._userView_header._userHeader_id;for(let e of u)e(t)}l.current=e},[e]),(0,n.jsx)(o.Provider,{value:{loggedInEnv:r,setLoggedInEnv:a},children:t})}function l(){let e=(0,s.useContext)(o);if(void 0===e)throw Error("useEnvContext must be used within a EnvProvider");return e}function d(){let{loggedInEnv:e}=l();return null!==e}},72859:(e,t,r)=>{"use strict";function n(){let e=localStorage.getItem("theme");if(e&&["light","dark","system"].includes(e))return e;for(let e of document.cookie.split(";")){let[t,r]=e.trim().split("="),n=r??"";if("theme"===t&&["light","dark","system"].includes(n))return n}return"system"}function s(e){let t="system"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e,r=document.documentElement;"dark"===t?r.classList.add("dark"):r.classList.remove("dark"),localStorage.setItem("theme",e);let n=new Date;n.setFullYear(n.getFullYear()+1),document.cookie=`theme=${e}; expires=${n.toUTCString()}; path=/; SameSite=Lax`}r.d(t,{$b:()=>n,AZ:()=>s})},82849:(e,t,r)=>{"use strict";function n(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)"__proto__"!==n&&(e[n]=r[n])}return e}r.d(t,{A:()=>s});var s=function e(t,r){function s(e,s,i){if("u">typeof document){"number"==typeof(i=n({},r,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var u in i)i[u]&&(o+="; "+u,!0!==i[u]&&(o+="="+i[u].split(";")[0]));return document.cookie=e+"="+t.write(s,e)+o}}return Object.create({set:s,get:function(e){if("u">typeof document&&(!arguments.length||e)){for(var r=document.cookie?document.cookie.split("; "):[],n={},s=0;s<r.length;s++){var i=r[s].split("="),o=i.slice(1).join("=");try{var u=decodeURIComponent(i[0]);if(u in n||(n[u]=t.read(o,u)),e===u)break}catch{}}return e?n[e]:n}},remove:function(e,t){s(e,"",n({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,n({},this.attributes,t))},withConverter:function(t){return e(n({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})},92016:(e,t,r)=>{Promise.resolve().then(r.bind(r,29308))}},e=>{e.O(0,[4337,7188,8384,2190,8441,9298,7358],()=>e(e.s=92016)),_N_E=e.O()}]);
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.