html5rw-jsoo 1.0.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/LICENSE +21 -0
- package/README.md +101 -0
- package/htmlrw-tests.js +411 -0
- package/htmlrw-tests.wasm.js +134 -0
- package/htmlrw-worker.js +7960 -0
- package/htmlrw-worker.wasm.js +136 -0
- package/htmlrw.js +8229 -0
- package/htmlrw.wasm.js +136 -0
- package/htmlrw_js_main.bc.wasm.assets/code-e7e41522f404e3a879d6.wasm +0 -0
- package/htmlrw_js_tests_main.bc.wasm.assets/code-1410fe592e1c3e438eb1.wasm +0 -0
- package/htmlrw_js_worker.bc.wasm.assets/code-c1e98c62582936e40109.wasm +0 -0
- package/package.json +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Anil Madhavapeddy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# html5rw
|
|
2
|
+
|
|
3
|
+
Pure OCaml HTML5 parser compiled to JavaScript and WebAssembly via js_of_ocaml.
|
|
4
|
+
|
|
5
|
+
**Note: This package is browser-only.** It uses DOM APIs and browser events for initialization and cannot be used in Node.js.
|
|
6
|
+
|
|
7
|
+
This is a fully compliant HTML5 parser implementing the [WHATWG HTML5 specification](https://html.spec.whatwg.org/multipage/parsing.html), passing
|
|
8
|
+
the html5lib-tests conformance suite. It is based on transpiling <https://github.com/validator/validator> into OCaml.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install html5rw-jsoo
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage (Browser Only)
|
|
17
|
+
|
|
18
|
+
### JavaScript Version
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<!DOCTYPE html>
|
|
22
|
+
<html>
|
|
23
|
+
<head>
|
|
24
|
+
<script src="node_modules/html5rw/htmlrw.js"></script>
|
|
25
|
+
</head>
|
|
26
|
+
<body>
|
|
27
|
+
<script>
|
|
28
|
+
// The library initializes on DOMContentLoaded
|
|
29
|
+
// API documentation coming soon
|
|
30
|
+
</script>
|
|
31
|
+
</body>
|
|
32
|
+
</html>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### WebAssembly Version
|
|
36
|
+
|
|
37
|
+
```html
|
|
38
|
+
<!DOCTYPE html>
|
|
39
|
+
<html>
|
|
40
|
+
<head>
|
|
41
|
+
<script src="node_modules/html5rw/htmlrw.wasm.js"></script>
|
|
42
|
+
</head>
|
|
43
|
+
<body>
|
|
44
|
+
<script>
|
|
45
|
+
// Same API as JavaScript version, but runs as WASM
|
|
46
|
+
// Automatically loads WASM modules from htmlrw_js_main.bc.wasm.assets/
|
|
47
|
+
</script>
|
|
48
|
+
</body>
|
|
49
|
+
</html>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Web Worker (Background Validation)
|
|
53
|
+
|
|
54
|
+
For non-blocking HTML validation in a separate thread:
|
|
55
|
+
|
|
56
|
+
```javascript
|
|
57
|
+
const worker = new Worker('node_modules/html5rw/htmlrw-worker.js');
|
|
58
|
+
|
|
59
|
+
worker.onmessage = (e) => {
|
|
60
|
+
console.log('Validation result:', e.data);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
worker.postMessage({ html: '<div><p>Hello' });
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
WASM version:
|
|
67
|
+
```javascript
|
|
68
|
+
const worker = new Worker('node_modules/html5rw/htmlrw-worker.wasm.js');
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Files Included
|
|
72
|
+
|
|
73
|
+
| File | Description |
|
|
74
|
+
|------|-------------|
|
|
75
|
+
| `htmlrw.js` | Main library (JavaScript) |
|
|
76
|
+
| `htmlrw.wasm.js` | Main library (WebAssembly loader) |
|
|
77
|
+
| `htmlrw-worker.js` | Web Worker (JavaScript) |
|
|
78
|
+
| `htmlrw-worker.wasm.js` | Web Worker (WebAssembly loader) |
|
|
79
|
+
| `htmlrw-tests.js` | Browser test runner (JavaScript) |
|
|
80
|
+
| `htmlrw-tests.wasm.js` | Browser test runner (WebAssembly loader) |
|
|
81
|
+
| `htmlrw_js_main.bc.wasm.assets/` | WASM modules for main library |
|
|
82
|
+
| `htmlrw_js_worker.bc.wasm.assets/` | WASM modules for web worker |
|
|
83
|
+
| `htmlrw_js_tests_main.bc.wasm.assets/` | WASM modules for test runner |
|
|
84
|
+
|
|
85
|
+
## Features
|
|
86
|
+
|
|
87
|
+
- Full HTML5 parsing per WHATWG specification
|
|
88
|
+
- Encoding detection and conversion
|
|
89
|
+
- Error recovery (like browsers)
|
|
90
|
+
- CSS selector queries
|
|
91
|
+
- DOM manipulation
|
|
92
|
+
- HTML serialization
|
|
93
|
+
|
|
94
|
+
## Source Code
|
|
95
|
+
|
|
96
|
+
The OCaml source code is available on the `main` branch:
|
|
97
|
+
https://tangled.org/anil.recoil.org/ocaml-html5rw
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
MIT
|
package/htmlrw-tests.js
ADDED
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
// Generated by js_of_ocaml
|
|
2
|
+
//# buildInfo:effects=disabled, kind=exe, use-js-string=true, version=6.2.0
|
|
3
|
+
(function(a){typeof
|
|
4
|
+
globalThis!=="object"&&(this?b():(a.defineProperty(a.prototype,"_T_",{configurable:true,get:b}),_T_));function
|
|
5
|
+
b(){var
|
|
6
|
+
b=this||self;b.globalThis=b;delete
|
|
7
|
+
a.prototype._T_}}(Object));(function(d){"use strict";var
|
|
8
|
+
r="EINVAL",y="ENOENT",S="Failure",ar="Pervasives.do_at_exit",x="node:fs",aB="Unix.Unix_error",R="win32",I="lseek",V="EISDIR",k="/",c=248,p=0xff,aq="Out_of_memory",az="Assert_failure",aA="Undefined_recursive_module",ap="Sys_blocked_io",U="mkdir",B=0xffff,aI="illegal operation on a directory",L='"',T="ESPIPE",aH=4096,j=0xffffff,ay="Sys_error",aN="Match_failure",ax="^",o=0x8000,s="EBADF",an=0x000000,ao="truncate",aM="write",A="bad file descriptor",aF="Not_found",aG="readdir",am="/static/",aL="illegal seek",al="file already exists",X="EEXIST",aK=" doesn't exist",ak="fd ",aw="ENOTEMPTY",W="open",J="ENOTDIR",aE="Division_by_zero",aJ="([^/]+)",H="no such file or directory",au="Invalid_argument",av="Stack_overflow",K=1000,aj="not a directory",aD="jsError",Y="rmdir",at="End_of_file",as="read",aC=", ",g="",n=1024,z="invalid argument",a$={};function
|
|
9
|
+
bL(a){if(a$[a])return a$[a];var
|
|
10
|
+
b=d.process;if(b&&b.env&&b.env[a]!==undefined)return b.env[a];if(d.jsoo_env&&typeof
|
|
11
|
+
d.jsoo_env[a]==="string")return d.jsoo_env[a]}var
|
|
12
|
+
N=0;(function(){var
|
|
13
|
+
c=bL("OCAMLRUNPARAM");if(c!==undefined){var
|
|
14
|
+
b=c.split(",");for(var
|
|
15
|
+
a=0;a<b.length;a++)if(b[a]==="b"){N=1;break}else if(b[a].startsWith("b="))N=+b[a].slice(2);else
|
|
16
|
+
continue}}());var
|
|
17
|
+
bC=N,h=[0];function
|
|
18
|
+
bn(a,b){if(!a.js_error||b||a[0]===c)a.js_error=new
|
|
19
|
+
d.Error("Js exception containing backtrace");return a}function
|
|
20
|
+
ac(a,b){return N&&bC?bn(a,b):a}function
|
|
21
|
+
a4(a,b){throw ac([0,a,b])}function
|
|
22
|
+
F(a){return a}function
|
|
23
|
+
a6(a,b){a4(a,F(b))}function
|
|
24
|
+
aU(a){if(!h.Failure)h.Failure=[c,F(S),-3];a6(h.Failure,a)}var
|
|
25
|
+
bb=new
|
|
26
|
+
ArrayBuffer(n),ba=new
|
|
27
|
+
TextDecoder();function
|
|
28
|
+
af(a){if(a.length<24){for(var
|
|
29
|
+
b=0;b<a.length;b++)if(a.charCodeAt(b)>127)return false;return true}else
|
|
30
|
+
return!/[^\x00-\x7f]/.test(a)}function
|
|
31
|
+
a0(a){if(af(a))return a;var
|
|
32
|
+
c=a.length<=bb.length?new
|
|
33
|
+
Uint8Array(bb,0,a.length):new
|
|
34
|
+
Uint8Array(a.length);for(var
|
|
35
|
+
b=0;b<a.length;b++)c[b]=a.charCodeAt(b);return ba.decode(c)}function
|
|
36
|
+
G(){return d.process?.versions?.node!==undefined}function
|
|
37
|
+
bN(){function
|
|
38
|
+
a(a){if(a.charAt(0)===k)return[g,a.slice(1)];return}function
|
|
39
|
+
b(a){var
|
|
40
|
+
h=/^([a-zA-Z]:|[\\/]{2}[^\\/]+[\\/]+[^\\/]+)?([\\/])?([\s\S]*?)$/,b=h.exec(a),c=b[1]||g,e=c.length>0&&c.charAt(1)!==":";if(b[2]||e){var
|
|
41
|
+
d=b[1]||g,f=b[2]||g;return[d,a.slice(d.length+f.length)]}return}return G()&&d.process&&d.process.platform?d.process.platform===R?b:a:a}var
|
|
42
|
+
ag=bN();function
|
|
43
|
+
a8(a){return a.slice(-1)!==k?a+k:a}if(G()&&d.process&&d.process.cwd)var
|
|
44
|
+
D=d.process.cwd().replace(/\\/g,k);else
|
|
45
|
+
var
|
|
46
|
+
D="/static";D=a8(D);function
|
|
47
|
+
bu(a){a=a0(a);if(!ag(a))a=D+a;var
|
|
48
|
+
e=ag(a),d=e[1].split(/[/\\]/),b=[];for(var
|
|
49
|
+
c=0;c<d.length;c++)switch(d[c]){case"..":b.pop();break;case".":break;case"":break;default:b.push(d[c]);break}b.unshift(e[0]);b.orig=a;return b}var
|
|
50
|
+
bM=new
|
|
51
|
+
TextEncoder();function
|
|
52
|
+
bI(a,b,c){var
|
|
53
|
+
d=String.fromCharCode;if(b===0&&c<=aH&&c===a.length)return d.apply(null,a);var
|
|
54
|
+
e=g;for(;0<c;b+=n,c-=n)e+=d.apply(null,a.slice(b,b+Math.min(c,n)));return e}function
|
|
55
|
+
bG(a){return F(bI(a,0,a.length))}function
|
|
56
|
+
l(a){if(af(a))return F(a);var
|
|
57
|
+
b=bM.encode(a);return bG(b)}function
|
|
58
|
+
i(a){a4(h.Sys_error,l(a))}function
|
|
59
|
+
a5(a,b){throw ac([0,a].concat(b))}var
|
|
60
|
+
bO=["E2BIG","EACCES","EAGAIN",s,"EBUSY","ECHILD","EDEADLK","EDOM",X,"EFAULT","EFBIG","EINTR",r,"EIO",V,"EMFILE","EMLINK","ENAMETOOLONG","ENFILE","ENODEV",y,"ENOEXEC","ENOLCK","ENOMEM","ENOSPC","ENOSYS",J,aw,"ENOTTY","ENXIO","EPERM","EPIPE","ERANGE","EROFS",T,"ESRCH","EXDEV","EWOULDBLOCK","EINPROGRESS","EALREADY","ENOTSOCK","EDESTADDRREQ","EMSGSIZE","EPROTOTYPE","ENOPROTOOPT","EPROTONOSUPPORT","ESOCKTNOSUPPORT","EOPNOTSUPP","EPFNOSUPPORT","EAFNOSUPPORT","EADDRINUSE","EADDRNOTAVAIL","ENETDOWN","ENETUNREACH","ENETRESET","ECONNABORTED","ECONNRESET","ENOBUFS","EISCONN","ENOTCONN","ESHUTDOWN","ETOOMANYREFS","ETIMEDOUT","ECONNREFUSED","EHOSTDOWN","EHOSTUNREACH","ELOOP","EOVERFLOW"];function
|
|
61
|
+
bd(a,b,c,d){var
|
|
62
|
+
e=bO.indexOf(a);if(e<0){if(d==null)d=-9999;e=[0,-d]}var
|
|
63
|
+
f=[e,l(b||g),l(c||g)];return f}var
|
|
64
|
+
a3={};function
|
|
65
|
+
u(a){return a3[a]}function
|
|
66
|
+
f(a,b,c,d,e){var
|
|
67
|
+
f=u(aB);if(a&&f)a5(f,bd(b,c,e));else{var
|
|
68
|
+
d=b+": "+d+aC+c;if(e!==undefined)d+=" '"+e+"'";i(d)}}function
|
|
69
|
+
ab(a){var
|
|
70
|
+
c=new
|
|
71
|
+
Uint8Array(a.l),e=a.c,d=e.length,b=0;for(;b<d;b++)c[b]=e.charCodeAt(b);for(d=a.l;b<d;b++)c[b]=0;a.c=c;a.t=4;return c}function
|
|
72
|
+
a9(a){if(a.t!==4)ab(a);return a.c}function
|
|
73
|
+
bF(a,b){return b.repeat(a)}function
|
|
74
|
+
P(a,b,c){var
|
|
75
|
+
d=String.fromCharCode;if(b===0&&c<=aH&&c===a.length)return d.apply(null,a);var
|
|
76
|
+
e=g;for(;0<c;b+=n,c-=n)e+=d.apply(null,a.subarray(b,b+Math.min(c,n)));return e}function
|
|
77
|
+
bl(a){if(a.t===2)a.c+=bF(a.l-a.c.length,"\0");else
|
|
78
|
+
a.c=P(a.c,0,a.c.length);a.t=0}class
|
|
79
|
+
q{constructor(a,b,c){this.t=a;this.c=b;this.l=c}toString(){switch(this.t){case
|
|
80
|
+
9:case
|
|
81
|
+
8:return this.c;case
|
|
82
|
+
4:case
|
|
83
|
+
2:bl(this);case
|
|
84
|
+
0:if(af(this.c))this.t=9;else
|
|
85
|
+
this.t=8;return this.c}}toUtf16(){if(this.t===9)return this.c;var
|
|
86
|
+
a=a9(this);return ba.decode(a)}slice(){var
|
|
87
|
+
a=this.t===4?this.c.slice():this.c;return new
|
|
88
|
+
q(this.t,a,this.l)}}function
|
|
89
|
+
br(a){return a
|
|
90
|
+
instanceof
|
|
91
|
+
q}function
|
|
92
|
+
bs(a){return typeof
|
|
93
|
+
a==="string"&&!/[^\x00-\xff]/.test(a)}function
|
|
94
|
+
bj(a){if(!(a
|
|
95
|
+
instanceof
|
|
96
|
+
Uint8Array))a=new
|
|
97
|
+
Uint8Array(a);return new
|
|
98
|
+
q(4,a,a.length)}function
|
|
99
|
+
aS(a){return new
|
|
100
|
+
q(0,a,a.length)}function
|
|
101
|
+
aZ(a){return a}function
|
|
102
|
+
_(a){return aS(aZ(a))}function
|
|
103
|
+
ad(a,b){f(b,y,H,a)}function
|
|
104
|
+
aT(a){return new
|
|
105
|
+
q(4,a,a.length)}function
|
|
106
|
+
aX(a){a6(h.Invalid_argument,a)}function
|
|
107
|
+
t(a){if(a<0)aX("Bytes.create");return new
|
|
108
|
+
q(a?2:9,g,a)}function
|
|
109
|
+
bv(a){return a.l}function
|
|
110
|
+
C(a,b,c,d,e){if(e===0)return 0;if(d===0&&(e>=c.l||c.t===2&&e>=c.c.length)){c.c=a.t===4?P(a.c,b,e):b===0&&a.c.length===e?a.c:a.c.slice(b,b+e);c.t=c.c.length===c.l?0:2}else if(c.t===2&&d===c.c.length){c.c+=a.t===4?P(a.c,b,e):b===0&&a.c.length===e?a.c:a.c.slice(b,b+e);c.t=c.c.length===c.l?0:2}else{if(c.t!==4)ab(c);var
|
|
111
|
+
g=a.c,h=c.c;if(a.t===4)if(d<=b)for(var
|
|
112
|
+
f=0;f<e;f++)h[d+f]=g[b+f];else
|
|
113
|
+
for(var
|
|
114
|
+
f=e-1;f>=0;f--)h[d+f]=g[b+f];else{var
|
|
115
|
+
i=Math.min(e,g.length-b);for(var
|
|
116
|
+
f=0;f<i;f++)h[d+f]=g.charCodeAt(b+f);for(;f<e;f++)h[d+f]=0}}return 0}function
|
|
117
|
+
aQ(){}class
|
|
118
|
+
m
|
|
119
|
+
extends
|
|
120
|
+
aQ{constructor(a){super();this.data=a}truncate(a){var
|
|
121
|
+
b=this.data;this.data=t(a|0);C(b,0,this.data,0,a)}length(){return bv(this.data)}write(a,b,c,d){var
|
|
122
|
+
e=this.length();if(a+d>=e){var
|
|
123
|
+
f=t(a+d),g=this.data;this.data=f;C(g,0,this.data,0,e)}C(aT(b),c,this.data,a,d);return d}read(a,b,c,d){var
|
|
124
|
+
e=this.length();if(a+d>=e)d=e-a;if(d){var
|
|
125
|
+
f=t(d|0);C(this.data,a,f,0,d);b.set(a9(f),c)}return d}}class
|
|
126
|
+
bf{constructor(a,b,c){this.file=b;this.name=a;this.flags=c;this.offset=0;this.seeked=false}err_closed(a,b){f(b,s,a,A)}length(){if(this.file)return this.file.length();this.err_closed("length")}truncate(a,b){if(this.file){if(!(this.flags.wronly||this.flags.rdwr))f(b,r,ao,z);return this.file.truncate(a)}this.err_closed(ao,b)}write(a,b,c,d){if(this.file&&(this.flags.wronly||this.flags.rdwr)){var
|
|
127
|
+
e=this.offset;c=this.file.write(e,a,b,c);this.offset+=c;return c}this.err_closed(aM,d)}read(a,b,c,d){if(this.file&&!this.flags.wronly){var
|
|
128
|
+
e=this.offset;c=this.file.read(e,a,b,c);this.offset+=c;return c}this.err_closed(as,d)}seek(a,b,c){switch(b){case
|
|
129
|
+
0:break;case
|
|
130
|
+
1:a+=this.offset;break;case
|
|
131
|
+
2:a+=this.length();break}if(a<0)f(c,r,I,z);this.offset=a;this.seeked=true}close(){if(!this.file)this.err_closed("close");this.file=undefined}check_stream_semantics(a){if(!this.file)return this.err_closed(a,1)}}class
|
|
132
|
+
aP{constructor(a,b){this.content={};this.root=a;this.lookupFun=b}nm(a){return this.root+a}create_dir_if_needed(a){var
|
|
133
|
+
d=a.split(k),c=g;for(var
|
|
134
|
+
b=0;b<d.length-1;b++){c+=d[b]+k;if(this.content[c])continue;this.content[c]=Symbol("directory")}}slash(a){return/\/$/.test(a)?a:a+k}lookup(a){if(!this.content[a]&&this.lookupFun){var
|
|
135
|
+
b=this.lookupFun(l(this.root),l(a));if(b!==0){this.create_dir_if_needed(a);this.content[a]=new
|
|
136
|
+
m(_(b[1]))}}}exists(a,b){if(a===g)return 1;var
|
|
137
|
+
c=this.slash(a);if(this.content[c])return 1;if(!b)this.lookup(a);return this.content[a]?1:0}isFile(a){return this.exists(a)&&!this.is_dir(a)?1:0}rename_dir(a,b){if(this.exists(b)){if(!this.is_dir(b))i(this.nm(b)+" : file already exists and is not a directory");if(this.readdir(b).length>0)i(this.nm(b)+" : directory not empty")}var
|
|
138
|
+
d=this.slash(a),c=this.slash(b);this.create_dir_if_needed(c);for(const
|
|
139
|
+
b
|
|
140
|
+
of
|
|
141
|
+
this.readdir(a))this.rename(d+b,c+b);delete
|
|
142
|
+
this.content[d]}rename(a,b){if(!this.exists(a))i(this.nm(a)+" : no such file or directory");if(this.is_dir(a))this.rename_dir(a,b);else{if(this.exists(b)&&this.is_dir(b))i(this.nm(b)+" : file already exists and is a directory");this.content[b]=this.content[a];delete
|
|
143
|
+
this.content[a]}}mkdir(a,b,c){if(this.exists(a))f(c,X,U,al,this.nm(a));var
|
|
144
|
+
d=/^(.*)\/[^/]+/.exec(a);d=d?.[1]||g;if(!this.exists(d))f(c,y,U,H,this.nm(a));if(!this.is_dir(d))f(c,J,U,aj,this.nm(a));this.create_dir_if_needed(this.slash(a))}rmdir(a,b){var
|
|
145
|
+
c=a===g?g:this.slash(a),e=new
|
|
146
|
+
RegExp(ax+c+aJ);if(!this.exists(a))f(b,y,Y,H,this.nm(a));if(!this.is_dir(a))f(b,J,Y,aj,this.nm(a));for(var
|
|
147
|
+
d
|
|
148
|
+
in
|
|
149
|
+
this.content)if(d.match(e))f(b,aw,Y,"directory not empty",this.nm(a));delete
|
|
150
|
+
this.content[c]}readdir(a){var
|
|
151
|
+
f=a===g?g:this.slash(a);if(!this.exists(a))i(a+": No such file or directory");if(!this.is_dir(a))i(a+": Not a directory");var
|
|
152
|
+
h=new
|
|
153
|
+
RegExp(ax+f+aJ),d={},c=[];for(var
|
|
154
|
+
e
|
|
155
|
+
in
|
|
156
|
+
this.content){var
|
|
157
|
+
b=e.match(h);if(b&&!d[b[1]]){d[b[1]]=true;c.push(b[1])}}return c}opendir(a,b){var
|
|
158
|
+
c=this.readdir(a),d=false,e=0;return{readSync:function(){if(d)f(b,s,aG,A);if(e===c.length)return null;var
|
|
159
|
+
a=c[e];e++;return{name:a}},closeSync:function(){if(d)f(b,s,aG,A);d=true;c=[]}}}is_dir(a){if(a===g)return true;var
|
|
160
|
+
b=this.slash(a);return this.content[b]?1:0}unlink(a,b){if(!this.exists(a,true))f(b,y,"unlink",H,a);delete
|
|
161
|
+
this.content[a];return 0}access(a,b,c){this.lookup(a);if(this.content[a]){if(this.is_dir(a))f(c,"EACCESS","access","permission denied,",this.nm(a))}else
|
|
162
|
+
ad(this.nm(a),c);return 0}open(a,b,c,d){var
|
|
163
|
+
e;this.lookup(a);if(this.content[a]){if(this.is_dir(a))f(d,V,W,aI,this.nm(a));if(b.create&&b.excl)f(d,X,W,al,this.nm(a));e=this.content[a];if(b.truncate)e.truncate()}else if(b.create){this.create_dir_if_needed(a);this.content[a]=new
|
|
164
|
+
m(t(0));e=this.content[a]}else
|
|
165
|
+
ad(this.nm(a),d);return new
|
|
166
|
+
bf(this.nm(a),e,b)}truncate(a,b,c){var
|
|
167
|
+
d;this.lookup(a);if(this.content[a]){if(this.is_dir(a))f(c,V,W,aI,this.nm(a));d=this.content[a];d.truncate(b)}else
|
|
168
|
+
ad(this.nm(a),c)}register(a,b){var
|
|
169
|
+
c;if(this.content[a])i(this.nm(a)+" : file already exists");if(br(b))c=new
|
|
170
|
+
m(b);if(bs(b))c=new
|
|
171
|
+
m(_(b));else if(Array.isArray(b))c=new
|
|
172
|
+
m(bj(b));else if(typeof
|
|
173
|
+
b==="string")c=new
|
|
174
|
+
m(aS(b));else if(b.toString){var
|
|
175
|
+
d=_(l(b.toString()));c=new
|
|
176
|
+
m(d)}if(c){this.create_dir_if_needed(a);this.content[a]=c}else
|
|
177
|
+
i(this.nm(a)+" : registering file with invalid content type")}}function
|
|
178
|
+
e(a,b,c){var
|
|
179
|
+
d=u(aB);if(b&&d){var
|
|
180
|
+
e=bd(a.code,c||a.syscall,a.path,a.errno);a5(d,e)}else
|
|
181
|
+
i(a.toString())}var
|
|
182
|
+
E=Math.pow(2,-24);function
|
|
183
|
+
bB(a){throw a}function
|
|
184
|
+
a7(){bB(h.Division_by_zero)}class
|
|
185
|
+
b{constructor(a,b,c){this.lo=a&j;this.mi=b&j;this.hi=c&B;this.caml_custom="_j"}static
|
|
186
|
+
UNSIGNED_MAX=new
|
|
187
|
+
b(j,j,B);static
|
|
188
|
+
SIGNED_MAX=new
|
|
189
|
+
b(j,j,0x7fff);static
|
|
190
|
+
SIGNED_MIN=new
|
|
191
|
+
b(an,an,o);slice(){return new
|
|
192
|
+
b(this.lo,this.mi,this.hi)}ucompare(a){if(this.hi>a.hi)return 1;if(this.hi<a.hi)return-1;if(this.mi>a.mi)return 1;if(this.mi<a.mi)return-1;if(this.lo>a.lo)return 1;if(this.lo<a.lo)return-1;return 0}compare(a){var
|
|
193
|
+
b=this.hi<<16,c=a.hi<<16;if(b>c)return 1;if(b<c)return-1;if(this.mi>a.mi)return 1;if(this.mi<a.mi)return-1;if(this.lo>a.lo)return 1;if(this.lo<a.lo)return-1;return 0}neg(){var
|
|
194
|
+
a=-this.lo,c=-this.mi+(a>>24),d=-this.hi+(c>>24);return new
|
|
195
|
+
b(a,c,d)}add(a){var
|
|
196
|
+
c=this.lo+a.lo,d=this.mi+a.mi+(c>>24),e=this.hi+a.hi+(d>>24);return new
|
|
197
|
+
b(c,d,e)}sub(a){var
|
|
198
|
+
c=this.lo-a.lo,d=this.mi-a.mi+(c>>24),e=this.hi-a.hi+(d>>24);return new
|
|
199
|
+
b(c,d,e)}mul(a){var
|
|
200
|
+
c=this.lo*a.lo,d=(c*E|0)+this.mi*a.lo+this.lo*a.mi,e=(d*E|0)+this.hi*a.lo+this.mi*a.mi+this.lo*a.hi;return new
|
|
201
|
+
b(c,d,e)}isZero(){return(this.lo|this.mi|this.hi)===0}isNeg(){return this.hi<<16<0}and(a){return new
|
|
202
|
+
b(this.lo&a.lo,this.mi&a.mi,this.hi&a.hi)}or(a){return new
|
|
203
|
+
b(this.lo|a.lo,this.mi|a.mi,this.hi|a.hi)}xor(a){return new
|
|
204
|
+
b(this.lo^a.lo,this.mi^a.mi,this.hi^a.hi)}shift_left(a){a=a&63;if(a===0)return this;if(a<24)return new
|
|
205
|
+
b(this.lo<<a,this.mi<<a|this.lo>>24-a,this.hi<<a|this.mi>>24-a);if(a<48)return new
|
|
206
|
+
b(0,this.lo<<a-24,this.mi<<a-24|this.lo>>48-a);return new
|
|
207
|
+
b(0,0,this.lo<<a-48)}shift_right_unsigned(a){a=a&63;if(a===0)return this;if(a<24)return new
|
|
208
|
+
b(this.lo>>a|this.mi<<24-a,this.mi>>a|this.hi<<24-a,this.hi>>a);if(a<48)return new
|
|
209
|
+
b(this.mi>>a-24|this.hi<<48-a,this.hi>>a-24,0);return new
|
|
210
|
+
b(this.hi>>a-48,0,0)}shift_right(a){a=a&63;if(a===0)return this;var
|
|
211
|
+
d=this.hi<<16>>16;if(a<24)return new
|
|
212
|
+
b(this.lo>>a|this.mi<<24-a,this.mi>>a|d<<24-a,this.hi<<16>>a>>>16);var
|
|
213
|
+
c=this.hi<<16>>31;if(a<48)return new
|
|
214
|
+
b(this.mi>>a-24|this.hi<<48-a,this.hi<<16>>a-24>>16,c&B);return new
|
|
215
|
+
b(this.hi<<16>>a-32,c,c)}lsl1(){this.hi=this.hi<<1|this.mi>>23;this.mi=(this.mi<<1|this.lo>>23)&j;this.lo=this.lo<<1&j}lsr1(){this.lo=(this.lo>>>1|this.mi<<23)&j;this.mi=(this.mi>>>1|this.hi<<23)&j;this.hi=this.hi>>>1}udivmod(a){var
|
|
216
|
+
e=0,d=this.slice(),c=a.slice(),f=new
|
|
217
|
+
b(0,0,0);while(d.ucompare(c)>0){e++;c.lsl1()}while(e>=0){e--;f.lsl1();if(d.ucompare(c)>=0){f.lo++;d=d.sub(c)}c.lsr1()}return{quotient:f,modulus:d}}div(a){var
|
|
218
|
+
b=this;if(a.isZero())a7();var
|
|
219
|
+
d=b.hi^a.hi;if(b.hi&o)b=b.neg();if(a.hi&o)a=a.neg();var
|
|
220
|
+
c=b.udivmod(a).quotient;if(d&o)c=c.neg();return c}mod(a){var
|
|
221
|
+
b=this;if(a.isZero())a7();var
|
|
222
|
+
d=b.hi;if(b.hi&o)b=b.neg();if(a.hi&o)a=a.neg();var
|
|
223
|
+
c=b.udivmod(a).modulus;if(d&o)c=c.neg();return c}toInt(){return this.lo|this.mi<<24}toFloat(){return(this.hi<<16)*Math.pow(2,32)+this.mi*Math.pow(2,24)+this.lo}toArray(){return[this.hi>>8,this.hi&p,this.mi>>16,this.mi>>8&p,this.mi&p,this.lo>>16,this.lo>>8&p,this.lo&p]}lo32(){return this.lo|(this.mi&p)<<24}hi32(){return this.mi>>>8&B|this.hi<<16}}function
|
|
224
|
+
bq(a){if(a<0)a=Math.ceil(a);return new
|
|
225
|
+
b(a&j,Math.floor(a*E)&j,Math.floor(a*E*E)&B)}function
|
|
226
|
+
ae(a,b){var
|
|
227
|
+
c;if(a.isFile())c=0;else if(a.isDirectory())c=1;else if(a.isCharacterDevice())c=2;else if(a.isBlockDevice())c=3;else if(a.isSymbolicLink())c=4;else if(a.isFIFO())c=5;else if(a.isSocket())c=6;return[0,a.dev,a.ino|0,c,a.mode,a.nlink,a.uid,a.gid,a.rdev,b?bq(a.size):a.size|0,a.atimeMs/K,a.mtimeMs/K,a.ctimeMs/K]}function
|
|
228
|
+
bA(a){return a.length}function
|
|
229
|
+
bH(a,b){return a.charCodeAt(b)}function
|
|
230
|
+
bR(a){var
|
|
231
|
+
d=bA(a),c=new
|
|
232
|
+
Uint8Array(d),b=0;for(;b<d;b++)c[b]=bH(a,b);return c}function
|
|
233
|
+
bi(){aX("index out of bounds")}function
|
|
234
|
+
bk(a,b,c){c&=p;if(a.t!==4){if(b===a.c.length){a.c+=String.fromCharCode(c);if(b+1===a.l)a.t=0;return 0}ab(a)}a.c[b]=c;return 0}function
|
|
235
|
+
bP(a,b,c){if(b>>>0>=a.l)bi();return bk(a,b,c)}class
|
|
236
|
+
Z
|
|
237
|
+
extends
|
|
238
|
+
aQ{constructor(a,b){super();this.fs=require(x);this.fd=a;this.flags=b;try{var
|
|
239
|
+
c=this.fs.fstatSync(a);b.noSeek=c.isCharacterDevice()||c.isFIFO()||c.isSocket()}catch(f){b.noSeek=true}this.offset=this.flags.append?c.size:0;this.seeked=false}truncate(a,b){try{this.fs.ftruncateSync(this.fd,a|0);if(this.offset>a)this.offset=a}catch(f){e(f,b)}}length(){try{return this.fs.fstatSync(this.fd).size}catch(f){i(f.toString())}}write(a,b,c,d){try{if(this.flags.noSeek||!this.seeked)var
|
|
240
|
+
f=this.fs.writeSync(this.fd,a,b,c);else
|
|
241
|
+
var
|
|
242
|
+
f=this.fs.writeSync(this.fd,a,b,c,this.offset);this.offset+=f}catch(f){e(f,d)}return f}read(a,b,c,d){try{if(this.flags.noSeek||!this.seeked)var
|
|
243
|
+
f=this.fs.readSync(this.fd,a,b,c);else
|
|
244
|
+
var
|
|
245
|
+
f=this.fs.readSync(this.fd,a,b,c,this.offset);this.offset+=f;return f}catch(f){e(f,d)}}seek(a,b,c){if(this.flags.noSeek)f(c,T,I,aL);switch(b){case
|
|
246
|
+
0:break;case
|
|
247
|
+
1:a+=this.offset;break;case
|
|
248
|
+
2:a+=this.length();break}if(a<0)f(c,r,I,z);this.offset=a;this.seeked=true;return this.offset}stat(a){try{var
|
|
249
|
+
b=this.fs.fstatSync(this.fd);return ae(b,a)}catch(f){e(f,1)}}chmod(a){try{this.fs.fchmodSync(this.fd,a);return 0}catch(f){e(f,1)}}sync(){try{this.fs.fsyncSync(this.fd);return 0}catch(f){e(f,1)}}close(a){try{this.fs.closeSync(this.fd);return 0}catch(f){e(f,a)}}check_stream_semantics(a){try{var
|
|
250
|
+
b=this.fs.fstatSync(this.fd)}catch(f){e(f,1,a)}if(!(b.isFile()||b.isCharacterDevice()||b.isFIFO()||b.isSocket()))f(1,r,a,z)}}class
|
|
251
|
+
aR{constructor(a){this.fs=require(x);this.root=a}nm(a){return this.root+a}exists(a){try{return this.fs.existsSync(this.nm(a))?1:0}catch(f){return 0}}isFile(a){try{return this.fs.statSync(this.nm(a)).isFile()?1:0}catch(f){i(f.toString())}}mkdir(a,b,c){try{this.fs.mkdirSync(this.nm(a),{mode:b});return 0}catch(f){e(f,c)}}rmdir(a,b){try{this.fs.rmdirSync(this.nm(a));return 0}catch(f){e(f,b)}}readdir(a,b){try{return this.fs.readdirSync(this.nm(a))}catch(f){e(f,b)}}is_dir(a){try{return this.fs.statSync(this.nm(a)).isDirectory()?1:0}catch(f){i(f.toString())}}unlink(a,b){try{this.fs.unlinkSync(this.nm(a));return 0}catch(f){e(f,b)}}utimes(a,b,c,d){try{if(b===0&&c===0){b=new
|
|
252
|
+
Date().getTime()/K;c=b}this.fs.utimesSync(this.nm(a),b,c);return 0}catch(f){e(f,d)}}truncate(a,b,c){try{this.fs.truncateSync(this.nm(a),b|0);return 0}catch(f){e(f,c)}}access(a,b,c){var
|
|
253
|
+
f=require(x).constants,g=0;for(var
|
|
254
|
+
h
|
|
255
|
+
in
|
|
256
|
+
b)switch(h){case"r":g|=f.R_OK;break;case"w":g|=f.W_OK;break;case"x":g|=d.process?.platform===R?f.R_OK:f.X_OK;break;case"f":g|=f.F_OK;break}try{this.fs.accessSync(this.nm(a),g);return 0}catch(f){e(f,c)}}open(a,b,c,d){var
|
|
257
|
+
g=require(x).constants,f=0;for(var
|
|
258
|
+
i
|
|
259
|
+
in
|
|
260
|
+
b)switch(i){case"rdonly":f|=g.O_RDONLY;break;case"wronly":f|=g.O_WRONLY;break;case"rdwr":f|=g.O_RDWR;break;case"append":f|=g.O_APPEND;break;case"create":f|=g.O_CREAT;break;case"truncate":f|=g.O_TRUNC;break;case"excl":f|=g.O_EXCL;break;case"binary":f|=g.O_BINARY;break;case"text":f|=g.O_TEXT;break;case"nonblock":f|=g.O_NONBLOCK;break;case"noctty":f|=g.O_NOCTTY;break;case"dsync":f|=g.O_DSYNC;break;case"sync":f|=g.O_SYNC;break}try{var
|
|
261
|
+
h=this.fs.openSync(this.nm(a),f,c);return new
|
|
262
|
+
Z(h,b)}catch(f){e(f,d)}}slash(a){return/\/$/.test(a)?a:a+k}rename(a,b,c){if(d.process?.platform===R)try{var
|
|
263
|
+
g=this.nm(b),h=this.nm(a),j,i;if((j=this.fs.statSync(g,{throwIfNoEntry:false}))&&(i=this.fs.statSync(h,{throwIfNoEntry:false}))&&i.isDirectory())if(j.isDirectory()){if(!this.slash(g).startsWith(this.slash(h)))try{this.fs.rmdirSync(g)}catch{}}else{var
|
|
264
|
+
f=new
|
|
265
|
+
Error(`ENOTDIR: not a directory, rename '${h}' -> '${g}'`);throw Object.assign(f,{errno:-20,code:J,syscall:"rename",path:g})}this.fs.renameSync(this.nm(a),this.nm(b))}catch(f){e(f,c)}else
|
|
266
|
+
try{this.fs.renameSync(this.nm(a),this.nm(b))}catch(f){e(f,c)}}stat(a,b,c){try{var
|
|
267
|
+
d=this.fs.statSync(this.nm(a));return ae(d,b)}catch(f){e(f,c)}}lstat(a,b,c){try{var
|
|
268
|
+
d=this.fs.lstatSync(this.nm(a));return ae(d,b)}catch(f){e(f,c)}}chmod(a,b,c){try{this.fs.chmodSync(this.nm(a),b);return 0}catch(f){e(f,c)}}link(a,b,c){try{this.fs.linkSync(this.nm(a),this.nm(b));return 0}catch(f){e(f,c)}}symlink(a,b,c,d){try{this.fs.symlinkSync(b,this.nm(c),a===0?null:a[1]?"dir":"file");return 0}catch(f){e(f,d)}}readlink(a,b){try{var
|
|
269
|
+
c=this.fs.readlinkSync(this.nm(a),"utf8");return l(c)}catch(f){e(f,b)}}opendir(a,b){try{return this.fs.opendirSync(this.nm(a))}catch(f){e(f,b)}}}function
|
|
270
|
+
aW(a){var
|
|
271
|
+
b=ag(a);if(!b)return;return b[0]+k}var
|
|
272
|
+
O=aW(D)||aU("unable to compute caml_root"),w=[];if(G())w.push({path:O,device:new
|
|
273
|
+
aR(O)});else
|
|
274
|
+
w.push({path:O,device:new
|
|
275
|
+
aP(O)});w.push({path:am,device:new
|
|
276
|
+
aP(am)});function
|
|
277
|
+
be(a){var
|
|
278
|
+
g=bu(a),a=g.join(k),f=a8(a),c;for(var
|
|
279
|
+
d=0;d<w.length;d++){var
|
|
280
|
+
b=w[d];if(f.search(b.path)===0&&(!c||c.path.length<b.path.length))c={path:b.path,device:b.device,rest:a.slice(b.path.length,a.length)}}if(!c&&G()){var
|
|
281
|
+
e=aW(a);if(e?.match(/^[a-zA-Z]:\/$/)){var
|
|
282
|
+
b={path:e,device:new
|
|
283
|
+
aR(e)};w.push(b);c={path:b.path,device:b.device,rest:a.slice(b.path.length,a.length)}}}if(c)return c;i("no device found for "+f)}function
|
|
284
|
+
bm(a,b){var
|
|
285
|
+
c=be(a);if(!c.device.register)aU("cannot register file");c.device.register(c.rest,b);return 0}function
|
|
286
|
+
a_(a,b){var
|
|
287
|
+
a=l(a),b=F(b);return bm(a,b)}function
|
|
288
|
+
bp(){var
|
|
289
|
+
b=d.jsoo_fs_tmp;if(b)for(var
|
|
290
|
+
a=0;a<b.length;a++)a_(b[a].name,b[a].content);d.jsoo_create_file=a_;d.jsoo_fs_tmp=[];return 0}function
|
|
291
|
+
aO(a){this.id=a}class
|
|
292
|
+
bw{constructor(){this.map=new
|
|
293
|
+
d.WeakMap();this.opened=new
|
|
294
|
+
d.Set()}close(a){this.opened.delete(a)}get(a){return this.map.get(a)}set(a,b){if(b.opened)this.opened.add(a);return this.map.set(a,b)}all(){return this.opened.values()}}var
|
|
295
|
+
M=new
|
|
296
|
+
bw();function
|
|
297
|
+
a1(a){return M.get(a)}function
|
|
298
|
+
bx(a){var
|
|
299
|
+
b=a1(a);if(!b.opened)i("Cannot flush a closed channel");if(!b.buffer||b.buffer_curr===0)return 0;if(b.output)b.output(P(b.buffer,0,b.buffer_curr));else
|
|
300
|
+
for(var
|
|
301
|
+
c=0;c<b.buffer_curr;)c+=b.file.write(b.buffer,c,b.buffer_curr-c);b.offset+=b.buffer_curr;b.buffer_curr=0;return 0}var
|
|
302
|
+
aY=65536;function
|
|
303
|
+
bJ(a,b){if(b.altname)try{var
|
|
304
|
+
d=require(x),c=d.openSync(b.altname,"rs");return new
|
|
305
|
+
Z(c,b)}catch(f){}return new
|
|
306
|
+
Z(a,b)}var
|
|
307
|
+
v=new
|
|
308
|
+
Array(3);class
|
|
309
|
+
bg
|
|
310
|
+
extends
|
|
311
|
+
m{constructor(a,b){super(t(0));this.log=function(a){return 0};if(a===1&&typeof
|
|
312
|
+
console.log==="function")this.log=console.log;else if(a===2&&typeof
|
|
313
|
+
console.error==="function")this.log=console.error;else if(typeof
|
|
314
|
+
console.log==="function")this.log=console.log;this.flags=b}length(){return 0}truncate(a,b){f(b,r,"ftruncate",z)}write(a,b,c,d){var
|
|
315
|
+
g=c;if(this.log){if(c>0&&b>=0&&b+c<=a.length&&a[b+c-1]===10)c--;var
|
|
316
|
+
e=t(c);C(aT(a),b,e,0,c);this.log(e.toUtf16());return g}f(d,s,aM,A)}read(a,b,c,d){f(d,s,as,A)}seek(a,b,c){f(c,T,I,aL)}close(){this.log=undefined}check_stream_semantics(a){}}function
|
|
317
|
+
Q(a,b){var
|
|
318
|
+
c;if(b===undefined){b=v.length;c=new
|
|
319
|
+
aO(b)}else if(v[b])c=v[b].chanid;else
|
|
320
|
+
c=new
|
|
321
|
+
aO(b);v[b]={file:a,chanid:c};return b|0}function
|
|
322
|
+
bQ(a,b,c){var
|
|
323
|
+
d={};while(b){switch(b[1]){case
|
|
324
|
+
0:d.rdonly=1;break;case
|
|
325
|
+
1:d.wronly=1;break;case
|
|
326
|
+
2:d.append=1;d.writeonly=1;break;case
|
|
327
|
+
3:d.create=1;break;case
|
|
328
|
+
4:d.truncate=1;break;case
|
|
329
|
+
5:d.excl=1;break;case
|
|
330
|
+
6:d.binary=1;break;case
|
|
331
|
+
7:d.text=1;break;case
|
|
332
|
+
8:d.nonblock=1;break}b=b[2]}var
|
|
333
|
+
e=be(a),f=e.device.open(e.rest,d,c);return Q(f,undefined)}(function(){var
|
|
334
|
+
c=G();function
|
|
335
|
+
a(a,b){return c?bJ(a,b):new
|
|
336
|
+
bg(a,b)}Q(a(0,{rdonly:1,altname:"/dev/stdin",isCharacterDevice:true}),0);Q(a(1,{buffered:c?1:2,wronly:1,isCharacterDevice:true}),1);Q(a(2,{buffered:c?1:2,wronly:1,isCharacterDevice:true}),2)}());function
|
|
337
|
+
by(a){var
|
|
338
|
+
b=v[a];if(b===undefined)i(ak+a+aK);var
|
|
339
|
+
d=b.file,c=b.chanid,f=null,e={file:d,offset:d.offset,fd:a,opened:true,out:false,buffer_curr:0,buffer_max:0,buffer:new
|
|
340
|
+
Uint8Array(aY),refill:f};M.set(c,e);return c}function
|
|
341
|
+
a2(a){var
|
|
342
|
+
c=v[a];if(c===undefined)i(ak+a+aK);var
|
|
343
|
+
b=c.file,d=c.chanid,e=b.flags.buffered!==undefined?b.flags.buffered:1,f={file:b,offset:b.offset,fd:a,opened:true,out:true,buffer_curr:0,buffer:new
|
|
344
|
+
Uint8Array(aY),buffered:e};M.set(d,f);return d}function
|
|
345
|
+
bz(){var
|
|
346
|
+
a=0,d=M.all();for(var
|
|
347
|
+
c
|
|
348
|
+
of
|
|
349
|
+
d){var
|
|
350
|
+
b=a1(c);if(b.opened&&b.out)a=[0,c,a]}return a}var
|
|
351
|
+
bc=undefined;function
|
|
352
|
+
$(d,e){var
|
|
353
|
+
f=d.l>=0?d.l:d.l=d.length,c=e.length,b=f-c;if(b===0)return d(...e);else if(b<0){var
|
|
354
|
+
a=d(...e.slice(0,f));if(typeof
|
|
355
|
+
a!=="function")return a;return $(a,e.slice(f))}else{switch(b){case
|
|
356
|
+
1:{var
|
|
357
|
+
a=function(a){var
|
|
358
|
+
f=new
|
|
359
|
+
Array(c+1);for(var
|
|
360
|
+
b=0;b<c;b++)f[b]=e[b];f[c]=a;return d(...f)};break}case
|
|
361
|
+
2:{var
|
|
362
|
+
a=function(a,b){var
|
|
363
|
+
g=new
|
|
364
|
+
Array(c+2);for(var
|
|
365
|
+
f=0;f<c;f++)g[f]=e[f];g[c]=a;g[c+1]=b;return d(...g)};break}default:var
|
|
366
|
+
a=function(...a){if(a.length===0)a=[undefined];return $(d,e.concat(a))}}a.l=b;return a}}var
|
|
367
|
+
aa=$;function
|
|
368
|
+
bh(a){var
|
|
369
|
+
d={},c=-1;if(a)for(var
|
|
370
|
+
b=1;b<a.length;b++){var
|
|
371
|
+
e=a[b][2];c=Math.max(c,e);d[a0(a[b][1])]=e}d.next_idx=c+1;return d}function
|
|
372
|
+
a(a,b,c){if(c){var
|
|
373
|
+
d=c;if(bc)a=aa(bc,[d]);else if(h.symbols){if(!h.symidx)h.symidx=bh(h.symbols);var
|
|
374
|
+
e=h.symidx[d];if(e>=0)a=e;else{var
|
|
375
|
+
a=h.symidx.next_idx++;h.symidx[d]=a}}}h[a+1]=b;if(c)h[c]=b}function
|
|
376
|
+
bD(a,b){a3[aZ(a)]=b;return 0}function
|
|
377
|
+
bK(a){{if(Array.isArray(a))return a;var
|
|
378
|
+
b;if(d.RangeError&&a
|
|
379
|
+
instanceof
|
|
380
|
+
d.RangeError&&a.message&&a.message.match(/maximum call stack/i))b=h.Stack_overflow;else if(d.InternalError&&a
|
|
381
|
+
instanceof
|
|
382
|
+
d.InternalError&&a.message&&a.message.match(/too much recursion/i))b=h.Stack_overflow;else if(a
|
|
383
|
+
instanceof
|
|
384
|
+
d.Error&&u(aD))b=[0,u(aD),a];else
|
|
385
|
+
b=[0,h.Failure,l(String(a))];if(a
|
|
386
|
+
instanceof
|
|
387
|
+
d.Error)b.js_error=a;return b}}function
|
|
388
|
+
bt(a){switch(a[2]){case-8:case-11:case-12:return 1;default:return 0}}function
|
|
389
|
+
bo(a){var
|
|
390
|
+
b=g;if(a[0]===0){b+=a[1][1];if(a.length===3&&a[2][0]===0&&bt(a[1]))var
|
|
391
|
+
f=a[2],h=1;else
|
|
392
|
+
var
|
|
393
|
+
h=2,f=a;b+="(";for(var
|
|
394
|
+
e=h;e<f.length;e++){if(e>h)b+=aC;var
|
|
395
|
+
d=f[e];if(typeof
|
|
396
|
+
d==="number")b+=d.toString();else if(d
|
|
397
|
+
instanceof
|
|
398
|
+
q)b+=L+d.toString()+L;else if(typeof
|
|
399
|
+
d==="string")b+=L+d.toString()+L;else
|
|
400
|
+
b+="_"}b+=")"}else if(a[0]===c)b+=a[1];return b}function
|
|
401
|
+
aV(a){if(Array.isArray(a)&&(a[0]===0||a[0]===c)){var
|
|
402
|
+
d=u("Printexc.handle_uncaught_exception");if(d)aa(d,[a,false]);else{var
|
|
403
|
+
e=bo(a),b=u(ar);if(b)aa(b,[0]);console.error("Fatal error: exception "+e);if(a.js_error)throw a.js_error}}else
|
|
404
|
+
throw a}function
|
|
405
|
+
bE(){var
|
|
406
|
+
c=d.process;if(c?.on)c.on("uncaughtException",function(a,b){aV(a);c.exit(2)});else if(d.addEventListener)d.addEventListener("error",function(a){if(a.error)aV(a.error)})}bE();bp();var
|
|
407
|
+
ah=[c,ay,-2];a(11,[c,aA,-12],aA);a(10,[c,az,-11],az);a(9,[c,ap,-10],ap);a(8,[c,av,-9],av);a(7,[c,aN,-8],aN);a(6,[c,aF,-7],aF);a(5,[c,aE,-6],aE);a(4,[c,at,-5],at);a(3,[c,au,-4],au);a(2,[c,S,-3],S);a(1,ah,ay);a(0,[c,aq,-1],aq);by(0);a2(1);a2(2);function
|
|
408
|
+
ai(a){var
|
|
409
|
+
b=bz(0);for(;;){if(!b)return 0;var
|
|
410
|
+
c=b[2],e=b[1];try{bx(e);b=c}catch(f){var
|
|
411
|
+
d=bK(f);if(d[1]!==ah)throw ac(d,0);b=c}}}bD(ar,ai);ai(0);return}(globalThis));
|