@spacex110/core 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +59 -1
- package/dist/index.js +1066 -966
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +2 -2
- package/src/channel-manager.ts +151 -0
- package/src/strategies.ts +9 -6
package/dist/index.js
CHANGED
|
@@ -282,11 +282,11 @@ const na = {
|
|
|
282
282
|
function t0(p) {
|
|
283
283
|
return re[p];
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function or() {
|
|
286
286
|
return Object.values(re);
|
|
287
287
|
}
|
|
288
288
|
function _r(p) {
|
|
289
|
-
return
|
|
289
|
+
return or().filter((r) => r.apiFormat === p);
|
|
290
290
|
}
|
|
291
291
|
const wr = {
|
|
292
292
|
[H.OPENAI]: [
|
|
@@ -482,57 +482,57 @@ function kr(p) {
|
|
|
482
482
|
return /^o\d/.test(p) || /reasoner|thinking|o1|o3|o4/i.test(p);
|
|
483
483
|
}
|
|
484
484
|
function le(p) {
|
|
485
|
-
const
|
|
486
|
-
if (
|
|
487
|
-
return
|
|
485
|
+
const r = /* @__PURE__ */ new Set(), t = p.input_modalities || [];
|
|
486
|
+
if (t.length > 0)
|
|
487
|
+
return t.some((u) => /text/i.test(u)) && r.add("text"), t.some((u) => /image|vision/i.test(u)) && r.add("vision"), t.some((u) => /audio/i.test(u)) && r.add("audio"), t.some((u) => /video/i.test(u)) && r.add("video"), r.size === 0 && r.add("text"), Array.from(r);
|
|
488
488
|
const e = p.capabilities;
|
|
489
|
-
if (e && ((e.vision || e.image) && (
|
|
490
|
-
return Array.from(
|
|
491
|
-
const
|
|
492
|
-
return
|
|
489
|
+
if (e && ((e.vision || e.image) && (r.add("vision"), r.add("text")), e.audio && r.add("audio"), e.video && r.add("video"), e.embeddings && r.add("embedding"), r.size > 0))
|
|
490
|
+
return Array.from(r);
|
|
491
|
+
const s = (p.id || "").toLowerCase(), c = (p.name || "").toLowerCase(), b = `${s} ${c}`;
|
|
492
|
+
return r.add("text"), /vision|image|visual|multimodal|vl|pixtral|llava|bakllava/.test(b) && r.add("vision"), /audio|speech|whisper|tts|stt/.test(b) && r.add("audio"), /video/.test(b) && r.add("video"), /embedding|embed/.test(b) && r.add("embedding"), /reasoner|reasoning|thinking|qwq/.test(b) && r.add("reasoning"), Array.from(r);
|
|
493
493
|
}
|
|
494
|
-
const Sr = (p) => Array.isArray(p == null ? void 0 : p.data) ? p.data.filter((
|
|
495
|
-
const
|
|
494
|
+
const Sr = (p) => Array.isArray(p == null ? void 0 : p.data) ? p.data.filter((r) => r.id).map((r) => {
|
|
495
|
+
const t = r.name || r.display_name || (r.id.split("/").pop() ?? "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
496
496
|
return {
|
|
497
|
-
id:
|
|
498
|
-
name:
|
|
499
|
-
created:
|
|
500
|
-
contextLength:
|
|
501
|
-
capabilities: le(
|
|
497
|
+
id: r.id,
|
|
498
|
+
name: t,
|
|
499
|
+
created: r.created || 0,
|
|
500
|
+
contextLength: r.context_length || r.max_context || void 0,
|
|
501
|
+
capabilities: le(r)
|
|
502
502
|
};
|
|
503
|
-
}).sort((
|
|
504
|
-
const e = (
|
|
505
|
-
return e !== 0 ? e : (
|
|
503
|
+
}).sort((r, t) => {
|
|
504
|
+
const e = (t.created || 0) - (r.created || 0);
|
|
505
|
+
return e !== 0 ? e : (t.id || "").localeCompare(r.id || "");
|
|
506
506
|
}) : [], xr = {
|
|
507
507
|
format: "openai",
|
|
508
508
|
getModelsEndpoint: (p) => `${p}/models`,
|
|
509
509
|
getChatEndpoint: (p) => `${p}/chat/completions`,
|
|
510
|
-
buildHeaders: (p) => {
|
|
510
|
+
buildHeaders: (p, r) => {
|
|
511
511
|
const t = {
|
|
512
512
|
"Content-Type": "application/json",
|
|
513
513
|
Authorization: `Bearer ${p}`
|
|
514
514
|
};
|
|
515
|
-
if (typeof window < "u" && window.location) {
|
|
515
|
+
if (!!r && /openrouter\.ai/i.test(r) && typeof window < "u" && window.location) {
|
|
516
516
|
t["HTTP-Referer"] = window.location.origin;
|
|
517
|
-
const
|
|
518
|
-
t["X-Title"] =
|
|
517
|
+
const s = document.title ? document.title.replace(/[^\x20-\x7E]/g, "").slice(0, 80) : "AI Selector";
|
|
518
|
+
t["X-Title"] = s || "AI Selector";
|
|
519
519
|
}
|
|
520
520
|
return t;
|
|
521
521
|
},
|
|
522
|
-
buildChatPayload: (p,
|
|
522
|
+
buildChatPayload: (p, r, t) => {
|
|
523
523
|
const e = {
|
|
524
524
|
model: p,
|
|
525
|
-
messages:
|
|
525
|
+
messages: r
|
|
526
526
|
};
|
|
527
|
-
return
|
|
527
|
+
return t && (e[kr(p) ? "max_completion_tokens" : "max_tokens"] = t), e;
|
|
528
528
|
},
|
|
529
529
|
parseChatResponse: (p) => {
|
|
530
|
-
var
|
|
531
|
-
return ((e = (
|
|
530
|
+
var r, t, e;
|
|
531
|
+
return ((e = (t = (r = p.choices) == null ? void 0 : r[0]) == null ? void 0 : t.message) == null ? void 0 : e.content) || "";
|
|
532
532
|
},
|
|
533
533
|
parseStreamChunk: (p) => {
|
|
534
|
-
var
|
|
535
|
-
return ((e = (
|
|
534
|
+
var r, t, e;
|
|
535
|
+
return ((e = (t = (r = p.choices) == null ? void 0 : r[0]) == null ? void 0 : t.delta) == null ? void 0 : e.content) || "";
|
|
536
536
|
}
|
|
537
537
|
}, Pr = {
|
|
538
538
|
format: "anthropic",
|
|
@@ -545,60 +545,60 @@ const Sr = (p) => Array.isArray(p == null ? void 0 : p.data) ? p.data.filter((t)
|
|
|
545
545
|
"anthropic-dangerous-direct-browser-access": "true"
|
|
546
546
|
// 启用浏览器直连 CORS
|
|
547
547
|
}),
|
|
548
|
-
buildChatPayload: (p,
|
|
548
|
+
buildChatPayload: (p, r, t) => ({
|
|
549
549
|
model: p,
|
|
550
|
-
messages:
|
|
551
|
-
max_tokens:
|
|
550
|
+
messages: r,
|
|
551
|
+
max_tokens: t || 1024
|
|
552
552
|
// Anthropic API 强制要求 max_tokens
|
|
553
553
|
}),
|
|
554
554
|
parseChatResponse: (p) => {
|
|
555
|
-
var
|
|
556
|
-
return ((
|
|
555
|
+
var r, t;
|
|
556
|
+
return ((t = (r = p.content) == null ? void 0 : r[0]) == null ? void 0 : t.text) || "";
|
|
557
557
|
},
|
|
558
558
|
parseStreamChunk: (p) => {
|
|
559
|
-
var
|
|
560
|
-
return p.type === "content_block_delta" && ((
|
|
559
|
+
var r;
|
|
560
|
+
return p.type === "content_block_delta" && ((r = p.delta) == null ? void 0 : r.text) || "";
|
|
561
561
|
},
|
|
562
562
|
// Anthropic 返回: { data: [{ id, display_name, created_at }] }
|
|
563
|
-
parseModelsResponse: (p) => Array.isArray(p.data) ? p.data.filter((
|
|
564
|
-
id:
|
|
565
|
-
name:
|
|
566
|
-
created:
|
|
567
|
-
capabilities: le(
|
|
568
|
-
})).sort((
|
|
563
|
+
parseModelsResponse: (p) => Array.isArray(p.data) ? p.data.filter((r) => r.id).map((r) => ({
|
|
564
|
+
id: r.id,
|
|
565
|
+
name: r.display_name || r.id,
|
|
566
|
+
created: r.created_at ? new Date(r.created_at).getTime() / 1e3 : 0,
|
|
567
|
+
capabilities: le(r)
|
|
568
|
+
})).sort((r, t) => (t.created || 0) - (r.created || 0)) : []
|
|
569
569
|
}, Ir = {
|
|
570
570
|
format: "gemini",
|
|
571
|
-
getModelsEndpoint: (p,
|
|
572
|
-
getChatEndpoint: (p,
|
|
571
|
+
getModelsEndpoint: (p, r) => `${p}/models?key=${r}`,
|
|
572
|
+
getChatEndpoint: (p, r, t) => `${p}/models/${t}:generateContent?key=${r}`,
|
|
573
573
|
buildHeaders: () => ({
|
|
574
574
|
"Content-Type": "application/json"
|
|
575
575
|
}),
|
|
576
|
-
buildChatPayload: (p,
|
|
577
|
-
const
|
|
578
|
-
role:
|
|
579
|
-
parts: [{ text:
|
|
576
|
+
buildChatPayload: (p, r, t) => {
|
|
577
|
+
const s = { contents: r.map((c) => ({
|
|
578
|
+
role: c.role === "assistant" ? "model" : "user",
|
|
579
|
+
parts: [{ text: c.content }]
|
|
580
580
|
})) };
|
|
581
|
-
return
|
|
581
|
+
return t && (s.generationConfig = { maxOutputTokens: t }), s;
|
|
582
582
|
},
|
|
583
583
|
parseChatResponse: (p) => {
|
|
584
|
-
var
|
|
585
|
-
return ((
|
|
584
|
+
var r, t, e, s, c;
|
|
585
|
+
return ((c = (s = (e = (t = (r = p.candidates) == null ? void 0 : r[0]) == null ? void 0 : t.content) == null ? void 0 : e.parts) == null ? void 0 : s[0]) == null ? void 0 : c.text) || "";
|
|
586
586
|
},
|
|
587
587
|
parseStreamChunk: (p) => {
|
|
588
|
-
var
|
|
589
|
-
return ((
|
|
588
|
+
var r, t, e, s, c;
|
|
589
|
+
return ((c = (s = (e = (t = (r = p.candidates) == null ? void 0 : r[0]) == null ? void 0 : t.content) == null ? void 0 : e.parts) == null ? void 0 : s[0]) == null ? void 0 : c.text) || "";
|
|
590
590
|
},
|
|
591
591
|
// Gemini 返回格式: { models: [{ name: "models/gemini-pro", ... }] }
|
|
592
|
-
parseModelsResponse: (p) => Array.isArray(p.models) ? p.models.filter((
|
|
593
|
-
var
|
|
594
|
-
return (
|
|
595
|
-
}).map((
|
|
596
|
-
id:
|
|
592
|
+
parseModelsResponse: (p) => Array.isArray(p.models) ? p.models.filter((r) => {
|
|
593
|
+
var t;
|
|
594
|
+
return (t = r.supportedGenerationMethods) == null ? void 0 : t.includes("generateContent");
|
|
595
|
+
}).map((r) => ({
|
|
596
|
+
id: r.name.replace("models/", ""),
|
|
597
597
|
// "models/gemini-pro" -> "gemini-pro"
|
|
598
|
-
name:
|
|
599
|
-
created:
|
|
600
|
-
capabilities: le(
|
|
601
|
-
})).sort((
|
|
598
|
+
name: r.displayName || r.name.replace("models/", ""),
|
|
599
|
+
created: r.created || 0,
|
|
600
|
+
capabilities: le(r)
|
|
601
|
+
})).sort((r, t) => (t.id || "").localeCompare(r.id || "")) : []
|
|
602
602
|
}, Rr = {
|
|
603
603
|
format: "cohere",
|
|
604
604
|
getModelsEndpoint: (p) => `${p}/models`,
|
|
@@ -607,20 +607,20 @@ const Sr = (p) => Array.isArray(p == null ? void 0 : p.data) ? p.data.filter((t)
|
|
|
607
607
|
"Content-Type": "application/json",
|
|
608
608
|
Authorization: `Bearer ${p}`
|
|
609
609
|
}),
|
|
610
|
-
buildChatPayload: (p,
|
|
610
|
+
buildChatPayload: (p, r, t) => {
|
|
611
611
|
const e = {
|
|
612
612
|
model: p,
|
|
613
|
-
messages:
|
|
613
|
+
messages: r
|
|
614
614
|
};
|
|
615
|
-
return
|
|
615
|
+
return t && (e.max_tokens = t), e;
|
|
616
616
|
},
|
|
617
617
|
parseChatResponse: (p) => {
|
|
618
|
-
var
|
|
619
|
-
return ((e = (
|
|
618
|
+
var r, t, e;
|
|
619
|
+
return ((e = (t = (r = p.message) == null ? void 0 : r.content) == null ? void 0 : t[0]) == null ? void 0 : e.text) || "";
|
|
620
620
|
},
|
|
621
621
|
parseStreamChunk: (p) => {
|
|
622
|
-
var
|
|
623
|
-
return p.type === "content-delta" && ((
|
|
622
|
+
var r, t, e, s;
|
|
623
|
+
return p.type === "content-delta" && ((s = (e = (t = (r = p.delta) == null ? void 0 : r.message) == null ? void 0 : t.content) == null ? void 0 : e[0]) == null ? void 0 : s.text) || "";
|
|
624
624
|
}
|
|
625
625
|
}, Hr = {
|
|
626
626
|
openai: xr,
|
|
@@ -633,40 +633,40 @@ function ae(p) {
|
|
|
633
633
|
}
|
|
634
634
|
async function cr(p) {
|
|
635
635
|
var i;
|
|
636
|
-
const { apiFormat:
|
|
636
|
+
const { apiFormat: r, baseUrl: t, apiKey: e, model: s, messages: c, maxTokens: b } = p, u = ae(r), f = u.getChatEndpoint(t, e, s), a = u.buildHeaders(e, t), n = u.buildChatPayload(s, c, b), B = performance.now();
|
|
637
637
|
try {
|
|
638
|
-
const
|
|
638
|
+
const l = await fetch(f, {
|
|
639
639
|
method: "POST",
|
|
640
640
|
headers: a,
|
|
641
641
|
body: JSON.stringify(n)
|
|
642
|
-
}),
|
|
643
|
-
if (!
|
|
642
|
+
}), d = Math.round(performance.now() - B);
|
|
643
|
+
if (!l.ok)
|
|
644
644
|
return {
|
|
645
645
|
success: !1,
|
|
646
|
-
message: ((i = (await
|
|
647
|
-
latencyMs:
|
|
646
|
+
message: ((i = (await l.json().catch(() => ({}))).error) == null ? void 0 : i.message) || `HTTP ${l.status}: ${l.statusText}`,
|
|
647
|
+
latencyMs: d
|
|
648
648
|
};
|
|
649
|
-
const C = await
|
|
649
|
+
const C = await l.json();
|
|
650
650
|
return {
|
|
651
651
|
success: !0,
|
|
652
652
|
content: u.parseChatResponse(C),
|
|
653
|
-
latencyMs:
|
|
653
|
+
latencyMs: d
|
|
654
654
|
};
|
|
655
|
-
} catch (
|
|
655
|
+
} catch (l) {
|
|
656
656
|
return {
|
|
657
657
|
success: !1,
|
|
658
|
-
message:
|
|
658
|
+
message: l instanceof Error ? l.message : "网络错误"
|
|
659
659
|
};
|
|
660
660
|
}
|
|
661
661
|
}
|
|
662
662
|
async function Mr(p) {
|
|
663
|
-
var
|
|
664
|
-
const { apiFormat:
|
|
665
|
-
let n = a.getChatEndpoint(
|
|
666
|
-
|
|
667
|
-
const B = a.buildHeaders(e), i = a.buildChatPayload(
|
|
663
|
+
var d;
|
|
664
|
+
const { apiFormat: r, baseUrl: t, apiKey: e, model: s, messages: c, maxTokens: b, onDelta: u, signal: f } = p, a = ae(r);
|
|
665
|
+
let n = a.getChatEndpoint(t, e, s);
|
|
666
|
+
r === "gemini" && (n = `${t}/models/${s}:streamGenerateContent?alt=sse&key=${encodeURIComponent(e)}`);
|
|
667
|
+
const B = a.buildHeaders(e, t), i = a.buildChatPayload(s, c, b);
|
|
668
668
|
i.stream = !0;
|
|
669
|
-
const
|
|
669
|
+
const l = performance.now();
|
|
670
670
|
try {
|
|
671
671
|
const C = await fetch(n, {
|
|
672
672
|
method: "POST",
|
|
@@ -679,14 +679,14 @@ async function Mr(p) {
|
|
|
679
679
|
let F = `HTTP ${C.status}`;
|
|
680
680
|
try {
|
|
681
681
|
const E = JSON.parse(v);
|
|
682
|
-
F = ((
|
|
682
|
+
F = ((d = E.error) == null ? void 0 : d.message) || E.error || E.message || F;
|
|
683
683
|
} catch {
|
|
684
684
|
v && (F = v.slice(0, 200));
|
|
685
685
|
}
|
|
686
|
-
return { success: !1, message: F, latencyMs: Math.round(performance.now() -
|
|
686
|
+
return { success: !1, message: F, latencyMs: Math.round(performance.now() - l) };
|
|
687
687
|
}
|
|
688
688
|
const h = C.body.getReader(), A = new TextDecoder();
|
|
689
|
-
let o = "",
|
|
689
|
+
let o = "", x = "";
|
|
690
690
|
for (; ; ) {
|
|
691
691
|
const { done: v, value: F } = await h.read();
|
|
692
692
|
if (v) break;
|
|
@@ -701,21 +701,21 @@ async function Mr(p) {
|
|
|
701
701
|
if (!(!R || R === "[DONE]"))
|
|
702
702
|
try {
|
|
703
703
|
const m = JSON.parse(R), D = a.parseStreamChunk ? a.parseStreamChunk(m) : "";
|
|
704
|
-
D && (
|
|
704
|
+
D && (x += D, u(x));
|
|
705
705
|
} catch {
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
|
-
return { success: !0, content:
|
|
709
|
+
return { success: !0, content: x, latencyMs: Math.round(performance.now() - l) };
|
|
710
710
|
} catch (C) {
|
|
711
|
-
return C instanceof Error && C.name === "AbortError" ? { success: !1, message: "请求已取消", latencyMs: Math.round(performance.now() -
|
|
711
|
+
return C instanceof Error && C.name === "AbortError" ? { success: !1, message: "请求已取消", latencyMs: Math.round(performance.now() - l) } : {
|
|
712
712
|
success: !1,
|
|
713
713
|
message: C instanceof Error ? C.message : "网络错误"
|
|
714
714
|
};
|
|
715
715
|
}
|
|
716
716
|
}
|
|
717
717
|
async function Or(p) {
|
|
718
|
-
const
|
|
718
|
+
const r = await cr({
|
|
719
719
|
apiFormat: p.apiFormat,
|
|
720
720
|
baseUrl: p.baseUrl,
|
|
721
721
|
apiKey: p.apiKey,
|
|
@@ -724,24 +724,24 @@ async function Or(p) {
|
|
|
724
724
|
// maxTokens: 5, // 不设置 maxTokens 以兼容 o1 等不支持该参数的模型
|
|
725
725
|
});
|
|
726
726
|
return {
|
|
727
|
-
success:
|
|
728
|
-
latencyMs:
|
|
729
|
-
message:
|
|
727
|
+
success: r.success,
|
|
728
|
+
latencyMs: r.latencyMs,
|
|
729
|
+
message: r.success ? void 0 : r.message
|
|
730
730
|
};
|
|
731
731
|
}
|
|
732
|
-
async function
|
|
733
|
-
const { provider:
|
|
732
|
+
async function sa(p) {
|
|
733
|
+
const { provider: r, apiKey: t, model: e, baseUrl: s, proxyUrl: c } = p, b = s || r.baseUrl, u = Date.now();
|
|
734
734
|
try {
|
|
735
|
-
if (
|
|
736
|
-
const h = await (await fetch(`${
|
|
735
|
+
if (c) {
|
|
736
|
+
const h = await (await fetch(`${c}/test`, {
|
|
737
737
|
method: "POST",
|
|
738
738
|
headers: { "Content-Type": "application/json" },
|
|
739
739
|
body: JSON.stringify({
|
|
740
|
-
provider_id:
|
|
741
|
-
api_key:
|
|
740
|
+
provider_id: r.id,
|
|
741
|
+
api_key: t,
|
|
742
742
|
model: e || "",
|
|
743
|
-
base_url:
|
|
744
|
-
api_format:
|
|
743
|
+
base_url: s || r.baseUrl,
|
|
744
|
+
api_format: r.apiFormat
|
|
745
745
|
})
|
|
746
746
|
})).json();
|
|
747
747
|
return {
|
|
@@ -750,26 +750,26 @@ async function oa(p) {
|
|
|
750
750
|
message: h.message
|
|
751
751
|
};
|
|
752
752
|
}
|
|
753
|
-
const f = ae(
|
|
753
|
+
const f = ae(r.apiFormat), a = e || "";
|
|
754
754
|
if (!a)
|
|
755
755
|
return {
|
|
756
756
|
success: !1,
|
|
757
757
|
latencyMs: 0,
|
|
758
758
|
message: "请先选择模型 (Please select a model)"
|
|
759
759
|
};
|
|
760
|
-
const n = f.buildHeaders(
|
|
760
|
+
const n = f.buildHeaders(t, b), B = f.buildChatPayload(a, [{ role: "user", content: "Hi" }]), i = f.getChatEndpoint(b, t, a), l = await fetch(i, {
|
|
761
761
|
method: "POST",
|
|
762
762
|
headers: n,
|
|
763
763
|
body: JSON.stringify(B)
|
|
764
|
-
}),
|
|
765
|
-
if (
|
|
766
|
-
return { success: !0, latencyMs:
|
|
764
|
+
}), d = Date.now() - u;
|
|
765
|
+
if (l.ok)
|
|
766
|
+
return { success: !0, latencyMs: d, message: "连接成功" };
|
|
767
767
|
{
|
|
768
|
-
const C = await
|
|
768
|
+
const C = await l.text();
|
|
769
769
|
return {
|
|
770
770
|
success: !1,
|
|
771
|
-
latencyMs:
|
|
772
|
-
message: `HTTP ${
|
|
771
|
+
latencyMs: d,
|
|
772
|
+
message: `HTTP ${l.status}: ${C.slice(0, 200)}`
|
|
773
773
|
};
|
|
774
774
|
}
|
|
775
775
|
} catch (f) {
|
|
@@ -780,30 +780,30 @@ async function oa(p) {
|
|
|
780
780
|
};
|
|
781
781
|
}
|
|
782
782
|
}
|
|
783
|
-
async function
|
|
783
|
+
async function $r(p) {
|
|
784
784
|
var b, u;
|
|
785
|
-
const { provider:
|
|
786
|
-
if (
|
|
785
|
+
const { provider: r, apiKey: t, baseUrl: e, proxyUrl: s, fallbackToStatic: c = !0 } = p;
|
|
786
|
+
if (s)
|
|
787
787
|
try {
|
|
788
|
-
const a = await (await fetch(`${
|
|
788
|
+
const a = await (await fetch(`${s}/models`, {
|
|
789
789
|
method: "POST",
|
|
790
790
|
headers: { "Content-Type": "application/json" },
|
|
791
791
|
body: JSON.stringify({
|
|
792
|
-
provider_id:
|
|
793
|
-
api_key:
|
|
794
|
-
base_url: e ||
|
|
792
|
+
provider_id: r.id,
|
|
793
|
+
api_key: t || void 0,
|
|
794
|
+
base_url: e || r.baseUrl
|
|
795
795
|
})
|
|
796
796
|
})).json();
|
|
797
797
|
if (a.success && ((b = a.models) == null ? void 0 : b.length) > 0)
|
|
798
798
|
return a.models;
|
|
799
799
|
} catch (f) {
|
|
800
|
-
if (console.warn("Failed to fetch models via proxy:", f), !
|
|
800
|
+
if (console.warn("Failed to fetch models via proxy:", f), !c) throw f;
|
|
801
801
|
}
|
|
802
|
-
if (!
|
|
802
|
+
if (!s && r.supportsModelsApi)
|
|
803
803
|
try {
|
|
804
|
-
const f = ae(
|
|
804
|
+
const f = ae(r.apiFormat);
|
|
805
805
|
if (f.getModelsEndpoint) {
|
|
806
|
-
const a = f.getModelsEndpoint(e ||
|
|
806
|
+
const a = f.getModelsEndpoint(e || r.baseUrl, t || ""), n = f.buildHeaders(t || "", e || r.baseUrl), B = await fetch(a, {
|
|
807
807
|
method: "GET",
|
|
808
808
|
headers: n
|
|
809
809
|
});
|
|
@@ -811,72 +811,72 @@ async function Tr(p) {
|
|
|
811
811
|
const i = await B.json();
|
|
812
812
|
return (f.parseModelsResponse || Sr)(i);
|
|
813
813
|
} else {
|
|
814
|
-
const
|
|
815
|
-
if (console.warn("Model fetch failed:",
|
|
814
|
+
const l = ((u = (await B.json().catch(() => ({}))).error) == null ? void 0 : u.message) || `HTTP ${B.status}`;
|
|
815
|
+
if (console.warn("Model fetch failed:", l), !c) throw new Error(l);
|
|
816
816
|
}
|
|
817
817
|
}
|
|
818
818
|
} catch (f) {
|
|
819
|
-
if (console.warn("Failed to fetch models directly:", f), !
|
|
819
|
+
if (console.warn("Failed to fetch models directly:", f), !c) throw f;
|
|
820
820
|
}
|
|
821
|
-
if (!
|
|
821
|
+
if (!c && r.supportsModelsApi)
|
|
822
822
|
throw new Error("Failed to fetch models");
|
|
823
|
-
return te(
|
|
823
|
+
return te(r.id);
|
|
824
824
|
}
|
|
825
|
-
var
|
|
826
|
-
function
|
|
825
|
+
var oe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
826
|
+
function Tr(p) {
|
|
827
827
|
return p && p.__esModule && Object.prototype.hasOwnProperty.call(p, "default") ? p.default : p;
|
|
828
828
|
}
|
|
829
829
|
function Lr(p) {
|
|
830
830
|
if (Object.prototype.hasOwnProperty.call(p, "__esModule")) return p;
|
|
831
|
-
var
|
|
832
|
-
if (typeof
|
|
833
|
-
var
|
|
834
|
-
return this instanceof e ? Reflect.construct(
|
|
831
|
+
var r = p.default;
|
|
832
|
+
if (typeof r == "function") {
|
|
833
|
+
var t = function e() {
|
|
834
|
+
return this instanceof e ? Reflect.construct(r, arguments, this.constructor) : r.apply(this, arguments);
|
|
835
835
|
};
|
|
836
|
-
|
|
837
|
-
} else
|
|
838
|
-
return Object.defineProperty(
|
|
839
|
-
var
|
|
840
|
-
Object.defineProperty(
|
|
836
|
+
t.prototype = r.prototype;
|
|
837
|
+
} else t = {};
|
|
838
|
+
return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(p).forEach(function(e) {
|
|
839
|
+
var s = Object.getOwnPropertyDescriptor(p, e);
|
|
840
|
+
Object.defineProperty(t, e, s.get ? s : {
|
|
841
841
|
enumerable: !0,
|
|
842
842
|
get: function() {
|
|
843
843
|
return p[e];
|
|
844
844
|
}
|
|
845
845
|
});
|
|
846
|
-
}),
|
|
846
|
+
}), t;
|
|
847
847
|
}
|
|
848
848
|
var m0 = { exports: {} };
|
|
849
|
-
function
|
|
849
|
+
function Kr(p) {
|
|
850
850
|
throw new Error('Could not dynamically require "' + p + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
851
851
|
}
|
|
852
852
|
var A0 = { exports: {} };
|
|
853
|
-
const
|
|
853
|
+
const Ur = {}, qr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
854
854
|
__proto__: null,
|
|
855
|
-
default:
|
|
856
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
855
|
+
default: Ur
|
|
856
|
+
}, Symbol.toStringTag, { value: "Module" })), zr = /* @__PURE__ */ Lr(qr);
|
|
857
857
|
var Nr = A0.exports, be;
|
|
858
858
|
function L() {
|
|
859
|
-
return be || (be = 1, (function(p,
|
|
860
|
-
(function(
|
|
859
|
+
return be || (be = 1, (function(p, r) {
|
|
860
|
+
(function(t, e) {
|
|
861
861
|
p.exports = e();
|
|
862
862
|
})(Nr, function() {
|
|
863
|
-
var
|
|
864
|
-
var
|
|
865
|
-
if (typeof window < "u" && window.crypto && (
|
|
863
|
+
var t = t || (function(e, s) {
|
|
864
|
+
var c;
|
|
865
|
+
if (typeof window < "u" && window.crypto && (c = window.crypto), typeof self < "u" && self.crypto && (c = self.crypto), typeof globalThis < "u" && globalThis.crypto && (c = globalThis.crypto), !c && typeof window < "u" && window.msCrypto && (c = window.msCrypto), !c && typeof oe < "u" && oe.crypto && (c = oe.crypto), !c && typeof Kr == "function")
|
|
866
866
|
try {
|
|
867
|
-
|
|
867
|
+
c = zr;
|
|
868
868
|
} catch {
|
|
869
869
|
}
|
|
870
870
|
var b = function() {
|
|
871
|
-
if (
|
|
872
|
-
if (typeof
|
|
871
|
+
if (c) {
|
|
872
|
+
if (typeof c.getRandomValues == "function")
|
|
873
873
|
try {
|
|
874
|
-
return
|
|
874
|
+
return c.getRandomValues(new Uint32Array(1))[0];
|
|
875
875
|
} catch {
|
|
876
876
|
}
|
|
877
|
-
if (typeof
|
|
877
|
+
if (typeof c.randomBytes == "function")
|
|
878
878
|
try {
|
|
879
|
-
return
|
|
879
|
+
return c.randomBytes(4).readInt32LE();
|
|
880
880
|
} catch {
|
|
881
881
|
}
|
|
882
882
|
}
|
|
@@ -884,9 +884,9 @@ function L() {
|
|
|
884
884
|
}, u = Object.create || /* @__PURE__ */ (function() {
|
|
885
885
|
function o() {
|
|
886
886
|
}
|
|
887
|
-
return function(
|
|
887
|
+
return function(x) {
|
|
888
888
|
var v;
|
|
889
|
-
return o.prototype =
|
|
889
|
+
return o.prototype = x, v = new o(), o.prototype = null, v;
|
|
890
890
|
};
|
|
891
891
|
})(), f = {}, a = f.lib = {}, n = a.Base = /* @__PURE__ */ (function() {
|
|
892
892
|
return {
|
|
@@ -909,10 +909,10 @@ function L() {
|
|
|
909
909
|
* });
|
|
910
910
|
*/
|
|
911
911
|
extend: function(o) {
|
|
912
|
-
var
|
|
913
|
-
return o &&
|
|
914
|
-
|
|
915
|
-
}),
|
|
912
|
+
var x = u(this);
|
|
913
|
+
return o && x.mixIn(o), (!x.hasOwnProperty("init") || this.init === x.init) && (x.init = function() {
|
|
914
|
+
x.$super.init.apply(this, arguments);
|
|
915
|
+
}), x.init.prototype = x, x.$super = this, x;
|
|
916
916
|
},
|
|
917
917
|
/**
|
|
918
918
|
* Extends this object and runs the init method.
|
|
@@ -956,8 +956,8 @@ function L() {
|
|
|
956
956
|
* });
|
|
957
957
|
*/
|
|
958
958
|
mixIn: function(o) {
|
|
959
|
-
for (var
|
|
960
|
-
o.hasOwnProperty(
|
|
959
|
+
for (var x in o)
|
|
960
|
+
o.hasOwnProperty(x) && (this[x] = o[x]);
|
|
961
961
|
o.hasOwnProperty("toString") && (this.toString = o.toString);
|
|
962
962
|
},
|
|
963
963
|
/**
|
|
@@ -986,8 +986,8 @@ function L() {
|
|
|
986
986
|
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
|
|
987
987
|
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
|
|
988
988
|
*/
|
|
989
|
-
init: function(o,
|
|
990
|
-
o = this.words = o || [],
|
|
989
|
+
init: function(o, x) {
|
|
990
|
+
o = this.words = o || [], x != s ? this.sigBytes = x : this.sigBytes = o.length * 4;
|
|
991
991
|
},
|
|
992
992
|
/**
|
|
993
993
|
* Converts this word array to a string.
|
|
@@ -1003,7 +1003,7 @@ function L() {
|
|
|
1003
1003
|
* var string = wordArray.toString(CryptoJS.enc.Utf8);
|
|
1004
1004
|
*/
|
|
1005
1005
|
toString: function(o) {
|
|
1006
|
-
return (o ||
|
|
1006
|
+
return (o || l).stringify(this);
|
|
1007
1007
|
},
|
|
1008
1008
|
/**
|
|
1009
1009
|
* Concatenates a word array to this word array.
|
|
@@ -1017,15 +1017,15 @@ function L() {
|
|
|
1017
1017
|
* wordArray1.concat(wordArray2);
|
|
1018
1018
|
*/
|
|
1019
1019
|
concat: function(o) {
|
|
1020
|
-
var
|
|
1020
|
+
var x = this.words, v = o.words, F = this.sigBytes, E = o.sigBytes;
|
|
1021
1021
|
if (this.clamp(), F % 4)
|
|
1022
1022
|
for (var g = 0; g < E; g++) {
|
|
1023
1023
|
var y = v[g >>> 2] >>> 24 - g % 4 * 8 & 255;
|
|
1024
|
-
|
|
1024
|
+
x[F + g >>> 2] |= y << 24 - (F + g) % 4 * 8;
|
|
1025
1025
|
}
|
|
1026
1026
|
else
|
|
1027
1027
|
for (var R = 0; R < E; R += 4)
|
|
1028
|
-
|
|
1028
|
+
x[F + R >>> 2] = v[R >>> 2];
|
|
1029
1029
|
return this.sigBytes += E, this;
|
|
1030
1030
|
},
|
|
1031
1031
|
/**
|
|
@@ -1036,8 +1036,8 @@ function L() {
|
|
|
1036
1036
|
* wordArray.clamp();
|
|
1037
1037
|
*/
|
|
1038
1038
|
clamp: function() {
|
|
1039
|
-
var o = this.words,
|
|
1040
|
-
o[
|
|
1039
|
+
var o = this.words, x = this.sigBytes;
|
|
1040
|
+
o[x >>> 2] &= 4294967295 << 32 - x % 4 * 8, o.length = e.ceil(x / 4);
|
|
1041
1041
|
},
|
|
1042
1042
|
/**
|
|
1043
1043
|
* Creates a copy of this word array.
|
|
@@ -1066,11 +1066,11 @@ function L() {
|
|
|
1066
1066
|
* var wordArray = CryptoJS.lib.WordArray.random(16);
|
|
1067
1067
|
*/
|
|
1068
1068
|
random: function(o) {
|
|
1069
|
-
for (var
|
|
1070
|
-
|
|
1071
|
-
return new B.init(
|
|
1069
|
+
for (var x = [], v = 0; v < o; v += 4)
|
|
1070
|
+
x.push(b());
|
|
1071
|
+
return new B.init(x, o);
|
|
1072
1072
|
}
|
|
1073
|
-
}), i = f.enc = {},
|
|
1073
|
+
}), i = f.enc = {}, l = i.Hex = {
|
|
1074
1074
|
/**
|
|
1075
1075
|
* Converts a word array to a hex string.
|
|
1076
1076
|
*
|
|
@@ -1085,8 +1085,8 @@ function L() {
|
|
|
1085
1085
|
* var hexString = CryptoJS.enc.Hex.stringify(wordArray);
|
|
1086
1086
|
*/
|
|
1087
1087
|
stringify: function(o) {
|
|
1088
|
-
for (var
|
|
1089
|
-
var g =
|
|
1088
|
+
for (var x = o.words, v = o.sigBytes, F = [], E = 0; E < v; E++) {
|
|
1089
|
+
var g = x[E >>> 2] >>> 24 - E % 4 * 8 & 255;
|
|
1090
1090
|
F.push((g >>> 4).toString(16)), F.push((g & 15).toString(16));
|
|
1091
1091
|
}
|
|
1092
1092
|
return F.join("");
|
|
@@ -1105,11 +1105,11 @@ function L() {
|
|
|
1105
1105
|
* var wordArray = CryptoJS.enc.Hex.parse(hexString);
|
|
1106
1106
|
*/
|
|
1107
1107
|
parse: function(o) {
|
|
1108
|
-
for (var
|
|
1108
|
+
for (var x = o.length, v = [], F = 0; F < x; F += 2)
|
|
1109
1109
|
v[F >>> 3] |= parseInt(o.substr(F, 2), 16) << 24 - F % 8 * 4;
|
|
1110
|
-
return new B.init(v,
|
|
1110
|
+
return new B.init(v, x / 2);
|
|
1111
1111
|
}
|
|
1112
|
-
},
|
|
1112
|
+
}, d = i.Latin1 = {
|
|
1113
1113
|
/**
|
|
1114
1114
|
* Converts a word array to a Latin1 string.
|
|
1115
1115
|
*
|
|
@@ -1124,8 +1124,8 @@ function L() {
|
|
|
1124
1124
|
* var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
|
|
1125
1125
|
*/
|
|
1126
1126
|
stringify: function(o) {
|
|
1127
|
-
for (var
|
|
1128
|
-
var g =
|
|
1127
|
+
for (var x = o.words, v = o.sigBytes, F = [], E = 0; E < v; E++) {
|
|
1128
|
+
var g = x[E >>> 2] >>> 24 - E % 4 * 8 & 255;
|
|
1129
1129
|
F.push(String.fromCharCode(g));
|
|
1130
1130
|
}
|
|
1131
1131
|
return F.join("");
|
|
@@ -1144,9 +1144,9 @@ function L() {
|
|
|
1144
1144
|
* var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
|
|
1145
1145
|
*/
|
|
1146
1146
|
parse: function(o) {
|
|
1147
|
-
for (var
|
|
1147
|
+
for (var x = o.length, v = [], F = 0; F < x; F++)
|
|
1148
1148
|
v[F >>> 2] |= (o.charCodeAt(F) & 255) << 24 - F % 4 * 8;
|
|
1149
|
-
return new B.init(v,
|
|
1149
|
+
return new B.init(v, x);
|
|
1150
1150
|
}
|
|
1151
1151
|
}, C = i.Utf8 = {
|
|
1152
1152
|
/**
|
|
@@ -1164,7 +1164,7 @@ function L() {
|
|
|
1164
1164
|
*/
|
|
1165
1165
|
stringify: function(o) {
|
|
1166
1166
|
try {
|
|
1167
|
-
return decodeURIComponent(escape(
|
|
1167
|
+
return decodeURIComponent(escape(d.stringify(o)));
|
|
1168
1168
|
} catch {
|
|
1169
1169
|
throw new Error("Malformed UTF-8 data");
|
|
1170
1170
|
}
|
|
@@ -1183,7 +1183,7 @@ function L() {
|
|
|
1183
1183
|
* var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
|
|
1184
1184
|
*/
|
|
1185
1185
|
parse: function(o) {
|
|
1186
|
-
return
|
|
1186
|
+
return d.parse(unescape(encodeURIComponent(o)));
|
|
1187
1187
|
}
|
|
1188
1188
|
}, h = a.BufferedBlockAlgorithm = n.extend({
|
|
1189
1189
|
/**
|
|
@@ -1224,15 +1224,15 @@ function L() {
|
|
|
1224
1224
|
* var processedData = bufferedBlockAlgorithm._process(!!'flush');
|
|
1225
1225
|
*/
|
|
1226
1226
|
_process: function(o) {
|
|
1227
|
-
var
|
|
1227
|
+
var x, v = this._data, F = v.words, E = v.sigBytes, g = this.blockSize, y = g * 4, R = E / y;
|
|
1228
1228
|
o ? R = e.ceil(R) : R = e.max((R | 0) - this._minBufferSize, 0);
|
|
1229
1229
|
var m = R * g, D = e.min(m * 4, E);
|
|
1230
1230
|
if (m) {
|
|
1231
1231
|
for (var w = 0; w < m; w += g)
|
|
1232
1232
|
this._doProcessBlock(F, w);
|
|
1233
|
-
|
|
1233
|
+
x = F.splice(0, m), v.sigBytes -= D;
|
|
1234
1234
|
}
|
|
1235
|
-
return new B.init(
|
|
1235
|
+
return new B.init(x, D);
|
|
1236
1236
|
},
|
|
1237
1237
|
/**
|
|
1238
1238
|
* Creates a copy of this object.
|
|
@@ -1307,8 +1307,8 @@ function L() {
|
|
|
1307
1307
|
*/
|
|
1308
1308
|
finalize: function(o) {
|
|
1309
1309
|
o && this._append(o);
|
|
1310
|
-
var
|
|
1311
|
-
return
|
|
1310
|
+
var x = this._doFinalize();
|
|
1311
|
+
return x;
|
|
1312
1312
|
},
|
|
1313
1313
|
blockSize: 16,
|
|
1314
1314
|
/**
|
|
@@ -1325,8 +1325,8 @@ function L() {
|
|
|
1325
1325
|
* var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
|
|
1326
1326
|
*/
|
|
1327
1327
|
_createHelper: function(o) {
|
|
1328
|
-
return function(
|
|
1329
|
-
return new o.init(v).finalize(
|
|
1328
|
+
return function(x, v) {
|
|
1329
|
+
return new o.init(v).finalize(x);
|
|
1330
1330
|
};
|
|
1331
1331
|
},
|
|
1332
1332
|
/**
|
|
@@ -1343,26 +1343,26 @@ function L() {
|
|
|
1343
1343
|
* var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
|
|
1344
1344
|
*/
|
|
1345
1345
|
_createHmacHelper: function(o) {
|
|
1346
|
-
return function(
|
|
1347
|
-
return new A.HMAC.init(o, v).finalize(
|
|
1346
|
+
return function(x, v) {
|
|
1347
|
+
return new A.HMAC.init(o, v).finalize(x);
|
|
1348
1348
|
};
|
|
1349
1349
|
}
|
|
1350
1350
|
});
|
|
1351
1351
|
var A = f.algo = {};
|
|
1352
1352
|
return f;
|
|
1353
1353
|
})(Math);
|
|
1354
|
-
return
|
|
1354
|
+
return t;
|
|
1355
1355
|
});
|
|
1356
1356
|
})(A0)), A0.exports;
|
|
1357
1357
|
}
|
|
1358
1358
|
var E0 = { exports: {} }, Wr = E0.exports, ye;
|
|
1359
1359
|
function ne() {
|
|
1360
|
-
return ye || (ye = 1, (function(p,
|
|
1361
|
-
(function(
|
|
1360
|
+
return ye || (ye = 1, (function(p, r) {
|
|
1361
|
+
(function(t, e) {
|
|
1362
1362
|
p.exports = e(L());
|
|
1363
|
-
})(Wr, function(
|
|
1363
|
+
})(Wr, function(t) {
|
|
1364
1364
|
return (function(e) {
|
|
1365
|
-
var
|
|
1365
|
+
var s = t, c = s.lib, b = c.Base, u = c.WordArray, f = s.x64 = {};
|
|
1366
1366
|
f.Word = b.extend({
|
|
1367
1367
|
/**
|
|
1368
1368
|
* Initializes a newly created 64-bit word.
|
|
@@ -1561,8 +1561,8 @@ function ne() {
|
|
|
1561
1561
|
*/
|
|
1562
1562
|
toX32: function() {
|
|
1563
1563
|
for (var a = this.words, n = a.length, B = [], i = 0; i < n; i++) {
|
|
1564
|
-
var
|
|
1565
|
-
B.push(
|
|
1564
|
+
var l = a[i];
|
|
1565
|
+
B.push(l.high), B.push(l.low);
|
|
1566
1566
|
}
|
|
1567
1567
|
return u.create(B, this.sigBytes);
|
|
1568
1568
|
},
|
|
@@ -1581,19 +1581,19 @@ function ne() {
|
|
|
1581
1581
|
return a;
|
|
1582
1582
|
}
|
|
1583
1583
|
});
|
|
1584
|
-
})(),
|
|
1584
|
+
})(), t;
|
|
1585
1585
|
});
|
|
1586
1586
|
})(E0)), E0.exports;
|
|
1587
1587
|
}
|
|
1588
1588
|
var F0 = { exports: {} }, Gr = F0.exports, _e;
|
|
1589
1589
|
function Qr() {
|
|
1590
|
-
return _e || (_e = 1, (function(p,
|
|
1591
|
-
(function(
|
|
1590
|
+
return _e || (_e = 1, (function(p, r) {
|
|
1591
|
+
(function(t, e) {
|
|
1592
1592
|
p.exports = e(L());
|
|
1593
|
-
})(Gr, function(
|
|
1593
|
+
})(Gr, function(t) {
|
|
1594
1594
|
return (function() {
|
|
1595
1595
|
if (typeof ArrayBuffer == "function") {
|
|
1596
|
-
var e =
|
|
1596
|
+
var e = t, s = e.lib, c = s.WordArray, b = c.init, u = c.init = function(f) {
|
|
1597
1597
|
if (f instanceof ArrayBuffer && (f = new Uint8Array(f)), (f instanceof Int8Array || typeof Uint8ClampedArray < "u" && f instanceof Uint8ClampedArray || f instanceof Int16Array || f instanceof Uint16Array || f instanceof Int32Array || f instanceof Uint32Array || f instanceof Float32Array || f instanceof Float64Array) && (f = new Uint8Array(f.buffer, f.byteOffset, f.byteLength)), f instanceof Uint8Array) {
|
|
1598
1598
|
for (var a = f.byteLength, n = [], B = 0; B < a; B++)
|
|
1599
1599
|
n[B >>> 2] |= f[B] << 24 - B % 4 * 8;
|
|
@@ -1601,20 +1601,20 @@ function Qr() {
|
|
|
1601
1601
|
} else
|
|
1602
1602
|
b.apply(this, arguments);
|
|
1603
1603
|
};
|
|
1604
|
-
u.prototype =
|
|
1604
|
+
u.prototype = c;
|
|
1605
1605
|
}
|
|
1606
|
-
})(),
|
|
1606
|
+
})(), t.lib.WordArray;
|
|
1607
1607
|
});
|
|
1608
1608
|
})(F0)), F0.exports;
|
|
1609
1609
|
}
|
|
1610
1610
|
var D0 = { exports: {} }, Xr = D0.exports, we;
|
|
1611
1611
|
function Vr() {
|
|
1612
|
-
return we || (we = 1, (function(p,
|
|
1613
|
-
(function(
|
|
1612
|
+
return we || (we = 1, (function(p, r) {
|
|
1613
|
+
(function(t, e) {
|
|
1614
1614
|
p.exports = e(L());
|
|
1615
|
-
})(Xr, function(
|
|
1615
|
+
})(Xr, function(t) {
|
|
1616
1616
|
return (function() {
|
|
1617
|
-
var e =
|
|
1617
|
+
var e = t, s = e.lib, c = s.WordArray, b = e.enc;
|
|
1618
1618
|
b.Utf16 = b.Utf16BE = {
|
|
1619
1619
|
/**
|
|
1620
1620
|
* Converts a word array to a UTF-16 BE string.
|
|
@@ -1631,8 +1631,8 @@ function Vr() {
|
|
|
1631
1631
|
*/
|
|
1632
1632
|
stringify: function(f) {
|
|
1633
1633
|
for (var a = f.words, n = f.sigBytes, B = [], i = 0; i < n; i += 2) {
|
|
1634
|
-
var
|
|
1635
|
-
B.push(String.fromCharCode(
|
|
1634
|
+
var l = a[i >>> 2] >>> 16 - i % 4 * 8 & 65535;
|
|
1635
|
+
B.push(String.fromCharCode(l));
|
|
1636
1636
|
}
|
|
1637
1637
|
return B.join("");
|
|
1638
1638
|
},
|
|
@@ -1652,7 +1652,7 @@ function Vr() {
|
|
|
1652
1652
|
parse: function(f) {
|
|
1653
1653
|
for (var a = f.length, n = [], B = 0; B < a; B++)
|
|
1654
1654
|
n[B >>> 1] |= f.charCodeAt(B) << 16 - B % 2 * 16;
|
|
1655
|
-
return
|
|
1655
|
+
return c.create(n, a * 2);
|
|
1656
1656
|
}
|
|
1657
1657
|
}, b.Utf16LE = {
|
|
1658
1658
|
/**
|
|
@@ -1670,8 +1670,8 @@ function Vr() {
|
|
|
1670
1670
|
*/
|
|
1671
1671
|
stringify: function(f) {
|
|
1672
1672
|
for (var a = f.words, n = f.sigBytes, B = [], i = 0; i < n; i += 2) {
|
|
1673
|
-
var
|
|
1674
|
-
B.push(String.fromCharCode(
|
|
1673
|
+
var l = u(a[i >>> 2] >>> 16 - i % 4 * 8 & 65535);
|
|
1674
|
+
B.push(String.fromCharCode(l));
|
|
1675
1675
|
}
|
|
1676
1676
|
return B.join("");
|
|
1677
1677
|
},
|
|
@@ -1691,24 +1691,24 @@ function Vr() {
|
|
|
1691
1691
|
parse: function(f) {
|
|
1692
1692
|
for (var a = f.length, n = [], B = 0; B < a; B++)
|
|
1693
1693
|
n[B >>> 1] |= u(f.charCodeAt(B) << 16 - B % 2 * 16);
|
|
1694
|
-
return
|
|
1694
|
+
return c.create(n, a * 2);
|
|
1695
1695
|
}
|
|
1696
1696
|
};
|
|
1697
1697
|
function u(f) {
|
|
1698
1698
|
return f << 8 & 4278255360 | f >>> 8 & 16711935;
|
|
1699
1699
|
}
|
|
1700
|
-
})(),
|
|
1700
|
+
})(), t.enc.Utf16;
|
|
1701
1701
|
});
|
|
1702
1702
|
})(D0)), D0.exports;
|
|
1703
1703
|
}
|
|
1704
1704
|
var g0 = { exports: {} }, jr = g0.exports, ke;
|
|
1705
1705
|
function n0() {
|
|
1706
|
-
return ke || (ke = 1, (function(p,
|
|
1707
|
-
(function(
|
|
1706
|
+
return ke || (ke = 1, (function(p, r) {
|
|
1707
|
+
(function(t, e) {
|
|
1708
1708
|
p.exports = e(L());
|
|
1709
|
-
})(jr, function(
|
|
1709
|
+
})(jr, function(t) {
|
|
1710
1710
|
return (function() {
|
|
1711
|
-
var e =
|
|
1711
|
+
var e = t, s = e.lib, c = s.WordArray, b = e.enc;
|
|
1712
1712
|
b.Base64 = {
|
|
1713
1713
|
/**
|
|
1714
1714
|
* Converts a word array to a Base64 string.
|
|
@@ -1726,13 +1726,13 @@ function n0() {
|
|
|
1726
1726
|
stringify: function(f) {
|
|
1727
1727
|
var a = f.words, n = f.sigBytes, B = this._map;
|
|
1728
1728
|
f.clamp();
|
|
1729
|
-
for (var i = [],
|
|
1730
|
-
for (var
|
|
1729
|
+
for (var i = [], l = 0; l < n; l += 3)
|
|
1730
|
+
for (var d = a[l >>> 2] >>> 24 - l % 4 * 8 & 255, C = a[l + 1 >>> 2] >>> 24 - (l + 1) % 4 * 8 & 255, h = a[l + 2 >>> 2] >>> 24 - (l + 2) % 4 * 8 & 255, A = d << 16 | C << 8 | h, o = 0; o < 4 && l + o * 0.75 < n; o++)
|
|
1731
1731
|
i.push(B.charAt(A >>> 6 * (3 - o) & 63));
|
|
1732
|
-
var
|
|
1733
|
-
if (
|
|
1732
|
+
var x = B.charAt(64);
|
|
1733
|
+
if (x)
|
|
1734
1734
|
for (; i.length % 4; )
|
|
1735
|
-
i.push(
|
|
1735
|
+
i.push(x);
|
|
1736
1736
|
return i.join("");
|
|
1737
1737
|
},
|
|
1738
1738
|
/**
|
|
@@ -1755,35 +1755,35 @@ function n0() {
|
|
|
1755
1755
|
for (var i = 0; i < n.length; i++)
|
|
1756
1756
|
B[n.charCodeAt(i)] = i;
|
|
1757
1757
|
}
|
|
1758
|
-
var
|
|
1759
|
-
if (
|
|
1760
|
-
var
|
|
1761
|
-
|
|
1758
|
+
var l = n.charAt(64);
|
|
1759
|
+
if (l) {
|
|
1760
|
+
var d = f.indexOf(l);
|
|
1761
|
+
d !== -1 && (a = d);
|
|
1762
1762
|
}
|
|
1763
1763
|
return u(f, a, B);
|
|
1764
1764
|
},
|
|
1765
1765
|
_map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
|
|
1766
1766
|
};
|
|
1767
1767
|
function u(f, a, n) {
|
|
1768
|
-
for (var B = [], i = 0,
|
|
1769
|
-
if (
|
|
1770
|
-
var
|
|
1768
|
+
for (var B = [], i = 0, l = 0; l < a; l++)
|
|
1769
|
+
if (l % 4) {
|
|
1770
|
+
var d = n[f.charCodeAt(l - 1)] << l % 4 * 2, C = n[f.charCodeAt(l)] >>> 6 - l % 4 * 2, h = d | C;
|
|
1771
1771
|
B[i >>> 2] |= h << 24 - i % 4 * 8, i++;
|
|
1772
1772
|
}
|
|
1773
|
-
return
|
|
1773
|
+
return c.create(B, i);
|
|
1774
1774
|
}
|
|
1775
|
-
})(),
|
|
1775
|
+
})(), t.enc.Base64;
|
|
1776
1776
|
});
|
|
1777
1777
|
})(g0)), g0.exports;
|
|
1778
1778
|
}
|
|
1779
1779
|
var b0 = { exports: {} }, Zr = b0.exports, Se;
|
|
1780
1780
|
function Yr() {
|
|
1781
|
-
return Se || (Se = 1, (function(p,
|
|
1782
|
-
(function(
|
|
1781
|
+
return Se || (Se = 1, (function(p, r) {
|
|
1782
|
+
(function(t, e) {
|
|
1783
1783
|
p.exports = e(L());
|
|
1784
|
-
})(Zr, function(
|
|
1784
|
+
})(Zr, function(t) {
|
|
1785
1785
|
return (function() {
|
|
1786
|
-
var e =
|
|
1786
|
+
var e = t, s = e.lib, c = s.WordArray, b = e.enc;
|
|
1787
1787
|
b.Base64url = {
|
|
1788
1788
|
/**
|
|
1789
1789
|
* Converts a word array to a Base64url string.
|
|
@@ -1804,14 +1804,14 @@ function Yr() {
|
|
|
1804
1804
|
a === void 0 && (a = !0);
|
|
1805
1805
|
var n = f.words, B = f.sigBytes, i = a ? this._safe_map : this._map;
|
|
1806
1806
|
f.clamp();
|
|
1807
|
-
for (var
|
|
1808
|
-
for (var C = n[
|
|
1809
|
-
|
|
1807
|
+
for (var l = [], d = 0; d < B; d += 3)
|
|
1808
|
+
for (var C = n[d >>> 2] >>> 24 - d % 4 * 8 & 255, h = n[d + 1 >>> 2] >>> 24 - (d + 1) % 4 * 8 & 255, A = n[d + 2 >>> 2] >>> 24 - (d + 2) % 4 * 8 & 255, o = C << 16 | h << 8 | A, x = 0; x < 4 && d + x * 0.75 < B; x++)
|
|
1809
|
+
l.push(i.charAt(o >>> 6 * (3 - x) & 63));
|
|
1810
1810
|
var v = i.charAt(64);
|
|
1811
1811
|
if (v)
|
|
1812
|
-
for (;
|
|
1813
|
-
|
|
1814
|
-
return
|
|
1812
|
+
for (; l.length % 4; )
|
|
1813
|
+
l.push(v);
|
|
1814
|
+
return l.join("");
|
|
1815
1815
|
},
|
|
1816
1816
|
/**
|
|
1817
1817
|
* Converts a Base64url string to a word array.
|
|
@@ -1833,12 +1833,12 @@ function Yr() {
|
|
|
1833
1833
|
var n = f.length, B = a ? this._safe_map : this._map, i = this._reverseMap;
|
|
1834
1834
|
if (!i) {
|
|
1835
1835
|
i = this._reverseMap = [];
|
|
1836
|
-
for (var
|
|
1837
|
-
i[B.charCodeAt(
|
|
1836
|
+
for (var l = 0; l < B.length; l++)
|
|
1837
|
+
i[B.charCodeAt(l)] = l;
|
|
1838
1838
|
}
|
|
1839
|
-
var
|
|
1840
|
-
if (
|
|
1841
|
-
var C = f.indexOf(
|
|
1839
|
+
var d = B.charAt(64);
|
|
1840
|
+
if (d) {
|
|
1841
|
+
var C = f.indexOf(d);
|
|
1842
1842
|
C !== -1 && (n = C);
|
|
1843
1843
|
}
|
|
1844
1844
|
return u(f, n, i);
|
|
@@ -1847,25 +1847,25 @@ function Yr() {
|
|
|
1847
1847
|
_safe_map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
|
|
1848
1848
|
};
|
|
1849
1849
|
function u(f, a, n) {
|
|
1850
|
-
for (var B = [], i = 0,
|
|
1851
|
-
if (
|
|
1852
|
-
var
|
|
1850
|
+
for (var B = [], i = 0, l = 0; l < a; l++)
|
|
1851
|
+
if (l % 4) {
|
|
1852
|
+
var d = n[f.charCodeAt(l - 1)] << l % 4 * 2, C = n[f.charCodeAt(l)] >>> 6 - l % 4 * 2, h = d | C;
|
|
1853
1853
|
B[i >>> 2] |= h << 24 - i % 4 * 8, i++;
|
|
1854
1854
|
}
|
|
1855
|
-
return
|
|
1855
|
+
return c.create(B, i);
|
|
1856
1856
|
}
|
|
1857
|
-
})(),
|
|
1857
|
+
})(), t.enc.Base64url;
|
|
1858
1858
|
});
|
|
1859
1859
|
})(b0)), b0.exports;
|
|
1860
1860
|
}
|
|
1861
1861
|
var y0 = { exports: {} }, Jr = y0.exports, Pe;
|
|
1862
1862
|
function i0() {
|
|
1863
|
-
return Pe || (Pe = 1, (function(p,
|
|
1864
|
-
(function(
|
|
1863
|
+
return Pe || (Pe = 1, (function(p, r) {
|
|
1864
|
+
(function(t, e) {
|
|
1865
1865
|
p.exports = e(L());
|
|
1866
|
-
})(Jr, function(
|
|
1866
|
+
})(Jr, function(t) {
|
|
1867
1867
|
return (function(e) {
|
|
1868
|
-
var
|
|
1868
|
+
var s = t, c = s.lib, b = c.WordArray, u = c.Hasher, f = s.algo, a = [];
|
|
1869
1869
|
(function() {
|
|
1870
1870
|
for (var C = 0; C < 64; C++)
|
|
1871
1871
|
a[C] = e.abs(e.sin(C + 1)) * 4294967296 | 0;
|
|
@@ -1881,17 +1881,17 @@ function i0() {
|
|
|
1881
1881
|
},
|
|
1882
1882
|
_doProcessBlock: function(C, h) {
|
|
1883
1883
|
for (var A = 0; A < 16; A++) {
|
|
1884
|
-
var o = h + A,
|
|
1885
|
-
C[o] = (
|
|
1884
|
+
var o = h + A, x = C[o];
|
|
1885
|
+
C[o] = (x << 8 | x >>> 24) & 16711935 | (x << 24 | x >>> 8) & 4278255360;
|
|
1886
1886
|
}
|
|
1887
|
-
var v = this._hash.words, F = C[h + 0], E = C[h + 1], g = C[h + 2], y = C[h + 3], R = C[h + 4], m = C[h + 5], D = C[h + 6], w = C[h + 7], k = C[h + 8], M = C[h + 9], O = C[h + 10],
|
|
1888
|
-
_ = B(_, P, I, S, F, 7, a[0]), S = B(S, _, P, I, E, 12, a[1]), I = B(I, S, _, P, g, 17, a[2]), P = B(P, I, S, _, y, 22, a[3]), _ = B(_, P, I, S, R, 7, a[4]), S = B(S, _, P, I, m, 12, a[5]), I = B(I, S, _, P, D, 17, a[6]), P = B(P, I, S, _, w, 22, a[7]), _ = B(_, P, I, S, k, 7, a[8]), S = B(S, _, P, I, M, 12, a[9]), I = B(I, S, _, P, O, 17, a[10]), P = B(P, I, S, _,
|
|
1887
|
+
var v = this._hash.words, F = C[h + 0], E = C[h + 1], g = C[h + 2], y = C[h + 3], R = C[h + 4], m = C[h + 5], D = C[h + 6], w = C[h + 7], k = C[h + 8], M = C[h + 9], O = C[h + 10], $ = C[h + 11], N = C[h + 12], K = C[h + 13], q = C[h + 14], U = C[h + 15], _ = v[0], P = v[1], I = v[2], S = v[3];
|
|
1888
|
+
_ = B(_, P, I, S, F, 7, a[0]), S = B(S, _, P, I, E, 12, a[1]), I = B(I, S, _, P, g, 17, a[2]), P = B(P, I, S, _, y, 22, a[3]), _ = B(_, P, I, S, R, 7, a[4]), S = B(S, _, P, I, m, 12, a[5]), I = B(I, S, _, P, D, 17, a[6]), P = B(P, I, S, _, w, 22, a[7]), _ = B(_, P, I, S, k, 7, a[8]), S = B(S, _, P, I, M, 12, a[9]), I = B(I, S, _, P, O, 17, a[10]), P = B(P, I, S, _, $, 22, a[11]), _ = B(_, P, I, S, N, 7, a[12]), S = B(S, _, P, I, K, 12, a[13]), I = B(I, S, _, P, q, 17, a[14]), P = B(P, I, S, _, U, 22, a[15]), _ = i(_, P, I, S, E, 5, a[16]), S = i(S, _, P, I, D, 9, a[17]), I = i(I, S, _, P, $, 14, a[18]), P = i(P, I, S, _, F, 20, a[19]), _ = i(_, P, I, S, m, 5, a[20]), S = i(S, _, P, I, O, 9, a[21]), I = i(I, S, _, P, U, 14, a[22]), P = i(P, I, S, _, R, 20, a[23]), _ = i(_, P, I, S, M, 5, a[24]), S = i(S, _, P, I, q, 9, a[25]), I = i(I, S, _, P, y, 14, a[26]), P = i(P, I, S, _, k, 20, a[27]), _ = i(_, P, I, S, K, 5, a[28]), S = i(S, _, P, I, g, 9, a[29]), I = i(I, S, _, P, w, 14, a[30]), P = i(P, I, S, _, N, 20, a[31]), _ = l(_, P, I, S, m, 4, a[32]), S = l(S, _, P, I, k, 11, a[33]), I = l(I, S, _, P, $, 16, a[34]), P = l(P, I, S, _, q, 23, a[35]), _ = l(_, P, I, S, E, 4, a[36]), S = l(S, _, P, I, R, 11, a[37]), I = l(I, S, _, P, w, 16, a[38]), P = l(P, I, S, _, O, 23, a[39]), _ = l(_, P, I, S, K, 4, a[40]), S = l(S, _, P, I, F, 11, a[41]), I = l(I, S, _, P, y, 16, a[42]), P = l(P, I, S, _, D, 23, a[43]), _ = l(_, P, I, S, M, 4, a[44]), S = l(S, _, P, I, N, 11, a[45]), I = l(I, S, _, P, U, 16, a[46]), P = l(P, I, S, _, g, 23, a[47]), _ = d(_, P, I, S, F, 6, a[48]), S = d(S, _, P, I, w, 10, a[49]), I = d(I, S, _, P, q, 15, a[50]), P = d(P, I, S, _, m, 21, a[51]), _ = d(_, P, I, S, N, 6, a[52]), S = d(S, _, P, I, y, 10, a[53]), I = d(I, S, _, P, O, 15, a[54]), P = d(P, I, S, _, E, 21, a[55]), _ = d(_, P, I, S, k, 6, a[56]), S = d(S, _, P, I, U, 10, a[57]), I = d(I, S, _, P, D, 15, a[58]), P = d(P, I, S, _, K, 21, a[59]), _ = d(_, P, I, S, R, 6, a[60]), S = d(S, _, P, I, $, 10, a[61]), I = d(I, S, _, P, g, 15, a[62]), P = d(P, I, S, _, M, 21, a[63]), v[0] = v[0] + _ | 0, v[1] = v[1] + P | 0, v[2] = v[2] + I | 0, v[3] = v[3] + S | 0;
|
|
1889
1889
|
},
|
|
1890
1890
|
_doFinalize: function() {
|
|
1891
1891
|
var C = this._data, h = C.words, A = this._nDataBytes * 8, o = C.sigBytes * 8;
|
|
1892
1892
|
h[o >>> 5] |= 128 << 24 - o % 32;
|
|
1893
|
-
var
|
|
1894
|
-
h[(o + 64 >>> 9 << 4) + 15] = (
|
|
1893
|
+
var x = e.floor(A / 4294967296), v = A;
|
|
1894
|
+
h[(o + 64 >>> 9 << 4) + 15] = (x << 8 | x >>> 24) & 16711935 | (x << 24 | x >>> 8) & 4278255360, h[(o + 64 >>> 9 << 4) + 14] = (v << 8 | v >>> 24) & 16711935 | (v << 24 | v >>> 8) & 4278255360, C.sigBytes = (h.length + 1) * 4, this._process();
|
|
1895
1895
|
for (var F = this._hash, E = F.words, g = 0; g < 4; g++) {
|
|
1896
1896
|
var y = E[g];
|
|
1897
1897
|
E[g] = (y << 8 | y >>> 24) & 16711935 | (y << 24 | y >>> 8) & 4278255360;
|
|
@@ -1903,37 +1903,37 @@ function i0() {
|
|
|
1903
1903
|
return C._hash = this._hash.clone(), C;
|
|
1904
1904
|
}
|
|
1905
1905
|
});
|
|
1906
|
-
function B(C, h, A, o,
|
|
1907
|
-
var E = C + (h & A | ~h & o) +
|
|
1906
|
+
function B(C, h, A, o, x, v, F) {
|
|
1907
|
+
var E = C + (h & A | ~h & o) + x + F;
|
|
1908
1908
|
return (E << v | E >>> 32 - v) + h;
|
|
1909
1909
|
}
|
|
1910
|
-
function i(C, h, A, o,
|
|
1911
|
-
var E = C + (h & o | A & ~o) +
|
|
1910
|
+
function i(C, h, A, o, x, v, F) {
|
|
1911
|
+
var E = C + (h & o | A & ~o) + x + F;
|
|
1912
1912
|
return (E << v | E >>> 32 - v) + h;
|
|
1913
1913
|
}
|
|
1914
|
-
function
|
|
1915
|
-
var E = C + (h ^ A ^ o) +
|
|
1914
|
+
function l(C, h, A, o, x, v, F) {
|
|
1915
|
+
var E = C + (h ^ A ^ o) + x + F;
|
|
1916
1916
|
return (E << v | E >>> 32 - v) + h;
|
|
1917
1917
|
}
|
|
1918
|
-
function
|
|
1919
|
-
var E = C + (A ^ (h | ~o)) +
|
|
1918
|
+
function d(C, h, A, o, x, v, F) {
|
|
1919
|
+
var E = C + (A ^ (h | ~o)) + x + F;
|
|
1920
1920
|
return (E << v | E >>> 32 - v) + h;
|
|
1921
1921
|
}
|
|
1922
|
-
|
|
1923
|
-
})(Math),
|
|
1922
|
+
s.MD5 = u._createHelper(n), s.HmacMD5 = u._createHmacHelper(n);
|
|
1923
|
+
})(Math), t.MD5;
|
|
1924
1924
|
});
|
|
1925
1925
|
})(y0)), y0.exports;
|
|
1926
1926
|
}
|
|
1927
1927
|
var _0 = { exports: {} }, et = _0.exports, Ie;
|
|
1928
1928
|
function lr() {
|
|
1929
|
-
return Ie || (Ie = 1, (function(p,
|
|
1930
|
-
(function(
|
|
1929
|
+
return Ie || (Ie = 1, (function(p, r) {
|
|
1930
|
+
(function(t, e) {
|
|
1931
1931
|
p.exports = e(L());
|
|
1932
|
-
})(et, function(
|
|
1932
|
+
})(et, function(t) {
|
|
1933
1933
|
return (function() {
|
|
1934
|
-
var e =
|
|
1934
|
+
var e = t, s = e.lib, c = s.WordArray, b = s.Hasher, u = e.algo, f = [], a = u.SHA1 = b.extend({
|
|
1935
1935
|
_doReset: function() {
|
|
1936
|
-
this._hash = new
|
|
1936
|
+
this._hash = new c.init([
|
|
1937
1937
|
1732584193,
|
|
1938
1938
|
4023233417,
|
|
1939
1939
|
2562383102,
|
|
@@ -1942,21 +1942,21 @@ function lr() {
|
|
|
1942
1942
|
]);
|
|
1943
1943
|
},
|
|
1944
1944
|
_doProcessBlock: function(n, B) {
|
|
1945
|
-
for (var i = this._hash.words,
|
|
1945
|
+
for (var i = this._hash.words, l = i[0], d = i[1], C = i[2], h = i[3], A = i[4], o = 0; o < 80; o++) {
|
|
1946
1946
|
if (o < 16)
|
|
1947
1947
|
f[o] = n[B + o] | 0;
|
|
1948
1948
|
else {
|
|
1949
|
-
var
|
|
1950
|
-
f[o] =
|
|
1949
|
+
var x = f[o - 3] ^ f[o - 8] ^ f[o - 14] ^ f[o - 16];
|
|
1950
|
+
f[o] = x << 1 | x >>> 31;
|
|
1951
1951
|
}
|
|
1952
|
-
var v = (
|
|
1953
|
-
o < 20 ? v += (
|
|
1952
|
+
var v = (l << 5 | l >>> 27) + A + f[o];
|
|
1953
|
+
o < 20 ? v += (d & C | ~d & h) + 1518500249 : o < 40 ? v += (d ^ C ^ h) + 1859775393 : o < 60 ? v += (d & C | d & h | C & h) - 1894007588 : v += (d ^ C ^ h) - 899497514, A = h, h = C, C = d << 30 | d >>> 2, d = l, l = v;
|
|
1954
1954
|
}
|
|
1955
|
-
i[0] = i[0] +
|
|
1955
|
+
i[0] = i[0] + l | 0, i[1] = i[1] + d | 0, i[2] = i[2] + C | 0, i[3] = i[3] + h | 0, i[4] = i[4] + A | 0;
|
|
1956
1956
|
},
|
|
1957
1957
|
_doFinalize: function() {
|
|
1958
|
-
var n = this._data, B = n.words, i = this._nDataBytes * 8,
|
|
1959
|
-
return B[
|
|
1958
|
+
var n = this._data, B = n.words, i = this._nDataBytes * 8, l = n.sigBytes * 8;
|
|
1959
|
+
return B[l >>> 5] |= 128 << 24 - l % 32, B[(l + 64 >>> 9 << 4) + 14] = Math.floor(i / 4294967296), B[(l + 64 >>> 9 << 4) + 15] = i, n.sigBytes = B.length * 4, this._process(), this._hash;
|
|
1960
1960
|
},
|
|
1961
1961
|
clone: function() {
|
|
1962
1962
|
var n = b.clone.call(this);
|
|
@@ -1964,72 +1964,72 @@ function lr() {
|
|
|
1964
1964
|
}
|
|
1965
1965
|
});
|
|
1966
1966
|
e.SHA1 = b._createHelper(a), e.HmacSHA1 = b._createHmacHelper(a);
|
|
1967
|
-
})(),
|
|
1967
|
+
})(), t.SHA1;
|
|
1968
1968
|
});
|
|
1969
1969
|
})(_0)), _0.exports;
|
|
1970
1970
|
}
|
|
1971
1971
|
var w0 = { exports: {} }, rt = w0.exports, Re;
|
|
1972
1972
|
function de() {
|
|
1973
|
-
return Re || (Re = 1, (function(p,
|
|
1974
|
-
(function(
|
|
1973
|
+
return Re || (Re = 1, (function(p, r) {
|
|
1974
|
+
(function(t, e) {
|
|
1975
1975
|
p.exports = e(L());
|
|
1976
|
-
})(rt, function(
|
|
1976
|
+
})(rt, function(t) {
|
|
1977
1977
|
return (function(e) {
|
|
1978
|
-
var
|
|
1978
|
+
var s = t, c = s.lib, b = c.WordArray, u = c.Hasher, f = s.algo, a = [], n = [];
|
|
1979
1979
|
(function() {
|
|
1980
|
-
function
|
|
1981
|
-
for (var o = e.sqrt(A),
|
|
1982
|
-
if (!(A %
|
|
1980
|
+
function l(A) {
|
|
1981
|
+
for (var o = e.sqrt(A), x = 2; x <= o; x++)
|
|
1982
|
+
if (!(A % x))
|
|
1983
1983
|
return !1;
|
|
1984
1984
|
return !0;
|
|
1985
1985
|
}
|
|
1986
|
-
function
|
|
1986
|
+
function d(A) {
|
|
1987
1987
|
return (A - (A | 0)) * 4294967296 | 0;
|
|
1988
1988
|
}
|
|
1989
1989
|
for (var C = 2, h = 0; h < 64; )
|
|
1990
|
-
|
|
1990
|
+
l(C) && (h < 8 && (a[h] = d(e.pow(C, 1 / 2))), n[h] = d(e.pow(C, 1 / 3)), h++), C++;
|
|
1991
1991
|
})();
|
|
1992
1992
|
var B = [], i = f.SHA256 = u.extend({
|
|
1993
1993
|
_doReset: function() {
|
|
1994
1994
|
this._hash = new b.init(a.slice(0));
|
|
1995
1995
|
},
|
|
1996
|
-
_doProcessBlock: function(
|
|
1997
|
-
for (var C = this._hash.words, h = C[0], A = C[1], o = C[2],
|
|
1996
|
+
_doProcessBlock: function(l, d) {
|
|
1997
|
+
for (var C = this._hash.words, h = C[0], A = C[1], o = C[2], x = C[3], v = C[4], F = C[5], E = C[6], g = C[7], y = 0; y < 64; y++) {
|
|
1998
1998
|
if (y < 16)
|
|
1999
|
-
B[y] =
|
|
1999
|
+
B[y] = l[d + y] | 0;
|
|
2000
2000
|
else {
|
|
2001
2001
|
var R = B[y - 15], m = (R << 25 | R >>> 7) ^ (R << 14 | R >>> 18) ^ R >>> 3, D = B[y - 2], w = (D << 15 | D >>> 17) ^ (D << 13 | D >>> 19) ^ D >>> 10;
|
|
2002
2002
|
B[y] = m + B[y - 7] + w + B[y - 16];
|
|
2003
2003
|
}
|
|
2004
|
-
var k = v & F ^ ~v & E, M = h & A ^ h & o ^ A & o, O = (h << 30 | h >>> 2) ^ (h << 19 | h >>> 13) ^ (h << 10 | h >>> 22),
|
|
2005
|
-
g = E, E = F, F = v, v =
|
|
2004
|
+
var k = v & F ^ ~v & E, M = h & A ^ h & o ^ A & o, O = (h << 30 | h >>> 2) ^ (h << 19 | h >>> 13) ^ (h << 10 | h >>> 22), $ = (v << 26 | v >>> 6) ^ (v << 21 | v >>> 11) ^ (v << 7 | v >>> 25), N = g + $ + k + n[y] + B[y], K = O + M;
|
|
2005
|
+
g = E, E = F, F = v, v = x + N | 0, x = o, o = A, A = h, h = N + K | 0;
|
|
2006
2006
|
}
|
|
2007
|
-
C[0] = C[0] + h | 0, C[1] = C[1] + A | 0, C[2] = C[2] + o | 0, C[3] = C[3] +
|
|
2007
|
+
C[0] = C[0] + h | 0, C[1] = C[1] + A | 0, C[2] = C[2] + o | 0, C[3] = C[3] + x | 0, C[4] = C[4] + v | 0, C[5] = C[5] + F | 0, C[6] = C[6] + E | 0, C[7] = C[7] + g | 0;
|
|
2008
2008
|
},
|
|
2009
2009
|
_doFinalize: function() {
|
|
2010
|
-
var
|
|
2011
|
-
return
|
|
2010
|
+
var l = this._data, d = l.words, C = this._nDataBytes * 8, h = l.sigBytes * 8;
|
|
2011
|
+
return d[h >>> 5] |= 128 << 24 - h % 32, d[(h + 64 >>> 9 << 4) + 14] = e.floor(C / 4294967296), d[(h + 64 >>> 9 << 4) + 15] = C, l.sigBytes = d.length * 4, this._process(), this._hash;
|
|
2012
2012
|
},
|
|
2013
2013
|
clone: function() {
|
|
2014
|
-
var
|
|
2015
|
-
return
|
|
2014
|
+
var l = u.clone.call(this);
|
|
2015
|
+
return l._hash = this._hash.clone(), l;
|
|
2016
2016
|
}
|
|
2017
2017
|
});
|
|
2018
|
-
|
|
2019
|
-
})(Math),
|
|
2018
|
+
s.SHA256 = u._createHelper(i), s.HmacSHA256 = u._createHmacHelper(i);
|
|
2019
|
+
})(Math), t.SHA256;
|
|
2020
2020
|
});
|
|
2021
2021
|
})(w0)), w0.exports;
|
|
2022
2022
|
}
|
|
2023
2023
|
var k0 = { exports: {} }, tt = k0.exports, He;
|
|
2024
2024
|
function at() {
|
|
2025
|
-
return He || (He = 1, (function(p,
|
|
2026
|
-
(function(
|
|
2025
|
+
return He || (He = 1, (function(p, r) {
|
|
2026
|
+
(function(t, e, s) {
|
|
2027
2027
|
p.exports = e(L(), de());
|
|
2028
|
-
})(tt, function(
|
|
2028
|
+
})(tt, function(t) {
|
|
2029
2029
|
return (function() {
|
|
2030
|
-
var e =
|
|
2030
|
+
var e = t, s = e.lib, c = s.WordArray, b = e.algo, u = b.SHA256, f = b.SHA224 = u.extend({
|
|
2031
2031
|
_doReset: function() {
|
|
2032
|
-
this._hash = new
|
|
2032
|
+
this._hash = new c.init([
|
|
2033
2033
|
3238371032,
|
|
2034
2034
|
914150663,
|
|
2035
2035
|
812702999,
|
|
@@ -2046,18 +2046,18 @@ function at() {
|
|
|
2046
2046
|
}
|
|
2047
2047
|
});
|
|
2048
2048
|
e.SHA224 = u._createHelper(f), e.HmacSHA224 = u._createHmacHelper(f);
|
|
2049
|
-
})(),
|
|
2049
|
+
})(), t.SHA224;
|
|
2050
2050
|
});
|
|
2051
2051
|
})(k0)), k0.exports;
|
|
2052
2052
|
}
|
|
2053
2053
|
var S0 = { exports: {} }, nt = S0.exports, Me;
|
|
2054
2054
|
function dr() {
|
|
2055
|
-
return Me || (Me = 1, (function(p,
|
|
2056
|
-
(function(
|
|
2055
|
+
return Me || (Me = 1, (function(p, r) {
|
|
2056
|
+
(function(t, e, s) {
|
|
2057
2057
|
p.exports = e(L(), ne());
|
|
2058
|
-
})(nt, function(
|
|
2058
|
+
})(nt, function(t) {
|
|
2059
2059
|
return (function() {
|
|
2060
|
-
var e =
|
|
2060
|
+
var e = t, s = e.lib, c = s.Hasher, b = e.x64, u = b.Word, f = b.WordArray, a = e.algo;
|
|
2061
2061
|
function n() {
|
|
2062
2062
|
return u.create.apply(u, arguments);
|
|
2063
2063
|
}
|
|
@@ -2144,10 +2144,10 @@ function dr() {
|
|
|
2144
2144
|
n(1816402316, 1246189591)
|
|
2145
2145
|
], i = [];
|
|
2146
2146
|
(function() {
|
|
2147
|
-
for (var
|
|
2148
|
-
i[
|
|
2147
|
+
for (var d = 0; d < 80; d++)
|
|
2148
|
+
i[d] = n();
|
|
2149
2149
|
})();
|
|
2150
|
-
var
|
|
2150
|
+
var l = a.SHA512 = c.extend({
|
|
2151
2151
|
_doReset: function() {
|
|
2152
2152
|
this._hash = new f.init([
|
|
2153
2153
|
new u.init(1779033703, 4089235720),
|
|
@@ -2160,55 +2160,55 @@ function dr() {
|
|
|
2160
2160
|
new u.init(1541459225, 327033209)
|
|
2161
2161
|
]);
|
|
2162
2162
|
},
|
|
2163
|
-
_doProcessBlock: function(
|
|
2164
|
-
for (var h = this._hash.words, A = h[0], o = h[1],
|
|
2163
|
+
_doProcessBlock: function(d, C) {
|
|
2164
|
+
for (var h = this._hash.words, A = h[0], o = h[1], x = h[2], v = h[3], F = h[4], E = h[5], g = h[6], y = h[7], R = A.high, m = A.low, D = o.high, w = o.low, k = x.high, M = x.low, O = v.high, $ = v.low, N = F.high, K = F.low, q = E.high, U = E.low, _ = g.high, P = g.low, I = y.high, S = y.low, W = R, z = m, X = D, T = w, c0 = k, s0 = M, ie = O, l0 = $, Y = N, V = K, p0 = q, d0 = U, C0 = _, f0 = P, se = I, u0 = S, J = 0; J < 80; J++) {
|
|
2165
2165
|
var Z, e0, B0 = i[J];
|
|
2166
2166
|
if (J < 16)
|
|
2167
|
-
e0 = B0.high =
|
|
2167
|
+
e0 = B0.high = d[C + J * 2] | 0, Z = B0.low = d[C + J * 2 + 1] | 0;
|
|
2168
2168
|
else {
|
|
2169
|
-
var ue = i[J - 15],
|
|
2169
|
+
var ue = i[J - 15], o0 = ue.high, h0 = ue.low, hr = (o0 >>> 1 | h0 << 31) ^ (o0 >>> 8 | h0 << 24) ^ o0 >>> 7, he = (h0 >>> 1 | o0 << 31) ^ (h0 >>> 8 | o0 << 24) ^ (h0 >>> 7 | o0 << 25), ve = i[J - 2], x0 = ve.high, v0 = ve.low, vr = (x0 >>> 19 | v0 << 13) ^ (x0 << 3 | v0 >>> 29) ^ x0 >>> 6, pe = (v0 >>> 19 | x0 << 13) ^ (v0 << 3 | x0 >>> 29) ^ (v0 >>> 6 | x0 << 26), Ce = i[J - 7], pr = Ce.high, Cr = Ce.low, Be = i[J - 16], Br = Be.high, me = Be.low;
|
|
2170
2170
|
Z = he + Cr, e0 = hr + pr + (Z >>> 0 < he >>> 0 ? 1 : 0), Z = Z + pe, e0 = e0 + vr + (Z >>> 0 < pe >>> 0 ? 1 : 0), Z = Z + me, e0 = e0 + Br + (Z >>> 0 < me >>> 0 ? 1 : 0), B0.high = e0, B0.low = Z;
|
|
2171
2171
|
}
|
|
2172
|
-
var mr = Y & p0 ^ ~Y & C0, Ae = V & d0 ^ ~V & f0, Ar = W & X ^ W & c0 ^ X & c0, Er =
|
|
2173
|
-
|
|
2172
|
+
var mr = Y & p0 ^ ~Y & C0, Ae = V & d0 ^ ~V & f0, Ar = W & X ^ W & c0 ^ X & c0, Er = z & T ^ z & s0 ^ T & s0, Fr = (W >>> 28 | z << 4) ^ (W << 30 | z >>> 2) ^ (W << 25 | z >>> 7), Ee = (z >>> 28 | W << 4) ^ (z << 30 | W >>> 2) ^ (z << 25 | W >>> 7), Dr = (Y >>> 14 | V << 18) ^ (Y >>> 18 | V << 14) ^ (Y << 23 | V >>> 9), gr = (V >>> 14 | Y << 18) ^ (V >>> 18 | Y << 14) ^ (V << 23 | Y >>> 9), Fe = B[J], br = Fe.high, De = Fe.low, j = u0 + gr, r0 = se + Dr + (j >>> 0 < u0 >>> 0 ? 1 : 0), j = j + Ae, r0 = r0 + mr + (j >>> 0 < Ae >>> 0 ? 1 : 0), j = j + De, r0 = r0 + br + (j >>> 0 < De >>> 0 ? 1 : 0), j = j + Z, r0 = r0 + e0 + (j >>> 0 < Z >>> 0 ? 1 : 0), ge = Ee + Er, yr = Fr + Ar + (ge >>> 0 < Ee >>> 0 ? 1 : 0);
|
|
2173
|
+
se = C0, u0 = f0, C0 = p0, f0 = d0, p0 = Y, d0 = V, V = l0 + j | 0, Y = ie + r0 + (V >>> 0 < l0 >>> 0 ? 1 : 0) | 0, ie = c0, l0 = s0, c0 = X, s0 = T, X = W, T = z, z = j + ge | 0, W = r0 + yr + (z >>> 0 < j >>> 0 ? 1 : 0) | 0;
|
|
2174
2174
|
}
|
|
2175
|
-
m = A.low = m +
|
|
2175
|
+
m = A.low = m + z, A.high = R + W + (m >>> 0 < z >>> 0 ? 1 : 0), w = o.low = w + T, o.high = D + X + (w >>> 0 < T >>> 0 ? 1 : 0), M = x.low = M + s0, x.high = k + c0 + (M >>> 0 < s0 >>> 0 ? 1 : 0), $ = v.low = $ + l0, v.high = O + ie + ($ >>> 0 < l0 >>> 0 ? 1 : 0), K = F.low = K + V, F.high = N + Y + (K >>> 0 < V >>> 0 ? 1 : 0), U = E.low = U + d0, E.high = q + p0 + (U >>> 0 < d0 >>> 0 ? 1 : 0), P = g.low = P + f0, g.high = _ + C0 + (P >>> 0 < f0 >>> 0 ? 1 : 0), S = y.low = S + u0, y.high = I + se + (S >>> 0 < u0 >>> 0 ? 1 : 0);
|
|
2176
2176
|
},
|
|
2177
2177
|
_doFinalize: function() {
|
|
2178
|
-
var
|
|
2179
|
-
C[A >>> 5] |= 128 << 24 - A % 32, C[(A + 128 >>> 10 << 5) + 30] = Math.floor(h / 4294967296), C[(A + 128 >>> 10 << 5) + 31] = h,
|
|
2178
|
+
var d = this._data, C = d.words, h = this._nDataBytes * 8, A = d.sigBytes * 8;
|
|
2179
|
+
C[A >>> 5] |= 128 << 24 - A % 32, C[(A + 128 >>> 10 << 5) + 30] = Math.floor(h / 4294967296), C[(A + 128 >>> 10 << 5) + 31] = h, d.sigBytes = C.length * 4, this._process();
|
|
2180
2180
|
var o = this._hash.toX32();
|
|
2181
2181
|
return o;
|
|
2182
2182
|
},
|
|
2183
2183
|
clone: function() {
|
|
2184
|
-
var
|
|
2185
|
-
return
|
|
2184
|
+
var d = c.clone.call(this);
|
|
2185
|
+
return d._hash = this._hash.clone(), d;
|
|
2186
2186
|
},
|
|
2187
2187
|
blockSize: 1024 / 32
|
|
2188
2188
|
});
|
|
2189
|
-
e.SHA512 =
|
|
2190
|
-
})(),
|
|
2189
|
+
e.SHA512 = c._createHelper(l), e.HmacSHA512 = c._createHmacHelper(l);
|
|
2190
|
+
})(), t.SHA512;
|
|
2191
2191
|
});
|
|
2192
2192
|
})(S0)), S0.exports;
|
|
2193
2193
|
}
|
|
2194
2194
|
var P0 = { exports: {} }, it = P0.exports, Oe;
|
|
2195
|
-
function
|
|
2196
|
-
return Oe || (Oe = 1, (function(p,
|
|
2197
|
-
(function(
|
|
2195
|
+
function st() {
|
|
2196
|
+
return Oe || (Oe = 1, (function(p, r) {
|
|
2197
|
+
(function(t, e, s) {
|
|
2198
2198
|
p.exports = e(L(), ne(), dr());
|
|
2199
|
-
})(it, function(
|
|
2199
|
+
})(it, function(t) {
|
|
2200
2200
|
return (function() {
|
|
2201
|
-
var e =
|
|
2201
|
+
var e = t, s = e.x64, c = s.Word, b = s.WordArray, u = e.algo, f = u.SHA512, a = u.SHA384 = f.extend({
|
|
2202
2202
|
_doReset: function() {
|
|
2203
2203
|
this._hash = new b.init([
|
|
2204
|
-
new
|
|
2205
|
-
new
|
|
2206
|
-
new
|
|
2207
|
-
new
|
|
2208
|
-
new
|
|
2209
|
-
new
|
|
2210
|
-
new
|
|
2211
|
-
new
|
|
2204
|
+
new c.init(3418070365, 3238371032),
|
|
2205
|
+
new c.init(1654270250, 914150663),
|
|
2206
|
+
new c.init(2438529370, 812702999),
|
|
2207
|
+
new c.init(355462360, 4144912697),
|
|
2208
|
+
new c.init(1731405415, 4290775857),
|
|
2209
|
+
new c.init(2394180231, 1750603025),
|
|
2210
|
+
new c.init(3675008525, 1694076839),
|
|
2211
|
+
new c.init(1203062813, 3204075428)
|
|
2212
2212
|
]);
|
|
2213
2213
|
},
|
|
2214
2214
|
_doFinalize: function() {
|
|
@@ -2217,23 +2217,23 @@ function ot() {
|
|
|
2217
2217
|
}
|
|
2218
2218
|
});
|
|
2219
2219
|
e.SHA384 = f._createHelper(a), e.HmacSHA384 = f._createHmacHelper(a);
|
|
2220
|
-
})(),
|
|
2220
|
+
})(), t.SHA384;
|
|
2221
2221
|
});
|
|
2222
2222
|
})(P0)), P0.exports;
|
|
2223
2223
|
}
|
|
2224
|
-
var I0 = { exports: {} },
|
|
2224
|
+
var I0 = { exports: {} }, ot = I0.exports, $e;
|
|
2225
2225
|
function xt() {
|
|
2226
|
-
return
|
|
2227
|
-
(function(
|
|
2226
|
+
return $e || ($e = 1, (function(p, r) {
|
|
2227
|
+
(function(t, e, s) {
|
|
2228
2228
|
p.exports = e(L(), ne());
|
|
2229
|
-
})(
|
|
2229
|
+
})(ot, function(t) {
|
|
2230
2230
|
return (function(e) {
|
|
2231
|
-
var
|
|
2231
|
+
var s = t, c = s.lib, b = c.WordArray, u = c.Hasher, f = s.x64, a = f.Word, n = s.algo, B = [], i = [], l = [];
|
|
2232
2232
|
(function() {
|
|
2233
2233
|
for (var h = 1, A = 0, o = 0; o < 24; o++) {
|
|
2234
2234
|
B[h + 5 * A] = (o + 1) * (o + 2) / 2 % 64;
|
|
2235
|
-
var
|
|
2236
|
-
h =
|
|
2235
|
+
var x = A % 5, v = (2 * h + 3 * A) % 5;
|
|
2236
|
+
h = x, A = v;
|
|
2237
2237
|
}
|
|
2238
2238
|
for (var h = 0; h < 5; h++)
|
|
2239
2239
|
for (var A = 0; A < 5; A++)
|
|
@@ -2246,13 +2246,13 @@ function xt() {
|
|
|
2246
2246
|
}
|
|
2247
2247
|
F & 128 ? F = F << 1 ^ 113 : F <<= 1;
|
|
2248
2248
|
}
|
|
2249
|
-
|
|
2249
|
+
l[E] = a.create(g, y);
|
|
2250
2250
|
}
|
|
2251
2251
|
})();
|
|
2252
|
-
var
|
|
2252
|
+
var d = [];
|
|
2253
2253
|
(function() {
|
|
2254
2254
|
for (var h = 0; h < 25; h++)
|
|
2255
|
-
|
|
2255
|
+
d[h] = a.create();
|
|
2256
2256
|
})();
|
|
2257
2257
|
var C = n.SHA3 = u.extend({
|
|
2258
2258
|
/**
|
|
@@ -2272,7 +2272,7 @@ function xt() {
|
|
|
2272
2272
|
this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32;
|
|
2273
2273
|
},
|
|
2274
2274
|
_doProcessBlock: function(h, A) {
|
|
2275
|
-
for (var o = this._state,
|
|
2275
|
+
for (var o = this._state, x = this.blockSize / 2, v = 0; v < x; v++) {
|
|
2276
2276
|
var F = h[A + 2 * v], E = h[A + 2 * v + 1];
|
|
2277
2277
|
F = (F << 8 | F >>> 24) & 16711935 | (F << 24 | F >>> 8) & 4278255360, E = (E << 8 | E >>> 24) & 16711935 | (E << 24 | E >>> 8) & 4278255360;
|
|
2278
2278
|
var g = o[v];
|
|
@@ -2284,36 +2284,36 @@ function xt() {
|
|
|
2284
2284
|
var g = o[R + 5 * w];
|
|
2285
2285
|
m ^= g.high, D ^= g.low;
|
|
2286
2286
|
}
|
|
2287
|
-
var k =
|
|
2287
|
+
var k = d[R];
|
|
2288
2288
|
k.high = m, k.low = D;
|
|
2289
2289
|
}
|
|
2290
2290
|
for (var R = 0; R < 5; R++)
|
|
2291
|
-
for (var M =
|
|
2291
|
+
for (var M = d[(R + 4) % 5], O = d[(R + 1) % 5], $ = O.high, N = O.low, m = M.high ^ ($ << 1 | N >>> 31), D = M.low ^ (N << 1 | $ >>> 31), w = 0; w < 5; w++) {
|
|
2292
2292
|
var g = o[R + 5 * w];
|
|
2293
2293
|
g.high ^= m, g.low ^= D;
|
|
2294
2294
|
}
|
|
2295
|
-
for (var
|
|
2296
|
-
var m, D, g = o[
|
|
2297
|
-
_ < 32 ? (m =
|
|
2298
|
-
var P =
|
|
2295
|
+
for (var K = 1; K < 25; K++) {
|
|
2296
|
+
var m, D, g = o[K], q = g.high, U = g.low, _ = B[K];
|
|
2297
|
+
_ < 32 ? (m = q << _ | U >>> 32 - _, D = U << _ | q >>> 32 - _) : (m = U << _ - 32 | q >>> 64 - _, D = q << _ - 32 | U >>> 64 - _);
|
|
2298
|
+
var P = d[i[K]];
|
|
2299
2299
|
P.high = m, P.low = D;
|
|
2300
2300
|
}
|
|
2301
|
-
var I =
|
|
2301
|
+
var I = d[0], S = o[0];
|
|
2302
2302
|
I.high = S.high, I.low = S.low;
|
|
2303
2303
|
for (var R = 0; R < 5; R++)
|
|
2304
2304
|
for (var w = 0; w < 5; w++) {
|
|
2305
|
-
var
|
|
2306
|
-
g.high = W.high ^ ~
|
|
2305
|
+
var K = R + 5 * w, g = o[K], W = d[K], z = d[(R + 1) % 5 + 5 * w], X = d[(R + 2) % 5 + 5 * w];
|
|
2306
|
+
g.high = W.high ^ ~z.high & X.high, g.low = W.low ^ ~z.low & X.low;
|
|
2307
2307
|
}
|
|
2308
|
-
var g = o[0],
|
|
2309
|
-
g.high ^=
|
|
2308
|
+
var g = o[0], T = l[y];
|
|
2309
|
+
g.high ^= T.high, g.low ^= T.low;
|
|
2310
2310
|
}
|
|
2311
2311
|
},
|
|
2312
2312
|
_doFinalize: function() {
|
|
2313
2313
|
var h = this._data, A = h.words;
|
|
2314
2314
|
this._nDataBytes * 8;
|
|
2315
|
-
var o = h.sigBytes * 8,
|
|
2316
|
-
A[o >>> 5] |= 1 << 24 - o % 32, A[(e.ceil((o + 1) /
|
|
2315
|
+
var o = h.sigBytes * 8, x = this.blockSize * 32;
|
|
2316
|
+
A[o >>> 5] |= 1 << 24 - o % 32, A[(e.ceil((o + 1) / x) * x >>> 5) - 1] |= 128, h.sigBytes = A.length * 4, this._process();
|
|
2317
2317
|
for (var v = this._state, F = this.cfg.outputLength / 8, E = F / 8, g = [], y = 0; y < E; y++) {
|
|
2318
2318
|
var R = v[y], m = R.high, D = R.low;
|
|
2319
2319
|
m = (m << 8 | m >>> 24) & 16711935 | (m << 24 | m >>> 8) & 4278255360, D = (D << 8 | D >>> 24) & 16711935 | (D << 24 | D >>> 8) & 4278255360, g.push(D), g.push(m);
|
|
@@ -2326,17 +2326,17 @@ function xt() {
|
|
|
2326
2326
|
return h;
|
|
2327
2327
|
}
|
|
2328
2328
|
});
|
|
2329
|
-
|
|
2330
|
-
})(Math),
|
|
2329
|
+
s.SHA3 = u._createHelper(C), s.HmacSHA3 = u._createHmacHelper(C);
|
|
2330
|
+
})(Math), t.SHA3;
|
|
2331
2331
|
});
|
|
2332
2332
|
})(I0)), I0.exports;
|
|
2333
2333
|
}
|
|
2334
|
-
var R0 = { exports: {} }, ct = R0.exports,
|
|
2334
|
+
var R0 = { exports: {} }, ct = R0.exports, Te;
|
|
2335
2335
|
function lt() {
|
|
2336
|
-
return
|
|
2337
|
-
(function(
|
|
2336
|
+
return Te || (Te = 1, (function(p, r) {
|
|
2337
|
+
(function(t, e) {
|
|
2338
2338
|
p.exports = e(L());
|
|
2339
|
-
})(ct, function(
|
|
2339
|
+
})(ct, function(t) {
|
|
2340
2340
|
/** @preserve
|
|
2341
2341
|
(c) 2012 by Cédric Mesnil. All rights reserved.
|
|
2342
2342
|
|
|
@@ -2348,7 +2348,7 @@ function lt() {
|
|
|
2348
2348
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
2349
2349
|
*/
|
|
2350
2350
|
return (function(e) {
|
|
2351
|
-
var
|
|
2351
|
+
var s = t, c = s.lib, b = c.WordArray, u = c.Hasher, f = s.algo, a = b.create([
|
|
2352
2352
|
0,
|
|
2353
2353
|
1,
|
|
2354
2354
|
2,
|
|
@@ -2672,7 +2672,7 @@ function lt() {
|
|
|
2672
2672
|
13,
|
|
2673
2673
|
11,
|
|
2674
2674
|
11
|
|
2675
|
-
]),
|
|
2675
|
+
]), l = b.create([0, 1518500249, 1859775393, 2400959708, 2840853838]), d = b.create([1352829926, 1548603684, 1836072691, 2053994217, 0]), C = f.RIPEMD160 = u.extend({
|
|
2676
2676
|
_doReset: function() {
|
|
2677
2677
|
this._hash = b.create([1732584193, 4023233417, 2562383102, 271733878, 3285377520]);
|
|
2678
2678
|
},
|
|
@@ -2681,11 +2681,11 @@ function lt() {
|
|
|
2681
2681
|
var R = g + y, m = E[R];
|
|
2682
2682
|
E[R] = (m << 8 | m >>> 24) & 16711935 | (m << 24 | m >>> 8) & 4278255360;
|
|
2683
2683
|
}
|
|
2684
|
-
var D = this._hash.words, w =
|
|
2685
|
-
I =
|
|
2686
|
-
for (var
|
|
2687
|
-
|
|
2688
|
-
|
|
2684
|
+
var D = this._hash.words, w = l.words, k = d.words, M = a.words, O = n.words, $ = B.words, N = i.words, K, q, U, _, P, I, S, W, z, X;
|
|
2685
|
+
I = K = D[0], S = q = D[1], W = U = D[2], z = _ = D[3], X = P = D[4];
|
|
2686
|
+
for (var T, y = 0; y < 80; y += 1)
|
|
2687
|
+
T = K + E[g + M[y]] | 0, y < 16 ? T += h(q, U, _) + w[0] : y < 32 ? T += A(q, U, _) + w[1] : y < 48 ? T += o(q, U, _) + w[2] : y < 64 ? T += x(q, U, _) + w[3] : T += v(q, U, _) + w[4], T = T | 0, T = F(T, $[y]), T = T + P | 0, K = P, P = _, _ = F(U, 10), U = q, q = T, T = I + E[g + O[y]] | 0, y < 16 ? T += v(S, W, z) + k[0] : y < 32 ? T += x(S, W, z) + k[1] : y < 48 ? T += o(S, W, z) + k[2] : y < 64 ? T += A(S, W, z) + k[3] : T += h(S, W, z) + k[4], T = T | 0, T = F(T, N[y]), T = T + X | 0, I = X, X = z, z = F(W, 10), W = S, S = T;
|
|
2688
|
+
T = D[1] + U + z | 0, D[1] = D[2] + _ + X | 0, D[2] = D[3] + P + I | 0, D[3] = D[4] + K + S | 0, D[4] = D[0] + q + W | 0, D[0] = T;
|
|
2689
2689
|
},
|
|
2690
2690
|
_doFinalize: function() {
|
|
2691
2691
|
var E = this._data, g = E.words, y = this._nDataBytes * 8, R = E.sigBytes * 8;
|
|
@@ -2710,7 +2710,7 @@ function lt() {
|
|
|
2710
2710
|
function o(E, g, y) {
|
|
2711
2711
|
return (E | ~g) ^ y;
|
|
2712
2712
|
}
|
|
2713
|
-
function
|
|
2713
|
+
function x(E, g, y) {
|
|
2714
2714
|
return E & y | g & ~y;
|
|
2715
2715
|
}
|
|
2716
2716
|
function v(E, g, y) {
|
|
@@ -2719,20 +2719,20 @@ function lt() {
|
|
|
2719
2719
|
function F(E, g) {
|
|
2720
2720
|
return E << g | E >>> 32 - g;
|
|
2721
2721
|
}
|
|
2722
|
-
|
|
2723
|
-
})(),
|
|
2722
|
+
s.RIPEMD160 = u._createHelper(C), s.HmacRIPEMD160 = u._createHmacHelper(C);
|
|
2723
|
+
})(), t.RIPEMD160;
|
|
2724
2724
|
});
|
|
2725
2725
|
})(R0)), R0.exports;
|
|
2726
2726
|
}
|
|
2727
2727
|
var H0 = { exports: {} }, dt = H0.exports, Le;
|
|
2728
2728
|
function fe() {
|
|
2729
|
-
return Le || (Le = 1, (function(p,
|
|
2730
|
-
(function(
|
|
2729
|
+
return Le || (Le = 1, (function(p, r) {
|
|
2730
|
+
(function(t, e) {
|
|
2731
2731
|
p.exports = e(L());
|
|
2732
|
-
})(dt, function(
|
|
2732
|
+
})(dt, function(t) {
|
|
2733
2733
|
(function() {
|
|
2734
|
-
var e =
|
|
2735
|
-
f.HMAC =
|
|
2734
|
+
var e = t, s = e.lib, c = s.Base, b = e.enc, u = b.Utf8, f = e.algo;
|
|
2735
|
+
f.HMAC = c.extend({
|
|
2736
2736
|
/**
|
|
2737
2737
|
* Initializes a newly created HMAC.
|
|
2738
2738
|
*
|
|
@@ -2747,9 +2747,9 @@ function fe() {
|
|
|
2747
2747
|
a = this._hasher = new a.init(), typeof n == "string" && (n = u.parse(n));
|
|
2748
2748
|
var B = a.blockSize, i = B * 4;
|
|
2749
2749
|
n.sigBytes > i && (n = a.finalize(n)), n.clamp();
|
|
2750
|
-
for (var
|
|
2750
|
+
for (var l = this._oKey = n.clone(), d = this._iKey = n.clone(), C = l.words, h = d.words, A = 0; A < B; A++)
|
|
2751
2751
|
C[A] ^= 1549556828, h[A] ^= 909522486;
|
|
2752
|
-
|
|
2752
|
+
l.sigBytes = d.sigBytes = i, this.reset();
|
|
2753
2753
|
},
|
|
2754
2754
|
/**
|
|
2755
2755
|
* Resets this HMAC to its initial state.
|
|
@@ -2802,14 +2802,14 @@ function fe() {
|
|
|
2802
2802
|
});
|
|
2803
2803
|
})(H0)), H0.exports;
|
|
2804
2804
|
}
|
|
2805
|
-
var M0 = { exports: {} }, ft = M0.exports,
|
|
2805
|
+
var M0 = { exports: {} }, ft = M0.exports, Ke;
|
|
2806
2806
|
function ut() {
|
|
2807
|
-
return
|
|
2808
|
-
(function(
|
|
2807
|
+
return Ke || (Ke = 1, (function(p, r) {
|
|
2808
|
+
(function(t, e, s) {
|
|
2809
2809
|
p.exports = e(L(), de(), fe());
|
|
2810
|
-
})(ft, function(
|
|
2810
|
+
})(ft, function(t) {
|
|
2811
2811
|
return (function() {
|
|
2812
|
-
var e =
|
|
2812
|
+
var e = t, s = e.lib, c = s.Base, b = s.WordArray, u = e.algo, f = u.SHA256, a = u.HMAC, n = u.PBKDF2 = c.extend({
|
|
2813
2813
|
/**
|
|
2814
2814
|
* Configuration options.
|
|
2815
2815
|
*
|
|
@@ -2817,7 +2817,7 @@ function ut() {
|
|
|
2817
2817
|
* @property {Hasher} hasher The hasher to use. Default: SHA256
|
|
2818
2818
|
* @property {number} iterations The number of iterations to perform. Default: 250000
|
|
2819
2819
|
*/
|
|
2820
|
-
cfg:
|
|
2820
|
+
cfg: c.extend({
|
|
2821
2821
|
keySize: 128 / 32,
|
|
2822
2822
|
hasher: f,
|
|
2823
2823
|
iterations: 25e4
|
|
@@ -2849,34 +2849,34 @@ function ut() {
|
|
|
2849
2849
|
* var key = kdf.compute(password, salt);
|
|
2850
2850
|
*/
|
|
2851
2851
|
compute: function(B, i) {
|
|
2852
|
-
for (var
|
|
2853
|
-
var F =
|
|
2854
|
-
|
|
2852
|
+
for (var l = this.cfg, d = a.create(l.hasher, B), C = b.create(), h = b.create([1]), A = C.words, o = h.words, x = l.keySize, v = l.iterations; A.length < x; ) {
|
|
2853
|
+
var F = d.update(i).finalize(h);
|
|
2854
|
+
d.reset();
|
|
2855
2855
|
for (var E = F.words, g = E.length, y = F, R = 1; R < v; R++) {
|
|
2856
|
-
y =
|
|
2856
|
+
y = d.finalize(y), d.reset();
|
|
2857
2857
|
for (var m = y.words, D = 0; D < g; D++)
|
|
2858
2858
|
E[D] ^= m[D];
|
|
2859
2859
|
}
|
|
2860
2860
|
C.concat(F), o[0]++;
|
|
2861
2861
|
}
|
|
2862
|
-
return C.sigBytes =
|
|
2862
|
+
return C.sigBytes = x * 4, C;
|
|
2863
2863
|
}
|
|
2864
2864
|
});
|
|
2865
|
-
e.PBKDF2 = function(B, i,
|
|
2866
|
-
return n.create(
|
|
2865
|
+
e.PBKDF2 = function(B, i, l) {
|
|
2866
|
+
return n.create(l).compute(B, i);
|
|
2867
2867
|
};
|
|
2868
|
-
})(),
|
|
2868
|
+
})(), t.PBKDF2;
|
|
2869
2869
|
});
|
|
2870
2870
|
})(M0)), M0.exports;
|
|
2871
2871
|
}
|
|
2872
|
-
var O0 = { exports: {} }, ht = O0.exports,
|
|
2872
|
+
var O0 = { exports: {} }, ht = O0.exports, Ue;
|
|
2873
2873
|
function a0() {
|
|
2874
|
-
return
|
|
2875
|
-
(function(
|
|
2874
|
+
return Ue || (Ue = 1, (function(p, r) {
|
|
2875
|
+
(function(t, e, s) {
|
|
2876
2876
|
p.exports = e(L(), lr(), fe());
|
|
2877
|
-
})(ht, function(
|
|
2877
|
+
})(ht, function(t) {
|
|
2878
2878
|
return (function() {
|
|
2879
|
-
var e =
|
|
2879
|
+
var e = t, s = e.lib, c = s.Base, b = s.WordArray, u = e.algo, f = u.MD5, a = u.EvpKDF = c.extend({
|
|
2880
2880
|
/**
|
|
2881
2881
|
* Configuration options.
|
|
2882
2882
|
*
|
|
@@ -2884,7 +2884,7 @@ function a0() {
|
|
|
2884
2884
|
* @property {Hasher} hasher The hash algorithm to use. Default: MD5
|
|
2885
2885
|
* @property {number} iterations The number of iterations to perform. Default: 1
|
|
2886
2886
|
*/
|
|
2887
|
-
cfg:
|
|
2887
|
+
cfg: c.extend({
|
|
2888
2888
|
keySize: 128 / 32,
|
|
2889
2889
|
hasher: f,
|
|
2890
2890
|
iterations: 1
|
|
@@ -2916,10 +2916,10 @@ function a0() {
|
|
|
2916
2916
|
* var key = kdf.compute(password, salt);
|
|
2917
2917
|
*/
|
|
2918
2918
|
compute: function(n, B) {
|
|
2919
|
-
for (var i,
|
|
2920
|
-
i &&
|
|
2921
|
-
for (var
|
|
2922
|
-
i =
|
|
2919
|
+
for (var i, l = this.cfg, d = l.hasher.create(), C = b.create(), h = C.words, A = l.keySize, o = l.iterations; h.length < A; ) {
|
|
2920
|
+
i && d.update(i), i = d.update(n).finalize(B), d.reset();
|
|
2921
|
+
for (var x = 1; x < o; x++)
|
|
2922
|
+
i = d.finalize(i), d.reset();
|
|
2923
2923
|
C.concat(i);
|
|
2924
2924
|
}
|
|
2925
2925
|
return C.sigBytes = A * 4, C;
|
|
@@ -2928,20 +2928,20 @@ function a0() {
|
|
|
2928
2928
|
e.EvpKDF = function(n, B, i) {
|
|
2929
2929
|
return a.create(i).compute(n, B);
|
|
2930
2930
|
};
|
|
2931
|
-
})(),
|
|
2931
|
+
})(), t.EvpKDF;
|
|
2932
2932
|
});
|
|
2933
2933
|
})(O0)), O0.exports;
|
|
2934
2934
|
}
|
|
2935
|
-
var
|
|
2935
|
+
var $0 = { exports: {} }, vt = $0.exports, qe;
|
|
2936
2936
|
function Q() {
|
|
2937
|
-
return
|
|
2938
|
-
(function(
|
|
2937
|
+
return qe || (qe = 1, (function(p, r) {
|
|
2938
|
+
(function(t, e, s) {
|
|
2939
2939
|
p.exports = e(L(), a0());
|
|
2940
|
-
})(vt, function(
|
|
2941
|
-
|
|
2942
|
-
var
|
|
2940
|
+
})(vt, function(t) {
|
|
2941
|
+
t.lib.Cipher || (function(e) {
|
|
2942
|
+
var s = t, c = s.lib, b = c.Base, u = c.WordArray, f = c.BufferedBlockAlgorithm, a = s.enc;
|
|
2943
2943
|
a.Utf8;
|
|
2944
|
-
var n = a.Base64, B =
|
|
2944
|
+
var n = a.Base64, B = s.algo, i = B.EvpKDF, l = c.Cipher = f.extend({
|
|
2945
2945
|
/**
|
|
2946
2946
|
* Configuration options.
|
|
2947
2947
|
*
|
|
@@ -3073,14 +3073,14 @@ function Q() {
|
|
|
3073
3073
|
};
|
|
3074
3074
|
})()
|
|
3075
3075
|
});
|
|
3076
|
-
|
|
3076
|
+
c.StreamCipher = l.extend({
|
|
3077
3077
|
_doFinalize: function() {
|
|
3078
3078
|
var m = this._process(!0);
|
|
3079
3079
|
return m;
|
|
3080
3080
|
},
|
|
3081
3081
|
blockSize: 1
|
|
3082
3082
|
});
|
|
3083
|
-
var
|
|
3083
|
+
var d = s.mode = {}, C = c.BlockCipherMode = b.extend({
|
|
3084
3084
|
/**
|
|
3085
3085
|
* Creates this mode for encryption.
|
|
3086
3086
|
*
|
|
@@ -3124,7 +3124,7 @@ function Q() {
|
|
|
3124
3124
|
init: function(m, D) {
|
|
3125
3125
|
this._cipher = m, this._iv = D;
|
|
3126
3126
|
}
|
|
3127
|
-
}), h =
|
|
3127
|
+
}), h = d.CBC = (function() {
|
|
3128
3128
|
var m = C.extend();
|
|
3129
3129
|
m.Encryptor = m.extend({
|
|
3130
3130
|
/**
|
|
@@ -3153,18 +3153,18 @@ function Q() {
|
|
|
3153
3153
|
* mode.processBlock(data.words, offset);
|
|
3154
3154
|
*/
|
|
3155
3155
|
processBlock: function(w, k) {
|
|
3156
|
-
var M = this._cipher, O = M.blockSize,
|
|
3157
|
-
M.decryptBlock(w, k), D.call(this, w, k, O), this._prevBlock =
|
|
3156
|
+
var M = this._cipher, O = M.blockSize, $ = w.slice(k, k + O);
|
|
3157
|
+
M.decryptBlock(w, k), D.call(this, w, k, O), this._prevBlock = $;
|
|
3158
3158
|
}
|
|
3159
3159
|
});
|
|
3160
3160
|
function D(w, k, M) {
|
|
3161
|
-
var O,
|
|
3162
|
-
|
|
3161
|
+
var O, $ = this._iv;
|
|
3162
|
+
$ ? (O = $, this._iv = e) : O = this._prevBlock;
|
|
3163
3163
|
for (var N = 0; N < M; N++)
|
|
3164
3164
|
w[k + N] ^= O[N];
|
|
3165
3165
|
}
|
|
3166
3166
|
return m;
|
|
3167
|
-
})(), A =
|
|
3167
|
+
})(), A = s.pad = {}, o = A.Pkcs7 = {
|
|
3168
3168
|
/**
|
|
3169
3169
|
* Pads data using the algorithm defined in PKCS #5/7.
|
|
3170
3170
|
*
|
|
@@ -3178,7 +3178,7 @@ function Q() {
|
|
|
3178
3178
|
* CryptoJS.pad.Pkcs7.pad(wordArray, 4);
|
|
3179
3179
|
*/
|
|
3180
3180
|
pad: function(m, D) {
|
|
3181
|
-
for (var w = D * 4, k = w - m.sigBytes % w, M = k << 24 | k << 16 | k << 8 | k, O = [],
|
|
3181
|
+
for (var w = D * 4, k = w - m.sigBytes % w, M = k << 24 | k << 16 | k << 8 | k, O = [], $ = 0; $ < k; $ += 4)
|
|
3182
3182
|
O.push(M);
|
|
3183
3183
|
var N = u.create(O, k);
|
|
3184
3184
|
m.concat(N);
|
|
@@ -3199,20 +3199,20 @@ function Q() {
|
|
|
3199
3199
|
m.sigBytes -= D;
|
|
3200
3200
|
}
|
|
3201
3201
|
};
|
|
3202
|
-
|
|
3202
|
+
c.BlockCipher = l.extend({
|
|
3203
3203
|
/**
|
|
3204
3204
|
* Configuration options.
|
|
3205
3205
|
*
|
|
3206
3206
|
* @property {Mode} mode The block mode to use. Default: CBC
|
|
3207
3207
|
* @property {Padding} padding The padding strategy to use. Default: Pkcs7
|
|
3208
3208
|
*/
|
|
3209
|
-
cfg:
|
|
3209
|
+
cfg: l.cfg.extend({
|
|
3210
3210
|
mode: h,
|
|
3211
3211
|
padding: o
|
|
3212
3212
|
}),
|
|
3213
3213
|
reset: function() {
|
|
3214
3214
|
var m;
|
|
3215
|
-
|
|
3215
|
+
l.reset.call(this);
|
|
3216
3216
|
var D = this.cfg, w = D.iv, k = D.mode;
|
|
3217
3217
|
this._xformMode == this._ENC_XFORM_MODE ? m = k.createEncryptor : (m = k.createDecryptor, this._minBufferSize = 1), this._mode && this._mode.__creator == m ? this._mode.init(this, w && w.words) : (this._mode = m.call(k, this, w && w.words), this._mode.__creator = m);
|
|
3218
3218
|
},
|
|
@@ -3225,7 +3225,7 @@ function Q() {
|
|
|
3225
3225
|
},
|
|
3226
3226
|
blockSize: 128 / 32
|
|
3227
3227
|
});
|
|
3228
|
-
var
|
|
3228
|
+
var x = c.CipherParams = b.extend({
|
|
3229
3229
|
/**
|
|
3230
3230
|
* Initializes a newly created cipher params object.
|
|
3231
3231
|
*
|
|
@@ -3266,7 +3266,7 @@ function Q() {
|
|
|
3266
3266
|
toString: function(m) {
|
|
3267
3267
|
return (m || this.formatter).stringify(this);
|
|
3268
3268
|
}
|
|
3269
|
-
}), v =
|
|
3269
|
+
}), v = s.format = {}, F = v.OpenSSL = {
|
|
3270
3270
|
/**
|
|
3271
3271
|
* Converts a cipher params object to an OpenSSL-compatible string.
|
|
3272
3272
|
*
|
|
@@ -3299,9 +3299,9 @@ function Q() {
|
|
|
3299
3299
|
*/
|
|
3300
3300
|
parse: function(m) {
|
|
3301
3301
|
var D, w = n.parse(m), k = w.words;
|
|
3302
|
-
return k[0] == 1398893684 && k[1] == 1701076831 && (D = u.create(k.slice(2, 4)), k.splice(0, 4), w.sigBytes -= 16),
|
|
3302
|
+
return k[0] == 1398893684 && k[1] == 1701076831 && (D = u.create(k.slice(2, 4)), k.splice(0, 4), w.sigBytes -= 16), x.create({ ciphertext: w, salt: D });
|
|
3303
3303
|
}
|
|
3304
|
-
}, E =
|
|
3304
|
+
}, E = c.SerializableCipher = b.extend({
|
|
3305
3305
|
/**
|
|
3306
3306
|
* Configuration options.
|
|
3307
3307
|
*
|
|
@@ -3330,14 +3330,14 @@ function Q() {
|
|
|
3330
3330
|
*/
|
|
3331
3331
|
encrypt: function(m, D, w, k) {
|
|
3332
3332
|
k = this.cfg.extend(k);
|
|
3333
|
-
var M = m.createEncryptor(w, k), O = M.finalize(D),
|
|
3334
|
-
return
|
|
3333
|
+
var M = m.createEncryptor(w, k), O = M.finalize(D), $ = M.cfg;
|
|
3334
|
+
return x.create({
|
|
3335
3335
|
ciphertext: O,
|
|
3336
3336
|
key: w,
|
|
3337
|
-
iv:
|
|
3337
|
+
iv: $.iv,
|
|
3338
3338
|
algorithm: m,
|
|
3339
|
-
mode:
|
|
3340
|
-
padding:
|
|
3339
|
+
mode: $.mode,
|
|
3340
|
+
padding: $.padding,
|
|
3341
3341
|
blockSize: m.blockSize,
|
|
3342
3342
|
formatter: k.format
|
|
3343
3343
|
});
|
|
@@ -3382,7 +3382,7 @@ function Q() {
|
|
|
3382
3382
|
_parse: function(m, D) {
|
|
3383
3383
|
return typeof m == "string" ? D.parse(m, this) : m;
|
|
3384
3384
|
}
|
|
3385
|
-
}), g =
|
|
3385
|
+
}), g = s.kdf = {}, y = g.OpenSSL = {
|
|
3386
3386
|
/**
|
|
3387
3387
|
* Derives a key and IV from a password.
|
|
3388
3388
|
*
|
|
@@ -3405,10 +3405,10 @@ function Q() {
|
|
|
3405
3405
|
var O = i.create({ keySize: D + w, hasher: M }).compute(m, k);
|
|
3406
3406
|
else
|
|
3407
3407
|
var O = i.create({ keySize: D + w }).compute(m, k);
|
|
3408
|
-
var
|
|
3409
|
-
return O.sigBytes = D * 4,
|
|
3408
|
+
var $ = u.create(O.words.slice(D), w * 4);
|
|
3409
|
+
return O.sigBytes = D * 4, x.create({ key: O, iv: $, salt: k });
|
|
3410
3410
|
}
|
|
3411
|
-
}, R =
|
|
3411
|
+
}, R = c.PasswordBasedCipher = E.extend({
|
|
3412
3412
|
/**
|
|
3413
3413
|
* Configuration options.
|
|
3414
3414
|
*
|
|
@@ -3468,74 +3468,74 @@ function Q() {
|
|
|
3468
3468
|
});
|
|
3469
3469
|
})();
|
|
3470
3470
|
});
|
|
3471
|
-
})(
|
|
3471
|
+
})($0)), $0.exports;
|
|
3472
3472
|
}
|
|
3473
|
-
var
|
|
3473
|
+
var T0 = { exports: {} }, pt = T0.exports, ze;
|
|
3474
3474
|
function Ct() {
|
|
3475
|
-
return
|
|
3476
|
-
(function(
|
|
3475
|
+
return ze || (ze = 1, (function(p, r) {
|
|
3476
|
+
(function(t, e, s) {
|
|
3477
3477
|
p.exports = e(L(), Q());
|
|
3478
|
-
})(pt, function(
|
|
3479
|
-
return
|
|
3480
|
-
var e =
|
|
3478
|
+
})(pt, function(t) {
|
|
3479
|
+
return t.mode.CFB = (function() {
|
|
3480
|
+
var e = t.lib.BlockCipherMode.extend();
|
|
3481
3481
|
e.Encryptor = e.extend({
|
|
3482
|
-
processBlock: function(
|
|
3482
|
+
processBlock: function(c, b) {
|
|
3483
3483
|
var u = this._cipher, f = u.blockSize;
|
|
3484
|
-
|
|
3484
|
+
s.call(this, c, b, f, u), this._prevBlock = c.slice(b, b + f);
|
|
3485
3485
|
}
|
|
3486
3486
|
}), e.Decryptor = e.extend({
|
|
3487
|
-
processBlock: function(
|
|
3488
|
-
var u = this._cipher, f = u.blockSize, a =
|
|
3489
|
-
|
|
3487
|
+
processBlock: function(c, b) {
|
|
3488
|
+
var u = this._cipher, f = u.blockSize, a = c.slice(b, b + f);
|
|
3489
|
+
s.call(this, c, b, f, u), this._prevBlock = a;
|
|
3490
3490
|
}
|
|
3491
3491
|
});
|
|
3492
|
-
function
|
|
3492
|
+
function s(c, b, u, f) {
|
|
3493
3493
|
var a, n = this._iv;
|
|
3494
3494
|
n ? (a = n.slice(0), this._iv = void 0) : a = this._prevBlock, f.encryptBlock(a, 0);
|
|
3495
3495
|
for (var B = 0; B < u; B++)
|
|
3496
|
-
|
|
3496
|
+
c[b + B] ^= a[B];
|
|
3497
3497
|
}
|
|
3498
3498
|
return e;
|
|
3499
|
-
})(),
|
|
3499
|
+
})(), t.mode.CFB;
|
|
3500
3500
|
});
|
|
3501
|
-
})(
|
|
3501
|
+
})(T0)), T0.exports;
|
|
3502
3502
|
}
|
|
3503
3503
|
var L0 = { exports: {} }, Bt = L0.exports, Ne;
|
|
3504
3504
|
function mt() {
|
|
3505
|
-
return Ne || (Ne = 1, (function(p,
|
|
3506
|
-
(function(
|
|
3505
|
+
return Ne || (Ne = 1, (function(p, r) {
|
|
3506
|
+
(function(t, e, s) {
|
|
3507
3507
|
p.exports = e(L(), Q());
|
|
3508
|
-
})(Bt, function(
|
|
3509
|
-
return
|
|
3510
|
-
var e =
|
|
3511
|
-
processBlock: function(
|
|
3508
|
+
})(Bt, function(t) {
|
|
3509
|
+
return t.mode.CTR = (function() {
|
|
3510
|
+
var e = t.lib.BlockCipherMode.extend(), s = e.Encryptor = e.extend({
|
|
3511
|
+
processBlock: function(c, b) {
|
|
3512
3512
|
var u = this._cipher, f = u.blockSize, a = this._iv, n = this._counter;
|
|
3513
3513
|
a && (n = this._counter = a.slice(0), this._iv = void 0);
|
|
3514
3514
|
var B = n.slice(0);
|
|
3515
3515
|
u.encryptBlock(B, 0), n[f - 1] = n[f - 1] + 1 | 0;
|
|
3516
3516
|
for (var i = 0; i < f; i++)
|
|
3517
|
-
|
|
3517
|
+
c[b + i] ^= B[i];
|
|
3518
3518
|
}
|
|
3519
3519
|
});
|
|
3520
|
-
return e.Decryptor =
|
|
3521
|
-
})(),
|
|
3520
|
+
return e.Decryptor = s, e;
|
|
3521
|
+
})(), t.mode.CTR;
|
|
3522
3522
|
});
|
|
3523
3523
|
})(L0)), L0.exports;
|
|
3524
3524
|
}
|
|
3525
|
-
var
|
|
3525
|
+
var K0 = { exports: {} }, At = K0.exports, We;
|
|
3526
3526
|
function Et() {
|
|
3527
|
-
return We || (We = 1, (function(p,
|
|
3528
|
-
(function(
|
|
3527
|
+
return We || (We = 1, (function(p, r) {
|
|
3528
|
+
(function(t, e, s) {
|
|
3529
3529
|
p.exports = e(L(), Q());
|
|
3530
|
-
})(At, function(
|
|
3530
|
+
})(At, function(t) {
|
|
3531
3531
|
/** @preserve
|
|
3532
3532
|
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
3533
3533
|
* derived from CryptoJS.mode.CTR
|
|
3534
3534
|
* Jan Hruby jhruby.web@gmail.com
|
|
3535
3535
|
*/
|
|
3536
|
-
return
|
|
3537
|
-
var e =
|
|
3538
|
-
function
|
|
3536
|
+
return t.mode.CTRGladman = (function() {
|
|
3537
|
+
var e = t.lib.BlockCipherMode.extend();
|
|
3538
|
+
function s(u) {
|
|
3539
3539
|
if ((u >> 24 & 255) === 255) {
|
|
3540
3540
|
var f = u >> 16 & 255, a = u >> 8 & 255, n = u & 255;
|
|
3541
3541
|
f === 255 ? (f = 0, a === 255 ? (a = 0, n === 255 ? n = 0 : ++n) : ++a) : ++f, u = 0, u += f << 16, u += a << 8, u += n;
|
|
@@ -3543,165 +3543,165 @@ function Et() {
|
|
|
3543
3543
|
u += 1 << 24;
|
|
3544
3544
|
return u;
|
|
3545
3545
|
}
|
|
3546
|
-
function
|
|
3547
|
-
return (u[0] =
|
|
3546
|
+
function c(u) {
|
|
3547
|
+
return (u[0] = s(u[0])) === 0 && (u[1] = s(u[1])), u;
|
|
3548
3548
|
}
|
|
3549
3549
|
var b = e.Encryptor = e.extend({
|
|
3550
3550
|
processBlock: function(u, f) {
|
|
3551
3551
|
var a = this._cipher, n = a.blockSize, B = this._iv, i = this._counter;
|
|
3552
|
-
B && (i = this._counter = B.slice(0), this._iv = void 0),
|
|
3553
|
-
var
|
|
3554
|
-
a.encryptBlock(
|
|
3555
|
-
for (var
|
|
3556
|
-
u[f +
|
|
3552
|
+
B && (i = this._counter = B.slice(0), this._iv = void 0), c(i);
|
|
3553
|
+
var l = i.slice(0);
|
|
3554
|
+
a.encryptBlock(l, 0);
|
|
3555
|
+
for (var d = 0; d < n; d++)
|
|
3556
|
+
u[f + d] ^= l[d];
|
|
3557
3557
|
}
|
|
3558
3558
|
});
|
|
3559
3559
|
return e.Decryptor = b, e;
|
|
3560
|
-
})(),
|
|
3560
|
+
})(), t.mode.CTRGladman;
|
|
3561
3561
|
});
|
|
3562
|
-
})(
|
|
3562
|
+
})(K0)), K0.exports;
|
|
3563
3563
|
}
|
|
3564
|
-
var
|
|
3564
|
+
var U0 = { exports: {} }, Ft = U0.exports, Ge;
|
|
3565
3565
|
function Dt() {
|
|
3566
|
-
return Ge || (Ge = 1, (function(p,
|
|
3567
|
-
(function(
|
|
3566
|
+
return Ge || (Ge = 1, (function(p, r) {
|
|
3567
|
+
(function(t, e, s) {
|
|
3568
3568
|
p.exports = e(L(), Q());
|
|
3569
|
-
})(Ft, function(
|
|
3570
|
-
return
|
|
3571
|
-
var e =
|
|
3572
|
-
processBlock: function(
|
|
3569
|
+
})(Ft, function(t) {
|
|
3570
|
+
return t.mode.OFB = (function() {
|
|
3571
|
+
var e = t.lib.BlockCipherMode.extend(), s = e.Encryptor = e.extend({
|
|
3572
|
+
processBlock: function(c, b) {
|
|
3573
3573
|
var u = this._cipher, f = u.blockSize, a = this._iv, n = this._keystream;
|
|
3574
3574
|
a && (n = this._keystream = a.slice(0), this._iv = void 0), u.encryptBlock(n, 0);
|
|
3575
3575
|
for (var B = 0; B < f; B++)
|
|
3576
|
-
|
|
3576
|
+
c[b + B] ^= n[B];
|
|
3577
3577
|
}
|
|
3578
3578
|
});
|
|
3579
|
-
return e.Decryptor =
|
|
3580
|
-
})(),
|
|
3579
|
+
return e.Decryptor = s, e;
|
|
3580
|
+
})(), t.mode.OFB;
|
|
3581
3581
|
});
|
|
3582
|
-
})(
|
|
3582
|
+
})(U0)), U0.exports;
|
|
3583
3583
|
}
|
|
3584
|
-
var
|
|
3584
|
+
var q0 = { exports: {} }, gt = q0.exports, Qe;
|
|
3585
3585
|
function bt() {
|
|
3586
|
-
return Qe || (Qe = 1, (function(p,
|
|
3587
|
-
(function(
|
|
3586
|
+
return Qe || (Qe = 1, (function(p, r) {
|
|
3587
|
+
(function(t, e, s) {
|
|
3588
3588
|
p.exports = e(L(), Q());
|
|
3589
|
-
})(gt, function(
|
|
3590
|
-
return
|
|
3591
|
-
var e =
|
|
3589
|
+
})(gt, function(t) {
|
|
3590
|
+
return t.mode.ECB = (function() {
|
|
3591
|
+
var e = t.lib.BlockCipherMode.extend();
|
|
3592
3592
|
return e.Encryptor = e.extend({
|
|
3593
|
-
processBlock: function(
|
|
3594
|
-
this._cipher.encryptBlock(
|
|
3593
|
+
processBlock: function(s, c) {
|
|
3594
|
+
this._cipher.encryptBlock(s, c);
|
|
3595
3595
|
}
|
|
3596
3596
|
}), e.Decryptor = e.extend({
|
|
3597
|
-
processBlock: function(
|
|
3598
|
-
this._cipher.decryptBlock(
|
|
3597
|
+
processBlock: function(s, c) {
|
|
3598
|
+
this._cipher.decryptBlock(s, c);
|
|
3599
3599
|
}
|
|
3600
3600
|
}), e;
|
|
3601
|
-
})(),
|
|
3601
|
+
})(), t.mode.ECB;
|
|
3602
3602
|
});
|
|
3603
|
-
})(
|
|
3603
|
+
})(q0)), q0.exports;
|
|
3604
3604
|
}
|
|
3605
|
-
var
|
|
3605
|
+
var z0 = { exports: {} }, yt = z0.exports, Xe;
|
|
3606
3606
|
function _t() {
|
|
3607
|
-
return Xe || (Xe = 1, (function(p,
|
|
3608
|
-
(function(
|
|
3607
|
+
return Xe || (Xe = 1, (function(p, r) {
|
|
3608
|
+
(function(t, e, s) {
|
|
3609
3609
|
p.exports = e(L(), Q());
|
|
3610
|
-
})(yt, function(
|
|
3611
|
-
return
|
|
3612
|
-
pad: function(e,
|
|
3613
|
-
var
|
|
3610
|
+
})(yt, function(t) {
|
|
3611
|
+
return t.pad.AnsiX923 = {
|
|
3612
|
+
pad: function(e, s) {
|
|
3613
|
+
var c = e.sigBytes, b = s * 4, u = b - c % b, f = c + u - 1;
|
|
3614
3614
|
e.clamp(), e.words[f >>> 2] |= u << 24 - f % 4 * 8, e.sigBytes += u;
|
|
3615
3615
|
},
|
|
3616
3616
|
unpad: function(e) {
|
|
3617
|
-
var
|
|
3618
|
-
e.sigBytes -=
|
|
3617
|
+
var s = e.words[e.sigBytes - 1 >>> 2] & 255;
|
|
3618
|
+
e.sigBytes -= s;
|
|
3619
3619
|
}
|
|
3620
|
-
},
|
|
3620
|
+
}, t.pad.Ansix923;
|
|
3621
3621
|
});
|
|
3622
|
-
})(
|
|
3622
|
+
})(z0)), z0.exports;
|
|
3623
3623
|
}
|
|
3624
3624
|
var N0 = { exports: {} }, wt = N0.exports, Ve;
|
|
3625
3625
|
function kt() {
|
|
3626
|
-
return Ve || (Ve = 1, (function(p,
|
|
3627
|
-
(function(
|
|
3626
|
+
return Ve || (Ve = 1, (function(p, r) {
|
|
3627
|
+
(function(t, e, s) {
|
|
3628
3628
|
p.exports = e(L(), Q());
|
|
3629
|
-
})(wt, function(
|
|
3630
|
-
return
|
|
3631
|
-
pad: function(e,
|
|
3632
|
-
var
|
|
3633
|
-
e.concat(
|
|
3629
|
+
})(wt, function(t) {
|
|
3630
|
+
return t.pad.Iso10126 = {
|
|
3631
|
+
pad: function(e, s) {
|
|
3632
|
+
var c = s * 4, b = c - e.sigBytes % c;
|
|
3633
|
+
e.concat(t.lib.WordArray.random(b - 1)).concat(t.lib.WordArray.create([b << 24], 1));
|
|
3634
3634
|
},
|
|
3635
3635
|
unpad: function(e) {
|
|
3636
|
-
var
|
|
3637
|
-
e.sigBytes -=
|
|
3636
|
+
var s = e.words[e.sigBytes - 1 >>> 2] & 255;
|
|
3637
|
+
e.sigBytes -= s;
|
|
3638
3638
|
}
|
|
3639
|
-
},
|
|
3639
|
+
}, t.pad.Iso10126;
|
|
3640
3640
|
});
|
|
3641
3641
|
})(N0)), N0.exports;
|
|
3642
3642
|
}
|
|
3643
3643
|
var W0 = { exports: {} }, St = W0.exports, je;
|
|
3644
3644
|
function Pt() {
|
|
3645
|
-
return je || (je = 1, (function(p,
|
|
3646
|
-
(function(
|
|
3645
|
+
return je || (je = 1, (function(p, r) {
|
|
3646
|
+
(function(t, e, s) {
|
|
3647
3647
|
p.exports = e(L(), Q());
|
|
3648
|
-
})(St, function(
|
|
3649
|
-
return
|
|
3650
|
-
pad: function(e,
|
|
3651
|
-
e.concat(
|
|
3648
|
+
})(St, function(t) {
|
|
3649
|
+
return t.pad.Iso97971 = {
|
|
3650
|
+
pad: function(e, s) {
|
|
3651
|
+
e.concat(t.lib.WordArray.create([2147483648], 1)), t.pad.ZeroPadding.pad(e, s);
|
|
3652
3652
|
},
|
|
3653
3653
|
unpad: function(e) {
|
|
3654
|
-
|
|
3654
|
+
t.pad.ZeroPadding.unpad(e), e.sigBytes--;
|
|
3655
3655
|
}
|
|
3656
|
-
},
|
|
3656
|
+
}, t.pad.Iso97971;
|
|
3657
3657
|
});
|
|
3658
3658
|
})(W0)), W0.exports;
|
|
3659
3659
|
}
|
|
3660
3660
|
var G0 = { exports: {} }, It = G0.exports, Ze;
|
|
3661
3661
|
function Rt() {
|
|
3662
|
-
return Ze || (Ze = 1, (function(p,
|
|
3663
|
-
(function(
|
|
3662
|
+
return Ze || (Ze = 1, (function(p, r) {
|
|
3663
|
+
(function(t, e, s) {
|
|
3664
3664
|
p.exports = e(L(), Q());
|
|
3665
|
-
})(It, function(
|
|
3666
|
-
return
|
|
3667
|
-
pad: function(e,
|
|
3668
|
-
var
|
|
3669
|
-
e.clamp(), e.sigBytes +=
|
|
3665
|
+
})(It, function(t) {
|
|
3666
|
+
return t.pad.ZeroPadding = {
|
|
3667
|
+
pad: function(e, s) {
|
|
3668
|
+
var c = s * 4;
|
|
3669
|
+
e.clamp(), e.sigBytes += c - (e.sigBytes % c || c);
|
|
3670
3670
|
},
|
|
3671
3671
|
unpad: function(e) {
|
|
3672
|
-
for (var
|
|
3673
|
-
if (
|
|
3674
|
-
e.sigBytes =
|
|
3672
|
+
for (var s = e.words, c = e.sigBytes - 1, c = e.sigBytes - 1; c >= 0; c--)
|
|
3673
|
+
if (s[c >>> 2] >>> 24 - c % 4 * 8 & 255) {
|
|
3674
|
+
e.sigBytes = c + 1;
|
|
3675
3675
|
break;
|
|
3676
3676
|
}
|
|
3677
3677
|
}
|
|
3678
|
-
},
|
|
3678
|
+
}, t.pad.ZeroPadding;
|
|
3679
3679
|
});
|
|
3680
3680
|
})(G0)), G0.exports;
|
|
3681
3681
|
}
|
|
3682
3682
|
var Q0 = { exports: {} }, Ht = Q0.exports, Ye;
|
|
3683
3683
|
function Mt() {
|
|
3684
|
-
return Ye || (Ye = 1, (function(p,
|
|
3685
|
-
(function(
|
|
3684
|
+
return Ye || (Ye = 1, (function(p, r) {
|
|
3685
|
+
(function(t, e, s) {
|
|
3686
3686
|
p.exports = e(L(), Q());
|
|
3687
|
-
})(Ht, function(
|
|
3688
|
-
return
|
|
3687
|
+
})(Ht, function(t) {
|
|
3688
|
+
return t.pad.NoPadding = {
|
|
3689
3689
|
pad: function() {
|
|
3690
3690
|
},
|
|
3691
3691
|
unpad: function() {
|
|
3692
3692
|
}
|
|
3693
|
-
},
|
|
3693
|
+
}, t.pad.NoPadding;
|
|
3694
3694
|
});
|
|
3695
3695
|
})(Q0)), Q0.exports;
|
|
3696
3696
|
}
|
|
3697
3697
|
var X0 = { exports: {} }, Ot = X0.exports, Je;
|
|
3698
|
-
function
|
|
3699
|
-
return Je || (Je = 1, (function(p,
|
|
3700
|
-
(function(
|
|
3698
|
+
function $t() {
|
|
3699
|
+
return Je || (Je = 1, (function(p, r) {
|
|
3700
|
+
(function(t, e, s) {
|
|
3701
3701
|
p.exports = e(L(), Q());
|
|
3702
|
-
})(Ot, function(
|
|
3702
|
+
})(Ot, function(t) {
|
|
3703
3703
|
return (function(e) {
|
|
3704
|
-
var
|
|
3704
|
+
var s = t, c = s.lib, b = c.CipherParams, u = s.enc, f = u.Hex, a = s.format;
|
|
3705
3705
|
a.Hex = {
|
|
3706
3706
|
/**
|
|
3707
3707
|
* Converts the ciphertext of a cipher params object to a hexadecimally encoded string.
|
|
@@ -3737,78 +3737,78 @@ function Tt() {
|
|
|
3737
3737
|
return b.create({ ciphertext: B });
|
|
3738
3738
|
}
|
|
3739
3739
|
};
|
|
3740
|
-
})(),
|
|
3740
|
+
})(), t.format.Hex;
|
|
3741
3741
|
});
|
|
3742
3742
|
})(X0)), X0.exports;
|
|
3743
3743
|
}
|
|
3744
|
-
var V0 = { exports: {} },
|
|
3744
|
+
var V0 = { exports: {} }, Tt = V0.exports, er;
|
|
3745
3745
|
function Lt() {
|
|
3746
|
-
return er || (er = 1, (function(p,
|
|
3747
|
-
(function(
|
|
3746
|
+
return er || (er = 1, (function(p, r) {
|
|
3747
|
+
(function(t, e, s) {
|
|
3748
3748
|
p.exports = e(L(), n0(), i0(), a0(), Q());
|
|
3749
|
-
})(
|
|
3749
|
+
})(Tt, function(t) {
|
|
3750
3750
|
return (function() {
|
|
3751
|
-
var e =
|
|
3751
|
+
var e = t, s = e.lib, c = s.BlockCipher, b = e.algo, u = [], f = [], a = [], n = [], B = [], i = [], l = [], d = [], C = [], h = [];
|
|
3752
3752
|
(function() {
|
|
3753
|
-
for (var
|
|
3754
|
-
v < 128 ?
|
|
3753
|
+
for (var x = [], v = 0; v < 256; v++)
|
|
3754
|
+
v < 128 ? x[v] = v << 1 : x[v] = v << 1 ^ 283;
|
|
3755
3755
|
for (var F = 0, E = 0, v = 0; v < 256; v++) {
|
|
3756
3756
|
var g = E ^ E << 1 ^ E << 2 ^ E << 3 ^ E << 4;
|
|
3757
3757
|
g = g >>> 8 ^ g & 255 ^ 99, u[F] = g, f[g] = F;
|
|
3758
|
-
var y =
|
|
3758
|
+
var y = x[F], R = x[y], m = x[R], D = x[g] * 257 ^ g * 16843008;
|
|
3759
3759
|
a[F] = D << 24 | D >>> 8, n[F] = D << 16 | D >>> 16, B[F] = D << 8 | D >>> 24, i[F] = D;
|
|
3760
3760
|
var D = m * 16843009 ^ R * 65537 ^ y * 257 ^ F * 16843008;
|
|
3761
|
-
|
|
3761
|
+
l[g] = D << 24 | D >>> 8, d[g] = D << 16 | D >>> 16, C[g] = D << 8 | D >>> 24, h[g] = D, F ? (F = y ^ x[x[x[m ^ y]]], E ^= x[x[E]]) : F = E = 1;
|
|
3762
3762
|
}
|
|
3763
3763
|
})();
|
|
3764
|
-
var A = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], o = b.AES =
|
|
3764
|
+
var A = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], o = b.AES = c.extend({
|
|
3765
3765
|
_doReset: function() {
|
|
3766
|
-
var
|
|
3766
|
+
var x;
|
|
3767
3767
|
if (!(this._nRounds && this._keyPriorReset === this._key)) {
|
|
3768
3768
|
for (var v = this._keyPriorReset = this._key, F = v.words, E = v.sigBytes / 4, g = this._nRounds = E + 6, y = (g + 1) * 4, R = this._keySchedule = [], m = 0; m < y; m++)
|
|
3769
|
-
m < E ? R[m] = F[m] : (
|
|
3769
|
+
m < E ? R[m] = F[m] : (x = R[m - 1], m % E ? E > 6 && m % E == 4 && (x = u[x >>> 24] << 24 | u[x >>> 16 & 255] << 16 | u[x >>> 8 & 255] << 8 | u[x & 255]) : (x = x << 8 | x >>> 24, x = u[x >>> 24] << 24 | u[x >>> 16 & 255] << 16 | u[x >>> 8 & 255] << 8 | u[x & 255], x ^= A[m / E | 0] << 24), R[m] = R[m - E] ^ x);
|
|
3770
3770
|
for (var D = this._invKeySchedule = [], w = 0; w < y; w++) {
|
|
3771
3771
|
var m = y - w;
|
|
3772
3772
|
if (w % 4)
|
|
3773
|
-
var
|
|
3773
|
+
var x = R[m];
|
|
3774
3774
|
else
|
|
3775
|
-
var
|
|
3776
|
-
w < 4 || m <= 4 ? D[w] =
|
|
3775
|
+
var x = R[m - 4];
|
|
3776
|
+
w < 4 || m <= 4 ? D[w] = x : D[w] = l[u[x >>> 24]] ^ d[u[x >>> 16 & 255]] ^ C[u[x >>> 8 & 255]] ^ h[u[x & 255]];
|
|
3777
3777
|
}
|
|
3778
3778
|
}
|
|
3779
3779
|
},
|
|
3780
|
-
encryptBlock: function(
|
|
3781
|
-
this._doCryptBlock(
|
|
3780
|
+
encryptBlock: function(x, v) {
|
|
3781
|
+
this._doCryptBlock(x, v, this._keySchedule, a, n, B, i, u);
|
|
3782
3782
|
},
|
|
3783
|
-
decryptBlock: function(
|
|
3784
|
-
var F =
|
|
3785
|
-
|
|
3786
|
-
var F =
|
|
3787
|
-
|
|
3783
|
+
decryptBlock: function(x, v) {
|
|
3784
|
+
var F = x[v + 1];
|
|
3785
|
+
x[v + 1] = x[v + 3], x[v + 3] = F, this._doCryptBlock(x, v, this._invKeySchedule, l, d, C, h, f);
|
|
3786
|
+
var F = x[v + 1];
|
|
3787
|
+
x[v + 1] = x[v + 3], x[v + 3] = F;
|
|
3788
3788
|
},
|
|
3789
|
-
_doCryptBlock: function(
|
|
3790
|
-
for (var D = this._nRounds, w =
|
|
3791
|
-
var
|
|
3792
|
-
w =
|
|
3789
|
+
_doCryptBlock: function(x, v, F, E, g, y, R, m) {
|
|
3790
|
+
for (var D = this._nRounds, w = x[v] ^ F[0], k = x[v + 1] ^ F[1], M = x[v + 2] ^ F[2], O = x[v + 3] ^ F[3], $ = 4, N = 1; N < D; N++) {
|
|
3791
|
+
var K = E[w >>> 24] ^ g[k >>> 16 & 255] ^ y[M >>> 8 & 255] ^ R[O & 255] ^ F[$++], q = E[k >>> 24] ^ g[M >>> 16 & 255] ^ y[O >>> 8 & 255] ^ R[w & 255] ^ F[$++], U = E[M >>> 24] ^ g[O >>> 16 & 255] ^ y[w >>> 8 & 255] ^ R[k & 255] ^ F[$++], _ = E[O >>> 24] ^ g[w >>> 16 & 255] ^ y[k >>> 8 & 255] ^ R[M & 255] ^ F[$++];
|
|
3792
|
+
w = K, k = q, M = U, O = _;
|
|
3793
3793
|
}
|
|
3794
|
-
var
|
|
3795
|
-
|
|
3794
|
+
var K = (m[w >>> 24] << 24 | m[k >>> 16 & 255] << 16 | m[M >>> 8 & 255] << 8 | m[O & 255]) ^ F[$++], q = (m[k >>> 24] << 24 | m[M >>> 16 & 255] << 16 | m[O >>> 8 & 255] << 8 | m[w & 255]) ^ F[$++], U = (m[M >>> 24] << 24 | m[O >>> 16 & 255] << 16 | m[w >>> 8 & 255] << 8 | m[k & 255]) ^ F[$++], _ = (m[O >>> 24] << 24 | m[w >>> 16 & 255] << 16 | m[k >>> 8 & 255] << 8 | m[M & 255]) ^ F[$++];
|
|
3795
|
+
x[v] = K, x[v + 1] = q, x[v + 2] = U, x[v + 3] = _;
|
|
3796
3796
|
},
|
|
3797
3797
|
keySize: 256 / 32
|
|
3798
3798
|
});
|
|
3799
|
-
e.AES =
|
|
3800
|
-
})(),
|
|
3799
|
+
e.AES = c._createHelper(o);
|
|
3800
|
+
})(), t.AES;
|
|
3801
3801
|
});
|
|
3802
3802
|
})(V0)), V0.exports;
|
|
3803
3803
|
}
|
|
3804
|
-
var j0 = { exports: {} },
|
|
3805
|
-
function
|
|
3806
|
-
return rr || (rr = 1, (function(p,
|
|
3807
|
-
(function(
|
|
3804
|
+
var j0 = { exports: {} }, Kt = j0.exports, rr;
|
|
3805
|
+
function Ut() {
|
|
3806
|
+
return rr || (rr = 1, (function(p, r) {
|
|
3807
|
+
(function(t, e, s) {
|
|
3808
3808
|
p.exports = e(L(), n0(), i0(), a0(), Q());
|
|
3809
|
-
})(
|
|
3809
|
+
})(Kt, function(t) {
|
|
3810
3810
|
return (function() {
|
|
3811
|
-
var e =
|
|
3811
|
+
var e = t, s = e.lib, c = s.WordArray, b = s.BlockCipher, u = e.algo, f = [
|
|
3812
3812
|
57,
|
|
3813
3813
|
49,
|
|
3814
3814
|
41,
|
|
@@ -4452,15 +4452,15 @@ function Kt() {
|
|
|
4452
4452
|
8064,
|
|
4453
4453
|
504,
|
|
4454
4454
|
2147483679
|
|
4455
|
-
],
|
|
4455
|
+
], l = u.DES = b.extend({
|
|
4456
4456
|
_doReset: function() {
|
|
4457
|
-
for (var A = this._key, o = A.words,
|
|
4457
|
+
for (var A = this._key, o = A.words, x = [], v = 0; v < 56; v++) {
|
|
4458
4458
|
var F = f[v] - 1;
|
|
4459
|
-
|
|
4459
|
+
x[v] = o[F >>> 5] >>> 31 - F % 32 & 1;
|
|
4460
4460
|
}
|
|
4461
4461
|
for (var E = this._subKeys = [], g = 0; g < 16; g++) {
|
|
4462
4462
|
for (var y = E[g] = [], R = n[g], v = 0; v < 24; v++)
|
|
4463
|
-
y[v / 6 | 0] |=
|
|
4463
|
+
y[v / 6 | 0] |= x[(a[v] - 1 + R) % 28] << 31 - v % 6, y[4 + (v / 6 | 0)] |= x[28 + (a[v + 24] - 1 + R) % 28] << 31 - v % 6;
|
|
4464
4464
|
y[0] = y[0] << 1 | y[0] >>> 31;
|
|
4465
4465
|
for (var v = 1; v < 7; v++)
|
|
4466
4466
|
y[v] = y[v] >>> (v - 1) * 4 + 3;
|
|
@@ -4475,36 +4475,36 @@ function Kt() {
|
|
|
4475
4475
|
decryptBlock: function(A, o) {
|
|
4476
4476
|
this._doCryptBlock(A, o, this._invSubKeys);
|
|
4477
4477
|
},
|
|
4478
|
-
_doCryptBlock: function(A, o,
|
|
4479
|
-
this._lBlock = A[o], this._rBlock = A[o + 1],
|
|
4478
|
+
_doCryptBlock: function(A, o, x) {
|
|
4479
|
+
this._lBlock = A[o], this._rBlock = A[o + 1], d.call(this, 4, 252645135), d.call(this, 16, 65535), C.call(this, 2, 858993459), C.call(this, 8, 16711935), d.call(this, 1, 1431655765);
|
|
4480
4480
|
for (var v = 0; v < 16; v++) {
|
|
4481
|
-
for (var F =
|
|
4481
|
+
for (var F = x[v], E = this._lBlock, g = this._rBlock, y = 0, R = 0; R < 8; R++)
|
|
4482
4482
|
y |= B[R][((g ^ F[R]) & i[R]) >>> 0];
|
|
4483
4483
|
this._lBlock = g, this._rBlock = E ^ y;
|
|
4484
4484
|
}
|
|
4485
4485
|
var m = this._lBlock;
|
|
4486
|
-
this._lBlock = this._rBlock, this._rBlock = m,
|
|
4486
|
+
this._lBlock = this._rBlock, this._rBlock = m, d.call(this, 1, 1431655765), C.call(this, 8, 16711935), C.call(this, 2, 858993459), d.call(this, 16, 65535), d.call(this, 4, 252645135), A[o] = this._lBlock, A[o + 1] = this._rBlock;
|
|
4487
4487
|
},
|
|
4488
4488
|
keySize: 64 / 32,
|
|
4489
4489
|
ivSize: 64 / 32,
|
|
4490
4490
|
blockSize: 64 / 32
|
|
4491
4491
|
});
|
|
4492
|
-
function
|
|
4493
|
-
var
|
|
4494
|
-
this._rBlock ^=
|
|
4492
|
+
function d(A, o) {
|
|
4493
|
+
var x = (this._lBlock >>> A ^ this._rBlock) & o;
|
|
4494
|
+
this._rBlock ^= x, this._lBlock ^= x << A;
|
|
4495
4495
|
}
|
|
4496
4496
|
function C(A, o) {
|
|
4497
|
-
var
|
|
4498
|
-
this._lBlock ^=
|
|
4497
|
+
var x = (this._rBlock >>> A ^ this._lBlock) & o;
|
|
4498
|
+
this._lBlock ^= x, this._rBlock ^= x << A;
|
|
4499
4499
|
}
|
|
4500
|
-
e.DES = b._createHelper(
|
|
4500
|
+
e.DES = b._createHelper(l);
|
|
4501
4501
|
var h = u.TripleDES = b.extend({
|
|
4502
4502
|
_doReset: function() {
|
|
4503
4503
|
var A = this._key, o = A.words;
|
|
4504
4504
|
if (o.length !== 2 && o.length !== 4 && o.length < 6)
|
|
4505
4505
|
throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");
|
|
4506
|
-
var
|
|
4507
|
-
this._des1 =
|
|
4506
|
+
var x = o.slice(0, 2), v = o.length < 4 ? o.slice(0, 2) : o.slice(2, 4), F = o.length < 6 ? o.slice(0, 2) : o.slice(4, 6);
|
|
4507
|
+
this._des1 = l.createEncryptor(c.create(x)), this._des2 = l.createEncryptor(c.create(v)), this._des3 = l.createEncryptor(c.create(F));
|
|
4508
4508
|
},
|
|
4509
4509
|
encryptBlock: function(A, o) {
|
|
4510
4510
|
this._des1.encryptBlock(A, o), this._des2.decryptBlock(A, o), this._des3.encryptBlock(A, o);
|
|
@@ -4517,26 +4517,26 @@ function Kt() {
|
|
|
4517
4517
|
blockSize: 64 / 32
|
|
4518
4518
|
});
|
|
4519
4519
|
e.TripleDES = b._createHelper(h);
|
|
4520
|
-
})(),
|
|
4520
|
+
})(), t.TripleDES;
|
|
4521
4521
|
});
|
|
4522
4522
|
})(j0)), j0.exports;
|
|
4523
4523
|
}
|
|
4524
|
-
var Z0 = { exports: {} },
|
|
4525
|
-
function
|
|
4526
|
-
return tr || (tr = 1, (function(p,
|
|
4527
|
-
(function(
|
|
4524
|
+
var Z0 = { exports: {} }, qt = Z0.exports, tr;
|
|
4525
|
+
function zt() {
|
|
4526
|
+
return tr || (tr = 1, (function(p, r) {
|
|
4527
|
+
(function(t, e, s) {
|
|
4528
4528
|
p.exports = e(L(), n0(), i0(), a0(), Q());
|
|
4529
|
-
})(
|
|
4529
|
+
})(qt, function(t) {
|
|
4530
4530
|
return (function() {
|
|
4531
|
-
var e =
|
|
4531
|
+
var e = t, s = e.lib, c = s.StreamCipher, b = e.algo, u = b.RC4 = c.extend({
|
|
4532
4532
|
_doReset: function() {
|
|
4533
|
-
for (var n = this._key, B = n.words, i = n.sigBytes,
|
|
4534
|
-
|
|
4535
|
-
for (var
|
|
4536
|
-
var h =
|
|
4537
|
-
C = (C +
|
|
4538
|
-
var o =
|
|
4539
|
-
|
|
4533
|
+
for (var n = this._key, B = n.words, i = n.sigBytes, l = this._S = [], d = 0; d < 256; d++)
|
|
4534
|
+
l[d] = d;
|
|
4535
|
+
for (var d = 0, C = 0; d < 256; d++) {
|
|
4536
|
+
var h = d % i, A = B[h >>> 2] >>> 24 - h % 4 * 8 & 255;
|
|
4537
|
+
C = (C + l[d] + A) % 256;
|
|
4538
|
+
var o = l[d];
|
|
4539
|
+
l[d] = l[C], l[C] = o;
|
|
4540
4540
|
}
|
|
4541
4541
|
this._i = this._j = 0;
|
|
4542
4542
|
},
|
|
@@ -4547,14 +4547,14 @@ function Ut() {
|
|
|
4547
4547
|
ivSize: 0
|
|
4548
4548
|
});
|
|
4549
4549
|
function f() {
|
|
4550
|
-
for (var n = this._S, B = this._i, i = this._j,
|
|
4550
|
+
for (var n = this._S, B = this._i, i = this._j, l = 0, d = 0; d < 4; d++) {
|
|
4551
4551
|
B = (B + 1) % 256, i = (i + n[B]) % 256;
|
|
4552
4552
|
var C = n[B];
|
|
4553
|
-
n[B] = n[i], n[i] = C,
|
|
4553
|
+
n[B] = n[i], n[i] = C, l |= n[(n[B] + n[i]) % 256] << 24 - d * 8;
|
|
4554
4554
|
}
|
|
4555
|
-
return this._i = B, this._j = i,
|
|
4555
|
+
return this._i = B, this._j = i, l;
|
|
4556
4556
|
}
|
|
4557
|
-
e.RC4 =
|
|
4557
|
+
e.RC4 = c._createHelper(u);
|
|
4558
4558
|
var a = b.RC4Drop = u.extend({
|
|
4559
4559
|
/**
|
|
4560
4560
|
* Configuration options.
|
|
@@ -4570,22 +4570,22 @@ function Ut() {
|
|
|
4570
4570
|
f.call(this);
|
|
4571
4571
|
}
|
|
4572
4572
|
});
|
|
4573
|
-
e.RC4Drop =
|
|
4574
|
-
})(),
|
|
4573
|
+
e.RC4Drop = c._createHelper(a);
|
|
4574
|
+
})(), t.RC4;
|
|
4575
4575
|
});
|
|
4576
4576
|
})(Z0)), Z0.exports;
|
|
4577
4577
|
}
|
|
4578
4578
|
var Y0 = { exports: {} }, Nt = Y0.exports, ar;
|
|
4579
4579
|
function Wt() {
|
|
4580
|
-
return ar || (ar = 1, (function(p,
|
|
4581
|
-
(function(
|
|
4580
|
+
return ar || (ar = 1, (function(p, r) {
|
|
4581
|
+
(function(t, e, s) {
|
|
4582
4582
|
p.exports = e(L(), n0(), i0(), a0(), Q());
|
|
4583
|
-
})(Nt, function(
|
|
4583
|
+
})(Nt, function(t) {
|
|
4584
4584
|
return (function() {
|
|
4585
|
-
var e =
|
|
4585
|
+
var e = t, s = e.lib, c = s.StreamCipher, b = e.algo, u = [], f = [], a = [], n = b.Rabbit = c.extend({
|
|
4586
4586
|
_doReset: function() {
|
|
4587
|
-
for (var i = this._key.words,
|
|
4588
|
-
i[
|
|
4587
|
+
for (var i = this._key.words, l = this.cfg.iv, d = 0; d < 4; d++)
|
|
4588
|
+
i[d] = (i[d] << 8 | i[d] >>> 24) & 16711935 | (i[d] << 24 | i[d] >>> 8) & 4278255360;
|
|
4589
4589
|
var C = this._X = [
|
|
4590
4590
|
i[0],
|
|
4591
4591
|
i[3] << 16 | i[2] >>> 16,
|
|
@@ -4606,51 +4606,51 @@ function Wt() {
|
|
|
4606
4606
|
i[3] & 4294901760 | i[0] & 65535
|
|
4607
4607
|
];
|
|
4608
4608
|
this._b = 0;
|
|
4609
|
-
for (var
|
|
4609
|
+
for (var d = 0; d < 4; d++)
|
|
4610
4610
|
B.call(this);
|
|
4611
|
-
for (var
|
|
4612
|
-
h[
|
|
4613
|
-
if (
|
|
4614
|
-
var A =
|
|
4611
|
+
for (var d = 0; d < 8; d++)
|
|
4612
|
+
h[d] ^= C[d + 4 & 7];
|
|
4613
|
+
if (l) {
|
|
4614
|
+
var A = l.words, o = A[0], x = A[1], v = (o << 8 | o >>> 24) & 16711935 | (o << 24 | o >>> 8) & 4278255360, F = (x << 8 | x >>> 24) & 16711935 | (x << 24 | x >>> 8) & 4278255360, E = v >>> 16 | F & 4294901760, g = F << 16 | v & 65535;
|
|
4615
4615
|
h[0] ^= v, h[1] ^= E, h[2] ^= F, h[3] ^= g, h[4] ^= v, h[5] ^= E, h[6] ^= F, h[7] ^= g;
|
|
4616
|
-
for (var
|
|
4616
|
+
for (var d = 0; d < 4; d++)
|
|
4617
4617
|
B.call(this);
|
|
4618
4618
|
}
|
|
4619
4619
|
},
|
|
4620
|
-
_doProcessBlock: function(i,
|
|
4621
|
-
var
|
|
4622
|
-
B.call(this), u[0] =
|
|
4620
|
+
_doProcessBlock: function(i, l) {
|
|
4621
|
+
var d = this._X;
|
|
4622
|
+
B.call(this), u[0] = d[0] ^ d[5] >>> 16 ^ d[3] << 16, u[1] = d[2] ^ d[7] >>> 16 ^ d[5] << 16, u[2] = d[4] ^ d[1] >>> 16 ^ d[7] << 16, u[3] = d[6] ^ d[3] >>> 16 ^ d[1] << 16;
|
|
4623
4623
|
for (var C = 0; C < 4; C++)
|
|
4624
|
-
u[C] = (u[C] << 8 | u[C] >>> 24) & 16711935 | (u[C] << 24 | u[C] >>> 8) & 4278255360, i[
|
|
4624
|
+
u[C] = (u[C] << 8 | u[C] >>> 24) & 16711935 | (u[C] << 24 | u[C] >>> 8) & 4278255360, i[l + C] ^= u[C];
|
|
4625
4625
|
},
|
|
4626
4626
|
blockSize: 128 / 32,
|
|
4627
4627
|
ivSize: 64 / 32
|
|
4628
4628
|
});
|
|
4629
4629
|
function B() {
|
|
4630
|
-
for (var i = this._X,
|
|
4631
|
-
f[
|
|
4632
|
-
|
|
4633
|
-
for (var
|
|
4634
|
-
var C = i[
|
|
4635
|
-
a[
|
|
4630
|
+
for (var i = this._X, l = this._C, d = 0; d < 8; d++)
|
|
4631
|
+
f[d] = l[d];
|
|
4632
|
+
l[0] = l[0] + 1295307597 + this._b | 0, l[1] = l[1] + 3545052371 + (l[0] >>> 0 < f[0] >>> 0 ? 1 : 0) | 0, l[2] = l[2] + 886263092 + (l[1] >>> 0 < f[1] >>> 0 ? 1 : 0) | 0, l[3] = l[3] + 1295307597 + (l[2] >>> 0 < f[2] >>> 0 ? 1 : 0) | 0, l[4] = l[4] + 3545052371 + (l[3] >>> 0 < f[3] >>> 0 ? 1 : 0) | 0, l[5] = l[5] + 886263092 + (l[4] >>> 0 < f[4] >>> 0 ? 1 : 0) | 0, l[6] = l[6] + 1295307597 + (l[5] >>> 0 < f[5] >>> 0 ? 1 : 0) | 0, l[7] = l[7] + 3545052371 + (l[6] >>> 0 < f[6] >>> 0 ? 1 : 0) | 0, this._b = l[7] >>> 0 < f[7] >>> 0 ? 1 : 0;
|
|
4633
|
+
for (var d = 0; d < 8; d++) {
|
|
4634
|
+
var C = i[d] + l[d], h = C & 65535, A = C >>> 16, o = ((h * h >>> 17) + h * A >>> 15) + A * A, x = ((C & 4294901760) * C | 0) + ((C & 65535) * C | 0);
|
|
4635
|
+
a[d] = o ^ x;
|
|
4636
4636
|
}
|
|
4637
4637
|
i[0] = a[0] + (a[7] << 16 | a[7] >>> 16) + (a[6] << 16 | a[6] >>> 16) | 0, i[1] = a[1] + (a[0] << 8 | a[0] >>> 24) + a[7] | 0, i[2] = a[2] + (a[1] << 16 | a[1] >>> 16) + (a[0] << 16 | a[0] >>> 16) | 0, i[3] = a[3] + (a[2] << 8 | a[2] >>> 24) + a[1] | 0, i[4] = a[4] + (a[3] << 16 | a[3] >>> 16) + (a[2] << 16 | a[2] >>> 16) | 0, i[5] = a[5] + (a[4] << 8 | a[4] >>> 24) + a[3] | 0, i[6] = a[6] + (a[5] << 16 | a[5] >>> 16) + (a[4] << 16 | a[4] >>> 16) | 0, i[7] = a[7] + (a[6] << 8 | a[6] >>> 24) + a[5] | 0;
|
|
4638
4638
|
}
|
|
4639
|
-
e.Rabbit =
|
|
4640
|
-
})(),
|
|
4639
|
+
e.Rabbit = c._createHelper(n);
|
|
4640
|
+
})(), t.Rabbit;
|
|
4641
4641
|
});
|
|
4642
4642
|
})(Y0)), Y0.exports;
|
|
4643
4643
|
}
|
|
4644
4644
|
var J0 = { exports: {} }, Gt = J0.exports, nr;
|
|
4645
4645
|
function Qt() {
|
|
4646
|
-
return nr || (nr = 1, (function(p,
|
|
4647
|
-
(function(
|
|
4646
|
+
return nr || (nr = 1, (function(p, r) {
|
|
4647
|
+
(function(t, e, s) {
|
|
4648
4648
|
p.exports = e(L(), n0(), i0(), a0(), Q());
|
|
4649
|
-
})(Gt, function(
|
|
4649
|
+
})(Gt, function(t) {
|
|
4650
4650
|
return (function() {
|
|
4651
|
-
var e =
|
|
4651
|
+
var e = t, s = e.lib, c = s.StreamCipher, b = e.algo, u = [], f = [], a = [], n = b.RabbitLegacy = c.extend({
|
|
4652
4652
|
_doReset: function() {
|
|
4653
|
-
var i = this._key.words,
|
|
4653
|
+
var i = this._key.words, l = this.cfg.iv, d = this._X = [
|
|
4654
4654
|
i[0],
|
|
4655
4655
|
i[3] << 16 | i[2] >>> 16,
|
|
4656
4656
|
i[1],
|
|
@@ -4673,46 +4673,46 @@ function Qt() {
|
|
|
4673
4673
|
for (var h = 0; h < 4; h++)
|
|
4674
4674
|
B.call(this);
|
|
4675
4675
|
for (var h = 0; h < 8; h++)
|
|
4676
|
-
C[h] ^=
|
|
4677
|
-
if (
|
|
4678
|
-
var A =
|
|
4676
|
+
C[h] ^= d[h + 4 & 7];
|
|
4677
|
+
if (l) {
|
|
4678
|
+
var A = l.words, o = A[0], x = A[1], v = (o << 8 | o >>> 24) & 16711935 | (o << 24 | o >>> 8) & 4278255360, F = (x << 8 | x >>> 24) & 16711935 | (x << 24 | x >>> 8) & 4278255360, E = v >>> 16 | F & 4294901760, g = F << 16 | v & 65535;
|
|
4679
4679
|
C[0] ^= v, C[1] ^= E, C[2] ^= F, C[3] ^= g, C[4] ^= v, C[5] ^= E, C[6] ^= F, C[7] ^= g;
|
|
4680
4680
|
for (var h = 0; h < 4; h++)
|
|
4681
4681
|
B.call(this);
|
|
4682
4682
|
}
|
|
4683
4683
|
},
|
|
4684
|
-
_doProcessBlock: function(i,
|
|
4685
|
-
var
|
|
4686
|
-
B.call(this), u[0] =
|
|
4684
|
+
_doProcessBlock: function(i, l) {
|
|
4685
|
+
var d = this._X;
|
|
4686
|
+
B.call(this), u[0] = d[0] ^ d[5] >>> 16 ^ d[3] << 16, u[1] = d[2] ^ d[7] >>> 16 ^ d[5] << 16, u[2] = d[4] ^ d[1] >>> 16 ^ d[7] << 16, u[3] = d[6] ^ d[3] >>> 16 ^ d[1] << 16;
|
|
4687
4687
|
for (var C = 0; C < 4; C++)
|
|
4688
|
-
u[C] = (u[C] << 8 | u[C] >>> 24) & 16711935 | (u[C] << 24 | u[C] >>> 8) & 4278255360, i[
|
|
4688
|
+
u[C] = (u[C] << 8 | u[C] >>> 24) & 16711935 | (u[C] << 24 | u[C] >>> 8) & 4278255360, i[l + C] ^= u[C];
|
|
4689
4689
|
},
|
|
4690
4690
|
blockSize: 128 / 32,
|
|
4691
4691
|
ivSize: 64 / 32
|
|
4692
4692
|
});
|
|
4693
4693
|
function B() {
|
|
4694
|
-
for (var i = this._X,
|
|
4695
|
-
f[
|
|
4696
|
-
|
|
4697
|
-
for (var
|
|
4698
|
-
var C = i[
|
|
4699
|
-
a[
|
|
4694
|
+
for (var i = this._X, l = this._C, d = 0; d < 8; d++)
|
|
4695
|
+
f[d] = l[d];
|
|
4696
|
+
l[0] = l[0] + 1295307597 + this._b | 0, l[1] = l[1] + 3545052371 + (l[0] >>> 0 < f[0] >>> 0 ? 1 : 0) | 0, l[2] = l[2] + 886263092 + (l[1] >>> 0 < f[1] >>> 0 ? 1 : 0) | 0, l[3] = l[3] + 1295307597 + (l[2] >>> 0 < f[2] >>> 0 ? 1 : 0) | 0, l[4] = l[4] + 3545052371 + (l[3] >>> 0 < f[3] >>> 0 ? 1 : 0) | 0, l[5] = l[5] + 886263092 + (l[4] >>> 0 < f[4] >>> 0 ? 1 : 0) | 0, l[6] = l[6] + 1295307597 + (l[5] >>> 0 < f[5] >>> 0 ? 1 : 0) | 0, l[7] = l[7] + 3545052371 + (l[6] >>> 0 < f[6] >>> 0 ? 1 : 0) | 0, this._b = l[7] >>> 0 < f[7] >>> 0 ? 1 : 0;
|
|
4697
|
+
for (var d = 0; d < 8; d++) {
|
|
4698
|
+
var C = i[d] + l[d], h = C & 65535, A = C >>> 16, o = ((h * h >>> 17) + h * A >>> 15) + A * A, x = ((C & 4294901760) * C | 0) + ((C & 65535) * C | 0);
|
|
4699
|
+
a[d] = o ^ x;
|
|
4700
4700
|
}
|
|
4701
4701
|
i[0] = a[0] + (a[7] << 16 | a[7] >>> 16) + (a[6] << 16 | a[6] >>> 16) | 0, i[1] = a[1] + (a[0] << 8 | a[0] >>> 24) + a[7] | 0, i[2] = a[2] + (a[1] << 16 | a[1] >>> 16) + (a[0] << 16 | a[0] >>> 16) | 0, i[3] = a[3] + (a[2] << 8 | a[2] >>> 24) + a[1] | 0, i[4] = a[4] + (a[3] << 16 | a[3] >>> 16) + (a[2] << 16 | a[2] >>> 16) | 0, i[5] = a[5] + (a[4] << 8 | a[4] >>> 24) + a[3] | 0, i[6] = a[6] + (a[5] << 16 | a[5] >>> 16) + (a[4] << 16 | a[4] >>> 16) | 0, i[7] = a[7] + (a[6] << 8 | a[6] >>> 24) + a[5] | 0;
|
|
4702
4702
|
}
|
|
4703
|
-
e.RabbitLegacy =
|
|
4704
|
-
})(),
|
|
4703
|
+
e.RabbitLegacy = c._createHelper(n);
|
|
4704
|
+
})(), t.RabbitLegacy;
|
|
4705
4705
|
});
|
|
4706
4706
|
})(J0)), J0.exports;
|
|
4707
4707
|
}
|
|
4708
4708
|
var ee = { exports: {} }, Xt = ee.exports, ir;
|
|
4709
4709
|
function Vt() {
|
|
4710
|
-
return ir || (ir = 1, (function(p,
|
|
4711
|
-
(function(
|
|
4710
|
+
return ir || (ir = 1, (function(p, r) {
|
|
4711
|
+
(function(t, e, s) {
|
|
4712
4712
|
p.exports = e(L(), n0(), i0(), a0(), Q());
|
|
4713
|
-
})(Xt, function(
|
|
4713
|
+
})(Xt, function(t) {
|
|
4714
4714
|
return (function() {
|
|
4715
|
-
var e =
|
|
4715
|
+
var e = t, s = e.lib, c = s.BlockCipher, b = e.algo;
|
|
4716
4716
|
const u = 16, f = [
|
|
4717
4717
|
608135816,
|
|
4718
4718
|
2242054355,
|
|
@@ -5771,30 +5771,30 @@ function Vt() {
|
|
|
5771
5771
|
sbox: []
|
|
5772
5772
|
};
|
|
5773
5773
|
function B(h, A) {
|
|
5774
|
-
let o = A >> 24 & 255,
|
|
5774
|
+
let o = A >> 24 & 255, x = A >> 16 & 255, v = A >> 8 & 255, F = A & 255, E = h.sbox[0][o] + h.sbox[1][x];
|
|
5775
5775
|
return E = E ^ h.sbox[2][v], E = E + h.sbox[3][F], E;
|
|
5776
5776
|
}
|
|
5777
5777
|
function i(h, A, o) {
|
|
5778
|
-
let
|
|
5778
|
+
let x = A, v = o, F;
|
|
5779
5779
|
for (let E = 0; E < u; ++E)
|
|
5780
|
-
|
|
5781
|
-
return F =
|
|
5780
|
+
x = x ^ h.pbox[E], v = B(h, x) ^ v, F = x, x = v, v = F;
|
|
5781
|
+
return F = x, x = v, v = F, v = v ^ h.pbox[u], x = x ^ h.pbox[u + 1], { left: x, right: v };
|
|
5782
5782
|
}
|
|
5783
|
-
function
|
|
5784
|
-
let
|
|
5783
|
+
function l(h, A, o) {
|
|
5784
|
+
let x = A, v = o, F;
|
|
5785
5785
|
for (let E = u + 1; E > 1; --E)
|
|
5786
|
-
|
|
5787
|
-
return F =
|
|
5786
|
+
x = x ^ h.pbox[E], v = B(h, x) ^ v, F = x, x = v, v = F;
|
|
5787
|
+
return F = x, x = v, v = F, v = v ^ h.pbox[1], x = x ^ h.pbox[0], { left: x, right: v };
|
|
5788
5788
|
}
|
|
5789
|
-
function
|
|
5789
|
+
function d(h, A, o) {
|
|
5790
5790
|
for (let g = 0; g < 4; g++) {
|
|
5791
5791
|
h.sbox[g] = [];
|
|
5792
5792
|
for (let y = 0; y < 256; y++)
|
|
5793
5793
|
h.sbox[g][y] = a[g][y];
|
|
5794
5794
|
}
|
|
5795
|
-
let
|
|
5795
|
+
let x = 0;
|
|
5796
5796
|
for (let g = 0; g < u + 2; g++)
|
|
5797
|
-
h.pbox[g] = f[g] ^ A[
|
|
5797
|
+
h.pbox[g] = f[g] ^ A[x], x++, x >= o && (x = 0);
|
|
5798
5798
|
let v = 0, F = 0, E = 0;
|
|
5799
5799
|
for (let g = 0; g < u + 2; g += 2)
|
|
5800
5800
|
E = i(h, v, F), v = E.left, F = E.right, h.pbox[g] = v, h.pbox[g + 1] = F;
|
|
@@ -5803,11 +5803,11 @@ function Vt() {
|
|
|
5803
5803
|
E = i(h, v, F), v = E.left, F = E.right, h.sbox[g][y] = v, h.sbox[g][y + 1] = F;
|
|
5804
5804
|
return !0;
|
|
5805
5805
|
}
|
|
5806
|
-
var C = b.Blowfish =
|
|
5806
|
+
var C = b.Blowfish = c.extend({
|
|
5807
5807
|
_doReset: function() {
|
|
5808
5808
|
if (this._keyPriorReset !== this._key) {
|
|
5809
5809
|
var h = this._keyPriorReset = this._key, A = h.words, o = h.sigBytes / 4;
|
|
5810
|
-
|
|
5810
|
+
d(n, A, o);
|
|
5811
5811
|
}
|
|
5812
5812
|
},
|
|
5813
5813
|
encryptBlock: function(h, A) {
|
|
@@ -5815,40 +5815,40 @@ function Vt() {
|
|
|
5815
5815
|
h[A] = o.left, h[A + 1] = o.right;
|
|
5816
5816
|
},
|
|
5817
5817
|
decryptBlock: function(h, A) {
|
|
5818
|
-
var o =
|
|
5818
|
+
var o = l(n, h[A], h[A + 1]);
|
|
5819
5819
|
h[A] = o.left, h[A + 1] = o.right;
|
|
5820
5820
|
},
|
|
5821
5821
|
blockSize: 64 / 32,
|
|
5822
5822
|
keySize: 128 / 32,
|
|
5823
5823
|
ivSize: 64 / 32
|
|
5824
5824
|
});
|
|
5825
|
-
e.Blowfish =
|
|
5826
|
-
})(),
|
|
5825
|
+
e.Blowfish = c._createHelper(C);
|
|
5826
|
+
})(), t.Blowfish;
|
|
5827
5827
|
});
|
|
5828
5828
|
})(ee)), ee.exports;
|
|
5829
5829
|
}
|
|
5830
|
-
var jt = m0.exports,
|
|
5830
|
+
var jt = m0.exports, sr;
|
|
5831
5831
|
function Zt() {
|
|
5832
|
-
return
|
|
5833
|
-
(function(
|
|
5834
|
-
p.exports = e(L(), ne(), Qr(), Vr(), n0(), Yr(), i0(), lr(), de(), at(), dr(),
|
|
5835
|
-
})(jt, function(
|
|
5836
|
-
return
|
|
5832
|
+
return sr || (sr = 1, (function(p, r) {
|
|
5833
|
+
(function(t, e, s) {
|
|
5834
|
+
p.exports = e(L(), ne(), Qr(), Vr(), n0(), Yr(), i0(), lr(), de(), at(), dr(), st(), xt(), lt(), fe(), ut(), a0(), Q(), Ct(), mt(), Et(), Dt(), bt(), _t(), kt(), Pt(), Rt(), Mt(), $t(), Lt(), Ut(), zt(), Wt(), Qt(), Vt());
|
|
5835
|
+
})(jt, function(t) {
|
|
5836
|
+
return t;
|
|
5837
5837
|
});
|
|
5838
5838
|
})(m0)), m0.exports;
|
|
5839
5839
|
}
|
|
5840
5840
|
var Yt = Zt();
|
|
5841
|
-
const ce = /* @__PURE__ */
|
|
5842
|
-
function Jt(p,
|
|
5841
|
+
const ce = /* @__PURE__ */ Tr(Yt), xe = "ai_provider_config", fr = "aiselector";
|
|
5842
|
+
function Jt(p, r = fr) {
|
|
5843
5843
|
try {
|
|
5844
|
-
return ce.AES.encrypt(p,
|
|
5844
|
+
return ce.AES.encrypt(p, r).toString();
|
|
5845
5845
|
} catch {
|
|
5846
5846
|
return p;
|
|
5847
5847
|
}
|
|
5848
5848
|
}
|
|
5849
|
-
function ea(p,
|
|
5849
|
+
function ea(p, r = fr) {
|
|
5850
5850
|
try {
|
|
5851
|
-
return ce.AES.decrypt(p,
|
|
5851
|
+
return ce.AES.decrypt(p, r).toString(ce.enc.Utf8);
|
|
5852
5852
|
} catch {
|
|
5853
5853
|
return p;
|
|
5854
5854
|
}
|
|
@@ -5857,16 +5857,16 @@ const ra = {
|
|
|
5857
5857
|
get: (p) => {
|
|
5858
5858
|
if (typeof window > "u") return null;
|
|
5859
5859
|
try {
|
|
5860
|
-
const
|
|
5861
|
-
return
|
|
5860
|
+
const r = localStorage.getItem(p);
|
|
5861
|
+
return r ? ea(r) : null;
|
|
5862
5862
|
} catch {
|
|
5863
5863
|
return null;
|
|
5864
5864
|
}
|
|
5865
5865
|
},
|
|
5866
|
-
set: (p,
|
|
5866
|
+
set: (p, r) => {
|
|
5867
5867
|
if (!(typeof window > "u"))
|
|
5868
5868
|
try {
|
|
5869
|
-
localStorage.setItem(p, Jt(
|
|
5869
|
+
localStorage.setItem(p, Jt(r));
|
|
5870
5870
|
} catch {
|
|
5871
5871
|
}
|
|
5872
5872
|
},
|
|
@@ -5875,37 +5875,37 @@ const ra = {
|
|
|
5875
5875
|
}
|
|
5876
5876
|
}, ta = {
|
|
5877
5877
|
get: (p) => typeof window > "u" ? null : localStorage.getItem(p),
|
|
5878
|
-
set: (p,
|
|
5879
|
-
typeof window > "u" || localStorage.setItem(p,
|
|
5878
|
+
set: (p, r) => {
|
|
5879
|
+
typeof window > "u" || localStorage.setItem(p, r);
|
|
5880
5880
|
},
|
|
5881
5881
|
remove: (p) => {
|
|
5882
5882
|
typeof window > "u" || localStorage.removeItem(p);
|
|
5883
5883
|
}
|
|
5884
|
-
},
|
|
5885
|
-
function xa(p = ur,
|
|
5886
|
-
const
|
|
5884
|
+
}, oa = ta, ur = ra;
|
|
5885
|
+
function xa(p = ur, r = {}) {
|
|
5886
|
+
const t = r.serialize || JSON.stringify, e = r.deserialize || JSON.parse;
|
|
5887
5887
|
return {
|
|
5888
5888
|
/**
|
|
5889
5889
|
* Save AI config
|
|
5890
5890
|
*/
|
|
5891
|
-
save(
|
|
5891
|
+
save(s) {
|
|
5892
5892
|
try {
|
|
5893
|
-
const
|
|
5894
|
-
p.set(xe,
|
|
5895
|
-
} catch (
|
|
5896
|
-
console.error("Failed to save config:",
|
|
5893
|
+
const c = t(s);
|
|
5894
|
+
p.set(xe, c);
|
|
5895
|
+
} catch (c) {
|
|
5896
|
+
console.error("Failed to save config:", c);
|
|
5897
5897
|
}
|
|
5898
5898
|
},
|
|
5899
5899
|
/**
|
|
5900
5900
|
* Load AI config
|
|
5901
5901
|
*/
|
|
5902
5902
|
load() {
|
|
5903
|
-
const
|
|
5904
|
-
if (!
|
|
5903
|
+
const s = p.get(xe);
|
|
5904
|
+
if (!s) return null;
|
|
5905
5905
|
try {
|
|
5906
|
-
return e(
|
|
5907
|
-
} catch (
|
|
5908
|
-
return console.error("Failed to load config:",
|
|
5906
|
+
return e(s);
|
|
5907
|
+
} catch (c) {
|
|
5908
|
+
return console.error("Failed to load config:", c), null;
|
|
5909
5909
|
}
|
|
5910
5910
|
},
|
|
5911
5911
|
/**
|
|
@@ -5922,15 +5922,15 @@ function aa(p) {
|
|
|
5922
5922
|
providers: Object.values(re),
|
|
5923
5923
|
getModels: (f) => te(f)
|
|
5924
5924
|
};
|
|
5925
|
-
const { mode:
|
|
5926
|
-
let
|
|
5927
|
-
if (
|
|
5925
|
+
const { mode: r, include: t, exclude: e, custom: s } = p;
|
|
5926
|
+
let c = [];
|
|
5927
|
+
if (r === "default") {
|
|
5928
5928
|
let f = Object.values(re);
|
|
5929
|
-
|
|
5929
|
+
t && t.length > 0 && (f = f.filter((a) => t.includes(a.id))), e && e.length > 0 && (f = f.filter((a) => !e.includes(a.id))), c = [...f];
|
|
5930
5930
|
}
|
|
5931
5931
|
const b = {};
|
|
5932
|
-
if (
|
|
5933
|
-
for (const [f, a] of Object.entries(
|
|
5932
|
+
if (s)
|
|
5933
|
+
for (const [f, a] of Object.entries(s)) {
|
|
5934
5934
|
const n = {
|
|
5935
5935
|
id: f,
|
|
5936
5936
|
name: a.name,
|
|
@@ -5939,108 +5939,135 @@ function aa(p) {
|
|
|
5939
5939
|
apiFormat: a.apiFormat,
|
|
5940
5940
|
supportsModelsApi: a.supportsModelsApi ?? !1,
|
|
5941
5941
|
icon: a.icon
|
|
5942
|
-
}, B =
|
|
5943
|
-
B >= 0 ?
|
|
5944
|
-
...
|
|
5942
|
+
}, B = c.findIndex((i) => i.id === f);
|
|
5943
|
+
B >= 0 ? c[B] = {
|
|
5944
|
+
...c[B],
|
|
5945
5945
|
...n,
|
|
5946
|
-
icon: n.icon ||
|
|
5947
|
-
} :
|
|
5946
|
+
icon: n.icon || c[B].icon
|
|
5947
|
+
} : c.push(n), a.models && a.models.length > 0 && (b[f] = a.models);
|
|
5948
5948
|
}
|
|
5949
|
-
return { providers:
|
|
5949
|
+
return { providers: c, getModels: (f) => b[f] ? b[f] : te(f) };
|
|
5950
5950
|
}
|
|
5951
|
-
function ca(p,
|
|
5952
|
-
const { providers:
|
|
5953
|
-
return
|
|
5951
|
+
function ca(p, r) {
|
|
5952
|
+
const { providers: t } = aa(r);
|
|
5953
|
+
return t.find((e) => e.id === p) || null;
|
|
5954
5954
|
}
|
|
5955
5955
|
class la {
|
|
5956
|
-
constructor(
|
|
5957
|
-
this.channels = [], this.activeChannelId = null, this.listeners = /* @__PURE__ */ new Map(), this.storagePrefix =
|
|
5956
|
+
constructor(r = {}) {
|
|
5957
|
+
this.channels = [], this.activeChannelId = null, this.capabilityDefaults = {}, this.listeners = /* @__PURE__ */ new Map(), this.storagePrefix = r.storagePrefix || "ai_channel", this.activeChannelKey = r.activeChannelKey || "ai_active_channel", this.capabilityDefaultsKey = r.capabilityDefaultsKey || "ai_capability_defaults", this.proxyUrl = r.proxyUrl, this.storageAdapter = r.storageAdapter || ur, this.loadChannels(), this.loadActiveChannel(), this.loadCapabilityDefaults();
|
|
5958
5958
|
}
|
|
5959
5959
|
// ==================== 事件系统 ====================
|
|
5960
5960
|
/** 监听事件 */
|
|
5961
|
-
on(
|
|
5962
|
-
return this.listeners.has(
|
|
5961
|
+
on(r, t) {
|
|
5962
|
+
return this.listeners.has(r) || this.listeners.set(r, /* @__PURE__ */ new Set()), this.listeners.get(r).add(t), () => this.off(r, t);
|
|
5963
5963
|
}
|
|
5964
5964
|
/** 取消监听 */
|
|
5965
|
-
off(
|
|
5965
|
+
off(r, t) {
|
|
5966
5966
|
var e;
|
|
5967
|
-
(e = this.listeners.get(
|
|
5967
|
+
(e = this.listeners.get(r)) == null || e.delete(t);
|
|
5968
5968
|
}
|
|
5969
|
-
emit(
|
|
5969
|
+
emit(r, t) {
|
|
5970
5970
|
var e;
|
|
5971
|
-
(e = this.listeners.get(
|
|
5971
|
+
(e = this.listeners.get(r)) == null || e.forEach((s) => s(t));
|
|
5972
5972
|
}
|
|
5973
5973
|
// ==================== 存储相关 ====================
|
|
5974
|
-
getStorageKey(
|
|
5975
|
-
return `${this.storagePrefix}_${
|
|
5974
|
+
getStorageKey(r) {
|
|
5975
|
+
return `${this.storagePrefix}_${r}`;
|
|
5976
5976
|
}
|
|
5977
5977
|
loadChannels() {
|
|
5978
5978
|
try {
|
|
5979
|
-
const
|
|
5980
|
-
(
|
|
5979
|
+
const r = Object.keys(localStorage || {}).filter(
|
|
5980
|
+
(t) => t.startsWith(this.storagePrefix)
|
|
5981
5981
|
);
|
|
5982
|
-
this.channels =
|
|
5983
|
-
const e = this.storageAdapter.get(
|
|
5982
|
+
this.channels = r.map((t) => {
|
|
5983
|
+
const e = this.storageAdapter.get(t);
|
|
5984
5984
|
return e ? JSON.parse(e) : null;
|
|
5985
|
-
}).filter((
|
|
5986
|
-
} catch (
|
|
5987
|
-
console.error("Failed to load channels:",
|
|
5985
|
+
}).filter((t) => t !== null);
|
|
5986
|
+
} catch (r) {
|
|
5987
|
+
console.error("Failed to load channels:", r), this.channels = [];
|
|
5988
5988
|
}
|
|
5989
5989
|
}
|
|
5990
5990
|
loadActiveChannel() {
|
|
5991
5991
|
try {
|
|
5992
|
-
const
|
|
5993
|
-
|
|
5992
|
+
const r = this.storageAdapter.get(this.activeChannelKey);
|
|
5993
|
+
r && (this.activeChannelId = r);
|
|
5994
|
+
} catch (r) {
|
|
5995
|
+
console.error("Failed to load active channel:", r);
|
|
5996
|
+
}
|
|
5997
|
+
}
|
|
5998
|
+
saveChannel(r) {
|
|
5999
|
+
try {
|
|
6000
|
+
this.storageAdapter.set(this.getStorageKey(r.id), JSON.stringify(r));
|
|
6001
|
+
} catch (t) {
|
|
6002
|
+
console.error("Failed to save channel:", t);
|
|
6003
|
+
}
|
|
6004
|
+
}
|
|
6005
|
+
deleteChannelFromStorage(r) {
|
|
6006
|
+
try {
|
|
6007
|
+
this.storageAdapter.remove(this.getStorageKey(r));
|
|
5994
6008
|
} catch (t) {
|
|
5995
|
-
console.error("Failed to
|
|
6009
|
+
console.error("Failed to delete channel from storage:", t);
|
|
5996
6010
|
}
|
|
5997
6011
|
}
|
|
5998
|
-
|
|
6012
|
+
saveActiveChannel() {
|
|
5999
6013
|
try {
|
|
6000
|
-
this.storageAdapter.set(this.
|
|
6014
|
+
this.activeChannelId ? this.storageAdapter.set(this.activeChannelKey, this.activeChannelId) : this.storageAdapter.remove(this.activeChannelKey);
|
|
6001
6015
|
} catch (r) {
|
|
6002
|
-
console.error("Failed to save channel:", r);
|
|
6016
|
+
console.error("Failed to save active channel:", r);
|
|
6003
6017
|
}
|
|
6004
6018
|
}
|
|
6005
|
-
|
|
6019
|
+
loadCapabilityDefaults() {
|
|
6006
6020
|
try {
|
|
6007
|
-
this.storageAdapter.
|
|
6021
|
+
const r = this.storageAdapter.get(this.capabilityDefaultsKey);
|
|
6022
|
+
if (r) {
|
|
6023
|
+
const t = JSON.parse(r);
|
|
6024
|
+
this.capabilityDefaults = t;
|
|
6025
|
+
}
|
|
6008
6026
|
} catch (r) {
|
|
6009
|
-
console.error("Failed to
|
|
6027
|
+
console.error("Failed to load capability defaults:", r);
|
|
6010
6028
|
}
|
|
6011
6029
|
}
|
|
6012
|
-
|
|
6030
|
+
saveCapabilityDefaults() {
|
|
6013
6031
|
try {
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6032
|
+
const r = Object.keys(this.capabilityDefaults).filter(
|
|
6033
|
+
(t) => this.capabilityDefaults[t]
|
|
6034
|
+
);
|
|
6035
|
+
if (r.length > 0) {
|
|
6036
|
+
const t = {};
|
|
6037
|
+
for (const e of r)
|
|
6038
|
+
t[e] = this.capabilityDefaults[e];
|
|
6039
|
+
this.storageAdapter.set(this.capabilityDefaultsKey, JSON.stringify(t));
|
|
6040
|
+
} else
|
|
6041
|
+
this.storageAdapter.remove(this.capabilityDefaultsKey);
|
|
6042
|
+
} catch (r) {
|
|
6043
|
+
console.error("Failed to save capability defaults:", r);
|
|
6017
6044
|
}
|
|
6018
6045
|
}
|
|
6019
6046
|
// ==================== 通道 CRUD ====================
|
|
6020
6047
|
/** 添加通道 */
|
|
6021
|
-
async addChannel(
|
|
6022
|
-
const e = t0(
|
|
6048
|
+
async addChannel(r, t) {
|
|
6049
|
+
const e = t0(r.providerId);
|
|
6023
6050
|
if (!e)
|
|
6024
|
-
throw new Error(`Provider not found: ${
|
|
6025
|
-
let
|
|
6051
|
+
throw new Error(`Provider not found: ${r.providerId}`);
|
|
6052
|
+
let s = r.modelName || r.model, c = [], b;
|
|
6026
6053
|
try {
|
|
6027
|
-
const n = (await this.getProviderModels(
|
|
6028
|
-
n && (
|
|
6054
|
+
const n = (await this.getProviderModels(r.providerId, r.apiKey, r.baseUrl)).find((B) => B.id === r.model);
|
|
6055
|
+
n && (s = n.name, c = n.capabilities || [], b = n.contextLength);
|
|
6029
6056
|
} catch (a) {
|
|
6030
6057
|
console.warn("Failed to fetch models, using static info:", a);
|
|
6031
6058
|
}
|
|
6032
6059
|
const u = {
|
|
6033
6060
|
id: Date.now().toString() + Math.random().toString(36).slice(2, 6),
|
|
6034
|
-
providerId:
|
|
6061
|
+
providerId: r.providerId,
|
|
6035
6062
|
providerName: e.name,
|
|
6036
|
-
model:
|
|
6037
|
-
modelName:
|
|
6038
|
-
apiKey:
|
|
6039
|
-
baseUrl:
|
|
6063
|
+
model: r.model,
|
|
6064
|
+
modelName: s,
|
|
6065
|
+
apiKey: r.apiKey,
|
|
6066
|
+
baseUrl: r.baseUrl,
|
|
6040
6067
|
apiFormat: e.apiFormat,
|
|
6041
|
-
capabilities:
|
|
6068
|
+
capabilities: c,
|
|
6042
6069
|
contextLength: b,
|
|
6043
|
-
name:
|
|
6070
|
+
name: t,
|
|
6044
6071
|
createdAt: Date.now(),
|
|
6045
6072
|
status: "untested"
|
|
6046
6073
|
}, f = this.channels.findIndex(
|
|
@@ -6049,30 +6076,30 @@ class la {
|
|
|
6049
6076
|
return f >= 0 ? (this.channels[f] = { ...u, id: this.channels[f].id }, this.saveChannel(this.channels[f]), this.emit("update", this.channels[f]), this.channels[f]) : (this.channels.unshift(u), this.saveChannel(u), this.emit("add", u), u);
|
|
6050
6077
|
}
|
|
6051
6078
|
/** 删除通道 */
|
|
6052
|
-
deleteChannel(
|
|
6053
|
-
const
|
|
6054
|
-
|
|
6079
|
+
deleteChannel(r) {
|
|
6080
|
+
const t = this.getChannel(r);
|
|
6081
|
+
t && (this.channels = this.channels.filter((e) => e.id !== r), this.deleteChannelFromStorage(r), this.activeChannelId === r && (this.activeChannelId = null, this.saveActiveChannel()), this.emit("delete", { id: r, channel: t }));
|
|
6055
6082
|
}
|
|
6056
6083
|
/** 更新通道 */
|
|
6057
|
-
async updateChannel(
|
|
6058
|
-
const
|
|
6059
|
-
if (!
|
|
6060
|
-
throw new Error(`Channel not found: ${
|
|
6061
|
-
const
|
|
6062
|
-
if (e !== void 0 && (
|
|
6063
|
-
const u = t0(
|
|
6084
|
+
async updateChannel(r, t, e) {
|
|
6085
|
+
const s = this.channels.find((u) => u.id === r);
|
|
6086
|
+
if (!s)
|
|
6087
|
+
throw new Error(`Channel not found: ${r}`);
|
|
6088
|
+
const c = { ...s, ...t };
|
|
6089
|
+
if (e !== void 0 && (c.name = e), t.providerId || t.model || t.baseUrl) {
|
|
6090
|
+
const u = t0(c.providerId);
|
|
6064
6091
|
if (u) {
|
|
6065
|
-
|
|
6092
|
+
c.providerName = u.name, c.apiFormat = u.apiFormat;
|
|
6066
6093
|
try {
|
|
6067
|
-
const a = (await this.getProviderModels(
|
|
6068
|
-
a && (
|
|
6094
|
+
const a = (await this.getProviderModels(c.providerId, c.apiKey, c.baseUrl)).find((n) => n.id === c.model);
|
|
6095
|
+
a && (c.modelName = a.name, c.capabilities = a.capabilities || [], c.contextLength = a.contextLength);
|
|
6069
6096
|
} catch (f) {
|
|
6070
6097
|
console.warn("Failed to fetch models:", f);
|
|
6071
6098
|
}
|
|
6072
6099
|
}
|
|
6073
6100
|
}
|
|
6074
|
-
const b = this.channels.findIndex((u) => u.id ===
|
|
6075
|
-
return this.channels[b] =
|
|
6101
|
+
const b = this.channels.findIndex((u) => u.id === r);
|
|
6102
|
+
return this.channels[b] = c, this.saveChannel(c), this.emit("update", c), c;
|
|
6076
6103
|
}
|
|
6077
6104
|
// ==================== 通道查询 ====================
|
|
6078
6105
|
/** 获取所有通道 */
|
|
@@ -6080,36 +6107,36 @@ class la {
|
|
|
6080
6107
|
return [...this.channels];
|
|
6081
6108
|
}
|
|
6082
6109
|
/** 根据 ID 获取通道 */
|
|
6083
|
-
getChannel(
|
|
6084
|
-
return this.channels.find((
|
|
6110
|
+
getChannel(r) {
|
|
6111
|
+
return this.channels.find((t) => t.id === r);
|
|
6085
6112
|
}
|
|
6086
6113
|
/** 按 Provider ID 过滤通道 */
|
|
6087
|
-
getChannelsByProvider(
|
|
6088
|
-
return this.channels.filter((
|
|
6114
|
+
getChannelsByProvider(r) {
|
|
6115
|
+
return this.channels.filter((t) => t.providerId === r);
|
|
6089
6116
|
}
|
|
6090
6117
|
/** 按模型能力过滤通道(如 vision, reasoning, audio) */
|
|
6091
|
-
getChannelsByCapability(
|
|
6092
|
-
return this.channels.filter((
|
|
6118
|
+
getChannelsByCapability(r) {
|
|
6119
|
+
return this.channels.filter((t) => {
|
|
6093
6120
|
var e;
|
|
6094
|
-
return (e =
|
|
6121
|
+
return (e = t.capabilities) == null ? void 0 : e.includes(r);
|
|
6095
6122
|
});
|
|
6096
6123
|
}
|
|
6097
6124
|
/** 按 API 格式过滤通道(如 openai, anthropic, gemini) */
|
|
6098
|
-
getChannelsByFormat(
|
|
6099
|
-
return this.channels.filter((
|
|
6125
|
+
getChannelsByFormat(r) {
|
|
6126
|
+
return this.channels.filter((t) => t.apiFormat === r);
|
|
6100
6127
|
}
|
|
6101
6128
|
/** 按连接状态过滤通道 */
|
|
6102
|
-
getChannelsByStatus(
|
|
6103
|
-
return this.channels.filter((
|
|
6129
|
+
getChannelsByStatus(r) {
|
|
6130
|
+
return this.channels.filter((t) => t.status === r);
|
|
6104
6131
|
}
|
|
6105
6132
|
/** 综合条件查询通道 */
|
|
6106
|
-
queryChannels(
|
|
6107
|
-
return this.channels.filter((
|
|
6133
|
+
queryChannels(r) {
|
|
6134
|
+
return this.channels.filter((t) => {
|
|
6108
6135
|
var e;
|
|
6109
|
-
if (
|
|
6110
|
-
if (
|
|
6111
|
-
const
|
|
6112
|
-
if (!`${
|
|
6136
|
+
if (r.providerId && t.providerId !== r.providerId || r.apiFormat && t.apiFormat !== r.apiFormat || r.capability && !((e = t.capabilities) != null && e.includes(r.capability)) || r.status && t.status !== r.status) return !1;
|
|
6137
|
+
if (r.keyword) {
|
|
6138
|
+
const s = r.keyword.toLowerCase();
|
|
6139
|
+
if (!`${t.name || ""} ${t.modelName} ${t.providerName} ${t.model}`.toLowerCase().includes(s)) return !1;
|
|
6113
6140
|
}
|
|
6114
6141
|
return !0;
|
|
6115
6142
|
});
|
|
@@ -6125,175 +6152,248 @@ class la {
|
|
|
6125
6152
|
return this.getChannel(this.activeChannelId);
|
|
6126
6153
|
}
|
|
6127
6154
|
/** 设置当前激活的通道 */
|
|
6128
|
-
setActiveChannel(
|
|
6129
|
-
const
|
|
6130
|
-
if (!
|
|
6131
|
-
throw new Error(`Channel not found: ${
|
|
6132
|
-
this.activeChannelId =
|
|
6133
|
-
const e = this.channels.findIndex((
|
|
6134
|
-
this.channels[e].lastUsedAt = Date.now(), this.saveChannel(this.channels[e]), this.emit("activate",
|
|
6155
|
+
setActiveChannel(r) {
|
|
6156
|
+
const t = this.getChannel(r);
|
|
6157
|
+
if (!t)
|
|
6158
|
+
throw new Error(`Channel not found: ${r}`);
|
|
6159
|
+
this.activeChannelId = r, this.saveActiveChannel();
|
|
6160
|
+
const e = this.channels.findIndex((s) => s.id === r);
|
|
6161
|
+
this.channels[e].lastUsedAt = Date.now(), this.saveChannel(this.channels[e]), this.emit("activate", t);
|
|
6135
6162
|
}
|
|
6136
6163
|
/** 清除当前激活的通道 */
|
|
6137
6164
|
clearActiveChannel() {
|
|
6138
6165
|
this.activeChannelId = null, this.saveActiveChannel();
|
|
6139
6166
|
}
|
|
6167
|
+
// ==================== 能力默认通道 ====================
|
|
6168
|
+
/**
|
|
6169
|
+
* 为指定能力类型设置默认通道
|
|
6170
|
+
* 当调用 getChannelForCapability 时,优先返回此通道
|
|
6171
|
+
*/
|
|
6172
|
+
setDefaultForCapability(r, t) {
|
|
6173
|
+
if (!this.getChannel(t))
|
|
6174
|
+
throw new Error(`Channel not found: ${t}`);
|
|
6175
|
+
this.capabilityDefaults[r] = t, this.saveCapabilityDefaults(), this.emit("update", { type: "capabilityDefault", capability: r, channelId: t });
|
|
6176
|
+
}
|
|
6177
|
+
/**
|
|
6178
|
+
* 获取指定能力类型的默认通道 ID
|
|
6179
|
+
* 返回 undefined 表示未设置
|
|
6180
|
+
*/
|
|
6181
|
+
getDefaultForCapability(r) {
|
|
6182
|
+
return this.capabilityDefaults[r] || void 0;
|
|
6183
|
+
}
|
|
6184
|
+
/**
|
|
6185
|
+
* 清除指定能力类型的默认通道
|
|
6186
|
+
*/
|
|
6187
|
+
clearDefaultForCapability(r) {
|
|
6188
|
+
delete this.capabilityDefaults[r], this.saveCapabilityDefaults();
|
|
6189
|
+
}
|
|
6190
|
+
/**
|
|
6191
|
+
* 获取所有能力类型的默认通道映射
|
|
6192
|
+
* 返回 { capability: channelId } 的对象
|
|
6193
|
+
*/
|
|
6194
|
+
getAllCapabilityDefaults() {
|
|
6195
|
+
return { ...this.capabilityDefaults };
|
|
6196
|
+
}
|
|
6197
|
+
/**
|
|
6198
|
+
* 根据能力类型获取最适合的通道(带降级链)
|
|
6199
|
+
*
|
|
6200
|
+
* 降级链:
|
|
6201
|
+
* 1. 该能力类型的显式默认通道
|
|
6202
|
+
* 2. 具有该能力且最后使用时间最新的通道
|
|
6203
|
+
* 3. 全局激活通道
|
|
6204
|
+
* 4. 第一个可用通道
|
|
6205
|
+
*/
|
|
6206
|
+
getChannelForCapability(r) {
|
|
6207
|
+
const t = this.capabilityDefaults[r];
|
|
6208
|
+
if (t) {
|
|
6209
|
+
const c = this.getChannel(t);
|
|
6210
|
+
if (c) return c;
|
|
6211
|
+
}
|
|
6212
|
+
const e = this.getChannelsByCapability(r).filter((c) => c.lastUsedAt).sort((c, b) => (b.lastUsedAt || 0) - (c.lastUsedAt || 0));
|
|
6213
|
+
if (e.length > 0) return e[0];
|
|
6214
|
+
const s = this.getActiveChannel();
|
|
6215
|
+
return s || this.channels[0];
|
|
6216
|
+
}
|
|
6217
|
+
/**
|
|
6218
|
+
* 使用指定能力类型的默认通道发送聊天请求
|
|
6219
|
+
* 自动选择合适的通道,无需手动指定 channelId
|
|
6220
|
+
*/
|
|
6221
|
+
async chatForCapability(r, t, e) {
|
|
6222
|
+
const s = this.getChannelForCapability(r);
|
|
6223
|
+
if (!s)
|
|
6224
|
+
throw new Error(`No available channel for capability: ${r}`);
|
|
6225
|
+
return this.chatWith(s.id, t, e);
|
|
6226
|
+
}
|
|
6227
|
+
/**
|
|
6228
|
+
* 使用指定能力类型的默认通道发送流式聊天请求
|
|
6229
|
+
*/
|
|
6230
|
+
async chatStreamForCapability(r, t, e) {
|
|
6231
|
+
const s = this.getChannelForCapability(r);
|
|
6232
|
+
if (!s)
|
|
6233
|
+
throw new Error(`No available channel for capability: ${r}`);
|
|
6234
|
+
return this.chatWithStream(s.id, t, {
|
|
6235
|
+
...e,
|
|
6236
|
+
onDelta: (e == null ? void 0 : e.onDelta) || ((c) => {
|
|
6237
|
+
})
|
|
6238
|
+
});
|
|
6239
|
+
}
|
|
6140
6240
|
// ==================== 模型查询 ====================
|
|
6141
6241
|
/** 获取 Provider 的可用模型列表(动态获取 + 静态兜底) */
|
|
6142
|
-
async getProviderModels(
|
|
6143
|
-
const
|
|
6144
|
-
if (!
|
|
6145
|
-
throw new Error(`Provider not found: ${
|
|
6146
|
-
return
|
|
6147
|
-
provider:
|
|
6148
|
-
apiKey:
|
|
6242
|
+
async getProviderModels(r, t, e) {
|
|
6243
|
+
const s = t0(r);
|
|
6244
|
+
if (!s)
|
|
6245
|
+
throw new Error(`Provider not found: ${r}`);
|
|
6246
|
+
return $r({
|
|
6247
|
+
provider: s,
|
|
6248
|
+
apiKey: t,
|
|
6149
6249
|
baseUrl: e,
|
|
6150
6250
|
proxyUrl: this.proxyUrl,
|
|
6151
6251
|
fallbackToStatic: !0
|
|
6152
6252
|
});
|
|
6153
6253
|
}
|
|
6154
6254
|
/** 获取通道对应的 Provider 的模型列表 */
|
|
6155
|
-
async getChannelModels(
|
|
6156
|
-
const
|
|
6157
|
-
if (!
|
|
6158
|
-
throw new Error(`Channel not found: ${
|
|
6159
|
-
return this.getProviderModels(
|
|
6255
|
+
async getChannelModels(r) {
|
|
6256
|
+
const t = this.getChannel(r);
|
|
6257
|
+
if (!t)
|
|
6258
|
+
throw new Error(`Channel not found: ${r}`);
|
|
6259
|
+
return this.getProviderModels(t.providerId, t.apiKey, t.baseUrl);
|
|
6160
6260
|
}
|
|
6161
6261
|
/** 获取 Provider 的静态模型列表(不发起网络请求) */
|
|
6162
|
-
getStaticModelList(
|
|
6163
|
-
return te(
|
|
6262
|
+
getStaticModelList(r) {
|
|
6263
|
+
return te(r);
|
|
6164
6264
|
}
|
|
6165
6265
|
/** 按能力过滤模型列表 */
|
|
6166
|
-
getModelsByCapability(
|
|
6167
|
-
return
|
|
6168
|
-
var
|
|
6169
|
-
return (
|
|
6266
|
+
getModelsByCapability(r, t) {
|
|
6267
|
+
return r.filter((e) => {
|
|
6268
|
+
var s;
|
|
6269
|
+
return (s = e.capabilities) == null ? void 0 : s.includes(t);
|
|
6170
6270
|
});
|
|
6171
6271
|
}
|
|
6172
6272
|
/** 获取所有已配置的模型摘要列表 */
|
|
6173
6273
|
getConfiguredModels() {
|
|
6174
|
-
return this.channels.map((
|
|
6175
|
-
channelId:
|
|
6176
|
-
providerId:
|
|
6177
|
-
providerName:
|
|
6178
|
-
model:
|
|
6179
|
-
modelName:
|
|
6180
|
-
apiFormat:
|
|
6181
|
-
capabilities:
|
|
6182
|
-
status:
|
|
6274
|
+
return this.channels.map((r) => ({
|
|
6275
|
+
channelId: r.id,
|
|
6276
|
+
providerId: r.providerId,
|
|
6277
|
+
providerName: r.providerName,
|
|
6278
|
+
model: r.model,
|
|
6279
|
+
modelName: r.modelName,
|
|
6280
|
+
apiFormat: r.apiFormat,
|
|
6281
|
+
capabilities: r.capabilities || [],
|
|
6282
|
+
status: r.status
|
|
6183
6283
|
}));
|
|
6184
6284
|
}
|
|
6185
6285
|
// ==================== API Key 管理 ====================
|
|
6186
6286
|
/** 更新通道的 API Key */
|
|
6187
|
-
async updateApiKey(
|
|
6188
|
-
return this.updateChannel(
|
|
6287
|
+
async updateApiKey(r, t) {
|
|
6288
|
+
return this.updateChannel(r, { apiKey: t });
|
|
6189
6289
|
}
|
|
6190
6290
|
/** 验证 API Key 格式(简单校验,非空且长度合理) */
|
|
6191
|
-
validateApiKey(
|
|
6192
|
-
const e = t0(
|
|
6193
|
-
return e ? e.needsApiKey ? !
|
|
6291
|
+
validateApiKey(r, t) {
|
|
6292
|
+
const e = t0(r);
|
|
6293
|
+
return e ? e.needsApiKey ? !t || t.trim().length === 0 ? { valid: !1, message: "API Key 不能为空" } : t.length < 10 ? { valid: !1, message: "API Key 长度过短" } : { valid: !0 } : { valid: !0, message: "此 Provider 不需要 API Key" } : { valid: !1, message: `Provider not found: ${r}` };
|
|
6194
6294
|
}
|
|
6195
6295
|
/** 脱敏显示 API Key(如 sk-••••••••J4xK) */
|
|
6196
|
-
maskApiKey(
|
|
6197
|
-
return !
|
|
6296
|
+
maskApiKey(r) {
|
|
6297
|
+
return !r || r.length <= 8 ? "••••••••" : `${r.slice(0, 4)}••••••••${r.slice(-4)}`;
|
|
6198
6298
|
}
|
|
6199
6299
|
/** 获取通道的脱敏 API Key */
|
|
6200
|
-
getMaskedApiKey(
|
|
6201
|
-
const
|
|
6202
|
-
return
|
|
6300
|
+
getMaskedApiKey(r) {
|
|
6301
|
+
const t = this.getChannel(r);
|
|
6302
|
+
return t ? this.maskApiKey(t.apiKey) : "";
|
|
6203
6303
|
}
|
|
6204
6304
|
// ==================== 聊天执行 ====================
|
|
6205
6305
|
/** 使用当前激活的通道发送聊天请求 */
|
|
6206
|
-
async chat(
|
|
6306
|
+
async chat(r, t) {
|
|
6207
6307
|
const e = this.getActiveChannel();
|
|
6208
6308
|
if (!e)
|
|
6209
6309
|
throw new Error("No active channel. Please set an active channel first.");
|
|
6210
|
-
return this.chatWith(e.id,
|
|
6310
|
+
return this.chatWith(e.id, r, t);
|
|
6211
6311
|
}
|
|
6212
6312
|
/** 使用指定通道发送聊天请求 */
|
|
6213
|
-
async chatWith(
|
|
6214
|
-
const
|
|
6215
|
-
if (!
|
|
6216
|
-
throw new Error(`Channel not found: ${
|
|
6217
|
-
const
|
|
6218
|
-
if (!
|
|
6219
|
-
throw new Error(`Provider not found: ${
|
|
6220
|
-
const b = (e == null ? void 0 : e.messages) || [{ role: "user", content:
|
|
6221
|
-
apiFormat:
|
|
6222
|
-
baseUrl:
|
|
6223
|
-
apiKey:
|
|
6224
|
-
model:
|
|
6313
|
+
async chatWith(r, t, e) {
|
|
6314
|
+
const s = this.getChannel(r);
|
|
6315
|
+
if (!s)
|
|
6316
|
+
throw new Error(`Channel not found: ${r}`);
|
|
6317
|
+
const c = t0(s.providerId);
|
|
6318
|
+
if (!c)
|
|
6319
|
+
throw new Error(`Provider not found: ${s.providerId}`);
|
|
6320
|
+
const b = (e == null ? void 0 : e.messages) || [{ role: "user", content: t }], u = await cr({
|
|
6321
|
+
apiFormat: s.apiFormat,
|
|
6322
|
+
baseUrl: s.baseUrl || c.baseUrl,
|
|
6323
|
+
apiKey: s.apiKey,
|
|
6324
|
+
model: s.model,
|
|
6225
6325
|
messages: b,
|
|
6226
6326
|
maxTokens: e == null ? void 0 : e.maxTokens
|
|
6227
6327
|
}), f = {
|
|
6228
6328
|
...u,
|
|
6229
|
-
channelId:
|
|
6230
|
-
model:
|
|
6329
|
+
channelId: s.id,
|
|
6330
|
+
model: s.model
|
|
6231
6331
|
};
|
|
6232
6332
|
if (u.success) {
|
|
6233
|
-
const a = this.channels.findIndex((n) => n.id ===
|
|
6333
|
+
const a = this.channels.findIndex((n) => n.id === s.id);
|
|
6234
6334
|
this.channels[a].lastUsedAt = Date.now(), this.channels[a].status = "connected", this.channels[a].lastError = void 0, this.saveChannel(this.channels[a]);
|
|
6235
6335
|
} else {
|
|
6236
|
-
const a = this.channels.findIndex((n) => n.id ===
|
|
6336
|
+
const a = this.channels.findIndex((n) => n.id === s.id);
|
|
6237
6337
|
this.channels[a].status = "error", this.channels[a].lastError = u.message, this.saveChannel(this.channels[a]);
|
|
6238
6338
|
}
|
|
6239
6339
|
return this.emit("chat", f), f;
|
|
6240
6340
|
}
|
|
6241
6341
|
/** 使用当前激活通道发送流式聊天。onDelta 每次收到「累计完整文本」。 */
|
|
6242
|
-
async chatStream(
|
|
6342
|
+
async chatStream(r, t) {
|
|
6243
6343
|
const e = this.getActiveChannel();
|
|
6244
6344
|
if (!e)
|
|
6245
6345
|
throw new Error("No active channel. Please set an active channel first.");
|
|
6246
|
-
return this.chatWithStream(e.id,
|
|
6346
|
+
return this.chatWithStream(e.id, r, t);
|
|
6247
6347
|
}
|
|
6248
6348
|
/** 使用指定通道发送流式聊天。onDelta 每次收到「累计完整文本」。 */
|
|
6249
|
-
async chatWithStream(
|
|
6250
|
-
const
|
|
6251
|
-
if (!
|
|
6252
|
-
throw new Error(`Channel not found: ${
|
|
6253
|
-
const
|
|
6254
|
-
if (!
|
|
6255
|
-
throw new Error(`Provider not found: ${
|
|
6256
|
-
const b = e.messages || [{ role: "user", content:
|
|
6257
|
-
apiFormat:
|
|
6258
|
-
baseUrl:
|
|
6259
|
-
apiKey:
|
|
6260
|
-
model:
|
|
6349
|
+
async chatWithStream(r, t, e) {
|
|
6350
|
+
const s = this.getChannel(r);
|
|
6351
|
+
if (!s)
|
|
6352
|
+
throw new Error(`Channel not found: ${r}`);
|
|
6353
|
+
const c = t0(s.providerId);
|
|
6354
|
+
if (!c)
|
|
6355
|
+
throw new Error(`Provider not found: ${s.providerId}`);
|
|
6356
|
+
const b = e.messages || [{ role: "user", content: t }], u = await Mr({
|
|
6357
|
+
apiFormat: s.apiFormat,
|
|
6358
|
+
baseUrl: s.baseUrl || c.baseUrl,
|
|
6359
|
+
apiKey: s.apiKey,
|
|
6360
|
+
model: s.model,
|
|
6261
6361
|
messages: b,
|
|
6262
6362
|
maxTokens: e.maxTokens,
|
|
6263
6363
|
onDelta: e.onDelta,
|
|
6264
6364
|
signal: e.signal
|
|
6265
6365
|
}), f = {
|
|
6266
6366
|
...u,
|
|
6267
|
-
channelId:
|
|
6268
|
-
model:
|
|
6269
|
-
}, a = this.channels.findIndex((n) => n.id ===
|
|
6367
|
+
channelId: s.id,
|
|
6368
|
+
model: s.model
|
|
6369
|
+
}, a = this.channels.findIndex((n) => n.id === s.id);
|
|
6270
6370
|
return u.success ? (this.channels[a].lastUsedAt = Date.now(), this.channels[a].status = "connected", this.channels[a].lastError = void 0) : (this.channels[a].status = "error", this.channels[a].lastError = u.message), this.saveChannel(this.channels[a]), this.emit("chat", f), f;
|
|
6271
6371
|
}
|
|
6272
6372
|
/** 测试指定通道的连接 */
|
|
6273
|
-
async testChannel(
|
|
6274
|
-
const
|
|
6275
|
-
if (!
|
|
6276
|
-
throw new Error(`Channel not found: ${
|
|
6277
|
-
const e = t0(
|
|
6373
|
+
async testChannel(r) {
|
|
6374
|
+
const t = this.getChannel(r);
|
|
6375
|
+
if (!t)
|
|
6376
|
+
throw new Error(`Channel not found: ${r}`);
|
|
6377
|
+
const e = t0(t.providerId);
|
|
6278
6378
|
if (!e)
|
|
6279
|
-
throw new Error(`Provider not found: ${
|
|
6280
|
-
const
|
|
6281
|
-
apiFormat:
|
|
6282
|
-
baseUrl:
|
|
6283
|
-
apiKey:
|
|
6284
|
-
model:
|
|
6285
|
-
}),
|
|
6286
|
-
return
|
|
6379
|
+
throw new Error(`Provider not found: ${t.providerId}`);
|
|
6380
|
+
const s = await Or({
|
|
6381
|
+
apiFormat: t.apiFormat,
|
|
6382
|
+
baseUrl: t.baseUrl || e.baseUrl,
|
|
6383
|
+
apiKey: t.apiKey,
|
|
6384
|
+
model: t.model
|
|
6385
|
+
}), c = this.channels.findIndex((b) => b.id === r);
|
|
6386
|
+
return s.success ? (this.channels[c].status = "connected", this.channels[c].lastError = void 0) : (this.channels[c].status = "error", this.channels[c].lastError = s.message), this.saveChannel(this.channels[c]), this.emit("test", { id: r, ...s }), s;
|
|
6287
6387
|
}
|
|
6288
6388
|
/** 测试所有通道连接 */
|
|
6289
6389
|
async testAllChannels() {
|
|
6290
6390
|
return await Promise.all(
|
|
6291
|
-
this.channels.map(async (
|
|
6391
|
+
this.channels.map(async (t) => {
|
|
6292
6392
|
try {
|
|
6293
|
-
const e = await this.testChannel(
|
|
6294
|
-
return { id:
|
|
6393
|
+
const e = await this.testChannel(t.id);
|
|
6394
|
+
return { id: t.id, channel: t, result: e };
|
|
6295
6395
|
} catch (e) {
|
|
6296
|
-
return { id:
|
|
6396
|
+
return { id: t.id, channel: t, result: { success: !1, message: e instanceof Error ? e.message : String(e) } };
|
|
6297
6397
|
}
|
|
6298
6398
|
})
|
|
6299
6399
|
);
|
|
@@ -6301,80 +6401,80 @@ class la {
|
|
|
6301
6401
|
// ==================== Provider 查询 ====================
|
|
6302
6402
|
/** 获取所有可用的 Provider */
|
|
6303
6403
|
getAvailableProviders() {
|
|
6304
|
-
return
|
|
6404
|
+
return or();
|
|
6305
6405
|
}
|
|
6306
6406
|
/** 获取单个 Provider 信息 */
|
|
6307
|
-
getProvider(
|
|
6308
|
-
return t0(
|
|
6407
|
+
getProvider(r) {
|
|
6408
|
+
return t0(r);
|
|
6309
6409
|
}
|
|
6310
6410
|
/** 按 API 格式获取 Provider 列表 */
|
|
6311
|
-
getProvidersByFormat(
|
|
6312
|
-
return _r(
|
|
6411
|
+
getProvidersByFormat(r) {
|
|
6412
|
+
return _r(r);
|
|
6313
6413
|
}
|
|
6314
6414
|
// ==================== 导入导出 ====================
|
|
6315
6415
|
/** 导出所有通道配置(不包含 API Key 明文) */
|
|
6316
|
-
exportChannels(
|
|
6317
|
-
const
|
|
6318
|
-
if (
|
|
6319
|
-
const { apiKey:
|
|
6320
|
-
return { ...
|
|
6416
|
+
exportChannels(r) {
|
|
6417
|
+
const t = this.channels.map((e) => {
|
|
6418
|
+
if (r) return e;
|
|
6419
|
+
const { apiKey: s, ...c } = e;
|
|
6420
|
+
return { ...c, apiKey: this.maskApiKey(s) };
|
|
6321
6421
|
});
|
|
6322
6422
|
return JSON.stringify({
|
|
6323
6423
|
version: 1,
|
|
6324
6424
|
exportedAt: Date.now(),
|
|
6325
|
-
channels:
|
|
6425
|
+
channels: t
|
|
6326
6426
|
}, null, 2);
|
|
6327
6427
|
}
|
|
6328
6428
|
/** 导入通道配置 */
|
|
6329
|
-
async importChannels(
|
|
6330
|
-
const e = JSON.parse(
|
|
6429
|
+
async importChannels(r, t = !0) {
|
|
6430
|
+
const e = JSON.parse(r);
|
|
6331
6431
|
if (!e.channels || !Array.isArray(e.channels))
|
|
6332
6432
|
throw new Error("Invalid import format: missing channels array");
|
|
6333
|
-
|
|
6334
|
-
const
|
|
6335
|
-
for (const
|
|
6336
|
-
if (
|
|
6337
|
-
console.warn(`Skipping channel ${
|
|
6433
|
+
t || this.clearAllChannels();
|
|
6434
|
+
const s = [];
|
|
6435
|
+
for (const c of e.channels) {
|
|
6436
|
+
if (c.apiKey && c.apiKey.includes("••••")) {
|
|
6437
|
+
console.warn(`Skipping channel ${c.modelName}: API Key is masked`);
|
|
6338
6438
|
continue;
|
|
6339
6439
|
}
|
|
6340
6440
|
const b = {
|
|
6341
|
-
providerId:
|
|
6342
|
-
apiKey:
|
|
6343
|
-
model:
|
|
6344
|
-
modelName:
|
|
6345
|
-
baseUrl:
|
|
6346
|
-
}, u = await this.addChannel(b,
|
|
6347
|
-
|
|
6441
|
+
providerId: c.providerId,
|
|
6442
|
+
apiKey: c.apiKey,
|
|
6443
|
+
model: c.model,
|
|
6444
|
+
modelName: c.modelName,
|
|
6445
|
+
baseUrl: c.baseUrl
|
|
6446
|
+
}, u = await this.addChannel(b, c.name);
|
|
6447
|
+
s.push(u);
|
|
6348
6448
|
}
|
|
6349
|
-
return
|
|
6449
|
+
return s;
|
|
6350
6450
|
}
|
|
6351
6451
|
// ==================== 批量操作 ====================
|
|
6352
6452
|
/** 清空所有通道 */
|
|
6353
6453
|
clearAllChannels() {
|
|
6354
|
-
this.channels.forEach((
|
|
6355
|
-
this.deleteChannelFromStorage(
|
|
6356
|
-
}), this.channels = [], this.activeChannelId = null, this.saveActiveChannel(), this.emit("clear", {});
|
|
6454
|
+
this.channels.forEach((r) => {
|
|
6455
|
+
this.deleteChannelFromStorage(r.id);
|
|
6456
|
+
}), this.channels = [], this.activeChannelId = null, this.saveActiveChannel(), this.capabilityDefaults = {}, this.saveCapabilityDefaults(), this.emit("clear", {});
|
|
6357
6457
|
}
|
|
6358
6458
|
/** 批量删除通道 */
|
|
6359
|
-
deleteChannels(
|
|
6360
|
-
|
|
6459
|
+
deleteChannels(r) {
|
|
6460
|
+
r.forEach((t) => this.deleteChannel(t));
|
|
6361
6461
|
}
|
|
6362
6462
|
/** 获取统计信息 */
|
|
6363
6463
|
getStats() {
|
|
6364
|
-
const
|
|
6464
|
+
const r = {
|
|
6365
6465
|
total: this.channels.length,
|
|
6366
6466
|
byStatus: {},
|
|
6367
6467
|
byFormat: {},
|
|
6368
6468
|
byProvider: {},
|
|
6369
6469
|
byCapability: {}
|
|
6370
6470
|
};
|
|
6371
|
-
for (const
|
|
6372
|
-
const e =
|
|
6373
|
-
|
|
6374
|
-
for (const
|
|
6375
|
-
|
|
6471
|
+
for (const t of this.channels) {
|
|
6472
|
+
const e = t.status || "untested";
|
|
6473
|
+
r.byStatus[e] = (r.byStatus[e] || 0) + 1, r.byFormat[t.apiFormat] = (r.byFormat[t.apiFormat] || 0) + 1, r.byProvider[t.providerId] = (r.byProvider[t.providerId] || 0) + 1;
|
|
6474
|
+
for (const s of t.capabilities || [])
|
|
6475
|
+
r.byCapability[s] = (r.byCapability[s] || 0) + 1;
|
|
6376
6476
|
}
|
|
6377
|
-
return
|
|
6477
|
+
return r;
|
|
6378
6478
|
}
|
|
6379
6479
|
}
|
|
6380
6480
|
export {
|
|
@@ -6387,20 +6487,20 @@ export {
|
|
|
6387
6487
|
xa as createConfigStorage,
|
|
6388
6488
|
ur as defaultStorageAdapter,
|
|
6389
6489
|
ra as encryptedStorageAdapter,
|
|
6390
|
-
|
|
6391
|
-
|
|
6490
|
+
$r as fetchModels,
|
|
6491
|
+
or as getAllProviders,
|
|
6392
6492
|
t0 as getProvider,
|
|
6393
6493
|
ca as getProviderFromConfig,
|
|
6394
6494
|
_r as getProvidersByFormat,
|
|
6395
6495
|
te as getStaticModels,
|
|
6396
6496
|
ae as getStrategy,
|
|
6397
|
-
|
|
6497
|
+
oa as localStorageAdapter,
|
|
6398
6498
|
ta as plainStorageAdapter,
|
|
6399
6499
|
aa as resolveProviderConfig,
|
|
6400
6500
|
cr as sendDirectChat,
|
|
6401
6501
|
Mr as sendDirectChatStream,
|
|
6402
6502
|
Hr as strategyRegistry,
|
|
6403
|
-
|
|
6503
|
+
sa as testConnection,
|
|
6404
6504
|
Or as testDirectConnection
|
|
6405
6505
|
};
|
|
6406
6506
|
//# sourceMappingURL=index.js.map
|