@guideai/react-native 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/{GuideAIChat-BFu10t6D.cjs → GuideAIChat-BtbkPIvE.cjs} +285 -26
- package/dist/GuideAIChat-BtbkPIvE.cjs.map +1 -0
- package/dist/{GuideAIChat-Ba6n1ePs.js → GuideAIChat-CKW6dgl_.js} +286 -27
- package/dist/GuideAIChat-CKW6dgl_.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +58 -6
- package/dist/index.mjs +2 -2
- package/dist/ui.cjs +2 -2
- package/dist/ui.d.ts +13 -3
- package/dist/ui.mjs +3 -3
- package/dist/{useConversations-C-OmzdeA.js → useConversations-BljCr0Od.js} +1067 -43
- package/dist/useConversations-BljCr0Od.js.map +1 -0
- package/dist/{useConversations-Chn_GKOz.cjs → useConversations-UiwD_WVF.cjs} +1067 -43
- package/dist/useConversations-UiwD_WVF.cjs.map +1 -0
- package/dist/voice.cjs +61 -23
- package/dist/voice.cjs.map +1 -1
- package/dist/voice.d.ts +13 -3
- package/dist/voice.mjs +62 -24
- package/dist/voice.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/GuideAIChat-BFu10t6D.cjs.map +0 -1
- package/dist/GuideAIChat-BQQ8lUKs.js +0 -2795
- package/dist/GuideAIChat-BQQ8lUKs.js.map +0 -1
- package/dist/GuideAIChat-Ba6n1ePs.js.map +0 -1
- package/dist/GuideAIChat-CNmEo5bZ.cjs +0 -2794
- package/dist/GuideAIChat-CNmEo5bZ.cjs.map +0 -1
- package/dist/GuideAIChat-CxyWFl_o.cjs +0 -2493
- package/dist/GuideAIChat-CxyWFl_o.cjs.map +0 -1
- package/dist/GuideAIChat-DOC4zx-a.js +0 -2494
- package/dist/GuideAIChat-DOC4zx-a.js.map +0 -1
- package/dist/GuideAIChat-SU0CVNby.js +0 -2795
- package/dist/GuideAIChat-SU0CVNby.js.map +0 -1
- package/dist/GuideAIChat-W8KQ4Y6i.cjs +0 -2794
- package/dist/GuideAIChat-W8KQ4Y6i.cjs.map +0 -1
- package/dist/useConversations-B_7km_uH.js +0 -4243
- package/dist/useConversations-B_7km_uH.js.map +0 -1
- package/dist/useConversations-C-OmzdeA.js.map +0 -1
- package/dist/useConversations-CJEaVqch.cjs +0 -4290
- package/dist/useConversations-CJEaVqch.cjs.map +0 -1
- package/dist/useConversations-CTbQBTz-.cjs +0 -4242
- package/dist/useConversations-CTbQBTz-.cjs.map +0 -1
- package/dist/useConversations-Chn_GKOz.cjs.map +0 -1
- package/dist/useConversations-Ckyqbxqi.cjs +0 -4299
- package/dist/useConversations-Ckyqbxqi.cjs.map +0 -1
- package/dist/useConversations-DzhYCIiY.js +0 -4300
- package/dist/useConversations-DzhYCIiY.js.map +0 -1
- package/dist/useConversations-SbhtYN_R.js +0 -4291
- package/dist/useConversations-SbhtYN_R.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContext, createContext, useSyncExternalStore, useState, useEffect, useCallback, useRef, useMemo } from "react";
|
|
2
|
-
const DRAWING_URL = /^https:\/\/res\.cloudinary\.com\/[\w-]+\/image\/upload
|
|
2
|
+
const DRAWING_URL = /^https:\/\/(?:res\.cloudinary\.com\/[\w-]+\/image\/upload\/|(?:guideai-video-media-\d+\.s3\.[a-z0-9-]+\.amazonaws\.com|d16dyzg2d3ijry\.cloudfront\.net)\/guideai\/)/;
|
|
3
3
|
const IMAGE_BLOCK = /```image[ \t]*\n([\s\S]*?)```/g;
|
|
4
4
|
function headlessImages(text) {
|
|
5
5
|
const images = [];
|
|
@@ -380,8 +380,9 @@ class HarnessValidator {
|
|
|
380
380
|
if (status === 429) return "rate_limit";
|
|
381
381
|
if (status && status >= 500) return "server";
|
|
382
382
|
if (status === 400 || status === 422) return "validation";
|
|
383
|
+
if (error.includes("no auth token found")) return "auth";
|
|
383
384
|
if (error.includes("timed out") || error.includes("timeout")) return "timeout";
|
|
384
|
-
if (error.includes("connect") || error.includes("network")) return "connection";
|
|
385
|
+
if (error.includes("connect") || error.includes("network") || error.includes("failed to fetch") || error.includes("load failed")) return "connection";
|
|
385
386
|
if (status && status >= 400) return "client";
|
|
386
387
|
return result.error_type || "unknown";
|
|
387
388
|
}
|
|
@@ -1069,7 +1070,7 @@ const EP = {
|
|
|
1069
1070
|
doItRuns: () => _j([..._v, "guide-executions"]),
|
|
1070
1071
|
doItRun: (runId, op) => _j([..._v, "guide-executions", encodeURIComponent(runId), ...op ? [op] : []]),
|
|
1071
1072
|
chatFormat: () => _j([..._v, "chat", "format-tool-result"]),
|
|
1072
|
-
copilotTools: () => _j([..._v, "copilot-tools", "active"])
|
|
1073
|
+
copilotTools: (mode) => `${_j([..._v, "copilot-tools", "active"])}${mode ? `?chat_mode=${mode}` : ""}`,
|
|
1073
1074
|
copilotStream: () => _j([..._v, "copilot", "stream"]),
|
|
1074
1075
|
resolveScore: () => _j([..._v, "resolve", "score"]),
|
|
1075
1076
|
resolveLocate: () => _j([..._v, "resolve", "locate"]),
|
|
@@ -1086,6 +1087,7 @@ const EP = {
|
|
|
1086
1087
|
realtimeTranscriptionSession: () => _j([..._v, "realtime", "transcription", "session"]),
|
|
1087
1088
|
realtimeSpeech: () => _j([..._v, "realtime", "speech"]),
|
|
1088
1089
|
listenSession: () => _j([..._v, "realtime", "listen", "session"]),
|
|
1090
|
+
dictateSession: () => _j([..._v, "realtime", "dictate", "session"]),
|
|
1089
1091
|
speakSession: () => _j([..._v, "realtime", "speak", "session"]),
|
|
1090
1092
|
liveSession: () => _j([..._v, "realtime", "live", "session"]),
|
|
1091
1093
|
// v=2: neutral voice codes (stream / pipeline / live / live-rtc).
|
|
@@ -1136,7 +1138,7 @@ class CopilotHarness {
|
|
|
1136
1138
|
if (this.initialized) return this.isEnabled();
|
|
1137
1139
|
try {
|
|
1138
1140
|
const response = await this.api.get(
|
|
1139
|
-
EP.copilotTools()
|
|
1141
|
+
EP.copilotTools("assistant")
|
|
1140
1142
|
);
|
|
1141
1143
|
if (response && response.tools && response.tools.length > 0) {
|
|
1142
1144
|
this.activeTools = response;
|
|
@@ -1309,6 +1311,7 @@ class CopilotHarness {
|
|
|
1309
1311
|
* Executes in the browser when possible, then formats the result with LLM.
|
|
1310
1312
|
*/
|
|
1311
1313
|
async executeToolCall(toolCall, originalQuestion, onStatus, onTextDelta) {
|
|
1314
|
+
var _a;
|
|
1312
1315
|
if (!this.canExecuteTool(toolCall)) {
|
|
1313
1316
|
const errorMsg = "Tool execution is unavailable in this browser context.";
|
|
1314
1317
|
this.memory.addMessage({
|
|
@@ -1374,6 +1377,28 @@ class CopilotHarness {
|
|
|
1374
1377
|
autoExecute: false
|
|
1375
1378
|
};
|
|
1376
1379
|
}
|
|
1380
|
+
if (this.tools.canExecuteCall(toolCall)) {
|
|
1381
|
+
const completedSteps = [{ tool_name: toolCall.tool, tool_result: result.data }];
|
|
1382
|
+
const continued = await this._continueToolChain(
|
|
1383
|
+
toolCall.tool,
|
|
1384
|
+
result.data,
|
|
1385
|
+
originalQuestion,
|
|
1386
|
+
completedSteps,
|
|
1387
|
+
onStatus,
|
|
1388
|
+
onTextDelta
|
|
1389
|
+
);
|
|
1390
|
+
if (continued.autoExecuteToolCall && continued.pendingToolCall) {
|
|
1391
|
+
return this._runClientToolChain(
|
|
1392
|
+
(_a = continued.pendingToolCalls) != null ? _a : [continued.pendingToolCall],
|
|
1393
|
+
originalQuestion,
|
|
1394
|
+
onStatus,
|
|
1395
|
+
onTextDelta,
|
|
1396
|
+
void 0,
|
|
1397
|
+
completedSteps
|
|
1398
|
+
);
|
|
1399
|
+
}
|
|
1400
|
+
return continued;
|
|
1401
|
+
}
|
|
1377
1402
|
return this._formatToolResult(
|
|
1378
1403
|
toolCall.tool,
|
|
1379
1404
|
result.data,
|
|
@@ -1781,6 +1806,7 @@ class CopilotHarness {
|
|
|
1781
1806
|
const response = await this.api.post(
|
|
1782
1807
|
EP.chatContinue(),
|
|
1783
1808
|
{
|
|
1809
|
+
chat_mode: "assistant",
|
|
1784
1810
|
original_question: originalQuestion,
|
|
1785
1811
|
latest_tool_name: latestToolName,
|
|
1786
1812
|
latest_tool_result: latestToolResult,
|
|
@@ -1822,19 +1848,19 @@ class CopilotHarness {
|
|
|
1822
1848
|
* round trip, rather than four of each. Dependent calls still arrive one at
|
|
1823
1849
|
* a time — the model only batches what it can run without waiting.
|
|
1824
1850
|
*/
|
|
1825
|
-
async _runClientToolChain(initialToolCalls, originalQuestion, onStatus, onTextDelta, onToolCallEvent) {
|
|
1851
|
+
async _runClientToolChain(initialToolCalls, originalQuestion, onStatus, onTextDelta, onToolCallEvent, completedSteps = []) {
|
|
1826
1852
|
var _a;
|
|
1827
1853
|
if (!this.hasAnyLocalTools()) {
|
|
1828
1854
|
return this._errorResponse("Tool execution is unavailable in this browser context.");
|
|
1829
1855
|
}
|
|
1830
|
-
const toolHistory = [];
|
|
1856
|
+
const toolHistory = [...completedSteps];
|
|
1831
1857
|
const executed = /* @__PURE__ */ new Set();
|
|
1832
1858
|
const callKey = (call) => {
|
|
1833
1859
|
var _a2, _b;
|
|
1834
1860
|
return `${call.tool}:${JSON.stringify((_a2 = call.params) != null ? _a2 : {})}:${JSON.stringify((_b = call.body) != null ? _b : {})}`;
|
|
1835
1861
|
};
|
|
1836
1862
|
let currentBatch = this._dropRepeats(initialToolCalls, executed, callKey);
|
|
1837
|
-
let toolsRun =
|
|
1863
|
+
let toolsRun = completedSteps.length;
|
|
1838
1864
|
let repairsUsed = 0;
|
|
1839
1865
|
for (let iteration = 0; currentBatch.length > 0 && iteration < MAX_CHAIN_ROUNDS; iteration += 1) {
|
|
1840
1866
|
if (toolsRun + currentBatch.length > MAX_TOTAL_TOOL_CALLS) {
|
|
@@ -1995,6 +2021,7 @@ class CopilotHarness {
|
|
|
1995
2021
|
var _a, _b;
|
|
1996
2022
|
try {
|
|
1997
2023
|
return await this.api.post(EP.chatExecuteTool(), {
|
|
2024
|
+
chat_mode: "assistant",
|
|
1998
2025
|
tool: toolCall.tool,
|
|
1999
2026
|
method: toolCall.method,
|
|
2000
2027
|
path: toolCall.path,
|
|
@@ -2026,6 +2053,7 @@ class CopilotHarness {
|
|
|
2026
2053
|
const rawResponse = await this.api.postRaw(
|
|
2027
2054
|
EP.chatFormat(),
|
|
2028
2055
|
{
|
|
2056
|
+
chat_mode: "assistant",
|
|
2029
2057
|
tool_name: toolName,
|
|
2030
2058
|
tool_result: toolResult,
|
|
2031
2059
|
original_question: originalQuestion,
|
|
@@ -3140,8 +3168,8 @@ function dump(label, value) {
|
|
|
3140
3168
|
console.log(`${label}
|
|
3141
3169
|
${text}`);
|
|
3142
3170
|
}
|
|
3143
|
-
function line(
|
|
3144
|
-
console.log(`[${stamp()}] ${
|
|
3171
|
+
function line(icon2, text) {
|
|
3172
|
+
console.log(`[${stamp()}] ${icon2} ${text}`);
|
|
3145
3173
|
}
|
|
3146
3174
|
function traceApi(api) {
|
|
3147
3175
|
return {
|
|
@@ -3605,21 +3633,21 @@ const ID = /^[A-Za-z0-9_-]{1,24}$/;
|
|
|
3605
3633
|
const SIZES = ["s", "m", "l"];
|
|
3606
3634
|
const TONES = ["ink", "blue", "red", "green"];
|
|
3607
3635
|
const PATH_DATA = /^[MmLlHhVvCcSsQqTtAaZz0-9eE.,\s+-]*$/;
|
|
3608
|
-
const PHOTO_URL = /^https:\/\/res\.cloudinary\.com\/[A-Za-z0-9_-]+\/image\/upload\/[^\s"'<>\\]+$/;
|
|
3636
|
+
const PHOTO_URL = /^https:\/\/(?:res\.cloudinary\.com\/[A-Za-z0-9_-]+\/image\/upload\/|(?:guideai-video-media-\d+\.s3\.[a-z0-9-]+\.amazonaws\.com|d16dyzg2d3ijry\.cloudfront\.net)\/guideai\/)[^\s"'<>\\]+$/;
|
|
3609
3637
|
const flat = (value, max) => typeof value === "string" ? value.replace(/\s+/g, " ").trim().slice(0, max) : "";
|
|
3610
3638
|
const clamp = (n, top = BOARD_H) => Math.round(Math.min(top, Math.max(0, n)) * 10) / 10;
|
|
3611
|
-
function num(value) {
|
|
3639
|
+
function num$1(value) {
|
|
3612
3640
|
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
3613
3641
|
}
|
|
3614
3642
|
let wide = 1;
|
|
3615
3643
|
function point(raw) {
|
|
3616
3644
|
if (!Array.isArray(raw) || raw.length !== 2) return null;
|
|
3617
|
-
const [x, y] = raw.map(num);
|
|
3645
|
+
const [x, y] = raw.map(num$1);
|
|
3618
3646
|
return x === null || y === null ? null : [clamp(x * wide, BOARD_W), clamp(y)];
|
|
3619
3647
|
}
|
|
3620
3648
|
function box(raw) {
|
|
3621
3649
|
if (!Array.isArray(raw) || raw.length !== 4) return null;
|
|
3622
|
-
const v = raw.map(num);
|
|
3650
|
+
const v = raw.map(num$1);
|
|
3623
3651
|
if (v.some((n) => n === null)) return null;
|
|
3624
3652
|
const x = clamp(v[0] * wide, BOARD_W);
|
|
3625
3653
|
const y = clamp(v[1]);
|
|
@@ -3683,7 +3711,7 @@ function item(raw) {
|
|
|
3683
3711
|
const rows = r.rows.slice(0, LIMITS.tableRows).filter((row) => Array.isArray(row) && row.length > 0).map((row) => row.slice(0, LIMITS.tableCols).map((cell) => flat(String(cell != null ? cell : ""), LIMITS.cell)));
|
|
3684
3712
|
const at = point(r.at.slice(0, 2));
|
|
3685
3713
|
if (!rows.length || !at) return null;
|
|
3686
|
-
const width = ((_a = num(r.at[2])) != null ? _a : 40) * wide;
|
|
3714
|
+
const width = ((_a = num$1(r.at[2])) != null ? _a : 40) * wide;
|
|
3687
3715
|
return { kind: "table", id: id(r.id), rows, at: [at[0], at[1], Math.min(Math.max(5, width), BOARD_W - at[0])], tone: tone(r.tone) };
|
|
3688
3716
|
}
|
|
3689
3717
|
case "mark": {
|
|
@@ -3711,7 +3739,7 @@ function item(raw) {
|
|
|
3711
3739
|
}
|
|
3712
3740
|
case "turn": {
|
|
3713
3741
|
const target = id(r.turn);
|
|
3714
|
-
const by = Math.min(LIMITS.turn, Math.max(-1440, (_b = num(r.by)) != null ? _b : 360));
|
|
3742
|
+
const by = Math.min(LIMITS.turn, Math.max(-1440, (_b = num$1(r.by)) != null ? _b : 360));
|
|
3715
3743
|
return target && by ? { kind: "turn", turn: target, by } : null;
|
|
3716
3744
|
}
|
|
3717
3745
|
case "pulse": {
|
|
@@ -3741,8 +3769,8 @@ function artInk(raw) {
|
|
|
3741
3769
|
function photo(raw) {
|
|
3742
3770
|
if (!raw || typeof raw !== "object") return null;
|
|
3743
3771
|
const r = raw;
|
|
3744
|
-
const w = num(r.w);
|
|
3745
|
-
const h = num(r.h);
|
|
3772
|
+
const w = num$1(r.w);
|
|
3773
|
+
const h = num$1(r.h);
|
|
3746
3774
|
if (typeof r.url !== "string" || r.url.length > 600 || !PHOTO_URL.test(r.url) || !w || !h || w <= 0 || h <= 0) return null;
|
|
3747
3775
|
const credit = flat(r.credit, 60);
|
|
3748
3776
|
return credit ? { url: r.url, w, h, credit } : { url: r.url, w, h };
|
|
@@ -3806,6 +3834,973 @@ function validateScene(raw) {
|
|
|
3806
3834
|
photos
|
|
3807
3835
|
};
|
|
3808
3836
|
}
|
|
3837
|
+
const ISO_ICONS = {
|
|
3838
|
+
"activity": '<path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"/>',
|
|
3839
|
+
"alert": '<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',
|
|
3840
|
+
"balancer": '<path d="M16 3h5v5"/><path d="M8 3H3v5"/><path d="M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3"/><path d="m15 9 6-6"/>',
|
|
3841
|
+
"ban": '<circle cx="12" cy="12" r="10"/><path d="M4.929 4.929 19.07 19.071"/>',
|
|
3842
|
+
"bank": '<path d="M10 18v-7"/><path d="M11.119 2.205a2 2 0 0 1 1.762 0l7.84 3.846A.5.5 0 0 1 20.5 7h-17a.5.5 0 0 1-.22-.949z"/><path d="M14 18v-7"/><path d="M18 18v-7"/><path d="M3 22h18"/><path d="M6 18v-7"/>',
|
|
3843
|
+
"bell": '<path d="M10.268 21a2 2 0 0 0 3.464 0"/><path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"/>',
|
|
3844
|
+
"book": '<path d="M12 5v16"/><path d="M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z"/>',
|
|
3845
|
+
"bot": '<path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/>',
|
|
3846
|
+
"box": '<path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/>',
|
|
3847
|
+
"boxes": '<path d="M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z"/><path d="m7 16.5-4.74-2.85"/><path d="m7 16.5 5-3"/><path d="M7 16.5v5.17"/><path d="M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z"/><path d="m17 16.5-5-3"/><path d="m17 16.5 4.74-2.85"/><path d="M17 16.5v5.17"/><path d="M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z"/><path d="M12 8 7.26 5.15"/><path d="m12 8 4.74-2.85"/><path d="M12 13.5V8"/>',
|
|
3848
|
+
"braces": '<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',
|
|
3849
|
+
"bug": '<path d="M12 20v-9"/><path d="M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"/><path d="M14.12 3.88 16 2"/><path d="M21 21a4 4 0 0 0-3.81-4"/><path d="M21 5a4 4 0 0 1-3.55 3.97"/><path d="M22 13h-4"/><path d="M3 21a4 4 0 0 1 3.81-4"/><path d="M3 5a4 4 0 0 0 3.55 3.97"/><path d="M6 13H2"/><path d="m8 2 1.88 1.88"/><path d="M9 7.13V6a3 3 0 1 1 6 0v1.13"/>',
|
|
3850
|
+
"bulb": '<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/>',
|
|
3851
|
+
"calendar": '<path d="M8 2v3"/><path d="M16 2v3"/><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/>',
|
|
3852
|
+
"camera": '<path d="M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"/><circle cx="12" cy="13" r="3"/>',
|
|
3853
|
+
"car": '<path d="M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2"/><circle cx="7" cy="17" r="2"/><path d="M9 17h6"/><circle cx="17" cy="17" r="2"/>',
|
|
3854
|
+
"card": '<rect width="20" height="14" x="2" y="5" rx="2"/><line x1="2" x2="22" y1="10" y2="10"/><path d="M6 14h2"/>',
|
|
3855
|
+
"cart": '<path d="m2.05 2.05 1.099-.028a1 1 0 0 1 1.008.815l2.69 14.347A1 1 0 0 0 7.83 18H18"/><path d="M4.563 5h16.435a1 1 0 0 1 .981 1.204l-1.026 6.226A2 2 0 0 1 18.962 14H6.25"/><circle cx="18" cy="20" r="2"/><circle cx="8" cy="20" r="2"/>',
|
|
3856
|
+
"chart": '<path d="M3 3v16a2 2 0 0 0 2 2h16"/><path d="M18 17V9"/><path d="M13 17V5"/><path d="M8 17v-3"/>',
|
|
3857
|
+
"check": '<path d="M20 6 9 17l-5-5"/>',
|
|
3858
|
+
"clipboard": '<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><path d="M12 11h4"/><path d="M12 16h4"/><path d="M8 11h.01"/><path d="M8 16h.01"/>',
|
|
3859
|
+
"clock": '<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>',
|
|
3860
|
+
"cloud": '<path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"/>',
|
|
3861
|
+
"code": '<path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/>',
|
|
3862
|
+
"cookie": '<path d="M11 17h.01"/><path d="M11.496 2c.324-.016.558.292.529.615a4 4 0 004.235 4.368.713.713 0 01.758.757 4 4 0 004.366 4.237c.323-.03.63.204.614.527a10 10 0 01-2.915 6.566A1 1 0 114.93 4.918 10 10 0 0111.496 2"/><path d="M12 12h.01"/><path d="M16 16h.01"/><path d="M16 3h.01"/><path d="M21 4h.01"/><path d="M21 8h.01"/><path d="M7 14h.01"/><path d="M9 8h.01"/>',
|
|
3863
|
+
"cpu": '<path d="M12 20v2"/><path d="M12 2v2"/><path d="M17 20v2"/><path d="M17 2v2"/><path d="M2 12h2"/><path d="M2 17h2"/><path d="M2 7h2"/><path d="M20 12h2"/><path d="M20 17h2"/><path d="M20 7h2"/><path d="M7 20v2"/><path d="M7 2v2"/><rect x="4" y="4" width="16" height="16" rx="2"/><rect x="8" y="8" width="8" height="8" rx="1"/>',
|
|
3864
|
+
"database": '<ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5V19A9 3 0 0 0 21 19V5"/><path d="M3 12A9 3 0 0 0 21 12"/>',
|
|
3865
|
+
"dollar": '<line x1="12" x2="12" y1="2" y2="22"/><path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/>',
|
|
3866
|
+
"droplet": '<path d="M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z"/>',
|
|
3867
|
+
"eye": '<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',
|
|
3868
|
+
"factory": '<path d="M12 16h.01"/><path d="M16 16h.01"/><path d="M3 19a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a.5.5 0 0 0-.769-.422l-4.462 2.844A.5.5 0 0 1 15 10.5v-2a.5.5 0 0 0-.769-.422L9.77 10.922A.5.5 0 0 1 9 10.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2z"/><path d="M8 16h.01"/>',
|
|
3869
|
+
"file": '<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/>',
|
|
3870
|
+
"filter": '<path d="M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"/>',
|
|
3871
|
+
"fingerprint": '<path d="M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4"/><path d="M14 13.12c0 2.38 0 6.38-1 8.88"/><path d="M17.29 21.02c.12-.6.43-2.3.5-3.02"/><path d="M2 12a10 10 0 0 1 18-6"/><path d="M2 16h.01"/><path d="M21.8 16c.2-2 .131-5.354 0-6"/><path d="M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2"/><path d="M8.65 22c.21-.66.45-1.32.57-2"/><path d="M9 6.8a6 6 0 0 1 9 5.2v2"/>',
|
|
3872
|
+
"flag": '<path d="M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528"/>',
|
|
3873
|
+
"flask": '<path d="M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2"/><path d="M6.453 15h11.094"/><path d="M8.5 2h7"/>',
|
|
3874
|
+
"gauge": '<path d="m12 14 4-4"/><path d="M3.34 19a10 10 0 1 1 17.32 0"/>',
|
|
3875
|
+
"gift": '<path d="M12 7v14"/><path d="M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8"/><path d="M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5"/><rect x="3" y="7" width="18" height="4" rx="1"/>',
|
|
3876
|
+
"git": '<path d="M15 6a9 9 0 0 0-9 9V3"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/>',
|
|
3877
|
+
"globe": '<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>',
|
|
3878
|
+
"graduation": '<path d="M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z"/><path d="M22 10v6"/><path d="M6 12.5V16a6 3 0 0 0 12 0v-3.5"/>',
|
|
3879
|
+
"hammer": '<path d="m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9"/><path d="m18 15 4-4"/><path d="m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5"/>',
|
|
3880
|
+
"hash": '<line x1="4" x2="20" y1="9" y2="9"/><line x1="4" x2="20" y1="15" y2="15"/><line x1="10" x2="8" y1="3" y2="21"/><line x1="16" x2="14" y1="3" y2="21"/>',
|
|
3881
|
+
"heart": '<path d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"/><path d="M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27"/>',
|
|
3882
|
+
"home": '<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/><path d="M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',
|
|
3883
|
+
"hotel": '<path d="M10 22v-6.57"/><path d="M12 11h.01"/><path d="M12 7h.01"/><path d="M14 15.43V22"/><path d="M15 16a5 5 0 0 0-6 0"/><path d="M16 11h.01"/><path d="M16 7h.01"/><path d="M8 11h.01"/><path d="M8 7h.01"/><rect x="4" y="2" width="16" height="20" rx="2"/>',
|
|
3884
|
+
"hourglass": '<path d="M5 22h14"/><path d="M5 2h14"/><path d="M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"/><path d="M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"/>',
|
|
3885
|
+
"image": '<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',
|
|
3886
|
+
"inbox": '<polyline points="22 12 16 12 14 15 10 15 8 12 2 12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/>',
|
|
3887
|
+
"info": '<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',
|
|
3888
|
+
"key": '<path d="M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z"/><circle cx="16.5" cy="7.5" r=".5" fill="currentColor"/>',
|
|
3889
|
+
"laptop": '<path d="M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z"/><path d="M20.054 15.987H3.946"/>',
|
|
3890
|
+
"layers": '<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"/><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"/><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"/>',
|
|
3891
|
+
"leaf": '<path d="M11 20a10 10 0 0010-10 25.9 25.9 0 00-1.04-7.281 1 1 0 00-1.755-.325C15.833 5.5 13 5.5 9.8 6.1A7 7 0 0011 20"/><path d="M2 21a5 5 0 012.911-4.544C7.613 15.212 8.351 15.24 11 13"/>',
|
|
3892
|
+
"list": '<path d="M3 5h.01"/><path d="M3 12h.01"/><path d="M3 19h.01"/><path d="M8 5h13"/><path d="M8 12h13"/><path d="M8 19h13"/>',
|
|
3893
|
+
"lock": '<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',
|
|
3894
|
+
"mail": '<path d="m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7"/><rect x="2" y="4" width="20" height="16" rx="2"/>',
|
|
3895
|
+
"map": '<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"/><circle cx="12" cy="10" r="3"/>',
|
|
3896
|
+
"merge": '<path d="m8 6 4-4 4 4"/><path d="M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22"/><path d="m20 22-5-5"/>',
|
|
3897
|
+
"message": '<path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"/>',
|
|
3898
|
+
"moon": '<path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"/>',
|
|
3899
|
+
"network": '<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',
|
|
3900
|
+
"package": '<path d="M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"/><path d="M12 22V12"/><polyline points="3.29 7 12 12 20.71 7"/><path d="m7.5 4.27 9 5.15"/>',
|
|
3901
|
+
"phone": '<rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/>',
|
|
3902
|
+
"plane": '<path d="M17.8 19.2 16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z"/>',
|
|
3903
|
+
"power": '<path d="M12 2v10"/><path d="M18.4 6.6a9 9 0 1 1-12.77.04"/>',
|
|
3904
|
+
"radio": '<path d="M16.247 7.761a6 6 0 0 1 0 8.478"/><path d="M19.075 4.933a10 10 0 0 1 0 14.134"/><path d="M4.925 19.067a10 10 0 0 1 0-14.134"/><path d="M7.753 16.239a6 6 0 0 1 0-8.478"/><circle cx="12" cy="12" r="2"/>',
|
|
3905
|
+
"receipt": '<path d="M12 17V7"/><path d="M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8"/><path d="M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z"/>',
|
|
3906
|
+
"refresh": '<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>',
|
|
3907
|
+
"rocket": '<path d="M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"/><path d="M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09"/><path d="M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z"/><path d="M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05"/>',
|
|
3908
|
+
"route": '<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>',
|
|
3909
|
+
"scale": '<path d="M12 3v18"/><path d="m19 8 3 8a5 5 0 0 1-6 0zV7"/><path d="M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1"/><path d="m5 8 3 8a5 5 0 0 1-6 0zV7"/><path d="M7 21h10"/>',
|
|
3910
|
+
"scroll": '<path d="M15 12h-5"/><path d="M15 8h-5"/><path d="M19 17V5a2 2 0 0 0-2-2H4"/><path d="M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3"/>',
|
|
3911
|
+
"search": '<path d="m21 21-4.34-4.34"/><circle cx="11" cy="11" r="8"/>',
|
|
3912
|
+
"server": '<rect width="20" height="8" x="2" y="2" rx="2" ry="2"/><rect width="20" height="8" x="2" y="14" rx="2" ry="2"/><line x1="6" x2="6.01" y1="6" y2="6"/><line x1="6" x2="6.01" y1="18" y2="18"/>',
|
|
3913
|
+
"settings": '<path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"/><circle cx="12" cy="12" r="3"/>',
|
|
3914
|
+
"share": '<circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" x2="15.42" y1="13.51" y2="17.49"/><line x1="15.41" x2="8.59" y1="6.51" y2="10.49"/>',
|
|
3915
|
+
"shield": '<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="m9 12 2 2 4-4"/>',
|
|
3916
|
+
"signpost": '<path d="M12 13v8"/><path d="M12 3v3"/><path d="M2.354 10.354a1.207 1.207 0 0 1 0-1.708l2.06-2.06A2 2 0 0 1 5.828 6h12.344a2 2 0 0 1 1.414.586l2.06 2.06a1.207 1.207 0 0 1 0 1.708l-2.06 2.06a2 2 0 0 1-1.414.586H5.828a2 2 0 0 1-1.414-.586z"/>',
|
|
3917
|
+
"siren": '<path d="M7 18v-6a5 5 0 1 1 10 0v6"/><path d="M5 21a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2z"/><path d="M21 12h1"/><path d="M18.5 4.5 18 5"/><path d="M2 12h1"/><path d="M12 2v1"/><path d="m4.929 4.929.707.707"/><path d="M12 12v6"/>',
|
|
3918
|
+
"sparkles": '<path d="M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"/><path d="M20 2v4"/><path d="M22 4h-4"/><circle cx="4" cy="20" r="2"/>',
|
|
3919
|
+
"stethoscope": '<path d="M11 2v2"/><path d="M5 2v2"/><path d="M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1"/><path d="M8 15a6 6 0 0 0 12 0v-3"/><circle cx="20" cy="10" r="2"/>',
|
|
3920
|
+
"store": '<path d="M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5"/><path d="M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244"/><path d="M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05"/>',
|
|
3921
|
+
"sun": '<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>',
|
|
3922
|
+
"table": '<path d="M12 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/>',
|
|
3923
|
+
"terminal": '<path d="M12 19h8"/><path d="m4 17 6-6-6-6"/>',
|
|
3924
|
+
"ticket": '<path d="M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z"/><path d="M13 5v2"/><path d="M13 17v2"/><path d="M13 11v2"/>',
|
|
3925
|
+
"timer": '<line x1="10" x2="14" y1="2" y2="2"/><line x1="12" x2="15" y1="14" y2="11"/><circle cx="12" cy="14" r="8"/>',
|
|
3926
|
+
"toggle": '<circle cx="15" cy="12" r="3"/><rect width="20" height="14" x="2" y="5" rx="7"/>',
|
|
3927
|
+
"trending": '<path d="M16 7h6v6"/><path d="m22 7-8.5 8.5-5-5L2 17"/>',
|
|
3928
|
+
"truck": '<path d="M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2"/><path d="M15 18H9"/><path d="M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14"/><circle cx="17" cy="18" r="2"/><circle cx="7" cy="18" r="2"/>',
|
|
3929
|
+
"undo": '<path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11"/>',
|
|
3930
|
+
"unplug": '<path d="m19 5 3-3"/><path d="m2 22 3-3"/><path d="M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z"/><path d="M7.5 13.5 10 11"/><path d="M10.5 16.5 13 14"/><path d="m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z"/>',
|
|
3931
|
+
"user": '<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>',
|
|
3932
|
+
"users": '<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><path d="M16 3.128a4 4 0 0 1 0 7.744"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><circle cx="9" cy="7" r="4"/>',
|
|
3933
|
+
"video": '<path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/>',
|
|
3934
|
+
"webhook": '<path d="M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2"/><path d="m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06"/><path d="m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8"/>',
|
|
3935
|
+
"wifi": '<path d="M12 20h.01"/><path d="M2 8.82a15 15 0 0 1 20 0"/><path d="M5 12.859a10 10 0 0 1 14 0"/><path d="M8.5 16.429a5 5 0 0 1 7 0"/>',
|
|
3936
|
+
"workflow": '<rect width="8" height="8" x="3" y="3" rx="2"/><path d="M7 11v4a2 2 0 0 0 2 2h4"/><rect width="8" height="8" x="13" y="13" rx="2"/>',
|
|
3937
|
+
"x": '<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',
|
|
3938
|
+
"zap": '<path d="M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z"/>'
|
|
3939
|
+
};
|
|
3940
|
+
function readIsoPlan(raw) {
|
|
3941
|
+
if (!raw || typeof raw !== "object") return null;
|
|
3942
|
+
const plan = raw;
|
|
3943
|
+
if (plan.kind !== "iso" || !Array.isArray(plan.steps) || !plan.steps.length) return null;
|
|
3944
|
+
const steps = plan.steps.filter((s) => !!s && typeof s === "object").map((s) => ({ ...s, say: typeof s.say === "string" ? s.say : "", do: Array.isArray(s.do) ? s.do.filter((a) => a && typeof a === "object") : [] }));
|
|
3945
|
+
if (!steps.length) return null;
|
|
3946
|
+
return {
|
|
3947
|
+
kind: "iso",
|
|
3948
|
+
lesson: plan.lesson === true,
|
|
3949
|
+
title: typeof plan.title === "string" ? plan.title : "How it works",
|
|
3950
|
+
summary: typeof plan.summary === "string" ? plan.summary : void 0,
|
|
3951
|
+
sample: plan.sample === true,
|
|
3952
|
+
metrics: Array.isArray(plan.metrics) ? plan.metrics.filter((m) => m && typeof m.id === "string") : [],
|
|
3953
|
+
goals: Array.isArray(plan.goals) ? plan.goals : [],
|
|
3954
|
+
steps
|
|
3955
|
+
};
|
|
3956
|
+
}
|
|
3957
|
+
const HW = 60;
|
|
3958
|
+
const HH = 30;
|
|
3959
|
+
const P = (c, r, z = 0) => [(c - r) * HW, (c + r) * HH - z];
|
|
3960
|
+
const f1 = (n) => String(Math.round(n * 10) / 10);
|
|
3961
|
+
const pt = (p) => `${f1(p[0])},${f1(p[1])}`;
|
|
3962
|
+
const clamp01 = (t) => Math.max(0, Math.min(1, t));
|
|
3963
|
+
const lerp = (a, b, t) => a + (b - a) * t;
|
|
3964
|
+
const esc = (s) => String(s != null ? s : "").replace(/[&<>"]/g, (ch) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[ch]);
|
|
3965
|
+
const ease = {
|
|
3966
|
+
inOut: (t) => t < 0.5 ? 4 * t * t * t : 1 - (-2 * t + 2) ** 3 / 2,
|
|
3967
|
+
out: (t) => 1 - (1 - t) ** 3,
|
|
3968
|
+
pop: (t) => 1 + 2.4 * (t - 1) ** 3 + 1.4 * (t - 1) ** 2
|
|
3969
|
+
};
|
|
3970
|
+
const LINE = "#1f2430";
|
|
3971
|
+
const MONO = "ui-monospace, 'SF Mono', Menlo, Consolas, monospace";
|
|
3972
|
+
const COLORS = {
|
|
3973
|
+
blue: ["#cfe0ff", "#a9c4f5", "#8eaee8", "#1e3a8a"],
|
|
3974
|
+
orange: ["#ffd9b8", "#f9b98a", "#ee9f6a", "#7c2d12"],
|
|
3975
|
+
purple: ["#e6dcff", "#cbbaf7", "#b29ded", "#4c1d95"],
|
|
3976
|
+
green: ["#d3f2d8", "#a9e0b4", "#8acb98", "#14532d"],
|
|
3977
|
+
yellow: ["#fff0bf", "#fbdb80", "#f0c75c", "#713f12"],
|
|
3978
|
+
teal: ["#cdf3ee", "#9fded5", "#7fcbc1", "#134e4a"],
|
|
3979
|
+
rose: ["#ffdbe3", "#f6b2c1", "#e996a9", "#881337"],
|
|
3980
|
+
slate: ["#e6eaf1", "#c8d0dc", "#b0bacb", "#1e293b"],
|
|
3981
|
+
sand: ["#f3ece0", "#e2d6c2", "#d2c3aa", "#44403c"],
|
|
3982
|
+
hot: ["#ffd0cc", "#f59b94", "#e5776f", "#7f1d1d"],
|
|
3983
|
+
down: ["#e4e4e7", "#c4c4cb", "#a8a8b2", "#52525b"]
|
|
3984
|
+
};
|
|
3985
|
+
const ICON_COLOR = Object.fromEntries([
|
|
3986
|
+
...["balancer", "signpost", "route", "network", "webhook", "share", "merge", "filter"].map((i) => [i, "orange"]),
|
|
3987
|
+
...["zap", "cpu", "settings", "check", "refresh", "rocket", "flask", "hammer", "sparkles", "git"].map((i) => [i, "green"]),
|
|
3988
|
+
...["globe", "clock", "calendar", "bank", "card", "dollar", "receipt", "store", "cart", "truck", "plane", "hotel", "car", "mail", "bell"].map((i) => [i, "yellow"]),
|
|
3989
|
+
...["inbox", "layers", "radio", "activity", "workflow", "boxes", "package", "message"].map((i) => [i, "teal"]),
|
|
3990
|
+
...["shield", "lock", "key", "fingerprint", "user", "users", "eye", "siren", "alert", "ban", "bug", "heart", "stethoscope"].map((i) => [i, "rose"]),
|
|
3991
|
+
...["database", "file", "table", "chart", "list", "scroll", "clipboard", "hash", "book", "image", "video", "camera"].map((i) => [i, "purple"])
|
|
3992
|
+
]);
|
|
3993
|
+
const TONE = { ink: LINE, blue: "#2563eb", red: "#dc2626", green: "#15803d", amber: "#b45309" };
|
|
3994
|
+
const TONE_BG = { ink: "#ffffff", blue: "#e0eaff", red: "#fee2e2", green: "#dcfce7", amber: "#fef3c7" };
|
|
3995
|
+
const PACKETS = {
|
|
3996
|
+
request: { label: "request", color: "#f28c3c" },
|
|
3997
|
+
response: { label: "response", color: "#22a35a" },
|
|
3998
|
+
write: { label: "write", color: "#334155" },
|
|
3999
|
+
heavy: { label: "heavy request", color: "#e8692a" },
|
|
4000
|
+
ping: { label: "health check", color: "#22a35a" },
|
|
4001
|
+
event: { label: "event", color: "#e0a400" },
|
|
4002
|
+
fail: { label: "failed request", color: "#dc2626" },
|
|
4003
|
+
data: { label: "data", color: "#8b5cf6" }
|
|
4004
|
+
};
|
|
4005
|
+
const PEOPLE = ["#f6b26b", "#9fc5e8", "#b4a7d6", "#93c47d", "#f4cccc", "#ffd966", "#a2c4c9"];
|
|
4006
|
+
const KINDS = {
|
|
4007
|
+
service: { r: 0.44, top: 42 },
|
|
4008
|
+
database: { r: 0.3, top: 46 },
|
|
4009
|
+
laptop: { r: 0.4, top: 46 },
|
|
4010
|
+
phone: { r: 0.4, top: 52 },
|
|
4011
|
+
crowd: { r: 0.5, top: 30 },
|
|
4012
|
+
queue: { r: 0.35, top: 12 },
|
|
4013
|
+
pages: { r: 0.35, top: 12 },
|
|
4014
|
+
ghost: { r: 0.44, top: 40 }
|
|
4015
|
+
};
|
|
4016
|
+
function icon(name, x, y, size, color, sw = 2) {
|
|
4017
|
+
var _a, _b;
|
|
4018
|
+
const body = (_b = (_a = ISO_ICONS[name]) != null ? _a : ISO_ICONS.box) != null ? _b : "";
|
|
4019
|
+
return `<g transform="translate(${f1(x - size / 2)} ${f1(y - size / 2)}) scale(${size / 24})" fill="none" stroke="${color}" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round">${body}</g>`;
|
|
4020
|
+
}
|
|
4021
|
+
function rounded(pts, r) {
|
|
4022
|
+
let d = "";
|
|
4023
|
+
const n = pts.length;
|
|
4024
|
+
for (let i = 0; i < n; i++) {
|
|
4025
|
+
const a = pts[(i - 1 + n) % n], b = pts[i], c = pts[(i + 1) % n];
|
|
4026
|
+
d += `${i ? "L" : "M"}${pt(cut(b, a, r))} Q${pt(b)} ${pt(cut(b, c, r))} `;
|
|
4027
|
+
}
|
|
4028
|
+
return d + "Z";
|
|
4029
|
+
}
|
|
4030
|
+
function cut(p, q, r) {
|
|
4031
|
+
const L = Math.hypot(q[0] - p[0], q[1] - p[1]) || 1;
|
|
4032
|
+
const k = Math.min(r, L / 2) / L;
|
|
4033
|
+
return [p[0] + (q[0] - p[0]) * k, p[1] + (q[1] - p[1]) * k];
|
|
4034
|
+
}
|
|
4035
|
+
function roundedPath(pts, r) {
|
|
4036
|
+
if (pts.length < 3) return "M" + pts.map(pt).join(" L");
|
|
4037
|
+
let d = "M" + pt(pts[0]);
|
|
4038
|
+
for (let i = 1; i < pts.length - 1; i++) d += ` L${pt(cut(pts[i], pts[i - 1], r))} Q${pt(pts[i])} ${pt(cut(pts[i], pts[i + 1], r))}`;
|
|
4039
|
+
return d + ` L${pt(pts[pts.length - 1])}`;
|
|
4040
|
+
}
|
|
4041
|
+
function along(pts, f) {
|
|
4042
|
+
const seg = [];
|
|
4043
|
+
let total = 0;
|
|
4044
|
+
for (let k = 1; k < pts.length; k++) {
|
|
4045
|
+
const L = Math.hypot(pts[k][0] - pts[k - 1][0], pts[k][1] - pts[k - 1][1]);
|
|
4046
|
+
seg.push(L);
|
|
4047
|
+
total += L;
|
|
4048
|
+
}
|
|
4049
|
+
let want = f * total;
|
|
4050
|
+
for (let k = 0; k < seg.length; k++) {
|
|
4051
|
+
if (want <= seg[k] || k === seg.length - 1) {
|
|
4052
|
+
const q = seg[k] ? want / seg[k] : 0;
|
|
4053
|
+
return [lerp(pts[k][0], pts[k + 1][0], q), lerp(pts[k][1], pts[k + 1][1], q)];
|
|
4054
|
+
}
|
|
4055
|
+
want -= seg[k];
|
|
4056
|
+
}
|
|
4057
|
+
return pts[0];
|
|
4058
|
+
}
|
|
4059
|
+
class Defs {
|
|
4060
|
+
constructor() {
|
|
4061
|
+
this.n = 0;
|
|
4062
|
+
this.out = [];
|
|
4063
|
+
}
|
|
4064
|
+
id(prefix) {
|
|
4065
|
+
this.n += 1;
|
|
4066
|
+
return `${prefix}${this.n}`;
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
function roundBox(c, r, w, d, z0, h, pal, defs, radius = 9, sw = 1.6) {
|
|
4070
|
+
const x0 = c - w / 2, x1 = c + w / 2, r0 = r - d / 2, r1 = r + d / 2, zt = z0 + h;
|
|
4071
|
+
const sil = [P(x0, r0, zt), P(x1, r0, zt), P(x1, r0, z0), P(x1, r1, z0), P(x0, r1, z0), P(x0, r1, zt)];
|
|
4072
|
+
const id2 = defs.id("ic");
|
|
4073
|
+
defs.out.push(`<clipPath id="${id2}"><path d="${rounded(sil, radius)}"/></clipPath>`);
|
|
4074
|
+
const left = [P(x0 - 1, r1, zt + 40), P(x1, r1, zt + 40), P(x1, r1, z0 - 40), P(x0 - 1, r1, z0 - 40)];
|
|
4075
|
+
const top = [P(x0, r0, zt), P(x1, r0, zt), P(x1, r1, zt), P(x0, r1, zt)];
|
|
4076
|
+
return `<path d="${rounded(sil, radius)}" fill="${pal[2]}"/><g clip-path="url(#${id2})"><polygon points="${left.map(pt).join(" ")}" fill="${pal[1]}"/></g><path d="${rounded(top, radius * 0.8)}" fill="${pal[0]}" stroke="${LINE}" stroke-width="${sw * 0.7}" stroke-opacity=".55"/><path d="${rounded(sil, radius)}" fill="none" stroke="${LINE}" stroke-width="${sw}" stroke-linejoin="round"/>`;
|
|
4077
|
+
}
|
|
4078
|
+
function cylinder(c, r, R, z0, h, pal, defs) {
|
|
4079
|
+
const rx = R * HW * Math.SQRT2, ry = R * HH * Math.SQRT2;
|
|
4080
|
+
const [bx, by] = P(c, r, z0), [tx, ty] = P(c, r, z0 + h);
|
|
4081
|
+
const id2 = defs.id("ig");
|
|
4082
|
+
defs.out.push(`<linearGradient id="${id2}" x1="0" x2="1"><stop offset="0" stop-color="${pal[1]}"/><stop offset=".5" stop-color="${pal[1]}"/><stop offset="1" stop-color="${pal[2]}"/></linearGradient>`);
|
|
4083
|
+
return `<path d="M${f1(bx - rx)},${f1(by)} A${f1(rx)},${f1(ry)} 0 0 0 ${f1(bx + rx)},${f1(by)} L${f1(tx + rx)},${f1(ty)} L${f1(tx - rx)},${f1(ty)} Z" fill="url(#${id2})" stroke="${LINE}" stroke-width="1.6"/><ellipse cx="${f1(tx)}" cy="${f1(ty)}" rx="${f1(rx)}" ry="${f1(ry)}" fill="${pal[0]}" stroke="${LINE}" stroke-width="1.6"/>`;
|
|
4084
|
+
}
|
|
4085
|
+
function pill(x, y, text, o = {}) {
|
|
4086
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
4087
|
+
const fs = (_a = o.fs) != null ? _a : 11, ic = o.icon ? fs + 4 : 0, w = text.length * fs * 0.6 + 16 + ic, h = fs + 10;
|
|
4088
|
+
const tone2 = (_b = o.tone) != null ? _b : "ink";
|
|
4089
|
+
const bg = (_d = (_c = o.bg) != null ? _c : TONE_BG[tone2]) != null ? _d : "#fff", ink = (_f = (_e = o.ink) != null ? _e : TONE[tone2]) != null ? _f : LINE;
|
|
4090
|
+
const x0 = o.anchor === "start" ? x : x - w / 2;
|
|
4091
|
+
return {
|
|
4092
|
+
w,
|
|
4093
|
+
h,
|
|
4094
|
+
x0,
|
|
4095
|
+
y0: y - h / 2,
|
|
4096
|
+
svg: `<g opacity="${(_g = o.alpha) != null ? _g : 1}"><rect x="${f1(x0)}" y="${f1(y - h / 2)}" width="${f1(w)}" height="${h}" rx="${h / 2}" fill="${bg}" stroke="${tone2 === "ink" ? LINE : ink}" stroke-width="1.3"/>` + (o.icon ? icon(o.icon, x0 + 8 + fs / 2, y, fs + 1, ink, 2.2) : "") + `<text x="${f1(x0 + 8 + ic + (w - 16 - ic) / 2)}" y="${f1(y + fs * 0.36)}" text-anchor="middle" font-size="${fs}" font-weight="600" fill="${ink}">${esc(text)}</text></g>`
|
|
4097
|
+
};
|
|
4098
|
+
}
|
|
4099
|
+
const cross = (x, y, s) => `<path d="M${f1(x - s)},${f1(y - s * 0.7)} L${f1(x + s)},${f1(y + s * 0.7)} M${f1(x + s)},${f1(y - s * 0.7)} L${f1(x - s)},${f1(y + s * 0.7)}" stroke="#dc2626" stroke-width="3.2" stroke-linecap="round"/>`;
|
|
4100
|
+
function person(c, r, z, col) {
|
|
4101
|
+
const [bx, by] = P(c, r, z), [hx, hy] = P(c, r, z + 19);
|
|
4102
|
+
return `<path d="M${f1(bx - 4.5)},${f1(by)} L${f1(bx - 4.5)},${f1(by - 11)} Q${f1(bx - 4.5)},${f1(by - 15)} ${f1(bx)},${f1(by - 15)} Q${f1(bx + 4.5)},${f1(by - 15)} ${f1(bx + 4.5)},${f1(by - 11)} L${f1(bx + 4.5)},${f1(by)} Z" fill="${col}" stroke="${LINE}" stroke-width="1.1"/><circle cx="${f1(hx)}" cy="${f1(hy)}" r="4.2" fill="#fde7d6" stroke="${LINE}" stroke-width="1.1"/>`;
|
|
4103
|
+
}
|
|
4104
|
+
function splitLabel(t) {
|
|
4105
|
+
const words = t.split(/\s+/).filter(Boolean);
|
|
4106
|
+
if (t.length <= 10 || words.length < 2) return [t];
|
|
4107
|
+
const mid = Math.ceil(words.length / 2);
|
|
4108
|
+
return [words.slice(0, mid).join(" "), words.slice(mid).join(" ")];
|
|
4109
|
+
}
|
|
4110
|
+
const SECONDS = {
|
|
4111
|
+
ms: 1e-3,
|
|
4112
|
+
s: 1,
|
|
4113
|
+
sec: 1,
|
|
4114
|
+
secs: 1,
|
|
4115
|
+
second: 1,
|
|
4116
|
+
seconds: 1,
|
|
4117
|
+
min: 60,
|
|
4118
|
+
mins: 60,
|
|
4119
|
+
minute: 60,
|
|
4120
|
+
minutes: 60,
|
|
4121
|
+
h: 3600,
|
|
4122
|
+
hr: 3600,
|
|
4123
|
+
hrs: 3600,
|
|
4124
|
+
hour: 3600,
|
|
4125
|
+
hours: 3600,
|
|
4126
|
+
d: 86400,
|
|
4127
|
+
day: 86400,
|
|
4128
|
+
days: 86400,
|
|
4129
|
+
wk: 604800,
|
|
4130
|
+
week: 604800,
|
|
4131
|
+
weeks: 604800,
|
|
4132
|
+
month: 2592e3,
|
|
4133
|
+
months: 2592e3,
|
|
4134
|
+
year: 31536e3,
|
|
4135
|
+
years: 31536e3
|
|
4136
|
+
};
|
|
4137
|
+
const SCALE = { k: 1e3, K: 1e3, M: 1e6, bn: 1e9, B: 1e9 };
|
|
4138
|
+
function measure(text) {
|
|
4139
|
+
const m = text.replace(/,/g, "").match(/(-?\d+(?:\.\d+)?)\s*([A-Za-z]+)?(?:\s*\/\s*([A-Za-z]+))?/);
|
|
4140
|
+
if (!m) return NaN;
|
|
4141
|
+
let v = parseFloat(m[1]);
|
|
4142
|
+
const unit = m[2], per = m[3];
|
|
4143
|
+
if (unit && SECONDS[unit.toLowerCase()]) v *= SECONDS[unit.toLowerCase()];
|
|
4144
|
+
else if (unit && SCALE[unit]) v *= SCALE[unit];
|
|
4145
|
+
if (per && SECONDS[per.toLowerCase()]) v /= SECONDS[per.toLowerCase()];
|
|
4146
|
+
return v;
|
|
4147
|
+
}
|
|
4148
|
+
const DUR = { flow: 400, add: 620, zone: 500, link: 520, send: 1500, move: 850, state: 600, gauge: 900, tag: 380, untag: 300, count: 1e3, panel: 450, remove: 450, pulse: 900 };
|
|
4149
|
+
const KIND_OF = (a) => Object.keys(DUR).find((k) => k in a);
|
|
4150
|
+
const str = (v) => typeof v === "string" ? v : v == null ? "" : String(v);
|
|
4151
|
+
const num = (v, d = 0) => typeof v === "number" && Number.isFinite(v) ? v : d;
|
|
4152
|
+
function timeline(actions) {
|
|
4153
|
+
let cursor = 0, prev = null, groupEnd = 0, lane = 0;
|
|
4154
|
+
return actions.filter((a) => KIND_OF(a)).map((a) => {
|
|
4155
|
+
const kind = KIND_OF(a);
|
|
4156
|
+
if (kind !== prev) {
|
|
4157
|
+
cursor = groupEnd;
|
|
4158
|
+
lane = 0;
|
|
4159
|
+
prev = kind;
|
|
4160
|
+
}
|
|
4161
|
+
const start = cursor + lane++ * (kind === "send" ? 200 : 110);
|
|
4162
|
+
const dur = DUR[kind];
|
|
4163
|
+
groupEnd = Math.max(groupEnd, start + dur);
|
|
4164
|
+
return { a, kind, start, dur };
|
|
4165
|
+
});
|
|
4166
|
+
}
|
|
4167
|
+
function pathId(W, a, b) {
|
|
4168
|
+
for (const [id2, l] of W.links) if (l.from === a && l.to === b || l.from === b && l.to === a) return id2;
|
|
4169
|
+
return `${a}>${b}`;
|
|
4170
|
+
}
|
|
4171
|
+
function ensurePath(W, a, b, p) {
|
|
4172
|
+
if (!W.objs.has(a) || !W.objs.has(b)) return null;
|
|
4173
|
+
const id2 = pathId(W, a, b);
|
|
4174
|
+
if (!W.links.has(id2)) W.links.set(id2, { id: id2, from: a, to: b, style: "solid", draw: p });
|
|
4175
|
+
return id2;
|
|
4176
|
+
}
|
|
4177
|
+
class IsoDrawing {
|
|
4178
|
+
constructor(plan, reducedMotion = false) {
|
|
4179
|
+
this.reducedMotion = reducedMotion;
|
|
4180
|
+
this.cells = [-2, -2, 10, 8];
|
|
4181
|
+
this.vb = [0, 0, 640, 400];
|
|
4182
|
+
this.plan = plan;
|
|
4183
|
+
this.spread();
|
|
4184
|
+
this.fit();
|
|
4185
|
+
}
|
|
4186
|
+
/** The camera: it frames everything the plan ever draws. */
|
|
4187
|
+
get viewBox() {
|
|
4188
|
+
return this.vb.map((v) => v.toFixed(0)).join(" ");
|
|
4189
|
+
}
|
|
4190
|
+
get steps() {
|
|
4191
|
+
return this.plan.steps;
|
|
4192
|
+
}
|
|
4193
|
+
/** How long step *i*'s own animation runs (ms at speed 1), before its line is read. */
|
|
4194
|
+
stepDuration(i) {
|
|
4195
|
+
var _a, _b;
|
|
4196
|
+
if (this.reducedMotion) return 0;
|
|
4197
|
+
const tl = timeline((_b = (_a = this.plan.steps[i]) == null ? void 0 : _a.do) != null ? _b : []);
|
|
4198
|
+
return tl.reduce((m, e) => Math.max(m, e.start + e.dur), 0) + 300;
|
|
4199
|
+
}
|
|
4200
|
+
// -------------------------------------------------------------- layout
|
|
4201
|
+
/** Two things on one screen diagonal would hide each other: nudge the later one along. */
|
|
4202
|
+
spread() {
|
|
4203
|
+
const placed = [];
|
|
4204
|
+
for (const st of this.plan.steps) {
|
|
4205
|
+
if (st.clear) placed.length = 0;
|
|
4206
|
+
for (const a of st.do) {
|
|
4207
|
+
if (typeof a.add !== "string" || !Array.isArray(a.at) || a.is === "queue" || a.is === "pages") continue;
|
|
4208
|
+
let c = num(a.at[0]), r = num(a.at[1]);
|
|
4209
|
+
const others = placed.filter((q) => q[2] !== a.add);
|
|
4210
|
+
const tries = [[0, 0], [1, 0], [0, 1], [-1, 0], [0, -1], [2, 0], [0, 2], [1, -1], [-1, 1]];
|
|
4211
|
+
const free = tries.find(([dc, dr]) => !others.some(([pc, pr]) => Math.abs(c + dc - r - dr - (pc - pr)) < 1.5 && Math.abs(c + dc + r + dr - (pc + pr)) < 3.4));
|
|
4212
|
+
if (free) {
|
|
4213
|
+
c += free[0];
|
|
4214
|
+
r += free[1];
|
|
4215
|
+
}
|
|
4216
|
+
a.at = [c, r];
|
|
4217
|
+
placed.push([c, r, a.add]);
|
|
4218
|
+
}
|
|
4219
|
+
}
|
|
4220
|
+
}
|
|
4221
|
+
/** The camera frames everything the plan ever draws, so it never jumps between steps. */
|
|
4222
|
+
fit() {
|
|
4223
|
+
const xs = [], ys = [];
|
|
4224
|
+
const take = (c, r, up, down) => {
|
|
4225
|
+
const [x2, y2] = P(c, r);
|
|
4226
|
+
xs.push(x2 - 75, x2 + 75);
|
|
4227
|
+
ys.push(y2 - up, y2 + down);
|
|
4228
|
+
};
|
|
4229
|
+
let left = false, right = false;
|
|
4230
|
+
for (const st of this.plan.steps) for (const a of st.do) {
|
|
4231
|
+
if (typeof a.add === "string" && Array.isArray(a.at)) {
|
|
4232
|
+
const c = num(a.at[0]) + 0.5, r = num(a.at[1]) + 0.5;
|
|
4233
|
+
take(c, r, a.is === "service" || !a.is ? 140 : 110, 55);
|
|
4234
|
+
if (["database", "queue", "pages"].includes(str(a.is)) && a.label) xs.push(P(c, r)[0] + 70 + str(a.label).length * 7.5);
|
|
4235
|
+
}
|
|
4236
|
+
if (typeof a.move === "string" && Array.isArray(a.to)) take(num(a.to[0]) + 0.5, num(a.to[1]) + 0.5, 120, 50);
|
|
4237
|
+
if (typeof a.zone === "string" && Array.isArray(a.at)) {
|
|
4238
|
+
const [c, r, w2 = 2, d = 2] = a.at.map((v) => num(v));
|
|
4239
|
+
for (const [cc, rr] of [[c, r], [c + w2, r], [c + w2, r + d], [c, r + d]]) take(cc, rr, 10, 10);
|
|
4240
|
+
}
|
|
4241
|
+
if (typeof a.panel === "string") {
|
|
4242
|
+
if (str(a.at).includes("left")) left = true;
|
|
4243
|
+
else right = true;
|
|
4244
|
+
}
|
|
4245
|
+
}
|
|
4246
|
+
if (!xs.length) take(3, 2, 100, 100);
|
|
4247
|
+
let x = Math.min(...xs) - 20 - (left ? 290 : 0);
|
|
4248
|
+
let w = Math.max(...xs) - x + 20 + (right ? 290 : 0);
|
|
4249
|
+
let y = Math.min(...ys) - 60;
|
|
4250
|
+
let h = Math.max(...ys) - y + 26;
|
|
4251
|
+
const want = 1.6;
|
|
4252
|
+
if (w / h < want) {
|
|
4253
|
+
const nw = h * want;
|
|
4254
|
+
x -= (nw - w) / 2;
|
|
4255
|
+
w = nw;
|
|
4256
|
+
} else {
|
|
4257
|
+
const nh = w / want;
|
|
4258
|
+
y -= (nh - h) / 2;
|
|
4259
|
+
h = nh;
|
|
4260
|
+
}
|
|
4261
|
+
this.vb = [x, y, w, h];
|
|
4262
|
+
}
|
|
4263
|
+
/** The kinds of parcel this plan sends, for the key under the scene. */
|
|
4264
|
+
legend() {
|
|
4265
|
+
const kinds = /* @__PURE__ */ new Set();
|
|
4266
|
+
for (const st of this.plan.steps) for (const a of st.do) {
|
|
4267
|
+
if (a.send || a.flow) {
|
|
4268
|
+
kinds.add(PACKETS[str(a.kind)] ? str(a.kind) : "request");
|
|
4269
|
+
if (a.bounce) kinds.add("response");
|
|
4270
|
+
if (num(a.fail) > 0) kinds.add("fail");
|
|
4271
|
+
}
|
|
4272
|
+
}
|
|
4273
|
+
return [...kinds].map((k) => ({ kind: k, label: PACKETS[k].label, color: PACKETS[k].color, ring: k === "ping" }));
|
|
4274
|
+
}
|
|
4275
|
+
/** The metric tiles as they stand at step *i*: each value, and whether it got better or worse. */
|
|
4276
|
+
metrics(i) {
|
|
4277
|
+
var _a, _b, _c, _d;
|
|
4278
|
+
const defs = this.plan.metrics;
|
|
4279
|
+
const ids = new Set(defs.map((m) => m.id));
|
|
4280
|
+
const fromActions = (st) => Object.fromEntries(st.do.filter((a) => typeof a.count === "string" && ids.has(a.count)).map((a) => [a.count, str(a.to)]));
|
|
4281
|
+
const vals = {};
|
|
4282
|
+
for (let k = 0; k <= i && k < this.plan.steps.length; k++) Object.assign(vals, (_a = this.plan.steps[k].metrics) != null ? _a : {}, fromActions(this.plan.steps[k]));
|
|
4283
|
+
const changed = /* @__PURE__ */ new Set([...Object.keys((_c = (_b = this.plan.steps[i]) == null ? void 0 : _b.metrics) != null ? _c : {}), ...Object.keys(fromActions((_d = this.plan.steps[i]) != null ? _d : { do: [] }))]);
|
|
4284
|
+
const value = (x) => measure(str(Array.isArray(x) ? x[0] : x));
|
|
4285
|
+
return defs.map((m) => {
|
|
4286
|
+
const v = vals[m.id];
|
|
4287
|
+
const text = (v == null ? "–" : str(Array.isArray(v) ? v[0] : v)).slice(0, 20);
|
|
4288
|
+
let tone2 = Array.isArray(v) ? str(v[1]) : "";
|
|
4289
|
+
if (!tone2 && m.better && v != null) {
|
|
4290
|
+
const first = this.plan.steps.map((st) => {
|
|
4291
|
+
var _a2;
|
|
4292
|
+
return ((_a2 = st.metrics) != null ? _a2 : {})[m.id];
|
|
4293
|
+
}).find((x) => x != null);
|
|
4294
|
+
const a0 = value(first), a1 = value(v);
|
|
4295
|
+
if (Number.isFinite(a0) && Number.isFinite(a1) && a0 !== a1) tone2 = (m.better === "low" ? a1 < a0 : a1 > a0) ? "good" : "bad";
|
|
4296
|
+
}
|
|
4297
|
+
const known = tone2 === "good" || tone2 === "bad" || tone2 === "warn" ? tone2 : "";
|
|
4298
|
+
return { id: m.id, label: m.label, text, tone: known, changed: changed.has(m.id), icon: m.icon && ISO_ICONS[m.icon] ? m.icon : void 0 };
|
|
4299
|
+
});
|
|
4300
|
+
}
|
|
4301
|
+
// -------------------------------------------------------------- the world at a moment
|
|
4302
|
+
world(i, t, live) {
|
|
4303
|
+
var _a;
|
|
4304
|
+
const W = { objs: /* @__PURE__ */ new Map(), links: /* @__PURE__ */ new Map(), zones: /* @__PURE__ */ new Map(), panels: /* @__PURE__ */ new Map(), flows: /* @__PURE__ */ new Map() };
|
|
4305
|
+
for (let k = 0; k < i; k++) this.apply(W, this.plan.steps[k], Infinity, null);
|
|
4306
|
+
this.apply(W, (_a = this.plan.steps[i]) != null ? _a : { say: "", do: [] }, t, live);
|
|
4307
|
+
return W;
|
|
4308
|
+
}
|
|
4309
|
+
apply(W, step, t, live) {
|
|
4310
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j2, _k, _l, _m;
|
|
4311
|
+
if (step.clear) {
|
|
4312
|
+
W.objs.clear();
|
|
4313
|
+
W.links.clear();
|
|
4314
|
+
W.zones.clear();
|
|
4315
|
+
W.panels.clear();
|
|
4316
|
+
W.flows.clear();
|
|
4317
|
+
}
|
|
4318
|
+
for (const ev of timeline(step.do)) {
|
|
4319
|
+
if (t !== Infinity && t < ev.start) continue;
|
|
4320
|
+
const p = t === Infinity ? 1 : clamp01((t - ev.start) / ev.dur);
|
|
4321
|
+
const a = ev.a;
|
|
4322
|
+
const id2 = str(a[ev.kind]);
|
|
4323
|
+
const o = W.objs.get(id2);
|
|
4324
|
+
switch (ev.kind) {
|
|
4325
|
+
case "add": {
|
|
4326
|
+
const prev = W.objs.get(id2);
|
|
4327
|
+
const at = Array.isArray(a.at) ? [num(a.at[0]) + 0.5, num(a.at[1]) + 0.5] : prev ? [prev.c, prev.r] : null;
|
|
4328
|
+
if (!at) break;
|
|
4329
|
+
const is = KINDS[str(a.is)] ? str(a.is) : "service";
|
|
4330
|
+
W.objs.set(id2, {
|
|
4331
|
+
...prev != null ? prev : { tags: [] },
|
|
4332
|
+
id: id2,
|
|
4333
|
+
is,
|
|
4334
|
+
c: at[0],
|
|
4335
|
+
r: at[1],
|
|
4336
|
+
label: str(a.label) || (prev == null ? void 0 : prev.label),
|
|
4337
|
+
sub: a.sub ? str(a.sub) : void 0,
|
|
4338
|
+
icon: a.icon ? str(a.icon) : void 0,
|
|
4339
|
+
color: a.color ? str(a.color) : void 0,
|
|
4340
|
+
big: a.big === true,
|
|
4341
|
+
count: a.count != null ? num(a.count) : prev == null ? void 0 : prev.count,
|
|
4342
|
+
dir: a.dir ? str(a.dir) : void 0,
|
|
4343
|
+
fill: a.fill != null ? num(a.fill) : void 0,
|
|
4344
|
+
rise: p,
|
|
4345
|
+
tags: (_a = prev == null ? void 0 : prev.tags) != null ? _a : []
|
|
4346
|
+
});
|
|
4347
|
+
break;
|
|
4348
|
+
}
|
|
4349
|
+
case "zone": {
|
|
4350
|
+
if (!Array.isArray(a.at)) break;
|
|
4351
|
+
const [c, r, w, d] = a.at.map((v) => num(v));
|
|
4352
|
+
W.zones.set(id2, { c, r, w: w || 2, d: d || 2, label: str(a.label), tone: a.tone ? str(a.tone) : void 0, p });
|
|
4353
|
+
break;
|
|
4354
|
+
}
|
|
4355
|
+
case "link": {
|
|
4356
|
+
const ends = Array.isArray(a.link) ? a.link.map(str) : [];
|
|
4357
|
+
if (ends.length !== 2) break;
|
|
4358
|
+
const lid = pathId(W, ends[0], ends[1]);
|
|
4359
|
+
const prev = W.links.get(lid);
|
|
4360
|
+
W.links.set(lid, {
|
|
4361
|
+
id: lid,
|
|
4362
|
+
from: (_b = prev == null ? void 0 : prev.from) != null ? _b : ends[0],
|
|
4363
|
+
to: (_c = prev == null ? void 0 : prev.to) != null ? _c : ends[1],
|
|
4364
|
+
label: a.label ? str(a.label) : prev == null ? void 0 : prev.label,
|
|
4365
|
+
both: a.both === true || (prev == null ? void 0 : prev.both),
|
|
4366
|
+
style: a.style ? str(a.style) : (_d = prev == null ? void 0 : prev.style) != null ? _d : "solid",
|
|
4367
|
+
draw: prev ? 1 : p
|
|
4368
|
+
});
|
|
4369
|
+
break;
|
|
4370
|
+
}
|
|
4371
|
+
case "flow": {
|
|
4372
|
+
const prev = W.flows.get(id2);
|
|
4373
|
+
const via = Array.isArray(a.via) ? a.via.map(str) : (_e = prev == null ? void 0 : prev.via) != null ? _e : [];
|
|
4374
|
+
if (a.rate === 0) {
|
|
4375
|
+
W.flows.delete(id2);
|
|
4376
|
+
break;
|
|
4377
|
+
}
|
|
4378
|
+
for (let k = 0; k < via.length - 1; k++) ensurePath(W, via[k], via[k + 1], p);
|
|
4379
|
+
W.flows.set(id2, { via, rate: a.rate != null ? num(a.rate, 1) : (_f = prev == null ? void 0 : prev.rate) != null ? _f : 1, bounce: a.bounce === true || (prev == null ? void 0 : prev.bounce), fail: a.fail != null ? num(a.fail) : (_g = prev == null ? void 0 : prev.fail) != null ? _g : 0, kind: a.kind ? str(a.kind) : (_h = prev == null ? void 0 : prev.kind) != null ? _h : "request" });
|
|
4380
|
+
break;
|
|
4381
|
+
}
|
|
4382
|
+
case "send": {
|
|
4383
|
+
const ends = Array.isArray(a.send) ? a.send.map(str) : [];
|
|
4384
|
+
if (ends.length !== 2) break;
|
|
4385
|
+
const lid = ensurePath(W, ends[0], ends[1], p);
|
|
4386
|
+
if (live && p < 1 && lid) live.push({ a: { ...a, send: lid, back: ((_i = W.links.get(lid)) == null ? void 0 : _i.from) !== ends[0] }, p, dur: ev.dur });
|
|
4387
|
+
break;
|
|
4388
|
+
}
|
|
4389
|
+
case "panel":
|
|
4390
|
+
W.panels.set(id2, { ...a, p });
|
|
4391
|
+
break;
|
|
4392
|
+
case "remove":
|
|
4393
|
+
for (const m of [W.objs, W.links, W.zones, W.panels]) {
|
|
4394
|
+
const x = m.get(id2);
|
|
4395
|
+
if (x) {
|
|
4396
|
+
if (p >= 1) m.delete(id2);
|
|
4397
|
+
else x.alpha = 1 - p;
|
|
4398
|
+
}
|
|
4399
|
+
}
|
|
4400
|
+
if (p >= 1) {
|
|
4401
|
+
for (const [lid, l] of W.links) if (l.from === id2 || l.to === id2) W.links.delete(lid);
|
|
4402
|
+
}
|
|
4403
|
+
break;
|
|
4404
|
+
case "move":
|
|
4405
|
+
if (o && Array.isArray(a.to)) {
|
|
4406
|
+
if (!o.from) o.from = [o.c, o.r];
|
|
4407
|
+
const e = ease.inOut(p);
|
|
4408
|
+
o.c = lerp(o.from[0], num(a.to[0]) + 0.5, e);
|
|
4409
|
+
o.r = lerp(o.from[1], num(a.to[1]) + 0.5, e);
|
|
4410
|
+
if (p >= 1) delete o.from;
|
|
4411
|
+
}
|
|
4412
|
+
break;
|
|
4413
|
+
case "state": {
|
|
4414
|
+
const to = str(a.to);
|
|
4415
|
+
if (o) {
|
|
4416
|
+
o.state = to === "ok" ? null : to;
|
|
4417
|
+
o.shake = to === "down" && p < 1 ? p : 0;
|
|
4418
|
+
}
|
|
4419
|
+
break;
|
|
4420
|
+
}
|
|
4421
|
+
case "gauge":
|
|
4422
|
+
if (o) {
|
|
4423
|
+
if (o.gFrom == null) o.gFrom = (_j2 = o.gauge) != null ? _j2 : 0;
|
|
4424
|
+
o.gauge = lerp(o.gFrom, num(a.to), ease.out(p));
|
|
4425
|
+
if (p >= 1) delete o.gFrom;
|
|
4426
|
+
}
|
|
4427
|
+
break;
|
|
4428
|
+
case "tag":
|
|
4429
|
+
if (o) {
|
|
4430
|
+
o.tags = o.tags.filter((x) => x.text !== str(a.text));
|
|
4431
|
+
o.tags.push({ text: str(a.text), tone: a.tone ? str(a.tone) : void 0, icon: a.icon ? str(a.icon) : void 0, p });
|
|
4432
|
+
}
|
|
4433
|
+
break;
|
|
4434
|
+
case "untag":
|
|
4435
|
+
if (o) o.tags = o.tags.filter((x) => x.text !== str(a.text));
|
|
4436
|
+
break;
|
|
4437
|
+
case "count": {
|
|
4438
|
+
if (!o) break;
|
|
4439
|
+
const target = str(a.to), m = target.match(/-?[\d,.]+/);
|
|
4440
|
+
if (o.is === "crowd" || o.is === "queue" || o.is === "pages") {
|
|
4441
|
+
if (o.cFrom == null) o.cFrom = (_k = o.count) != null ? _k : 0;
|
|
4442
|
+
const end = m ? parseFloat(m[0].replace(/,/g, "")) : (_l = o.count) != null ? _l : 0;
|
|
4443
|
+
o.count = Math.round(lerp(o.cFrom, Math.min(end, o.is === "crowd" ? 40 : 16), ease.out(p)));
|
|
4444
|
+
if (p >= 1) delete o.cFrom;
|
|
4445
|
+
} else if (m && p < 1) {
|
|
4446
|
+
if (o.nFrom == null) o.nFrom = parseFloat(str((_m = o.badge) != null ? _m : "0").replace(/[^\d.-]/g, "")) || 0;
|
|
4447
|
+
const v = Math.round(lerp(o.nFrom, parseFloat(m[0].replace(/,/g, "")), ease.out(p)));
|
|
4448
|
+
o.badge = target.replace(m[0], v.toLocaleString("en-GB"));
|
|
4449
|
+
} else {
|
|
4450
|
+
o.badge = target;
|
|
4451
|
+
delete o.nFrom;
|
|
4452
|
+
}
|
|
4453
|
+
break;
|
|
4454
|
+
}
|
|
4455
|
+
case "pulse":
|
|
4456
|
+
if (o) o.pulse = p < 1 ? p : 0;
|
|
4457
|
+
break;
|
|
4458
|
+
}
|
|
4459
|
+
}
|
|
4460
|
+
}
|
|
4461
|
+
route(l, W) {
|
|
4462
|
+
const A = W.objs.get(l.from), B = W.objs.get(l.to);
|
|
4463
|
+
if (!A || !B) return null;
|
|
4464
|
+
const others = [...W.objs.values()].filter((o) => o !== A && o !== B);
|
|
4465
|
+
const blocked = (pts2) => {
|
|
4466
|
+
for (let k = 0; k < pts2.length - 1; k++) {
|
|
4467
|
+
const [a, b] = [pts2[k], pts2[k + 1]], n = Math.ceil(Math.hypot(b[0] - a[0], b[1] - a[1]) * 6);
|
|
4468
|
+
for (let s = 1; s < n; s++) {
|
|
4469
|
+
const c = lerp(a[0], b[0], s / n), r = lerp(a[1], b[1], s / n);
|
|
4470
|
+
if (others.some((o) => Math.abs(o.c - c) < 0.42 && Math.abs(o.r - r) < 0.42)) return true;
|
|
4471
|
+
}
|
|
4472
|
+
}
|
|
4473
|
+
return false;
|
|
4474
|
+
};
|
|
4475
|
+
let pts;
|
|
4476
|
+
if (Math.abs(A.c - B.c) < 0.05 || Math.abs(A.r - B.r) < 0.05) pts = [[A.c, A.r], [B.c, B.r]];
|
|
4477
|
+
else {
|
|
4478
|
+
const a = [[A.c, A.r], [A.c, B.r], [B.c, B.r]], b = [[A.c, A.r], [B.c, A.r], [B.c, B.r]];
|
|
4479
|
+
pts = !blocked(a) || blocked(b) ? a : b;
|
|
4480
|
+
if (blocked(pts)) pts = [[A.c, A.r], [B.c, B.r]];
|
|
4481
|
+
}
|
|
4482
|
+
const trim = (p, q, by) => {
|
|
4483
|
+
const L = Math.hypot(q[0] - p[0], q[1] - p[1]) || 1, k = Math.min(by, L * 0.45) / L;
|
|
4484
|
+
return [p[0] + (q[0] - p[0]) * k, p[1] + (q[1] - p[1]) * k];
|
|
4485
|
+
};
|
|
4486
|
+
pts[0] = trim(pts[0], pts[1], KINDS[A.is].r + 0.06);
|
|
4487
|
+
pts[pts.length - 1] = trim(pts[pts.length - 1], pts[pts.length - 2], KINDS[B.is].r + 0.1);
|
|
4488
|
+
return pts;
|
|
4489
|
+
}
|
|
4490
|
+
// -------------------------------------------------------------- drawing
|
|
4491
|
+
/**
|
|
4492
|
+
* Step *i* at *t* ms into its animation (Infinity: finished), as SVG text.
|
|
4493
|
+
* *clock* is seconds on a running clock, for traffic that keeps flowing.
|
|
4494
|
+
*/
|
|
4495
|
+
svg(i, t, clock) {
|
|
4496
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4497
|
+
if (this.reducedMotion) t = Infinity;
|
|
4498
|
+
const live = [];
|
|
4499
|
+
const W = this.world(i, t, live);
|
|
4500
|
+
const defs = new Defs();
|
|
4501
|
+
const out = [], over = [];
|
|
4502
|
+
const [c0, r0, c1, r1] = this.cells;
|
|
4503
|
+
const grid = [];
|
|
4504
|
+
for (let c = c0; c <= c1; c += 0.5) grid.push(`M${pt(P(c, r0))} L${pt(P(c, r1))}`);
|
|
4505
|
+
for (let r = r0; r <= r1; r += 0.5) grid.push(`M${pt(P(c0, r))} L${pt(P(c1, r))}`);
|
|
4506
|
+
out.push(`<path d="${grid.join(" ")}" stroke="rgba(30,36,48,.07)" stroke-width="1" fill="none"/>`);
|
|
4507
|
+
for (const z of W.zones.values()) out.push(this.zoneSvg(z));
|
|
4508
|
+
const paths = /* @__PURE__ */ new Map();
|
|
4509
|
+
const labels = [];
|
|
4510
|
+
for (const l of W.links.values()) {
|
|
4511
|
+
const pts = this.route(l, W);
|
|
4512
|
+
if (!pts) continue;
|
|
4513
|
+
const scr = pts.map((q) => P(q[0], q[1], 2));
|
|
4514
|
+
let len = 0;
|
|
4515
|
+
for (let k = 1; k < scr.length; k++) len += Math.hypot(scr[k][0] - scr[k - 1][0], scr[k][1] - scr[k - 1][1]);
|
|
4516
|
+
paths.set(l.id, pts);
|
|
4517
|
+
const dead = l.style === "off" || l.style === "cut" || [l.from, l.to].some((oid) => {
|
|
4518
|
+
var _a2;
|
|
4519
|
+
return ((_a2 = W.objs.get(oid)) == null ? void 0 : _a2.state) === "down";
|
|
4520
|
+
});
|
|
4521
|
+
const shown = ease.inOut(l.draw);
|
|
4522
|
+
const color = l.style === "cut" || dead && l.style !== "off" ? "#dc2626" : dead ? "#94a3b8" : LINE;
|
|
4523
|
+
let dash = "";
|
|
4524
|
+
if (l.style === "dashed" || dead) dash = 'stroke-dasharray="6 6"';
|
|
4525
|
+
if (l.style === "beat") dash = `stroke-dasharray="3 7" stroke-dashoffset="${f1(-(clock * 1e3 / 40) % 10)}"`;
|
|
4526
|
+
const draw = shown < 0.999 ? `stroke-dasharray="${f1(shown * len)} ${f1(len + 20)}"` : dash;
|
|
4527
|
+
const marker = color === "#dc2626" ? "iar" : color === "#94a3b8" ? "iag" : "ia";
|
|
4528
|
+
const heads = shown > 0.97 && l.style !== "off" ? `marker-end="url(#${marker})"${l.both ? ` marker-start="url(#${marker})"` : ""}` : "";
|
|
4529
|
+
out.push(`<path d="${roundedPath(scr, 14)}" fill="none" stroke="${color}" stroke-width="1.9" stroke-linecap="round" ${draw} ${heads} opacity="${(_a = l.alpha) != null ? _a : 1}"/>`);
|
|
4530
|
+
if (l.style === "cut" && shown > 0.9) {
|
|
4531
|
+
const m = P(...along(pts, 0.5), 2);
|
|
4532
|
+
over.push(`<g transform="translate(${f1(m[0])} ${f1(m[1])})"><circle r="8" fill="#fee2e2" stroke="#dc2626" stroke-width="1.5"/>${cross(0, 0, 4)}</g>`);
|
|
4533
|
+
}
|
|
4534
|
+
if (l.label && shown > 0.6) labels.push({ at: P(...along(pts, 0.5), 2), text: l.label, rank: 3, alpha: l.alpha });
|
|
4535
|
+
}
|
|
4536
|
+
const things = [];
|
|
4537
|
+
for (const o of W.objs.values()) things.push({ depth: o.c + o.r, o });
|
|
4538
|
+
for (const { a, p, dur } of live) {
|
|
4539
|
+
const pts = paths.get(str(a.send));
|
|
4540
|
+
if (!pts || p >= 1) continue;
|
|
4541
|
+
const e = ease.inOut(clamp01(p * (dur / DUR.send)));
|
|
4542
|
+
const at = along(pts, a.back ? 1 - e : e);
|
|
4543
|
+
things.push({ depth: at[0] + at[1] + 0.02, parcel: { at, kind: PACKETS[str(a.kind)] ? str(a.kind) : "request", q: e, label: a.label ? str(a.label) : void 0 } });
|
|
4544
|
+
}
|
|
4545
|
+
const now = this.reducedMotion ? 0.37 : clock;
|
|
4546
|
+
for (const fl of W.flows.values()) {
|
|
4547
|
+
const hops = [];
|
|
4548
|
+
for (let k = 0; k < fl.via.length - 1; k++) {
|
|
4549
|
+
const lid = pathId(W, fl.via[k], fl.via[k + 1]), info = paths.get(lid);
|
|
4550
|
+
if (!info) {
|
|
4551
|
+
hops.length = 0;
|
|
4552
|
+
break;
|
|
4553
|
+
}
|
|
4554
|
+
hops.push(((_b = W.links.get(lid)) == null ? void 0 : _b.from) === fl.via[k] ? info : [...info].reverse());
|
|
4555
|
+
}
|
|
4556
|
+
if (!hops.length) continue;
|
|
4557
|
+
const route = hops.flat(), there = 1.3 * hops.length, trip = fl.bounce ? there * 2 : there;
|
|
4558
|
+
const rate = Math.max(0.1, Math.min(fl.rate, 5));
|
|
4559
|
+
for (let k = Math.max(Math.floor((now - trip) * rate), 0); k <= Math.floor(now * rate); k++) {
|
|
4560
|
+
const age = now - k / rate;
|
|
4561
|
+
if (age < 0 || age > trip) continue;
|
|
4562
|
+
const failed = fl.fail > 0 && (k * 9301 + 49297) % 233280 / 233280 < fl.fail;
|
|
4563
|
+
const outward = age <= there, q = outward ? age / there : (age - there) / there;
|
|
4564
|
+
if (failed && !outward) continue;
|
|
4565
|
+
const at = along(route, outward ? ease.inOut(q) : 1 - ease.inOut(q));
|
|
4566
|
+
const kind = failed ? "fail" : outward ? PACKETS[fl.kind] ? fl.kind : "request" : "response";
|
|
4567
|
+
things.push({ depth: at[0] + at[1] + 0.02, parcel: { at, kind, q: failed ? q : 0.5 } });
|
|
4568
|
+
}
|
|
4569
|
+
}
|
|
4570
|
+
things.sort((x, y) => x.depth - y.depth);
|
|
4571
|
+
const bodies = [];
|
|
4572
|
+
for (const th of things) {
|
|
4573
|
+
if (th.parcel) {
|
|
4574
|
+
out.push(parcel(th.parcel.at, th.parcel.kind, th.parcel.q));
|
|
4575
|
+
if (th.parcel.label) labels.push({ at: P(th.parcel.at[0], th.parcel.at[1], 24), text: th.parcel.label, rank: 4, tone: th.parcel.kind === "fail" ? "red" : th.parcel.kind === "response" ? "green" : "amber" });
|
|
4576
|
+
continue;
|
|
4577
|
+
}
|
|
4578
|
+
const o = th.o, K = KINDS[o.is];
|
|
4579
|
+
const rise = o.rise;
|
|
4580
|
+
const lift = Math.max(0, (1 - ease.pop(rise)) * -26) + (o.pulse ? Math.sin(o.pulse * Math.PI) * 7 : 0);
|
|
4581
|
+
const shake = o.shake ? Math.sin(o.shake * Math.PI * 8) * 3 * (1 - o.shake) : 0;
|
|
4582
|
+
const [gx, gy] = P(o.c, o.r, 0);
|
|
4583
|
+
if (o.state === "hot") out.push(`<ellipse cx="${f1(gx)}" cy="${f1(gy - 18)}" rx="62" ry="44" fill="url(#ihot)"/>`);
|
|
4584
|
+
if (o.pulse) {
|
|
4585
|
+
const e = ease.out(o.pulse);
|
|
4586
|
+
out.push(`<ellipse cx="${f1(gx)}" cy="${f1(gy)}" rx="${f1(40 + 40 * e)}" ry="${f1(20 + 20 * e)}" fill="none" stroke="#2563eb" stroke-width="2.5" opacity="${f1(1 - e)}"/>`);
|
|
4587
|
+
}
|
|
4588
|
+
if (o.is !== "queue" && o.is !== "pages") out.push(`<ellipse cx="${f1(gx)}" cy="${f1(gy + 3)}" rx="${f1(K.r * HW * 1.5)}" ry="${f1(K.r * HH * 1.5)}" fill="rgba(30,36,48,${f1(0.08 * rise)})"/>`);
|
|
4589
|
+
out.push(`<g transform="translate(${f1(shake)} 0)" opacity="${f1(Math.min(1, rise * 1.6) * ((_c = o.alpha) != null ? _c : 1) * (o.state === "dim" ? 0.42 : 1))}">${this.object(o, lift, defs)}</g>`);
|
|
4590
|
+
const topZ = (o.is === "service" && o.big ? 47 : K.top) + lift;
|
|
4591
|
+
let stackY = P(o.c, o.r, topZ)[1] - 16;
|
|
4592
|
+
const cx = gx;
|
|
4593
|
+
if (o.gauge != null) {
|
|
4594
|
+
const v = Math.round(o.gauge), col = v >= 85 ? "#dc2626" : v >= 60 ? "#d97706" : "#16a34a";
|
|
4595
|
+
over.push(`<g transform="translate(${f1(cx)} ${f1(stackY)})"><rect x="-38" y="-10" width="76" height="20" rx="10" fill="#fff" stroke="${LINE}" stroke-width="1.3"/>${icon("cpu", -26, 0, 11, "#475569", 2.2)}<rect x="-17" y="-3" width="30" height="6" rx="3" fill="#e2e8f0"/><rect x="-17" y="-3" width="${f1(30 * clamp01(v / 100))}" height="6" rx="3" fill="${col}"/><text x="27" y="4" text-anchor="end" font-size="10" font-weight="700" fill="${LINE}">${v}%</text></g>`);
|
|
4596
|
+
stackY -= 24;
|
|
4597
|
+
}
|
|
4598
|
+
const tags = [...o.tags];
|
|
4599
|
+
if (o.state === "down" && !tags.some((x) => /down/i.test(x.text))) tags.unshift({ text: "DOWN", tone: "red", icon: "alert", p: 1 });
|
|
4600
|
+
for (const tg of tags) {
|
|
4601
|
+
over.push(pill(cx, stackY, tg.text, { tone: (_d = tg.tone) != null ? _d : "ink", icon: tg.icon, fs: 10.5, alpha: tg.p }).svg);
|
|
4602
|
+
stackY -= 23;
|
|
4603
|
+
}
|
|
4604
|
+
if (o.badge) {
|
|
4605
|
+
over.push(pill(cx, stackY, o.badge, { bg: "#0f172a", ink: "#fff", fs: 11 }).svg);
|
|
4606
|
+
stackY -= 23;
|
|
4607
|
+
}
|
|
4608
|
+
if (o.label && o.is !== "service" && o.is !== "ghost") {
|
|
4609
|
+
const below = o.is === "crowd" || o.is === "laptop" || o.is === "phone";
|
|
4610
|
+
const beside = o.is === "database" || o.is === "queue" || o.is === "pages";
|
|
4611
|
+
labels.push({
|
|
4612
|
+
at: below ? [cx, P(o.c + 0.5, o.r + 0.5, 0)[1] + 18] : P(o.c + 0.42, o.r - 0.3, beside ? 22 : 0),
|
|
4613
|
+
text: o.label,
|
|
4614
|
+
rank: 1,
|
|
4615
|
+
icon: o.is === "crowd" ? "users" : below ? "user" : o.is === "database" ? "database" : void 0,
|
|
4616
|
+
anchor: beside ? "start" : void 0,
|
|
4617
|
+
alpha: Math.min(1, rise * 2) * ((_e = o.alpha) != null ? _e : 1)
|
|
4618
|
+
});
|
|
4619
|
+
}
|
|
4620
|
+
bodies.push([cx - 40, P(o.c, o.r, topZ)[1] - 8, 80, topZ + 16]);
|
|
4621
|
+
}
|
|
4622
|
+
const placed = [];
|
|
4623
|
+
const hit = (a, b) => a[0] < b[0] + b[2] && b[0] < a[0] + a[2] && a[1] < b[1] + b[3] && b[1] < a[1] + a[3];
|
|
4624
|
+
const TRIES = [[0, 0], [0, -18], [0, 18], [30, 0], [-30, 0], [26, -16], [-26, 16], [0, -34]];
|
|
4625
|
+
labels.sort((a, b) => a.rank - b.rank);
|
|
4626
|
+
for (const L of labels) {
|
|
4627
|
+
let done = false;
|
|
4628
|
+
for (const [dx, dy] of L.rank === 1 ? [[0, 0], [0, 18], [0, -18], [28, 0], [-28, 0], [0, 34]] : TRIES) {
|
|
4629
|
+
const pl = pill(L.at[0] + dx, L.at[1] + dy, L.text, { tone: (_f = L.tone) != null ? _f : "ink", icon: L.icon, fs: L.rank === 1 ? 11.5 : 10, anchor: L.anchor, alpha: L.alpha });
|
|
4630
|
+
const box2 = [pl.x0 - 2, pl.y0 - 2, pl.w + 4, pl.h + 4];
|
|
4631
|
+
if (!(L.rank === 1 ? placed : [...placed, ...bodies]).some((b) => hit(box2, b))) {
|
|
4632
|
+
placed.push(box2);
|
|
4633
|
+
over.push(pl.svg);
|
|
4634
|
+
done = true;
|
|
4635
|
+
break;
|
|
4636
|
+
}
|
|
4637
|
+
}
|
|
4638
|
+
if (!done && L.rank === 1) {
|
|
4639
|
+
const pl = pill(L.at[0], L.at[1], L.text, { icon: L.icon, fs: 11.5, anchor: L.anchor, alpha: L.alpha });
|
|
4640
|
+
placed.push([pl.x0, pl.y0, pl.w, pl.h]);
|
|
4641
|
+
over.push(pl.svg);
|
|
4642
|
+
}
|
|
4643
|
+
}
|
|
4644
|
+
for (const pn of W.panels.values()) over.push(this.panelSvg(pn));
|
|
4645
|
+
const markers = [["ia", LINE], ["iar", "#dc2626"], ["iag", "#94a3b8"]].map(([id2, col]) => `<marker id="${id2}" viewBox="0 0 10 10" refX="7.5" refY="5" markerWidth="5.5" markerHeight="5.5" orient="auto-start-reverse"><path d="M0 0 L10 5 L0 10 Z" fill="${col}"/></marker>`).join("");
|
|
4646
|
+
const glow = '<radialGradient id="ihot"><stop offset="0" stop-color="#ef4444" stop-opacity=".38"/><stop offset="1" stop-color="#ef4444" stop-opacity="0"/></radialGradient>';
|
|
4647
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${this.viewBox}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${esc(this.plan.title)}"><defs>${markers}${glow}${defs.out.join("")}</defs><g font-family="${MONO}">${out.join("")}${over.join("")}</g></svg>`;
|
|
4648
|
+
}
|
|
4649
|
+
object(o, z, defs) {
|
|
4650
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
4651
|
+
const fallback = o.is === "database" || o.is === "pages" ? "purple" : o.icon && ICON_COLOR[o.icon] || "blue";
|
|
4652
|
+
const pal = o.state === "hot" ? COLORS.hot : o.state === "down" ? COLORS.down : (_b = COLORS[(_a = o.color) != null ? _a : ""]) != null ? _b : COLORS[fallback];
|
|
4653
|
+
const { c, r } = o;
|
|
4654
|
+
let s = "";
|
|
4655
|
+
if (o.is === "service") {
|
|
4656
|
+
const w = 0.8 * (o.big ? 1.12 : 1), h = 40 * (o.big ? 1.12 : 1);
|
|
4657
|
+
s += roundBox(c, r, w, w, z, h, pal, defs, 11);
|
|
4658
|
+
const [x, y] = P(c, r, z + h);
|
|
4659
|
+
const lines = splitLabel((_c = o.label) != null ? _c : "");
|
|
4660
|
+
const ty = y - (lines.length * 12 + (o.sub ? 10 : 0) + (o.icon ? 18 : 0)) / 2 + 2;
|
|
4661
|
+
if (o.icon) s += icon(o.icon, x, ty + 7, 19, pal[3], 2);
|
|
4662
|
+
lines.forEach((ln, k) => {
|
|
4663
|
+
s += `<text x="${f1(x)}" y="${f1(ty + (o.icon ? 27 : 9) + k * 12)}" text-anchor="middle" font-size="12.5" font-weight="700" fill="${pal[3]}">${esc(ln)}</text>`;
|
|
4664
|
+
});
|
|
4665
|
+
if (o.sub) s += `<text x="${f1(x)}" y="${f1(ty + (o.icon ? 27 : 9) + lines.length * 12 - 1)}" text-anchor="middle" font-size="8.5" fill="${pal[3]}" opacity=".75">${esc(o.sub)}</text>`;
|
|
4666
|
+
if (o.state === "down") s += cross(x, y - 2, 13);
|
|
4667
|
+
} else if (o.is === "ghost") {
|
|
4668
|
+
const w = 0.8, h = 38, x0 = c - w / 2, x1 = c + w / 2, r0 = r - w / 2, r1 = r + w / 2;
|
|
4669
|
+
const sil = [P(x0, r0, z + h), P(x1, r0, z + h), P(x1, r0, z), P(x1, r1, z), P(x0, r1, z), P(x0, r1, z + h)];
|
|
4670
|
+
s += `<path d="${rounded(sil, 10)}" fill="rgba(255,255,255,.35)" stroke="${LINE}" stroke-width="1.4" stroke-dasharray="5 4"/>`;
|
|
4671
|
+
const [x, y] = P(c, r, z + h);
|
|
4672
|
+
s += `<text x="${f1(x)}" y="${f1(y + 4)}" text-anchor="middle" font-size="10.5" font-weight="700" fill="#475569">${esc((_d = o.label) != null ? _d : "?")}</text>`;
|
|
4673
|
+
} else if (o.is === "database") {
|
|
4674
|
+
const R = 0.3 * (o.big ? 1.3 : 1), h = 44 * (o.big ? 1.3 : 1);
|
|
4675
|
+
s += cylinder(c, r, R, z, h, pal, defs);
|
|
4676
|
+
if (o.fill) {
|
|
4677
|
+
const rx = R * HW * Math.SQRT2, ry = R * HH * Math.SQRT2, [bx, by] = P(c, r, z), fh = h * clamp01(o.fill);
|
|
4678
|
+
s += `<path d="M${f1(bx - rx)},${f1(by)} A${f1(rx)},${f1(ry)} 0 0 0 ${f1(bx + rx)},${f1(by)} L${f1(bx + rx)},${f1(by - fh)} A${f1(rx)},${f1(ry)} 0 0 1 ${f1(bx - rx)},${f1(by - fh)} Z" fill="#a9e0b4" stroke="${LINE}" stroke-width="1.2" opacity=".9"/>`;
|
|
4679
|
+
}
|
|
4680
|
+
const [x, y] = P(c, r, z + h * 0.42);
|
|
4681
|
+
s += icon((_e = o.icon) != null ? _e : "database", x, y + 6, 16, pal[3], 2);
|
|
4682
|
+
if (o.state === "down") s += cross(x, y - 8, 12);
|
|
4683
|
+
} else if (o.is === "laptop" || o.is === "phone") {
|
|
4684
|
+
s += roundBox(c, r, 0.78, 0.78, z, 10, COLORS.sand, defs, 12);
|
|
4685
|
+
const screen = o.state === "down" ? "#e4e4e7" : "#ddd6fe";
|
|
4686
|
+
if (o.is === "laptop") {
|
|
4687
|
+
s += roundBox(c + 0.02, r + 0.04, 0.46, 0.34, z + 10, 3, ["#f1f5f9", "#cbd5e1", "#94a3b8"], defs, 4, 1.3);
|
|
4688
|
+
const sx0 = c - 0.21, sx1 = c + 0.25, rr = r - 0.14;
|
|
4689
|
+
s += `<path d="${rounded([P(sx0, rr, z + 13), P(sx1, rr, z + 13), P(sx1, rr - 0.03, z + 44), P(sx0, rr - 0.03, z + 44)], 4)}" fill="#3f3f46" stroke="${LINE}" stroke-width="1.5"/>`;
|
|
4690
|
+
s += `<polygon points="${[P(sx0 + 0.03, rr + 2e-3, z + 16), P(sx1 - 0.03, rr + 2e-3, z + 16), P(sx1 - 0.03, rr - 0.025, z + 41), P(sx0 + 0.03, rr - 0.025, z + 41)].map(pt).join(" ")}" fill="${screen}"/>`;
|
|
4691
|
+
s += `<polygon points="${[P(sx0 + 0.06, rr, z + 34), P(sx1 - 0.12, rr, z + 34), P(sx1 - 0.12, rr, z + 37), P(sx0 + 0.06, rr, z + 37)].map(pt).join(" ")}" fill="#a78bfa"/>`;
|
|
4692
|
+
} else {
|
|
4693
|
+
const px = c + 0.02;
|
|
4694
|
+
s += `<path d="${rounded([P(px - 0.13, r, z + 10), P(px + 0.13, r, z + 10), P(px + 0.13, r, z + 54), P(px - 0.13, r, z + 54)], 6)}" fill="#3f3f46" stroke="${LINE}" stroke-width="1.5"/>`;
|
|
4695
|
+
s += `<path d="${rounded([P(px - 0.1, r + 2e-3, z + 14), P(px + 0.1, r + 2e-3, z + 14), P(px + 0.1, r + 2e-3, z + 50), P(px - 0.1, r + 2e-3, z + 50)], 4)}" fill="${screen}"/>`;
|
|
4696
|
+
s += `<polygon points="${[P(px - 0.07, r, z + 36), P(px + 0.05, r, z + 36), P(px + 0.05, r, z + 42), P(px - 0.07, r, z + 42)].map(pt).join(" ")}" fill="#a78bfa"/>`;
|
|
4697
|
+
}
|
|
4698
|
+
} else if (o.is === "crowd") {
|
|
4699
|
+
const n = Math.max(3, Math.min(40, Math.round((_f = o.count) != null ? _f : 8)));
|
|
4700
|
+
const cols = Math.ceil(Math.sqrt(n * 1.4)), rows = Math.ceil(n / cols);
|
|
4701
|
+
const pw = Math.min(1.5, 0.3 + cols * 0.13), pd = Math.min(1.2, 0.3 + rows * 0.13);
|
|
4702
|
+
s += roundBox(c, r, pw, pd, z, 9, COLORS.sand, defs, 12);
|
|
4703
|
+
const people = [];
|
|
4704
|
+
for (let k = 0; k < n; k++) {
|
|
4705
|
+
const i = k % cols, j = Math.floor(k / cols);
|
|
4706
|
+
people.push([c - pw / 2 + 0.17 + i * (pw - 0.34) / Math.max(1, cols - 1), r - pd / 2 + 0.17 + j * (pd - 0.34) / Math.max(1, rows - 1), PEOPLE[k * 3 % PEOPLE.length]]);
|
|
4707
|
+
}
|
|
4708
|
+
people.sort((a, b) => a[0] + a[1] - b[0] - b[1]);
|
|
4709
|
+
for (const [pc, pr, col] of people) s += person(pc, pr, z + 9, col);
|
|
4710
|
+
} else if (o.is === "queue" || o.is === "pages") {
|
|
4711
|
+
const n = Math.max(1, Math.min(16, Math.round((_g = o.count) != null ? _g : 6)));
|
|
4712
|
+
const dir = o.dir === "down" ? [0, 1] : o.dir === "up" ? [0, -1] : o.dir === "left" ? [-1, 0] : [1, 0];
|
|
4713
|
+
const step = o.is === "pages" ? 0.17 : 0.19, len = (n - 1) * step;
|
|
4714
|
+
const lane = [
|
|
4715
|
+
P(c - 0.12 * Math.abs(dir[1]) - 0.12, r - 0.12 * Math.abs(dir[0]) - 0.12, 0),
|
|
4716
|
+
P(c + dir[0] * len + 0.12 + 0.12 * Math.abs(dir[1]), r - 0.12, 0),
|
|
4717
|
+
P(c + dir[0] * len + 0.12, r + dir[1] * len + 0.12, 0),
|
|
4718
|
+
P(c - 0.12, r + dir[1] * len + 0.12 + 0.12 * Math.abs(dir[0]), 0)
|
|
4719
|
+
];
|
|
4720
|
+
s += `<path d="${rounded(lane, 6)}" fill="rgba(148,163,184,.08)" stroke="${LINE}" stroke-opacity=".5" stroke-width="1.1" stroke-dasharray="4 4"/>`;
|
|
4721
|
+
const items = [];
|
|
4722
|
+
for (let k = 0; k < n; k++) items.push([c + dir[0] * k * step, r + dir[1] * k * step]);
|
|
4723
|
+
items.sort((a, b) => a[0] + a[1] - b[0] - b[1]);
|
|
4724
|
+
for (const [ic, ir] of items) {
|
|
4725
|
+
if (o.is === "pages") s += roundBox(ic, ir, 0.13, 0.32, z, 7, o.state === "hot" ? COLORS.hot : (_i = COLORS[(_h = o.color) != null ? _h : ""]) != null ? _i : COLORS.purple, defs, 4, 1.2);
|
|
4726
|
+
else {
|
|
4727
|
+
const [x, y] = P(ic, ir, z + 5);
|
|
4728
|
+
s += `<circle cx="${f1(x)}" cy="${f1(y)}" r="7" fill="${o.state === "hot" ? "#ef4444" : PACKETS.request.color}" stroke="${LINE}" stroke-width="1.2"/>`;
|
|
4729
|
+
}
|
|
4730
|
+
}
|
|
4731
|
+
}
|
|
4732
|
+
return s;
|
|
4733
|
+
}
|
|
4734
|
+
zoneSvg(z) {
|
|
4735
|
+
var _a;
|
|
4736
|
+
const e = ease.out(z.p);
|
|
4737
|
+
const corners = [P(z.c, z.r), P(z.c + z.w, z.r), P(z.c + z.w, z.r + z.d), P(z.c, z.r + z.d)];
|
|
4738
|
+
const fill = z.tone === "green" ? "rgba(34,163,90,.10)" : z.tone === "red" ? "rgba(220,38,38,.08)" : z.tone === "blue" ? "rgba(37,99,235,.08)" : "rgba(148,163,184,.06)";
|
|
4739
|
+
const stroke = z.tone === "green" ? "#22a35a" : z.tone === "red" ? "#dc2626" : z.tone === "blue" ? "#2563eb" : LINE;
|
|
4740
|
+
const [lx, ly] = P(z.c + 0.15, z.r + z.d - 0.1);
|
|
4741
|
+
const n = Math.hypot(HW, HH);
|
|
4742
|
+
const label = z.label ? `<text transform="matrix(${f1(HW / n)} ${f1(HH / n)} ${f1(-HW / n)} ${f1(HH / n)} ${f1(lx)} ${f1(ly)})" font-size="11" font-weight="700" letter-spacing="2.5" fill="${stroke}" opacity=".95">${esc(z.label.toUpperCase())}</text>` : "";
|
|
4743
|
+
return `<g opacity="${f1(e * ((_a = z.alpha) != null ? _a : 1))}"><path d="${rounded(corners, 14)}" fill="${fill}" stroke="${stroke}" stroke-opacity=".7" stroke-width="1.4" stroke-dasharray="7 5"/>${label}</g>`;
|
|
4744
|
+
}
|
|
4745
|
+
panelSvg(pn) {
|
|
4746
|
+
var _a, _b, _c, _d;
|
|
4747
|
+
const [vx, vy, vw, vh] = this.vb;
|
|
4748
|
+
const lines = ((_a = pn.lines) != null ? _a : []).slice(0, 7).map(str);
|
|
4749
|
+
const bars = ((_b = pn.bars) != null ? _b : []).slice(0, 5);
|
|
4750
|
+
const chart = pn.line && Array.isArray(pn.line.points) ? pn.line : null;
|
|
4751
|
+
const fs = 11, lh = 17;
|
|
4752
|
+
const w = Math.min(vw * 0.42, Math.max(220, ...lines.map((l) => l.replace(/^[!+~]/, "").length * fs * 0.6 + 28), str(pn.title).length * 8 + 50));
|
|
4753
|
+
const h = 34 + lines.length * lh + bars.length * 20 + (chart ? 70 : 0) + 8;
|
|
4754
|
+
const where = str(pn.at) || "top-right";
|
|
4755
|
+
const x = where.includes("left") ? vx + 14 : vx + vw - w - 14;
|
|
4756
|
+
const y = where.includes("top") ? vy + 60 : vy + vh - h - 26;
|
|
4757
|
+
const e = ease.out(pn.p);
|
|
4758
|
+
let s = `<g opacity="${f1(e * ((_c = pn.alpha) != null ? _c : 1))}" transform="translate(${f1(x)} ${f1(y + (1 - e) * 8)})"><rect width="${f1(w)}" height="${f1(h)}" rx="8" fill="#fff" stroke="${LINE}" stroke-width="1.4"/>`;
|
|
4759
|
+
s += icon(pn.icon && ISO_ICONS[pn.icon] ? pn.icon : "info", 16, 17, 12, "#475569", 2.2);
|
|
4760
|
+
s += `<text x="28" y="21" font-size="9.5" font-weight="700" letter-spacing="1.4" fill="#475569">${esc(str(pn.title).toUpperCase())}</text>`;
|
|
4761
|
+
s += `<line x1="10" x2="${f1(w - 10)}" y1="30" y2="30" stroke="#e2e8f0"/>`;
|
|
4762
|
+
let yy = 34;
|
|
4763
|
+
for (const raw of lines) {
|
|
4764
|
+
const mark = raw[0], text = /^[!+~]/.test(raw) ? raw.slice(1) : raw;
|
|
4765
|
+
if (mark === "!" || mark === "+") s += `<rect x="8" y="${yy + 1}" width="${f1(w - 16)}" height="${lh - 2}" rx="3" fill="${mark === "!" ? "#fee2e2" : "#dcfce7"}"/>`;
|
|
4766
|
+
s += `<text x="14" y="${yy + 12.5}" font-size="${fs}" fill="${mark === "!" ? "#b91c1c" : mark === "+" ? "#15803d" : mark === "~" ? "#94a3b8" : LINE}" font-weight="${mark === "!" || mark === "+" ? 700 : 500}" xml:space="preserve">${esc(text)}</text>`;
|
|
4767
|
+
yy += lh;
|
|
4768
|
+
}
|
|
4769
|
+
for (const [label, value, tone2] of bars) {
|
|
4770
|
+
const col = (_d = TONE[tone2]) != null ? _d : TONE.blue, bw = w - 140;
|
|
4771
|
+
s += `<text x="14" y="${yy + 13}" font-size="10.5" fill="${LINE}">${esc(label)}</text><rect x="104" y="${yy + 5}" width="${f1(bw)}" height="9" rx="4.5" fill="#eef2f7"/><rect x="104" y="${yy + 5}" width="${f1(bw * clamp01(num(value) / 100))}" height="9" rx="4.5" fill="${col}"/><text x="${f1(w - 12)}" y="${yy + 13}" text-anchor="end" font-size="10" font-weight="700" fill="${col}">${esc(value)}%</text>`;
|
|
4772
|
+
yy += 20;
|
|
4773
|
+
}
|
|
4774
|
+
if (chart) {
|
|
4775
|
+
const pts = chart.points.map(Number).filter((n) => Number.isFinite(n)).slice(0, 12);
|
|
4776
|
+
const max = Math.max(...pts, 1), cw = w - 40, chh = 50, ox = 26, oy = yy + 8;
|
|
4777
|
+
const xy = pts.map((v, i) => [ox + i * cw / Math.max(1, pts.length - 1), oy + chh - v / max * chh]);
|
|
4778
|
+
s += `<line x1="${ox}" y1="${oy + chh}" x2="${ox + cw}" y2="${oy + chh}" stroke="#cbd5e1"/><line x1="${ox}" y1="${oy}" x2="${ox}" y2="${oy + chh}" stroke="#cbd5e1"/>`;
|
|
4779
|
+
s += `<polyline points="${xy.map(pt).join(" ")}" fill="none" stroke="${LINE}" stroke-width="1.8" stroke-linejoin="round"/>`;
|
|
4780
|
+
if (chart.mark != null && xy.length) {
|
|
4781
|
+
const m = xy[Math.max(0, Math.min(xy.length - 1, chart.mark))];
|
|
4782
|
+
s += `<circle cx="${f1(m[0])}" cy="${f1(m[1])}" r="4" fill="#22a35a" stroke="${LINE}"/>`;
|
|
4783
|
+
}
|
|
4784
|
+
if (chart.x) s += `<text x="${ox + cw}" y="${oy + chh + 12}" text-anchor="end" font-size="9" fill="#64748b">${esc(chart.x)} →</text>`;
|
|
4785
|
+
if (chart.y) s += `<text x="${ox + 4}" y="${oy + 8}" font-size="9" fill="#64748b">${esc(chart.y)}</text>`;
|
|
4786
|
+
}
|
|
4787
|
+
return s + "</g>";
|
|
4788
|
+
}
|
|
4789
|
+
}
|
|
4790
|
+
function parcel(at, kind, q) {
|
|
4791
|
+
var _a;
|
|
4792
|
+
const [x, y] = P(at[0], at[1], 6), col = ((_a = PACKETS[kind]) != null ? _a : PACKETS.request).color;
|
|
4793
|
+
const shadow = `<ellipse cx="${f1(x)}" cy="${f1(y + 7)}" rx="7" ry="3.5" fill="rgba(30,36,48,.14)"/>`;
|
|
4794
|
+
if (kind === "write") return shadow + `<rect x="${f1(x - 5)}" y="${f1(y - 5)}" width="10" height="10" rx="2" fill="${col}" stroke="${LINE}" stroke-width="1.2"/>`;
|
|
4795
|
+
if (kind === "heavy") return shadow + `<rect x="${f1(x - 7.5)}" y="${f1(y - 7.5)}" width="15" height="15" rx="3" fill="${col}" stroke="${LINE}" stroke-width="1.3"/>`;
|
|
4796
|
+
if (kind === "ping") return shadow + `<circle cx="${f1(x)}" cy="${f1(y)}" r="5.5" fill="#fff" stroke="${col}" stroke-width="2.4"/>`;
|
|
4797
|
+
if (kind === "event") return shadow + `<path d="M${f1(x)},${f1(y - 7)} L${f1(x + 7)},${f1(y)} L${f1(x)},${f1(y + 7)} L${f1(x - 7)},${f1(y)} Z" fill="${col}" stroke="${LINE}" stroke-width="1.2"/>`;
|
|
4798
|
+
if (kind === "fail" && q > 0.82) {
|
|
4799
|
+
const e = (q - 0.82) / 0.18;
|
|
4800
|
+
return `<g opacity="${f1(1 - e * 0.6)}"><circle cx="${f1(x)}" cy="${f1(y)}" r="${f1(6 + e * 6)}" fill="#fee2e2" stroke="#dc2626" stroke-width="1.6"/>${cross(x, y, 4)}</g>`;
|
|
4801
|
+
}
|
|
4802
|
+
return shadow + `<circle cx="${f1(x)}" cy="${f1(y)}" r="5.5" fill="${col}" stroke="${LINE}" stroke-width="1.2"/>`;
|
|
4803
|
+
}
|
|
3809
4804
|
const BLOCKS_PATH = "/api/v1/chat/blocks";
|
|
3810
4805
|
const WHITEBOARD_PATH = "/api/v1/chat/whiteboard";
|
|
3811
4806
|
const BLOCKS_TTL_MS = 6e4;
|
|
@@ -3833,43 +4828,60 @@ class WhiteboardStore {
|
|
|
3833
4828
|
}
|
|
3834
4829
|
/** Whether the Blueprint has the whiteboard. False when it cannot be asked. */
|
|
3835
4830
|
async available() {
|
|
4831
|
+
return (await this.readBlocks()).on;
|
|
4832
|
+
}
|
|
4833
|
+
/** Whether the Blueprint offers a Full lesson beside the whiteboard. */
|
|
4834
|
+
async lessonsAvailable() {
|
|
4835
|
+
return (await this.readBlocks()).lessons;
|
|
4836
|
+
}
|
|
4837
|
+
readBlocks() {
|
|
3836
4838
|
var _a;
|
|
3837
|
-
if (this.blocks && this.clock() - this.blocks.at < BLOCKS_TTL_MS) return this.blocks
|
|
3838
|
-
(_a = this.blocksPending) != null ? _a : this.blocksPending = this.api().get(BLOCKS_PATH, 1e4).then(
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
4839
|
+
if (this.blocks && this.clock() - this.blocks.at < BLOCKS_TTL_MS) return Promise.resolve(this.blocks);
|
|
4840
|
+
(_a = this.blocksPending) != null ? _a : this.blocksPending = this.api().get(BLOCKS_PATH, 1e4).then(
|
|
4841
|
+
(res) => {
|
|
4842
|
+
var _a2, _b, _c;
|
|
4843
|
+
return { on: ((_a2 = res == null ? void 0 : res.blocks) == null ? void 0 : _a2.whiteboard) === true, lessons: ((_b = res == null ? void 0 : res.blocks) == null ? void 0 : _b.whiteboard) === true && ((_c = res == null ? void 0 : res.blocks) == null ? void 0 : _c.lessons) === true };
|
|
4844
|
+
},
|
|
4845
|
+
() => ({ on: false, lessons: false })
|
|
4846
|
+
).then((read) => {
|
|
4847
|
+
this.blocks = { at: this.clock(), ...read };
|
|
3843
4848
|
this.blocksPending = null;
|
|
3844
|
-
return
|
|
4849
|
+
return read;
|
|
3845
4850
|
});
|
|
3846
4851
|
return this.blocksPending;
|
|
3847
4852
|
}
|
|
3848
|
-
/**
|
|
3849
|
-
|
|
4853
|
+
/**
|
|
4854
|
+
* Explain *question* (and the answer on screen) on the board. The server
|
|
4855
|
+
* picks a pen board or a 3D one from the Blueprint's style; *lesson* asks
|
|
4856
|
+
* for the Full lesson, a longer 3D lesson that plays by itself.
|
|
4857
|
+
*/
|
|
4858
|
+
async explain(question, answer, options = {}) {
|
|
4859
|
+
var _a;
|
|
3850
4860
|
const q = question.trim().slice(0, 500);
|
|
3851
4861
|
if (!q) return false;
|
|
4862
|
+
const lesson = options.lesson === true;
|
|
3852
4863
|
const a = answer ? readableAnswer(answer).slice(0, 4e3) : void 0;
|
|
3853
|
-
const key = `${q}\0${a != null ? a : ""}`;
|
|
4864
|
+
const key = `${q}\0${a != null ? a : ""}\0${lesson ? "lesson" : "board"}`;
|
|
3854
4865
|
const known = this.kept.get(key);
|
|
3855
4866
|
if (known) {
|
|
3856
|
-
this.set({ status: "playing", scene: known, error: null, question: q, answer: a });
|
|
4867
|
+
this.set({ status: "playing", scene: known, error: null, question: q, answer: a, lesson });
|
|
3857
4868
|
return true;
|
|
3858
4869
|
}
|
|
3859
4870
|
const token = ++this.request;
|
|
3860
|
-
this.set({ status: "loading", scene: null, error: null, question: q, answer: a });
|
|
4871
|
+
this.set({ status: "loading", scene: null, error: null, question: q, answer: a, lesson });
|
|
3861
4872
|
try {
|
|
3862
4873
|
const raw = await this.api().post(
|
|
3863
4874
|
WHITEBOARD_PATH,
|
|
3864
4875
|
// pictures: this board shows real photos with labelled parts.
|
|
3865
4876
|
// motion: it can play motion; the server adds it only when Animate is on.
|
|
3866
|
-
|
|
3867
|
-
|
|
4877
|
+
// iso: it draws 3D boards; the Blueprint's style decides when one is used.
|
|
4878
|
+
{ question: q, answer: a || void 0, language: this.language(), pictures: true, motion: true, iso: true, lesson: lesson || void 0 },
|
|
4879
|
+
lesson ? 9e4 : 6e4
|
|
3868
4880
|
);
|
|
3869
4881
|
if (token !== this.request) return false;
|
|
3870
|
-
const scene = validateScene(raw);
|
|
4882
|
+
const scene = (_a = readIsoPlan(raw)) != null ? _a : validateScene(raw);
|
|
3871
4883
|
this.keep(key, scene);
|
|
3872
|
-
this.set({ status: "playing", scene, error: null, question: q, answer: a });
|
|
4884
|
+
this.set({ status: "playing", scene, error: null, question: q, answer: a, lesson });
|
|
3873
4885
|
return true;
|
|
3874
4886
|
} catch (err) {
|
|
3875
4887
|
if (token !== this.request) return false;
|
|
@@ -3878,18 +4890,20 @@ class WhiteboardStore {
|
|
|
3878
4890
|
scene: null,
|
|
3879
4891
|
error: err instanceof SceneError ? "This board could not be drawn." : "The whiteboard is not available right now.",
|
|
3880
4892
|
question: q,
|
|
3881
|
-
answer: a
|
|
4893
|
+
answer: a,
|
|
4894
|
+
lesson
|
|
3882
4895
|
});
|
|
3883
4896
|
return false;
|
|
3884
4897
|
}
|
|
3885
4898
|
}
|
|
3886
4899
|
/** Ask again after an error. */
|
|
3887
4900
|
retry() {
|
|
3888
|
-
if (this.state.status === "error") void this.explain(this.state.question, this.state.answer);
|
|
4901
|
+
if (this.state.status === "error") void this.explain(this.state.question, this.state.answer, { lesson: this.state.lesson });
|
|
3889
4902
|
}
|
|
3890
|
-
/** Play a board the host built. A board that cannot be drawn throws SceneError. */
|
|
4903
|
+
/** Play a board the host built (pen or 3D). A board that cannot be drawn throws SceneError. */
|
|
3891
4904
|
play(scene) {
|
|
3892
|
-
|
|
4905
|
+
var _a;
|
|
4906
|
+
const valid = (_a = readIsoPlan(scene)) != null ? _a : validateScene(scene);
|
|
3893
4907
|
this.request += 1;
|
|
3894
4908
|
this.set({ status: "playing", scene: valid, error: null, question: valid.title });
|
|
3895
4909
|
}
|
|
@@ -3936,20 +4950,28 @@ function useWhiteboard() {
|
|
|
3936
4950
|
const board = GuideAI.isConfigured() ? whiteboardStore() : IDLE;
|
|
3937
4951
|
const state = useSyncExternalStore(board.subscribe, board.getState, board.getState);
|
|
3938
4952
|
const [available, setAvailable] = useState(false);
|
|
4953
|
+
const [lessons, setLessons] = useState(false);
|
|
3939
4954
|
useEffect(() => {
|
|
3940
4955
|
if (board === IDLE) return;
|
|
3941
4956
|
let live = true;
|
|
3942
4957
|
void board.available().then((on) => {
|
|
3943
4958
|
if (live) setAvailable(on);
|
|
3944
4959
|
});
|
|
4960
|
+
void board.lessonsAvailable().then((on) => {
|
|
4961
|
+
if (live) setLessons(on);
|
|
4962
|
+
});
|
|
3945
4963
|
return () => {
|
|
3946
4964
|
live = false;
|
|
3947
4965
|
};
|
|
3948
4966
|
}, [board]);
|
|
3949
4967
|
return {
|
|
3950
4968
|
available,
|
|
4969
|
+
lessons,
|
|
3951
4970
|
state,
|
|
3952
|
-
explain: useCallback(
|
|
4971
|
+
explain: useCallback(
|
|
4972
|
+
(question, answer, options) => board.explain(question, answer, options),
|
|
4973
|
+
[board]
|
|
4974
|
+
),
|
|
3953
4975
|
play: useCallback((scene) => board.play(scene), [board]),
|
|
3954
4976
|
retry: useCallback(() => board.retry(), [board]),
|
|
3955
4977
|
close: useCallback(() => board.close(), [board])
|
|
@@ -4204,21 +5226,22 @@ function useGuideAI(options = {}) {
|
|
|
4204
5226
|
var _a2;
|
|
4205
5227
|
if (message.role !== "assistant" || message.streaming || message.error || !message.content) return message;
|
|
4206
5228
|
const suggestions = (_a2 = message.suggestions) != null ? _a2 : (defaultFollowUps == null ? void 0 : defaultFollowUps.length) ? defaultFollowUps : void 0;
|
|
4207
|
-
return { ...message, suggestions, whiteboard: board.available || void 0 };
|
|
4208
|
-
}), [messages, defaultFollowUps, board.available]);
|
|
5229
|
+
return { ...message, suggestions, whiteboard: board.available || void 0, lesson: board.available && board.lessons || void 0 };
|
|
5230
|
+
}), [messages, defaultFollowUps, board.available, board.lessons]);
|
|
4209
5231
|
const last = shown[shown.length - 1];
|
|
4210
5232
|
const followUps = !busy && (last == null ? void 0 : last.role) === "assistant" && !last.pendingAction ? (_d = last.suggestions) != null ? _d : [] : [];
|
|
4211
5233
|
const typing = busy && messages.some((message) => message.streaming && !message.content);
|
|
4212
|
-
const explainOnWhiteboard = useCallback(async (messageId) => {
|
|
5234
|
+
const explainOnWhiteboard = useCallback(async (messageId, options2) => {
|
|
4213
5235
|
const answer = messages.find((message) => message.id === messageId);
|
|
4214
5236
|
if (!answer || answer.role !== "assistant" || !answer.content) return false;
|
|
4215
|
-
return board.explain(answer.question || answer.content.slice(0, 200), answer.content);
|
|
5237
|
+
return board.explain(answer.question || answer.content.slice(0, 200), answer.content, options2);
|
|
4216
5238
|
}, [messages, board]);
|
|
4217
5239
|
return {
|
|
4218
5240
|
messages: shown,
|
|
4219
5241
|
typing,
|
|
4220
5242
|
followUps,
|
|
4221
5243
|
whiteboardAvailable: board.available,
|
|
5244
|
+
lessonsAvailable: board.available && board.lessons,
|
|
4222
5245
|
explainOnWhiteboard,
|
|
4223
5246
|
input,
|
|
4224
5247
|
setInput,
|
|
@@ -4284,6 +5307,7 @@ export {
|
|
|
4284
5307
|
BOARD_W as B,
|
|
4285
5308
|
EP as E,
|
|
4286
5309
|
GuideAI as G,
|
|
5310
|
+
IsoDrawing as I,
|
|
4287
5311
|
LIMITS as L,
|
|
4288
5312
|
RegistryContext as R,
|
|
4289
5313
|
ScreenRegistry as S,
|
|
@@ -4297,4 +5321,4 @@ export {
|
|
|
4297
5321
|
requireConfigured as r,
|
|
4298
5322
|
useGuideAIRuntime as u
|
|
4299
5323
|
};
|
|
4300
|
-
//# sourceMappingURL=useConversations-
|
|
5324
|
+
//# sourceMappingURL=useConversations-BljCr0Od.js.map
|