@moss-js/moss 1.16.0 → 1.17.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/README.md CHANGED
@@ -100,67 +100,15 @@ device fields contain that Moss UUID.
100
100
 
101
101
  ## Telemetry
102
102
 
103
- The SDK reports usage to the Moss cloud at `$MOSS_INDEX_URL/telemetry`
104
- (`https://service.usemoss.dev/index/telemetry` by default). Telemetry is always
105
- on, because the device id and the query count drive usage billing. Requests are
106
- sent in the background. A failed send is dropped and never fails the call that
107
- caused it.
108
-
109
- Queries do not send a request each. The SDK buffers their events, with the same
110
- fields as below, and sends them every 3 seconds while queries run, plus once
111
- more when the client or session is closed. A send puts up to 500 query events in
112
- one JSON array per request. The buffer holds up to 10,000 events between sends,
113
- and events past that are dropped. Other events are sent one per request, when
114
- the operation happens.
115
-
116
- `close()` on a client or session resolves after that last send finishes, so
117
- await it before the process exits. A process that exits without closing can
118
- lose up to 3 seconds of query events. Each flush waits at most 5 seconds for
119
- authentication and 3 seconds per request, and drops its events when either fails.
120
-
121
- ### Fields on every event
122
-
123
- | Field | Value |
124
- |---|---|
125
- | `action` | Always `"telemetry"`. |
126
- | `eventType` | The event type, from the table below. |
127
- | `projectId` | Your project id. |
128
- | `clientId`, `sessionId` | The same random id, one per client or session object. |
129
- | `sdkVersion`, `sdkPackageVersion` | Version of the native binding package. |
130
- | `nativeCoreVersion` | Version of the Rust core. |
131
- | `modelCacheSchemaVersion` | Layout version of the on-disk model cache. |
132
- | `deviceId` | Billable device id: your `identity.deviceId`, or else the Moss device UUID. |
133
- | `mossDeviceId` | The Moss device UUID stored in `.moss-device-id`. |
134
- | `userId` | Only when you set one. Never billable. |
135
- | `indexName` | The index, when the event concerns one index. |
136
- | `modelId`, `modelArtifactVersion`, `modelManifestSha256` | The embedding model and its exact artifact, when known. |
137
-
138
- ### Event types and their extra fields
139
-
140
- | Event | Sent when | Extra fields |
141
- |---|---|---|
142
- | `index.load` | An index loads | `docCount`, `autoRefresh`, `refreshIntervalSecs` (with auto refresh), `cached` (a cache path was given), `servedStale` (served from the cache while the cloud is unreachable), `modelCacheGeneration` |
143
- | `index.auto_refresh` | An auto refresh poll finishes | `changed`, `modelCacheGeneration` |
144
- | `index.unload` | An index unloads or the client closes | `modelCacheGeneration` |
145
- | `index.query` | A single-index query runs, sent in a batch | `latencyMs`, `modelCacheGeneration` |
146
- | `index.query_multi` | A multi-index query runs, sent in a batch | The `index.query` fields, plus `indexCount` and `indexNames`. `modelCacheGeneration` when every index shares one, else `modelCacheGenerationsByIndex`. |
147
- | `index.usage.periodic_flush`, `index.usage.final_flush` | Every 3 seconds while there is usage, and at close | `queryCount`, `docsEmbedded`, `tokensEstimated` |
148
- | `session.load` | A session loads an index from the cloud | `docCount` |
149
- | `session.load_from_disk` | A session loads a local snapshot | `docCount`, plus `rebuilt` and `persisted` when a legacy snapshot is rebuilt |
150
- | `session.add_docs`, `session.delete_docs` | Documents are added or deleted | `docCount` |
151
- | `session.push_index` | A session pushes its index | `docCount` |
152
- | `session.auto_refresh_staged` | A newer cloud version is downloaded | `updatedAt` |
153
- | `session.auto_refresh` | A downloaded version is installed | `changed`, `docCount`, `updatedAt` |
154
- | `session.unload` | A session is closed | None |
155
- | `session.query` | A session query runs, sent in a batch | `latencyMs` |
156
- | `session.usage.periodic_flush`, `session.usage.final_flush` | Every 3 seconds while there is usage, at close, and before a push | `queryCount`, `docsEmbedded`, `tokensEstimated` |
157
-
158
- `latencyMs` on a query event is the time that query took, in milliseconds.
159
- `index.query` and `index.query_multi` time the whole call, including the query
160
- embedding. `session.query` times the search lookup only, without embedding, so
161
- the two are not directly comparable.
162
-
163
- No document text, query text, metadata or embedding is ever sent.
103
+ The SDK always sends usage telemetry to the Moss cloud, and there is no option
104
+ to turn it off. It sends event types, your project id, index names, query and
105
+ document counts, query latencies, SDK and model versions, and a device id: a
106
+ random UUID stored on the device, or the `identity.deviceId` you supply, plus
107
+ `identity.userId` when you set one. Telemetry never includes query text,
108
+ document text, metadata, embeddings or file paths. Document text and embeddings
109
+ leave the device only when you create, add to or push an index in the cloud.
110
+
111
+ See [Telemetry](https://docs.moss.dev/docs/reference/telemetry) for every field and when it is sent.
164
112
 
165
113
  ## Resource cleanup
166
114
 
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
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};
1
+ const _0x5b9f34=_0x5487;(function(_0x442818,_0x340711){const _0x25067b=_0x5487,_0x3ccd46=_0x442818();while(!![]){try{const _0x438f4f=parseInt(_0x25067b(0x17c))/0x1+-parseInt(_0x25067b(0x1b4))/0x2*(parseInt(_0x25067b(0x1fa))/0x3)+parseInt(_0x25067b(0x1d8))/0x4+parseInt(_0x25067b(0x230))/0x5+parseInt(_0x25067b(0x242))/0x6+-parseInt(_0x25067b(0x22b))/0x7+-parseInt(_0x25067b(0x197))/0x8;if(_0x438f4f===_0x340711)break;else _0x3ccd46['push'](_0x3ccd46['shift']());}catch(_0x2e2135){_0x3ccd46['push'](_0x3ccd46['shift']());}}}(_0x5b4c,0xda705));import{JobStatus as _0x51b0f6}from'@moss-js/moss-core';import*as _0xdfe61 from'@moss-js/moss-core';import*as _0x526d8f from'@moss-js/moss-core';function _0x5b4c(){const _0x457cc7=['utf8','body','building','74628vJbcCa','warn','toLowerCase','Completed','listWebSources','received\x20an\x20array\x20where\x20a\x20JobProgress\x20object\x20was\x20expected','manifestSha256','refreshCadence','createAuthenticatedSessionInner','/v1/manage','applySessionIdentity','map','function','maxPages','authNotifyFn','slice','manageClient','session','\x20must\x20not\x20have\x20leading\x20or\x20trailing\x20whitespace','hasIndex','\x20must\x20be\x20at\x20most\x20','version','cachePath','NaN','toByteArray','upsert','CLOUD_API_AUTH_URL','3438944mDiPBQ','message','added','parseOptions','resolveAuthRequest','invalidate','_warmModel','env','deref','authUrl','unloadIndexes','Bearer\x20','MOSS_INDEX_URL','moss-core\x20runtime\x20is\x20missing\x20resolveAuthRequest/rejectAuthRequest\x20exports.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','deleteDocs\x20requires\x20at\x20least\x20one\x20document\x20ID','setIdentity','HTTP\x20error!\x20status:\x20','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20MossClient.close()','updated','getDocuments','all','timeout','withAuthenticator','create','deviceIdentity','candidateDepth','getAuthHeader','moss-core\x20runtime\x20SessionIndex\x20is\x20missing\x20the\x20withAuthenticator\x20factory.\x20Upgrade\x20@moss-js/moss-core\x20to\x20a\x20build\x20that\x20supports\x20custom\x20authenticators\x20for\x20sessions.','data','10YQRrbX','startsWith','byteLength','configuredIdentity','default','cachePathDeviceId','addDocs\x20requires\x20at\x20least\x20one\x20document','getIndex','INVALID_ARGUMENT','loadIndex','deviceId','identity','isArray','[moss]\x20Dropping\x20a\x20malformed\x20job\x20progress\x20event;\x20progress\x20reporting\x20may\x20be\x20incomplete\x20for\x20this\x20operation.\x20Cause:\x20','modelId','then','rootUrl','[moss]\x20Ignoring\x20an\x20auth\x20request\x20with\x20no\x20usable\x20request\x20id;\x20custom\x20authentication\x20may\x20be\x20unavailable\x20for\x20this\x20client.\x20Cause:\x20','asyncDispose','encode','text','stringify','userId','isSafeInteger','error','cache','queryText','getDocs','Uploading','received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20status\x20(','queryMultiIndexText','MOSS_AUTH_URL','close','applyIdentity','_fromInner','replace','5102812cVsIKg','deleteDocs','length','call','object','ensureCachePathDeviceId','projectId','onProgress','maxDocuments','loadFromDisk','received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20jobId\x20(','Unsupported\x20data\x20type\x20for\x20file\x20upload','_create','entries','excludePaths','test','Unsupported\x20job\x20status\x20\x27','expiresAt','docCount','addDocs','.\x20All\x20documents\x20must\x20have\x20.embedding\x20set\x20when\x20using\x20modelId=\x27custom\x27.','moss-core\x20rejected\x20the\x20auth\x20token:\x20','pending_upload','listIndexes','currentPhase','normalizeJobStatus','moss-minilm','hasCustomAuthenticator','createIndex','topK','resync','\x27\x20returned\x20by\x20moss-core','status','embedding','361347cOVIvx','includePaths','saveToDisk','parse','addDocumentsText','SDK_VERSION_NUMBER','wrapProgress','createIndex\x20requires\x20at\x20least\x20one\x20document','MOSS_CLOUD_API_BASE_URL','trim','createAuthenticatedSessionInner\x20requires\x20a\x20custom\x20IAuthenticator\x20client','addDocuments','maxDepth','\x20UTF-8\x20bytes','json','received\x20a\x20progress\x20event\x20with\x20a\x20non-finite\x20progress\x20value\x20(','pushIndex','alpha','.moss-device-id','string','requireMultiIndexCore','queryMultiIndex\x20requires\x20at\x20least\x20one\x20index\x20name','sources','\x20contains\x20an\x20unsupported\x20character','name','unloadIndex','https://service.usemoss.dev','minScore','fromEntries','query','Web\x20source\x20methods\x20require\x20a\x20project\x20key.\x20Construct\x20MossClient\x20with\x20(projectId,\x20projectKey).','custom','POST','delete','getJobStatus','indexManager','getAuthToken','from','filter','resyncWebSource','createIndexFromFiles','application/json','jobId','now','Authentication\x20failed\x20(HTTP\x20401):\x20','projectKey','some','This\x20session\x20uses\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20embedding\x20via\x20QueryOptions.embedding.','The\x20installed\x20@moss-js/moss-core\x20does\x20not\x20support\x20multi-index\x20operations\x20(queryMultiIndex,\x20loadIndexes,\x20unloadIndexes).\x20Upgrade\x20@moss-js/moss-core.','7479059fGLvgs','contentType','MossClient\x20options.identity\x20must\x20be\x20an\x20object','inner','token','7068575lteeJA','createWebSource','Documents\x20missing\x20.embedding\x20for\x20custom\x20model:\x20','fetchAndCache','expiresIn','SessionIndex','bind','number','updateWebSource','code','inspectSnapshot','moss-core\x20runtime\x20ManageClient/IndexManager\x20is\x20missing\x20withAuthenticator\x20factory.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','received\x20','Building','IndexManager','freeze','PendingUpload','ManageClient','1387374omVgZj','createIndexFromFiles\x20requires\x20at\x20least\x20one\x20file','arrayBuffer','keys','completed','MossClient\x20options.identity.','Failed','CLOUD_API_IDENTITY_URL','rejectAuthRequest','progress','deleteDocuments','[moss]\x20Auth\x20request\x20','mossDeviceId','deleteIndex','The\x20installed\x20@moss-js/moss-core\x20runtime\x20does\x20not\x20support\x20exact\x20model\x20artifact\x20identities.\x20Upgrade\x20moss-core\x20before\x20creating\x20this\x20session.','deleteWebSource','inflight','\x27\x20is\x20closed','loadIndexes','authenticator','\x22\x20is\x20not\x20loaded.\x20Call\x20loadIndex(\x22','received\x20a\x20progress\x20event\x20with\x20a\x20non-string\x20currentPhase\x20(','queryMultiIndex','pendingupload'];_0x5b4c=function(){return _0x457cc7;};return _0x5b4c();}var p=_0x526d8f,he=p['MODEL_DOWNLOAD_URL'],ge=p[_0x5b9f34(0x1ff)],pe=p[_0x5b9f34(0x168)],U=p[_0x5b9f34(0x196)],fe=typeof process<'u'&&process[_0x5b9f34(0x19e)][_0x5b9f34(0x1a3)]||p['CLOUD_API_INDEX_URL'],k=typeof process<'u'?process['env']:{},y=class{constructor(_0x25c483,_0x2a26a4){const _0x17c345=_0x5b9f34;this['projectId']=_0x25c483,this[_0x17c345(0x227)]=_0x2a26a4,this[_0x17c345(0x1a0)]=k[_0x17c345(0x1d3)]??U;}[_0x5b9f34(0x1de)];[_0x5b9f34(0x227)];[_0x5b9f34(0x1a0)];async[_0x5b9f34(0x21e)](){const _0x2a0e18=_0x5b9f34;let _0x166506=await fetch(this['authUrl'],{'method':'POST','headers':{'Content-Type':_0x2a0e18(0x223)},'body':JSON['stringify']({'projectId':this['projectId'],'projectKey':this[_0x2a0e18(0x227)]}),'signal':AbortSignal[_0x2a0e18(0x1ac)](0x7530)});if(_0x166506[_0x2a0e18(0x1f8)]===0x191){let _0x5bf83f=await _0x166506[_0x2a0e18(0x1c8)]();throw new Error(_0x2a0e18(0x226)+_0x5bf83f);}if(!_0x166506['ok']){let _0x1e4e89=await _0x166506[_0x2a0e18(0x1c8)]();throw new Error('HTTP\x20'+_0x166506[_0x2a0e18(0x1f8)]+':\x20'+_0x1e4e89);}let _0x3e3ca0=await _0x166506[_0x2a0e18(0x208)]();return{'token':_0x3e3ca0[_0x2a0e18(0x22f)],'expiresIn':_0x3e3ca0[_0x2a0e18(0x234)]};}async[_0x5b9f34(0x1b1)](){const _0x4efdee=_0x5b9f34;let {token:_0x1a7963}=await this[_0x4efdee(0x21e)]();return _0x4efdee(0x1a2)+_0x1a7963;}},x=class{constructor(_0x4c27c2){this['inner']=_0x4c27c2;}[_0x5b9f34(0x22e)];[_0x5b9f34(0x1cd)]=null;[_0x5b9f34(0x171)]=null;async[_0x5b9f34(0x21e)](){const _0x56f801=_0x5b9f34;if(this[_0x56f801(0x1cd)]&&this[_0x56f801(0x1cd)][_0x56f801(0x1e9)]>Date[_0x56f801(0x225)]())return{'token':this['cache'][_0x56f801(0x22f)],'expiresIn':this[_0x56f801(0x1cd)][_0x56f801(0x234)]};if(this[_0x56f801(0x171)])return this[_0x56f801(0x171)];this[_0x56f801(0x171)]=this[_0x56f801(0x233)]();try{return await this[_0x56f801(0x171)];}finally{this['inflight']=null;}}async[_0x5b9f34(0x1b1)](){const _0x3360ce=_0x5b9f34;let {token:_0x3ee198}=await this[_0x3360ce(0x21e)]();return'Bearer\x20'+_0x3ee198;}[_0x5b9f34(0x19c)](_0x4a6038){const _0x2947d0=_0x5b9f34;this[_0x2947d0(0x1cd)]?.[_0x2947d0(0x22f)]===_0x4a6038&&(this[_0x2947d0(0x1cd)]=null);}async[_0x5b9f34(0x233)](){const _0x1aecba=_0x5b9f34;let {token:_0x154cf8,expiresIn:_0x11ee1b}=await this[_0x1aecba(0x22e)][_0x1aecba(0x21e)](),_0x20c67e=Q(_0x11ee1b);return this['cache']=_0x20c67e>0x0?{'token':_0x154cf8,'expiresIn':_0x11ee1b,'expiresAt':Date[_0x1aecba(0x225)]()+_0x20c67e*0x3e8}:null,{'token':_0x154cf8,'expiresIn':_0x11ee1b};}};function Q(_0x2e19fb){const _0x2da6b3=_0x5b9f34;let _0x5d425d=typeof _0x2e19fb==_0x2da6b3(0x237)||typeof _0x2e19fb==_0x2da6b3(0x20d)?Number(_0x2e19fb):Number[_0x2da6b3(0x193)];return!Number['isFinite'](_0x5d425d)||_0x5d425d<=0x0?0x0:Math['max'](_0x5d425d*0.9,_0x5d425d-0x3c);}import{randomUUID as _0x2eae12}from'node:crypto';import{existsSync as _0x4f9ae0,mkdirSync as _0x1317ae,readFileSync as _0x23d8cb,writeFileSync as _0x52ace3}from'node:fs';import{join as _0xae99f6}from'node:path';var ee=_0x5b9f34(0x20c),A=0x100,N=/[\p{Cc}\p{Cf}\p{Cs}\uFFFD]/u;function te(_0x3e6e76){const _0x4cceed=_0x5b9f34;return _0x3e6e76[_0x4cceed(0x1da)]>0x0&&_0x3e6e76['trim']()===_0x3e6e76&&!N['test'](_0x3e6e76)&&new TextEncoder()[_0x4cceed(0x1c7)](_0x3e6e76)[_0x4cceed(0x1b6)]<=A;}function _0x5487(_0x27d31a,_0x2c709d){_0x27d31a=_0x27d31a-0x165;const _0x5b4ce2=_0x5b4c();let _0x548763=_0x5b4ce2[_0x27d31a];return _0x548763;}function L(_0xb263d9,_0x21872d){const _0x9c6fe7=_0x5b9f34;if(_0xb263d9!==void 0x0){if(typeof _0xb263d9!='string'||_0xb263d9[_0x9c6fe7(0x1da)]===0x0)throw new TypeError('MossClient\x20options.identity.'+_0x21872d+'\x20must\x20be\x20a\x20non-empty\x20string');if(_0xb263d9['trim']()!==_0xb263d9)throw new TypeError(_0x9c6fe7(0x166)+_0x21872d+_0x9c6fe7(0x18e));if(N[_0x9c6fe7(0x1e7)](_0xb263d9))throw new TypeError(_0x9c6fe7(0x166)+_0x21872d+_0x9c6fe7(0x211));if(new TextEncoder()['encode'](_0xb263d9)[_0x9c6fe7(0x1b6)]>A)throw new TypeError('MossClient\x20options.identity.'+_0x21872d+_0x9c6fe7(0x190)+A+_0x9c6fe7(0x207));return _0xb263d9;}}function q(_0x3532a6){const _0x47c153=_0x5b9f34;if(_0x3532a6!==void 0x0){if(_0x3532a6===null||typeof _0x3532a6!=_0x47c153(0x1dc)||Array['isArray'](_0x3532a6))throw new TypeError(_0x47c153(0x22d));return Object[_0x47c153(0x23f)]({'deviceId':L(_0x3532a6['deviceId'],'deviceId'),'userId':L(_0x3532a6[_0x47c153(0x1ca)],_0x47c153(0x1ca))});}}function F(_0x1fd0db){const _0x3e4dc3=_0x5b9f34;return _0x1fd0db?.[_0x3e4dc3(0x1be)]!==void 0x0||_0x1fd0db?.[_0x3e4dc3(0x1ca)]!==void 0x0;}function D(_0x264405){const _0x4fbca4=_0x5b9f34;if(!_0x264405?.[_0x4fbca4(0x203)]())return;let _0x45b363=_0xae99f6(_0x264405,ee);try{if(_0x4f9ae0(_0x45b363)){let _0x1ab5c8=_0x23d8cb(_0x45b363,_0x4fbca4(0x179))[_0x4fbca4(0x203)]();return te(_0x1ab5c8)?_0x1ab5c8:void 0x0;}_0x1317ae(_0x264405,{'recursive':!0x0});let _0x1c281e=_0x2eae12();return _0x52ace3(_0x45b363,_0x1c281e,_0x4fbca4(0x179)),_0x1c281e;}catch{return;}}var ne=0x1;function b(_0x3598f0){const _0x16d193=_0x5b9f34;let _0x381731=_0x3598f0['modelArtifactContractVersion'];if(typeof _0x381731!=_0x16d193(0x188))throw j();let _0x45c8ba=_0x381731[_0x16d193(0x1db)](_0x3598f0);if(!Number[_0x16d193(0x1cb)](_0x45c8ba)||_0x45c8ba<ne)throw j();}function j(){const _0xf5fd43=_0x5b9f34;return new Error(_0xf5fd43(0x16f));}var Ae=0x708*0x3e8,re={'INVALID_ARGUMENT':!0x0,'NOT_FOUND':!0x0,'UNAUTHORIZED':!0x0,'NETWORK':!0x0,'DESERIALIZATION':!0x0,'MODEL_UNAVAILABLE':!0x0,'INTERNAL':!0x0},se=new Set(Object[_0x5b9f34(0x245)](re));function oe(_0x5ebbbb){const _0x2bbd56=_0x5b9f34;if(!(_0x5ebbbb instanceof Error))return!0x1;let _0x10a119=_0x5ebbbb[_0x2bbd56(0x239)];return typeof _0x10a119==_0x2bbd56(0x20d)&&se['has'](_0x10a119);}function f(_0x11c6b5,_0x1aa275){return Object['assign'](new Error(_0x1aa275),{'code':_0x11c6b5});}function w(_0x538be0){const _0x2ae31e=_0x5b9f34;if(!(_0x538be0?.[_0x2ae31e(0x215)]===void 0x0&&_0x538be0?.[_0x2ae31e(0x1b0)]===void 0x0))return{'minScore':_0x538be0[_0x2ae31e(0x215)],'candidateDepth':_0x538be0[_0x2ae31e(0x1b0)]};}function R(_0x2e3770){return _0x2e3770 instanceof Error?_0x2e3770['message']:String(_0x2e3770);}function ie(_0x518aa9){const _0x109797=_0x5b9f34;if(_0x518aa9===null||typeof _0x518aa9!=_0x109797(0x1dc))return'received\x20'+String(_0x518aa9);if(Array[_0x109797(0x1c0)](_0x518aa9))return _0x109797(0x181);let _0x206ebc=_0x518aa9;return typeof _0x206ebc[_0x109797(0x224)]!='string'||_0x206ebc['jobId']['length']===0x0?_0x109797(0x1e2)+String(_0x206ebc[_0x109797(0x224)])+')':typeof _0x206ebc['status']!=_0x109797(0x20d)||_0x206ebc[_0x109797(0x1f8)]['length']===0x0?_0x109797(0x1d1)+String(_0x206ebc['status'])+')':typeof _0x206ebc[_0x109797(0x16a)]!=_0x109797(0x237)||!Number['isFinite'](_0x206ebc[_0x109797(0x16a)])?_0x109797(0x209)+String(_0x206ebc[_0x109797(0x16a)])+')':_0x206ebc[_0x109797(0x1f0)]!==void 0x0&&_0x206ebc[_0x109797(0x1f0)]!==null&&typeof _0x206ebc[_0x109797(0x1f0)]!=_0x109797(0x20d)?_0x109797(0x176)+String(_0x206ebc[_0x109797(0x1f0)])+')':null;}var P=class{[_0x5b9f34(0x174)];[_0x5b9f34(0x18c)];[_0x5b9f34(0x21d)];[_0x5b9f34(0x1b9)];[_0x5b9f34(0x1b7)];[_0x5b9f34(0x1de)];[_0x5b9f34(0x18a)];constructor(_0x420086,_0x4e8e01,_0x34c49e){const _0x3aa97a=_0x5b9f34;this['configuredIdentity']=q(_0x34c49e?.[_0x3aa97a(0x1bf)]),this[_0x3aa97a(0x1b9)]=D(_0x34c49e?.[_0x3aa97a(0x192)]),this['projectId']=_0x420086;let _0x27aa70=typeof _0x4e8e01==_0x3aa97a(0x20d)?new y(_0x420086,_0x4e8e01):_0x4e8e01;this[_0x3aa97a(0x174)]=new x(_0x27aa70);let _0x536de0=_0xdfe61,_0x484e57=_0x536de0['ManageClient']??_0x536de0[_0x3aa97a(0x1b8)]?.[_0x3aa97a(0x241)],_0x159996=_0x536de0[_0x3aa97a(0x23e)]??_0x536de0['default']?.[_0x3aa97a(0x23e)];if(!_0x484e57||!_0x159996)throw new Error('moss-core\x20runtime\x20is\x20missing\x20ManageClient/IndexManager\x20exports');if(typeof _0x4e8e01==_0x3aa97a(0x20d))this[_0x3aa97a(0x18c)]=new _0x484e57(_0x420086,_0x4e8e01),this[_0x3aa97a(0x21d)]=new _0x159996(_0x420086,_0x4e8e01);else{let _0x379c36=_0x536de0[_0x3aa97a(0x19b)]??_0x536de0[_0x3aa97a(0x1b8)]?.[_0x3aa97a(0x19b)],_0x48619d=_0x536de0[_0x3aa97a(0x169)]??_0x536de0[_0x3aa97a(0x1b8)]?.[_0x3aa97a(0x169)];if(!_0x379c36||!_0x48619d)throw new Error(_0x3aa97a(0x1a4));let _0x3c4bbf=this[_0x3aa97a(0x174)],_0x4e1684=(_0x8e85f2,_0xfa1084)=>{const _0x2e2ced=_0x3aa97a;try{_0x48619d(_0x8e85f2,_0xfa1084);}catch(_0x25be85){console['warn'](_0x2e2ced(0x16c)+_0x8e85f2+'\x20could\x20not\x20be\x20settled:\x20'+R(_0x25be85));}},_0xfc4aaa=(_0x3e80e0,_0xd83296)=>{const _0x6ece4c=_0x3aa97a;try{_0x379c36(_0x3e80e0,_0xd83296);}catch(_0x39498e){_0x4e1684(_0x3e80e0,_0x6ece4c(0x1ed)+R(_0x39498e));}},_0x1b8e8f=!0x1,_0x1544fe=(_0x5edeab,_0x288b56,_0x134e38)=>{const _0x506d64=_0x3aa97a;if(_0x5edeab||!Number[_0x506d64(0x1cb)](_0x288b56)||_0x288b56<0x0){_0x1b8e8f||(_0x1b8e8f=!0x0,console[_0x506d64(0x17d)](_0x506d64(0x1c5)+(_0x5edeab?_0x5edeab[_0x506d64(0x198)]:_0x506d64(0x23c)+String(_0x288b56))));return;}typeof _0x134e38==_0x506d64(0x20d)&&_0x3c4bbf[_0x506d64(0x19c)](_0x134e38),_0x3c4bbf[_0x506d64(0x1b1)]()[_0x506d64(0x1c3)](_0x3bce72=>{const _0x169de1=_0x506d64;let _0x4ff2d1=_0x3bce72[_0x169de1(0x1b5)]('Bearer\x20')?_0x3bce72[_0x169de1(0x18b)](0x7):_0x3bce72;_0xfc4aaa(_0x288b56,_0x4ff2d1);},_0x1fc686=>_0x4e1684(_0x288b56,R(_0x1fc686)));};this[_0x3aa97a(0x18a)]=_0x1544fe;let _0x11633f=_0x484e57,_0x443570=_0x159996;if(!_0x11633f[_0x3aa97a(0x1ad)]||!_0x443570[_0x3aa97a(0x1ad)])throw new Error(_0x3aa97a(0x23b));this['manageClient']=_0x11633f[_0x3aa97a(0x1ad)](_0x420086,_0x1544fe),this[_0x3aa97a(0x21d)]=_0x443570[_0x3aa97a(0x1ad)](_0x420086,_0x1544fe);}this[_0x3aa97a(0x1d5)](this[_0x3aa97a(0x21d)]);}async[_0x5b9f34(0x1d4)](){const _0x3d713e=_0x5b9f34;let _0x58b448=this[_0x3d713e(0x21d)][_0x3d713e(0x1d4)];if(typeof _0x58b448!='function')throw new Error(_0x3d713e(0x1a8));await _0x58b448['call'](this[_0x3d713e(0x21d)]);}async[_0x5b9f34(0x21e)](){const _0x20f30a=_0x5b9f34;return this[_0x20f30a(0x174)][_0x20f30a(0x21e)]();}[_0x5b9f34(0x200)](_0x145658){if(!_0x145658)return;let _0x5035a2=!0x1;return(_0x32f6ce,_0x29c0ff)=>{const _0x222b20=_0x5487;let _0x52eb3f=_0x32f6ce?_0x32f6ce[_0x222b20(0x198)]:ie(_0x29c0ff);if(_0x52eb3f!==null){_0x5035a2||(_0x5035a2=!0x0,console[_0x222b20(0x17d)](_0x222b20(0x1c1)+_0x52eb3f));return;}_0x145658(_0x29c0ff);};}[_0x5b9f34(0x1f1)](_0xcf1e92){const _0x4c1494=_0x5b9f34;let _0x45225c=_0xcf1e92[_0x4c1494(0x203)]()[_0x4c1494(0x17e)]()['replace'](/\s+/g,'_'),_0x4fcc43=_0x45225c[_0x4c1494(0x1d7)](/_/g,'');if(_0x45225c===_0x4c1494(0x1ee)||_0x4fcc43===_0x4c1494(0x178))return _0x51b0f6[_0x4c1494(0x240)];if(_0x45225c==='uploading')return _0x51b0f6[_0x4c1494(0x1d0)];if(_0x45225c===_0x4c1494(0x17b))return _0x51b0f6[_0x4c1494(0x23d)];if(_0x45225c===_0x4c1494(0x165))return _0x51b0f6[_0x4c1494(0x17f)];if(_0x45225c==='failed')return _0x51b0f6[_0x4c1494(0x167)];throw new Error(_0x4c1494(0x1e8)+_0xcf1e92+_0x4c1494(0x1f7));}async[_0x5b9f34(0x1f4)](_0x252973,_0x46dfae,_0x465683,_0xc26f1e){const _0x28e70a=_0x5b9f34;if(!_0x46dfae[_0x28e70a(0x1da)])throw new Error(_0x28e70a(0x201));return await this[_0x28e70a(0x18c)][_0x28e70a(0x1f4)](_0x252973,_0x46dfae,_0x465683,this[_0x28e70a(0x200)](_0xc26f1e?.['onProgress']));}async[_0x5b9f34(0x194)](_0x513b78){const _0x57547f=_0x5b9f34;if(_0x513b78 instanceof Uint8Array)return Array[_0x57547f(0x21f)](_0x513b78);if(_0x513b78 instanceof ArrayBuffer)return Array['from'](new Uint8Array(_0x513b78));if(typeof _0x513b78[_0x57547f(0x244)]==_0x57547f(0x188)){let _0xf94070=await _0x513b78['arrayBuffer']();return Array[_0x57547f(0x21f)](new Uint8Array(_0xf94070));}throw new Error(_0x57547f(0x1e3));}async[_0x5b9f34(0x222)](_0x1414c7,_0x4b3312,_0x333fdb){const _0x122b59=_0x5b9f34;if(_0x4b3312[_0x122b59(0x1da)]===0x0)throw new Error(_0x122b59(0x243));let _0x228520=_0x333fdb?.[_0x122b59(0x1c2)]??_0x122b59(0x1f2),_0x339e48=await Promise[_0x122b59(0x1ab)](_0x4b3312['map'](async _0x37d510=>({'name':_0x37d510['name'],'contentType':_0x37d510[_0x122b59(0x22c)],'path':_0x37d510['path']??void 0x0,'data':_0x37d510[_0x122b59(0x1b3)]!=null?await this[_0x122b59(0x194)](_0x37d510[_0x122b59(0x1b3)]):void 0x0})));return await this[_0x122b59(0x18c)][_0x122b59(0x222)](_0x1414c7,_0x339e48,_0x228520,this['wrapProgress'](_0x333fdb?.['onProgress']),_0x333fdb?.[_0x122b59(0x19a)]??null);}async[_0x5b9f34(0x1eb)](_0x3aecb6,_0x50b9f6,_0x5c83d7){const _0x3b182c=_0x5b9f34;if(Array[_0x3b182c(0x1c0)](_0x50b9f6)&&_0x50b9f6[_0x3b182c(0x1da)]===0x0)throw new Error(_0x3b182c(0x1ba));return await this[_0x3b182c(0x18c)][_0x3b182c(0x1eb)](_0x3aecb6,_0x50b9f6,_0x5c83d7??null,this['wrapProgress'](_0x5c83d7?.[_0x3b182c(0x1df)]));}async[_0x5b9f34(0x1d9)](_0x1b12bc,_0x10f332,_0xb9ae4e){const _0x50664f=_0x5b9f34;if(Array[_0x50664f(0x1c0)](_0x10f332)&&_0x10f332[_0x50664f(0x1da)]===0x0)throw new Error(_0x50664f(0x1a5));return await this['manageClient'][_0x50664f(0x1d9)](_0x1b12bc,_0x10f332,this[_0x50664f(0x200)](_0xb9ae4e?.[_0x50664f(0x1df)]));}async[_0x5b9f34(0x21c)](_0x3b7415){const _0x10c27b=_0x5b9f34;let _0x57e087=await this[_0x10c27b(0x18c)][_0x10c27b(0x21c)](_0x3b7415);return{..._0x57e087,'status':this[_0x10c27b(0x1f1)](_0x57e087[_0x10c27b(0x1f8)]),'currentPhase':_0x57e087[_0x10c27b(0x1f0)]??null,'error':_0x57e087[_0x10c27b(0x1cc)]??null};}async['getIndex'](_0x58bc20){const _0x1ccab1=_0x5b9f34;return this['manageClient'][_0x1ccab1(0x1bb)](_0x58bc20);}async[_0x5b9f34(0x1ef)](){const _0x3f3326=_0x5b9f34;return this[_0x3f3326(0x18c)][_0x3f3326(0x1ef)]();}async[_0x5b9f34(0x16e)](_0x1f67c4){const _0x1529ad=_0x5b9f34;return this[_0x1529ad(0x18c)][_0x1529ad(0x16e)](_0x1f67c4);}async[_0x5b9f34(0x1cf)](_0x4f6d9c,_0x1e3baa){const _0x4d73d0=_0x5b9f34;return this['manageClient'][_0x4d73d0(0x1cf)](_0x4f6d9c,_0x1e3baa??null);}async[_0x5b9f34(0x1bd)](_0xa70331,_0x270741){const _0x51181d=_0x5b9f34;return this[_0x51181d(0x1dd)](_0x270741?.['cachePath']),(await this[_0x51181d(0x21d)][_0x51181d(0x1bd)](_0xa70331,_0x270741??null))[_0x51181d(0x212)];}async[_0x5b9f34(0x173)](_0x469f33,_0x3fd8db){const _0x26da7f=_0x5b9f34;let _0x1ba064=this[_0x26da7f(0x20e)]();return this['ensureCachePathDeviceId'](_0x3fd8db?.[_0x26da7f(0x192)]),_0x1ba064[_0x26da7f(0x173)](_0x469f33,_0x3fd8db??null);}async[_0x5b9f34(0x213)](_0x56863e){const _0x1fcae7=_0x5b9f34;return this[_0x1fcae7(0x21d)][_0x1fcae7(0x213)](_0x56863e);}async[_0x5b9f34(0x1a1)](_0x5cb798){const _0xad977d=_0x5b9f34;return this['requireMultiIndexCore']()[_0xad977d(0x1a1)](_0x5cb798);}['requireMultiIndexCore'](){const _0x211aa9=_0x5b9f34;let _0x51ab4b=this[_0x211aa9(0x21d)];if(typeof _0x51ab4b[_0x211aa9(0x177)]!=_0x211aa9(0x188)||typeof _0x51ab4b[_0x211aa9(0x1d2)]!=_0x211aa9(0x188)||typeof _0x51ab4b[_0x211aa9(0x173)]!=_0x211aa9(0x188)||typeof _0x51ab4b[_0x211aa9(0x1a1)]!=_0x211aa9(0x188))throw new Error(_0x211aa9(0x22a));return{'queryMultiIndex':_0x51ab4b['queryMultiIndex'][_0x211aa9(0x236)](_0x51ab4b),'queryMultiIndexText':_0x51ab4b[_0x211aa9(0x1d2)]['bind'](_0x51ab4b),'loadIndexes':_0x51ab4b[_0x211aa9(0x173)]['bind'](_0x51ab4b),'unloadIndexes':_0x51ab4b['unloadIndexes'][_0x211aa9(0x236)](_0x51ab4b)};}[_0x5b9f34(0x1dd)](_0x4cb9ca){const _0x109e24=_0x5b9f34;_0x4cb9ca&&this[_0x109e24(0x1b9)]===void 0x0&&D(_0x4cb9ca);}[_0x5b9f34(0x1d5)]=_0x1b6744=>{const _0x3ba133=_0x5b9f34;!F(this[_0x3ba133(0x1b7)])&&this[_0x3ba133(0x1b9)]===void 0x0||_0x1b6744[_0x3ba133(0x1a6)](this[_0x3ba133(0x1b7)]?.['deviceId']??null,this[_0x3ba133(0x1b7)]?.[_0x3ba133(0x1ca)]??null,this[_0x3ba133(0x1b9)]??null);};[_0x5b9f34(0x186)]=_0x18d1d7=>{const _0x2e786a=_0x5b9f34;let _0x19c215=this[_0x2e786a(0x21d)][_0x2e786a(0x1af)]?.();if(!_0x19c215){this[_0x2e786a(0x1d5)](_0x18d1d7);return;}_0x18d1d7[_0x2e786a(0x1a6)](_0x19c215[_0x2e786a(0x1be)]??null,this[_0x2e786a(0x1b7)]?.[_0x2e786a(0x1ca)]??null,_0x19c215[_0x2e786a(0x16d)]??null);};[_0x5b9f34(0x1f3)](){const _0x35b4b3=_0x5b9f34;return this[_0x35b4b3(0x18a)]!==void 0x0;}async[_0x5b9f34(0x184)](_0x311fe1,_0x26efb3,_0x2a561f){const _0x4c094b=_0x5b9f34;if(!this[_0x4c094b(0x18a)])throw new Error(_0x4c094b(0x204));let _0x470e02=_0xdfe61,_0x1f88f5=_0x470e02[_0x4c094b(0x235)]??_0x470e02[_0x4c094b(0x1b8)]?.['SessionIndex'];if(!_0x1f88f5||typeof _0x1f88f5[_0x4c094b(0x1ad)]!=_0x4c094b(0x188))throw new Error(_0x4c094b(0x1b2));return _0x2a561f&&b(_0x1f88f5),_0x1f88f5['withAuthenticator'](_0x311fe1,_0x26efb3,this[_0x4c094b(0x1de)],this[_0x4c094b(0x18a)],null,null,_0x2a561f?.[_0x4c094b(0x191)]??null,_0x2a561f?.['manifestSha256']??null);}async[_0x5b9f34(0x217)](_0x445d53,_0x46802d,_0x4c6173){const _0x1ff42a=_0x5b9f34;if(!await this[_0x1ff42a(0x21d)][_0x1ff42a(0x18f)](_0x445d53))throw f('NOT_FOUND','Index\x20\x22'+_0x445d53+_0x1ff42a(0x175)+_0x445d53+'\x22)\x20or\x20loadIndexes([...])\x20before\x20querying;\x20queries\x20run\x20locally\x20and\x20there\x20is\x20no\x20cloud\x20query\x20fallback.');let _0xa910c1=_0x4c6173?.[_0x1ff42a(0x1f5)]??0x5,_0x2c45d4=_0x4c6173?.['alpha']??0.8;return _0x4c6173?.[_0x1ff42a(0x1f9)]?this[_0x1ff42a(0x21d)]['query'](_0x445d53,_0x46802d,_0x4c6173[_0x1ff42a(0x1f9)],_0xa910c1,_0x2c45d4,_0x4c6173?.[_0x1ff42a(0x220)],w(_0x4c6173)):this['indexManager'][_0x1ff42a(0x1ce)](_0x445d53,_0x46802d,_0xa910c1,_0x2c45d4,_0x4c6173?.['filter'],w(_0x4c6173));}async[_0x5b9f34(0x177)](_0x430e02,_0x5c561a,_0xeb9b0b){const _0x11d353=_0x5b9f34;if(_0x430e02['length']===0x0)throw f('INVALID_ARGUMENT',_0x11d353(0x20f));let _0x1eb6a5=this[_0x11d353(0x20e)](),_0x38be74=_0xeb9b0b?.[_0x11d353(0x1f5)]??0xa,_0x2849e0=_0xeb9b0b?.[_0x11d353(0x20b)]??0.8;return _0xeb9b0b?.[_0x11d353(0x1f9)]?_0x1eb6a5[_0x11d353(0x177)](_0x430e02,_0x5c561a,_0xeb9b0b[_0x11d353(0x1f9)],_0x38be74,_0x2849e0,_0xeb9b0b?.['filter'],w(_0xeb9b0b)):_0x1eb6a5['queryMultiIndexText'](_0x430e02,_0x5c561a,_0x38be74,_0x2849e0,_0xeb9b0b?.[_0x11d353(0x220)],w(_0xeb9b0b));}};import{SessionIndex as _0x2854d6}from'@moss-js/moss-core';var h=class r{#e;#o;#r=!0x1;#a;constructor(_0x161d61,_0x190363){this.#o=_0x161d61,this.#e=_0x190363;}static async['_create'](_0xd3fe63,_0x18371e,_0x140e43,_0x5eeab6,_0x483eb8,_0x1ad0ae,_0x5e5c96){const _0x2e0241=_0x5b9f34;let _0x2a62a3=_0x2854d6;_0x5e5c96&&b(_0x2a62a3);let _0x50cc18=await _0x2a62a3[_0x2e0241(0x1ae)](_0xd3fe63,_0x18371e,_0x140e43,_0x5eeab6,_0x483eb8??null,_0x5e5c96?.['version']??null,_0x5e5c96?.[_0x2e0241(0x182)]??null);return r['_fromInner'](_0xd3fe63,_0x50cc18,_0x1ad0ae);}static['_fromInner'](_0x3c7261,_0x247d28,_0x292797){return _0x292797?.(_0x247d28),new r(_0x3c7261,_0x247d28);}get[_0x5b9f34(0x212)](){return this.#o;}get[_0x5b9f34(0x1ea)](){return this.#n(),this.#e['docCount'];}get[_0x5b9f34(0x1c2)](){const _0x20b2b1=_0x5b9f34;return this.#e[_0x20b2b1(0x1c2)];}async[_0x5b9f34(0x1eb)](_0x4cd366,_0x30de3){const _0x485c2b=_0x5b9f34;this.#n();let _0x297cec=_0x30de3?{'upsert':_0x30de3[_0x485c2b(0x195)]??!0x0}:void 0x0;if(this['modelId']===_0x485c2b(0x219)){let _0x446a8e=r.#s(_0x4cd366),_0x17ec5b=_0x4cd366['map'](_0x2bc5f2=>{const _0x5e3672=_0x485c2b;let _0x170c36={..._0x2bc5f2};return delete _0x170c36[_0x5e3672(0x1f9)],_0x170c36;}),_0x171931=await this.#e[_0x485c2b(0x205)](_0x17ec5b,_0x446a8e,_0x297cec);return{'added':_0x171931[_0x485c2b(0x199)],'updated':_0x171931[_0x485c2b(0x1a9)]};}let _0x133dc7=await this.#e[_0x485c2b(0x1fe)](_0x4cd366,_0x297cec);return{'added':_0x133dc7[_0x485c2b(0x199)],'updated':_0x133dc7[_0x485c2b(0x1a9)]};}async['deleteDocs'](_0x4aa8e6){const _0x46c1b4=_0x5b9f34;return this.#n(),await this.#e[_0x46c1b4(0x16b)](_0x4aa8e6);}async[_0x5b9f34(0x1cf)](_0x59da1b){const _0x37e994=_0x5b9f34;return this.#n(),await this.#e[_0x37e994(0x1aa)](_0x59da1b??null);}async[_0x5b9f34(0x217)](_0x4e5cd2,_0x4cea02){const _0x370660=_0x5b9f34;this.#n();let _0x46b751=_0x4cea02?.['topK']??0x5,_0x4944d2=_0x4cea02?.['alpha']??0.8,_0x133b3d=_0x4cea02?.['filter']??null,_0x223663=_0x4cea02?.[_0x370660(0x1f9)];if(_0x223663==null){if(this[_0x370660(0x1c2)]===_0x370660(0x219))throw f(_0x370660(0x1bc),_0x370660(0x229));return await this.#e[_0x370660(0x1ce)](_0x4e5cd2,_0x46b751,_0x4944d2,_0x133b3d);}return await this.#e['query'](_0x4e5cd2,_0x46b751,Array['from'](_0x223663),_0x4944d2,_0x133b3d);}async['loadIndex'](_0x1562d7,_0x38cd84){const _0x4d817e=_0x5b9f34;return this.#n(),this.#e[_0x4d817e(0x1bd)](_0x1562d7,_0x38cd84??null);}async[_0x5b9f34(0x20a)](){const _0x67a746=_0x5b9f34;return this.#n(),this.#e[_0x67a746(0x20a)]();}async[_0x5b9f34(0x1fc)](_0x2105d8){const _0x2c4ce1=_0x5b9f34;this.#n(),await this.#e[_0x2c4ce1(0x1fc)](_0x2105d8);}async[_0x5b9f34(0x1e1)](_0x39255f,_0x5f0506){const _0x3d8e95=_0x5b9f34;this.#n();let _0x171733=_0x5f0506?.['rebuildLegacy']??!0x0;return await this.#e[_0x3d8e95(0x1e1)](_0x39255f,{'rebuildLegacy':_0x171733});}async[_0x5b9f34(0x23a)](_0x275d50){const _0x3bd114=_0x5b9f34;return this.#n(),await this.#e[_0x3bd114(0x23a)](_0x275d50);}#n(){const _0x54bb22=_0x5b9f34;if(this.#r)throw new Error('SessionIndex\x20\x27'+this.#o+_0x54bb22(0x172));}[_0x5b9f34(0x1d4)](){return this.#a??=this.#i(),this.#a;}async #i(){const _0x5d4e76=_0x5b9f34;this.#r=!0x0;let _0x5d8fa3=this.#e[_0x5d4e76(0x1d4)];if(typeof _0x5d8fa3!=_0x5d4e76(0x188))throw new Error('@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20SessionIndex.close()');await _0x5d8fa3[_0x5d4e76(0x1db)](this.#e);}async[Symbol[_0x5b9f34(0x1c6)]](){const _0x11790d=_0x5b9f34;return this[_0x11790d(0x1d4)]();}async[_0x5b9f34(0x19d)](){const _0x76e886=_0x5b9f34;this.#n(),this[_0x76e886(0x1c2)]!=='custom'&&await this.#e['loadModel']();}static#s(_0x531da6){const _0x5a2b39=_0x5b9f34;let _0x37f0b5=_0x531da6[_0x5a2b39(0x220)](_0x20c5d2=>!_0x20c5d2['embedding']||_0x20c5d2[_0x5a2b39(0x1f9)]['length']===0x0)[_0x5a2b39(0x187)](_0x7676ff=>_0x7676ff['id']);if(_0x37f0b5[_0x5a2b39(0x1da)]>0x0)throw new Error(_0x5a2b39(0x232)+_0x37f0b5['join'](',\x20')+_0x5a2b39(0x1ec));return _0x531da6[_0x5a2b39(0x187)](_0x5e4d36=>Array[_0x5a2b39(0x21f)](_0x5e4d36['embedding']??[]));}};import{validateIndexName as _0x227faf}from'@moss-js/moss-core';var ue=_0x5b9f34(0x214),de=_0x5b9f34(0x185),M=class extends Error{['status'];[_0x5b9f34(0x17a)];constructor(_0x1b20f8,_0x3fefed){const _0x36f8bf=_0x5b9f34;let _0x36f049=_0x3fefed?':\x20'+_0x3fefed:'';super(_0x36f8bf(0x1a7)+_0x1b20f8+_0x36f049),this[_0x36f8bf(0x212)]='ManageApiError',this[_0x36f8bf(0x1f8)]=_0x1b20f8,this[_0x36f8bf(0x17a)]=_0x3fefed;}};function ce(){const _0x1e2139=_0x5b9f34;return''+(typeof process<'u'&&process[_0x1e2139(0x19e)][_0x1e2139(0x202)]||ue)[_0x1e2139(0x1d7)](/\/+$/,'')+de;}function le(_0x211852){const _0x5b067f=_0x5b9f34;return _0x211852?Object[_0x5b067f(0x216)](Object[_0x5b067f(0x1e5)](_0x211852)[_0x5b067f(0x220)](([,_0x2c94f0])=>_0x2c94f0!==void 0x0)):{};}async function $(_0x3314c1,_0x5dcefc,_0x5cbbfd,_0x35710f){const _0x26758e=_0x5b9f34;let _0x238e78={...le(_0x35710f),'action':_0x5cbbfd,'projectId':_0x3314c1},_0x1c4e45=await fetch(ce(),{'method':_0x26758e(0x21a),'headers':{'Content-Type':_0x26758e(0x223),'X-Project-Key':_0x5dcefc},'body':JSON[_0x26758e(0x1c9)](_0x238e78),'signal':AbortSignal[_0x26758e(0x1ac)](0x927c0)}),_0x5ef59a=await _0x1c4e45[_0x26758e(0x1c8)]();if(!_0x1c4e45['ok'])throw new M(_0x1c4e45[_0x26758e(0x1f8)],_0x5ef59a);return _0x5ef59a?JSON[_0x26758e(0x1fd)](_0x5ef59a):{};}var J=_0x5b9f34(0x1f2),C=class{#e;#o;#r;#a=!0x1;#n;#i=new Set();constructor(_0x4f342a,_0x1e2c6a,_0x53b230){const _0x3e8844=_0x5b9f34;this.#e=new P(_0x4f342a,_0x1e2c6a,_0x53b230),this.#o=_0x4f342a,this.#r=typeof _0x1e2c6a==_0x3e8844(0x20d)?_0x1e2c6a:null;}async[_0x5b9f34(0x21e)](){const _0x1d9bc5=_0x5b9f34;return this.#t(),this.#e[_0x1d9bc5(0x21e)]();}async[_0x5b9f34(0x1f4)](_0x5ecf12,_0x175a41,_0x4cde1d){const _0x3643a6=_0x5b9f34;this.#t();let _0x57168f;return _0x4cde1d?.['modelId']!==void 0x0?_0x57168f=_0x4cde1d['modelId']:_0x57168f=_0x175a41[_0x3643a6(0x228)](_0x1192f1=>Array[_0x3643a6(0x1c0)](_0x1192f1[_0x3643a6(0x1f9)])&&_0x1192f1[_0x3643a6(0x1f9)][_0x3643a6(0x1da)]>0x0)?'custom':J,this.#e[_0x3643a6(0x1f4)](_0x5ecf12,_0x175a41,_0x57168f,_0x4cde1d);}async[_0x5b9f34(0x222)](_0x269fa3,_0x2462d9,_0x199c2a){const _0x1b1abf=_0x5b9f34;return this.#t(),this.#e[_0x1b1abf(0x222)](_0x269fa3,_0x2462d9,_0x199c2a);}async[_0x5b9f34(0x1bb)](_0x5367b0){const _0x5393e3=_0x5b9f34;return this.#t(),this.#e[_0x5393e3(0x1bb)](_0x5367b0);}async[_0x5b9f34(0x1ef)](){const _0x4830dc=_0x5b9f34;return this.#t(),this.#e[_0x4830dc(0x1ef)]();}async[_0x5b9f34(0x16e)](_0x418c5b){const _0x3f6700=_0x5b9f34;return this.#t(),this.#e[_0x3f6700(0x16e)](_0x418c5b);}async[_0x5b9f34(0x1eb)](_0x32c019,_0x23a2b1,_0x490c58){const _0x4317a0=_0x5b9f34;return this.#t(),this.#e[_0x4317a0(0x1eb)](_0x32c019,_0x23a2b1,_0x490c58);}async['deleteDocs'](_0x53cc7b,_0x2d6255,_0x3cceb7){const _0x5ed743=_0x5b9f34;return this.#t(),this.#e[_0x5ed743(0x1d9)](_0x53cc7b,_0x2d6255,_0x3cceb7);}async[_0x5b9f34(0x21c)](_0x2994fa){return this.#t(),this.#e['getJobStatus'](_0x2994fa);}async[_0x5b9f34(0x231)](_0x2e692e,_0x363db7,_0x56ddf7){const _0x1b6a29=_0x5b9f34;return this.#t(),_0x227faf(_0x363db7),this.#s('createWebSource',{'rootUrl':_0x2e692e,'indexName':_0x363db7,'maxPages':_0x56ddf7?.[_0x1b6a29(0x189)],'maxDocuments':_0x56ddf7?.[_0x1b6a29(0x1e0)],'maxDepth':_0x56ddf7?.[_0x1b6a29(0x206)],'includePaths':_0x56ddf7?.[_0x1b6a29(0x1fb)],'excludePaths':_0x56ddf7?.[_0x1b6a29(0x1e6)],'respectRobots':_0x56ddf7?.['respectRobots'],'parseDocuments':_0x56ddf7?.['parseDocuments'],'refreshCadence':_0x56ddf7?.[_0x1b6a29(0x183)],'modelId':_0x56ddf7?.[_0x1b6a29(0x1c2)]});}async[_0x5b9f34(0x180)](_0x573081){const _0x2bef5a=_0x5b9f34;this.#t();let _0x2c6f05=(await this.#s('listWebSources',_0x573081!==void 0x0?{'indexName':_0x573081}:void 0x0))[_0x2bef5a(0x210)]??[];return _0x573081===void 0x0?_0x2c6f05:_0x2c6f05['filter'](_0x12fb68=>_0x12fb68['indexName']===_0x573081);}async['getWebSource'](_0x5c1725){return this.#t(),this.#s('getWebSource',{'sourceId':_0x5c1725});}async['updateWebSource'](_0x1dede4,_0x415cfe){const _0x37257a=_0x5b9f34;return this.#t(),this.#s(_0x37257a(0x238),{'sourceId':_0x1dede4,'refreshCadence':_0x415cfe[_0x37257a(0x183)],'rootUrl':_0x415cfe[_0x37257a(0x1c4)],'includePaths':_0x415cfe[_0x37257a(0x1fb)],'excludePaths':_0x415cfe[_0x37257a(0x1e6)],'maxDepth':_0x415cfe[_0x37257a(0x206)],'maxPages':_0x415cfe['maxPages'],'resync':_0x415cfe[_0x37257a(0x1f6)]});}async[_0x5b9f34(0x221)](_0x5186c2){const _0x51dab4=_0x5b9f34;return this.#t(),this.#s(_0x51dab4(0x221),{'sourceId':_0x5186c2});}async[_0x5b9f34(0x170)](_0x5e1476){const _0x595a85=_0x5b9f34;return this.#t(),this.#s(_0x595a85(0x170),{'sourceId':_0x5e1476});}async #s(_0x25c43b,_0x510403){const _0x10370d=_0x5b9f34;if(this.#r===null)throw new Error(_0x10370d(0x218));return $(this.#o,this.#r,_0x25c43b,_0x510403);}async[_0x5b9f34(0x1cf)](_0x19cac5,_0x5abd0d){const _0x1b839e=_0x5b9f34;return this.#t(),this.#e[_0x1b839e(0x1cf)](_0x19cac5,_0x5abd0d);}async[_0x5b9f34(0x1bd)](_0x58db63,_0x5ef272){const _0x3aaa1f=_0x5b9f34;return this.#t(),this.#e[_0x3aaa1f(0x1bd)](_0x58db63,_0x5ef272);}async[_0x5b9f34(0x173)](_0x541f13,_0x46fc49){const _0x1a085a=_0x5b9f34;return this.#t(),this.#e[_0x1a085a(0x173)](_0x541f13,_0x46fc49);}async[_0x5b9f34(0x213)](_0x5e4374){const _0x127210=_0x5b9f34;return this.#t(),this.#e[_0x127210(0x213)](_0x5e4374);}async[_0x5b9f34(0x1a1)](_0x6e198b){const _0x559fef=_0x5b9f34;return this.#t(),this.#e[_0x559fef(0x1a1)](_0x6e198b);}async[_0x5b9f34(0x217)](_0x33fd29,_0xe49993,_0x19b496){const _0x951705=_0x5b9f34;return this.#t(),this.#e[_0x951705(0x217)](_0x33fd29,_0xe49993,_0x19b496);}async[_0x5b9f34(0x177)](_0x4aea79,_0x37f05d,_0xe32ecd){const _0x4b04e0=_0x5b9f34;return this.#t(),this.#e[_0x4b04e0(0x177)](_0x4aea79,_0x37f05d,_0xe32ecd);}async[_0x5b9f34(0x18d)](_0x3f7740,_0x5eecee=J,_0x420cc1){const _0x5c1d83=_0x5b9f34;this.#t();let _0x44be93=this.#e[_0x5c1d83(0x186)],_0x106d80;if(this.#r!==null)_0x106d80=await h[_0x5c1d83(0x1e4)](_0x3f7740,_0x5eecee,this.#o,this.#r,void 0x0,_0x44be93,_0x420cc1);else{let _0x235847=await this.#e['createAuthenticatedSessionInner'](_0x3f7740,_0x5eecee,_0x420cc1);_0x106d80=h[_0x5c1d83(0x1d6)](_0x3f7740,_0x235847,_0x44be93);}await _0x106d80[_0x5c1d83(0x19d)]();for(let _0x217135 of this.#i)_0x217135[_0x5c1d83(0x19f)]()||this.#i[_0x5c1d83(0x21b)](_0x217135);return this.#i['add'](new WeakRef(_0x106d80)),_0x106d80;}#t(){if(this.#a)throw new Error('MossClient\x20is\x20closed');}[_0x5b9f34(0x1d4)](){return this.#n??=this.#u(),this.#n;}async #u(){const _0x27f682=_0x5b9f34;this.#a=!0x0;let _0x1389b0=[...this.#i][_0x27f682(0x187)](_0x447fba=>_0x447fba[_0x27f682(0x19f)]())[_0x27f682(0x220)](_0x415640=>_0x415640!==void 0x0);this.#i['clear'](),await Promise[_0x27f682(0x1ab)](_0x1389b0[_0x27f682(0x187)](_0x5e7d0f=>_0x5e7d0f[_0x27f682(0x1d4)]())),await this.#e[_0x27f682(0x1d4)]();}async[Symbol['asyncDispose']](){const _0x4abae2=_0x5b9f34;return this[_0x4abae2(0x1d4)]();}};export{M as ManageApiError,C as MossClient,h as SessionIndex,oe as isMossError};
package/dist/moss.d.ts CHANGED
@@ -679,11 +679,13 @@ export declare interface MossIdentity {
679
679
  * - **`"moss-mediumlm"`**: Balanced model offering higher accuracy with reasonable performance.
680
680
  * Best for applications where search quality is important and moderate latency is acceptable.
681
681
  *
682
+ * - **`"moss-litelm"`**: Smallest built-in model, available to entitled organizations.
683
+ *
682
684
  * - **`"custom"`**: Use this when providing pre-computed embeddings from external sources.
683
685
  * No embedding model is loaded. All documents must include embeddings, and all queries
684
686
  * must provide embeddings via QueryOptions.embedding.
685
687
  */
686
- export declare type MossModel = "moss-minilm" | "moss-mediumlm" | "custom";
688
+ export declare type MossModel = "moss-minilm" | "moss-mediumlm" | "moss-litelm" | "custom";
687
689
 
688
690
  /**
689
691
  * Options for async mutation operations (addDocs, deleteDocs).
@@ -801,7 +803,7 @@ export declare class SessionIndex {
801
803
  * @internal Construct via `MossClient.session()` — direct instantiation
802
804
  * is intentionally unsupported so the auth context flows from the client.
803
805
  */
804
- constructor(name: string, modelId: MossModel, inner: SessionIndex_2);
806
+ constructor(name: string, inner: SessionIndex_2);
805
807
  /**
806
808
  * @internal Factory used by `MossClient.session()`. Constructs the
807
809
  * underlying Rust `SessionIndex` and wraps it. Async because the
@@ -815,7 +817,7 @@ export declare class SessionIndex {
815
817
  * custom-authenticator path, where `InternalMossClient` builds the core
816
818
  * handle via the auth bridge (`SessionIndex.withAuthenticator`).
817
819
  */
818
- static _fromInner(name: string, modelId: MossModel, inner: SessionIndex_2, applyIdentity?: (target: IdentityTarget) => void): SessionIndex;
820
+ static _fromInner(name: string, inner: SessionIndex_2, applyIdentity?: (target: IdentityTarget) => void): SessionIndex;
819
821
  /** The session index name. Identifies the cloud index on `pushIndex` / `loadIndex`. */
820
822
  get name(): string;
821
823
  /**
@@ -825,7 +827,11 @@ export declare class SessionIndex {
825
827
  * up on a later read.
826
828
  */
827
829
  get docCount(): number;
828
- /** The embedding model this session is configured for. */
830
+ /**
831
+ * The model this session embeds with, as of its last completed call.
832
+ * `addDocs` and `query` read it on every call to pick their path, and
833
+ * `loadIndex`, `loadFromDisk` or a version that auto-refresh installs can change it.
834
+ */
829
835
  get modelId(): MossModel;
830
836
  /**
831
837
  * Add or update documents in the local session index.
@@ -866,13 +872,19 @@ export declare class SessionIndex {
866
872
  * pulls newer versions in on subsequent reads; the poller pauses
867
873
  * while local un-pushed edits exist.
868
874
  *
875
+ * The index replaces this session's documents and model, so after a
876
+ * custom-model index loads, `addDocs` and `query` need embeddings.
877
+ * Auto-refresh can install a custom-model version the same way.
878
+ *
869
879
  * @returns Number of documents loaded into the session.
870
880
  */
871
881
  loadIndex(indexName: string, options?: LoadSessionOptions): Promise<number>;
872
882
  /**
873
883
  * Upload the session to the cloud, creating or replacing the index
874
- * with the same name. Documents are pushed with their locally-computed
875
- * embeddings — no server-side re-embedding.
884
+ * with the same name. A custom-model session keeps its locally-computed
885
+ * embeddings; for a built-in model the server re-embeds the text with
886
+ * that model, so the index loads and answers text queries like one
887
+ * built with `createIndex`.
876
888
  */
877
889
  pushIndex(): Promise<PushIndexResult>;
878
890
  /**
@@ -883,6 +895,9 @@ export declare class SessionIndex {
883
895
  /**
884
896
  * Restore a session previously written by `saveToDisk`.
885
897
  *
898
+ * The snapshot replaces this session's documents and model, so after a
899
+ * custom-model snapshot loads, `addDocs` and `query` need embeddings.
900
+ *
886
901
  * A snapshot saved by an SDK older than 1.8 for a built-in model carries
887
902
  * no model artifact provenance, so the core can only restore it as a
888
903
  * custom-model session. This method asks the core to rebuild such a
@@ -912,8 +927,8 @@ export declare class SessionIndex {
912
927
  * Release the session's native resources deterministically: the
913
928
  * auto-refresh poller, the in-memory index, and this session's
914
929
  * reference to the shared embedding model. Safe to call more than
915
- * once. Afterwards `name` and `modelId` stay readable (JS-side
916
- * metadata); `docCount` and all methods throw "is closed".
930
+ * once. Afterwards `name` and `modelId` stay readable (`modelId` as
931
+ * of the last call); `docCount` and all methods throw "is closed".
917
932
  *
918
933
  * Also invoked by `await using` (Symbol.asyncDispose).
919
934
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moss-js/moss",
3
- "version": "1.16.0",
3
+ "version": "1.17.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.31.0"
48
+ "@moss-js/moss-core": "0.32.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@eslint/js": "^9.39.4",