(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[177],{2461:e=>{e.exports={style:{fontFamily:"'JetBrains Mono', 'JetBrains Mono Fallback'",fontStyle:"normal"},className:"__className_3c557b",variable:"__variable_3c557b"}},3798:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,7150,23)),Promise.resolve().then(n.t.bind(n,2461,23)),Promise.resolve().then(n.bind(n,4934)),Promise.resolve().then(n.t.bind(n,4344,23))},4344:()=>{},4934:(e,t,n)=>{"use strict";n.d(t,{WebSocketProvider:()=>s,h:()=>c});var r=n(206),o=n(1406);let l=(0,o.createContext)({connected:!1,lastChange:0});function s(e){let{children:t}=e,[n,s]=(0,o.useState)(!1),[c,a]=(0,o.useState)(0),u=(0,o.useRef)(null),i=(0,o.useRef)(null),m=(0,o.useRef)(2e3);return(0,o.useEffect)(()=>(!function e(){let t="https:"===window.location.protocol?"wss:":"ws:",n=new WebSocket("".concat(t,"//").concat(window.location.host,"/api/ws"));u.current=n,n.onopen=()=>{s(!0),m.current=2e3},n.onclose=()=>{s(!1),u.current=null;let t=m.current;m.current=Math.min(1.5*t,3e4),i.current=setTimeout(e,t)},n.onmessage=e=>{try{let t=JSON.parse(e.data);"file-changes"===t.type&&"number"==typeof t.timestamp&&a(t.timestamp)}catch(e){}},n.onerror=()=>{console.warn("[ws-provider] WebSocket error occurred")}}(),()=>{null!==i.current&&(clearTimeout(i.current),i.current=null),u.current&&(u.current.onclose=null,u.current.close(),u.current=null)}),[]),(0,r.jsx)(l.Provider,{value:{connected:n,lastChange:c},children:t})}function c(){return(0,o.useContext)(l)}},7150:e=>{e.exports={style:{fontFamily:"'Inter', 'Inter Fallback'",fontStyle:"normal"},className:"__className_f367f3",variable:"__variable_f367f3"}}},e=>{e.O(0,[144,235,690,358],()=>e(e.s=3798)),_N_E=e.O()}]);