@kevisual/ai 0.0.4 → 0.0.6
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/ai-provider-browser.d.ts +434 -0
- package/dist/ai-provider-browser.js +24652 -0
- package/dist/ai-provider.d.ts +208 -4
- package/dist/ai-provider.js +1496 -89
- package/package.json +13 -3
package/dist/ai-provider.js
CHANGED
|
@@ -6263,7 +6263,1224 @@ var init_fileFromPath = __esm(() => {
|
|
|
6263
6263
|
};
|
|
6264
6264
|
});
|
|
6265
6265
|
|
|
6266
|
-
// ../../node_modules/.pnpm/
|
|
6266
|
+
// ../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/core.js
|
|
6267
|
+
var require_core = __commonJS((exports, module) => {
|
|
6268
|
+
(function(root, factory) {
|
|
6269
|
+
if (typeof exports === "object") {
|
|
6270
|
+
module.exports = exports = factory();
|
|
6271
|
+
} else if (typeof define === "function" && define.amd) {
|
|
6272
|
+
define([], factory);
|
|
6273
|
+
} else {
|
|
6274
|
+
root.CryptoJS = factory();
|
|
6275
|
+
}
|
|
6276
|
+
})(exports, function() {
|
|
6277
|
+
var CryptoJS = CryptoJS || function(Math2, undefined2) {
|
|
6278
|
+
var crypto;
|
|
6279
|
+
if (typeof window !== "undefined" && window.crypto) {
|
|
6280
|
+
crypto = window.crypto;
|
|
6281
|
+
}
|
|
6282
|
+
if (typeof self !== "undefined" && self.crypto) {
|
|
6283
|
+
crypto = self.crypto;
|
|
6284
|
+
}
|
|
6285
|
+
if (typeof globalThis !== "undefined" && globalThis.crypto) {
|
|
6286
|
+
crypto = globalThis.crypto;
|
|
6287
|
+
}
|
|
6288
|
+
if (!crypto && typeof window !== "undefined" && window.msCrypto) {
|
|
6289
|
+
crypto = window.msCrypto;
|
|
6290
|
+
}
|
|
6291
|
+
if (!crypto && typeof global !== "undefined" && global.crypto) {
|
|
6292
|
+
crypto = global.crypto;
|
|
6293
|
+
}
|
|
6294
|
+
if (!crypto && true) {
|
|
6295
|
+
try {
|
|
6296
|
+
crypto = __require("crypto");
|
|
6297
|
+
} catch (err) {}
|
|
6298
|
+
}
|
|
6299
|
+
var cryptoSecureRandomInt = function() {
|
|
6300
|
+
if (crypto) {
|
|
6301
|
+
if (typeof crypto.getRandomValues === "function") {
|
|
6302
|
+
try {
|
|
6303
|
+
return crypto.getRandomValues(new Uint32Array(1))[0];
|
|
6304
|
+
} catch (err) {}
|
|
6305
|
+
}
|
|
6306
|
+
if (typeof crypto.randomBytes === "function") {
|
|
6307
|
+
try {
|
|
6308
|
+
return crypto.randomBytes(4).readInt32LE();
|
|
6309
|
+
} catch (err) {}
|
|
6310
|
+
}
|
|
6311
|
+
}
|
|
6312
|
+
throw new Error("Native crypto module could not be used to get secure random number.");
|
|
6313
|
+
};
|
|
6314
|
+
var create = Object.create || function() {
|
|
6315
|
+
function F2() {}
|
|
6316
|
+
return function(obj) {
|
|
6317
|
+
var subtype;
|
|
6318
|
+
F2.prototype = obj;
|
|
6319
|
+
subtype = new F2;
|
|
6320
|
+
F2.prototype = null;
|
|
6321
|
+
return subtype;
|
|
6322
|
+
};
|
|
6323
|
+
}();
|
|
6324
|
+
var C2 = {};
|
|
6325
|
+
var C_lib = C2.lib = {};
|
|
6326
|
+
var Base = C_lib.Base = function() {
|
|
6327
|
+
return {
|
|
6328
|
+
extend: function(overrides) {
|
|
6329
|
+
var subtype = create(this);
|
|
6330
|
+
if (overrides) {
|
|
6331
|
+
subtype.mixIn(overrides);
|
|
6332
|
+
}
|
|
6333
|
+
if (!subtype.hasOwnProperty("init") || this.init === subtype.init) {
|
|
6334
|
+
subtype.init = function() {
|
|
6335
|
+
subtype.$super.init.apply(this, arguments);
|
|
6336
|
+
};
|
|
6337
|
+
}
|
|
6338
|
+
subtype.init.prototype = subtype;
|
|
6339
|
+
subtype.$super = this;
|
|
6340
|
+
return subtype;
|
|
6341
|
+
},
|
|
6342
|
+
create: function() {
|
|
6343
|
+
var instance = this.extend();
|
|
6344
|
+
instance.init.apply(instance, arguments);
|
|
6345
|
+
return instance;
|
|
6346
|
+
},
|
|
6347
|
+
init: function() {},
|
|
6348
|
+
mixIn: function(properties) {
|
|
6349
|
+
for (var propertyName in properties) {
|
|
6350
|
+
if (properties.hasOwnProperty(propertyName)) {
|
|
6351
|
+
this[propertyName] = properties[propertyName];
|
|
6352
|
+
}
|
|
6353
|
+
}
|
|
6354
|
+
if (properties.hasOwnProperty("toString")) {
|
|
6355
|
+
this.toString = properties.toString;
|
|
6356
|
+
}
|
|
6357
|
+
},
|
|
6358
|
+
clone: function() {
|
|
6359
|
+
return this.init.prototype.extend(this);
|
|
6360
|
+
}
|
|
6361
|
+
};
|
|
6362
|
+
}();
|
|
6363
|
+
var WordArray = C_lib.WordArray = Base.extend({
|
|
6364
|
+
init: function(words, sigBytes) {
|
|
6365
|
+
words = this.words = words || [];
|
|
6366
|
+
if (sigBytes != undefined2) {
|
|
6367
|
+
this.sigBytes = sigBytes;
|
|
6368
|
+
} else {
|
|
6369
|
+
this.sigBytes = words.length * 4;
|
|
6370
|
+
}
|
|
6371
|
+
},
|
|
6372
|
+
toString: function(encoder) {
|
|
6373
|
+
return (encoder || Hex).stringify(this);
|
|
6374
|
+
},
|
|
6375
|
+
concat: function(wordArray) {
|
|
6376
|
+
var thisWords = this.words;
|
|
6377
|
+
var thatWords = wordArray.words;
|
|
6378
|
+
var thisSigBytes = this.sigBytes;
|
|
6379
|
+
var thatSigBytes = wordArray.sigBytes;
|
|
6380
|
+
this.clamp();
|
|
6381
|
+
if (thisSigBytes % 4) {
|
|
6382
|
+
for (var i2 = 0;i2 < thatSigBytes; i2++) {
|
|
6383
|
+
var thatByte = thatWords[i2 >>> 2] >>> 24 - i2 % 4 * 8 & 255;
|
|
6384
|
+
thisWords[thisSigBytes + i2 >>> 2] |= thatByte << 24 - (thisSigBytes + i2) % 4 * 8;
|
|
6385
|
+
}
|
|
6386
|
+
} else {
|
|
6387
|
+
for (var j2 = 0;j2 < thatSigBytes; j2 += 4) {
|
|
6388
|
+
thisWords[thisSigBytes + j2 >>> 2] = thatWords[j2 >>> 2];
|
|
6389
|
+
}
|
|
6390
|
+
}
|
|
6391
|
+
this.sigBytes += thatSigBytes;
|
|
6392
|
+
return this;
|
|
6393
|
+
},
|
|
6394
|
+
clamp: function() {
|
|
6395
|
+
var words = this.words;
|
|
6396
|
+
var sigBytes = this.sigBytes;
|
|
6397
|
+
words[sigBytes >>> 2] &= 4294967295 << 32 - sigBytes % 4 * 8;
|
|
6398
|
+
words.length = Math2.ceil(sigBytes / 4);
|
|
6399
|
+
},
|
|
6400
|
+
clone: function() {
|
|
6401
|
+
var clone = Base.clone.call(this);
|
|
6402
|
+
clone.words = this.words.slice(0);
|
|
6403
|
+
return clone;
|
|
6404
|
+
},
|
|
6405
|
+
random: function(nBytes) {
|
|
6406
|
+
var words = [];
|
|
6407
|
+
for (var i2 = 0;i2 < nBytes; i2 += 4) {
|
|
6408
|
+
words.push(cryptoSecureRandomInt());
|
|
6409
|
+
}
|
|
6410
|
+
return new WordArray.init(words, nBytes);
|
|
6411
|
+
}
|
|
6412
|
+
});
|
|
6413
|
+
var C_enc = C2.enc = {};
|
|
6414
|
+
var Hex = C_enc.Hex = {
|
|
6415
|
+
stringify: function(wordArray) {
|
|
6416
|
+
var words = wordArray.words;
|
|
6417
|
+
var sigBytes = wordArray.sigBytes;
|
|
6418
|
+
var hexChars = [];
|
|
6419
|
+
for (var i2 = 0;i2 < sigBytes; i2++) {
|
|
6420
|
+
var bite = words[i2 >>> 2] >>> 24 - i2 % 4 * 8 & 255;
|
|
6421
|
+
hexChars.push((bite >>> 4).toString(16));
|
|
6422
|
+
hexChars.push((bite & 15).toString(16));
|
|
6423
|
+
}
|
|
6424
|
+
return hexChars.join("");
|
|
6425
|
+
},
|
|
6426
|
+
parse: function(hexStr) {
|
|
6427
|
+
var hexStrLength = hexStr.length;
|
|
6428
|
+
var words = [];
|
|
6429
|
+
for (var i2 = 0;i2 < hexStrLength; i2 += 2) {
|
|
6430
|
+
words[i2 >>> 3] |= parseInt(hexStr.substr(i2, 2), 16) << 24 - i2 % 8 * 4;
|
|
6431
|
+
}
|
|
6432
|
+
return new WordArray.init(words, hexStrLength / 2);
|
|
6433
|
+
}
|
|
6434
|
+
};
|
|
6435
|
+
var Latin1 = C_enc.Latin1 = {
|
|
6436
|
+
stringify: function(wordArray) {
|
|
6437
|
+
var words = wordArray.words;
|
|
6438
|
+
var sigBytes = wordArray.sigBytes;
|
|
6439
|
+
var latin1Chars = [];
|
|
6440
|
+
for (var i2 = 0;i2 < sigBytes; i2++) {
|
|
6441
|
+
var bite = words[i2 >>> 2] >>> 24 - i2 % 4 * 8 & 255;
|
|
6442
|
+
latin1Chars.push(String.fromCharCode(bite));
|
|
6443
|
+
}
|
|
6444
|
+
return latin1Chars.join("");
|
|
6445
|
+
},
|
|
6446
|
+
parse: function(latin1Str) {
|
|
6447
|
+
var latin1StrLength = latin1Str.length;
|
|
6448
|
+
var words = [];
|
|
6449
|
+
for (var i2 = 0;i2 < latin1StrLength; i2++) {
|
|
6450
|
+
words[i2 >>> 2] |= (latin1Str.charCodeAt(i2) & 255) << 24 - i2 % 4 * 8;
|
|
6451
|
+
}
|
|
6452
|
+
return new WordArray.init(words, latin1StrLength);
|
|
6453
|
+
}
|
|
6454
|
+
};
|
|
6455
|
+
var Utf8 = C_enc.Utf8 = {
|
|
6456
|
+
stringify: function(wordArray) {
|
|
6457
|
+
try {
|
|
6458
|
+
return decodeURIComponent(escape(Latin1.stringify(wordArray)));
|
|
6459
|
+
} catch (e2) {
|
|
6460
|
+
throw new Error("Malformed UTF-8 data");
|
|
6461
|
+
}
|
|
6462
|
+
},
|
|
6463
|
+
parse: function(utf8Str) {
|
|
6464
|
+
return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
|
|
6465
|
+
}
|
|
6466
|
+
};
|
|
6467
|
+
var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
|
|
6468
|
+
reset: function() {
|
|
6469
|
+
this._data = new WordArray.init;
|
|
6470
|
+
this._nDataBytes = 0;
|
|
6471
|
+
},
|
|
6472
|
+
_append: function(data) {
|
|
6473
|
+
if (typeof data == "string") {
|
|
6474
|
+
data = Utf8.parse(data);
|
|
6475
|
+
}
|
|
6476
|
+
this._data.concat(data);
|
|
6477
|
+
this._nDataBytes += data.sigBytes;
|
|
6478
|
+
},
|
|
6479
|
+
_process: function(doFlush) {
|
|
6480
|
+
var processedWords;
|
|
6481
|
+
var data = this._data;
|
|
6482
|
+
var dataWords = data.words;
|
|
6483
|
+
var dataSigBytes = data.sigBytes;
|
|
6484
|
+
var blockSize = this.blockSize;
|
|
6485
|
+
var blockSizeBytes = blockSize * 4;
|
|
6486
|
+
var nBlocksReady = dataSigBytes / blockSizeBytes;
|
|
6487
|
+
if (doFlush) {
|
|
6488
|
+
nBlocksReady = Math2.ceil(nBlocksReady);
|
|
6489
|
+
} else {
|
|
6490
|
+
nBlocksReady = Math2.max((nBlocksReady | 0) - this._minBufferSize, 0);
|
|
6491
|
+
}
|
|
6492
|
+
var nWordsReady = nBlocksReady * blockSize;
|
|
6493
|
+
var nBytesReady = Math2.min(nWordsReady * 4, dataSigBytes);
|
|
6494
|
+
if (nWordsReady) {
|
|
6495
|
+
for (var offset = 0;offset < nWordsReady; offset += blockSize) {
|
|
6496
|
+
this._doProcessBlock(dataWords, offset);
|
|
6497
|
+
}
|
|
6498
|
+
processedWords = dataWords.splice(0, nWordsReady);
|
|
6499
|
+
data.sigBytes -= nBytesReady;
|
|
6500
|
+
}
|
|
6501
|
+
return new WordArray.init(processedWords, nBytesReady);
|
|
6502
|
+
},
|
|
6503
|
+
clone: function() {
|
|
6504
|
+
var clone = Base.clone.call(this);
|
|
6505
|
+
clone._data = this._data.clone();
|
|
6506
|
+
return clone;
|
|
6507
|
+
},
|
|
6508
|
+
_minBufferSize: 0
|
|
6509
|
+
});
|
|
6510
|
+
var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
|
|
6511
|
+
cfg: Base.extend(),
|
|
6512
|
+
init: function(cfg) {
|
|
6513
|
+
this.cfg = this.cfg.extend(cfg);
|
|
6514
|
+
this.reset();
|
|
6515
|
+
},
|
|
6516
|
+
reset: function() {
|
|
6517
|
+
BufferedBlockAlgorithm.reset.call(this);
|
|
6518
|
+
this._doReset();
|
|
6519
|
+
},
|
|
6520
|
+
update: function(messageUpdate) {
|
|
6521
|
+
this._append(messageUpdate);
|
|
6522
|
+
this._process();
|
|
6523
|
+
return this;
|
|
6524
|
+
},
|
|
6525
|
+
finalize: function(messageUpdate) {
|
|
6526
|
+
if (messageUpdate) {
|
|
6527
|
+
this._append(messageUpdate);
|
|
6528
|
+
}
|
|
6529
|
+
var hash = this._doFinalize();
|
|
6530
|
+
return hash;
|
|
6531
|
+
},
|
|
6532
|
+
blockSize: 512 / 32,
|
|
6533
|
+
_createHelper: function(hasher) {
|
|
6534
|
+
return function(message, cfg) {
|
|
6535
|
+
return new hasher.init(cfg).finalize(message);
|
|
6536
|
+
};
|
|
6537
|
+
},
|
|
6538
|
+
_createHmacHelper: function(hasher) {
|
|
6539
|
+
return function(message, key) {
|
|
6540
|
+
return new C_algo.HMAC.init(hasher, key).finalize(message);
|
|
6541
|
+
};
|
|
6542
|
+
}
|
|
6543
|
+
});
|
|
6544
|
+
var C_algo = C2.algo = {};
|
|
6545
|
+
return C2;
|
|
6546
|
+
}(Math);
|
|
6547
|
+
return CryptoJS;
|
|
6548
|
+
});
|
|
6549
|
+
});
|
|
6550
|
+
|
|
6551
|
+
// ../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64.js
|
|
6552
|
+
var require_enc_base64 = __commonJS((exports, module) => {
|
|
6553
|
+
(function(root, factory) {
|
|
6554
|
+
if (typeof exports === "object") {
|
|
6555
|
+
module.exports = exports = factory(require_core());
|
|
6556
|
+
} else if (typeof define === "function" && define.amd) {
|
|
6557
|
+
define(["./core"], factory);
|
|
6558
|
+
} else {
|
|
6559
|
+
factory(root.CryptoJS);
|
|
6560
|
+
}
|
|
6561
|
+
})(exports, function(CryptoJS) {
|
|
6562
|
+
(function() {
|
|
6563
|
+
var C2 = CryptoJS;
|
|
6564
|
+
var C_lib = C2.lib;
|
|
6565
|
+
var WordArray = C_lib.WordArray;
|
|
6566
|
+
var C_enc = C2.enc;
|
|
6567
|
+
var Base64 = C_enc.Base64 = {
|
|
6568
|
+
stringify: function(wordArray) {
|
|
6569
|
+
var words = wordArray.words;
|
|
6570
|
+
var sigBytes = wordArray.sigBytes;
|
|
6571
|
+
var map = this._map;
|
|
6572
|
+
wordArray.clamp();
|
|
6573
|
+
var base64Chars = [];
|
|
6574
|
+
for (var i2 = 0;i2 < sigBytes; i2 += 3) {
|
|
6575
|
+
var byte1 = words[i2 >>> 2] >>> 24 - i2 % 4 * 8 & 255;
|
|
6576
|
+
var byte2 = words[i2 + 1 >>> 2] >>> 24 - (i2 + 1) % 4 * 8 & 255;
|
|
6577
|
+
var byte3 = words[i2 + 2 >>> 2] >>> 24 - (i2 + 2) % 4 * 8 & 255;
|
|
6578
|
+
var triplet = byte1 << 16 | byte2 << 8 | byte3;
|
|
6579
|
+
for (var j2 = 0;j2 < 4 && i2 + j2 * 0.75 < sigBytes; j2++) {
|
|
6580
|
+
base64Chars.push(map.charAt(triplet >>> 6 * (3 - j2) & 63));
|
|
6581
|
+
}
|
|
6582
|
+
}
|
|
6583
|
+
var paddingChar = map.charAt(64);
|
|
6584
|
+
if (paddingChar) {
|
|
6585
|
+
while (base64Chars.length % 4) {
|
|
6586
|
+
base64Chars.push(paddingChar);
|
|
6587
|
+
}
|
|
6588
|
+
}
|
|
6589
|
+
return base64Chars.join("");
|
|
6590
|
+
},
|
|
6591
|
+
parse: function(base64Str) {
|
|
6592
|
+
var base64StrLength = base64Str.length;
|
|
6593
|
+
var map = this._map;
|
|
6594
|
+
var reverseMap = this._reverseMap;
|
|
6595
|
+
if (!reverseMap) {
|
|
6596
|
+
reverseMap = this._reverseMap = [];
|
|
6597
|
+
for (var j2 = 0;j2 < map.length; j2++) {
|
|
6598
|
+
reverseMap[map.charCodeAt(j2)] = j2;
|
|
6599
|
+
}
|
|
6600
|
+
}
|
|
6601
|
+
var paddingChar = map.charAt(64);
|
|
6602
|
+
if (paddingChar) {
|
|
6603
|
+
var paddingIndex = base64Str.indexOf(paddingChar);
|
|
6604
|
+
if (paddingIndex !== -1) {
|
|
6605
|
+
base64StrLength = paddingIndex;
|
|
6606
|
+
}
|
|
6607
|
+
}
|
|
6608
|
+
return parseLoop(base64Str, base64StrLength, reverseMap);
|
|
6609
|
+
},
|
|
6610
|
+
_map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
|
|
6611
|
+
};
|
|
6612
|
+
function parseLoop(base64Str, base64StrLength, reverseMap) {
|
|
6613
|
+
var words = [];
|
|
6614
|
+
var nBytes = 0;
|
|
6615
|
+
for (var i2 = 0;i2 < base64StrLength; i2++) {
|
|
6616
|
+
if (i2 % 4) {
|
|
6617
|
+
var bits1 = reverseMap[base64Str.charCodeAt(i2 - 1)] << i2 % 4 * 2;
|
|
6618
|
+
var bits2 = reverseMap[base64Str.charCodeAt(i2)] >>> 6 - i2 % 4 * 2;
|
|
6619
|
+
var bitsCombined = bits1 | bits2;
|
|
6620
|
+
words[nBytes >>> 2] |= bitsCombined << 24 - nBytes % 4 * 8;
|
|
6621
|
+
nBytes++;
|
|
6622
|
+
}
|
|
6623
|
+
}
|
|
6624
|
+
return WordArray.create(words, nBytes);
|
|
6625
|
+
}
|
|
6626
|
+
})();
|
|
6627
|
+
return CryptoJS.enc.Base64;
|
|
6628
|
+
});
|
|
6629
|
+
});
|
|
6630
|
+
|
|
6631
|
+
// ../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/md5.js
|
|
6632
|
+
var require_md5 = __commonJS((exports, module) => {
|
|
6633
|
+
(function(root, factory) {
|
|
6634
|
+
if (typeof exports === "object") {
|
|
6635
|
+
module.exports = exports = factory(require_core());
|
|
6636
|
+
} else if (typeof define === "function" && define.amd) {
|
|
6637
|
+
define(["./core"], factory);
|
|
6638
|
+
} else {
|
|
6639
|
+
factory(root.CryptoJS);
|
|
6640
|
+
}
|
|
6641
|
+
})(exports, function(CryptoJS) {
|
|
6642
|
+
(function(Math2) {
|
|
6643
|
+
var C2 = CryptoJS;
|
|
6644
|
+
var C_lib = C2.lib;
|
|
6645
|
+
var WordArray = C_lib.WordArray;
|
|
6646
|
+
var Hasher = C_lib.Hasher;
|
|
6647
|
+
var C_algo = C2.algo;
|
|
6648
|
+
var T2 = [];
|
|
6649
|
+
(function() {
|
|
6650
|
+
for (var i2 = 0;i2 < 64; i2++) {
|
|
6651
|
+
T2[i2] = Math2.abs(Math2.sin(i2 + 1)) * 4294967296 | 0;
|
|
6652
|
+
}
|
|
6653
|
+
})();
|
|
6654
|
+
var MD5 = C_algo.MD5 = Hasher.extend({
|
|
6655
|
+
_doReset: function() {
|
|
6656
|
+
this._hash = new WordArray.init([
|
|
6657
|
+
1732584193,
|
|
6658
|
+
4023233417,
|
|
6659
|
+
2562383102,
|
|
6660
|
+
271733878
|
|
6661
|
+
]);
|
|
6662
|
+
},
|
|
6663
|
+
_doProcessBlock: function(M2, offset) {
|
|
6664
|
+
for (var i2 = 0;i2 < 16; i2++) {
|
|
6665
|
+
var offset_i = offset + i2;
|
|
6666
|
+
var M_offset_i = M2[offset_i];
|
|
6667
|
+
M2[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 16711935 | (M_offset_i << 24 | M_offset_i >>> 8) & 4278255360;
|
|
6668
|
+
}
|
|
6669
|
+
var H2 = this._hash.words;
|
|
6670
|
+
var M_offset_0 = M2[offset + 0];
|
|
6671
|
+
var M_offset_1 = M2[offset + 1];
|
|
6672
|
+
var M_offset_2 = M2[offset + 2];
|
|
6673
|
+
var M_offset_3 = M2[offset + 3];
|
|
6674
|
+
var M_offset_4 = M2[offset + 4];
|
|
6675
|
+
var M_offset_5 = M2[offset + 5];
|
|
6676
|
+
var M_offset_6 = M2[offset + 6];
|
|
6677
|
+
var M_offset_7 = M2[offset + 7];
|
|
6678
|
+
var M_offset_8 = M2[offset + 8];
|
|
6679
|
+
var M_offset_9 = M2[offset + 9];
|
|
6680
|
+
var M_offset_10 = M2[offset + 10];
|
|
6681
|
+
var M_offset_11 = M2[offset + 11];
|
|
6682
|
+
var M_offset_12 = M2[offset + 12];
|
|
6683
|
+
var M_offset_13 = M2[offset + 13];
|
|
6684
|
+
var M_offset_14 = M2[offset + 14];
|
|
6685
|
+
var M_offset_15 = M2[offset + 15];
|
|
6686
|
+
var a2 = H2[0];
|
|
6687
|
+
var b2 = H2[1];
|
|
6688
|
+
var c2 = H2[2];
|
|
6689
|
+
var d2 = H2[3];
|
|
6690
|
+
a2 = FF(a2, b2, c2, d2, M_offset_0, 7, T2[0]);
|
|
6691
|
+
d2 = FF(d2, a2, b2, c2, M_offset_1, 12, T2[1]);
|
|
6692
|
+
c2 = FF(c2, d2, a2, b2, M_offset_2, 17, T2[2]);
|
|
6693
|
+
b2 = FF(b2, c2, d2, a2, M_offset_3, 22, T2[3]);
|
|
6694
|
+
a2 = FF(a2, b2, c2, d2, M_offset_4, 7, T2[4]);
|
|
6695
|
+
d2 = FF(d2, a2, b2, c2, M_offset_5, 12, T2[5]);
|
|
6696
|
+
c2 = FF(c2, d2, a2, b2, M_offset_6, 17, T2[6]);
|
|
6697
|
+
b2 = FF(b2, c2, d2, a2, M_offset_7, 22, T2[7]);
|
|
6698
|
+
a2 = FF(a2, b2, c2, d2, M_offset_8, 7, T2[8]);
|
|
6699
|
+
d2 = FF(d2, a2, b2, c2, M_offset_9, 12, T2[9]);
|
|
6700
|
+
c2 = FF(c2, d2, a2, b2, M_offset_10, 17, T2[10]);
|
|
6701
|
+
b2 = FF(b2, c2, d2, a2, M_offset_11, 22, T2[11]);
|
|
6702
|
+
a2 = FF(a2, b2, c2, d2, M_offset_12, 7, T2[12]);
|
|
6703
|
+
d2 = FF(d2, a2, b2, c2, M_offset_13, 12, T2[13]);
|
|
6704
|
+
c2 = FF(c2, d2, a2, b2, M_offset_14, 17, T2[14]);
|
|
6705
|
+
b2 = FF(b2, c2, d2, a2, M_offset_15, 22, T2[15]);
|
|
6706
|
+
a2 = GG(a2, b2, c2, d2, M_offset_1, 5, T2[16]);
|
|
6707
|
+
d2 = GG(d2, a2, b2, c2, M_offset_6, 9, T2[17]);
|
|
6708
|
+
c2 = GG(c2, d2, a2, b2, M_offset_11, 14, T2[18]);
|
|
6709
|
+
b2 = GG(b2, c2, d2, a2, M_offset_0, 20, T2[19]);
|
|
6710
|
+
a2 = GG(a2, b2, c2, d2, M_offset_5, 5, T2[20]);
|
|
6711
|
+
d2 = GG(d2, a2, b2, c2, M_offset_10, 9, T2[21]);
|
|
6712
|
+
c2 = GG(c2, d2, a2, b2, M_offset_15, 14, T2[22]);
|
|
6713
|
+
b2 = GG(b2, c2, d2, a2, M_offset_4, 20, T2[23]);
|
|
6714
|
+
a2 = GG(a2, b2, c2, d2, M_offset_9, 5, T2[24]);
|
|
6715
|
+
d2 = GG(d2, a2, b2, c2, M_offset_14, 9, T2[25]);
|
|
6716
|
+
c2 = GG(c2, d2, a2, b2, M_offset_3, 14, T2[26]);
|
|
6717
|
+
b2 = GG(b2, c2, d2, a2, M_offset_8, 20, T2[27]);
|
|
6718
|
+
a2 = GG(a2, b2, c2, d2, M_offset_13, 5, T2[28]);
|
|
6719
|
+
d2 = GG(d2, a2, b2, c2, M_offset_2, 9, T2[29]);
|
|
6720
|
+
c2 = GG(c2, d2, a2, b2, M_offset_7, 14, T2[30]);
|
|
6721
|
+
b2 = GG(b2, c2, d2, a2, M_offset_12, 20, T2[31]);
|
|
6722
|
+
a2 = HH(a2, b2, c2, d2, M_offset_5, 4, T2[32]);
|
|
6723
|
+
d2 = HH(d2, a2, b2, c2, M_offset_8, 11, T2[33]);
|
|
6724
|
+
c2 = HH(c2, d2, a2, b2, M_offset_11, 16, T2[34]);
|
|
6725
|
+
b2 = HH(b2, c2, d2, a2, M_offset_14, 23, T2[35]);
|
|
6726
|
+
a2 = HH(a2, b2, c2, d2, M_offset_1, 4, T2[36]);
|
|
6727
|
+
d2 = HH(d2, a2, b2, c2, M_offset_4, 11, T2[37]);
|
|
6728
|
+
c2 = HH(c2, d2, a2, b2, M_offset_7, 16, T2[38]);
|
|
6729
|
+
b2 = HH(b2, c2, d2, a2, M_offset_10, 23, T2[39]);
|
|
6730
|
+
a2 = HH(a2, b2, c2, d2, M_offset_13, 4, T2[40]);
|
|
6731
|
+
d2 = HH(d2, a2, b2, c2, M_offset_0, 11, T2[41]);
|
|
6732
|
+
c2 = HH(c2, d2, a2, b2, M_offset_3, 16, T2[42]);
|
|
6733
|
+
b2 = HH(b2, c2, d2, a2, M_offset_6, 23, T2[43]);
|
|
6734
|
+
a2 = HH(a2, b2, c2, d2, M_offset_9, 4, T2[44]);
|
|
6735
|
+
d2 = HH(d2, a2, b2, c2, M_offset_12, 11, T2[45]);
|
|
6736
|
+
c2 = HH(c2, d2, a2, b2, M_offset_15, 16, T2[46]);
|
|
6737
|
+
b2 = HH(b2, c2, d2, a2, M_offset_2, 23, T2[47]);
|
|
6738
|
+
a2 = II(a2, b2, c2, d2, M_offset_0, 6, T2[48]);
|
|
6739
|
+
d2 = II(d2, a2, b2, c2, M_offset_7, 10, T2[49]);
|
|
6740
|
+
c2 = II(c2, d2, a2, b2, M_offset_14, 15, T2[50]);
|
|
6741
|
+
b2 = II(b2, c2, d2, a2, M_offset_5, 21, T2[51]);
|
|
6742
|
+
a2 = II(a2, b2, c2, d2, M_offset_12, 6, T2[52]);
|
|
6743
|
+
d2 = II(d2, a2, b2, c2, M_offset_3, 10, T2[53]);
|
|
6744
|
+
c2 = II(c2, d2, a2, b2, M_offset_10, 15, T2[54]);
|
|
6745
|
+
b2 = II(b2, c2, d2, a2, M_offset_1, 21, T2[55]);
|
|
6746
|
+
a2 = II(a2, b2, c2, d2, M_offset_8, 6, T2[56]);
|
|
6747
|
+
d2 = II(d2, a2, b2, c2, M_offset_15, 10, T2[57]);
|
|
6748
|
+
c2 = II(c2, d2, a2, b2, M_offset_6, 15, T2[58]);
|
|
6749
|
+
b2 = II(b2, c2, d2, a2, M_offset_13, 21, T2[59]);
|
|
6750
|
+
a2 = II(a2, b2, c2, d2, M_offset_4, 6, T2[60]);
|
|
6751
|
+
d2 = II(d2, a2, b2, c2, M_offset_11, 10, T2[61]);
|
|
6752
|
+
c2 = II(c2, d2, a2, b2, M_offset_2, 15, T2[62]);
|
|
6753
|
+
b2 = II(b2, c2, d2, a2, M_offset_9, 21, T2[63]);
|
|
6754
|
+
H2[0] = H2[0] + a2 | 0;
|
|
6755
|
+
H2[1] = H2[1] + b2 | 0;
|
|
6756
|
+
H2[2] = H2[2] + c2 | 0;
|
|
6757
|
+
H2[3] = H2[3] + d2 | 0;
|
|
6758
|
+
},
|
|
6759
|
+
_doFinalize: function() {
|
|
6760
|
+
var data = this._data;
|
|
6761
|
+
var dataWords = data.words;
|
|
6762
|
+
var nBitsTotal = this._nDataBytes * 8;
|
|
6763
|
+
var nBitsLeft = data.sigBytes * 8;
|
|
6764
|
+
dataWords[nBitsLeft >>> 5] |= 128 << 24 - nBitsLeft % 32;
|
|
6765
|
+
var nBitsTotalH = Math2.floor(nBitsTotal / 4294967296);
|
|
6766
|
+
var nBitsTotalL = nBitsTotal;
|
|
6767
|
+
dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 16711935 | (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 4278255360;
|
|
6768
|
+
dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 16711935 | (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 4278255360;
|
|
6769
|
+
data.sigBytes = (dataWords.length + 1) * 4;
|
|
6770
|
+
this._process();
|
|
6771
|
+
var hash = this._hash;
|
|
6772
|
+
var H2 = hash.words;
|
|
6773
|
+
for (var i2 = 0;i2 < 4; i2++) {
|
|
6774
|
+
var H_i = H2[i2];
|
|
6775
|
+
H2[i2] = (H_i << 8 | H_i >>> 24) & 16711935 | (H_i << 24 | H_i >>> 8) & 4278255360;
|
|
6776
|
+
}
|
|
6777
|
+
return hash;
|
|
6778
|
+
},
|
|
6779
|
+
clone: function() {
|
|
6780
|
+
var clone = Hasher.clone.call(this);
|
|
6781
|
+
clone._hash = this._hash.clone();
|
|
6782
|
+
return clone;
|
|
6783
|
+
}
|
|
6784
|
+
});
|
|
6785
|
+
function FF(a2, b2, c2, d2, x2, s2, t2) {
|
|
6786
|
+
var n2 = a2 + (b2 & c2 | ~b2 & d2) + x2 + t2;
|
|
6787
|
+
return (n2 << s2 | n2 >>> 32 - s2) + b2;
|
|
6788
|
+
}
|
|
6789
|
+
function GG(a2, b2, c2, d2, x2, s2, t2) {
|
|
6790
|
+
var n2 = a2 + (b2 & d2 | c2 & ~d2) + x2 + t2;
|
|
6791
|
+
return (n2 << s2 | n2 >>> 32 - s2) + b2;
|
|
6792
|
+
}
|
|
6793
|
+
function HH(a2, b2, c2, d2, x2, s2, t2) {
|
|
6794
|
+
var n2 = a2 + (b2 ^ c2 ^ d2) + x2 + t2;
|
|
6795
|
+
return (n2 << s2 | n2 >>> 32 - s2) + b2;
|
|
6796
|
+
}
|
|
6797
|
+
function II(a2, b2, c2, d2, x2, s2, t2) {
|
|
6798
|
+
var n2 = a2 + (c2 ^ (b2 | ~d2)) + x2 + t2;
|
|
6799
|
+
return (n2 << s2 | n2 >>> 32 - s2) + b2;
|
|
6800
|
+
}
|
|
6801
|
+
C2.MD5 = Hasher._createHelper(MD5);
|
|
6802
|
+
C2.HmacMD5 = Hasher._createHmacHelper(MD5);
|
|
6803
|
+
})(Math);
|
|
6804
|
+
return CryptoJS.MD5;
|
|
6805
|
+
});
|
|
6806
|
+
});
|
|
6807
|
+
|
|
6808
|
+
// ../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha1.js
|
|
6809
|
+
var require_sha1 = __commonJS((exports, module) => {
|
|
6810
|
+
(function(root, factory) {
|
|
6811
|
+
if (typeof exports === "object") {
|
|
6812
|
+
module.exports = exports = factory(require_core());
|
|
6813
|
+
} else if (typeof define === "function" && define.amd) {
|
|
6814
|
+
define(["./core"], factory);
|
|
6815
|
+
} else {
|
|
6816
|
+
factory(root.CryptoJS);
|
|
6817
|
+
}
|
|
6818
|
+
})(exports, function(CryptoJS) {
|
|
6819
|
+
(function() {
|
|
6820
|
+
var C2 = CryptoJS;
|
|
6821
|
+
var C_lib = C2.lib;
|
|
6822
|
+
var WordArray = C_lib.WordArray;
|
|
6823
|
+
var Hasher = C_lib.Hasher;
|
|
6824
|
+
var C_algo = C2.algo;
|
|
6825
|
+
var W2 = [];
|
|
6826
|
+
var SHA1 = C_algo.SHA1 = Hasher.extend({
|
|
6827
|
+
_doReset: function() {
|
|
6828
|
+
this._hash = new WordArray.init([
|
|
6829
|
+
1732584193,
|
|
6830
|
+
4023233417,
|
|
6831
|
+
2562383102,
|
|
6832
|
+
271733878,
|
|
6833
|
+
3285377520
|
|
6834
|
+
]);
|
|
6835
|
+
},
|
|
6836
|
+
_doProcessBlock: function(M2, offset) {
|
|
6837
|
+
var H2 = this._hash.words;
|
|
6838
|
+
var a2 = H2[0];
|
|
6839
|
+
var b2 = H2[1];
|
|
6840
|
+
var c2 = H2[2];
|
|
6841
|
+
var d2 = H2[3];
|
|
6842
|
+
var e2 = H2[4];
|
|
6843
|
+
for (var i2 = 0;i2 < 80; i2++) {
|
|
6844
|
+
if (i2 < 16) {
|
|
6845
|
+
W2[i2] = M2[offset + i2] | 0;
|
|
6846
|
+
} else {
|
|
6847
|
+
var n2 = W2[i2 - 3] ^ W2[i2 - 8] ^ W2[i2 - 14] ^ W2[i2 - 16];
|
|
6848
|
+
W2[i2] = n2 << 1 | n2 >>> 31;
|
|
6849
|
+
}
|
|
6850
|
+
var t2 = (a2 << 5 | a2 >>> 27) + e2 + W2[i2];
|
|
6851
|
+
if (i2 < 20) {
|
|
6852
|
+
t2 += (b2 & c2 | ~b2 & d2) + 1518500249;
|
|
6853
|
+
} else if (i2 < 40) {
|
|
6854
|
+
t2 += (b2 ^ c2 ^ d2) + 1859775393;
|
|
6855
|
+
} else if (i2 < 60) {
|
|
6856
|
+
t2 += (b2 & c2 | b2 & d2 | c2 & d2) - 1894007588;
|
|
6857
|
+
} else {
|
|
6858
|
+
t2 += (b2 ^ c2 ^ d2) - 899497514;
|
|
6859
|
+
}
|
|
6860
|
+
e2 = d2;
|
|
6861
|
+
d2 = c2;
|
|
6862
|
+
c2 = b2 << 30 | b2 >>> 2;
|
|
6863
|
+
b2 = a2;
|
|
6864
|
+
a2 = t2;
|
|
6865
|
+
}
|
|
6866
|
+
H2[0] = H2[0] + a2 | 0;
|
|
6867
|
+
H2[1] = H2[1] + b2 | 0;
|
|
6868
|
+
H2[2] = H2[2] + c2 | 0;
|
|
6869
|
+
H2[3] = H2[3] + d2 | 0;
|
|
6870
|
+
H2[4] = H2[4] + e2 | 0;
|
|
6871
|
+
},
|
|
6872
|
+
_doFinalize: function() {
|
|
6873
|
+
var data = this._data;
|
|
6874
|
+
var dataWords = data.words;
|
|
6875
|
+
var nBitsTotal = this._nDataBytes * 8;
|
|
6876
|
+
var nBitsLeft = data.sigBytes * 8;
|
|
6877
|
+
dataWords[nBitsLeft >>> 5] |= 128 << 24 - nBitsLeft % 32;
|
|
6878
|
+
dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 4294967296);
|
|
6879
|
+
dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal;
|
|
6880
|
+
data.sigBytes = dataWords.length * 4;
|
|
6881
|
+
this._process();
|
|
6882
|
+
return this._hash;
|
|
6883
|
+
},
|
|
6884
|
+
clone: function() {
|
|
6885
|
+
var clone = Hasher.clone.call(this);
|
|
6886
|
+
clone._hash = this._hash.clone();
|
|
6887
|
+
return clone;
|
|
6888
|
+
}
|
|
6889
|
+
});
|
|
6890
|
+
C2.SHA1 = Hasher._createHelper(SHA1);
|
|
6891
|
+
C2.HmacSHA1 = Hasher._createHmacHelper(SHA1);
|
|
6892
|
+
})();
|
|
6893
|
+
return CryptoJS.SHA1;
|
|
6894
|
+
});
|
|
6895
|
+
});
|
|
6896
|
+
|
|
6897
|
+
// ../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/hmac.js
|
|
6898
|
+
var require_hmac = __commonJS((exports, module) => {
|
|
6899
|
+
(function(root, factory) {
|
|
6900
|
+
if (typeof exports === "object") {
|
|
6901
|
+
module.exports = exports = factory(require_core());
|
|
6902
|
+
} else if (typeof define === "function" && define.amd) {
|
|
6903
|
+
define(["./core"], factory);
|
|
6904
|
+
} else {
|
|
6905
|
+
factory(root.CryptoJS);
|
|
6906
|
+
}
|
|
6907
|
+
})(exports, function(CryptoJS) {
|
|
6908
|
+
(function() {
|
|
6909
|
+
var C2 = CryptoJS;
|
|
6910
|
+
var C_lib = C2.lib;
|
|
6911
|
+
var Base = C_lib.Base;
|
|
6912
|
+
var C_enc = C2.enc;
|
|
6913
|
+
var Utf8 = C_enc.Utf8;
|
|
6914
|
+
var C_algo = C2.algo;
|
|
6915
|
+
var HMAC = C_algo.HMAC = Base.extend({
|
|
6916
|
+
init: function(hasher, key) {
|
|
6917
|
+
hasher = this._hasher = new hasher.init;
|
|
6918
|
+
if (typeof key == "string") {
|
|
6919
|
+
key = Utf8.parse(key);
|
|
6920
|
+
}
|
|
6921
|
+
var hasherBlockSize = hasher.blockSize;
|
|
6922
|
+
var hasherBlockSizeBytes = hasherBlockSize * 4;
|
|
6923
|
+
if (key.sigBytes > hasherBlockSizeBytes) {
|
|
6924
|
+
key = hasher.finalize(key);
|
|
6925
|
+
}
|
|
6926
|
+
key.clamp();
|
|
6927
|
+
var oKey = this._oKey = key.clone();
|
|
6928
|
+
var iKey = this._iKey = key.clone();
|
|
6929
|
+
var oKeyWords = oKey.words;
|
|
6930
|
+
var iKeyWords = iKey.words;
|
|
6931
|
+
for (var i2 = 0;i2 < hasherBlockSize; i2++) {
|
|
6932
|
+
oKeyWords[i2] ^= 1549556828;
|
|
6933
|
+
iKeyWords[i2] ^= 909522486;
|
|
6934
|
+
}
|
|
6935
|
+
oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
|
|
6936
|
+
this.reset();
|
|
6937
|
+
},
|
|
6938
|
+
reset: function() {
|
|
6939
|
+
var hasher = this._hasher;
|
|
6940
|
+
hasher.reset();
|
|
6941
|
+
hasher.update(this._iKey);
|
|
6942
|
+
},
|
|
6943
|
+
update: function(messageUpdate) {
|
|
6944
|
+
this._hasher.update(messageUpdate);
|
|
6945
|
+
return this;
|
|
6946
|
+
},
|
|
6947
|
+
finalize: function(messageUpdate) {
|
|
6948
|
+
var hasher = this._hasher;
|
|
6949
|
+
var innerHash = hasher.finalize(messageUpdate);
|
|
6950
|
+
hasher.reset();
|
|
6951
|
+
var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));
|
|
6952
|
+
return hmac;
|
|
6953
|
+
}
|
|
6954
|
+
});
|
|
6955
|
+
})();
|
|
6956
|
+
});
|
|
6957
|
+
});
|
|
6958
|
+
|
|
6959
|
+
// ../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/evpkdf.js
|
|
6960
|
+
var require_evpkdf = __commonJS((exports, module) => {
|
|
6961
|
+
(function(root, factory, undef) {
|
|
6962
|
+
if (typeof exports === "object") {
|
|
6963
|
+
module.exports = exports = factory(require_core(), require_sha1(), require_hmac());
|
|
6964
|
+
} else if (typeof define === "function" && define.amd) {
|
|
6965
|
+
define(["./core", "./sha1", "./hmac"], factory);
|
|
6966
|
+
} else {
|
|
6967
|
+
factory(root.CryptoJS);
|
|
6968
|
+
}
|
|
6969
|
+
})(exports, function(CryptoJS) {
|
|
6970
|
+
(function() {
|
|
6971
|
+
var C2 = CryptoJS;
|
|
6972
|
+
var C_lib = C2.lib;
|
|
6973
|
+
var Base = C_lib.Base;
|
|
6974
|
+
var WordArray = C_lib.WordArray;
|
|
6975
|
+
var C_algo = C2.algo;
|
|
6976
|
+
var MD5 = C_algo.MD5;
|
|
6977
|
+
var EvpKDF = C_algo.EvpKDF = Base.extend({
|
|
6978
|
+
cfg: Base.extend({
|
|
6979
|
+
keySize: 128 / 32,
|
|
6980
|
+
hasher: MD5,
|
|
6981
|
+
iterations: 1
|
|
6982
|
+
}),
|
|
6983
|
+
init: function(cfg) {
|
|
6984
|
+
this.cfg = this.cfg.extend(cfg);
|
|
6985
|
+
},
|
|
6986
|
+
compute: function(password, salt) {
|
|
6987
|
+
var block;
|
|
6988
|
+
var cfg = this.cfg;
|
|
6989
|
+
var hasher = cfg.hasher.create();
|
|
6990
|
+
var derivedKey = WordArray.create();
|
|
6991
|
+
var derivedKeyWords = derivedKey.words;
|
|
6992
|
+
var keySize = cfg.keySize;
|
|
6993
|
+
var iterations = cfg.iterations;
|
|
6994
|
+
while (derivedKeyWords.length < keySize) {
|
|
6995
|
+
if (block) {
|
|
6996
|
+
hasher.update(block);
|
|
6997
|
+
}
|
|
6998
|
+
block = hasher.update(password).finalize(salt);
|
|
6999
|
+
hasher.reset();
|
|
7000
|
+
for (var i2 = 1;i2 < iterations; i2++) {
|
|
7001
|
+
block = hasher.finalize(block);
|
|
7002
|
+
hasher.reset();
|
|
7003
|
+
}
|
|
7004
|
+
derivedKey.concat(block);
|
|
7005
|
+
}
|
|
7006
|
+
derivedKey.sigBytes = keySize * 4;
|
|
7007
|
+
return derivedKey;
|
|
7008
|
+
}
|
|
7009
|
+
});
|
|
7010
|
+
C2.EvpKDF = function(password, salt, cfg) {
|
|
7011
|
+
return EvpKDF.create(cfg).compute(password, salt);
|
|
7012
|
+
};
|
|
7013
|
+
})();
|
|
7014
|
+
return CryptoJS.EvpKDF;
|
|
7015
|
+
});
|
|
7016
|
+
});
|
|
7017
|
+
|
|
7018
|
+
// ../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/cipher-core.js
|
|
7019
|
+
var require_cipher_core = __commonJS((exports, module) => {
|
|
7020
|
+
(function(root, factory, undef) {
|
|
7021
|
+
if (typeof exports === "object") {
|
|
7022
|
+
module.exports = exports = factory(require_core(), require_evpkdf());
|
|
7023
|
+
} else if (typeof define === "function" && define.amd) {
|
|
7024
|
+
define(["./core", "./evpkdf"], factory);
|
|
7025
|
+
} else {
|
|
7026
|
+
factory(root.CryptoJS);
|
|
7027
|
+
}
|
|
7028
|
+
})(exports, function(CryptoJS) {
|
|
7029
|
+
CryptoJS.lib.Cipher || function(undefined2) {
|
|
7030
|
+
var C2 = CryptoJS;
|
|
7031
|
+
var C_lib = C2.lib;
|
|
7032
|
+
var Base = C_lib.Base;
|
|
7033
|
+
var WordArray = C_lib.WordArray;
|
|
7034
|
+
var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
|
|
7035
|
+
var C_enc = C2.enc;
|
|
7036
|
+
var Utf8 = C_enc.Utf8;
|
|
7037
|
+
var Base64 = C_enc.Base64;
|
|
7038
|
+
var C_algo = C2.algo;
|
|
7039
|
+
var EvpKDF = C_algo.EvpKDF;
|
|
7040
|
+
var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
|
|
7041
|
+
cfg: Base.extend(),
|
|
7042
|
+
createEncryptor: function(key, cfg) {
|
|
7043
|
+
return this.create(this._ENC_XFORM_MODE, key, cfg);
|
|
7044
|
+
},
|
|
7045
|
+
createDecryptor: function(key, cfg) {
|
|
7046
|
+
return this.create(this._DEC_XFORM_MODE, key, cfg);
|
|
7047
|
+
},
|
|
7048
|
+
init: function(xformMode, key, cfg) {
|
|
7049
|
+
this.cfg = this.cfg.extend(cfg);
|
|
7050
|
+
this._xformMode = xformMode;
|
|
7051
|
+
this._key = key;
|
|
7052
|
+
this.reset();
|
|
7053
|
+
},
|
|
7054
|
+
reset: function() {
|
|
7055
|
+
BufferedBlockAlgorithm.reset.call(this);
|
|
7056
|
+
this._doReset();
|
|
7057
|
+
},
|
|
7058
|
+
process: function(dataUpdate) {
|
|
7059
|
+
this._append(dataUpdate);
|
|
7060
|
+
return this._process();
|
|
7061
|
+
},
|
|
7062
|
+
finalize: function(dataUpdate) {
|
|
7063
|
+
if (dataUpdate) {
|
|
7064
|
+
this._append(dataUpdate);
|
|
7065
|
+
}
|
|
7066
|
+
var finalProcessedData = this._doFinalize();
|
|
7067
|
+
return finalProcessedData;
|
|
7068
|
+
},
|
|
7069
|
+
keySize: 128 / 32,
|
|
7070
|
+
ivSize: 128 / 32,
|
|
7071
|
+
_ENC_XFORM_MODE: 1,
|
|
7072
|
+
_DEC_XFORM_MODE: 2,
|
|
7073
|
+
_createHelper: function() {
|
|
7074
|
+
function selectCipherStrategy(key) {
|
|
7075
|
+
if (typeof key == "string") {
|
|
7076
|
+
return PasswordBasedCipher;
|
|
7077
|
+
} else {
|
|
7078
|
+
return SerializableCipher;
|
|
7079
|
+
}
|
|
7080
|
+
}
|
|
7081
|
+
return function(cipher) {
|
|
7082
|
+
return {
|
|
7083
|
+
encrypt: function(message, key, cfg) {
|
|
7084
|
+
return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
|
|
7085
|
+
},
|
|
7086
|
+
decrypt: function(ciphertext, key, cfg) {
|
|
7087
|
+
return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
|
|
7088
|
+
}
|
|
7089
|
+
};
|
|
7090
|
+
};
|
|
7091
|
+
}()
|
|
7092
|
+
});
|
|
7093
|
+
var StreamCipher = C_lib.StreamCipher = Cipher.extend({
|
|
7094
|
+
_doFinalize: function() {
|
|
7095
|
+
var finalProcessedBlocks = this._process(true);
|
|
7096
|
+
return finalProcessedBlocks;
|
|
7097
|
+
},
|
|
7098
|
+
blockSize: 1
|
|
7099
|
+
});
|
|
7100
|
+
var C_mode = C2.mode = {};
|
|
7101
|
+
var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
|
|
7102
|
+
createEncryptor: function(cipher, iv) {
|
|
7103
|
+
return this.Encryptor.create(cipher, iv);
|
|
7104
|
+
},
|
|
7105
|
+
createDecryptor: function(cipher, iv) {
|
|
7106
|
+
return this.Decryptor.create(cipher, iv);
|
|
7107
|
+
},
|
|
7108
|
+
init: function(cipher, iv) {
|
|
7109
|
+
this._cipher = cipher;
|
|
7110
|
+
this._iv = iv;
|
|
7111
|
+
}
|
|
7112
|
+
});
|
|
7113
|
+
var CBC = C_mode.CBC = function() {
|
|
7114
|
+
var CBC2 = BlockCipherMode.extend();
|
|
7115
|
+
CBC2.Encryptor = CBC2.extend({
|
|
7116
|
+
processBlock: function(words, offset) {
|
|
7117
|
+
var cipher = this._cipher;
|
|
7118
|
+
var blockSize = cipher.blockSize;
|
|
7119
|
+
xorBlock.call(this, words, offset, blockSize);
|
|
7120
|
+
cipher.encryptBlock(words, offset);
|
|
7121
|
+
this._prevBlock = words.slice(offset, offset + blockSize);
|
|
7122
|
+
}
|
|
7123
|
+
});
|
|
7124
|
+
CBC2.Decryptor = CBC2.extend({
|
|
7125
|
+
processBlock: function(words, offset) {
|
|
7126
|
+
var cipher = this._cipher;
|
|
7127
|
+
var blockSize = cipher.blockSize;
|
|
7128
|
+
var thisBlock = words.slice(offset, offset + blockSize);
|
|
7129
|
+
cipher.decryptBlock(words, offset);
|
|
7130
|
+
xorBlock.call(this, words, offset, blockSize);
|
|
7131
|
+
this._prevBlock = thisBlock;
|
|
7132
|
+
}
|
|
7133
|
+
});
|
|
7134
|
+
function xorBlock(words, offset, blockSize) {
|
|
7135
|
+
var block;
|
|
7136
|
+
var iv = this._iv;
|
|
7137
|
+
if (iv) {
|
|
7138
|
+
block = iv;
|
|
7139
|
+
this._iv = undefined2;
|
|
7140
|
+
} else {
|
|
7141
|
+
block = this._prevBlock;
|
|
7142
|
+
}
|
|
7143
|
+
for (var i2 = 0;i2 < blockSize; i2++) {
|
|
7144
|
+
words[offset + i2] ^= block[i2];
|
|
7145
|
+
}
|
|
7146
|
+
}
|
|
7147
|
+
return CBC2;
|
|
7148
|
+
}();
|
|
7149
|
+
var C_pad = C2.pad = {};
|
|
7150
|
+
var Pkcs7 = C_pad.Pkcs7 = {
|
|
7151
|
+
pad: function(data, blockSize) {
|
|
7152
|
+
var blockSizeBytes = blockSize * 4;
|
|
7153
|
+
var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
|
|
7154
|
+
var paddingWord = nPaddingBytes << 24 | nPaddingBytes << 16 | nPaddingBytes << 8 | nPaddingBytes;
|
|
7155
|
+
var paddingWords = [];
|
|
7156
|
+
for (var i2 = 0;i2 < nPaddingBytes; i2 += 4) {
|
|
7157
|
+
paddingWords.push(paddingWord);
|
|
7158
|
+
}
|
|
7159
|
+
var padding = WordArray.create(paddingWords, nPaddingBytes);
|
|
7160
|
+
data.concat(padding);
|
|
7161
|
+
},
|
|
7162
|
+
unpad: function(data) {
|
|
7163
|
+
var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 255;
|
|
7164
|
+
data.sigBytes -= nPaddingBytes;
|
|
7165
|
+
}
|
|
7166
|
+
};
|
|
7167
|
+
var BlockCipher = C_lib.BlockCipher = Cipher.extend({
|
|
7168
|
+
cfg: Cipher.cfg.extend({
|
|
7169
|
+
mode: CBC,
|
|
7170
|
+
padding: Pkcs7
|
|
7171
|
+
}),
|
|
7172
|
+
reset: function() {
|
|
7173
|
+
var modeCreator;
|
|
7174
|
+
Cipher.reset.call(this);
|
|
7175
|
+
var cfg = this.cfg;
|
|
7176
|
+
var iv = cfg.iv;
|
|
7177
|
+
var mode = cfg.mode;
|
|
7178
|
+
if (this._xformMode == this._ENC_XFORM_MODE) {
|
|
7179
|
+
modeCreator = mode.createEncryptor;
|
|
7180
|
+
} else {
|
|
7181
|
+
modeCreator = mode.createDecryptor;
|
|
7182
|
+
this._minBufferSize = 1;
|
|
7183
|
+
}
|
|
7184
|
+
if (this._mode && this._mode.__creator == modeCreator) {
|
|
7185
|
+
this._mode.init(this, iv && iv.words);
|
|
7186
|
+
} else {
|
|
7187
|
+
this._mode = modeCreator.call(mode, this, iv && iv.words);
|
|
7188
|
+
this._mode.__creator = modeCreator;
|
|
7189
|
+
}
|
|
7190
|
+
},
|
|
7191
|
+
_doProcessBlock: function(words, offset) {
|
|
7192
|
+
this._mode.processBlock(words, offset);
|
|
7193
|
+
},
|
|
7194
|
+
_doFinalize: function() {
|
|
7195
|
+
var finalProcessedBlocks;
|
|
7196
|
+
var padding = this.cfg.padding;
|
|
7197
|
+
if (this._xformMode == this._ENC_XFORM_MODE) {
|
|
7198
|
+
padding.pad(this._data, this.blockSize);
|
|
7199
|
+
finalProcessedBlocks = this._process(true);
|
|
7200
|
+
} else {
|
|
7201
|
+
finalProcessedBlocks = this._process(true);
|
|
7202
|
+
padding.unpad(finalProcessedBlocks);
|
|
7203
|
+
}
|
|
7204
|
+
return finalProcessedBlocks;
|
|
7205
|
+
},
|
|
7206
|
+
blockSize: 128 / 32
|
|
7207
|
+
});
|
|
7208
|
+
var CipherParams = C_lib.CipherParams = Base.extend({
|
|
7209
|
+
init: function(cipherParams) {
|
|
7210
|
+
this.mixIn(cipherParams);
|
|
7211
|
+
},
|
|
7212
|
+
toString: function(formatter) {
|
|
7213
|
+
return (formatter || this.formatter).stringify(this);
|
|
7214
|
+
}
|
|
7215
|
+
});
|
|
7216
|
+
var C_format = C2.format = {};
|
|
7217
|
+
var OpenSSLFormatter = C_format.OpenSSL = {
|
|
7218
|
+
stringify: function(cipherParams) {
|
|
7219
|
+
var wordArray;
|
|
7220
|
+
var ciphertext = cipherParams.ciphertext;
|
|
7221
|
+
var salt = cipherParams.salt;
|
|
7222
|
+
if (salt) {
|
|
7223
|
+
wordArray = WordArray.create([1398893684, 1701076831]).concat(salt).concat(ciphertext);
|
|
7224
|
+
} else {
|
|
7225
|
+
wordArray = ciphertext;
|
|
7226
|
+
}
|
|
7227
|
+
return wordArray.toString(Base64);
|
|
7228
|
+
},
|
|
7229
|
+
parse: function(openSSLStr) {
|
|
7230
|
+
var salt;
|
|
7231
|
+
var ciphertext = Base64.parse(openSSLStr);
|
|
7232
|
+
var ciphertextWords = ciphertext.words;
|
|
7233
|
+
if (ciphertextWords[0] == 1398893684 && ciphertextWords[1] == 1701076831) {
|
|
7234
|
+
salt = WordArray.create(ciphertextWords.slice(2, 4));
|
|
7235
|
+
ciphertextWords.splice(0, 4);
|
|
7236
|
+
ciphertext.sigBytes -= 16;
|
|
7237
|
+
}
|
|
7238
|
+
return CipherParams.create({ ciphertext, salt });
|
|
7239
|
+
}
|
|
7240
|
+
};
|
|
7241
|
+
var SerializableCipher = C_lib.SerializableCipher = Base.extend({
|
|
7242
|
+
cfg: Base.extend({
|
|
7243
|
+
format: OpenSSLFormatter
|
|
7244
|
+
}),
|
|
7245
|
+
encrypt: function(cipher, message, key, cfg) {
|
|
7246
|
+
cfg = this.cfg.extend(cfg);
|
|
7247
|
+
var encryptor = cipher.createEncryptor(key, cfg);
|
|
7248
|
+
var ciphertext = encryptor.finalize(message);
|
|
7249
|
+
var cipherCfg = encryptor.cfg;
|
|
7250
|
+
return CipherParams.create({
|
|
7251
|
+
ciphertext,
|
|
7252
|
+
key,
|
|
7253
|
+
iv: cipherCfg.iv,
|
|
7254
|
+
algorithm: cipher,
|
|
7255
|
+
mode: cipherCfg.mode,
|
|
7256
|
+
padding: cipherCfg.padding,
|
|
7257
|
+
blockSize: cipher.blockSize,
|
|
7258
|
+
formatter: cfg.format
|
|
7259
|
+
});
|
|
7260
|
+
},
|
|
7261
|
+
decrypt: function(cipher, ciphertext, key, cfg) {
|
|
7262
|
+
cfg = this.cfg.extend(cfg);
|
|
7263
|
+
ciphertext = this._parse(ciphertext, cfg.format);
|
|
7264
|
+
var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
|
|
7265
|
+
return plaintext;
|
|
7266
|
+
},
|
|
7267
|
+
_parse: function(ciphertext, format) {
|
|
7268
|
+
if (typeof ciphertext == "string") {
|
|
7269
|
+
return format.parse(ciphertext, this);
|
|
7270
|
+
} else {
|
|
7271
|
+
return ciphertext;
|
|
7272
|
+
}
|
|
7273
|
+
}
|
|
7274
|
+
});
|
|
7275
|
+
var C_kdf = C2.kdf = {};
|
|
7276
|
+
var OpenSSLKdf = C_kdf.OpenSSL = {
|
|
7277
|
+
execute: function(password, keySize, ivSize, salt, hasher) {
|
|
7278
|
+
if (!salt) {
|
|
7279
|
+
salt = WordArray.random(64 / 8);
|
|
7280
|
+
}
|
|
7281
|
+
if (!hasher) {
|
|
7282
|
+
var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
|
|
7283
|
+
} else {
|
|
7284
|
+
var key = EvpKDF.create({ keySize: keySize + ivSize, hasher }).compute(password, salt);
|
|
7285
|
+
}
|
|
7286
|
+
var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
|
|
7287
|
+
key.sigBytes = keySize * 4;
|
|
7288
|
+
return CipherParams.create({ key, iv, salt });
|
|
7289
|
+
}
|
|
7290
|
+
};
|
|
7291
|
+
var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
|
|
7292
|
+
cfg: SerializableCipher.cfg.extend({
|
|
7293
|
+
kdf: OpenSSLKdf
|
|
7294
|
+
}),
|
|
7295
|
+
encrypt: function(cipher, message, password, cfg) {
|
|
7296
|
+
cfg = this.cfg.extend(cfg);
|
|
7297
|
+
var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, cfg.salt, cfg.hasher);
|
|
7298
|
+
cfg.iv = derivedParams.iv;
|
|
7299
|
+
var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);
|
|
7300
|
+
ciphertext.mixIn(derivedParams);
|
|
7301
|
+
return ciphertext;
|
|
7302
|
+
},
|
|
7303
|
+
decrypt: function(cipher, ciphertext, password, cfg) {
|
|
7304
|
+
cfg = this.cfg.extend(cfg);
|
|
7305
|
+
ciphertext = this._parse(ciphertext, cfg.format);
|
|
7306
|
+
var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt, cfg.hasher);
|
|
7307
|
+
cfg.iv = derivedParams.iv;
|
|
7308
|
+
var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
|
|
7309
|
+
return plaintext;
|
|
7310
|
+
}
|
|
7311
|
+
});
|
|
7312
|
+
}();
|
|
7313
|
+
});
|
|
7314
|
+
});
|
|
7315
|
+
|
|
7316
|
+
// ../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js
|
|
7317
|
+
var require_aes = __commonJS((exports, module) => {
|
|
7318
|
+
(function(root, factory, undef) {
|
|
7319
|
+
if (typeof exports === "object") {
|
|
7320
|
+
module.exports = exports = factory(require_core(), require_enc_base64(), require_md5(), require_evpkdf(), require_cipher_core());
|
|
7321
|
+
} else if (typeof define === "function" && define.amd) {
|
|
7322
|
+
define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
|
|
7323
|
+
} else {
|
|
7324
|
+
factory(root.CryptoJS);
|
|
7325
|
+
}
|
|
7326
|
+
})(exports, function(CryptoJS) {
|
|
7327
|
+
(function() {
|
|
7328
|
+
var C2 = CryptoJS;
|
|
7329
|
+
var C_lib = C2.lib;
|
|
7330
|
+
var BlockCipher = C_lib.BlockCipher;
|
|
7331
|
+
var C_algo = C2.algo;
|
|
7332
|
+
var SBOX = [];
|
|
7333
|
+
var INV_SBOX = [];
|
|
7334
|
+
var SUB_MIX_0 = [];
|
|
7335
|
+
var SUB_MIX_1 = [];
|
|
7336
|
+
var SUB_MIX_2 = [];
|
|
7337
|
+
var SUB_MIX_3 = [];
|
|
7338
|
+
var INV_SUB_MIX_0 = [];
|
|
7339
|
+
var INV_SUB_MIX_1 = [];
|
|
7340
|
+
var INV_SUB_MIX_2 = [];
|
|
7341
|
+
var INV_SUB_MIX_3 = [];
|
|
7342
|
+
(function() {
|
|
7343
|
+
var d2 = [];
|
|
7344
|
+
for (var i2 = 0;i2 < 256; i2++) {
|
|
7345
|
+
if (i2 < 128) {
|
|
7346
|
+
d2[i2] = i2 << 1;
|
|
7347
|
+
} else {
|
|
7348
|
+
d2[i2] = i2 << 1 ^ 283;
|
|
7349
|
+
}
|
|
7350
|
+
}
|
|
7351
|
+
var x2 = 0;
|
|
7352
|
+
var xi = 0;
|
|
7353
|
+
for (var i2 = 0;i2 < 256; i2++) {
|
|
7354
|
+
var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4;
|
|
7355
|
+
sx = sx >>> 8 ^ sx & 255 ^ 99;
|
|
7356
|
+
SBOX[x2] = sx;
|
|
7357
|
+
INV_SBOX[sx] = x2;
|
|
7358
|
+
var x22 = d2[x2];
|
|
7359
|
+
var x4 = d2[x22];
|
|
7360
|
+
var x8 = d2[x4];
|
|
7361
|
+
var t2 = d2[sx] * 257 ^ sx * 16843008;
|
|
7362
|
+
SUB_MIX_0[x2] = t2 << 24 | t2 >>> 8;
|
|
7363
|
+
SUB_MIX_1[x2] = t2 << 16 | t2 >>> 16;
|
|
7364
|
+
SUB_MIX_2[x2] = t2 << 8 | t2 >>> 24;
|
|
7365
|
+
SUB_MIX_3[x2] = t2;
|
|
7366
|
+
var t2 = x8 * 16843009 ^ x4 * 65537 ^ x22 * 257 ^ x2 * 16843008;
|
|
7367
|
+
INV_SUB_MIX_0[sx] = t2 << 24 | t2 >>> 8;
|
|
7368
|
+
INV_SUB_MIX_1[sx] = t2 << 16 | t2 >>> 16;
|
|
7369
|
+
INV_SUB_MIX_2[sx] = t2 << 8 | t2 >>> 24;
|
|
7370
|
+
INV_SUB_MIX_3[sx] = t2;
|
|
7371
|
+
if (!x2) {
|
|
7372
|
+
x2 = xi = 1;
|
|
7373
|
+
} else {
|
|
7374
|
+
x2 = x22 ^ d2[d2[d2[x8 ^ x22]]];
|
|
7375
|
+
xi ^= d2[d2[xi]];
|
|
7376
|
+
}
|
|
7377
|
+
}
|
|
7378
|
+
})();
|
|
7379
|
+
var RCON = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54];
|
|
7380
|
+
var AES = C_algo.AES = BlockCipher.extend({
|
|
7381
|
+
_doReset: function() {
|
|
7382
|
+
var t2;
|
|
7383
|
+
if (this._nRounds && this._keyPriorReset === this._key) {
|
|
7384
|
+
return;
|
|
7385
|
+
}
|
|
7386
|
+
var key = this._keyPriorReset = this._key;
|
|
7387
|
+
var keyWords = key.words;
|
|
7388
|
+
var keySize = key.sigBytes / 4;
|
|
7389
|
+
var nRounds = this._nRounds = keySize + 6;
|
|
7390
|
+
var ksRows = (nRounds + 1) * 4;
|
|
7391
|
+
var keySchedule = this._keySchedule = [];
|
|
7392
|
+
for (var ksRow = 0;ksRow < ksRows; ksRow++) {
|
|
7393
|
+
if (ksRow < keySize) {
|
|
7394
|
+
keySchedule[ksRow] = keyWords[ksRow];
|
|
7395
|
+
} else {
|
|
7396
|
+
t2 = keySchedule[ksRow - 1];
|
|
7397
|
+
if (!(ksRow % keySize)) {
|
|
7398
|
+
t2 = t2 << 8 | t2 >>> 24;
|
|
7399
|
+
t2 = SBOX[t2 >>> 24] << 24 | SBOX[t2 >>> 16 & 255] << 16 | SBOX[t2 >>> 8 & 255] << 8 | SBOX[t2 & 255];
|
|
7400
|
+
t2 ^= RCON[ksRow / keySize | 0] << 24;
|
|
7401
|
+
} else if (keySize > 6 && ksRow % keySize == 4) {
|
|
7402
|
+
t2 = SBOX[t2 >>> 24] << 24 | SBOX[t2 >>> 16 & 255] << 16 | SBOX[t2 >>> 8 & 255] << 8 | SBOX[t2 & 255];
|
|
7403
|
+
}
|
|
7404
|
+
keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t2;
|
|
7405
|
+
}
|
|
7406
|
+
}
|
|
7407
|
+
var invKeySchedule = this._invKeySchedule = [];
|
|
7408
|
+
for (var invKsRow = 0;invKsRow < ksRows; invKsRow++) {
|
|
7409
|
+
var ksRow = ksRows - invKsRow;
|
|
7410
|
+
if (invKsRow % 4) {
|
|
7411
|
+
var t2 = keySchedule[ksRow];
|
|
7412
|
+
} else {
|
|
7413
|
+
var t2 = keySchedule[ksRow - 4];
|
|
7414
|
+
}
|
|
7415
|
+
if (invKsRow < 4 || ksRow <= 4) {
|
|
7416
|
+
invKeySchedule[invKsRow] = t2;
|
|
7417
|
+
} else {
|
|
7418
|
+
invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t2 >>> 24]] ^ INV_SUB_MIX_1[SBOX[t2 >>> 16 & 255]] ^ INV_SUB_MIX_2[SBOX[t2 >>> 8 & 255]] ^ INV_SUB_MIX_3[SBOX[t2 & 255]];
|
|
7419
|
+
}
|
|
7420
|
+
}
|
|
7421
|
+
},
|
|
7422
|
+
encryptBlock: function(M2, offset) {
|
|
7423
|
+
this._doCryptBlock(M2, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
|
|
7424
|
+
},
|
|
7425
|
+
decryptBlock: function(M2, offset) {
|
|
7426
|
+
var t2 = M2[offset + 1];
|
|
7427
|
+
M2[offset + 1] = M2[offset + 3];
|
|
7428
|
+
M2[offset + 3] = t2;
|
|
7429
|
+
this._doCryptBlock(M2, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
|
|
7430
|
+
var t2 = M2[offset + 1];
|
|
7431
|
+
M2[offset + 1] = M2[offset + 3];
|
|
7432
|
+
M2[offset + 3] = t2;
|
|
7433
|
+
},
|
|
7434
|
+
_doCryptBlock: function(M2, offset, keySchedule, SUB_MIX_02, SUB_MIX_12, SUB_MIX_22, SUB_MIX_32, SBOX2) {
|
|
7435
|
+
var nRounds = this._nRounds;
|
|
7436
|
+
var s0 = M2[offset] ^ keySchedule[0];
|
|
7437
|
+
var s1 = M2[offset + 1] ^ keySchedule[1];
|
|
7438
|
+
var s2 = M2[offset + 2] ^ keySchedule[2];
|
|
7439
|
+
var s3 = M2[offset + 3] ^ keySchedule[3];
|
|
7440
|
+
var ksRow = 4;
|
|
7441
|
+
for (var round = 1;round < nRounds; round++) {
|
|
7442
|
+
var t0 = SUB_MIX_02[s0 >>> 24] ^ SUB_MIX_12[s1 >>> 16 & 255] ^ SUB_MIX_22[s2 >>> 8 & 255] ^ SUB_MIX_32[s3 & 255] ^ keySchedule[ksRow++];
|
|
7443
|
+
var t1 = SUB_MIX_02[s1 >>> 24] ^ SUB_MIX_12[s2 >>> 16 & 255] ^ SUB_MIX_22[s3 >>> 8 & 255] ^ SUB_MIX_32[s0 & 255] ^ keySchedule[ksRow++];
|
|
7444
|
+
var t2 = SUB_MIX_02[s2 >>> 24] ^ SUB_MIX_12[s3 >>> 16 & 255] ^ SUB_MIX_22[s0 >>> 8 & 255] ^ SUB_MIX_32[s1 & 255] ^ keySchedule[ksRow++];
|
|
7445
|
+
var t3 = SUB_MIX_02[s3 >>> 24] ^ SUB_MIX_12[s0 >>> 16 & 255] ^ SUB_MIX_22[s1 >>> 8 & 255] ^ SUB_MIX_32[s2 & 255] ^ keySchedule[ksRow++];
|
|
7446
|
+
s0 = t0;
|
|
7447
|
+
s1 = t1;
|
|
7448
|
+
s2 = t2;
|
|
7449
|
+
s3 = t3;
|
|
7450
|
+
}
|
|
7451
|
+
var t0 = (SBOX2[s0 >>> 24] << 24 | SBOX2[s1 >>> 16 & 255] << 16 | SBOX2[s2 >>> 8 & 255] << 8 | SBOX2[s3 & 255]) ^ keySchedule[ksRow++];
|
|
7452
|
+
var t1 = (SBOX2[s1 >>> 24] << 24 | SBOX2[s2 >>> 16 & 255] << 16 | SBOX2[s3 >>> 8 & 255] << 8 | SBOX2[s0 & 255]) ^ keySchedule[ksRow++];
|
|
7453
|
+
var t2 = (SBOX2[s2 >>> 24] << 24 | SBOX2[s3 >>> 16 & 255] << 16 | SBOX2[s0 >>> 8 & 255] << 8 | SBOX2[s1 & 255]) ^ keySchedule[ksRow++];
|
|
7454
|
+
var t3 = (SBOX2[s3 >>> 24] << 24 | SBOX2[s0 >>> 16 & 255] << 16 | SBOX2[s1 >>> 8 & 255] << 8 | SBOX2[s2 & 255]) ^ keySchedule[ksRow++];
|
|
7455
|
+
M2[offset] = t0;
|
|
7456
|
+
M2[offset + 1] = t1;
|
|
7457
|
+
M2[offset + 2] = t2;
|
|
7458
|
+
M2[offset + 3] = t3;
|
|
7459
|
+
},
|
|
7460
|
+
keySize: 256 / 32
|
|
7461
|
+
});
|
|
7462
|
+
C2.AES = BlockCipher._createHelper(AES);
|
|
7463
|
+
})();
|
|
7464
|
+
return CryptoJS.AES;
|
|
7465
|
+
});
|
|
7466
|
+
});
|
|
7467
|
+
|
|
7468
|
+
// ../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js
|
|
7469
|
+
var require_enc_utf8 = __commonJS((exports, module) => {
|
|
7470
|
+
(function(root, factory) {
|
|
7471
|
+
if (typeof exports === "object") {
|
|
7472
|
+
module.exports = exports = factory(require_core());
|
|
7473
|
+
} else if (typeof define === "function" && define.amd) {
|
|
7474
|
+
define(["./core"], factory);
|
|
7475
|
+
} else {
|
|
7476
|
+
factory(root.CryptoJS);
|
|
7477
|
+
}
|
|
7478
|
+
})(exports, function(CryptoJS) {
|
|
7479
|
+
return CryptoJS.enc.Utf8;
|
|
7480
|
+
});
|
|
7481
|
+
});
|
|
7482
|
+
|
|
7483
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/internal/qs/formats.mjs
|
|
6267
7484
|
var default_format = "RFC3986";
|
|
6268
7485
|
var formatters = {
|
|
6269
7486
|
RFC1738: (v) => String(v).replace(/%20/g, "+"),
|
|
@@ -6271,7 +7488,7 @@ var formatters = {
|
|
|
6271
7488
|
};
|
|
6272
7489
|
var RFC1738 = "RFC1738";
|
|
6273
7490
|
|
|
6274
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
7491
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/internal/qs/utils.mjs
|
|
6275
7492
|
var is_array = Array.isArray;
|
|
6276
7493
|
var hex_table = (() => {
|
|
6277
7494
|
const array = [];
|
|
@@ -6343,7 +7560,7 @@ function maybe_map(val, fn) {
|
|
|
6343
7560
|
return fn(val);
|
|
6344
7561
|
}
|
|
6345
7562
|
|
|
6346
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
7563
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/internal/qs/stringify.mjs
|
|
6347
7564
|
var has = Object.prototype.hasOwnProperty;
|
|
6348
7565
|
var array_prefix_generators = {
|
|
6349
7566
|
brackets(prefix) {
|
|
@@ -6573,10 +7790,10 @@ function stringify(object, opts = {}) {
|
|
|
6573
7790
|
}
|
|
6574
7791
|
return joined.length > 0 ? prefix + joined : "";
|
|
6575
7792
|
}
|
|
6576
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
7793
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/version.mjs
|
|
6577
7794
|
var VERSION = "4.103.0";
|
|
6578
7795
|
|
|
6579
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
7796
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/_shims/registry.mjs
|
|
6580
7797
|
var auto = false;
|
|
6581
7798
|
var kind = undefined;
|
|
6582
7799
|
var fetch = undefined;
|
|
@@ -6614,7 +7831,7 @@ function setShims(shims, options = { auto: false }) {
|
|
|
6614
7831
|
isFsReadStream = shims.isFsReadStream;
|
|
6615
7832
|
}
|
|
6616
7833
|
|
|
6617
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
7834
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/_shims/node-runtime.mjs
|
|
6618
7835
|
var nf = __toESM(require_lib2(), 1);
|
|
6619
7836
|
|
|
6620
7837
|
// ../../node_modules/.pnpm/formdata-node@4.4.1/node_modules/formdata-node/lib/esm/FormData.js
|
|
@@ -6754,7 +7971,7 @@ class FormData2 {
|
|
|
6754
7971
|
}
|
|
6755
7972
|
}
|
|
6756
7973
|
|
|
6757
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
7974
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/_shims/node-runtime.mjs
|
|
6758
7975
|
var import_agentkeepalive = __toESM(require_agentkeepalive(), 1);
|
|
6759
7976
|
var import_abort_controller = __toESM(require_abort_controller(), 1);
|
|
6760
7977
|
import { ReadStream as FsReadStream } from "node:fs";
|
|
@@ -6940,10 +8157,10 @@ class FormDataEncoder {
|
|
|
6940
8157
|
}
|
|
6941
8158
|
}
|
|
6942
8159
|
|
|
6943
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
8160
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/_shims/node-runtime.mjs
|
|
6944
8161
|
import { Readable } from "node:stream";
|
|
6945
8162
|
|
|
6946
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
8163
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/_shims/MultipartBody.mjs
|
|
6947
8164
|
class MultipartBody {
|
|
6948
8165
|
constructor(body) {
|
|
6949
8166
|
this.body = body;
|
|
@@ -6953,7 +8170,7 @@ class MultipartBody {
|
|
|
6953
8170
|
}
|
|
6954
8171
|
}
|
|
6955
8172
|
|
|
6956
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
8173
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/_shims/node-runtime.mjs
|
|
6957
8174
|
import { ReadableStream as ReadableStream3 } from "node:stream/web";
|
|
6958
8175
|
var fileFromPathWarned = false;
|
|
6959
8176
|
async function fileFromPath3(path, ...args) {
|
|
@@ -6998,14 +8215,14 @@ function getRuntime() {
|
|
|
6998
8215
|
};
|
|
6999
8216
|
}
|
|
7000
8217
|
|
|
7001
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
8218
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/_shims/index.mjs
|
|
7002
8219
|
var init = () => {
|
|
7003
8220
|
if (!kind)
|
|
7004
8221
|
setShims(getRuntime(), { auto: true });
|
|
7005
8222
|
};
|
|
7006
8223
|
init();
|
|
7007
8224
|
|
|
7008
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
8225
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/error.mjs
|
|
7009
8226
|
class OpenAIError extends Error {
|
|
7010
8227
|
}
|
|
7011
8228
|
|
|
@@ -7123,7 +8340,7 @@ class ContentFilterFinishReasonError extends OpenAIError {
|
|
|
7123
8340
|
}
|
|
7124
8341
|
}
|
|
7125
8342
|
|
|
7126
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
8343
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/internal/decoders/line.mjs
|
|
7127
8344
|
var __classPrivateFieldSet5 = function(receiver, state, value, kind2, f2) {
|
|
7128
8345
|
if (kind2 === "m")
|
|
7129
8346
|
throw new TypeError("Private method is not writable");
|
|
@@ -7243,7 +8460,7 @@ function findDoubleNewlineIndex(buffer) {
|
|
|
7243
8460
|
return -1;
|
|
7244
8461
|
}
|
|
7245
8462
|
|
|
7246
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
8463
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/internal/stream-utils.mjs
|
|
7247
8464
|
function ReadableStreamToAsyncIterable(stream) {
|
|
7248
8465
|
if (stream[Symbol.asyncIterator])
|
|
7249
8466
|
return stream;
|
|
@@ -7272,7 +8489,7 @@ function ReadableStreamToAsyncIterable(stream) {
|
|
|
7272
8489
|
};
|
|
7273
8490
|
}
|
|
7274
8491
|
|
|
7275
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
8492
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/streaming.mjs
|
|
7276
8493
|
class Stream {
|
|
7277
8494
|
constructor(iterator, controller) {
|
|
7278
8495
|
this.iterator = iterator;
|
|
@@ -7398,12 +8615,12 @@ class Stream {
|
|
|
7398
8615
|
];
|
|
7399
8616
|
}
|
|
7400
8617
|
toReadableStream() {
|
|
7401
|
-
const
|
|
8618
|
+
const self2 = this;
|
|
7402
8619
|
let iter;
|
|
7403
8620
|
const encoder = new TextEncoder;
|
|
7404
8621
|
return new ReadableStream({
|
|
7405
8622
|
async start() {
|
|
7406
|
-
iter =
|
|
8623
|
+
iter = self2[Symbol.asyncIterator]();
|
|
7407
8624
|
},
|
|
7408
8625
|
async pull(ctrl) {
|
|
7409
8626
|
try {
|
|
@@ -7514,7 +8731,7 @@ function partition(str, delimiter) {
|
|
|
7514
8731
|
return [str, "", ""];
|
|
7515
8732
|
}
|
|
7516
8733
|
|
|
7517
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
8734
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/uploads.mjs
|
|
7518
8735
|
var isResponseLike = (value) => value != null && typeof value === "object" && typeof value.url === "string" && typeof value.blob === "function";
|
|
7519
8736
|
var isFileLike2 = (value) => value != null && typeof value === "object" && typeof value.name === "string" && typeof value.lastModified === "number" && isBlobLike(value);
|
|
7520
8737
|
var isBlobLike = (value) => value != null && typeof value === "object" && typeof value.size === "number" && typeof value.type === "string" && typeof value.text === "function" && typeof value.slice === "function" && typeof value.arrayBuffer === "function";
|
|
@@ -7602,7 +8819,7 @@ var addFormValue = async (form, key, value) => {
|
|
|
7602
8819
|
}
|
|
7603
8820
|
};
|
|
7604
8821
|
|
|
7605
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
8822
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/core.mjs
|
|
7606
8823
|
var __classPrivateFieldSet6 = function(receiver, state, value, kind2, f2) {
|
|
7607
8824
|
if (kind2 === "m")
|
|
7608
8825
|
throw new TypeError("Private method is not writable");
|
|
@@ -8309,7 +9526,7 @@ function isObj(obj) {
|
|
|
8309
9526
|
return obj != null && typeof obj === "object" && !Array.isArray(obj);
|
|
8310
9527
|
}
|
|
8311
9528
|
|
|
8312
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
9529
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/pagination.mjs
|
|
8313
9530
|
class Page extends AbstractPage {
|
|
8314
9531
|
constructor(client, response, body, options) {
|
|
8315
9532
|
super(client, response, body, options);
|
|
@@ -8366,14 +9583,14 @@ class CursorPage extends AbstractPage {
|
|
|
8366
9583
|
}
|
|
8367
9584
|
}
|
|
8368
9585
|
|
|
8369
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
9586
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resource.mjs
|
|
8370
9587
|
class APIResource {
|
|
8371
9588
|
constructor(client) {
|
|
8372
9589
|
this._client = client;
|
|
8373
9590
|
}
|
|
8374
9591
|
}
|
|
8375
9592
|
|
|
8376
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
9593
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/chat/completions/messages.mjs
|
|
8377
9594
|
class Messages extends APIResource {
|
|
8378
9595
|
list(completionId, query = {}, options) {
|
|
8379
9596
|
if (isRequestOptions(query)) {
|
|
@@ -8383,7 +9600,7 @@ class Messages extends APIResource {
|
|
|
8383
9600
|
}
|
|
8384
9601
|
}
|
|
8385
9602
|
|
|
8386
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
9603
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/chat/completions/completions.mjs
|
|
8387
9604
|
class Completions extends APIResource {
|
|
8388
9605
|
constructor() {
|
|
8389
9606
|
super(...arguments);
|
|
@@ -8417,7 +9634,7 @@ class ChatCompletionStoreMessagesPage extends CursorPage {
|
|
|
8417
9634
|
Completions.ChatCompletionsPage = ChatCompletionsPage;
|
|
8418
9635
|
Completions.Messages = Messages;
|
|
8419
9636
|
|
|
8420
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
9637
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/chat/chat.mjs
|
|
8421
9638
|
class Chat extends APIResource {
|
|
8422
9639
|
constructor() {
|
|
8423
9640
|
super(...arguments);
|
|
@@ -8426,7 +9643,7 @@ class Chat extends APIResource {
|
|
|
8426
9643
|
}
|
|
8427
9644
|
Chat.Completions = Completions;
|
|
8428
9645
|
Chat.ChatCompletionsPage = ChatCompletionsPage;
|
|
8429
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
9646
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/audio/speech.mjs
|
|
8430
9647
|
class Speech extends APIResource {
|
|
8431
9648
|
create(body, options) {
|
|
8432
9649
|
return this._client.post("/audio/speech", {
|
|
@@ -8438,7 +9655,7 @@ class Speech extends APIResource {
|
|
|
8438
9655
|
}
|
|
8439
9656
|
}
|
|
8440
9657
|
|
|
8441
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
9658
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/audio/transcriptions.mjs
|
|
8442
9659
|
class Transcriptions extends APIResource {
|
|
8443
9660
|
create(body, options) {
|
|
8444
9661
|
return this._client.post("/audio/transcriptions", multipartFormRequestOptions({
|
|
@@ -8450,14 +9667,14 @@ class Transcriptions extends APIResource {
|
|
|
8450
9667
|
}
|
|
8451
9668
|
}
|
|
8452
9669
|
|
|
8453
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
9670
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/audio/translations.mjs
|
|
8454
9671
|
class Translations extends APIResource {
|
|
8455
9672
|
create(body, options) {
|
|
8456
9673
|
return this._client.post("/audio/translations", multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }));
|
|
8457
9674
|
}
|
|
8458
9675
|
}
|
|
8459
9676
|
|
|
8460
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
9677
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/audio/audio.mjs
|
|
8461
9678
|
class Audio extends APIResource {
|
|
8462
9679
|
constructor() {
|
|
8463
9680
|
super(...arguments);
|
|
@@ -8469,7 +9686,7 @@ class Audio extends APIResource {
|
|
|
8469
9686
|
Audio.Transcriptions = Transcriptions;
|
|
8470
9687
|
Audio.Translations = Translations;
|
|
8471
9688
|
Audio.Speech = Speech;
|
|
8472
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
9689
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/batches.mjs
|
|
8473
9690
|
class Batches extends APIResource {
|
|
8474
9691
|
create(body, options) {
|
|
8475
9692
|
return this._client.post("/batches", { body, ...options });
|
|
@@ -8491,7 +9708,7 @@ class Batches extends APIResource {
|
|
|
8491
9708
|
class BatchesPage extends CursorPage {
|
|
8492
9709
|
}
|
|
8493
9710
|
Batches.BatchesPage = BatchesPage;
|
|
8494
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
9711
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/lib/EventStream.mjs
|
|
8495
9712
|
var __classPrivateFieldSet7 = function(receiver, state, value, kind2, f2) {
|
|
8496
9713
|
if (kind2 === "m")
|
|
8497
9714
|
throw new TypeError("Private method is not writable");
|
|
@@ -8660,7 +9877,7 @@ _EventStream_connectedPromise = new WeakMap, _EventStream_resolveConnectedPromis
|
|
|
8660
9877
|
return this._emit("error", new OpenAIError(String(error)));
|
|
8661
9878
|
};
|
|
8662
9879
|
|
|
8663
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
9880
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/lib/AssistantStream.mjs
|
|
8664
9881
|
var __classPrivateFieldGet9 = function(receiver, state, kind2, f2) {
|
|
8665
9882
|
if (kind2 === "a" && !f2)
|
|
8666
9883
|
throw new TypeError("Private accessor was defined without a getter");
|
|
@@ -9213,7 +10430,7 @@ _AssistantStream_addEvent = function _AssistantStream_addEvent2(event) {
|
|
|
9213
10430
|
};
|
|
9214
10431
|
function assertNever(_x) {}
|
|
9215
10432
|
|
|
9216
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
10433
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/beta/assistants.mjs
|
|
9217
10434
|
class Assistants extends APIResource {
|
|
9218
10435
|
create(body, options) {
|
|
9219
10436
|
return this._client.post("/assistants", {
|
|
@@ -9257,12 +10474,12 @@ class AssistantsPage extends CursorPage {
|
|
|
9257
10474
|
}
|
|
9258
10475
|
Assistants.AssistantsPage = AssistantsPage;
|
|
9259
10476
|
|
|
9260
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
10477
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/lib/RunnableFunction.mjs
|
|
9261
10478
|
function isRunnableFunctionWithParse(fn) {
|
|
9262
10479
|
return typeof fn.parse === "function";
|
|
9263
10480
|
}
|
|
9264
10481
|
|
|
9265
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
10482
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/lib/chatCompletionUtils.mjs
|
|
9266
10483
|
var isAssistantMessage = (message) => {
|
|
9267
10484
|
return message?.role === "assistant";
|
|
9268
10485
|
};
|
|
@@ -9273,7 +10490,7 @@ var isToolMessage = (message) => {
|
|
|
9273
10490
|
return message?.role === "tool";
|
|
9274
10491
|
};
|
|
9275
10492
|
|
|
9276
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
10493
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/lib/parser.mjs
|
|
9277
10494
|
function isAutoParsableResponseFormat(response_format) {
|
|
9278
10495
|
return response_format?.["$brand"] === "auto-parseable-response-format";
|
|
9279
10496
|
}
|
|
@@ -9366,7 +10583,7 @@ function validateInputTools(tools) {
|
|
|
9366
10583
|
}
|
|
9367
10584
|
}
|
|
9368
10585
|
|
|
9369
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
10586
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/lib/AbstractChatCompletionRunner.mjs
|
|
9370
10587
|
var __classPrivateFieldGet10 = function(receiver, state, kind2, f2) {
|
|
9371
10588
|
if (kind2 === "a" && !f2)
|
|
9372
10589
|
throw new TypeError("Private accessor was defined without a getter");
|
|
@@ -9699,7 +10916,7 @@ _AbstractChatCompletionRunner_instances = new WeakSet, _AbstractChatCompletionRu
|
|
|
9699
10916
|
return typeof rawContent === "string" ? rawContent : rawContent === undefined ? "undefined" : JSON.stringify(rawContent);
|
|
9700
10917
|
};
|
|
9701
10918
|
|
|
9702
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
10919
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/lib/ChatCompletionRunner.mjs
|
|
9703
10920
|
class ChatCompletionRunner extends AbstractChatCompletionRunner {
|
|
9704
10921
|
static runFunctions(client, params, options) {
|
|
9705
10922
|
const runner = new ChatCompletionRunner;
|
|
@@ -9727,7 +10944,7 @@ class ChatCompletionRunner extends AbstractChatCompletionRunner {
|
|
|
9727
10944
|
}
|
|
9728
10945
|
}
|
|
9729
10946
|
|
|
9730
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
10947
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/_vendor/partial-json-parser/parser.mjs
|
|
9731
10948
|
var STR = 1;
|
|
9732
10949
|
var NUM = 2;
|
|
9733
10950
|
var ARR = 4;
|
|
@@ -9941,7 +11158,7 @@ var _parseJSON = (jsonString, allow) => {
|
|
|
9941
11158
|
};
|
|
9942
11159
|
var partialParse = (input) => parseJSON(input, Allow.ALL ^ Allow.NUM);
|
|
9943
11160
|
|
|
9944
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
11161
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/lib/ChatCompletionStream.mjs
|
|
9945
11162
|
var __classPrivateFieldSet9 = function(receiver, state, value, kind2, f2) {
|
|
9946
11163
|
if (kind2 === "m")
|
|
9947
11164
|
throw new TypeError("Private method is not writable");
|
|
@@ -10430,7 +11647,7 @@ function assertIsEmpty(obj) {
|
|
|
10430
11647
|
}
|
|
10431
11648
|
function assertNever2(_x) {}
|
|
10432
11649
|
|
|
10433
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
11650
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/lib/ChatCompletionStreamingRunner.mjs
|
|
10434
11651
|
class ChatCompletionStreamingRunner extends ChatCompletionStream {
|
|
10435
11652
|
static fromReadableStream(stream) {
|
|
10436
11653
|
const runner = new ChatCompletionStreamingRunner(null);
|
|
@@ -10457,7 +11674,7 @@ class ChatCompletionStreamingRunner extends ChatCompletionStream {
|
|
|
10457
11674
|
}
|
|
10458
11675
|
}
|
|
10459
11676
|
|
|
10460
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
11677
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/beta/chat/completions.mjs
|
|
10461
11678
|
class Completions2 extends APIResource {
|
|
10462
11679
|
parse(body, options) {
|
|
10463
11680
|
validateInputTools(body.tools);
|
|
@@ -10486,7 +11703,7 @@ class Completions2 extends APIResource {
|
|
|
10486
11703
|
}
|
|
10487
11704
|
}
|
|
10488
11705
|
|
|
10489
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
11706
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/beta/chat/chat.mjs
|
|
10490
11707
|
class Chat2 extends APIResource {
|
|
10491
11708
|
constructor() {
|
|
10492
11709
|
super(...arguments);
|
|
@@ -10497,7 +11714,7 @@ class Chat2 extends APIResource {
|
|
|
10497
11714
|
Chat3.Completions = Completions2;
|
|
10498
11715
|
})(Chat2 || (Chat2 = {}));
|
|
10499
11716
|
|
|
10500
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
11717
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/beta/realtime/sessions.mjs
|
|
10501
11718
|
class Sessions extends APIResource {
|
|
10502
11719
|
create(body, options) {
|
|
10503
11720
|
return this._client.post("/realtime/sessions", {
|
|
@@ -10508,7 +11725,7 @@ class Sessions extends APIResource {
|
|
|
10508
11725
|
}
|
|
10509
11726
|
}
|
|
10510
11727
|
|
|
10511
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
11728
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/beta/realtime/transcription-sessions.mjs
|
|
10512
11729
|
class TranscriptionSessions extends APIResource {
|
|
10513
11730
|
create(body, options) {
|
|
10514
11731
|
return this._client.post("/realtime/transcription_sessions", {
|
|
@@ -10519,7 +11736,7 @@ class TranscriptionSessions extends APIResource {
|
|
|
10519
11736
|
}
|
|
10520
11737
|
}
|
|
10521
11738
|
|
|
10522
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
11739
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/beta/realtime/realtime.mjs
|
|
10523
11740
|
class Realtime extends APIResource {
|
|
10524
11741
|
constructor() {
|
|
10525
11742
|
super(...arguments);
|
|
@@ -10530,7 +11747,7 @@ class Realtime extends APIResource {
|
|
|
10530
11747
|
Realtime.Sessions = Sessions;
|
|
10531
11748
|
Realtime.TranscriptionSessions = TranscriptionSessions;
|
|
10532
11749
|
|
|
10533
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
11750
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/beta/threads/messages.mjs
|
|
10534
11751
|
class Messages2 extends APIResource {
|
|
10535
11752
|
create(threadId, body, options) {
|
|
10536
11753
|
return this._client.post(`/threads/${threadId}/messages`, {
|
|
@@ -10574,7 +11791,7 @@ class MessagesPage extends CursorPage {
|
|
|
10574
11791
|
}
|
|
10575
11792
|
Messages2.MessagesPage = MessagesPage;
|
|
10576
11793
|
|
|
10577
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
11794
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/beta/threads/runs/steps.mjs
|
|
10578
11795
|
class Steps extends APIResource {
|
|
10579
11796
|
retrieve(threadId, runId, stepId, query = {}, options) {
|
|
10580
11797
|
if (isRequestOptions(query)) {
|
|
@@ -10602,7 +11819,7 @@ class RunStepsPage extends CursorPage {
|
|
|
10602
11819
|
}
|
|
10603
11820
|
Steps.RunStepsPage = RunStepsPage;
|
|
10604
11821
|
|
|
10605
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
11822
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/beta/threads/runs/runs.mjs
|
|
10606
11823
|
class Runs extends APIResource {
|
|
10607
11824
|
constructor() {
|
|
10608
11825
|
super(...arguments);
|
|
@@ -10718,7 +11935,7 @@ Runs.RunsPage = RunsPage;
|
|
|
10718
11935
|
Runs.Steps = Steps;
|
|
10719
11936
|
Runs.RunStepsPage = RunStepsPage;
|
|
10720
11937
|
|
|
10721
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
11938
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/beta/threads/threads.mjs
|
|
10722
11939
|
class Threads extends APIResource {
|
|
10723
11940
|
constructor() {
|
|
10724
11941
|
super(...arguments);
|
|
@@ -10775,7 +11992,7 @@ Threads.RunsPage = RunsPage;
|
|
|
10775
11992
|
Threads.Messages = Messages2;
|
|
10776
11993
|
Threads.MessagesPage = MessagesPage;
|
|
10777
11994
|
|
|
10778
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
11995
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/beta/beta.mjs
|
|
10779
11996
|
class Beta extends APIResource {
|
|
10780
11997
|
constructor() {
|
|
10781
11998
|
super(...arguments);
|
|
@@ -10789,13 +12006,13 @@ Beta.Realtime = Realtime;
|
|
|
10789
12006
|
Beta.Assistants = Assistants;
|
|
10790
12007
|
Beta.AssistantsPage = AssistantsPage;
|
|
10791
12008
|
Beta.Threads = Threads;
|
|
10792
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12009
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/completions.mjs
|
|
10793
12010
|
class Completions3 extends APIResource {
|
|
10794
12011
|
create(body, options) {
|
|
10795
12012
|
return this._client.post("/completions", { body, ...options, stream: body.stream ?? false });
|
|
10796
12013
|
}
|
|
10797
12014
|
}
|
|
10798
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12015
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/containers/files/content.mjs
|
|
10799
12016
|
class Content extends APIResource {
|
|
10800
12017
|
retrieve(containerId, fileId, options) {
|
|
10801
12018
|
return this._client.get(`/containers/${containerId}/files/${fileId}/content`, {
|
|
@@ -10805,7 +12022,7 @@ class Content extends APIResource {
|
|
|
10805
12022
|
}
|
|
10806
12023
|
}
|
|
10807
12024
|
|
|
10808
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12025
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/containers/files/files.mjs
|
|
10809
12026
|
class Files extends APIResource {
|
|
10810
12027
|
constructor() {
|
|
10811
12028
|
super(...arguments);
|
|
@@ -10839,7 +12056,7 @@ class FileListResponsesPage extends CursorPage {
|
|
|
10839
12056
|
Files.FileListResponsesPage = FileListResponsesPage;
|
|
10840
12057
|
Files.Content = Content;
|
|
10841
12058
|
|
|
10842
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12059
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/containers/containers.mjs
|
|
10843
12060
|
class Containers extends APIResource {
|
|
10844
12061
|
constructor() {
|
|
10845
12062
|
super(...arguments);
|
|
@@ -10870,7 +12087,7 @@ class ContainerListResponsesPage extends CursorPage {
|
|
|
10870
12087
|
Containers.ContainerListResponsesPage = ContainerListResponsesPage;
|
|
10871
12088
|
Containers.Files = Files;
|
|
10872
12089
|
Containers.FileListResponsesPage = FileListResponsesPage;
|
|
10873
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12090
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/embeddings.mjs
|
|
10874
12091
|
class Embeddings extends APIResource {
|
|
10875
12092
|
create(body, options) {
|
|
10876
12093
|
const hasUserProvidedEncodingFormat = !!body.encoding_format;
|
|
@@ -10900,7 +12117,7 @@ class Embeddings extends APIResource {
|
|
|
10900
12117
|
});
|
|
10901
12118
|
}
|
|
10902
12119
|
}
|
|
10903
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12120
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/evals/runs/output-items.mjs
|
|
10904
12121
|
class OutputItems extends APIResource {
|
|
10905
12122
|
retrieve(evalId, runId, outputItemId, options) {
|
|
10906
12123
|
return this._client.get(`/evals/${evalId}/runs/${runId}/output_items/${outputItemId}`, options);
|
|
@@ -10917,7 +12134,7 @@ class OutputItemListResponsesPage extends CursorPage {
|
|
|
10917
12134
|
}
|
|
10918
12135
|
OutputItems.OutputItemListResponsesPage = OutputItemListResponsesPage;
|
|
10919
12136
|
|
|
10920
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12137
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/evals/runs/runs.mjs
|
|
10921
12138
|
class Runs2 extends APIResource {
|
|
10922
12139
|
constructor() {
|
|
10923
12140
|
super(...arguments);
|
|
@@ -10949,7 +12166,7 @@ Runs2.RunListResponsesPage = RunListResponsesPage;
|
|
|
10949
12166
|
Runs2.OutputItems = OutputItems;
|
|
10950
12167
|
Runs2.OutputItemListResponsesPage = OutputItemListResponsesPage;
|
|
10951
12168
|
|
|
10952
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12169
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/evals/evals.mjs
|
|
10953
12170
|
class Evals extends APIResource {
|
|
10954
12171
|
constructor() {
|
|
10955
12172
|
super(...arguments);
|
|
@@ -10980,7 +12197,7 @@ class EvalListResponsesPage extends CursorPage {
|
|
|
10980
12197
|
Evals.EvalListResponsesPage = EvalListResponsesPage;
|
|
10981
12198
|
Evals.Runs = Runs2;
|
|
10982
12199
|
Evals.RunListResponsesPage = RunListResponsesPage;
|
|
10983
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12200
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/files.mjs
|
|
10984
12201
|
class Files2 extends APIResource {
|
|
10985
12202
|
create(body, options) {
|
|
10986
12203
|
return this._client.post("/files", multipartFormRequestOptions({ body, ...options }));
|
|
@@ -11027,11 +12244,11 @@ class Files2 extends APIResource {
|
|
|
11027
12244
|
class FileObjectsPage extends CursorPage {
|
|
11028
12245
|
}
|
|
11029
12246
|
Files2.FileObjectsPage = FileObjectsPage;
|
|
11030
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12247
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/fine-tuning/methods.mjs
|
|
11031
12248
|
class Methods extends APIResource {
|
|
11032
12249
|
}
|
|
11033
12250
|
|
|
11034
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12251
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/fine-tuning/alpha/graders.mjs
|
|
11035
12252
|
class Graders extends APIResource {
|
|
11036
12253
|
run(body, options) {
|
|
11037
12254
|
return this._client.post("/fine_tuning/alpha/graders/run", { body, ...options });
|
|
@@ -11041,7 +12258,7 @@ class Graders extends APIResource {
|
|
|
11041
12258
|
}
|
|
11042
12259
|
}
|
|
11043
12260
|
|
|
11044
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12261
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/fine-tuning/alpha/alpha.mjs
|
|
11045
12262
|
class Alpha extends APIResource {
|
|
11046
12263
|
constructor() {
|
|
11047
12264
|
super(...arguments);
|
|
@@ -11050,7 +12267,7 @@ class Alpha extends APIResource {
|
|
|
11050
12267
|
}
|
|
11051
12268
|
Alpha.Graders = Graders;
|
|
11052
12269
|
|
|
11053
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12270
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/fine-tuning/checkpoints/permissions.mjs
|
|
11054
12271
|
class Permissions extends APIResource {
|
|
11055
12272
|
create(fineTunedModelCheckpoint, body, options) {
|
|
11056
12273
|
return this._client.getAPIList(`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, PermissionCreateResponsesPage, { body, method: "post", ...options });
|
|
@@ -11073,7 +12290,7 @@ class PermissionCreateResponsesPage extends Page {
|
|
|
11073
12290
|
}
|
|
11074
12291
|
Permissions.PermissionCreateResponsesPage = PermissionCreateResponsesPage;
|
|
11075
12292
|
|
|
11076
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12293
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/fine-tuning/checkpoints/checkpoints.mjs
|
|
11077
12294
|
class Checkpoints extends APIResource {
|
|
11078
12295
|
constructor() {
|
|
11079
12296
|
super(...arguments);
|
|
@@ -11083,7 +12300,7 @@ class Checkpoints extends APIResource {
|
|
|
11083
12300
|
Checkpoints.Permissions = Permissions;
|
|
11084
12301
|
Checkpoints.PermissionCreateResponsesPage = PermissionCreateResponsesPage;
|
|
11085
12302
|
|
|
11086
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12303
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/fine-tuning/jobs/checkpoints.mjs
|
|
11087
12304
|
class Checkpoints2 extends APIResource {
|
|
11088
12305
|
list(fineTuningJobId, query = {}, options) {
|
|
11089
12306
|
if (isRequestOptions(query)) {
|
|
@@ -11097,7 +12314,7 @@ class FineTuningJobCheckpointsPage extends CursorPage {
|
|
|
11097
12314
|
}
|
|
11098
12315
|
Checkpoints2.FineTuningJobCheckpointsPage = FineTuningJobCheckpointsPage;
|
|
11099
12316
|
|
|
11100
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12317
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/fine-tuning/jobs/jobs.mjs
|
|
11101
12318
|
class Jobs extends APIResource {
|
|
11102
12319
|
constructor() {
|
|
11103
12320
|
super(...arguments);
|
|
@@ -11145,7 +12362,7 @@ Jobs.FineTuningJobEventsPage = FineTuningJobEventsPage;
|
|
|
11145
12362
|
Jobs.Checkpoints = Checkpoints2;
|
|
11146
12363
|
Jobs.FineTuningJobCheckpointsPage = FineTuningJobCheckpointsPage;
|
|
11147
12364
|
|
|
11148
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12365
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/fine-tuning/fine-tuning.mjs
|
|
11149
12366
|
class FineTuning extends APIResource {
|
|
11150
12367
|
constructor() {
|
|
11151
12368
|
super(...arguments);
|
|
@@ -11161,11 +12378,11 @@ FineTuning.FineTuningJobsPage = FineTuningJobsPage;
|
|
|
11161
12378
|
FineTuning.FineTuningJobEventsPage = FineTuningJobEventsPage;
|
|
11162
12379
|
FineTuning.Checkpoints = Checkpoints;
|
|
11163
12380
|
FineTuning.Alpha = Alpha;
|
|
11164
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12381
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/graders/grader-models.mjs
|
|
11165
12382
|
class GraderModels extends APIResource {
|
|
11166
12383
|
}
|
|
11167
12384
|
|
|
11168
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12385
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/graders/graders.mjs
|
|
11169
12386
|
class Graders2 extends APIResource {
|
|
11170
12387
|
constructor() {
|
|
11171
12388
|
super(...arguments);
|
|
@@ -11173,7 +12390,7 @@ class Graders2 extends APIResource {
|
|
|
11173
12390
|
}
|
|
11174
12391
|
}
|
|
11175
12392
|
Graders2.GraderModels = GraderModels;
|
|
11176
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12393
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/images.mjs
|
|
11177
12394
|
class Images extends APIResource {
|
|
11178
12395
|
createVariation(body, options) {
|
|
11179
12396
|
return this._client.post("/images/variations", multipartFormRequestOptions({ body, ...options }));
|
|
@@ -11185,7 +12402,7 @@ class Images extends APIResource {
|
|
|
11185
12402
|
return this._client.post("/images/generations", { body, ...options });
|
|
11186
12403
|
}
|
|
11187
12404
|
}
|
|
11188
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12405
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/models.mjs
|
|
11189
12406
|
class Models extends APIResource {
|
|
11190
12407
|
retrieve(model, options) {
|
|
11191
12408
|
return this._client.get(`/models/${model}`, options);
|
|
@@ -11201,13 +12418,13 @@ class Models extends APIResource {
|
|
|
11201
12418
|
class ModelsPage extends Page {
|
|
11202
12419
|
}
|
|
11203
12420
|
Models.ModelsPage = ModelsPage;
|
|
11204
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12421
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/moderations.mjs
|
|
11205
12422
|
class Moderations extends APIResource {
|
|
11206
12423
|
create(body, options) {
|
|
11207
12424
|
return this._client.post("/moderations", { body, ...options });
|
|
11208
12425
|
}
|
|
11209
12426
|
}
|
|
11210
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12427
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/lib/ResponsesParser.mjs
|
|
11211
12428
|
function maybeParseResponse(response, params) {
|
|
11212
12429
|
if (!params || !hasAutoParseableInput2(params)) {
|
|
11213
12430
|
return {
|
|
@@ -11328,7 +12545,7 @@ function addOutputText(rsp) {
|
|
|
11328
12545
|
rsp.output_text = texts.join("");
|
|
11329
12546
|
}
|
|
11330
12547
|
|
|
11331
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12548
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/responses/input-items.mjs
|
|
11332
12549
|
class InputItems extends APIResource {
|
|
11333
12550
|
list(responseId, query = {}, options) {
|
|
11334
12551
|
if (isRequestOptions(query)) {
|
|
@@ -11341,7 +12558,7 @@ class InputItems extends APIResource {
|
|
|
11341
12558
|
}
|
|
11342
12559
|
}
|
|
11343
12560
|
|
|
11344
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12561
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/lib/responses/ResponseStream.mjs
|
|
11345
12562
|
var __classPrivateFieldSet10 = function(receiver, state, value, kind2, f2) {
|
|
11346
12563
|
if (kind2 === "m")
|
|
11347
12564
|
throw new TypeError("Private method is not writable");
|
|
@@ -11592,7 +12809,7 @@ function finalizeResponse(snapshot, params) {
|
|
|
11592
12809
|
return maybeParseResponse(snapshot, params);
|
|
11593
12810
|
}
|
|
11594
12811
|
|
|
11595
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12812
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/responses/responses.mjs
|
|
11596
12813
|
class Responses extends APIResource {
|
|
11597
12814
|
constructor() {
|
|
11598
12815
|
super(...arguments);
|
|
@@ -11644,14 +12861,14 @@ class Responses extends APIResource {
|
|
|
11644
12861
|
class ResponseItemsPage extends CursorPage {
|
|
11645
12862
|
}
|
|
11646
12863
|
Responses.InputItems = InputItems;
|
|
11647
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12864
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/uploads/parts.mjs
|
|
11648
12865
|
class Parts extends APIResource {
|
|
11649
12866
|
create(uploadId, body, options) {
|
|
11650
12867
|
return this._client.post(`/uploads/${uploadId}/parts`, multipartFormRequestOptions({ body, ...options }));
|
|
11651
12868
|
}
|
|
11652
12869
|
}
|
|
11653
12870
|
|
|
11654
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12871
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/uploads/uploads.mjs
|
|
11655
12872
|
class Uploads extends APIResource {
|
|
11656
12873
|
constructor() {
|
|
11657
12874
|
super(...arguments);
|
|
@@ -11668,7 +12885,7 @@ class Uploads extends APIResource {
|
|
|
11668
12885
|
}
|
|
11669
12886
|
}
|
|
11670
12887
|
Uploads.Parts = Parts;
|
|
11671
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12888
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/lib/Util.mjs
|
|
11672
12889
|
var allSettledWithThrow = async (promises) => {
|
|
11673
12890
|
const results = await Promise.allSettled(promises);
|
|
11674
12891
|
const rejected = results.filter((result) => result.status === "rejected");
|
|
@@ -11687,7 +12904,7 @@ var allSettledWithThrow = async (promises) => {
|
|
|
11687
12904
|
return values;
|
|
11688
12905
|
};
|
|
11689
12906
|
|
|
11690
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
12907
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/vector-stores/files.mjs
|
|
11691
12908
|
class Files3 extends APIResource {
|
|
11692
12909
|
create(vectorStoreId, body, options) {
|
|
11693
12910
|
return this._client.post(`/vector_stores/${vectorStoreId}/files`, {
|
|
@@ -11783,7 +13000,7 @@ class FileContentResponsesPage extends Page {
|
|
|
11783
13000
|
Files3.VectorStoreFilesPage = VectorStoreFilesPage;
|
|
11784
13001
|
Files3.FileContentResponsesPage = FileContentResponsesPage;
|
|
11785
13002
|
|
|
11786
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
13003
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/vector-stores/file-batches.mjs
|
|
11787
13004
|
class FileBatches extends APIResource {
|
|
11788
13005
|
create(vectorStoreId, body, options) {
|
|
11789
13006
|
return this._client.post(`/vector_stores/${vectorStoreId}/file_batches`, {
|
|
@@ -11870,7 +13087,7 @@ class FileBatches extends APIResource {
|
|
|
11870
13087
|
}
|
|
11871
13088
|
}
|
|
11872
13089
|
|
|
11873
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
13090
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/resources/vector-stores/vector-stores.mjs
|
|
11874
13091
|
class VectorStores extends APIResource {
|
|
11875
13092
|
constructor() {
|
|
11876
13093
|
super(...arguments);
|
|
@@ -11934,7 +13151,7 @@ VectorStores.Files = Files3;
|
|
|
11934
13151
|
VectorStores.VectorStoreFilesPage = VectorStoreFilesPage;
|
|
11935
13152
|
VectorStores.FileContentResponsesPage = FileContentResponsesPage;
|
|
11936
13153
|
VectorStores.FileBatches = FileBatches;
|
|
11937
|
-
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.
|
|
13154
|
+
// ../../node_modules/.pnpm/openai@4.103.0_ws@8.18.1_zod@3.25.28/node_modules/openai/index.mjs
|
|
11938
13155
|
var _a;
|
|
11939
13156
|
|
|
11940
13157
|
class OpenAI extends APIClient {
|
|
@@ -12062,6 +13279,14 @@ var _deployments_endpoints = new Set([
|
|
|
12062
13279
|
]);
|
|
12063
13280
|
|
|
12064
13281
|
// src/provider/core/chat.ts
|
|
13282
|
+
var getIsBrowser = () => {
|
|
13283
|
+
try {
|
|
13284
|
+
return false;
|
|
13285
|
+
} catch (e2) {
|
|
13286
|
+
return false;
|
|
13287
|
+
}
|
|
13288
|
+
};
|
|
13289
|
+
|
|
12065
13290
|
class BaseChat {
|
|
12066
13291
|
baseURL;
|
|
12067
13292
|
model;
|
|
@@ -12075,7 +13300,8 @@ class BaseChat {
|
|
|
12075
13300
|
this.baseURL = options.baseURL;
|
|
12076
13301
|
this.model = options.model;
|
|
12077
13302
|
this.apiKey = options.apiKey;
|
|
12078
|
-
|
|
13303
|
+
const DEFAULT_IS_BROWSER = getIsBrowser();
|
|
13304
|
+
this.isBrowser = options.isBrowser ?? DEFAULT_IS_BROWSER;
|
|
12079
13305
|
this.openai = new OpenAI({
|
|
12080
13306
|
apiKey: this.apiKey,
|
|
12081
13307
|
baseURL: this.baseURL,
|
|
@@ -12220,14 +13446,14 @@ class ModelScope extends BaseChat {
|
|
|
12220
13446
|
}
|
|
12221
13447
|
}
|
|
12222
13448
|
|
|
12223
|
-
// src/provider/
|
|
13449
|
+
// src/provider/chat.ts
|
|
12224
13450
|
var OllamaProvider = Ollama;
|
|
12225
13451
|
var SiliconFlowProvider = SiliconFlow;
|
|
12226
13452
|
var CustomProvider = Custom;
|
|
12227
13453
|
var VolcesProvider = Volces;
|
|
12228
13454
|
var DeepSeekProvider = DeepSeek;
|
|
12229
13455
|
var ModelScopeProvider = ModelScope;
|
|
12230
|
-
var
|
|
13456
|
+
var ChatProviderMap = {
|
|
12231
13457
|
Ollama: OllamaProvider,
|
|
12232
13458
|
SiliconFlow: SiliconFlowProvider,
|
|
12233
13459
|
Custom: CustomProvider,
|
|
@@ -12241,7 +13467,7 @@ class ProviderManager {
|
|
|
12241
13467
|
provider;
|
|
12242
13468
|
constructor(config) {
|
|
12243
13469
|
const { provider, model, apiKey, baseURL } = config;
|
|
12244
|
-
const Provider =
|
|
13470
|
+
const Provider = ChatProviderMap[provider];
|
|
12245
13471
|
if (!Provider) {
|
|
12246
13472
|
throw new Error(`Provider ${provider} not found`);
|
|
12247
13473
|
}
|
|
@@ -12266,15 +13492,196 @@ class ProviderManager {
|
|
|
12266
13492
|
return this.provider.chat(messages);
|
|
12267
13493
|
}
|
|
12268
13494
|
}
|
|
13495
|
+
// src/provider/knowledge-adapter/knowledge-base.ts
|
|
13496
|
+
class KnowledgeBase extends BaseChat {
|
|
13497
|
+
embeddingModel;
|
|
13498
|
+
splitSize;
|
|
13499
|
+
splitOverlap;
|
|
13500
|
+
batchSize;
|
|
13501
|
+
constructor(options) {
|
|
13502
|
+
super(options);
|
|
13503
|
+
this.embeddingModel = options.embeddingModel;
|
|
13504
|
+
this.splitSize = options.splitSize || 2000;
|
|
13505
|
+
this.splitOverlap = options.splitOverlap || 200;
|
|
13506
|
+
this.prompt_tokens = 0;
|
|
13507
|
+
this.total_tokens = 0;
|
|
13508
|
+
this.batchSize = options.batchSize || 4;
|
|
13509
|
+
}
|
|
13510
|
+
async generateEmbedding(text) {
|
|
13511
|
+
try {
|
|
13512
|
+
const res = await this.generateEmbeddingCore(text, { model: this.embeddingModel });
|
|
13513
|
+
return { code: 200, data: res.data };
|
|
13514
|
+
} catch (error) {
|
|
13515
|
+
const has413 = error?.message?.includes("413");
|
|
13516
|
+
if (has413) {
|
|
13517
|
+
return {
|
|
13518
|
+
code: 413,
|
|
13519
|
+
message: "请求过大,请分割文本"
|
|
13520
|
+
};
|
|
13521
|
+
}
|
|
13522
|
+
return {
|
|
13523
|
+
code: error?.code || 500,
|
|
13524
|
+
message: "生成embedding失败"
|
|
13525
|
+
};
|
|
13526
|
+
}
|
|
13527
|
+
}
|
|
13528
|
+
async generateEmbeddingBatch(textArray) {
|
|
13529
|
+
const batchSize = this.batchSize || 4;
|
|
13530
|
+
const embeddings = [];
|
|
13531
|
+
for (let i2 = 0;i2 < textArray.length; i2 += batchSize) {
|
|
13532
|
+
const batch = textArray.slice(i2, i2 + batchSize);
|
|
13533
|
+
const res = await this.generateEmbedding(batch);
|
|
13534
|
+
if (res.code === 200) {
|
|
13535
|
+
embeddings.push(...res.data.map((item) => item.embedding));
|
|
13536
|
+
}
|
|
13537
|
+
}
|
|
13538
|
+
return embeddings;
|
|
13539
|
+
}
|
|
13540
|
+
async splitLongText(text) {
|
|
13541
|
+
const chunks = [];
|
|
13542
|
+
let startIndex = 0;
|
|
13543
|
+
while (startIndex < text.length) {
|
|
13544
|
+
const endIndex = Math.min(startIndex + this.splitSize, text.length);
|
|
13545
|
+
const chunk = text.substring(startIndex, endIndex);
|
|
13546
|
+
chunks.push(chunk);
|
|
13547
|
+
startIndex = endIndex - this.splitOverlap;
|
|
13548
|
+
if (startIndex >= text.length - this.splitOverlap) {
|
|
13549
|
+
break;
|
|
13550
|
+
}
|
|
13551
|
+
}
|
|
13552
|
+
const embeddings = await this.generateEmbeddingBatch(chunks);
|
|
13553
|
+
return chunks.map((chunk, index) => ({
|
|
13554
|
+
text: chunk,
|
|
13555
|
+
embedding: embeddings[index]
|
|
13556
|
+
}));
|
|
13557
|
+
}
|
|
13558
|
+
}
|
|
13559
|
+
|
|
13560
|
+
// src/provider/knowledge-adapter/siliconflow.ts
|
|
13561
|
+
class SiliconFlowKnowledge extends KnowledgeBase {
|
|
13562
|
+
static BASE_URL = "https://api.siliconflow.cn/v1";
|
|
13563
|
+
constructor(options) {
|
|
13564
|
+
super({ ...options, baseURL: options?.baseURL ?? SiliconFlowKnowledge.BASE_URL });
|
|
13565
|
+
}
|
|
13566
|
+
async rerank(data) {
|
|
13567
|
+
return this.openai.post("/rerank", {
|
|
13568
|
+
body: data
|
|
13569
|
+
});
|
|
13570
|
+
}
|
|
13571
|
+
}
|
|
13572
|
+
// src/provider/utils/parse-config.ts
|
|
13573
|
+
var import_aes = __toESM(require_aes(), 1);
|
|
13574
|
+
var import_enc_utf8 = __toESM(require_enc_utf8(), 1);
|
|
13575
|
+
var CryptoJS = { AES: import_aes.default, enc: { Utf8: import_enc_utf8.default } };
|
|
13576
|
+
function encryptAES(plainText, secretKey) {
|
|
13577
|
+
return CryptoJS.AES.encrypt(plainText, secretKey).toString();
|
|
13578
|
+
}
|
|
13579
|
+
function decryptAES(cipherText, secretKey) {
|
|
13580
|
+
const bytes = CryptoJS.AES.decrypt(cipherText, secretKey);
|
|
13581
|
+
return bytes.toString(CryptoJS.enc.Utf8);
|
|
13582
|
+
}
|
|
13583
|
+
|
|
13584
|
+
class AIConfigParser {
|
|
13585
|
+
config;
|
|
13586
|
+
result;
|
|
13587
|
+
constructor(config) {
|
|
13588
|
+
this.config = config;
|
|
13589
|
+
}
|
|
13590
|
+
getProvider(opts) {
|
|
13591
|
+
const { model, group, decryptKey } = opts;
|
|
13592
|
+
const modelConfig = this.config.models.find((m2) => m2.model === model && m2.group === group);
|
|
13593
|
+
const groupConfig = this.config.secretKeys.find((m2) => m2.group === group);
|
|
13594
|
+
if (!modelConfig) {
|
|
13595
|
+
throw new Error(`在模型组 ${group} 中未找到模型 ${model}`);
|
|
13596
|
+
}
|
|
13597
|
+
const mergeConfig = {
|
|
13598
|
+
...modelConfig,
|
|
13599
|
+
...groupConfig,
|
|
13600
|
+
decryptKey: decryptKey || groupConfig?.decryptKey
|
|
13601
|
+
};
|
|
13602
|
+
if (!mergeConfig.provider) {
|
|
13603
|
+
throw new Error(`模型 ${model} 未配置提供商`);
|
|
13604
|
+
}
|
|
13605
|
+
if (!mergeConfig.model) {
|
|
13606
|
+
throw new Error(`模型 ${model} 未配置模型名称`);
|
|
13607
|
+
}
|
|
13608
|
+
if (!mergeConfig.apiKey) {
|
|
13609
|
+
throw new Error(`组 ${group} 未配置 API 密钥`);
|
|
13610
|
+
}
|
|
13611
|
+
if (!mergeConfig.group) {
|
|
13612
|
+
throw new Error(`组 ${group} 未配置`);
|
|
13613
|
+
}
|
|
13614
|
+
this.result = mergeConfig;
|
|
13615
|
+
return mergeConfig;
|
|
13616
|
+
}
|
|
13617
|
+
async getSecretKey(opts) {
|
|
13618
|
+
const { getCache, setCache, providerResult } = opts || {};
|
|
13619
|
+
const { apiKey, decryptKey, group = "", model } = providerResult || this.result;
|
|
13620
|
+
const cacheKey = `${group}--${model}`;
|
|
13621
|
+
if (!decryptKey) {
|
|
13622
|
+
return apiKey;
|
|
13623
|
+
}
|
|
13624
|
+
if (getCache) {
|
|
13625
|
+
const cache = await getCache(cacheKey);
|
|
13626
|
+
if (cache) {
|
|
13627
|
+
return cache;
|
|
13628
|
+
}
|
|
13629
|
+
}
|
|
13630
|
+
const secretKey = decryptAES(apiKey, decryptKey);
|
|
13631
|
+
if (setCache) {
|
|
13632
|
+
await setCache(cacheKey, secretKey);
|
|
13633
|
+
}
|
|
13634
|
+
return secretKey;
|
|
13635
|
+
}
|
|
13636
|
+
encrypt(plainText, secretKey) {
|
|
13637
|
+
return encryptAES(plainText, secretKey);
|
|
13638
|
+
}
|
|
13639
|
+
decrypt(cipherText, secretKey) {
|
|
13640
|
+
return decryptAES(cipherText, secretKey);
|
|
13641
|
+
}
|
|
13642
|
+
getSelectOpts() {
|
|
13643
|
+
const { models, secretKeys = [] } = this.config;
|
|
13644
|
+
return models.map((model) => {
|
|
13645
|
+
const selectOpts = secretKeys.find((m2) => m2.group === model.group);
|
|
13646
|
+
return {
|
|
13647
|
+
...model,
|
|
13648
|
+
...selectOpts
|
|
13649
|
+
};
|
|
13650
|
+
});
|
|
13651
|
+
}
|
|
13652
|
+
getConfig(keepSecret, config) {
|
|
13653
|
+
const chatConfig = config ?? this.config;
|
|
13654
|
+
if (keepSecret) {
|
|
13655
|
+
return chatConfig;
|
|
13656
|
+
}
|
|
13657
|
+
const { secretKeys = [], ...rest } = chatConfig || {};
|
|
13658
|
+
return {
|
|
13659
|
+
...rest,
|
|
13660
|
+
secretKeys: secretKeys.map((item) => {
|
|
13661
|
+
return {
|
|
13662
|
+
...item,
|
|
13663
|
+
apiKey: undefined,
|
|
13664
|
+
decryptKey: undefined
|
|
13665
|
+
};
|
|
13666
|
+
})
|
|
13667
|
+
};
|
|
13668
|
+
}
|
|
13669
|
+
}
|
|
12269
13670
|
export {
|
|
12270
13671
|
readStream,
|
|
13672
|
+
getIsBrowser,
|
|
13673
|
+
encryptAES,
|
|
13674
|
+
decryptAES,
|
|
12271
13675
|
VolcesProvider,
|
|
12272
13676
|
SiliconFlowProvider,
|
|
12273
|
-
|
|
13677
|
+
SiliconFlowKnowledge,
|
|
12274
13678
|
ProviderManager,
|
|
12275
13679
|
OllamaProvider,
|
|
12276
13680
|
ModelScopeProvider,
|
|
13681
|
+
KnowledgeBase,
|
|
12277
13682
|
DeepSeekProvider,
|
|
12278
13683
|
CustomProvider,
|
|
12279
|
-
|
|
13684
|
+
ChatProviderMap,
|
|
13685
|
+
BaseChat,
|
|
13686
|
+
AIConfigParser
|
|
12280
13687
|
};
|