PageSourceSearch

https://www.focora.ai/assets/index-DKZyPnpJ.js

js focora.ai collected 2026-10-02 01:12:31 UTC 50,571 bytes, 1 lines download raw bytes

vendor: 5,595 bytes, line 1
1import{w as y,t as Ie}from"./chunk-4N6VE7H7-DCXb7SYf.js";import{d as j,E as Fe,T as re,u as Ue}from"./axiosConfig-DFKm4Hre.js";import{a as Me}from"./focusSessionApi-D6yfmLso.js";import{g as f}from"./logger-DuBIU0n2.js";import{u as Ve}from"./ToastContext-5Pa0sOwL.js";import{u as De,q as Ke}from"./queryOptions-BzsPG9Pm.js";import{G as le}from"./iconBase-9W0e38Fc.js";const He=async()=>(await j.post("/activity/ping")).data,S=Object.create(null);S.open="0";S.close="1";S.ping="2";S.pong="3";S.message="4";S.upgrade="5";S.noop="6";const q=Object.create(null);Object.keys(S).forEach(n=>{q[S[n]]=n});const Q={type:"error",data:"parser error"},fe=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",de=typeof ArrayBuffer=="function",pe=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,G=({type:n,data:e},t,s)=>fe&&e instanceof Blob?t?s(e):oe(e,s):de&&(e instanceof ArrayBuffer||pe(e))?t?s(e):oe(new Blob([e]),s):s(S[n]+(e||"")),oe=(n,e)=>{const t=new FileReader;return t.onload=function(){const s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(n)};function ae(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let K;function $e(n,e){if(fe&&n.data instanceof Blob)return n.data.arrayBuffer().then(ae).then(e);if(de&&(n.data instanceof ArrayBuffer||pe(n.data)))return e(ae(n.data));G(n,!1,t=>{K||(K=new TextEncoder),e(K.encode(t))})}const ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",x=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<ce.length;n++)x[ce.charCodeAt(n)]=n;const Qe=n=>{let e=n.length*.75,t=n.length,s,i=0,r,a,c,h;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const g=new ArrayBuffer(e),m=new Uint8Array(g);for(s=0;s<t;s+=4)r=x[n.charCodeAt(s)],a=x[n.charCodeAt(s+1)],c=x[n.charCodeAt(s+2)],h=x[n.charCodeAt(s+3)],m[i++]=r<<2|a>>4,m[i++]=(a&15)<<4|c>>2,m[i++]=(c&3)<<6|h&63;return g},ze=typeof ArrayBuffer=="function",Z=(n,e)=>{if(typeof n!="string")return{type:"message",data:me(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:We(n.substring(1),e)}:q[t]?n.length>1?{type:q[t],data:n.substring(1)}:{type:q[t]}:Q},We=(n,e)=>{if(ze){const t=Qe(n);return me(t,e)}else return{base64:!0,data:n}},me=(n,e)=>{switch(e){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},ye="�",Ye=(n,e)=>{const t=n.length,s=new Array(t);let i=0;n.forEach((r,a)=>{G(r,!1,c=>{s[a]=c,++i===t&&e(s.join(ye))})})},Je=(n,e)=>{const t=n.split(ye),s=[];for(let i=0;i<t.length;i++){const r=Z(t[i],e);if(s.push(r),r.type==="error")break}return s};function Xe(){return new TransformStream({transform(n,e){$e(n,t=>{const s=t.length;let i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);const r=new DataView(i.buffer);r.setUint8(0,126),r.setUint16(1,s)}else{i=new Uint8Array(9);const r=new DataView(i.buffer);r.setUint8(0,127),r.setBigUint64(1,BigInt(s))}n.data&&typeof n.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(t)})}})}let H;function L(n){return n.reduce((e,t)=>e+t.length,0)}function P(n,e){if(n[0].length===e)return n.shift();const t=new Uint8Array(e);let s=0;for(let i=0;i<e;i++)t[i]=n[0][s++],s===n[0].length&&(n.shift(),s=0);return n.length&&s<n[0].length&&(n[0]=n[0].slice(s)),t}function je(n,e){H||(H=new TextDecoder);const t=[];let s=0,i=-1,r=!1;return new TransformStream({transform(a,c){for(t.push(a);;){if(s===0){if(L(t)<1)break;const h=P(t,1);r=(h[0]&128)===128,i=h[0]&127,i<126?s=3:i===126?s=1:s=2}else if(s===1){if(L(t)<2)break;const h=P(t,2);i=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),s=3}else if(s===2){if(L(t)<8)break;const h=P(t,8),g=new DataView(h.buffer,h.byteOffset,h.length),m=g.getUint32(0);if(m>Math.pow(2,21)-1){c.enqueue(Q);break}i=m*Math.pow(2,32)+g.getUint32(4),s=3}else{if(L(t)<i)break;const h=P(t,i);c.enqueue(Z(r?h:H.decode(h),e)),s=0}if(i===0||i>n){c.enqueue(Q);break}}}})}const ge=4;function d(n){if(n)return Ge(n)}function Ge(n){for(var e in d.prototype)n[e]=d.prototype[e];return n}d.prototype.on=d.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this};d.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this};d.prototype.off=d.prototype.removeListener=d.prototype.removeAllListeners=d.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+n];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var s,i=0;i<t.length;i++)if(s=t[i],s===e||s.fn===e){t.splice(i,1);break}return t.length===0&&delete this._callbacks["$"+n],this};d.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+n],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,i=t.length;s<i;++s)t[s].apply(this,e)}return this};d.prototype.emitReserved=d.prototype.emit;d.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};d.prototype.hasListeners=function(n){return!!this.listeners(n).length};const M=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),_=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ze
vendor: 4,315 bytes, line 1
1="arraybuffer";function _e(n,...e){return e.reduce((t,s)=>(n.hasOwnProperty(s)&&(t[s]=n[s]),t),{})}const et=_.setTimeout,tt=_.clearTimeout;function V(n,e){e.useNativeTimers?(n.setTimeoutFn=et.bind(_),n.clearTimeoutFn=tt.bind(_)):(n.setTimeoutFn=_.setTimeout.bind(_),n.clearTimeoutFn=_.clearTimeout.bind(_))}const st=1.33;function nt(n){return typeof n=="string"?it(n):Math.ceil((n.byteLength||n.size)*st)}function it(n){let e=0,t=0;for(let s=0,i=n.length;s<i;s++)e=n.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function ve(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function rt(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function ot(n){let e={},t=n.split("&");for(let s=0,i=t.length;s<i;s++){let r=t[s].split("=");e[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return e}class at extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}}class ee extends d{constructor(e){super(),this.writable=!1,V(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new at(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Z(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=rt(e);return t.length?"?"+t:""}}class ct extends ee{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};Je(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Ye(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=ve()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let we=!1;try{we=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const ht=we;function ut(){}class lt extends ct{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let s=location.port;s||(s=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){const s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(i,r)=>{this.onError("xhr post error",i,r)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}}class k extends d{constructor(e,t,s){super(),this.createRequest=e,V(this,s),this._opts=s,this._method=s.method||"GET",this._uri=t,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;const t=_e(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(t);
vendor: 13,103 bytes, line 1
1try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&s.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var i;s.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=k.requestsCount++,k.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=ut,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete k.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}k.requestsCount=0;k.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",he);else if(typeof addEventListener=="function"){const n="onpagehide"in _?"pagehide":"unload";addEventListener(n,he,!1)}}function he(){for(let n in k.requests)k.requests.hasOwnProperty(n)&&k.requests[n].abort()}const ft=function(){const n=be({xdomain:!1});return n&&n.responseType!==null}();class dt extends lt{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=ft&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new k(be,this.uri(),e)}}function be(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||ht))return new XMLHttpRequest}catch{}if(!e)try{return new _[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Ee=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class pt extends ee{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,s=Ee?{}:_e(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],i=t===e.length-1;G(s,this.supportsBinary,r=>{try{this.doWrite(s,r)}catch{}i&&M(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=ve()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const $=_.WebSocket||_.MozWebSocket;class mt extends pt{createSocket(e,t,s){return Ee?new $(e,t,s):t?new $(e,t):new $(e)}doWrite(e,t){this.ws.send(t)}}class yt extends ee{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=je(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),i=Xe();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const r=()=>{s.read().then(({done:c,value:h})=>{c||(this.onPacket(h),r())}).catch(c=>{})};r();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],i=t===e.length-1;this._writer.write(s).then(()=>{i&&M(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const gt={websocket:mt,webtransport:yt,polling:dt},_t=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,vt=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function z(n){if(n.length>8e3)throw"URI too long";const e=n,t=n.indexOf("["),s=n.indexOf("]");t!=-1&&s!=-1&&(n=n.substring(0,t)+n.substring(t,s).replace(/:/g,";")+n.substring(s,n.length));let i=_t.exec(n||""),r={},a=14;for(;a--;)r[vt[a]]=i[a]||"";return t!=-1&&s!=-1&&(r.source=e,r.host=r.host.substring(1,r.host.length-1).replace(/;/g,":"),r.authority=r.authority.replace("[","").replace("]","").replace(/;/g,":"),r.ipv6uri=!0),r.pathNames=wt(r,r.path),r.queryKey=bt(r,r.query),r}function wt(n,e){const t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function bt(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,i,r){i&&(t[i]=r)}),t}const W=typeof addEventListener=="function"&&typeof removeEventListener=="function",I=[];W&&addEventListener("offline",()=>{I.forEach(n=>n())},!1);class C extends d{constructor(e,t){if(super(),this.binaryType=Ze,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const s=z(e);t.hostname=s.host,t.secure=s.protocol==="https"||s.protocol==="wss",t.port=s.port,s.query&&(t.query=s.query)}else t.host&&(t.hostname=z(t.host).host);V(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(s=>{const i=s.prototype.name;this.transports.push(i),this._transportsByName[i]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=ot(this.opts.query)),W&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},I.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=ge,t.transport=e,this.id&&(t.sid=this.id);const s=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&C.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",C.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let s=0;s<this.writeBuffer.length;s++){const i=this.writeBuffer[s].data;if(i&&(t+=nt(i)),s>0&&t>this._maxPayload)return this.writeBuffer.slice(0,s);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,M(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,s){return this._sendPacket("message",e,t,s),this}send(e,t,s){return this._sendPacket("message",e,t,s),this}_sendPacket(e,t,s,i){if(typeof t=="function"&&(i=t,t=void 0),typeof s=="function"&&(i=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const r={type:e,data:t,options:s};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},s=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}_onError(e){if(C.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),W&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=I.indexOf(this._offlineEventListener);s!==-1&&I.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}C.protocol=ge;class Et extends C{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),s=!1;C.priorWebsocketSuccess=!1;const i=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",v=>{if(!s)if(v.type==="pong"&&v.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;C.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(m(),this.setTransport(t),t.send([{type:"upgrade"}
vendor: 7,797 bytes, line 1
1]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const O=new Error("probe error");O.transport=t.name,this.emitReserved("upgradeError",O)}}))};function r(){s||(s=!0,m(),t.close(),t=null)}const a=v=>{const O=new Error("probe error: "+v);O.transport=t.name,r(),this.emitReserved("upgradeError",O)};function c(){a("transport closed")}function h(){a("socket closed")}function g(v){t&&v.name!==t.name&&r()}const m=()=>{t.removeListener("open",i),t.removeListener("error",a),t.removeListener("close",c),this.off("close",h),this.off("upgrading",g)};t.once("open",i),t.once("error",a),t.once("close",c),this.once("close",h),this.once("upgrading",g),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}}let kt=class extends Et{constructor(e,t={}){const s=typeof e=="object",i=s?{...e}:{...t};(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(r=>gt[r]).filter(r=>!!r)),super(s?i:e,i)}};function St(n,e="",t){let s=n;t=t||typeof location<"u"&&location,n==null&&(n=t.protocol+"//"+t.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=t.protocol+n:n=t.host+n),/^(https?|wss?):\/\//.test(n)||(typeof t<"u"?n=t.protocol+"//"+n:n="https://"+n),s=z(n)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const r=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+r+":"+s.port+e,s.href=s.protocol+"://"+r+(t&&t.port===s.port?"":":"+s.port),s}const Tt=typeof ArrayBuffer=="function",At=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,ke=Object.prototype.toString,Rt=typeof Blob=="function"||typeof Blob<"u"&&ke.call(Blob)==="[object BlobConstructor]",Ct=typeof File=="function"||typeof File<"u"&&ke.call(File)==="[object FileConstructor]";function te(n){return Tt&&(n instanceof ArrayBuffer||At(n))||Rt&&n instanceof Blob||Ct&&n instanceof File}function F(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,s=n.length;t<s;t++)if(F(n[t]))return!0;return!1}if(te(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return F(n.toJSON(),!0);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&F(n[t]))return!0;return!1}function Ot(n){const e=[],t=n.data,s=n;return s.data=Y(t,e),s.attachments=e.length,{packet:s,buffers:e}}function Y(n,e){if(!n)return n;if(te(n)){const t={_placeholder:!0,num:e.length};return e.push(n),t}else if(Array.isArray(n)){const t=new Array(n.length);for(let s=0;s<n.length;s++)t[s]=Y(n[s],e);return t}else if(typeof n=="object"&&!(n instanceof Date)){const t={};for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=Y(n[s],e));return t}return n}function Nt(n,e){return n.data=J(n.data,e),delete n.attachments,n}function J(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let t=0;t<n.length;t++)n[t]=J(n[t],e);else if(typeof n=="object")for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(n[t]=J(n[t],e));return n}const Bt=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var u;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(u||(u={}));class xt{constructor(e){this.replacer=e}encode(e){return(e.type===u.EVENT||e.type===u.ACK)&&F(e)?this.encodeAsBinary({type:e.type===u.EVENT?u.BINARY_EVENT:u.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===u.BINARY_EVENT||e.type===u.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Ot(e),s=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(s),i}}class se extends d{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e=="function"?{reviver:e}:e)}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const s=t.type===u.BINARY_EVENT;s||t.type===u.BINARY_ACK?(t.type=s?u.EVENT:u.ACK,this.reconstructor=new Lt(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(te(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const s={type:Number(e.charAt(0))};if(u[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===u.BINARY_EVENT||s.type===u.BINARY_ACK){const r=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const a=e.substring(r,t);if(a!=Number(a)||e.charAt(t)!=="-")throw new Error("Illegal attachments");const c=Number(a);if(!Pt(c)||c<0)throw new Error("Illegal attachments");if(c>this.opts.maxAttachments)throw new Error("too many attachments");s.attachments=c}if(e.charAt(t+1)==="/"){const r=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(r,t)}else s.nsp="/";const i=e.charAt(t+1);if(i!==""&&Number(i)==i){const r=t+1;for(;++t;){const a=e.charAt(t);if(a==null||Number(a)!=a){--t;break}if(t===e.length)break}s.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(se.isPayloadValid(s.type,r))s.data=r;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case u.CONNECT:return ue(t);case u.DISCONNECT:return t===void 0;case u.CONNECT_ERROR:return typeof t=="string"||ue(t);case u.EVENT:case u.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Bt.indexOf(t[0])===-1);case u.ACK:case u.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Lt{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Nt(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Pt=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n};function ue(n){return Object.prototype.toString.call(n)==="[object Object]"}const qt=Object.freeze(Object.defineProperty({__proto__:null,Decoder:se,Encoder:xt,get PacketType(){return u}},Symbol.toStringTag,{value:"Module"}));function E(n,e,t){return n.on(e,t),function(){n.off(e,t)}}const It=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Se extends d{constructor(e,t,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[E(e,"open",this.onopen.bind(this)),E(e,"packet",this.onpacket.b
vendor: 9,689 bytes, line 1
1ind(this)),E(e,"error",this.onerror.bind(this)),E(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var s,i,r;if(It.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const a={type:u.EVENT,data:t};if(a.options={},a.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const m=this.ids++,v=t.pop();this._registerAckCallback(m,v),a.id=m}const c=(i=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||i===void 0?void 0:i.writable,h=this.connected&&!(!((r=this.io.engine)===null||r===void 0)&&r._hasPingExpired());return this.flags.volatile&&!c||(h?(this.notifyOutgoingListeners(a),this.packet(a)):this.sendBuffer.push(a)),this.flags={},this}_registerAckCallback(e,t){var s;const i=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(i===void 0){this.acks[e]=t;return}const r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===e&&this.sendBuffer.splice(c,1);t.call(this,new Error("operation has timed out"))},i),a=(...c)=>{this.io.clearTimeoutFn(r),t.apply(this,c)};a.withError=!0,this.acks[e]=a}emitWithAck(e,...t){return new Promise((s,i)=>{const r=(a,c)=>a?i(a):s(c);r.withError=!0,t.push(r),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...r)=>s!==this._queue[0]?void 0:(i!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(i)):(this._queue.shift(),t&&t(null,...r)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:u.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){const s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case u.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case u.EVENT:case u.BINARY_EVENT:this.onevent(e);break;case u.ACK:case u.BINARY_ACK:this.onack(e);break;case u.DISCONNECT:this.ondisconnect();break;case u.CONNECT_ERROR:this.destroy();const s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let s=!1;return function(...i){s||(s=!0,t.packet({type:u.ACK,id:e,data:i}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:u.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const s of t)s.apply(this,e.data)}}}function N(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}N.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=(Math.floor(e*10)&1)==0?n-t:n+t}return Math.min(n,this.max)|0};N.prototype.reset=function(){this.attempts=0};N.prototype.setMin=function(n){this.ms=n};N.prototype.setMax=function(n){this.max=n};N.prototype.setJitter=function(n){this.jitter=n};class X extends d{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,V(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new N({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const i=t.parser||qt;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new kt(this.uri,this.opts);const t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const i=E(t,"open",function(){s.onopen(),e&&e()}),r=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},a=E(t,"error",r);if(this._timeout!==!1){const c=this._timeout,h=this.setTimeoutFn(()=>{i(),r(new Error("timeout")),t.close()},c);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(i),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(E(e,"ping",this.onping.bind(this)),E(e,"data",this.ondata.bind(this)),E(e,"error",this.onerror.bind(this)),E(e,"close",this.onclose.bind(this)),E(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){M(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new Se(this,e,t),this.nsps[e]=s),s}_destroy(e){const t=Object.keys(this.nsps);for(const s of t)if(this.nsps[s].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let s=0;s<t.length;
1s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const B={};function U(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=St(n,e.path||"/socket.io"),s=t.source,i=t.id,r=t.path,a=B[i]&&r in B[i].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||a;let h;return c?h=new X(s,e):(B[i]||(B[i]=new X(s,e)),h=B[i]),t.query&&!e.query&&(e.query=t.queryKey),h.socket(t.path,e)}Object.assign(U,{Manager:X,Socket:Se,io:U,connect:U});const Ft=async()=>(await j.get("/pomodoro-setting")).data.data[0],Xt=async n=>(await j.patch("/pomodoro-setting",n)).data.data;function Ut(){return Ke({queryKey:["pomodoroSetting"],queryFn:Ft,enabled:!0})}function Mt(){return De(Ut())}const Vt=2*60*1e3,Te=y.createContext(),Dt=()=>{const n=localStorage.getItem("paused_pomodoro");return n?{...JSON.parse(n),status:"running",isPaused:!0}:{status:"idle",phase:"focus",currentSessionNumber:1,timeLeft:0,endTime:null,isPaused:!1}};function jt({children:n}){const[e,t]=y.useState(Dt),[s,i]=y.useState(null),[r,a]=y.useState(!1),[c,h]=y.useState(!1),[g,m]=y.useState(""),[v,O]=y.useState(!1),{data:T}=Mt(),{success:R,error:A}=Ve(),ne=y.useRef(0),w=Fe(),Ae={focus:((T==null?void 0:T.focusDuration)??25)*60*1e3,shortBreak:((T==null?void 0:T.shortBreakDuration)??5)*60*1e3,longBreak:((T==null?void 0:T.longBreakDuration)??15)*60*1e3};y.useEffect(()=>{window.postMessage({type:"FOCORA_SESSION_STATE",session:{_id:(e==null?void 0:e._id)??null,status:(e==null?void 0:e.status)??"idle",phase:(e==null?void 0:e.phase)??"focus",isPaused:!!(e!=null&&e.isPaused),phaseDurationMs:Ae[(e==null?void 0:e.phase)??"focus"]}},window.location.origin)},[e==null?void 0:e._id,e==null?void 0:e.status,e==null?void 0:e.phase,e==null?void 0:e.isPaused]),y.useEffect(()=>{e.isPaused&&e._id?localStorage.setItem("paused_pomodoro",JSON.stringify({_id:e._id,timeLeft:e.timeLeft,phase:e.phase,currentSessionNumber:e.currentSessionNumber})):e.isPaused||localStorage.removeItem("paused_pomodoro")},[e.isPaused,e.timeLeft]),y.useEffect(()=>{const p=()=>re.getAccessToken();if(!p())return;const l=U("https://focora-production.up.railway.app",{auth:{token:p()},transports:["websocket","polling"],reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:1e3,reconnectionDelayMax:5e3,timeout:2e4});l.io.on("reconnect_attempt",()=>{l.auth={token:p()}}),l.on("connect",()=>{f.info("Connected to server","development"),a(!0)}),l.on("disconnect",o=>{f.error(`Disconnected: ${o}`,"development"),a(!1),o==="io server disconnect"&&l.connect()}),l.on("connect_error",async o=>{f.error("Connection error:",o,"development"),a(!1);const b=String((o==null?void 0:o.message)||"").toLowerCase();if(/auth|token|jwt|unauthor|forbidden|401|403/.test(b)&&re.isTokenExpired(p()))try{const qe=await Ue();l.auth={token:qe},l.connect()}catch{A("Session expired — please sign in again.")}}),l.onAny((o,...b)=>{f.info(`[SOCKET EVENT] Received: ${o}`,b,"development")}),l.on("session_state",o=>{const b=JSON.parse(localStorage.getItem("paused_pomodoro"));o.isPaused&&b&&b._id===o._id?t({...o,timeLeft:b.timeLeft}):t(o)}),l.on("socketConnected",o=>{f.info("Received socket information:",o,"development"),O(o)}),l.on("session_started",o=>{f.info("Session started:",o,"development"),t(o),w.invalidateQueries({queryKey:["currentSession"]}),R("Focus session started!")}),l.on("session_paused",o=>{f.info("Session paused:",o,"development"),t(o),w.invalidateQueries({queryKey:["currentSession"]}),R("Session paused")}),l.on("session_resumed",o=>{f.info("Session resumed:",o,"development"),t(o),w.invalidateQueries({queryKey:["currentSession"]}),R("Session resumed")}),l.on("session_completed",o=>{f.info("Session completed:",o,"development"),playCompletionSound(),o.status==="running"&&(t(o),w.invalidateQueries({queryKey:["currentSession"]}),w.invalidateQueries({queryKey:["analytics"]}),w.invalidateQueries({queryKey:["analytics","today"]}),R("Session completed!"))}),l.on("session_skipped",o=>{f.info("Session skipped:",o,"development"),f.info("Session data timeLeft:",o.timeLeft,"development"),f.info("Session data status:",o.status,"development"),f.info("Session data phase:",o.phase,"development"),o.status==="running"&&(t(o),w.invalidateQueries({queryKey:["currentSession"]}),w.invalidateQueries({queryKey:["analytics"]}),w.invalidateQueries({queryKey:["analytics","today"]}),R("Session skipped"))}),l.on("pomodoro_cycle_completed",o=>{f.info("Triggered!","development"),f.info(o.initialSession,"development"),f.info(o,"development"),t(o.initialSession),playCompletionSound()}),l.on("session_reset",o=>{f.info("Session reset:",o,"development"),t(o),w.invalidateQueries({queryKey:["currentSession"]}),R("Session restarted")}),l.on("timer_tick",o=>
1{f.info("Timer tick received:",o,"development"),t(D=>({...D,timeLeft:o.timeLeft,phase:o.phase,currentSessionNumber:o.currentSessionNumber,endTime:o.endTime||D.endTime}));const b=Date.now();b-ne.current>=Vt&&(ne.current=b,He().catch(()=>{}))}),l.on("session_phase_completed",o=>{f.info("Phase completed:",o,"development"),t(o.newSession),m(o.newSession._id),playCompletionSound(),R(`${{focus:"Focus session",shortBreak:"Short break",longBreak:"Long break"}[o.completedPhase]} completed!`),o.newSession.status==="completed"&&h(!0)}),l.on("session_error",o=>{f.error("Session error:",o,"development"),A(o.message||"An error occurred")}),i(l);const ie=()=>{document.visibilityState==="visible"&&!l.connected&&l.connect()};return document.addEventListener("visibilitychange",ie),i(l),()=>{l.close(),document.removeEventListener("visibilitychange",ie)}},[]);const Re=p=>{s&&r?s.emit("start_session",p):A("Not connected to server",{allowedEnvironments:"development"})},Ce=p=>{s&&r?s.emit("pause_session",p):A("Not connected to server",{allowedEnvironments:"development"})},Oe=p=>{s&&r?s.emit("resume_session",p):A("Not connected to server",{allowedEnvironments:"development"})},Ne=p=>{s&&r?s.emit("complete_session",p):A("Not connected to server",{allowedEnvironments:"development"})},Be=p=>{s&&r?s.emit("skip_session",p):A("Not connected to server",{allowedEnvironments:"development"})},xe=p=>{s&&r?s.emit("reset_session",p):A("Not connected to server",{allowedEnvironments:"development"})},Le=async p=>{try{await Me(p),w.invalidateQueries({queryKey:["currentSession"]}),R("Added reflection successfully!"),t({status:"idle",phase:"focus",currentSessionNumber:1,timeLeft:0}),h(!1)}catch(l){A(l.message||"Failed to add reflection")}};y.useEffect(()=>{(e==null?void 0:e.status)==="completed"&&(h(!0),m(e._id))},[e==null?void 0:e.status,e==null?void 0:e._id]);const Pe=y.useMemo(()=>({currentSession:e,isLoading:!1,error:r?null:new Error("Not connected"),isConnected:r,completed:c,setCompleted:h,startSession:Re,resetSession:xe,pauseSession:Ce,resumeSession:Oe,completeSession:Ne,skipSession:Be,addReflection:Le,isExtensionConnected:v,isStarting:!1,isPausing:!1,isResuming:!1,isCompleting:!1,isSkipping:!1,setLastSessionId:m,lastSessionId:g}),[e,r,c,g,v]);return Ie.jsx(Te.Provider,{value:Pe,children:n})}function Gt(){const n=y.useContext(Te);if(n===void 0)throw new Error("usePomodoroSessionContext must be used within a PomodoroSessionProvider");return n}function Zt(n){return le({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 456c-110.3 0-200-89.7-200-200 0-54.8 21.7-105.9 61.2-144 6.4-6.2 16.6-6 22.7.4 6.2 6.4 6 16.6-.4 22.7-33.1 32-51.3 74.9-51.3 120.9 0 92.5 75.3 167.8 167.8 167.8S423.8 348.5 423.8 256c0-87.1-66.7-159-151.8-167.1v62.6c0 8.9-7.2 16.1-16.1 16.1s-16.1-7.2-16.1-16.1V72.1c0-8.9 7.2-16.1 16.1-16.1 110.3 0 200 89.7 200 200S366.3 456 256 456z"},child:[]},{tag:"path",attr:{d:"M175.9 161.9l99.5 71.5c13.5 9.7 16.7 28.5 7 42s-28.5 16.7-42 7c-2.8-2-5.2-4.4-7-7l-71.5-99.5c-3.2-4.5-2.2-10.8 2.3-14 3.6-2.6 8.3-2.4 11.7 0z"},child:[]}]})(n)}function es(n){return le({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M413.967 276.8c1.06-6.235 1.06-13.518 1.06-20.8s-1.06-13.518-1.06-20.8l44.667-34.318c4.26-3.118 5.319-8.317 2.13-13.518L418.215 115.6c-2.129-4.164-8.507-6.235-12.767-4.164l-53.186 20.801c-10.638-8.318-23.394-15.601-36.16-20.801l-7.448-55.117c-1.06-4.154-5.319-8.318-10.638-8.318h-85.098c-5.318 0-9.577 4.164-10.637 8.318l-8.508 55.117c-12.767 5.2-24.464 12.482-36.171 20.801l-53.186-20.801c-5.319-2.071-10.638 0-12.767 4.164L49.1 187.365c-2.119 4.153-1.061 10.399 2.129 13.518L96.97 235.2c0 7.282-1.06 13.518-1.06 20.8s1.06 13.518 1.06 20.8l-44.668 34.318c-4.26 3.118-5.318 8.317-2.13 13.518L92.721 396.4c2.13 4.164 8.508 6.235 12.767 4.164l53.187-20.801c10.637 8.318 23.394 15.601 36.16 20.801l8.508 55.117c1.069 5.2 5.318 8.318 10.637 8.318h85.098c5.319 0 9.578-4.164 10.638-8.318l8.518-55.117c12.757-5.2 24.464-12.482 36.16-20.801l53.187 20.801c5.318 2.071 10.637 0 12.767-4.164l42.549-71.765c2.129-4.153 1.06-10.399-2.13-13.518l-46.8-34.317zm-158.499 52c-41.489 0-74.46-32.235-74.46-72.8s32.971-72.8 74.46-72.8 74.461 32.235 74.461 72.8-32.972 72.8-74.461 72.8z"},child:[]}]})(n)}export{Zt as I,jt as P,es as a,Gt as b,Mt as c,He as p,Xt 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.