@kedem/okdb 2.4.0 → 2.5.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/CHANGELOG.md +78 -0
- package/algorithm-worker-thread.js +1 -1
- package/bin/okdb.js +1 -1
- package/docs/auth-and-sync.md +2 -1
- package/docs/change-log.md +6 -6
- package/docs/licensing.md +6 -1
- package/docs/migration.md +60 -1
- package/docs/plugins.md +1 -1
- package/docs/processors.md +1 -1
- package/docs/subscriptions.md +6 -4
- package/docs/views.md +4 -0
- package/okdb-functions-sandbox-worker.js +1 -1
- package/okdb-http-worker-child.js +1 -1
- package/okdb-views-bootstrap-worker.js +1 -1
- package/okdb.js +1 -1
- package/package.json +1 -1
- package/types/okdb.d.ts +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,84 @@ All notable changes to `@kedem/okdb` are documented here. Format loosely follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/); versions follow [SemVer](https://semver.org/).
|
|
5
5
|
Dates are release dates.
|
|
6
6
|
|
|
7
|
+
## [2.5.0] - 2026-09-28
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **`OKDB.clone(src, dst)` and `OKDB.reidentify(path)` — a copied store gets its own identity.**
|
|
12
|
+
A file-copied store (a test template, a restored backup) used to keep the original's `~system`
|
|
13
|
+
identity, so copies shared its UDP bus group (receiving each other's POKE/DRAIN/TYPE_DROP), sync
|
|
14
|
+
node id, node keypair, token secret and licence node binding. `clone()` copies a **closed** store
|
|
15
|
+
(refuses `STORE_IN_USE` while any env is open; `CLONE_DEST_NOT_EMPTY`, `CLONE_DEST_OVERLAPS_SOURCE`)
|
|
16
|
+
and marks the copy; `reidentify()` marks a copy you made yourself (e.g. a hot backup from
|
|
17
|
+
`db.migrate.backup()`); `okdb restore <backup> --path <dst> --new-identity` does both. The copy's
|
|
18
|
+
first `open()` mints a fresh id exactly once. Its copied history still counts as its own
|
|
19
|
+
(`originMode` filters treat former ids as self up to each env's fork clock, `db.formerIds`), so
|
|
20
|
+
FTS/views/indexes/time-machine are consistent without a rebuild; sync links and peer cursors are
|
|
21
|
+
dropped (it joins as a new node), secrets and keypair are regenerated, locks and leases dropped.
|
|
22
|
+
Node-bound licence activations report `wrong_node` on the copy. See
|
|
23
|
+
[Migration → Cloning a store](docs/migration.md).
|
|
24
|
+
- **`okdb shm-gc`** — deletes okdb shared-memory segments in `/dev/shm` that no process maps or
|
|
25
|
+
holds open (leaked by okdb ≤ 2.4.0, see Fixed). `--dry-run`; `--prefix` (default `-tmp-`: only
|
|
26
|
+
stores under `/tmp`); `--force` when some same-user processes' maps are unreadable. Linux only.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- **Four OKDB instances indexing FTS in one process deadlocked every write in that process.**
|
|
31
|
+
lmdb-js runs each async commit on a libuv thread-pool thread (`UV_THREADPOOL_SIZE`, default 4)
|
|
32
|
+
and keeps it while the commit callback is pending; the FTS commit held its post txn while its docs
|
|
33
|
+
txn needed a second thread, so four concurrent FTS commits took the whole pool and every later
|
|
34
|
+
commit in the process hung (logged as `writer STALL` on unrelated envs). Such nested holds are now
|
|
35
|
+
capped process-wide below the pool size. Workaround for older versions: `UV_THREADPOOL_SIZE=16`.
|
|
36
|
+
- **Shared-memory segments leaked forever.** Every env path ever opened left a `/dev/shm` entry
|
|
37
|
+
(one per env plus one boot-lock segment per store; millions on test machines), and a new store at
|
|
38
|
+
a reused path inherited the old one's clock, drain and writer-cell state. The last process to
|
|
39
|
+
close an env path now unlinks its segment; an opener racing that unlink keeps the segment alive or
|
|
40
|
+
moves to its successor, so cross-process clock/HLC state never splits. Run `okdb shm-gc` once to
|
|
41
|
+
clear leaks from older versions.
|
|
42
|
+
- **Cluster worker disconnected during `open()` never exited.** A worker the primary disconnected
|
|
43
|
+
while it was still booting missed the `disconnect` event and kept the store open indefinitely
|
|
44
|
+
(the `ppid === 1` backstop never fires under a subreaper such as systemd --user).
|
|
45
|
+
- **Two stores could share shared-memory state.** Segment names replaced every non-alphanumeric
|
|
46
|
+
character with `-`, so e.g. store `/a/b` with env `c-d` and store `/a/b-c` with env `d` shared one
|
|
47
|
+
segment (clock, HLC, compaction drain, writer cells); the boot-lock segment also collided with an
|
|
48
|
+
env named `boot`. Names now carry a hash of the full path.
|
|
49
|
+
- **`open()` failed for store paths longer than ~250 characters** (`shm_open failed: File name too
|
|
50
|
+
long`; ~30 on macOS). Segment names are now length-bounded.
|
|
51
|
+
- **A worker thread killed by `terminate()` mid-write blocked compaction.** Its writer cell stayed
|
|
52
|
+
claimed under the live host pid, pinning the env as shared and its writer count above zero. Cells
|
|
53
|
+
now record the owning thread and are released when the thread exits.
|
|
54
|
+
- **Views missed writes synced in from peers.** Sync views and every view's `$ref` / live map `$ref`
|
|
55
|
+
sections skipped remote-origin writes, which a rebuild then counted — live results and a rebuild
|
|
56
|
+
could disagree, and a later local update of such a doc undid a contribution never added. Views now
|
|
57
|
+
count every write. View storage version 6 → 7: on first open, affected views rebuild once — only
|
|
58
|
+
on stores that have (or had) a sync peer or are clones; all other views are restamped.
|
|
59
|
+
- **A failed `open()` leaked everything it had opened** (LMDB envs, shared memory, timers, registry
|
|
60
|
+
rows) for the life of the process, and `close()` then threw `INVALID_STATE`. It now tears down
|
|
61
|
+
before rethrowing the original error; the instance is left `STOPPED`.
|
|
62
|
+
- **`originMode` was ignored by async processors registered with `handler: '<name>'` or `module`**
|
|
63
|
+
(they received every write). It is now applied on every delivery path, including snapshot
|
|
64
|
+
bootstrap; the cursor still advances past filtered-out changes. **Behaviour change:** without an
|
|
65
|
+
explicit `originMode` these processors now get the documented default `'self'` — pass
|
|
66
|
+
`originMode: 'all'` to keep receiving synced-in writes (see [UPGRADING.md](UPGRADING.md)).
|
|
67
|
+
- **A copied store opened the original's `~log`.** Older stores recorded the `~log` env as an
|
|
68
|
+
absolute path; it is now stored relative and healed on open.
|
|
69
|
+
|
|
70
|
+
### Changed
|
|
71
|
+
|
|
72
|
+
- **Faster `open()`.** The live-subscriptions store (`~sub`) and its signal router are created on
|
|
73
|
+
first subscription use instead of at every open; licence signature verification is memoized per
|
|
74
|
+
process; a brand-new store records its storage migrations as done instead of running them; the
|
|
75
|
+
sync node keypair is minted on first use. A fresh store opens in about half the time.
|
|
76
|
+
- **Shared-memory segment names now end in a hash of the full store path** (a readable prefix is
|
|
77
|
+
kept, so stores under `/tmp` still start with `-tmp-`). **Old and new versions no longer share
|
|
78
|
+
segments: stop every process on a store and restart them together — no rolling upgrade across
|
|
79
|
+
this release** (see [UPGRADING.md](UPGRADING.md)). A live okdb ≤ 2.4.0 writer on the same store is
|
|
80
|
+
detected and logged.
|
|
81
|
+
- `close()` on a stopped instance is a no-op (a second `close()` used to throw `INVALID_STATE`);
|
|
82
|
+
plugins are stopped only if their `start()` succeeded, in reverse order.
|
|
83
|
+
- `writer STALL` log names a saturated libuv thread pool as a possible cause (it blamed fsync only).
|
|
84
|
+
|
|
7
85
|
## [2.4.0] - 2026-09-25
|
|
8
86
|
|
|
9
87
|
### Security
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const _0x31c441=_0x2d84;(function(_0x8aa4bb,_0x3ce597){const _0x4834b3=_0x2d84,_0x7a0cc3=_0x8aa4bb();while(!![]){try{const _0x2df0ca=parseInt(_0x4834b3(0x196))/0x1+parseInt(_0x4834b3(0x20f))/0x2*(-parseInt(_0x4834b3(0x16e))/0x3)+parseInt(_0x4834b3(0x176))/0x4+-parseInt(_0x4834b3(0x19b))/0x5*(-parseInt(_0x4834b3(0x208))/0x6)+parseInt(_0x4834b3(0x162))/0x7+-parseInt(_0x4834b3(0x1b9))/0x8+-parseInt(_0x4834b3(0x1a9))/0x9*(parseInt(_0x4834b3(0x18d))/0xa);if(_0x2df0ca===_0x3ce597)break;else _0x7a0cc3['push'](_0x7a0cc3['shift']());}catch(_0xae0633){_0x7a0cc3['push'](_0x7a0cc3['shift']());}}}(_0x1f86,0x94049));var require$$0$1=require(_0x31c441(0x165)),require$$0=require('fs'),require$$1=require('path'),require$$2=require('os'),require$$3=require(_0x31c441(0x169));function _0x2d84(_0x4bff9c,_0x5304ac){_0x4bff9c=_0x4bff9c-0x162;const _0x1f86ad=_0x1f86();let _0x2d8461=_0x1f86ad[_0x4bff9c];return _0x2d8461;}function getDefaultExportFromCjs(_0x2d144f){const _0x56e563=_0x31c441;return _0x2d144f&&_0x2d144f[_0x56e563(0x1ca)]&&Object[_0x56e563(0x1cd)][_0x56e563(0x199)][_0x56e563(0x182)](_0x2d144f,_0x56e563(0x173))?_0x2d144f[_0x56e563(0x173)]:_0x2d144f;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x5a627c=_0x31c441;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x284fa=require$$0,_0x5397ba=require$$1,_0x5b0cdb=require$$2,_0x4d7da0=require$$3;function _0x22d13b(){const _0x424e1f=_0x2d84;return Date[_0x424e1f(0x1ff)]();}function _0x3bf671(_0x579fea){const _0x36c2c6=_0x2d84;try{return _0x284fa[_0x36c2c6(0x1dd)](_0x579fea);}catch{return![];}}function _0xd8b77(_0x21ae9c){const _0x36ad3d=_0x2d84;try{return _0x284fa[_0x36ad3d(0x188)](_0x21ae9c,_0x36ad3d(0x179));}catch{return null;}}function _0x425259(_0x363690,_0x14d938){const _0x4b839d=_0x2d84,_0x174e90=_0x363690+_0x4b839d(0x164)+_0x4d7da0['randomBytes'](0x6)[_0x4b839d(0x16f)](_0x4b839d(0x20d));_0x284fa['writeFileSync'](_0x174e90,_0x14d938),_0x284fa[_0x4b839d(0x1c8)](_0x174e90,_0x363690);}function _0x29df22(_0x33b9fa,_0x16f5ff=0x10){const _0x427e5e=_0x2d84,_0x15ae65=String(Math[_0x427e5e(0x22d)](0x0,Math[_0x427e5e(0x191)](_0x33b9fa||0x0)));return _0x15ae65['length']>=_0x16f5ff?_0x15ae65:'0'[_0x427e5e(0x17e)](_0x16f5ff-_0x15ae65[_0x427e5e(0x21f)])+_0x15ae65;}return snapshotStore=class _0x4042e7{constructor({dir:_0x19e8f9,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x2a8ab3=_0x2d84;if(!_0x19e8f9)throw new Error(_0x2a8ab3(0x16b));this[_0x2a8ab3(0x22a)]=_0x19e8f9,this['snapshotsDir']=_0x5397ba[_0x2a8ab3(0x20c)](_0x19e8f9,_0x2a8ab3(0x1d1)),this['currentPath']=_0x5397ba[_0x2a8ab3(0x20c)](_0x19e8f9,_0x2a8ab3(0x1af)),this[_0x2a8ab3(0x204)]=_0x5397ba[_0x2a8ab3(0x20c)](_0x19e8f9,_0x2a8ab3(0x1fc)),this[_0x2a8ab3(0x238)]=keepSnapshots,this[_0x2a8ab3(0x1d3)]=log,_0x284fa[_0x2a8ab3(0x1c6)](this[_0x2a8ab3(0x22a)],{'recursive':!![]}),_0x284fa[_0x2a8ab3(0x1c6)](this[_0x2a8ab3(0x21d)],{'recursive':!![]});}[_0x5a627c(0x1f8)](_0x4a81ca){const _0x34c984=_0x5a627c;return _0x5397ba['join'](this[_0x34c984(0x21d)],_0x4a81ca);}[_0x5a627c(0x23b)](_0x2cbfeb){const _0x981f2=_0x5a627c,_0x3948c4=this[_0x981f2(0x1f8)](_0x2cbfeb);return{'dir':_0x3948c4,'index':_0x5397ba[_0x981f2(0x20c)](_0x3948c4,_0x981f2(0x198)),'labels':_0x5397ba[_0x981f2(0x20c)](_0x3948c4,_0x981f2(0x207)),'state':_0x5397ba[_0x981f2(0x20c)](_0x3948c4,_0x981f2(0x18e))};}[_0x5a627c(0x1da)](){const _0x4b122e=_0x5a627c;if(!_0x3bf671(this['currentPath']))return null;const _0x50541b=_0xd8b77(this['currentPath']);if(!_0x50541b)return null;const _0x3bd471=String(_0x50541b)[_0x4b122e(0x1aa)]();return _0x3bd471||null;}['readCurrentClock'](){const _0xf08db0=_0x5a627c,_0xe8c0b8=this['readCurrentId']();if(!_0xe8c0b8)return 0x0;const _0x526566=Number(_0xe8c0b8);return Number[_0xf08db0(0x232)](_0x526566)?_0x526566:0x0;}[_0x5a627c(0x1b8)](){const _0x10410c=_0x5a627c;try{return _0x284fa[_0x10410c(0x1bd)](this[_0x10410c(0x21d)],{'withFileTypes':!![]})[_0x10410c(0x1ac)](_0x3d5538=>_0x3d5538[_0x10410c(0x1cb)]())[_0x10410c(0x1bb)](_0x1a3d89=>_0x1a3d89[_0x10410c(0x233)])['filter'](_0x5d08c3=>!_0x5d08c3[_0x10410c(0x219)](_0x10410c(0x164)))[_0x10410c(0x1ac)](_0x425ec5=>!_0x425ec5[_0x10410c(0x219)](_0x10410c(0x16d)))[_0x10410c(0x23a)]();}catch{return[];}}[_0x5a627c(0x1c4)](){const _0x41bf4d=_0x5a627c,_0x4fe705=this['readCurrentId']();if(_0x4fe705)return _0x4fe705;const _0x3a5f24=this[_0x41bf4d(0x1b8)]();if(!_0x3a5f24['length'])return null;return _0x3a5f24[_0x3a5f24[_0x41bf4d(0x21f)]-0x1];}['cleanupTmpDirs']({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x524283=_0x5a627c;let _0x1b310a;try{_0x1b310a=_0x284fa[_0x524283(0x1bd)](this['snapshotsDir'],{'withFileTypes':!![]});}catch{return;}const _0x3336be=_0x22d13b()-maxAgeMs;for(const _0x3dbdc0 of _0x1b310a){if(!_0x3dbdc0[_0x524283(0x1cb)]())continue;const _0x29993d=_0x3dbdc0['name'];if(!_0x29993d[_0x524283(0x219)]('.tmp-')&&!_0x29993d[_0x524283(0x219)](_0x524283(0x16d)))continue;const _0x17b5f0=_0x5397ba[_0x524283(0x20c)](this[_0x524283(0x21d)],_0x29993d);try{const _0x439c98=_0x284fa[_0x524283(0x200)](_0x17b5f0);if(_0x439c98[_0x524283(0x1ad)]>_0x3336be)continue;}catch{}try{_0x284fa['rmSync'](_0x17b5f0,{'recursive':!![],'force':!![]});}catch{}}}[_0x5a627c(0x1e4)]({keep:keep=null}={}){const _0x26c439=_0x5a627c,_0x39771c=Math[_0x26c439(0x22d)](0x1,Math[_0x26c439(0x191)](keep??this[_0x26c439(0x238)]??0x3)),_0x51880d=this[_0x26c439(0x1b8)]();if(_0x51880d[_0x26c439(0x21f)]<=_0x39771c)return;const _0x55193e=this[_0x26c439(0x1da)](),_0x516b21=_0x51880d[_0x26c439(0x23f)](0x0,Math[_0x26c439(0x22d)](0x0,_0x51880d['length']-_0x39771c));for(const _0x59958c of _0x516b21){if(_0x55193e&&_0x59958c===_0x55193e)continue;const _0x204615=this[_0x26c439(0x1f8)](_0x59958c);try{_0x284fa[_0x26c439(0x218)](_0x204615,{'recursive':!![],'force':!![]});}catch{}}}async[_0x5a627c(0x183)](_0x86a72,_0x1effa8){const _0x125fd6=_0x5a627c;if(!_0x86a72)throw new Error('snapshot\x20id\x20required');const _0x51f2bd=this[_0x125fd6(0x23b)](_0x86a72);if(!_0x3bf671(_0x51f2bd[_0x125fd6(0x211)])||!_0x3bf671(_0x51f2bd[_0x125fd6(0x19f)])||!_0x3bf671(_0x51f2bd[_0x125fd6(0x178)]))throw new Error(_0x125fd6(0x229)+_0x86a72);const _0xf24f51=await _0x1effa8(_0x51f2bd);return _0xf24f51||{};}async[_0x5a627c(0x1a1)](_0x343ef0,_0x4ccdf4,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x3f51fe=_0x5a627c,_0x9c40db=Number(_0x343ef0);if(!Number[_0x3f51fe(0x232)](_0x9c40db)||_0x9c40db<0x0)throw new Error(_0x3f51fe(0x22f));const _0x21c3d5=_0x29df22(_0x9c40db),_0x52539c=this[_0x3f51fe(0x1f8)](_0x21c3d5),_0x5f389d=_0x5397ba[_0x3f51fe(0x20c)](this[_0x3f51fe(0x21d)],_0x3f51fe(0x164)+_0x21c3d5+'-'+_0x4d7da0[_0x3f51fe(0x236)](0x6)[_0x3f51fe(0x16f)](_0x3f51fe(0x20d)));_0x284fa[_0x3f51fe(0x1c6)](_0x5f389d,{'recursive':!![]});const _0x1708c9={'dir':_0x5f389d,'index':_0x5397ba[_0x3f51fe(0x20c)](_0x5f389d,_0x3f51fe(0x198)),'labels':_0x5397ba['join'](_0x5f389d,_0x3f51fe(0x207)),'state':_0x5397ba['join'](_0x5f389d,_0x3f51fe(0x18e))};await _0x4ccdf4(_0x1708c9,{'id':_0x21c3d5,'clock':_0x9c40db});const _0x4606a9=JSON['stringify']({'pid':process[_0x3f51fe(0x1db)],'host':_0x5b0cdb[_0x3f51fe(0x1f3)](),'at':_0x22d13b()}),_0xcdc217=_0x22d13b();let _0x168909=null;const _0xc17cab=()=>{const _0x4de0fd=_0x3f51fe;try{const _0x57a58c=JSON['parse'](_0x284fa[_0x4de0fd(0x188)](this[_0x4de0fd(0x204)],_0x4de0fd(0x179)));if(_0x57a58c['at']&&_0x22d13b()-_0x57a58c['at']>staleLockMaxAgeMs){const _0x1854b2=_0x22d13b()-_0x57a58c['at'],_0x25fc51='Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20'+Math[_0x4de0fd(0x1e5)](_0x1854b2/0x3e8)+_0x4de0fd(0x1d6)+_0x57a58c[_0x4de0fd(0x1db)]+_0x4de0fd(0x1ab)+_0x57a58c[_0x4de0fd(0x172)]+_0x4de0fd(0x201)+_0x4de0fd(0x1ea);this[_0x4de0fd(0x1d3)]?.[_0x4de0fd(0x185)]?this['log'][_0x4de0fd(0x185)](_0x25fc51):console[_0x4de0fd(0x185)](_0x4de0fd(0x235),_0x25fc51);try{_0x284fa['unlinkSync'](this[_0x4de0fd(0x204)]);}catch{}return!![];}}catch{try{_0x284fa[_0x4de0fd(0x18a)](this[_0x4de0fd(0x204)]);}catch{}}return![];},_0x463da9=()=>{const _0x79b200=_0x3f51fe;try{return _0x168909=_0x284fa[_0x79b200(0x192)](this[_0x79b200(0x204)],'wx'),_0x284fa['writeFileSync'](_0x168909,_0x4606a9),!![];}catch(_0x35aa1f){if(_0x35aa1f&&_0x35aa1f[_0x79b200(0x1e3)]===_0x79b200(0x1c2))return![];throw _0x35aa1f;}};if(!_0x463da9()){_0xc17cab(),_0x463da9();if(_0x168909==null&&lockTimeoutMs>0x0)while(_0x22d13b()-_0xcdc217<lockTimeoutMs){await new Promise(_0x5f046a=>setTimeout(_0x5f046a,0x19));if(_0x463da9())break;_0xc17cab();}}if(_0x168909==null){try{_0x284fa['rmSync'](_0x5f389d,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':'lock_busy'};}try{const _0x103664=this[_0x3f51fe(0x1a4)]();if(_0x9c40db<=_0x103664){try{_0x284fa[_0x3f51fe(0x218)](_0x5f389d,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x3f51fe(0x18b),'currentClock':_0x103664};}if(!_0x3bf671(_0x52539c))_0x284fa[_0x3f51fe(0x1c8)](_0x5f389d,_0x52539c);else try{_0x284fa[_0x3f51fe(0x218)](_0x5f389d,{'recursive':!![],'force':!![]});}catch{}return _0x425259(this[_0x3f51fe(0x227)],_0x21c3d5+'\x0a'),this['prune']({'keep':keep}),{'published':!![],'currentClock':_0x9c40db};}finally{try{_0x284fa[_0x3f51fe(0x240)](_0x168909);}catch{}try{_0x284fa[_0x3f51fe(0x18a)](this['lockPath']);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x2f931d=_0x31c441;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x28b42e=require$$0;class _0x1bf8d0{constructor(){const _0x455d65=_0x2d84;this[_0x455d65(0x1a2)]=new Map(),this[_0x455d65(0x215)]=new Map(),this[_0x455d65(0x1f7)]=0x0,this[_0x455d65(0x22b)]=0x0,this[_0x455d65(0x203)]=new Map(),this[_0x455d65(0x242)]=!![];}async[_0x2f931d(0x1e0)](){const _0x58871e=_0x2f931d;this['keyToLabel']=new Map(),this[_0x58871e(0x215)]=new Map(),this[_0x58871e(0x203)]=new Map(),this[_0x58871e(0x242)]=!![],this['nextLabel']=0x0,this['_tombstoneCount']=0x0;}async[_0x2f931d(0x210)](_0x456cc9){const _0x353c6b=_0x2f931d;if(!_0x456cc9||!_0x28b42e[_0x353c6b(0x1dd)](_0x456cc9))return await this[_0x353c6b(0x1e0)](),!![];let _0x4ac263;try{_0x4ac263=_0x28b42e[_0x353c6b(0x188)](_0x456cc9,'utf8');}catch{return await this['reset'](),!![];}let _0x5adfbe;try{_0x5adfbe=JSON['parse'](_0x4ac263);}catch{return await this[_0x353c6b(0x1e0)](),!![];}const _0x48ae15=Array[_0x353c6b(0x21e)](_0x5adfbe?.[_0x353c6b(0x1a3)])?_0x5adfbe['entries']:[],_0x4f2dea=Number[_0x353c6b(0x187)](_0x5adfbe?.['nextLabel'])?_0x5adfbe[_0x353c6b(0x1f7)]:0x0,_0x4fe8f4=new Map(),_0x1c7d93=new Map(),_0x781fc=new Map(),_0x25538d=_0x5adfbe?.[_0x353c6b(0x1d4)]>=0x2;let _0xe7ded7=-0x1;for(const _0x40621f of _0x48ae15){if(!Array[_0x353c6b(0x21e)](_0x40621f)||_0x40621f[_0x353c6b(0x21f)]<0x2)continue;const _0x5bd4b4=Number(_0x40621f[0x0]),_0x424668=String(_0x40621f[0x1]??'');if(!Number[_0x353c6b(0x187)](_0x5bd4b4)||_0x5bd4b4<0x0)continue;if(!_0x424668)continue;_0x4fe8f4[_0x353c6b(0x1ba)](_0x424668,_0x5bd4b4),_0x1c7d93[_0x353c6b(0x1ba)](_0x5bd4b4,_0x424668);if(_0x25538d&&typeof _0x40621f[0x2]==='number')_0x781fc[_0x353c6b(0x1ba)](_0x424668,_0x40621f[0x2]);if(_0x5bd4b4>_0xe7ded7)_0xe7ded7=_0x5bd4b4;}return this[_0x353c6b(0x1a2)]=_0x4fe8f4,this[_0x353c6b(0x215)]=_0x1c7d93,this[_0x353c6b(0x203)]=_0x781fc,this[_0x353c6b(0x242)]=_0x25538d,this[_0x353c6b(0x1f7)]=Math[_0x353c6b(0x22d)](_0x4f2dea,_0xe7ded7+0x1,0x0),this[_0x353c6b(0x22b)]=0x0,!![];}[_0x2f931d(0x1a0)](_0x5ec151){const _0x3fbd7c=_0x2f931d;return this[_0x3fbd7c(0x1a2)][_0x3fbd7c(0x19d)](_0x5ec151);}[_0x2f931d(0x1ec)](_0x1bf2b7){const _0x286075=_0x2f931d;let _0x2845f0=this[_0x286075(0x1a2)][_0x286075(0x19d)](_0x1bf2b7);if(_0x2845f0!==undefined)return _0x2845f0;return _0x2845f0=this[_0x286075(0x1f7)]++,this['keyToLabel']['set'](_0x1bf2b7,_0x2845f0),this[_0x286075(0x215)][_0x286075(0x1ba)](_0x2845f0,_0x1bf2b7),_0x2845f0;}[_0x2f931d(0x1d0)](_0xa4f0a7,_0x1962b3){const _0x214c34=_0x2f931d;if(_0x1962b3==null)this[_0x214c34(0x203)][_0x214c34(0x16c)](_0xa4f0a7);else this[_0x214c34(0x203)][_0x214c34(0x1ba)](_0xa4f0a7,_0x1962b3);}[_0x2f931d(0x1a8)](_0x3a34a7){const _0xdfdf34=_0x2f931d;return this[_0xdfdf34(0x203)][_0xdfdf34(0x19d)](_0x3a34a7);}[_0x2f931d(0x1eb)](){const _0xecdc20=_0x2f931d;return this[_0xecdc20(0x1a2)][_0xecdc20(0x1eb)]();}[_0x2f931d(0x221)](_0x39616f){const _0x356526=_0x2f931d,_0x2f1e05=this['keyToLabel'][_0x356526(0x19d)](_0x39616f);if(_0x2f1e05===undefined)return;this[_0x356526(0x203)]['delete'](_0x39616f),this[_0x356526(0x1a2)][_0x356526(0x16c)](_0x39616f),this[_0x356526(0x215)][_0x356526(0x16c)](_0x2f1e05),this[_0x356526(0x22b)]++;}[_0x2f931d(0x170)](_0x3010dd){const _0x502a10=_0x2f931d;return this[_0x502a10(0x215)][_0x502a10(0x19d)](_0x3010dd)??null;}[_0x2f931d(0x1d2)](){const _0x3352a8=_0x2f931d;return this[_0x3352a8(0x1a2)][_0x3352a8(0x1d2)];}[_0x2f931d(0x20e)](){return this['_tombstoneCount'];}async[_0x2f931d(0x184)](_0x38d983){const _0x5e79f5=_0x2f931d,_0x2ddc43=_0x38d983+_0x5e79f5(0x1fa),_0x17597d=[];for(const [_0x69f573,_0x2b68e5]of this[_0x5e79f5(0x215)][_0x5e79f5(0x1a3)]()){const _0x46f1c2=this[_0x5e79f5(0x203)]['get'](_0x2b68e5);_0x17597d[_0x5e79f5(0x1b6)](_0x46f1c2==null?[_0x69f573,_0x2b68e5]:[_0x69f573,_0x2b68e5,_0x46f1c2]);}_0x17597d[_0x5e79f5(0x23a)]((_0xe6e5c5,_0x3f1b9e)=>_0xe6e5c5[0x0]-_0x3f1b9e[0x0]);const _0xf4255={'version':0x2,'nextLabel':this[_0x5e79f5(0x1f7)],'entries':_0x17597d};_0x28b42e[_0x5e79f5(0x1f9)](_0x2ddc43,JSON[_0x5e79f5(0x174)](_0xf4255)),_0x28b42e[_0x5e79f5(0x1c8)](_0x2ddc43,_0x38d983);}}return labelMap=_0x1bf8d0,labelMap;}function _0x1f86(){const _0x28332c=['key','remove','repeat','initIndex','cleanupTmpDirs','stop','call','loadSnapshot','snapshotTo','warn','readIndexSync','isInteger','readFileSync','flat','unlinkSync','stale','has','66950HAITDA','state.json','F32','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','trunc','openSync','count','writerLockMaxAgeMs','buffer','1027802xmHBzM','usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','index.hnsw','hasOwnProperty','rebuild','10pvOEGF','writer','get','memoryUsage','labels','labelForExisting','publishSnapshot','keyToLabel','entries','readCurrentClock','vectors','HierarchicalNSW','Unknown\x20op:\x20\x22','fingerprintOf','2745mDEGBA','trim',',\x20host:\x20','filter','mtimeMs','Unknown\x20algorithm:\x20\x22','CURRENT','heartbeatIntervalMs','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20','HNSW_BINDINGS_UNAVAILABLE','markDelete','exports','efConstruction','push','growFactor','listSnapshotIds','142912JRywTp','set','map','unreadable','readdirSync','addPoint','tmpMaxAgeMs','fid','ScalarKind','EEXIST','added','latestSnapshotId','unref','mkdirSync','connectivity','renameSync','clock','__esModule','isDirectory','searchKnn','prototype','save','viewRefreshMs','setFingerprint','snapshots','size','log','version','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','s,\x20pid:\x20','min','getMaxElements','algorithm','readCurrentId','pid','Index','existsSync','search','metric','reset','HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','snapshotMaxLagMs','code','prune','round','removed','fetchAllResult','setEf','parse','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','keys','labelForEphemeral','then','changed','L2sq','ready','from','catch','hostname','distances','queryVec','cosine','nextLabel','_snapshotDir','writeFileSync','.tmp','manifestVersion','SNAPSHOT.LOCK','expansionSearch','token','now','statSync',').\x20','hnsw','keyToFp','lockPath','clear','imul','labels.json','1998012NFgHmI','acquire','expansionAdd','sync','join','hex','tombstoneCount','3716VmVUzR','loadFrom','index','Original\x20error:\x20','arch','sqrt','labelToKey','hnswlib-node','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20','rmSync','startsWith','efSearch','resolve','capacity','snapshotsDir','isArray','length','postMessage','tombstone','error','add','Cos','MetricKind','info','currentPath','cause','snapshot\x20incomplete:\x20','dir','_tombstoneCount','snapshotEveryChanges','max','published','candidateClock\x20must\x20be\x20finite\x20>=\x200','snapshot','dims','isFinite','name','usearch','[SnapshotStore]','randomBytes','reject','keepSnapshots','resizeIndex','sort','_snapshotPaths','load','platform','view','slice','closeSync','node','hasFingerprints','4871594ApfACz','vector','.tmp-','worker_threads','maxElements','fetchAll','message','crypto','ENOENT','SnapshotStore\x20requires\x20dir','delete','_tmp-','1095zVcftO','toString','keyForLabel','for\x20Node\x20','host','default','stringify','versions','3818168uNbgTk','score','state','utf8','isFree','writeIndexSync'];_0x1f86=function(){return _0x28332c;};return _0x1f86();}var indexConvergence,hasRequiredIndexConvergence;function requireIndexConvergence(){if(hasRequiredIndexConvergence)return indexConvergence;hasRequiredIndexConvergence=0x1;function _0x251f2c(_0x4020b1){const _0x155005=_0x2d84,_0x3d6e72=new Uint32Array(_0x4020b1[_0x155005(0x195)],_0x4020b1['byteOffset'],_0x4020b1[_0x155005(0x21f)]);let _0xee6a18=0x811c9dc5,_0x1d9d43=0x9747b28c;for(let _0xf3feca=0x0;_0xf3feca<_0x3d6e72[_0x155005(0x21f)];_0xf3feca++){const _0x4c1564=_0x3d6e72[_0xf3feca];_0xee6a18=Math[_0x155005(0x206)](_0xee6a18^_0x4c1564,0x1000193)>>>0x0;let _0x310520=Math[_0x155005(0x206)](_0x4c1564,0xcc9e2d51);_0x310520=_0x310520<<0xf|_0x310520>>>0x11,_0x1d9d43=Math[_0x155005(0x206)](_0x1d9d43^Math[_0x155005(0x206)](_0x310520,0x1b873593),0x5)+0xe6546b64,_0x1d9d43>>>=0x0;}return _0x1d9d43=Math[_0x155005(0x206)](_0x1d9d43^_0x1d9d43>>>0x10,0x85ebca6b)>>>0x0,(_0xee6a18>>>0x0)*0x100000+(_0x1d9d43&0xfffff);}function _0x2f12fb(_0x3920e0,_0x207b09,_0x476e5c,{upsert:_0x190562,remove:_0x1d288a}){const _0x500091=_0x2d84,_0x3f24d3=new Set();let _0x22c909=0x0,_0x36de1b=0x0,_0x501138=0x0;for(const {key:_0x55e2cb,vector:_0x43d32e}of _0x207b09){if(!(_0x43d32e instanceof Float32Array)||_0x43d32e['length']!==_0x476e5c)continue;_0x3f24d3[_0x500091(0x223)](_0x55e2cb);const _0x4a62ea=_0x251f2c(_0x43d32e),_0x31a226=_0x3920e0['labelForExisting'](_0x55e2cb)!==undefined;if(_0x31a226&&_0x3920e0[_0x500091(0x1a8)](_0x55e2cb)===_0x4a62ea)continue;_0x190562(_0x55e2cb,_0x43d32e,_0x4a62ea);if(_0x31a226)_0x36de1b++;else _0x22c909++;}for(const _0x291c16 of[..._0x3920e0[_0x500091(0x1eb)]()]){if(_0x3f24d3[_0x500091(0x18c)](_0x291c16))continue;_0x1d288a(_0x291c16),_0x501138++;}return{'added':_0x22c909,'changed':_0x36de1b,'removed':_0x501138};}return indexConvergence={'fingerprint':_0x251f2c,'reconcileIndex':_0x2f12fb},indexConvergence;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x1fb427=requireSnapshotStore(),_0x444cf1=requireLabelMap(),{fingerprint:_0xd485ae,reconcileIndex:_0x281f25}=requireIndexConvergence(),_0x358c59=0x1;let _0x418d43=null;function _0x3959f2(){const _0x276e7b=_0x2d84;if(_0x418d43)return _0x418d43;try{return _0x418d43=require(_0x276e7b(0x216)),_0x418d43;}catch(_0x43a772){const _0x1affec=new Error(_0x276e7b(0x1e1)+(_0x276e7b(0x171)+process[_0x276e7b(0x175)][_0x276e7b(0x241)]+'\x20on\x20'+process[_0x276e7b(0x23d)]+'/'+process[_0x276e7b(0x213)]+'.\x20')+_0x276e7b(0x1b1)+(_0x276e7b(0x212)+(_0x43a772?.[_0x276e7b(0x168)]||String(_0x43a772))));_0x1affec[_0x276e7b(0x1e3)]=_0x276e7b(0x1b2),_0x1affec[_0x276e7b(0x228)]=_0x43a772;throw _0x1affec;}}return hnsw=function _0x3c2782(_0x36cb1d={},{dims:_0x16a73f,dir:_0x347adb}){const _0x2d4734=_0x2d84,_0x200658=_0x3959f2();if(!_0x16a73f||_0x16a73f<=0x0)throw new Error(_0x2d4734(0x190));if(!_0x347adb)throw new Error('hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage');const _0x28d43f={'metric':_0x36cb1d[_0x2d4734(0x1df)]??_0x2d4734(0x1f6),'M':_0x36cb1d['M']??0x10,'efConstruction':_0x36cb1d[_0x2d4734(0x1b5)]??0xc8,'efSearch':_0x36cb1d[_0x2d4734(0x21a)]??0x40,'maxElements':_0x36cb1d[_0x2d4734(0x166)]??0x400,'growFactor':_0x36cb1d[_0x2d4734(0x1b7)]??0x2,'snapshotEveryChanges':_0x36cb1d[_0x2d4734(0x22c)]??0xc350,'keepSnapshots':_0x36cb1d[_0x2d4734(0x238)]??0x2,'tmpMaxAgeMs':_0x36cb1d[_0x2d4734(0x1bf)]??0x6*0x36ee80},_0x2dbad3=new _0x1fb427({'dir':_0x347adb,'keepSnapshots':_0x28d43f['keepSnapshots']}),_0x4d24b4=new _0x444cf1();let _0x79e3e7=null,_0x481dcd=0x0,_0x60e80e=null,_0x4752c2=Promise[_0x2d4734(0x21b)]();const _0x8a94b9=_0x3c9496=>{const _0x2c9c7f=_0x2d4734,_0x4b935c=_0x4752c2[_0x2c9c7f(0x1ed)](_0x3c9496);return _0x4752c2=_0x4b935c[_0x2c9c7f(0x1f2)](()=>{}),_0x4b935c;};async function _0x914392(_0x46255c){const _0xd8571d=_0x2d4734;await _0x4d24b4['reset'](),_0x46255c=_0x46255c??[];const _0x2c4950=Math[_0xd8571d(0x22d)](_0x28d43f[_0xd8571d(0x166)],Math['ceil'](_0x46255c[_0xd8571d(0x21f)]*(_0x28d43f[_0xd8571d(0x1b7)]||1.2)),0x1);_0x79e3e7=new _0x200658[(_0xd8571d(0x1a6))](_0x28d43f[_0xd8571d(0x1df)],_0x16a73f),_0x79e3e7[_0xd8571d(0x17f)]({'maxElements':_0x2c4950,'efConstruction':_0x28d43f[_0xd8571d(0x1b5)],'M':_0x28d43f['M']});for(const {key:_0x4be879,vector:_0x1a2640}of _0x46255c){if(!(_0x1a2640 instanceof Float32Array)||_0x1a2640['length']!==_0x16a73f)continue;_0x19d79f(_0x4be879,_0x1a2640);}_0x79e3e7[_0xd8571d(0x1e8)](_0x28d43f[_0xd8571d(0x21a)]),_0x481dcd=0x0;}async function _0x54dea5(_0x5199b){return _0x914392(_0x5199b?await _0x5199b():[]);}function _0x5dcaec(){const _0x19402e=_0x2d4734;if(_0x79e3e7['getCurrentCount']()<_0x79e3e7['getMaxElements']())return;const _0x4a0421=Math['ceil'](_0x79e3e7[_0x19402e(0x1d8)]()*(_0x28d43f[_0x19402e(0x1b7)]||0x2));_0x79e3e7[_0x19402e(0x239)](_0x4a0421),_0x28d43f['maxElements']=_0x4a0421;}function _0x19d79f(_0x3fc6cb,_0x1b62e2,_0x3c1c00){const _0x162d83=_0x2d4734,_0x374c82=_0x4d24b4[_0x162d83(0x1ec)](_0x3fc6cb);try{_0x79e3e7[_0x162d83(0x1b3)](_0x374c82);}catch{}_0x5dcaec(),_0x79e3e7[_0x162d83(0x1be)](Array[_0x162d83(0x1f1)](_0x1b62e2),_0x374c82),_0x4d24b4[_0x162d83(0x1d0)](_0x3fc6cb,_0x3c1c00??_0xd485ae(_0x1b62e2));}function _0x20903c(_0x31d992){const _0x5cd496=_0x2d4734,_0x16ca1d=_0x4d24b4[_0x5cd496(0x1a0)](_0x31d992);if(_0x16ca1d===undefined)return![];try{_0x79e3e7[_0x5cd496(0x1b3)](_0x16ca1d);}catch{}return _0x4d24b4['tombstone'](_0x31d992),!![];}function _0x31b616(){const _0x33f0d0=_0x2d4734;return Math[_0x33f0d0(0x22d)](Date['now'](),_0x2dbad3['readCurrentClock']()+0x1);}async function _0x412b9c(_0x300bf8){const _0x16b521=_0x2d4734;if(!_0x79e3e7||!_0x300bf8)return![];const _0x3e54e6=await _0x2dbad3[_0x16b521(0x1a1)](_0x300bf8,async _0x4e8039=>{const _0x167c25=_0x16b521;_0x79e3e7[_0x167c25(0x17b)](_0x4e8039[_0x167c25(0x211)]),await _0x4d24b4[_0x167c25(0x184)](_0x4e8039[_0x167c25(0x19f)]);const _0xe2d72c=require$$0;_0xe2d72c[_0x167c25(0x1f9)](_0x4e8039[_0x167c25(0x178)],JSON[_0x167c25(0x174)]({'manifestVersion':_0x358c59,'dims':_0x16a73f,'metric':_0x28d43f[_0x167c25(0x1df)],'clock':_0x300bf8,'snapshotAt':Date[_0x167c25(0x1ff)]()},null,0x2));},{'keep':_0x28d43f['keepSnapshots']});if(_0x3e54e6?.[_0x16b521(0x22e)])_0x481dcd=0x0;return _0x3e54e6?.[_0x16b521(0x22e)]??![];}async function _0x4affc9(){const _0x13a19b=_0x2d4734,_0x46b98e=_0x2dbad3[_0x13a19b(0x1da)]()||_0x2dbad3['latestSnapshotId']();if(!_0x46b98e)return null;let _0x477672,_0x54ac6f=![];return await _0x2dbad3[_0x13a19b(0x183)](_0x46b98e,async _0x267754=>{const _0x55c7b2=_0x13a19b,_0x128324=require$$0;_0x477672=JSON[_0x55c7b2(0x1e9)](_0x128324['readFileSync'](_0x267754[_0x55c7b2(0x178)],'utf8'));if(_0x477672[_0x55c7b2(0x1fb)]!==_0x358c59||_0x477672['dims']!==_0x16a73f||_0x477672[_0x55c7b2(0x1df)]!==_0x28d43f[_0x55c7b2(0x1df)]){_0x477672=null;return;}await _0x4d24b4[_0x55c7b2(0x210)](_0x267754['labels']),_0x79e3e7=new _0x200658[(_0x55c7b2(0x1a6))](_0x28d43f['metric'],_0x16a73f),_0x79e3e7[_0x55c7b2(0x186)](_0x267754[_0x55c7b2(0x211)]),_0x79e3e7[_0x55c7b2(0x1e8)](_0x28d43f[_0x55c7b2(0x21a)]),_0x54ac6f=!![];}),_0x54ac6f?_0x477672?.[_0x13a19b(0x1c9)]??0x0:null;}return{async 'load'(_0x1033f6){return _0x8a94b9(async()=>{const _0x38646d=_0x2d84;_0x2dbad3[_0x38646d(0x180)]({'maxAgeMs':_0x28d43f['tmpMaxAgeMs']}),_0x60e80e=_0x1033f6??null;const _0x3a09fa=await _0x4affc9(),_0x63d59f=_0x1033f6?await _0x1033f6():null;if(_0x3a09fa!=null){if(_0x63d59f){if(!_0x4d24b4[_0x38646d(0x242)])return await _0x914392(_0x63d59f),null;const _0x59dfa4=_0x281f25(_0x4d24b4,_0x63d59f,_0x16a73f,{'upsert':_0x19d79f,'remove':_0x20903c});_0x481dcd+=_0x59dfa4[_0x38646d(0x1c3)]+_0x59dfa4[_0x38646d(0x1ee)]+_0x59dfa4[_0x38646d(0x1e6)];}return _0x3a09fa;}return await _0x914392(_0x63d59f),null;});},async 'add'(_0x1a6801,_0x375721,_0x3f9193){return _0x8a94b9(async()=>{const _0xe30912=_0x2d84;if(!_0x79e3e7)return;const _0x48d3b5=_0x375721 instanceof Float32Array?_0x375721:new Float32Array(_0x375721),_0x438152=_0xd485ae(_0x48d3b5);if(_0x4d24b4[_0xe30912(0x1a8)](_0x1a6801)===_0x438152)return;_0x19d79f(_0x1a6801,_0x48d3b5,_0x438152),_0x481dcd++,_0x481dcd>=_0x28d43f['snapshotEveryChanges']&&await _0x412b9c(_0x31b616());});},async 'remove'(_0x41e6ff){return _0x8a94b9(async()=>{if(!_0x79e3e7)return;if(_0x20903c(_0x41e6ff))_0x481dcd++;});},'search'(_0x36cca3,{limit:limit=0xa,efSearch:_0x7afc31}={}){const _0x5e74e9=_0x2d4734;if(!_0x79e3e7)return[];if(Number[_0x5e74e9(0x187)](_0x7afc31))_0x79e3e7[_0x5e74e9(0x1e8)](_0x7afc31);const _0x1ebebe=Math[_0x5e74e9(0x1d7)](limit,_0x79e3e7['getCurrentCount']()||0x1),{neighbors:_0x21fa2e,distances:_0x28526d}=_0x79e3e7[_0x5e74e9(0x1cc)](Array[_0x5e74e9(0x1f1)](_0x36cca3),_0x1ebebe),_0x5c927a=[];for(let _0x3d87e0=0x0;_0x3d87e0<_0x21fa2e[_0x5e74e9(0x21f)];_0x3d87e0++){const _0x36e0f8=_0x4d24b4['keyForLabel'](_0x21fa2e[_0x3d87e0]);if(!_0x36e0f8)continue;const _0x390105=_0x28d43f[_0x5e74e9(0x1df)]===_0x5e74e9(0x1f6)?Math[_0x5e74e9(0x22d)](0x0,0x1-_0x28526d[_0x3d87e0]):0x1/(0x1+_0x28526d[_0x3d87e0]);_0x5c927a[_0x5e74e9(0x1b6)]({'key':_0x36e0f8,'score':_0x390105});}return _0x5c927a;},async 'snapshot'(_0x21d39e){return _0x8a94b9(()=>_0x412b9c(_0x21d39e??_0x31b616()));},async 'rebuild'(_0x1566d5){return _0x8a94b9(()=>{if(_0x1566d5!=null)_0x60e80e=_0x1566d5;return _0x54dea5(_0x1566d5??_0x60e80e);});},async 'stop'(){const _0x59a1e8=_0x2d4734;return _0x8a94b9(()=>_0x481dcd>0x0||!_0x2dbad3[_0x59a1e8(0x1da)]()?_0x412b9c(_0x31b616()):![]);},'count'(){return _0x4d24b4['size']();},'info'(){const _0x2611ae=_0x2d4734;return{'algorithm':_0x2611ae(0x202),'metric':_0x28d43f[_0x2611ae(0x1df)],'M':_0x28d43f['M'],'efConstruction':_0x28d43f[_0x2611ae(0x1b5)],'efSearch':_0x28d43f['efSearch'],'maxElements':_0x79e3e7?.[_0x2611ae(0x1d8)]()??_0x28d43f[_0x2611ae(0x166)],'count':_0x4d24b4['size'](),'changesSince':_0x481dcd,'snapshotDir':_0x347adb,'latestSnapshot':_0x2dbad3[_0x2611ae(0x1da)]()??null};}};},hnsw;}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x16f875(_0x2edc8c={}){const _0x5cef76=new Map();return{async 'load'(_0x31f29b){const _0xb4b4b5=_0x2d84;_0x5cef76[_0xb4b4b5(0x205)]();if(_0x31f29b)for(const {key:_0x4f4158,vector:_0x33c97b}of await _0x31f29b()){_0x5cef76[_0xb4b4b5(0x1ba)](_0x4f4158,_0x33c97b);}},async 'add'(_0x5daafc,_0x1f6850,_0x838ddf){const _0xee981b=_0x2d84;_0x5cef76[_0xee981b(0x1ba)](_0x5daafc,_0x1f6850);},async 'remove'(_0x30f7cc){const _0x464815=_0x2d84;_0x5cef76[_0x464815(0x16c)](_0x30f7cc);},'search'(_0x21dce8,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x25f799=_0x2d84,_0x5a9546=[];for(const [_0x29a4c5,_0x5decd5]of _0x5cef76){const _0x11be6b=_0x15f014(_0x21dce8,_0x5decd5);if(_0x11be6b>=threshold)_0x5a9546['push']({'key':_0x29a4c5,'score':_0x11be6b});}return _0x5a9546['sort']((_0x5eb0e7,_0x2bc023)=>_0x2bc023[_0x25f799(0x177)]-_0x5eb0e7['score']),_0x5a9546[_0x25f799(0x23f)](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x36c4e5){const _0xed4006=_0x2d84;await this[_0xed4006(0x23c)](_0x36c4e5);},async 'stop'(){},'count'(){const _0x5c4da1=_0x2d84;return _0x5cef76[_0x5c4da1(0x1d2)];},'info'(){const _0x504eb3=_0x2d84;return{'algorithm':_0x504eb3(0x189),'count':_0x5cef76[_0x504eb3(0x1d2)]};}};};function _0x15f014(_0x1e568a,_0x449640){const _0x1b164d=_0x2d84;let _0x2dd384=0x0,_0x50430a=0x0,_0x663a19=0x0;for(let _0x10e6d8=0x0;_0x10e6d8<_0x1e568a[_0x1b164d(0x21f)];_0x10e6d8++){_0x2dd384+=_0x1e568a[_0x10e6d8]*_0x449640[_0x10e6d8],_0x50430a+=_0x1e568a[_0x10e6d8]*_0x1e568a[_0x10e6d8],_0x663a19+=_0x449640[_0x10e6d8]*_0x449640[_0x10e6d8];}const _0x5ed06a=Math[_0x1b164d(0x214)](_0x50430a)*Math[_0x1b164d(0x214)](_0x663a19);return _0x5ed06a===0x0?0x0:_0x2dd384/_0x5ed06a;}return flat;}var writerLock,hasRequiredWriterLock;function requireWriterLock(){if(hasRequiredWriterLock)return writerLock;hasRequiredWriterLock=0x1;const _0xe50081=require$$0,_0xad5568=require$$1,_0x44dc2c=require$$3;return writerLock=function _0xc2395d(_0x506a19,{maxAgeMs:maxAgeMs=0x3a98,heartbeatMs:heartbeatMs=0x1388,onLost:onLost=null}={}){const _0x4312c3=_0x2d84,_0x203edd=_0xad5568[_0x4312c3(0x20c)](_0x506a19,'WRITER.LOCK'),_0x41065f=_0x44dc2c['randomBytes'](0x8)[_0x4312c3(0x16f)](_0x4312c3(0x20d));let _0x41dc27=![],_0x3f94ca=null;const _0x1b7370=()=>JSON[_0x4312c3(0x174)]({'pid':process[_0x4312c3(0x1db)],'token':_0x41065f,'at':Date['now']()});function _0x185a18(){const _0x16b2b7=_0x4312c3;try{return JSON[_0x16b2b7(0x1e9)](_0xe50081[_0x16b2b7(0x188)](_0x203edd,_0x16b2b7(0x179)));}catch(_0xb48cf){return _0xb48cf?.[_0x16b2b7(0x1e3)]===_0x16b2b7(0x16a)?null:{'unreadable':!![]};}}function _0x592a66(){const _0x10398b=_0x4312c3;try{const _0xc6c378=_0xe50081['openSync'](_0x203edd,'wx');try{_0xe50081['writeFileSync'](_0xc6c378,_0x1b7370());}finally{_0xe50081[_0x10398b(0x240)](_0xc6c378);}return!![];}catch(_0x4f67f6){if(_0x4f67f6?.[_0x10398b(0x1e3)]===_0x10398b(0x1c2))return![];throw _0x4f67f6;}}function _0x35fd65(_0x1930af){const _0x101617=_0x4312c3;if(!_0x1930af)return!![];if(_0x1930af[_0x101617(0x1bc)])return!![];return Date[_0x101617(0x1ff)]()-(_0x1930af['at']??0x0)>=maxAgeMs;}function _0x2cff93(){if(_0x3f94ca)clearInterval(_0x3f94ca);_0x3f94ca=null;}function _0x2a116f(){_0x2cff93(),_0x3f94ca=setInterval(()=>{const _0x4790c8=_0x2d84,_0x4fad04=_0x185a18();if(_0x4fad04&&!_0x4fad04[_0x4790c8(0x1bc)]&&_0x4fad04['token']!==_0x41065f){_0x41dc27=![],_0x2cff93();try{onLost?.();}catch{}return;}try{_0xe50081[_0x4790c8(0x1f9)](_0x203edd,_0x1b7370());}catch{}},heartbeatMs),_0x3f94ca['unref']?.();}function _0x29cc34(){const _0x18655f=_0x185a18();return!!_0x18655f&&_0x18655f['token']===_0x41065f;}return{'path':_0x203edd,'token':_0x41065f,'acquire'(){const _0x28fc98=_0x4312c3,_0x3a4b63=_0x185a18();if(_0x3a4b63&&_0x3a4b63[_0x28fc98(0x1fe)]===_0x41065f){_0x41dc27=!![];if(!_0x3f94ca)_0x2a116f();return!![];}let _0x58c108=_0x592a66();if(!_0x58c108&&_0x35fd65(_0x185a18())){try{_0xe50081[_0x28fc98(0x18a)](_0x203edd);}catch{}_0x58c108=_0x592a66();}if(_0x58c108&&!_0x29cc34())_0x58c108=![];_0x41dc27=_0x58c108;if(_0x58c108)_0x2a116f();return _0x58c108;},'held'(){return _0x41dc27;},'isFree'(){const _0x119b01=_0x4312c3,_0x2a26f6=_0x185a18();if(_0x2a26f6&&_0x2a26f6[_0x119b01(0x1fe)]===_0x41065f)return![];return _0x35fd65(_0x2a26f6);},'release'(){const _0x2577f6=_0x4312c3;_0x2cff93();if(!_0x41dc27)return;_0x41dc27=![];if(_0x29cc34())try{_0xe50081[_0x2577f6(0x18a)](_0x203edd);}catch{}}};},writerLock;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x3f7825=require$$0,_0x155c3a=requireSnapshotStore(),_0x111234=requireLabelMap(),_0x5d580d=requireWriterLock(),{fingerprint:_0x5bc402,reconcileIndex:_0x1506e5}=requireIndexConvergence(),_0x5c9c9c=0x1;let _0x3555d2=null;function _0x5c9970(){const _0x497c9b=_0x2d84;if(_0x3555d2)return _0x3555d2;try{return _0x3555d2=require(_0x497c9b(0x234)),_0x3555d2;}catch(_0x2e24ed){const _0x205425=new Error(_0x497c9b(0x1d5)+(_0x497c9b(0x171)+process['versions'][_0x497c9b(0x241)]+'\x20on\x20'+process[_0x497c9b(0x23d)]+'/'+process[_0x497c9b(0x213)]+'.\x20')+_0x497c9b(0x217)+(_0x497c9b(0x212)+(_0x2e24ed?.[_0x497c9b(0x168)]||String(_0x2e24ed))));_0x205425['code']='USEARCH_BINDINGS_UNAVAILABLE',_0x205425[_0x497c9b(0x228)]=_0x2e24ed;throw _0x205425;}}function _0x171c90(_0x5cc736,_0x172679){const _0xce8d25=_0x2d84;switch(_0x5cc736){case _0xce8d25(0x1f6):return _0x172679[_0xce8d25(0x225)][_0xce8d25(0x224)];case'l2':return _0x172679['MetricKind'][_0xce8d25(0x1ef)];case'ip':return _0x172679['MetricKind']['IP'];default:return _0x172679[_0xce8d25(0x225)][_0xce8d25(0x224)];}}return usearch=function _0x3152eb(_0xb59072={},{dims:_0x32473d,dir:_0x3ea71d,fetchAll:fetchAll=null,onChange:onChange=null}={}){const _0x52ce53=_0x2d84,_0x3c9bdc=_0x5c9970();if(!_0x32473d||_0x32473d<=0x0)throw new Error('usearch\x20algorithm\x20requires\x20dims\x20>\x200');if(!_0x3ea71d)throw new Error(_0x52ce53(0x197));const _0x417b8f={'metric':_0xb59072['metric']??_0x52ce53(0x1f6),'connectivity':_0xb59072[_0x52ce53(0x1c7)]??0x10,'expansionAdd':_0xb59072[_0x52ce53(0x20a)]??0x80,'expansionSearch':_0xb59072[_0x52ce53(0x1fd)]??0x40,'snapshotEveryChanges':_0xb59072[_0x52ce53(0x22c)]??0xc350,'snapshotMaxLagMs':_0xb59072[_0x52ce53(0x1e2)]??0x2710,'keepSnapshots':_0xb59072['keepSnapshots']??0x2,'tmpMaxAgeMs':_0xb59072[_0x52ce53(0x1bf)]??0x6*0x36ee80,'heartbeatIntervalMs':_0xb59072['heartbeatIntervalMs']??0x1388,'writerLockMaxAgeMs':_0xb59072[_0x52ce53(0x194)]??0x3a98,'viewRefreshMs':_0xb59072[_0x52ce53(0x1cf)]??0x3e8},_0xdd6b29=new _0x155c3a({'dir':_0x3ea71d,'keepSnapshots':_0x417b8f[_0x52ce53(0x238)]}),_0x175485=_0x5d580d(_0x3ea71d,{'maxAgeMs':_0x417b8f['writerLockMaxAgeMs'],'heartbeatMs':_0x417b8f[_0x52ce53(0x1b0)],'onLost':()=>{const _0x1c996b=_0x52ce53;_0x351773(_0xf55ec9)[_0x1c996b(0x1f2)](()=>{});}});let _0x7d20a7=new _0x111234(),_0x543918=null,_0x149e2b=0x0,_0x18a34e=null,_0x30b4c7=![],_0x5274bf=![],_0x11b35b=null,_0x43a35d=0x0,_0x137947=null,_0x1adb6a=0x0,_0x19729d=![],_0x53ca0a=Promise[_0x52ce53(0x21b)]();const _0x351773=_0x22156a=>{const _0x1891b5=_0x52ce53,_0x2df6bf=_0x53ca0a[_0x1891b5(0x1ed)](_0x22156a);return _0x53ca0a=_0x2df6bf['catch'](()=>{}),_0x2df6bf;},_0x4954b3=()=>{try{onChange?.();}catch{}};function _0x3d1af6(){const _0xe61000=_0x52ce53;return new _0x3c9bdc[(_0xe61000(0x1dc))]({'dimensions':_0x32473d,'metric':_0x171c90(_0x417b8f[_0xe61000(0x1df)],_0x3c9bdc),'quantization':_0x3c9bdc[_0xe61000(0x1c1)][_0xe61000(0x18f)],'connectivity':_0x417b8f[_0xe61000(0x1c7)],'expansion_add':_0x417b8f[_0xe61000(0x20a)],'expansion_search':_0x417b8f['expansionSearch'],'multi':![]});}function _0x3a6fb7(_0x1864d0){return _0x1864d0 instanceof Float32Array?_0x1864d0:new Float32Array(_0x1864d0);}function _0x3a5ac2(){const _0x3b5828=_0x52ce53;if(fetchAll)return fetchAll();if(_0x18a34e)return _0x18a34e();return Promise[_0x3b5828(0x21b)](null);}function _0x5d8e9b(_0x1ff191,_0x77177e,_0x2a2725){const _0x2f33b0=_0x52ce53,_0x1ca197=_0x7d20a7['labelForExisting'](_0x1ff191);if(_0x1ca197!==undefined)try{_0x543918[_0x2f33b0(0x17d)](BigInt(_0x1ca197));}catch{}const _0x342c35=_0x7d20a7['labelForEphemeral'](_0x1ff191);_0x543918[_0x2f33b0(0x223)](BigInt(_0x342c35),_0x77177e),_0x7d20a7['setFingerprint'](_0x1ff191,_0x2a2725??_0x5bc402(_0x77177e));}function _0x5df581(_0x3adb70){const _0x1ead1c=_0x52ce53,_0x2a729e=_0x7d20a7['labelForExisting'](_0x3adb70);if(_0x2a729e===undefined)return![];try{_0x543918[_0x1ead1c(0x17d)](BigInt(_0x2a729e));}catch{}return _0x7d20a7[_0x1ead1c(0x221)](_0x3adb70),!![];}function _0x1b76a8(_0x308419){const _0x2feb32=_0x52ce53;_0x7d20a7=new _0x111234(),_0x543918=_0x3d1af6();for(const {key:_0x5cc6e5,vector:_0x581a07}of _0x308419??[]){if(!(_0x581a07 instanceof Float32Array)||_0x581a07[_0x2feb32(0x21f)]!==_0x32473d)continue;_0x5d8e9b(_0x5cc6e5,_0x581a07);}_0x149e2b=0x0;}function _0x4b2277(){const _0x4fdfb3=_0x52ce53;return Math[_0x4fdfb3(0x22d)](Date[_0x4fdfb3(0x1ff)](),_0xdd6b29[_0x4fdfb3(0x1a4)]()+0x1);}function _0x41d488(){if(_0x11b35b)clearTimeout(_0x11b35b);_0x11b35b=null;}function _0x4c8f6b(){const _0x4205e2=_0x52ce53;if(!_0x417b8f[_0x4205e2(0x1e2)]||_0x11b35b||!_0x5274bf||_0x149e2b<=0x0)return;const _0x360952=Math[_0x4205e2(0x22d)](_0x417b8f[_0x4205e2(0x1e2)],0xa*_0x43a35d);_0x11b35b=setTimeout(()=>{const _0x5da3ce=_0x4205e2;_0x11b35b=null,_0x351773(async()=>{if(_0x5274bf&&_0x149e2b>0x0)await _0x4d0724();_0x4c8f6b(),_0x4954b3();})[_0x5da3ce(0x1f2)](()=>{});},_0x360952),_0x11b35b[_0x4205e2(0x1c5)]?.();}async function _0x4d0724(_0x5de075){const _0x199b9a=_0x52ce53;if(!_0x543918)return![];const _0x58668e=_0x5de075??_0x4b2277(),_0x5a6cd5=Date[_0x199b9a(0x1ff)](),_0x247ffe=await _0xdd6b29['publishSnapshot'](_0x58668e,async _0x3995c5=>{const _0x3b064c=_0x199b9a;_0x543918[_0x3b064c(0x1ce)](_0x3995c5[_0x3b064c(0x211)]),await _0x7d20a7['snapshotTo'](_0x3995c5[_0x3b064c(0x19f)]),_0x3f7825[_0x3b064c(0x1f9)](_0x3995c5['state'],JSON[_0x3b064c(0x174)]({'manifestVersion':_0x5c9c9c,'algorithm':_0x3b064c(0x234),'dims':_0x32473d,'metric':_0x417b8f[_0x3b064c(0x1df)],'clock':_0x58668e,'snapshotAt':Date[_0x3b064c(0x1ff)]()},null,0x2));},{'keep':_0x417b8f['keepSnapshots']});return _0x43a35d=Date[_0x199b9a(0x1ff)]()-_0x5a6cd5,_0x247ffe?.[_0x199b9a(0x22e)]&&(_0x149e2b=0x0,_0x41d488()),_0x247ffe?.[_0x199b9a(0x22e)]??![];}function _0x4ff402(){_0x149e2b++;if(_0x149e2b>=_0x417b8f['snapshotEveryChanges'])return _0x4d0724();return _0x4c8f6b(),null;}async function _0x19dbb3(){const _0x56a81f=_0x52ce53,_0x38c92a=_0xdd6b29[_0x56a81f(0x1da)]()||_0xdd6b29[_0x56a81f(0x1c4)]();if(!_0x38c92a)return null;let _0xaed38,_0x53ffd3=![];try{await _0xdd6b29[_0x56a81f(0x183)](_0x38c92a,async _0x15bb47=>{const _0x21646c=_0x56a81f;_0xaed38=JSON['parse'](_0x3f7825[_0x21646c(0x188)](_0x15bb47[_0x21646c(0x178)],_0x21646c(0x179)));if(_0xaed38[_0x21646c(0x1fb)]!==_0x5c9c9c||_0xaed38[_0x21646c(0x1d9)]!==_0x21646c(0x234)||_0xaed38[_0x21646c(0x231)]!==_0x32473d||_0xaed38[_0x21646c(0x1df)]!==_0x417b8f[_0x21646c(0x1df)]){_0xaed38=null;return;}const _0x26980b=new _0x111234();await _0x26980b['loadFrom'](_0x15bb47[_0x21646c(0x19f)]);const _0x1a8881=_0x3d1af6();_0x1a8881[_0x21646c(0x23c)](_0x15bb47[_0x21646c(0x211)]),_0x7d20a7=_0x26980b,_0x543918=_0x1a8881,_0x53ffd3=!![];});}catch{return null;}return _0x53ffd3?_0xaed38?.[_0x56a81f(0x1c9)]??0x0:null;}async function _0x4adee2(_0x5bc1c9){const _0x13edf1=_0x52ce53;_0x137947=null;const _0x5ca1f2=await _0x19dbb3();if(_0x5ca1f2!=null){_0x149e2b=0x0;if(_0x5bc1c9){if(!_0x7d20a7[_0x13edf1(0x242)])return _0x1b76a8(_0x5bc1c9),await _0x4d0724(),null;const _0x378ded=_0x1506e5(_0x7d20a7,_0x5bc1c9,_0x32473d,{'upsert':_0x5d8e9b,'remove':_0x5df581}),_0xc58851=_0x378ded[_0x13edf1(0x1c3)]+_0x378ded[_0x13edf1(0x1ee)]+_0x378ded['removed'];_0xc58851>0x0&&(_0x149e2b+=_0xc58851,await _0x4d0724());}return _0x5ca1f2;}_0x1b76a8(_0x5bc1c9??[]);if(_0x543918['size']()>0x0)await _0x4d0724();return null;}async function _0x534d8d(){_0x5274bf=!![],await _0x4adee2(await _0x3a5ac2());}async function _0xf55ec9(){const _0x422faa=_0x52ce53;if(!_0x5274bf)return;_0x5274bf=![],_0x41d488(),_0x149e2b=0x0;const _0x2811e6=_0xdd6b29[_0x422faa(0x1da)]()||_0xdd6b29[_0x422faa(0x1c4)]();await _0x475943(_0x2811e6),_0x4954b3();}async function _0x475943(_0x334141){const _0x3eb723=_0x52ce53;if(!_0x334141)return![];let _0x11aeb1=![];try{await _0xdd6b29[_0x3eb723(0x183)](_0x334141,async _0x2445bd=>{const _0x35abbd=_0x3eb723,_0x12a3a5=JSON[_0x35abbd(0x1e9)](_0x3f7825[_0x35abbd(0x188)](_0x2445bd['state'],_0x35abbd(0x179)));if(_0x12a3a5[_0x35abbd(0x1fb)]!==_0x5c9c9c||_0x12a3a5[_0x35abbd(0x1d9)]!=='usearch'||_0x12a3a5[_0x35abbd(0x231)]!==_0x32473d||_0x12a3a5['metric']!==_0x417b8f['metric'])return;const _0x230af7=new _0x111234();await _0x230af7[_0x35abbd(0x210)](_0x2445bd['labels']);const _0x27b00d=_0x3d1af6();_0x27b00d[_0x35abbd(0x23e)](_0x2445bd['index']),_0x543918=_0x27b00d,_0x7d20a7=_0x230af7,_0x137947=_0x334141,_0x11aeb1=!![];});}catch{}return _0x11aeb1;}function _0x13b679(){const _0x32b960=_0x52ce53,_0xc0ef04=Date['now']();if(_0xc0ef04-_0x1adb6a<_0x417b8f[_0x32b960(0x1cf)])return;_0x1adb6a=_0xc0ef04;if(_0x19729d)return;if(_0x175485[_0x32b960(0x17a)]()){_0x19729d=!![],_0x351773(async()=>{!_0x5274bf&&_0x30b4c7&&_0x175485['acquire']()&&(await _0x534d8d(),_0x4954b3());})[_0x32b960(0x1f2)](()=>{})['finally'](()=>{_0x19729d=![];});return;}const _0x2b6c62=_0xdd6b29[_0x32b960(0x1da)]()||_0xdd6b29[_0x32b960(0x1c4)]();if(!_0x2b6c62||_0x2b6c62===_0x137947)return;_0x19729d=!![],_0x351773(async()=>{if(!_0x5274bf&&await _0x475943(_0x2b6c62))_0x4954b3();})[_0x32b960(0x1f2)](()=>{})['finally'](()=>{_0x19729d=![];});}return{async 'load'(_0x4fb34c){return _0x351773(async()=>{const _0x2dc33a=_0x2d84;_0xdd6b29['cleanupTmpDirs']({'maxAgeMs':_0x417b8f[_0x2dc33a(0x1bf)]}),_0x18a34e=_0x4fb34c??null,_0x5274bf=_0x175485[_0x2dc33a(0x209)]();let _0x4fdd27=null;if(_0x5274bf)_0x4fdd27=await _0x4adee2(_0x4fb34c?await _0x4fb34c():null);else{const _0x4700e0=_0xdd6b29['readCurrentId']()||_0xdd6b29['latestSnapshotId']();await _0x475943(_0x4700e0);}return _0x30b4c7=!![],_0x4fdd27;});},async 'add'(_0x59f4ef,_0xe5560e,_0x4cbf96){return _0x351773(async()=>{const _0x39d4ec=_0x2d84;if(!_0x30b4c7)return;const _0x39f600=_0x3a6fb7(_0xe5560e);if(!_0x5274bf){if(!_0x175485[_0x39d4ec(0x209)]())return;await _0x534d8d();}if(!_0x543918)return;const _0x2256d4=_0x5bc402(_0x39f600);if(_0x7d20a7[_0x39d4ec(0x1a8)](_0x59f4ef)===_0x2256d4)return;_0x5d8e9b(_0x59f4ef,_0x39f600,_0x2256d4),await _0x4ff402();});},async 'remove'(_0x12e722){return _0x351773(async()=>{const _0x510dd3=_0x2d84;if(!_0x30b4c7)return;if(!_0x5274bf){if(!_0x175485[_0x510dd3(0x209)]())return;await _0x534d8d();}if(!_0x543918)return;if(_0x5df581(_0x12e722))await _0x4ff402();});},'search'(_0x26cdd9,{limit:limit=0xa}={}){const _0x1e1ed4=_0x52ce53;if(!_0x5274bf&&_0x30b4c7)_0x13b679();if(!_0x543918)return[];const _0x2be802=_0x543918[_0x1e1ed4(0x1d2)]();if(_0x2be802===0x0)return[];const _0x2c8285=Math[_0x1e1ed4(0x1d7)](limit,_0x2be802),_0x4c6bd4=_0x543918[_0x1e1ed4(0x1de)](_0x3a6fb7(_0x26cdd9),_0x2c8285,0x0),_0x22d6c1=[],_0x455581=_0x4c6bd4[_0x1e1ed4(0x1eb)],_0x48686c=_0x4c6bd4[_0x1e1ed4(0x1f4)];for(let _0x22da7d=0x0;_0x22da7d<_0x455581['length'];_0x22da7d++){const _0xe1306=_0x455581[_0x22da7d];if(_0xe1306===0xffffffffffffffffn)continue;const _0x33b24a=Number(_0xe1306),_0x5cdfb2=_0x7d20a7[_0x1e1ed4(0x170)](_0x33b24a);if(!_0x5cdfb2)continue;const _0x4862c9=_0x48686c[_0x22da7d];let _0x1bc978;if(_0x417b8f[_0x1e1ed4(0x1df)]===_0x1e1ed4(0x1f6))_0x1bc978=Math[_0x1e1ed4(0x22d)](0x0,0x1-_0x4862c9);else{if(_0x417b8f[_0x1e1ed4(0x1df)]==='ip')_0x1bc978=-_0x4862c9;else _0x1bc978=0x1/(0x1+_0x4862c9);}_0x22d6c1['push']({'key':_0x5cdfb2,'score':_0x1bc978});}return _0x22d6c1;},async 'snapshot'(_0x1a2dc9){return _0x351773(()=>_0x5274bf?_0x4d0724(_0x1a2dc9??undefined):![]);},async 'rebuild'(_0x48fce2){return _0x351773(async()=>{const _0x17ab7a=_0x2d84;if(_0x48fce2!=null)_0x18a34e=_0x48fce2;if(!_0x5274bf){if(!_0x175485[_0x17ab7a(0x209)]())return;_0x5274bf=!![];}const _0x14bf78=_0x48fce2?await _0x48fce2():await _0x3a5ac2();_0x1b76a8(_0x14bf78??[]),_0x30b4c7=!![],await _0x4d0724();});},async 'stop'(){return _0x351773(async()=>{const _0x582b20=_0x2d84;_0x41d488();if(_0x5274bf){if(_0x149e2b>0x0||!_0xdd6b29[_0x582b20(0x1da)]())await _0x4d0724();_0x175485['release']();}_0x5274bf=![],_0x30b4c7=![];});},'count'(){const _0x6992a6=_0x52ce53;return _0x7d20a7[_0x6992a6(0x1d2)]();},'info'(){const _0x5ae89e=_0x52ce53;return{'algorithm':_0x5ae89e(0x234),'role':_0x5274bf?_0x5ae89e(0x19c):'reader','metric':_0x417b8f[_0x5ae89e(0x1df)],'connectivity':_0x417b8f[_0x5ae89e(0x1c7)],'expansionAdd':_0x417b8f[_0x5ae89e(0x20a)],'expansionSearch':_0x417b8f[_0x5ae89e(0x1fd)],'snapshotEveryChanges':_0x417b8f[_0x5ae89e(0x22c)],'snapshotMaxLagMs':_0x417b8f[_0x5ae89e(0x1e2)],'count':_0x7d20a7['size'](),'size':_0x543918?.['size']?.()??0x0,'capacity':_0x543918?.[_0x5ae89e(0x21c)]?.()??0x0,'changesSince':_0x5274bf?_0x149e2b:null,'viewedSnapshot':_0x137947??null,'snapshotDir':_0x3ea71d,'latestSnapshot':_0xdd6b29[_0x5ae89e(0x1da)]()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0x144f87=_0x31c441;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x4cbaf6,workerData:_0x57378d}=require$$0$1,{algorithmName:_0x3b42c6,algorithmConfig:_0x3feafc,dims:_0x1feeda,dir:_0x1f8af4}=_0x57378d;let _0x445bfc=0x1;const _0x52892f=new Map();function _0x589a0e(){const _0x2e7a42=_0x445bfc++;return new Promise((_0x595598,_0x5848de)=>{const _0xb1e74b=_0x2d84;_0x52892f[_0xb1e74b(0x1ba)](_0x2e7a42,{'resolve':_0x595598,'reject':_0x5848de}),_0x4cbaf6[_0xb1e74b(0x220)]({'op':_0xb1e74b(0x167),'fid':_0x2e7a42});});}const _0x3dec94={'dims':_0x1feeda,'dir':_0x1f8af4,'fetchAll':_0x589a0e,'onChange':()=>_0x2a8b92()};let _0x52b023;if(_0x3b42c6===_0x144f87(0x202))_0x52b023=requireHnsw()(_0x3feafc,_0x3dec94);else{if(_0x3b42c6===_0x144f87(0x189))_0x52b023=requireFlat()(_0x3feafc,_0x3dec94);else{if(_0x3b42c6===_0x144f87(0x234))_0x52b023=requireUsearch()(_0x3feafc,_0x3dec94);else throw new Error(_0x144f87(0x1ae)+_0x3b42c6+'\x22');}}function _0x2a8b92(){const _0x4704d6=_0x144f87;try{_0x4cbaf6[_0x4704d6(0x220)]({'op':_0x4704d6(0x20b),'count':_0x52b023['count'](),'info':_0x52b023[_0x4704d6(0x226)](),'memory':process[_0x4704d6(0x19e)]()});}catch{}}function _0x20d348(_0x55da20){const _0x46b533=_0x144f87;return(_0x55da20||[])[_0x46b533(0x1bb)](_0x325413=>({'key':_0x325413['key'],'vector':_0x325413[_0x46b533(0x163)]instanceof Float32Array?_0x325413[_0x46b533(0x163)]:new Float32Array(_0x325413[_0x46b533(0x163)])}));}return _0x4cbaf6['on'](_0x144f87(0x168),async _0x4ebb64=>{const _0x53c9d9=_0x144f87;if(_0x4ebb64['op']===_0x53c9d9(0x1e7)){const _0x33220c=_0x52892f[_0x53c9d9(0x19d)](_0x4ebb64['fid']);if(!_0x33220c)return;_0x52892f[_0x53c9d9(0x16c)](_0x4ebb64[_0x53c9d9(0x1c0)]);if(_0x4ebb64[_0x53c9d9(0x222)])_0x33220c[_0x53c9d9(0x237)](new Error(_0x4ebb64[_0x53c9d9(0x222)]));else _0x33220c[_0x53c9d9(0x21b)](_0x20d348(_0x4ebb64[_0x53c9d9(0x1a5)]));return;}const {id:_0x1664a3,op:_0x2fcb72,args:_0x36ce92}=_0x4ebb64;try{let _0xe6e6e3;switch(_0x2fcb72){case _0x53c9d9(0x23c):{_0xe6e6e3=await _0x52b023[_0x53c9d9(0x23c)](_0x36ce92['hasRows']?_0x589a0e:null),_0x2a8b92();break;}case'add':{const _0x272376=_0x36ce92[_0x53c9d9(0x163)]instanceof Float32Array?_0x36ce92[_0x53c9d9(0x163)]:new Float32Array(_0x36ce92[_0x53c9d9(0x163)]);await _0x52b023[_0x53c9d9(0x223)](_0x36ce92[_0x53c9d9(0x17c)],_0x272376,_0x36ce92[_0x53c9d9(0x1c9)]??undefined),_0x2a8b92(),_0xe6e6e3=null;break;}case'remove':{await _0x52b023[_0x53c9d9(0x17d)](_0x36ce92[_0x53c9d9(0x17c)]),_0x2a8b92(),_0xe6e6e3=null;break;}case'search':{const _0x143752=_0x36ce92[_0x53c9d9(0x1f5)]instanceof Float32Array?_0x36ce92['queryVec']:new Float32Array(_0x36ce92['queryVec']);_0xe6e6e3=_0x52b023[_0x53c9d9(0x1de)](_0x143752,_0x36ce92['opts']||{});break;}case _0x53c9d9(0x230):{_0xe6e6e3=await _0x52b023['snapshot'](_0x36ce92[_0x53c9d9(0x1c9)]),_0x2a8b92();break;}case _0x53c9d9(0x19a):{const _0x3a5271=_0x20d348(_0x36ce92[_0x53c9d9(0x1a5)]);await _0x52b023['rebuild'](async()=>_0x3a5271),_0x2a8b92(),_0xe6e6e3=null;break;}case _0x53c9d9(0x181):{await _0x52b023[_0x53c9d9(0x181)](),_0x2a8b92(),_0xe6e6e3=null;break;}case'count':{_0xe6e6e3=_0x52b023[_0x53c9d9(0x193)]();break;}case _0x53c9d9(0x226):{_0xe6e6e3=_0x52b023[_0x53c9d9(0x226)]();break;}default:throw new Error(_0x53c9d9(0x1a7)+_0x2fcb72+'\x22');}_0x4cbaf6[_0x53c9d9(0x220)]({'id':_0x1664a3,'result':_0xe6e6e3});}catch(_0x119725){_0x4cbaf6['postMessage']({'id':_0x1664a3,'error':{'message':_0x119725?.[_0x53c9d9(0x168)]||String(_0x119725),'code':_0x119725?.['code']}});}}),_0x4cbaf6[_0x144f87(0x220)]({'op':_0x144f87(0x1f0)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module[_0x31c441(0x1b4)]=algorithmWorkerThread;
|
|
1
|
+
'use strict';const _0x591ed2=_0x50b8;(function(_0xd8bed7,_0x1156b2){const _0x3276d0=_0x50b8,_0x45bedf=_0xd8bed7();while(!![]){try{const _0x24db1b=parseInt(_0x3276d0(0x25c))/0x1*(parseInt(_0x3276d0(0x296))/0x2)+-parseInt(_0x3276d0(0x269))/0x3*(-parseInt(_0x3276d0(0x289))/0x4)+-parseInt(_0x3276d0(0x1f0))/0x5+parseInt(_0x3276d0(0x23c))/0x6*(parseInt(_0x3276d0(0x248))/0x7)+parseInt(_0x3276d0(0x28b))/0x8*(parseInt(_0x3276d0(0x240))/0x9)+-parseInt(_0x3276d0(0x203))/0xa*(-parseInt(_0x3276d0(0x29f))/0xb)+parseInt(_0x3276d0(0x28a))/0xc*(-parseInt(_0x3276d0(0x224))/0xd);if(_0x24db1b===_0x1156b2)break;else _0x45bedf['push'](_0x45bedf['shift']());}catch(_0x49cbe4){_0x45bedf['push'](_0x45bedf['shift']());}}}(_0x414d,0x98ea6));var require$$0$1=require('worker_threads'),require$$0=require('fs'),require$$1=require(_0x591ed2(0x279)),require$$2=require('os'),require$$3=require(_0x591ed2(0x1ed));function getDefaultExportFromCjs(_0x2c2cee){const _0x2ba976=_0x591ed2;return _0x2c2cee&&_0x2c2cee[_0x2ba976(0x23a)]&&Object['prototype']['hasOwnProperty']['call'](_0x2c2cee,_0x2ba976(0x242))?_0x2c2cee[_0x2ba976(0x242)]:_0x2c2cee;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x4219bf=_0x591ed2;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x5b79ed=require$$0,_0x3ac559=require$$1,_0x28fe05=require$$2,_0xa6e0a4=require$$3;function _0x1dd6b0(){const _0x1eb075=_0x50b8;return Date[_0x1eb075(0x20b)]();}function _0x231d4a(_0x5c4808){const _0x79ba30=_0x50b8;try{return _0x5b79ed[_0x79ba30(0x25f)](_0x5c4808);}catch{return![];}}function _0x3f6acd(_0x1608aa){const _0x985920=_0x50b8;try{return _0x5b79ed[_0x985920(0x1e2)](_0x1608aa,_0x985920(0x21e));}catch{return null;}}function _0x1cc405(_0x2f71c2,_0x1b23db){const _0x3ddb21=_0x50b8,_0x25d72e=_0x2f71c2+_0x3ddb21(0x2a7)+_0xa6e0a4['randomBytes'](0x6)[_0x3ddb21(0x1ff)]('hex');_0x5b79ed[_0x3ddb21(0x21b)](_0x25d72e,_0x1b23db),_0x5b79ed[_0x3ddb21(0x27d)](_0x25d72e,_0x2f71c2);}function _0x13c78f(_0x599921,_0x1c64e2=0x10){const _0xa846f=_0x50b8,_0x120618=String(Math[_0xa846f(0x251)](0x0,Math[_0xa846f(0x24e)](_0x599921||0x0)));return _0x120618[_0xa846f(0x295)]>=_0x1c64e2?_0x120618:'0'[_0xa846f(0x1e8)](_0x1c64e2-_0x120618[_0xa846f(0x295)])+_0x120618;}return snapshotStore=class _0x10dcec{constructor({dir:_0x1ef318,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x34c42c=_0x50b8;if(!_0x1ef318)throw new Error('SnapshotStore\x20requires\x20dir');this[_0x34c42c(0x270)]=_0x1ef318,this[_0x34c42c(0x266)]=_0x3ac559['join'](_0x1ef318,'snapshots'),this[_0x34c42c(0x28e)]=_0x3ac559[_0x34c42c(0x200)](_0x1ef318,_0x34c42c(0x2a1)),this[_0x34c42c(0x204)]=_0x3ac559[_0x34c42c(0x200)](_0x1ef318,_0x34c42c(0x2ac)),this[_0x34c42c(0x229)]=keepSnapshots,this[_0x34c42c(0x286)]=log,_0x5b79ed[_0x34c42c(0x262)](this[_0x34c42c(0x270)],{'recursive':!![]}),_0x5b79ed[_0x34c42c(0x262)](this[_0x34c42c(0x266)],{'recursive':!![]});}[_0x4219bf(0x1fc)](_0x42d5e9){const _0x5885f5=_0x4219bf;return _0x3ac559[_0x5885f5(0x200)](this[_0x5885f5(0x266)],_0x42d5e9);}[_0x4219bf(0x298)](_0x488ea9){const _0x52e686=_0x4219bf,_0x5d632f=this['_snapshotDir'](_0x488ea9);return{'dir':_0x5d632f,'index':_0x3ac559['join'](_0x5d632f,_0x52e686(0x28c)),'labels':_0x3ac559[_0x52e686(0x200)](_0x5d632f,_0x52e686(0x268)),'state':_0x3ac559['join'](_0x5d632f,_0x52e686(0x201))};}[_0x4219bf(0x2ad)](){const _0x627a1e=_0x4219bf;if(!_0x231d4a(this[_0x627a1e(0x28e)]))return null;const _0x33632d=_0x3f6acd(this[_0x627a1e(0x28e)]);if(!_0x33632d)return null;const _0x2fba3a=String(_0x33632d)[_0x627a1e(0x25b)]();return _0x2fba3a||null;}[_0x4219bf(0x1fa)](){const _0x37f2eb=_0x4219bf,_0x24f395=this[_0x37f2eb(0x2ad)]();if(!_0x24f395)return 0x0;const _0x440bb4=Number(_0x24f395);return Number[_0x37f2eb(0x257)](_0x440bb4)?_0x440bb4:0x0;}[_0x4219bf(0x213)](){const _0x44c281=_0x4219bf;try{return _0x5b79ed[_0x44c281(0x21c)](this['snapshotsDir'],{'withFileTypes':!![]})[_0x44c281(0x2ab)](_0x3c5ea5=>_0x3c5ea5['isDirectory']())['map'](_0x940c3b=>_0x940c3b[_0x44c281(0x23d)])[_0x44c281(0x2ab)](_0x5a6a5e=>!_0x5a6a5e[_0x44c281(0x22b)](_0x44c281(0x2a7)))['filter'](_0x558be5=>!_0x558be5[_0x44c281(0x22b)]('_tmp-'))[_0x44c281(0x226)]();}catch{return[];}}[_0x4219bf(0x2a9)](){const _0x4821d7=_0x4219bf,_0x95b033=this[_0x4821d7(0x2ad)]();if(_0x95b033)return _0x95b033;const _0x5ad5c3=this['listSnapshotIds']();if(!_0x5ad5c3[_0x4821d7(0x295)])return null;return _0x5ad5c3[_0x5ad5c3[_0x4821d7(0x295)]-0x1];}[_0x4219bf(0x265)]({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0xb5ad91=_0x4219bf;let _0x19feaa;try{_0x19feaa=_0x5b79ed[_0xb5ad91(0x21c)](this[_0xb5ad91(0x266)],{'withFileTypes':!![]});}catch{return;}const _0xd3f62f=_0x1dd6b0()-maxAgeMs;for(const _0x41d8c4 of _0x19feaa){if(!_0x41d8c4['isDirectory']())continue;const _0x301dda=_0x41d8c4[_0xb5ad91(0x23d)];if(!_0x301dda['startsWith']('.tmp-')&&!_0x301dda[_0xb5ad91(0x22b)](_0xb5ad91(0x23f)))continue;const _0x5d0da5=_0x3ac559['join'](this[_0xb5ad91(0x266)],_0x301dda);try{const _0x165138=_0x5b79ed['statSync'](_0x5d0da5);if(_0x165138[_0xb5ad91(0x23e)]>_0xd3f62f)continue;}catch{}try{_0x5b79ed[_0xb5ad91(0x280)](_0x5d0da5,{'recursive':!![],'force':!![]});}catch{}}}[_0x4219bf(0x250)]({keep:keep=null}={}){const _0x42fa8f=_0x4219bf,_0x5cc530=Math[_0x42fa8f(0x251)](0x1,Math[_0x42fa8f(0x24e)](keep??this['keepSnapshots']??0x3)),_0x267878=this[_0x42fa8f(0x213)]();if(_0x267878['length']<=_0x5cc530)return;const _0x1eb236=this[_0x42fa8f(0x2ad)](),_0x1cf8ab=_0x267878[_0x42fa8f(0x283)](0x0,Math[_0x42fa8f(0x251)](0x0,_0x267878[_0x42fa8f(0x295)]-_0x5cc530));for(const _0x11b65d of _0x1cf8ab){if(_0x1eb236&&_0x11b65d===_0x1eb236)continue;const _0x11f2e6=this[_0x42fa8f(0x1fc)](_0x11b65d);try{_0x5b79ed[_0x42fa8f(0x280)](_0x11f2e6,{'recursive':!![],'force':!![]});}catch{}}}async[_0x4219bf(0x27c)](_0x1e51e4,_0x46bf57){const _0x4d329d=_0x4219bf;if(!_0x1e51e4)throw new Error(_0x4d329d(0x22c));const _0x845c27=this[_0x4d329d(0x298)](_0x1e51e4);if(!_0x231d4a(_0x845c27[_0x4d329d(0x254)])||!_0x231d4a(_0x845c27['labels'])||!_0x231d4a(_0x845c27[_0x4d329d(0x221)]))throw new Error(_0x4d329d(0x244)+_0x1e51e4);const _0x28d433=await _0x46bf57(_0x845c27);return _0x28d433||{};}async[_0x4219bf(0x272)](_0x1f7ffb,_0x9c1593,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x41a103=_0x4219bf,_0x3960aa=Number(_0x1f7ffb);if(!Number['isFinite'](_0x3960aa)||_0x3960aa<0x0)throw new Error(_0x41a103(0x2a8));const _0x9ecb27=_0x13c78f(_0x3960aa),_0x4275ad=this[_0x41a103(0x1fc)](_0x9ecb27),_0x5afa14=_0x3ac559[_0x41a103(0x200)](this[_0x41a103(0x266)],_0x41a103(0x2a7)+_0x9ecb27+'-'+_0xa6e0a4[_0x41a103(0x263)](0x6)[_0x41a103(0x1ff)](_0x41a103(0x1ee)));_0x5b79ed[_0x41a103(0x262)](_0x5afa14,{'recursive':!![]});const _0x504996={'dir':_0x5afa14,'index':_0x3ac559['join'](_0x5afa14,_0x41a103(0x28c)),'labels':_0x3ac559[_0x41a103(0x200)](_0x5afa14,_0x41a103(0x268)),'state':_0x3ac559[_0x41a103(0x200)](_0x5afa14,_0x41a103(0x201))};await _0x9c1593(_0x504996,{'id':_0x9ecb27,'clock':_0x3960aa});const _0x368c42=JSON[_0x41a103(0x24d)]({'pid':process['pid'],'host':_0x28fe05[_0x41a103(0x253)](),'at':_0x1dd6b0()}),_0x2d08fc=_0x1dd6b0();let _0x522fd0=null;const _0x488086=()=>{const _0x17c29a=_0x41a103;try{const _0x27cc4a=JSON[_0x17c29a(0x217)](_0x5b79ed[_0x17c29a(0x1e2)](this[_0x17c29a(0x204)],_0x17c29a(0x21e)));if(_0x27cc4a['at']&&_0x1dd6b0()-_0x27cc4a['at']>staleLockMaxAgeMs){const _0x245ddc=_0x1dd6b0()-_0x27cc4a['at'],_0x44a08d=_0x17c29a(0x2b1)+Math[_0x17c29a(0x20e)](_0x245ddc/0x3e8)+'s,\x20pid:\x20'+_0x27cc4a[_0x17c29a(0x26e)]+_0x17c29a(0x2a4)+_0x27cc4a[_0x17c29a(0x1e5)]+_0x17c29a(0x2af)+_0x17c29a(0x27a);this[_0x17c29a(0x286)]?.['warn']?this['log']['warn'](_0x44a08d):console[_0x17c29a(0x1ef)](_0x17c29a(0x222),_0x44a08d);try{_0x5b79ed[_0x17c29a(0x1e1)](this[_0x17c29a(0x204)]);}catch{}return!![];}}catch{try{_0x5b79ed[_0x17c29a(0x1e1)](this[_0x17c29a(0x204)]);}catch{}}return![];},_0x36d95f=()=>{const _0x25e020=_0x41a103;try{return _0x522fd0=_0x5b79ed[_0x25e020(0x29b)](this['lockPath'],'wx'),_0x5b79ed[_0x25e020(0x21b)](_0x522fd0,_0x368c42),!![];}catch(_0x34064d){if(_0x34064d&&_0x34064d[_0x25e020(0x1f6)]==='EEXIST')return![];throw _0x34064d;}};if(!_0x36d95f()){_0x488086(),_0x36d95f();if(_0x522fd0==null&&lockTimeoutMs>0x0)while(_0x1dd6b0()-_0x2d08fc<lockTimeoutMs){await new Promise(_0x4c8288=>setTimeout(_0x4c8288,0x19));if(_0x36d95f())break;_0x488086();}}if(_0x522fd0==null){try{_0x5b79ed[_0x41a103(0x280)](_0x5afa14,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':'lock_busy'};}try{const _0x440cb8=this[_0x41a103(0x1fa)]();if(_0x3960aa<=_0x440cb8){try{_0x5b79ed[_0x41a103(0x280)](_0x5afa14,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':'stale','currentClock':_0x440cb8};}if(!_0x231d4a(_0x4275ad))_0x5b79ed[_0x41a103(0x27d)](_0x5afa14,_0x4275ad);else try{_0x5b79ed['rmSync'](_0x5afa14,{'recursive':!![],'force':!![]});}catch{}return _0x1cc405(this[_0x41a103(0x28e)],_0x9ecb27+'\x0a'),this[_0x41a103(0x250)]({'keep':keep}),{'published':!![],'currentClock':_0x3960aa};}finally{try{_0x5b79ed['closeSync'](_0x522fd0);}catch{}try{_0x5b79ed[_0x41a103(0x1e1)](this[_0x41a103(0x204)]);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x4941de=_0x591ed2;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x5276d1=require$$0;class _0x456752{constructor(){const _0x4f93fb=_0x50b8;this[_0x4f93fb(0x22f)]=new Map(),this['labelToKey']=new Map(),this[_0x4f93fb(0x2b3)]=0x0,this[_0x4f93fb(0x233)]=0x0,this['keyToFp']=new Map(),this[_0x4f93fb(0x223)]=!![];}async[_0x4941de(0x20c)](){const _0xae16a6=_0x4941de;this[_0xae16a6(0x22f)]=new Map(),this['labelToKey']=new Map(),this[_0xae16a6(0x239)]=new Map(),this[_0xae16a6(0x223)]=!![],this[_0xae16a6(0x2b3)]=0x0,this[_0xae16a6(0x233)]=0x0;}async['loadFrom'](_0x1b8690){const _0x488398=_0x4941de;if(!_0x1b8690||!_0x5276d1[_0x488398(0x25f)](_0x1b8690))return await this[_0x488398(0x20c)](),!![];let _0xddb22e;try{_0xddb22e=_0x5276d1[_0x488398(0x1e2)](_0x1b8690,_0x488398(0x21e));}catch{return await this[_0x488398(0x20c)](),!![];}let _0x42a9fc;try{_0x42a9fc=JSON['parse'](_0xddb22e);}catch{return await this['reset'](),!![];}const _0x2bddc6=Array['isArray'](_0x42a9fc?.[_0x488398(0x22d)])?_0x42a9fc[_0x488398(0x22d)]:[],_0x2721ab=Number['isInteger'](_0x42a9fc?.[_0x488398(0x2b3)])?_0x42a9fc[_0x488398(0x2b3)]:0x0,_0x31129e=new Map(),_0x2c99e4=new Map(),_0x294603=new Map(),_0x45c2a9=_0x42a9fc?.['version']>=0x2;let _0x941949=-0x1;for(const _0x56f217 of _0x2bddc6){if(!Array[_0x488398(0x1eb)](_0x56f217)||_0x56f217[_0x488398(0x295)]<0x2)continue;const _0x33e7db=Number(_0x56f217[0x0]),_0x41e181=String(_0x56f217[0x1]??'');if(!Number['isInteger'](_0x33e7db)||_0x33e7db<0x0)continue;if(!_0x41e181)continue;_0x31129e[_0x488398(0x24c)](_0x41e181,_0x33e7db),_0x2c99e4['set'](_0x33e7db,_0x41e181);if(_0x45c2a9&&typeof _0x56f217[0x2]===_0x488398(0x249))_0x294603['set'](_0x41e181,_0x56f217[0x2]);if(_0x33e7db>_0x941949)_0x941949=_0x33e7db;}return this['keyToLabel']=_0x31129e,this[_0x488398(0x252)]=_0x2c99e4,this[_0x488398(0x239)]=_0x294603,this[_0x488398(0x223)]=_0x45c2a9,this[_0x488398(0x2b3)]=Math['max'](_0x2721ab,_0x941949+0x1,0x0),this['_tombstoneCount']=0x0,!![];}[_0x4941de(0x22a)](_0xd45a50){const _0x55099a=_0x4941de;return this[_0x55099a(0x22f)][_0x55099a(0x245)](_0xd45a50);}[_0x4941de(0x1f7)](_0x3fa8f2){const _0x48c21c=_0x4941de;let _0x310aaa=this[_0x48c21c(0x22f)][_0x48c21c(0x245)](_0x3fa8f2);if(_0x310aaa!==undefined)return _0x310aaa;return _0x310aaa=this[_0x48c21c(0x2b3)]++,this[_0x48c21c(0x22f)][_0x48c21c(0x24c)](_0x3fa8f2,_0x310aaa),this[_0x48c21c(0x252)][_0x48c21c(0x24c)](_0x310aaa,_0x3fa8f2),_0x310aaa;}[_0x4941de(0x2b0)](_0x9481b6,_0x5a59e8){const _0x1f09fb=_0x4941de;if(_0x5a59e8==null)this['keyToFp'][_0x1f09fb(0x1ea)](_0x9481b6);else this[_0x1f09fb(0x239)][_0x1f09fb(0x24c)](_0x9481b6,_0x5a59e8);}['fingerprintOf'](_0x2f50f1){const _0x315938=_0x4941de;return this[_0x315938(0x239)]['get'](_0x2f50f1);}[_0x4941de(0x23b)](){const _0x42bb2e=_0x4941de;return this['keyToLabel'][_0x42bb2e(0x23b)]();}['tombstone'](_0x3e580b){const _0x219895=_0x4941de,_0xf1908b=this['keyToLabel'][_0x219895(0x245)](_0x3e580b);if(_0xf1908b===undefined)return;this[_0x219895(0x239)][_0x219895(0x1ea)](_0x3e580b),this['keyToLabel'][_0x219895(0x1ea)](_0x3e580b),this[_0x219895(0x252)]['delete'](_0xf1908b),this[_0x219895(0x233)]++;}[_0x4941de(0x1f5)](_0x3de0e9){const _0x4089d8=_0x4941de;return this[_0x4089d8(0x252)]['get'](_0x3de0e9)??null;}[_0x4941de(0x25e)](){const _0x295344=_0x4941de;return this[_0x295344(0x22f)][_0x295344(0x25e)];}['tombstoneCount'](){return this['_tombstoneCount'];}async['snapshotTo'](_0x558950){const _0x46a81d=_0x4941de,_0x5b0dde=_0x558950+_0x46a81d(0x243),_0x4abc5e=[];for(const [_0x3eec80,_0x59d533]of this['labelToKey'][_0x46a81d(0x22d)]()){const _0x559c27=this['keyToFp'][_0x46a81d(0x245)](_0x59d533);_0x4abc5e['push'](_0x559c27==null?[_0x3eec80,_0x59d533]:[_0x3eec80,_0x59d533,_0x559c27]);}_0x4abc5e[_0x46a81d(0x226)]((_0x499b21,_0x53725f)=>_0x499b21[0x0]-_0x53725f[0x0]);const _0x934722={'version':0x2,'nextLabel':this[_0x46a81d(0x2b3)],'entries':_0x4abc5e};_0x5276d1['writeFileSync'](_0x5b0dde,JSON[_0x46a81d(0x24d)](_0x934722)),_0x5276d1[_0x46a81d(0x27d)](_0x5b0dde,_0x558950);}}return labelMap=_0x456752,labelMap;}var indexConvergence,hasRequiredIndexConvergence;function requireIndexConvergence(){if(hasRequiredIndexConvergence)return indexConvergence;hasRequiredIndexConvergence=0x1;function _0x579d3c(_0x2c4e01){const _0x135aac=_0x50b8,_0x1992f4=new Uint32Array(_0x2c4e01[_0x135aac(0x1e3)],_0x2c4e01[_0x135aac(0x1e6)],_0x2c4e01[_0x135aac(0x295)]);let _0x1ff7bf=0x811c9dc5,_0x142cfa=0x9747b28c;for(let _0x1b0ca6=0x0;_0x1b0ca6<_0x1992f4[_0x135aac(0x295)];_0x1b0ca6++){const _0x58b5d1=_0x1992f4[_0x1b0ca6];_0x1ff7bf=Math['imul'](_0x1ff7bf^_0x58b5d1,0x1000193)>>>0x0;let _0x51b280=Math[_0x135aac(0x264)](_0x58b5d1,0xcc9e2d51);_0x51b280=_0x51b280<<0xf|_0x51b280>>>0x11,_0x142cfa=Math[_0x135aac(0x264)](_0x142cfa^Math[_0x135aac(0x264)](_0x51b280,0x1b873593),0x5)+0xe6546b64,_0x142cfa>>>=0x0;}return _0x142cfa=Math[_0x135aac(0x264)](_0x142cfa^_0x142cfa>>>0x10,0x85ebca6b)>>>0x0,(_0x1ff7bf>>>0x0)*0x100000+(_0x142cfa&0xfffff);}function _0xb1b5c5(_0x4bdeaf,_0x2d6455,_0x61f798,{upsert:_0x57d0c9,remove:_0x400d9f}){const _0x1b32e7=_0x50b8,_0x12f3ba=new Set();let _0x2bb2e0=0x0,_0x2627f9=0x0,_0x5c57dc=0x0;for(const {key:_0x2b4ace,vector:_0x81c7bf}of _0x2d6455){if(!(_0x81c7bf instanceof Float32Array)||_0x81c7bf['length']!==_0x61f798)continue;_0x12f3ba[_0x1b32e7(0x281)](_0x2b4ace);const _0x29eb8b=_0x579d3c(_0x81c7bf),_0x488ba5=_0x4bdeaf['labelForExisting'](_0x2b4ace)!==undefined;if(_0x488ba5&&_0x4bdeaf['fingerprintOf'](_0x2b4ace)===_0x29eb8b)continue;_0x57d0c9(_0x2b4ace,_0x81c7bf,_0x29eb8b);if(_0x488ba5)_0x2627f9++;else _0x2bb2e0++;}for(const _0x4e17a4 of[..._0x4bdeaf['keys']()]){if(_0x12f3ba[_0x1b32e7(0x1ec)](_0x4e17a4))continue;_0x400d9f(_0x4e17a4),_0x5c57dc++;}return{'added':_0x2bb2e0,'changed':_0x2627f9,'removed':_0x5c57dc};}return indexConvergence={'fingerprint':_0x579d3c,'reconcileIndex':_0xb1b5c5},indexConvergence;}function _0x414d(){const _0x5b9c6b=['error','filter','SNAPSHOT.LOCK','readCurrentId','writeIndexSync',').\x20','setFingerprint','Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20','resizeIndex','nextLabel','ceil','ScalarKind','platform','changed','isFree','reject','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20','unreadable','unlinkSync','readFileSync','buffer','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','host','byteOffset','then','repeat','memoryUsage','delete','isArray','has','crypto','hex','warn','4034235NlMwiu','fid','rebuild','efSearch','manifestVersion','keyForLabel','code','labelForEphemeral','efConstruction','getMaxElements','readCurrentClock','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','_snapshotDir','count','usearch\x20algorithm\x20requires\x20dims\x20>\x200','toString','join','state.json','tombstone','10070luNPIP','lockPath','metric','HNSW_BINDINGS_UNAVAILABLE','capacity','usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','vector','exports','now','reset','stop','round','postMessage','message','key','info','listSnapshotIds','writerLockMaxAgeMs','fingerprintOf','Index','parse','loadFrom','snapshotMaxLagMs','fetchAll','writeFileSync','readdirSync','F32','utf8','token','usearch','state','[SnapshotStore]','hasFingerprints','46215jccTNO','expansionSearch','sort','cause','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','keepSnapshots','labelForExisting','startsWith','snapshot\x20id\x20required','entries','search','keyToLabel','reader','distances','Original\x20error:\x20','_tombstoneCount','sync','searchKnn','HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','growFactor','release','keyToFp','__esModule','keys','457842FUxJPu','name','mtimeMs','_tmp-','2556ZeTfOe','sqrt','default','.tmp','snapshot\x20incomplete:\x20','get','hnsw','hnswlib-node','7EIrdLL','number','load','vectors','set','stringify','trunc','removed','prune','max','labelToKey','hostname','index','node','score','isFinite','MetricKind','ENOENT','maxElements','trim','491CGDwDK','viewRefreshMs','size','existsSync','catch','unref','mkdirSync','randomBytes','imul','cleanupTmpDirs','snapshotsDir','flat','labels.json','2793117jpFhar','readIndexSync','HierarchicalNSW','acquire','dims','pid','heartbeatIntervalMs','dir','writer','publishSnapshot','snapshot','markDelete','connectivity','queryVec','cosine','closeSync','path','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','remove','loadSnapshot','renameSync','labels','isInteger','rmSync','add','snapshotTo','slice','from','\x20on\x20','log','hasRows','tmpMaxAgeMs','4jiTQke','4716sCiBYW','4288uTsrnr','index.hnsw','setEf','currentPath','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20','ready','L2sq','fetchAllResult','clear','USEARCH_BINDINGS_UNAVAILABLE','length','2478GWdLVq','clock','_snapshotPaths','expansionAdd','finally','openSync','resolve','arch','push','11605tpnhxw','save','CURRENT','snapshotEveryChanges','published',',\x20host:\x20','versions','Cos','.tmp-','candidateClock\x20must\x20be\x20finite\x20>=\x200','latestSnapshotId'];_0x414d=function(){return _0x5b9c6b;};return _0x414d();}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x4f6e78=requireSnapshotStore(),_0x3579aa=requireLabelMap(),{fingerprint:_0x4edf74,reconcileIndex:_0x572340}=requireIndexConvergence(),_0x15f4fe=0x1;let _0x7e80ad=null;function _0x468691(){const _0x41f0df=_0x50b8;if(_0x7e80ad)return _0x7e80ad;try{return _0x7e80ad=require(_0x41f0df(0x247)),_0x7e80ad;}catch(_0x511198){const _0x2dc947=new Error(_0x41f0df(0x236)+('for\x20Node\x20'+process[_0x41f0df(0x2a5)][_0x41f0df(0x255)]+_0x41f0df(0x285)+process[_0x41f0df(0x1db)]+'/'+process[_0x41f0df(0x29d)]+'.\x20')+_0x41f0df(0x28f)+(_0x41f0df(0x232)+(_0x511198?.['message']||String(_0x511198))));_0x2dc947[_0x41f0df(0x1f6)]=_0x41f0df(0x206),_0x2dc947[_0x41f0df(0x227)]=_0x511198;throw _0x2dc947;}}return hnsw=function _0xfd0508(_0x1ec33d={},{dims:_0x288671,dir:_0x5a53d7}){const _0x3bfa97=_0x50b8,_0x21833b=_0x468691();if(!_0x288671||_0x288671<=0x0)throw new Error(_0x3bfa97(0x228));if(!_0x5a53d7)throw new Error(_0x3bfa97(0x1fb));const _0x509141={'metric':_0x1ec33d['metric']??'cosine','M':_0x1ec33d['M']??0x10,'efConstruction':_0x1ec33d[_0x3bfa97(0x1f8)]??0xc8,'efSearch':_0x1ec33d[_0x3bfa97(0x1f3)]??0x40,'maxElements':_0x1ec33d['maxElements']??0x400,'growFactor':_0x1ec33d['growFactor']??0x2,'snapshotEveryChanges':_0x1ec33d['snapshotEveryChanges']??0xc350,'keepSnapshots':_0x1ec33d[_0x3bfa97(0x229)]??0x2,'tmpMaxAgeMs':_0x1ec33d[_0x3bfa97(0x288)]??0x6*0x36ee80},_0x417cf4=new _0x4f6e78({'dir':_0x5a53d7,'keepSnapshots':_0x509141[_0x3bfa97(0x229)]}),_0x3a3c31=new _0x3579aa();let _0x39f3fe=null,_0x2c8029=0x0,_0x205e9e=null,_0x35cc52=Promise[_0x3bfa97(0x29c)]();const _0x14e6d0=_0x4a5e0c=>{const _0x2d9d70=_0x3bfa97,_0x172077=_0x35cc52[_0x2d9d70(0x1e7)](_0x4a5e0c);return _0x35cc52=_0x172077[_0x2d9d70(0x260)](()=>{}),_0x172077;};async function _0x2e5242(_0x295103){const _0x50299f=_0x3bfa97;await _0x3a3c31[_0x50299f(0x20c)](),_0x295103=_0x295103??[];const _0x32d82e=Math[_0x50299f(0x251)](_0x509141[_0x50299f(0x25a)],Math['ceil'](_0x295103['length']*(_0x509141['growFactor']||1.2)),0x1);_0x39f3fe=new _0x21833b[(_0x50299f(0x26b))](_0x509141[_0x50299f(0x205)],_0x288671),_0x39f3fe['initIndex']({'maxElements':_0x32d82e,'efConstruction':_0x509141[_0x50299f(0x1f8)],'M':_0x509141['M']});for(const {key:_0x4824b2,vector:_0x1fe8d1}of _0x295103){if(!(_0x1fe8d1 instanceof Float32Array)||_0x1fe8d1[_0x50299f(0x295)]!==_0x288671)continue;_0x4379c1(_0x4824b2,_0x1fe8d1);}_0x39f3fe[_0x50299f(0x28d)](_0x509141[_0x50299f(0x1f3)]),_0x2c8029=0x0;}async function _0x4dcc76(_0x4ca356){return _0x2e5242(_0x4ca356?await _0x4ca356():[]);}function _0xd7aab1(){const _0x31b8e7=_0x3bfa97;if(_0x39f3fe['getCurrentCount']()<_0x39f3fe[_0x31b8e7(0x1f9)]())return;const _0x166d11=Math[_0x31b8e7(0x2b4)](_0x39f3fe[_0x31b8e7(0x1f9)]()*(_0x509141[_0x31b8e7(0x237)]||0x2));_0x39f3fe[_0x31b8e7(0x2b2)](_0x166d11),_0x509141[_0x31b8e7(0x25a)]=_0x166d11;}function _0x4379c1(_0x534d29,_0x4ebb3b,_0x42bda3){const _0x421ebc=_0x3bfa97,_0x186861=_0x3a3c31[_0x421ebc(0x1f7)](_0x534d29);try{_0x39f3fe[_0x421ebc(0x274)](_0x186861);}catch{}_0xd7aab1(),_0x39f3fe['addPoint'](Array[_0x421ebc(0x284)](_0x4ebb3b),_0x186861),_0x3a3c31[_0x421ebc(0x2b0)](_0x534d29,_0x42bda3??_0x4edf74(_0x4ebb3b));}function _0x309d9f(_0x4fe483){const _0x5624ec=_0x3bfa97,_0x3431c4=_0x3a3c31[_0x5624ec(0x22a)](_0x4fe483);if(_0x3431c4===undefined)return![];try{_0x39f3fe[_0x5624ec(0x274)](_0x3431c4);}catch{}return _0x3a3c31[_0x5624ec(0x202)](_0x4fe483),!![];}function _0xf83da(){const _0x1a9718=_0x3bfa97;return Math[_0x1a9718(0x251)](Date[_0x1a9718(0x20b)](),_0x417cf4[_0x1a9718(0x1fa)]()+0x1);}async function _0x574d9b(_0x4022a7){const _0x535c93=_0x3bfa97;if(!_0x39f3fe||!_0x4022a7)return![];const _0x3f8e33=await _0x417cf4['publishSnapshot'](_0x4022a7,async _0x56043a=>{const _0x41975b=_0x50b8;_0x39f3fe[_0x41975b(0x2ae)](_0x56043a[_0x41975b(0x254)]),await _0x3a3c31[_0x41975b(0x282)](_0x56043a[_0x41975b(0x27e)]);const _0x36b13d=require$$0;_0x36b13d['writeFileSync'](_0x56043a[_0x41975b(0x221)],JSON[_0x41975b(0x24d)]({'manifestVersion':_0x15f4fe,'dims':_0x288671,'metric':_0x509141[_0x41975b(0x205)],'clock':_0x4022a7,'snapshotAt':Date[_0x41975b(0x20b)]()},null,0x2));},{'keep':_0x509141[_0x535c93(0x229)]});if(_0x3f8e33?.[_0x535c93(0x2a3)])_0x2c8029=0x0;return _0x3f8e33?.[_0x535c93(0x2a3)]??![];}async function _0x1fbffc(){const _0x4b7338=_0x3bfa97,_0x51f152=_0x417cf4['readCurrentId']()||_0x417cf4[_0x4b7338(0x2a9)]();if(!_0x51f152)return null;let _0x58327d,_0x3c48cc=![];return await _0x417cf4[_0x4b7338(0x27c)](_0x51f152,async _0x250bc8=>{const _0x418b98=_0x4b7338,_0x3f598b=require$$0;_0x58327d=JSON[_0x418b98(0x217)](_0x3f598b['readFileSync'](_0x250bc8[_0x418b98(0x221)],_0x418b98(0x21e)));if(_0x58327d[_0x418b98(0x1f4)]!==_0x15f4fe||_0x58327d['dims']!==_0x288671||_0x58327d[_0x418b98(0x205)]!==_0x509141[_0x418b98(0x205)]){_0x58327d=null;return;}await _0x3a3c31[_0x418b98(0x218)](_0x250bc8[_0x418b98(0x27e)]),_0x39f3fe=new _0x21833b[(_0x418b98(0x26b))](_0x509141[_0x418b98(0x205)],_0x288671),_0x39f3fe[_0x418b98(0x26a)](_0x250bc8['index']),_0x39f3fe[_0x418b98(0x28d)](_0x509141[_0x418b98(0x1f3)]),_0x3c48cc=!![];}),_0x3c48cc?_0x58327d?.[_0x4b7338(0x297)]??0x0:null;}return{async 'load'(_0x24f3b2){return _0x14e6d0(async()=>{const _0x1bd7fc=_0x50b8;_0x417cf4['cleanupTmpDirs']({'maxAgeMs':_0x509141[_0x1bd7fc(0x288)]}),_0x205e9e=_0x24f3b2??null;const _0x388b32=await _0x1fbffc(),_0x34e4e9=_0x24f3b2?await _0x24f3b2():null;if(_0x388b32!=null){if(_0x34e4e9){if(!_0x3a3c31[_0x1bd7fc(0x223)])return await _0x2e5242(_0x34e4e9),null;const _0x110683=_0x572340(_0x3a3c31,_0x34e4e9,_0x288671,{'upsert':_0x4379c1,'remove':_0x309d9f});_0x2c8029+=_0x110683['added']+_0x110683[_0x1bd7fc(0x1dc)]+_0x110683['removed'];}return _0x388b32;}return await _0x2e5242(_0x34e4e9),null;});},async 'add'(_0x4b28b0,_0x5025e4,_0x117951){return _0x14e6d0(async()=>{if(!_0x39f3fe)return;const _0x1b2ebd=_0x5025e4 instanceof Float32Array?_0x5025e4:new Float32Array(_0x5025e4),_0x809c6e=_0x4edf74(_0x1b2ebd);if(_0x3a3c31['fingerprintOf'](_0x4b28b0)===_0x809c6e)return;_0x4379c1(_0x4b28b0,_0x1b2ebd,_0x809c6e),_0x2c8029++,_0x2c8029>=_0x509141['snapshotEveryChanges']&&await _0x574d9b(_0xf83da());});},async 'remove'(_0x26be97){return _0x14e6d0(async()=>{if(!_0x39f3fe)return;if(_0x309d9f(_0x26be97))_0x2c8029++;});},'search'(_0x502aae,{limit:limit=0xa,efSearch:_0xec151f}={}){const _0x37dd84=_0x3bfa97;if(!_0x39f3fe)return[];if(Number[_0x37dd84(0x27f)](_0xec151f))_0x39f3fe[_0x37dd84(0x28d)](_0xec151f);const _0x4c33c2=Math['min'](limit,_0x39f3fe['getCurrentCount']()||0x1),{neighbors:_0x3850a4,distances:_0x3b7f45}=_0x39f3fe[_0x37dd84(0x235)](Array[_0x37dd84(0x284)](_0x502aae),_0x4c33c2),_0x4dfde3=[];for(let _0x1c043a=0x0;_0x1c043a<_0x3850a4['length'];_0x1c043a++){const _0x1175ef=_0x3a3c31[_0x37dd84(0x1f5)](_0x3850a4[_0x1c043a]);if(!_0x1175ef)continue;const _0x331b32=_0x509141[_0x37dd84(0x205)]===_0x37dd84(0x277)?Math[_0x37dd84(0x251)](0x0,0x1-_0x3b7f45[_0x1c043a]):0x1/(0x1+_0x3b7f45[_0x1c043a]);_0x4dfde3[_0x37dd84(0x29e)]({'key':_0x1175ef,'score':_0x331b32});}return _0x4dfde3;},async 'snapshot'(_0x37c56c){return _0x14e6d0(()=>_0x574d9b(_0x37c56c??_0xf83da()));},async 'rebuild'(_0x3ec4b7){return _0x14e6d0(()=>{if(_0x3ec4b7!=null)_0x205e9e=_0x3ec4b7;return _0x4dcc76(_0x3ec4b7??_0x205e9e);});},async 'stop'(){const _0x465c58=_0x3bfa97;return _0x14e6d0(()=>_0x2c8029>0x0||!_0x417cf4[_0x465c58(0x2ad)]()?_0x574d9b(_0xf83da()):![]);},'count'(){const _0x3fef7b=_0x3bfa97;return _0x3a3c31[_0x3fef7b(0x25e)]();},'info'(){const _0x5afe99=_0x3bfa97;return{'algorithm':_0x5afe99(0x246),'metric':_0x509141[_0x5afe99(0x205)],'M':_0x509141['M'],'efConstruction':_0x509141[_0x5afe99(0x1f8)],'efSearch':_0x509141[_0x5afe99(0x1f3)],'maxElements':_0x39f3fe?.[_0x5afe99(0x1f9)]()??_0x509141[_0x5afe99(0x25a)],'count':_0x3a3c31[_0x5afe99(0x25e)](),'changesSince':_0x2c8029,'snapshotDir':_0x5a53d7,'latestSnapshot':_0x417cf4[_0x5afe99(0x2ad)]()??null};}};},hnsw;}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x3b336a(_0x10fbe2={}){const _0x42b571=new Map();return{async 'load'(_0x392d14){const _0xe2b6c8=_0x50b8;_0x42b571[_0xe2b6c8(0x293)]();if(_0x392d14)for(const {key:_0x1b3c77,vector:_0x110d38}of await _0x392d14()){_0x42b571[_0xe2b6c8(0x24c)](_0x1b3c77,_0x110d38);}},async 'add'(_0x1d6e58,_0x4d818b,_0x6f74f2){const _0x29c8b9=_0x50b8;_0x42b571[_0x29c8b9(0x24c)](_0x1d6e58,_0x4d818b);},async 'remove'(_0x2728b4){_0x42b571['delete'](_0x2728b4);},'search'(_0x2b03b5,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x5d221a=_0x50b8,_0x312d02=[];for(const [_0x1d5313,_0x64008b]of _0x42b571){const _0x2252a7=_0x38cc90(_0x2b03b5,_0x64008b);if(_0x2252a7>=threshold)_0x312d02[_0x5d221a(0x29e)]({'key':_0x1d5313,'score':_0x2252a7});}return _0x312d02[_0x5d221a(0x226)]((_0x45e002,_0x4149d6)=>_0x4149d6['score']-_0x45e002[_0x5d221a(0x256)]),_0x312d02[_0x5d221a(0x283)](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x3921ca){const _0xda79ad=_0x50b8;await this[_0xda79ad(0x24a)](_0x3921ca);},async 'stop'(){},'count'(){return _0x42b571['size'];},'info'(){return{'algorithm':'flat','count':_0x42b571['size']};}};};function _0x38cc90(_0x385f9f,_0x56b118){const _0x2ac5c0=_0x50b8;let _0x345996=0x0,_0x57162d=0x0,_0x1786bc=0x0;for(let _0x5b1846=0x0;_0x5b1846<_0x385f9f['length'];_0x5b1846++){_0x345996+=_0x385f9f[_0x5b1846]*_0x56b118[_0x5b1846],_0x57162d+=_0x385f9f[_0x5b1846]*_0x385f9f[_0x5b1846],_0x1786bc+=_0x56b118[_0x5b1846]*_0x56b118[_0x5b1846];}const _0x58d09e=Math['sqrt'](_0x57162d)*Math[_0x2ac5c0(0x241)](_0x1786bc);return _0x58d09e===0x0?0x0:_0x345996/_0x58d09e;}return flat;}var writerLock,hasRequiredWriterLock;function requireWriterLock(){if(hasRequiredWriterLock)return writerLock;hasRequiredWriterLock=0x1;const _0x2a68c0=require$$0,_0x3b7ab4=require$$1,_0x2726d6=require$$3;return writerLock=function _0xf94222(_0x1c92f5,{maxAgeMs:maxAgeMs=0x3a98,heartbeatMs:heartbeatMs=0x1388,onLost:onLost=null}={}){const _0x3f839c=_0x50b8,_0x118596=_0x3b7ab4[_0x3f839c(0x200)](_0x1c92f5,'WRITER.LOCK'),_0x41431e=_0x2726d6['randomBytes'](0x8)['toString'](_0x3f839c(0x1ee));let _0x2015bf=![],_0x1d5fab=null;const _0x4efd33=()=>JSON[_0x3f839c(0x24d)]({'pid':process[_0x3f839c(0x26e)],'token':_0x41431e,'at':Date[_0x3f839c(0x20b)]()});function _0x3b2504(){const _0x149887=_0x3f839c;try{return JSON[_0x149887(0x217)](_0x2a68c0[_0x149887(0x1e2)](_0x118596,_0x149887(0x21e)));}catch(_0x49fcc1){return _0x49fcc1?.[_0x149887(0x1f6)]===_0x149887(0x259)?null:{'unreadable':!![]};}}function _0x23d7ca(){const _0x2a9a7d=_0x3f839c;try{const _0x41516e=_0x2a68c0[_0x2a9a7d(0x29b)](_0x118596,'wx');try{_0x2a68c0[_0x2a9a7d(0x21b)](_0x41516e,_0x4efd33());}finally{_0x2a68c0[_0x2a9a7d(0x278)](_0x41516e);}return!![];}catch(_0x7a2202){if(_0x7a2202?.[_0x2a9a7d(0x1f6)]==='EEXIST')return![];throw _0x7a2202;}}function _0x77a0e6(_0x2742ae){const _0x58a09b=_0x3f839c;if(!_0x2742ae)return!![];if(_0x2742ae[_0x58a09b(0x1e0)])return!![];return Date[_0x58a09b(0x20b)]()-(_0x2742ae['at']??0x0)>=maxAgeMs;}function _0x33c37b(){if(_0x1d5fab)clearInterval(_0x1d5fab);_0x1d5fab=null;}function _0x572b56(){const _0x47237f=_0x3f839c;_0x33c37b(),_0x1d5fab=setInterval(()=>{const _0x36cf76=_0x50b8,_0x4010de=_0x3b2504();if(_0x4010de&&!_0x4010de[_0x36cf76(0x1e0)]&&_0x4010de[_0x36cf76(0x21f)]!==_0x41431e){_0x2015bf=![],_0x33c37b();try{onLost?.();}catch{}return;}try{_0x2a68c0[_0x36cf76(0x21b)](_0x118596,_0x4efd33());}catch{}},heartbeatMs),_0x1d5fab[_0x47237f(0x261)]?.();}function _0x265332(){const _0x17ac6a=_0x3f839c,_0x2019d4=_0x3b2504();return!!_0x2019d4&&_0x2019d4[_0x17ac6a(0x21f)]===_0x41431e;}return{'path':_0x118596,'token':_0x41431e,'acquire'(){const _0x20c007=_0x3b2504();if(_0x20c007&&_0x20c007['token']===_0x41431e){_0x2015bf=!![];if(!_0x1d5fab)_0x572b56();return!![];}let _0x452c1a=_0x23d7ca();if(!_0x452c1a&&_0x77a0e6(_0x3b2504())){try{_0x2a68c0['unlinkSync'](_0x118596);}catch{}_0x452c1a=_0x23d7ca();}if(_0x452c1a&&!_0x265332())_0x452c1a=![];_0x2015bf=_0x452c1a;if(_0x452c1a)_0x572b56();return _0x452c1a;},'held'(){return _0x2015bf;},'isFree'(){const _0x2d864b=_0x3f839c,_0x25eb35=_0x3b2504();if(_0x25eb35&&_0x25eb35[_0x2d864b(0x21f)]===_0x41431e)return![];return _0x77a0e6(_0x25eb35);},'release'(){const _0x3c1940=_0x3f839c;_0x33c37b();if(!_0x2015bf)return;_0x2015bf=![];if(_0x265332())try{_0x2a68c0[_0x3c1940(0x1e1)](_0x118596);}catch{}}};},writerLock;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x3374ff=require$$0,_0x218df2=requireSnapshotStore(),_0x32f9d5=requireLabelMap(),_0x5ed3e1=requireWriterLock(),{fingerprint:_0x266e98,reconcileIndex:_0x1ba238}=requireIndexConvergence(),_0xe956c9=0x1;let _0x29f4b3=null;function _0x2d8a48(){const _0x17cc12=_0x50b8;if(_0x29f4b3)return _0x29f4b3;try{return _0x29f4b3=require(_0x17cc12(0x220)),_0x29f4b3;}catch(_0x40e2d9){const _0x2d9e43=new Error(_0x17cc12(0x1e4)+('for\x20Node\x20'+process[_0x17cc12(0x2a5)][_0x17cc12(0x255)]+'\x20on\x20'+process[_0x17cc12(0x1db)]+'/'+process[_0x17cc12(0x29d)]+'.\x20')+_0x17cc12(0x1df)+(_0x17cc12(0x232)+(_0x40e2d9?.['message']||String(_0x40e2d9))));_0x2d9e43[_0x17cc12(0x1f6)]=_0x17cc12(0x294),_0x2d9e43[_0x17cc12(0x227)]=_0x40e2d9;throw _0x2d9e43;}}function _0x17ca5a(_0x23ff3d,_0xf1efda){const _0xe90921=_0x50b8;switch(_0x23ff3d){case _0xe90921(0x277):return _0xf1efda[_0xe90921(0x258)][_0xe90921(0x2a6)];case'l2':return _0xf1efda['MetricKind'][_0xe90921(0x291)];case'ip':return _0xf1efda[_0xe90921(0x258)]['IP'];default:return _0xf1efda[_0xe90921(0x258)][_0xe90921(0x2a6)];}}return usearch=function _0x259933(_0x2e053c={},{dims:_0x3a6dc1,dir:_0x98f1ee,fetchAll:fetchAll=null,onChange:onChange=null}={}){const _0x5db65d=_0x50b8,_0x39e59f=_0x2d8a48();if(!_0x3a6dc1||_0x3a6dc1<=0x0)throw new Error(_0x5db65d(0x1fe));if(!_0x98f1ee)throw new Error(_0x5db65d(0x208));const _0x540ae0={'metric':_0x2e053c[_0x5db65d(0x205)]??_0x5db65d(0x277),'connectivity':_0x2e053c[_0x5db65d(0x275)]??0x10,'expansionAdd':_0x2e053c[_0x5db65d(0x299)]??0x80,'expansionSearch':_0x2e053c['expansionSearch']??0x40,'snapshotEveryChanges':_0x2e053c[_0x5db65d(0x2a2)]??0xc350,'snapshotMaxLagMs':_0x2e053c[_0x5db65d(0x219)]??0x2710,'keepSnapshots':_0x2e053c[_0x5db65d(0x229)]??0x2,'tmpMaxAgeMs':_0x2e053c[_0x5db65d(0x288)]??0x6*0x36ee80,'heartbeatIntervalMs':_0x2e053c['heartbeatIntervalMs']??0x1388,'writerLockMaxAgeMs':_0x2e053c['writerLockMaxAgeMs']??0x3a98,'viewRefreshMs':_0x2e053c['viewRefreshMs']??0x3e8},_0x5e4936=new _0x218df2({'dir':_0x98f1ee,'keepSnapshots':_0x540ae0['keepSnapshots']}),_0x35fd2a=_0x5ed3e1(_0x98f1ee,{'maxAgeMs':_0x540ae0[_0x5db65d(0x214)],'heartbeatMs':_0x540ae0[_0x5db65d(0x26f)],'onLost':()=>{const _0x3aacbc=_0x5db65d;_0x230451(_0x13dc07)[_0x3aacbc(0x260)](()=>{});}});let _0x20d05c=new _0x32f9d5(),_0x34c785=null,_0xbf36eb=0x0,_0x2e3056=null,_0x2a9c7f=![],_0xfcee39=![],_0x529504=null,_0x2f5881=0x0,_0x51ae7c=null,_0x30b9d1=0x0,_0x525ea5=![],_0x305720=Promise[_0x5db65d(0x29c)]();const _0x230451=_0x4cbe0d=>{const _0x1a7c6b=_0x5db65d,_0x52e17d=_0x305720[_0x1a7c6b(0x1e7)](_0x4cbe0d);return _0x305720=_0x52e17d[_0x1a7c6b(0x260)](()=>{}),_0x52e17d;},_0x794152=()=>{try{onChange?.();}catch{}};function _0x15b766(){const _0xf73a94=_0x5db65d;return new _0x39e59f[(_0xf73a94(0x216))]({'dimensions':_0x3a6dc1,'metric':_0x17ca5a(_0x540ae0[_0xf73a94(0x205)],_0x39e59f),'quantization':_0x39e59f[_0xf73a94(0x2b5)][_0xf73a94(0x21d)],'connectivity':_0x540ae0[_0xf73a94(0x275)],'expansion_add':_0x540ae0[_0xf73a94(0x299)],'expansion_search':_0x540ae0[_0xf73a94(0x225)],'multi':![]});}function _0x5e4767(_0x575a53){return _0x575a53 instanceof Float32Array?_0x575a53:new Float32Array(_0x575a53);}function _0x258b26(){const _0x399fcb=_0x5db65d;if(fetchAll)return fetchAll();if(_0x2e3056)return _0x2e3056();return Promise[_0x399fcb(0x29c)](null);}function _0x349ed9(_0x58fc92,_0x5dba45,_0x400494){const _0xc59a0b=_0x5db65d,_0x1de454=_0x20d05c[_0xc59a0b(0x22a)](_0x58fc92);if(_0x1de454!==undefined)try{_0x34c785['remove'](BigInt(_0x1de454));}catch{}const _0x5ec3be=_0x20d05c[_0xc59a0b(0x1f7)](_0x58fc92);_0x34c785['add'](BigInt(_0x5ec3be),_0x5dba45),_0x20d05c[_0xc59a0b(0x2b0)](_0x58fc92,_0x400494??_0x266e98(_0x5dba45));}function _0x5da14f(_0x219fc2){const _0x1c0ddf=_0x5db65d,_0x517c51=_0x20d05c[_0x1c0ddf(0x22a)](_0x219fc2);if(_0x517c51===undefined)return![];try{_0x34c785['remove'](BigInt(_0x517c51));}catch{}return _0x20d05c[_0x1c0ddf(0x202)](_0x219fc2),!![];}function _0x2f5bf1(_0x48cf49){const _0x126689=_0x5db65d;_0x20d05c=new _0x32f9d5(),_0x34c785=_0x15b766();for(const {key:_0x12852d,vector:_0x1c1a44}of _0x48cf49??[]){if(!(_0x1c1a44 instanceof Float32Array)||_0x1c1a44[_0x126689(0x295)]!==_0x3a6dc1)continue;_0x349ed9(_0x12852d,_0x1c1a44);}_0xbf36eb=0x0;}function _0x477824(){const _0xe2a356=_0x5db65d;return Math[_0xe2a356(0x251)](Date[_0xe2a356(0x20b)](),_0x5e4936[_0xe2a356(0x1fa)]()+0x1);}function _0x3e1b9b(){if(_0x529504)clearTimeout(_0x529504);_0x529504=null;}function _0x2ec900(){const _0x5e18ee=_0x5db65d;if(!_0x540ae0[_0x5e18ee(0x219)]||_0x529504||!_0xfcee39||_0xbf36eb<=0x0)return;const _0x380258=Math[_0x5e18ee(0x251)](_0x540ae0[_0x5e18ee(0x219)],0xa*_0x2f5881);_0x529504=setTimeout(()=>{const _0x45826e=_0x5e18ee;_0x529504=null,_0x230451(async()=>{if(_0xfcee39&&_0xbf36eb>0x0)await _0x384486();_0x2ec900(),_0x794152();})[_0x45826e(0x260)](()=>{});},_0x380258),_0x529504['unref']?.();}async function _0x384486(_0x48bd16){const _0x14127b=_0x5db65d;if(!_0x34c785)return![];const _0x5d1a8c=_0x48bd16??_0x477824(),_0x382589=Date[_0x14127b(0x20b)](),_0x1bd733=await _0x5e4936[_0x14127b(0x272)](_0x5d1a8c,async _0x41334c=>{const _0x58381b=_0x14127b;_0x34c785[_0x58381b(0x2a0)](_0x41334c['index']),await _0x20d05c[_0x58381b(0x282)](_0x41334c['labels']),_0x3374ff[_0x58381b(0x21b)](_0x41334c[_0x58381b(0x221)],JSON[_0x58381b(0x24d)]({'manifestVersion':_0xe956c9,'algorithm':_0x58381b(0x220),'dims':_0x3a6dc1,'metric':_0x540ae0[_0x58381b(0x205)],'clock':_0x5d1a8c,'snapshotAt':Date[_0x58381b(0x20b)]()},null,0x2));},{'keep':_0x540ae0[_0x14127b(0x229)]});return _0x2f5881=Date[_0x14127b(0x20b)]()-_0x382589,_0x1bd733?.[_0x14127b(0x2a3)]&&(_0xbf36eb=0x0,_0x3e1b9b()),_0x1bd733?.['published']??![];}function _0x1dcac8(){const _0x1eb0f9=_0x5db65d;_0xbf36eb++;if(_0xbf36eb>=_0x540ae0[_0x1eb0f9(0x2a2)])return _0x384486();return _0x2ec900(),null;}async function _0x279073(){const _0x53da4a=_0x5db65d,_0x23dcd7=_0x5e4936[_0x53da4a(0x2ad)]()||_0x5e4936[_0x53da4a(0x2a9)]();if(!_0x23dcd7)return null;let _0x1e7e76,_0x553e46=![];try{await _0x5e4936[_0x53da4a(0x27c)](_0x23dcd7,async _0x561183=>{const _0x3c923b=_0x53da4a;_0x1e7e76=JSON[_0x3c923b(0x217)](_0x3374ff[_0x3c923b(0x1e2)](_0x561183[_0x3c923b(0x221)],_0x3c923b(0x21e)));if(_0x1e7e76[_0x3c923b(0x1f4)]!==_0xe956c9||_0x1e7e76['algorithm']!=='usearch'||_0x1e7e76[_0x3c923b(0x26d)]!==_0x3a6dc1||_0x1e7e76[_0x3c923b(0x205)]!==_0x540ae0[_0x3c923b(0x205)]){_0x1e7e76=null;return;}const _0x50b230=new _0x32f9d5();await _0x50b230[_0x3c923b(0x218)](_0x561183[_0x3c923b(0x27e)]);const _0x214991=_0x15b766();_0x214991['load'](_0x561183[_0x3c923b(0x254)]),_0x20d05c=_0x50b230,_0x34c785=_0x214991,_0x553e46=!![];});}catch{return null;}return _0x553e46?_0x1e7e76?.[_0x53da4a(0x297)]??0x0:null;}async function _0x28f28e(_0x365c6b){const _0x487d4a=_0x5db65d;_0x51ae7c=null;const _0x356345=await _0x279073();if(_0x356345!=null){_0xbf36eb=0x0;if(_0x365c6b){if(!_0x20d05c[_0x487d4a(0x223)])return _0x2f5bf1(_0x365c6b),await _0x384486(),null;const _0x596ab3=_0x1ba238(_0x20d05c,_0x365c6b,_0x3a6dc1,{'upsert':_0x349ed9,'remove':_0x5da14f}),_0x123c95=_0x596ab3['added']+_0x596ab3[_0x487d4a(0x1dc)]+_0x596ab3[_0x487d4a(0x24f)];_0x123c95>0x0&&(_0xbf36eb+=_0x123c95,await _0x384486());}return _0x356345;}_0x2f5bf1(_0x365c6b??[]);if(_0x34c785[_0x487d4a(0x25e)]()>0x0)await _0x384486();return null;}async function _0x70d99a(){_0xfcee39=!![],await _0x28f28e(await _0x258b26());}async function _0x13dc07(){const _0x2fb72a=_0x5db65d;if(!_0xfcee39)return;_0xfcee39=![],_0x3e1b9b(),_0xbf36eb=0x0;const _0x50b6bf=_0x5e4936[_0x2fb72a(0x2ad)]()||_0x5e4936[_0x2fb72a(0x2a9)]();await _0xd64041(_0x50b6bf),_0x794152();}async function _0xd64041(_0x206c9a){const _0x36dad6=_0x5db65d;if(!_0x206c9a)return![];let _0x1aa3c2=![];try{await _0x5e4936[_0x36dad6(0x27c)](_0x206c9a,async _0x5dd8ab=>{const _0x372c4f=_0x36dad6,_0x3c0168=JSON[_0x372c4f(0x217)](_0x3374ff['readFileSync'](_0x5dd8ab[_0x372c4f(0x221)],'utf8'));if(_0x3c0168[_0x372c4f(0x1f4)]!==_0xe956c9||_0x3c0168['algorithm']!=='usearch'||_0x3c0168['dims']!==_0x3a6dc1||_0x3c0168[_0x372c4f(0x205)]!==_0x540ae0['metric'])return;const _0x190185=new _0x32f9d5();await _0x190185['loadFrom'](_0x5dd8ab[_0x372c4f(0x27e)]);const _0xc822f=_0x15b766();_0xc822f['view'](_0x5dd8ab['index']),_0x34c785=_0xc822f,_0x20d05c=_0x190185,_0x51ae7c=_0x206c9a,_0x1aa3c2=!![];});}catch{}return _0x1aa3c2;}function _0x5aedb2(){const _0x79dc06=_0x5db65d,_0x275ced=Date[_0x79dc06(0x20b)]();if(_0x275ced-_0x30b9d1<_0x540ae0[_0x79dc06(0x25d)])return;_0x30b9d1=_0x275ced;if(_0x525ea5)return;if(_0x35fd2a[_0x79dc06(0x1dd)]()){_0x525ea5=!![],_0x230451(async()=>{!_0xfcee39&&_0x2a9c7f&&_0x35fd2a['acquire']()&&(await _0x70d99a(),_0x794152());})[_0x79dc06(0x260)](()=>{})[_0x79dc06(0x29a)](()=>{_0x525ea5=![];});return;}const _0x3c286c=_0x5e4936[_0x79dc06(0x2ad)]()||_0x5e4936[_0x79dc06(0x2a9)]();if(!_0x3c286c||_0x3c286c===_0x51ae7c)return;_0x525ea5=!![],_0x230451(async()=>{if(!_0xfcee39&&await _0xd64041(_0x3c286c))_0x794152();})[_0x79dc06(0x260)](()=>{})[_0x79dc06(0x29a)](()=>{_0x525ea5=![];});}return{async 'load'(_0x36da0a){return _0x230451(async()=>{const _0x38575=_0x50b8;_0x5e4936['cleanupTmpDirs']({'maxAgeMs':_0x540ae0[_0x38575(0x288)]}),_0x2e3056=_0x36da0a??null,_0xfcee39=_0x35fd2a[_0x38575(0x26c)]();let _0x433127=null;if(_0xfcee39)_0x433127=await _0x28f28e(_0x36da0a?await _0x36da0a():null);else{const _0x25ef16=_0x5e4936[_0x38575(0x2ad)]()||_0x5e4936[_0x38575(0x2a9)]();await _0xd64041(_0x25ef16);}return _0x2a9c7f=!![],_0x433127;});},async 'add'(_0x2c611f,_0x1ebacc,_0x15eb7a){return _0x230451(async()=>{const _0x5b4ae9=_0x50b8;if(!_0x2a9c7f)return;const _0x29de08=_0x5e4767(_0x1ebacc);if(!_0xfcee39){if(!_0x35fd2a['acquire']())return;await _0x70d99a();}if(!_0x34c785)return;const _0x387283=_0x266e98(_0x29de08);if(_0x20d05c[_0x5b4ae9(0x215)](_0x2c611f)===_0x387283)return;_0x349ed9(_0x2c611f,_0x29de08,_0x387283),await _0x1dcac8();});},async 'remove'(_0x584824){return _0x230451(async()=>{const _0x4896be=_0x50b8;if(!_0x2a9c7f)return;if(!_0xfcee39){if(!_0x35fd2a[_0x4896be(0x26c)]())return;await _0x70d99a();}if(!_0x34c785)return;if(_0x5da14f(_0x584824))await _0x1dcac8();});},'search'(_0x38c315,{limit:limit=0xa}={}){const _0x59893e=_0x5db65d;if(!_0xfcee39&&_0x2a9c7f)_0x5aedb2();if(!_0x34c785)return[];const _0x1f52fc=_0x34c785['size']();if(_0x1f52fc===0x0)return[];const _0x411bb0=Math['min'](limit,_0x1f52fc),_0x57c396=_0x34c785[_0x59893e(0x22e)](_0x5e4767(_0x38c315),_0x411bb0,0x0),_0x9c1ab8=[],_0x14e148=_0x57c396[_0x59893e(0x23b)],_0xe61382=_0x57c396[_0x59893e(0x231)];for(let _0x1b7135=0x0;_0x1b7135<_0x14e148['length'];_0x1b7135++){const _0x3da41f=_0x14e148[_0x1b7135];if(_0x3da41f===0xffffffffffffffffn)continue;const _0x59f833=Number(_0x3da41f),_0x36aa6f=_0x20d05c[_0x59893e(0x1f5)](_0x59f833);if(!_0x36aa6f)continue;const _0x48909c=_0xe61382[_0x1b7135];let _0x489390;if(_0x540ae0[_0x59893e(0x205)]===_0x59893e(0x277))_0x489390=Math[_0x59893e(0x251)](0x0,0x1-_0x48909c);else{if(_0x540ae0[_0x59893e(0x205)]==='ip')_0x489390=-_0x48909c;else _0x489390=0x1/(0x1+_0x48909c);}_0x9c1ab8['push']({'key':_0x36aa6f,'score':_0x489390});}return _0x9c1ab8;},async 'snapshot'(_0x404407){return _0x230451(()=>_0xfcee39?_0x384486(_0x404407??undefined):![]);},async 'rebuild'(_0x53e364){return _0x230451(async()=>{const _0x3c8253=_0x50b8;if(_0x53e364!=null)_0x2e3056=_0x53e364;if(!_0xfcee39){if(!_0x35fd2a[_0x3c8253(0x26c)]())return;_0xfcee39=!![];}const _0x3ee31d=_0x53e364?await _0x53e364():await _0x258b26();_0x2f5bf1(_0x3ee31d??[]),_0x2a9c7f=!![],await _0x384486();});},async 'stop'(){return _0x230451(async()=>{const _0x288d26=_0x50b8;_0x3e1b9b();if(_0xfcee39){if(_0xbf36eb>0x0||!_0x5e4936['readCurrentId']())await _0x384486();_0x35fd2a[_0x288d26(0x238)]();}_0xfcee39=![],_0x2a9c7f=![];});},'count'(){const _0x509572=_0x5db65d;return _0x20d05c[_0x509572(0x25e)]();},'info'(){const _0x112a60=_0x5db65d;return{'algorithm':_0x112a60(0x220),'role':_0xfcee39?_0x112a60(0x271):_0x112a60(0x230),'metric':_0x540ae0[_0x112a60(0x205)],'connectivity':_0x540ae0['connectivity'],'expansionAdd':_0x540ae0[_0x112a60(0x299)],'expansionSearch':_0x540ae0['expansionSearch'],'snapshotEveryChanges':_0x540ae0[_0x112a60(0x2a2)],'snapshotMaxLagMs':_0x540ae0[_0x112a60(0x219)],'count':_0x20d05c[_0x112a60(0x25e)](),'size':_0x34c785?.[_0x112a60(0x25e)]?.()??0x0,'capacity':_0x34c785?.[_0x112a60(0x207)]?.()??0x0,'changesSince':_0xfcee39?_0xbf36eb:null,'viewedSnapshot':_0x51ae7c??null,'snapshotDir':_0x98f1ee,'latestSnapshot':_0x5e4936[_0x112a60(0x2ad)]()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0x20025b=_0x591ed2;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x3069b3,workerData:_0x4a649a}=require$$0$1,{algorithmName:_0x3cbdb1,algorithmConfig:_0x275e15,dims:_0x43d43e,dir:_0x4a60a1}=_0x4a649a;let _0x148ab0=0x1;const _0x2b3dc8=new Map();function _0x1d325c(){const _0x368f81=_0x148ab0++;return new Promise((_0xca5c49,_0x1fd646)=>{const _0x38f228=_0x50b8;_0x2b3dc8[_0x38f228(0x24c)](_0x368f81,{'resolve':_0xca5c49,'reject':_0x1fd646}),_0x3069b3['postMessage']({'op':_0x38f228(0x21a),'fid':_0x368f81});});}const _0x1583a7={'dims':_0x43d43e,'dir':_0x4a60a1,'fetchAll':_0x1d325c,'onChange':()=>_0x4a7d3e()};let _0x4519ab;if(_0x3cbdb1===_0x20025b(0x246))_0x4519ab=requireHnsw()(_0x275e15,_0x1583a7);else{if(_0x3cbdb1===_0x20025b(0x267))_0x4519ab=requireFlat()(_0x275e15,_0x1583a7);else{if(_0x3cbdb1===_0x20025b(0x220))_0x4519ab=requireUsearch()(_0x275e15,_0x1583a7);else throw new Error('Unknown\x20algorithm:\x20\x22'+_0x3cbdb1+'\x22');}}function _0x4a7d3e(){const _0x48bad7=_0x20025b;try{_0x3069b3['postMessage']({'op':_0x48bad7(0x234),'count':_0x4519ab[_0x48bad7(0x1fd)](),'info':_0x4519ab[_0x48bad7(0x212)](),'memory':process[_0x48bad7(0x1e9)]()});}catch{}}function _0x6abc85(_0x1cf28f){const _0x181738=_0x20025b;return(_0x1cf28f||[])['map'](_0x57f732=>({'key':_0x57f732[_0x181738(0x211)],'vector':_0x57f732['vector']instanceof Float32Array?_0x57f732['vector']:new Float32Array(_0x57f732[_0x181738(0x209)])}));}return _0x3069b3['on'](_0x20025b(0x210),async _0x2fb4db=>{const _0x57db9c=_0x20025b;if(_0x2fb4db['op']===_0x57db9c(0x292)){const _0x4fb94b=_0x2b3dc8[_0x57db9c(0x245)](_0x2fb4db[_0x57db9c(0x1f1)]);if(!_0x4fb94b)return;_0x2b3dc8[_0x57db9c(0x1ea)](_0x2fb4db[_0x57db9c(0x1f1)]);if(_0x2fb4db[_0x57db9c(0x2aa)])_0x4fb94b[_0x57db9c(0x1de)](new Error(_0x2fb4db[_0x57db9c(0x2aa)]));else _0x4fb94b['resolve'](_0x6abc85(_0x2fb4db[_0x57db9c(0x24b)]));return;}const {id:_0x27d5ec,op:_0x53e2bd,args:_0x551960}=_0x2fb4db;try{let _0x47c907;switch(_0x53e2bd){case _0x57db9c(0x24a):{_0x47c907=await _0x4519ab[_0x57db9c(0x24a)](_0x551960[_0x57db9c(0x287)]?_0x1d325c:null),_0x4a7d3e();break;}case _0x57db9c(0x281):{const _0x5e1123=_0x551960[_0x57db9c(0x209)]instanceof Float32Array?_0x551960[_0x57db9c(0x209)]:new Float32Array(_0x551960[_0x57db9c(0x209)]);await _0x4519ab[_0x57db9c(0x281)](_0x551960[_0x57db9c(0x211)],_0x5e1123,_0x551960['clock']??undefined),_0x4a7d3e(),_0x47c907=null;break;}case'remove':{await _0x4519ab[_0x57db9c(0x27b)](_0x551960[_0x57db9c(0x211)]),_0x4a7d3e(),_0x47c907=null;break;}case'search':{const _0xb6fc90=_0x551960[_0x57db9c(0x276)]instanceof Float32Array?_0x551960[_0x57db9c(0x276)]:new Float32Array(_0x551960['queryVec']);_0x47c907=_0x4519ab[_0x57db9c(0x22e)](_0xb6fc90,_0x551960['opts']||{});break;}case _0x57db9c(0x273):{_0x47c907=await _0x4519ab[_0x57db9c(0x273)](_0x551960[_0x57db9c(0x297)]),_0x4a7d3e();break;}case _0x57db9c(0x1f2):{const _0xd9692f=_0x6abc85(_0x551960[_0x57db9c(0x24b)]);await _0x4519ab[_0x57db9c(0x1f2)](async()=>_0xd9692f),_0x4a7d3e(),_0x47c907=null;break;}case _0x57db9c(0x20d):{await _0x4519ab['stop'](),_0x4a7d3e(),_0x47c907=null;break;}case _0x57db9c(0x1fd):{_0x47c907=_0x4519ab[_0x57db9c(0x1fd)]();break;}case _0x57db9c(0x212):{_0x47c907=_0x4519ab[_0x57db9c(0x212)]();break;}default:throw new Error('Unknown\x20op:\x20\x22'+_0x53e2bd+'\x22');}_0x3069b3[_0x57db9c(0x20f)]({'id':_0x27d5ec,'result':_0x47c907});}catch(_0x1a9e64){_0x3069b3['postMessage']({'id':_0x27d5ec,'error':{'message':_0x1a9e64?.[_0x57db9c(0x210)]||String(_0x1a9e64),'code':_0x1a9e64?.['code']}});}}),_0x3069b3[_0x20025b(0x20f)]({'op':_0x20025b(0x290)}),algorithmWorkerThread$1;}function _0x50b8(_0x4252fb,_0x45b4cf){_0x4252fb=_0x4252fb-0x1db;const _0x414d6c=_0x414d();let _0x50b861=_0x414d6c[_0x4252fb];return _0x50b861;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module[_0x591ed2(0x20a)]=algorithmWorkerThread;
|