@kedem/okdb 2.3.0 → 2.3.3
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 +111 -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,117 @@ 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.3] - 2026-09-24
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **Two processes opening a new store with `OKDB_LICENSE_FILE` are both licensed.** The install
|
|
12
|
+
created the `~licenses` type with a check-then-register, so when two processes (e.g. a
|
|
13
|
+
supervisor and its worker) opened a brand-new store at once, the loser threw "Register Type
|
|
14
|
+
Error: ~licenses already registered", logged `OKDB_LICENSE_FILE not installed` and ran on the
|
|
15
|
+
free tier until restarted. The type is now get-or-created (`ensureType`), a process that finds
|
|
16
|
+
the license already stored by its peer loads it, and a license's record id is derived from the
|
|
17
|
+
license itself, so a concurrent install no longer stores it twice (the id keeps its UUID
|
|
18
|
+
shape). The same get-or-create now covers the other lazily created types that raced the same
|
|
19
|
+
way: `~tokens`, `~files`, embeddings vector types and the indexer's `doc_status` re-creation
|
|
20
|
+
after a rebuild.
|
|
21
|
+
|
|
22
|
+
## [2.3.2] - 2026-09-24
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- **An index-maintenance error now aborts the write.** Secondary-index upkeep runs inside the
|
|
27
|
+
writer's transaction; an error there used to be logged and swallowed, so the document committed
|
|
28
|
+
without its index row (a unique index then silently stopped enforcing uniqueness for that key).
|
|
29
|
+
The error now fails the commit and the whole transaction rolls back. Writes that used to
|
|
30
|
+
"succeed" while silently skipping the index will now throw.
|
|
31
|
+
- **A non-scalar value in an indexed field is rejected with `INVALID_INDEX_KEY`.** An object,
|
|
32
|
+
array or `Date` in an indexed field could never be indexed; such writes committed without an
|
|
33
|
+
index row and now fail (see above). Index fields take `null`/missing, strings, numbers,
|
|
34
|
+
booleans, bigints or Buffers. A document already stored with such a value (from an earlier
|
|
35
|
+
version) stays updatable and removable: an unindexable old value is treated as having no row.
|
|
36
|
+
- **The console log sink honours `OKDB_LOG_LEVEL` (default `info`).** It printed every level, so
|
|
37
|
+
debug lines such as the queue's per-job "job claimed" reached the console. Set
|
|
38
|
+
`OKDB_LOG_LEVEL=debug` to get them back. The `~log` and relay sinks are unchanged.
|
|
39
|
+
- **The embeddings `_durable*` accessors are async.** `_durableIndexerStats`,
|
|
40
|
+
`_durableIndexerDocs`, `_durableIndexerDoc` and `_durableWorkerStats` now return promises (see
|
|
41
|
+
Fixed); callers must `await` them. The HTTP routes and pipeline inspect already do.
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
|
|
45
|
+
- **Unique indexes lost their row under a stale lmdb key buffer.** lmdb-js `getValues()` inside a
|
|
46
|
+
write transaction decodes a discarded key from a shared buffer that can still hold the previous
|
|
47
|
+
write's bytes; when those looked like an ordered-binary number the read threw ("The number
|
|
48
|
+
4.7e-66 cannot be converted to a BigInt"). The unique-index check hit it right after its own
|
|
49
|
+
write, and with the error swallowed the job committed without its index row, so the queue's
|
|
50
|
+
idempotency dedup was bypassed (seen while claiming embedding jobs in bulk). Duplicate-value
|
|
51
|
+
reads that can run in a write transaction (index uniqueness, views' live map, time machine,
|
|
52
|
+
FTS live tiers) now use key-bounded range reads that never decode stale bytes. Vacating a
|
|
53
|
+
`null` index key no longer counts the whole `null`-key duplicate set (every claimed queue job
|
|
54
|
+
did this).
|
|
55
|
+
- **The embeddings indexer no longer fails a drain on a duplicate job.** Queue-mode indexing
|
|
56
|
+
enqueues a batch in one transaction, so the queue's idempotency fallback didn't apply: a peer
|
|
57
|
+
enqueueing the same doc between the check and the commit failed the batch ("processor drain
|
|
58
|
+
error … Unique constraint violated") and the drain retried. The duplicate now folds into the
|
|
59
|
+
pending job, as a single `enqueue` does.
|
|
60
|
+
- **Queue: a job deleted mid-claim is skipped.** A job removed between the claim scan and the
|
|
61
|
+
claim update threw `NOT_FOUND`, which the consumer logged as "worker loop crashed". It is now a
|
|
62
|
+
lost race like a version conflict: the job is skipped and the next one claimed. Both lost-race
|
|
63
|
+
paths return the bucket tokens taken for that job (previously leaked on a version conflict).
|
|
64
|
+
- **A drain waiting for a resolver no longer spins.** On reopen of a store with FTS or an
|
|
65
|
+
embeddings indexer over a `resolveField` field, the processor drained before the app registered
|
|
66
|
+
the resolver and retried in a hot loop (~800 "processor drain error" warnings in 1.5 s). It now
|
|
67
|
+
holds quietly (cursor unchanged, `status().waiting` set, one debug line) and resumes when the
|
|
68
|
+
resolver is registered, on the next write, or on the catch-up tick. A holding process yields
|
|
69
|
+
its lease at once to a peer that wants it.
|
|
70
|
+
- **Embeddings durable stats see pipelines created by another process.** The durable indexer and
|
|
71
|
+
worker stats looked for the pipeline's sub-env only among envs already open, so a process that
|
|
72
|
+
attached before another process created the pipeline reported `done 0 / pending N`. They now
|
|
73
|
+
open the sub-env on demand.
|
|
74
|
+
- **The embeddings restart safety net resets only when vectors are really lost.** It reset the
|
|
75
|
+
cursor whenever the vector store was empty, so a pipeline whose docs legitimately yield no
|
|
76
|
+
vectors re-ran every doc on every restart. It now resets only when `doc_status` is missing or a
|
|
77
|
+
done, non-empty doc expects a vector that isn't there — and that reset now actually re-indexes
|
|
78
|
+
(it drops `doc_status` first, as `rebuild()` does; before, surviving done rows skipped every
|
|
79
|
+
doc).
|
|
80
|
+
|
|
81
|
+
## [2.3.1] - 2026-09-24
|
|
82
|
+
|
|
83
|
+
### Fixed
|
|
84
|
+
|
|
85
|
+
- **`ensureType` is race-safe across processes.** It checked for the type and then registered it
|
|
86
|
+
in a separate step, so two processes creating the same type in a shared env raced and the loser
|
|
87
|
+
threw "Register Type Error: <type> already registered" (seen when two processes opened the same
|
|
88
|
+
fresh env at first boot). The existence check now runs inside the write transaction, and a
|
|
89
|
+
peer's win counts as success. Indexes passed to `ensureType` get the same treatment: an index a
|
|
90
|
+
peer registered is adopted instead of being created or rebuilt a second time. Internal
|
|
91
|
+
check-then-register sites (`~envs`, `~engines`, `~pipelines`, functions, views, process
|
|
92
|
+
registry, `doc_status`, …) now use `ensureType`. An explicit `registerType` of an existing type
|
|
93
|
+
still throws.
|
|
94
|
+
- **The embeddings indexer commits as it goes.** An inline drain embedded every text of its batch
|
|
95
|
+
(up to 1 000 docs) before writing any vector or `doc_status` row. A large bootstrap showed zero
|
|
96
|
+
progress for many minutes (about 19 min for 372 source files on a local model), and a restart in
|
|
97
|
+
that window lost all of it. Vectors and `DONE` rows are now written every ~128 texts
|
|
98
|
+
(`batch` × 4), so progress is visible and durable, and a re-run skips committed docs.
|
|
99
|
+
- **A slow embeddings backlog no longer freezes the rest of the instance.** The indexer drained in
|
|
100
|
+
5 000-change quanta, so a backlog of network-bound embed calls held the instance's processor
|
|
101
|
+
gate for the whole build (FTS and other pipelines' indexers sat still) and tripped the 60 s
|
|
102
|
+
drain deadline into error/retry cycles. It now drains in 32-change quanta, releasing the gate
|
|
103
|
+
between them, with a 10-minute drain deadline. Both can be overridden per pipeline
|
|
104
|
+
(`config.flushQuantum`, `config.drainDeadlineMs`).
|
|
105
|
+
- **`createPipeline` repairs a pipeline whose member engines are missing.** An existing pipeline
|
|
106
|
+
record always refused with "Pipeline already exists", so a record left pointing at engines that
|
|
107
|
+
were gone (removed, or lost to an interrupted create in another process) could never index and
|
|
108
|
+
could not be recovered by re-running an idempotent create. Missing members are now re-created
|
|
109
|
+
(existing ones reused) and a warning names them. A complete pipeline still refuses.
|
|
110
|
+
- **Named processor handlers work with two OKDB instances in one process.** The named-handler
|
|
111
|
+
registry is process-global, but the indexer, pipeline-processor and materializer drivers keep
|
|
112
|
+
their runtime per instance. A processor registered on the first instance after a second
|
|
113
|
+
instance opened dispatched to the second instance's handler, found nothing to do, and advanced
|
|
114
|
+
its cursor anyway, so those changes were silently never processed (e.g. a new pipeline or an
|
|
115
|
+
engine restart on a host's own store while an embedded library's store is also open). Handlers
|
|
116
|
+
now resolve their instance through a driver id carried in the processor payload.
|
|
117
|
+
|
|
7
118
|
## [2.3.0] - 2026-09-24
|
|
8
119
|
|
|
9
120
|
### 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';function _0x2796(){const _0xb675a1=['usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','WRITER.LOCK','key','published','MetricKind','USEARCH_BINDINGS_UNAVAILABLE','warn','efConstruction','hnswlib-node','Original\x20error:\x20','push','reject','token','add','catch','readIndexSync','dir','HierarchicalNSW','min','has','keyToFp','listSnapshotIds','readCurrentClock','prototype','queryVec','from','78PedzFR','state','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20','now','size','added','hasOwnProperty','nextLabel','trunc','manifestVersion','versions','keyForLabel','6OwdHGz','readdirSync','[SnapshotStore]','view','snapshotEveryChanges','repeat','hnsw','writeIndexSync','L2sq','startsWith','_tmp-','clear','SnapshotStore\x20requires\x20dir','set','HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','filter','snapshot\x20id\x20required','byteOffset','entries','loadFrom','snapshotTo','reset','writer','delete','getCurrentCount','opts','vector','reader','snapshotsDir','resizeIndex','29817JErKlu','remove','cause','prune','writeFileSync','closeSync','labelForExisting','labels','memoryUsage','vectors','hasRows','lockPath','dims','buffer','heartbeatIntervalMs','map','unlinkSync','score','keepSnapshots','__esModule','error','slice','readFileSync','arch','labels.json','keys','removed','call','index','worker_threads','tmpMaxAgeMs','readCurrentId','Cos','rebuild','ready','isInteger','tombstone','metric','writerLockMaxAgeMs','SNAPSHOT.LOCK','hostname','1190BJqJfL','number','statSync','\x20on\x20','get','7wSaIFB','viewRefreshMs','resolve','distances','name','cosine','mkdirSync','46080rDeTmS','randomBytes','hex','EEXIST','sort','changed','ceil','hasFingerprints','2717364vXvfvY','Unknown\x20algorithm:\x20\x22','mtimeMs','initIndex',').\x20','index.hnsw','parse','length','trim','imul','usearch\x20algorithm\x20requires\x20dims\x20>\x200','usearch','stop','setFingerprint','fetchAllResult','labelForEphemeral','1259535yzQKvY','isFree','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','keyToLabel','platform','acquire','host','stringify','cleanupTmpDirs','7455984YUTzjZ','setEf','unreadable','sqrt','max','log','.tmp-','efSearch','3307096TIwYet','expansionAdd','fingerprintOf','for\x20Node\x20','default','version','flat','crypto','renameSync','info','publishSnapshot','path','stale','rmSync','candidateClock\x20must\x20be\x20finite\x20>=\x200','ScalarKind','Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20','.tmp','expansionSearch','code','node','snapshotMaxLagMs','lock_busy','Unknown\x20op:\x20\x22','toString','_snapshotPaths','22032714OyfKer','F32','state.json','clock','join','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','postMessage','HNSW_BINDINGS_UNAVAILABLE','count','utf8','then','connectivity','getMaxElements','load','pid','finally','labelToKey','maxElements','_tombstoneCount','latestSnapshotId','isDirectory','loadSnapshot','CURRENT','isFinite','unref','markDelete','message','search','sync','_snapshotDir','growFactor'];_0x2796=function(){return _0xb675a1;};return _0x2796();}const _0x2d7520=_0x3b7a;(function(_0x32c205,_0x32daa7){const _0x1014e4=_0x3b7a,_0x37f58e=_0x32c205();while(!![]){try{const _0x4b52b2=-parseInt(_0x1014e4(0x19c))/0x1*(parseInt(_0x1014e4(0x171))/0x2)+parseInt(_0x1014e4(0x1d9))/0x3+-parseInt(_0x1014e4(0x1fa))/0x4+parseInt(_0x1014e4(0x1e9))/0x5*(-parseInt(_0x1014e4(0x17d))/0x6)+parseInt(_0x1014e4(0x1ca))/0x7*(parseInt(_0x1014e4(0x1f2))/0x8)+parseInt(_0x1014e4(0x1d1))/0x9*(-parseInt(_0x1014e4(0x1c5))/0xa)+parseInt(_0x1014e4(0x138))/0xb;if(_0x4b52b2===_0x32daa7)break;else _0x37f58e['push'](_0x37f58e['shift']());}catch(_0x2e115a){_0x37f58e['push'](_0x37f58e['shift']());}}}(_0x2796,0xf1af0));var require$$0$1=require(_0x2d7520(0x1b9)),require$$0=require('fs'),require$$1=require(_0x2d7520(0x129)),require$$2=require('os'),require$$3=require(_0x2d7520(0x125));function getDefaultExportFromCjs(_0x48b6e1){const _0x2fa4bc=_0x2d7520;return _0x48b6e1&&_0x48b6e1[_0x2fa4bc(0x1af)]&&Object[_0x2fa4bc(0x16e)][_0x2fa4bc(0x177)][_0x2fa4bc(0x1b7)](_0x48b6e1,_0x2fa4bc(0x122))?_0x48b6e1[_0x2fa4bc(0x122)]:_0x48b6e1;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x302aee=_0x2d7520;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x3a1d7a=require$$0,_0x4cca24=require$$1,_0x4216e3=require$$2,_0x59c3d9=require$$3;function _0x3cc0ea(){const _0x325987=_0x3b7a;return Date[_0x325987(0x174)]();}function _0x497c11(_0xb90b7){try{return _0x3a1d7a['existsSync'](_0xb90b7);}catch{return![];}}function _0x57aa1c(_0x12b190){const _0x244f4d=_0x3b7a;try{return _0x3a1d7a['readFileSync'](_0x12b190,_0x244f4d(0x141));}catch{return null;}}function _0x5d5390(_0x55dd7a,_0x1af4e4){const _0x359afa=_0x3b7a,_0x344981=_0x55dd7a+_0x359afa(0x1f8)+_0x59c3d9[_0x359afa(0x1d2)](0x6)[_0x359afa(0x136)](_0x359afa(0x1d3));_0x3a1d7a[_0x359afa(0x1a0)](_0x344981,_0x1af4e4),_0x3a1d7a['renameSync'](_0x344981,_0x55dd7a);}function _0x596b85(_0x27cc1f,_0xe39a65=0x10){const _0x113b91=_0x3b7a,_0x39fd82=String(Math[_0x113b91(0x1f6)](0x0,Math['trunc'](_0x27cc1f||0x0)));return _0x39fd82['length']>=_0xe39a65?_0x39fd82:'0'[_0x113b91(0x182)](_0xe39a65-_0x39fd82[_0x113b91(0x1e0)])+_0x39fd82;}return snapshotStore=class _0xc71019{constructor({dir:_0x361cc5,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x2976b1=_0x3b7a;if(!_0x361cc5)throw new Error(_0x2976b1(0x189));this[_0x2976b1(0x167)]=_0x361cc5,this[_0x2976b1(0x19a)]=_0x4cca24['join'](_0x361cc5,'snapshots'),this['currentPath']=_0x4cca24[_0x2976b1(0x13c)](_0x361cc5,_0x2976b1(0x14e)),this[_0x2976b1(0x1a7)]=_0x4cca24[_0x2976b1(0x13c)](_0x361cc5,_0x2976b1(0x1c3)),this[_0x2976b1(0x1ae)]=keepSnapshots,this[_0x2976b1(0x1f7)]=log,_0x3a1d7a[_0x2976b1(0x1d0)](this[_0x2976b1(0x167)],{'recursive':!![]}),_0x3a1d7a[_0x2976b1(0x1d0)](this[_0x2976b1(0x19a)],{'recursive':!![]});}[_0x302aee(0x155)](_0xdf708c){const _0x28f875=_0x302aee;return _0x4cca24[_0x28f875(0x13c)](this[_0x28f875(0x19a)],_0xdf708c);}[_0x302aee(0x137)](_0x32674e){const _0x38d97e=_0x302aee,_0x3ad731=this['_snapshotDir'](_0x32674e);return{'dir':_0x3ad731,'index':_0x4cca24[_0x38d97e(0x13c)](_0x3ad731,_0x38d97e(0x1de)),'labels':_0x4cca24[_0x38d97e(0x13c)](_0x3ad731,_0x38d97e(0x1b4)),'state':_0x4cca24[_0x38d97e(0x13c)](_0x3ad731,_0x38d97e(0x13a))};}[_0x302aee(0x1bb)](){const _0x29ecb2=_0x302aee;if(!_0x497c11(this['currentPath']))return null;const _0x50a526=_0x57aa1c(this['currentPath']);if(!_0x50a526)return null;const _0x5d90c1=String(_0x50a526)[_0x29ecb2(0x1e1)]();return _0x5d90c1||null;}['readCurrentClock'](){const _0x3282a4=_0x302aee,_0x353f4f=this['readCurrentId']();if(!_0x353f4f)return 0x0;const _0x1b0688=Number(_0x353f4f);return Number[_0x3282a4(0x14f)](_0x1b0688)?_0x1b0688:0x0;}[_0x302aee(0x16c)](){const _0xc91c3d=_0x302aee;try{return _0x3a1d7a[_0xc91c3d(0x17e)](this[_0xc91c3d(0x19a)],{'withFileTypes':!![]})[_0xc91c3d(0x18d)](_0x32128c=>_0x32128c[_0xc91c3d(0x14c)]())[_0xc91c3d(0x1ab)](_0x2d70e0=>_0x2d70e0[_0xc91c3d(0x1ce)])[_0xc91c3d(0x18d)](_0x39046a=>!_0x39046a[_0xc91c3d(0x186)](_0xc91c3d(0x1f8)))[_0xc91c3d(0x18d)](_0x68343b=>!_0x68343b['startsWith'](_0xc91c3d(0x187)))[_0xc91c3d(0x1d5)]();}catch{return[];}}['latestSnapshotId'](){const _0x10830c=_0x302aee,_0x1f3d4=this[_0x10830c(0x1bb)]();if(_0x1f3d4)return _0x1f3d4;const _0x5baa6b=this[_0x10830c(0x16c)]();if(!_0x5baa6b[_0x10830c(0x1e0)])return null;return _0x5baa6b[_0x5baa6b[_0x10830c(0x1e0)]-0x1];}[_0x302aee(0x1f1)]({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x5e59bb=_0x302aee;let _0x30b128;try{_0x30b128=_0x3a1d7a[_0x5e59bb(0x17e)](this['snapshotsDir'],{'withFileTypes':!![]});}catch{return;}const _0x257d15=_0x3cc0ea()-maxAgeMs;for(const _0x156f15 of _0x30b128){if(!_0x156f15[_0x5e59bb(0x14c)]())continue;const _0x3a7e38=_0x156f15[_0x5e59bb(0x1ce)];if(!_0x3a7e38[_0x5e59bb(0x186)](_0x5e59bb(0x1f8))&&!_0x3a7e38['startsWith'](_0x5e59bb(0x187)))continue;const _0x4123e5=_0x4cca24[_0x5e59bb(0x13c)](this[_0x5e59bb(0x19a)],_0x3a7e38);try{const _0x294e6d=_0x3a1d7a[_0x5e59bb(0x1c7)](_0x4123e5);if(_0x294e6d[_0x5e59bb(0x1db)]>_0x257d15)continue;}catch{}try{_0x3a1d7a[_0x5e59bb(0x12b)](_0x4123e5,{'recursive':!![],'force':!![]});}catch{}}}['prune']({keep:keep=null}={}){const _0x58250e=_0x302aee,_0x597f4c=Math[_0x58250e(0x1f6)](0x1,Math[_0x58250e(0x179)](keep??this[_0x58250e(0x1ae)]??0x3)),_0x57b969=this[_0x58250e(0x16c)]();if(_0x57b969[_0x58250e(0x1e0)]<=_0x597f4c)return;const _0x9f0ffd=this['readCurrentId'](),_0x4b49e9=_0x57b969[_0x58250e(0x1b1)](0x0,Math[_0x58250e(0x1f6)](0x0,_0x57b969[_0x58250e(0x1e0)]-_0x597f4c));for(const _0x438f3e of _0x4b49e9){if(_0x9f0ffd&&_0x438f3e===_0x9f0ffd)continue;const _0x540b8b=this['_snapshotDir'](_0x438f3e);try{_0x3a1d7a[_0x58250e(0x12b)](_0x540b8b,{'recursive':!![],'force':!![]});}catch{}}}async[_0x302aee(0x14d)](_0x218a19,_0x2c8d1d){const _0x22032d=_0x302aee;if(!_0x218a19)throw new Error(_0x22032d(0x18e));const _0x50c708=this[_0x22032d(0x137)](_0x218a19);if(!_0x497c11(_0x50c708[_0x22032d(0x1b8)])||!_0x497c11(_0x50c708[_0x22032d(0x1a3)])||!_0x497c11(_0x50c708['state']))throw new Error('snapshot\x20incomplete:\x20'+_0x218a19);const _0x4004a2=await _0x2c8d1d(_0x50c708);return _0x4004a2||{};}async['publishSnapshot'](_0x5110c0,_0xd8ee3c,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x1fa840=_0x302aee,_0x13ccdf=Number(_0x5110c0);if(!Number[_0x1fa840(0x14f)](_0x13ccdf)||_0x13ccdf<0x0)throw new Error(_0x1fa840(0x12c));const _0x28c77b=_0x596b85(_0x13ccdf),_0xc3ec3b=this[_0x1fa840(0x155)](_0x28c77b),_0x35f64c=_0x4cca24['join'](this[_0x1fa840(0x19a)],_0x1fa840(0x1f8)+_0x28c77b+'-'+_0x59c3d9[_0x1fa840(0x1d2)](0x6)[_0x1fa840(0x136)](_0x1fa840(0x1d3)));_0x3a1d7a['mkdirSync'](_0x35f64c,{'recursive':!![]});const _0xfbc3e3={'dir':_0x35f64c,'index':_0x4cca24[_0x1fa840(0x13c)](_0x35f64c,'index.hnsw'),'labels':_0x4cca24[_0x1fa840(0x13c)](_0x35f64c,'labels.json'),'state':_0x4cca24[_0x1fa840(0x13c)](_0x35f64c,_0x1fa840(0x13a))};await _0xd8ee3c(_0xfbc3e3,{'id':_0x28c77b,'clock':_0x13ccdf});const _0x56d99f=JSON[_0x1fa840(0x1f0)]({'pid':process[_0x1fa840(0x146)],'host':_0x4216e3[_0x1fa840(0x1c4)](),'at':_0x3cc0ea()}),_0x2db2a7=_0x3cc0ea();let _0xe534d0=null;const _0x287173=()=>{const _0x3dec11=_0x1fa840;try{const _0x44d414=JSON[_0x3dec11(0x1df)](_0x3a1d7a[_0x3dec11(0x1b2)](this['lockPath'],_0x3dec11(0x141)));if(_0x44d414['at']&&_0x3cc0ea()-_0x44d414['at']>staleLockMaxAgeMs){const _0x1a567d=_0x3cc0ea()-_0x44d414['at'],_0x13d1a6=_0x3dec11(0x12e)+Math['round'](_0x1a567d/0x3e8)+'s,\x20pid:\x20'+_0x44d414[_0x3dec11(0x146)]+',\x20host:\x20'+_0x44d414[_0x3dec11(0x1ef)]+_0x3dec11(0x1dd)+_0x3dec11(0x1eb);this[_0x3dec11(0x1f7)]?.[_0x3dec11(0x15d)]?this[_0x3dec11(0x1f7)][_0x3dec11(0x15d)](_0x13d1a6):console['warn'](_0x3dec11(0x17f),_0x13d1a6);try{_0x3a1d7a['unlinkSync'](this[_0x3dec11(0x1a7)]);}catch{}return!![];}}catch{try{_0x3a1d7a[_0x3dec11(0x1ac)](this['lockPath']);}catch{}}return![];},_0x599225=()=>{const _0x114e62=_0x1fa840;try{return _0xe534d0=_0x3a1d7a['openSync'](this[_0x114e62(0x1a7)],'wx'),_0x3a1d7a[_0x114e62(0x1a0)](_0xe534d0,_0x56d99f),!![];}catch(_0x1e6dfc){if(_0x1e6dfc&&_0x1e6dfc['code']===_0x114e62(0x1d4))return![];throw _0x1e6dfc;}};if(!_0x599225()){_0x287173(),_0x599225();if(_0xe534d0==null&&lockTimeoutMs>0x0)while(_0x3cc0ea()-_0x2db2a7<lockTimeoutMs){await new Promise(_0x3d43a1=>setTimeout(_0x3d43a1,0x19));if(_0x599225())break;_0x287173();}}if(_0xe534d0==null){try{_0x3a1d7a[_0x1fa840(0x12b)](_0x35f64c,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x1fa840(0x134)};}try{const _0x5187b6=this['readCurrentClock']();if(_0x13ccdf<=_0x5187b6){try{_0x3a1d7a[_0x1fa840(0x12b)](_0x35f64c,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x1fa840(0x12a),'currentClock':_0x5187b6};}if(!_0x497c11(_0xc3ec3b))_0x3a1d7a['renameSync'](_0x35f64c,_0xc3ec3b);else try{_0x3a1d7a['rmSync'](_0x35f64c,{'recursive':!![],'force':!![]});}catch{}return _0x5d5390(this['currentPath'],_0x28c77b+'\x0a'),this[_0x1fa840(0x19f)]({'keep':keep}),{'published':!![],'currentClock':_0x13ccdf};}finally{try{_0x3a1d7a[_0x1fa840(0x1a1)](_0xe534d0);}catch{}try{_0x3a1d7a[_0x1fa840(0x1ac)](this[_0x1fa840(0x1a7)]);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x343f48=_0x2d7520;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x1f6de5=require$$0;class _0x280409{constructor(){const _0x1b4152=_0x3b7a;this[_0x1b4152(0x1ec)]=new Map(),this['labelToKey']=new Map(),this[_0x1b4152(0x178)]=0x0,this['_tombstoneCount']=0x0,this[_0x1b4152(0x16b)]=new Map(),this['hasFingerprints']=!![];}async[_0x343f48(0x193)](){const _0x2bbbc2=_0x343f48;this[_0x2bbbc2(0x1ec)]=new Map(),this[_0x2bbbc2(0x148)]=new Map(),this[_0x2bbbc2(0x16b)]=new Map(),this[_0x2bbbc2(0x1d8)]=!![],this[_0x2bbbc2(0x178)]=0x0,this[_0x2bbbc2(0x14a)]=0x0;}async[_0x343f48(0x191)](_0xa677ff){const _0x6b9ef3=_0x343f48;if(!_0xa677ff||!_0x1f6de5['existsSync'](_0xa677ff))return await this['reset'](),!![];let _0x19af96;try{_0x19af96=_0x1f6de5[_0x6b9ef3(0x1b2)](_0xa677ff,_0x6b9ef3(0x141));}catch{return await this[_0x6b9ef3(0x193)](),!![];}let _0x8137c0;try{_0x8137c0=JSON[_0x6b9ef3(0x1df)](_0x19af96);}catch{return await this[_0x6b9ef3(0x193)](),!![];}const _0x2b47f5=Array['isArray'](_0x8137c0?.[_0x6b9ef3(0x190)])?_0x8137c0[_0x6b9ef3(0x190)]:[],_0x553c98=Number[_0x6b9ef3(0x1bf)](_0x8137c0?.[_0x6b9ef3(0x178)])?_0x8137c0[_0x6b9ef3(0x178)]:0x0,_0xe23bf1=new Map(),_0x3d9d29=new Map(),_0x47234e=new Map(),_0x2d6e7d=_0x8137c0?.[_0x6b9ef3(0x123)]>=0x2;let _0x37b755=-0x1;for(const _0x4cfd71 of _0x2b47f5){if(!Array['isArray'](_0x4cfd71)||_0x4cfd71[_0x6b9ef3(0x1e0)]<0x2)continue;const _0x4821ac=Number(_0x4cfd71[0x0]),_0x45a787=String(_0x4cfd71[0x1]??'');if(!Number[_0x6b9ef3(0x1bf)](_0x4821ac)||_0x4821ac<0x0)continue;if(!_0x45a787)continue;_0xe23bf1[_0x6b9ef3(0x18a)](_0x45a787,_0x4821ac),_0x3d9d29[_0x6b9ef3(0x18a)](_0x4821ac,_0x45a787);if(_0x2d6e7d&&typeof _0x4cfd71[0x2]===_0x6b9ef3(0x1c6))_0x47234e[_0x6b9ef3(0x18a)](_0x45a787,_0x4cfd71[0x2]);if(_0x4821ac>_0x37b755)_0x37b755=_0x4821ac;}return this[_0x6b9ef3(0x1ec)]=_0xe23bf1,this[_0x6b9ef3(0x148)]=_0x3d9d29,this[_0x6b9ef3(0x16b)]=_0x47234e,this['hasFingerprints']=_0x2d6e7d,this[_0x6b9ef3(0x178)]=Math[_0x6b9ef3(0x1f6)](_0x553c98,_0x37b755+0x1,0x0),this[_0x6b9ef3(0x14a)]=0x0,!![];}[_0x343f48(0x1a2)](_0x5f3698){const _0x6b67ca=_0x343f48;return this[_0x6b67ca(0x1ec)][_0x6b67ca(0x1c9)](_0x5f3698);}['labelForEphemeral'](_0x328306){const _0x1d1cec=_0x343f48;let _0x30c065=this[_0x1d1cec(0x1ec)]['get'](_0x328306);if(_0x30c065!==undefined)return _0x30c065;return _0x30c065=this[_0x1d1cec(0x178)]++,this[_0x1d1cec(0x1ec)][_0x1d1cec(0x18a)](_0x328306,_0x30c065),this[_0x1d1cec(0x148)][_0x1d1cec(0x18a)](_0x30c065,_0x328306),_0x30c065;}[_0x343f48(0x1e6)](_0x3ee1a7,_0x1a5a69){const _0x21f279=_0x343f48;if(_0x1a5a69==null)this[_0x21f279(0x16b)]['delete'](_0x3ee1a7);else this[_0x21f279(0x16b)][_0x21f279(0x18a)](_0x3ee1a7,_0x1a5a69);}[_0x343f48(0x1fc)](_0x48bafd){const _0x709436=_0x343f48;return this[_0x709436(0x16b)]['get'](_0x48bafd);}[_0x343f48(0x1b5)](){return this['keyToLabel']['keys']();}[_0x343f48(0x1c0)](_0x23837b){const _0x22c04c=_0x343f48,_0x344bcf=this[_0x22c04c(0x1ec)]['get'](_0x23837b);if(_0x344bcf===undefined)return;this['keyToFp']['delete'](_0x23837b),this[_0x22c04c(0x1ec)][_0x22c04c(0x195)](_0x23837b),this[_0x22c04c(0x148)][_0x22c04c(0x195)](_0x344bcf),this[_0x22c04c(0x14a)]++;}[_0x343f48(0x17c)](_0xb22bee){const _0x161918=_0x343f48;return this[_0x161918(0x148)][_0x161918(0x1c9)](_0xb22bee)??null;}[_0x343f48(0x175)](){const _0x6a8303=_0x343f48;return this[_0x6a8303(0x1ec)][_0x6a8303(0x175)];}['tombstoneCount'](){const _0xea8b4a=_0x343f48;return this[_0xea8b4a(0x14a)];}async[_0x343f48(0x192)](_0x4661c4){const _0x54d090=_0x343f48,_0x402a84=_0x4661c4+_0x54d090(0x12f),_0x50efcb=[];for(const [_0x5154d6,_0x529603]of this[_0x54d090(0x148)][_0x54d090(0x190)]()){const _0x25543b=this['keyToFp'][_0x54d090(0x1c9)](_0x529603);_0x50efcb[_0x54d090(0x161)](_0x25543b==null?[_0x5154d6,_0x529603]:[_0x5154d6,_0x529603,_0x25543b]);}_0x50efcb[_0x54d090(0x1d5)]((_0x4a08ef,_0x3fe522)=>_0x4a08ef[0x0]-_0x3fe522[0x0]);const _0x1edd7e={'version':0x2,'nextLabel':this['nextLabel'],'entries':_0x50efcb};_0x1f6de5['writeFileSync'](_0x402a84,JSON[_0x54d090(0x1f0)](_0x1edd7e)),_0x1f6de5[_0x54d090(0x126)](_0x402a84,_0x4661c4);}}return labelMap=_0x280409,labelMap;}var indexConvergence,hasRequiredIndexConvergence;function requireIndexConvergence(){if(hasRequiredIndexConvergence)return indexConvergence;hasRequiredIndexConvergence=0x1;function _0x7517a2(_0x40db98){const _0x1d464a=_0x3b7a,_0x3986e6=new Uint32Array(_0x40db98[_0x1d464a(0x1a9)],_0x40db98[_0x1d464a(0x18f)],_0x40db98['length']);let _0x28076f=0x811c9dc5,_0xf6c068=0x9747b28c;for(let _0xec47e8=0x0;_0xec47e8<_0x3986e6[_0x1d464a(0x1e0)];_0xec47e8++){const _0x559735=_0x3986e6[_0xec47e8];_0x28076f=Math[_0x1d464a(0x1e2)](_0x28076f^_0x559735,0x1000193)>>>0x0;let _0x5a7d4b=Math[_0x1d464a(0x1e2)](_0x559735,0xcc9e2d51);_0x5a7d4b=_0x5a7d4b<<0xf|_0x5a7d4b>>>0x11,_0xf6c068=Math[_0x1d464a(0x1e2)](_0xf6c068^Math[_0x1d464a(0x1e2)](_0x5a7d4b,0x1b873593),0x5)+0xe6546b64,_0xf6c068>>>=0x0;}return _0xf6c068=Math[_0x1d464a(0x1e2)](_0xf6c068^_0xf6c068>>>0x10,0x85ebca6b)>>>0x0,(_0x28076f>>>0x0)*0x100000+(_0xf6c068&0xfffff);}function _0x7ec065(_0xf5c61d,_0x1c56c0,_0x53ddf2,{upsert:_0x48ace7,remove:_0x23b5b8}){const _0x2847f3=_0x3b7a,_0x83e91f=new Set();let _0x4ac256=0x0,_0x69d7b3=0x0,_0x2e33ed=0x0;for(const {key:_0x5a82f5,vector:_0x5539d6}of _0x1c56c0){if(!(_0x5539d6 instanceof Float32Array)||_0x5539d6[_0x2847f3(0x1e0)]!==_0x53ddf2)continue;_0x83e91f[_0x2847f3(0x164)](_0x5a82f5);const _0x2f2eb7=_0x7517a2(_0x5539d6),_0x302127=_0xf5c61d[_0x2847f3(0x1a2)](_0x5a82f5)!==undefined;if(_0x302127&&_0xf5c61d['fingerprintOf'](_0x5a82f5)===_0x2f2eb7)continue;_0x48ace7(_0x5a82f5,_0x5539d6,_0x2f2eb7);if(_0x302127)_0x69d7b3++;else _0x4ac256++;}for(const _0x40ed73 of[..._0xf5c61d[_0x2847f3(0x1b5)]()]){if(_0x83e91f[_0x2847f3(0x16a)](_0x40ed73))continue;_0x23b5b8(_0x40ed73),_0x2e33ed++;}return{'added':_0x4ac256,'changed':_0x69d7b3,'removed':_0x2e33ed};}return indexConvergence={'fingerprint':_0x7517a2,'reconcileIndex':_0x7ec065},indexConvergence;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x3861f9=requireSnapshotStore(),_0x2389fe=requireLabelMap(),{fingerprint:_0x26d219,reconcileIndex:_0x259bec}=requireIndexConvergence(),_0x235f15=0x1;let _0x464552=null;function _0x2e710b(){const _0x32e2a5=_0x3b7a;if(_0x464552)return _0x464552;try{return _0x464552=require(_0x32e2a5(0x15f)),_0x464552;}catch(_0x4a1124){const _0x496243=new Error(_0x32e2a5(0x18b)+('for\x20Node\x20'+process[_0x32e2a5(0x17b)][_0x32e2a5(0x132)]+_0x32e2a5(0x1c8)+process[_0x32e2a5(0x1ed)]+'/'+process[_0x32e2a5(0x1b3)]+'.\x20')+_0x32e2a5(0x173)+(_0x32e2a5(0x160)+(_0x4a1124?.[_0x32e2a5(0x152)]||String(_0x4a1124))));_0x496243[_0x32e2a5(0x131)]=_0x32e2a5(0x13f),_0x496243[_0x32e2a5(0x19e)]=_0x4a1124;throw _0x496243;}}return hnsw=function _0x43fb6a(_0x411353={},{dims:_0x306740,dir:_0x4c8091}){const _0x1c6874=_0x3b7a,_0x5a381c=_0x2e710b();if(!_0x306740||_0x306740<=0x0)throw new Error(_0x1c6874(0x13d));if(!_0x4c8091)throw new Error(_0x1c6874(0x18c));const _0x338170={'metric':_0x411353[_0x1c6874(0x1c1)]??_0x1c6874(0x1cf),'M':_0x411353['M']??0x10,'efConstruction':_0x411353['efConstruction']??0xc8,'efSearch':_0x411353[_0x1c6874(0x1f9)]??0x40,'maxElements':_0x411353[_0x1c6874(0x149)]??0x400,'growFactor':_0x411353[_0x1c6874(0x156)]??0x2,'snapshotEveryChanges':_0x411353[_0x1c6874(0x181)]??0xc350,'keepSnapshots':_0x411353[_0x1c6874(0x1ae)]??0x2,'tmpMaxAgeMs':_0x411353[_0x1c6874(0x1ba)]??0x6*0x36ee80},_0x597b7f=new _0x3861f9({'dir':_0x4c8091,'keepSnapshots':_0x338170['keepSnapshots']}),_0x23d149=new _0x2389fe();let _0x33b82e=null,_0x26a31a=0x0,_0x513576=null,_0x505697=Promise[_0x1c6874(0x1cc)]();const _0x470420=_0x418ffe=>{const _0x53874a=_0x1c6874,_0x4f194b=_0x505697['then'](_0x418ffe);return _0x505697=_0x4f194b[_0x53874a(0x165)](()=>{}),_0x4f194b;};async function _0x4dffb8(_0x30cbd7){const _0x134bdb=_0x1c6874;await _0x23d149[_0x134bdb(0x193)](),_0x30cbd7=_0x30cbd7??[];const _0x30551e=Math[_0x134bdb(0x1f6)](_0x338170['maxElements'],Math[_0x134bdb(0x1d7)](_0x30cbd7[_0x134bdb(0x1e0)]*(_0x338170['growFactor']||1.2)),0x1);_0x33b82e=new _0x5a381c['HierarchicalNSW'](_0x338170['metric'],_0x306740),_0x33b82e[_0x134bdb(0x1dc)]({'maxElements':_0x30551e,'efConstruction':_0x338170[_0x134bdb(0x15e)],'M':_0x338170['M']});for(const {key:_0x52deaf,vector:_0x27e393}of _0x30cbd7){if(!(_0x27e393 instanceof Float32Array)||_0x27e393['length']!==_0x306740)continue;_0x5c8063(_0x52deaf,_0x27e393);}_0x33b82e[_0x134bdb(0x1f3)](_0x338170[_0x134bdb(0x1f9)]),_0x26a31a=0x0;}async function _0x2f12e2(_0x23c676){return _0x4dffb8(_0x23c676?await _0x23c676():[]);}function _0x21f690(){const _0x37926f=_0x1c6874;if(_0x33b82e[_0x37926f(0x196)]()<_0x33b82e[_0x37926f(0x144)]())return;const _0x5f0578=Math['ceil'](_0x33b82e['getMaxElements']()*(_0x338170[_0x37926f(0x156)]||0x2));_0x33b82e[_0x37926f(0x19b)](_0x5f0578),_0x338170[_0x37926f(0x149)]=_0x5f0578;}function _0x5c8063(_0x5e8c99,_0x1df3e8,_0x181706){const _0x333440=_0x1c6874,_0x32937e=_0x23d149['labelForEphemeral'](_0x5e8c99);try{_0x33b82e[_0x333440(0x151)](_0x32937e);}catch{}_0x21f690(),_0x33b82e['addPoint'](Array['from'](_0x1df3e8),_0x32937e),_0x23d149['setFingerprint'](_0x5e8c99,_0x181706??_0x26d219(_0x1df3e8));}function _0xfadb88(_0x5aa320){const _0x2a546e=_0x1c6874,_0x29faeb=_0x23d149[_0x2a546e(0x1a2)](_0x5aa320);if(_0x29faeb===undefined)return![];try{_0x33b82e[_0x2a546e(0x151)](_0x29faeb);}catch{}return _0x23d149[_0x2a546e(0x1c0)](_0x5aa320),!![];}function _0x3b261e(){return Math['max'](Date['now'](),_0x597b7f['readCurrentClock']()+0x1);}async function _0x4e7edf(_0x393bfd){const _0x2abcf7=_0x1c6874;if(!_0x33b82e||!_0x393bfd)return![];const _0x329b00=await _0x597b7f['publishSnapshot'](_0x393bfd,async _0x59014c=>{const _0x52babf=_0x3b7a;_0x33b82e[_0x52babf(0x184)](_0x59014c['index']),await _0x23d149[_0x52babf(0x192)](_0x59014c['labels']);const _0x5c1b3d=require$$0;_0x5c1b3d[_0x52babf(0x1a0)](_0x59014c[_0x52babf(0x172)],JSON[_0x52babf(0x1f0)]({'manifestVersion':_0x235f15,'dims':_0x306740,'metric':_0x338170[_0x52babf(0x1c1)],'clock':_0x393bfd,'snapshotAt':Date[_0x52babf(0x174)]()},null,0x2));},{'keep':_0x338170['keepSnapshots']});if(_0x329b00?.['published'])_0x26a31a=0x0;return _0x329b00?.[_0x2abcf7(0x15a)]??![];}async function _0x5b085e(){const _0x2585a5=_0x1c6874,_0x27ff64=_0x597b7f['readCurrentId']()||_0x597b7f[_0x2585a5(0x14b)]();if(!_0x27ff64)return null;let _0x243bc1,_0x3ec26b=![];return await _0x597b7f[_0x2585a5(0x14d)](_0x27ff64,async _0x1c05b9=>{const _0x7ca507=_0x2585a5,_0x1fa02a=require$$0;_0x243bc1=JSON[_0x7ca507(0x1df)](_0x1fa02a[_0x7ca507(0x1b2)](_0x1c05b9[_0x7ca507(0x172)],_0x7ca507(0x141)));if(_0x243bc1[_0x7ca507(0x17a)]!==_0x235f15||_0x243bc1[_0x7ca507(0x1a8)]!==_0x306740||_0x243bc1[_0x7ca507(0x1c1)]!==_0x338170[_0x7ca507(0x1c1)]){_0x243bc1=null;return;}await _0x23d149[_0x7ca507(0x191)](_0x1c05b9[_0x7ca507(0x1a3)]),_0x33b82e=new _0x5a381c[(_0x7ca507(0x168))](_0x338170[_0x7ca507(0x1c1)],_0x306740),_0x33b82e[_0x7ca507(0x166)](_0x1c05b9[_0x7ca507(0x1b8)]),_0x33b82e[_0x7ca507(0x1f3)](_0x338170[_0x7ca507(0x1f9)]),_0x3ec26b=!![];}),_0x3ec26b?_0x243bc1?.[_0x2585a5(0x13b)]??0x0:null;}return{async 'load'(_0x51719e){return _0x470420(async()=>{const _0x45fa80=_0x3b7a;_0x597b7f['cleanupTmpDirs']({'maxAgeMs':_0x338170[_0x45fa80(0x1ba)]}),_0x513576=_0x51719e??null;const _0x506fdb=await _0x5b085e(),_0x13c2b0=_0x51719e?await _0x51719e():null;if(_0x506fdb!=null){if(_0x13c2b0){if(!_0x23d149[_0x45fa80(0x1d8)])return await _0x4dffb8(_0x13c2b0),null;const _0x5adc97=_0x259bec(_0x23d149,_0x13c2b0,_0x306740,{'upsert':_0x5c8063,'remove':_0xfadb88});_0x26a31a+=_0x5adc97['added']+_0x5adc97['changed']+_0x5adc97[_0x45fa80(0x1b6)];}return _0x506fdb;}return await _0x4dffb8(_0x13c2b0),null;});},async 'add'(_0x3e460b,_0x1d9cd9,_0x245fbf){return _0x470420(async()=>{const _0x543d5f=_0x3b7a;if(!_0x33b82e)return;const _0xc9d8c3=_0x1d9cd9 instanceof Float32Array?_0x1d9cd9:new Float32Array(_0x1d9cd9),_0x5a1ff6=_0x26d219(_0xc9d8c3);if(_0x23d149[_0x543d5f(0x1fc)](_0x3e460b)===_0x5a1ff6)return;_0x5c8063(_0x3e460b,_0xc9d8c3,_0x5a1ff6),_0x26a31a++,_0x26a31a>=_0x338170[_0x543d5f(0x181)]&&await _0x4e7edf(_0x3b261e());});},async 'remove'(_0xc63d1){return _0x470420(async()=>{if(!_0x33b82e)return;if(_0xfadb88(_0xc63d1))_0x26a31a++;});},'search'(_0x46baf2,{limit:limit=0xa,efSearch:_0x13fe46}={}){const _0x21c5ba=_0x1c6874;if(!_0x33b82e)return[];if(Number['isInteger'](_0x13fe46))_0x33b82e[_0x21c5ba(0x1f3)](_0x13fe46);const _0x475d9a=Math[_0x21c5ba(0x169)](limit,_0x33b82e[_0x21c5ba(0x196)]()||0x1),{neighbors:_0x1c558c,distances:_0x63fb39}=_0x33b82e['searchKnn'](Array[_0x21c5ba(0x170)](_0x46baf2),_0x475d9a),_0xe33b91=[];for(let _0x22e5b5=0x0;_0x22e5b5<_0x1c558c['length'];_0x22e5b5++){const _0x243abd=_0x23d149['keyForLabel'](_0x1c558c[_0x22e5b5]);if(!_0x243abd)continue;const _0x533589=_0x338170[_0x21c5ba(0x1c1)]===_0x21c5ba(0x1cf)?Math[_0x21c5ba(0x1f6)](0x0,0x1-_0x63fb39[_0x22e5b5]):0x1/(0x1+_0x63fb39[_0x22e5b5]);_0xe33b91['push']({'key':_0x243abd,'score':_0x533589});}return _0xe33b91;},async 'snapshot'(_0xed07ea){return _0x470420(()=>_0x4e7edf(_0xed07ea??_0x3b261e()));},async 'rebuild'(_0x6ff0d7){return _0x470420(()=>{if(_0x6ff0d7!=null)_0x513576=_0x6ff0d7;return _0x2f12e2(_0x6ff0d7??_0x513576);});},async 'stop'(){const _0x519547=_0x1c6874;return _0x470420(()=>_0x26a31a>0x0||!_0x597b7f[_0x519547(0x1bb)]()?_0x4e7edf(_0x3b261e()):![]);},'count'(){const _0x287a2c=_0x1c6874;return _0x23d149[_0x287a2c(0x175)]();},'info'(){const _0x10a549=_0x1c6874;return{'algorithm':_0x10a549(0x183),'metric':_0x338170[_0x10a549(0x1c1)],'M':_0x338170['M'],'efConstruction':_0x338170[_0x10a549(0x15e)],'efSearch':_0x338170['efSearch'],'maxElements':_0x33b82e?.['getMaxElements']()??_0x338170[_0x10a549(0x149)],'count':_0x23d149[_0x10a549(0x175)](),'changesSince':_0x26a31a,'snapshotDir':_0x4c8091,'latestSnapshot':_0x597b7f[_0x10a549(0x1bb)]()??null};}};},hnsw;}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x3b8fd4(_0x1719f4={}){const _0x4c7748=new Map();return{async 'load'(_0x1ccfa0){const _0xd9c3c0=_0x3b7a;_0x4c7748[_0xd9c3c0(0x188)]();if(_0x1ccfa0)for(const {key:_0x41f6b7,vector:_0x54007a}of await _0x1ccfa0()){_0x4c7748[_0xd9c3c0(0x18a)](_0x41f6b7,_0x54007a);}},async 'add'(_0x373644,_0x3cd71d,_0x2931fc){const _0x1a5b51=_0x3b7a;_0x4c7748[_0x1a5b51(0x18a)](_0x373644,_0x3cd71d);},async 'remove'(_0x16e853){const _0x4bcd85=_0x3b7a;_0x4c7748[_0x4bcd85(0x195)](_0x16e853);},'search'(_0x277960,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x13ae0f=_0x3b7a,_0x188670=[];for(const [_0x265978,_0x3fe8ad]of _0x4c7748){const _0x204a17=_0x2622ae(_0x277960,_0x3fe8ad);if(_0x204a17>=threshold)_0x188670['push']({'key':_0x265978,'score':_0x204a17});}return _0x188670[_0x13ae0f(0x1d5)]((_0x4ed360,_0x116e0d)=>_0x116e0d[_0x13ae0f(0x1ad)]-_0x4ed360[_0x13ae0f(0x1ad)]),_0x188670[_0x13ae0f(0x1b1)](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x5f08b8){await this['load'](_0x5f08b8);},async 'stop'(){},'count'(){const _0x35bc16=_0x3b7a;return _0x4c7748[_0x35bc16(0x175)];},'info'(){const _0x485aee=_0x3b7a;return{'algorithm':_0x485aee(0x124),'count':_0x4c7748[_0x485aee(0x175)]};}};};function _0x2622ae(_0x16ce2f,_0x217994){const _0xd4bf65=_0x3b7a;let _0x289639=0x0,_0xd09fb0=0x0,_0x1a615a=0x0;for(let _0xc1f89c=0x0;_0xc1f89c<_0x16ce2f[_0xd4bf65(0x1e0)];_0xc1f89c++){_0x289639+=_0x16ce2f[_0xc1f89c]*_0x217994[_0xc1f89c],_0xd09fb0+=_0x16ce2f[_0xc1f89c]*_0x16ce2f[_0xc1f89c],_0x1a615a+=_0x217994[_0xc1f89c]*_0x217994[_0xc1f89c];}const _0x4ee72c=Math['sqrt'](_0xd09fb0)*Math[_0xd4bf65(0x1f5)](_0x1a615a);return _0x4ee72c===0x0?0x0:_0x289639/_0x4ee72c;}return flat;}var writerLock,hasRequiredWriterLock;function _0x3b7a(_0x4e8a32,_0x341b50){_0x4e8a32=_0x4e8a32-0x121;const _0x27967f=_0x2796();let _0x3b7a2b=_0x27967f[_0x4e8a32];return _0x3b7a2b;}function requireWriterLock(){if(hasRequiredWriterLock)return writerLock;hasRequiredWriterLock=0x1;const _0x4c9979=require$$0,_0xab8532=require$$1,_0x1a06c4=require$$3;return writerLock=function _0x58f464(_0x494e22,{maxAgeMs:maxAgeMs=0x3a98,heartbeatMs:heartbeatMs=0x1388,onLost:onLost=null}={}){const _0xc61720=_0x3b7a,_0x5df197=_0xab8532[_0xc61720(0x13c)](_0x494e22,_0xc61720(0x158)),_0x405111=_0x1a06c4[_0xc61720(0x1d2)](0x8)[_0xc61720(0x136)](_0xc61720(0x1d3));let _0x4fcfd6=![],_0x18b818=null;const _0x1b71e7=()=>JSON[_0xc61720(0x1f0)]({'pid':process['pid'],'token':_0x405111,'at':Date['now']()});function _0x53539b(){const _0x15cf6f=_0xc61720;try{return JSON[_0x15cf6f(0x1df)](_0x4c9979[_0x15cf6f(0x1b2)](_0x5df197,_0x15cf6f(0x141)));}catch(_0x2755ea){return _0x2755ea?.['code']==='ENOENT'?null:{'unreadable':!![]};}}function _0x4d0530(){const _0x4a9fed=_0xc61720;try{const _0x3e3ffc=_0x4c9979['openSync'](_0x5df197,'wx');try{_0x4c9979['writeFileSync'](_0x3e3ffc,_0x1b71e7());}finally{_0x4c9979[_0x4a9fed(0x1a1)](_0x3e3ffc);}return!![];}catch(_0x53b568){if(_0x53b568?.[_0x4a9fed(0x131)]==='EEXIST')return![];throw _0x53b568;}}function _0x3cf160(_0x22e9d6){if(!_0x22e9d6)return!![];if(_0x22e9d6['unreadable'])return!![];return Date['now']()-(_0x22e9d6['at']??0x0)>=maxAgeMs;}function _0x30c36a(){if(_0x18b818)clearInterval(_0x18b818);_0x18b818=null;}function _0x2202e6(){const _0x23fdda=_0xc61720;_0x30c36a(),_0x18b818=setInterval(()=>{const _0x3c1392=_0x3b7a,_0xb41201=_0x53539b();if(_0xb41201&&!_0xb41201[_0x3c1392(0x1f4)]&&_0xb41201[_0x3c1392(0x163)]!==_0x405111){_0x4fcfd6=![],_0x30c36a();try{onLost?.();}catch{}return;}try{_0x4c9979[_0x3c1392(0x1a0)](_0x5df197,_0x1b71e7());}catch{}},heartbeatMs),_0x18b818[_0x23fdda(0x150)]?.();}function _0x1c4839(){const _0x4e34ed=_0xc61720,_0x4af8de=_0x53539b();return!!_0x4af8de&&_0x4af8de[_0x4e34ed(0x163)]===_0x405111;}return{'path':_0x5df197,'token':_0x405111,'acquire'(){const _0x5e8248=_0x53539b();if(_0x5e8248&&_0x5e8248['token']===_0x405111){_0x4fcfd6=!![];if(!_0x18b818)_0x2202e6();return!![];}let _0x256800=_0x4d0530();if(!_0x256800&&_0x3cf160(_0x53539b())){try{_0x4c9979['unlinkSync'](_0x5df197);}catch{}_0x256800=_0x4d0530();}if(_0x256800&&!_0x1c4839())_0x256800=![];_0x4fcfd6=_0x256800;if(_0x256800)_0x2202e6();return _0x256800;},'held'(){return _0x4fcfd6;},'isFree'(){const _0x46c5cd=_0xc61720,_0x3a084c=_0x53539b();if(_0x3a084c&&_0x3a084c[_0x46c5cd(0x163)]===_0x405111)return![];return _0x3cf160(_0x3a084c);},'release'(){_0x30c36a();if(!_0x4fcfd6)return;_0x4fcfd6=![];if(_0x1c4839())try{_0x4c9979['unlinkSync'](_0x5df197);}catch{}}};},writerLock;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x537f62=require$$0,_0x3bc4d0=requireSnapshotStore(),_0x87a1ee=requireLabelMap(),_0x198c82=requireWriterLock(),{fingerprint:_0xe6b816,reconcileIndex:_0x330383}=requireIndexConvergence(),_0x76bce1=0x1;let _0x312e0e=null;function _0x5787ae(){const _0x220efc=_0x3b7a;if(_0x312e0e)return _0x312e0e;try{return _0x312e0e=require(_0x220efc(0x1e4)),_0x312e0e;}catch(_0x295a4f){const _0x4dd9fd=new Error('usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20'+(_0x220efc(0x121)+process[_0x220efc(0x17b)][_0x220efc(0x132)]+_0x220efc(0x1c8)+process[_0x220efc(0x1ed)]+'/'+process[_0x220efc(0x1b3)]+'.\x20')+'Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20'+(_0x220efc(0x160)+(_0x295a4f?.[_0x220efc(0x152)]||String(_0x295a4f))));_0x4dd9fd[_0x220efc(0x131)]=_0x220efc(0x15c),_0x4dd9fd['cause']=_0x295a4f;throw _0x4dd9fd;}}function _0x23f049(_0x3e2673,_0x43197a){const _0x2751f6=_0x3b7a;switch(_0x3e2673){case _0x2751f6(0x1cf):return _0x43197a[_0x2751f6(0x15b)]['Cos'];case'l2':return _0x43197a['MetricKind'][_0x2751f6(0x185)];case'ip':return _0x43197a[_0x2751f6(0x15b)]['IP'];default:return _0x43197a[_0x2751f6(0x15b)][_0x2751f6(0x1bc)];}}return usearch=function _0x2d8694(_0x9feea8={},{dims:_0x486b74,dir:_0x4f24e9,fetchAll:fetchAll=null,onChange:onChange=null}={}){const _0x53fa46=_0x3b7a,_0x27032a=_0x5787ae();if(!_0x486b74||_0x486b74<=0x0)throw new Error(_0x53fa46(0x1e3));if(!_0x4f24e9)throw new Error(_0x53fa46(0x157));const _0x1c1484={'metric':_0x9feea8[_0x53fa46(0x1c1)]??_0x53fa46(0x1cf),'connectivity':_0x9feea8[_0x53fa46(0x143)]??0x10,'expansionAdd':_0x9feea8[_0x53fa46(0x1fb)]??0x80,'expansionSearch':_0x9feea8['expansionSearch']??0x40,'snapshotEveryChanges':_0x9feea8[_0x53fa46(0x181)]??0xc350,'snapshotMaxLagMs':_0x9feea8[_0x53fa46(0x133)]??0x2710,'keepSnapshots':_0x9feea8[_0x53fa46(0x1ae)]??0x2,'tmpMaxAgeMs':_0x9feea8[_0x53fa46(0x1ba)]??0x6*0x36ee80,'heartbeatIntervalMs':_0x9feea8[_0x53fa46(0x1aa)]??0x1388,'writerLockMaxAgeMs':_0x9feea8[_0x53fa46(0x1c2)]??0x3a98,'viewRefreshMs':_0x9feea8[_0x53fa46(0x1cb)]??0x3e8},_0x2d2127=new _0x3bc4d0({'dir':_0x4f24e9,'keepSnapshots':_0x1c1484[_0x53fa46(0x1ae)]}),_0x518c8d=_0x198c82(_0x4f24e9,{'maxAgeMs':_0x1c1484[_0x53fa46(0x1c2)],'heartbeatMs':_0x1c1484[_0x53fa46(0x1aa)],'onLost':()=>{const _0x4260bf=_0x53fa46;_0x4ca809(_0x15cbab)[_0x4260bf(0x165)](()=>{});}});let _0x42e893=new _0x87a1ee(),_0x215c73=null,_0x36e97c=0x0,_0x16b451=null,_0x45a9d7=![],_0x3122ad=![],_0x2d2f9c=null,_0x196c81=0x0,_0x4c4965=null,_0x13eec5=0x0,_0x5c3942=![],_0x1a62d9=Promise[_0x53fa46(0x1cc)]();const _0x4ca809=_0x1847bd=>{const _0x4daf4e=_0x53fa46,_0xe0a699=_0x1a62d9[_0x4daf4e(0x142)](_0x1847bd);return _0x1a62d9=_0xe0a699['catch'](()=>{}),_0xe0a699;},_0x4efd42=()=>{try{onChange?.();}catch{}};function _0x4ab8b9(){const _0x252f62=_0x53fa46;return new _0x27032a['Index']({'dimensions':_0x486b74,'metric':_0x23f049(_0x1c1484['metric'],_0x27032a),'quantization':_0x27032a[_0x252f62(0x12d)][_0x252f62(0x139)],'connectivity':_0x1c1484[_0x252f62(0x143)],'expansion_add':_0x1c1484[_0x252f62(0x1fb)],'expansion_search':_0x1c1484[_0x252f62(0x130)],'multi':![]});}function _0x35312d(_0x58665b){return _0x58665b instanceof Float32Array?_0x58665b:new Float32Array(_0x58665b);}function _0x5c1751(){const _0x66a8a8=_0x53fa46;if(fetchAll)return fetchAll();if(_0x16b451)return _0x16b451();return Promise[_0x66a8a8(0x1cc)](null);}function _0xe2b793(_0x1c2077,_0x42adb1,_0x2fd543){const _0x46d9df=_0x53fa46,_0x5bcf65=_0x42e893[_0x46d9df(0x1a2)](_0x1c2077);if(_0x5bcf65!==undefined)try{_0x215c73[_0x46d9df(0x19d)](BigInt(_0x5bcf65));}catch{}const _0x39a909=_0x42e893[_0x46d9df(0x1e8)](_0x1c2077);_0x215c73[_0x46d9df(0x164)](BigInt(_0x39a909),_0x42adb1),_0x42e893[_0x46d9df(0x1e6)](_0x1c2077,_0x2fd543??_0xe6b816(_0x42adb1));}function _0x109561(_0x116473){const _0x27d3a7=_0x53fa46,_0x5f00e9=_0x42e893[_0x27d3a7(0x1a2)](_0x116473);if(_0x5f00e9===undefined)return![];try{_0x215c73[_0x27d3a7(0x19d)](BigInt(_0x5f00e9));}catch{}return _0x42e893['tombstone'](_0x116473),!![];}function _0x4413d3(_0x2b6025){const _0xcc845d=_0x53fa46;_0x42e893=new _0x87a1ee(),_0x215c73=_0x4ab8b9();for(const {key:_0x54ae2e,vector:_0x38e2df}of _0x2b6025??[]){if(!(_0x38e2df instanceof Float32Array)||_0x38e2df[_0xcc845d(0x1e0)]!==_0x486b74)continue;_0xe2b793(_0x54ae2e,_0x38e2df);}_0x36e97c=0x0;}function _0x2c916e(){const _0x5e686c=_0x53fa46;return Math[_0x5e686c(0x1f6)](Date['now'](),_0x2d2127[_0x5e686c(0x16d)]()+0x1);}function _0x191928(){if(_0x2d2f9c)clearTimeout(_0x2d2f9c);_0x2d2f9c=null;}function _0x2b1ac2(){const _0x2834c5=_0x53fa46;if(!_0x1c1484['snapshotMaxLagMs']||_0x2d2f9c||!_0x3122ad||_0x36e97c<=0x0)return;const _0xcd887d=Math['max'](_0x1c1484[_0x2834c5(0x133)],0xa*_0x196c81);_0x2d2f9c=setTimeout(()=>{const _0x39ee5e=_0x2834c5;_0x2d2f9c=null,_0x4ca809(async()=>{if(_0x3122ad&&_0x36e97c>0x0)await _0x233827();_0x2b1ac2(),_0x4efd42();})[_0x39ee5e(0x165)](()=>{});},_0xcd887d),_0x2d2f9c[_0x2834c5(0x150)]?.();}async function _0x233827(_0x3aa331){const _0x4cede3=_0x53fa46;if(!_0x215c73)return![];const _0x3fb2cc=_0x3aa331??_0x2c916e(),_0x1c97e6=Date[_0x4cede3(0x174)](),_0x222a3a=await _0x2d2127[_0x4cede3(0x128)](_0x3fb2cc,async _0x2256df=>{const _0x5c57d0=_0x4cede3;_0x215c73['save'](_0x2256df['index']),await _0x42e893['snapshotTo'](_0x2256df[_0x5c57d0(0x1a3)]),_0x537f62['writeFileSync'](_0x2256df[_0x5c57d0(0x172)],JSON[_0x5c57d0(0x1f0)]({'manifestVersion':_0x76bce1,'algorithm':_0x5c57d0(0x1e4),'dims':_0x486b74,'metric':_0x1c1484[_0x5c57d0(0x1c1)],'clock':_0x3fb2cc,'snapshotAt':Date[_0x5c57d0(0x174)]()},null,0x2));},{'keep':_0x1c1484['keepSnapshots']});return _0x196c81=Date[_0x4cede3(0x174)]()-_0x1c97e6,_0x222a3a?.[_0x4cede3(0x15a)]&&(_0x36e97c=0x0,_0x191928()),_0x222a3a?.[_0x4cede3(0x15a)]??![];}function _0x38e48a(){const _0x42fabd=_0x53fa46;_0x36e97c++;if(_0x36e97c>=_0x1c1484[_0x42fabd(0x181)])return _0x233827();return _0x2b1ac2(),null;}async function _0xccae2f(){const _0x3099a3=_0x53fa46,_0x419039=_0x2d2127[_0x3099a3(0x1bb)]()||_0x2d2127[_0x3099a3(0x14b)]();if(!_0x419039)return null;let _0x1be271,_0x5c5a15=![];try{await _0x2d2127[_0x3099a3(0x14d)](_0x419039,async _0x3c8ce0=>{const _0x343cd9=_0x3099a3;_0x1be271=JSON['parse'](_0x537f62['readFileSync'](_0x3c8ce0[_0x343cd9(0x172)],'utf8'));if(_0x1be271[_0x343cd9(0x17a)]!==_0x76bce1||_0x1be271['algorithm']!==_0x343cd9(0x1e4)||_0x1be271[_0x343cd9(0x1a8)]!==_0x486b74||_0x1be271[_0x343cd9(0x1c1)]!==_0x1c1484[_0x343cd9(0x1c1)]){_0x1be271=null;return;}const _0x3c7702=new _0x87a1ee();await _0x3c7702[_0x343cd9(0x191)](_0x3c8ce0[_0x343cd9(0x1a3)]);const _0x8ceb3b=_0x4ab8b9();_0x8ceb3b['load'](_0x3c8ce0[_0x343cd9(0x1b8)]),_0x42e893=_0x3c7702,_0x215c73=_0x8ceb3b,_0x5c5a15=!![];});}catch{return null;}return _0x5c5a15?_0x1be271?.['clock']??0x0:null;}async function _0x40d42f(_0x1f0de5){const _0x336fc8=_0x53fa46;_0x4c4965=null;const _0x3b0df2=await _0xccae2f();if(_0x3b0df2!=null){_0x36e97c=0x0;if(_0x1f0de5){if(!_0x42e893[_0x336fc8(0x1d8)])return _0x4413d3(_0x1f0de5),await _0x233827(),null;const _0x479eab=_0x330383(_0x42e893,_0x1f0de5,_0x486b74,{'upsert':_0xe2b793,'remove':_0x109561}),_0x3ab961=_0x479eab[_0x336fc8(0x176)]+_0x479eab[_0x336fc8(0x1d6)]+_0x479eab['removed'];_0x3ab961>0x0&&(_0x36e97c+=_0x3ab961,await _0x233827());}return _0x3b0df2;}_0x4413d3(_0x1f0de5??[]);if(_0x215c73['size']()>0x0)await _0x233827();return null;}async function _0x32f846(){_0x3122ad=!![],await _0x40d42f(await _0x5c1751());}async function _0x15cbab(){const _0x3a10c0=_0x53fa46;if(!_0x3122ad)return;_0x3122ad=![],_0x191928(),_0x36e97c=0x0;const _0x2ab60f=_0x2d2127[_0x3a10c0(0x1bb)]()||_0x2d2127[_0x3a10c0(0x14b)]();await _0x590cfd(_0x2ab60f),_0x4efd42();}async function _0x590cfd(_0x463893){const _0x249654=_0x53fa46;if(!_0x463893)return![];let _0x20c331=![];try{await _0x2d2127[_0x249654(0x14d)](_0x463893,async _0x11daf5=>{const _0x112bd1=_0x249654,_0x6cd542=JSON['parse'](_0x537f62[_0x112bd1(0x1b2)](_0x11daf5[_0x112bd1(0x172)],_0x112bd1(0x141)));if(_0x6cd542[_0x112bd1(0x17a)]!==_0x76bce1||_0x6cd542['algorithm']!=='usearch'||_0x6cd542[_0x112bd1(0x1a8)]!==_0x486b74||_0x6cd542[_0x112bd1(0x1c1)]!==_0x1c1484[_0x112bd1(0x1c1)])return;const _0x3672de=new _0x87a1ee();await _0x3672de[_0x112bd1(0x191)](_0x11daf5['labels']);const _0x5918d3=_0x4ab8b9();_0x5918d3[_0x112bd1(0x180)](_0x11daf5[_0x112bd1(0x1b8)]),_0x215c73=_0x5918d3,_0x42e893=_0x3672de,_0x4c4965=_0x463893,_0x20c331=!![];});}catch{}return _0x20c331;}function _0x5ae799(){const _0x1470a2=_0x53fa46,_0x31f653=Date[_0x1470a2(0x174)]();if(_0x31f653-_0x13eec5<_0x1c1484[_0x1470a2(0x1cb)])return;_0x13eec5=_0x31f653;if(_0x5c3942)return;if(_0x518c8d[_0x1470a2(0x1ea)]()){_0x5c3942=!![],_0x4ca809(async()=>{!_0x3122ad&&_0x45a9d7&&_0x518c8d['acquire']()&&(await _0x32f846(),_0x4efd42());})[_0x1470a2(0x165)](()=>{})[_0x1470a2(0x147)](()=>{_0x5c3942=![];});return;}const _0x376de9=_0x2d2127[_0x1470a2(0x1bb)]()||_0x2d2127[_0x1470a2(0x14b)]();if(!_0x376de9||_0x376de9===_0x4c4965)return;_0x5c3942=!![],_0x4ca809(async()=>{if(!_0x3122ad&&await _0x590cfd(_0x376de9))_0x4efd42();})[_0x1470a2(0x165)](()=>{})[_0x1470a2(0x147)](()=>{_0x5c3942=![];});}return{async 'load'(_0x1b7191){return _0x4ca809(async()=>{const _0x3ad04e=_0x3b7a;_0x2d2127[_0x3ad04e(0x1f1)]({'maxAgeMs':_0x1c1484['tmpMaxAgeMs']}),_0x16b451=_0x1b7191??null,_0x3122ad=_0x518c8d[_0x3ad04e(0x1ee)]();let _0xd43fa5=null;if(_0x3122ad)_0xd43fa5=await _0x40d42f(_0x1b7191?await _0x1b7191():null);else{const _0x253c1b=_0x2d2127[_0x3ad04e(0x1bb)]()||_0x2d2127[_0x3ad04e(0x14b)]();await _0x590cfd(_0x253c1b);}return _0x45a9d7=!![],_0xd43fa5;});},async 'add'(_0x13c5df,_0x14d73f,_0x22b24f){return _0x4ca809(async()=>{const _0x3e5bc7=_0x3b7a;if(!_0x45a9d7)return;const _0x3cb691=_0x35312d(_0x14d73f);if(!_0x3122ad){if(!_0x518c8d[_0x3e5bc7(0x1ee)]())return;await _0x32f846();}if(!_0x215c73)return;const _0x577def=_0xe6b816(_0x3cb691);if(_0x42e893['fingerprintOf'](_0x13c5df)===_0x577def)return;_0xe2b793(_0x13c5df,_0x3cb691,_0x577def),await _0x38e48a();});},async 'remove'(_0x2710a2){return _0x4ca809(async()=>{const _0x4d80be=_0x3b7a;if(!_0x45a9d7)return;if(!_0x3122ad){if(!_0x518c8d[_0x4d80be(0x1ee)]())return;await _0x32f846();}if(!_0x215c73)return;if(_0x109561(_0x2710a2))await _0x38e48a();});},'search'(_0x32e96f,{limit:limit=0xa}={}){const _0x119de3=_0x53fa46;if(!_0x3122ad&&_0x45a9d7)_0x5ae799();if(!_0x215c73)return[];const _0x49dd77=_0x215c73[_0x119de3(0x175)]();if(_0x49dd77===0x0)return[];const _0x303d28=Math[_0x119de3(0x169)](limit,_0x49dd77),_0x86e203=_0x215c73['search'](_0x35312d(_0x32e96f),_0x303d28,0x0),_0x3bca28=[],_0x30421b=_0x86e203[_0x119de3(0x1b5)],_0x224f72=_0x86e203[_0x119de3(0x1cd)];for(let _0x1c7d83=0x0;_0x1c7d83<_0x30421b['length'];_0x1c7d83++){const _0x19fd97=_0x30421b[_0x1c7d83];if(_0x19fd97===0xffffffffffffffffn)continue;const _0x95a3f5=Number(_0x19fd97),_0x45a3e9=_0x42e893[_0x119de3(0x17c)](_0x95a3f5);if(!_0x45a3e9)continue;const _0x1259e4=_0x224f72[_0x1c7d83];let _0x55a6c3;if(_0x1c1484[_0x119de3(0x1c1)]===_0x119de3(0x1cf))_0x55a6c3=Math[_0x119de3(0x1f6)](0x0,0x1-_0x1259e4);else{if(_0x1c1484[_0x119de3(0x1c1)]==='ip')_0x55a6c3=-_0x1259e4;else _0x55a6c3=0x1/(0x1+_0x1259e4);}_0x3bca28[_0x119de3(0x161)]({'key':_0x45a3e9,'score':_0x55a6c3});}return _0x3bca28;},async 'snapshot'(_0x4aea80){return _0x4ca809(()=>_0x3122ad?_0x233827(_0x4aea80??undefined):![]);},async 'rebuild'(_0x5d80fd){return _0x4ca809(async()=>{if(_0x5d80fd!=null)_0x16b451=_0x5d80fd;if(!_0x3122ad){if(!_0x518c8d['acquire']())return;_0x3122ad=!![];}const _0x439674=_0x5d80fd?await _0x5d80fd():await _0x5c1751();_0x4413d3(_0x439674??[]),_0x45a9d7=!![],await _0x233827();});},async 'stop'(){return _0x4ca809(async()=>{_0x191928();if(_0x3122ad){if(_0x36e97c>0x0||!_0x2d2127['readCurrentId']())await _0x233827();_0x518c8d['release']();}_0x3122ad=![],_0x45a9d7=![];});},'count'(){return _0x42e893['size']();},'info'(){const _0x3f3d8e=_0x53fa46;return{'algorithm':_0x3f3d8e(0x1e4),'role':_0x3122ad?_0x3f3d8e(0x194):_0x3f3d8e(0x199),'metric':_0x1c1484[_0x3f3d8e(0x1c1)],'connectivity':_0x1c1484[_0x3f3d8e(0x143)],'expansionAdd':_0x1c1484[_0x3f3d8e(0x1fb)],'expansionSearch':_0x1c1484[_0x3f3d8e(0x130)],'snapshotEveryChanges':_0x1c1484['snapshotEveryChanges'],'snapshotMaxLagMs':_0x1c1484[_0x3f3d8e(0x133)],'count':_0x42e893[_0x3f3d8e(0x175)](),'size':_0x215c73?.[_0x3f3d8e(0x175)]?.()??0x0,'capacity':_0x215c73?.['capacity']?.()??0x0,'changesSince':_0x3122ad?_0x36e97c:null,'viewedSnapshot':_0x4c4965??null,'snapshotDir':_0x4f24e9,'latestSnapshot':_0x2d2127[_0x3f3d8e(0x1bb)]()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0x2bc72f=_0x2d7520;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x84704,workerData:_0xb46431}=require$$0$1,{algorithmName:_0x20c697,algorithmConfig:_0x104c4a,dims:_0x25aa9f,dir:_0x356614}=_0xb46431;let _0x285972=0x1;const _0x7c02ae=new Map();function _0x106602(){const _0xc8858a=_0x285972++;return new Promise((_0x3bedc0,_0x454ffd)=>{const _0x4d537c=_0x3b7a;_0x7c02ae[_0x4d537c(0x18a)](_0xc8858a,{'resolve':_0x3bedc0,'reject':_0x454ffd}),_0x84704['postMessage']({'op':'fetchAll','fid':_0xc8858a});});}const _0x491c62={'dims':_0x25aa9f,'dir':_0x356614,'fetchAll':_0x106602,'onChange':()=>_0x387960()};let _0x600e70;if(_0x20c697===_0x2bc72f(0x183))_0x600e70=requireHnsw()(_0x104c4a,_0x491c62);else{if(_0x20c697===_0x2bc72f(0x124))_0x600e70=requireFlat()(_0x104c4a,_0x491c62);else{if(_0x20c697===_0x2bc72f(0x1e4))_0x600e70=requireUsearch()(_0x104c4a,_0x491c62);else throw new Error(_0x2bc72f(0x1da)+_0x20c697+'\x22');}}function _0x387960(){const _0x13d165=_0x2bc72f;try{_0x84704['postMessage']({'op':_0x13d165(0x154),'count':_0x600e70[_0x13d165(0x140)](),'info':_0x600e70[_0x13d165(0x127)](),'memory':process[_0x13d165(0x1a4)]()});}catch{}}function _0x81b102(_0x2dd0c2){const _0x1fe71a=_0x2bc72f;return(_0x2dd0c2||[])[_0x1fe71a(0x1ab)](_0x4c352f=>({'key':_0x4c352f['key'],'vector':_0x4c352f[_0x1fe71a(0x198)]instanceof Float32Array?_0x4c352f[_0x1fe71a(0x198)]:new Float32Array(_0x4c352f[_0x1fe71a(0x198)])}));}return _0x84704['on'](_0x2bc72f(0x152),async _0x4a5734=>{const _0x407617=_0x2bc72f;if(_0x4a5734['op']===_0x407617(0x1e7)){const _0x45888a=_0x7c02ae[_0x407617(0x1c9)](_0x4a5734['fid']);if(!_0x45888a)return;_0x7c02ae[_0x407617(0x195)](_0x4a5734['fid']);if(_0x4a5734[_0x407617(0x1b0)])_0x45888a[_0x407617(0x162)](new Error(_0x4a5734['error']));else _0x45888a['resolve'](_0x81b102(_0x4a5734['vectors']));return;}const {id:_0x3f2b63,op:_0x3830a4,args:_0x37fc02}=_0x4a5734;try{let _0x4606c5;switch(_0x3830a4){case _0x407617(0x145):{_0x4606c5=await _0x600e70[_0x407617(0x145)](_0x37fc02[_0x407617(0x1a6)]?_0x106602:null),_0x387960();break;}case _0x407617(0x164):{const _0x57b38b=_0x37fc02[_0x407617(0x198)]instanceof Float32Array?_0x37fc02['vector']:new Float32Array(_0x37fc02[_0x407617(0x198)]);await _0x600e70[_0x407617(0x164)](_0x37fc02[_0x407617(0x159)],_0x57b38b,_0x37fc02[_0x407617(0x13b)]??undefined),_0x387960(),_0x4606c5=null;break;}case _0x407617(0x19d):{await _0x600e70[_0x407617(0x19d)](_0x37fc02[_0x407617(0x159)]),_0x387960(),_0x4606c5=null;break;}case _0x407617(0x153):{const _0x563045=_0x37fc02[_0x407617(0x16f)]instanceof Float32Array?_0x37fc02[_0x407617(0x16f)]:new Float32Array(_0x37fc02['queryVec']);_0x4606c5=_0x600e70[_0x407617(0x153)](_0x563045,_0x37fc02[_0x407617(0x197)]||{});break;}case'snapshot':{_0x4606c5=await _0x600e70['snapshot'](_0x37fc02[_0x407617(0x13b)]),_0x387960();break;}case _0x407617(0x1bd):{const _0x574f89=_0x81b102(_0x37fc02[_0x407617(0x1a5)]);await _0x600e70['rebuild'](async()=>_0x574f89),_0x387960(),_0x4606c5=null;break;}case _0x407617(0x1e5):{await _0x600e70[_0x407617(0x1e5)](),_0x387960(),_0x4606c5=null;break;}case _0x407617(0x140):{_0x4606c5=_0x600e70[_0x407617(0x140)]();break;}case _0x407617(0x127):{_0x4606c5=_0x600e70[_0x407617(0x127)]();break;}default:throw new Error(_0x407617(0x135)+_0x3830a4+'\x22');}_0x84704[_0x407617(0x13e)]({'id':_0x3f2b63,'result':_0x4606c5});}catch(_0x2aee9d){_0x84704[_0x407617(0x13e)]({'id':_0x3f2b63,'error':{'message':_0x2aee9d?.[_0x407617(0x152)]||String(_0x2aee9d),'code':_0x2aee9d?.[_0x407617(0x131)]}});}}),_0x84704[_0x2bc72f(0x13e)]({'op':_0x2bc72f(0x1be)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module['exports']=algorithmWorkerThread;
|