@kedem/okdb 2.1.2 → 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/docs/embeddings.md +3 -3
- package/docs/querying.md +20 -0
- package/docs/views.md +32 -32
- package/okdb-functions-sandbox-worker.js +1 -1
- package/okdb-http-worker-child.js +1 -1
- package/okdb-views-bootstrap-worker.js +1 -1
- package/okdb.js +1 -1
- package/package.json +1 -1
- package/types/environment.d.ts +4 -2
- package/types/features/views.d.ts +38 -4
- package/types/index.d.ts +4 -2
- package/types/options.d.ts +25 -3
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 _0x4ea323=_0x1eb2;(function(_0x5c9582,_0x3acca7){const _0x47e396=_0x1eb2,_0x31e27c=_0x5c9582();while(!![]){try{const _0x4c0aa8=parseInt(_0x47e396(0x137))/0x1*(parseInt(_0x47e396(0x19a))/0x2)+-parseInt(_0x47e396(0x17d))/0x3+-parseInt(_0x47e396(0x15b))/0x4+-parseInt(_0x47e396(0x145))/0x5*(parseInt(_0x47e396(0x159))/0x6)+-parseInt(_0x47e396(0x1ce))/0x7+-parseInt(_0x47e396(0x154))/0x8+-parseInt(_0x47e396(0x18a))/0x9*(-parseInt(_0x47e396(0x17f))/0xa);if(_0x4c0aa8===_0x3acca7)break;else _0x31e27c['push'](_0x31e27c['shift']());}catch(_0x5ebd08){_0x31e27c['push'](_0x31e27c['shift']());}}}(_0x372b,0x84538));function _0x372b(){const _0x4344eb=['min','index','isDirectory','rebuild','memoryUsage','ready','keepSnapshots','viewRefreshMs','mkdirSync','writerLockMaxAgeMs','lock_busy','usearch','_tombstoneCount','Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20','initIndex','utf8','cleanupTmpDirs',',\x20host:\x20','remove','loadSnapshot','F32','call','HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','_snapshotDir','randomBytes','trunc','WRITER.LOCK','tombstone','latestSnapshotId','sort','flat','452522RgziRl','sqrt','labels','labels.json','efConstruction','set','node','sync','writeFileSync','from','lockPath','loadFrom','currentPath','keys','closeSync','prune','index.hnsw','startsWith','for\x20Node\x20','CURRENT','snapshotsDir','capacity','nextLabel','readFileSync','efSearch','expansionSearch','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20','hex','stop','isArray','isFinite','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','hnswlib-node','search','warn','join','Cos','map','path','max','1nfEvzy','delete','vectors','USEARCH_BINDINGS_UNAVAILABLE','cosine','labelToKey','candidateClock\x20must\x20be\x20finite\x20>=\x200','SnapshotStore\x20requires\x20dir','snapshot\x20id\x20required','arch','growFactor','Unknown\x20algorithm:\x20\x22','Index','readdirSync','5XircYL','connectivity','HierarchicalNSW','ceil','length','Original\x20error:\x20','resolve','algorithm','tombstoneCount','metric','info','push','then','reset','stale','2360032UydIVb','heartbeatIntervalMs','writer','queryVec','load','5719578CFBRps','view','3448444MAqVkj','distances','dir','name','code','dims','pid','rmSync','_snapshotPaths','key','getCurrentCount','labelForExisting','labelForEphemeral','get','postMessage','existsSync','publishSnapshot','clear','entries','.tmp','.tmp-','HNSW_BINDINGS_UNAVAILABLE','parse','setEf','ScalarKind','usearch\x20algorithm\x20requires\x20dims\x20>\x200','repeat','state.json','usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','toString','openSync','snapshotTo','\x20on\x20','now','1493604QKrAzl','mtimeMs','511930aljwWR','searchKnn','expansionAdd','MetricKind','Unknown\x20op:\x20\x22','unref','add','state','versions','trim','readCurrentId','387jTKayF','slice','getMaxElements','isInteger','count','readCurrentClock','markDelete','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','size','snapshot\x20incomplete:\x20','statSync','listSnapshotIds','_tmp-','stringify','platform','keyForLabel','2027202zLKOKm','clock','unlinkSync','snapshots','hnsw','message','snapshotEveryChanges','default','vector','filter','crypto','keyToLabel','published','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','tmpMaxAgeMs','cause','snapshot','log','maxElements','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','score'];_0x372b=function(){return _0x4344eb;};return _0x372b();}var require$$0$1=require('worker_threads'),require$$0=require('fs'),require$$1=require(_0x4ea323(0x135)),require$$2=require('os'),require$$3=require(_0x4ea323(0x1a4));function getDefaultExportFromCjs(_0x3da8d6){const _0x3efcd0=_0x4ea323;return _0x3da8d6&&_0x3da8d6['__esModule']&&Object['prototype']['hasOwnProperty'][_0x3efcd0(0x1c4)](_0x3da8d6,'default')?_0x3da8d6[_0x3efcd0(0x1a1)]:_0x3da8d6;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x538d47=_0x4ea323;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x3ee969=require$$0,_0x2130bc=require$$1,_0x41cf97=require$$2,_0x3272d8=require$$3;function _0x5de148(){const _0x44e2f0=_0x1eb2;return Date[_0x44e2f0(0x17c)]();}function _0x2b9f2f(_0x4951ae){const _0x4bc90a=_0x1eb2;try{return _0x3ee969[_0x4bc90a(0x16a)](_0x4951ae);}catch{return![];}}function _0x30f043(_0xf0a77b){const _0x43204=_0x1eb2;try{return _0x3ee969[_0x43204(0x1e5)](_0xf0a77b,_0x43204(0x1be));}catch{return null;}}function _0x2238c6(_0x1b927a,_0xc90e7a){const _0xd399ec=_0x1eb2,_0x35d0a2=_0x1b927a+'.tmp-'+_0x3272d8['randomBytes'](0x6)['toString'](_0xd399ec(0x1e9));_0x3ee969['writeFileSync'](_0x35d0a2,_0xc90e7a),_0x3ee969['renameSync'](_0x35d0a2,_0x1b927a);}function _0x3a164d(_0x5580fb,_0x25149f=0x10){const _0x53c907=_0x1eb2,_0xe0ab4b=String(Math[_0x53c907(0x136)](0x0,Math['trunc'](_0x5580fb||0x0)));return _0xe0ab4b[_0x53c907(0x149)]>=_0x25149f?_0xe0ab4b:'0'[_0x53c907(0x175)](_0x25149f-_0xe0ab4b[_0x53c907(0x149)])+_0xe0ab4b;}return snapshotStore=class _0x6cdb84{constructor({dir:_0x2a5e30,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x2f2421=_0x1eb2;if(!_0x2a5e30)throw new Error(_0x2f2421(0x13e));this[_0x2f2421(0x15d)]=_0x2a5e30,this[_0x2f2421(0x1e2)]=_0x2130bc[_0x2f2421(0x1f1)](_0x2a5e30,_0x2f2421(0x19d)),this[_0x2f2421(0x1da)]=_0x2130bc[_0x2f2421(0x1f1)](_0x2a5e30,_0x2f2421(0x1e1)),this[_0x2f2421(0x1d8)]=_0x2130bc['join'](_0x2a5e30,'SNAPSHOT.LOCK'),this['keepSnapshots']=keepSnapshots,this['log']=log,_0x3ee969[_0x2f2421(0x1b7)](this[_0x2f2421(0x15d)],{'recursive':!![]}),_0x3ee969[_0x2f2421(0x1b7)](this['snapshotsDir'],{'recursive':!![]});}[_0x538d47(0x1c6)](_0xbb1bcc){const _0x245590=_0x538d47;return _0x2130bc[_0x245590(0x1f1)](this['snapshotsDir'],_0xbb1bcc);}[_0x538d47(0x163)](_0x32a987){const _0xd2bbdc=_0x538d47,_0x3980d9=this[_0xd2bbdc(0x1c6)](_0x32a987);return{'dir':_0x3980d9,'index':_0x2130bc['join'](_0x3980d9,_0xd2bbdc(0x1de)),'labels':_0x2130bc[_0xd2bbdc(0x1f1)](_0x3980d9,_0xd2bbdc(0x1d1)),'state':_0x2130bc[_0xd2bbdc(0x1f1)](_0x3980d9,'state.json')};}[_0x538d47(0x189)](){const _0x4172a4=_0x538d47;if(!_0x2b9f2f(this[_0x4172a4(0x1da)]))return null;const _0x4b70f3=_0x30f043(this[_0x4172a4(0x1da)]);if(!_0x4b70f3)return null;const _0x438879=String(_0x4b70f3)[_0x4172a4(0x188)]();return _0x438879||null;}[_0x538d47(0x18f)](){const _0x476226=_0x538d47,_0x4d75cf=this[_0x476226(0x189)]();if(!_0x4d75cf)return 0x0;const _0x40598d=Number(_0x4d75cf);return Number['isFinite'](_0x40598d)?_0x40598d:0x0;}[_0x538d47(0x195)](){const _0x9a8300=_0x538d47;try{return _0x3ee969[_0x9a8300(0x144)](this[_0x9a8300(0x1e2)],{'withFileTypes':!![]})[_0x9a8300(0x1a3)](_0x22e8a0=>_0x22e8a0[_0x9a8300(0x1b1)]())[_0x9a8300(0x134)](_0x4059a7=>_0x4059a7[_0x9a8300(0x15e)])['filter'](_0x2a54bd=>!_0x2a54bd['startsWith'](_0x9a8300(0x16f)))[_0x9a8300(0x1a3)](_0x8cb1e5=>!_0x8cb1e5[_0x9a8300(0x1df)]('_tmp-'))[_0x9a8300(0x1cc)]();}catch{return[];}}[_0x538d47(0x1cb)](){const _0x5424f3=_0x538d47,_0x2fd4a9=this[_0x5424f3(0x189)]();if(_0x2fd4a9)return _0x2fd4a9;const _0x5ae22e=this[_0x5424f3(0x195)]();if(!_0x5ae22e['length'])return null;return _0x5ae22e[_0x5ae22e[_0x5424f3(0x149)]-0x1];}[_0x538d47(0x1bf)]({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x1249ff=_0x538d47;let _0xddb498;try{_0xddb498=_0x3ee969[_0x1249ff(0x144)](this[_0x1249ff(0x1e2)],{'withFileTypes':!![]});}catch{return;}const _0x81bdaf=_0x5de148()-maxAgeMs;for(const _0x41476c of _0xddb498){if(!_0x41476c['isDirectory']())continue;const _0x3b8cfb=_0x41476c[_0x1249ff(0x15e)];if(!_0x3b8cfb[_0x1249ff(0x1df)](_0x1249ff(0x16f))&&!_0x3b8cfb[_0x1249ff(0x1df)](_0x1249ff(0x196)))continue;const _0x106e45=_0x2130bc[_0x1249ff(0x1f1)](this[_0x1249ff(0x1e2)],_0x3b8cfb);try{const _0x35182c=_0x3ee969[_0x1249ff(0x194)](_0x106e45);if(_0x35182c[_0x1249ff(0x17e)]>_0x81bdaf)continue;}catch{}try{_0x3ee969[_0x1249ff(0x162)](_0x106e45,{'recursive':!![],'force':!![]});}catch{}}}['prune']({keep:keep=null}={}){const _0x1df731=_0x538d47,_0x2b54b4=Math[_0x1df731(0x136)](0x1,Math[_0x1df731(0x1c8)](keep??this[_0x1df731(0x1b5)]??0x3)),_0xb44e89=this[_0x1df731(0x195)]();if(_0xb44e89[_0x1df731(0x149)]<=_0x2b54b4)return;const _0x81e2e6=this[_0x1df731(0x189)](),_0x1f152d=_0xb44e89[_0x1df731(0x18b)](0x0,Math[_0x1df731(0x136)](0x0,_0xb44e89['length']-_0x2b54b4));for(const _0x17876d of _0x1f152d){if(_0x81e2e6&&_0x17876d===_0x81e2e6)continue;const _0x48b13e=this[_0x1df731(0x1c6)](_0x17876d);try{_0x3ee969[_0x1df731(0x162)](_0x48b13e,{'recursive':!![],'force':!![]});}catch{}}}async[_0x538d47(0x1c2)](_0x1824a4,_0x22e76d){const _0x2eaf81=_0x538d47;if(!_0x1824a4)throw new Error(_0x2eaf81(0x13f));const _0x394930=this[_0x2eaf81(0x163)](_0x1824a4);if(!_0x2b9f2f(_0x394930[_0x2eaf81(0x1b0)])||!_0x2b9f2f(_0x394930[_0x2eaf81(0x1d0)])||!_0x2b9f2f(_0x394930[_0x2eaf81(0x186)]))throw new Error(_0x2eaf81(0x193)+_0x1824a4);const _0x1dd040=await _0x22e76d(_0x394930);return _0x1dd040||{};}async['publishSnapshot'](_0x475622,_0x55f893,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x38e9a4=_0x538d47,_0x2ef018=Number(_0x475622);if(!Number[_0x38e9a4(0x1ec)](_0x2ef018)||_0x2ef018<0x0)throw new Error(_0x38e9a4(0x13d));const _0x497dbf=_0x3a164d(_0x2ef018),_0xcda8d6=this['_snapshotDir'](_0x497dbf),_0x172dca=_0x2130bc[_0x38e9a4(0x1f1)](this[_0x38e9a4(0x1e2)],_0x38e9a4(0x16f)+_0x497dbf+'-'+_0x3272d8[_0x38e9a4(0x1c7)](0x6)[_0x38e9a4(0x178)](_0x38e9a4(0x1e9)));_0x3ee969[_0x38e9a4(0x1b7)](_0x172dca,{'recursive':!![]});const _0x4a90db={'dir':_0x172dca,'index':_0x2130bc[_0x38e9a4(0x1f1)](_0x172dca,_0x38e9a4(0x1de)),'labels':_0x2130bc[_0x38e9a4(0x1f1)](_0x172dca,_0x38e9a4(0x1d1)),'state':_0x2130bc['join'](_0x172dca,_0x38e9a4(0x176))};await _0x55f893(_0x4a90db,{'id':_0x497dbf,'clock':_0x2ef018});const _0x837b74=JSON[_0x38e9a4(0x197)]({'pid':process[_0x38e9a4(0x161)],'host':_0x41cf97['hostname'](),'at':_0x5de148()}),_0x4af2fc=_0x5de148();let _0x2e5191=null;const _0x931019=()=>{const _0x4b4594=_0x38e9a4;try{const _0x2926db=JSON[_0x4b4594(0x171)](_0x3ee969['readFileSync'](this[_0x4b4594(0x1d8)],_0x4b4594(0x1be)));if(_0x2926db['at']&&_0x5de148()-_0x2926db['at']>staleLockMaxAgeMs){const _0x5f3b00=_0x5de148()-_0x2926db['at'],_0x42557b=_0x4b4594(0x1bc)+Math['round'](_0x5f3b00/0x3e8)+'s,\x20pid:\x20'+_0x2926db[_0x4b4594(0x161)]+_0x4b4594(0x1c0)+_0x2926db['host']+').\x20'+_0x4b4594(0x191);this[_0x4b4594(0x1ab)]?.[_0x4b4594(0x1f0)]?this[_0x4b4594(0x1ab)][_0x4b4594(0x1f0)](_0x42557b):console[_0x4b4594(0x1f0)]('[SnapshotStore]',_0x42557b);try{_0x3ee969['unlinkSync'](this['lockPath']);}catch{}return!![];}}catch{try{_0x3ee969['unlinkSync'](this[_0x4b4594(0x1d8)]);}catch{}}return![];},_0x5c6d3a=()=>{const _0x47c7bc=_0x38e9a4;try{return _0x2e5191=_0x3ee969['openSync'](this[_0x47c7bc(0x1d8)],'wx'),_0x3ee969[_0x47c7bc(0x1d6)](_0x2e5191,_0x837b74),!![];}catch(_0x3e19a4){if(_0x3e19a4&&_0x3e19a4[_0x47c7bc(0x15f)]==='EEXIST')return![];throw _0x3e19a4;}};if(!_0x5c6d3a()){_0x931019(),_0x5c6d3a();if(_0x2e5191==null&&lockTimeoutMs>0x0)while(_0x5de148()-_0x4af2fc<lockTimeoutMs){await new Promise(_0x1a9d8e=>setTimeout(_0x1a9d8e,0x19));if(_0x5c6d3a())break;_0x931019();}}if(_0x2e5191==null){try{_0x3ee969[_0x38e9a4(0x162)](_0x172dca,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x38e9a4(0x1b9)};}try{const _0x5d1017=this[_0x38e9a4(0x18f)]();if(_0x2ef018<=_0x5d1017){try{_0x3ee969[_0x38e9a4(0x162)](_0x172dca,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x38e9a4(0x153),'currentClock':_0x5d1017};}if(!_0x2b9f2f(_0xcda8d6))_0x3ee969['renameSync'](_0x172dca,_0xcda8d6);else try{_0x3ee969['rmSync'](_0x172dca,{'recursive':!![],'force':!![]});}catch{}return _0x2238c6(this['currentPath'],_0x497dbf+'\x0a'),this[_0x38e9a4(0x1dd)]({'keep':keep}),{'published':!![],'currentClock':_0x2ef018};}finally{try{_0x3ee969[_0x38e9a4(0x1dc)](_0x2e5191);}catch{}try{_0x3ee969[_0x38e9a4(0x19c)](this['lockPath']);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x12626a=_0x4ea323;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x490b9c=require$$0;class _0x25342a{constructor(){const _0x226539=_0x1eb2;this[_0x226539(0x1a5)]=new Map(),this[_0x226539(0x13c)]=new Map(),this[_0x226539(0x1e4)]=0x0,this[_0x226539(0x1bb)]=0x0;}async[_0x12626a(0x152)](){const _0x56fafe=_0x12626a;this['keyToLabel']=new Map(),this[_0x56fafe(0x13c)]=new Map(),this[_0x56fafe(0x1e4)]=0x0,this[_0x56fafe(0x1bb)]=0x0;}async['loadFrom'](_0x21fc47){const _0x43836b=_0x12626a;if(!_0x21fc47||!_0x490b9c[_0x43836b(0x16a)](_0x21fc47))return await this['reset'](),!![];let _0x4726da;try{_0x4726da=_0x490b9c['readFileSync'](_0x21fc47,_0x43836b(0x1be));}catch{return await this['reset'](),!![];}let _0x3bb6c7;try{_0x3bb6c7=JSON[_0x43836b(0x171)](_0x4726da);}catch{return await this[_0x43836b(0x152)](),!![];}const _0x84cd95=Array[_0x43836b(0x1eb)](_0x3bb6c7?.['entries'])?_0x3bb6c7[_0x43836b(0x16d)]:[],_0x2709c1=Number[_0x43836b(0x18d)](_0x3bb6c7?.[_0x43836b(0x1e4)])?_0x3bb6c7['nextLabel']:0x0,_0x1d85ba=new Map(),_0x31d5a1=new Map();let _0x46dac4=-0x1;for(const _0x2c51f3 of _0x84cd95){if(!Array[_0x43836b(0x1eb)](_0x2c51f3)||_0x2c51f3[_0x43836b(0x149)]!==0x2)continue;const _0x59898b=Number(_0x2c51f3[0x0]),_0x757519=String(_0x2c51f3[0x1]??'');if(!Number[_0x43836b(0x18d)](_0x59898b)||_0x59898b<0x0)continue;if(!_0x757519)continue;_0x1d85ba['set'](_0x757519,_0x59898b),_0x31d5a1[_0x43836b(0x1d3)](_0x59898b,_0x757519);if(_0x59898b>_0x46dac4)_0x46dac4=_0x59898b;}return this[_0x43836b(0x1a5)]=_0x1d85ba,this[_0x43836b(0x13c)]=_0x31d5a1,this[_0x43836b(0x1e4)]=Math['max'](_0x2709c1,_0x46dac4+0x1,0x0),this['_tombstoneCount']=0x0,!![];}[_0x12626a(0x166)](_0x228ba2){const _0x506a3f=_0x12626a;return this[_0x506a3f(0x1a5)][_0x506a3f(0x168)](_0x228ba2);}[_0x12626a(0x167)](_0x444c24){const _0x447f63=_0x12626a;let _0x17510e=this[_0x447f63(0x1a5)][_0x447f63(0x168)](_0x444c24);if(_0x17510e!==undefined)return _0x17510e;return _0x17510e=this[_0x447f63(0x1e4)]++,this['keyToLabel']['set'](_0x444c24,_0x17510e),this[_0x447f63(0x13c)][_0x447f63(0x1d3)](_0x17510e,_0x444c24),_0x17510e;}[_0x12626a(0x1ca)](_0x21fa5f){const _0x134314=_0x12626a,_0x45bb07=this[_0x134314(0x1a5)][_0x134314(0x168)](_0x21fa5f);if(_0x45bb07===undefined)return;this[_0x134314(0x1a5)][_0x134314(0x138)](_0x21fa5f),this['labelToKey']['delete'](_0x45bb07),this[_0x134314(0x1bb)]++;}[_0x12626a(0x199)](_0x5f0544){const _0x422631=_0x12626a;return this[_0x422631(0x13c)]['get'](_0x5f0544)??null;}[_0x12626a(0x192)](){const _0x4ba32d=_0x12626a;return this[_0x4ba32d(0x1a5)][_0x4ba32d(0x192)];}[_0x12626a(0x14d)](){return this['_tombstoneCount'];}async[_0x12626a(0x17a)](_0x1ff704){const _0x54dc9a=_0x12626a,_0x13fbe1=_0x1ff704+_0x54dc9a(0x16e),_0x49c69e=[];for(const [_0xb6a581,_0x433436]of this[_0x54dc9a(0x13c)][_0x54dc9a(0x16d)]()){_0x49c69e[_0x54dc9a(0x150)]([_0xb6a581,_0x433436]);}_0x49c69e[_0x54dc9a(0x1cc)]((_0x106296,_0x24befd)=>_0x106296[0x0]-_0x24befd[0x0]);const _0x3ef6c9={'version':0x1,'nextLabel':this['nextLabel'],'entries':_0x49c69e};_0x490b9c[_0x54dc9a(0x1d6)](_0x13fbe1,JSON[_0x54dc9a(0x197)](_0x3ef6c9)),_0x490b9c['renameSync'](_0x13fbe1,_0x1ff704);}}return labelMap=_0x25342a,labelMap;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x25af06=requireSnapshotStore(),_0x2d933e=requireLabelMap(),_0x5a3e30=0x1;let _0x3a6af7=null;function _0x2dd5c8(){const _0xd3a3ac=_0x1eb2;if(_0x3a6af7)return _0x3a6af7;try{return _0x3a6af7=require(_0xd3a3ac(0x1ee)),_0x3a6af7;}catch(_0x57a455){const _0x373fdf=new Error(_0xd3a3ac(0x1c5)+(_0xd3a3ac(0x1e0)+process[_0xd3a3ac(0x187)][_0xd3a3ac(0x1d4)]+_0xd3a3ac(0x17b)+process[_0xd3a3ac(0x198)]+'/'+process['arch']+'.\x20')+_0xd3a3ac(0x1e8)+('Original\x20error:\x20'+(_0x57a455?.['message']||String(_0x57a455))));_0x373fdf['code']=_0xd3a3ac(0x170),_0x373fdf[_0xd3a3ac(0x1a9)]=_0x57a455;throw _0x373fdf;}}return hnsw=function _0x26ba16(_0x4bf6e4={},{dims:_0x287c47,dir:_0x300dd3}){const _0x5cfeec=_0x1eb2,_0x3cd347=_0x2dd5c8();if(!_0x287c47||_0x287c47<=0x0)throw new Error(_0x5cfeec(0x1ed));if(!_0x300dd3)throw new Error(_0x5cfeec(0x1ad));const _0x10266f={'metric':_0x4bf6e4[_0x5cfeec(0x14e)]??_0x5cfeec(0x13b),'M':_0x4bf6e4['M']??0x10,'efConstruction':_0x4bf6e4[_0x5cfeec(0x1d2)]??0xc8,'efSearch':_0x4bf6e4['efSearch']??0x40,'maxElements':_0x4bf6e4[_0x5cfeec(0x1ac)]??0x400,'growFactor':_0x4bf6e4[_0x5cfeec(0x141)]??0x2,'snapshotEveryChanges':_0x4bf6e4[_0x5cfeec(0x1a0)]??0xc350,'keepSnapshots':_0x4bf6e4['keepSnapshots']??0x2,'tmpMaxAgeMs':_0x4bf6e4[_0x5cfeec(0x1a8)]??0x6*0x36ee80},_0x1fb9e0=new _0x25af06({'dir':_0x300dd3,'keepSnapshots':_0x10266f[_0x5cfeec(0x1b5)]}),_0x4185a9=new _0x2d933e();let _0x25dad9=null,_0x2e4f0c=0x0,_0xbb1945=null,_0x31bab1=Promise[_0x5cfeec(0x14b)]();const _0x459065=_0xaa9a37=>{const _0x2709ea=_0x5cfeec;return _0x31bab1=_0x31bab1[_0x2709ea(0x151)](_0xaa9a37),_0x31bab1;};async function _0x58a19d(_0x4db443){const _0x3d0a3d=_0x5cfeec;await _0x4185a9['reset']();const _0x4af788=_0x4db443?await _0x4db443():[],_0x2ed9a3=Math[_0x3d0a3d(0x136)](_0x10266f[_0x3d0a3d(0x1ac)],Math['ceil'](_0x4af788['length']*(_0x10266f[_0x3d0a3d(0x141)]||1.2)),0x1);_0x25dad9=new _0x3cd347[(_0x3d0a3d(0x147))](_0x10266f['metric'],_0x287c47),_0x25dad9[_0x3d0a3d(0x1bd)]({'maxElements':_0x2ed9a3,'efConstruction':_0x10266f['efConstruction'],'M':_0x10266f['M']});for(const {key:_0x33f418,vector:_0x57abdb}of _0x4af788){if(!(_0x57abdb instanceof Float32Array)||_0x57abdb[_0x3d0a3d(0x149)]!==_0x287c47)continue;const _0xc93291=_0x4185a9[_0x3d0a3d(0x167)](_0x33f418);_0x25dad9['addPoint'](Array[_0x3d0a3d(0x1d7)](_0x57abdb),_0xc93291);}_0x25dad9[_0x3d0a3d(0x172)](_0x10266f[_0x3d0a3d(0x1e6)]),_0x2e4f0c=0x0;}async function _0x259199(_0x44349c){const _0x374416=_0x5cfeec;if(!_0x25dad9||!_0x44349c)return![];const _0x20a981=await _0x1fb9e0[_0x374416(0x16b)](_0x44349c,async _0x4dbce5=>{const _0x47508d=_0x374416;_0x25dad9['writeIndexSync'](_0x4dbce5[_0x47508d(0x1b0)]),await _0x4185a9[_0x47508d(0x17a)](_0x4dbce5['labels']);const _0x245a13=require$$0;_0x245a13[_0x47508d(0x1d6)](_0x4dbce5['state'],JSON[_0x47508d(0x197)]({'manifestVersion':_0x5a3e30,'dims':_0x287c47,'metric':_0x10266f[_0x47508d(0x14e)],'clock':_0x44349c,'snapshotAt':Date['now']()},null,0x2));},{'keep':_0x10266f[_0x374416(0x1b5)]});if(_0x20a981?.['published'])_0x2e4f0c=0x0;return _0x20a981?.[_0x374416(0x1a6)]??![];}async function _0x2dd110(){const _0x16f0eb=_0x5cfeec,_0x4e8f39=_0x1fb9e0['readCurrentId']()||_0x1fb9e0[_0x16f0eb(0x1cb)]();if(!_0x4e8f39)return null;let _0x17da4a,_0x3a459c=![];return await _0x1fb9e0[_0x16f0eb(0x1c2)](_0x4e8f39,async _0x2878d6=>{const _0x5b90be=_0x16f0eb,_0x1103d1=require$$0;_0x17da4a=JSON['parse'](_0x1103d1[_0x5b90be(0x1e5)](_0x2878d6[_0x5b90be(0x186)],'utf8'));if(_0x17da4a['manifestVersion']!==_0x5a3e30||_0x17da4a[_0x5b90be(0x160)]!==_0x287c47||_0x17da4a[_0x5b90be(0x14e)]!==_0x10266f[_0x5b90be(0x14e)]){_0x17da4a=null;return;}await _0x4185a9['loadFrom'](_0x2878d6[_0x5b90be(0x1d0)]),_0x25dad9=new _0x3cd347[(_0x5b90be(0x147))](_0x10266f[_0x5b90be(0x14e)],_0x287c47),_0x25dad9['readIndexSync'](_0x2878d6[_0x5b90be(0x1b0)]),_0x25dad9[_0x5b90be(0x172)](_0x10266f[_0x5b90be(0x1e6)]),_0x3a459c=!![];}),_0x3a459c?_0x17da4a?.[_0x16f0eb(0x19b)]??0x0:null;}return{async 'load'(_0x349aeb){return _0x459065(async()=>{const _0x56c441=_0x1eb2;_0x1fb9e0[_0x56c441(0x1bf)]({'maxAgeMs':_0x10266f[_0x56c441(0x1a8)]}),_0xbb1945=_0x349aeb??null;const _0x52adb8=await _0x2dd110();if(_0x52adb8!=null)return _0x52adb8;return await _0x58a19d(_0x349aeb),null;});},async 'add'(_0x198f63,_0xdf241d,_0x23db45){return _0x459065(async()=>{const _0x3f7fee=_0x1eb2;if(!_0x25dad9)return;const _0x204b0a=_0x4185a9[_0x3f7fee(0x167)](_0x198f63);try{_0x25dad9[_0x3f7fee(0x190)](_0x204b0a);}catch{}_0x25dad9['getCurrentCount']()>=_0x25dad9['getMaxElements']()&&(_0x10266f['maxElements']=Math[_0x3f7fee(0x148)](_0x25dad9[_0x3f7fee(0x18c)]()*(_0x10266f[_0x3f7fee(0x141)]||0x2)),await _0x58a19d(_0xbb1945)),_0x25dad9['addPoint'](Array['from'](_0xdf241d),_0x204b0a),_0x2e4f0c++,_0x2e4f0c>=_0x10266f[_0x3f7fee(0x1a0)]&&await _0x259199(_0x23db45??Date[_0x3f7fee(0x17c)]());});},async 'remove'(_0x1859a7){return _0x459065(async()=>{const _0x40f199=_0x1eb2;if(!_0x25dad9)return;const _0x335acd=_0x4185a9[_0x40f199(0x166)](_0x1859a7);if(_0x335acd===undefined)return;try{_0x25dad9[_0x40f199(0x190)](_0x335acd);}catch{}_0x4185a9[_0x40f199(0x1ca)](_0x1859a7),_0x2e4f0c++;});},'search'(_0x40eb60,{limit:limit=0xa,efSearch:_0x12b6b6}={}){const _0x3653f9=_0x5cfeec;if(!_0x25dad9)return[];if(Number[_0x3653f9(0x18d)](_0x12b6b6))_0x25dad9[_0x3653f9(0x172)](_0x12b6b6);const _0x269e36=Math[_0x3653f9(0x1af)](limit,_0x25dad9[_0x3653f9(0x165)]()||0x1),{neighbors:_0x1735b5,distances:_0x33ef1a}=_0x25dad9[_0x3653f9(0x180)](Array['from'](_0x40eb60),_0x269e36),_0x9d88b9=[];for(let _0x4ef37f=0x0;_0x4ef37f<_0x1735b5[_0x3653f9(0x149)];_0x4ef37f++){const _0x5f0d45=_0x4185a9[_0x3653f9(0x199)](_0x1735b5[_0x4ef37f]);if(!_0x5f0d45)continue;const _0x217fe5=_0x10266f[_0x3653f9(0x14e)]==='cosine'?Math[_0x3653f9(0x136)](0x0,0x1-_0x33ef1a[_0x4ef37f]):0x1/(0x1+_0x33ef1a[_0x4ef37f]);_0x9d88b9[_0x3653f9(0x150)]({'key':_0x5f0d45,'score':_0x217fe5});}return _0x9d88b9;},async 'snapshot'(_0x2a29bd=Date[_0x5cfeec(0x17c)]()){return _0x459065(()=>_0x259199(_0x2a29bd));},async 'rebuild'(_0x3bd0f4){return _0x459065(()=>{if(_0x3bd0f4!=null)_0xbb1945=_0x3bd0f4;return _0x58a19d(_0x3bd0f4??_0xbb1945);});},async 'stop'(){const _0x51737e=_0x5cfeec;return _0x459065(()=>_0x259199(Date[_0x51737e(0x17c)]()));},'count'(){const _0x423eb2=_0x5cfeec;return _0x4185a9[_0x423eb2(0x192)]();},'info'(){const _0x326c97=_0x5cfeec;return{'algorithm':_0x326c97(0x19e),'metric':_0x10266f[_0x326c97(0x14e)],'M':_0x10266f['M'],'efConstruction':_0x10266f[_0x326c97(0x1d2)],'efSearch':_0x10266f[_0x326c97(0x1e6)],'maxElements':_0x25dad9?.['getMaxElements']()??_0x10266f[_0x326c97(0x1ac)],'count':_0x4185a9[_0x326c97(0x192)](),'changesSince':_0x2e4f0c,'snapshotDir':_0x300dd3,'latestSnapshot':_0x1fb9e0[_0x326c97(0x189)]()??null};}};},hnsw;}function _0x1eb2(_0x3727a6,_0x27f81d){_0x3727a6=_0x3727a6-0x134;const _0x372b61=_0x372b();let _0x1eb2c7=_0x372b61[_0x3727a6];return _0x1eb2c7;}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x2c7fe5(_0x121e57={}){const _0x929b39=new Map();return{async 'load'(_0xe7864b){const _0x934888=_0x1eb2;_0x929b39[_0x934888(0x16c)]();if(_0xe7864b)for(const {key:_0x1fa720,vector:_0x540f89}of await _0xe7864b()){_0x929b39[_0x934888(0x1d3)](_0x1fa720,_0x540f89);}},async 'add'(_0x57cc58,_0x1d1011,_0x5a6407){const _0x341b45=_0x1eb2;_0x929b39[_0x341b45(0x1d3)](_0x57cc58,_0x1d1011);},async 'remove'(_0x18c893){const _0x597c59=_0x1eb2;_0x929b39[_0x597c59(0x138)](_0x18c893);},'search'(_0x4efed1,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x19ec01=_0x1eb2,_0xedfbd1=[];for(const [_0x31b033,_0x3bf2e]of _0x929b39){const _0x43002f=_0x25710d(_0x4efed1,_0x3bf2e);if(_0x43002f>=threshold)_0xedfbd1[_0x19ec01(0x150)]({'key':_0x31b033,'score':_0x43002f});}return _0xedfbd1['sort']((_0x5a0014,_0x43e846)=>_0x43e846[_0x19ec01(0x1ae)]-_0x5a0014[_0x19ec01(0x1ae)]),_0xedfbd1[_0x19ec01(0x18b)](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x105f0e){await this['load'](_0x105f0e);},async 'stop'(){},'count'(){const _0x2dad9b=_0x1eb2;return _0x929b39[_0x2dad9b(0x192)];},'info'(){const _0x48c867=_0x1eb2;return{'algorithm':_0x48c867(0x1cd),'count':_0x929b39[_0x48c867(0x192)]};}};};function _0x25710d(_0x3159f5,_0x5589af){const _0x2b9d5e=_0x1eb2;let _0x35a137=0x0,_0x4c911f=0x0,_0x16546f=0x0;for(let _0x4f3936=0x0;_0x4f3936<_0x3159f5[_0x2b9d5e(0x149)];_0x4f3936++){_0x35a137+=_0x3159f5[_0x4f3936]*_0x5589af[_0x4f3936],_0x4c911f+=_0x3159f5[_0x4f3936]*_0x3159f5[_0x4f3936],_0x16546f+=_0x5589af[_0x4f3936]*_0x5589af[_0x4f3936];}const _0x57b7ab=Math[_0x2b9d5e(0x1cf)](_0x4c911f)*Math['sqrt'](_0x16546f);return _0x57b7ab===0x0?0x0:_0x35a137/_0x57b7ab;}return flat;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x25345d=require$$0,_0x3f4e78=require$$1,_0x3d4d6f=requireSnapshotStore(),_0x519845=requireLabelMap(),_0x2ed3c7=0x1;let _0x460068=null;function _0x35d644(){const _0x2b879c=_0x1eb2;if(_0x460068)return _0x460068;try{return _0x460068=require(_0x2b879c(0x1ba)),_0x460068;}catch(_0x1c11cc){const _0x385249=new Error(_0x2b879c(0x1a7)+('for\x20Node\x20'+process['versions'][_0x2b879c(0x1d4)]+_0x2b879c(0x17b)+process[_0x2b879c(0x198)]+'/'+process[_0x2b879c(0x140)]+'.\x20')+'Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20'+(_0x2b879c(0x14a)+(_0x1c11cc?.['message']||String(_0x1c11cc))));_0x385249[_0x2b879c(0x15f)]=_0x2b879c(0x13a),_0x385249['cause']=_0x1c11cc;throw _0x385249;}}function _0xc1fbaa(_0x2f339a,_0x59c97e){const _0x5008f9=_0x1eb2;switch(_0x2f339a){case _0x5008f9(0x13b):return _0x59c97e[_0x5008f9(0x182)][_0x5008f9(0x1f2)];case'l2':return _0x59c97e[_0x5008f9(0x182)]['L2sq'];case'ip':return _0x59c97e[_0x5008f9(0x182)]['IP'];default:return _0x59c97e['MetricKind'][_0x5008f9(0x1f2)];}}return usearch=function _0x5da9e5(_0x53c512={},{dims:_0x41be7d,dir:_0x43b6a5}){const _0x5e39ab=_0x1eb2,_0x2eb8cf=_0x35d644();if(!_0x41be7d||_0x41be7d<=0x0)throw new Error(_0x5e39ab(0x174));if(!_0x43b6a5)throw new Error(_0x5e39ab(0x177));const _0x535bc6={'metric':_0x53c512[_0x5e39ab(0x14e)]??'cosine','connectivity':_0x53c512['connectivity']??0x10,'expansionAdd':_0x53c512[_0x5e39ab(0x181)]??0x80,'expansionSearch':_0x53c512[_0x5e39ab(0x1e7)]??0x40,'snapshotEveryChanges':_0x53c512[_0x5e39ab(0x1a0)]??0xc350,'keepSnapshots':_0x53c512[_0x5e39ab(0x1b5)]??0x2,'tmpMaxAgeMs':_0x53c512[_0x5e39ab(0x1a8)]??0x6*0x36ee80,'heartbeatIntervalMs':_0x53c512[_0x5e39ab(0x155)]??0x1388,'writerLockMaxAgeMs':_0x53c512[_0x5e39ab(0x1b8)]??0x3a98,'viewRefreshMs':_0x53c512[_0x5e39ab(0x1b6)]??0x3e8},_0x4dea6e=new _0x3d4d6f({'dir':_0x43b6a5,'keepSnapshots':_0x535bc6[_0x5e39ab(0x1b5)]}),_0x1a30bc=_0x3f4e78[_0x5e39ab(0x1f1)](_0x43b6a5,_0x5e39ab(0x1c9));let _0x17c596=new _0x519845(),_0x2b914f=null,_0x500d9a=0x0,_0x107086=null,_0x367a06=![],_0xd113a5=null,_0x27c135=null,_0x2aff3d=0x0,_0x4d2c1e=![],_0x3e90ab=Promise[_0x5e39ab(0x14b)]();const _0x1401be=_0x578963=>{const _0x41840b=_0x5e39ab;return _0x3e90ab=_0x3e90ab[_0x41840b(0x151)](_0x578963),_0x3e90ab;};function _0x53473f(){const _0x4fadb2=_0x5e39ab;return new _0x2eb8cf[(_0x4fadb2(0x143))]({'dimensions':_0x41be7d,'metric':_0xc1fbaa(_0x535bc6[_0x4fadb2(0x14e)],_0x2eb8cf),'quantization':_0x2eb8cf[_0x4fadb2(0x173)][_0x4fadb2(0x1c3)],'connectivity':_0x535bc6[_0x4fadb2(0x146)],'expansion_add':_0x535bc6['expansionAdd'],'expansion_search':_0x535bc6[_0x4fadb2(0x1e7)],'multi':![]});}function _0x2dc5fe(_0x34f141){return _0x34f141 instanceof Float32Array?_0x34f141:new Float32Array(_0x34f141);}function _0x5ec6b7(){const _0x1a4b4b=_0x5e39ab,_0x2bebd5=JSON['stringify']({'pid':process[_0x1a4b4b(0x161)],'at':Date[_0x1a4b4b(0x17c)]()}),_0x590ffb=()=>{const _0x57446b=_0x1a4b4b;try{const _0x4803c2=_0x25345d[_0x57446b(0x179)](_0x1a30bc,'wx');return _0x25345d['writeFileSync'](_0x4803c2,_0x2bebd5),_0x25345d['closeSync'](_0x4803c2),!![];}catch(_0x148568){if(_0x148568?.[_0x57446b(0x15f)]==='EEXIST')return![];throw _0x148568;}};if(_0x590ffb())return!![];try{const _0x185fb9=JSON[_0x1a4b4b(0x171)](_0x25345d[_0x1a4b4b(0x1e5)](_0x1a30bc,_0x1a4b4b(0x1be))),_0x121b8e=Date['now']()-(_0x185fb9['at']??0x0);if(_0x121b8e<_0x535bc6[_0x1a4b4b(0x1b8)])return![];}catch{}try{_0x25345d[_0x1a4b4b(0x19c)](_0x1a30bc);}catch{}return _0x590ffb();}function _0x31db7a(){const _0x86f41a=_0x5e39ab;if(_0xd113a5)clearInterval(_0xd113a5);_0xd113a5=setInterval(()=>{const _0x362dd5=_0x1eb2;try{_0x25345d[_0x362dd5(0x1d6)](_0x1a30bc,JSON['stringify']({'pid':process[_0x362dd5(0x161)],'at':Date['now']()}));}catch{}},_0x535bc6['heartbeatIntervalMs']),_0xd113a5[_0x86f41a(0x184)]();}function _0x583338(){const _0x3380fd=_0x5e39ab;_0xd113a5&&(clearInterval(_0xd113a5),_0xd113a5=null);try{const _0x1f7fe7=JSON[_0x3380fd(0x171)](_0x25345d[_0x3380fd(0x1e5)](_0x1a30bc,_0x3380fd(0x1be)));if(_0x1f7fe7['pid']===process['pid'])_0x25345d['unlinkSync'](_0x1a30bc);}catch{}}async function _0x13b4b5(_0x41fac5){const _0x598a70=_0x5e39ab;_0x17c596=new _0x519845(),await _0x17c596[_0x598a70(0x152)](),_0x2b914f=_0x53473f();const _0xef83a7=_0x41fac5?await _0x41fac5():[];for(const {key:_0x51875d,vector:_0x598ab8}of _0xef83a7){if(!(_0x598ab8 instanceof Float32Array)||_0x598ab8[_0x598a70(0x149)]!==_0x41be7d)continue;const _0x4eddbc=_0x17c596[_0x598a70(0x167)](_0x51875d);_0x2b914f['add'](BigInt(_0x4eddbc),_0x598ab8);}_0x500d9a=0x0;}async function _0x7802c0(_0x2d3ebc){const _0x40e944=_0x5e39ab;if(!_0x2b914f||!_0x2d3ebc)return![];const _0x2b3365=await _0x4dea6e[_0x40e944(0x16b)](_0x2d3ebc,async _0x122453=>{const _0xb3b98e=_0x40e944;_0x2b914f['save'](_0x122453[_0xb3b98e(0x1b0)]),await _0x17c596[_0xb3b98e(0x17a)](_0x122453['labels']),_0x25345d[_0xb3b98e(0x1d6)](_0x122453[_0xb3b98e(0x186)],JSON['stringify']({'manifestVersion':_0x2ed3c7,'algorithm':'usearch','dims':_0x41be7d,'metric':_0x535bc6['metric'],'clock':_0x2d3ebc,'snapshotAt':Date[_0xb3b98e(0x17c)]()},null,0x2));},{'keep':_0x535bc6['keepSnapshots']});if(_0x2b3365?.[_0x40e944(0x1a6)])_0x500d9a=0x0;return _0x2b3365?.[_0x40e944(0x1a6)]??![];}async function _0x4cceb2(){const _0x48c6f6=_0x5e39ab,_0x6103eb=_0x4dea6e['readCurrentId']()||_0x4dea6e[_0x48c6f6(0x1cb)]();if(!_0x6103eb)return null;let _0x3b875c,_0x5fd6a0=![];return await _0x4dea6e['loadSnapshot'](_0x6103eb,async _0x26ce10=>{const _0x152da2=_0x48c6f6;_0x3b875c=JSON['parse'](_0x25345d[_0x152da2(0x1e5)](_0x26ce10[_0x152da2(0x186)],_0x152da2(0x1be)));if(_0x3b875c['manifestVersion']!==_0x2ed3c7||_0x3b875c[_0x152da2(0x14c)]!==_0x152da2(0x1ba)||_0x3b875c[_0x152da2(0x160)]!==_0x41be7d||_0x3b875c[_0x152da2(0x14e)]!==_0x535bc6[_0x152da2(0x14e)]){_0x3b875c=null;return;}_0x17c596=new _0x519845(),await _0x17c596[_0x152da2(0x1d9)](_0x26ce10[_0x152da2(0x1d0)]),_0x2b914f=_0x53473f(),_0x2b914f[_0x152da2(0x158)](_0x26ce10[_0x152da2(0x1b0)]),_0x5fd6a0=!![];}),_0x5fd6a0?_0x3b875c?.[_0x48c6f6(0x19b)]??0x0:null;}async function _0x16fb90(_0x32f430){const _0x5386a8=_0x5e39ab;if(!_0x32f430)return![];let _0x184308=![];try{await _0x4dea6e[_0x5386a8(0x1c2)](_0x32f430,async _0x59697a=>{const _0x37a9f8=_0x5386a8,_0xc5db1c=JSON[_0x37a9f8(0x171)](_0x25345d['readFileSync'](_0x59697a[_0x37a9f8(0x186)],'utf8'));if(_0xc5db1c['manifestVersion']!==_0x2ed3c7||_0xc5db1c['algorithm']!==_0x37a9f8(0x1ba)||_0xc5db1c[_0x37a9f8(0x160)]!==_0x41be7d||_0xc5db1c['metric']!==_0x535bc6[_0x37a9f8(0x14e)])return;const _0x286954=new _0x519845();await _0x286954[_0x37a9f8(0x1d9)](_0x59697a[_0x37a9f8(0x1d0)]);const _0x3a97a6=_0x53473f();_0x3a97a6[_0x37a9f8(0x15a)](_0x59697a[_0x37a9f8(0x1b0)]),_0x2b914f=_0x3a97a6,_0x17c596=_0x286954,_0x27c135=_0x32f430,_0x184308=!![];});}catch{}return _0x184308;}async function _0x1cc2dd(_0x40c7b3){try{await _0x16fb90(_0x40c7b3);}finally{_0x4d2c1e=![];}}function _0x497e81(){const _0xe620e=_0x5e39ab,_0x1e703d=Date[_0xe620e(0x17c)]();if(_0x1e703d-_0x2aff3d<_0x535bc6[_0xe620e(0x1b6)])return;_0x2aff3d=_0x1e703d;if(_0x4d2c1e)return;const _0xc86013=_0x4dea6e['readCurrentId']()||_0x4dea6e[_0xe620e(0x1cb)]();if(!_0xc86013||_0xc86013===_0x27c135)return;_0x4d2c1e=!![],_0x1cc2dd(_0xc86013);}async function _0x4f7e1a(){const _0x56a2e9=_0x5e39ab;_0x367a06=!![],_0x31db7a();if(_0x27c135)try{const _0x331234=new _0x519845();let _0xbf608=![];await _0x4dea6e[_0x56a2e9(0x1c2)](_0x27c135,async _0x19363b=>{const _0xd48002=_0x56a2e9;await _0x331234[_0xd48002(0x1d9)](_0x19363b[_0xd48002(0x1d0)]);const _0x37dca6=_0x53473f();_0x37dca6[_0xd48002(0x158)](_0x19363b[_0xd48002(0x1b0)]),_0x2b914f=_0x37dca6,_0x17c596=_0x331234,_0xbf608=!![];});if(_0xbf608)return;}catch{}await _0x13b4b5(_0x107086);}return{async 'load'(_0xf2a397){return _0x1401be(async()=>{const _0x357583=_0x1eb2;_0x4dea6e[_0x357583(0x1bf)]({'maxAgeMs':_0x535bc6[_0x357583(0x1a8)]}),_0x107086=_0xf2a397??null,_0x367a06=_0x5ec6b7();if(_0x367a06){_0x31db7a();const _0x47b930=await _0x4cceb2();if(_0x47b930!=null)return _0x47b930;return await _0x13b4b5(_0xf2a397),null;}const _0x58f407=_0x4dea6e[_0x357583(0x189)]()||_0x4dea6e[_0x357583(0x1cb)]();return await _0x16fb90(_0x58f407),null;});},async 'add'(_0x2411ae,_0x461f0,_0x517e99){return _0x1401be(async()=>{const _0xf9efcb=_0x1eb2;if(!_0x367a06){if(!_0x5ec6b7())return;await _0x4f7e1a();}if(!_0x2b914f)return;const _0xd0538b=_0x17c596[_0xf9efcb(0x166)](_0x2411ae);if(_0xd0538b!==undefined)try{_0x2b914f[_0xf9efcb(0x1c1)](BigInt(_0xd0538b));}catch{}const _0x572ca4=_0x17c596[_0xf9efcb(0x167)](_0x2411ae);_0x2b914f[_0xf9efcb(0x185)](BigInt(_0x572ca4),_0x2dc5fe(_0x461f0)),_0x500d9a++,_0x500d9a>=_0x535bc6[_0xf9efcb(0x1a0)]&&await _0x7802c0(_0x517e99??Date[_0xf9efcb(0x17c)]());});},async 'remove'(_0x14fd96){return _0x1401be(async()=>{const _0xcec98a=_0x1eb2;if(!_0x367a06){if(!_0x5ec6b7())return;await _0x4f7e1a();}if(!_0x2b914f)return;const _0x763dcb=_0x17c596[_0xcec98a(0x166)](_0x14fd96);if(_0x763dcb===undefined)return;try{_0x2b914f['remove'](BigInt(_0x763dcb));}catch{}_0x17c596[_0xcec98a(0x1ca)](_0x14fd96),_0x500d9a++;});},'search'(_0x5f1d7a,{limit:limit=0xa}={}){const _0x496a06=_0x5e39ab;if(!_0x367a06)_0x497e81();if(!_0x2b914f)return[];const _0x4c19b1=_0x2b914f['size']();if(_0x4c19b1===0x0)return[];const _0x718828=Math['min'](limit,_0x4c19b1),_0x3589c4=_0x2b914f[_0x496a06(0x1ef)](_0x2dc5fe(_0x5f1d7a),_0x718828,0x0),_0x9b0f26=[],_0x1eb6da=_0x3589c4[_0x496a06(0x1db)],_0x49eae3=_0x3589c4[_0x496a06(0x15c)];for(let _0x2e560c=0x0;_0x2e560c<_0x1eb6da['length'];_0x2e560c++){const _0x29474a=_0x1eb6da[_0x2e560c];if(_0x29474a===0xffffffffffffffffn)continue;const _0x312c5e=Number(_0x29474a),_0x43e15d=_0x17c596[_0x496a06(0x199)](_0x312c5e);if(!_0x43e15d)continue;const _0x547a42=_0x49eae3[_0x2e560c];let _0x3da592;if(_0x535bc6['metric']===_0x496a06(0x13b))_0x3da592=Math['max'](0x0,0x1-_0x547a42);else{if(_0x535bc6[_0x496a06(0x14e)]==='ip')_0x3da592=-_0x547a42;else _0x3da592=0x1/(0x1+_0x547a42);}_0x9b0f26['push']({'key':_0x43e15d,'score':_0x3da592});}return _0x9b0f26;},async 'snapshot'(_0x410890=Date['now']()){if(!_0x367a06)return![];return _0x1401be(()=>_0x7802c0(_0x410890));},async 'rebuild'(_0x80f957){if(!_0x367a06)return;return _0x1401be(()=>{if(_0x80f957!=null)_0x107086=_0x80f957;return _0x13b4b5(_0x80f957??_0x107086);});},async 'stop'(){return _0x1401be(async()=>{const _0x484b80=_0x1eb2;_0x367a06&&(await _0x7802c0(Date[_0x484b80(0x17c)]()),_0x583338());});},'count'(){return _0x17c596['size']();},'info'(){const _0x250f6c=_0x5e39ab;return{'algorithm':'usearch','role':_0x367a06?_0x250f6c(0x156):'reader','metric':_0x535bc6[_0x250f6c(0x14e)],'connectivity':_0x535bc6['connectivity'],'expansionAdd':_0x535bc6['expansionAdd'],'expansionSearch':_0x535bc6[_0x250f6c(0x1e7)],'count':_0x17c596['size'](),'size':_0x2b914f?.[_0x250f6c(0x192)]?.()??0x0,'capacity':_0x2b914f?.[_0x250f6c(0x1e3)]?.()??0x0,'changesSince':_0x367a06?_0x500d9a:null,'viewedSnapshot':_0x27c135??null,'snapshotDir':_0x43b6a5,'latestSnapshot':_0x4dea6e['readCurrentId']()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0x12cded=_0x4ea323;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x51119e,workerData:_0x11124b}=require$$0$1,{algorithmName:_0x27c341,algorithmConfig:_0x2c13c2,dims:_0x22cabf,dir:_0x4b6ecb}=_0x11124b;let _0x4d1228;if(_0x27c341===_0x12cded(0x19e))_0x4d1228=requireHnsw()(_0x2c13c2,{'dims':_0x22cabf,'dir':_0x4b6ecb});else{if(_0x27c341===_0x12cded(0x1cd))_0x4d1228=requireFlat()(_0x2c13c2,{'dims':_0x22cabf,'dir':_0x4b6ecb});else{if(_0x27c341===_0x12cded(0x1ba))_0x4d1228=requireUsearch()(_0x2c13c2,{'dims':_0x22cabf,'dir':_0x4b6ecb});else throw new Error(_0x12cded(0x142)+_0x27c341+'\x22');}}function _0x2a659c(){const _0x400286=_0x12cded;try{_0x51119e['postMessage']({'op':_0x400286(0x1d5),'count':_0x4d1228[_0x400286(0x18e)](),'info':_0x4d1228['info'](),'memory':process[_0x400286(0x1b3)]()});}catch{}}return _0x51119e['on'](_0x12cded(0x19f),async _0x10aac7=>{const _0x30f58f=_0x12cded,{id:_0x2ca237,op:_0x5c9e5f,args:_0x531655}=_0x10aac7;try{let _0xb0759f;switch(_0x5c9e5f){case _0x30f58f(0x158):{const _0x310604=(_0x531655[_0x30f58f(0x139)]||[])['map'](_0x4fae10=>({'key':_0x4fae10[_0x30f58f(0x164)],'vector':_0x4fae10['vector']instanceof Float32Array?_0x4fae10[_0x30f58f(0x1a2)]:new Float32Array(_0x4fae10[_0x30f58f(0x1a2)])}));_0xb0759f=await _0x4d1228[_0x30f58f(0x158)](async()=>_0x310604),_0x2a659c();break;}case _0x30f58f(0x185):{const _0x3f63b7=_0x531655[_0x30f58f(0x1a2)]instanceof Float32Array?_0x531655[_0x30f58f(0x1a2)]:new Float32Array(_0x531655[_0x30f58f(0x1a2)]);await _0x4d1228['add'](_0x531655[_0x30f58f(0x164)],_0x3f63b7,_0x531655['clock']??undefined),_0x2a659c(),_0xb0759f=null;break;}case _0x30f58f(0x1c1):{await _0x4d1228[_0x30f58f(0x1c1)](_0x531655[_0x30f58f(0x164)]),_0x2a659c(),_0xb0759f=null;break;}case'search':{const _0x2c4812=_0x531655['queryVec']instanceof Float32Array?_0x531655[_0x30f58f(0x157)]:new Float32Array(_0x531655[_0x30f58f(0x157)]);_0xb0759f=_0x4d1228['search'](_0x2c4812,_0x531655['opts']||{});break;}case _0x30f58f(0x1aa):{_0xb0759f=await _0x4d1228[_0x30f58f(0x1aa)](_0x531655[_0x30f58f(0x19b)]),_0x2a659c();break;}case _0x30f58f(0x1b2):{const _0x3316b5=(_0x531655[_0x30f58f(0x139)]||[])[_0x30f58f(0x134)](_0x3ca4a5=>({'key':_0x3ca4a5[_0x30f58f(0x164)],'vector':_0x3ca4a5[_0x30f58f(0x1a2)]instanceof Float32Array?_0x3ca4a5[_0x30f58f(0x1a2)]:new Float32Array(_0x3ca4a5[_0x30f58f(0x1a2)])}));await _0x4d1228[_0x30f58f(0x1b2)](async()=>_0x3316b5),_0x2a659c(),_0xb0759f=null;break;}case _0x30f58f(0x1ea):{await _0x4d1228[_0x30f58f(0x1ea)](),_0x2a659c(),_0xb0759f=null;break;}case'count':{_0xb0759f=_0x4d1228[_0x30f58f(0x18e)]();break;}case _0x30f58f(0x14f):{_0xb0759f=_0x4d1228[_0x30f58f(0x14f)]();break;}default:throw new Error(_0x30f58f(0x183)+_0x5c9e5f+'\x22');}_0x51119e['postMessage']({'id':_0x2ca237,'result':_0xb0759f});}catch(_0x9e5349){_0x51119e['postMessage']({'id':_0x2ca237,'error':{'message':_0x9e5349?.[_0x30f58f(0x19f)]||String(_0x9e5349),'code':_0x9e5349?.[_0x30f58f(0x15f)]}});}}),_0x51119e[_0x12cded(0x169)]({'op':_0x12cded(0x1b4)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module['exports']=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;
|