@kedem/okdb 2.6.4 → 2.7.1
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 +80 -0
- package/algorithm-worker-thread.js +1 -1
- package/bin/okdb.js +1 -1
- package/docs/functions.md +27 -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/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,86 @@ 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.7.1] - 2026-10-18
|
|
8
|
+
|
|
9
|
+
2.7.0 was published from a build made before its last three fixes; 2.7.1 is the intended 2.7 release. Upgrade from
|
|
10
|
+
2.7.0 to 2.7.1. The storage format is unchanged. This is the last Node.js release: okdb 3 is a Rust core that forks
|
|
11
|
+
from it. Upgrade to okdb 3 by stopping every 2.x process, then opening the store with okdb 3; do not run 2.x and
|
|
12
|
+
3.x writers on one store at the same time (see Known issue below).
|
|
13
|
+
|
|
14
|
+
### Known issue
|
|
15
|
+
|
|
16
|
+
- **Opening a store can drop one concurrent write from another process.** The LMDB binding 2.x uses
|
|
17
|
+
(lmdb-js) resets a shared transaction counter whenever a process opens an environment. If another process
|
|
18
|
+
commits at that moment, that commit can be silently lost, even though it was acknowledged. The window is
|
|
19
|
+
narrow (we could not reproduce it in 140 loaded test runs, but it was observed once), and it applies to
|
|
20
|
+
stores shared by several 2.x processes, and to stores shared by 2.x and okdb 3 processes. 2.7.0 does not
|
|
21
|
+
change this. **To avoid it:** open every process's environments before write traffic starts, and upgrade
|
|
22
|
+
to okdb 3, whose storage layer does not have this bug. When upgrading, stop every 2.x process before an
|
|
23
|
+
okdb 3 process opens the store, and never run 2.x and 3.x writers on one store at the same time.
|
|
24
|
+
|
|
25
|
+
- **An environment can fail with `EINVAL` (Invalid argument) on every write after a peer closes it.** When a
|
|
26
|
+
process closes an environment while another process is opening it, lmdb-js can destroy the shared locks
|
|
27
|
+
the opener then uses; every write transaction in that process fails until all processes close the
|
|
28
|
+
environment. Restarting the affected processes recovers. Rare (it needs an open and a close to overlap).
|
|
29
|
+
Fixed in okdb 3.0, whose storage layer keeps those locks intact.
|
|
30
|
+
- **`queue.samplePayloads(type)` always returns `[]`.** Fixed in okdb 3.0.
|
|
31
|
+
- **A view whose `$ref` section crashed mid-scan stays `partially-ready`.** Restarting a halted view after a
|
|
32
|
+
reopen can also count an update to an existing key as a new key and miss grouped and `$ref` rows. Rebuild
|
|
33
|
+
the view (`views.rebuild(name)`) to recover. Fixed in okdb 3.0, which rebuilds such views on open.
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- **Sync:** a poke that arrives while a pull from that peer is already running now triggers one more pull
|
|
38
|
+
instead of being dropped, so the last write of a burst no longer waits for the next unrelated event. Closing
|
|
39
|
+
an instance while a sync pull was running could crash the process; `close()` now waits for the pull (up to a
|
|
40
|
+
few seconds) before closing the environments.
|
|
41
|
+
- **The queue worker could crash** when a peer's compaction closed its env while it was waiting for work.
|
|
42
|
+
|
|
43
|
+
## [2.7.0] - 2026-10-18
|
|
44
|
+
|
|
45
|
+
The last Node.js release line: okdb 3 is a Rust core that forks from this version. 2.7.0 fixes every bug
|
|
46
|
+
found while porting, so a 2.7 process and an okdb 3 process can share a store and behave the same. The
|
|
47
|
+
storage format is unchanged: no migrations, stores open as-is.
|
|
48
|
+
|
|
49
|
+
### Changed (read before upgrading)
|
|
50
|
+
|
|
51
|
+
- **Sandboxed `fetch` refuses private addresses, and checks every redirect.** Before, only the first URL
|
|
52
|
+
was checked: an allowed host could redirect a function anywhere, and `allowedFetchDomains: '*'` reached
|
|
53
|
+
localhost and the LAN. Now every hop must be http(s), on the allow-list, and (unless its hostname is
|
|
54
|
+
listed explicitly) not resolve to loopback, RFC 1918, link-local (including the cloud metadata service),
|
|
55
|
+
CGNAT, ULA, multicast or reserved space (`FETCH_PRIVATE_ADDRESS`). Credentials are dropped when a
|
|
56
|
+
redirect leaves the origin. **A function that called a local service through `'*'` must list that host**,
|
|
57
|
+
or set `OKDB_FN_FETCH_ALLOW_PRIVATE=1`. Stored functions also keep `allowedFetchDomains` (it was dropped
|
|
58
|
+
when a function was saved). See [Functions → Network access](docs/functions.md#network-access-fetch).
|
|
59
|
+
- **Compaction can now be refused with `COMPACT_PEER_HOLDS_ENV`.** The `data.mdb` swap no longer runs
|
|
60
|
+
while another process still holds the env's `lock.mdb`; it re-signals the drain, then gives up with the
|
|
61
|
+
store untouched (auto-compaction retries later). Before, a peer that had not released could read the
|
|
62
|
+
compacted file through stale lock-file state and see the env **empty** (all types gone) or fail writes
|
|
63
|
+
with `MDB_PROBLEM`. Both meta pages of the compacted file are now sealed as a second safeguard.
|
|
64
|
+
- **A process that missed a compaction refuses writes with `ENV_SWAPPED_UNDER`** instead of writing into
|
|
65
|
+
the swapped-out file, where acknowledged writes were lost. Every env now also polls the shared drain
|
|
66
|
+
stamp (200 ms), so a process that opened while a peer was compacting is no longer deaf to the swap.
|
|
67
|
+
Restart a process that reports `ENV_SWAPPED_UNDER`.
|
|
68
|
+
- **Exports carry document versions** (`ver` on data lines). The importer already reads it.
|
|
69
|
+
|
|
70
|
+
### Fixed
|
|
71
|
+
|
|
72
|
+
- **Full-text search lost postings** when a document lost a term and regained it before the next
|
|
73
|
+
compaction of the index (the term sat in both live tiers and searched as removed). Postings are now
|
|
74
|
+
committed before the document row, so a failed commit is redone by the retry, and an index build replays
|
|
75
|
+
writes that a peer process skipped while the build ran.
|
|
76
|
+
- **Sync:** a replica that was sent a remove for a key it never had wedged for good (`… does not exist`);
|
|
77
|
+
it is now recorded as a no-op. A control pull no longer rewinds a newer data cursor, and an
|
|
78
|
+
acknowledgement that lands during a GC sweep queues another sweep instead of being dropped.
|
|
79
|
+
- **Queue `max_concurrency` never limited anything** (the running-job count scanned an empty range).
|
|
80
|
+
- **An index registered by one process was not maintained by processes already running** on the same
|
|
81
|
+
store; writes now pick up the new index (they retry with `INDEX_SET_CHANGED` internally), and the build
|
|
82
|
+
no longer overwrites a document written during its scan.
|
|
83
|
+
- **Time machine:** the first enable's seed no longer misses writes that land while it runs.
|
|
84
|
+
- **Logical rebuild (compaction fallback)** silently dropped index rows whose key starts with a null part
|
|
85
|
+
(both the raw and the typed copy), and its verification count could not notice.
|
|
86
|
+
|
|
7
87
|
## [2.6.4] - 2026-10-08
|
|
8
88
|
|
|
9
89
|
### Fixed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const _0x35715f=_0x9448;(function(_0x30a51b,_0x1385f4){const _0x3567d6=_0x9448,_0x2c632d=_0x30a51b();while(!![]){try{const _0x224325=parseInt(_0x3567d6(0xd9))/0x1*(-parseInt(_0x3567d6(0x11d))/0x2)+-parseInt(_0x3567d6(0xea))/0x3+-parseInt(_0x3567d6(0x167))/0x4+-parseInt(_0x3567d6(0x13c))/0x5*(-parseInt(_0x3567d6(0xe6))/0x6)+-parseInt(_0x3567d6(0x176))/0x7*(-parseInt(_0x3567d6(0x179))/0x8)+-parseInt(_0x3567d6(0x10f))/0x9*(parseInt(_0x3567d6(0x14d))/0xa)+parseInt(_0x3567d6(0x196))/0xb;if(_0x224325===_0x1385f4)break;else _0x2c632d['push'](_0x2c632d['shift']());}catch(_0x48d856){_0x2c632d['push'](_0x2c632d['shift']());}}}(_0x33c4,0x8b23a));var require$$0$1=require(_0x35715f(0x155)),require$$0=require('fs'),require$$1=require(_0x35715f(0x125)),require$$2=require('os'),require$$3=require(_0x35715f(0x118));function getDefaultExportFromCjs(_0x5e4c5a){const _0x57489b=_0x35715f;return _0x5e4c5a&&_0x5e4c5a[_0x57489b(0x150)]&&Object['prototype'][_0x57489b(0x11a)][_0x57489b(0x161)](_0x5e4c5a,_0x57489b(0x17f))?_0x5e4c5a[_0x57489b(0x17f)]:_0x5e4c5a;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x53ccdd=_0x35715f;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x18168c=require$$0,_0x724a6a=require$$1,_0x242203=require$$2,_0x417b52=require$$3;function _0x791e5b(){const _0x355c56=_0x9448;return Date[_0x355c56(0x16e)]();}function _0x4f7781(_0x1bc8a6){try{return _0x18168c['existsSync'](_0x1bc8a6);}catch{return![];}}function _0x40caeb(_0x4261f1){const _0x43eabd=_0x9448;try{return _0x18168c[_0x43eabd(0x152)](_0x4261f1,_0x43eabd(0x15d));}catch{return null;}}function _0x191186(_0x30286d,_0x3041b9){const _0x3ae26e=_0x9448,_0x586feb=_0x30286d+_0x3ae26e(0x19f)+_0x417b52[_0x3ae26e(0x134)](0x6)[_0x3ae26e(0x186)](_0x3ae26e(0x18b));_0x18168c[_0x3ae26e(0xf0)](_0x586feb,_0x3041b9),_0x18168c[_0x3ae26e(0xd5)](_0x586feb,_0x30286d);}function _0x2507e4(_0x4c3788,_0x3f37ea=0x10){const _0xcd1b4a=_0x9448,_0x296f1e=String(Math[_0xcd1b4a(0x126)](0x0,Math[_0xcd1b4a(0x18a)](_0x4c3788||0x0)));return _0x296f1e[_0xcd1b4a(0x18c)]>=_0x3f37ea?_0x296f1e:'0'['repeat'](_0x3f37ea-_0x296f1e['length'])+_0x296f1e;}return snapshotStore=class _0x17c722{constructor({dir:_0x3b1201,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0xe11dac=_0x9448;if(!_0x3b1201)throw new Error(_0xe11dac(0x19c));this[_0xe11dac(0x13a)]=_0x3b1201,this[_0xe11dac(0xfe)]=_0x724a6a[_0xe11dac(0x195)](_0x3b1201,_0xe11dac(0x197)),this[_0xe11dac(0x148)]=_0x724a6a[_0xe11dac(0x195)](_0x3b1201,_0xe11dac(0x1a4)),this[_0xe11dac(0x108)]=_0x724a6a[_0xe11dac(0x195)](_0x3b1201,_0xe11dac(0x1aa)),this[_0xe11dac(0x12d)]=keepSnapshots,this[_0xe11dac(0x1a7)]=log,_0x18168c[_0xe11dac(0x190)](this[_0xe11dac(0x13a)],{'recursive':!![]}),_0x18168c[_0xe11dac(0x190)](this[_0xe11dac(0xfe)],{'recursive':!![]});}['_snapshotDir'](_0x47245c){const _0x4dcd9d=_0x9448;return _0x724a6a[_0x4dcd9d(0x195)](this[_0x4dcd9d(0xfe)],_0x47245c);}['_snapshotPaths'](_0x58181d){const _0x4a5874=_0x9448,_0x3b07f6=this['_snapshotDir'](_0x58181d);return{'dir':_0x3b07f6,'index':_0x724a6a['join'](_0x3b07f6,'index.hnsw'),'labels':_0x724a6a['join'](_0x3b07f6,'labels.json'),'state':_0x724a6a['join'](_0x3b07f6,_0x4a5874(0x15f))};}[_0x53ccdd(0x119)](){const _0x60b7a8=_0x53ccdd;if(!_0x4f7781(this['currentPath']))return null;const _0xb25555=_0x40caeb(this['currentPath']);if(!_0xb25555)return null;const _0x37f116=String(_0xb25555)[_0x60b7a8(0x18e)]();return _0x37f116||null;}[_0x53ccdd(0xe3)](){const _0x5b31b1=_0x53ccdd,_0x4004f1=this[_0x5b31b1(0x119)]();if(!_0x4004f1)return 0x0;const _0x5573c4=Number(_0x4004f1);return Number[_0x5b31b1(0x194)](_0x5573c4)?_0x5573c4:0x0;}[_0x53ccdd(0x145)](){const _0x4501c9=_0x53ccdd;try{return _0x18168c[_0x4501c9(0x12f)](this[_0x4501c9(0xfe)],{'withFileTypes':!![]})['filter'](_0x13fcb4=>_0x13fcb4['isDirectory']())[_0x4501c9(0x170)](_0x33cd4d=>_0x33cd4d[_0x4501c9(0x163)])[_0x4501c9(0x102)](_0x11f3eb=>!_0x11f3eb[_0x4501c9(0x144)](_0x4501c9(0x19f)))[_0x4501c9(0x102)](_0x5179bc=>!_0x5179bc[_0x4501c9(0x144)](_0x4501c9(0x174)))['sort']();}catch{return[];}}['latestSnapshotId'](){const _0x400a80=_0x53ccdd,_0x2ed280=this[_0x400a80(0x119)]();if(_0x2ed280)return _0x2ed280;const _0x55e246=this[_0x400a80(0x145)]();if(!_0x55e246[_0x400a80(0x18c)])return null;return _0x55e246[_0x55e246[_0x400a80(0x18c)]-0x1];}['cleanupTmpDirs']({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x133414=_0x53ccdd;let _0x488034;try{_0x488034=_0x18168c[_0x133414(0x12f)](this['snapshotsDir'],{'withFileTypes':!![]});}catch{return;}const _0x4a094b=_0x791e5b()-maxAgeMs;for(const _0x8b1076 of _0x488034){if(!_0x8b1076[_0x133414(0x1a5)]())continue;const _0x132f86=_0x8b1076[_0x133414(0x163)];if(!_0x132f86['startsWith'](_0x133414(0x19f))&&!_0x132f86['startsWith'](_0x133414(0x174)))continue;const _0x14ff99=_0x724a6a[_0x133414(0x195)](this[_0x133414(0xfe)],_0x132f86);try{const _0x519138=_0x18168c[_0x133414(0xf5)](_0x14ff99);if(_0x519138['mtimeMs']>_0x4a094b)continue;}catch{}try{_0x18168c[_0x133414(0x11e)](_0x14ff99,{'recursive':!![],'force':!![]});}catch{}}}[_0x53ccdd(0x149)]({keep:keep=null}={}){const _0x2e7fef=_0x53ccdd,_0xfb8821=Math[_0x2e7fef(0x126)](0x1,Math[_0x2e7fef(0x18a)](keep??this[_0x2e7fef(0x12d)]??0x3)),_0x425552=this[_0x2e7fef(0x145)]();if(_0x425552[_0x2e7fef(0x18c)]<=_0xfb8821)return;const _0x1aaa62=this[_0x2e7fef(0x119)](),_0x5c25db=_0x425552[_0x2e7fef(0x164)](0x0,Math[_0x2e7fef(0x126)](0x0,_0x425552[_0x2e7fef(0x18c)]-_0xfb8821));for(const _0x4a7e95 of _0x5c25db){if(_0x1aaa62&&_0x4a7e95===_0x1aaa62)continue;const _0x3cc5bb=this['_snapshotDir'](_0x4a7e95);try{_0x18168c[_0x2e7fef(0x11e)](_0x3cc5bb,{'recursive':!![],'force':!![]});}catch{}}}async[_0x53ccdd(0x14b)](_0x241b86,_0x15c44b){const _0x3f7491=_0x53ccdd;if(!_0x241b86)throw new Error('snapshot\x20id\x20required');const _0x56d8f3=this[_0x3f7491(0x17e)](_0x241b86);if(!_0x4f7781(_0x56d8f3[_0x3f7491(0xf8)])||!_0x4f7781(_0x56d8f3[_0x3f7491(0xf4)])||!_0x4f7781(_0x56d8f3[_0x3f7491(0x17b)]))throw new Error(_0x3f7491(0x137)+_0x241b86);const _0x147a67=await _0x15c44b(_0x56d8f3);return _0x147a67||{};}async[_0x53ccdd(0xe9)](_0x20c3fa,_0x4a3d30,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x1344ce=_0x53ccdd,_0x9ee543=Number(_0x20c3fa);if(!Number['isFinite'](_0x9ee543)||_0x9ee543<0x0)throw new Error(_0x1344ce(0x158));const _0x2cc3ad=_0x2507e4(_0x9ee543),_0x2493e2=this[_0x1344ce(0x17d)](_0x2cc3ad),_0x95005f=_0x724a6a[_0x1344ce(0x195)](this[_0x1344ce(0xfe)],_0x1344ce(0x19f)+_0x2cc3ad+'-'+_0x417b52[_0x1344ce(0x134)](0x6)[_0x1344ce(0x186)](_0x1344ce(0x18b)));_0x18168c[_0x1344ce(0x190)](_0x95005f,{'recursive':!![]});const _0x4243ed={'dir':_0x95005f,'index':_0x724a6a[_0x1344ce(0x195)](_0x95005f,_0x1344ce(0x113)),'labels':_0x724a6a[_0x1344ce(0x195)](_0x95005f,_0x1344ce(0x11f)),'state':_0x724a6a[_0x1344ce(0x195)](_0x95005f,'state.json')};await _0x4a3d30(_0x4243ed,{'id':_0x2cc3ad,'clock':_0x9ee543});const _0x457d3f=JSON[_0x1344ce(0x112)]({'pid':process[_0x1344ce(0x19a)],'host':_0x242203['hostname'](),'at':_0x791e5b()}),_0x5bbbb0=_0x791e5b();let _0x89423c=null;const _0x581e54=()=>{const _0x38723c=_0x1344ce;try{const _0x21bb70=JSON[_0x38723c(0xfa)](_0x18168c['readFileSync'](this[_0x38723c(0x108)],'utf8'));if(_0x21bb70['at']&&_0x791e5b()-_0x21bb70['at']>staleLockMaxAgeMs){const _0x143be1=_0x791e5b()-_0x21bb70['at'],_0x3abd5f=_0x38723c(0x101)+Math['round'](_0x143be1/0x3e8)+_0x38723c(0x1a8)+_0x21bb70[_0x38723c(0x19a)]+_0x38723c(0x123)+_0x21bb70[_0x38723c(0x1a3)]+').\x20'+_0x38723c(0xf2);this['log']?.[_0x38723c(0x105)]?this['log'][_0x38723c(0x105)](_0x3abd5f):console['warn'](_0x38723c(0x142),_0x3abd5f);try{_0x18168c['unlinkSync'](this['lockPath']);}catch{}return!![];}}catch{try{_0x18168c['unlinkSync'](this[_0x38723c(0x108)]);}catch{}}return![];},_0x16064c=()=>{const _0x33112b=_0x1344ce;try{return _0x89423c=_0x18168c[_0x33112b(0x1a6)](this[_0x33112b(0x108)],'wx'),_0x18168c[_0x33112b(0xf0)](_0x89423c,_0x457d3f),!![];}catch(_0x4050bb){if(_0x4050bb&&_0x4050bb[_0x33112b(0x193)]==='EEXIST')return![];throw _0x4050bb;}};if(!_0x16064c()){_0x581e54(),_0x16064c();if(_0x89423c==null&&lockTimeoutMs>0x0)while(_0x791e5b()-_0x5bbbb0<lockTimeoutMs){await new Promise(_0x25ab85=>setTimeout(_0x25ab85,0x19));if(_0x16064c())break;_0x581e54();}}if(_0x89423c==null){try{_0x18168c['rmSync'](_0x95005f,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':'lock_busy'};}try{const _0x24e777=this[_0x1344ce(0xe3)]();if(_0x9ee543<=_0x24e777){try{_0x18168c[_0x1344ce(0x11e)](_0x95005f,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x1344ce(0x132),'currentClock':_0x24e777};}if(!_0x4f7781(_0x2493e2))_0x18168c[_0x1344ce(0xd5)](_0x95005f,_0x2493e2);else try{_0x18168c[_0x1344ce(0x11e)](_0x95005f,{'recursive':!![],'force':!![]});}catch{}return _0x191186(this[_0x1344ce(0x148)],_0x2cc3ad+'\x0a'),this['prune']({'keep':keep}),{'published':!![],'currentClock':_0x9ee543};}finally{try{_0x18168c[_0x1344ce(0x14c)](_0x89423c);}catch{}try{_0x18168c[_0x1344ce(0x14f)](this[_0x1344ce(0x108)]);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x3cad26=_0x35715f;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x162834=require$$0;class _0x57c2e9{constructor(){const _0x27fccd=_0x9448;this[_0x27fccd(0x128)]=new Map(),this[_0x27fccd(0xd4)]=new Map(),this[_0x27fccd(0x10e)]=0x0,this[_0x27fccd(0x191)]=0x0,this['keyToFp']=new Map(),this[_0x27fccd(0x139)]=!![];}async[_0x3cad26(0x133)](){const _0x25aec9=_0x3cad26;this[_0x25aec9(0x128)]=new Map(),this[_0x25aec9(0xd4)]=new Map(),this[_0x25aec9(0x184)]=new Map(),this[_0x25aec9(0x139)]=!![],this[_0x25aec9(0x10e)]=0x0,this[_0x25aec9(0x191)]=0x0;}async[_0x3cad26(0x15c)](_0x512e71){const _0x43a5bd=_0x3cad26;if(!_0x512e71||!_0x162834[_0x43a5bd(0xed)](_0x512e71))return await this['reset'](),!![];let _0x26e2ed;try{_0x26e2ed=_0x162834['readFileSync'](_0x512e71,_0x43a5bd(0x15d));}catch{return await this['reset'](),!![];}let _0x5c9bba;try{_0x5c9bba=JSON[_0x43a5bd(0xfa)](_0x26e2ed);}catch{return await this['reset'](),!![];}const _0x4747df=Array[_0x43a5bd(0xe4)](_0x5c9bba?.[_0x43a5bd(0x180)])?_0x5c9bba[_0x43a5bd(0x180)]:[],_0x3b68b9=Number['isInteger'](_0x5c9bba?.[_0x43a5bd(0x10e)])?_0x5c9bba['nextLabel']:0x0,_0x435930=new Map(),_0x5037a5=new Map(),_0x3899d9=new Map(),_0x1856e6=_0x5c9bba?.['version']>=0x2;let _0x77da7f=-0x1;for(const _0x505882 of _0x4747df){if(!Array['isArray'](_0x505882)||_0x505882[_0x43a5bd(0x18c)]<0x2)continue;const _0x22520a=Number(_0x505882[0x0]),_0x349255=String(_0x505882[0x1]??'');if(!Number[_0x43a5bd(0x188)](_0x22520a)||_0x22520a<0x0)continue;if(!_0x349255)continue;_0x435930[_0x43a5bd(0xd8)](_0x349255,_0x22520a),_0x5037a5['set'](_0x22520a,_0x349255);if(_0x1856e6&&typeof _0x505882[0x2]==='number')_0x3899d9[_0x43a5bd(0xd8)](_0x349255,_0x505882[0x2]);if(_0x22520a>_0x77da7f)_0x77da7f=_0x22520a;}return this[_0x43a5bd(0x128)]=_0x435930,this['labelToKey']=_0x5037a5,this[_0x43a5bd(0x184)]=_0x3899d9,this['hasFingerprints']=_0x1856e6,this[_0x43a5bd(0x10e)]=Math[_0x43a5bd(0x126)](_0x3b68b9,_0x77da7f+0x1,0x0),this['_tombstoneCount']=0x0,!![];}[_0x3cad26(0x183)](_0x29dea2){const _0x3e60f4=_0x3cad26;return this[_0x3e60f4(0x128)][_0x3e60f4(0x172)](_0x29dea2);}['labelForEphemeral'](_0x3a71e8){const _0x356e13=_0x3cad26;let _0x22ba6d=this[_0x356e13(0x128)][_0x356e13(0x172)](_0x3a71e8);if(_0x22ba6d!==undefined)return _0x22ba6d;return _0x22ba6d=this[_0x356e13(0x10e)]++,this[_0x356e13(0x128)][_0x356e13(0xd8)](_0x3a71e8,_0x22ba6d),this[_0x356e13(0xd4)]['set'](_0x22ba6d,_0x3a71e8),_0x22ba6d;}[_0x3cad26(0x114)](_0x33c717,_0x165c65){const _0x45e77d=_0x3cad26;if(_0x165c65==null)this[_0x45e77d(0x184)][_0x45e77d(0xeb)](_0x33c717);else this['keyToFp']['set'](_0x33c717,_0x165c65);}[_0x3cad26(0x12c)](_0x505989){const _0x2646c0=_0x3cad26;return this[_0x2646c0(0x184)][_0x2646c0(0x172)](_0x505989);}[_0x3cad26(0xd3)](){const _0x3cdb07=_0x3cad26;return this[_0x3cdb07(0x128)]['keys']();}[_0x3cad26(0x19d)](_0x2d4c4b){const _0x14c5fc=_0x3cad26,_0x3dcf34=this['keyToLabel'][_0x14c5fc(0x172)](_0x2d4c4b);if(_0x3dcf34===undefined)return;this['keyToFp'][_0x14c5fc(0xeb)](_0x2d4c4b),this['keyToLabel'][_0x14c5fc(0xeb)](_0x2d4c4b),this[_0x14c5fc(0xd4)][_0x14c5fc(0xeb)](_0x3dcf34),this[_0x14c5fc(0x191)]++;}[_0x3cad26(0x147)](_0x1e8157){const _0x56c293=_0x3cad26;return this[_0x56c293(0xd4)][_0x56c293(0x172)](_0x1e8157)??null;}[_0x3cad26(0x16d)](){const _0x51f6b8=_0x3cad26;return this[_0x51f6b8(0x128)][_0x51f6b8(0x16d)];}[_0x3cad26(0x19b)](){const _0x4c513d=_0x3cad26;return this[_0x4c513d(0x191)];}async[_0x3cad26(0x189)](_0x5a3e4f){const _0x3d5ded=_0x3cad26,_0x5c513f=_0x5a3e4f+_0x3d5ded(0x162),_0xd5c182=[];for(const [_0x4dd53b,_0x38f8a8]of this[_0x3d5ded(0xd4)][_0x3d5ded(0x180)]()){const _0x15db2e=this[_0x3d5ded(0x184)][_0x3d5ded(0x172)](_0x38f8a8);_0xd5c182['push'](_0x15db2e==null?[_0x4dd53b,_0x38f8a8]:[_0x4dd53b,_0x38f8a8,_0x15db2e]);}_0xd5c182[_0x3d5ded(0x17a)]((_0x560c78,_0x497afb)=>_0x560c78[0x0]-_0x497afb[0x0]);const _0xe16fc0={'version':0x2,'nextLabel':this[_0x3d5ded(0x10e)],'entries':_0xd5c182};_0x162834[_0x3d5ded(0xf0)](_0x5c513f,JSON[_0x3d5ded(0x112)](_0xe16fc0)),_0x162834[_0x3d5ded(0xd5)](_0x5c513f,_0x5a3e4f);}}return labelMap=_0x57c2e9,labelMap;}var indexConvergence,hasRequiredIndexConvergence;function requireIndexConvergence(){if(hasRequiredIndexConvergence)return indexConvergence;hasRequiredIndexConvergence=0x1;function _0x44778b(_0x38c079){const _0x11b2c8=_0x9448,_0x52cb2e=new Uint32Array(_0x38c079['buffer'],_0x38c079[_0x11b2c8(0xda)],_0x38c079[_0x11b2c8(0x18c)]);let _0x9341d9=0x811c9dc5,_0x1594e9=0x9747b28c;for(let _0x42f001=0x0;_0x42f001<_0x52cb2e[_0x11b2c8(0x18c)];_0x42f001++){const _0x35a975=_0x52cb2e[_0x42f001];_0x9341d9=Math['imul'](_0x9341d9^_0x35a975,0x1000193)>>>0x0;let _0x4e9c64=Math[_0x11b2c8(0x135)](_0x35a975,0xcc9e2d51);_0x4e9c64=_0x4e9c64<<0xf|_0x4e9c64>>>0x11,_0x1594e9=Math[_0x11b2c8(0x135)](_0x1594e9^Math[_0x11b2c8(0x135)](_0x4e9c64,0x1b873593),0x5)+0xe6546b64,_0x1594e9>>>=0x0;}return _0x1594e9=Math['imul'](_0x1594e9^_0x1594e9>>>0x10,0x85ebca6b)>>>0x0,(_0x9341d9>>>0x0)*0x100000+(_0x1594e9&0xfffff);}function _0x254643(_0x2e2e9b,_0x39350a,_0x3800ae,{upsert:_0x5e7fa0,remove:_0x5ecdd2}){const _0x3d6567=_0x9448,_0x236fa9=new Set();let _0x2f264e=0x0,_0x1e3a52=0x0,_0x2dc9e1=0x0;for(const {key:_0x11ff53,vector:_0x12eaf5}of _0x39350a){if(!(_0x12eaf5 instanceof Float32Array)||_0x12eaf5[_0x3d6567(0x18c)]!==_0x3800ae)continue;_0x236fa9[_0x3d6567(0x153)](_0x11ff53);const _0xfed7a3=_0x44778b(_0x12eaf5),_0x4d15ed=_0x2e2e9b[_0x3d6567(0x183)](_0x11ff53)!==undefined;if(_0x4d15ed&&_0x2e2e9b[_0x3d6567(0x12c)](_0x11ff53)===_0xfed7a3)continue;_0x5e7fa0(_0x11ff53,_0x12eaf5,_0xfed7a3);if(_0x4d15ed)_0x1e3a52++;else _0x2f264e++;}for(const _0x1e1a35 of[..._0x2e2e9b[_0x3d6567(0xd3)]()]){if(_0x236fa9[_0x3d6567(0x115)](_0x1e1a35))continue;_0x5ecdd2(_0x1e1a35),_0x2dc9e1++;}return{'added':_0x2f264e,'changed':_0x1e3a52,'removed':_0x2dc9e1};}return indexConvergence={'fingerprint':_0x44778b,'reconcileIndex':_0x254643},indexConvergence;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x270421=requireSnapshotStore(),_0x4eb93b=requireLabelMap(),{fingerprint:_0x3c8db5,reconcileIndex:_0x105354}=requireIndexConvergence(),_0xcdb1a5=0x1;let _0x302834=null;function _0x3d2274(){const _0x538ae1=_0x9448;if(_0x302834)return _0x302834;try{return _0x302834=require('hnswlib-node'),_0x302834;}catch(_0x9e6b0c){const _0x290548=new Error('HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20'+(_0x538ae1(0x106)+process[_0x538ae1(0x129)][_0x538ae1(0xfd)]+'\x20on\x20'+process[_0x538ae1(0x157)]+'/'+process['arch']+'.\x20')+'Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20'+(_0x538ae1(0x111)+(_0x9e6b0c?.[_0x538ae1(0x13b)]||String(_0x9e6b0c))));_0x290548[_0x538ae1(0x193)]=_0x538ae1(0x168),_0x290548[_0x538ae1(0x1a9)]=_0x9e6b0c;throw _0x290548;}}return hnsw=function _0x12715f(_0x59d025={},{dims:_0x56572c,dir:_0x5acb51}){const _0x483b93=_0x9448,_0x243f8d=_0x3d2274();if(!_0x56572c||_0x56572c<=0x0)throw new Error(_0x483b93(0x120));if(!_0x5acb51)throw new Error(_0x483b93(0xe2));const _0xf4d730={'metric':_0x59d025[_0x483b93(0x10d)]??_0x483b93(0x1ab),'M':_0x59d025['M']??0x10,'efConstruction':_0x59d025[_0x483b93(0x192)]??0xc8,'efSearch':_0x59d025[_0x483b93(0x130)]??0x40,'maxElements':_0x59d025['maxElements']??0x400,'growFactor':_0x59d025[_0x483b93(0x187)]??0x2,'snapshotEveryChanges':_0x59d025['snapshotEveryChanges']??0xc350,'keepSnapshots':_0x59d025[_0x483b93(0x12d)]??0x2,'tmpMaxAgeMs':_0x59d025[_0x483b93(0x175)]??0x6*0x36ee80},_0x18a6df=new _0x270421({'dir':_0x5acb51,'keepSnapshots':_0xf4d730['keepSnapshots']}),_0xebc386=new _0x4eb93b();let _0x87bb07=null,_0x54fb9f=0x0,_0x5a5f54=null,_0x51564e=Promise[_0x483b93(0x10b)]();const _0x36b9ce=_0x2b23f8=>{const _0x4febea=_0x483b93,_0x827879=_0x51564e[_0x4febea(0x146)](_0x2b23f8);return _0x51564e=_0x827879['catch'](()=>{}),_0x827879;};async function _0xcbb698(_0x166423){const _0x511048=_0x483b93;await _0xebc386['reset'](),_0x166423=_0x166423??[];const _0x595ca8=Math[_0x511048(0x126)](_0xf4d730[_0x511048(0x154)],Math['ceil'](_0x166423[_0x511048(0x18c)]*(_0xf4d730['growFactor']||1.2)),0x1);_0x87bb07=new _0x243f8d['HierarchicalNSW'](_0xf4d730[_0x511048(0x10d)],_0x56572c),_0x87bb07[_0x511048(0xdb)]({'maxElements':_0x595ca8,'efConstruction':_0xf4d730[_0x511048(0x192)],'M':_0xf4d730['M']});for(const {key:_0x497901,vector:_0x40ff2e}of _0x166423){if(!(_0x40ff2e instanceof Float32Array)||_0x40ff2e[_0x511048(0x18c)]!==_0x56572c)continue;_0x5d1445(_0x497901,_0x40ff2e);}_0x87bb07[_0x511048(0x10a)](_0xf4d730[_0x511048(0x130)]),_0x54fb9f=0x0;}async function _0x1bdc5a(_0x9050c8){return _0xcbb698(_0x9050c8?await _0x9050c8():[]);}function _0x18f687(){const _0x306359=_0x483b93;if(_0x87bb07[_0x306359(0x143)]()<_0x87bb07[_0x306359(0x16c)]())return;const _0x38aa2d=Math[_0x306359(0x100)](_0x87bb07[_0x306359(0x16c)]()*(_0xf4d730[_0x306359(0x187)]||0x2));_0x87bb07['resizeIndex'](_0x38aa2d),_0xf4d730[_0x306359(0x154)]=_0x38aa2d;}function _0x5d1445(_0xfcb78b,_0x249b63,_0x4594b0){const _0x302646=_0x483b93,_0x403fea=_0xebc386[_0x302646(0xdc)](_0xfcb78b);try{_0x87bb07[_0x302646(0x11c)](_0x403fea);}catch{}_0x18f687(),_0x87bb07[_0x302646(0x166)](Array[_0x302646(0x165)](_0x249b63),_0x403fea),_0xebc386[_0x302646(0x114)](_0xfcb78b,_0x4594b0??_0x3c8db5(_0x249b63));}function _0x46f1ab(_0x21ffab){const _0x52847a=_0x483b93,_0x16ea73=_0xebc386[_0x52847a(0x183)](_0x21ffab);if(_0x16ea73===undefined)return![];try{_0x87bb07[_0x52847a(0x11c)](_0x16ea73);}catch{}return _0xebc386[_0x52847a(0x19d)](_0x21ffab),!![];}function _0x1227e7(){const _0x45f557=_0x483b93;return Math['max'](Date[_0x45f557(0x16e)](),_0x18a6df[_0x45f557(0xe3)]()+0x1);}async function _0x58d189(_0x17e84c){const _0x539085=_0x483b93;if(!_0x87bb07||!_0x17e84c)return![];const _0x40fcc9=await _0x18a6df['publishSnapshot'](_0x17e84c,async _0x4993c6=>{const _0x4a686b=_0x9448;_0x87bb07[_0x4a686b(0x13f)](_0x4993c6[_0x4a686b(0xf8)]),await _0xebc386[_0x4a686b(0x189)](_0x4993c6[_0x4a686b(0xf4)]);const _0x4ba250=require$$0;_0x4ba250[_0x4a686b(0xf0)](_0x4993c6[_0x4a686b(0x17b)],JSON[_0x4a686b(0x112)]({'manifestVersion':_0xcdb1a5,'dims':_0x56572c,'metric':_0xf4d730[_0x4a686b(0x10d)],'clock':_0x17e84c,'snapshotAt':Date[_0x4a686b(0x16e)]()},null,0x2));},{'keep':_0xf4d730[_0x539085(0x12d)]});if(_0x40fcc9?.[_0x539085(0xfc)])_0x54fb9f=0x0;return _0x40fcc9?.[_0x539085(0xfc)]??![];}async function _0x53b48b(){const _0x267a61=_0x483b93,_0x3a8eef=_0x18a6df[_0x267a61(0x119)]()||_0x18a6df[_0x267a61(0x138)]();if(!_0x3a8eef)return null;let _0x25f5ba,_0xb365f9=![];return await _0x18a6df[_0x267a61(0x14b)](_0x3a8eef,async _0x257c5f=>{const _0x55d83f=_0x267a61,_0x2d02f7=require$$0;_0x25f5ba=JSON[_0x55d83f(0xfa)](_0x2d02f7[_0x55d83f(0x152)](_0x257c5f[_0x55d83f(0x17b)],_0x55d83f(0x15d)));if(_0x25f5ba[_0x55d83f(0x171)]!==_0xcdb1a5||_0x25f5ba[_0x55d83f(0x1ac)]!==_0x56572c||_0x25f5ba[_0x55d83f(0x10d)]!==_0xf4d730['metric']){_0x25f5ba=null;return;}await _0xebc386[_0x55d83f(0x15c)](_0x257c5f[_0x55d83f(0xf4)]),_0x87bb07=new _0x243f8d[(_0x55d83f(0x17c))](_0xf4d730['metric'],_0x56572c),_0x87bb07[_0x55d83f(0x117)](_0x257c5f['index']),_0x87bb07[_0x55d83f(0x10a)](_0xf4d730[_0x55d83f(0x130)]),_0xb365f9=!![];}),_0xb365f9?_0x25f5ba?.['clock']??0x0:null;}return{async 'load'(_0x355fb5){return _0x36b9ce(async()=>{const _0x3033b7=_0x9448;_0x18a6df[_0x3033b7(0x127)]({'maxAgeMs':_0xf4d730['tmpMaxAgeMs']}),_0x5a5f54=_0x355fb5??null;const _0x452956=await _0x53b48b(),_0x3dc55b=_0x355fb5?await _0x355fb5():null;if(_0x452956!=null){if(_0x3dc55b){if(!_0xebc386[_0x3033b7(0x139)])return await _0xcbb698(_0x3dc55b),null;const _0x3cc524=_0x105354(_0xebc386,_0x3dc55b,_0x56572c,{'upsert':_0x5d1445,'remove':_0x46f1ab});_0x54fb9f+=_0x3cc524[_0x3033b7(0xf7)]+_0x3cc524[_0x3033b7(0x15b)]+_0x3cc524[_0x3033b7(0x116)];}return _0x452956;}return await _0xcbb698(_0x3dc55b),null;});},async 'add'(_0x4b98d8,_0x430e93,_0x48df98){return _0x36b9ce(async()=>{const _0x28c470=_0x9448;if(!_0x87bb07)return;const _0x1a483b=_0x430e93 instanceof Float32Array?_0x430e93:new Float32Array(_0x430e93),_0x535b40=_0x3c8db5(_0x1a483b);if(_0xebc386[_0x28c470(0x12c)](_0x4b98d8)===_0x535b40)return;_0x5d1445(_0x4b98d8,_0x1a483b,_0x535b40),_0x54fb9f++,_0x54fb9f>=_0xf4d730[_0x28c470(0x199)]&&await _0x58d189(_0x1227e7());});},async 'remove'(_0x27350a){return _0x36b9ce(async()=>{if(!_0x87bb07)return;if(_0x46f1ab(_0x27350a))_0x54fb9f++;});},'search'(_0x365d81,{limit:limit=0xa,efSearch:_0x5e3697}={}){const _0x2abcec=_0x483b93;if(!_0x87bb07)return[];if(Number[_0x2abcec(0x188)](_0x5e3697))_0x87bb07[_0x2abcec(0x10a)](_0x5e3697);const _0x331bec=Math['min'](limit,_0x87bb07[_0x2abcec(0x143)]()||0x1),{neighbors:_0x5b6b48,distances:_0xcf00da}=_0x87bb07[_0x2abcec(0x156)](Array[_0x2abcec(0x165)](_0x365d81),_0x331bec),_0x199ee2=[];for(let _0x191aae=0x0;_0x191aae<_0x5b6b48[_0x2abcec(0x18c)];_0x191aae++){const _0x48ad02=_0xebc386[_0x2abcec(0x147)](_0x5b6b48[_0x191aae]);if(!_0x48ad02)continue;const _0x12e501=_0xf4d730['metric']===_0x2abcec(0x1ab)?Math[_0x2abcec(0x126)](0x0,0x1-_0xcf00da[_0x191aae]):0x1/(0x1+_0xcf00da[_0x191aae]);_0x199ee2['push']({'key':_0x48ad02,'score':_0x12e501});}return _0x199ee2;},async 'snapshot'(_0x5afd61){return _0x36b9ce(()=>_0x58d189(_0x5afd61??_0x1227e7()));},async 'rebuild'(_0x34a171){return _0x36b9ce(()=>{if(_0x34a171!=null)_0x5a5f54=_0x34a171;return _0x1bdc5a(_0x34a171??_0x5a5f54);});},async 'stop'(){const _0x1ea4a0=_0x483b93;return _0x36b9ce(()=>_0x54fb9f>0x0||!_0x18a6df[_0x1ea4a0(0x119)]()?_0x58d189(_0x1227e7()):![]);},'count'(){return _0xebc386['size']();},'info'(){const _0x303e54=_0x483b93;return{'algorithm':_0x303e54(0x16a),'metric':_0xf4d730[_0x303e54(0x10d)],'M':_0xf4d730['M'],'efConstruction':_0xf4d730[_0x303e54(0x192)],'efSearch':_0xf4d730['efSearch'],'maxElements':_0x87bb07?.[_0x303e54(0x16c)]()??_0xf4d730[_0x303e54(0x154)],'count':_0xebc386[_0x303e54(0x16d)](),'changesSince':_0x54fb9f,'snapshotDir':_0x5acb51,'latestSnapshot':_0x18a6df[_0x303e54(0x119)]()??null};}};},hnsw;}function _0x33c4(){const _0x24837f=['writer','getMaxElements','size','now','Index','map','manifestVersion','get','rebuild','_tmp-','tmpMaxAgeMs','7IiFCNx','expansionSearch','ENOENT','7365496ZYZyeE','sort','state','HierarchicalNSW','_snapshotDir','_snapshotPaths','default','entries','key','hasRows','labelForExisting','keyToFp','finally','toString','growFactor','isInteger','snapshotTo','trunc','hex','length','view','trim','release','mkdirSync','_tombstoneCount','efConstruction','code','isFinite','join','6489571Zwvjep','snapshots','arch','snapshotEveryChanges','pid','tombstoneCount','SnapshotStore\x20requires\x20dir','tombstone','algorithm','.tmp-','queryVec','usearch','expansionAdd','host','CURRENT','isDirectory','openSync','log','s,\x20pid:\x20','cause','SNAPSHOT.LOCK','cosine','dims','L2sq','snapshotMaxLagMs','keys','labelToKey','renameSync','MetricKind','vectors','set','3004CubWnT','byteOffset','initIndex','labelForEphemeral','unref','viewRefreshMs','sqrt','vector','min','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','readCurrentClock','isArray','token','6NXsqfk','postMessage','usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','publishSnapshot','217416LtGTSf','delete','load','existsSync','F32','remove','writeFileSync','Cos','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','fetchAll','labels','statSync','acquire','added','index','Unknown\x20op:\x20\x22','parse','search','published','node','snapshotsDir','push','ceil','Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20','filter','connectivity','ScalarKind','warn','for\x20Node\x20','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20','lockPath','snapshot','setEf','resolve','catch','metric','nextLabel','18igSdAH','clear','Original\x20error:\x20','stringify','index.hnsw','setFingerprint','has','removed','readIndexSync','crypto','readCurrentId','hasOwnProperty','reject','markDelete','128qJAlzq','rmSync','labels.json','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','usearch\x20algorithm\x20requires\x20dims\x20>\x200','sync',',\x20host:\x20','USEARCH_BINDINGS_UNAVAILABLE','path','max','cleanupTmpDirs','keyToLabel','versions','fetchAllResult','count','fingerprintOf','keepSnapshots','ready','readdirSync','efSearch','fid','stale','reset','randomBytes','imul','info','snapshot\x20incomplete:\x20','latestSnapshotId','hasFingerprints','dir','message','4683545SeGYDJ','unreadable','stop','writeIndexSync','\x20on\x20','reader','[SnapshotStore]','getCurrentCount','startsWith','listSnapshotIds','then','keyForLabel','currentPath','prune','memoryUsage','loadSnapshot','closeSync','3817190rkIRNo','EEXIST','unlinkSync','__esModule','flat','readFileSync','add','maxElements','worker_threads','searchKnn','platform','candidateClock\x20must\x20be\x20finite\x20>=\x200','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','heartbeatIntervalMs','changed','loadFrom','utf8','writerLockMaxAgeMs','state.json','clock','call','.tmp','name','slice','from','addPoint','3397108wZUlwN','HNSW_BINDINGS_UNAVAILABLE','error','hnsw'];_0x33c4=function(){return _0x24837f;};return _0x33c4();}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0xb4be5d(_0x5e6ba9={}){const _0x3a4a96=new Map();return{async 'load'(_0x3abfb9){const _0x4db906=_0x9448;_0x3a4a96[_0x4db906(0x110)]();if(_0x3abfb9)for(const {key:_0x51e4be,vector:_0x9f2a34}of await _0x3abfb9()){_0x3a4a96[_0x4db906(0xd8)](_0x51e4be,_0x9f2a34);}},async 'add'(_0x506e9f,_0x555e42,_0x29f5b9){_0x3a4a96['set'](_0x506e9f,_0x555e42);},async 'remove'(_0x3c1dd2){const _0x314307=_0x9448;_0x3a4a96[_0x314307(0xeb)](_0x3c1dd2);},'search'(_0x4194be,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x2e3cd5=_0x9448,_0x13f675=[];for(const [_0x11a6de,_0x574a5b]of _0x3a4a96){const _0x2600aa=_0x51ee30(_0x4194be,_0x574a5b);if(_0x2600aa>=threshold)_0x13f675['push']({'key':_0x11a6de,'score':_0x2600aa});}return _0x13f675[_0x2e3cd5(0x17a)]((_0x5165c5,_0x534f92)=>_0x534f92['score']-_0x5165c5['score']),_0x13f675['slice'](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x1fc7c2){const _0xb3d676=_0x9448;await this[_0xb3d676(0xec)](_0x1fc7c2);},async 'stop'(){},'count'(){const _0x3cd8ad=_0x9448;return _0x3a4a96[_0x3cd8ad(0x16d)];},'info'(){const _0x306e23=_0x9448;return{'algorithm':'flat','count':_0x3a4a96[_0x306e23(0x16d)]};}};};function _0x51ee30(_0x32479d,_0x4bd10a){const _0x53ca1f=_0x9448;let _0x119330=0x0,_0x1270f4=0x0,_0xdff689=0x0;for(let _0x2da40b=0x0;_0x2da40b<_0x32479d['length'];_0x2da40b++){_0x119330+=_0x32479d[_0x2da40b]*_0x4bd10a[_0x2da40b],_0x1270f4+=_0x32479d[_0x2da40b]*_0x32479d[_0x2da40b],_0xdff689+=_0x4bd10a[_0x2da40b]*_0x4bd10a[_0x2da40b];}const _0x3ae158=Math[_0x53ca1f(0xdf)](_0x1270f4)*Math['sqrt'](_0xdff689);return _0x3ae158===0x0?0x0:_0x119330/_0x3ae158;}return flat;}function _0x9448(_0x123bf4,_0x1d00dd){_0x123bf4=_0x123bf4-0xd3;const _0x33c4e3=_0x33c4();let _0x94481f=_0x33c4e3[_0x123bf4];return _0x94481f;}var okdbTimers,hasRequiredOkdbTimers;function requireOkdbTimers(){if(hasRequiredOkdbTimers)return okdbTimers;hasRequiredOkdbTimers=0x1;const _0x266062=0x2**0x1f-0x1;function _0x5b560b(_0x66e64b){if(!(_0x66e64b>0x0))return 0x0;return _0x66e64b>_0x266062?_0x266062:_0x66e64b;}function _0x1c00fc(_0x40a6c0){return _0x40a6c0===Infinity;}return okdbTimers={'MAX_TIMER_DELAY':_0x266062,'clampTimerDelay':_0x5b560b,'isNeverDelay':_0x1c00fc},okdbTimers;}var writerLock,hasRequiredWriterLock;function requireWriterLock(){if(hasRequiredWriterLock)return writerLock;hasRequiredWriterLock=0x1;const _0x39d160=require$$0,{clampTimerDelay:_0x4a91c3}=requireOkdbTimers(),_0x1478d9=require$$1,_0x162d54=require$$3;return writerLock=function _0x178a97(_0x621634,{maxAgeMs:maxAgeMs=0x3a98,heartbeatMs:heartbeatMs=0x1388,onLost:onLost=null}={}){const _0x51c268=_0x9448,_0xe8025c=_0x1478d9[_0x51c268(0x195)](_0x621634,'WRITER.LOCK'),_0x142ae7=_0x162d54['randomBytes'](0x8)[_0x51c268(0x186)](_0x51c268(0x18b));let _0x407f2c=![],_0x315f94=null;const _0x1ff929=()=>JSON[_0x51c268(0x112)]({'pid':process[_0x51c268(0x19a)],'token':_0x142ae7,'at':Date[_0x51c268(0x16e)]()});function _0xea15e8(){const _0x121da9=_0x51c268;try{return JSON['parse'](_0x39d160[_0x121da9(0x152)](_0xe8025c,'utf8'));}catch(_0x4caeaa){return _0x4caeaa?.[_0x121da9(0x193)]===_0x121da9(0x178)?null:{'unreadable':!![]};}}function _0x54eba4(){const _0x4ebdba=_0x51c268;try{const _0x463302=_0x39d160[_0x4ebdba(0x1a6)](_0xe8025c,'wx');try{_0x39d160[_0x4ebdba(0xf0)](_0x463302,_0x1ff929());}finally{_0x39d160['closeSync'](_0x463302);}return!![];}catch(_0x28f435){if(_0x28f435?.[_0x4ebdba(0x193)]===_0x4ebdba(0x14e))return![];throw _0x28f435;}}function _0x548928(_0x1d5516){const _0x4be334=_0x51c268;if(!_0x1d5516)return!![];if(_0x1d5516[_0x4be334(0x13d)])return!![];return Date[_0x4be334(0x16e)]()-(_0x1d5516['at']??0x0)>=maxAgeMs;}function _0x2468f3(){if(_0x315f94)clearInterval(_0x315f94);_0x315f94=null;}function _0x74a183(){const _0x57a0c4=_0x51c268;_0x2468f3(),_0x315f94=setInterval(()=>{const _0x32efbb=_0x9448,_0xc3110c=_0xea15e8();if(_0xc3110c&&!_0xc3110c[_0x32efbb(0x13d)]&&_0xc3110c[_0x32efbb(0xe5)]!==_0x142ae7){_0x407f2c=![],_0x2468f3();try{onLost?.();}catch{}return;}try{_0x39d160[_0x32efbb(0xf0)](_0xe8025c,_0x1ff929());}catch{}},_0x4a91c3(heartbeatMs)),_0x315f94[_0x57a0c4(0xdd)]?.();}function _0x39f0c5(){const _0x1f396b=_0x51c268,_0x1ee35a=_0xea15e8();return!!_0x1ee35a&&_0x1ee35a[_0x1f396b(0xe5)]===_0x142ae7;}return{'path':_0xe8025c,'token':_0x142ae7,'acquire'(){const _0x1b1f2d=_0x51c268,_0x367513=_0xea15e8();if(_0x367513&&_0x367513[_0x1b1f2d(0xe5)]===_0x142ae7){_0x407f2c=!![];if(!_0x315f94)_0x74a183();return!![];}let _0x3ec020=_0x54eba4();if(!_0x3ec020&&_0x548928(_0xea15e8())){try{_0x39d160[_0x1b1f2d(0x14f)](_0xe8025c);}catch{}_0x3ec020=_0x54eba4();}if(_0x3ec020&&!_0x39f0c5())_0x3ec020=![];_0x407f2c=_0x3ec020;if(_0x3ec020)_0x74a183();return _0x3ec020;},'held'(){return _0x407f2c;},'isFree'(){const _0x3acb6b=_0x51c268,_0x122408=_0xea15e8();if(_0x122408&&_0x122408[_0x3acb6b(0xe5)]===_0x142ae7)return![];return _0x548928(_0x122408);},'release'(){const _0x5b8f46=_0x51c268;_0x2468f3();if(!_0x407f2c)return;_0x407f2c=![];if(_0x39f0c5())try{_0x39d160[_0x5b8f46(0x14f)](_0xe8025c);}catch{}}};},writerLock;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x383dff=require$$0,{clampTimerDelay:_0x11e23d,isNeverDelay:_0x305b33}=requireOkdbTimers(),_0x42d966=requireSnapshotStore(),_0x521e11=requireLabelMap(),_0x453485=requireWriterLock(),{fingerprint:_0x11b0fe,reconcileIndex:_0x5d7efc}=requireIndexConvergence(),_0x477e7a=0x1;let _0x349fad=null;function _0x13502e(){const _0x3be0d4=_0x9448;if(_0x349fad)return _0x349fad;try{return _0x349fad=require('usearch'),_0x349fad;}catch(_0x1b0db8){const _0x3e34a1=new Error(_0x3be0d4(0x159)+(_0x3be0d4(0x106)+process[_0x3be0d4(0x129)][_0x3be0d4(0xfd)]+_0x3be0d4(0x140)+process[_0x3be0d4(0x157)]+'/'+process[_0x3be0d4(0x198)]+'.\x20')+_0x3be0d4(0x107)+(_0x3be0d4(0x111)+(_0x1b0db8?.[_0x3be0d4(0x13b)]||String(_0x1b0db8))));_0x3e34a1[_0x3be0d4(0x193)]=_0x3be0d4(0x124),_0x3e34a1[_0x3be0d4(0x1a9)]=_0x1b0db8;throw _0x3e34a1;}}function _0x19d7a4(_0x260a10,_0x18a54f){const _0x2a10d7=_0x9448;switch(_0x260a10){case'cosine':return _0x18a54f[_0x2a10d7(0xd6)][_0x2a10d7(0xf1)];case'l2':return _0x18a54f[_0x2a10d7(0xd6)][_0x2a10d7(0x1ad)];case'ip':return _0x18a54f[_0x2a10d7(0xd6)]['IP'];default:return _0x18a54f['MetricKind'][_0x2a10d7(0xf1)];}}return usearch=function _0x422c70(_0x457b1f={},{dims:_0x3026de,dir:_0x1aaea1,fetchAll:fetchAll=null,onChange:onChange=null}={}){const _0x53a664=_0x9448,_0x3a1a05=_0x13502e();if(!_0x3026de||_0x3026de<=0x0)throw new Error(_0x53a664(0x121));if(!_0x1aaea1)throw new Error(_0x53a664(0xe8));const _0x4ea967={'metric':_0x457b1f[_0x53a664(0x10d)]??_0x53a664(0x1ab),'connectivity':_0x457b1f['connectivity']??0x10,'expansionAdd':_0x457b1f[_0x53a664(0x1a2)]??0x80,'expansionSearch':_0x457b1f['expansionSearch']??0x40,'snapshotEveryChanges':_0x457b1f[_0x53a664(0x199)]??0xc350,'snapshotMaxLagMs':_0x457b1f[_0x53a664(0x1ae)]??0x2710,'keepSnapshots':_0x457b1f[_0x53a664(0x12d)]??0x2,'tmpMaxAgeMs':_0x457b1f[_0x53a664(0x175)]??0x6*0x36ee80,'heartbeatIntervalMs':_0x457b1f['heartbeatIntervalMs']??0x1388,'writerLockMaxAgeMs':_0x457b1f[_0x53a664(0x15e)]??0x3a98,'viewRefreshMs':_0x457b1f[_0x53a664(0xde)]??0x3e8},_0x1e7eaf=new _0x42d966({'dir':_0x1aaea1,'keepSnapshots':_0x4ea967[_0x53a664(0x12d)]}),_0x5dc882=_0x453485(_0x1aaea1,{'maxAgeMs':_0x4ea967['writerLockMaxAgeMs'],'heartbeatMs':_0x4ea967[_0x53a664(0x15a)],'onLost':()=>{const _0x3b9dd5=_0x53a664;_0x490487(_0x2cf3e8)[_0x3b9dd5(0x10c)](()=>{});}});let _0xf90cbc=new _0x521e11(),_0x2af47b=null,_0x38a95c=0x0,_0x3ab34a=null,_0x4ca126=![],_0x84eab=![],_0x115467=null,_0x4318e6=0x0,_0x3d6b46=null,_0x265c0e=0x0,_0xf6f36a=![],_0x110871=Promise['resolve']();const _0x490487=_0x1dd674=>{const _0x417a31=_0x53a664,_0x10792f=_0x110871[_0x417a31(0x146)](_0x1dd674);return _0x110871=_0x10792f[_0x417a31(0x10c)](()=>{}),_0x10792f;},_0x1b54cc=()=>{try{onChange?.();}catch{}};function _0x5be32e(){const _0x4cf50e=_0x53a664;return new _0x3a1a05[(_0x4cf50e(0x16f))]({'dimensions':_0x3026de,'metric':_0x19d7a4(_0x4ea967[_0x4cf50e(0x10d)],_0x3a1a05),'quantization':_0x3a1a05[_0x4cf50e(0x104)][_0x4cf50e(0xee)],'connectivity':_0x4ea967[_0x4cf50e(0x103)],'expansion_add':_0x4ea967[_0x4cf50e(0x1a2)],'expansion_search':_0x4ea967[_0x4cf50e(0x177)],'multi':![]});}function _0x2138e7(_0x5a25f2){return _0x5a25f2 instanceof Float32Array?_0x5a25f2:new Float32Array(_0x5a25f2);}function _0x317a47(){const _0x36e5aa=_0x53a664;if(fetchAll)return fetchAll();if(_0x3ab34a)return _0x3ab34a();return Promise[_0x36e5aa(0x10b)](null);}function _0x34e2ae(_0x310b77,_0x2e9bc7,_0x479c16){const _0x2c4254=_0x53a664,_0x24b7a0=_0xf90cbc['labelForExisting'](_0x310b77);if(_0x24b7a0!==undefined)try{_0x2af47b[_0x2c4254(0xef)](BigInt(_0x24b7a0));}catch{}const _0x5bea34=_0xf90cbc['labelForEphemeral'](_0x310b77);_0x2af47b[_0x2c4254(0x153)](BigInt(_0x5bea34),_0x2e9bc7),_0xf90cbc[_0x2c4254(0x114)](_0x310b77,_0x479c16??_0x11b0fe(_0x2e9bc7));}function _0x275585(_0x127ddc){const _0x4d7209=_0x53a664,_0x5cebd9=_0xf90cbc[_0x4d7209(0x183)](_0x127ddc);if(_0x5cebd9===undefined)return![];try{_0x2af47b['remove'](BigInt(_0x5cebd9));}catch{}return _0xf90cbc[_0x4d7209(0x19d)](_0x127ddc),!![];}function _0x2986de(_0x2d54c1){const _0x42064e=_0x53a664;_0xf90cbc=new _0x521e11(),_0x2af47b=_0x5be32e();for(const {key:_0x378d1a,vector:_0x467a2b}of _0x2d54c1??[]){if(!(_0x467a2b instanceof Float32Array)||_0x467a2b[_0x42064e(0x18c)]!==_0x3026de)continue;_0x34e2ae(_0x378d1a,_0x467a2b);}_0x38a95c=0x0;}function _0x41ca82(){const _0x3667b0=_0x53a664;return Math['max'](Date[_0x3667b0(0x16e)](),_0x1e7eaf[_0x3667b0(0xe3)]()+0x1);}function _0x3110ed(){if(_0x115467)clearTimeout(_0x115467);_0x115467=null;}function _0xbbe943(){const _0x447767=_0x53a664;if(!_0x4ea967[_0x447767(0x1ae)]||_0x305b33(_0x4ea967[_0x447767(0x1ae)])||_0x115467||!_0x84eab||_0x38a95c<=0x0)return;const _0x31a143=_0x11e23d(Math[_0x447767(0x126)](_0x4ea967[_0x447767(0x1ae)],0xa*_0x4318e6));_0x115467=setTimeout(()=>{const _0x200984=_0x447767;_0x115467=null,_0x490487(async()=>{if(_0x84eab&&_0x38a95c>0x0)await _0x342543();_0xbbe943(),_0x1b54cc();})[_0x200984(0x10c)](()=>{});},_0x31a143),_0x115467[_0x447767(0xdd)]?.();}async function _0x342543(_0x53b029){const _0x632000=_0x53a664;if(!_0x2af47b)return![];const _0x1e7f4b=_0x53b029??_0x41ca82(),_0x2d94c6=Date['now'](),_0x1f5643=await _0x1e7eaf[_0x632000(0xe9)](_0x1e7f4b,async _0xcceace=>{const _0x1b69c9=_0x632000;_0x2af47b['save'](_0xcceace[_0x1b69c9(0xf8)]),await _0xf90cbc[_0x1b69c9(0x189)](_0xcceace['labels']),_0x383dff[_0x1b69c9(0xf0)](_0xcceace['state'],JSON[_0x1b69c9(0x112)]({'manifestVersion':_0x477e7a,'algorithm':_0x1b69c9(0x1a1),'dims':_0x3026de,'metric':_0x4ea967[_0x1b69c9(0x10d)],'clock':_0x1e7f4b,'snapshotAt':Date[_0x1b69c9(0x16e)]()},null,0x2));},{'keep':_0x4ea967[_0x632000(0x12d)]});return _0x4318e6=Date[_0x632000(0x16e)]()-_0x2d94c6,_0x1f5643?.[_0x632000(0xfc)]&&(_0x38a95c=0x0,_0x3110ed()),_0x1f5643?.[_0x632000(0xfc)]??![];}function _0x25af3a(){const _0x23b1bb=_0x53a664;_0x38a95c++;if(_0x38a95c>=_0x4ea967[_0x23b1bb(0x199)])return _0x342543();return _0xbbe943(),null;}async function _0x496298(){const _0x4aa99b=_0x53a664,_0xd6c3ec=_0x1e7eaf['readCurrentId']()||_0x1e7eaf[_0x4aa99b(0x138)]();if(!_0xd6c3ec)return null;let _0x3ee983,_0x5c995a=![];try{await _0x1e7eaf[_0x4aa99b(0x14b)](_0xd6c3ec,async _0x1d900b=>{const _0x2382ff=_0x4aa99b;_0x3ee983=JSON[_0x2382ff(0xfa)](_0x383dff['readFileSync'](_0x1d900b['state'],'utf8'));if(_0x3ee983[_0x2382ff(0x171)]!==_0x477e7a||_0x3ee983['algorithm']!==_0x2382ff(0x1a1)||_0x3ee983[_0x2382ff(0x1ac)]!==_0x3026de||_0x3ee983['metric']!==_0x4ea967['metric']){_0x3ee983=null;return;}const _0x2acaf2=new _0x521e11();await _0x2acaf2[_0x2382ff(0x15c)](_0x1d900b[_0x2382ff(0xf4)]);const _0x22751d=_0x5be32e();_0x22751d['load'](_0x1d900b[_0x2382ff(0xf8)]),_0xf90cbc=_0x2acaf2,_0x2af47b=_0x22751d,_0x5c995a=!![];});}catch{return null;}return _0x5c995a?_0x3ee983?.[_0x4aa99b(0x160)]??0x0:null;}async function _0x3f7753(_0x54ef92){const _0x5885f3=_0x53a664;_0x3d6b46=null;const _0x147441=await _0x496298();if(_0x147441!=null){_0x38a95c=0x0;if(_0x54ef92){if(!_0xf90cbc['hasFingerprints'])return _0x2986de(_0x54ef92),await _0x342543(),null;const _0x120555=_0x5d7efc(_0xf90cbc,_0x54ef92,_0x3026de,{'upsert':_0x34e2ae,'remove':_0x275585}),_0x334a65=_0x120555[_0x5885f3(0xf7)]+_0x120555[_0x5885f3(0x15b)]+_0x120555['removed'];_0x334a65>0x0&&(_0x38a95c+=_0x334a65,await _0x342543());}return _0x147441;}_0x2986de(_0x54ef92??[]);if(_0x2af47b[_0x5885f3(0x16d)]()>0x0)await _0x342543();return null;}async function _0x4b8058(){_0x84eab=!![],await _0x3f7753(await _0x317a47());}async function _0x2cf3e8(){const _0x1050c5=_0x53a664;if(!_0x84eab)return;_0x84eab=![],_0x3110ed(),_0x38a95c=0x0;const _0x13481f=_0x1e7eaf[_0x1050c5(0x119)]()||_0x1e7eaf['latestSnapshotId']();await _0x57f51c(_0x13481f),_0x1b54cc();}async function _0x57f51c(_0x2ecda0){const _0x53bd9a=_0x53a664;if(!_0x2ecda0)return![];let _0x1d1066=![];try{await _0x1e7eaf[_0x53bd9a(0x14b)](_0x2ecda0,async _0x30b08a=>{const _0x243bc2=_0x53bd9a,_0x4c96d5=JSON['parse'](_0x383dff['readFileSync'](_0x30b08a['state'],_0x243bc2(0x15d)));if(_0x4c96d5['manifestVersion']!==_0x477e7a||_0x4c96d5[_0x243bc2(0x19e)]!==_0x243bc2(0x1a1)||_0x4c96d5[_0x243bc2(0x1ac)]!==_0x3026de||_0x4c96d5[_0x243bc2(0x10d)]!==_0x4ea967[_0x243bc2(0x10d)])return;const _0x30f211=new _0x521e11();await _0x30f211[_0x243bc2(0x15c)](_0x30b08a[_0x243bc2(0xf4)]);const _0x5374b0=_0x5be32e();_0x5374b0[_0x243bc2(0x18d)](_0x30b08a[_0x243bc2(0xf8)]),_0x2af47b=_0x5374b0,_0xf90cbc=_0x30f211,_0x3d6b46=_0x2ecda0,_0x1d1066=!![];});}catch{}return _0x1d1066;}function _0x72e50c(){const _0x3c0094=_0x53a664,_0x2cb7cc=Date[_0x3c0094(0x16e)]();if(_0x2cb7cc-_0x265c0e<_0x4ea967[_0x3c0094(0xde)])return;_0x265c0e=_0x2cb7cc;if(_0xf6f36a)return;if(_0x5dc882['isFree']()){_0xf6f36a=!![],_0x490487(async()=>{!_0x84eab&&_0x4ca126&&_0x5dc882['acquire']()&&(await _0x4b8058(),_0x1b54cc());})[_0x3c0094(0x10c)](()=>{})['finally'](()=>{_0xf6f36a=![];});return;}const _0x2a9b0f=_0x1e7eaf[_0x3c0094(0x119)]()||_0x1e7eaf[_0x3c0094(0x138)]();if(!_0x2a9b0f||_0x2a9b0f===_0x3d6b46)return;_0xf6f36a=!![],_0x490487(async()=>{if(!_0x84eab&&await _0x57f51c(_0x2a9b0f))_0x1b54cc();})[_0x3c0094(0x10c)](()=>{})[_0x3c0094(0x185)](()=>{_0xf6f36a=![];});}return{async 'load'(_0x547fa7){return _0x490487(async()=>{const _0x2187c9=_0x9448;_0x1e7eaf[_0x2187c9(0x127)]({'maxAgeMs':_0x4ea967[_0x2187c9(0x175)]}),_0x3ab34a=_0x547fa7??null,_0x84eab=_0x5dc882[_0x2187c9(0xf6)]();let _0x321f4a=null;if(_0x84eab)_0x321f4a=await _0x3f7753(_0x547fa7?await _0x547fa7():null);else{const _0xcdadb6=_0x1e7eaf[_0x2187c9(0x119)]()||_0x1e7eaf['latestSnapshotId']();await _0x57f51c(_0xcdadb6);}return _0x4ca126=!![],_0x321f4a;});},async 'add'(_0x1549d8,_0x4280d9,_0x1fd22c){return _0x490487(async()=>{const _0x2478e4=_0x9448;if(!_0x4ca126)return;const _0x5be524=_0x2138e7(_0x4280d9);if(!_0x84eab){if(!_0x5dc882['acquire']())return;await _0x4b8058();}if(!_0x2af47b)return;const _0x39d527=_0x11b0fe(_0x5be524);if(_0xf90cbc[_0x2478e4(0x12c)](_0x1549d8)===_0x39d527)return;_0x34e2ae(_0x1549d8,_0x5be524,_0x39d527),await _0x25af3a();});},async 'remove'(_0x1fb228){return _0x490487(async()=>{const _0x344f41=_0x9448;if(!_0x4ca126)return;if(!_0x84eab){if(!_0x5dc882[_0x344f41(0xf6)]())return;await _0x4b8058();}if(!_0x2af47b)return;if(_0x275585(_0x1fb228))await _0x25af3a();});},'search'(_0xd9662c,{limit:limit=0xa}={}){const _0x422dbe=_0x53a664;if(!_0x84eab&&_0x4ca126)_0x72e50c();if(!_0x2af47b)return[];const _0x340266=_0x2af47b[_0x422dbe(0x16d)]();if(_0x340266===0x0)return[];const _0x1425b8=Math[_0x422dbe(0xe1)](limit,_0x340266),_0x50cb48=_0x2af47b[_0x422dbe(0xfb)](_0x2138e7(_0xd9662c),_0x1425b8,0x0),_0x44fea5=[],_0x351015=_0x50cb48[_0x422dbe(0xd3)],_0x2f357f=_0x50cb48['distances'];for(let _0x3a283b=0x0;_0x3a283b<_0x351015['length'];_0x3a283b++){const _0x725379=_0x351015[_0x3a283b];if(_0x725379===0xffffffffffffffffn)continue;const _0x1f061b=Number(_0x725379),_0x17cfb3=_0xf90cbc[_0x422dbe(0x147)](_0x1f061b);if(!_0x17cfb3)continue;const _0x169bc5=_0x2f357f[_0x3a283b];let _0x4cbc78;if(_0x4ea967['metric']==='cosine')_0x4cbc78=Math[_0x422dbe(0x126)](0x0,0x1-_0x169bc5);else{if(_0x4ea967[_0x422dbe(0x10d)]==='ip')_0x4cbc78=-_0x169bc5;else _0x4cbc78=0x1/(0x1+_0x169bc5);}_0x44fea5[_0x422dbe(0xff)]({'key':_0x17cfb3,'score':_0x4cbc78});}return _0x44fea5;},async 'snapshot'(_0x16fa19){return _0x490487(()=>_0x84eab?_0x342543(_0x16fa19??undefined):![]);},async 'rebuild'(_0x9a36b6){return _0x490487(async()=>{const _0x2e8eb2=_0x9448;if(_0x9a36b6!=null)_0x3ab34a=_0x9a36b6;if(!_0x84eab){if(!_0x5dc882[_0x2e8eb2(0xf6)]())return;_0x84eab=!![];}const _0x2a7755=_0x9a36b6?await _0x9a36b6():await _0x317a47();_0x2986de(_0x2a7755??[]),_0x4ca126=!![],await _0x342543();});},async 'stop'(){return _0x490487(async()=>{const _0x1e3df4=_0x9448;_0x3110ed();if(_0x84eab){if(_0x38a95c>0x0||!_0x1e7eaf[_0x1e3df4(0x119)]())await _0x342543();_0x5dc882[_0x1e3df4(0x18f)]();}_0x84eab=![],_0x4ca126=![];});},'count'(){const _0x21d083=_0x53a664;return _0xf90cbc[_0x21d083(0x16d)]();},'info'(){const _0x27096b=_0x53a664;return{'algorithm':'usearch','role':_0x84eab?_0x27096b(0x16b):_0x27096b(0x141),'metric':_0x4ea967[_0x27096b(0x10d)],'connectivity':_0x4ea967[_0x27096b(0x103)],'expansionAdd':_0x4ea967['expansionAdd'],'expansionSearch':_0x4ea967['expansionSearch'],'snapshotEveryChanges':_0x4ea967[_0x27096b(0x199)],'snapshotMaxLagMs':_0x4ea967['snapshotMaxLagMs'],'count':_0xf90cbc[_0x27096b(0x16d)](),'size':_0x2af47b?.[_0x27096b(0x16d)]?.()??0x0,'capacity':_0x2af47b?.['capacity']?.()??0x0,'changesSince':_0x84eab?_0x38a95c:null,'viewedSnapshot':_0x3d6b46??null,'snapshotDir':_0x1aaea1,'latestSnapshot':_0x1e7eaf[_0x27096b(0x119)]()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0x560435=_0x35715f;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x4026e9,workerData:_0x38129a}=require$$0$1,{algorithmName:_0x3e7b10,algorithmConfig:_0x5939b6,dims:_0xf61d78,dir:_0x16dcfd}=_0x38129a;let _0x45ec65=0x1;const _0x1915f0=new Map();function _0x5d2946(){const _0x278054=_0x45ec65++;return new Promise((_0x39e81b,_0xc8501)=>{const _0x5617aa=_0x9448;_0x1915f0['set'](_0x278054,{'resolve':_0x39e81b,'reject':_0xc8501}),_0x4026e9[_0x5617aa(0xe7)]({'op':_0x5617aa(0xf3),'fid':_0x278054});});}const _0x422e01={'dims':_0xf61d78,'dir':_0x16dcfd,'fetchAll':_0x5d2946,'onChange':()=>_0x884f35()};let _0x291134;if(_0x3e7b10===_0x560435(0x16a))_0x291134=requireHnsw()(_0x5939b6,_0x422e01);else{if(_0x3e7b10===_0x560435(0x151))_0x291134=requireFlat()(_0x5939b6,_0x422e01);else{if(_0x3e7b10==='usearch')_0x291134=requireUsearch()(_0x5939b6,_0x422e01);else throw new Error('Unknown\x20algorithm:\x20\x22'+_0x3e7b10+'\x22');}}function _0x884f35(){const _0x44bf20=_0x560435;try{_0x4026e9[_0x44bf20(0xe7)]({'op':_0x44bf20(0x122),'count':_0x291134['count'](),'info':_0x291134[_0x44bf20(0x136)](),'memory':process[_0x44bf20(0x14a)]()});}catch{}}function _0x4130e9(_0x4e70c4){const _0x98f65e=_0x560435;return(_0x4e70c4||[])[_0x98f65e(0x170)](_0x48d679=>({'key':_0x48d679[_0x98f65e(0x181)],'vector':_0x48d679[_0x98f65e(0xe0)]instanceof Float32Array?_0x48d679['vector']:new Float32Array(_0x48d679[_0x98f65e(0xe0)])}));}return _0x4026e9['on'](_0x560435(0x13b),async _0x486cc8=>{const _0x4c6007=_0x560435;if(_0x486cc8['op']===_0x4c6007(0x12a)){const _0x56db6c=_0x1915f0[_0x4c6007(0x172)](_0x486cc8[_0x4c6007(0x131)]);if(!_0x56db6c)return;_0x1915f0['delete'](_0x486cc8[_0x4c6007(0x131)]);if(_0x486cc8[_0x4c6007(0x169)])_0x56db6c[_0x4c6007(0x11b)](new Error(_0x486cc8['error']));else _0x56db6c[_0x4c6007(0x10b)](_0x4130e9(_0x486cc8[_0x4c6007(0xd7)]));return;}const {id:_0x209ebd,op:_0x450239,args:_0xd7a514}=_0x486cc8;try{let _0x6ef2fc;switch(_0x450239){case'load':{_0x6ef2fc=await _0x291134[_0x4c6007(0xec)](_0xd7a514[_0x4c6007(0x182)]?_0x5d2946:null),_0x884f35();break;}case'add':{const _0x1b1ed4=_0xd7a514['vector']instanceof Float32Array?_0xd7a514[_0x4c6007(0xe0)]:new Float32Array(_0xd7a514[_0x4c6007(0xe0)]);await _0x291134[_0x4c6007(0x153)](_0xd7a514[_0x4c6007(0x181)],_0x1b1ed4,_0xd7a514[_0x4c6007(0x160)]??undefined),_0x884f35(),_0x6ef2fc=null;break;}case'remove':{await _0x291134[_0x4c6007(0xef)](_0xd7a514['key']),_0x884f35(),_0x6ef2fc=null;break;}case'search':{const _0x55c475=_0xd7a514['queryVec']instanceof Float32Array?_0xd7a514[_0x4c6007(0x1a0)]:new Float32Array(_0xd7a514['queryVec']);_0x6ef2fc=_0x291134[_0x4c6007(0xfb)](_0x55c475,_0xd7a514['opts']||{});break;}case _0x4c6007(0x109):{_0x6ef2fc=await _0x291134['snapshot'](_0xd7a514[_0x4c6007(0x160)]),_0x884f35();break;}case _0x4c6007(0x173):{const _0x54999c=_0x4130e9(_0xd7a514[_0x4c6007(0xd7)]);await _0x291134[_0x4c6007(0x173)](async()=>_0x54999c),_0x884f35(),_0x6ef2fc=null;break;}case _0x4c6007(0x13e):{await _0x291134[_0x4c6007(0x13e)](),_0x884f35(),_0x6ef2fc=null;break;}case _0x4c6007(0x12b):{_0x6ef2fc=_0x291134['count']();break;}case _0x4c6007(0x136):{_0x6ef2fc=_0x291134['info']();break;}default:throw new Error(_0x4c6007(0xf9)+_0x450239+'\x22');}_0x4026e9[_0x4c6007(0xe7)]({'id':_0x209ebd,'result':_0x6ef2fc});}catch(_0x6c7a7f){_0x4026e9[_0x4c6007(0xe7)]({'id':_0x209ebd,'error':{'message':_0x6c7a7f?.[_0x4c6007(0x13b)]||String(_0x6c7a7f),'code':_0x6c7a7f?.['code']}});}}),_0x4026e9[_0x560435(0xe7)]({'op':_0x560435(0x12e)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module['exports']=algorithmWorkerThread;
|
|
1
|
+
'use strict';const _0x2bb8dc=_0x4d49;(function(_0x3100ca,_0x527ae4){const _0x31934c=_0x4d49,_0x326104=_0x3100ca();while(!![]){try{const _0x1c5d54=-parseInt(_0x31934c(0x1d9))/0x1*(parseInt(_0x31934c(0x204))/0x2)+parseInt(_0x31934c(0x1eb))/0x3+parseInt(_0x31934c(0x1c2))/0x4+-parseInt(_0x31934c(0x232))/0x5*(parseInt(_0x31934c(0x1b0))/0x6)+-parseInt(_0x31934c(0x173))/0x7*(parseInt(_0x31934c(0x16c))/0x8)+parseInt(_0x31934c(0x1f1))/0x9+parseInt(_0x31934c(0x16f))/0xa*(parseInt(_0x31934c(0x17e))/0xb);if(_0x1c5d54===_0x527ae4)break;else _0x326104['push'](_0x326104['shift']());}catch(_0x559b23){_0x326104['push'](_0x326104['shift']());}}}(_0x1e68,0x5f2ee));function _0x4d49(_0x3eade8,_0x482bfa){_0x3eade8=_0x3eade8-0x15b;const _0x1e68d9=_0x1e68();let _0x4d4977=_0x1e68d9[_0x3eade8];return _0x4d4977;}var require$$0$1=require(_0x2bb8dc(0x21d)),require$$0=require('fs'),require$$1=require(_0x2bb8dc(0x179)),require$$2=require('os'),require$$3=require('crypto');function getDefaultExportFromCjs(_0x1b20f6){const _0x573f2e=_0x2bb8dc;return _0x1b20f6&&_0x1b20f6[_0x573f2e(0x1ca)]&&Object[_0x573f2e(0x21b)]['hasOwnProperty'][_0x573f2e(0x187)](_0x1b20f6,_0x573f2e(0x1e0))?_0x1b20f6[_0x573f2e(0x1e0)]:_0x1b20f6;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x4b8fc4=_0x2bb8dc;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x543d78=require$$0,_0x3c540b=require$$1,_0x97a72d=require$$2,_0x346446=require$$3;function _0x5dd036(){const _0x171c64=_0x4d49;return Date[_0x171c64(0x22b)]();}function _0x2511cc(_0xe6d812){const _0x422827=_0x4d49;try{return _0x543d78[_0x422827(0x20a)](_0xe6d812);}catch{return![];}}function _0x3b8d72(_0x2d9223){const _0x26ec34=_0x4d49;try{return _0x543d78[_0x26ec34(0x18e)](_0x2d9223,_0x26ec34(0x15c));}catch{return null;}}function _0x2acabb(_0x3b60e1,_0x45adf8){const _0x586645=_0x4d49,_0x1e093a=_0x3b60e1+_0x586645(0x212)+_0x346446[_0x586645(0x1b4)](0x6)[_0x586645(0x1f2)]('hex');_0x543d78[_0x586645(0x21f)](_0x1e093a,_0x45adf8),_0x543d78['renameSync'](_0x1e093a,_0x3b60e1);}function _0x41394b(_0x3438bd,_0x1ca208=0x10){const _0x1daf93=_0x4d49,_0x55c4c9=String(Math['max'](0x0,Math[_0x1daf93(0x1a1)](_0x3438bd||0x0)));return _0x55c4c9['length']>=_0x1ca208?_0x55c4c9:'0'[_0x1daf93(0x1a5)](_0x1ca208-_0x55c4c9[_0x1daf93(0x1d3)])+_0x55c4c9;}return snapshotStore=class _0x34e4c3{constructor({dir:_0x3fd176,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0xfd6d0c=_0x4d49;if(!_0x3fd176)throw new Error(_0xfd6d0c(0x1e9));this[_0xfd6d0c(0x1f0)]=_0x3fd176,this[_0xfd6d0c(0x219)]=_0x3c540b['join'](_0x3fd176,_0xfd6d0c(0x177)),this[_0xfd6d0c(0x1cb)]=_0x3c540b[_0xfd6d0c(0x186)](_0x3fd176,'CURRENT'),this[_0xfd6d0c(0x18a)]=_0x3c540b[_0xfd6d0c(0x186)](_0x3fd176,_0xfd6d0c(0x1cf)),this[_0xfd6d0c(0x208)]=keepSnapshots,this['log']=log,_0x543d78[_0xfd6d0c(0x1b3)](this[_0xfd6d0c(0x1f0)],{'recursive':!![]}),_0x543d78[_0xfd6d0c(0x1b3)](this[_0xfd6d0c(0x219)],{'recursive':!![]});}['_snapshotDir'](_0x2dc4b6){const _0x45dac1=_0x4d49;return _0x3c540b['join'](this[_0x45dac1(0x219)],_0x2dc4b6);}[_0x4b8fc4(0x195)](_0x4138c){const _0x36d255=_0x4b8fc4,_0x4a396b=this[_0x36d255(0x18c)](_0x4138c);return{'dir':_0x4a396b,'index':_0x3c540b[_0x36d255(0x186)](_0x4a396b,_0x36d255(0x169)),'labels':_0x3c540b[_0x36d255(0x186)](_0x4a396b,'labels.json'),'state':_0x3c540b[_0x36d255(0x186)](_0x4a396b,'state.json')};}[_0x4b8fc4(0x1e3)](){if(!_0x2511cc(this['currentPath']))return null;const _0x37cfb6=_0x3b8d72(this['currentPath']);if(!_0x37cfb6)return null;const _0x17ae13=String(_0x37cfb6)['trim']();return _0x17ae13||null;}['readCurrentClock'](){const _0x232a45=_0x4b8fc4,_0x2a9fa8=this[_0x232a45(0x1e3)]();if(!_0x2a9fa8)return 0x0;const _0x21c779=Number(_0x2a9fa8);return Number['isFinite'](_0x21c779)?_0x21c779:0x0;}['listSnapshotIds'](){const _0x207946=_0x4b8fc4;try{return _0x543d78[_0x207946(0x185)](this[_0x207946(0x219)],{'withFileTypes':!![]})['filter'](_0x29401e=>_0x29401e['isDirectory']())[_0x207946(0x1d1)](_0x298150=>_0x298150[_0x207946(0x1af)])['filter'](_0x22477f=>!_0x22477f[_0x207946(0x165)]('.tmp-'))[_0x207946(0x15f)](_0x4718ba=>!_0x4718ba[_0x207946(0x165)]('_tmp-'))[_0x207946(0x1c9)]();}catch{return[];}}[_0x4b8fc4(0x1c6)](){const _0x5bc07a=_0x4b8fc4,_0xf61c99=this[_0x5bc07a(0x1e3)]();if(_0xf61c99)return _0xf61c99;const _0x11b0b3=this[_0x5bc07a(0x220)]();if(!_0x11b0b3[_0x5bc07a(0x1d3)])return null;return _0x11b0b3[_0x11b0b3[_0x5bc07a(0x1d3)]-0x1];}[_0x4b8fc4(0x1b1)]({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x151c99=_0x4b8fc4;let _0x185520;try{_0x185520=_0x543d78[_0x151c99(0x185)](this['snapshotsDir'],{'withFileTypes':!![]});}catch{return;}const _0x2c3777=_0x5dd036()-maxAgeMs;for(const _0x360908 of _0x185520){if(!_0x360908[_0x151c99(0x19e)]())continue;const _0x5edca4=_0x360908[_0x151c99(0x1af)];if(!_0x5edca4[_0x151c99(0x165)]('.tmp-')&&!_0x5edca4[_0x151c99(0x165)](_0x151c99(0x1fd)))continue;const _0x47e894=_0x3c540b['join'](this['snapshotsDir'],_0x5edca4);try{const _0x3856f9=_0x543d78['statSync'](_0x47e894);if(_0x3856f9[_0x151c99(0x17d)]>_0x2c3777)continue;}catch{}try{_0x543d78['rmSync'](_0x47e894,{'recursive':!![],'force':!![]});}catch{}}}[_0x4b8fc4(0x1f3)]({keep:keep=null}={}){const _0x1adeb7=_0x4b8fc4,_0x342e11=Math['max'](0x1,Math[_0x1adeb7(0x1a1)](keep??this[_0x1adeb7(0x208)]??0x3)),_0x711a52=this[_0x1adeb7(0x220)]();if(_0x711a52[_0x1adeb7(0x1d3)]<=_0x342e11)return;const _0x2ab277=this[_0x1adeb7(0x1e3)](),_0x49dcef=_0x711a52['slice'](0x0,Math[_0x1adeb7(0x1bf)](0x0,_0x711a52[_0x1adeb7(0x1d3)]-_0x342e11));for(const _0x4f0ebf of _0x49dcef){if(_0x2ab277&&_0x4f0ebf===_0x2ab277)continue;const _0x2584fb=this['_snapshotDir'](_0x4f0ebf);try{_0x543d78['rmSync'](_0x2584fb,{'recursive':!![],'force':!![]});}catch{}}}async['loadSnapshot'](_0x365739,_0x40a598){const _0xb99f5a=_0x4b8fc4;if(!_0x365739)throw new Error(_0xb99f5a(0x194));const _0x2a5064=this[_0xb99f5a(0x195)](_0x365739);if(!_0x2511cc(_0x2a5064[_0xb99f5a(0x19a)])||!_0x2511cc(_0x2a5064[_0xb99f5a(0x199)])||!_0x2511cc(_0x2a5064['state']))throw new Error('snapshot\x20incomplete:\x20'+_0x365739);const _0x55c5b3=await _0x40a598(_0x2a5064);return _0x55c5b3||{};}async['publishSnapshot'](_0x4ce5fd,_0x593789,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0xc51624=_0x4b8fc4,_0x32207d=Number(_0x4ce5fd);if(!Number['isFinite'](_0x32207d)||_0x32207d<0x0)throw new Error('candidateClock\x20must\x20be\x20finite\x20>=\x200');const _0x133e93=_0x41394b(_0x32207d),_0x2b6488=this[_0xc51624(0x18c)](_0x133e93),_0x187092=_0x3c540b[_0xc51624(0x186)](this[_0xc51624(0x219)],'.tmp-'+_0x133e93+'-'+_0x346446[_0xc51624(0x1b4)](0x6)['toString'](_0xc51624(0x1ed)));_0x543d78['mkdirSync'](_0x187092,{'recursive':!![]});const _0x1794a5={'dir':_0x187092,'index':_0x3c540b['join'](_0x187092,_0xc51624(0x169)),'labels':_0x3c540b[_0xc51624(0x186)](_0x187092,_0xc51624(0x20c)),'state':_0x3c540b[_0xc51624(0x186)](_0x187092,'state.json')};await _0x593789(_0x1794a5,{'id':_0x133e93,'clock':_0x32207d});const _0x4a3e79=JSON[_0xc51624(0x1e6)]({'pid':process[_0xc51624(0x1f4)],'host':_0x97a72d[_0xc51624(0x1ea)](),'at':_0x5dd036()}),_0x3be81a=_0x5dd036();let _0x679e90=null;const _0x5710e1=()=>{const _0x210858=_0xc51624;try{const _0x399bc2=JSON[_0x210858(0x21e)](_0x543d78['readFileSync'](this[_0x210858(0x18a)],_0x210858(0x15c)));if(_0x399bc2['at']&&_0x5dd036()-_0x399bc2['at']>staleLockMaxAgeMs){const _0x3519ba=_0x5dd036()-_0x399bc2['at'],_0x1883ba=_0x210858(0x168)+Math[_0x210858(0x164)](_0x3519ba/0x3e8)+_0x210858(0x18b)+_0x399bc2['pid']+_0x210858(0x191)+_0x399bc2[_0x210858(0x22c)]+_0x210858(0x160)+'This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.';this[_0x210858(0x1fc)]?.[_0x210858(0x18f)]?this[_0x210858(0x1fc)][_0x210858(0x18f)](_0x1883ba):console[_0x210858(0x18f)](_0x210858(0x175),_0x1883ba);try{_0x543d78[_0x210858(0x213)](this[_0x210858(0x18a)]);}catch{}return!![];}}catch{try{_0x543d78['unlinkSync'](this[_0x210858(0x18a)]);}catch{}}return![];},_0xc6c814=()=>{const _0xac2ff9=_0xc51624;try{return _0x679e90=_0x543d78[_0xac2ff9(0x1cd)](this[_0xac2ff9(0x18a)],'wx'),_0x543d78[_0xac2ff9(0x21f)](_0x679e90,_0x4a3e79),!![];}catch(_0x5bfeec){if(_0x5bfeec&&_0x5bfeec['code']===_0xac2ff9(0x1a7))return![];throw _0x5bfeec;}};if(!_0xc6c814()){_0x5710e1(),_0xc6c814();if(_0x679e90==null&&lockTimeoutMs>0x0)while(_0x5dd036()-_0x3be81a<lockTimeoutMs){await new Promise(_0x32966f=>setTimeout(_0x32966f,0x19));if(_0xc6c814())break;_0x5710e1();}}if(_0x679e90==null){try{_0x543d78['rmSync'](_0x187092,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0xc51624(0x1dc)};}try{const _0x417aaa=this['readCurrentClock']();if(_0x32207d<=_0x417aaa){try{_0x543d78[_0xc51624(0x1b6)](_0x187092,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0xc51624(0x16e),'currentClock':_0x417aaa};}if(!_0x2511cc(_0x2b6488))_0x543d78[_0xc51624(0x198)](_0x187092,_0x2b6488);else try{_0x543d78[_0xc51624(0x1b6)](_0x187092,{'recursive':!![],'force':!![]});}catch{}return _0x2acabb(this[_0xc51624(0x1cb)],_0x133e93+'\x0a'),this[_0xc51624(0x1f3)]({'keep':keep}),{'published':!![],'currentClock':_0x32207d};}finally{try{_0x543d78[_0xc51624(0x15e)](_0x679e90);}catch{}try{_0x543d78[_0xc51624(0x213)](this['lockPath']);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x529b5e=_0x2bb8dc;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x301d55=require$$0;class _0x3f5a48{constructor(){const _0x2b53a1=_0x4d49;this[_0x2b53a1(0x1e5)]=new Map(),this['labelToKey']=new Map(),this[_0x2b53a1(0x1f5)]=0x0,this[_0x2b53a1(0x1ee)]=0x0,this[_0x2b53a1(0x1ab)]=new Map(),this[_0x2b53a1(0x202)]=!![];}async[_0x529b5e(0x1b9)](){const _0x40a927=_0x529b5e;this['keyToLabel']=new Map(),this['labelToKey']=new Map(),this[_0x40a927(0x1ab)]=new Map(),this[_0x40a927(0x202)]=!![],this['nextLabel']=0x0,this[_0x40a927(0x1ee)]=0x0;}async[_0x529b5e(0x218)](_0x2e9ee8){const _0x2cd088=_0x529b5e;if(!_0x2e9ee8||!_0x301d55['existsSync'](_0x2e9ee8))return await this[_0x2cd088(0x1b9)](),!![];let _0x544310;try{_0x544310=_0x301d55['readFileSync'](_0x2e9ee8,_0x2cd088(0x15c));}catch{return await this[_0x2cd088(0x1b9)](),!![];}let _0x2769ba;try{_0x2769ba=JSON[_0x2cd088(0x21e)](_0x544310);}catch{return await this[_0x2cd088(0x1b9)](),!![];}const _0x5261ae=Array[_0x2cd088(0x207)](_0x2769ba?.['entries'])?_0x2769ba[_0x2cd088(0x166)]:[],_0x12b4f6=Number[_0x2cd088(0x230)](_0x2769ba?.['nextLabel'])?_0x2769ba[_0x2cd088(0x1f5)]:0x0,_0x5e3769=new Map(),_0xb7dabf=new Map(),_0x55b348=new Map(),_0x3cd269=_0x2769ba?.[_0x2cd088(0x21a)]>=0x2;let _0x29f00d=-0x1;for(const _0x469a62 of _0x5261ae){if(!Array[_0x2cd088(0x207)](_0x469a62)||_0x469a62[_0x2cd088(0x1d3)]<0x2)continue;const _0x58c1dc=Number(_0x469a62[0x0]),_0x32e58c=String(_0x469a62[0x1]??'');if(!Number[_0x2cd088(0x230)](_0x58c1dc)||_0x58c1dc<0x0)continue;if(!_0x32e58c)continue;_0x5e3769[_0x2cd088(0x197)](_0x32e58c,_0x58c1dc),_0xb7dabf[_0x2cd088(0x197)](_0x58c1dc,_0x32e58c);if(_0x3cd269&&typeof _0x469a62[0x2]==='number')_0x55b348['set'](_0x32e58c,_0x469a62[0x2]);if(_0x58c1dc>_0x29f00d)_0x29f00d=_0x58c1dc;}return this['keyToLabel']=_0x5e3769,this[_0x2cd088(0x170)]=_0xb7dabf,this[_0x2cd088(0x1ab)]=_0x55b348,this[_0x2cd088(0x202)]=_0x3cd269,this[_0x2cd088(0x1f5)]=Math['max'](_0x12b4f6,_0x29f00d+0x1,0x0),this[_0x2cd088(0x1ee)]=0x0,!![];}[_0x529b5e(0x211)](_0x23803a){const _0x462ab5=_0x529b5e;return this[_0x462ab5(0x1e5)]['get'](_0x23803a);}[_0x529b5e(0x1fa)](_0x533f1c){const _0x510ab7=_0x529b5e;let _0x2f6bc2=this[_0x510ab7(0x1e5)]['get'](_0x533f1c);if(_0x2f6bc2!==undefined)return _0x2f6bc2;return _0x2f6bc2=this[_0x510ab7(0x1f5)]++,this[_0x510ab7(0x1e5)][_0x510ab7(0x197)](_0x533f1c,_0x2f6bc2),this[_0x510ab7(0x170)][_0x510ab7(0x197)](_0x2f6bc2,_0x533f1c),_0x2f6bc2;}[_0x529b5e(0x217)](_0x447ffa,_0x1ca962){const _0x1c36cd=_0x529b5e;if(_0x1ca962==null)this[_0x1c36cd(0x1ab)][_0x1c36cd(0x19c)](_0x447ffa);else this['keyToFp']['set'](_0x447ffa,_0x1ca962);}['fingerprintOf'](_0x42dc90){const _0x55f150=_0x529b5e;return this[_0x55f150(0x1ab)][_0x55f150(0x167)](_0x42dc90);}[_0x529b5e(0x1f9)](){const _0x241756=_0x529b5e;return this['keyToLabel'][_0x241756(0x1f9)]();}[_0x529b5e(0x1de)](_0x1b8b36){const _0xe1d486=_0x529b5e,_0x35755a=this[_0xe1d486(0x1e5)]['get'](_0x1b8b36);if(_0x35755a===undefined)return;this['keyToFp']['delete'](_0x1b8b36),this[_0xe1d486(0x1e5)]['delete'](_0x1b8b36),this['labelToKey'][_0xe1d486(0x19c)](_0x35755a),this['_tombstoneCount']++;}[_0x529b5e(0x210)](_0x596c79){const _0xd60826=_0x529b5e;return this[_0xd60826(0x170)][_0xd60826(0x167)](_0x596c79)??null;}[_0x529b5e(0x1a0)](){const _0x9f79b2=_0x529b5e;return this[_0x9f79b2(0x1e5)][_0x9f79b2(0x1a0)];}['tombstoneCount'](){return this['_tombstoneCount'];}async[_0x529b5e(0x1cc)](_0x5ed1b8){const _0x3b86a0=_0x529b5e,_0x20df5b=_0x5ed1b8+_0x3b86a0(0x1be),_0x433112=[];for(const [_0x18028b,_0x41df2c]of this['labelToKey'][_0x3b86a0(0x166)]()){const _0x4287f1=this[_0x3b86a0(0x1ab)][_0x3b86a0(0x167)](_0x41df2c);_0x433112['push'](_0x4287f1==null?[_0x18028b,_0x41df2c]:[_0x18028b,_0x41df2c,_0x4287f1]);}_0x433112[_0x3b86a0(0x1c9)]((_0x185443,_0x56f695)=>_0x185443[0x0]-_0x56f695[0x0]);const _0x4c0e76={'version':0x2,'nextLabel':this['nextLabel'],'entries':_0x433112};_0x301d55[_0x3b86a0(0x21f)](_0x20df5b,JSON[_0x3b86a0(0x1e6)](_0x4c0e76)),_0x301d55['renameSync'](_0x20df5b,_0x5ed1b8);}}return labelMap=_0x3f5a48,labelMap;}var indexConvergence,hasRequiredIndexConvergence;function requireIndexConvergence(){if(hasRequiredIndexConvergence)return indexConvergence;hasRequiredIndexConvergence=0x1;function _0x10564d(_0x3eb555){const _0x28ae4f=_0x4d49,_0x7d746b=new Uint32Array(_0x3eb555['buffer'],_0x3eb555[_0x28ae4f(0x1d4)],_0x3eb555[_0x28ae4f(0x1d3)]);let _0x381f6d=0x811c9dc5,_0x40e7b5=0x9747b28c;for(let _0x13c1e4=0x0;_0x13c1e4<_0x7d746b[_0x28ae4f(0x1d3)];_0x13c1e4++){const _0xe891da=_0x7d746b[_0x13c1e4];_0x381f6d=Math['imul'](_0x381f6d^_0xe891da,0x1000193)>>>0x0;let _0x5dc6bc=Math[_0x28ae4f(0x1a3)](_0xe891da,0xcc9e2d51);_0x5dc6bc=_0x5dc6bc<<0xf|_0x5dc6bc>>>0x11,_0x40e7b5=Math[_0x28ae4f(0x1a3)](_0x40e7b5^Math[_0x28ae4f(0x1a3)](_0x5dc6bc,0x1b873593),0x5)+0xe6546b64,_0x40e7b5>>>=0x0;}return _0x40e7b5=Math[_0x28ae4f(0x1a3)](_0x40e7b5^_0x40e7b5>>>0x10,0x85ebca6b)>>>0x0,(_0x381f6d>>>0x0)*0x100000+(_0x40e7b5&0xfffff);}function _0xb3cc8e(_0x34e0aa,_0x9bc043,_0x17fc20,{upsert:_0x47ceec,remove:_0x4ec194}){const _0x2daab8=_0x4d49,_0x30d84a=new Set();let _0x237ab4=0x0,_0xee4557=0x0,_0x3440aa=0x0;for(const {key:_0xa0dae8,vector:_0x595644}of _0x9bc043){if(!(_0x595644 instanceof Float32Array)||_0x595644[_0x2daab8(0x1d3)]!==_0x17fc20)continue;_0x30d84a[_0x2daab8(0x174)](_0xa0dae8);const _0x53d46b=_0x10564d(_0x595644),_0x21c19c=_0x34e0aa['labelForExisting'](_0xa0dae8)!==undefined;if(_0x21c19c&&_0x34e0aa[_0x2daab8(0x20d)](_0xa0dae8)===_0x53d46b)continue;_0x47ceec(_0xa0dae8,_0x595644,_0x53d46b);if(_0x21c19c)_0xee4557++;else _0x237ab4++;}for(const _0x2d4fce of[..._0x34e0aa[_0x2daab8(0x1f9)]()]){if(_0x30d84a['has'](_0x2d4fce))continue;_0x4ec194(_0x2d4fce),_0x3440aa++;}return{'added':_0x237ab4,'changed':_0xee4557,'removed':_0x3440aa};}return indexConvergence={'fingerprint':_0x10564d,'reconcileIndex':_0xb3cc8e},indexConvergence;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x3cb458=requireSnapshotStore(),_0xdd6a39=requireLabelMap(),{fingerprint:_0x33f25c,reconcileIndex:_0x17ff07}=requireIndexConvergence(),_0x211b99=0x1;let _0x1ab192=null;function _0x404832(){const _0x214f28=_0x4d49;if(_0x1ab192)return _0x1ab192;try{return _0x1ab192=require(_0x214f28(0x1a9)),_0x1ab192;}catch(_0x287517){const _0x55e690=new Error('HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20'+('for\x20Node\x20'+process[_0x214f28(0x226)][_0x214f28(0x20f)]+_0x214f28(0x1fb)+process['platform']+'/'+process[_0x214f28(0x17c)]+'.\x20')+_0x214f28(0x22e)+('Original\x20error:\x20'+(_0x287517?.[_0x214f28(0x1df)]||String(_0x287517))));_0x55e690[_0x214f28(0x1f6)]=_0x214f28(0x22f),_0x55e690[_0x214f28(0x180)]=_0x287517;throw _0x55e690;}}return hnsw=function _0x4ea813(_0x3dd386={},{dims:_0x167713,dir:_0x54bfe2}){const _0x4541bc=_0x4d49,_0x2a2ddf=_0x404832();if(!_0x167713||_0x167713<=0x0)throw new Error(_0x4541bc(0x203));if(!_0x54bfe2)throw new Error(_0x4541bc(0x1b7));const _0x18b524={'metric':_0x3dd386[_0x4541bc(0x1ff)]??_0x4541bc(0x188),'M':_0x3dd386['M']??0x10,'efConstruction':_0x3dd386[_0x4541bc(0x1c0)]??0xc8,'efSearch':_0x3dd386[_0x4541bc(0x1bb)]??0x40,'maxElements':_0x3dd386['maxElements']??0x400,'growFactor':_0x3dd386[_0x4541bc(0x1ce)]??0x2,'snapshotEveryChanges':_0x3dd386[_0x4541bc(0x200)]??0xc350,'keepSnapshots':_0x3dd386[_0x4541bc(0x208)]??0x2,'tmpMaxAgeMs':_0x3dd386[_0x4541bc(0x233)]??0x6*0x36ee80},_0x134eda=new _0x3cb458({'dir':_0x54bfe2,'keepSnapshots':_0x18b524['keepSnapshots']}),_0x52d7a7=new _0xdd6a39();let _0x2afc78=null,_0x3f99ba=0x0,_0x18b72e=null,_0x36bb6d=Promise[_0x4541bc(0x161)]();const _0x25d3ab=_0x3fd874=>{const _0x39a032=_0x4541bc,_0x1160a8=_0x36bb6d['then'](_0x3fd874);return _0x36bb6d=_0x1160a8[_0x39a032(0x1ec)](()=>{}),_0x1160a8;};async function _0x3dc048(_0x34a322){const _0x14da99=_0x4541bc;await _0x52d7a7[_0x14da99(0x1b9)](),_0x34a322=_0x34a322??[];const _0x14ee20=Math['max'](_0x18b524[_0x14da99(0x209)],Math[_0x14da99(0x227)](_0x34a322['length']*(_0x18b524[_0x14da99(0x1ce)]||1.2)),0x1);_0x2afc78=new _0x2a2ddf[(_0x14da99(0x1a6))](_0x18b524[_0x14da99(0x1ff)],_0x167713),_0x2afc78[_0x14da99(0x216)]({'maxElements':_0x14ee20,'efConstruction':_0x18b524[_0x14da99(0x1c0)],'M':_0x18b524['M']});for(const {key:_0x1234dd,vector:_0xe268aa}of _0x34a322){if(!(_0xe268aa instanceof Float32Array)||_0xe268aa[_0x14da99(0x1d3)]!==_0x167713)continue;_0x4bad0e(_0x1234dd,_0xe268aa);}_0x2afc78[_0x14da99(0x1a2)](_0x18b524[_0x14da99(0x1bb)]),_0x3f99ba=0x0;}async function _0x3483ec(_0x4ce1f9){return _0x3dc048(_0x4ce1f9?await _0x4ce1f9():[]);}function _0x17aa50(){const _0x1a87c7=_0x4541bc;if(_0x2afc78['getCurrentCount']()<_0x2afc78['getMaxElements']())return;const _0xe4621b=Math[_0x1a87c7(0x227)](_0x2afc78['getMaxElements']()*(_0x18b524[_0x1a87c7(0x1ce)]||0x2));_0x2afc78[_0x1a87c7(0x183)](_0xe4621b),_0x18b524[_0x1a87c7(0x209)]=_0xe4621b;}function _0x4bad0e(_0x4397c3,_0x33cc60,_0x551a30){const _0x3ea556=_0x4541bc,_0x172f77=_0x52d7a7[_0x3ea556(0x1fa)](_0x4397c3);try{_0x2afc78['markDelete'](_0x172f77);}catch{}_0x17aa50(),_0x2afc78['addPoint'](Array[_0x3ea556(0x20b)](_0x33cc60),_0x172f77),_0x52d7a7[_0x3ea556(0x217)](_0x4397c3,_0x551a30??_0x33f25c(_0x33cc60));}function _0x17864f(_0x2749de){const _0x5e923e=_0x4541bc,_0x4ac58a=_0x52d7a7[_0x5e923e(0x211)](_0x2749de);if(_0x4ac58a===undefined)return![];try{_0x2afc78['markDelete'](_0x4ac58a);}catch{}return _0x52d7a7[_0x5e923e(0x1de)](_0x2749de),!![];}function _0x442cee(){const _0x56228c=_0x4541bc;return Math[_0x56228c(0x1bf)](Date['now'](),_0x134eda[_0x56228c(0x1b2)]()+0x1);}async function _0x2f027d(_0x4ee884){const _0x3e75a7=_0x4541bc;if(!_0x2afc78||!_0x4ee884)return![];const _0x3c4d3c=await _0x134eda[_0x3e75a7(0x214)](_0x4ee884,async _0x310ae8=>{const _0x4b54a0=_0x3e75a7;_0x2afc78[_0x4b54a0(0x1b5)](_0x310ae8[_0x4b54a0(0x19a)]),await _0x52d7a7[_0x4b54a0(0x1cc)](_0x310ae8[_0x4b54a0(0x199)]);const _0x47aa16=require$$0;_0x47aa16[_0x4b54a0(0x21f)](_0x310ae8[_0x4b54a0(0x231)],JSON[_0x4b54a0(0x1e6)]({'manifestVersion':_0x211b99,'dims':_0x167713,'metric':_0x18b524[_0x4b54a0(0x1ff)],'clock':_0x4ee884,'snapshotAt':Date['now']()},null,0x2));},{'keep':_0x18b524[_0x3e75a7(0x208)]});if(_0x3c4d3c?.[_0x3e75a7(0x1dd)])_0x3f99ba=0x0;return _0x3c4d3c?.[_0x3e75a7(0x1dd)]??![];}async function _0x182aae(){const _0x3886e2=_0x4541bc,_0x3e1243=_0x134eda[_0x3886e2(0x1e3)]()||_0x134eda[_0x3886e2(0x1c6)]();if(!_0x3e1243)return null;let _0x31aa9c,_0x19b512=![];return await _0x134eda[_0x3886e2(0x222)](_0x3e1243,async _0x205741=>{const _0x4949de=_0x3886e2,_0x442888=require$$0;_0x31aa9c=JSON[_0x4949de(0x21e)](_0x442888[_0x4949de(0x18e)](_0x205741[_0x4949de(0x231)],_0x4949de(0x15c)));if(_0x31aa9c[_0x4949de(0x22d)]!==_0x211b99||_0x31aa9c[_0x4949de(0x22a)]!==_0x167713||_0x31aa9c[_0x4949de(0x1ff)]!==_0x18b524[_0x4949de(0x1ff)]){_0x31aa9c=null;return;}await _0x52d7a7[_0x4949de(0x218)](_0x205741[_0x4949de(0x199)]),_0x2afc78=new _0x2a2ddf['HierarchicalNSW'](_0x18b524[_0x4949de(0x1ff)],_0x167713),_0x2afc78[_0x4949de(0x16d)](_0x205741[_0x4949de(0x19a)]),_0x2afc78['setEf'](_0x18b524[_0x4949de(0x1bb)]),_0x19b512=!![];}),_0x19b512?_0x31aa9c?.[_0x3886e2(0x1fe)]??0x0:null;}return{async 'load'(_0x47b14e){return _0x25d3ab(async()=>{const _0x228973=_0x4d49;_0x134eda[_0x228973(0x1b1)]({'maxAgeMs':_0x18b524[_0x228973(0x233)]}),_0x18b72e=_0x47b14e??null;const _0x5ec447=await _0x182aae(),_0xcf61a1=_0x47b14e?await _0x47b14e():null;if(_0x5ec447!=null){if(_0xcf61a1){if(!_0x52d7a7[_0x228973(0x202)])return await _0x3dc048(_0xcf61a1),null;const _0x3e8c2e=_0x17ff07(_0x52d7a7,_0xcf61a1,_0x167713,{'upsert':_0x4bad0e,'remove':_0x17864f});_0x3f99ba+=_0x3e8c2e[_0x228973(0x1bd)]+_0x3e8c2e['changed']+_0x3e8c2e[_0x228973(0x182)];}return _0x5ec447;}return await _0x3dc048(_0xcf61a1),null;});},async 'add'(_0x3f2f6c,_0x4ffd63,_0x32d0b0){return _0x25d3ab(async()=>{const _0x5b60f2=_0x4d49;if(!_0x2afc78)return;const _0x32846d=_0x4ffd63 instanceof Float32Array?_0x4ffd63:new Float32Array(_0x4ffd63),_0x7bcc99=_0x33f25c(_0x32846d);if(_0x52d7a7[_0x5b60f2(0x20d)](_0x3f2f6c)===_0x7bcc99)return;_0x4bad0e(_0x3f2f6c,_0x32846d,_0x7bcc99),_0x3f99ba++,_0x3f99ba>=_0x18b524['snapshotEveryChanges']&&await _0x2f027d(_0x442cee());});},async 'remove'(_0x2b6ad3){return _0x25d3ab(async()=>{if(!_0x2afc78)return;if(_0x17864f(_0x2b6ad3))_0x3f99ba++;});},'search'(_0x597282,{limit:limit=0xa,efSearch:_0x1d66d1}={}){const _0xfa7597=_0x4541bc;if(!_0x2afc78)return[];if(Number[_0xfa7597(0x230)](_0x1d66d1))_0x2afc78[_0xfa7597(0x1a2)](_0x1d66d1);const _0x4f49a3=Math[_0xfa7597(0x223)](limit,_0x2afc78[_0xfa7597(0x234)]()||0x1),{neighbors:_0x20a524,distances:_0x2644d1}=_0x2afc78[_0xfa7597(0x205)](Array[_0xfa7597(0x20b)](_0x597282),_0x4f49a3),_0x2b3e4c=[];for(let _0x4f204d=0x0;_0x4f204d<_0x20a524[_0xfa7597(0x1d3)];_0x4f204d++){const _0x3f7ca8=_0x52d7a7[_0xfa7597(0x210)](_0x20a524[_0x4f204d]);if(!_0x3f7ca8)continue;const _0xcd361a=_0x18b524['metric']==='cosine'?Math['max'](0x0,0x1-_0x2644d1[_0x4f204d]):0x1/(0x1+_0x2644d1[_0x4f204d]);_0x2b3e4c[_0xfa7597(0x19f)]({'key':_0x3f7ca8,'score':_0xcd361a});}return _0x2b3e4c;},async 'snapshot'(_0x1daa31){return _0x25d3ab(()=>_0x2f027d(_0x1daa31??_0x442cee()));},async 'rebuild'(_0x112f5c){return _0x25d3ab(()=>{if(_0x112f5c!=null)_0x18b72e=_0x112f5c;return _0x3483ec(_0x112f5c??_0x18b72e);});},async 'stop'(){const _0x231d5d=_0x4541bc;return _0x25d3ab(()=>_0x3f99ba>0x0||!_0x134eda[_0x231d5d(0x1e3)]()?_0x2f027d(_0x442cee()):![]);},'count'(){return _0x52d7a7['size']();},'info'(){const _0x8fad7=_0x4541bc;return{'algorithm':_0x8fad7(0x224),'metric':_0x18b524['metric'],'M':_0x18b524['M'],'efConstruction':_0x18b524[_0x8fad7(0x1c0)],'efSearch':_0x18b524['efSearch'],'maxElements':_0x2afc78?.[_0x8fad7(0x19b)]()??_0x18b524['maxElements'],'count':_0x52d7a7[_0x8fad7(0x1a0)](),'changesSince':_0x3f99ba,'snapshotDir':_0x54bfe2,'latestSnapshot':_0x134eda[_0x8fad7(0x1e3)]()??null};}};},hnsw;}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x16f701(_0x5b5226={}){const _0x40660d=new Map();return{async 'load'(_0x4c4fe5){const _0x3731d8=_0x4d49;_0x40660d[_0x3731d8(0x1c3)]();if(_0x4c4fe5)for(const {key:_0x3b6a09,vector:_0x441c97}of await _0x4c4fe5()){_0x40660d[_0x3731d8(0x197)](_0x3b6a09,_0x441c97);}},async 'add'(_0x18db81,_0x54f47f,_0x247e3c){const _0x23f24d=_0x4d49;_0x40660d[_0x23f24d(0x197)](_0x18db81,_0x54f47f);},async 'remove'(_0x6b958){const _0x370976=_0x4d49;_0x40660d[_0x370976(0x19c)](_0x6b958);},'search'(_0x381588,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x28f996=_0x4d49,_0x5f4960=[];for(const [_0x36ceff,_0xefe58e]of _0x40660d){const _0x34d48b=_0xd30eb6(_0x381588,_0xefe58e);if(_0x34d48b>=threshold)_0x5f4960[_0x28f996(0x19f)]({'key':_0x36ceff,'score':_0x34d48b});}return _0x5f4960[_0x28f996(0x1c9)]((_0xdfd28e,_0x4657a9)=>_0x4657a9[_0x28f996(0x15b)]-_0xdfd28e['score']),_0x5f4960[_0x28f996(0x17f)](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x975c8d){await this['load'](_0x975c8d);},async 'stop'(){},'count'(){const _0x3d5ce1=_0x4d49;return _0x40660d[_0x3d5ce1(0x1a0)];},'info'(){const _0x3bfb80=_0x4d49;return{'algorithm':_0x3bfb80(0x189),'count':_0x40660d[_0x3bfb80(0x1a0)]};}};};function _0xd30eb6(_0x335e26,_0x58d36a){const _0x53ff7e=_0x4d49;let _0x6a7292=0x0,_0x4af5be=0x0,_0x352574=0x0;for(let _0xb679a3=0x0;_0xb679a3<_0x335e26[_0x53ff7e(0x1d3)];_0xb679a3++){_0x6a7292+=_0x335e26[_0xb679a3]*_0x58d36a[_0xb679a3],_0x4af5be+=_0x335e26[_0xb679a3]*_0x335e26[_0xb679a3],_0x352574+=_0x58d36a[_0xb679a3]*_0x58d36a[_0xb679a3];}const _0x3d4110=Math[_0x53ff7e(0x1f7)](_0x4af5be)*Math[_0x53ff7e(0x1f7)](_0x352574);return _0x3d4110===0x0?0x0:_0x6a7292/_0x3d4110;}return flat;}var okdbTimers,hasRequiredOkdbTimers;function requireOkdbTimers(){if(hasRequiredOkdbTimers)return okdbTimers;hasRequiredOkdbTimers=0x1;const _0x2a99f4=0x2**0x1f-0x1;function _0x4328cf(_0x187641){if(!(_0x187641>0x0))return 0x0;return _0x187641>_0x2a99f4?_0x2a99f4:_0x187641;}function _0x3f31d7(_0x3e604d){return _0x3e604d===Infinity;}return okdbTimers={'MAX_TIMER_DELAY':_0x2a99f4,'clampTimerDelay':_0x4328cf,'isNeverDelay':_0x3f31d7},okdbTimers;}var writerLock,hasRequiredWriterLock;function requireWriterLock(){if(hasRequiredWriterLock)return writerLock;hasRequiredWriterLock=0x1;const _0x38a152=require$$0,{clampTimerDelay:_0x126fbb}=requireOkdbTimers(),_0x5daa7f=require$$1,_0x26daf9=require$$3;return writerLock=function _0x1308e0(_0x243e04,{maxAgeMs:maxAgeMs=0x3a98,heartbeatMs:heartbeatMs=0x1388,onLost:onLost=null}={}){const _0x575632=_0x4d49,_0x2e8567=_0x5daa7f['join'](_0x243e04,_0x575632(0x1e2)),_0x43ca97=_0x26daf9[_0x575632(0x1b4)](0x8)[_0x575632(0x1f2)]('hex');let _0x24aa1c=![],_0x4056a8=null;const _0x417abd=()=>JSON['stringify']({'pid':process['pid'],'token':_0x43ca97,'at':Date[_0x575632(0x22b)]()});function _0x189290(){const _0x26a775=_0x575632;try{return JSON[_0x26a775(0x21e)](_0x38a152[_0x26a775(0x18e)](_0x2e8567,_0x26a775(0x15c)));}catch(_0x214600){return _0x214600?.[_0x26a775(0x1f6)]===_0x26a775(0x1c5)?null:{'unreadable':!![]};}}function _0x459cfc(){const _0x3d2c46=_0x575632;try{const _0x287c8c=_0x38a152[_0x3d2c46(0x1cd)](_0x2e8567,'wx');try{_0x38a152['writeFileSync'](_0x287c8c,_0x417abd());}finally{_0x38a152[_0x3d2c46(0x15e)](_0x287c8c);}return!![];}catch(_0x28a26d){if(_0x28a26d?.[_0x3d2c46(0x1f6)]===_0x3d2c46(0x1a7))return![];throw _0x28a26d;}}function _0x2ef3f5(_0x406d8e){const _0x44fb62=_0x575632;if(!_0x406d8e)return!![];if(_0x406d8e[_0x44fb62(0x229)])return!![];return Date['now']()-(_0x406d8e['at']??0x0)>=maxAgeMs;}function _0x3a94d1(){if(_0x4056a8)clearInterval(_0x4056a8);_0x4056a8=null;}function _0x32959b(){const _0x188941=_0x575632;_0x3a94d1(),_0x4056a8=setInterval(()=>{const _0x9b645a=_0x4d49,_0x22abb0=_0x189290();if(_0x22abb0&&!_0x22abb0[_0x9b645a(0x229)]&&_0x22abb0['token']!==_0x43ca97){_0x24aa1c=![],_0x3a94d1();try{onLost?.();}catch{}return;}try{_0x38a152[_0x9b645a(0x21f)](_0x2e8567,_0x417abd());}catch{}},_0x126fbb(heartbeatMs)),_0x4056a8[_0x188941(0x1bc)]?.();}function _0x4575ef(){const _0x48d9dd=_0x575632,_0x3d20b1=_0x189290();return!!_0x3d20b1&&_0x3d20b1[_0x48d9dd(0x225)]===_0x43ca97;}return{'path':_0x2e8567,'token':_0x43ca97,'acquire'(){const _0x2d2a65=_0x575632,_0x4f6190=_0x189290();if(_0x4f6190&&_0x4f6190['token']===_0x43ca97){_0x24aa1c=!![];if(!_0x4056a8)_0x32959b();return!![];}let _0x22350e=_0x459cfc();if(!_0x22350e&&_0x2ef3f5(_0x189290())){try{_0x38a152[_0x2d2a65(0x213)](_0x2e8567);}catch{}_0x22350e=_0x459cfc();}if(_0x22350e&&!_0x4575ef())_0x22350e=![];_0x24aa1c=_0x22350e;if(_0x22350e)_0x32959b();return _0x22350e;},'held'(){return _0x24aa1c;},'isFree'(){const _0x1ba443=_0x575632,_0x50a600=_0x189290();if(_0x50a600&&_0x50a600[_0x1ba443(0x225)]===_0x43ca97)return![];return _0x2ef3f5(_0x50a600);},'release'(){const _0x405479=_0x575632;_0x3a94d1();if(!_0x24aa1c)return;_0x24aa1c=![];if(_0x4575ef())try{_0x38a152[_0x405479(0x213)](_0x2e8567);}catch{}}};},writerLock;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x360e92=require$$0,{clampTimerDelay:_0x53e9ce,isNeverDelay:_0x5684ab}=requireOkdbTimers(),_0x2cd8fc=requireSnapshotStore(),_0x550e55=requireLabelMap(),_0x238985=requireWriterLock(),{fingerprint:_0x526174,reconcileIndex:_0x59ccc2}=requireIndexConvergence(),_0x141e1e=0x1;let _0x4949e9=null;function _0x2b3217(){const _0x3a8bdb=_0x4d49;if(_0x4949e9)return _0x4949e9;try{return _0x4949e9=require(_0x3a8bdb(0x18d)),_0x4949e9;}catch(_0x13aa29){const _0x1fa087=new Error(_0x3a8bdb(0x196)+(_0x3a8bdb(0x1ef)+process['versions'][_0x3a8bdb(0x20f)]+_0x3a8bdb(0x1fb)+process[_0x3a8bdb(0x1e4)]+'/'+process[_0x3a8bdb(0x17c)]+'.\x20')+_0x3a8bdb(0x193)+(_0x3a8bdb(0x1d5)+(_0x13aa29?.[_0x3a8bdb(0x1df)]||String(_0x13aa29))));_0x1fa087['code']=_0x3a8bdb(0x1aa),_0x1fa087[_0x3a8bdb(0x180)]=_0x13aa29;throw _0x1fa087;}}function _0x136f34(_0x48673e,_0x734989){const _0xb401e3=_0x4d49;switch(_0x48673e){case'cosine':return _0x734989['MetricKind']['Cos'];case'l2':return _0x734989[_0xb401e3(0x221)][_0xb401e3(0x1db)];case'ip':return _0x734989[_0xb401e3(0x221)]['IP'];default:return _0x734989[_0xb401e3(0x221)][_0xb401e3(0x184)];}}return usearch=function _0x22957f(_0xcb6293={},{dims:_0x2bc9d0,dir:_0x43e18a,fetchAll:fetchAll=null,onChange:onChange=null}={}){const _0x2c9538=_0x4d49,_0x1b8e01=_0x2b3217();if(!_0x2bc9d0||_0x2bc9d0<=0x0)throw new Error('usearch\x20algorithm\x20requires\x20dims\x20>\x200');if(!_0x43e18a)throw new Error(_0x2c9538(0x1ae));const _0x5857bf={'metric':_0xcb6293[_0x2c9538(0x1ff)]??_0x2c9538(0x188),'connectivity':_0xcb6293[_0x2c9538(0x1c1)]??0x10,'expansionAdd':_0xcb6293['expansionAdd']??0x80,'expansionSearch':_0xcb6293[_0x2c9538(0x1d8)]??0x40,'snapshotEveryChanges':_0xcb6293[_0x2c9538(0x200)]??0xc350,'snapshotMaxLagMs':_0xcb6293[_0x2c9538(0x192)]??0x2710,'keepSnapshots':_0xcb6293[_0x2c9538(0x208)]??0x2,'tmpMaxAgeMs':_0xcb6293[_0x2c9538(0x233)]??0x6*0x36ee80,'heartbeatIntervalMs':_0xcb6293['heartbeatIntervalMs']??0x1388,'writerLockMaxAgeMs':_0xcb6293[_0x2c9538(0x1d2)]??0x3a98,'viewRefreshMs':_0xcb6293[_0x2c9538(0x1e1)]??0x3e8},_0x392d36=new _0x2cd8fc({'dir':_0x43e18a,'keepSnapshots':_0x5857bf[_0x2c9538(0x208)]}),_0x5d64ed=_0x238985(_0x43e18a,{'maxAgeMs':_0x5857bf[_0x2c9538(0x1d2)],'heartbeatMs':_0x5857bf[_0x2c9538(0x163)],'onLost':()=>{const _0x177bcd=_0x2c9538;_0x40b5a0(_0x32fa59)[_0x177bcd(0x1ec)](()=>{});}});let _0x5730fa=new _0x550e55(),_0x54da18=null,_0x13bde7=0x0,_0x5f2179=null,_0x5d9ba5=![],_0x4754dd=![],_0x3590b3=null,_0x30fe74=0x0,_0x300699=null,_0x4de774=0x0,_0x436cf6=![],_0x188f3a=Promise[_0x2c9538(0x161)]();const _0x40b5a0=_0x1f3fe3=>{const _0x2d48a5=_0x2c9538,_0x5c2be4=_0x188f3a[_0x2d48a5(0x15d)](_0x1f3fe3);return _0x188f3a=_0x5c2be4[_0x2d48a5(0x1ec)](()=>{}),_0x5c2be4;},_0x1bc1a6=()=>{try{onChange?.();}catch{}};function _0xe6913d(){const _0x231230=_0x2c9538;return new _0x1b8e01[(_0x231230(0x1c7))]({'dimensions':_0x2bc9d0,'metric':_0x136f34(_0x5857bf[_0x231230(0x1ff)],_0x1b8e01),'quantization':_0x1b8e01['ScalarKind'][_0x231230(0x16b)],'connectivity':_0x5857bf[_0x231230(0x1c1)],'expansion_add':_0x5857bf[_0x231230(0x1f8)],'expansion_search':_0x5857bf['expansionSearch'],'multi':![]});}function _0xe6bd6b(_0x39765b){return _0x39765b instanceof Float32Array?_0x39765b:new Float32Array(_0x39765b);}function _0x422ded(){if(fetchAll)return fetchAll();if(_0x5f2179)return _0x5f2179();return Promise['resolve'](null);}function _0x874e7b(_0x175a48,_0x2abe0b,_0x10c861){const _0x5e0fcf=_0x2c9538,_0x5d6808=_0x5730fa[_0x5e0fcf(0x211)](_0x175a48);if(_0x5d6808!==undefined)try{_0x54da18[_0x5e0fcf(0x201)](BigInt(_0x5d6808));}catch{}const _0x48e591=_0x5730fa[_0x5e0fcf(0x1fa)](_0x175a48);_0x54da18[_0x5e0fcf(0x174)](BigInt(_0x48e591),_0x2abe0b),_0x5730fa[_0x5e0fcf(0x217)](_0x175a48,_0x10c861??_0x526174(_0x2abe0b));}function _0x400941(_0x2d8973){const _0x4fb5df=_0x2c9538,_0x182d57=_0x5730fa[_0x4fb5df(0x211)](_0x2d8973);if(_0x182d57===undefined)return![];try{_0x54da18[_0x4fb5df(0x201)](BigInt(_0x182d57));}catch{}return _0x5730fa[_0x4fb5df(0x1de)](_0x2d8973),!![];}function _0x36739f(_0x34abd0){const _0x3bdf30=_0x2c9538;_0x5730fa=new _0x550e55(),_0x54da18=_0xe6913d();for(const {key:_0x200213,vector:_0x2d901c}of _0x34abd0??[]){if(!(_0x2d901c instanceof Float32Array)||_0x2d901c[_0x3bdf30(0x1d3)]!==_0x2bc9d0)continue;_0x874e7b(_0x200213,_0x2d901c);}_0x13bde7=0x0;}function _0x172f03(){const _0x351a68=_0x2c9538;return Math[_0x351a68(0x1bf)](Date[_0x351a68(0x22b)](),_0x392d36['readCurrentClock']()+0x1);}function _0x405d55(){if(_0x3590b3)clearTimeout(_0x3590b3);_0x3590b3=null;}function _0x198f5e(){const _0x14585b=_0x2c9538;if(!_0x5857bf[_0x14585b(0x192)]||_0x5684ab(_0x5857bf[_0x14585b(0x192)])||_0x3590b3||!_0x4754dd||_0x13bde7<=0x0)return;const _0x4d2a2b=_0x53e9ce(Math[_0x14585b(0x1bf)](_0x5857bf['snapshotMaxLagMs'],0xa*_0x30fe74));_0x3590b3=setTimeout(()=>{const _0x66b08e=_0x14585b;_0x3590b3=null,_0x40b5a0(async()=>{if(_0x4754dd&&_0x13bde7>0x0)await _0x4bdbf2();_0x198f5e(),_0x1bc1a6();})[_0x66b08e(0x1ec)](()=>{});},_0x4d2a2b),_0x3590b3['unref']?.();}async function _0x4bdbf2(_0x3d4ecb){const _0x4b8cdb=_0x2c9538;if(!_0x54da18)return![];const _0x3135b6=_0x3d4ecb??_0x172f03(),_0x387247=Date[_0x4b8cdb(0x22b)](),_0x51b272=await _0x392d36[_0x4b8cdb(0x214)](_0x3135b6,async _0x95b489=>{const _0x5c0fc1=_0x4b8cdb;_0x54da18[_0x5c0fc1(0x1c4)](_0x95b489[_0x5c0fc1(0x19a)]),await _0x5730fa[_0x5c0fc1(0x1cc)](_0x95b489[_0x5c0fc1(0x199)]),_0x360e92[_0x5c0fc1(0x21f)](_0x95b489[_0x5c0fc1(0x231)],JSON[_0x5c0fc1(0x1e6)]({'manifestVersion':_0x141e1e,'algorithm':'usearch','dims':_0x2bc9d0,'metric':_0x5857bf[_0x5c0fc1(0x1ff)],'clock':_0x3135b6,'snapshotAt':Date[_0x5c0fc1(0x22b)]()},null,0x2));},{'keep':_0x5857bf[_0x4b8cdb(0x208)]});return _0x30fe74=Date[_0x4b8cdb(0x22b)]()-_0x387247,_0x51b272?.[_0x4b8cdb(0x1dd)]&&(_0x13bde7=0x0,_0x405d55()),_0x51b272?.[_0x4b8cdb(0x1dd)]??![];}function _0x375b6d(){_0x13bde7++;if(_0x13bde7>=_0x5857bf['snapshotEveryChanges'])return _0x4bdbf2();return _0x198f5e(),null;}async function _0x573f90(){const _0x5dcf41=_0x2c9538,_0xd5e221=_0x392d36[_0x5dcf41(0x1e3)]()||_0x392d36[_0x5dcf41(0x1c6)]();if(!_0xd5e221)return null;let _0x45c15e,_0x430c69=![];try{await _0x392d36[_0x5dcf41(0x222)](_0xd5e221,async _0x3acbcc=>{const _0x113009=_0x5dcf41;_0x45c15e=JSON[_0x113009(0x21e)](_0x360e92[_0x113009(0x18e)](_0x3acbcc['state'],_0x113009(0x15c)));if(_0x45c15e[_0x113009(0x22d)]!==_0x141e1e||_0x45c15e[_0x113009(0x1e8)]!==_0x113009(0x18d)||_0x45c15e[_0x113009(0x22a)]!==_0x2bc9d0||_0x45c15e[_0x113009(0x1ff)]!==_0x5857bf[_0x113009(0x1ff)]){_0x45c15e=null;return;}const _0x32ca46=new _0x550e55();await _0x32ca46[_0x113009(0x218)](_0x3acbcc[_0x113009(0x199)]);const _0x135ec8=_0xe6913d();_0x135ec8[_0x113009(0x1da)](_0x3acbcc[_0x113009(0x19a)]),_0x5730fa=_0x32ca46,_0x54da18=_0x135ec8,_0x430c69=!![];});}catch{return null;}return _0x430c69?_0x45c15e?.[_0x5dcf41(0x1fe)]??0x0:null;}async function _0x1c622a(_0x5904c9){const _0x64c9a9=_0x2c9538;_0x300699=null;const _0x2a8342=await _0x573f90();if(_0x2a8342!=null){_0x13bde7=0x0;if(_0x5904c9){if(!_0x5730fa['hasFingerprints'])return _0x36739f(_0x5904c9),await _0x4bdbf2(),null;const _0x225f26=_0x59ccc2(_0x5730fa,_0x5904c9,_0x2bc9d0,{'upsert':_0x874e7b,'remove':_0x400941}),_0x20c88a=_0x225f26[_0x64c9a9(0x1bd)]+_0x225f26[_0x64c9a9(0x1d6)]+_0x225f26[_0x64c9a9(0x182)];_0x20c88a>0x0&&(_0x13bde7+=_0x20c88a,await _0x4bdbf2());}return _0x2a8342;}_0x36739f(_0x5904c9??[]);if(_0x54da18[_0x64c9a9(0x1a0)]()>0x0)await _0x4bdbf2();return null;}async function _0x5472c6(){_0x4754dd=!![],await _0x1c622a(await _0x422ded());}async function _0x32fa59(){const _0x2307bc=_0x2c9538;if(!_0x4754dd)return;_0x4754dd=![],_0x405d55(),_0x13bde7=0x0;const _0x173997=_0x392d36[_0x2307bc(0x1e3)]()||_0x392d36[_0x2307bc(0x1c6)]();await _0x54d47e(_0x173997),_0x1bc1a6();}async function _0x54d47e(_0x377f2f){const _0x34fcd0=_0x2c9538;if(!_0x377f2f)return![];let _0x55fb8e=![];try{await _0x392d36[_0x34fcd0(0x222)](_0x377f2f,async _0x2c2ad2=>{const _0x15238b=_0x34fcd0,_0x1f3443=JSON[_0x15238b(0x21e)](_0x360e92[_0x15238b(0x18e)](_0x2c2ad2[_0x15238b(0x231)],'utf8'));if(_0x1f3443[_0x15238b(0x22d)]!==_0x141e1e||_0x1f3443[_0x15238b(0x1e8)]!=='usearch'||_0x1f3443['dims']!==_0x2bc9d0||_0x1f3443['metric']!==_0x5857bf[_0x15238b(0x1ff)])return;const _0x4f6c0e=new _0x550e55();await _0x4f6c0e[_0x15238b(0x218)](_0x2c2ad2[_0x15238b(0x199)]);const _0x516af6=_0xe6913d();_0x516af6['view'](_0x2c2ad2[_0x15238b(0x19a)]),_0x54da18=_0x516af6,_0x5730fa=_0x4f6c0e,_0x300699=_0x377f2f,_0x55fb8e=!![];});}catch{}return _0x55fb8e;}function _0x460926(){const _0xb05d04=_0x2c9538,_0x14b409=Date['now']();if(_0x14b409-_0x4de774<_0x5857bf[_0xb05d04(0x1e1)])return;_0x4de774=_0x14b409;if(_0x436cf6)return;if(_0x5d64ed['isFree']()){_0x436cf6=!![],_0x40b5a0(async()=>{!_0x4754dd&&_0x5d9ba5&&_0x5d64ed['acquire']()&&(await _0x5472c6(),_0x1bc1a6());})[_0xb05d04(0x1ec)](()=>{})['finally'](()=>{_0x436cf6=![];});return;}const _0x3e391d=_0x392d36[_0xb05d04(0x1e3)]()||_0x392d36[_0xb05d04(0x1c6)]();if(!_0x3e391d||_0x3e391d===_0x300699)return;_0x436cf6=!![],_0x40b5a0(async()=>{if(!_0x4754dd&&await _0x54d47e(_0x3e391d))_0x1bc1a6();})[_0xb05d04(0x1ec)](()=>{})[_0xb05d04(0x215)](()=>{_0x436cf6=![];});}return{async 'load'(_0x142ee1){return _0x40b5a0(async()=>{const _0x4e7a01=_0x4d49;_0x392d36[_0x4e7a01(0x1b1)]({'maxAgeMs':_0x5857bf[_0x4e7a01(0x233)]}),_0x5f2179=_0x142ee1??null,_0x4754dd=_0x5d64ed[_0x4e7a01(0x1a8)]();let _0x5e21bb=null;if(_0x4754dd)_0x5e21bb=await _0x1c622a(_0x142ee1?await _0x142ee1():null);else{const _0x5f3ea5=_0x392d36[_0x4e7a01(0x1e3)]()||_0x392d36[_0x4e7a01(0x1c6)]();await _0x54d47e(_0x5f3ea5);}return _0x5d9ba5=!![],_0x5e21bb;});},async 'add'(_0x3966d8,_0x527c05,_0x4cfff8){return _0x40b5a0(async()=>{const _0x46ce4c=_0x4d49;if(!_0x5d9ba5)return;const _0x1c2ccf=_0xe6bd6b(_0x527c05);if(!_0x4754dd){if(!_0x5d64ed[_0x46ce4c(0x1a8)]())return;await _0x5472c6();}if(!_0x54da18)return;const _0x154528=_0x526174(_0x1c2ccf);if(_0x5730fa[_0x46ce4c(0x20d)](_0x3966d8)===_0x154528)return;_0x874e7b(_0x3966d8,_0x1c2ccf,_0x154528),await _0x375b6d();});},async 'remove'(_0x5f4a78){return _0x40b5a0(async()=>{const _0x37a079=_0x4d49;if(!_0x5d9ba5)return;if(!_0x4754dd){if(!_0x5d64ed[_0x37a079(0x1a8)]())return;await _0x5472c6();}if(!_0x54da18)return;if(_0x400941(_0x5f4a78))await _0x375b6d();});},'search'(_0x541931,{limit:limit=0xa}={}){const _0x4835bb=_0x2c9538;if(!_0x4754dd&&_0x5d9ba5)_0x460926();if(!_0x54da18)return[];const _0x41fb28=_0x54da18['size']();if(_0x41fb28===0x0)return[];const _0xba1279=Math[_0x4835bb(0x223)](limit,_0x41fb28),_0x1e2887=_0x54da18['search'](_0xe6bd6b(_0x541931),_0xba1279,0x0),_0x57fde5=[],_0x19888d=_0x1e2887['keys'],_0x1f96be=_0x1e2887[_0x4835bb(0x176)];for(let _0x3b74d6=0x0;_0x3b74d6<_0x19888d[_0x4835bb(0x1d3)];_0x3b74d6++){const _0x374549=_0x19888d[_0x3b74d6];if(_0x374549===0xffffffffffffffffn)continue;const _0x5e1771=Number(_0x374549),_0x52d681=_0x5730fa[_0x4835bb(0x210)](_0x5e1771);if(!_0x52d681)continue;const _0xa1cd75=_0x1f96be[_0x3b74d6];let _0x10d715;if(_0x5857bf[_0x4835bb(0x1ff)]===_0x4835bb(0x188))_0x10d715=Math[_0x4835bb(0x1bf)](0x0,0x1-_0xa1cd75);else{if(_0x5857bf['metric']==='ip')_0x10d715=-_0xa1cd75;else _0x10d715=0x1/(0x1+_0xa1cd75);}_0x57fde5['push']({'key':_0x52d681,'score':_0x10d715});}return _0x57fde5;},async 'snapshot'(_0x172ebf){return _0x40b5a0(()=>_0x4754dd?_0x4bdbf2(_0x172ebf??undefined):![]);},async 'rebuild'(_0x42621f){return _0x40b5a0(async()=>{const _0x456f36=_0x4d49;if(_0x42621f!=null)_0x5f2179=_0x42621f;if(!_0x4754dd){if(!_0x5d64ed[_0x456f36(0x1a8)]())return;_0x4754dd=!![];}const _0x517348=_0x42621f?await _0x42621f():await _0x422ded();_0x36739f(_0x517348??[]),_0x5d9ba5=!![],await _0x4bdbf2();});},async 'stop'(){return _0x40b5a0(async()=>{const _0x5ae974=_0x4d49;_0x405d55();if(_0x4754dd){if(_0x13bde7>0x0||!_0x392d36[_0x5ae974(0x1e3)]())await _0x4bdbf2();_0x5d64ed['release']();}_0x4754dd=![],_0x5d9ba5=![];});},'count'(){const _0x8131a0=_0x2c9538;return _0x5730fa[_0x8131a0(0x1a0)]();},'info'(){const _0x4e4f92=_0x2c9538;return{'algorithm':'usearch','role':_0x4754dd?_0x4e4f92(0x1ac):_0x4e4f92(0x1d7),'metric':_0x5857bf['metric'],'connectivity':_0x5857bf['connectivity'],'expansionAdd':_0x5857bf['expansionAdd'],'expansionSearch':_0x5857bf[_0x4e4f92(0x1d8)],'snapshotEveryChanges':_0x5857bf[_0x4e4f92(0x200)],'snapshotMaxLagMs':_0x5857bf[_0x4e4f92(0x192)],'count':_0x5730fa[_0x4e4f92(0x1a0)](),'size':_0x54da18?.[_0x4e4f92(0x1a0)]?.()??0x0,'capacity':_0x54da18?.['capacity']?.()??0x0,'changesSince':_0x4754dd?_0x13bde7:null,'viewedSnapshot':_0x300699??null,'snapshotDir':_0x43e18a,'latestSnapshot':_0x392d36[_0x4e4f92(0x1e3)]()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0xc52c80=_0x2bb8dc;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x26d19,workerData:_0x548e68}=require$$0$1,{algorithmName:_0x3b9751,algorithmConfig:_0x1c7595,dims:_0x239f27,dir:_0x131290}=_0x548e68;let _0x2263bd=0x1;const _0xef114=new Map();function _0x5622c8(){const _0x98f1ab=_0x2263bd++;return new Promise((_0x481e25,_0x5919f3)=>{const _0x473be6=_0x4d49;_0xef114[_0x473be6(0x197)](_0x98f1ab,{'resolve':_0x481e25,'reject':_0x5919f3}),_0x26d19['postMessage']({'op':_0x473be6(0x190),'fid':_0x98f1ab});});}const _0x2848c4={'dims':_0x239f27,'dir':_0x131290,'fetchAll':_0x5622c8,'onChange':()=>_0x190dc0()};let _0x451cb6;if(_0x3b9751===_0xc52c80(0x224))_0x451cb6=requireHnsw()(_0x1c7595,_0x2848c4);else{if(_0x3b9751===_0xc52c80(0x189))_0x451cb6=requireFlat()(_0x1c7595,_0x2848c4);else{if(_0x3b9751==='usearch')_0x451cb6=requireUsearch()(_0x1c7595,_0x2848c4);else throw new Error(_0xc52c80(0x19d)+_0x3b9751+'\x22');}}function _0x190dc0(){const _0xffddef=_0xc52c80;try{_0x26d19[_0xffddef(0x228)]({'op':'sync','count':_0x451cb6['count'](),'info':_0x451cb6[_0xffddef(0x1b8)](),'memory':process[_0xffddef(0x16a)]()});}catch{}}function _0x2a8a7c(_0x2a15e4){const _0x4d53f8=_0xc52c80;return(_0x2a15e4||[])[_0x4d53f8(0x1d1)](_0x417d23=>({'key':_0x417d23[_0x4d53f8(0x1c8)],'vector':_0x417d23[_0x4d53f8(0x206)]instanceof Float32Array?_0x417d23[_0x4d53f8(0x206)]:new Float32Array(_0x417d23[_0x4d53f8(0x206)])}));}return _0x26d19['on'](_0xc52c80(0x1df),async _0x4bb72a=>{const _0x19aaf3=_0xc52c80;if(_0x4bb72a['op']===_0x19aaf3(0x17b)){const _0x1fd1d5=_0xef114[_0x19aaf3(0x167)](_0x4bb72a[_0x19aaf3(0x162)]);if(!_0x1fd1d5)return;_0xef114[_0x19aaf3(0x19c)](_0x4bb72a[_0x19aaf3(0x162)]);if(_0x4bb72a['error'])_0x1fd1d5['reject'](new Error(_0x4bb72a[_0x19aaf3(0x1ad)]));else _0x1fd1d5[_0x19aaf3(0x161)](_0x2a8a7c(_0x4bb72a[_0x19aaf3(0x20e)]));return;}const {id:_0xb1e6a2,op:_0x592700,args:_0x121046}=_0x4bb72a;try{let _0x18e6d6;switch(_0x592700){case _0x19aaf3(0x1da):{_0x18e6d6=await _0x451cb6[_0x19aaf3(0x1da)](_0x121046[_0x19aaf3(0x178)]?_0x5622c8:null),_0x190dc0();break;}case _0x19aaf3(0x174):{const _0x36cf04=_0x121046[_0x19aaf3(0x206)]instanceof Float32Array?_0x121046['vector']:new Float32Array(_0x121046[_0x19aaf3(0x206)]);await _0x451cb6[_0x19aaf3(0x174)](_0x121046['key'],_0x36cf04,_0x121046[_0x19aaf3(0x1fe)]??undefined),_0x190dc0(),_0x18e6d6=null;break;}case _0x19aaf3(0x201):{await _0x451cb6[_0x19aaf3(0x201)](_0x121046[_0x19aaf3(0x1c8)]),_0x190dc0(),_0x18e6d6=null;break;}case _0x19aaf3(0x171):{const _0x54dcab=_0x121046['queryVec']instanceof Float32Array?_0x121046[_0x19aaf3(0x1e7)]:new Float32Array(_0x121046[_0x19aaf3(0x1e7)]);_0x18e6d6=_0x451cb6[_0x19aaf3(0x171)](_0x54dcab,_0x121046[_0x19aaf3(0x172)]||{});break;}case'snapshot':{_0x18e6d6=await _0x451cb6['snapshot'](_0x121046[_0x19aaf3(0x1fe)]),_0x190dc0();break;}case _0x19aaf3(0x1d0):{const _0x321516=_0x2a8a7c(_0x121046[_0x19aaf3(0x20e)]);await _0x451cb6[_0x19aaf3(0x1d0)](async()=>_0x321516),_0x190dc0(),_0x18e6d6=null;break;}case'stop':{await _0x451cb6[_0x19aaf3(0x1ba)](),_0x190dc0(),_0x18e6d6=null;break;}case _0x19aaf3(0x1a4):{_0x18e6d6=_0x451cb6['count']();break;}case'info':{_0x18e6d6=_0x451cb6['info']();break;}default:throw new Error(_0x19aaf3(0x21c)+_0x592700+'\x22');}_0x26d19[_0x19aaf3(0x228)]({'id':_0xb1e6a2,'result':_0x18e6d6});}catch(_0x3825ad){_0x26d19[_0x19aaf3(0x228)]({'id':_0xb1e6a2,'error':{'message':_0x3825ad?.['message']||String(_0x3825ad),'code':_0x3825ad?.[_0x19aaf3(0x1f6)]}});}}),_0x26d19['postMessage']({'op':_0xc52c80(0x17a)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module[_0x2bb8dc(0x181)]=algorithmWorkerThread;function _0x1e68(){const _0x5e2fad=['vectors','node','keyForLabel','labelForExisting','.tmp-','unlinkSync','publishSnapshot','finally','initIndex','setFingerprint','loadFrom','snapshotsDir','version','prototype','Unknown\x20op:\x20\x22','worker_threads','parse','writeFileSync','listSnapshotIds','MetricKind','loadSnapshot','min','hnsw','token','versions','ceil','postMessage','unreadable','dims','now','host','manifestVersion','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20','HNSW_BINDINGS_UNAVAILABLE','isInteger','state','15MJvQxU','tmpMaxAgeMs','getCurrentCount','score','utf8','then','closeSync','filter',').\x20','resolve','fid','heartbeatIntervalMs','round','startsWith','entries','get','Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20','index.hnsw','memoryUsage','F32','280KIWqNy','readIndexSync','stale','6230FhJVba','labelToKey','search','opts','69545MGSlIA','add','[SnapshotStore]','distances','snapshots','hasRows','path','ready','fetchAllResult','arch','mtimeMs','44OYliiw','slice','cause','exports','removed','resizeIndex','Cos','readdirSync','join','call','cosine','flat','lockPath','s,\x20pid:\x20','_snapshotDir','usearch','readFileSync','warn','fetchAll',',\x20host:\x20','snapshotMaxLagMs','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20','snapshot\x20id\x20required','_snapshotPaths','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','set','renameSync','labels','index','getMaxElements','delete','Unknown\x20algorithm:\x20\x22','isDirectory','push','size','trunc','setEf','imul','count','repeat','HierarchicalNSW','EEXIST','acquire','hnswlib-node','USEARCH_BINDINGS_UNAVAILABLE','keyToFp','writer','error','usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','name','406314jIJfuO','cleanupTmpDirs','readCurrentClock','mkdirSync','randomBytes','writeIndexSync','rmSync','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','info','reset','stop','efSearch','unref','added','.tmp','max','efConstruction','connectivity','2102068dPDXGX','clear','save','ENOENT','latestSnapshotId','Index','key','sort','__esModule','currentPath','snapshotTo','openSync','growFactor','SNAPSHOT.LOCK','rebuild','map','writerLockMaxAgeMs','length','byteOffset','Original\x20error:\x20','changed','reader','expansionSearch','52ZqGVnK','load','L2sq','lock_busy','published','tombstone','message','default','viewRefreshMs','WRITER.LOCK','readCurrentId','platform','keyToLabel','stringify','queryVec','algorithm','SnapshotStore\x20requires\x20dir','hostname','1463910jzOeIG','catch','hex','_tombstoneCount','for\x20Node\x20','dir','5637681pnAFZQ','toString','prune','pid','nextLabel','code','sqrt','expansionAdd','keys','labelForEphemeral','\x20on\x20','log','_tmp-','clock','metric','snapshotEveryChanges','remove','hasFingerprints','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','26986xyfvPX','searchKnn','vector','isArray','keepSnapshots','maxElements','existsSync','from','labels.json','fingerprintOf'];_0x1e68=function(){return _0x5e2fad;};return _0x1e68();}
|