1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a10c34-6c97-7220-a2fc-6a8f9a19e3da")}catch(e){}}();const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-ably-7hPgGLjZ.js","assets/rolldown-runtime-Cyuzqnbw.js"])))=>i.map(i=>d[i]); 2import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{I as t,n,t as r}from"./error-reporter-DXoHd-iC.js";import{r as i}from"./vendor-pdf-DyNmzu0Z.js";var a=null,o=null,s=0,c=!1,l=!1,u=!1,d=3,f=new Map;function p(){return Array.from(f.keys()).slice(-20)}function m(e){return h(e)||g(e)?{shouldReport:!1,severity:`info`,shouldCountTowardBail:!1}:{shouldReport:!0,severity:`error`,shouldCountTowardBail:!0}}function h(e){return e instanceof Error?!!(e.name===`TypeError`&&/failed to fetch/i.test(e.message)||e.name===`AbortError`):!1}function g(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.response===void 0?!!(t.code===`ERR_NETWORK`||typeof t.message==`string`&&/network error/i.test(t.message)):!1}function _(){if(l||typeof window>`u`)return;l=!0;let e=()=>{s=0,c&&(c=!1,a=null)};window.addEventListener(`online`,e),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&e()})}function v(){u||(u=!0,t.subscribe((e,t)=>{let n=!!t?.token,r=!!e.token;n&&!r&&S()}))}async function y(){if(_(),v(),a){let e=a.connection.state;if(e===`connected`||e===`connecting`)return a;
2if(e===`disconnected`||e===`suspended`)return a.connect(),a;a.close(),a=null}if(o)return o;o=(async()=>{let o=await i(()=>import(`./vendor-ably-7hPgGLjZ.js`).then(t=>e(t.t(),1)),__vite__mapDeps([0,1])),l=t.getState().user?.id;return a=new o.Realtime({...l?{clientId:l}:{},disconnectedRetryTimeout:15e3,suspendedRetryTimeout:3e4,recover:(e,t)=>{t(!0)},authCallback:async(e,t)=>{if(c){t(`auth bailed: consecutive failures exceeded`,null);return}try{let{data:e}=await n.post(`/v1/realtime/tokens`,{documents:p()});s=0,t(null,e.token_request)}catch(e){let n=m(e);if(n.shouldCountTowardBail&&(s+=1,s>=d)){c=!0,r.report(Error(`Ably auth failed ${s} consecutive times â bailing`),{component:`AblyClient`,context:{action:`auth_bailed`}});try{a?.close()}catch{}}n.shouldReport&&r.report(e,{component:`AblyClient`,context:{action:`auth_callback`}}),t(e instanceof Error?e.message:`Unknown error`,null)}}}),a.connection.on(`failed`,e=>{r.report(Error(`Ably connection failed: ${e.reason?.message||`unknown`}`),{component:`AblyClient`,context:{action:`connection_failed`}})}),a})();try{return await o}finally{o=null}}async function b(){if(a)try{await a.auth.authorize()}catch(e){r.report(e,{component:`AblyClient`,context:{action:`refresh_auth`}})}}async function x(e){let t=f.get(e)??0;f.delete(e),f.set(e,t+1),t===0&&await b();let n=!1;return()=>{if(n)return;n=!0;let t=(f.get(e)??1)-1;t>0?f.set(e,t):f.delete(e)}}function S(){a&&=(a.close(),null),s=0,c=!1}export{b as i,x as n,y as r,S as t}; 3//# chunkId=01a10c34-6c97-7220-a2fc-6a8f9a19e3da
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.