@kedem/okdb 2.4.0 → 2.6.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.
- package/CHANGELOG.md +160 -0
- package/algorithm-worker-thread.js +1 -1
- package/bin/okdb.js +1 -1
- package/docs/auth-and-sync.md +2 -1
- package/docs/auth-permissions.md +31 -5
- package/docs/change-log.md +6 -6
- package/docs/licensing.md +6 -1
- package/docs/migration.md +60 -1
- package/docs/plugins.md +1 -1
- package/docs/processors.md +1 -1
- package/docs/subscriptions.md +6 -4
- package/docs/views.md +4 -0
- package/okdb-functions-sandbox-worker.js +1 -1
- package/okdb-http-worker-child.js +1 -1
- package/okdb-views-bootstrap-worker.js +1 -1
- package/okdb.js +1 -1
- package/package.json +1 -1
- package/public/admin-app.js +1 -1
- package/public/components/schema-edit-modal.ok.js +1 -0
- package/public/core/db/db-section.ok.html +1 -0
- package/public/core/db/modals/add-item-modal.ok.js +1 -0
- package/public/core/db/modals/create-fts-modal.ok.js +1 -0
- package/public/core/db/modals/create-index-modal.ok.js +1 -0
- package/public/core/db/parts/db-overview.ok.js +1 -0
- package/public/core/db/parts/edit-row.ok.js +1 -0
- package/public/core/db/parts/type-changelog.ok.js +1 -0
- package/public/core/db/parts/type-data-tab.ok.js +1 -0
- package/public/core/db/parts/type-list.ok.js +1 -0
- package/public/core/db/parts/type-manage-tab.ok.js +1 -0
- package/public/core/db/parts/type-schema-tab.ok.js +1 -0
- package/public/core/db/parts/type-viewer.ok.js +1 -0
- package/public/core/db/type-ops.js +1 -0
- package/public/core/docs/docs-page.ok.html +1 -0
- package/public/core/license/license-panel.ok.js +1 -0
- package/public/core/system/parts/system-log.ok.js +1 -0
- package/public/core/system/parts/system-processing-panel.ok.js +1 -0
- package/public/core/system/parts/system-storage-panel.ok.js +1 -0
- package/public/core/system/system-events-page.ok.js +1 -0
- package/public/core/system/system-logs-page.ok.js +1 -0
- package/public/core/system/system-overview-page.ok.html +1 -0
- package/public/core/system/system-runtime-page.ok.js +1 -0
- package/public/core/system/system-section.ok.html +1 -0
- package/public/features/api/api-panel.ok.js +1 -0
- package/public/features/api/index.js +1 -0
- package/public/features/auth/auth-panel.ok.js +1 -0
- package/public/features/auth/index.js +1 -0
- package/public/features/files/files-section.ok.html +1 -0
- package/public/features/files/index.js +1 -0
- package/public/features/files/parts/files-file-list.ok.js +1 -0
- package/public/features/files/parts/files-path-browser.ok.js +1 -0
- package/public/features/files/parts/files-preview.ok.js +1 -0
- package/public/features/files/parts/files-upload-panel.ok.js +1 -0
- package/public/features/functions/exports.js +1 -0
- package/public/features/functions/functions-section.ok.html +1 -0
- package/public/features/functions/functions-store.js +1 -0
- package/public/features/functions/index.js +1 -0
- package/public/features/functions/modals/function-modal.ok.js +1 -0
- package/public/features/functions/parts/function-detail.ok.js +1 -0
- package/public/features/functions/parts/function-logs.ok.js +1 -0
- package/public/features/functions/parts/function-runner.ok.js +1 -0
- package/public/features/pipelines/engine-ui-utils.js +1 -0
- package/public/features/pipelines/exports.js +1 -0
- package/public/features/pipelines/index.js +1 -0
- package/public/features/pipelines/modals/create-pipeline-modal.ok.js +1 -0
- package/public/features/pipelines/modals/edit-pipeline-modal.ok.js +1 -0
- package/public/features/pipelines/modals/engine-modal.ok.js +1 -0
- package/public/features/pipelines/parts/embed-create-panel.ok.js +1 -0
- package/public/features/pipelines/parts/embed-embedder-panel.ok.js +1 -0
- package/public/features/pipelines/parts/embed-indexer-panel.ok.js +1 -0
- package/public/features/pipelines/parts/embed-search-panel.ok.js +1 -0
- package/public/features/pipelines/parts/embed-worker-panel.ok.js +1 -0
- package/public/features/pipelines/parts/embeddings-engine-panel.ok.js +1 -0
- package/public/features/pipelines/parts/engine-declaration-editor.ok.js +1 -0
- package/public/features/pipelines/parts/engines-overview.ok.js +1 -0
- package/public/features/pipelines/parts/generic-engine-panel.ok.js +1 -0
- package/public/features/pipelines/parts/pipeline-create-panel.ok.js +1 -0
- package/public/features/pipelines/parts/pipeline-flow-strip.ok.js +1 -0
- package/public/features/pipelines/parts/type-pipelines-tab.ok.js +1 -0
- package/public/features/pipelines/pipelines-section.ok.html +1 -0
- package/public/features/queue/index.js +1 -0
- package/public/features/queue/modals/create-bucket-modal.ok.js +1 -0
- package/public/features/queue/modals/edit-bucket-modal.ok.js +1 -0
- package/public/features/queue/modals/edit-job-modal.ok.js +1 -0
- package/public/features/queue/modals/enqueue-job-modal.ok.js +1 -0
- package/public/features/queue/modals/job-type-modal.ok.js +1 -0
- package/public/features/queue/parts/job-log-panel.ok.js +1 -0
- package/public/features/queue/parts/queue-buckets.ok.js +1 -0
- package/public/features/queue/parts/queue-job-types.ok.js +1 -0
- package/public/features/queue/parts/queue-jobs.ok.js +1 -0
- package/public/features/queue/parts/queue-types.ok.js +1 -0
- package/public/features/queue/parts/queue-workers.ok.js +1 -0
- package/public/features/queue/queue-section.ok.html +1 -0
- package/public/features/sync/index.js +1 -0
- package/public/features/sync/sync-panel.ok.js +1 -0
- package/public/features/views/index.js +1 -0
- package/public/features/views/modals/create-view-modal.ok.js +1 -0
- package/public/features/views/parts/views-list.ok.js +1 -0
- package/public/features/views/parts/views-overview.ok.js +1 -0
- package/public/features/views/views-section.ok.html +1 -0
- package/public/features/views/views-store.js +1 -0
- package/public/index.html +9 -3
- package/public/modules/ok.js +1 -1
- package/public/shell/admin-shell.ok.html +3 -0
- package/public/shell/core-manifest.js +1 -0
- package/public/shell/shell-piece.ok.js +1 -0
- package/public/shell/shell-section-host.ok.js +1 -0
- package/public/shell/shell-section.ok.js +1 -0
- package/public/shell/shell-store.js +1 -0
- package/public/stores/auth-store.js +1 -1
- package/public/stores/okdb-store.js +1 -1
- package/public/stores/storage-store.js +1 -0
- package/public/styles.css +1 -1
- package/public/vendor/okjs/ok.esm.min.js +1 -1
- package/public/vendor/okjs/toolkit/components/ok-chart.ok.js +1 -1
- package/public/vendor/okjs/toolkit/components/ok-doc-viewer.ok.js +1 -1
- package/public/vendor/okjs/toolkit/components/ok-marked.ok.js +1 -1
- package/public/vendor/okjs/toolkit/components/ok-monaco.ok.js +1 -1
- package/types/okdb.d.ts +20 -0
- package/public/components/admin-route-host.ok.js +0 -1
- package/public/components/field.html +0 -158
- package/public/layouts/_default.ok.html +0 -3
- package/public/sections/api/index.ok.html +0 -1
- package/public/sections/auth/index.ok.html +0 -1
- package/public/sections/auth/modals/perm-info-popover.ok.js +0 -1
- package/public/sections/db/index.ok.html +0 -1
- package/public/sections/db/modals/add-item-modal.ok.js +0 -1
- package/public/sections/db/modals/create-fts-modal.ok.js +0 -1
- package/public/sections/db/modals/create-index-modal.ok.js +0 -1
- package/public/sections/db/modals/create-pipeline-modal.ok.js +0 -1
- package/public/sections/db/modals/schema-edit-modal.ok.js +0 -1
- package/public/sections/db/parts/db-overview.ok.js +0 -1
- package/public/sections/db/parts/edit-row.ok.js +0 -1
- package/public/sections/db/parts/type-changelog.ok.js +0 -1
- package/public/sections/db/parts/type-list.ok.js +0 -1
- package/public/sections/db/parts/type-pipelines-tab.ok.js +0 -1
- package/public/sections/db/parts/type-schema-tab.ok.js +0 -1
- package/public/sections/db/parts/type-viewer.ok.js +0 -1
- package/public/sections/db/parts/type-violations-tab.ok.js +0 -1
- package/public/sections/docs/index.ok.html +0 -1
- package/public/sections/embeddings/index.ok.html +0 -1
- package/public/sections/embeddings/modals/edit-pipeline-modal.ok.js +0 -1
- package/public/sections/embeddings/parts/embed-create-panel.ok.js +0 -1
- package/public/sections/embeddings/parts/embed-embedder-panel.ok.js +0 -1
- package/public/sections/embeddings/parts/embed-engine-declaration-editor.ok.js +0 -1
- package/public/sections/embeddings/parts/embed-engine-list.ok.js +0 -1
- package/public/sections/embeddings/parts/embed-indexer-panel.ok.js +0 -1
- package/public/sections/embeddings/parts/embed-lifecycle-bar.ok.js +0 -1
- package/public/sections/embeddings/parts/embed-overview.ok.js +0 -1
- package/public/sections/embeddings/parts/embed-search-panel.ok.js +0 -1
- package/public/sections/embeddings/parts/embed-worker-panel.ok.js +0 -1
- package/public/sections/embeddings/parts/embeddings-engine-panel.ok.js +0 -1
- package/public/sections/embeddings/parts/engines-overview.ok.js +0 -1
- package/public/sections/embeddings/parts/pipeline-create-panel.ok.js +0 -1
- package/public/sections/embeddings/parts/pipeline-flow-strip.ok.js +0 -1
- package/public/sections/engines/engine-ui-utils.js +0 -1
- package/public/sections/engines/index.ok.html +0 -1
- package/public/sections/engines/modals/engine-modal.ok.js +0 -1
- package/public/sections/engines/parts/engine-declaration-editor.ok.js +0 -1
- package/public/sections/engines/parts/generic-engine-panel.ok.js +0 -1
- package/public/sections/files/index.ok.html +0 -1
- package/public/sections/files/parts/files-collection-list.ok.js +0 -1
- package/public/sections/files/parts/files-collection-panel.ok.js +0 -1
- package/public/sections/files/parts/files-file-list.ok.js +0 -1
- package/public/sections/files/parts/files-path-browser.ok.js +0 -1
- package/public/sections/files/parts/files-preview.ok.js +0 -1
- package/public/sections/files/parts/files-upload-panel.ok.js +0 -1
- package/public/sections/functions/index.ok.html +0 -1
- package/public/sections/functions/modals/function-modal.ok.js +0 -1
- package/public/sections/functions/parts/function-detail.ok.js +0 -1
- package/public/sections/functions/parts/function-logs.ok.js +0 -1
- package/public/sections/functions/parts/function-runner.ok.js +0 -1
- package/public/sections/license/index.ok.html +0 -1
- package/public/sections/license/parts/license-panel.ok.js +0 -1
- package/public/sections/queue/index.ok.html +0 -1
- package/public/sections/queue/modals/create-bucket-modal.ok.js +0 -1
- package/public/sections/queue/modals/edit-bucket-modal.ok.js +0 -1
- package/public/sections/queue/modals/edit-job-modal.ok.js +0 -1
- package/public/sections/queue/modals/enqueue-job-modal.ok.js +0 -1
- package/public/sections/queue/modals/job-type-modal.ok.js +0 -1
- package/public/sections/queue/parts/job-log-panel.ok.js +0 -1
- package/public/sections/queue/parts/ok-job-form.ok.js +0 -1
- package/public/sections/queue/parts/queue-buckets.ok.js +0 -1
- package/public/sections/queue/parts/queue-job-types.ok.js +0 -1
- package/public/sections/queue/parts/queue-jobs.ok.js +0 -1
- package/public/sections/queue/parts/queue-types.ok.js +0 -1
- package/public/sections/queue/parts/queue-workers.ok.js +0 -1
- package/public/sections/sync/index.ok.html +0 -5
- package/public/sections/sync/parts/sync-node-detail.ok.js +0 -1
- package/public/sections/system/index.ok.html +0 -1
- package/public/sections/system/parts/system-api-panel.ok.js +0 -1
- package/public/sections/system/parts/system-auth-panel.ok.js +0 -1
- package/public/sections/system/parts/system-log.ok.js +0 -1
- package/public/sections/system/parts/system-processing-panel.ok.js +0 -1
- package/public/sections/system/parts/system-status.ok.js +0 -1
- package/public/sections/system/parts/system-storage-panel.ok.js +0 -1
- package/public/sections/system/parts/system-sync-panel.ok.js +0 -1
- package/public/sections/views/index.ok.html +0 -1
- package/public/sections/views/modals/create-view-modal.ok.js +0 -1
- package/public/sections/views/parts/views-list.ok.js +0 -1
- package/public/sections/views/parts/views-overview.ok.js +0 -1
- package/public/stores/functions-store.js +0 -1
- /package/public/{sections → core}/db/parts/tm-timeline.ok.js +0 -0
- /package/public/{util → core/db}/sift-schema.js +0 -0
- /package/public/{view-models → core/db}/type-query-vm.js +0 -0
- /package/public/{sections → core}/system/modals/data-ops-modal.ok.js +0 -0
- /package/public/{sections → core}/system/parts/system-locks-panel.ok.js +0 -0
- /package/public/{sections → core}/system/parts/system-log-history.ok.js +0 -0
- /package/public/{sections → core}/system/parts/system-process-panel.ok.js +0 -0
- /package/public/{sections → core}/system/parts/system-runtime-overview.ok.js +0 -0
- /package/public/{sections → features}/api/parts/api-endpoint.ok.js +0 -0
- /package/public/{sections → features}/auth/modals/create-token-modal.ok.js +0 -0
- /package/public/{sections → features}/auth/modals/edit-token-modal.ok.js +0 -0
- /package/public/{sections → features}/auth/parts/token-detail.ok.js +0 -0
- /package/public/{sections → features}/auth/parts/token-list.ok.js +0 -0
- /package/public/{sections → features}/files/parts/files-blob-status.ok.js +0 -0
- /package/public/{sections → features}/files/parts/files-overview.ok.js +0 -0
- /package/public/{sections → features}/functions/parts/functions-list.ok.js +0 -0
- /package/public/{sections/engines → features/pipelines}/engine-panel-shared-style.js +0 -0
- /package/public/{sections/embeddings → features/pipelines}/modals/register-model-modal.ok.js +0 -0
- /package/public/{sections/embeddings → features/pipelines}/modals/replace-embedder-modal.ok.js +0 -0
- /package/public/{sections/embeddings → features/pipelines}/parts/embed-model-catalog.ok.js +0 -0
- /package/public/{sections/engines → features/pipelines}/parts/engine-lifecycle-actions.ok.js +0 -0
- /package/public/{sections/engines → features/pipelines}/parts/engine-panel-shell.ok.js +0 -0
- /package/public/{sections/engines → features/pipelines}/parts/engine-resource-card.ok.js +0 -0
- /package/public/{sections/engines → features/pipelines}/parts/engine-row-item.ok.js +0 -0
- /package/public/{sections/embeddings → features/pipelines}/parts/pipeline-try-search.ok.js +0 -0
- /package/public/{sections → features}/queue/parts/code-panel.ok.js +0 -0
- /package/public/{sections → features}/sync/modals/connect-peer-modal.ok.js +0 -0
- /package/public/{sections → features}/sync/parts/sync-retention.ok.js +0 -0
- /package/public/{sections → features}/sync/parts/sync-topology.ok.js +0 -0
- /package/public/{sections → features}/views/parts/view-detail.ok.js +0 -0
- /package/public/{sections/db → shell}/modals/create-env-modal.ok.js +0 -0
- /package/public/{sections/db → shell}/modals/demo-env-modal.ok.js +0 -0
- /package/public/{sections/db → shell}/modals/remove-env-modal.ok.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,166 @@ 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.6.0] - 2026-09-28
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- **Admin UI rebuilt as a shell with feature-contributed sections** (`design/admin-shell.md`). The
|
|
12
|
+
chrome (env picker, nav, notices, live/security pills) mounts once and sections swap inside it —
|
|
13
|
+
switching sections no longer tears the page down or flashes a full-page "Loading…". Each feature
|
|
14
|
+
ships its own UI under `src/features/<f>/admin/` (a manifest contributing nav sections, DB
|
|
15
|
+
type-viewer tabs and System pages); the server lists them, UI-agnostically, at
|
|
16
|
+
`GET /admin/api/features` (licence + permissions per feature). Nav items, DB tabs and System pages
|
|
17
|
+
go through one gate: a feature without a licence shows **locked** with "Requires a license with …",
|
|
18
|
+
one the token may not see shows locked with the permission it needs, and opening it by URL shows the
|
|
19
|
+
reason instead of loading it. Views is now gated on `views:read` like every other section.
|
|
20
|
+
- `#/api`, `#/auth`, `#/sync`, `#/license`, `#/docs` (and `/docs`) open the matching System page;
|
|
21
|
+
`#/processes`, `#/processing` open the Runtime page's Processes / Processors tab.
|
|
22
|
+
- Admin: the License page hides/disables Add, Activate and Remove for tokens without
|
|
23
|
+
`system:write`, matching the server-side gate.
|
|
24
|
+
- Admin: the DB overview's Time Machine card now needs `schema:read` to load at all (no 403 in
|
|
25
|
+
the console without it) and disables Enable/Disable All and per-type Enable/Disable without
|
|
26
|
+
`schema:write`, matching the server-side gate.
|
|
27
|
+
|
|
28
|
+
### Security
|
|
29
|
+
|
|
30
|
+
- **Time-machine routes checked no permission.** The `/api/env/:env/time-machine…` routes declared
|
|
31
|
+
no access, so any authenticated token — one holding only `env:read`, or a grant for another env —
|
|
32
|
+
could read every document's field-level history (`…/:type/:key/history`, `…/at/:clock`,
|
|
33
|
+
`…/changes`) and enable, disable or drop tracking. They now need `data:read` for history, state
|
|
34
|
+
and diffs, `schema:read` for status (`/time-machine`, `/types`, `/types/:type`, `/status`) and
|
|
35
|
+
`schema:write` to enable/disable/drop/flush (incl. the deprecated `POST`/`DELETE …/enable`); all
|
|
36
|
+
are env-scoped, so per-env grants and the protected `~` env gate apply.
|
|
37
|
+
- **Any authenticated token could manage licences or join the node to a cluster.**
|
|
38
|
+
`GET /admin/license/status` now needs `system:read`; `POST /admin/license`,
|
|
39
|
+
`POST /admin/license/:id/activate` and `DELETE /admin/license/:id` need `system:write`;
|
|
40
|
+
`POST /admin/setup/join` (joining starts replicating this node's data) needs `sync:write`.
|
|
41
|
+
First-run setup in open/bootstrap mode is unaffected.
|
|
42
|
+
- A route-table test (`tests/auth-routes-have-permissions.test.js`) now fails for any route that
|
|
43
|
+
declares no permission unless it is allow-listed as public / authenticated-only with a reason,
|
|
44
|
+
and for any `:env` route with an env-scoped permission that lacks `scope: 'env'`.
|
|
45
|
+
- **`/api/env/:env/engines…` (12 routes) skipped the protected `~` env gate.** They declared
|
|
46
|
+
`system:*` without `scope: 'env'`, so a token holding `system:write` alone — no
|
|
47
|
+
`protected:write` — could create, patch, delete, restart, pause/resume/retry/reset-cursor or
|
|
48
|
+
rebuild an engine directly in `~system` (or any other `~` env), unlike every other route that
|
|
49
|
+
touches a `~` env. They now declare `scope: 'env'`, like the `ttl` routes already did.
|
|
50
|
+
- `tests/auth-routes-have-permissions.test.js`'s `:env`-scope check no longer exempts
|
|
51
|
+
`system:*`/`auth:*`/`sync:*` permissions from needing `scope: 'env'` — that blanket exemption
|
|
52
|
+
is what let the engines routes above go unnoticed. The rule is now uniform (every `:env` route
|
|
53
|
+
with a permission declares the scope), with `ENV_SCOPE_EXCEPTIONS` reserved for genuine
|
|
54
|
+
one-offs, and a new test locks in `~system` engines needing `protected:*`.
|
|
55
|
+
|
|
56
|
+
### Fixed
|
|
57
|
+
|
|
58
|
+
- **Per-env grants were refused on the embeddings type-pipeline routes.** The 19
|
|
59
|
+
`/api/env/:env/type/:type/pipelines…` routes (list/create, stop/start/restart/delete, stats,
|
|
60
|
+
flush, query/nearest, snapshot/rebuild, docs and their markDone/markFail/markDelete/retry,
|
|
61
|
+
retry-failed) did not declare their env scope, so a per-env grant got 403 there. They now honour
|
|
62
|
+
per-env grants and the protected `~` env gate, like their `/api/env/:env/pipelines…` siblings.
|
|
63
|
+
- **Per-env grants were refused on the schema, violation and pipeline routes.**
|
|
64
|
+
`/api/env/:env/type/:type/schema`, `/api/env/:env/violations[/:type]`,
|
|
65
|
+
`/api/env/:env/type/:type/violations/:key`, `/api/env/:env/ref-violations[/:type]` and
|
|
66
|
+
`/api/env/:env/pipelines…` did not declare their env scope, so a token whose `schema:read` (or
|
|
67
|
+
`schema:write`) was granted for one env got 403 there (the admin DB section's Schema tab and
|
|
68
|
+
violation badges failed for such tokens). They now honour per-env grants — and, like the other env
|
|
69
|
+
routes, the protected `~` env gate.
|
|
70
|
+
- Admin: links inside the admin (`#/…`) reloaded the whole page (`<base href>` made them point at
|
|
71
|
+
another document); they now navigate in place. After login the admin returns to the page you
|
|
72
|
+
opened.
|
|
73
|
+
- Admin: a deep link with `?env=` loaded the default env first; the URL's env is now selected before
|
|
74
|
+
anything loads. DB keeps `?type=` across env switches when the new env has that type.
|
|
75
|
+
- Admin: duplicate requests removed — Views loaded its list and every view's meta/definition twice,
|
|
76
|
+
`/api/system/storage` was fetched by the version badge and again by each overview (now once,
|
|
77
|
+
shared), `/admin/login/config` twice at boot, a function was loaded two or three times when opened
|
|
78
|
+
and the function list twice after create; DB entry and deep links make each call once.
|
|
79
|
+
- Admin: tokens without `system:read` no longer get 403s from the storage badge, the event stream or
|
|
80
|
+
DB's system-wide cards; the TTL and schema buttons check the permissions their routes require.
|
|
81
|
+
- Admin: a newly created view now opens; the Pipelines "↗ Type" button opens the type in DB; Files
|
|
82
|
+
honours `?collection=`; Auth's `?token=` deep link works again; queue job types show before their
|
|
83
|
+
first job; the queue job-type schema editor no longer requests `/admin/undefined/types`; System
|
|
84
|
+
works with no env selected; System → Overview's 10 s refresh stops when you leave it and its
|
|
85
|
+
styles no longer leak into DB and Pipelines.
|
|
86
|
+
- Admin static files: path containment is separator-aware (a sibling directory whose name starts
|
|
87
|
+
with the served directory's name could be read).
|
|
88
|
+
|
|
89
|
+
## [2.5.0] - 2026-09-28
|
|
90
|
+
|
|
91
|
+
### Added
|
|
92
|
+
|
|
93
|
+
- **`OKDB.clone(src, dst)` and `OKDB.reidentify(path)` — a copied store gets its own identity.**
|
|
94
|
+
A file-copied store (a test template, a restored backup) used to keep the original's `~system`
|
|
95
|
+
identity, so copies shared its UDP bus group (receiving each other's POKE/DRAIN/TYPE_DROP), sync
|
|
96
|
+
node id, node keypair, token secret and licence node binding. `clone()` copies a **closed** store
|
|
97
|
+
(refuses `STORE_IN_USE` while any env is open; `CLONE_DEST_NOT_EMPTY`, `CLONE_DEST_OVERLAPS_SOURCE`)
|
|
98
|
+
and marks the copy; `reidentify()` marks a copy you made yourself (e.g. a hot backup from
|
|
99
|
+
`db.migrate.backup()`); `okdb restore <backup> --path <dst> --new-identity` does both. The copy's
|
|
100
|
+
first `open()` mints a fresh id exactly once. Its copied history still counts as its own
|
|
101
|
+
(`originMode` filters treat former ids as self up to each env's fork clock, `db.formerIds`), so
|
|
102
|
+
FTS/views/indexes/time-machine are consistent without a rebuild; sync links and peer cursors are
|
|
103
|
+
dropped (it joins as a new node), secrets and keypair are regenerated, locks and leases dropped.
|
|
104
|
+
Node-bound licence activations report `wrong_node` on the copy. See
|
|
105
|
+
[Migration → Cloning a store](docs/migration.md).
|
|
106
|
+
- **`okdb shm-gc`** — deletes okdb shared-memory segments in `/dev/shm` that no process maps or
|
|
107
|
+
holds open (leaked by okdb ≤ 2.4.0, see Fixed). `--dry-run`; `--prefix` (default `-tmp-`: only
|
|
108
|
+
stores under `/tmp`); `--force` when some same-user processes' maps are unreadable. Linux only.
|
|
109
|
+
|
|
110
|
+
### Fixed
|
|
111
|
+
|
|
112
|
+
- **Four OKDB instances indexing FTS in one process deadlocked every write in that process.**
|
|
113
|
+
lmdb-js runs each async commit on a libuv thread-pool thread (`UV_THREADPOOL_SIZE`, default 4)
|
|
114
|
+
and keeps it while the commit callback is pending; the FTS commit held its post txn while its docs
|
|
115
|
+
txn needed a second thread, so four concurrent FTS commits took the whole pool and every later
|
|
116
|
+
commit in the process hung (logged as `writer STALL` on unrelated envs). Such nested holds are now
|
|
117
|
+
capped process-wide below the pool size. Workaround for older versions: `UV_THREADPOOL_SIZE=16`.
|
|
118
|
+
- **Shared-memory segments leaked forever.** Every env path ever opened left a `/dev/shm` entry
|
|
119
|
+
(one per env plus one boot-lock segment per store; millions on test machines), and a new store at
|
|
120
|
+
a reused path inherited the old one's clock, drain and writer-cell state. The last process to
|
|
121
|
+
close an env path now unlinks its segment; an opener racing that unlink keeps the segment alive or
|
|
122
|
+
moves to its successor, so cross-process clock/HLC state never splits. Run `okdb shm-gc` once to
|
|
123
|
+
clear leaks from older versions.
|
|
124
|
+
- **Cluster worker disconnected during `open()` never exited.** A worker the primary disconnected
|
|
125
|
+
while it was still booting missed the `disconnect` event and kept the store open indefinitely
|
|
126
|
+
(the `ppid === 1` backstop never fires under a subreaper such as systemd --user).
|
|
127
|
+
- **Two stores could share shared-memory state.** Segment names replaced every non-alphanumeric
|
|
128
|
+
character with `-`, so e.g. store `/a/b` with env `c-d` and store `/a/b-c` with env `d` shared one
|
|
129
|
+
segment (clock, HLC, compaction drain, writer cells); the boot-lock segment also collided with an
|
|
130
|
+
env named `boot`. Names now carry a hash of the full path.
|
|
131
|
+
- **`open()` failed for store paths longer than ~250 characters** (`shm_open failed: File name too
|
|
132
|
+
long`; ~30 on macOS). Segment names are now length-bounded.
|
|
133
|
+
- **A worker thread killed by `terminate()` mid-write blocked compaction.** Its writer cell stayed
|
|
134
|
+
claimed under the live host pid, pinning the env as shared and its writer count above zero. Cells
|
|
135
|
+
now record the owning thread and are released when the thread exits.
|
|
136
|
+
- **Views missed writes synced in from peers.** Sync views and every view's `$ref` / live map `$ref`
|
|
137
|
+
sections skipped remote-origin writes, which a rebuild then counted — live results and a rebuild
|
|
138
|
+
could disagree, and a later local update of such a doc undid a contribution never added. Views now
|
|
139
|
+
count every write. View storage version 6 → 7: on first open, affected views rebuild once — only
|
|
140
|
+
on stores that have (or had) a sync peer or are clones; all other views are restamped.
|
|
141
|
+
- **A failed `open()` leaked everything it had opened** (LMDB envs, shared memory, timers, registry
|
|
142
|
+
rows) for the life of the process, and `close()` then threw `INVALID_STATE`. It now tears down
|
|
143
|
+
before rethrowing the original error; the instance is left `STOPPED`.
|
|
144
|
+
- **`originMode` was ignored by async processors registered with `handler: '<name>'` or `module`**
|
|
145
|
+
(they received every write). It is now applied on every delivery path, including snapshot
|
|
146
|
+
bootstrap; the cursor still advances past filtered-out changes. **Behaviour change:** without an
|
|
147
|
+
explicit `originMode` these processors now get the documented default `'self'` — pass
|
|
148
|
+
`originMode: 'all'` to keep receiving synced-in writes (see [UPGRADING.md](UPGRADING.md)).
|
|
149
|
+
- **A copied store opened the original's `~log`.** Older stores recorded the `~log` env as an
|
|
150
|
+
absolute path; it is now stored relative and healed on open.
|
|
151
|
+
|
|
152
|
+
### Changed
|
|
153
|
+
|
|
154
|
+
- **Faster `open()`.** The live-subscriptions store (`~sub`) and its signal router are created on
|
|
155
|
+
first subscription use instead of at every open; licence signature verification is memoized per
|
|
156
|
+
process; a brand-new store records its storage migrations as done instead of running them; the
|
|
157
|
+
sync node keypair is minted on first use. A fresh store opens in about half the time.
|
|
158
|
+
- **Shared-memory segment names now end in a hash of the full store path** (a readable prefix is
|
|
159
|
+
kept, so stores under `/tmp` still start with `-tmp-`). **Old and new versions no longer share
|
|
160
|
+
segments: stop every process on a store and restart them together — no rolling upgrade across
|
|
161
|
+
this release** (see [UPGRADING.md](UPGRADING.md)). A live okdb ≤ 2.4.0 writer on the same store is
|
|
162
|
+
detected and logged.
|
|
163
|
+
- `close()` on a stopped instance is a no-op (a second `close()` used to throw `INVALID_STATE`);
|
|
164
|
+
plugins are stopped only if their `start()` succeeded, in reverse order.
|
|
165
|
+
- `writer STALL` log names a saturated libuv thread pool as a possible cause (it blamed fsync only).
|
|
166
|
+
|
|
7
167
|
## [2.4.0] - 2026-09-25
|
|
8
168
|
|
|
9
169
|
### Security
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const _0x31c441=_0x2d84;(function(_0x8aa4bb,_0x3ce597){const _0x4834b3=_0x2d84,_0x7a0cc3=_0x8aa4bb();while(!![]){try{const _0x2df0ca=parseInt(_0x4834b3(0x196))/0x1+parseInt(_0x4834b3(0x20f))/0x2*(-parseInt(_0x4834b3(0x16e))/0x3)+parseInt(_0x4834b3(0x176))/0x4+-parseInt(_0x4834b3(0x19b))/0x5*(-parseInt(_0x4834b3(0x208))/0x6)+parseInt(_0x4834b3(0x162))/0x7+-parseInt(_0x4834b3(0x1b9))/0x8+-parseInt(_0x4834b3(0x1a9))/0x9*(parseInt(_0x4834b3(0x18d))/0xa);if(_0x2df0ca===_0x3ce597)break;else _0x7a0cc3['push'](_0x7a0cc3['shift']());}catch(_0xae0633){_0x7a0cc3['push'](_0x7a0cc3['shift']());}}}(_0x1f86,0x94049));var require$$0$1=require(_0x31c441(0x165)),require$$0=require('fs'),require$$1=require('path'),require$$2=require('os'),require$$3=require(_0x31c441(0x169));function _0x2d84(_0x4bff9c,_0x5304ac){_0x4bff9c=_0x4bff9c-0x162;const _0x1f86ad=_0x1f86();let _0x2d8461=_0x1f86ad[_0x4bff9c];return _0x2d8461;}function getDefaultExportFromCjs(_0x2d144f){const _0x56e563=_0x31c441;return _0x2d144f&&_0x2d144f[_0x56e563(0x1ca)]&&Object[_0x56e563(0x1cd)][_0x56e563(0x199)][_0x56e563(0x182)](_0x2d144f,_0x56e563(0x173))?_0x2d144f[_0x56e563(0x173)]:_0x2d144f;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x5a627c=_0x31c441;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x284fa=require$$0,_0x5397ba=require$$1,_0x5b0cdb=require$$2,_0x4d7da0=require$$3;function _0x22d13b(){const _0x424e1f=_0x2d84;return Date[_0x424e1f(0x1ff)]();}function _0x3bf671(_0x579fea){const _0x36c2c6=_0x2d84;try{return _0x284fa[_0x36c2c6(0x1dd)](_0x579fea);}catch{return![];}}function _0xd8b77(_0x21ae9c){const _0x36ad3d=_0x2d84;try{return _0x284fa[_0x36ad3d(0x188)](_0x21ae9c,_0x36ad3d(0x179));}catch{return null;}}function _0x425259(_0x363690,_0x14d938){const _0x4b839d=_0x2d84,_0x174e90=_0x363690+_0x4b839d(0x164)+_0x4d7da0['randomBytes'](0x6)[_0x4b839d(0x16f)](_0x4b839d(0x20d));_0x284fa['writeFileSync'](_0x174e90,_0x14d938),_0x284fa[_0x4b839d(0x1c8)](_0x174e90,_0x363690);}function _0x29df22(_0x33b9fa,_0x16f5ff=0x10){const _0x427e5e=_0x2d84,_0x15ae65=String(Math[_0x427e5e(0x22d)](0x0,Math[_0x427e5e(0x191)](_0x33b9fa||0x0)));return _0x15ae65['length']>=_0x16f5ff?_0x15ae65:'0'[_0x427e5e(0x17e)](_0x16f5ff-_0x15ae65[_0x427e5e(0x21f)])+_0x15ae65;}return snapshotStore=class _0x4042e7{constructor({dir:_0x19e8f9,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x2a8ab3=_0x2d84;if(!_0x19e8f9)throw new Error(_0x2a8ab3(0x16b));this[_0x2a8ab3(0x22a)]=_0x19e8f9,this['snapshotsDir']=_0x5397ba[_0x2a8ab3(0x20c)](_0x19e8f9,_0x2a8ab3(0x1d1)),this['currentPath']=_0x5397ba[_0x2a8ab3(0x20c)](_0x19e8f9,_0x2a8ab3(0x1af)),this[_0x2a8ab3(0x204)]=_0x5397ba[_0x2a8ab3(0x20c)](_0x19e8f9,_0x2a8ab3(0x1fc)),this[_0x2a8ab3(0x238)]=keepSnapshots,this[_0x2a8ab3(0x1d3)]=log,_0x284fa[_0x2a8ab3(0x1c6)](this[_0x2a8ab3(0x22a)],{'recursive':!![]}),_0x284fa[_0x2a8ab3(0x1c6)](this[_0x2a8ab3(0x21d)],{'recursive':!![]});}[_0x5a627c(0x1f8)](_0x4a81ca){const _0x34c984=_0x5a627c;return _0x5397ba['join'](this[_0x34c984(0x21d)],_0x4a81ca);}[_0x5a627c(0x23b)](_0x2cbfeb){const _0x981f2=_0x5a627c,_0x3948c4=this[_0x981f2(0x1f8)](_0x2cbfeb);return{'dir':_0x3948c4,'index':_0x5397ba[_0x981f2(0x20c)](_0x3948c4,_0x981f2(0x198)),'labels':_0x5397ba[_0x981f2(0x20c)](_0x3948c4,_0x981f2(0x207)),'state':_0x5397ba[_0x981f2(0x20c)](_0x3948c4,_0x981f2(0x18e))};}[_0x5a627c(0x1da)](){const _0x4b122e=_0x5a627c;if(!_0x3bf671(this['currentPath']))return null;const _0x50541b=_0xd8b77(this['currentPath']);if(!_0x50541b)return null;const _0x3bd471=String(_0x50541b)[_0x4b122e(0x1aa)]();return _0x3bd471||null;}['readCurrentClock'](){const _0xf08db0=_0x5a627c,_0xe8c0b8=this['readCurrentId']();if(!_0xe8c0b8)return 0x0;const _0x526566=Number(_0xe8c0b8);return Number[_0xf08db0(0x232)](_0x526566)?_0x526566:0x0;}[_0x5a627c(0x1b8)](){const _0x10410c=_0x5a627c;try{return _0x284fa[_0x10410c(0x1bd)](this[_0x10410c(0x21d)],{'withFileTypes':!![]})[_0x10410c(0x1ac)](_0x3d5538=>_0x3d5538[_0x10410c(0x1cb)]())[_0x10410c(0x1bb)](_0x1a3d89=>_0x1a3d89[_0x10410c(0x233)])['filter'](_0x5d08c3=>!_0x5d08c3[_0x10410c(0x219)](_0x10410c(0x164)))[_0x10410c(0x1ac)](_0x425ec5=>!_0x425ec5[_0x10410c(0x219)](_0x10410c(0x16d)))[_0x10410c(0x23a)]();}catch{return[];}}[_0x5a627c(0x1c4)](){const _0x41bf4d=_0x5a627c,_0x4fe705=this['readCurrentId']();if(_0x4fe705)return _0x4fe705;const _0x3a5f24=this[_0x41bf4d(0x1b8)]();if(!_0x3a5f24['length'])return null;return _0x3a5f24[_0x3a5f24[_0x41bf4d(0x21f)]-0x1];}['cleanupTmpDirs']({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x524283=_0x5a627c;let _0x1b310a;try{_0x1b310a=_0x284fa[_0x524283(0x1bd)](this['snapshotsDir'],{'withFileTypes':!![]});}catch{return;}const _0x3336be=_0x22d13b()-maxAgeMs;for(const _0x3dbdc0 of _0x1b310a){if(!_0x3dbdc0[_0x524283(0x1cb)]())continue;const _0x29993d=_0x3dbdc0['name'];if(!_0x29993d[_0x524283(0x219)]('.tmp-')&&!_0x29993d[_0x524283(0x219)](_0x524283(0x16d)))continue;const _0x17b5f0=_0x5397ba[_0x524283(0x20c)](this[_0x524283(0x21d)],_0x29993d);try{const _0x439c98=_0x284fa[_0x524283(0x200)](_0x17b5f0);if(_0x439c98[_0x524283(0x1ad)]>_0x3336be)continue;}catch{}try{_0x284fa['rmSync'](_0x17b5f0,{'recursive':!![],'force':!![]});}catch{}}}[_0x5a627c(0x1e4)]({keep:keep=null}={}){const _0x26c439=_0x5a627c,_0x39771c=Math[_0x26c439(0x22d)](0x1,Math[_0x26c439(0x191)](keep??this[_0x26c439(0x238)]??0x3)),_0x51880d=this[_0x26c439(0x1b8)]();if(_0x51880d[_0x26c439(0x21f)]<=_0x39771c)return;const _0x55193e=this[_0x26c439(0x1da)](),_0x516b21=_0x51880d[_0x26c439(0x23f)](0x0,Math[_0x26c439(0x22d)](0x0,_0x51880d['length']-_0x39771c));for(const _0x59958c of _0x516b21){if(_0x55193e&&_0x59958c===_0x55193e)continue;const _0x204615=this[_0x26c439(0x1f8)](_0x59958c);try{_0x284fa[_0x26c439(0x218)](_0x204615,{'recursive':!![],'force':!![]});}catch{}}}async[_0x5a627c(0x183)](_0x86a72,_0x1effa8){const _0x125fd6=_0x5a627c;if(!_0x86a72)throw new Error('snapshot\x20id\x20required');const _0x51f2bd=this[_0x125fd6(0x23b)](_0x86a72);if(!_0x3bf671(_0x51f2bd[_0x125fd6(0x211)])||!_0x3bf671(_0x51f2bd[_0x125fd6(0x19f)])||!_0x3bf671(_0x51f2bd[_0x125fd6(0x178)]))throw new Error(_0x125fd6(0x229)+_0x86a72);const _0xf24f51=await _0x1effa8(_0x51f2bd);return _0xf24f51||{};}async[_0x5a627c(0x1a1)](_0x343ef0,_0x4ccdf4,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x3f51fe=_0x5a627c,_0x9c40db=Number(_0x343ef0);if(!Number[_0x3f51fe(0x232)](_0x9c40db)||_0x9c40db<0x0)throw new Error(_0x3f51fe(0x22f));const _0x21c3d5=_0x29df22(_0x9c40db),_0x52539c=this[_0x3f51fe(0x1f8)](_0x21c3d5),_0x5f389d=_0x5397ba[_0x3f51fe(0x20c)](this[_0x3f51fe(0x21d)],_0x3f51fe(0x164)+_0x21c3d5+'-'+_0x4d7da0[_0x3f51fe(0x236)](0x6)[_0x3f51fe(0x16f)](_0x3f51fe(0x20d)));_0x284fa[_0x3f51fe(0x1c6)](_0x5f389d,{'recursive':!![]});const _0x1708c9={'dir':_0x5f389d,'index':_0x5397ba[_0x3f51fe(0x20c)](_0x5f389d,_0x3f51fe(0x198)),'labels':_0x5397ba['join'](_0x5f389d,_0x3f51fe(0x207)),'state':_0x5397ba['join'](_0x5f389d,_0x3f51fe(0x18e))};await _0x4ccdf4(_0x1708c9,{'id':_0x21c3d5,'clock':_0x9c40db});const _0x4606a9=JSON['stringify']({'pid':process[_0x3f51fe(0x1db)],'host':_0x5b0cdb[_0x3f51fe(0x1f3)](),'at':_0x22d13b()}),_0xcdc217=_0x22d13b();let _0x168909=null;const _0xc17cab=()=>{const _0x4de0fd=_0x3f51fe;try{const _0x57a58c=JSON['parse'](_0x284fa[_0x4de0fd(0x188)](this[_0x4de0fd(0x204)],_0x4de0fd(0x179)));if(_0x57a58c['at']&&_0x22d13b()-_0x57a58c['at']>staleLockMaxAgeMs){const _0x1854b2=_0x22d13b()-_0x57a58c['at'],_0x25fc51='Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20'+Math[_0x4de0fd(0x1e5)](_0x1854b2/0x3e8)+_0x4de0fd(0x1d6)+_0x57a58c[_0x4de0fd(0x1db)]+_0x4de0fd(0x1ab)+_0x57a58c[_0x4de0fd(0x172)]+_0x4de0fd(0x201)+_0x4de0fd(0x1ea);this[_0x4de0fd(0x1d3)]?.[_0x4de0fd(0x185)]?this['log'][_0x4de0fd(0x185)](_0x25fc51):console[_0x4de0fd(0x185)](_0x4de0fd(0x235),_0x25fc51);try{_0x284fa['unlinkSync'](this[_0x4de0fd(0x204)]);}catch{}return!![];}}catch{try{_0x284fa[_0x4de0fd(0x18a)](this[_0x4de0fd(0x204)]);}catch{}}return![];},_0x463da9=()=>{const _0x79b200=_0x3f51fe;try{return _0x168909=_0x284fa[_0x79b200(0x192)](this[_0x79b200(0x204)],'wx'),_0x284fa['writeFileSync'](_0x168909,_0x4606a9),!![];}catch(_0x35aa1f){if(_0x35aa1f&&_0x35aa1f[_0x79b200(0x1e3)]===_0x79b200(0x1c2))return![];throw _0x35aa1f;}};if(!_0x463da9()){_0xc17cab(),_0x463da9();if(_0x168909==null&&lockTimeoutMs>0x0)while(_0x22d13b()-_0xcdc217<lockTimeoutMs){await new Promise(_0x5f046a=>setTimeout(_0x5f046a,0x19));if(_0x463da9())break;_0xc17cab();}}if(_0x168909==null){try{_0x284fa['rmSync'](_0x5f389d,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':'lock_busy'};}try{const _0x103664=this[_0x3f51fe(0x1a4)]();if(_0x9c40db<=_0x103664){try{_0x284fa[_0x3f51fe(0x218)](_0x5f389d,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x3f51fe(0x18b),'currentClock':_0x103664};}if(!_0x3bf671(_0x52539c))_0x284fa[_0x3f51fe(0x1c8)](_0x5f389d,_0x52539c);else try{_0x284fa[_0x3f51fe(0x218)](_0x5f389d,{'recursive':!![],'force':!![]});}catch{}return _0x425259(this[_0x3f51fe(0x227)],_0x21c3d5+'\x0a'),this['prune']({'keep':keep}),{'published':!![],'currentClock':_0x9c40db};}finally{try{_0x284fa[_0x3f51fe(0x240)](_0x168909);}catch{}try{_0x284fa[_0x3f51fe(0x18a)](this['lockPath']);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x2f931d=_0x31c441;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x28b42e=require$$0;class _0x1bf8d0{constructor(){const _0x455d65=_0x2d84;this[_0x455d65(0x1a2)]=new Map(),this[_0x455d65(0x215)]=new Map(),this[_0x455d65(0x1f7)]=0x0,this[_0x455d65(0x22b)]=0x0,this[_0x455d65(0x203)]=new Map(),this[_0x455d65(0x242)]=!![];}async[_0x2f931d(0x1e0)](){const _0x58871e=_0x2f931d;this['keyToLabel']=new Map(),this[_0x58871e(0x215)]=new Map(),this[_0x58871e(0x203)]=new Map(),this[_0x58871e(0x242)]=!![],this['nextLabel']=0x0,this['_tombstoneCount']=0x0;}async[_0x2f931d(0x210)](_0x456cc9){const _0x353c6b=_0x2f931d;if(!_0x456cc9||!_0x28b42e[_0x353c6b(0x1dd)](_0x456cc9))return await this[_0x353c6b(0x1e0)](),!![];let _0x4ac263;try{_0x4ac263=_0x28b42e[_0x353c6b(0x188)](_0x456cc9,'utf8');}catch{return await this['reset'](),!![];}let _0x5adfbe;try{_0x5adfbe=JSON['parse'](_0x4ac263);}catch{return await this[_0x353c6b(0x1e0)](),!![];}const _0x48ae15=Array[_0x353c6b(0x21e)](_0x5adfbe?.[_0x353c6b(0x1a3)])?_0x5adfbe['entries']:[],_0x4f2dea=Number[_0x353c6b(0x187)](_0x5adfbe?.['nextLabel'])?_0x5adfbe[_0x353c6b(0x1f7)]:0x0,_0x4fe8f4=new Map(),_0x1c7d93=new Map(),_0x781fc=new Map(),_0x25538d=_0x5adfbe?.[_0x353c6b(0x1d4)]>=0x2;let _0xe7ded7=-0x1;for(const _0x40621f of _0x48ae15){if(!Array[_0x353c6b(0x21e)](_0x40621f)||_0x40621f[_0x353c6b(0x21f)]<0x2)continue;const _0x5bd4b4=Number(_0x40621f[0x0]),_0x424668=String(_0x40621f[0x1]??'');if(!Number[_0x353c6b(0x187)](_0x5bd4b4)||_0x5bd4b4<0x0)continue;if(!_0x424668)continue;_0x4fe8f4[_0x353c6b(0x1ba)](_0x424668,_0x5bd4b4),_0x1c7d93[_0x353c6b(0x1ba)](_0x5bd4b4,_0x424668);if(_0x25538d&&typeof _0x40621f[0x2]==='number')_0x781fc[_0x353c6b(0x1ba)](_0x424668,_0x40621f[0x2]);if(_0x5bd4b4>_0xe7ded7)_0xe7ded7=_0x5bd4b4;}return this[_0x353c6b(0x1a2)]=_0x4fe8f4,this[_0x353c6b(0x215)]=_0x1c7d93,this[_0x353c6b(0x203)]=_0x781fc,this[_0x353c6b(0x242)]=_0x25538d,this[_0x353c6b(0x1f7)]=Math[_0x353c6b(0x22d)](_0x4f2dea,_0xe7ded7+0x1,0x0),this[_0x353c6b(0x22b)]=0x0,!![];}[_0x2f931d(0x1a0)](_0x5ec151){const _0x3fbd7c=_0x2f931d;return this[_0x3fbd7c(0x1a2)][_0x3fbd7c(0x19d)](_0x5ec151);}[_0x2f931d(0x1ec)](_0x1bf2b7){const _0x286075=_0x2f931d;let _0x2845f0=this[_0x286075(0x1a2)][_0x286075(0x19d)](_0x1bf2b7);if(_0x2845f0!==undefined)return _0x2845f0;return _0x2845f0=this[_0x286075(0x1f7)]++,this['keyToLabel']['set'](_0x1bf2b7,_0x2845f0),this[_0x286075(0x215)][_0x286075(0x1ba)](_0x2845f0,_0x1bf2b7),_0x2845f0;}[_0x2f931d(0x1d0)](_0xa4f0a7,_0x1962b3){const _0x214c34=_0x2f931d;if(_0x1962b3==null)this[_0x214c34(0x203)][_0x214c34(0x16c)](_0xa4f0a7);else this[_0x214c34(0x203)][_0x214c34(0x1ba)](_0xa4f0a7,_0x1962b3);}[_0x2f931d(0x1a8)](_0x3a34a7){const _0xdfdf34=_0x2f931d;return this[_0xdfdf34(0x203)][_0xdfdf34(0x19d)](_0x3a34a7);}[_0x2f931d(0x1eb)](){const _0xecdc20=_0x2f931d;return this[_0xecdc20(0x1a2)][_0xecdc20(0x1eb)]();}[_0x2f931d(0x221)](_0x39616f){const _0x356526=_0x2f931d,_0x2f1e05=this['keyToLabel'][_0x356526(0x19d)](_0x39616f);if(_0x2f1e05===undefined)return;this[_0x356526(0x203)]['delete'](_0x39616f),this[_0x356526(0x1a2)][_0x356526(0x16c)](_0x39616f),this[_0x356526(0x215)][_0x356526(0x16c)](_0x2f1e05),this[_0x356526(0x22b)]++;}[_0x2f931d(0x170)](_0x3010dd){const _0x502a10=_0x2f931d;return this[_0x502a10(0x215)][_0x502a10(0x19d)](_0x3010dd)??null;}[_0x2f931d(0x1d2)](){const _0x3352a8=_0x2f931d;return this[_0x3352a8(0x1a2)][_0x3352a8(0x1d2)];}[_0x2f931d(0x20e)](){return this['_tombstoneCount'];}async[_0x2f931d(0x184)](_0x38d983){const _0x5e79f5=_0x2f931d,_0x2ddc43=_0x38d983+_0x5e79f5(0x1fa),_0x17597d=[];for(const [_0x69f573,_0x2b68e5]of this[_0x5e79f5(0x215)][_0x5e79f5(0x1a3)]()){const _0x46f1c2=this[_0x5e79f5(0x203)]['get'](_0x2b68e5);_0x17597d[_0x5e79f5(0x1b6)](_0x46f1c2==null?[_0x69f573,_0x2b68e5]:[_0x69f573,_0x2b68e5,_0x46f1c2]);}_0x17597d[_0x5e79f5(0x23a)]((_0xe6e5c5,_0x3f1b9e)=>_0xe6e5c5[0x0]-_0x3f1b9e[0x0]);const _0xf4255={'version':0x2,'nextLabel':this[_0x5e79f5(0x1f7)],'entries':_0x17597d};_0x28b42e[_0x5e79f5(0x1f9)](_0x2ddc43,JSON[_0x5e79f5(0x174)](_0xf4255)),_0x28b42e[_0x5e79f5(0x1c8)](_0x2ddc43,_0x38d983);}}return labelMap=_0x1bf8d0,labelMap;}function _0x1f86(){const _0x28332c=['key','remove','repeat','initIndex','cleanupTmpDirs','stop','call','loadSnapshot','snapshotTo','warn','readIndexSync','isInteger','readFileSync','flat','unlinkSync','stale','has','66950HAITDA','state.json','F32','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','trunc','openSync','count','writerLockMaxAgeMs','buffer','1027802xmHBzM','usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','index.hnsw','hasOwnProperty','rebuild','10pvOEGF','writer','get','memoryUsage','labels','labelForExisting','publishSnapshot','keyToLabel','entries','readCurrentClock','vectors','HierarchicalNSW','Unknown\x20op:\x20\x22','fingerprintOf','2745mDEGBA','trim',',\x20host:\x20','filter','mtimeMs','Unknown\x20algorithm:\x20\x22','CURRENT','heartbeatIntervalMs','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20','HNSW_BINDINGS_UNAVAILABLE','markDelete','exports','efConstruction','push','growFactor','listSnapshotIds','142912JRywTp','set','map','unreadable','readdirSync','addPoint','tmpMaxAgeMs','fid','ScalarKind','EEXIST','added','latestSnapshotId','unref','mkdirSync','connectivity','renameSync','clock','__esModule','isDirectory','searchKnn','prototype','save','viewRefreshMs','setFingerprint','snapshots','size','log','version','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','s,\x20pid:\x20','min','getMaxElements','algorithm','readCurrentId','pid','Index','existsSync','search','metric','reset','HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','snapshotMaxLagMs','code','prune','round','removed','fetchAllResult','setEf','parse','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','keys','labelForEphemeral','then','changed','L2sq','ready','from','catch','hostname','distances','queryVec','cosine','nextLabel','_snapshotDir','writeFileSync','.tmp','manifestVersion','SNAPSHOT.LOCK','expansionSearch','token','now','statSync',').\x20','hnsw','keyToFp','lockPath','clear','imul','labels.json','1998012NFgHmI','acquire','expansionAdd','sync','join','hex','tombstoneCount','3716VmVUzR','loadFrom','index','Original\x20error:\x20','arch','sqrt','labelToKey','hnswlib-node','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20','rmSync','startsWith','efSearch','resolve','capacity','snapshotsDir','isArray','length','postMessage','tombstone','error','add','Cos','MetricKind','info','currentPath','cause','snapshot\x20incomplete:\x20','dir','_tombstoneCount','snapshotEveryChanges','max','published','candidateClock\x20must\x20be\x20finite\x20>=\x200','snapshot','dims','isFinite','name','usearch','[SnapshotStore]','randomBytes','reject','keepSnapshots','resizeIndex','sort','_snapshotPaths','load','platform','view','slice','closeSync','node','hasFingerprints','4871594ApfACz','vector','.tmp-','worker_threads','maxElements','fetchAll','message','crypto','ENOENT','SnapshotStore\x20requires\x20dir','delete','_tmp-','1095zVcftO','toString','keyForLabel','for\x20Node\x20','host','default','stringify','versions','3818168uNbgTk','score','state','utf8','isFree','writeIndexSync'];_0x1f86=function(){return _0x28332c;};return _0x1f86();}var indexConvergence,hasRequiredIndexConvergence;function requireIndexConvergence(){if(hasRequiredIndexConvergence)return indexConvergence;hasRequiredIndexConvergence=0x1;function _0x251f2c(_0x4020b1){const _0x155005=_0x2d84,_0x3d6e72=new Uint32Array(_0x4020b1[_0x155005(0x195)],_0x4020b1['byteOffset'],_0x4020b1[_0x155005(0x21f)]);let _0xee6a18=0x811c9dc5,_0x1d9d43=0x9747b28c;for(let _0xf3feca=0x0;_0xf3feca<_0x3d6e72[_0x155005(0x21f)];_0xf3feca++){const _0x4c1564=_0x3d6e72[_0xf3feca];_0xee6a18=Math[_0x155005(0x206)](_0xee6a18^_0x4c1564,0x1000193)>>>0x0;let _0x310520=Math[_0x155005(0x206)](_0x4c1564,0xcc9e2d51);_0x310520=_0x310520<<0xf|_0x310520>>>0x11,_0x1d9d43=Math[_0x155005(0x206)](_0x1d9d43^Math[_0x155005(0x206)](_0x310520,0x1b873593),0x5)+0xe6546b64,_0x1d9d43>>>=0x0;}return _0x1d9d43=Math[_0x155005(0x206)](_0x1d9d43^_0x1d9d43>>>0x10,0x85ebca6b)>>>0x0,(_0xee6a18>>>0x0)*0x100000+(_0x1d9d43&0xfffff);}function _0x2f12fb(_0x3920e0,_0x207b09,_0x476e5c,{upsert:_0x190562,remove:_0x1d288a}){const _0x500091=_0x2d84,_0x3f24d3=new Set();let _0x22c909=0x0,_0x36de1b=0x0,_0x501138=0x0;for(const {key:_0x55e2cb,vector:_0x43d32e}of _0x207b09){if(!(_0x43d32e instanceof Float32Array)||_0x43d32e['length']!==_0x476e5c)continue;_0x3f24d3[_0x500091(0x223)](_0x55e2cb);const _0x4a62ea=_0x251f2c(_0x43d32e),_0x31a226=_0x3920e0['labelForExisting'](_0x55e2cb)!==undefined;if(_0x31a226&&_0x3920e0[_0x500091(0x1a8)](_0x55e2cb)===_0x4a62ea)continue;_0x190562(_0x55e2cb,_0x43d32e,_0x4a62ea);if(_0x31a226)_0x36de1b++;else _0x22c909++;}for(const _0x291c16 of[..._0x3920e0[_0x500091(0x1eb)]()]){if(_0x3f24d3[_0x500091(0x18c)](_0x291c16))continue;_0x1d288a(_0x291c16),_0x501138++;}return{'added':_0x22c909,'changed':_0x36de1b,'removed':_0x501138};}return indexConvergence={'fingerprint':_0x251f2c,'reconcileIndex':_0x2f12fb},indexConvergence;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x1fb427=requireSnapshotStore(),_0x444cf1=requireLabelMap(),{fingerprint:_0xd485ae,reconcileIndex:_0x281f25}=requireIndexConvergence(),_0x358c59=0x1;let _0x418d43=null;function _0x3959f2(){const _0x276e7b=_0x2d84;if(_0x418d43)return _0x418d43;try{return _0x418d43=require(_0x276e7b(0x216)),_0x418d43;}catch(_0x43a772){const _0x1affec=new Error(_0x276e7b(0x1e1)+(_0x276e7b(0x171)+process[_0x276e7b(0x175)][_0x276e7b(0x241)]+'\x20on\x20'+process[_0x276e7b(0x23d)]+'/'+process[_0x276e7b(0x213)]+'.\x20')+_0x276e7b(0x1b1)+(_0x276e7b(0x212)+(_0x43a772?.[_0x276e7b(0x168)]||String(_0x43a772))));_0x1affec[_0x276e7b(0x1e3)]=_0x276e7b(0x1b2),_0x1affec[_0x276e7b(0x228)]=_0x43a772;throw _0x1affec;}}return hnsw=function _0x3c2782(_0x36cb1d={},{dims:_0x16a73f,dir:_0x347adb}){const _0x2d4734=_0x2d84,_0x200658=_0x3959f2();if(!_0x16a73f||_0x16a73f<=0x0)throw new Error(_0x2d4734(0x190));if(!_0x347adb)throw new Error('hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage');const _0x28d43f={'metric':_0x36cb1d[_0x2d4734(0x1df)]??_0x2d4734(0x1f6),'M':_0x36cb1d['M']??0x10,'efConstruction':_0x36cb1d[_0x2d4734(0x1b5)]??0xc8,'efSearch':_0x36cb1d[_0x2d4734(0x21a)]??0x40,'maxElements':_0x36cb1d[_0x2d4734(0x166)]??0x400,'growFactor':_0x36cb1d[_0x2d4734(0x1b7)]??0x2,'snapshotEveryChanges':_0x36cb1d[_0x2d4734(0x22c)]??0xc350,'keepSnapshots':_0x36cb1d[_0x2d4734(0x238)]??0x2,'tmpMaxAgeMs':_0x36cb1d[_0x2d4734(0x1bf)]??0x6*0x36ee80},_0x2dbad3=new _0x1fb427({'dir':_0x347adb,'keepSnapshots':_0x28d43f['keepSnapshots']}),_0x4d24b4=new _0x444cf1();let _0x79e3e7=null,_0x481dcd=0x0,_0x60e80e=null,_0x4752c2=Promise[_0x2d4734(0x21b)]();const _0x8a94b9=_0x3c9496=>{const _0x2c9c7f=_0x2d4734,_0x4b935c=_0x4752c2[_0x2c9c7f(0x1ed)](_0x3c9496);return _0x4752c2=_0x4b935c[_0x2c9c7f(0x1f2)](()=>{}),_0x4b935c;};async function _0x914392(_0x46255c){const _0xd8571d=_0x2d4734;await _0x4d24b4['reset'](),_0x46255c=_0x46255c??[];const _0x2c4950=Math[_0xd8571d(0x22d)](_0x28d43f[_0xd8571d(0x166)],Math['ceil'](_0x46255c[_0xd8571d(0x21f)]*(_0x28d43f[_0xd8571d(0x1b7)]||1.2)),0x1);_0x79e3e7=new _0x200658[(_0xd8571d(0x1a6))](_0x28d43f[_0xd8571d(0x1df)],_0x16a73f),_0x79e3e7[_0xd8571d(0x17f)]({'maxElements':_0x2c4950,'efConstruction':_0x28d43f[_0xd8571d(0x1b5)],'M':_0x28d43f['M']});for(const {key:_0x4be879,vector:_0x1a2640}of _0x46255c){if(!(_0x1a2640 instanceof Float32Array)||_0x1a2640['length']!==_0x16a73f)continue;_0x19d79f(_0x4be879,_0x1a2640);}_0x79e3e7[_0xd8571d(0x1e8)](_0x28d43f[_0xd8571d(0x21a)]),_0x481dcd=0x0;}async function _0x54dea5(_0x5199b){return _0x914392(_0x5199b?await _0x5199b():[]);}function _0x5dcaec(){const _0x19402e=_0x2d4734;if(_0x79e3e7['getCurrentCount']()<_0x79e3e7['getMaxElements']())return;const _0x4a0421=Math['ceil'](_0x79e3e7[_0x19402e(0x1d8)]()*(_0x28d43f[_0x19402e(0x1b7)]||0x2));_0x79e3e7[_0x19402e(0x239)](_0x4a0421),_0x28d43f['maxElements']=_0x4a0421;}function _0x19d79f(_0x3fc6cb,_0x1b62e2,_0x3c1c00){const _0x162d83=_0x2d4734,_0x374c82=_0x4d24b4[_0x162d83(0x1ec)](_0x3fc6cb);try{_0x79e3e7[_0x162d83(0x1b3)](_0x374c82);}catch{}_0x5dcaec(),_0x79e3e7[_0x162d83(0x1be)](Array[_0x162d83(0x1f1)](_0x1b62e2),_0x374c82),_0x4d24b4[_0x162d83(0x1d0)](_0x3fc6cb,_0x3c1c00??_0xd485ae(_0x1b62e2));}function _0x20903c(_0x31d992){const _0x5cd496=_0x2d4734,_0x16ca1d=_0x4d24b4[_0x5cd496(0x1a0)](_0x31d992);if(_0x16ca1d===undefined)return![];try{_0x79e3e7[_0x5cd496(0x1b3)](_0x16ca1d);}catch{}return _0x4d24b4['tombstone'](_0x31d992),!![];}function _0x31b616(){const _0x33f0d0=_0x2d4734;return Math[_0x33f0d0(0x22d)](Date['now'](),_0x2dbad3['readCurrentClock']()+0x1);}async function _0x412b9c(_0x300bf8){const _0x16b521=_0x2d4734;if(!_0x79e3e7||!_0x300bf8)return![];const _0x3e54e6=await _0x2dbad3[_0x16b521(0x1a1)](_0x300bf8,async _0x4e8039=>{const _0x167c25=_0x16b521;_0x79e3e7[_0x167c25(0x17b)](_0x4e8039[_0x167c25(0x211)]),await _0x4d24b4[_0x167c25(0x184)](_0x4e8039[_0x167c25(0x19f)]);const _0xe2d72c=require$$0;_0xe2d72c[_0x167c25(0x1f9)](_0x4e8039[_0x167c25(0x178)],JSON[_0x167c25(0x174)]({'manifestVersion':_0x358c59,'dims':_0x16a73f,'metric':_0x28d43f[_0x167c25(0x1df)],'clock':_0x300bf8,'snapshotAt':Date[_0x167c25(0x1ff)]()},null,0x2));},{'keep':_0x28d43f['keepSnapshots']});if(_0x3e54e6?.[_0x16b521(0x22e)])_0x481dcd=0x0;return _0x3e54e6?.[_0x16b521(0x22e)]??![];}async function _0x4affc9(){const _0x13a19b=_0x2d4734,_0x46b98e=_0x2dbad3[_0x13a19b(0x1da)]()||_0x2dbad3['latestSnapshotId']();if(!_0x46b98e)return null;let _0x477672,_0x54ac6f=![];return await _0x2dbad3[_0x13a19b(0x183)](_0x46b98e,async _0x267754=>{const _0x55c7b2=_0x13a19b,_0x128324=require$$0;_0x477672=JSON[_0x55c7b2(0x1e9)](_0x128324['readFileSync'](_0x267754[_0x55c7b2(0x178)],'utf8'));if(_0x477672[_0x55c7b2(0x1fb)]!==_0x358c59||_0x477672['dims']!==_0x16a73f||_0x477672[_0x55c7b2(0x1df)]!==_0x28d43f[_0x55c7b2(0x1df)]){_0x477672=null;return;}await _0x4d24b4[_0x55c7b2(0x210)](_0x267754['labels']),_0x79e3e7=new _0x200658[(_0x55c7b2(0x1a6))](_0x28d43f['metric'],_0x16a73f),_0x79e3e7[_0x55c7b2(0x186)](_0x267754[_0x55c7b2(0x211)]),_0x79e3e7[_0x55c7b2(0x1e8)](_0x28d43f[_0x55c7b2(0x21a)]),_0x54ac6f=!![];}),_0x54ac6f?_0x477672?.[_0x13a19b(0x1c9)]??0x0:null;}return{async 'load'(_0x1033f6){return _0x8a94b9(async()=>{const _0x38646d=_0x2d84;_0x2dbad3[_0x38646d(0x180)]({'maxAgeMs':_0x28d43f['tmpMaxAgeMs']}),_0x60e80e=_0x1033f6??null;const _0x3a09fa=await _0x4affc9(),_0x63d59f=_0x1033f6?await _0x1033f6():null;if(_0x3a09fa!=null){if(_0x63d59f){if(!_0x4d24b4[_0x38646d(0x242)])return await _0x914392(_0x63d59f),null;const _0x59dfa4=_0x281f25(_0x4d24b4,_0x63d59f,_0x16a73f,{'upsert':_0x19d79f,'remove':_0x20903c});_0x481dcd+=_0x59dfa4[_0x38646d(0x1c3)]+_0x59dfa4[_0x38646d(0x1ee)]+_0x59dfa4[_0x38646d(0x1e6)];}return _0x3a09fa;}return await _0x914392(_0x63d59f),null;});},async 'add'(_0x1a6801,_0x375721,_0x3f9193){return _0x8a94b9(async()=>{const _0xe30912=_0x2d84;if(!_0x79e3e7)return;const _0x48d3b5=_0x375721 instanceof Float32Array?_0x375721:new Float32Array(_0x375721),_0x438152=_0xd485ae(_0x48d3b5);if(_0x4d24b4[_0xe30912(0x1a8)](_0x1a6801)===_0x438152)return;_0x19d79f(_0x1a6801,_0x48d3b5,_0x438152),_0x481dcd++,_0x481dcd>=_0x28d43f['snapshotEveryChanges']&&await _0x412b9c(_0x31b616());});},async 'remove'(_0x41e6ff){return _0x8a94b9(async()=>{if(!_0x79e3e7)return;if(_0x20903c(_0x41e6ff))_0x481dcd++;});},'search'(_0x36cca3,{limit:limit=0xa,efSearch:_0x7afc31}={}){const _0x5e74e9=_0x2d4734;if(!_0x79e3e7)return[];if(Number[_0x5e74e9(0x187)](_0x7afc31))_0x79e3e7[_0x5e74e9(0x1e8)](_0x7afc31);const _0x1ebebe=Math[_0x5e74e9(0x1d7)](limit,_0x79e3e7['getCurrentCount']()||0x1),{neighbors:_0x21fa2e,distances:_0x28526d}=_0x79e3e7[_0x5e74e9(0x1cc)](Array[_0x5e74e9(0x1f1)](_0x36cca3),_0x1ebebe),_0x5c927a=[];for(let _0x3d87e0=0x0;_0x3d87e0<_0x21fa2e[_0x5e74e9(0x21f)];_0x3d87e0++){const _0x36e0f8=_0x4d24b4['keyForLabel'](_0x21fa2e[_0x3d87e0]);if(!_0x36e0f8)continue;const _0x390105=_0x28d43f[_0x5e74e9(0x1df)]===_0x5e74e9(0x1f6)?Math[_0x5e74e9(0x22d)](0x0,0x1-_0x28526d[_0x3d87e0]):0x1/(0x1+_0x28526d[_0x3d87e0]);_0x5c927a[_0x5e74e9(0x1b6)]({'key':_0x36e0f8,'score':_0x390105});}return _0x5c927a;},async 'snapshot'(_0x21d39e){return _0x8a94b9(()=>_0x412b9c(_0x21d39e??_0x31b616()));},async 'rebuild'(_0x1566d5){return _0x8a94b9(()=>{if(_0x1566d5!=null)_0x60e80e=_0x1566d5;return _0x54dea5(_0x1566d5??_0x60e80e);});},async 'stop'(){const _0x59a1e8=_0x2d4734;return _0x8a94b9(()=>_0x481dcd>0x0||!_0x2dbad3[_0x59a1e8(0x1da)]()?_0x412b9c(_0x31b616()):![]);},'count'(){return _0x4d24b4['size']();},'info'(){const _0x2611ae=_0x2d4734;return{'algorithm':_0x2611ae(0x202),'metric':_0x28d43f[_0x2611ae(0x1df)],'M':_0x28d43f['M'],'efConstruction':_0x28d43f[_0x2611ae(0x1b5)],'efSearch':_0x28d43f['efSearch'],'maxElements':_0x79e3e7?.[_0x2611ae(0x1d8)]()??_0x28d43f[_0x2611ae(0x166)],'count':_0x4d24b4['size'](),'changesSince':_0x481dcd,'snapshotDir':_0x347adb,'latestSnapshot':_0x2dbad3[_0x2611ae(0x1da)]()??null};}};},hnsw;}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x16f875(_0x2edc8c={}){const _0x5cef76=new Map();return{async 'load'(_0x31f29b){const _0xb4b4b5=_0x2d84;_0x5cef76[_0xb4b4b5(0x205)]();if(_0x31f29b)for(const {key:_0x4f4158,vector:_0x33c97b}of await _0x31f29b()){_0x5cef76[_0xb4b4b5(0x1ba)](_0x4f4158,_0x33c97b);}},async 'add'(_0x5daafc,_0x1f6850,_0x838ddf){const _0xee981b=_0x2d84;_0x5cef76[_0xee981b(0x1ba)](_0x5daafc,_0x1f6850);},async 'remove'(_0x30f7cc){const _0x464815=_0x2d84;_0x5cef76[_0x464815(0x16c)](_0x30f7cc);},'search'(_0x21dce8,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x25f799=_0x2d84,_0x5a9546=[];for(const [_0x29a4c5,_0x5decd5]of _0x5cef76){const _0x11be6b=_0x15f014(_0x21dce8,_0x5decd5);if(_0x11be6b>=threshold)_0x5a9546['push']({'key':_0x29a4c5,'score':_0x11be6b});}return _0x5a9546['sort']((_0x5eb0e7,_0x2bc023)=>_0x2bc023[_0x25f799(0x177)]-_0x5eb0e7['score']),_0x5a9546[_0x25f799(0x23f)](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x36c4e5){const _0xed4006=_0x2d84;await this[_0xed4006(0x23c)](_0x36c4e5);},async 'stop'(){},'count'(){const _0x5c4da1=_0x2d84;return _0x5cef76[_0x5c4da1(0x1d2)];},'info'(){const _0x504eb3=_0x2d84;return{'algorithm':_0x504eb3(0x189),'count':_0x5cef76[_0x504eb3(0x1d2)]};}};};function _0x15f014(_0x1e568a,_0x449640){const _0x1b164d=_0x2d84;let _0x2dd384=0x0,_0x50430a=0x0,_0x663a19=0x0;for(let _0x10e6d8=0x0;_0x10e6d8<_0x1e568a[_0x1b164d(0x21f)];_0x10e6d8++){_0x2dd384+=_0x1e568a[_0x10e6d8]*_0x449640[_0x10e6d8],_0x50430a+=_0x1e568a[_0x10e6d8]*_0x1e568a[_0x10e6d8],_0x663a19+=_0x449640[_0x10e6d8]*_0x449640[_0x10e6d8];}const _0x5ed06a=Math[_0x1b164d(0x214)](_0x50430a)*Math[_0x1b164d(0x214)](_0x663a19);return _0x5ed06a===0x0?0x0:_0x2dd384/_0x5ed06a;}return flat;}var writerLock,hasRequiredWriterLock;function requireWriterLock(){if(hasRequiredWriterLock)return writerLock;hasRequiredWriterLock=0x1;const _0xe50081=require$$0,_0xad5568=require$$1,_0x44dc2c=require$$3;return writerLock=function _0xc2395d(_0x506a19,{maxAgeMs:maxAgeMs=0x3a98,heartbeatMs:heartbeatMs=0x1388,onLost:onLost=null}={}){const _0x4312c3=_0x2d84,_0x203edd=_0xad5568[_0x4312c3(0x20c)](_0x506a19,'WRITER.LOCK'),_0x41065f=_0x44dc2c['randomBytes'](0x8)[_0x4312c3(0x16f)](_0x4312c3(0x20d));let _0x41dc27=![],_0x3f94ca=null;const _0x1b7370=()=>JSON[_0x4312c3(0x174)]({'pid':process[_0x4312c3(0x1db)],'token':_0x41065f,'at':Date['now']()});function _0x185a18(){const _0x16b2b7=_0x4312c3;try{return JSON[_0x16b2b7(0x1e9)](_0xe50081[_0x16b2b7(0x188)](_0x203edd,_0x16b2b7(0x179)));}catch(_0xb48cf){return _0xb48cf?.[_0x16b2b7(0x1e3)]===_0x16b2b7(0x16a)?null:{'unreadable':!![]};}}function _0x592a66(){const _0x10398b=_0x4312c3;try{const _0xc6c378=_0xe50081['openSync'](_0x203edd,'wx');try{_0xe50081['writeFileSync'](_0xc6c378,_0x1b7370());}finally{_0xe50081[_0x10398b(0x240)](_0xc6c378);}return!![];}catch(_0x4f67f6){if(_0x4f67f6?.[_0x10398b(0x1e3)]===_0x10398b(0x1c2))return![];throw _0x4f67f6;}}function _0x35fd65(_0x1930af){const _0x101617=_0x4312c3;if(!_0x1930af)return!![];if(_0x1930af[_0x101617(0x1bc)])return!![];return Date[_0x101617(0x1ff)]()-(_0x1930af['at']??0x0)>=maxAgeMs;}function _0x2cff93(){if(_0x3f94ca)clearInterval(_0x3f94ca);_0x3f94ca=null;}function _0x2a116f(){_0x2cff93(),_0x3f94ca=setInterval(()=>{const _0x4790c8=_0x2d84,_0x4fad04=_0x185a18();if(_0x4fad04&&!_0x4fad04[_0x4790c8(0x1bc)]&&_0x4fad04['token']!==_0x41065f){_0x41dc27=![],_0x2cff93();try{onLost?.();}catch{}return;}try{_0xe50081[_0x4790c8(0x1f9)](_0x203edd,_0x1b7370());}catch{}},heartbeatMs),_0x3f94ca['unref']?.();}function _0x29cc34(){const _0x18655f=_0x185a18();return!!_0x18655f&&_0x18655f['token']===_0x41065f;}return{'path':_0x203edd,'token':_0x41065f,'acquire'(){const _0x28fc98=_0x4312c3,_0x3a4b63=_0x185a18();if(_0x3a4b63&&_0x3a4b63[_0x28fc98(0x1fe)]===_0x41065f){_0x41dc27=!![];if(!_0x3f94ca)_0x2a116f();return!![];}let _0x58c108=_0x592a66();if(!_0x58c108&&_0x35fd65(_0x185a18())){try{_0xe50081[_0x28fc98(0x18a)](_0x203edd);}catch{}_0x58c108=_0x592a66();}if(_0x58c108&&!_0x29cc34())_0x58c108=![];_0x41dc27=_0x58c108;if(_0x58c108)_0x2a116f();return _0x58c108;},'held'(){return _0x41dc27;},'isFree'(){const _0x119b01=_0x4312c3,_0x2a26f6=_0x185a18();if(_0x2a26f6&&_0x2a26f6[_0x119b01(0x1fe)]===_0x41065f)return![];return _0x35fd65(_0x2a26f6);},'release'(){const _0x2577f6=_0x4312c3;_0x2cff93();if(!_0x41dc27)return;_0x41dc27=![];if(_0x29cc34())try{_0xe50081[_0x2577f6(0x18a)](_0x203edd);}catch{}}};},writerLock;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x3f7825=require$$0,_0x155c3a=requireSnapshotStore(),_0x111234=requireLabelMap(),_0x5d580d=requireWriterLock(),{fingerprint:_0x5bc402,reconcileIndex:_0x1506e5}=requireIndexConvergence(),_0x5c9c9c=0x1;let _0x3555d2=null;function _0x5c9970(){const _0x497c9b=_0x2d84;if(_0x3555d2)return _0x3555d2;try{return _0x3555d2=require(_0x497c9b(0x234)),_0x3555d2;}catch(_0x2e24ed){const _0x205425=new Error(_0x497c9b(0x1d5)+(_0x497c9b(0x171)+process['versions'][_0x497c9b(0x241)]+'\x20on\x20'+process[_0x497c9b(0x23d)]+'/'+process[_0x497c9b(0x213)]+'.\x20')+_0x497c9b(0x217)+(_0x497c9b(0x212)+(_0x2e24ed?.[_0x497c9b(0x168)]||String(_0x2e24ed))));_0x205425['code']='USEARCH_BINDINGS_UNAVAILABLE',_0x205425[_0x497c9b(0x228)]=_0x2e24ed;throw _0x205425;}}function _0x171c90(_0x5cc736,_0x172679){const _0xce8d25=_0x2d84;switch(_0x5cc736){case _0xce8d25(0x1f6):return _0x172679[_0xce8d25(0x225)][_0xce8d25(0x224)];case'l2':return _0x172679['MetricKind'][_0xce8d25(0x1ef)];case'ip':return _0x172679['MetricKind']['IP'];default:return _0x172679[_0xce8d25(0x225)][_0xce8d25(0x224)];}}return usearch=function _0x3152eb(_0xb59072={},{dims:_0x32473d,dir:_0x3ea71d,fetchAll:fetchAll=null,onChange:onChange=null}={}){const _0x52ce53=_0x2d84,_0x3c9bdc=_0x5c9970();if(!_0x32473d||_0x32473d<=0x0)throw new Error('usearch\x20algorithm\x20requires\x20dims\x20>\x200');if(!_0x3ea71d)throw new Error(_0x52ce53(0x197));const _0x417b8f={'metric':_0xb59072['metric']??_0x52ce53(0x1f6),'connectivity':_0xb59072[_0x52ce53(0x1c7)]??0x10,'expansionAdd':_0xb59072[_0x52ce53(0x20a)]??0x80,'expansionSearch':_0xb59072[_0x52ce53(0x1fd)]??0x40,'snapshotEveryChanges':_0xb59072[_0x52ce53(0x22c)]??0xc350,'snapshotMaxLagMs':_0xb59072[_0x52ce53(0x1e2)]??0x2710,'keepSnapshots':_0xb59072['keepSnapshots']??0x2,'tmpMaxAgeMs':_0xb59072[_0x52ce53(0x1bf)]??0x6*0x36ee80,'heartbeatIntervalMs':_0xb59072['heartbeatIntervalMs']??0x1388,'writerLockMaxAgeMs':_0xb59072[_0x52ce53(0x194)]??0x3a98,'viewRefreshMs':_0xb59072[_0x52ce53(0x1cf)]??0x3e8},_0xdd6b29=new _0x155c3a({'dir':_0x3ea71d,'keepSnapshots':_0x417b8f[_0x52ce53(0x238)]}),_0x175485=_0x5d580d(_0x3ea71d,{'maxAgeMs':_0x417b8f['writerLockMaxAgeMs'],'heartbeatMs':_0x417b8f[_0x52ce53(0x1b0)],'onLost':()=>{const _0x1c996b=_0x52ce53;_0x351773(_0xf55ec9)[_0x1c996b(0x1f2)](()=>{});}});let _0x7d20a7=new _0x111234(),_0x543918=null,_0x149e2b=0x0,_0x18a34e=null,_0x30b4c7=![],_0x5274bf=![],_0x11b35b=null,_0x43a35d=0x0,_0x137947=null,_0x1adb6a=0x0,_0x19729d=![],_0x53ca0a=Promise[_0x52ce53(0x21b)]();const _0x351773=_0x22156a=>{const _0x1891b5=_0x52ce53,_0x2df6bf=_0x53ca0a[_0x1891b5(0x1ed)](_0x22156a);return _0x53ca0a=_0x2df6bf['catch'](()=>{}),_0x2df6bf;},_0x4954b3=()=>{try{onChange?.();}catch{}};function _0x3d1af6(){const _0xe61000=_0x52ce53;return new _0x3c9bdc[(_0xe61000(0x1dc))]({'dimensions':_0x32473d,'metric':_0x171c90(_0x417b8f[_0xe61000(0x1df)],_0x3c9bdc),'quantization':_0x3c9bdc[_0xe61000(0x1c1)][_0xe61000(0x18f)],'connectivity':_0x417b8f[_0xe61000(0x1c7)],'expansion_add':_0x417b8f[_0xe61000(0x20a)],'expansion_search':_0x417b8f['expansionSearch'],'multi':![]});}function _0x3a6fb7(_0x1864d0){return _0x1864d0 instanceof Float32Array?_0x1864d0:new Float32Array(_0x1864d0);}function _0x3a5ac2(){const _0x3b5828=_0x52ce53;if(fetchAll)return fetchAll();if(_0x18a34e)return _0x18a34e();return Promise[_0x3b5828(0x21b)](null);}function _0x5d8e9b(_0x1ff191,_0x77177e,_0x2a2725){const _0x2f33b0=_0x52ce53,_0x1ca197=_0x7d20a7['labelForExisting'](_0x1ff191);if(_0x1ca197!==undefined)try{_0x543918[_0x2f33b0(0x17d)](BigInt(_0x1ca197));}catch{}const _0x342c35=_0x7d20a7['labelForEphemeral'](_0x1ff191);_0x543918[_0x2f33b0(0x223)](BigInt(_0x342c35),_0x77177e),_0x7d20a7['setFingerprint'](_0x1ff191,_0x2a2725??_0x5bc402(_0x77177e));}function _0x5df581(_0x3adb70){const _0x1ead1c=_0x52ce53,_0x2a729e=_0x7d20a7['labelForExisting'](_0x3adb70);if(_0x2a729e===undefined)return![];try{_0x543918[_0x1ead1c(0x17d)](BigInt(_0x2a729e));}catch{}return _0x7d20a7[_0x1ead1c(0x221)](_0x3adb70),!![];}function _0x1b76a8(_0x308419){const _0x2feb32=_0x52ce53;_0x7d20a7=new _0x111234(),_0x543918=_0x3d1af6();for(const {key:_0x5cc6e5,vector:_0x581a07}of _0x308419??[]){if(!(_0x581a07 instanceof Float32Array)||_0x581a07[_0x2feb32(0x21f)]!==_0x32473d)continue;_0x5d8e9b(_0x5cc6e5,_0x581a07);}_0x149e2b=0x0;}function _0x4b2277(){const _0x4fdfb3=_0x52ce53;return Math[_0x4fdfb3(0x22d)](Date[_0x4fdfb3(0x1ff)](),_0xdd6b29[_0x4fdfb3(0x1a4)]()+0x1);}function _0x41d488(){if(_0x11b35b)clearTimeout(_0x11b35b);_0x11b35b=null;}function _0x4c8f6b(){const _0x4205e2=_0x52ce53;if(!_0x417b8f[_0x4205e2(0x1e2)]||_0x11b35b||!_0x5274bf||_0x149e2b<=0x0)return;const _0x360952=Math[_0x4205e2(0x22d)](_0x417b8f[_0x4205e2(0x1e2)],0xa*_0x43a35d);_0x11b35b=setTimeout(()=>{const _0x5da3ce=_0x4205e2;_0x11b35b=null,_0x351773(async()=>{if(_0x5274bf&&_0x149e2b>0x0)await _0x4d0724();_0x4c8f6b(),_0x4954b3();})[_0x5da3ce(0x1f2)](()=>{});},_0x360952),_0x11b35b[_0x4205e2(0x1c5)]?.();}async function _0x4d0724(_0x5de075){const _0x199b9a=_0x52ce53;if(!_0x543918)return![];const _0x58668e=_0x5de075??_0x4b2277(),_0x5a6cd5=Date[_0x199b9a(0x1ff)](),_0x247ffe=await _0xdd6b29['publishSnapshot'](_0x58668e,async _0x3995c5=>{const _0x3b064c=_0x199b9a;_0x543918[_0x3b064c(0x1ce)](_0x3995c5[_0x3b064c(0x211)]),await _0x7d20a7['snapshotTo'](_0x3995c5[_0x3b064c(0x19f)]),_0x3f7825[_0x3b064c(0x1f9)](_0x3995c5['state'],JSON[_0x3b064c(0x174)]({'manifestVersion':_0x5c9c9c,'algorithm':_0x3b064c(0x234),'dims':_0x32473d,'metric':_0x417b8f[_0x3b064c(0x1df)],'clock':_0x58668e,'snapshotAt':Date[_0x3b064c(0x1ff)]()},null,0x2));},{'keep':_0x417b8f['keepSnapshots']});return _0x43a35d=Date[_0x199b9a(0x1ff)]()-_0x5a6cd5,_0x247ffe?.[_0x199b9a(0x22e)]&&(_0x149e2b=0x0,_0x41d488()),_0x247ffe?.[_0x199b9a(0x22e)]??![];}function _0x4ff402(){_0x149e2b++;if(_0x149e2b>=_0x417b8f['snapshotEveryChanges'])return _0x4d0724();return _0x4c8f6b(),null;}async function _0x19dbb3(){const _0x56a81f=_0x52ce53,_0x38c92a=_0xdd6b29[_0x56a81f(0x1da)]()||_0xdd6b29[_0x56a81f(0x1c4)]();if(!_0x38c92a)return null;let _0xaed38,_0x53ffd3=![];try{await _0xdd6b29[_0x56a81f(0x183)](_0x38c92a,async _0x15bb47=>{const _0x21646c=_0x56a81f;_0xaed38=JSON['parse'](_0x3f7825[_0x21646c(0x188)](_0x15bb47[_0x21646c(0x178)],_0x21646c(0x179)));if(_0xaed38[_0x21646c(0x1fb)]!==_0x5c9c9c||_0xaed38[_0x21646c(0x1d9)]!==_0x21646c(0x234)||_0xaed38[_0x21646c(0x231)]!==_0x32473d||_0xaed38[_0x21646c(0x1df)]!==_0x417b8f[_0x21646c(0x1df)]){_0xaed38=null;return;}const _0x26980b=new _0x111234();await _0x26980b['loadFrom'](_0x15bb47[_0x21646c(0x19f)]);const _0x1a8881=_0x3d1af6();_0x1a8881[_0x21646c(0x23c)](_0x15bb47[_0x21646c(0x211)]),_0x7d20a7=_0x26980b,_0x543918=_0x1a8881,_0x53ffd3=!![];});}catch{return null;}return _0x53ffd3?_0xaed38?.[_0x56a81f(0x1c9)]??0x0:null;}async function _0x4adee2(_0x5bc1c9){const _0x13edf1=_0x52ce53;_0x137947=null;const _0x5ca1f2=await _0x19dbb3();if(_0x5ca1f2!=null){_0x149e2b=0x0;if(_0x5bc1c9){if(!_0x7d20a7[_0x13edf1(0x242)])return _0x1b76a8(_0x5bc1c9),await _0x4d0724(),null;const _0x378ded=_0x1506e5(_0x7d20a7,_0x5bc1c9,_0x32473d,{'upsert':_0x5d8e9b,'remove':_0x5df581}),_0xc58851=_0x378ded[_0x13edf1(0x1c3)]+_0x378ded[_0x13edf1(0x1ee)]+_0x378ded['removed'];_0xc58851>0x0&&(_0x149e2b+=_0xc58851,await _0x4d0724());}return _0x5ca1f2;}_0x1b76a8(_0x5bc1c9??[]);if(_0x543918['size']()>0x0)await _0x4d0724();return null;}async function _0x534d8d(){_0x5274bf=!![],await _0x4adee2(await _0x3a5ac2());}async function _0xf55ec9(){const _0x422faa=_0x52ce53;if(!_0x5274bf)return;_0x5274bf=![],_0x41d488(),_0x149e2b=0x0;const _0x2811e6=_0xdd6b29[_0x422faa(0x1da)]()||_0xdd6b29[_0x422faa(0x1c4)]();await _0x475943(_0x2811e6),_0x4954b3();}async function _0x475943(_0x334141){const _0x3eb723=_0x52ce53;if(!_0x334141)return![];let _0x11aeb1=![];try{await _0xdd6b29[_0x3eb723(0x183)](_0x334141,async _0x2445bd=>{const _0x35abbd=_0x3eb723,_0x12a3a5=JSON[_0x35abbd(0x1e9)](_0x3f7825[_0x35abbd(0x188)](_0x2445bd['state'],_0x35abbd(0x179)));if(_0x12a3a5[_0x35abbd(0x1fb)]!==_0x5c9c9c||_0x12a3a5[_0x35abbd(0x1d9)]!=='usearch'||_0x12a3a5[_0x35abbd(0x231)]!==_0x32473d||_0x12a3a5['metric']!==_0x417b8f['metric'])return;const _0x230af7=new _0x111234();await _0x230af7[_0x35abbd(0x210)](_0x2445bd['labels']);const _0x27b00d=_0x3d1af6();_0x27b00d[_0x35abbd(0x23e)](_0x2445bd['index']),_0x543918=_0x27b00d,_0x7d20a7=_0x230af7,_0x137947=_0x334141,_0x11aeb1=!![];});}catch{}return _0x11aeb1;}function _0x13b679(){const _0x32b960=_0x52ce53,_0xc0ef04=Date['now']();if(_0xc0ef04-_0x1adb6a<_0x417b8f[_0x32b960(0x1cf)])return;_0x1adb6a=_0xc0ef04;if(_0x19729d)return;if(_0x175485[_0x32b960(0x17a)]()){_0x19729d=!![],_0x351773(async()=>{!_0x5274bf&&_0x30b4c7&&_0x175485['acquire']()&&(await _0x534d8d(),_0x4954b3());})[_0x32b960(0x1f2)](()=>{})['finally'](()=>{_0x19729d=![];});return;}const _0x2b6c62=_0xdd6b29[_0x32b960(0x1da)]()||_0xdd6b29[_0x32b960(0x1c4)]();if(!_0x2b6c62||_0x2b6c62===_0x137947)return;_0x19729d=!![],_0x351773(async()=>{if(!_0x5274bf&&await _0x475943(_0x2b6c62))_0x4954b3();})[_0x32b960(0x1f2)](()=>{})['finally'](()=>{_0x19729d=![];});}return{async 'load'(_0x4fb34c){return _0x351773(async()=>{const _0x2dc33a=_0x2d84;_0xdd6b29['cleanupTmpDirs']({'maxAgeMs':_0x417b8f[_0x2dc33a(0x1bf)]}),_0x18a34e=_0x4fb34c??null,_0x5274bf=_0x175485[_0x2dc33a(0x209)]();let _0x4fdd27=null;if(_0x5274bf)_0x4fdd27=await _0x4adee2(_0x4fb34c?await _0x4fb34c():null);else{const _0x4700e0=_0xdd6b29['readCurrentId']()||_0xdd6b29['latestSnapshotId']();await _0x475943(_0x4700e0);}return _0x30b4c7=!![],_0x4fdd27;});},async 'add'(_0x59f4ef,_0xe5560e,_0x4cbf96){return _0x351773(async()=>{const _0x39d4ec=_0x2d84;if(!_0x30b4c7)return;const _0x39f600=_0x3a6fb7(_0xe5560e);if(!_0x5274bf){if(!_0x175485[_0x39d4ec(0x209)]())return;await _0x534d8d();}if(!_0x543918)return;const _0x2256d4=_0x5bc402(_0x39f600);if(_0x7d20a7[_0x39d4ec(0x1a8)](_0x59f4ef)===_0x2256d4)return;_0x5d8e9b(_0x59f4ef,_0x39f600,_0x2256d4),await _0x4ff402();});},async 'remove'(_0x12e722){return _0x351773(async()=>{const _0x510dd3=_0x2d84;if(!_0x30b4c7)return;if(!_0x5274bf){if(!_0x175485[_0x510dd3(0x209)]())return;await _0x534d8d();}if(!_0x543918)return;if(_0x5df581(_0x12e722))await _0x4ff402();});},'search'(_0x26cdd9,{limit:limit=0xa}={}){const _0x1e1ed4=_0x52ce53;if(!_0x5274bf&&_0x30b4c7)_0x13b679();if(!_0x543918)return[];const _0x2be802=_0x543918[_0x1e1ed4(0x1d2)]();if(_0x2be802===0x0)return[];const _0x2c8285=Math[_0x1e1ed4(0x1d7)](limit,_0x2be802),_0x4c6bd4=_0x543918[_0x1e1ed4(0x1de)](_0x3a6fb7(_0x26cdd9),_0x2c8285,0x0),_0x22d6c1=[],_0x455581=_0x4c6bd4[_0x1e1ed4(0x1eb)],_0x48686c=_0x4c6bd4[_0x1e1ed4(0x1f4)];for(let _0x22da7d=0x0;_0x22da7d<_0x455581['length'];_0x22da7d++){const _0xe1306=_0x455581[_0x22da7d];if(_0xe1306===0xffffffffffffffffn)continue;const _0x33b24a=Number(_0xe1306),_0x5cdfb2=_0x7d20a7[_0x1e1ed4(0x170)](_0x33b24a);if(!_0x5cdfb2)continue;const _0x4862c9=_0x48686c[_0x22da7d];let _0x1bc978;if(_0x417b8f[_0x1e1ed4(0x1df)]===_0x1e1ed4(0x1f6))_0x1bc978=Math[_0x1e1ed4(0x22d)](0x0,0x1-_0x4862c9);else{if(_0x417b8f[_0x1e1ed4(0x1df)]==='ip')_0x1bc978=-_0x4862c9;else _0x1bc978=0x1/(0x1+_0x4862c9);}_0x22d6c1['push']({'key':_0x5cdfb2,'score':_0x1bc978});}return _0x22d6c1;},async 'snapshot'(_0x1a2dc9){return _0x351773(()=>_0x5274bf?_0x4d0724(_0x1a2dc9??undefined):![]);},async 'rebuild'(_0x48fce2){return _0x351773(async()=>{const _0x17ab7a=_0x2d84;if(_0x48fce2!=null)_0x18a34e=_0x48fce2;if(!_0x5274bf){if(!_0x175485[_0x17ab7a(0x209)]())return;_0x5274bf=!![];}const _0x14bf78=_0x48fce2?await _0x48fce2():await _0x3a5ac2();_0x1b76a8(_0x14bf78??[]),_0x30b4c7=!![],await _0x4d0724();});},async 'stop'(){return _0x351773(async()=>{const _0x582b20=_0x2d84;_0x41d488();if(_0x5274bf){if(_0x149e2b>0x0||!_0xdd6b29[_0x582b20(0x1da)]())await _0x4d0724();_0x175485['release']();}_0x5274bf=![],_0x30b4c7=![];});},'count'(){const _0x6992a6=_0x52ce53;return _0x7d20a7[_0x6992a6(0x1d2)]();},'info'(){const _0x5ae89e=_0x52ce53;return{'algorithm':_0x5ae89e(0x234),'role':_0x5274bf?_0x5ae89e(0x19c):'reader','metric':_0x417b8f[_0x5ae89e(0x1df)],'connectivity':_0x417b8f[_0x5ae89e(0x1c7)],'expansionAdd':_0x417b8f[_0x5ae89e(0x20a)],'expansionSearch':_0x417b8f[_0x5ae89e(0x1fd)],'snapshotEveryChanges':_0x417b8f[_0x5ae89e(0x22c)],'snapshotMaxLagMs':_0x417b8f[_0x5ae89e(0x1e2)],'count':_0x7d20a7['size'](),'size':_0x543918?.['size']?.()??0x0,'capacity':_0x543918?.[_0x5ae89e(0x21c)]?.()??0x0,'changesSince':_0x5274bf?_0x149e2b:null,'viewedSnapshot':_0x137947??null,'snapshotDir':_0x3ea71d,'latestSnapshot':_0xdd6b29[_0x5ae89e(0x1da)]()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0x144f87=_0x31c441;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x4cbaf6,workerData:_0x57378d}=require$$0$1,{algorithmName:_0x3b42c6,algorithmConfig:_0x3feafc,dims:_0x1feeda,dir:_0x1f8af4}=_0x57378d;let _0x445bfc=0x1;const _0x52892f=new Map();function _0x589a0e(){const _0x2e7a42=_0x445bfc++;return new Promise((_0x595598,_0x5848de)=>{const _0xb1e74b=_0x2d84;_0x52892f[_0xb1e74b(0x1ba)](_0x2e7a42,{'resolve':_0x595598,'reject':_0x5848de}),_0x4cbaf6[_0xb1e74b(0x220)]({'op':_0xb1e74b(0x167),'fid':_0x2e7a42});});}const _0x3dec94={'dims':_0x1feeda,'dir':_0x1f8af4,'fetchAll':_0x589a0e,'onChange':()=>_0x2a8b92()};let _0x52b023;if(_0x3b42c6===_0x144f87(0x202))_0x52b023=requireHnsw()(_0x3feafc,_0x3dec94);else{if(_0x3b42c6===_0x144f87(0x189))_0x52b023=requireFlat()(_0x3feafc,_0x3dec94);else{if(_0x3b42c6===_0x144f87(0x234))_0x52b023=requireUsearch()(_0x3feafc,_0x3dec94);else throw new Error(_0x144f87(0x1ae)+_0x3b42c6+'\x22');}}function _0x2a8b92(){const _0x4704d6=_0x144f87;try{_0x4cbaf6[_0x4704d6(0x220)]({'op':_0x4704d6(0x20b),'count':_0x52b023['count'](),'info':_0x52b023[_0x4704d6(0x226)](),'memory':process[_0x4704d6(0x19e)]()});}catch{}}function _0x20d348(_0x55da20){const _0x46b533=_0x144f87;return(_0x55da20||[])[_0x46b533(0x1bb)](_0x325413=>({'key':_0x325413['key'],'vector':_0x325413[_0x46b533(0x163)]instanceof Float32Array?_0x325413[_0x46b533(0x163)]:new Float32Array(_0x325413[_0x46b533(0x163)])}));}return _0x4cbaf6['on'](_0x144f87(0x168),async _0x4ebb64=>{const _0x53c9d9=_0x144f87;if(_0x4ebb64['op']===_0x53c9d9(0x1e7)){const _0x33220c=_0x52892f[_0x53c9d9(0x19d)](_0x4ebb64['fid']);if(!_0x33220c)return;_0x52892f[_0x53c9d9(0x16c)](_0x4ebb64[_0x53c9d9(0x1c0)]);if(_0x4ebb64[_0x53c9d9(0x222)])_0x33220c[_0x53c9d9(0x237)](new Error(_0x4ebb64[_0x53c9d9(0x222)]));else _0x33220c[_0x53c9d9(0x21b)](_0x20d348(_0x4ebb64[_0x53c9d9(0x1a5)]));return;}const {id:_0x1664a3,op:_0x2fcb72,args:_0x36ce92}=_0x4ebb64;try{let _0xe6e6e3;switch(_0x2fcb72){case _0x53c9d9(0x23c):{_0xe6e6e3=await _0x52b023[_0x53c9d9(0x23c)](_0x36ce92['hasRows']?_0x589a0e:null),_0x2a8b92();break;}case'add':{const _0x272376=_0x36ce92[_0x53c9d9(0x163)]instanceof Float32Array?_0x36ce92[_0x53c9d9(0x163)]:new Float32Array(_0x36ce92[_0x53c9d9(0x163)]);await _0x52b023[_0x53c9d9(0x223)](_0x36ce92[_0x53c9d9(0x17c)],_0x272376,_0x36ce92[_0x53c9d9(0x1c9)]??undefined),_0x2a8b92(),_0xe6e6e3=null;break;}case'remove':{await _0x52b023[_0x53c9d9(0x17d)](_0x36ce92[_0x53c9d9(0x17c)]),_0x2a8b92(),_0xe6e6e3=null;break;}case'search':{const _0x143752=_0x36ce92[_0x53c9d9(0x1f5)]instanceof Float32Array?_0x36ce92['queryVec']:new Float32Array(_0x36ce92['queryVec']);_0xe6e6e3=_0x52b023[_0x53c9d9(0x1de)](_0x143752,_0x36ce92['opts']||{});break;}case _0x53c9d9(0x230):{_0xe6e6e3=await _0x52b023['snapshot'](_0x36ce92[_0x53c9d9(0x1c9)]),_0x2a8b92();break;}case _0x53c9d9(0x19a):{const _0x3a5271=_0x20d348(_0x36ce92[_0x53c9d9(0x1a5)]);await _0x52b023['rebuild'](async()=>_0x3a5271),_0x2a8b92(),_0xe6e6e3=null;break;}case _0x53c9d9(0x181):{await _0x52b023[_0x53c9d9(0x181)](),_0x2a8b92(),_0xe6e6e3=null;break;}case'count':{_0xe6e6e3=_0x52b023[_0x53c9d9(0x193)]();break;}case _0x53c9d9(0x226):{_0xe6e6e3=_0x52b023[_0x53c9d9(0x226)]();break;}default:throw new Error(_0x53c9d9(0x1a7)+_0x2fcb72+'\x22');}_0x4cbaf6[_0x53c9d9(0x220)]({'id':_0x1664a3,'result':_0xe6e6e3});}catch(_0x119725){_0x4cbaf6['postMessage']({'id':_0x1664a3,'error':{'message':_0x119725?.[_0x53c9d9(0x168)]||String(_0x119725),'code':_0x119725?.['code']}});}}),_0x4cbaf6[_0x144f87(0x220)]({'op':_0x144f87(0x1f0)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module[_0x31c441(0x1b4)]=algorithmWorkerThread;
|
|
1
|
+
'use strict';const _0x411a8a=_0x3360;(function(_0x5d24de,_0x2e375b){const _0x43bc65=_0x3360,_0x51d1cc=_0x5d24de();while(!![]){try{const _0x505d6d=-parseInt(_0x43bc65(0x15b))/0x1+parseInt(_0x43bc65(0x1e1))/0x2+-parseInt(_0x43bc65(0x1c9))/0x3*(parseInt(_0x43bc65(0x174))/0x4)+-parseInt(_0x43bc65(0x18d))/0x5+-parseInt(_0x43bc65(0x14c))/0x6*(parseInt(_0x43bc65(0x204))/0x7)+parseInt(_0x43bc65(0x179))/0x8*(-parseInt(_0x43bc65(0x210))/0x9)+-parseInt(_0x43bc65(0x19f))/0xa*(-parseInt(_0x43bc65(0x1f2))/0xb);if(_0x505d6d===_0x2e375b)break;else _0x51d1cc['push'](_0x51d1cc['shift']());}catch(_0x148a38){_0x51d1cc['push'](_0x51d1cc['shift']());}}}(_0xf898,0x3f4c9));var require$$0$1=require(_0x411a8a(0x206)),require$$0=require('fs'),require$$1=require(_0x411a8a(0x13a)),require$$2=require('os'),require$$3=require('crypto');function getDefaultExportFromCjs(_0xb9f058){const _0x26fe23=_0x411a8a;return _0xb9f058&&_0xb9f058['__esModule']&&Object[_0x26fe23(0x155)][_0x26fe23(0x140)]['call'](_0xb9f058,_0x26fe23(0x144))?_0xb9f058['default']:_0xb9f058;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x3f9bb8=_0x411a8a;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x4c53a2=require$$0,_0x4be99c=require$$1,_0x47663e=require$$2,_0x5b3eef=require$$3;function _0x314cff(){const _0x3a921a=_0x3360;return Date[_0x3a921a(0x1d3)]();}function _0x1c7671(_0x5dd966){const _0x1406fd=_0x3360;try{return _0x4c53a2[_0x1406fd(0x16f)](_0x5dd966);}catch{return![];}}function _0x227608(_0xaff088){const _0x5b4627=_0x3360;try{return _0x4c53a2['readFileSync'](_0xaff088,_0x5b4627(0x1d1));}catch{return null;}}function _0x2b7fea(_0x7ee79a,_0x433d43){const _0x3d1615=_0x3360,_0x4d408b=_0x7ee79a+_0x3d1615(0x167)+_0x5b3eef[_0x3d1615(0x156)](0x6)[_0x3d1615(0x177)]('hex');_0x4c53a2['writeFileSync'](_0x4d408b,_0x433d43),_0x4c53a2['renameSync'](_0x4d408b,_0x7ee79a);}function _0x23a340(_0x58b888,_0x311861=0x10){const _0xdb6f3f=_0x3360,_0x54deaf=String(Math[_0xdb6f3f(0x1fd)](0x0,Math[_0xdb6f3f(0x190)](_0x58b888||0x0)));return _0x54deaf[_0xdb6f3f(0x13e)]>=_0x311861?_0x54deaf:'0'[_0xdb6f3f(0x1c5)](_0x311861-_0x54deaf[_0xdb6f3f(0x13e)])+_0x54deaf;}return snapshotStore=class _0x98bed1{constructor({dir:_0x25d246,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x56c459=_0x3360;if(!_0x25d246)throw new Error(_0x56c459(0x152));this[_0x56c459(0x1b2)]=_0x25d246,this[_0x56c459(0x1b6)]=_0x4be99c['join'](_0x25d246,_0x56c459(0x203)),this['currentPath']=_0x4be99c[_0x56c459(0x1fc)](_0x25d246,'CURRENT'),this[_0x56c459(0x176)]=_0x4be99c['join'](_0x25d246,'SNAPSHOT.LOCK'),this[_0x56c459(0x1b1)]=keepSnapshots,this['log']=log,_0x4c53a2['mkdirSync'](this['dir'],{'recursive':!![]}),_0x4c53a2['mkdirSync'](this[_0x56c459(0x1b6)],{'recursive':!![]});}[_0x3f9bb8(0x146)](_0x3c7e59){const _0x3bf1d5=_0x3f9bb8;return _0x4be99c[_0x3bf1d5(0x1fc)](this[_0x3bf1d5(0x1b6)],_0x3c7e59);}[_0x3f9bb8(0x185)](_0x2ec8a0){const _0x44f4f7=_0x3f9bb8,_0x225a9f=this[_0x44f4f7(0x146)](_0x2ec8a0);return{'dir':_0x225a9f,'index':_0x4be99c[_0x44f4f7(0x1fc)](_0x225a9f,_0x44f4f7(0x19c)),'labels':_0x4be99c[_0x44f4f7(0x1fc)](_0x225a9f,_0x44f4f7(0x18f)),'state':_0x4be99c[_0x44f4f7(0x1fc)](_0x225a9f,_0x44f4f7(0x195))};}[_0x3f9bb8(0x169)](){const _0x11ffd1=_0x3f9bb8;if(!_0x1c7671(this['currentPath']))return null;const _0x2dce65=_0x227608(this['currentPath']);if(!_0x2dce65)return null;const _0x34a23a=String(_0x2dce65)[_0x11ffd1(0x172)]();return _0x34a23a||null;}[_0x3f9bb8(0x1f7)](){const _0x2be7df=_0x3f9bb8,_0x401c68=this[_0x2be7df(0x169)]();if(!_0x401c68)return 0x0;const _0x324b01=Number(_0x401c68);return Number[_0x2be7df(0x137)](_0x324b01)?_0x324b01:0x0;}[_0x3f9bb8(0x1f0)](){const _0x26b299=_0x3f9bb8;try{return _0x4c53a2['readdirSync'](this['snapshotsDir'],{'withFileTypes':!![]})[_0x26b299(0x1bd)](_0x352391=>_0x352391[_0x26b299(0x1b7)]())['map'](_0xc97598=>_0xc97598[_0x26b299(0x187)])[_0x26b299(0x1bd)](_0x6b8892=>!_0x6b8892[_0x26b299(0x20d)](_0x26b299(0x167)))[_0x26b299(0x1bd)](_0x4958b5=>!_0x4958b5[_0x26b299(0x20d)]('_tmp-'))[_0x26b299(0x1e8)]();}catch{return[];}}['latestSnapshotId'](){const _0x2b45d6=_0x3f9bb8,_0x68c4c1=this[_0x2b45d6(0x169)]();if(_0x68c4c1)return _0x68c4c1;const _0x28ea46=this['listSnapshotIds']();if(!_0x28ea46[_0x2b45d6(0x13e)])return null;return _0x28ea46[_0x28ea46[_0x2b45d6(0x13e)]-0x1];}[_0x3f9bb8(0x18a)]({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x26d7e2=_0x3f9bb8;let _0x5b952b;try{_0x5b952b=_0x4c53a2[_0x26d7e2(0x178)](this['snapshotsDir'],{'withFileTypes':!![]});}catch{return;}const _0x5dcf2b=_0x314cff()-maxAgeMs;for(const _0x20107d of _0x5b952b){if(!_0x20107d[_0x26d7e2(0x1b7)]())continue;const _0x15f42e=_0x20107d['name'];if(!_0x15f42e[_0x26d7e2(0x20d)](_0x26d7e2(0x167))&&!_0x15f42e['startsWith']('_tmp-'))continue;const _0xec5ba0=_0x4be99c['join'](this[_0x26d7e2(0x1b6)],_0x15f42e);try{const _0xee369e=_0x4c53a2[_0x26d7e2(0x1d6)](_0xec5ba0);if(_0xee369e[_0x26d7e2(0x188)]>_0x5dcf2b)continue;}catch{}try{_0x4c53a2[_0x26d7e2(0x19a)](_0xec5ba0,{'recursive':!![],'force':!![]});}catch{}}}[_0x3f9bb8(0x19e)]({keep:keep=null}={}){const _0xca7d=_0x3f9bb8,_0x38c5bd=Math[_0xca7d(0x1fd)](0x1,Math[_0xca7d(0x190)](keep??this[_0xca7d(0x1b1)]??0x3)),_0xb78c83=this[_0xca7d(0x1f0)]();if(_0xb78c83[_0xca7d(0x13e)]<=_0x38c5bd)return;const _0x497e83=this[_0xca7d(0x169)](),_0x5dc50e=_0xb78c83['slice'](0x0,Math[_0xca7d(0x1fd)](0x0,_0xb78c83[_0xca7d(0x13e)]-_0x38c5bd));for(const _0x5d284f of _0x5dc50e){if(_0x497e83&&_0x5d284f===_0x497e83)continue;const _0x459e89=this[_0xca7d(0x146)](_0x5d284f);try{_0x4c53a2[_0xca7d(0x19a)](_0x459e89,{'recursive':!![],'force':!![]});}catch{}}}async[_0x3f9bb8(0x196)](_0x4b42d7,_0x1a75b1){const _0x281b5a=_0x3f9bb8;if(!_0x4b42d7)throw new Error('snapshot\x20id\x20required');const _0x2928c2=this[_0x281b5a(0x185)](_0x4b42d7);if(!_0x1c7671(_0x2928c2[_0x281b5a(0x20f)])||!_0x1c7671(_0x2928c2[_0x281b5a(0x1aa)])||!_0x1c7671(_0x2928c2['state']))throw new Error(_0x281b5a(0x139)+_0x4b42d7);const _0x5d10b5=await _0x1a75b1(_0x2928c2);return _0x5d10b5||{};}async[_0x3f9bb8(0x17b)](_0x50b311,_0x2f7e5e,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0xf8598f=_0x3f9bb8,_0x3cfa61=Number(_0x50b311);if(!Number['isFinite'](_0x3cfa61)||_0x3cfa61<0x0)throw new Error('candidateClock\x20must\x20be\x20finite\x20>=\x200');const _0x51bf80=_0x23a340(_0x3cfa61),_0xa056f=this[_0xf8598f(0x146)](_0x51bf80),_0x5db989=_0x4be99c[_0xf8598f(0x1fc)](this[_0xf8598f(0x1b6)],'.tmp-'+_0x51bf80+'-'+_0x5b3eef[_0xf8598f(0x156)](0x6)[_0xf8598f(0x177)](_0xf8598f(0x16e)));_0x4c53a2['mkdirSync'](_0x5db989,{'recursive':!![]});const _0x9f9f37={'dir':_0x5db989,'index':_0x4be99c[_0xf8598f(0x1fc)](_0x5db989,_0xf8598f(0x19c)),'labels':_0x4be99c[_0xf8598f(0x1fc)](_0x5db989,_0xf8598f(0x18f)),'state':_0x4be99c[_0xf8598f(0x1fc)](_0x5db989,_0xf8598f(0x195))};await _0x2f7e5e(_0x9f9f37,{'id':_0x51bf80,'clock':_0x3cfa61});const _0x5d3161=JSON[_0xf8598f(0x1c1)]({'pid':process[_0xf8598f(0x16d)],'host':_0x47663e[_0xf8598f(0x1e2)](),'at':_0x314cff()}),_0x37e36c=_0x314cff();let _0x43f168=null;const _0x393aa4=()=>{const _0x236cd9=_0xf8598f;try{const _0x4640ce=JSON[_0x236cd9(0x1a5)](_0x4c53a2[_0x236cd9(0x15a)](this[_0x236cd9(0x176)],_0x236cd9(0x1d1)));if(_0x4640ce['at']&&_0x314cff()-_0x4640ce['at']>staleLockMaxAgeMs){const _0x8603cd=_0x314cff()-_0x4640ce['at'],_0xa5adc2=_0x236cd9(0x1ca)+Math[_0x236cd9(0x1df)](_0x8603cd/0x3e8)+'s,\x20pid:\x20'+_0x4640ce[_0x236cd9(0x16d)]+',\x20host:\x20'+_0x4640ce[_0x236cd9(0x1b9)]+_0x236cd9(0x183)+_0x236cd9(0x197);this[_0x236cd9(0x200)]?.['warn']?this[_0x236cd9(0x200)][_0x236cd9(0x15c)](_0xa5adc2):console[_0x236cd9(0x15c)](_0x236cd9(0x1f1),_0xa5adc2);try{_0x4c53a2[_0x236cd9(0x211)](this[_0x236cd9(0x176)]);}catch{}return!![];}}catch{try{_0x4c53a2[_0x236cd9(0x211)](this['lockPath']);}catch{}}return![];},_0x5a7777=()=>{const _0x3bae38=_0xf8598f;try{return _0x43f168=_0x4c53a2[_0x3bae38(0x205)](this[_0x3bae38(0x176)],'wx'),_0x4c53a2[_0x3bae38(0x1a2)](_0x43f168,_0x5d3161),!![];}catch(_0xa4407b){if(_0xa4407b&&_0xa4407b[_0x3bae38(0x1a8)]===_0x3bae38(0x173))return![];throw _0xa4407b;}};if(!_0x5a7777()){_0x393aa4(),_0x5a7777();if(_0x43f168==null&&lockTimeoutMs>0x0)while(_0x314cff()-_0x37e36c<lockTimeoutMs){await new Promise(_0xd326bb=>setTimeout(_0xd326bb,0x19));if(_0x5a7777())break;_0x393aa4();}}if(_0x43f168==null){try{_0x4c53a2[_0xf8598f(0x19a)](_0x5db989,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0xf8598f(0x1a6)};}try{const _0x39d4e8=this['readCurrentClock']();if(_0x3cfa61<=_0x39d4e8){try{_0x4c53a2['rmSync'](_0x5db989,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0xf8598f(0x16b),'currentClock':_0x39d4e8};}if(!_0x1c7671(_0xa056f))_0x4c53a2['renameSync'](_0x5db989,_0xa056f);else try{_0x4c53a2[_0xf8598f(0x19a)](_0x5db989,{'recursive':!![],'force':!![]});}catch{}return _0x2b7fea(this[_0xf8598f(0x1a0)],_0x51bf80+'\x0a'),this[_0xf8598f(0x19e)]({'keep':keep}),{'published':!![],'currentClock':_0x3cfa61};}finally{try{_0x4c53a2[_0xf8598f(0x1c6)](_0x43f168);}catch{}try{_0x4c53a2['unlinkSync'](this[_0xf8598f(0x176)]);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x59ee78=_0x411a8a;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x457479=require$$0;class _0x566074{constructor(){const _0x2389ff=_0x3360;this[_0x2389ff(0x1d5)]=new Map(),this[_0x2389ff(0x1c2)]=new Map(),this[_0x2389ff(0x1ce)]=0x0,this[_0x2389ff(0x1ab)]=0x0,this[_0x2389ff(0x208)]=new Map(),this[_0x2389ff(0x1ed)]=!![];}async[_0x59ee78(0x158)](){const _0x1cbafd=_0x59ee78;this['keyToLabel']=new Map(),this['labelToKey']=new Map(),this[_0x1cbafd(0x208)]=new Map(),this[_0x1cbafd(0x1ed)]=!![],this[_0x1cbafd(0x1ce)]=0x0,this[_0x1cbafd(0x1ab)]=0x0;}async[_0x59ee78(0x1bc)](_0x53bca9){const _0x2dc9fd=_0x59ee78;if(!_0x53bca9||!_0x457479[_0x2dc9fd(0x16f)](_0x53bca9))return await this[_0x2dc9fd(0x158)](),!![];let _0x252971;try{_0x252971=_0x457479['readFileSync'](_0x53bca9,_0x2dc9fd(0x1d1));}catch{return await this['reset'](),!![];}let _0x28e232;try{_0x28e232=JSON[_0x2dc9fd(0x1a5)](_0x252971);}catch{return await this[_0x2dc9fd(0x158)](),!![];}const _0x596a25=Array[_0x2dc9fd(0x15e)](_0x28e232?.[_0x2dc9fd(0x1f8)])?_0x28e232[_0x2dc9fd(0x1f8)]:[],_0x4d37ae=Number[_0x2dc9fd(0x1cd)](_0x28e232?.[_0x2dc9fd(0x1ce)])?_0x28e232[_0x2dc9fd(0x1ce)]:0x0,_0x33ba0b=new Map(),_0x5cdb6c=new Map(),_0x1c67ec=new Map(),_0x2e692b=_0x28e232?.[_0x2dc9fd(0x1ff)]>=0x2;let _0x2fb4a1=-0x1;for(const _0x365f9c of _0x596a25){if(!Array['isArray'](_0x365f9c)||_0x365f9c[_0x2dc9fd(0x13e)]<0x2)continue;const _0x3bab59=Number(_0x365f9c[0x0]),_0x35060b=String(_0x365f9c[0x1]??'');if(!Number[_0x2dc9fd(0x1cd)](_0x3bab59)||_0x3bab59<0x0)continue;if(!_0x35060b)continue;_0x33ba0b[_0x2dc9fd(0x192)](_0x35060b,_0x3bab59),_0x5cdb6c[_0x2dc9fd(0x192)](_0x3bab59,_0x35060b);if(_0x2e692b&&typeof _0x365f9c[0x2]===_0x2dc9fd(0x1e5))_0x1c67ec['set'](_0x35060b,_0x365f9c[0x2]);if(_0x3bab59>_0x2fb4a1)_0x2fb4a1=_0x3bab59;}return this[_0x2dc9fd(0x1d5)]=_0x33ba0b,this[_0x2dc9fd(0x1c2)]=_0x5cdb6c,this[_0x2dc9fd(0x208)]=_0x1c67ec,this['hasFingerprints']=_0x2e692b,this[_0x2dc9fd(0x1ce)]=Math[_0x2dc9fd(0x1fd)](_0x4d37ae,_0x2fb4a1+0x1,0x0),this['_tombstoneCount']=0x0,!![];}[_0x59ee78(0x1e7)](_0x3a44d5){const _0x19f545=_0x59ee78;return this[_0x19f545(0x1d5)]['get'](_0x3a44d5);}[_0x59ee78(0x17a)](_0x495a32){const _0x321245=_0x59ee78;let _0x374793=this[_0x321245(0x1d5)][_0x321245(0x1de)](_0x495a32);if(_0x374793!==undefined)return _0x374793;return _0x374793=this[_0x321245(0x1ce)]++,this[_0x321245(0x1d5)][_0x321245(0x192)](_0x495a32,_0x374793),this[_0x321245(0x1c2)][_0x321245(0x192)](_0x374793,_0x495a32),_0x374793;}[_0x59ee78(0x141)](_0x521bd0,_0x43e25a){const _0x3dba14=_0x59ee78;if(_0x43e25a==null)this[_0x3dba14(0x208)][_0x3dba14(0x1fa)](_0x521bd0);else this[_0x3dba14(0x208)]['set'](_0x521bd0,_0x43e25a);}['fingerprintOf'](_0x17d5de){const _0x1e3c66=_0x59ee78;return this['keyToFp'][_0x1e3c66(0x1de)](_0x17d5de);}[_0x59ee78(0x1f6)](){const _0x2b8dfb=_0x59ee78;return this['keyToLabel'][_0x2b8dfb(0x1f6)]();}[_0x59ee78(0x19d)](_0x419344){const _0x521e03=_0x59ee78,_0x40390b=this['keyToLabel'][_0x521e03(0x1de)](_0x419344);if(_0x40390b===undefined)return;this[_0x521e03(0x208)][_0x521e03(0x1fa)](_0x419344),this['keyToLabel'][_0x521e03(0x1fa)](_0x419344),this[_0x521e03(0x1c2)][_0x521e03(0x1fa)](_0x40390b),this[_0x521e03(0x1ab)]++;}[_0x59ee78(0x15f)](_0x4e6d15){const _0xc14b9d=_0x59ee78;return this[_0xc14b9d(0x1c2)][_0xc14b9d(0x1de)](_0x4e6d15)??null;}[_0x59ee78(0x1d7)](){const _0x1fa7cf=_0x59ee78;return this[_0x1fa7cf(0x1d5)][_0x1fa7cf(0x1d7)];}[_0x59ee78(0x1ba)](){const _0x418319=_0x59ee78;return this[_0x418319(0x1ab)];}async[_0x59ee78(0x1d9)](_0xb8a06f){const _0x29e7bb=_0x59ee78,_0x1fcb26=_0xb8a06f+_0x29e7bb(0x14e),_0x26edd2=[];for(const [_0x4efbe0,_0x2368d4]of this['labelToKey'][_0x29e7bb(0x1f8)]()){const _0x2beef3=this[_0x29e7bb(0x208)][_0x29e7bb(0x1de)](_0x2368d4);_0x26edd2[_0x29e7bb(0x1db)](_0x2beef3==null?[_0x4efbe0,_0x2368d4]:[_0x4efbe0,_0x2368d4,_0x2beef3]);}_0x26edd2[_0x29e7bb(0x1e8)]((_0x32e39d,_0x3934a0)=>_0x32e39d[0x0]-_0x3934a0[0x0]);const _0xdab971={'version':0x2,'nextLabel':this[_0x29e7bb(0x1ce)],'entries':_0x26edd2};_0x457479['writeFileSync'](_0x1fcb26,JSON['stringify'](_0xdab971)),_0x457479['renameSync'](_0x1fcb26,_0xb8a06f);}}return labelMap=_0x566074,labelMap;}var indexConvergence,hasRequiredIndexConvergence;function requireIndexConvergence(){if(hasRequiredIndexConvergence)return indexConvergence;hasRequiredIndexConvergence=0x1;function _0x45875b(_0x19d9e5){const _0x4cdda8=_0x3360,_0x4bd3c3=new Uint32Array(_0x19d9e5[_0x4cdda8(0x160)],_0x19d9e5[_0x4cdda8(0x193)],_0x19d9e5[_0x4cdda8(0x13e)]);let _0xb16848=0x811c9dc5,_0x3b7b77=0x9747b28c;for(let _0x255208=0x0;_0x255208<_0x4bd3c3['length'];_0x255208++){const _0xf00792=_0x4bd3c3[_0x255208];_0xb16848=Math[_0x4cdda8(0x1c4)](_0xb16848^_0xf00792,0x1000193)>>>0x0;let _0x32a963=Math['imul'](_0xf00792,0xcc9e2d51);_0x32a963=_0x32a963<<0xf|_0x32a963>>>0x11,_0x3b7b77=Math[_0x4cdda8(0x1c4)](_0x3b7b77^Math[_0x4cdda8(0x1c4)](_0x32a963,0x1b873593),0x5)+0xe6546b64,_0x3b7b77>>>=0x0;}return _0x3b7b77=Math['imul'](_0x3b7b77^_0x3b7b77>>>0x10,0x85ebca6b)>>>0x0,(_0xb16848>>>0x0)*0x100000+(_0x3b7b77&0xfffff);}function _0x1cf236(_0x1ee843,_0x4d7168,_0x2c24c4,{upsert:_0x3866ca,remove:_0x80d818}){const _0x439a2e=_0x3360,_0x461013=new Set();let _0x1201e8=0x0,_0x33a711=0x0,_0x4b6d0f=0x0;for(const {key:_0x3a90fd,vector:_0x336ec7}of _0x4d7168){if(!(_0x336ec7 instanceof Float32Array)||_0x336ec7['length']!==_0x2c24c4)continue;_0x461013[_0x439a2e(0x166)](_0x3a90fd);const _0x5570b7=_0x45875b(_0x336ec7),_0xdcba40=_0x1ee843[_0x439a2e(0x1e7)](_0x3a90fd)!==undefined;if(_0xdcba40&&_0x1ee843[_0x439a2e(0x1d2)](_0x3a90fd)===_0x5570b7)continue;_0x3866ca(_0x3a90fd,_0x336ec7,_0x5570b7);if(_0xdcba40)_0x33a711++;else _0x1201e8++;}for(const _0x149a8d of[..._0x1ee843[_0x439a2e(0x1f6)]()]){if(_0x461013['has'](_0x149a8d))continue;_0x80d818(_0x149a8d),_0x4b6d0f++;}return{'added':_0x1201e8,'changed':_0x33a711,'removed':_0x4b6d0f};}return indexConvergence={'fingerprint':_0x45875b,'reconcileIndex':_0x1cf236},indexConvergence;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x54f145=requireSnapshotStore(),_0x485af6=requireLabelMap(),{fingerprint:_0x2de35c,reconcileIndex:_0x5e77f0}=requireIndexConvergence(),_0x2d5043=0x1;let _0x35cf99=null;function _0x417f74(){const _0x4b9297=_0x3360;if(_0x35cf99)return _0x35cf99;try{return _0x35cf99=require(_0x4b9297(0x165)),_0x35cf99;}catch(_0x3984a8){const _0x4c8792=new Error(_0x4b9297(0x207)+('for\x20Node\x20'+process[_0x4b9297(0x154)][_0x4b9297(0x1ef)]+_0x4b9297(0x18b)+process[_0x4b9297(0x171)]+'/'+process[_0x4b9297(0x17f)]+'.\x20')+'Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20'+(_0x4b9297(0x209)+(_0x3984a8?.[_0x4b9297(0x194)]||String(_0x3984a8))));_0x4c8792[_0x4b9297(0x1a8)]=_0x4b9297(0x150),_0x4c8792['cause']=_0x3984a8;throw _0x4c8792;}}return hnsw=function _0x37105b(_0x504cb7={},{dims:_0x234f83,dir:_0x3d57de}){const _0x3e2d51=_0x3360,_0x15eb2f=_0x417f74();if(!_0x234f83||_0x234f83<=0x0)throw new Error(_0x3e2d51(0x191));if(!_0x3d57de)throw new Error(_0x3e2d51(0x16a));const _0x12439f={'metric':_0x504cb7[_0x3e2d51(0x1bb)]??_0x3e2d51(0x164),'M':_0x504cb7['M']??0x10,'efConstruction':_0x504cb7[_0x3e2d51(0x17c)]??0xc8,'efSearch':_0x504cb7[_0x3e2d51(0x189)]??0x40,'maxElements':_0x504cb7[_0x3e2d51(0x199)]??0x400,'growFactor':_0x504cb7[_0x3e2d51(0x1a7)]??0x2,'snapshotEveryChanges':_0x504cb7[_0x3e2d51(0x16c)]??0xc350,'keepSnapshots':_0x504cb7[_0x3e2d51(0x1b1)]??0x2,'tmpMaxAgeMs':_0x504cb7[_0x3e2d51(0x14b)]??0x6*0x36ee80},_0x5af97f=new _0x54f145({'dir':_0x3d57de,'keepSnapshots':_0x12439f[_0x3e2d51(0x1b1)]}),_0x4ae3f8=new _0x485af6();let _0x4d2f6f=null,_0x2aad23=0x0,_0x3f94fe=null,_0x3443fb=Promise[_0x3e2d51(0x15d)]();const _0x29d3ee=_0x4c3d30=>{const _0x1b7dac=_0x3e2d51,_0xca8759=_0x3443fb[_0x1b7dac(0x182)](_0x4c3d30);return _0x3443fb=_0xca8759[_0x1b7dac(0x1e3)](()=>{}),_0xca8759;};async function _0x4aa06a(_0x9c3c31){const _0x3a9bf0=_0x3e2d51;await _0x4ae3f8[_0x3a9bf0(0x158)](),_0x9c3c31=_0x9c3c31??[];const _0x2fbec9=Math[_0x3a9bf0(0x1fd)](_0x12439f[_0x3a9bf0(0x199)],Math[_0x3a9bf0(0x1b4)](_0x9c3c31[_0x3a9bf0(0x13e)]*(_0x12439f[_0x3a9bf0(0x1a7)]||1.2)),0x1);_0x4d2f6f=new _0x15eb2f[(_0x3a9bf0(0x20e))](_0x12439f[_0x3a9bf0(0x1bb)],_0x234f83),_0x4d2f6f[_0x3a9bf0(0x212)]({'maxElements':_0x2fbec9,'efConstruction':_0x12439f[_0x3a9bf0(0x17c)],'M':_0x12439f['M']});for(const {key:_0x614cd7,vector:_0x51b01c}of _0x9c3c31){if(!(_0x51b01c instanceof Float32Array)||_0x51b01c[_0x3a9bf0(0x13e)]!==_0x234f83)continue;_0x48794c(_0x614cd7,_0x51b01c);}_0x4d2f6f['setEf'](_0x12439f[_0x3a9bf0(0x189)]),_0x2aad23=0x0;}async function _0x3b1929(_0x5d2d03){return _0x4aa06a(_0x5d2d03?await _0x5d2d03():[]);}function _0x2fe010(){const _0x3fc628=_0x3e2d51;if(_0x4d2f6f[_0x3fc628(0x1a9)]()<_0x4d2f6f[_0x3fc628(0x201)]())return;const _0x2a1f2b=Math[_0x3fc628(0x1b4)](_0x4d2f6f[_0x3fc628(0x201)]()*(_0x12439f[_0x3fc628(0x1a7)]||0x2));_0x4d2f6f[_0x3fc628(0x175)](_0x2a1f2b),_0x12439f[_0x3fc628(0x199)]=_0x2a1f2b;}function _0x48794c(_0x46eea8,_0x2a2574,_0x45e167){const _0x2311d5=_0x3e2d51,_0x68ac10=_0x4ae3f8['labelForEphemeral'](_0x46eea8);try{_0x4d2f6f[_0x2311d5(0x1ac)](_0x68ac10);}catch{}_0x2fe010(),_0x4d2f6f[_0x2311d5(0x1ae)](Array[_0x2311d5(0x159)](_0x2a2574),_0x68ac10),_0x4ae3f8[_0x2311d5(0x141)](_0x46eea8,_0x45e167??_0x2de35c(_0x2a2574));}function _0x3632c3(_0x589f94){const _0x5b1cac=_0x3e2d51,_0x23ffb7=_0x4ae3f8[_0x5b1cac(0x1e7)](_0x589f94);if(_0x23ffb7===undefined)return![];try{_0x4d2f6f[_0x5b1cac(0x1ac)](_0x23ffb7);}catch{}return _0x4ae3f8[_0x5b1cac(0x19d)](_0x589f94),!![];}function _0x1364c1(){const _0x5ac049=_0x3e2d51;return Math[_0x5ac049(0x1fd)](Date[_0x5ac049(0x1d3)](),_0x5af97f[_0x5ac049(0x1f7)]()+0x1);}async function _0x32caba(_0x1e5788){const _0x2135e3=_0x3e2d51;if(!_0x4d2f6f||!_0x1e5788)return![];const _0x208883=await _0x5af97f[_0x2135e3(0x17b)](_0x1e5788,async _0x1cb882=>{const _0x5a8e65=_0x2135e3;_0x4d2f6f[_0x5a8e65(0x13c)](_0x1cb882['index']),await _0x4ae3f8[_0x5a8e65(0x1d9)](_0x1cb882[_0x5a8e65(0x1aa)]);const _0x445bc5=require$$0;_0x445bc5[_0x5a8e65(0x1a2)](_0x1cb882[_0x5a8e65(0x180)],JSON[_0x5a8e65(0x1c1)]({'manifestVersion':_0x2d5043,'dims':_0x234f83,'metric':_0x12439f[_0x5a8e65(0x1bb)],'clock':_0x1e5788,'snapshotAt':Date[_0x5a8e65(0x1d3)]()},null,0x2));},{'keep':_0x12439f['keepSnapshots']});if(_0x208883?.[_0x2135e3(0x170)])_0x2aad23=0x0;return _0x208883?.[_0x2135e3(0x170)]??![];}async function _0x265c82(){const _0x1efb6b=_0x3e2d51,_0x1e1aa2=_0x5af97f[_0x1efb6b(0x169)]()||_0x5af97f[_0x1efb6b(0x1a1)]();if(!_0x1e1aa2)return null;let _0x1111dc,_0x2e3f84=![];return await _0x5af97f[_0x1efb6b(0x196)](_0x1e1aa2,async _0x1c8968=>{const _0x4f1ec1=_0x1efb6b,_0x56b1ce=require$$0;_0x1111dc=JSON[_0x4f1ec1(0x1a5)](_0x56b1ce['readFileSync'](_0x1c8968[_0x4f1ec1(0x180)],_0x4f1ec1(0x1d1)));if(_0x1111dc[_0x4f1ec1(0x14a)]!==_0x2d5043||_0x1111dc['dims']!==_0x234f83||_0x1111dc[_0x4f1ec1(0x1bb)]!==_0x12439f[_0x4f1ec1(0x1bb)]){_0x1111dc=null;return;}await _0x4ae3f8['loadFrom'](_0x1c8968['labels']),_0x4d2f6f=new _0x15eb2f[(_0x4f1ec1(0x20e))](_0x12439f[_0x4f1ec1(0x1bb)],_0x234f83),_0x4d2f6f[_0x4f1ec1(0x13d)](_0x1c8968[_0x4f1ec1(0x20f)]),_0x4d2f6f[_0x4f1ec1(0x147)](_0x12439f[_0x4f1ec1(0x189)]),_0x2e3f84=!![];}),_0x2e3f84?_0x1111dc?.[_0x1efb6b(0x149)]??0x0:null;}return{async 'load'(_0x384906){return _0x29d3ee(async()=>{const _0x6a0cb2=_0x3360;_0x5af97f[_0x6a0cb2(0x18a)]({'maxAgeMs':_0x12439f[_0x6a0cb2(0x14b)]}),_0x3f94fe=_0x384906??null;const _0x129666=await _0x265c82(),_0x10e57d=_0x384906?await _0x384906():null;if(_0x129666!=null){if(_0x10e57d){if(!_0x4ae3f8[_0x6a0cb2(0x1ed)])return await _0x4aa06a(_0x10e57d),null;const _0x3318f3=_0x5e77f0(_0x4ae3f8,_0x10e57d,_0x234f83,{'upsert':_0x48794c,'remove':_0x3632c3});_0x2aad23+=_0x3318f3['added']+_0x3318f3[_0x6a0cb2(0x18c)]+_0x3318f3[_0x6a0cb2(0x1e4)];}return _0x129666;}return await _0x4aa06a(_0x10e57d),null;});},async 'add'(_0x3bb990,_0x35ba64,_0x465b42){return _0x29d3ee(async()=>{const _0x543a82=_0x3360;if(!_0x4d2f6f)return;const _0x426abf=_0x35ba64 instanceof Float32Array?_0x35ba64:new Float32Array(_0x35ba64),_0x127152=_0x2de35c(_0x426abf);if(_0x4ae3f8[_0x543a82(0x1d2)](_0x3bb990)===_0x127152)return;_0x48794c(_0x3bb990,_0x426abf,_0x127152),_0x2aad23++,_0x2aad23>=_0x12439f[_0x543a82(0x16c)]&&await _0x32caba(_0x1364c1());});},async 'remove'(_0x3f5987){return _0x29d3ee(async()=>{if(!_0x4d2f6f)return;if(_0x3632c3(_0x3f5987))_0x2aad23++;});},'search'(_0x2490d1,{limit:limit=0xa,efSearch:_0x1f1d12}={}){const _0x1c0788=_0x3e2d51;if(!_0x4d2f6f)return[];if(Number[_0x1c0788(0x1cd)](_0x1f1d12))_0x4d2f6f[_0x1c0788(0x147)](_0x1f1d12);const _0x5dd90f=Math[_0x1c0788(0x1be)](limit,_0x4d2f6f[_0x1c0788(0x1a9)]()||0x1),{neighbors:_0x59af5c,distances:_0x117a06}=_0x4d2f6f['searchKnn'](Array['from'](_0x2490d1),_0x5dd90f),_0x2c6a55=[];for(let _0x1d2947=0x0;_0x1d2947<_0x59af5c['length'];_0x1d2947++){const _0x1e228e=_0x4ae3f8['keyForLabel'](_0x59af5c[_0x1d2947]);if(!_0x1e228e)continue;const _0x2f27a4=_0x12439f[_0x1c0788(0x1bb)]==='cosine'?Math[_0x1c0788(0x1fd)](0x0,0x1-_0x117a06[_0x1d2947]):0x1/(0x1+_0x117a06[_0x1d2947]);_0x2c6a55[_0x1c0788(0x1db)]({'key':_0x1e228e,'score':_0x2f27a4});}return _0x2c6a55;},async 'snapshot'(_0x535015){return _0x29d3ee(()=>_0x32caba(_0x535015??_0x1364c1()));},async 'rebuild'(_0x2216aa){return _0x29d3ee(()=>{if(_0x2216aa!=null)_0x3f94fe=_0x2216aa;return _0x3b1929(_0x2216aa??_0x3f94fe);});},async 'stop'(){return _0x29d3ee(()=>_0x2aad23>0x0||!_0x5af97f['readCurrentId']()?_0x32caba(_0x1364c1()):![]);},'count'(){const _0x183791=_0x3e2d51;return _0x4ae3f8[_0x183791(0x1d7)]();},'info'(){const _0x1c1c62=_0x3e2d51;return{'algorithm':_0x1c1c62(0x161),'metric':_0x12439f['metric'],'M':_0x12439f['M'],'efConstruction':_0x12439f[_0x1c1c62(0x17c)],'efSearch':_0x12439f['efSearch'],'maxElements':_0x4d2f6f?.[_0x1c1c62(0x201)]()??_0x12439f[_0x1c1c62(0x199)],'count':_0x4ae3f8[_0x1c1c62(0x1d7)](),'changesSince':_0x2aad23,'snapshotDir':_0x3d57de,'latestSnapshot':_0x5af97f[_0x1c1c62(0x169)]()??null};}};},hnsw;}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x513a18(_0x4ef6b0={}){const _0x52a722=new Map();return{async 'load'(_0x508d61){const _0x10f2e4=_0x3360;_0x52a722[_0x10f2e4(0x1f4)]();if(_0x508d61)for(const {key:_0x1b8429,vector:_0x2bc3d9}of await _0x508d61()){_0x52a722[_0x10f2e4(0x192)](_0x1b8429,_0x2bc3d9);}},async 'add'(_0x3bb4f9,_0xd25fee,_0x15f88b){_0x52a722['set'](_0x3bb4f9,_0xd25fee);},async 'remove'(_0x429e2a){const _0x3a979f=_0x3360;_0x52a722[_0x3a979f(0x1fa)](_0x429e2a);},'search'(_0x3e9127,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x2c3f6d=_0x3360,_0x32b0a0=[];for(const [_0x20ea7d,_0x2b0218]of _0x52a722){const _0x4ace62=_0x3b3f81(_0x3e9127,_0x2b0218);if(_0x4ace62>=threshold)_0x32b0a0[_0x2c3f6d(0x1db)]({'key':_0x20ea7d,'score':_0x4ace62});}return _0x32b0a0[_0x2c3f6d(0x1e8)]((_0x5a390e,_0x413499)=>_0x413499[_0x2c3f6d(0x1b0)]-_0x5a390e[_0x2c3f6d(0x1b0)]),_0x32b0a0[_0x2c3f6d(0x184)](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x5b6a08){await this['load'](_0x5b6a08);},async 'stop'(){},'count'(){const _0x4fa636=_0x3360;return _0x52a722[_0x4fa636(0x1d7)];},'info'(){const _0x326fb5=_0x3360;return{'algorithm':'flat','count':_0x52a722[_0x326fb5(0x1d7)]};}};};function _0x3b3f81(_0xc33ad6,_0x32c139){const _0x4074d3=_0x3360;let _0x4fe58f=0x0,_0x57ba46=0x0,_0x4cde42=0x0;for(let _0x57199e=0x0;_0x57199e<_0xc33ad6[_0x4074d3(0x13e)];_0x57199e++){_0x4fe58f+=_0xc33ad6[_0x57199e]*_0x32c139[_0x57199e],_0x57ba46+=_0xc33ad6[_0x57199e]*_0xc33ad6[_0x57199e],_0x4cde42+=_0x32c139[_0x57199e]*_0x32c139[_0x57199e];}const _0x3548bf=Math[_0x4074d3(0x168)](_0x57ba46)*Math['sqrt'](_0x4cde42);return _0x3548bf===0x0?0x0:_0x4fe58f/_0x3548bf;}return flat;}var writerLock,hasRequiredWriterLock;function requireWriterLock(){if(hasRequiredWriterLock)return writerLock;hasRequiredWriterLock=0x1;const _0x21b32d=require$$0,_0x1eba11=require$$1,_0x42d6fb=require$$3;return writerLock=function _0x26572c(_0x191b84,{maxAgeMs:maxAgeMs=0x3a98,heartbeatMs:heartbeatMs=0x1388,onLost:onLost=null}={}){const _0x58495a=_0x3360,_0x5b46a4=_0x1eba11['join'](_0x191b84,_0x58495a(0x1bf)),_0x202fb8=_0x42d6fb[_0x58495a(0x156)](0x8)[_0x58495a(0x177)](_0x58495a(0x16e));let _0x23738d=![],_0x333818=null;const _0x35c5df=()=>JSON[_0x58495a(0x1c1)]({'pid':process[_0x58495a(0x16d)],'token':_0x202fb8,'at':Date[_0x58495a(0x1d3)]()});function _0x276e6c(){const _0x39ad31=_0x58495a;try{return JSON[_0x39ad31(0x1a5)](_0x21b32d['readFileSync'](_0x5b46a4,'utf8'));}catch(_0x1fa527){return _0x1fa527?.[_0x39ad31(0x1a8)]===_0x39ad31(0x1a3)?null:{'unreadable':!![]};}}function _0x24b572(){const _0x13a988=_0x58495a;try{const _0x443b59=_0x21b32d['openSync'](_0x5b46a4,'wx');try{_0x21b32d['writeFileSync'](_0x443b59,_0x35c5df());}finally{_0x21b32d[_0x13a988(0x1c6)](_0x443b59);}return!![];}catch(_0x151c10){if(_0x151c10?.[_0x13a988(0x1a8)]===_0x13a988(0x173))return![];throw _0x151c10;}}function _0x19f3d9(_0x41771f){const _0x59c296=_0x58495a;if(!_0x41771f)return!![];if(_0x41771f[_0x59c296(0x1c3)])return!![];return Date[_0x59c296(0x1d3)]()-(_0x41771f['at']??0x0)>=maxAgeMs;}function _0x5936fe(){if(_0x333818)clearInterval(_0x333818);_0x333818=null;}function _0x24a783(){_0x5936fe(),_0x333818=setInterval(()=>{const _0x3ed6d7=_0x3360,_0x2c37d3=_0x276e6c();if(_0x2c37d3&&!_0x2c37d3['unreadable']&&_0x2c37d3[_0x3ed6d7(0x1f3)]!==_0x202fb8){_0x23738d=![],_0x5936fe();try{onLost?.();}catch{}return;}try{_0x21b32d[_0x3ed6d7(0x1a2)](_0x5b46a4,_0x35c5df());}catch{}},heartbeatMs),_0x333818['unref']?.();}function _0x378c0a(){const _0x47c563=_0x58495a,_0x1950fc=_0x276e6c();return!!_0x1950fc&&_0x1950fc[_0x47c563(0x1f3)]===_0x202fb8;}return{'path':_0x5b46a4,'token':_0x202fb8,'acquire'(){const _0x1471e1=_0x58495a,_0x323493=_0x276e6c();if(_0x323493&&_0x323493[_0x1471e1(0x1f3)]===_0x202fb8){_0x23738d=!![];if(!_0x333818)_0x24a783();return!![];}let _0x11c64c=_0x24b572();if(!_0x11c64c&&_0x19f3d9(_0x276e6c())){try{_0x21b32d[_0x1471e1(0x211)](_0x5b46a4);}catch{}_0x11c64c=_0x24b572();}if(_0x11c64c&&!_0x378c0a())_0x11c64c=![];_0x23738d=_0x11c64c;if(_0x11c64c)_0x24a783();return _0x11c64c;},'held'(){return _0x23738d;},'isFree'(){const _0x395dfb=_0x58495a,_0xd2d633=_0x276e6c();if(_0xd2d633&&_0xd2d633[_0x395dfb(0x1f3)]===_0x202fb8)return![];return _0x19f3d9(_0xd2d633);},'release'(){const _0x2d49c2=_0x58495a;_0x5936fe();if(!_0x23738d)return;_0x23738d=![];if(_0x378c0a())try{_0x21b32d[_0x2d49c2(0x211)](_0x5b46a4);}catch{}}};},writerLock;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x34fdf8=require$$0,_0x4da061=requireSnapshotStore(),_0x1b8eaf=requireLabelMap(),_0x477a91=requireWriterLock(),{fingerprint:_0x600b9d,reconcileIndex:_0x551732}=requireIndexConvergence(),_0x55cb33=0x1;let _0x89b0e1=null;function _0x3a5d57(){const _0x636f8b=_0x3360;if(_0x89b0e1)return _0x89b0e1;try{return _0x89b0e1=require(_0x636f8b(0x1ea)),_0x89b0e1;}catch(_0x21157c){const _0x3142f4=new Error(_0x636f8b(0x1ad)+(_0x636f8b(0x14f)+process[_0x636f8b(0x154)][_0x636f8b(0x1ef)]+_0x636f8b(0x18b)+process[_0x636f8b(0x171)]+'/'+process[_0x636f8b(0x17f)]+'.\x20')+_0x636f8b(0x1cc)+(_0x636f8b(0x209)+(_0x21157c?.['message']||String(_0x21157c))));_0x3142f4['code']=_0x636f8b(0x157),_0x3142f4[_0x636f8b(0x1d0)]=_0x21157c;throw _0x3142f4;}}function _0x53ac1f(_0x189d98,_0x26118d){const _0x86ade4=_0x3360;switch(_0x189d98){case _0x86ade4(0x164):return _0x26118d[_0x86ade4(0x1c7)][_0x86ade4(0x181)];case'l2':return _0x26118d[_0x86ade4(0x1c7)][_0x86ade4(0x1dc)];case'ip':return _0x26118d['MetricKind']['IP'];default:return _0x26118d[_0x86ade4(0x1c7)][_0x86ade4(0x181)];}}return usearch=function _0x5a8de2(_0x185273={},{dims:_0x353d90,dir:_0x148319,fetchAll:fetchAll=null,onChange:onChange=null}={}){const _0x4eac58=_0x3360,_0x32c73c=_0x3a5d57();if(!_0x353d90||_0x353d90<=0x0)throw new Error(_0x4eac58(0x1c0));if(!_0x148319)throw new Error(_0x4eac58(0x1b5));const _0x3d096e={'metric':_0x185273[_0x4eac58(0x1bb)]??'cosine','connectivity':_0x185273[_0x4eac58(0x18e)]??0x10,'expansionAdd':_0x185273[_0x4eac58(0x142)]??0x80,'expansionSearch':_0x185273['expansionSearch']??0x40,'snapshotEveryChanges':_0x185273[_0x4eac58(0x16c)]??0xc350,'snapshotMaxLagMs':_0x185273[_0x4eac58(0x1da)]??0x2710,'keepSnapshots':_0x185273[_0x4eac58(0x1b1)]??0x2,'tmpMaxAgeMs':_0x185273[_0x4eac58(0x14b)]??0x6*0x36ee80,'heartbeatIntervalMs':_0x185273[_0x4eac58(0x1b8)]??0x1388,'writerLockMaxAgeMs':_0x185273[_0x4eac58(0x1d8)]??0x3a98,'viewRefreshMs':_0x185273['viewRefreshMs']??0x3e8},_0x2265b5=new _0x4da061({'dir':_0x148319,'keepSnapshots':_0x3d096e[_0x4eac58(0x1b1)]}),_0x4c44c7=_0x477a91(_0x148319,{'maxAgeMs':_0x3d096e[_0x4eac58(0x1d8)],'heartbeatMs':_0x3d096e[_0x4eac58(0x1b8)],'onLost':()=>{const _0x27b79d=_0x4eac58;_0x152239(_0x350547)[_0x27b79d(0x1e3)](()=>{});}});let _0x2c882b=new _0x1b8eaf(),_0x1589ee=null,_0x10dc8b=0x0,_0x232238=null,_0x30625d=![],_0x4fa1ff=![],_0xf59148=null,_0x1b3ef5=0x0,_0x1ee4d9=null,_0x26a863=0x0,_0x16d624=![],_0x2cab22=Promise[_0x4eac58(0x15d)]();const _0x152239=_0x141c3c=>{const _0x276faa=_0x4eac58,_0x55b6ca=_0x2cab22[_0x276faa(0x182)](_0x141c3c);return _0x2cab22=_0x55b6ca['catch'](()=>{}),_0x55b6ca;},_0x344d08=()=>{try{onChange?.();}catch{}};function _0x16ad58(){const _0x5965fd=_0x4eac58;return new _0x32c73c[(_0x5965fd(0x145))]({'dimensions':_0x353d90,'metric':_0x53ac1f(_0x3d096e['metric'],_0x32c73c),'quantization':_0x32c73c['ScalarKind'][_0x5965fd(0x14d)],'connectivity':_0x3d096e[_0x5965fd(0x18e)],'expansion_add':_0x3d096e[_0x5965fd(0x142)],'expansion_search':_0x3d096e['expansionSearch'],'multi':![]});}function _0x506f22(_0x568469){return _0x568469 instanceof Float32Array?_0x568469:new Float32Array(_0x568469);}function _0x4e2215(){const _0x29caf8=_0x4eac58;if(fetchAll)return fetchAll();if(_0x232238)return _0x232238();return Promise[_0x29caf8(0x15d)](null);}function _0x1538ce(_0x569297,_0x11b077,_0x39015e){const _0x386ae4=_0x4eac58,_0x5d7af9=_0x2c882b['labelForExisting'](_0x569297);if(_0x5d7af9!==undefined)try{_0x1589ee[_0x386ae4(0x198)](BigInt(_0x5d7af9));}catch{}const _0x454b5a=_0x2c882b[_0x386ae4(0x17a)](_0x569297);_0x1589ee['add'](BigInt(_0x454b5a),_0x11b077),_0x2c882b[_0x386ae4(0x141)](_0x569297,_0x39015e??_0x600b9d(_0x11b077));}function _0x7bdc90(_0x309fdd){const _0xe8ab7d=_0x4eac58,_0x12199a=_0x2c882b[_0xe8ab7d(0x1e7)](_0x309fdd);if(_0x12199a===undefined)return![];try{_0x1589ee[_0xe8ab7d(0x198)](BigInt(_0x12199a));}catch{}return _0x2c882b[_0xe8ab7d(0x19d)](_0x309fdd),!![];}function _0x203455(_0x5b7955){const _0x4f0b8d=_0x4eac58;_0x2c882b=new _0x1b8eaf(),_0x1589ee=_0x16ad58();for(const {key:_0x3e1259,vector:_0x59723a}of _0x5b7955??[]){if(!(_0x59723a instanceof Float32Array)||_0x59723a[_0x4f0b8d(0x13e)]!==_0x353d90)continue;_0x1538ce(_0x3e1259,_0x59723a);}_0x10dc8b=0x0;}function _0x14cd4d(){const _0x493f91=_0x4eac58;return Math[_0x493f91(0x1fd)](Date[_0x493f91(0x1d3)](),_0x2265b5[_0x493f91(0x1f7)]()+0x1);}function _0xf41a60(){if(_0xf59148)clearTimeout(_0xf59148);_0xf59148=null;}function _0x4a5cf0(){const _0x2dce64=_0x4eac58;if(!_0x3d096e[_0x2dce64(0x1da)]||_0xf59148||!_0x4fa1ff||_0x10dc8b<=0x0)return;const _0x39b302=Math[_0x2dce64(0x1fd)](_0x3d096e['snapshotMaxLagMs'],0xa*_0x1b3ef5);_0xf59148=setTimeout(()=>{const _0x572119=_0x2dce64;_0xf59148=null,_0x152239(async()=>{if(_0x4fa1ff&&_0x10dc8b>0x0)await _0x59cb25();_0x4a5cf0(),_0x344d08();})[_0x572119(0x1e3)](()=>{});},_0x39b302),_0xf59148['unref']?.();}async function _0x59cb25(_0x399e9d){const _0x3cff7f=_0x4eac58;if(!_0x1589ee)return![];const _0x1f589b=_0x399e9d??_0x14cd4d(),_0x223fbc=Date[_0x3cff7f(0x1d3)](),_0x5d8800=await _0x2265b5[_0x3cff7f(0x17b)](_0x1f589b,async _0x2952bf=>{const _0x4155e0=_0x3cff7f;_0x1589ee['save'](_0x2952bf[_0x4155e0(0x20f)]),await _0x2c882b[_0x4155e0(0x1d9)](_0x2952bf[_0x4155e0(0x1aa)]),_0x34fdf8[_0x4155e0(0x1a2)](_0x2952bf[_0x4155e0(0x180)],JSON[_0x4155e0(0x1c1)]({'manifestVersion':_0x55cb33,'algorithm':_0x4155e0(0x1ea),'dims':_0x353d90,'metric':_0x3d096e[_0x4155e0(0x1bb)],'clock':_0x1f589b,'snapshotAt':Date[_0x4155e0(0x1d3)]()},null,0x2));},{'keep':_0x3d096e[_0x3cff7f(0x1b1)]});return _0x1b3ef5=Date[_0x3cff7f(0x1d3)]()-_0x223fbc,_0x5d8800?.[_0x3cff7f(0x170)]&&(_0x10dc8b=0x0,_0xf41a60()),_0x5d8800?.['published']??![];}function _0x506b5d(){const _0x3eacd1=_0x4eac58;_0x10dc8b++;if(_0x10dc8b>=_0x3d096e[_0x3eacd1(0x16c)])return _0x59cb25();return _0x4a5cf0(),null;}async function _0xaf012b(){const _0x19bc92=_0x4eac58,_0x474862=_0x2265b5[_0x19bc92(0x169)]()||_0x2265b5[_0x19bc92(0x1a1)]();if(!_0x474862)return null;let _0x18c8e6,_0x5b1e51=![];try{await _0x2265b5['loadSnapshot'](_0x474862,async _0x2ebb0e=>{const _0x51c970=_0x19bc92;_0x18c8e6=JSON[_0x51c970(0x1a5)](_0x34fdf8[_0x51c970(0x15a)](_0x2ebb0e[_0x51c970(0x180)],_0x51c970(0x1d1)));if(_0x18c8e6[_0x51c970(0x14a)]!==_0x55cb33||_0x18c8e6['algorithm']!==_0x51c970(0x1ea)||_0x18c8e6['dims']!==_0x353d90||_0x18c8e6[_0x51c970(0x1bb)]!==_0x3d096e[_0x51c970(0x1bb)]){_0x18c8e6=null;return;}const _0x23bf68=new _0x1b8eaf();await _0x23bf68[_0x51c970(0x1bc)](_0x2ebb0e[_0x51c970(0x1aa)]);const _0x31d84e=_0x16ad58();_0x31d84e['load'](_0x2ebb0e[_0x51c970(0x20f)]),_0x2c882b=_0x23bf68,_0x1589ee=_0x31d84e,_0x5b1e51=!![];});}catch{return null;}return _0x5b1e51?_0x18c8e6?.[_0x19bc92(0x149)]??0x0:null;}async function _0x373334(_0x1b7fa9){const _0x253fbb=_0x4eac58;_0x1ee4d9=null;const _0x3b2aad=await _0xaf012b();if(_0x3b2aad!=null){_0x10dc8b=0x0;if(_0x1b7fa9){if(!_0x2c882b[_0x253fbb(0x1ed)])return _0x203455(_0x1b7fa9),await _0x59cb25(),null;const _0x120d1d=_0x551732(_0x2c882b,_0x1b7fa9,_0x353d90,{'upsert':_0x1538ce,'remove':_0x7bdc90}),_0x539008=_0x120d1d[_0x253fbb(0x148)]+_0x120d1d['changed']+_0x120d1d['removed'];_0x539008>0x0&&(_0x10dc8b+=_0x539008,await _0x59cb25());}return _0x3b2aad;}_0x203455(_0x1b7fa9??[]);if(_0x1589ee[_0x253fbb(0x1d7)]()>0x0)await _0x59cb25();return null;}async function _0x491f0c(){_0x4fa1ff=!![],await _0x373334(await _0x4e2215());}async function _0x350547(){const _0x7d666=_0x4eac58;if(!_0x4fa1ff)return;_0x4fa1ff=![],_0xf41a60(),_0x10dc8b=0x0;const _0x328d32=_0x2265b5['readCurrentId']()||_0x2265b5[_0x7d666(0x1a1)]();await _0x2f108f(_0x328d32),_0x344d08();}async function _0x2f108f(_0x500516){const _0x2b5eff=_0x4eac58;if(!_0x500516)return![];let _0xd86ef0=![];try{await _0x2265b5[_0x2b5eff(0x196)](_0x500516,async _0x5ae4db=>{const _0x3dd516=_0x2b5eff,_0x5621af=JSON[_0x3dd516(0x1a5)](_0x34fdf8['readFileSync'](_0x5ae4db[_0x3dd516(0x180)],_0x3dd516(0x1d1)));if(_0x5621af[_0x3dd516(0x14a)]!==_0x55cb33||_0x5621af[_0x3dd516(0x1cb)]!=='usearch'||_0x5621af[_0x3dd516(0x1dd)]!==_0x353d90||_0x5621af[_0x3dd516(0x1bb)]!==_0x3d096e[_0x3dd516(0x1bb)])return;const _0x4a8c02=new _0x1b8eaf();await _0x4a8c02['loadFrom'](_0x5ae4db[_0x3dd516(0x1aa)]);const _0x586b7d=_0x16ad58();_0x586b7d[_0x3dd516(0x1f5)](_0x5ae4db[_0x3dd516(0x20f)]),_0x1589ee=_0x586b7d,_0x2c882b=_0x4a8c02,_0x1ee4d9=_0x500516,_0xd86ef0=!![];});}catch{}return _0xd86ef0;}function _0x45a2e2(){const _0x90d16f=_0x4eac58,_0x4a5c77=Date[_0x90d16f(0x1d3)]();if(_0x4a5c77-_0x26a863<_0x3d096e[_0x90d16f(0x143)])return;_0x26a863=_0x4a5c77;if(_0x16d624)return;if(_0x4c44c7[_0x90d16f(0x1cf)]()){_0x16d624=!![],_0x152239(async()=>{const _0x5d96ec=_0x90d16f;!_0x4fa1ff&&_0x30625d&&_0x4c44c7[_0x5d96ec(0x1e0)]()&&(await _0x491f0c(),_0x344d08());})['catch'](()=>{})[_0x90d16f(0x20c)](()=>{_0x16d624=![];});return;}const _0x567491=_0x2265b5['readCurrentId']()||_0x2265b5[_0x90d16f(0x1a1)]();if(!_0x567491||_0x567491===_0x1ee4d9)return;_0x16d624=!![],_0x152239(async()=>{if(!_0x4fa1ff&&await _0x2f108f(_0x567491))_0x344d08();})[_0x90d16f(0x1e3)](()=>{})[_0x90d16f(0x20c)](()=>{_0x16d624=![];});}return{async 'load'(_0x2ba566){return _0x152239(async()=>{const _0x2adb2a=_0x3360;_0x2265b5['cleanupTmpDirs']({'maxAgeMs':_0x3d096e[_0x2adb2a(0x14b)]}),_0x232238=_0x2ba566??null,_0x4fa1ff=_0x4c44c7[_0x2adb2a(0x1e0)]();let _0x5097bc=null;if(_0x4fa1ff)_0x5097bc=await _0x373334(_0x2ba566?await _0x2ba566():null);else{const _0xbb28b=_0x2265b5['readCurrentId']()||_0x2265b5[_0x2adb2a(0x1a1)]();await _0x2f108f(_0xbb28b);}return _0x30625d=!![],_0x5097bc;});},async 'add'(_0x4b31de,_0x41fa76,_0x17c45c){return _0x152239(async()=>{const _0x1641a9=_0x3360;if(!_0x30625d)return;const _0x10e6b3=_0x506f22(_0x41fa76);if(!_0x4fa1ff){if(!_0x4c44c7[_0x1641a9(0x1e0)]())return;await _0x491f0c();}if(!_0x1589ee)return;const _0x1656f8=_0x600b9d(_0x10e6b3);if(_0x2c882b[_0x1641a9(0x1d2)](_0x4b31de)===_0x1656f8)return;_0x1538ce(_0x4b31de,_0x10e6b3,_0x1656f8),await _0x506b5d();});},async 'remove'(_0xd0521){return _0x152239(async()=>{const _0x40630a=_0x3360;if(!_0x30625d)return;if(!_0x4fa1ff){if(!_0x4c44c7[_0x40630a(0x1e0)]())return;await _0x491f0c();}if(!_0x1589ee)return;if(_0x7bdc90(_0xd0521))await _0x506b5d();});},'search'(_0x308c9b,{limit:limit=0xa}={}){const _0x46d4e1=_0x4eac58;if(!_0x4fa1ff&&_0x30625d)_0x45a2e2();if(!_0x1589ee)return[];const _0x1c0d6a=_0x1589ee[_0x46d4e1(0x1d7)]();if(_0x1c0d6a===0x0)return[];const _0x15bf2d=Math[_0x46d4e1(0x1be)](limit,_0x1c0d6a),_0x4625f9=_0x1589ee[_0x46d4e1(0x186)](_0x506f22(_0x308c9b),_0x15bf2d,0x0),_0x2c6acf=[],_0x5ccebc=_0x4625f9[_0x46d4e1(0x1f6)],_0xc370e2=_0x4625f9[_0x46d4e1(0x1ec)];for(let _0x2f613a=0x0;_0x2f613a<_0x5ccebc[_0x46d4e1(0x13e)];_0x2f613a++){const _0x32b79e=_0x5ccebc[_0x2f613a];if(_0x32b79e===0xffffffffffffffffn)continue;const _0x2452d0=Number(_0x32b79e),_0x1df56e=_0x2c882b[_0x46d4e1(0x15f)](_0x2452d0);if(!_0x1df56e)continue;const _0x397e38=_0xc370e2[_0x2f613a];let _0x2fdbeb;if(_0x3d096e[_0x46d4e1(0x1bb)]===_0x46d4e1(0x164))_0x2fdbeb=Math[_0x46d4e1(0x1fd)](0x0,0x1-_0x397e38);else{if(_0x3d096e[_0x46d4e1(0x1bb)]==='ip')_0x2fdbeb=-_0x397e38;else _0x2fdbeb=0x1/(0x1+_0x397e38);}_0x2c6acf['push']({'key':_0x1df56e,'score':_0x2fdbeb});}return _0x2c6acf;},async 'snapshot'(_0x1bc1c9){return _0x152239(()=>_0x4fa1ff?_0x59cb25(_0x1bc1c9??undefined):![]);},async 'rebuild'(_0x3fd021){return _0x152239(async()=>{if(_0x3fd021!=null)_0x232238=_0x3fd021;if(!_0x4fa1ff){if(!_0x4c44c7['acquire']())return;_0x4fa1ff=!![];}const _0x1d7ac2=_0x3fd021?await _0x3fd021():await _0x4e2215();_0x203455(_0x1d7ac2??[]),_0x30625d=!![],await _0x59cb25();});},async 'stop'(){return _0x152239(async()=>{const _0x2b6c8c=_0x3360;_0xf41a60();if(_0x4fa1ff){if(_0x10dc8b>0x0||!_0x2265b5[_0x2b6c8c(0x169)]())await _0x59cb25();_0x4c44c7['release']();}_0x4fa1ff=![],_0x30625d=![];});},'count'(){const _0x4f8c4c=_0x4eac58;return _0x2c882b[_0x4f8c4c(0x1d7)]();},'info'(){const _0x50d4d1=_0x4eac58;return{'algorithm':_0x50d4d1(0x1ea),'role':_0x4fa1ff?_0x50d4d1(0x1fe):_0x50d4d1(0x151),'metric':_0x3d096e['metric'],'connectivity':_0x3d096e[_0x50d4d1(0x18e)],'expansionAdd':_0x3d096e[_0x50d4d1(0x142)],'expansionSearch':_0x3d096e[_0x50d4d1(0x1a4)],'snapshotEveryChanges':_0x3d096e[_0x50d4d1(0x16c)],'snapshotMaxLagMs':_0x3d096e[_0x50d4d1(0x1da)],'count':_0x2c882b[_0x50d4d1(0x1d7)](),'size':_0x1589ee?.['size']?.()??0x0,'capacity':_0x1589ee?.[_0x50d4d1(0x17e)]?.()??0x0,'changesSince':_0x4fa1ff?_0x10dc8b:null,'viewedSnapshot':_0x1ee4d9??null,'snapshotDir':_0x148319,'latestSnapshot':_0x2265b5['readCurrentId']()??null};}};},usearch;}function _0x3360(_0x507d4c,_0x4efcc0){_0x507d4c=_0x507d4c-0x137;const _0xf898a6=_0xf898();let _0x336086=_0xf898a6[_0x507d4c];return _0x336086;}var hasRequiredAlgorithmWorkerThread;function _0xf898(){const _0x31d5a2=['state','Cos','then',').\x20','slice','_snapshotPaths','search','name','mtimeMs','efSearch','cleanupTmpDirs','\x20on\x20','changed','343425OUhjUb','connectivity','labels.json','trunc','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','set','byteOffset','message','state.json','loadSnapshot','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','remove','maxElements','rmSync','fetchAll','index.hnsw','tombstone','prune','130yzmpmq','currentPath','latestSnapshotId','writeFileSync','ENOENT','expansionSearch','parse','lock_busy','growFactor','code','getCurrentCount','labels','_tombstoneCount','markDelete','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','addPoint','info','score','keepSnapshots','dir','hasRows','ceil','usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','snapshotsDir','isDirectory','heartbeatIntervalMs','host','tombstoneCount','metric','loadFrom','filter','min','WRITER.LOCK','usearch\x20algorithm\x20requires\x20dims\x20>\x200','stringify','labelToKey','unreadable','imul','repeat','closeSync','MetricKind','sync','14307jWvVMa','Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20','algorithm','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20','isInteger','nextLabel','isFree','cause','utf8','fingerprintOf','now','opts','keyToLabel','statSync','size','writerLockMaxAgeMs','snapshotTo','snapshotMaxLagMs','push','L2sq','dims','get','round','acquire','199972QJUfql','hostname','catch','removed','number','snapshot','labelForExisting','sort','stop','usearch','map','distances','hasFingerprints','memoryUsage','node','listSnapshotIds','[SnapshotStore]','1329691SCCBHz','token','clear','view','keys','readCurrentClock','entries','key','delete','vector','join','max','writer','version','log','getMaxElements','error','snapshots','2114hBOaMP','openSync','worker_threads','HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','keyToFp','Original\x20error:\x20','postMessage','rebuild','finally','startsWith','HierarchicalNSW','index','299457guVLyq','unlinkSync','initIndex','isFinite','vectors','snapshot\x20incomplete:\x20','path','count','writeIndexSync','readIndexSync','length','fid','hasOwnProperty','setFingerprint','expansionAdd','viewRefreshMs','default','Index','_snapshotDir','setEf','added','clock','manifestVersion','tmpMaxAgeMs','4314REZsKz','F32','.tmp','for\x20Node\x20','HNSW_BINDINGS_UNAVAILABLE','reader','SnapshotStore\x20requires\x20dir','fetchAllResult','versions','prototype','randomBytes','USEARCH_BINDINGS_UNAVAILABLE','reset','from','readFileSync','321592UbeCpQ','warn','resolve','isArray','keyForLabel','buffer','hnsw','queryVec','load','cosine','hnswlib-node','add','.tmp-','sqrt','readCurrentId','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','stale','snapshotEveryChanges','pid','hex','existsSync','published','platform','trim','EEXIST','368xjBbaS','resizeIndex','lockPath','toString','readdirSync','88ZvsHIg','labelForEphemeral','publishSnapshot','efConstruction','exports','capacity','arch'];_0xf898=function(){return _0x31d5a2;};return _0xf898();}function requireAlgorithmWorkerThread(){const _0x5a9244=_0x411a8a;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x39657c,workerData:_0x2e9a2c}=require$$0$1,{algorithmName:_0x4d9990,algorithmConfig:_0x5d2978,dims:_0x47ab32,dir:_0x367ab9}=_0x2e9a2c;let _0x23ebfc=0x1;const _0x3dbc45=new Map();function _0x30f8ee(){const _0x4ca2da=_0x23ebfc++;return new Promise((_0x45cfd0,_0x2aa460)=>{const _0x5362fb=_0x3360;_0x3dbc45['set'](_0x4ca2da,{'resolve':_0x45cfd0,'reject':_0x2aa460}),_0x39657c[_0x5362fb(0x20a)]({'op':_0x5362fb(0x19b),'fid':_0x4ca2da});});}const _0x1e5994={'dims':_0x47ab32,'dir':_0x367ab9,'fetchAll':_0x30f8ee,'onChange':()=>_0x394040()};let _0x58ede8;if(_0x4d9990==='hnsw')_0x58ede8=requireHnsw()(_0x5d2978,_0x1e5994);else{if(_0x4d9990==='flat')_0x58ede8=requireFlat()(_0x5d2978,_0x1e5994);else{if(_0x4d9990==='usearch')_0x58ede8=requireUsearch()(_0x5d2978,_0x1e5994);else throw new Error('Unknown\x20algorithm:\x20\x22'+_0x4d9990+'\x22');}}function _0x394040(){const _0x2f47eb=_0x3360;try{_0x39657c[_0x2f47eb(0x20a)]({'op':_0x2f47eb(0x1c8),'count':_0x58ede8['count'](),'info':_0x58ede8['info'](),'memory':process[_0x2f47eb(0x1ee)]()});}catch{}}function _0x53cb3d(_0x2f8988){const _0x47e6a0=_0x3360;return(_0x2f8988||[])[_0x47e6a0(0x1eb)](_0x5c4ba4=>({'key':_0x5c4ba4[_0x47e6a0(0x1f9)],'vector':_0x5c4ba4[_0x47e6a0(0x1fb)]instanceof Float32Array?_0x5c4ba4[_0x47e6a0(0x1fb)]:new Float32Array(_0x5c4ba4[_0x47e6a0(0x1fb)])}));}return _0x39657c['on'](_0x5a9244(0x194),async _0x652f4b=>{const _0x4637a0=_0x5a9244;if(_0x652f4b['op']===_0x4637a0(0x153)){const _0x26d255=_0x3dbc45[_0x4637a0(0x1de)](_0x652f4b[_0x4637a0(0x13f)]);if(!_0x26d255)return;_0x3dbc45[_0x4637a0(0x1fa)](_0x652f4b[_0x4637a0(0x13f)]);if(_0x652f4b['error'])_0x26d255['reject'](new Error(_0x652f4b[_0x4637a0(0x202)]));else _0x26d255[_0x4637a0(0x15d)](_0x53cb3d(_0x652f4b[_0x4637a0(0x138)]));return;}const {id:_0x3f5885,op:_0x588d31,args:_0x354909}=_0x652f4b;try{let _0x16369b;switch(_0x588d31){case _0x4637a0(0x163):{_0x16369b=await _0x58ede8[_0x4637a0(0x163)](_0x354909[_0x4637a0(0x1b3)]?_0x30f8ee:null),_0x394040();break;}case _0x4637a0(0x166):{const _0x48cec9=_0x354909[_0x4637a0(0x1fb)]instanceof Float32Array?_0x354909['vector']:new Float32Array(_0x354909['vector']);await _0x58ede8[_0x4637a0(0x166)](_0x354909[_0x4637a0(0x1f9)],_0x48cec9,_0x354909[_0x4637a0(0x149)]??undefined),_0x394040(),_0x16369b=null;break;}case _0x4637a0(0x198):{await _0x58ede8[_0x4637a0(0x198)](_0x354909[_0x4637a0(0x1f9)]),_0x394040(),_0x16369b=null;break;}case'search':{const _0x14087a=_0x354909[_0x4637a0(0x162)]instanceof Float32Array?_0x354909[_0x4637a0(0x162)]:new Float32Array(_0x354909['queryVec']);_0x16369b=_0x58ede8[_0x4637a0(0x186)](_0x14087a,_0x354909[_0x4637a0(0x1d4)]||{});break;}case _0x4637a0(0x1e6):{_0x16369b=await _0x58ede8['snapshot'](_0x354909[_0x4637a0(0x149)]),_0x394040();break;}case'rebuild':{const _0x4ec9e3=_0x53cb3d(_0x354909[_0x4637a0(0x138)]);await _0x58ede8[_0x4637a0(0x20b)](async()=>_0x4ec9e3),_0x394040(),_0x16369b=null;break;}case _0x4637a0(0x1e9):{await _0x58ede8[_0x4637a0(0x1e9)](),_0x394040(),_0x16369b=null;break;}case'count':{_0x16369b=_0x58ede8[_0x4637a0(0x13b)]();break;}case _0x4637a0(0x1af):{_0x16369b=_0x58ede8[_0x4637a0(0x1af)]();break;}default:throw new Error('Unknown\x20op:\x20\x22'+_0x588d31+'\x22');}_0x39657c[_0x4637a0(0x20a)]({'id':_0x3f5885,'result':_0x16369b});}catch(_0x307a2d){_0x39657c[_0x4637a0(0x20a)]({'id':_0x3f5885,'error':{'message':_0x307a2d?.[_0x4637a0(0x194)]||String(_0x307a2d),'code':_0x307a2d?.[_0x4637a0(0x1a8)]}});}}),_0x39657c[_0x5a9244(0x20a)]({'op':'ready'}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module[_0x411a8a(0x17d)]=algorithmWorkerThread;
|