remotepy 1.0.10 → 1.3.0
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.
- package/README.md +48 -1
- package/dist/RemotePyClient.d.ts +100 -0
- package/dist/RemotePyClient.js +1 -1
- package/package.json +81 -69
package/README.md
CHANGED
|
@@ -2,7 +2,54 @@
|
|
|
2
2
|
|
|
3
3
|
Remote Py allows you to write python functions and run it on a server. It also provides you interfaces in multiple languages including JavaScript, CSharp and Python to call the remote python functions.
|
|
4
4
|
|
|
5
|
-
It is a RPC mechanism built on top of Web Sockets allowing you to communicate both ways.
|
|
5
|
+
It is a RPC mechanism built on top of Web Sockets allowing you to communicate both ways.
|
|
6
|
+
|
|
7
|
+
## What's new in 1.3.0
|
|
8
|
+
|
|
9
|
+
- **Callback API and generated proxies are now callId-correlated.** Every request
|
|
10
|
+
(including `remotepy.MyServer.fn(arg, cb)` proxies) carries a `callId`; the reply is
|
|
11
|
+
delivered to the callbacks of the request that made it. Overlapping calls to the same
|
|
12
|
+
function no longer cross-wire. Needs a server that echoes `callId` (remotepy >= 0.3);
|
|
13
|
+
against older servers replies are still routed by function name as before.
|
|
14
|
+
- **Callback calls fail fast instead of hanging**: a call made while disconnected, or in
|
|
15
|
+
flight when the connection closes, receives an `Error` through its error callback
|
|
16
|
+
(`(ok, error)` -> `error`; `(start, row, end, error)` -> `error`; a single callback gets
|
|
17
|
+
the `Error` as its first argument). `defaultTimeout` now applies to callback calls too.
|
|
18
|
+
- **Logging is off by default.** The client no longer prints request arguments or replies
|
|
19
|
+
(they carry tokens and secrets). `{ log: true }` logs lifecycle events only;
|
|
20
|
+
`{ debug: true }` additionally logs payloads, for local debugging.
|
|
21
|
+
- Replies for requests the client no longer waits for (timed out, connection dropped)
|
|
22
|
+
are discarded rather than handed to the next caller of the same function.
|
|
23
|
+
|
|
24
|
+
## What's new in 1.1.0
|
|
25
|
+
|
|
26
|
+
Fully backward compatible — all existing callback APIs work unchanged. New:
|
|
27
|
+
|
|
28
|
+
- **Promise-based API with `callId` correlation** — concurrent calls to the same function are
|
|
29
|
+
now safe (legacy callbacks were keyed by function name and clobbered each other):
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
const sum = await client.call('MyServer.add', { a: 2, b: 3 });
|
|
33
|
+
|
|
34
|
+
const rows = await client.callStream('MyServer.report', { n: 100 }, {
|
|
35
|
+
onRow: (index, item, total) => render(item),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
await client.callBinary('MyServer.upload', { name: 'f.bin' }, arrayBufferOrBlob);
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- **Per-call timeouts**: `client.call(fn, args, { timeout: 5000 })` or a
|
|
42
|
+
`defaultTimeout` constructor option. Server errors reject the promise (with `.traceback`).
|
|
43
|
+
- **Pending calls are rejected when the connection closes** (previously they hung forever).
|
|
44
|
+
- **Auto-reconnect** (opt-in): `new RemotePyClient(url, page, { autoReconnect: true })`
|
|
45
|
+
with exponential backoff; `client.close()` closes deliberately.
|
|
46
|
+
- **Node.js support**: `new RemotePyClient(url, page, { WebSocket: require('ws') })`.
|
|
47
|
+
- **Session helpers**: `client.setSessionId(id)` / `getSessionId()` (works outside browsers).
|
|
48
|
+
- **TypeScript definitions** shipped (`dist/RemotePyClient.d.ts`).
|
|
49
|
+
- **Bug fixes**: binary sends silently no-oped (`this` binding in FileReader callbacks);
|
|
50
|
+
4-callback streaming error handler indexed out of range; errors thrown inside `onmessage`
|
|
51
|
+
no longer abort post-message processing (route them to `client.onerror`); `{ log: false }`
|
|
52
|
+
silences console chatter.
|
|
6
53
|
|
|
7
54
|
####Requirements
|
|
8
55
|
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export interface RemotePyClientOptions {
|
|
2
|
+
/** WebSocket implementation (required under Node, e.g. `require('ws')`). */
|
|
3
|
+
WebSocket?: any;
|
|
4
|
+
/** Milliseconds before a promise-based call rejects. 0 = never (default). */
|
|
5
|
+
defaultTimeout?: number;
|
|
6
|
+
/** Reconnect with exponential backoff after an unexpected close. Default false. */
|
|
7
|
+
autoReconnect?: boolean;
|
|
8
|
+
reconnectDelayMs?: number;
|
|
9
|
+
reconnectMaxDelayMs?: number;
|
|
10
|
+
reconnectMaxAttempts?: number;
|
|
11
|
+
/** Log lifecycle events (connecting/connected/closed). Default false since 1.3.0. */
|
|
12
|
+
log?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Also log every request's arguments and every reply. Payloads routinely
|
|
15
|
+
* carry tokens and secrets: explicit opt-in for local debugging only. Default false.
|
|
16
|
+
*/
|
|
17
|
+
debug?: boolean;
|
|
18
|
+
/** After a reconnect, re-activate the stored session id automatically. */
|
|
19
|
+
sessionResume?: boolean;
|
|
20
|
+
/** RPC used for session resume. Default "SessionServer.startSessionIfNotStarted". */
|
|
21
|
+
sessionResumeFunc?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Promise returned by callStream, with server-side cancellation support. */
|
|
25
|
+
export interface StreamPromise<T> extends Promise<T[]> {
|
|
26
|
+
callId: string | null;
|
|
27
|
+
/** Ask the server to stop the stream; the promise resolves with rows so far. */
|
|
28
|
+
cancel(): void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface CallOptions {
|
|
32
|
+
/** Per-call timeout in ms; overrides `defaultTimeout`. */
|
|
33
|
+
timeout?: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface StreamHandlers {
|
|
37
|
+
onStart?: (returnValue: any, streamId: string) => void;
|
|
38
|
+
onRow?: (index: number, item: any, total?: number) => void;
|
|
39
|
+
onEnd?: (streamEmpty: boolean, cancelled: boolean) => void;
|
|
40
|
+
onError?: (error: Error) => void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export class RemotePyClient {
|
|
44
|
+
constructor(serverName?: string, clientPageId?: string, options?: RemotePyClientOptions);
|
|
45
|
+
|
|
46
|
+
serverName: string;
|
|
47
|
+
clientPageId: string;
|
|
48
|
+
isOpen: boolean;
|
|
49
|
+
PythonFunctions: Record<string, any>;
|
|
50
|
+
PythonFunctionsHelp: Record<string, string>;
|
|
51
|
+
|
|
52
|
+
/** User-assignable lifecycle hooks. */
|
|
53
|
+
oninit?: () => void;
|
|
54
|
+
onopen?: () => void;
|
|
55
|
+
onclose?: (event: any) => void;
|
|
56
|
+
onerror?: (error: unknown) => void;
|
|
57
|
+
onmessagereceived?: (event: any) => void;
|
|
58
|
+
onmessageprocessed?: () => void;
|
|
59
|
+
|
|
60
|
+
connect(): void;
|
|
61
|
+
/** Close deliberately; suppresses auto-reconnect. */
|
|
62
|
+
close(): void;
|
|
63
|
+
|
|
64
|
+
// ── Promise-based API (callId-correlated; safe for concurrent calls) ──
|
|
65
|
+
call<T = any>(funcName: string, args?: Record<string, any>, options?: CallOptions): Promise<T>;
|
|
66
|
+
callStream<T = any>(funcName: string, args: Record<string, any> | undefined,
|
|
67
|
+
handlers?: StreamHandlers, options?: CallOptions): StreamPromise<T>;
|
|
68
|
+
/** Ask the server to stop an in-progress stream (by callId). */
|
|
69
|
+
cancelStream(callId: string): void;
|
|
70
|
+
callBinary<T = any>(funcName: string, args: Record<string, any> | undefined,
|
|
71
|
+
data: ArrayBuffer | ArrayBufferView | Blob, options?: CallOptions): Promise<T>;
|
|
72
|
+
|
|
73
|
+
getSessionId(): string | null;
|
|
74
|
+
setSessionId(sessionId: string): void;
|
|
75
|
+
|
|
76
|
+
// ── Callback API (and the generated proxy functions from getServerAPI()) ──
|
|
77
|
+
// Since 1.3.0 each request carries a callId and replies are matched to the
|
|
78
|
+
// request that made them, so concurrent calls to one function are safe when
|
|
79
|
+
// the server echoes callId (remotepy >= 0.3). Calls made while disconnected,
|
|
80
|
+
// and calls in flight when the connection closes, receive an Error through
|
|
81
|
+
// their error callback ((ok, error) -> error; (start, row, end, error) ->
|
|
82
|
+
// error; a single callback receives it as its first argument).
|
|
83
|
+
callPythonFunction(funcName: string, args?: Record<string, any>, ...callbacks: Function[]): void;
|
|
84
|
+
callMultipleCallbackPythonFunction(funcName: string, ...args: any[]): void;
|
|
85
|
+
callFunc(funcName: string, args?: Record<string, any>, callback?: Function): void;
|
|
86
|
+
callPythonFunctionBinary(funcName: string, args: Record<string, any> | undefined,
|
|
87
|
+
file: Blob, callback?: Function): void;
|
|
88
|
+
registerJSFunctionToBeCalledByPython(funcName: string, func: Function): void;
|
|
89
|
+
registerCallbackToPythonFunction(funcName: string, callback: Function): void;
|
|
90
|
+
registerMultipleCallbackPythonFunction(funcName: string, ...callbacks: Function[]): void;
|
|
91
|
+
getServerAPI(): Record<string, any>;
|
|
92
|
+
getService(name: string): any;
|
|
93
|
+
|
|
94
|
+
addPreOpenEventHandler(func: Function): void;
|
|
95
|
+
addPreCloseEventHandler(func: Function): void;
|
|
96
|
+
addPreMessageEventHandler(func: Function): void;
|
|
97
|
+
addPostOpenEventHandler(func: Function): void;
|
|
98
|
+
addPostCloseEventHandler(func: Function): void;
|
|
99
|
+
addPostMessageEventHandler(func: Function): void;
|
|
100
|
+
}
|
package/dist/RemotePyClient.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a0_0x1143(_0x3849ee,_0x50c59c){var _0x355b74=a0_0x355b();return a0_0x1143=function(_0x11436e,_0x26c967){_0x11436e=_0x11436e-0x180;var _0x44cafe=_0x355b74[_0x11436e];return _0x44cafe;},a0_0x1143(_0x3849ee,_0x50c59c);}(function(_0x2baddf,_0x54eca1){var _0x2b2546=a0_0x1143,_0x16642c=_0x2baddf();while(!![]){try{var _0x1b979b=-parseInt(_0x2b2546(0x1ee))/0x1*(-parseInt(_0x2b2546(0x184))/0x2)+-parseInt(_0x2b2546(0x1d5))/0x3*(parseInt(_0x2b2546(0x192))/0x4)+parseInt(_0x2b2546(0x186))/0x5*(-parseInt(_0x2b2546(0x185))/0x6)+-parseInt(_0x2b2546(0x1d4))/0x7+-parseInt(_0x2b2546(0x182))/0x8*(parseInt(_0x2b2546(0x19c))/0x9)+-parseInt(_0x2b2546(0x1cc))/0xa*(-parseInt(_0x2b2546(0x1a3))/0xb)+parseInt(_0x2b2546(0x1d2))/0xc;if(_0x1b979b===_0x54eca1)break;else _0x16642c['push'](_0x16642c['shift']());}catch(_0x13e0eb){_0x16642c['push'](_0x16642c['shift']());}}}(a0_0x355b,0x9f1a5));import*as a0_0x4f3911 from'msgpack-lite';function a0_0x355b(){var _0x5521d9=['callFunc','Chart\x20Loading\x20Completed\x20...','stream_item','createJSProxyFunctions','addPostOpenEventHandler','row','getPythonFunctionLibraryHelp','5019464sUEUOE','data','618BAAjiM','3811188VCRbFz','10uUrFze','Connected\x20to\x20Server\x20:','callPythonFunctionBinary','\x20called\x20with\x20arguments:\x20','slice','start','isBinary','target','getSessionId','PreCloseEventHandlers','\x27].slice(0,\x20-1);\x0a','indexOf','4CzhfGi','addPreCloseEventHandler','var\x20args\x20=\x20Array.prototype.slice.call(arguments);\x20var\x20inputObject\x20=\x20{};\x20for(var\x20i\x20in\x20paramNames)\x20{\x20var\x20paramName\x20=\x20paramNames[i];\x20if(paramName\x20!=\x20\x27...func\x27)\x20{\x20inputObject[paramName]\x20=\x20args[i];}\x20}\x20return\x20this.callMultipleCallbackPythonFunction(\x27','registerCallbackToPythonFunction','registerMultipleCallbackPythonFunction','callMultipleCallbackPythonFunction','buffer','function','onclose','\x20...','9TiHGTk','callPythonFunction','Function\x20:\x20','PythonFunctions','result','stream_index','streaming','1794122YIWKPX','sendImageBinary','pythonCallbackDict','bind','substr','funcName','img','No\x20function\x20defined\x20for\x20','PostOpenEventHandlers','Connection\x20not\x20open.','onopen','StatusBar','callback','createElement','addPreMessageEventHandler','onmessage','binaryFunctionQueue','getServerAPI','send','getServerString','readyState','appendChild','readCallbackArguments','onmessageprocessed','addPostCloseEventHandler','var\x20paramNames\x20=\x20this.PythonFunctionsArgs[\x27','forEach','push','...func','match','innerHTML','\x20closed.','shift','stringify','onmessagereceived','isOpen','No\x20function\x20callback\x20defined\x20for\x20','func','onload','string','getPythonFunctionLibrary','20GVUEvr','jsFunctionDict','PostCloseEventHandlers','map','binaryType','clientPageId','32654472hLgche','log','6323555YeEJcA','1908510UcyVSc','JS2Py','Too\x20many\x20callbacks\x20for\x20','end','return','toString','No\x20msgpack\x20library\x20loaded','PythonFunctionsArgs','message(b)\x20received\x20:\x20','PreOpenEventHandlers','length','readAsArrayBuffer','blob','registerJSFunctionToBeCalledByPython','serverName','PreMessageEventHandlers','getItem','socket','sendBinary','PostMessageEventHandlers','error','00\x20','split','oninit','PythonFunctionsHelp','3371YOgZYx','pythonMultipleCallbackDict','args'];a0_0x355b=function(){return _0x5521d9;};return a0_0x355b();}function RemotePyClient(_0x3edf2f,_0x39d5bd){var _0x2e7274=a0_0x1143;if(_0x3edf2f===undefined)this[_0x2e7274(0x1e3)]='ws://localhost:80';else this['serverName']=_0x3edf2f;if(_0x39d5bd===undefined)this['clientPageId']='wss';else this[_0x2e7274(0x1d1)]=_0x39d5bd;this[_0x2e7274(0x1c6)]=![],this['jsFunctionDict']=[],this['pythonCallbackDict']=[],this['binaryFunctionQueue']=[],this[_0x2e7274(0x19f)]={},this['socket']=null,this[_0x2e7274(0x1ed)]={},this['pythonMultipleCallbackDict']={},this['PythonFunctionsArgs']={},this[_0x2e7274(0x1d6)]={};let _0x3e80ac=null;this[_0x2e7274(0x1de)]=[],this[_0x2e7274(0x18f)]=[],this[_0x2e7274(0x1e4)]=[],this[_0x2e7274(0x1ab)]=[],this[_0x2e7274(0x1ce)]=[],this[_0x2e7274(0x1e8)]=[],this['addPreOpenEventHandler']=_0x80ba77=>this[_0x2e7274(0x1de)]['push'](_0x80ba77),this[_0x2e7274(0x193)]=_0xb4e414=>this[_0x2e7274(0x18f)][_0x2e7274(0x1be)](_0xb4e414),this[_0x2e7274(0x1b1)]=_0x27dbec=>this['PreMessageEventHandlers'][_0x2e7274(0x1be)](_0x27dbec),this[_0x2e7274(0x1f5)]=_0x16db69=>this['PostOpenEventHandlers'][_0x2e7274(0x1be)](_0x16db69),this[_0x2e7274(0x1bb)]=_0x696d64=>this[_0x2e7274(0x1ce)]['push'](_0x696d64),this['addPostMessageEventHandler']=_0x11d672=>this[_0x2e7274(0x1e8)][_0x2e7274(0x1be)](_0x11d672),this[_0x2e7274(0x1b6)]=function(){var _0x19dc06=_0x2e7274;return this['serverName']+'/'+this[_0x19dc06(0x1d1)];},this[_0x2e7274(0x1b9)]=function(_0x3c1034,..._0x44b122){var _0x59982d=_0x2e7274;for(var _0x4f15db=_0x44b122['length']-0x1;_0x4f15db>=0x0;--_0x4f15db){if(typeof _0x44b122[_0x4f15db]!==_0x59982d(0x199))break;}var _0x3ac158=_0x44b122[_0x59982d(0x18a)](0x0,_0x4f15db+0x1),_0x319559=_0x44b122[_0x59982d(0x18a)](_0x4f15db+0x1);return[_0x3c1034,_0x3ac158,_0x319559];},this[_0x2e7274(0x196)]=function(_0x5b8b4d,..._0x3f06ba){var _0x5904a3=_0x2e7274;this[_0x5904a3(0x1ef)][_0x5b8b4d]=_0x3f06ba;},this[_0x2e7274(0x197)]=function(_0x20f732,..._0x317024){var _0x5aec4e=_0x2e7274,_0x4f5f73=this[_0x5aec4e(0x1b9)](_0x20f732,..._0x317024);_0x20f732=_0x4f5f73[0x0];let _0x104b83=_0x4f5f73[0x1][0x0],_0x3257de=_0x4f5f73[0x2];this[_0x5aec4e(0x1c6)]?(this[_0x5aec4e(0x1e6)][_0x5aec4e(0x1b5)](JSON['stringify']({'funcName':_0x20f732,'args':_0x104b83,'session_id':this['getSessionId']()})),console[_0x5aec4e(0x1d3)]('Function\x20:\x20'+_0x20f732+_0x5aec4e(0x189),_0x104b83)):console[_0x5aec4e(0x1d3)](_0x5aec4e(0x1ac)),_0x3257de['length']>0x0&&this[_0x5aec4e(0x196)](_0x20f732,..._0x3257de);},this[_0x2e7274(0x195)]=function(_0x4102bf,_0x230626){var _0x28a19a=_0x2e7274,_0x20eef3=this[_0x28a19a(0x1a5)][_0x28a19a(0x1cf)](function(_0x29d1b2){var _0x4c7ad4=_0x28a19a;return _0x29d1b2[_0x4c7ad4(0x1a8)];})['indexOf'](_0x4102bf);_0x20eef3<0x0?this[_0x28a19a(0x1a5)][_0x28a19a(0x1be)]({'funcName':_0x4102bf,'callback':_0x230626}):this[_0x28a19a(0x1a5)][_0x20eef3][_0x28a19a(0x1af)]=_0x230626;},this['getSessionId']=function(){var _0xf983a9=_0x2e7274;return sessionStorage[_0xf983a9(0x1e5)]('JS2PY_SESSION_ID');},this[_0x2e7274(0x1e2)]=function(_0x59b5db,_0x518551){var _0x51c2b5=_0x2e7274;this[_0x51c2b5(0x1cd)][_0x51c2b5(0x1be)]({'funcName':_0x59b5db,'func':_0x518551});},this[_0x2e7274(0x1f1)]=function(_0x2b76a8,_0xe7ad79,_0xfe19d){var _0x4fe202=_0x2e7274;this[_0x4fe202(0x1c6)]?(this[_0x4fe202(0x1e6)][_0x4fe202(0x1b5)](JSON[_0x4fe202(0x1c4)]({'funcName':_0x2b76a8,'args':_0xe7ad79,'session_id':this[_0x4fe202(0x18e)]()})),console[_0x4fe202(0x1d3)](_0x4fe202(0x19e)+_0x2b76a8+_0x4fe202(0x189),_0xe7ad79)):console[_0x4fe202(0x1d3)]('Connection\x20not\x20open.');if(_0xfe19d===undefined){}else this[_0x4fe202(0x195)](_0x2b76a8,_0xfe19d);},this[_0x2e7274(0x19d)]=function(_0x173ef7,_0xf24224,..._0xd05a79){var _0x1ee9af=_0x2e7274;this[_0x1ee9af(0x197)](_0x173ef7,_0xf24224,..._0xd05a79);},this[_0x2e7274(0x188)]=function(_0x8dd97,_0x433e1d,_0x81fa5a,_0x1021d4){var _0x5b9f3d=_0x2e7274;_0x433e1d===undefined&&(_0x433e1d={});_0x433e1d[_0x5b9f3d(0x18c)]=!![],this[_0x5b9f3d(0x1f1)](_0x8dd97,_0x433e1d);if(this[_0x5b9f3d(0x1c6)]){this[_0x5b9f3d(0x1e7)](_0x81fa5a);if(_0x1021d4===undefined){}else this['registerCallbackToPythonFunction'](_0x8dd97,_0x1021d4);}else console[_0x5b9f3d(0x1d3)](_0x5b9f3d(0x1ac));},this[_0x2e7274(0x1e7)]=function(_0x17aeb2){var _0x4dde73=_0x2e7274,_0x21e61e=new FileReader();_0x21e61e['onload']=function(_0x278dd7){var _0x19d698=a0_0x1143,_0x322bc0=_0x278dd7[_0x19d698(0x18d)][_0x19d698(0x1a0)];if(this[_0x19d698(0x1e6)]&&this['socket'][_0x19d698(0x1b7)]==0x1)this[_0x19d698(0x1e6)]['send'](_0x322bc0);},_0x21e61e[_0x4dde73(0x1e0)](_0x17aeb2);},this['sendNonImageBinary']=function(_0x4e20f0){var _0xf24b74=_0x2e7274;if(_0x4e20f0['type'][_0xf24b74(0x1c0)](/image.*/)){console[_0xf24b74(0x1d3)]('The\x20dropped\x20file\x20is\x20an\x20image:\x20',_0x4e20f0['type']);return;}var _0x220741=new FileReader();_0x220741[_0xf24b74(0x1c9)]=function(_0x18c630){var _0x1e25b1=_0xf24b74,_0x23dc49=_0x18c630[_0x1e25b1(0x18d)][_0x1e25b1(0x1a0)];if(this[_0x1e25b1(0x1e6)]&&this[_0x1e25b1(0x1e6)][_0x1e25b1(0x1b7)]==0x1)this[_0x1e25b1(0x1e6)][_0x1e25b1(0x1b5)](_0x23dc49);},_0x220741[_0xf24b74(0x1e0)](_0x4e20f0);},this[_0x2e7274(0x1a4)]=function(_0xdd8c8f){var _0x2f738f=_0x2e7274;if(!_0xdd8c8f['type'][_0x2f738f(0x1c0)](/image.*/)){console[_0x2f738f(0x1d3)]('The\x20dropped\x20file\x20is\x20not\x20an\x20image:\x20',_0xdd8c8f['type']);return;}var _0x28af50=new FileReader();_0x28af50['onload']=function(_0x4de854){var _0x2efe03=_0x2f738f,_0x658fd2=_0x4de854[_0x2efe03(0x18d)]['result'];if(this[_0x2efe03(0x1e6)]&&this['socket'][_0x2efe03(0x1b7)]==0x1)this[_0x2efe03(0x1e6)][_0x2efe03(0x1b5)](_0x658fd2);},_0x28af50[_0x2f738f(0x1e0)](_0xdd8c8f);},this[_0x2e7274(0x1f4)]=function(_0xdb97b5){var _0x219ac8=_0x2e7274;for(var _0x3df5f7 in this['PythonFunctionsArgs']){var _0x1247d7=this[_0x219ac8(0x1dc)][_0x3df5f7];_0x1247d7[_0x219ac8(0x1be)](_0x219ac8(0x1bf));var _0x55fc1e=_0x219ac8(0x1bc)+_0x3df5f7+_0x219ac8(0x190)+_0x219ac8(0x194)+_0x3df5f7+'\x27,\x20inputObject,\x20...func);';_0x1247d7[_0x219ac8(0x1be)](_0x55fc1e),_0x3e80ac=this;if(_0x3df5f7[_0x219ac8(0x191)]('.')>=0x0){var _0x388590=_0x3df5f7[_0x219ac8(0x1eb)]('.'),_0x39076d=this['PythonFunctions'];for(var _0x3dd9a8=0x0;_0x3dd9a8<_0x388590[_0x219ac8(0x1df)]-0x1;_0x3dd9a8++){!(_0x388590[_0x3dd9a8]in _0x39076d)&&(_0x39076d[_0x388590[_0x3dd9a8]]={}),_0x39076d=_0x39076d[_0x388590[_0x3dd9a8]];}_0x39076d[_0x388590[_0x388590[_0x219ac8(0x1df)]-0x1]]=Function['apply'](null,_0x1247d7)['bind'](this);}else this[_0x219ac8(0x19f)][_0x3df5f7]=Function['apply'](null,_0x1247d7)[_0x219ac8(0x1a6)](this);}},this['connect']=function(){var _0x6e41db=_0x2e7274;this[_0x6e41db(0x1ec)]!==undefined&&this[_0x6e41db(0x1ec)]();var _0x128a05=this[_0x6e41db(0x1b6)]();console[_0x6e41db(0x1d3)]('Connecting\x20to\x20:\x20'+_0x128a05+_0x6e41db(0x19b)),this[_0x6e41db(0x1e6)]=new WebSocket(_0x128a05),this[_0x6e41db(0x1e6)][_0x6e41db(0x1d0)]='arraybuffer',_0x3e80ac=this,this[_0x6e41db(0x1e6)][_0x6e41db(0x1ad)]=function(){var _0xabd0f1=_0x6e41db;console[_0xabd0f1(0x1d3)](_0xabd0f1(0x187)+_0x128a05),_0x3e80ac[_0xabd0f1(0x1de)][_0xabd0f1(0x1bd)](_0x44efbd=>_0x44efbd()),_0x3e80ac[_0xabd0f1(0x1c6)]=!![],_0x3e80ac[_0xabd0f1(0x1ad)]!==undefined&&(_0x3e80ac[_0xabd0f1(0x197)](_0xabd0f1(0x1cb),{},function(_0x1f2c5e){var _0x130946=_0xabd0f1;_0x3e80ac[_0x130946(0x1dc)]={};for(var _0x2cf358 in _0x1f2c5e){_0x1f2c5e[_0x2cf358][_0x130946(0x1c3)](),_0x1f2c5e[_0x2cf358][0x0]=='session_id'&&_0x1f2c5e[_0x2cf358][_0x130946(0x1c3)](),_0x3e80ac[_0x130946(0x1dc)][_0x2cf358]=_0x1f2c5e[_0x2cf358];}_0x3e80ac[_0x130946(0x1f4)](''),_0x3e80ac[_0x130946(0x1ad)]();}),_0x3e80ac['callMultipleCallbackPythonFunction'](_0xabd0f1(0x181),{},function(_0x1eb994){var _0x42923d=_0xabd0f1;_0x3e80ac[_0x42923d(0x1ed)]=_0x1eb994;})),_0x3e80ac[_0xabd0f1(0x1ab)][_0xabd0f1(0x1bd)](_0x5732ec=>_0x5732ec());},this['socket'][_0x6e41db(0x1b2)]=function(_0x4b5336){var _0x25ac84=_0x6e41db;_0x3e80ac[_0x25ac84(0x1e4)][_0x25ac84(0x1bd)](_0x13637f=>_0x13637f());_0x3e80ac[_0x25ac84(0x1c5)]!==undefined&&_0x3e80ac[_0x25ac84(0x1c5)](_0x4b5336);let _0x280046=null;if(_0x4b5336['data']instanceof ArrayBuffer)try{const _0x424a4f=a0_0x4f3911['decode'](new Uint8Array(_0x4b5336[_0x25ac84(0x183)]));_0x280046=_0x424a4f;}catch(_0x2b8e86){_0x280046=null;}else typeof _0x4b5336[_0x25ac84(0x183)]==_0x25ac84(0x1ca)&&(_0x280046=JSON['parse'](_0x4b5336[_0x25ac84(0x183)]));if(_0x280046!==null){console['log']('Message\x20received:\x20',_0x280046);if(_0x25ac84(0x1f0)in _0x280046){var _0x41abb2=_0x3e80ac[_0x25ac84(0x1cd)][_0x25ac84(0x1cf)](function(_0x88e20f){var _0x542bb8=_0x25ac84;return _0x88e20f[_0x542bb8(0x1a8)];})[_0x25ac84(0x191)](_0x280046[_0x25ac84(0x1a8)]);if(_0x41abb2>=0x0){var _0x583683=_0x3e80ac['jsFunctionDict'][_0x41abb2];_0x25ac84(0x18c)in _0x280046[_0x25ac84(0x1f0)]?_0x3e80ac[_0x25ac84(0x1b3)][_0x25ac84(0x1be)]({'funcName':_0x280046[_0x25ac84(0x1a8)],'callback':_0x583683['func'],'args':_0x280046[_0x25ac84(0x1f0)]}):_0x583683[_0x25ac84(0x1c8)](_0x280046['args']);}else{if(_0x280046[_0x25ac84(0x1a8)]===_0x25ac84(0x1cb))return;else throw'No\x20function\x20defined\x20for\x20'+_0x280046['funcName'];}}else{if(_0x25ac84(0x1a2)in _0x280046){if(_0x280046[_0x25ac84(0x1a8)]in _0x3e80ac[_0x25ac84(0x1ef)]){var _0x41a5fb=_0x3e80ac[_0x25ac84(0x1ef)][_0x280046[_0x25ac84(0x1a8)]];switch(_0x41a5fb[_0x25ac84(0x1df)]){case 0x0:break;case 0x1:if(_0x25ac84(0x1e9)in _0x280046)_0x41a5fb[0x0](_0x280046[_0x25ac84(0x1e9)],![]);if(_0x25ac84(0x1d9)in _0x280046)_0x41a5fb[0x0](_0x280046['streaming'],_0x280046[_0x25ac84(0x1d9)],![]);break;case 0x2:if(_0x25ac84(0x1e9)in _0x280046)_0x41a5fb[0x0](_0x280046[_0x25ac84(0x1e9)],![]);if(_0x25ac84(0x1d9)in _0x280046)_0x41a5fb[0x0](_0x280046[_0x25ac84(0x1a2)],_0x280046[_0x25ac84(0x1d9)],![]);if(_0x280046[_0x25ac84(0x1a2)]==_0x25ac84(0x180))_0x41a5fb[0x1](_0x280046[_0x25ac84(0x1a1)],_0x280046[_0x25ac84(0x1f3)],![]);break;case 0x3:if(_0x25ac84(0x1e9)in _0x280046)_0x41a5fb[0x0](_0x280046[_0x25ac84(0x1e9)],![]);if(_0x280046[_0x25ac84(0x1a2)]=='start')_0x41a5fb[0x0](_0x280046[_0x25ac84(0x1d9)],![]);if(_0x280046[_0x25ac84(0x1a2)]==_0x25ac84(0x180))_0x41a5fb[0x1](_0x280046[_0x25ac84(0x1a1)],_0x280046[_0x25ac84(0x1f3)],![]);if(_0x280046[_0x25ac84(0x1a2)]==_0x25ac84(0x1d8))_0x41a5fb[0x2](_0x280046['stream_empty'],![]);break;case 0x4:if('error'in _0x280046)_0x41a5fb[0x4](_0x280046['error'],![]);if(_0x280046[_0x25ac84(0x1a2)]==_0x25ac84(0x18b))_0x41a5fb[0x0](_0x280046[_0x25ac84(0x1d9)],![]);if(_0x280046[_0x25ac84(0x1a2)]==_0x25ac84(0x180))_0x41a5fb[0x1](_0x280046['stream_index'],_0x280046[_0x25ac84(0x1f3)],![]);if(_0x280046['streaming']=='end')_0x41a5fb[0x2](_0x280046['stream_empty'],![]);break;default:throw _0x25ac84(0x1d7)+_0x280046[_0x25ac84(0x1a8)];}}else throw _0x25ac84(0x1c7)+_0x280046[_0x25ac84(0x1a8)];}else{if(_0x280046[_0x25ac84(0x1a8)]in _0x3e80ac[_0x25ac84(0x1ef)]){var _0x41a5fb=_0x3e80ac[_0x25ac84(0x1ef)][_0x280046[_0x25ac84(0x1a8)]];switch(_0x41a5fb['length']){case 0x0:break;case 0x1:if(_0x25ac84(0x1e9)in _0x280046)_0x41a5fb[0x0](_0x280046[_0x25ac84(0x1e9)],![]);if(_0x25ac84(0x1d9)in _0x280046)_0x41a5fb[0x0](_0x280046[_0x25ac84(0x1d9)],![]);break;case 0x2:if(_0x25ac84(0x1e9)in _0x280046)_0x41a5fb[0x1](_0x280046[_0x25ac84(0x1e9)],![]);if(_0x25ac84(0x1d9)in _0x280046)_0x41a5fb[0x0](_0x280046[_0x25ac84(0x1d9)],![]);break;case 0x3:if('error'in _0x280046)_0x41a5fb[0x0](_0x280046['error'],![]);if(_0x25ac84(0x1d9)in _0x280046)_0x41a5fb[0x0](_0x280046[_0x25ac84(0x1d9)],![]);break;default:throw _0x25ac84(0x1d7)+_0x280046[_0x25ac84(0x1a8)];}}else{var _0x41abb2=_0x3e80ac[_0x25ac84(0x1a5)][_0x25ac84(0x1cf)](function(_0xf10787){var _0x19dfc7=_0x25ac84;return _0xf10787[_0x19dfc7(0x1a8)];})[_0x25ac84(0x191)](_0x280046[_0x25ac84(0x1a8)]);if(_0x41abb2>=0x0){var _0x583683=_0x3e80ac[_0x25ac84(0x1a5)][_0x41abb2];_0x280046[_0x25ac84(0x1d9)]===undefined?_0x280046[_0x25ac84(0x1e9)]!==undefined&&_0x583683[_0x25ac84(0x1af)](_0x280046[_0x25ac84(0x1e9)],![]):_0x583683['callback'](_0x280046[_0x25ac84(0x1d9)],!![]);}else throw _0x25ac84(0x1aa)+_0x280046[_0x25ac84(0x1a8)];}}}}else{console[_0x25ac84(0x1d3)](_0x25ac84(0x1db));var _0xa43016=new Uint8Array(_0x4b5336[_0x25ac84(0x183)]),_0x32c00b='\x20';for(var _0x23612d=0x0;_0x23612d<_0xa43016[_0x25ac84(0x1df)];_0x23612d++){_0x32c00b+=(_0x25ac84(0x1ea)+_0xa43016[_0x23612d][_0x25ac84(0x1da)](0x10))[_0x25ac84(0x1a7)](-0x2);}var _0x22e87f=_0x4b5336['data'],_0x3ea486=new Uint8Array(_0x22e87f),_0x43fff0=new Blob([_0x3ea486[_0x25ac84(0x198)]]);if(_0x3e80ac[_0x25ac84(0x1b3)][_0x25ac84(0x1df)]>0x0){var _0x5d509d=_0x3e80ac[_0x25ac84(0x1b3)]['shift']();_0x5d509d['args'][_0x25ac84(0x1e1)]=_0x43fff0,_0x5d509d[_0x25ac84(0x1af)](_0x5d509d['args']);}else{var _0x17467f=new FileReader();_0x17467f[_0x25ac84(0x1c9)]=function(_0x29b88a){var _0x3d7176=_0x25ac84,_0x2635f5=document[_0x3d7176(0x1b0)](_0x3d7176(0x1a9));_0x2635f5['src']=_0x29b88a[_0x3d7176(0x18d)][_0x3d7176(0x1a0)],document['body'][_0x3d7176(0x1b8)](_0x2635f5);},_0x17467f['readAsDataURL'](_0x43fff0),document['getElementById'](_0x25ac84(0x1ae))[_0x25ac84(0x1c1)]=_0x25ac84(0x1f2);}console[_0x25ac84(0x1d3)](_0x25ac84(0x1dd),_0x32c00b);}_0x3e80ac[_0x25ac84(0x1ba)]!==undefined&&_0x3e80ac['onmessageprocessed'](),_0x3e80ac[_0x25ac84(0x1e8)][_0x25ac84(0x1bd)](_0xf2209e=>_0xf2209e());},this[_0x6e41db(0x1e6)][_0x6e41db(0x19a)]=function(_0x1e60e4){var _0x431859=_0x6e41db;console[_0x431859(0x1d3)]('Connection\x20to\x20'+_0x128a05+_0x431859(0x1c2)),_0x3e80ac[_0x431859(0x18f)][_0x431859(0x1bd)](_0x425f2e=>_0x425f2e(_0x1e60e4)),_0x3e80ac['isOpen']=![],this[_0x431859(0x1e6)]=null,_0x3e80ac[_0x431859(0x19a)]!==undefined&&_0x3e80ac[_0x431859(0x19a)](_0x1e60e4),_0x3e80ac[_0x431859(0x1ce)][_0x431859(0x1bd)](_0x2a6f8b=>_0x2a6f8b(_0x1e60e4));};},this[_0x2e7274(0x1b4)]=function(){var _0x5cb857=_0x2e7274;return this[_0x5cb857(0x19f)];},this['getService']=function(_0x558171){var _0x1962b1=_0x2e7274;return this[_0x1962b1(0x19f)][_0x558171];};}export{RemotePyClient};
|
|
1
|
+
function a0_0x14e3(_0x2b3de8,_0x4ce21d){var _0x531a51=a0_0x531a();return a0_0x14e3=function(_0x14e37a,_0x4e7663){_0x14e37a=_0x14e37a-0xe5;var _0x56616c=_0x531a51[_0x14e37a];return _0x56616c;},a0_0x14e3(_0x2b3de8,_0x4ce21d);}(function(_0x1b8859,_0x2be9a5){var _0x35f707=a0_0x14e3,_0x34eeca=_0x1b8859();while(!![]){try{var _0x59a2d0=-parseInt(_0x35f707(0x19e))/0x1+parseInt(_0x35f707(0x115))/0x2+parseInt(_0x35f707(0x135))/0x3*(parseInt(_0x35f707(0x170))/0x4)+-parseInt(_0x35f707(0x16a))/0x5+-parseInt(_0x35f707(0x167))/0x6+parseInt(_0x35f707(0x112))/0x7*(-parseInt(_0x35f707(0x1a5))/0x8)+parseInt(_0x35f707(0x14d))/0x9*(parseInt(_0x35f707(0x199))/0xa);if(_0x59a2d0===_0x2be9a5)break;else _0x34eeca['push'](_0x34eeca['shift']());}catch(_0x4e72bd){_0x34eeca['push'](_0x34eeca['shift']());}}}(a0_0x531a,0x70b40));import*as a0_0x452d58 from'msgpack-lite';function RemotePyClient(_0x16f826,_0xe8ba67,_0x251f1d){var _0x308d75=a0_0x14e3;if(_0x16f826===undefined)this[_0x308d75(0x15a)]='ws://localhost:80';else this['serverName']=_0x16f826;if(_0xe8ba67===undefined)this[_0x308d75(0x198)]=_0x308d75(0x148);else this[_0x308d75(0x198)]=_0xe8ba67;_0x251f1d=_0x251f1d||{},this[_0x308d75(0xee)]=_0x251f1d;var _0x18f111=function(){};this[_0x308d75(0x17d)]=_0x251f1d['log']===!![]||_0x251f1d['debug']===!![]?console[_0x308d75(0x125)][_0x308d75(0xf8)](console):_0x18f111,this[_0x308d75(0x197)]=_0x251f1d[_0x308d75(0x16d)]===!![]?console['log'][_0x308d75(0xf8)](console):_0x18f111,this[_0x308d75(0x134)]=_0x251f1d['WebSocket']||(typeof WebSocket!==_0x308d75(0x138)?WebSocket:typeof globalThis!==_0x308d75(0x138)?globalThis[_0x308d75(0x1a4)]:undefined),this['_defaultTimeout']=_0x251f1d['defaultTimeout']||0x0,this[_0x308d75(0x14b)]=!!_0x251f1d[_0x308d75(0x159)],this[_0x308d75(0x183)]=_0x251f1d['reconnectDelayMs']||0x1f4,this[_0x308d75(0x156)]=_0x251f1d[_0x308d75(0x15d)]||0x7530,this['_reconnectMaxAttempts']=_0x251f1d['reconnectMaxAttempts']||Infinity,this[_0x308d75(0xf7)]=0x0,this[_0x308d75(0x16e)]=null,this['_closedByUser']=![],this[_0x308d75(0x13d)]=new Map(),this[_0x308d75(0x13c)]=new Map(),this[_0x308d75(0x142)]=0x0,this[_0x308d75(0x1a7)]=null,this[_0x308d75(0xef)]=![],this[_0x308d75(0xe5)]=[],this['pythonCallbackDict']=[],this[_0x308d75(0x175)]=[],this[_0x308d75(0x137)]={},this[_0x308d75(0x17b)]=null,this[_0x308d75(0xea)]={},this['pythonMultipleCallbackDict']={},this[_0x308d75(0x18f)]={},this['JS2Py']={};let _0x54f2f2=null;this[_0x308d75(0x179)]=[],this[_0x308d75(0x185)]=[],this['PreMessageEventHandlers']=[],this[_0x308d75(0xe8)]=[],this[_0x308d75(0x104)]=[],this[_0x308d75(0x128)]=[],this[_0x308d75(0x144)]=_0x4fd09b=>this['PreOpenEventHandlers']['push'](_0x4fd09b),this['addPreCloseEventHandler']=_0x23f942=>this['PreCloseEventHandlers'][_0x308d75(0x18e)](_0x23f942),this['addPreMessageEventHandler']=_0x227e36=>this[_0x308d75(0xfb)][_0x308d75(0x18e)](_0x227e36),this['addPostOpenEventHandler']=_0x32948c=>this[_0x308d75(0xe8)][_0x308d75(0x18e)](_0x32948c),this[_0x308d75(0x133)]=_0x4dece9=>this[_0x308d75(0x104)]['push'](_0x4dece9),this['addPostMessageEventHandler']=_0x5df2b4=>this[_0x308d75(0x128)][_0x308d75(0x18e)](_0x5df2b4),this[_0x308d75(0x17c)]=function(){var _0x174274=_0x308d75;return this['serverName']+'/'+this[_0x174274(0x198)];},this[_0x308d75(0x1a2)]=function(_0x227455,..._0x4a8e34){var _0x259af8=_0x308d75;for(var _0x2901e3=_0x4a8e34[_0x259af8(0x12f)]-0x1;_0x2901e3>=0x0;--_0x2901e3){if(typeof _0x4a8e34[_0x2901e3]!==_0x259af8(0xe7))break;}var _0xb2bf5e=_0x4a8e34[_0x259af8(0x132)](0x0,_0x2901e3+0x1),_0x11a20b=_0x4a8e34[_0x259af8(0x132)](_0x2901e3+0x1);return[_0x227455,_0xb2bf5e,_0x11a20b];},this['registerMultipleCallbackPythonFunction']=function(_0x455ba6,..._0x3195c4){this['pythonMultipleCallbackDict'][_0x455ba6]=_0x3195c4;},this['callMultipleCallbackPythonFunction']=function(_0x11a7f3,..._0x34f574){var _0x30e241=this['readCallbackArguments'](_0x11a7f3,..._0x34f574);this['_callLegacy'](_0x30e241[0x0],_0x30e241[0x1][0x0],_0x30e241[0x2],![]);},this[_0x308d75(0x172)]=function(_0x53747f,_0xc50d7b,_0x3fc05a,_0x120d09){var _0x4c94e9=_0x308d75,_0x4a3dc5=_0x3fc05a[_0x4c94e9(0x12f)]>0x0;_0x4a3dc5&&this['registerMultipleCallbackPythonFunction'](_0x53747f,..._0x3fc05a);if(!this['isOpen']){this[_0x4c94e9(0x17d)](_0x4c94e9(0x121));_0x4a3dc5&&!_0x120d09&&this[_0x4c94e9(0x152)](_0x3fc05a,new Error('Connection\x20not\x20open.'));return;}var _0x4ac23a=this[_0x4c94e9(0x11a)]();if(_0x4a3dc5){var _0x11e762={'funcName':_0x53747f,'callbacks':_0x3fc05a,'timer':null,'internal':!!_0x120d09};if(this['_defaultTimeout']>0x0&&!_0x120d09){var _0x4e8cab=this;_0x11e762[_0x4c94e9(0x102)]=setTimeout(function(){var _0x173d32=_0x4c94e9;_0x4e8cab[_0x173d32(0x13c)][_0x173d32(0x126)](_0x4ac23a),_0x4e8cab[_0x173d32(0x19c)](_0x3fc05a,new Error(_0x173d32(0x154)+_0x4e8cab[_0x173d32(0x157)]+_0x173d32(0xff)+_0x53747f));},this[_0x4c94e9(0x157)]);}this[_0x4c94e9(0x13c)][_0x4c94e9(0x14c)](_0x4ac23a,_0x11e762);}this[_0x4c94e9(0x17b)][_0x4c94e9(0x191)](JSON[_0x4c94e9(0x16c)]({'funcName':_0x53747f,'args':_0xc50d7b,'session_id':this[_0x4c94e9(0x124)](),'callId':_0x4ac23a})),this[_0x4c94e9(0x197)](_0x4c94e9(0x129)+_0x53747f+_0x4c94e9(0x13b),_0xc50d7b);},this['_legacyErrorCallbackIndex']=function(_0x100f8b){var _0x1c68ff=_0x308d75;if(_0x100f8b[_0x1c68ff(0x12f)]===0x2)return 0x1;if(_0x100f8b[_0x1c68ff(0x12f)]===0x4)return 0x3;return 0x0;},this[_0x308d75(0x19c)]=function(_0xc6de57,_0x5065a3){var _0x6c19ea=_0x308d75;try{_0xc6de57[this[_0x6c19ea(0x166)](_0xc6de57)](_0x5065a3,![]);}catch(_0x41eb1b){this[_0x6c19ea(0x16f)](_0x41eb1b);}},this[_0x308d75(0x152)]=function(_0x46ba76,_0x10d1e2){var _0x35ecd4=this;setTimeout(function(){_0x35ecd4['_invokeLegacyError'](_0x46ba76,_0x10d1e2);},0x0);},this[_0x308d75(0x10c)]=function(_0x4a9e24){var _0x53cf4f=_0x308d75;if(!(_0x53cf4f(0xf2)in _0x4a9e24))return!![];return _0x53cf4f(0xfe)in _0x4a9e24||_0x4a9e24['streaming']=='end';},this['_dispatchLegacyReply']=function(_0x17aa80,_0x2f917a){var _0x2b5896=_0x308d75;if('streaming'in _0x2f917a){switch(_0x17aa80[_0x2b5896(0x12f)]){case 0x0:break;case 0x1:if('error'in _0x2f917a)_0x17aa80[0x0](_0x2f917a[_0x2b5896(0xfe)],![]);if('return'in _0x2f917a)_0x17aa80[0x0](_0x2f917a[_0x2b5896(0xf2)],_0x2f917a[_0x2b5896(0x18d)],![]);break;case 0x2:if(_0x2b5896(0xfe)in _0x2f917a)_0x17aa80[0x0](_0x2f917a[_0x2b5896(0xfe)],![]);if('return'in _0x2f917a)_0x17aa80[0x0](_0x2f917a[_0x2b5896(0xf2)],_0x2f917a[_0x2b5896(0x18d)],![]);if(_0x2f917a[_0x2b5896(0xf2)]==_0x2b5896(0x122))_0x17aa80[0x1](_0x2f917a[_0x2b5896(0x162)],_0x2f917a['stream_item'],![]);break;case 0x3:if(_0x2b5896(0xfe)in _0x2f917a)_0x17aa80[0x0](_0x2f917a[_0x2b5896(0xfe)],![]);if(_0x2f917a[_0x2b5896(0xf2)]==_0x2b5896(0x182))_0x17aa80[0x0](_0x2f917a['return'],![]);if(_0x2f917a[_0x2b5896(0xf2)]==_0x2b5896(0x122))_0x17aa80[0x1](_0x2f917a[_0x2b5896(0x162)],_0x2f917a['stream_item'],![]);if(_0x2f917a[_0x2b5896(0xf2)]==_0x2b5896(0x196))_0x17aa80[0x2](_0x2f917a[_0x2b5896(0x184)],![]);break;case 0x4:if(_0x2b5896(0xfe)in _0x2f917a)_0x17aa80[0x3](_0x2f917a[_0x2b5896(0xfe)],![]);if(_0x2f917a[_0x2b5896(0xf2)]==_0x2b5896(0x182))_0x17aa80[0x0](_0x2f917a[_0x2b5896(0x18d)],![]);if(_0x2f917a['streaming']==_0x2b5896(0x122))_0x17aa80[0x1](_0x2f917a['stream_index'],_0x2f917a['stream_item'],![]);if(_0x2f917a[_0x2b5896(0xf2)]==_0x2b5896(0x196))_0x17aa80[0x2](_0x2f917a[_0x2b5896(0x184)],![]);break;default:throw _0x2b5896(0x15e)+_0x2f917a[_0x2b5896(0x174)];}return;}switch(_0x17aa80[_0x2b5896(0x12f)]){case 0x0:break;case 0x1:if(_0x2b5896(0xfe)in _0x2f917a)_0x17aa80[0x0](_0x2f917a[_0x2b5896(0xfe)],![]);if(_0x2b5896(0x18d)in _0x2f917a)_0x17aa80[0x0](_0x2f917a[_0x2b5896(0x18d)],![]);break;case 0x2:if(_0x2b5896(0xfe)in _0x2f917a)_0x17aa80[0x1](_0x2f917a['error'],![]);if(_0x2b5896(0x18d)in _0x2f917a)_0x17aa80[0x0](_0x2f917a['return'],![]);break;case 0x3:if('error'in _0x2f917a)_0x17aa80[0x0](_0x2f917a[_0x2b5896(0xfe)],![]);if(_0x2b5896(0x18d)in _0x2f917a)_0x17aa80[0x0](_0x2f917a[_0x2b5896(0x18d)],![]);break;default:throw _0x2b5896(0x15e)+_0x2f917a[_0x2b5896(0x174)];}},this[_0x308d75(0x140)]=function(_0x8e1860){var _0x45155e=_0x308d75,_0x42be27=this;this[_0x45155e(0x13c)][_0x45155e(0x16b)](function(_0x76c9e5,_0x5b9cec){var _0x2fa43e=_0x45155e;if(_0x76c9e5[_0x2fa43e(0x174)]===_0x8e1860){if(_0x76c9e5['timer'])clearTimeout(_0x76c9e5[_0x2fa43e(0x102)]);_0x42be27[_0x2fa43e(0x13c)][_0x2fa43e(0x126)](_0x5b9cec);}});},this[_0x308d75(0xf6)]=function(_0x8bb0c9){var _0x1c8fcc=_0x308d75,_0x2417a9=new Error(_0x8bb0c9),_0x75dc2d=Array[_0x1c8fcc(0x120)](this[_0x1c8fcc(0x13c)][_0x1c8fcc(0x103)]());this[_0x1c8fcc(0x13c)][_0x1c8fcc(0x14e)]();for(var _0x318086=0x0;_0x318086<_0x75dc2d[_0x1c8fcc(0x12f)];_0x318086++){if(_0x75dc2d[_0x318086][_0x1c8fcc(0x102)])clearTimeout(_0x75dc2d[_0x318086][_0x1c8fcc(0x102)]);if(!_0x75dc2d[_0x318086][_0x1c8fcc(0x107)])this[_0x1c8fcc(0x19c)](_0x75dc2d[_0x318086][_0x1c8fcc(0x118)],_0x2417a9);}},this[_0x308d75(0x12b)]=function(_0x51523d,_0x30fb34){var _0x2640b4=_0x308d75,_0x293603=this[_0x2640b4(0x158)][_0x2640b4(0x131)](function(_0x4986f8){var _0x5287f4=_0x2640b4;return _0x4986f8[_0x5287f4(0x174)];})[_0x2640b4(0x169)](_0x51523d);_0x293603<0x0?this['pythonCallbackDict']['push']({'funcName':_0x51523d,'callback':_0x30fb34}):this[_0x2640b4(0x158)][_0x293603][_0x2640b4(0x15b)]=_0x30fb34;},this['getSessionId']=function(){var _0x268bc5=_0x308d75;if(this[_0x268bc5(0x1a7)]!==null)return this['_sessionId'];if(typeof sessionStorage!==_0x268bc5(0x138))return sessionStorage[_0x268bc5(0xf3)]('JS2PY_SESSION_ID');return null;},this[_0x308d75(0x11c)]=function(_0x36d01a){var _0x35d2db=_0x308d75;this[_0x35d2db(0x1a7)]=_0x36d01a;if(typeof sessionStorage!==_0x35d2db(0x138))try{sessionStorage[_0x35d2db(0x1a3)](_0x35d2db(0x12e),_0x36d01a);}catch(_0x3b8d93){}},this[_0x308d75(0x11a)]=function(){var _0x2a2c15=_0x308d75;return'c'+ ++this[_0x2a2c15(0x142)]+'-'+Math[_0x2a2c15(0x147)]()[_0x2a2c15(0x116)](0x24)['slice'](0x2,0xa);},this[_0x308d75(0x11d)]=function(_0x3053cc,_0x2bd33d,_0x7fa6f3){var _0x249902=_0x308d75;this[_0x249902(0x17b)]['send'](JSON[_0x249902(0x16c)]({'funcName':_0x3053cc,'args':_0x2bd33d||{},'session_id':this[_0x249902(0x124)](),'callId':_0x7fa6f3}));},this[_0x308d75(0xf0)]=function(_0xac082d,_0x519469,_0x5ef441,_0xd9b2e8,_0x1fed58,_0x3d3c33){var _0x6b81ba=_0x308d75,_0x1278a5={'funcName':_0xac082d,'resolve':_0x5ef441,'reject':_0xd9b2e8,'timer':null,'stream':_0x3d3c33||null,'rows':_0x3d3c33?undefined:undefined},_0x3ac41c=_0x1fed58===undefined?this[_0x6b81ba(0x157)]:_0x1fed58;if(_0x3ac41c>0x0){var _0x50b3de=this;_0x1278a5['timer']=setTimeout(function(){var _0x26c853=_0x6b81ba;_0x50b3de['_pendingCalls']['delete'](_0x519469),_0xd9b2e8(new Error(_0x26c853(0x154)+_0x3ac41c+'ms:\x20'+_0xac082d));},_0x3ac41c);}return this[_0x6b81ba(0x13d)][_0x6b81ba(0x14c)](_0x519469,_0x1278a5),_0x1278a5;},this[_0x308d75(0x13e)]=function(_0x348a40,_0x25d242,_0x8f06d){_0x8f06d=_0x8f06d||{};var _0x5f2511=this;return new Promise(function(_0x45dc3a,_0x4d18a8){var _0x469d9e=a0_0x14e3;if(!_0x5f2511[_0x469d9e(0xef)]){_0x4d18a8(new Error('Connection\x20not\x20open.'));return;}var _0x41a0cd=_0x5f2511[_0x469d9e(0x11a)]();_0x5f2511['_registerPending'](_0x348a40,_0x41a0cd,_0x45dc3a,_0x4d18a8,_0x8f06d[_0x469d9e(0xf4)],null),_0x5f2511[_0x469d9e(0x11d)](_0x348a40,_0x25d242,_0x41a0cd);});},this[_0x308d75(0xe9)]=function(_0x3bd973,_0x677125,_0x1efb75,_0x5aa6e3){var _0x28f8ff=_0x308d75;_0x1efb75=_0x1efb75||{},_0x5aa6e3=_0x5aa6e3||{};var _0x4a8d6e=this,_0x49c52d=null,_0x31bcc7=new Promise(function(_0x4021de,_0x2d9534){var _0x4372a5=a0_0x14e3;if(!_0x4a8d6e[_0x4372a5(0xef)]){_0x2d9534(new Error('Connection\x20not\x20open.'));return;}_0x49c52d=_0x4a8d6e[_0x4372a5(0x11a)]();var _0x751a45=_0x4a8d6e[_0x4372a5(0xf0)](_0x3bd973,_0x49c52d,_0x4021de,_0x2d9534,_0x5aa6e3[_0x4372a5(0xf4)],_0x1efb75);_0x751a45[_0x4372a5(0x109)]=[],_0x4a8d6e[_0x4372a5(0x11d)](_0x3bd973,_0x677125,_0x49c52d);});return _0x31bcc7['callId']=_0x49c52d,_0x31bcc7[_0x28f8ff(0x1a1)]=function(){var _0xbb82de=_0x28f8ff;if(_0x49c52d)_0x4a8d6e[_0xbb82de(0x130)](_0x49c52d);},_0x31bcc7;},this[_0x308d75(0x130)]=function(_0x34b55d){var _0x2e66d0=_0x308d75;if(!this[_0x2e66d0(0xef)]||!_0x34b55d)return;this[_0x2e66d0(0x17b)][_0x2e66d0(0x191)](JSON[_0x2e66d0(0x16c)]({'stream_cancel':!![],'callId':_0x34b55d}));},this[_0x308d75(0x146)]=function(_0x350d8f,_0x515a57,_0x261248,_0xa30f75){_0xa30f75=_0xa30f75||{};var _0x9631d6=this;return new Promise(function(_0x2f2cac,_0x4476c3){var _0x113ed8=a0_0x14e3;if(!_0x9631d6[_0x113ed8(0xef)]){_0x4476c3(new Error('Connection\x20not\x20open.'));return;}var _0x44d9f1=_0x9631d6[_0x113ed8(0x11a)]();_0x515a57=_0x515a57||{},_0x515a57['isBinary']=!![],_0x9631d6[_0x113ed8(0xf0)](_0x350d8f,_0x44d9f1,_0x2f2cac,_0x4476c3,_0xa30f75['timeout'],null),_0x9631d6[_0x113ed8(0x11d)](_0x350d8f,_0x515a57,_0x44d9f1),_0x9631d6[_0x113ed8(0x195)](_0x261248,_0x4476c3);});},this['_sendRawBinary']=function(_0x20fb57,_0x1902e0){var _0x5aa051=_0x308d75,_0x530882=this;if(typeof Blob!==_0x5aa051(0x138)&&_0x20fb57 instanceof Blob){var _0x4dd96a=new FileReader();_0x4dd96a[_0x5aa051(0xfc)]=function(_0x4e13f2){var _0x427dbd=_0x5aa051;if(_0x530882['socket']&&_0x530882[_0x427dbd(0x17b)][_0x427dbd(0x17f)]==0x1)_0x530882[_0x427dbd(0x17b)][_0x427dbd(0x191)](_0x4e13f2[_0x427dbd(0x17e)]['result']);},_0x4dd96a[_0x5aa051(0x180)]=function(_0x9c3f7a){if(_0x1902e0)_0x1902e0(new Error('FileReader\x20failed'));},_0x4dd96a[_0x5aa051(0x141)](_0x20fb57);}else _0x530882[_0x5aa051(0x17b)][_0x5aa051(0x191)](_0x20fb57);},this[_0x308d75(0x10a)]=function(_0x542758,_0x847ee0){var _0x394e4c=_0x308d75,_0x2e67fc=this['_pendingCalls']['get'](_0x542758);if(!_0x2e67fc)return![];var _0x1a2b3c=_0x394e4c(0xf2)in _0x847ee0;if(_0x1a2b3c){var _0x58c387=_0x847ee0[_0x394e4c(0xf2)];try{if(_0x58c387===_0x394e4c(0x182)){if(_0x2e67fc[_0x394e4c(0x109)]===undefined)_0x2e67fc[_0x394e4c(0x109)]=[];if(_0x2e67fc['stream']&&_0x2e67fc[_0x394e4c(0x143)]['onStart'])_0x2e67fc[_0x394e4c(0x143)][_0x394e4c(0x186)](_0x847ee0[_0x394e4c(0x18d)],_0x847ee0[_0x394e4c(0xeb)]);}else{if(_0x58c387===_0x394e4c(0x122)){if(_0x2e67fc[_0x394e4c(0x109)]!==undefined)_0x2e67fc[_0x394e4c(0x109)]['push'](_0x847ee0['stream_item']);if(_0x2e67fc[_0x394e4c(0x143)]&&_0x2e67fc['stream'][_0x394e4c(0x151)])_0x2e67fc[_0x394e4c(0x143)][_0x394e4c(0x151)](_0x847ee0[_0x394e4c(0x162)],_0x847ee0[_0x394e4c(0x150)],_0x847ee0[_0x394e4c(0x1a6)]);}else{if(_0x58c387==='end'){if(_0x2e67fc['stream']&&_0x2e67fc[_0x394e4c(0x143)][_0x394e4c(0x1a8)])_0x2e67fc[_0x394e4c(0x143)][_0x394e4c(0x1a8)](_0x847ee0[_0x394e4c(0x184)],_0x847ee0[_0x394e4c(0xf5)]===!![]);if(_0x2e67fc[_0x394e4c(0x102)])clearTimeout(_0x2e67fc[_0x394e4c(0x102)]);this[_0x394e4c(0x13d)]['delete'](_0x542758),_0x2e67fc[_0x394e4c(0x19f)](_0x2e67fc[_0x394e4c(0x109)]===undefined?[]:_0x2e67fc[_0x394e4c(0x109)]);}}}}catch(_0x31e6ed){this[_0x394e4c(0x16f)](_0x31e6ed);}return!![];}if(_0x2e67fc['timer'])clearTimeout(_0x2e67fc[_0x394e4c(0x102)]);this[_0x394e4c(0x13d)][_0x394e4c(0x126)](_0x542758);if(_0x394e4c(0xfe)in _0x847ee0){var _0x161c0a=new Error(_0x847ee0[_0x394e4c(0xfe)]);_0x161c0a[_0x394e4c(0x176)]=_0x847ee0[_0x394e4c(0x176)],_0x161c0a[_0x394e4c(0x174)]=_0x847ee0[_0x394e4c(0x174)];if(_0x2e67fc['stream']&&_0x2e67fc[_0x394e4c(0x143)][_0x394e4c(0xed)])try{_0x2e67fc['stream'][_0x394e4c(0xed)](_0x161c0a);}catch(_0x398f59){this[_0x394e4c(0x16f)](_0x398f59);}_0x2e67fc[_0x394e4c(0x117)](_0x161c0a);}else _0x2e67fc[_0x394e4c(0x19f)](_0x847ee0[_0x394e4c(0x18d)]);return!![];},this[_0x308d75(0x11f)]=function(_0x2f2218){var _0x4fafcb=_0x308d75,_0x4d93c6=new Error(_0x2f2218);this[_0x4fafcb(0x13d)][_0x4fafcb(0x16b)](function(_0x57e810){var _0x421196=_0x4fafcb;if(_0x57e810[_0x421196(0x102)])clearTimeout(_0x57e810[_0x421196(0x102)]);try{_0x57e810[_0x421196(0x117)](_0x4d93c6);}catch(_0x4160d6){}}),this[_0x4fafcb(0x13d)]['clear']();},this[_0x308d75(0x16f)]=function(_0x32ba4d){var _0x470169=_0x308d75;if(this[_0x470169(0x180)]!==undefined)try{this[_0x470169(0x180)](_0x32ba4d);return;}catch(_0x420d6e){}console['error'](_0x470169(0x119),_0x32ba4d);},this['close']=function(){var _0x400bc3=_0x308d75;this[_0x400bc3(0x101)]=!![];this[_0x400bc3(0x16e)]&&(clearTimeout(this[_0x400bc3(0x16e)]),this[_0x400bc3(0x16e)]=null);if(this[_0x400bc3(0x17b)])this[_0x400bc3(0x17b)]['close']();},this[_0x308d75(0x161)]=function(_0x25c436,_0x1588d0){var _0x2e1d94=_0x308d75;this['jsFunctionDict'][_0x2e1d94(0x18e)]({'funcName':_0x25c436,'func':_0x1588d0});},this[_0x308d75(0x190)]=function(_0x24363c,_0x3c86d7,_0x5e05cf){var _0x2a1624=_0x308d75;this[_0x2a1624(0xef)]?(this[_0x2a1624(0x17b)]['send'](JSON[_0x2a1624(0x16c)]({'funcName':_0x24363c,'args':_0x3c86d7,'session_id':this[_0x2a1624(0x124)]()})),this['_debug'](_0x2a1624(0x129)+_0x24363c+'\x20called\x20with\x20arguments:\x20',_0x3c86d7)):this[_0x2a1624(0x17d)](_0x2a1624(0x121));if(_0x5e05cf===undefined){}else this['registerCallbackToPythonFunction'](_0x24363c,_0x5e05cf);},this[_0x308d75(0x12c)]=function(_0x5c5dfb,_0x535de0,..._0x4ed733){this['callMultipleCallbackPythonFunction'](_0x5c5dfb,_0x535de0,..._0x4ed733);},this['callPythonFunctionBinary']=function(_0x16207a,_0x12bb62,_0x32dbbf,_0x1132dc){var _0x4e9036=_0x308d75;_0x12bb62===undefined&&(_0x12bb62={});_0x12bb62[_0x4e9036(0x12a)]=!![],this[_0x4e9036(0x190)](_0x16207a,_0x12bb62);if(this['isOpen']){this[_0x4e9036(0x11e)](_0x32dbbf);if(_0x1132dc===undefined){}else this[_0x4e9036(0x12b)](_0x16207a,_0x1132dc);}else this[_0x4e9036(0x17d)](_0x4e9036(0x121));},this[_0x308d75(0x11e)]=function(_0xb110aa){var _0x45a213=_0x308d75,_0x533c88=this,_0x56e92d=new FileReader();_0x56e92d['onload']=function(_0x33fe2c){var _0x84405a=a0_0x14e3,_0xda0158=_0x33fe2c['target'][_0x84405a(0x178)];if(_0x533c88[_0x84405a(0x17b)]&&_0x533c88[_0x84405a(0x17b)][_0x84405a(0x17f)]==0x1)_0x533c88[_0x84405a(0x17b)]['send'](_0xda0158);},_0x56e92d[_0x45a213(0x141)](_0xb110aa);},this[_0x308d75(0x177)]=function(_0x53aae6){var _0x399612=_0x308d75;if(_0x53aae6[_0x399612(0xe6)][_0x399612(0x136)](/image.*/)){this[_0x399612(0x17d)]('The\x20dropped\x20file\x20is\x20an\x20image:\x20',_0x53aae6['type']);return;}var _0x293282=this,_0x2124a4=new FileReader();_0x2124a4[_0x399612(0xfc)]=function(_0x4075f7){var _0x44d3ce=_0x399612,_0xe325ef=_0x4075f7['target']['result'];if(_0x293282[_0x44d3ce(0x17b)]&&_0x293282[_0x44d3ce(0x17b)]['readyState']==0x1)_0x293282[_0x44d3ce(0x17b)]['send'](_0xe325ef);},_0x2124a4[_0x399612(0x141)](_0x53aae6);},this[_0x308d75(0x123)]=function(_0x10d843){var _0x223684=_0x308d75;if(!_0x10d843[_0x223684(0xe6)][_0x223684(0x136)](/image.*/)){this['_log']('The\x20dropped\x20file\x20is\x20not\x20an\x20image:\x20',_0x10d843['type']);return;}var _0x5e2715=this,_0x12361d=new FileReader();_0x12361d[_0x223684(0xfc)]=function(_0x1fe0e5){var _0x437ef4=_0x223684,_0xc41485=_0x1fe0e5[_0x437ef4(0x17e)]['result'];if(_0x5e2715[_0x437ef4(0x17b)]&&_0x5e2715[_0x437ef4(0x17b)]['readyState']==0x1)_0x5e2715[_0x437ef4(0x17b)][_0x437ef4(0x191)](_0xc41485);},_0x12361d[_0x223684(0x141)](_0x10d843);},this[_0x308d75(0x193)]=function(_0x45e725){var _0x229099=_0x308d75;for(var _0x251596 in this['PythonFunctionsArgs']){var _0x3e5c9b=this['PythonFunctionsArgs'][_0x251596];_0x3e5c9b[_0x229099(0x18e)]('...func');var _0x565835=_0x229099(0x188)+_0x251596+'\x27].slice(0,\x20-1);\x0a'+_0x229099(0x106)+_0x251596+_0x229099(0x14f);_0x3e5c9b[_0x229099(0x18e)](_0x565835),_0x54f2f2=this;if(_0x251596[_0x229099(0x169)]('.')>=0x0){var _0x4b00f7=_0x251596[_0x229099(0x111)]('.'),_0x18beaf=this[_0x229099(0x137)];for(var _0x41d4c2=0x0;_0x41d4c2<_0x4b00f7['length']-0x1;_0x41d4c2++){!(_0x4b00f7[_0x41d4c2]in _0x18beaf)&&(_0x18beaf[_0x4b00f7[_0x41d4c2]]={}),_0x18beaf=_0x18beaf[_0x4b00f7[_0x41d4c2]];}_0x18beaf[_0x4b00f7[_0x4b00f7['length']-0x1]]=Function[_0x229099(0x15c)](null,_0x3e5c9b)[_0x229099(0xf8)](this);}else this[_0x229099(0x137)][_0x251596]=Function[_0x229099(0x15c)](null,_0x3e5c9b)['bind'](this);}},this[_0x308d75(0x192)]=function(){var _0x3b73e4=_0x308d75;this[_0x3b73e4(0x18b)]!==undefined&&this[_0x3b73e4(0x18b)]();var _0x56fbef=this[_0x3b73e4(0x17c)](),_0x179900=this[_0x3b73e4(0x134)];if(_0x179900===undefined)throw new Error(_0x3b73e4(0x114)+'new\x20RemotePyClient(server,\x20page,\x20{\x20WebSocket:\x20require(\x27ws\x27)\x20}).');this[_0x3b73e4(0x101)]=![],this[_0x3b73e4(0x17d)](_0x3b73e4(0x10d)+_0x56fbef+_0x3b73e4(0xfa)),this[_0x3b73e4(0x17b)]=new _0x179900(_0x56fbef),this[_0x3b73e4(0x17b)]['binaryType']=_0x3b73e4(0x17a),_0x54f2f2=this,this[_0x3b73e4(0x17b)][_0x3b73e4(0x10b)]=function(){var _0x360c2d=_0x3b73e4;_0x54f2f2[_0x360c2d(0x17d)]('Connected\x20to\x20Server\x20:'+_0x56fbef),_0x54f2f2[_0x360c2d(0x179)][_0x360c2d(0x16b)](_0x32bc3f=>_0x32bc3f()),_0x54f2f2['isOpen']=!![];var _0x3f74fe=_0x54f2f2[_0x360c2d(0xf7)]>0x0;_0x54f2f2[_0x360c2d(0xf7)]=0x0;if(_0x3f74fe&&_0x54f2f2['options'][_0x360c2d(0x163)]&&_0x54f2f2[_0x360c2d(0x124)]()){var _0x19153f=_0x54f2f2[_0x360c2d(0xee)]['sessionResumeFunc']||'SessionServer.startSessionIfNotStarted';_0x54f2f2[_0x360c2d(0x13e)](_0x19153f,{'sessionid':_0x54f2f2[_0x360c2d(0x124)]()})[_0x360c2d(0x187)](function(_0x535073){_0x54f2f2['_emitError'](_0x535073);});}_0x54f2f2[_0x360c2d(0x10b)]!==undefined&&(_0x54f2f2['_callLegacy'](_0x360c2d(0x19a),{},[function(_0x2e418b){var _0x292cf7=_0x360c2d;_0x54f2f2[_0x292cf7(0x18f)]={};for(var _0x24ffd6 in _0x2e418b){_0x2e418b[_0x24ffd6][_0x292cf7(0x18c)](),_0x2e418b[_0x24ffd6][0x0]=='session_id'&&_0x2e418b[_0x24ffd6]['shift'](),_0x54f2f2[_0x292cf7(0x18f)][_0x24ffd6]=_0x2e418b[_0x24ffd6];}_0x54f2f2[_0x292cf7(0x193)](''),_0x54f2f2[_0x292cf7(0x10b)]();}],!![]),_0x54f2f2[_0x360c2d(0x172)]('getPythonFunctionLibraryHelp',{},[function(_0x263581){var _0x349b0f=_0x360c2d;_0x54f2f2[_0x349b0f(0xea)]=_0x263581;}],!![])),_0x54f2f2[_0x360c2d(0xe8)]['forEach'](_0x277a6e=>_0x277a6e());},this[_0x3b73e4(0x17b)][_0x3b73e4(0x160)]=function(_0x2fadea){var _0x1c287b=_0x3b73e4;_0x54f2f2[_0x1c287b(0xfb)][_0x1c287b(0x16b)](_0x25bcca=>_0x25bcca());_0x54f2f2[_0x1c287b(0x1a0)]!==undefined&&_0x54f2f2['onmessagereceived'](_0x2fadea);let _0x4de806=null;if(_0x2fadea[_0x1c287b(0x13f)]instanceof ArrayBuffer)try{const _0x4f822c=a0_0x452d58['decode'](new Uint8Array(_0x2fadea[_0x1c287b(0x13f)]));_0x4de806=_0x4f822c;}catch(_0x161670){_0x4de806=null;}else typeof _0x2fadea[_0x1c287b(0x13f)]=='string'&&(_0x4de806=JSON[_0x1c287b(0x155)](_0x2fadea[_0x1c287b(0x13f)]));if(_0x4de806!==null){_0x54f2f2[_0x1c287b(0x197)](_0x1c287b(0x127),_0x4de806);var _0x225c12=_0x4de806[_0x1c287b(0x194)];if(_0x225c12!==undefined&&_0x225c12!==null&&!(_0x1c287b(0x18a)in _0x4de806)){var _0x17f0f8=![];if(_0x54f2f2[_0x1c287b(0x13d)][_0x1c287b(0x110)](_0x225c12))_0x54f2f2['_settlePending'](_0x225c12,_0x4de806),_0x17f0f8=!![];else{if(_0x54f2f2[_0x1c287b(0x13c)][_0x1c287b(0x110)](_0x225c12)){var _0x2fc4b5=_0x54f2f2['_pendingLegacy'][_0x1c287b(0x173)](_0x225c12);if(_0x54f2f2[_0x1c287b(0x10c)](_0x4de806)){if(_0x2fc4b5[_0x1c287b(0x102)])clearTimeout(_0x2fc4b5[_0x1c287b(0x102)]);_0x54f2f2[_0x1c287b(0x13c)][_0x1c287b(0x126)](_0x225c12);}try{_0x54f2f2[_0x1c287b(0x171)](_0x2fc4b5['callbacks'],_0x4de806);}catch(_0x2aaa6e){_0x54f2f2[_0x1c287b(0x16f)](_0x2aaa6e);}_0x17f0f8=!![];}else _0x54f2f2[_0x1c287b(0x197)](_0x1c287b(0x13a)+_0x225c12+'\x20('+_0x4de806[_0x1c287b(0x174)]+')'),_0x17f0f8=!![];}if(_0x17f0f8){_0x54f2f2[_0x1c287b(0xfd)]!==undefined&&_0x54f2f2[_0x1c287b(0xfd)]();_0x54f2f2[_0x1c287b(0x128)][_0x1c287b(0x16b)](_0x5b8f2e=>_0x5b8f2e());return;}}try{if(_0x1c287b(0x18a)in _0x4de806){var _0x1c7baa=_0x54f2f2['jsFunctionDict'][_0x1c287b(0x131)](function(_0x5c0554){var _0xd4862b=_0x1c287b;return _0x5c0554[_0xd4862b(0x174)];})[_0x1c287b(0x169)](_0x4de806['funcName']);if(_0x1c7baa>=0x0){var _0x11404c=_0x54f2f2[_0x1c287b(0xe5)][_0x1c7baa];_0x1c287b(0x12a)in _0x4de806[_0x1c287b(0x18a)]?_0x54f2f2[_0x1c287b(0x175)][_0x1c287b(0x18e)]({'funcName':_0x4de806[_0x1c287b(0x174)],'callback':_0x11404c[_0x1c287b(0x105)],'args':_0x4de806['args']}):_0x11404c[_0x1c287b(0x105)](_0x4de806[_0x1c287b(0x18a)]);}else{if(_0x4de806['funcName']==='getPythonFunctionLibrary')return;else throw _0x1c287b(0xf1)+_0x4de806[_0x1c287b(0x174)];}}else{if('streaming'in _0x4de806){if(_0x4de806['funcName']in _0x54f2f2[_0x1c287b(0x11b)]){var _0x3bfbf7=_0x54f2f2[_0x1c287b(0x11b)][_0x4de806[_0x1c287b(0x174)]];if(_0x54f2f2[_0x1c287b(0x10c)](_0x4de806))_0x54f2f2[_0x1c287b(0x140)](_0x4de806['funcName']);_0x54f2f2[_0x1c287b(0x171)](_0x3bfbf7,_0x4de806);}else throw _0x1c287b(0x153)+_0x4de806['funcName'];}else{if(_0x4de806[_0x1c287b(0x174)]in _0x54f2f2[_0x1c287b(0x11b)]){var _0x3bfbf7=_0x54f2f2[_0x1c287b(0x11b)][_0x4de806[_0x1c287b(0x174)]];_0x54f2f2['_forgetLegacyByName'](_0x4de806[_0x1c287b(0x174)]),_0x54f2f2['_dispatchLegacyReply'](_0x3bfbf7,_0x4de806);}else{var _0x1c7baa=_0x54f2f2[_0x1c287b(0x158)][_0x1c287b(0x131)](function(_0x247ff5){var _0x251fae=_0x1c287b;return _0x247ff5[_0x251fae(0x174)];})[_0x1c287b(0x169)](_0x4de806[_0x1c287b(0x174)]);if(_0x1c7baa>=0x0){var _0x11404c=_0x54f2f2[_0x1c287b(0x158)][_0x1c7baa];_0x4de806['return']===undefined?_0x4de806[_0x1c287b(0xfe)]!==undefined&&_0x11404c[_0x1c287b(0x15b)](_0x4de806[_0x1c287b(0xfe)],![]):_0x11404c[_0x1c287b(0x15b)](_0x4de806[_0x1c287b(0x18d)],!![]);}else throw'No\x20function\x20defined\x20for\x20'+_0x4de806[_0x1c287b(0x174)];}}}}catch(_0x570531){_0x54f2f2[_0x1c287b(0x16f)](_0x570531);}}else{_0x54f2f2[_0x1c287b(0x17d)]('No\x20msgpack\x20library\x20loaded');var _0x5c5264=new Uint8Array(_0x2fadea['data']),_0x3d30f8='\x20';for(var _0x7733e4=0x0;_0x7733e4<_0x5c5264['length'];_0x7733e4++){_0x3d30f8+=(_0x1c287b(0x164)+_0x5c5264[_0x7733e4][_0x1c287b(0x116)](0x10))['substr'](-0x2);}var _0x29d265=_0x2fadea[_0x1c287b(0x13f)],_0x14a208=new Uint8Array(_0x29d265),_0x2e474f=new Blob([_0x14a208['buffer']]);if(_0x54f2f2[_0x1c287b(0x175)][_0x1c287b(0x12f)]>0x0){var _0x224d51=_0x54f2f2[_0x1c287b(0x175)][_0x1c287b(0x18c)]();_0x224d51[_0x1c287b(0x18a)][_0x1c287b(0xec)]=_0x2e474f,_0x224d51[_0x1c287b(0x15b)](_0x224d51[_0x1c287b(0x18a)]);}else{if(typeof document!==_0x1c287b(0x138)){var _0x17b54b=new FileReader();_0x17b54b[_0x1c287b(0xfc)]=function(_0x59f992){var _0x28f480=_0x1c287b,_0x1c937c=document['createElement']('img');_0x1c937c[_0x28f480(0x108)]=_0x59f992[_0x28f480(0x17e)][_0x28f480(0x178)],document[_0x28f480(0x139)][_0x28f480(0x19b)](_0x1c937c);},_0x17b54b[_0x1c287b(0x168)](_0x2e474f);var _0xbc2167=document[_0x1c287b(0x10e)](_0x1c287b(0x15f));if(_0xbc2167)_0xbc2167[_0x1c287b(0x10f)]=_0x1c287b(0x189);}}_0x54f2f2[_0x1c287b(0x197)](_0x1c287b(0x113),_0x3d30f8);}_0x54f2f2['onmessageprocessed']!==undefined&&_0x54f2f2['onmessageprocessed'](),_0x54f2f2[_0x1c287b(0x128)][_0x1c287b(0x16b)](_0x32bf5d=>_0x32bf5d());},this[_0x3b73e4(0x17b)]['onclose']=function(_0x2eacbf){var _0x2dbb5d=_0x3b73e4;_0x54f2f2[_0x2dbb5d(0x17d)](_0x2dbb5d(0x149)+_0x56fbef+_0x2dbb5d(0x1a9)),_0x54f2f2[_0x2dbb5d(0x185)][_0x2dbb5d(0x16b)](_0x1a9218=>_0x1a9218(_0x2eacbf)),_0x54f2f2[_0x2dbb5d(0xef)]=![],_0x54f2f2[_0x2dbb5d(0x17b)]=null,_0x54f2f2['_rejectAllPending']('Connection\x20closed'),_0x54f2f2[_0x2dbb5d(0xf6)](_0x2dbb5d(0x12d));_0x54f2f2[_0x2dbb5d(0x181)]!==undefined&&_0x54f2f2[_0x2dbb5d(0x181)](_0x2eacbf);_0x54f2f2[_0x2dbb5d(0x104)]['forEach'](_0x389cdb=>_0x389cdb(_0x2eacbf));if(_0x54f2f2[_0x2dbb5d(0x14b)]&&!_0x54f2f2[_0x2dbb5d(0x101)]&&_0x54f2f2[_0x2dbb5d(0xf7)]<_0x54f2f2[_0x2dbb5d(0x19d)]){var _0x1da688=Math[_0x2dbb5d(0xf9)](_0x54f2f2[_0x2dbb5d(0x183)]*Math[_0x2dbb5d(0x100)](0x2,_0x54f2f2['_reconnectAttempts']),_0x54f2f2[_0x2dbb5d(0x156)]);_0x54f2f2[_0x2dbb5d(0xf7)]+=0x1,_0x54f2f2[_0x2dbb5d(0x17d)](_0x2dbb5d(0x145)+_0x1da688+'ms\x20(attempt\x20'+_0x54f2f2[_0x2dbb5d(0xf7)]+')'),_0x54f2f2['_reconnectTimer']=setTimeout(function(){var _0x4959a3=_0x2dbb5d;_0x54f2f2[_0x4959a3(0x16e)]=null,_0x54f2f2[_0x4959a3(0x192)]();},_0x1da688);}};},this[_0x308d75(0x165)]=function(){var _0x33b257=_0x308d75;return this[_0x33b257(0x137)];},this[_0x308d75(0x14a)]=function(_0x1a961a){var _0x33e983=_0x308d75;return this[_0x33e983(0x137)][_0x1a961a];};}export{RemotePyClient};function a0_0x531a(){var _0x509b37=['10649tKDDIZ','resolve','onmessagereceived','cancel','readCallbackArguments','setItem','WebSocket','288248PbAeYp','stream_total','_sessionId','onEnd','\x20closed.','jsFunctionDict','type','function','PostOpenEventHandlers','callStream','PythonFunctionsHelp','stream_id','blob','onError','options','isOpen','_registerPending','No\x20function\x20defined\x20for\x20','streaming','getItem','timeout','stream_cancelled','_failAllLegacyPending','_reconnectAttempts','bind','min','\x20...','PreMessageEventHandlers','onload','onmessageprocessed','error','ms:\x20','pow','_closedByUser','timer','values','PostCloseEventHandlers','func','var\x20args\x20=\x20Array.prototype.slice.call(arguments);\x20var\x20inputObject\x20=\x20{};\x20for(var\x20i\x20in\x20paramNames)\x20{\x20var\x20paramName\x20=\x20paramNames[i];\x20if(paramName\x20!=\x20\x27...func\x27)\x20{\x20inputObject[paramName]\x20=\x20args[i];}\x20}\x20return\x20this.callMultipleCallbackPythonFunction(\x27','internal','src','rows','_settlePending','onopen','_legacyReplyEnds','Connecting\x20to\x20:\x20','getElementById','innerHTML','has','split','175tRJBoO','message(b)\x20received\x20:\x20','No\x20WebSocket\x20implementation\x20available.\x20In\x20Node,\x20pass\x20one\x20via\x20','1462772EfLLht','toString','reject','callbacks','RemotePyClient\x20error:','_makeCallId','pythonMultipleCallbackDict','setSessionId','_sendCall','sendBinary','_rejectAllPending','from','Connection\x20not\x20open.','row','sendImageBinary','getSessionId','log','delete','Message\x20received:\x20','PostMessageEventHandlers','Function\x20:\x20','isBinary','registerCallbackToPythonFunction','callPythonFunction','Connection\x20closed','JS2PY_SESSION_ID','length','cancelStream','map','slice','addPostCloseEventHandler','_WebSocketImpl','3TbFJNO','match','PythonFunctions','undefined','body','Dropping\x20reply\x20for\x20unknown\x20callId\x20','\x20called\x20with\x20arguments:\x20','_pendingLegacy','_pendingCalls','call','data','_forgetLegacyByName','readAsArrayBuffer','_callSeq','stream','addPreOpenEventHandler','Reconnecting\x20in\x20','callBinary','random','wss','Connection\x20to\x20','getService','_autoReconnect','set','13918077wOVXEg','clear','\x27,\x20inputObject,\x20...func);','stream_item','onRow','_failLegacyLater','No\x20function\x20callback\x20defined\x20for\x20','RPC\x20timeout\x20after\x20','parse','_reconnectMaxDelayMs','_defaultTimeout','pythonCallbackDict','autoReconnect','serverName','callback','apply','reconnectMaxDelayMs','Too\x20many\x20callbacks\x20for\x20','StatusBar','onmessage','registerJSFunctionToBeCalledByPython','stream_index','sessionResume','00\x20','getServerAPI','_legacyErrorCallbackIndex','3611082YSIKWK','readAsDataURL','indexOf','3313415pSFjIs','forEach','stringify','debug','_reconnectTimer','_emitError','1438988QWZfGI','_dispatchLegacyReply','_callLegacy','get','funcName','binaryFunctionQueue','traceback','sendNonImageBinary','result','PreOpenEventHandlers','arraybuffer','socket','getServerString','_log','target','readyState','onerror','onclose','start','_reconnectDelayMs','stream_empty','PreCloseEventHandlers','onStart','catch','var\x20paramNames\x20=\x20this.PythonFunctionsArgs[\x27','Chart\x20Loading\x20Completed\x20...','args','oninit','shift','return','push','PythonFunctionsArgs','callFunc','send','connect','createJSProxyFunctions','callId','_sendRawBinary','end','_debug','clientPageId','10xKwlHN','getPythonFunctionLibrary','appendChild','_invokeLegacyError','_reconnectMaxAttempts'];a0_0x531a=function(){return _0x509b37;};return a0_0x531a();}
|
package/package.json
CHANGED
|
@@ -1,69 +1,81 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "remotepy",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "JavaScript library to connect to RemotePy server. Allows you to call python functions on server from JavaScript.",
|
|
5
|
-
"main": "dist/RemotePyClient.js",
|
|
6
|
-
"module": "dist/RemotePyClient.js",
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
"build": "
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
"remote",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "remotepy",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "JavaScript library to connect to RemotePy server. Allows you to call python functions on server from JavaScript.",
|
|
5
|
+
"main": "dist/RemotePyClient.js",
|
|
6
|
+
"module": "dist/RemotePyClient.js",
|
|
7
|
+
"types": "dist/RemotePyClient.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"dev-build": "mkdirp dist && cp-cli src/RemotePyClient.js dist/RemotePyClient.dev.js",
|
|
10
|
+
"prod-build": "mkdirp dist && npx uglify-js src/RemotePyClient.js --compress --mangle --output dist/RemotePyClient.min.js && npx javascript-obfuscator dist/RemotePyClient.min.js --output dist/RemotePyClient.obfuscated.js && cp-cli dist/RemotePyClient.obfuscated.js dist/RemotePyClient.common.js && echo export default RemotePyClient; >> dist/RemotePyClient.common.js && npx rename-cli dist/RemotePyClient.common.js dist/RemotePyClient.esm.js",
|
|
11
|
+
"build": "npm run dev-build && npm run process && npm run types-copy",
|
|
12
|
+
"types-copy": "cp-cli src/RemotePyClient.d.ts dist/RemotePyClient.d.ts",
|
|
13
|
+
"test:live": "node test/live_test.mjs",
|
|
14
|
+
"test:live:obfuscated": "cp-cli dist/RemotePyClient.esm.js test/RemotePyClient_obfuscated.mjs && node test/live_test_obfuscated.mjs",
|
|
15
|
+
"process": "mkdirp dist && npm run minify && npm run obfuscate",
|
|
16
|
+
"minify": "terser src/RemotePyClient.js -o dist/RemotePyClient.min.js",
|
|
17
|
+
"obfuscate": "javascript-obfuscator dist/RemotePyClient.min.js --output dist/RemotePyClient.obfuscated.js && cp-cli dist/RemotePyClient.obfuscated.js dist/RemotePyClient.esm.js",
|
|
18
|
+
"update-file": "echo export default RemotePyClient; >> RemotePyClient.common.js",
|
|
19
|
+
"rename-file": "rename RemotePyClient.common.js RemotePyClient.esm.js || mv RemotePyClient.common.js RemotePyClient.esm.js",
|
|
20
|
+
"pretest": "cp-cli src/RemotePyClient.js test/RemotePyClient_under_test.mjs",
|
|
21
|
+
"test": "cross-env NODE_ENV=test mocha --timeout 10000 test/RemotePyClient.test.mjs",
|
|
22
|
+
"publish_to_npm": "npm run build && cp-cli dist/RemotePyClient.esm.js dist/RemotePyClient.js && npm publish"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/alpharithmic/remotepy_jsclient.git"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"remotepy",
|
|
30
|
+
"remote",
|
|
31
|
+
"websocket",
|
|
32
|
+
"python",
|
|
33
|
+
"javascript",
|
|
34
|
+
"rpc",
|
|
35
|
+
"remote",
|
|
36
|
+
"procedure",
|
|
37
|
+
"call"
|
|
38
|
+
],
|
|
39
|
+
"author": "Neelofar Farukh Tamboli",
|
|
40
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/alpharithmic/remotepy_jsclient/issues"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/alpharithmic/remotepy_jsclient#readme",
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@babel/core": "^7.25.2",
|
|
47
|
+
"@babel/preset-env": "^7.25.3",
|
|
48
|
+
"assert": "^2.0.0",
|
|
49
|
+
"babel-loader": "^9.1.3",
|
|
50
|
+
"cp-cli": "^1.0.2",
|
|
51
|
+
"cpy-cli": "^5.0.0",
|
|
52
|
+
"cross-env": "^7.0.3",
|
|
53
|
+
"javascript-obfuscator": "^4.1.1",
|
|
54
|
+
"mkdirp": "^3.0.1",
|
|
55
|
+
"mocha": "^10.0.0",
|
|
56
|
+
"rename-cli": "^7.0.2",
|
|
57
|
+
"terser": "^5.19.2",
|
|
58
|
+
"uglify-js": "^3.19.1",
|
|
59
|
+
"webpack": "^5.93.0",
|
|
60
|
+
"webpack-cli": "^5.1.4",
|
|
61
|
+
"ws": "^8.13.0"
|
|
62
|
+
},
|
|
63
|
+
"files": [
|
|
64
|
+
"dist/RemotePyClient.js",
|
|
65
|
+
"dist/RemotePyClient.d.ts"
|
|
66
|
+
],
|
|
67
|
+
"dependencies": {
|
|
68
|
+
"msgpack-lite": "^0.1.26"
|
|
69
|
+
},
|
|
70
|
+
"peerDependencies": {
|
|
71
|
+
"ws": ">=8"
|
|
72
|
+
},
|
|
73
|
+
"peerDependenciesMeta": {
|
|
74
|
+
"ws": {
|
|
75
|
+
"optional": true
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"directories": {
|
|
79
|
+
"test": "test"
|
|
80
|
+
}
|
|
81
|
+
}
|