nextclaw 0.17.1 → 0.17.2
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/index.js +19 -26
- package/package.json +11 -11
- package/resources/USAGE.md +20 -20
- package/ui-dist/assets/{ChannelsList-BXuFNDBh.js → ChannelsList-DekMP4a3.js} +1 -1
- package/ui-dist/assets/{ChatPage-CEuFBJgC.js → ChatPage-Dgw4vlDt.js} +5 -5
- package/ui-dist/assets/DocBrowser-CExjX5is.js +1 -0
- package/ui-dist/assets/{DocBrowser-DxdSujSc.js → DocBrowser-DjcghYGO.js} +1 -1
- package/ui-dist/assets/{DocBrowserContext-CQ-8jMha.js → DocBrowserContext-CLlq7rZQ.js} +1 -1
- package/ui-dist/assets/{LogoBadge-D-KQIN4U.js → LogoBadge-D_dOy5U3.js} +1 -1
- package/ui-dist/assets/{MarketplacePage-CNeXwz7q.js → MarketplacePage-BlIeNn3x.js} +1 -1
- package/ui-dist/assets/MarketplacePage-DGfzg1LG.js +1 -0
- package/ui-dist/assets/{McpMarketplacePage-BGv2wwuk.js → McpMarketplacePage-mz2_IX1O.js} +1 -1
- package/ui-dist/assets/{ModelConfig-CoNm556G.js → ModelConfig-C_49_a9v.js} +1 -1
- package/ui-dist/assets/{ProvidersList-BXeGOw0M.js → ProvidersList-B0RCb_Vg.js} +1 -1
- package/ui-dist/assets/{RemoteAccessPage-vlBOKnMP.js → RemoteAccessPage-CcfQjLtx.js} +1 -1
- package/ui-dist/assets/RuntimeConfig-DBWzwoY-.js +1 -0
- package/ui-dist/assets/{SearchConfig-BK0dn4Zp.js → SearchConfig-jSdwlH4b.js} +1 -1
- package/ui-dist/assets/{SecretsConfig-Jduzy42Q.js → SecretsConfig-DbiS3txa.js} +1 -1
- package/ui-dist/assets/{SessionsConfig-CIwqHwvE.js → SessionsConfig-CbIOcAp8.js} +1 -1
- package/ui-dist/assets/{book-open-FnK2xCQd.js → book-open-BLxSL7Dk.js} +1 -1
- package/ui-dist/assets/{chat-session-display-BD_AN71I.js → chat-session-display-8yW6-mtm.js} +1 -1
- package/ui-dist/assets/{chunk-JZWAC4HX-B5l0hr_u.js → chunk-JZWAC4HX-Bp0t5xoO.js} +1 -1
- package/ui-dist/assets/{config-JKmXfZ3q.js → config-C96FWufn.js} +1 -1
- package/ui-dist/assets/{createLucideIcon-o1WWhwhd.js → createLucideIcon-B_U7Nq4F.js} +1 -1
- package/ui-dist/assets/{dist-DazA6Wd_.js → dist-BFY-GyT4.js} +1 -1
- package/ui-dist/assets/{dist-C_moWYv7.js → dist-D9pHzW9z.js} +1 -1
- package/ui-dist/assets/{external-link-BKje3SiD.js → external-link-BydIQTIH.js} +1 -1
- package/ui-dist/assets/{hash-DfW4DT8O.js → hash-Djdf0x1C.js} +1 -1
- package/ui-dist/assets/i18n-DAekxt_G.js +1 -0
- package/ui-dist/assets/index-CHEgQIiO.css +1 -0
- package/ui-dist/assets/{index-BuTtTFjM.js → index-DqSv8Azv.js} +3 -3
- package/ui-dist/assets/{label-BzDWmdOe.js → label-Bvv4Mrea.js} +1 -1
- package/ui-dist/assets/loader-circle-CGXXikVG.js +1 -0
- package/ui-dist/assets/{logos-CTLlde_T.js → logos-CGJJRI5_.js} +1 -1
- package/ui-dist/assets/{page-layout-BagR3t59.js → page-layout-6Nm4Cnvr.js} +1 -1
- package/ui-dist/assets/plus-CrW9BJDy.js +1 -0
- package/ui-dist/assets/{popover-5DWhNfd4.js → popover-b9rSYI6X.js} +1 -1
- package/ui-dist/assets/{provider-models-DJ29qHuA.js → provider-models-IJDA940D.js} +1 -1
- package/ui-dist/assets/{react-C3yu5yge.js → react-CDZz_StC.js} +1 -1
- package/ui-dist/assets/{refresh-ccw-BAJf-h7w.js → refresh-ccw-BvSSnnCw.js} +1 -1
- package/ui-dist/assets/{save-aa6z4GJL.js → save-CAf0_-b9.js} +1 -1
- package/ui-dist/assets/search-DgoXxocn.js +1 -0
- package/ui-dist/assets/{security-config-BrmOzvpp.js → security-config-DF66-l25.js} +1 -1
- package/ui-dist/assets/{select-BHJPiJWt.js → select-CEIMqc0H.js} +1 -1
- package/ui-dist/assets/skeleton-BiPUQkOD.js +1 -0
- package/ui-dist/assets/{status-dot-DUwsTIdv.js → status-dot-CmQI5Qq2.js} +1 -1
- package/ui-dist/assets/{switch-B6nCfcOB.js → switch-B7SxDXyR.js} +1 -1
- package/ui-dist/assets/{tabs-custom-B57SMElx.js → tabs-custom-Dxt6EJJW.js} +1 -1
- package/ui-dist/assets/{trash-2-CrjYH5ok.js → trash-2-BnQ1PDTw.js} +1 -1
- package/ui-dist/assets/{useConfirmDialog-RlLbo0NU.js → useConfirmDialog-B-vMOmhG.js} +1 -1
- package/ui-dist/assets/{useMutation-oTTWXgLG.js → useMutation-Bi39Z9_J.js} +1 -1
- package/ui-dist/assets/x-PBSiWt3l.js +1 -0
- package/ui-dist/index.html +18 -18
- package/ui-dist/assets/DocBrowser-C8b2uPgL.js +0 -1
- package/ui-dist/assets/MarketplacePage-BGPF2sDu.js +0 -1
- package/ui-dist/assets/RuntimeConfig-CEkrhzg7.js +0 -1
- package/ui-dist/assets/i18n-BK1w-oBy.js +0 -1
- package/ui-dist/assets/index-DaR9igPC.css +0 -1
- package/ui-dist/assets/loader-circle-DdZPxBUz.js +0 -1
- package/ui-dist/assets/plus-DP2PSCPO.js +0 -1
- package/ui-dist/assets/search-pD6ZwQYF.js +0 -1
- package/ui-dist/assets/skeleton-D6kCk9Y6.js +0 -1
- package/ui-dist/assets/x-CTIQHUuD.js +0 -1
package/dist/cli/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import * as NextclawCore from "@nextclaw/core";
|
|
4
|
-
import { APP_NAME, APP_TAGLINE, AgentLoop, AgentRouteResolver, BUILTIN_MAIN_AGENT_ID, ChannelManager, CommandRegistry, ConfigSchema, ContextBuilder, CronService, CronTool, DEFAULT_WORKSPACE_DIR, DEFAULT_WORKSPACE_PATH, DisposableStore, EditFileTool, ExecTool, ExtensionToolAdapter, GatewayTool, InputBudgetPruner, LLMProvider, ListDirTool, MemoryGetTool, MemorySearchTool, MessageBus, MessageTool, NativeAgentEngine, ProviderManager, ReadFileTool, SessionsHistoryTool, SessionsListTool,
|
|
4
|
+
import { APP_NAME, APP_TAGLINE, AgentLoop, AgentRouteResolver, BUILTIN_MAIN_AGENT_ID, ChannelManager, CommandRegistry, ConfigSchema, ContextBuilder, CronService, CronTool, DEFAULT_WORKSPACE_DIR, DEFAULT_WORKSPACE_PATH, DisposableStore, EditFileTool, ExecTool, ExtensionToolAdapter, GatewayTool, InputBudgetPruner, LLMProvider, ListDirTool, MemoryGetTool, MemorySearchTool, MessageBus, MessageTool, NativeAgentEngine, ProviderManager, ReadFileTool, SessionsHistoryTool, SessionsListTool, SkillsLoader, Tool, ToolRegistry, WebFetchTool, WebSearchTool, WriteFileTool, buildConfigSchema, buildReloadPlan, buildToolCatalogEntries, createAgentProfile, createAssistantStreamDeltaControlMessage, createAssistantStreamResetControlMessage, createExternalCommandEnv, diffConfigPaths, expandHome, findEffectiveAgentProfile, getConfigPath, getDataDir, getPackageVersion, getWorkspacePath, hasSecretRef, loadConfig, normalizeInlineSecretRefs, parseAgentScopedSessionKey, parseThinkingLevel, readSessionProjectRoot, redactConfigObject, removeAgentProfile, resolveConfigSecrets, resolveDefaultAgentProfileId, resolveEffectiveAgentProfiles, resolveSessionWorkspacePath, resolveThinkingLevel, saveConfig, toDisposable, updateAgentProfile } from "@nextclaw/core";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import { RemoteConnector, RemotePlatformClient, RemoteRuntimeActions, RemoteServiceModule, RemoteStatusStore, buildConfiguredRemoteState, readPlatformSessionTokenState, registerRemoteCommands, resolveRemoteStatusSnapshot } from "@nextclaw/remote";
|
|
7
7
|
import { addPluginLoadPath, buildPluginStatusReport, disablePluginInConfig, discoverPluginStatusReport, enablePluginInConfig, getPluginChannelBindings, getPluginUiMetadataFromRegistry, installPluginFromNpmSpec, installPluginFromPath, loadOpenClawPlugins, loadOpenClawPluginsProgressively, mergePluginConfigView, recordPluginInstall, resolvePluginChannelMessageToolHints, resolveUninstallDirectoryTargets, setPluginRuntimeBridge, startPluginChannelGateways, stopPluginChannelGateways, toPluginConfigView, toPluginConfigView as toPluginConfigView$1, uninstallPlugin } from "@nextclaw/openclaw-compat";
|
|
@@ -983,7 +983,6 @@ const RESERVED_TOOL_NAMES = [
|
|
|
983
983
|
"spawn",
|
|
984
984
|
"sessions_list",
|
|
985
985
|
"sessions_history",
|
|
986
|
-
"sessions_send",
|
|
987
986
|
"memory_search",
|
|
988
987
|
"memory_get",
|
|
989
988
|
"subagents",
|
|
@@ -4981,7 +4980,7 @@ var SpawnChildSessionTool = class extends Tool {
|
|
|
4981
4980
|
return "spawn";
|
|
4982
4981
|
}
|
|
4983
4982
|
get description() {
|
|
4984
|
-
return "Create a child session,
|
|
4983
|
+
return "Create a child session, start the delegated task in the background, return a running child-session handle immediately, and automatically continue this session with the child's final reply when it finishes.";
|
|
4985
4984
|
}
|
|
4986
4985
|
get parameters() {
|
|
4987
4986
|
return {
|
|
@@ -4989,19 +4988,19 @@ var SpawnChildSessionTool = class extends Tool {
|
|
|
4989
4988
|
properties: {
|
|
4990
4989
|
task: {
|
|
4991
4990
|
type: "string",
|
|
4992
|
-
description: "Task to
|
|
4991
|
+
description: "Task to start immediately inside the child session."
|
|
4993
4992
|
},
|
|
4994
4993
|
label: {
|
|
4995
4994
|
type: "string",
|
|
4996
|
-
description: "Optional child session title."
|
|
4995
|
+
description: "Optional child session title shown in the session list and tool card."
|
|
4997
4996
|
},
|
|
4998
4997
|
model: {
|
|
4999
4998
|
type: "string",
|
|
5000
|
-
description: "Optional model override for the child session."
|
|
4999
|
+
description: "Optional model override used only for the child session."
|
|
5001
5000
|
},
|
|
5002
5001
|
agentId: {
|
|
5003
5002
|
type: "string",
|
|
5004
|
-
description: "Optional target agent id for the child session. Omit to use the default agent."
|
|
5003
|
+
description: "Optional target agent id for the child session. Omit to use the default agent for that child."
|
|
5005
5004
|
}
|
|
5006
5005
|
},
|
|
5007
5006
|
required: ["task"]
|
|
@@ -5298,16 +5297,6 @@ var NextclawNcpToolRegistry = class {
|
|
|
5298
5297
|
this.registerTool(sessionsRequestTool);
|
|
5299
5298
|
this.registerTool(new SessionsListTool(this.options.sessionManager));
|
|
5300
5299
|
this.registerTool(new SessionsHistoryTool(this.options.sessionManager));
|
|
5301
|
-
const sessionsSendTool = new SessionsSendTool(this.options.sessionManager, this.options.bus);
|
|
5302
|
-
sessionsSendTool.setContext({
|
|
5303
|
-
currentSessionKey: context.sessionId,
|
|
5304
|
-
currentAgentId: context.agentId,
|
|
5305
|
-
channel: context.channel,
|
|
5306
|
-
chatId: context.chatId,
|
|
5307
|
-
maxPingPongTurns: context.config.session?.agentToAgent?.maxPingPongTurns ?? 0,
|
|
5308
|
-
currentHandoffDepth: context.handoffDepth
|
|
5309
|
-
});
|
|
5310
|
-
this.registerTool(sessionsSendTool);
|
|
5311
5300
|
this.registerTool(new MemorySearchTool(context.workspace));
|
|
5312
5301
|
this.registerTool(new MemoryGetTool(context.workspace));
|
|
5313
5302
|
const gatewayTool = new GatewayTool(this.options.gatewayController);
|
|
@@ -5440,14 +5429,15 @@ function prependRequestedSkills(content, requestedSkillNames) {
|
|
|
5440
5429
|
function buildSessionOrchestrationSection() {
|
|
5441
5430
|
return [
|
|
5442
5431
|
"## Session Orchestration",
|
|
5443
|
-
"- `spawn` creates a child session
|
|
5444
|
-
"-
|
|
5432
|
+
"- `spawn` creates a child session, starts the delegated task there immediately, and returns a running child-session handle right away instead of waiting for the child to finish.",
|
|
5433
|
+
"- When that child reaches its final reply, `spawn` writes the completed result back into the original tool call and resumes the current session with the child's result.",
|
|
5434
|
+
"- Use `spawn` when the work is a subtask of the current flow and the user expects this session to pause now and then continue after that child finishes.",
|
|
5445
5435
|
"- `sessions_spawn` creates a standalone session. Use it when the work should live in its own thread, remain independently reviewable later, or continue outside the current flow.",
|
|
5446
5436
|
"- `sessions_request` sends one task to another session. Use it to reuse an existing session, or immediately after `sessions_spawn` when a new standalone session should start working right away.",
|
|
5447
5437
|
"- If the goal is 'open a new session and have it do something now', the usual sequence is: 1) call `sessions_spawn`; 2) call `sessions_request` with that returned `sessionId`.",
|
|
5448
5438
|
"- `sessions_request.target` must be an object shaped like `{ \"session_id\": \"<target-session-id>\" }`. Do not pass a bare string.",
|
|
5449
5439
|
"- Prefer `delivery=\"resume_source\"` when the current session should continue after the target session produces its final reply. Use `delivery=\"none\"` when you only want the target session to run independently.",
|
|
5450
|
-
"- Do not use `spawn` for long-lived independent threads
|
|
5440
|
+
"- Do not use `spawn` for long-lived independent threads, fire-and-forget work, or work that should not automatically resume the current session; in those cases use `sessions_spawn` plus `sessions_request` instead."
|
|
5451
5441
|
].join("\n");
|
|
5452
5442
|
}
|
|
5453
5443
|
function filterTools(toolDefinitions, requestedToolNames) {
|
|
@@ -6490,10 +6480,6 @@ var SessionRequestDeliveryService = class {
|
|
|
6490
6480
|
if (!params.request.sourceToolCallId?.trim()) return;
|
|
6491
6481
|
const backend = this.resolveBackend();
|
|
6492
6482
|
if (!backend) throw new Error("NCP backend is not ready for session request delivery.");
|
|
6493
|
-
if (!await waitForSessionToBecomeIdle({
|
|
6494
|
-
backend,
|
|
6495
|
-
sessionId: params.request.sourceSessionId
|
|
6496
|
-
})) return;
|
|
6497
6483
|
await backend.updateToolCallResult(params.request.sourceSessionId, params.request.sourceToolCallId.trim(), params.result);
|
|
6498
6484
|
};
|
|
6499
6485
|
resumeSourceSession = async (params) => {
|
|
@@ -6502,7 +6488,10 @@ var SessionRequestDeliveryService = class {
|
|
|
6502
6488
|
if (!await waitForSessionToBecomeIdle({
|
|
6503
6489
|
backend,
|
|
6504
6490
|
sessionId: params.request.sourceSessionId
|
|
6505
|
-
}))
|
|
6491
|
+
})) {
|
|
6492
|
+
console.warn(`[session-request] resume skipped for ${params.request.sourceSessionId} because the source session did not become idle in time.`);
|
|
6493
|
+
return;
|
|
6494
|
+
}
|
|
6506
6495
|
scheduleDetached(async () => consumeAgentRun(backend.send({
|
|
6507
6496
|
sessionId: params.request.sourceSessionId,
|
|
6508
6497
|
message: buildSessionRequestCompletionMessage(params)
|
|
@@ -7688,8 +7677,12 @@ function createGatewayShellContext(params) {
|
|
|
7688
7677
|
const runtimeConfigPath = getConfigPath$2();
|
|
7689
7678
|
const config = resolveConfigSecrets$3(loadConfig$3(), { configPath: runtimeConfigPath });
|
|
7690
7679
|
const workspace = getWorkspacePath$2(config.agents.defaults.workspace);
|
|
7680
|
+
const homeDir = getDataDir$1();
|
|
7691
7681
|
const cronStorePath = join(getDataDir$1(), "cron", "jobs.json");
|
|
7692
|
-
const sessionManager = measureStartupSync("service.gateway_shell_context.session_manager", () => new SessionManager$1(
|
|
7682
|
+
const sessionManager = measureStartupSync("service.gateway_shell_context.session_manager", () => new SessionManager$1({
|
|
7683
|
+
workspace,
|
|
7684
|
+
homeDir
|
|
7685
|
+
}));
|
|
7693
7686
|
const cron = new CronService$1(cronStorePath);
|
|
7694
7687
|
const uiConfig = resolveUiConfig(config, params.uiOverrides);
|
|
7695
7688
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nextclaw",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.2",
|
|
4
4
|
"description": "Lightweight personal AI assistant with CLI, multi-provider routing, and channel integrations.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -40,16 +40,16 @@
|
|
|
40
40
|
"chokidar": "^3.6.0",
|
|
41
41
|
"commander": "^12.1.0",
|
|
42
42
|
"yaml": "^2.8.1",
|
|
43
|
-
"@nextclaw/core": "0.12.0",
|
|
44
|
-
"@nextclaw/ncp-agent-runtime": "0.3.7",
|
|
45
43
|
"@nextclaw/ncp": "0.5.0",
|
|
46
|
-
"@nextclaw/
|
|
47
|
-
"@nextclaw/ncp-mcp": "0.1.
|
|
48
|
-
"@nextclaw/
|
|
49
|
-
"@nextclaw/
|
|
50
|
-
"@nextclaw/
|
|
51
|
-
"@nextclaw/
|
|
52
|
-
"@nextclaw/remote": "0.1.
|
|
44
|
+
"@nextclaw/ncp-agent-runtime": "0.3.7",
|
|
45
|
+
"@nextclaw/ncp-mcp": "0.1.68",
|
|
46
|
+
"@nextclaw/ncp-toolkit": "0.5.1",
|
|
47
|
+
"@nextclaw/openclaw-compat": "1.0.1",
|
|
48
|
+
"@nextclaw/mcp": "0.1.66",
|
|
49
|
+
"@nextclaw/runtime": "0.2.33",
|
|
50
|
+
"@nextclaw/remote": "0.1.78",
|
|
51
|
+
"@nextclaw/core": "0.12.1",
|
|
52
|
+
"@nextclaw/server": "0.12.1"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/node": "^20.17.6",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"tsx": "^4.19.2",
|
|
58
58
|
"typescript": "^5.6.3",
|
|
59
59
|
"vitest": "^4.1.2",
|
|
60
|
-
"@nextclaw/ui": "0.12.
|
|
60
|
+
"@nextclaw/ui": "0.12.1"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"dev": "tsx watch --tsconfig tsconfig.json src/cli/index.ts",
|
package/resources/USAGE.md
CHANGED
|
@@ -211,7 +211,6 @@ Use one of these two entry points instead:
|
|
|
211
211
|
|
|
212
212
|
- `bindings`: route inbound messages by `channel + accountId (+peer)` to a target `agentId`
|
|
213
213
|
- `session.dmScope`: DM isolation strategy (`main` / `per-peer` / `per-channel-peer` / `per-account-channel-peer`)
|
|
214
|
-
- `session.agentToAgent.maxPingPongTurns`: cap cross-agent ping-pong loops (`0` means block auto ping-pong)
|
|
215
214
|
|
|
216
215
|
> ⚠️ **Strict enum guard (OpenClaw-aligned):** `session.dmScope` accepts **only** these 4 values: `main`, `per-peer`, `per-channel-peer`, `per-account-channel-peer`.
|
|
217
216
|
> Any other value (for example `per-account-channel-peer-agent`) is invalid and must not be written.
|
|
@@ -233,8 +232,7 @@ Example:
|
|
|
233
232
|
}
|
|
234
233
|
],
|
|
235
234
|
"session": {
|
|
236
|
-
"dmScope": "per-account-channel-peer"
|
|
237
|
-
"agentToAgent": { "maxPingPongTurns": 0 }
|
|
235
|
+
"dmScope": "per-account-channel-peer"
|
|
238
236
|
}
|
|
239
237
|
}
|
|
240
238
|
```
|
|
@@ -245,7 +243,6 @@ CLI equivalents:
|
|
|
245
243
|
nextclaw agents new engineer --json
|
|
246
244
|
nextclaw config set bindings '[{"agentId":"engineer","match":{"channel":"discord","accountId":"zongzhihui"}}]' --json
|
|
247
245
|
nextclaw config set session.dmScope '"per-account-channel-peer"' --json
|
|
248
|
-
nextclaw config set session.agentToAgent.maxPingPongTurns 0 --json
|
|
249
246
|
```
|
|
250
247
|
|
|
251
248
|
### Multi-agent collaboration playbook (recommended)
|
|
@@ -256,7 +253,6 @@ Use this baseline for predictable team-style collaboration:
|
|
|
256
253
|
2. Create specialist agents through the `Agents` page or `nextclaw agents new` (for example `engineer`, `ops`, `support`).
|
|
257
254
|
3. Route stable traffic classes with `bindings` (channel/account/peer based).
|
|
258
255
|
4. Use `session.dmScope="per-account-channel-peer"` for multi-account + multi-channel isolation.
|
|
259
|
-
5. Set `session.agentToAgent.maxPingPongTurns=0` first, then increase only when you explicitly want cross-agent relay.
|
|
260
256
|
|
|
261
257
|
Suggested role split:
|
|
262
258
|
|
|
@@ -330,7 +326,6 @@ nextclaw config set channels.discord.groupAllowFrom '["dev-room"]' --json
|
|
|
330
326
|
2. Add at least one binding and verify inbound messages hit the expected role.
|
|
331
327
|
3. Verify DM isolation across user/channel/account boundaries under the selected `dmScope`.
|
|
332
328
|
4. If Discord/Telegram group collaboration is enabled, verify mention gating (`requireMention` / `mentionPatterns`) behavior.
|
|
333
|
-
5. Verify auto ping-pong policy with `session.agentToAgent.maxPingPongTurns` (set `0` to block).
|
|
334
329
|
|
|
335
330
|
Pass criteria: stable routing, no cross-session context leakage, predictable group triggering, explainable fallback behavior.
|
|
336
331
|
|
|
@@ -521,9 +516,9 @@ Agent management notes:
|
|
|
521
516
|
- If `--avatar` is omitted, NextClaw generates a local default `avatar.svg`.
|
|
522
517
|
- `nextclaw agents new/update/remove --json` returns machine-readable output plus `restartRequired: true`.
|
|
523
518
|
|
|
524
|
-
### Agent
|
|
519
|
+
### Agent CRUD flow for AI self-management
|
|
525
520
|
|
|
526
|
-
When NextClaw AI is asked to create
|
|
521
|
+
When NextClaw AI is asked to create, update, or remove an Agent, use this exact flow instead of inventing config edits:
|
|
527
522
|
|
|
528
523
|
1. Inspect current agents when needed:
|
|
529
524
|
|
|
@@ -531,14 +526,16 @@ When NextClaw AI is asked to create a new Agent, use this exact flow instead of
|
|
|
531
526
|
nextclaw agents list --json
|
|
532
527
|
```
|
|
533
528
|
|
|
534
|
-
2.
|
|
529
|
+
2. Execute the dedicated command instead of editing config directly:
|
|
535
530
|
|
|
536
531
|
```bash
|
|
537
532
|
nextclaw agents new <agent-id> --json [--name <display-name>] [--description <description>] [--avatar <url-or-local-file>] [--home <path>]
|
|
533
|
+
nextclaw agents update <agent-id> --json [--name <display-name>] [--description <description>] [--avatar <url-or-local-file>]
|
|
534
|
+
nextclaw agents remove <agent-id> --json
|
|
538
535
|
```
|
|
539
536
|
|
|
540
537
|
3. Treat the JSON output as the source of truth:
|
|
541
|
-
- `agent`: created Agent profile
|
|
538
|
+
- `agent`: created or updated Agent profile
|
|
542
539
|
- `restartRequired: true`: runtime changes still need a restart to apply
|
|
543
540
|
|
|
544
541
|
4. If the service is currently running, restart explicitly after creation:
|
|
@@ -556,23 +553,26 @@ When NextClaw AI is asked to create a new Agent, use this exact flow instead of
|
|
|
556
553
|
|
|
557
554
|
Rules:
|
|
558
555
|
|
|
559
|
-
- Do not try to create the built-in `main` agent.
|
|
560
|
-
-
|
|
561
|
-
-
|
|
562
|
-
-
|
|
556
|
+
- Do not try to create or remove the built-in `main` agent. `nextclaw agents update main` is allowed.
|
|
557
|
+
- For normal Agent management, prefer `nextclaw agents list|new|update|remove --json` over direct `config.json` or `agents.list` edits.
|
|
558
|
+
- Direct `config.json` / `agents.list` edits are recovery-only: use them only for explicit operator-led disaster recovery, or when a documented CLI path still cannot express the requested change.
|
|
559
|
+
- Humans should use the `Agents` page or the CLI for Agent identities. `Routing & Runtime` is not the identity-management entry point.
|
|
560
|
+
- If the user asked AI to perform Agent CRUD, AI should run the command, not only describe it.
|
|
563
561
|
- Avatar guidance for AI-created agents:
|
|
564
|
-
-
|
|
565
|
-
-
|
|
566
|
-
-
|
|
562
|
+
- When AI creates an Agent, prefer passing an explicit `--avatar` instead of relying on the generated fallback.
|
|
563
|
+
- Prefer non-text avatars for long-lived Agent identities; avoid letter-based or initials-based avatar styles as the default recommendation.
|
|
564
|
+
- DiceBear `initials` is a text-based avatar style and should not be the default recommendation for Agents.
|
|
565
|
+
- If you use DiceBear or a similar deterministic service, prefer a non-text style with a stable seed derived from `agent-id` (or display name) so repeated creation yields a predictable identity.
|
|
567
566
|
- Concrete example:
|
|
568
567
|
|
|
569
568
|
```bash
|
|
570
|
-
nextclaw agents new researcher --json --name "Researcher" --avatar "https://api.dicebear.com/9.x/
|
|
569
|
+
nextclaw agents new researcher --json --name "Researcher" --avatar "https://api.dicebear.com/9.x/identicon/svg?seed=researcher"
|
|
571
570
|
```
|
|
572
571
|
|
|
573
572
|
- If you want a different stable avatar, keep the same URL pattern but replace the seed with the final `agent-id` or display name.
|
|
574
|
-
- Example providers may change over time; treat DiceBear as
|
|
575
|
-
- If the user prefers local-only assets, offline behavior, or does not want third-party avatar URLs,
|
|
573
|
+
- Example providers may change over time; treat DiceBear as a replaceable suggestion rather than a built-in product dependency or a hardcoded runtime rule.
|
|
574
|
+
- If the user prefers local-only assets, offline behavior, or does not want third-party avatar URLs, prefer passing a local image file path with `--avatar`.
|
|
575
|
+
- Omit `--avatar` only as a last-resort fallback. The generated local `avatar.svg` is acceptable as a fallback, but it is not the preferred default for AI-created Agents.
|
|
576
576
|
|
|
577
577
|
Gateway options (when running `nextclaw gateway` or `nextclaw start`):
|
|
578
578
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e,h as t,i as n,m as r,n as i,o as a,p as o,u as s}from"./i18n-BK1w-oBy.js";import{n as c,o as l,r as u,u as d}from"./dist-DazA6Wd_.js";import{t as f}from"./useMutation-oTTWXgLG.js";import{O as p,a as m,i as h,n as g,r as _,t as v}from"./select-BHJPiJWt.js";import{t as y}from"./createLucideIcon-o1WWhwhd.js";import{t as b}from"./book-open-FnK2xCQd.js";import{t as x}from"./external-link-BKje3SiD.js";import{n as S,t as C}from"./logos-CTLlde_T.js";import{t as w}from"./hash-DfW4DT8O.js";import{t as T}from"./loader-circle-DdZPxBUz.js";import{t as E}from"./search-pD6ZwQYF.js";import{t as D}from"./x-CTIQHUuD.js";import{E as ee,W as O,c as k,dt as A,g as te,l as j,lt as M,mt as ne,u as N}from"./index-BuTtTFjM.js";import{t as P}from"./LogoBadge-D-KQIN4U.js";import{t as F}from"./label-BzDWmdOe.js";import{n as I,t as L}from"./page-layout-BagR3t59.js";import{t as re}from"./tabs-custom-B57SMElx.js";import{t as R}from"./status-dot-DUwsTIdv.js";import{t as z}from"./config-hints-WtpHP_DW.js";import{i as ie,n as ae,r as oe,t as se}from"./config-layout-LQ10ozRC.js";import{t as ce}from"./switch-B6nCfcOB.js";var le=y(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),ue=y(`MessageCircleMore`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),de=y(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),fe=y(`ToggleLeft`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`6`,ry:`6`,key:`f2vt7d`}],[`circle`,{cx:`8`,cy:`12`,r:`2`,key:`1nvbw3`}]]),B=e(r(),1);function V(e){let t=a();return e.tutorialUrls?.[t]||e.tutorialUrls?.default||e.tutorialUrl}var H=o();function pe({value:e,onChange:t,className:r,placeholder:i=``}){let[a,o]=(0,B.useState)(``),c=n=>{n.key===`Enter`&&a.trim()?(n.preventDefault(),t([...e,a.trim()]),o(``)):n.key===`Backspace`&&!a&&e.length>0&&t(e.slice(0,-1))},l=n=>{t(e.filter((e,t)=>t!==n))};return(0,H.jsxs)(`div`,{className:s(`flex flex-wrap gap-2 p-2 border rounded-md min-h-[42px]`,r),children:[e.map((e,t)=>(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 bg-primary text-primary-foreground rounded text-sm`,children:[e,(0,H.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`hover:text-red-300 transition-colors`,children:(0,H.jsx)(D,{className:`h-3 w-3`})})]},t)),(0,H.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),onKeyDown:c,className:`flex-1 outline-none min-w-[100px] bg-transparent text-sm`,placeholder:i||n(`enterTag`)})]})}function me(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,H.jsx)(ne,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,H.jsx)(S,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,H.jsx)(le,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,H.jsx)(w,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,H.jsx)(fe,{className:`h-3.5 w-3.5 text-gray-500`}):(0,H.jsx)(M,{className:`h-3.5 w-3.5 text-gray-500`})}function U({channelName:e,fields:t,formData:r,jsonDrafts:i,setJsonDrafts:a,updateField:o,uiHints:s}){return(0,H.jsx)(H.Fragment,{children:t.map(t=>{let c=z(`channels.${e}.${t.name}`,s),l=c?.label??t.label,u=c?.placeholder;return(0,H.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,H.jsxs)(F,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[me(t.name),l]}),t.type===`boolean`&&(0,H.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,H.jsx)(`span`,{className:`text-sm text-gray-500`,children:r[t.name]?n(`enabled`):n(`disabled`)}),(0,H.jsx)(ce,{id:t.name,checked:r[t.name]||!1,onCheckedChange:e=>o(t.name,e),className:`data-[state=checked]:bg-emerald-500`})]}),(t.type===`text`||t.type===`email`)&&(0,H.jsx)(O,{id:t.name,type:t.type,value:r[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u,className:`rounded-xl`}),t.type===`password`&&(0,H.jsx)(O,{id:t.name,type:`password`,value:r[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u??n(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,H.jsx)(O,{id:t.name,type:`number`,value:r[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:u,className:`rounded-xl`}),t.type===`tags`&&(0,H.jsx)(pe,{value:r[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,H.jsxs)(v,{value:r[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,H.jsx)(h,{className:`rounded-xl`,children:(0,H.jsx)(m,{})}),(0,H.jsx)(g,{children:(t.options??[]).map(e=>(0,H.jsx)(_,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,H.jsx)(`textarea`,{id:t.name,value:i[t.name]??`{}`,onChange:e=>a(n=>({...n,[t.name]:e.target.value})),className:`min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono`})]},t.name)})})}var W=[{value:`pairing`,label:`pairing`},{value:`allowlist`,label:`allowlist`},{value:`open`,label:`open`},{value:`disabled`,label:`disabled`}],G=[{value:`open`,label:`open`},{value:`allowlist`,label:`allowlist`},{value:`disabled`,label:`disabled`}],he=[{value:`off`,label:`off`},{value:`partial`,label:`partial`},{value:`block`,label:`block`},{value:`progress`,label:`progress`}];function ge(){return{telegram:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`token`,type:`password`,label:n(`botToken`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)},{name:`proxy`,type:`text`,label:n(`proxy`)},{name:`accountId`,type:`text`,label:n(`accountId`)},{name:`dmPolicy`,type:`select`,label:n(`dmPolicy`),options:W},{name:`groupPolicy`,type:`select`,label:n(`groupPolicy`),options:G},{name:`groupAllowFrom`,type:`tags`,label:n(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:n(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:n(`mentionPatterns`)},{name:`groups`,type:`json`,label:n(`groupRulesJson`)}]},discord:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`token`,type:`password`,label:n(`botToken`)},{name:`allowBots`,type:`boolean`,label:n(`allowBotMessages`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)},{name:`gatewayUrl`,type:`text`,label:n(`gatewayUrl`)},{name:`intents`,type:`number`,label:n(`intents`)},{name:`proxy`,type:`text`,label:n(`proxy`)},{name:`mediaMaxMb`,type:`number`,label:n(`attachmentMaxSizeMb`)},{name:`streaming`,type:`select`,label:n(`streamingMode`),options:he},{name:`draftChunk`,type:`json`,label:n(`draftChunkingJson`)},{name:`textChunkLimit`,type:`number`,label:n(`textChunkLimit`)},{name:`accountId`,type:`text`,label:n(`accountId`)},{name:`dmPolicy`,type:`select`,label:n(`dmPolicy`),options:W},{name:`groupPolicy`,type:`select`,label:n(`groupPolicy`),options:G},{name:`groupAllowFrom`,type:`tags`,label:n(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:n(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:n(`mentionPatterns`)},{name:`groups`,type:`json`,label:n(`groupRulesJson`)}]},whatsapp:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`bridgeUrl`,type:`text`,label:n(`bridgeUrl`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]},feishu:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`appId`,type:`text`,label:n(`appId`)},{name:`appSecret`,type:`password`,label:n(`appSecret`)},{name:`encryptKey`,type:`password`,label:n(`encryptKey`)},{name:`verificationToken`,type:`password`,label:n(`verificationToken`)},{name:`domain`,type:`text`,label:`Domain`},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)},{name:`dmPolicy`,type:`select`,label:n(`dmPolicy`),options:W},{name:`groupPolicy`,type:`select`,label:n(`groupPolicy`),options:G},{name:`groupAllowFrom`,type:`tags`,label:n(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:n(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:n(`mentionPatterns`)},{name:`groups`,type:`json`,label:n(`groupRulesJson`)},{name:`accounts`,type:`json`,label:n(`accountsJson`)}]},dingtalk:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`clientId`,type:`text`,label:n(`clientId`)},{name:`clientSecret`,type:`password`,label:n(`clientSecret`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]},wecom:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`corpId`,type:`text`,label:n(`corpId`)},{name:`agentId`,type:`text`,label:n(`agentId`)},{name:`secret`,type:`password`,label:n(`secret`)},{name:`token`,type:`password`,label:n(`token`)},{name:`callbackPort`,type:`number`,label:n(`callbackPort`)},{name:`callbackPath`,type:`text`,label:n(`callbackPath`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]},weixin:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`),section:`primary`},{name:`defaultAccountId`,type:`text`,label:n(`defaultAccountId`)},{name:`baseUrl`,type:`text`,label:n(`baseUrl`)},{name:`pollTimeoutMs`,type:`number`,label:n(`pollTimeoutMs`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)},{name:`accounts`,type:`json`,label:n(`accountsJson`)}],layout:[{type:`fields`,section:`primary`},{type:`custom`,sectionId:`weixin-auth`},{type:`fields`,section:`advanced`,collapsible:{title:n(`weixinAuthAdvancedTitle`),description:n(`weixinAuthAdvancedDescription`)}}]},slack:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`mode`,type:`text`,label:n(`mode`)},{name:`webhookPath`,type:`text`,label:n(`webhookPath`)},{name:`allowBots`,type:`boolean`,label:n(`allowBotMessages`)},{name:`botToken`,type:`password`,label:n(`botToken`)},{name:`appToken`,type:`password`,label:n(`appToken`)}]},email:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`consentGranted`,type:`boolean`,label:n(`consentGranted`)},{name:`imapHost`,type:`text`,label:n(`imapHost`)},{name:`imapPort`,type:`number`,label:n(`imapPort`)},{name:`imapUsername`,type:`text`,label:n(`imapUsername`)},{name:`imapPassword`,type:`password`,label:n(`imapPassword`)},{name:`fromAddress`,type:`email`,label:n(`fromAddress`)}]},mochat:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`baseUrl`,type:`text`,label:n(`baseUrl`)},{name:`clawToken`,type:`password`,label:n(`clawToken`)},{name:`agentUserId`,type:`text`,label:n(`agentUserId`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]},qq:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`appId`,type:`text`,label:n(`appId`)},{name:`secret`,type:`password`,label:n(`appSecret`)},{name:`markdownSupport`,type:`boolean`,label:n(`markdownSupport`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]}}}var _e=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),K=t((e=>{var t,n=[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];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),q=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),ve=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),ye=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),be=t((e=>{var t=K().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),xe=t((e=>{var t=K().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Se=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),J=t((e=>{var t=q(),n=[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],r=[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];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Ce=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),we=t((e=>{var t=Ce();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),Te=t(((e,t)=>{var n=we();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),Y=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),X=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
1
|
+
import{_ as e,h as t,i as n,m as r,n as i,o as a,p as o,u as s}from"./i18n-DAekxt_G.js";import{n as c,o as l,r as u,u as d}from"./dist-BFY-GyT4.js";import{t as f}from"./useMutation-Bi39Z9_J.js";import{O as p,a as m,i as h,n as g,r as _,t as v}from"./select-CEIMqc0H.js";import{t as y}from"./createLucideIcon-B_U7Nq4F.js";import{t as b}from"./book-open-BLxSL7Dk.js";import{t as x}from"./external-link-BydIQTIH.js";import{n as S,t as C}from"./logos-CGJJRI5_.js";import{t as w}from"./hash-Djdf0x1C.js";import{t as T}from"./loader-circle-CGXXikVG.js";import{t as E}from"./search-DgoXxocn.js";import{t as D}from"./x-PBSiWt3l.js";import{E as ee,W as O,c as k,dt as A,g as te,l as j,lt as M,mt as ne,u as N}from"./index-DqSv8Azv.js";import{t as P}from"./LogoBadge-D_dOy5U3.js";import{t as F}from"./label-Bvv4Mrea.js";import{n as I,t as L}from"./page-layout-6Nm4Cnvr.js";import{t as re}from"./tabs-custom-Dxt6EJJW.js";import{t as R}from"./status-dot-CmQI5Qq2.js";import{t as z}from"./config-hints-WtpHP_DW.js";import{i as ie,n as ae,r as oe,t as se}from"./config-layout-LQ10ozRC.js";import{t as ce}from"./switch-B7SxDXyR.js";var le=y(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),ue=y(`MessageCircleMore`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),de=y(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),fe=y(`ToggleLeft`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`6`,ry:`6`,key:`f2vt7d`}],[`circle`,{cx:`8`,cy:`12`,r:`2`,key:`1nvbw3`}]]),B=e(r(),1);function V(e){let t=a();return e.tutorialUrls?.[t]||e.tutorialUrls?.default||e.tutorialUrl}var H=o();function pe({value:e,onChange:t,className:r,placeholder:i=``}){let[a,o]=(0,B.useState)(``),c=n=>{n.key===`Enter`&&a.trim()?(n.preventDefault(),t([...e,a.trim()]),o(``)):n.key===`Backspace`&&!a&&e.length>0&&t(e.slice(0,-1))},l=n=>{t(e.filter((e,t)=>t!==n))};return(0,H.jsxs)(`div`,{className:s(`flex flex-wrap gap-2 p-2 border rounded-md min-h-[42px]`,r),children:[e.map((e,t)=>(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 bg-primary text-primary-foreground rounded text-sm`,children:[e,(0,H.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`hover:text-red-300 transition-colors`,children:(0,H.jsx)(D,{className:`h-3 w-3`})})]},t)),(0,H.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),onKeyDown:c,className:`flex-1 outline-none min-w-[100px] bg-transparent text-sm`,placeholder:i||n(`enterTag`)})]})}function me(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,H.jsx)(ne,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,H.jsx)(S,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,H.jsx)(le,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,H.jsx)(w,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,H.jsx)(fe,{className:`h-3.5 w-3.5 text-gray-500`}):(0,H.jsx)(M,{className:`h-3.5 w-3.5 text-gray-500`})}function U({channelName:e,fields:t,formData:r,jsonDrafts:i,setJsonDrafts:a,updateField:o,uiHints:s}){return(0,H.jsx)(H.Fragment,{children:t.map(t=>{let c=z(`channels.${e}.${t.name}`,s),l=c?.label??t.label,u=c?.placeholder;return(0,H.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,H.jsxs)(F,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[me(t.name),l]}),t.type===`boolean`&&(0,H.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,H.jsx)(`span`,{className:`text-sm text-gray-500`,children:r[t.name]?n(`enabled`):n(`disabled`)}),(0,H.jsx)(ce,{id:t.name,checked:r[t.name]||!1,onCheckedChange:e=>o(t.name,e),className:`data-[state=checked]:bg-emerald-500`})]}),(t.type===`text`||t.type===`email`)&&(0,H.jsx)(O,{id:t.name,type:t.type,value:r[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u,className:`rounded-xl`}),t.type===`password`&&(0,H.jsx)(O,{id:t.name,type:`password`,value:r[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u??n(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,H.jsx)(O,{id:t.name,type:`number`,value:r[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:u,className:`rounded-xl`}),t.type===`tags`&&(0,H.jsx)(pe,{value:r[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,H.jsxs)(v,{value:r[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,H.jsx)(h,{className:`rounded-xl`,children:(0,H.jsx)(m,{})}),(0,H.jsx)(g,{children:(t.options??[]).map(e=>(0,H.jsx)(_,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,H.jsx)(`textarea`,{id:t.name,value:i[t.name]??`{}`,onChange:e=>a(n=>({...n,[t.name]:e.target.value})),className:`min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono`})]},t.name)})})}var W=[{value:`pairing`,label:`pairing`},{value:`allowlist`,label:`allowlist`},{value:`open`,label:`open`},{value:`disabled`,label:`disabled`}],G=[{value:`open`,label:`open`},{value:`allowlist`,label:`allowlist`},{value:`disabled`,label:`disabled`}],he=[{value:`off`,label:`off`},{value:`partial`,label:`partial`},{value:`block`,label:`block`},{value:`progress`,label:`progress`}];function ge(){return{telegram:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`token`,type:`password`,label:n(`botToken`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)},{name:`proxy`,type:`text`,label:n(`proxy`)},{name:`accountId`,type:`text`,label:n(`accountId`)},{name:`dmPolicy`,type:`select`,label:n(`dmPolicy`),options:W},{name:`groupPolicy`,type:`select`,label:n(`groupPolicy`),options:G},{name:`groupAllowFrom`,type:`tags`,label:n(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:n(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:n(`mentionPatterns`)},{name:`groups`,type:`json`,label:n(`groupRulesJson`)}]},discord:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`token`,type:`password`,label:n(`botToken`)},{name:`allowBots`,type:`boolean`,label:n(`allowBotMessages`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)},{name:`gatewayUrl`,type:`text`,label:n(`gatewayUrl`)},{name:`intents`,type:`number`,label:n(`intents`)},{name:`proxy`,type:`text`,label:n(`proxy`)},{name:`mediaMaxMb`,type:`number`,label:n(`attachmentMaxSizeMb`)},{name:`streaming`,type:`select`,label:n(`streamingMode`),options:he},{name:`draftChunk`,type:`json`,label:n(`draftChunkingJson`)},{name:`textChunkLimit`,type:`number`,label:n(`textChunkLimit`)},{name:`accountId`,type:`text`,label:n(`accountId`)},{name:`dmPolicy`,type:`select`,label:n(`dmPolicy`),options:W},{name:`groupPolicy`,type:`select`,label:n(`groupPolicy`),options:G},{name:`groupAllowFrom`,type:`tags`,label:n(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:n(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:n(`mentionPatterns`)},{name:`groups`,type:`json`,label:n(`groupRulesJson`)}]},whatsapp:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`bridgeUrl`,type:`text`,label:n(`bridgeUrl`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]},feishu:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`appId`,type:`text`,label:n(`appId`)},{name:`appSecret`,type:`password`,label:n(`appSecret`)},{name:`encryptKey`,type:`password`,label:n(`encryptKey`)},{name:`verificationToken`,type:`password`,label:n(`verificationToken`)},{name:`domain`,type:`text`,label:`Domain`},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)},{name:`dmPolicy`,type:`select`,label:n(`dmPolicy`),options:W},{name:`groupPolicy`,type:`select`,label:n(`groupPolicy`),options:G},{name:`groupAllowFrom`,type:`tags`,label:n(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:n(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:n(`mentionPatterns`)},{name:`groups`,type:`json`,label:n(`groupRulesJson`)},{name:`accounts`,type:`json`,label:n(`accountsJson`)}]},dingtalk:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`clientId`,type:`text`,label:n(`clientId`)},{name:`clientSecret`,type:`password`,label:n(`clientSecret`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]},wecom:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`corpId`,type:`text`,label:n(`corpId`)},{name:`agentId`,type:`text`,label:n(`agentId`)},{name:`secret`,type:`password`,label:n(`secret`)},{name:`token`,type:`password`,label:n(`token`)},{name:`callbackPort`,type:`number`,label:n(`callbackPort`)},{name:`callbackPath`,type:`text`,label:n(`callbackPath`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]},weixin:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`),section:`primary`},{name:`defaultAccountId`,type:`text`,label:n(`defaultAccountId`)},{name:`baseUrl`,type:`text`,label:n(`baseUrl`)},{name:`pollTimeoutMs`,type:`number`,label:n(`pollTimeoutMs`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)},{name:`accounts`,type:`json`,label:n(`accountsJson`)}],layout:[{type:`fields`,section:`primary`},{type:`custom`,sectionId:`weixin-auth`},{type:`fields`,section:`advanced`,collapsible:{title:n(`weixinAuthAdvancedTitle`),description:n(`weixinAuthAdvancedDescription`)}}]},slack:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`mode`,type:`text`,label:n(`mode`)},{name:`webhookPath`,type:`text`,label:n(`webhookPath`)},{name:`allowBots`,type:`boolean`,label:n(`allowBotMessages`)},{name:`botToken`,type:`password`,label:n(`botToken`)},{name:`appToken`,type:`password`,label:n(`appToken`)}]},email:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`consentGranted`,type:`boolean`,label:n(`consentGranted`)},{name:`imapHost`,type:`text`,label:n(`imapHost`)},{name:`imapPort`,type:`number`,label:n(`imapPort`)},{name:`imapUsername`,type:`text`,label:n(`imapUsername`)},{name:`imapPassword`,type:`password`,label:n(`imapPassword`)},{name:`fromAddress`,type:`email`,label:n(`fromAddress`)}]},mochat:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`baseUrl`,type:`text`,label:n(`baseUrl`)},{name:`clawToken`,type:`password`,label:n(`clawToken`)},{name:`agentUserId`,type:`text`,label:n(`agentUserId`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]},qq:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`appId`,type:`text`,label:n(`appId`)},{name:`secret`,type:`password`,label:n(`appSecret`)},{name:`markdownSupport`,type:`boolean`,label:n(`markdownSupport`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]}}}var _e=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),K=t((e=>{var t,n=[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];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),q=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),ve=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),ye=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),be=t((e=>{var t=K().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),xe=t((e=>{var t=K().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Se=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),J=t((e=>{var t=q(),n=[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],r=[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];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Ce=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),we=t((e=>{var t=Ce();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),Te=t(((e,t)=>{var n=we();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),Y=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),X=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
2
2
|
]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^`+t+`$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),Z=t((e=>{var t=Y(),n=X();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),Ee=t((e=>{var t=K(),n=J(),r=q(),i=Z(),a=Y(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),De=t((e=>{var t=K(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),Oe=t(((e,t)=>{var n=Z();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),ke=t(((e,t)=>{var n=Z(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},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+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),Ae=t(((e,t)=>{var n=Z();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),je=t(((e,t)=>{var n=Z(),r=K();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*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=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw 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)}},t.exports=i})),Me=t(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),Ne=t((e=>{var t=Z(),n=Oe(),r=ke(),i=Ae(),a=je(),o=X(),s=K(),c=Me();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
|
|
4
4
|
Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),Pe=t((e=>{var t=K(),n=q(),r=ve(),i=ye(),a=be(),o=xe(),s=Se(),c=J(),l=Te(),u=Ee(),d=De(),f=Z(),p=Ne();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
|