@kedem/okdb 2.2.1 → 2.3.0

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +191 -0
  2. package/algorithm-worker-thread.js +1 -1
  3. package/bin/okdb.js +1 -1
  4. package/docs/embeddings.md +83 -5
  5. package/docs/fts.md +1 -1
  6. package/docs/licensing.md +75 -14
  7. package/docs/manifest.json +1 -0
  8. package/docs/resolved-fields.md +79 -0
  9. package/okdb-functions-sandbox-worker.js +1 -1
  10. package/okdb-http-worker-child.js +1 -1
  11. package/okdb-views-bootstrap-worker.js +1 -1
  12. package/okdb.js +1 -1
  13. package/package.json +1 -1
  14. package/public/modules/ok.js +1 -1
  15. package/public/sections/db/modals/create-env-modal.ok.js +1 -1
  16. package/public/sections/db/modals/remove-env-modal.ok.js +1 -1
  17. package/public/sections/db/modals/schema-edit-modal.ok.js +1 -1
  18. package/public/sections/embeddings/parts/embed-create-panel.ok.js +1 -1
  19. package/public/sections/embeddings/parts/embed-search-panel.ok.js +1 -1
  20. package/public/sections/embeddings/parts/pipeline-try-search.ok.js +1 -1
  21. package/public/sections/license/parts/license-panel.ok.js +1 -1
  22. package/public/sections/queue/modals/create-bucket-modal.ok.js +1 -1
  23. package/public/sections/queue/modals/edit-bucket-modal.ok.js +1 -1
  24. package/public/sections/sync/index.ok.html +2 -2
  25. package/public/sections/sync/modals/connect-peer-modal.ok.js +1 -1
  26. package/public/sections/system/parts/system-sync-panel.ok.js +1 -1
  27. package/public/vendor/okjs/ok.esm.min.js +1 -1
  28. package/public/vendor/okjs/toolkit/devtools/devtools-window.js +1 -0
  29. package/public/vendor/okjs/toolkit/devtools/ok-console.ok.js +1 -1
  30. package/public/vendor/okjs/toolkit/devtools/ok-crash-explorer-service.ok.js +1 -0
  31. package/public/vendor/okjs/toolkit/devtools/ok-crash-explorer.ok.js +1 -0
  32. package/public/vendor/okjs/toolkit/elements/ok-icon.ok.js +1 -1
  33. package/public/vendor/okjs/toolkit/errors/crash-minimal.ok.js +1 -0
  34. package/public/vendor/okjs/toolkit/errors/ok-crash-boundary.ok.js +1 -1
  35. package/public/vendor/okjs/toolkit/errors/ok-crash-info.ok.js +1 -1
  36. package/public/vendor/okjs/toolkit/manifest.js +1 -1
  37. package/types/environment.d.ts +26 -0
  38. package/types/features/licenses.d.ts +86 -0
  39. package/types/index.d.ts +11 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,197 @@ 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.0] - 2026-09-24
8
+
9
+ ### Added
10
+
11
+ - **Resolved fields** (`env.resolveField(type, field, fn)`): index content okdb never stores.
12
+ FTS (live drain and builds), the embeddings indexer and search-result chunk text read the field
13
+ through an app-registered resolver when a row has no stored value — e.g. rows of `{ rel, hash }`
14
+ with file text served from disk. The declaration is durable; a process that runs those indexes
15
+ without the resolver holds them with `FIELD_RESOLVER_MISSING` (the drain waits for the resolver;
16
+ no doc is marked failed) instead of indexing empty text. A resolver error fails that item only. Also `unresolveField`, `resolvedFields`, `readField`.
17
+ **Batch resolvers** (`resolveField(type, field, fn, { batch, batchSize })`) resolve many rows per
18
+ call — FTS drains/builds and the embeddings indexer prefetch a whole batch in one call (for a
19
+ remote source: one round trip per batch instead of per row).
20
+ Measured on okdb's own `src/` (265 files, 5.2 MB): identical FTS and vector results, source
21
+ env 2.6 MB → 0.27 MB. See `docs/resolved-fields.md`.
22
+ - Vector search views: `algorithm_config.idleEvictMs` (or `OKDB_VECTOR_VIEW_IDLE_EVICT_MS`) sets
23
+ a view's idle-eviction delay (default 5 min; `0` keeps it resident; `stats()` reports it), and
24
+ usearch `algorithm_config.snapshotMaxLagMs` bounds reader lag (see Fixed).
25
+ - `okdb.embeddings.getEmbedderFactory(type)` / `getEmbedderSchema(type)`: the factory (built-in or
26
+ registered) and field schema of an embedder type, e.g. to wrap a built-in provider and supply its
27
+ API key at runtime instead of storing it in the pipeline's durable config.
28
+ - **`db.licenses`** — install and inspect licenses from code (after `open()`): `add(input)` takes
29
+ a license blob, an activation token (auto-detected) or `{ blob, activation }`, takes effect
30
+ immediately, and is idempotent (re-adding a stored license returns it with `changed:false`);
31
+ `activate(token)`, `remove(id)`, `list()`, `get(id)`, and `effective()` (the active license or
32
+ the free tier, with `enforced`). Results are summaries (`id`, `type`, `status`,
33
+ `needsActivation`, `pin`, `expiresAt`, `features`, `limits`) — never the blob or token. The
34
+ admin license routes and `okdb license` now go through it. See `docs/licensing.md`.
35
+ - **`OKDB_LICENSE_FILE`**: `open()` installs the license in that file (blob, token, or both)
36
+ through the same idempotent path, before license-gated features and engines start. A missing or
37
+ invalid file is a warning (error code only, never the content); `open()` continues.
38
+
39
+ ### Changed
40
+
41
+ - **Free tier covers embeddings pipelines and 5 environments** (unlicensed prod builds), so an
42
+ embedded code index — a management env plus one env per workspace, each with an embeddings
43
+ pipeline — works out of the box for up to three workspaces. `embeddings` is on: the members of
44
+ an embeddings pipeline (embedder, indexer, vector-search, embed-worker engines) are licensed by
45
+ `embeddings` as well as `engines`, and load at open when either is enabled (previously an
46
+ unlicensed boot skipped every engine). A new free-tier-only limit, `pipelinesPerEnv` (2), bounds
47
+ them — counted as the env's indexer engines, refused before any member is created. `envs`
48
+ (which counts `default`) is 5, was 2. The generic `engines` platform (custom drivers,
49
+ standalone engines of other types) stays licensed. Paid licenses are unaffected: the license
50
+ format has no `pipelinesPerEnv` field, so a license is never bounded by it; a license with
51
+ `embeddings` but not `engines` can now actually run pipelines. Internal (`~`) envs, which the
52
+ `envs` limit never counted, are no longer refused by it either (a pipeline's
53
+ `~<env>:emb:<type>` env failed once the user envs were at the limit). See `docs/licensing.md`.
54
+ - Admin license routes (`POST /admin/license`, `POST /admin/license/:id/activate`) return the
55
+ license summary (no raw blob/token), and re-adding a stored license is an idempotent success
56
+ (was a 400 "License already stored"). `okdb license <blob>` likewise reports "already stored"
57
+ instead of failing. Internally a duplicate add is `LICENSE_ALREADY_STORED` (was
58
+ `LICENSE_INVALID`, the same code as a bad signature).
59
+ - **Embeddings indexing rebuilt around one idempotent `reconcile`.** For each document the
60
+ indexer compares the chunk content hashes the source doc calls for with the vectors actually
61
+ stored, embeds only the missing ones, deletes the stale ones, and records the outcome. Inline
62
+ drains and queue workers share it. Measured on 100 docs × 768 dims, half of them edited once:
63
+ the embeddings env per doc went from 100 → 34 KB (queue, chunked), 61 → 30 KB (inline,
64
+ chunked), 13 → 9 KB (queue, unchunked).
65
+ - Queue jobs are references: payload `{ key }` only (was the full job context plus a copy of
66
+ the chunk text), one job per doc (was one per chunk), write bursts folded into the pending
67
+ job (`idempotency_scope: 'pending'`, see below). New `debounce` option (ms) holds jobs back so
68
+ an edit burst embeds only the final text.
69
+ - Embed requests are batched (`batch`, default 32), across documents in inline mode.
70
+ `embedBatch(texts)` is a new optional embedder hook; the built-in `openai` and `ollama`
71
+ embedders implement it natively (one HTTP request per batch).
72
+ - Editing a field the pipeline doesn't embed costs no embed call and no write (was a full
73
+ re-embed). Non-chunked docs record a content `hash` for this.
74
+ - The hash→vector cache is a bounded LRU (`cache`, default 1024) instead of every stored vector
75
+ loaded into memory at startup.
76
+ - **Vectors are stored as raw float32 bytes** (3 KB per 768-dim vector, was ~6.9 KB as a msgpack
77
+ float64 array). A raw `vec:` row read through the generic data API is now a byte buffer, not a
78
+ number array — use `okdb.embeddings.getVector()`. Pre-2.3 rows still decode (the migration
79
+ keeps them); they convert as they're rewritten.
80
+ - **`doc_status` rows are trimmed** to `source_key`, `status`, `version`, `clock`, `updated`,
81
+ `error`, `empty`, and `hash` (unchunked) or `chunks[{hash,start,end}]`. Gone: `engine_key`, `mode`, `created`,
82
+ `chunk_strategy`, `total_chunks`, chunk text. `error`/`empty` are present only when set.
83
+ Rows are ordered by the source doc `version` and never regress.
84
+ - **Deleting a source doc deletes its `doc_status` row** (no `deleted` tombstones kept forever).
85
+ - **`chunk_status:<storage_key>` is gone** (a second copy of every chunk manifest, rewritten per
86
+ chunk). `listDocStatus` still reports `chunk_done` for chunked docs.
87
+ - **`chunk.storeText` is ignored**: chunk text is no longer copied into `doc_status`; search
88
+ results derive it from the current source doc (`okdb.embeddings.describeChunk()`). The admin
89
+ UI's "Store chunk text" checkbox (on by default) is removed.
90
+ - **Storage migration `2.3.0` / `embeddings-lean-layout`** (runs once on first open, before
91
+ engines boot, recorded in `~migrations`): drops each pipeline's pre-2.3 `doc_status`,
92
+ `chunk_status` and queued embedding jobs, removes vectors whose source doc no longer exists,
93
+ and resets the indexer to replay from clock 0.
94
+ Vectors are kept — chunked docs rebuild their status from the stored chunk hashes with **no
95
+ embed calls** and search keeps serving throughout; unchunked docs re-embed once (pre-2.3 rows
96
+ carry no content hash). `OKDB_EMBEDDINGS_REEMBED=1` also drops the vectors for a full
97
+ re-embed. The store is stamped `2.3.0`, so okdb 2.2.x refuses to open it (it cannot read
98
+ the new vector encoding).
99
+ - `okdb.embeddings.describeChunk()` is now async (it may read a resolved field).
100
+ - Indexer API: `reconcile(key, { heartbeat })` added (the embed-worker's entry point);
101
+ `markDone` no longer takes a `chunks` manifest; `markDelete` removes the row.
102
+ - Queue: `enqueue(..., { idempotency_scope: 'pending' })` — the idempotency key dedups against
103
+ pending jobs only and is released at claim, so a change arriving while a job runs enqueues a
104
+ follow-up instead of folding into the running job.
105
+
106
+ ### Fixed
107
+
108
+ - **Queue calls wait out a peer's compaction instead of failing.** When another process
109
+ compacted the env, this process closed its handle for the ~seconds-long swap, and any queue call
110
+ in that window (`enqueue`, `markJobComplete`/`Fail`, `releaseClaim`, `getJob`, …) threw
111
+ `INVALID_STATE` "OKDB not opened" from its first read before reaching the write path's drain
112
+ park. Enqueues were lost, and finished jobs stayed `running` until their claim expired. Queue
113
+ entrypoints now wait for the reopen, as `env.put`/`txn` already did; a genuinely closed env still
114
+ fails immediately.
115
+
116
+ - **Vector search views now always converge to the stored vectors** (usearch and hnsw; flat
117
+ already did). A view that idle-evicted (5 min without a search) skipped live updates while
118
+ unloaded, and its next load served its own stale snapshot without replaying the stored
119
+ vectors — anything embedded while it was unloaded was missing from the graph for good (load 5,
120
+ evict, add 10, reload → 5 of 15). Every load (and every reader→writer promotion) now diffs the
121
+ snapshot against the `vec:` rows via per-key vector fingerprints stored with the snapshot
122
+ (labels v2) and applies the missing adds, replaced vectors and removes. A pre-2.3 snapshot
123
+ (no fingerprints) is rebuilt from the rows once.
124
+ - **usearch: a process holding `WRITER.LOCK` could be a reader, leaving nobody to write the
125
+ graph** (~2 in 10 evictions landing near a change-count publish). Ownership was by pid, so an
126
+ evicted view's replacement worker in the same process didn't recognise — or could release —
127
+ its sibling's lock; and a live update delivered to the not-yet-loaded replacement promoted it
128
+ to writer, after which its own load saw its fresh lock and turned reader while its heartbeat
129
+ kept the lock alive. The lock is now owned by a per-instance token (a writer whose lock was
130
+ taken over demotes itself), writes to an unloaded instance are dropped (the load reconciles
131
+ them), the fanout tail pins the instance for a batch, and a reload waits for the evicted
132
+ instance to publish and release first. A reader whose writer is gone takes over on its next
133
+ search instead of serving the last snapshot forever.
134
+ - **usearch/hnsw: change-count snapshot publishes stopped after the first eviction.** Snapshot
135
+ ids mixed two clocks — the changelog counter (change-count publishes) and `Date.now()`
136
+ (stop/eviction/explicit publishes) — so after one wall-clock publish every change-count publish
137
+ was rejected as stale, readers froze at that snapshot, and every later add re-saved the whole
138
+ index into a tmp dir that was then discarded. Internal publishes now use one monotonic id.
139
+ - **usearch readers are fresh within `snapshotMaxLagMs` (new, default 10 s)**: the writer
140
+ publishes once the oldest unpublished change is that old, stretched to 10× the last publish's
141
+ duration so a large index spends at most ~10% of its time saving. `snapshotEveryChanges`
142
+ (still 50 000) is now only a burst cap; as the only trigger it meant a reader of a typical
143
+ (< 50k) index never saw a publish until the writer's view was evicted.
144
+ - hnsw: growing past capacity rebuilt the graph from the rows captured at load, dropping every
145
+ vector added since; it now resizes in place.
146
+ - A usearch reader's cold load no longer reads and ships every stored vector to its worker
147
+ thread (the algorithm pulls rows only when it needs them); vectors cross to the worker as
148
+ Float32Arrays instead of boxed arrays.
149
+ - Search view `rebuild()` on an unloaded view marked it loaded without loading it.
150
+ - `removeEnvironment` deleted sub-environment directories (e.g. the embeddings env
151
+ `~<env>:emb:<type>`) using their RELATIVE registry path, i.e. relative to `process.cwd()`:
152
+ the real directory was left behind, and a same-named directory in the current working
153
+ directory would have been deleted instead. Paths now resolve under the store root, and a
154
+ non-absolute path is refused.
155
+ - Chunked queue-mode pipelines left the previous version's chunk vectors in place on every update
156
+ (a doc edited once held twice its vectors; search could match text the doc no longer has),
157
+ embedded superseded versions from queued jobs, and could report a doc DONE for an older
158
+ version while its current chunks were still pending.
159
+ - Deleting a source doc from a chunked queue-mode pipeline never removed its vectors (the delete
160
+ path called a storage `scan()` that the vector store doesn't have), so deleted docs stayed
161
+ searchable. The 2.3.0 migration removes the leftovers.
162
+ - `durableRetryDoc`/`durableRetryFailed`/`durableRebuild` now work for chunked queue-mode
163
+ pipelines too.
164
+ - Queue-mode embedding pipelines kept every completed job and its payload forever
165
+ (`~queue_jobs` / `~queue_payloads` in `~<env>:emb:<type>`) — one row pair per document, or
166
+ per chunk for chunked pipelines (whose payloads carry a copy of `chunk_text`), re-added on
167
+ every source update and "Re-embed all". Embedding jobs are now enqueued with `done_ttl: 0`
168
+ (deleted on completion; `doc_status` remains the durable record); jobs left by older builds
169
+ are dropped by the 2.3.0 migration. Failed jobs are still kept for inspection/retry. Side effect: the worker's "Queue" metric
170
+ now shows the real backlog instead of every job ever enqueued.
171
+ - **Writer: a transaction issued while another was held open ran nested inside it.** lmdb-js keeps
172
+ an async write txn open while its callback's promise is pending (FTS holds its post txn across
173
+ the docs commit); a `childTransaction` issued in that window ran synchronously inside the
174
+ holder's txn — the write silently joined it (lost if the holder aborted) and the writer crashed
175
+ on the non-promise result. New transactions on that writer now wait for the hold to settle; a
176
+ nested result from a caller outside the writer is accounted for and warned instead of crashing.
177
+ - **A failed FTS build left the index stuck in `RESETTING`** and `fts.ready()` waiting forever. The
178
+ index now goes to the `error` state (message in `fts.list(type)[i].error`) and `ready()` rejects
179
+ with `FTS_BUILD_FAILED`; `fts.reset()` or the next `open()` retries the build.
180
+ - A pending FTS reset racing a type drop crashed on its own "dropped before the reset completed"
181
+ guard.
182
+ - `removeEnvironment` (and env close) now deregisters the env's engines in-process — re-creating
183
+ the env and its pipeline in the same process failed with "Engine already exists".
184
+ - `pipelines.remove` now drops the pipeline's vectors and resets its indexer cursor (vectors were
185
+ kept forever, and a re-created pipeline skipped docs it had indexed before); `indexer.rebuild()`
186
+ on the lazy vector adapter really drops the vectors now.
187
+ - `embeddings.durableRebuild()` from a passive (`processors:false`/`engines:false`) process now
188
+ reaches the live indexer in the owning process (durable command epoch + a processor hint)
189
+ and makes it re-embed (the live indexer never noticed); a restart does not replay the reset.
190
+ Processors no longer re-run their last command at every registration, and a registration
191
+ stopped while acquiring its lease no longer leaks a heartbeating lease.
192
+ - `bus.stop()` flushes pending sends — hints sent right before close/exit were lost.
193
+ - Admin UI: works with `@kedem/okjs` 1.3 (its import of the removed `ok-crash-info` component
194
+ failed the whole module graph; the crash screen's details now come from
195
+ `ok-crash-explorer-service`), and Enter-to-submit works again in 10 dialogs
196
+ (`@keydown:enter` — `@keydown.enter` never bound a key filter).
197
+
7
198
  ## [2.2.1] - 2026-08-25
8
199
 
9
200
  ### Fixed
