@kedem/okdb 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +126 -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
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@kedem/okdb` are documented here. Format loosely follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/); versions follow [SemVer](https://semver.org/).
|
|
5
|
+
Dates are release dates.
|
|
6
|
+
|
|
7
|
+
## [2.2.1] - 2026-08-25
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **Regression in 2.2.0**: `query()` with an `index` + `reverse: true` + any bound (`prefix`,
|
|
12
|
+
flat `startIndex`/`endIndex`, or the nested `index: {fields, start, end}` form) silently
|
|
13
|
+
returned zero rows instead of the correct descending range. Caused by 2.2.0's own
|
|
14
|
+
`byIndex`/`getIndex`/`countByIndex` reverse-swap fix stacking on top of `query()`'s
|
|
15
|
+
pre-existing internal swap — the two canceled out. Fixed by splitting `byIndex()` into a
|
|
16
|
+
public normalizing wrapper and a private `_byIndexCore` that `query()` calls directly,
|
|
17
|
+
bypassing the double normalization. Direct `byIndex()`/`getIndex()`/`countByIndex()` callers
|
|
18
|
+
are unaffected.
|
|
19
|
+
|
|
20
|
+
## [2.2.0] - 2026-08-25
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- `byIndex`/`getIndex`/`countByIndex({prefix})` silently ignored `prefix` and returned the
|
|
25
|
+
whole unfiltered index instead of a prefix match.
|
|
26
|
+
- `byIndex`/`getIndex`/`countByIndex` combined with `reverse: true` and natural-order
|
|
27
|
+
`start`/`end` silently returned zero rows (lmdb's own reverse convention wants `start` as
|
|
28
|
+
the higher bound; these now swap automatically, matching the documented direction-independent
|
|
29
|
+
contract).
|
|
30
|
+
- `query()` silently ignored a flat `start`/`end` option (only `startIndex`/`endIndex`, or the
|
|
31
|
+
nested `index: {start, end}` form, were ever wired up) and ran an unfiltered scan instead.
|
|
32
|
+
Passing `start`/`end` now throws immediately, pointing at the correct option names.
|
|
33
|
+
- `OKDBTransaction.query()` was not honoring `useReadTransaction` — a `txn.query()` call inside
|
|
34
|
+
a `useReadTransaction: true` transaction silently read live data instead of the transaction's
|
|
35
|
+
pinned consistent snapshot, unlike its `getRange`/`byIndex`/`get` siblings on the same
|
|
36
|
+
transaction. `query()` now threads the transaction through correctly.
|
|
37
|
+
- `$countBy` view results: `docs/views.md` and `types/features/views.d.ts` documented/typed a
|
|
38
|
+
plain `{ [groupKey]: { value } }` shape; the actual (correct, unchanged) runtime shape is the
|
|
39
|
+
paginated `{ totalGroups, preview: [...], hasMore, cursor }`. Docs and types corrected to
|
|
40
|
+
match reality — this also affects `$group` and `$ref`-nested grouped reducers, and the
|
|
41
|
+
`range()`/bucketed-view output shape.
|
|
42
|
+
- `docs/embeddings.md`: indexer `stats()` documented as `{ total, pending, embedded, failed }`;
|
|
43
|
+
actual shape is `{ doc_counts: { pending, done, failed, deleted, total }, ... }`.
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- **New strict option validation**: `getRange`, `getKeys`, `getCount`, `getIndex`, `byIndex`,
|
|
48
|
+
`countByIndex`, and `query()` now throw on any option key outside that method's real
|
|
49
|
+
vocabulary, instead of silently ignoring it. This is the root-cause fix behind several of the
|
|
50
|
+
bugs above — an unrecognized option previously produced a plausible wrong answer instead of an
|
|
51
|
+
error. **This can be a breaking change** for callers passing a typo'd, extra, or
|
|
52
|
+
wrong-surface option key that was previously tolerated silently (see `types/options.d.ts`:
|
|
53
|
+
`OKDBQueryOptions` for `query()`'s real vocabulary, `OKDBIndexRangeOptions` for
|
|
54
|
+
`byIndex`/`getIndex`/`countByIndex`'s).
|
|
55
|
+
- `types/options.d.ts`: split `OKDBQueryOptions` (query()'s vocabulary — `start`/`end` removed,
|
|
56
|
+
`endIndex`/`startKey`/`endKey` added) from a new `OKDBIndexRangeOptions`
|
|
57
|
+
(`byIndex`/`getIndex`/`countByIndex`'s lmdb-native vocabulary). They previously shared one
|
|
58
|
+
type, which is how `start`/`end` leaked into `query()`'s type despite never being implemented
|
|
59
|
+
there.
|
|
60
|
+
|
|
61
|
+
### Docs
|
|
62
|
+
|
|
63
|
+
- `docs/querying.md`: added the previously-undocumented `startIndex`/`endIndex` example for
|
|
64
|
+
non-prefix index ranges in `query()`, and notes on the new throw-on-unknown-key behavior and
|
|
65
|
+
the direction-independent `start`/`end` guarantee.
|
|
66
|
+
|
|
67
|
+
## [2.1.2] - 2026-08-21
|
|
68
|
+
|
|
69
|
+
### Fixed
|
|
70
|
+
|
|
71
|
+
- Admin engines page: `ACTIVATION_FAILED` on load — an inline `.ok.html` `<script type="module">`
|
|
72
|
+
is loaded via a blob URL with no hierarchical base, so a relative import to a plain
|
|
73
|
+
(non-`.ok.js`) file failed. Inlined the helper instead of importing it.
|
|
74
|
+
- `release-check.js`'s tag-vs-HEAD comparison broke on annotated tags (`npm version`'s default):
|
|
75
|
+
`refs/tags/<tag>` resolves to the tag _object's_ own SHA for an annotated tag, not the commit
|
|
76
|
+
it points at, so the comparison never matched even when the tag was correctly placed. Now peels
|
|
77
|
+
annotated tags to their target commit before comparing.
|
|
78
|
+
|
|
79
|
+
## [2.1.1] - 2026-08-21
|
|
80
|
+
|
|
81
|
+
### Fixed
|
|
82
|
+
|
|
83
|
+
- Passive-node (`engines: false`) embedding pipeline visibility: a node not running its own
|
|
84
|
+
engines showed members as "missing" with zero progress, and every action
|
|
85
|
+
(retry/rebuild/view vector) either threw `ENGINE_NOT_RUNNING_HERE` or silently no-opped — even
|
|
86
|
+
when the pipeline was running fine on a separate `engines: true` process against the same
|
|
87
|
+
path. Status/progress/actions now distinguish "running elsewhere" (remote) from genuinely
|
|
88
|
+
missing/broken, and read real progress, doc status, vectors, and processor cursors directly
|
|
89
|
+
from durable LMDB state instead of requiring a live in-process engine.
|
|
90
|
+
- `doc_counts.total` was undercounting mid-bootstrap/rebuild (only counted rows touched so far).
|
|
91
|
+
- Doc listing, mark done/failed/deleted, and single/bulk retry now work durably on a passive
|
|
92
|
+
node; empty content is correctly `DONE`, not `FAILED` (was polluting the failed count and
|
|
93
|
+
looping forever on retry).
|
|
94
|
+
- "Re-embed all" actually wipes+resets+re-enqueues now, instead of a silent no-op 200.
|
|
95
|
+
- "View vector" reads vectors directly from LMDB (including chunked pipelines) instead of
|
|
96
|
+
requiring a live engine's in-memory cache.
|
|
97
|
+
- Fixed a vector-write bug where `markDone`/`markDelete` silently skipped the actual vector
|
|
98
|
+
write in the default (no custom resolver) setup.
|
|
99
|
+
- Admin UI: pipeline-list members read the correct response field; progress bar live-updates
|
|
100
|
+
and stays visible at 100% on completion.
|
|
101
|
+
|
|
102
|
+
## [2.1.0] - 2026-08-08
|
|
103
|
+
|
|
104
|
+
### Changed — the safe-range contract (env-balloon fix)
|
|
105
|
+
|
|
106
|
+
LMDB range readers can no longer pin the freelist past a synchronous block: default
|
|
107
|
+
`getRange`/`getKeys`/`getValues` are renewable (an iterator held across an `await` neither
|
|
108
|
+
balloons the file nor breaks); pinned surfaces (`snapshot: true`, `byIndex`/`getIndex`,
|
|
109
|
+
`getChanges`, `useReadTransaction`) throw `READER_HELD_ACROSS_AWAIT` deterministically on
|
|
110
|
+
suspension, with an opt-in `'tolerant'` park-and-resume mode for callers who want it. See
|
|
111
|
+
`docs/upgrade-2.1.md` for the full contract and migration notes.
|
|
112
|
+
|
|
113
|
+
### Added
|
|
114
|
+
|
|
115
|
+
- Storage observability: per-env reclaimable %, reader pins, and compaction outcome surface in
|
|
116
|
+
the admin Environments table and env overview.
|
|
117
|
+
- Compaction temp-dir orphans are reaped on `open()`.
|
|
118
|
+
|
|
119
|
+
## [2.0.x] - 2026-07-07 – 2026-08-08
|
|
120
|
+
|
|
121
|
+
**okdb 2.0: the operator-managed rewrite.** Envs open lazily; async `OKDBWriter` funnels every
|
|
122
|
+
write through one choke point per env; `OKDBProcessor` unifies change-subscription across
|
|
123
|
+
views/indexes/FTS/materializer/embeddings/time-machine with a cooperative hold-window lease as
|
|
124
|
+
the load balancer; HTTP clustering, the function sandbox, and subscriptions v2 landed. See
|
|
125
|
+
`docs/upgrade-2.0.md` and the Architecture section of `CLAUDE.md` for the full model — this file
|
|
126
|
+
starts tracking change-by-change detail from 2.1.0 onward.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const _0x67fb04=_0x43a8;(function(_0x5d1045,_0x1944e8){const _0x476e47=_0x43a8,_0x2a10c1=_0x5d1045();while(!![]){try{const _0x4f834f=parseInt(_0x476e47(0x124))/0x1+parseInt(_0x476e47(0x181))/0x2+parseInt(_0x476e47(0xd7))/0x3*(parseInt(_0x476e47(0x144))/0x4)+parseInt(_0x476e47(0xc3))/0x5*(-parseInt(_0x476e47(0x16a))/0x6)+parseInt(_0x476e47(0x10b))/0x7*(-parseInt(_0x476e47(0x183))/0x8)+-parseInt(_0x476e47(0x120))/0x9+-parseInt(_0x476e47(0x145))/0xa;if(_0x4f834f===_0x1944e8)break;else _0x2a10c1['push'](_0x2a10c1['shift']());}catch(_0x9f50a5){_0x2a10c1['push'](_0x2a10c1['shift']());}}}(_0x5bc2,0xf1ced));var require$$0$1=require(_0x67fb04(0xdf)),require$$0=require('fs'),require$$1=require('path'),require$$2=require('os'),require$$3=require(_0x67fb04(0x180));function getDefaultExportFromCjs(_0x46e66f){const _0x4cad82=_0x67fb04;return _0x46e66f&&_0x46e66f[_0x4cad82(0x12f)]&&Object[_0x4cad82(0x16d)]['hasOwnProperty'][_0x4cad82(0xed)](_0x46e66f,_0x4cad82(0xc2))?_0x46e66f[_0x4cad82(0xc2)]:_0x46e66f;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x22df5b=_0x67fb04;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x36a16c=require$$0,_0x1e8021=require$$1,_0x54b1d4=require$$2,_0x1d06f1=require$$3;function _0x4d6b2e(){const _0x4fd817=_0x43a8;return Date[_0x4fd817(0xcd)]();}function _0x420189(_0x19e7a5){const _0x11a1eb=_0x43a8;try{return _0x36a16c[_0x11a1eb(0xd4)](_0x19e7a5);}catch{return![];}}function _0x4f2378(_0x540d8c){const _0x44268d=_0x43a8;try{return _0x36a16c[_0x44268d(0x123)](_0x540d8c,_0x44268d(0xe6));}catch{return null;}}function _0x4e1dbd(_0x3b92f8,_0x1a5381){const _0x116b16=_0x43a8,_0x3e44fc=_0x3b92f8+_0x116b16(0x10e)+_0x1d06f1[_0x116b16(0x15b)](0x6)[_0x116b16(0xd8)](_0x116b16(0x14b));_0x36a16c[_0x116b16(0x179)](_0x3e44fc,_0x1a5381),_0x36a16c[_0x116b16(0x136)](_0x3e44fc,_0x3b92f8);}function _0x37381b(_0x58bcaa,_0x5d788b=0x10){const _0x3d1100=_0x43a8,_0x46c577=String(Math[_0x3d1100(0x11c)](0x0,Math[_0x3d1100(0x173)](_0x58bcaa||0x0)));return _0x46c577[_0x3d1100(0x13c)]>=_0x5d788b?_0x46c577:'0'['repeat'](_0x5d788b-_0x46c577[_0x3d1100(0x13c)])+_0x46c577;}return snapshotStore=class _0x4c5d79{constructor({dir:_0x38c571,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x232269=_0x43a8;if(!_0x38c571)throw new Error(_0x232269(0x119));this['dir']=_0x38c571,this[_0x232269(0xde)]=_0x1e8021[_0x232269(0xfb)](_0x38c571,_0x232269(0x104)),this[_0x232269(0x176)]=_0x1e8021[_0x232269(0xfb)](_0x38c571,'CURRENT'),this[_0x232269(0xeb)]=_0x1e8021['join'](_0x38c571,_0x232269(0xdb)),this[_0x232269(0x152)]=keepSnapshots,this[_0x232269(0x113)]=log,_0x36a16c[_0x232269(0x13d)](this[_0x232269(0x12d)],{'recursive':!![]}),_0x36a16c[_0x232269(0x13d)](this[_0x232269(0xde)],{'recursive':!![]});}['_snapshotDir'](_0x492011){const _0x263157=_0x43a8;return _0x1e8021[_0x263157(0xfb)](this['snapshotsDir'],_0x492011);}[_0x22df5b(0xee)](_0x52ed32){const _0xa6f367=_0x22df5b,_0x894038=this[_0xa6f367(0xca)](_0x52ed32);return{'dir':_0x894038,'index':_0x1e8021[_0xa6f367(0xfb)](_0x894038,_0xa6f367(0x14c)),'labels':_0x1e8021['join'](_0x894038,_0xa6f367(0x127)),'state':_0x1e8021[_0xa6f367(0xfb)](_0x894038,_0xa6f367(0x13f))};}[_0x22df5b(0x126)](){const _0x22e278=_0x22df5b;if(!_0x420189(this['currentPath']))return null;const _0x412333=_0x4f2378(this['currentPath']);if(!_0x412333)return null;const _0x338e34=String(_0x412333)[_0x22e278(0x12e)]();return _0x338e34||null;}['readCurrentClock'](){const _0x53360f=_0x22df5b,_0x1f8222=this[_0x53360f(0x126)]();if(!_0x1f8222)return 0x0;const _0x4c3588=Number(_0x1f8222);return Number[_0x53360f(0x132)](_0x4c3588)?_0x4c3588:0x0;}['listSnapshotIds'](){const _0x556f4a=_0x22df5b;try{return _0x36a16c[_0x556f4a(0xc8)](this[_0x556f4a(0xde)],{'withFileTypes':!![]})[_0x556f4a(0xda)](_0x31ab71=>_0x31ab71['isDirectory']())['map'](_0xa3a48e=>_0xa3a48e['name'])['filter'](_0x2d17ca=>!_0x2d17ca[_0x556f4a(0xd3)](_0x556f4a(0x10e)))[_0x556f4a(0xda)](_0x420233=>!_0x420233[_0x556f4a(0xd3)](_0x556f4a(0x150)))[_0x556f4a(0x103)]();}catch{return[];}}[_0x22df5b(0xf9)](){const _0x14cee1=_0x22df5b,_0x238680=this[_0x14cee1(0x126)]();if(_0x238680)return _0x238680;const _0x18ad0a=this[_0x14cee1(0x17a)]();if(!_0x18ad0a[_0x14cee1(0x13c)])return null;return _0x18ad0a[_0x18ad0a['length']-0x1];}[_0x22df5b(0xf7)]({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x46a488=_0x22df5b;let _0x103f8d;try{_0x103f8d=_0x36a16c[_0x46a488(0xc8)](this[_0x46a488(0xde)],{'withFileTypes':!![]});}catch{return;}const _0x52ccd0=_0x4d6b2e()-maxAgeMs;for(const _0x140197 of _0x103f8d){if(!_0x140197[_0x46a488(0xf3)]())continue;const _0x464027=_0x140197[_0x46a488(0x122)];if(!_0x464027['startsWith'](_0x46a488(0x10e))&&!_0x464027[_0x46a488(0xd3)]('_tmp-'))continue;const _0x18378d=_0x1e8021['join'](this[_0x46a488(0xde)],_0x464027);try{const _0x18c7b5=_0x36a16c[_0x46a488(0xe3)](_0x18378d);if(_0x18c7b5[_0x46a488(0xe4)]>_0x52ccd0)continue;}catch{}try{_0x36a16c[_0x46a488(0x10a)](_0x18378d,{'recursive':!![],'force':!![]});}catch{}}}[_0x22df5b(0xfc)]({keep:keep=null}={}){const _0x119956=_0x22df5b,_0x14931d=Math['max'](0x1,Math[_0x119956(0x173)](keep??this['keepSnapshots']??0x3)),_0x21c985=this[_0x119956(0x17a)]();if(_0x21c985[_0x119956(0x13c)]<=_0x14931d)return;const _0xaef5db=this[_0x119956(0x126)](),_0x3afb7c=_0x21c985[_0x119956(0x11e)](0x0,Math['max'](0x0,_0x21c985[_0x119956(0x13c)]-_0x14931d));for(const _0x3805d2 of _0x3afb7c){if(_0xaef5db&&_0x3805d2===_0xaef5db)continue;const _0x2efd1c=this[_0x119956(0xca)](_0x3805d2);try{_0x36a16c['rmSync'](_0x2efd1c,{'recursive':!![],'force':!![]});}catch{}}}async[_0x22df5b(0xd2)](_0x3fd4d4,_0x1aa942){const _0x3ac28c=_0x22df5b;if(!_0x3fd4d4)throw new Error('snapshot\x20id\x20required');const _0x45ab77=this[_0x3ac28c(0xee)](_0x3fd4d4);if(!_0x420189(_0x45ab77['index'])||!_0x420189(_0x45ab77[_0x3ac28c(0x153)])||!_0x420189(_0x45ab77['state']))throw new Error(_0x3ac28c(0xf0)+_0x3fd4d4);const _0x1ae891=await _0x1aa942(_0x45ab77);return _0x1ae891||{};}async[_0x22df5b(0x134)](_0x2080f0,_0x30817f,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0xa04c8f=_0x22df5b,_0x352771=Number(_0x2080f0);if(!Number[_0xa04c8f(0x132)](_0x352771)||_0x352771<0x0)throw new Error('candidateClock\x20must\x20be\x20finite\x20>=\x200');const _0x1a285f=_0x37381b(_0x352771),_0x51bf9d=this[_0xa04c8f(0xca)](_0x1a285f),_0x568e63=_0x1e8021[_0xa04c8f(0xfb)](this['snapshotsDir'],_0xa04c8f(0x10e)+_0x1a285f+'-'+_0x1d06f1[_0xa04c8f(0x15b)](0x6)[_0xa04c8f(0xd8)]('hex'));_0x36a16c[_0xa04c8f(0x13d)](_0x568e63,{'recursive':!![]});const _0x4075b3={'dir':_0x568e63,'index':_0x1e8021[_0xa04c8f(0xfb)](_0x568e63,'index.hnsw'),'labels':_0x1e8021[_0xa04c8f(0xfb)](_0x568e63,_0xa04c8f(0x127)),'state':_0x1e8021[_0xa04c8f(0xfb)](_0x568e63,_0xa04c8f(0x13f))};await _0x30817f(_0x4075b3,{'id':_0x1a285f,'clock':_0x352771});const _0x15e96a=JSON[_0xa04c8f(0x117)]({'pid':process[_0xa04c8f(0x17d)],'host':_0x54b1d4['hostname'](),'at':_0x4d6b2e()}),_0x2248b5=_0x4d6b2e();let _0x2a35d0=null;const _0x3763c3=()=>{const _0x4336e0=_0xa04c8f;try{const _0x47ad1b=JSON['parse'](_0x36a16c[_0x4336e0(0x123)](this['lockPath'],_0x4336e0(0xe6)));if(_0x47ad1b['at']&&_0x4d6b2e()-_0x47ad1b['at']>staleLockMaxAgeMs){const _0x1a9f37=_0x4d6b2e()-_0x47ad1b['at'],_0x6b5e35=_0x4336e0(0x139)+Math[_0x4336e0(0xfd)](_0x1a9f37/0x3e8)+'s,\x20pid:\x20'+_0x47ad1b[_0x4336e0(0x17d)]+_0x4336e0(0x15a)+_0x47ad1b[_0x4336e0(0xd9)]+_0x4336e0(0xf4)+_0x4336e0(0xe8);this[_0x4336e0(0x113)]?.[_0x4336e0(0x11b)]?this[_0x4336e0(0x113)][_0x4336e0(0x11b)](_0x6b5e35):console[_0x4336e0(0x11b)](_0x4336e0(0xe2),_0x6b5e35);try{_0x36a16c[_0x4336e0(0x174)](this[_0x4336e0(0xeb)]);}catch{}return!![];}}catch{try{_0x36a16c['unlinkSync'](this[_0x4336e0(0xeb)]);}catch{}}return![];},_0x4363a5=()=>{const _0x106e59=_0xa04c8f;try{return _0x2a35d0=_0x36a16c[_0x106e59(0xc7)](this['lockPath'],'wx'),_0x36a16c[_0x106e59(0x179)](_0x2a35d0,_0x15e96a),!![];}catch(_0x79708c){if(_0x79708c&&_0x79708c['code']===_0x106e59(0x165))return![];throw _0x79708c;}};if(!_0x4363a5()){_0x3763c3(),_0x4363a5();if(_0x2a35d0==null&&lockTimeoutMs>0x0)while(_0x4d6b2e()-_0x2248b5<lockTimeoutMs){await new Promise(_0x708fbc=>setTimeout(_0x708fbc,0x19));if(_0x4363a5())break;_0x3763c3();}}if(_0x2a35d0==null){try{_0x36a16c['rmSync'](_0x568e63,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0xa04c8f(0x161)};}try{const _0x5bf8c9=this['readCurrentClock']();if(_0x352771<=_0x5bf8c9){try{_0x36a16c['rmSync'](_0x568e63,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0xa04c8f(0xc4),'currentClock':_0x5bf8c9};}if(!_0x420189(_0x51bf9d))_0x36a16c[_0xa04c8f(0x136)](_0x568e63,_0x51bf9d);else try{_0x36a16c[_0xa04c8f(0x10a)](_0x568e63,{'recursive':!![],'force':!![]});}catch{}return _0x4e1dbd(this[_0xa04c8f(0x176)],_0x1a285f+'\x0a'),this[_0xa04c8f(0xfc)]({'keep':keep}),{'published':!![],'currentClock':_0x352771};}finally{try{_0x36a16c[_0xa04c8f(0x157)](_0x2a35d0);}catch{}try{_0x36a16c[_0xa04c8f(0x174)](this[_0xa04c8f(0xeb)]);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x597690=_0x67fb04;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0xaeeebb=require$$0;class _0x33d561{constructor(){this['keyToLabel']=new Map(),this['labelToKey']=new Map(),this['nextLabel']=0x0,this['_tombstoneCount']=0x0;}async[_0x597690(0x12a)](){const _0x5bc972=_0x597690;this[_0x5bc972(0x167)]=new Map(),this[_0x5bc972(0xcb)]=new Map(),this[_0x5bc972(0x166)]=0x0,this['_tombstoneCount']=0x0;}async['loadFrom'](_0x5df3a0){const _0x24f6b0=_0x597690;if(!_0x5df3a0||!_0xaeeebb['existsSync'](_0x5df3a0))return await this[_0x24f6b0(0x12a)](),!![];let _0x54dbe0;try{_0x54dbe0=_0xaeeebb[_0x24f6b0(0x123)](_0x5df3a0,_0x24f6b0(0xe6));}catch{return await this['reset'](),!![];}let _0x268ae4;try{_0x268ae4=JSON[_0x24f6b0(0x12b)](_0x54dbe0);}catch{return await this[_0x24f6b0(0x12a)](),!![];}const _0x51b7ba=Array['isArray'](_0x268ae4?.['entries'])?_0x268ae4[_0x24f6b0(0x168)]:[],_0x2d0968=Number[_0x24f6b0(0x148)](_0x268ae4?.[_0x24f6b0(0x166)])?_0x268ae4[_0x24f6b0(0x166)]:0x0,_0x23fb10=new Map(),_0x2118fe=new Map();let _0x3ab383=-0x1;for(const _0x10d225 of _0x51b7ba){if(!Array['isArray'](_0x10d225)||_0x10d225[_0x24f6b0(0x13c)]!==0x2)continue;const _0x27d303=Number(_0x10d225[0x0]),_0x189306=String(_0x10d225[0x1]??'');if(!Number['isInteger'](_0x27d303)||_0x27d303<0x0)continue;if(!_0x189306)continue;_0x23fb10['set'](_0x189306,_0x27d303),_0x2118fe[_0x24f6b0(0x118)](_0x27d303,_0x189306);if(_0x27d303>_0x3ab383)_0x3ab383=_0x27d303;}return this[_0x24f6b0(0x167)]=_0x23fb10,this[_0x24f6b0(0xcb)]=_0x2118fe,this['nextLabel']=Math[_0x24f6b0(0x11c)](_0x2d0968,_0x3ab383+0x1,0x0),this['_tombstoneCount']=0x0,!![];}['labelForExisting'](_0x33b754){const _0xf15c82=_0x597690;return this[_0xf15c82(0x167)]['get'](_0x33b754);}[_0x597690(0x116)](_0x1cc731){const _0x3aa3bd=_0x597690;let _0x46c644=this[_0x3aa3bd(0x167)][_0x3aa3bd(0x129)](_0x1cc731);if(_0x46c644!==undefined)return _0x46c644;return _0x46c644=this['nextLabel']++,this[_0x3aa3bd(0x167)][_0x3aa3bd(0x118)](_0x1cc731,_0x46c644),this['labelToKey'][_0x3aa3bd(0x118)](_0x46c644,_0x1cc731),_0x46c644;}[_0x597690(0x110)](_0x72127b){const _0x7adbc7=_0x597690,_0x282371=this['keyToLabel']['get'](_0x72127b);if(_0x282371===undefined)return;this[_0x7adbc7(0x167)][_0x7adbc7(0x135)](_0x72127b),this[_0x7adbc7(0xcb)][_0x7adbc7(0x135)](_0x282371),this['_tombstoneCount']++;}['keyForLabel'](_0x22f7db){const _0x3ea83a=_0x597690;return this['labelToKey'][_0x3ea83a(0x129)](_0x22f7db)??null;}['size'](){const _0x39612e=_0x597690;return this['keyToLabel'][_0x39612e(0xcf)];}[_0x597690(0x11f)](){const _0x47790a=_0x597690;return this[_0x47790a(0x172)];}async['snapshotTo'](_0x1ed37a){const _0x2dc5d5=_0x597690,_0x4fe584=_0x1ed37a+_0x2dc5d5(0x170),_0x5a9146=[];for(const [_0x370c84,_0x2d00e8]of this['labelToKey']['entries']()){_0x5a9146[_0x2dc5d5(0xc9)]([_0x370c84,_0x2d00e8]);}_0x5a9146[_0x2dc5d5(0x103)]((_0x5e5b83,_0x50ee96)=>_0x5e5b83[0x0]-_0x50ee96[0x0]);const _0x8cf0b={'version':0x1,'nextLabel':this[_0x2dc5d5(0x166)],'entries':_0x5a9146};_0xaeeebb[_0x2dc5d5(0x179)](_0x4fe584,JSON[_0x2dc5d5(0x117)](_0x8cf0b)),_0xaeeebb[_0x2dc5d5(0x136)](_0x4fe584,_0x1ed37a);}}return labelMap=_0x33d561,labelMap;}function _0x43a8(_0x4e277e,_0x3c9193){_0x4e277e=_0x4e277e-0xc2;const _0x5bc290=_0x5bc2();let _0x43a8ba=_0x5bc290[_0x4e277e];return _0x43a8ba;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x3f8c0a=requireSnapshotStore(),_0x318344=requireLabelMap(),_0x4a5250=0x1;let _0x598e37=null;function _0x2cbf09(){const _0x54fd7c=_0x43a8;if(_0x598e37)return _0x598e37;try{return _0x598e37=require(_0x54fd7c(0x149)),_0x598e37;}catch(_0x202e96){const _0x31cb28=new Error(_0x54fd7c(0xd5)+('for\x20Node\x20'+process['versions'][_0x54fd7c(0x105)]+_0x54fd7c(0x177)+process[_0x54fd7c(0xf2)]+'/'+process[_0x54fd7c(0x178)]+'.\x20')+_0x54fd7c(0x101)+(_0x54fd7c(0x114)+(_0x202e96?.[_0x54fd7c(0x112)]||String(_0x202e96))));_0x31cb28[_0x54fd7c(0x158)]=_0x54fd7c(0x16f),_0x31cb28[_0x54fd7c(0xfa)]=_0x202e96;throw _0x31cb28;}}return hnsw=function _0xa3db3(_0x3d6e37={},{dims:_0x4d296a,dir:_0x5c3e75}){const _0x29db6e=_0x43a8,_0x45a79b=_0x2cbf09();if(!_0x4d296a||_0x4d296a<=0x0)throw new Error('hnsw\x20algorithm\x20requires\x20dims\x20>\x200');if(!_0x5c3e75)throw new Error('hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage');const _0x856a0c={'metric':_0x3d6e37[_0x29db6e(0x16c)]??_0x29db6e(0x10f),'M':_0x3d6e37['M']??0x10,'efConstruction':_0x3d6e37[_0x29db6e(0x111)]??0xc8,'efSearch':_0x3d6e37[_0x29db6e(0x141)]??0x40,'maxElements':_0x3d6e37['maxElements']??0x400,'growFactor':_0x3d6e37[_0x29db6e(0x160)]??0x2,'snapshotEveryChanges':_0x3d6e37['snapshotEveryChanges']??0xc350,'keepSnapshots':_0x3d6e37[_0x29db6e(0x152)]??0x2,'tmpMaxAgeMs':_0x3d6e37[_0x29db6e(0x175)]??0x6*0x36ee80},_0x475d63=new _0x3f8c0a({'dir':_0x5c3e75,'keepSnapshots':_0x856a0c['keepSnapshots']}),_0x45a68f=new _0x318344();let _0x372034=null,_0x5290f6=0x0,_0x497b84=null,_0x57992f=Promise[_0x29db6e(0x128)]();const _0xe07a1f=_0x204f75=>{return _0x57992f=_0x57992f['then'](_0x204f75),_0x57992f;};async function _0x5ad60c(_0x2d1ae9){const _0xe39e57=_0x29db6e;await _0x45a68f['reset']();const _0x581620=_0x2d1ae9?await _0x2d1ae9():[],_0x2cc96=Math['max'](_0x856a0c[_0xe39e57(0x10c)],Math[_0xe39e57(0x159)](_0x581620[_0xe39e57(0x13c)]*(_0x856a0c['growFactor']||1.2)),0x1);_0x372034=new _0x45a79b[(_0xe39e57(0x14d))](_0x856a0c[_0xe39e57(0x16c)],_0x4d296a),_0x372034[_0xe39e57(0x151)]({'maxElements':_0x2cc96,'efConstruction':_0x856a0c[_0xe39e57(0x111)],'M':_0x856a0c['M']});for(const {key:_0x577704,vector:_0x1ed7b1}of _0x581620){if(!(_0x1ed7b1 instanceof Float32Array)||_0x1ed7b1[_0xe39e57(0x13c)]!==_0x4d296a)continue;const _0x43da76=_0x45a68f[_0xe39e57(0x116)](_0x577704);_0x372034['addPoint'](Array[_0xe39e57(0x106)](_0x1ed7b1),_0x43da76);}_0x372034[_0xe39e57(0x182)](_0x856a0c[_0xe39e57(0x141)]),_0x5290f6=0x0;}async function _0x2b7199(_0x1238d6){const _0x5a78b9=_0x29db6e;if(!_0x372034||!_0x1238d6)return![];const _0x275743=await _0x475d63[_0x5a78b9(0x134)](_0x1238d6,async _0x25327b=>{const _0x447160=_0x5a78b9;_0x372034[_0x447160(0xdd)](_0x25327b['index']),await _0x45a68f[_0x447160(0xfe)](_0x25327b[_0x447160(0x153)]);const _0x4b066a=require$$0;_0x4b066a['writeFileSync'](_0x25327b[_0x447160(0x17b)],JSON[_0x447160(0x117)]({'manifestVersion':_0x4a5250,'dims':_0x4d296a,'metric':_0x856a0c['metric'],'clock':_0x1238d6,'snapshotAt':Date[_0x447160(0xcd)]()},null,0x2));},{'keep':_0x856a0c['keepSnapshots']});if(_0x275743?.['published'])_0x5290f6=0x0;return _0x275743?.[_0x5a78b9(0xe0)]??![];}async function _0x5b4edc(){const _0x1e1012=_0x29db6e,_0x29eb91=_0x475d63['readCurrentId']()||_0x475d63['latestSnapshotId']();if(!_0x29eb91)return null;let _0x45250f,_0x6fafad=![];return await _0x475d63[_0x1e1012(0xd2)](_0x29eb91,async _0x24f435=>{const _0x42d082=_0x1e1012,_0x179879=require$$0;_0x45250f=JSON[_0x42d082(0x12b)](_0x179879[_0x42d082(0x123)](_0x24f435[_0x42d082(0x17b)],_0x42d082(0xe6)));if(_0x45250f[_0x42d082(0xea)]!==_0x4a5250||_0x45250f['dims']!==_0x4d296a||_0x45250f[_0x42d082(0x16c)]!==_0x856a0c[_0x42d082(0x16c)]){_0x45250f=null;return;}await _0x45a68f[_0x42d082(0x171)](_0x24f435['labels']),_0x372034=new _0x45a79b[(_0x42d082(0x14d))](_0x856a0c[_0x42d082(0x16c)],_0x4d296a),_0x372034[_0x42d082(0x155)](_0x24f435[_0x42d082(0xe7)]),_0x372034[_0x42d082(0x182)](_0x856a0c[_0x42d082(0x141)]),_0x6fafad=!![];}),_0x6fafad?_0x45250f?.[_0x1e1012(0x13b)]??0x0:null;}return{async 'load'(_0x5bd628){return _0xe07a1f(async()=>{const _0x35dfd0=_0x43a8;_0x475d63['cleanupTmpDirs']({'maxAgeMs':_0x856a0c[_0x35dfd0(0x175)]}),_0x497b84=_0x5bd628??null;const _0x267add=await _0x5b4edc();if(_0x267add!=null)return _0x267add;return await _0x5ad60c(_0x5bd628),null;});},async 'add'(_0x3abde2,_0x4cd019,_0x273944){return _0xe07a1f(async()=>{const _0x55714a=_0x43a8;if(!_0x372034)return;const _0x5d05e5=_0x45a68f[_0x55714a(0x116)](_0x3abde2);try{_0x372034[_0x55714a(0xd6)](_0x5d05e5);}catch{}_0x372034[_0x55714a(0xd0)]()>=_0x372034[_0x55714a(0x17f)]()&&(_0x856a0c[_0x55714a(0x10c)]=Math[_0x55714a(0x159)](_0x372034['getMaxElements']()*(_0x856a0c[_0x55714a(0x160)]||0x2)),await _0x5ad60c(_0x497b84)),_0x372034[_0x55714a(0x146)](Array[_0x55714a(0x106)](_0x4cd019),_0x5d05e5),_0x5290f6++,_0x5290f6>=_0x856a0c[_0x55714a(0x115)]&&await _0x2b7199(_0x273944??Date[_0x55714a(0xcd)]());});},async 'remove'(_0x2310e6){return _0xe07a1f(async()=>{const _0xe067ac=_0x43a8;if(!_0x372034)return;const _0x38a027=_0x45a68f['labelForExisting'](_0x2310e6);if(_0x38a027===undefined)return;try{_0x372034['markDelete'](_0x38a027);}catch{}_0x45a68f[_0xe067ac(0x110)](_0x2310e6),_0x5290f6++;});},'search'(_0x8fd898,{limit:limit=0xa,efSearch:_0x1311e8}={}){const _0x5ee767=_0x29db6e;if(!_0x372034)return[];if(Number['isInteger'](_0x1311e8))_0x372034['setEf'](_0x1311e8);const _0x177bbd=Math[_0x5ee767(0xf6)](limit,_0x372034['getCurrentCount']()||0x1),{neighbors:_0xa56f87,distances:_0x43a2ec}=_0x372034[_0x5ee767(0x137)](Array[_0x5ee767(0x106)](_0x8fd898),_0x177bbd),_0x4fa1aa=[];for(let _0x78f429=0x0;_0x78f429<_0xa56f87[_0x5ee767(0x13c)];_0x78f429++){const _0x2aec13=_0x45a68f[_0x5ee767(0x15f)](_0xa56f87[_0x78f429]);if(!_0x2aec13)continue;const _0x1748c4=_0x856a0c[_0x5ee767(0x16c)]===_0x5ee767(0x10f)?Math[_0x5ee767(0x11c)](0x0,0x1-_0x43a2ec[_0x78f429]):0x1/(0x1+_0x43a2ec[_0x78f429]);_0x4fa1aa[_0x5ee767(0xc9)]({'key':_0x2aec13,'score':_0x1748c4});}return _0x4fa1aa;},async 'snapshot'(_0x36b0b5=Date['now']()){return _0xe07a1f(()=>_0x2b7199(_0x36b0b5));},async 'rebuild'(_0x1c07c9){return _0xe07a1f(()=>{if(_0x1c07c9!=null)_0x497b84=_0x1c07c9;return _0x5ad60c(_0x1c07c9??_0x497b84);});},async 'stop'(){const _0x12b137=_0x29db6e;return _0xe07a1f(()=>_0x2b7199(Date[_0x12b137(0xcd)]()));},'count'(){return _0x45a68f['size']();},'info'(){const _0x28f4ad=_0x29db6e;return{'algorithm':'hnsw','metric':_0x856a0c[_0x28f4ad(0x16c)],'M':_0x856a0c['M'],'efConstruction':_0x856a0c[_0x28f4ad(0x111)],'efSearch':_0x856a0c[_0x28f4ad(0x141)],'maxElements':_0x372034?.[_0x28f4ad(0x17f)]()??_0x856a0c[_0x28f4ad(0x10c)],'count':_0x45a68f[_0x28f4ad(0xcf)](),'changesSince':_0x5290f6,'snapshotDir':_0x5c3e75,'latestSnapshot':_0x475d63[_0x28f4ad(0x126)]()??null};}};},hnsw;}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x11934e(_0x339672={}){const _0x3e1ee4=new Map();return{async 'load'(_0x1d6625){const _0x4349af=_0x43a8;_0x3e1ee4[_0x4349af(0x14e)]();if(_0x1d6625)for(const {key:_0x366aca,vector:_0x557d88}of await _0x1d6625()){_0x3e1ee4[_0x4349af(0x118)](_0x366aca,_0x557d88);}},async 'add'(_0x10b18b,_0x280d1d,_0x216330){const _0x1c58e3=_0x43a8;_0x3e1ee4[_0x1c58e3(0x118)](_0x10b18b,_0x280d1d);},async 'remove'(_0x33a311){const _0x180029=_0x43a8;_0x3e1ee4[_0x180029(0x135)](_0x33a311);},'search'(_0x355c42,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x436552=_0x43a8,_0x220857=[];for(const [_0x3a0b9c,_0x9069ec]of _0x3e1ee4){const _0x224942=_0x3f068a(_0x355c42,_0x9069ec);if(_0x224942>=threshold)_0x220857[_0x436552(0xc9)]({'key':_0x3a0b9c,'score':_0x224942});}return _0x220857[_0x436552(0x103)]((_0x406e2d,_0x186766)=>_0x186766[_0x436552(0xf1)]-_0x406e2d['score']),_0x220857['slice'](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x532c32){const _0xfdffd=_0x43a8;await this[_0xfdffd(0x156)](_0x532c32);},async 'stop'(){},'count'(){const _0x1f8f95=_0x43a8;return _0x3e1ee4[_0x1f8f95(0xcf)];},'info'(){const _0x210a29=_0x43a8;return{'algorithm':'flat','count':_0x3e1ee4[_0x210a29(0xcf)]};}};};function _0x3f068a(_0x32bfef,_0x171d64){const _0x5ed927=_0x43a8;let _0x112139=0x0,_0x4927e7=0x0,_0x24fc87=0x0;for(let _0x4bb3d1=0x0;_0x4bb3d1<_0x32bfef[_0x5ed927(0x13c)];_0x4bb3d1++){_0x112139+=_0x32bfef[_0x4bb3d1]*_0x171d64[_0x4bb3d1],_0x4927e7+=_0x32bfef[_0x4bb3d1]*_0x32bfef[_0x4bb3d1],_0x24fc87+=_0x171d64[_0x4bb3d1]*_0x171d64[_0x4bb3d1];}const _0x9b455a=Math[_0x5ed927(0x125)](_0x4927e7)*Math[_0x5ed927(0x125)](_0x24fc87);return _0x9b455a===0x0?0x0:_0x112139/_0x9b455a;}return flat;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0xe11bd3=require$$0,_0x975b8d=require$$1,_0xdb8de8=requireSnapshotStore(),_0xd34066=requireLabelMap(),_0x357957=0x1;let _0x53b115=null;function _0x54b789(){const _0x13e444=_0x43a8;if(_0x53b115)return _0x53b115;try{return _0x53b115=require(_0x13e444(0x12c)),_0x53b115;}catch(_0x4f5463){const _0x1b574a=new Error('usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20'+('for\x20Node\x20'+process[_0x13e444(0xf8)][_0x13e444(0x105)]+_0x13e444(0x177)+process[_0x13e444(0xf2)]+'/'+process[_0x13e444(0x178)]+'.\x20')+_0x13e444(0x14a)+(_0x13e444(0x114)+(_0x4f5463?.[_0x13e444(0x112)]||String(_0x4f5463))));_0x1b574a[_0x13e444(0x158)]=_0x13e444(0x17e),_0x1b574a[_0x13e444(0xfa)]=_0x4f5463;throw _0x1b574a;}}function _0x287ea8(_0x57633b,_0x41627c){const _0x33c0e3=_0x43a8;switch(_0x57633b){case _0x33c0e3(0x10f):return _0x41627c[_0x33c0e3(0x142)][_0x33c0e3(0xc6)];case'l2':return _0x41627c['MetricKind'][_0x33c0e3(0xdc)];case'ip':return _0x41627c[_0x33c0e3(0x142)]['IP'];default:return _0x41627c['MetricKind'][_0x33c0e3(0xc6)];}}return usearch=function _0x21aa2c(_0x3421ad={},{dims:_0x50c959,dir:_0x146dea}){const _0x69d16f=_0x43a8,_0x3224a2=_0x54b789();if(!_0x50c959||_0x50c959<=0x0)throw new Error('usearch\x20algorithm\x20requires\x20dims\x20>\x200');if(!_0x146dea)throw new Error(_0x69d16f(0x10d));const _0x12e8b1={'metric':_0x3421ad['metric']??_0x69d16f(0x10f),'connectivity':_0x3421ad[_0x69d16f(0x15d)]??0x10,'expansionAdd':_0x3421ad[_0x69d16f(0xe1)]??0x80,'expansionSearch':_0x3421ad[_0x69d16f(0x140)]??0x40,'snapshotEveryChanges':_0x3421ad[_0x69d16f(0x115)]??0xc350,'keepSnapshots':_0x3421ad[_0x69d16f(0x152)]??0x2,'tmpMaxAgeMs':_0x3421ad[_0x69d16f(0x175)]??0x6*0x36ee80,'heartbeatIntervalMs':_0x3421ad[_0x69d16f(0x147)]??0x1388,'writerLockMaxAgeMs':_0x3421ad[_0x69d16f(0x169)]??0x3a98,'viewRefreshMs':_0x3421ad[_0x69d16f(0xc5)]??0x3e8},_0x5e8350=new _0xdb8de8({'dir':_0x146dea,'keepSnapshots':_0x12e8b1[_0x69d16f(0x152)]}),_0x29233a=_0x975b8d[_0x69d16f(0xfb)](_0x146dea,_0x69d16f(0x11a));let _0x27f84b=new _0xd34066(),_0x86bebc=null,_0x157a43=0x0,_0x32a2e9=null,_0x2a8aba=![],_0x5a179c=null,_0x33bc09=null,_0x1b9887=0x0,_0x447cc0=![],_0x32a15=Promise['resolve']();const _0xf1ae84=_0x351835=>{const _0x3f1529=_0x69d16f;return _0x32a15=_0x32a15[_0x3f1529(0x107)](_0x351835),_0x32a15;};function _0x408551(){const _0xe1b9a0=_0x69d16f;return new _0x3224a2[(_0xe1b9a0(0x102))]({'dimensions':_0x50c959,'metric':_0x287ea8(_0x12e8b1[_0xe1b9a0(0x16c)],_0x3224a2),'quantization':_0x3224a2[_0xe1b9a0(0xec)][_0xe1b9a0(0x164)],'connectivity':_0x12e8b1[_0xe1b9a0(0x15d)],'expansion_add':_0x12e8b1['expansionAdd'],'expansion_search':_0x12e8b1[_0xe1b9a0(0x140)],'multi':![]});}function _0x551e8d(_0x3029dc){return _0x3029dc instanceof Float32Array?_0x3029dc:new Float32Array(_0x3029dc);}function _0x5611fd(){const _0x5b82e2=_0x69d16f,_0x4713dc=JSON['stringify']({'pid':process[_0x5b82e2(0x17d)],'at':Date['now']()}),_0x20b57d=()=>{const _0x18f94d=_0x5b82e2;try{const _0x54b3d6=_0xe11bd3[_0x18f94d(0xc7)](_0x29233a,'wx');return _0xe11bd3[_0x18f94d(0x179)](_0x54b3d6,_0x4713dc),_0xe11bd3[_0x18f94d(0x157)](_0x54b3d6),!![];}catch(_0x366fd3){if(_0x366fd3?.[_0x18f94d(0x158)]===_0x18f94d(0x165))return![];throw _0x366fd3;}};if(_0x20b57d())return!![];try{const _0x27b852=JSON['parse'](_0xe11bd3[_0x5b82e2(0x123)](_0x29233a,'utf8')),_0x38be25=Date['now']()-(_0x27b852['at']??0x0);if(_0x38be25<_0x12e8b1[_0x5b82e2(0x169)])return![];}catch{}try{_0xe11bd3[_0x5b82e2(0x174)](_0x29233a);}catch{}return _0x20b57d();}function _0x49e6eb(){const _0x51d3ea=_0x69d16f;if(_0x5a179c)clearInterval(_0x5a179c);_0x5a179c=setInterval(()=>{const _0x48adae=_0x43a8;try{_0xe11bd3['writeFileSync'](_0x29233a,JSON[_0x48adae(0x117)]({'pid':process[_0x48adae(0x17d)],'at':Date[_0x48adae(0xcd)]()}));}catch{}},_0x12e8b1[_0x51d3ea(0x147)]),_0x5a179c[_0x51d3ea(0x130)]();}function _0x49a610(){const _0xedecd=_0x69d16f;_0x5a179c&&(clearInterval(_0x5a179c),_0x5a179c=null);try{const _0x4f58cb=JSON[_0xedecd(0x12b)](_0xe11bd3['readFileSync'](_0x29233a,_0xedecd(0xe6)));if(_0x4f58cb[_0xedecd(0x17d)]===process[_0xedecd(0x17d)])_0xe11bd3[_0xedecd(0x174)](_0x29233a);}catch{}}async function _0x31863e(_0x1cbe29){const _0x1d568f=_0x69d16f;_0x27f84b=new _0xd34066(),await _0x27f84b[_0x1d568f(0x12a)](),_0x86bebc=_0x408551();const _0x4db1d4=_0x1cbe29?await _0x1cbe29():[];for(const {key:_0x42322c,vector:_0x2d82e}of _0x4db1d4){if(!(_0x2d82e instanceof Float32Array)||_0x2d82e[_0x1d568f(0x13c)]!==_0x50c959)continue;const _0x5ea525=_0x27f84b[_0x1d568f(0x116)](_0x42322c);_0x86bebc[_0x1d568f(0x16b)](BigInt(_0x5ea525),_0x2d82e);}_0x157a43=0x0;}async function _0x270923(_0x1c954b){const _0xfd9d89=_0x69d16f;if(!_0x86bebc||!_0x1c954b)return![];const _0x20092b=await _0x5e8350['publishSnapshot'](_0x1c954b,async _0x113f97=>{const _0x420c4e=_0x43a8;_0x86bebc[_0x420c4e(0x163)](_0x113f97['index']),await _0x27f84b[_0x420c4e(0xfe)](_0x113f97[_0x420c4e(0x153)]),_0xe11bd3[_0x420c4e(0x179)](_0x113f97[_0x420c4e(0x17b)],JSON[_0x420c4e(0x117)]({'manifestVersion':_0x357957,'algorithm':'usearch','dims':_0x50c959,'metric':_0x12e8b1[_0x420c4e(0x16c)],'clock':_0x1c954b,'snapshotAt':Date[_0x420c4e(0xcd)]()},null,0x2));},{'keep':_0x12e8b1[_0xfd9d89(0x152)]});if(_0x20092b?.[_0xfd9d89(0xe0)])_0x157a43=0x0;return _0x20092b?.[_0xfd9d89(0xe0)]??![];}async function _0x3d74a2(){const _0x24fe27=_0x69d16f,_0x3e4f32=_0x5e8350[_0x24fe27(0x126)]()||_0x5e8350[_0x24fe27(0xf9)]();if(!_0x3e4f32)return null;let _0x496a24,_0x37124d=![];return await _0x5e8350['loadSnapshot'](_0x3e4f32,async _0x1f76dd=>{const _0x3f9b88=_0x24fe27;_0x496a24=JSON[_0x3f9b88(0x12b)](_0xe11bd3[_0x3f9b88(0x123)](_0x1f76dd[_0x3f9b88(0x17b)],_0x3f9b88(0xe6)));if(_0x496a24[_0x3f9b88(0xea)]!==_0x357957||_0x496a24['algorithm']!=='usearch'||_0x496a24[_0x3f9b88(0x138)]!==_0x50c959||_0x496a24[_0x3f9b88(0x16c)]!==_0x12e8b1[_0x3f9b88(0x16c)]){_0x496a24=null;return;}_0x27f84b=new _0xd34066(),await _0x27f84b[_0x3f9b88(0x171)](_0x1f76dd[_0x3f9b88(0x153)]),_0x86bebc=_0x408551(),_0x86bebc[_0x3f9b88(0x156)](_0x1f76dd[_0x3f9b88(0xe7)]),_0x37124d=!![];}),_0x37124d?_0x496a24?.[_0x24fe27(0x13b)]??0x0:null;}async function _0x1f310d(_0x2696a8){const _0x12c824=_0x69d16f;if(!_0x2696a8)return![];let _0x5bba42=![];try{await _0x5e8350[_0x12c824(0xd2)](_0x2696a8,async _0x238f52=>{const _0x12544c=_0x12c824,_0x2ce2b0=JSON[_0x12544c(0x12b)](_0xe11bd3[_0x12544c(0x123)](_0x238f52['state'],_0x12544c(0xe6)));if(_0x2ce2b0[_0x12544c(0xea)]!==_0x357957||_0x2ce2b0[_0x12544c(0x154)]!==_0x12544c(0x12c)||_0x2ce2b0[_0x12544c(0x138)]!==_0x50c959||_0x2ce2b0[_0x12544c(0x16c)]!==_0x12e8b1[_0x12544c(0x16c)])return;const _0x5dbbfe=new _0xd34066();await _0x5dbbfe[_0x12544c(0x171)](_0x238f52[_0x12544c(0x153)]);const _0x4c9feb=_0x408551();_0x4c9feb['view'](_0x238f52[_0x12544c(0xe7)]),_0x86bebc=_0x4c9feb,_0x27f84b=_0x5dbbfe,_0x33bc09=_0x2696a8,_0x5bba42=!![];});}catch{}return _0x5bba42;}async function _0x38ae0d(_0x25d59a){try{await _0x1f310d(_0x25d59a);}finally{_0x447cc0=![];}}function _0x52d528(){const _0x5c10fd=_0x69d16f,_0x4f1c56=Date['now']();if(_0x4f1c56-_0x1b9887<_0x12e8b1[_0x5c10fd(0xc5)])return;_0x1b9887=_0x4f1c56;if(_0x447cc0)return;const _0x566116=_0x5e8350[_0x5c10fd(0x126)]()||_0x5e8350['latestSnapshotId']();if(!_0x566116||_0x566116===_0x33bc09)return;_0x447cc0=!![],_0x38ae0d(_0x566116);}async function _0x5d10f0(){const _0x459d43=_0x69d16f;_0x2a8aba=!![],_0x49e6eb();if(_0x33bc09)try{const _0x312c11=new _0xd34066();let _0x58622d=![];await _0x5e8350[_0x459d43(0xd2)](_0x33bc09,async _0x533b83=>{const _0xe2c5b5=_0x459d43;await _0x312c11[_0xe2c5b5(0x171)](_0x533b83[_0xe2c5b5(0x153)]);const _0x4d0bfa=_0x408551();_0x4d0bfa[_0xe2c5b5(0x156)](_0x533b83[_0xe2c5b5(0xe7)]),_0x86bebc=_0x4d0bfa,_0x27f84b=_0x312c11,_0x58622d=!![];});if(_0x58622d)return;}catch{}await _0x31863e(_0x32a2e9);}return{async 'load'(_0x31bf97){return _0xf1ae84(async()=>{const _0x52aea3=_0x43a8;_0x5e8350[_0x52aea3(0xf7)]({'maxAgeMs':_0x12e8b1[_0x52aea3(0x175)]}),_0x32a2e9=_0x31bf97??null,_0x2a8aba=_0x5611fd();if(_0x2a8aba){_0x49e6eb();const _0x41f092=await _0x3d74a2();if(_0x41f092!=null)return _0x41f092;return await _0x31863e(_0x31bf97),null;}const _0x12a147=_0x5e8350[_0x52aea3(0x126)]()||_0x5e8350['latestSnapshotId']();return await _0x1f310d(_0x12a147),null;});},async 'add'(_0x5eba55,_0x1b7cb6,_0x3b1c3d){return _0xf1ae84(async()=>{const _0x173654=_0x43a8;if(!_0x2a8aba){if(!_0x5611fd())return;await _0x5d10f0();}if(!_0x86bebc)return;const _0x79413c=_0x27f84b[_0x173654(0xd1)](_0x5eba55);if(_0x79413c!==undefined)try{_0x86bebc[_0x173654(0x121)](BigInt(_0x79413c));}catch{}const _0x5df022=_0x27f84b[_0x173654(0x116)](_0x5eba55);_0x86bebc['add'](BigInt(_0x5df022),_0x551e8d(_0x1b7cb6)),_0x157a43++,_0x157a43>=_0x12e8b1[_0x173654(0x115)]&&await _0x270923(_0x3b1c3d??Date[_0x173654(0xcd)]());});},async 'remove'(_0x996c74){return _0xf1ae84(async()=>{const _0x39163f=_0x43a8;if(!_0x2a8aba){if(!_0x5611fd())return;await _0x5d10f0();}if(!_0x86bebc)return;const _0xeeed9b=_0x27f84b['labelForExisting'](_0x996c74);if(_0xeeed9b===undefined)return;try{_0x86bebc[_0x39163f(0x121)](BigInt(_0xeeed9b));}catch{}_0x27f84b[_0x39163f(0x110)](_0x996c74),_0x157a43++;});},'search'(_0x3487ff,{limit:limit=0xa}={}){const _0x43f8d8=_0x69d16f;if(!_0x2a8aba)_0x52d528();if(!_0x86bebc)return[];const _0x2ea4d8=_0x86bebc[_0x43f8d8(0xcf)]();if(_0x2ea4d8===0x0)return[];const _0x4d0104=Math['min'](limit,_0x2ea4d8),_0x1add19=_0x86bebc[_0x43f8d8(0x13a)](_0x551e8d(_0x3487ff),_0x4d0104,0x0),_0x4571ab=[],_0x54c015=_0x1add19[_0x43f8d8(0xe5)],_0x5160b6=_0x1add19[_0x43f8d8(0x17c)];for(let _0x30aa86=0x0;_0x30aa86<_0x54c015[_0x43f8d8(0x13c)];_0x30aa86++){const _0x4ca0ef=_0x54c015[_0x30aa86];if(_0x4ca0ef===0xffffffffffffffffn)continue;const _0x427d2=Number(_0x4ca0ef),_0x337641=_0x27f84b[_0x43f8d8(0x15f)](_0x427d2);if(!_0x337641)continue;const _0x3b4f92=_0x5160b6[_0x30aa86];let _0xc4624d;if(_0x12e8b1[_0x43f8d8(0x16c)]===_0x43f8d8(0x10f))_0xc4624d=Math['max'](0x0,0x1-_0x3b4f92);else{if(_0x12e8b1['metric']==='ip')_0xc4624d=-_0x3b4f92;else _0xc4624d=0x1/(0x1+_0x3b4f92);}_0x4571ab[_0x43f8d8(0xc9)]({'key':_0x337641,'score':_0xc4624d});}return _0x4571ab;},async 'snapshot'(_0x546fbd=Date[_0x69d16f(0xcd)]()){if(!_0x2a8aba)return![];return _0xf1ae84(()=>_0x270923(_0x546fbd));},async 'rebuild'(_0x14337a){if(!_0x2a8aba)return;return _0xf1ae84(()=>{if(_0x14337a!=null)_0x32a2e9=_0x14337a;return _0x31863e(_0x14337a??_0x32a2e9);});},async 'stop'(){return _0xf1ae84(async()=>{const _0x59f414=_0x43a8;_0x2a8aba&&(await _0x270923(Date[_0x59f414(0xcd)]()),_0x49a610());});},'count'(){return _0x27f84b['size']();},'info'(){const _0x1e95b1=_0x69d16f;return{'algorithm':_0x1e95b1(0x12c),'role':_0x2a8aba?_0x1e95b1(0x100):_0x1e95b1(0x15c),'metric':_0x12e8b1[_0x1e95b1(0x16c)],'connectivity':_0x12e8b1[_0x1e95b1(0x15d)],'expansionAdd':_0x12e8b1['expansionAdd'],'expansionSearch':_0x12e8b1[_0x1e95b1(0x140)],'count':_0x27f84b['size'](),'size':_0x86bebc?.[_0x1e95b1(0xcf)]?.()??0x0,'capacity':_0x86bebc?.[_0x1e95b1(0xce)]?.()??0x0,'changesSince':_0x2a8aba?_0x157a43:null,'viewedSnapshot':_0x33bc09??null,'snapshotDir':_0x146dea,'latestSnapshot':_0x5e8350['readCurrentId']()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0x2fbd0d=_0x67fb04;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0xbbf7bd,workerData:_0xc1f151}=require$$0$1,{algorithmName:_0x3b8ad9,algorithmConfig:_0x278670,dims:_0x4a2d69,dir:_0x2ee404}=_0xc1f151;let _0x312b03;if(_0x3b8ad9==='hnsw')_0x312b03=requireHnsw()(_0x278670,{'dims':_0x4a2d69,'dir':_0x2ee404});else{if(_0x3b8ad9===_0x2fbd0d(0x11d))_0x312b03=requireFlat()(_0x278670,{'dims':_0x4a2d69,'dir':_0x2ee404});else{if(_0x3b8ad9===_0x2fbd0d(0x12c))_0x312b03=requireUsearch()(_0x278670,{'dims':_0x4a2d69,'dir':_0x2ee404});else throw new Error(_0x2fbd0d(0xff)+_0x3b8ad9+'\x22');}}function _0x289b52(){const _0x19877a=_0x2fbd0d;try{_0xbbf7bd['postMessage']({'op':_0x19877a(0x108),'count':_0x312b03[_0x19877a(0x13e)](),'info':_0x312b03[_0x19877a(0x14f)](),'memory':process[_0x19877a(0xf5)]()});}catch{}}return _0xbbf7bd['on']('message',async _0x40f1aa=>{const _0x57654e=_0x2fbd0d,{id:_0x4385cc,op:_0x453618,args:_0x580016}=_0x40f1aa;try{let _0x2745d8;switch(_0x453618){case'load':{const _0x23a692=(_0x580016[_0x57654e(0xe9)]||[])[_0x57654e(0x109)](_0xaa6d65=>({'key':_0xaa6d65[_0x57654e(0x162)],'vector':_0xaa6d65[_0x57654e(0x143)]instanceof Float32Array?_0xaa6d65[_0x57654e(0x143)]:new Float32Array(_0xaa6d65[_0x57654e(0x143)])}));_0x2745d8=await _0x312b03[_0x57654e(0x156)](async()=>_0x23a692),_0x289b52();break;}case _0x57654e(0x16b):{const _0x4648a0=_0x580016[_0x57654e(0x143)]instanceof Float32Array?_0x580016[_0x57654e(0x143)]:new Float32Array(_0x580016[_0x57654e(0x143)]);await _0x312b03[_0x57654e(0x16b)](_0x580016[_0x57654e(0x162)],_0x4648a0,_0x580016[_0x57654e(0x13b)]??undefined),_0x289b52(),_0x2745d8=null;break;}case'remove':{await _0x312b03['remove'](_0x580016[_0x57654e(0x162)]),_0x289b52(),_0x2745d8=null;break;}case _0x57654e(0x13a):{const _0x301c5=_0x580016[_0x57654e(0xcc)]instanceof Float32Array?_0x580016[_0x57654e(0xcc)]:new Float32Array(_0x580016[_0x57654e(0xcc)]);_0x2745d8=_0x312b03['search'](_0x301c5,_0x580016['opts']||{});break;}case'snapshot':{_0x2745d8=await _0x312b03[_0x57654e(0x131)](_0x580016[_0x57654e(0x13b)]),_0x289b52();break;}case _0x57654e(0x16e):{const _0xe3aa33=(_0x580016[_0x57654e(0xe9)]||[])[_0x57654e(0x109)](_0x49f8d1=>({'key':_0x49f8d1[_0x57654e(0x162)],'vector':_0x49f8d1[_0x57654e(0x143)]instanceof Float32Array?_0x49f8d1[_0x57654e(0x143)]:new Float32Array(_0x49f8d1[_0x57654e(0x143)])}));await _0x312b03[_0x57654e(0x16e)](async()=>_0xe3aa33),_0x289b52(),_0x2745d8=null;break;}case'stop':{await _0x312b03['stop'](),_0x289b52(),_0x2745d8=null;break;}case _0x57654e(0x13e):{_0x2745d8=_0x312b03[_0x57654e(0x13e)]();break;}case'info':{_0x2745d8=_0x312b03[_0x57654e(0x14f)]();break;}default:throw new Error(_0x57654e(0x15e)+_0x453618+'\x22');}_0xbbf7bd['postMessage']({'id':_0x4385cc,'result':_0x2745d8});}catch(_0x5df0a4){_0xbbf7bd[_0x57654e(0x133)]({'id':_0x4385cc,'error':{'message':_0x5df0a4?.[_0x57654e(0x112)]||String(_0x5df0a4),'code':_0x5df0a4?.['code']}});}}),_0xbbf7bd[_0x2fbd0d(0x133)]({'op':'ready'}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);function _0x5bc2(){const _0x366627=['count','state.json','expansionSearch','efSearch','MetricKind','vector','4KpslQX','6397580jVBEPK','addPoint','heartbeatIntervalMs','isInteger','hnswlib-node','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20','hex','index.hnsw','HierarchicalNSW','clear','info','_tmp-','initIndex','keepSnapshots','labels','algorithm','readIndexSync','load','closeSync','code','ceil',',\x20host:\x20','randomBytes','reader','connectivity','Unknown\x20op:\x20\x22','keyForLabel','growFactor','lock_busy','key','save','F32','EEXIST','nextLabel','keyToLabel','entries','writerLockMaxAgeMs','42gFtsjj','add','metric','prototype','rebuild','HNSW_BINDINGS_UNAVAILABLE','.tmp','loadFrom','_tombstoneCount','trunc','unlinkSync','tmpMaxAgeMs','currentPath','\x20on\x20','arch','writeFileSync','listSnapshotIds','state','distances','pid','USEARCH_BINDINGS_UNAVAILABLE','getMaxElements','crypto','2515742carJEI','setEf','1926736wgtwdz','default','300050iJrkPA','stale','viewRefreshMs','Cos','openSync','readdirSync','push','_snapshotDir','labelToKey','queryVec','now','capacity','size','getCurrentCount','labelForExisting','loadSnapshot','startsWith','existsSync','HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','markDelete','4174983bSvCOm','toString','host','filter','SNAPSHOT.LOCK','L2sq','writeIndexSync','snapshotsDir','worker_threads','published','expansionAdd','[SnapshotStore]','statSync','mtimeMs','keys','utf8','index','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','vectors','manifestVersion','lockPath','ScalarKind','call','_snapshotPaths','exports','snapshot\x20incomplete:\x20','score','platform','isDirectory',').\x20','memoryUsage','min','cleanupTmpDirs','versions','latestSnapshotId','cause','join','prune','round','snapshotTo','Unknown\x20algorithm:\x20\x22','writer','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20','Index','sort','snapshots','node','from','then','sync','map','rmSync','42fRIgLB','maxElements','usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','.tmp-','cosine','tombstone','efConstruction','message','log','Original\x20error:\x20','snapshotEveryChanges','labelForEphemeral','stringify','set','SnapshotStore\x20requires\x20dir','WRITER.LOCK','warn','max','flat','slice','tombstoneCount','4956390ZBMcji','remove','name','readFileSync','1396503qhfmJa','sqrt','readCurrentId','labels.json','resolve','get','reset','parse','usearch','dir','trim','__esModule','unref','snapshot','isFinite','postMessage','publishSnapshot','delete','renameSync','searchKnn','dims','Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20','search','clock','length','mkdirSync'];_0x5bc2=function(){return _0x366627;};return _0x5bc2();}module[_0x67fb04(0xef)]=algorithmWorkerThread;
|
|
1
|
+
'use strict';const _0x2f1a82=_0x2846;(function(_0x2aea6c,_0x4fc697){const _0x371a7e=_0x2846,_0xf58f19=_0x2aea6c();while(!![]){try{const _0x585fa8=parseInt(_0x371a7e(0x1b8))/0x1*(-parseInt(_0x371a7e(0x1a4))/0x2)+parseInt(_0x371a7e(0x16d))/0x3*(parseInt(_0x371a7e(0x1e2))/0x4)+-parseInt(_0x371a7e(0x1bf))/0x5*(-parseInt(_0x371a7e(0x1a6))/0x6)+-parseInt(_0x371a7e(0x1be))/0x7*(parseInt(_0x371a7e(0x14c))/0x8)+parseInt(_0x371a7e(0x18b))/0x9*(parseInt(_0x371a7e(0x175))/0xa)+parseInt(_0x371a7e(0x1af))/0xb+-parseInt(_0x371a7e(0x169))/0xc*(parseInt(_0x371a7e(0x1e7))/0xd);if(_0x585fa8===_0x4fc697)break;else _0xf58f19['push'](_0xf58f19['shift']());}catch(_0x4f886d){_0xf58f19['push'](_0xf58f19['shift']());}}}(_0x370a,0x2c043));var require$$0$1=require(_0x2f1a82(0x1bd)),require$$0=require('fs'),require$$1=require('path'),require$$2=require('os'),require$$3=require(_0x2f1a82(0x159));function getDefaultExportFromCjs(_0x3f4552){const _0x6cf357=_0x2f1a82;return _0x3f4552&&_0x3f4552[_0x6cf357(0x1e1)]&&Object[_0x6cf357(0x162)][_0x6cf357(0x195)]['call'](_0x3f4552,'default')?_0x3f4552[_0x6cf357(0x187)]:_0x3f4552;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x4af8a2=_0x2f1a82;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x290754=require$$0,_0x2884fc=require$$1,_0x4e3458=require$$2,_0x1146cb=require$$3;function _0x52951d(){const _0x29b424=_0x2846;return Date[_0x29b424(0x151)]();}function _0x20c3c6(_0x4858a6){const _0x4cf8db=_0x2846;try{return _0x290754[_0x4cf8db(0x172)](_0x4858a6);}catch{return![];}}function _0x50d3b7(_0x1be124){const _0x1deb48=_0x2846;try{return _0x290754[_0x1deb48(0x1ef)](_0x1be124,_0x1deb48(0x16b));}catch{return null;}}function _0x172b70(_0x2dc9fa,_0x347e6f){const _0x5f4a2b=_0x2846,_0x53028b=_0x2dc9fa+_0x5f4a2b(0x1e6)+_0x1146cb[_0x5f4a2b(0x1ac)](0x6)[_0x5f4a2b(0x1fd)]('hex');_0x290754[_0x5f4a2b(0x147)](_0x53028b,_0x347e6f),_0x290754[_0x5f4a2b(0x142)](_0x53028b,_0x2dc9fa);}function _0x3ea149(_0x151c97,_0x1af740=0x10){const _0x432520=_0x2846,_0x24f6eb=String(Math[_0x432520(0x152)](0x0,Math[_0x432520(0x166)](_0x151c97||0x0)));return _0x24f6eb[_0x432520(0x1aa)]>=_0x1af740?_0x24f6eb:'0'[_0x432520(0x1f2)](_0x1af740-_0x24f6eb[_0x432520(0x1aa)])+_0x24f6eb;}return snapshotStore=class _0x546e90{constructor({dir:_0x1802f1,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x55b84e=_0x2846;if(!_0x1802f1)throw new Error(_0x55b84e(0x1c8));this[_0x55b84e(0x19d)]=_0x1802f1,this[_0x55b84e(0x15e)]=_0x2884fc[_0x55b84e(0x1a8)](_0x1802f1,'snapshots'),this['currentPath']=_0x2884fc[_0x55b84e(0x1a8)](_0x1802f1,_0x55b84e(0x16f)),this[_0x55b84e(0x1fe)]=_0x2884fc[_0x55b84e(0x1a8)](_0x1802f1,'SNAPSHOT.LOCK'),this[_0x55b84e(0x1ce)]=keepSnapshots,this[_0x55b84e(0x1d5)]=log,_0x290754[_0x55b84e(0x15c)](this[_0x55b84e(0x19d)],{'recursive':!![]}),_0x290754[_0x55b84e(0x15c)](this[_0x55b84e(0x15e)],{'recursive':!![]});}[_0x4af8a2(0x1d0)](_0x2eed42){const _0x2f7cfb=_0x4af8a2;return _0x2884fc[_0x2f7cfb(0x1a8)](this[_0x2f7cfb(0x15e)],_0x2eed42);}[_0x4af8a2(0x189)](_0x2fab5b){const _0x1c1d1f=_0x4af8a2,_0x305df7=this[_0x1c1d1f(0x1d0)](_0x2fab5b);return{'dir':_0x305df7,'index':_0x2884fc[_0x1c1d1f(0x1a8)](_0x305df7,_0x1c1d1f(0x167)),'labels':_0x2884fc[_0x1c1d1f(0x1a8)](_0x305df7,_0x1c1d1f(0x17c)),'state':_0x2884fc[_0x1c1d1f(0x1a8)](_0x305df7,_0x1c1d1f(0x1f4))};}[_0x4af8a2(0x1b3)](){const _0x3074a4=_0x4af8a2;if(!_0x20c3c6(this[_0x3074a4(0x14f)]))return null;const _0x4e5d8f=_0x50d3b7(this[_0x3074a4(0x14f)]);if(!_0x4e5d8f)return null;const _0x44d117=String(_0x4e5d8f)[_0x3074a4(0x198)]();return _0x44d117||null;}[_0x4af8a2(0x16e)](){const _0x54be46=_0x4af8a2,_0x21e06b=this[_0x54be46(0x1b3)]();if(!_0x21e06b)return 0x0;const _0x5e2392=Number(_0x21e06b);return Number[_0x54be46(0x148)](_0x5e2392)?_0x5e2392:0x0;}[_0x4af8a2(0x1c5)](){const _0x141878=_0x4af8a2;try{return _0x290754[_0x141878(0x1ee)](this['snapshotsDir'],{'withFileTypes':!![]})[_0x141878(0x17d)](_0x28f6f7=>_0x28f6f7['isDirectory']())['map'](_0x1980b7=>_0x1980b7[_0x141878(0x14e)])['filter'](_0x49bc9a=>!_0x49bc9a[_0x141878(0x1a1)](_0x141878(0x1e6)))[_0x141878(0x17d)](_0x3524ff=>!_0x3524ff[_0x141878(0x1a1)](_0x141878(0x1a2)))[_0x141878(0x156)]();}catch{return[];}}[_0x4af8a2(0x19b)](){const _0x2b1466=_0x4af8a2,_0x5ae4a4=this[_0x2b1466(0x1b3)]();if(_0x5ae4a4)return _0x5ae4a4;const _0x31ee34=this[_0x2b1466(0x1c5)]();if(!_0x31ee34[_0x2b1466(0x1aa)])return null;return _0x31ee34[_0x31ee34['length']-0x1];}[_0x4af8a2(0x173)]({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x32f38e=_0x4af8a2;let _0x524d11;try{_0x524d11=_0x290754['readdirSync'](this[_0x32f38e(0x15e)],{'withFileTypes':!![]});}catch{return;}const _0x32aac2=_0x52951d()-maxAgeMs;for(const _0x598d50 of _0x524d11){if(!_0x598d50[_0x32f38e(0x19e)]())continue;const _0x17662c=_0x598d50[_0x32f38e(0x14e)];if(!_0x17662c[_0x32f38e(0x1a1)](_0x32f38e(0x1e6))&&!_0x17662c[_0x32f38e(0x1a1)]('_tmp-'))continue;const _0x2a4b70=_0x2884fc['join'](this[_0x32f38e(0x15e)],_0x17662c);try{const _0x3db0c1=_0x290754[_0x32f38e(0x190)](_0x2a4b70);if(_0x3db0c1[_0x32f38e(0x1dc)]>_0x32aac2)continue;}catch{}try{_0x290754[_0x32f38e(0x1c0)](_0x2a4b70,{'recursive':!![],'force':!![]});}catch{}}}['prune']({keep:keep=null}={}){const _0x2099fc=_0x4af8a2,_0x4ef4c1=Math[_0x2099fc(0x152)](0x1,Math[_0x2099fc(0x166)](keep??this[_0x2099fc(0x1ce)]??0x3)),_0x240cf4=this[_0x2099fc(0x1c5)]();if(_0x240cf4[_0x2099fc(0x1aa)]<=_0x4ef4c1)return;const _0x7d6f67=this[_0x2099fc(0x1b3)](),_0x523ca7=_0x240cf4[_0x2099fc(0x1a5)](0x0,Math[_0x2099fc(0x152)](0x0,_0x240cf4[_0x2099fc(0x1aa)]-_0x4ef4c1));for(const _0x3869a1 of _0x523ca7){if(_0x7d6f67&&_0x3869a1===_0x7d6f67)continue;const _0x42c47d=this[_0x2099fc(0x1d0)](_0x3869a1);try{_0x290754[_0x2099fc(0x1c0)](_0x42c47d,{'recursive':!![],'force':!![]});}catch{}}}async[_0x4af8a2(0x168)](_0x35c8d9,_0x5f3eba){const _0x264387=_0x4af8a2;if(!_0x35c8d9)throw new Error(_0x264387(0x153));const _0x5d38ac=this['_snapshotPaths'](_0x35c8d9);if(!_0x20c3c6(_0x5d38ac[_0x264387(0x1cc)])||!_0x20c3c6(_0x5d38ac[_0x264387(0x186)])||!_0x20c3c6(_0x5d38ac['state']))throw new Error(_0x264387(0x1f6)+_0x35c8d9);const _0x40b67e=await _0x5f3eba(_0x5d38ac);return _0x40b67e||{};}async[_0x4af8a2(0x1b9)](_0x518c63,_0x21ef18,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x3ccbbf=_0x4af8a2,_0x286f6b=Number(_0x518c63);if(!Number[_0x3ccbbf(0x148)](_0x286f6b)||_0x286f6b<0x0)throw new Error(_0x3ccbbf(0x17f));const _0x3bebd2=_0x3ea149(_0x286f6b),_0x2ed883=this['_snapshotDir'](_0x3bebd2),_0x5946f0=_0x2884fc['join'](this[_0x3ccbbf(0x15e)],_0x3ccbbf(0x1e6)+_0x3bebd2+'-'+_0x1146cb[_0x3ccbbf(0x1ac)](0x6)[_0x3ccbbf(0x1fd)](_0x3ccbbf(0x19c)));_0x290754['mkdirSync'](_0x5946f0,{'recursive':!![]});const _0x37022a={'dir':_0x5946f0,'index':_0x2884fc[_0x3ccbbf(0x1a8)](_0x5946f0,_0x3ccbbf(0x167)),'labels':_0x2884fc[_0x3ccbbf(0x1a8)](_0x5946f0,_0x3ccbbf(0x17c)),'state':_0x2884fc[_0x3ccbbf(0x1a8)](_0x5946f0,'state.json')};await _0x21ef18(_0x37022a,{'id':_0x3bebd2,'clock':_0x286f6b});const _0x5d5594=JSON[_0x3ccbbf(0x1e0)]({'pid':process[_0x3ccbbf(0x1f5)],'host':_0x4e3458[_0x3ccbbf(0x1b2)](),'at':_0x52951d()}),_0x4b7eea=_0x52951d();let _0x1c2d24=null;const _0x1778ec=()=>{const _0x1cc440=_0x3ccbbf;try{const _0x532a7e=JSON[_0x1cc440(0x1ea)](_0x290754[_0x1cc440(0x1ef)](this['lockPath'],_0x1cc440(0x16b)));if(_0x532a7e['at']&&_0x52951d()-_0x532a7e['at']>staleLockMaxAgeMs){const _0x21d864=_0x52951d()-_0x532a7e['at'],_0x18f970='Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20'+Math[_0x1cc440(0x19f)](_0x21d864/0x3e8)+_0x1cc440(0x1db)+_0x532a7e[_0x1cc440(0x1f5)]+_0x1cc440(0x15b)+_0x532a7e[_0x1cc440(0x202)]+_0x1cc440(0x1b4)+_0x1cc440(0x18d);this[_0x1cc440(0x1d5)]?.[_0x1cc440(0x185)]?this[_0x1cc440(0x1d5)]['warn'](_0x18f970):console[_0x1cc440(0x185)](_0x1cc440(0x1f3),_0x18f970);try{_0x290754['unlinkSync'](this[_0x1cc440(0x1fe)]);}catch{}return!![];}}catch{try{_0x290754[_0x1cc440(0x16a)](this[_0x1cc440(0x1fe)]);}catch{}}return![];},_0x3a5fd1=()=>{const _0x2553af=_0x3ccbbf;try{return _0x1c2d24=_0x290754['openSync'](this[_0x2553af(0x1fe)],'wx'),_0x290754[_0x2553af(0x147)](_0x1c2d24,_0x5d5594),!![];}catch(_0x55655a){if(_0x55655a&&_0x55655a['code']===_0x2553af(0x1dd))return![];throw _0x55655a;}};if(!_0x3a5fd1()){_0x1778ec(),_0x3a5fd1();if(_0x1c2d24==null&&lockTimeoutMs>0x0)while(_0x52951d()-_0x4b7eea<lockTimeoutMs){await new Promise(_0x319c38=>setTimeout(_0x319c38,0x19));if(_0x3a5fd1())break;_0x1778ec();}}if(_0x1c2d24==null){try{_0x290754[_0x3ccbbf(0x1c0)](_0x5946f0,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x3ccbbf(0x1ba)};}try{const _0x41c0d5=this[_0x3ccbbf(0x16e)]();if(_0x286f6b<=_0x41c0d5){try{_0x290754[_0x3ccbbf(0x1c0)](_0x5946f0,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x3ccbbf(0x150),'currentClock':_0x41c0d5};}if(!_0x20c3c6(_0x2ed883))_0x290754['renameSync'](_0x5946f0,_0x2ed883);else try{_0x290754[_0x3ccbbf(0x1c0)](_0x5946f0,{'recursive':!![],'force':!![]});}catch{}return _0x172b70(this[_0x3ccbbf(0x14f)],_0x3bebd2+'\x0a'),this[_0x3ccbbf(0x1c3)]({'keep':keep}),{'published':!![],'currentClock':_0x286f6b};}finally{try{_0x290754[_0x3ccbbf(0x141)](_0x1c2d24);}catch{}try{_0x290754[_0x3ccbbf(0x16a)](this[_0x3ccbbf(0x1fe)]);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x42ffc7=_0x2f1a82;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x311ec8=require$$0;class _0x5ec987{constructor(){const _0x533b6c=_0x2846;this[_0x533b6c(0x1df)]=new Map(),this[_0x533b6c(0x174)]=new Map(),this[_0x533b6c(0x1e4)]=0x0,this['_tombstoneCount']=0x0;}async[_0x42ffc7(0x1d9)](){const _0x1d2cdd=_0x42ffc7;this[_0x1d2cdd(0x1df)]=new Map(),this[_0x1d2cdd(0x174)]=new Map(),this[_0x1d2cdd(0x1e4)]=0x0,this[_0x1d2cdd(0x1f7)]=0x0;}async[_0x42ffc7(0x183)](_0x280b9b){const _0x343ef9=_0x42ffc7;if(!_0x280b9b||!_0x311ec8[_0x343ef9(0x172)](_0x280b9b))return await this[_0x343ef9(0x1d9)](),!![];let _0x2938a0;try{_0x2938a0=_0x311ec8[_0x343ef9(0x1ef)](_0x280b9b,'utf8');}catch{return await this[_0x343ef9(0x1d9)](),!![];}let _0x17da1c;try{_0x17da1c=JSON[_0x343ef9(0x1ea)](_0x2938a0);}catch{return await this[_0x343ef9(0x1d9)](),!![];}const _0x595942=Array[_0x343ef9(0x18f)](_0x17da1c?.['entries'])?_0x17da1c[_0x343ef9(0x1c2)]:[],_0x1de8d6=Number[_0x343ef9(0x182)](_0x17da1c?.[_0x343ef9(0x1e4)])?_0x17da1c['nextLabel']:0x0,_0x3770f5=new Map(),_0x392186=new Map();let _0x211d57=-0x1;for(const _0x3a1de7 of _0x595942){if(!Array[_0x343ef9(0x18f)](_0x3a1de7)||_0x3a1de7[_0x343ef9(0x1aa)]!==0x2)continue;const _0x540a99=Number(_0x3a1de7[0x0]),_0x44c427=String(_0x3a1de7[0x1]??'');if(!Number[_0x343ef9(0x182)](_0x540a99)||_0x540a99<0x0)continue;if(!_0x44c427)continue;_0x3770f5['set'](_0x44c427,_0x540a99),_0x392186[_0x343ef9(0x1c1)](_0x540a99,_0x44c427);if(_0x540a99>_0x211d57)_0x211d57=_0x540a99;}return this['keyToLabel']=_0x3770f5,this[_0x343ef9(0x174)]=_0x392186,this[_0x343ef9(0x1e4)]=Math['max'](_0x1de8d6,_0x211d57+0x1,0x0),this[_0x343ef9(0x1f7)]=0x0,!![];}[_0x42ffc7(0x1d6)](_0x528398){const _0x522270=_0x42ffc7;return this[_0x522270(0x1df)][_0x522270(0x15f)](_0x528398);}[_0x42ffc7(0x1ed)](_0xd9ba14){const _0x276c33=_0x42ffc7;let _0xcd43f=this[_0x276c33(0x1df)][_0x276c33(0x15f)](_0xd9ba14);if(_0xcd43f!==undefined)return _0xcd43f;return _0xcd43f=this[_0x276c33(0x1e4)]++,this[_0x276c33(0x1df)][_0x276c33(0x1c1)](_0xd9ba14,_0xcd43f),this['labelToKey']['set'](_0xcd43f,_0xd9ba14),_0xcd43f;}['tombstone'](_0x5a5c6e){const _0x5cf618=_0x42ffc7,_0x439425=this[_0x5cf618(0x1df)]['get'](_0x5a5c6e);if(_0x439425===undefined)return;this[_0x5cf618(0x1df)][_0x5cf618(0x199)](_0x5a5c6e),this[_0x5cf618(0x174)]['delete'](_0x439425),this[_0x5cf618(0x1f7)]++;}[_0x42ffc7(0x1b5)](_0x627b4b){const _0x50460b=_0x42ffc7;return this[_0x50460b(0x174)][_0x50460b(0x15f)](_0x627b4b)??null;}[_0x42ffc7(0x194)](){const _0x11cef1=_0x42ffc7;return this[_0x11cef1(0x1df)]['size'];}[_0x42ffc7(0x13f)](){const _0x428c52=_0x42ffc7;return this[_0x428c52(0x1f7)];}async[_0x42ffc7(0x157)](_0x52d5bc){const _0x1c0d10=_0x42ffc7,_0x4a9712=_0x52d5bc+'.tmp',_0x1aa552=[];for(const [_0x585707,_0x56d5c1]of this['labelToKey'][_0x1c0d10(0x1c2)]()){_0x1aa552['push']([_0x585707,_0x56d5c1]);}_0x1aa552[_0x1c0d10(0x156)]((_0x1ee77b,_0x18cf90)=>_0x1ee77b[0x0]-_0x18cf90[0x0]);const _0x5e1594={'version':0x1,'nextLabel':this[_0x1c0d10(0x1e4)],'entries':_0x1aa552};_0x311ec8[_0x1c0d10(0x147)](_0x4a9712,JSON[_0x1c0d10(0x1e0)](_0x5e1594)),_0x311ec8[_0x1c0d10(0x142)](_0x4a9712,_0x52d5bc);}}return labelMap=_0x5ec987,labelMap;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x1a1c9e=requireSnapshotStore(),_0x58301f=requireLabelMap(),_0x9eae49=0x1;let _0x175d4a=null;function _0x45376c(){const _0x1693fd=_0x2846;if(_0x175d4a)return _0x175d4a;try{return _0x175d4a=require(_0x1693fd(0x158)),_0x175d4a;}catch(_0x385860){const _0x4e4aae=new Error(_0x1693fd(0x181)+('for\x20Node\x20'+process[_0x1693fd(0x15a)]['node']+_0x1693fd(0x18a)+process[_0x1693fd(0x1bc)]+'/'+process[_0x1693fd(0x155)]+'.\x20')+'Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20'+(_0x1693fd(0x1de)+(_0x385860?.[_0x1693fd(0x143)]||String(_0x385860))));_0x4e4aae[_0x1693fd(0x14a)]='HNSW_BINDINGS_UNAVAILABLE',_0x4e4aae['cause']=_0x385860;throw _0x4e4aae;}}return hnsw=function _0x73344d(_0x59ab68={},{dims:_0x3cdb63,dir:_0x52b725}){const _0x4829e9=_0x2846,_0x263f57=_0x45376c();if(!_0x3cdb63||_0x3cdb63<=0x0)throw new Error('hnsw\x20algorithm\x20requires\x20dims\x20>\x200');if(!_0x52b725)throw new Error(_0x4829e9(0x1d8));const _0x4754c9={'metric':_0x59ab68[_0x4829e9(0x15d)]??_0x4829e9(0x1a7),'M':_0x59ab68['M']??0x10,'efConstruction':_0x59ab68[_0x4829e9(0x191)]??0xc8,'efSearch':_0x59ab68[_0x4829e9(0x1fc)]??0x40,'maxElements':_0x59ab68['maxElements']??0x400,'growFactor':_0x59ab68[_0x4829e9(0x1f1)]??0x2,'snapshotEveryChanges':_0x59ab68['snapshotEveryChanges']??0xc350,'keepSnapshots':_0x59ab68['keepSnapshots']??0x2,'tmpMaxAgeMs':_0x59ab68[_0x4829e9(0x178)]??0x6*0x36ee80},_0x27ea57=new _0x1a1c9e({'dir':_0x52b725,'keepSnapshots':_0x4754c9[_0x4829e9(0x1ce)]}),_0x4afa80=new _0x58301f();let _0x41471f=null,_0x50fdba=0x0,_0x220482=null,_0x41baf2=Promise[_0x4829e9(0x160)]();const _0x26b730=_0x37de0e=>{const _0x41c831=_0x4829e9;return _0x41baf2=_0x41baf2[_0x41c831(0x1c9)](_0x37de0e),_0x41baf2;};async function _0x4baa16(_0x2434c5){const _0x57b300=_0x4829e9;await _0x4afa80[_0x57b300(0x1d9)]();const _0x1e70f4=_0x2434c5?await _0x2434c5():[],_0x558b2d=Math[_0x57b300(0x152)](_0x4754c9[_0x57b300(0x165)],Math['ceil'](_0x1e70f4[_0x57b300(0x1aa)]*(_0x4754c9[_0x57b300(0x1f1)]||1.2)),0x1);_0x41471f=new _0x263f57['HierarchicalNSW'](_0x4754c9[_0x57b300(0x15d)],_0x3cdb63),_0x41471f['initIndex']({'maxElements':_0x558b2d,'efConstruction':_0x4754c9[_0x57b300(0x191)],'M':_0x4754c9['M']});for(const {key:_0x457d98,vector:_0xbe283e}of _0x1e70f4){if(!(_0xbe283e instanceof Float32Array)||_0xbe283e[_0x57b300(0x1aa)]!==_0x3cdb63)continue;const _0x2b5c0c=_0x4afa80[_0x57b300(0x1ed)](_0x457d98);_0x41471f['addPoint'](Array[_0x57b300(0x203)](_0xbe283e),_0x2b5c0c);}_0x41471f[_0x57b300(0x1f8)](_0x4754c9[_0x57b300(0x1fc)]),_0x50fdba=0x0;}async function _0x37f2e6(_0x4389a5){const _0x1638b6=_0x4829e9;if(!_0x41471f||!_0x4389a5)return![];const _0x10a851=await _0x27ea57[_0x1638b6(0x1b9)](_0x4389a5,async _0x2ba27a=>{const _0x39504f=_0x1638b6;_0x41471f[_0x39504f(0x180)](_0x2ba27a[_0x39504f(0x1cc)]),await _0x4afa80['snapshotTo'](_0x2ba27a[_0x39504f(0x186)]);const _0x1fc22a=require$$0;_0x1fc22a['writeFileSync'](_0x2ba27a['state'],JSON[_0x39504f(0x1e0)]({'manifestVersion':_0x9eae49,'dims':_0x3cdb63,'metric':_0x4754c9[_0x39504f(0x15d)],'clock':_0x4389a5,'snapshotAt':Date[_0x39504f(0x151)]()},null,0x2));},{'keep':_0x4754c9[_0x1638b6(0x1ce)]});if(_0x10a851?.[_0x1638b6(0x14d)])_0x50fdba=0x0;return _0x10a851?.[_0x1638b6(0x14d)]??![];}async function _0x1842b7(){const _0xa2fc6a=_0x4829e9,_0x270a72=_0x27ea57[_0xa2fc6a(0x1b3)]()||_0x27ea57[_0xa2fc6a(0x19b)]();if(!_0x270a72)return null;let _0xb57bf2,_0x25fdd0=![];return await _0x27ea57[_0xa2fc6a(0x168)](_0x270a72,async _0x48d86e=>{const _0x440482=_0xa2fc6a,_0x115e9a=require$$0;_0xb57bf2=JSON[_0x440482(0x1ea)](_0x115e9a[_0x440482(0x1ef)](_0x48d86e[_0x440482(0x193)],'utf8'));if(_0xb57bf2['manifestVersion']!==_0x9eae49||_0xb57bf2[_0x440482(0x1ca)]!==_0x3cdb63||_0xb57bf2[_0x440482(0x15d)]!==_0x4754c9[_0x440482(0x15d)]){_0xb57bf2=null;return;}await _0x4afa80[_0x440482(0x183)](_0x48d86e[_0x440482(0x186)]),_0x41471f=new _0x263f57['HierarchicalNSW'](_0x4754c9[_0x440482(0x15d)],_0x3cdb63),_0x41471f['readIndexSync'](_0x48d86e[_0x440482(0x1cc)]),_0x41471f[_0x440482(0x1f8)](_0x4754c9['efSearch']),_0x25fdd0=!![];}),_0x25fdd0?_0xb57bf2?.[_0xa2fc6a(0x14b)]??0x0:null;}return{async 'load'(_0x27c301){return _0x26b730(async()=>{const _0x5ee368=_0x2846;_0x27ea57[_0x5ee368(0x173)]({'maxAgeMs':_0x4754c9[_0x5ee368(0x178)]}),_0x220482=_0x27c301??null;const _0x30487c=await _0x1842b7();if(_0x30487c!=null)return _0x30487c;return await _0x4baa16(_0x27c301),null;});},async 'add'(_0x232211,_0x4c165e,_0x10ca81){return _0x26b730(async()=>{const _0x40eb8a=_0x2846;if(!_0x41471f)return;const _0x49ada6=_0x4afa80[_0x40eb8a(0x1ed)](_0x232211);try{_0x41471f[_0x40eb8a(0x18e)](_0x49ada6);}catch{}_0x41471f[_0x40eb8a(0x1d7)]()>=_0x41471f[_0x40eb8a(0x1bb)]()&&(_0x4754c9['maxElements']=Math[_0x40eb8a(0x204)](_0x41471f[_0x40eb8a(0x1bb)]()*(_0x4754c9[_0x40eb8a(0x1f1)]||0x2)),await _0x4baa16(_0x220482)),_0x41471f['addPoint'](Array[_0x40eb8a(0x203)](_0x4c165e),_0x49ada6),_0x50fdba++,_0x50fdba>=_0x4754c9[_0x40eb8a(0x197)]&&await _0x37f2e6(_0x10ca81??Date[_0x40eb8a(0x151)]());});},async 'remove'(_0x37e79f){return _0x26b730(async()=>{const _0x35c143=_0x2846;if(!_0x41471f)return;const _0xebf3e0=_0x4afa80[_0x35c143(0x1d6)](_0x37e79f);if(_0xebf3e0===undefined)return;try{_0x41471f[_0x35c143(0x18e)](_0xebf3e0);}catch{}_0x4afa80[_0x35c143(0x201)](_0x37e79f),_0x50fdba++;});},'search'(_0x38940d,{limit:limit=0xa,efSearch:_0x5eb1cb}={}){const _0x11534c=_0x4829e9;if(!_0x41471f)return[];if(Number[_0x11534c(0x182)](_0x5eb1cb))_0x41471f[_0x11534c(0x1f8)](_0x5eb1cb);const _0x3dfa73=Math[_0x11534c(0x1f9)](limit,_0x41471f[_0x11534c(0x1d7)]()||0x1),{neighbors:_0x665cb3,distances:_0x252474}=_0x41471f[_0x11534c(0x154)](Array[_0x11534c(0x203)](_0x38940d),_0x3dfa73),_0x314765=[];for(let _0x3da042=0x0;_0x3da042<_0x665cb3[_0x11534c(0x1aa)];_0x3da042++){const _0x55b10c=_0x4afa80['keyForLabel'](_0x665cb3[_0x3da042]);if(!_0x55b10c)continue;const _0x702c10=_0x4754c9[_0x11534c(0x15d)]===_0x11534c(0x1a7)?Math[_0x11534c(0x152)](0x0,0x1-_0x252474[_0x3da042]):0x1/(0x1+_0x252474[_0x3da042]);_0x314765[_0x11534c(0x200)]({'key':_0x55b10c,'score':_0x702c10});}return _0x314765;},async 'snapshot'(_0x446c02=Date[_0x4829e9(0x151)]()){return _0x26b730(()=>_0x37f2e6(_0x446c02));},async 'rebuild'(_0x78fd1){return _0x26b730(()=>{if(_0x78fd1!=null)_0x220482=_0x78fd1;return _0x4baa16(_0x78fd1??_0x220482);});},async 'stop'(){const _0xf450aa=_0x4829e9;return _0x26b730(()=>_0x37f2e6(Date[_0xf450aa(0x151)]()));},'count'(){const _0x19eecb=_0x4829e9;return _0x4afa80[_0x19eecb(0x194)]();},'info'(){const _0x174b20=_0x4829e9;return{'algorithm':_0x174b20(0x177),'metric':_0x4754c9[_0x174b20(0x15d)],'M':_0x4754c9['M'],'efConstruction':_0x4754c9[_0x174b20(0x191)],'efSearch':_0x4754c9[_0x174b20(0x1fc)],'maxElements':_0x41471f?.[_0x174b20(0x1bb)]()??_0x4754c9['maxElements'],'count':_0x4afa80[_0x174b20(0x194)](),'changesSince':_0x50fdba,'snapshotDir':_0x52b725,'latestSnapshot':_0x27ea57[_0x174b20(0x1b3)]()??null};}};},hnsw;}function _0x370a(){const _0x5b10f0=['Unknown\x20op:\x20\x22','ScalarKind','2699yuhmmI','publishSnapshot','lock_busy','getMaxElements','platform','worker_threads','21CXckPN','25pvyUyZ','rmSync','set','entries','prune','Cos','listSnapshotIds','load','usearch\x20algorithm\x20requires\x20dims\x20>\x200','SnapshotStore\x20requires\x20dir','then','dims','count','index','MetricKind','keepSnapshots','search','_snapshotDir','viewRefreshMs','capacity','openSync','distances','log','labelForExisting','getCurrentCount','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','reset','postMessage','s,\x20pid:\x20','mtimeMs','EEXIST','Original\x20error:\x20','keyToLabel','stringify','__esModule','102244vmGDzt','stop','nextLabel','connectivity','.tmp-','691613LbXFTz','heartbeatIntervalMs','view','parse','vector','unref','labelForEphemeral','readdirSync','readFileSync','remove','growFactor','repeat','[SnapshotStore]','state.json','pid','snapshot\x20incomplete:\x20','_tombstoneCount','setEf','min','opts','flat','efSearch','toString','lockPath','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','push','tombstone','host','from','ceil','tombstoneCount','add','closeSync','renameSync','message','map','queryVec','F32','writeFileSync','isFinite','for\x20Node\x20','code','clock','69160McEEkM','published','name','currentPath','stale','now','max','snapshot\x20id\x20required','searchKnn','arch','sort','snapshotTo','hnswlib-node','crypto','versions',',\x20host:\x20','mkdirSync','metric','snapshotsDir','get','resolve','usearch','prototype','node','memoryUsage','maxElements','trunc','index.hnsw','loadSnapshot','12kXqhsz','unlinkSync','utf8','cause','18fbYuAh','readCurrentClock','CURRENT','WRITER.LOCK','reader','existsSync','cleanupTmpDirs','labelToKey','10UDkyPM','writerLockMaxAgeMs','hnsw','tmpMaxAgeMs','save','snapshot','info','labels.json','filter','algorithm','candidateClock\x20must\x20be\x20finite\x20>=\x200','writeIndexSync','HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','isInteger','loadFrom','keys','warn','labels','default','expansionSearch','_snapshotPaths','\x20on\x20','120123WkyGzo','USEARCH_BINDINGS_UNAVAILABLE','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','markDelete','isArray','statSync','efConstruction','vectors','state','size','hasOwnProperty','sqrt','snapshotEveryChanges','trim','delete','manifestVersion','latestSnapshotId','hex','dir','isDirectory','round','rebuild','startsWith','_tmp-','clear','78PIZNLN','slice','101526OnOCZp','cosine','join','exports','length','Index','randomBytes','score','expansionAdd','1247070uWwCHD','key','ready','hostname','readCurrentId',').\x20','keyForLabel'];_0x370a=function(){return _0x5b10f0;};return _0x370a();}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0xb27747(_0x57de50={}){const _0x3f1663=new Map();return{async 'load'(_0x1d5096){const _0x5bc54b=_0x2846;_0x3f1663[_0x5bc54b(0x1a3)]();if(_0x1d5096)for(const {key:_0x2b2b2d,vector:_0x420819}of await _0x1d5096()){_0x3f1663[_0x5bc54b(0x1c1)](_0x2b2b2d,_0x420819);}},async 'add'(_0x56712f,_0x4214bb,_0x557cd5){const _0x270610=_0x2846;_0x3f1663[_0x270610(0x1c1)](_0x56712f,_0x4214bb);},async 'remove'(_0x150a2c){const _0x5abcb2=_0x2846;_0x3f1663[_0x5abcb2(0x199)](_0x150a2c);},'search'(_0xb9803a,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x2b8bdd=_0x2846,_0x578879=[];for(const [_0x40ed63,_0x2cdf33]of _0x3f1663){const _0x298d8c=_0x206f63(_0xb9803a,_0x2cdf33);if(_0x298d8c>=threshold)_0x578879[_0x2b8bdd(0x200)]({'key':_0x40ed63,'score':_0x298d8c});}return _0x578879[_0x2b8bdd(0x156)]((_0x4706c6,_0x2f3c9a)=>_0x2f3c9a[_0x2b8bdd(0x1ad)]-_0x4706c6[_0x2b8bdd(0x1ad)]),_0x578879[_0x2b8bdd(0x1a5)](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x5b12f1){const _0x3c953c=_0x2846;await this[_0x3c953c(0x1c6)](_0x5b12f1);},async 'stop'(){},'count'(){const _0x32a464=_0x2846;return _0x3f1663[_0x32a464(0x194)];},'info'(){const _0x3e6b66=_0x2846;return{'algorithm':_0x3e6b66(0x1fb),'count':_0x3f1663[_0x3e6b66(0x194)]};}};};function _0x206f63(_0x18b240,_0x30379){const _0x141c1a=_0x2846;let _0x524f75=0x0,_0x12afa4=0x0,_0x1195f5=0x0;for(let _0x3911bd=0x0;_0x3911bd<_0x18b240[_0x141c1a(0x1aa)];_0x3911bd++){_0x524f75+=_0x18b240[_0x3911bd]*_0x30379[_0x3911bd],_0x12afa4+=_0x18b240[_0x3911bd]*_0x18b240[_0x3911bd],_0x1195f5+=_0x30379[_0x3911bd]*_0x30379[_0x3911bd];}const _0x51d31a=Math[_0x141c1a(0x196)](_0x12afa4)*Math['sqrt'](_0x1195f5);return _0x51d31a===0x0?0x0:_0x524f75/_0x51d31a;}return flat;}function _0x2846(_0x1a348f,_0x299a6e){_0x1a348f=_0x1a348f-0x13f;const _0x370a34=_0x370a();let _0x284677=_0x370a34[_0x1a348f];return _0x284677;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x42b739=require$$0,_0x379a77=require$$1,_0x321b5c=requireSnapshotStore(),_0x45e684=requireLabelMap(),_0x5ab985=0x1;let _0x119c43=null;function _0x542525(){const _0x5ef145=_0x2846;if(_0x119c43)return _0x119c43;try{return _0x119c43=require(_0x5ef145(0x161)),_0x119c43;}catch(_0x2a76cc){const _0x4e4d64=new Error(_0x5ef145(0x1ff)+(_0x5ef145(0x149)+process['versions'][_0x5ef145(0x163)]+_0x5ef145(0x18a)+process['platform']+'/'+process['arch']+'.\x20')+'Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20'+(_0x5ef145(0x1de)+(_0x2a76cc?.['message']||String(_0x2a76cc))));_0x4e4d64[_0x5ef145(0x14a)]=_0x5ef145(0x18c),_0x4e4d64[_0x5ef145(0x16c)]=_0x2a76cc;throw _0x4e4d64;}}function _0xc9ab26(_0x27cba5,_0x444a41){const _0x2b3511=_0x2846;switch(_0x27cba5){case'cosine':return _0x444a41[_0x2b3511(0x1cd)][_0x2b3511(0x1c4)];case'l2':return _0x444a41[_0x2b3511(0x1cd)]['L2sq'];case'ip':return _0x444a41['MetricKind']['IP'];default:return _0x444a41['MetricKind'][_0x2b3511(0x1c4)];}}return usearch=function _0x503351(_0x1ce51e={},{dims:_0x50fc82,dir:_0x407d07}){const _0x5846b1=_0x2846,_0x12c854=_0x542525();if(!_0x50fc82||_0x50fc82<=0x0)throw new Error(_0x5846b1(0x1c7));if(!_0x407d07)throw new Error('usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage');const _0x53941c={'metric':_0x1ce51e[_0x5846b1(0x15d)]??_0x5846b1(0x1a7),'connectivity':_0x1ce51e[_0x5846b1(0x1e5)]??0x10,'expansionAdd':_0x1ce51e[_0x5846b1(0x1ae)]??0x80,'expansionSearch':_0x1ce51e[_0x5846b1(0x188)]??0x40,'snapshotEveryChanges':_0x1ce51e[_0x5846b1(0x197)]??0xc350,'keepSnapshots':_0x1ce51e[_0x5846b1(0x1ce)]??0x2,'tmpMaxAgeMs':_0x1ce51e[_0x5846b1(0x178)]??0x6*0x36ee80,'heartbeatIntervalMs':_0x1ce51e[_0x5846b1(0x1e8)]??0x1388,'writerLockMaxAgeMs':_0x1ce51e[_0x5846b1(0x176)]??0x3a98,'viewRefreshMs':_0x1ce51e[_0x5846b1(0x1d1)]??0x3e8},_0x28a7e2=new _0x321b5c({'dir':_0x407d07,'keepSnapshots':_0x53941c[_0x5846b1(0x1ce)]}),_0x3bf794=_0x379a77[_0x5846b1(0x1a8)](_0x407d07,_0x5846b1(0x170));let _0x1567e7=new _0x45e684(),_0x41deb5=null,_0xd34213=0x0,_0x3a9033=null,_0x4cd784=![],_0x14dc35=null,_0x28f21a=null,_0x4be533=0x0,_0xabcfb8=![],_0x10b3fa=Promise[_0x5846b1(0x160)]();const _0x5446ac=_0x1722b4=>{const _0x195032=_0x5846b1;return _0x10b3fa=_0x10b3fa[_0x195032(0x1c9)](_0x1722b4),_0x10b3fa;};function _0x115a24(){const _0xc99bd=_0x5846b1;return new _0x12c854[(_0xc99bd(0x1ab))]({'dimensions':_0x50fc82,'metric':_0xc9ab26(_0x53941c[_0xc99bd(0x15d)],_0x12c854),'quantization':_0x12c854[_0xc99bd(0x1b7)][_0xc99bd(0x146)],'connectivity':_0x53941c[_0xc99bd(0x1e5)],'expansion_add':_0x53941c[_0xc99bd(0x1ae)],'expansion_search':_0x53941c['expansionSearch'],'multi':![]});}function _0x540406(_0x5a7417){return _0x5a7417 instanceof Float32Array?_0x5a7417:new Float32Array(_0x5a7417);}function _0x326d70(){const _0x249659=_0x5846b1,_0x54d417=JSON['stringify']({'pid':process[_0x249659(0x1f5)],'at':Date[_0x249659(0x151)]()}),_0x2205ba=()=>{const _0x82f73=_0x249659;try{const _0x1541b4=_0x42b739[_0x82f73(0x1d3)](_0x3bf794,'wx');return _0x42b739[_0x82f73(0x147)](_0x1541b4,_0x54d417),_0x42b739[_0x82f73(0x141)](_0x1541b4),!![];}catch(_0x37a731){if(_0x37a731?.[_0x82f73(0x14a)]===_0x82f73(0x1dd))return![];throw _0x37a731;}};if(_0x2205ba())return!![];try{const _0x262b55=JSON[_0x249659(0x1ea)](_0x42b739[_0x249659(0x1ef)](_0x3bf794,_0x249659(0x16b))),_0x27d828=Date[_0x249659(0x151)]()-(_0x262b55['at']??0x0);if(_0x27d828<_0x53941c['writerLockMaxAgeMs'])return![];}catch{}try{_0x42b739['unlinkSync'](_0x3bf794);}catch{}return _0x2205ba();}function _0x3d0b3f(){const _0x140814=_0x5846b1;if(_0x14dc35)clearInterval(_0x14dc35);_0x14dc35=setInterval(()=>{const _0x554477=_0x2846;try{_0x42b739[_0x554477(0x147)](_0x3bf794,JSON['stringify']({'pid':process['pid'],'at':Date[_0x554477(0x151)]()}));}catch{}},_0x53941c[_0x140814(0x1e8)]),_0x14dc35[_0x140814(0x1ec)]();}function _0x1ed0d6(){const _0x1afa81=_0x5846b1;_0x14dc35&&(clearInterval(_0x14dc35),_0x14dc35=null);try{const _0x1e1519=JSON[_0x1afa81(0x1ea)](_0x42b739[_0x1afa81(0x1ef)](_0x3bf794,'utf8'));if(_0x1e1519[_0x1afa81(0x1f5)]===process[_0x1afa81(0x1f5)])_0x42b739['unlinkSync'](_0x3bf794);}catch{}}async function _0x5c19c3(_0x233065){const _0x337c42=_0x5846b1;_0x1567e7=new _0x45e684(),await _0x1567e7[_0x337c42(0x1d9)](),_0x41deb5=_0x115a24();const _0x1ab104=_0x233065?await _0x233065():[];for(const {key:_0x187a73,vector:_0x3db4bf}of _0x1ab104){if(!(_0x3db4bf instanceof Float32Array)||_0x3db4bf['length']!==_0x50fc82)continue;const _0x3a518c=_0x1567e7['labelForEphemeral'](_0x187a73);_0x41deb5[_0x337c42(0x140)](BigInt(_0x3a518c),_0x3db4bf);}_0xd34213=0x0;}async function _0xd51111(_0x2be25e){const _0x36c650=_0x5846b1;if(!_0x41deb5||!_0x2be25e)return![];const _0x2c33b0=await _0x28a7e2[_0x36c650(0x1b9)](_0x2be25e,async _0x37d4fe=>{const _0x36f51c=_0x36c650;_0x41deb5[_0x36f51c(0x179)](_0x37d4fe[_0x36f51c(0x1cc)]),await _0x1567e7[_0x36f51c(0x157)](_0x37d4fe[_0x36f51c(0x186)]),_0x42b739['writeFileSync'](_0x37d4fe[_0x36f51c(0x193)],JSON['stringify']({'manifestVersion':_0x5ab985,'algorithm':_0x36f51c(0x161),'dims':_0x50fc82,'metric':_0x53941c[_0x36f51c(0x15d)],'clock':_0x2be25e,'snapshotAt':Date['now']()},null,0x2));},{'keep':_0x53941c[_0x36c650(0x1ce)]});if(_0x2c33b0?.['published'])_0xd34213=0x0;return _0x2c33b0?.[_0x36c650(0x14d)]??![];}async function _0x5899bf(){const _0x23c144=_0x5846b1,_0x190a5f=_0x28a7e2[_0x23c144(0x1b3)]()||_0x28a7e2['latestSnapshotId']();if(!_0x190a5f)return null;let _0x404d45,_0x54e1c5=![];return await _0x28a7e2[_0x23c144(0x168)](_0x190a5f,async _0x12579f=>{const _0x4f731d=_0x23c144;_0x404d45=JSON[_0x4f731d(0x1ea)](_0x42b739[_0x4f731d(0x1ef)](_0x12579f[_0x4f731d(0x193)],_0x4f731d(0x16b)));if(_0x404d45[_0x4f731d(0x19a)]!==_0x5ab985||_0x404d45['algorithm']!==_0x4f731d(0x161)||_0x404d45[_0x4f731d(0x1ca)]!==_0x50fc82||_0x404d45[_0x4f731d(0x15d)]!==_0x53941c[_0x4f731d(0x15d)]){_0x404d45=null;return;}_0x1567e7=new _0x45e684(),await _0x1567e7['loadFrom'](_0x12579f[_0x4f731d(0x186)]),_0x41deb5=_0x115a24(),_0x41deb5[_0x4f731d(0x1c6)](_0x12579f[_0x4f731d(0x1cc)]),_0x54e1c5=!![];}),_0x54e1c5?_0x404d45?.['clock']??0x0:null;}async function _0x1816ac(_0x2e2560){const _0x29378d=_0x5846b1;if(!_0x2e2560)return![];let _0xacba7c=![];try{await _0x28a7e2[_0x29378d(0x168)](_0x2e2560,async _0x39832a=>{const _0x43df2b=_0x29378d,_0x38c829=JSON['parse'](_0x42b739[_0x43df2b(0x1ef)](_0x39832a[_0x43df2b(0x193)],_0x43df2b(0x16b)));if(_0x38c829[_0x43df2b(0x19a)]!==_0x5ab985||_0x38c829[_0x43df2b(0x17e)]!==_0x43df2b(0x161)||_0x38c829[_0x43df2b(0x1ca)]!==_0x50fc82||_0x38c829[_0x43df2b(0x15d)]!==_0x53941c[_0x43df2b(0x15d)])return;const _0x21de61=new _0x45e684();await _0x21de61['loadFrom'](_0x39832a[_0x43df2b(0x186)]);const _0x3c109c=_0x115a24();_0x3c109c[_0x43df2b(0x1e9)](_0x39832a['index']),_0x41deb5=_0x3c109c,_0x1567e7=_0x21de61,_0x28f21a=_0x2e2560,_0xacba7c=!![];});}catch{}return _0xacba7c;}async function _0x1b712b(_0x5dd5fe){try{await _0x1816ac(_0x5dd5fe);}finally{_0xabcfb8=![];}}function _0x45f63c(){const _0x2b42cb=_0x5846b1,_0x13d6aa=Date[_0x2b42cb(0x151)]();if(_0x13d6aa-_0x4be533<_0x53941c[_0x2b42cb(0x1d1)])return;_0x4be533=_0x13d6aa;if(_0xabcfb8)return;const _0x59ac34=_0x28a7e2[_0x2b42cb(0x1b3)]()||_0x28a7e2[_0x2b42cb(0x19b)]();if(!_0x59ac34||_0x59ac34===_0x28f21a)return;_0xabcfb8=!![],_0x1b712b(_0x59ac34);}async function _0x400880(){const _0x4f2e7c=_0x5846b1;_0x4cd784=!![],_0x3d0b3f();if(_0x28f21a)try{const _0x5c85cf=new _0x45e684();let _0x29301a=![];await _0x28a7e2[_0x4f2e7c(0x168)](_0x28f21a,async _0x1bbfd7=>{const _0x16e55b=_0x4f2e7c;await _0x5c85cf[_0x16e55b(0x183)](_0x1bbfd7[_0x16e55b(0x186)]);const _0x2677cf=_0x115a24();_0x2677cf[_0x16e55b(0x1c6)](_0x1bbfd7[_0x16e55b(0x1cc)]),_0x41deb5=_0x2677cf,_0x1567e7=_0x5c85cf,_0x29301a=!![];});if(_0x29301a)return;}catch{}await _0x5c19c3(_0x3a9033);}return{async 'load'(_0x9971a5){return _0x5446ac(async()=>{const _0x50e2d3=_0x2846;_0x28a7e2[_0x50e2d3(0x173)]({'maxAgeMs':_0x53941c[_0x50e2d3(0x178)]}),_0x3a9033=_0x9971a5??null,_0x4cd784=_0x326d70();if(_0x4cd784){_0x3d0b3f();const _0x4c77dc=await _0x5899bf();if(_0x4c77dc!=null)return _0x4c77dc;return await _0x5c19c3(_0x9971a5),null;}const _0x142073=_0x28a7e2['readCurrentId']()||_0x28a7e2[_0x50e2d3(0x19b)]();return await _0x1816ac(_0x142073),null;});},async 'add'(_0xac46ac,_0x2fac5,_0x5730a2){return _0x5446ac(async()=>{const _0x56e895=_0x2846;if(!_0x4cd784){if(!_0x326d70())return;await _0x400880();}if(!_0x41deb5)return;const _0x2b30ce=_0x1567e7['labelForExisting'](_0xac46ac);if(_0x2b30ce!==undefined)try{_0x41deb5[_0x56e895(0x1f0)](BigInt(_0x2b30ce));}catch{}const _0x2d3148=_0x1567e7[_0x56e895(0x1ed)](_0xac46ac);_0x41deb5[_0x56e895(0x140)](BigInt(_0x2d3148),_0x540406(_0x2fac5)),_0xd34213++,_0xd34213>=_0x53941c[_0x56e895(0x197)]&&await _0xd51111(_0x5730a2??Date['now']());});},async 'remove'(_0x40bb9){return _0x5446ac(async()=>{const _0x5bf21f=_0x2846;if(!_0x4cd784){if(!_0x326d70())return;await _0x400880();}if(!_0x41deb5)return;const _0x5e62ec=_0x1567e7[_0x5bf21f(0x1d6)](_0x40bb9);if(_0x5e62ec===undefined)return;try{_0x41deb5[_0x5bf21f(0x1f0)](BigInt(_0x5e62ec));}catch{}_0x1567e7[_0x5bf21f(0x201)](_0x40bb9),_0xd34213++;});},'search'(_0x49f66b,{limit:limit=0xa}={}){const _0x3991ba=_0x5846b1;if(!_0x4cd784)_0x45f63c();if(!_0x41deb5)return[];const _0x4fb786=_0x41deb5[_0x3991ba(0x194)]();if(_0x4fb786===0x0)return[];const _0x416725=Math[_0x3991ba(0x1f9)](limit,_0x4fb786),_0x3d5644=_0x41deb5[_0x3991ba(0x1cf)](_0x540406(_0x49f66b),_0x416725,0x0),_0x4e247f=[],_0x5106de=_0x3d5644[_0x3991ba(0x184)],_0x49c3a1=_0x3d5644[_0x3991ba(0x1d4)];for(let _0x36903b=0x0;_0x36903b<_0x5106de[_0x3991ba(0x1aa)];_0x36903b++){const _0x4d587b=_0x5106de[_0x36903b];if(_0x4d587b===0xffffffffffffffffn)continue;const _0x1f8851=Number(_0x4d587b),_0x47a5f1=_0x1567e7[_0x3991ba(0x1b5)](_0x1f8851);if(!_0x47a5f1)continue;const _0x434bd1=_0x49c3a1[_0x36903b];let _0x1ddf8f;if(_0x53941c['metric']===_0x3991ba(0x1a7))_0x1ddf8f=Math[_0x3991ba(0x152)](0x0,0x1-_0x434bd1);else{if(_0x53941c[_0x3991ba(0x15d)]==='ip')_0x1ddf8f=-_0x434bd1;else _0x1ddf8f=0x1/(0x1+_0x434bd1);}_0x4e247f[_0x3991ba(0x200)]({'key':_0x47a5f1,'score':_0x1ddf8f});}return _0x4e247f;},async 'snapshot'(_0x543654=Date[_0x5846b1(0x151)]()){if(!_0x4cd784)return![];return _0x5446ac(()=>_0xd51111(_0x543654));},async 'rebuild'(_0x2fa7a3){if(!_0x4cd784)return;return _0x5446ac(()=>{if(_0x2fa7a3!=null)_0x3a9033=_0x2fa7a3;return _0x5c19c3(_0x2fa7a3??_0x3a9033);});},async 'stop'(){return _0x5446ac(async()=>{_0x4cd784&&(await _0xd51111(Date['now']()),_0x1ed0d6());});},'count'(){const _0x481e62=_0x5846b1;return _0x1567e7[_0x481e62(0x194)]();},'info'(){const _0x590538=_0x5846b1;return{'algorithm':'usearch','role':_0x4cd784?'writer':_0x590538(0x171),'metric':_0x53941c[_0x590538(0x15d)],'connectivity':_0x53941c[_0x590538(0x1e5)],'expansionAdd':_0x53941c[_0x590538(0x1ae)],'expansionSearch':_0x53941c[_0x590538(0x188)],'count':_0x1567e7[_0x590538(0x194)](),'size':_0x41deb5?.[_0x590538(0x194)]?.()??0x0,'capacity':_0x41deb5?.[_0x590538(0x1d2)]?.()??0x0,'changesSince':_0x4cd784?_0xd34213:null,'viewedSnapshot':_0x28f21a??null,'snapshotDir':_0x407d07,'latestSnapshot':_0x28a7e2[_0x590538(0x1b3)]()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0x10d3c9=_0x2f1a82;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x40c05e,workerData:_0x2d278a}=require$$0$1,{algorithmName:_0x3e8431,algorithmConfig:_0x274821,dims:_0x590ecd,dir:_0xce54bd}=_0x2d278a;let _0x5287c5;if(_0x3e8431==='hnsw')_0x5287c5=requireHnsw()(_0x274821,{'dims':_0x590ecd,'dir':_0xce54bd});else{if(_0x3e8431===_0x10d3c9(0x1fb))_0x5287c5=requireFlat()(_0x274821,{'dims':_0x590ecd,'dir':_0xce54bd});else{if(_0x3e8431==='usearch')_0x5287c5=requireUsearch()(_0x274821,{'dims':_0x590ecd,'dir':_0xce54bd});else throw new Error('Unknown\x20algorithm:\x20\x22'+_0x3e8431+'\x22');}}function _0x24fe62(){const _0x5ec1c2=_0x10d3c9;try{_0x40c05e[_0x5ec1c2(0x1da)]({'op':'sync','count':_0x5287c5[_0x5ec1c2(0x1cb)](),'info':_0x5287c5[_0x5ec1c2(0x17b)](),'memory':process[_0x5ec1c2(0x164)]()});}catch{}}return _0x40c05e['on'](_0x10d3c9(0x143),async _0x4f7b9b=>{const _0x55f3af=_0x10d3c9,{id:_0x2d8097,op:_0x54eb41,args:_0x43a19e}=_0x4f7b9b;try{let _0x5a6c7e;switch(_0x54eb41){case'load':{const _0x25c80a=(_0x43a19e[_0x55f3af(0x192)]||[])[_0x55f3af(0x144)](_0x26ff28=>({'key':_0x26ff28['key'],'vector':_0x26ff28['vector']instanceof Float32Array?_0x26ff28[_0x55f3af(0x1eb)]:new Float32Array(_0x26ff28[_0x55f3af(0x1eb)])}));_0x5a6c7e=await _0x5287c5[_0x55f3af(0x1c6)](async()=>_0x25c80a),_0x24fe62();break;}case _0x55f3af(0x140):{const _0xb44930=_0x43a19e[_0x55f3af(0x1eb)]instanceof Float32Array?_0x43a19e[_0x55f3af(0x1eb)]:new Float32Array(_0x43a19e['vector']);await _0x5287c5['add'](_0x43a19e[_0x55f3af(0x1b0)],_0xb44930,_0x43a19e[_0x55f3af(0x14b)]??undefined),_0x24fe62(),_0x5a6c7e=null;break;}case _0x55f3af(0x1f0):{await _0x5287c5['remove'](_0x43a19e['key']),_0x24fe62(),_0x5a6c7e=null;break;}case _0x55f3af(0x1cf):{const _0x38786d=_0x43a19e[_0x55f3af(0x145)]instanceof Float32Array?_0x43a19e[_0x55f3af(0x145)]:new Float32Array(_0x43a19e[_0x55f3af(0x145)]);_0x5a6c7e=_0x5287c5['search'](_0x38786d,_0x43a19e[_0x55f3af(0x1fa)]||{});break;}case _0x55f3af(0x17a):{_0x5a6c7e=await _0x5287c5['snapshot'](_0x43a19e['clock']),_0x24fe62();break;}case _0x55f3af(0x1a0):{const _0x2aaa2a=(_0x43a19e[_0x55f3af(0x192)]||[])[_0x55f3af(0x144)](_0x3adbd0=>({'key':_0x3adbd0[_0x55f3af(0x1b0)],'vector':_0x3adbd0[_0x55f3af(0x1eb)]instanceof Float32Array?_0x3adbd0[_0x55f3af(0x1eb)]:new Float32Array(_0x3adbd0[_0x55f3af(0x1eb)])}));await _0x5287c5[_0x55f3af(0x1a0)](async()=>_0x2aaa2a),_0x24fe62(),_0x5a6c7e=null;break;}case _0x55f3af(0x1e3):{await _0x5287c5[_0x55f3af(0x1e3)](),_0x24fe62(),_0x5a6c7e=null;break;}case _0x55f3af(0x1cb):{_0x5a6c7e=_0x5287c5['count']();break;}case _0x55f3af(0x17b):{_0x5a6c7e=_0x5287c5[_0x55f3af(0x17b)]();break;}default:throw new Error(_0x55f3af(0x1b6)+_0x54eb41+'\x22');}_0x40c05e['postMessage']({'id':_0x2d8097,'result':_0x5a6c7e});}catch(_0xeaffec){_0x40c05e[_0x55f3af(0x1da)]({'id':_0x2d8097,'error':{'message':_0xeaffec?.[_0x55f3af(0x143)]||String(_0xeaffec),'code':_0xeaffec?.['code']}});}}),_0x40c05e['postMessage']({'op':_0x10d3c9(0x1b1)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module[_0x2f1a82(0x1a9)]=algorithmWorkerThread;
|