@theowlops/boombot 1.1.2 → 1.1.3
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/cli/cli/registry.js +14 -0
- package/dist/cli/commands/update.js +21 -0
- package/dist/gateway/handlers/system.js +54 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/commands.d.ts +40 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/commands.js +22 -0
- package/dist/package.json +1 -1
- package/dist/web/assets/{ChatView-DwrZXRTf.js → ChatView-DewkhV93.js} +1 -1
- package/dist/web/assets/{MemoryView-GytJpeXY.js → MemoryView-DP25X8jn.js} +1 -1
- package/dist/web/assets/{SchedulesView-CgZHa7Zc.js → SchedulesView-DOeYo9tY.js} +1 -1
- package/dist/web/assets/{SessionsView-DIaw3vEm.js → SessionsView-Cg8olSle.js} +1 -1
- package/dist/web/assets/{TasksView-BIccQf95.js → TasksView-BWJym_ZX.js} +1 -1
- package/dist/web/assets/{Textarea-DjaaMDYP.js → Textarea-zDM3NMBL.js} +1 -1
- package/dist/web/assets/{Tooltip-DSXSVOvn.js → Tooltip-Dzv4yBOV.js} +1 -1
- package/dist/web/assets/{browser-BfCCGa0f.js → browser-BXTr8ura.js} +1 -1
- package/dist/web/assets/index-usu7RXES.js +73 -0
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index-7FrWWPBR.js +0 -73
package/dist/cli/cli/registry.js
CHANGED
|
@@ -10,6 +10,7 @@ import { runGateway } from "../commands/gateway.js";
|
|
|
10
10
|
import { isSupportedMigrateSource, printMigrateReport, runMigrateFromOpenClaw, } from "../commands/migrate.js";
|
|
11
11
|
import { runSetup } from "../commands/setup.js";
|
|
12
12
|
import { runPluginList, runPluginInstall, runPluginUninstall } from "../commands/plugin.js";
|
|
13
|
+
import { runUpdate } from "../commands/update.js";
|
|
13
14
|
import { CliError } from "./cli-error.js";
|
|
14
15
|
async function setupHandler(_ctx) {
|
|
15
16
|
await runSetup();
|
|
@@ -182,4 +183,17 @@ export const REGISTRY = [
|
|
|
182
183
|
},
|
|
183
184
|
handler: pluginUninstallHandler,
|
|
184
185
|
},
|
|
186
|
+
{
|
|
187
|
+
spec: {
|
|
188
|
+
path: ['update'],
|
|
189
|
+
aliases: [['upgrade']],
|
|
190
|
+
summary: 'Cập nhật BoomBot lên phiên bản mới nhất từ npm',
|
|
191
|
+
usage: 'boombot update',
|
|
192
|
+
acceptsPositionals: false,
|
|
193
|
+
flags: [],
|
|
194
|
+
examples: ['boombot update', 'boombot upgrade'],
|
|
195
|
+
notes: ['Chạy `npm install -g @theowlops/boombot@latest` để kéo code mới.'],
|
|
196
|
+
},
|
|
197
|
+
handler: async () => runUpdate(),
|
|
198
|
+
},
|
|
185
199
|
];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { exec } from 'node:child_process';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
3
|
+
const execAsync = promisify(exec);
|
|
4
|
+
export async function runUpdate() {
|
|
5
|
+
console.log('🔄 Đang kiểm tra và cập nhật @theowlops/boombot từ npm...');
|
|
6
|
+
try {
|
|
7
|
+
const { stdout, stderr } = await execAsync('npm install -g @theowlops/boombot@latest');
|
|
8
|
+
if (stdout.trim()) {
|
|
9
|
+
console.log(stdout.trim());
|
|
10
|
+
}
|
|
11
|
+
if (stderr.trim()) {
|
|
12
|
+
console.error(stderr.trim());
|
|
13
|
+
}
|
|
14
|
+
console.log('✅ Cập nhật thành công! Hãy khởi động lại `boombot gateway start` để áp dụng bản mới.');
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
console.error('❌ Lỗi khi cập nhật:', err instanceof Error ? err.message : String(err));
|
|
19
|
+
return 1;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -3,10 +3,64 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Mirrors `GET /healthz` (which needs no auth): `{ ok, version, wireVersion }`.
|
|
5
5
|
*/
|
|
6
|
+
import { exec } from 'node:child_process';
|
|
7
|
+
import { promisify } from 'node:util';
|
|
6
8
|
import { WIRE_VERSION } from '@boombot/protocol';
|
|
7
9
|
import { GATEWAY_VERSION } from '../server.js';
|
|
10
|
+
const execAsync = promisify(exec);
|
|
8
11
|
export function registerSystemHandlers(registry) {
|
|
9
12
|
registry.register('gateway.health', async () => {
|
|
10
13
|
return { ok: true, version: GATEWAY_VERSION, wireVersion: WIRE_VERSION };
|
|
11
14
|
});
|
|
15
|
+
registry.register('system.version', async () => {
|
|
16
|
+
let latest;
|
|
17
|
+
try {
|
|
18
|
+
const res = await fetch('https://registry.npmjs.org/@theowlops/boombot/latest', {
|
|
19
|
+
signal: AbortSignal.timeout(4000),
|
|
20
|
+
});
|
|
21
|
+
if (res.ok) {
|
|
22
|
+
const data = (await res.json());
|
|
23
|
+
latest = data.version;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
// offline / timeout
|
|
28
|
+
}
|
|
29
|
+
const hasUpdate = Boolean(latest && latest !== GATEWAY_VERSION);
|
|
30
|
+
return { current: GATEWAY_VERSION, latest, hasUpdate };
|
|
31
|
+
});
|
|
32
|
+
registry.register('system.update', async () => {
|
|
33
|
+
try {
|
|
34
|
+
const { stdout, stderr } = await execAsync('npm install -g @theowlops/boombot@latest', {
|
|
35
|
+
timeout: 120_000,
|
|
36
|
+
});
|
|
37
|
+
let latest;
|
|
38
|
+
try {
|
|
39
|
+
const res = await fetch('https://registry.npmjs.org/@theowlops/boombot/latest', {
|
|
40
|
+
signal: AbortSignal.timeout(4000),
|
|
41
|
+
});
|
|
42
|
+
if (res.ok) {
|
|
43
|
+
const data = (await res.json());
|
|
44
|
+
latest = data.version;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
// ignore
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
ok: true,
|
|
52
|
+
message: latest ? `Đã cập nhật lên v${latest}` : 'Đã kéo bản mới nhất từ npm thành công',
|
|
53
|
+
current: GATEWAY_VERSION,
|
|
54
|
+
latest,
|
|
55
|
+
output: (stdout || stderr || '').trim(),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
return {
|
|
60
|
+
ok: false,
|
|
61
|
+
message: err instanceof Error ? err.message : 'Lỗi cập nhật npm',
|
|
62
|
+
current: GATEWAY_VERSION,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
});
|
|
12
66
|
}
|
|
@@ -3144,6 +3144,46 @@ export declare const COMMAND_SCHEMAS: {
|
|
|
3144
3144
|
wireVersion: number;
|
|
3145
3145
|
}>;
|
|
3146
3146
|
};
|
|
3147
|
+
readonly "system.version": {
|
|
3148
|
+
type: string;
|
|
3149
|
+
payload: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
3150
|
+
response: z.ZodObject<{
|
|
3151
|
+
current: z.ZodString;
|
|
3152
|
+
latest: z.ZodOptional<z.ZodString>;
|
|
3153
|
+
hasUpdate: z.ZodBoolean;
|
|
3154
|
+
}, "strip", z.ZodTypeAny, {
|
|
3155
|
+
current: string;
|
|
3156
|
+
hasUpdate: boolean;
|
|
3157
|
+
latest?: string | undefined;
|
|
3158
|
+
}, {
|
|
3159
|
+
current: string;
|
|
3160
|
+
hasUpdate: boolean;
|
|
3161
|
+
latest?: string | undefined;
|
|
3162
|
+
}>;
|
|
3163
|
+
};
|
|
3164
|
+
readonly "system.update": {
|
|
3165
|
+
type: string;
|
|
3166
|
+
payload: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
3167
|
+
response: z.ZodObject<{
|
|
3168
|
+
ok: z.ZodBoolean;
|
|
3169
|
+
message: z.ZodString;
|
|
3170
|
+
current: z.ZodString;
|
|
3171
|
+
latest: z.ZodOptional<z.ZodString>;
|
|
3172
|
+
output: z.ZodOptional<z.ZodString>;
|
|
3173
|
+
}, "strip", z.ZodTypeAny, {
|
|
3174
|
+
message: string;
|
|
3175
|
+
ok: boolean;
|
|
3176
|
+
current: string;
|
|
3177
|
+
output?: string | undefined;
|
|
3178
|
+
latest?: string | undefined;
|
|
3179
|
+
}, {
|
|
3180
|
+
message: string;
|
|
3181
|
+
ok: boolean;
|
|
3182
|
+
current: string;
|
|
3183
|
+
output?: string | undefined;
|
|
3184
|
+
latest?: string | undefined;
|
|
3185
|
+
}>;
|
|
3186
|
+
};
|
|
3147
3187
|
readonly "task.create": {
|
|
3148
3188
|
type: string;
|
|
3149
3189
|
payload: z.ZodObject<{
|
|
@@ -411,6 +411,26 @@ const gatewayHealth = {
|
|
|
411
411
|
wireVersion: z.number().int(),
|
|
412
412
|
}),
|
|
413
413
|
};
|
|
414
|
+
const systemVersion = {
|
|
415
|
+
type: "system.version",
|
|
416
|
+
payload: z.object({}),
|
|
417
|
+
response: z.object({
|
|
418
|
+
current: z.string(),
|
|
419
|
+
latest: z.string().optional(),
|
|
420
|
+
hasUpdate: z.boolean(),
|
|
421
|
+
}),
|
|
422
|
+
};
|
|
423
|
+
const systemUpdate = {
|
|
424
|
+
type: "system.update",
|
|
425
|
+
payload: z.object({}),
|
|
426
|
+
response: z.object({
|
|
427
|
+
ok: z.boolean(),
|
|
428
|
+
message: z.string(),
|
|
429
|
+
current: z.string(),
|
|
430
|
+
latest: z.string().optional(),
|
|
431
|
+
output: z.string().optional(),
|
|
432
|
+
}),
|
|
433
|
+
};
|
|
414
434
|
// ---------------------------------------------------------------------------
|
|
415
435
|
// Background task runner commands (wire v1 additive).
|
|
416
436
|
// ---------------------------------------------------------------------------
|
|
@@ -520,6 +540,8 @@ export const COMMAND_SCHEMAS = {
|
|
|
520
540
|
"memory.note": memoryNote,
|
|
521
541
|
"channel.list": channelList,
|
|
522
542
|
"gateway.health": gatewayHealth,
|
|
543
|
+
"system.version": systemVersion,
|
|
544
|
+
"system.update": systemUpdate,
|
|
523
545
|
"task.create": taskCreate,
|
|
524
546
|
"task.list": taskList,
|
|
525
547
|
"task.get": taskGet,
|
package/dist/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as Ge,a as Da,b as Hn,r as _,j as g,S as On,I as b0,B as He,O as Ra,c as Or,d as Fn,e as $n,f as Pn,g as Gn,h as Wn,w as Un,s as Vn}from"./index-7FrWWPBR.js";import{T as Xn}from"./Textarea-DjaaMDYP.js";function Yn({variant:r="compact"}){const{t:e}=Ge(),{client:t}=Da(),{push:a}=Hn(),[n,i]=_.useState([]),[o,u]=_.useState(null),[d,m]=_.useState(!0),[f,y]=_.useState(!1),x=_.useCallback(async()=>{if(!t){m(!1);return}try{const k=await t.providersList();i(k);const T=k.find(z=>z.active);u((T==null?void 0:T.id)??null)}catch{i([])}finally{m(!1)}},[t]);_.useEffect(()=>{x()},[x]);const w=_.useCallback(async k=>{const T=k.target.value;if(!(!T||T===o||f||!t)){y(!0);try{await t.providersActivate(T),u(T);const z=n.find(R=>R.id===T);a({tone:"success",title:e("modelSwitcher.switched"),message:z?`${z.name} · ${z.model}`:void 0})}catch(z){a({tone:"error",title:e("modelSwitcher.switchFailed"),message:z instanceof Error?z.message:void 0})}finally{y(!1)}}},[o,t,n,a,f,e]);return d?g.jsx(On,{size:16,"aria-label":e("modelSwitcher.loading")}):n.length===0?null:g.jsx("select",{value:o??"",onChange:w,disabled:f,"aria-label":e("modelSwitcher.label"),title:e("modelSwitcher.label"),style:{background:"var(--surface-2, rgba(255, 255, 255, 0.05))",color:"var(--text, #e2e8f0)",border:"1px solid var(--border-subtle, rgba(255, 255, 255, 0.1))",borderRadius:"6px",padding:"4px 8px",fontSize:"13px",fontFamily:"inherit",cursor:f?"not-allowed":"pointer"},children:n.map(k=>g.jsx("option",{value:k.id,children:r==="full"?`${k.name} — ${k.model}`:k.model||k.name},k.id))})}const Kn="_workbench_16slg_1",Zn="_resizer_16slg_14",Jn="_header_16slg_30",Qn="_tabs_16slg_40",es="_tabBtn_16slg_48",ts="_tabActive_16slg_73",rs="_headerActions_16slg_80",as="_closeBtn_16slg_86",ns="_liveIndicator_16slg_103",ss="_body_16slg_118",is="_terminal_16slg_125",ls="_termLine_16slg_133",os="_timestamp_16slg_140",us="_badge_16slg_146",cs="_badgeInfo_16slg_155",hs="_badgeTool_16slg_156",ds="_badgeSuccess_16slg_157",ms="_badgeError_16slg_158",fs="_badgeThinking_16slg_159",ps="_termMsg_16slg_161",vs="_termOutputBox_16slg_165",gs="_pipeline_16slg_179",bs="_stageCard_16slg_185",ys="_stageHeader_16slg_192",xs="_stageTitle_16slg_199",ws="_stageDesc_16slg_205",ks="_telemetry_16slg_212",Ss="_metricCard_16slg_218",Ts="_metricLabel_16slg_225",Ms="_metricValue_16slg_231",As="_progressBar_16slg_237",zs="_progressFill_16slg_246",U={workbench:Kn,resizer:Zn,header:Jn,tabs:Qn,tabBtn:es,tabActive:ts,headerActions:rs,closeBtn:as,liveIndicator:ns,body:ss,terminal:is,termLine:ls,timestamp:os,badge:us,badgeInfo:cs,badgeTool:hs,badgeSuccess:ds,badgeError:ms,badgeThinking:fs,termMsg:ps,termOutputBox:vs,pipeline:gs,stageCard:bs,stageHeader:ys,stageTitle:xs,stageDesc:ws,telemetry:ks,metricCard:Ss,metricLabel:Ts,metricValue:Ms,progressBar:As,progressFill:zs},Cs=_.memo(function({open:e,onClose:t,logs:a,stages:n,telemetry:i,isStreaming:o}){const[u,d]=_.useState("terminal"),[m,f]=_.useState(()=>{const M=localStorage.getItem("boombot.workbench.width");return M?Math.max(320,Math.min(800,Number(M))):420}),y=_.useRef(null),x=_.useRef(!1);_.useEffect(()=>{var M;u==="terminal"&&o&&((M=y.current)==null||M.scrollIntoView({behavior:"smooth"}))},[a,u,o]);const w=M=>{x.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const H=P=>{if(!x.current)return;const q=Math.max(320,Math.min(800,window.innerWidth-P.clientX));f(q),localStorage.setItem("boombot.workbench.width",String(q))},$=()=>{x.current=!1,document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",H),window.removeEventListener("mouseup",$)};window.addEventListener("mousemove",H),window.addEventListener("mouseup",$)};if(!e)return null;const k=i.maxContextTokens??257e3,T=i.totalTokens??0,z=Math.min(100,Math.round(T/k*100));let R="#10b981";return z>80?R="#f43f5e":z>60&&(R="#d97706"),g.jsxs("aside",{className:U.workbench,style:{width:`${m}px`},"aria-label":"Agent Execution Workbench",children:[g.jsx("div",{className:U.resizer,onMouseDown:w,title:"Kéo để điều chỉnh độ rộng (OpenClaw style)"}),g.jsxs("div",{className:U.header,children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[g.jsx("img",{src:"/logo.png",alt:"BoomBot",style:{width:16,height:16,borderRadius:4,objectFit:"cover"}}),g.jsxs("div",{className:U.tabs,children:[g.jsxs("button",{className:`${U.tabBtn} ${u==="terminal"?U.tabActive:""}`,onClick:()=>d("terminal"),children:[o&&g.jsx("span",{className:U.liveIndicator}),"Terminal"]}),g.jsx("button",{className:`${U.tabBtn} ${u==="pipeline"?U.tabActive:""}`,onClick:()=>d("pipeline"),children:"Pipeline"}),g.jsx("button",{className:`${U.tabBtn} ${u==="telemetry"?U.tabActive:""}`,onClick:()=>d("telemetry"),children:"Telemetry"})]})]}),g.jsxs("div",{className:U.headerActions,children:[g.jsx("div",{title:`Context capacity: ${z}% (${(T/1e3).toFixed(1)}k / ${(k/1e3).toFixed(0)}k)`,style:{width:50,height:4,borderRadius:2,background:"rgba(255,255,255,0.1)",overflow:"hidden",marginRight:6},children:g.jsx("div",{style:{width:`${z}%`,height:"100%",background:R,transition:"width 200ms ease"}})}),g.jsx("button",{className:U.closeBtn,onClick:t,title:"Close Workbench (Ctrl+\\)",children:"✕"})]})]}),g.jsxs("div",{className:U.body,children:[u==="terminal"&&g.jsxs("div",{className:U.terminal,children:[a.length===0?g.jsx("div",{style:{color:"#475569",textAlign:"center",marginTop:40},children:"No active execution logs yet."}):a.map(M=>{let H=U.badgeInfo;return M.type==="tool"?H=U.badgeTool:M.type==="success"?H=U.badgeSuccess:M.type==="error"?H=U.badgeError:M.type==="thinking"&&(H=U.badgeThinking),g.jsxs("div",{className:U.termLine,children:[g.jsx("span",{className:U.timestamp,children:M.timestamp}),g.jsx("span",{className:`${U.badge} ${H}`,children:M.source}),g.jsxs("div",{className:U.termMsg,children:[g.jsx("span",{children:M.message}),M.durationMs!==void 0&&g.jsxs("span",{style:{color:"#64748b",marginLeft:6},children:["(",M.durationMs,"ms)"]}),M.output&&g.jsx("div",{className:U.termOutputBox,children:M.output})]})]},M.id)}),g.jsx("div",{ref:y})]}),u==="pipeline"&&g.jsx("div",{className:U.pipeline,children:n.length===0?g.jsx("div",{style:{color:"#475569",textAlign:"center",marginTop:40},children:"Pipeline waiting for incoming turn..."}):n.map(M=>g.jsxs("div",{className:U.stageCard,children:[g.jsxs("div",{className:U.stageHeader,children:[g.jsx("span",{className:U.stageTitle,children:M.name}),g.jsx("span",{className:`${U.badge} ${M.status==="completed"?U.badgeSuccess:M.status==="running"?U.badgeTool:M.status==="failed"?U.badgeError:U.badgeInfo}`,children:M.status})]}),M.details&&g.jsx("div",{className:U.stageDesc,children:M.details}),M.durationMs!==void 0&&g.jsxs("div",{style:{color:"#475569",fontSize:11,marginTop:4},children:["Duration: ",M.durationMs,"ms"]})]},M.id))}),u==="telemetry"&&g.jsxs("div",{className:U.telemetry,children:[g.jsxs("div",{className:U.metricCard,children:[g.jsx("div",{className:U.metricLabel,children:"Context Window Usage"}),g.jsxs("div",{className:U.metricValue,children:[T.toLocaleString()," / ",k.toLocaleString()," ",g.jsxs("span",{style:{fontSize:13,fontWeight:500,color:"#94a3b8"},children:["(",z,"%)"]})]}),g.jsx("div",{className:U.progressBar,children:g.jsx("div",{className:U.progressFill,style:{width:`${z}%`}})})]}),g.jsxs("div",{className:U.metricCard,children:[g.jsx("div",{className:U.metricLabel,children:"Token Breakdown"}),g.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:13,color:"#cbd5e1"},children:[g.jsx("span",{children:"Prompt (Input):"}),g.jsx("span",{children:(i.promptTokens??0).toLocaleString()})]}),g.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:13,color:"#cbd5e1",marginTop:4},children:[g.jsx("span",{children:"Completion (Output):"}),g.jsx("span",{children:(i.completionTokens??0).toLocaleString()})]})]}),g.jsxs("div",{className:U.metricCard,children:[g.jsx("div",{className:U.metricLabel,children:"Routing & Safety Gate"}),g.jsxs("div",{style:{fontSize:13,color:"#f1f5f9"},children:["Route: ",g.jsx("span",{style:{color:"#2dd4bf",fontWeight:600},children:i.activeRoute??"Default"})]}),g.jsx("div",{style:{fontSize:12,color:"#64748b",marginTop:4},children:"System 1 Reflex: Active (<10ms)"})]})]})]})]})}),Bs="_slashPopup_i6lvu_1",Ns="_slashHeader_i6lvu_30",js="_slashItem_i6lvu_39",Ds="_slashItemSelected_i6lvu_58",Rs="_slashIcon_i6lvu_64",_s="_slashText_i6lvu_81",Is="_slashTitle_i6lvu_86",Es="_slashDesc_i6lvu_92",qs="_slashKbd_i6lvu_105",se={slashPopup:Bs,slashHeader:Ns,slashItem:js,slashItemSelected:Ds,slashIcon:Rs,slashText:_s,slashTitle:Is,slashDesc:Es,slashKbd:qs},_a=[{id:"clear",command:"/clear",title:"Chat mới (/clear)",description:"Xóa ngữ cảnh cũ và bắt đầu phiên chat mới",icon:"plus"},{id:"compact",command:"/compact",title:"Nén ngữ cảnh (/compact)",description:"Tóm tắt lịch sử để tiết kiệm token và tăng tốc độ",icon:"sparkle"},{id:"status",command:"/status",title:"Trạng thái hệ thống (/status)",description:"Xem thông tin gateway, ping, RAM và tài nguyên",icon:"monitor"},{id:"tools",command:"/tools",title:"Công cụ & Plugin (/tools)",description:"Mở danh sách plugin và sandbox tools",icon:"plug"},{id:"help",command:"/help",title:"Trợ giúp (/help)",description:"Xem danh sách phím tắt và câu lệnh điều khiển",icon:"info"}],Ls=_.memo(function({filter:e,selectedIndex:t,onSelect:a}){const n=_.useRef(null),i=e.trim().toLowerCase(),o=_a.filter(u=>u.command.toLowerCase().includes(i)||u.title.toLowerCase().includes(i)||u.description.toLowerCase().includes(i));return _.useEffect(()=>{var d;const u=(d=n.current)==null?void 0:d.children[t];u&&u.scrollIntoView({block:"nearest"})},[t]),o.length===0?null:g.jsxs("div",{className:se.slashPopup,ref:n,role:"listbox","aria-label":"Lệnh nhanh",children:[g.jsx("div",{className:se.slashHeader,children:"LỆNH NHANH (SLASH COMMANDS)"}),o.map((u,d)=>{const m=d===t,f=u.icon==="sparkle"?"bolt":u.icon;return g.jsxs("button",{type:"button",role:"option","aria-selected":m,className:`${se.slashItem} ${m?se.slashItemSelected:""}`,onClick:()=>a(u),children:[g.jsx("div",{className:se.slashIcon,children:g.jsx(b0,{name:f,size:15})}),g.jsxs("div",{className:se.slashText,children:[g.jsx("div",{className:se.slashTitle,children:u.title}),g.jsx("div",{className:se.slashDesc,children:u.description})]}),g.jsx("kbd",{className:se.slashKbd,children:"↵"})]},u.id)})]})}),Hs="_chatContainer_dnrji_13",Os="_chatMain_dnrji_29",Fs="_chat_dnrji_13",$s="_chatHeader_dnrji_77",Ps="_headerControls_dnrji_97",Gs="_telemetryBadge_dnrji_109",Ws="_telemetryBadgeValue_dnrji_135",Us="_workbenchToggleBtn_dnrji_145",Vs="_workbenchToggleBtnActive_dnrji_189",Xs="_workbenchPaneWrapper_dnrji_201",Ys="_reasoningLive_dnrji_223",Ks="_springAccordion_dnrji_1",Zs="_reasoningLiveHeader_dnrji_245",Js="_reasoningPulse_dnrji_269",Qs="_pulse_dnrji_1",ei="_reasoningLiveLabel_dnrji_355",ti="_reasoningLiveContent_dnrji_365",ri="_reasoningDetails_dnrji_397",ai="_reasoningSummary_dnrji_441",ni="_reasoningCheck_dnrji_473",si="_checkmarkPop_dnrji_1",ii="_reasoningSparkle_dnrji_513",li="_reasoningLabel_dnrji_523",oi="_reasoningBadge_dnrji_533",ui="_reasoningContent_dnrji_551",ci="_banner_dnrji_581",hi="_approvalBanner_dnrji_651",di="_pulseApproval_dnrji_1",mi="_approvalHeading_dnrji_701",fi="_approvalBadge_dnrji_713",pi="_approvalText_dnrji_737",vi="_approvalActions_dnrji_759",gi="_list_dnrji_773",bi="_row_dnrji_797",yi="_springCard_dnrji_1",xi="_rowUser_dnrji_839",wi="_avatar_dnrji_847",ki="_bubble_dnrji_871",Si="_bubbleStreaming_dnrji_909",Ti="_rotateConicGlow_dnrji_1",Mi="_meta_dnrji_1005",Ai="_roleLabel_dnrji_1025",zi="_time_dnrji_1043",Ci="_msgActionBar_dnrji_1057",Bi="_msgAction_dnrji_1057",Ni="_msgActionActive_dnrji_1149",ji="_content_dnrji_1159",Di="_p_dnrji_1171",Ri="_inlineCode_dnrji_1191",_i="_link_dnrji_1209",Ii="_mathInline_dnrji_1251",Ei="_mathBlock_dnrji_1271",qi="_codeBlock_dnrji_1313",Li="_listMd_dnrji_1337",Hi="_vbadge_dnrji_1359",Oi="_vbadgeOk_dnrji_1395",Fi="_vbadgeWarn_dnrji_1405",$i="_vbadgeText_dnrji_1415",Pi="_vbadgeTip_dnrji_1423",Gi="_thinking_dnrji_1475",Wi="_thinkingRow_dnrji_1489",Ui="_fadeIn_dnrji_1",Vi="_caret_dnrji_1505",Xi="_caretPulse_dnrji_1",Yi="_streamContentWrapper_dnrji_1553",Ki="_tokenFadeIn_dnrji_1",Zi="_streamingIndicator_dnrji_1599",Ji="_shimmerText_dnrji_1629",Qi="_shimmerSweep_dnrji_1",e1="_streamingDot_dnrji_1685",t1="_dotBlink_dnrji_1",r1="_errorBox_dnrji_1729",a1="_errorBody_dnrji_1751",n1="_errorText_dnrji_1765",s1="_cancelledNote_dnrji_1777",i1="_hero_dnrji_1795",l1="_heroMascot_dnrji_1821",o1="_heroGreeting_dnrji_1829",u1="_heroLead_dnrji_1847",c1="_heroComposer_dnrji_1863",h1="_composer_dnrji_1881",d1="_composerWrapper_dnrji_1897",m1="_composerInner_dnrji_1905",f1="_composerRow_dnrji_1979",p1="_hint_dnrji_1995",v1="_charCount_dnrji_2007",g1="_suggestRow_dnrji_2025",b1="_sendBtn_dnrji_2103",y1="_toolDot_dnrji_2181",x1="_claudeToolCard_dnrji_2227",w1="_claudeToolBody_dnrji_2255",k1="_claudeToolHeader_dnrji_2267",S1="_claudeToolHeaderLeft_dnrji_2301",T1="_claudeToolTitle_dnrji_2313",M1="_claudeToolDuration_dnrji_2325",A1="_iconMuted_dnrji_2339",z1="_iconSuccess_dnrji_2349",C1="_iconDanger_dnrji_2357",B1="_iconSpin_dnrji_2365",N1="_spin_dnrji_1",j1="_iconSpinAccent_dnrji_2375",D1="_claudeToolRow_dnrji_2411",R1="_claudeToolIndicator_dnrji_2425",_1="_claudeToolContent_dnrji_2441",I1="_claudeToolName_dnrji_2455",E1="_claudeToolVerbose_dnrji_2467",q1="_claudeToolCode_dnrji_2479",L1="_codeBlockWrapper_dnrji_2497",H1="_codeHeader_dnrji_2513",O1="_codeLang_dnrji_2531",F1="_codeCopyBtn_dnrji_2545",$1="_latencyBadge_dnrji_2585",S={chatContainer:Hs,chatMain:Os,chat:Fs,chatHeader:$s,headerControls:Ps,telemetryBadge:Gs,telemetryBadgeValue:Ws,workbenchToggleBtn:Us,workbenchToggleBtnActive:Vs,workbenchPaneWrapper:Xs,reasoningLive:Ys,springAccordion:Ks,reasoningLiveHeader:Zs,reasoningPulse:Js,pulse:Qs,reasoningLiveLabel:ei,reasoningLiveContent:ti,reasoningDetails:ri,reasoningSummary:ai,reasoningCheck:ni,checkmarkPop:si,reasoningSparkle:ii,reasoningLabel:li,reasoningBadge:oi,reasoningContent:ui,banner:ci,approvalBanner:hi,pulseApproval:di,approvalHeading:mi,approvalBadge:fi,approvalText:pi,approvalActions:vi,list:gi,row:bi,springCard:yi,rowUser:xi,avatar:wi,bubble:ki,bubbleStreaming:Si,rotateConicGlow:Ti,meta:Mi,roleLabel:Ai,time:zi,msgActionBar:Ci,msgAction:Bi,msgActionActive:Ni,content:ji,p:Di,inlineCode:Ri,link:_i,mathInline:Ii,mathBlock:Ei,codeBlock:qi,listMd:Li,vbadge:Hi,vbadgeOk:Oi,vbadgeWarn:Fi,vbadgeText:$i,vbadgeTip:Pi,thinking:Gi,thinkingRow:Wi,fadeIn:Ui,caret:Vi,caretPulse:Xi,streamContentWrapper:Yi,tokenFadeIn:Ki,streamingIndicator:Zi,shimmerText:Ji,shimmerSweep:Qi,streamingDot:e1,dotBlink:t1,errorBox:r1,errorBody:a1,errorText:n1,cancelledNote:s1,hero:i1,heroMascot:l1,heroGreeting:o1,heroLead:u1,heroComposer:c1,composer:h1,composerWrapper:d1,composerInner:m1,composerRow:f1,hint:p1,charCount:v1,suggestRow:g1,sendBtn:b1,toolDot:y1,claudeToolCard:x1,claudeToolBody:w1,claudeToolHeader:k1,claudeToolHeaderLeft:S1,claudeToolTitle:T1,claudeToolDuration:M1,iconMuted:A1,iconSuccess:z1,iconDanger:C1,iconSpin:B1,spin:N1,iconSpinAccent:j1,claudeToolRow:D1,claudeToolIndicator:R1,claudeToolContent:_1,claudeToolName:I1,claudeToolVerbose:E1,claudeToolCode:q1,codeBlockWrapper:L1,codeHeader:H1,codeLang:O1,codeCopyBtn:F1,latencyBadge:$1};function Ia({report:r}){const{t:e}=Ge(),t=r.verdicts.filter(i=>i.verdict==="grounded").length,a=r.ungroundedCount>0,n=a?e("chat.unverifiedTip",{n:r.ungroundedCount}):e("chat.verifiedTip",{n:t});return g.jsxs("span",{className:`${S.vbadge} ${a?S.vbadgeWarn:S.vbadgeOk}`,tabIndex:0,role:"img","aria-label":n,children:[g.jsx(b0,{name:a?"warn":"shield",size:14}),g.jsx("span",{className:S.vbadgeText,"aria-hidden":"true",children:a?e("chat.unverifiedLabel",{n:r.ungroundedCount}):e("chat.verifiedLabel")}),g.jsx("span",{className:S.vbadgeTip,role:"tooltip",children:n})]})}const Et=["off","new","all","verbose"],Fr="boombot.toolProgress",P1={"research.search":"chat.progressTools.researchSearch","research.extract":"chat.progressTools.researchExtract","research.deep":"chat.progressTools.researchDeep","research.academic":"chat.progressTools.researchAcademic","research.crawl":"chat.progressTools.researchCrawl","file.read":"chat.progressTools.fileRead","file.glob":"chat.progressTools.fileGlob","file.grep":"chat.progressTools.fileGrep","file.write":"chat.progressTools.fileWrite","file.edit":"chat.progressTools.fileEdit","memory.search":"chat.progressTools.memorySearch","memory.note":"chat.progressTools.memoryNote","session.search":"chat.progressTools.sessionSearch","shell.exec":"chat.progressTools.shellExec",delegate_task:"chat.progressTools.subagentRun","channel.send":"chat.progressTools.channelSend","skill.list":"chat.progressTools.skillList","skill.read":"chat.progressTools.skillRead","skill.save":"chat.progressTools.skillSave",cronjob_manage:"chat.progressTools.cronjob"};function Ea({entries:r,mode:e}){const{t}=Ge(),[a,n]=_.useState(null),o=r.filter(x=>x.status==="running").length>0,u=a!==null?a:!o&&e!=="verbose"&&e!=="new",d=r.reduce((x,w)=>x+(w.durationMs??0),0);if(e==="off"||r.length===0)return null;const m=new Set,f=e==="new"?r.filter(x=>m.has(x.name)?!1:(m.add(x.name),!0)):r,y=o?t("chat.hintStreaming"):`${t("chat.toolProgress")} (${r.length})`;return g.jsxs("div",{className:S.claudeToolCard,children:[g.jsxs("button",{type:"button",className:S.claudeToolHeader,onClick:()=>n(!u),"aria-expanded":!u,children:[g.jsxs("div",{className:S.claudeToolHeaderLeft,children:[o?g.jsx(b0,{name:"refresh",size:14,className:S.iconSpin}):g.jsx(b0,{name:"bolt",size:14,className:S.iconMuted}),g.jsx("span",{className:S.claudeToolTitle,children:y}),!o&&d>0&&g.jsxs("span",{className:S.claudeToolDuration,children:[(d/1e3).toFixed(1),"s"]})]}),g.jsx(b0,{name:u?"chevron-right":"chevron-down",size:14,className:S.iconMuted})]}),!u&&g.jsx("ul",{className:S.claudeToolBody,"aria-label":t("chat.toolProgress"),children:f.map(x=>g.jsxs("li",{className:S.claudeToolRow,children:[g.jsx("div",{className:S.claudeToolIndicator,children:x.status==="running"?g.jsx(b0,{name:"refresh",size:12,className:S.iconSpinAccent}):x.status==="error"?g.jsx(b0,{name:"warn",size:12,className:S.iconDanger}):g.jsx(b0,{name:"check",size:12,className:S.iconSuccess})}),g.jsxs("div",{className:S.claudeToolContent,children:[g.jsx("span",{className:S.claudeToolName,children:t(P1[x.name]??"chat.progressTools.other")}),g.jsx("span",{children:t(`chat.progressStatus.${x.status}`)}),e==="verbose"&&g.jsxs("span",{className:S.claudeToolVerbose,children:[g.jsx("code",{className:S.claudeToolCode,children:x.name}),g.jsx("span",{children:x.durationMs===void 0?x.id:`${x.durationMs} ms · ${x.id}`})]})]})]},x.id))})]})}class B extends Error{constructor(e,t){var a="KaTeX parse error: "+e,n,i,o=t&&t.loc;if(o&&o.start<=o.end){var u=o.lexer.input;n=o.start,i=o.end,n===u.length?a+=" at end of input: ":a+=" at position "+(n+1)+": ";var d=u.slice(n,i).replace(/[^]/g,"$&̲"),m;n>15?m="…"+u.slice(n-15,n):m=u.slice(0,n);var f;i+15<u.length?f=u.slice(i,i+15)+"…":f=u.slice(i),a+=m+d+f}super(a),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,B.prototype),this.position=n,n!=null&&i!=null&&(this.length=i-n),this.rawMessage=e}}var G1=/([A-Z])/g,W1=r=>r.replace(G1,"-$1").toLowerCase(),U1={"&":"&",">":">","<":"<",'"':""","'":"'"},V1=/[&><"']/g,w0=r=>String(r).replace(V1,e=>U1[e]),gt=r=>r.type==="ordgroup"||r.type==="color"?r.body.length===1?gt(r.body[0]):r:r.type==="font"?gt(r.body):r,X1=new Set(["mathord","textord","atom"]),ce=r=>X1.has(gt(r).type),Y1=r=>{var e=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(r);return e?e[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e[1])?null:e[1].toLowerCase():"_relative"},Qt={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:r=>"#"+r},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(r,e)=>(e.push(r),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:r=>Math.max(0,r),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:r=>Math.max(0,r),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:r=>Math.max(0,r),cli:"-e, --max-expand <n>",cliProcessor:r=>r==="Infinity"?1/0:parseInt(r)},globalGroup:{type:"boolean",cli:!1}};function K1(r){if(typeof r!="string")return r.enum[0];switch(r){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{};default:throw new Error("Unexpected schema type; settings must declare an explicit default.")}}function Z1(r){if(Object.prototype.hasOwnProperty.call(r,"default")&&r.default!==void 0)return r.default;var e=Array.isArray(r.type)?r.type[0]:r.type;return K1(e)}function J1(r,e,t,a){var n=Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0,i=Object.prototype.hasOwnProperty.call(a,"processor")?a.processor:void 0;r[e]=n!==void 0?i?i(n):n:Z1(a)}class br{constructor(e){e===void 0&&(e={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var t of Object.keys(Qt)){var a=Qt[t];a&&J1(this,t,e,a)}}isTrusted(e){if("url"in e&&e.url&&!e.protocol){var t=Y1(e.url);if(t==null)return!1;e.protocol=t}var a=typeof this.trust=="function"?this.trust(e):this.trust;return!!a}}class ve{constructor(e,t,a){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=a}sup(){return J0[Q1[this.id]]}sub(){return J0[el[this.id]]}fracNum(){return J0[tl[this.id]]}fracDen(){return J0[rl[this.id]]}cramp(){return J0[al[this.id]]}text(){return J0[nl[this.id]]}isTight(){return this.size>=2}}var yr=0,yt=1,Oe=2,oe=3,Qe=4,F0=5,Fe=6,M0=7,J0=[new ve(yr,0,!1),new ve(yt,0,!0),new ve(Oe,1,!1),new ve(oe,1,!0),new ve(Qe,2,!1),new ve(F0,2,!0),new ve(Fe,3,!1),new ve(M0,3,!0)],Q1=[Qe,F0,Qe,F0,Fe,M0,Fe,M0],el=[F0,F0,F0,F0,M0,M0,M0,M0],tl=[Oe,oe,Qe,F0,Fe,M0,Fe,M0],rl=[oe,oe,F0,F0,M0,M0,M0,M0],al=[yt,yt,oe,oe,F0,F0,M0,M0],nl=[yr,yt,Oe,oe,Oe,oe,Oe,oe],V={DISPLAY:J0[yr],TEXT:J0[Oe],SCRIPT:J0[Qe],SCRIPTSCRIPT:J0[Fe]},er=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function sl(r){for(var e=0;e<er.length;e++)for(var t=er[e],a=0;a<t.blocks.length;a++){var n=t.blocks[a];if(r>=n[0]&&r<=n[1])return t.name}return null}var bt=[];er.forEach(r=>r.blocks.forEach(e=>bt.push(...e)));function qa(r){for(var e=0;e<bt.length;e+=2)if(r>=bt[e]&&r<=bt[e+1])return!0;return!1}var m0=r=>r+" "+r,Le=80,il=function(e,t){return"M95,"+(622+e+t)+`
|
|
1
|
+
import{u as Ge,a as Da,b as Hn,r as _,j as g,S as On,I as b0,B as He,O as Ra,c as Or,d as Fn,e as $n,f as Pn,g as Gn,h as Wn,w as Un,s as Vn}from"./index-usu7RXES.js";import{T as Xn}from"./Textarea-zDM3NMBL.js";function Yn({variant:r="compact"}){const{t:e}=Ge(),{client:t}=Da(),{push:a}=Hn(),[n,i]=_.useState([]),[o,u]=_.useState(null),[d,m]=_.useState(!0),[f,y]=_.useState(!1),x=_.useCallback(async()=>{if(!t){m(!1);return}try{const k=await t.providersList();i(k);const T=k.find(z=>z.active);u((T==null?void 0:T.id)??null)}catch{i([])}finally{m(!1)}},[t]);_.useEffect(()=>{x()},[x]);const w=_.useCallback(async k=>{const T=k.target.value;if(!(!T||T===o||f||!t)){y(!0);try{await t.providersActivate(T),u(T);const z=n.find(R=>R.id===T);a({tone:"success",title:e("modelSwitcher.switched"),message:z?`${z.name} · ${z.model}`:void 0})}catch(z){a({tone:"error",title:e("modelSwitcher.switchFailed"),message:z instanceof Error?z.message:void 0})}finally{y(!1)}}},[o,t,n,a,f,e]);return d?g.jsx(On,{size:16,"aria-label":e("modelSwitcher.loading")}):n.length===0?null:g.jsx("select",{value:o??"",onChange:w,disabled:f,"aria-label":e("modelSwitcher.label"),title:e("modelSwitcher.label"),style:{background:"var(--surface-2, rgba(255, 255, 255, 0.05))",color:"var(--text, #e2e8f0)",border:"1px solid var(--border-subtle, rgba(255, 255, 255, 0.1))",borderRadius:"6px",padding:"4px 8px",fontSize:"13px",fontFamily:"inherit",cursor:f?"not-allowed":"pointer"},children:n.map(k=>g.jsx("option",{value:k.id,children:r==="full"?`${k.name} — ${k.model}`:k.model||k.name},k.id))})}const Kn="_workbench_16slg_1",Zn="_resizer_16slg_14",Jn="_header_16slg_30",Qn="_tabs_16slg_40",es="_tabBtn_16slg_48",ts="_tabActive_16slg_73",rs="_headerActions_16slg_80",as="_closeBtn_16slg_86",ns="_liveIndicator_16slg_103",ss="_body_16slg_118",is="_terminal_16slg_125",ls="_termLine_16slg_133",os="_timestamp_16slg_140",us="_badge_16slg_146",cs="_badgeInfo_16slg_155",hs="_badgeTool_16slg_156",ds="_badgeSuccess_16slg_157",ms="_badgeError_16slg_158",fs="_badgeThinking_16slg_159",ps="_termMsg_16slg_161",vs="_termOutputBox_16slg_165",gs="_pipeline_16slg_179",bs="_stageCard_16slg_185",ys="_stageHeader_16slg_192",xs="_stageTitle_16slg_199",ws="_stageDesc_16slg_205",ks="_telemetry_16slg_212",Ss="_metricCard_16slg_218",Ts="_metricLabel_16slg_225",Ms="_metricValue_16slg_231",As="_progressBar_16slg_237",zs="_progressFill_16slg_246",U={workbench:Kn,resizer:Zn,header:Jn,tabs:Qn,tabBtn:es,tabActive:ts,headerActions:rs,closeBtn:as,liveIndicator:ns,body:ss,terminal:is,termLine:ls,timestamp:os,badge:us,badgeInfo:cs,badgeTool:hs,badgeSuccess:ds,badgeError:ms,badgeThinking:fs,termMsg:ps,termOutputBox:vs,pipeline:gs,stageCard:bs,stageHeader:ys,stageTitle:xs,stageDesc:ws,telemetry:ks,metricCard:Ss,metricLabel:Ts,metricValue:Ms,progressBar:As,progressFill:zs},Cs=_.memo(function({open:e,onClose:t,logs:a,stages:n,telemetry:i,isStreaming:o}){const[u,d]=_.useState("terminal"),[m,f]=_.useState(()=>{const M=localStorage.getItem("boombot.workbench.width");return M?Math.max(320,Math.min(800,Number(M))):420}),y=_.useRef(null),x=_.useRef(!1);_.useEffect(()=>{var M;u==="terminal"&&o&&((M=y.current)==null||M.scrollIntoView({behavior:"smooth"}))},[a,u,o]);const w=M=>{x.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const H=P=>{if(!x.current)return;const q=Math.max(320,Math.min(800,window.innerWidth-P.clientX));f(q),localStorage.setItem("boombot.workbench.width",String(q))},$=()=>{x.current=!1,document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",H),window.removeEventListener("mouseup",$)};window.addEventListener("mousemove",H),window.addEventListener("mouseup",$)};if(!e)return null;const k=i.maxContextTokens??257e3,T=i.totalTokens??0,z=Math.min(100,Math.round(T/k*100));let R="#10b981";return z>80?R="#f43f5e":z>60&&(R="#d97706"),g.jsxs("aside",{className:U.workbench,style:{width:`${m}px`},"aria-label":"Agent Execution Workbench",children:[g.jsx("div",{className:U.resizer,onMouseDown:w,title:"Kéo để điều chỉnh độ rộng (OpenClaw style)"}),g.jsxs("div",{className:U.header,children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[g.jsx("img",{src:"/logo.png",alt:"BoomBot",style:{width:16,height:16,borderRadius:4,objectFit:"cover"}}),g.jsxs("div",{className:U.tabs,children:[g.jsxs("button",{className:`${U.tabBtn} ${u==="terminal"?U.tabActive:""}`,onClick:()=>d("terminal"),children:[o&&g.jsx("span",{className:U.liveIndicator}),"Terminal"]}),g.jsx("button",{className:`${U.tabBtn} ${u==="pipeline"?U.tabActive:""}`,onClick:()=>d("pipeline"),children:"Pipeline"}),g.jsx("button",{className:`${U.tabBtn} ${u==="telemetry"?U.tabActive:""}`,onClick:()=>d("telemetry"),children:"Telemetry"})]})]}),g.jsxs("div",{className:U.headerActions,children:[g.jsx("div",{title:`Context capacity: ${z}% (${(T/1e3).toFixed(1)}k / ${(k/1e3).toFixed(0)}k)`,style:{width:50,height:4,borderRadius:2,background:"rgba(255,255,255,0.1)",overflow:"hidden",marginRight:6},children:g.jsx("div",{style:{width:`${z}%`,height:"100%",background:R,transition:"width 200ms ease"}})}),g.jsx("button",{className:U.closeBtn,onClick:t,title:"Close Workbench (Ctrl+\\)",children:"✕"})]})]}),g.jsxs("div",{className:U.body,children:[u==="terminal"&&g.jsxs("div",{className:U.terminal,children:[a.length===0?g.jsx("div",{style:{color:"#475569",textAlign:"center",marginTop:40},children:"No active execution logs yet."}):a.map(M=>{let H=U.badgeInfo;return M.type==="tool"?H=U.badgeTool:M.type==="success"?H=U.badgeSuccess:M.type==="error"?H=U.badgeError:M.type==="thinking"&&(H=U.badgeThinking),g.jsxs("div",{className:U.termLine,children:[g.jsx("span",{className:U.timestamp,children:M.timestamp}),g.jsx("span",{className:`${U.badge} ${H}`,children:M.source}),g.jsxs("div",{className:U.termMsg,children:[g.jsx("span",{children:M.message}),M.durationMs!==void 0&&g.jsxs("span",{style:{color:"#64748b",marginLeft:6},children:["(",M.durationMs,"ms)"]}),M.output&&g.jsx("div",{className:U.termOutputBox,children:M.output})]})]},M.id)}),g.jsx("div",{ref:y})]}),u==="pipeline"&&g.jsx("div",{className:U.pipeline,children:n.length===0?g.jsx("div",{style:{color:"#475569",textAlign:"center",marginTop:40},children:"Pipeline waiting for incoming turn..."}):n.map(M=>g.jsxs("div",{className:U.stageCard,children:[g.jsxs("div",{className:U.stageHeader,children:[g.jsx("span",{className:U.stageTitle,children:M.name}),g.jsx("span",{className:`${U.badge} ${M.status==="completed"?U.badgeSuccess:M.status==="running"?U.badgeTool:M.status==="failed"?U.badgeError:U.badgeInfo}`,children:M.status})]}),M.details&&g.jsx("div",{className:U.stageDesc,children:M.details}),M.durationMs!==void 0&&g.jsxs("div",{style:{color:"#475569",fontSize:11,marginTop:4},children:["Duration: ",M.durationMs,"ms"]})]},M.id))}),u==="telemetry"&&g.jsxs("div",{className:U.telemetry,children:[g.jsxs("div",{className:U.metricCard,children:[g.jsx("div",{className:U.metricLabel,children:"Context Window Usage"}),g.jsxs("div",{className:U.metricValue,children:[T.toLocaleString()," / ",k.toLocaleString()," ",g.jsxs("span",{style:{fontSize:13,fontWeight:500,color:"#94a3b8"},children:["(",z,"%)"]})]}),g.jsx("div",{className:U.progressBar,children:g.jsx("div",{className:U.progressFill,style:{width:`${z}%`}})})]}),g.jsxs("div",{className:U.metricCard,children:[g.jsx("div",{className:U.metricLabel,children:"Token Breakdown"}),g.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:13,color:"#cbd5e1"},children:[g.jsx("span",{children:"Prompt (Input):"}),g.jsx("span",{children:(i.promptTokens??0).toLocaleString()})]}),g.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:13,color:"#cbd5e1",marginTop:4},children:[g.jsx("span",{children:"Completion (Output):"}),g.jsx("span",{children:(i.completionTokens??0).toLocaleString()})]})]}),g.jsxs("div",{className:U.metricCard,children:[g.jsx("div",{className:U.metricLabel,children:"Routing & Safety Gate"}),g.jsxs("div",{style:{fontSize:13,color:"#f1f5f9"},children:["Route: ",g.jsx("span",{style:{color:"#2dd4bf",fontWeight:600},children:i.activeRoute??"Default"})]}),g.jsx("div",{style:{fontSize:12,color:"#64748b",marginTop:4},children:"System 1 Reflex: Active (<10ms)"})]})]})]})]})}),Bs="_slashPopup_i6lvu_1",Ns="_slashHeader_i6lvu_30",js="_slashItem_i6lvu_39",Ds="_slashItemSelected_i6lvu_58",Rs="_slashIcon_i6lvu_64",_s="_slashText_i6lvu_81",Is="_slashTitle_i6lvu_86",Es="_slashDesc_i6lvu_92",qs="_slashKbd_i6lvu_105",se={slashPopup:Bs,slashHeader:Ns,slashItem:js,slashItemSelected:Ds,slashIcon:Rs,slashText:_s,slashTitle:Is,slashDesc:Es,slashKbd:qs},_a=[{id:"clear",command:"/clear",title:"Chat mới (/clear)",description:"Xóa ngữ cảnh cũ và bắt đầu phiên chat mới",icon:"plus"},{id:"compact",command:"/compact",title:"Nén ngữ cảnh (/compact)",description:"Tóm tắt lịch sử để tiết kiệm token và tăng tốc độ",icon:"sparkle"},{id:"status",command:"/status",title:"Trạng thái hệ thống (/status)",description:"Xem thông tin gateway, ping, RAM và tài nguyên",icon:"monitor"},{id:"tools",command:"/tools",title:"Công cụ & Plugin (/tools)",description:"Mở danh sách plugin và sandbox tools",icon:"plug"},{id:"help",command:"/help",title:"Trợ giúp (/help)",description:"Xem danh sách phím tắt và câu lệnh điều khiển",icon:"info"}],Ls=_.memo(function({filter:e,selectedIndex:t,onSelect:a}){const n=_.useRef(null),i=e.trim().toLowerCase(),o=_a.filter(u=>u.command.toLowerCase().includes(i)||u.title.toLowerCase().includes(i)||u.description.toLowerCase().includes(i));return _.useEffect(()=>{var d;const u=(d=n.current)==null?void 0:d.children[t];u&&u.scrollIntoView({block:"nearest"})},[t]),o.length===0?null:g.jsxs("div",{className:se.slashPopup,ref:n,role:"listbox","aria-label":"Lệnh nhanh",children:[g.jsx("div",{className:se.slashHeader,children:"LỆNH NHANH (SLASH COMMANDS)"}),o.map((u,d)=>{const m=d===t,f=u.icon==="sparkle"?"bolt":u.icon;return g.jsxs("button",{type:"button",role:"option","aria-selected":m,className:`${se.slashItem} ${m?se.slashItemSelected:""}`,onClick:()=>a(u),children:[g.jsx("div",{className:se.slashIcon,children:g.jsx(b0,{name:f,size:15})}),g.jsxs("div",{className:se.slashText,children:[g.jsx("div",{className:se.slashTitle,children:u.title}),g.jsx("div",{className:se.slashDesc,children:u.description})]}),g.jsx("kbd",{className:se.slashKbd,children:"↵"})]},u.id)})]})}),Hs="_chatContainer_dnrji_13",Os="_chatMain_dnrji_29",Fs="_chat_dnrji_13",$s="_chatHeader_dnrji_77",Ps="_headerControls_dnrji_97",Gs="_telemetryBadge_dnrji_109",Ws="_telemetryBadgeValue_dnrji_135",Us="_workbenchToggleBtn_dnrji_145",Vs="_workbenchToggleBtnActive_dnrji_189",Xs="_workbenchPaneWrapper_dnrji_201",Ys="_reasoningLive_dnrji_223",Ks="_springAccordion_dnrji_1",Zs="_reasoningLiveHeader_dnrji_245",Js="_reasoningPulse_dnrji_269",Qs="_pulse_dnrji_1",ei="_reasoningLiveLabel_dnrji_355",ti="_reasoningLiveContent_dnrji_365",ri="_reasoningDetails_dnrji_397",ai="_reasoningSummary_dnrji_441",ni="_reasoningCheck_dnrji_473",si="_checkmarkPop_dnrji_1",ii="_reasoningSparkle_dnrji_513",li="_reasoningLabel_dnrji_523",oi="_reasoningBadge_dnrji_533",ui="_reasoningContent_dnrji_551",ci="_banner_dnrji_581",hi="_approvalBanner_dnrji_651",di="_pulseApproval_dnrji_1",mi="_approvalHeading_dnrji_701",fi="_approvalBadge_dnrji_713",pi="_approvalText_dnrji_737",vi="_approvalActions_dnrji_759",gi="_list_dnrji_773",bi="_row_dnrji_797",yi="_springCard_dnrji_1",xi="_rowUser_dnrji_839",wi="_avatar_dnrji_847",ki="_bubble_dnrji_871",Si="_bubbleStreaming_dnrji_909",Ti="_rotateConicGlow_dnrji_1",Mi="_meta_dnrji_1005",Ai="_roleLabel_dnrji_1025",zi="_time_dnrji_1043",Ci="_msgActionBar_dnrji_1057",Bi="_msgAction_dnrji_1057",Ni="_msgActionActive_dnrji_1149",ji="_content_dnrji_1159",Di="_p_dnrji_1171",Ri="_inlineCode_dnrji_1191",_i="_link_dnrji_1209",Ii="_mathInline_dnrji_1251",Ei="_mathBlock_dnrji_1271",qi="_codeBlock_dnrji_1313",Li="_listMd_dnrji_1337",Hi="_vbadge_dnrji_1359",Oi="_vbadgeOk_dnrji_1395",Fi="_vbadgeWarn_dnrji_1405",$i="_vbadgeText_dnrji_1415",Pi="_vbadgeTip_dnrji_1423",Gi="_thinking_dnrji_1475",Wi="_thinkingRow_dnrji_1489",Ui="_fadeIn_dnrji_1",Vi="_caret_dnrji_1505",Xi="_caretPulse_dnrji_1",Yi="_streamContentWrapper_dnrji_1553",Ki="_tokenFadeIn_dnrji_1",Zi="_streamingIndicator_dnrji_1599",Ji="_shimmerText_dnrji_1629",Qi="_shimmerSweep_dnrji_1",e1="_streamingDot_dnrji_1685",t1="_dotBlink_dnrji_1",r1="_errorBox_dnrji_1729",a1="_errorBody_dnrji_1751",n1="_errorText_dnrji_1765",s1="_cancelledNote_dnrji_1777",i1="_hero_dnrji_1795",l1="_heroMascot_dnrji_1821",o1="_heroGreeting_dnrji_1829",u1="_heroLead_dnrji_1847",c1="_heroComposer_dnrji_1863",h1="_composer_dnrji_1881",d1="_composerWrapper_dnrji_1897",m1="_composerInner_dnrji_1905",f1="_composerRow_dnrji_1979",p1="_hint_dnrji_1995",v1="_charCount_dnrji_2007",g1="_suggestRow_dnrji_2025",b1="_sendBtn_dnrji_2103",y1="_toolDot_dnrji_2181",x1="_claudeToolCard_dnrji_2227",w1="_claudeToolBody_dnrji_2255",k1="_claudeToolHeader_dnrji_2267",S1="_claudeToolHeaderLeft_dnrji_2301",T1="_claudeToolTitle_dnrji_2313",M1="_claudeToolDuration_dnrji_2325",A1="_iconMuted_dnrji_2339",z1="_iconSuccess_dnrji_2349",C1="_iconDanger_dnrji_2357",B1="_iconSpin_dnrji_2365",N1="_spin_dnrji_1",j1="_iconSpinAccent_dnrji_2375",D1="_claudeToolRow_dnrji_2411",R1="_claudeToolIndicator_dnrji_2425",_1="_claudeToolContent_dnrji_2441",I1="_claudeToolName_dnrji_2455",E1="_claudeToolVerbose_dnrji_2467",q1="_claudeToolCode_dnrji_2479",L1="_codeBlockWrapper_dnrji_2497",H1="_codeHeader_dnrji_2513",O1="_codeLang_dnrji_2531",F1="_codeCopyBtn_dnrji_2545",$1="_latencyBadge_dnrji_2585",S={chatContainer:Hs,chatMain:Os,chat:Fs,chatHeader:$s,headerControls:Ps,telemetryBadge:Gs,telemetryBadgeValue:Ws,workbenchToggleBtn:Us,workbenchToggleBtnActive:Vs,workbenchPaneWrapper:Xs,reasoningLive:Ys,springAccordion:Ks,reasoningLiveHeader:Zs,reasoningPulse:Js,pulse:Qs,reasoningLiveLabel:ei,reasoningLiveContent:ti,reasoningDetails:ri,reasoningSummary:ai,reasoningCheck:ni,checkmarkPop:si,reasoningSparkle:ii,reasoningLabel:li,reasoningBadge:oi,reasoningContent:ui,banner:ci,approvalBanner:hi,pulseApproval:di,approvalHeading:mi,approvalBadge:fi,approvalText:pi,approvalActions:vi,list:gi,row:bi,springCard:yi,rowUser:xi,avatar:wi,bubble:ki,bubbleStreaming:Si,rotateConicGlow:Ti,meta:Mi,roleLabel:Ai,time:zi,msgActionBar:Ci,msgAction:Bi,msgActionActive:Ni,content:ji,p:Di,inlineCode:Ri,link:_i,mathInline:Ii,mathBlock:Ei,codeBlock:qi,listMd:Li,vbadge:Hi,vbadgeOk:Oi,vbadgeWarn:Fi,vbadgeText:$i,vbadgeTip:Pi,thinking:Gi,thinkingRow:Wi,fadeIn:Ui,caret:Vi,caretPulse:Xi,streamContentWrapper:Yi,tokenFadeIn:Ki,streamingIndicator:Zi,shimmerText:Ji,shimmerSweep:Qi,streamingDot:e1,dotBlink:t1,errorBox:r1,errorBody:a1,errorText:n1,cancelledNote:s1,hero:i1,heroMascot:l1,heroGreeting:o1,heroLead:u1,heroComposer:c1,composer:h1,composerWrapper:d1,composerInner:m1,composerRow:f1,hint:p1,charCount:v1,suggestRow:g1,sendBtn:b1,toolDot:y1,claudeToolCard:x1,claudeToolBody:w1,claudeToolHeader:k1,claudeToolHeaderLeft:S1,claudeToolTitle:T1,claudeToolDuration:M1,iconMuted:A1,iconSuccess:z1,iconDanger:C1,iconSpin:B1,spin:N1,iconSpinAccent:j1,claudeToolRow:D1,claudeToolIndicator:R1,claudeToolContent:_1,claudeToolName:I1,claudeToolVerbose:E1,claudeToolCode:q1,codeBlockWrapper:L1,codeHeader:H1,codeLang:O1,codeCopyBtn:F1,latencyBadge:$1};function Ia({report:r}){const{t:e}=Ge(),t=r.verdicts.filter(i=>i.verdict==="grounded").length,a=r.ungroundedCount>0,n=a?e("chat.unverifiedTip",{n:r.ungroundedCount}):e("chat.verifiedTip",{n:t});return g.jsxs("span",{className:`${S.vbadge} ${a?S.vbadgeWarn:S.vbadgeOk}`,tabIndex:0,role:"img","aria-label":n,children:[g.jsx(b0,{name:a?"warn":"shield",size:14}),g.jsx("span",{className:S.vbadgeText,"aria-hidden":"true",children:a?e("chat.unverifiedLabel",{n:r.ungroundedCount}):e("chat.verifiedLabel")}),g.jsx("span",{className:S.vbadgeTip,role:"tooltip",children:n})]})}const Et=["off","new","all","verbose"],Fr="boombot.toolProgress",P1={"research.search":"chat.progressTools.researchSearch","research.extract":"chat.progressTools.researchExtract","research.deep":"chat.progressTools.researchDeep","research.academic":"chat.progressTools.researchAcademic","research.crawl":"chat.progressTools.researchCrawl","file.read":"chat.progressTools.fileRead","file.glob":"chat.progressTools.fileGlob","file.grep":"chat.progressTools.fileGrep","file.write":"chat.progressTools.fileWrite","file.edit":"chat.progressTools.fileEdit","memory.search":"chat.progressTools.memorySearch","memory.note":"chat.progressTools.memoryNote","session.search":"chat.progressTools.sessionSearch","shell.exec":"chat.progressTools.shellExec",delegate_task:"chat.progressTools.subagentRun","channel.send":"chat.progressTools.channelSend","skill.list":"chat.progressTools.skillList","skill.read":"chat.progressTools.skillRead","skill.save":"chat.progressTools.skillSave",cronjob_manage:"chat.progressTools.cronjob"};function Ea({entries:r,mode:e}){const{t}=Ge(),[a,n]=_.useState(null),o=r.filter(x=>x.status==="running").length>0,u=a!==null?a:!o&&e!=="verbose"&&e!=="new",d=r.reduce((x,w)=>x+(w.durationMs??0),0);if(e==="off"||r.length===0)return null;const m=new Set,f=e==="new"?r.filter(x=>m.has(x.name)?!1:(m.add(x.name),!0)):r,y=o?t("chat.hintStreaming"):`${t("chat.toolProgress")} (${r.length})`;return g.jsxs("div",{className:S.claudeToolCard,children:[g.jsxs("button",{type:"button",className:S.claudeToolHeader,onClick:()=>n(!u),"aria-expanded":!u,children:[g.jsxs("div",{className:S.claudeToolHeaderLeft,children:[o?g.jsx(b0,{name:"refresh",size:14,className:S.iconSpin}):g.jsx(b0,{name:"bolt",size:14,className:S.iconMuted}),g.jsx("span",{className:S.claudeToolTitle,children:y}),!o&&d>0&&g.jsxs("span",{className:S.claudeToolDuration,children:[(d/1e3).toFixed(1),"s"]})]}),g.jsx(b0,{name:u?"chevron-right":"chevron-down",size:14,className:S.iconMuted})]}),!u&&g.jsx("ul",{className:S.claudeToolBody,"aria-label":t("chat.toolProgress"),children:f.map(x=>g.jsxs("li",{className:S.claudeToolRow,children:[g.jsx("div",{className:S.claudeToolIndicator,children:x.status==="running"?g.jsx(b0,{name:"refresh",size:12,className:S.iconSpinAccent}):x.status==="error"?g.jsx(b0,{name:"warn",size:12,className:S.iconDanger}):g.jsx(b0,{name:"check",size:12,className:S.iconSuccess})}),g.jsxs("div",{className:S.claudeToolContent,children:[g.jsx("span",{className:S.claudeToolName,children:t(P1[x.name]??"chat.progressTools.other")}),g.jsx("span",{children:t(`chat.progressStatus.${x.status}`)}),e==="verbose"&&g.jsxs("span",{className:S.claudeToolVerbose,children:[g.jsx("code",{className:S.claudeToolCode,children:x.name}),g.jsx("span",{children:x.durationMs===void 0?x.id:`${x.durationMs} ms · ${x.id}`})]})]})]},x.id))})]})}class B extends Error{constructor(e,t){var a="KaTeX parse error: "+e,n,i,o=t&&t.loc;if(o&&o.start<=o.end){var u=o.lexer.input;n=o.start,i=o.end,n===u.length?a+=" at end of input: ":a+=" at position "+(n+1)+": ";var d=u.slice(n,i).replace(/[^]/g,"$&̲"),m;n>15?m="…"+u.slice(n-15,n):m=u.slice(0,n);var f;i+15<u.length?f=u.slice(i,i+15)+"…":f=u.slice(i),a+=m+d+f}super(a),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,B.prototype),this.position=n,n!=null&&i!=null&&(this.length=i-n),this.rawMessage=e}}var G1=/([A-Z])/g,W1=r=>r.replace(G1,"-$1").toLowerCase(),U1={"&":"&",">":">","<":"<",'"':""","'":"'"},V1=/[&><"']/g,w0=r=>String(r).replace(V1,e=>U1[e]),gt=r=>r.type==="ordgroup"||r.type==="color"?r.body.length===1?gt(r.body[0]):r:r.type==="font"?gt(r.body):r,X1=new Set(["mathord","textord","atom"]),ce=r=>X1.has(gt(r).type),Y1=r=>{var e=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(r);return e?e[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e[1])?null:e[1].toLowerCase():"_relative"},Qt={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:r=>"#"+r},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(r,e)=>(e.push(r),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:r=>Math.max(0,r),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:r=>Math.max(0,r),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:r=>Math.max(0,r),cli:"-e, --max-expand <n>",cliProcessor:r=>r==="Infinity"?1/0:parseInt(r)},globalGroup:{type:"boolean",cli:!1}};function K1(r){if(typeof r!="string")return r.enum[0];switch(r){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{};default:throw new Error("Unexpected schema type; settings must declare an explicit default.")}}function Z1(r){if(Object.prototype.hasOwnProperty.call(r,"default")&&r.default!==void 0)return r.default;var e=Array.isArray(r.type)?r.type[0]:r.type;return K1(e)}function J1(r,e,t,a){var n=Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0,i=Object.prototype.hasOwnProperty.call(a,"processor")?a.processor:void 0;r[e]=n!==void 0?i?i(n):n:Z1(a)}class br{constructor(e){e===void 0&&(e={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var t of Object.keys(Qt)){var a=Qt[t];a&&J1(this,t,e,a)}}isTrusted(e){if("url"in e&&e.url&&!e.protocol){var t=Y1(e.url);if(t==null)return!1;e.protocol=t}var a=typeof this.trust=="function"?this.trust(e):this.trust;return!!a}}class ve{constructor(e,t,a){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=a}sup(){return J0[Q1[this.id]]}sub(){return J0[el[this.id]]}fracNum(){return J0[tl[this.id]]}fracDen(){return J0[rl[this.id]]}cramp(){return J0[al[this.id]]}text(){return J0[nl[this.id]]}isTight(){return this.size>=2}}var yr=0,yt=1,Oe=2,oe=3,Qe=4,F0=5,Fe=6,M0=7,J0=[new ve(yr,0,!1),new ve(yt,0,!0),new ve(Oe,1,!1),new ve(oe,1,!0),new ve(Qe,2,!1),new ve(F0,2,!0),new ve(Fe,3,!1),new ve(M0,3,!0)],Q1=[Qe,F0,Qe,F0,Fe,M0,Fe,M0],el=[F0,F0,F0,F0,M0,M0,M0,M0],tl=[Oe,oe,Qe,F0,Fe,M0,Fe,M0],rl=[oe,oe,F0,F0,M0,M0,M0,M0],al=[yt,yt,oe,oe,F0,F0,M0,M0],nl=[yr,yt,Oe,oe,Oe,oe,Oe,oe],V={DISPLAY:J0[yr],TEXT:J0[Oe],SCRIPT:J0[Qe],SCRIPTSCRIPT:J0[Fe]},er=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function sl(r){for(var e=0;e<er.length;e++)for(var t=er[e],a=0;a<t.blocks.length;a++){var n=t.blocks[a];if(r>=n[0]&&r<=n[1])return t.name}return null}var bt=[];er.forEach(r=>r.blocks.forEach(e=>bt.push(...e)));function qa(r){for(var e=0;e<bt.length;e+=2)if(r>=bt[e]&&r<=bt[e+1])return!0;return!1}var m0=r=>r+" "+r,Le=80,il=function(e,t){return"M95,"+(622+e+t)+`
|
|
2
2
|
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
|
3
3
|
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
|
4
4
|
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as L,u as I,a as q,b as R,r as o,j as e,P as T,E as k,B as v,i as D,c as P,l as A}from"./index-
|
|
1
|
+
import{e as L,u as I,a as q,b as R,r as o,j as e,P as T,E as k,B as v,i as D,c as P,l as A}from"./index-usu7RXES.js";import{T as B}from"./Textarea-zDM3NMBL.js";const O="_searchSection_ujkx3_3",$="_noteSection_ujkx3_8",G="_searchInput_ujkx3_16",H="_count_ujkx3_20",Q="_results_ujkx3_26",V="_card_ujkx3_33",X="_excerpt_ujkx3_55",z="_cardFooter_ujkx3_70",J="_scoreWrap_ujkx3_77",K="_scoreTrack_ujkx3_85",U="_scoreFill_ujkx3_93",Y="_scoreLabel_ujkx3_103",Z="_skeletons_ujkx3_110",ee="_emptyWrap_ujkx3_117",r={searchSection:O,noteSection:$,searchInput:G,count:H,results:Q,card:V,excerpt:X,cardFooter:z,scoreWrap:J,scoreTrack:K,scoreFill:U,scoreLabel:Y,skeletons:Z,emptyWrap:ee};function se(c,s){const a=s.trim();if(!a)return c;const h=c.toLowerCase(),u=a.toLowerCase(),l=[];let d=0,i=0,n=h.indexOf(u,d);for(;n!==-1&&i<50;)l.push(c.slice(d,n)),l.push(e.jsx("mark",{children:c.slice(n,n+a.length)},i)),d=n+a.length,i+=1,n=h.indexOf(u,d);return l.push(c.slice(d)),e.jsx(e.Fragment,{children:l})}function ae(){const c=L(),{t:s}=I(),{client:a,connected:h}=q(),u=R(),[l,d]=o.useState(""),[i,n]=o.useState(""),[S,N]=o.useState(!1),[m,C]=o.useState(""),[p,F]=o.useState([]),[j,g]=o.useState("idle"),[w,M]=o.useState(""),_=o.useRef(0);o.useEffect(()=>{const t=setTimeout(()=>C(l.trim()),300);return()=>clearTimeout(t)},[l]);const b=o.useCallback((t,x,y)=>{a&&(g("searching"),a.memorySearch(x).then(f=>{_.current===t&&(F(f),g("done"))}).catch(f=>{_.current===t&&(M(f instanceof Error?f.message:s("memory.searchFailDefault")),g("error"),y&&u.push({tone:"error",title:s("memory.searchFailToast")}))}))},[a,s,u]);o.useEffect(()=>{if(!a||!h)return;if(!m){F([]),g("idle");return}const t=_.current+=1;b(t,m,!0)},[m,a,h,b]);const E=()=>{const t=_.current+=1;!a||!m||b(t,m,!1)},W=async t=>{if(t.preventDefault(),!(!a||!i.trim())){N(!0);try{await a.memoryNote(i.trim()),n(""),u.push({tone:"success",title:s("memory.noteSaved")})}catch(x){u.push({tone:"error",title:x instanceof Error?x.message:s("memory.noteFailed")})}finally{N(!1)}}};return h?e.jsxs(e.Fragment,{children:[e.jsx(T,{title:s("memory.title"),subtitle:s("memory.subtitleFts")}),e.jsxs("form",{className:r.noteSection,onSubmit:t=>void W(t),children:[e.jsx(B,{label:s("memory.noteLabel"),value:i,onChange:t=>n(t.target.value),placeholder:s("memory.notePlaceholder"),rows:3,maxLength:65536}),e.jsx(v,{type:"submit",variant:"primary",disabled:S||!i.trim(),children:s(S?"memory.noteSaving":"memory.noteSave")})]}),e.jsx("div",{className:r.searchSection,children:e.jsx(D,{label:s("memory.searchLabel"),className:r.searchInput,value:l,onChange:t=>d(t.target.value),placeholder:s("memory.searchPlaceholder"),role:"searchbox","aria-label":s("memory.searchAria"),autoComplete:"off"})}),j==="searching"&&e.jsx("div",{className:r.skeletons,"aria-label":s("memory.searchingAria"),children:[0,1,2].map(t=>e.jsx(P,{variant:"rect"},t))}),j==="idle"&&e.jsx("div",{className:r.emptyWrap,children:e.jsx(k,{icon:"search",title:s("memory.idleTitle"),message:s("memory.idleMessage")})}),j==="error"&&e.jsx("div",{className:r.emptyWrap,children:e.jsx(k,{icon:"warn",title:s("memory.errorTitle"),message:w,action:e.jsx(v,{variant:"secondary",onClick:E,children:s("memory.searchFailDefault")})})}),j==="done"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:r.count,role:"status",children:p.length===0?s("memory.noneFor",{q:m}):s("memory.foundFor",{n:p.length,q:m})}),p.length===0?e.jsx("div",{className:r.emptyWrap,children:e.jsx(k,{icon:"database",title:s("memory.noResultsTitle"),message:s("memory.noResultsMessage"),action:e.jsx(v,{variant:"secondary",onClick:()=>c("/"),children:s("memory.startChat")})})}):e.jsx("div",{className:r.results,children:p.map((t,x)=>{const y=Math.min(1,Math.max(0,t.score));return e.jsxs("article",{className:`enter-stagger ${r.card}`,style:{"--i":Math.min(x,7)},children:[e.jsx("p",{className:r.excerpt,children:se(t.excerpt,m)}),e.jsxs("div",{className:r.cardFooter,children:[t.source&&e.jsx(A,{tone:"info",children:t.source}),e.jsxs("div",{className:r.scoreWrap,children:[e.jsx("div",{className:r.scoreTrack,role:"img","aria-label":s("memory.scoreAria",{n:Math.round(y*100)}),children:e.jsx("div",{className:r.scoreFill,style:{transform:`scaleX(${y})`}})}),e.jsxs("span",{className:r.scoreLabel,children:[Math.round(y*100),"%"]})]})]})]},t.id)})})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(T,{title:s("memory.title"),subtitle:s("memory.subtitle")}),e.jsx(k,{icon:"warn",title:s("memory.notConnectedTitle"),message:s("memory.notConnectedMessage"),action:e.jsx(v,{variant:"primary",onClick:()=>c("/welcome"),children:s("memory.gotoOnboarding")})})]})}export{ae as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as Z,u as ee,a as se,b as te,r as m,j as t,P as W,E as M,B as _,l as $,c as ne,m as L,k as q,M as B,i as G}from"./index-
|
|
1
|
+
import{e as Z,u as ee,a as se,b as te,r as m,j as t,P as W,E as M,B as _,l as $,c as ne,m as L,k as q,M as B,i as G}from"./index-usu7RXES.js";import{T as ae}from"./Textarea-zDM3NMBL.js";import{T as le}from"./Tooltip-Dzv4yBOV.js";const re="_list_gy8cy_3",oe="_card_gy8cy_10",ce="_row_gy8cy_35",de="_info_gy8cy_43",ie="_titleRow_gy8cy_51",ue="_title_gy8cy_51",he="_cronRow_gy8cy_66",me="_cronHuman_gy8cy_73",pe="_cronRaw_gy8cy_79",fe="_meta_gy8cy_88",ge="_prompt_gy8cy_95",ye="_controls_gy8cy_102",_e="_switchWrap_gy8cy_109",ve="_actions_gy8cy_115",xe="_form_gy8cy_121",we="_formFooter_gy8cy_127",je="_skeletons_gy8cy_134",be="_deleteWarn_gy8cy_141",o={list:re,card:oe,row:ce,info:de,titleRow:ie,title:ue,cronRow:he,cronHuman:me,cronRaw:pe,meta:fe,prompt:ge,controls:ye,switchWrap:_e,actions:ve,form:xe,formFooter:we,skeletons:je,deleteWarn:be},Y=["schedules.fieldMinute","schedules.fieldHour","schedules.fieldDay","schedules.fieldMonth","schedules.fieldDow"],Ne=[[0,59],[0,23],[1,31],[1,12],[0,7]],Te=/^(?:\*|\*\/\d+|\d+(?:-\d+)?(?:,\d+(?:-\d+)?)*)$/;function Ce(g,e){var r;const l=g.trim().split(/\s+/);if(l.length!==5)return e("schedules.cronNeedsFive");for(let n=0;n<5;n+=1){const d=l[n];if(!Te.test(d))return e("schedules.fieldInvalid",{field:e(Y[n]??"")});const u=((r=d.match(/\d+/g))==null?void 0:r.map(Number))??[],[i,h]=Ne[n];if(u.some(y=>y<i||y>h))return e("schedules.fieldRange",{field:e(Y[n]??""),lo:i,hi:h})}return null}const Ee=["schedules.dow0","schedules.dow1","schedules.dow2","schedules.dow3","schedules.dow4","schedules.dow5","schedules.dow6"];function Se(g,e){const l=g.trim().split(/\s+/);if(l.length!==5)return g;const[r,n,d,u,i]=l,h=p=>/^\d+$/.test(p),y=p=>p.padStart(2,"0"),N=p=>{const c=p.match(/^\*\/(\d+)$/);return c?Number(c[1]):void 0},T=(p,c)=>`${p}:${y(c)}`;if(r==="*"&&n==="*"&&d==="*"&&u==="*"&&i==="*")return e("schedules.everyMinute");const v=N(r);if(v!==void 0&&n==="*"&&d==="*"&&u==="*"&&i==="*")return e("schedules.everyNMinutes",{n:v});const x=N(n);if(x!==void 0&&r==="0"&&d==="*"&&u==="*"&&i==="*")return e("schedules.everyNHours",{n:x});if(h(r)&&n==="*"&&d==="*"&&u==="*"&&i==="*")return e("schedules.hourlyAtMinute",{m:r});if(h(r)&&h(n)&&d==="*"&&u==="*"&&i==="*")return e("schedules.dailyAt",{time:T(n,r)});if(h(r)&&h(n)&&d==="*"&&u==="*"&&i!=="*"){const p=e(Ee[i==="7"?0:Number(i)]??"schedules.dow0");return e("schedules.weeklyAt",{day:p,time:T(n,r)})}return h(r)&&h(n)&&h(d)&&u==="*"&&i==="*"?e("schedules.monthlyAt",{dom:d,time:T(n,r)}):g}function Re(g,e){if(!g)return e("schedules.noSchedule");const l=Date.parse(g)-Date.now();if(Number.isNaN(l))return e("schedules.unknown");if(l<=0)return e("schedules.due");const r=Math.round(l/6e4);if(r<1)return e("schedules.inSeconds");if(r<60)return e("schedules.inMinutes",{n:r});const n=Math.round(r/60);if(n<24)return e("schedules.inHours",{n});const d=Math.round(n/24);return e("schedules.inDays",{n:d})}const K={name:"",cron:"",prompt:"",enabled:!0};function De(){const g=Z(),{t:e}=ee(),{client:l,connected:r}=se(),n=te(),[d,u]=m.useState([]),[i,h]=m.useState(!0),[y,N]=m.useState(null),[T,v]=m.useState(!1),[x,p]=m.useState(null),[c,b]=m.useState(K),[R,k]=m.useState({}),[F,D]=m.useState(!1),[w,E]=m.useState(null),[A,O]=m.useState(!1),S=m.useCallback(async()=>{if(l){h(!0),N(null);try{u(await l.schedulesList())}catch(s){N(s instanceof Error?s.message:e("schedules.loadError"))}finally{h(!1)}}},[l,e]);m.useEffect(()=>{S()},[S]);const H=()=>{p(null),b(K),k({}),v(!0)},V=s=>{p(s),b({name:s.name,cron:s.cron,prompt:s.prompt,enabled:s.enabled}),k({}),v(!0)},U=m.useCallback(()=>{const s={};if(c.name.trim()||(s.name=e("schedules.nameRequired")),!c.cron.trim())s.cron=e("schedules.cronRequired");else{const a=Ce(c.cron,e);a&&(s.cron=a)}return c.prompt.trim()||(s.prompt=e("schedules.promptRequired")),s},[c,e]),z=async s=>{s.preventDefault();const a=U();if(k(a),!(Object.keys(a).length>0)&&l){D(!0);try{const f={name:c.name.trim(),cron:c.cron.trim(),prompt:c.prompt.trim(),enabled:c.enabled};x?await l.schedulesUpdate(x.id,f):await l.schedulesCreate(f),await S(),v(!1),n.push({tone:"success",title:e(x?"schedules.updatedToast":"schedules.createdToast")})}catch(f){n.push({tone:"error",title:e("schedules.saveFailToast"),message:f instanceof Error?f.message:void 0})}finally{D(!1)}}},J=async s=>{if(!l)return;const a=!s.enabled;u(f=>f.map(j=>j.id===s.id?{...j,enabled:a}:j));try{const f=await l.schedulesToggle(s.id,a);u(j=>j.map(C=>C.id===s.id?f:C)),n.push({tone:"success",title:a?e("schedules.enabledToast",{name:s.name}):e("schedules.disabledToast",{name:s.name})})}catch(f){u(j=>j.map(C=>C.id===s.id?s:C)),n.push({tone:"error",title:e("schedules.toggleFailToast"),message:f instanceof Error?f.message:void 0})}},Q=async()=>{if(!(!l||!w)){O(!0);try{await l.schedulesDelete(w.id),u(s=>s.filter(a=>a.id!==w.id)),E(null),n.push({tone:"success",title:e("schedules.deletedToast",{name:w.name})})}catch(s){n.push({tone:"error",title:e("schedules.deleteFailToast"),message:s instanceof Error?s.message:void 0})}finally{O(!1)}}},[I,P]=m.useState(null),X=async s=>{if(l){P(s.id);try{await l.schedulesRunNow(s.id),n.push({tone:"success",title:e("schedules.runNowToast",{name:s.name})})}catch(a){n.push({tone:"error",title:e("schedules.runNowFailToast"),message:a instanceof Error?a.message:void 0})}finally{P(null)}}};return r?t.jsxs(t.Fragment,{children:[t.jsx(W,{title:e("schedules.title"),subtitle:e("schedules.subtitle"),actions:t.jsxs(t.Fragment,{children:[t.jsx(le,{label:e("schedules.atMostOnceTip"),children:t.jsx($,{tone:"info",children:e("schedules.atMostOnceBadge")})}),t.jsx(_,{variant:"primary",onClick:H,children:e("schedules.create")})]})}),i&&t.jsx("div",{className:o.skeletons,"aria-label":e("schedules.loadingAria"),children:[0,1,2].map(s=>t.jsx(ne,{variant:"rect"},s))}),!i&&y&&t.jsx(M,{icon:"warn",title:e("schedules.notLoadableTitle"),message:y,action:t.jsx(_,{variant:"secondary",onClick:()=>void S(),children:e("schedules.retry")})}),!i&&!y&&d.length===0&&t.jsx(M,{icon:"calendar",title:e("schedules.emptyTitle"),message:e("schedules.emptyMessage"),action:t.jsx(_,{variant:"primary",onClick:H,children:e("schedules.create")})}),!i&&!y&&d.length>0&&t.jsx("div",{className:o.list,"data-nav-list":!0,children:d.map((s,a)=>t.jsx("article",{className:`enter-stagger ${o.card}`,style:{"--i":Math.min(a,7)},"data-nav-item":!0,tabIndex:0,children:t.jsxs("div",{className:o.row,children:[t.jsxs("div",{className:o.info,children:[t.jsxs("div",{className:o.titleRow,children:[t.jsx("h3",{className:o.title,children:s.name}),t.jsxs($,{tone:s.enabled?"accent":"muted",children:[t.jsx("span",{className:s.enabled?"status-dot status-dot--pulse":"status-dot","aria-hidden":"true"}),s.enabled?e("schedules.badgeOn"):e("schedules.badgeOff")]})]}),t.jsxs("div",{className:o.cronRow,children:[t.jsx("span",{className:o.cronHuman,children:Se(s.cron,e)}),t.jsx("span",{className:o.cronRaw,children:s.cron})]}),t.jsx("p",{className:o.meta,children:e("schedules.nextRun",{time:Re(s.nextRunAt,e)})}),t.jsx("p",{className:`${o.meta} ${o.prompt}`,children:s.prompt})]}),t.jsxs("div",{className:o.controls,children:[t.jsx("div",{className:o.switchWrap,children:t.jsx(L,{checked:s.enabled,onChange:()=>void J(s),label:s.enabled?e("schedules.badgeOn"):e("schedules.badgeOff")})}),t.jsxs("div",{className:o.actions,children:[t.jsx(_,{variant:"secondary",loading:I===s.id,disabled:I!==null,onClick:()=>void X(s),children:e("schedules.runNow")}),t.jsx(q,{icon:"edit","aria-label":e("schedules.editAria",{name:s.name}),onClick:()=>V(s)}),t.jsx(q,{icon:"trash","aria-label":e("schedules.deleteAria",{name:s.name}),onClick:()=>E(s)})]})]})]})},s.id))}),t.jsx(B,{open:T,onClose:()=>v(!1),title:e(x?"schedules.modalEditTitle":"schedules.modalAddTitle"),children:t.jsxs("form",{className:o.form,onSubmit:s=>void z(s),noValidate:!0,children:[t.jsx(G,{label:e("schedules.formName"),value:c.name,onChange:s=>b(a=>({...a,name:s.target.value})),error:R.name,placeholder:e("schedules.formNamePh"),required:!0,autoComplete:"off"}),t.jsx(G,{label:e("schedules.formCron"),value:c.cron,onChange:s=>b(a=>({...a,cron:s.target.value})),error:R.cron,hint:e("schedules.formCronHint"),placeholder:"*/15 * * * *",required:!0,autoComplete:"off",inputMode:"text"}),t.jsx(ae,{label:e("schedules.formPrompt"),value:c.prompt,onChange:s=>b(a=>({...a,prompt:s.target.value})),error:R.prompt,hint:e("schedules.formPromptHint"),placeholder:e("schedules.formPromptPh"),required:!0,rows:4}),t.jsx(L,{checked:c.enabled,onChange:s=>b(a=>({...a,enabled:s})),label:e("schedules.formEnableNow")}),t.jsxs("div",{className:o.formFooter,children:[t.jsx(_,{variant:"ghost",type:"button",onClick:()=>v(!1),children:e("schedules.cancel")}),t.jsx(_,{variant:"primary",type:"submit",loading:F,disabled:F,children:e(x?"schedules.saveChanges":"schedules.create")})]})]})}),t.jsx(B,{open:!!w,onClose:()=>E(null),title:e("schedules.modalDeleteTitle"),footer:t.jsxs(t.Fragment,{children:[t.jsx(_,{variant:"ghost",onClick:()=>E(null),children:e("schedules.cancel")}),t.jsx(_,{variant:"danger",onClick:()=>void Q(),loading:A,disabled:A,children:e("schedules.modalDeleteTitle")})]}),children:w&&t.jsx("p",{className:o.deleteWarn,children:e("schedules.modalDeleteBody",{name:w.name,cron:w.cron})})})]}):t.jsxs(t.Fragment,{children:[t.jsx(W,{title:e("schedules.title"),subtitle:e("schedules.subtitle")}),t.jsx(M,{icon:"warn",title:e("schedules.notConnectedTitle"),message:e("schedules.notConnectedMessage"),action:t.jsx(_,{variant:"primary",onClick:()=>g("/welcome"),children:e("schedules.gotoOnboarding")})})]})}export{De as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as K,u as G,a as H,f as V,r as i,j as s,P as q,B as f,I as j,c as J,E as O,i as Q,k as _,M as U}from"./index-
|
|
1
|
+
import{e as K,u as G,a as H,f as V,r as i,j as s,P as q,B as f,I as j,c as J,E as O,i as Q,k as _,M as U}from"./index-usu7RXES.js";const W="_wrap_gon5p_6",X="_banner_gon5p_15",Y="_list_gon5p_31",Z="_rowItem_gon5p_40",ee="_row_gon5p_40",se="_rowIcon_gon5p_96",te="_rowMain_gon5p_119",ne="_rowTitle_gon5p_124",ae="_rowMeta_gon5p_133",ie="_rowActions_gon5p_146",oe="_editForm_gon5p_158",re="_skelRow_gon5p_171",le="_deleteText_gon5p_179",r={wrap:W,banner:X,list:Y,rowItem:Z,row:ee,rowIcon:se,rowMain:te,rowTitle:ne,rowMeta:ae,rowActions:ie,editForm:oe,skelRow:re,deleteText:le};function ce(l,t,k){const n=new Date(l).getTime();if(Number.isNaN(n))return"";const C=Date.now()-n,m=Math.floor(C/6e4);if(m<1)return t("sessions.justNow");if(m<60)return t("sessions.minutesAgo",{n:m});const d=Math.floor(m/60);if(d<24)return t("sessions.hoursAgo",{n:d});const p=Math.floor(d/24);return p===1?t("sessions.yesterday"):p<30?t("sessions.daysAgo",{n:p}):new Date(n).toLocaleDateString(k)}function ue(){const l=K(),{t,locale:k}=G(),{client:n}=H(),C=V(),[m,d]=i.useState([]),[p,v]=i.useState(!0),[T,g]=i.useState(null),[h,M]=i.useState(!1),[c,b]=i.useState(null),[w,S]=i.useState(!1),[E,D]=i.useState(null),[u,R]=i.useState(null),[N,I]=i.useState(""),A=i.useCallback(async()=>{if(!n){v(!1);return}v(!0),g(null);try{const e=await n.sessionsList();d(e)}catch(e){g(e instanceof Error?e.message:t("sessions.loadError"))}finally{v(!1)}},[n,t]);i.useEffect(()=>{A()},[A]);const B=i.useCallback(async()=>{if(!(h||!n)){M(!0);try{const e=await n.sessionsCreate();l(`/chat/${e.id}`)}catch(e){g(e instanceof Error?e.message:t("sessions.createError"))}finally{M(!1)}}},[n,h,l,t]),P=i.useCallback(async()=>{if(!(!c||w||!n)){S(!0);try{await n.sessionsDelete(c.id),d(e=>e.filter(a=>a.id!==c.id)),b(null)}catch(e){g(e instanceof Error?e.message:t("sessions.deleteError"))}finally{S(!1)}}},[n,c,w,t]),$=i.useCallback(e=>{R(e.id),I(e.title)},[]),L=i.useCallback(async e=>{if(!(!n||E!==null)){D(e.id);try{const a=await n.sessionsBranch(e.id);l(`/chat/${a.id}`)}catch(a){g(a instanceof Error?a.message:t("sessions.branchError"))}finally{D(null)}}},[E,n,l,t]),x=i.useCallback(()=>{R(null),I("")},[]),F=i.useCallback(async()=>{if(!u)return;const e=N.trim();if(e===""||!n){x();return}try{const a=await n.sessionsRename(u,e);d(y=>y.map(o=>o.id===a.id?a:o))}catch(a){g(a instanceof Error?a.message:t("sessions.renameError"))}finally{x()}},[n,u,N,x,t]),z=[...m].sort((e,a)=>new Date(a.updatedAt).getTime()-new Date(e.updatedAt).getTime());return s.jsxs("section",{className:r.wrap,"aria-label":t("sessions.sectionAria"),children:[s.jsx(q,{title:t("sessions.title"),subtitle:t("sessions.subtitle"),actions:s.jsxs(f,{variant:"primary",onClick:B,loading:h,disabled:h,children:[s.jsx(j,{name:"plus",size:18}),t("sessions.newChat")]})}),T&&s.jsxs("div",{className:r.banner,role:"alert",children:[s.jsx(j,{name:"warn",size:16}),s.jsx("span",{children:T}),s.jsx(f,{variant:"ghost",size:"sm",onClick:()=>void A(),children:t("sessions.reload")})]}),p?s.jsx("div",{className:r.list,"aria-label":t("sessions.loadingAria"),children:[0,1,2].map(e=>s.jsx("div",{className:r.skelRow,children:s.jsx(J,{variant:"rect"})},e))}):z.length===0?s.jsx(O,{icon:"sessions",title:t("sessions.emptyTitle"),message:t("sessions.emptyMessage"),action:s.jsxs(f,{variant:"primary",onClick:B,loading:h,disabled:h,children:[s.jsx(j,{name:"plus",size:18}),t("sessions.newChatEmptyCta")]})}):s.jsx("ul",{className:r.list,"data-nav-list":!0,children:z.map((e,a)=>{const y=a<8&&!C;return s.jsx("li",{className:y?`enter-stagger ${r.rowItem}`:r.rowItem,style:y?{"--i":a}:void 0,children:s.jsxs("article",{className:r.row,"data-nav-item":!0,onClick:()=>l(`/chat/${e.id}`),onKeyDown:o=>{o.key==="Enter"&&u!==e.id&&l(`/chat/${e.id}`)},tabIndex:u===e.id?-1:0,role:"button","aria-label":t("sessions.openAria",{title:e.title}),children:[s.jsx("div",{className:r.rowIcon,"aria-hidden":"true",children:s.jsx(j,{name:"chat",size:18})}),s.jsx("div",{className:r.rowMain,children:u===e.id?s.jsxs("form",{className:r.editForm,onSubmit:o=>{o.preventDefault(),o.stopPropagation(),F()},onClick:o=>o.stopPropagation(),children:[s.jsx(Q,{value:N,onChange:o=>I(o.currentTarget.value),onKeyDown:o=>{o.key==="Escape"&&x()},"aria-label":t("sessions.inputAria"),autoFocus:!0,maxLength:120}),s.jsx(_,{icon:"check","aria-label":t("sessions.saveName"),onClick:F}),s.jsx(_,{icon:"x","aria-label":t("sessions.cancelRename"),onClick:x})]}):s.jsxs(s.Fragment,{children:[s.jsx("h3",{className:r.rowTitle,children:e.title}),s.jsxs("p",{className:r.rowMeta,children:[s.jsx("span",{children:t("sessions.messagesCount",{n:e.messageCount})}),s.jsx("span",{"aria-hidden":"true",children:"·"}),s.jsx(j,{name:"clock",size:13}),s.jsx("time",{children:ce(e.updatedAt,t,k)})]})]})}),u!==e.id&&s.jsxs("div",{className:r.rowActions,onClick:o=>o.stopPropagation(),children:[s.jsx(_,{icon:"copy","aria-label":t("sessions.branchAria",{title:e.title}),disabled:E!==null,onClick:()=>void L(e)}),s.jsx(_,{icon:"edit","aria-label":t("sessions.renameAria",{title:e.title}),onClick:()=>$(e)}),s.jsx(_,{icon:"trash","aria-label":t("sessions.deleteAria",{title:e.title}),onClick:()=>b(e)})]})]})},e.id)})}),s.jsx(U,{open:c!==null,onClose:()=>!w&&b(null),title:t("sessions.modalTitle"),footer:s.jsxs(s.Fragment,{children:[s.jsx(f,{variant:"ghost",onClick:()=>b(null),disabled:w,children:t("sessions.cancel")}),s.jsx(f,{variant:"danger",onClick:P,loading:w,disabled:w,children:t("sessions.deleteBtn")})]}),children:s.jsx("p",{className:r.deleteText,children:t("sessions.modalBody",{title:(c==null?void 0:c.title)??""})})})]})}export{ue as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e as Z,u as ee,a as te,b as se,r as o,j as t,P as q,E as C,B as c,k as m,c as ae,l as D,I as re,M as G,i as ne}from"./index-
|
|
1
|
+
import{e as Z,u as ee,a as te,b as se,r as o,j as t,P as q,E as C,B as c,k as m,c as ae,l as D,I as re,M as G,i as ne}from"./index-usu7RXES.js";import{T as V}from"./Textarea-zDM3NMBL.js";import{T as ie}from"./Tooltip-Dzv4yBOV.js";const oe="_list_55r1k_3",le="_card_55r1k_10",ce="_row_55r1k_35",de="_info_55r1k_43",pe="_titleRow_55r1k_51",ue="_title_55r1k_51",me="_meta_55r1k_66",he="_taskError_55r1k_72",fe="_approval_55r1k_79",_e="_approvalActions_55r1k_97",xe="_controls_55r1k_104",ve="_actions_55r1k_111",ke="_expandBtn_55r1k_117",ge="_steps_55r1k_127",je="_step_55r1k_127",we="_stepHead_55r1k_143",be="_stepIndex_55r1k_150",ye="_stepPrompt_55r1k_157",Te="_stepAttempts_55r1k_163",Ce="_stepOutput_55r1k_168",Ee="_stepError_55r1k_182",Ne="_form_55r1k_191",Se="_formFooter_55r1k_197",Ae="_redirectHint_55r1k_204",Re="_skeletons_55r1k_211",r={list:oe,card:le,row:ce,info:de,titleRow:pe,title:ue,meta:me,taskError:he,approval:fe,approvalActions:_e,controls:xe,actions:ve,expandBtn:ke,steps:ge,step:je,stepHead:we,stepIndex:be,stepPrompt:ye,stepAttempts:Te,stepOutput:Ce,stepError:Ee,form:Ne,formFooter:Se,redirectHint:Ae,skeletons:Re},Ie=4e3,Be={queued:{tone:"info",pulse:!1},running:{tone:"accent",pulse:!0},paused:{tone:"warn",pulse:!1},awaiting_approval:{tone:"warn",pulse:!0},completed:{tone:"muted",pulse:!1},failed:{tone:"danger",pulse:!1},cancelled:{tone:"muted",pulse:!1},interrupted:{tone:"warn",pulse:!1}},Fe={pending:"muted",running:"accent",done:"info",failed:"danger",skipped:"warn"},Pe=new Set(["queued","running","paused","awaiting_approval"]),Me=new Set(["failed","interrupted"]);function qe(){const $=Z(),{t:s}=ee(),{client:p,connected:b}=te(),_=se(),[x,z]=o.useState([]),[k,E]=o.useState(!0),[g,N]=o.useState(null),[U,S]=o.useState(new Set),[u,A]=o.useState(null),[Y,j]=o.useState(!1),[R,I]=o.useState(""),[B,F]=o.useState(""),[J,v]=o.useState(null),[P,M]=o.useState(!1),[h,w]=o.useState(null),[y,T]=o.useState(""),[K,H]=o.useState(!1),O=o.useRef(p);O.current=p;const d=o.useCallback(async(e=!1)=>{const l=O.current;if(l){e||(E(!0),N(null));try{z(await l.tasksList())}catch(i){e||N(i instanceof Error?i.message:s("tasks.loadError"))}finally{e||E(!1)}}},[s]);o.useEffect(()=>{d()},[d]),o.useEffect(()=>{if(!b)return;const l=x.some(n=>n.status==="running"||n.status==="awaiting_approval")?1500:Ie,i=window.setInterval(()=>{document.visibilityState==="visible"&&d(!0)},l);return()=>window.clearInterval(i)},[b,d,x]);const Q=e=>{S(l=>{const i=new Set(l);return i.has(e)?i.delete(e):i.add(e),i})},f=async(e,l,i)=>{if(p){A(e.id);try{await l(p),await d(!0),_.push({tone:"success",title:i})}catch(n){_.push({tone:"error",title:s("tasks.actionFailToast"),message:n instanceof Error?n.message:void 0})}finally{A(null)}}},L=()=>{I(""),F(""),v(null),j(!0)},W=async e=>{e.preventDefault();const l=R.trim(),i=B.split(`
|
|
2
2
|
`).map(n=>n.trim()).filter(n=>n!=="").map(n=>({prompt:n}));if(l===""){v(s("tasks.titleRequired"));return}if(i.length===0){v(s("tasks.stepsRequired"));return}if(p){M(!0),v(null);try{const n=await p.tasksCreate({title:l,steps:i});j(!1),S(a=>new Set(a).add(n.id)),await d(!0),_.push({tone:"success",title:s("tasks.createdToast")})}catch(n){v(n instanceof Error?n.message:s("tasks.createFailToast"))}finally{M(!1)}}},X=async()=>{if(!p||!h)return;const e=y.trim();if(e!==""){H(!0);try{await p.tasksRedirect(h.id,e),w(null),T(""),await d(!0),_.push({tone:"success",title:s("tasks.redirectedToast")})}catch(l){_.push({tone:"error",title:s("tasks.actionFailToast"),message:l instanceof Error?l.message:void 0})}finally{H(!1)}}};return b?t.jsxs(t.Fragment,{children:[t.jsx(q,{title:s("tasks.title"),subtitle:s("tasks.subtitle"),actions:t.jsxs(t.Fragment,{children:[t.jsx(ie,{label:s("tasks.refreshAria"),children:t.jsx(m,{icon:"refresh","aria-label":s("tasks.refreshAria"),onClick:()=>void d()})}),t.jsx(c,{variant:"primary",onClick:L,children:s("tasks.create")})]})}),k&&t.jsx("div",{className:r.skeletons,"aria-label":s("tasks.loadingAria"),children:[0,1,2].map(e=>t.jsx(ae,{variant:"rect"},e))}),!k&&g&&t.jsx(C,{icon:"warn",title:s("tasks.notLoadableTitle"),message:g,action:t.jsx(c,{variant:"secondary",onClick:()=>void d(),children:s("tasks.retry")})}),!k&&!g&&x.length===0&&t.jsx(C,{icon:"clock",title:s("tasks.emptyTitle"),message:s("tasks.emptyMessage"),action:t.jsx(c,{variant:"primary",onClick:L,children:s("tasks.create")})}),!k&&!g&&x.length>0&&t.jsx("div",{className:r.list,"data-nav-list":!0,children:x.map((e,l)=>{const i=Be[e.status],n=U.has(e.id);return t.jsxs("article",{className:`enter-stagger ${r.card}`,style:{"--i":Math.min(l,7)},"data-nav-item":!0,tabIndex:0,children:[t.jsxs("div",{className:r.row,children:[t.jsxs("div",{className:r.info,children:[t.jsxs("div",{className:r.titleRow,children:[t.jsx("h3",{className:r.title,children:e.title}),t.jsxs(D,{tone:i.tone,children:[t.jsx("span",{className:i.pulse?"status-dot status-dot--pulse":"status-dot","aria-hidden":"true"}),s(`tasks.status_${e.status}`)]})]}),t.jsx("p",{className:r.meta,children:s("tasks.stepProgress",{done:e.steps.filter(a=>a.status==="done").length,total:e.steps.length})}),e.error&&t.jsx("p",{className:r.taskError,children:e.error}),e.status==="awaiting_approval"&&e.approval&&t.jsxs("div",{className:r.approval,role:"alert",children:[t.jsx(re,{name:"shield",size:16}),t.jsx("span",{children:s("tasks.approvalInfo",{tool:e.approval.toolName,reason:e.approval.reason})})]})]}),t.jsx("div",{className:r.controls,children:t.jsxs("div",{className:r.actions,children:[(e.status==="queued"||e.status==="running")&&t.jsx(m,{icon:"pause","aria-label":s("tasks.pauseAria",{title:e.title}),disabled:u===e.id,onClick:()=>void f(e,a=>a.tasksPause(e.id),s("tasks.pausedToast"))}),(e.status==="paused"||e.status==="awaiting_approval")&&t.jsx(m,{icon:"play","aria-label":s("tasks.resumeAria",{title:e.title}),disabled:u===e.id,onClick:()=>void f(e,a=>a.tasksResume(e.id),s("tasks.resumedToast"))}),Me.has(e.status)&&t.jsx(m,{icon:"refresh","aria-label":s("tasks.retryAria",{title:e.title}),disabled:u===e.id,onClick:()=>void f(e,a=>a.tasksRetry(e.id),s("tasks.retriedToast"))}),e.status==="running"&&t.jsx(m,{icon:"send","aria-label":s("tasks.redirectAria",{title:e.title}),disabled:u===e.id,onClick:()=>{w(e),T("")}}),Pe.has(e.status)&&t.jsx(m,{icon:"stop","aria-label":s("tasks.cancelAria",{title:e.title}),disabled:u===e.id,onClick:()=>void f(e,a=>a.tasksCancel(e.id),s("tasks.cancelledToast"))}),t.jsx(m,{icon:"chevron-right","aria-label":n?s("tasks.collapseAria",{title:e.title}):s("tasks.expandAria",{title:e.title}),"aria-expanded":n,className:r.expandBtn,onClick:()=>Q(e.id)})]})})]}),e.status==="awaiting_approval"&&e.approval&&t.jsxs("div",{className:r.approvalActions,children:[t.jsx(c,{variant:"primary",loading:u===e.id,onClick:()=>void f(e,a=>a.tasksResume(e.id,{approved:!0}),s("tasks.approvedToast")),children:s("tasks.approve")}),t.jsx(c,{variant:"danger",loading:u===e.id,onClick:()=>void f(e,a=>a.tasksResume(e.id,{approved:!1}),s("tasks.deniedToast")),children:s("tasks.deny")})]}),n&&t.jsx("ol",{className:r.steps,children:e.steps.map(a=>t.jsxs("li",{className:r.step,children:[t.jsxs("div",{className:r.stepHead,children:[t.jsxs("span",{className:r.stepIndex,children:["#",a.index+1]}),t.jsx("span",{className:r.stepPrompt,children:a.prompt}),t.jsx(D,{tone:Fe[a.status]??"muted",children:s(`tasks.step_${a.status}`)}),a.attempts>1&&t.jsx("span",{className:r.stepAttempts,children:s("tasks.attempts",{n:a.attempts})})]}),a.output&&t.jsx("pre",{className:r.stepOutput,children:a.output}),a.error&&t.jsx("p",{className:r.stepError,children:a.error})]},a.id))})]},e.id)})}),t.jsx(G,{open:Y,onClose:()=>j(!1),title:s("tasks.createModalTitle"),children:t.jsxs("form",{className:r.form,onSubmit:e=>void W(e),noValidate:!0,children:[t.jsx(ne,{label:s("tasks.formTitle"),value:R,onChange:e=>I(e.target.value),error:J??void 0,placeholder:s("tasks.formTitlePh"),required:!0,autoComplete:"off"}),t.jsx(V,{label:s("tasks.formSteps"),value:B,onChange:e=>F(e.target.value),hint:s("tasks.formStepsHint"),placeholder:s("tasks.formStepsPh"),rows:5,required:!0}),t.jsxs("div",{className:r.formFooter,children:[t.jsx(c,{variant:"ghost",type:"button",onClick:()=>j(!1),children:s("tasks.cancel")}),t.jsx(c,{variant:"primary",type:"submit",loading:P,disabled:P,children:s("tasks.create")})]})]})}),t.jsx(G,{open:h!==null,onClose:()=>w(null),title:s("tasks.redirectModalTitle"),children:t.jsxs("div",{className:r.form,children:[t.jsx("p",{className:r.redirectHint,children:s("tasks.redirectHint",{title:(h==null?void 0:h.title)??""})}),t.jsx(V,{label:s("tasks.redirectMessage"),value:y,onChange:e=>T(e.target.value),placeholder:s("tasks.redirectMessagePh"),rows:3,autoFocus:!0}),t.jsxs("div",{className:r.formFooter,children:[t.jsx(c,{variant:"ghost",onClick:()=>w(null),children:s("tasks.cancel")}),t.jsx(c,{variant:"primary",loading:K,disabled:y.trim()==="",onClick:()=>void X(),children:s("tasks.redirectSend")})]})]})})]}):t.jsxs(t.Fragment,{children:[t.jsx(q,{title:s("tasks.title"),subtitle:s("tasks.subtitle")}),t.jsx(C,{icon:"warn",title:s("tasks.notConnectedTitle"),message:s("tasks.notConnectedMessage"),action:t.jsx(c,{variant:"primary",onClick:()=>$("/welcome"),children:s("tasks.gotoOnboarding")})})]})}export{qe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,j as i,F as x,n as l,o as u}from"./index-
|
|
1
|
+
import{r as n,j as i,F as x,n as l,o as u}from"./index-usu7RXES.js";function m({label:d,error:a,hint:t,id:o,required:e,...r}){const c=n.useId(),s=o??`textarea-${c}`;return i.jsx(x,{id:s,label:d,error:a,hint:t,required:e,children:i.jsx("textarea",{id:s,className:l.control,"aria-invalid":a?!0:void 0,"aria-describedby":u(s,a,t),required:e,...r})})}export{m as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./index-
|
|
1
|
+
import{j as s}from"./index-usu7RXES.js";const p="_tooltip_r5lwe_1",i={tooltip:p};function a({label:t,children:o}){return s.jsx("span",{className:i.tooltip,"data-tip":t,children:o})}export{a as T};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p as re}from"./index-
|
|
1
|
+
import{p as re}from"./index-usu7RXES.js";function oe(r,o){for(var i=0;i<o.length;i++){const e=o[i];if(typeof e!="string"&&!Array.isArray(e)){for(const t in e)if(t!=="default"&&!(t in r)){const n=Object.getOwnPropertyDescriptor(e,t);n&&Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var z={},Q,Bt;function ie(){return Bt||(Bt=1,Q=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Q}var $={},_={},At;function U(){if(At)return _;At=1;let r;const o=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return _.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17},_.getSymbolTotalCodewords=function(e){return o[e]},_.getBCHDigit=function(i){let e=0;for(;i!==0;)e++,i>>>=1;return e},_.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');r=e},_.isKanjiModeEnabled=function(){return typeof r<"u"},_.toSJIS=function(e){return r(e)},_}var W={},Rt;function yt(){return Rt||(Rt=1,(function(r){r.L={bit:1},r.M={bit:0},r.Q={bit:3},r.H={bit:2};function o(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"l":case"low":return r.L;case"m":case"medium":return r.M;case"q":case"quartile":return r.Q;case"h":case"high":return r.H;default:throw new Error("Unknown EC Level: "+i)}}r.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4},r.from=function(e,t){if(r.isValid(e))return e;try{return o(e)}catch{return t}}})(W)),W}var Z,Tt;function se(){if(Tt)return Z;Tt=1;function r(){this.buffer=[],this.length=0}return r.prototype={get:function(o){const i=Math.floor(o/8);return(this.buffer[i]>>>7-o%8&1)===1},put:function(o,i){for(let e=0;e<i;e++)this.putBit((o>>>i-e-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(o){const i=Math.floor(this.length/8);this.buffer.length<=i&&this.buffer.push(0),o&&(this.buffer[i]|=128>>>this.length%8),this.length++}},Z=r,Z}var X,It;function ue(){if(It)return X;It=1;function r(o){if(!o||o<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=o,this.data=new Uint8Array(o*o),this.reservedBit=new Uint8Array(o*o)}return r.prototype.set=function(o,i,e,t){const n=o*this.size+i;this.data[n]=e,t&&(this.reservedBit[n]=!0)},r.prototype.get=function(o,i){return this.data[o*this.size+i]},r.prototype.xor=function(o,i,e){this.data[o*this.size+i]^=e},r.prototype.isReserved=function(o,i){return this.reservedBit[o*this.size+i]},X=r,X}var x={},Nt;function ae(){return Nt||(Nt=1,(function(r){const o=U().getSymbolSize;r.getRowColCoords=function(e){if(e===1)return[];const t=Math.floor(e/7)+2,n=o(e),s=n===145?26:Math.ceil((n-13)/(2*t-2))*2,a=[n-7];for(let u=1;u<t-1;u++)a[u]=a[u-1]-s;return a.push(6),a.reverse()},r.getPositions=function(e){const t=[],n=r.getRowColCoords(e),s=n.length;for(let a=0;a<s;a++)for(let u=0;u<s;u++)a===0&&u===0||a===0&&u===s-1||a===s-1&&u===0||t.push([n[a],n[u]]);return t}})(x)),x}var tt={},Pt;function ce(){if(Pt)return tt;Pt=1;const r=U().getSymbolSize,o=7;return tt.getPositions=function(e){const t=r(e);return[[0,0],[t-o,0],[0,t-o]]},tt}var et={},Mt;function fe(){return Mt||(Mt=1,(function(r){r.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const o={N1:3,N2:3,N3:40,N4:10};r.isValid=function(t){return t!=null&&t!==""&&!isNaN(t)&&t>=0&&t<=7},r.from=function(t){return r.isValid(t)?parseInt(t,10):void 0},r.getPenaltyN1=function(t){const n=t.size;let s=0,a=0,u=0,c=null,d=null;for(let p=0;p<n;p++){a=u=0,c=d=null;for(let h=0;h<n;h++){let f=t.get(p,h);f===c?a++:(a>=5&&(s+=o.N1+(a-5)),c=f,a=1),f=t.get(h,p),f===d?u++:(u>=5&&(s+=o.N1+(u-5)),d=f,u=1)}a>=5&&(s+=o.N1+(a-5)),u>=5&&(s+=o.N1+(u-5))}return s},r.getPenaltyN2=function(t){const n=t.size;let s=0;for(let a=0;a<n-1;a++)for(let u=0;u<n-1;u++){const c=t.get(a,u)+t.get(a,u+1)+t.get(a+1,u)+t.get(a+1,u+1);(c===4||c===0)&&s++}return s*o.N2},r.getPenaltyN3=function(t){const n=t.size;let s=0,a=0,u=0;for(let c=0;c<n;c++){a=u=0;for(let d=0;d<n;d++)a=a<<1&2047|t.get(c,d),d>=10&&(a===1488||a===93)&&s++,u=u<<1&2047|t.get(d,c),d>=10&&(u===1488||u===93)&&s++}return s*o.N3},r.getPenaltyN4=function(t){let n=0;const s=t.data.length;for(let u=0;u<s;u++)n+=t.data[u];return Math.abs(Math.ceil(n*100/s/5)-10)*o.N4};function i(e,t,n){switch(e){case r.Patterns.PATTERN000:return(t+n)%2===0;case r.Patterns.PATTERN001:return t%2===0;case r.Patterns.PATTERN010:return n%3===0;case r.Patterns.PATTERN011:return(t+n)%3===0;case r.Patterns.PATTERN100:return(Math.floor(t/2)+Math.floor(n/3))%2===0;case r.Patterns.PATTERN101:return t*n%2+t*n%3===0;case r.Patterns.PATTERN110:return(t*n%2+t*n%3)%2===0;case r.Patterns.PATTERN111:return(t*n%3+(t+n)%2)%2===0;default:throw new Error("bad maskPattern:"+e)}}r.applyMask=function(t,n){const s=n.size;for(let a=0;a<s;a++)for(let u=0;u<s;u++)n.isReserved(u,a)||n.xor(u,a,i(t,u,a))},r.getBestMask=function(t,n){const s=Object.keys(r.Patterns).length;let a=0,u=1/0;for(let c=0;c<s;c++){n(c),r.applyMask(c,t);const d=r.getPenaltyN1(t)+r.getPenaltyN2(t)+r.getPenaltyN3(t)+r.getPenaltyN4(t);r.applyMask(c,t),d<u&&(u=d,a=c)}return a}})(et)),et}var J={},St;function $t(){if(St)return J;St=1;const r=yt(),o=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],i=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return J.getBlocksCount=function(t,n){switch(n){case r.L:return o[(t-1)*4+0];case r.M:return o[(t-1)*4+1];case r.Q:return o[(t-1)*4+2];case r.H:return o[(t-1)*4+3];default:return}},J.getTotalCodewordsCount=function(t,n){switch(n){case r.L:return i[(t-1)*4+0];case r.M:return i[(t-1)*4+1];case r.Q:return i[(t-1)*4+2];case r.H:return i[(t-1)*4+3];default:return}},J}var nt={},K={},bt;function le(){if(bt)return K;bt=1;const r=new Uint8Array(512),o=new Uint8Array(256);return(function(){let e=1;for(let t=0;t<255;t++)r[t]=e,o[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t++)r[t]=r[t-255]})(),K.log=function(e){if(e<1)throw new Error("log("+e+")");return o[e]},K.exp=function(e){return r[e]},K.mul=function(e,t){return e===0||t===0?0:r[o[e]+o[t]]},K}var Lt;function de(){return Lt||(Lt=1,(function(r){const o=le();r.mul=function(e,t){const n=new Uint8Array(e.length+t.length-1);for(let s=0;s<e.length;s++)for(let a=0;a<t.length;a++)n[s+a]^=o.mul(e[s],t[a]);return n},r.mod=function(e,t){let n=new Uint8Array(e);for(;n.length-t.length>=0;){const s=n[0];for(let u=0;u<t.length;u++)n[u]^=o.mul(t[u],s);let a=0;for(;a<n.length&&n[a]===0;)a++;n=n.slice(a)}return n},r.generateECPolynomial=function(e){let t=new Uint8Array([1]);for(let n=0;n<e;n++)t=r.mul(t,new Uint8Array([1,o.exp(n)]));return t}})(nt)),nt}var rt,Dt;function ge(){if(Dt)return rt;Dt=1;const r=de();function o(i){this.genPoly=void 0,this.degree=i,this.degree&&this.initialize(this.degree)}return o.prototype.initialize=function(e){this.degree=e,this.genPoly=r.generateECPolynomial(this.degree)},o.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const n=r.mod(t,this.genPoly),s=this.degree-n.length;if(s>0){const a=new Uint8Array(this.degree);return a.set(n,s),a}return n},rt=o,rt}var ot={},it={},st={},qt;function Wt(){return qt||(qt=1,st.isValid=function(o){return!isNaN(o)&&o>=1&&o<=40}),st}var L={},vt;function Zt(){if(vt)return L;vt=1;const r="[0-9]+",o="[A-Z $%*+\\-./:]+";let i="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";i=i.replace(/u/g,"\\u");const e="(?:(?![A-Z0-9 $%*+\\-./:]|"+i+`)(?:.|[\r
|
|
2
2
|
]))+`;L.KANJI=new RegExp(i,"g"),L.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),L.BYTE=new RegExp(e,"g"),L.NUMERIC=new RegExp(r,"g"),L.ALPHANUMERIC=new RegExp(o,"g");const t=new RegExp("^"+i+"$"),n=new RegExp("^"+r+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return L.testKanji=function(u){return t.test(u)},L.testNumeric=function(u){return n.test(u)},L.testAlphanumeric=function(u){return s.test(u)},L}var _t;function F(){return _t||(_t=1,(function(r){const o=Wt(),i=Zt();r.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},r.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},r.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},r.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},r.MIXED={bit:-1},r.getCharCountIndicator=function(n,s){if(!n.ccBits)throw new Error("Invalid mode: "+n);if(!o.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?n.ccBits[0]:s<27?n.ccBits[1]:n.ccBits[2]},r.getBestModeForData=function(n){return i.testNumeric(n)?r.NUMERIC:i.testAlphanumeric(n)?r.ALPHANUMERIC:i.testKanji(n)?r.KANJI:r.BYTE},r.toString=function(n){if(n&&n.id)return n.id;throw new Error("Invalid mode")},r.isValid=function(n){return n&&n.bit&&n.ccBits};function e(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return r.NUMERIC;case"alphanumeric":return r.ALPHANUMERIC;case"kanji":return r.KANJI;case"byte":return r.BYTE;default:throw new Error("Unknown mode: "+t)}}r.from=function(n,s){if(r.isValid(n))return n;try{return e(n)}catch{return s}}})(it)),it}var Ut;function he(){return Ut||(Ut=1,(function(r){const o=U(),i=$t(),e=yt(),t=F(),n=Wt(),s=7973,a=o.getBCHDigit(s);function u(h,f,N){for(let P=1;P<=40;P++)if(f<=r.getCapacity(P,N,h))return P}function c(h,f){return t.getCharCountIndicator(h,f)+4}function d(h,f){let N=0;return h.forEach(function(P){const S=c(P.mode,f);N+=S+P.getBitsLength()}),N}function p(h,f){for(let N=1;N<=40;N++)if(d(h,N)<=r.getCapacity(N,f,t.MIXED))return N}r.from=function(f,N){return n.isValid(f)?parseInt(f,10):N},r.getCapacity=function(f,N,P){if(!n.isValid(f))throw new Error("Invalid QR Code version");typeof P>"u"&&(P=t.BYTE);const S=o.getSymbolTotalCodewords(f),R=i.getTotalCodewordsCount(f,N),M=(S-R)*8;if(P===t.MIXED)return M;const T=M-c(P,f);switch(P){case t.NUMERIC:return Math.floor(T/10*3);case t.ALPHANUMERIC:return Math.floor(T/11*2);case t.KANJI:return Math.floor(T/13);case t.BYTE:default:return Math.floor(T/8)}},r.getBestVersionForData=function(f,N){let P;const S=e.from(N,e.M);if(Array.isArray(f)){if(f.length>1)return p(f,S);if(f.length===0)return 1;P=f[0]}else P=f;return u(P.mode,P.getLength(),S)},r.getEncodedBits=function(f){if(!n.isValid(f)||f<7)throw new Error("Invalid QR Code version");let N=f<<12;for(;o.getBCHDigit(N)-a>=0;)N^=s<<o.getBCHDigit(N)-a;return f<<12|N}})(ot)),ot}var ut={},Ft;function me(){if(Ft)return ut;Ft=1;const r=U(),o=1335,i=21522,e=r.getBCHDigit(o);return ut.getEncodedBits=function(n,s){const a=n.bit<<3|s;let u=a<<10;for(;r.getBCHDigit(u)-e>=0;)u^=o<<r.getBCHDigit(u)-e;return(a<<10|u)^i},ut}var at={},ct,kt;function we(){if(kt)return ct;kt=1;const r=F();function o(i){this.mode=r.NUMERIC,this.data=i.toString()}return o.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(e){let t,n,s;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),s=parseInt(n,10),e.put(s,10);const a=this.data.length-t;a>0&&(n=this.data.substr(t),s=parseInt(n,10),e.put(s,a*3+1))},ct=o,ct}var ft,zt;function ye(){if(zt)return ft;zt=1;const r=F(),o=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function i(e){this.mode=r.ALPHANUMERIC,this.data=e}return i.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){let n;for(n=0;n+2<=this.data.length;n+=2){let s=o.indexOf(this.data[n])*45;s+=o.indexOf(this.data[n+1]),t.put(s,11)}this.data.length%2&&t.put(o.indexOf(this.data[n]),6)},ft=i,ft}var lt,Vt;function Ce(){if(Vt)return lt;Vt=1;const r=F();function o(i){this.mode=r.BYTE,typeof i=="string"?this.data=new TextEncoder().encode(i):this.data=new Uint8Array(i)}return o.getBitsLength=function(e){return e*8},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(i){for(let e=0,t=this.data.length;e<t;e++)i.put(this.data[e],8)},lt=o,lt}var dt,Kt;function Ee(){if(Kt)return dt;Kt=1;const r=F(),o=U();function i(e){this.mode=r.KANJI,this.data=e}return i.getBitsLength=function(t){return t*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=o.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+`
|
|
3
3
|
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},dt=i,dt}var gt={exports:{}},Ht;function pe(){return Ht||(Ht=1,(function(r){var o={single_source_shortest_paths:function(i,e,t){var n={},s={};s[e]=0;var a=o.PriorityQueue.make();a.push(e,0);for(var u,c,d,p,h,f,N,P,S;!a.empty();){u=a.pop(),c=u.value,p=u.cost,h=i[c]||{};for(d in h)h.hasOwnProperty(d)&&(f=h[d],N=p+f,P=s[d],S=typeof s[d]>"u",(S||P>N)&&(s[d]=N,a.push(d,N),n[d]=c))}if(typeof t<"u"&&typeof s[t]>"u"){var R=["Could not find a path from ",e," to ",t,"."].join("");throw new Error(R)}return n},extract_shortest_path_from_predecessor_list:function(i,e){for(var t=[],n=e;n;)t.push(n),i[n],n=i[n];return t.reverse(),t},find_path:function(i,e,t){var n=o.single_source_shortest_paths(i,e,t);return o.extract_shortest_path_from_predecessor_list(n,t)},PriorityQueue:{make:function(i){var e=o.PriorityQueue,t={},n;i=i||{};for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t.queue=[],t.sorter=i.sorter||e.default_sorter,t},default_sorter:function(i,e){return i.cost-e.cost},push:function(i,e){var t={value:i,cost:e};this.queue.push(t),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};r.exports=o})(gt)),gt.exports}var Jt;function Be(){return Jt||(Jt=1,(function(r){const o=F(),i=we(),e=ye(),t=Ce(),n=Ee(),s=Zt(),a=U(),u=pe();function c(R){return unescape(encodeURIComponent(R)).length}function d(R,M,T){const B=[];let b;for(;(b=R.exec(T))!==null;)B.push({data:b[0],index:b.index,mode:M,length:b[0].length});return B}function p(R){const M=d(s.NUMERIC,o.NUMERIC,R),T=d(s.ALPHANUMERIC,o.ALPHANUMERIC,R);let B,b;return a.isKanjiModeEnabled()?(B=d(s.BYTE,o.BYTE,R),b=d(s.KANJI,o.KANJI,R)):(B=d(s.BYTE_KANJI,o.BYTE,R),b=[]),M.concat(T,B,b).sort(function(C,y){return C.index-y.index}).map(function(C){return{data:C.data,mode:C.mode,length:C.length}})}function h(R,M){switch(M){case o.NUMERIC:return i.getBitsLength(R);case o.ALPHANUMERIC:return e.getBitsLength(R);case o.KANJI:return n.getBitsLength(R);case o.BYTE:return t.getBitsLength(R)}}function f(R){return R.reduce(function(M,T){const B=M.length-1>=0?M[M.length-1]:null;return B&&B.mode===T.mode?(M[M.length-1].data+=T.data,M):(M.push(T),M)},[])}function N(R){const M=[];for(let T=0;T<R.length;T++){const B=R[T];switch(B.mode){case o.NUMERIC:M.push([B,{data:B.data,mode:o.ALPHANUMERIC,length:B.length},{data:B.data,mode:o.BYTE,length:B.length}]);break;case o.ALPHANUMERIC:M.push([B,{data:B.data,mode:o.BYTE,length:B.length}]);break;case o.KANJI:M.push([B,{data:B.data,mode:o.BYTE,length:c(B.data)}]);break;case o.BYTE:M.push([{data:B.data,mode:o.BYTE,length:c(B.data)}])}}return M}function P(R,M){const T={},B={start:{}};let b=["start"];for(let g=0;g<R.length;g++){const C=R[g],y=[];for(let l=0;l<C.length;l++){const A=C[l],m=""+g+l;y.push(m),T[m]={node:A,lastCount:0},B[m]={};for(let E=0;E<b.length;E++){const w=b[E];T[w]&&T[w].node.mode===A.mode?(B[w][m]=h(T[w].lastCount+A.length,A.mode)-h(T[w].lastCount,A.mode),T[w].lastCount+=A.length):(T[w]&&(T[w].lastCount=A.length),B[w][m]=h(A.length,A.mode)+4+o.getCharCountIndicator(A.mode,M))}}b=y}for(let g=0;g<b.length;g++)B[b[g]].end=0;return{map:B,table:T}}function S(R,M){let T;const B=o.getBestModeForData(R);if(T=o.from(M,B),T!==o.BYTE&&T.bit<B.bit)throw new Error('"'+R+'" cannot be encoded with mode '+o.toString(T)+`.
|
|
4
4
|
Suggested mode is: `+o.toString(B));switch(T===o.KANJI&&!a.isKanjiModeEnabled()&&(T=o.BYTE),T){case o.NUMERIC:return new i(R);case o.ALPHANUMERIC:return new e(R);case o.KANJI:return new n(R);case o.BYTE:return new t(R)}}r.fromArray=function(M){return M.reduce(function(T,B){return typeof B=="string"?T.push(S(B,null)):B.data&&T.push(S(B.data,B.mode)),T},[])},r.fromString=function(M,T){const B=p(M,a.isKanjiModeEnabled()),b=N(B),g=P(b,T),C=u.find_path(g.map,"start","end"),y=[];for(let l=1;l<C.length-1;l++)y.push(g.table[C[l]].node);return r.fromArray(f(y))},r.rawSplit=function(M){return r.fromArray(p(M,a.isKanjiModeEnabled()))}})(at)),at}var Ot;function Ae(){if(Ot)return $;Ot=1;const r=U(),o=yt(),i=se(),e=ue(),t=ae(),n=ce(),s=fe(),a=$t(),u=ge(),c=he(),d=me(),p=F(),h=Be();function f(g,C){const y=g.size,l=n.getPositions(C);for(let A=0;A<l.length;A++){const m=l[A][0],E=l[A][1];for(let w=-1;w<=7;w++)if(!(m+w<=-1||y<=m+w))for(let I=-1;I<=7;I++)E+I<=-1||y<=E+I||(w>=0&&w<=6&&(I===0||I===6)||I>=0&&I<=6&&(w===0||w===6)||w>=2&&w<=4&&I>=2&&I<=4?g.set(m+w,E+I,!0,!0):g.set(m+w,E+I,!1,!0))}}function N(g){const C=g.size;for(let y=8;y<C-8;y++){const l=y%2===0;g.set(y,6,l,!0),g.set(6,y,l,!0)}}function P(g,C){const y=t.getPositions(C);for(let l=0;l<y.length;l++){const A=y[l][0],m=y[l][1];for(let E=-2;E<=2;E++)for(let w=-2;w<=2;w++)E===-2||E===2||w===-2||w===2||E===0&&w===0?g.set(A+E,m+w,!0,!0):g.set(A+E,m+w,!1,!0)}}function S(g,C){const y=g.size,l=c.getEncodedBits(C);let A,m,E;for(let w=0;w<18;w++)A=Math.floor(w/3),m=w%3+y-8-3,E=(l>>w&1)===1,g.set(A,m,E,!0),g.set(m,A,E,!0)}function R(g,C,y){const l=g.size,A=d.getEncodedBits(C,y);let m,E;for(m=0;m<15;m++)E=(A>>m&1)===1,m<6?g.set(m,8,E,!0):m<8?g.set(m+1,8,E,!0):g.set(l-15+m,8,E,!0),m<8?g.set(8,l-m-1,E,!0):m<9?g.set(8,15-m-1+1,E,!0):g.set(8,15-m-1,E,!0);g.set(l-8,8,1,!0)}function M(g,C){const y=g.size;let l=-1,A=y-1,m=7,E=0;for(let w=y-1;w>0;w-=2)for(w===6&&w--;;){for(let I=0;I<2;I++)if(!g.isReserved(A,w-I)){let v=!1;E<C.length&&(v=(C[E]>>>m&1)===1),g.set(A,w-I,v),m--,m===-1&&(E++,m=7)}if(A+=l,A<0||y<=A){A-=l,l=-l;break}}}function T(g,C,y){const l=new i;y.forEach(function(I){l.put(I.mode.bit,4),l.put(I.getLength(),p.getCharCountIndicator(I.mode,g)),I.write(l)});const A=r.getSymbolTotalCodewords(g),m=a.getTotalCodewordsCount(g,C),E=(A-m)*8;for(l.getLengthInBits()+4<=E&&l.put(0,4);l.getLengthInBits()%8!==0;)l.putBit(0);const w=(E-l.getLengthInBits())/8;for(let I=0;I<w;I++)l.put(I%2?17:236,8);return B(l,g,C)}function B(g,C,y){const l=r.getSymbolTotalCodewords(C),A=a.getTotalCodewordsCount(C,y),m=l-A,E=a.getBlocksCount(C,y),w=l%E,I=E-w,v=Math.floor(l/E),V=Math.floor(m/E),te=V+1,Ct=v-V,ee=new u(Ct);let O=0;const H=new Array(E),Et=new Array(E);let j=0;const ne=new Uint8Array(g.buffer);for(let k=0;k<E;k++){const G=k<I?V:te;H[k]=ne.slice(O,O+G),Et[k]=ee.encode(H[k]),O+=G,j=Math.max(j,G)}const Y=new Uint8Array(l);let pt=0,D,q;for(D=0;D<j;D++)for(q=0;q<E;q++)D<H[q].length&&(Y[pt++]=H[q][D]);for(D=0;D<Ct;D++)for(q=0;q<E;q++)Y[pt++]=Et[q][D];return Y}function b(g,C,y,l){let A;if(Array.isArray(g))A=h.fromArray(g);else if(typeof g=="string"){let v=C;if(!v){const V=h.rawSplit(g);v=c.getBestVersionForData(V,y)}A=h.fromString(g,v||40)}else throw new Error("Invalid data");const m=c.getBestVersionForData(A,y);if(!m)throw new Error("The amount of data is too big to be stored in a QR Code");if(!C)C=m;else if(C<m)throw new Error(`
|