@moss-js/moss 1.15.0 → 1.16.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/dist/index.esm.js +1 -1
- package/dist/moss.d.ts +25 -2
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function _0x5865(){const _0xd31e47=['moss-core\x20runtime\x20SessionIndex\x20is\x20missing\x20the\x20withAuthenticator\x20factory.\x20Upgrade\x20@moss-js/moss-core\x20to\x20a\x20build\x20that\x20supports\x20custom\x20authenticators\x20for\x20sessions.','embedding','HTTP\x20error!\x20status:\x20','manifestSha256','listWebSources','json','configuredIdentity','Unsupported\x20job\x20status\x20\x27','path','cachePath','5889oECLKR','applySessionIdentity','toByteArray','authUrl','56MlwvPJ','delete','maxPages','respectRobots','moss-minilm','queryText','createIndexFromFiles\x20requires\x20at\x20least\x20one\x20file','test','resolveAuthRequest','normalizeJobStatus','PendingUpload','createIndexFromFiles','withAuthenticator','\x20could\x20not\x20be\x20settled:\x20','fetchAndCache','refreshCadence','\x20must\x20not\x20have\x20leading\x20or\x20trailing\x20whitespace','createIndex','excludePaths','applyIdentity','body','alpha','all','projectKey','deviceIdentity','call','currentPhase','MOSS_CLOUD_API_BASE_URL','_fromInner','getAuthHeader','expiresAt','no\x20exact\x20artifact\x20identity','pendingupload','https://service.usemoss.dev','addDocs\x20requires\x20at\x20least\x20one\x20document','application/json','then','modelId','byteLength','unloadIndex','authNotifyFn','authenticator','status','MossClient\x20is\x20closed','env','Unsupported\x20data\x20type\x20for\x20file\x20upload','progress','asyncDispose','Web\x20source\x20methods\x20require\x20a\x20project\x20key.\x20Construct\x20MossClient\x20with\x20(projectId,\x20projectKey).','sources','unloadIndexes','error','\x20UTF-8\x20bytes','requireMultiIndexCore','inflight','default','MOSS_AUTH_URL','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20MossClient.close()','queryMultiIndexText','utf8','data','function','length','deleteDocs','resync','Failed','The\x20installed\x20@moss-js/moss-core\x20runtime\x20does\x20not\x20support\x20exact\x20model\x20artifact\x20identities.\x20Upgrade\x20moss-core\x20before\x20creating\x20this\x20session.','timeout','stringify','map','parse','minScore','mossDeviceId','getWebSource','\x20must\x20be\x20at\x20most\x20','bind','IndexManager','inner','[moss]\x20Dropping\x20a\x20malformed\x20job\x20progress\x20event;\x20progress\x20reporting\x20may\x20be\x20incomplete\x20for\x20this\x20operation.\x20Cause:\x20','ManageApiError','getDocs','Uploading','startsWith','deviceId','86PZaosg','now','arrayBuffer','cache','expiresIn','text','pending_upload','indexManager','393750gHCouw','moss-core\x20runtime\x20ManageClient/IndexManager\x20is\x20missing\x20withAuthenticator\x20factory.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','addDocs','1577240cghewG','\x22)\x20or\x20loadIndexes([...])\x20before\x20querying;\x20queries\x20run\x20locally\x20and\x20there\x20is\x20no\x20cloud\x20query\x20fallback.','from','loadModel','identity','token','MossClient\x20options.identity.','pushIndex','replace','updateWebSource','query','ManageClient','maxDocuments','Authentication\x20failed\x20(HTTP\x20401):\x20','queryMultiIndex','SessionIndex','Bearer\x20','createIndex\x20requires\x20at\x20least\x20one\x20document','[moss]\x20Ignoring\x20an\x20auth\x20request\x20with\x20no\x20usable\x20request\x20id;\x20custom\x20authentication\x20may\x20be\x20unavailable\x20for\x20this\x20client.\x20Cause:\x20','HTTP\x20','maxDepth','isArray','manageClient','POST','received\x20','\x20Provide\x20a\x20query\x20vector\x20via\x20options.embedding,\x20or\x20use\x20alpha\x200\x20for\x20keyword-only\x20search.','createAuthenticatedSessionInner','loadIndex','_warmModel','loadFromDisk','loadIndexes','CLOUD_API_INDEX_URL','SDK_VERSION_NUMBER','contentType','hasCustomAuthenticator','modelArtifactContractVersion','Index\x20\x22','failed','MossClient\x20options.identity\x20must\x20be\x20an\x20object','toLowerCase','projectId','object','_create','trim','version','deleteDocuments','parseOptions','SessionIndex\x20\x27','moss-core\x20runtime\x20is\x20missing\x20ManageClient/IndexManager\x20exports','indexName','added','includePaths','1684746QCAjQK','This\x20session\x20uses\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20embedding\x20via\x20QueryOptions.embedding.','message','topK','building','createAuthenticatedSessionInner\x20requires\x20a\x20custom\x20IAuthenticator\x20client','getAuthToken','queryMultiIndex\x20requires\x20at\x20least\x20one\x20index\x20name','[moss]\x20Auth\x20request\x20','name','custom','listIndexes','warn','addDocumentsText','jobId','includes','The\x20installed\x20@moss-js/moss-core\x20does\x20not\x20support\x20multi-index\x20operations\x20(queryMultiIndex,\x20loadIndexes,\x20unloadIndexes).\x20Upgrade\x20@moss-js/moss-core.','requires\x20explicit\x20query\x20embeddings','inspectSnapshot','moss-core\x20runtime\x20is\x20missing\x20resolveAuthRequest/rejectAuthRequest\x20exports.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','updated','ensureCachePathDeviceId','deleteDocs\x20requires\x20at\x20least\x20one\x20document\x20ID','wrapProgress','Building','join','setIdentity','Documents\x20missing\x20.embedding\x20for\x20custom\x20model:\x20','uploading','2395638GCaZNE','onProgress','candidateDepth','deref','cachePathDeviceId','close','getIndex','fromEntries','One\x20or\x20more\x20indexes\x20use\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20vector\x20via\x20options.embedding,\x20or\x20use\x20alpha\x200\x20for\x20keyword-only\x20search.','deleteIndex','getJobStatus','string','slice','number','docCount','filter','998187zeMKQN','completed','\x22\x20is\x20not\x20loaded.\x20Call\x20loadIndex(\x22','1615108mirvvS','Completed','isSafeInteger','createWebSource','.\x20All\x20documents\x20must\x20have\x20.embedding\x20set\x20when\x20using\x20modelId=\x27custom\x27.','isFinite','\x27\x20returned\x20by\x20moss-core','\x20must\x20be\x20a\x20non-empty\x20string','saveToDisk','/v1/manage','addDocuments','rejectAuthRequest'];_0x5865=function(){return _0xd31e47;};return _0x5865();}const _0x46a83d=_0xddff;(function(_0x5860ff,_0x3cceb5){const _0x3ef3b4=_0xddff,_0x51f83d=_0x5860ff();while(!![]){try{const _0x22f410=-parseInt(_0x3ef3b4(0x16f))/0x1+-parseInt(_0x3ef3b4(0x1e0))/0x2*(-parseInt(_0x3ef3b4(0x188))/0x3)+-parseInt(_0x3ef3b4(0x172))/0x4+-parseInt(_0x3ef3b4(0x1eb))/0x5+parseInt(_0x3ef3b4(0x1e8))/0x6+parseInt(_0x3ef3b4(0x142))/0x7+parseInt(_0x3ef3b4(0x18c))/0x8*(parseInt(_0x3ef3b4(0x15f))/0x9);if(_0x22f410===_0x3cceb5)break;else _0x51f83d['push'](_0x51f83d['shift']());}catch(_0x2c4ccb){_0x51f83d['push'](_0x51f83d['shift']());}}}(_0x5865,0x82ffe));import{JobStatus as _0x5a2181}from'@moss-js/moss-core';import*as _0x1f1a6f from'@moss-js/moss-core';import*as _0x171d58 from'@moss-js/moss-core';var g=_0x171d58,ae=g['MODEL_DOWNLOAD_URL'],ue=g[_0x46a83d(0x20b)],de=g['CLOUD_API_IDENTITY_URL'],T=g['CLOUD_API_AUTH_URL'],ce=typeof process<'u'&&process[_0x46a83d(0x1b8)]['MOSS_INDEX_URL']||g[_0x46a83d(0x20a)],E=typeof process<'u'?process['env']:{},f=class{constructor(_0x3efcc4,_0x3f0494){const _0x1434a1=_0x46a83d;this['projectId']=_0x3efcc4,this[_0x1434a1(0x1a3)]=_0x3f0494,this[_0x1434a1(0x18b)]=E[_0x1434a1(0x1c4)]??T;}[_0x46a83d(0x213)];[_0x46a83d(0x1a3)];['authUrl'];async[_0x46a83d(0x148)](){const _0x44b57b=_0x46a83d;let _0x18e3e7=await fetch(this[_0x44b57b(0x18b)],{'method':_0x44b57b(0x202),'headers':{'Content-Type':_0x44b57b(0x1af)},'body':JSON[_0x44b57b(0x1d0)]({'projectId':this[_0x44b57b(0x213)],'projectKey':this[_0x44b57b(0x1a3)]}),'signal':AbortSignal['timeout'](0x7530)});if(_0x18e3e7[_0x44b57b(0x1b6)]===0x191){let _0x3a8a36=await _0x18e3e7[_0x44b57b(0x1e5)]();throw new Error(_0x44b57b(0x1f8)+_0x3a8a36);}if(!_0x18e3e7['ok']){let _0x39097c=await _0x18e3e7[_0x44b57b(0x1e5)]();throw new Error(_0x44b57b(0x1fe)+_0x18e3e7[_0x44b57b(0x1b6)]+':\x20'+_0x39097c);}let _0x50dbc1=await _0x18e3e7[_0x44b57b(0x183)]();return{'token':_0x50dbc1[_0x44b57b(0x1f0)],'expiresIn':_0x50dbc1[_0x44b57b(0x1e4)]};}async[_0x46a83d(0x1a9)](){const _0x576801=_0x46a83d;let {token:_0x1b3176}=await this[_0x576801(0x148)]();return'Bearer\x20'+_0x1b3176;}},I=class{constructor(_0x5b376f){const _0x140337=_0x46a83d;this[_0x140337(0x1d9)]=_0x5b376f;}[_0x46a83d(0x1d9)];[_0x46a83d(0x1e3)]=null;[_0x46a83d(0x1c2)]=null;async[_0x46a83d(0x148)](){const _0x36ba65=_0x46a83d;if(this[_0x36ba65(0x1e3)]&&this[_0x36ba65(0x1e3)][_0x36ba65(0x1aa)]>Date[_0x36ba65(0x1e1)]())return{'token':this[_0x36ba65(0x1e3)][_0x36ba65(0x1f0)],'expiresIn':this[_0x36ba65(0x1e3)][_0x36ba65(0x1e4)]};if(this[_0x36ba65(0x1c2)])return this[_0x36ba65(0x1c2)];this['inflight']=this[_0x36ba65(0x19a)]();try{return await this[_0x36ba65(0x1c2)];}finally{this['inflight']=null;}}async[_0x46a83d(0x1a9)](){let {token:_0x388eb3}=await this['getAuthToken']();return'Bearer\x20'+_0x388eb3;}async[_0x46a83d(0x19a)](){const _0x21fc57=_0x46a83d;let {token:_0x3d4fbf,expiresIn:_0x3e2379}=await this['inner']['getAuthToken'](),_0xb882e1=Date[_0x21fc57(0x1e1)]()+(_0x3e2379-0x3c)*0x3e8;return this[_0x21fc57(0x1e3)]={'token':_0x3d4fbf,'expiresIn':_0x3e2379,'expiresAt':_0xb882e1},{'token':_0x3d4fbf,'expiresIn':_0x3e2379};}};import{randomUUID as _0x3b74d0}from'node:crypto';import{existsSync as _0x4d2da1,mkdirSync as _0x466ae4,readFileSync as _0x431bad,writeFileSync as _0x21360b}from'node:fs';import{join as _0x13aeed}from'node:path';var z='.moss-device-id',S=0x100,k=/[\p{Cc}\p{Cf}\p{Cs}\uFFFD]/u;function Y(_0x23d30a){const _0x121e7f=_0x46a83d;return _0x23d30a['length']>0x0&&_0x23d30a[_0x121e7f(0x216)]()===_0x23d30a&&!k[_0x121e7f(0x193)](_0x23d30a)&&new TextEncoder()['encode'](_0x23d30a)[_0x121e7f(0x1b2)]<=S;}function _(_0x30ba72,_0x2e8f88){const _0x43a7e8=_0x46a83d;if(_0x30ba72!==void 0x0){if(typeof _0x30ba72!=_0x43a7e8(0x16a)||_0x30ba72['length']===0x0)throw new TypeError(_0x43a7e8(0x1f1)+_0x2e8f88+_0x43a7e8(0x179));if(_0x30ba72['trim']()!==_0x30ba72)throw new TypeError(_0x43a7e8(0x1f1)+_0x2e8f88+_0x43a7e8(0x19c));if(k[_0x43a7e8(0x193)](_0x30ba72))throw new TypeError(_0x43a7e8(0x1f1)+_0x2e8f88+'\x20contains\x20an\x20unsupported\x20character');if(new TextEncoder()['encode'](_0x30ba72)[_0x43a7e8(0x1b2)]>S)throw new TypeError(_0x43a7e8(0x1f1)+_0x2e8f88+_0x43a7e8(0x1d6)+S+_0x43a7e8(0x1c0));return _0x30ba72;}}function U(_0x41a35f){const _0x79ef9b=_0x46a83d;if(_0x41a35f!==void 0x0){if(_0x41a35f===null||typeof _0x41a35f!=_0x79ef9b(0x214)||Array[_0x79ef9b(0x200)](_0x41a35f))throw new TypeError(_0x79ef9b(0x211));return Object['freeze']({'deviceId':_(_0x41a35f['deviceId'],_0x79ef9b(0x1df)),'userId':_(_0x41a35f['userId'],'userId')});}}function q(_0x16b90e){const _0x45f15b=_0x46a83d;return _0x16b90e?.[_0x45f15b(0x1df)]!==void 0x0||_0x16b90e?.['userId']!==void 0x0;}function M(_0x158771){const _0x4a81d7=_0x46a83d;if(!_0x158771?.['trim']())return;let _0xd037a6=_0x13aeed(_0x158771,z);try{if(_0x4d2da1(_0xd037a6)){let _0x58fe3b=_0x431bad(_0xd037a6,_0x4a81d7(0x1c7))[_0x4a81d7(0x216)]();return Y(_0x58fe3b)?_0x58fe3b:void 0x0;}_0x466ae4(_0x158771,{'recursive':!0x0});let _0x11b932=_0x3b74d0();return _0x21360b(_0xd037a6,_0x11b932,_0x4a81d7(0x1c7)),_0x11b932;}catch{return;}}var Z=0x1;function y(_0x2572bd){const _0x4762fb=_0x46a83d;let _0x41402d=_0x2572bd[_0x4762fb(0x20e)];if(typeof _0x41402d!=_0x4762fb(0x1c9))throw L();let _0x2aa4a9=_0x41402d[_0x4762fb(0x1a5)](_0x2572bd);if(!Number[_0x4762fb(0x174)](_0x2aa4a9)||_0x2aa4a9<Z)throw L();}function L(){const _0xa2981=_0x46a83d;return new Error(_0xa2981(0x1ce));}var xe=0x708*0x3e8;function x(_0x38b551){const _0x34afb3=_0x46a83d;if(!(_0x38b551?.['minScore']===void 0x0&&_0x38b551?.[_0x34afb3(0x161)]===void 0x0))return{'minScore':_0x38b551[_0x34afb3(0x1d3)],'candidateDepth':_0x38b551[_0x34afb3(0x161)]};}function A(_0x28596b){const _0x2e69b7=_0x46a83d;return _0x28596b instanceof Error?_0x28596b[_0x2e69b7(0x144)]:String(_0x28596b);}function _0xddff(_0x3b6774,_0x309031){_0x3b6774=_0x3b6774-0x141;const _0x586501=_0x5865();let _0xddff50=_0x586501[_0x3b6774];return _0xddff50;}function ee(_0x1f0cfd){const _0x2b2511=_0x46a83d;if(_0x1f0cfd===null||typeof _0x1f0cfd!=_0x2b2511(0x214))return _0x2b2511(0x203)+String(_0x1f0cfd);if(Array[_0x2b2511(0x200)](_0x1f0cfd))return'received\x20an\x20array\x20where\x20a\x20JobProgress\x20object\x20was\x20expected';let _0x11ff41=_0x1f0cfd;return typeof _0x11ff41['jobId']!=_0x2b2511(0x16a)||_0x11ff41['jobId'][_0x2b2511(0x1ca)]===0x0?'received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20jobId\x20('+String(_0x11ff41[_0x2b2511(0x150)])+')':typeof _0x11ff41[_0x2b2511(0x1b6)]!=_0x2b2511(0x16a)||_0x11ff41['status'][_0x2b2511(0x1ca)]===0x0?'received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20status\x20('+String(_0x11ff41[_0x2b2511(0x1b6)])+')':typeof _0x11ff41[_0x2b2511(0x1ba)]!=_0x2b2511(0x16c)||!Number[_0x2b2511(0x177)](_0x11ff41['progress'])?'received\x20a\x20progress\x20event\x20with\x20a\x20non-finite\x20progress\x20value\x20('+String(_0x11ff41[_0x2b2511(0x1ba)])+')':_0x11ff41['currentPhase']!==void 0x0&&_0x11ff41[_0x2b2511(0x1a6)]!==null&&typeof _0x11ff41[_0x2b2511(0x1a6)]!='string'?'received\x20a\x20progress\x20event\x20with\x20a\x20non-string\x20currentPhase\x20('+String(_0x11ff41[_0x2b2511(0x1a6)])+')':null;}var b=class{['authenticator'];[_0x46a83d(0x201)];[_0x46a83d(0x1e7)];[_0x46a83d(0x163)];[_0x46a83d(0x184)];['projectId'];[_0x46a83d(0x1b4)];constructor(_0xc4f53d,_0x146818,_0x7c846f){const _0x2ded6e=_0x46a83d;this['configuredIdentity']=U(_0x7c846f?.[_0x2ded6e(0x1ef)]),this[_0x2ded6e(0x163)]=M(_0x7c846f?.[_0x2ded6e(0x187)]),this[_0x2ded6e(0x213)]=_0xc4f53d;let _0x4b6942=typeof _0x146818==_0x2ded6e(0x16a)?new f(_0xc4f53d,_0x146818):_0x146818;this['authenticator']=new I(_0x4b6942);let _0x211416=_0x1f1a6f,_0x4900e3=_0x211416[_0x2ded6e(0x1f6)]??_0x211416['default']?.[_0x2ded6e(0x1f6)],_0x3946dd=_0x211416[_0x2ded6e(0x1d8)]??_0x211416[_0x2ded6e(0x1c3)]?.[_0x2ded6e(0x1d8)];if(!_0x4900e3||!_0x3946dd)throw new Error(_0x2ded6e(0x21b));if(typeof _0x146818=='string')this[_0x2ded6e(0x201)]=new _0x4900e3(_0xc4f53d,_0x146818),this[_0x2ded6e(0x1e7)]=new _0x3946dd(_0xc4f53d,_0x146818);else{let _0x3105de=_0x211416[_0x2ded6e(0x194)]??_0x211416[_0x2ded6e(0x1c3)]?.['resolveAuthRequest'],_0x5c8737=_0x211416[_0x2ded6e(0x17d)]??_0x211416['default']?.[_0x2ded6e(0x17d)];if(!_0x3105de||!_0x5c8737)throw new Error(_0x2ded6e(0x155));let _0x1e7dcc=this[_0x2ded6e(0x1b5)],_0x513eba=(_0x15652b,_0x245096)=>{const _0x40e859=_0x2ded6e;try{_0x5c8737(_0x15652b,_0x245096);}catch(_0x2661a0){console[_0x40e859(0x14e)](_0x40e859(0x14a)+_0x15652b+_0x40e859(0x199)+A(_0x2661a0));}},_0x59c2e3=(_0x324b04,_0x383566)=>{try{_0x3105de(_0x324b04,_0x383566);}catch(_0x4e1680){_0x513eba(_0x324b04,'moss-core\x20rejected\x20the\x20auth\x20token:\x20'+A(_0x4e1680));}},_0x157fc4=!0x1,_0x4f0511=(_0x4e79b1,_0x209bca)=>{const _0x4c4e05=_0x2ded6e;if(_0x4e79b1||!Number[_0x4c4e05(0x174)](_0x209bca)||_0x209bca<0x0){_0x157fc4||(_0x157fc4=!0x0,console[_0x4c4e05(0x14e)](_0x4c4e05(0x1fd)+(_0x4e79b1?_0x4e79b1[_0x4c4e05(0x144)]:_0x4c4e05(0x203)+String(_0x209bca))));return;}_0x1e7dcc[_0x4c4e05(0x1a9)]()[_0x4c4e05(0x1b0)](_0x4144fc=>{const _0x48e550=_0x4c4e05;let _0x5b4233=_0x4144fc[_0x48e550(0x1de)](_0x48e550(0x1fb))?_0x4144fc[_0x48e550(0x16b)](0x7):_0x4144fc;_0x59c2e3(_0x209bca,_0x5b4233);},_0x59f7b7=>_0x513eba(_0x209bca,A(_0x59f7b7)));};this[_0x2ded6e(0x1b4)]=_0x4f0511;let _0xa8ceab=_0x4900e3,_0x284f4f=_0x3946dd;if(!_0xa8ceab['withAuthenticator']||!_0x284f4f[_0x2ded6e(0x198)])throw new Error(_0x2ded6e(0x1e9));this[_0x2ded6e(0x201)]=_0xa8ceab[_0x2ded6e(0x198)](_0xc4f53d,_0x4f0511),this['indexManager']=_0x284f4f[_0x2ded6e(0x198)](_0xc4f53d,_0x4f0511);}this[_0x2ded6e(0x19f)](this[_0x2ded6e(0x1e7)]);}async[_0x46a83d(0x164)](){const _0x26a3d4=_0x46a83d;let _0x4a3bca=this[_0x26a3d4(0x1e7)]['close'];if(typeof _0x4a3bca!=_0x26a3d4(0x1c9))throw new Error(_0x26a3d4(0x1c5));await _0x4a3bca[_0x26a3d4(0x1a5)](this['indexManager']);}async[_0x46a83d(0x148)](){const _0x666c9a=_0x46a83d;return this[_0x666c9a(0x1b5)][_0x666c9a(0x148)]();}[_0x46a83d(0x159)](_0x4c6cdc){if(!_0x4c6cdc)return;let _0x1c2c34=!0x1;return(_0x5ea448,_0x403fc7)=>{const _0x33cf13=_0xddff;let _0x54841d=_0x5ea448?_0x5ea448[_0x33cf13(0x144)]:ee(_0x403fc7);if(_0x54841d!==null){_0x1c2c34||(_0x1c2c34=!0x0,console[_0x33cf13(0x14e)](_0x33cf13(0x1da)+_0x54841d));return;}_0x4c6cdc(_0x403fc7);};}[_0x46a83d(0x195)](_0x334470){const _0x155355=_0x46a83d;let _0x250f41=_0x334470[_0x155355(0x216)]()[_0x155355(0x212)]()['replace'](/\s+/g,'_'),_0x1a4222=_0x250f41[_0x155355(0x1f3)](/_/g,'');if(_0x250f41===_0x155355(0x1e6)||_0x1a4222===_0x155355(0x1ac))return _0x5a2181[_0x155355(0x196)];if(_0x250f41===_0x155355(0x15e))return _0x5a2181[_0x155355(0x1dd)];if(_0x250f41===_0x155355(0x146))return _0x5a2181[_0x155355(0x15a)];if(_0x250f41===_0x155355(0x170))return _0x5a2181[_0x155355(0x173)];if(_0x250f41===_0x155355(0x210))return _0x5a2181[_0x155355(0x1cd)];throw new Error(_0x155355(0x185)+_0x334470+_0x155355(0x178));}async['createIndex'](_0x5525a4,_0x2d4e21,_0x2c8344,_0x2aa729){const _0x312735=_0x46a83d;if(!_0x2d4e21[_0x312735(0x1ca)])throw new Error(_0x312735(0x1fc));return await this[_0x312735(0x201)][_0x312735(0x19d)](_0x5525a4,_0x2d4e21,_0x2c8344,this[_0x312735(0x159)](_0x2aa729?.[_0x312735(0x160)]));}async[_0x46a83d(0x18a)](_0x809009){const _0x20ede=_0x46a83d;if(_0x809009 instanceof Uint8Array)return Array['from'](_0x809009);if(_0x809009 instanceof ArrayBuffer)return Array[_0x20ede(0x1ed)](new Uint8Array(_0x809009));if(typeof _0x809009['arrayBuffer']==_0x20ede(0x1c9)){let _0x2f8424=await _0x809009[_0x20ede(0x1e2)]();return Array[_0x20ede(0x1ed)](new Uint8Array(_0x2f8424));}throw new Error(_0x20ede(0x1b9));}async[_0x46a83d(0x197)](_0x28bf73,_0x39acca,_0x429092){const _0x150454=_0x46a83d;if(_0x39acca[_0x150454(0x1ca)]===0x0)throw new Error(_0x150454(0x192));let _0x21e199=_0x429092?.[_0x150454(0x1b1)]??_0x150454(0x190),_0xd9adbe=await Promise[_0x150454(0x1a2)](_0x39acca[_0x150454(0x1d1)](async _0x50a7ec=>({'name':_0x50a7ec[_0x150454(0x14b)],'contentType':_0x50a7ec[_0x150454(0x20c)],'path':_0x50a7ec[_0x150454(0x186)]??void 0x0,'data':_0x50a7ec[_0x150454(0x1c8)]!=null?await this[_0x150454(0x18a)](_0x50a7ec[_0x150454(0x1c8)]):void 0x0})));return await this[_0x150454(0x201)][_0x150454(0x197)](_0x28bf73,_0xd9adbe,_0x21e199,this[_0x150454(0x159)](_0x429092?.[_0x150454(0x160)]),_0x429092?.[_0x150454(0x219)]??null);}async[_0x46a83d(0x1ea)](_0x447b2b,_0x362285,_0x4c3681){const _0xd8bc4f=_0x46a83d;if(Array[_0xd8bc4f(0x200)](_0x362285)&&_0x362285['length']===0x0)throw new Error(_0xd8bc4f(0x1ae));return await this['manageClient'][_0xd8bc4f(0x1ea)](_0x447b2b,_0x362285,_0x4c3681??null,this['wrapProgress'](_0x4c3681?.[_0xd8bc4f(0x160)]));}async[_0x46a83d(0x1cb)](_0x2c4133,_0x24cddb,_0x52bf73){const _0x4c8223=_0x46a83d;if(Array['isArray'](_0x24cddb)&&_0x24cddb[_0x4c8223(0x1ca)]===0x0)throw new Error(_0x4c8223(0x158));return await this[_0x4c8223(0x201)][_0x4c8223(0x1cb)](_0x2c4133,_0x24cddb,this[_0x4c8223(0x159)](_0x52bf73?.[_0x4c8223(0x160)]));}async[_0x46a83d(0x169)](_0x54147f){const _0x1bed93=_0x46a83d;let _0xe6b5fa=await this[_0x1bed93(0x201)][_0x1bed93(0x169)](_0x54147f);return{..._0xe6b5fa,'status':this['normalizeJobStatus'](_0xe6b5fa[_0x1bed93(0x1b6)]),'currentPhase':_0xe6b5fa[_0x1bed93(0x1a6)]??null,'error':_0xe6b5fa[_0x1bed93(0x1bf)]??null};}async['getIndex'](_0x23ba4c){const _0x3bf8fe=_0x46a83d;return this[_0x3bf8fe(0x201)][_0x3bf8fe(0x165)](_0x23ba4c);}async['listIndexes'](){const _0x1fbd1e=_0x46a83d;return this[_0x1fbd1e(0x201)][_0x1fbd1e(0x14d)]();}async[_0x46a83d(0x168)](_0x45f973){const _0x235f98=_0x46a83d;return this[_0x235f98(0x201)][_0x235f98(0x168)](_0x45f973);}async[_0x46a83d(0x1dc)](_0x30c64a,_0x200233){const _0x1ef1a4=_0x46a83d;return this[_0x1ef1a4(0x201)]['getDocs'](_0x30c64a,_0x200233??null);}async['loadIndex'](_0x2904f3,_0x1c232a){const _0x30642f=_0x46a83d;return this[_0x30642f(0x157)](_0x1c232a?.[_0x30642f(0x187)]),(await this[_0x30642f(0x1e7)][_0x30642f(0x206)](_0x2904f3,_0x1c232a??null))[_0x30642f(0x14b)];}async['loadIndexes'](_0x5862b1,_0x363f59){const _0x4fc802=_0x46a83d;let _0xc88f04=this[_0x4fc802(0x1c1)]();return this[_0x4fc802(0x157)](_0x363f59?.[_0x4fc802(0x187)]),_0xc88f04[_0x4fc802(0x209)](_0x5862b1,_0x363f59??null);}async[_0x46a83d(0x1b3)](_0x2bd1e6){const _0x50af75=_0x46a83d;return this['indexManager'][_0x50af75(0x1b3)](_0x2bd1e6);}async['unloadIndexes'](_0x9f1cfe){const _0xd6c23=_0x46a83d;return this[_0xd6c23(0x1c1)]()[_0xd6c23(0x1be)](_0x9f1cfe);}[_0x46a83d(0x1c1)](){const _0x48e9fe=_0x46a83d;let _0x2d3692=this['indexManager'];if(typeof _0x2d3692['queryMultiIndex']!='function'||typeof _0x2d3692['queryMultiIndexText']!=_0x48e9fe(0x1c9)||typeof _0x2d3692[_0x48e9fe(0x209)]!=_0x48e9fe(0x1c9)||typeof _0x2d3692['unloadIndexes']!=_0x48e9fe(0x1c9))throw new Error(_0x48e9fe(0x152));return{'queryMultiIndex':_0x2d3692[_0x48e9fe(0x1f9)][_0x48e9fe(0x1d7)](_0x2d3692),'queryMultiIndexText':_0x2d3692['queryMultiIndexText'][_0x48e9fe(0x1d7)](_0x2d3692),'loadIndexes':_0x2d3692['loadIndexes'][_0x48e9fe(0x1d7)](_0x2d3692),'unloadIndexes':_0x2d3692['unloadIndexes']['bind'](_0x2d3692)};}['ensureCachePathDeviceId'](_0x27ac17){const _0x5e1bb0=_0x46a83d;_0x27ac17&&this[_0x5e1bb0(0x163)]===void 0x0&&M(_0x27ac17);}[_0x46a83d(0x19f)]=_0x565d4f=>{const _0x2ba277=_0x46a83d;!q(this['configuredIdentity'])&&this[_0x2ba277(0x163)]===void 0x0||_0x565d4f[_0x2ba277(0x15c)](this[_0x2ba277(0x184)]?.[_0x2ba277(0x1df)]??null,this['configuredIdentity']?.['userId']??null,this[_0x2ba277(0x163)]??null);};[_0x46a83d(0x189)]=_0x31bbba=>{const _0x74fa4a=_0x46a83d;let _0x264ac3=this['indexManager'][_0x74fa4a(0x1a4)]?.();if(!_0x264ac3){this['applyIdentity'](_0x31bbba);return;}_0x31bbba[_0x74fa4a(0x15c)](_0x264ac3[_0x74fa4a(0x1df)]??null,this[_0x74fa4a(0x184)]?.['userId']??null,_0x264ac3[_0x74fa4a(0x1d4)]??null);};[_0x46a83d(0x20d)](){return this['authNotifyFn']!==void 0x0;}async[_0x46a83d(0x205)](_0x57e657,_0x2ca807,_0xe56b50){const _0xa432b4=_0x46a83d;if(!this[_0xa432b4(0x1b4)])throw new Error(_0xa432b4(0x147));let _0x5dc09b=_0x1f1a6f,_0x15a459=_0x5dc09b[_0xa432b4(0x1fa)]??_0x5dc09b[_0xa432b4(0x1c3)]?.[_0xa432b4(0x1fa)];if(!_0x15a459||typeof _0x15a459[_0xa432b4(0x198)]!=_0xa432b4(0x1c9))throw new Error(_0xa432b4(0x17e));return _0xe56b50&&y(_0x15a459),_0x15a459[_0xa432b4(0x198)](_0x57e657,_0x2ca807,this[_0xa432b4(0x213)],this['authNotifyFn'],null,null,_0xe56b50?.[_0xa432b4(0x217)]??null,_0xe56b50?.[_0xa432b4(0x181)]??null);}async[_0x46a83d(0x1f5)](_0x34c29e,_0x30e043,_0x11b5a8){const _0x599233=_0x46a83d;if(!await this[_0x599233(0x1e7)]['hasIndex'](_0x34c29e))throw new Error(_0x599233(0x20f)+_0x34c29e+_0x599233(0x171)+_0x34c29e+_0x599233(0x1ec));let _0x12406f=_0x11b5a8?.[_0x599233(0x145)]??0x5,_0x3d6ca7=_0x11b5a8?.[_0x599233(0x1a1)]??0.8;return _0x11b5a8?.[_0x599233(0x17f)]?this[_0x599233(0x1e7)][_0x599233(0x1f5)](_0x34c29e,_0x30e043,_0x11b5a8['embedding'],_0x12406f,_0x3d6ca7,_0x11b5a8?.[_0x599233(0x16e)],x(_0x11b5a8)):this['indexManager']['queryText'](_0x34c29e,_0x30e043,_0x12406f,_0x3d6ca7,_0x11b5a8?.[_0x599233(0x16e)],x(_0x11b5a8));}async[_0x46a83d(0x1f9)](_0x59e202,_0x356645,_0x5cd60b){const _0xf5a7be=_0x46a83d;if(_0x59e202[_0xf5a7be(0x1ca)]===0x0)throw new Error(_0xf5a7be(0x149));let _0x3f1e23=this[_0xf5a7be(0x1c1)](),_0x56a85d=_0x5cd60b?.['topK']??0xa,_0x2c17ec=_0x5cd60b?.[_0xf5a7be(0x1a1)]??0.8;if(_0x5cd60b?.['embedding'])return _0x3f1e23[_0xf5a7be(0x1f9)](_0x59e202,_0x356645,_0x5cd60b[_0xf5a7be(0x17f)],_0x56a85d,_0x2c17ec,_0x5cd60b?.[_0xf5a7be(0x16e)],x(_0x5cd60b));try{return await _0x3f1e23[_0xf5a7be(0x1c6)](_0x59e202,_0x356645,_0x56a85d,_0x2c17ec,_0x5cd60b?.['filter'],x(_0x5cd60b));}catch(_0x314c60){throw _0x314c60 instanceof Error&&_0x314c60['message'][_0xf5a7be(0x151)](_0xf5a7be(0x1ab))?new Error(_0x314c60[_0xf5a7be(0x144)]+_0xf5a7be(0x204),{'cause':_0x314c60}):_0x314c60 instanceof Error&&_0x314c60[_0xf5a7be(0x144)][_0xf5a7be(0x151)](_0xf5a7be(0x153))?new Error(_0xf5a7be(0x167),{'cause':_0x314c60}):_0x314c60;}}};import{SessionIndex as _0x299e9a}from'@moss-js/moss-core';var h=class r{#e;#r;#s;#i=!0x1;#a;constructor(_0xfd2256,_0x2af824,_0x27bbc3){this.#s=_0xfd2256,this.#r=_0x2af824,this.#e=_0x27bbc3;}static async['_create'](_0x2139f2,_0x4aaf78,_0x15ccd3,_0x4150bf,_0x235906,_0x8e8fc,_0x22af73){const _0x254cc8=_0x46a83d;let _0x313c28=_0x299e9a;_0x22af73&&y(_0x313c28);let _0x10a7bb=await _0x313c28['create'](_0x2139f2,_0x4aaf78,_0x15ccd3,_0x4150bf,_0x235906??null,_0x22af73?.[_0x254cc8(0x217)]??null,_0x22af73?.[_0x254cc8(0x181)]??null);return r[_0x254cc8(0x1a8)](_0x2139f2,_0x4aaf78,_0x10a7bb,_0x8e8fc);}static[_0x46a83d(0x1a8)](_0x3be776,_0x44a783,_0x291790,_0x148c3e){return _0x148c3e?.(_0x291790),new r(_0x3be776,_0x44a783,_0x291790);}get['name'](){return this.#s;}get[_0x46a83d(0x16d)](){const _0x1c39b0=_0x46a83d;return this.#n(),this.#e[_0x1c39b0(0x16d)];}get[_0x46a83d(0x1b1)](){return this.#r;}async['addDocs'](_0x326fe4,_0x3c15c9){const _0x21cb4a=_0x46a83d;this.#n();let _0x1fb7e5=_0x3c15c9?{'upsert':_0x3c15c9['upsert']??!0x0}:void 0x0;if(this.#r==='custom'){let _0x13c36e=r.#t(_0x326fe4),_0x573f91=_0x326fe4['map'](_0x10c08f=>{const _0x2776fd=_0xddff;let _0x25ae62={..._0x10c08f};return delete _0x25ae62[_0x2776fd(0x17f)],_0x25ae62;}),_0x5462bf=await this.#e[_0x21cb4a(0x17c)](_0x573f91,_0x13c36e,_0x1fb7e5);return{'added':_0x5462bf[_0x21cb4a(0x21d)],'updated':_0x5462bf[_0x21cb4a(0x156)]};}let _0x36a41d=await this.#e[_0x21cb4a(0x14f)](_0x326fe4,_0x1fb7e5);return{'added':_0x36a41d[_0x21cb4a(0x21d)],'updated':_0x36a41d['updated']};}async['deleteDocs'](_0x5d72a6){const _0x2d5539=_0x46a83d;return this.#n(),await this.#e[_0x2d5539(0x218)](_0x5d72a6);}async[_0x46a83d(0x1dc)](_0x7a303c){return this.#n(),await this.#e['getDocuments'](_0x7a303c??null);}async['query'](_0x45989c,_0x420ea1){const _0x5f2fc9=_0x46a83d;this.#n();let _0x34ed1f=_0x420ea1?.[_0x5f2fc9(0x145)]??0x5,_0x55f937=_0x420ea1?.[_0x5f2fc9(0x1a1)]??0.8,_0x67bbb7=_0x420ea1?.[_0x5f2fc9(0x16e)]??null,_0x4a3e3a=_0x420ea1?.[_0x5f2fc9(0x17f)];if(_0x4a3e3a==null){if(this.#r===_0x5f2fc9(0x14c))throw new Error(_0x5f2fc9(0x143));return await this.#e[_0x5f2fc9(0x191)](_0x45989c,_0x34ed1f,_0x55f937,_0x67bbb7);}return await this.#e[_0x5f2fc9(0x1f5)](_0x45989c,_0x34ed1f,Array[_0x5f2fc9(0x1ed)](_0x4a3e3a),_0x55f937,_0x67bbb7);}async[_0x46a83d(0x206)](_0x41b2c2,_0x3258a7){const _0x4d16a9=_0x46a83d;return this.#n(),this.#e[_0x4d16a9(0x206)](_0x41b2c2,_0x3258a7??null);}async[_0x46a83d(0x1f2)](){const _0x745f16=_0x46a83d;return this.#n(),this.#e[_0x745f16(0x1f2)]();}async[_0x46a83d(0x17a)](_0x2c5ddf){const _0x2666a9=_0x46a83d;this.#n(),await this.#e[_0x2666a9(0x17a)](_0x2c5ddf);}async[_0x46a83d(0x208)](_0x3e2c76,_0x2fbbcf){const _0xa54195=_0x46a83d;this.#n();let _0x2ad015=_0x2fbbcf?.['rebuildLegacy']??!0x0;return await this.#e[_0xa54195(0x208)](_0x3e2c76,{'rebuildLegacy':_0x2ad015});}async[_0x46a83d(0x154)](_0x424a8f){const _0x255492=_0x46a83d;return this.#n(),await this.#e[_0x255492(0x154)](_0x424a8f);}#n(){const _0x39f651=_0x46a83d;if(this.#i)throw new Error(_0x39f651(0x21a)+this.#s+'\x27\x20is\x20closed');}[_0x46a83d(0x164)](){return this.#a??=this.#o(),this.#a;}async #o(){const _0x4822ad=_0x46a83d;this.#i=!0x0;let _0x3f1d05=this.#e[_0x4822ad(0x164)];if(typeof _0x3f1d05!=_0x4822ad(0x1c9))throw new Error('@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20SessionIndex.close()');await _0x3f1d05['call'](this.#e);}async[Symbol[_0x46a83d(0x1bb)]](){const _0x34f63d=_0x46a83d;return this[_0x34f63d(0x164)]();}async[_0x46a83d(0x207)](){const _0x40364e=_0x46a83d;this.#n(),this.#r!==_0x40364e(0x14c)&&await this.#e[_0x40364e(0x1ee)]();}static#t(_0x562664){const _0x4dc0c2=_0x46a83d;let _0x55c213=_0x562664[_0x4dc0c2(0x16e)](_0xc35080=>!_0xc35080['embedding']||_0xc35080[_0x4dc0c2(0x17f)][_0x4dc0c2(0x1ca)]===0x0)[_0x4dc0c2(0x1d1)](_0x582d4b=>_0x582d4b['id']);if(_0x55c213[_0x4dc0c2(0x1ca)]>0x0)throw new Error(_0x4dc0c2(0x15d)+_0x55c213[_0x4dc0c2(0x15b)](',\x20')+_0x4dc0c2(0x176));return _0x562664[_0x4dc0c2(0x1d1)](_0x587fee=>Array['from'](_0x587fee[_0x4dc0c2(0x17f)]??[]));}};import{validateIndexName as _0x13890c}from'@moss-js/moss-core';var ne=_0x46a83d(0x1ad),re=_0x46a83d(0x17b),w=class extends Error{[_0x46a83d(0x1b6)];[_0x46a83d(0x1a0)];constructor(_0x324ea7,_0x502cba){const _0x516f7f=_0x46a83d;let _0x260b5=_0x502cba?':\x20'+_0x502cba:'';super(_0x516f7f(0x180)+_0x324ea7+_0x260b5),this['name']=_0x516f7f(0x1db),this[_0x516f7f(0x1b6)]=_0x324ea7,this[_0x516f7f(0x1a0)]=_0x502cba;}};function se(){const _0x19e1a2=_0x46a83d;return''+(typeof process<'u'&&process['env'][_0x19e1a2(0x1a7)]||ne)[_0x19e1a2(0x1f3)](/\/+$/,'')+re;}function oe(_0x3617a1){const _0x4115c2=_0x46a83d;return _0x3617a1?Object[_0x4115c2(0x166)](Object['entries'](_0x3617a1)[_0x4115c2(0x16e)](([,_0x5baf99])=>_0x5baf99!==void 0x0)):{};}async function F(_0x2a06cd,_0x344c19,_0x282889,_0x56e674){const _0x2eb82c=_0x46a83d;let _0x3a0c4a={...oe(_0x56e674),'action':_0x282889,'projectId':_0x2a06cd},_0x519d2f=await fetch(se(),{'method':_0x2eb82c(0x202),'headers':{'Content-Type':'application/json','X-Project-Key':_0x344c19},'body':JSON[_0x2eb82c(0x1d0)](_0x3a0c4a),'signal':AbortSignal[_0x2eb82c(0x1cf)](0x927c0)}),_0x4b4cf5=await _0x519d2f[_0x2eb82c(0x1e5)]();if(!_0x519d2f['ok'])throw new w(_0x519d2f[_0x2eb82c(0x1b6)],_0x4b4cf5);return _0x4b4cf5?JSON[_0x2eb82c(0x1d2)](_0x4b4cf5):{};}var W=_0x46a83d(0x190),D=class{#e;#r;#s;#i=!0x1;#a;#n=new Set();constructor(_0x2a3c28,_0xd00f39,_0x3a710){const _0x4fd41d=_0x46a83d;this.#e=new b(_0x2a3c28,_0xd00f39,_0x3a710),this.#r=_0x2a3c28,this.#s=typeof _0xd00f39==_0x4fd41d(0x16a)?_0xd00f39:null;}async['getAuthToken'](){const _0x18d89a=_0x46a83d;return this.#t(),this.#e[_0x18d89a(0x148)]();}async[_0x46a83d(0x19d)](_0x19aae9,_0x5bd27f,_0x350e87){const _0x42f074=_0x46a83d;this.#t();let _0x587134;return _0x350e87?.[_0x42f074(0x1b1)]!==void 0x0?_0x587134=_0x350e87[_0x42f074(0x1b1)]:_0x587134=_0x5bd27f['some'](_0x3f8aa7=>Array['isArray'](_0x3f8aa7[_0x42f074(0x17f)])&&_0x3f8aa7[_0x42f074(0x17f)][_0x42f074(0x1ca)]>0x0)?_0x42f074(0x14c):W,this.#e['createIndex'](_0x19aae9,_0x5bd27f,_0x587134,_0x350e87);}async[_0x46a83d(0x197)](_0x4079d9,_0x1f689c,_0x4bd39f){const _0x4ea5f4=_0x46a83d;return this.#t(),this.#e[_0x4ea5f4(0x197)](_0x4079d9,_0x1f689c,_0x4bd39f);}async[_0x46a83d(0x165)](_0x1d4f18){const _0x132bed=_0x46a83d;return this.#t(),this.#e[_0x132bed(0x165)](_0x1d4f18);}async['listIndexes'](){const _0x221b9d=_0x46a83d;return this.#t(),this.#e[_0x221b9d(0x14d)]();}async['deleteIndex'](_0x275d56){const _0x4c121e=_0x46a83d;return this.#t(),this.#e[_0x4c121e(0x168)](_0x275d56);}async[_0x46a83d(0x1ea)](_0x1e06b9,_0x1d0ef7,_0x1c2ac4){const _0x16ac2d=_0x46a83d;return this.#t(),this.#e[_0x16ac2d(0x1ea)](_0x1e06b9,_0x1d0ef7,_0x1c2ac4);}async[_0x46a83d(0x1cb)](_0xa24c13,_0x40bf7b,_0x4bdc26){return this.#t(),this.#e['deleteDocs'](_0xa24c13,_0x40bf7b,_0x4bdc26);}async['getJobStatus'](_0x4074bb){const _0x175c02=_0x46a83d;return this.#t(),this.#e[_0x175c02(0x169)](_0x4074bb);}async['createWebSource'](_0x5bddc9,_0x1af71f,_0x18a2db){const _0x3b32d1=_0x46a83d;return this.#t(),_0x13890c(_0x1af71f),this.#o(_0x3b32d1(0x175),{'rootUrl':_0x5bddc9,'indexName':_0x1af71f,'maxPages':_0x18a2db?.[_0x3b32d1(0x18e)],'maxDocuments':_0x18a2db?.[_0x3b32d1(0x1f7)],'maxDepth':_0x18a2db?.[_0x3b32d1(0x1ff)],'includePaths':_0x18a2db?.[_0x3b32d1(0x141)],'excludePaths':_0x18a2db?.[_0x3b32d1(0x19e)],'respectRobots':_0x18a2db?.[_0x3b32d1(0x18f)],'parseDocuments':_0x18a2db?.['parseDocuments'],'refreshCadence':_0x18a2db?.[_0x3b32d1(0x19b)],'modelId':_0x18a2db?.[_0x3b32d1(0x1b1)]});}async['listWebSources'](_0x3d12a8){const _0xd5d590=_0x46a83d;this.#t();let _0x24e645=(await this.#o(_0xd5d590(0x182),_0x3d12a8!==void 0x0?{'indexName':_0x3d12a8}:void 0x0))[_0xd5d590(0x1bd)]??[];return _0x3d12a8===void 0x0?_0x24e645:_0x24e645[_0xd5d590(0x16e)](_0x231aa5=>_0x231aa5[_0xd5d590(0x21c)]===_0x3d12a8);}async[_0x46a83d(0x1d5)](_0x8f33ef){const _0x3bd6b3=_0x46a83d;return this.#t(),this.#o(_0x3bd6b3(0x1d5),{'sourceId':_0x8f33ef});}async[_0x46a83d(0x1f4)](_0x224463,_0x56d1b3){const _0x527b47=_0x46a83d;return this.#t(),this.#o(_0x527b47(0x1f4),{'sourceId':_0x224463,'refreshCadence':_0x56d1b3[_0x527b47(0x19b)],'rootUrl':_0x56d1b3['rootUrl'],'includePaths':_0x56d1b3['includePaths'],'excludePaths':_0x56d1b3[_0x527b47(0x19e)],'maxDepth':_0x56d1b3['maxDepth'],'maxPages':_0x56d1b3[_0x527b47(0x18e)],'resync':_0x56d1b3[_0x527b47(0x1cc)]});}async['resyncWebSource'](_0x55704){return this.#t(),this.#o('resyncWebSource',{'sourceId':_0x55704});}async['deleteWebSource'](_0x5d0322){return this.#t(),this.#o('deleteWebSource',{'sourceId':_0x5d0322});}async #o(_0x726aa7,_0x470e77){const _0x5dfa0c=_0x46a83d;if(this.#s===null)throw new Error(_0x5dfa0c(0x1bc));return F(this.#r,this.#s,_0x726aa7,_0x470e77);}async[_0x46a83d(0x1dc)](_0x1b80a2,_0x463868){const _0x7f31f7=_0x46a83d;return this.#t(),this.#e[_0x7f31f7(0x1dc)](_0x1b80a2,_0x463868);}async['loadIndex'](_0x31ca1c,_0x2b0d87){const _0x37298d=_0x46a83d;return this.#t(),this.#e[_0x37298d(0x206)](_0x31ca1c,_0x2b0d87);}async[_0x46a83d(0x209)](_0x3c174e,_0x1d7fbb){return this.#t(),this.#e['loadIndexes'](_0x3c174e,_0x1d7fbb);}async[_0x46a83d(0x1b3)](_0x3d6a17){const _0xcfd40=_0x46a83d;return this.#t(),this.#e[_0xcfd40(0x1b3)](_0x3d6a17);}async[_0x46a83d(0x1be)](_0x5d7b0d){return this.#t(),this.#e['unloadIndexes'](_0x5d7b0d);}async[_0x46a83d(0x1f5)](_0x496673,_0x33787a,_0x75a08f){return this.#t(),this.#e['query'](_0x496673,_0x33787a,_0x75a08f);}async[_0x46a83d(0x1f9)](_0x2d9d88,_0x29be49,_0x150e42){const _0x4cc838=_0x46a83d;return this.#t(),this.#e[_0x4cc838(0x1f9)](_0x2d9d88,_0x29be49,_0x150e42);}async['session'](_0x39dff9,_0x64c489=W,_0x8f92c7){const _0x21828c=_0x46a83d;this.#t();let _0x37c616=this.#e[_0x21828c(0x189)],_0xe6f658;if(this.#s!==null)_0xe6f658=await h[_0x21828c(0x215)](_0x39dff9,_0x64c489,this.#r,this.#s,void 0x0,_0x37c616,_0x8f92c7);else{let _0x5180c2=await this.#e[_0x21828c(0x205)](_0x39dff9,_0x64c489,_0x8f92c7);_0xe6f658=h[_0x21828c(0x1a8)](_0x39dff9,_0x64c489,_0x5180c2,_0x37c616);}await _0xe6f658['_warmModel']();for(let _0x467fe5 of this.#n)_0x467fe5['deref']()||this.#n[_0x21828c(0x18d)](_0x467fe5);return this.#n['add'](new WeakRef(_0xe6f658)),_0xe6f658;}#t(){const _0x57f93b=_0x46a83d;if(this.#i)throw new Error(_0x57f93b(0x1b7));}[_0x46a83d(0x164)](){return this.#a??=this.#u(),this.#a;}async #u(){const _0x348359=_0x46a83d;this.#i=!0x0;let _0x5f3da7=[...this.#n][_0x348359(0x1d1)](_0x51bad0=>_0x51bad0[_0x348359(0x162)]())['filter'](_0x44f62a=>_0x44f62a!==void 0x0);this.#n['clear'](),await Promise['all'](_0x5f3da7['map'](_0x57272b=>_0x57272b['close']())),await this.#e[_0x348359(0x164)]();}async[Symbol[_0x46a83d(0x1bb)]](){const _0x30010d=_0x46a83d;return this[_0x30010d(0x164)]();}};export{w as ManageApiError,D as MossClient,h as SessionIndex};
|
|
1
|
+
const _0xb7ded2=_0xf7dd;(function(_0x346014,_0x35f986){const _0x4faaaf=_0xf7dd,_0x151dd3=_0x346014();while(!![]){try{const _0x2627a1=-parseInt(_0x4faaaf(0x16f))/0x1+-parseInt(_0x4faaaf(0x1d8))/0x2*(-parseInt(_0x4faaaf(0x17b))/0x3)+-parseInt(_0x4faaaf(0x18b))/0x4+parseInt(_0x4faaaf(0x1ae))/0x5+-parseInt(_0x4faaaf(0x18c))/0x6+parseInt(_0x4faaaf(0x196))/0x7+parseInt(_0x4faaaf(0x214))/0x8*(parseInt(_0x4faaaf(0x1f4))/0x9);if(_0x2627a1===_0x35f986)break;else _0x151dd3['push'](_0x151dd3['shift']());}catch(_0x2e7c15){_0x151dd3['push'](_0x151dd3['shift']());}}}(_0x4484,0x51fc6));import{JobStatus as _0x5f4ea8}from'@moss-js/moss-core';import*as _0x5e12ee from'@moss-js/moss-core';import*as _0x36bb09 from'@moss-js/moss-core';var g=_0x36bb09,le=g[_0xb7ded2(0x1f1)],me=g[_0xb7ded2(0x1ee)],he=g[_0xb7ded2(0x1af)],T=g[_0xb7ded2(0x205)],ge=typeof process<'u'&&process[_0xb7ded2(0x22c)][_0xb7ded2(0x193)]||g[_0xb7ded2(0x195)],_=typeof process<'u'?process['env']:{},I=class{constructor(_0x27b9ea,_0x375c47){const _0x4b7f61=_0xb7ded2;this[_0x4b7f61(0x217)]=_0x27b9ea,this[_0x4b7f61(0x23d)]=_0x375c47,this[_0x4b7f61(0x1d7)]=_['MOSS_AUTH_URL']??T;}[_0xb7ded2(0x217)];[_0xb7ded2(0x23d)];[_0xb7ded2(0x1d7)];async['getAuthToken'](){const _0x479cd1=_0xb7ded2;let _0x412600=await fetch(this[_0x479cd1(0x1d7)],{'method':_0x479cd1(0x1d0),'headers':{'Content-Type':_0x479cd1(0x17c)},'body':JSON[_0x479cd1(0x1cc)]({'projectId':this[_0x479cd1(0x217)],'projectKey':this['projectKey']}),'signal':AbortSignal[_0x479cd1(0x1e7)](0x7530)});if(_0x412600[_0x479cd1(0x17e)]===0x191){let _0x5a4d53=await _0x412600[_0x479cd1(0x22a)]();throw new Error(_0x479cd1(0x16e)+_0x5a4d53);}if(!_0x412600['ok']){let _0x2818ba=await _0x412600[_0x479cd1(0x22a)]();throw new Error(_0x479cd1(0x1f9)+_0x412600['status']+':\x20'+_0x2818ba);}let _0x3bfd17=await _0x412600[_0x479cd1(0x206)]();return{'token':_0x3bfd17[_0x479cd1(0x1fa)],'expiresIn':_0x3bfd17[_0x479cd1(0x21e)]};}async['getAuthHeader'](){const _0x3adba4=_0xb7ded2;let {token:_0x577aff}=await this[_0x3adba4(0x185)]();return _0x3adba4(0x1cd)+_0x577aff;}},y=class{constructor(_0x44a248){const _0x393ecf=_0xb7ded2;this[_0x393ecf(0x1a7)]=_0x44a248;}[_0xb7ded2(0x1a7)];['cache']=null;[_0xb7ded2(0x203)]=null;async[_0xb7ded2(0x185)](){const _0xb880ea=_0xb7ded2;if(this[_0xb880ea(0x23c)]&&this[_0xb880ea(0x23c)]['expiresAt']>Date['now']())return{'token':this[_0xb880ea(0x23c)][_0xb880ea(0x1fa)],'expiresIn':this[_0xb880ea(0x23c)]['expiresIn']};if(this[_0xb880ea(0x203)])return this['inflight'];this[_0xb880ea(0x203)]=this['fetchAndCache']();try{return await this[_0xb880ea(0x203)];}finally{this['inflight']=null;}}async['getAuthHeader'](){const _0x3bca43=_0xb7ded2;let {token:_0x11e978}=await this[_0x3bca43(0x185)]();return'Bearer\x20'+_0x11e978;}async[_0xb7ded2(0x23b)](){const _0x367346=_0xb7ded2;let {token:_0x49746e,expiresIn:_0x17c8b6}=await this[_0x367346(0x1a7)][_0x367346(0x185)](),_0x569c2f=Date['now']()+(_0x17c8b6-0x3c)*0x3e8;return this[_0x367346(0x23c)]={'token':_0x49746e,'expiresIn':_0x17c8b6,'expiresAt':_0x569c2f},{'token':_0x49746e,'expiresIn':_0x17c8b6};}};import{randomUUID as _0x48aa9b}from'node:crypto';import{existsSync as _0x315ff5,mkdirSync as _0x767e04,readFileSync as _0x165c89,writeFileSync as _0x20d990}from'node:fs';import{join as _0xa59d9a}from'node:path';function _0x4484(){const _0x595f31=['getDocs','projectId','getAuthHeader','deleteIndex','deviceIdentity','bind','failed','manageClient','expiresIn','queryMultiIndexText','delete','_create','sources','encode','PendingUpload','isSafeInteger','listWebSources','rejectAuthRequest','data','query','text','all','env','received\x20','indexName','includePaths','cachePath','Unsupported\x20data\x20type\x20for\x20file\x20upload','resync','rootUrl','deleteDocs\x20requires\x20at\x20least\x20one\x20document\x20ID','call','parseDocuments','hasIndex','received\x20a\x20progress\x20event\x20with\x20a\x20non-string\x20currentPhase\x20(','unloadIndexes','updated','fetchAndCache','cache','projectKey','\x22)\x20or\x20loadIndexes([...])\x20before\x20querying;\x20queries\x20run\x20locally\x20and\x20there\x20is\x20no\x20cloud\x20query\x20fallback.','custom','warn','join','getJobStatus','test','received\x20a\x20progress\x20event\x20with\x20a\x20non-finite\x20progress\x20value\x20(','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20MossClient.close()','SessionIndex','alpha','identity','applySessionIdentity','string','loadModel','message','byteLength','Authentication\x20failed\x20(HTTP\x20401):\x20','497266ZTVQED','jobId','NOT_FOUND','close','keys','default','applyIdentity','startsWith','deleteDocs','requireMultiIndexCore','received\x20an\x20array\x20where\x20a\x20JobProgress\x20object\x20was\x20expected','/v1/manage','261juHXPo','application/json','create','status','function','INVALID_ARGUMENT','modelArtifactContractVersion','userId','deleteWebSource','SessionIndex\x20\x27','getAuthToken','body','path','object','This\x20session\x20uses\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20embedding\x20via\x20QueryOptions.embedding.','createIndex','2162012uNVucH','1720308VcVIoI','Web\x20source\x20methods\x20require\x20a\x20project\x20key.\x20Construct\x20MossClient\x20with\x20(projectId,\x20projectKey).','loadIndex','mossDeviceId','_fromInner','MOSS_CLOUD_API_BASE_URL','trim','MOSS_INDEX_URL','createIndexFromFiles\x20requires\x20at\x20least\x20one\x20file','CLOUD_API_INDEX_URL','2434901acjFFO','code','queryMultiIndex','MossClient\x20is\x20closed','pushIndex','onProgress','session','slice','Unsupported\x20job\x20status\x20\x27','addDocumentsText','ManageClient','saveToDisk','completed','parse','createIndex\x20requires\x20at\x20least\x20one\x20document','loadIndexes','Building','inner','createIndexFromFiles','Documents\x20missing\x20.embedding\x20for\x20custom\x20model:\x20','resolveAuthRequest','moss-core\x20runtime\x20SessionIndex\x20is\x20missing\x20the\x20withAuthenticator\x20factory.\x20Upgrade\x20@moss-js/moss-core\x20to\x20a\x20build\x20that\x20supports\x20custom\x20authenticators\x20for\x20sessions.','hasCustomAuthenticator','loadFromDisk','155705KvPUiE','CLOUD_API_IDENTITY_URL','authNotifyFn','minScore','.\x20All\x20documents\x20must\x20have\x20.embedding\x20set\x20when\x20using\x20modelId=\x27custom\x27.','withAuthenticator','Failed','entries','arrayBuffer','createAuthenticatedSessionInner','modelId','rebuildLegacy','received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20jobId\x20(','refreshCadence','queryText','[moss]\x20Dropping\x20a\x20malformed\x20job\x20progress\x20event;\x20progress\x20reporting\x20may\x20be\x20incomplete\x20for\x20this\x20operation.\x20Cause:\x20','setIdentity','asyncDispose','\x22\x20is\x20not\x20loaded.\x20Call\x20loadIndex(\x22','added','https://service.usemoss.dev','Uploading','moss-core\x20runtime\x20is\x20missing\x20resolveAuthRequest/rejectAuthRequest\x20exports.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','The\x20installed\x20@moss-js/moss-core\x20does\x20not\x20support\x20multi-index\x20operations\x20(queryMultiIndex,\x20loadIndexes,\x20unloadIndexes).\x20Upgrade\x20@moss-js/moss-core.','map','indexManager','manifestSha256','toByteArray','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20SessionIndex.close()','inspectSnapshot','stringify','Bearer\x20','embedding','fromEntries','POST','\x20contains\x20an\x20unsupported\x20character','isFinite','pendingupload','upsert','MossClient\x20options.identity\x20must\x20be\x20an\x20object','configuredIdentity','authUrl','1006wtrjDo','The\x20installed\x20@moss-js/moss-core\x20runtime\x20does\x20not\x20support\x20exact\x20model\x20artifact\x20identities.\x20Upgrade\x20moss-core\x20before\x20creating\x20this\x20session.','topK','IndexManager','MossClient\x20options.identity.','deviceId','wrapProgress','deleteDocuments','getIndex','moss-minilm','utf8','resyncWebSource','updateWebSource','isArray','currentPhase','timeout','cachePathDeviceId','_warmModel','docCount','getWebSource','\x27\x20is\x20closed','name','SDK_VERSION_NUMBER','queryMultiIndex\x20requires\x20at\x20least\x20one\x20index\x20name','createWebSource','MODEL_DOWNLOAD_URL','unloadIndex','parseOptions','11138004pfnJCR','deref','moss-core\x20rejected\x20the\x20auth\x20token:\x20','.moss-device-id','normalizeJobStatus','HTTP\x20','token','length','maxDocuments','replace','ensureCachePathDeviceId','Completed','listIndexes','moss-core\x20runtime\x20ManageClient/IndexManager\x20is\x20missing\x20withAuthenticator\x20factory.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','\x27\x20returned\x20by\x20moss-core','inflight','number','CLOUD_API_AUTH_URL','json','authenticator','\x20must\x20be\x20at\x20most\x20','progress','filter','Index\x20\x22','version','maxPages','addDocs','error','from','building','add','\x20must\x20be\x20a\x20non-empty\x20string','8mUzxVC','pending_upload'];_0x4484=function(){return _0x595f31;};return _0x4484();}var Y=_0xb7ded2(0x1f7),S=0x100,k=/[\p{Cc}\p{Cf}\p{Cs}\uFFFD]/u;function Z(_0x14b5e1){const _0x23a8ba=_0xb7ded2;return _0x14b5e1['length']>0x0&&_0x14b5e1['trim']()===_0x14b5e1&&!k[_0x23a8ba(0x243)](_0x14b5e1)&&new TextEncoder()[_0x23a8ba(0x223)](_0x14b5e1)[_0x23a8ba(0x16d)]<=S;}function U(_0x5d4881,_0x1425e9){const _0x14c66a=_0xb7ded2;if(_0x5d4881!==void 0x0){if(typeof _0x5d4881!=_0x14c66a(0x16a)||_0x5d4881['length']===0x0)throw new TypeError('MossClient\x20options.identity.'+_0x1425e9+_0x14c66a(0x213));if(_0x5d4881[_0x14c66a(0x192)]()!==_0x5d4881)throw new TypeError('MossClient\x20options.identity.'+_0x1425e9+'\x20must\x20not\x20have\x20leading\x20or\x20trailing\x20whitespace');if(k[_0x14c66a(0x243)](_0x5d4881))throw new TypeError(_0x14c66a(0x1dc)+_0x1425e9+_0x14c66a(0x1d1));if(new TextEncoder()[_0x14c66a(0x223)](_0x5d4881)['byteLength']>S)throw new TypeError(_0x14c66a(0x1dc)+_0x1425e9+_0x14c66a(0x208)+S+'\x20UTF-8\x20bytes');return _0x5d4881;}}function _0xf7dd(_0x12546a,_0x14d2e6){_0x12546a=_0x12546a-0x169;const _0x448496=_0x4484();let _0xf7dd7a=_0x448496[_0x12546a];return _0xf7dd7a;}function L(_0x57af50){const _0xbafc50=_0xb7ded2;if(_0x57af50!==void 0x0){if(_0x57af50===null||typeof _0x57af50!=_0xbafc50(0x188)||Array[_0xbafc50(0x1e5)](_0x57af50))throw new TypeError(_0xbafc50(0x1d5));return Object['freeze']({'deviceId':U(_0x57af50[_0xbafc50(0x1dd)],'deviceId'),'userId':U(_0x57af50[_0xbafc50(0x182)],_0xbafc50(0x182))});}}function N(_0x4c9bbf){const _0x49f1f9=_0xb7ded2;return _0x4c9bbf?.[_0x49f1f9(0x1dd)]!==void 0x0||_0x4c9bbf?.[_0x49f1f9(0x182)]!==void 0x0;}function A(_0x95a4f1){const _0x3ac3d6=_0xb7ded2;if(!_0x95a4f1?.[_0x3ac3d6(0x192)]())return;let _0x3bc32b=_0xa59d9a(_0x95a4f1,Y);try{if(_0x315ff5(_0x3bc32b)){let _0x59138a=_0x165c89(_0x3bc32b,'utf8')[_0x3ac3d6(0x192)]();return Z(_0x59138a)?_0x59138a:void 0x0;}_0x767e04(_0x95a4f1,{'recursive':!0x0});let _0x5090cf=_0x48aa9b();return _0x20d990(_0x3bc32b,_0x5090cf,_0x3ac3d6(0x1e2)),_0x5090cf;}catch{return;}}var ee=0x1;function x(_0x1ef910){const _0x3dad15=_0xb7ded2;let _0x4c5fa3=_0x1ef910[_0x3dad15(0x181)];if(typeof _0x4c5fa3!='function')throw q();let _0x18a771=_0x4c5fa3[_0x3dad15(0x235)](_0x1ef910);if(!Number['isSafeInteger'](_0x18a771)||_0x18a771<ee)throw q();}function q(){const _0x2c0621=_0xb7ded2;return new Error(_0x2c0621(0x1d9));}var Pe=0x708*0x3e8,te={'INVALID_ARGUMENT':!0x0,'NOT_FOUND':!0x0,'UNAUTHORIZED':!0x0,'NETWORK':!0x0,'DESERIALIZATION':!0x0,'MODEL_UNAVAILABLE':!0x0,'INTERNAL':!0x0},ne=new Set(Object[_0xb7ded2(0x173)](te));function re(_0x2fd24e){const _0x7eb29f=_0xb7ded2;if(!(_0x2fd24e instanceof Error))return!0x1;let _0x4b4c19=_0x2fd24e[_0x7eb29f(0x197)];return typeof _0x4b4c19==_0x7eb29f(0x16a)&&ne['has'](_0x4b4c19);}function p(_0x509e4a,_0x8090e4){return Object['assign'](new Error(_0x8090e4),{'code':_0x509e4a});}function b(_0x4cf6ea){const _0x513e0a=_0xb7ded2;if(!(_0x4cf6ea?.[_0x513e0a(0x1b1)]===void 0x0&&_0x4cf6ea?.['candidateDepth']===void 0x0))return{'minScore':_0x4cf6ea['minScore'],'candidateDepth':_0x4cf6ea['candidateDepth']};}function D(_0x5b7cee){const _0x2f7207=_0xb7ded2;return _0x5b7cee instanceof Error?_0x5b7cee[_0x2f7207(0x16c)]:String(_0x5b7cee);}function se(_0x3b76e3){const _0x39d232=_0xb7ded2;if(_0x3b76e3===null||typeof _0x3b76e3!='object')return _0x39d232(0x22d)+String(_0x3b76e3);if(Array[_0x39d232(0x1e5)](_0x3b76e3))return _0x39d232(0x179);let _0x201909=_0x3b76e3;return typeof _0x201909[_0x39d232(0x170)]!=_0x39d232(0x16a)||_0x201909['jobId'][_0x39d232(0x1fb)]===0x0?_0x39d232(0x1ba)+String(_0x201909['jobId'])+')':typeof _0x201909[_0x39d232(0x17e)]!=_0x39d232(0x16a)||_0x201909[_0x39d232(0x17e)][_0x39d232(0x1fb)]===0x0?'received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20status\x20('+String(_0x201909['status'])+')':typeof _0x201909[_0x39d232(0x209)]!=_0x39d232(0x204)||!Number[_0x39d232(0x1d2)](_0x201909[_0x39d232(0x209)])?_0x39d232(0x244)+String(_0x201909[_0x39d232(0x209)])+')':_0x201909['currentPhase']!==void 0x0&&_0x201909['currentPhase']!==null&&typeof _0x201909[_0x39d232(0x1e6)]!=_0x39d232(0x16a)?_0x39d232(0x238)+String(_0x201909[_0x39d232(0x1e6)])+')':null;}var w=class{[_0xb7ded2(0x207)];[_0xb7ded2(0x21d)];['indexManager'];[_0xb7ded2(0x1e8)];[_0xb7ded2(0x1d6)];['projectId'];['authNotifyFn'];constructor(_0x478761,_0x47ea50,_0xdfae84){const _0xad4402=_0xb7ded2;this[_0xad4402(0x1d6)]=L(_0xdfae84?.[_0xad4402(0x248)]),this[_0xad4402(0x1e8)]=A(_0xdfae84?.[_0xad4402(0x230)]),this[_0xad4402(0x217)]=_0x478761;let _0x1a89df=typeof _0x47ea50==_0xad4402(0x16a)?new I(_0x478761,_0x47ea50):_0x47ea50;this[_0xad4402(0x207)]=new y(_0x1a89df);let _0x1bb598=_0x5e12ee,_0x1e0230=_0x1bb598[_0xad4402(0x1a0)]??_0x1bb598[_0xad4402(0x174)]?.['ManageClient'],_0xe3591=_0x1bb598[_0xad4402(0x1db)]??_0x1bb598[_0xad4402(0x174)]?.[_0xad4402(0x1db)];if(!_0x1e0230||!_0xe3591)throw new Error('moss-core\x20runtime\x20is\x20missing\x20ManageClient/IndexManager\x20exports');if(typeof _0x47ea50==_0xad4402(0x16a))this[_0xad4402(0x21d)]=new _0x1e0230(_0x478761,_0x47ea50),this[_0xad4402(0x1c7)]=new _0xe3591(_0x478761,_0x47ea50);else{let _0x122945=_0x1bb598[_0xad4402(0x1aa)]??_0x1bb598[_0xad4402(0x174)]?.[_0xad4402(0x1aa)],_0xe8ea7c=_0x1bb598[_0xad4402(0x227)]??_0x1bb598[_0xad4402(0x174)]?.['rejectAuthRequest'];if(!_0x122945||!_0xe8ea7c)throw new Error(_0xad4402(0x1c4));let _0x1ba626=this[_0xad4402(0x207)],_0x3ac26a=(_0x5e50d9,_0x3f0271)=>{const _0x24071a=_0xad4402;try{_0xe8ea7c(_0x5e50d9,_0x3f0271);}catch(_0x460c6a){console[_0x24071a(0x240)]('[moss]\x20Auth\x20request\x20'+_0x5e50d9+'\x20could\x20not\x20be\x20settled:\x20'+D(_0x460c6a));}},_0x2240e9=(_0x520f73,_0x513db5)=>{const _0x4c68d8=_0xad4402;try{_0x122945(_0x520f73,_0x513db5);}catch(_0x149373){_0x3ac26a(_0x520f73,_0x4c68d8(0x1f6)+D(_0x149373));}},_0x551385=!0x1,_0x16cb97=(_0x15a07c,_0x384c5e)=>{const _0x4ce78a=_0xad4402;if(_0x15a07c||!Number[_0x4ce78a(0x225)](_0x384c5e)||_0x384c5e<0x0){_0x551385||(_0x551385=!0x0,console[_0x4ce78a(0x240)]('[moss]\x20Ignoring\x20an\x20auth\x20request\x20with\x20no\x20usable\x20request\x20id;\x20custom\x20authentication\x20may\x20be\x20unavailable\x20for\x20this\x20client.\x20Cause:\x20'+(_0x15a07c?_0x15a07c[_0x4ce78a(0x16c)]:_0x4ce78a(0x22d)+String(_0x384c5e))));return;}_0x1ba626[_0x4ce78a(0x218)]()['then'](_0x2ab775=>{const _0x366ba9=_0x4ce78a;let _0x18915e=_0x2ab775[_0x366ba9(0x176)](_0x366ba9(0x1cd))?_0x2ab775[_0x366ba9(0x19d)](0x7):_0x2ab775;_0x2240e9(_0x384c5e,_0x18915e);},_0x215739=>_0x3ac26a(_0x384c5e,D(_0x215739)));};this[_0xad4402(0x1b0)]=_0x16cb97;let _0x560194=_0x1e0230,_0x5f1eaf=_0xe3591;if(!_0x560194[_0xad4402(0x1b3)]||!_0x5f1eaf[_0xad4402(0x1b3)])throw new Error(_0xad4402(0x201));this['manageClient']=_0x560194['withAuthenticator'](_0x478761,_0x16cb97),this['indexManager']=_0x5f1eaf['withAuthenticator'](_0x478761,_0x16cb97);}this[_0xad4402(0x175)](this[_0xad4402(0x1c7)]);}async[_0xb7ded2(0x172)](){const _0x84b445=_0xb7ded2;let _0x2784b7=this[_0x84b445(0x1c7)][_0x84b445(0x172)];if(typeof _0x2784b7!=_0x84b445(0x17f))throw new Error(_0x84b445(0x245));await _0x2784b7[_0x84b445(0x235)](this[_0x84b445(0x1c7)]);}async['getAuthToken'](){const _0xa5ce15=_0xb7ded2;return this[_0xa5ce15(0x207)][_0xa5ce15(0x185)]();}[_0xb7ded2(0x1de)](_0x241389){if(!_0x241389)return;let _0x290b22=!0x1;return(_0x4234f8,_0x586727)=>{const _0x42e3f2=_0xf7dd;let _0x137c84=_0x4234f8?_0x4234f8['message']:se(_0x586727);if(_0x137c84!==null){_0x290b22||(_0x290b22=!0x0,console['warn'](_0x42e3f2(0x1bd)+_0x137c84));return;}_0x241389(_0x586727);};}[_0xb7ded2(0x1f8)](_0x3fa72e){const _0x578fac=_0xb7ded2;let _0x577c17=_0x3fa72e['trim']()['toLowerCase']()[_0x578fac(0x1fd)](/\s+/g,'_'),_0xe62ac=_0x577c17[_0x578fac(0x1fd)](/_/g,'');if(_0x577c17===_0x578fac(0x215)||_0xe62ac===_0x578fac(0x1d3))return _0x5f4ea8[_0x578fac(0x224)];if(_0x577c17==='uploading')return _0x5f4ea8[_0x578fac(0x1c3)];if(_0x577c17===_0x578fac(0x211))return _0x5f4ea8[_0x578fac(0x1a6)];if(_0x577c17===_0x578fac(0x1a2))return _0x5f4ea8[_0x578fac(0x1ff)];if(_0x577c17===_0x578fac(0x21c))return _0x5f4ea8[_0x578fac(0x1b4)];throw new Error(_0x578fac(0x19e)+_0x3fa72e+_0x578fac(0x202));}async[_0xb7ded2(0x18a)](_0x182604,_0x54548d,_0x39a569,_0x521013){const _0x4b11e1=_0xb7ded2;if(!_0x54548d[_0x4b11e1(0x1fb)])throw new Error(_0x4b11e1(0x1a4));return await this[_0x4b11e1(0x21d)][_0x4b11e1(0x18a)](_0x182604,_0x54548d,_0x39a569,this[_0x4b11e1(0x1de)](_0x521013?.[_0x4b11e1(0x19b)]));}async[_0xb7ded2(0x1c9)](_0x5ed9fe){const _0x43b10d=_0xb7ded2;if(_0x5ed9fe instanceof Uint8Array)return Array[_0x43b10d(0x210)](_0x5ed9fe);if(_0x5ed9fe instanceof ArrayBuffer)return Array['from'](new Uint8Array(_0x5ed9fe));if(typeof _0x5ed9fe[_0x43b10d(0x1b6)]==_0x43b10d(0x17f)){let _0x249063=await _0x5ed9fe['arrayBuffer']();return Array[_0x43b10d(0x210)](new Uint8Array(_0x249063));}throw new Error(_0x43b10d(0x231));}async[_0xb7ded2(0x1a8)](_0x467af6,_0x8711df,_0x1eefa4){const _0x3f33c8=_0xb7ded2;if(_0x8711df['length']===0x0)throw new Error(_0x3f33c8(0x194));let _0x53f0b9=_0x1eefa4?.['modelId']??'moss-minilm',_0x8772ba=await Promise[_0x3f33c8(0x22b)](_0x8711df[_0x3f33c8(0x1c6)](async _0x1a1a04=>({'name':_0x1a1a04[_0x3f33c8(0x1ed)],'contentType':_0x1a1a04['contentType'],'path':_0x1a1a04[_0x3f33c8(0x187)]??void 0x0,'data':_0x1a1a04[_0x3f33c8(0x228)]!=null?await this['toByteArray'](_0x1a1a04[_0x3f33c8(0x228)]):void 0x0})));return await this['manageClient'][_0x3f33c8(0x1a8)](_0x467af6,_0x8772ba,_0x53f0b9,this['wrapProgress'](_0x1eefa4?.[_0x3f33c8(0x19b)]),_0x1eefa4?.[_0x3f33c8(0x1f3)]??null);}async[_0xb7ded2(0x20e)](_0x249710,_0x10afe7,_0x2501ab){const _0x385774=_0xb7ded2;if(Array[_0x385774(0x1e5)](_0x10afe7)&&_0x10afe7[_0x385774(0x1fb)]===0x0)throw new Error('addDocs\x20requires\x20at\x20least\x20one\x20document');return await this[_0x385774(0x21d)]['addDocs'](_0x249710,_0x10afe7,_0x2501ab??null,this[_0x385774(0x1de)](_0x2501ab?.['onProgress']));}async[_0xb7ded2(0x177)](_0x39a44d,_0x2de74a,_0x11a855){const _0x146a78=_0xb7ded2;if(Array[_0x146a78(0x1e5)](_0x2de74a)&&_0x2de74a[_0x146a78(0x1fb)]===0x0)throw new Error(_0x146a78(0x234));return await this['manageClient'][_0x146a78(0x177)](_0x39a44d,_0x2de74a,this['wrapProgress'](_0x11a855?.['onProgress']));}async[_0xb7ded2(0x242)](_0x11fa02){const _0x52198d=_0xb7ded2;let _0x43c57c=await this['manageClient'][_0x52198d(0x242)](_0x11fa02);return{..._0x43c57c,'status':this['normalizeJobStatus'](_0x43c57c[_0x52198d(0x17e)]),'currentPhase':_0x43c57c['currentPhase']??null,'error':_0x43c57c[_0x52198d(0x20f)]??null};}async[_0xb7ded2(0x1e0)](_0x4fa82a){const _0x3a7711=_0xb7ded2;return this[_0x3a7711(0x21d)][_0x3a7711(0x1e0)](_0x4fa82a);}async[_0xb7ded2(0x200)](){const _0x279af8=_0xb7ded2;return this[_0x279af8(0x21d)]['listIndexes']();}async[_0xb7ded2(0x219)](_0x5b1e4a){const _0x1f969e=_0xb7ded2;return this[_0x1f969e(0x21d)][_0x1f969e(0x219)](_0x5b1e4a);}async[_0xb7ded2(0x216)](_0x4f3386,_0x516c46){const _0x10bb7a=_0xb7ded2;return this[_0x10bb7a(0x21d)]['getDocs'](_0x4f3386,_0x516c46??null);}async[_0xb7ded2(0x18e)](_0x366420,_0x3d885a){const _0x24f2d7=_0xb7ded2;return this['ensureCachePathDeviceId'](_0x3d885a?.[_0x24f2d7(0x230)]),(await this[_0x24f2d7(0x1c7)][_0x24f2d7(0x18e)](_0x366420,_0x3d885a??null))['name'];}async[_0xb7ded2(0x1a5)](_0x402de0,_0x241abc){const _0x2310be=_0xb7ded2;let _0x43b2ad=this[_0x2310be(0x178)]();return this['ensureCachePathDeviceId'](_0x241abc?.['cachePath']),_0x43b2ad[_0x2310be(0x1a5)](_0x402de0,_0x241abc??null);}async[_0xb7ded2(0x1f2)](_0x144493){const _0x76beb0=_0xb7ded2;return this[_0x76beb0(0x1c7)][_0x76beb0(0x1f2)](_0x144493);}async[_0xb7ded2(0x239)](_0x26483c){return this['requireMultiIndexCore']()['unloadIndexes'](_0x26483c);}[_0xb7ded2(0x178)](){const _0x69cd8c=_0xb7ded2;let _0x54219d=this[_0x69cd8c(0x1c7)];if(typeof _0x54219d[_0x69cd8c(0x198)]!=_0x69cd8c(0x17f)||typeof _0x54219d[_0x69cd8c(0x21f)]!='function'||typeof _0x54219d[_0x69cd8c(0x1a5)]!=_0x69cd8c(0x17f)||typeof _0x54219d['unloadIndexes']!='function')throw new Error(_0x69cd8c(0x1c5));return{'queryMultiIndex':_0x54219d[_0x69cd8c(0x198)][_0x69cd8c(0x21b)](_0x54219d),'queryMultiIndexText':_0x54219d[_0x69cd8c(0x21f)]['bind'](_0x54219d),'loadIndexes':_0x54219d[_0x69cd8c(0x1a5)][_0x69cd8c(0x21b)](_0x54219d),'unloadIndexes':_0x54219d['unloadIndexes'][_0x69cd8c(0x21b)](_0x54219d)};}[_0xb7ded2(0x1fe)](_0x2299dc){_0x2299dc&&this['cachePathDeviceId']===void 0x0&&A(_0x2299dc);}[_0xb7ded2(0x175)]=_0x3abb0d=>{const _0x193778=_0xb7ded2;!N(this['configuredIdentity'])&&this[_0x193778(0x1e8)]===void 0x0||_0x3abb0d['setIdentity'](this[_0x193778(0x1d6)]?.[_0x193778(0x1dd)]??null,this[_0x193778(0x1d6)]?.['userId']??null,this[_0x193778(0x1e8)]??null);};[_0xb7ded2(0x169)]=_0x5ae14e=>{const _0x779b33=_0xb7ded2;let _0x54b315=this['indexManager'][_0x779b33(0x21a)]?.();if(!_0x54b315){this[_0x779b33(0x175)](_0x5ae14e);return;}_0x5ae14e[_0x779b33(0x1be)](_0x54b315[_0x779b33(0x1dd)]??null,this[_0x779b33(0x1d6)]?.[_0x779b33(0x182)]??null,_0x54b315[_0x779b33(0x18f)]??null);};[_0xb7ded2(0x1ac)](){const _0x58f231=_0xb7ded2;return this[_0x58f231(0x1b0)]!==void 0x0;}async[_0xb7ded2(0x1b7)](_0x3136ef,_0x42f9a8,_0x1f7f49){const _0x4131e5=_0xb7ded2;if(!this[_0x4131e5(0x1b0)])throw new Error('createAuthenticatedSessionInner\x20requires\x20a\x20custom\x20IAuthenticator\x20client');let _0x19cad1=_0x5e12ee,_0x50976e=_0x19cad1[_0x4131e5(0x246)]??_0x19cad1['default']?.[_0x4131e5(0x246)];if(!_0x50976e||typeof _0x50976e['withAuthenticator']!='function')throw new Error(_0x4131e5(0x1ab));return _0x1f7f49&&x(_0x50976e),_0x50976e[_0x4131e5(0x1b3)](_0x3136ef,_0x42f9a8,this[_0x4131e5(0x217)],this[_0x4131e5(0x1b0)],null,null,_0x1f7f49?.[_0x4131e5(0x20c)]??null,_0x1f7f49?.[_0x4131e5(0x1c8)]??null);}async[_0xb7ded2(0x229)](_0x359782,_0x61530c,_0x250c07){const _0x32c90f=_0xb7ded2;if(!await this[_0x32c90f(0x1c7)][_0x32c90f(0x237)](_0x359782))throw p(_0x32c90f(0x171),_0x32c90f(0x20b)+_0x359782+_0x32c90f(0x1c0)+_0x359782+_0x32c90f(0x23e));let _0x1fa202=_0x250c07?.[_0x32c90f(0x1da)]??0x5,_0x2d77f5=_0x250c07?.['alpha']??0.8;return _0x250c07?.['embedding']?this['indexManager'][_0x32c90f(0x229)](_0x359782,_0x61530c,_0x250c07[_0x32c90f(0x1ce)],_0x1fa202,_0x2d77f5,_0x250c07?.[_0x32c90f(0x20a)],b(_0x250c07)):this[_0x32c90f(0x1c7)]['queryText'](_0x359782,_0x61530c,_0x1fa202,_0x2d77f5,_0x250c07?.[_0x32c90f(0x20a)],b(_0x250c07));}async[_0xb7ded2(0x198)](_0x584fda,_0x2364a2,_0x5ba4c0){const _0x34e1a3=_0xb7ded2;if(_0x584fda[_0x34e1a3(0x1fb)]===0x0)throw p(_0x34e1a3(0x180),_0x34e1a3(0x1ef));let _0x273f00=this[_0x34e1a3(0x178)](),_0x2d11cb=_0x5ba4c0?.[_0x34e1a3(0x1da)]??0xa,_0x2cbc9d=_0x5ba4c0?.[_0x34e1a3(0x247)]??0.8;return _0x5ba4c0?.['embedding']?_0x273f00[_0x34e1a3(0x198)](_0x584fda,_0x2364a2,_0x5ba4c0[_0x34e1a3(0x1ce)],_0x2d11cb,_0x2cbc9d,_0x5ba4c0?.[_0x34e1a3(0x20a)],b(_0x5ba4c0)):_0x273f00['queryMultiIndexText'](_0x584fda,_0x2364a2,_0x2d11cb,_0x2cbc9d,_0x5ba4c0?.['filter'],b(_0x5ba4c0));}};import{SessionIndex as _0x259da3}from'@moss-js/moss-core';var h=class r{#e;#r;#s;#i=!0x1;#a;constructor(_0x4cfb78,_0x306448,_0x4e6938){this.#s=_0x4cfb78,this.#r=_0x306448,this.#e=_0x4e6938;}static async['_create'](_0x35a2fe,_0xf47c35,_0x484e3e,_0x98cfd5,_0x105ac5,_0x3d2dbb,_0x535006){const _0x322464=_0xb7ded2;let _0x284916=_0x259da3;_0x535006&&x(_0x284916);let _0x54ba6c=await _0x284916[_0x322464(0x17d)](_0x35a2fe,_0xf47c35,_0x484e3e,_0x98cfd5,_0x105ac5??null,_0x535006?.[_0x322464(0x20c)]??null,_0x535006?.[_0x322464(0x1c8)]??null);return r['_fromInner'](_0x35a2fe,_0xf47c35,_0x54ba6c,_0x3d2dbb);}static[_0xb7ded2(0x190)](_0x25cc42,_0x26f2cf,_0x505650,_0x36237d){return _0x36237d?.(_0x505650),new r(_0x25cc42,_0x26f2cf,_0x505650);}get[_0xb7ded2(0x1ed)](){return this.#s;}get[_0xb7ded2(0x1ea)](){const _0x31c758=_0xb7ded2;return this.#n(),this.#e[_0x31c758(0x1ea)];}get['modelId'](){return this.#r;}async[_0xb7ded2(0x20e)](_0x5a3872,_0x3b8636){const _0x3d668a=_0xb7ded2;this.#n();let _0x4f659a=_0x3b8636?{'upsert':_0x3b8636[_0x3d668a(0x1d4)]??!0x0}:void 0x0;if(this.#r===_0x3d668a(0x23f)){let _0x3d3b94=r.#t(_0x5a3872),_0x2a123f=_0x5a3872['map'](_0x1b5b53=>{const _0x1bd0c8=_0x3d668a;let _0x1a6048={..._0x1b5b53};return delete _0x1a6048[_0x1bd0c8(0x1ce)],_0x1a6048;}),_0x232644=await this.#e['addDocuments'](_0x2a123f,_0x3d3b94,_0x4f659a);return{'added':_0x232644[_0x3d668a(0x1c1)],'updated':_0x232644[_0x3d668a(0x23a)]};}let _0x2b3cbf=await this.#e[_0x3d668a(0x19f)](_0x5a3872,_0x4f659a);return{'added':_0x2b3cbf[_0x3d668a(0x1c1)],'updated':_0x2b3cbf[_0x3d668a(0x23a)]};}async[_0xb7ded2(0x177)](_0x3eae8a){const _0x30dfeb=_0xb7ded2;return this.#n(),await this.#e[_0x30dfeb(0x1df)](_0x3eae8a);}async['getDocs'](_0x1bb624){return this.#n(),await this.#e['getDocuments'](_0x1bb624??null);}async[_0xb7ded2(0x229)](_0xf8d8bc,_0x2fe9ad){const _0x458038=_0xb7ded2;this.#n();let _0x3e61ab=_0x2fe9ad?.['topK']??0x5,_0x12565d=_0x2fe9ad?.[_0x458038(0x247)]??0.8,_0x351d86=_0x2fe9ad?.['filter']??null,_0x20d28c=_0x2fe9ad?.[_0x458038(0x1ce)];if(_0x20d28c==null){if(this.#r==='custom')throw p('INVALID_ARGUMENT',_0x458038(0x189));return await this.#e[_0x458038(0x1bc)](_0xf8d8bc,_0x3e61ab,_0x12565d,_0x351d86);}return await this.#e[_0x458038(0x229)](_0xf8d8bc,_0x3e61ab,Array['from'](_0x20d28c),_0x12565d,_0x351d86);}async['loadIndex'](_0x37f50e,_0x4278f5){return this.#n(),this.#e['loadIndex'](_0x37f50e,_0x4278f5??null);}async['pushIndex'](){const _0x3f93f0=_0xb7ded2;return this.#n(),this.#e[_0x3f93f0(0x19a)]();}async['saveToDisk'](_0x60abcc){const _0x5761dc=_0xb7ded2;this.#n(),await this.#e[_0x5761dc(0x1a1)](_0x60abcc);}async['loadFromDisk'](_0x3e7105,_0x51121c){const _0xdf5bf7=_0xb7ded2;this.#n();let _0x1f7428=_0x51121c?.[_0xdf5bf7(0x1b9)]??!0x0;return await this.#e[_0xdf5bf7(0x1ad)](_0x3e7105,{'rebuildLegacy':_0x1f7428});}async[_0xb7ded2(0x1cb)](_0x27cea1){const _0x32b0e5=_0xb7ded2;return this.#n(),await this.#e[_0x32b0e5(0x1cb)](_0x27cea1);}#n(){const _0x15e3f7=_0xb7ded2;if(this.#i)throw new Error(_0x15e3f7(0x184)+this.#s+_0x15e3f7(0x1ec));}[_0xb7ded2(0x172)](){return this.#a??=this.#o(),this.#a;}async #o(){const _0xf22ed4=_0xb7ded2;this.#i=!0x0;let _0x2a56b3=this.#e[_0xf22ed4(0x172)];if(typeof _0x2a56b3!=_0xf22ed4(0x17f))throw new Error(_0xf22ed4(0x1ca));await _0x2a56b3[_0xf22ed4(0x235)](this.#e);}async[Symbol[_0xb7ded2(0x1bf)]](){const _0x56d7e1=_0xb7ded2;return this[_0x56d7e1(0x172)]();}async[_0xb7ded2(0x1e9)](){const _0x181b86=_0xb7ded2;this.#n(),this.#r!==_0x181b86(0x23f)&&await this.#e[_0x181b86(0x16b)]();}static#t(_0x5d5d99){const _0x40ca0b=_0xb7ded2;let _0x199a9c=_0x5d5d99[_0x40ca0b(0x20a)](_0x2b6dcc=>!_0x2b6dcc[_0x40ca0b(0x1ce)]||_0x2b6dcc[_0x40ca0b(0x1ce)][_0x40ca0b(0x1fb)]===0x0)[_0x40ca0b(0x1c6)](_0x480020=>_0x480020['id']);if(_0x199a9c[_0x40ca0b(0x1fb)]>0x0)throw new Error(_0x40ca0b(0x1a9)+_0x199a9c[_0x40ca0b(0x241)](',\x20')+_0x40ca0b(0x1b2));return _0x5d5d99['map'](_0x18b116=>Array['from'](_0x18b116[_0x40ca0b(0x1ce)]??[]));}};import{validateIndexName as _0x3067b3}from'@moss-js/moss-core';var ie=_0xb7ded2(0x1c2),ae=_0xb7ded2(0x17a),M=class extends Error{[_0xb7ded2(0x17e)];[_0xb7ded2(0x186)];constructor(_0x1fe103,_0x491f84){const _0x56fb81=_0xb7ded2;let _0x3db726=_0x491f84?':\x20'+_0x491f84:'';super('HTTP\x20error!\x20status:\x20'+_0x1fe103+_0x3db726),this[_0x56fb81(0x1ed)]='ManageApiError',this[_0x56fb81(0x17e)]=_0x1fe103,this[_0x56fb81(0x186)]=_0x491f84;}};function ue(){const _0x46de45=_0xb7ded2;return''+(typeof process<'u'&&process[_0x46de45(0x22c)][_0x46de45(0x191)]||ie)[_0x46de45(0x1fd)](/\/+$/,'')+ae;}function de(_0x31fc57){const _0x2e06a6=_0xb7ded2;return _0x31fc57?Object[_0x2e06a6(0x1cf)](Object[_0x2e06a6(0x1b5)](_0x31fc57)[_0x2e06a6(0x20a)](([,_0x537b8a])=>_0x537b8a!==void 0x0)):{};}async function j(_0x1aba3b,_0x216394,_0x33ea0f,_0x3d6566){const _0x360d69=_0xb7ded2;let _0x3cff5f={...de(_0x3d6566),'action':_0x33ea0f,'projectId':_0x1aba3b},_0x3ef2e6=await fetch(ue(),{'method':'POST','headers':{'Content-Type':_0x360d69(0x17c),'X-Project-Key':_0x216394},'body':JSON[_0x360d69(0x1cc)](_0x3cff5f),'signal':AbortSignal['timeout'](0x927c0)}),_0x3b7fb1=await _0x3ef2e6[_0x360d69(0x22a)]();if(!_0x3ef2e6['ok'])throw new M(_0x3ef2e6[_0x360d69(0x17e)],_0x3b7fb1);return _0x3b7fb1?JSON[_0x360d69(0x1a3)](_0x3b7fb1):{};}var W=_0xb7ded2(0x1e1),R=class{#e;#r;#s;#i=!0x1;#a;#n=new Set();constructor(_0x2d2285,_0x4aa5d8,_0x441ce8){this.#e=new w(_0x2d2285,_0x4aa5d8,_0x441ce8),this.#r=_0x2d2285,this.#s=typeof _0x4aa5d8=='string'?_0x4aa5d8:null;}async[_0xb7ded2(0x185)](){const _0x28cb25=_0xb7ded2;return this.#t(),this.#e[_0x28cb25(0x185)]();}async[_0xb7ded2(0x18a)](_0xb159dd,_0xda3c4c,_0x37398f){const _0x27a719=_0xb7ded2;this.#t();let _0x450307;return _0x37398f?.['modelId']!==void 0x0?_0x450307=_0x37398f['modelId']:_0x450307=_0xda3c4c['some'](_0x413302=>Array['isArray'](_0x413302['embedding'])&&_0x413302[_0x27a719(0x1ce)][_0x27a719(0x1fb)]>0x0)?'custom':W,this.#e[_0x27a719(0x18a)](_0xb159dd,_0xda3c4c,_0x450307,_0x37398f);}async[_0xb7ded2(0x1a8)](_0x2d891e,_0x176bea,_0x2e19ad){const _0x4cd157=_0xb7ded2;return this.#t(),this.#e[_0x4cd157(0x1a8)](_0x2d891e,_0x176bea,_0x2e19ad);}async[_0xb7ded2(0x1e0)](_0x57f57e){const _0x489db1=_0xb7ded2;return this.#t(),this.#e[_0x489db1(0x1e0)](_0x57f57e);}async['listIndexes'](){const _0x5be572=_0xb7ded2;return this.#t(),this.#e[_0x5be572(0x200)]();}async[_0xb7ded2(0x219)](_0x596e86){const _0x271122=_0xb7ded2;return this.#t(),this.#e[_0x271122(0x219)](_0x596e86);}async[_0xb7ded2(0x20e)](_0x56998f,_0x21680a,_0x57bcb3){const _0x1a7a7a=_0xb7ded2;return this.#t(),this.#e[_0x1a7a7a(0x20e)](_0x56998f,_0x21680a,_0x57bcb3);}async[_0xb7ded2(0x177)](_0x48ed57,_0x1fc2e3,_0x55e776){const _0x4901d8=_0xb7ded2;return this.#t(),this.#e[_0x4901d8(0x177)](_0x48ed57,_0x1fc2e3,_0x55e776);}async[_0xb7ded2(0x242)](_0x37ae5f){const _0xf1ed33=_0xb7ded2;return this.#t(),this.#e[_0xf1ed33(0x242)](_0x37ae5f);}async[_0xb7ded2(0x1f0)](_0x3323a2,_0x19d5fa,_0x3b3ba1){const _0x601b7d=_0xb7ded2;return this.#t(),_0x3067b3(_0x19d5fa),this.#o(_0x601b7d(0x1f0),{'rootUrl':_0x3323a2,'indexName':_0x19d5fa,'maxPages':_0x3b3ba1?.[_0x601b7d(0x20d)],'maxDocuments':_0x3b3ba1?.[_0x601b7d(0x1fc)],'maxDepth':_0x3b3ba1?.['maxDepth'],'includePaths':_0x3b3ba1?.[_0x601b7d(0x22f)],'excludePaths':_0x3b3ba1?.['excludePaths'],'respectRobots':_0x3b3ba1?.['respectRobots'],'parseDocuments':_0x3b3ba1?.[_0x601b7d(0x236)],'refreshCadence':_0x3b3ba1?.[_0x601b7d(0x1bb)],'modelId':_0x3b3ba1?.[_0x601b7d(0x1b8)]});}async[_0xb7ded2(0x226)](_0x5e58f6){const _0x2e3cff=_0xb7ded2;this.#t();let _0x3a9fc7=(await this.#o(_0x2e3cff(0x226),_0x5e58f6!==void 0x0?{'indexName':_0x5e58f6}:void 0x0))[_0x2e3cff(0x222)]??[];return _0x5e58f6===void 0x0?_0x3a9fc7:_0x3a9fc7[_0x2e3cff(0x20a)](_0x4e49d9=>_0x4e49d9[_0x2e3cff(0x22e)]===_0x5e58f6);}async[_0xb7ded2(0x1eb)](_0x316fb0){const _0x78e178=_0xb7ded2;return this.#t(),this.#o(_0x78e178(0x1eb),{'sourceId':_0x316fb0});}async['updateWebSource'](_0x132e37,_0x5a1838){const _0x38c56b=_0xb7ded2;return this.#t(),this.#o(_0x38c56b(0x1e4),{'sourceId':_0x132e37,'refreshCadence':_0x5a1838[_0x38c56b(0x1bb)],'rootUrl':_0x5a1838[_0x38c56b(0x233)],'includePaths':_0x5a1838[_0x38c56b(0x22f)],'excludePaths':_0x5a1838['excludePaths'],'maxDepth':_0x5a1838['maxDepth'],'maxPages':_0x5a1838[_0x38c56b(0x20d)],'resync':_0x5a1838[_0x38c56b(0x232)]});}async[_0xb7ded2(0x1e3)](_0x2bafba){const _0x5516fd=_0xb7ded2;return this.#t(),this.#o(_0x5516fd(0x1e3),{'sourceId':_0x2bafba});}async[_0xb7ded2(0x183)](_0x4b2c99){return this.#t(),this.#o('deleteWebSource',{'sourceId':_0x4b2c99});}async #o(_0x4187e1,_0x5b3ae7){const _0x409ef0=_0xb7ded2;if(this.#s===null)throw new Error(_0x409ef0(0x18d));return j(this.#r,this.#s,_0x4187e1,_0x5b3ae7);}async[_0xb7ded2(0x216)](_0x4a5a9e,_0x2d123c){return this.#t(),this.#e['getDocs'](_0x4a5a9e,_0x2d123c);}async[_0xb7ded2(0x18e)](_0x1e7cbd,_0x39c933){return this.#t(),this.#e['loadIndex'](_0x1e7cbd,_0x39c933);}async[_0xb7ded2(0x1a5)](_0x5b75f7,_0x547190){const _0x8ecec7=_0xb7ded2;return this.#t(),this.#e[_0x8ecec7(0x1a5)](_0x5b75f7,_0x547190);}async[_0xb7ded2(0x1f2)](_0x5aaab6){const _0x10f955=_0xb7ded2;return this.#t(),this.#e[_0x10f955(0x1f2)](_0x5aaab6);}async['unloadIndexes'](_0x5d0fff){return this.#t(),this.#e['unloadIndexes'](_0x5d0fff);}async[_0xb7ded2(0x229)](_0x7438c8,_0x4002c0,_0x36dd6e){return this.#t(),this.#e['query'](_0x7438c8,_0x4002c0,_0x36dd6e);}async['queryMultiIndex'](_0x4fef6d,_0x244526,_0x56cb8d){return this.#t(),this.#e['queryMultiIndex'](_0x4fef6d,_0x244526,_0x56cb8d);}async[_0xb7ded2(0x19c)](_0x505baf,_0x42774f=W,_0x521f5d){const _0x3f4673=_0xb7ded2;this.#t();let _0x218297=this.#e[_0x3f4673(0x169)],_0x12e6cb;if(this.#s!==null)_0x12e6cb=await h[_0x3f4673(0x221)](_0x505baf,_0x42774f,this.#r,this.#s,void 0x0,_0x218297,_0x521f5d);else{let _0x3cc55c=await this.#e[_0x3f4673(0x1b7)](_0x505baf,_0x42774f,_0x521f5d);_0x12e6cb=h[_0x3f4673(0x190)](_0x505baf,_0x42774f,_0x3cc55c,_0x218297);}await _0x12e6cb[_0x3f4673(0x1e9)]();for(let _0x1567b4 of this.#n)_0x1567b4[_0x3f4673(0x1f5)]()||this.#n[_0x3f4673(0x220)](_0x1567b4);return this.#n[_0x3f4673(0x212)](new WeakRef(_0x12e6cb)),_0x12e6cb;}#t(){const _0x1b95e8=_0xb7ded2;if(this.#i)throw new Error(_0x1b95e8(0x199));}[_0xb7ded2(0x172)](){return this.#a??=this.#u(),this.#a;}async #u(){const _0x1ff043=_0xb7ded2;this.#i=!0x0;let _0x404b33=[...this.#n][_0x1ff043(0x1c6)](_0x10731e=>_0x10731e['deref']())[_0x1ff043(0x20a)](_0x14efc9=>_0x14efc9!==void 0x0);this.#n['clear'](),await Promise[_0x1ff043(0x22b)](_0x404b33[_0x1ff043(0x1c6)](_0x5ad13f=>_0x5ad13f[_0x1ff043(0x172)]())),await this.#e['close']();}async[Symbol['asyncDispose']](){const _0x5aa60e=_0xb7ded2;return this[_0x5aa60e(0x172)]();}};export{M as ManageApiError,R as MossClient,h as SessionIndex,re as isMossError};
|
package/dist/moss.d.ts
CHANGED
|
@@ -95,6 +95,9 @@ declare interface IdentityTarget {
|
|
|
95
95
|
setIdentity(deviceId?: string | null, userId?: string | null, mossDeviceId?: string | null): void;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
/** True when `error` carries a stable Moss `code`, set by the native core or the SDK. */
|
|
99
|
+
export declare function isMossError(error: unknown): error is MossError;
|
|
100
|
+
|
|
98
101
|
/**
|
|
99
102
|
* ISO 8601 date string format.
|
|
100
103
|
* @example "2025-09-26T15:04:05Z"
|
|
@@ -128,9 +131,14 @@ export declare interface LoadIndexesResult {
|
|
|
128
131
|
*/
|
|
129
132
|
loaded: string[];
|
|
130
133
|
/**
|
|
131
|
-
* Names that failed to load, mapping name to
|
|
134
|
+
* Names that failed to load, mapping name to a fixed public message.
|
|
132
135
|
*/
|
|
133
136
|
failed: Record<string, string>;
|
|
137
|
+
/**
|
|
138
|
+
* Names that failed to load, mapping name to the error code. Set by the
|
|
139
|
+
* matching `@moss-js/moss-core`.
|
|
140
|
+
*/
|
|
141
|
+
failedCodes?: Record<string, MossErrorCode>;
|
|
134
142
|
}
|
|
135
143
|
|
|
136
144
|
/**
|
|
@@ -519,7 +527,7 @@ export declare class MossClient {
|
|
|
519
527
|
*
|
|
520
528
|
* The index must have been loaded via `loadIndex()` or `loadIndexes()`;
|
|
521
529
|
* queries run entirely in-memory with no network round-trip. Querying an
|
|
522
|
-
* index that is not loaded rejects with
|
|
530
|
+
* index that is not loaded rejects with a `NOT_FOUND` error naming the load call.
|
|
523
531
|
*
|
|
524
532
|
* Loaded foundation indexes require an exact model artifact identity before
|
|
525
533
|
* Moss can generate query embeddings locally. For an older identity-less
|
|
@@ -633,6 +641,21 @@ export declare interface MossClientOptions {
|
|
|
633
641
|
identity?: MossIdentity;
|
|
634
642
|
}
|
|
635
643
|
|
|
644
|
+
/**
|
|
645
|
+
* An `Error` with a stable `code`, from the native core or the SDK.
|
|
646
|
+
* A core failure carries fixed text for each kind of failure, and `detail`
|
|
647
|
+
* holds the core error text. An SDK error describes its cause and has no `detail`.
|
|
648
|
+
*/
|
|
649
|
+
export declare interface MossError extends Error {
|
|
650
|
+
/** The kind of failure, stable across releases. */
|
|
651
|
+
code: MossErrorCode;
|
|
652
|
+
/** The core error text, for logs and support. Diagnostic text, not a stable contract. */
|
|
653
|
+
detail?: string;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/** Stable code on every error the native core or the SDK reports. */
|
|
657
|
+
export declare type MossErrorCode = "INVALID_ARGUMENT" | "NOT_FOUND" | "UNAUTHORIZED" | "NETWORK" | "DESERIALIZATION" | "MODEL_UNAVAILABLE" | "INTERNAL";
|
|
658
|
+
|
|
636
659
|
/**
|
|
637
660
|
* Caller-managed stable identity for a MossClient lifetime. Supplied values
|
|
638
661
|
* must be 1-256 UTF-8 bytes with no leading or trailing whitespace, Unicode
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moss-js/moss",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"main": "dist/index.esm.js",
|
|
5
5
|
"module": "dist/index.esm.js",
|
|
6
6
|
"types": "dist/moss.d.ts",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"author": "InferEdge Inc.",
|
|
46
46
|
"license": "SEE LICENSE IN LICENSE",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@moss-js/moss-core": "0.
|
|
48
|
+
"@moss-js/moss-core": "0.31.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@eslint/js": "^9.39.4",
|