@@ -1 +1 @@
1
- 'use strict';const _0x2f1a82=_0x2846;(function(_0x2aea6c,_0x4fc697){const _0x371a7e=_0x2846,_0xf58f19=_0x2aea6c();while(!![]){try{const _0x585fa8=parseInt(_0x371a7e(0x1b8))/0x1*(-parseInt(_0x371a7e(0x1a4))/0x2)+parseInt(_0x371a7e(0x16d))/0x3*(parseInt(_0x371a7e(0x1e2))/0x4)+-parseInt(_0x371a7e(0x1bf))/0x5*(-parseInt(_0x371a7e(0x1a6))/0x6)+-parseInt(_0x371a7e(0x1be))/0x7*(parseInt(_0x371a7e(0x14c))/0x8)+parseInt(_0x371a7e(0x18b))/0x9*(parseInt(_0x371a7e(0x175))/0xa)+parseInt(_0x371a7e(0x1af))/0xb+-parseInt(_0x371a7e(0x169))/0xc*(parseInt(_0x371a7e(0x1e7))/0xd);if(_0x585fa8===_0x4fc697)break;else _0xf58f19['push'](_0xf58f19['shift']());}catch(_0x4f886d){_0xf58f19['push'](_0xf58f19['shift']());}}}(_0x370a,0x2c043));var require$$0$1=require(_0x2f1a82(0x1bd)),require$$0=require('fs'),require$$1=require('path'),require$$2=require('os'),require$$3=require(_0x2f1a82(0x159));function getDefaultExportFromCjs(_0x3f4552){const _0x6cf357=_0x2f1a82;return _0x3f4552&&_0x3f4552[_0x6cf357(0x1e1)]&&Object[_0x6cf357(0x162)][_0x6cf357(0x195)]['call'](_0x3f4552,'default')?_0x3f4552[_0x6cf357(0x187)]:_0x3f4552;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x4af8a2=_0x2f1a82;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x290754=require$$0,_0x2884fc=require$$1,_0x4e3458=require$$2,_0x1146cb=require$$3;function _0x52951d(){const _0x29b424=_0x2846;return Date[_0x29b424(0x151)]();}function _0x20c3c6(_0x4858a6){const _0x4cf8db=_0x2846;try{return _0x290754[_0x4cf8db(0x172)](_0x4858a6);}catch{return![];}}function _0x50d3b7(_0x1be124){const _0x1deb48=_0x2846;try{return _0x290754[_0x1deb48(0x1ef)](_0x1be124,_0x1deb48(0x16b));}catch{return null;}}function _0x172b70(_0x2dc9fa,_0x347e6f){const _0x5f4a2b=_0x2846,_0x53028b=_0x2dc9fa+_0x5f4a2b(0x1e6)+_0x1146cb[_0x5f4a2b(0x1ac)](0x6)[_0x5f4a2b(0x1fd)]('hex');_0x290754[_0x5f4a2b(0x147)](_0x53028b,_0x347e6f),_0x290754[_0x5f4a2b(0x142)](_0x53028b,_0x2dc9fa);}function _0x3ea149(_0x151c97,_0x1af740=0x10){const _0x432520=_0x2846,_0x24f6eb=String(Math[_0x432520(0x152)](0x0,Math[_0x432520(0x166)](_0x151c97||0x0)));return _0x24f6eb[_0x432520(0x1aa)]>=_0x1af740?_0x24f6eb:'0'[_0x432520(0x1f2)](_0x1af740-_0x24f6eb[_0x432520(0x1aa)])+_0x24f6eb;}return snapshotStore=class _0x546e90{constructor({dir:_0x1802f1,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x55b84e=_0x2846;if(!_0x1802f1)throw new Error(_0x55b84e(0x1c8));this[_0x55b84e(0x19d)]=_0x1802f1,this[_0x55b84e(0x15e)]=_0x2884fc[_0x55b84e(0x1a8)](_0x1802f1,'snapshots'),this['currentPath']=_0x2884fc[_0x55b84e(0x1a8)](_0x1802f1,_0x55b84e(0x16f)),this[_0x55b84e(0x1fe)]=_0x2884fc[_0x55b84e(0x1a8)](_0x1802f1,'SNAPSHOT.LOCK'),this[_0x55b84e(0x1ce)]=keepSnapshots,this[_0x55b84e(0x1d5)]=log,_0x290754[_0x55b84e(0x15c)](this[_0x55b84e(0x19d)],{'recursive':!![]}),_0x290754[_0x55b84e(0x15c)](this[_0x55b84e(0x15e)],{'recursive':!![]});}[_0x4af8a2(0x1d0)](_0x2eed42){const _0x2f7cfb=_0x4af8a2;return _0x2884fc[_0x2f7cfb(0x1a8)](this[_0x2f7cfb(0x15e)],_0x2eed42);}[_0x4af8a2(0x189)](_0x2fab5b){const _0x1c1d1f=_0x4af8a2,_0x305df7=this[_0x1c1d1f(0x1d0)](_0x2fab5b);return{'dir':_0x305df7,'index':_0x2884fc[_0x1c1d1f(0x1a8)](_0x305df7,_0x1c1d1f(0x167)),'labels':_0x2884fc[_0x1c1d1f(0x1a8)](_0x305df7,_0x1c1d1f(0x17c)),'state':_0x2884fc[_0x1c1d1f(0x1a8)](_0x305df7,_0x1c1d1f(0x1f4))};}[_0x4af8a2(0x1b3)](){const _0x3074a4=_0x4af8a2;if(!_0x20c3c6(this[_0x3074a4(0x14f)]))return null;const _0x4e5d8f=_0x50d3b7(this[_0x3074a4(0x14f)]);if(!_0x4e5d8f)return null;const _0x44d117=String(_0x4e5d8f)[_0x3074a4(0x198)]();return _0x44d117||null;}[_0x4af8a2(0x16e)](){const _0x54be46=_0x4af8a2,_0x21e06b=this[_0x54be46(0x1b3)]();if(!_0x21e06b)return 0x0;const _0x5e2392=Number(_0x21e06b);return Number[_0x54be46(0x148)](_0x5e2392)?_0x5e2392:0x0;}[_0x4af8a2(0x1c5)](){const _0x141878=_0x4af8a2;try{return _0x290754[_0x141878(0x1ee)](this['snapshotsDir'],{'withFileTypes':!![]})[_0x141878(0x17d)](_0x28f6f7=>_0x28f6f7['isDirectory']())['map'](_0x1980b7=>_0x1980b7[_0x141878(0x14e)])['filter'](_0x49bc9a=>!_0x49bc9a[_0x141878(0x1a1)](_0x141878(0x1e6)))[_0x141878(0x17d)](_0x3524ff=>!_0x3524ff[_0x141878(0x1a1)](_0x141878(0x1a2)))[_0x141878(0x156)]();}catch{return[];}}[_0x4af8a2(0x19b)](){const _0x2b1466=_0x4af8a2,_0x5ae4a4=this[_0x2b1466(0x1b3)]();if(_0x5ae4a4)return _0x5ae4a4;const _0x31ee34=this[_0x2b1466(0x1c5)]();if(!_0x31ee34[_0x2b1466(0x1aa)])return null;return _0x31ee34[_0x31ee34['length']-0x1];}[_0x4af8a2(0x173)]({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x32f38e=_0x4af8a2;let _0x524d11;try{_0x524d11=_0x290754['readdirSync'](this[_0x32f38e(0x15e)],{'withFileTypes':!![]});}catch{return;}const _0x32aac2=_0x52951d()-maxAgeMs;for(const _0x598d50 of _0x524d11){if(!_0x598d50[_0x32f38e(0x19e)]())continue;const _0x17662c=_0x598d50[_0x32f38e(0x14e)];if(!_0x17662c[_0x32f38e(0x1a1)](_0x32f38e(0x1e6))&&!_0x17662c[_0x32f38e(0x1a1)]('_tmp-'))continue;const _0x2a4b70=_0x2884fc['join'](this[_0x32f38e(0x15e)],_0x17662c);try{const _0x3db0c1=_0x290754[_0x32f38e(0x190)](_0x2a4b70);if(_0x3db0c1[_0x32f38e(0x1dc)]>_0x32aac2)continue;}catch{}try{_0x290754[_0x32f38e(0x1c0)](_0x2a4b70,{'recursive':!![],'force':!![]});}catch{}}}['prune']({keep:keep=null}={}){const _0x2099fc=_0x4af8a2,_0x4ef4c1=Math[_0x2099fc(0x152)](0x1,Math[_0x2099fc(0x166)](keep??this[_0x2099fc(0x1ce)]??0x3)),_0x240cf4=this[_0x2099fc(0x1c5)]();if(_0x240cf4[_0x2099fc(0x1aa)]<=_0x4ef4c1)return;const _0x7d6f67=this[_0x2099fc(0x1b3)](),_0x523ca7=_0x240cf4[_0x2099fc(0x1a5)](0x0,Math[_0x2099fc(0x152)](0x0,_0x240cf4[_0x2099fc(0x1aa)]-_0x4ef4c1));for(const _0x3869a1 of _0x523ca7){if(_0x7d6f67&&_0x3869a1===_0x7d6f67)continue;const _0x42c47d=this[_0x2099fc(0x1d0)](_0x3869a1);try{_0x290754[_0x2099fc(0x1c0)](_0x42c47d,{'recursive':!![],'force':!![]});}catch{}}}async[_0x4af8a2(0x168)](_0x35c8d9,_0x5f3eba){const _0x264387=_0x4af8a2;if(!_0x35c8d9)throw new Error(_0x264387(0x153));const _0x5d38ac=this['_snapshotPaths'](_0x35c8d9);if(!_0x20c3c6(_0x5d38ac[_0x264387(0x1cc)])||!_0x20c3c6(_0x5d38ac[_0x264387(0x186)])||!_0x20c3c6(_0x5d38ac['state']))throw new Error(_0x264387(0x1f6)+_0x35c8d9);const _0x40b67e=await _0x5f3eba(_0x5d38ac);return _0x40b67e||{};}async[_0x4af8a2(0x1b9)](_0x518c63,_0x21ef18,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x3ccbbf=_0x4af8a2,_0x286f6b=Number(_0x518c63);if(!Number[_0x3ccbbf(0x148)](_0x286f6b)||_0x286f6b<0x0)throw new Error(_0x3ccbbf(0x17f));const _0x3bebd2=_0x3ea149(_0x286f6b),_0x2ed883=this['_snapshotDir'](_0x3bebd2),_0x5946f0=_0x2884fc['join'](this[_0x3ccbbf(0x15e)],_0x3ccbbf(0x1e6)+_0x3bebd2+'-'+_0x1146cb[_0x3ccbbf(0x1ac)](0x6)[_0x3ccbbf(0x1fd)](_0x3ccbbf(0x19c)));_0x290754['mkdirSync'](_0x5946f0,{'recursive':!![]});const _0x37022a={'dir':_0x5946f0,'index':_0x2884fc[_0x3ccbbf(0x1a8)](_0x5946f0,_0x3ccbbf(0x167)),'labels':_0x2884fc[_0x3ccbbf(0x1a8)](_0x5946f0,_0x3ccbbf(0x17c)),'state':_0x2884fc[_0x3ccbbf(0x1a8)](_0x5946f0,'state.json')};await _0x21ef18(_0x37022a,{'id':_0x3bebd2,'clock':_0x286f6b});const _0x5d5594=JSON[_0x3ccbbf(0x1e0)]({'pid':process[_0x3ccbbf(0x1f5)],'host':_0x4e3458[_0x3ccbbf(0x1b2)](),'at':_0x52951d()}),_0x4b7eea=_0x52951d();let _0x1c2d24=null;const _0x1778ec=()=>{const _0x1cc440=_0x3ccbbf;try{const _0x532a7e=JSON[_0x1cc440(0x1ea)](_0x290754[_0x1cc440(0x1ef)](this['lockPath'],_0x1cc440(0x16b)));if(_0x532a7e['at']&&_0x52951d()-_0x532a7e['at']>staleLockMaxAgeMs){const _0x21d864=_0x52951d()-_0x532a7e['at'],_0x18f970='Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20'+Math[_0x1cc440(0x19f)](_0x21d864/0x3e8)+_0x1cc440(0x1db)+_0x532a7e[_0x1cc440(0x1f5)]+_0x1cc440(0x15b)+_0x532a7e[_0x1cc440(0x202)]+_0x1cc440(0x1b4)+_0x1cc440(0x18d);this[_0x1cc440(0x1d5)]?.[_0x1cc440(0x185)]?this[_0x1cc440(0x1d5)]['warn'](_0x18f970):console[_0x1cc440(0x185)](_0x1cc440(0x1f3),_0x18f970);try{_0x290754['unlinkSync'](this[_0x1cc440(0x1fe)]);}catch{}return!![];}}catch{try{_0x290754[_0x1cc440(0x16a)](this[_0x1cc440(0x1fe)]);}catch{}}return![];},_0x3a5fd1=()=>{const _0x2553af=_0x3ccbbf;try{return _0x1c2d24=_0x290754['openSync'](this[_0x2553af(0x1fe)],'wx'),_0x290754[_0x2553af(0x147)](_0x1c2d24,_0x5d5594),!![];}catch(_0x55655a){if(_0x55655a&&_0x55655a['code']===_0x2553af(0x1dd))return![];throw _0x55655a;}};if(!_0x3a5fd1()){_0x1778ec(),_0x3a5fd1();if(_0x1c2d24==null&&lockTimeoutMs>0x0)while(_0x52951d()-_0x4b7eea<lockTimeoutMs){await new Promise(_0x319c38=>setTimeout(_0x319c38,0x19));if(_0x3a5fd1())break;_0x1778ec();}}if(_0x1c2d24==null){try{_0x290754[_0x3ccbbf(0x1c0)](_0x5946f0,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x3ccbbf(0x1ba)};}try{const _0x41c0d5=this[_0x3ccbbf(0x16e)]();if(_0x286f6b<=_0x41c0d5){try{_0x290754[_0x3ccbbf(0x1c0)](_0x5946f0,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x3ccbbf(0x150),'currentClock':_0x41c0d5};}if(!_0x20c3c6(_0x2ed883))_0x290754['renameSync'](_0x5946f0,_0x2ed883);else try{_0x290754[_0x3ccbbf(0x1c0)](_0x5946f0,{'recursive':!![],'force':!![]});}catch{}return _0x172b70(this[_0x3ccbbf(0x14f)],_0x3bebd2+'\x0a'),this[_0x3ccbbf(0x1c3)]({'keep':keep}),{'published':!![],'currentClock':_0x286f6b};}finally{try{_0x290754[_0x3ccbbf(0x141)](_0x1c2d24);}catch{}try{_0x290754[_0x3ccbbf(0x16a)](this[_0x3ccbbf(0x1fe)]);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x42ffc7=_0x2f1a82;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x311ec8=require$$0;class _0x5ec987{constructor(){const _0x533b6c=_0x2846;this[_0x533b6c(0x1df)]=new Map(),this[_0x533b6c(0x174)]=new Map(),this[_0x533b6c(0x1e4)]=0x0,this['_tombstoneCount']=0x0;}async[_0x42ffc7(0x1d9)](){const _0x1d2cdd=_0x42ffc7;this[_0x1d2cdd(0x1df)]=new Map(),this[_0x1d2cdd(0x174)]=new Map(),this[_0x1d2cdd(0x1e4)]=0x0,this[_0x1d2cdd(0x1f7)]=0x0;}async[_0x42ffc7(0x183)](_0x280b9b){const _0x343ef9=_0x42ffc7;if(!_0x280b9b||!_0x311ec8[_0x343ef9(0x172)](_0x280b9b))return await this[_0x343ef9(0x1d9)](),!![];let _0x2938a0;try{_0x2938a0=_0x311ec8[_0x343ef9(0x1ef)](_0x280b9b,'utf8');}catch{return await this[_0x343ef9(0x1d9)](),!![];}let _0x17da1c;try{_0x17da1c=JSON[_0x343ef9(0x1ea)](_0x2938a0);}catch{return await this[_0x343ef9(0x1d9)](),!![];}const _0x595942=Array[_0x343ef9(0x18f)](_0x17da1c?.['entries'])?_0x17da1c[_0x343ef9(0x1c2)]:[],_0x1de8d6=Number[_0x343ef9(0x182)](_0x17da1c?.[_0x343ef9(0x1e4)])?_0x17da1c['nextLabel']:0x0,_0x3770f5=new Map(),_0x392186=new Map();let _0x211d57=-0x1;for(const _0x3a1de7 of _0x595942){if(!Array[_0x343ef9(0x18f)](_0x3a1de7)||_0x3a1de7[_0x343ef9(0x1aa)]!==0x2)continue;const _0x540a99=Number(_0x3a1de7[0x0]),_0x44c427=String(_0x3a1de7[0x1]??'');if(!Number[_0x343ef9(0x182)](_0x540a99)||_0x540a99<0x0)continue;if(!_0x44c427)continue;_0x3770f5['set'](_0x44c427,_0x540a99),_0x392186[_0x343ef9(0x1c1)](_0x540a99,_0x44c427);if(_0x540a99>_0x211d57)_0x211d57=_0x540a99;}return this['keyToLabel']=_0x3770f5,this[_0x343ef9(0x174)]=_0x392186,this[_0x343ef9(0x1e4)]=Math['max'](_0x1de8d6,_0x211d57+0x1,0x0),this[_0x343ef9(0x1f7)]=0x0,!![];}[_0x42ffc7(0x1d6)](_0x528398){const _0x522270=_0x42ffc7;return this[_0x522270(0x1df)][_0x522270(0x15f)](_0x528398);}[_0x42ffc7(0x1ed)](_0xd9ba14){const _0x276c33=_0x42ffc7;let _0xcd43f=this[_0x276c33(0x1df)][_0x276c33(0x15f)](_0xd9ba14);if(_0xcd43f!==undefined)return _0xcd43f;return _0xcd43f=this[_0x276c33(0x1e4)]++,this[_0x276c33(0x1df)][_0x276c33(0x1c1)](_0xd9ba14,_0xcd43f),this['labelToKey']['set'](_0xcd43f,_0xd9ba14),_0xcd43f;}['tombstone'](_0x5a5c6e){const _0x5cf618=_0x42ffc7,_0x439425=this[_0x5cf618(0x1df)]['get'](_0x5a5c6e);if(_0x439425===undefined)return;this[_0x5cf618(0x1df)][_0x5cf618(0x199)](_0x5a5c6e),this[_0x5cf618(0x174)]['delete'](_0x439425),this[_0x5cf618(0x1f7)]++;}[_0x42ffc7(0x1b5)](_0x627b4b){const _0x50460b=_0x42ffc7;return this[_0x50460b(0x174)][_0x50460b(0x15f)](_0x627b4b)??null;}[_0x42ffc7(0x194)](){const _0x11cef1=_0x42ffc7;return this[_0x11cef1(0x1df)]['size'];}[_0x42ffc7(0x13f)](){const _0x428c52=_0x42ffc7;return this[_0x428c52(0x1f7)];}async[_0x42ffc7(0x157)](_0x52d5bc){const _0x1c0d10=_0x42ffc7,_0x4a9712=_0x52d5bc+'.tmp',_0x1aa552=[];for(const [_0x585707,_0x56d5c1]of this['labelToKey'][_0x1c0d10(0x1c2)]()){_0x1aa552['push']([_0x585707,_0x56d5c1]);}_0x1aa552[_0x1c0d10(0x156)]((_0x1ee77b,_0x18cf90)=>_0x1ee77b[0x0]-_0x18cf90[0x0]);const _0x5e1594={'version':0x1,'nextLabel':this[_0x1c0d10(0x1e4)],'entries':_0x1aa552};_0x311ec8[_0x1c0d10(0x147)](_0x4a9712,JSON[_0x1c0d10(0x1e0)](_0x5e1594)),_0x311ec8[_0x1c0d10(0x142)](_0x4a9712,_0x52d5bc);}}return labelMap=_0x5ec987,labelMap;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x1a1c9e=requireSnapshotStore(),_0x58301f=requireLabelMap(),_0x9eae49=0x1;let _0x175d4a=null;function _0x45376c(){const _0x1693fd=_0x2846;if(_0x175d4a)return _0x175d4a;try{return _0x175d4a=require(_0x1693fd(0x158)),_0x175d4a;}catch(_0x385860){const _0x4e4aae=new Error(_0x1693fd(0x181)+('for\x20Node\x20'+process[_0x1693fd(0x15a)]['node']+_0x1693fd(0x18a)+process[_0x1693fd(0x1bc)]+'/'+process[_0x1693fd(0x155)]+'.\x20')+'Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20'+(_0x1693fd(0x1de)+(_0x385860?.[_0x1693fd(0x143)]||String(_0x385860))));_0x4e4aae[_0x1693fd(0x14a)]='HNSW_BINDINGS_UNAVAILABLE',_0x4e4aae['cause']=_0x385860;throw _0x4e4aae;}}return hnsw=function _0x73344d(_0x59ab68={},{dims:_0x3cdb63,dir:_0x52b725}){const _0x4829e9=_0x2846,_0x263f57=_0x45376c();if(!_0x3cdb63||_0x3cdb63<=0x0)throw new Error('hnsw\x20algorithm\x20requires\x20dims\x20>\x200');if(!_0x52b725)throw new Error(_0x4829e9(0x1d8));const _0x4754c9={'metric':_0x59ab68[_0x4829e9(0x15d)]??_0x4829e9(0x1a7),'M':_0x59ab68['M']??0x10,'efConstruction':_0x59ab68[_0x4829e9(0x191)]??0xc8,'efSearch':_0x59ab68[_0x4829e9(0x1fc)]??0x40,'maxElements':_0x59ab68['maxElements']??0x400,'growFactor':_0x59ab68[_0x4829e9(0x1f1)]??0x2,'snapshotEveryChanges':_0x59ab68['snapshotEveryChanges']??0xc350,'keepSnapshots':_0x59ab68['keepSnapshots']??0x2,'tmpMaxAgeMs':_0x59ab68[_0x4829e9(0x178)]??0x6*0x36ee80},_0x27ea57=new _0x1a1c9e({'dir':_0x52b725,'keepSnapshots':_0x4754c9[_0x4829e9(0x1ce)]}),_0x4afa80=new _0x58301f();let _0x41471f=null,_0x50fdba=0x0,_0x220482=null,_0x41baf2=Promise[_0x4829e9(0x160)]();const _0x26b730=_0x37de0e=>{const _0x41c831=_0x4829e9;return _0x41baf2=_0x41baf2[_0x41c831(0x1c9)](_0x37de0e),_0x41baf2;};async function _0x4baa16(_0x2434c5){const _0x57b300=_0x4829e9;await _0x4afa80[_0x57b300(0x1d9)]();const _0x1e70f4=_0x2434c5?await _0x2434c5():[],_0x558b2d=Math[_0x57b300(0x152)](_0x4754c9[_0x57b300(0x165)],Math['ceil'](_0x1e70f4[_0x57b300(0x1aa)]*(_0x4754c9[_0x57b300(0x1f1)]||1.2)),0x1);_0x41471f=new _0x263f57['HierarchicalNSW'](_0x4754c9[_0x57b300(0x15d)],_0x3cdb63),_0x41471f['initIndex']({'maxElements':_0x558b2d,'efConstruction':_0x4754c9[_0x57b300(0x191)],'M':_0x4754c9['M']});for(const {key:_0x457d98,vector:_0xbe283e}of _0x1e70f4){if(!(_0xbe283e instanceof Float32Array)||_0xbe283e[_0x57b300(0x1aa)]!==_0x3cdb63)continue;const _0x2b5c0c=_0x4afa80[_0x57b300(0x1ed)](_0x457d98);_0x41471f['addPoint'](Array[_0x57b300(0x203)](_0xbe283e),_0x2b5c0c);}_0x41471f[_0x57b300(0x1f8)](_0x4754c9[_0x57b300(0x1fc)]),_0x50fdba=0x0;}async function _0x37f2e6(_0x4389a5){const _0x1638b6=_0x4829e9;if(!_0x41471f||!_0x4389a5)return![];const _0x10a851=await _0x27ea57[_0x1638b6(0x1b9)](_0x4389a5,async _0x2ba27a=>{const _0x39504f=_0x1638b6;_0x41471f[_0x39504f(0x180)](_0x2ba27a[_0x39504f(0x1cc)]),await _0x4afa80['snapshotTo'](_0x2ba27a[_0x39504f(0x186)]);const _0x1fc22a=require$$0;_0x1fc22a['writeFileSync'](_0x2ba27a['state'],JSON[_0x39504f(0x1e0)]({'manifestVersion':_0x9eae49,'dims':_0x3cdb63,'metric':_0x4754c9[_0x39504f(0x15d)],'clock':_0x4389a5,'snapshotAt':Date[_0x39504f(0x151)]()},null,0x2));},{'keep':_0x4754c9[_0x1638b6(0x1ce)]});if(_0x10a851?.[_0x1638b6(0x14d)])_0x50fdba=0x0;return _0x10a851?.[_0x1638b6(0x14d)]??![];}async function _0x1842b7(){const _0xa2fc6a=_0x4829e9,_0x270a72=_0x27ea57[_0xa2fc6a(0x1b3)]()||_0x27ea57[_0xa2fc6a(0x19b)]();if(!_0x270a72)return null;let _0xb57bf2,_0x25fdd0=![];return await _0x27ea57[_0xa2fc6a(0x168)](_0x270a72,async _0x48d86e=>{const _0x440482=_0xa2fc6a,_0x115e9a=require$$0;_0xb57bf2=JSON[_0x440482(0x1ea)](_0x115e9a[_0x440482(0x1ef)](_0x48d86e[_0x440482(0x193)],'utf8'));if(_0xb57bf2['manifestVersion']!==_0x9eae49||_0xb57bf2[_0x440482(0x1ca)]!==_0x3cdb63||_0xb57bf2[_0x440482(0x15d)]!==_0x4754c9[_0x440482(0x15d)]){_0xb57bf2=null;return;}await _0x4afa80[_0x440482(0x183)](_0x48d86e[_0x440482(0x186)]),_0x41471f=new _0x263f57['HierarchicalNSW'](_0x4754c9[_0x440482(0x15d)],_0x3cdb63),_0x41471f['readIndexSync'](_0x48d86e[_0x440482(0x1cc)]),_0x41471f[_0x440482(0x1f8)](_0x4754c9['efSearch']),_0x25fdd0=!![];}),_0x25fdd0?_0xb57bf2?.[_0xa2fc6a(0x14b)]??0x0:null;}return{async 'load'(_0x27c301){return _0x26b730(async()=>{const _0x5ee368=_0x2846;_0x27ea57[_0x5ee368(0x173)]({'maxAgeMs':_0x4754c9[_0x5ee368(0x178)]}),_0x220482=_0x27c301??null;const _0x30487c=await _0x1842b7();if(_0x30487c!=null)return _0x30487c;return await _0x4baa16(_0x27c301),null;});},async 'add'(_0x232211,_0x4c165e,_0x10ca81){return _0x26b730(async()=>{const _0x40eb8a=_0x2846;if(!_0x41471f)return;const _0x49ada6=_0x4afa80[_0x40eb8a(0x1ed)](_0x232211);try{_0x41471f[_0x40eb8a(0x18e)](_0x49ada6);}catch{}_0x41471f[_0x40eb8a(0x1d7)]()>=_0x41471f[_0x40eb8a(0x1bb)]()&&(_0x4754c9['maxElements']=Math[_0x40eb8a(0x204)](_0x41471f[_0x40eb8a(0x1bb)]()*(_0x4754c9[_0x40eb8a(0x1f1)]||0x2)),await _0x4baa16(_0x220482)),_0x41471f['addPoint'](Array[_0x40eb8a(0x203)](_0x4c165e),_0x49ada6),_0x50fdba++,_0x50fdba>=_0x4754c9[_0x40eb8a(0x197)]&&await _0x37f2e6(_0x10ca81??Date[_0x40eb8a(0x151)]());});},async 'remove'(_0x37e79f){return _0x26b730(async()=>{const _0x35c143=_0x2846;if(!_0x41471f)return;const _0xebf3e0=_0x4afa80[_0x35c143(0x1d6)](_0x37e79f);if(_0xebf3e0===undefined)return;try{_0x41471f[_0x35c143(0x18e)](_0xebf3e0);}catch{}_0x4afa80[_0x35c143(0x201)](_0x37e79f),_0x50fdba++;});},'search'(_0x38940d,{limit:limit=0xa,efSearch:_0x5eb1cb}={}){const _0x11534c=_0x4829e9;if(!_0x41471f)return[];if(Number[_0x11534c(0x182)](_0x5eb1cb))_0x41471f[_0x11534c(0x1f8)](_0x5eb1cb);const _0x3dfa73=Math[_0x11534c(0x1f9)](limit,_0x41471f[_0x11534c(0x1d7)]()||0x1),{neighbors:_0x665cb3,distances:_0x252474}=_0x41471f[_0x11534c(0x154)](Array[_0x11534c(0x203)](_0x38940d),_0x3dfa73),_0x314765=[];for(let _0x3da042=0x0;_0x3da042<_0x665cb3[_0x11534c(0x1aa)];_0x3da042++){const _0x55b10c=_0x4afa80['keyForLabel'](_0x665cb3[_0x3da042]);if(!_0x55b10c)continue;const _0x702c10=_0x4754c9[_0x11534c(0x15d)]===_0x11534c(0x1a7)?Math[_0x11534c(0x152)](0x0,0x1-_0x252474[_0x3da042]):0x1/(0x1+_0x252474[_0x3da042]);_0x314765[_0x11534c(0x200)]({'key':_0x55b10c,'score':_0x702c10});}return _0x314765;},async 'snapshot'(_0x446c02=Date[_0x4829e9(0x151)]()){return _0x26b730(()=>_0x37f2e6(_0x446c02));},async 'rebuild'(_0x78fd1){return _0x26b730(()=>{if(_0x78fd1!=null)_0x220482=_0x78fd1;return _0x4baa16(_0x78fd1??_0x220482);});},async 'stop'(){const _0xf450aa=_0x4829e9;return _0x26b730(()=>_0x37f2e6(Date[_0xf450aa(0x151)]()));},'count'(){const _0x19eecb=_0x4829e9;return _0x4afa80[_0x19eecb(0x194)]();},'info'(){const _0x174b20=_0x4829e9;return{'algorithm':_0x174b20(0x177),'metric':_0x4754c9[_0x174b20(0x15d)],'M':_0x4754c9['M'],'efConstruction':_0x4754c9[_0x174b20(0x191)],'efSearch':_0x4754c9[_0x174b20(0x1fc)],'maxElements':_0x41471f?.[_0x174b20(0x1bb)]()??_0x4754c9['maxElements'],'count':_0x4afa80[_0x174b20(0x194)](),'changesSince':_0x50fdba,'snapshotDir':_0x52b725,'latestSnapshot':_0x27ea57[_0x174b20(0x1b3)]()??null};}};},hnsw;}function _0x370a(){const _0x5b10f0=['Unknown\x20op:\x20\x22','ScalarKind','2699yuhmmI','publishSnapshot','lock_busy','getMaxElements','platform','worker_threads','21CXckPN','25pvyUyZ','rmSync','set','entries','prune','Cos','listSnapshotIds','load','usearch\x20algorithm\x20requires\x20dims\x20>\x200','SnapshotStore\x20requires\x20dir','then','dims','count','index','MetricKind','keepSnapshots','search','_snapshotDir','viewRefreshMs','capacity','openSync','distances','log','labelForExisting','getCurrentCount','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','reset','postMessage','s,\x20pid:\x20','mtimeMs','EEXIST','Original\x20error:\x20','keyToLabel','stringify','__esModule','102244vmGDzt','stop','nextLabel','connectivity','.tmp-','691613LbXFTz','heartbeatIntervalMs','view','parse','vector','unref','labelForEphemeral','readdirSync','readFileSync','remove','growFactor','repeat','[SnapshotStore]','state.json','pid','snapshot\x20incomplete:\x20','_tombstoneCount','setEf','min','opts','flat','efSearch','toString','lockPath','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','push','tombstone','host','from','ceil','tombstoneCount','add','closeSync','renameSync','message','map','queryVec','F32','writeFileSync','isFinite','for\x20Node\x20','code','clock','69160McEEkM','published','name','currentPath','stale','now','max','snapshot\x20id\x20required','searchKnn','arch','sort','snapshotTo','hnswlib-node','crypto','versions',',\x20host:\x20','mkdirSync','metric','snapshotsDir','get','resolve','usearch','prototype','node','memoryUsage','maxElements','trunc','index.hnsw','loadSnapshot','12kXqhsz','unlinkSync','utf8','cause','18fbYuAh','readCurrentClock','CURRENT','WRITER.LOCK','reader','existsSync','cleanupTmpDirs','labelToKey','10UDkyPM','writerLockMaxAgeMs','hnsw','tmpMaxAgeMs','save','snapshot','info','labels.json','filter','algorithm','candidateClock\x20must\x20be\x20finite\x20>=\x200','writeIndexSync','HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','isInteger','loadFrom','keys','warn','labels','default','expansionSearch','_snapshotPaths','\x20on\x20','120123WkyGzo','USEARCH_BINDINGS_UNAVAILABLE','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','markDelete','isArray','statSync','efConstruction','vectors','state','size','hasOwnProperty','sqrt','snapshotEveryChanges','trim','delete','manifestVersion','latestSnapshotId','hex','dir','isDirectory','round','rebuild','startsWith','_tmp-','clear','78PIZNLN','slice','101526OnOCZp','cosine','join','exports','length','Index','randomBytes','score','expansionAdd','1247070uWwCHD','key','ready','hostname','readCurrentId',').\x20','keyForLabel'];_0x370a=function(){return _0x5b10f0;};return _0x370a();}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0xb27747(_0x57de50={}){const _0x3f1663=new Map();return{async 'load'(_0x1d5096){const _0x5bc54b=_0x2846;_0x3f1663[_0x5bc54b(0x1a3)]();if(_0x1d5096)for(const {key:_0x2b2b2d,vector:_0x420819}of await _0x1d5096()){_0x3f1663[_0x5bc54b(0x1c1)](_0x2b2b2d,_0x420819);}},async 'add'(_0x56712f,_0x4214bb,_0x557cd5){const _0x270610=_0x2846;_0x3f1663[_0x270610(0x1c1)](_0x56712f,_0x4214bb);},async 'remove'(_0x150a2c){const _0x5abcb2=_0x2846;_0x3f1663[_0x5abcb2(0x199)](_0x150a2c);},'search'(_0xb9803a,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x2b8bdd=_0x2846,_0x578879=[];for(const [_0x40ed63,_0x2cdf33]of _0x3f1663){const _0x298d8c=_0x206f63(_0xb9803a,_0x2cdf33);if(_0x298d8c>=threshold)_0x578879[_0x2b8bdd(0x200)]({'key':_0x40ed63,'score':_0x298d8c});}return _0x578879[_0x2b8bdd(0x156)]((_0x4706c6,_0x2f3c9a)=>_0x2f3c9a[_0x2b8bdd(0x1ad)]-_0x4706c6[_0x2b8bdd(0x1ad)]),_0x578879[_0x2b8bdd(0x1a5)](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x5b12f1){const _0x3c953c=_0x2846;await this[_0x3c953c(0x1c6)](_0x5b12f1);},async 'stop'(){},'count'(){const _0x32a464=_0x2846;return _0x3f1663[_0x32a464(0x194)];},'info'(){const _0x3e6b66=_0x2846;return{'algorithm':_0x3e6b66(0x1fb),'count':_0x3f1663[_0x3e6b66(0x194)]};}};};function _0x206f63(_0x18b240,_0x30379){const _0x141c1a=_0x2846;let _0x524f75=0x0,_0x12afa4=0x0,_0x1195f5=0x0;for(let _0x3911bd=0x0;_0x3911bd<_0x18b240[_0x141c1a(0x1aa)];_0x3911bd++){_0x524f75+=_0x18b240[_0x3911bd]*_0x30379[_0x3911bd],_0x12afa4+=_0x18b240[_0x3911bd]*_0x18b240[_0x3911bd],_0x1195f5+=_0x30379[_0x3911bd]*_0x30379[_0x3911bd];}const _0x51d31a=Math[_0x141c1a(0x196)](_0x12afa4)*Math['sqrt'](_0x1195f5);return _0x51d31a===0x0?0x0:_0x524f75/_0x51d31a;}return flat;}function _0x2846(_0x1a348f,_0x299a6e){_0x1a348f=_0x1a348f-0x13f;const _0x370a34=_0x370a();let _0x284677=_0x370a34[_0x1a348f];return _0x284677;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x42b739=require$$0,_0x379a77=require$$1,_0x321b5c=requireSnapshotStore(),_0x45e684=requireLabelMap(),_0x5ab985=0x1;let _0x119c43=null;function _0x542525(){const _0x5ef145=_0x2846;if(_0x119c43)return _0x119c43;try{return _0x119c43=require(_0x5ef145(0x161)),_0x119c43;}catch(_0x2a76cc){const _0x4e4d64=new Error(_0x5ef145(0x1ff)+(_0x5ef145(0x149)+process['versions'][_0x5ef145(0x163)]+_0x5ef145(0x18a)+process['platform']+'/'+process['arch']+'.\x20')+'Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20'+(_0x5ef145(0x1de)+(_0x2a76cc?.['message']||String(_0x2a76cc))));_0x4e4d64[_0x5ef145(0x14a)]=_0x5ef145(0x18c),_0x4e4d64[_0x5ef145(0x16c)]=_0x2a76cc;throw _0x4e4d64;}}function _0xc9ab26(_0x27cba5,_0x444a41){const _0x2b3511=_0x2846;switch(_0x27cba5){case'cosine':return _0x444a41[_0x2b3511(0x1cd)][_0x2b3511(0x1c4)];case'l2':return _0x444a41[_0x2b3511(0x1cd)]['L2sq'];case'ip':return _0x444a41['MetricKind']['IP'];default:return _0x444a41['MetricKind'][_0x2b3511(0x1c4)];}}return usearch=function _0x503351(_0x1ce51e={},{dims:_0x50fc82,dir:_0x407d07}){const _0x5846b1=_0x2846,_0x12c854=_0x542525();if(!_0x50fc82||_0x50fc82<=0x0)throw new Error(_0x5846b1(0x1c7));if(!_0x407d07)throw new Error('usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage');const _0x53941c={'metric':_0x1ce51e[_0x5846b1(0x15d)]??_0x5846b1(0x1a7),'connectivity':_0x1ce51e[_0x5846b1(0x1e5)]??0x10,'expansionAdd':_0x1ce51e[_0x5846b1(0x1ae)]??0x80,'expansionSearch':_0x1ce51e[_0x5846b1(0x188)]??0x40,'snapshotEveryChanges':_0x1ce51e[_0x5846b1(0x197)]??0xc350,'keepSnapshots':_0x1ce51e[_0x5846b1(0x1ce)]??0x2,'tmpMaxAgeMs':_0x1ce51e[_0x5846b1(0x178)]??0x6*0x36ee80,'heartbeatIntervalMs':_0x1ce51e[_0x5846b1(0x1e8)]??0x1388,'writerLockMaxAgeMs':_0x1ce51e[_0x5846b1(0x176)]??0x3a98,'viewRefreshMs':_0x1ce51e[_0x5846b1(0x1d1)]??0x3e8},_0x28a7e2=new _0x321b5c({'dir':_0x407d07,'keepSnapshots':_0x53941c[_0x5846b1(0x1ce)]}),_0x3bf794=_0x379a77[_0x5846b1(0x1a8)](_0x407d07,_0x5846b1(0x170));let _0x1567e7=new _0x45e684(),_0x41deb5=null,_0xd34213=0x0,_0x3a9033=null,_0x4cd784=![],_0x14dc35=null,_0x28f21a=null,_0x4be533=0x0,_0xabcfb8=![],_0x10b3fa=Promise[_0x5846b1(0x160)]();const _0x5446ac=_0x1722b4=>{const _0x195032=_0x5846b1;return _0x10b3fa=_0x10b3fa[_0x195032(0x1c9)](_0x1722b4),_0x10b3fa;};function _0x115a24(){const _0xc99bd=_0x5846b1;return new _0x12c854[(_0xc99bd(0x1ab))]({'dimensions':_0x50fc82,'metric':_0xc9ab26(_0x53941c[_0xc99bd(0x15d)],_0x12c854),'quantization':_0x12c854[_0xc99bd(0x1b7)][_0xc99bd(0x146)],'connectivity':_0x53941c[_0xc99bd(0x1e5)],'expansion_add':_0x53941c[_0xc99bd(0x1ae)],'expansion_search':_0x53941c['expansionSearch'],'multi':![]});}function _0x540406(_0x5a7417){return _0x5a7417 instanceof Float32Array?_0x5a7417:new Float32Array(_0x5a7417);}function _0x326d70(){const _0x249659=_0x5846b1,_0x54d417=JSON['stringify']({'pid':process[_0x249659(0x1f5)],'at':Date[_0x249659(0x151)]()}),_0x2205ba=()=>{const _0x82f73=_0x249659;try{const _0x1541b4=_0x42b739[_0x82f73(0x1d3)](_0x3bf794,'wx');return _0x42b739[_0x82f73(0x147)](_0x1541b4,_0x54d417),_0x42b739[_0x82f73(0x141)](_0x1541b4),!![];}catch(_0x37a731){if(_0x37a731?.[_0x82f73(0x14a)]===_0x82f73(0x1dd))return![];throw _0x37a731;}};if(_0x2205ba())return!![];try{const _0x262b55=JSON[_0x249659(0x1ea)](_0x42b739[_0x249659(0x1ef)](_0x3bf794,_0x249659(0x16b))),_0x27d828=Date[_0x249659(0x151)]()-(_0x262b55['at']??0x0);if(_0x27d828<_0x53941c['writerLockMaxAgeMs'])return![];}catch{}try{_0x42b739['unlinkSync'](_0x3bf794);}catch{}return _0x2205ba();}function _0x3d0b3f(){const _0x140814=_0x5846b1;if(_0x14dc35)clearInterval(_0x14dc35);_0x14dc35=setInterval(()=>{const _0x554477=_0x2846;try{_0x42b739[_0x554477(0x147)](_0x3bf794,JSON['stringify']({'pid':process['pid'],'at':Date[_0x554477(0x151)]()}));}catch{}},_0x53941c[_0x140814(0x1e8)]),_0x14dc35[_0x140814(0x1ec)]();}function _0x1ed0d6(){const _0x1afa81=_0x5846b1;_0x14dc35&&(clearInterval(_0x14dc35),_0x14dc35=null);try{const _0x1e1519=JSON[_0x1afa81(0x1ea)](_0x42b739[_0x1afa81(0x1ef)](_0x3bf794,'utf8'));if(_0x1e1519[_0x1afa81(0x1f5)]===process[_0x1afa81(0x1f5)])_0x42b739['unlinkSync'](_0x3bf794);}catch{}}async function _0x5c19c3(_0x233065){const _0x337c42=_0x5846b1;_0x1567e7=new _0x45e684(),await _0x1567e7[_0x337c42(0x1d9)](),_0x41deb5=_0x115a24();const _0x1ab104=_0x233065?await _0x233065():[];for(const {key:_0x187a73,vector:_0x3db4bf}of _0x1ab104){if(!(_0x3db4bf instanceof Float32Array)||_0x3db4bf['length']!==_0x50fc82)continue;const _0x3a518c=_0x1567e7['labelForEphemeral'](_0x187a73);_0x41deb5[_0x337c42(0x140)](BigInt(_0x3a518c),_0x3db4bf);}_0xd34213=0x0;}async function _0xd51111(_0x2be25e){const _0x36c650=_0x5846b1;if(!_0x41deb5||!_0x2be25e)return![];const _0x2c33b0=await _0x28a7e2[_0x36c650(0x1b9)](_0x2be25e,async _0x37d4fe=>{const _0x36f51c=_0x36c650;_0x41deb5[_0x36f51c(0x179)](_0x37d4fe[_0x36f51c(0x1cc)]),await _0x1567e7[_0x36f51c(0x157)](_0x37d4fe[_0x36f51c(0x186)]),_0x42b739['writeFileSync'](_0x37d4fe[_0x36f51c(0x193)],JSON['stringify']({'manifestVersion':_0x5ab985,'algorithm':_0x36f51c(0x161),'dims':_0x50fc82,'metric':_0x53941c[_0x36f51c(0x15d)],'clock':_0x2be25e,'snapshotAt':Date['now']()},null,0x2));},{'keep':_0x53941c[_0x36c650(0x1ce)]});if(_0x2c33b0?.['published'])_0xd34213=0x0;return _0x2c33b0?.[_0x36c650(0x14d)]??![];}async function _0x5899bf(){const _0x23c144=_0x5846b1,_0x190a5f=_0x28a7e2[_0x23c144(0x1b3)]()||_0x28a7e2['latestSnapshotId']();if(!_0x190a5f)return null;let _0x404d45,_0x54e1c5=![];return await _0x28a7e2[_0x23c144(0x168)](_0x190a5f,async _0x12579f=>{const _0x4f731d=_0x23c144;_0x404d45=JSON[_0x4f731d(0x1ea)](_0x42b739[_0x4f731d(0x1ef)](_0x12579f[_0x4f731d(0x193)],_0x4f731d(0x16b)));if(_0x404d45[_0x4f731d(0x19a)]!==_0x5ab985||_0x404d45['algorithm']!==_0x4f731d(0x161)||_0x404d45[_0x4f731d(0x1ca)]!==_0x50fc82||_0x404d45[_0x4f731d(0x15d)]!==_0x53941c[_0x4f731d(0x15d)]){_0x404d45=null;return;}_0x1567e7=new _0x45e684(),await _0x1567e7['loadFrom'](_0x12579f[_0x4f731d(0x186)]),_0x41deb5=_0x115a24(),_0x41deb5[_0x4f731d(0x1c6)](_0x12579f[_0x4f731d(0x1cc)]),_0x54e1c5=!![];}),_0x54e1c5?_0x404d45?.['clock']??0x0:null;}async function _0x1816ac(_0x2e2560){const _0x29378d=_0x5846b1;if(!_0x2e2560)return![];let _0xacba7c=![];try{await _0x28a7e2[_0x29378d(0x168)](_0x2e2560,async _0x39832a=>{const _0x43df2b=_0x29378d,_0x38c829=JSON['parse'](_0x42b739[_0x43df2b(0x1ef)](_0x39832a[_0x43df2b(0x193)],_0x43df2b(0x16b)));if(_0x38c829[_0x43df2b(0x19a)]!==_0x5ab985||_0x38c829[_0x43df2b(0x17e)]!==_0x43df2b(0x161)||_0x38c829[_0x43df2b(0x1ca)]!==_0x50fc82||_0x38c829[_0x43df2b(0x15d)]!==_0x53941c[_0x43df2b(0x15d)])return;const _0x21de61=new _0x45e684();await _0x21de61['loadFrom'](_0x39832a[_0x43df2b(0x186)]);const _0x3c109c=_0x115a24();_0x3c109c[_0x43df2b(0x1e9)](_0x39832a['index']),_0x41deb5=_0x3c109c,_0x1567e7=_0x21de61,_0x28f21a=_0x2e2560,_0xacba7c=!![];});}catch{}return _0xacba7c;}async function _0x1b712b(_0x5dd5fe){try{await _0x1816ac(_0x5dd5fe);}finally{_0xabcfb8=![];}}function _0x45f63c(){const _0x2b42cb=_0x5846b1,_0x13d6aa=Date[_0x2b42cb(0x151)]();if(_0x13d6aa-_0x4be533<_0x53941c[_0x2b42cb(0x1d1)])return;_0x4be533=_0x13d6aa;if(_0xabcfb8)return;const _0x59ac34=_0x28a7e2[_0x2b42cb(0x1b3)]()||_0x28a7e2[_0x2b42cb(0x19b)]();if(!_0x59ac34||_0x59ac34===_0x28f21a)return;_0xabcfb8=!![],_0x1b712b(_0x59ac34);}async function _0x400880(){const _0x4f2e7c=_0x5846b1;_0x4cd784=!![],_0x3d0b3f();if(_0x28f21a)try{const _0x5c85cf=new _0x45e684();let _0x29301a=![];await _0x28a7e2[_0x4f2e7c(0x168)](_0x28f21a,async _0x1bbfd7=>{const _0x16e55b=_0x4f2e7c;await _0x5c85cf[_0x16e55b(0x183)](_0x1bbfd7[_0x16e55b(0x186)]);const _0x2677cf=_0x115a24();_0x2677cf[_0x16e55b(0x1c6)](_0x1bbfd7[_0x16e55b(0x1cc)]),_0x41deb5=_0x2677cf,_0x1567e7=_0x5c85cf,_0x29301a=!![];});if(_0x29301a)return;}catch{}await _0x5c19c3(_0x3a9033);}return{async 'load'(_0x9971a5){return _0x5446ac(async()=>{const _0x50e2d3=_0x2846;_0x28a7e2[_0x50e2d3(0x173)]({'maxAgeMs':_0x53941c[_0x50e2d3(0x178)]}),_0x3a9033=_0x9971a5??null,_0x4cd784=_0x326d70();if(_0x4cd784){_0x3d0b3f();const _0x4c77dc=await _0x5899bf();if(_0x4c77dc!=null)return _0x4c77dc;return await _0x5c19c3(_0x9971a5),null;}const _0x142073=_0x28a7e2['readCurrentId']()||_0x28a7e2[_0x50e2d3(0x19b)]();return await _0x1816ac(_0x142073),null;});},async 'add'(_0xac46ac,_0x2fac5,_0x5730a2){return _0x5446ac(async()=>{const _0x56e895=_0x2846;if(!_0x4cd784){if(!_0x326d70())return;await _0x400880();}if(!_0x41deb5)return;const _0x2b30ce=_0x1567e7['labelForExisting'](_0xac46ac);if(_0x2b30ce!==undefined)try{_0x41deb5[_0x56e895(0x1f0)](BigInt(_0x2b30ce));}catch{}const _0x2d3148=_0x1567e7[_0x56e895(0x1ed)](_0xac46ac);_0x41deb5[_0x56e895(0x140)](BigInt(_0x2d3148),_0x540406(_0x2fac5)),_0xd34213++,_0xd34213>=_0x53941c[_0x56e895(0x197)]&&await _0xd51111(_0x5730a2??Date['now']());});},async 'remove'(_0x40bb9){return _0x5446ac(async()=>{const _0x5bf21f=_0x2846;if(!_0x4cd784){if(!_0x326d70())return;await _0x400880();}if(!_0x41deb5)return;const _0x5e62ec=_0x1567e7[_0x5bf21f(0x1d6)](_0x40bb9);if(_0x5e62ec===undefined)return;try{_0x41deb5[_0x5bf21f(0x1f0)](BigInt(_0x5e62ec));}catch{}_0x1567e7[_0x5bf21f(0x201)](_0x40bb9),_0xd34213++;});},'search'(_0x49f66b,{limit:limit=0xa}={}){const _0x3991ba=_0x5846b1;if(!_0x4cd784)_0x45f63c();if(!_0x41deb5)return[];const _0x4fb786=_0x41deb5[_0x3991ba(0x194)]();if(_0x4fb786===0x0)return[];const _0x416725=Math[_0x3991ba(0x1f9)](limit,_0x4fb786),_0x3d5644=_0x41deb5[_0x3991ba(0x1cf)](_0x540406(_0x49f66b),_0x416725,0x0),_0x4e247f=[],_0x5106de=_0x3d5644[_0x3991ba(0x184)],_0x49c3a1=_0x3d5644[_0x3991ba(0x1d4)];for(let _0x36903b=0x0;_0x36903b<_0x5106de[_0x3991ba(0x1aa)];_0x36903b++){const _0x4d587b=_0x5106de[_0x36903b];if(_0x4d587b===0xffffffffffffffffn)continue;const _0x1f8851=Number(_0x4d587b),_0x47a5f1=_0x1567e7[_0x3991ba(0x1b5)](_0x1f8851);if(!_0x47a5f1)continue;const _0x434bd1=_0x49c3a1[_0x36903b];let _0x1ddf8f;if(_0x53941c['metric']===_0x3991ba(0x1a7))_0x1ddf8f=Math[_0x3991ba(0x152)](0x0,0x1-_0x434bd1);else{if(_0x53941c[_0x3991ba(0x15d)]==='ip')_0x1ddf8f=-_0x434bd1;else _0x1ddf8f=0x1/(0x1+_0x434bd1);}_0x4e247f[_0x3991ba(0x200)]({'key':_0x47a5f1,'score':_0x1ddf8f});}return _0x4e247f;},async 'snapshot'(_0x543654=Date[_0x5846b1(0x151)]()){if(!_0x4cd784)return![];return _0x5446ac(()=>_0xd51111(_0x543654));},async 'rebuild'(_0x2fa7a3){if(!_0x4cd784)return;return _0x5446ac(()=>{if(_0x2fa7a3!=null)_0x3a9033=_0x2fa7a3;return _0x5c19c3(_0x2fa7a3??_0x3a9033);});},async 'stop'(){return _0x5446ac(async()=>{_0x4cd784&&(await _0xd51111(Date['now']()),_0x1ed0d6());});},'count'(){const _0x481e62=_0x5846b1;return _0x1567e7[_0x481e62(0x194)]();},'info'(){const _0x590538=_0x5846b1;return{'algorithm':'usearch','role':_0x4cd784?'writer':_0x590538(0x171),'metric':_0x53941c[_0x590538(0x15d)],'connectivity':_0x53941c[_0x590538(0x1e5)],'expansionAdd':_0x53941c[_0x590538(0x1ae)],'expansionSearch':_0x53941c[_0x590538(0x188)],'count':_0x1567e7[_0x590538(0x194)](),'size':_0x41deb5?.[_0x590538(0x194)]?.()??0x0,'capacity':_0x41deb5?.[_0x590538(0x1d2)]?.()??0x0,'changesSince':_0x4cd784?_0xd34213:null,'viewedSnapshot':_0x28f21a??null,'snapshotDir':_0x407d07,'latestSnapshot':_0x28a7e2[_0x590538(0x1b3)]()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0x10d3c9=_0x2f1a82;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x40c05e,workerData:_0x2d278a}=require$$0$1,{algorithmName:_0x3e8431,algorithmConfig:_0x274821,dims:_0x590ecd,dir:_0xce54bd}=_0x2d278a;let _0x5287c5;if(_0x3e8431==='hnsw')_0x5287c5=requireHnsw()(_0x274821,{'dims':_0x590ecd,'dir':_0xce54bd});else{if(_0x3e8431===_0x10d3c9(0x1fb))_0x5287c5=requireFlat()(_0x274821,{'dims':_0x590ecd,'dir':_0xce54bd});else{if(_0x3e8431==='usearch')_0x5287c5=requireUsearch()(_0x274821,{'dims':_0x590ecd,'dir':_0xce54bd});else throw new Error('Unknown\x20algorithm:\x20\x22'+_0x3e8431+'\x22');}}function _0x24fe62(){const _0x5ec1c2=_0x10d3c9;try{_0x40c05e[_0x5ec1c2(0x1da)]({'op':'sync','count':_0x5287c5[_0x5ec1c2(0x1cb)](),'info':_0x5287c5[_0x5ec1c2(0x17b)](),'memory':process[_0x5ec1c2(0x164)]()});}catch{}}return _0x40c05e['on'](_0x10d3c9(0x143),async _0x4f7b9b=>{const _0x55f3af=_0x10d3c9,{id:_0x2d8097,op:_0x54eb41,args:_0x43a19e}=_0x4f7b9b;try{let _0x5a6c7e;switch(_0x54eb41){case'load':{const _0x25c80a=(_0x43a19e[_0x55f3af(0x192)]||[])[_0x55f3af(0x144)](_0x26ff28=>({'key':_0x26ff28['key'],'vector':_0x26ff28['vector']instanceof Float32Array?_0x26ff28[_0x55f3af(0x1eb)]:new Float32Array(_0x26ff28[_0x55f3af(0x1eb)])}));_0x5a6c7e=await _0x5287c5[_0x55f3af(0x1c6)](async()=>_0x25c80a),_0x24fe62();break;}case _0x55f3af(0x140):{const _0xb44930=_0x43a19e[_0x55f3af(0x1eb)]instanceof Float32Array?_0x43a19e[_0x55f3af(0x1eb)]:new Float32Array(_0x43a19e['vector']);await _0x5287c5['add'](_0x43a19e[_0x55f3af(0x1b0)],_0xb44930,_0x43a19e[_0x55f3af(0x14b)]??undefined),_0x24fe62(),_0x5a6c7e=null;break;}case _0x55f3af(0x1f0):{await _0x5287c5['remove'](_0x43a19e['key']),_0x24fe62(),_0x5a6c7e=null;break;}case _0x55f3af(0x1cf):{const _0x38786d=_0x43a19e[_0x55f3af(0x145)]instanceof Float32Array?_0x43a19e[_0x55f3af(0x145)]:new Float32Array(_0x43a19e[_0x55f3af(0x145)]);_0x5a6c7e=_0x5287c5['search'](_0x38786d,_0x43a19e[_0x55f3af(0x1fa)]||{});break;}case _0x55f3af(0x17a):{_0x5a6c7e=await _0x5287c5['snapshot'](_0x43a19e['clock']),_0x24fe62();break;}case _0x55f3af(0x1a0):{const _0x2aaa2a=(_0x43a19e[_0x55f3af(0x192)]||[])[_0x55f3af(0x144)](_0x3adbd0=>({'key':_0x3adbd0[_0x55f3af(0x1b0)],'vector':_0x3adbd0[_0x55f3af(0x1eb)]instanceof Float32Array?_0x3adbd0[_0x55f3af(0x1eb)]:new Float32Array(_0x3adbd0[_0x55f3af(0x1eb)])}));await _0x5287c5[_0x55f3af(0x1a0)](async()=>_0x2aaa2a),_0x24fe62(),_0x5a6c7e=null;break;}case _0x55f3af(0x1e3):{await _0x5287c5[_0x55f3af(0x1e3)](),_0x24fe62(),_0x5a6c7e=null;break;}case _0x55f3af(0x1cb):{_0x5a6c7e=_0x5287c5['count']();break;}case _0x55f3af(0x17b):{_0x5a6c7e=_0x5287c5[_0x55f3af(0x17b)]();break;}default:throw new Error(_0x55f3af(0x1b6)+_0x54eb41+'\x22');}_0x40c05e['postMessage']({'id':_0x2d8097,'result':_0x5a6c7e});}catch(_0xeaffec){_0x40c05e[_0x55f3af(0x1da)]({'id':_0x2d8097,'error':{'message':_0xeaffec?.[_0x55f3af(0x143)]||String(_0xeaffec),'code':_0xeaffec?.['code']}});}}),_0x40c05e['postMessage']({'op':_0x10d3c9(0x1b1)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module[_0x2f1a82(0x1a9)]=algorithmWorkerThread;
1
+ 'use strict';function _0x5cec(_0x4613c8,_0xa10b64){_0x4613c8=_0x4613c8-0xd4;const _0x3a0785=_0x3a07();let _0x5cecfb=_0x3a0785[_0x4613c8];return _0x5cecfb;}const _0x11b94d=_0x5cec;(function(_0x4e0afe,_0x592238){const _0x154bed=_0x5cec,_0x55a29e=_0x4e0afe();while(!![]){try{const _0x163b41=-parseInt(_0x154bed(0xdc))/0x1*(-parseInt(_0x154bed(0x13b))/0x2)+parseInt(_0x154bed(0x120))/0x3*(parseInt(_0x154bed(0x116))/0x4)+-parseInt(_0x154bed(0x130))/0x5*(-parseInt(_0x154bed(0xdb))/0x6)+-parseInt(_0x154bed(0xe1))/0x7*(parseInt(_0x154bed(0xfd))/0x8)+parseInt(_0x154bed(0x1a5))/0x9*(parseInt(_0x154bed(0x11a))/0xa)+-parseInt(_0x154bed(0x19f))/0xb*(parseInt(_0x154bed(0x183))/0xc)+-parseInt(_0x154bed(0x12f))/0xd*(parseInt(_0x154bed(0x17c))/0xe);if(_0x163b41===_0x592238)break;else _0x55a29e['push'](_0x55a29e['shift']());}catch(_0x193b40){_0x55a29e['push'](_0x55a29e['shift']());}}}(_0x3a07,0x55ed0));var require$$0$1=require(_0x11b94d(0x195)),require$$0=require('fs'),require$$1=require(_0x11b94d(0xef)),require$$2=require('os'),require$$3=require(_0x11b94d(0x13f));function getDefaultExportFromCjs(_0x518b7e){const _0x1b0a4a=_0x11b94d;return _0x518b7e&&_0x518b7e[_0x1b0a4a(0x11c)]&&Object[_0x1b0a4a(0x1ad)]['hasOwnProperty']['call'](_0x518b7e,'default')?_0x518b7e[_0x1b0a4a(0x148)]:_0x518b7e;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x1939db=_0x11b94d;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x81280f=require$$0,_0x5a8e40=require$$1,_0x363bf6=require$$2,_0x3aee3a=require$$3;function _0x4ea5a7(){const _0x3f0216=_0x5cec;return Date[_0x3f0216(0x1a7)]();}function _0x29aa02(_0x5712a6){const _0x1d3cc0=_0x5cec;try{return _0x81280f[_0x1d3cc0(0x107)](_0x5712a6);}catch{return![];}}function _0x31b9fa(_0x2b9233){const _0x44790c=_0x5cec;try{return _0x81280f['readFileSync'](_0x2b9233,_0x44790c(0x124));}catch{return null;}}function _0xe4ed84(_0x235a3c,_0x431ab4){const _0x3bf1c2=_0x5cec,_0x43829d=_0x235a3c+_0x3bf1c2(0x186)+_0x3aee3a[_0x3bf1c2(0x146)](0x6)[_0x3bf1c2(0x15b)](_0x3bf1c2(0x181));_0x81280f[_0x3bf1c2(0x170)](_0x43829d,_0x431ab4),_0x81280f[_0x3bf1c2(0x112)](_0x43829d,_0x235a3c);}function _0x2c6f6d(_0x4e9426,_0x1d136a=0x10){const _0x1d93cd=_0x5cec,_0x5dac6a=String(Math[_0x1d93cd(0x16d)](0x0,Math[_0x1d93cd(0x1ae)](_0x4e9426||0x0)));return _0x5dac6a[_0x1d93cd(0x122)]>=_0x1d136a?_0x5dac6a:'0'[_0x1d93cd(0x114)](_0x1d136a-_0x5dac6a[_0x1d93cd(0x122)])+_0x5dac6a;}return snapshotStore=class _0x172db5{constructor({dir:_0x13ec03,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x419358=_0x5cec;if(!_0x13ec03)throw new Error(_0x419358(0x158));this[_0x419358(0x151)]=_0x13ec03,this[_0x419358(0x149)]=_0x5a8e40[_0x419358(0x169)](_0x13ec03,'snapshots'),this['currentPath']=_0x5a8e40[_0x419358(0x169)](_0x13ec03,'CURRENT'),this[_0x419358(0x185)]=_0x5a8e40[_0x419358(0x169)](_0x13ec03,_0x419358(0x193)),this[_0x419358(0x191)]=keepSnapshots,this['log']=log,_0x81280f[_0x419358(0x127)](this[_0x419358(0x151)],{'recursive':!![]}),_0x81280f[_0x419358(0x127)](this[_0x419358(0x149)],{'recursive':!![]});}[_0x1939db(0x10d)](_0x4b8be0){const _0x227196=_0x1939db;return _0x5a8e40['join'](this[_0x227196(0x149)],_0x4b8be0);}[_0x1939db(0x1b2)](_0x57d69b){const _0x31dce7=_0x1939db,_0x20c982=this[_0x31dce7(0x10d)](_0x57d69b);return{'dir':_0x20c982,'index':_0x5a8e40[_0x31dce7(0x169)](_0x20c982,_0x31dce7(0x101)),'labels':_0x5a8e40[_0x31dce7(0x169)](_0x20c982,'labels.json'),'state':_0x5a8e40[_0x31dce7(0x169)](_0x20c982,_0x31dce7(0x119))};}['readCurrentId'](){const _0x11ad5f=_0x1939db;if(!_0x29aa02(this[_0x11ad5f(0x136)]))return null;const _0x33895a=_0x31b9fa(this[_0x11ad5f(0x136)]);if(!_0x33895a)return null;const _0x183d39=String(_0x33895a)['trim']();return _0x183d39||null;}['readCurrentClock'](){const _0x310b67=_0x1939db,_0x94d6ac=this[_0x310b67(0x1ac)]();if(!_0x94d6ac)return 0x0;const _0x271490=Number(_0x94d6ac);return Number[_0x310b67(0xf5)](_0x271490)?_0x271490:0x0;}[_0x1939db(0xfc)](){const _0x2ed3f3=_0x1939db;try{return _0x81280f[_0x2ed3f3(0xf2)](this[_0x2ed3f3(0x149)],{'withFileTypes':!![]})['filter'](_0x2d8fff=>_0x2d8fff[_0x2ed3f3(0x135)]())[_0x2ed3f3(0x141)](_0x53b2b5=>_0x53b2b5['name'])[_0x2ed3f3(0x199)](_0x2ecaf8=>!_0x2ecaf8[_0x2ed3f3(0xd6)](_0x2ed3f3(0x186)))[_0x2ed3f3(0x199)](_0x3f62b7=>!_0x3f62b7[_0x2ed3f3(0xd6)](_0x2ed3f3(0x173)))[_0x2ed3f3(0x10c)]();}catch{return[];}}['latestSnapshotId'](){const _0x14e9ca=_0x1939db,_0x213215=this[_0x14e9ca(0x1ac)]();if(_0x213215)return _0x213215;const _0x4e887b=this[_0x14e9ca(0xfc)]();if(!_0x4e887b[_0x14e9ca(0x122)])return null;return _0x4e887b[_0x4e887b[_0x14e9ca(0x122)]-0x1];}['cleanupTmpDirs']({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x447ea0=_0x1939db;let _0x146661;try{_0x146661=_0x81280f[_0x447ea0(0xf2)](this[_0x447ea0(0x149)],{'withFileTypes':!![]});}catch{return;}const _0x225c34=_0x4ea5a7()-maxAgeMs;for(const _0x5ce5e9 of _0x146661){if(!_0x5ce5e9[_0x447ea0(0x135)]())continue;const _0x56059c=_0x5ce5e9[_0x447ea0(0x16f)];if(!_0x56059c[_0x447ea0(0xd6)](_0x447ea0(0x186))&&!_0x56059c[_0x447ea0(0xd6)](_0x447ea0(0x173)))continue;const _0x4e69b3=_0x5a8e40['join'](this[_0x447ea0(0x149)],_0x56059c);try{const _0x11aeea=_0x81280f[_0x447ea0(0x161)](_0x4e69b3);if(_0x11aeea[_0x447ea0(0x10a)]>_0x225c34)continue;}catch{}try{_0x81280f[_0x447ea0(0x108)](_0x4e69b3,{'recursive':!![],'force':!![]});}catch{}}}[_0x1939db(0x145)]({keep:keep=null}={}){const _0xba2341=_0x1939db,_0x238aa0=Math[_0xba2341(0x16d)](0x1,Math['trunc'](keep??this[_0xba2341(0x191)]??0x3)),_0x13925d=this[_0xba2341(0xfc)]();if(_0x13925d[_0xba2341(0x122)]<=_0x238aa0)return;const _0x83c53b=this[_0xba2341(0x1ac)](),_0x47faa2=_0x13925d[_0xba2341(0x16a)](0x0,Math['max'](0x0,_0x13925d[_0xba2341(0x122)]-_0x238aa0));for(const _0x3dcd35 of _0x47faa2){if(_0x83c53b&&_0x3dcd35===_0x83c53b)continue;const _0x5d9d1f=this['_snapshotDir'](_0x3dcd35);try{_0x81280f[_0xba2341(0x108)](_0x5d9d1f,{'recursive':!![],'force':!![]});}catch{}}}async[_0x1939db(0x198)](_0x24c673,_0x31ee50){const _0x9359fe=_0x1939db;if(!_0x24c673)throw new Error(_0x9359fe(0xf8));const _0x5c4826=this['_snapshotPaths'](_0x24c673);if(!_0x29aa02(_0x5c4826['index'])||!_0x29aa02(_0x5c4826['labels'])||!_0x29aa02(_0x5c4826[_0x9359fe(0x160)]))throw new Error('snapshot\x20incomplete:\x20'+_0x24c673);const _0x11092f=await _0x31ee50(_0x5c4826);return _0x11092f||{};}async[_0x1939db(0x113)](_0x196036,_0x3ada8e,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x49abbc=_0x1939db,_0x1bd062=Number(_0x196036);if(!Number['isFinite'](_0x1bd062)||_0x1bd062<0x0)throw new Error(_0x49abbc(0xd5));const _0x1a9031=_0x2c6f6d(_0x1bd062),_0x2324f7=this[_0x49abbc(0x10d)](_0x1a9031),_0x3afa24=_0x5a8e40[_0x49abbc(0x169)](this[_0x49abbc(0x149)],_0x49abbc(0x186)+_0x1a9031+'-'+_0x3aee3a[_0x49abbc(0x146)](0x6)[_0x49abbc(0x15b)]('hex'));_0x81280f[_0x49abbc(0x127)](_0x3afa24,{'recursive':!![]});const _0x90a3ab={'dir':_0x3afa24,'index':_0x5a8e40[_0x49abbc(0x169)](_0x3afa24,_0x49abbc(0x101)),'labels':_0x5a8e40[_0x49abbc(0x169)](_0x3afa24,'labels.json'),'state':_0x5a8e40[_0x49abbc(0x169)](_0x3afa24,_0x49abbc(0x119))};await _0x3ada8e(_0x90a3ab,{'id':_0x1a9031,'clock':_0x1bd062});const _0x4a1b82=JSON[_0x49abbc(0x159)]({'pid':process[_0x49abbc(0xe0)],'host':_0x363bf6[_0x49abbc(0x184)](),'at':_0x4ea5a7()}),_0x40d9d6=_0x4ea5a7();let _0x1c001a=null;const _0x52fa55=()=>{const _0x534c27=_0x49abbc;try{const _0x55e3a1=JSON[_0x534c27(0x10e)](_0x81280f['readFileSync'](this[_0x534c27(0x185)],'utf8'));if(_0x55e3a1['at']&&_0x4ea5a7()-_0x55e3a1['at']>staleLockMaxAgeMs){const _0x22d400=_0x4ea5a7()-_0x55e3a1['at'],_0x16d1c5='Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20'+Math[_0x534c27(0x144)](_0x22d400/0x3e8)+_0x534c27(0xea)+_0x55e3a1[_0x534c27(0xe0)]+_0x534c27(0x126)+_0x55e3a1[_0x534c27(0xd4)]+_0x534c27(0x117)+'This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.';this[_0x534c27(0xeb)]?.[_0x534c27(0xe3)]?this[_0x534c27(0xeb)][_0x534c27(0xe3)](_0x16d1c5):console['warn'](_0x534c27(0x176),_0x16d1c5);try{_0x81280f['unlinkSync'](this[_0x534c27(0x185)]);}catch{}return!![];}}catch{try{_0x81280f['unlinkSync'](this['lockPath']);}catch{}}return![];},_0x3fcf8d=()=>{const _0x451459=_0x49abbc;try{return _0x1c001a=_0x81280f[_0x451459(0x14c)](this['lockPath'],'wx'),_0x81280f['writeFileSync'](_0x1c001a,_0x4a1b82),!![];}catch(_0x297e80){if(_0x297e80&&_0x297e80['code']===_0x451459(0x171))return![];throw _0x297e80;}};if(!_0x3fcf8d()){_0x52fa55(),_0x3fcf8d();if(_0x1c001a==null&&lockTimeoutMs>0x0)while(_0x4ea5a7()-_0x40d9d6<lockTimeoutMs){await new Promise(_0x3bc1af=>setTimeout(_0x3bc1af,0x19));if(_0x3fcf8d())break;_0x52fa55();}}if(_0x1c001a==null){try{_0x81280f['rmSync'](_0x3afa24,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x49abbc(0x179)};}try{const _0x1d04f1=this[_0x49abbc(0x103)]();if(_0x1bd062<=_0x1d04f1){try{_0x81280f[_0x49abbc(0x108)](_0x3afa24,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':'stale','currentClock':_0x1d04f1};}if(!_0x29aa02(_0x2324f7))_0x81280f[_0x49abbc(0x112)](_0x3afa24,_0x2324f7);else try{_0x81280f['rmSync'](_0x3afa24,{'recursive':!![],'force':!![]});}catch{}return _0xe4ed84(this[_0x49abbc(0x136)],_0x1a9031+'\x0a'),this[_0x49abbc(0x145)]({'keep':keep}),{'published':!![],'currentClock':_0x1bd062};}finally{try{_0x81280f[_0x49abbc(0x14d)](_0x1c001a);}catch{}try{_0x81280f[_0x49abbc(0x109)](this['lockPath']);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x11417a=_0x11b94d;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x582098=require$$0;class _0x1f4c5c{constructor(){const _0x3db94b=_0x5cec;this['keyToLabel']=new Map(),this['labelToKey']=new Map(),this['nextLabel']=0x0,this['_tombstoneCount']=0x0,this[_0x3db94b(0x187)]=new Map(),this['hasFingerprints']=!![];}async['reset'](){const _0x428a97=_0x5cec;this[_0x428a97(0xda)]=new Map(),this[_0x428a97(0x14e)]=new Map(),this[_0x428a97(0x187)]=new Map(),this[_0x428a97(0x129)]=!![],this[_0x428a97(0x16c)]=0x0,this['_tombstoneCount']=0x0;}async[_0x11417a(0x162)](_0x1e5e52){const _0x5bb443=_0x11417a;if(!_0x1e5e52||!_0x582098[_0x5bb443(0x107)](_0x1e5e52))return await this[_0x5bb443(0x1b1)](),!![];let _0xa0c591;try{_0xa0c591=_0x582098[_0x5bb443(0x1ab)](_0x1e5e52,'utf8');}catch{return await this['reset'](),!![];}let _0x522fdc;try{_0x522fdc=JSON['parse'](_0xa0c591);}catch{return await this['reset'](),!![];}const _0x2fc2ba=Array[_0x5bb443(0x12b)](_0x522fdc?.[_0x5bb443(0x174)])?_0x522fdc[_0x5bb443(0x174)]:[],_0x3c833c=Number[_0x5bb443(0x131)](_0x522fdc?.['nextLabel'])?_0x522fdc['nextLabel']:0x0,_0x588e4c=new Map(),_0x3a3d07=new Map(),_0x1e6596=new Map(),_0x3c486b=_0x522fdc?.[_0x5bb443(0x137)]>=0x2;let _0xfff1cd=-0x1;for(const _0x463c1b of _0x2fc2ba){if(!Array['isArray'](_0x463c1b)||_0x463c1b['length']<0x2)continue;const _0x39ff4b=Number(_0x463c1b[0x0]),_0xa1972e=String(_0x463c1b[0x1]??'');if(!Number[_0x5bb443(0x131)](_0x39ff4b)||_0x39ff4b<0x0)continue;if(!_0xa1972e)continue;_0x588e4c[_0x5bb443(0x128)](_0xa1972e,_0x39ff4b),_0x3a3d07[_0x5bb443(0x128)](_0x39ff4b,_0xa1972e);if(_0x3c486b&&typeof _0x463c1b[0x2]==='number')_0x1e6596['set'](_0xa1972e,_0x463c1b[0x2]);if(_0x39ff4b>_0xfff1cd)_0xfff1cd=_0x39ff4b;}return this[_0x5bb443(0xda)]=_0x588e4c,this['labelToKey']=_0x3a3d07,this[_0x5bb443(0x187)]=_0x1e6596,this[_0x5bb443(0x129)]=_0x3c486b,this[_0x5bb443(0x16c)]=Math['max'](_0x3c833c,_0xfff1cd+0x1,0x0),this[_0x5bb443(0x15c)]=0x0,!![];}[_0x11417a(0x18a)](_0x48e5d0){const _0xc577e6=_0x11417a;return this['keyToLabel'][_0xc577e6(0x16e)](_0x48e5d0);}[_0x11417a(0xee)](_0x4e8bbd){const _0x348c28=_0x11417a;let _0xf1c8f5=this['keyToLabel'][_0x348c28(0x16e)](_0x4e8bbd);if(_0xf1c8f5!==undefined)return _0xf1c8f5;return _0xf1c8f5=this[_0x348c28(0x16c)]++,this[_0x348c28(0xda)]['set'](_0x4e8bbd,_0xf1c8f5),this['labelToKey'][_0x348c28(0x128)](_0xf1c8f5,_0x4e8bbd),_0xf1c8f5;}[_0x11417a(0x10b)](_0x3a1ac7,_0x4c853d){const _0x3c6488=_0x11417a;if(_0x4c853d==null)this['keyToFp']['delete'](_0x3a1ac7);else this['keyToFp'][_0x3c6488(0x128)](_0x3a1ac7,_0x4c853d);}['fingerprintOf'](_0x4bea5f){const _0x56b4e9=_0x11417a;return this[_0x56b4e9(0x187)]['get'](_0x4bea5f);}[_0x11417a(0x15e)](){const _0x551b66=_0x11417a;return this['keyToLabel'][_0x551b66(0x15e)]();}[_0x11417a(0x166)](_0x15ea17){const _0x29ce25=_0x11417a,_0x599c28=this[_0x29ce25(0xda)][_0x29ce25(0x16e)](_0x15ea17);if(_0x599c28===undefined)return;this[_0x29ce25(0x187)][_0x29ce25(0xe8)](_0x15ea17),this[_0x29ce25(0xda)][_0x29ce25(0xe8)](_0x15ea17),this[_0x29ce25(0x14e)][_0x29ce25(0xe8)](_0x599c28),this['_tombstoneCount']++;}[_0x11417a(0x190)](_0x234b56){const _0x7d40d9=_0x11417a;return this[_0x7d40d9(0x14e)][_0x7d40d9(0x16e)](_0x234b56)??null;}[_0x11417a(0x134)](){const _0x5f203d=_0x11417a;return this[_0x5f203d(0xda)][_0x5f203d(0x134)];}[_0x11417a(0x196)](){const _0x4a26e3=_0x11417a;return this[_0x4a26e3(0x15c)];}async['snapshotTo'](_0x5dd1f5){const _0x511a7e=_0x11417a,_0x4290a4=_0x5dd1f5+_0x511a7e(0x12a),_0x9384ea=[];for(const [_0x1a9697,_0x39512d]of this[_0x511a7e(0x14e)][_0x511a7e(0x174)]()){const _0x3aec33=this[_0x511a7e(0x187)]['get'](_0x39512d);_0x9384ea[_0x511a7e(0x194)](_0x3aec33==null?[_0x1a9697,_0x39512d]:[_0x1a9697,_0x39512d,_0x3aec33]);}_0x9384ea[_0x511a7e(0x10c)]((_0xeb4a26,_0x2e7157)=>_0xeb4a26[0x0]-_0x2e7157[0x0]);const _0x240f45={'version':0x2,'nextLabel':this[_0x511a7e(0x16c)],'entries':_0x9384ea};_0x582098[_0x511a7e(0x170)](_0x4290a4,JSON[_0x511a7e(0x159)](_0x240f45)),_0x582098['renameSync'](_0x4290a4,_0x5dd1f5);}}return labelMap=_0x1f4c5c,labelMap;}var indexConvergence,hasRequiredIndexConvergence;function _0x3a07(){const _0x150cda=[').\x20','efConstruction','state.json','10xwrOMV','hnswlib-node','__esModule','count','latestSnapshotId','search','3bbHbuK','queryVec','length','sqrt','utf8','hasRows',',\x20host:\x20','mkdirSync','set','hasFingerprints','.tmp','isArray','clear','ENOENT','searchKnn','1001078KvDNBc','1942235iMIBKU','isInteger','node','load','size','isDirectory','currentPath','version','labels','buffer','algorithm','420380slTJHZ','save','catch','Cos','crypto','hnsw','map','Unknown\x20op:\x20\x22','readIndexSync','round','prune','randomBytes','capacity','default','snapshotsDir','getCurrentCount','published','openSync','closeSync','labelToKey','distances','connectivity','dir','vector','score','expansionSearch','USEARCH_BINDINGS_UNAVAILABLE','snapshot','versions','SnapshotStore\x20requires\x20dir','stringify','snapshotEveryChanges','toString','_tombstoneCount','code','keys','min','state','statSync','loadFrom','ceil','writer','arch','tombstone','markDelete','unref','join','slice','sync','nextLabel','max','get','name','writeFileSync','EEXIST','snapshotTo','_tmp-','entries','unreadable','[SnapshotStore]','finally','growFactor','lock_busy','opts','token','28KRmpCS','imul','writerLockMaxAgeMs','stop','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20','hex','HierarchicalNSW','24liUWnT','hostname','lockPath','.tmp-','keyToFp','usearch','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','labelForExisting','heartbeatIntervalMs','info','key','metric','HNSW_BINDINGS_UNAVAILABLE','keyForLabel','keepSnapshots','manifestVersion','SNAPSHOT.LOCK','push','worker_threads','tombstoneCount','removed','loadSnapshot','filter','exports','resolve','initIndex','remove','getMaxElements','2249896rWVRLb','clock','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','expansionAdd','fetchAllResult','view','768699uhKXCW','platform','now','L2sq','index','cosine','readFileSync','readCurrentId','prototype','trunc','efSearch','message','reset','_snapshotPaths','host','candidateClock\x20must\x20be\x20finite\x20>=\x200','startsWith','from','resizeIndex','then','keyToLabel','6OTLjrT','1EyOGMG','MetricKind','cleanupTmpDirs','release','pid','3059vCLNFF','fid','warn','postMessage','for\x20Node\x20','vectors','added','delete','snapshotMaxLagMs','s,\x20pid:\x20','log','fingerprintOf','writeIndexSync','labelForEphemeral','path','addPoint','\x20on\x20','readdirSync','rebuild','error','isFinite','add','Original\x20error:\x20','snapshot\x20id\x20required','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','tmpMaxAgeMs','isFree','listSnapshotIds','2216ecRDcy','acquire','flat','dims','index.hnsw','cause','readCurrentClock','viewRefreshMs','fetchAll','ready','existsSync','rmSync','unlinkSync','mtimeMs','setFingerprint','sort','_snapshotDir','parse','setEf','memoryUsage','maxElements','renameSync','publishSnapshot','repeat','reject','1408148eDfTby'];_0x3a07=function(){return _0x150cda;};return _0x3a07();}function requireIndexConvergence(){if(hasRequiredIndexConvergence)return indexConvergence;hasRequiredIndexConvergence=0x1;function _0x2ee783(_0xe57e69){const _0x494a0b=_0x5cec,_0x552479=new Uint32Array(_0xe57e69[_0x494a0b(0x139)],_0xe57e69['byteOffset'],_0xe57e69[_0x494a0b(0x122)]);let _0x4fc3d3=0x811c9dc5,_0x44b8e9=0x9747b28c;for(let _0x2a0fee=0x0;_0x2a0fee<_0x552479[_0x494a0b(0x122)];_0x2a0fee++){const _0x1d623b=_0x552479[_0x2a0fee];_0x4fc3d3=Math[_0x494a0b(0x17d)](_0x4fc3d3^_0x1d623b,0x1000193)>>>0x0;let _0x5edf11=Math[_0x494a0b(0x17d)](_0x1d623b,0xcc9e2d51);_0x5edf11=_0x5edf11<<0xf|_0x5edf11>>>0x11,_0x44b8e9=Math[_0x494a0b(0x17d)](_0x44b8e9^Math[_0x494a0b(0x17d)](_0x5edf11,0x1b873593),0x5)+0xe6546b64,_0x44b8e9>>>=0x0;}return _0x44b8e9=Math[_0x494a0b(0x17d)](_0x44b8e9^_0x44b8e9>>>0x10,0x85ebca6b)>>>0x0,(_0x4fc3d3>>>0x0)*0x100000+(_0x44b8e9&0xfffff);}function _0x230aca(_0x3ec7c8,_0x5eed4b,_0x1c1abb,{upsert:_0x541e9b,remove:_0x4ca18c}){const _0x1b20a8=_0x5cec,_0xc382a7=new Set();let _0x35626c=0x0,_0x215584=0x0,_0x260976=0x0;for(const {key:_0x1d9905,vector:_0x474ef5}of _0x5eed4b){if(!(_0x474ef5 instanceof Float32Array)||_0x474ef5[_0x1b20a8(0x122)]!==_0x1c1abb)continue;_0xc382a7[_0x1b20a8(0xf6)](_0x1d9905);const _0x131fb7=_0x2ee783(_0x474ef5),_0x2b5f18=_0x3ec7c8[_0x1b20a8(0x18a)](_0x1d9905)!==undefined;if(_0x2b5f18&&_0x3ec7c8[_0x1b20a8(0xec)](_0x1d9905)===_0x131fb7)continue;_0x541e9b(_0x1d9905,_0x474ef5,_0x131fb7);if(_0x2b5f18)_0x215584++;else _0x35626c++;}for(const _0x1dc5a4 of[..._0x3ec7c8['keys']()]){if(_0xc382a7['has'](_0x1dc5a4))continue;_0x4ca18c(_0x1dc5a4),_0x260976++;}return{'added':_0x35626c,'changed':_0x215584,'removed':_0x260976};}return indexConvergence={'fingerprint':_0x2ee783,'reconcileIndex':_0x230aca},indexConvergence;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x3507d0=requireSnapshotStore(),_0x2a029e=requireLabelMap(),{fingerprint:_0x49a6b0,reconcileIndex:_0x5a0382}=requireIndexConvergence(),_0x28d7b4=0x1;let _0x30fd38=null;function _0x5e8f6e(){const _0x226130=_0x5cec;if(_0x30fd38)return _0x30fd38;try{return _0x30fd38=require(_0x226130(0x11b)),_0x30fd38;}catch(_0x579a9b){const _0x5d215c=new Error('HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20'+(_0x226130(0xe5)+process['versions'][_0x226130(0x132)]+_0x226130(0xf1)+process[_0x226130(0x1a6)]+'/'+process[_0x226130(0x165)]+'.\x20')+'Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20'+(_0x226130(0xf7)+(_0x579a9b?.[_0x226130(0x1b0)]||String(_0x579a9b))));_0x5d215c[_0x226130(0x15d)]=_0x226130(0x18f),_0x5d215c[_0x226130(0x102)]=_0x579a9b;throw _0x5d215c;}}return hnsw=function _0x4487e3(_0x237714={},{dims:_0x5e11cc,dir:_0x206042}){const _0x449f92=_0x5cec,_0x4dfc51=_0x5e8f6e();if(!_0x5e11cc||_0x5e11cc<=0x0)throw new Error(_0x449f92(0xf9));if(!_0x206042)throw new Error(_0x449f92(0x189));const _0xb5f86e={'metric':_0x237714[_0x449f92(0x18e)]??_0x449f92(0x1aa),'M':_0x237714['M']??0x10,'efConstruction':_0x237714[_0x449f92(0x118)]??0xc8,'efSearch':_0x237714[_0x449f92(0x1af)]??0x40,'maxElements':_0x237714[_0x449f92(0x111)]??0x400,'growFactor':_0x237714['growFactor']??0x2,'snapshotEveryChanges':_0x237714[_0x449f92(0x15a)]??0xc350,'keepSnapshots':_0x237714[_0x449f92(0x191)]??0x2,'tmpMaxAgeMs':_0x237714[_0x449f92(0xfa)]??0x6*0x36ee80},_0x55ddbc=new _0x3507d0({'dir':_0x206042,'keepSnapshots':_0xb5f86e[_0x449f92(0x191)]}),_0x33cd72=new _0x2a029e();let _0x3cf7b3=null,_0x587d52=0x0,_0x47fa25=null,_0x276bbd=Promise['resolve']();const _0x47bd4b=_0x3117ce=>{const _0x5189f1=_0x449f92,_0x297c2b=_0x276bbd[_0x5189f1(0xd9)](_0x3117ce);return _0x276bbd=_0x297c2b[_0x5189f1(0x13d)](()=>{}),_0x297c2b;};async function _0x3bfdd4(_0x4b773d){const _0x3d6c1d=_0x449f92;await _0x33cd72[_0x3d6c1d(0x1b1)](),_0x4b773d=_0x4b773d??[];const _0x326ead=Math[_0x3d6c1d(0x16d)](_0xb5f86e[_0x3d6c1d(0x111)],Math[_0x3d6c1d(0x163)](_0x4b773d[_0x3d6c1d(0x122)]*(_0xb5f86e['growFactor']||1.2)),0x1);_0x3cf7b3=new _0x4dfc51[(_0x3d6c1d(0x182))](_0xb5f86e['metric'],_0x5e11cc),_0x3cf7b3[_0x3d6c1d(0x19c)]({'maxElements':_0x326ead,'efConstruction':_0xb5f86e[_0x3d6c1d(0x118)],'M':_0xb5f86e['M']});for(const {key:_0x2ed8ea,vector:_0x198409}of _0x4b773d){if(!(_0x198409 instanceof Float32Array)||_0x198409['length']!==_0x5e11cc)continue;_0x316b44(_0x2ed8ea,_0x198409);}_0x3cf7b3[_0x3d6c1d(0x10f)](_0xb5f86e['efSearch']),_0x587d52=0x0;}async function _0x25de4f(_0x5cd7c8){return _0x3bfdd4(_0x5cd7c8?await _0x5cd7c8():[]);}function _0x7dcd0(){const _0x5d7eac=_0x449f92;if(_0x3cf7b3['getCurrentCount']()<_0x3cf7b3['getMaxElements']())return;const _0x284afe=Math[_0x5d7eac(0x163)](_0x3cf7b3[_0x5d7eac(0x19e)]()*(_0xb5f86e[_0x5d7eac(0x178)]||0x2));_0x3cf7b3[_0x5d7eac(0xd8)](_0x284afe),_0xb5f86e[_0x5d7eac(0x111)]=_0x284afe;}function _0x316b44(_0xdc8068,_0x416ae3,_0x416c0d){const _0xff2996=_0x449f92,_0x3a36e3=_0x33cd72[_0xff2996(0xee)](_0xdc8068);try{_0x3cf7b3[_0xff2996(0x167)](_0x3a36e3);}catch{}_0x7dcd0(),_0x3cf7b3[_0xff2996(0xf0)](Array[_0xff2996(0xd7)](_0x416ae3),_0x3a36e3),_0x33cd72[_0xff2996(0x10b)](_0xdc8068,_0x416c0d??_0x49a6b0(_0x416ae3));}function _0x368c55(_0x32213d){const _0x1e669c=_0x449f92,_0x32bc09=_0x33cd72[_0x1e669c(0x18a)](_0x32213d);if(_0x32bc09===undefined)return![];try{_0x3cf7b3[_0x1e669c(0x167)](_0x32bc09);}catch{}return _0x33cd72[_0x1e669c(0x166)](_0x32213d),!![];}function _0x41b54b(){const _0x17f39b=_0x449f92;return Math[_0x17f39b(0x16d)](Date[_0x17f39b(0x1a7)](),_0x55ddbc[_0x17f39b(0x103)]()+0x1);}async function _0x341588(_0x4f5590){const _0x28402d=_0x449f92;if(!_0x3cf7b3||!_0x4f5590)return![];const _0xc2ae52=await _0x55ddbc[_0x28402d(0x113)](_0x4f5590,async _0x323941=>{const _0x345efa=_0x28402d;_0x3cf7b3[_0x345efa(0xed)](_0x323941[_0x345efa(0x1a9)]),await _0x33cd72[_0x345efa(0x172)](_0x323941[_0x345efa(0x138)]);const _0x525c68=require$$0;_0x525c68[_0x345efa(0x170)](_0x323941[_0x345efa(0x160)],JSON[_0x345efa(0x159)]({'manifestVersion':_0x28d7b4,'dims':_0x5e11cc,'metric':_0xb5f86e[_0x345efa(0x18e)],'clock':_0x4f5590,'snapshotAt':Date[_0x345efa(0x1a7)]()},null,0x2));},{'keep':_0xb5f86e['keepSnapshots']});if(_0xc2ae52?.[_0x28402d(0x14b)])_0x587d52=0x0;return _0xc2ae52?.['published']??![];}async function _0x3aa5d4(){const _0x2a9239=_0x449f92,_0x22db42=_0x55ddbc[_0x2a9239(0x1ac)]()||_0x55ddbc['latestSnapshotId']();if(!_0x22db42)return null;let _0x2f694b,_0x26a607=![];return await _0x55ddbc[_0x2a9239(0x198)](_0x22db42,async _0x36cf0a=>{const _0x2c794a=_0x2a9239,_0x153b39=require$$0;_0x2f694b=JSON[_0x2c794a(0x10e)](_0x153b39[_0x2c794a(0x1ab)](_0x36cf0a[_0x2c794a(0x160)],'utf8'));if(_0x2f694b[_0x2c794a(0x192)]!==_0x28d7b4||_0x2f694b[_0x2c794a(0x100)]!==_0x5e11cc||_0x2f694b['metric']!==_0xb5f86e[_0x2c794a(0x18e)]){_0x2f694b=null;return;}await _0x33cd72['loadFrom'](_0x36cf0a[_0x2c794a(0x138)]),_0x3cf7b3=new _0x4dfc51[(_0x2c794a(0x182))](_0xb5f86e[_0x2c794a(0x18e)],_0x5e11cc),_0x3cf7b3[_0x2c794a(0x143)](_0x36cf0a[_0x2c794a(0x1a9)]),_0x3cf7b3[_0x2c794a(0x10f)](_0xb5f86e[_0x2c794a(0x1af)]),_0x26a607=!![];}),_0x26a607?_0x2f694b?.[_0x2a9239(0x1a0)]??0x0:null;}return{async 'load'(_0x537df2){return _0x47bd4b(async()=>{const _0x1292fc=_0x5cec;_0x55ddbc[_0x1292fc(0xde)]({'maxAgeMs':_0xb5f86e[_0x1292fc(0xfa)]}),_0x47fa25=_0x537df2??null;const _0x2c7527=await _0x3aa5d4(),_0x4d62f0=_0x537df2?await _0x537df2():null;if(_0x2c7527!=null){if(_0x4d62f0){if(!_0x33cd72[_0x1292fc(0x129)])return await _0x3bfdd4(_0x4d62f0),null;const _0x3045c2=_0x5a0382(_0x33cd72,_0x4d62f0,_0x5e11cc,{'upsert':_0x316b44,'remove':_0x368c55});_0x587d52+=_0x3045c2[_0x1292fc(0xe7)]+_0x3045c2['changed']+_0x3045c2['removed'];}return _0x2c7527;}return await _0x3bfdd4(_0x4d62f0),null;});},async 'add'(_0x4b8e09,_0x5d2953,_0x1a6362){return _0x47bd4b(async()=>{const _0x2e30c2=_0x5cec;if(!_0x3cf7b3)return;const _0x28d463=_0x5d2953 instanceof Float32Array?_0x5d2953:new Float32Array(_0x5d2953),_0x37b3ee=_0x49a6b0(_0x28d463);if(_0x33cd72[_0x2e30c2(0xec)](_0x4b8e09)===_0x37b3ee)return;_0x316b44(_0x4b8e09,_0x28d463,_0x37b3ee),_0x587d52++,_0x587d52>=_0xb5f86e[_0x2e30c2(0x15a)]&&await _0x341588(_0x41b54b());});},async 'remove'(_0x36179c){return _0x47bd4b(async()=>{if(!_0x3cf7b3)return;if(_0x368c55(_0x36179c))_0x587d52++;});},'search'(_0x185fca,{limit:limit=0xa,efSearch:_0x144e7e}={}){const _0xed8294=_0x449f92;if(!_0x3cf7b3)return[];if(Number[_0xed8294(0x131)](_0x144e7e))_0x3cf7b3[_0xed8294(0x10f)](_0x144e7e);const _0x26563a=Math['min'](limit,_0x3cf7b3[_0xed8294(0x14a)]()||0x1),{neighbors:_0x5a01f,distances:_0x806fc}=_0x3cf7b3[_0xed8294(0x12e)](Array[_0xed8294(0xd7)](_0x185fca),_0x26563a),_0x3f7fd9=[];for(let _0xbe2c24=0x0;_0xbe2c24<_0x5a01f[_0xed8294(0x122)];_0xbe2c24++){const _0x4e8b16=_0x33cd72['keyForLabel'](_0x5a01f[_0xbe2c24]);if(!_0x4e8b16)continue;const _0x436a91=_0xb5f86e[_0xed8294(0x18e)]===_0xed8294(0x1aa)?Math[_0xed8294(0x16d)](0x0,0x1-_0x806fc[_0xbe2c24]):0x1/(0x1+_0x806fc[_0xbe2c24]);_0x3f7fd9['push']({'key':_0x4e8b16,'score':_0x436a91});}return _0x3f7fd9;},async 'snapshot'(_0x359cee){return _0x47bd4b(()=>_0x341588(_0x359cee??_0x41b54b()));},async 'rebuild'(_0x2a633d){return _0x47bd4b(()=>{if(_0x2a633d!=null)_0x47fa25=_0x2a633d;return _0x25de4f(_0x2a633d??_0x47fa25);});},async 'stop'(){const _0x2aa313=_0x449f92;return _0x47bd4b(()=>_0x587d52>0x0||!_0x55ddbc[_0x2aa313(0x1ac)]()?_0x341588(_0x41b54b()):![]);},'count'(){const _0x21dfc0=_0x449f92;return _0x33cd72[_0x21dfc0(0x134)]();},'info'(){const _0xd86bac=_0x449f92;return{'algorithm':_0xd86bac(0x140),'metric':_0xb5f86e[_0xd86bac(0x18e)],'M':_0xb5f86e['M'],'efConstruction':_0xb5f86e[_0xd86bac(0x118)],'efSearch':_0xb5f86e[_0xd86bac(0x1af)],'maxElements':_0x3cf7b3?.[_0xd86bac(0x19e)]()??_0xb5f86e[_0xd86bac(0x111)],'count':_0x33cd72[_0xd86bac(0x134)](),'changesSince':_0x587d52,'snapshotDir':_0x206042,'latestSnapshot':_0x55ddbc[_0xd86bac(0x1ac)]()??null};}};},hnsw;}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x47f3c4(_0x121e64={}){const _0x25c2ec=new Map();return{async 'load'(_0x3e244a){const _0x422a1c=_0x5cec;_0x25c2ec[_0x422a1c(0x12c)]();if(_0x3e244a)for(const {key:_0x286630,vector:_0x3fc258}of await _0x3e244a()){_0x25c2ec['set'](_0x286630,_0x3fc258);}},async 'add'(_0x16ca98,_0x1a5480,_0x1baf76){_0x25c2ec['set'](_0x16ca98,_0x1a5480);},async 'remove'(_0x2573b5){_0x25c2ec['delete'](_0x2573b5);},'search'(_0x5e66d8,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x2bd672=_0x5cec,_0x236726=[];for(const [_0x31468d,_0x228db7]of _0x25c2ec){const _0x2acdf6=_0x22a649(_0x5e66d8,_0x228db7);if(_0x2acdf6>=threshold)_0x236726['push']({'key':_0x31468d,'score':_0x2acdf6});}return _0x236726[_0x2bd672(0x10c)]((_0x22fd1f,_0x2bab92)=>_0x2bab92[_0x2bd672(0x153)]-_0x22fd1f['score']),_0x236726['slice'](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x338445){const _0x4166af=_0x5cec;await this[_0x4166af(0x133)](_0x338445);},async 'stop'(){},'count'(){return _0x25c2ec['size'];},'info'(){const _0x1bcfc2=_0x5cec;return{'algorithm':_0x1bcfc2(0xff),'count':_0x25c2ec[_0x1bcfc2(0x134)]};}};};function _0x22a649(_0x159664,_0x417929){const _0x1c3644=_0x5cec;let _0x163d01=0x0,_0x7edf43=0x0,_0x451585=0x0;for(let _0x3dc001=0x0;_0x3dc001<_0x159664['length'];_0x3dc001++){_0x163d01+=_0x159664[_0x3dc001]*_0x417929[_0x3dc001],_0x7edf43+=_0x159664[_0x3dc001]*_0x159664[_0x3dc001],_0x451585+=_0x417929[_0x3dc001]*_0x417929[_0x3dc001];}const _0x1e0440=Math[_0x1c3644(0x123)](_0x7edf43)*Math[_0x1c3644(0x123)](_0x451585);return _0x1e0440===0x0?0x0:_0x163d01/_0x1e0440;}return flat;}var writerLock,hasRequiredWriterLock;function requireWriterLock(){if(hasRequiredWriterLock)return writerLock;hasRequiredWriterLock=0x1;const _0x306083=require$$0,_0x286d40=require$$1,_0xc2e837=require$$3;return writerLock=function _0x5b7feb(_0x176dc7,{maxAgeMs:maxAgeMs=0x3a98,heartbeatMs:heartbeatMs=0x1388,onLost:onLost=null}={}){const _0x67bbc4=_0x5cec,_0x4cf671=_0x286d40['join'](_0x176dc7,'WRITER.LOCK'),_0x417cc3=_0xc2e837[_0x67bbc4(0x146)](0x8)['toString'](_0x67bbc4(0x181));let _0x1f29d9=![],_0x41c0b1=null;const _0x412547=()=>JSON[_0x67bbc4(0x159)]({'pid':process[_0x67bbc4(0xe0)],'token':_0x417cc3,'at':Date[_0x67bbc4(0x1a7)]()});function _0x3db1e7(){const _0x5df14a=_0x67bbc4;try{return JSON[_0x5df14a(0x10e)](_0x306083[_0x5df14a(0x1ab)](_0x4cf671,_0x5df14a(0x124)));}catch(_0x4ed965){return _0x4ed965?.['code']===_0x5df14a(0x12d)?null:{'unreadable':!![]};}}function _0x247c35(){const _0x22bb46=_0x67bbc4;try{const _0x39d8d0=_0x306083[_0x22bb46(0x14c)](_0x4cf671,'wx');try{_0x306083[_0x22bb46(0x170)](_0x39d8d0,_0x412547());}finally{_0x306083[_0x22bb46(0x14d)](_0x39d8d0);}return!![];}catch(_0x2f9936){if(_0x2f9936?.[_0x22bb46(0x15d)]===_0x22bb46(0x171))return![];throw _0x2f9936;}}function _0x1c46fb(_0x290091){const _0x56a481=_0x67bbc4;if(!_0x290091)return!![];if(_0x290091['unreadable'])return!![];return Date[_0x56a481(0x1a7)]()-(_0x290091['at']??0x0)>=maxAgeMs;}function _0x57f8b2(){if(_0x41c0b1)clearInterval(_0x41c0b1);_0x41c0b1=null;}function _0xe3643c(){_0x57f8b2(),_0x41c0b1=setInterval(()=>{const _0x5ab0c3=_0x5cec,_0x1d0a24=_0x3db1e7();if(_0x1d0a24&&!_0x1d0a24[_0x5ab0c3(0x175)]&&_0x1d0a24[_0x5ab0c3(0x17b)]!==_0x417cc3){_0x1f29d9=![],_0x57f8b2();try{onLost?.();}catch{}return;}try{_0x306083[_0x5ab0c3(0x170)](_0x4cf671,_0x412547());}catch{}},heartbeatMs),_0x41c0b1['unref']?.();}function _0x50201e(){const _0x4a9241=_0x67bbc4,_0x21ad0e=_0x3db1e7();return!!_0x21ad0e&&_0x21ad0e[_0x4a9241(0x17b)]===_0x417cc3;}return{'path':_0x4cf671,'token':_0x417cc3,'acquire'(){const _0x87b970=_0x67bbc4,_0x302fd2=_0x3db1e7();if(_0x302fd2&&_0x302fd2[_0x87b970(0x17b)]===_0x417cc3){_0x1f29d9=!![];if(!_0x41c0b1)_0xe3643c();return!![];}let _0x51cd52=_0x247c35();if(!_0x51cd52&&_0x1c46fb(_0x3db1e7())){try{_0x306083[_0x87b970(0x109)](_0x4cf671);}catch{}_0x51cd52=_0x247c35();}if(_0x51cd52&&!_0x50201e())_0x51cd52=![];_0x1f29d9=_0x51cd52;if(_0x51cd52)_0xe3643c();return _0x51cd52;},'held'(){return _0x1f29d9;},'isFree'(){const _0x5bc62b=_0x67bbc4,_0x1fc7d5=_0x3db1e7();if(_0x1fc7d5&&_0x1fc7d5[_0x5bc62b(0x17b)]===_0x417cc3)return![];return _0x1c46fb(_0x1fc7d5);},'release'(){const _0x30c656=_0x67bbc4;_0x57f8b2();if(!_0x1f29d9)return;_0x1f29d9=![];if(_0x50201e())try{_0x306083[_0x30c656(0x109)](_0x4cf671);}catch{}}};},writerLock;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x4a0661=require$$0,_0x24a054=requireSnapshotStore(),_0x46f7ad=requireLabelMap(),_0x317c98=requireWriterLock(),{fingerprint:_0x560b70,reconcileIndex:_0xe47db9}=requireIndexConvergence(),_0x59bf7a=0x1;let _0x2ea589=null;function _0x31f29b(){const _0x2b6e79=_0x5cec;if(_0x2ea589)return _0x2ea589;try{return _0x2ea589=require(_0x2b6e79(0x188)),_0x2ea589;}catch(_0x585a8f){const _0x24bbbc=new Error(_0x2b6e79(0x1a1)+(_0x2b6e79(0xe5)+process[_0x2b6e79(0x157)]['node']+_0x2b6e79(0xf1)+process['platform']+'/'+process[_0x2b6e79(0x165)]+'.\x20')+_0x2b6e79(0x180)+('Original\x20error:\x20'+(_0x585a8f?.[_0x2b6e79(0x1b0)]||String(_0x585a8f))));_0x24bbbc[_0x2b6e79(0x15d)]=_0x2b6e79(0x155),_0x24bbbc['cause']=_0x585a8f;throw _0x24bbbc;}}function _0x2e0375(_0x229e9c,_0x4892a5){const _0xba841b=_0x5cec;switch(_0x229e9c){case _0xba841b(0x1aa):return _0x4892a5[_0xba841b(0xdd)][_0xba841b(0x13e)];case'l2':return _0x4892a5[_0xba841b(0xdd)][_0xba841b(0x1a8)];case'ip':return _0x4892a5[_0xba841b(0xdd)]['IP'];default:return _0x4892a5[_0xba841b(0xdd)][_0xba841b(0x13e)];}}return usearch=function _0x4fda0d(_0x4e84b9={},{dims:_0x3d86ee,dir:_0x5cfc91,fetchAll:fetchAll=null,onChange:onChange=null}={}){const _0xa28850=_0x5cec,_0x40141c=_0x31f29b();if(!_0x3d86ee||_0x3d86ee<=0x0)throw new Error('usearch\x20algorithm\x20requires\x20dims\x20>\x200');if(!_0x5cfc91)throw new Error('usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage');const _0x1a8900={'metric':_0x4e84b9[_0xa28850(0x18e)]??_0xa28850(0x1aa),'connectivity':_0x4e84b9[_0xa28850(0x150)]??0x10,'expansionAdd':_0x4e84b9[_0xa28850(0x1a2)]??0x80,'expansionSearch':_0x4e84b9[_0xa28850(0x154)]??0x40,'snapshotEveryChanges':_0x4e84b9[_0xa28850(0x15a)]??0xc350,'snapshotMaxLagMs':_0x4e84b9[_0xa28850(0xe9)]??0x2710,'keepSnapshots':_0x4e84b9[_0xa28850(0x191)]??0x2,'tmpMaxAgeMs':_0x4e84b9['tmpMaxAgeMs']??0x6*0x36ee80,'heartbeatIntervalMs':_0x4e84b9[_0xa28850(0x18b)]??0x1388,'writerLockMaxAgeMs':_0x4e84b9[_0xa28850(0x17e)]??0x3a98,'viewRefreshMs':_0x4e84b9[_0xa28850(0x104)]??0x3e8},_0x5b5b68=new _0x24a054({'dir':_0x5cfc91,'keepSnapshots':_0x1a8900[_0xa28850(0x191)]}),_0x598b9b=_0x317c98(_0x5cfc91,{'maxAgeMs':_0x1a8900['writerLockMaxAgeMs'],'heartbeatMs':_0x1a8900[_0xa28850(0x18b)],'onLost':()=>{const _0x802c49=_0xa28850;_0xf8c467(_0x1fa892)[_0x802c49(0x13d)](()=>{});}});let _0x604812=new _0x46f7ad(),_0x3f5320=null,_0x5ae20d=0x0,_0x1571b4=null,_0x2e5538=![],_0x3cd4d1=![],_0x32e912=null,_0x4c441f=0x0,_0x5d83d4=null,_0x3e0501=0x0,_0x4a0f9c=![],_0x1fbc0c=Promise[_0xa28850(0x19b)]();const _0xf8c467=_0x33786e=>{const _0x411b3d=_0xa28850,_0x432a40=_0x1fbc0c[_0x411b3d(0xd9)](_0x33786e);return _0x1fbc0c=_0x432a40[_0x411b3d(0x13d)](()=>{}),_0x432a40;},_0x51b636=()=>{try{onChange?.();}catch{}};function _0x20ac8a(){const _0x33f54e=_0xa28850;return new _0x40141c['Index']({'dimensions':_0x3d86ee,'metric':_0x2e0375(_0x1a8900[_0x33f54e(0x18e)],_0x40141c),'quantization':_0x40141c['ScalarKind']['F32'],'connectivity':_0x1a8900[_0x33f54e(0x150)],'expansion_add':_0x1a8900['expansionAdd'],'expansion_search':_0x1a8900['expansionSearch'],'multi':![]});}function _0x2ca74a(_0x29f944){return _0x29f944 instanceof Float32Array?_0x29f944:new Float32Array(_0x29f944);}function _0x120c68(){const _0xab180d=_0xa28850;if(fetchAll)return fetchAll();if(_0x1571b4)return _0x1571b4();return Promise[_0xab180d(0x19b)](null);}function _0x1746df(_0x311ab3,_0x302ff2,_0x2cdc57){const _0x4ccf88=_0xa28850,_0x36d487=_0x604812[_0x4ccf88(0x18a)](_0x311ab3);if(_0x36d487!==undefined)try{_0x3f5320['remove'](BigInt(_0x36d487));}catch{}const _0x54f4b6=_0x604812[_0x4ccf88(0xee)](_0x311ab3);_0x3f5320['add'](BigInt(_0x54f4b6),_0x302ff2),_0x604812[_0x4ccf88(0x10b)](_0x311ab3,_0x2cdc57??_0x560b70(_0x302ff2));}function _0xa54ea6(_0x3c9b5f){const _0x305a61=_0xa28850,_0x383f99=_0x604812[_0x305a61(0x18a)](_0x3c9b5f);if(_0x383f99===undefined)return![];try{_0x3f5320[_0x305a61(0x19d)](BigInt(_0x383f99));}catch{}return _0x604812[_0x305a61(0x166)](_0x3c9b5f),!![];}function _0x302d15(_0x564237){const _0x47bbee=_0xa28850;_0x604812=new _0x46f7ad(),_0x3f5320=_0x20ac8a();for(const {key:_0x554872,vector:_0x4f92df}of _0x564237??[]){if(!(_0x4f92df instanceof Float32Array)||_0x4f92df[_0x47bbee(0x122)]!==_0x3d86ee)continue;_0x1746df(_0x554872,_0x4f92df);}_0x5ae20d=0x0;}function _0x42b4b2(){const _0x129a2d=_0xa28850;return Math['max'](Date[_0x129a2d(0x1a7)](),_0x5b5b68[_0x129a2d(0x103)]()+0x1);}function _0x26e279(){if(_0x32e912)clearTimeout(_0x32e912);_0x32e912=null;}function _0x368bdb(){const _0x11a3ec=_0xa28850;if(!_0x1a8900[_0x11a3ec(0xe9)]||_0x32e912||!_0x3cd4d1||_0x5ae20d<=0x0)return;const _0x22c306=Math[_0x11a3ec(0x16d)](_0x1a8900[_0x11a3ec(0xe9)],0xa*_0x4c441f);_0x32e912=setTimeout(()=>{const _0x42f1f4=_0x11a3ec;_0x32e912=null,_0xf8c467(async()=>{if(_0x3cd4d1&&_0x5ae20d>0x0)await _0x35412a();_0x368bdb(),_0x51b636();})[_0x42f1f4(0x13d)](()=>{});},_0x22c306),_0x32e912[_0x11a3ec(0x168)]?.();}async function _0x35412a(_0x11636b){const _0x1f21c1=_0xa28850;if(!_0x3f5320)return![];const _0x41dd29=_0x11636b??_0x42b4b2(),_0x180ca7=Date[_0x1f21c1(0x1a7)](),_0x386302=await _0x5b5b68[_0x1f21c1(0x113)](_0x41dd29,async _0xf7555a=>{const _0x24ef0e=_0x1f21c1;_0x3f5320[_0x24ef0e(0x13c)](_0xf7555a['index']),await _0x604812[_0x24ef0e(0x172)](_0xf7555a['labels']),_0x4a0661[_0x24ef0e(0x170)](_0xf7555a['state'],JSON[_0x24ef0e(0x159)]({'manifestVersion':_0x59bf7a,'algorithm':_0x24ef0e(0x188),'dims':_0x3d86ee,'metric':_0x1a8900[_0x24ef0e(0x18e)],'clock':_0x41dd29,'snapshotAt':Date[_0x24ef0e(0x1a7)]()},null,0x2));},{'keep':_0x1a8900[_0x1f21c1(0x191)]});return _0x4c441f=Date[_0x1f21c1(0x1a7)]()-_0x180ca7,_0x386302?.[_0x1f21c1(0x14b)]&&(_0x5ae20d=0x0,_0x26e279()),_0x386302?.[_0x1f21c1(0x14b)]??![];}function _0x31f4f6(){const _0x45783a=_0xa28850;_0x5ae20d++;if(_0x5ae20d>=_0x1a8900[_0x45783a(0x15a)])return _0x35412a();return _0x368bdb(),null;}async function _0x428e8e(){const _0x4fbddc=_0xa28850,_0x32f7ca=_0x5b5b68[_0x4fbddc(0x1ac)]()||_0x5b5b68[_0x4fbddc(0x11e)]();if(!_0x32f7ca)return null;let _0x48ab2e,_0x411d42=![];try{await _0x5b5b68[_0x4fbddc(0x198)](_0x32f7ca,async _0x24d4d5=>{const _0x556df6=_0x4fbddc;_0x48ab2e=JSON[_0x556df6(0x10e)](_0x4a0661[_0x556df6(0x1ab)](_0x24d4d5[_0x556df6(0x160)],_0x556df6(0x124)));if(_0x48ab2e[_0x556df6(0x192)]!==_0x59bf7a||_0x48ab2e[_0x556df6(0x13a)]!==_0x556df6(0x188)||_0x48ab2e[_0x556df6(0x100)]!==_0x3d86ee||_0x48ab2e[_0x556df6(0x18e)]!==_0x1a8900[_0x556df6(0x18e)]){_0x48ab2e=null;return;}const _0x3cfd9c=new _0x46f7ad();await _0x3cfd9c[_0x556df6(0x162)](_0x24d4d5[_0x556df6(0x138)]);const _0x3d6388=_0x20ac8a();_0x3d6388[_0x556df6(0x133)](_0x24d4d5[_0x556df6(0x1a9)]),_0x604812=_0x3cfd9c,_0x3f5320=_0x3d6388,_0x411d42=!![];});}catch{return null;}return _0x411d42?_0x48ab2e?.['clock']??0x0:null;}async function _0x1d5b44(_0x1cca17){const _0x2b3901=_0xa28850;_0x5d83d4=null;const _0x3b61bd=await _0x428e8e();if(_0x3b61bd!=null){_0x5ae20d=0x0;if(_0x1cca17){if(!_0x604812[_0x2b3901(0x129)])return _0x302d15(_0x1cca17),await _0x35412a(),null;const _0x27a3b2=_0xe47db9(_0x604812,_0x1cca17,_0x3d86ee,{'upsert':_0x1746df,'remove':_0xa54ea6}),_0x12239a=_0x27a3b2[_0x2b3901(0xe7)]+_0x27a3b2['changed']+_0x27a3b2[_0x2b3901(0x197)];_0x12239a>0x0&&(_0x5ae20d+=_0x12239a,await _0x35412a());}return _0x3b61bd;}_0x302d15(_0x1cca17??[]);if(_0x3f5320[_0x2b3901(0x134)]()>0x0)await _0x35412a();return null;}async function _0x526b41(){_0x3cd4d1=!![],await _0x1d5b44(await _0x120c68());}async function _0x1fa892(){const _0x254fcb=_0xa28850;if(!_0x3cd4d1)return;_0x3cd4d1=![],_0x26e279(),_0x5ae20d=0x0;const _0x5c896d=_0x5b5b68[_0x254fcb(0x1ac)]()||_0x5b5b68['latestSnapshotId']();await _0x265473(_0x5c896d),_0x51b636();}async function _0x265473(_0x1e1275){const _0x3cb769=_0xa28850;if(!_0x1e1275)return![];let _0x57dfed=![];try{await _0x5b5b68[_0x3cb769(0x198)](_0x1e1275,async _0x160070=>{const _0x2b89cf=_0x3cb769,_0x625c06=JSON[_0x2b89cf(0x10e)](_0x4a0661[_0x2b89cf(0x1ab)](_0x160070[_0x2b89cf(0x160)],_0x2b89cf(0x124)));if(_0x625c06[_0x2b89cf(0x192)]!==_0x59bf7a||_0x625c06['algorithm']!==_0x2b89cf(0x188)||_0x625c06[_0x2b89cf(0x100)]!==_0x3d86ee||_0x625c06[_0x2b89cf(0x18e)]!==_0x1a8900[_0x2b89cf(0x18e)])return;const _0x486577=new _0x46f7ad();await _0x486577[_0x2b89cf(0x162)](_0x160070[_0x2b89cf(0x138)]);const _0x44529d=_0x20ac8a();_0x44529d[_0x2b89cf(0x1a4)](_0x160070['index']),_0x3f5320=_0x44529d,_0x604812=_0x486577,_0x5d83d4=_0x1e1275,_0x57dfed=!![];});}catch{}return _0x57dfed;}function _0x13e292(){const _0x31b134=_0xa28850,_0x1014cc=Date['now']();if(_0x1014cc-_0x3e0501<_0x1a8900[_0x31b134(0x104)])return;_0x3e0501=_0x1014cc;if(_0x4a0f9c)return;if(_0x598b9b[_0x31b134(0xfb)]()){_0x4a0f9c=!![],_0xf8c467(async()=>{const _0x928aef=_0x31b134;!_0x3cd4d1&&_0x2e5538&&_0x598b9b[_0x928aef(0xfe)]()&&(await _0x526b41(),_0x51b636());})[_0x31b134(0x13d)](()=>{})[_0x31b134(0x177)](()=>{_0x4a0f9c=![];});return;}const _0x163385=_0x5b5b68[_0x31b134(0x1ac)]()||_0x5b5b68[_0x31b134(0x11e)]();if(!_0x163385||_0x163385===_0x5d83d4)return;_0x4a0f9c=!![],_0xf8c467(async()=>{if(!_0x3cd4d1&&await _0x265473(_0x163385))_0x51b636();})[_0x31b134(0x13d)](()=>{})[_0x31b134(0x177)](()=>{_0x4a0f9c=![];});}return{async 'load'(_0x4e4452){return _0xf8c467(async()=>{const _0x3e535c=_0x5cec;_0x5b5b68[_0x3e535c(0xde)]({'maxAgeMs':_0x1a8900['tmpMaxAgeMs']}),_0x1571b4=_0x4e4452??null,_0x3cd4d1=_0x598b9b[_0x3e535c(0xfe)]();let _0x1390e0=null;if(_0x3cd4d1)_0x1390e0=await _0x1d5b44(_0x4e4452?await _0x4e4452():null);else{const _0x261e9d=_0x5b5b68[_0x3e535c(0x1ac)]()||_0x5b5b68[_0x3e535c(0x11e)]();await _0x265473(_0x261e9d);}return _0x2e5538=!![],_0x1390e0;});},async 'add'(_0x248805,_0x27bd19,_0x734889){return _0xf8c467(async()=>{const _0x539ebe=_0x5cec;if(!_0x2e5538)return;const _0xfa15b8=_0x2ca74a(_0x27bd19);if(!_0x3cd4d1){if(!_0x598b9b['acquire']())return;await _0x526b41();}if(!_0x3f5320)return;const _0x1a3958=_0x560b70(_0xfa15b8);if(_0x604812[_0x539ebe(0xec)](_0x248805)===_0x1a3958)return;_0x1746df(_0x248805,_0xfa15b8,_0x1a3958),await _0x31f4f6();});},async 'remove'(_0x27291d){return _0xf8c467(async()=>{const _0x27699c=_0x5cec;if(!_0x2e5538)return;if(!_0x3cd4d1){if(!_0x598b9b[_0x27699c(0xfe)]())return;await _0x526b41();}if(!_0x3f5320)return;if(_0xa54ea6(_0x27291d))await _0x31f4f6();});},'search'(_0x313289,{limit:limit=0xa}={}){const _0x4ba166=_0xa28850;if(!_0x3cd4d1&&_0x2e5538)_0x13e292();if(!_0x3f5320)return[];const _0x1bdfdc=_0x3f5320[_0x4ba166(0x134)]();if(_0x1bdfdc===0x0)return[];const _0x120a26=Math[_0x4ba166(0x15f)](limit,_0x1bdfdc),_0x528955=_0x3f5320['search'](_0x2ca74a(_0x313289),_0x120a26,0x0),_0x1f20cd=[],_0x100ba4=_0x528955[_0x4ba166(0x15e)],_0x375b90=_0x528955[_0x4ba166(0x14f)];for(let _0x4f49a4=0x0;_0x4f49a4<_0x100ba4[_0x4ba166(0x122)];_0x4f49a4++){const _0x257124=_0x100ba4[_0x4f49a4];if(_0x257124===0xffffffffffffffffn)continue;const _0x1d7459=Number(_0x257124),_0x52cace=_0x604812['keyForLabel'](_0x1d7459);if(!_0x52cace)continue;const _0x92b434=_0x375b90[_0x4f49a4];let _0x406220;if(_0x1a8900[_0x4ba166(0x18e)]===_0x4ba166(0x1aa))_0x406220=Math['max'](0x0,0x1-_0x92b434);else{if(_0x1a8900['metric']==='ip')_0x406220=-_0x92b434;else _0x406220=0x1/(0x1+_0x92b434);}_0x1f20cd['push']({'key':_0x52cace,'score':_0x406220});}return _0x1f20cd;},async 'snapshot'(_0x1b811b){return _0xf8c467(()=>_0x3cd4d1?_0x35412a(_0x1b811b??undefined):![]);},async 'rebuild'(_0x1bf5f1){return _0xf8c467(async()=>{if(_0x1bf5f1!=null)_0x1571b4=_0x1bf5f1;if(!_0x3cd4d1){if(!_0x598b9b['acquire']())return;_0x3cd4d1=!![];}const _0x5413b4=_0x1bf5f1?await _0x1bf5f1():await _0x120c68();_0x302d15(_0x5413b4??[]),_0x2e5538=!![],await _0x35412a();});},async 'stop'(){return _0xf8c467(async()=>{const _0x41b05a=_0x5cec;_0x26e279();if(_0x3cd4d1){if(_0x5ae20d>0x0||!_0x5b5b68[_0x41b05a(0x1ac)]())await _0x35412a();_0x598b9b[_0x41b05a(0xdf)]();}_0x3cd4d1=![],_0x2e5538=![];});},'count'(){const _0x536c43=_0xa28850;return _0x604812[_0x536c43(0x134)]();},'info'(){const _0x1aeec0=_0xa28850;return{'algorithm':'usearch','role':_0x3cd4d1?_0x1aeec0(0x164):'reader','metric':_0x1a8900[_0x1aeec0(0x18e)],'connectivity':_0x1a8900[_0x1aeec0(0x150)],'expansionAdd':_0x1a8900[_0x1aeec0(0x1a2)],'expansionSearch':_0x1a8900[_0x1aeec0(0x154)],'snapshotEveryChanges':_0x1a8900['snapshotEveryChanges'],'snapshotMaxLagMs':_0x1a8900['snapshotMaxLagMs'],'count':_0x604812[_0x1aeec0(0x134)](),'size':_0x3f5320?.[_0x1aeec0(0x134)]?.()??0x0,'capacity':_0x3f5320?.[_0x1aeec0(0x147)]?.()??0x0,'changesSince':_0x3cd4d1?_0x5ae20d:null,'viewedSnapshot':_0x5d83d4??null,'snapshotDir':_0x5cfc91,'latestSnapshot':_0x5b5b68['readCurrentId']()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0xfe497b=_0x11b94d;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x186f6f,workerData:_0x45668b}=require$$0$1,{algorithmName:_0x4990cb,algorithmConfig:_0x44bc4f,dims:_0x202025,dir:_0x4e13eb}=_0x45668b;let _0x3adb4c=0x1;const _0x132168=new Map();function _0x1e7638(){const _0x514636=_0x3adb4c++;return new Promise((_0x41c953,_0xf7773b)=>{const _0x5546e6=_0x5cec;_0x132168[_0x5546e6(0x128)](_0x514636,{'resolve':_0x41c953,'reject':_0xf7773b}),_0x186f6f['postMessage']({'op':_0x5546e6(0x105),'fid':_0x514636});});}const _0x1198d7={'dims':_0x202025,'dir':_0x4e13eb,'fetchAll':_0x1e7638,'onChange':()=>_0x2a3ceb()};let _0x473592;if(_0x4990cb===_0xfe497b(0x140))_0x473592=requireHnsw()(_0x44bc4f,_0x1198d7);else{if(_0x4990cb===_0xfe497b(0xff))_0x473592=requireFlat()(_0x44bc4f,_0x1198d7);else{if(_0x4990cb===_0xfe497b(0x188))_0x473592=requireUsearch()(_0x44bc4f,_0x1198d7);else throw new Error('Unknown\x20algorithm:\x20\x22'+_0x4990cb+'\x22');}}function _0x2a3ceb(){const _0x401a33=_0xfe497b;try{_0x186f6f[_0x401a33(0xe4)]({'op':_0x401a33(0x16b),'count':_0x473592[_0x401a33(0x11d)](),'info':_0x473592[_0x401a33(0x18c)](),'memory':process[_0x401a33(0x110)]()});}catch{}}function _0x5f4cc8(_0x463d8c){const _0x38355b=_0xfe497b;return(_0x463d8c||[])['map'](_0x512e96=>({'key':_0x512e96['key'],'vector':_0x512e96['vector']instanceof Float32Array?_0x512e96[_0x38355b(0x152)]:new Float32Array(_0x512e96['vector'])}));}return _0x186f6f['on'](_0xfe497b(0x1b0),async _0x148785=>{const _0x332585=_0xfe497b;if(_0x148785['op']===_0x332585(0x1a3)){const _0x240b4f=_0x132168[_0x332585(0x16e)](_0x148785['fid']);if(!_0x240b4f)return;_0x132168['delete'](_0x148785[_0x332585(0xe2)]);if(_0x148785['error'])_0x240b4f[_0x332585(0x115)](new Error(_0x148785[_0x332585(0xf4)]));else _0x240b4f[_0x332585(0x19b)](_0x5f4cc8(_0x148785[_0x332585(0xe6)]));return;}const {id:_0x327322,op:_0x2a7d43,args:_0x2580dd}=_0x148785;try{let _0x107d8e;switch(_0x2a7d43){case _0x332585(0x133):{_0x107d8e=await _0x473592[_0x332585(0x133)](_0x2580dd[_0x332585(0x125)]?_0x1e7638:null),_0x2a3ceb();break;}case _0x332585(0xf6):{const _0x2f75df=_0x2580dd['vector']instanceof Float32Array?_0x2580dd[_0x332585(0x152)]:new Float32Array(_0x2580dd[_0x332585(0x152)]);await _0x473592[_0x332585(0xf6)](_0x2580dd[_0x332585(0x18d)],_0x2f75df,_0x2580dd['clock']??undefined),_0x2a3ceb(),_0x107d8e=null;break;}case _0x332585(0x19d):{await _0x473592[_0x332585(0x19d)](_0x2580dd[_0x332585(0x18d)]),_0x2a3ceb(),_0x107d8e=null;break;}case _0x332585(0x11f):{const _0x47884d=_0x2580dd[_0x332585(0x121)]instanceof Float32Array?_0x2580dd[_0x332585(0x121)]:new Float32Array(_0x2580dd[_0x332585(0x121)]);_0x107d8e=_0x473592[_0x332585(0x11f)](_0x47884d,_0x2580dd[_0x332585(0x17a)]||{});break;}case _0x332585(0x156):{_0x107d8e=await _0x473592[_0x332585(0x156)](_0x2580dd[_0x332585(0x1a0)]),_0x2a3ceb();break;}case _0x332585(0xf3):{const _0x1d8a57=_0x5f4cc8(_0x2580dd[_0x332585(0xe6)]);await _0x473592[_0x332585(0xf3)](async()=>_0x1d8a57),_0x2a3ceb(),_0x107d8e=null;break;}case'stop':{await _0x473592[_0x332585(0x17f)](),_0x2a3ceb(),_0x107d8e=null;break;}case _0x332585(0x11d):{_0x107d8e=_0x473592[_0x332585(0x11d)]();break;}case _0x332585(0x18c):{_0x107d8e=_0x473592[_0x332585(0x18c)]();break;}default:throw new Error(_0x332585(0x142)+_0x2a7d43+'\x22');}_0x186f6f[_0x332585(0xe4)]({'id':_0x327322,'result':_0x107d8e});}catch(_0x29b60d){_0x186f6f['postMessage']({'id':_0x327322,'error':{'message':_0x29b60d?.[_0x332585(0x1b0)]||String(_0x29b60d),'code':_0x29b60d?.[_0x332585(0x15d)]}});}}),_0x186f6f['postMessage']({'op':_0xfe497b(0x106)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module[_0x11b94d(0x19a)]=algorithmWorkerThread;