@tangle-network/sandbox 0.9.1 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1,667 @@
1
- function a0_0xac02(_0x55aa89,_0x3f25bb){_0x55aa89=_0x55aa89-0x17f;const _0xd60c6d=a0_0xd60c();let _0xac02b7=_0xd60c6d[_0x55aa89];if(a0_0xac02['\x48\x65\x66\x53\x6e\x72']===undefined){var _0x145bbf=function(_0x1797d0){const _0x257691='\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x2b\x2f\x3d';let _0x24b0ac='',_0x36c8cc='';for(let _0x412add=0x0,_0x11b261,_0x33e85a,_0x57117e=0x0;_0x33e85a=_0x1797d0['\x63\x68\x61\x72\x41\x74'](_0x57117e++);~_0x33e85a&&(_0x11b261=_0x412add%0x4?_0x11b261*0x40+_0x33e85a:_0x33e85a,_0x412add++%0x4)?_0x24b0ac+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](0xff&_0x11b261>>(-0x2*_0x412add&0x6)):0x0){_0x33e85a=_0x257691['\x69\x6e\x64\x65\x78\x4f\x66'](_0x33e85a);}for(let _0x48df18=0x0,_0x3d927d=_0x24b0ac['\x6c\x65\x6e\x67\x74\x68'];_0x48df18<_0x3d927d;_0x48df18++){_0x36c8cc+='\x25'+('\x30\x30'+_0x24b0ac['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x48df18)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x10))['\x73\x6c\x69\x63\x65'](-0x2);}return decodeURIComponent(_0x36c8cc);};a0_0xac02['\x4f\x48\x61\x4e\x73\x48']=_0x145bbf,a0_0xac02['\x4f\x67\x72\x49\x66\x62']={},a0_0xac02['\x48\x65\x66\x53\x6e\x72']=!![];}const _0x3e22ce=_0xd60c6d[0x0],_0x4f4aa0=_0x55aa89+_0x3e22ce,_0x5869a9=a0_0xac02['\x4f\x67\x72\x49\x66\x62'][_0x4f4aa0];return!_0x5869a9?(_0xac02b7=a0_0xac02['\x4f\x48\x61\x4e\x73\x48'](_0xac02b7),a0_0xac02['\x4f\x67\x72\x49\x66\x62'][_0x4f4aa0]=_0xac02b7):_0xac02b7=_0x5869a9,_0xac02b7;}const a0_0x51a297=a0_0xac02;(function(_0x504437,_0x5321e7){const _0x56f011=a0_0xac02,_0x4deef6=_0x504437();while(!![]){try{const _0x22f6c0=parseInt(_0x56f011(0x249))/0x1*(-parseInt(_0x56f011(0x1ee))/0x2)+parseInt(_0x56f011(0x22d))/0x3+parseInt(_0x56f011(0x1a7))/0x4+parseInt(_0x56f011(0x1e4))/0x5+-parseInt(_0x56f011(0x1d8))/0x6*(parseInt(_0x56f011(0x24d))/0x7)+parseInt(_0x56f011(0x1fc))/0x8+parseInt(_0x56f011(0x1c0))/0x9*(-parseInt(_0x56f011(0x228))/0xa);if(_0x22f6c0===_0x5321e7)break;else _0x4deef6['push'](_0x4deef6['shift']());}catch(_0x4682ea){_0x4deef6['push'](_0x4deef6['shift']());}}}(a0_0xd60c,0x795f2));const INITIAL_METRICS={'\x6c\x61\x73\x74\x50\x69\x6e\x67\x4c\x61\x74\x65\x6e\x63\x79\x4d\x73':null,'\x61\x76\x67\x50\x69\x6e\x67\x4c\x61\x74\x65\x6e\x63\x79\x4d\x73':null,'\x6d\x69\x73\x73\x65\x64\x50\x6f\x6e\x67\x43\x6f\x75\x6e\x74':0x0,'\x72\x65\x63\x6f\x6e\x6e\x65\x63\x74\x43\x6f\x75\x6e\x74':0x0,'\x6c\x61\x73\x74\x50\x6f\x6e\x67\x41\x74':null,'\x6c\x61\x73\x74\x52\x65\x63\x6f\x6e\x6e\x65\x63\x74\x41\x74':null,'\x71\x75\x61\x6c\x69\x74\x79':a0_0x51a297(0x227)};function calculateConnectionQuality(_0x2febef,_0x5988e8){const _0x34cda2=a0_0x51a297,_0x52f924={'\x6c\x41\x73\x73\x6a':function(_0x59e7ec,_0x56ed6d){return _0x59e7ec-_0x56ed6d;},'\x58\x73\x73\x78\x51':function(_0x4fc0ff,_0x4ed60b){return _0x4fc0ff>_0x4ed60b;},'\x6d\x59\x41\x6d\x73':function(_0x5afce2,_0x461f0f){return _0x5afce2!==_0x461f0f;},'\x61\x6e\x76\x6e\x68':function(_0x541b55,_0x4c80e1){return _0x541b55<_0x4c80e1;},'\x4c\x63\x72\x73\x6f':function(_0x902975,_0x9e19b1){return _0x902975===_0x9e19b1;},'\x4c\x42\x67\x64\x4a':_0x34cda2(0x1ab),'\x44\x48\x77\x57\x6f':function(_0x2dc4a4,_0x44c835){return _0x2dc4a4<=_0x44c835;},'\x52\x44\x4f\x78\x69':_0x34cda2(0x241)};if(!_0x5988e8)return _0x34cda2(0x227);const {avgPingLatencyMs:_0x56eb7d,missedPongCount:_0x15b51b,reconnectCount:_0x3f3d03,lastReconnectAt:_0x34be35}=_0x2febef,_0x37d527=_0x34be35&&_0x52f924['\x6c\x41\x73\x73\x6a'](Date[_0x34cda2(0x225)](),_0x34be35)<0x12c*0x3e8;if(_0x15b51b>=0x2||_0x37d527&&_0x52f924['\x58\x73\x73\x78\x51'](_0x3f3d03,0x1))return _0x34cda2(0x19b);if(_0x15b51b>=0x1||_0x52f924[_0x34cda2(0x222)](_0x56eb7d,null)&&_0x56eb7d>0x3e8||_0x37d527)return _0x34cda2(0x204);if(_0x52f924[_0x34cda2(0x222)](_0x56eb7d,null)&&_0x52f924[_0x34cda2(0x1d0)](_0x56eb7d,0x64)&&_0x52f924[_0x34cda2(0x244)](_0x3f3d03,0x0))return _0x52f924[_0x34cda2(0x1f2)];if(_0x56eb7d!==null&&_0x52f924[_0x34cda2(0x181)](_0x56eb7d,0x12c))return _0x52f924['\x52\x44\x4f\x78\x69'];return _0x34cda2(0x241);}function a0_0xd60c(){const _0x1f146a=['\x76\x67\x39\x52\x7a\x77\x34\x47\x43\x4d\x76\x4d\x43\x4d\x76\x5a\x41\x63\x62\x4d\x79\x77\x4c\x53\x7a\x77\x71\x36\x69\x61','\x79\x32\x39\x55\x42\x4d\x76\x4a\x44\x67\x76\x4b\x71\x78\x71','\x7a\x68\x76\x57\x42\x67\x4c\x4a\x79\x78\x72\x4c\x43\x31\x6e\x52\x41\x78\x62\x57\x7a\x77\x71','\x79\x32\x58\x4c\x79\x78\x69','\x43\x32\x76\x30\x75\x32\x76\x5a\x43\x32\x4c\x56\x42\x4b\x6e\x56\x42\x4e\x72\x4c\x45\x68\x71','\x79\x32\x39\x55\x42\x4d\x76\x4a\x44\x67\x76\x4b','\x6d\x4d\x58\x67\x77\x76\x72\x4f\x43\x61','\x43\x67\x66\x59\x43\x32\x75','\x43\x4e\x76\x55\x44\x67\x4c\x54\x7a\x73\x35\x4b\x41\x78\x6e\x4a\x42\x32\x35\x55\x7a\x77\x6e\x30\x7a\x77\x71','\x43\x32\x76\x30\x75\x33\x72\x48\x44\x67\x75','\x74\x65\x6a\x4e\x7a\x65\x4f','\x74\x31\x62\x66\x74\x47','\x43\x32\x6e\x4f\x7a\x77\x72\x31\x42\x67\x76\x73\x7a\x77\x6e\x56\x42\x4d\x35\x4c\x79\x33\x71','\x42\x77\x66\x34\x72\x67\x76\x4b\x44\x78\x62\x53\x41\x77\x6e\x48\x44\x67\x4c\x56\x42\x4c\x6e\x50\x45\x4d\x75','\x43\x68\x6a\x56\x79\x32\x76\x5a\x43\x30\x35\x48\x42\x77\x75','\x42\x77\x76\x5a\x43\x32\x66\x4e\x7a\x76\x72\x35\x43\x67\x75','\x79\x32\x48\x48\x42\x4d\x35\x4c\x42\x68\x6d','\x41\x75\x39\x65\x43\x76\x75','\x44\x77\x35\x4b\x7a\x77\x7a\x50\x42\x4d\x76\x4b','\x41\x77\x35\x50\x44\x67\x4c\x48\x42\x66\x6a\x4c\x79\x32\x39\x55\x42\x4d\x76\x4a\x44\x65\x72\x4c\x42\x67\x66\x35\x74\x78\x6d','\x6d\x4a\x47\x35\x6e\x74\x4b\x59\x75\x4b\x50\x78\x71\x76\x62\x50','\x43\x67\x4c\x55\x7a\x30\x58\x48\x44\x67\x76\x55\x79\x33\x4c\x69\x41\x78\x6e\x30\x42\x33\x6a\x35','\x7a\x4d\x58\x56\x42\x33\x69','\x79\x32\x58\x56\x43\x32\x75','\x42\x67\x66\x5a\x44\x66\x62\x50\x42\x4d\x44\x62\x44\x61','\x43\x4e\x76\x55\x44\x67\x4c\x54\x7a\x73\x35\x59\x7a\x77\x66\x4b\x45\x71','\x43\x32\x76\x48\x43\x4d\x6e\x4f\x75\x67\x66\x59\x79\x77\x31\x5a','\x43\x32\x76\x5a\x43\x32\x4c\x56\x42\x4c\x39\x4e\x79\x78\x72\x4c\x44\x32\x66\x35\x78\x57','\x7a\x67\x76\x4e\x43\x4d\x66\x4b\x7a\x77\x71','\x7a\x67\x54\x35\x43\x78\x43','\x7a\x67\x4c\x5a\x79\x32\x39\x55\x42\x4d\x76\x4a\x44\x61','\x43\x4d\x76\x57\x42\x67\x66\x35\x75\x33\x72\x56\x43\x4d\x66\x4e\x7a\x75\x54\x4c\x45\x76\x62\x59\x7a\x77\x7a\x50\x45\x61','\x43\x4d\x76\x57\x42\x67\x66\x35\x75\x33\x72\x56\x43\x4d\x66\x4e\x7a\x71','\x43\x4e\x76\x55\x44\x67\x4c\x54\x7a\x73\x35\x55\x42\x33\x72\x46\x7a\x4d\x39\x31\x42\x4d\x71','\x42\x32\x35\x73\x7a\x78\x62\x53\x79\x78\x4c\x71\x43\x4d\x39\x4e\x43\x4d\x76\x5a\x43\x57','\x43\x67\x39\x55\x7a\x31\x72\x50\x42\x77\x76\x56\x44\x78\x71','\x43\x32\x76\x55\x7a\x66\x72\x4c\x43\x4d\x31\x50\x42\x4d\x66\x53\x73\x77\x35\x57\x44\x78\x71','\x44\x67\x39\x30\x79\x77\x57','\x41\x78\x6e\x73\x7a\x78\x62\x53\x79\x78\x4c\x50\x42\x4d\x43','\x43\x4d\x76\x57\x42\x67\x66\x35\x6c\x4e\x62\x59\x42\x32\x44\x59\x7a\x78\x6e\x5a','\x7a\x32\x76\x30\x76\x67\x39\x52\x7a\x77\x34','\x78\x31\x39\x30\x7a\x78\x6e\x30\x78\x31\x38','\x7a\x32\x76\x30\x73\x78\x72\x4c\x42\x71','\x71\x32\x39\x55\x42\x4d\x76\x4a\x44\x67\x4c\x56\x42\x49\x62\x4a\x42\x67\x39\x5a\x7a\x77\x71','\x79\x33\x76\x59\x43\x4d\x76\x55\x44\x66\x6e\x4c\x43\x33\x6e\x50\x42\x32\x35\x6a\x7a\x61','\x44\x77\x35\x5a\x44\x77\x6a\x5a\x79\x33\x6a\x50\x79\x4d\x75','\x43\x4d\x76\x5a\x7a\x78\x72\x6e\x7a\x78\x72\x59\x41\x77\x6e\x5a','\x43\x32\x76\x5a\x43\x32\x4c\x56\x42\x4b\x4c\x4b','\x43\x32\x76\x55\x7a\x66\x44\x50\x44\x67\x48\x73\x7a\x78\x6e\x57\x42\x32\x35\x5a\x7a\x71','\x42\x32\x35\x64\x42\x32\x35\x55\x7a\x77\x6e\x30','\x43\x32\x76\x30\x73\x78\x72\x4c\x42\x71','\x41\x67\x66\x55\x7a\x67\x58\x4c\x74\x33\x62\x4c\x42\x47','\x79\x32\x39\x55\x44\x67\x66\x50\x42\x4d\x76\x59\x73\x77\x71','\x42\x32\x35\x4a\x42\x67\x39\x5a\x7a\x71','\x44\x68\x6a\x48\x79\x32\x54\x73\x7a\x77\x6e\x56\x42\x4d\x35\x4c\x79\x33\x72\x50\x42\x32\x34','\x43\x67\x39\x59\x44\x63\x35\x4a\x42\x67\x39\x5a\x7a\x77\x71','\x42\x67\x66\x5a\x44\x65\x76\x32\x7a\x77\x35\x30\x73\x77\x71','\x79\x77\x44\x4c\x42\x4e\x71\x55\x7a\x78\x7a\x4c\x42\x4e\x71','\x42\x76\x4c\x62\x42\x78\x6d','\x41\x67\x66\x55\x7a\x67\x58\x4c\x75\x67\x39\x55\x7a\x57','\x7a\x67\x76\x53\x7a\x78\x72\x4c','\x42\x4d\x39\x33','\x42\x32\x35\x4c\x43\x4e\x6a\x56\x43\x47','\x7a\x67\x4c\x5a\x79\x32\x39\x55\x42\x4d\x76\x4a\x44\x67\x76\x4b','\x6e\x4a\x69\x30\x6d\x74\x62\x41\x71\x77\x35\x62\x74\x30\x57','\x7a\x77\x35\x48\x79\x4d\x58\x4c\x72\x67\x76\x4b\x44\x78\x62\x53\x41\x77\x6e\x48\x44\x67\x4c\x56\x42\x47','\x43\x32\x76\x58\x44\x77\x76\x55\x79\x32\x76\x6a\x7a\x61','\x42\x32\x35\x66\x43\x4e\x6a\x56\x43\x47','\x41\x78\x6e\x73\x7a\x77\x7a\x59\x7a\x78\x6e\x4f\x41\x77\x35\x4e\x76\x67\x39\x52\x7a\x77\x34','\x6d\x4a\x6d\x59\x6e\x4a\x65\x5a\x6e\x30\x50\x4c\x7a\x76\x44\x78\x71\x71','\x42\x67\x66\x5a\x44\x66\x62\x50\x42\x4d\x44\x74\x7a\x77\x35\x30\x71\x78\x71','\x43\x4d\x76\x5a\x42\x32\x58\x32\x7a\x71','\x7a\x32\x76\x30\x75\x33\x72\x48\x44\x67\x75','\x79\x32\x58\x4c\x79\x77\x35\x31\x43\x61','\x7a\x78\x7a\x4c\x42\x4e\x72\x5a\x75\x4d\x76\x4a\x7a\x77\x4c\x32\x7a\x77\x71','\x42\x32\x35\x64\x42\x32\x35\x30\x79\x77\x4c\x55\x7a\x78\x6a\x73\x7a\x77\x66\x4b\x45\x71','\x79\x32\x39\x4b\x7a\x71','\x41\x78\x6e\x64\x42\x32\x35\x55\x7a\x77\x6e\x30\x7a\x77\x71','\x45\x66\x6e\x51\x44\x78\x65','\x41\x67\x66\x55\x7a\x67\x58\x4c\x71\x32\x58\x56\x43\x32\x75','\x43\x67\x4c\x55\x7a\x30\x4c\x55\x44\x67\x76\x59\x44\x4d\x66\x53','\x7a\x78\x48\x4c\x79\x33\x76\x30\x41\x77\x39\x55\x78\x32\x4c\x4b','\x43\x32\x76\x55\x7a\x66\x62\x50\x42\x4d\x43','\x42\x67\x66\x5a\x44\x66\x39\x4c\x44\x4d\x76\x55\x44\x66\x39\x50\x7a\x61','\x79\x4d\x66\x5a\x7a\x76\x76\x59\x42\x61','\x43\x33\x72\x56\x43\x66\x62\x50\x42\x4d\x44\x6a\x42\x4e\x72\x4c\x43\x4e\x7a\x48\x42\x61','\x41\x68\x4c\x57\x74\x75\x75','\x79\x4e\x6a\x72\x79\x32\x69','\x42\x77\x66\x34\x75\x4d\x76\x4a\x42\x32\x35\x55\x7a\x77\x6e\x30\x72\x67\x76\x53\x79\x78\x4c\x6e\x43\x57','\x7a\x32\x39\x56\x7a\x61','\x42\x78\x6e\x4e\x78\x57','\x43\x4d\x76\x57\x42\x67\x66\x35\x6c\x4e\x6e\x30\x79\x78\x6a\x30','\x74\x67\x6e\x59\x43\x32\x38','\x76\x67\x39\x52\x7a\x77\x34\x47\x43\x4d\x76\x4d\x43\x4d\x76\x5a\x41\x67\x76\x4b','\x43\x67\x39\x55\x7a\x57','\x41\x67\x31\x67\x72\x4d\x47','\x42\x77\x76\x5a\x43\x32\x66\x4e\x7a\x71','\x6d\x74\x79\x57\x6d\x64\x71\x30\x44\x76\x6a\x48\x42\x4e\x6e\x55','\x42\x77\x4c\x55','\x41\x67\x66\x5a\x71\x32\x39\x55\x42\x4d\x76\x4a\x44\x67\x76\x4b\x71\x4d\x76\x4d\x42\x33\x6a\x4c','\x43\x67\x4c\x55\x7a\x30\x4c\x55\x44\x67\x76\x59\x44\x4d\x66\x53\x74\x78\x6d','\x6e\x4a\x71\x31\x6f\x64\x69\x35\x6d\x75\x76\x72\x41\x4c\x44\x71\x41\x71','\x43\x67\x39\x59\x44\x61','\x7a\x78\x48\x4c\x79\x33\x76\x30\x41\x77\x39\x55\x73\x77\x71','\x7a\x32\x76\x30\x75\x33\x72\x48\x44\x68\x6d','\x79\x32\x39\x55\x42\x4d\x76\x4a\x44\x67\x4c\x55\x7a\x57','\x43\x32\x76\x5a\x43\x32\x4c\x56\x42\x4c\x39\x50\x7a\x61','\x79\x33\x76\x59\x43\x4d\x76\x55\x44\x65\x76\x34\x7a\x77\x6e\x31\x44\x67\x4c\x56\x42\x4b\x4c\x4b','\x7a\x67\x4c\x5a\x43\x67\x66\x30\x79\x32\x48\x6e\x7a\x78\x6e\x5a\x79\x77\x44\x4c','\x42\x32\x35\x75\x42\x32\x54\x4c\x42\x4b\x76\x34\x43\x67\x4c\x59\x7a\x77\x71','\x43\x4d\x76\x4a\x42\x32\x35\x55\x7a\x77\x6e\x30\x76\x67\x4c\x54\x7a\x78\x69','\x42\x32\x35\x73\x44\x77\x35\x30\x41\x77\x31\x4c\x75\x4d\x76\x48\x7a\x68\x4b','\x7a\x77\x35\x48\x79\x4d\x58\x4c\x75\x4d\x76\x57\x42\x67\x66\x35\x75\x67\x76\x59\x43\x32\x4c\x5a\x44\x67\x76\x55\x79\x32\x75','\x42\x67\x66\x5a\x44\x66\x62\x56\x42\x4d\x44\x62\x44\x61','\x42\x77\x66\x34\x74\x77\x4c\x5a\x43\x32\x76\x4b\x75\x67\x39\x55\x7a\x33\x6d','\x79\x4b\x72\x33\x77\x67\x53','\x7a\x32\x76\x30\x71\x32\x39\x55\x42\x4d\x76\x4a\x44\x67\x4c\x56\x42\x4c\x66\x31\x79\x77\x58\x50\x44\x68\x4b','\x42\x77\x4c\x5a\x43\x32\x76\x4b\x75\x67\x39\x55\x7a\x30\x6e\x56\x44\x77\x35\x30','\x42\x32\x35\x75\x42\x32\x54\x4c\x42\x4c\x6a\x4c\x7a\x4e\x6a\x4c\x43\x32\x47','\x7a\x32\x76\x30\x75\x4d\x76\x57\x42\x67\x66\x35\x75\x33\x72\x48\x44\x67\x75','\x73\x78\x6a\x4b\x42\x30\x43','\x42\x77\x76\x5a\x43\x32\x66\x4e\x7a\x78\x6e\x74\x7a\x77\x35\x30','\x74\x65\x6e\x41\x42\x75\x47','\x42\x32\x35\x73\x44\x77\x35\x30\x41\x77\x31\x4c\x74\x4d\x39\x30\x72\x4d\x39\x31\x42\x4d\x71','\x73\x4b\x58\x48\x42\x4c\x6d','\x79\x32\x48\x48\x42\x4d\x35\x4c\x42\x61','\x7a\x32\x76\x30','\x79\x32\x58\x4c\x79\x78\x6a\x73\x7a\x78\x62\x53\x79\x78\x4c\x74\x44\x67\x66\x30\x7a\x71','\x43\x4d\x76\x4a\x42\x32\x35\x55\x7a\x77\x6e\x30\x71\x32\x39\x31\x42\x4e\x71','\x44\x32\x66\x36\x77\x78\x43','\x43\x32\x4c\x4b\x7a\x77\x6e\x48\x43\x4b\x4c\x4b','\x44\x78\x62\x4b\x79\x78\x72\x4c\x71\x32\x39\x55\x42\x4d\x76\x4a\x44\x67\x4c\x56\x42\x4c\x66\x31\x79\x77\x58\x50\x44\x68\x4b','\x43\x4d\x76\x57\x42\x67\x66\x35\x6c\x4d\x6e\x56\x42\x78\x62\x53\x7a\x78\x72\x4c','\x43\x32\x48\x50\x7a\x4e\x71','\x42\x32\x35\x73\x7a\x77\x6e\x56\x42\x4d\x35\x4c\x79\x33\x71','\x79\x78\x76\x30\x42\x31\x6a\x4c\x79\x32\x39\x55\x42\x4d\x76\x4a\x44\x61','\x42\x32\x6a\x51\x7a\x77\x6e\x30','\x72\x65\x48\x33\x76\x32\x38','\x41\x32\x76\x35\x43\x57','\x43\x32\x76\x55\x7a\x61','\x79\x76\x6e\x32\x41\x68\x47','\x43\x4e\x76\x55\x44\x67\x4c\x54\x7a\x73\x35\x4a\x42\x32\x35\x55\x7a\x77\x6e\x30\x7a\x77\x71','\x43\x4d\x76\x4a\x7a\x77\x4c\x32\x7a\x77\x71','\x43\x4d\x76\x48\x7a\x68\x4c\x74\x44\x67\x66\x30\x7a\x71','\x42\x32\x35\x56\x43\x67\x76\x55','\x42\x32\x35\x63\x79\x77\x6e\x52\x43\x68\x6a\x4c\x43\x33\x6e\x31\x43\x4d\x76\x78\x79\x78\x6a\x55\x41\x77\x35\x4e','\x42\x77\x66\x34\x75\x4d\x76\x4a\x42\x32\x35\x55\x7a\x77\x6e\x30\x71\x78\x72\x30\x7a\x77\x31\x57\x44\x68\x6d','\x75\x67\x39\x55\x7a\x59\x62\x30\x41\x77\x31\x4c\x42\x33\x76\x30\x69\x63\x30\x47\x79\x32\x39\x55\x42\x4d\x76\x4a\x44\x67\x4c\x56\x42\x49\x62\x31\x42\x4e\x6a\x4c\x43\x33\x62\x56\x42\x4e\x6e\x50\x44\x4d\x75','\x79\x4d\x66\x4a\x41\x33\x62\x59\x7a\x78\x6e\x5a\x44\x78\x6a\x4c\x6c\x4e\x44\x48\x43\x4d\x35\x50\x42\x4d\x43','\x42\x32\x35\x6e\x7a\x78\x72\x59\x41\x77\x6e\x5a\x71\x32\x48\x48\x42\x4d\x44\x4c','\x72\x4c\x76\x52\x71\x77\x30','\x44\x78\x62\x4b\x79\x78\x72\x4c\x76\x67\x39\x52\x7a\x77\x34','\x44\x78\x6a\x53','\x76\x65\x39\x6c\x72\x75\x35\x46\x75\x4b\x76\x67\x75\x4b\x76\x74\x73\x66\x39\x67\x71\x75\x4c\x6d\x72\x75\x71','\x41\x67\x66\x5a','\x44\x67\x39\x52\x7a\x77\x34\x55\x7a\x78\x48\x57\x41\x78\x6a\x4c\x7a\x61','\x43\x4d\x66\x55\x7a\x67\x39\x54','\x79\x32\x39\x55\x44\x67\x66\x50\x42\x4d\x76\x59\x6c\x4e\x6a\x4c\x79\x77\x72\x35\x69\x67\x76\x32\x7a\x77\x35\x30\x69\x68\x6a\x4c\x79\x32\x76\x50\x44\x4d\x76\x4b\x69\x68\x44\x50\x44\x67\x48\x56\x44\x78\x71\x47\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x65\x4c\x4b','\x72\x4d\x6e\x63\x44\x4d\x65','\x43\x4d\x76\x57\x42\x67\x66\x35\x75\x68\x6a\x56\x7a\x33\x6a\x4c\x43\x33\x6d','\x43\x68\x6a\x56\x44\x67\x39\x4a\x42\x32\x57','\x43\x4d\x76\x5a\x44\x67\x39\x59\x7a\x76\x6e\x31\x79\x4e\x6e\x4a\x43\x4d\x4c\x57\x44\x67\x4c\x56\x42\x4e\x6d','\x74\x76\x50\x58\x76\x4b\x65','\x43\x67\x39\x56\x43\x47','\x79\x32\x39\x55\x44\x67\x66\x50\x42\x4d\x76\x59\x6c\x4e\x6a\x4c\x79\x77\x72\x35','\x79\x33\x76\x59\x43\x4d\x76\x55\x44\x66\x72\x56\x41\x32\x76\x55','\x43\x4d\x76\x51\x7a\x77\x6e\x30','\x44\x66\x66\x4c\x41\x65\x47','\x44\x67\x39\x74\x44\x68\x6a\x50\x42\x4d\x43','\x44\x68\x6a\x48\x42\x4e\x6e\x57\x42\x33\x6a\x30','\x43\x32\x76\x4a\x42\x32\x35\x4b\x43\x31\x6a\x4c\x42\x77\x66\x50\x42\x4d\x4c\x55\x7a\x57','\x43\x68\x76\x5a\x41\x61','\x75\x4d\x44\x4b\x7a\x68\x47','\x43\x4d\x76\x54\x42\x33\x7a\x4c\x73\x78\x72\x4c\x42\x71','\x73\x68\x76\x6b\x71\x77\x43','\x6d\x74\x69\x31\x6d\x64\x71\x5a\x6d\x4d\x66\x35\x42\x32\x6e\x6b\x74\x61','\x7a\x30\x31\x49\x71\x4d\x57','\x44\x78\x62\x4b\x79\x78\x72\x4c\x71\x32\x39\x55\x42\x4d\x76\x4a\x44\x67\x4c\x56\x42\x4b\x31\x4c\x44\x68\x6a\x50\x79\x33\x6d','\x44\x68\x4c\x57\x7a\x71','\x7a\x78\x48\x4a\x7a\x77\x58\x53\x7a\x77\x35\x30','\x43\x32\x4c\x55\x79\x32\x75','\x43\x33\x72\x48\x44\x67\x75','\x43\x68\x6a\x56\x79\x32\x76\x5a\x43\x32\x76\x4b\x72\x78\x7a\x4c\x42\x4e\x72\x6a\x7a\x68\x6d','\x44\x32\x54\x67\x41\x66\x79','\x41\x78\x50\x65\x74\x32\x69','\x43\x4d\x76\x4a\x42\x32\x35\x55\x7a\x77\x6e\x30\x71\x78\x72\x30\x7a\x77\x31\x57\x44\x68\x6d','\x43\x32\x66\x32\x7a\x76\x6a\x4c\x43\x67\x58\x48\x45\x76\x6e\x30\x79\x78\x72\x4c','\x7a\x67\x66\x30\x79\x71','\x43\x67\x4c\x55\x7a\x57','\x41\x4e\x66\x48\x42\x4c\x65','\x44\x31\x4c\x56\x79\x4c\x69','\x43\x32\x76\x30','\x41\x67\x66\x55\x7a\x67\x58\x4c\x74\x77\x76\x5a\x43\x32\x66\x4e\x7a\x71','\x43\x67\x76\x55\x7a\x67\x4c\x55\x7a\x30\x6e\x48\x42\x67\x58\x49\x79\x77\x6e\x52\x43\x57','\x44\x67\x39\x52\x7a\x77\x34','\x44\x67\x76\x59\x42\x77\x4c\x55\x79\x77\x57\x55\x41\x77\x35\x57\x44\x78\x71','\x42\x32\x35\x62\x7a\x32\x76\x55\x44\x65\x76\x32\x7a\x77\x35\x30','\x43\x78\x76\x48\x42\x67\x4c\x30\x45\x71','\x43\x4d\x76\x48\x43\x32\x39\x55','\x75\x31\x50\x6f\x7a\x65\x6d','\x6e\x4a\x61\x5a\x79\x75\x58\x57\x43\x67\x76\x6a','\x43\x33\x76\x49\x43\x32\x6e\x59\x41\x77\x6a\x4c','\x74\x78\x6a\x67\x76\x66\x65','\x41\x4d\x7a\x34\x79\x4c\x61','\x79\x32\x39\x55\x42\x4d\x76\x4a\x44\x67\x4c\x56\x42\x4b\x31\x4c\x44\x68\x6a\x50\x79\x33\x6d','\x45\x4b\x7a\x4f\x76\x76\x65','\x79\x32\x39\x55\x42\x4d\x76\x4a\x44\x61','\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x65\x4c\x4b','\x71\x32\x58\x50\x7a\x77\x35\x30\x69\x67\x72\x50\x43\x32\x6e\x56\x42\x4d\x35\x4c\x79\x33\x71','\x76\x78\x4c\x6c\x44\x66\x79','\x42\x32\x35\x74\x44\x67\x66\x30\x7a\x75\x6e\x4f\x79\x77\x35\x4e\x7a\x71','\x75\x4d\x76\x58\x44\x77\x76\x5a\x44\x63\x62\x30\x41\x77\x31\x4c\x42\x33\x76\x30','\x45\x4b\x4c\x54\x42\x32\x4f','\x7a\x68\x6a\x56\x43\x68\x62\x4c\x7a\x65\x6e\x56\x44\x77\x35\x30','\x43\x32\x4c\x36\x7a\x71','\x42\x32\x35\x75\x42\x32\x54\x4c\x42\x4b\x76\x34\x43\x67\x4c\x59\x41\x77\x35\x4e','\x79\x77\x35\x32\x42\x4d\x47','\x43\x67\x39\x55\x7a\x31\x72\x50\x42\x77\x76\x56\x44\x78\x72\x6e\x43\x57','\x7a\x78\x6a\x59\x42\x33\x69','\x79\x32\x58\x4c\x79\x78\x6a\x71\x42\x32\x35\x4e\x76\x67\x4c\x54\x7a\x77\x39\x31\x44\x61','\x42\x67\x66\x30\x7a\x77\x35\x4a\x45\x75\x48\x50\x43\x33\x72\x56\x43\x4e\x4c\x74\x41\x78\x50\x4c','\x42\x77\x76\x5a\x43\x32\x66\x4e\x7a\x78\x6e\x73\x7a\x77\x6e\x4c\x41\x78\x7a\x4c\x7a\x61','\x41\x76\x76\x59\x72\x33\x69','\x79\x32\x39\x55\x42\x4d\x76\x4a\x44\x66\x44\x4c\x79\x4c\x6e\x56\x79\x32\x54\x4c\x44\x61','\x6e\x4d\x58\x6f\x73\x4b\x54\x79\x42\x71','\x44\x33\x6a\x34\x73\x67\x6d','\x43\x33\x72\x48\x43\x4e\x72\x71\x41\x77\x35\x4e\x73\x77\x35\x30\x7a\x78\x6a\x32\x79\x77\x57','\x43\x33\x72\x56\x43\x4d\x75','\x41\x77\x35\x32\x79\x77\x58\x50\x7a\x66\x39\x57\x79\x78\x4c\x53\x42\x32\x66\x4b','\x42\x67\x76\x55\x7a\x33\x72\x4f','\x41\x67\x66\x55\x7a\x67\x58\x4c\x43\x4e\x6d','\x79\x32\x39\x55\x7a\x4d\x4c\x4e','\x72\x68\x72\x64\x41\x33\x47','\x43\x33\x72\x59\x41\x77\x35\x4e\x41\x77\x7a\x35','\x42\x67\x39\x48\x7a\x66\x6a\x4c\x43\x67\x58\x48\x45\x76\x6e\x30\x79\x78\x72\x4c','\x71\x30\x76\x6c\x7a\x68\x71','\x6e\x64\x6d\x32\x6f\x64\x43\x34\x6d\x68\x6e\x30\x44\x33\x48\x73\x72\x61','\x7a\x32\x58\x30\x41\x32\x4b','\x79\x32\x39\x55\x42\x4d\x76\x4a\x44\x67\x4c\x56\x42\x49\x35\x4c\x43\x33\x72\x48\x79\x4d\x58\x50\x43\x32\x48\x4c\x7a\x61','\x75\x30\x72\x65\x75\x33\x4f'];a0_0xd60c=function(){return _0x1f146a;};return a0_0xd60c();}const DEFAULT_CONFIG={'\x74\x72\x61\x6e\x73\x70\x6f\x72\x74':'\x77\x65\x62\x73\x6f\x63\x6b\x65\x74','\x63\x68\x61\x6e\x6e\x65\x6c\x73':['\x2a'],'\x61\x75\x74\x6f\x52\x65\x63\x6f\x6e\x6e\x65\x63\x74':!![],'\x6d\x61\x78\x52\x65\x63\x6f\x6e\x6e\x65\x63\x74\x41\x74\x74\x65\x6d\x70\x74\x73':0xa,'\x69\x6e\x69\x74\x69\x61\x6c\x52\x65\x63\x6f\x6e\x6e\x65\x63\x74\x44\x65\x6c\x61\x79\x4d\x73':0x3e8,'\x6d\x61\x78\x52\x65\x63\x6f\x6e\x6e\x65\x63\x74\x44\x65\x6c\x61\x79\x4d\x73':0x7530,'\x70\x69\x6e\x67\x49\x6e\x74\x65\x72\x76\x61\x6c\x4d\x73':0x7530,'\x70\x6f\x6e\x67\x54\x69\x6d\x65\x6f\x75\x74\x4d\x73':0x2710,'\x6d\x61\x78\x4d\x69\x73\x73\x65\x64\x50\x6f\x6e\x67\x73':0x2,'\x65\x6e\x61\x62\x6c\x65\x44\x65\x64\x75\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e':!![],'\x6d\x61\x78\x44\x65\x64\x75\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e\x53\x69\x7a\x65':0x3e8,'\x65\x6e\x61\x62\x6c\x65\x52\x65\x70\x6c\x61\x79\x50\x65\x72\x73\x69\x73\x74\x65\x6e\x63\x65':![],'\x72\x65\x70\x6c\x61\x79\x53\x74\x6f\x72\x61\x67\x65\x4b\x65\x79\x50\x72\x65\x66\x69\x78':a0_0x51a297(0x203),'\x6c\x61\x74\x65\x6e\x63\x79\x48\x69\x73\x74\x6f\x72\x79\x53\x69\x7a\x65':0xa},STORAGE_KEYS={'\x6c\x61\x73\x74\x45\x76\x65\x6e\x74\x49\x64':a0_0x51a297(0x23b),'\x65\x78\x65\x63\x75\x74\x69\x6f\x6e\x49\x64':a0_0x51a297(0x239),'\x73\x65\x73\x73\x69\x6f\x6e\x49\x64':a0_0x51a297(0x252)},WIRE_TYPE_MAP={'\x73\x69\x64\x65\x63\x61\x72\x2e\x63\x6f\x6e\x6e\x65\x63\x74\x65\x64':a0_0x51a297(0x185),'\x73\x69\x64\x65\x63\x61\x72\x2e\x64\x69\x73\x63\x6f\x6e\x6e\x65\x63\x74\x65\x64':a0_0x51a297(0x1f0),'\x73\x69\x64\x65\x63\x61\x72\x2e\x6e\x6f\x74\x5f\x66\x6f\x75\x6e\x64':a0_0x51a297(0x209),'\x73\x69\x64\x65\x63\x61\x72\x2e\x72\x65\x61\x64\x79':a0_0x51a297(0x201)};var MemoryStorage=class{['\x73\x74\x6f\x72\x65']=new Map();[a0_0x51a297(0x212)](_0x4f9685){const _0x209711=a0_0x51a297;return this[_0x209711(0x1db)][_0x209711(0x266)](_0x4f9685)??null;}[a0_0x51a297(0x21a)](_0x45e5bd,_0x2bf439){const _0x4b51eb=a0_0x51a297;this[_0x4b51eb(0x1db)][_0x4b51eb(0x1b7)](_0x45e5bd,_0x2bf439);}[a0_0x51a297(0x1a5)](_0x329705){const _0x1071e3=a0_0x51a297;this[_0x1071e3(0x1db)][_0x1071e3(0x224)](_0x329705);}},SessionGatewayClient=class{['\x77\x73']=null;[a0_0x51a297(0x1df)];[a0_0x51a297(0x1de)];[a0_0x51a297(0x19d)];['\x69\x73\x52\x65\x66\x72\x65\x73\x68\x69\x6e\x67\x54\x6f\x6b\x65\x6e']=![];[a0_0x51a297(0x1ad)]=a0_0x51a297(0x227);['\x63\x6f\x6e\x6e\x65\x63\x74\x65\x64\x41\x74']=null;[a0_0x51a297(0x24b)]=![];[a0_0x51a297(0x200)]=null;[a0_0x51a297(0x259)]=null;['\x6c\x61\x73\x74\x50\x69\x6e\x67\x53\x65\x6e\x74\x41\x74']=null;[a0_0x51a297(0x25d)]=0x0;[a0_0x51a297(0x1b1)]=0x0;[a0_0x51a297(0x1d5)]=0x0;[a0_0x51a297(0x261)]=0x0;['\x65\x76\x65\x6e\x74\x73\x52\x65\x63\x65\x69\x76\x65\x64']=0x0;[a0_0x51a297(0x1ea)]=0x0;[a0_0x51a297(0x256)]=null;['\x70\x69\x6e\x67\x49\x6e\x74\x65\x72\x76\x61\x6c']=null;[a0_0x51a297(0x20b)]=null;[a0_0x51a297(0x1b9)]=new Map();['\x6d\x65\x73\x73\x61\x67\x65\x49\x64\x43\x6f\x75\x6e\x74\x65\x72']=0x0;[a0_0x51a297(0x1ae)]=new Set();[a0_0x51a297(0x1fd)]=[];[a0_0x51a297(0x1c4)]={...INITIAL_METRICS};[a0_0x51a297(0x220)]=null;[a0_0x51a297(0x253)]=null;['\x63\x75\x72\x72\x65\x6e\x74\x53\x65\x73\x73\x69\x6f\x6e\x49\x64']=null;[a0_0x51a297(0x20e)]=![];[a0_0x51a297(0x197)]={'\x74\x6f\x74\x61\x6c':0x0,'\x72\x65\x63\x65\x69\x76\x65\x64':0x0};constructor(_0x4c56f0){const _0xeb0135=a0_0x51a297,_0x50b617={'\x52\x67\x64\x64\x78':function(_0x40e62d,_0x184ae5){return _0x40e62d!==_0x184ae5;},'\x69\x4f\x44\x71\x55':'\x6c\x6f\x63\x61\x6c\x53\x74\x6f\x72\x61\x67\x65','\x77\x72\x78\x48\x63':_0xeb0135(0x211)};let _0x5cf6fe;if(_0x4c56f0[_0xeb0135(0x208)])_0x5cf6fe=_0x4c56f0[_0xeb0135(0x208)];else{if(_0x50b617[_0xeb0135(0x1a4)](typeof globalThis,_0xeb0135(0x1fa))&&_0x50b617[_0xeb0135(0x1f9)]in globalThis)try{const _0x25980=_0x50b617[_0xeb0135(0x1d9)];localStorage['\x73\x65\x74\x49\x74\x65\x6d'](_0x25980,_0x25980),localStorage[_0xeb0135(0x1a5)](_0x25980),_0x5cf6fe=localStorage;}catch{_0x5cf6fe=new MemoryStorage();}else _0x5cf6fe=new MemoryStorage();}this['\x63\x6f\x6e\x66\x69\x67']={'\x75\x72\x6c':_0x4c56f0[_0xeb0135(0x190)],'\x73\x65\x73\x73\x69\x6f\x6e\x49\x64':_0x4c56f0['\x73\x65\x73\x73\x69\x6f\x6e\x49\x64'],'\x74\x6f\x6b\x65\x6e':_0x4c56f0[_0xeb0135(0x1ba)],'\x6f\x6e\x54\x6f\x6b\x65\x6e\x52\x65\x66\x72\x65\x73\x68':_0x4c56f0[_0xeb0135(0x25e)],'\x74\x72\x61\x6e\x73\x70\x6f\x72\x74':_0x4c56f0[_0xeb0135(0x1a1)]??DEFAULT_CONFIG[_0xeb0135(0x1a1)],'\x63\x68\x61\x6e\x6e\x65\x6c\x73':_0x4c56f0[_0xeb0135(0x1f8)]??DEFAULT_CONFIG['\x63\x68\x61\x6e\x6e\x65\x6c\x73'],'\x61\x75\x74\x6f\x52\x65\x63\x6f\x6e\x6e\x65\x63\x74':_0x4c56f0[_0xeb0135(0x17f)]??DEFAULT_CONFIG[_0xeb0135(0x17f)],'\x6d\x61\x78\x52\x65\x63\x6f\x6e\x6e\x65\x63\x74\x41\x74\x74\x65\x6d\x70\x74\x73':_0x4c56f0[_0xeb0135(0x18a)]??DEFAULT_CONFIG[_0xeb0135(0x18a)],'\x69\x6e\x69\x74\x69\x61\x6c\x52\x65\x63\x6f\x6e\x6e\x65\x63\x74\x44\x65\x6c\x61\x79\x4d\x73':_0x4c56f0[_0xeb0135(0x1fb)]??DEFAULT_CONFIG[_0xeb0135(0x1fb)],'\x6d\x61\x78\x52\x65\x63\x6f\x6e\x6e\x65\x63\x74\x44\x65\x6c\x61\x79\x4d\x73':_0x4c56f0[_0xeb0135(0x240)]??DEFAULT_CONFIG['\x6d\x61\x78\x52\x65\x63\x6f\x6e\x6e\x65\x63\x74\x44\x65\x6c\x61\x79\x4d\x73'],'\x70\x69\x6e\x67\x49\x6e\x74\x65\x72\x76\x61\x6c\x4d\x73':_0x4c56f0[_0xeb0135(0x24c)]??DEFAULT_CONFIG['\x70\x69\x6e\x67\x49\x6e\x74\x65\x72\x76\x61\x6c\x4d\x73'],'\x70\x6f\x6e\x67\x54\x69\x6d\x65\x6f\x75\x74\x4d\x73':_0x4c56f0[_0xeb0135(0x1d1)]??DEFAULT_CONFIG[_0xeb0135(0x1d1)],'\x6d\x61\x78\x4d\x69\x73\x73\x65\x64\x50\x6f\x6e\x67\x73':_0x4c56f0[_0xeb0135(0x25a)]??DEFAULT_CONFIG[_0xeb0135(0x25a)],'\x65\x6e\x61\x62\x6c\x65\x44\x65\x64\x75\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e':_0x4c56f0[_0xeb0135(0x229)]??DEFAULT_CONFIG[_0xeb0135(0x229)],'\x6d\x61\x78\x44\x65\x64\x75\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e\x53\x69\x7a\x65':_0x4c56f0[_0xeb0135(0x1f5)]??DEFAULT_CONFIG[_0xeb0135(0x1f5)],'\x65\x6e\x61\x62\x6c\x65\x52\x65\x70\x6c\x61\x79\x50\x65\x72\x73\x69\x73\x74\x65\x6e\x63\x65':_0x4c56f0['\x65\x6e\x61\x62\x6c\x65\x52\x65\x70\x6c\x61\x79\x50\x65\x72\x73\x69\x73\x74\x65\x6e\x63\x65']??DEFAULT_CONFIG['\x65\x6e\x61\x62\x6c\x65\x52\x65\x70\x6c\x61\x79\x50\x65\x72\x73\x69\x73\x74\x65\x6e\x63\x65'],'\x72\x65\x70\x6c\x61\x79\x53\x74\x6f\x72\x61\x67\x65':_0x5cf6fe,'\x72\x65\x70\x6c\x61\x79\x53\x74\x6f\x72\x61\x67\x65\x4b\x65\x79\x50\x72\x65\x66\x69\x78':_0x4c56f0['\x72\x65\x70\x6c\x61\x79\x53\x74\x6f\x72\x61\x67\x65\x4b\x65\x79\x50\x72\x65\x66\x69\x78']??DEFAULT_CONFIG[_0xeb0135(0x207)],'\x6c\x61\x74\x65\x6e\x63\x79\x48\x69\x73\x74\x6f\x72\x79\x53\x69\x7a\x65':_0x4c56f0[_0xeb0135(0x1d4)]??DEFAULT_CONFIG['\x6c\x61\x74\x65\x6e\x63\x79\x48\x69\x73\x74\x6f\x72\x79\x53\x69\x7a\x65']},this['\x68\x61\x6e\x64\x6c\x65\x72\x73']=_0x4c56f0[_0xeb0135(0x1de)]??{},this[_0xeb0135(0x19d)]=_0x4c56f0[_0xeb0135(0x1ba)];if(this[_0xeb0135(0x1df)][_0xeb0135(0x258)])this[_0xeb0135(0x1e2)]();}[a0_0x51a297(0x1c6)](){const _0x3f9b53=a0_0x51a297,_0x559379={'\x53\x5a\x4e\x64\x43':function(_0x2b74df,_0x2e3891){return _0x2b74df===_0x2e3891;},'\x64\x6b\x79\x71\x77':_0x3f9b53(0x251),'\x77\x6b\x46\x68\x56':'\x72\x65\x63\x6f\x6e\x6e\x65\x63\x74\x69\x6e\x67'};if(_0x559379[_0x3f9b53(0x1bf)](this[_0x3f9b53(0x1ad)],_0x3f9b53(0x1ed))||_0x559379['\x53\x5a\x4e\x64\x43'](this[_0x3f9b53(0x1ad)],_0x559379[_0x3f9b53(0x205)]))return;const _0x2a6777=this[_0x3f9b53(0x24b)];this[_0x3f9b53(0x1f1)](_0x2a6777?_0x559379[_0x3f9b53(0x1af)]:_0x559379[_0x3f9b53(0x205)]),this[_0x3f9b53(0x1d7)]();}[a0_0x51a297(0x1d7)](){const _0x3b5c6b=a0_0x51a297,_0xdd2245=new URL(this[_0x3b5c6b(0x1df)][_0x3b5c6b(0x190)]);_0xdd2245[_0x3b5c6b(0x202)][_0x3b5c6b(0x1b7)]('\x74\x6f\x6b\x65\x6e',this[_0x3b5c6b(0x19d)]),this['\x77\x73']=new WebSocket(_0xdd2245[_0x3b5c6b(0x1a0)]()),this['\x77\x73'][_0x3b5c6b(0x188)]=()=>this['\x68\x61\x6e\x64\x6c\x65\x4f\x70\x65\x6e'](),this['\x77\x73'][_0x3b5c6b(0x21d)]=_0x4525fd=>this[_0x3b5c6b(0x237)](_0x4525fd[_0x3b5c6b(0x234)],_0x4525fd[_0x3b5c6b(0x1be)]),this['\x77\x73'][_0x3b5c6b(0x226)]=_0x27f15d=>{},this['\x77\x73']['\x6f\x6e\x6d\x65\x73\x73\x61\x67\x65']=_0x4da630=>this[_0x3b5c6b(0x1b8)](_0x4da630[_0x3b5c6b(0x1b3)]);}[a0_0x51a297(0x206)](){const _0x2bacaf=a0_0x51a297,_0x3066d4={'\x6d\x46\x48\x55\x41':_0x2bacaf(0x1c8),'\x78\x4d\x49\x4d\x76':_0x2bacaf(0x227)};this[_0x2bacaf(0x231)](),this['\x77\x73']&&(this['\x77\x73'][_0x2bacaf(0x1ff)](0x3e8,_0x3066d4['\x6d\x46\x48\x55\x41']),this['\x77\x73']=null),this[_0x2bacaf(0x1f1)](_0x3066d4['\x78\x4d\x49\x4d\x76']);}async[a0_0x51a297(0x1c1)](_0x12287d){const _0xc1b3=a0_0x51a297,_0x3e0582={'\x53\x44\x44\x53\x7a':'\x73\x75\x62\x73\x63\x72\x69\x62\x65'};return(await this[_0xc1b3(0x218)]({'\x74\x79\x70\x65':_0x3e0582[_0xc1b3(0x1e7)],'\x63\x68\x61\x6e\x6e\x65\x6c\x73':_0x12287d}))[_0xc1b3(0x1f8)];}async[a0_0x51a297(0x215)](_0x5cb49f){const _0x51919d=a0_0x51a297;return(await this[_0x51919d(0x218)]({'\x74\x79\x70\x65':_0x51919d(0x215),'\x63\x68\x61\x6e\x6e\x65\x6c\x73':_0x5cb49f}))[_0x51919d(0x1f8)];}async['\x70\x69\x6e\x67'](){const _0x2c3bfe=a0_0x51a297,_0x427868={'\x41\x76\x74\x4a\x75':function(_0x4f637f,_0x4d7ec5){return _0x4f637f-_0x4d7ec5;}},_0x23054b=Date['\x6e\x6f\x77']();return await this[_0x2c3bfe(0x218)]({'\x74\x79\x70\x65':'\x70\x69\x6e\x67'}),_0x427868['\x41\x76\x74\x4a\x75'](Date['\x6e\x6f\x77'](),_0x23054b);}['\x72\x65\x70\x6c\x61\x79'](_0xb1f6cf){this['\x73\x65\x6e\x64']({'\x74\x79\x70\x65':'\x72\x65\x70\x6c\x61\x79','\x73\x69\x6e\x63\x65':_0xb1f6cf});}[a0_0x51a297(0x20c)](_0x3de50e,_0x18cfa2){const _0x454a7b=a0_0x51a297;if(!this['\x69\x73\x43\x6f\x6e\x6e\x65\x63\x74\x65\x64']())return![];return this[_0x454a7b(0x183)]({'\x74\x79\x70\x65':_0x454a7b(0x1bb),'\x64\x61\x74\x61':{'\x74\x65\x72\x6d\x69\x6e\x61\x6c\x49\x64':_0x3de50e,'\x69\x6e\x70\x75\x74':_0x18cfa2}}),!![];}[a0_0x51a297(0x1ec)](_0x4225da,_0x47d119){const _0x2585b1=a0_0x51a297;this[_0x2585b1(0x214)]=_0x4225da;if(_0x47d119)this[_0x2585b1(0x253)]=_0x47d119;this[_0x2585b1(0x1b2)]();}[a0_0x51a297(0x267)](){const _0x2ee9d1=a0_0x51a297,_0x1bff84={'\x48\x75\x4a\x41\x67':function(_0x3dffc6,_0x573450){return _0x3dffc6+_0x573450;}};this[_0x2ee9d1(0x220)]=null,this[_0x2ee9d1(0x253)]=null,this[_0x2ee9d1(0x214)]=null,this[_0x2ee9d1(0x20e)]=![],this['\x72\x65\x70\x6c\x61\x79\x50\x72\x6f\x67\x72\x65\x73\x73']={'\x74\x6f\x74\x61\x6c':0x0,'\x72\x65\x63\x65\x69\x76\x65\x64':0x0},this[_0x2ee9d1(0x1ae)][_0x2ee9d1(0x1eb)](),this[_0x2ee9d1(0x1ea)]=0x0;if(this[_0x2ee9d1(0x1df)][_0x2ee9d1(0x258)]){const _0x7d841f=this['\x63\x6f\x6e\x66\x69\x67'][_0x2ee9d1(0x207)];try{this['\x63\x6f\x6e\x66\x69\x67']['\x72\x65\x70\x6c\x61\x79\x53\x74\x6f\x72\x61\x67\x65']['\x72\x65\x6d\x6f\x76\x65\x49\x74\x65\x6d'](_0x7d841f+STORAGE_KEYS['\x6c\x61\x73\x74\x45\x76\x65\x6e\x74\x49\x64']),this[_0x2ee9d1(0x1df)][_0x2ee9d1(0x208)][_0x2ee9d1(0x1a5)](_0x1bff84[_0x2ee9d1(0x1a6)](_0x7d841f,STORAGE_KEYS[_0x2ee9d1(0x24f)])),this[_0x2ee9d1(0x1df)]['\x72\x65\x70\x6c\x61\x79\x53\x74\x6f\x72\x61\x67\x65'][_0x2ee9d1(0x1a5)](_0x7d841f+STORAGE_KEYS['\x73\x65\x73\x73\x69\x6f\x6e\x49\x64']);}catch{}}}[a0_0x51a297(0x25f)](){const _0x452a51=a0_0x51a297;return{'\x69\x73\x52\x65\x70\x6c\x61\x79\x69\x6e\x67':this[_0x452a51(0x20e)],'\x70\x72\x6f\x67\x72\x65\x73\x73':{...this[_0x452a51(0x197)]}};}[a0_0x51a297(0x250)](){const _0x39e4f0=a0_0x51a297;return{'\x73\x74\x61\x74\x65':this[_0x39e4f0(0x1ad)],'\x63\x6f\x6e\x6e\x65\x63\x74\x65\x64\x41\x74':this[_0x39e4f0(0x1e9)],'\x6c\x61\x73\x74\x50\x69\x6e\x67\x41\x74':this[_0x39e4f0(0x200)],'\x6c\x61\x73\x74\x50\x6f\x6e\x67\x41\x74':this[_0x39e4f0(0x259)],'\x72\x65\x63\x6f\x6e\x6e\x65\x63\x74\x41\x74\x74\x65\x6d\x70\x74\x73':this['\x72\x65\x63\x6f\x6e\x6e\x65\x63\x74\x41\x74\x74\x65\x6d\x70\x74\x73'],'\x6d\x65\x73\x73\x61\x67\x65\x73\x52\x65\x63\x65\x69\x76\x65\x64':this[_0x39e4f0(0x1d5)],'\x6d\x65\x73\x73\x61\x67\x65\x73\x53\x65\x6e\x74':this[_0x39e4f0(0x261)],'\x65\x76\x65\x6e\x74\x73\x52\x65\x63\x65\x69\x76\x65\x64':this['\x65\x76\x65\x6e\x74\x73\x52\x65\x63\x65\x69\x76\x65\x64'],'\x64\x75\x70\x6c\x69\x63\x61\x74\x65\x73\x53\x6b\x69\x70\x70\x65\x64':this[_0x39e4f0(0x1ea)],'\x6d\x65\x74\x72\x69\x63\x73':{...this[_0x39e4f0(0x1c4)]},'\x72\x65\x70\x6c\x61\x79':this['\x67\x65\x74\x52\x65\x70\x6c\x61\x79\x53\x74\x61\x74\x65']()};}[a0_0x51a297(0x230)](){const _0x2bc88b=a0_0x51a297;return this[_0x2bc88b(0x1ad)];}[a0_0x51a297(0x235)](){const _0x27c103=a0_0x51a297,_0xab945a={'\x4d\x5a\x71\x56\x41':function(_0x7b156b,_0x51f757){return _0x7b156b===_0x51f757;},'\x66\x6c\x74\x4f\x4a':'\x63\x6f\x6e\x6e\x65\x63\x74\x65\x64'};return _0xab945a[_0x27c103(0x19a)](this['\x73\x74\x61\x74\x65'],_0xab945a['\x66\x6c\x74\x4f\x4a']);}[a0_0x51a297(0x25c)](){const _0x58292f=a0_0x51a297;return this[_0x58292f(0x1c4)]['\x71\x75\x61\x6c\x69\x74\x79'];}['\x67\x65\x74\x43\x6f\x6e\x6e\x65\x63\x74\x69\x6f\x6e\x4d\x65\x74\x72\x69\x63\x73'](){const _0x2365f3=a0_0x51a297;return{...this[_0x2365f3(0x1c4)]};}[a0_0x51a297(0x216)](){const _0xbba657=a0_0x51a297;this[_0xbba657(0x1fd)]=[],this['\x63\x6f\x6e\x6e\x65\x63\x74\x69\x6f\x6e\x4d\x65\x74\x72\x69\x63\x73']={...INITIAL_METRICS},this[_0xbba657(0x1de)][_0xbba657(0x18d)]?.(this['\x63\x6f\x6e\x6e\x65\x63\x74\x69\x6f\x6e\x4d\x65\x74\x72\x69\x63\x73']);}[a0_0x51a297(0x18f)](_0x356af8){const _0x27b210=a0_0x51a297;this[_0x27b210(0x19d)]=_0x356af8;if(this[_0x27b210(0x1ad)]==='\x63\x6f\x6e\x6e\x65\x63\x74\x65\x64'&&this['\x77\x73'])this['\x77\x73'][_0x27b210(0x1ff)](0x3e8,_0x27b210(0x245));}[a0_0x51a297(0x210)](){const _0x3679e6=a0_0x51a297;return this[_0x3679e6(0x19d)];}[a0_0x51a297(0x1f1)](_0x340585){const _0x324d6c=a0_0x51a297;this[_0x324d6c(0x1ad)]!==_0x340585&&(this[_0x324d6c(0x1ad)]=_0x340585,this['\x75\x70\x64\x61\x74\x65\x43\x6f\x6e\x6e\x65\x63\x74\x69\x6f\x6e\x51\x75\x61\x6c\x69\x74\x79'](),this[_0x324d6c(0x1de)][_0x324d6c(0x1ca)]?.(_0x340585));}[a0_0x51a297(0x21b)](){const _0x28d088=a0_0x51a297,_0x73ad02={'\x46\x63\x42\x76\x61':_0x28d088(0x1ed)},_0x72324c=this['\x68\x61\x73\x43\x6f\x6e\x6e\x65\x63\x74\x65\x64\x42\x65\x66\x6f\x72\x65'];this['\x68\x61\x73\x43\x6f\x6e\x6e\x65\x63\x74\x65\x64\x42\x65\x66\x6f\x72\x65']=!![],this[_0x28d088(0x1f1)](_0x73ad02[_0x28d088(0x196)]),this[_0x28d088(0x1e9)]=Date[_0x28d088(0x225)](),this[_0x28d088(0x1b1)]=0x0,this[_0x28d088(0x25d)]=0x0,this[_0x28d088(0x1da)](),this[_0x28d088(0x199)](),_0x72324c&&(this[_0x28d088(0x21e)](),this[_0x28d088(0x1de)][_0x28d088(0x26e)]?.());}[a0_0x51a297(0x237)](_0x2ca303,_0x981d1d){const _0x43f2b3=a0_0x51a297,_0x5e1b84={'\x69\x72\x58\x6d\x6d':_0x43f2b3(0x227)};this[_0x43f2b3(0x231)](),this[_0x43f2b3(0x1de)]['\x6f\x6e\x44\x69\x73\x63\x6f\x6e\x6e\x65\x63\x74']?.(_0x2ca303,_0x981d1d);if(this[_0x43f2b3(0x1df)][_0x43f2b3(0x17f)]&&this[_0x43f2b3(0x1b1)]<this['\x63\x6f\x6e\x66\x69\x67']['\x6d\x61\x78\x52\x65\x63\x6f\x6e\x6e\x65\x63\x74\x41\x74\x74\x65\x6d\x70\x74\x73'])this[_0x43f2b3(0x1f1)]('\x72\x65\x63\x6f\x6e\x6e\x65\x63\x74\x69\x6e\x67'),this[_0x43f2b3(0x1f4)]();else this[_0x43f2b3(0x1f1)](_0x5e1b84['\x69\x72\x58\x6d\x6d']);}['\x68\x61\x6e\x64\x6c\x65\x4d\x65\x73\x73\x61\x67\x65'](_0xe275b3){const _0xfd1a77=a0_0x51a297,_0x2df4fd={'\x76\x48\x76\x55\x49':function(_0x1ff801,_0x5bb99c){return _0x1ff801===_0x5bb99c;},'\x49\x72\x64\x6f\x47':'\x73\x74\x72\x69\x6e\x67','\x68\x63\x4a\x51\x6e':function(_0x3d62f0,_0x2565e8){return _0x3d62f0!==_0x2565e8;},'\x4c\x43\x5a\x6d\x48':function(_0x4bed91,_0x19a0b4){return _0x4bed91===_0x19a0b4;},'\x61\x53\x76\x68\x78':'\x6f\x62\x6a\x65\x63\x74','\x62\x72\x51\x63\x62':function(_0x168ca3,_0x200cf5){return _0x168ca3!==_0x200cf5;},'\x41\x76\x51\x56\x41':_0xfd1a77(0x221),'\x67\x4d\x62\x42\x6c':_0xfd1a77(0x246),'\x68\x79\x70\x4d\x45':function(_0x4e3801,_0x3c3205){return _0x4e3801>_0x3c3205;},'\x77\x59\x6f\x62\x52':function(_0x3ad160,_0x47a9db){return _0x3ad160>=_0x47a9db;}};this['\x6d\x65\x73\x73\x61\x67\x65\x73\x52\x65\x63\x65\x69\x76\x65\x64']++;try{const _0x457786=JSON[_0xfd1a77(0x1ef)](_0xe275b3);if(!_0x457786[_0xfd1a77(0x1aa)]&&_0x457786[_0xfd1a77(0x1f7)])_0x457786['\x74\x79\x70\x65']=_0x457786[_0xfd1a77(0x1f7)];if(_0x2df4fd['\x76\x48\x76\x55\x49'](typeof _0x457786[_0xfd1a77(0x1aa)],_0x2df4fd[_0xfd1a77(0x260)])&&_0x2df4fd['\x68\x63\x4a\x51\x6e'](WIRE_TYPE_MAP[_0x457786['\x74\x79\x70\x65']],void 0x0))_0x457786[_0xfd1a77(0x1aa)]=WIRE_TYPE_MAP[_0x457786[_0xfd1a77(0x1aa)]];if(_0x457786[_0xfd1a77(0x1b3)]&&_0x2df4fd[_0xfd1a77(0x262)](typeof _0x457786['\x64\x61\x74\x61'],_0x2df4fd[_0xfd1a77(0x184)])){const _0x205f25=_0x457786[_0xfd1a77(0x1b3)];if(_0x2df4fd[_0xfd1a77(0x23f)](_0x205f25[_0xfd1a77(0x26a)],void 0x0)&&_0x205f25['\x73\x61\x6e\x64\x62\x6f\x78\x49\x64']===void 0x0)_0x205f25[_0xfd1a77(0x1c7)]=_0x205f25['\x73\x69\x64\x65\x63\x61\x72\x49\x64'];}if(_0x457786[_0xfd1a77(0x1aa)]===_0x2df4fd['\x41\x76\x51\x56\x41']&&!_0x457786[_0xfd1a77(0x1b3)]&&_0x457786[_0xfd1a77(0x265)]){const {type:_0x4f5b4b,messageType:_0x3acdee,channel:_0x27451f,id:_0x1e38c4,sequenceId:_0x4a438f,timestamp:_0x16d8b9,..._0x1808d7}=_0x457786;_0x457786[_0xfd1a77(0x1b3)]=_0x1808d7;}const _0x2c086b=_0x457786;if(_0x2c086b[_0xfd1a77(0x1aa)]===_0x2df4fd[_0xfd1a77(0x1a8)]){this[_0xfd1a77(0x223)](_0x2c086b['\x74\x69\x6d\x65\x73\x74\x61\x6d\x70']),this[_0xfd1a77(0x254)](_0x2c086b);return;}if('\x69\x64'in _0x2c086b&&_0x2c086b['\x69\x64']&&this[_0xfd1a77(0x1df)]['\x65\x6e\x61\x62\x6c\x65\x44\x65\x64\x75\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e']){const _0x22212d=_0x2c086b['\x69\x64'];if(this[_0xfd1a77(0x1ae)][_0xfd1a77(0x192)](_0x22212d)){this[_0xfd1a77(0x1ea)]++;return;}this[_0xfd1a77(0x1ae)]['\x61\x64\x64'](_0x22212d);if(_0x2df4fd[_0xfd1a77(0x23e)](this[_0xfd1a77(0x1ae)][_0xfd1a77(0x1ce)],this[_0xfd1a77(0x1df)]['\x6d\x61\x78\x44\x65\x64\x75\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e\x53\x69\x7a\x65'])){const _0x1cc873=Math[_0xfd1a77(0x1fe)](this[_0xfd1a77(0x1df)][_0xfd1a77(0x1f5)]*0.1);let _0x171dfa=0x0;for(const _0x4e1829 of this[_0xfd1a77(0x1ae)]){if(_0x2df4fd[_0xfd1a77(0x1b6)](_0x171dfa,_0x1cc873))break;this[_0xfd1a77(0x1ae)][_0xfd1a77(0x224)](_0x4e1829),_0x171dfa++;}}this[_0xfd1a77(0x220)]=_0x22212d,this[_0xfd1a77(0x1b2)]();}this[_0xfd1a77(0x254)](_0x2c086b);}catch{}}[a0_0x51a297(0x223)](_0xe6b7ce){const _0x3d44ae=a0_0x51a297,_0x50f9cc={'\x77\x61\x7a\x59\x77':function(_0x9b3ce4,_0x1e2fda){return _0x9b3ce4-_0x1e2fda;}},_0x3fc025=Date[_0x3d44ae(0x225)]();this[_0x3d44ae(0x259)]=_0xe6b7ce,this['\x6d\x69\x73\x73\x65\x64\x50\x6f\x6e\x67\x43\x6f\x75\x6e\x74']=0x0,this[_0x3d44ae(0x1d3)]();if(this['\x6c\x61\x73\x74\x50\x69\x6e\x67\x53\x65\x6e\x74\x41\x74']){const _0x50fcaf=_0x50f9cc[_0x3d44ae(0x269)](_0x3fc025,this[_0x3d44ae(0x22e)]);this[_0x3d44ae(0x1fd)][_0x3d44ae(0x1a3)](_0x50fcaf);if(this['\x70\x69\x6e\x67\x4c\x61\x74\x65\x6e\x63\x79\x48\x69\x73\x74\x6f\x72\x79'][_0x3d44ae(0x1dd)]>this[_0x3d44ae(0x1df)][_0x3d44ae(0x1d4)])this[_0x3d44ae(0x1fd)][_0x3d44ae(0x26d)]();this[_0x3d44ae(0x1a9)](_0x50fcaf,_0x3fc025);}}[a0_0x51a297(0x254)](_0x41f625){const _0x19aee1=a0_0x51a297,_0x13107e={'\x69\x7a\x44\x4f\x62':function(_0x367a17,_0x57b80d){return _0x367a17===_0x57b80d;},'\x69\x55\x72\x47\x72':function(_0x2de804,_0xd34719){return _0x2de804 in _0xd34719;},'\x68\x6d\x46\x46\x68':_0x19aee1(0x1f0),'\x78\x53\x6a\x75\x71':_0x19aee1(0x1dc),'\x67\x6c\x74\x6b\x69':'\x72\x75\x6e\x74\x69\x6d\x65\x2e\x72\x65\x61\x64\x79','\x4d\x72\x46\x54\x51':'\x70\x6f\x72\x74\x2e\x6f\x70\x65\x6e\x65\x64','\x55\x79\x4b\x74\x56':_0x19aee1(0x21f),'\x65\x45\x62\x6a\x4b':_0x19aee1(0x26c),'\x43\x48\x6e\x64\x77':_0x19aee1(0x193),'\x6a\x71\x61\x6e\x51':_0x19aee1(0x18c)};if('\x69\x64'in _0x41f625&&_0x41f625['\x69\x64']){const _0x5e0826=this[_0x19aee1(0x1b9)][_0x19aee1(0x266)](_0x41f625['\x69\x64']);if(_0x5e0826){this[_0x19aee1(0x1b9)][_0x19aee1(0x224)](_0x41f625['\x69\x64']);if(_0x13107e[_0x19aee1(0x1b0)](_0x41f625['\x74\x79\x70\x65'],_0x19aee1(0x1d2)))_0x5e0826[_0x19aee1(0x19e)](new Error(_0x41f625[_0x19aee1(0x248)]));else _0x5e0826[_0x19aee1(0x22f)](_0x13107e[_0x19aee1(0x1d6)](_0x19aee1(0x1b3),_0x41f625)?_0x41f625[_0x19aee1(0x1b3)]:void 0x0);return;}}switch(_0x41f625[_0x19aee1(0x1aa)]){case _0x19aee1(0x1e6):this['\x68\x61\x6e\x64\x6c\x65\x72\x73'][_0x19aee1(0x219)]?.(_0x41f625[_0x19aee1(0x1b3)][_0x19aee1(0x217)]);break;case'\x72\x75\x6e\x74\x69\x6d\x65\x2e\x63\x6f\x6e\x6e\x65\x63\x74\x65\x64':this[_0x19aee1(0x1de)]['\x6f\x6e\x52\x75\x6e\x74\x69\x6d\x65\x43\x6f\x6e\x6e\x65\x63\x74\x65\x64']?.(_0x41f625[_0x19aee1(0x1b3)][_0x19aee1(0x1c7)],_0x41f625[_0x19aee1(0x1b3)][_0x19aee1(0x23c)]);break;case _0x13107e[_0x19aee1(0x247)]:this[_0x19aee1(0x1de)]['\x6f\x6e\x52\x75\x6e\x74\x69\x6d\x65\x44\x69\x73\x63\x6f\x6e\x6e\x65\x63\x74\x65\x64']?.(_0x41f625['\x64\x61\x74\x61']['\x73\x61\x6e\x64\x62\x6f\x78\x49\x64'],_0x41f625[_0x19aee1(0x1b3)][_0x19aee1(0x1d2)]);break;case'\x72\x75\x6e\x74\x69\x6d\x65\x2e\x6e\x6f\x74\x5f\x66\x6f\x75\x6e\x64':this['\x68\x61\x6e\x64\x6c\x65\x72\x73'][_0x19aee1(0x263)]?.(_0x41f625[_0x19aee1(0x1b3)][_0x19aee1(0x217)],_0x41f625['\x64\x61\x74\x61'][_0x19aee1(0x21c)],_0x41f625[_0x19aee1(0x1b3)][_0x19aee1(0x1be)]);break;case _0x19aee1(0x19c):{const _0x11dbef=_0x41f625[_0x19aee1(0x1b3)],_0x41f06d=_0x11dbef[_0x19aee1(0x1c7)]??_0x11dbef[_0x19aee1(0x26a)];if(_0x41f06d)this[_0x19aee1(0x1de)][_0x19aee1(0x233)]?.(_0x41f06d);else this[_0x19aee1(0x1de)]['\x6f\x6e\x45\x72\x72\x6f\x72']?.(_0x19aee1(0x195),_0x13107e[_0x19aee1(0x236)]);break;}case _0x13107e[_0x19aee1(0x1e5)]:this[_0x19aee1(0x1de)][_0x19aee1(0x257)]?.(_0x41f625[_0x19aee1(0x1b3)]);break;case _0x13107e[_0x19aee1(0x1c2)]:this[_0x19aee1(0x1de)]['\x6f\x6e\x50\x6f\x72\x74\x4f\x70\x65\x6e\x65\x64']?.(_0x41f625['\x64\x61\x74\x61'][_0x19aee1(0x24e)],_0x41f625['\x64\x61\x74\x61'][_0x19aee1(0x198)],_0x41f625[_0x19aee1(0x1b3)][_0x19aee1(0x1f6)]);break;case _0x13107e[_0x19aee1(0x1c9)]:this[_0x19aee1(0x1de)]['\x6f\x6e\x50\x6f\x72\x74\x43\x6c\x6f\x73\x65\x64']?.(_0x41f625[_0x19aee1(0x1b3)][_0x19aee1(0x24e)]);break;case _0x19aee1(0x221):this[_0x19aee1(0x232)]++,this['\x74\x72\x61\x63\x6b\x45\x78\x65\x63\x75\x74\x69\x6f\x6e\x43\x6f\x6e\x74\x65\x78\x74'](_0x41f625[_0x19aee1(0x1b3)]),this[_0x19aee1(0x1de)][_0x19aee1(0x1bc)]?.(_0x41f625[_0x19aee1(0x265)],_0x41f625[_0x19aee1(0x1b3)],_0x41f625[_0x19aee1(0x22a)]);break;case _0x19aee1(0x243):this['\x69\x73\x52\x65\x70\x6c\x61\x79\x69\x6e\x67']=!![],this[_0x19aee1(0x197)]={'\x74\x6f\x74\x61\x6c':_0x41f625[_0x19aee1(0x20d)],'\x72\x65\x63\x65\x69\x76\x65\x64':0x0},this[_0x19aee1(0x1de)]['\x6f\x6e\x52\x65\x70\x6c\x61\x79\x53\x74\x61\x72\x74']?.(_0x41f625['\x74\x6f\x74\x61\x6c']);break;case _0x19aee1(0x20f):this[_0x19aee1(0x197)][_0x19aee1(0x186)]=_0x41f625[_0x19aee1(0x186)],this['\x68\x61\x6e\x64\x6c\x65\x72\x73'][_0x19aee1(0x20a)]?.(_0x41f625[_0x19aee1(0x186)],this['\x72\x65\x70\x6c\x61\x79\x50\x72\x6f\x67\x72\x65\x73\x73']['\x74\x6f\x74\x61\x6c']);break;case _0x13107e['\x65\x45\x62\x6a\x4b']:this[_0x19aee1(0x20e)]=![],this[_0x19aee1(0x1de)]['\x6f\x6e\x52\x65\x70\x6c\x61\x79\x43\x6f\x6d\x70\x6c\x65\x74\x65']?.(_0x41f625[_0x19aee1(0x20d)]);break;case _0x19aee1(0x1d2):this[_0x19aee1(0x1de)][_0x19aee1(0x22b)]?.(_0x41f625[_0x19aee1(0x248)],_0x41f625[_0x19aee1(0x234)]);break;case'\x74\x6f\x6b\x65\x6e\x2e\x65\x78\x70\x69\x72\x69\x6e\x67':this[_0x19aee1(0x1de)][_0x19aee1(0x1cf)]?.(_0x41f625[_0x19aee1(0x1b3)][_0x19aee1(0x1a2)]),this['\x68\x61\x6e\x64\x6c\x65\x54\x6f\x6b\x65\x6e\x45\x78\x70\x69\x72\x69\x6e\x67']();break;case _0x13107e['\x43\x48\x6e\x64\x77']:this[_0x19aee1(0x1de)][_0x19aee1(0x255)]?.();break;case _0x13107e[_0x19aee1(0x1b5)]:this[_0x19aee1(0x1de)][_0x19aee1(0x189)]?.(_0x41f625[_0x19aee1(0x1b3)][_0x19aee1(0x1cd)],_0x41f625[_0x19aee1(0x1b3)][_0x19aee1(0x1ac)],_0x41f625[_0x19aee1(0x1b3)]['\x74\x6f\x74\x61\x6c\x44\x72\x6f\x70\x70\x65\x64']);break;}}['\x74\x72\x61\x63\x6b\x45\x78\x65\x63\x75\x74\x69\x6f\x6e\x43\x6f\x6e\x74\x65\x78\x74'](_0x41f787){const _0x4ff126=a0_0x51a297,_0x3059cb={'\x46\x55\x6b\x41\x6d':function(_0x522820,_0x56da66){return _0x522820!==_0x56da66;},'\x6c\x51\x4b\x44\x4c':_0x4ff126(0x180),'\x4a\x4c\x61\x6e\x53':function(_0xc1acdd,_0xb871c1){return _0xc1acdd===_0xb871c1;}};if(_0x3059cb[_0x4ff126(0x18e)](typeof _0x41f787,_0x3059cb['\x6c\x51\x4b\x44\x4c'])||_0x3059cb[_0x4ff126(0x264)](_0x41f787,null))return;const _0x2dbe0f=_0x41f787;_0x2dbe0f[_0x4ff126(0x24f)]&&(this['\x63\x75\x72\x72\x65\x6e\x74\x45\x78\x65\x63\x75\x74\x69\x6f\x6e\x49\x64']=_0x2dbe0f[_0x4ff126(0x24f)],this['\x73\x61\x76\x65\x52\x65\x70\x6c\x61\x79\x53\x74\x61\x74\x65']()),_0x2dbe0f['\x74\x79\x70\x65']==='\x65\x78\x65\x63\x75\x74\x69\x6f\x6e\x2e\x73\x74\x61\x72\x74\x65\x64'&&_0x2dbe0f[_0x4ff126(0x217)]&&(this['\x63\x75\x72\x72\x65\x6e\x74\x53\x65\x73\x73\x69\x6f\x6e\x49\x64']=_0x2dbe0f['\x73\x65\x73\x73\x69\x6f\x6e\x49\x64'],this[_0x4ff126(0x1b2)]());}async['\x68\x61\x6e\x64\x6c\x65\x54\x6f\x6b\x65\x6e\x45\x78\x70\x69\x72\x69\x6e\x67'](){const _0xde9690=a0_0x51a297,_0x347967={'\x48\x48\x76\x78\x65':function(_0x39d67c,_0x161288){return _0x39d67c instanceof _0x161288;}};if(!this['\x63\x6f\x6e\x66\x69\x67'][_0xde9690(0x25e)]||this[_0xde9690(0x22c)])return;this[_0xde9690(0x22c)]=!![];try{const _0x29cc60=await this[_0xde9690(0x1df)][_0xde9690(0x25e)]();this[_0xde9690(0x18f)](_0x29cc60['\x74\x6f\x6b\x65\x6e']);}catch(_0x4c616a){this[_0xde9690(0x1de)][_0xde9690(0x22b)]?.(_0xde9690(0x1e8)+(_0x347967['\x48\x48\x76\x78\x65'](_0x4c616a,Error)?_0x4c616a['\x6d\x65\x73\x73\x61\x67\x65']:String(_0x4c616a)),_0xde9690(0x191));}finally{this['\x69\x73\x52\x65\x66\x72\x65\x73\x68\x69\x6e\x67\x54\x6f\x6b\x65\x6e']=![];}}[a0_0x51a297(0x183)](_0x4b7cf0){const _0x6fe12c=a0_0x51a297;this['\x77\x73']?.[_0x6fe12c(0x187)]===WebSocket['\x4f\x50\x45\x4e']&&(this['\x77\x73'][_0x6fe12c(0x183)](JSON[_0x6fe12c(0x1e1)](_0x4b7cf0)),this[_0x6fe12c(0x261)]++);}[a0_0x51a297(0x218)](_0x482052){const _0x30ed97=a0_0x51a297,_0xa6d86c={'\x62\x44\x77\x58\x6b':_0x30ed97(0x1cb)};return new Promise((_0x1951d9,_0x50fe9f)=>{const _0x53c1e0=_0x30ed97,_0x23d6b8={'\x7a\x49\x6d\x6f\x6a':_0xa6d86c[_0x53c1e0(0x25b)]},_0x158315=_0x53c1e0(0x242)+ ++this['\x6d\x65\x73\x73\x61\x67\x65\x49\x64\x43\x6f\x75\x6e\x74\x65\x72'];this[_0x53c1e0(0x1b9)][_0x53c1e0(0x1b7)](_0x158315,{'\x72\x65\x73\x6f\x6c\x76\x65':_0x1951d9,'\x72\x65\x6a\x65\x63\x74':_0x50fe9f}),setTimeout(()=>{const _0x44ed49=_0x53c1e0;this['\x70\x65\x6e\x64\x69\x6e\x67\x43\x61\x6c\x6c\x62\x61\x63\x6b\x73'][_0x44ed49(0x192)](_0x158315)&&(this[_0x44ed49(0x1b9)][_0x44ed49(0x224)](_0x158315),_0x50fe9f(new Error(_0x23d6b8[_0x44ed49(0x1cc)])));},0x2710),this[_0x53c1e0(0x183)]({..._0x482052,'\x69\x64':_0x158315});});}[a0_0x51a297(0x199)](){const _0x4650da=a0_0x51a297,_0x3789c4={'\x43\x45\x4b\x64\x74':function(_0x4d32dd,_0x1cf0c1){return _0x4d32dd>_0x1cf0c1;}},_0x251c31=this[_0x4650da(0x1df)][_0x4650da(0x1f8)],_0x4ba600={};if(this['\x6c\x61\x73\x74\x45\x76\x65\x6e\x74\x49\x64'])_0x4ba600[_0x4650da(0x220)]=this[_0x4650da(0x220)];if(this[_0x4650da(0x253)])_0x4ba600[_0x4650da(0x24f)]=this[_0x4650da(0x253)];if(this[_0x4650da(0x214)])_0x4ba600[_0x4650da(0x217)]=this[_0x4650da(0x214)];const _0x4bff76=_0x3789c4[_0x4650da(0x1e3)](Object[_0x4650da(0x182)](_0x4ba600)['\x6c\x65\x6e\x67\x74\x68'],0x0);_0x4bff76&&(this[_0x4650da(0x20e)]=!![],this[_0x4650da(0x197)]={'\x74\x6f\x74\x61\x6c':0x0,'\x72\x65\x63\x65\x69\x76\x65\x64':0x0}),this[_0x4650da(0x183)]({'\x74\x79\x70\x65':'\x73\x75\x62\x73\x63\x72\x69\x62\x65','\x63\x68\x61\x6e\x6e\x65\x6c\x73':_0x251c31,..._0x4bff76?{'\x72\x65\x70\x6c\x61\x79\x4f\x70\x74\x69\x6f\x6e\x73':_0x4ba600}:{}});}[a0_0x51a297(0x1da)](){const _0x327260=a0_0x51a297;this[_0x327260(0x23d)](),this[_0x327260(0x238)]=setInterval(()=>{const _0x2a1216=_0x327260;this[_0x2a1216(0x23a)]();},this[_0x327260(0x1df)][_0x327260(0x24c)]);}[a0_0x51a297(0x23d)](){const _0x4e9c12=a0_0x51a297;this[_0x4e9c12(0x238)]&&(clearInterval(this['\x70\x69\x6e\x67\x49\x6e\x74\x65\x72\x76\x61\x6c']),this[_0x4e9c12(0x238)]=null);}[a0_0x51a297(0x23a)](){const _0x1798b9=a0_0x51a297,_0x2bfcdf={'\x44\x74\x43\x6b\x78':function(_0xa08284,_0x508ac0){return _0xa08284>=_0x508ac0;},'\x6a\x66\x78\x62\x50':function(_0x1efa30,_0x46210e){return _0x1efa30>_0x46210e;},'\x7a\x46\x68\x55\x51':function(_0x253a1a,_0x5d85b7){return _0x253a1a>=_0x5d85b7;},'\x6b\x77\x76\x66\x76':_0x1798b9(0x1b4)};if(this['\x77\x73']?.[_0x1798b9(0x187)]!==WebSocket[_0x1798b9(0x1f3)])return;const _0x39a6b2=this[_0x1798b9(0x259)]?Date[_0x1798b9(0x225)]()-this[_0x1798b9(0x259)]:0x0;if(this[_0x1798b9(0x259)]&&_0x2bfcdf[_0x1798b9(0x1c3)](_0x39a6b2,this['\x63\x6f\x6e\x66\x69\x67'][_0x1798b9(0x1d1)])){this[_0x1798b9(0x25d)]++,this[_0x1798b9(0x1c4)]={...this[_0x1798b9(0x1c4)],'\x6d\x69\x73\x73\x65\x64\x50\x6f\x6e\x67\x43\x6f\x75\x6e\x74':this[_0x1798b9(0x25d)]},this[_0x1798b9(0x26b)]();if(_0x2bfcdf[_0x1798b9(0x1c5)](this[_0x1798b9(0x25d)],this[_0x1798b9(0x1df)][_0x1798b9(0x25a)])){this['\x77\x73']?.[_0x1798b9(0x1ff)](0xfa0,'\x50\x6f\x6e\x67\x20\x74\x69\x6d\x65\x6f\x75\x74\x20\x2d\x20\x63\x6f\x6e\x6e\x65\x63\x74\x69\x6f\x6e\x20\x75\x6e\x72\x65\x73\x70\x6f\x6e\x73\x69\x76\x65');return;}}this[_0x1798b9(0x200)]=Date['\x6e\x6f\x77'](),this['\x6c\x61\x73\x74\x50\x69\x6e\x67\x53\x65\x6e\x74\x41\x74']=Date['\x6e\x6f\x77'](),this[_0x1798b9(0x183)]({'\x74\x79\x70\x65':_0x2bfcdf['\x6b\x77\x76\x66\x76']}),this[_0x1798b9(0x20b)]=setTimeout(()=>{const _0x4603a5=_0x1798b9;this[_0x4603a5(0x25d)]++,this[_0x4603a5(0x1c4)]={...this[_0x4603a5(0x1c4)],'\x6d\x69\x73\x73\x65\x64\x50\x6f\x6e\x67\x43\x6f\x75\x6e\x74':this[_0x4603a5(0x25d)]},this['\x75\x70\x64\x61\x74\x65\x43\x6f\x6e\x6e\x65\x63\x74\x69\x6f\x6e\x51\x75\x61\x6c\x69\x74\x79']();if(_0x2bfcdf[_0x4603a5(0x1e0)](this[_0x4603a5(0x25d)],this[_0x4603a5(0x1df)]['\x6d\x61\x78\x4d\x69\x73\x73\x65\x64\x50\x6f\x6e\x67\x73']))this['\x77\x73']?.[_0x4603a5(0x1ff)](0xfa0,_0x4603a5(0x18b));},this['\x63\x6f\x6e\x66\x69\x67'][_0x1798b9(0x1d1)]);}[a0_0x51a297(0x1d3)](){const _0x213745=a0_0x51a297;this[_0x213745(0x20b)]&&(clearTimeout(this[_0x213745(0x20b)]),this[_0x213745(0x20b)]=null);}[a0_0x51a297(0x1f4)](){const _0x176380=a0_0x51a297,_0x11f5fc={'\x43\x4d\x6c\x47\x45':function(_0x30103d,_0x184cf2){return _0x30103d*_0x184cf2;},'\x4f\x4c\x6e\x76\x70':function(_0x3222c9,_0x592fda){return _0x3222c9-_0x592fda;},'\x6e\x61\x66\x65\x64':function(_0x198557,_0x19993f,_0x3a3877){return _0x198557(_0x19993f,_0x3a3877);}};if(this[_0x176380(0x256)])return;this[_0x176380(0x1b1)]++;const _0x3a4e55=Math[_0x176380(0x24a)](this[_0x176380(0x1df)][_0x176380(0x1fb)]*0x2**(this['\x72\x65\x63\x6f\x6e\x6e\x65\x63\x74\x41\x74\x74\x65\x6d\x70\x74\x73']-0x1),this[_0x176380(0x1df)][_0x176380(0x240)]),_0x2f13eb=_0x11f5fc['\x43\x4d\x6c\x47\x45'](_0x3a4e55*0.3,_0x11f5fc['\x4f\x4c\x6e\x76\x70'](Math[_0x176380(0x194)]()*0x2,0x1));this[_0x176380(0x256)]=_0x11f5fc['\x6e\x61\x66\x65\x64'](setTimeout,()=>{const _0x1e4546=_0x176380;this[_0x1e4546(0x256)]=null,this[_0x1e4546(0x1c6)]();},_0x3a4e55+_0x2f13eb);}[a0_0x51a297(0x231)](){const _0x2edafc=a0_0x51a297;this[_0x2edafc(0x23d)](),this[_0x2edafc(0x1d3)]();this[_0x2edafc(0x256)]&&(clearTimeout(this[_0x2edafc(0x256)]),this[_0x2edafc(0x256)]=null);for(const [_0x3a4d73,_0x76e909]of this[_0x2edafc(0x1b9)]){_0x76e909[_0x2edafc(0x19e)](new Error(_0x2edafc(0x213))),this[_0x2edafc(0x1b9)][_0x2edafc(0x224)](_0x3a4d73);}}[a0_0x51a297(0x1a9)](_0x1dd2a0,_0x52e90a){const _0x238007=a0_0x51a297,_0x5d3171=this['\x70\x69\x6e\x67\x4c\x61\x74\x65\x6e\x63\x79\x48\x69\x73\x74\x6f\x72\x79'][_0x238007(0x1dd)]>0x0?this[_0x238007(0x1fd)]['\x72\x65\x64\x75\x63\x65']((_0x186245,_0x1c2a1c)=>_0x186245+_0x1c2a1c,0x0)/this[_0x238007(0x1fd)]['\x6c\x65\x6e\x67\x74\x68']:null;this['\x63\x6f\x6e\x6e\x65\x63\x74\x69\x6f\x6e\x4d\x65\x74\x72\x69\x63\x73']={...this[_0x238007(0x1c4)],'\x6c\x61\x73\x74\x50\x69\x6e\x67\x4c\x61\x74\x65\x6e\x63\x79\x4d\x73':_0x1dd2a0,'\x61\x76\x67\x50\x69\x6e\x67\x4c\x61\x74\x65\x6e\x63\x79\x4d\x73':_0x5d3171,'\x6d\x69\x73\x73\x65\x64\x50\x6f\x6e\x67\x43\x6f\x75\x6e\x74':this[_0x238007(0x25d)],'\x6c\x61\x73\x74\x50\x6f\x6e\x67\x41\x74':_0x52e90a},this['\x75\x70\x64\x61\x74\x65\x43\x6f\x6e\x6e\x65\x63\x74\x69\x6f\x6e\x51\x75\x61\x6c\x69\x74\x79']();}[a0_0x51a297(0x26b)](){const _0x862429=a0_0x51a297,_0x34893c={'\x44\x45\x69\x43\x76':function(_0x396635,_0x10afc2){return _0x396635===_0x10afc2;},'\x53\x4b\x6a\x58\x43':function(_0x3a188a,_0x36d3b1){return _0x3a188a!==_0x36d3b1;}},_0x3241ba=_0x34893c['\x44\x45\x69\x43\x76'](this[_0x862429(0x1ad)],'\x63\x6f\x6e\x6e\x65\x63\x74\x65\x64'),_0x114c50=calculateConnectionQuality(this['\x63\x6f\x6e\x6e\x65\x63\x74\x69\x6f\x6e\x4d\x65\x74\x72\x69\x63\x73'],_0x3241ba);_0x34893c['\x53\x4b\x6a\x58\x43'](this['\x63\x6f\x6e\x6e\x65\x63\x74\x69\x6f\x6e\x4d\x65\x74\x72\x69\x63\x73'][_0x862429(0x1bd)],_0x114c50)&&(this['\x63\x6f\x6e\x6e\x65\x63\x74\x69\x6f\x6e\x4d\x65\x74\x72\x69\x63\x73']={...this[_0x862429(0x1c4)],'\x71\x75\x61\x6c\x69\x74\x79':_0x114c50},this[_0x862429(0x1de)][_0x862429(0x18d)]?.(this[_0x862429(0x1c4)]));}[a0_0x51a297(0x21e)](){const _0x52bc7b=a0_0x51a297,_0x3a185e=Date['\x6e\x6f\x77']();this[_0x52bc7b(0x1c4)]={...this['\x63\x6f\x6e\x6e\x65\x63\x74\x69\x6f\x6e\x4d\x65\x74\x72\x69\x63\x73'],'\x72\x65\x63\x6f\x6e\x6e\x65\x63\x74\x43\x6f\x75\x6e\x74':this[_0x52bc7b(0x1c4)][_0x52bc7b(0x268)]+0x1,'\x6c\x61\x73\x74\x52\x65\x63\x6f\x6e\x6e\x65\x63\x74\x41\x74':_0x3a185e},this['\x70\x69\x6e\x67\x4c\x61\x74\x65\x6e\x63\x79\x48\x69\x73\x74\x6f\x72\x79']=[],this[_0x52bc7b(0x26b)]();}[a0_0x51a297(0x1e2)](){const _0x38e263=a0_0x51a297,_0x19ad69={'\x74\x51\x65\x68\x48':function(_0x2ecc8d,_0x1c5b40){return _0x2ecc8d+_0x1c5b40;}};if(!this[_0x38e263(0x1df)][_0x38e263(0x258)])return;const _0x27e865=this[_0x38e263(0x1df)]['\x72\x65\x70\x6c\x61\x79\x53\x74\x6f\x72\x61\x67\x65\x4b\x65\x79\x50\x72\x65\x66\x69\x78'];try{this[_0x38e263(0x220)]=this[_0x38e263(0x1df)][_0x38e263(0x208)][_0x38e263(0x212)](_0x19ad69[_0x38e263(0x19f)](_0x27e865,STORAGE_KEYS['\x6c\x61\x73\x74\x45\x76\x65\x6e\x74\x49\x64'])),this[_0x38e263(0x253)]=this[_0x38e263(0x1df)][_0x38e263(0x208)][_0x38e263(0x212)](_0x27e865+STORAGE_KEYS[_0x38e263(0x24f)]),this['\x63\x75\x72\x72\x65\x6e\x74\x53\x65\x73\x73\x69\x6f\x6e\x49\x64']=this[_0x38e263(0x1df)][_0x38e263(0x208)][_0x38e263(0x212)](_0x19ad69[_0x38e263(0x19f)](_0x27e865,STORAGE_KEYS['\x73\x65\x73\x73\x69\x6f\x6e\x49\x64']));}catch{}}[a0_0x51a297(0x1b2)](){const _0x4eb479=a0_0x51a297;if(!this[_0x4eb479(0x1df)]['\x65\x6e\x61\x62\x6c\x65\x52\x65\x70\x6c\x61\x79\x50\x65\x72\x73\x69\x73\x74\x65\x6e\x63\x65'])return;const _0x9be809=this[_0x4eb479(0x1df)]['\x72\x65\x70\x6c\x61\x79\x53\x74\x6f\x72\x61\x67\x65\x4b\x65\x79\x50\x72\x65\x66\x69\x78'];try{if(this[_0x4eb479(0x220)])this[_0x4eb479(0x1df)][_0x4eb479(0x208)][_0x4eb479(0x21a)](_0x9be809+STORAGE_KEYS[_0x4eb479(0x220)],this[_0x4eb479(0x220)]);if(this['\x63\x75\x72\x72\x65\x6e\x74\x45\x78\x65\x63\x75\x74\x69\x6f\x6e\x49\x64'])this[_0x4eb479(0x1df)][_0x4eb479(0x208)][_0x4eb479(0x21a)](_0x9be809+STORAGE_KEYS[_0x4eb479(0x24f)],this['\x63\x75\x72\x72\x65\x6e\x74\x45\x78\x65\x63\x75\x74\x69\x6f\x6e\x49\x64']);if(this['\x63\x75\x72\x72\x65\x6e\x74\x53\x65\x73\x73\x69\x6f\x6e\x49\x64'])this[_0x4eb479(0x1df)][_0x4eb479(0x208)]['\x73\x65\x74\x49\x74\x65\x6d'](_0x9be809+STORAGE_KEYS[_0x4eb479(0x217)],this[_0x4eb479(0x214)]);}catch{}}};export{INITIAL_METRICS,SessionGatewayClient,calculateConnectionQuality};
1
+ //#region src/session-gateway/types.ts
2
+ /**
3
+ * Default connection metrics.
4
+ */
5
+ const INITIAL_METRICS = {
6
+ lastPingLatencyMs: null,
7
+ avgPingLatencyMs: null,
8
+ missedPongCount: 0,
9
+ reconnectCount: 0,
10
+ lastPongAt: null,
11
+ lastReconnectAt: null,
12
+ quality: "disconnected"
13
+ };
14
+ /**
15
+ * Calculate connection quality from metrics.
16
+ */
17
+ function calculateConnectionQuality(metrics, isConnected) {
18
+ if (!isConnected) return "disconnected";
19
+ const { avgPingLatencyMs, missedPongCount, reconnectCount, lastReconnectAt } = metrics;
20
+ const recentReconnect = lastReconnectAt && Date.now() - lastReconnectAt < 300 * 1e3;
21
+ if (missedPongCount >= 2 || recentReconnect && reconnectCount > 1) return "poor";
22
+ if (missedPongCount >= 1 || avgPingLatencyMs !== null && avgPingLatencyMs > 1e3 || recentReconnect) return "degraded";
23
+ if (avgPingLatencyMs !== null && avgPingLatencyMs < 100 && reconnectCount === 0) return "excellent";
24
+ if (avgPingLatencyMs !== null && avgPingLatencyMs <= 300) return "good";
25
+ return "good";
26
+ }
27
+ //#endregion
28
+ //#region src/session-gateway/client.ts
29
+ /**
30
+ * SessionGatewayClient
31
+ *
32
+ * WebSocket client for Sandbox API session streaming.
33
+ * Browser-safe: no Node.js APIs.
34
+ */
35
+ const DEFAULT_CONFIG = {
36
+ transport: "websocket",
37
+ channels: ["*"],
38
+ autoReconnect: true,
39
+ maxReconnectAttempts: 10,
40
+ initialReconnectDelayMs: 1e3,
41
+ maxReconnectDelayMs: 3e4,
42
+ pingIntervalMs: 3e4,
43
+ pongTimeoutMs: 1e4,
44
+ maxMissedPongs: 2,
45
+ enableDeduplication: true,
46
+ maxDeduplicationSize: 1e3,
47
+ enableReplayPersistence: false,
48
+ replayStorageKeyPrefix: "session_gateway_",
49
+ latencyHistorySize: 10
50
+ };
51
+ const STORAGE_KEYS = {
52
+ lastEventId: "last_event_id",
53
+ executionId: "execution_id",
54
+ sessionId: "session_id"
55
+ };
56
+ /**
57
+ * Legacy wire-protocol message type map. The current server emits the
58
+ * `sidecar.*` message types; the SDK surfaces the canonical `runtime.*`
59
+ * names. Kept at module scope so it isn't re-allocated per inbound
60
+ * WebSocket message.
61
+ */
62
+ const WIRE_TYPE_MAP = {
63
+ "sidecar.connected": "runtime.connected",
64
+ "sidecar.disconnected": "runtime.disconnected",
65
+ "sidecar.not_found": "runtime.not_found",
66
+ "sidecar.ready": "runtime.ready"
67
+ };
68
+ /**
69
+ * Memory-based storage fallback when localStorage is not available.
70
+ */
71
+ var MemoryStorage = class {
72
+ store = /* @__PURE__ */ new Map();
73
+ getItem(key) {
74
+ return this.store.get(key) ?? null;
75
+ }
76
+ setItem(key, value) {
77
+ this.store.set(key, value);
78
+ }
79
+ removeItem(key) {
80
+ this.store.delete(key);
81
+ }
82
+ };
83
+ var SessionGatewayClient = class {
84
+ ws = null;
85
+ config;
86
+ handlers;
87
+ currentToken;
88
+ isRefreshingToken = false;
89
+ state = "disconnected";
90
+ connectedAt = null;
91
+ hasConnectedBefore = false;
92
+ lastPingAt = null;
93
+ lastPongAt = null;
94
+ lastPingSentAt = null;
95
+ missedPongCount = 0;
96
+ reconnectAttempts = 0;
97
+ messagesReceived = 0;
98
+ messagesSent = 0;
99
+ eventsReceived = 0;
100
+ duplicatesSkipped = 0;
101
+ reconnectTimer = null;
102
+ pingInterval = null;
103
+ pongTimeout = null;
104
+ pendingCallbacks = /* @__PURE__ */ new Map();
105
+ messageIdCounter = 0;
106
+ processedEventIds = /* @__PURE__ */ new Set();
107
+ pingLatencyHistory = [];
108
+ connectionMetrics = { ...INITIAL_METRICS };
109
+ lastEventId = null;
110
+ currentExecutionId = null;
111
+ currentSessionId = null;
112
+ isReplaying = false;
113
+ replayProgress = {
114
+ total: 0,
115
+ received: 0
116
+ };
117
+ constructor(config) {
118
+ let storage;
119
+ if (config.replayStorage) storage = config.replayStorage;
120
+ else if (typeof globalThis !== "undefined" && "localStorage" in globalThis) try {
121
+ const testKey = "__test__";
122
+ localStorage.setItem(testKey, testKey);
123
+ localStorage.removeItem(testKey);
124
+ storage = localStorage;
125
+ } catch {
126
+ storage = new MemoryStorage();
127
+ }
128
+ else storage = new MemoryStorage();
129
+ this.config = {
130
+ url: config.url,
131
+ sessionId: config.sessionId,
132
+ token: config.token,
133
+ onTokenRefresh: config.onTokenRefresh,
134
+ transport: config.transport ?? DEFAULT_CONFIG.transport,
135
+ channels: config.channels ?? DEFAULT_CONFIG.channels,
136
+ autoReconnect: config.autoReconnect ?? DEFAULT_CONFIG.autoReconnect,
137
+ maxReconnectAttempts: config.maxReconnectAttempts ?? DEFAULT_CONFIG.maxReconnectAttempts,
138
+ initialReconnectDelayMs: config.initialReconnectDelayMs ?? DEFAULT_CONFIG.initialReconnectDelayMs,
139
+ maxReconnectDelayMs: config.maxReconnectDelayMs ?? DEFAULT_CONFIG.maxReconnectDelayMs,
140
+ pingIntervalMs: config.pingIntervalMs ?? DEFAULT_CONFIG.pingIntervalMs,
141
+ pongTimeoutMs: config.pongTimeoutMs ?? DEFAULT_CONFIG.pongTimeoutMs,
142
+ maxMissedPongs: config.maxMissedPongs ?? DEFAULT_CONFIG.maxMissedPongs,
143
+ enableDeduplication: config.enableDeduplication ?? DEFAULT_CONFIG.enableDeduplication,
144
+ maxDeduplicationSize: config.maxDeduplicationSize ?? DEFAULT_CONFIG.maxDeduplicationSize,
145
+ enableReplayPersistence: config.enableReplayPersistence ?? DEFAULT_CONFIG.enableReplayPersistence,
146
+ replayStorage: storage,
147
+ replayStorageKeyPrefix: config.replayStorageKeyPrefix ?? DEFAULT_CONFIG.replayStorageKeyPrefix,
148
+ latencyHistorySize: config.latencyHistorySize ?? DEFAULT_CONFIG.latencyHistorySize
149
+ };
150
+ this.handlers = config.handlers ?? {};
151
+ this.currentToken = config.token;
152
+ if (this.config.enableReplayPersistence) this.loadReplayState();
153
+ }
154
+ /**
155
+ * Connect to the session gateway.
156
+ */
157
+ connect() {
158
+ if (this.state === "connected" || this.state === "connecting") return;
159
+ const isReconnect = this.hasConnectedBefore;
160
+ this.setState(isReconnect ? "reconnecting" : "connecting");
161
+ this.connectWebSocket();
162
+ }
163
+ connectWebSocket() {
164
+ const url = new URL(this.config.url);
165
+ url.searchParams.set("token", this.currentToken);
166
+ this.ws = new WebSocket(url.toString());
167
+ this.ws.onopen = () => this.handleOpen();
168
+ this.ws.onclose = (event) => this.handleClose(event.code, event.reason);
169
+ this.ws.onerror = (_event) => {};
170
+ this.ws.onmessage = (event) => this.handleMessage(event.data);
171
+ }
172
+ /**
173
+ * Disconnect from the session gateway.
174
+ */
175
+ disconnect() {
176
+ this.cleanup();
177
+ if (this.ws) {
178
+ this.ws.close(1e3, "Client disconnect");
179
+ this.ws = null;
180
+ }
181
+ this.setState("disconnected");
182
+ }
183
+ /**
184
+ * Subscribe to additional channels.
185
+ */
186
+ async subscribe(channels) {
187
+ return (await this.sendWithResponse({
188
+ type: "subscribe",
189
+ channels
190
+ })).channels;
191
+ }
192
+ /**
193
+ * Unsubscribe from channels.
194
+ */
195
+ async unsubscribe(channels) {
196
+ return (await this.sendWithResponse({
197
+ type: "unsubscribe",
198
+ channels
199
+ })).channels;
200
+ }
201
+ /**
202
+ * Send a ping and wait for pong.
203
+ */
204
+ async ping() {
205
+ const start = Date.now();
206
+ await this.sendWithResponse({ type: "ping" });
207
+ return Date.now() - start;
208
+ }
209
+ /**
210
+ * Request replay of events since a timestamp.
211
+ */
212
+ replay(since) {
213
+ this.send({
214
+ type: "replay",
215
+ since
216
+ });
217
+ }
218
+ /**
219
+ * Send terminal input via WebSocket.
220
+ */
221
+ sendTerminalInput(terminalId, input) {
222
+ if (!this.isConnected()) return false;
223
+ this.send({
224
+ type: "terminal.input",
225
+ data: {
226
+ terminalId,
227
+ input
228
+ }
229
+ });
230
+ return true;
231
+ }
232
+ /**
233
+ * Set the current session/execution context for event tracking.
234
+ */
235
+ setSessionContext(sessionId, executionId) {
236
+ this.currentSessionId = sessionId;
237
+ if (executionId) this.currentExecutionId = executionId;
238
+ this.saveReplayState();
239
+ }
240
+ /**
241
+ * Clear replay state (call when session ends).
242
+ */
243
+ clearReplayState() {
244
+ this.lastEventId = null;
245
+ this.currentExecutionId = null;
246
+ this.currentSessionId = null;
247
+ this.isReplaying = false;
248
+ this.replayProgress = {
249
+ total: 0,
250
+ received: 0
251
+ };
252
+ this.processedEventIds.clear();
253
+ this.duplicatesSkipped = 0;
254
+ if (this.config.enableReplayPersistence) {
255
+ const prefix = this.config.replayStorageKeyPrefix;
256
+ try {
257
+ this.config.replayStorage.removeItem(prefix + STORAGE_KEYS.lastEventId);
258
+ this.config.replayStorage.removeItem(prefix + STORAGE_KEYS.executionId);
259
+ this.config.replayStorage.removeItem(prefix + STORAGE_KEYS.sessionId);
260
+ } catch {}
261
+ }
262
+ }
263
+ /**
264
+ * Get current replay state for UI indicators.
265
+ */
266
+ getReplayState() {
267
+ return {
268
+ isReplaying: this.isReplaying,
269
+ progress: { ...this.replayProgress }
270
+ };
271
+ }
272
+ /**
273
+ * Get connection statistics.
274
+ */
275
+ getStats() {
276
+ return {
277
+ state: this.state,
278
+ connectedAt: this.connectedAt,
279
+ lastPingAt: this.lastPingAt,
280
+ lastPongAt: this.lastPongAt,
281
+ reconnectAttempts: this.reconnectAttempts,
282
+ messagesReceived: this.messagesReceived,
283
+ messagesSent: this.messagesSent,
284
+ eventsReceived: this.eventsReceived,
285
+ duplicatesSkipped: this.duplicatesSkipped,
286
+ metrics: { ...this.connectionMetrics },
287
+ replay: this.getReplayState()
288
+ };
289
+ }
290
+ getState() {
291
+ return this.state;
292
+ }
293
+ isConnected() {
294
+ return this.state === "connected";
295
+ }
296
+ getConnectionQuality() {
297
+ return this.connectionMetrics.quality;
298
+ }
299
+ getConnectionMetrics() {
300
+ return { ...this.connectionMetrics };
301
+ }
302
+ resetMetrics() {
303
+ this.pingLatencyHistory = [];
304
+ this.connectionMetrics = { ...INITIAL_METRICS };
305
+ this.handlers.onMetricsChange?.(this.connectionMetrics);
306
+ }
307
+ /**
308
+ * Update the auth token and reconnect with the new token.
309
+ */
310
+ updateToken(token) {
311
+ this.currentToken = token;
312
+ if (this.state === "connected" && this.ws) this.ws.close(1e3, "Token refreshed");
313
+ }
314
+ /**
315
+ * Get the current auth token.
316
+ */
317
+ getToken() {
318
+ return this.currentToken;
319
+ }
320
+ setState(state) {
321
+ if (this.state !== state) {
322
+ this.state = state;
323
+ this.updateConnectionQuality();
324
+ this.handlers.onStateChange?.(state);
325
+ }
326
+ }
327
+ handleOpen() {
328
+ const isReconnect = this.hasConnectedBefore;
329
+ this.hasConnectedBefore = true;
330
+ this.setState("connected");
331
+ this.connectedAt = Date.now();
332
+ this.reconnectAttempts = 0;
333
+ this.missedPongCount = 0;
334
+ this.startPingInterval();
335
+ this.restoreSubscriptions();
336
+ if (isReconnect) {
337
+ this.trackReconnection();
338
+ this.handlers.onReconnect?.();
339
+ }
340
+ }
341
+ handleClose(code, reason) {
342
+ this.cleanup();
343
+ this.handlers.onDisconnect?.(code, reason);
344
+ if (this.config.autoReconnect && this.reconnectAttempts < this.config.maxReconnectAttempts) {
345
+ this.setState("reconnecting");
346
+ this.scheduleReconnect();
347
+ } else this.setState("disconnected");
348
+ }
349
+ handleMessage(data) {
350
+ this.messagesReceived++;
351
+ try {
352
+ const raw = JSON.parse(data);
353
+ if (!raw.type && raw.messageType) raw.type = raw.messageType;
354
+ if (typeof raw.type === "string" && WIRE_TYPE_MAP[raw.type] !== void 0) raw.type = WIRE_TYPE_MAP[raw.type];
355
+ if (raw.data && typeof raw.data === "object") {
356
+ const d = raw.data;
357
+ if (d.sidecarId !== void 0 && d.sandboxId === void 0) d.sandboxId = d.sidecarId;
358
+ }
359
+ if (raw.type === "agent.event" && !raw.data && raw.channel) {
360
+ const { type, messageType, channel, id, sequenceId, timestamp, ...rest } = raw;
361
+ raw.data = rest;
362
+ }
363
+ const message = raw;
364
+ if (message.type === "pong") {
365
+ this.handlePong(message.timestamp);
366
+ this.dispatchMessage(message);
367
+ return;
368
+ }
369
+ if ("id" in message && message.id && this.config.enableDeduplication) {
370
+ const eventId = message.id;
371
+ if (this.processedEventIds.has(eventId)) {
372
+ this.duplicatesSkipped++;
373
+ return;
374
+ }
375
+ this.processedEventIds.add(eventId);
376
+ if (this.processedEventIds.size > this.config.maxDeduplicationSize) {
377
+ const entriesToRemove = Math.floor(this.config.maxDeduplicationSize * .1);
378
+ let removed = 0;
379
+ for (const oldId of this.processedEventIds) {
380
+ if (removed >= entriesToRemove) break;
381
+ this.processedEventIds.delete(oldId);
382
+ removed++;
383
+ }
384
+ }
385
+ this.lastEventId = eventId;
386
+ this.saveReplayState();
387
+ }
388
+ this.dispatchMessage(message);
389
+ } catch {}
390
+ }
391
+ handlePong(timestamp) {
392
+ const now = Date.now();
393
+ this.lastPongAt = timestamp;
394
+ this.missedPongCount = 0;
395
+ this.clearPongTimeout();
396
+ if (this.lastPingSentAt) {
397
+ const latency = now - this.lastPingSentAt;
398
+ this.pingLatencyHistory.push(latency);
399
+ if (this.pingLatencyHistory.length > this.config.latencyHistorySize) this.pingLatencyHistory.shift();
400
+ this.updateConnectionMetrics(latency, now);
401
+ }
402
+ }
403
+ dispatchMessage(message) {
404
+ if ("id" in message && message.id) {
405
+ const callback = this.pendingCallbacks.get(message.id);
406
+ if (callback) {
407
+ this.pendingCallbacks.delete(message.id);
408
+ if (message.type === "error") callback.reject(new Error(message.message));
409
+ else callback.resolve("data" in message ? message.data : void 0);
410
+ return;
411
+ }
412
+ }
413
+ switch (message.type) {
414
+ case "connection.established":
415
+ this.handlers.onConnect?.(message.data.sessionId);
416
+ break;
417
+ case "runtime.connected":
418
+ this.handlers.onRuntimeConnected?.(message.data.sandboxId, message.data.baseUrl);
419
+ break;
420
+ case "runtime.disconnected":
421
+ this.handlers.onRuntimeDisconnected?.(message.data.sandboxId, message.data.error);
422
+ break;
423
+ case "runtime.not_found":
424
+ this.handlers.onRuntimeNotFound?.(message.data.sessionId, message.data.containerId, message.data.reason);
425
+ break;
426
+ case "container.ready": {
427
+ const data = message.data;
428
+ const id = data.sandboxId ?? data.sidecarId;
429
+ if (id) this.handlers.onContainerReady?.(id);
430
+ else this.handlers.onError?.("container.ready event received without sandboxId", "invalid_payload");
431
+ break;
432
+ }
433
+ case "runtime.ready":
434
+ this.handlers.onRuntimeReady?.(message.data);
435
+ break;
436
+ case "port.opened":
437
+ this.handlers.onPortOpened?.(message.data.port, message.data.protocol, message.data.processName);
438
+ break;
439
+ case "port.closed":
440
+ this.handlers.onPortClosed?.(message.data.port);
441
+ break;
442
+ case "agent.event":
443
+ this.eventsReceived++;
444
+ this.trackExecutionContext(message.data);
445
+ this.handlers.onAgentEvent?.(message.channel, message.data, message.sequenceId);
446
+ break;
447
+ case "replay.start":
448
+ this.isReplaying = true;
449
+ this.replayProgress = {
450
+ total: message.total,
451
+ received: 0
452
+ };
453
+ this.handlers.onReplayStart?.(message.total);
454
+ break;
455
+ case "replay.progress":
456
+ this.replayProgress.received = message.received;
457
+ this.handlers.onReplayProgress?.(message.received, this.replayProgress.total);
458
+ break;
459
+ case "replay.complete":
460
+ this.isReplaying = false;
461
+ this.handlers.onReplayComplete?.(message.total);
462
+ break;
463
+ case "error":
464
+ this.handlers.onError?.(message.message, message.code);
465
+ break;
466
+ case "token.expiring":
467
+ this.handlers.onTokenExpiring?.(message.data.secondsRemaining);
468
+ this.handleTokenExpiring();
469
+ break;
470
+ case "token.expired":
471
+ this.handlers.onTokenExpired?.();
472
+ break;
473
+ case "backpressure.warning":
474
+ this.handlers.onBackpressureWarning?.(message.data.droppedCount, message.data.since, message.data.totalDropped);
475
+ break;
476
+ }
477
+ }
478
+ trackExecutionContext(data) {
479
+ if (typeof data !== "object" || data === null) return;
480
+ const eventData = data;
481
+ if (eventData.executionId) {
482
+ this.currentExecutionId = eventData.executionId;
483
+ this.saveReplayState();
484
+ }
485
+ if (eventData.type === "execution.started" && eventData.sessionId) {
486
+ this.currentSessionId = eventData.sessionId;
487
+ this.saveReplayState();
488
+ }
489
+ }
490
+ async handleTokenExpiring() {
491
+ if (!this.config.onTokenRefresh || this.isRefreshingToken) return;
492
+ this.isRefreshingToken = true;
493
+ try {
494
+ const result = await this.config.onTokenRefresh();
495
+ this.updateToken(result.token);
496
+ } catch (error) {
497
+ this.handlers.onError?.(`Token refresh failed: ${error instanceof Error ? error.message : String(error)}`, "TOKEN_REFRESH_FAILED");
498
+ } finally {
499
+ this.isRefreshingToken = false;
500
+ }
501
+ }
502
+ send(message) {
503
+ if (this.ws?.readyState === WebSocket.OPEN) {
504
+ this.ws.send(JSON.stringify(message));
505
+ this.messagesSent++;
506
+ }
507
+ }
508
+ sendWithResponse(message) {
509
+ return new Promise((resolve, reject) => {
510
+ const id = `msg_${++this.messageIdCounter}`;
511
+ this.pendingCallbacks.set(id, {
512
+ resolve,
513
+ reject
514
+ });
515
+ setTimeout(() => {
516
+ if (this.pendingCallbacks.has(id)) {
517
+ this.pendingCallbacks.delete(id);
518
+ reject(/* @__PURE__ */ new Error("Request timeout"));
519
+ }
520
+ }, 1e4);
521
+ this.send({
522
+ ...message,
523
+ id
524
+ });
525
+ });
526
+ }
527
+ restoreSubscriptions() {
528
+ const channels = this.config.channels;
529
+ const replayOptions = {};
530
+ if (this.lastEventId) replayOptions.lastEventId = this.lastEventId;
531
+ if (this.currentExecutionId) replayOptions.executionId = this.currentExecutionId;
532
+ if (this.currentSessionId) replayOptions.sessionId = this.currentSessionId;
533
+ const hasReplayState = Object.keys(replayOptions).length > 0;
534
+ if (hasReplayState) {
535
+ this.isReplaying = true;
536
+ this.replayProgress = {
537
+ total: 0,
538
+ received: 0
539
+ };
540
+ }
541
+ this.send({
542
+ type: "subscribe",
543
+ channels,
544
+ ...hasReplayState ? { replayOptions } : {}
545
+ });
546
+ }
547
+ startPingInterval() {
548
+ this.stopPingInterval();
549
+ this.pingInterval = setInterval(() => {
550
+ this.sendPing();
551
+ }, this.config.pingIntervalMs);
552
+ }
553
+ stopPingInterval() {
554
+ if (this.pingInterval) {
555
+ clearInterval(this.pingInterval);
556
+ this.pingInterval = null;
557
+ }
558
+ }
559
+ sendPing() {
560
+ if (this.ws?.readyState !== WebSocket.OPEN) return;
561
+ const timeSinceLastPong = this.lastPongAt ? Date.now() - this.lastPongAt : 0;
562
+ if (this.lastPongAt && timeSinceLastPong > this.config.pongTimeoutMs) {
563
+ this.missedPongCount++;
564
+ this.connectionMetrics = {
565
+ ...this.connectionMetrics,
566
+ missedPongCount: this.missedPongCount
567
+ };
568
+ this.updateConnectionQuality();
569
+ if (this.missedPongCount >= this.config.maxMissedPongs) {
570
+ this.ws?.close(4e3, "Pong timeout - connection unresponsive");
571
+ return;
572
+ }
573
+ }
574
+ this.lastPingAt = Date.now();
575
+ this.lastPingSentAt = Date.now();
576
+ this.send({ type: "ping" });
577
+ this.pongTimeout = setTimeout(() => {
578
+ this.missedPongCount++;
579
+ this.connectionMetrics = {
580
+ ...this.connectionMetrics,
581
+ missedPongCount: this.missedPongCount
582
+ };
583
+ this.updateConnectionQuality();
584
+ if (this.missedPongCount >= this.config.maxMissedPongs) this.ws?.close(4e3, "Pong timeout - connection unresponsive");
585
+ }, this.config.pongTimeoutMs);
586
+ }
587
+ clearPongTimeout() {
588
+ if (this.pongTimeout) {
589
+ clearTimeout(this.pongTimeout);
590
+ this.pongTimeout = null;
591
+ }
592
+ }
593
+ scheduleReconnect() {
594
+ if (this.reconnectTimer) return;
595
+ this.reconnectAttempts++;
596
+ const delay = Math.min(this.config.initialReconnectDelayMs * 2 ** (this.reconnectAttempts - 1), this.config.maxReconnectDelayMs);
597
+ const jitter = delay * .3 * (Math.random() * 2 - 1);
598
+ this.reconnectTimer = setTimeout(() => {
599
+ this.reconnectTimer = null;
600
+ this.connect();
601
+ }, delay + jitter);
602
+ }
603
+ cleanup() {
604
+ this.stopPingInterval();
605
+ this.clearPongTimeout();
606
+ if (this.reconnectTimer) {
607
+ clearTimeout(this.reconnectTimer);
608
+ this.reconnectTimer = null;
609
+ }
610
+ for (const [id, callback] of this.pendingCallbacks) {
611
+ callback.reject(/* @__PURE__ */ new Error("Connection closed"));
612
+ this.pendingCallbacks.delete(id);
613
+ }
614
+ }
615
+ updateConnectionMetrics(latency, pongTime) {
616
+ const avgLatency = this.pingLatencyHistory.length > 0 ? this.pingLatencyHistory.reduce((a, b) => a + b, 0) / this.pingLatencyHistory.length : null;
617
+ this.connectionMetrics = {
618
+ ...this.connectionMetrics,
619
+ lastPingLatencyMs: latency,
620
+ avgPingLatencyMs: avgLatency,
621
+ missedPongCount: this.missedPongCount,
622
+ lastPongAt: pongTime
623
+ };
624
+ this.updateConnectionQuality();
625
+ }
626
+ updateConnectionQuality() {
627
+ const isConnected = this.state === "connected";
628
+ const quality = calculateConnectionQuality(this.connectionMetrics, isConnected);
629
+ if (this.connectionMetrics.quality !== quality) {
630
+ this.connectionMetrics = {
631
+ ...this.connectionMetrics,
632
+ quality
633
+ };
634
+ this.handlers.onMetricsChange?.(this.connectionMetrics);
635
+ }
636
+ }
637
+ trackReconnection() {
638
+ const now = Date.now();
639
+ this.connectionMetrics = {
640
+ ...this.connectionMetrics,
641
+ reconnectCount: this.connectionMetrics.reconnectCount + 1,
642
+ lastReconnectAt: now
643
+ };
644
+ this.pingLatencyHistory = [];
645
+ this.updateConnectionQuality();
646
+ }
647
+ loadReplayState() {
648
+ if (!this.config.enableReplayPersistence) return;
649
+ const prefix = this.config.replayStorageKeyPrefix;
650
+ try {
651
+ this.lastEventId = this.config.replayStorage.getItem(prefix + STORAGE_KEYS.lastEventId);
652
+ this.currentExecutionId = this.config.replayStorage.getItem(prefix + STORAGE_KEYS.executionId);
653
+ this.currentSessionId = this.config.replayStorage.getItem(prefix + STORAGE_KEYS.sessionId);
654
+ } catch {}
655
+ }
656
+ saveReplayState() {
657
+ if (!this.config.enableReplayPersistence) return;
658
+ const prefix = this.config.replayStorageKeyPrefix;
659
+ try {
660
+ if (this.lastEventId) this.config.replayStorage.setItem(prefix + STORAGE_KEYS.lastEventId, this.lastEventId);
661
+ if (this.currentExecutionId) this.config.replayStorage.setItem(prefix + STORAGE_KEYS.executionId, this.currentExecutionId);
662
+ if (this.currentSessionId) this.config.replayStorage.setItem(prefix + STORAGE_KEYS.sessionId, this.currentSessionId);
663
+ } catch {}
664
+ }
665
+ };
666
+ //#endregion
667
+ export { INITIAL_METRICS, SessionGatewayClient, calculateConnectionQuality };