sphere-cli 0.1.37 → 0.1.39
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 +82 -4
- package/bin/sphere.js +434 -14
- package/examples/nhanes_sample.csv +4900 -0
- package/package.json +8 -3
- package/scripts/postinstall.js +74 -122
- package/sphere-node.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sphere-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.39",
|
|
4
4
|
"description": "SPHERE CLI — synthetic data generation, evaluation, and certification",
|
|
5
5
|
"keywords": ["synthetic-data", "privacy", "cli", "data-science"],
|
|
6
6
|
"homepage": "https://github.com/statzihuai/sphere-cli",
|
|
@@ -16,12 +16,17 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"postinstall": "node scripts/postinstall.js"
|
|
18
18
|
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"bytenode": "^1.5.7"
|
|
21
|
+
},
|
|
19
22
|
"files": [
|
|
20
23
|
"bin/",
|
|
21
|
-
"
|
|
24
|
+
"examples/",
|
|
25
|
+
"scripts/postinstall.js",
|
|
26
|
+
"sphere-node.js"
|
|
22
27
|
],
|
|
23
28
|
"engines": {
|
|
24
|
-
"node": ">=
|
|
29
|
+
"node": ">=18.0.0"
|
|
25
30
|
},
|
|
26
31
|
"os": ["darwin", "linux"],
|
|
27
32
|
"cpu": ["arm64", "x64"]
|
package/scripts/postinstall.js
CHANGED
|
@@ -1,141 +1,93 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* Releases and extracts it to native/ inside the npm package directory.
|
|
4
|
+
* SPHERE CLI postinstall — compiles sphere-node.js to V8 bytecode.
|
|
6
5
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
6
|
+
* sphere-node.js in this package is an obfuscated JS bundle of the SPHERE
|
|
7
|
+
* algorithm. Compiling it to V8 bytecode (.jsc) at install time ensures the
|
|
8
|
+
* bytecode matches the Node.js version on this machine, preventing
|
|
9
|
+
* decompilation. After compilation the source file is replaced by a tiny
|
|
10
|
+
* loader stub so only bytecode remains on disk.
|
|
12
11
|
*
|
|
13
|
-
*
|
|
12
|
+
* This mirrors exactly how the SPHERE desktop app protects its code.
|
|
14
13
|
*/
|
|
15
14
|
|
|
16
|
-
const
|
|
17
|
-
const fs
|
|
18
|
-
const path = require('path');
|
|
19
|
-
const os = require('os');
|
|
20
|
-
const { execFileSync } = require('child_process');
|
|
15
|
+
const path = require('path');
|
|
16
|
+
const fs = require('fs');
|
|
21
17
|
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
18
|
+
const PKG_DIR = path.join(__dirname, '..');
|
|
19
|
+
const SRC = path.join(PKG_DIR, 'sphere-node.js');
|
|
20
|
+
const OUT = path.join(PKG_DIR, 'sphere-node.jsc');
|
|
21
|
+
const STUB = "'use strict';\nrequire('bytenode');\nrequire('./sphere-node.jsc');\n";
|
|
22
|
+
const VERSION = require('../package.json').version;
|
|
23
|
+
const MARKER = path.join(PKG_DIR, '.sphere-node-version');
|
|
25
24
|
|
|
26
|
-
// ──
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (p === 'darwin' && a === 'arm64') return 'macos-arm64';
|
|
31
|
-
if (p === 'linux' && a === 'x64') return 'linux-x86_64';
|
|
32
|
-
if (p === 'linux' && a === 'arm64') return 'linux-arm64';
|
|
33
|
-
throw new Error(
|
|
34
|
-
`Unsupported platform: ${p}-${a}\n` +
|
|
35
|
-
'Supported: macOS arm64, Linux x86_64, Linux arm64.\n' +
|
|
36
|
-
'Use the curl installer instead: https://github.com/statzihuai/sphere-cli#install'
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// ── HTTPS GET with redirect following ────────────────────────────────────────
|
|
41
|
-
function download(url, destPath) {
|
|
42
|
-
return new Promise((resolve, reject) => {
|
|
43
|
-
function get(url, redirects) {
|
|
44
|
-
if (redirects > 5) { reject(new Error('Too many redirects')); return; }
|
|
45
|
-
https.get(url, { headers: { 'User-Agent': 'sphere-cli-npm-installer' } }, res => {
|
|
46
|
-
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
47
|
-
get(res.headers.location, redirects + 1);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
if (res.statusCode !== 200) {
|
|
51
|
-
reject(new Error(`HTTP ${res.statusCode} downloading ${url}`));
|
|
52
|
-
res.resume();
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const out = fs.createWriteStream(destPath);
|
|
56
|
-
res.pipe(out);
|
|
57
|
-
out.on('finish', () => out.close(resolve));
|
|
58
|
-
out.on('error', reject);
|
|
59
|
-
res.on('error', reject);
|
|
60
|
-
}).on('error', reject);
|
|
61
|
-
}
|
|
62
|
-
get(url, 0);
|
|
63
|
-
});
|
|
25
|
+
// ── Skip flag ─────────────────────────────────────────────────────────────────
|
|
26
|
+
if (process.env.SPHERE_SKIP_POSTINSTALL === '1') {
|
|
27
|
+
process.stdout.write('SPHERE_SKIP_POSTINSTALL=1 — skipping bytecode compilation.\n');
|
|
28
|
+
process.exit(0);
|
|
64
29
|
}
|
|
65
30
|
|
|
66
|
-
// ──
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
console.log('SPHERE_SKIP_POSTINSTALL=1 — skipping binary download.');
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const platform = getPlatformKey();
|
|
75
|
-
const tarball = `sphere-cli-${platform}.tar.gz`;
|
|
76
|
-
const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${tarball}`;
|
|
77
|
-
const nativeDir = path.join(PKG_DIR, 'native');
|
|
78
|
-
const tmpTar = path.join(os.tmpdir(), `sphere-cli-install-${process.pid}.tar.gz`);
|
|
79
|
-
|
|
80
|
-
// Re-download whenever the installed version doesn't match the package version.
|
|
81
|
-
// This ensures `npm install -g sphere-cli` or `npm update -g sphere-cli` always
|
|
82
|
-
// delivers the correct binary even when one is already present from a prior release.
|
|
83
|
-
const binaryPath = path.join(nativeDir, 'sphere-cli', 'sphere');
|
|
84
|
-
const markerPath = path.join(nativeDir, '.sphere-cli-version');
|
|
85
|
-
const installedVer = fs.existsSync(markerPath)
|
|
86
|
-
? fs.readFileSync(markerPath, 'utf8').trim()
|
|
87
|
-
: null;
|
|
88
|
-
|
|
89
|
-
if (fs.existsSync(binaryPath) && installedVer === VERSION) {
|
|
90
|
-
console.log(`✓ SPHERE CLI v${VERSION} already installed — skipping download.`);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (installedVer && installedVer !== VERSION) {
|
|
95
|
-
console.log(`\nUpgrading SPHERE CLI ${installedVer} → ${VERSION} for ${platform} …`);
|
|
96
|
-
} else {
|
|
97
|
-
console.log(`\nDownloading SPHERE CLI v${VERSION} for ${platform} …`);
|
|
98
|
-
}
|
|
99
|
-
console.log(` ${url}\n`);
|
|
31
|
+
// ── Already compiled for this version? ───────────────────────────────────────
|
|
32
|
+
const installedVer = fs.existsSync(MARKER)
|
|
33
|
+
? fs.readFileSync(MARKER, 'utf8').trim()
|
|
34
|
+
: null;
|
|
100
35
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
`Failed to download SPHERE CLI binary: ${err.message}\n\n` +
|
|
106
|
-
'Alternatives:\n' +
|
|
107
|
-
` • curl installer: curl -fsSL https://github.com/${REPO}/releases/latest/download/install.sh | sh\n` +
|
|
108
|
-
` • Manual download: ${url}`
|
|
109
|
-
);
|
|
110
|
-
}
|
|
36
|
+
if (fs.existsSync(OUT) && installedVer === VERSION) {
|
|
37
|
+
process.stdout.write(`✓ SPHERE algorithm already compiled for v${VERSION}.\n`);
|
|
38
|
+
process.exit(0);
|
|
39
|
+
}
|
|
111
40
|
|
|
112
|
-
|
|
41
|
+
// ── Source check ──────────────────────────────────────────────────────────────
|
|
42
|
+
if (!fs.existsSync(SRC)) {
|
|
43
|
+
process.stderr.write('sphere-node.js not found in package — reinstall sphere-cli.\n');
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
113
46
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
47
|
+
const srcText = fs.readFileSync(SRC, 'utf8');
|
|
48
|
+
if (srcText.includes("require('bytenode')") && srcText.length < 200) {
|
|
49
|
+
// Already stubbed from a previous install — .jsc must exist
|
|
50
|
+
if (fs.existsSync(OUT)) {
|
|
51
|
+
process.stdout.write('✓ SPHERE algorithm already compiled.\n');
|
|
52
|
+
process.exit(0);
|
|
118
53
|
}
|
|
54
|
+
process.stderr.write('sphere-node.js is a stub but sphere-node.jsc is missing. Reinstall sphere-cli.\n');
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
119
57
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
// Write version marker so future postinstall runs can detect upgrades
|
|
124
|
-
fs.writeFileSync(markerPath, VERSION, 'utf8');
|
|
58
|
+
// ── Compile ───────────────────────────────────────────────────────────────────
|
|
59
|
+
process.stdout.write('Compiling SPHERE algorithm for your Node.js version …\n');
|
|
125
60
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
61
|
+
let bytenode;
|
|
62
|
+
try {
|
|
63
|
+
bytenode = require('bytenode');
|
|
64
|
+
} catch {
|
|
65
|
+
process.stderr.write(
|
|
66
|
+
'bytenode is not installed — this is unexpected.\n' +
|
|
67
|
+
'Try: cd "$(npm root -g)/sphere-cli" && npm install bytenode\n',
|
|
68
|
+
);
|
|
69
|
+
process.exit(1);
|
|
133
70
|
}
|
|
134
71
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
72
|
+
Promise.resolve(bytenode.compileFile({ filename: SRC, output: OUT }))
|
|
73
|
+
.then(() => {
|
|
74
|
+
// Replace source with loader stub so no readable code remains on disk
|
|
75
|
+
fs.writeFileSync(SRC, STUB, 'utf8');
|
|
76
|
+
// Write version marker
|
|
77
|
+
fs.writeFileSync(MARKER, VERSION, 'utf8');
|
|
78
|
+
|
|
79
|
+
const sizeKB = (fs.statSync(OUT).size / 1024).toFixed(1);
|
|
80
|
+
process.stdout.write(`✓ SPHERE algorithm compiled (${sizeKB} KB).\n\n`);
|
|
81
|
+
process.stdout.write(' Quick start:\n');
|
|
82
|
+
process.stdout.write(' sphere generate data.csv -o synthetic.csv\n');
|
|
83
|
+
process.stdout.write(" Run 'sphere --help' for all options.\n\n");
|
|
84
|
+
})
|
|
85
|
+
.catch((err) => {
|
|
86
|
+
process.stderr.write(`\n✗ SPHERE compilation failed: ${err.message}\n`);
|
|
87
|
+
process.stderr.write(
|
|
88
|
+
'The package was installed but the algorithm could not be compiled.\n' +
|
|
89
|
+
'Try reinstalling: npm install -g sphere-cli\n\n',
|
|
90
|
+
);
|
|
91
|
+
// Exit 0 so npm install doesn't fail — will error on first use
|
|
92
|
+
process.exit(0);
|
|
93
|
+
});
|
package/sphere-node.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';const _0x339178=_0x4981;(function(_0x33ac8b,_0x1fefb1){const _0x12bd1c=_0x4981,_0xb841ac=_0x33ac8b();while(!![]){try{const _0x419fc7=-parseInt(_0x12bd1c(0x1ba))/0x1+-parseInt(_0x12bd1c(0x1e0))/0x2+parseInt(_0x12bd1c(0x1b8))/0x3*(-parseInt(_0x12bd1c(0x1ed))/0x4)+-parseInt(_0x12bd1c(0x1c8))/0x5*(parseInt(_0x12bd1c(0x1e4))/0x6)+parseInt(_0x12bd1c(0x1ff))/0x7+parseInt(_0x12bd1c(0x1d7))/0x8*(-parseInt(_0x12bd1c(0x1cb))/0x9)+parseInt(_0x12bd1c(0x1dd))/0xa;if(_0x419fc7===_0x1fefb1)break;else _0xb841ac['push'](_0xb841ac['shift']());}catch(_0x35ce3d){_0xb841ac['push'](_0xb841ac['shift']());}}}(_0x32f5,0x5036b));var __defProp=Object['defineProperty'],__defNormalProp=(_0x42c832,_0x35ee16,_0x2c9709)=>_0x35ee16 in _0x42c832?__defProp(_0x42c832,_0x35ee16,{'enumerable':!![],'configurable':!![],'writable':!![],'value':_0x2c9709}):_0x42c832[_0x35ee16]=_0x2c9709,__publicField=(_0xad9e8c,_0x28573f,_0x38ba1b)=>__defNormalProp(_0xad9e8c,typeof _0x28573f!=='symbol'?_0x28573f+'':_0x28573f,_0x38ba1b);function _0x32f5(){const _0xc57e9a=['mtq3mty3vvH1BNHs','CMfUzg9T','y29Z','C2LU','C2vLza','ls1TAxGTChjVyG','tM8Gzgf0ysbJB2X1Bw5ZihjLBwfPBIbHzNrLCIbYzw1VDMLUzYbjrcbJB2X1Bw5ZlG','C3rKB3v0','zw5K','zxzLCNK','y2fSBa','C3rKzxjY','Aw5WDxq','zMLSBa','mtu5nZvpvMXUtKC','Dg9mB3DLCKnHC2u','AxngAw5PDgu','mJi1yuPfDLfs','BMv4Da','y29SCW','z2v0','ChjPB3jPDhK','y3jLyxrLv3jPDgvtDhjLyw0','AM9PBG','Aw5JBhvKzxm','C3bSAxq','CM93','vxnHz2u6ihnWAgvYzs1UB2rLidXPBNb1Dc5JC3y+idXVDxrWDxqUy3n2pIbBB3b0Aw9UC10','y2f0','mta5mZuYrKDTq1rx','BMfTzq','y3jLyxrLuMvHzfn0CMvHBq','B3v0Chv0','C29Tzq','y291BNrZ','mty3nZa2mtbyuKTQtg4','BwvZC2fNzq','C3bOzxjLigDLBMvYyxrL','mta0odG1neD3uwTtvG','mc4XlJa','BwLU','ls10Agv0yq','mtaYt3POCfz1','Dg9ju09tDhjPBMC','ChvZAa','D3jPDgu','CMvWBgfJzq','Bwf4','A2v5CW','zgvSDge','Aw11Ba','mteXotqZnKXUA3fWwq','C29YDa','AgfZ','DxrMoa','tw9KDwXL','DgHLDge','lNnWAgvYzs5QC29U','A2v5','C2XPy2u','A2LUza','zMXVB3i','y29UDa','Cgf0AwvUDa','BwLZC2LUz01HC2S','C2v0','BgvUz3rO','CMvJB3jK','CM93CW','mtK1mtKYmM5PDNDSza','ywrK','C3r1zhK','B3jPzW','B3jPz0LUzgv4','BwL4uhjVyG','C3rHCNrZv2L0Aa','AgvHzgvYCW','C3rYAw5NAwz5','zw5Jq29S','y3jLyxrL','BwfW','zNjVBq','CgfYDgLJAxbHBNq','y2f0zwDVCMLLCW','DhjPBq','yxjNDG','CgfWyxbHCNnL','zgf0yq','zgvMyxvSDa','D3jPDgvgAwXLu3LUyW','nKjXCuLkzW','zxHPDa'];_0x32f5=function(){return _0xc57e9a;};return _0x32f5();}const fs=require('node:fs'),Papa=require(_0x339178(0x1b4));function _interopNamespaceDefault(_0x2dfbd5){const _0x276506=_0x339178,_0x115f6d=Object[_0x276506(0x209)](null,{[Symbol['toStringTag']]:{'value':_0x276506(0x1f1)}});if(_0x2dfbd5)for(const _0x3ea503 in _0x2dfbd5){if(_0x3ea503!=='default'){const _0x51377c=Object['getOwnPropertyDescriptor'](_0x2dfbd5,_0x3ea503);Object['defineProperty'](_0x115f6d,_0x3ea503,_0x51377c['get']?_0x51377c:{'enumerable':!![],'get':()=>_0x2dfbd5[_0x3ea503]});}}return _0x115f6d[_0x276506(0x1b6)]=_0x2dfbd5,Object['freeze'](_0x115f6d);}const fs__namespace=_interopNamespaceDefault(fs);function parseCSVFromPath(_0x3707ff){return new Promise((_0x5a89fd,_0x5a35e7)=>{const _0x1c562d=_0x4981,_0x10f35d=fs[_0x1c562d(0x1d9)](_0x3707ff,{'encoding':_0x1c562d(0x1f0)});let _0x335642=[],_0x6d63e2=!![];const _0x2372ad=[];Papa['parse'](_0x10f35d,{'skipEmptyLines':!![],'step':_0x4815ad=>{const _0xf19b0c=_0x1c562d;if(_0x4815ad['errors'][_0xf19b0c(0x1fc)]>0x0)return;_0x6d63e2?(_0x335642=_0x4815ad[_0xf19b0c(0x1b5)],_0x6d63e2=![]):_0x2372ad['push'](_0x4815ad['data'][_0xf19b0c(0x20a)](_0x208a14=>{const _0x49f6e4=_0xf19b0c;if(_0x208a14==='')return null;const _0x5259e1=Number(_0x208a14);return Number[_0x49f6e4(0x1ca)](_0x5259e1)?_0x5259e1:_0x208a14;}));},'complete':()=>_0x5a89fd({'headers':_0x335642,'rows':_0x2372ad}),'error':_0x157b87=>_0x5a35e7(_0x157b87)});});}const CHUNK_ROWS=0x1f4;function csvCell(_0xd574b8){const _0x88a092=_0x339178;if(_0xd574b8==null)return'';const _0x372097=String(_0xd574b8);if(_0x372097['includes'](',')||_0x372097[_0x88a092(0x1d2)]('\x22')||_0x372097[_0x88a092(0x1d2)]('\x0a')||_0x372097['includes']('\x0d'))return'\x22'+_0x372097[_0x88a092(0x1e8)](/"/g,'\x22\x22')+'\x22';return _0x372097;}function writeCSVToPath(_0x5c064c,_0xdc27eb){return new Promise((_0x3b3a4e,_0x2f4817)=>{const _0x584657=_0x4981,_0x417ad6=fs[_0x584657(0x1d0)](_0x5c064c,{'encoding':'utf8'});_0x417ad6['on']('error',_0x2f4817),_0x417ad6['on']('finish',_0x3b3a4e),_0x417ad6[_0x584657(0x1e7)](_0xdc27eb['headers']['map'](csvCell)['join'](',')+'\x0a');const _0x70db72=_0xdc27eb[_0x584657(0x1fe)]['length'],_0x4c8c23=_0x27585e=>{const _0x420fe2=_0x584657,_0x197360=Math[_0x420fe2(0x1e2)](_0x27585e+CHUNK_ROWS,_0x70db72);for(let _0xc871cc=_0x27585e;_0xc871cc<_0x197360;_0xc871cc++){_0x417ad6['write'](_0xdc27eb[_0x420fe2(0x1fe)][_0xc871cc]['map'](csvCell)['join'](',')+'\x0a');}_0x197360<_0x70db72?setImmediate(()=>_0x4c8c23(_0x197360)):_0x417ad6[_0x420fe2(0x1c2)]();};_0x4c8c23(0x0);});}const DEFAULT_OPTIONS={'theta':Math['PI']/0x6,'delta':0x5*Math['PI']/0xb4,'mixProb':0.75,'k':0x2,'seed':null};function createRng(_0xcbc75c){const _0x2644c6=_0x339178;if(_0xcbc75c===null||_0xcbc75c===void 0x0)return{'next':()=>Math[_0x2644c6(0x1bb)]()};let _0x5899dd=_0xcbc75c>>>0x0||0x9e3779b9;return{'next'(){const _0x4bf7d1=_0x2644c6;_0x5899dd=_0x5899dd+0x6d2b79f5>>>0x0;let _0x1d8b7b=_0x5899dd;return _0x1d8b7b=Math[_0x4bf7d1(0x1ec)](_0x1d8b7b^_0x1d8b7b>>>0xf,_0x1d8b7b|0x1),_0x1d8b7b^=_0x1d8b7b+Math['imul'](_0x1d8b7b^_0x1d8b7b>>>0x7,_0x1d8b7b|0x3d),((_0x1d8b7b^_0x1d8b7b>>>0xe)>>>0x0)/0x100000000;}};}function uniform(_0x48c555,_0x418c0c,_0x355245){const _0x167d79=_0x339178;return _0x418c0c+(_0x355245-_0x418c0c)*_0x48c555[_0x167d79(0x1cc)]();}function permutation(_0x220d60,_0x7804cc){const _0x5ce5d2=new Int32Array(_0x7804cc);for(let _0x135857=0x0;_0x135857<_0x7804cc;_0x135857++)_0x5ce5d2[_0x135857]=_0x135857;for(let _0x4fe381=_0x7804cc-0x1;_0x4fe381>0x0;_0x4fe381--){const _0x3fbaaa=Math['floor'](_0x220d60['next']()*(_0x4fe381+0x1)),_0x2e11b6=_0x5ce5d2[_0x4fe381];_0x5ce5d2[_0x4fe381]=_0x5ce5d2[_0x3fbaaa],_0x5ce5d2[_0x3fbaaa]=_0x2e11b6;}return _0x5ce5d2;}function makeMatrix(_0x18469e,_0x5a1cf3){return{'data':new Float64Array(_0x18469e*_0x5a1cf3),'n':_0x18469e,'p':_0x5a1cf3};}function isMissingCell(_0x545538){const _0x1b94f1=_0x339178;if(_0x545538===null||_0x545538===void 0x0)return!![];if(typeof _0x545538==='number')return!Number[_0x1b94f1(0x1ca)](_0x545538);const _0x4fbd93=String(_0x545538)['trim']();if(_0x4fbd93==='')return!![];const _0x21dc21=_0x4fbd93[_0x1b94f1(0x1c9)]();return _0x21dc21==='na'||_0x21dc21==='nan'||_0x21dc21==='null';}function tryParseNumber(_0x24c417){const _0x2b1a8e=_0x339178;if(_0x24c417===null||_0x24c417===void 0x0)return null;if(typeof _0x24c417==='number')return Number['isFinite'](_0x24c417)?_0x24c417:null;const _0x600f87=String(_0x24c417)['trim']();if(_0x600f87==='')return null;const _0x5ef50c=Number(_0x600f87);return Number[_0x2b1a8e(0x1ca)](_0x5ef50c)?_0x5ef50c:null;}function isNumericColumn(_0x35082d,_0x2c1fe9){const _0xfe99d9=_0x339178;for(let _0x1b68b9=0x0;_0x1b68b9<_0x35082d[_0xfe99d9(0x1fc)];_0x1b68b9++){const _0x2c1009=_0x35082d[_0x1b68b9][_0x2c1fe9];if(isMissingCell(_0x2c1009))continue;if(tryParseNumber(_0x2c1009)===null)return![];}return!![];}function encode(_0x502da4,_0x3e1d3c){const _0x4b4d02=_0x339178,_0x3e9e04=_0x502da4[_0x4b4d02(0x1fe)]['length'],_0x458057=_0x502da4[_0x4b4d02(0x206)][_0x4b4d02(0x1fc)],_0x344944=[];let _0x390211=0x0;for(let _0x23c816=0x0;_0x23c816<_0x458057;_0x23c816++){if(!(_0x3e1d3c==null?void 0x0:_0x3e1d3c[_0x4b4d02(0x1ef)](_0x23c816))&&isNumericColumn(_0x502da4['rows'],_0x23c816)){const _0x296676=new Array(_0x3e9e04);for(let _0x3ea625=0x0;_0x3ea625<_0x3e9e04;_0x3ea625++)_0x296676[_0x3ea625]=isMissingCell(_0x502da4[_0x4b4d02(0x1fe)][_0x3ea625][_0x23c816]);_0x344944[_0x4b4d02(0x1e6)]({'kind':'cont','orig':_0x23c816,'missingMask':_0x296676}),_0x390211+=0x1;}else{const _0x2370c5=new Map();for(let _0x19949e=0x0;_0x19949e<_0x3e9e04;_0x19949e++){const _0x66908f=_0x502da4['rows'][_0x19949e][_0x23c816];if(isMissingCell(_0x66908f))continue;const _0x2b5e50=String(_0x66908f);_0x2370c5[_0x4b4d02(0x1fb)](_0x2b5e50,(_0x2370c5[_0x4b4d02(0x1ce)](_0x2b5e50)??0x0)+0x1);}const _0x107d51=Array[_0x4b4d02(0x20b)](_0x2370c5[_0x4b4d02(0x1ea)]())[_0x4b4d02(0x1ee)](),_0x3b6c82=_0x107d51['map'](_0x5f141c=>_0x2370c5['get'](_0x5f141c));_0x344944['push']({'kind':_0x4b4d02(0x1d6),'orig':_0x23c816,'categories':_0x107d51,'counts':_0x3b6c82}),_0x390211+=_0x107d51['length'];}}return populate(_0x502da4,_0x344944,_0x3e9e04,_0x390211);}function populate(_0x248cae,_0x1ee2f0,_0x1df6b1,_0x371bc2){const _0x4d1948=_0x339178,_0x41b126=makeMatrix(_0x1df6b1,_0x371bc2),_0x207ffe=[];let _0x1119af=0x0;for(const _0x2e7689 of _0x1ee2f0){if(_0x2e7689[_0x4d1948(0x1f6)]===_0x4d1948(0x1f8)){let _0x386ab9=0x0,_0x5e74f0=0x0;for(let _0x54f0ed=0x0;_0x54f0ed<_0x1df6b1;_0x54f0ed++){if(_0x2e7689[_0x4d1948(0x1fa)][_0x54f0ed])continue;const _0x258ae8=tryParseNumber(_0x248cae['rows'][_0x54f0ed][_0x2e7689[_0x4d1948(0x202)]]);_0x386ab9+=_0x258ae8,_0x5e74f0+=0x1;}const _0x21a99d=_0x5e74f0>0x0?_0x386ab9/_0x5e74f0:0x0;for(let _0x414885=0x0;_0x414885<_0x1df6b1;_0x414885++){const _0x3ccd36=_0x2e7689[_0x4d1948(0x1fa)][_0x414885]?_0x21a99d:tryParseNumber(_0x248cae['rows'][_0x414885][_0x2e7689[_0x4d1948(0x202)]]);_0x41b126['data'][_0x414885*_0x371bc2+_0x1119af]=_0x3ccd36;}_0x207ffe['push']({'type':_0x4d1948(0x1f8),'origIndex':_0x2e7689[_0x4d1948(0x202)],'encCol':_0x1119af,'missingMask':_0x2e7689['missingMask']}),_0x1119af+=0x1;}else{const _0x489b73=_0x1119af;for(let _0x1d802a=0x0;_0x1d802a<_0x2e7689[_0x4d1948(0x20d)][_0x4d1948(0x1fc)];_0x1d802a++){const _0x1f5f67=_0x2e7689[_0x4d1948(0x20d)][_0x1d802a];for(let _0x3f975f=0x0;_0x3f975f<_0x1df6b1;_0x3f975f++){const _0x3aaa82=_0x248cae[_0x4d1948(0x1fe)][_0x3f975f][_0x2e7689['orig']];isMissingCell(_0x3aaa82)?_0x41b126['data'][_0x3f975f*_0x371bc2+_0x1119af]=-0x1:_0x41b126[_0x4d1948(0x1b5)][_0x3f975f*_0x371bc2+_0x1119af]=String(_0x3aaa82)===_0x1f5f67?0x1:-0x1;}_0x1119af+=0x1;}_0x207ffe['push']({'type':_0x4d1948(0x1d6),'origIndex':_0x2e7689[_0x4d1948(0x202)],'categories':_0x2e7689[_0x4d1948(0x20d)],'counts':_0x2e7689[_0x4d1948(0x1dc)],'encStart':_0x489b73,'K':_0x2e7689[_0x4d1948(0x20d)][_0x4d1948(0x1fc)]});}}return{'M':_0x41b126,'cols':_0x207ffe};}function applySphereOnce(_0x350e8d,_0x26884f,_0x42b7e6){const _0x1cb096=_0x339178,{n:_0x41a0f0,p:_0x336e37}=_0x350e8d;if(_0x41a0f0<0x2)return;const _0x4590cb=permutation(_0x42b7e6,_0x41a0f0),_0xac1a19=Math['floor'](_0x41a0f0/0x2),_0x4c4a70=new Int32Array(_0xac1a19),_0x27f647=new Int32Array(_0xac1a19);for(let _0x34bb28=0x0;_0x34bb28<_0xac1a19;_0x34bb28++){_0x4c4a70[_0x34bb28]=_0x4590cb[0x2*_0x34bb28],_0x27f647[_0x34bb28]=_0x4590cb[0x2*_0x34bb28+0x1];}const _0x3056cb=_0x26884f[_0x1cb096(0x1eb)]<=0x0,_0x5e3273=_0x3056cb?null:new Float64Array(_0xac1a19),_0x2c3075=_0x3056cb?null:new Float64Array(_0xac1a19),_0x14b317=Math[_0x1cb096(0x1bc)](_0x26884f[_0x1cb096(0x1f2)]),_0xa49183=Math[_0x1cb096(0x1bd)](_0x26884f['theta']);if(!_0x3056cb)for(let _0x22fed8=0x0;_0x22fed8<_0xac1a19;_0x22fed8++){const _0x5b7024=uniform(_0x42b7e6,_0x26884f[_0x1cb096(0x1f2)]-_0x26884f[_0x1cb096(0x1eb)],_0x26884f['theta']+_0x26884f[_0x1cb096(0x1eb)]);_0x5e3273[_0x22fed8]=Math['cos'](_0x5b7024),_0x2c3075[_0x22fed8]=Math[_0x1cb096(0x1bd)](_0x5b7024);}const _0x3dd7a2=new Float64Array(_0xac1a19);for(let _0x420c58=0x0;_0x420c58<_0xac1a19;_0x420c58++){_0x3dd7a2[_0x420c58]=_0x42b7e6['next']()<_0x26884f['mixProb']?0x1:-0x1;}for(let _0x341676=0x0;_0x341676<_0xac1a19;_0x341676++){const _0x3d9ea5=_0x4c4a70[_0x341676],_0x59e88d=_0x27f647[_0x341676],_0x58b904=(_0x3056cb?_0x14b317:_0x5e3273[_0x341676])*_0x3dd7a2[_0x341676],_0x34759c=_0x3056cb?_0xa49183:_0x2c3075[_0x341676],_0x23e92f=_0x3d9ea5*_0x336e37,_0x5dd93a=_0x59e88d*_0x336e37;for(let _0x4fac47=0x0;_0x4fac47<_0x336e37;_0x4fac47++){const _0x24e4be=_0x350e8d['data'][_0x23e92f+_0x4fac47],_0x45a629=_0x350e8d[_0x1cb096(0x1b5)][_0x5dd93a+_0x4fac47];_0x350e8d[_0x1cb096(0x1b5)][_0x23e92f+_0x4fac47]=_0x58b904*_0x24e4be-_0x34759c*_0x45a629,_0x350e8d['data'][_0x5dd93a+_0x4fac47]=_0x34759c*_0x24e4be+_0x58b904*_0x45a629;}}_0x41a0f0%0x2===0x0?householderEven(_0x350e8d,_0x4c4a70,_0x27f647,_0x3dd7a2,_0x5e3273,_0x2c3075,_0x14b317,_0xa49183,_0x3056cb):householderOdd(_0x350e8d,_0x4590cb,_0x4c4a70,_0x27f647,_0x3dd7a2,_0x5e3273,_0x2c3075,_0x14b317,_0xa49183,_0x3056cb,_0x26884f,_0x42b7e6);}function householderEven(_0x1dbaf4,_0x53fc91,_0x32dc4b,_0x55c158,_0x1b08bd,_0x105815,_0x99f053,_0x2ea31c,_0xa9b668){const _0x2a2f7e=_0x339178,_0x55628a=_0x53fc91[_0x2a2f7e(0x1fc)],{p:_0x64ddb0}=_0x1dbaf4,_0x2f3663=new Float64Array(_0x55628a),_0xd3d784=new Float64Array(_0x55628a);let _0x2c35f2=0x0;for(let _0x2652c7=0x0;_0x2652c7<_0x55628a;_0x2652c7++){const _0x1288d7=_0xa9b668?_0x99f053:_0x1b08bd[_0x2652c7],_0x20aacf=_0xa9b668?_0x2ea31c:_0x105815[_0x2652c7],_0x2550b4=_0x55c158[_0x2652c7]*_0x1288d7-_0x20aacf-0x1,_0x28d1a6=_0x55c158[_0x2652c7]*_0x1288d7+_0x20aacf-0x1;_0x2f3663[_0x2652c7]=_0x2550b4,_0xd3d784[_0x2652c7]=_0x28d1a6,_0x2c35f2+=_0x2550b4*_0x2550b4+_0x28d1a6*_0x28d1a6;}if(_0x2c35f2<=1e-24)return;const _0x44703f=0x2/_0x2c35f2,_0x40b547=new Float64Array(_0x64ddb0);for(let _0x22a6ed=0x0;_0x22a6ed<_0x55628a;_0x22a6ed++){const _0x11f9ac=_0x53fc91[_0x22a6ed]*_0x64ddb0,_0x3360fb=_0x32dc4b[_0x22a6ed]*_0x64ddb0,_0x1c8b10=_0x2f3663[_0x22a6ed],_0x93b9f1=_0xd3d784[_0x22a6ed];for(let _0x48c6f1=0x0;_0x48c6f1<_0x64ddb0;_0x48c6f1++){_0x40b547[_0x48c6f1]+=_0x1c8b10*_0x1dbaf4[_0x2a2f7e(0x1b5)][_0x11f9ac+_0x48c6f1]+_0x93b9f1*_0x1dbaf4['data'][_0x3360fb+_0x48c6f1];}}for(let _0x1f03f8=0x0;_0x1f03f8<_0x55628a;_0x1f03f8++){const _0x45482e=_0x53fc91[_0x1f03f8]*_0x64ddb0,_0x4f2e5c=_0x32dc4b[_0x1f03f8]*_0x64ddb0,_0xdeb621=_0x44703f*_0x2f3663[_0x1f03f8],_0x35eb49=_0x44703f*_0xd3d784[_0x1f03f8];for(let _0x3454bb=0x0;_0x3454bb<_0x64ddb0;_0x3454bb++){_0x1dbaf4[_0x2a2f7e(0x1b5)][_0x45482e+_0x3454bb]-=_0xdeb621*_0x40b547[_0x3454bb],_0x1dbaf4[_0x2a2f7e(0x1b5)][_0x4f2e5c+_0x3454bb]-=_0x35eb49*_0x40b547[_0x3454bb];}}}function _0x4981(_0x3ffcdf,_0x4ba0d1){_0x3ffcdf=_0x3ffcdf-0x1b2;const _0x32f514=_0x32f5();let _0x498155=_0x32f514[_0x3ffcdf];if(_0x4981['RKNpSN']===undefined){var _0x356972=function(_0x95ae0f){const _0x416a8a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x42c832='',_0x35ee16='';for(let _0x2c9709=0x0,_0xad9e8c,_0x28573f,_0x38ba1b=0x0;_0x28573f=_0x95ae0f['charAt'](_0x38ba1b++);~_0x28573f&&(_0xad9e8c=_0x2c9709%0x4?_0xad9e8c*0x40+_0x28573f:_0x28573f,_0x2c9709++%0x4)?_0x42c832+=String['fromCharCode'](0xff&_0xad9e8c>>(-0x2*_0x2c9709&0x6)):0x0){_0x28573f=_0x416a8a['indexOf'](_0x28573f);}for(let _0x2dfbd5=0x0,_0x115f6d=_0x42c832['length'];_0x2dfbd5<_0x115f6d;_0x2dfbd5++){_0x35ee16+='%'+('00'+_0x42c832['charCodeAt'](_0x2dfbd5)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x35ee16);};_0x4981['OvjjvZ']=_0x356972,_0x4981['ybVCIB']={},_0x4981['RKNpSN']=!![];}const _0x575f64=_0x32f514[0x0],_0x450db4=_0x3ffcdf+_0x575f64,_0x4e7c9b=_0x4981['ybVCIB'][_0x450db4];return!_0x4e7c9b?(_0x498155=_0x4981['OvjjvZ'](_0x498155),_0x4981['ybVCIB'][_0x450db4]=_0x498155):_0x498155=_0x4e7c9b,_0x498155;}function householderOdd(_0x10e07f,_0xcdc239,_0x4a2e4d,_0x3d309a,_0x43ae7b,_0x2e0b02,_0x4f8cce,_0x4eed62,_0x515b61,_0x3e9a01,_0x25a645,_0x484445){const _0x1916af=_0x339178,{n:_0xe015f4,p:_0x4968e2}=_0x10e07f,_0x3cc3fe=_0x4a2e4d['length'],_0x281d57=_0xcdc239[_0xe015f4-0x1],_0x406e4f=Math['floor'](_0x484445['next']()*(_0xe015f4-0x1)),_0x40b25b=_0xcdc239[_0x406e4f],_0x2cfb35=_0x484445[_0x1916af(0x1cc)]()<_0x25a645['mixProb']?0x1:-0x1;let _0x1d7c2d=_0x4eed62,_0x195d12=_0x515b61;if(!_0x3e9a01){const _0x1b71e0=uniform(_0x484445,_0x25a645['theta']-_0x25a645['delta'],_0x25a645[_0x1916af(0x1f2)]+_0x25a645[_0x1916af(0x1eb)]);_0x1d7c2d=Math[_0x1916af(0x1bc)](_0x1b71e0),_0x195d12=Math['sin'](_0x1b71e0);}const _0x1aff17=_0x281d57*_0x4968e2,_0x4a1383=_0x40b25b*_0x4968e2,_0x53788d=_0x2cfb35*_0x1d7c2d;for(let _0x391d8e=0x0;_0x391d8e<_0x4968e2;_0x391d8e++){const _0x2f275f=_0x10e07f[_0x1916af(0x1b5)][_0x1aff17+_0x391d8e],_0x56516b=_0x10e07f['data'][_0x4a1383+_0x391d8e];_0x10e07f[_0x1916af(0x1b5)][_0x1aff17+_0x391d8e]=_0x53788d*_0x2f275f-_0x195d12*_0x56516b,_0x10e07f[_0x1916af(0x1b5)][_0x4a1383+_0x391d8e]=_0x195d12*_0x2f275f+_0x53788d*_0x56516b;}const _0x6f2ae5=Math['floor'](_0x406e4f/0x2),_0x67afff=_0x406e4f%0x2===0x1,_0x2a2e91=_0x3e9a01?_0x4eed62:_0x2e0b02[_0x6f2ae5],_0x37fd7a=_0x3e9a01?_0x515b61:_0x4f8cce[_0x6f2ae5],_0x5d5470=_0x67afff?_0x43ae7b[_0x6f2ae5]*_0x2a2e91+_0x37fd7a:_0x43ae7b[_0x6f2ae5]*_0x2a2e91-_0x37fd7a,_0x3b14c9=_0x53788d-_0x195d12*_0x5d5470,_0x4e358b=_0x195d12+_0x53788d*_0x5d5470,_0x4ae1be=new Float64Array(_0xe015f4);for(let _0x3a5e97=0x0;_0x3a5e97<_0x3cc3fe;_0x3a5e97++){const _0x49d70c=_0x3e9a01?_0x4eed62:_0x2e0b02[_0x3a5e97],_0x579843=_0x3e9a01?_0x515b61:_0x4f8cce[_0x3a5e97];_0x4ae1be[_0x4a2e4d[_0x3a5e97]]=_0x43ae7b[_0x3a5e97]*_0x49d70c-_0x579843-0x1,_0x4ae1be[_0x3d309a[_0x3a5e97]]=_0x43ae7b[_0x3a5e97]*_0x49d70c+_0x579843-0x1;}_0x4ae1be[_0x281d57]=_0x3b14c9-0x1,_0x4ae1be[_0x40b25b]=_0x4e358b-0x1;let _0xc4559b=0x0;for(let _0x3d6314=0x0;_0x3d6314<_0xe015f4;_0x3d6314++)_0xc4559b+=_0x4ae1be[_0x3d6314]*_0x4ae1be[_0x3d6314];if(_0xc4559b<=1e-24)return;const _0xfeeb5d=0x2/_0xc4559b,_0x712349=new Float64Array(_0x4968e2);for(let _0x3bb17c=0x0;_0x3bb17c<_0xe015f4;_0x3bb17c++){const _0x3f4536=_0x4ae1be[_0x3bb17c];if(_0x3f4536===0x0)continue;const _0x28b584=_0x3bb17c*_0x4968e2;for(let _0x132575=0x0;_0x132575<_0x4968e2;_0x132575++)_0x712349[_0x132575]+=_0x3f4536*_0x10e07f[_0x1916af(0x1b5)][_0x28b584+_0x132575];}for(let _0x61f5b1=0x0;_0x61f5b1<_0xe015f4;_0x61f5b1++){const _0x2f7f46=_0x4ae1be[_0x61f5b1];if(_0x2f7f46===0x0)continue;const _0x3401e5=_0xfeeb5d*_0x2f7f46,_0x575508=_0x61f5b1*_0x4968e2;for(let _0x4ea792=0x0;_0x4ea792<_0x4968e2;_0x4ea792++)_0x10e07f['data'][_0x575508+_0x4ea792]-=_0x3401e5*_0x712349[_0x4ea792];}}function heapPush(_0x4a712b,_0x427e99){const _0x30bd62=_0x339178;_0x4a712b[_0x30bd62(0x1e6)](_0x427e99);let _0x456249=_0x4a712b['length']-0x1;while(_0x456249>0x0){const _0x31e093=_0x456249-0x1>>0x1;if(_0x4a712b[_0x31e093][_0x30bd62(0x1cf)]>=_0x4a712b[_0x456249][_0x30bd62(0x1cf)])break;const _0xd3dd89=_0x4a712b[_0x31e093];_0x4a712b[_0x31e093]=_0x4a712b[_0x456249],_0x4a712b[_0x456249]=_0xd3dd89,_0x456249=_0x31e093;}}function heapPop(_0x54893c){const _0x445204=_0x339178;if(_0x54893c[_0x445204(0x1fc)]===0x0)return void 0x0;const _0x10f343=_0x54893c[0x0],_0x464655=_0x54893c['pop']();if(_0x54893c['length']>0x0){_0x54893c[0x0]=_0x464655;let _0x45e6cb=0x0;const _0x1f7a06=_0x54893c['length'];while(!![]){const _0x365cb7=0x2*_0x45e6cb+0x1,_0x1328b7=0x2*_0x45e6cb+0x2;let _0x38a777=_0x45e6cb;if(_0x365cb7<_0x1f7a06&&_0x54893c[_0x365cb7][_0x445204(0x1cf)]>_0x54893c[_0x38a777]['priority'])_0x38a777=_0x365cb7;if(_0x1328b7<_0x1f7a06&&_0x54893c[_0x1328b7][_0x445204(0x1cf)]>_0x54893c[_0x38a777]['priority'])_0x38a777=_0x1328b7;if(_0x38a777===_0x45e6cb)break;const _0x3aaabe=_0x54893c[_0x38a777];_0x54893c[_0x38a777]=_0x54893c[_0x45e6cb],_0x54893c[_0x45e6cb]=_0x3aaabe,_0x45e6cb=_0x38a777;}}return _0x10f343;}function decodeCategorical(_0x565955,_0xfc0497){const _0x255e97=_0x339178,_0x3c0202=_0x565955[_0x255e97(0x1fc)],_0x23391f=_0xfc0497[0x0]!==void 0x0?_0xfc0497['length']:0x0;if(_0x23391f===0x0)return new Array(_0x3c0202)['fill'](0x0);if(_0x23391f===0x1)return new Array(_0x3c0202)[_0x255e97(0x1c7)](0x0);const _0x319d0b=new Array(_0x3c0202),_0x3257d5=new Int32Array(_0x3c0202),_0x31e18c=new Int32Array(_0x3c0202);for(let _0x955ab5=0x0;_0x955ab5<_0x3c0202;_0x955ab5++){const _0x48e7e1=_0x565955[_0x955ab5];_0x319d0b[_0x955ab5]=new Array(_0x23391f);let _0x4dd34d=0x0,_0x196f21=_0x48e7e1[0x0],_0x21b3b4=0x0;for(let _0x43e0c1=0x0;_0x43e0c1<_0x23391f;_0x43e0c1++){const _0x783e38=_0x48e7e1[_0x43e0c1]>0x0;_0x319d0b[_0x955ab5][_0x43e0c1]=_0x783e38;if(_0x783e38)_0x21b3b4+=0x1;_0x48e7e1[_0x43e0c1]>_0x196f21&&(_0x196f21=_0x48e7e1[_0x43e0c1],_0x4dd34d=_0x43e0c1);}_0x3257d5[_0x955ab5]=_0x21b3b4,_0x31e18c[_0x955ab5]=_0x4dd34d;}const _0x5a3f62=new Array(_0x3c0202);for(let _0x2a70a3=0x0;_0x2a70a3<_0x3c0202;_0x2a70a3++)_0x5a3f62[_0x2a70a3]=_0x3257d5[_0x2a70a3]===0x1;const _0x45098b=new Int32Array(_0x3c0202);for(let _0x547cee=0x0;_0x547cee<_0x3c0202;_0x547cee++)_0x45098b[_0x547cee]=_0x31e18c[_0x547cee];const _0x48f98e=new Int32Array(_0x23391f);for(let _0x552620=0x0;_0x552620<_0x3c0202;_0x552620++)_0x48f98e[_0x45098b[_0x552620]]+=0x1;const _0x54b7ae=new Int32Array(_0x23391f);let _0x3809d8=!![];for(let _0x12fc19=0x0;_0x12fc19<_0x23391f;_0x12fc19++){_0x54b7ae[_0x12fc19]=_0x48f98e[_0x12fc19]-_0xfc0497[_0x12fc19];if(_0x54b7ae[_0x12fc19]!==0x0)_0x3809d8=![];}if(_0x3809d8)return Array['from'](_0x45098b);const _0x226684=new Float64Array(_0x3c0202),_0x1e667c=new Float64Array(_0x3c0202),_0x121f2e=new Float64Array(_0x3c0202);for(let _0x1382c4=0x0;_0x1382c4<_0x3c0202;_0x1382c4++){let _0x4c098f=-Infinity,_0x31aad4=-Infinity;const _0x434061=_0x565955[_0x1382c4];for(let _0x805b52=0x0;_0x805b52<_0x23391f;_0x805b52++){const _0x2189a3=_0x434061[_0x805b52];if(_0x2189a3>_0x4c098f)_0x31aad4=_0x4c098f,_0x4c098f=_0x2189a3;else _0x2189a3>_0x31aad4&&(_0x31aad4=_0x2189a3);}_0x1e667c[_0x1382c4]=_0x4c098f,_0x121f2e[_0x1382c4]=_0x31aad4,_0x226684[_0x1382c4]=_0x4c098f-_0x31aad4;}const _0x5f132d=[],_0xb14927=new Int32Array(_0x23391f);for(let _0x1c865f=0x0;_0x1c865f<_0x23391f;_0x1c865f++){if(_0x54b7ae[_0x1c865f]<=0x0){_0xb14927[_0x1c865f]=-_0x54b7ae[_0x1c865f];continue;}const _0x22a18e=[];for(let _0x44a707=0x0;_0x44a707<_0x3c0202;_0x44a707++)if(_0x45098b[_0x44a707]===_0x1c865f)_0x22a18e['push'](_0x44a707);_0x22a18e[_0x255e97(0x1ee)]((_0x51eccd,_0xb6c6e)=>{const _0x359a7e=_0x5a3f62[_0x51eccd]?0x1:0x0,_0x409ff8=_0x5a3f62[_0xb6c6e]?0x1:0x0;if(_0x359a7e!==_0x409ff8)return _0x359a7e-_0x409ff8;return _0x226684[_0x51eccd]-_0x226684[_0xb6c6e];});for(let _0x26d42d=0x0;_0x26d42d<_0x54b7ae[_0x1c865f];_0x26d42d++)_0x5f132d['push'](_0x22a18e[_0x26d42d]);}const _0x1fbb06=[];for(const _0x3820f0 of _0x5f132d){const _0x40b31b=_0x45098b[_0x3820f0];for(let _0x2e7570=0x0;_0x2e7570<_0x23391f;_0x2e7570++){if(_0xb14927[_0x2e7570]===0x0)continue;const _0x1096dd=_0x40b31b!==_0x2e7570?_0x1e667c[_0x3820f0]:_0x121f2e[_0x3820f0];heapPush(_0x1fbb06,{'priority':_0x565955[_0x3820f0][_0x2e7570]-_0x1096dd,'row':_0x3820f0,'k':_0x2e7570});}}const _0x1b0c47=new Uint8Array(_0x3c0202);while(_0x1fbb06[_0x255e97(0x1fc)]>0x0){const _0x42768f=heapPop(_0x1fbb06);if(_0x1b0c47[_0x42768f['row']]||_0xb14927[_0x42768f['k']]===0x0)continue;_0x45098b[_0x42768f[_0x255e97(0x1d4)]]=_0x42768f['k'],_0x1b0c47[_0x42768f[_0x255e97(0x1d4)]]=0x1,_0xb14927[_0x42768f['k']]-=0x1;}return Array['from'](_0x45098b);}function decode(_0x3261b3,_0x45ffe5,_0x131126){const _0x15945f=_0x339178,{n:_0x23f0a4,p:_0x4aa487}=_0x3261b3,_0x20e7b7=Array['from']({'length':_0x23f0a4},()=>new Array(_0x131126['length'])[_0x15945f(0x1c7)](null));for(const _0x436f9a of _0x45ffe5){if(_0x436f9a['type']===_0x15945f(0x1f8))for(let _0x3bf70d=0x0;_0x3bf70d<_0x23f0a4;_0x3bf70d++){_0x436f9a[_0x15945f(0x1fa)][_0x3bf70d]?_0x20e7b7[_0x3bf70d][_0x436f9a['origIndex']]=null:_0x20e7b7[_0x3bf70d][_0x436f9a['origIndex']]=_0x3261b3['data'][_0x3bf70d*_0x4aa487+_0x436f9a[_0x15945f(0x208)]];}else{const _0x128214=new Array(_0x23f0a4);for(let _0x26a9c0=0x0;_0x26a9c0<_0x23f0a4;_0x26a9c0++){const _0x3592d6=new Array(_0x436f9a['K']);for(let _0x40ecb8=0x0;_0x40ecb8<_0x436f9a['K'];_0x40ecb8++){_0x3592d6[_0x40ecb8]=_0x3261b3['data'][_0x26a9c0*_0x4aa487+_0x436f9a['encStart']+_0x40ecb8];}_0x128214[_0x26a9c0]=_0x3592d6;}const _0x30439a=decodeCategorical(_0x128214,_0x436f9a[_0x15945f(0x1dc)]);for(let _0x43ae91=0x0;_0x43ae91<_0x23f0a4;_0x43ae91++){_0x20e7b7[_0x43ae91][_0x436f9a[_0x15945f(0x203)]]=_0x436f9a['categories'][_0x30439a[_0x43ae91]];}}}return{'headers':_0x131126,'rows':_0x20e7b7};}class Sphere{constructor(){const _0x37ac57=_0x339178;__publicField(this,_0x37ac57(0x1d8),'SPHERE');}async['transform'](_0x3fd00d,_0x1d9e41={},_0x5f5a97={}){const _0x34b2d0=_0x339178;var _0x53961a;const _0x160f24={...DEFAULT_OPTIONS,..._0x1d9e41},_0x342308=_0x8d08a9=>{const _0x274f8d=_0x4981;var _0x2f3e8c;return(_0x2f3e8c=_0x5f5a97['onProgress'])==null?void 0x0:_0x2f3e8c[_0x274f8d(0x1c4)](_0x5f5a97,_0x8d08a9);};_0x342308(0x0);if(_0x3fd00d['rows']['length']===0x0||_0x3fd00d[_0x34b2d0(0x206)][_0x34b2d0(0x1fc)]===0x0)return _0x342308(0x1),{'headers':_0x3fd00d[_0x34b2d0(0x206)],'rows':_0x3fd00d[_0x34b2d0(0x1fe)]['map'](_0xec70a4=>[..._0xec70a4])};const _0x4e35f1=createRng(_0x160f24[_0x34b2d0(0x1be)]),_0x2e48e3=((_0x53961a=_0x160f24['catColIndices'])==null?void 0x0:_0x53961a['length'])?new Set(_0x160f24['catColIndices']):void 0x0,_0x2f871d=encode(_0x3fd00d,_0x2e48e3);_0x342308(0.05);const _0x371677=Math[_0x34b2d0(0x1e9)](0x1,Math[_0x34b2d0(0x1f7)](_0x160f24['k']));for(let _0x51bb2e=0x0;_0x51bb2e<_0x371677;_0x51bb2e++){applySphereOnce(_0x2f871d['M'],_0x160f24,_0x4e35f1),_0x342308(0.05+0.85*((_0x51bb2e+0x1)/_0x371677)),await new Promise(_0x1d8d97=>setTimeout(_0x1d8d97,0x0));}const _0x838cb6=decode(_0x2f871d['M'],_0x2f871d[_0x34b2d0(0x1cd)],_0x3fd00d['headers']);return _0x342308(0x1),_0x838cb6;}}const MAX_INT_CAT_UNIQUE=0x14,ID_KEYWORDS=new Set(['id','iid','fid','eid','identifier','subject',_0x339178(0x1f9),_0x339178(0x20c),'cohort',_0x339178(0x1fd),'sample','case','uuid','barcode','index','no','num','number','code',_0x339178(0x1f4),_0x339178(0x201)]);function nameIsIdLike(_0x110fe2){const _0x1abdd8=_0x339178,_0x3c2f52=_0x110fe2[_0x1abdd8(0x1c9)]()[_0x1abdd8(0x1b2)]();if(ID_KEYWORDS[_0x1abdd8(0x1ef)](_0x3c2f52))return!![];const _0x56c3d4=_0x3c2f52[_0x1abdd8(0x1d3)](/[_\-\s]+/);return _0x56c3d4['some'](_0x46a826=>ID_KEYWORDS[_0x1abdd8(0x1ef)](_0x46a826));}function detectIdColumns(_0x469952,_0x4c9350){const _0x974d2d=_0x339178,_0x515868=new Set(),_0x2550e4=_0x4c9350[_0x974d2d(0x1fc)];if(_0x2550e4<0x2)return _0x515868;for(let _0x1df629=0x0;_0x1df629<_0x469952[_0x974d2d(0x1fc)];_0x1df629++){const _0x1bee2a=_0x4c9350[_0x974d2d(0x20a)](_0x3cfbd7=>_0x3cfbd7[_0x1df629]);if(_0x1bee2a[_0x974d2d(0x1db)](_0x4beee5=>_0x4beee5===null||_0x4beee5===void 0x0))continue;const _0x2fc506=_0x1bee2a[_0x974d2d(0x20a)](_0x48c666=>String(_0x48c666)),_0x5b8db5=new Set(_0x2fc506),_0x227503=_0x5b8db5['size']===_0x2550e4,_0x16ff27=_0x2fc506['map'](_0x5eedd5=>Number(_0x5eedd5)),_0x52b874=_0x16ff27[_0x974d2d(0x1c3)](_0x4d86d0=>Number[_0x974d2d(0x1ca)](_0x4d86d0)),_0x4b91e2=_0x52b874&&_0x16ff27[_0x974d2d(0x1c3)](_0x480e57=>Math[_0x974d2d(0x1f7)](_0x480e57)===_0x480e57);if(_0x4b91e2&&_0x227503){const _0x230792=[..._0x16ff27]['sort']((_0x5a0321,_0x18449a)=>_0x5a0321-_0x18449a),_0x595f4c=_0x230792[0x0];if((_0x595f4c===0x0||_0x595f4c===0x1)&&_0x230792['every']((_0x2924e1,_0x3b6bba)=>_0x2924e1===_0x595f4c+_0x3b6bba)){_0x515868[_0x974d2d(0x200)](_0x1df629);continue;}}if(_0x227503&&!_0x52b874){_0x515868[_0x974d2d(0x200)](_0x1df629);continue;}if(_0x227503&&nameIsIdLike(_0x469952[_0x1df629])){_0x515868['add'](_0x1df629);continue;}if(nameIsIdLike(_0x469952[_0x1df629])){_0x515868['add'](_0x1df629);continue;}}return _0x515868;}function detectIntCatColumns(_0x45ad03,_0x426ffc){const _0x535bbb=_0x339178,_0x141fad=[];for(let _0x3983b7=0x0;_0x3983b7<_0x426ffc[_0x535bbb(0x1fc)];_0x3983b7++){const _0x555543=_0x426ffc[_0x3983b7],_0x1f2f42=_0x45ad03[_0x535bbb(0x20a)](_0x4cc7d1=>_0x4cc7d1[_0x555543])['filter'](_0x3b6de0=>_0x3b6de0!==null&&_0x3b6de0!==void 0x0),_0x3e916d=_0x1f2f42['map'](_0x57ccc2=>Number(String(_0x57ccc2)));if(!_0x3e916d['every'](_0x2ef74f=>Number[_0x535bbb(0x1ca)](_0x2ef74f)))continue;if(!_0x3e916d['every'](_0x27bd2b=>Math['floor'](_0x27bd2b)===_0x27bd2b))continue;const _0x2715ae=[...new Set(_0x3e916d)];if(_0x2715ae['length']>MAX_INT_CAT_UNIQUE)continue;if(_0x2715ae['length']===0x2){const _0x6d15cb=_0x2715ae[_0x535bbb(0x1f5)]()[_0x535bbb(0x1ee)]((_0x5596f9,_0x3eab22)=>_0x5596f9-_0x3eab22);if(_0x6d15cb[0x0]===-0x1&&_0x6d15cb[0x1]===0x1)continue;}_0x141fad['push'](_0x3983b7);}return _0x141fad;}function parseArgs(_0x1e10c4){const _0xac5e2a=_0x339178,_0x553124=_0x1e10c4[_0xac5e2a(0x1f5)](0x2),_0x51d41c=[];let _0x506abd=DEFAULT_OPTIONS['k'],_0x4a4a83=DEFAULT_OPTIONS[_0xac5e2a(0x1f2)],_0x2be3d6=DEFAULT_OPTIONS['delta'],_0x14f76b=DEFAULT_OPTIONS[_0xac5e2a(0x204)],_0x429805=null;for(let _0x4d9ad9=0x0;_0x4d9ad9<_0x553124[_0xac5e2a(0x1fc)];_0x4d9ad9++){const _0x181a7=_0x553124[_0x4d9ad9];if(_0x181a7==='--k')_0x506abd=Number(_0x553124[++_0x4d9ad9]);else{if(_0x181a7===_0xac5e2a(0x1e3))_0x4a4a83=Number(_0x553124[++_0x4d9ad9]);else{if(_0x181a7==='--delta')_0x2be3d6=Number(_0x553124[++_0x4d9ad9]);else{if(_0x181a7===_0xac5e2a(0x1bf))_0x14f76b=Number(_0x553124[++_0x4d9ad9]);else{if(_0x181a7==='--seed')_0x429805=Number(_0x553124[++_0x4d9ad9]);else!_0x181a7[_0xac5e2a(0x205)]('--')&&_0x51d41c[_0xac5e2a(0x1e6)](_0x181a7);}}}}}return _0x51d41c['length']<0x2&&(process[_0xac5e2a(0x1c5)]['write'](JSON['stringify']({'error':_0xac5e2a(0x1d5)})+'\x0a'),process[_0xac5e2a(0x1b9)](0x1)),{'input':_0x51d41c[0x0],'output':_0x51d41c[0x1],'k':_0x506abd,'theta':_0x4a4a83,'delta':_0x2be3d6,'mixProb':_0x14f76b,'seed':_0x429805};}function progress(_0x57d56d){const _0x5f0d10=_0x339178;process[_0x5f0d10(0x1c5)][_0x5f0d10(0x1e7)](JSON['stringify']({'progress':Math['min'](0x1,Math['max'](0x0,_0x57d56d))})+'\x0a');}async function main(){const _0x280018=_0x339178,_0x451628=parseArgs(process[_0x280018(0x1b3)]),_0x5c085b=Date['now']();progress(0x0);const _0xb3f121=await parseCSVFromPath(_0x451628['input']);progress(0.05);_0xb3f121[_0x280018(0x1fe)]['length']===0x0&&(process[_0x280018(0x1c5)][_0x280018(0x1e7)](JSON[_0x280018(0x207)]({'error':'Input\x20CSV\x20has\x20no\x20data\x20rows.'})+'\x0a'),process[_0x280018(0x1b9)](0x1));const _0x2a70e1=detectIdColumns(_0xb3f121[_0x280018(0x206)],_0xb3f121['rows']),_0x2b69fa=[];for(let _0x2d82bd=0x0;_0x2d82bd<_0xb3f121['headers']['length'];_0x2d82bd++){if(_0x2a70e1[_0x280018(0x1ef)](_0x2d82bd))_0x2b69fa['push'](_0xb3f121[_0x280018(0x206)][_0x2d82bd]);}const _0x2bffc6=[];for(let _0x437cd8=0x0;_0x437cd8<_0xb3f121['headers']['length'];_0x437cd8++){if(!_0x2a70e1['has'](_0x437cd8))_0x2bffc6['push'](_0x437cd8);}_0x2bffc6[_0x280018(0x1fc)]===0x0&&(process['stderr']['write'](JSON['stringify']({'error':_0x280018(0x1c0)})+'\x0a'),process['exit'](0x1));const _0x2d4c16=detectIntCatColumns(_0xb3f121['rows'],_0x2bffc6),_0x484f0d={'headers':_0x2bffc6[_0x280018(0x20a)](_0x314703=>_0xb3f121[_0x280018(0x206)][_0x314703]),'rows':_0xb3f121['rows'][_0x280018(0x20a)](_0x9d9da6=>_0x2bffc6['map'](_0x4b1638=>_0x9d9da6[_0x4b1638]))},_0xf13da9=_0x451628['seed']!==null?_0x451628[_0x280018(0x1be)]:Math['floor'](Math['random']()*0xffffffff),_0x400ecc=new Sphere(),_0x58e92f=await _0x400ecc['transform'](_0x484f0d,{'k':_0x451628['k'],'theta':_0x451628[_0x280018(0x1f2)],'delta':_0x451628['delta'],'mixProb':_0x451628[_0x280018(0x204)],'seed':_0xf13da9,'catColIndices':_0x2d4c16},{'onProgress':_0x32a1c6=>progress(0.05+0.85*_0x32a1c6)});progress(0.92);const _0x11760e=_0xb3f121[_0x280018(0x1fe)]['length'],_0x446d62=Math['max'](0x3,String(_0x11760e)['length']),_0x2eb0e2=Array['from']({'length':_0x11760e},(_0x494c04,_0x5d91b9)=>'Synthetic'+String(_0x5d91b9+0x1)['padStart'](_0x446d62,'0')),_0x17b290=new Map(_0x2bffc6['map']((_0x5e414c,_0x4509c0)=>[_0x5e414c,_0x4509c0])),_0x1e9565=_0xb3f121['rows']['map']((_0x13fef9,_0x9cfad2)=>_0xb3f121[_0x280018(0x206)]['map']((_0x996266,_0x416f02)=>{const _0x5785bf=_0x280018;if(_0x2a70e1['has'](_0x416f02))return _0x2eb0e2[_0x9cfad2];const _0x856da8=_0x17b290['get'](_0x416f02);return _0x58e92f[_0x5785bf(0x1fe)][_0x9cfad2][_0x856da8];})),_0x1af1e1={'headers':_0xb3f121[_0x280018(0x206)],'rows':_0x1e9565};await writeCSVToPath(_0x451628[_0x280018(0x1da)],_0x1af1e1),progress(0.98);const _0x4b27d2=new Date()[_0x280018(0x1e5)]()[_0x280018(0x1e8)](/\.\d+Z$/,'Z'),_0x6644e9={'tool':_0x280018(0x1df),'version':_0x280018(0x1e1),'generated_at':_0x4b27d2,'real':_0x451628[_0x280018(0x1c6)][_0x280018(0x1e8)](/.*[\\/]/,''),'seed':_0xf13da9,'k':_0x451628['k'],'theta':_0x451628[_0x280018(0x1f2)],'delta':_0x451628['delta'],'mix_prob':_0x451628['mixProb'],'rows':_0x11760e,'cols':_0xb3f121['headers']['length']};fs__namespace[_0x280018(0x1b7)](_0x451628['output']+_0x280018(0x1f3),JSON['stringify'](_0x6644e9,null,0x2),'utf8'),progress(0x1);const _0x2e5d36=Date['now']()-_0x5c085b;process[_0x280018(0x1c1)][_0x280018(0x1e7)](JSON[_0x280018(0x207)]({'ok':!![],'elapsedMs':_0x2e5d36,'rows':_0x11760e,'cols':_0xb3f121['headers']['length'],'seed':_0xf13da9,'idColDetected':_0x2b69fa['length']>0x0,'idColName':_0x2b69fa[_0x280018(0x1fc)]>0x0?_0x2b69fa[_0x280018(0x1d1)](',\x20'):null})+'\x0a'),process['exit'](0x0);}main()['catch'](_0x435f8e=>{const _0x2e2efd=_0x339178;process['stderr']['write'](JSON[_0x2e2efd(0x207)]({'error':String((_0x435f8e==null?void 0x0:_0x435f8e[_0x2e2efd(0x1de)])??_0x435f8e)})+'\x0a'),process[_0x2e2efd(0x1b9)](0x1);});
|