@kedem/okdb 2.1.2 → 2.2.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.
@@ -1 +1 @@
1
- 'use strict';const _0x4ea323=_0x1eb2;(function(_0x5c9582,_0x3acca7){const _0x47e396=_0x1eb2,_0x31e27c=_0x5c9582();while(!![]){try{const _0x4c0aa8=parseInt(_0x47e396(0x137))/0x1*(parseInt(_0x47e396(0x19a))/0x2)+-parseInt(_0x47e396(0x17d))/0x3+-parseInt(_0x47e396(0x15b))/0x4+-parseInt(_0x47e396(0x145))/0x5*(parseInt(_0x47e396(0x159))/0x6)+-parseInt(_0x47e396(0x1ce))/0x7+-parseInt(_0x47e396(0x154))/0x8+-parseInt(_0x47e396(0x18a))/0x9*(-parseInt(_0x47e396(0x17f))/0xa);if(_0x4c0aa8===_0x3acca7)break;else _0x31e27c['push'](_0x31e27c['shift']());}catch(_0x5ebd08){_0x31e27c['push'](_0x31e27c['shift']());}}}(_0x372b,0x84538));function _0x372b(){const _0x4344eb=['min','index','isDirectory','rebuild','memoryUsage','ready','keepSnapshots','viewRefreshMs','mkdirSync','writerLockMaxAgeMs','lock_busy','usearch','_tombstoneCount','Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20','initIndex','utf8','cleanupTmpDirs',',\x20host:\x20','remove','loadSnapshot','F32','call','HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','_snapshotDir','randomBytes','trunc','WRITER.LOCK','tombstone','latestSnapshotId','sort','flat','452522RgziRl','sqrt','labels','labels.json','efConstruction','set','node','sync','writeFileSync','from','lockPath','loadFrom','currentPath','keys','closeSync','prune','index.hnsw','startsWith','for\x20Node\x20','CURRENT','snapshotsDir','capacity','nextLabel','readFileSync','efSearch','expansionSearch','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20','hex','stop','isArray','isFinite','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','hnswlib-node','search','warn','join','Cos','map','path','max','1nfEvzy','delete','vectors','USEARCH_BINDINGS_UNAVAILABLE','cosine','labelToKey','candidateClock\x20must\x20be\x20finite\x20>=\x200','SnapshotStore\x20requires\x20dir','snapshot\x20id\x20required','arch','growFactor','Unknown\x20algorithm:\x20\x22','Index','readdirSync','5XircYL','connectivity','HierarchicalNSW','ceil','length','Original\x20error:\x20','resolve','algorithm','tombstoneCount','metric','info','push','then','reset','stale','2360032UydIVb','heartbeatIntervalMs','writer','queryVec','load','5719578CFBRps','view','3448444MAqVkj','distances','dir','name','code','dims','pid','rmSync','_snapshotPaths','key','getCurrentCount','labelForExisting','labelForEphemeral','get','postMessage','existsSync','publishSnapshot','clear','entries','.tmp','.tmp-','HNSW_BINDINGS_UNAVAILABLE','parse','setEf','ScalarKind','usearch\x20algorithm\x20requires\x20dims\x20>\x200','repeat','state.json','usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','toString','openSync','snapshotTo','\x20on\x20','now','1493604QKrAzl','mtimeMs','511930aljwWR','searchKnn','expansionAdd','MetricKind','Unknown\x20op:\x20\x22','unref','add','state','versions','trim','readCurrentId','387jTKayF','slice','getMaxElements','isInteger','count','readCurrentClock','markDelete','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','size','snapshot\x20incomplete:\x20','statSync','listSnapshotIds','_tmp-','stringify','platform','keyForLabel','2027202zLKOKm','clock','unlinkSync','snapshots','hnsw','message','snapshotEveryChanges','default','vector','filter','crypto','keyToLabel','published','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','tmpMaxAgeMs','cause','snapshot','log','maxElements','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','score'];_0x372b=function(){return _0x4344eb;};return _0x372b();}var require$$0$1=require('worker_threads'),require$$0=require('fs'),require$$1=require(_0x4ea323(0x135)),require$$2=require('os'),require$$3=require(_0x4ea323(0x1a4));function getDefaultExportFromCjs(_0x3da8d6){const _0x3efcd0=_0x4ea323;return _0x3da8d6&&_0x3da8d6['__esModule']&&Object['prototype']['hasOwnProperty'][_0x3efcd0(0x1c4)](_0x3da8d6,'default')?_0x3da8d6[_0x3efcd0(0x1a1)]:_0x3da8d6;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x538d47=_0x4ea323;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x3ee969=require$$0,_0x2130bc=require$$1,_0x41cf97=require$$2,_0x3272d8=require$$3;function _0x5de148(){const _0x44e2f0=_0x1eb2;return Date[_0x44e2f0(0x17c)]();}function _0x2b9f2f(_0x4951ae){const _0x4bc90a=_0x1eb2;try{return _0x3ee969[_0x4bc90a(0x16a)](_0x4951ae);}catch{return![];}}function _0x30f043(_0xf0a77b){const _0x43204=_0x1eb2;try{return _0x3ee969[_0x43204(0x1e5)](_0xf0a77b,_0x43204(0x1be));}catch{return null;}}function _0x2238c6(_0x1b927a,_0xc90e7a){const _0xd399ec=_0x1eb2,_0x35d0a2=_0x1b927a+'.tmp-'+_0x3272d8['randomBytes'](0x6)['toString'](_0xd399ec(0x1e9));_0x3ee969['writeFileSync'](_0x35d0a2,_0xc90e7a),_0x3ee969['renameSync'](_0x35d0a2,_0x1b927a);}function _0x3a164d(_0x5580fb,_0x25149f=0x10){const _0x53c907=_0x1eb2,_0xe0ab4b=String(Math[_0x53c907(0x136)](0x0,Math['trunc'](_0x5580fb||0x0)));return _0xe0ab4b[_0x53c907(0x149)]>=_0x25149f?_0xe0ab4b:'0'[_0x53c907(0x175)](_0x25149f-_0xe0ab4b[_0x53c907(0x149)])+_0xe0ab4b;}return snapshotStore=class _0x6cdb84{constructor({dir:_0x2a5e30,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x2f2421=_0x1eb2;if(!_0x2a5e30)throw new Error(_0x2f2421(0x13e));this[_0x2f2421(0x15d)]=_0x2a5e30,this[_0x2f2421(0x1e2)]=_0x2130bc[_0x2f2421(0x1f1)](_0x2a5e30,_0x2f2421(0x19d)),this[_0x2f2421(0x1da)]=_0x2130bc[_0x2f2421(0x1f1)](_0x2a5e30,_0x2f2421(0x1e1)),this[_0x2f2421(0x1d8)]=_0x2130bc['join'](_0x2a5e30,'SNAPSHOT.LOCK'),this['keepSnapshots']=keepSnapshots,this['log']=log,_0x3ee969[_0x2f2421(0x1b7)](this[_0x2f2421(0x15d)],{'recursive':!![]}),_0x3ee969[_0x2f2421(0x1b7)](this['snapshotsDir'],{'recursive':!![]});}[_0x538d47(0x1c6)](_0xbb1bcc){const _0x245590=_0x538d47;return _0x2130bc[_0x245590(0x1f1)](this['snapshotsDir'],_0xbb1bcc);}[_0x538d47(0x163)](_0x32a987){const _0xd2bbdc=_0x538d47,_0x3980d9=this[_0xd2bbdc(0x1c6)](_0x32a987);return{'dir':_0x3980d9,'index':_0x2130bc['join'](_0x3980d9,_0xd2bbdc(0x1de)),'labels':_0x2130bc[_0xd2bbdc(0x1f1)](_0x3980d9,_0xd2bbdc(0x1d1)),'state':_0x2130bc[_0xd2bbdc(0x1f1)](_0x3980d9,'state.json')};}[_0x538d47(0x189)](){const _0x4172a4=_0x538d47;if(!_0x2b9f2f(this[_0x4172a4(0x1da)]))return null;const _0x4b70f3=_0x30f043(this[_0x4172a4(0x1da)]);if(!_0x4b70f3)return null;const _0x438879=String(_0x4b70f3)[_0x4172a4(0x188)]();return _0x438879||null;}[_0x538d47(0x18f)](){const _0x476226=_0x538d47,_0x4d75cf=this[_0x476226(0x189)]();if(!_0x4d75cf)return 0x0;const _0x40598d=Number(_0x4d75cf);return Number['isFinite'](_0x40598d)?_0x40598d:0x0;}[_0x538d47(0x195)](){const _0x9a8300=_0x538d47;try{return _0x3ee969[_0x9a8300(0x144)](this[_0x9a8300(0x1e2)],{'withFileTypes':!![]})[_0x9a8300(0x1a3)](_0x22e8a0=>_0x22e8a0[_0x9a8300(0x1b1)]())[_0x9a8300(0x134)](_0x4059a7=>_0x4059a7[_0x9a8300(0x15e)])['filter'](_0x2a54bd=>!_0x2a54bd['startsWith'](_0x9a8300(0x16f)))[_0x9a8300(0x1a3)](_0x8cb1e5=>!_0x8cb1e5[_0x9a8300(0x1df)]('_tmp-'))[_0x9a8300(0x1cc)]();}catch{return[];}}[_0x538d47(0x1cb)](){const _0x5424f3=_0x538d47,_0x2fd4a9=this[_0x5424f3(0x189)]();if(_0x2fd4a9)return _0x2fd4a9;const _0x5ae22e=this[_0x5424f3(0x195)]();if(!_0x5ae22e['length'])return null;return _0x5ae22e[_0x5ae22e[_0x5424f3(0x149)]-0x1];}[_0x538d47(0x1bf)]({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x1249ff=_0x538d47;let _0xddb498;try{_0xddb498=_0x3ee969[_0x1249ff(0x144)](this[_0x1249ff(0x1e2)],{'withFileTypes':!![]});}catch{return;}const _0x81bdaf=_0x5de148()-maxAgeMs;for(const _0x41476c of _0xddb498){if(!_0x41476c['isDirectory']())continue;const _0x3b8cfb=_0x41476c[_0x1249ff(0x15e)];if(!_0x3b8cfb[_0x1249ff(0x1df)](_0x1249ff(0x16f))&&!_0x3b8cfb[_0x1249ff(0x1df)](_0x1249ff(0x196)))continue;const _0x106e45=_0x2130bc[_0x1249ff(0x1f1)](this[_0x1249ff(0x1e2)],_0x3b8cfb);try{const _0x35182c=_0x3ee969[_0x1249ff(0x194)](_0x106e45);if(_0x35182c[_0x1249ff(0x17e)]>_0x81bdaf)continue;}catch{}try{_0x3ee969[_0x1249ff(0x162)](_0x106e45,{'recursive':!![],'force':!![]});}catch{}}}['prune']({keep:keep=null}={}){const _0x1df731=_0x538d47,_0x2b54b4=Math[_0x1df731(0x136)](0x1,Math[_0x1df731(0x1c8)](keep??this[_0x1df731(0x1b5)]??0x3)),_0xb44e89=this[_0x1df731(0x195)]();if(_0xb44e89[_0x1df731(0x149)]<=_0x2b54b4)return;const _0x81e2e6=this[_0x1df731(0x189)](),_0x1f152d=_0xb44e89[_0x1df731(0x18b)](0x0,Math[_0x1df731(0x136)](0x0,_0xb44e89['length']-_0x2b54b4));for(const _0x17876d of _0x1f152d){if(_0x81e2e6&&_0x17876d===_0x81e2e6)continue;const _0x48b13e=this[_0x1df731(0x1c6)](_0x17876d);try{_0x3ee969[_0x1df731(0x162)](_0x48b13e,{'recursive':!![],'force':!![]});}catch{}}}async[_0x538d47(0x1c2)](_0x1824a4,_0x22e76d){const _0x2eaf81=_0x538d47;if(!_0x1824a4)throw new Error(_0x2eaf81(0x13f));const _0x394930=this[_0x2eaf81(0x163)](_0x1824a4);if(!_0x2b9f2f(_0x394930[_0x2eaf81(0x1b0)])||!_0x2b9f2f(_0x394930[_0x2eaf81(0x1d0)])||!_0x2b9f2f(_0x394930[_0x2eaf81(0x186)]))throw new Error(_0x2eaf81(0x193)+_0x1824a4);const _0x1dd040=await _0x22e76d(_0x394930);return _0x1dd040||{};}async['publishSnapshot'](_0x475622,_0x55f893,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x38e9a4=_0x538d47,_0x2ef018=Number(_0x475622);if(!Number[_0x38e9a4(0x1ec)](_0x2ef018)||_0x2ef018<0x0)throw new Error(_0x38e9a4(0x13d));const _0x497dbf=_0x3a164d(_0x2ef018),_0xcda8d6=this['_snapshotDir'](_0x497dbf),_0x172dca=_0x2130bc[_0x38e9a4(0x1f1)](this[_0x38e9a4(0x1e2)],_0x38e9a4(0x16f)+_0x497dbf+'-'+_0x3272d8[_0x38e9a4(0x1c7)](0x6)[_0x38e9a4(0x178)](_0x38e9a4(0x1e9)));_0x3ee969[_0x38e9a4(0x1b7)](_0x172dca,{'recursive':!![]});const _0x4a90db={'dir':_0x172dca,'index':_0x2130bc[_0x38e9a4(0x1f1)](_0x172dca,_0x38e9a4(0x1de)),'labels':_0x2130bc[_0x38e9a4(0x1f1)](_0x172dca,_0x38e9a4(0x1d1)),'state':_0x2130bc['join'](_0x172dca,_0x38e9a4(0x176))};await _0x55f893(_0x4a90db,{'id':_0x497dbf,'clock':_0x2ef018});const _0x837b74=JSON[_0x38e9a4(0x197)]({'pid':process[_0x38e9a4(0x161)],'host':_0x41cf97['hostname'](),'at':_0x5de148()}),_0x4af2fc=_0x5de148();let _0x2e5191=null;const _0x931019=()=>{const _0x4b4594=_0x38e9a4;try{const _0x2926db=JSON[_0x4b4594(0x171)](_0x3ee969['readFileSync'](this[_0x4b4594(0x1d8)],_0x4b4594(0x1be)));if(_0x2926db['at']&&_0x5de148()-_0x2926db['at']>staleLockMaxAgeMs){const _0x5f3b00=_0x5de148()-_0x2926db['at'],_0x42557b=_0x4b4594(0x1bc)+Math['round'](_0x5f3b00/0x3e8)+'s,\x20pid:\x20'+_0x2926db[_0x4b4594(0x161)]+_0x4b4594(0x1c0)+_0x2926db['host']+').\x20'+_0x4b4594(0x191);this[_0x4b4594(0x1ab)]?.[_0x4b4594(0x1f0)]?this[_0x4b4594(0x1ab)][_0x4b4594(0x1f0)](_0x42557b):console[_0x4b4594(0x1f0)]('[SnapshotStore]',_0x42557b);try{_0x3ee969['unlinkSync'](this['lockPath']);}catch{}return!![];}}catch{try{_0x3ee969['unlinkSync'](this[_0x4b4594(0x1d8)]);}catch{}}return![];},_0x5c6d3a=()=>{const _0x47c7bc=_0x38e9a4;try{return _0x2e5191=_0x3ee969['openSync'](this[_0x47c7bc(0x1d8)],'wx'),_0x3ee969[_0x47c7bc(0x1d6)](_0x2e5191,_0x837b74),!![];}catch(_0x3e19a4){if(_0x3e19a4&&_0x3e19a4[_0x47c7bc(0x15f)]==='EEXIST')return![];throw _0x3e19a4;}};if(!_0x5c6d3a()){_0x931019(),_0x5c6d3a();if(_0x2e5191==null&&lockTimeoutMs>0x0)while(_0x5de148()-_0x4af2fc<lockTimeoutMs){await new Promise(_0x1a9d8e=>setTimeout(_0x1a9d8e,0x19));if(_0x5c6d3a())break;_0x931019();}}if(_0x2e5191==null){try{_0x3ee969[_0x38e9a4(0x162)](_0x172dca,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x38e9a4(0x1b9)};}try{const _0x5d1017=this[_0x38e9a4(0x18f)]();if(_0x2ef018<=_0x5d1017){try{_0x3ee969[_0x38e9a4(0x162)](_0x172dca,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x38e9a4(0x153),'currentClock':_0x5d1017};}if(!_0x2b9f2f(_0xcda8d6))_0x3ee969['renameSync'](_0x172dca,_0xcda8d6);else try{_0x3ee969['rmSync'](_0x172dca,{'recursive':!![],'force':!![]});}catch{}return _0x2238c6(this['currentPath'],_0x497dbf+'\x0a'),this[_0x38e9a4(0x1dd)]({'keep':keep}),{'published':!![],'currentClock':_0x2ef018};}finally{try{_0x3ee969[_0x38e9a4(0x1dc)](_0x2e5191);}catch{}try{_0x3ee969[_0x38e9a4(0x19c)](this['lockPath']);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x12626a=_0x4ea323;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x490b9c=require$$0;class _0x25342a{constructor(){const _0x226539=_0x1eb2;this[_0x226539(0x1a5)]=new Map(),this[_0x226539(0x13c)]=new Map(),this[_0x226539(0x1e4)]=0x0,this[_0x226539(0x1bb)]=0x0;}async[_0x12626a(0x152)](){const _0x56fafe=_0x12626a;this['keyToLabel']=new Map(),this[_0x56fafe(0x13c)]=new Map(),this[_0x56fafe(0x1e4)]=0x0,this[_0x56fafe(0x1bb)]=0x0;}async['loadFrom'](_0x21fc47){const _0x43836b=_0x12626a;if(!_0x21fc47||!_0x490b9c[_0x43836b(0x16a)](_0x21fc47))return await this['reset'](),!![];let _0x4726da;try{_0x4726da=_0x490b9c['readFileSync'](_0x21fc47,_0x43836b(0x1be));}catch{return await this['reset'](),!![];}let _0x3bb6c7;try{_0x3bb6c7=JSON[_0x43836b(0x171)](_0x4726da);}catch{return await this[_0x43836b(0x152)](),!![];}const _0x84cd95=Array[_0x43836b(0x1eb)](_0x3bb6c7?.['entries'])?_0x3bb6c7[_0x43836b(0x16d)]:[],_0x2709c1=Number[_0x43836b(0x18d)](_0x3bb6c7?.[_0x43836b(0x1e4)])?_0x3bb6c7['nextLabel']:0x0,_0x1d85ba=new Map(),_0x31d5a1=new Map();let _0x46dac4=-0x1;for(const _0x2c51f3 of _0x84cd95){if(!Array[_0x43836b(0x1eb)](_0x2c51f3)||_0x2c51f3[_0x43836b(0x149)]!==0x2)continue;const _0x59898b=Number(_0x2c51f3[0x0]),_0x757519=String(_0x2c51f3[0x1]??'');if(!Number[_0x43836b(0x18d)](_0x59898b)||_0x59898b<0x0)continue;if(!_0x757519)continue;_0x1d85ba['set'](_0x757519,_0x59898b),_0x31d5a1[_0x43836b(0x1d3)](_0x59898b,_0x757519);if(_0x59898b>_0x46dac4)_0x46dac4=_0x59898b;}return this[_0x43836b(0x1a5)]=_0x1d85ba,this[_0x43836b(0x13c)]=_0x31d5a1,this[_0x43836b(0x1e4)]=Math['max'](_0x2709c1,_0x46dac4+0x1,0x0),this['_tombstoneCount']=0x0,!![];}[_0x12626a(0x166)](_0x228ba2){const _0x506a3f=_0x12626a;return this[_0x506a3f(0x1a5)][_0x506a3f(0x168)](_0x228ba2);}[_0x12626a(0x167)](_0x444c24){const _0x447f63=_0x12626a;let _0x17510e=this[_0x447f63(0x1a5)][_0x447f63(0x168)](_0x444c24);if(_0x17510e!==undefined)return _0x17510e;return _0x17510e=this[_0x447f63(0x1e4)]++,this['keyToLabel']['set'](_0x444c24,_0x17510e),this[_0x447f63(0x13c)][_0x447f63(0x1d3)](_0x17510e,_0x444c24),_0x17510e;}[_0x12626a(0x1ca)](_0x21fa5f){const _0x134314=_0x12626a,_0x45bb07=this[_0x134314(0x1a5)][_0x134314(0x168)](_0x21fa5f);if(_0x45bb07===undefined)return;this[_0x134314(0x1a5)][_0x134314(0x138)](_0x21fa5f),this['labelToKey']['delete'](_0x45bb07),this[_0x134314(0x1bb)]++;}[_0x12626a(0x199)](_0x5f0544){const _0x422631=_0x12626a;return this[_0x422631(0x13c)]['get'](_0x5f0544)??null;}[_0x12626a(0x192)](){const _0x4ba32d=_0x12626a;return this[_0x4ba32d(0x1a5)][_0x4ba32d(0x192)];}[_0x12626a(0x14d)](){return this['_tombstoneCount'];}async[_0x12626a(0x17a)](_0x1ff704){const _0x54dc9a=_0x12626a,_0x13fbe1=_0x1ff704+_0x54dc9a(0x16e),_0x49c69e=[];for(const [_0xb6a581,_0x433436]of this[_0x54dc9a(0x13c)][_0x54dc9a(0x16d)]()){_0x49c69e[_0x54dc9a(0x150)]([_0xb6a581,_0x433436]);}_0x49c69e[_0x54dc9a(0x1cc)]((_0x106296,_0x24befd)=>_0x106296[0x0]-_0x24befd[0x0]);const _0x3ef6c9={'version':0x1,'nextLabel':this['nextLabel'],'entries':_0x49c69e};_0x490b9c[_0x54dc9a(0x1d6)](_0x13fbe1,JSON[_0x54dc9a(0x197)](_0x3ef6c9)),_0x490b9c['renameSync'](_0x13fbe1,_0x1ff704);}}return labelMap=_0x25342a,labelMap;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x25af06=requireSnapshotStore(),_0x2d933e=requireLabelMap(),_0x5a3e30=0x1;let _0x3a6af7=null;function _0x2dd5c8(){const _0xd3a3ac=_0x1eb2;if(_0x3a6af7)return _0x3a6af7;try{return _0x3a6af7=require(_0xd3a3ac(0x1ee)),_0x3a6af7;}catch(_0x57a455){const _0x373fdf=new Error(_0xd3a3ac(0x1c5)+(_0xd3a3ac(0x1e0)+process[_0xd3a3ac(0x187)][_0xd3a3ac(0x1d4)]+_0xd3a3ac(0x17b)+process[_0xd3a3ac(0x198)]+'/'+process['arch']+'.\x20')+_0xd3a3ac(0x1e8)+('Original\x20error:\x20'+(_0x57a455?.['message']||String(_0x57a455))));_0x373fdf['code']=_0xd3a3ac(0x170),_0x373fdf[_0xd3a3ac(0x1a9)]=_0x57a455;throw _0x373fdf;}}return hnsw=function _0x26ba16(_0x4bf6e4={},{dims:_0x287c47,dir:_0x300dd3}){const _0x5cfeec=_0x1eb2,_0x3cd347=_0x2dd5c8();if(!_0x287c47||_0x287c47<=0x0)throw new Error(_0x5cfeec(0x1ed));if(!_0x300dd3)throw new Error(_0x5cfeec(0x1ad));const _0x10266f={'metric':_0x4bf6e4[_0x5cfeec(0x14e)]??_0x5cfeec(0x13b),'M':_0x4bf6e4['M']??0x10,'efConstruction':_0x4bf6e4[_0x5cfeec(0x1d2)]??0xc8,'efSearch':_0x4bf6e4['efSearch']??0x40,'maxElements':_0x4bf6e4[_0x5cfeec(0x1ac)]??0x400,'growFactor':_0x4bf6e4[_0x5cfeec(0x141)]??0x2,'snapshotEveryChanges':_0x4bf6e4[_0x5cfeec(0x1a0)]??0xc350,'keepSnapshots':_0x4bf6e4['keepSnapshots']??0x2,'tmpMaxAgeMs':_0x4bf6e4[_0x5cfeec(0x1a8)]??0x6*0x36ee80},_0x1fb9e0=new _0x25af06({'dir':_0x300dd3,'keepSnapshots':_0x10266f[_0x5cfeec(0x1b5)]}),_0x4185a9=new _0x2d933e();let _0x25dad9=null,_0x2e4f0c=0x0,_0xbb1945=null,_0x31bab1=Promise[_0x5cfeec(0x14b)]();const _0x459065=_0xaa9a37=>{const _0x2709ea=_0x5cfeec;return _0x31bab1=_0x31bab1[_0x2709ea(0x151)](_0xaa9a37),_0x31bab1;};async function _0x58a19d(_0x4db443){const _0x3d0a3d=_0x5cfeec;await _0x4185a9['reset']();const _0x4af788=_0x4db443?await _0x4db443():[],_0x2ed9a3=Math[_0x3d0a3d(0x136)](_0x10266f[_0x3d0a3d(0x1ac)],Math['ceil'](_0x4af788['length']*(_0x10266f[_0x3d0a3d(0x141)]||1.2)),0x1);_0x25dad9=new _0x3cd347[(_0x3d0a3d(0x147))](_0x10266f['metric'],_0x287c47),_0x25dad9[_0x3d0a3d(0x1bd)]({'maxElements':_0x2ed9a3,'efConstruction':_0x10266f['efConstruction'],'M':_0x10266f['M']});for(const {key:_0x33f418,vector:_0x57abdb}of _0x4af788){if(!(_0x57abdb instanceof Float32Array)||_0x57abdb[_0x3d0a3d(0x149)]!==_0x287c47)continue;const _0xc93291=_0x4185a9[_0x3d0a3d(0x167)](_0x33f418);_0x25dad9['addPoint'](Array[_0x3d0a3d(0x1d7)](_0x57abdb),_0xc93291);}_0x25dad9[_0x3d0a3d(0x172)](_0x10266f[_0x3d0a3d(0x1e6)]),_0x2e4f0c=0x0;}async function _0x259199(_0x44349c){const _0x374416=_0x5cfeec;if(!_0x25dad9||!_0x44349c)return![];const _0x20a981=await _0x1fb9e0[_0x374416(0x16b)](_0x44349c,async _0x4dbce5=>{const _0x47508d=_0x374416;_0x25dad9['writeIndexSync'](_0x4dbce5[_0x47508d(0x1b0)]),await _0x4185a9[_0x47508d(0x17a)](_0x4dbce5['labels']);const _0x245a13=require$$0;_0x245a13[_0x47508d(0x1d6)](_0x4dbce5['state'],JSON[_0x47508d(0x197)]({'manifestVersion':_0x5a3e30,'dims':_0x287c47,'metric':_0x10266f[_0x47508d(0x14e)],'clock':_0x44349c,'snapshotAt':Date['now']()},null,0x2));},{'keep':_0x10266f[_0x374416(0x1b5)]});if(_0x20a981?.['published'])_0x2e4f0c=0x0;return _0x20a981?.[_0x374416(0x1a6)]??![];}async function _0x2dd110(){const _0x16f0eb=_0x5cfeec,_0x4e8f39=_0x1fb9e0['readCurrentId']()||_0x1fb9e0[_0x16f0eb(0x1cb)]();if(!_0x4e8f39)return null;let _0x17da4a,_0x3a459c=![];return await _0x1fb9e0[_0x16f0eb(0x1c2)](_0x4e8f39,async _0x2878d6=>{const _0x5b90be=_0x16f0eb,_0x1103d1=require$$0;_0x17da4a=JSON['parse'](_0x1103d1[_0x5b90be(0x1e5)](_0x2878d6[_0x5b90be(0x186)],'utf8'));if(_0x17da4a['manifestVersion']!==_0x5a3e30||_0x17da4a[_0x5b90be(0x160)]!==_0x287c47||_0x17da4a[_0x5b90be(0x14e)]!==_0x10266f[_0x5b90be(0x14e)]){_0x17da4a=null;return;}await _0x4185a9['loadFrom'](_0x2878d6[_0x5b90be(0x1d0)]),_0x25dad9=new _0x3cd347[(_0x5b90be(0x147))](_0x10266f[_0x5b90be(0x14e)],_0x287c47),_0x25dad9['readIndexSync'](_0x2878d6[_0x5b90be(0x1b0)]),_0x25dad9[_0x5b90be(0x172)](_0x10266f[_0x5b90be(0x1e6)]),_0x3a459c=!![];}),_0x3a459c?_0x17da4a?.[_0x16f0eb(0x19b)]??0x0:null;}return{async 'load'(_0x349aeb){return _0x459065(async()=>{const _0x56c441=_0x1eb2;_0x1fb9e0[_0x56c441(0x1bf)]({'maxAgeMs':_0x10266f[_0x56c441(0x1a8)]}),_0xbb1945=_0x349aeb??null;const _0x52adb8=await _0x2dd110();if(_0x52adb8!=null)return _0x52adb8;return await _0x58a19d(_0x349aeb),null;});},async 'add'(_0x198f63,_0xdf241d,_0x23db45){return _0x459065(async()=>{const _0x3f7fee=_0x1eb2;if(!_0x25dad9)return;const _0x204b0a=_0x4185a9[_0x3f7fee(0x167)](_0x198f63);try{_0x25dad9[_0x3f7fee(0x190)](_0x204b0a);}catch{}_0x25dad9['getCurrentCount']()>=_0x25dad9['getMaxElements']()&&(_0x10266f['maxElements']=Math[_0x3f7fee(0x148)](_0x25dad9[_0x3f7fee(0x18c)]()*(_0x10266f[_0x3f7fee(0x141)]||0x2)),await _0x58a19d(_0xbb1945)),_0x25dad9['addPoint'](Array['from'](_0xdf241d),_0x204b0a),_0x2e4f0c++,_0x2e4f0c>=_0x10266f[_0x3f7fee(0x1a0)]&&await _0x259199(_0x23db45??Date[_0x3f7fee(0x17c)]());});},async 'remove'(_0x1859a7){return _0x459065(async()=>{const _0x40f199=_0x1eb2;if(!_0x25dad9)return;const _0x335acd=_0x4185a9[_0x40f199(0x166)](_0x1859a7);if(_0x335acd===undefined)return;try{_0x25dad9[_0x40f199(0x190)](_0x335acd);}catch{}_0x4185a9[_0x40f199(0x1ca)](_0x1859a7),_0x2e4f0c++;});},'search'(_0x40eb60,{limit:limit=0xa,efSearch:_0x12b6b6}={}){const _0x3653f9=_0x5cfeec;if(!_0x25dad9)return[];if(Number[_0x3653f9(0x18d)](_0x12b6b6))_0x25dad9[_0x3653f9(0x172)](_0x12b6b6);const _0x269e36=Math[_0x3653f9(0x1af)](limit,_0x25dad9[_0x3653f9(0x165)]()||0x1),{neighbors:_0x1735b5,distances:_0x33ef1a}=_0x25dad9[_0x3653f9(0x180)](Array['from'](_0x40eb60),_0x269e36),_0x9d88b9=[];for(let _0x4ef37f=0x0;_0x4ef37f<_0x1735b5[_0x3653f9(0x149)];_0x4ef37f++){const _0x5f0d45=_0x4185a9[_0x3653f9(0x199)](_0x1735b5[_0x4ef37f]);if(!_0x5f0d45)continue;const _0x217fe5=_0x10266f[_0x3653f9(0x14e)]==='cosine'?Math[_0x3653f9(0x136)](0x0,0x1-_0x33ef1a[_0x4ef37f]):0x1/(0x1+_0x33ef1a[_0x4ef37f]);_0x9d88b9[_0x3653f9(0x150)]({'key':_0x5f0d45,'score':_0x217fe5});}return _0x9d88b9;},async 'snapshot'(_0x2a29bd=Date[_0x5cfeec(0x17c)]()){return _0x459065(()=>_0x259199(_0x2a29bd));},async 'rebuild'(_0x3bd0f4){return _0x459065(()=>{if(_0x3bd0f4!=null)_0xbb1945=_0x3bd0f4;return _0x58a19d(_0x3bd0f4??_0xbb1945);});},async 'stop'(){const _0x51737e=_0x5cfeec;return _0x459065(()=>_0x259199(Date[_0x51737e(0x17c)]()));},'count'(){const _0x423eb2=_0x5cfeec;return _0x4185a9[_0x423eb2(0x192)]();},'info'(){const _0x326c97=_0x5cfeec;return{'algorithm':_0x326c97(0x19e),'metric':_0x10266f[_0x326c97(0x14e)],'M':_0x10266f['M'],'efConstruction':_0x10266f[_0x326c97(0x1d2)],'efSearch':_0x10266f[_0x326c97(0x1e6)],'maxElements':_0x25dad9?.['getMaxElements']()??_0x10266f[_0x326c97(0x1ac)],'count':_0x4185a9[_0x326c97(0x192)](),'changesSince':_0x2e4f0c,'snapshotDir':_0x300dd3,'latestSnapshot':_0x1fb9e0[_0x326c97(0x189)]()??null};}};},hnsw;}function _0x1eb2(_0x3727a6,_0x27f81d){_0x3727a6=_0x3727a6-0x134;const _0x372b61=_0x372b();let _0x1eb2c7=_0x372b61[_0x3727a6];return _0x1eb2c7;}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x2c7fe5(_0x121e57={}){const _0x929b39=new Map();return{async 'load'(_0xe7864b){const _0x934888=_0x1eb2;_0x929b39[_0x934888(0x16c)]();if(_0xe7864b)for(const {key:_0x1fa720,vector:_0x540f89}of await _0xe7864b()){_0x929b39[_0x934888(0x1d3)](_0x1fa720,_0x540f89);}},async 'add'(_0x57cc58,_0x1d1011,_0x5a6407){const _0x341b45=_0x1eb2;_0x929b39[_0x341b45(0x1d3)](_0x57cc58,_0x1d1011);},async 'remove'(_0x18c893){const _0x597c59=_0x1eb2;_0x929b39[_0x597c59(0x138)](_0x18c893);},'search'(_0x4efed1,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x19ec01=_0x1eb2,_0xedfbd1=[];for(const [_0x31b033,_0x3bf2e]of _0x929b39){const _0x43002f=_0x25710d(_0x4efed1,_0x3bf2e);if(_0x43002f>=threshold)_0xedfbd1[_0x19ec01(0x150)]({'key':_0x31b033,'score':_0x43002f});}return _0xedfbd1['sort']((_0x5a0014,_0x43e846)=>_0x43e846[_0x19ec01(0x1ae)]-_0x5a0014[_0x19ec01(0x1ae)]),_0xedfbd1[_0x19ec01(0x18b)](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x105f0e){await this['load'](_0x105f0e);},async 'stop'(){},'count'(){const _0x2dad9b=_0x1eb2;return _0x929b39[_0x2dad9b(0x192)];},'info'(){const _0x48c867=_0x1eb2;return{'algorithm':_0x48c867(0x1cd),'count':_0x929b39[_0x48c867(0x192)]};}};};function _0x25710d(_0x3159f5,_0x5589af){const _0x2b9d5e=_0x1eb2;let _0x35a137=0x0,_0x4c911f=0x0,_0x16546f=0x0;for(let _0x4f3936=0x0;_0x4f3936<_0x3159f5[_0x2b9d5e(0x149)];_0x4f3936++){_0x35a137+=_0x3159f5[_0x4f3936]*_0x5589af[_0x4f3936],_0x4c911f+=_0x3159f5[_0x4f3936]*_0x3159f5[_0x4f3936],_0x16546f+=_0x5589af[_0x4f3936]*_0x5589af[_0x4f3936];}const _0x57b7ab=Math[_0x2b9d5e(0x1cf)](_0x4c911f)*Math['sqrt'](_0x16546f);return _0x57b7ab===0x0?0x0:_0x35a137/_0x57b7ab;}return flat;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x25345d=require$$0,_0x3f4e78=require$$1,_0x3d4d6f=requireSnapshotStore(),_0x519845=requireLabelMap(),_0x2ed3c7=0x1;let _0x460068=null;function _0x35d644(){const _0x2b879c=_0x1eb2;if(_0x460068)return _0x460068;try{return _0x460068=require(_0x2b879c(0x1ba)),_0x460068;}catch(_0x1c11cc){const _0x385249=new Error(_0x2b879c(0x1a7)+('for\x20Node\x20'+process['versions'][_0x2b879c(0x1d4)]+_0x2b879c(0x17b)+process[_0x2b879c(0x198)]+'/'+process[_0x2b879c(0x140)]+'.\x20')+'Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20'+(_0x2b879c(0x14a)+(_0x1c11cc?.['message']||String(_0x1c11cc))));_0x385249[_0x2b879c(0x15f)]=_0x2b879c(0x13a),_0x385249['cause']=_0x1c11cc;throw _0x385249;}}function _0xc1fbaa(_0x2f339a,_0x59c97e){const _0x5008f9=_0x1eb2;switch(_0x2f339a){case _0x5008f9(0x13b):return _0x59c97e[_0x5008f9(0x182)][_0x5008f9(0x1f2)];case'l2':return _0x59c97e[_0x5008f9(0x182)]['L2sq'];case'ip':return _0x59c97e[_0x5008f9(0x182)]['IP'];default:return _0x59c97e['MetricKind'][_0x5008f9(0x1f2)];}}return usearch=function _0x5da9e5(_0x53c512={},{dims:_0x41be7d,dir:_0x43b6a5}){const _0x5e39ab=_0x1eb2,_0x2eb8cf=_0x35d644();if(!_0x41be7d||_0x41be7d<=0x0)throw new Error(_0x5e39ab(0x174));if(!_0x43b6a5)throw new Error(_0x5e39ab(0x177));const _0x535bc6={'metric':_0x53c512[_0x5e39ab(0x14e)]??'cosine','connectivity':_0x53c512['connectivity']??0x10,'expansionAdd':_0x53c512[_0x5e39ab(0x181)]??0x80,'expansionSearch':_0x53c512[_0x5e39ab(0x1e7)]??0x40,'snapshotEveryChanges':_0x53c512[_0x5e39ab(0x1a0)]??0xc350,'keepSnapshots':_0x53c512[_0x5e39ab(0x1b5)]??0x2,'tmpMaxAgeMs':_0x53c512[_0x5e39ab(0x1a8)]??0x6*0x36ee80,'heartbeatIntervalMs':_0x53c512[_0x5e39ab(0x155)]??0x1388,'writerLockMaxAgeMs':_0x53c512[_0x5e39ab(0x1b8)]??0x3a98,'viewRefreshMs':_0x53c512[_0x5e39ab(0x1b6)]??0x3e8},_0x4dea6e=new _0x3d4d6f({'dir':_0x43b6a5,'keepSnapshots':_0x535bc6[_0x5e39ab(0x1b5)]}),_0x1a30bc=_0x3f4e78[_0x5e39ab(0x1f1)](_0x43b6a5,_0x5e39ab(0x1c9));let _0x17c596=new _0x519845(),_0x2b914f=null,_0x500d9a=0x0,_0x107086=null,_0x367a06=![],_0xd113a5=null,_0x27c135=null,_0x2aff3d=0x0,_0x4d2c1e=![],_0x3e90ab=Promise[_0x5e39ab(0x14b)]();const _0x1401be=_0x578963=>{const _0x41840b=_0x5e39ab;return _0x3e90ab=_0x3e90ab[_0x41840b(0x151)](_0x578963),_0x3e90ab;};function _0x53473f(){const _0x4fadb2=_0x5e39ab;return new _0x2eb8cf[(_0x4fadb2(0x143))]({'dimensions':_0x41be7d,'metric':_0xc1fbaa(_0x535bc6[_0x4fadb2(0x14e)],_0x2eb8cf),'quantization':_0x2eb8cf[_0x4fadb2(0x173)][_0x4fadb2(0x1c3)],'connectivity':_0x535bc6[_0x4fadb2(0x146)],'expansion_add':_0x535bc6['expansionAdd'],'expansion_search':_0x535bc6[_0x4fadb2(0x1e7)],'multi':![]});}function _0x2dc5fe(_0x34f141){return _0x34f141 instanceof Float32Array?_0x34f141:new Float32Array(_0x34f141);}function _0x5ec6b7(){const _0x1a4b4b=_0x5e39ab,_0x2bebd5=JSON['stringify']({'pid':process[_0x1a4b4b(0x161)],'at':Date[_0x1a4b4b(0x17c)]()}),_0x590ffb=()=>{const _0x57446b=_0x1a4b4b;try{const _0x4803c2=_0x25345d[_0x57446b(0x179)](_0x1a30bc,'wx');return _0x25345d['writeFileSync'](_0x4803c2,_0x2bebd5),_0x25345d['closeSync'](_0x4803c2),!![];}catch(_0x148568){if(_0x148568?.[_0x57446b(0x15f)]==='EEXIST')return![];throw _0x148568;}};if(_0x590ffb())return!![];try{const _0x185fb9=JSON[_0x1a4b4b(0x171)](_0x25345d[_0x1a4b4b(0x1e5)](_0x1a30bc,_0x1a4b4b(0x1be))),_0x121b8e=Date['now']()-(_0x185fb9['at']??0x0);if(_0x121b8e<_0x535bc6[_0x1a4b4b(0x1b8)])return![];}catch{}try{_0x25345d[_0x1a4b4b(0x19c)](_0x1a30bc);}catch{}return _0x590ffb();}function _0x31db7a(){const _0x86f41a=_0x5e39ab;if(_0xd113a5)clearInterval(_0xd113a5);_0xd113a5=setInterval(()=>{const _0x362dd5=_0x1eb2;try{_0x25345d[_0x362dd5(0x1d6)](_0x1a30bc,JSON['stringify']({'pid':process[_0x362dd5(0x161)],'at':Date['now']()}));}catch{}},_0x535bc6['heartbeatIntervalMs']),_0xd113a5[_0x86f41a(0x184)]();}function _0x583338(){const _0x3380fd=_0x5e39ab;_0xd113a5&&(clearInterval(_0xd113a5),_0xd113a5=null);try{const _0x1f7fe7=JSON[_0x3380fd(0x171)](_0x25345d[_0x3380fd(0x1e5)](_0x1a30bc,_0x3380fd(0x1be)));if(_0x1f7fe7['pid']===process['pid'])_0x25345d['unlinkSync'](_0x1a30bc);}catch{}}async function _0x13b4b5(_0x41fac5){const _0x598a70=_0x5e39ab;_0x17c596=new _0x519845(),await _0x17c596[_0x598a70(0x152)](),_0x2b914f=_0x53473f();const _0xef83a7=_0x41fac5?await _0x41fac5():[];for(const {key:_0x51875d,vector:_0x598ab8}of _0xef83a7){if(!(_0x598ab8 instanceof Float32Array)||_0x598ab8[_0x598a70(0x149)]!==_0x41be7d)continue;const _0x4eddbc=_0x17c596[_0x598a70(0x167)](_0x51875d);_0x2b914f['add'](BigInt(_0x4eddbc),_0x598ab8);}_0x500d9a=0x0;}async function _0x7802c0(_0x2d3ebc){const _0x40e944=_0x5e39ab;if(!_0x2b914f||!_0x2d3ebc)return![];const _0x2b3365=await _0x4dea6e[_0x40e944(0x16b)](_0x2d3ebc,async _0x122453=>{const _0xb3b98e=_0x40e944;_0x2b914f['save'](_0x122453[_0xb3b98e(0x1b0)]),await _0x17c596[_0xb3b98e(0x17a)](_0x122453['labels']),_0x25345d[_0xb3b98e(0x1d6)](_0x122453[_0xb3b98e(0x186)],JSON['stringify']({'manifestVersion':_0x2ed3c7,'algorithm':'usearch','dims':_0x41be7d,'metric':_0x535bc6['metric'],'clock':_0x2d3ebc,'snapshotAt':Date[_0xb3b98e(0x17c)]()},null,0x2));},{'keep':_0x535bc6['keepSnapshots']});if(_0x2b3365?.[_0x40e944(0x1a6)])_0x500d9a=0x0;return _0x2b3365?.[_0x40e944(0x1a6)]??![];}async function _0x4cceb2(){const _0x48c6f6=_0x5e39ab,_0x6103eb=_0x4dea6e['readCurrentId']()||_0x4dea6e[_0x48c6f6(0x1cb)]();if(!_0x6103eb)return null;let _0x3b875c,_0x5fd6a0=![];return await _0x4dea6e['loadSnapshot'](_0x6103eb,async _0x26ce10=>{const _0x152da2=_0x48c6f6;_0x3b875c=JSON['parse'](_0x25345d[_0x152da2(0x1e5)](_0x26ce10[_0x152da2(0x186)],_0x152da2(0x1be)));if(_0x3b875c['manifestVersion']!==_0x2ed3c7||_0x3b875c[_0x152da2(0x14c)]!==_0x152da2(0x1ba)||_0x3b875c[_0x152da2(0x160)]!==_0x41be7d||_0x3b875c[_0x152da2(0x14e)]!==_0x535bc6[_0x152da2(0x14e)]){_0x3b875c=null;return;}_0x17c596=new _0x519845(),await _0x17c596[_0x152da2(0x1d9)](_0x26ce10[_0x152da2(0x1d0)]),_0x2b914f=_0x53473f(),_0x2b914f[_0x152da2(0x158)](_0x26ce10[_0x152da2(0x1b0)]),_0x5fd6a0=!![];}),_0x5fd6a0?_0x3b875c?.[_0x48c6f6(0x19b)]??0x0:null;}async function _0x16fb90(_0x32f430){const _0x5386a8=_0x5e39ab;if(!_0x32f430)return![];let _0x184308=![];try{await _0x4dea6e[_0x5386a8(0x1c2)](_0x32f430,async _0x59697a=>{const _0x37a9f8=_0x5386a8,_0xc5db1c=JSON[_0x37a9f8(0x171)](_0x25345d['readFileSync'](_0x59697a[_0x37a9f8(0x186)],'utf8'));if(_0xc5db1c['manifestVersion']!==_0x2ed3c7||_0xc5db1c['algorithm']!==_0x37a9f8(0x1ba)||_0xc5db1c[_0x37a9f8(0x160)]!==_0x41be7d||_0xc5db1c['metric']!==_0x535bc6[_0x37a9f8(0x14e)])return;const _0x286954=new _0x519845();await _0x286954[_0x37a9f8(0x1d9)](_0x59697a[_0x37a9f8(0x1d0)]);const _0x3a97a6=_0x53473f();_0x3a97a6[_0x37a9f8(0x15a)](_0x59697a[_0x37a9f8(0x1b0)]),_0x2b914f=_0x3a97a6,_0x17c596=_0x286954,_0x27c135=_0x32f430,_0x184308=!![];});}catch{}return _0x184308;}async function _0x1cc2dd(_0x40c7b3){try{await _0x16fb90(_0x40c7b3);}finally{_0x4d2c1e=![];}}function _0x497e81(){const _0xe620e=_0x5e39ab,_0x1e703d=Date[_0xe620e(0x17c)]();if(_0x1e703d-_0x2aff3d<_0x535bc6[_0xe620e(0x1b6)])return;_0x2aff3d=_0x1e703d;if(_0x4d2c1e)return;const _0xc86013=_0x4dea6e['readCurrentId']()||_0x4dea6e[_0xe620e(0x1cb)]();if(!_0xc86013||_0xc86013===_0x27c135)return;_0x4d2c1e=!![],_0x1cc2dd(_0xc86013);}async function _0x4f7e1a(){const _0x56a2e9=_0x5e39ab;_0x367a06=!![],_0x31db7a();if(_0x27c135)try{const _0x331234=new _0x519845();let _0xbf608=![];await _0x4dea6e[_0x56a2e9(0x1c2)](_0x27c135,async _0x19363b=>{const _0xd48002=_0x56a2e9;await _0x331234[_0xd48002(0x1d9)](_0x19363b[_0xd48002(0x1d0)]);const _0x37dca6=_0x53473f();_0x37dca6[_0xd48002(0x158)](_0x19363b[_0xd48002(0x1b0)]),_0x2b914f=_0x37dca6,_0x17c596=_0x331234,_0xbf608=!![];});if(_0xbf608)return;}catch{}await _0x13b4b5(_0x107086);}return{async 'load'(_0xf2a397){return _0x1401be(async()=>{const _0x357583=_0x1eb2;_0x4dea6e[_0x357583(0x1bf)]({'maxAgeMs':_0x535bc6[_0x357583(0x1a8)]}),_0x107086=_0xf2a397??null,_0x367a06=_0x5ec6b7();if(_0x367a06){_0x31db7a();const _0x47b930=await _0x4cceb2();if(_0x47b930!=null)return _0x47b930;return await _0x13b4b5(_0xf2a397),null;}const _0x58f407=_0x4dea6e[_0x357583(0x189)]()||_0x4dea6e[_0x357583(0x1cb)]();return await _0x16fb90(_0x58f407),null;});},async 'add'(_0x2411ae,_0x461f0,_0x517e99){return _0x1401be(async()=>{const _0xf9efcb=_0x1eb2;if(!_0x367a06){if(!_0x5ec6b7())return;await _0x4f7e1a();}if(!_0x2b914f)return;const _0xd0538b=_0x17c596[_0xf9efcb(0x166)](_0x2411ae);if(_0xd0538b!==undefined)try{_0x2b914f[_0xf9efcb(0x1c1)](BigInt(_0xd0538b));}catch{}const _0x572ca4=_0x17c596[_0xf9efcb(0x167)](_0x2411ae);_0x2b914f[_0xf9efcb(0x185)](BigInt(_0x572ca4),_0x2dc5fe(_0x461f0)),_0x500d9a++,_0x500d9a>=_0x535bc6[_0xf9efcb(0x1a0)]&&await _0x7802c0(_0x517e99??Date[_0xf9efcb(0x17c)]());});},async 'remove'(_0x14fd96){return _0x1401be(async()=>{const _0xcec98a=_0x1eb2;if(!_0x367a06){if(!_0x5ec6b7())return;await _0x4f7e1a();}if(!_0x2b914f)return;const _0x763dcb=_0x17c596[_0xcec98a(0x166)](_0x14fd96);if(_0x763dcb===undefined)return;try{_0x2b914f['remove'](BigInt(_0x763dcb));}catch{}_0x17c596[_0xcec98a(0x1ca)](_0x14fd96),_0x500d9a++;});},'search'(_0x5f1d7a,{limit:limit=0xa}={}){const _0x496a06=_0x5e39ab;if(!_0x367a06)_0x497e81();if(!_0x2b914f)return[];const _0x4c19b1=_0x2b914f['size']();if(_0x4c19b1===0x0)return[];const _0x718828=Math['min'](limit,_0x4c19b1),_0x3589c4=_0x2b914f[_0x496a06(0x1ef)](_0x2dc5fe(_0x5f1d7a),_0x718828,0x0),_0x9b0f26=[],_0x1eb6da=_0x3589c4[_0x496a06(0x1db)],_0x49eae3=_0x3589c4[_0x496a06(0x15c)];for(let _0x2e560c=0x0;_0x2e560c<_0x1eb6da['length'];_0x2e560c++){const _0x29474a=_0x1eb6da[_0x2e560c];if(_0x29474a===0xffffffffffffffffn)continue;const _0x312c5e=Number(_0x29474a),_0x43e15d=_0x17c596[_0x496a06(0x199)](_0x312c5e);if(!_0x43e15d)continue;const _0x547a42=_0x49eae3[_0x2e560c];let _0x3da592;if(_0x535bc6['metric']===_0x496a06(0x13b))_0x3da592=Math['max'](0x0,0x1-_0x547a42);else{if(_0x535bc6[_0x496a06(0x14e)]==='ip')_0x3da592=-_0x547a42;else _0x3da592=0x1/(0x1+_0x547a42);}_0x9b0f26['push']({'key':_0x43e15d,'score':_0x3da592});}return _0x9b0f26;},async 'snapshot'(_0x410890=Date['now']()){if(!_0x367a06)return![];return _0x1401be(()=>_0x7802c0(_0x410890));},async 'rebuild'(_0x80f957){if(!_0x367a06)return;return _0x1401be(()=>{if(_0x80f957!=null)_0x107086=_0x80f957;return _0x13b4b5(_0x80f957??_0x107086);});},async 'stop'(){return _0x1401be(async()=>{const _0x484b80=_0x1eb2;_0x367a06&&(await _0x7802c0(Date[_0x484b80(0x17c)]()),_0x583338());});},'count'(){return _0x17c596['size']();},'info'(){const _0x250f6c=_0x5e39ab;return{'algorithm':'usearch','role':_0x367a06?_0x250f6c(0x156):'reader','metric':_0x535bc6[_0x250f6c(0x14e)],'connectivity':_0x535bc6['connectivity'],'expansionAdd':_0x535bc6['expansionAdd'],'expansionSearch':_0x535bc6[_0x250f6c(0x1e7)],'count':_0x17c596['size'](),'size':_0x2b914f?.[_0x250f6c(0x192)]?.()??0x0,'capacity':_0x2b914f?.[_0x250f6c(0x1e3)]?.()??0x0,'changesSince':_0x367a06?_0x500d9a:null,'viewedSnapshot':_0x27c135??null,'snapshotDir':_0x43b6a5,'latestSnapshot':_0x4dea6e['readCurrentId']()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0x12cded=_0x4ea323;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x51119e,workerData:_0x11124b}=require$$0$1,{algorithmName:_0x27c341,algorithmConfig:_0x2c13c2,dims:_0x22cabf,dir:_0x4b6ecb}=_0x11124b;let _0x4d1228;if(_0x27c341===_0x12cded(0x19e))_0x4d1228=requireHnsw()(_0x2c13c2,{'dims':_0x22cabf,'dir':_0x4b6ecb});else{if(_0x27c341===_0x12cded(0x1cd))_0x4d1228=requireFlat()(_0x2c13c2,{'dims':_0x22cabf,'dir':_0x4b6ecb});else{if(_0x27c341===_0x12cded(0x1ba))_0x4d1228=requireUsearch()(_0x2c13c2,{'dims':_0x22cabf,'dir':_0x4b6ecb});else throw new Error(_0x12cded(0x142)+_0x27c341+'\x22');}}function _0x2a659c(){const _0x400286=_0x12cded;try{_0x51119e['postMessage']({'op':_0x400286(0x1d5),'count':_0x4d1228[_0x400286(0x18e)](),'info':_0x4d1228['info'](),'memory':process[_0x400286(0x1b3)]()});}catch{}}return _0x51119e['on'](_0x12cded(0x19f),async _0x10aac7=>{const _0x30f58f=_0x12cded,{id:_0x2ca237,op:_0x5c9e5f,args:_0x531655}=_0x10aac7;try{let _0xb0759f;switch(_0x5c9e5f){case _0x30f58f(0x158):{const _0x310604=(_0x531655[_0x30f58f(0x139)]||[])['map'](_0x4fae10=>({'key':_0x4fae10[_0x30f58f(0x164)],'vector':_0x4fae10['vector']instanceof Float32Array?_0x4fae10[_0x30f58f(0x1a2)]:new Float32Array(_0x4fae10[_0x30f58f(0x1a2)])}));_0xb0759f=await _0x4d1228[_0x30f58f(0x158)](async()=>_0x310604),_0x2a659c();break;}case _0x30f58f(0x185):{const _0x3f63b7=_0x531655[_0x30f58f(0x1a2)]instanceof Float32Array?_0x531655[_0x30f58f(0x1a2)]:new Float32Array(_0x531655[_0x30f58f(0x1a2)]);await _0x4d1228['add'](_0x531655[_0x30f58f(0x164)],_0x3f63b7,_0x531655['clock']??undefined),_0x2a659c(),_0xb0759f=null;break;}case _0x30f58f(0x1c1):{await _0x4d1228[_0x30f58f(0x1c1)](_0x531655[_0x30f58f(0x164)]),_0x2a659c(),_0xb0759f=null;break;}case'search':{const _0x2c4812=_0x531655['queryVec']instanceof Float32Array?_0x531655[_0x30f58f(0x157)]:new Float32Array(_0x531655[_0x30f58f(0x157)]);_0xb0759f=_0x4d1228['search'](_0x2c4812,_0x531655['opts']||{});break;}case _0x30f58f(0x1aa):{_0xb0759f=await _0x4d1228[_0x30f58f(0x1aa)](_0x531655[_0x30f58f(0x19b)]),_0x2a659c();break;}case _0x30f58f(0x1b2):{const _0x3316b5=(_0x531655[_0x30f58f(0x139)]||[])[_0x30f58f(0x134)](_0x3ca4a5=>({'key':_0x3ca4a5[_0x30f58f(0x164)],'vector':_0x3ca4a5[_0x30f58f(0x1a2)]instanceof Float32Array?_0x3ca4a5[_0x30f58f(0x1a2)]:new Float32Array(_0x3ca4a5[_0x30f58f(0x1a2)])}));await _0x4d1228[_0x30f58f(0x1b2)](async()=>_0x3316b5),_0x2a659c(),_0xb0759f=null;break;}case _0x30f58f(0x1ea):{await _0x4d1228[_0x30f58f(0x1ea)](),_0x2a659c(),_0xb0759f=null;break;}case'count':{_0xb0759f=_0x4d1228[_0x30f58f(0x18e)]();break;}case _0x30f58f(0x14f):{_0xb0759f=_0x4d1228[_0x30f58f(0x14f)]();break;}default:throw new Error(_0x30f58f(0x183)+_0x5c9e5f+'\x22');}_0x51119e['postMessage']({'id':_0x2ca237,'result':_0xb0759f});}catch(_0x9e5349){_0x51119e['postMessage']({'id':_0x2ca237,'error':{'message':_0x9e5349?.[_0x30f58f(0x19f)]||String(_0x9e5349),'code':_0x9e5349?.[_0x30f58f(0x15f)]}});}}),_0x51119e[_0x12cded(0x169)]({'op':_0x12cded(0x1b4)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module['exports']=algorithmWorkerThread;
1
+ 'use strict';const _0x67fb04=_0x43a8;(function(_0x5d1045,_0x1944e8){const _0x476e47=_0x43a8,_0x2a10c1=_0x5d1045();while(!![]){try{const _0x4f834f=parseInt(_0x476e47(0x124))/0x1+parseInt(_0x476e47(0x181))/0x2+parseInt(_0x476e47(0xd7))/0x3*(parseInt(_0x476e47(0x144))/0x4)+parseInt(_0x476e47(0xc3))/0x5*(-parseInt(_0x476e47(0x16a))/0x6)+parseInt(_0x476e47(0x10b))/0x7*(-parseInt(_0x476e47(0x183))/0x8)+-parseInt(_0x476e47(0x120))/0x9+-parseInt(_0x476e47(0x145))/0xa;if(_0x4f834f===_0x1944e8)break;else _0x2a10c1['push'](_0x2a10c1['shift']());}catch(_0x9f50a5){_0x2a10c1['push'](_0x2a10c1['shift']());}}}(_0x5bc2,0xf1ced));var require$$0$1=require(_0x67fb04(0xdf)),require$$0=require('fs'),require$$1=require('path'),require$$2=require('os'),require$$3=require(_0x67fb04(0x180));function getDefaultExportFromCjs(_0x46e66f){const _0x4cad82=_0x67fb04;return _0x46e66f&&_0x46e66f[_0x4cad82(0x12f)]&&Object[_0x4cad82(0x16d)]['hasOwnProperty'][_0x4cad82(0xed)](_0x46e66f,_0x4cad82(0xc2))?_0x46e66f[_0x4cad82(0xc2)]:_0x46e66f;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x22df5b=_0x67fb04;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x36a16c=require$$0,_0x1e8021=require$$1,_0x54b1d4=require$$2,_0x1d06f1=require$$3;function _0x4d6b2e(){const _0x4fd817=_0x43a8;return Date[_0x4fd817(0xcd)]();}function _0x420189(_0x19e7a5){const _0x11a1eb=_0x43a8;try{return _0x36a16c[_0x11a1eb(0xd4)](_0x19e7a5);}catch{return![];}}function _0x4f2378(_0x540d8c){const _0x44268d=_0x43a8;try{return _0x36a16c[_0x44268d(0x123)](_0x540d8c,_0x44268d(0xe6));}catch{return null;}}function _0x4e1dbd(_0x3b92f8,_0x1a5381){const _0x116b16=_0x43a8,_0x3e44fc=_0x3b92f8+_0x116b16(0x10e)+_0x1d06f1[_0x116b16(0x15b)](0x6)[_0x116b16(0xd8)](_0x116b16(0x14b));_0x36a16c[_0x116b16(0x179)](_0x3e44fc,_0x1a5381),_0x36a16c[_0x116b16(0x136)](_0x3e44fc,_0x3b92f8);}function _0x37381b(_0x58bcaa,_0x5d788b=0x10){const _0x3d1100=_0x43a8,_0x46c577=String(Math[_0x3d1100(0x11c)](0x0,Math[_0x3d1100(0x173)](_0x58bcaa||0x0)));return _0x46c577[_0x3d1100(0x13c)]>=_0x5d788b?_0x46c577:'0'['repeat'](_0x5d788b-_0x46c577[_0x3d1100(0x13c)])+_0x46c577;}return snapshotStore=class _0x4c5d79{constructor({dir:_0x38c571,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x232269=_0x43a8;if(!_0x38c571)throw new Error(_0x232269(0x119));this['dir']=_0x38c571,this[_0x232269(0xde)]=_0x1e8021[_0x232269(0xfb)](_0x38c571,_0x232269(0x104)),this[_0x232269(0x176)]=_0x1e8021[_0x232269(0xfb)](_0x38c571,'CURRENT'),this[_0x232269(0xeb)]=_0x1e8021['join'](_0x38c571,_0x232269(0xdb)),this[_0x232269(0x152)]=keepSnapshots,this[_0x232269(0x113)]=log,_0x36a16c[_0x232269(0x13d)](this[_0x232269(0x12d)],{'recursive':!![]}),_0x36a16c[_0x232269(0x13d)](this[_0x232269(0xde)],{'recursive':!![]});}['_snapshotDir'](_0x492011){const _0x263157=_0x43a8;return _0x1e8021[_0x263157(0xfb)](this['snapshotsDir'],_0x492011);}[_0x22df5b(0xee)](_0x52ed32){const _0xa6f367=_0x22df5b,_0x894038=this[_0xa6f367(0xca)](_0x52ed32);return{'dir':_0x894038,'index':_0x1e8021[_0xa6f367(0xfb)](_0x894038,_0xa6f367(0x14c)),'labels':_0x1e8021['join'](_0x894038,_0xa6f367(0x127)),'state':_0x1e8021[_0xa6f367(0xfb)](_0x894038,_0xa6f367(0x13f))};}[_0x22df5b(0x126)](){const _0x22e278=_0x22df5b;if(!_0x420189(this['currentPath']))return null;const _0x412333=_0x4f2378(this['currentPath']);if(!_0x412333)return null;const _0x338e34=String(_0x412333)[_0x22e278(0x12e)]();return _0x338e34||null;}['readCurrentClock'](){const _0x53360f=_0x22df5b,_0x1f8222=this[_0x53360f(0x126)]();if(!_0x1f8222)return 0x0;const _0x4c3588=Number(_0x1f8222);return Number[_0x53360f(0x132)](_0x4c3588)?_0x4c3588:0x0;}['listSnapshotIds'](){const _0x556f4a=_0x22df5b;try{return _0x36a16c[_0x556f4a(0xc8)](this[_0x556f4a(0xde)],{'withFileTypes':!![]})[_0x556f4a(0xda)](_0x31ab71=>_0x31ab71['isDirectory']())['map'](_0xa3a48e=>_0xa3a48e['name'])['filter'](_0x2d17ca=>!_0x2d17ca[_0x556f4a(0xd3)](_0x556f4a(0x10e)))[_0x556f4a(0xda)](_0x420233=>!_0x420233[_0x556f4a(0xd3)](_0x556f4a(0x150)))[_0x556f4a(0x103)]();}catch{return[];}}[_0x22df5b(0xf9)](){const _0x14cee1=_0x22df5b,_0x238680=this[_0x14cee1(0x126)]();if(_0x238680)return _0x238680;const _0x18ad0a=this[_0x14cee1(0x17a)]();if(!_0x18ad0a[_0x14cee1(0x13c)])return null;return _0x18ad0a[_0x18ad0a['length']-0x1];}[_0x22df5b(0xf7)]({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x46a488=_0x22df5b;let _0x103f8d;try{_0x103f8d=_0x36a16c[_0x46a488(0xc8)](this[_0x46a488(0xde)],{'withFileTypes':!![]});}catch{return;}const _0x52ccd0=_0x4d6b2e()-maxAgeMs;for(const _0x140197 of _0x103f8d){if(!_0x140197[_0x46a488(0xf3)]())continue;const _0x464027=_0x140197[_0x46a488(0x122)];if(!_0x464027['startsWith'](_0x46a488(0x10e))&&!_0x464027[_0x46a488(0xd3)]('_tmp-'))continue;const _0x18378d=_0x1e8021['join'](this[_0x46a488(0xde)],_0x464027);try{const _0x18c7b5=_0x36a16c[_0x46a488(0xe3)](_0x18378d);if(_0x18c7b5[_0x46a488(0xe4)]>_0x52ccd0)continue;}catch{}try{_0x36a16c[_0x46a488(0x10a)](_0x18378d,{'recursive':!![],'force':!![]});}catch{}}}[_0x22df5b(0xfc)]({keep:keep=null}={}){const _0x119956=_0x22df5b,_0x14931d=Math['max'](0x1,Math[_0x119956(0x173)](keep??this['keepSnapshots']??0x3)),_0x21c985=this[_0x119956(0x17a)]();if(_0x21c985[_0x119956(0x13c)]<=_0x14931d)return;const _0xaef5db=this[_0x119956(0x126)](),_0x3afb7c=_0x21c985[_0x119956(0x11e)](0x0,Math['max'](0x0,_0x21c985[_0x119956(0x13c)]-_0x14931d));for(const _0x3805d2 of _0x3afb7c){if(_0xaef5db&&_0x3805d2===_0xaef5db)continue;const _0x2efd1c=this[_0x119956(0xca)](_0x3805d2);try{_0x36a16c['rmSync'](_0x2efd1c,{'recursive':!![],'force':!![]});}catch{}}}async[_0x22df5b(0xd2)](_0x3fd4d4,_0x1aa942){const _0x3ac28c=_0x22df5b;if(!_0x3fd4d4)throw new Error('snapshot\x20id\x20required');const _0x45ab77=this[_0x3ac28c(0xee)](_0x3fd4d4);if(!_0x420189(_0x45ab77['index'])||!_0x420189(_0x45ab77[_0x3ac28c(0x153)])||!_0x420189(_0x45ab77['state']))throw new Error(_0x3ac28c(0xf0)+_0x3fd4d4);const _0x1ae891=await _0x1aa942(_0x45ab77);return _0x1ae891||{};}async[_0x22df5b(0x134)](_0x2080f0,_0x30817f,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0xa04c8f=_0x22df5b,_0x352771=Number(_0x2080f0);if(!Number[_0xa04c8f(0x132)](_0x352771)||_0x352771<0x0)throw new Error('candidateClock\x20must\x20be\x20finite\x20>=\x200');const _0x1a285f=_0x37381b(_0x352771),_0x51bf9d=this[_0xa04c8f(0xca)](_0x1a285f),_0x568e63=_0x1e8021[_0xa04c8f(0xfb)](this['snapshotsDir'],_0xa04c8f(0x10e)+_0x1a285f+'-'+_0x1d06f1[_0xa04c8f(0x15b)](0x6)[_0xa04c8f(0xd8)]('hex'));_0x36a16c[_0xa04c8f(0x13d)](_0x568e63,{'recursive':!![]});const _0x4075b3={'dir':_0x568e63,'index':_0x1e8021[_0xa04c8f(0xfb)](_0x568e63,'index.hnsw'),'labels':_0x1e8021[_0xa04c8f(0xfb)](_0x568e63,_0xa04c8f(0x127)),'state':_0x1e8021[_0xa04c8f(0xfb)](_0x568e63,_0xa04c8f(0x13f))};await _0x30817f(_0x4075b3,{'id':_0x1a285f,'clock':_0x352771});const _0x15e96a=JSON[_0xa04c8f(0x117)]({'pid':process[_0xa04c8f(0x17d)],'host':_0x54b1d4['hostname'](),'at':_0x4d6b2e()}),_0x2248b5=_0x4d6b2e();let _0x2a35d0=null;const _0x3763c3=()=>{const _0x4336e0=_0xa04c8f;try{const _0x47ad1b=JSON['parse'](_0x36a16c[_0x4336e0(0x123)](this['lockPath'],_0x4336e0(0xe6)));if(_0x47ad1b['at']&&_0x4d6b2e()-_0x47ad1b['at']>staleLockMaxAgeMs){const _0x1a9f37=_0x4d6b2e()-_0x47ad1b['at'],_0x6b5e35=_0x4336e0(0x139)+Math[_0x4336e0(0xfd)](_0x1a9f37/0x3e8)+'s,\x20pid:\x20'+_0x47ad1b[_0x4336e0(0x17d)]+_0x4336e0(0x15a)+_0x47ad1b[_0x4336e0(0xd9)]+_0x4336e0(0xf4)+_0x4336e0(0xe8);this[_0x4336e0(0x113)]?.[_0x4336e0(0x11b)]?this[_0x4336e0(0x113)][_0x4336e0(0x11b)](_0x6b5e35):console[_0x4336e0(0x11b)](_0x4336e0(0xe2),_0x6b5e35);try{_0x36a16c[_0x4336e0(0x174)](this[_0x4336e0(0xeb)]);}catch{}return!![];}}catch{try{_0x36a16c['unlinkSync'](this[_0x4336e0(0xeb)]);}catch{}}return![];},_0x4363a5=()=>{const _0x106e59=_0xa04c8f;try{return _0x2a35d0=_0x36a16c[_0x106e59(0xc7)](this['lockPath'],'wx'),_0x36a16c[_0x106e59(0x179)](_0x2a35d0,_0x15e96a),!![];}catch(_0x79708c){if(_0x79708c&&_0x79708c['code']===_0x106e59(0x165))return![];throw _0x79708c;}};if(!_0x4363a5()){_0x3763c3(),_0x4363a5();if(_0x2a35d0==null&&lockTimeoutMs>0x0)while(_0x4d6b2e()-_0x2248b5<lockTimeoutMs){await new Promise(_0x708fbc=>setTimeout(_0x708fbc,0x19));if(_0x4363a5())break;_0x3763c3();}}if(_0x2a35d0==null){try{_0x36a16c['rmSync'](_0x568e63,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0xa04c8f(0x161)};}try{const _0x5bf8c9=this['readCurrentClock']();if(_0x352771<=_0x5bf8c9){try{_0x36a16c['rmSync'](_0x568e63,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0xa04c8f(0xc4),'currentClock':_0x5bf8c9};}if(!_0x420189(_0x51bf9d))_0x36a16c[_0xa04c8f(0x136)](_0x568e63,_0x51bf9d);else try{_0x36a16c[_0xa04c8f(0x10a)](_0x568e63,{'recursive':!![],'force':!![]});}catch{}return _0x4e1dbd(this[_0xa04c8f(0x176)],_0x1a285f+'\x0a'),this[_0xa04c8f(0xfc)]({'keep':keep}),{'published':!![],'currentClock':_0x352771};}finally{try{_0x36a16c[_0xa04c8f(0x157)](_0x2a35d0);}catch{}try{_0x36a16c[_0xa04c8f(0x174)](this[_0xa04c8f(0xeb)]);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x597690=_0x67fb04;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0xaeeebb=require$$0;class _0x33d561{constructor(){this['keyToLabel']=new Map(),this['labelToKey']=new Map(),this['nextLabel']=0x0,this['_tombstoneCount']=0x0;}async[_0x597690(0x12a)](){const _0x5bc972=_0x597690;this[_0x5bc972(0x167)]=new Map(),this[_0x5bc972(0xcb)]=new Map(),this[_0x5bc972(0x166)]=0x0,this['_tombstoneCount']=0x0;}async['loadFrom'](_0x5df3a0){const _0x24f6b0=_0x597690;if(!_0x5df3a0||!_0xaeeebb['existsSync'](_0x5df3a0))return await this[_0x24f6b0(0x12a)](),!![];let _0x54dbe0;try{_0x54dbe0=_0xaeeebb[_0x24f6b0(0x123)](_0x5df3a0,_0x24f6b0(0xe6));}catch{return await this['reset'](),!![];}let _0x268ae4;try{_0x268ae4=JSON[_0x24f6b0(0x12b)](_0x54dbe0);}catch{return await this[_0x24f6b0(0x12a)](),!![];}const _0x51b7ba=Array['isArray'](_0x268ae4?.['entries'])?_0x268ae4[_0x24f6b0(0x168)]:[],_0x2d0968=Number[_0x24f6b0(0x148)](_0x268ae4?.[_0x24f6b0(0x166)])?_0x268ae4[_0x24f6b0(0x166)]:0x0,_0x23fb10=new Map(),_0x2118fe=new Map();let _0x3ab383=-0x1;for(const _0x10d225 of _0x51b7ba){if(!Array['isArray'](_0x10d225)||_0x10d225[_0x24f6b0(0x13c)]!==0x2)continue;const _0x27d303=Number(_0x10d225[0x0]),_0x189306=String(_0x10d225[0x1]??'');if(!Number['isInteger'](_0x27d303)||_0x27d303<0x0)continue;if(!_0x189306)continue;_0x23fb10['set'](_0x189306,_0x27d303),_0x2118fe[_0x24f6b0(0x118)](_0x27d303,_0x189306);if(_0x27d303>_0x3ab383)_0x3ab383=_0x27d303;}return this[_0x24f6b0(0x167)]=_0x23fb10,this[_0x24f6b0(0xcb)]=_0x2118fe,this['nextLabel']=Math[_0x24f6b0(0x11c)](_0x2d0968,_0x3ab383+0x1,0x0),this['_tombstoneCount']=0x0,!![];}['labelForExisting'](_0x33b754){const _0xf15c82=_0x597690;return this[_0xf15c82(0x167)]['get'](_0x33b754);}[_0x597690(0x116)](_0x1cc731){const _0x3aa3bd=_0x597690;let _0x46c644=this[_0x3aa3bd(0x167)][_0x3aa3bd(0x129)](_0x1cc731);if(_0x46c644!==undefined)return _0x46c644;return _0x46c644=this['nextLabel']++,this[_0x3aa3bd(0x167)][_0x3aa3bd(0x118)](_0x1cc731,_0x46c644),this['labelToKey'][_0x3aa3bd(0x118)](_0x46c644,_0x1cc731),_0x46c644;}[_0x597690(0x110)](_0x72127b){const _0x7adbc7=_0x597690,_0x282371=this['keyToLabel']['get'](_0x72127b);if(_0x282371===undefined)return;this[_0x7adbc7(0x167)][_0x7adbc7(0x135)](_0x72127b),this[_0x7adbc7(0xcb)][_0x7adbc7(0x135)](_0x282371),this['_tombstoneCount']++;}['keyForLabel'](_0x22f7db){const _0x3ea83a=_0x597690;return this['labelToKey'][_0x3ea83a(0x129)](_0x22f7db)??null;}['size'](){const _0x39612e=_0x597690;return this['keyToLabel'][_0x39612e(0xcf)];}[_0x597690(0x11f)](){const _0x47790a=_0x597690;return this[_0x47790a(0x172)];}async['snapshotTo'](_0x1ed37a){const _0x2dc5d5=_0x597690,_0x4fe584=_0x1ed37a+_0x2dc5d5(0x170),_0x5a9146=[];for(const [_0x370c84,_0x2d00e8]of this['labelToKey']['entries']()){_0x5a9146[_0x2dc5d5(0xc9)]([_0x370c84,_0x2d00e8]);}_0x5a9146[_0x2dc5d5(0x103)]((_0x5e5b83,_0x50ee96)=>_0x5e5b83[0x0]-_0x50ee96[0x0]);const _0x8cf0b={'version':0x1,'nextLabel':this[_0x2dc5d5(0x166)],'entries':_0x5a9146};_0xaeeebb[_0x2dc5d5(0x179)](_0x4fe584,JSON[_0x2dc5d5(0x117)](_0x8cf0b)),_0xaeeebb[_0x2dc5d5(0x136)](_0x4fe584,_0x1ed37a);}}return labelMap=_0x33d561,labelMap;}function _0x43a8(_0x4e277e,_0x3c9193){_0x4e277e=_0x4e277e-0xc2;const _0x5bc290=_0x5bc2();let _0x43a8ba=_0x5bc290[_0x4e277e];return _0x43a8ba;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x3f8c0a=requireSnapshotStore(),_0x318344=requireLabelMap(),_0x4a5250=0x1;let _0x598e37=null;function _0x2cbf09(){const _0x54fd7c=_0x43a8;if(_0x598e37)return _0x598e37;try{return _0x598e37=require(_0x54fd7c(0x149)),_0x598e37;}catch(_0x202e96){const _0x31cb28=new Error(_0x54fd7c(0xd5)+('for\x20Node\x20'+process['versions'][_0x54fd7c(0x105)]+_0x54fd7c(0x177)+process[_0x54fd7c(0xf2)]+'/'+process[_0x54fd7c(0x178)]+'.\x20')+_0x54fd7c(0x101)+(_0x54fd7c(0x114)+(_0x202e96?.[_0x54fd7c(0x112)]||String(_0x202e96))));_0x31cb28[_0x54fd7c(0x158)]=_0x54fd7c(0x16f),_0x31cb28[_0x54fd7c(0xfa)]=_0x202e96;throw _0x31cb28;}}return hnsw=function _0xa3db3(_0x3d6e37={},{dims:_0x4d296a,dir:_0x5c3e75}){const _0x29db6e=_0x43a8,_0x45a79b=_0x2cbf09();if(!_0x4d296a||_0x4d296a<=0x0)throw new Error('hnsw\x20algorithm\x20requires\x20dims\x20>\x200');if(!_0x5c3e75)throw new Error('hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage');const _0x856a0c={'metric':_0x3d6e37[_0x29db6e(0x16c)]??_0x29db6e(0x10f),'M':_0x3d6e37['M']??0x10,'efConstruction':_0x3d6e37[_0x29db6e(0x111)]??0xc8,'efSearch':_0x3d6e37[_0x29db6e(0x141)]??0x40,'maxElements':_0x3d6e37['maxElements']??0x400,'growFactor':_0x3d6e37[_0x29db6e(0x160)]??0x2,'snapshotEveryChanges':_0x3d6e37['snapshotEveryChanges']??0xc350,'keepSnapshots':_0x3d6e37[_0x29db6e(0x152)]??0x2,'tmpMaxAgeMs':_0x3d6e37[_0x29db6e(0x175)]??0x6*0x36ee80},_0x475d63=new _0x3f8c0a({'dir':_0x5c3e75,'keepSnapshots':_0x856a0c['keepSnapshots']}),_0x45a68f=new _0x318344();let _0x372034=null,_0x5290f6=0x0,_0x497b84=null,_0x57992f=Promise[_0x29db6e(0x128)]();const _0xe07a1f=_0x204f75=>{return _0x57992f=_0x57992f['then'](_0x204f75),_0x57992f;};async function _0x5ad60c(_0x2d1ae9){const _0xe39e57=_0x29db6e;await _0x45a68f['reset']();const _0x581620=_0x2d1ae9?await _0x2d1ae9():[],_0x2cc96=Math['max'](_0x856a0c[_0xe39e57(0x10c)],Math[_0xe39e57(0x159)](_0x581620[_0xe39e57(0x13c)]*(_0x856a0c['growFactor']||1.2)),0x1);_0x372034=new _0x45a79b[(_0xe39e57(0x14d))](_0x856a0c[_0xe39e57(0x16c)],_0x4d296a),_0x372034[_0xe39e57(0x151)]({'maxElements':_0x2cc96,'efConstruction':_0x856a0c[_0xe39e57(0x111)],'M':_0x856a0c['M']});for(const {key:_0x577704,vector:_0x1ed7b1}of _0x581620){if(!(_0x1ed7b1 instanceof Float32Array)||_0x1ed7b1[_0xe39e57(0x13c)]!==_0x4d296a)continue;const _0x43da76=_0x45a68f[_0xe39e57(0x116)](_0x577704);_0x372034['addPoint'](Array[_0xe39e57(0x106)](_0x1ed7b1),_0x43da76);}_0x372034[_0xe39e57(0x182)](_0x856a0c[_0xe39e57(0x141)]),_0x5290f6=0x0;}async function _0x2b7199(_0x1238d6){const _0x5a78b9=_0x29db6e;if(!_0x372034||!_0x1238d6)return![];const _0x275743=await _0x475d63[_0x5a78b9(0x134)](_0x1238d6,async _0x25327b=>{const _0x447160=_0x5a78b9;_0x372034[_0x447160(0xdd)](_0x25327b['index']),await _0x45a68f[_0x447160(0xfe)](_0x25327b[_0x447160(0x153)]);const _0x4b066a=require$$0;_0x4b066a['writeFileSync'](_0x25327b[_0x447160(0x17b)],JSON[_0x447160(0x117)]({'manifestVersion':_0x4a5250,'dims':_0x4d296a,'metric':_0x856a0c['metric'],'clock':_0x1238d6,'snapshotAt':Date[_0x447160(0xcd)]()},null,0x2));},{'keep':_0x856a0c['keepSnapshots']});if(_0x275743?.['published'])_0x5290f6=0x0;return _0x275743?.[_0x5a78b9(0xe0)]??![];}async function _0x5b4edc(){const _0x1e1012=_0x29db6e,_0x29eb91=_0x475d63['readCurrentId']()||_0x475d63['latestSnapshotId']();if(!_0x29eb91)return null;let _0x45250f,_0x6fafad=![];return await _0x475d63[_0x1e1012(0xd2)](_0x29eb91,async _0x24f435=>{const _0x42d082=_0x1e1012,_0x179879=require$$0;_0x45250f=JSON[_0x42d082(0x12b)](_0x179879[_0x42d082(0x123)](_0x24f435[_0x42d082(0x17b)],_0x42d082(0xe6)));if(_0x45250f[_0x42d082(0xea)]!==_0x4a5250||_0x45250f['dims']!==_0x4d296a||_0x45250f[_0x42d082(0x16c)]!==_0x856a0c[_0x42d082(0x16c)]){_0x45250f=null;return;}await _0x45a68f[_0x42d082(0x171)](_0x24f435['labels']),_0x372034=new _0x45a79b[(_0x42d082(0x14d))](_0x856a0c[_0x42d082(0x16c)],_0x4d296a),_0x372034[_0x42d082(0x155)](_0x24f435[_0x42d082(0xe7)]),_0x372034[_0x42d082(0x182)](_0x856a0c[_0x42d082(0x141)]),_0x6fafad=!![];}),_0x6fafad?_0x45250f?.[_0x1e1012(0x13b)]??0x0:null;}return{async 'load'(_0x5bd628){return _0xe07a1f(async()=>{const _0x35dfd0=_0x43a8;_0x475d63['cleanupTmpDirs']({'maxAgeMs':_0x856a0c[_0x35dfd0(0x175)]}),_0x497b84=_0x5bd628??null;const _0x267add=await _0x5b4edc();if(_0x267add!=null)return _0x267add;return await _0x5ad60c(_0x5bd628),null;});},async 'add'(_0x3abde2,_0x4cd019,_0x273944){return _0xe07a1f(async()=>{const _0x55714a=_0x43a8;if(!_0x372034)return;const _0x5d05e5=_0x45a68f[_0x55714a(0x116)](_0x3abde2);try{_0x372034[_0x55714a(0xd6)](_0x5d05e5);}catch{}_0x372034[_0x55714a(0xd0)]()>=_0x372034[_0x55714a(0x17f)]()&&(_0x856a0c[_0x55714a(0x10c)]=Math[_0x55714a(0x159)](_0x372034['getMaxElements']()*(_0x856a0c[_0x55714a(0x160)]||0x2)),await _0x5ad60c(_0x497b84)),_0x372034[_0x55714a(0x146)](Array[_0x55714a(0x106)](_0x4cd019),_0x5d05e5),_0x5290f6++,_0x5290f6>=_0x856a0c[_0x55714a(0x115)]&&await _0x2b7199(_0x273944??Date[_0x55714a(0xcd)]());});},async 'remove'(_0x2310e6){return _0xe07a1f(async()=>{const _0xe067ac=_0x43a8;if(!_0x372034)return;const _0x38a027=_0x45a68f['labelForExisting'](_0x2310e6);if(_0x38a027===undefined)return;try{_0x372034['markDelete'](_0x38a027);}catch{}_0x45a68f[_0xe067ac(0x110)](_0x2310e6),_0x5290f6++;});},'search'(_0x8fd898,{limit:limit=0xa,efSearch:_0x1311e8}={}){const _0x5ee767=_0x29db6e;if(!_0x372034)return[];if(Number['isInteger'](_0x1311e8))_0x372034['setEf'](_0x1311e8);const _0x177bbd=Math[_0x5ee767(0xf6)](limit,_0x372034['getCurrentCount']()||0x1),{neighbors:_0xa56f87,distances:_0x43a2ec}=_0x372034[_0x5ee767(0x137)](Array[_0x5ee767(0x106)](_0x8fd898),_0x177bbd),_0x4fa1aa=[];for(let _0x78f429=0x0;_0x78f429<_0xa56f87[_0x5ee767(0x13c)];_0x78f429++){const _0x2aec13=_0x45a68f[_0x5ee767(0x15f)](_0xa56f87[_0x78f429]);if(!_0x2aec13)continue;const _0x1748c4=_0x856a0c[_0x5ee767(0x16c)]===_0x5ee767(0x10f)?Math[_0x5ee767(0x11c)](0x0,0x1-_0x43a2ec[_0x78f429]):0x1/(0x1+_0x43a2ec[_0x78f429]);_0x4fa1aa[_0x5ee767(0xc9)]({'key':_0x2aec13,'score':_0x1748c4});}return _0x4fa1aa;},async 'snapshot'(_0x36b0b5=Date['now']()){return _0xe07a1f(()=>_0x2b7199(_0x36b0b5));},async 'rebuild'(_0x1c07c9){return _0xe07a1f(()=>{if(_0x1c07c9!=null)_0x497b84=_0x1c07c9;return _0x5ad60c(_0x1c07c9??_0x497b84);});},async 'stop'(){const _0x12b137=_0x29db6e;return _0xe07a1f(()=>_0x2b7199(Date[_0x12b137(0xcd)]()));},'count'(){return _0x45a68f['size']();},'info'(){const _0x28f4ad=_0x29db6e;return{'algorithm':'hnsw','metric':_0x856a0c[_0x28f4ad(0x16c)],'M':_0x856a0c['M'],'efConstruction':_0x856a0c[_0x28f4ad(0x111)],'efSearch':_0x856a0c[_0x28f4ad(0x141)],'maxElements':_0x372034?.[_0x28f4ad(0x17f)]()??_0x856a0c[_0x28f4ad(0x10c)],'count':_0x45a68f[_0x28f4ad(0xcf)](),'changesSince':_0x5290f6,'snapshotDir':_0x5c3e75,'latestSnapshot':_0x475d63[_0x28f4ad(0x126)]()??null};}};},hnsw;}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x11934e(_0x339672={}){const _0x3e1ee4=new Map();return{async 'load'(_0x1d6625){const _0x4349af=_0x43a8;_0x3e1ee4[_0x4349af(0x14e)]();if(_0x1d6625)for(const {key:_0x366aca,vector:_0x557d88}of await _0x1d6625()){_0x3e1ee4[_0x4349af(0x118)](_0x366aca,_0x557d88);}},async 'add'(_0x10b18b,_0x280d1d,_0x216330){const _0x1c58e3=_0x43a8;_0x3e1ee4[_0x1c58e3(0x118)](_0x10b18b,_0x280d1d);},async 'remove'(_0x33a311){const _0x180029=_0x43a8;_0x3e1ee4[_0x180029(0x135)](_0x33a311);},'search'(_0x355c42,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x436552=_0x43a8,_0x220857=[];for(const [_0x3a0b9c,_0x9069ec]of _0x3e1ee4){const _0x224942=_0x3f068a(_0x355c42,_0x9069ec);if(_0x224942>=threshold)_0x220857[_0x436552(0xc9)]({'key':_0x3a0b9c,'score':_0x224942});}return _0x220857[_0x436552(0x103)]((_0x406e2d,_0x186766)=>_0x186766[_0x436552(0xf1)]-_0x406e2d['score']),_0x220857['slice'](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x532c32){const _0xfdffd=_0x43a8;await this[_0xfdffd(0x156)](_0x532c32);},async 'stop'(){},'count'(){const _0x1f8f95=_0x43a8;return _0x3e1ee4[_0x1f8f95(0xcf)];},'info'(){const _0x210a29=_0x43a8;return{'algorithm':'flat','count':_0x3e1ee4[_0x210a29(0xcf)]};}};};function _0x3f068a(_0x32bfef,_0x171d64){const _0x5ed927=_0x43a8;let _0x112139=0x0,_0x4927e7=0x0,_0x24fc87=0x0;for(let _0x4bb3d1=0x0;_0x4bb3d1<_0x32bfef[_0x5ed927(0x13c)];_0x4bb3d1++){_0x112139+=_0x32bfef[_0x4bb3d1]*_0x171d64[_0x4bb3d1],_0x4927e7+=_0x32bfef[_0x4bb3d1]*_0x32bfef[_0x4bb3d1],_0x24fc87+=_0x171d64[_0x4bb3d1]*_0x171d64[_0x4bb3d1];}const _0x9b455a=Math[_0x5ed927(0x125)](_0x4927e7)*Math[_0x5ed927(0x125)](_0x24fc87);return _0x9b455a===0x0?0x0:_0x112139/_0x9b455a;}return flat;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0xe11bd3=require$$0,_0x975b8d=require$$1,_0xdb8de8=requireSnapshotStore(),_0xd34066=requireLabelMap(),_0x357957=0x1;let _0x53b115=null;function _0x54b789(){const _0x13e444=_0x43a8;if(_0x53b115)return _0x53b115;try{return _0x53b115=require(_0x13e444(0x12c)),_0x53b115;}catch(_0x4f5463){const _0x1b574a=new Error('usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20'+('for\x20Node\x20'+process[_0x13e444(0xf8)][_0x13e444(0x105)]+_0x13e444(0x177)+process[_0x13e444(0xf2)]+'/'+process[_0x13e444(0x178)]+'.\x20')+_0x13e444(0x14a)+(_0x13e444(0x114)+(_0x4f5463?.[_0x13e444(0x112)]||String(_0x4f5463))));_0x1b574a[_0x13e444(0x158)]=_0x13e444(0x17e),_0x1b574a[_0x13e444(0xfa)]=_0x4f5463;throw _0x1b574a;}}function _0x287ea8(_0x57633b,_0x41627c){const _0x33c0e3=_0x43a8;switch(_0x57633b){case _0x33c0e3(0x10f):return _0x41627c[_0x33c0e3(0x142)][_0x33c0e3(0xc6)];case'l2':return _0x41627c['MetricKind'][_0x33c0e3(0xdc)];case'ip':return _0x41627c[_0x33c0e3(0x142)]['IP'];default:return _0x41627c['MetricKind'][_0x33c0e3(0xc6)];}}return usearch=function _0x21aa2c(_0x3421ad={},{dims:_0x50c959,dir:_0x146dea}){const _0x69d16f=_0x43a8,_0x3224a2=_0x54b789();if(!_0x50c959||_0x50c959<=0x0)throw new Error('usearch\x20algorithm\x20requires\x20dims\x20>\x200');if(!_0x146dea)throw new Error(_0x69d16f(0x10d));const _0x12e8b1={'metric':_0x3421ad['metric']??_0x69d16f(0x10f),'connectivity':_0x3421ad[_0x69d16f(0x15d)]??0x10,'expansionAdd':_0x3421ad[_0x69d16f(0xe1)]??0x80,'expansionSearch':_0x3421ad[_0x69d16f(0x140)]??0x40,'snapshotEveryChanges':_0x3421ad[_0x69d16f(0x115)]??0xc350,'keepSnapshots':_0x3421ad[_0x69d16f(0x152)]??0x2,'tmpMaxAgeMs':_0x3421ad[_0x69d16f(0x175)]??0x6*0x36ee80,'heartbeatIntervalMs':_0x3421ad[_0x69d16f(0x147)]??0x1388,'writerLockMaxAgeMs':_0x3421ad[_0x69d16f(0x169)]??0x3a98,'viewRefreshMs':_0x3421ad[_0x69d16f(0xc5)]??0x3e8},_0x5e8350=new _0xdb8de8({'dir':_0x146dea,'keepSnapshots':_0x12e8b1[_0x69d16f(0x152)]}),_0x29233a=_0x975b8d[_0x69d16f(0xfb)](_0x146dea,_0x69d16f(0x11a));let _0x27f84b=new _0xd34066(),_0x86bebc=null,_0x157a43=0x0,_0x32a2e9=null,_0x2a8aba=![],_0x5a179c=null,_0x33bc09=null,_0x1b9887=0x0,_0x447cc0=![],_0x32a15=Promise['resolve']();const _0xf1ae84=_0x351835=>{const _0x3f1529=_0x69d16f;return _0x32a15=_0x32a15[_0x3f1529(0x107)](_0x351835),_0x32a15;};function _0x408551(){const _0xe1b9a0=_0x69d16f;return new _0x3224a2[(_0xe1b9a0(0x102))]({'dimensions':_0x50c959,'metric':_0x287ea8(_0x12e8b1[_0xe1b9a0(0x16c)],_0x3224a2),'quantization':_0x3224a2[_0xe1b9a0(0xec)][_0xe1b9a0(0x164)],'connectivity':_0x12e8b1[_0xe1b9a0(0x15d)],'expansion_add':_0x12e8b1['expansionAdd'],'expansion_search':_0x12e8b1[_0xe1b9a0(0x140)],'multi':![]});}function _0x551e8d(_0x3029dc){return _0x3029dc instanceof Float32Array?_0x3029dc:new Float32Array(_0x3029dc);}function _0x5611fd(){const _0x5b82e2=_0x69d16f,_0x4713dc=JSON['stringify']({'pid':process[_0x5b82e2(0x17d)],'at':Date['now']()}),_0x20b57d=()=>{const _0x18f94d=_0x5b82e2;try{const _0x54b3d6=_0xe11bd3[_0x18f94d(0xc7)](_0x29233a,'wx');return _0xe11bd3[_0x18f94d(0x179)](_0x54b3d6,_0x4713dc),_0xe11bd3[_0x18f94d(0x157)](_0x54b3d6),!![];}catch(_0x366fd3){if(_0x366fd3?.[_0x18f94d(0x158)]===_0x18f94d(0x165))return![];throw _0x366fd3;}};if(_0x20b57d())return!![];try{const _0x27b852=JSON['parse'](_0xe11bd3[_0x5b82e2(0x123)](_0x29233a,'utf8')),_0x38be25=Date['now']()-(_0x27b852['at']??0x0);if(_0x38be25<_0x12e8b1[_0x5b82e2(0x169)])return![];}catch{}try{_0xe11bd3[_0x5b82e2(0x174)](_0x29233a);}catch{}return _0x20b57d();}function _0x49e6eb(){const _0x51d3ea=_0x69d16f;if(_0x5a179c)clearInterval(_0x5a179c);_0x5a179c=setInterval(()=>{const _0x48adae=_0x43a8;try{_0xe11bd3['writeFileSync'](_0x29233a,JSON[_0x48adae(0x117)]({'pid':process[_0x48adae(0x17d)],'at':Date[_0x48adae(0xcd)]()}));}catch{}},_0x12e8b1[_0x51d3ea(0x147)]),_0x5a179c[_0x51d3ea(0x130)]();}function _0x49a610(){const _0xedecd=_0x69d16f;_0x5a179c&&(clearInterval(_0x5a179c),_0x5a179c=null);try{const _0x4f58cb=JSON[_0xedecd(0x12b)](_0xe11bd3['readFileSync'](_0x29233a,_0xedecd(0xe6)));if(_0x4f58cb[_0xedecd(0x17d)]===process[_0xedecd(0x17d)])_0xe11bd3[_0xedecd(0x174)](_0x29233a);}catch{}}async function _0x31863e(_0x1cbe29){const _0x1d568f=_0x69d16f;_0x27f84b=new _0xd34066(),await _0x27f84b[_0x1d568f(0x12a)](),_0x86bebc=_0x408551();const _0x4db1d4=_0x1cbe29?await _0x1cbe29():[];for(const {key:_0x42322c,vector:_0x2d82e}of _0x4db1d4){if(!(_0x2d82e instanceof Float32Array)||_0x2d82e[_0x1d568f(0x13c)]!==_0x50c959)continue;const _0x5ea525=_0x27f84b[_0x1d568f(0x116)](_0x42322c);_0x86bebc[_0x1d568f(0x16b)](BigInt(_0x5ea525),_0x2d82e);}_0x157a43=0x0;}async function _0x270923(_0x1c954b){const _0xfd9d89=_0x69d16f;if(!_0x86bebc||!_0x1c954b)return![];const _0x20092b=await _0x5e8350['publishSnapshot'](_0x1c954b,async _0x113f97=>{const _0x420c4e=_0x43a8;_0x86bebc[_0x420c4e(0x163)](_0x113f97['index']),await _0x27f84b[_0x420c4e(0xfe)](_0x113f97[_0x420c4e(0x153)]),_0xe11bd3[_0x420c4e(0x179)](_0x113f97[_0x420c4e(0x17b)],JSON[_0x420c4e(0x117)]({'manifestVersion':_0x357957,'algorithm':'usearch','dims':_0x50c959,'metric':_0x12e8b1[_0x420c4e(0x16c)],'clock':_0x1c954b,'snapshotAt':Date[_0x420c4e(0xcd)]()},null,0x2));},{'keep':_0x12e8b1[_0xfd9d89(0x152)]});if(_0x20092b?.[_0xfd9d89(0xe0)])_0x157a43=0x0;return _0x20092b?.[_0xfd9d89(0xe0)]??![];}async function _0x3d74a2(){const _0x24fe27=_0x69d16f,_0x3e4f32=_0x5e8350[_0x24fe27(0x126)]()||_0x5e8350[_0x24fe27(0xf9)]();if(!_0x3e4f32)return null;let _0x496a24,_0x37124d=![];return await _0x5e8350['loadSnapshot'](_0x3e4f32,async _0x1f76dd=>{const _0x3f9b88=_0x24fe27;_0x496a24=JSON[_0x3f9b88(0x12b)](_0xe11bd3[_0x3f9b88(0x123)](_0x1f76dd[_0x3f9b88(0x17b)],_0x3f9b88(0xe6)));if(_0x496a24[_0x3f9b88(0xea)]!==_0x357957||_0x496a24['algorithm']!=='usearch'||_0x496a24[_0x3f9b88(0x138)]!==_0x50c959||_0x496a24[_0x3f9b88(0x16c)]!==_0x12e8b1[_0x3f9b88(0x16c)]){_0x496a24=null;return;}_0x27f84b=new _0xd34066(),await _0x27f84b[_0x3f9b88(0x171)](_0x1f76dd[_0x3f9b88(0x153)]),_0x86bebc=_0x408551(),_0x86bebc[_0x3f9b88(0x156)](_0x1f76dd[_0x3f9b88(0xe7)]),_0x37124d=!![];}),_0x37124d?_0x496a24?.[_0x24fe27(0x13b)]??0x0:null;}async function _0x1f310d(_0x2696a8){const _0x12c824=_0x69d16f;if(!_0x2696a8)return![];let _0x5bba42=![];try{await _0x5e8350[_0x12c824(0xd2)](_0x2696a8,async _0x238f52=>{const _0x12544c=_0x12c824,_0x2ce2b0=JSON[_0x12544c(0x12b)](_0xe11bd3[_0x12544c(0x123)](_0x238f52['state'],_0x12544c(0xe6)));if(_0x2ce2b0[_0x12544c(0xea)]!==_0x357957||_0x2ce2b0[_0x12544c(0x154)]!==_0x12544c(0x12c)||_0x2ce2b0[_0x12544c(0x138)]!==_0x50c959||_0x2ce2b0[_0x12544c(0x16c)]!==_0x12e8b1[_0x12544c(0x16c)])return;const _0x5dbbfe=new _0xd34066();await _0x5dbbfe[_0x12544c(0x171)](_0x238f52[_0x12544c(0x153)]);const _0x4c9feb=_0x408551();_0x4c9feb['view'](_0x238f52[_0x12544c(0xe7)]),_0x86bebc=_0x4c9feb,_0x27f84b=_0x5dbbfe,_0x33bc09=_0x2696a8,_0x5bba42=!![];});}catch{}return _0x5bba42;}async function _0x38ae0d(_0x25d59a){try{await _0x1f310d(_0x25d59a);}finally{_0x447cc0=![];}}function _0x52d528(){const _0x5c10fd=_0x69d16f,_0x4f1c56=Date['now']();if(_0x4f1c56-_0x1b9887<_0x12e8b1[_0x5c10fd(0xc5)])return;_0x1b9887=_0x4f1c56;if(_0x447cc0)return;const _0x566116=_0x5e8350[_0x5c10fd(0x126)]()||_0x5e8350['latestSnapshotId']();if(!_0x566116||_0x566116===_0x33bc09)return;_0x447cc0=!![],_0x38ae0d(_0x566116);}async function _0x5d10f0(){const _0x459d43=_0x69d16f;_0x2a8aba=!![],_0x49e6eb();if(_0x33bc09)try{const _0x312c11=new _0xd34066();let _0x58622d=![];await _0x5e8350[_0x459d43(0xd2)](_0x33bc09,async _0x533b83=>{const _0xe2c5b5=_0x459d43;await _0x312c11[_0xe2c5b5(0x171)](_0x533b83[_0xe2c5b5(0x153)]);const _0x4d0bfa=_0x408551();_0x4d0bfa[_0xe2c5b5(0x156)](_0x533b83[_0xe2c5b5(0xe7)]),_0x86bebc=_0x4d0bfa,_0x27f84b=_0x312c11,_0x58622d=!![];});if(_0x58622d)return;}catch{}await _0x31863e(_0x32a2e9);}return{async 'load'(_0x31bf97){return _0xf1ae84(async()=>{const _0x52aea3=_0x43a8;_0x5e8350[_0x52aea3(0xf7)]({'maxAgeMs':_0x12e8b1[_0x52aea3(0x175)]}),_0x32a2e9=_0x31bf97??null,_0x2a8aba=_0x5611fd();if(_0x2a8aba){_0x49e6eb();const _0x41f092=await _0x3d74a2();if(_0x41f092!=null)return _0x41f092;return await _0x31863e(_0x31bf97),null;}const _0x12a147=_0x5e8350[_0x52aea3(0x126)]()||_0x5e8350['latestSnapshotId']();return await _0x1f310d(_0x12a147),null;});},async 'add'(_0x5eba55,_0x1b7cb6,_0x3b1c3d){return _0xf1ae84(async()=>{const _0x173654=_0x43a8;if(!_0x2a8aba){if(!_0x5611fd())return;await _0x5d10f0();}if(!_0x86bebc)return;const _0x79413c=_0x27f84b[_0x173654(0xd1)](_0x5eba55);if(_0x79413c!==undefined)try{_0x86bebc[_0x173654(0x121)](BigInt(_0x79413c));}catch{}const _0x5df022=_0x27f84b[_0x173654(0x116)](_0x5eba55);_0x86bebc['add'](BigInt(_0x5df022),_0x551e8d(_0x1b7cb6)),_0x157a43++,_0x157a43>=_0x12e8b1[_0x173654(0x115)]&&await _0x270923(_0x3b1c3d??Date[_0x173654(0xcd)]());});},async 'remove'(_0x996c74){return _0xf1ae84(async()=>{const _0x39163f=_0x43a8;if(!_0x2a8aba){if(!_0x5611fd())return;await _0x5d10f0();}if(!_0x86bebc)return;const _0xeeed9b=_0x27f84b['labelForExisting'](_0x996c74);if(_0xeeed9b===undefined)return;try{_0x86bebc[_0x39163f(0x121)](BigInt(_0xeeed9b));}catch{}_0x27f84b[_0x39163f(0x110)](_0x996c74),_0x157a43++;});},'search'(_0x3487ff,{limit:limit=0xa}={}){const _0x43f8d8=_0x69d16f;if(!_0x2a8aba)_0x52d528();if(!_0x86bebc)return[];const _0x2ea4d8=_0x86bebc[_0x43f8d8(0xcf)]();if(_0x2ea4d8===0x0)return[];const _0x4d0104=Math['min'](limit,_0x2ea4d8),_0x1add19=_0x86bebc[_0x43f8d8(0x13a)](_0x551e8d(_0x3487ff),_0x4d0104,0x0),_0x4571ab=[],_0x54c015=_0x1add19[_0x43f8d8(0xe5)],_0x5160b6=_0x1add19[_0x43f8d8(0x17c)];for(let _0x30aa86=0x0;_0x30aa86<_0x54c015[_0x43f8d8(0x13c)];_0x30aa86++){const _0x4ca0ef=_0x54c015[_0x30aa86];if(_0x4ca0ef===0xffffffffffffffffn)continue;const _0x427d2=Number(_0x4ca0ef),_0x337641=_0x27f84b[_0x43f8d8(0x15f)](_0x427d2);if(!_0x337641)continue;const _0x3b4f92=_0x5160b6[_0x30aa86];let _0xc4624d;if(_0x12e8b1[_0x43f8d8(0x16c)]===_0x43f8d8(0x10f))_0xc4624d=Math['max'](0x0,0x1-_0x3b4f92);else{if(_0x12e8b1['metric']==='ip')_0xc4624d=-_0x3b4f92;else _0xc4624d=0x1/(0x1+_0x3b4f92);}_0x4571ab[_0x43f8d8(0xc9)]({'key':_0x337641,'score':_0xc4624d});}return _0x4571ab;},async 'snapshot'(_0x546fbd=Date[_0x69d16f(0xcd)]()){if(!_0x2a8aba)return![];return _0xf1ae84(()=>_0x270923(_0x546fbd));},async 'rebuild'(_0x14337a){if(!_0x2a8aba)return;return _0xf1ae84(()=>{if(_0x14337a!=null)_0x32a2e9=_0x14337a;return _0x31863e(_0x14337a??_0x32a2e9);});},async 'stop'(){return _0xf1ae84(async()=>{const _0x59f414=_0x43a8;_0x2a8aba&&(await _0x270923(Date[_0x59f414(0xcd)]()),_0x49a610());});},'count'(){return _0x27f84b['size']();},'info'(){const _0x1e95b1=_0x69d16f;return{'algorithm':_0x1e95b1(0x12c),'role':_0x2a8aba?_0x1e95b1(0x100):_0x1e95b1(0x15c),'metric':_0x12e8b1[_0x1e95b1(0x16c)],'connectivity':_0x12e8b1[_0x1e95b1(0x15d)],'expansionAdd':_0x12e8b1['expansionAdd'],'expansionSearch':_0x12e8b1[_0x1e95b1(0x140)],'count':_0x27f84b['size'](),'size':_0x86bebc?.[_0x1e95b1(0xcf)]?.()??0x0,'capacity':_0x86bebc?.[_0x1e95b1(0xce)]?.()??0x0,'changesSince':_0x2a8aba?_0x157a43:null,'viewedSnapshot':_0x33bc09??null,'snapshotDir':_0x146dea,'latestSnapshot':_0x5e8350['readCurrentId']()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0x2fbd0d=_0x67fb04;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0xbbf7bd,workerData:_0xc1f151}=require$$0$1,{algorithmName:_0x3b8ad9,algorithmConfig:_0x278670,dims:_0x4a2d69,dir:_0x2ee404}=_0xc1f151;let _0x312b03;if(_0x3b8ad9==='hnsw')_0x312b03=requireHnsw()(_0x278670,{'dims':_0x4a2d69,'dir':_0x2ee404});else{if(_0x3b8ad9===_0x2fbd0d(0x11d))_0x312b03=requireFlat()(_0x278670,{'dims':_0x4a2d69,'dir':_0x2ee404});else{if(_0x3b8ad9===_0x2fbd0d(0x12c))_0x312b03=requireUsearch()(_0x278670,{'dims':_0x4a2d69,'dir':_0x2ee404});else throw new Error(_0x2fbd0d(0xff)+_0x3b8ad9+'\x22');}}function _0x289b52(){const _0x19877a=_0x2fbd0d;try{_0xbbf7bd['postMessage']({'op':_0x19877a(0x108),'count':_0x312b03[_0x19877a(0x13e)](),'info':_0x312b03[_0x19877a(0x14f)](),'memory':process[_0x19877a(0xf5)]()});}catch{}}return _0xbbf7bd['on']('message',async _0x40f1aa=>{const _0x57654e=_0x2fbd0d,{id:_0x4385cc,op:_0x453618,args:_0x580016}=_0x40f1aa;try{let _0x2745d8;switch(_0x453618){case'load':{const _0x23a692=(_0x580016[_0x57654e(0xe9)]||[])[_0x57654e(0x109)](_0xaa6d65=>({'key':_0xaa6d65[_0x57654e(0x162)],'vector':_0xaa6d65[_0x57654e(0x143)]instanceof Float32Array?_0xaa6d65[_0x57654e(0x143)]:new Float32Array(_0xaa6d65[_0x57654e(0x143)])}));_0x2745d8=await _0x312b03[_0x57654e(0x156)](async()=>_0x23a692),_0x289b52();break;}case _0x57654e(0x16b):{const _0x4648a0=_0x580016[_0x57654e(0x143)]instanceof Float32Array?_0x580016[_0x57654e(0x143)]:new Float32Array(_0x580016[_0x57654e(0x143)]);await _0x312b03[_0x57654e(0x16b)](_0x580016[_0x57654e(0x162)],_0x4648a0,_0x580016[_0x57654e(0x13b)]??undefined),_0x289b52(),_0x2745d8=null;break;}case'remove':{await _0x312b03['remove'](_0x580016[_0x57654e(0x162)]),_0x289b52(),_0x2745d8=null;break;}case _0x57654e(0x13a):{const _0x301c5=_0x580016[_0x57654e(0xcc)]instanceof Float32Array?_0x580016[_0x57654e(0xcc)]:new Float32Array(_0x580016[_0x57654e(0xcc)]);_0x2745d8=_0x312b03['search'](_0x301c5,_0x580016['opts']||{});break;}case'snapshot':{_0x2745d8=await _0x312b03[_0x57654e(0x131)](_0x580016[_0x57654e(0x13b)]),_0x289b52();break;}case _0x57654e(0x16e):{const _0xe3aa33=(_0x580016[_0x57654e(0xe9)]||[])[_0x57654e(0x109)](_0x49f8d1=>({'key':_0x49f8d1[_0x57654e(0x162)],'vector':_0x49f8d1[_0x57654e(0x143)]instanceof Float32Array?_0x49f8d1[_0x57654e(0x143)]:new Float32Array(_0x49f8d1[_0x57654e(0x143)])}));await _0x312b03[_0x57654e(0x16e)](async()=>_0xe3aa33),_0x289b52(),_0x2745d8=null;break;}case'stop':{await _0x312b03['stop'](),_0x289b52(),_0x2745d8=null;break;}case _0x57654e(0x13e):{_0x2745d8=_0x312b03[_0x57654e(0x13e)]();break;}case'info':{_0x2745d8=_0x312b03[_0x57654e(0x14f)]();break;}default:throw new Error(_0x57654e(0x15e)+_0x453618+'\x22');}_0xbbf7bd['postMessage']({'id':_0x4385cc,'result':_0x2745d8});}catch(_0x5df0a4){_0xbbf7bd[_0x57654e(0x133)]({'id':_0x4385cc,'error':{'message':_0x5df0a4?.[_0x57654e(0x112)]||String(_0x5df0a4),'code':_0x5df0a4?.['code']}});}}),_0xbbf7bd[_0x2fbd0d(0x133)]({'op':'ready'}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);function _0x5bc2(){const _0x366627=['count','state.json','expansionSearch','efSearch','MetricKind','vector','4KpslQX','6397580jVBEPK','addPoint','heartbeatIntervalMs','isInteger','hnswlib-node','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20','hex','index.hnsw','HierarchicalNSW','clear','info','_tmp-','initIndex','keepSnapshots','labels','algorithm','readIndexSync','load','closeSync','code','ceil',',\x20host:\x20','randomBytes','reader','connectivity','Unknown\x20op:\x20\x22','keyForLabel','growFactor','lock_busy','key','save','F32','EEXIST','nextLabel','keyToLabel','entries','writerLockMaxAgeMs','42gFtsjj','add','metric','prototype','rebuild','HNSW_BINDINGS_UNAVAILABLE','.tmp','loadFrom','_tombstoneCount','trunc','unlinkSync','tmpMaxAgeMs','currentPath','\x20on\x20','arch','writeFileSync','listSnapshotIds','state','distances','pid','USEARCH_BINDINGS_UNAVAILABLE','getMaxElements','crypto','2515742carJEI','setEf','1926736wgtwdz','default','300050iJrkPA','stale','viewRefreshMs','Cos','openSync','readdirSync','push','_snapshotDir','labelToKey','queryVec','now','capacity','size','getCurrentCount','labelForExisting','loadSnapshot','startsWith','existsSync','HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','markDelete','4174983bSvCOm','toString','host','filter','SNAPSHOT.LOCK','L2sq','writeIndexSync','snapshotsDir','worker_threads','published','expansionAdd','[SnapshotStore]','statSync','mtimeMs','keys','utf8','index','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','vectors','manifestVersion','lockPath','ScalarKind','call','_snapshotPaths','exports','snapshot\x20incomplete:\x20','score','platform','isDirectory',').\x20','memoryUsage','min','cleanupTmpDirs','versions','latestSnapshotId','cause','join','prune','round','snapshotTo','Unknown\x20algorithm:\x20\x22','writer','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20','Index','sort','snapshots','node','from','then','sync','map','rmSync','42fRIgLB','maxElements','usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','.tmp-','cosine','tombstone','efConstruction','message','log','Original\x20error:\x20','snapshotEveryChanges','labelForEphemeral','stringify','set','SnapshotStore\x20requires\x20dir','WRITER.LOCK','warn','max','flat','slice','tombstoneCount','4956390ZBMcji','remove','name','readFileSync','1396503qhfmJa','sqrt','readCurrentId','labels.json','resolve','get','reset','parse','usearch','dir','trim','__esModule','unref','snapshot','isFinite','postMessage','publishSnapshot','delete','renameSync','searchKnn','dims','Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20','search','clock','length','mkdirSync'];_0x5bc2=function(){return _0x366627;};return _0x5bc2();}module[_0x67fb04(0xef)]=algorithmWorkerThread;