@kedem/okdb 2.3.0 → 2.3.2
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 +96 -0
- package/algorithm-worker-thread.js +1 -1
- package/bin/okdb.js +1 -1
- 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,102 @@ 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.3.2] - 2026-09-24
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- **An index-maintenance error now aborts the write.** Secondary-index upkeep runs inside the
|
|
12
|
+
writer's transaction; an error there used to be logged and swallowed, so the document committed
|
|
13
|
+
without its index row (a unique index then silently stopped enforcing uniqueness for that key).
|
|
14
|
+
The error now fails the commit and the whole transaction rolls back. Writes that used to
|
|
15
|
+
"succeed" while silently skipping the index will now throw.
|
|
16
|
+
- **A non-scalar value in an indexed field is rejected with `INVALID_INDEX_KEY`.** An object,
|
|
17
|
+
array or `Date` in an indexed field could never be indexed; such writes committed without an
|
|
18
|
+
index row and now fail (see above). Index fields take `null`/missing, strings, numbers,
|
|
19
|
+
booleans, bigints or Buffers. A document already stored with such a value (from an earlier
|
|
20
|
+
version) stays updatable and removable: an unindexable old value is treated as having no row.
|
|
21
|
+
- **The console log sink honours `OKDB_LOG_LEVEL` (default `info`).** It printed every level, so
|
|
22
|
+
debug lines such as the queue's per-job "job claimed" reached the console. Set
|
|
23
|
+
`OKDB_LOG_LEVEL=debug` to get them back. The `~log` and relay sinks are unchanged.
|
|
24
|
+
- **The embeddings `_durable*` accessors are async.** `_durableIndexerStats`,
|
|
25
|
+
`_durableIndexerDocs`, `_durableIndexerDoc` and `_durableWorkerStats` now return promises (see
|
|
26
|
+
Fixed); callers must `await` them. The HTTP routes and pipeline inspect already do.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- **Unique indexes lost their row under a stale lmdb key buffer.** lmdb-js `getValues()` inside a
|
|
31
|
+
write transaction decodes a discarded key from a shared buffer that can still hold the previous
|
|
32
|
+
write's bytes; when those looked like an ordered-binary number the read threw ("The number
|
|
33
|
+
4.7e-66 cannot be converted to a BigInt"). The unique-index check hit it right after its own
|
|
34
|
+
write, and with the error swallowed the job committed without its index row, so the queue's
|
|
35
|
+
idempotency dedup was bypassed (seen while claiming embedding jobs in bulk). Duplicate-value
|
|
36
|
+
reads that can run in a write transaction (index uniqueness, views' live map, time machine,
|
|
37
|
+
FTS live tiers) now use key-bounded range reads that never decode stale bytes. Vacating a
|
|
38
|
+
`null` index key no longer counts the whole `null`-key duplicate set (every claimed queue job
|
|
39
|
+
did this).
|
|
40
|
+
- **The embeddings indexer no longer fails a drain on a duplicate job.** Queue-mode indexing
|
|
41
|
+
enqueues a batch in one transaction, so the queue's idempotency fallback didn't apply: a peer
|
|
42
|
+
enqueueing the same doc between the check and the commit failed the batch ("processor drain
|
|
43
|
+
error … Unique constraint violated") and the drain retried. The duplicate now folds into the
|
|
44
|
+
pending job, as a single `enqueue` does.
|
|
45
|
+
- **Queue: a job deleted mid-claim is skipped.** A job removed between the claim scan and the
|
|
46
|
+
claim update threw `NOT_FOUND`, which the consumer logged as "worker loop crashed". It is now a
|
|
47
|
+
lost race like a version conflict: the job is skipped and the next one claimed. Both lost-race
|
|
48
|
+
paths return the bucket tokens taken for that job (previously leaked on a version conflict).
|
|
49
|
+
- **A drain waiting for a resolver no longer spins.** On reopen of a store with FTS or an
|
|
50
|
+
embeddings indexer over a `resolveField` field, the processor drained before the app registered
|
|
51
|
+
the resolver and retried in a hot loop (~800 "processor drain error" warnings in 1.5 s). It now
|
|
52
|
+
holds quietly (cursor unchanged, `status().waiting` set, one debug line) and resumes when the
|
|
53
|
+
resolver is registered, on the next write, or on the catch-up tick. A holding process yields
|
|
54
|
+
its lease at once to a peer that wants it.
|
|
55
|
+
- **Embeddings durable stats see pipelines created by another process.** The durable indexer and
|
|
56
|
+
worker stats looked for the pipeline's sub-env only among envs already open, so a process that
|
|
57
|
+
attached before another process created the pipeline reported `done 0 / pending N`. They now
|
|
58
|
+
open the sub-env on demand.
|
|
59
|
+
- **The embeddings restart safety net resets only when vectors are really lost.** It reset the
|
|
60
|
+
cursor whenever the vector store was empty, so a pipeline whose docs legitimately yield no
|
|
61
|
+
vectors re-ran every doc on every restart. It now resets only when `doc_status` is missing or a
|
|
62
|
+
done, non-empty doc expects a vector that isn't there — and that reset now actually re-indexes
|
|
63
|
+
(it drops `doc_status` first, as `rebuild()` does; before, surviving done rows skipped every
|
|
64
|
+
doc).
|
|
65
|
+
|
|
66
|
+
## [2.3.1] - 2026-09-24
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
|
|
70
|
+
- **`ensureType` is race-safe across processes.** It checked for the type and then registered it
|
|
71
|
+
in a separate step, so two processes creating the same type in a shared env raced and the loser
|
|
72
|
+
threw "Register Type Error: <type> already registered" (seen when two processes opened the same
|
|
73
|
+
fresh env at first boot). The existence check now runs inside the write transaction, and a
|
|
74
|
+
peer's win counts as success. Indexes passed to `ensureType` get the same treatment: an index a
|
|
75
|
+
peer registered is adopted instead of being created or rebuilt a second time. Internal
|
|
76
|
+
check-then-register sites (`~envs`, `~engines`, `~pipelines`, functions, views, process
|
|
77
|
+
registry, `doc_status`, …) now use `ensureType`. An explicit `registerType` of an existing type
|
|
78
|
+
still throws.
|
|
79
|
+
- **The embeddings indexer commits as it goes.** An inline drain embedded every text of its batch
|
|
80
|
+
(up to 1 000 docs) before writing any vector or `doc_status` row. A large bootstrap showed zero
|
|
81
|
+
progress for many minutes (about 19 min for 372 source files on a local model), and a restart in
|
|
82
|
+
that window lost all of it. Vectors and `DONE` rows are now written every ~128 texts
|
|
83
|
+
(`batch` × 4), so progress is visible and durable, and a re-run skips committed docs.
|
|
84
|
+
- **A slow embeddings backlog no longer freezes the rest of the instance.** The indexer drained in
|
|
85
|
+
5 000-change quanta, so a backlog of network-bound embed calls held the instance's processor
|
|
86
|
+
gate for the whole build (FTS and other pipelines' indexers sat still) and tripped the 60 s
|
|
87
|
+
drain deadline into error/retry cycles. It now drains in 32-change quanta, releasing the gate
|
|
88
|
+
between them, with a 10-minute drain deadline. Both can be overridden per pipeline
|
|
89
|
+
(`config.flushQuantum`, `config.drainDeadlineMs`).
|
|
90
|
+
- **`createPipeline` repairs a pipeline whose member engines are missing.** An existing pipeline
|
|
91
|
+
record always refused with "Pipeline already exists", so a record left pointing at engines that
|
|
92
|
+
were gone (removed, or lost to an interrupted create in another process) could never index and
|
|
93
|
+
could not be recovered by re-running an idempotent create. Missing members are now re-created
|
|
94
|
+
(existing ones reused) and a warning names them. A complete pipeline still refuses.
|
|
95
|
+
- **Named processor handlers work with two OKDB instances in one process.** The named-handler
|
|
96
|
+
registry is process-global, but the indexer, pipeline-processor and materializer drivers keep
|
|
97
|
+
their runtime per instance. A processor registered on the first instance after a second
|
|
98
|
+
instance opened dispatched to the second instance's handler, found nothing to do, and advanced
|
|
99
|
+
its cursor anyway, so those changes were silently never processed (e.g. a new pipeline or an
|
|
100
|
+
engine restart on a host's own store while an embedded library's store is also open). Handlers
|
|
101
|
+
now resolve their instance through a driver id carried in the processor payload.
|
|
102
|
+
|
|
7
103
|
## [2.3.0] - 2026-09-24
|
|
8
104
|
|
|
9
105
|
### Added
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function _0x5cec(_0x4613c8,_0xa10b64){_0x4613c8=_0x4613c8-0xd4;const _0x3a0785=_0x3a07();let _0x5cecfb=_0x3a0785[_0x4613c8];return _0x5cecfb;}const _0x11b94d=_0x5cec;(function(_0x4e0afe,_0x592238){const _0x154bed=_0x5cec,_0x55a29e=_0x4e0afe();while(!![]){try{const _0x163b41=-parseInt(_0x154bed(0xdc))/0x1*(-parseInt(_0x154bed(0x13b))/0x2)+parseInt(_0x154bed(0x120))/0x3*(parseInt(_0x154bed(0x116))/0x4)+-parseInt(_0x154bed(0x130))/0x5*(-parseInt(_0x154bed(0xdb))/0x6)+-parseInt(_0x154bed(0xe1))/0x7*(parseInt(_0x154bed(0xfd))/0x8)+parseInt(_0x154bed(0x1a5))/0x9*(parseInt(_0x154bed(0x11a))/0xa)+-parseInt(_0x154bed(0x19f))/0xb*(parseInt(_0x154bed(0x183))/0xc)+-parseInt(_0x154bed(0x12f))/0xd*(parseInt(_0x154bed(0x17c))/0xe);if(_0x163b41===_0x592238)break;else _0x55a29e['push'](_0x55a29e['shift']());}catch(_0x193b40){_0x55a29e['push'](_0x55a29e['shift']());}}}(_0x3a07,0x55ed0));var require$$0$1=require(_0x11b94d(0x195)),require$$0=require('fs'),require$$1=require(_0x11b94d(0xef)),require$$2=require('os'),require$$3=require(_0x11b94d(0x13f));function getDefaultExportFromCjs(_0x518b7e){const _0x1b0a4a=_0x11b94d;return _0x518b7e&&_0x518b7e[_0x1b0a4a(0x11c)]&&Object[_0x1b0a4a(0x1ad)]['hasOwnProperty']['call'](_0x518b7e,'default')?_0x518b7e[_0x1b0a4a(0x148)]:_0x518b7e;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x1939db=_0x11b94d;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x81280f=require$$0,_0x5a8e40=require$$1,_0x363bf6=require$$2,_0x3aee3a=require$$3;function _0x4ea5a7(){const _0x3f0216=_0x5cec;return Date[_0x3f0216(0x1a7)]();}function _0x29aa02(_0x5712a6){const _0x1d3cc0=_0x5cec;try{return _0x81280f[_0x1d3cc0(0x107)](_0x5712a6);}catch{return![];}}function _0x31b9fa(_0x2b9233){const _0x44790c=_0x5cec;try{return _0x81280f['readFileSync'](_0x2b9233,_0x44790c(0x124));}catch{return null;}}function _0xe4ed84(_0x235a3c,_0x431ab4){const _0x3bf1c2=_0x5cec,_0x43829d=_0x235a3c+_0x3bf1c2(0x186)+_0x3aee3a[_0x3bf1c2(0x146)](0x6)[_0x3bf1c2(0x15b)](_0x3bf1c2(0x181));_0x81280f[_0x3bf1c2(0x170)](_0x43829d,_0x431ab4),_0x81280f[_0x3bf1c2(0x112)](_0x43829d,_0x235a3c);}function _0x2c6f6d(_0x4e9426,_0x1d136a=0x10){const _0x1d93cd=_0x5cec,_0x5dac6a=String(Math[_0x1d93cd(0x16d)](0x0,Math[_0x1d93cd(0x1ae)](_0x4e9426||0x0)));return _0x5dac6a[_0x1d93cd(0x122)]>=_0x1d136a?_0x5dac6a:'0'[_0x1d93cd(0x114)](_0x1d136a-_0x5dac6a[_0x1d93cd(0x122)])+_0x5dac6a;}return snapshotStore=class _0x172db5{constructor({dir:_0x13ec03,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x419358=_0x5cec;if(!_0x13ec03)throw new Error(_0x419358(0x158));this[_0x419358(0x151)]=_0x13ec03,this[_0x419358(0x149)]=_0x5a8e40[_0x419358(0x169)](_0x13ec03,'snapshots'),this['currentPath']=_0x5a8e40[_0x419358(0x169)](_0x13ec03,'CURRENT'),this[_0x419358(0x185)]=_0x5a8e40[_0x419358(0x169)](_0x13ec03,_0x419358(0x193)),this[_0x419358(0x191)]=keepSnapshots,this['log']=log,_0x81280f[_0x419358(0x127)](this[_0x419358(0x151)],{'recursive':!![]}),_0x81280f[_0x419358(0x127)](this[_0x419358(0x149)],{'recursive':!![]});}[_0x1939db(0x10d)](_0x4b8be0){const _0x227196=_0x1939db;return _0x5a8e40['join'](this[_0x227196(0x149)],_0x4b8be0);}[_0x1939db(0x1b2)](_0x57d69b){const _0x31dce7=_0x1939db,_0x20c982=this[_0x31dce7(0x10d)](_0x57d69b);return{'dir':_0x20c982,'index':_0x5a8e40[_0x31dce7(0x169)](_0x20c982,_0x31dce7(0x101)),'labels':_0x5a8e40[_0x31dce7(0x169)](_0x20c982,'labels.json'),'state':_0x5a8e40[_0x31dce7(0x169)](_0x20c982,_0x31dce7(0x119))};}['readCurrentId'](){const _0x11ad5f=_0x1939db;if(!_0x29aa02(this[_0x11ad5f(0x136)]))return null;const _0x33895a=_0x31b9fa(this[_0x11ad5f(0x136)]);if(!_0x33895a)return null;const _0x183d39=String(_0x33895a)['trim']();return _0x183d39||null;}['readCurrentClock'](){const _0x310b67=_0x1939db,_0x94d6ac=this[_0x310b67(0x1ac)]();if(!_0x94d6ac)return 0x0;const _0x271490=Number(_0x94d6ac);return Number[_0x310b67(0xf5)](_0x271490)?_0x271490:0x0;}[_0x1939db(0xfc)](){const _0x2ed3f3=_0x1939db;try{return _0x81280f[_0x2ed3f3(0xf2)](this[_0x2ed3f3(0x149)],{'withFileTypes':!![]})['filter'](_0x2d8fff=>_0x2d8fff[_0x2ed3f3(0x135)]())[_0x2ed3f3(0x141)](_0x53b2b5=>_0x53b2b5['name'])[_0x2ed3f3(0x199)](_0x2ecaf8=>!_0x2ecaf8[_0x2ed3f3(0xd6)](_0x2ed3f3(0x186)))[_0x2ed3f3(0x199)](_0x3f62b7=>!_0x3f62b7[_0x2ed3f3(0xd6)](_0x2ed3f3(0x173)))[_0x2ed3f3(0x10c)]();}catch{return[];}}['latestSnapshotId'](){const _0x14e9ca=_0x1939db,_0x213215=this[_0x14e9ca(0x1ac)]();if(_0x213215)return _0x213215;const _0x4e887b=this[_0x14e9ca(0xfc)]();if(!_0x4e887b[_0x14e9ca(0x122)])return null;return _0x4e887b[_0x4e887b[_0x14e9ca(0x122)]-0x1];}['cleanupTmpDirs']({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x447ea0=_0x1939db;let _0x146661;try{_0x146661=_0x81280f[_0x447ea0(0xf2)](this[_0x447ea0(0x149)],{'withFileTypes':!![]});}catch{return;}const _0x225c34=_0x4ea5a7()-maxAgeMs;for(const _0x5ce5e9 of _0x146661){if(!_0x5ce5e9[_0x447ea0(0x135)]())continue;const _0x56059c=_0x5ce5e9[_0x447ea0(0x16f)];if(!_0x56059c[_0x447ea0(0xd6)](_0x447ea0(0x186))&&!_0x56059c[_0x447ea0(0xd6)](_0x447ea0(0x173)))continue;const _0x4e69b3=_0x5a8e40['join'](this[_0x447ea0(0x149)],_0x56059c);try{const _0x11aeea=_0x81280f[_0x447ea0(0x161)](_0x4e69b3);if(_0x11aeea[_0x447ea0(0x10a)]>_0x225c34)continue;}catch{}try{_0x81280f[_0x447ea0(0x108)](_0x4e69b3,{'recursive':!![],'force':!![]});}catch{}}}[_0x1939db(0x145)]({keep:keep=null}={}){const _0xba2341=_0x1939db,_0x238aa0=Math[_0xba2341(0x16d)](0x1,Math['trunc'](keep??this[_0xba2341(0x191)]??0x3)),_0x13925d=this[_0xba2341(0xfc)]();if(_0x13925d[_0xba2341(0x122)]<=_0x238aa0)return;const _0x83c53b=this[_0xba2341(0x1ac)](),_0x47faa2=_0x13925d[_0xba2341(0x16a)](0x0,Math['max'](0x0,_0x13925d[_0xba2341(0x122)]-_0x238aa0));for(const _0x3dcd35 of _0x47faa2){if(_0x83c53b&&_0x3dcd35===_0x83c53b)continue;const _0x5d9d1f=this['_snapshotDir'](_0x3dcd35);try{_0x81280f[_0xba2341(0x108)](_0x5d9d1f,{'recursive':!![],'force':!![]});}catch{}}}async[_0x1939db(0x198)](_0x24c673,_0x31ee50){const _0x9359fe=_0x1939db;if(!_0x24c673)throw new Error(_0x9359fe(0xf8));const _0x5c4826=this['_snapshotPaths'](_0x24c673);if(!_0x29aa02(_0x5c4826['index'])||!_0x29aa02(_0x5c4826['labels'])||!_0x29aa02(_0x5c4826[_0x9359fe(0x160)]))throw new Error('snapshot\x20incomplete:\x20'+_0x24c673);const _0x11092f=await _0x31ee50(_0x5c4826);return _0x11092f||{};}async[_0x1939db(0x113)](_0x196036,_0x3ada8e,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x49abbc=_0x1939db,_0x1bd062=Number(_0x196036);if(!Number['isFinite'](_0x1bd062)||_0x1bd062<0x0)throw new Error(_0x49abbc(0xd5));const _0x1a9031=_0x2c6f6d(_0x1bd062),_0x2324f7=this[_0x49abbc(0x10d)](_0x1a9031),_0x3afa24=_0x5a8e40[_0x49abbc(0x169)](this[_0x49abbc(0x149)],_0x49abbc(0x186)+_0x1a9031+'-'+_0x3aee3a[_0x49abbc(0x146)](0x6)[_0x49abbc(0x15b)]('hex'));_0x81280f[_0x49abbc(0x127)](_0x3afa24,{'recursive':!![]});const _0x90a3ab={'dir':_0x3afa24,'index':_0x5a8e40[_0x49abbc(0x169)](_0x3afa24,_0x49abbc(0x101)),'labels':_0x5a8e40[_0x49abbc(0x169)](_0x3afa24,'labels.json'),'state':_0x5a8e40[_0x49abbc(0x169)](_0x3afa24,_0x49abbc(0x119))};await _0x3ada8e(_0x90a3ab,{'id':_0x1a9031,'clock':_0x1bd062});const _0x4a1b82=JSON[_0x49abbc(0x159)]({'pid':process[_0x49abbc(0xe0)],'host':_0x363bf6[_0x49abbc(0x184)](),'at':_0x4ea5a7()}),_0x40d9d6=_0x4ea5a7();let _0x1c001a=null;const _0x52fa55=()=>{const _0x534c27=_0x49abbc;try{const _0x55e3a1=JSON[_0x534c27(0x10e)](_0x81280f['readFileSync'](this[_0x534c27(0x185)],'utf8'));if(_0x55e3a1['at']&&_0x4ea5a7()-_0x55e3a1['at']>staleLockMaxAgeMs){const _0x22d400=_0x4ea5a7()-_0x55e3a1['at'],_0x16d1c5='Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20'+Math[_0x534c27(0x144)](_0x22d400/0x3e8)+_0x534c27(0xea)+_0x55e3a1[_0x534c27(0xe0)]+_0x534c27(0x126)+_0x55e3a1[_0x534c27(0xd4)]+_0x534c27(0x117)+'This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.';this[_0x534c27(0xeb)]?.[_0x534c27(0xe3)]?this[_0x534c27(0xeb)][_0x534c27(0xe3)](_0x16d1c5):console['warn'](_0x534c27(0x176),_0x16d1c5);try{_0x81280f['unlinkSync'](this[_0x534c27(0x185)]);}catch{}return!![];}}catch{try{_0x81280f['unlinkSync'](this['lockPath']);}catch{}}return![];},_0x3fcf8d=()=>{const _0x451459=_0x49abbc;try{return _0x1c001a=_0x81280f[_0x451459(0x14c)](this['lockPath'],'wx'),_0x81280f['writeFileSync'](_0x1c001a,_0x4a1b82),!![];}catch(_0x297e80){if(_0x297e80&&_0x297e80['code']===_0x451459(0x171))return![];throw _0x297e80;}};if(!_0x3fcf8d()){_0x52fa55(),_0x3fcf8d();if(_0x1c001a==null&&lockTimeoutMs>0x0)while(_0x4ea5a7()-_0x40d9d6<lockTimeoutMs){await new Promise(_0x3bc1af=>setTimeout(_0x3bc1af,0x19));if(_0x3fcf8d())break;_0x52fa55();}}if(_0x1c001a==null){try{_0x81280f['rmSync'](_0x3afa24,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x49abbc(0x179)};}try{const _0x1d04f1=this[_0x49abbc(0x103)]();if(_0x1bd062<=_0x1d04f1){try{_0x81280f[_0x49abbc(0x108)](_0x3afa24,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':'stale','currentClock':_0x1d04f1};}if(!_0x29aa02(_0x2324f7))_0x81280f[_0x49abbc(0x112)](_0x3afa24,_0x2324f7);else try{_0x81280f['rmSync'](_0x3afa24,{'recursive':!![],'force':!![]});}catch{}return _0xe4ed84(this[_0x49abbc(0x136)],_0x1a9031+'\x0a'),this[_0x49abbc(0x145)]({'keep':keep}),{'published':!![],'currentClock':_0x1bd062};}finally{try{_0x81280f[_0x49abbc(0x14d)](_0x1c001a);}catch{}try{_0x81280f[_0x49abbc(0x109)](this['lockPath']);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x11417a=_0x11b94d;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x582098=require$$0;class _0x1f4c5c{constructor(){const _0x3db94b=_0x5cec;this['keyToLabel']=new Map(),this['labelToKey']=new Map(),this['nextLabel']=0x0,this['_tombstoneCount']=0x0,this[_0x3db94b(0x187)]=new Map(),this['hasFingerprints']=!![];}async['reset'](){const _0x428a97=_0x5cec;this[_0x428a97(0xda)]=new Map(),this[_0x428a97(0x14e)]=new Map(),this[_0x428a97(0x187)]=new Map(),this[_0x428a97(0x129)]=!![],this[_0x428a97(0x16c)]=0x0,this['_tombstoneCount']=0x0;}async[_0x11417a(0x162)](_0x1e5e52){const _0x5bb443=_0x11417a;if(!_0x1e5e52||!_0x582098[_0x5bb443(0x107)](_0x1e5e52))return await this[_0x5bb443(0x1b1)](),!![];let _0xa0c591;try{_0xa0c591=_0x582098[_0x5bb443(0x1ab)](_0x1e5e52,'utf8');}catch{return await this['reset'](),!![];}let _0x522fdc;try{_0x522fdc=JSON['parse'](_0xa0c591);}catch{return await this['reset'](),!![];}const _0x2fc2ba=Array[_0x5bb443(0x12b)](_0x522fdc?.[_0x5bb443(0x174)])?_0x522fdc[_0x5bb443(0x174)]:[],_0x3c833c=Number[_0x5bb443(0x131)](_0x522fdc?.['nextLabel'])?_0x522fdc['nextLabel']:0x0,_0x588e4c=new Map(),_0x3a3d07=new Map(),_0x1e6596=new Map(),_0x3c486b=_0x522fdc?.[_0x5bb443(0x137)]>=0x2;let _0xfff1cd=-0x1;for(const _0x463c1b of _0x2fc2ba){if(!Array['isArray'](_0x463c1b)||_0x463c1b['length']<0x2)continue;const _0x39ff4b=Number(_0x463c1b[0x0]),_0xa1972e=String(_0x463c1b[0x1]??'');if(!Number[_0x5bb443(0x131)](_0x39ff4b)||_0x39ff4b<0x0)continue;if(!_0xa1972e)continue;_0x588e4c[_0x5bb443(0x128)](_0xa1972e,_0x39ff4b),_0x3a3d07[_0x5bb443(0x128)](_0x39ff4b,_0xa1972e);if(_0x3c486b&&typeof _0x463c1b[0x2]==='number')_0x1e6596['set'](_0xa1972e,_0x463c1b[0x2]);if(_0x39ff4b>_0xfff1cd)_0xfff1cd=_0x39ff4b;}return this[_0x5bb443(0xda)]=_0x588e4c,this['labelToKey']=_0x3a3d07,this[_0x5bb443(0x187)]=_0x1e6596,this[_0x5bb443(0x129)]=_0x3c486b,this[_0x5bb443(0x16c)]=Math['max'](_0x3c833c,_0xfff1cd+0x1,0x0),this[_0x5bb443(0x15c)]=0x0,!![];}[_0x11417a(0x18a)](_0x48e5d0){const _0xc577e6=_0x11417a;return this['keyToLabel'][_0xc577e6(0x16e)](_0x48e5d0);}[_0x11417a(0xee)](_0x4e8bbd){const _0x348c28=_0x11417a;let _0xf1c8f5=this['keyToLabel'][_0x348c28(0x16e)](_0x4e8bbd);if(_0xf1c8f5!==undefined)return _0xf1c8f5;return _0xf1c8f5=this[_0x348c28(0x16c)]++,this[_0x348c28(0xda)]['set'](_0x4e8bbd,_0xf1c8f5),this['labelToKey'][_0x348c28(0x128)](_0xf1c8f5,_0x4e8bbd),_0xf1c8f5;}[_0x11417a(0x10b)](_0x3a1ac7,_0x4c853d){const _0x3c6488=_0x11417a;if(_0x4c853d==null)this['keyToFp']['delete'](_0x3a1ac7);else this['keyToFp'][_0x3c6488(0x128)](_0x3a1ac7,_0x4c853d);}['fingerprintOf'](_0x4bea5f){const _0x56b4e9=_0x11417a;return this[_0x56b4e9(0x187)]['get'](_0x4bea5f);}[_0x11417a(0x15e)](){const _0x551b66=_0x11417a;return this['keyToLabel'][_0x551b66(0x15e)]();}[_0x11417a(0x166)](_0x15ea17){const _0x29ce25=_0x11417a,_0x599c28=this[_0x29ce25(0xda)][_0x29ce25(0x16e)](_0x15ea17);if(_0x599c28===undefined)return;this[_0x29ce25(0x187)][_0x29ce25(0xe8)](_0x15ea17),this[_0x29ce25(0xda)][_0x29ce25(0xe8)](_0x15ea17),this[_0x29ce25(0x14e)][_0x29ce25(0xe8)](_0x599c28),this['_tombstoneCount']++;}[_0x11417a(0x190)](_0x234b56){const _0x7d40d9=_0x11417a;return this[_0x7d40d9(0x14e)][_0x7d40d9(0x16e)](_0x234b56)??null;}[_0x11417a(0x134)](){const _0x5f203d=_0x11417a;return this[_0x5f203d(0xda)][_0x5f203d(0x134)];}[_0x11417a(0x196)](){const _0x4a26e3=_0x11417a;return this[_0x4a26e3(0x15c)];}async['snapshotTo'](_0x5dd1f5){const _0x511a7e=_0x11417a,_0x4290a4=_0x5dd1f5+_0x511a7e(0x12a),_0x9384ea=[];for(const [_0x1a9697,_0x39512d]of this[_0x511a7e(0x14e)][_0x511a7e(0x174)]()){const _0x3aec33=this[_0x511a7e(0x187)]['get'](_0x39512d);_0x9384ea[_0x511a7e(0x194)](_0x3aec33==null?[_0x1a9697,_0x39512d]:[_0x1a9697,_0x39512d,_0x3aec33]);}_0x9384ea[_0x511a7e(0x10c)]((_0xeb4a26,_0x2e7157)=>_0xeb4a26[0x0]-_0x2e7157[0x0]);const _0x240f45={'version':0x2,'nextLabel':this[_0x511a7e(0x16c)],'entries':_0x9384ea};_0x582098[_0x511a7e(0x170)](_0x4290a4,JSON[_0x511a7e(0x159)](_0x240f45)),_0x582098['renameSync'](_0x4290a4,_0x5dd1f5);}}return labelMap=_0x1f4c5c,labelMap;}var indexConvergence,hasRequiredIndexConvergence;function _0x3a07(){const _0x150cda=[').\x20','efConstruction','state.json','10xwrOMV','hnswlib-node','__esModule','count','latestSnapshotId','search','3bbHbuK','queryVec','length','sqrt','utf8','hasRows',',\x20host:\x20','mkdirSync','set','hasFingerprints','.tmp','isArray','clear','ENOENT','searchKnn','1001078KvDNBc','1942235iMIBKU','isInteger','node','load','size','isDirectory','currentPath','version','labels','buffer','algorithm','420380slTJHZ','save','catch','Cos','crypto','hnsw','map','Unknown\x20op:\x20\x22','readIndexSync','round','prune','randomBytes','capacity','default','snapshotsDir','getCurrentCount','published','openSync','closeSync','labelToKey','distances','connectivity','dir','vector','score','expansionSearch','USEARCH_BINDINGS_UNAVAILABLE','snapshot','versions','SnapshotStore\x20requires\x20dir','stringify','snapshotEveryChanges','toString','_tombstoneCount','code','keys','min','state','statSync','loadFrom','ceil','writer','arch','tombstone','markDelete','unref','join','slice','sync','nextLabel','max','get','name','writeFileSync','EEXIST','snapshotTo','_tmp-','entries','unreadable','[SnapshotStore]','finally','growFactor','lock_busy','opts','token','28KRmpCS','imul','writerLockMaxAgeMs','stop','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20','hex','HierarchicalNSW','24liUWnT','hostname','lockPath','.tmp-','keyToFp','usearch','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','labelForExisting','heartbeatIntervalMs','info','key','metric','HNSW_BINDINGS_UNAVAILABLE','keyForLabel','keepSnapshots','manifestVersion','SNAPSHOT.LOCK','push','worker_threads','tombstoneCount','removed','loadSnapshot','filter','exports','resolve','initIndex','remove','getMaxElements','2249896rWVRLb','clock','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','expansionAdd','fetchAllResult','view','768699uhKXCW','platform','now','L2sq','index','cosine','readFileSync','readCurrentId','prototype','trunc','efSearch','message','reset','_snapshotPaths','host','candidateClock\x20must\x20be\x20finite\x20>=\x200','startsWith','from','resizeIndex','then','keyToLabel','6OTLjrT','1EyOGMG','MetricKind','cleanupTmpDirs','release','pid','3059vCLNFF','fid','warn','postMessage','for\x20Node\x20','vectors','added','delete','snapshotMaxLagMs','s,\x20pid:\x20','log','fingerprintOf','writeIndexSync','labelForEphemeral','path','addPoint','\x20on\x20','readdirSync','rebuild','error','isFinite','add','Original\x20error:\x20','snapshot\x20id\x20required','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','tmpMaxAgeMs','isFree','listSnapshotIds','2216ecRDcy','acquire','flat','dims','index.hnsw','cause','readCurrentClock','viewRefreshMs','fetchAll','ready','existsSync','rmSync','unlinkSync','mtimeMs','setFingerprint','sort','_snapshotDir','parse','setEf','memoryUsage','maxElements','renameSync','publishSnapshot','repeat','reject','1408148eDfTby'];_0x3a07=function(){return _0x150cda;};return _0x3a07();}function requireIndexConvergence(){if(hasRequiredIndexConvergence)return indexConvergence;hasRequiredIndexConvergence=0x1;function _0x2ee783(_0xe57e69){const _0x494a0b=_0x5cec,_0x552479=new Uint32Array(_0xe57e69[_0x494a0b(0x139)],_0xe57e69['byteOffset'],_0xe57e69[_0x494a0b(0x122)]);let _0x4fc3d3=0x811c9dc5,_0x44b8e9=0x9747b28c;for(let _0x2a0fee=0x0;_0x2a0fee<_0x552479[_0x494a0b(0x122)];_0x2a0fee++){const _0x1d623b=_0x552479[_0x2a0fee];_0x4fc3d3=Math[_0x494a0b(0x17d)](_0x4fc3d3^_0x1d623b,0x1000193)>>>0x0;let _0x5edf11=Math[_0x494a0b(0x17d)](_0x1d623b,0xcc9e2d51);_0x5edf11=_0x5edf11<<0xf|_0x5edf11>>>0x11,_0x44b8e9=Math[_0x494a0b(0x17d)](_0x44b8e9^Math[_0x494a0b(0x17d)](_0x5edf11,0x1b873593),0x5)+0xe6546b64,_0x44b8e9>>>=0x0;}return _0x44b8e9=Math[_0x494a0b(0x17d)](_0x44b8e9^_0x44b8e9>>>0x10,0x85ebca6b)>>>0x0,(_0x4fc3d3>>>0x0)*0x100000+(_0x44b8e9&0xfffff);}function _0x230aca(_0x3ec7c8,_0x5eed4b,_0x1c1abb,{upsert:_0x541e9b,remove:_0x4ca18c}){const _0x1b20a8=_0x5cec,_0xc382a7=new Set();let _0x35626c=0x0,_0x215584=0x0,_0x260976=0x0;for(const {key:_0x1d9905,vector:_0x474ef5}of _0x5eed4b){if(!(_0x474ef5 instanceof Float32Array)||_0x474ef5[_0x1b20a8(0x122)]!==_0x1c1abb)continue;_0xc382a7[_0x1b20a8(0xf6)](_0x1d9905);const _0x131fb7=_0x2ee783(_0x474ef5),_0x2b5f18=_0x3ec7c8[_0x1b20a8(0x18a)](_0x1d9905)!==undefined;if(_0x2b5f18&&_0x3ec7c8[_0x1b20a8(0xec)](_0x1d9905)===_0x131fb7)continue;_0x541e9b(_0x1d9905,_0x474ef5,_0x131fb7);if(_0x2b5f18)_0x215584++;else _0x35626c++;}for(const _0x1dc5a4 of[..._0x3ec7c8['keys']()]){if(_0xc382a7['has'](_0x1dc5a4))continue;_0x4ca18c(_0x1dc5a4),_0x260976++;}return{'added':_0x35626c,'changed':_0x215584,'removed':_0x260976};}return indexConvergence={'fingerprint':_0x2ee783,'reconcileIndex':_0x230aca},indexConvergence;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x3507d0=requireSnapshotStore(),_0x2a029e=requireLabelMap(),{fingerprint:_0x49a6b0,reconcileIndex:_0x5a0382}=requireIndexConvergence(),_0x28d7b4=0x1;let _0x30fd38=null;function _0x5e8f6e(){const _0x226130=_0x5cec;if(_0x30fd38)return _0x30fd38;try{return _0x30fd38=require(_0x226130(0x11b)),_0x30fd38;}catch(_0x579a9b){const _0x5d215c=new Error('HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20'+(_0x226130(0xe5)+process['versions'][_0x226130(0x132)]+_0x226130(0xf1)+process[_0x226130(0x1a6)]+'/'+process[_0x226130(0x165)]+'.\x20')+'Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20'+(_0x226130(0xf7)+(_0x579a9b?.[_0x226130(0x1b0)]||String(_0x579a9b))));_0x5d215c[_0x226130(0x15d)]=_0x226130(0x18f),_0x5d215c[_0x226130(0x102)]=_0x579a9b;throw _0x5d215c;}}return hnsw=function _0x4487e3(_0x237714={},{dims:_0x5e11cc,dir:_0x206042}){const _0x449f92=_0x5cec,_0x4dfc51=_0x5e8f6e();if(!_0x5e11cc||_0x5e11cc<=0x0)throw new Error(_0x449f92(0xf9));if(!_0x206042)throw new Error(_0x449f92(0x189));const _0xb5f86e={'metric':_0x237714[_0x449f92(0x18e)]??_0x449f92(0x1aa),'M':_0x237714['M']??0x10,'efConstruction':_0x237714[_0x449f92(0x118)]??0xc8,'efSearch':_0x237714[_0x449f92(0x1af)]??0x40,'maxElements':_0x237714[_0x449f92(0x111)]??0x400,'growFactor':_0x237714['growFactor']??0x2,'snapshotEveryChanges':_0x237714[_0x449f92(0x15a)]??0xc350,'keepSnapshots':_0x237714[_0x449f92(0x191)]??0x2,'tmpMaxAgeMs':_0x237714[_0x449f92(0xfa)]??0x6*0x36ee80},_0x55ddbc=new _0x3507d0({'dir':_0x206042,'keepSnapshots':_0xb5f86e[_0x449f92(0x191)]}),_0x33cd72=new _0x2a029e();let _0x3cf7b3=null,_0x587d52=0x0,_0x47fa25=null,_0x276bbd=Promise['resolve']();const _0x47bd4b=_0x3117ce=>{const _0x5189f1=_0x449f92,_0x297c2b=_0x276bbd[_0x5189f1(0xd9)](_0x3117ce);return _0x276bbd=_0x297c2b[_0x5189f1(0x13d)](()=>{}),_0x297c2b;};async function _0x3bfdd4(_0x4b773d){const _0x3d6c1d=_0x449f92;await _0x33cd72[_0x3d6c1d(0x1b1)](),_0x4b773d=_0x4b773d??[];const _0x326ead=Math[_0x3d6c1d(0x16d)](_0xb5f86e[_0x3d6c1d(0x111)],Math[_0x3d6c1d(0x163)](_0x4b773d[_0x3d6c1d(0x122)]*(_0xb5f86e['growFactor']||1.2)),0x1);_0x3cf7b3=new _0x4dfc51[(_0x3d6c1d(0x182))](_0xb5f86e['metric'],_0x5e11cc),_0x3cf7b3[_0x3d6c1d(0x19c)]({'maxElements':_0x326ead,'efConstruction':_0xb5f86e[_0x3d6c1d(0x118)],'M':_0xb5f86e['M']});for(const {key:_0x2ed8ea,vector:_0x198409}of _0x4b773d){if(!(_0x198409 instanceof Float32Array)||_0x198409['length']!==_0x5e11cc)continue;_0x316b44(_0x2ed8ea,_0x198409);}_0x3cf7b3[_0x3d6c1d(0x10f)](_0xb5f86e['efSearch']),_0x587d52=0x0;}async function _0x25de4f(_0x5cd7c8){return _0x3bfdd4(_0x5cd7c8?await _0x5cd7c8():[]);}function _0x7dcd0(){const _0x5d7eac=_0x449f92;if(_0x3cf7b3['getCurrentCount']()<_0x3cf7b3['getMaxElements']())return;const _0x284afe=Math[_0x5d7eac(0x163)](_0x3cf7b3[_0x5d7eac(0x19e)]()*(_0xb5f86e[_0x5d7eac(0x178)]||0x2));_0x3cf7b3[_0x5d7eac(0xd8)](_0x284afe),_0xb5f86e[_0x5d7eac(0x111)]=_0x284afe;}function _0x316b44(_0xdc8068,_0x416ae3,_0x416c0d){const _0xff2996=_0x449f92,_0x3a36e3=_0x33cd72[_0xff2996(0xee)](_0xdc8068);try{_0x3cf7b3[_0xff2996(0x167)](_0x3a36e3);}catch{}_0x7dcd0(),_0x3cf7b3[_0xff2996(0xf0)](Array[_0xff2996(0xd7)](_0x416ae3),_0x3a36e3),_0x33cd72[_0xff2996(0x10b)](_0xdc8068,_0x416c0d??_0x49a6b0(_0x416ae3));}function _0x368c55(_0x32213d){const _0x1e669c=_0x449f92,_0x32bc09=_0x33cd72[_0x1e669c(0x18a)](_0x32213d);if(_0x32bc09===undefined)return![];try{_0x3cf7b3[_0x1e669c(0x167)](_0x32bc09);}catch{}return _0x33cd72[_0x1e669c(0x166)](_0x32213d),!![];}function _0x41b54b(){const _0x17f39b=_0x449f92;return Math[_0x17f39b(0x16d)](Date[_0x17f39b(0x1a7)](),_0x55ddbc[_0x17f39b(0x103)]()+0x1);}async function _0x341588(_0x4f5590){const _0x28402d=_0x449f92;if(!_0x3cf7b3||!_0x4f5590)return![];const _0xc2ae52=await _0x55ddbc[_0x28402d(0x113)](_0x4f5590,async _0x323941=>{const _0x345efa=_0x28402d;_0x3cf7b3[_0x345efa(0xed)](_0x323941[_0x345efa(0x1a9)]),await _0x33cd72[_0x345efa(0x172)](_0x323941[_0x345efa(0x138)]);const _0x525c68=require$$0;_0x525c68[_0x345efa(0x170)](_0x323941[_0x345efa(0x160)],JSON[_0x345efa(0x159)]({'manifestVersion':_0x28d7b4,'dims':_0x5e11cc,'metric':_0xb5f86e[_0x345efa(0x18e)],'clock':_0x4f5590,'snapshotAt':Date[_0x345efa(0x1a7)]()},null,0x2));},{'keep':_0xb5f86e['keepSnapshots']});if(_0xc2ae52?.[_0x28402d(0x14b)])_0x587d52=0x0;return _0xc2ae52?.['published']??![];}async function _0x3aa5d4(){const _0x2a9239=_0x449f92,_0x22db42=_0x55ddbc[_0x2a9239(0x1ac)]()||_0x55ddbc['latestSnapshotId']();if(!_0x22db42)return null;let _0x2f694b,_0x26a607=![];return await _0x55ddbc[_0x2a9239(0x198)](_0x22db42,async _0x36cf0a=>{const _0x2c794a=_0x2a9239,_0x153b39=require$$0;_0x2f694b=JSON[_0x2c794a(0x10e)](_0x153b39[_0x2c794a(0x1ab)](_0x36cf0a[_0x2c794a(0x160)],'utf8'));if(_0x2f694b[_0x2c794a(0x192)]!==_0x28d7b4||_0x2f694b[_0x2c794a(0x100)]!==_0x5e11cc||_0x2f694b['metric']!==_0xb5f86e[_0x2c794a(0x18e)]){_0x2f694b=null;return;}await _0x33cd72['loadFrom'](_0x36cf0a[_0x2c794a(0x138)]),_0x3cf7b3=new _0x4dfc51[(_0x2c794a(0x182))](_0xb5f86e[_0x2c794a(0x18e)],_0x5e11cc),_0x3cf7b3[_0x2c794a(0x143)](_0x36cf0a[_0x2c794a(0x1a9)]),_0x3cf7b3[_0x2c794a(0x10f)](_0xb5f86e[_0x2c794a(0x1af)]),_0x26a607=!![];}),_0x26a607?_0x2f694b?.[_0x2a9239(0x1a0)]??0x0:null;}return{async 'load'(_0x537df2){return _0x47bd4b(async()=>{const _0x1292fc=_0x5cec;_0x55ddbc[_0x1292fc(0xde)]({'maxAgeMs':_0xb5f86e[_0x1292fc(0xfa)]}),_0x47fa25=_0x537df2??null;const _0x2c7527=await _0x3aa5d4(),_0x4d62f0=_0x537df2?await _0x537df2():null;if(_0x2c7527!=null){if(_0x4d62f0){if(!_0x33cd72[_0x1292fc(0x129)])return await _0x3bfdd4(_0x4d62f0),null;const _0x3045c2=_0x5a0382(_0x33cd72,_0x4d62f0,_0x5e11cc,{'upsert':_0x316b44,'remove':_0x368c55});_0x587d52+=_0x3045c2[_0x1292fc(0xe7)]+_0x3045c2['changed']+_0x3045c2['removed'];}return _0x2c7527;}return await _0x3bfdd4(_0x4d62f0),null;});},async 'add'(_0x4b8e09,_0x5d2953,_0x1a6362){return _0x47bd4b(async()=>{const _0x2e30c2=_0x5cec;if(!_0x3cf7b3)return;const _0x28d463=_0x5d2953 instanceof Float32Array?_0x5d2953:new Float32Array(_0x5d2953),_0x37b3ee=_0x49a6b0(_0x28d463);if(_0x33cd72[_0x2e30c2(0xec)](_0x4b8e09)===_0x37b3ee)return;_0x316b44(_0x4b8e09,_0x28d463,_0x37b3ee),_0x587d52++,_0x587d52>=_0xb5f86e[_0x2e30c2(0x15a)]&&await _0x341588(_0x41b54b());});},async 'remove'(_0x36179c){return _0x47bd4b(async()=>{if(!_0x3cf7b3)return;if(_0x368c55(_0x36179c))_0x587d52++;});},'search'(_0x185fca,{limit:limit=0xa,efSearch:_0x144e7e}={}){const _0xed8294=_0x449f92;if(!_0x3cf7b3)return[];if(Number[_0xed8294(0x131)](_0x144e7e))_0x3cf7b3[_0xed8294(0x10f)](_0x144e7e);const _0x26563a=Math['min'](limit,_0x3cf7b3[_0xed8294(0x14a)]()||0x1),{neighbors:_0x5a01f,distances:_0x806fc}=_0x3cf7b3[_0xed8294(0x12e)](Array[_0xed8294(0xd7)](_0x185fca),_0x26563a),_0x3f7fd9=[];for(let _0xbe2c24=0x0;_0xbe2c24<_0x5a01f[_0xed8294(0x122)];_0xbe2c24++){const _0x4e8b16=_0x33cd72['keyForLabel'](_0x5a01f[_0xbe2c24]);if(!_0x4e8b16)continue;const _0x436a91=_0xb5f86e[_0xed8294(0x18e)]===_0xed8294(0x1aa)?Math[_0xed8294(0x16d)](0x0,0x1-_0x806fc[_0xbe2c24]):0x1/(0x1+_0x806fc[_0xbe2c24]);_0x3f7fd9['push']({'key':_0x4e8b16,'score':_0x436a91});}return _0x3f7fd9;},async 'snapshot'(_0x359cee){return _0x47bd4b(()=>_0x341588(_0x359cee??_0x41b54b()));},async 'rebuild'(_0x2a633d){return _0x47bd4b(()=>{if(_0x2a633d!=null)_0x47fa25=_0x2a633d;return _0x25de4f(_0x2a633d??_0x47fa25);});},async 'stop'(){const _0x2aa313=_0x449f92;return _0x47bd4b(()=>_0x587d52>0x0||!_0x55ddbc[_0x2aa313(0x1ac)]()?_0x341588(_0x41b54b()):![]);},'count'(){const _0x21dfc0=_0x449f92;return _0x33cd72[_0x21dfc0(0x134)]();},'info'(){const _0xd86bac=_0x449f92;return{'algorithm':_0xd86bac(0x140),'metric':_0xb5f86e[_0xd86bac(0x18e)],'M':_0xb5f86e['M'],'efConstruction':_0xb5f86e[_0xd86bac(0x118)],'efSearch':_0xb5f86e[_0xd86bac(0x1af)],'maxElements':_0x3cf7b3?.[_0xd86bac(0x19e)]()??_0xb5f86e[_0xd86bac(0x111)],'count':_0x33cd72[_0xd86bac(0x134)](),'changesSince':_0x587d52,'snapshotDir':_0x206042,'latestSnapshot':_0x55ddbc[_0xd86bac(0x1ac)]()??null};}};},hnsw;}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x47f3c4(_0x121e64={}){const _0x25c2ec=new Map();return{async 'load'(_0x3e244a){const _0x422a1c=_0x5cec;_0x25c2ec[_0x422a1c(0x12c)]();if(_0x3e244a)for(const {key:_0x286630,vector:_0x3fc258}of await _0x3e244a()){_0x25c2ec['set'](_0x286630,_0x3fc258);}},async 'add'(_0x16ca98,_0x1a5480,_0x1baf76){_0x25c2ec['set'](_0x16ca98,_0x1a5480);},async 'remove'(_0x2573b5){_0x25c2ec['delete'](_0x2573b5);},'search'(_0x5e66d8,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x2bd672=_0x5cec,_0x236726=[];for(const [_0x31468d,_0x228db7]of _0x25c2ec){const _0x2acdf6=_0x22a649(_0x5e66d8,_0x228db7);if(_0x2acdf6>=threshold)_0x236726['push']({'key':_0x31468d,'score':_0x2acdf6});}return _0x236726[_0x2bd672(0x10c)]((_0x22fd1f,_0x2bab92)=>_0x2bab92[_0x2bd672(0x153)]-_0x22fd1f['score']),_0x236726['slice'](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x338445){const _0x4166af=_0x5cec;await this[_0x4166af(0x133)](_0x338445);},async 'stop'(){},'count'(){return _0x25c2ec['size'];},'info'(){const _0x1bcfc2=_0x5cec;return{'algorithm':_0x1bcfc2(0xff),'count':_0x25c2ec[_0x1bcfc2(0x134)]};}};};function _0x22a649(_0x159664,_0x417929){const _0x1c3644=_0x5cec;let _0x163d01=0x0,_0x7edf43=0x0,_0x451585=0x0;for(let _0x3dc001=0x0;_0x3dc001<_0x159664['length'];_0x3dc001++){_0x163d01+=_0x159664[_0x3dc001]*_0x417929[_0x3dc001],_0x7edf43+=_0x159664[_0x3dc001]*_0x159664[_0x3dc001],_0x451585+=_0x417929[_0x3dc001]*_0x417929[_0x3dc001];}const _0x1e0440=Math[_0x1c3644(0x123)](_0x7edf43)*Math[_0x1c3644(0x123)](_0x451585);return _0x1e0440===0x0?0x0:_0x163d01/_0x1e0440;}return flat;}var writerLock,hasRequiredWriterLock;function requireWriterLock(){if(hasRequiredWriterLock)return writerLock;hasRequiredWriterLock=0x1;const _0x306083=require$$0,_0x286d40=require$$1,_0xc2e837=require$$3;return writerLock=function _0x5b7feb(_0x176dc7,{maxAgeMs:maxAgeMs=0x3a98,heartbeatMs:heartbeatMs=0x1388,onLost:onLost=null}={}){const _0x67bbc4=_0x5cec,_0x4cf671=_0x286d40['join'](_0x176dc7,'WRITER.LOCK'),_0x417cc3=_0xc2e837[_0x67bbc4(0x146)](0x8)['toString'](_0x67bbc4(0x181));let _0x1f29d9=![],_0x41c0b1=null;const _0x412547=()=>JSON[_0x67bbc4(0x159)]({'pid':process[_0x67bbc4(0xe0)],'token':_0x417cc3,'at':Date[_0x67bbc4(0x1a7)]()});function _0x3db1e7(){const _0x5df14a=_0x67bbc4;try{return JSON[_0x5df14a(0x10e)](_0x306083[_0x5df14a(0x1ab)](_0x4cf671,_0x5df14a(0x124)));}catch(_0x4ed965){return _0x4ed965?.['code']===_0x5df14a(0x12d)?null:{'unreadable':!![]};}}function _0x247c35(){const _0x22bb46=_0x67bbc4;try{const _0x39d8d0=_0x306083[_0x22bb46(0x14c)](_0x4cf671,'wx');try{_0x306083[_0x22bb46(0x170)](_0x39d8d0,_0x412547());}finally{_0x306083[_0x22bb46(0x14d)](_0x39d8d0);}return!![];}catch(_0x2f9936){if(_0x2f9936?.[_0x22bb46(0x15d)]===_0x22bb46(0x171))return![];throw _0x2f9936;}}function _0x1c46fb(_0x290091){const _0x56a481=_0x67bbc4;if(!_0x290091)return!![];if(_0x290091['unreadable'])return!![];return Date[_0x56a481(0x1a7)]()-(_0x290091['at']??0x0)>=maxAgeMs;}function _0x57f8b2(){if(_0x41c0b1)clearInterval(_0x41c0b1);_0x41c0b1=null;}function _0xe3643c(){_0x57f8b2(),_0x41c0b1=setInterval(()=>{const _0x5ab0c3=_0x5cec,_0x1d0a24=_0x3db1e7();if(_0x1d0a24&&!_0x1d0a24[_0x5ab0c3(0x175)]&&_0x1d0a24[_0x5ab0c3(0x17b)]!==_0x417cc3){_0x1f29d9=![],_0x57f8b2();try{onLost?.();}catch{}return;}try{_0x306083[_0x5ab0c3(0x170)](_0x4cf671,_0x412547());}catch{}},heartbeatMs),_0x41c0b1['unref']?.();}function _0x50201e(){const _0x4a9241=_0x67bbc4,_0x21ad0e=_0x3db1e7();return!!_0x21ad0e&&_0x21ad0e[_0x4a9241(0x17b)]===_0x417cc3;}return{'path':_0x4cf671,'token':_0x417cc3,'acquire'(){const _0x87b970=_0x67bbc4,_0x302fd2=_0x3db1e7();if(_0x302fd2&&_0x302fd2[_0x87b970(0x17b)]===_0x417cc3){_0x1f29d9=!![];if(!_0x41c0b1)_0xe3643c();return!![];}let _0x51cd52=_0x247c35();if(!_0x51cd52&&_0x1c46fb(_0x3db1e7())){try{_0x306083[_0x87b970(0x109)](_0x4cf671);}catch{}_0x51cd52=_0x247c35();}if(_0x51cd52&&!_0x50201e())_0x51cd52=![];_0x1f29d9=_0x51cd52;if(_0x51cd52)_0xe3643c();return _0x51cd52;},'held'(){return _0x1f29d9;},'isFree'(){const _0x5bc62b=_0x67bbc4,_0x1fc7d5=_0x3db1e7();if(_0x1fc7d5&&_0x1fc7d5[_0x5bc62b(0x17b)]===_0x417cc3)return![];return _0x1c46fb(_0x1fc7d5);},'release'(){const _0x30c656=_0x67bbc4;_0x57f8b2();if(!_0x1f29d9)return;_0x1f29d9=![];if(_0x50201e())try{_0x306083[_0x30c656(0x109)](_0x4cf671);}catch{}}};},writerLock;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x4a0661=require$$0,_0x24a054=requireSnapshotStore(),_0x46f7ad=requireLabelMap(),_0x317c98=requireWriterLock(),{fingerprint:_0x560b70,reconcileIndex:_0xe47db9}=requireIndexConvergence(),_0x59bf7a=0x1;let _0x2ea589=null;function _0x31f29b(){const _0x2b6e79=_0x5cec;if(_0x2ea589)return _0x2ea589;try{return _0x2ea589=require(_0x2b6e79(0x188)),_0x2ea589;}catch(_0x585a8f){const _0x24bbbc=new Error(_0x2b6e79(0x1a1)+(_0x2b6e79(0xe5)+process[_0x2b6e79(0x157)]['node']+_0x2b6e79(0xf1)+process['platform']+'/'+process[_0x2b6e79(0x165)]+'.\x20')+_0x2b6e79(0x180)+('Original\x20error:\x20'+(_0x585a8f?.[_0x2b6e79(0x1b0)]||String(_0x585a8f))));_0x24bbbc[_0x2b6e79(0x15d)]=_0x2b6e79(0x155),_0x24bbbc['cause']=_0x585a8f;throw _0x24bbbc;}}function _0x2e0375(_0x229e9c,_0x4892a5){const _0xba841b=_0x5cec;switch(_0x229e9c){case _0xba841b(0x1aa):return _0x4892a5[_0xba841b(0xdd)][_0xba841b(0x13e)];case'l2':return _0x4892a5[_0xba841b(0xdd)][_0xba841b(0x1a8)];case'ip':return _0x4892a5[_0xba841b(0xdd)]['IP'];default:return _0x4892a5[_0xba841b(0xdd)][_0xba841b(0x13e)];}}return usearch=function _0x4fda0d(_0x4e84b9={},{dims:_0x3d86ee,dir:_0x5cfc91,fetchAll:fetchAll=null,onChange:onChange=null}={}){const _0xa28850=_0x5cec,_0x40141c=_0x31f29b();if(!_0x3d86ee||_0x3d86ee<=0x0)throw new Error('usearch\x20algorithm\x20requires\x20dims\x20>\x200');if(!_0x5cfc91)throw new Error('usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage');const _0x1a8900={'metric':_0x4e84b9[_0xa28850(0x18e)]??_0xa28850(0x1aa),'connectivity':_0x4e84b9[_0xa28850(0x150)]??0x10,'expansionAdd':_0x4e84b9[_0xa28850(0x1a2)]??0x80,'expansionSearch':_0x4e84b9[_0xa28850(0x154)]??0x40,'snapshotEveryChanges':_0x4e84b9[_0xa28850(0x15a)]??0xc350,'snapshotMaxLagMs':_0x4e84b9[_0xa28850(0xe9)]??0x2710,'keepSnapshots':_0x4e84b9[_0xa28850(0x191)]??0x2,'tmpMaxAgeMs':_0x4e84b9['tmpMaxAgeMs']??0x6*0x36ee80,'heartbeatIntervalMs':_0x4e84b9[_0xa28850(0x18b)]??0x1388,'writerLockMaxAgeMs':_0x4e84b9[_0xa28850(0x17e)]??0x3a98,'viewRefreshMs':_0x4e84b9[_0xa28850(0x104)]??0x3e8},_0x5b5b68=new _0x24a054({'dir':_0x5cfc91,'keepSnapshots':_0x1a8900[_0xa28850(0x191)]}),_0x598b9b=_0x317c98(_0x5cfc91,{'maxAgeMs':_0x1a8900['writerLockMaxAgeMs'],'heartbeatMs':_0x1a8900[_0xa28850(0x18b)],'onLost':()=>{const _0x802c49=_0xa28850;_0xf8c467(_0x1fa892)[_0x802c49(0x13d)](()=>{});}});let _0x604812=new _0x46f7ad(),_0x3f5320=null,_0x5ae20d=0x0,_0x1571b4=null,_0x2e5538=![],_0x3cd4d1=![],_0x32e912=null,_0x4c441f=0x0,_0x5d83d4=null,_0x3e0501=0x0,_0x4a0f9c=![],_0x1fbc0c=Promise[_0xa28850(0x19b)]();const _0xf8c467=_0x33786e=>{const _0x411b3d=_0xa28850,_0x432a40=_0x1fbc0c[_0x411b3d(0xd9)](_0x33786e);return _0x1fbc0c=_0x432a40[_0x411b3d(0x13d)](()=>{}),_0x432a40;},_0x51b636=()=>{try{onChange?.();}catch{}};function _0x20ac8a(){const _0x33f54e=_0xa28850;return new _0x40141c['Index']({'dimensions':_0x3d86ee,'metric':_0x2e0375(_0x1a8900[_0x33f54e(0x18e)],_0x40141c),'quantization':_0x40141c['ScalarKind']['F32'],'connectivity':_0x1a8900[_0x33f54e(0x150)],'expansion_add':_0x1a8900['expansionAdd'],'expansion_search':_0x1a8900['expansionSearch'],'multi':![]});}function _0x2ca74a(_0x29f944){return _0x29f944 instanceof Float32Array?_0x29f944:new Float32Array(_0x29f944);}function _0x120c68(){const _0xab180d=_0xa28850;if(fetchAll)return fetchAll();if(_0x1571b4)return _0x1571b4();return Promise[_0xab180d(0x19b)](null);}function _0x1746df(_0x311ab3,_0x302ff2,_0x2cdc57){const _0x4ccf88=_0xa28850,_0x36d487=_0x604812[_0x4ccf88(0x18a)](_0x311ab3);if(_0x36d487!==undefined)try{_0x3f5320['remove'](BigInt(_0x36d487));}catch{}const _0x54f4b6=_0x604812[_0x4ccf88(0xee)](_0x311ab3);_0x3f5320['add'](BigInt(_0x54f4b6),_0x302ff2),_0x604812[_0x4ccf88(0x10b)](_0x311ab3,_0x2cdc57??_0x560b70(_0x302ff2));}function _0xa54ea6(_0x3c9b5f){const _0x305a61=_0xa28850,_0x383f99=_0x604812[_0x305a61(0x18a)](_0x3c9b5f);if(_0x383f99===undefined)return![];try{_0x3f5320[_0x305a61(0x19d)](BigInt(_0x383f99));}catch{}return _0x604812[_0x305a61(0x166)](_0x3c9b5f),!![];}function _0x302d15(_0x564237){const _0x47bbee=_0xa28850;_0x604812=new _0x46f7ad(),_0x3f5320=_0x20ac8a();for(const {key:_0x554872,vector:_0x4f92df}of _0x564237??[]){if(!(_0x4f92df instanceof Float32Array)||_0x4f92df[_0x47bbee(0x122)]!==_0x3d86ee)continue;_0x1746df(_0x554872,_0x4f92df);}_0x5ae20d=0x0;}function _0x42b4b2(){const _0x129a2d=_0xa28850;return Math['max'](Date[_0x129a2d(0x1a7)](),_0x5b5b68[_0x129a2d(0x103)]()+0x1);}function _0x26e279(){if(_0x32e912)clearTimeout(_0x32e912);_0x32e912=null;}function _0x368bdb(){const _0x11a3ec=_0xa28850;if(!_0x1a8900[_0x11a3ec(0xe9)]||_0x32e912||!_0x3cd4d1||_0x5ae20d<=0x0)return;const _0x22c306=Math[_0x11a3ec(0x16d)](_0x1a8900[_0x11a3ec(0xe9)],0xa*_0x4c441f);_0x32e912=setTimeout(()=>{const _0x42f1f4=_0x11a3ec;_0x32e912=null,_0xf8c467(async()=>{if(_0x3cd4d1&&_0x5ae20d>0x0)await _0x35412a();_0x368bdb(),_0x51b636();})[_0x42f1f4(0x13d)](()=>{});},_0x22c306),_0x32e912[_0x11a3ec(0x168)]?.();}async function _0x35412a(_0x11636b){const _0x1f21c1=_0xa28850;if(!_0x3f5320)return![];const _0x41dd29=_0x11636b??_0x42b4b2(),_0x180ca7=Date[_0x1f21c1(0x1a7)](),_0x386302=await _0x5b5b68[_0x1f21c1(0x113)](_0x41dd29,async _0xf7555a=>{const _0x24ef0e=_0x1f21c1;_0x3f5320[_0x24ef0e(0x13c)](_0xf7555a['index']),await _0x604812[_0x24ef0e(0x172)](_0xf7555a['labels']),_0x4a0661[_0x24ef0e(0x170)](_0xf7555a['state'],JSON[_0x24ef0e(0x159)]({'manifestVersion':_0x59bf7a,'algorithm':_0x24ef0e(0x188),'dims':_0x3d86ee,'metric':_0x1a8900[_0x24ef0e(0x18e)],'clock':_0x41dd29,'snapshotAt':Date[_0x24ef0e(0x1a7)]()},null,0x2));},{'keep':_0x1a8900[_0x1f21c1(0x191)]});return _0x4c441f=Date[_0x1f21c1(0x1a7)]()-_0x180ca7,_0x386302?.[_0x1f21c1(0x14b)]&&(_0x5ae20d=0x0,_0x26e279()),_0x386302?.[_0x1f21c1(0x14b)]??![];}function _0x31f4f6(){const _0x45783a=_0xa28850;_0x5ae20d++;if(_0x5ae20d>=_0x1a8900[_0x45783a(0x15a)])return _0x35412a();return _0x368bdb(),null;}async function _0x428e8e(){const _0x4fbddc=_0xa28850,_0x32f7ca=_0x5b5b68[_0x4fbddc(0x1ac)]()||_0x5b5b68[_0x4fbddc(0x11e)]();if(!_0x32f7ca)return null;let _0x48ab2e,_0x411d42=![];try{await _0x5b5b68[_0x4fbddc(0x198)](_0x32f7ca,async _0x24d4d5=>{const _0x556df6=_0x4fbddc;_0x48ab2e=JSON[_0x556df6(0x10e)](_0x4a0661[_0x556df6(0x1ab)](_0x24d4d5[_0x556df6(0x160)],_0x556df6(0x124)));if(_0x48ab2e[_0x556df6(0x192)]!==_0x59bf7a||_0x48ab2e[_0x556df6(0x13a)]!==_0x556df6(0x188)||_0x48ab2e[_0x556df6(0x100)]!==_0x3d86ee||_0x48ab2e[_0x556df6(0x18e)]!==_0x1a8900[_0x556df6(0x18e)]){_0x48ab2e=null;return;}const _0x3cfd9c=new _0x46f7ad();await _0x3cfd9c[_0x556df6(0x162)](_0x24d4d5[_0x556df6(0x138)]);const _0x3d6388=_0x20ac8a();_0x3d6388[_0x556df6(0x133)](_0x24d4d5[_0x556df6(0x1a9)]),_0x604812=_0x3cfd9c,_0x3f5320=_0x3d6388,_0x411d42=!![];});}catch{return null;}return _0x411d42?_0x48ab2e?.['clock']??0x0:null;}async function _0x1d5b44(_0x1cca17){const _0x2b3901=_0xa28850;_0x5d83d4=null;const _0x3b61bd=await _0x428e8e();if(_0x3b61bd!=null){_0x5ae20d=0x0;if(_0x1cca17){if(!_0x604812[_0x2b3901(0x129)])return _0x302d15(_0x1cca17),await _0x35412a(),null;const _0x27a3b2=_0xe47db9(_0x604812,_0x1cca17,_0x3d86ee,{'upsert':_0x1746df,'remove':_0xa54ea6}),_0x12239a=_0x27a3b2[_0x2b3901(0xe7)]+_0x27a3b2['changed']+_0x27a3b2[_0x2b3901(0x197)];_0x12239a>0x0&&(_0x5ae20d+=_0x12239a,await _0x35412a());}return _0x3b61bd;}_0x302d15(_0x1cca17??[]);if(_0x3f5320[_0x2b3901(0x134)]()>0x0)await _0x35412a();return null;}async function _0x526b41(){_0x3cd4d1=!![],await _0x1d5b44(await _0x120c68());}async function _0x1fa892(){const _0x254fcb=_0xa28850;if(!_0x3cd4d1)return;_0x3cd4d1=![],_0x26e279(),_0x5ae20d=0x0;const _0x5c896d=_0x5b5b68[_0x254fcb(0x1ac)]()||_0x5b5b68['latestSnapshotId']();await _0x265473(_0x5c896d),_0x51b636();}async function _0x265473(_0x1e1275){const _0x3cb769=_0xa28850;if(!_0x1e1275)return![];let _0x57dfed=![];try{await _0x5b5b68[_0x3cb769(0x198)](_0x1e1275,async _0x160070=>{const _0x2b89cf=_0x3cb769,_0x625c06=JSON[_0x2b89cf(0x10e)](_0x4a0661[_0x2b89cf(0x1ab)](_0x160070[_0x2b89cf(0x160)],_0x2b89cf(0x124)));if(_0x625c06[_0x2b89cf(0x192)]!==_0x59bf7a||_0x625c06['algorithm']!==_0x2b89cf(0x188)||_0x625c06[_0x2b89cf(0x100)]!==_0x3d86ee||_0x625c06[_0x2b89cf(0x18e)]!==_0x1a8900[_0x2b89cf(0x18e)])return;const _0x486577=new _0x46f7ad();await _0x486577[_0x2b89cf(0x162)](_0x160070[_0x2b89cf(0x138)]);const _0x44529d=_0x20ac8a();_0x44529d[_0x2b89cf(0x1a4)](_0x160070['index']),_0x3f5320=_0x44529d,_0x604812=_0x486577,_0x5d83d4=_0x1e1275,_0x57dfed=!![];});}catch{}return _0x57dfed;}function _0x13e292(){const _0x31b134=_0xa28850,_0x1014cc=Date['now']();if(_0x1014cc-_0x3e0501<_0x1a8900[_0x31b134(0x104)])return;_0x3e0501=_0x1014cc;if(_0x4a0f9c)return;if(_0x598b9b[_0x31b134(0xfb)]()){_0x4a0f9c=!![],_0xf8c467(async()=>{const _0x928aef=_0x31b134;!_0x3cd4d1&&_0x2e5538&&_0x598b9b[_0x928aef(0xfe)]()&&(await _0x526b41(),_0x51b636());})[_0x31b134(0x13d)](()=>{})[_0x31b134(0x177)](()=>{_0x4a0f9c=![];});return;}const _0x163385=_0x5b5b68[_0x31b134(0x1ac)]()||_0x5b5b68[_0x31b134(0x11e)]();if(!_0x163385||_0x163385===_0x5d83d4)return;_0x4a0f9c=!![],_0xf8c467(async()=>{if(!_0x3cd4d1&&await _0x265473(_0x163385))_0x51b636();})[_0x31b134(0x13d)](()=>{})[_0x31b134(0x177)](()=>{_0x4a0f9c=![];});}return{async 'load'(_0x4e4452){return _0xf8c467(async()=>{const _0x3e535c=_0x5cec;_0x5b5b68[_0x3e535c(0xde)]({'maxAgeMs':_0x1a8900['tmpMaxAgeMs']}),_0x1571b4=_0x4e4452??null,_0x3cd4d1=_0x598b9b[_0x3e535c(0xfe)]();let _0x1390e0=null;if(_0x3cd4d1)_0x1390e0=await _0x1d5b44(_0x4e4452?await _0x4e4452():null);else{const _0x261e9d=_0x5b5b68[_0x3e535c(0x1ac)]()||_0x5b5b68[_0x3e535c(0x11e)]();await _0x265473(_0x261e9d);}return _0x2e5538=!![],_0x1390e0;});},async 'add'(_0x248805,_0x27bd19,_0x734889){return _0xf8c467(async()=>{const _0x539ebe=_0x5cec;if(!_0x2e5538)return;const _0xfa15b8=_0x2ca74a(_0x27bd19);if(!_0x3cd4d1){if(!_0x598b9b['acquire']())return;await _0x526b41();}if(!_0x3f5320)return;const _0x1a3958=_0x560b70(_0xfa15b8);if(_0x604812[_0x539ebe(0xec)](_0x248805)===_0x1a3958)return;_0x1746df(_0x248805,_0xfa15b8,_0x1a3958),await _0x31f4f6();});},async 'remove'(_0x27291d){return _0xf8c467(async()=>{const _0x27699c=_0x5cec;if(!_0x2e5538)return;if(!_0x3cd4d1){if(!_0x598b9b[_0x27699c(0xfe)]())return;await _0x526b41();}if(!_0x3f5320)return;if(_0xa54ea6(_0x27291d))await _0x31f4f6();});},'search'(_0x313289,{limit:limit=0xa}={}){const _0x4ba166=_0xa28850;if(!_0x3cd4d1&&_0x2e5538)_0x13e292();if(!_0x3f5320)return[];const _0x1bdfdc=_0x3f5320[_0x4ba166(0x134)]();if(_0x1bdfdc===0x0)return[];const _0x120a26=Math[_0x4ba166(0x15f)](limit,_0x1bdfdc),_0x528955=_0x3f5320['search'](_0x2ca74a(_0x313289),_0x120a26,0x0),_0x1f20cd=[],_0x100ba4=_0x528955[_0x4ba166(0x15e)],_0x375b90=_0x528955[_0x4ba166(0x14f)];for(let _0x4f49a4=0x0;_0x4f49a4<_0x100ba4[_0x4ba166(0x122)];_0x4f49a4++){const _0x257124=_0x100ba4[_0x4f49a4];if(_0x257124===0xffffffffffffffffn)continue;const _0x1d7459=Number(_0x257124),_0x52cace=_0x604812['keyForLabel'](_0x1d7459);if(!_0x52cace)continue;const _0x92b434=_0x375b90[_0x4f49a4];let _0x406220;if(_0x1a8900[_0x4ba166(0x18e)]===_0x4ba166(0x1aa))_0x406220=Math['max'](0x0,0x1-_0x92b434);else{if(_0x1a8900['metric']==='ip')_0x406220=-_0x92b434;else _0x406220=0x1/(0x1+_0x92b434);}_0x1f20cd['push']({'key':_0x52cace,'score':_0x406220});}return _0x1f20cd;},async 'snapshot'(_0x1b811b){return _0xf8c467(()=>_0x3cd4d1?_0x35412a(_0x1b811b??undefined):![]);},async 'rebuild'(_0x1bf5f1){return _0xf8c467(async()=>{if(_0x1bf5f1!=null)_0x1571b4=_0x1bf5f1;if(!_0x3cd4d1){if(!_0x598b9b['acquire']())return;_0x3cd4d1=!![];}const _0x5413b4=_0x1bf5f1?await _0x1bf5f1():await _0x120c68();_0x302d15(_0x5413b4??[]),_0x2e5538=!![],await _0x35412a();});},async 'stop'(){return _0xf8c467(async()=>{const _0x41b05a=_0x5cec;_0x26e279();if(_0x3cd4d1){if(_0x5ae20d>0x0||!_0x5b5b68[_0x41b05a(0x1ac)]())await _0x35412a();_0x598b9b[_0x41b05a(0xdf)]();}_0x3cd4d1=![],_0x2e5538=![];});},'count'(){const _0x536c43=_0xa28850;return _0x604812[_0x536c43(0x134)]();},'info'(){const _0x1aeec0=_0xa28850;return{'algorithm':'usearch','role':_0x3cd4d1?_0x1aeec0(0x164):'reader','metric':_0x1a8900[_0x1aeec0(0x18e)],'connectivity':_0x1a8900[_0x1aeec0(0x150)],'expansionAdd':_0x1a8900[_0x1aeec0(0x1a2)],'expansionSearch':_0x1a8900[_0x1aeec0(0x154)],'snapshotEveryChanges':_0x1a8900['snapshotEveryChanges'],'snapshotMaxLagMs':_0x1a8900['snapshotMaxLagMs'],'count':_0x604812[_0x1aeec0(0x134)](),'size':_0x3f5320?.[_0x1aeec0(0x134)]?.()??0x0,'capacity':_0x3f5320?.[_0x1aeec0(0x147)]?.()??0x0,'changesSince':_0x3cd4d1?_0x5ae20d:null,'viewedSnapshot':_0x5d83d4??null,'snapshotDir':_0x5cfc91,'latestSnapshot':_0x5b5b68['readCurrentId']()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0xfe497b=_0x11b94d;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x186f6f,workerData:_0x45668b}=require$$0$1,{algorithmName:_0x4990cb,algorithmConfig:_0x44bc4f,dims:_0x202025,dir:_0x4e13eb}=_0x45668b;let _0x3adb4c=0x1;const _0x132168=new Map();function _0x1e7638(){const _0x514636=_0x3adb4c++;return new Promise((_0x41c953,_0xf7773b)=>{const _0x5546e6=_0x5cec;_0x132168[_0x5546e6(0x128)](_0x514636,{'resolve':_0x41c953,'reject':_0xf7773b}),_0x186f6f['postMessage']({'op':_0x5546e6(0x105),'fid':_0x514636});});}const _0x1198d7={'dims':_0x202025,'dir':_0x4e13eb,'fetchAll':_0x1e7638,'onChange':()=>_0x2a3ceb()};let _0x473592;if(_0x4990cb===_0xfe497b(0x140))_0x473592=requireHnsw()(_0x44bc4f,_0x1198d7);else{if(_0x4990cb===_0xfe497b(0xff))_0x473592=requireFlat()(_0x44bc4f,_0x1198d7);else{if(_0x4990cb===_0xfe497b(0x188))_0x473592=requireUsearch()(_0x44bc4f,_0x1198d7);else throw new Error('Unknown\x20algorithm:\x20\x22'+_0x4990cb+'\x22');}}function _0x2a3ceb(){const _0x401a33=_0xfe497b;try{_0x186f6f[_0x401a33(0xe4)]({'op':_0x401a33(0x16b),'count':_0x473592[_0x401a33(0x11d)](),'info':_0x473592[_0x401a33(0x18c)](),'memory':process[_0x401a33(0x110)]()});}catch{}}function _0x5f4cc8(_0x463d8c){const _0x38355b=_0xfe497b;return(_0x463d8c||[])['map'](_0x512e96=>({'key':_0x512e96['key'],'vector':_0x512e96['vector']instanceof Float32Array?_0x512e96[_0x38355b(0x152)]:new Float32Array(_0x512e96['vector'])}));}return _0x186f6f['on'](_0xfe497b(0x1b0),async _0x148785=>{const _0x332585=_0xfe497b;if(_0x148785['op']===_0x332585(0x1a3)){const _0x240b4f=_0x132168[_0x332585(0x16e)](_0x148785['fid']);if(!_0x240b4f)return;_0x132168['delete'](_0x148785[_0x332585(0xe2)]);if(_0x148785['error'])_0x240b4f[_0x332585(0x115)](new Error(_0x148785[_0x332585(0xf4)]));else _0x240b4f[_0x332585(0x19b)](_0x5f4cc8(_0x148785[_0x332585(0xe6)]));return;}const {id:_0x327322,op:_0x2a7d43,args:_0x2580dd}=_0x148785;try{let _0x107d8e;switch(_0x2a7d43){case _0x332585(0x133):{_0x107d8e=await _0x473592[_0x332585(0x133)](_0x2580dd[_0x332585(0x125)]?_0x1e7638:null),_0x2a3ceb();break;}case _0x332585(0xf6):{const _0x2f75df=_0x2580dd['vector']instanceof Float32Array?_0x2580dd[_0x332585(0x152)]:new Float32Array(_0x2580dd[_0x332585(0x152)]);await _0x473592[_0x332585(0xf6)](_0x2580dd[_0x332585(0x18d)],_0x2f75df,_0x2580dd['clock']??undefined),_0x2a3ceb(),_0x107d8e=null;break;}case _0x332585(0x19d):{await _0x473592[_0x332585(0x19d)](_0x2580dd[_0x332585(0x18d)]),_0x2a3ceb(),_0x107d8e=null;break;}case _0x332585(0x11f):{const _0x47884d=_0x2580dd[_0x332585(0x121)]instanceof Float32Array?_0x2580dd[_0x332585(0x121)]:new Float32Array(_0x2580dd[_0x332585(0x121)]);_0x107d8e=_0x473592[_0x332585(0x11f)](_0x47884d,_0x2580dd[_0x332585(0x17a)]||{});break;}case _0x332585(0x156):{_0x107d8e=await _0x473592[_0x332585(0x156)](_0x2580dd[_0x332585(0x1a0)]),_0x2a3ceb();break;}case _0x332585(0xf3):{const _0x1d8a57=_0x5f4cc8(_0x2580dd[_0x332585(0xe6)]);await _0x473592[_0x332585(0xf3)](async()=>_0x1d8a57),_0x2a3ceb(),_0x107d8e=null;break;}case'stop':{await _0x473592[_0x332585(0x17f)](),_0x2a3ceb(),_0x107d8e=null;break;}case _0x332585(0x11d):{_0x107d8e=_0x473592[_0x332585(0x11d)]();break;}case _0x332585(0x18c):{_0x107d8e=_0x473592[_0x332585(0x18c)]();break;}default:throw new Error(_0x332585(0x142)+_0x2a7d43+'\x22');}_0x186f6f[_0x332585(0xe4)]({'id':_0x327322,'result':_0x107d8e});}catch(_0x29b60d){_0x186f6f['postMessage']({'id':_0x327322,'error':{'message':_0x29b60d?.[_0x332585(0x1b0)]||String(_0x29b60d),'code':_0x29b60d?.[_0x332585(0x15d)]}});}}),_0x186f6f['postMessage']({'op':_0xfe497b(0x106)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module[_0x11b94d(0x19a)]=algorithmWorkerThread;
|
|
1
|
+
'use strict';const _0x5db5a4=_0x5717;(function(_0x49f6a0,_0x36351a){const _0x1cb2db=_0x5717,_0x1d6dd8=_0x49f6a0();while(!![]){try{const _0xbd9563=parseInt(_0x1cb2db(0x1a4))/0x1+-parseInt(_0x1cb2db(0x177))/0x2+-parseInt(_0x1cb2db(0x1c6))/0x3*(parseInt(_0x1cb2db(0x1a6))/0x4)+-parseInt(_0x1cb2db(0x210))/0x5*(-parseInt(_0x1cb2db(0x23f))/0x6)+parseInt(_0x1cb2db(0x17b))/0x7+parseInt(_0x1cb2db(0x234))/0x8*(-parseInt(_0x1cb2db(0x185))/0x9)+parseInt(_0x1cb2db(0x1d6))/0xa*(parseInt(_0x1cb2db(0x220))/0xb);if(_0xbd9563===_0x36351a)break;else _0x1d6dd8['push'](_0x1d6dd8['shift']());}catch(_0x229aac){_0x1d6dd8['push'](_0x1d6dd8['shift']());}}}(_0x1f5b,0xc1584));var require$$0$1=require('worker_threads'),require$$0=require('fs'),require$$1=require('path'),require$$2=require('os'),require$$3=require('crypto');function getDefaultExportFromCjs(_0x2111df){const _0x5f33d9=_0x5717;return _0x2111df&&_0x2111df[_0x5f33d9(0x239)]&&Object[_0x5f33d9(0x1e9)][_0x5f33d9(0x1ca)][_0x5f33d9(0x1aa)](_0x2111df,_0x5f33d9(0x1ef))?_0x2111df[_0x5f33d9(0x1ef)]:_0x2111df;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x1be4a1=_0x5717;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x233d7b=require$$0,_0x2d237f=require$$1,_0x3df377=require$$2,_0x456141=require$$3;function _0x5e2463(){const _0x3be10d=_0x5717;return Date[_0x3be10d(0x17a)]();}function _0x282af4(_0x418ba7){try{return _0x233d7b['existsSync'](_0x418ba7);}catch{return![];}}function _0x35d8a8(_0x29ca7c){const _0xbc3129=_0x5717;try{return _0x233d7b[_0xbc3129(0x1d1)](_0x29ca7c,'utf8');}catch{return null;}}function _0x5f1875(_0x5e4ca2,_0x28a3c6){const _0x1660da=_0x5717,_0x5d6768=_0x5e4ca2+_0x1660da(0x1f7)+_0x456141['randomBytes'](0x6)[_0x1660da(0x172)](_0x1660da(0x1e8));_0x233d7b[_0x1660da(0x238)](_0x5d6768,_0x28a3c6),_0x233d7b['renameSync'](_0x5d6768,_0x5e4ca2);}function _0x5a5b03(_0x17a989,_0x4b9eb3=0x10){const _0x538764=_0x5717,_0x1a3898=String(Math['max'](0x0,Math['trunc'](_0x17a989||0x0)));return _0x1a3898[_0x538764(0x232)]>=_0x4b9eb3?_0x1a3898:'0'[_0x538764(0x1dd)](_0x4b9eb3-_0x1a3898[_0x538764(0x232)])+_0x1a3898;}return snapshotStore=class _0x302020{constructor({dir:_0xf78024,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x1701fa=_0x5717;if(!_0xf78024)throw new Error('SnapshotStore\x20requires\x20dir');this[_0x1701fa(0x1e3)]=_0xf78024,this[_0x1701fa(0x18e)]=_0x2d237f[_0x1701fa(0x20e)](_0xf78024,_0x1701fa(0x1b3)),this['currentPath']=_0x2d237f[_0x1701fa(0x20e)](_0xf78024,_0x1701fa(0x1c2)),this['lockPath']=_0x2d237f['join'](_0xf78024,_0x1701fa(0x206)),this[_0x1701fa(0x181)]=keepSnapshots,this['log']=log,_0x233d7b[_0x1701fa(0x235)](this[_0x1701fa(0x1e3)],{'recursive':!![]}),_0x233d7b[_0x1701fa(0x235)](this[_0x1701fa(0x18e)],{'recursive':!![]});}[_0x1be4a1(0x1a3)](_0x1525c8){const _0x785d2c=_0x1be4a1;return _0x2d237f[_0x785d2c(0x20e)](this['snapshotsDir'],_0x1525c8);}[_0x1be4a1(0x228)](_0x355e49){const _0x209e3d=_0x1be4a1,_0x41d78e=this[_0x209e3d(0x1a3)](_0x355e49);return{'dir':_0x41d78e,'index':_0x2d237f[_0x209e3d(0x20e)](_0x41d78e,_0x209e3d(0x1fe)),'labels':_0x2d237f['join'](_0x41d78e,_0x209e3d(0x1a1)),'state':_0x2d237f[_0x209e3d(0x20e)](_0x41d78e,_0x209e3d(0x1dc))};}[_0x1be4a1(0x1b6)](){const _0x15104f=_0x1be4a1;if(!_0x282af4(this['currentPath']))return null;const _0x2e05ef=_0x35d8a8(this['currentPath']);if(!_0x2e05ef)return null;const _0x66ec79=String(_0x2e05ef)[_0x15104f(0x213)]();return _0x66ec79||null;}[_0x1be4a1(0x217)](){const _0x1d0b6f=_0x1be4a1,_0x1ad11c=this['readCurrentId']();if(!_0x1ad11c)return 0x0;const _0x52ca1c=Number(_0x1ad11c);return Number[_0x1d0b6f(0x191)](_0x52ca1c)?_0x52ca1c:0x0;}[_0x1be4a1(0x1f3)](){const _0x4adf9e=_0x1be4a1;try{return _0x233d7b[_0x4adf9e(0x189)](this[_0x4adf9e(0x18e)],{'withFileTypes':!![]})[_0x4adf9e(0x230)](_0x5c5043=>_0x5c5043['isDirectory']())[_0x4adf9e(0x21d)](_0x391ada=>_0x391ada[_0x4adf9e(0x22c)])[_0x4adf9e(0x230)](_0x6c05c5=>!_0x6c05c5[_0x4adf9e(0x1d7)](_0x4adf9e(0x1f7)))[_0x4adf9e(0x230)](_0x4bedd3=>!_0x4bedd3[_0x4adf9e(0x1d7)]('_tmp-'))[_0x4adf9e(0x187)]();}catch{return[];}}[_0x1be4a1(0x1cc)](){const _0x2eee4f=_0x1be4a1,_0x2dd1ee=this[_0x2eee4f(0x1b6)]();if(_0x2dd1ee)return _0x2dd1ee;const _0x42e9f2=this['listSnapshotIds']();if(!_0x42e9f2['length'])return null;return _0x42e9f2[_0x42e9f2[_0x2eee4f(0x232)]-0x1];}[_0x1be4a1(0x1d3)]({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x2032e7=_0x1be4a1;let _0xef8288;try{_0xef8288=_0x233d7b['readdirSync'](this[_0x2032e7(0x18e)],{'withFileTypes':!![]});}catch{return;}const _0xd978c9=_0x5e2463()-maxAgeMs;for(const _0x8bf312 of _0xef8288){if(!_0x8bf312[_0x2032e7(0x1d5)]())continue;const _0xa91635=_0x8bf312[_0x2032e7(0x22c)];if(!_0xa91635[_0x2032e7(0x1d7)](_0x2032e7(0x1f7))&&!_0xa91635[_0x2032e7(0x1d7)]('_tmp-'))continue;const _0x4256de=_0x2d237f[_0x2032e7(0x20e)](this['snapshotsDir'],_0xa91635);try{const _0x53c15e=_0x233d7b[_0x2032e7(0x199)](_0x4256de);if(_0x53c15e[_0x2032e7(0x168)]>_0xd978c9)continue;}catch{}try{_0x233d7b[_0x2032e7(0x21e)](_0x4256de,{'recursive':!![],'force':!![]});}catch{}}}['prune']({keep:keep=null}={}){const _0x526af6=_0x1be4a1,_0x2d7531=Math[_0x526af6(0x222)](0x1,Math['trunc'](keep??this[_0x526af6(0x181)]??0x3)),_0x4c0220=this[_0x526af6(0x1f3)]();if(_0x4c0220[_0x526af6(0x232)]<=_0x2d7531)return;const _0x5ba917=this[_0x526af6(0x1b6)](),_0x5f333f=_0x4c0220['slice'](0x0,Math[_0x526af6(0x222)](0x0,_0x4c0220['length']-_0x2d7531));for(const _0x75b436 of _0x5f333f){if(_0x5ba917&&_0x75b436===_0x5ba917)continue;const _0x3005f6=this[_0x526af6(0x1a3)](_0x75b436);try{_0x233d7b[_0x526af6(0x21e)](_0x3005f6,{'recursive':!![],'force':!![]});}catch{}}}async[_0x1be4a1(0x1e0)](_0x4baf78,_0x41c839){const _0x51d009=_0x1be4a1;if(!_0x4baf78)throw new Error(_0x51d009(0x1ee));const _0x1ca371=this['_snapshotPaths'](_0x4baf78);if(!_0x282af4(_0x1ca371[_0x51d009(0x221)])||!_0x282af4(_0x1ca371[_0x51d009(0x227)])||!_0x282af4(_0x1ca371['state']))throw new Error('snapshot\x20incomplete:\x20'+_0x4baf78);const _0x18d24f=await _0x41c839(_0x1ca371);return _0x18d24f||{};}async[_0x1be4a1(0x17e)](_0x3e7fd4,_0x4f3043,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x9eb37f=_0x1be4a1,_0x367f0e=Number(_0x3e7fd4);if(!Number[_0x9eb37f(0x191)](_0x367f0e)||_0x367f0e<0x0)throw new Error('candidateClock\x20must\x20be\x20finite\x20>=\x200');const _0x1561e4=_0x5a5b03(_0x367f0e),_0x106d8f=this[_0x9eb37f(0x1a3)](_0x1561e4),_0x3dda6a=_0x2d237f[_0x9eb37f(0x20e)](this[_0x9eb37f(0x18e)],'.tmp-'+_0x1561e4+'-'+_0x456141[_0x9eb37f(0x1eb)](0x6)[_0x9eb37f(0x172)](_0x9eb37f(0x1e8)));_0x233d7b[_0x9eb37f(0x235)](_0x3dda6a,{'recursive':!![]});const _0x3067f9={'dir':_0x3dda6a,'index':_0x2d237f['join'](_0x3dda6a,_0x9eb37f(0x1fe)),'labels':_0x2d237f[_0x9eb37f(0x20e)](_0x3dda6a,'labels.json'),'state':_0x2d237f[_0x9eb37f(0x20e)](_0x3dda6a,_0x9eb37f(0x1dc))};await _0x4f3043(_0x3067f9,{'id':_0x1561e4,'clock':_0x367f0e});const _0x37970e=JSON[_0x9eb37f(0x200)]({'pid':process[_0x9eb37f(0x197)],'host':_0x3df377[_0x9eb37f(0x1ed)](),'at':_0x5e2463()}),_0x3e22f5=_0x5e2463();let _0x38a26a=null;const _0x259d66=()=>{const _0x229db9=_0x9eb37f;try{const _0x557d78=JSON['parse'](_0x233d7b[_0x229db9(0x1d1)](this[_0x229db9(0x1c1)],_0x229db9(0x17f)));if(_0x557d78['at']&&_0x5e2463()-_0x557d78['at']>staleLockMaxAgeMs){const _0x5f4410=_0x5e2463()-_0x557d78['at'],_0x315c95=_0x229db9(0x20f)+Math[_0x229db9(0x196)](_0x5f4410/0x3e8)+_0x229db9(0x1f1)+_0x557d78[_0x229db9(0x197)]+',\x20host:\x20'+_0x557d78[_0x229db9(0x1de)]+_0x229db9(0x1be)+_0x229db9(0x1ec);this['log']?.[_0x229db9(0x1b2)]?this[_0x229db9(0x16f)]['warn'](_0x315c95):console['warn'](_0x229db9(0x1f5),_0x315c95);try{_0x233d7b[_0x229db9(0x1e2)](this['lockPath']);}catch{}return!![];}}catch{try{_0x233d7b[_0x229db9(0x1e2)](this[_0x229db9(0x1c1)]);}catch{}}return![];},_0x1df8af=()=>{const _0xb922d1=_0x9eb37f;try{return _0x38a26a=_0x233d7b[_0xb922d1(0x1d2)](this[_0xb922d1(0x1c1)],'wx'),_0x233d7b[_0xb922d1(0x238)](_0x38a26a,_0x37970e),!![];}catch(_0xa01e50){if(_0xa01e50&&_0xa01e50[_0xb922d1(0x1a0)]===_0xb922d1(0x1a7))return![];throw _0xa01e50;}};if(!_0x1df8af()){_0x259d66(),_0x1df8af();if(_0x38a26a==null&&lockTimeoutMs>0x0)while(_0x5e2463()-_0x3e22f5<lockTimeoutMs){await new Promise(_0xc4c388=>setTimeout(_0xc4c388,0x19));if(_0x1df8af())break;_0x259d66();}}if(_0x38a26a==null){try{_0x233d7b[_0x9eb37f(0x21e)](_0x3dda6a,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':'lock_busy'};}try{const _0x18b2f2=this['readCurrentClock']();if(_0x367f0e<=_0x18b2f2){try{_0x233d7b['rmSync'](_0x3dda6a,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x9eb37f(0x1bc),'currentClock':_0x18b2f2};}if(!_0x282af4(_0x106d8f))_0x233d7b[_0x9eb37f(0x1e1)](_0x3dda6a,_0x106d8f);else try{_0x233d7b['rmSync'](_0x3dda6a,{'recursive':!![],'force':!![]});}catch{}return _0x5f1875(this[_0x9eb37f(0x186)],_0x1561e4+'\x0a'),this[_0x9eb37f(0x202)]({'keep':keep}),{'published':!![],'currentClock':_0x367f0e};}finally{try{_0x233d7b[_0x9eb37f(0x1ac)](_0x38a26a);}catch{}try{_0x233d7b[_0x9eb37f(0x1e2)](this[_0x9eb37f(0x1c1)]);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x1bb8a6=_0x5717;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x5e7a7e=require$$0;class _0x3d9ac4{constructor(){const _0x1c79e2=_0x5717;this[_0x1c79e2(0x21c)]=new Map(),this['labelToKey']=new Map(),this[_0x1c79e2(0x1c9)]=0x0,this['_tombstoneCount']=0x0,this['keyToFp']=new Map(),this[_0x1c79e2(0x1d4)]=!![];}async[_0x1bb8a6(0x1f0)](){const _0x2a9566=_0x1bb8a6;this['keyToLabel']=new Map(),this['labelToKey']=new Map(),this[_0x2a9566(0x1e5)]=new Map(),this['hasFingerprints']=!![],this[_0x2a9566(0x1c9)]=0x0,this[_0x2a9566(0x1a5)]=0x0;}async[_0x1bb8a6(0x1a2)](_0x3fce6a){const _0x65a7f5=_0x1bb8a6;if(!_0x3fce6a||!_0x5e7a7e[_0x65a7f5(0x1fc)](_0x3fce6a))return await this[_0x65a7f5(0x1f0)](),!![];let _0x409df4;try{_0x409df4=_0x5e7a7e[_0x65a7f5(0x1d1)](_0x3fce6a,'utf8');}catch{return await this[_0x65a7f5(0x1f0)](),!![];}let _0x32cf8a;try{_0x32cf8a=JSON['parse'](_0x409df4);}catch{return await this[_0x65a7f5(0x1f0)](),!![];}const _0x5a32de=Array[_0x65a7f5(0x1b8)](_0x32cf8a?.[_0x65a7f5(0x22b)])?_0x32cf8a[_0x65a7f5(0x22b)]:[],_0x40a813=Number['isInteger'](_0x32cf8a?.[_0x65a7f5(0x1c9)])?_0x32cf8a[_0x65a7f5(0x1c9)]:0x0,_0x32e989=new Map(),_0x524024=new Map(),_0x4f896b=new Map(),_0x27924c=_0x32cf8a?.['version']>=0x2;let _0xad997d=-0x1;for(const _0x552c50 of _0x5a32de){if(!Array['isArray'](_0x552c50)||_0x552c50[_0x65a7f5(0x232)]<0x2)continue;const _0xfc995e=Number(_0x552c50[0x0]),_0x5a62ee=String(_0x552c50[0x1]??'');if(!Number[_0x65a7f5(0x192)](_0xfc995e)||_0xfc995e<0x0)continue;if(!_0x5a62ee)continue;_0x32e989[_0x65a7f5(0x225)](_0x5a62ee,_0xfc995e),_0x524024[_0x65a7f5(0x225)](_0xfc995e,_0x5a62ee);if(_0x27924c&&typeof _0x552c50[0x2]==='number')_0x4f896b[_0x65a7f5(0x225)](_0x5a62ee,_0x552c50[0x2]);if(_0xfc995e>_0xad997d)_0xad997d=_0xfc995e;}return this['keyToLabel']=_0x32e989,this[_0x65a7f5(0x20d)]=_0x524024,this['keyToFp']=_0x4f896b,this[_0x65a7f5(0x1d4)]=_0x27924c,this[_0x65a7f5(0x1c9)]=Math[_0x65a7f5(0x222)](_0x40a813,_0xad997d+0x1,0x0),this[_0x65a7f5(0x1a5)]=0x0,!![];}[_0x1bb8a6(0x188)](_0x243c7b){const _0x4e4a7a=_0x1bb8a6;return this['keyToLabel'][_0x4e4a7a(0x23e)](_0x243c7b);}['labelForEphemeral'](_0x2305dd){const _0x59b37b=_0x1bb8a6;let _0xada9cb=this[_0x59b37b(0x21c)][_0x59b37b(0x23e)](_0x2305dd);if(_0xada9cb!==undefined)return _0xada9cb;return _0xada9cb=this[_0x59b37b(0x1c9)]++,this[_0x59b37b(0x21c)][_0x59b37b(0x225)](_0x2305dd,_0xada9cb),this[_0x59b37b(0x20d)]['set'](_0xada9cb,_0x2305dd),_0xada9cb;}['setFingerprint'](_0x28ec0a,_0x13fa59){const _0x273a7e=_0x1bb8a6;if(_0x13fa59==null)this['keyToFp'][_0x273a7e(0x175)](_0x28ec0a);else this[_0x273a7e(0x1e5)][_0x273a7e(0x225)](_0x28ec0a,_0x13fa59);}[_0x1bb8a6(0x1a9)](_0xae167){const _0x656a37=_0x1bb8a6;return this[_0x656a37(0x1e5)]['get'](_0xae167);}[_0x1bb8a6(0x195)](){const _0x4043f4=_0x1bb8a6;return this[_0x4043f4(0x21c)]['keys']();}[_0x1bb8a6(0x17c)](_0x4cde0f){const _0x34fb67=_0x1bb8a6,_0x22c30b=this[_0x34fb67(0x21c)][_0x34fb67(0x23e)](_0x4cde0f);if(_0x22c30b===undefined)return;this[_0x34fb67(0x1e5)]['delete'](_0x4cde0f),this[_0x34fb67(0x21c)][_0x34fb67(0x175)](_0x4cde0f),this[_0x34fb67(0x20d)][_0x34fb67(0x175)](_0x22c30b),this['_tombstoneCount']++;}[_0x1bb8a6(0x1fd)](_0x386e74){return this['labelToKey']['get'](_0x386e74)??null;}[_0x1bb8a6(0x201)](){const _0x40ed9d=_0x1bb8a6;return this[_0x40ed9d(0x21c)][_0x40ed9d(0x201)];}[_0x1bb8a6(0x170)](){return this['_tombstoneCount'];}async[_0x1bb8a6(0x23d)](_0x253173){const _0x258446=_0x1bb8a6,_0x347daf=_0x253173+'.tmp',_0x5eb3e9=[];for(const [_0x5500e8,_0x266d9e]of this[_0x258446(0x20d)][_0x258446(0x22b)]()){const _0xf6fce4=this[_0x258446(0x1e5)][_0x258446(0x23e)](_0x266d9e);_0x5eb3e9['push'](_0xf6fce4==null?[_0x5500e8,_0x266d9e]:[_0x5500e8,_0x266d9e,_0xf6fce4]);}_0x5eb3e9[_0x258446(0x187)]((_0x10e5cc,_0x10a9fb)=>_0x10e5cc[0x0]-_0x10a9fb[0x0]);const _0x11d025={'version':0x2,'nextLabel':this[_0x258446(0x1c9)],'entries':_0x5eb3e9};_0x5e7a7e[_0x258446(0x238)](_0x347daf,JSON[_0x258446(0x200)](_0x11d025)),_0x5e7a7e[_0x258446(0x1e1)](_0x347daf,_0x253173);}}return labelMap=_0x3d9ac4,labelMap;}var indexConvergence,hasRequiredIndexConvergence;function requireIndexConvergence(){if(hasRequiredIndexConvergence)return indexConvergence;hasRequiredIndexConvergence=0x1;function _0x54d5f4(_0x512865){const _0x30052f=_0x5717,_0x470b4c=new Uint32Array(_0x512865[_0x30052f(0x1c8)],_0x512865[_0x30052f(0x190)],_0x512865[_0x30052f(0x232)]);let _0x33a15a=0x811c9dc5,_0x1be3f9=0x9747b28c;for(let _0x541a86=0x0;_0x541a86<_0x470b4c['length'];_0x541a86++){const _0x32c8ad=_0x470b4c[_0x541a86];_0x33a15a=Math['imul'](_0x33a15a^_0x32c8ad,0x1000193)>>>0x0;let _0x264864=Math[_0x30052f(0x23a)](_0x32c8ad,0xcc9e2d51);_0x264864=_0x264864<<0xf|_0x264864>>>0x11,_0x1be3f9=Math[_0x30052f(0x23a)](_0x1be3f9^Math[_0x30052f(0x23a)](_0x264864,0x1b873593),0x5)+0xe6546b64,_0x1be3f9>>>=0x0;}return _0x1be3f9=Math['imul'](_0x1be3f9^_0x1be3f9>>>0x10,0x85ebca6b)>>>0x0,(_0x33a15a>>>0x0)*0x100000+(_0x1be3f9&0xfffff);}function _0x4842b5(_0x505d79,_0x4df428,_0xfa346c,{upsert:_0x3c0df7,remove:_0xd4ce2c}){const _0x535d52=_0x5717,_0x247774=new Set();let _0x8c301=0x0,_0x33c9e0=0x0,_0x17a4c1=0x0;for(const {key:_0x25c7ae,vector:_0x1da366}of _0x4df428){if(!(_0x1da366 instanceof Float32Array)||_0x1da366['length']!==_0xfa346c)continue;_0x247774[_0x535d52(0x1a8)](_0x25c7ae);const _0xe84592=_0x54d5f4(_0x1da366),_0x404b1f=_0x505d79[_0x535d52(0x188)](_0x25c7ae)!==undefined;if(_0x404b1f&&_0x505d79[_0x535d52(0x1a9)](_0x25c7ae)===_0xe84592)continue;_0x3c0df7(_0x25c7ae,_0x1da366,_0xe84592);if(_0x404b1f)_0x33c9e0++;else _0x8c301++;}for(const _0x54e1bb of[..._0x505d79[_0x535d52(0x195)]()]){if(_0x247774['has'](_0x54e1bb))continue;_0xd4ce2c(_0x54e1bb),_0x17a4c1++;}return{'added':_0x8c301,'changed':_0x33c9e0,'removed':_0x17a4c1};}return indexConvergence={'fingerprint':_0x54d5f4,'reconcileIndex':_0x4842b5},indexConvergence;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x30a178=requireSnapshotStore(),_0x69cd21=requireLabelMap(),{fingerprint:_0xcbc21f,reconcileIndex:_0x364cd8}=requireIndexConvergence(),_0xe5e7c8=0x1;let _0x22f04a=null;function _0x3f7a0c(){const _0x465499=_0x5717;if(_0x22f04a)return _0x22f04a;try{return _0x22f04a=require('hnswlib-node'),_0x22f04a;}catch(_0x44c8b1){const _0x40bb98=new Error(_0x465499(0x176)+(_0x465499(0x18d)+process['versions'][_0x465499(0x1c0)]+_0x465499(0x1fb)+process['platform']+'/'+process[_0x465499(0x16b)]+'.\x20')+'Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20'+(_0x465499(0x1af)+(_0x44c8b1?.[_0x465499(0x19d)]||String(_0x44c8b1))));_0x40bb98[_0x465499(0x1a0)]=_0x465499(0x219),_0x40bb98['cause']=_0x44c8b1;throw _0x40bb98;}}return hnsw=function _0x46744c(_0x46924c={},{dims:_0x451b1e,dir:_0x463c2b}){const _0x243395=_0x5717,_0x37ae7d=_0x3f7a0c();if(!_0x451b1e||_0x451b1e<=0x0)throw new Error(_0x243395(0x20a));if(!_0x463c2b)throw new Error(_0x243395(0x20c));const _0x4519f2={'metric':_0x46924c['metric']??'cosine','M':_0x46924c['M']??0x10,'efConstruction':_0x46924c[_0x243395(0x18c)]??0xc8,'efSearch':_0x46924c[_0x243395(0x16a)]??0x40,'maxElements':_0x46924c[_0x243395(0x1ff)]??0x400,'growFactor':_0x46924c[_0x243395(0x198)]??0x2,'snapshotEveryChanges':_0x46924c[_0x243395(0x19a)]??0xc350,'keepSnapshots':_0x46924c['keepSnapshots']??0x2,'tmpMaxAgeMs':_0x46924c[_0x243395(0x180)]??0x6*0x36ee80},_0x3c8729=new _0x30a178({'dir':_0x463c2b,'keepSnapshots':_0x4519f2[_0x243395(0x181)]}),_0xcc8e9b=new _0x69cd21();let _0x3775dd=null,_0x59a693=0x0,_0x40f8b5=null,_0x558792=Promise[_0x243395(0x169)]();const _0x3ca46b=_0x102681=>{const _0x853119=_0x243395,_0xfaab1a=_0x558792[_0x853119(0x1b5)](_0x102681);return _0x558792=_0xfaab1a[_0x853119(0x1bd)](()=>{}),_0xfaab1a;};async function _0x338b5d(_0x2cd8a8){const _0x1241e7=_0x243395;await _0xcc8e9b[_0x1241e7(0x1f0)](),_0x2cd8a8=_0x2cd8a8??[];const _0x5800f9=Math[_0x1241e7(0x222)](_0x4519f2[_0x1241e7(0x1ff)],Math[_0x1241e7(0x1d8)](_0x2cd8a8[_0x1241e7(0x232)]*(_0x4519f2[_0x1241e7(0x198)]||1.2)),0x1);_0x3775dd=new _0x37ae7d[(_0x1241e7(0x204))](_0x4519f2['metric'],_0x451b1e),_0x3775dd['initIndex']({'maxElements':_0x5800f9,'efConstruction':_0x4519f2[_0x1241e7(0x18c)],'M':_0x4519f2['M']});for(const {key:_0x1d2ca1,vector:_0x28b40c}of _0x2cd8a8){if(!(_0x28b40c instanceof Float32Array)||_0x28b40c[_0x1241e7(0x232)]!==_0x451b1e)continue;_0x4c5d22(_0x1d2ca1,_0x28b40c);}_0x3775dd[_0x1241e7(0x18b)](_0x4519f2[_0x1241e7(0x16a)]),_0x59a693=0x0;}async function _0x3b480a(_0x278652){return _0x338b5d(_0x278652?await _0x278652():[]);}function _0x2e89ce(){const _0x363115=_0x243395;if(_0x3775dd['getCurrentCount']()<_0x3775dd[_0x363115(0x21f)]())return;const _0x5965df=Math[_0x363115(0x1d8)](_0x3775dd['getMaxElements']()*(_0x4519f2[_0x363115(0x198)]||0x2));_0x3775dd[_0x363115(0x1ab)](_0x5965df),_0x4519f2[_0x363115(0x1ff)]=_0x5965df;}function _0x4c5d22(_0x14dd7f,_0x55ed30,_0x2d0365){const _0x209091=_0x243395,_0x4f20fc=_0xcc8e9b[_0x209091(0x216)](_0x14dd7f);try{_0x3775dd[_0x209091(0x1cb)](_0x4f20fc);}catch{}_0x2e89ce(),_0x3775dd[_0x209091(0x1b1)](Array['from'](_0x55ed30),_0x4f20fc),_0xcc8e9b['setFingerprint'](_0x14dd7f,_0x2d0365??_0xcbc21f(_0x55ed30));}function _0x31c524(_0x48eb9d){const _0x30d69f=_0x243395,_0x397833=_0xcc8e9b['labelForExisting'](_0x48eb9d);if(_0x397833===undefined)return![];try{_0x3775dd[_0x30d69f(0x1cb)](_0x397833);}catch{}return _0xcc8e9b['tombstone'](_0x48eb9d),!![];}function _0x303d6b(){const _0x17e6a6=_0x243395;return Math[_0x17e6a6(0x222)](Date['now'](),_0x3c8729[_0x17e6a6(0x217)]()+0x1);}async function _0x484ec(_0x1504e2){const _0x549b70=_0x243395;if(!_0x3775dd||!_0x1504e2)return![];const _0x2c2d07=await _0x3c8729['publishSnapshot'](_0x1504e2,async _0x19d969=>{const _0x535ce7=_0x5717;_0x3775dd[_0x535ce7(0x1e6)](_0x19d969[_0x535ce7(0x221)]),await _0xcc8e9b[_0x535ce7(0x23d)](_0x19d969[_0x535ce7(0x227)]);const _0x56326e=require$$0;_0x56326e[_0x535ce7(0x238)](_0x19d969['state'],JSON['stringify']({'manifestVersion':_0xe5e7c8,'dims':_0x451b1e,'metric':_0x4519f2[_0x535ce7(0x21b)],'clock':_0x1504e2,'snapshotAt':Date[_0x535ce7(0x17a)]()},null,0x2));},{'keep':_0x4519f2[_0x549b70(0x181)]});if(_0x2c2d07?.[_0x549b70(0x1c5)])_0x59a693=0x0;return _0x2c2d07?.[_0x549b70(0x1c5)]??![];}async function _0x37a30e(){const _0x3a576e=_0x243395,_0x47454b=_0x3c8729['readCurrentId']()||_0x3c8729[_0x3a576e(0x1cc)]();if(!_0x47454b)return null;let _0x1c594f,_0x4e8fe6=![];return await _0x3c8729[_0x3a576e(0x1e0)](_0x47454b,async _0x17280c=>{const _0xe6b39e=_0x3a576e,_0x3bcf95=require$$0;_0x1c594f=JSON[_0xe6b39e(0x1c4)](_0x3bcf95['readFileSync'](_0x17280c[_0xe6b39e(0x1e4)],_0xe6b39e(0x17f)));if(_0x1c594f[_0xe6b39e(0x1f8)]!==_0xe5e7c8||_0x1c594f[_0xe6b39e(0x233)]!==_0x451b1e||_0x1c594f[_0xe6b39e(0x21b)]!==_0x4519f2['metric']){_0x1c594f=null;return;}await _0xcc8e9b[_0xe6b39e(0x1a2)](_0x17280c[_0xe6b39e(0x227)]),_0x3775dd=new _0x37ae7d['HierarchicalNSW'](_0x4519f2[_0xe6b39e(0x21b)],_0x451b1e),_0x3775dd[_0xe6b39e(0x1f4)](_0x17280c[_0xe6b39e(0x221)]),_0x3775dd[_0xe6b39e(0x18b)](_0x4519f2[_0xe6b39e(0x16a)]),_0x4e8fe6=!![];}),_0x4e8fe6?_0x1c594f?.[_0x3a576e(0x19e)]??0x0:null;}return{async 'load'(_0x2b8145){return _0x3ca46b(async()=>{const _0x3fc04e=_0x5717;_0x3c8729['cleanupTmpDirs']({'maxAgeMs':_0x4519f2[_0x3fc04e(0x180)]}),_0x40f8b5=_0x2b8145??null;const _0x42858d=await _0x37a30e(),_0x19446f=_0x2b8145?await _0x2b8145():null;if(_0x42858d!=null){if(_0x19446f){if(!_0xcc8e9b[_0x3fc04e(0x1d4)])return await _0x338b5d(_0x19446f),null;const _0x11dae9=_0x364cd8(_0xcc8e9b,_0x19446f,_0x451b1e,{'upsert':_0x4c5d22,'remove':_0x31c524});_0x59a693+=_0x11dae9[_0x3fc04e(0x193)]+_0x11dae9[_0x3fc04e(0x224)]+_0x11dae9[_0x3fc04e(0x236)];}return _0x42858d;}return await _0x338b5d(_0x19446f),null;});},async 'add'(_0x2d2ec2,_0x2ee76d,_0x4bf22b){return _0x3ca46b(async()=>{const _0x4991ce=_0x5717;if(!_0x3775dd)return;const _0x13341a=_0x2ee76d instanceof Float32Array?_0x2ee76d:new Float32Array(_0x2ee76d),_0x450a58=_0xcbc21f(_0x13341a);if(_0xcc8e9b[_0x4991ce(0x1a9)](_0x2d2ec2)===_0x450a58)return;_0x4c5d22(_0x2d2ec2,_0x13341a,_0x450a58),_0x59a693++,_0x59a693>=_0x4519f2[_0x4991ce(0x19a)]&&await _0x484ec(_0x303d6b());});},async 'remove'(_0x487269){return _0x3ca46b(async()=>{if(!_0x3775dd)return;if(_0x31c524(_0x487269))_0x59a693++;});},'search'(_0x322dce,{limit:limit=0xa,efSearch:_0x5a911d}={}){const _0x113d21=_0x243395;if(!_0x3775dd)return[];if(Number['isInteger'](_0x5a911d))_0x3775dd['setEf'](_0x5a911d);const _0x3858d6=Math[_0x113d21(0x1bf)](limit,_0x3775dd[_0x113d21(0x19f)]()||0x1),{neighbors:_0x5126f8,distances:_0x20be8f}=_0x3775dd[_0x113d21(0x1df)](Array[_0x113d21(0x237)](_0x322dce),_0x3858d6),_0x1ad5b3=[];for(let _0x1db287=0x0;_0x1db287<_0x5126f8[_0x113d21(0x232)];_0x1db287++){const _0x5beb61=_0xcc8e9b[_0x113d21(0x1fd)](_0x5126f8[_0x1db287]);if(!_0x5beb61)continue;const _0x368ac9=_0x4519f2['metric']===_0x113d21(0x1d9)?Math[_0x113d21(0x222)](0x0,0x1-_0x20be8f[_0x1db287]):0x1/(0x1+_0x20be8f[_0x1db287]);_0x1ad5b3[_0x113d21(0x212)]({'key':_0x5beb61,'score':_0x368ac9});}return _0x1ad5b3;},async 'snapshot'(_0x5a838f){return _0x3ca46b(()=>_0x484ec(_0x5a838f??_0x303d6b()));},async 'rebuild'(_0x4b5434){return _0x3ca46b(()=>{if(_0x4b5434!=null)_0x40f8b5=_0x4b5434;return _0x3b480a(_0x4b5434??_0x40f8b5);});},async 'stop'(){const _0x43449c=_0x243395;return _0x3ca46b(()=>_0x59a693>0x0||!_0x3c8729[_0x43449c(0x1b6)]()?_0x484ec(_0x303d6b()):![]);},'count'(){const _0x3e36c2=_0x243395;return _0xcc8e9b[_0x3e36c2(0x201)]();},'info'(){const _0x82981e=_0x243395;return{'algorithm':_0x82981e(0x1f9),'metric':_0x4519f2[_0x82981e(0x21b)],'M':_0x4519f2['M'],'efConstruction':_0x4519f2['efConstruction'],'efSearch':_0x4519f2[_0x82981e(0x16a)],'maxElements':_0x3775dd?.[_0x82981e(0x21f)]()??_0x4519f2[_0x82981e(0x1ff)],'count':_0xcc8e9b[_0x82981e(0x201)](),'changesSince':_0x59a693,'snapshotDir':_0x463c2b,'latestSnapshot':_0x3c8729['readCurrentId']()??null};}};},hnsw;}var flat,hasRequiredFlat;function _0x5717(_0x194693,_0x563122){_0x194693=_0x194693-0x168;const _0x1f5bcc=_0x1f5b();let _0x5717ec=_0x1f5bcc[_0x194693];return _0x5717ec;}function _0x1f5b(){const _0x5800d8=['900981yfCchL','currentPath','sort','labelForExisting','readdirSync','vector','setEf','efConstruction','for\x20Node\x20','snapshotsDir','postMessage','byteOffset','isFinite','isInteger','added','key','keys','round','pid','growFactor','statSync','snapshotEveryChanges','writer','finally','message','clock','getCurrentCount','code','labels.json','loadFrom','_snapshotDir','505016cbhnOM','_tombstoneCount','12fCKCEM','EEXIST','add','fingerprintOf','call','resizeIndex','closeSync','rebuild','opts','Original\x20error:\x20','ready','addPoint','warn','snapshots','snapshot','then','readCurrentId','Index','isArray','unreadable','slice','token','stale','catch',').\x20','min','node','lockPath','CURRENT','expansionAdd','parse','published','419937etrAKn','vectors','buffer','nextLabel','hasOwnProperty','markDelete','latestSnapshotId','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20','reject','acquire','info','readFileSync','openSync','cleanupTmpDirs','hasFingerprints','isDirectory','10MouAQR','startsWith','ceil','cosine','WRITER.LOCK','connectivity','state.json','repeat','host','searchKnn','loadSnapshot','renameSync','unlinkSync','dir','state','keyToFp','writeIndexSync','Unknown\x20algorithm:\x20\x22','hex','prototype','count','randomBytes','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','hostname','snapshot\x20id\x20required','default','reset','s,\x20pid:\x20','capacity','listSnapshotIds','readIndexSync','[SnapshotStore]','writerLockMaxAgeMs','.tmp-','manifestVersion','hnsw','release','\x20on\x20','existsSync','keyForLabel','index.hnsw','maxElements','stringify','size','prune','search','HierarchicalNSW','algorithm','SNAPSHOT.LOCK','view','error','fetchAll','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','load','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','labelToKey','join','Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20','104180aKGgqa','MetricKind','push','trim','versions','expansionSearch','labelForEphemeral','readCurrentClock','isFree','HNSW_BINDINGS_UNAVAILABLE','sqrt','metric','keyToLabel','map','rmSync','getMaxElements','15607339hGoNha','index','max','heartbeatIntervalMs','changed','set','unref','labels','_snapshotPaths','platform','score','entries','name','distances','Cos','viewRefreshMs','filter','stop','length','dims','104UGgLXS','mkdirSync','removed','from','writeFileSync','__esModule','imul','ScalarKind','exports','snapshotTo','get','48LjQtMy','mtimeMs','resolve','efSearch','arch','fetchAllResult','setFingerprint','reader','log','tombstoneCount','queryVec','toString','flat','remove','delete','HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','1630728MspAmX','fid','snapshotMaxLagMs','now','8666735JuLMnw','tombstone','ENOENT','publishSnapshot','utf8','tmpMaxAgeMs','keepSnapshots','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','Unknown\x20op:\x20\x22','usearch'];_0x1f5b=function(){return _0x5800d8;};return _0x1f5b();}function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x1b2328(_0x3298d1={}){const _0xbdf55c=new Map();return{async 'load'(_0x33af80){_0xbdf55c['clear']();if(_0x33af80)for(const {key:_0x5797b4,vector:_0x3e9d33}of await _0x33af80()){_0xbdf55c['set'](_0x5797b4,_0x3e9d33);}},async 'add'(_0x183ea4,_0x15e176,_0x31a749){const _0x414406=_0x5717;_0xbdf55c[_0x414406(0x225)](_0x183ea4,_0x15e176);},async 'remove'(_0x3912e1){const _0x556e88=_0x5717;_0xbdf55c[_0x556e88(0x175)](_0x3912e1);},'search'(_0x3f92cb,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x3e4fbd=_0x5717,_0x468491=[];for(const [_0x34e826,_0x1d3fe8]of _0xbdf55c){const _0x4e1131=_0x41c027(_0x3f92cb,_0x1d3fe8);if(_0x4e1131>=threshold)_0x468491[_0x3e4fbd(0x212)]({'key':_0x34e826,'score':_0x4e1131});}return _0x468491[_0x3e4fbd(0x187)]((_0xe040ea,_0x306590)=>_0x306590[_0x3e4fbd(0x22a)]-_0xe040ea['score']),_0x468491[_0x3e4fbd(0x1ba)](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x5320d4){const _0x3b748c=_0x5717;await this[_0x3b748c(0x20b)](_0x5320d4);},async 'stop'(){},'count'(){const _0x147a65=_0x5717;return _0xbdf55c[_0x147a65(0x201)];},'info'(){const _0x1c7008=_0x5717;return{'algorithm':_0x1c7008(0x173),'count':_0xbdf55c[_0x1c7008(0x201)]};}};};function _0x41c027(_0x443171,_0x35df07){const _0x37e483=_0x5717;let _0x52fb20=0x0,_0x3e6133=0x0,_0x212cf9=0x0;for(let _0x3fc2dd=0x0;_0x3fc2dd<_0x443171[_0x37e483(0x232)];_0x3fc2dd++){_0x52fb20+=_0x443171[_0x3fc2dd]*_0x35df07[_0x3fc2dd],_0x3e6133+=_0x443171[_0x3fc2dd]*_0x443171[_0x3fc2dd],_0x212cf9+=_0x35df07[_0x3fc2dd]*_0x35df07[_0x3fc2dd];}const _0x24b219=Math['sqrt'](_0x3e6133)*Math[_0x37e483(0x21a)](_0x212cf9);return _0x24b219===0x0?0x0:_0x52fb20/_0x24b219;}return flat;}var writerLock,hasRequiredWriterLock;function requireWriterLock(){if(hasRequiredWriterLock)return writerLock;hasRequiredWriterLock=0x1;const _0x4a23cf=require$$0,_0x3dcb7f=require$$1,_0x2f0cb6=require$$3;return writerLock=function _0x2756b8(_0x14eb2f,{maxAgeMs:maxAgeMs=0x3a98,heartbeatMs:heartbeatMs=0x1388,onLost:onLost=null}={}){const _0xfe2552=_0x5717,_0x2165bf=_0x3dcb7f[_0xfe2552(0x20e)](_0x14eb2f,_0xfe2552(0x1da)),_0x57bb3b=_0x2f0cb6[_0xfe2552(0x1eb)](0x8)[_0xfe2552(0x172)](_0xfe2552(0x1e8));let _0x5b47a6=![],_0x1b747c=null;const _0x32b7dd=()=>JSON[_0xfe2552(0x200)]({'pid':process['pid'],'token':_0x57bb3b,'at':Date[_0xfe2552(0x17a)]()});function _0x340934(){const _0xb5c59d=_0xfe2552;try{return JSON[_0xb5c59d(0x1c4)](_0x4a23cf[_0xb5c59d(0x1d1)](_0x2165bf,_0xb5c59d(0x17f)));}catch(_0x445b55){return _0x445b55?.['code']===_0xb5c59d(0x17d)?null:{'unreadable':!![]};}}function _0x90ce6f(){const _0x5f408b=_0xfe2552;try{const _0x39994e=_0x4a23cf[_0x5f408b(0x1d2)](_0x2165bf,'wx');try{_0x4a23cf['writeFileSync'](_0x39994e,_0x32b7dd());}finally{_0x4a23cf['closeSync'](_0x39994e);}return!![];}catch(_0x221cef){if(_0x221cef?.[_0x5f408b(0x1a0)]===_0x5f408b(0x1a7))return![];throw _0x221cef;}}function _0x524aeb(_0x2229c0){const _0x46a5d4=_0xfe2552;if(!_0x2229c0)return!![];if(_0x2229c0[_0x46a5d4(0x1b9)])return!![];return Date[_0x46a5d4(0x17a)]()-(_0x2229c0['at']??0x0)>=maxAgeMs;}function _0x284f2c(){if(_0x1b747c)clearInterval(_0x1b747c);_0x1b747c=null;}function _0x3e0064(){_0x284f2c(),_0x1b747c=setInterval(()=>{const _0x572108=_0x5717,_0xa017e2=_0x340934();if(_0xa017e2&&!_0xa017e2[_0x572108(0x1b9)]&&_0xa017e2['token']!==_0x57bb3b){_0x5b47a6=![],_0x284f2c();try{onLost?.();}catch{}return;}try{_0x4a23cf['writeFileSync'](_0x2165bf,_0x32b7dd());}catch{}},heartbeatMs),_0x1b747c['unref']?.();}function _0x58cf82(){const _0x45d294=_0x340934();return!!_0x45d294&&_0x45d294['token']===_0x57bb3b;}return{'path':_0x2165bf,'token':_0x57bb3b,'acquire'(){const _0x1895e9=_0xfe2552,_0x1749dd=_0x340934();if(_0x1749dd&&_0x1749dd['token']===_0x57bb3b){_0x5b47a6=!![];if(!_0x1b747c)_0x3e0064();return!![];}let _0x35daa5=_0x90ce6f();if(!_0x35daa5&&_0x524aeb(_0x340934())){try{_0x4a23cf[_0x1895e9(0x1e2)](_0x2165bf);}catch{}_0x35daa5=_0x90ce6f();}if(_0x35daa5&&!_0x58cf82())_0x35daa5=![];_0x5b47a6=_0x35daa5;if(_0x35daa5)_0x3e0064();return _0x35daa5;},'held'(){return _0x5b47a6;},'isFree'(){const _0x200d63=_0xfe2552,_0x2b4599=_0x340934();if(_0x2b4599&&_0x2b4599[_0x200d63(0x1bb)]===_0x57bb3b)return![];return _0x524aeb(_0x2b4599);},'release'(){const _0x2855ac=_0xfe2552;_0x284f2c();if(!_0x5b47a6)return;_0x5b47a6=![];if(_0x58cf82())try{_0x4a23cf[_0x2855ac(0x1e2)](_0x2165bf);}catch{}}};},writerLock;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x188e02=require$$0,_0x29bfac=requireSnapshotStore(),_0x5ce840=requireLabelMap(),_0x4db71e=requireWriterLock(),{fingerprint:_0x4cb014,reconcileIndex:_0x4b1132}=requireIndexConvergence(),_0xd937b7=0x1;let _0x3574d0=null;function _0x2d78e9(){const _0x5a1a53=_0x5717;if(_0x3574d0)return _0x3574d0;try{return _0x3574d0=require('usearch'),_0x3574d0;}catch(_0x3ccb77){const _0x547baf=new Error(_0x5a1a53(0x182)+(_0x5a1a53(0x18d)+process[_0x5a1a53(0x214)]['node']+_0x5a1a53(0x1fb)+process[_0x5a1a53(0x229)]+'/'+process['arch']+'.\x20')+_0x5a1a53(0x1cd)+('Original\x20error:\x20'+(_0x3ccb77?.[_0x5a1a53(0x19d)]||String(_0x3ccb77))));_0x547baf[_0x5a1a53(0x1a0)]='USEARCH_BINDINGS_UNAVAILABLE',_0x547baf['cause']=_0x3ccb77;throw _0x547baf;}}function _0x325064(_0x3006fb,_0x545faf){const _0x3b351f=_0x5717;switch(_0x3006fb){case _0x3b351f(0x1d9):return _0x545faf[_0x3b351f(0x211)]['Cos'];case'l2':return _0x545faf['MetricKind']['L2sq'];case'ip':return _0x545faf[_0x3b351f(0x211)]['IP'];default:return _0x545faf[_0x3b351f(0x211)][_0x3b351f(0x22e)];}}return usearch=function _0x3025d0(_0x3e9b76={},{dims:_0x39ca96,dir:_0x3a7e15,fetchAll:fetchAll=null,onChange:onChange=null}={}){const _0x16c739=_0x5717,_0x441028=_0x2d78e9();if(!_0x39ca96||_0x39ca96<=0x0)throw new Error('usearch\x20algorithm\x20requires\x20dims\x20>\x200');if(!_0x3a7e15)throw new Error('usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage');const _0x2098a0={'metric':_0x3e9b76['metric']??'cosine','connectivity':_0x3e9b76[_0x16c739(0x1db)]??0x10,'expansionAdd':_0x3e9b76[_0x16c739(0x1c3)]??0x80,'expansionSearch':_0x3e9b76['expansionSearch']??0x40,'snapshotEveryChanges':_0x3e9b76[_0x16c739(0x19a)]??0xc350,'snapshotMaxLagMs':_0x3e9b76['snapshotMaxLagMs']??0x2710,'keepSnapshots':_0x3e9b76['keepSnapshots']??0x2,'tmpMaxAgeMs':_0x3e9b76['tmpMaxAgeMs']??0x6*0x36ee80,'heartbeatIntervalMs':_0x3e9b76[_0x16c739(0x223)]??0x1388,'writerLockMaxAgeMs':_0x3e9b76['writerLockMaxAgeMs']??0x3a98,'viewRefreshMs':_0x3e9b76['viewRefreshMs']??0x3e8},_0x114387=new _0x29bfac({'dir':_0x3a7e15,'keepSnapshots':_0x2098a0[_0x16c739(0x181)]}),_0x495aff=_0x4db71e(_0x3a7e15,{'maxAgeMs':_0x2098a0[_0x16c739(0x1f6)],'heartbeatMs':_0x2098a0[_0x16c739(0x223)],'onLost':()=>{const _0x5b6b39=_0x16c739;_0x3571ac(_0x2235e7)[_0x5b6b39(0x1bd)](()=>{});}});let _0x3687b1=new _0x5ce840(),_0x234e36=null,_0x2d0049=0x0,_0xb6d3d3=null,_0x509561=![],_0x41a7b7=![],_0x81c4b5=null,_0x5e7c0b=0x0,_0x397d12=null,_0x48f2a5=0x0,_0x2b61dd=![],_0x1cfed5=Promise[_0x16c739(0x169)]();const _0x3571ac=_0x4f6a37=>{const _0x34197e=_0x16c739,_0x19a7b7=_0x1cfed5[_0x34197e(0x1b5)](_0x4f6a37);return _0x1cfed5=_0x19a7b7[_0x34197e(0x1bd)](()=>{}),_0x19a7b7;},_0x477821=()=>{try{onChange?.();}catch{}};function _0x333503(){const _0x2c58f8=_0x16c739;return new _0x441028[(_0x2c58f8(0x1b7))]({'dimensions':_0x39ca96,'metric':_0x325064(_0x2098a0[_0x2c58f8(0x21b)],_0x441028),'quantization':_0x441028[_0x2c58f8(0x23b)]['F32'],'connectivity':_0x2098a0['connectivity'],'expansion_add':_0x2098a0[_0x2c58f8(0x1c3)],'expansion_search':_0x2098a0[_0x2c58f8(0x215)],'multi':![]});}function _0x546ab5(_0x357f5f){return _0x357f5f instanceof Float32Array?_0x357f5f:new Float32Array(_0x357f5f);}function _0x27164a(){if(fetchAll)return fetchAll();if(_0xb6d3d3)return _0xb6d3d3();return Promise['resolve'](null);}function _0x4ccb38(_0x47ee10,_0x23ba1c,_0x53ef78){const _0x13ca61=_0x16c739,_0x472320=_0x3687b1[_0x13ca61(0x188)](_0x47ee10);if(_0x472320!==undefined)try{_0x234e36[_0x13ca61(0x174)](BigInt(_0x472320));}catch{}const _0x5826a2=_0x3687b1[_0x13ca61(0x216)](_0x47ee10);_0x234e36['add'](BigInt(_0x5826a2),_0x23ba1c),_0x3687b1[_0x13ca61(0x16d)](_0x47ee10,_0x53ef78??_0x4cb014(_0x23ba1c));}function _0x56422f(_0x1187b3){const _0xedc47=_0x16c739,_0x1c3126=_0x3687b1[_0xedc47(0x188)](_0x1187b3);if(_0x1c3126===undefined)return![];try{_0x234e36[_0xedc47(0x174)](BigInt(_0x1c3126));}catch{}return _0x3687b1['tombstone'](_0x1187b3),!![];}function _0x13285f(_0x4d66d8){const _0x44dca9=_0x16c739;_0x3687b1=new _0x5ce840(),_0x234e36=_0x333503();for(const {key:_0x2b74ad,vector:_0x1da19d}of _0x4d66d8??[]){if(!(_0x1da19d instanceof Float32Array)||_0x1da19d[_0x44dca9(0x232)]!==_0x39ca96)continue;_0x4ccb38(_0x2b74ad,_0x1da19d);}_0x2d0049=0x0;}function _0x3d7856(){const _0x382819=_0x16c739;return Math['max'](Date[_0x382819(0x17a)](),_0x114387[_0x382819(0x217)]()+0x1);}function _0x33143b(){if(_0x81c4b5)clearTimeout(_0x81c4b5);_0x81c4b5=null;}function _0x293e8a(){const _0x45a7e1=_0x16c739;if(!_0x2098a0['snapshotMaxLagMs']||_0x81c4b5||!_0x41a7b7||_0x2d0049<=0x0)return;const _0x30e615=Math[_0x45a7e1(0x222)](_0x2098a0[_0x45a7e1(0x179)],0xa*_0x5e7c0b);_0x81c4b5=setTimeout(()=>{const _0x6de410=_0x45a7e1;_0x81c4b5=null,_0x3571ac(async()=>{if(_0x41a7b7&&_0x2d0049>0x0)await _0x12d40c();_0x293e8a(),_0x477821();})[_0x6de410(0x1bd)](()=>{});},_0x30e615),_0x81c4b5[_0x45a7e1(0x226)]?.();}async function _0x12d40c(_0x3f369d){const _0x2cb75d=_0x16c739;if(!_0x234e36)return![];const _0x1a66aa=_0x3f369d??_0x3d7856(),_0x44dc9d=Date[_0x2cb75d(0x17a)](),_0x121585=await _0x114387[_0x2cb75d(0x17e)](_0x1a66aa,async _0x4912fb=>{const _0x311851=_0x2cb75d;_0x234e36['save'](_0x4912fb[_0x311851(0x221)]),await _0x3687b1['snapshotTo'](_0x4912fb[_0x311851(0x227)]),_0x188e02[_0x311851(0x238)](_0x4912fb[_0x311851(0x1e4)],JSON[_0x311851(0x200)]({'manifestVersion':_0xd937b7,'algorithm':'usearch','dims':_0x39ca96,'metric':_0x2098a0[_0x311851(0x21b)],'clock':_0x1a66aa,'snapshotAt':Date['now']()},null,0x2));},{'keep':_0x2098a0[_0x2cb75d(0x181)]});return _0x5e7c0b=Date[_0x2cb75d(0x17a)]()-_0x44dc9d,_0x121585?.[_0x2cb75d(0x1c5)]&&(_0x2d0049=0x0,_0x33143b()),_0x121585?.[_0x2cb75d(0x1c5)]??![];}function _0x4b8e9a(){const _0xcbba8c=_0x16c739;_0x2d0049++;if(_0x2d0049>=_0x2098a0[_0xcbba8c(0x19a)])return _0x12d40c();return _0x293e8a(),null;}async function _0x378db3(){const _0x25393f=_0x16c739,_0x504578=_0x114387[_0x25393f(0x1b6)]()||_0x114387['latestSnapshotId']();if(!_0x504578)return null;let _0xe07b1f,_0x5eea38=![];try{await _0x114387[_0x25393f(0x1e0)](_0x504578,async _0x28e1ec=>{const _0x3b47e5=_0x25393f;_0xe07b1f=JSON[_0x3b47e5(0x1c4)](_0x188e02['readFileSync'](_0x28e1ec[_0x3b47e5(0x1e4)],_0x3b47e5(0x17f)));if(_0xe07b1f['manifestVersion']!==_0xd937b7||_0xe07b1f[_0x3b47e5(0x205)]!==_0x3b47e5(0x184)||_0xe07b1f[_0x3b47e5(0x233)]!==_0x39ca96||_0xe07b1f['metric']!==_0x2098a0[_0x3b47e5(0x21b)]){_0xe07b1f=null;return;}const _0x5964ef=new _0x5ce840();await _0x5964ef['loadFrom'](_0x28e1ec['labels']);const _0x452afd=_0x333503();_0x452afd[_0x3b47e5(0x20b)](_0x28e1ec[_0x3b47e5(0x221)]),_0x3687b1=_0x5964ef,_0x234e36=_0x452afd,_0x5eea38=!![];});}catch{return null;}return _0x5eea38?_0xe07b1f?.[_0x25393f(0x19e)]??0x0:null;}async function _0x2b10b9(_0x3eb011){const _0x220a8a=_0x16c739;_0x397d12=null;const _0x1e7278=await _0x378db3();if(_0x1e7278!=null){_0x2d0049=0x0;if(_0x3eb011){if(!_0x3687b1[_0x220a8a(0x1d4)])return _0x13285f(_0x3eb011),await _0x12d40c(),null;const _0x5a5689=_0x4b1132(_0x3687b1,_0x3eb011,_0x39ca96,{'upsert':_0x4ccb38,'remove':_0x56422f}),_0x2d29b2=_0x5a5689[_0x220a8a(0x193)]+_0x5a5689['changed']+_0x5a5689[_0x220a8a(0x236)];_0x2d29b2>0x0&&(_0x2d0049+=_0x2d29b2,await _0x12d40c());}return _0x1e7278;}_0x13285f(_0x3eb011??[]);if(_0x234e36[_0x220a8a(0x201)]()>0x0)await _0x12d40c();return null;}async function _0x252b54(){_0x41a7b7=!![],await _0x2b10b9(await _0x27164a());}async function _0x2235e7(){if(!_0x41a7b7)return;_0x41a7b7=![],_0x33143b(),_0x2d0049=0x0;const _0x3403f1=_0x114387['readCurrentId']()||_0x114387['latestSnapshotId']();await _0x48c768(_0x3403f1),_0x477821();}async function _0x48c768(_0x4760c1){const _0x470a06=_0x16c739;if(!_0x4760c1)return![];let _0x432bfb=![];try{await _0x114387[_0x470a06(0x1e0)](_0x4760c1,async _0x2724cc=>{const _0x128c1f=_0x470a06,_0x2cd90f=JSON[_0x128c1f(0x1c4)](_0x188e02[_0x128c1f(0x1d1)](_0x2724cc[_0x128c1f(0x1e4)],_0x128c1f(0x17f)));if(_0x2cd90f[_0x128c1f(0x1f8)]!==_0xd937b7||_0x2cd90f['algorithm']!=='usearch'||_0x2cd90f[_0x128c1f(0x233)]!==_0x39ca96||_0x2cd90f[_0x128c1f(0x21b)]!==_0x2098a0[_0x128c1f(0x21b)])return;const _0x2640e4=new _0x5ce840();await _0x2640e4['loadFrom'](_0x2724cc[_0x128c1f(0x227)]);const _0x191745=_0x333503();_0x191745[_0x128c1f(0x207)](_0x2724cc[_0x128c1f(0x221)]),_0x234e36=_0x191745,_0x3687b1=_0x2640e4,_0x397d12=_0x4760c1,_0x432bfb=!![];});}catch{}return _0x432bfb;}function _0x3ef21d(){const _0x2a0780=_0x16c739,_0x295b6f=Date[_0x2a0780(0x17a)]();if(_0x295b6f-_0x48f2a5<_0x2098a0[_0x2a0780(0x22f)])return;_0x48f2a5=_0x295b6f;if(_0x2b61dd)return;if(_0x495aff[_0x2a0780(0x218)]()){_0x2b61dd=!![],_0x3571ac(async()=>{const _0xf8924c=_0x2a0780;!_0x41a7b7&&_0x509561&&_0x495aff[_0xf8924c(0x1cf)]()&&(await _0x252b54(),_0x477821());})['catch'](()=>{})[_0x2a0780(0x19c)](()=>{_0x2b61dd=![];});return;}const _0x282601=_0x114387[_0x2a0780(0x1b6)]()||_0x114387[_0x2a0780(0x1cc)]();if(!_0x282601||_0x282601===_0x397d12)return;_0x2b61dd=!![],_0x3571ac(async()=>{if(!_0x41a7b7&&await _0x48c768(_0x282601))_0x477821();})[_0x2a0780(0x1bd)](()=>{})[_0x2a0780(0x19c)](()=>{_0x2b61dd=![];});}return{async 'load'(_0x6ede51){return _0x3571ac(async()=>{const _0x1fe31b=_0x5717;_0x114387[_0x1fe31b(0x1d3)]({'maxAgeMs':_0x2098a0['tmpMaxAgeMs']}),_0xb6d3d3=_0x6ede51??null,_0x41a7b7=_0x495aff[_0x1fe31b(0x1cf)]();let _0x439ec4=null;if(_0x41a7b7)_0x439ec4=await _0x2b10b9(_0x6ede51?await _0x6ede51():null);else{const _0x19dc71=_0x114387[_0x1fe31b(0x1b6)]()||_0x114387[_0x1fe31b(0x1cc)]();await _0x48c768(_0x19dc71);}return _0x509561=!![],_0x439ec4;});},async 'add'(_0x44be87,_0x2cf90a,_0x4a7b34){return _0x3571ac(async()=>{const _0xe06931=_0x5717;if(!_0x509561)return;const _0x3c20f4=_0x546ab5(_0x2cf90a);if(!_0x41a7b7){if(!_0x495aff[_0xe06931(0x1cf)]())return;await _0x252b54();}if(!_0x234e36)return;const _0x47a6fb=_0x4cb014(_0x3c20f4);if(_0x3687b1[_0xe06931(0x1a9)](_0x44be87)===_0x47a6fb)return;_0x4ccb38(_0x44be87,_0x3c20f4,_0x47a6fb),await _0x4b8e9a();});},async 'remove'(_0x3bdf44){return _0x3571ac(async()=>{const _0x6ee5fe=_0x5717;if(!_0x509561)return;if(!_0x41a7b7){if(!_0x495aff[_0x6ee5fe(0x1cf)]())return;await _0x252b54();}if(!_0x234e36)return;if(_0x56422f(_0x3bdf44))await _0x4b8e9a();});},'search'(_0x2ee448,{limit:limit=0xa}={}){const _0x2277e1=_0x16c739;if(!_0x41a7b7&&_0x509561)_0x3ef21d();if(!_0x234e36)return[];const _0x13ac07=_0x234e36[_0x2277e1(0x201)]();if(_0x13ac07===0x0)return[];const _0x1c090f=Math[_0x2277e1(0x1bf)](limit,_0x13ac07),_0x4cb84d=_0x234e36[_0x2277e1(0x203)](_0x546ab5(_0x2ee448),_0x1c090f,0x0),_0x43d5c5=[],_0x5cf998=_0x4cb84d[_0x2277e1(0x195)],_0x5b9bd9=_0x4cb84d[_0x2277e1(0x22d)];for(let _0x112706=0x0;_0x112706<_0x5cf998[_0x2277e1(0x232)];_0x112706++){const _0x2999ae=_0x5cf998[_0x112706];if(_0x2999ae===0xffffffffffffffffn)continue;const _0x56311e=Number(_0x2999ae),_0x5b1061=_0x3687b1[_0x2277e1(0x1fd)](_0x56311e);if(!_0x5b1061)continue;const _0x12c4e5=_0x5b9bd9[_0x112706];let _0x2938e5;if(_0x2098a0['metric']==='cosine')_0x2938e5=Math[_0x2277e1(0x222)](0x0,0x1-_0x12c4e5);else{if(_0x2098a0['metric']==='ip')_0x2938e5=-_0x12c4e5;else _0x2938e5=0x1/(0x1+_0x12c4e5);}_0x43d5c5[_0x2277e1(0x212)]({'key':_0x5b1061,'score':_0x2938e5});}return _0x43d5c5;},async 'snapshot'(_0x25d46c){return _0x3571ac(()=>_0x41a7b7?_0x12d40c(_0x25d46c??undefined):![]);},async 'rebuild'(_0x434e1f){return _0x3571ac(async()=>{const _0x140320=_0x5717;if(_0x434e1f!=null)_0xb6d3d3=_0x434e1f;if(!_0x41a7b7){if(!_0x495aff[_0x140320(0x1cf)]())return;_0x41a7b7=!![];}const _0x2d0158=_0x434e1f?await _0x434e1f():await _0x27164a();_0x13285f(_0x2d0158??[]),_0x509561=!![],await _0x12d40c();});},async 'stop'(){return _0x3571ac(async()=>{const _0x18c3f3=_0x5717;_0x33143b();if(_0x41a7b7){if(_0x2d0049>0x0||!_0x114387[_0x18c3f3(0x1b6)]())await _0x12d40c();_0x495aff[_0x18c3f3(0x1fa)]();}_0x41a7b7=![],_0x509561=![];});},'count'(){return _0x3687b1['size']();},'info'(){const _0x2b8941=_0x16c739;return{'algorithm':_0x2b8941(0x184),'role':_0x41a7b7?_0x2b8941(0x19b):_0x2b8941(0x16e),'metric':_0x2098a0[_0x2b8941(0x21b)],'connectivity':_0x2098a0[_0x2b8941(0x1db)],'expansionAdd':_0x2098a0['expansionAdd'],'expansionSearch':_0x2098a0[_0x2b8941(0x215)],'snapshotEveryChanges':_0x2098a0[_0x2b8941(0x19a)],'snapshotMaxLagMs':_0x2098a0[_0x2b8941(0x179)],'count':_0x3687b1[_0x2b8941(0x201)](),'size':_0x234e36?.[_0x2b8941(0x201)]?.()??0x0,'capacity':_0x234e36?.[_0x2b8941(0x1f2)]?.()??0x0,'changesSince':_0x41a7b7?_0x2d0049:null,'viewedSnapshot':_0x397d12??null,'snapshotDir':_0x3a7e15,'latestSnapshot':_0x114387[_0x2b8941(0x1b6)]()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0x1929bc=_0x5717;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x169156,workerData:_0x24ec54}=require$$0$1,{algorithmName:_0x125829,algorithmConfig:_0x3c3bb3,dims:_0x162de7,dir:_0x41944d}=_0x24ec54;let _0x1484ea=0x1;const _0x15e9bc=new Map();function _0x27299f(){const _0x5541a3=_0x1484ea++;return new Promise((_0xa4e217,_0xa0673d)=>{const _0x489c2a=_0x5717;_0x15e9bc[_0x489c2a(0x225)](_0x5541a3,{'resolve':_0xa4e217,'reject':_0xa0673d}),_0x169156[_0x489c2a(0x18f)]({'op':_0x489c2a(0x209),'fid':_0x5541a3});});}const _0x1d0bb1={'dims':_0x162de7,'dir':_0x41944d,'fetchAll':_0x27299f,'onChange':()=>_0x1aeeb1()};let _0x54a9f6;if(_0x125829===_0x1929bc(0x1f9))_0x54a9f6=requireHnsw()(_0x3c3bb3,_0x1d0bb1);else{if(_0x125829===_0x1929bc(0x173))_0x54a9f6=requireFlat()(_0x3c3bb3,_0x1d0bb1);else{if(_0x125829===_0x1929bc(0x184))_0x54a9f6=requireUsearch()(_0x3c3bb3,_0x1d0bb1);else throw new Error(_0x1929bc(0x1e7)+_0x125829+'\x22');}}function _0x1aeeb1(){const _0x5c3b38=_0x1929bc;try{_0x169156['postMessage']({'op':'sync','count':_0x54a9f6[_0x5c3b38(0x1ea)](),'info':_0x54a9f6[_0x5c3b38(0x1d0)](),'memory':process['memoryUsage']()});}catch{}}function _0x278527(_0x22b399){const _0x6292f5=_0x1929bc;return(_0x22b399||[])['map'](_0x142fc4=>({'key':_0x142fc4[_0x6292f5(0x194)],'vector':_0x142fc4[_0x6292f5(0x18a)]instanceof Float32Array?_0x142fc4['vector']:new Float32Array(_0x142fc4['vector'])}));}return _0x169156['on'](_0x1929bc(0x19d),async _0x276a6d=>{const _0x10e805=_0x1929bc;if(_0x276a6d['op']===_0x10e805(0x16c)){const _0xf3682a=_0x15e9bc[_0x10e805(0x23e)](_0x276a6d[_0x10e805(0x178)]);if(!_0xf3682a)return;_0x15e9bc[_0x10e805(0x175)](_0x276a6d[_0x10e805(0x178)]);if(_0x276a6d[_0x10e805(0x208)])_0xf3682a[_0x10e805(0x1ce)](new Error(_0x276a6d['error']));else _0xf3682a[_0x10e805(0x169)](_0x278527(_0x276a6d[_0x10e805(0x1c7)]));return;}const {id:_0x22bb54,op:_0x44a6cd,args:_0x189a6d}=_0x276a6d;try{let _0x304606;switch(_0x44a6cd){case _0x10e805(0x20b):{_0x304606=await _0x54a9f6[_0x10e805(0x20b)](_0x189a6d['hasRows']?_0x27299f:null),_0x1aeeb1();break;}case _0x10e805(0x1a8):{const _0x4e826d=_0x189a6d[_0x10e805(0x18a)]instanceof Float32Array?_0x189a6d['vector']:new Float32Array(_0x189a6d['vector']);await _0x54a9f6[_0x10e805(0x1a8)](_0x189a6d['key'],_0x4e826d,_0x189a6d['clock']??undefined),_0x1aeeb1(),_0x304606=null;break;}case'remove':{await _0x54a9f6[_0x10e805(0x174)](_0x189a6d[_0x10e805(0x194)]),_0x1aeeb1(),_0x304606=null;break;}case'search':{const _0x113a56=_0x189a6d['queryVec']instanceof Float32Array?_0x189a6d[_0x10e805(0x171)]:new Float32Array(_0x189a6d[_0x10e805(0x171)]);_0x304606=_0x54a9f6[_0x10e805(0x203)](_0x113a56,_0x189a6d[_0x10e805(0x1ae)]||{});break;}case'snapshot':{_0x304606=await _0x54a9f6[_0x10e805(0x1b4)](_0x189a6d['clock']),_0x1aeeb1();break;}case _0x10e805(0x1ad):{const _0x3e62cf=_0x278527(_0x189a6d[_0x10e805(0x1c7)]);await _0x54a9f6[_0x10e805(0x1ad)](async()=>_0x3e62cf),_0x1aeeb1(),_0x304606=null;break;}case _0x10e805(0x231):{await _0x54a9f6['stop'](),_0x1aeeb1(),_0x304606=null;break;}case _0x10e805(0x1ea):{_0x304606=_0x54a9f6[_0x10e805(0x1ea)]();break;}case'info':{_0x304606=_0x54a9f6[_0x10e805(0x1d0)]();break;}default:throw new Error(_0x10e805(0x183)+_0x44a6cd+'\x22');}_0x169156[_0x10e805(0x18f)]({'id':_0x22bb54,'result':_0x304606});}catch(_0x3325d3){_0x169156['postMessage']({'id':_0x22bb54,'error':{'message':_0x3325d3?.[_0x10e805(0x19d)]||String(_0x3325d3),'code':_0x3325d3?.[_0x10e805(0x1a0)]}});}}),_0x169156[_0x1929bc(0x18f)]({'op':_0x1929bc(0x1b0)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module[_0x5db5a4(0x23c)]=algorithmWorkerThread;
|