@kedem/okdb 2.3.2 → 2.3.4
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 +74 -0
- package/algorithm-worker-thread.js +1 -1
- package/bin/okdb.js +1 -1
- package/docs/auth-and-sync.md +170 -463
- package/docs/auth-permissions.md +3 -1
- package/docs/deployment.md +8 -0
- package/docs/embeddings.md +1 -0
- package/docs/files.md +176 -51
- package/docs/functions.md +1 -1
- package/docs/getting-started.md +40 -13
- package/docs/http-api.md +12 -3
- package/docs/http-cluster.md +25 -0
- package/docs/resolved-fields.md +2 -0
- package/okdb-functions-sandbox-worker.js +1 -1
- package/okdb-http-worker-child.js +1 -1
- package/okdb-views-bootstrap-worker.js +1 -1
- package/okdb.js +1 -1
- package/package.json +1 -1
- package/public/sections/files/parts/files-file-list.ok.js +1 -1
- package/public/sections/files/parts/files-preview.ok.js +1 -0
- package/types/features/files.d.ts +38 -3
- package/types/index.d.ts +18 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,80 @@ All notable changes to `@kedem/okdb` are documented here. Format loosely follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/); versions follow [SemVer](https://semver.org/).
|
|
5
5
|
Dates are release dates.
|
|
6
6
|
|
|
7
|
+
## [2.3.4] - 2026-09-24
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **Searchable file contents: `files.indexContent({ field, maxBytes })`.** Declares `~files.<field>`
|
|
12
|
+
a resolved field backed by a built-in resolver (blob → extractor → text), installed in every
|
|
13
|
+
process automatically, so FTS and embeddings over `~files` need no per-process app code.
|
|
14
|
+
Text-like mimes are extracted out of the box; `files.registerExtractor(match, fn)` adds others
|
|
15
|
+
(mime, wildcard or predicate; no parsers are bundled). A blob missing on the indexing node is
|
|
16
|
+
pulled from sync peers first, else fails retryably with `FILE_BLOB_MISSING`. Also
|
|
17
|
+
`files.get(id)` / `files.read(id)`, and `files.read` / `files.listPath` in functions.
|
|
18
|
+
- **Inline file preview: `GET /api/files/:id?inline=1`.** Passive media (non-SVG images, audio,
|
|
19
|
+
video, PDF) keep their type; everything else is served as `text/plain`, always with `nosniff`
|
|
20
|
+
and a sandboxing CSP. Single `Range` requests are honoured (206 / 416).
|
|
21
|
+
- **Admin → Files:** a preview pane (text/JSON, images, SVG, PDF, audio/video), a path filter, and
|
|
22
|
+
content search over the `~files` FTS index.
|
|
23
|
+
- **The CLI honours the role flags from its config file.** Top-level `processors`, `engines` and
|
|
24
|
+
`compaction` booleans in `.kdbconfig` (or `--config`) are passed to `new OKDB(path, opts)` with
|
|
25
|
+
the constructor's names, defaults and semantics, for the single-process node and every cluster
|
|
26
|
+
worker — so a passive serving node can run from `bin/okdb`. They were silently ignored before.
|
|
27
|
+
A non-boolean value is a startup error.
|
|
28
|
+
- **`db.http.listen(port, { host })` binds the API to chosen addresses.** `host` is a string or an
|
|
29
|
+
array (one server per address, sharing one request handler); default unchanged (all
|
|
30
|
+
interfaces). With an array, `listen()` returns the first address's `http.Server`; all of them are
|
|
31
|
+
on `db.http.servers` and `db.http.close()` closes them all. The process registry's `listenAddr`
|
|
32
|
+
shows the bound host(s). The CLI reads `http.host` from its config file (single-process and
|
|
33
|
+
every cluster worker). The documented `listen(port, '0.0.0.0')` form now actually binds that
|
|
34
|
+
host (a string is shorthand for `{ host }`); before, the argument was ignored.
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
|
|
38
|
+
- **Overwriting a file id releases the old blob.** `files.upload()` under an existing id with
|
|
39
|
+
different bytes leaked the previous blob's reference (it was never deleted); same bytes no
|
|
40
|
+
longer double-count.
|
|
41
|
+
- **Downloads of files with non-Latin-1 names no longer fail** (`ERR_INVALID_CHAR`):
|
|
42
|
+
`content-disposition` carries an ASCII fallback plus RFC 6266 `filename*`.
|
|
43
|
+
- **Blob pulls from sync peers found no peers**: they looked up `~sync_nodes` in the default env
|
|
44
|
+
instead of `~system`. The fetch now has a timeout.
|
|
45
|
+
- **Admin → Files: switching folders reloads the file list.**
|
|
46
|
+
- **`docs/auth-permissions.md`: the cluster-peer token recipe needs `sync:read` too** — `join()`
|
|
47
|
+
reads `/api/sync/info` first.
|
|
48
|
+
- **`docs/auth-and-sync.md` describes the real auth and sync-peer model.** Dropped the `auth.admin`,
|
|
49
|
+
`auth.tokens`, `api.tokens` and `auth.mode` config okdb never reads; tokens live in `~tokens`, and
|
|
50
|
+
peers join once with a token or name + password, then sync with Ed25519-signed requests.
|
|
51
|
+
- **A process missing an app registration holds embedding work instead of failing it.** A
|
|
52
|
+
full-role process that lacked the pipeline's custom preparer (`registerPreparer`) or chunk
|
|
53
|
+
strategy (`registerChunkStrategy`), or whose embedder engine was not running (e.g. its
|
|
54
|
+
`registerEmbedderFactory` factory is registered only in another process), marked every doc it
|
|
55
|
+
picked up `failed` for good — measured: with a second such process on the store, 21 of 40 docs
|
|
56
|
+
ended failed and stayed failed after the owner restarted. It now holds them exactly like a
|
|
57
|
+
missing resolved-field resolver: the doc stays `pending`, the inline drain is held (and yields
|
|
58
|
+
its lease to a peer that wants it), a queue job is re-queued without using a try, and
|
|
59
|
+
`indexer.stats().waiting` reports `{ reason: 'REGISTRATION_MISSING', kind, name }` or
|
|
60
|
+
`{ reason: 'EMBEDDER_NOT_RUNNING' }` with a warning in the log. The work completes once the
|
|
61
|
+
registration arrives in that process (registering a preparer/strategy or starting the embedder
|
|
62
|
+
kicks the held drain) or a process that has it picks it up. A misspelled built-in name holds
|
|
63
|
+
too; the message lists the built-ins. Docs already marked `failed` this way by earlier versions
|
|
64
|
+
are not revisited automatically — run `indexer.retryFailed()` once.
|
|
65
|
+
|
|
66
|
+
## [2.3.3] - 2026-09-24
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
|
|
70
|
+
- **Two processes opening a new store with `OKDB_LICENSE_FILE` are both licensed.** The install
|
|
71
|
+
created the `~licenses` type with a check-then-register, so when two processes (e.g. a
|
|
72
|
+
supervisor and its worker) opened a brand-new store at once, the loser threw "Register Type
|
|
73
|
+
Error: ~licenses already registered", logged `OKDB_LICENSE_FILE not installed` and ran on the
|
|
74
|
+
free tier until restarted. The type is now get-or-created (`ensureType`), a process that finds
|
|
75
|
+
the license already stored by its peer loads it, and a license's record id is derived from the
|
|
76
|
+
license itself, so a concurrent install no longer stores it twice (the id keeps its UUID
|
|
77
|
+
shape). The same get-or-create now covers the other lazily created types that raced the same
|
|
78
|
+
way: `~tokens`, `~files`, embeddings vector types and the indexer's `doc_status` re-creation
|
|
79
|
+
after a rebuild.
|
|
80
|
+
|
|
7
81
|
## [2.3.2] - 2026-09-24
|
|
8
82
|
|
|
9
83
|
### Changed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const _0x5db5a4=_0x5717;(function(_0x49f6a0,_0x36351a){const _0x1cb2db=_0x5717,_0x1d6dd8=_0x49f6a0();while(!![]){try{const _0xbd9563=parseInt(_0x1cb2db(0x1a4))/0x1+-parseInt(_0x1cb2db(0x177))/0x2+-parseInt(_0x1cb2db(0x1c6))/0x3*(parseInt(_0x1cb2db(0x1a6))/0x4)+-parseInt(_0x1cb2db(0x210))/0x5*(-parseInt(_0x1cb2db(0x23f))/0x6)+parseInt(_0x1cb2db(0x17b))/0x7+parseInt(_0x1cb2db(0x234))/0x8*(-parseInt(_0x1cb2db(0x185))/0x9)+parseInt(_0x1cb2db(0x1d6))/0xa*(parseInt(_0x1cb2db(0x220))/0xb);if(_0xbd9563===_0x36351a)break;else _0x1d6dd8['push'](_0x1d6dd8['shift']());}catch(_0x229aac){_0x1d6dd8['push'](_0x1d6dd8['shift']());}}}(_0x1f5b,0xc1584));var require$$0$1=require('worker_threads'),require$$0=require('fs'),require$$1=require('path'),require$$2=require('os'),require$$3=require('crypto');function getDefaultExportFromCjs(_0x2111df){const _0x5f33d9=_0x5717;return _0x2111df&&_0x2111df[_0x5f33d9(0x239)]&&Object[_0x5f33d9(0x1e9)][_0x5f33d9(0x1ca)][_0x5f33d9(0x1aa)](_0x2111df,_0x5f33d9(0x1ef))?_0x2111df[_0x5f33d9(0x1ef)]:_0x2111df;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x1be4a1=_0x5717;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x233d7b=require$$0,_0x2d237f=require$$1,_0x3df377=require$$2,_0x456141=require$$3;function _0x5e2463(){const _0x3be10d=_0x5717;return Date[_0x3be10d(0x17a)]();}function _0x282af4(_0x418ba7){try{return _0x233d7b['existsSync'](_0x418ba7);}catch{return![];}}function _0x35d8a8(_0x29ca7c){const _0xbc3129=_0x5717;try{return _0x233d7b[_0xbc3129(0x1d1)](_0x29ca7c,'utf8');}catch{return null;}}function _0x5f1875(_0x5e4ca2,_0x28a3c6){const _0x1660da=_0x5717,_0x5d6768=_0x5e4ca2+_0x1660da(0x1f7)+_0x456141['randomBytes'](0x6)[_0x1660da(0x172)](_0x1660da(0x1e8));_0x233d7b[_0x1660da(0x238)](_0x5d6768,_0x28a3c6),_0x233d7b['renameSync'](_0x5d6768,_0x5e4ca2);}function _0x5a5b03(_0x17a989,_0x4b9eb3=0x10){const _0x538764=_0x5717,_0x1a3898=String(Math['max'](0x0,Math['trunc'](_0x17a989||0x0)));return _0x1a3898[_0x538764(0x232)]>=_0x4b9eb3?_0x1a3898:'0'[_0x538764(0x1dd)](_0x4b9eb3-_0x1a3898[_0x538764(0x232)])+_0x1a3898;}return snapshotStore=class _0x302020{constructor({dir:_0xf78024,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x1701fa=_0x5717;if(!_0xf78024)throw new Error('SnapshotStore\x20requires\x20dir');this[_0x1701fa(0x1e3)]=_0xf78024,this[_0x1701fa(0x18e)]=_0x2d237f[_0x1701fa(0x20e)](_0xf78024,_0x1701fa(0x1b3)),this['currentPath']=_0x2d237f[_0x1701fa(0x20e)](_0xf78024,_0x1701fa(0x1c2)),this['lockPath']=_0x2d237f['join'](_0xf78024,_0x1701fa(0x206)),this[_0x1701fa(0x181)]=keepSnapshots,this['log']=log,_0x233d7b[_0x1701fa(0x235)](this[_0x1701fa(0x1e3)],{'recursive':!![]}),_0x233d7b[_0x1701fa(0x235)](this[_0x1701fa(0x18e)],{'recursive':!![]});}[_0x1be4a1(0x1a3)](_0x1525c8){const _0x785d2c=_0x1be4a1;return _0x2d237f[_0x785d2c(0x20e)](this['snapshotsDir'],_0x1525c8);}[_0x1be4a1(0x228)](_0x355e49){const _0x209e3d=_0x1be4a1,_0x41d78e=this[_0x209e3d(0x1a3)](_0x355e49);return{'dir':_0x41d78e,'index':_0x2d237f[_0x209e3d(0x20e)](_0x41d78e,_0x209e3d(0x1fe)),'labels':_0x2d237f['join'](_0x41d78e,_0x209e3d(0x1a1)),'state':_0x2d237f[_0x209e3d(0x20e)](_0x41d78e,_0x209e3d(0x1dc))};}[_0x1be4a1(0x1b6)](){const _0x15104f=_0x1be4a1;if(!_0x282af4(this['currentPath']))return null;const _0x2e05ef=_0x35d8a8(this['currentPath']);if(!_0x2e05ef)return null;const _0x66ec79=String(_0x2e05ef)[_0x15104f(0x213)]();return _0x66ec79||null;}[_0x1be4a1(0x217)](){const _0x1d0b6f=_0x1be4a1,_0x1ad11c=this['readCurrentId']();if(!_0x1ad11c)return 0x0;const _0x52ca1c=Number(_0x1ad11c);return Number[_0x1d0b6f(0x191)](_0x52ca1c)?_0x52ca1c:0x0;}[_0x1be4a1(0x1f3)](){const _0x4adf9e=_0x1be4a1;try{return _0x233d7b[_0x4adf9e(0x189)](this[_0x4adf9e(0x18e)],{'withFileTypes':!![]})[_0x4adf9e(0x230)](_0x5c5043=>_0x5c5043['isDirectory']())[_0x4adf9e(0x21d)](_0x391ada=>_0x391ada[_0x4adf9e(0x22c)])[_0x4adf9e(0x230)](_0x6c05c5=>!_0x6c05c5[_0x4adf9e(0x1d7)](_0x4adf9e(0x1f7)))[_0x4adf9e(0x230)](_0x4bedd3=>!_0x4bedd3[_0x4adf9e(0x1d7)]('_tmp-'))[_0x4adf9e(0x187)]();}catch{return[];}}[_0x1be4a1(0x1cc)](){const _0x2eee4f=_0x1be4a1,_0x2dd1ee=this[_0x2eee4f(0x1b6)]();if(_0x2dd1ee)return _0x2dd1ee;const _0x42e9f2=this['listSnapshotIds']();if(!_0x42e9f2['length'])return null;return _0x42e9f2[_0x42e9f2[_0x2eee4f(0x232)]-0x1];}[_0x1be4a1(0x1d3)]({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x2032e7=_0x1be4a1;let _0xef8288;try{_0xef8288=_0x233d7b['readdirSync'](this[_0x2032e7(0x18e)],{'withFileTypes':!![]});}catch{return;}const _0xd978c9=_0x5e2463()-maxAgeMs;for(const _0x8bf312 of _0xef8288){if(!_0x8bf312[_0x2032e7(0x1d5)]())continue;const _0xa91635=_0x8bf312[_0x2032e7(0x22c)];if(!_0xa91635[_0x2032e7(0x1d7)](_0x2032e7(0x1f7))&&!_0xa91635[_0x2032e7(0x1d7)]('_tmp-'))continue;const _0x4256de=_0x2d237f[_0x2032e7(0x20e)](this['snapshotsDir'],_0xa91635);try{const _0x53c15e=_0x233d7b[_0x2032e7(0x199)](_0x4256de);if(_0x53c15e[_0x2032e7(0x168)]>_0xd978c9)continue;}catch{}try{_0x233d7b[_0x2032e7(0x21e)](_0x4256de,{'recursive':!![],'force':!![]});}catch{}}}['prune']({keep:keep=null}={}){const _0x526af6=_0x1be4a1,_0x2d7531=Math[_0x526af6(0x222)](0x1,Math['trunc'](keep??this[_0x526af6(0x181)]??0x3)),_0x4c0220=this[_0x526af6(0x1f3)]();if(_0x4c0220[_0x526af6(0x232)]<=_0x2d7531)return;const _0x5ba917=this[_0x526af6(0x1b6)](),_0x5f333f=_0x4c0220['slice'](0x0,Math[_0x526af6(0x222)](0x0,_0x4c0220['length']-_0x2d7531));for(const _0x75b436 of _0x5f333f){if(_0x5ba917&&_0x75b436===_0x5ba917)continue;const _0x3005f6=this[_0x526af6(0x1a3)](_0x75b436);try{_0x233d7b[_0x526af6(0x21e)](_0x3005f6,{'recursive':!![],'force':!![]});}catch{}}}async[_0x1be4a1(0x1e0)](_0x4baf78,_0x41c839){const _0x51d009=_0x1be4a1;if(!_0x4baf78)throw new Error(_0x51d009(0x1ee));const _0x1ca371=this['_snapshotPaths'](_0x4baf78);if(!_0x282af4(_0x1ca371[_0x51d009(0x221)])||!_0x282af4(_0x1ca371[_0x51d009(0x227)])||!_0x282af4(_0x1ca371['state']))throw new Error('snapshot\x20incomplete:\x20'+_0x4baf78);const _0x18d24f=await _0x41c839(_0x1ca371);return _0x18d24f||{};}async[_0x1be4a1(0x17e)](_0x3e7fd4,_0x4f3043,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x9eb37f=_0x1be4a1,_0x367f0e=Number(_0x3e7fd4);if(!Number[_0x9eb37f(0x191)](_0x367f0e)||_0x367f0e<0x0)throw new Error('candidateClock\x20must\x20be\x20finite\x20>=\x200');const _0x1561e4=_0x5a5b03(_0x367f0e),_0x106d8f=this[_0x9eb37f(0x1a3)](_0x1561e4),_0x3dda6a=_0x2d237f[_0x9eb37f(0x20e)](this[_0x9eb37f(0x18e)],'.tmp-'+_0x1561e4+'-'+_0x456141[_0x9eb37f(0x1eb)](0x6)[_0x9eb37f(0x172)](_0x9eb37f(0x1e8)));_0x233d7b[_0x9eb37f(0x235)](_0x3dda6a,{'recursive':!![]});const _0x3067f9={'dir':_0x3dda6a,'index':_0x2d237f['join'](_0x3dda6a,_0x9eb37f(0x1fe)),'labels':_0x2d237f[_0x9eb37f(0x20e)](_0x3dda6a,'labels.json'),'state':_0x2d237f[_0x9eb37f(0x20e)](_0x3dda6a,_0x9eb37f(0x1dc))};await _0x4f3043(_0x3067f9,{'id':_0x1561e4,'clock':_0x367f0e});const _0x37970e=JSON[_0x9eb37f(0x200)]({'pid':process[_0x9eb37f(0x197)],'host':_0x3df377[_0x9eb37f(0x1ed)](),'at':_0x5e2463()}),_0x3e22f5=_0x5e2463();let _0x38a26a=null;const _0x259d66=()=>{const _0x229db9=_0x9eb37f;try{const _0x557d78=JSON['parse'](_0x233d7b[_0x229db9(0x1d1)](this[_0x229db9(0x1c1)],_0x229db9(0x17f)));if(_0x557d78['at']&&_0x5e2463()-_0x557d78['at']>staleLockMaxAgeMs){const _0x5f4410=_0x5e2463()-_0x557d78['at'],_0x315c95=_0x229db9(0x20f)+Math[_0x229db9(0x196)](_0x5f4410/0x3e8)+_0x229db9(0x1f1)+_0x557d78[_0x229db9(0x197)]+',\x20host:\x20'+_0x557d78[_0x229db9(0x1de)]+_0x229db9(0x1be)+_0x229db9(0x1ec);this['log']?.[_0x229db9(0x1b2)]?this[_0x229db9(0x16f)]['warn'](_0x315c95):console['warn'](_0x229db9(0x1f5),_0x315c95);try{_0x233d7b[_0x229db9(0x1e2)](this['lockPath']);}catch{}return!![];}}catch{try{_0x233d7b[_0x229db9(0x1e2)](this[_0x229db9(0x1c1)]);}catch{}}return![];},_0x1df8af=()=>{const _0xb922d1=_0x9eb37f;try{return _0x38a26a=_0x233d7b[_0xb922d1(0x1d2)](this[_0xb922d1(0x1c1)],'wx'),_0x233d7b[_0xb922d1(0x238)](_0x38a26a,_0x37970e),!![];}catch(_0xa01e50){if(_0xa01e50&&_0xa01e50[_0xb922d1(0x1a0)]===_0xb922d1(0x1a7))return![];throw _0xa01e50;}};if(!_0x1df8af()){_0x259d66(),_0x1df8af();if(_0x38a26a==null&&lockTimeoutMs>0x0)while(_0x5e2463()-_0x3e22f5<lockTimeoutMs){await new Promise(_0xc4c388=>setTimeout(_0xc4c388,0x19));if(_0x1df8af())break;_0x259d66();}}if(_0x38a26a==null){try{_0x233d7b[_0x9eb37f(0x21e)](_0x3dda6a,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':'lock_busy'};}try{const _0x18b2f2=this['readCurrentClock']();if(_0x367f0e<=_0x18b2f2){try{_0x233d7b['rmSync'](_0x3dda6a,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x9eb37f(0x1bc),'currentClock':_0x18b2f2};}if(!_0x282af4(_0x106d8f))_0x233d7b[_0x9eb37f(0x1e1)](_0x3dda6a,_0x106d8f);else try{_0x233d7b['rmSync'](_0x3dda6a,{'recursive':!![],'force':!![]});}catch{}return _0x5f1875(this[_0x9eb37f(0x186)],_0x1561e4+'\x0a'),this[_0x9eb37f(0x202)]({'keep':keep}),{'published':!![],'currentClock':_0x367f0e};}finally{try{_0x233d7b[_0x9eb37f(0x1ac)](_0x38a26a);}catch{}try{_0x233d7b[_0x9eb37f(0x1e2)](this[_0x9eb37f(0x1c1)]);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x1bb8a6=_0x5717;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x5e7a7e=require$$0;class _0x3d9ac4{constructor(){const _0x1c79e2=_0x5717;this[_0x1c79e2(0x21c)]=new Map(),this['labelToKey']=new Map(),this[_0x1c79e2(0x1c9)]=0x0,this['_tombstoneCount']=0x0,this['keyToFp']=new Map(),this[_0x1c79e2(0x1d4)]=!![];}async[_0x1bb8a6(0x1f0)](){const _0x2a9566=_0x1bb8a6;this['keyToLabel']=new Map(),this['labelToKey']=new Map(),this[_0x2a9566(0x1e5)]=new Map(),this['hasFingerprints']=!![],this[_0x2a9566(0x1c9)]=0x0,this[_0x2a9566(0x1a5)]=0x0;}async[_0x1bb8a6(0x1a2)](_0x3fce6a){const _0x65a7f5=_0x1bb8a6;if(!_0x3fce6a||!_0x5e7a7e[_0x65a7f5(0x1fc)](_0x3fce6a))return await this[_0x65a7f5(0x1f0)](),!![];let _0x409df4;try{_0x409df4=_0x5e7a7e[_0x65a7f5(0x1d1)](_0x3fce6a,'utf8');}catch{return await this[_0x65a7f5(0x1f0)](),!![];}let _0x32cf8a;try{_0x32cf8a=JSON['parse'](_0x409df4);}catch{return await this[_0x65a7f5(0x1f0)](),!![];}const _0x5a32de=Array[_0x65a7f5(0x1b8)](_0x32cf8a?.[_0x65a7f5(0x22b)])?_0x32cf8a[_0x65a7f5(0x22b)]:[],_0x40a813=Number['isInteger'](_0x32cf8a?.[_0x65a7f5(0x1c9)])?_0x32cf8a[_0x65a7f5(0x1c9)]:0x0,_0x32e989=new Map(),_0x524024=new Map(),_0x4f896b=new Map(),_0x27924c=_0x32cf8a?.['version']>=0x2;let _0xad997d=-0x1;for(const _0x552c50 of _0x5a32de){if(!Array['isArray'](_0x552c50)||_0x552c50[_0x65a7f5(0x232)]<0x2)continue;const _0xfc995e=Number(_0x552c50[0x0]),_0x5a62ee=String(_0x552c50[0x1]??'');if(!Number[_0x65a7f5(0x192)](_0xfc995e)||_0xfc995e<0x0)continue;if(!_0x5a62ee)continue;_0x32e989[_0x65a7f5(0x225)](_0x5a62ee,_0xfc995e),_0x524024[_0x65a7f5(0x225)](_0xfc995e,_0x5a62ee);if(_0x27924c&&typeof _0x552c50[0x2]==='number')_0x4f896b[_0x65a7f5(0x225)](_0x5a62ee,_0x552c50[0x2]);if(_0xfc995e>_0xad997d)_0xad997d=_0xfc995e;}return this['keyToLabel']=_0x32e989,this[_0x65a7f5(0x20d)]=_0x524024,this['keyToFp']=_0x4f896b,this[_0x65a7f5(0x1d4)]=_0x27924c,this[_0x65a7f5(0x1c9)]=Math[_0x65a7f5(0x222)](_0x40a813,_0xad997d+0x1,0x0),this[_0x65a7f5(0x1a5)]=0x0,!![];}[_0x1bb8a6(0x188)](_0x243c7b){const _0x4e4a7a=_0x1bb8a6;return this['keyToLabel'][_0x4e4a7a(0x23e)](_0x243c7b);}['labelForEphemeral'](_0x2305dd){const _0x59b37b=_0x1bb8a6;let _0xada9cb=this[_0x59b37b(0x21c)][_0x59b37b(0x23e)](_0x2305dd);if(_0xada9cb!==undefined)return _0xada9cb;return _0xada9cb=this[_0x59b37b(0x1c9)]++,this[_0x59b37b(0x21c)][_0x59b37b(0x225)](_0x2305dd,_0xada9cb),this[_0x59b37b(0x20d)]['set'](_0xada9cb,_0x2305dd),_0xada9cb;}['setFingerprint'](_0x28ec0a,_0x13fa59){const _0x273a7e=_0x1bb8a6;if(_0x13fa59==null)this['keyToFp'][_0x273a7e(0x175)](_0x28ec0a);else this[_0x273a7e(0x1e5)][_0x273a7e(0x225)](_0x28ec0a,_0x13fa59);}[_0x1bb8a6(0x1a9)](_0xae167){const _0x656a37=_0x1bb8a6;return this[_0x656a37(0x1e5)]['get'](_0xae167);}[_0x1bb8a6(0x195)](){const _0x4043f4=_0x1bb8a6;return this[_0x4043f4(0x21c)]['keys']();}[_0x1bb8a6(0x17c)](_0x4cde0f){const _0x34fb67=_0x1bb8a6,_0x22c30b=this[_0x34fb67(0x21c)][_0x34fb67(0x23e)](_0x4cde0f);if(_0x22c30b===undefined)return;this[_0x34fb67(0x1e5)]['delete'](_0x4cde0f),this[_0x34fb67(0x21c)][_0x34fb67(0x175)](_0x4cde0f),this[_0x34fb67(0x20d)][_0x34fb67(0x175)](_0x22c30b),this['_tombstoneCount']++;}[_0x1bb8a6(0x1fd)](_0x386e74){return this['labelToKey']['get'](_0x386e74)??null;}[_0x1bb8a6(0x201)](){const _0x40ed9d=_0x1bb8a6;return this[_0x40ed9d(0x21c)][_0x40ed9d(0x201)];}[_0x1bb8a6(0x170)](){return this['_tombstoneCount'];}async[_0x1bb8a6(0x23d)](_0x253173){const _0x258446=_0x1bb8a6,_0x347daf=_0x253173+'.tmp',_0x5eb3e9=[];for(const [_0x5500e8,_0x266d9e]of this[_0x258446(0x20d)][_0x258446(0x22b)]()){const _0xf6fce4=this[_0x258446(0x1e5)][_0x258446(0x23e)](_0x266d9e);_0x5eb3e9['push'](_0xf6fce4==null?[_0x5500e8,_0x266d9e]:[_0x5500e8,_0x266d9e,_0xf6fce4]);}_0x5eb3e9[_0x258446(0x187)]((_0x10e5cc,_0x10a9fb)=>_0x10e5cc[0x0]-_0x10a9fb[0x0]);const _0x11d025={'version':0x2,'nextLabel':this[_0x258446(0x1c9)],'entries':_0x5eb3e9};_0x5e7a7e[_0x258446(0x238)](_0x347daf,JSON[_0x258446(0x200)](_0x11d025)),_0x5e7a7e[_0x258446(0x1e1)](_0x347daf,_0x253173);}}return labelMap=_0x3d9ac4,labelMap;}var indexConvergence,hasRequiredIndexConvergence;function requireIndexConvergence(){if(hasRequiredIndexConvergence)return indexConvergence;hasRequiredIndexConvergence=0x1;function _0x54d5f4(_0x512865){const _0x30052f=_0x5717,_0x470b4c=new Uint32Array(_0x512865[_0x30052f(0x1c8)],_0x512865[_0x30052f(0x190)],_0x512865[_0x30052f(0x232)]);let _0x33a15a=0x811c9dc5,_0x1be3f9=0x9747b28c;for(let _0x541a86=0x0;_0x541a86<_0x470b4c['length'];_0x541a86++){const _0x32c8ad=_0x470b4c[_0x541a86];_0x33a15a=Math['imul'](_0x33a15a^_0x32c8ad,0x1000193)>>>0x0;let _0x264864=Math[_0x30052f(0x23a)](_0x32c8ad,0xcc9e2d51);_0x264864=_0x264864<<0xf|_0x264864>>>0x11,_0x1be3f9=Math[_0x30052f(0x23a)](_0x1be3f9^Math[_0x30052f(0x23a)](_0x264864,0x1b873593),0x5)+0xe6546b64,_0x1be3f9>>>=0x0;}return _0x1be3f9=Math['imul'](_0x1be3f9^_0x1be3f9>>>0x10,0x85ebca6b)>>>0x0,(_0x33a15a>>>0x0)*0x100000+(_0x1be3f9&0xfffff);}function _0x4842b5(_0x505d79,_0x4df428,_0xfa346c,{upsert:_0x3c0df7,remove:_0xd4ce2c}){const _0x535d52=_0x5717,_0x247774=new Set();let _0x8c301=0x0,_0x33c9e0=0x0,_0x17a4c1=0x0;for(const {key:_0x25c7ae,vector:_0x1da366}of _0x4df428){if(!(_0x1da366 instanceof Float32Array)||_0x1da366['length']!==_0xfa346c)continue;_0x247774[_0x535d52(0x1a8)](_0x25c7ae);const _0xe84592=_0x54d5f4(_0x1da366),_0x404b1f=_0x505d79[_0x535d52(0x188)](_0x25c7ae)!==undefined;if(_0x404b1f&&_0x505d79[_0x535d52(0x1a9)](_0x25c7ae)===_0xe84592)continue;_0x3c0df7(_0x25c7ae,_0x1da366,_0xe84592);if(_0x404b1f)_0x33c9e0++;else _0x8c301++;}for(const _0x54e1bb of[..._0x505d79[_0x535d52(0x195)]()]){if(_0x247774['has'](_0x54e1bb))continue;_0xd4ce2c(_0x54e1bb),_0x17a4c1++;}return{'added':_0x8c301,'changed':_0x33c9e0,'removed':_0x17a4c1};}return indexConvergence={'fingerprint':_0x54d5f4,'reconcileIndex':_0x4842b5},indexConvergence;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x30a178=requireSnapshotStore(),_0x69cd21=requireLabelMap(),{fingerprint:_0xcbc21f,reconcileIndex:_0x364cd8}=requireIndexConvergence(),_0xe5e7c8=0x1;let _0x22f04a=null;function _0x3f7a0c(){const _0x465499=_0x5717;if(_0x22f04a)return _0x22f04a;try{return _0x22f04a=require('hnswlib-node'),_0x22f04a;}catch(_0x44c8b1){const _0x40bb98=new Error(_0x465499(0x176)+(_0x465499(0x18d)+process['versions'][_0x465499(0x1c0)]+_0x465499(0x1fb)+process['platform']+'/'+process[_0x465499(0x16b)]+'.\x20')+'Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20'+(_0x465499(0x1af)+(_0x44c8b1?.[_0x465499(0x19d)]||String(_0x44c8b1))));_0x40bb98[_0x465499(0x1a0)]=_0x465499(0x219),_0x40bb98['cause']=_0x44c8b1;throw _0x40bb98;}}return hnsw=function _0x46744c(_0x46924c={},{dims:_0x451b1e,dir:_0x463c2b}){const _0x243395=_0x5717,_0x37ae7d=_0x3f7a0c();if(!_0x451b1e||_0x451b1e<=0x0)throw new Error(_0x243395(0x20a));if(!_0x463c2b)throw new Error(_0x243395(0x20c));const _0x4519f2={'metric':_0x46924c['metric']??'cosine','M':_0x46924c['M']??0x10,'efConstruction':_0x46924c[_0x243395(0x18c)]??0xc8,'efSearch':_0x46924c[_0x243395(0x16a)]??0x40,'maxElements':_0x46924c[_0x243395(0x1ff)]??0x400,'growFactor':_0x46924c[_0x243395(0x198)]??0x2,'snapshotEveryChanges':_0x46924c[_0x243395(0x19a)]??0xc350,'keepSnapshots':_0x46924c['keepSnapshots']??0x2,'tmpMaxAgeMs':_0x46924c[_0x243395(0x180)]??0x6*0x36ee80},_0x3c8729=new _0x30a178({'dir':_0x463c2b,'keepSnapshots':_0x4519f2[_0x243395(0x181)]}),_0xcc8e9b=new _0x69cd21();let _0x3775dd=null,_0x59a693=0x0,_0x40f8b5=null,_0x558792=Promise[_0x243395(0x169)]();const _0x3ca46b=_0x102681=>{const _0x853119=_0x243395,_0xfaab1a=_0x558792[_0x853119(0x1b5)](_0x102681);return _0x558792=_0xfaab1a[_0x853119(0x1bd)](()=>{}),_0xfaab1a;};async function _0x338b5d(_0x2cd8a8){const _0x1241e7=_0x243395;await _0xcc8e9b[_0x1241e7(0x1f0)](),_0x2cd8a8=_0x2cd8a8??[];const _0x5800f9=Math[_0x1241e7(0x222)](_0x4519f2[_0x1241e7(0x1ff)],Math[_0x1241e7(0x1d8)](_0x2cd8a8[_0x1241e7(0x232)]*(_0x4519f2[_0x1241e7(0x198)]||1.2)),0x1);_0x3775dd=new _0x37ae7d[(_0x1241e7(0x204))](_0x4519f2['metric'],_0x451b1e),_0x3775dd['initIndex']({'maxElements':_0x5800f9,'efConstruction':_0x4519f2[_0x1241e7(0x18c)],'M':_0x4519f2['M']});for(const {key:_0x1d2ca1,vector:_0x28b40c}of _0x2cd8a8){if(!(_0x28b40c instanceof Float32Array)||_0x28b40c[_0x1241e7(0x232)]!==_0x451b1e)continue;_0x4c5d22(_0x1d2ca1,_0x28b40c);}_0x3775dd[_0x1241e7(0x18b)](_0x4519f2[_0x1241e7(0x16a)]),_0x59a693=0x0;}async function _0x3b480a(_0x278652){return _0x338b5d(_0x278652?await _0x278652():[]);}function _0x2e89ce(){const _0x363115=_0x243395;if(_0x3775dd['getCurrentCount']()<_0x3775dd[_0x363115(0x21f)]())return;const _0x5965df=Math[_0x363115(0x1d8)](_0x3775dd['getMaxElements']()*(_0x4519f2[_0x363115(0x198)]||0x2));_0x3775dd[_0x363115(0x1ab)](_0x5965df),_0x4519f2[_0x363115(0x1ff)]=_0x5965df;}function _0x4c5d22(_0x14dd7f,_0x55ed30,_0x2d0365){const _0x209091=_0x243395,_0x4f20fc=_0xcc8e9b[_0x209091(0x216)](_0x14dd7f);try{_0x3775dd[_0x209091(0x1cb)](_0x4f20fc);}catch{}_0x2e89ce(),_0x3775dd[_0x209091(0x1b1)](Array['from'](_0x55ed30),_0x4f20fc),_0xcc8e9b['setFingerprint'](_0x14dd7f,_0x2d0365??_0xcbc21f(_0x55ed30));}function _0x31c524(_0x48eb9d){const _0x30d69f=_0x243395,_0x397833=_0xcc8e9b['labelForExisting'](_0x48eb9d);if(_0x397833===undefined)return![];try{_0x3775dd[_0x30d69f(0x1cb)](_0x397833);}catch{}return _0xcc8e9b['tombstone'](_0x48eb9d),!![];}function _0x303d6b(){const _0x17e6a6=_0x243395;return Math[_0x17e6a6(0x222)](Date['now'](),_0x3c8729[_0x17e6a6(0x217)]()+0x1);}async function _0x484ec(_0x1504e2){const _0x549b70=_0x243395;if(!_0x3775dd||!_0x1504e2)return![];const _0x2c2d07=await _0x3c8729['publishSnapshot'](_0x1504e2,async _0x19d969=>{const _0x535ce7=_0x5717;_0x3775dd[_0x535ce7(0x1e6)](_0x19d969[_0x535ce7(0x221)]),await _0xcc8e9b[_0x535ce7(0x23d)](_0x19d969[_0x535ce7(0x227)]);const _0x56326e=require$$0;_0x56326e[_0x535ce7(0x238)](_0x19d969['state'],JSON['stringify']({'manifestVersion':_0xe5e7c8,'dims':_0x451b1e,'metric':_0x4519f2[_0x535ce7(0x21b)],'clock':_0x1504e2,'snapshotAt':Date[_0x535ce7(0x17a)]()},null,0x2));},{'keep':_0x4519f2[_0x549b70(0x181)]});if(_0x2c2d07?.[_0x549b70(0x1c5)])_0x59a693=0x0;return _0x2c2d07?.[_0x549b70(0x1c5)]??![];}async function _0x37a30e(){const _0x3a576e=_0x243395,_0x47454b=_0x3c8729['readCurrentId']()||_0x3c8729[_0x3a576e(0x1cc)]();if(!_0x47454b)return null;let _0x1c594f,_0x4e8fe6=![];return await _0x3c8729[_0x3a576e(0x1e0)](_0x47454b,async _0x17280c=>{const _0xe6b39e=_0x3a576e,_0x3bcf95=require$$0;_0x1c594f=JSON[_0xe6b39e(0x1c4)](_0x3bcf95['readFileSync'](_0x17280c[_0xe6b39e(0x1e4)],_0xe6b39e(0x17f)));if(_0x1c594f[_0xe6b39e(0x1f8)]!==_0xe5e7c8||_0x1c594f[_0xe6b39e(0x233)]!==_0x451b1e||_0x1c594f[_0xe6b39e(0x21b)]!==_0x4519f2['metric']){_0x1c594f=null;return;}await _0xcc8e9b[_0xe6b39e(0x1a2)](_0x17280c[_0xe6b39e(0x227)]),_0x3775dd=new _0x37ae7d['HierarchicalNSW'](_0x4519f2[_0xe6b39e(0x21b)],_0x451b1e),_0x3775dd[_0xe6b39e(0x1f4)](_0x17280c[_0xe6b39e(0x221)]),_0x3775dd[_0xe6b39e(0x18b)](_0x4519f2[_0xe6b39e(0x16a)]),_0x4e8fe6=!![];}),_0x4e8fe6?_0x1c594f?.[_0x3a576e(0x19e)]??0x0:null;}return{async 'load'(_0x2b8145){return _0x3ca46b(async()=>{const _0x3fc04e=_0x5717;_0x3c8729['cleanupTmpDirs']({'maxAgeMs':_0x4519f2[_0x3fc04e(0x180)]}),_0x40f8b5=_0x2b8145??null;const _0x42858d=await _0x37a30e(),_0x19446f=_0x2b8145?await _0x2b8145():null;if(_0x42858d!=null){if(_0x19446f){if(!_0xcc8e9b[_0x3fc04e(0x1d4)])return await _0x338b5d(_0x19446f),null;const _0x11dae9=_0x364cd8(_0xcc8e9b,_0x19446f,_0x451b1e,{'upsert':_0x4c5d22,'remove':_0x31c524});_0x59a693+=_0x11dae9[_0x3fc04e(0x193)]+_0x11dae9[_0x3fc04e(0x224)]+_0x11dae9[_0x3fc04e(0x236)];}return _0x42858d;}return await _0x338b5d(_0x19446f),null;});},async 'add'(_0x2d2ec2,_0x2ee76d,_0x4bf22b){return _0x3ca46b(async()=>{const _0x4991ce=_0x5717;if(!_0x3775dd)return;const _0x13341a=_0x2ee76d instanceof Float32Array?_0x2ee76d:new Float32Array(_0x2ee76d),_0x450a58=_0xcbc21f(_0x13341a);if(_0xcc8e9b[_0x4991ce(0x1a9)](_0x2d2ec2)===_0x450a58)return;_0x4c5d22(_0x2d2ec2,_0x13341a,_0x450a58),_0x59a693++,_0x59a693>=_0x4519f2[_0x4991ce(0x19a)]&&await _0x484ec(_0x303d6b());});},async 'remove'(_0x487269){return _0x3ca46b(async()=>{if(!_0x3775dd)return;if(_0x31c524(_0x487269))_0x59a693++;});},'search'(_0x322dce,{limit:limit=0xa,efSearch:_0x5a911d}={}){const _0x113d21=_0x243395;if(!_0x3775dd)return[];if(Number['isInteger'](_0x5a911d))_0x3775dd['setEf'](_0x5a911d);const _0x3858d6=Math[_0x113d21(0x1bf)](limit,_0x3775dd[_0x113d21(0x19f)]()||0x1),{neighbors:_0x5126f8,distances:_0x20be8f}=_0x3775dd[_0x113d21(0x1df)](Array[_0x113d21(0x237)](_0x322dce),_0x3858d6),_0x1ad5b3=[];for(let _0x1db287=0x0;_0x1db287<_0x5126f8[_0x113d21(0x232)];_0x1db287++){const _0x5beb61=_0xcc8e9b[_0x113d21(0x1fd)](_0x5126f8[_0x1db287]);if(!_0x5beb61)continue;const _0x368ac9=_0x4519f2['metric']===_0x113d21(0x1d9)?Math[_0x113d21(0x222)](0x0,0x1-_0x20be8f[_0x1db287]):0x1/(0x1+_0x20be8f[_0x1db287]);_0x1ad5b3[_0x113d21(0x212)]({'key':_0x5beb61,'score':_0x368ac9});}return _0x1ad5b3;},async 'snapshot'(_0x5a838f){return _0x3ca46b(()=>_0x484ec(_0x5a838f??_0x303d6b()));},async 'rebuild'(_0x4b5434){return _0x3ca46b(()=>{if(_0x4b5434!=null)_0x40f8b5=_0x4b5434;return _0x3b480a(_0x4b5434??_0x40f8b5);});},async 'stop'(){const _0x43449c=_0x243395;return _0x3ca46b(()=>_0x59a693>0x0||!_0x3c8729[_0x43449c(0x1b6)]()?_0x484ec(_0x303d6b()):![]);},'count'(){const _0x3e36c2=_0x243395;return _0xcc8e9b[_0x3e36c2(0x201)]();},'info'(){const _0x82981e=_0x243395;return{'algorithm':_0x82981e(0x1f9),'metric':_0x4519f2[_0x82981e(0x21b)],'M':_0x4519f2['M'],'efConstruction':_0x4519f2['efConstruction'],'efSearch':_0x4519f2[_0x82981e(0x16a)],'maxElements':_0x3775dd?.[_0x82981e(0x21f)]()??_0x4519f2[_0x82981e(0x1ff)],'count':_0xcc8e9b[_0x82981e(0x201)](),'changesSince':_0x59a693,'snapshotDir':_0x463c2b,'latestSnapshot':_0x3c8729['readCurrentId']()??null};}};},hnsw;}var flat,hasRequiredFlat;function _0x5717(_0x194693,_0x563122){_0x194693=_0x194693-0x168;const _0x1f5bcc=_0x1f5b();let _0x5717ec=_0x1f5bcc[_0x194693];return _0x5717ec;}function _0x1f5b(){const _0x5800d8=['900981yfCchL','currentPath','sort','labelForExisting','readdirSync','vector','setEf','efConstruction','for\x20Node\x20','snapshotsDir','postMessage','byteOffset','isFinite','isInteger','added','key','keys','round','pid','growFactor','statSync','snapshotEveryChanges','writer','finally','message','clock','getCurrentCount','code','labels.json','loadFrom','_snapshotDir','505016cbhnOM','_tombstoneCount','12fCKCEM','EEXIST','add','fingerprintOf','call','resizeIndex','closeSync','rebuild','opts','Original\x20error:\x20','ready','addPoint','warn','snapshots','snapshot','then','readCurrentId','Index','isArray','unreadable','slice','token','stale','catch',').\x20','min','node','lockPath','CURRENT','expansionAdd','parse','published','419937etrAKn','vectors','buffer','nextLabel','hasOwnProperty','markDelete','latestSnapshotId','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20','reject','acquire','info','readFileSync','openSync','cleanupTmpDirs','hasFingerprints','isDirectory','10MouAQR','startsWith','ceil','cosine','WRITER.LOCK','connectivity','state.json','repeat','host','searchKnn','loadSnapshot','renameSync','unlinkSync','dir','state','keyToFp','writeIndexSync','Unknown\x20algorithm:\x20\x22','hex','prototype','count','randomBytes','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','hostname','snapshot\x20id\x20required','default','reset','s,\x20pid:\x20','capacity','listSnapshotIds','readIndexSync','[SnapshotStore]','writerLockMaxAgeMs','.tmp-','manifestVersion','hnsw','release','\x20on\x20','existsSync','keyForLabel','index.hnsw','maxElements','stringify','size','prune','search','HierarchicalNSW','algorithm','SNAPSHOT.LOCK','view','error','fetchAll','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','load','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','labelToKey','join','Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20','104180aKGgqa','MetricKind','push','trim','versions','expansionSearch','labelForEphemeral','readCurrentClock','isFree','HNSW_BINDINGS_UNAVAILABLE','sqrt','metric','keyToLabel','map','rmSync','getMaxElements','15607339hGoNha','index','max','heartbeatIntervalMs','changed','set','unref','labels','_snapshotPaths','platform','score','entries','name','distances','Cos','viewRefreshMs','filter','stop','length','dims','104UGgLXS','mkdirSync','removed','from','writeFileSync','__esModule','imul','ScalarKind','exports','snapshotTo','get','48LjQtMy','mtimeMs','resolve','efSearch','arch','fetchAllResult','setFingerprint','reader','log','tombstoneCount','queryVec','toString','flat','remove','delete','HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','1630728MspAmX','fid','snapshotMaxLagMs','now','8666735JuLMnw','tombstone','ENOENT','publishSnapshot','utf8','tmpMaxAgeMs','keepSnapshots','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','Unknown\x20op:\x20\x22','usearch'];_0x1f5b=function(){return _0x5800d8;};return _0x1f5b();}function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x1b2328(_0x3298d1={}){const _0xbdf55c=new Map();return{async 'load'(_0x33af80){_0xbdf55c['clear']();if(_0x33af80)for(const {key:_0x5797b4,vector:_0x3e9d33}of await _0x33af80()){_0xbdf55c['set'](_0x5797b4,_0x3e9d33);}},async 'add'(_0x183ea4,_0x15e176,_0x31a749){const _0x414406=_0x5717;_0xbdf55c[_0x414406(0x225)](_0x183ea4,_0x15e176);},async 'remove'(_0x3912e1){const _0x556e88=_0x5717;_0xbdf55c[_0x556e88(0x175)](_0x3912e1);},'search'(_0x3f92cb,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x3e4fbd=_0x5717,_0x468491=[];for(const [_0x34e826,_0x1d3fe8]of _0xbdf55c){const _0x4e1131=_0x41c027(_0x3f92cb,_0x1d3fe8);if(_0x4e1131>=threshold)_0x468491[_0x3e4fbd(0x212)]({'key':_0x34e826,'score':_0x4e1131});}return _0x468491[_0x3e4fbd(0x187)]((_0xe040ea,_0x306590)=>_0x306590[_0x3e4fbd(0x22a)]-_0xe040ea['score']),_0x468491[_0x3e4fbd(0x1ba)](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x5320d4){const _0x3b748c=_0x5717;await this[_0x3b748c(0x20b)](_0x5320d4);},async 'stop'(){},'count'(){const _0x147a65=_0x5717;return _0xbdf55c[_0x147a65(0x201)];},'info'(){const _0x1c7008=_0x5717;return{'algorithm':_0x1c7008(0x173),'count':_0xbdf55c[_0x1c7008(0x201)]};}};};function _0x41c027(_0x443171,_0x35df07){const _0x37e483=_0x5717;let _0x52fb20=0x0,_0x3e6133=0x0,_0x212cf9=0x0;for(let _0x3fc2dd=0x0;_0x3fc2dd<_0x443171[_0x37e483(0x232)];_0x3fc2dd++){_0x52fb20+=_0x443171[_0x3fc2dd]*_0x35df07[_0x3fc2dd],_0x3e6133+=_0x443171[_0x3fc2dd]*_0x443171[_0x3fc2dd],_0x212cf9+=_0x35df07[_0x3fc2dd]*_0x35df07[_0x3fc2dd];}const _0x24b219=Math['sqrt'](_0x3e6133)*Math[_0x37e483(0x21a)](_0x212cf9);return _0x24b219===0x0?0x0:_0x52fb20/_0x24b219;}return flat;}var writerLock,hasRequiredWriterLock;function requireWriterLock(){if(hasRequiredWriterLock)return writerLock;hasRequiredWriterLock=0x1;const _0x4a23cf=require$$0,_0x3dcb7f=require$$1,_0x2f0cb6=require$$3;return writerLock=function _0x2756b8(_0x14eb2f,{maxAgeMs:maxAgeMs=0x3a98,heartbeatMs:heartbeatMs=0x1388,onLost:onLost=null}={}){const _0xfe2552=_0x5717,_0x2165bf=_0x3dcb7f[_0xfe2552(0x20e)](_0x14eb2f,_0xfe2552(0x1da)),_0x57bb3b=_0x2f0cb6[_0xfe2552(0x1eb)](0x8)[_0xfe2552(0x172)](_0xfe2552(0x1e8));let _0x5b47a6=![],_0x1b747c=null;const _0x32b7dd=()=>JSON[_0xfe2552(0x200)]({'pid':process['pid'],'token':_0x57bb3b,'at':Date[_0xfe2552(0x17a)]()});function _0x340934(){const _0xb5c59d=_0xfe2552;try{return JSON[_0xb5c59d(0x1c4)](_0x4a23cf[_0xb5c59d(0x1d1)](_0x2165bf,_0xb5c59d(0x17f)));}catch(_0x445b55){return _0x445b55?.['code']===_0xb5c59d(0x17d)?null:{'unreadable':!![]};}}function _0x90ce6f(){const _0x5f408b=_0xfe2552;try{const _0x39994e=_0x4a23cf[_0x5f408b(0x1d2)](_0x2165bf,'wx');try{_0x4a23cf['writeFileSync'](_0x39994e,_0x32b7dd());}finally{_0x4a23cf['closeSync'](_0x39994e);}return!![];}catch(_0x221cef){if(_0x221cef?.[_0x5f408b(0x1a0)]===_0x5f408b(0x1a7))return![];throw _0x221cef;}}function _0x524aeb(_0x2229c0){const _0x46a5d4=_0xfe2552;if(!_0x2229c0)return!![];if(_0x2229c0[_0x46a5d4(0x1b9)])return!![];return Date[_0x46a5d4(0x17a)]()-(_0x2229c0['at']??0x0)>=maxAgeMs;}function _0x284f2c(){if(_0x1b747c)clearInterval(_0x1b747c);_0x1b747c=null;}function _0x3e0064(){_0x284f2c(),_0x1b747c=setInterval(()=>{const _0x572108=_0x5717,_0xa017e2=_0x340934();if(_0xa017e2&&!_0xa017e2[_0x572108(0x1b9)]&&_0xa017e2['token']!==_0x57bb3b){_0x5b47a6=![],_0x284f2c();try{onLost?.();}catch{}return;}try{_0x4a23cf['writeFileSync'](_0x2165bf,_0x32b7dd());}catch{}},heartbeatMs),_0x1b747c['unref']?.();}function _0x58cf82(){const _0x45d294=_0x340934();return!!_0x45d294&&_0x45d294['token']===_0x57bb3b;}return{'path':_0x2165bf,'token':_0x57bb3b,'acquire'(){const _0x1895e9=_0xfe2552,_0x1749dd=_0x340934();if(_0x1749dd&&_0x1749dd['token']===_0x57bb3b){_0x5b47a6=!![];if(!_0x1b747c)_0x3e0064();return!![];}let _0x35daa5=_0x90ce6f();if(!_0x35daa5&&_0x524aeb(_0x340934())){try{_0x4a23cf[_0x1895e9(0x1e2)](_0x2165bf);}catch{}_0x35daa5=_0x90ce6f();}if(_0x35daa5&&!_0x58cf82())_0x35daa5=![];_0x5b47a6=_0x35daa5;if(_0x35daa5)_0x3e0064();return _0x35daa5;},'held'(){return _0x5b47a6;},'isFree'(){const _0x200d63=_0xfe2552,_0x2b4599=_0x340934();if(_0x2b4599&&_0x2b4599[_0x200d63(0x1bb)]===_0x57bb3b)return![];return _0x524aeb(_0x2b4599);},'release'(){const _0x2855ac=_0xfe2552;_0x284f2c();if(!_0x5b47a6)return;_0x5b47a6=![];if(_0x58cf82())try{_0x4a23cf[_0x2855ac(0x1e2)](_0x2165bf);}catch{}}};},writerLock;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x188e02=require$$0,_0x29bfac=requireSnapshotStore(),_0x5ce840=requireLabelMap(),_0x4db71e=requireWriterLock(),{fingerprint:_0x4cb014,reconcileIndex:_0x4b1132}=requireIndexConvergence(),_0xd937b7=0x1;let _0x3574d0=null;function _0x2d78e9(){const _0x5a1a53=_0x5717;if(_0x3574d0)return _0x3574d0;try{return _0x3574d0=require('usearch'),_0x3574d0;}catch(_0x3ccb77){const _0x547baf=new Error(_0x5a1a53(0x182)+(_0x5a1a53(0x18d)+process[_0x5a1a53(0x214)]['node']+_0x5a1a53(0x1fb)+process[_0x5a1a53(0x229)]+'/'+process['arch']+'.\x20')+_0x5a1a53(0x1cd)+('Original\x20error:\x20'+(_0x3ccb77?.[_0x5a1a53(0x19d)]||String(_0x3ccb77))));_0x547baf[_0x5a1a53(0x1a0)]='USEARCH_BINDINGS_UNAVAILABLE',_0x547baf['cause']=_0x3ccb77;throw _0x547baf;}}function _0x325064(_0x3006fb,_0x545faf){const _0x3b351f=_0x5717;switch(_0x3006fb){case _0x3b351f(0x1d9):return _0x545faf[_0x3b351f(0x211)]['Cos'];case'l2':return _0x545faf['MetricKind']['L2sq'];case'ip':return _0x545faf[_0x3b351f(0x211)]['IP'];default:return _0x545faf[_0x3b351f(0x211)][_0x3b351f(0x22e)];}}return usearch=function _0x3025d0(_0x3e9b76={},{dims:_0x39ca96,dir:_0x3a7e15,fetchAll:fetchAll=null,onChange:onChange=null}={}){const _0x16c739=_0x5717,_0x441028=_0x2d78e9();if(!_0x39ca96||_0x39ca96<=0x0)throw new Error('usearch\x20algorithm\x20requires\x20dims\x20>\x200');if(!_0x3a7e15)throw new Error('usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage');const _0x2098a0={'metric':_0x3e9b76['metric']??'cosine','connectivity':_0x3e9b76[_0x16c739(0x1db)]??0x10,'expansionAdd':_0x3e9b76[_0x16c739(0x1c3)]??0x80,'expansionSearch':_0x3e9b76['expansionSearch']??0x40,'snapshotEveryChanges':_0x3e9b76[_0x16c739(0x19a)]??0xc350,'snapshotMaxLagMs':_0x3e9b76['snapshotMaxLagMs']??0x2710,'keepSnapshots':_0x3e9b76['keepSnapshots']??0x2,'tmpMaxAgeMs':_0x3e9b76['tmpMaxAgeMs']??0x6*0x36ee80,'heartbeatIntervalMs':_0x3e9b76[_0x16c739(0x223)]??0x1388,'writerLockMaxAgeMs':_0x3e9b76['writerLockMaxAgeMs']??0x3a98,'viewRefreshMs':_0x3e9b76['viewRefreshMs']??0x3e8},_0x114387=new _0x29bfac({'dir':_0x3a7e15,'keepSnapshots':_0x2098a0[_0x16c739(0x181)]}),_0x495aff=_0x4db71e(_0x3a7e15,{'maxAgeMs':_0x2098a0[_0x16c739(0x1f6)],'heartbeatMs':_0x2098a0[_0x16c739(0x223)],'onLost':()=>{const _0x5b6b39=_0x16c739;_0x3571ac(_0x2235e7)[_0x5b6b39(0x1bd)](()=>{});}});let _0x3687b1=new _0x5ce840(),_0x234e36=null,_0x2d0049=0x0,_0xb6d3d3=null,_0x509561=![],_0x41a7b7=![],_0x81c4b5=null,_0x5e7c0b=0x0,_0x397d12=null,_0x48f2a5=0x0,_0x2b61dd=![],_0x1cfed5=Promise[_0x16c739(0x169)]();const _0x3571ac=_0x4f6a37=>{const _0x34197e=_0x16c739,_0x19a7b7=_0x1cfed5[_0x34197e(0x1b5)](_0x4f6a37);return _0x1cfed5=_0x19a7b7[_0x34197e(0x1bd)](()=>{}),_0x19a7b7;},_0x477821=()=>{try{onChange?.();}catch{}};function _0x333503(){const _0x2c58f8=_0x16c739;return new _0x441028[(_0x2c58f8(0x1b7))]({'dimensions':_0x39ca96,'metric':_0x325064(_0x2098a0[_0x2c58f8(0x21b)],_0x441028),'quantization':_0x441028[_0x2c58f8(0x23b)]['F32'],'connectivity':_0x2098a0['connectivity'],'expansion_add':_0x2098a0[_0x2c58f8(0x1c3)],'expansion_search':_0x2098a0[_0x2c58f8(0x215)],'multi':![]});}function _0x546ab5(_0x357f5f){return _0x357f5f instanceof Float32Array?_0x357f5f:new Float32Array(_0x357f5f);}function _0x27164a(){if(fetchAll)return fetchAll();if(_0xb6d3d3)return _0xb6d3d3();return Promise['resolve'](null);}function _0x4ccb38(_0x47ee10,_0x23ba1c,_0x53ef78){const _0x13ca61=_0x16c739,_0x472320=_0x3687b1[_0x13ca61(0x188)](_0x47ee10);if(_0x472320!==undefined)try{_0x234e36[_0x13ca61(0x174)](BigInt(_0x472320));}catch{}const _0x5826a2=_0x3687b1[_0x13ca61(0x216)](_0x47ee10);_0x234e36['add'](BigInt(_0x5826a2),_0x23ba1c),_0x3687b1[_0x13ca61(0x16d)](_0x47ee10,_0x53ef78??_0x4cb014(_0x23ba1c));}function _0x56422f(_0x1187b3){const _0xedc47=_0x16c739,_0x1c3126=_0x3687b1[_0xedc47(0x188)](_0x1187b3);if(_0x1c3126===undefined)return![];try{_0x234e36[_0xedc47(0x174)](BigInt(_0x1c3126));}catch{}return _0x3687b1['tombstone'](_0x1187b3),!![];}function _0x13285f(_0x4d66d8){const _0x44dca9=_0x16c739;_0x3687b1=new _0x5ce840(),_0x234e36=_0x333503();for(const {key:_0x2b74ad,vector:_0x1da19d}of _0x4d66d8??[]){if(!(_0x1da19d instanceof Float32Array)||_0x1da19d[_0x44dca9(0x232)]!==_0x39ca96)continue;_0x4ccb38(_0x2b74ad,_0x1da19d);}_0x2d0049=0x0;}function _0x3d7856(){const _0x382819=_0x16c739;return Math['max'](Date[_0x382819(0x17a)](),_0x114387[_0x382819(0x217)]()+0x1);}function _0x33143b(){if(_0x81c4b5)clearTimeout(_0x81c4b5);_0x81c4b5=null;}function _0x293e8a(){const _0x45a7e1=_0x16c739;if(!_0x2098a0['snapshotMaxLagMs']||_0x81c4b5||!_0x41a7b7||_0x2d0049<=0x0)return;const _0x30e615=Math[_0x45a7e1(0x222)](_0x2098a0[_0x45a7e1(0x179)],0xa*_0x5e7c0b);_0x81c4b5=setTimeout(()=>{const _0x6de410=_0x45a7e1;_0x81c4b5=null,_0x3571ac(async()=>{if(_0x41a7b7&&_0x2d0049>0x0)await _0x12d40c();_0x293e8a(),_0x477821();})[_0x6de410(0x1bd)](()=>{});},_0x30e615),_0x81c4b5[_0x45a7e1(0x226)]?.();}async function _0x12d40c(_0x3f369d){const _0x2cb75d=_0x16c739;if(!_0x234e36)return![];const _0x1a66aa=_0x3f369d??_0x3d7856(),_0x44dc9d=Date[_0x2cb75d(0x17a)](),_0x121585=await _0x114387[_0x2cb75d(0x17e)](_0x1a66aa,async _0x4912fb=>{const _0x311851=_0x2cb75d;_0x234e36['save'](_0x4912fb[_0x311851(0x221)]),await _0x3687b1['snapshotTo'](_0x4912fb[_0x311851(0x227)]),_0x188e02[_0x311851(0x238)](_0x4912fb[_0x311851(0x1e4)],JSON[_0x311851(0x200)]({'manifestVersion':_0xd937b7,'algorithm':'usearch','dims':_0x39ca96,'metric':_0x2098a0[_0x311851(0x21b)],'clock':_0x1a66aa,'snapshotAt':Date['now']()},null,0x2));},{'keep':_0x2098a0[_0x2cb75d(0x181)]});return _0x5e7c0b=Date[_0x2cb75d(0x17a)]()-_0x44dc9d,_0x121585?.[_0x2cb75d(0x1c5)]&&(_0x2d0049=0x0,_0x33143b()),_0x121585?.[_0x2cb75d(0x1c5)]??![];}function _0x4b8e9a(){const _0xcbba8c=_0x16c739;_0x2d0049++;if(_0x2d0049>=_0x2098a0[_0xcbba8c(0x19a)])return _0x12d40c();return _0x293e8a(),null;}async function _0x378db3(){const _0x25393f=_0x16c739,_0x504578=_0x114387[_0x25393f(0x1b6)]()||_0x114387['latestSnapshotId']();if(!_0x504578)return null;let _0xe07b1f,_0x5eea38=![];try{await _0x114387[_0x25393f(0x1e0)](_0x504578,async _0x28e1ec=>{const _0x3b47e5=_0x25393f;_0xe07b1f=JSON[_0x3b47e5(0x1c4)](_0x188e02['readFileSync'](_0x28e1ec[_0x3b47e5(0x1e4)],_0x3b47e5(0x17f)));if(_0xe07b1f['manifestVersion']!==_0xd937b7||_0xe07b1f[_0x3b47e5(0x205)]!==_0x3b47e5(0x184)||_0xe07b1f[_0x3b47e5(0x233)]!==_0x39ca96||_0xe07b1f['metric']!==_0x2098a0[_0x3b47e5(0x21b)]){_0xe07b1f=null;return;}const _0x5964ef=new _0x5ce840();await _0x5964ef['loadFrom'](_0x28e1ec['labels']);const _0x452afd=_0x333503();_0x452afd[_0x3b47e5(0x20b)](_0x28e1ec[_0x3b47e5(0x221)]),_0x3687b1=_0x5964ef,_0x234e36=_0x452afd,_0x5eea38=!![];});}catch{return null;}return _0x5eea38?_0xe07b1f?.[_0x25393f(0x19e)]??0x0:null;}async function _0x2b10b9(_0x3eb011){const _0x220a8a=_0x16c739;_0x397d12=null;const _0x1e7278=await _0x378db3();if(_0x1e7278!=null){_0x2d0049=0x0;if(_0x3eb011){if(!_0x3687b1[_0x220a8a(0x1d4)])return _0x13285f(_0x3eb011),await _0x12d40c(),null;const _0x5a5689=_0x4b1132(_0x3687b1,_0x3eb011,_0x39ca96,{'upsert':_0x4ccb38,'remove':_0x56422f}),_0x2d29b2=_0x5a5689[_0x220a8a(0x193)]+_0x5a5689['changed']+_0x5a5689[_0x220a8a(0x236)];_0x2d29b2>0x0&&(_0x2d0049+=_0x2d29b2,await _0x12d40c());}return _0x1e7278;}_0x13285f(_0x3eb011??[]);if(_0x234e36[_0x220a8a(0x201)]()>0x0)await _0x12d40c();return null;}async function _0x252b54(){_0x41a7b7=!![],await _0x2b10b9(await _0x27164a());}async function _0x2235e7(){if(!_0x41a7b7)return;_0x41a7b7=![],_0x33143b(),_0x2d0049=0x0;const _0x3403f1=_0x114387['readCurrentId']()||_0x114387['latestSnapshotId']();await _0x48c768(_0x3403f1),_0x477821();}async function _0x48c768(_0x4760c1){const _0x470a06=_0x16c739;if(!_0x4760c1)return![];let _0x432bfb=![];try{await _0x114387[_0x470a06(0x1e0)](_0x4760c1,async _0x2724cc=>{const _0x128c1f=_0x470a06,_0x2cd90f=JSON[_0x128c1f(0x1c4)](_0x188e02[_0x128c1f(0x1d1)](_0x2724cc[_0x128c1f(0x1e4)],_0x128c1f(0x17f)));if(_0x2cd90f[_0x128c1f(0x1f8)]!==_0xd937b7||_0x2cd90f['algorithm']!=='usearch'||_0x2cd90f[_0x128c1f(0x233)]!==_0x39ca96||_0x2cd90f[_0x128c1f(0x21b)]!==_0x2098a0[_0x128c1f(0x21b)])return;const _0x2640e4=new _0x5ce840();await _0x2640e4['loadFrom'](_0x2724cc[_0x128c1f(0x227)]);const _0x191745=_0x333503();_0x191745[_0x128c1f(0x207)](_0x2724cc[_0x128c1f(0x221)]),_0x234e36=_0x191745,_0x3687b1=_0x2640e4,_0x397d12=_0x4760c1,_0x432bfb=!![];});}catch{}return _0x432bfb;}function _0x3ef21d(){const _0x2a0780=_0x16c739,_0x295b6f=Date[_0x2a0780(0x17a)]();if(_0x295b6f-_0x48f2a5<_0x2098a0[_0x2a0780(0x22f)])return;_0x48f2a5=_0x295b6f;if(_0x2b61dd)return;if(_0x495aff[_0x2a0780(0x218)]()){_0x2b61dd=!![],_0x3571ac(async()=>{const _0xf8924c=_0x2a0780;!_0x41a7b7&&_0x509561&&_0x495aff[_0xf8924c(0x1cf)]()&&(await _0x252b54(),_0x477821());})['catch'](()=>{})[_0x2a0780(0x19c)](()=>{_0x2b61dd=![];});return;}const _0x282601=_0x114387[_0x2a0780(0x1b6)]()||_0x114387[_0x2a0780(0x1cc)]();if(!_0x282601||_0x282601===_0x397d12)return;_0x2b61dd=!![],_0x3571ac(async()=>{if(!_0x41a7b7&&await _0x48c768(_0x282601))_0x477821();})[_0x2a0780(0x1bd)](()=>{})[_0x2a0780(0x19c)](()=>{_0x2b61dd=![];});}return{async 'load'(_0x6ede51){return _0x3571ac(async()=>{const _0x1fe31b=_0x5717;_0x114387[_0x1fe31b(0x1d3)]({'maxAgeMs':_0x2098a0['tmpMaxAgeMs']}),_0xb6d3d3=_0x6ede51??null,_0x41a7b7=_0x495aff[_0x1fe31b(0x1cf)]();let _0x439ec4=null;if(_0x41a7b7)_0x439ec4=await _0x2b10b9(_0x6ede51?await _0x6ede51():null);else{const _0x19dc71=_0x114387[_0x1fe31b(0x1b6)]()||_0x114387[_0x1fe31b(0x1cc)]();await _0x48c768(_0x19dc71);}return _0x509561=!![],_0x439ec4;});},async 'add'(_0x44be87,_0x2cf90a,_0x4a7b34){return _0x3571ac(async()=>{const _0xe06931=_0x5717;if(!_0x509561)return;const _0x3c20f4=_0x546ab5(_0x2cf90a);if(!_0x41a7b7){if(!_0x495aff[_0xe06931(0x1cf)]())return;await _0x252b54();}if(!_0x234e36)return;const _0x47a6fb=_0x4cb014(_0x3c20f4);if(_0x3687b1[_0xe06931(0x1a9)](_0x44be87)===_0x47a6fb)return;_0x4ccb38(_0x44be87,_0x3c20f4,_0x47a6fb),await _0x4b8e9a();});},async 'remove'(_0x3bdf44){return _0x3571ac(async()=>{const _0x6ee5fe=_0x5717;if(!_0x509561)return;if(!_0x41a7b7){if(!_0x495aff[_0x6ee5fe(0x1cf)]())return;await _0x252b54();}if(!_0x234e36)return;if(_0x56422f(_0x3bdf44))await _0x4b8e9a();});},'search'(_0x2ee448,{limit:limit=0xa}={}){const _0x2277e1=_0x16c739;if(!_0x41a7b7&&_0x509561)_0x3ef21d();if(!_0x234e36)return[];const _0x13ac07=_0x234e36[_0x2277e1(0x201)]();if(_0x13ac07===0x0)return[];const _0x1c090f=Math[_0x2277e1(0x1bf)](limit,_0x13ac07),_0x4cb84d=_0x234e36[_0x2277e1(0x203)](_0x546ab5(_0x2ee448),_0x1c090f,0x0),_0x43d5c5=[],_0x5cf998=_0x4cb84d[_0x2277e1(0x195)],_0x5b9bd9=_0x4cb84d[_0x2277e1(0x22d)];for(let _0x112706=0x0;_0x112706<_0x5cf998[_0x2277e1(0x232)];_0x112706++){const _0x2999ae=_0x5cf998[_0x112706];if(_0x2999ae===0xffffffffffffffffn)continue;const _0x56311e=Number(_0x2999ae),_0x5b1061=_0x3687b1[_0x2277e1(0x1fd)](_0x56311e);if(!_0x5b1061)continue;const _0x12c4e5=_0x5b9bd9[_0x112706];let _0x2938e5;if(_0x2098a0['metric']==='cosine')_0x2938e5=Math[_0x2277e1(0x222)](0x0,0x1-_0x12c4e5);else{if(_0x2098a0['metric']==='ip')_0x2938e5=-_0x12c4e5;else _0x2938e5=0x1/(0x1+_0x12c4e5);}_0x43d5c5[_0x2277e1(0x212)]({'key':_0x5b1061,'score':_0x2938e5});}return _0x43d5c5;},async 'snapshot'(_0x25d46c){return _0x3571ac(()=>_0x41a7b7?_0x12d40c(_0x25d46c??undefined):![]);},async 'rebuild'(_0x434e1f){return _0x3571ac(async()=>{const _0x140320=_0x5717;if(_0x434e1f!=null)_0xb6d3d3=_0x434e1f;if(!_0x41a7b7){if(!_0x495aff[_0x140320(0x1cf)]())return;_0x41a7b7=!![];}const _0x2d0158=_0x434e1f?await _0x434e1f():await _0x27164a();_0x13285f(_0x2d0158??[]),_0x509561=!![],await _0x12d40c();});},async 'stop'(){return _0x3571ac(async()=>{const _0x18c3f3=_0x5717;_0x33143b();if(_0x41a7b7){if(_0x2d0049>0x0||!_0x114387[_0x18c3f3(0x1b6)]())await _0x12d40c();_0x495aff[_0x18c3f3(0x1fa)]();}_0x41a7b7=![],_0x509561=![];});},'count'(){return _0x3687b1['size']();},'info'(){const _0x2b8941=_0x16c739;return{'algorithm':_0x2b8941(0x184),'role':_0x41a7b7?_0x2b8941(0x19b):_0x2b8941(0x16e),'metric':_0x2098a0[_0x2b8941(0x21b)],'connectivity':_0x2098a0[_0x2b8941(0x1db)],'expansionAdd':_0x2098a0['expansionAdd'],'expansionSearch':_0x2098a0[_0x2b8941(0x215)],'snapshotEveryChanges':_0x2098a0[_0x2b8941(0x19a)],'snapshotMaxLagMs':_0x2098a0[_0x2b8941(0x179)],'count':_0x3687b1[_0x2b8941(0x201)](),'size':_0x234e36?.[_0x2b8941(0x201)]?.()??0x0,'capacity':_0x234e36?.[_0x2b8941(0x1f2)]?.()??0x0,'changesSince':_0x41a7b7?_0x2d0049:null,'viewedSnapshot':_0x397d12??null,'snapshotDir':_0x3a7e15,'latestSnapshot':_0x114387[_0x2b8941(0x1b6)]()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0x1929bc=_0x5717;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x169156,workerData:_0x24ec54}=require$$0$1,{algorithmName:_0x125829,algorithmConfig:_0x3c3bb3,dims:_0x162de7,dir:_0x41944d}=_0x24ec54;let _0x1484ea=0x1;const _0x15e9bc=new Map();function _0x27299f(){const _0x5541a3=_0x1484ea++;return new Promise((_0xa4e217,_0xa0673d)=>{const _0x489c2a=_0x5717;_0x15e9bc[_0x489c2a(0x225)](_0x5541a3,{'resolve':_0xa4e217,'reject':_0xa0673d}),_0x169156[_0x489c2a(0x18f)]({'op':_0x489c2a(0x209),'fid':_0x5541a3});});}const _0x1d0bb1={'dims':_0x162de7,'dir':_0x41944d,'fetchAll':_0x27299f,'onChange':()=>_0x1aeeb1()};let _0x54a9f6;if(_0x125829===_0x1929bc(0x1f9))_0x54a9f6=requireHnsw()(_0x3c3bb3,_0x1d0bb1);else{if(_0x125829===_0x1929bc(0x173))_0x54a9f6=requireFlat()(_0x3c3bb3,_0x1d0bb1);else{if(_0x125829===_0x1929bc(0x184))_0x54a9f6=requireUsearch()(_0x3c3bb3,_0x1d0bb1);else throw new Error(_0x1929bc(0x1e7)+_0x125829+'\x22');}}function _0x1aeeb1(){const _0x5c3b38=_0x1929bc;try{_0x169156['postMessage']({'op':'sync','count':_0x54a9f6[_0x5c3b38(0x1ea)](),'info':_0x54a9f6[_0x5c3b38(0x1d0)](),'memory':process['memoryUsage']()});}catch{}}function _0x278527(_0x22b399){const _0x6292f5=_0x1929bc;return(_0x22b399||[])['map'](_0x142fc4=>({'key':_0x142fc4[_0x6292f5(0x194)],'vector':_0x142fc4[_0x6292f5(0x18a)]instanceof Float32Array?_0x142fc4['vector']:new Float32Array(_0x142fc4['vector'])}));}return _0x169156['on'](_0x1929bc(0x19d),async _0x276a6d=>{const _0x10e805=_0x1929bc;if(_0x276a6d['op']===_0x10e805(0x16c)){const _0xf3682a=_0x15e9bc[_0x10e805(0x23e)](_0x276a6d[_0x10e805(0x178)]);if(!_0xf3682a)return;_0x15e9bc[_0x10e805(0x175)](_0x276a6d[_0x10e805(0x178)]);if(_0x276a6d[_0x10e805(0x208)])_0xf3682a[_0x10e805(0x1ce)](new Error(_0x276a6d['error']));else _0xf3682a[_0x10e805(0x169)](_0x278527(_0x276a6d[_0x10e805(0x1c7)]));return;}const {id:_0x22bb54,op:_0x44a6cd,args:_0x189a6d}=_0x276a6d;try{let _0x304606;switch(_0x44a6cd){case _0x10e805(0x20b):{_0x304606=await _0x54a9f6[_0x10e805(0x20b)](_0x189a6d['hasRows']?_0x27299f:null),_0x1aeeb1();break;}case _0x10e805(0x1a8):{const _0x4e826d=_0x189a6d[_0x10e805(0x18a)]instanceof Float32Array?_0x189a6d['vector']:new Float32Array(_0x189a6d['vector']);await _0x54a9f6[_0x10e805(0x1a8)](_0x189a6d['key'],_0x4e826d,_0x189a6d['clock']??undefined),_0x1aeeb1(),_0x304606=null;break;}case'remove':{await _0x54a9f6[_0x10e805(0x174)](_0x189a6d[_0x10e805(0x194)]),_0x1aeeb1(),_0x304606=null;break;}case'search':{const _0x113a56=_0x189a6d['queryVec']instanceof Float32Array?_0x189a6d[_0x10e805(0x171)]:new Float32Array(_0x189a6d[_0x10e805(0x171)]);_0x304606=_0x54a9f6[_0x10e805(0x203)](_0x113a56,_0x189a6d[_0x10e805(0x1ae)]||{});break;}case'snapshot':{_0x304606=await _0x54a9f6[_0x10e805(0x1b4)](_0x189a6d['clock']),_0x1aeeb1();break;}case _0x10e805(0x1ad):{const _0x3e62cf=_0x278527(_0x189a6d[_0x10e805(0x1c7)]);await _0x54a9f6[_0x10e805(0x1ad)](async()=>_0x3e62cf),_0x1aeeb1(),_0x304606=null;break;}case _0x10e805(0x231):{await _0x54a9f6['stop'](),_0x1aeeb1(),_0x304606=null;break;}case _0x10e805(0x1ea):{_0x304606=_0x54a9f6[_0x10e805(0x1ea)]();break;}case'info':{_0x304606=_0x54a9f6[_0x10e805(0x1d0)]();break;}default:throw new Error(_0x10e805(0x183)+_0x44a6cd+'\x22');}_0x169156[_0x10e805(0x18f)]({'id':_0x22bb54,'result':_0x304606});}catch(_0x3325d3){_0x169156['postMessage']({'id':_0x22bb54,'error':{'message':_0x3325d3?.[_0x10e805(0x19d)]||String(_0x3325d3),'code':_0x3325d3?.[_0x10e805(0x1a0)]}});}}),_0x169156[_0x1929bc(0x18f)]({'op':_0x1929bc(0x1b0)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module[_0x5db5a4(0x23c)]=algorithmWorkerThread;
|
|
1
|
+
'use strict';const _0x35f0f1=_0xe4ae;(function(_0x30755a,_0x5ede62){const _0x16725e=_0xe4ae,_0x631c00=_0x30755a();while(!![]){try{const _0x1e48e0=parseInt(_0x16725e(0x105))/0x1+parseInt(_0x16725e(0x121))/0x2+-parseInt(_0x16725e(0x168))/0x3*(-parseInt(_0x16725e(0xea))/0x4)+-parseInt(_0x16725e(0xce))/0x5+-parseInt(_0x16725e(0xd8))/0x6+parseInt(_0x16725e(0x13c))/0x7*(-parseInt(_0x16725e(0x135))/0x8)+-parseInt(_0x16725e(0x17f))/0x9;if(_0x1e48e0===_0x5ede62)break;else _0x631c00['push'](_0x631c00['shift']());}catch(_0x306270){_0x631c00['push'](_0x631c00['shift']());}}}(_0x2ae0,0x261a3));var require$$0$1=require(_0x35f0f1(0x12e)),require$$0=require('fs'),require$$1=require('path'),require$$2=require('os'),require$$3=require(_0x35f0f1(0x134));function getDefaultExportFromCjs(_0x1238e8){const _0x2b31e7=_0x35f0f1;return _0x1238e8&&_0x1238e8[_0x2b31e7(0x173)]&&Object[_0x2b31e7(0xe7)][_0x2b31e7(0xcc)][_0x2b31e7(0x186)](_0x1238e8,'default')?_0x1238e8['default']:_0x1238e8;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x4c698c=_0x35f0f1;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x58e704=require$$0,_0x437133=require$$1,_0x197b0b=require$$2,_0xb99a1b=require$$3;function _0x2b5ba5(){const _0x60dc56=_0xe4ae;return Date[_0x60dc56(0x113)]();}function _0xc27ee(_0x50d91d){const _0x284599=_0xe4ae;try{return _0x58e704[_0x284599(0x112)](_0x50d91d);}catch{return![];}}function _0x44add9(_0x3ba4a8){try{return _0x58e704['readFileSync'](_0x3ba4a8,'utf8');}catch{return null;}}function _0x2f58c8(_0x1e630b,_0x48ee6a){const _0x15a4ee=_0xe4ae,_0x288f70=_0x1e630b+'.tmp-'+_0xb99a1b[_0x15a4ee(0x106)](0x6)['toString'](_0x15a4ee(0x146));_0x58e704[_0x15a4ee(0x170)](_0x288f70,_0x48ee6a),_0x58e704[_0x15a4ee(0xeb)](_0x288f70,_0x1e630b);}function _0x27b57b(_0x2d6224,_0x465b8c=0x10){const _0x21831b=_0xe4ae,_0xd31589=String(Math[_0x21831b(0x172)](0x0,Math[_0x21831b(0xf1)](_0x2d6224||0x0)));return _0xd31589[_0x21831b(0x163)]>=_0x465b8c?_0xd31589:'0'[_0x21831b(0x10a)](_0x465b8c-_0xd31589[_0x21831b(0x163)])+_0xd31589;}return snapshotStore=class _0x526aa8{constructor({dir:_0x8f4abd,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x51d848=_0xe4ae;if(!_0x8f4abd)throw new Error('SnapshotStore\x20requires\x20dir');this[_0x51d848(0x182)]=_0x8f4abd,this[_0x51d848(0x132)]=_0x437133[_0x51d848(0x18f)](_0x8f4abd,_0x51d848(0xd9)),this['currentPath']=_0x437133[_0x51d848(0x18f)](_0x8f4abd,_0x51d848(0xdf)),this[_0x51d848(0x12c)]=_0x437133[_0x51d848(0x18f)](_0x8f4abd,_0x51d848(0xd5)),this['keepSnapshots']=keepSnapshots,this['log']=log,_0x58e704[_0x51d848(0xef)](this[_0x51d848(0x182)],{'recursive':!![]}),_0x58e704[_0x51d848(0xef)](this['snapshotsDir'],{'recursive':!![]});}['_snapshotDir'](_0x455e8e){const _0x17d5a5=_0xe4ae;return _0x437133[_0x17d5a5(0x18f)](this[_0x17d5a5(0x132)],_0x455e8e);}[_0x4c698c(0x117)](_0x2da1ce){const _0x339a26=_0x4c698c,_0x47196c=this[_0x339a26(0xcd)](_0x2da1ce);return{'dir':_0x47196c,'index':_0x437133[_0x339a26(0x18f)](_0x47196c,_0x339a26(0xed)),'labels':_0x437133[_0x339a26(0x18f)](_0x47196c,_0x339a26(0xd2)),'state':_0x437133[_0x339a26(0x18f)](_0x47196c,_0x339a26(0x177))};}[_0x4c698c(0x197)](){const _0x306b14=_0x4c698c;if(!_0xc27ee(this[_0x306b14(0x119)]))return null;const _0x254c55=_0x44add9(this[_0x306b14(0x119)]);if(!_0x254c55)return null;const _0x4d6332=String(_0x254c55)[_0x306b14(0x152)]();return _0x4d6332||null;}[_0x4c698c(0x138)](){const _0x3c34da=_0x4c698c,_0x49cc90=this['readCurrentId']();if(!_0x49cc90)return 0x0;const _0xf0c75f=Number(_0x49cc90);return Number[_0x3c34da(0xe9)](_0xf0c75f)?_0xf0c75f:0x0;}[_0x4c698c(0x15d)](){const _0x6e9b0b=_0x4c698c;try{return _0x58e704['readdirSync'](this['snapshotsDir'],{'withFileTypes':!![]})[_0x6e9b0b(0x159)](_0x31fc30=>_0x31fc30['isDirectory']())[_0x6e9b0b(0x193)](_0x8543f6=>_0x8543f6[_0x6e9b0b(0x16b)])[_0x6e9b0b(0x159)](_0x2db6b2=>!_0x2db6b2[_0x6e9b0b(0x196)](_0x6e9b0b(0x180)))[_0x6e9b0b(0x159)](_0x487b42=>!_0x487b42[_0x6e9b0b(0x196)](_0x6e9b0b(0x15b)))[_0x6e9b0b(0x187)]();}catch{return[];}}['latestSnapshotId'](){const _0x34c806=_0x4c698c,_0x43827a=this['readCurrentId']();if(_0x43827a)return _0x43827a;const _0x12c459=this[_0x34c806(0x15d)]();if(!_0x12c459['length'])return null;return _0x12c459[_0x12c459[_0x34c806(0x163)]-0x1];}[_0x4c698c(0xc6)]({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x10a44a=_0x4c698c;let _0x55afea;try{_0x55afea=_0x58e704['readdirSync'](this[_0x10a44a(0x132)],{'withFileTypes':!![]});}catch{return;}const _0x685168=_0x2b5ba5()-maxAgeMs;for(const _0x3c44e9 of _0x55afea){if(!_0x3c44e9[_0x10a44a(0x169)]())continue;const _0x381f38=_0x3c44e9['name'];if(!_0x381f38[_0x10a44a(0x196)](_0x10a44a(0x180))&&!_0x381f38[_0x10a44a(0x196)](_0x10a44a(0x15b)))continue;const _0x50b67d=_0x437133[_0x10a44a(0x18f)](this[_0x10a44a(0x132)],_0x381f38);try{const _0x35e296=_0x58e704[_0x10a44a(0x122)](_0x50b67d);if(_0x35e296[_0x10a44a(0xec)]>_0x685168)continue;}catch{}try{_0x58e704[_0x10a44a(0x126)](_0x50b67d,{'recursive':!![],'force':!![]});}catch{}}}[_0x4c698c(0x156)]({keep:keep=null}={}){const _0x2a9f8a=_0x4c698c,_0x5d0197=Math[_0x2a9f8a(0x172)](0x1,Math[_0x2a9f8a(0xf1)](keep??this[_0x2a9f8a(0x148)]??0x3)),_0x1a6672=this['listSnapshotIds']();if(_0x1a6672[_0x2a9f8a(0x163)]<=_0x5d0197)return;const _0x5917f7=this[_0x2a9f8a(0x197)](),_0x2e7921=_0x1a6672[_0x2a9f8a(0xd6)](0x0,Math[_0x2a9f8a(0x172)](0x0,_0x1a6672[_0x2a9f8a(0x163)]-_0x5d0197));for(const _0x5cb266 of _0x2e7921){if(_0x5917f7&&_0x5cb266===_0x5917f7)continue;const _0x42e94b=this[_0x2a9f8a(0xcd)](_0x5cb266);try{_0x58e704[_0x2a9f8a(0x126)](_0x42e94b,{'recursive':!![],'force':!![]});}catch{}}}async[_0x4c698c(0x19c)](_0x193765,_0x187939){const _0x2e7df9=_0x4c698c;if(!_0x193765)throw new Error(_0x2e7df9(0x129));const _0x56cc5c=this[_0x2e7df9(0x117)](_0x193765);if(!_0xc27ee(_0x56cc5c[_0x2e7df9(0x142)])||!_0xc27ee(_0x56cc5c[_0x2e7df9(0x16a)])||!_0xc27ee(_0x56cc5c[_0x2e7df9(0x157)]))throw new Error(_0x2e7df9(0x164)+_0x193765);const _0x160de3=await _0x187939(_0x56cc5c);return _0x160de3||{};}async[_0x4c698c(0x150)](_0x566ce4,_0x51dab7,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x188471=_0x4c698c,_0x3f1ead=Number(_0x566ce4);if(!Number[_0x188471(0xe9)](_0x3f1ead)||_0x3f1ead<0x0)throw new Error(_0x188471(0x174));const _0x51bef4=_0x27b57b(_0x3f1ead),_0x18c3a3=this[_0x188471(0xcd)](_0x51bef4),_0x1936f8=_0x437133[_0x188471(0x18f)](this[_0x188471(0x132)],_0x188471(0x180)+_0x51bef4+'-'+_0xb99a1b[_0x188471(0x106)](0x6)[_0x188471(0x108)](_0x188471(0x146)));_0x58e704['mkdirSync'](_0x1936f8,{'recursive':!![]});const _0x5724af={'dir':_0x1936f8,'index':_0x437133[_0x188471(0x18f)](_0x1936f8,_0x188471(0xed)),'labels':_0x437133['join'](_0x1936f8,_0x188471(0xd2)),'state':_0x437133[_0x188471(0x18f)](_0x1936f8,_0x188471(0x177))};await _0x51dab7(_0x5724af,{'id':_0x51bef4,'clock':_0x3f1ead});const _0xa2f651=JSON[_0x188471(0x124)]({'pid':process[_0x188471(0x162)],'host':_0x197b0b[_0x188471(0x107)](),'at':_0x2b5ba5()}),_0x3a1f01=_0x2b5ba5();let _0x10eca9=null;const _0x528401=()=>{const _0x2990ce=_0x188471;try{const _0x3bb19d=JSON[_0x2990ce(0xf0)](_0x58e704['readFileSync'](this['lockPath'],'utf8'));if(_0x3bb19d['at']&&_0x2b5ba5()-_0x3bb19d['at']>staleLockMaxAgeMs){const _0x208d9a=_0x2b5ba5()-_0x3bb19d['at'],_0x19b9be=_0x2990ce(0x179)+Math[_0x2990ce(0x16c)](_0x208d9a/0x3e8)+_0x2990ce(0x17a)+_0x3bb19d[_0x2990ce(0x162)]+',\x20host:\x20'+_0x3bb19d['host']+_0x2990ce(0xc9)+_0x2990ce(0xf7);this[_0x2990ce(0x131)]?.[_0x2990ce(0xe6)]?this[_0x2990ce(0x131)][_0x2990ce(0xe6)](_0x19b9be):console[_0x2990ce(0xe6)](_0x2990ce(0xde),_0x19b9be);try{_0x58e704[_0x2990ce(0x13b)](this[_0x2990ce(0x12c)]);}catch{}return!![];}}catch{try{_0x58e704['unlinkSync'](this[_0x2990ce(0x12c)]);}catch{}}return![];},_0x3e7563=()=>{const _0x5913d7=_0x188471;try{return _0x10eca9=_0x58e704[_0x5913d7(0x17c)](this['lockPath'],'wx'),_0x58e704[_0x5913d7(0x170)](_0x10eca9,_0xa2f651),!![];}catch(_0x242093){if(_0x242093&&_0x242093[_0x5913d7(0x10f)]==='EEXIST')return![];throw _0x242093;}};if(!_0x3e7563()){_0x528401(),_0x3e7563();if(_0x10eca9==null&&lockTimeoutMs>0x0)while(_0x2b5ba5()-_0x3a1f01<lockTimeoutMs){await new Promise(_0x41f94e=>setTimeout(_0x41f94e,0x19));if(_0x3e7563())break;_0x528401();}}if(_0x10eca9==null){try{_0x58e704['rmSync'](_0x1936f8,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x188471(0x145)};}try{const _0x421795=this[_0x188471(0x138)]();if(_0x3f1ead<=_0x421795){try{_0x58e704['rmSync'](_0x1936f8,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':'stale','currentClock':_0x421795};}if(!_0xc27ee(_0x18c3a3))_0x58e704['renameSync'](_0x1936f8,_0x18c3a3);else try{_0x58e704[_0x188471(0x126)](_0x1936f8,{'recursive':!![],'force':!![]});}catch{}return _0x2f58c8(this[_0x188471(0x119)],_0x51bef4+'\x0a'),this[_0x188471(0x156)]({'keep':keep}),{'published':!![],'currentClock':_0x3f1ead};}finally{try{_0x58e704[_0x188471(0x18b)](_0x10eca9);}catch{}try{_0x58e704[_0x188471(0x13b)](this[_0x188471(0x12c)]);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x575179=_0x35f0f1;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x17c1fa=require$$0;class _0x57b4a6{constructor(){const _0x8bc2ac=_0xe4ae;this[_0x8bc2ac(0x171)]=new Map(),this[_0x8bc2ac(0x133)]=new Map(),this[_0x8bc2ac(0xe4)]=0x0,this['_tombstoneCount']=0x0,this[_0x8bc2ac(0x188)]=new Map(),this['hasFingerprints']=!![];}async['reset'](){const _0x2057d9=_0xe4ae;this[_0x2057d9(0x171)]=new Map(),this[_0x2057d9(0x133)]=new Map(),this[_0x2057d9(0x188)]=new Map(),this[_0x2057d9(0x184)]=!![],this[_0x2057d9(0xe4)]=0x0,this[_0x2057d9(0x100)]=0x0;}async['loadFrom'](_0x24f500){const _0x7beedd=_0xe4ae;if(!_0x24f500||!_0x17c1fa[_0x7beedd(0x112)](_0x24f500))return await this[_0x7beedd(0x139)](),!![];let _0x2af32d;try{_0x2af32d=_0x17c1fa[_0x7beedd(0xfb)](_0x24f500,'utf8');}catch{return await this[_0x7beedd(0x139)](),!![];}let _0xd66840;try{_0xd66840=JSON[_0x7beedd(0xf0)](_0x2af32d);}catch{return await this[_0x7beedd(0x139)](),!![];}const _0x53bb79=Array[_0x7beedd(0x154)](_0xd66840?.[_0x7beedd(0xf5)])?_0xd66840[_0x7beedd(0xf5)]:[],_0x26a3c8=Number['isInteger'](_0xd66840?.[_0x7beedd(0xe4)])?_0xd66840['nextLabel']:0x0,_0x3db8bf=new Map(),_0x4c02d5=new Map(),_0x476b9b=new Map(),_0x1c0e8e=_0xd66840?.[_0x7beedd(0x185)]>=0x2;let _0xff9c29=-0x1;for(const _0x274344 of _0x53bb79){if(!Array[_0x7beedd(0x154)](_0x274344)||_0x274344[_0x7beedd(0x163)]<0x2)continue;const _0x36d38f=Number(_0x274344[0x0]),_0x480298=String(_0x274344[0x1]??'');if(!Number[_0x7beedd(0x198)](_0x36d38f)||_0x36d38f<0x0)continue;if(!_0x480298)continue;_0x3db8bf['set'](_0x480298,_0x36d38f),_0x4c02d5[_0x7beedd(0xe3)](_0x36d38f,_0x480298);if(_0x1c0e8e&&typeof _0x274344[0x2]===_0x7beedd(0x16f))_0x476b9b[_0x7beedd(0xe3)](_0x480298,_0x274344[0x2]);if(_0x36d38f>_0xff9c29)_0xff9c29=_0x36d38f;}return this['keyToLabel']=_0x3db8bf,this['labelToKey']=_0x4c02d5,this['keyToFp']=_0x476b9b,this[_0x7beedd(0x184)]=_0x1c0e8e,this[_0x7beedd(0xe4)]=Math[_0x7beedd(0x172)](_0x26a3c8,_0xff9c29+0x1,0x0),this[_0x7beedd(0x100)]=0x0,!![];}[_0x575179(0xe8)](_0x5f5186){return this['keyToLabel']['get'](_0x5f5186);}[_0x575179(0x12f)](_0x58806e){const _0x52fd77=_0x575179;let _0xe67020=this[_0x52fd77(0x171)][_0x52fd77(0x19a)](_0x58806e);if(_0xe67020!==undefined)return _0xe67020;return _0xe67020=this[_0x52fd77(0xe4)]++,this[_0x52fd77(0x171)][_0x52fd77(0xe3)](_0x58806e,_0xe67020),this['labelToKey'][_0x52fd77(0xe3)](_0xe67020,_0x58806e),_0xe67020;}[_0x575179(0xf3)](_0x440665,_0x2252d8){const _0x550e47=_0x575179;if(_0x2252d8==null)this['keyToFp'][_0x550e47(0x127)](_0x440665);else this['keyToFp'][_0x550e47(0xe3)](_0x440665,_0x2252d8);}['fingerprintOf'](_0x48711c){const _0x3538fb=_0x575179;return this['keyToFp'][_0x3538fb(0x19a)](_0x48711c);}['keys'](){const _0x4a928c=_0x575179;return this[_0x4a928c(0x171)][_0x4a928c(0x15e)]();}[_0x575179(0xc5)](_0x5ae4b1){const _0x14228e=_0x575179,_0x22c094=this[_0x14228e(0x171)][_0x14228e(0x19a)](_0x5ae4b1);if(_0x22c094===undefined)return;this[_0x14228e(0x188)]['delete'](_0x5ae4b1),this['keyToLabel'][_0x14228e(0x127)](_0x5ae4b1),this['labelToKey'][_0x14228e(0x127)](_0x22c094),this['_tombstoneCount']++;}['keyForLabel'](_0x5eb0c4){const _0x2d29d6=_0x575179;return this[_0x2d29d6(0x133)][_0x2d29d6(0x19a)](_0x5eb0c4)??null;}[_0x575179(0x149)](){const _0x398d07=_0x575179;return this[_0x398d07(0x171)][_0x398d07(0x149)];}[_0x575179(0xf2)](){const _0x44e71c=_0x575179;return this[_0x44e71c(0x100)];}async[_0x575179(0x141)](_0x2ec279){const _0x49ece4=_0x575179,_0x5aa1ee=_0x2ec279+_0x49ece4(0x194),_0x3827c4=[];for(const [_0x2c0ed6,_0x1d26e4]of this[_0x49ece4(0x133)][_0x49ece4(0xf5)]()){const _0x2bbb77=this[_0x49ece4(0x188)][_0x49ece4(0x19a)](_0x1d26e4);_0x3827c4[_0x49ece4(0x17d)](_0x2bbb77==null?[_0x2c0ed6,_0x1d26e4]:[_0x2c0ed6,_0x1d26e4,_0x2bbb77]);}_0x3827c4[_0x49ece4(0x187)]((_0x11fbfd,_0x2e6ef8)=>_0x11fbfd[0x0]-_0x2e6ef8[0x0]);const _0x38368d={'version':0x2,'nextLabel':this['nextLabel'],'entries':_0x3827c4};_0x17c1fa['writeFileSync'](_0x5aa1ee,JSON[_0x49ece4(0x124)](_0x38368d)),_0x17c1fa[_0x49ece4(0xeb)](_0x5aa1ee,_0x2ec279);}}return labelMap=_0x57b4a6,labelMap;}function _0xe4ae(_0x1a1a57,_0x39b725){_0x1a1a57=_0x1a1a57-0xc5;const _0x2ae020=_0x2ae0();let _0xe4ae26=_0x2ae020[_0x1a1a57];return _0xe4ae26;}var indexConvergence,hasRequiredIndexConvergence;function requireIndexConvergence(){if(hasRequiredIndexConvergence)return indexConvergence;hasRequiredIndexConvergence=0x1;function _0x21d2bb(_0x14e4ab){const _0x24bb04=_0xe4ae,_0x25dc8e=new Uint32Array(_0x14e4ab['buffer'],_0x14e4ab[_0x24bb04(0x18c)],_0x14e4ab[_0x24bb04(0x163)]);let _0xb591d1=0x811c9dc5,_0x4afb82=0x9747b28c;for(let _0x1cfbb4=0x0;_0x1cfbb4<_0x25dc8e[_0x24bb04(0x163)];_0x1cfbb4++){const _0xcff280=_0x25dc8e[_0x1cfbb4];_0xb591d1=Math['imul'](_0xb591d1^_0xcff280,0x1000193)>>>0x0;let _0x89aee4=Math[_0x24bb04(0x10d)](_0xcff280,0xcc9e2d51);_0x89aee4=_0x89aee4<<0xf|_0x89aee4>>>0x11,_0x4afb82=Math['imul'](_0x4afb82^Math['imul'](_0x89aee4,0x1b873593),0x5)+0xe6546b64,_0x4afb82>>>=0x0;}return _0x4afb82=Math[_0x24bb04(0x10d)](_0x4afb82^_0x4afb82>>>0x10,0x85ebca6b)>>>0x0,(_0xb591d1>>>0x0)*0x100000+(_0x4afb82&0xfffff);}function _0x165598(_0x151a11,_0x24d5d8,_0x263620,{upsert:_0x33a37d,remove:_0x5b542b}){const _0x70f024=_0xe4ae,_0x58bc15=new Set();let _0x5ab63b=0x0,_0x559f5c=0x0,_0x5c9686=0x0;for(const {key:_0xb4744e,vector:_0x328137}of _0x24d5d8){if(!(_0x328137 instanceof Float32Array)||_0x328137['length']!==_0x263620)continue;_0x58bc15[_0x70f024(0xf8)](_0xb4744e);const _0x3fe479=_0x21d2bb(_0x328137),_0x27fb76=_0x151a11['labelForExisting'](_0xb4744e)!==undefined;if(_0x27fb76&&_0x151a11[_0x70f024(0x10b)](_0xb4744e)===_0x3fe479)continue;_0x33a37d(_0xb4744e,_0x328137,_0x3fe479);if(_0x27fb76)_0x559f5c++;else _0x5ab63b++;}for(const _0x47bc92 of[..._0x151a11['keys']()]){if(_0x58bc15[_0x70f024(0x123)](_0x47bc92))continue;_0x5b542b(_0x47bc92),_0x5c9686++;}return{'added':_0x5ab63b,'changed':_0x559f5c,'removed':_0x5c9686};}return indexConvergence={'fingerprint':_0x21d2bb,'reconcileIndex':_0x165598},indexConvergence;}function _0x2ae0(){const _0x2384d4=['expansionSearch','currentPath','loadFrom','capacity','distances','added','getMaxElements','readIndexSync','growFactor','516332KhUtwr','statSync','has','stringify','node','rmSync','delete','writerLockMaxAgeMs','snapshot\x20id\x20required','sqrt','unref','lockPath','catch','worker_threads','labelForEphemeral','dims','log','snapshotsDir','labelToKey','crypto','1040376PdbtxK','unreadable','usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','readCurrentClock','reset','snapshotEveryChanges','unlinkSync','7aBeMRa','finally','key','snapshotMaxLagMs','algorithm','snapshotTo','index','writeIndexSync','reject','lock_busy','hex','HNSW_BINDINGS_UNAVAILABLE','keepSnapshots','size','HierarchicalNSW','ready','load','getCurrentCount','reader','count','publishSnapshot','cosine','trim','flat','isArray','release','prune','state','HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','filter','hasRows','_tmp-','L2sq','listSnapshotIds','keys','ceil','postMessage','Original\x20error:\x20','pid','length','snapshot\x20incomplete:\x20','cause','\x20on\x20','vectors','69Epfprt','isDirectory','labels','name','round','hnswlib-node','latestSnapshotId','number','writeFileSync','keyToLabel','max','__esModule','candidateClock\x20must\x20be\x20finite\x20>=\x200','snapshot','MetricKind','state.json','viewRefreshMs','Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20','s,\x20pid:\x20','acquire','openSync','push','efConstruction','1838916ETXsTw','.tmp-','exports','dir','changed','hasFingerprints','version','call','sort','keyToFp','fetchAll','manifestVersion','closeSync','byteOffset','then','memoryUsage','join','message','stop','Unknown\x20op:\x20\x22','map','.tmp','Unknown\x20algorithm:\x20\x22','startsWith','readCurrentId','isInteger','min','get','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20','loadSnapshot','setEf','ENOENT','resizeIndex','tombstone','cleanupTmpDirs','fetchAllResult','keyForLabel',').\x20','addPoint','clock','hasOwnProperty','_snapshotDir','305770UIMAZY','writer','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','labels.json','heartbeatIntervalMs','utf8','SNAPSHOT.LOCK','slice','hnsw','725772RtrxAZ','snapshots','vector','initIndex','resolve','from','[SnapshotStore]','CURRENT','token','connectivity','WRITER.LOCK','set','nextLabel','for\x20Node\x20','warn','prototype','labelForExisting','isFinite','47924EZtCoA','renameSync','mtimeMs','index.hnsw','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','mkdirSync','parse','trunc','tombstoneCount','setFingerprint','sync','entries','metric','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','add','queryVec','tmpMaxAgeMs','readFileSync','rebuild','remove','search','efSearch','_tombstoneCount','markDelete','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20','published','expansionAdd','138825MjiJiv','randomBytes','hostname','toString','clear','repeat','fingerprintOf','searchKnn','imul','error','code','maxElements','info','existsSync','now','Cos','usearch','score','_snapshotPaths'];_0x2ae0=function(){return _0x2384d4;};return _0x2ae0();}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x3cd421=requireSnapshotStore(),_0x3db4a0=requireLabelMap(),{fingerprint:_0x308f08,reconcileIndex:_0x52768b}=requireIndexConvergence(),_0x23807f=0x1;let _0x108b83=null;function _0x1cc11e(){const _0x3004bf=_0xe4ae;if(_0x108b83)return _0x108b83;try{return _0x108b83=require(_0x3004bf(0x16d)),_0x108b83;}catch(_0x44e4a6){const _0x26814a=new Error(_0x3004bf(0x158)+('for\x20Node\x20'+process['versions'][_0x3004bf(0x125)]+_0x3004bf(0x166)+process['platform']+'/'+process['arch']+'.\x20')+_0x3004bf(0x19b)+(_0x3004bf(0x161)+(_0x44e4a6?.[_0x3004bf(0x190)]||String(_0x44e4a6))));_0x26814a['code']=_0x3004bf(0x147),_0x26814a[_0x3004bf(0x165)]=_0x44e4a6;throw _0x26814a;}}return hnsw=function _0x15eddc(_0x53acca={},{dims:_0x2607b8,dir:_0x50a61c}){const _0x1cd2b7=_0xe4ae,_0x4b7dd4=_0x1cc11e();if(!_0x2607b8||_0x2607b8<=0x0)throw new Error(_0x1cd2b7(0xd0));if(!_0x50a61c)throw new Error(_0x1cd2b7(0xee));const _0x3ee761={'metric':_0x53acca[_0x1cd2b7(0xf6)]??'cosine','M':_0x53acca['M']??0x10,'efConstruction':_0x53acca[_0x1cd2b7(0x17e)]??0xc8,'efSearch':_0x53acca[_0x1cd2b7(0xff)]??0x40,'maxElements':_0x53acca[_0x1cd2b7(0x110)]??0x400,'growFactor':_0x53acca[_0x1cd2b7(0x120)]??0x2,'snapshotEveryChanges':_0x53acca['snapshotEveryChanges']??0xc350,'keepSnapshots':_0x53acca[_0x1cd2b7(0x148)]??0x2,'tmpMaxAgeMs':_0x53acca[_0x1cd2b7(0xfa)]??0x6*0x36ee80},_0x41f5a3=new _0x3cd421({'dir':_0x50a61c,'keepSnapshots':_0x3ee761[_0x1cd2b7(0x148)]}),_0x5d674d=new _0x3db4a0();let _0x2b5b30=null,_0x4607c6=0x0,_0x35d06a=null,_0x164e65=Promise['resolve']();const _0x1b7073=_0xb323e0=>{const _0x2fb75c=_0x1cd2b7,_0x502a24=_0x164e65[_0x2fb75c(0x18d)](_0xb323e0);return _0x164e65=_0x502a24[_0x2fb75c(0x12d)](()=>{}),_0x502a24;};async function _0x5191c6(_0x273f35){const _0xd3bfd=_0x1cd2b7;await _0x5d674d[_0xd3bfd(0x139)](),_0x273f35=_0x273f35??[];const _0x48ca2f=Math['max'](_0x3ee761[_0xd3bfd(0x110)],Math[_0xd3bfd(0x15f)](_0x273f35['length']*(_0x3ee761[_0xd3bfd(0x120)]||1.2)),0x1);_0x2b5b30=new _0x4b7dd4[(_0xd3bfd(0x14a))](_0x3ee761[_0xd3bfd(0xf6)],_0x2607b8),_0x2b5b30[_0xd3bfd(0xdb)]({'maxElements':_0x48ca2f,'efConstruction':_0x3ee761[_0xd3bfd(0x17e)],'M':_0x3ee761['M']});for(const {key:_0x4fb285,vector:_0x21193d}of _0x273f35){if(!(_0x21193d instanceof Float32Array)||_0x21193d[_0xd3bfd(0x163)]!==_0x2607b8)continue;_0xa79734(_0x4fb285,_0x21193d);}_0x2b5b30['setEf'](_0x3ee761[_0xd3bfd(0xff)]),_0x4607c6=0x0;}async function _0x1cb9f6(_0x3a83d0){return _0x5191c6(_0x3a83d0?await _0x3a83d0():[]);}function _0x20ee83(){const _0xc08256=_0x1cd2b7;if(_0x2b5b30['getCurrentCount']()<_0x2b5b30[_0xc08256(0x11e)]())return;const _0x4120d0=Math[_0xc08256(0x15f)](_0x2b5b30[_0xc08256(0x11e)]()*(_0x3ee761[_0xc08256(0x120)]||0x2));_0x2b5b30[_0xc08256(0x19f)](_0x4120d0),_0x3ee761[_0xc08256(0x110)]=_0x4120d0;}function _0xa79734(_0x124c07,_0x4cdc74,_0x3abfde){const _0x1817d0=_0x1cd2b7,_0xd30bba=_0x5d674d[_0x1817d0(0x12f)](_0x124c07);try{_0x2b5b30[_0x1817d0(0x101)](_0xd30bba);}catch{}_0x20ee83(),_0x2b5b30[_0x1817d0(0xca)](Array[_0x1817d0(0xdd)](_0x4cdc74),_0xd30bba),_0x5d674d[_0x1817d0(0xf3)](_0x124c07,_0x3abfde??_0x308f08(_0x4cdc74));}function _0x13c972(_0x150a74){const _0x418e94=_0x1cd2b7,_0x2d53fc=_0x5d674d[_0x418e94(0xe8)](_0x150a74);if(_0x2d53fc===undefined)return![];try{_0x2b5b30['markDelete'](_0x2d53fc);}catch{}return _0x5d674d[_0x418e94(0xc5)](_0x150a74),!![];}function _0x5b5b0a(){const _0x400e7f=_0x1cd2b7;return Math[_0x400e7f(0x172)](Date[_0x400e7f(0x113)](),_0x41f5a3[_0x400e7f(0x138)]()+0x1);}async function _0x32aa97(_0x3ec0da){const _0x18bc98=_0x1cd2b7;if(!_0x2b5b30||!_0x3ec0da)return![];const _0x52a95a=await _0x41f5a3['publishSnapshot'](_0x3ec0da,async _0x149666=>{const _0x31b8ee=_0xe4ae;_0x2b5b30[_0x31b8ee(0x143)](_0x149666[_0x31b8ee(0x142)]),await _0x5d674d['snapshotTo'](_0x149666[_0x31b8ee(0x16a)]);const _0x4f7830=require$$0;_0x4f7830[_0x31b8ee(0x170)](_0x149666[_0x31b8ee(0x157)],JSON[_0x31b8ee(0x124)]({'manifestVersion':_0x23807f,'dims':_0x2607b8,'metric':_0x3ee761[_0x31b8ee(0xf6)],'clock':_0x3ec0da,'snapshotAt':Date[_0x31b8ee(0x113)]()},null,0x2));},{'keep':_0x3ee761[_0x18bc98(0x148)]});if(_0x52a95a?.[_0x18bc98(0x103)])_0x4607c6=0x0;return _0x52a95a?.[_0x18bc98(0x103)]??![];}async function _0x5efa06(){const _0x59f3fe=_0x1cd2b7,_0x5bcc55=_0x41f5a3[_0x59f3fe(0x197)]()||_0x41f5a3[_0x59f3fe(0x16e)]();if(!_0x5bcc55)return null;let _0x28e6bf,_0x50480e=![];return await _0x41f5a3[_0x59f3fe(0x19c)](_0x5bcc55,async _0x1d7dd1=>{const _0xafad80=_0x59f3fe,_0x5328bc=require$$0;_0x28e6bf=JSON[_0xafad80(0xf0)](_0x5328bc[_0xafad80(0xfb)](_0x1d7dd1[_0xafad80(0x157)],_0xafad80(0xd4)));if(_0x28e6bf[_0xafad80(0x18a)]!==_0x23807f||_0x28e6bf[_0xafad80(0x130)]!==_0x2607b8||_0x28e6bf['metric']!==_0x3ee761[_0xafad80(0xf6)]){_0x28e6bf=null;return;}await _0x5d674d[_0xafad80(0x11a)](_0x1d7dd1['labels']),_0x2b5b30=new _0x4b7dd4[(_0xafad80(0x14a))](_0x3ee761[_0xafad80(0xf6)],_0x2607b8),_0x2b5b30[_0xafad80(0x11f)](_0x1d7dd1[_0xafad80(0x142)]),_0x2b5b30['setEf'](_0x3ee761[_0xafad80(0xff)]),_0x50480e=!![];}),_0x50480e?_0x28e6bf?.[_0x59f3fe(0xcb)]??0x0:null;}return{async 'load'(_0x288c17){return _0x1b7073(async()=>{const _0x1c6445=_0xe4ae;_0x41f5a3[_0x1c6445(0xc6)]({'maxAgeMs':_0x3ee761[_0x1c6445(0xfa)]}),_0x35d06a=_0x288c17??null;const _0x313ae6=await _0x5efa06(),_0x18a837=_0x288c17?await _0x288c17():null;if(_0x313ae6!=null){if(_0x18a837){if(!_0x5d674d[_0x1c6445(0x184)])return await _0x5191c6(_0x18a837),null;const _0x27a6fd=_0x52768b(_0x5d674d,_0x18a837,_0x2607b8,{'upsert':_0xa79734,'remove':_0x13c972});_0x4607c6+=_0x27a6fd[_0x1c6445(0x11d)]+_0x27a6fd[_0x1c6445(0x183)]+_0x27a6fd['removed'];}return _0x313ae6;}return await _0x5191c6(_0x18a837),null;});},async 'add'(_0x1f934a,_0x14bd31,_0x232dad){return _0x1b7073(async()=>{const _0x29f1e1=_0xe4ae;if(!_0x2b5b30)return;const _0x511bdf=_0x14bd31 instanceof Float32Array?_0x14bd31:new Float32Array(_0x14bd31),_0x5ad021=_0x308f08(_0x511bdf);if(_0x5d674d[_0x29f1e1(0x10b)](_0x1f934a)===_0x5ad021)return;_0xa79734(_0x1f934a,_0x511bdf,_0x5ad021),_0x4607c6++,_0x4607c6>=_0x3ee761[_0x29f1e1(0x13a)]&&await _0x32aa97(_0x5b5b0a());});},async 'remove'(_0x225cb2){return _0x1b7073(async()=>{if(!_0x2b5b30)return;if(_0x13c972(_0x225cb2))_0x4607c6++;});},'search'(_0x2132f4,{limit:limit=0xa,efSearch:_0x170b14}={}){const _0x472589=_0x1cd2b7;if(!_0x2b5b30)return[];if(Number[_0x472589(0x198)](_0x170b14))_0x2b5b30[_0x472589(0x19d)](_0x170b14);const _0x23161f=Math[_0x472589(0x199)](limit,_0x2b5b30[_0x472589(0x14d)]()||0x1),{neighbors:_0x1b1863,distances:_0x38b8ce}=_0x2b5b30[_0x472589(0x10c)](Array[_0x472589(0xdd)](_0x2132f4),_0x23161f),_0x38425a=[];for(let _0x53a497=0x0;_0x53a497<_0x1b1863[_0x472589(0x163)];_0x53a497++){const _0x2e7ed=_0x5d674d[_0x472589(0xc8)](_0x1b1863[_0x53a497]);if(!_0x2e7ed)continue;const _0x214041=_0x3ee761[_0x472589(0xf6)]===_0x472589(0x151)?Math['max'](0x0,0x1-_0x38b8ce[_0x53a497]):0x1/(0x1+_0x38b8ce[_0x53a497]);_0x38425a[_0x472589(0x17d)]({'key':_0x2e7ed,'score':_0x214041});}return _0x38425a;},async 'snapshot'(_0xab50d8){return _0x1b7073(()=>_0x32aa97(_0xab50d8??_0x5b5b0a()));},async 'rebuild'(_0x377bc8){return _0x1b7073(()=>{if(_0x377bc8!=null)_0x35d06a=_0x377bc8;return _0x1cb9f6(_0x377bc8??_0x35d06a);});},async 'stop'(){const _0x444a76=_0x1cd2b7;return _0x1b7073(()=>_0x4607c6>0x0||!_0x41f5a3[_0x444a76(0x197)]()?_0x32aa97(_0x5b5b0a()):![]);},'count'(){return _0x5d674d['size']();},'info'(){const _0x361a8e=_0x1cd2b7;return{'algorithm':'hnsw','metric':_0x3ee761[_0x361a8e(0xf6)],'M':_0x3ee761['M'],'efConstruction':_0x3ee761[_0x361a8e(0x17e)],'efSearch':_0x3ee761[_0x361a8e(0xff)],'maxElements':_0x2b5b30?.[_0x361a8e(0x11e)]()??_0x3ee761['maxElements'],'count':_0x5d674d[_0x361a8e(0x149)](),'changesSince':_0x4607c6,'snapshotDir':_0x50a61c,'latestSnapshot':_0x41f5a3[_0x361a8e(0x197)]()??null};}};},hnsw;}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x8dc52d(_0x3f823d={}){const _0x5d2111=new Map();return{async 'load'(_0x53b1ee){const _0x2d5451=_0xe4ae;_0x5d2111[_0x2d5451(0x109)]();if(_0x53b1ee)for(const {key:_0x4742eb,vector:_0x271aef}of await _0x53b1ee()){_0x5d2111[_0x2d5451(0xe3)](_0x4742eb,_0x271aef);}},async 'add'(_0x507265,_0x4a056e,_0x243de2){const _0x364997=_0xe4ae;_0x5d2111[_0x364997(0xe3)](_0x507265,_0x4a056e);},async 'remove'(_0x2b914c){const _0x4aa3d3=_0xe4ae;_0x5d2111[_0x4aa3d3(0x127)](_0x2b914c);},'search'(_0x27c2b0,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x2b1de2=_0xe4ae,_0x32ed97=[];for(const [_0xd291ff,_0x172e45]of _0x5d2111){const _0x1da5a6=_0x5a558d(_0x27c2b0,_0x172e45);if(_0x1da5a6>=threshold)_0x32ed97[_0x2b1de2(0x17d)]({'key':_0xd291ff,'score':_0x1da5a6});}return _0x32ed97[_0x2b1de2(0x187)]((_0x43cdd2,_0x486cfd)=>_0x486cfd[_0x2b1de2(0x116)]-_0x43cdd2[_0x2b1de2(0x116)]),_0x32ed97[_0x2b1de2(0xd6)](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x5878a0){await this['load'](_0x5878a0);},async 'stop'(){},'count'(){return _0x5d2111['size'];},'info'(){const _0x97b235=_0xe4ae;return{'algorithm':_0x97b235(0x153),'count':_0x5d2111[_0x97b235(0x149)]};}};};function _0x5a558d(_0x46fa35,_0x1130df){const _0x7bdddf=_0xe4ae;let _0x4711da=0x0,_0x46f3c2=0x0,_0x399ce5=0x0;for(let _0x2caf17=0x0;_0x2caf17<_0x46fa35[_0x7bdddf(0x163)];_0x2caf17++){_0x4711da+=_0x46fa35[_0x2caf17]*_0x1130df[_0x2caf17],_0x46f3c2+=_0x46fa35[_0x2caf17]*_0x46fa35[_0x2caf17],_0x399ce5+=_0x1130df[_0x2caf17]*_0x1130df[_0x2caf17];}const _0x6d460a=Math[_0x7bdddf(0x12a)](_0x46f3c2)*Math[_0x7bdddf(0x12a)](_0x399ce5);return _0x6d460a===0x0?0x0:_0x4711da/_0x6d460a;}return flat;}var writerLock,hasRequiredWriterLock;function requireWriterLock(){if(hasRequiredWriterLock)return writerLock;hasRequiredWriterLock=0x1;const _0x4240da=require$$0,_0x36f9ea=require$$1,_0xacc17f=require$$3;return writerLock=function _0x349204(_0x26c817,{maxAgeMs:maxAgeMs=0x3a98,heartbeatMs:heartbeatMs=0x1388,onLost:onLost=null}={}){const _0x3809af=_0xe4ae,_0x5a6dd0=_0x36f9ea['join'](_0x26c817,_0x3809af(0xe2)),_0x314893=_0xacc17f[_0x3809af(0x106)](0x8)[_0x3809af(0x108)](_0x3809af(0x146));let _0x2744bb=![],_0x4aa978=null;const _0x464c7b=()=>JSON[_0x3809af(0x124)]({'pid':process[_0x3809af(0x162)],'token':_0x314893,'at':Date[_0x3809af(0x113)]()});function _0x4bb962(){const _0xf707dc=_0x3809af;try{return JSON[_0xf707dc(0xf0)](_0x4240da[_0xf707dc(0xfb)](_0x5a6dd0,_0xf707dc(0xd4)));}catch(_0x1b1a9b){return _0x1b1a9b?.[_0xf707dc(0x10f)]===_0xf707dc(0x19e)?null:{'unreadable':!![]};}}function _0x1bc780(){const _0xec8616=_0x3809af;try{const _0x46739a=_0x4240da[_0xec8616(0x17c)](_0x5a6dd0,'wx');try{_0x4240da[_0xec8616(0x170)](_0x46739a,_0x464c7b());}finally{_0x4240da[_0xec8616(0x18b)](_0x46739a);}return!![];}catch(_0x2d1fc5){if(_0x2d1fc5?.[_0xec8616(0x10f)]==='EEXIST')return![];throw _0x2d1fc5;}}function _0x132e1e(_0x46f63d){const _0x18be1c=_0x3809af;if(!_0x46f63d)return!![];if(_0x46f63d['unreadable'])return!![];return Date[_0x18be1c(0x113)]()-(_0x46f63d['at']??0x0)>=maxAgeMs;}function _0x5d8c61(){if(_0x4aa978)clearInterval(_0x4aa978);_0x4aa978=null;}function _0x3e7d77(){const _0x1e6b5c=_0x3809af;_0x5d8c61(),_0x4aa978=setInterval(()=>{const _0x11ecee=_0xe4ae,_0x7d4be7=_0x4bb962();if(_0x7d4be7&&!_0x7d4be7[_0x11ecee(0x136)]&&_0x7d4be7[_0x11ecee(0xe0)]!==_0x314893){_0x2744bb=![],_0x5d8c61();try{onLost?.();}catch{}return;}try{_0x4240da[_0x11ecee(0x170)](_0x5a6dd0,_0x464c7b());}catch{}},heartbeatMs),_0x4aa978[_0x1e6b5c(0x12b)]?.();}function _0x397179(){const _0x5edde3=_0x3809af,_0x4a0f08=_0x4bb962();return!!_0x4a0f08&&_0x4a0f08[_0x5edde3(0xe0)]===_0x314893;}return{'path':_0x5a6dd0,'token':_0x314893,'acquire'(){const _0x158930=_0x3809af,_0x5515b8=_0x4bb962();if(_0x5515b8&&_0x5515b8[_0x158930(0xe0)]===_0x314893){_0x2744bb=!![];if(!_0x4aa978)_0x3e7d77();return!![];}let _0x7b8616=_0x1bc780();if(!_0x7b8616&&_0x132e1e(_0x4bb962())){try{_0x4240da[_0x158930(0x13b)](_0x5a6dd0);}catch{}_0x7b8616=_0x1bc780();}if(_0x7b8616&&!_0x397179())_0x7b8616=![];_0x2744bb=_0x7b8616;if(_0x7b8616)_0x3e7d77();return _0x7b8616;},'held'(){return _0x2744bb;},'isFree'(){const _0x23e731=_0x4bb962();if(_0x23e731&&_0x23e731['token']===_0x314893)return![];return _0x132e1e(_0x23e731);},'release'(){const _0x53ef85=_0x3809af;_0x5d8c61();if(!_0x2744bb)return;_0x2744bb=![];if(_0x397179())try{_0x4240da[_0x53ef85(0x13b)](_0x5a6dd0);}catch{}}};},writerLock;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x2da06a=require$$0,_0x37fe5e=requireSnapshotStore(),_0x334b8c=requireLabelMap(),_0x2e2346=requireWriterLock(),{fingerprint:_0xbaced6,reconcileIndex:_0x4f1bff}=requireIndexConvergence(),_0x4012c1=0x1;let _0x56c324=null;function _0x2d9e71(){const _0x395546=_0xe4ae;if(_0x56c324)return _0x56c324;try{return _0x56c324=require('usearch'),_0x56c324;}catch(_0x4a9b26){const _0x545d21=new Error(_0x395546(0xd1)+(_0x395546(0xe5)+process['versions']['node']+'\x20on\x20'+process['platform']+'/'+process['arch']+'.\x20')+_0x395546(0x102)+('Original\x20error:\x20'+(_0x4a9b26?.[_0x395546(0x190)]||String(_0x4a9b26))));_0x545d21[_0x395546(0x10f)]='USEARCH_BINDINGS_UNAVAILABLE',_0x545d21[_0x395546(0x165)]=_0x4a9b26;throw _0x545d21;}}function _0x2d9839(_0x103e2a,_0x14ceeb){const _0x57f222=_0xe4ae;switch(_0x103e2a){case _0x57f222(0x151):return _0x14ceeb[_0x57f222(0x176)][_0x57f222(0x114)];case'l2':return _0x14ceeb[_0x57f222(0x176)][_0x57f222(0x15c)];case'ip':return _0x14ceeb[_0x57f222(0x176)]['IP'];default:return _0x14ceeb[_0x57f222(0x176)][_0x57f222(0x114)];}}return usearch=function _0x16cc0c(_0x1c135e={},{dims:_0x36c9d7,dir:_0x2809c9,fetchAll:fetchAll=null,onChange:onChange=null}={}){const _0x34dcee=_0xe4ae,_0x162ef9=_0x2d9e71();if(!_0x36c9d7||_0x36c9d7<=0x0)throw new Error('usearch\x20algorithm\x20requires\x20dims\x20>\x200');if(!_0x2809c9)throw new Error(_0x34dcee(0x137));const _0x310fd8={'metric':_0x1c135e[_0x34dcee(0xf6)]??_0x34dcee(0x151),'connectivity':_0x1c135e['connectivity']??0x10,'expansionAdd':_0x1c135e[_0x34dcee(0x104)]??0x80,'expansionSearch':_0x1c135e['expansionSearch']??0x40,'snapshotEveryChanges':_0x1c135e[_0x34dcee(0x13a)]??0xc350,'snapshotMaxLagMs':_0x1c135e[_0x34dcee(0x13f)]??0x2710,'keepSnapshots':_0x1c135e['keepSnapshots']??0x2,'tmpMaxAgeMs':_0x1c135e['tmpMaxAgeMs']??0x6*0x36ee80,'heartbeatIntervalMs':_0x1c135e[_0x34dcee(0xd3)]??0x1388,'writerLockMaxAgeMs':_0x1c135e['writerLockMaxAgeMs']??0x3a98,'viewRefreshMs':_0x1c135e[_0x34dcee(0x178)]??0x3e8},_0x3abaff=new _0x37fe5e({'dir':_0x2809c9,'keepSnapshots':_0x310fd8['keepSnapshots']}),_0x3707d1=_0x2e2346(_0x2809c9,{'maxAgeMs':_0x310fd8[_0x34dcee(0x128)],'heartbeatMs':_0x310fd8['heartbeatIntervalMs'],'onLost':()=>{const _0x1b31d9=_0x34dcee;_0x5e0290(_0x9a07b)[_0x1b31d9(0x12d)](()=>{});}});let _0x34b18e=new _0x334b8c(),_0x5c030a=null,_0x46b8c6=0x0,_0x5cb5f4=null,_0x419aee=![],_0x49b234=![],_0x4ed5dd=null,_0x18dd03=0x0,_0x913595=null,_0x9828cb=0x0,_0x575d4d=![],_0x4c2a03=Promise['resolve']();const _0x5e0290=_0x4fd552=>{const _0x28a198=_0x34dcee,_0x336721=_0x4c2a03[_0x28a198(0x18d)](_0x4fd552);return _0x4c2a03=_0x336721[_0x28a198(0x12d)](()=>{}),_0x336721;},_0x3795c4=()=>{try{onChange?.();}catch{}};function _0x3afa2e(){const _0x47bf58=_0x34dcee;return new _0x162ef9['Index']({'dimensions':_0x36c9d7,'metric':_0x2d9839(_0x310fd8[_0x47bf58(0xf6)],_0x162ef9),'quantization':_0x162ef9['ScalarKind']['F32'],'connectivity':_0x310fd8[_0x47bf58(0xe1)],'expansion_add':_0x310fd8[_0x47bf58(0x104)],'expansion_search':_0x310fd8[_0x47bf58(0x118)],'multi':![]});}function _0xb1ac1(_0x4ee966){return _0x4ee966 instanceof Float32Array?_0x4ee966:new Float32Array(_0x4ee966);}function _0x5db444(){if(fetchAll)return fetchAll();if(_0x5cb5f4)return _0x5cb5f4();return Promise['resolve'](null);}function _0x102ea8(_0xd0f281,_0x904f4c,_0x330b25){const _0x2d34cf=_0x34dcee,_0x1bcdc0=_0x34b18e[_0x2d34cf(0xe8)](_0xd0f281);if(_0x1bcdc0!==undefined)try{_0x5c030a[_0x2d34cf(0xfd)](BigInt(_0x1bcdc0));}catch{}const _0x2acaa4=_0x34b18e['labelForEphemeral'](_0xd0f281);_0x5c030a[_0x2d34cf(0xf8)](BigInt(_0x2acaa4),_0x904f4c),_0x34b18e['setFingerprint'](_0xd0f281,_0x330b25??_0xbaced6(_0x904f4c));}function _0x4f272b(_0x18d26b){const _0x23c553=_0x34dcee,_0x2a365c=_0x34b18e[_0x23c553(0xe8)](_0x18d26b);if(_0x2a365c===undefined)return![];try{_0x5c030a[_0x23c553(0xfd)](BigInt(_0x2a365c));}catch{}return _0x34b18e[_0x23c553(0xc5)](_0x18d26b),!![];}function _0x3f1d62(_0x347ba7){const _0x17f7c5=_0x34dcee;_0x34b18e=new _0x334b8c(),_0x5c030a=_0x3afa2e();for(const {key:_0x119595,vector:_0x58a139}of _0x347ba7??[]){if(!(_0x58a139 instanceof Float32Array)||_0x58a139[_0x17f7c5(0x163)]!==_0x36c9d7)continue;_0x102ea8(_0x119595,_0x58a139);}_0x46b8c6=0x0;}function _0x39a698(){const _0x4c2149=_0x34dcee;return Math[_0x4c2149(0x172)](Date[_0x4c2149(0x113)](),_0x3abaff[_0x4c2149(0x138)]()+0x1);}function _0x44cda1(){if(_0x4ed5dd)clearTimeout(_0x4ed5dd);_0x4ed5dd=null;}function _0x52b75c(){const _0x13320e=_0x34dcee;if(!_0x310fd8['snapshotMaxLagMs']||_0x4ed5dd||!_0x49b234||_0x46b8c6<=0x0)return;const _0x199c22=Math['max'](_0x310fd8[_0x13320e(0x13f)],0xa*_0x18dd03);_0x4ed5dd=setTimeout(()=>{const _0x669a92=_0x13320e;_0x4ed5dd=null,_0x5e0290(async()=>{if(_0x49b234&&_0x46b8c6>0x0)await _0x209feb();_0x52b75c(),_0x3795c4();})[_0x669a92(0x12d)](()=>{});},_0x199c22),_0x4ed5dd['unref']?.();}async function _0x209feb(_0x142376){const _0x2c0261=_0x34dcee;if(!_0x5c030a)return![];const _0x147b10=_0x142376??_0x39a698(),_0x3d31b9=Date[_0x2c0261(0x113)](),_0x1bd71f=await _0x3abaff['publishSnapshot'](_0x147b10,async _0x42b19e=>{const _0x20e2eb=_0x2c0261;_0x5c030a['save'](_0x42b19e['index']),await _0x34b18e[_0x20e2eb(0x141)](_0x42b19e[_0x20e2eb(0x16a)]),_0x2da06a[_0x20e2eb(0x170)](_0x42b19e[_0x20e2eb(0x157)],JSON['stringify']({'manifestVersion':_0x4012c1,'algorithm':_0x20e2eb(0x115),'dims':_0x36c9d7,'metric':_0x310fd8[_0x20e2eb(0xf6)],'clock':_0x147b10,'snapshotAt':Date['now']()},null,0x2));},{'keep':_0x310fd8['keepSnapshots']});return _0x18dd03=Date[_0x2c0261(0x113)]()-_0x3d31b9,_0x1bd71f?.[_0x2c0261(0x103)]&&(_0x46b8c6=0x0,_0x44cda1()),_0x1bd71f?.[_0x2c0261(0x103)]??![];}function _0x57fb93(){const _0x3818aa=_0x34dcee;_0x46b8c6++;if(_0x46b8c6>=_0x310fd8[_0x3818aa(0x13a)])return _0x209feb();return _0x52b75c(),null;}async function _0x1c71fe(){const _0x5f4261=_0x34dcee,_0x405159=_0x3abaff[_0x5f4261(0x197)]()||_0x3abaff[_0x5f4261(0x16e)]();if(!_0x405159)return null;let _0x485c09,_0x19eb0d=![];try{await _0x3abaff[_0x5f4261(0x19c)](_0x405159,async _0xd4b3bf=>{const _0x2d4787=_0x5f4261;_0x485c09=JSON['parse'](_0x2da06a[_0x2d4787(0xfb)](_0xd4b3bf[_0x2d4787(0x157)],_0x2d4787(0xd4)));if(_0x485c09[_0x2d4787(0x18a)]!==_0x4012c1||_0x485c09[_0x2d4787(0x140)]!==_0x2d4787(0x115)||_0x485c09[_0x2d4787(0x130)]!==_0x36c9d7||_0x485c09[_0x2d4787(0xf6)]!==_0x310fd8[_0x2d4787(0xf6)]){_0x485c09=null;return;}const _0x15a466=new _0x334b8c();await _0x15a466[_0x2d4787(0x11a)](_0xd4b3bf[_0x2d4787(0x16a)]);const _0x1694bb=_0x3afa2e();_0x1694bb[_0x2d4787(0x14c)](_0xd4b3bf['index']),_0x34b18e=_0x15a466,_0x5c030a=_0x1694bb,_0x19eb0d=!![];});}catch{return null;}return _0x19eb0d?_0x485c09?.['clock']??0x0:null;}async function _0x865998(_0x39d457){const _0x14eda2=_0x34dcee;_0x913595=null;const _0x4817f7=await _0x1c71fe();if(_0x4817f7!=null){_0x46b8c6=0x0;if(_0x39d457){if(!_0x34b18e[_0x14eda2(0x184)])return _0x3f1d62(_0x39d457),await _0x209feb(),null;const _0x33fcfa=_0x4f1bff(_0x34b18e,_0x39d457,_0x36c9d7,{'upsert':_0x102ea8,'remove':_0x4f272b}),_0x241391=_0x33fcfa[_0x14eda2(0x11d)]+_0x33fcfa['changed']+_0x33fcfa['removed'];_0x241391>0x0&&(_0x46b8c6+=_0x241391,await _0x209feb());}return _0x4817f7;}_0x3f1d62(_0x39d457??[]);if(_0x5c030a[_0x14eda2(0x149)]()>0x0)await _0x209feb();return null;}async function _0x26b099(){_0x49b234=!![],await _0x865998(await _0x5db444());}async function _0x9a07b(){const _0x4bea2a=_0x34dcee;if(!_0x49b234)return;_0x49b234=![],_0x44cda1(),_0x46b8c6=0x0;const _0x42b33b=_0x3abaff[_0x4bea2a(0x197)]()||_0x3abaff[_0x4bea2a(0x16e)]();await _0x18b0d9(_0x42b33b),_0x3795c4();}async function _0x18b0d9(_0x44aa82){const _0x29674a=_0x34dcee;if(!_0x44aa82)return![];let _0x22885a=![];try{await _0x3abaff[_0x29674a(0x19c)](_0x44aa82,async _0x14030e=>{const _0x2c27d5=_0x29674a,_0xe4241f=JSON['parse'](_0x2da06a[_0x2c27d5(0xfb)](_0x14030e['state'],_0x2c27d5(0xd4)));if(_0xe4241f['manifestVersion']!==_0x4012c1||_0xe4241f[_0x2c27d5(0x140)]!==_0x2c27d5(0x115)||_0xe4241f[_0x2c27d5(0x130)]!==_0x36c9d7||_0xe4241f[_0x2c27d5(0xf6)]!==_0x310fd8[_0x2c27d5(0xf6)])return;const _0x18ed13=new _0x334b8c();await _0x18ed13[_0x2c27d5(0x11a)](_0x14030e[_0x2c27d5(0x16a)]);const _0x16e808=_0x3afa2e();_0x16e808['view'](_0x14030e['index']),_0x5c030a=_0x16e808,_0x34b18e=_0x18ed13,_0x913595=_0x44aa82,_0x22885a=!![];});}catch{}return _0x22885a;}function _0x6ff940(){const _0x243c6b=_0x34dcee,_0x4bd256=Date[_0x243c6b(0x113)]();if(_0x4bd256-_0x9828cb<_0x310fd8[_0x243c6b(0x178)])return;_0x9828cb=_0x4bd256;if(_0x575d4d)return;if(_0x3707d1['isFree']()){_0x575d4d=!![],_0x5e0290(async()=>{const _0x1c3956=_0x243c6b;!_0x49b234&&_0x419aee&&_0x3707d1[_0x1c3956(0x17b)]()&&(await _0x26b099(),_0x3795c4());})[_0x243c6b(0x12d)](()=>{})[_0x243c6b(0x13d)](()=>{_0x575d4d=![];});return;}const _0x358c3e=_0x3abaff[_0x243c6b(0x197)]()||_0x3abaff[_0x243c6b(0x16e)]();if(!_0x358c3e||_0x358c3e===_0x913595)return;_0x575d4d=!![],_0x5e0290(async()=>{if(!_0x49b234&&await _0x18b0d9(_0x358c3e))_0x3795c4();})[_0x243c6b(0x12d)](()=>{})[_0x243c6b(0x13d)](()=>{_0x575d4d=![];});}return{async 'load'(_0x205576){return _0x5e0290(async()=>{const _0x2c0a4b=_0xe4ae;_0x3abaff[_0x2c0a4b(0xc6)]({'maxAgeMs':_0x310fd8[_0x2c0a4b(0xfa)]}),_0x5cb5f4=_0x205576??null,_0x49b234=_0x3707d1[_0x2c0a4b(0x17b)]();let _0x4ea0e8=null;if(_0x49b234)_0x4ea0e8=await _0x865998(_0x205576?await _0x205576():null);else{const _0x2fc2f1=_0x3abaff[_0x2c0a4b(0x197)]()||_0x3abaff[_0x2c0a4b(0x16e)]();await _0x18b0d9(_0x2fc2f1);}return _0x419aee=!![],_0x4ea0e8;});},async 'add'(_0x487343,_0x532499,_0x1c49ae){return _0x5e0290(async()=>{const _0x334b50=_0xe4ae;if(!_0x419aee)return;const _0x3466fa=_0xb1ac1(_0x532499);if(!_0x49b234){if(!_0x3707d1[_0x334b50(0x17b)]())return;await _0x26b099();}if(!_0x5c030a)return;const _0x4d4290=_0xbaced6(_0x3466fa);if(_0x34b18e['fingerprintOf'](_0x487343)===_0x4d4290)return;_0x102ea8(_0x487343,_0x3466fa,_0x4d4290),await _0x57fb93();});},async 'remove'(_0x3ff5c9){return _0x5e0290(async()=>{const _0x5e594f=_0xe4ae;if(!_0x419aee)return;if(!_0x49b234){if(!_0x3707d1[_0x5e594f(0x17b)]())return;await _0x26b099();}if(!_0x5c030a)return;if(_0x4f272b(_0x3ff5c9))await _0x57fb93();});},'search'(_0x3b2ba1,{limit:limit=0xa}={}){const _0x5d70e4=_0x34dcee;if(!_0x49b234&&_0x419aee)_0x6ff940();if(!_0x5c030a)return[];const _0x1752ac=_0x5c030a[_0x5d70e4(0x149)]();if(_0x1752ac===0x0)return[];const _0x1e3f49=Math[_0x5d70e4(0x199)](limit,_0x1752ac),_0x148643=_0x5c030a[_0x5d70e4(0xfe)](_0xb1ac1(_0x3b2ba1),_0x1e3f49,0x0),_0x103b45=[],_0x5e7c5b=_0x148643[_0x5d70e4(0x15e)],_0x1e14d9=_0x148643[_0x5d70e4(0x11c)];for(let _0x5dd181=0x0;_0x5dd181<_0x5e7c5b[_0x5d70e4(0x163)];_0x5dd181++){const _0x1cdad6=_0x5e7c5b[_0x5dd181];if(_0x1cdad6===0xffffffffffffffffn)continue;const _0x513d5d=Number(_0x1cdad6),_0x481378=_0x34b18e[_0x5d70e4(0xc8)](_0x513d5d);if(!_0x481378)continue;const _0x136c6b=_0x1e14d9[_0x5dd181];let _0x2e914a;if(_0x310fd8['metric']===_0x5d70e4(0x151))_0x2e914a=Math['max'](0x0,0x1-_0x136c6b);else{if(_0x310fd8[_0x5d70e4(0xf6)]==='ip')_0x2e914a=-_0x136c6b;else _0x2e914a=0x1/(0x1+_0x136c6b);}_0x103b45[_0x5d70e4(0x17d)]({'key':_0x481378,'score':_0x2e914a});}return _0x103b45;},async 'snapshot'(_0x3862fc){return _0x5e0290(()=>_0x49b234?_0x209feb(_0x3862fc??undefined):![]);},async 'rebuild'(_0x1206f5){return _0x5e0290(async()=>{const _0x549e41=_0xe4ae;if(_0x1206f5!=null)_0x5cb5f4=_0x1206f5;if(!_0x49b234){if(!_0x3707d1[_0x549e41(0x17b)]())return;_0x49b234=!![];}const _0x5d1741=_0x1206f5?await _0x1206f5():await _0x5db444();_0x3f1d62(_0x5d1741??[]),_0x419aee=!![],await _0x209feb();});},async 'stop'(){return _0x5e0290(async()=>{const _0x116e52=_0xe4ae;_0x44cda1();if(_0x49b234){if(_0x46b8c6>0x0||!_0x3abaff[_0x116e52(0x197)]())await _0x209feb();_0x3707d1[_0x116e52(0x155)]();}_0x49b234=![],_0x419aee=![];});},'count'(){const _0x4358a1=_0x34dcee;return _0x34b18e[_0x4358a1(0x149)]();},'info'(){const _0x45d41b=_0x34dcee;return{'algorithm':_0x45d41b(0x115),'role':_0x49b234?_0x45d41b(0xcf):_0x45d41b(0x14e),'metric':_0x310fd8['metric'],'connectivity':_0x310fd8[_0x45d41b(0xe1)],'expansionAdd':_0x310fd8['expansionAdd'],'expansionSearch':_0x310fd8[_0x45d41b(0x118)],'snapshotEveryChanges':_0x310fd8['snapshotEveryChanges'],'snapshotMaxLagMs':_0x310fd8['snapshotMaxLagMs'],'count':_0x34b18e[_0x45d41b(0x149)](),'size':_0x5c030a?.[_0x45d41b(0x149)]?.()??0x0,'capacity':_0x5c030a?.[_0x45d41b(0x11b)]?.()??0x0,'changesSince':_0x49b234?_0x46b8c6:null,'viewedSnapshot':_0x913595??null,'snapshotDir':_0x2809c9,'latestSnapshot':_0x3abaff[_0x45d41b(0x197)]()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0x347f12=_0x35f0f1;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x5c7d29,workerData:_0x11d008}=require$$0$1,{algorithmName:_0x44d319,algorithmConfig:_0x1a3e5d,dims:_0x2997f1,dir:_0x4f09b9}=_0x11d008;let _0x19b0b6=0x1;const _0x5a7169=new Map();function _0x1487cc(){const _0x2ce198=_0x19b0b6++;return new Promise((_0x88cad5,_0x48beb9)=>{const _0x2b9441=_0xe4ae;_0x5a7169[_0x2b9441(0xe3)](_0x2ce198,{'resolve':_0x88cad5,'reject':_0x48beb9}),_0x5c7d29[_0x2b9441(0x160)]({'op':_0x2b9441(0x189),'fid':_0x2ce198});});}const _0x3f84b9={'dims':_0x2997f1,'dir':_0x4f09b9,'fetchAll':_0x1487cc,'onChange':()=>_0x545a71()};let _0x388dcf;if(_0x44d319===_0x347f12(0xd7))_0x388dcf=requireHnsw()(_0x1a3e5d,_0x3f84b9);else{if(_0x44d319==='flat')_0x388dcf=requireFlat()(_0x1a3e5d,_0x3f84b9);else{if(_0x44d319==='usearch')_0x388dcf=requireUsearch()(_0x1a3e5d,_0x3f84b9);else throw new Error(_0x347f12(0x195)+_0x44d319+'\x22');}}function _0x545a71(){const _0x59880e=_0x347f12;try{_0x5c7d29[_0x59880e(0x160)]({'op':_0x59880e(0xf4),'count':_0x388dcf['count'](),'info':_0x388dcf[_0x59880e(0x111)](),'memory':process[_0x59880e(0x18e)]()});}catch{}}function _0x300beb(_0x1cff94){const _0x1b5848=_0x347f12;return(_0x1cff94||[])[_0x1b5848(0x193)](_0x27914f=>({'key':_0x27914f[_0x1b5848(0x13e)],'vector':_0x27914f[_0x1b5848(0xda)]instanceof Float32Array?_0x27914f[_0x1b5848(0xda)]:new Float32Array(_0x27914f[_0x1b5848(0xda)])}));}return _0x5c7d29['on']('message',async _0xf1795d=>{const _0x784552=_0x347f12;if(_0xf1795d['op']===_0x784552(0xc7)){const _0x4dd4d6=_0x5a7169['get'](_0xf1795d['fid']);if(!_0x4dd4d6)return;_0x5a7169[_0x784552(0x127)](_0xf1795d['fid']);if(_0xf1795d[_0x784552(0x10e)])_0x4dd4d6[_0x784552(0x144)](new Error(_0xf1795d['error']));else _0x4dd4d6[_0x784552(0xdc)](_0x300beb(_0xf1795d[_0x784552(0x167)]));return;}const {id:_0x5c0508,op:_0x4833a1,args:_0x212392}=_0xf1795d;try{let _0x43ac48;switch(_0x4833a1){case'load':{_0x43ac48=await _0x388dcf['load'](_0x212392[_0x784552(0x15a)]?_0x1487cc:null),_0x545a71();break;}case _0x784552(0xf8):{const _0x6e14f4=_0x212392[_0x784552(0xda)]instanceof Float32Array?_0x212392[_0x784552(0xda)]:new Float32Array(_0x212392['vector']);await _0x388dcf[_0x784552(0xf8)](_0x212392[_0x784552(0x13e)],_0x6e14f4,_0x212392[_0x784552(0xcb)]??undefined),_0x545a71(),_0x43ac48=null;break;}case _0x784552(0xfd):{await _0x388dcf[_0x784552(0xfd)](_0x212392[_0x784552(0x13e)]),_0x545a71(),_0x43ac48=null;break;}case _0x784552(0xfe):{const _0x15cdf3=_0x212392[_0x784552(0xf9)]instanceof Float32Array?_0x212392[_0x784552(0xf9)]:new Float32Array(_0x212392[_0x784552(0xf9)]);_0x43ac48=_0x388dcf[_0x784552(0xfe)](_0x15cdf3,_0x212392['opts']||{});break;}case _0x784552(0x175):{_0x43ac48=await _0x388dcf['snapshot'](_0x212392[_0x784552(0xcb)]),_0x545a71();break;}case _0x784552(0xfc):{const _0x2188af=_0x300beb(_0x212392['vectors']);await _0x388dcf['rebuild'](async()=>_0x2188af),_0x545a71(),_0x43ac48=null;break;}case _0x784552(0x191):{await _0x388dcf[_0x784552(0x191)](),_0x545a71(),_0x43ac48=null;break;}case _0x784552(0x14f):{_0x43ac48=_0x388dcf[_0x784552(0x14f)]();break;}case _0x784552(0x111):{_0x43ac48=_0x388dcf[_0x784552(0x111)]();break;}default:throw new Error(_0x784552(0x192)+_0x4833a1+'\x22');}_0x5c7d29[_0x784552(0x160)]({'id':_0x5c0508,'result':_0x43ac48});}catch(_0x2c7232){_0x5c7d29[_0x784552(0x160)]({'id':_0x5c0508,'error':{'message':_0x2c7232?.['message']||String(_0x2c7232),'code':_0x2c7232?.[_0x784552(0x10f)]}});}}),_0x5c7d29[_0x347f12(0x160)]({'op':_0x347f12(0x14b)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module[_0x35f0f1(0x181)]=algorithmWorkerThread;
|