@moss-js/moss 1.11.0 → 1.14.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 +45 -8
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x383a96=_0x7cc7;(function(_0x2868ab,_0x463f85){const _0x13163a=_0x7cc7,_0x3dadad=_0x2868ab();while(!![]){try{const _0x1b55a6=parseInt(_0x13163a(0x1ea))/0x1+-parseInt(_0x13163a(0x219))/0x2*(-parseInt(_0x13163a(0x21a))/0x3)+-parseInt(_0x13163a(0x1bd))/0x4+-parseInt(_0x13163a(0x22a))/0x5*(parseInt(_0x13163a(0x261))/0x6)+-parseInt(_0x13163a(0x1a9))/0x7*(-parseInt(_0x13163a(0x244))/0x8)+parseInt(_0x13163a(0x1be))/0x9+parseInt(_0x13163a(0x201))/0xa*(-parseInt(_0x13163a(0x212))/0xb);if(_0x1b55a6===_0x463f85)break;else _0x3dadad['push'](_0x3dadad['shift']());}catch(_0x4526db){_0x3dadad['push'](_0x3dadad['shift']());}}}(_0x7380,0x7dfb5));import{JobStatus as _0x4813ef}from'@moss-js/moss-core';function _0x7cc7(_0x803d5e,_0x3653e7){_0x803d5e=_0x803d5e-0x1a8;const _0x7380f5=_0x7380();let _0x7cc760=_0x7380f5[_0x803d5e];return _0x7cc760;}import*as _0x31db36 from'@moss-js/moss-core';import*as _0x3ddaff from'@moss-js/moss-core';var g=_0x3ddaff,oe=g[_0x383a96(0x232)],ie=g[_0x383a96(0x1d7)],ae=g[_0x383a96(0x20c)],O=g[_0x383a96(0x242)],ue=typeof process<'u'&&process[_0x383a96(0x235)][_0x383a96(0x213)]||g[_0x383a96(0x20e)],T=typeof process<'u'?process[_0x383a96(0x235)]:{},f=class{constructor(_0x135efe,_0x1e8e57){const _0x2e2cca=_0x383a96;this[_0x2e2cca(0x1da)]=_0x135efe,this[_0x2e2cca(0x269)]=_0x1e8e57,this[_0x2e2cca(0x1cd)]=T[_0x2e2cca(0x27b)]??O;}[_0x383a96(0x1da)];[_0x383a96(0x269)];[_0x383a96(0x1cd)];async['getAuthToken'](){const _0x2d8b5=_0x383a96;let _0x91195f=await fetch(this[_0x2d8b5(0x1cd)],{'method':_0x2d8b5(0x1b2),'headers':{'Content-Type':_0x2d8b5(0x27e)},'body':JSON[_0x2d8b5(0x1dd)]({'projectId':this['projectId'],'projectKey':this[_0x2d8b5(0x269)]}),'signal':AbortSignal['timeout'](0x7530)});if(_0x91195f[_0x2d8b5(0x1c4)]===0x191){let _0x3ff1f1=await _0x91195f[_0x2d8b5(0x23b)]();throw new Error(_0x2d8b5(0x227)+_0x3ff1f1);}if(!_0x91195f['ok']){let _0x180502=await _0x91195f['text']();throw new Error(_0x2d8b5(0x268)+_0x91195f[_0x2d8b5(0x1c4)]+':\x20'+_0x180502);}let _0x396a6c=await _0x91195f[_0x2d8b5(0x249)]();return{'token':_0x396a6c[_0x2d8b5(0x27a)],'expiresIn':_0x396a6c[_0x2d8b5(0x21b)]};}async[_0x383a96(0x26b)](){const _0x563958=_0x383a96;let {token:_0x37623e}=await this[_0x563958(0x265)]();return _0x563958(0x241)+_0x37623e;}},I=class{constructor(_0x2ec7c7){this['inner']=_0x2ec7c7;}['inner'];[_0x383a96(0x20f)]=null;[_0x383a96(0x1e1)]=null;async[_0x383a96(0x265)](){const _0x4abb25=_0x383a96;if(this[_0x4abb25(0x20f)]&&this[_0x4abb25(0x20f)][_0x4abb25(0x27d)]>Date['now']())return{'token':this[_0x4abb25(0x20f)][_0x4abb25(0x27a)],'expiresIn':this['cache'][_0x4abb25(0x21b)]};if(this[_0x4abb25(0x1e1)])return this[_0x4abb25(0x1e1)];this[_0x4abb25(0x1e1)]=this[_0x4abb25(0x1ba)]();try{return await this[_0x4abb25(0x1e1)];}finally{this['inflight']=null;}}async[_0x383a96(0x26b)](){const _0x2df21a=_0x383a96;let {token:_0x1bf587}=await this[_0x2df21a(0x265)]();return _0x2df21a(0x241)+_0x1bf587;}async[_0x383a96(0x1ba)](){const _0x3b2966=_0x383a96;let {token:_0x3df15f,expiresIn:_0x342979}=await this['inner'][_0x3b2966(0x265)](),_0x53004e=Date[_0x3b2966(0x1ff)]()+(_0x342979-0x3c)*0x3e8;return this[_0x3b2966(0x20f)]={'token':_0x3df15f,'expiresIn':_0x342979,'expiresAt':_0x53004e},{'token':_0x3df15f,'expiresIn':_0x342979};}};import{randomUUID as _0x4ee26c}from'node:crypto';import{existsSync as _0x218176,mkdirSync as _0x3e5e92,readFileSync as _0x2c52d0,writeFileSync as _0x4fb13a}from'node:fs';import{join as _0x2d4aab}from'node:path';var X='.moss-device-id',P=0x100,_=/[\p{Cc}\p{Cf}\p{Cs}\uFFFD]/u;function z(_0x58fd11){const _0x237066=_0x383a96;return _0x58fd11['length']>0x0&&_0x58fd11['trim']()===_0x58fd11&&!_['test'](_0x58fd11)&&new TextEncoder()[_0x237066(0x240)](_0x58fd11)[_0x237066(0x1ca)]<=P;}function E(_0x4ce1ff,_0x5a5c20){const _0x436ca1=_0x383a96;if(_0x4ce1ff!==void 0x0){if(typeof _0x4ce1ff!=_0x436ca1(0x218)||_0x4ce1ff[_0x436ca1(0x21f)]===0x0)throw new TypeError(_0x436ca1(0x22b)+_0x5a5c20+_0x436ca1(0x1ed));if(_0x4ce1ff[_0x436ca1(0x1b1)]()!==_0x4ce1ff)throw new TypeError(_0x436ca1(0x22b)+_0x5a5c20+'\x20must\x20not\x20have\x20leading\x20or\x20trailing\x20whitespace');if(_[_0x436ca1(0x1bf)](_0x4ce1ff))throw new TypeError('MossClient\x20options.identity.'+_0x5a5c20+_0x436ca1(0x1f3));if(new TextEncoder()[_0x436ca1(0x240)](_0x4ce1ff)[_0x436ca1(0x1ca)]>P)throw new TypeError(_0x436ca1(0x22b)+_0x5a5c20+'\x20must\x20be\x20at\x20most\x20'+P+'\x20UTF-8\x20bytes');return _0x4ce1ff;}}function k(_0x579dad){const _0x85139c=_0x383a96;if(_0x579dad!==void 0x0){if(_0x579dad===null||typeof _0x579dad!=_0x85139c(0x1c8)||Array['isArray'](_0x579dad))throw new TypeError('MossClient\x20options.identity\x20must\x20be\x20an\x20object');return Object[_0x85139c(0x1cf)]({'deviceId':E(_0x579dad[_0x85139c(0x1c9)],'deviceId'),'userId':E(_0x579dad[_0x85139c(0x24b)],_0x85139c(0x24b))});}}function U(_0x40e6b8){const _0x4357e4=_0x383a96;return _0x40e6b8?.[_0x4357e4(0x1c9)]!==void 0x0||_0x40e6b8?.[_0x4357e4(0x24b)]!==void 0x0;}function M(_0x2cc903){const _0x2caddf=_0x383a96;if(!_0x2cc903?.['trim']())return;let _0x203831=_0x2d4aab(_0x2cc903,X);try{if(_0x218176(_0x203831)){let _0xfb0f1b=_0x2c52d0(_0x203831,'utf8')[_0x2caddf(0x1b1)]();return z(_0xfb0f1b)?_0xfb0f1b:void 0x0;}_0x3e5e92(_0x2cc903,{'recursive':!0x0});let _0x1cac80=_0x4ee26c();return _0x4fb13a(_0x203831,_0x1cac80,_0x2caddf(0x24f)),_0x1cac80;}catch{return;}}var Y=0x1;function y(_0xd975fd){const _0x5ded73=_0x383a96;let _0x45b689=_0xd975fd[_0x5ded73(0x207)];if(typeof _0x45b689!=_0x5ded73(0x1d2))throw q();let _0x4d8aa7=_0x45b689[_0x5ded73(0x274)](_0xd975fd);if(!Number['isSafeInteger'](_0x4d8aa7)||_0x4d8aa7<Y)throw q();}function q(){return new Error('The\x20installed\x20@moss-js/moss-core\x20runtime\x20does\x20not\x20support\x20exact\x20model\x20artifact\x20identities.\x20Upgrade\x20moss-core\x20before\x20creating\x20this\x20session.');}var Ie=0x708*0x3e8;function S(_0x4af0c8){const _0x31534d=_0x383a96;return _0x4af0c8 instanceof Error?_0x4af0c8[_0x31534d(0x259)]:String(_0x4af0c8);}function Z(_0x52b1ff){const _0x425524=_0x383a96;if(_0x52b1ff===null||typeof _0x52b1ff!=_0x425524(0x1c8))return'received\x20'+String(_0x52b1ff);if(Array[_0x425524(0x1aa)](_0x52b1ff))return _0x425524(0x24e);let _0x439cc8=_0x52b1ff;return typeof _0x439cc8[_0x425524(0x231)]!='string'||_0x439cc8[_0x425524(0x231)][_0x425524(0x21f)]===0x0?'received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20jobId\x20('+String(_0x439cc8[_0x425524(0x231)])+')':typeof _0x439cc8[_0x425524(0x1c4)]!=_0x425524(0x218)||_0x439cc8[_0x425524(0x1c4)][_0x425524(0x21f)]===0x0?_0x425524(0x20b)+String(_0x439cc8['status'])+')':typeof _0x439cc8[_0x425524(0x23a)]!='number'||!Number[_0x425524(0x26e)](_0x439cc8[_0x425524(0x23a)])?_0x425524(0x1b0)+String(_0x439cc8[_0x425524(0x23a)])+')':_0x439cc8[_0x425524(0x250)]!==void 0x0&&_0x439cc8['currentPhase']!==null&&typeof _0x439cc8['currentPhase']!=_0x425524(0x218)?_0x425524(0x21d)+String(_0x439cc8[_0x425524(0x250)])+')':null;}var x=class{[_0x383a96(0x1c7)];[_0x383a96(0x225)];[_0x383a96(0x21e)];[_0x383a96(0x263)];[_0x383a96(0x1b9)];[_0x383a96(0x1da)];[_0x383a96(0x1df)];constructor(_0x68fa9b,_0x1e525b,_0x5f103b){const _0x56c035=_0x383a96;this[_0x56c035(0x1b9)]=k(_0x5f103b?.[_0x56c035(0x1ef)]),this['cachePathDeviceId']=M(_0x5f103b?.['cachePath']),this[_0x56c035(0x1da)]=_0x68fa9b;let _0x2d61c7=typeof _0x1e525b==_0x56c035(0x218)?new f(_0x68fa9b,_0x1e525b):_0x1e525b;this['authenticator']=new I(_0x2d61c7);let _0x3a9845=_0x31db36,_0x4b12b0=_0x3a9845[_0x56c035(0x1a8)]??_0x3a9845['default']?.[_0x56c035(0x1a8)],_0x27e44e=_0x3a9845[_0x56c035(0x1ae)]??_0x3a9845['default']?.[_0x56c035(0x1ae)];if(!_0x4b12b0||!_0x27e44e)throw new Error(_0x56c035(0x238));if(typeof _0x1e525b==_0x56c035(0x218))this[_0x56c035(0x225)]=new _0x4b12b0(_0x68fa9b,_0x1e525b),this[_0x56c035(0x21e)]=new _0x27e44e(_0x68fa9b,_0x1e525b);else{let _0x2baa16=_0x3a9845[_0x56c035(0x202)]??_0x3a9845[_0x56c035(0x246)]?.[_0x56c035(0x202)],_0x5f5d4e=_0x3a9845[_0x56c035(0x1ec)]??_0x3a9845[_0x56c035(0x246)]?.[_0x56c035(0x1ec)];if(!_0x2baa16||!_0x5f5d4e)throw new Error(_0x56c035(0x215));let _0x382a04=this['authenticator'],_0x1d4d59=(_0x2c28d2,_0x5e8999)=>{const _0x10f29e=_0x56c035;try{_0x5f5d4e(_0x2c28d2,_0x5e8999);}catch(_0x21db68){console[_0x10f29e(0x1d4)](_0x10f29e(0x233)+_0x2c28d2+_0x10f29e(0x22f)+S(_0x21db68));}},_0x2cfede=(_0x422f69,_0x54ce1d)=>{const _0x3727b6=_0x56c035;try{_0x2baa16(_0x422f69,_0x54ce1d);}catch(_0x328862){_0x1d4d59(_0x422f69,_0x3727b6(0x203)+S(_0x328862));}},_0x28a5a4=!0x1,_0xb8075c=(_0x145c4e,_0x416cfc)=>{const _0x347d60=_0x56c035;if(_0x145c4e||!Number['isSafeInteger'](_0x416cfc)||_0x416cfc<0x0){_0x28a5a4||(_0x28a5a4=!0x0,console[_0x347d60(0x1d4)]('[moss]\x20Ignoring\x20an\x20auth\x20request\x20with\x20no\x20usable\x20request\x20id;\x20custom\x20authentication\x20may\x20be\x20unavailable\x20for\x20this\x20client.\x20Cause:\x20'+(_0x145c4e?_0x145c4e[_0x347d60(0x259)]:'received\x20'+String(_0x416cfc))));return;}_0x382a04['getAuthHeader']()[_0x347d60(0x1b4)](_0x297a9e=>{const _0x34941a=_0x347d60;let _0x1d0ab2=_0x297a9e[_0x34941a(0x23f)](_0x34941a(0x241))?_0x297a9e[_0x34941a(0x25a)](0x7):_0x297a9e;_0x2cfede(_0x416cfc,_0x1d0ab2);},_0x12798c=>_0x1d4d59(_0x416cfc,S(_0x12798c)));};this['authNotifyFn']=_0xb8075c;let _0x32bfcf=_0x4b12b0,_0x125b02=_0x27e44e;if(!_0x32bfcf[_0x56c035(0x271)]||!_0x125b02[_0x56c035(0x271)])throw new Error(_0x56c035(0x1ab));this[_0x56c035(0x225)]=_0x32bfcf[_0x56c035(0x271)](_0x68fa9b,_0xb8075c),this['indexManager']=_0x125b02[_0x56c035(0x271)](_0x68fa9b,_0xb8075c);}this['applyIdentity'](this[_0x56c035(0x21e)]);}async[_0x383a96(0x24c)](){const _0x1b2d4a=_0x383a96;let _0x1ac1ea=this['indexManager'][_0x1b2d4a(0x24c)];if(typeof _0x1ac1ea!='function')throw new Error(_0x1b2d4a(0x1db));await _0x1ac1ea[_0x1b2d4a(0x274)](this[_0x1b2d4a(0x21e)]);}async[_0x383a96(0x265)](){const _0x3dc99b=_0x383a96;return this['authenticator'][_0x3dc99b(0x265)]();}[_0x383a96(0x266)](_0x2b7e59){if(!_0x2b7e59)return;let _0x5654f2=!0x1;return(_0x24201d,_0x196829)=>{const _0x145469=_0x7cc7;let _0x2e8f0a=_0x24201d?_0x24201d[_0x145469(0x259)]:Z(_0x196829);if(_0x2e8f0a!==null){_0x5654f2||(_0x5654f2=!0x0,console[_0x145469(0x1d4)](_0x145469(0x267)+_0x2e8f0a));return;}_0x2b7e59(_0x196829);};}[_0x383a96(0x1f9)](_0x6b6025){const _0x400f09=_0x383a96;let _0x4e8fb7=_0x6b6025[_0x400f09(0x1b1)]()[_0x400f09(0x1f2)]()[_0x400f09(0x1d1)](/\s+/g,'_'),_0x2c3529=_0x4e8fb7[_0x400f09(0x1d1)](/_/g,'');if(_0x4e8fb7===_0x400f09(0x1f4)||_0x2c3529===_0x400f09(0x256))return _0x4813ef[_0x400f09(0x22c)];if(_0x4e8fb7===_0x400f09(0x1b8))return _0x4813ef[_0x400f09(0x276)];if(_0x4e8fb7===_0x400f09(0x223))return _0x4813ef[_0x400f09(0x1d6)];if(_0x4e8fb7==='completed')return _0x4813ef['Completed'];if(_0x4e8fb7==='failed')return _0x4813ef['Failed'];throw new Error(_0x400f09(0x1dc)+_0x6b6025+_0x400f09(0x253));}async[_0x383a96(0x25d)](_0x4ba87e,_0x5ac3ec,_0x1cc202,_0x524db8){const _0x4c1816=_0x383a96;if(!_0x5ac3ec[_0x4c1816(0x21f)])throw new Error(_0x4c1816(0x1e0));return await this['manageClient'][_0x4c1816(0x25d)](_0x4ba87e,_0x5ac3ec,_0x1cc202,this[_0x4c1816(0x266)](_0x524db8?.[_0x4c1816(0x1f5)]));}async[_0x383a96(0x1c1)](_0x4a4b4c){const _0x49e3f2=_0x383a96;if(_0x4a4b4c instanceof Uint8Array)return Array[_0x49e3f2(0x229)](_0x4a4b4c);if(_0x4a4b4c instanceof ArrayBuffer)return Array[_0x49e3f2(0x229)](new Uint8Array(_0x4a4b4c));if(typeof _0x4a4b4c[_0x49e3f2(0x1e2)]==_0x49e3f2(0x1d2)){let _0x37f925=await _0x4a4b4c[_0x49e3f2(0x1e2)]();return Array[_0x49e3f2(0x229)](new Uint8Array(_0x37f925));}throw new Error('Unsupported\x20data\x20type\x20for\x20file\x20upload');}async[_0x383a96(0x1f1)](_0x456103,_0x95ba10,_0x3aa294){const _0x1fc903=_0x383a96;if(_0x95ba10['length']===0x0)throw new Error(_0x1fc903(0x257));let _0x21212f=_0x3aa294?.['modelId']??_0x1fc903(0x1f0),_0x30ad2d=await Promise[_0x1fc903(0x270)](_0x95ba10[_0x1fc903(0x252)](async _0x189b16=>({'name':_0x189b16['name'],'contentType':_0x189b16[_0x1fc903(0x26f)],'path':_0x189b16[_0x1fc903(0x1de)]??void 0x0,'data':_0x189b16['data']!=null?await this[_0x1fc903(0x1c1)](_0x189b16['data']):void 0x0})));return await this[_0x1fc903(0x225)][_0x1fc903(0x1f1)](_0x456103,_0x30ad2d,_0x21212f,this[_0x1fc903(0x266)](_0x3aa294?.['onProgress']),_0x3aa294?.[_0x1fc903(0x1e6)]??null);}async[_0x383a96(0x24a)](_0x213b9c,_0x1ce9a9,_0x177ce7){const _0x50bc8b=_0x383a96;if(Array[_0x50bc8b(0x1aa)](_0x1ce9a9)&&_0x1ce9a9[_0x50bc8b(0x21f)]===0x0)throw new Error(_0x50bc8b(0x1cb));return await this['manageClient']['addDocs'](_0x213b9c,_0x1ce9a9,_0x177ce7??null,this['wrapProgress'](_0x177ce7?.[_0x50bc8b(0x1f5)]));}async[_0x383a96(0x277)](_0x3aa4ac,_0x3532b2,_0x275e1a){const _0x207949=_0x383a96;if(Array[_0x207949(0x1aa)](_0x3532b2)&&_0x3532b2[_0x207949(0x21f)]===0x0)throw new Error(_0x207949(0x1d5));return await this['manageClient']['deleteDocs'](_0x3aa4ac,_0x3532b2,this[_0x207949(0x266)](_0x275e1a?.[_0x207949(0x1f5)]));}async[_0x383a96(0x1e3)](_0x27f53d){const _0x38db62=_0x383a96;let _0x259365=await this[_0x38db62(0x225)][_0x38db62(0x1e3)](_0x27f53d);return{..._0x259365,'status':this[_0x38db62(0x1f9)](_0x259365[_0x38db62(0x1c4)]),'currentPhase':_0x259365['currentPhase']??null,'error':_0x259365[_0x38db62(0x200)]??null};}async['getIndex'](_0x5195fe){return this['manageClient']['getIndex'](_0x5195fe);}async[_0x383a96(0x205)](){const _0x4f3173=_0x383a96;return this['manageClient'][_0x4f3173(0x205)]();}async['deleteIndex'](_0x250c94){const _0x98b426=_0x383a96;return this[_0x98b426(0x225)][_0x98b426(0x239)](_0x250c94);}async[_0x383a96(0x25f)](_0x5e8675,_0x5cc263){const _0x1dd429=_0x383a96;return this[_0x1dd429(0x225)][_0x1dd429(0x25f)](_0x5e8675,_0x5cc263??null);}async[_0x383a96(0x204)](_0x2df8c0,_0x1b707e){const _0x26e1c3=_0x383a96;this[_0x26e1c3(0x1e8)](_0x1b707e?.[_0x26e1c3(0x1c6)]);let _0x546cd8=await this['indexManager'][_0x26e1c3(0x204)](_0x2df8c0,_0x1b707e??null);return _0x546cd8[_0x26e1c3(0x273)]['id']!==_0x26e1c3(0x1bb)&&await this[_0x26e1c3(0x21e)]['loadQueryModel'](_0x2df8c0),_0x546cd8[_0x26e1c3(0x1e4)];}async[_0x383a96(0x262)](_0x5ee11c,_0x1d8524){const _0x436bc0=_0x383a96;let _0x4fd944=this[_0x436bc0(0x1d9)]();return this[_0x436bc0(0x1e8)](_0x1d8524?.[_0x436bc0(0x1c6)]),_0x4fd944[_0x436bc0(0x262)](_0x5ee11c,_0x1d8524??null);}async[_0x383a96(0x26d)](_0x3c4033){const _0x221591=_0x383a96;return this[_0x221591(0x21e)][_0x221591(0x26d)](_0x3c4033);}async[_0x383a96(0x221)](_0x489aa5){const _0x3b90d6=_0x383a96;return this['requireMultiIndexCore']()[_0x3b90d6(0x221)](_0x489aa5);}[_0x383a96(0x1d9)](){const _0x3ead3e=_0x383a96;let _0x29e4d1=this[_0x3ead3e(0x21e)];if(typeof _0x29e4d1[_0x3ead3e(0x217)]!='function'||typeof _0x29e4d1[_0x3ead3e(0x23c)]!=_0x3ead3e(0x1d2)||typeof _0x29e4d1[_0x3ead3e(0x262)]!=_0x3ead3e(0x1d2)||typeof _0x29e4d1[_0x3ead3e(0x221)]!='function')throw new Error(_0x3ead3e(0x264));return{'queryMultiIndex':_0x29e4d1['queryMultiIndex'][_0x3ead3e(0x1d0)](_0x29e4d1),'queryMultiIndexText':_0x29e4d1[_0x3ead3e(0x23c)][_0x3ead3e(0x1d0)](_0x29e4d1),'loadIndexes':_0x29e4d1[_0x3ead3e(0x262)][_0x3ead3e(0x1d0)](_0x29e4d1),'unloadIndexes':_0x29e4d1[_0x3ead3e(0x221)][_0x3ead3e(0x1d0)](_0x29e4d1)};}['ensureCachePathDeviceId'](_0x23d43a){_0x23d43a&&this['cachePathDeviceId']===void 0x0&&M(_0x23d43a);}[_0x383a96(0x1b3)]=_0x31ad1a=>{const _0x2ed187=_0x383a96;!U(this['configuredIdentity'])&&this[_0x2ed187(0x263)]===void 0x0||_0x31ad1a['setIdentity'](this[_0x2ed187(0x1b9)]?.[_0x2ed187(0x1c9)]??null,this['configuredIdentity']?.['userId']??null,this[_0x2ed187(0x263)]??null);};[_0x383a96(0x20d)]=_0x5dab3b=>{const _0x4d6b3f=_0x383a96;let _0x5dd0ff=this[_0x4d6b3f(0x21e)]['deviceIdentity']?.();if(!_0x5dd0ff){this['applyIdentity'](_0x5dab3b);return;}_0x5dab3b[_0x4d6b3f(0x216)](_0x5dd0ff[_0x4d6b3f(0x1c9)]??null,this[_0x4d6b3f(0x1b9)]?.[_0x4d6b3f(0x24b)]??null,_0x5dd0ff['mossDeviceId']??null);};['hasCustomAuthenticator'](){const _0x30daa6=_0x383a96;return this[_0x30daa6(0x1df)]!==void 0x0;}async[_0x383a96(0x220)](_0xea997e,_0x435985,_0x24f19d){const _0x4fe826=_0x383a96;if(!this[_0x4fe826(0x1df)])throw new Error(_0x4fe826(0x209));let _0x3fd46d=_0x31db36,_0x5a4941=_0x3fd46d[_0x4fe826(0x222)]??_0x3fd46d[_0x4fe826(0x246)]?.[_0x4fe826(0x222)];if(!_0x5a4941||typeof _0x5a4941[_0x4fe826(0x271)]!='function')throw new Error(_0x4fe826(0x279));return _0x24f19d&&y(_0x5a4941),_0x5a4941[_0x4fe826(0x271)](_0xea997e,_0x435985,this[_0x4fe826(0x1da)],this[_0x4fe826(0x1df)],null,null,_0x24f19d?.[_0x4fe826(0x254)]??null,_0x24f19d?.[_0x4fe826(0x258)]??null);}async[_0x383a96(0x248)](_0x4da6fc,_0x34124f,_0x392d0a){const _0x10b0a3=_0x383a96;if(!await this[_0x10b0a3(0x21e)][_0x10b0a3(0x247)](_0x4da6fc))throw new Error('Index\x20\x22'+_0x4da6fc+_0x10b0a3(0x1bc)+_0x4da6fc+_0x10b0a3(0x224));let _0x251f26=_0x392d0a?.[_0x10b0a3(0x226)]??0x5,_0x2a1a91=_0x392d0a?.[_0x10b0a3(0x1c2)]??0.8;return _0x392d0a?.[_0x10b0a3(0x206)]?this[_0x10b0a3(0x21e)][_0x10b0a3(0x248)](_0x4da6fc,_0x34124f,_0x392d0a['embedding'],_0x251f26,_0x2a1a91,_0x392d0a?.[_0x10b0a3(0x214)]):this[_0x10b0a3(0x21e)][_0x10b0a3(0x25b)](_0x4da6fc,_0x34124f,_0x251f26,_0x2a1a91,_0x392d0a?.[_0x10b0a3(0x214)]);}async[_0x383a96(0x217)](_0x43acda,_0x279b79,_0x5aecb7){const _0x642517=_0x383a96;if(_0x43acda['length']===0x0)throw new Error(_0x642517(0x1fc));let _0x4b93c5=this[_0x642517(0x1d9)](),_0x5fcb66=_0x5aecb7?.['topK']??0xa,_0x11dc65=_0x5aecb7?.[_0x642517(0x1c2)]??0.8;if(_0x5aecb7?.[_0x642517(0x206)])return _0x4b93c5[_0x642517(0x217)](_0x43acda,_0x279b79,_0x5aecb7[_0x642517(0x206)],_0x5fcb66,_0x11dc65,_0x5aecb7?.['filter']);try{return await _0x4b93c5[_0x642517(0x23c)](_0x43acda,_0x279b79,_0x5fcb66,_0x11dc65,_0x5aecb7?.[_0x642517(0x214)]);}catch(_0x399463){throw _0x399463 instanceof Error&&_0x399463['message'][_0x642517(0x272)](_0x642517(0x275))?new Error(_0x399463['message']+_0x642517(0x1f6),{'cause':_0x399463}):_0x399463 instanceof Error&&_0x399463[_0x642517(0x259)][_0x642517(0x272)](_0x642517(0x1fe))?new Error('One\x20or\x20more\x20indexes\x20use\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20vector\x20via\x20options.embedding,\x20or\x20use\x20alpha\x200\x20for\x20keyword-only\x20search.',{'cause':_0x399463}):_0x399463;}}};import{SessionIndex as _0x2f1d96}from'@moss-js/moss-core';var h=class r{#e;#r;#s;#i=!0x1;#a;constructor(_0x52adb2,_0x5400c0,_0x24e9e5){this.#s=_0x52adb2,this.#r=_0x5400c0,this.#e=_0x24e9e5;}static async[_0x383a96(0x255)](_0x58ff4c,_0x390be5,_0x270dd7,_0x1ac6e8,_0xe3a6ce,_0x1bb62f,_0x166900){const _0x247be6=_0x383a96;let _0x25867c=_0x2f1d96;_0x166900&&y(_0x25867c);let _0x4e87e3=await _0x25867c[_0x247be6(0x22d)](_0x58ff4c,_0x390be5,_0x270dd7,_0x1ac6e8,_0xe3a6ce??null,_0x166900?.[_0x247be6(0x254)]??null,_0x166900?.['manifestSha256']??null);return r['_fromInner'](_0x58ff4c,_0x390be5,_0x4e87e3,_0x1bb62f);}static[_0x383a96(0x1d3)](_0x51a17a,_0x293e4c,_0x3b8028,_0x3c6534){return _0x3c6534?.(_0x3b8028),new r(_0x51a17a,_0x293e4c,_0x3b8028);}get[_0x383a96(0x1e4)](){return this.#s;}get[_0x383a96(0x237)](){const _0x5a16d8=_0x383a96;return this.#n(),this.#e[_0x5a16d8(0x237)];}get[_0x383a96(0x210)](){return this.#r;}async[_0x383a96(0x24a)](_0x44be6c,_0x1b4c9a){const _0x21a2ce=_0x383a96;this.#n();let _0x5b2250=_0x1b4c9a?{'upsert':_0x1b4c9a[_0x21a2ce(0x243)]??!0x0}:void 0x0;if(this.#r===_0x21a2ce(0x1bb)){let _0x2c03b6=r.#t(_0x44be6c),_0x14204a=_0x44be6c[_0x21a2ce(0x252)](_0x8191da=>{const _0x1ab6d3=_0x21a2ce;let _0x1c5f44={..._0x8191da};return delete _0x1c5f44[_0x1ab6d3(0x206)],_0x1c5f44;}),_0x3b9475=this.#e[_0x21a2ce(0x230)](_0x14204a,_0x2c03b6,_0x5b2250);return{'added':_0x3b9475[_0x21a2ce(0x1b7)],'updated':_0x3b9475['updated']};}let _0x5ec9e1=this.#e['addDocumentsText'](_0x44be6c,_0x5b2250);return{'added':_0x5ec9e1['added'],'updated':_0x5ec9e1[_0x21a2ce(0x278)]};}async['deleteDocs'](_0x2c6289){const _0x547685=_0x383a96;return this.#n(),this.#e[_0x547685(0x260)](_0x2c6289);}async[_0x383a96(0x25f)](_0x21d0b3){return this.#n(),this.#e['getDocuments'](_0x21d0b3??null);}async[_0x383a96(0x248)](_0x3c5abb,_0x14106d){const _0x534c79=_0x383a96;this.#n();let _0x49ec9a=_0x14106d?.['topK']??0x5,_0xa22d1f=_0x14106d?.[_0x534c79(0x1c2)]??0.8,_0x5ba81d=_0x14106d?.[_0x534c79(0x214)]??null,_0x384ac6=_0x14106d?.[_0x534c79(0x206)];if(_0x384ac6==null){if(this.#r===_0x534c79(0x1bb))throw new Error('This\x20session\x20uses\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20embedding\x20via\x20QueryOptions.embedding.');return this.#e[_0x534c79(0x25b)](_0x3c5abb,_0x49ec9a,_0xa22d1f,_0x5ba81d);}return this.#e[_0x534c79(0x248)](_0x3c5abb,_0x49ec9a,Array[_0x534c79(0x229)](_0x384ac6),_0xa22d1f,_0x5ba81d);}async['loadIndex'](_0x909bb5,_0x53462f){const _0x54116b=_0x383a96;return this.#n(),this.#e[_0x54116b(0x204)](_0x909bb5,_0x53462f??null);}async['pushIndex'](){return this.#n(),this.#e['pushIndex']();}async['saveToDisk'](_0x5d101a){const _0x2b0f3f=_0x383a96;this.#n(),this.#e[_0x2b0f3f(0x236)](_0x5d101a);}async['loadFromDisk'](_0x5b7ec2){const _0x5208b2=_0x383a96;return this.#n(),this.#e[_0x5208b2(0x27c)](_0x5b7ec2);}#n(){const _0x1b356d=_0x383a96;if(this.#i)throw new Error('SessionIndex\x20\x27'+this.#s+_0x1b356d(0x25e));}[_0x383a96(0x24c)](){return this.#a??=this.#o(),this.#a;}async #o(){const _0x4b5aa6=_0x383a96;this.#i=!0x0;let _0x1d623a=this.#e[_0x4b5aa6(0x24c)];if(typeof _0x1d623a!=_0x4b5aa6(0x1d2))throw new Error(_0x4b5aa6(0x25c));await _0x1d623a[_0x4b5aa6(0x274)](this.#e);}async[Symbol[_0x383a96(0x1eb)]](){const _0x305243=_0x383a96;return this[_0x305243(0x24c)]();}async['_warmModel'](){const _0x1fe79d=_0x383a96;this.#n(),this.#r!==_0x1fe79d(0x1bb)&&this.#e['loadModel']();}static#t(_0x2eb830){const _0x3f9c9f=_0x383a96;let _0x332041=_0x2eb830[_0x3f9c9f(0x214)](_0xabeec8=>!_0xabeec8['embedding']||_0xabeec8[_0x3f9c9f(0x206)]['length']===0x0)[_0x3f9c9f(0x252)](_0x4489ea=>_0x4489ea['id']);if(_0x332041['length']>0x0)throw new Error('Documents\x20missing\x20.embedding\x20for\x20custom\x20model:\x20'+_0x332041[_0x3f9c9f(0x1fd)](',\x20')+_0x3f9c9f(0x251));return _0x2eb830[_0x3f9c9f(0x252)](_0xf55cd4=>Array['from'](_0xf55cd4[_0x3f9c9f(0x206)]??[]));}},te='https://service.usemoss.dev',ne='/v1/manage',b=class extends Error{[_0x383a96(0x1c4)];['body'];constructor(_0x4515cf,_0x40c0b4){const _0x19f9e3=_0x383a96;let _0x1b0ba1=_0x40c0b4?':\x20'+_0x40c0b4:'';super(_0x19f9e3(0x1fa)+_0x4515cf+_0x1b0ba1),this[_0x19f9e3(0x1e4)]=_0x19f9e3(0x1af),this[_0x19f9e3(0x1c4)]=_0x4515cf,this['body']=_0x40c0b4;}};function re(){const _0x198d86=_0x383a96;return''+(typeof process<'u'&&process[_0x198d86(0x235)][_0x198d86(0x1ac)]||te)[_0x198d86(0x1d1)](/\/+$/,'')+ne;}function _0x7380(){const _0x37adbb=['maxDepth','IndexManager','ManageApiError','received\x20a\x20progress\x20event\x20with\x20a\x20non-finite\x20progress\x20value\x20(','trim','POST','applyIdentity','then','includePaths','respectRobots','added','uploading','configuredIdentity','fetchAndCache','custom','\x22\x20is\x20not\x20loaded.\x20Call\x20loadIndex(\x22','1981804idGiwb','8777970mXFnUA','test','sources','toByteArray','alpha','resyncWebSource','status','delete','cachePath','authenticator','object','deviceId','byteLength','addDocs\x20requires\x20at\x20least\x20one\x20document','session','authUrl','entries','freeze','bind','replace','function','_fromInner','warn','deleteDocs\x20requires\x20at\x20least\x20one\x20document\x20ID','Building','SDK_VERSION_NUMBER','refreshCadence','requireMultiIndexCore','projectId','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20MossClient.close()','Unsupported\x20job\x20status\x20\x27','stringify','path','authNotifyFn','createIndex\x20requires\x20at\x20least\x20one\x20document','inflight','arrayBuffer','getJobStatus','name','fromEntries','parseOptions','deleteWebSource','ensureCachePathDeviceId','createWebSource','298889KhLapv','asyncDispose','rejectAuthRequest','\x20must\x20be\x20a\x20non-empty\x20string','indexName','identity','moss-minilm','createIndexFromFiles','toLowerCase','\x20contains\x20an\x20unsupported\x20character','pending_upload','onProgress','\x20Provide\x20a\x20query\x20vector\x20via\x20options.embedding,\x20or\x20use\x20alpha\x200\x20for\x20keyword-only\x20search.','updateWebSource','getIndex','normalizeJobStatus','HTTP\x20error!\x20status:\x20','_warmModel','queryMultiIndex\x20requires\x20at\x20least\x20one\x20index\x20name','join','requires\x20explicit\x20query\x20embeddings','now','error','40iUNvvG','resolveAuthRequest','moss-core\x20rejected\x20the\x20auth\x20token:\x20','loadIndex','listIndexes','embedding','modelArtifactContractVersion','parseDocuments','createAuthenticatedSessionInner\x20requires\x20a\x20custom\x20IAuthenticator\x20client','maxDocuments','received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20status\x20(','CLOUD_API_IDENTITY_URL','applySessionIdentity','CLOUD_API_INDEX_URL','cache','modelId','getWebSource','2046022YfPgbN','MOSS_INDEX_URL','filter','moss-core\x20runtime\x20is\x20missing\x20resolveAuthRequest/rejectAuthRequest\x20exports.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','setIdentity','queryMultiIndex','string','8aAURMf','372939lobvNf','expiresIn','clear','received\x20a\x20progress\x20event\x20with\x20a\x20non-string\x20currentPhase\x20(','indexManager','length','createAuthenticatedSessionInner','unloadIndexes','SessionIndex','building','\x22)\x20or\x20loadIndexes([...])\x20before\x20querying;\x20queries\x20run\x20locally\x20and\x20there\x20is\x20no\x20cloud\x20query\x20fallback.','manageClient','topK','Authentication\x20failed\x20(HTTP\x20401):\x20','resync','from','153210ycWJdK','MossClient\x20options.identity.','PendingUpload','create','maxPages','\x20could\x20not\x20be\x20settled:\x20','addDocuments','jobId','MODEL_DOWNLOAD_URL','[moss]\x20Auth\x20request\x20','timeout','env','saveToDisk','docCount','moss-core\x20runtime\x20is\x20missing\x20ManageClient/IndexManager\x20exports','deleteIndex','progress','text','queryMultiIndexText','deref','excludePaths','startsWith','encode','Bearer\x20','CLOUD_API_AUTH_URL','upsert','250232lUhgEy','Web\x20source\x20methods\x20require\x20a\x20project\x20key.\x20Construct\x20MossClient\x20with\x20(projectId,\x20projectKey).','default','hasIndex','query','json','addDocs','userId','close','MossClient\x20is\x20closed','received\x20an\x20array\x20where\x20a\x20JobProgress\x20object\x20was\x20expected','utf8','currentPhase','.\x20All\x20documents\x20must\x20have\x20.embedding\x20set\x20when\x20using\x20modelId=\x27custom\x27.','map','\x27\x20returned\x20by\x20moss-core','version','_create','pendingupload','createIndexFromFiles\x20requires\x20at\x20least\x20one\x20file','manifestSha256','message','slice','queryText','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20SessionIndex.close()','createIndex','\x27\x20is\x20closed','getDocs','deleteDocuments','144iZuYPj','loadIndexes','cachePathDeviceId','The\x20installed\x20@moss-js/moss-core\x20does\x20not\x20support\x20multi-index\x20operations\x20(queryMultiIndex,\x20loadIndexes,\x20unloadIndexes).\x20Upgrade\x20@moss-js/moss-core.','getAuthToken','wrapProgress','[moss]\x20Dropping\x20a\x20malformed\x20job\x20progress\x20event;\x20progress\x20reporting\x20may\x20be\x20incomplete\x20for\x20this\x20operation.\x20Cause:\x20','HTTP\x20','projectKey','rootUrl','getAuthHeader','add','unloadIndex','isFinite','contentType','all','withAuthenticator','includes','model','call','no\x20exact\x20artifact\x20identity','Uploading','deleteDocs','updated','moss-core\x20runtime\x20SessionIndex\x20is\x20missing\x20the\x20withAuthenticator\x20factory.\x20Upgrade\x20@moss-js/moss-core\x20to\x20a\x20build\x20that\x20supports\x20custom\x20authenticators\x20for\x20sessions.','token','MOSS_AUTH_URL','loadFromDisk','expiresAt','application/json','listWebSources','ManageClient','161kNMiNC','isArray','moss-core\x20runtime\x20ManageClient/IndexManager\x20is\x20missing\x20withAuthenticator\x20factory.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','MOSS_CLOUD_API_BASE_URL'];_0x7380=function(){return _0x37adbb;};return _0x7380();}function se(_0x200fef){const _0xf516e1=_0x383a96;return _0x200fef?Object[_0xf516e1(0x1e5)](Object[_0xf516e1(0x1ce)](_0x200fef)[_0xf516e1(0x214)](([,_0x3037ac])=>_0x3037ac!==void 0x0)):{};}async function j(_0x39380b,_0xf03e60,_0x10d5ed,_0x25f9dc){const _0x195d07=_0x383a96;let _0xcaa053={...se(_0x25f9dc),'action':_0x10d5ed,'projectId':_0x39380b},_0x1924f8=await fetch(re(),{'method':_0x195d07(0x1b2),'headers':{'Content-Type':'application/json','X-Project-Key':_0xf03e60},'body':JSON[_0x195d07(0x1dd)](_0xcaa053),'signal':AbortSignal[_0x195d07(0x234)](0x927c0)}),_0xbb0251=await _0x1924f8['text']();if(!_0x1924f8['ok'])throw new b(_0x1924f8[_0x195d07(0x1c4)],_0xbb0251);return _0xbb0251?JSON['parse'](_0xbb0251):{};}var F=_0x383a96(0x1f0),A=class{#e;#r;#s;#i=!0x1;#a;#n=new Set();constructor(_0x3ef9f4,_0x24ba72,_0x214319){const _0x344afd=_0x383a96;this.#e=new x(_0x3ef9f4,_0x24ba72,_0x214319),this.#r=_0x3ef9f4,this.#s=typeof _0x24ba72==_0x344afd(0x218)?_0x24ba72:null;}async[_0x383a96(0x265)](){const _0x37e0ec=_0x383a96;return this.#t(),this.#e[_0x37e0ec(0x265)]();}async['createIndex'](_0x3d1503,_0x2c6739,_0x40dadb){const _0x443c2a=_0x383a96;this.#t();let _0x35533b;return _0x40dadb?.['modelId']!==void 0x0?_0x35533b=_0x40dadb[_0x443c2a(0x210)]:_0x35533b=_0x2c6739['some'](_0x4346ca=>Array[_0x443c2a(0x1aa)](_0x4346ca[_0x443c2a(0x206)])&&_0x4346ca[_0x443c2a(0x206)][_0x443c2a(0x21f)]>0x0)?'custom':F,this.#e['createIndex'](_0x3d1503,_0x2c6739,_0x35533b,_0x40dadb);}async[_0x383a96(0x1f1)](_0x2d0462,_0x52c6b5,_0x1d33fe){const _0x44bc9d=_0x383a96;return this.#t(),this.#e[_0x44bc9d(0x1f1)](_0x2d0462,_0x52c6b5,_0x1d33fe);}async[_0x383a96(0x1f8)](_0x14d875){const _0x3e22e1=_0x383a96;return this.#t(),this.#e[_0x3e22e1(0x1f8)](_0x14d875);}async[_0x383a96(0x205)](){const _0x115a38=_0x383a96;return this.#t(),this.#e[_0x115a38(0x205)]();}async[_0x383a96(0x239)](_0x32f686){const _0x3c8821=_0x383a96;return this.#t(),this.#e[_0x3c8821(0x239)](_0x32f686);}async[_0x383a96(0x24a)](_0x5f27fb,_0x4f5b7c,_0x995df5){const _0x548384=_0x383a96;return this.#t(),this.#e[_0x548384(0x24a)](_0x5f27fb,_0x4f5b7c,_0x995df5);}async[_0x383a96(0x277)](_0x59c62b,_0x563f15,_0x2b4dce){const _0x1de20e=_0x383a96;return this.#t(),this.#e[_0x1de20e(0x277)](_0x59c62b,_0x563f15,_0x2b4dce);}async[_0x383a96(0x1e3)](_0x13a267){const _0x2c7a53=_0x383a96;return this.#t(),this.#e[_0x2c7a53(0x1e3)](_0x13a267);}async[_0x383a96(0x1e9)](_0x5610a8,_0x374dec,_0x40ff8e){const _0x1b2108=_0x383a96;return this.#t(),this.#o('createWebSource',{'rootUrl':_0x5610a8,'indexName':_0x374dec,'maxPages':_0x40ff8e?.[_0x1b2108(0x22e)],'maxDocuments':_0x40ff8e?.[_0x1b2108(0x20a)],'maxDepth':_0x40ff8e?.[_0x1b2108(0x1ad)],'includePaths':_0x40ff8e?.[_0x1b2108(0x1b5)],'excludePaths':_0x40ff8e?.[_0x1b2108(0x23e)],'respectRobots':_0x40ff8e?.[_0x1b2108(0x1b6)],'parseDocuments':_0x40ff8e?.[_0x1b2108(0x208)],'refreshCadence':_0x40ff8e?.[_0x1b2108(0x1d8)],'modelId':_0x40ff8e?.[_0x1b2108(0x210)]});}async[_0x383a96(0x27f)](_0x452460){const _0x4cde1d=_0x383a96;this.#t();let _0x41c971=(await this.#o(_0x4cde1d(0x27f),_0x452460!==void 0x0?{'indexName':_0x452460}:void 0x0))[_0x4cde1d(0x1c0)]??[];return _0x452460===void 0x0?_0x41c971:_0x41c971[_0x4cde1d(0x214)](_0x43836e=>_0x43836e[_0x4cde1d(0x1ee)]===_0x452460);}async[_0x383a96(0x211)](_0x559703){return this.#t(),this.#o('getWebSource',{'sourceId':_0x559703});}async['updateWebSource'](_0x309e27,_0x2ade64){const _0x549b97=_0x383a96;return this.#t(),this.#o(_0x549b97(0x1f7),{'sourceId':_0x309e27,'refreshCadence':_0x2ade64[_0x549b97(0x1d8)],'rootUrl':_0x2ade64[_0x549b97(0x26a)],'includePaths':_0x2ade64[_0x549b97(0x1b5)],'excludePaths':_0x2ade64['excludePaths'],'maxDepth':_0x2ade64[_0x549b97(0x1ad)],'maxPages':_0x2ade64[_0x549b97(0x22e)],'resync':_0x2ade64[_0x549b97(0x228)]});}async[_0x383a96(0x1c3)](_0x7f56ad){return this.#t(),this.#o('resyncWebSource',{'sourceId':_0x7f56ad});}async[_0x383a96(0x1e7)](_0x1c1c3e){const _0x1bbbf2=_0x383a96;return this.#t(),this.#o(_0x1bbbf2(0x1e7),{'sourceId':_0x1c1c3e});}async #o(_0x5e1113,_0x5adfeb){const _0x2f14a0=_0x383a96;if(this.#s===null)throw new Error(_0x2f14a0(0x245));return j(this.#r,this.#s,_0x5e1113,_0x5adfeb);}async[_0x383a96(0x25f)](_0x53f7af,_0x4b46f4){const _0x5a1db6=_0x383a96;return this.#t(),this.#e[_0x5a1db6(0x25f)](_0x53f7af,_0x4b46f4);}async[_0x383a96(0x204)](_0x40e195,_0xbaa518){const _0x2c5e4b=_0x383a96;return this.#t(),this.#e[_0x2c5e4b(0x204)](_0x40e195,_0xbaa518);}async['loadIndexes'](_0x33d1ed,_0x4cde7d){return this.#t(),this.#e['loadIndexes'](_0x33d1ed,_0x4cde7d);}async['unloadIndex'](_0x2fe8d2){const _0xb3099f=_0x383a96;return this.#t(),this.#e[_0xb3099f(0x26d)](_0x2fe8d2);}async[_0x383a96(0x221)](_0x4f6d7e){const _0x47aff5=_0x383a96;return this.#t(),this.#e[_0x47aff5(0x221)](_0x4f6d7e);}async[_0x383a96(0x248)](_0x49b852,_0x19a8e7,_0x4f2c2f){const _0x16f66c=_0x383a96;return this.#t(),this.#e[_0x16f66c(0x248)](_0x49b852,_0x19a8e7,_0x4f2c2f);}async[_0x383a96(0x217)](_0x5d0fce,_0x453e96,_0x48eb7f){const _0x4627aa=_0x383a96;return this.#t(),this.#e[_0x4627aa(0x217)](_0x5d0fce,_0x453e96,_0x48eb7f);}async[_0x383a96(0x1cc)](_0x4aaed8,_0xbfb980=F,_0x5a629b){const _0x336087=_0x383a96;this.#t();let _0x96570b=this.#e['applySessionIdentity'],_0x425b13;if(this.#s!==null)_0x425b13=await h[_0x336087(0x255)](_0x4aaed8,_0xbfb980,this.#r,this.#s,void 0x0,_0x96570b,_0x5a629b);else{let _0x2567e0=await this.#e[_0x336087(0x220)](_0x4aaed8,_0xbfb980,_0x5a629b);_0x425b13=h[_0x336087(0x1d3)](_0x4aaed8,_0xbfb980,_0x2567e0,_0x96570b);}await _0x425b13[_0x336087(0x1fb)]();for(let _0x246727 of this.#n)_0x246727[_0x336087(0x23d)]()||this.#n[_0x336087(0x1c5)](_0x246727);return this.#n[_0x336087(0x26c)](new WeakRef(_0x425b13)),_0x425b13;}#t(){const _0x3d4ce7=_0x383a96;if(this.#i)throw new Error(_0x3d4ce7(0x24d));}[_0x383a96(0x24c)](){return this.#a??=this.#u(),this.#a;}async #u(){const _0x27f19d=_0x383a96;this.#i=!0x0;let _0x53339d=[...this.#n][_0x27f19d(0x252)](_0x4232b2=>_0x4232b2[_0x27f19d(0x23d)]())[_0x27f19d(0x214)](_0x5e30e2=>_0x5e30e2!==void 0x0);this.#n[_0x27f19d(0x21c)](),await Promise[_0x27f19d(0x270)](_0x53339d[_0x27f19d(0x252)](_0x340feb=>_0x340feb[_0x27f19d(0x24c)]())),await this.#e['close']();}async[Symbol[_0x383a96(0x1eb)]](){const _0x1daf49=_0x383a96;return this[_0x1daf49(0x24c)]();}};export{b as ManageApiError,A as MossClient,h as SessionIndex};
|
|
1
|
+
const _0xbe3c1b=_0xb5a9;(function(_0x19c388,_0x18797a){const _0x120fc9=_0xb5a9,_0x1f8870=_0x19c388();while(!![]){try{const _0x5a43c3=-parseInt(_0x120fc9(0x1d1))/0x1*(parseInt(_0x120fc9(0x23c))/0x2)+-parseInt(_0x120fc9(0x226))/0x3*(-parseInt(_0x120fc9(0x24e))/0x4)+-parseInt(_0x120fc9(0x1ca))/0x5*(-parseInt(_0x120fc9(0x1c6))/0x6)+-parseInt(_0x120fc9(0x1de))/0x7+-parseInt(_0x120fc9(0x21e))/0x8*(parseInt(_0x120fc9(0x216))/0x9)+parseInt(_0x120fc9(0x20d))/0xa*(parseInt(_0x120fc9(0x1e4))/0xb)+parseInt(_0x120fc9(0x21b))/0xc*(parseInt(_0x120fc9(0x1d7))/0xd);if(_0x5a43c3===_0x18797a)break;else _0x1f8870['push'](_0x1f8870['shift']());}catch(_0x5e496d){_0x1f8870['push'](_0x1f8870['shift']());}}}(_0x77d9,0x8f92a));import{JobStatus as _0x6363d6}from'@moss-js/moss-core';function _0xb5a9(_0x195c66,_0x313bc1){_0x195c66=_0x195c66-0x189;const _0x77d95a=_0x77d9();let _0xb5a9c0=_0x77d95a[_0x195c66];return _0xb5a9c0;}import*as _0x46fea7 from'@moss-js/moss-core';import*as _0x28db48 from'@moss-js/moss-core';var g=_0x28db48,oe=g[_0xbe3c1b(0x255)],ie=g[_0xbe3c1b(0x1e6)],ae=g[_0xbe3c1b(0x22c)],O=g[_0xbe3c1b(0x214)],ue=typeof process<'u'&&process[_0xbe3c1b(0x201)][_0xbe3c1b(0x224)]||g[_0xbe3c1b(0x1f4)],T=typeof process<'u'?process[_0xbe3c1b(0x201)]:{},f=class{constructor(_0x32895d,_0x4fe1c3){const _0x216f9a=_0xbe3c1b;this[_0x216f9a(0x21d)]=_0x32895d,this[_0x216f9a(0x209)]=_0x4fe1c3,this['authUrl']=T[_0x216f9a(0x199)]??O;}['projectId'];[_0xbe3c1b(0x209)];[_0xbe3c1b(0x243)];async['getAuthToken'](){const _0x403873=_0xbe3c1b;let _0x1c369f=await fetch(this[_0x403873(0x243)],{'method':'POST','headers':{'Content-Type':_0x403873(0x1b0)},'body':JSON[_0x403873(0x251)]({'projectId':this[_0x403873(0x21d)],'projectKey':this[_0x403873(0x209)]}),'signal':AbortSignal[_0x403873(0x25d)](0x7530)});if(_0x1c369f[_0x403873(0x1e8)]===0x191){let _0x3705d2=await _0x1c369f[_0x403873(0x1f2)]();throw new Error('Authentication\x20failed\x20(HTTP\x20401):\x20'+_0x3705d2);}if(!_0x1c369f['ok']){let _0x609c59=await _0x1c369f['text']();throw new Error('HTTP\x20'+_0x1c369f[_0x403873(0x1e8)]+':\x20'+_0x609c59);}let _0x328845=await _0x1c369f[_0x403873(0x1e0)]();return{'token':_0x328845['token'],'expiresIn':_0x328845[_0x403873(0x23d)]};}async[_0xbe3c1b(0x208)](){const _0x55e905=_0xbe3c1b;let {token:_0x25e7db}=await this[_0x55e905(0x1af)]();return _0x55e905(0x1ea)+_0x25e7db;}},I=class{constructor(_0x41fba6){this['inner']=_0x41fba6;}[_0xbe3c1b(0x1c2)];[_0xbe3c1b(0x1ff)]=null;[_0xbe3c1b(0x18a)]=null;async[_0xbe3c1b(0x1af)](){const _0x2bc0c9=_0xbe3c1b;if(this[_0x2bc0c9(0x1ff)]&&this[_0x2bc0c9(0x1ff)][_0x2bc0c9(0x22b)]>Date[_0x2bc0c9(0x1fb)]())return{'token':this[_0x2bc0c9(0x1ff)]['token'],'expiresIn':this['cache'][_0x2bc0c9(0x23d)]};if(this['inflight'])return this[_0x2bc0c9(0x18a)];this['inflight']=this[_0x2bc0c9(0x239)]();try{return await this[_0x2bc0c9(0x18a)];}finally{this['inflight']=null;}}async[_0xbe3c1b(0x208)](){const _0x3be46c=_0xbe3c1b;let {token:_0x38ff29}=await this[_0x3be46c(0x1af)]();return'Bearer\x20'+_0x38ff29;}async['fetchAndCache'](){const _0x44d3ab=_0xbe3c1b;let {token:_0x1c00fd,expiresIn:_0x3bd5ac}=await this[_0x44d3ab(0x1c2)][_0x44d3ab(0x1af)](),_0x28f075=Date[_0x44d3ab(0x1fb)]()+(_0x3bd5ac-0x3c)*0x3e8;return this['cache']={'token':_0x1c00fd,'expiresIn':_0x3bd5ac,'expiresAt':_0x28f075},{'token':_0x1c00fd,'expiresIn':_0x3bd5ac};}};import{randomUUID as _0x57db31}from'node:crypto';import{existsSync as _0x8e456e,mkdirSync as _0x5e9071,readFileSync as _0x3a72ef,writeFileSync as _0x1890a4}from'node:fs';import{join as _0x5f3841}from'node:path';var X=_0xbe3c1b(0x1b9),P=0x100,_=/[\p{Cc}\p{Cf}\p{Cs}\uFFFD]/u;function z(_0x116449){const _0x11636f=_0xbe3c1b;return _0x116449[_0x11636f(0x1cb)]>0x0&&_0x116449['trim']()===_0x116449&&!_['test'](_0x116449)&&new TextEncoder()[_0x11636f(0x1b1)](_0x116449)[_0x11636f(0x1a8)]<=P;}function E(_0x5e4cc2,_0x429cc5){const _0x213034=_0xbe3c1b;if(_0x5e4cc2!==void 0x0){if(typeof _0x5e4cc2!=_0x213034(0x241)||_0x5e4cc2[_0x213034(0x1cb)]===0x0)throw new TypeError(_0x213034(0x1ee)+_0x429cc5+'\x20must\x20be\x20a\x20non-empty\x20string');if(_0x5e4cc2[_0x213034(0x217)]()!==_0x5e4cc2)throw new TypeError(_0x213034(0x1ee)+_0x429cc5+_0x213034(0x198));if(_[_0x213034(0x1ed)](_0x5e4cc2))throw new TypeError('MossClient\x20options.identity.'+_0x429cc5+_0x213034(0x200));if(new TextEncoder()[_0x213034(0x1b1)](_0x5e4cc2)[_0x213034(0x1a8)]>P)throw new TypeError('MossClient\x20options.identity.'+_0x429cc5+'\x20must\x20be\x20at\x20most\x20'+P+_0x213034(0x1cf));return _0x5e4cc2;}}function k(_0x2d6d76){const _0x409961=_0xbe3c1b;if(_0x2d6d76!==void 0x0){if(_0x2d6d76===null||typeof _0x2d6d76!=_0x409961(0x20b)||Array[_0x409961(0x19a)](_0x2d6d76))throw new TypeError('MossClient\x20options.identity\x20must\x20be\x20an\x20object');return Object[_0x409961(0x1a6)]({'deviceId':E(_0x2d6d76[_0x409961(0x246)],'deviceId'),'userId':E(_0x2d6d76[_0x409961(0x193)],'userId')});}}function U(_0x580d28){return _0x580d28?.['deviceId']!==void 0x0||_0x580d28?.['userId']!==void 0x0;}function M(_0x2e5ec3){const _0x4ce095=_0xbe3c1b;if(!_0x2e5ec3?.[_0x4ce095(0x217)]())return;let _0x1183c1=_0x5f3841(_0x2e5ec3,X);try{if(_0x8e456e(_0x1183c1)){let _0x9bd8e9=_0x3a72ef(_0x1183c1,_0x4ce095(0x1b3))[_0x4ce095(0x217)]();return z(_0x9bd8e9)?_0x9bd8e9:void 0x0;}_0x5e9071(_0x2e5ec3,{'recursive':!0x0});let _0x14a57d=_0x57db31();return _0x1890a4(_0x1183c1,_0x14a57d,_0x4ce095(0x1b3)),_0x14a57d;}catch{return;}}var Y=0x1;function y(_0x33f084){const _0x40592a=_0xbe3c1b;let _0x417afb=_0x33f084[_0x40592a(0x19c)];if(typeof _0x417afb!=_0x40592a(0x1da))throw q();let _0x1b772d=_0x417afb['call'](_0x33f084);if(!Number[_0x40592a(0x1ec)](_0x1b772d)||_0x1b772d<Y)throw q();}function q(){const _0x5b85e0=_0xbe3c1b;return new Error(_0x5b85e0(0x18f));}var Ie=0x708*0x3e8;function S(_0x3c50ac){const _0xae1643=_0xbe3c1b;return _0x3c50ac instanceof Error?_0x3c50ac[_0xae1643(0x1f9)]:String(_0x3c50ac);}function Z(_0x49a724){const _0x158a64=_0xbe3c1b;if(_0x49a724===null||typeof _0x49a724!=_0x158a64(0x20b))return _0x158a64(0x1c4)+String(_0x49a724);if(Array[_0x158a64(0x19a)](_0x49a724))return _0x158a64(0x18c);let _0x35bdf0=_0x49a724;return typeof _0x35bdf0['jobId']!='string'||_0x35bdf0[_0x158a64(0x21a)]['length']===0x0?_0x158a64(0x231)+String(_0x35bdf0[_0x158a64(0x21a)])+')':typeof _0x35bdf0[_0x158a64(0x1e8)]!=_0x158a64(0x241)||_0x35bdf0[_0x158a64(0x1e8)][_0x158a64(0x1cb)]===0x0?'received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20status\x20('+String(_0x35bdf0[_0x158a64(0x1e8)])+')':typeof _0x35bdf0['progress']!=_0x158a64(0x1f5)||!Number['isFinite'](_0x35bdf0[_0x158a64(0x244)])?_0x158a64(0x1d5)+String(_0x35bdf0[_0x158a64(0x244)])+')':_0x35bdf0[_0x158a64(0x1db)]!==void 0x0&&_0x35bdf0[_0x158a64(0x1db)]!==null&&typeof _0x35bdf0['currentPhase']!='string'?'received\x20a\x20progress\x20event\x20with\x20a\x20non-string\x20currentPhase\x20('+String(_0x35bdf0[_0x158a64(0x1db)])+')':null;}var x=class{[_0xbe3c1b(0x20a)];[_0xbe3c1b(0x261)];[_0xbe3c1b(0x233)];[_0xbe3c1b(0x1a0)];[_0xbe3c1b(0x25e)];['projectId'];[_0xbe3c1b(0x203)];constructor(_0x26df4f,_0x109d15,_0x3f3eaf){const _0x20f6b8=_0xbe3c1b;this[_0x20f6b8(0x25e)]=k(_0x3f3eaf?.['identity']),this[_0x20f6b8(0x1a0)]=M(_0x3f3eaf?.[_0x20f6b8(0x1e7)]),this[_0x20f6b8(0x21d)]=_0x26df4f;let _0x357421=typeof _0x109d15==_0x20f6b8(0x241)?new f(_0x26df4f,_0x109d15):_0x109d15;this[_0x20f6b8(0x20a)]=new I(_0x357421);let _0x50300b=_0x46fea7,_0x56c784=_0x50300b[_0x20f6b8(0x253)]??_0x50300b[_0x20f6b8(0x1d9)]?.['ManageClient'],_0x261034=_0x50300b[_0x20f6b8(0x22a)]??_0x50300b[_0x20f6b8(0x1d9)]?.[_0x20f6b8(0x22a)];if(!_0x56c784||!_0x261034)throw new Error(_0x20f6b8(0x1a4));if(typeof _0x109d15==_0x20f6b8(0x241))this[_0x20f6b8(0x261)]=new _0x56c784(_0x26df4f,_0x109d15),this[_0x20f6b8(0x233)]=new _0x261034(_0x26df4f,_0x109d15);else{let _0x4d2186=_0x50300b[_0x20f6b8(0x1ac)]??_0x50300b[_0x20f6b8(0x1d9)]?.[_0x20f6b8(0x1ac)],_0x2d36b6=_0x50300b[_0x20f6b8(0x234)]??_0x50300b[_0x20f6b8(0x1d9)]?.[_0x20f6b8(0x234)];if(!_0x4d2186||!_0x2d36b6)throw new Error(_0x20f6b8(0x195));let _0xb92769=this[_0x20f6b8(0x20a)],_0x390412=(_0x204576,_0x369387)=>{const _0x5e2b12=_0x20f6b8;try{_0x2d36b6(_0x204576,_0x369387);}catch(_0x23e556){console[_0x5e2b12(0x23b)](_0x5e2b12(0x1ab)+_0x204576+_0x5e2b12(0x25c)+S(_0x23e556));}},_0x5d98ce=(_0x2f5124,_0x1cfd90)=>{try{_0x4d2186(_0x2f5124,_0x1cfd90);}catch(_0x2e8bc2){_0x390412(_0x2f5124,'moss-core\x20rejected\x20the\x20auth\x20token:\x20'+S(_0x2e8bc2));}},_0x55ddf7=!0x1,_0x4a4e3b=(_0x4fa03c,_0x3c5432)=>{const _0x54ea5f=_0x20f6b8;if(_0x4fa03c||!Number[_0x54ea5f(0x1ec)](_0x3c5432)||_0x3c5432<0x0){_0x55ddf7||(_0x55ddf7=!0x0,console[_0x54ea5f(0x23b)]('[moss]\x20Ignoring\x20an\x20auth\x20request\x20with\x20no\x20usable\x20request\x20id;\x20custom\x20authentication\x20may\x20be\x20unavailable\x20for\x20this\x20client.\x20Cause:\x20'+(_0x4fa03c?_0x4fa03c[_0x54ea5f(0x1f9)]:_0x54ea5f(0x1c4)+String(_0x3c5432))));return;}_0xb92769[_0x54ea5f(0x208)]()['then'](_0x185409=>{const _0x1de975=_0x54ea5f;let _0x3588e5=_0x185409[_0x1de975(0x259)](_0x1de975(0x1ea))?_0x185409[_0x1de975(0x1b7)](0x7):_0x185409;_0x5d98ce(_0x3c5432,_0x3588e5);},_0x4088a8=>_0x390412(_0x3c5432,S(_0x4088a8)));};this[_0x20f6b8(0x203)]=_0x4a4e3b;let _0x3fe020=_0x56c784,_0x44d05c=_0x261034;if(!_0x3fe020[_0x20f6b8(0x20c)]||!_0x44d05c[_0x20f6b8(0x20c)])throw new Error('moss-core\x20runtime\x20ManageClient/IndexManager\x20is\x20missing\x20withAuthenticator\x20factory.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.');this['manageClient']=_0x3fe020['withAuthenticator'](_0x26df4f,_0x4a4e3b),this[_0x20f6b8(0x233)]=_0x44d05c['withAuthenticator'](_0x26df4f,_0x4a4e3b);}this['applyIdentity'](this[_0x20f6b8(0x233)]);}async[_0xbe3c1b(0x21f)](){const _0x3f4109=_0xbe3c1b;let _0x338748=this['indexManager'][_0x3f4109(0x21f)];if(typeof _0x338748!=_0x3f4109(0x1da))throw new Error(_0x3f4109(0x1fc));await _0x338748[_0x3f4109(0x20e)](this[_0x3f4109(0x233)]);}async[_0xbe3c1b(0x1af)](){const _0x383990=_0xbe3c1b;return this[_0x383990(0x20a)]['getAuthToken']();}[_0xbe3c1b(0x225)](_0x146108){if(!_0x146108)return;let _0x37e750=!0x1;return(_0x57f1d7,_0x1c6e29)=>{const _0x175045=_0xb5a9;let _0x50c60e=_0x57f1d7?_0x57f1d7[_0x175045(0x1f9)]:Z(_0x1c6e29);if(_0x50c60e!==null){_0x37e750||(_0x37e750=!0x0,console[_0x175045(0x23b)](_0x175045(0x191)+_0x50c60e));return;}_0x146108(_0x1c6e29);};}[_0xbe3c1b(0x1e3)](_0x350765){const _0x413deb=_0xbe3c1b;let _0x3b4f2e=_0x350765['trim']()[_0x413deb(0x238)]()[_0x413deb(0x235)](/\s+/g,'_'),_0x40a07b=_0x3b4f2e[_0x413deb(0x235)](/_/g,'');if(_0x3b4f2e==='pending_upload'||_0x40a07b===_0x413deb(0x189))return _0x6363d6[_0x413deb(0x1f7)];if(_0x3b4f2e===_0x413deb(0x1b4))return _0x6363d6[_0x413deb(0x227)];if(_0x3b4f2e==='building')return _0x6363d6[_0x413deb(0x1be)];if(_0x3b4f2e===_0x413deb(0x190))return _0x6363d6[_0x413deb(0x23e)];if(_0x3b4f2e===_0x413deb(0x260))return _0x6363d6[_0x413deb(0x1e2)];throw new Error('Unsupported\x20job\x20status\x20\x27'+_0x350765+_0x413deb(0x1b8));}async[_0xbe3c1b(0x230)](_0x4e6470,_0x84b530,_0x1ee26c,_0x5dcb05){const _0x5a5dc1=_0xbe3c1b;if(!_0x84b530[_0x5a5dc1(0x1cb)])throw new Error('createIndex\x20requires\x20at\x20least\x20one\x20document');return await this['manageClient']['createIndex'](_0x4e6470,_0x84b530,_0x1ee26c,this[_0x5a5dc1(0x225)](_0x5dcb05?.[_0x5a5dc1(0x23f)]));}async['toByteArray'](_0x16d970){const _0x5d1044=_0xbe3c1b;if(_0x16d970 instanceof Uint8Array)return Array[_0x5d1044(0x221)](_0x16d970);if(_0x16d970 instanceof ArrayBuffer)return Array['from'](new Uint8Array(_0x16d970));if(typeof _0x16d970[_0x5d1044(0x232)]=='function'){let _0x3250a8=await _0x16d970[_0x5d1044(0x232)]();return Array[_0x5d1044(0x221)](new Uint8Array(_0x3250a8));}throw new Error(_0x5d1044(0x23a));}async[_0xbe3c1b(0x257)](_0x448223,_0x37207f,_0x513b2a){const _0x6f5245=_0xbe3c1b;if(_0x37207f[_0x6f5245(0x1cb)]===0x0)throw new Error(_0x6f5245(0x1f1));let _0x1e5688=_0x513b2a?.['modelId']??_0x6f5245(0x204),_0x36501c=await Promise[_0x6f5245(0x1c3)](_0x37207f[_0x6f5245(0x1c8)](async _0x10efaf=>({'name':_0x10efaf[_0x6f5245(0x192)],'contentType':_0x10efaf[_0x6f5245(0x1fa)],'path':_0x10efaf[_0x6f5245(0x24d)]??void 0x0,'data':_0x10efaf['data']!=null?await this['toByteArray'](_0x10efaf[_0x6f5245(0x196)]):void 0x0})));return await this[_0x6f5245(0x261)][_0x6f5245(0x257)](_0x448223,_0x36501c,_0x1e5688,this['wrapProgress'](_0x513b2a?.[_0x6f5245(0x23f)]),_0x513b2a?.[_0x6f5245(0x1d4)]??null);}async[_0xbe3c1b(0x1c7)](_0x433bdd,_0x42fb76,_0x3e89fa){const _0x52268b=_0xbe3c1b;if(Array['isArray'](_0x42fb76)&&_0x42fb76['length']===0x0)throw new Error('addDocs\x20requires\x20at\x20least\x20one\x20document');return await this[_0x52268b(0x261)]['addDocs'](_0x433bdd,_0x42fb76,_0x3e89fa??null,this[_0x52268b(0x225)](_0x3e89fa?.['onProgress']));}async[_0xbe3c1b(0x24f)](_0x1d27cc,_0x3d7d94,_0x6169c){const _0x36983b=_0xbe3c1b;if(Array[_0x36983b(0x19a)](_0x3d7d94)&&_0x3d7d94[_0x36983b(0x1cb)]===0x0)throw new Error(_0x36983b(0x1f6));return await this[_0x36983b(0x261)][_0x36983b(0x24f)](_0x1d27cc,_0x3d7d94,this['wrapProgress'](_0x6169c?.['onProgress']));}async[_0xbe3c1b(0x24a)](_0x5a83f8){const _0x5c3ee3=_0xbe3c1b;let _0x54b127=await this['manageClient']['getJobStatus'](_0x5a83f8);return{..._0x54b127,'status':this[_0x5c3ee3(0x1e3)](_0x54b127['status']),'currentPhase':_0x54b127[_0x5c3ee3(0x1db)]??null,'error':_0x54b127[_0x5c3ee3(0x19e)]??null};}async[_0xbe3c1b(0x1d6)](_0x3080c7){return this['manageClient']['getIndex'](_0x3080c7);}async[_0xbe3c1b(0x197)](){const _0x43be6b=_0xbe3c1b;return this[_0x43be6b(0x261)][_0x43be6b(0x197)]();}async['deleteIndex'](_0x94cbcb){const _0x4f517d=_0xbe3c1b;return this[_0x4f517d(0x261)]['deleteIndex'](_0x94cbcb);}async['getDocs'](_0x3cef08,_0x5c23e7){const _0x248010=_0xbe3c1b;return this['manageClient'][_0x248010(0x25a)](_0x3cef08,_0x5c23e7??null);}async['loadIndex'](_0x103ca7,_0x592cd5){const _0x42ac96=_0xbe3c1b;this[_0x42ac96(0x24c)](_0x592cd5?.['cachePath']);let _0x1c3c36=await this['indexManager'][_0x42ac96(0x18e)](_0x103ca7,_0x592cd5??null);return _0x1c3c36['model']['id']!=='custom'&&await this['indexManager'][_0x42ac96(0x207)](_0x103ca7),_0x1c3c36[_0x42ac96(0x192)];}async['loadIndexes'](_0xae8592,_0x34462f){const _0x32f2f3=_0xbe3c1b;let _0xd9368e=this[_0x32f2f3(0x237)]();return this['ensureCachePathDeviceId'](_0x34462f?.[_0x32f2f3(0x1e7)]),_0xd9368e[_0x32f2f3(0x1fd)](_0xae8592,_0x34462f??null);}async[_0xbe3c1b(0x256)](_0x2e2432){const _0x261e6f=_0xbe3c1b;return this['indexManager'][_0x261e6f(0x256)](_0x2e2432);}async['unloadIndexes'](_0x3a4ae1){const _0x4a1aea=_0xbe3c1b;return this[_0x4a1aea(0x237)]()[_0x4a1aea(0x1ba)](_0x3a4ae1);}[_0xbe3c1b(0x237)](){const _0x581eec=_0xbe3c1b;let _0xaec773=this['indexManager'];if(typeof _0xaec773[_0x581eec(0x222)]!=_0x581eec(0x1da)||typeof _0xaec773[_0x581eec(0x19f)]!=_0x581eec(0x1da)||typeof _0xaec773[_0x581eec(0x1fd)]!=_0x581eec(0x1da)||typeof _0xaec773[_0x581eec(0x1ba)]!=_0x581eec(0x1da))throw new Error(_0x581eec(0x1a3));return{'queryMultiIndex':_0xaec773['queryMultiIndex']['bind'](_0xaec773),'queryMultiIndexText':_0xaec773[_0x581eec(0x19f)]['bind'](_0xaec773),'loadIndexes':_0xaec773[_0x581eec(0x1fd)][_0x581eec(0x1ce)](_0xaec773),'unloadIndexes':_0xaec773[_0x581eec(0x1ba)]['bind'](_0xaec773)};}['ensureCachePathDeviceId'](_0x5c3b1a){const _0x423656=_0xbe3c1b;_0x5c3b1a&&this[_0x423656(0x1a0)]===void 0x0&&M(_0x5c3b1a);}[_0xbe3c1b(0x229)]=_0x50d8ea=>{const _0x2e4955=_0xbe3c1b;!U(this[_0x2e4955(0x25e)])&&this['cachePathDeviceId']===void 0x0||_0x50d8ea[_0x2e4955(0x1cc)](this[_0x2e4955(0x25e)]?.['deviceId']??null,this['configuredIdentity']?.[_0x2e4955(0x193)]??null,this[_0x2e4955(0x1a0)]??null);};[_0xbe3c1b(0x249)]=_0xfb39f9=>{const _0x38ba5e=_0xbe3c1b;let _0x443b58=this[_0x38ba5e(0x233)][_0x38ba5e(0x1ad)]?.();if(!_0x443b58){this[_0x38ba5e(0x229)](_0xfb39f9);return;}_0xfb39f9[_0x38ba5e(0x1cc)](_0x443b58[_0x38ba5e(0x246)]??null,this[_0x38ba5e(0x25e)]?.[_0x38ba5e(0x193)]??null,_0x443b58['mossDeviceId']??null);};['hasCustomAuthenticator'](){return this['authNotifyFn']!==void 0x0;}async[_0xbe3c1b(0x245)](_0x147a38,_0x16f73c,_0x21c68e){const _0x3ed09d=_0xbe3c1b;if(!this[_0x3ed09d(0x203)])throw new Error('createAuthenticatedSessionInner\x20requires\x20a\x20custom\x20IAuthenticator\x20client');let _0xa4f6bd=_0x46fea7,_0x1d2b83=_0xa4f6bd[_0x3ed09d(0x22f)]??_0xa4f6bd[_0x3ed09d(0x1d9)]?.[_0x3ed09d(0x22f)];if(!_0x1d2b83||typeof _0x1d2b83[_0x3ed09d(0x20c)]!=_0x3ed09d(0x1da))throw new Error(_0x3ed09d(0x25f));return _0x21c68e&&y(_0x1d2b83),_0x1d2b83[_0x3ed09d(0x20c)](_0x147a38,_0x16f73c,this[_0x3ed09d(0x21d)],this[_0x3ed09d(0x203)],null,null,_0x21c68e?.[_0x3ed09d(0x218)]??null,_0x21c68e?.[_0x3ed09d(0x1f0)]??null);}async['query'](_0x11d416,_0xd515c5,_0x15d35c){const _0x16c55e=_0xbe3c1b;if(!await this[_0x16c55e(0x233)][_0x16c55e(0x206)](_0x11d416))throw new Error('Index\x20\x22'+_0x11d416+'\x22\x20is\x20not\x20loaded.\x20Call\x20loadIndex(\x22'+_0x11d416+_0x16c55e(0x258));let _0x256eaf=_0x15d35c?.[_0x16c55e(0x242)]??0x5,_0x46c16c=_0x15d35c?.['alpha']??0.8;return _0x15d35c?.[_0x16c55e(0x1cd)]?this['indexManager'][_0x16c55e(0x236)](_0x11d416,_0xd515c5,_0x15d35c['embedding'],_0x256eaf,_0x46c16c,_0x15d35c?.[_0x16c55e(0x1ef)]):this['indexManager'][_0x16c55e(0x1bc)](_0x11d416,_0xd515c5,_0x256eaf,_0x46c16c,_0x15d35c?.['filter']);}async[_0xbe3c1b(0x222)](_0x50fff0,_0x93b751,_0x32a376){const _0x41985a=_0xbe3c1b;if(_0x50fff0[_0x41985a(0x1cb)]===0x0)throw new Error('queryMultiIndex\x20requires\x20at\x20least\x20one\x20index\x20name');let _0x3f7296=this['requireMultiIndexCore'](),_0x33731d=_0x32a376?.['topK']??0xa,_0x178fa0=_0x32a376?.[_0x41985a(0x21c)]??0.8;if(_0x32a376?.[_0x41985a(0x1cd)])return _0x3f7296[_0x41985a(0x222)](_0x50fff0,_0x93b751,_0x32a376['embedding'],_0x33731d,_0x178fa0,_0x32a376?.[_0x41985a(0x1ef)]);try{return await _0x3f7296[_0x41985a(0x19f)](_0x50fff0,_0x93b751,_0x33731d,_0x178fa0,_0x32a376?.[_0x41985a(0x1ef)]);}catch(_0x522e0c){throw _0x522e0c instanceof Error&&_0x522e0c[_0x41985a(0x1f9)]['includes']('no\x20exact\x20artifact\x20identity')?new Error(_0x522e0c[_0x41985a(0x1f9)]+_0x41985a(0x1d2),{'cause':_0x522e0c}):_0x522e0c instanceof Error&&_0x522e0c[_0x41985a(0x1f9)][_0x41985a(0x205)]('requires\x20explicit\x20query\x20embeddings')?new Error(_0x41985a(0x262),{'cause':_0x522e0c}):_0x522e0c;}}};import{SessionIndex as _0x14da15}from'@moss-js/moss-core';var h=class r{#e;#r;#s;#i=!0x1;#a;constructor(_0x17e339,_0x273fdb,_0x1b3e00){this.#s=_0x17e339,this.#r=_0x273fdb,this.#e=_0x1b3e00;}static async[_0xbe3c1b(0x248)](_0x4da06c,_0x536224,_0x1dca81,_0x966f58,_0x56d210,_0x1cbb77,_0x116076){const _0x5c76e4=_0xbe3c1b;let _0x1b4b09=_0x14da15;_0x116076&&y(_0x1b4b09);let _0x3cfafd=await _0x1b4b09['create'](_0x4da06c,_0x536224,_0x1dca81,_0x966f58,_0x56d210??null,_0x116076?.['version']??null,_0x116076?.[_0x5c76e4(0x1f0)]??null);return r['_fromInner'](_0x4da06c,_0x536224,_0x3cfafd,_0x1cbb77);}static[_0xbe3c1b(0x19d)](_0xdd3f88,_0x31d15f,_0xd86c48,_0x4a9dee){return _0x4a9dee?.(_0xd86c48),new r(_0xdd3f88,_0x31d15f,_0xd86c48);}get[_0xbe3c1b(0x192)](){return this.#s;}get[_0xbe3c1b(0x25b)](){const _0xb48905=_0xbe3c1b;return this.#n(),this.#e[_0xb48905(0x25b)];}get[_0xbe3c1b(0x1a1)](){return this.#r;}async[_0xbe3c1b(0x1c7)](_0x18e85d,_0x526e47){const _0x1fde92=_0xbe3c1b;this.#n();let _0x450c5c=_0x526e47?{'upsert':_0x526e47['upsert']??!0x0}:void 0x0;if(this.#r===_0x1fde92(0x1dd)){let _0x44b98e=r.#t(_0x18e85d),_0x4c3814=_0x18e85d[_0x1fde92(0x1c8)](_0x22899=>{const _0x5bd3d0=_0x1fde92;let _0x4442ad={..._0x22899};return delete _0x4442ad[_0x5bd3d0(0x1cd)],_0x4442ad;}),_0x33b531=await this.#e[_0x1fde92(0x194)](_0x4c3814,_0x44b98e,_0x450c5c);return{'added':_0x33b531[_0x1fde92(0x20f)],'updated':_0x33b531[_0x1fde92(0x254)]};}let _0x162904=await this.#e[_0x1fde92(0x1f8)](_0x18e85d,_0x450c5c);return{'added':_0x162904[_0x1fde92(0x20f)],'updated':_0x162904['updated']};}async[_0xbe3c1b(0x24f)](_0x53a98e){return this.#n(),await this.#e['deleteDocuments'](_0x53a98e);}async[_0xbe3c1b(0x25a)](_0x95172c){const _0x1467ee=_0xbe3c1b;return this.#n(),await this.#e[_0x1467ee(0x240)](_0x95172c??null);}async[_0xbe3c1b(0x236)](_0x54c130,_0x276ea8){const _0x3997d5=_0xbe3c1b;this.#n();let _0x516dbc=_0x276ea8?.[_0x3997d5(0x242)]??0x5,_0x541927=_0x276ea8?.[_0x3997d5(0x21c)]??0.8,_0x34a64b=_0x276ea8?.['filter']??null,_0x555935=_0x276ea8?.[_0x3997d5(0x1cd)];if(_0x555935==null){if(this.#r===_0x3997d5(0x1dd))throw new Error('This\x20session\x20uses\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20embedding\x20via\x20QueryOptions.embedding.');return await this.#e[_0x3997d5(0x1bc)](_0x54c130,_0x516dbc,_0x541927,_0x34a64b);}return await this.#e[_0x3997d5(0x236)](_0x54c130,_0x516dbc,Array[_0x3997d5(0x221)](_0x555935),_0x541927,_0x34a64b);}async[_0xbe3c1b(0x18e)](_0x415c2d,_0x478435){const _0x149665=_0xbe3c1b;return this.#n(),this.#e[_0x149665(0x18e)](_0x415c2d,_0x478435??null);}async[_0xbe3c1b(0x1bd)](){const _0x3ab247=_0xbe3c1b;return this.#n(),this.#e[_0x3ab247(0x1bd)]();}async[_0xbe3c1b(0x228)](_0x4ba834){const _0x8a3cb0=_0xbe3c1b;this.#n(),await this.#e[_0x8a3cb0(0x228)](_0x4ba834);}async[_0xbe3c1b(0x19b)](_0x310d35,_0xfd4bad){const _0x4d8170=_0xbe3c1b;this.#n();let _0x173ec1=_0xfd4bad?.[_0x4d8170(0x1c1)]??!0x0;return await this.#e[_0x4d8170(0x19b)](_0x310d35,{'rebuildLegacy':_0x173ec1});}async[_0xbe3c1b(0x1a5)](_0x45ea6f){const _0x482f91=_0xbe3c1b;return this.#n(),await this.#e[_0x482f91(0x1a5)](_0x45ea6f);}#n(){const _0x42a935=_0xbe3c1b;if(this.#i)throw new Error(_0x42a935(0x1a7)+this.#s+'\x27\x20is\x20closed');}[_0xbe3c1b(0x21f)](){return this.#a??=this.#o(),this.#a;}async #o(){const _0x21f142=_0xbe3c1b;this.#i=!0x0;let _0x55482d=this.#e[_0x21f142(0x21f)];if(typeof _0x55482d!=_0x21f142(0x1da))throw new Error(_0x21f142(0x202));await _0x55482d[_0x21f142(0x20e)](this.#e);}async[Symbol[_0xbe3c1b(0x1f3)]](){const _0x8ead39=_0xbe3c1b;return this[_0x8ead39(0x21f)]();}async[_0xbe3c1b(0x1e5)](){const _0xf7b6d4=_0xbe3c1b;this.#n(),this.#r!==_0xf7b6d4(0x1dd)&&await this.#e[_0xf7b6d4(0x1a9)]();}static#t(_0x5c5a3b){const _0x315d96=_0xbe3c1b;let _0x383091=_0x5c5a3b['filter'](_0x339aa7=>!_0x339aa7['embedding']||_0x339aa7['embedding'][_0x315d96(0x1cb)]===0x0)['map'](_0x15e7fb=>_0x15e7fb['id']);if(_0x383091[_0x315d96(0x1cb)]>0x0)throw new Error(_0x315d96(0x1d8)+_0x383091[_0x315d96(0x1a2)](',\x20')+_0x315d96(0x1b6));return _0x5c5a3b[_0x315d96(0x1c8)](_0x573514=>Array[_0x315d96(0x221)](_0x573514[_0x315d96(0x1cd)]??[]));}},te=_0xbe3c1b(0x18b),ne=_0xbe3c1b(0x1d3),b=class extends Error{['status'];[_0xbe3c1b(0x211)];constructor(_0x31d117,_0x56377c){const _0x19303b=_0xbe3c1b;let _0x205eac=_0x56377c?':\x20'+_0x56377c:'';super(_0x19303b(0x22d)+_0x31d117+_0x205eac),this[_0x19303b(0x192)]=_0x19303b(0x1c5),this[_0x19303b(0x1e8)]=_0x31d117,this[_0x19303b(0x211)]=_0x56377c;}};function re(){const _0x9a5281=_0xbe3c1b;return''+(typeof process<'u'&&process[_0x9a5281(0x201)][_0x9a5281(0x223)]||te)['replace'](/\/+$/,'')+ne;}function se(_0x4fe443){const _0x1cc498=_0xbe3c1b;return _0x4fe443?Object[_0x1cc498(0x1aa)](Object[_0x1cc498(0x18d)](_0x4fe443)[_0x1cc498(0x1ef)](([,_0x41a34f])=>_0x41a34f!==void 0x0)):{};}async function j(_0x1e4cb3,_0x247a2f,_0x113ec9,_0x5a52d0){const _0x12e334=_0xbe3c1b;let _0x4b477e={...se(_0x5a52d0),'action':_0x113ec9,'projectId':_0x1e4cb3},_0x3fea5f=await fetch(re(),{'method':_0x12e334(0x1bf),'headers':{'Content-Type':_0x12e334(0x1b0),'X-Project-Key':_0x247a2f},'body':JSON[_0x12e334(0x251)](_0x4b477e),'signal':AbortSignal[_0x12e334(0x25d)](0x927c0)}),_0x24cbca=await _0x3fea5f['text']();if(!_0x3fea5f['ok'])throw new b(_0x3fea5f[_0x12e334(0x1e8)],_0x24cbca);return _0x24cbca?JSON['parse'](_0x24cbca):{};}var F='moss-minilm',A=class{#e;#r;#s;#i=!0x1;#a;#n=new Set();constructor(_0x128902,_0x55b291,_0x393c24){const _0x2ef627=_0xbe3c1b;this.#e=new x(_0x128902,_0x55b291,_0x393c24),this.#r=_0x128902,this.#s=typeof _0x55b291==_0x2ef627(0x241)?_0x55b291:null;}async[_0xbe3c1b(0x1af)](){const _0x1c29cc=_0xbe3c1b;return this.#t(),this.#e[_0x1c29cc(0x1af)]();}async['createIndex'](_0x2ef3c7,_0xfbf0c2,_0x3f1856){const _0xdd6446=_0xbe3c1b;this.#t();let _0xce121a;return _0x3f1856?.[_0xdd6446(0x1a1)]!==void 0x0?_0xce121a=_0x3f1856[_0xdd6446(0x1a1)]:_0xce121a=_0xfbf0c2[_0xdd6446(0x212)](_0x45d501=>Array[_0xdd6446(0x19a)](_0x45d501[_0xdd6446(0x1cd)])&&_0x45d501[_0xdd6446(0x1cd)]['length']>0x0)?'custom':F,this.#e[_0xdd6446(0x230)](_0x2ef3c7,_0xfbf0c2,_0xce121a,_0x3f1856);}async[_0xbe3c1b(0x257)](_0x5d0605,_0x4839c2,_0x36b0a0){const _0x150bdd=_0xbe3c1b;return this.#t(),this.#e[_0x150bdd(0x257)](_0x5d0605,_0x4839c2,_0x36b0a0);}async[_0xbe3c1b(0x1d6)](_0xd378ca){const _0x4d8993=_0xbe3c1b;return this.#t(),this.#e[_0x4d8993(0x1d6)](_0xd378ca);}async[_0xbe3c1b(0x197)](){const _0x220c57=_0xbe3c1b;return this.#t(),this.#e[_0x220c57(0x197)]();}async[_0xbe3c1b(0x252)](_0x27184e){const _0x5907b2=_0xbe3c1b;return this.#t(),this.#e[_0x5907b2(0x252)](_0x27184e);}async['addDocs'](_0x57af18,_0x38c597,_0x570e43){const _0x3ab1e7=_0xbe3c1b;return this.#t(),this.#e[_0x3ab1e7(0x1c7)](_0x57af18,_0x38c597,_0x570e43);}async[_0xbe3c1b(0x24f)](_0x2ed711,_0x8c0a1e,_0x30f047){const _0x565132=_0xbe3c1b;return this.#t(),this.#e[_0x565132(0x24f)](_0x2ed711,_0x8c0a1e,_0x30f047);}async[_0xbe3c1b(0x24a)](_0x329864){return this.#t(),this.#e['getJobStatus'](_0x329864);}async[_0xbe3c1b(0x213)](_0x4df2de,_0x4d5f01,_0x4fd5b2){const _0x48f705=_0xbe3c1b;return this.#t(),this.#o(_0x48f705(0x213),{'rootUrl':_0x4df2de,'indexName':_0x4d5f01,'maxPages':_0x4fd5b2?.[_0x48f705(0x247)],'maxDocuments':_0x4fd5b2?.[_0x48f705(0x1b2)],'maxDepth':_0x4fd5b2?.['maxDepth'],'includePaths':_0x4fd5b2?.[_0x48f705(0x1c9)],'excludePaths':_0x4fd5b2?.[_0x48f705(0x220)],'respectRobots':_0x4fd5b2?.[_0x48f705(0x1eb)],'parseDocuments':_0x4fd5b2?.[_0x48f705(0x215)],'refreshCadence':_0x4fd5b2?.[_0x48f705(0x24b)],'modelId':_0x4fd5b2?.['modelId']});}async[_0xbe3c1b(0x1ae)](_0x48b784){const _0x1cfa3d=_0xbe3c1b;this.#t();let _0x3cf666=(await this.#o(_0x1cfa3d(0x1ae),_0x48b784!==void 0x0?{'indexName':_0x48b784}:void 0x0))[_0x1cfa3d(0x1d0)]??[];return _0x48b784===void 0x0?_0x3cf666:_0x3cf666[_0x1cfa3d(0x1ef)](_0x3fedb3=>_0x3fedb3[_0x1cfa3d(0x219)]===_0x48b784);}async['getWebSource'](_0x5cdf3d){const _0x523452=_0xbe3c1b;return this.#t(),this.#o(_0x523452(0x1e9),{'sourceId':_0x5cdf3d});}async[_0xbe3c1b(0x1df)](_0x179c4c,_0x46752d){const _0x4b784f=_0xbe3c1b;return this.#t(),this.#o(_0x4b784f(0x1df),{'sourceId':_0x179c4c,'refreshCadence':_0x46752d[_0x4b784f(0x24b)],'rootUrl':_0x46752d['rootUrl'],'includePaths':_0x46752d[_0x4b784f(0x1c9)],'excludePaths':_0x46752d[_0x4b784f(0x220)],'maxDepth':_0x46752d[_0x4b784f(0x22e)],'maxPages':_0x46752d[_0x4b784f(0x247)],'resync':_0x46752d[_0x4b784f(0x1b5)]});}async[_0xbe3c1b(0x1bb)](_0x17c61d){const _0x5376db=_0xbe3c1b;return this.#t(),this.#o(_0x5376db(0x1bb),{'sourceId':_0x17c61d});}async[_0xbe3c1b(0x1dc)](_0x2a3410){const _0x340a87=_0xbe3c1b;return this.#t(),this.#o(_0x340a87(0x1dc),{'sourceId':_0x2a3410});}async #o(_0x218ca9,_0x1fd352){const _0x581d53=_0xbe3c1b;if(this.#s===null)throw new Error(_0x581d53(0x250));return j(this.#r,this.#s,_0x218ca9,_0x1fd352);}async['getDocs'](_0xe0968f,_0x4dc852){const _0x29deca=_0xbe3c1b;return this.#t(),this.#e[_0x29deca(0x25a)](_0xe0968f,_0x4dc852);}async[_0xbe3c1b(0x18e)](_0x2210ff,_0x90753e){return this.#t(),this.#e['loadIndex'](_0x2210ff,_0x90753e);}async[_0xbe3c1b(0x1fd)](_0x99c949,_0x143859){const _0xe6eee3=_0xbe3c1b;return this.#t(),this.#e[_0xe6eee3(0x1fd)](_0x99c949,_0x143859);}async['unloadIndex'](_0x45c777){const _0x181c2e=_0xbe3c1b;return this.#t(),this.#e[_0x181c2e(0x256)](_0x45c777);}async[_0xbe3c1b(0x1ba)](_0xcdb25a){return this.#t(),this.#e['unloadIndexes'](_0xcdb25a);}async[_0xbe3c1b(0x236)](_0x2d4b89,_0x555576,_0x5d757f){const _0x1415cb=_0xbe3c1b;return this.#t(),this.#e[_0x1415cb(0x236)](_0x2d4b89,_0x555576,_0x5d757f);}async['queryMultiIndex'](_0x4ff9e9,_0x1a9cc5,_0x563506){const _0x1e3501=_0xbe3c1b;return this.#t(),this.#e[_0x1e3501(0x222)](_0x4ff9e9,_0x1a9cc5,_0x563506);}async['session'](_0x2da034,_0x4fb6a5=F,_0x3d591d){const _0x574687=_0xbe3c1b;this.#t();let _0x2b8ad8=this.#e[_0x574687(0x249)],_0x4d26d1;if(this.#s!==null)_0x4d26d1=await h[_0x574687(0x248)](_0x2da034,_0x4fb6a5,this.#r,this.#s,void 0x0,_0x2b8ad8,_0x3d591d);else{let _0x289311=await this.#e[_0x574687(0x245)](_0x2da034,_0x4fb6a5,_0x3d591d);_0x4d26d1=h[_0x574687(0x19d)](_0x2da034,_0x4fb6a5,_0x289311,_0x2b8ad8);}await _0x4d26d1[_0x574687(0x1e5)]();for(let _0x2a58a6 of this.#n)_0x2a58a6[_0x574687(0x210)]()||this.#n[_0x574687(0x1fe)](_0x2a58a6);return this.#n[_0x574687(0x1c0)](new WeakRef(_0x4d26d1)),_0x4d26d1;}#t(){const _0x2806c4=_0xbe3c1b;if(this.#i)throw new Error(_0x2806c4(0x1e1));}['close'](){return this.#a??=this.#u(),this.#a;}async #u(){const _0x53fb29=_0xbe3c1b;this.#i=!0x0;let _0x5abdaa=[...this.#n][_0x53fb29(0x1c8)](_0x2a2d03=>_0x2a2d03[_0x53fb29(0x210)]())[_0x53fb29(0x1ef)](_0x4221cd=>_0x4221cd!==void 0x0);this.#n['clear'](),await Promise['all'](_0x5abdaa[_0x53fb29(0x1c8)](_0x1b341=>_0x1b341[_0x53fb29(0x21f)]())),await this.#e[_0x53fb29(0x21f)]();}async[Symbol['asyncDispose']](){const _0x2e0481=_0xbe3c1b;return this[_0x2e0481(0x21f)]();}};function _0x77d9(){const _0x49ab17=['Failed','normalizeJobStatus','3793427eWNywA','_warmModel','SDK_VERSION_NUMBER','cachePath','status','getWebSource','Bearer\x20','respectRobots','isSafeInteger','test','MossClient\x20options.identity.','filter','manifestSha256','createIndexFromFiles\x20requires\x20at\x20least\x20one\x20file','text','asyncDispose','CLOUD_API_INDEX_URL','number','deleteDocs\x20requires\x20at\x20least\x20one\x20document\x20ID','PendingUpload','addDocumentsText','message','contentType','now','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20MossClient.close()','loadIndexes','delete','cache','\x20contains\x20an\x20unsupported\x20character','env','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20SessionIndex.close()','authNotifyFn','moss-minilm','includes','hasIndex','loadQueryModel','getAuthHeader','projectKey','authenticator','object','withAuthenticator','30eEETLK','call','added','deref','body','some','createWebSource','CLOUD_API_AUTH_URL','parseDocuments','23832BcyvmZ','trim','version','indexName','jobId','36rIubtc','alpha','projectId','1856AUNMmY','close','excludePaths','from','queryMultiIndex','MOSS_CLOUD_API_BASE_URL','MOSS_INDEX_URL','wrapProgress','860343iozovX','Uploading','saveToDisk','applyIdentity','IndexManager','expiresAt','CLOUD_API_IDENTITY_URL','HTTP\x20error!\x20status:\x20','maxDepth','SessionIndex','createIndex','received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20jobId\x20(','arrayBuffer','indexManager','rejectAuthRequest','replace','query','requireMultiIndexCore','toLowerCase','fetchAndCache','Unsupported\x20data\x20type\x20for\x20file\x20upload','warn','2YybPlo','expiresIn','Completed','onProgress','getDocuments','string','topK','authUrl','progress','createAuthenticatedSessionInner','deviceId','maxPages','_create','applySessionIdentity','getJobStatus','refreshCadence','ensureCachePathDeviceId','path','8aHeEnT','deleteDocs','Web\x20source\x20methods\x20require\x20a\x20project\x20key.\x20Construct\x20MossClient\x20with\x20(projectId,\x20projectKey).','stringify','deleteIndex','ManageClient','updated','MODEL_DOWNLOAD_URL','unloadIndex','createIndexFromFiles','\x22)\x20or\x20loadIndexes([...])\x20before\x20querying;\x20queries\x20run\x20locally\x20and\x20there\x20is\x20no\x20cloud\x20query\x20fallback.','startsWith','getDocs','docCount','\x20could\x20not\x20be\x20settled:\x20','timeout','configuredIdentity','moss-core\x20runtime\x20SessionIndex\x20is\x20missing\x20the\x20withAuthenticator\x20factory.\x20Upgrade\x20@moss-js/moss-core\x20to\x20a\x20build\x20that\x20supports\x20custom\x20authenticators\x20for\x20sessions.','failed','manageClient','One\x20or\x20more\x20indexes\x20use\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20vector\x20via\x20options.embedding,\x20or\x20use\x20alpha\x200\x20for\x20keyword-only\x20search.','pendingupload','inflight','https://service.usemoss.dev','received\x20an\x20array\x20where\x20a\x20JobProgress\x20object\x20was\x20expected','entries','loadIndex','The\x20installed\x20@moss-js/moss-core\x20runtime\x20does\x20not\x20support\x20exact\x20model\x20artifact\x20identities.\x20Upgrade\x20moss-core\x20before\x20creating\x20this\x20session.','completed','[moss]\x20Dropping\x20a\x20malformed\x20job\x20progress\x20event;\x20progress\x20reporting\x20may\x20be\x20incomplete\x20for\x20this\x20operation.\x20Cause:\x20','name','userId','addDocuments','moss-core\x20runtime\x20is\x20missing\x20resolveAuthRequest/rejectAuthRequest\x20exports.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','data','listIndexes','\x20must\x20not\x20have\x20leading\x20or\x20trailing\x20whitespace','MOSS_AUTH_URL','isArray','loadFromDisk','modelArtifactContractVersion','_fromInner','error','queryMultiIndexText','cachePathDeviceId','modelId','join','The\x20installed\x20@moss-js/moss-core\x20does\x20not\x20support\x20multi-index\x20operations\x20(queryMultiIndex,\x20loadIndexes,\x20unloadIndexes).\x20Upgrade\x20@moss-js/moss-core.','moss-core\x20runtime\x20is\x20missing\x20ManageClient/IndexManager\x20exports','inspectSnapshot','freeze','SessionIndex\x20\x27','byteLength','loadModel','fromEntries','[moss]\x20Auth\x20request\x20','resolveAuthRequest','deviceIdentity','listWebSources','getAuthToken','application/json','encode','maxDocuments','utf8','uploading','resync','.\x20All\x20documents\x20must\x20have\x20.embedding\x20set\x20when\x20using\x20modelId=\x27custom\x27.','slice','\x27\x20returned\x20by\x20moss-core','.moss-device-id','unloadIndexes','resyncWebSource','queryText','pushIndex','Building','POST','add','rebuildLegacy','inner','all','received\x20','ManageApiError','26826muqPxs','addDocs','map','includePaths','55LAxQKl','length','setIdentity','embedding','bind','\x20UTF-8\x20bytes','sources','1134929GWbtvB','\x20Provide\x20a\x20query\x20vector\x20via\x20options.embedding,\x20or\x20use\x20alpha\x200\x20for\x20keyword-only\x20search.','/v1/manage','parseOptions','received\x20a\x20progress\x20event\x20with\x20a\x20non-finite\x20progress\x20value\x20(','getIndex','4925284ZFuioG','Documents\x20missing\x20.embedding\x20for\x20custom\x20model:\x20','default','function','currentPhase','deleteWebSource','custom','3196053adwZtG','updateWebSource','json','MossClient\x20is\x20closed'];_0x77d9=function(){return _0x49ab17;};return _0x77d9();}export{b as ManageApiError,A as MossClient,h as SessionIndex};
|
package/dist/moss.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { IndexInfo } from '@moss-js/moss-core';
|
|
|
6
6
|
import { JobPhase } from '@moss-js/moss-core';
|
|
7
7
|
import { JobStatus } from '@moss-js/moss-core';
|
|
8
8
|
import { JobStatusResponse } from '@moss-js/moss-core';
|
|
9
|
+
import { LoadFromDiskOptions } from '@moss-js/moss-core';
|
|
9
10
|
import { LoadSessionOptions } from '@moss-js/moss-core';
|
|
10
11
|
import { MutationResult } from '@moss-js/moss-core';
|
|
11
12
|
import { PushIndexResult } from '@moss-js/moss-core';
|
|
@@ -14,6 +15,7 @@ import { QueryResultDocumentInfo } from '@moss-js/moss-core';
|
|
|
14
15
|
import { RefreshResult } from '@moss-js/moss-core';
|
|
15
16
|
import { SearchResult } from '@moss-js/moss-core';
|
|
16
17
|
import { SessionIndex as SessionIndex_2 } from '@moss-js/moss-core';
|
|
18
|
+
import { SnapshotInfo } from '@moss-js/moss-core';
|
|
17
19
|
|
|
18
20
|
export declare interface AuthToken {
|
|
19
21
|
token: string;
|
|
@@ -115,6 +117,8 @@ export { JobStatus }
|
|
|
115
117
|
|
|
116
118
|
export { JobStatusResponse }
|
|
117
119
|
|
|
120
|
+
export { LoadFromDiskOptions }
|
|
121
|
+
|
|
118
122
|
/**
|
|
119
123
|
* Outcome of a best-effort bulk `loadIndexes` call.
|
|
120
124
|
*/
|
|
@@ -745,8 +749,9 @@ export { SearchResult }
|
|
|
745
749
|
* A local in-session index for real-time indexing and querying.
|
|
746
750
|
*
|
|
747
751
|
* All operations (`addDocs`, `deleteDocs`, `query`) run entirely in
|
|
748
|
-
* process memory with no cloud round-trip
|
|
749
|
-
*
|
|
752
|
+
* process memory with no cloud round-trip, on a native worker thread so
|
|
753
|
+
* the Node event loop stays responsive. Call `pushIndex()` at the end of
|
|
754
|
+
* a session to persist the result to the cloud.
|
|
750
755
|
*
|
|
751
756
|
* @example
|
|
752
757
|
* ```typescript
|
|
@@ -781,7 +786,12 @@ export declare class SessionIndex {
|
|
|
781
786
|
static _fromInner(name: string, modelId: MossModel, inner: SessionIndex_2, applyIdentity?: (target: IdentityTarget) => void): SessionIndex;
|
|
782
787
|
/** The session index name. Identifies the cloud index on `pushIndex` / `loadIndex`. */
|
|
783
788
|
get name(): string;
|
|
784
|
-
/**
|
|
789
|
+
/**
|
|
790
|
+
* Number of documents currently in the local session. Synchronous and
|
|
791
|
+
* never waits: it reports the count as of the last completed operation.
|
|
792
|
+
* A staged auto-refresh version is applied on a worker thread and shows
|
|
793
|
+
* up on a later read.
|
|
794
|
+
*/
|
|
785
795
|
get docCount(): number;
|
|
786
796
|
/** The embedding model this session is configured for. */
|
|
787
797
|
get modelId(): MossModel;
|
|
@@ -789,8 +799,9 @@ export declare class SessionIndex {
|
|
|
789
799
|
* Add or update documents in the local session index.
|
|
790
800
|
*
|
|
791
801
|
* For models other than `"custom"`, embeddings are generated locally
|
|
792
|
-
* via the Rust core
|
|
793
|
-
*
|
|
802
|
+
* via the Rust core on a native worker thread, with no cloud round-trip
|
|
803
|
+
* and no main-thread stall while a large batch is embedded. For
|
|
804
|
+
* `modelId="custom"`, each document **must** carry an `.embedding` field.
|
|
794
805
|
*
|
|
795
806
|
* @returns `{ added, updated }` counts.
|
|
796
807
|
*/
|
|
@@ -808,7 +819,7 @@ export declare class SessionIndex {
|
|
|
808
819
|
*
|
|
809
820
|
* For `modelId="custom"`, an explicit `options.embedding` is required.
|
|
810
821
|
* For built-in models the query is embedded locally by the Rust core
|
|
811
|
-
* if `options.embedding` is omitted.
|
|
822
|
+
* on a native worker thread if `options.embedding` is omitted.
|
|
812
823
|
*/
|
|
813
824
|
query(query: string, options?: QueryOptions): Promise<SearchResult>;
|
|
814
825
|
/**
|
|
@@ -833,9 +844,32 @@ export declare class SessionIndex {
|
|
|
833
844
|
saveToDisk(cachePath: string): Promise<void>;
|
|
834
845
|
/**
|
|
835
846
|
* Restore a session previously written by `saveToDisk`.
|
|
847
|
+
*
|
|
848
|
+
* A snapshot saved by an SDK older than 1.8 for a built-in model carries
|
|
849
|
+
* no model artifact provenance, so the core can only restore it as a
|
|
850
|
+
* custom-model session. This method asks the core to rebuild such a
|
|
851
|
+
* snapshot instead, which it does only for a session opened with the same
|
|
852
|
+
* built-in model: the stored documents are re-embedded with the current
|
|
853
|
+
* model (one-time cost, needs the cloud for the model) and the upgraded
|
|
854
|
+
* snapshot is saved back, all in one operation, so it happens once per
|
|
855
|
+
* device. Custom-model sessions and a snapshot of a different model load
|
|
856
|
+
* as before. Pass `{ rebuildLegacy: false }` to opt out.
|
|
857
|
+
*
|
|
858
|
+
* When the rebuild cannot load the model (offline, delivery down) the
|
|
859
|
+
* call rejects with a message starting "Legacy snapshot rebuild needs the
|
|
860
|
+
* embedding model" and changes nothing: the snapshot is intact and the
|
|
861
|
+
* session is as it was. Retry later; do not treat it as a corrupt cache.
|
|
836
862
|
* @returns Number of documents loaded.
|
|
837
863
|
*/
|
|
838
|
-
loadFromDisk(cachePath: string): Promise<number>;
|
|
864
|
+
loadFromDisk(cachePath: string, options?: LoadFromDiskOptions): Promise<number>;
|
|
865
|
+
/**
|
|
866
|
+
* Describe the snapshot under `<cachePath>/<name>/` without loading it:
|
|
867
|
+
* the model it was saved with, whether it carries model artifact
|
|
868
|
+
* provenance, and its size. `modelId` is a built-in model with
|
|
869
|
+
* `hasModelArtifact: false` for snapshots saved before 1.8, which
|
|
870
|
+
* `loadFromDisk` rebuilds by default.
|
|
871
|
+
*/
|
|
872
|
+
inspectSnapshot(cachePath: string): Promise<SnapshotInfo>;
|
|
839
873
|
/**
|
|
840
874
|
* Release the session's native resources deterministically: the
|
|
841
875
|
* auto-refresh poller, the in-memory index, and this session's
|
|
@@ -850,11 +884,14 @@ export declare class SessionIndex {
|
|
|
850
884
|
/**
|
|
851
885
|
* @internal Pre-loads the bundled embedding model for built-in
|
|
852
886
|
* `modelId`s; no-op for `"custom"`. Called by `MossClient.session()`
|
|
853
|
-
* so the first `addDocs` / `query` doesn't pay cold-start latency.
|
|
887
|
+
* so the first `addDocs` / `query` doesn't pay cold-start latency. The
|
|
888
|
+
* download and runtime initialization run on a native worker thread.
|
|
854
889
|
*/
|
|
855
890
|
_warmModel(): Promise<void>;
|
|
856
891
|
}
|
|
857
892
|
|
|
893
|
+
export { SnapshotInfo }
|
|
894
|
+
|
|
858
895
|
export declare interface UpdateWebSourceOptions {
|
|
859
896
|
refreshCadence?: WebSourceRefreshCadence;
|
|
860
897
|
rootUrl?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moss-js/moss",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.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.29.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@eslint/js": "^9.39.4",
|