AnyBot/site/index.html

1673 lines
155 KiB
HTML
Raw Normal View History

<!doctype html>
<html lang="zh-Hant" data-style="paper">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>AnyBot</title>
<meta name="claude:viewport-fit-sides" content="cover">
<meta name="description" content="跑在你自己電腦上的 AI 助理。會聊天,也會動手:整理檔案、跑指令、開瀏覽器填表、操作螢幕、到點自己做。動手之前先問你。開源、免費、自己架。">
<meta property="og:title" content="AnyBot:跑在你自己電腦上的 AI 助理">
<meta property="og:description" content="會聊天,也會動手。動手之前先問你。開源、免費、資料留在你這邊。">
<meta property="og:image" content="cat.jpg">
<link rel="icon" href="icon.jpg">
<link rel="apple-touch-icon" href="icon.jpg">
<style>
/* Layout: one calm column (留天地), each section a sentence and the thing itself drawn the way
the app draws it; the live window opens the page, the cat's yellow closes it. */
:root {
/* 風格「紙」(the app's default, src/theme.rs TEMPLATES): three colours, the rest mixed from them. */
--fg: #25221f; --bg: #faf9f6; --accent: #c06244;
--brand: #f9c11c; --brand-ink: #1d1a12;
--attention: #c9922e; --ok: #2e7d3f; --bad: #b42a2a;
--pane: color-mix(in srgb, var(--bg) 70%, #fff);
--side: color-mix(in srgb, var(--bg) 94%, var(--fg));
--soft: color-mix(in srgb, var(--fg) 6%, transparent);
--soft2: color-mix(in srgb, var(--fg) 10%, transparent);
--line: color-mix(in srgb, var(--fg) 12%, transparent);
--text2: color-mix(in srgb, var(--fg) 70%, var(--bg));
--text3: color-mix(in srgb, var(--fg) 52%, var(--bg));
--attention-bg: color-mix(in srgb, var(--attention) 10%, var(--pane));
--grid: color-mix(in srgb, var(--fg) 7%, transparent);
--shade: 0 1px 2px #1c160f0f, 0 8px 24px -6px #1c160f1f, 0 24px 60px -24px #1c160f29;
--font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Segoe UI", system-ui, sans-serif;
--display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Segoe UI", system-ui, sans-serif;
--mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
--fs-cap: 12px; --fs-s: 13px; --fs-ui: 15px; --fs-read: 17px; --fs-h3: 20px; --fs-h2: clamp(26px, 3.4vw, 36px); --fs-h1: clamp(36px, 6.4vw, 64px);
--r-s: 8px; --r-m: 12px; --r-l: 18px; --r-full: 999px;
--max: 1120px;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--fg: #f2f0eb; --bg: #1e1d1b; --accent: #d88366;
--pane: color-mix(in srgb, var(--bg) 88%, #fff);
--side: color-mix(in srgb, var(--bg) 92%, #000);
--attention: #d9a441;
--shade: 0 1px 2px #0000004d, 0 12px 32px -8px #00000080, 0 30px 70px -30px #0000008c;
color-scheme: dark;
}
}
:root[data-theme="dark"] {
--fg: #f2f0eb; --bg: #1e1d1b; --accent: #d88366;
--pane: color-mix(in srgb, var(--bg) 88%, #fff);
--side: color-mix(in srgb, var(--bg) 92%, #000);
--attention: #d9a441;
--shade: 0 1px 2px #0000004d, 0 12px 32px -8px #00000080, 0 30px 70px -30px #0000008c;
color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 var(--fs-ui)/1.6 var(--font); -webkit-font-smoothing: antialiased; transition: background-color .35s, color .35s; }
body.dots { background-image: radial-gradient(var(--grid) 1.1px, transparent 1.3px); background-size: 18px 18px; }
body.grid { background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 24px 24px; }
body.waves { background-image: radial-gradient(circle at 50% 100%, transparent 11px, var(--grid) 11.5px, var(--grid) 13px, transparent 13.5px); background-size: 28px 14px; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
a { color: inherit; }
img { max-width: 100%; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; letter-spacing: -.01em; word-break: keep-all; overflow-wrap: anywhere; }
p { margin: 0; }
.wrap { max-width: var(--max); margin-inline: auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
/* Buttons: capsules (圓). The main one is ink, as in the app; colour stays for meaning (靜). */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: var(--r-full); border: 1px solid var(--line); background: var(--pane); color: var(--fg); font-weight: 600; font-size: var(--fs-ui); text-decoration: none; white-space: nowrap; transition: transform .15s, box-shadow .2s, background-color .2s; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shade); }
.btn.main { background: var(--fg); color: var(--bg); border-color: transparent; }
.btn.sm { height: 34px; padding: 0 14px; font-size: var(--fs-s); }
.ib { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--r-full); border: 0; background: transparent; color: var(--text2); }
.ib:hover { background: var(--soft); color: var(--fg); }
/* ---------- top bar ---------- */
header.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid transparent; transition: border-color .2s; }
header.top.scrolled { border-bottom-color: var(--line); }
.top .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; font: 700 18px/1 var(--display); text-decoration: none; letter-spacing: -.01em; }
.logo img { width: 30px; height: 30px; border-radius: 8px; display: block; }
.top nav { display: flex; gap: 2px; margin-left: 18px; }
.top nav a { padding: 6px 12px; border-radius: var(--r-full); color: var(--text2); text-decoration: none; font-size: var(--fs-s); font-weight: 500; }
.top nav a:hover { background: var(--soft); color: var(--fg); }
.top .end { margin-left: auto; display: flex; align-items: center; gap: 4px; }
@media (max-width: 820px) { .top nav { display: none; } }
@media (max-width: 420px) { .top .src { display: none; } }
/* 風格 picker (the popover from the top bar) */
.pop { position: absolute; right: max(20px, env(safe-area-inset-right, 0px)); top: 56px; width: min(340px, calc(100vw - 32px)); background: var(--pane); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shade); padding: 14px; }
.pop h4 { margin: 0 0 10px; font-size: var(--fs-s); color: var(--text3); font-weight: 600; }
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sw { display: grid; gap: 6px; justify-items: center; padding: 8px 4px; border-radius: var(--r-m); border: 1px solid transparent; background: transparent; font-size: var(--fs-cap); color: var(--text2); }
.sw:hover { background: var(--soft); }
.sw.on { border-color: var(--fg); color: var(--fg); font-weight: 600; }
.sw i { width: 40px; height: 40px; border-radius: 12px; display: block; position: relative; box-shadow: inset 0 0 0 1px #0000001a; overflow: hidden; }
.sw i::after { content: ""; position: absolute; right: 6px; bottom: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--a); }
.sw i::before { content: ""; position: absolute; left: 7px; top: 9px; width: 18px; height: 3px; border-radius: 2px; background: var(--f); box-shadow: 0 6px 0 var(--f); opacity: .55; }
.pop .modes { display: flex; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.pop .modes button { flex: 1; height: 32px; border-radius: var(--r-full); border: 1px solid var(--line); background: transparent; font-size: var(--fs-s); color: var(--text2); }
.pop .modes button.on { background: var(--fg); color: var(--bg); border-color: transparent; }
/* ---------- hero ---------- */
.hero { padding-block: clamp(48px, 9vw, 104px) 40px; }
.eyebrow { display: inline-flex; flex-wrap: wrap; gap: 6px 14px; color: var(--text3); font-size: var(--fs-s); font-weight: 500; }
.eyebrow span { display: inline-flex; align-items: center; gap: 6px; }
.eyebrow span + span::before { content: ""; width: 3px; height: 3px; border-radius: 50%; background: currentColor; margin-right: 8px; }
@media (max-width: 560px) { .eyebrow span + span::before { display: none; } }
.hero h1 { font-size: var(--fs-h1); line-height: 1.14; font-weight: 700; margin-top: 18px; }
.hero h1 .line { display: block; }
.mark { background: linear-gradient(transparent 58%, color-mix(in srgb, var(--brand) 75%, transparent) 58%, color-mix(in srgb, var(--brand) 75%, transparent) 92%, transparent 92%); padding-inline: .06em; }
.hero .lede { margin-top: 20px; font-size: clamp(17px, 2vw, 20px); line-height: 1.7; color: var(--text2); max-width: 34em; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.fine { margin-top: 14px; font-size: var(--fs-s); color: var(--text3); }
/* ---------- the app, to try: laid out as the desktop app (浮) ---------- */
.stage { padding-block: 8px 24px; }
.stage-top { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.stage-top .note { color: var(--text3); font-size: var(--fs-s); }
@media (max-width: 760px) { .stage-top .tabs { display: none; } }
.win { position: relative; display: grid; grid-template-columns: 52px 220px minmax(0, 1fr); height: 660px; max-width: 100%; margin-inline: auto; border-radius: var(--r-l); background: var(--pane); box-shadow: var(--shade); overflow: hidden; border: 1px solid var(--line); font-size: var(--fs-ui); }
.win button { font: inherit; color: inherit; }
.av { width: 40px; height: 40px; display: block; flex: none; position: relative; }
.av svg { width: 100%; height: 100%; display: block; }
/* the column of places */
.rail { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0 12px; }
.lights { display: flex; gap: 5px; padding: 2px 0 12px; }
.lights i { width: 10px; height: 10px; border-radius: 50%; }
.lights i:nth-child(1) { background: #ec6a5e; } .lights i:nth-child(2) { background: #f4bf4f; } .lights i:nth-child(3) { background: #61c554; }
.rb { width: 36px; height: 36px; border-radius: var(--r-m); border: 0; background: transparent; color: var(--text2); display: grid; place-items: center; position: relative; }
.rb:hover { background: var(--soft); color: var(--fg); }
.rb.on { background: var(--soft2); color: var(--fg); }
.rb .badge { position: absolute; top: 2px; right: 1px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: #fff; font: 600 10px/15px var(--font); }
.rail .sp { flex: 1; }
/* bots */
.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 8px 10px 10px; min-width: 0; overflow: hidden; }
.side-top { display: flex; align-items: center; gap: 4px; height: 40px; flex: none; }
.side-top .side-head { display: none; font: 700 24px/1 var(--display); padding-left: 6px; }
.side-top .sp { flex: 1; }
.find { margin: 2px 4px 8px; height: 32px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--pane); padding: 0 10px; font: inherit; font-size: var(--fs-s); color: var(--fg); outline: 0; flex: none; }
.pchips { display: none; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 4px 10px; flex: none; }
.pchips button { height: 34px; padding: 0 12px; border-radius: var(--r-full); border: 1px solid var(--line); background: var(--pane); font-size: var(--fs-s); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pchips button .i { width: 15px; height: 15px; }
.pchips b { color: var(--accent); }
.side-scroll { flex: 1; min-height: 0; overflow: auto; scrollbar-width: none; }
.bots { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.list { display: grid; gap: 2px; }
.bot { appearance: none; border: 0; background: transparent; cursor: pointer; display: grid; justify-items: center; gap: 7px; padding: 12px 4px 9px; border-radius: var(--r-l); font-size: var(--fs-s); color: var(--fg); position: relative; text-align: center; min-width: 0; }
.bot:hover { background: var(--soft); }
.bot.on { background: var(--soft2); }
.bot .av { width: 44px; height: 44px; }
.bot .nm { min-width: 0; max-width: 100%; }
.bot .nm b { font-weight: 400; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot .pv { display: none; font-style: normal; }
.bot .dot { display: none; position: absolute; top: 9px; right: 20px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.bot.unread .dot { display: block; }
.bot.waiting .dot { display: block; background: var(--attention); }
.bot .star { position: absolute; right: -3px; bottom: -3px; width: 17px; height: 17px; border-radius: 50%; background: #f07a22; color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--side); }
.bot .star svg { width: 10px; height: 10px; fill: currentColor; stroke: none; }
.bot.pop { animation: pop .6s cubic-bezier(.2, 1.5, .4, 1); }
.bot[hidden] { display: none; }
.list .bot { grid-template-columns: 32px minmax(0, 1fr); justify-items: start; text-align: left; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r-m); }
.list .bot .av { width: 32px; height: 32px; }
.list .bot .pv { display: block; font-size: var(--fs-cap); color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .bot .dot { top: 6px; right: auto; left: 34px; }
.grp { margin: 16px 8px 4px; font-size: var(--fs-cap); color: var(--text3); }
.side-foot { padding-top: 8px; flex: none; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--r-m); }
.me > b { width: 32px; height: 32px; border-radius: 50%; background: var(--soft2); border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 500; color: var(--text2); }
.me span { display: grid; font-size: var(--fs-s); line-height: 1.3; }
.me small { font-size: var(--fs-cap); color: var(--text3); display: flex; align-items: center; gap: 5px; }
.me small::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
/* main: one of 聊天, 工作流, 日程 */
.amain { position: relative; min-width: 0; display: flex; flex-direction: column; background: var(--pane); }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; min-width: 0; }
.bar { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 14px 0 22px; flex: none; }
.bar h4 { margin: 0; font: 650 17px/1 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bar .tag { font-size: var(--fs-cap); color: var(--text3); white-space: nowrap; }
.bar .sp { flex: 1; }
.bar .back { display: none; margin-left: -10px; }
.bar .crumb { border: 0; background: transparent; color: var(--text3); font-size: var(--fs-s); padding: 4px 4px; display: inline-flex; align-items: center; gap: 2px; }
.bar .crumb:hover { color: var(--fg); }
.tb { height: 32px; padding: 0 12px; border-radius: var(--r-full); border: 0; background: transparent; font-size: var(--fs-s); color: var(--text2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tb:hover { background: var(--soft); color: var(--fg); }
.tb.solid { background: var(--soft2); color: var(--fg); }
.tb.stop { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.tb .i { width: 15px; height: 15px; }
.bar-line { border-bottom: 1px solid var(--line); }
/* chat */
.convs { flex: 1; min-height: 0; position: relative; }
.msgs { position: absolute; inset: 0; overflow: auto; padding: 18px max(20px, calc((100% - 720px) / 2)) 14px; display: flex; flex-direction: column; gap: 16px; scrollbar-width: thin; }
.msgs > * { flex: none; }
.hello { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 22px; align-items: center; padding: 34px 0 8px; }
.hello .av { width: 84px; height: 84px; grid-row: span 3; }
.hello small { color: var(--text3); font-size: var(--fs-ui); }
.hello h3 { font: 700 26px/1.25 var(--display); margin: 0; }
.hello p { color: var(--text2); font-size: var(--fs-ui); }
.hello-offers { display: flex; flex-wrap: wrap; gap: 8px; }
.hello-offers:empty { display: none; }
.hello-model { font-size: var(--fs-cap); color: var(--text3); }
.u { align-self: flex-end; max-width: 78%; background: var(--soft2); color: var(--fg); padding: 9px 14px; border-radius: 16px; animation: rise .3s both; overflow-wrap: anywhere; }
.b { max-width: 100%; line-height: 1.75; }
.b .tx { white-space: pre-line; }
.gb { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: start; }
.gb .av { width: 28px; height: 28px; margin-top: 2px; }
.gb .nm { display: block; font-size: var(--fs-s); font-weight: 600; }
.mem { display: flex; align-items: center; gap: 6px; font-size: var(--fs-cap); color: var(--text3); }
.mem .i { width: 14px; height: 14px; }
.ask { border: 1.5px solid var(--attention); background: var(--attention-bg); border-radius: var(--r-l); padding: 16px 18px; display: grid; gap: 10px; animation: rise .45s cubic-bezier(.2,.8,.2,1) both; }
.ask h5 { margin: 0; font-size: var(--fs-ui); font-weight: 650; }
.ask .what { color: var(--text2); font-size: var(--fs-s); }
.ask code { display: block; font: 12.5px/1.6 var(--mono); background: var(--pane); border-radius: var(--r-s); padding: 9px 12px; overflow-x: auto; white-space: pre; }
.ask .row { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 2px; }
.ask .row button { height: 34px; padding: 0 15px; border-radius: var(--r-full); border: 0; background: var(--soft2); font-weight: 600; font-size: var(--fs-s); }
.ask .row button.yes { background: var(--fg); color: var(--bg); }
.ask .hint { font-size: var(--fs-cap); color: var(--text3); display: flex; align-items: center; gap: 6px; }
.ask .hint .i { width: 14px; height: 14px; }
.waitline { display: flex; align-items: center; gap: 10px; font-size: var(--fs-s); font-weight: 600; }
.waitline .av { width: 30px; height: 30px; }
.waitline .av::after { content: ""; position: absolute; top: -2px; right: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--attention); box-shadow: 0 0 0 2px var(--pane); }
.step { display: flex; align-items: center; gap: 8px; font-size: var(--fs-s); color: var(--text2); animation: rise .3s both; }
.step .i { width: 16px; height: 16px; }
.step.ok .i { color: var(--ok); } .step.no .i { color: var(--bad); }
.step.run .i { color: var(--text3); animation: spin 1s linear infinite; }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text3); animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
.card { border: 1px solid var(--line); border-radius: var(--r-l); padding: 14px 16px; display: grid; gap: 10px; max-width: 540px; background: var(--pane); box-shadow: 0 1px 2px #0000000d; animation: rise .4s both; min-width: 0; }
.card .hd { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.card .hd .i { color: var(--accent); }
.card .hd small { margin-left: auto; font-weight: 400; font-size: var(--fs-cap); color: var(--text3); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { background: var(--soft); border-radius: var(--r-m); padding: 10px 12px; }
.tile b { font: 700 22px/1.1 var(--display); display: block; font-variant-numeric: tabular-nums; }
.tile span { font-size: var(--fs-cap); color: var(--text3); }
.todo { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: var(--fs-s); }
.todo li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; }
.todo em { font-style: normal; font-size: var(--fs-cap); font-weight: 600; color: var(--text3); padding-top: 1px; }
.tblw { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-s); font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl th { color: var(--text3); font-weight: 600; font-size: var(--fs-cap); }
.tbl td.best { color: var(--ok); font-weight: 600; }
.bars { display: grid; gap: 8px; }
.bars div { display: grid; grid-template-columns: 44px minmax(0, 1fr) 64px; gap: 10px; align-items: center; font-size: var(--fs-s); }
.bars i { height: 8px; border-radius: 4px; background: var(--accent); display: block; }
.bars b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.routine { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.routine .ico { width: 38px; height: 38px; border-radius: 12px; background: var(--soft); display: grid; place-items: center; color: var(--accent); }
.routine b { display: block; }
.routine span { font-size: var(--fs-cap); color: var(--text3); }
.ok-pill { font-size: var(--fs-cap); font-weight: 600; padding: 3px 10px; border-radius: var(--r-full); color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); white-space: nowrap; }
.newbot { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 12px; align-items: center; }
.newbot .av { width: 48px; height: 48px; }
.newbot span { display: block; font-size: var(--fs-cap); color: var(--text3); }
.shot { border-radius: var(--r-m); border: 1px solid var(--line); overflow: hidden; max-width: 440px; background: var(--bg); animation: rise .4s both; }
.shot .url { display: flex; gap: 8px; align-items: center; padding: 7px 10px; border-bottom: 1px solid var(--line); font: 11.5px var(--mono); color: var(--text3); background: var(--side); }
.shot .url i { width: 8px; height: 8px; border-radius: 50%; background: var(--soft2); }
.shot .page { padding: 14px 16px 16px; display: grid; gap: 9px; }
.shot .page h6 { margin: 0 0 2px; font-size: var(--fs-ui); }
.field { display: grid; gap: 3px; font-size: 11.5px; color: var(--text3); }
.field .v { height: 28px; border: 1px solid var(--line); border-radius: 7px; padding: 0 9px; display: flex; align-items: center; font-size: 12.5px; color: var(--fg); background: var(--pane); }
.field .v.typing-now::after { content: ""; width: 1.5px; height: 14px; background: var(--accent); margin-left: 1px; animation: blink .8s infinite; }
.shot .cap { font-size: var(--fs-cap); color: var(--text3); padding: 0 16px 12px; display: flex; gap: 6px; align-items: center; }
.shot .cap .i { width: 14px; height: 14px; }
.offers { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 max(20px, calc((100% - 720px) / 2)) 10px; flex: none; }
.offers:empty { display: none; }
.offer { height: 34px; padding: 0 15px; border-radius: var(--r-full); border: 1px solid var(--line); background: var(--pane); font-size: var(--fs-s); color: var(--fg); white-space: nowrap; display: inline-flex; align-items: center; transition: border-color .15s, background-color .15s; }
.offer:hover { background: var(--soft); }
.alwaysbar { margin: 0 max(20px, calc((100% - 720px) / 2)) 8px; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--r-m); background: color-mix(in srgb, var(--bad) 10%, transparent); color: var(--bad); font-size: var(--fs-s); flex: none; }
.alwaysbar span { flex: 1; }
.alwaysbar button { border: 0; background: transparent; font-weight: 600; color: var(--bad); font-size: var(--fs-s); }
.composer { margin: 0 max(20px, calc((100% - 720px) / 2)) 6px; display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 9px; border-radius: 16px; background: var(--pane); border: 1px solid var(--line); box-shadow: var(--shade); flex: none; }
.composer:focus-within { border-color: color-mix(in srgb, var(--fg) 35%, transparent); }
.composer .plus { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--soft); color: var(--text2); display: grid; place-items: center; }
.composer .plus .i, .composer .send .i { width: 16px; height: 16px; }
.composer input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--fg); font: inherit; font-size: var(--fs-ui); }
.composer input::placeholder { color: var(--text3); }
.composer .send { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--soft2); color: var(--text3); display: grid; place-items: center; }
.composer .send.go { background: var(--fg); color: var(--bg); }
.composer .zap { width: 30px; height: 30px; border-radius: 50%; border: 0; background: transparent; color: var(--bad); display: grid; place-items: center; }
.queued-bar { text-align: center; font-size: var(--fs-cap); color: var(--text3); padding: 2px 16px 10px; min-height: 26px; flex: none; }
/* 工作流 */
.canvas { flex: 1; min-height: 0; overflow: auto; position: relative; background-color: var(--bg); background-image: radial-gradient(var(--grid) 1.2px, transparent 1.4px); background-size: 18px 18px; border-top: 1px solid var(--line); }
.board-wrap { position: relative; margin: 64px auto 80px; }
.board { position: absolute; left: 0; top: 0; width: 760px; height: 600px; transform-origin: 0 0; }
.board svg.edges { position: absolute; inset: 0; width: 760px; height: 600px; overflow: visible; pointer-events: none; }
.edges path { fill: none; stroke: color-mix(in srgb, var(--fg) 35%, transparent); stroke-width: 1.6; }
.edges path.on { stroke: var(--ok); }
.edges text { font: 600 11px var(--font); fill: var(--text3); }
.node { position: absolute; width: 186px; border-radius: var(--r-m); background: var(--pane); border: 1px solid var(--line); box-shadow: 0 1px 3px #0000001a; padding: 10px 12px; cursor: grab; touch-action: none; user-select: none; transition: box-shadow .2s, border-color .2s; }
.node:active { cursor: grabbing; }
.node.waiting { border-color: var(--attention); box-shadow: 0 0 0 3px color-mix(in srgb, var(--attention) 22%, transparent); }
.node.running { border-color: var(--accent); }
.node .nh { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; }
.node .nh .i { width: 14px; height: 14px; color: var(--text2); }
.node .ns { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--text3); }
.node .ns.done { color: var(--ok); } .node .ns.running { color: var(--accent); } .node .ns.waiting { color: var(--attention); } .node .ns.stopped { color: var(--bad); }
.node .nb { font-size: 11.5px; color: var(--text2); line-height: 1.5; margin-top: 5px; }
.node .nb b { color: var(--accent); font-weight: 600; display: block; }
.node .go { margin-top: 8px; width: 100%; height: 26px; border-radius: 7px; border: 0; background: var(--soft2); font-size: 11.5px; font-weight: 600; }
.node.note { background: #f7c8a8; color: #3a2414; border: 0; width: 120px; min-height: 96px; box-shadow: 0 6px 14px -6px #0000004d; }
.node.note .nb { color: #3a2414; font-size: 12px; white-space: pre-line; margin: 0; }
.wf-banner { position: absolute; top: 66px; left: 50%; translate: -50% 0; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: var(--r-l); background: var(--pane); border: 1.5px solid var(--attention); box-shadow: var(--shade); white-space: nowrap; max-width: calc(100% - 24px); animation: rise .3s both; }
.wf-banner span { overflow: hidden; text-overflow: ellipsis; font-size: var(--fs-s); }
.wf-banner.done { border-color: var(--ok); }
.wf-banner button { height: 32px; padding: 0 16px; border-radius: var(--r-full); border: 0; background: var(--soft2); font-weight: 600; font-size: var(--fs-s); flex: none; }
.wf-banner button.yes { background: var(--fg); color: var(--bg); }
.wf-tools { position: absolute; bottom: 14px; left: 50%; translate: -50% 0; z-index: 3; display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: var(--r-l); background: var(--pane); border: 1px solid var(--line); box-shadow: var(--shade); }
.wf-tools .rb { width: 34px; height: 34px; }
.wf-tools .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.wf-tools .add { height: 34px; padding: 0 14px; border-radius: var(--r-m); border: 0; background: var(--fg); color: var(--bg); font-weight: 600; font-size: var(--fs-s); display: inline-flex; align-items: center; gap: 4px; margin-left: 4px; white-space: nowrap; }
.wf-zoom { position: absolute; bottom: 14px; left: 14px; z-index: 3; display: flex; align-items: center; padding: 3px; border-radius: var(--r-m); background: var(--pane); border: 1px solid var(--line); box-shadow: var(--shade); font-size: var(--fs-cap); font-variant-numeric: tabular-nums; }
.wf-zoom .rb { width: 28px; height: 28px; }
.wf-zoom span { min-width: 40px; text-align: center; }
@media (max-width: 960px) { .wf-zoom { display: none; } }
/* 日程 */
.sched { flex: 1; min-height: 0; overflow: auto; padding: 16px 22px 22px; border-top: 1px solid var(--line); display: grid; align-content: start; grid-auto-rows: max-content; gap: 16px; }
.sch-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sch-top .range { font: 650 18px/1 var(--display); margin-left: 6px; font-variant-numeric: tabular-nums; }
.sch-top .today { height: 30px; padding: 0 14px; border-radius: var(--r-full); border: 0; background: var(--soft); color: var(--text2); font-size: var(--fs-s); }
.seg { display: inline-flex; padding: 3px; border-radius: var(--r-full); background: var(--soft); margin-left: auto; }
.seg button { height: 28px; padding: 0 13px; border-radius: var(--r-full); border: 0; background: transparent; font-size: var(--fs-s); color: var(--text2); }
.seg button.on { background: var(--pane); color: var(--fg); font-weight: 600; box-shadow: 0 1px 3px #0000001f; }
.week { display: grid; grid-template-columns: repeat(7, minmax(92px, 1fr)); gap: 8px; overflow-x: auto; }
.dcol { border: 1px solid var(--line); border-radius: var(--r-l); padding: 10px; min-height: 190px; display: grid; align-content: start; gap: 10px; background: var(--pane); }
.dcol.today { border-color: var(--accent); }
.dcol h5 { margin: 0; font-size: var(--fs-s); font-weight: 650; white-space: nowrap; }
.dcol.today h5 { color: var(--accent); }
.it { display: grid; gap: 2px; font-size: var(--fs-s); }
.it .t { display: flex; align-items: center; gap: 5px; font-size: var(--fs-cap); color: var(--text3); font-variant-numeric: tabular-nums; }
.it .t .i { width: 13px; height: 13px; }
.it .t .i.ok { color: var(--ok); } .it .t .i.no { color: var(--bad); } .it .t .i.wait { color: var(--attention); }
.it .t .av { width: 18px; height: 18px; margin-left: auto; }
.it b { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coming { border: 1px solid var(--line); border-radius: var(--r-l); padding: 12px 16px; display: grid; gap: 4px; background: var(--pane); }
.coming h5 { margin: 0 0 4px; font-size: var(--fs-s); color: var(--text3); font-weight: 500; }
.crow { display: grid; grid-template-columns: 10px minmax(0, 1fr) 26px; gap: 10px; align-items: center; padding: 7px 0; font-size: var(--fs-s); }
.crow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.crow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow .av { width: 24px; height: 24px; }
.crow.fresh span { font-weight: 600; }
.addr { justify-self: start; border: 0; background: transparent; color: var(--text2); font-size: var(--fs-s); padding: 4px 2px; }
.addr:hover { color: var(--fg); }
.dayl { display: grid; gap: 2px; }
.dayl .it { grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; padding: 9px 6px; border-bottom: 1px solid var(--line); gap: 10px; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month div { border-radius: var(--r-s); padding: 6px; min-height: 52px; background: var(--soft); font-size: var(--fs-cap); color: var(--text2); }
.month div.out { opacity: .4; }
.month div.today { outline: 1.5px solid var(--accent); color: var(--accent); font-weight: 650; }
.month i { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin: 6px 2px 0 0; }
/* dialogs: 任務, 所有檔案, 市集, 設定, 傳送 */
.scrim { position: absolute; inset: 0; z-index: 10; background: color-mix(in srgb, #000 28%, transparent); display: grid; place-items: center; padding: 28px; animation: fade .2s both; }
.dlg { width: min(860px, 100%); height: min(560px, 100%); background: var(--pane); border-radius: var(--r-l); box-shadow: var(--shade); display: flex; flex-direction: column; overflow: hidden; animation: rise .25s both; }
.dlg.sm { width: min(520px, 100%); height: auto; max-height: 100%; }
.dlg-h { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 12px 0 22px; border-bottom: 1px solid var(--line); flex: none; }
.dlg-h h4 { margin: 0; font: 650 18px/1 var(--display); }
.dlg-h .ib { margin-left: auto; }
.dlg-b { flex: 1; min-height: 0; display: grid; grid-template-columns: 190px minmax(0, 1fr); }
.dlg-b.one { grid-template-columns: minmax(0, 1fr); }
.dside { background: var(--side); padding: 12px 10px; display: grid; align-content: start; gap: 2px; overflow: auto; border-right: 1px solid var(--line); }
.dside input { height: 32px; border-radius: var(--r-m); border: 0; background: var(--soft2); padding: 0 10px; font: inherit; font-size: var(--fs-s); color: var(--fg); outline: 0; margin-bottom: 8px; }
.dside button { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border-radius: var(--r-m); border: 0; background: transparent; font-size: var(--fs-s); text-align: left; }
.dside button:hover { background: var(--soft); }
.dside button.on { background: var(--soft2); font-weight: 600; }
.dside button em { margin-left: auto; font-style: normal; font-size: var(--fs-cap); color: var(--text3); }
.dside h6 { margin: 12px 10px 4px; font-size: var(--fs-cap); color: var(--text3); font-weight: 500; }
.dside .inst { display: flex; align-items: center; gap: 8px; padding: 4px 10px; font-size: var(--fs-cap); color: var(--text2); }
.dside .inst::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text3); }
.dside .inst em { margin-left: auto; font-style: normal; color: var(--text3); }
.dmain { padding: 16px 20px 20px; overflow: auto; display: grid; align-content: start; gap: 12px; min-width: 0; }
.dmain h5 { margin: 0; font-size: var(--fs-ui); font-weight: 650; }
.dmain .desc { font-size: var(--fs-s); color: var(--text3); margin-top: -8px; }
.dtop { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chipb { height: 28px; padding: 0 12px; border-radius: var(--r-full); border: 0; background: var(--soft); font-size: var(--fs-s); color: var(--text2); display: inline-flex; align-items: center; gap: 4px; }
.chipb.on { background: var(--soft2); color: var(--fg); font-weight: 600; }
.mk { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mkc { border: 1px solid var(--line); border-radius: var(--r-l); padding: 14px; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.mkc .lt { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-weight: 650; font-size: 16px; grid-row: span 2; }
.mkc .av { width: 40px; height: 40px; grid-row: span 2; }
.mkc b { font-weight: 600; font-size: var(--fs-s); }
.mkc b small { font-weight: 400; color: var(--text3); margin-left: 6px; }
.mkc p { grid-column: 1 / -1; font-size: var(--fs-cap); color: var(--text2); line-height: 1.55; margin-top: 4px; }
.mkc .add { grid-row: span 2; height: 30px; padding: 0 14px; border-radius: var(--r-full); border: 0; background: var(--soft2); font-weight: 600; font-size: var(--fs-s); white-space: nowrap; }
.mkc .add.done { background: transparent; color: var(--ok); }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.fcard { border: 0; background: transparent; padding: 0; display: grid; gap: 6px; text-align: left; font-size: var(--fs-cap); min-width: 0; }
.fcard .th { aspect-ratio: 4 / 3; border-radius: var(--r-m); background: var(--soft); display: grid; place-items: center; color: var(--text3); border: 1px solid var(--line); }
.fcard .th .i { width: 26px; height: 26px; }
.fcard .th.img { background: linear-gradient(135deg, var(--h1), var(--h2)); color: #ffffffcc; border: 0; }
.fcard b { font-weight: 500; font-size: var(--fs-s); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcard span { color: var(--text3); }
.fcard.fresh .th { box-shadow: 0 0 0 2px var(--accent); }
.flist .frow { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; font-size: var(--fs-s); width: 100%; }
.flist .frow span { color: var(--text3); font-size: var(--fs-cap); white-space: nowrap; }
.tasks { display: grid; gap: 8px; }
.tk { border: 1px solid var(--line); border-radius: var(--r-l); padding: 12px 14px; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; text-align: left; background: var(--pane); width: 100%; }
.tk:hover { background: var(--soft); }
.tk .av { width: 30px; height: 30px; }
.tk .hd { display: flex; align-items: center; gap: 8px; font-size: var(--fs-cap); color: var(--text3); }
.tk .st { margin-left: auto; font-weight: 600; padding: 2px 9px; border-radius: var(--r-full); background: var(--soft); white-space: nowrap; }
.tk .st.waiting { color: var(--attention); background: color-mix(in srgb, var(--attention) 14%, transparent); }
.tk .st.running { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tk .st.done { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.tk .tx { font-size: var(--fs-ui); margin-top: 2px; }
.tk .ln { font-size: var(--fs-cap); color: var(--text3); margin-top: 2px; }
.empty-note { font-size: var(--fs-s); color: var(--text3); padding: 8px 2px; }
.sgroup { border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.srow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: var(--fs-s); min-height: 52px; }
.srow:last-child { border-bottom: 0; }
.srow small { display: block; font-size: var(--fs-cap); color: var(--text3); margin-top: 2px; }
.srow .r { color: var(--text3); font-size: var(--fs-cap); text-align: right; }
.srow .r.ok { color: var(--ok); }
.srow .swatches { display: grid; grid-template-columns: repeat(8, 30px); gap: 6px; }
.srow .sw { padding: 0; width: 30px; }
.srow .sw i { width: 30px; height: 30px; border-radius: 9px; }
.srow .sw i::before { display: none; }
.srow .sw i::after { right: 4px; bottom: 4px; width: 9px; height: 9px; }
.srow .sw span, .srow .sw { font-size: 0; }
.srow .sw.on { border: 0; }
.srow .sw.on i { box-shadow: 0 0 0 2px var(--pane), 0 0 0 3.5px var(--fg); }
.switch { width: 42px; height: 25px; border-radius: 13px; border: 0; background: var(--soft2); position: relative; transition: background-color .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0000004d; transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { transform: translateX(17px); }
.switch.danger[aria-checked="true"] { background: var(--bad); }
.fake-select { height: 32px; padding: 0 12px; border-radius: var(--r-m); background: var(--soft); font-size: var(--fs-s); display: inline-flex; align-items: center; gap: 6px; }
.devs { display: flex; gap: 8px; flex-wrap: wrap; }
.drop-in { display: grid; gap: 8px; }
.drop-in textarea { min-height: 70px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--pane); color: var(--fg); padding: 10px 12px; font: inherit; font-size: var(--fs-s); resize: vertical; outline: 0; }
.big-btn { height: 40px; border-radius: var(--r-full); border: 0; background: var(--fg); color: var(--bg); font-weight: 600; font-size: var(--fs-s); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.big-btn.soft { background: var(--soft2); color: var(--fg); }
.menu { position: absolute; z-index: 9; top: 48px; right: 14px; min-width: 200px; background: var(--pane); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: var(--shade); padding: 5px; display: grid; animation: rise .2s both; }
.menu button { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 8px; border: 0; background: transparent; font-size: var(--fs-s); text-align: left; }
.menu button:hover { background: var(--soft); }
.app-toast { position: absolute; z-index: 12; left: 50%; bottom: 84px; translate: -50% 0; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: var(--r-m); background: color-mix(in srgb, var(--pane) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); box-shadow: var(--shade); font-size: var(--fs-s); animation: rise .25s both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes blink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: none; opacity: 1; } }
/* The same app on a phone: the list first, each place on its own page (the phone page's way). */
.win.m { grid-template-columns: minmax(0, 1fr); height: 660px; }
.win.m .rail { display: none; }
.win.m .side { border-right: 0; background: var(--bg); padding: 10px 8px; }
.win.m .side-top .side-head { display: block; }
.win.m .pchips { display: flex; }
.win.m .bots, .win.m .list { display: flex; flex-direction: column; gap: 0; }
.win.m .bot { grid-template-columns: 46px minmax(0, 1fr); justify-items: stretch; align-items: center; text-align: left; gap: 12px; padding: 9px 8px; }
.win.m .bot .av { width: 46px; height: 46px; }
.win.m .bot .nm b { font-weight: 600; }
.win.m .bot .pv { display: block; font-size: var(--fs-s); color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win.m .bot.on { background: transparent; }
.win.m .bot .dot { top: 50%; right: 12px; left: auto; transform: translateY(-50%); }
.win.m .side-foot { border-top: 1px solid var(--line); }
.win.m.in-main .side { display: none; }
.win.m:not(.in-main) .amain { display: none; }
.win.m .bar { padding-left: 12px; }
.win.m .bar .back { display: inline-grid; }
.win.m .bar .tag, .win.m .bar .crumb, .win.m .bar .wide { display: none; }
.win.m .offers { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.win.m .hello { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding-top: 16px; }
.win.m .hello .av { grid-row: auto; width: 64px; height: 64px; }
.win.m .hello h3 { font-size: 21px; }
.win.m .hello-offers { justify-content: center; }
.win.m .scrim { padding: 0; }
.win.m .dlg { width: 100%; height: 100%; border-radius: 0; }
.win.m .dlg-b { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
.win.m .dside { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; gap: 4px; scrollbar-width: none; }
.win.m .dside input, .win.m .dside h6, .win.m .dside .inst { display: none; }
.win.m .dside button { flex: none; }
.win.m .mk { grid-template-columns: minmax(0, 1fr); }
.win.m .wf-tools .rb:not(.keep), .win.m .wf-tools .sep { display: none; }
.win.m .sched { padding: 12px 14px 18px; }
.win.m .srow.wrap { grid-template-columns: minmax(0, 1fr); }
.win.m .srow.wrap .r { text-align: left; }
.win.m .srow .swatches { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.win.m .srow .sw, .win.m .srow .sw i { width: 100%; }
.win.m .srow .sw i { height: auto; aspect-ratio: 1; }
.win.framed { width: 392px; height: 790px; border-radius: 50px; border: 11px solid #1b1a19; box-shadow: var(--shade), inset 0 0 0 1px #ffffff14; }
.win.framed .side { padding-top: 34px; }
.win.framed .amain .bar { margin-top: 26px; }
.win.framed::before { content: ""; position: absolute; top: 9px; left: 50%; translate: -50% 0; width: 96px; height: 26px; border-radius: 14px; background: #1b1a19; z-index: 20; }
/* ---------- sections ---------- */
section.s { padding-block: clamp(64px, 10vw, 120px) 0; }
.kicker { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-s); font-weight: 600; color: var(--accent); }
.kicker .i { width: 16px; height: 16px; }
.s h2 { font-size: var(--fs-h2); line-height: 1.25; font-weight: 700; margin-top: 12px; max-width: 18em; }
.s .sub { margin-top: 14px; font-size: var(--fs-read); line-height: 1.75; color: var(--text2); max-width: 36em; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(28px, 6vw, 80px); align-items: center; }
.split.flip > :first-child { order: 2; }
@media (max-width: 860px) { .split { grid-template-columns: minmax(0, 1fr); } .split.flip > :first-child { order: 0; } }
.points { display: grid; gap: 14px; margin: 26px 0 0; padding: 0; list-style: none; }
.points li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; font-size: var(--fs-ui); line-height: 1.65; color: var(--text2); }
.points li .i { margin-top: 3px; color: var(--fg); }
.points b { color: var(--fg); font-weight: 600; }
.points code, .s .sub code { font: 13px var(--mono); background: var(--soft); padding: 1px 6px; border-radius: 5px; }
.panel { background: var(--pane); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shade); padding: clamp(16px, 3vw, 24px); min-width: 0; }
/* three answers */
.answers { display: grid; gap: 10px; }
.answer { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start; padding: 14px; border-radius: var(--r-m); background: var(--soft); }
.answer .pill { height: 30px; padding: 0 14px; border-radius: var(--r-full); display: inline-flex; align-items: center; font-weight: 600; font-size: var(--fs-s); border: 1px solid var(--line); background: var(--pane); white-space: nowrap; }
.answer .pill.yes { background: var(--fg); color: var(--bg); border-color: transparent; }
.answer p { font-size: var(--fs-s); color: var(--text2); line-height: 1.6; }
.answer p b { color: var(--fg); display: block; font-size: var(--fs-ui); margin-bottom: 2px; }
.always { margin-top: 12px; display: flex; gap: 8px; align-items: center; font-size: var(--fs-cap); color: var(--text3); }
/* bots */
.crew { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 36px; }
@media (max-width: 860px) { .crew { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mate { background: var(--pane); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px; display: grid; gap: 10px; align-content: start; transition: transform .2s, box-shadow .2s; }
.mate:hover { transform: translateY(-3px); box-shadow: var(--shade); }
.mate .av { width: 48px; height: 48px; }
.mate h3 { font-size: var(--fs-ui); font-weight: 650; }
.mate p { font-size: var(--fs-s); color: var(--text2); line-height: 1.6; }
.mate .model { font: 12px/1 var(--mono); color: var(--text3); padding-top: 10px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.thread { margin-top: 14px; display: grid; gap: 10px; }
.said { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start; font-size: var(--fs-s); line-height: 1.6; }
.said .av { width: 30px; height: 30px; }
.said b { font-weight: 600; margin-right: 6px; }
.said em { font-style: normal; color: var(--accent); font-weight: 600; }
/* models */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--r-full); background: var(--pane); border: 1px solid var(--line); font-size: var(--fs-s); font-weight: 500; }
.chip small { color: var(--text3); font-weight: 400; }
.chip.hi { border-color: var(--fg); }
/* phone */
.phone { width: min(300px, 100%); aspect-ratio: 9 / 18.5; margin-inline: auto; border-radius: 44px; padding: 10px; background: #1b1a19; box-shadow: var(--shade), inset 0 0 0 1.5px #ffffff1f; }
.screen { height: 100%; border-radius: 35px; background: var(--bg); overflow: hidden; display: flex; flex-direction: column; position: relative; }
.screen .notch { width: 90px; height: 24px; border-radius: 14px; background: #1b1a19; margin: 8px auto 0; flex: none; }
.screen .ph { padding: 14px 16px 6px; font: 700 20px/1 var(--display); display: flex; align-items: center; justify-content: space-between; }
.screen .ph .i { width: 18px; height: 18px; color: var(--text2); }
.prow { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 16px; }
.prow .av { width: 38px; height: 38px; }
.prow b { display: block; font-size: 13.5px; font-weight: 600; }
.prow span { display: block; font-size: 12px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow time { font-size: 11px; color: var(--text3); align-self: start; padding-top: 3px; }
.prow .wait { color: var(--attention); font-weight: 600; }
.banner { position: absolute; left: 10px; right: 10px; top: 44px; background: color-mix(in srgb, var(--pane) 86%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid var(--line); border-radius: 18px; padding: 10px 12px; box-shadow: var(--shade); font-size: 12px; display: grid; gap: 8px; animation: drop 4.8s 1s infinite both; }
.banner b { font-size: 12.5px; }
.banner .row { display: flex; gap: 6px; }
.banner .row i { flex: 1; text-align: center; font-style: normal; font-weight: 600; padding: 5px 0; border-radius: var(--r-full); background: var(--soft2); }
.banner .row i:first-child { background: var(--fg); color: var(--bg); }
@keyframes drop { 0% { opacity: 0; transform: translateY(-14px); } 10%, 72% { opacity: 1; transform: none; } 82%, 100% { opacity: 0; transform: translateY(-14px); } }
.pad { margin: auto 12px 12px; height: 92px; border-radius: 18px; background: var(--soft); display: grid; place-items: center; color: var(--text3); font-size: 11px; position: relative; }
.pad::after { content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 35%, transparent); animation: glide 3.6s ease-in-out infinite; }
@keyframes glide { 0%, 100% { transform: translate(-50px, 10px); } 50% { transform: translate(40px, -14px); } }
.keys { display: flex; gap: 4px; padding: 0 12px 14px; }
.keys i { flex: 1; font: 600 10.5px/26px var(--mono); text-align: center; border-radius: 8px; background: var(--soft2); font-style: normal; color: var(--text2); }
/* schedule */
.day { display: grid; gap: 2px; }
.day h4 { margin: 0 0 8px; font-size: var(--fs-s); color: var(--text3); font-weight: 600; }
.slot { display: grid; grid-template-columns: 52px 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 8px; border-radius: var(--r-m); }
.slot:hover { background: var(--soft); }
.slot time { font: 13px/1 var(--mono); color: var(--text2); }
.slot .av { width: 26px; height: 26px; }
.slot b { display: block; font-size: var(--fs-ui); font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot span { font-size: var(--fs-cap); color: var(--text3); }
.state { font-size: var(--fs-cap); font-weight: 600; padding: 3px 10px; border-radius: var(--r-full); background: var(--soft); color: var(--text2); white-space: nowrap; }
.state.done { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.state.run { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.triggers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 22px; }
.triggers span { font-size: var(--fs-cap); padding: 5px 11px; border-radius: var(--r-full); border: 1px dashed var(--line); color: var(--text2); }
/* yours */
.yours { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 36px; }
@media (max-width: 860px) { .yours { grid-template-columns: minmax(0, 1fr); } }
.fact { padding: 20px; border-radius: var(--r-l); border: 1px solid var(--line); display: grid; gap: 8px; align-content: start; }
.fact .i { width: 22px; height: 22px; color: var(--accent); }
.fact h3 { font-size: var(--fs-ui); font-weight: 650; }
.fact p { font-size: var(--fs-s); line-height: 1.65; color: var(--text2); }
.map { margin-top: 12px; padding: 20px; border-radius: var(--r-l); background: var(--soft); overflow-x: auto; }
.map pre { margin: 0; font: 12.5px/1.75 var(--mono); color: var(--text2); white-space: pre; }
/* styles gallery */
.gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 32px; }
@media (max-width: 720px) { .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tpl { text-align: left; padding: 0; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--pane); overflow: hidden; transition: transform .2s, box-shadow .2s, border-color .2s; }
.tpl:hover { transform: translateY(-3px); box-shadow: var(--shade); }
.tpl.on { border-color: var(--fg); box-shadow: 0 0 0 1px var(--fg); }
.tpl .pic { display: grid; grid-template-columns: 30% 1fr; height: 92px; background: var(--b); }
.tpl .pic i { background: color-mix(in srgb, var(--b) 92%, var(--f)); border-right: 1px solid color-mix(in srgb, var(--f) 10%, transparent); position: relative; }
.tpl .pic i::before { content: ""; position: absolute; left: 8px; right: 8px; top: 14px; height: 16px; border-radius: 5px; background: color-mix(in srgb, var(--f) 12%, transparent); }
.tpl .pic s { position: relative; text-decoration: none; }
.tpl .pic s::before { content: ""; position: absolute; right: 12px; top: 16px; width: 46%; height: 14px; border-radius: 8px 8px 3px 8px; background: var(--f); opacity: .85; }
.tpl .pic s::after { content: ""; position: absolute; left: 12px; top: 40px; width: 58%; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--f) 30%, transparent); box-shadow: 0 12px 0 color-mix(in srgb, var(--f) 30%, transparent); }
.tpl .pic b { position: absolute; right: 12px; bottom: 12px; width: 14px; height: 14px; border-radius: 50%; background: var(--a); }
.tpl .meta { padding: 10px 14px 12px; display: grid; gap: 2px; }
.tpl .meta b { font-size: var(--fs-ui); }
.tpl .meta span { font-size: var(--fs-cap); color: var(--text3); }
/* install */
.install { margin-top: 32px; }
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--r-full); background: var(--soft); flex-wrap: wrap; }
.tabs button { height: 34px; padding: 0 16px; border: 0; border-radius: var(--r-full); background: transparent; font-weight: 600; font-size: var(--fs-s); color: var(--text2); }
.tabs button[aria-selected="true"] { background: var(--pane); color: var(--fg); box-shadow: 0 1px 3px #0000001f; }
.cmd { margin-top: 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 8px 8px 18px; border-radius: var(--r-m); background: color-mix(in srgb, var(--fg) 92%, var(--bg)); color: var(--bg); }
.cmd pre { margin: 0; overflow-x: auto; font: 13px/1.7 var(--mono); padding-block: 8px; scrollbar-width: thin; }
.cmd pre::before { content: "$ "; opacity: .45; }
.cmd .copy { height: 36px; padding: 0 14px; border-radius: var(--r-full); border: 1px solid color-mix(in srgb, var(--bg) 25%, transparent); background: transparent; color: var(--bg); font-weight: 600; font-size: var(--fs-s); display: inline-flex; align-items: center; gap: 6px; }
.cmd .copy .i { width: 15px; height: 15px; }
.steps3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
@media (max-width: 720px) { .steps3 { grid-template-columns: minmax(0, 1fr); } }
.steps3 div { padding: 16px; border-radius: var(--r-m); background: var(--soft); font-size: var(--fs-s); line-height: 1.6; color: var(--text2); }
.steps3 b { display: block; color: var(--fg); font-size: var(--fs-ui); margin-bottom: 4px; }
.steps3 small { font: 600 12px/1 var(--mono); color: var(--accent); display: block; margin-bottom: 8px; }
.tabnote { margin-top: 10px; font-size: var(--fs-s); color: var(--text3); }
/* FAQ */
.faq { margin-top: 28px; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 18px 4px; font-size: var(--fs-read); font-weight: 600; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; margin-left: auto; font: 400 22px/1 var(--font); color: var(--text3); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 4px 20px; color: var(--text2); line-height: 1.75; max-width: 46em; }
.faq code { font: 13px var(--mono); background: var(--soft); padding: 1px 6px; border-radius: 5px; }
/* the cat's yellow (a brand surface, the same in every 風格 and theme) */
.closing { margin-top: clamp(72px, 10vw, 128px); background: var(--brand); color: var(--brand-ink); }
.closing .wrap { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); align-items: center; gap: 32px; padding-block: clamp(48px, 7vw, 80px) 0; }
.closing h2 { font-size: clamp(30px, 4.6vw, 48px); line-height: 1.15; font-weight: 750; }
.closing p { margin-top: 14px; font-size: var(--fs-read); line-height: 1.7; color: #1d1a12c4; max-width: 30em; }
.closing .cta .btn { background: var(--brand-ink); color: #fff8e1; border-color: transparent; }
.closing .cta .btn.ghost { background: transparent; color: var(--brand-ink); border-color: #1d1a1240; }
.closing img { display: block; width: 100%; max-width: 380px; height: auto; justify-self: end; align-self: end; border-radius: 28px 28px 0 0; }
@media (max-width: 720px) { .closing .wrap { grid-template-columns: minmax(0, 1fr); } .closing img { justify-self: center; max-width: 280px; } }
.closing .cta { padding-bottom: clamp(48px, 7vw, 80px); }
footer { padding-block: 40px 56px; color: var(--text3); font-size: var(--fs-s); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; }
footer a { text-decoration: none; color: var(--text2); }
footer a:hover { color: var(--fg); }
footer .logo { color: var(--fg); font-size: 15px; }
footer .logo img { width: 24px; height: 24px; border-radius: 6px; }
footer .end { margin-left: auto; }
</style>
</head>
<body>
<header class="top" id="top">
<div class="wrap">
<a class="logo" href="#"><img src="icon.jpg" alt="">AnyBot</a>
<nav aria-label="主要">
<a href="#ask">先問你</a>
<a href="#crew">一群 Bot</a>
<a href="#phone">手機</a>
<a href="#yours">資料</a>
<a href="#faq">常見問題</a>
</nav>
<div class="end">
<button class="ib" id="style-btn" aria-label="換風格" aria-expanded="false" aria-controls="style-pop"><svg class="i" data-i="palette"></svg></button>
<a class="ib src" href="https://code.30cm.net/daniel.w/AnyBot" aria-label="原始碼" target="_blank" rel="noopener"><svg class="i" data-i="code"></svg></a>
<a class="btn main sm" href="#install">安裝</a>
</div>
</div>
<div class="pop" id="style-pop" hidden>
<h4>風格(跟 App 裡的同一套)</h4>
<div class="swatches" id="swatches"></div>
<div class="modes" role="group" aria-label="深淺">
<button data-mode="">跟系統</button><button data-mode="light">淺色</button><button data-mode="dark">深色</button>
</div>
</div>
</header>
<main>
<div class="hero">
<div class="wrap">
<div class="eyebrow"><span>開源 Apache-2.0</span><span>macOS · Linux · Windows</span><span>手機用瀏覽器</span></div>
<h1><span class="line">跑在你自己電腦上的 AI 助理,</span><span class="mark">動手之前先問你。</span></h1>
<p class="lede">會聊天,也會動手:整理檔案、跑指令、開瀏覽器填表、操作螢幕、到點自己做。模型你選,聊天和記憶留在你的電腦上。</p>
<div class="cta">
<a class="btn main" href="#install"><svg class="i" data-i="terminal"></svg>安裝 AnyBot</a>
<a class="btn" href="#live">在網頁上試用<svg class="i" data-i="arrow-down"></svg></a>
</div>
<p class="fine">免費。用你自己的 API 金鑰、ChatGPT 方案,或家裡的 Ollama。</p>
</div>
</div>
<div class="stage" id="live">
<div class="wrap">
<div class="stage-top">
<p class="note">網頁上的示範,跟桌面 App 同一個樣子:左邊每一格都能點、打字也可以。不連任何模型,也不會動到你的電腦。</p>
<div class="tabs" role="tablist" aria-label="看哪一種">
<button role="tab" id="view-desk" data-view="desk" aria-selected="true">電腦</button>
<button role="tab" id="view-phone" data-view="phone" aria-selected="false">手機</button>
</div>
</div>
<div class="win" id="app" aria-label="試用 AnyBot">
<nav class="rail" aria-label="地方">
<div class="lights"><i></i><i></i><i></i></div>
<button class="rb on" data-nav="chat" title="聊天" aria-label="聊天"><svg class="i" data-i="messages"></svg></button>
<button class="rb" data-nav="wf" title="工作流" aria-label="工作流"><svg class="i" data-i="workflow"></svg></button>
<button class="rb" data-nav="sched" title="日程" aria-label="日程"><svg class="i" data-i="calendar"></svg></button>
<button class="rb" data-modal="tasks" title="任務" aria-label="任務"><svg class="i" data-i="circle-check"></svg><span class="badge" id="badge" hidden></span></button>
<button class="rb" data-modal="files" title="所有檔案" aria-label="所有檔案"><svg class="i" data-i="folder"></svg></button>
<span class="sp"></span>
<button class="rb" data-modal="drops" title="傳送檔案或文字到其他裝置" aria-label="傳送"><svg class="i" data-i="upload"></svg></button>
<button class="rb" data-modal="market" title="市集:連接器、技能、Bot 範本" aria-label="市集"><svg class="i" data-i="grid"></svg></button>
<button class="rb" data-modal="settings" title="設定" aria-label="設定"><svg class="i" data-i="gear"></svg></button>
</nav>
<aside class="side">
<div class="side-top"><span class="side-head">AnyBot</span><span class="sp"></span><button class="ib" id="find-btn" aria-label="搜尋 Bot" title="搜尋 Bot"><svg class="i" data-i="search"></svg></button><button class="ib" data-modal="market" data-arg="tpl" aria-label="新增 Bot" title="新增"><svg class="i" data-i="plus"></svg></button></div>
<input class="find" id="find" type="search" placeholder="搜尋 Bot" aria-label="搜尋 Bot" hidden>
<div class="pchips" id="pchips"></div>
<div class="side-scroll"><div class="bots" id="side-bots"></div><div id="side-list"></div></div>
<div class="side-foot"><div class="me"><b>你</b><span>你<small>這台電腦</small></span></div></div>
</aside>
<div class="amain">
<section class="view" id="v-chat">
<div class="bar"><button class="ib back" data-back aria-label="回到清單"><svg class="i" data-i="chevron-left"></svg></button><span class="av" id="bar-av" style="width:26px;height:26px" hidden></span><h4 id="bar-name"></h4><span class="tag" id="bar-tag"></span><span class="sp"></span><button class="tb wide" id="share">分享</button><button class="ib" id="more" aria-label="更多"><svg class="i" data-i="more"></svg></button></div>
<div class="convs" id="convs"></div>
<div class="offers" id="offers"></div>
<div class="alwaysbar" id="alwaysbar" hidden><svg class="i" data-i="zap"></svg><span>一律放行開著:要允許的都自動答應(付款這類每次都問的照樣問)</span><button data-always-off>關閉</button></div>
<form class="composer" id="composer" autocomplete="off">
<button type="button" class="plus" aria-label="附加檔案" data-toast="示範:真的 AnyBot 可以附上檔案、照片,或從手機丟過來"><svg class="i" data-i="plus"></svg></button>
<input id="say" type="text" placeholder="傳訊息給 電腦助手" enterkeyhint="send" aria-label="訊息">
<button type="button" class="zap" id="zap" hidden title="一律放行開著(點一下關閉)" aria-label="關閉一律放行" data-always-off><svg class="i" data-i="zap"></svg></button>
<button class="send" id="send" aria-label="送出"><svg class="i" data-i="arrow-up"></svg></button>
</form>
<div class="queued-bar" id="queued"></div>
</section>
<section class="view" id="v-wf" hidden></section>
<section class="view" id="v-sched" hidden></section>
</div>
<div class="scrim" id="modal" hidden></div>
</div>
</div>
</div>
<section class="s" id="ask">
<div class="wrap split">
<div>
<span class="kicker"><svg class="i" data-i="shield-check"></svg>先問你</span>
<h2>動你的電腦、對外送出、收不回來的事,先跳一張卡片。</h2>
<p class="sub">卡片上寫清楚它要做什麼。你按了才動手;付款、寄出、刪除每次都問,安全規則擋下的怎麼設都不放行。</p>
<ul class="points">
<li><svg class="i" data-i="box"></svg><span><b>指令在沙盒裡跑。</b>macOS 和 Linux 上,私密資料夾讀不到也改不了。</span></li>
<li><svg class="i" data-i="rotate-ccw"></svg><span><b>改錯了能退回。</b>Bot 改檔前先存一份,打 <code>/rewind</code> 回到之前某一句。</span></li>
<li><svg class="i" data-i="key"></svg><span><b>密碼模型看不到。</b>密碼和卡號放在保險庫,由 AnyBot 直接填進網頁。</span></li>
<li><svg class="i" data-i="history"></svg><span><b>做過什麼都查得到。</b>每一步都留在稽核時間軸,包括你不在時例行任務做的。</span></li>
</ul>
</div>
<div class="panel">
<div class="answers">
<div class="answer"><span class="pill yes">允許</span><p><b>這一次可以</b>只放行眼前這件事,下次同樣的事還會問。</p></div>
<div class="answer"><span class="pill">一律允許</span><p><b>這一類以後都可以</b>例如「在工作區裡建資料夾」。設定 › 權限 隨時收回。</p></div>
<div class="answer"><span class="pill">拒絕</span><p><b>不要做</b>Bot 會知道你拒絕了,改用別的方法或問你怎麼辦。</p></div>
</div>
<div class="always"><svg class="i" data-i="zap"></svg>真的信任它時,可以打開「一律放行」;聊天上方會一直提醒你它開著。</div>
</div>
</div>
</section>
<section class="s" id="crew">
<div class="wrap">
<span class="kicker"><svg class="i" data-i="users"></svg>一群 Bot</span>
<h2>每個 Bot 有自己的個性、模型、記憶和電腦。</h2>
<p class="sub">從範本建,或自己捏一個。它們會互相問問題、交辦工作,也能在群組裡輪流回答你;任何聊天打「@」就能點名。</p>
<div class="crew" id="crew-cards"></div>
<div class="panel thread" aria-label="群組聊天示範" style="margin-top:12px">
<div class="said"><span class="av" data-bot="0"></span><p><b>你</b>週末想去台南兩天,幫我排一下。</p></div>
<div class="said"><span class="av" data-bot="1"></span><p><b>研究助理</b>週六晴、週日午後可能有雨。我把室內景點排在週日下午,表格放在頁面「台南兩天」。</p></div>
<div class="said"><span class="av" data-bot="2"></span><p><b>寫作夥伴</b>接著補一個寫遊記的角度:用三家早餐串起兩天。<em>@電腦助手</em> 幫忙訂週六晚上的民宿?</p></div>
</div>
</div>
</section>
<section class="s" id="models">
<div class="wrap">
<span class="kicker"><svg class="i" data-i="sparkles"></svg>模型你選</span>
<h2>用你已經有的,每個 Bot 各用各的。</h2>
<p class="sub">貼上自己的 API 金鑰;有 ChatGPT Plus 或 Pro 就用帳號登入,用方案的額度;什麼都沒有就用家裡的 Ollama。主模型額度用完時,照順序換備用模型。</p>
<div class="chips">
<span class="chip hi">ChatGPT 方案<small>帳號登入,不用金鑰</small></span>
<span class="chip">Claude</span><span class="chip">OpenAI</span><span class="chip">Gemini</span><span class="chip">xAI Grok</span>
<span class="chip">OpenRouter</span><span class="chip">OpenCode Go</span>
<span class="chip">Ollama<small>在你的電腦上跑</small></span>
<span class="chip">任何 OpenAI 相容的服務</span>
</div>
</div>
</section>
<section class="s" id="phone">
<div class="wrap split flip">
<div>
<span class="kicker"><svg class="i" data-i="smartphone"></svg>手機</span>
<h2>出門也找得到它。</h2>
<p class="sub">手機瀏覽器打開你的網址、登入,就是同一個聊天。加到主畫面,用起來像一個 App。</p>
<ul class="points">
<li><svg class="i" data-i="bell"></svg><span><b>通知來了直接答。</b>允許、拒絕、回答它的問題,不用回到電腦前。</span></li>
<li><svg class="i" data-i="mouse-pointer"></svg><span><b>手機當觸控板。</b>看 Bot 的電腦或你家的 Mac,一指移動、兩指捲動,⌘、Ctrl、Tab 有按鍵列。</span></li>
<li><svg class="i" data-i="send"></svg><span><b>檔案丟過去。</b>照片、文件、一段網址,從手機傳到帳號裡任何一台電腦。</span></li>
<li><svg class="i" data-i="monitor"></svg><span><b>設定也在手機上。</b>日程、工作流、所有檔案、用量、風格,跟電腦上的一樣。</span></li>
</ul>
</div>
<div>
<div class="phone" aria-label="手機畫面示範">
<div class="screen">
<div class="notch"></div>
<div class="banner"><b>電腦助手 想執行一個指令</b><span>mkdir -p 2026-04 2026-05 2026-06</span><div class="row"><i>允許</i><i>拒絕</i></div></div>
<div class="ph">AnyBot<svg class="i" data-i="search"></svg></div>
<div id="phone-rows"></div>
<div class="pad">觸控板</div>
<div class="keys"><i>⌘</i><i>⌃</i><i>⇧</i><i>Tab</i><i>Esc</i><i>⌘Tab</i></div>
</div>
</div>
</div>
</div>
</section>
<section class="s" id="schedule">
<div class="wrap split">
<div>
<span class="kicker"><svg class="i" data-i="clock"></svg>到點自己做</span>
<h2>說一句「每個工作日早上 9 點」,就排好了。</h2>
<p class="sub">例行任務可以照時間跑,也可以在 PR 合併、CI 失敗、收到新信時跑。每次都留紀錄,連續失敗兩次自己暫停,不會半夜一直重試。</p>
<div class="triggers"><span>每天 07:30</span><span>每個工作日 09:00</span><span>PR 合併時</span><span>CI 失敗時</span><span>收到新信時</span><span>每月 1 號</span></div>
</div>
<div class="panel">
<div class="day" id="day"><h4>今天</h4></div>
</div>
</div>
</section>
<section class="s" id="yours">
<div class="wrap">
<span class="kicker"><svg class="i" data-i="lock"></svg>資料留在你這邊</span>
<h2>聊天、記憶、檔案、密碼,都在你自己的電腦上。</h2>
<p class="sub">要手機從外面連、多台電腦一起用時,再架一台你自己的帳號伺服器。它只負責把裝置接起來,不保存聊天。</p>
<div class="yours">
<div class="fact"><svg class="i" data-i="server"></svg><h3>伺服器也是你的</h3><p>任何有 Docker 的 Linux,2 GB 以上就夠。只問網址、帳號、密碼,HTTPS 它自己處理。</p></div>
<div class="fact"><svg class="i" data-i="lock"></svg><h3>備份先加密</h3><p>在你的電腦上加密後才上傳,伺服器打不開。換電腦登入帳號,Bot 和聊天跟過來。</p></div>
<div class="fact"><svg class="i" data-i="box"></svg><h3>Bot 有自己的電腦</h3><p>一台 Docker 裡的 Linux 小桌面,每個 Bot 有自己的螢幕和瀏覽器,跟你的電腦隔開。你隨時能看、能接手。</p></div>
</div>
<div class="map" aria-label="裝置怎麼接起來">
<pre> 你在手機上說話 你在筆電上說話 沒螢幕的電腦也行
\ | /
└──── 帳號伺服器(你自己架的,只負責把大家接起來)────┘
|
大腦:Bot、聊天、記憶、例行任務在這裡
|
手腳:大腦叫它看畫面、點擊、讀檔、開瀏覽器</pre>
</div>
</div>
</section>
<section class="s" id="styles">
<div class="wrap">
<span class="kicker"><svg class="i" data-i="palette"></svg>風格</span>
<h2>八種風格,點一下整套換。</h2>
<p class="sub">App 裡的同一套:顏色、聊天背景的花紋一起換,電腦和手機同步。在這裡點點看,整個網站會跟著換。</p>
<div class="gallery" id="gallery"></div>
</div>
</section>
<section class="s" id="install">
<div class="wrap">
<span class="kicker"><svg class="i" data-i="terminal"></svg>安裝</span>
<h2>打開終端機,貼一行。</h2>
<p class="sub">它會自己裝好需要的東西、問你要裝哪一種,然後做第一次設定。裝在你的使用者資料夾,不需要系統管理員。</p>
<div class="install">
<div class="tabs" role="tablist" aria-label="作業系統">
<button role="tab" id="tab-unix" aria-selected="true" data-tab="unix">macOS · Linux</button>
<button role="tab" id="tab-win" aria-selected="false" data-tab="win">Windows</button>
<button role="tab" id="tab-server" aria-selected="false" data-tab="server">伺服器</button>
</div>
<div class="cmd"><pre id="cmd-text"></pre><button class="copy" id="copy"><svg class="i" data-i="copy"></svg><span>複製</span></button></div>
<p class="tabnote" id="cmd-note"></p>
<div class="steps3">
<div><small>1</small><b>打開 AnyBot</b>Mac 第一次要對圖示按右鍵 › 打開(還沒有 Apple 開發者簽章)。</div>
<div><small>2</small><b>設定模型</b>貼上 API 金鑰、用 ChatGPT 帳號登入,或選 Ollama。</div>
<div><small>3</small><b>交代第一件事</b>例如「幫我把下載資料夾的照片照月份整理好」,它會先問你。</div>
</div>
</div>
</div>
</section>
<section class="s" id="faq">
<div class="wrap">
<span class="kicker"><svg class="i" data-i="help"></svg>常見問題</span>
<h2>簡短回答。</h2>
<div class="faq">
<details><summary>AnyBot 要錢嗎?</summary><p>不用。AnyBot 是 Apache-2.0 授權的開源軟體,免費使用。你只付給你選的模型服務;用 ChatGPT 方案的額度或家裡的 Ollama 也可以。</p></details>
<details><summary>可以用我的 ChatGPT Plus 或 Pro 嗎?</summary><p>可以。模型選「ChatGPT 方案」,按「使用 ChatGPT 繼續」用帳號登入,就用方案的額度,不用 API 金鑰。</p></details>
<details><summary>我的資料會去哪裡?</summary><p>聊天、記憶、檔案和保險庫在你的電腦,或你自己架的伺服器上。帳號伺服器只把裝置接起來;備份在你的電腦加密後才上傳。你送給模型的對話會到你選的模型服務;用 Ollama 的話,連這一段也不離開你的電腦。</p></details>
<details><summary>讓 Bot 在我的電腦上動手安全嗎?</summary><p>動電腦、對外送出、收不回來的事都先問你,付款、寄出、刪除每次都問。指令在沙盒裡跑,私密資料夾讀不到;改檔前先存一份,可以用 <code>/rewind</code> 退回。不想讓它碰你的電腦,就讓它用自己那台 Docker 裡的電腦。</p></details>
<details><summary>一定要架伺服器嗎?</summary><p>不用,裝好就能在這台電腦上用。想從手機外出連、或讓幾台電腦一起用,再架帳號伺服器;也可以先拿一台常開的 Mac 當大腦,手機在同一個 Wi-Fi 或 Tailscale 用手機密碼直接連。</p></details>
<details><summary>哪些電腦可以跑?</summary><p>macOS、Linux(apt、dnf、yum、pacman、zypper、apk、xbps 都認得)、Windows 10 和 11(x64、arm64)。伺服器是任何有 Docker、2 GB 記憶體以上的 Linux。手機用瀏覽器,iPhone 和 Android 都可以。</p></details>
<details><summary>它能接 Slack、Telegram 這些嗎?</summary><p>能。Slack、Discord、Telegram、Teams、Mac 的「訊息」和「郵件」、簡訊、X:收到一則就讓指定的 Bot 回。外面來的訊息不受信任,不帶你的記憶、不給電腦工具。另外也能接 MCP 連接器。</p></details>
<details><summary>原始碼在哪裡?</summary><p>全部在 <a href="https://code.30cm.net/daniel.w/AnyBot" target="_blank" rel="noopener">code.30cm.net/daniel.w/AnyBot</a>,桌面 App、帳號伺服器、手機網頁都在同一個 repo,用 Rust 寫的。</p></details>
</div>
</div>
</section>
</main>
<section class="closing" id="start" aria-label="開始使用">
<div class="wrap">
<div>
<h2>讓第一個 Bot<br>幫你做一件事。</h2>
<p>從整理一個資料夾開始。它會先說要做什麼,你按了才動手。</p>
<div class="cta">
<a class="btn" href="#install"><svg class="i" data-i="terminal"></svg>安裝 AnyBot</a>
<a class="btn ghost" href="https://code.30cm.net/daniel.w/AnyBot" target="_blank" rel="noopener"><svg class="i" data-i="code"></svg>看原始碼</a>
</div>
</div>
<img src="cat.jpg" alt="AnyBot 的貓" width="420" height="420">
</div>
</section>
<footer>
<div class="wrap">
<a class="logo" href="#"><img src="icon.jpg" alt="">AnyBot</a>
<a href="https://code.30cm.net/daniel.w/AnyBot" target="_blank" rel="noopener">原始碼</a>
<a href="https://code.30cm.net/daniel.w/AnyBot/src/branch/main/FEATURES.md" target="_blank" rel="noopener">完整功能</a>
<a href="https://code.30cm.net/daniel.w/AnyBot/src/branch/main/SECURITY.md" target="_blank" rel="noopener">安全</a>
<a href="https://code.30cm.net/daniel.w/AnyBot/src/branch/main/README.en.md" target="_blank" rel="noopener">English</a>
<span class="end">Apache-2.0 · 開源軟體</span>
</div>
</footer>
<script>
(() => {
const $ = (id) => document.getElementById(id);
const root = document.documentElement;
const store = { get(k) { try { return localStorage.getItem(k); } catch { return null; } }, set(k, v) { try { v == null ? localStorage.removeItem(k) : localStorage.setItem(k, v); } catch {} } };
// ---------- icons (Lucide, stroke 1.75) ----------
const ICONS = {
palette: '<circle cx="13.5" cy="6.5" r=".5" fill="currentColor"/><circle cx="17.5" cy="10.5" r=".5" fill="currentColor"/><circle cx="8.5" cy="7.5" r=".5" fill="currentColor"/><circle cx="6.5" cy="12.5" r=".5" fill="currentColor"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z"/>',
code: '<path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/>',
terminal: '<path d="m4 17 6-6-6-6"/><path d="M12 19h8"/>',
"arrow-down": '<path d="M12 5v14"/><path d="m19 12-7 7-7-7"/>',
"arrow-up": '<path d="m5 12 7-7 7 7"/><path d="M12 19V5"/>',
plus: '<path d="M5 12h14"/><path d="M12 5v14"/>',
"shield-check": '<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"/>',
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"/>',
"rotate-ccw": '<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/>',
key: '<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',
history: '<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',
zap: '<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/>',
users: '<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>',
sparkles: '<path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/>',
smartphone: '<rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/>',
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"/>',
"mouse-pointer": '<path d="M12.586 12.586 19 19"/><path d="M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z"/>',
send: '<path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"/><path d="m21.854 2.147-10.94 10.939"/>',
monitor: '<rect width="20" height="14" x="2" y="3" rx="2"/><path d="M8 21h8"/><path d="M12 17v4"/>',
search: '<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',
clock: '<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>',
lock: '<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',
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"/><path d="M6 6h.01"/><path d="M6 18h.01"/>',
copy: '<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',
check: '<path d="M20 6 9 17l-5-5"/>',
x: '<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',
help: '<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',
calendar: '<path d="M8 2v4"/><path d="M16 2v4"/><rect width="18" height="18" x="3" y="4" rx="2"/><path d="M3 10h18"/>',
"chevron-left": '<path d="m15 18-6-6 6-6"/>',
loader: '<path d="M21 12a9 9 0 1 1-6.219-8.56"/>',
"file-text": '<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/>',
bookmark: '<path d="m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z"/>',
chart: '<path d="M3 3v16a2 2 0 0 0 2 2h16"/><path d="M18 17V9"/><path d="M13 17V5"/><path d="M8 17v-3"/>',
messages: '<path d="M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z"/><path d="M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1"/>',
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"/>',
"circle-check": '<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>',
folder: '<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',
upload: '<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m17 8-5-5-5 5"/><path d="M12 3v12"/>',
grid: '<rect width="7" height="7" x="3" y="3" rx="1"/><rect width="7" height="7" x="14" y="3" rx="1"/><rect width="7" height="7" x="14" y="14" rx="1"/><rect width="7" height="7" x="3" y="14" rx="1"/>',
gear: '<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>',
more: '<circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/>',
square: '<rect width="16" height="16" x="4" y="4" rx="2"/>',
hand: '<path d="M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"/><path d="M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"/><path d="M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"/><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/>',
pencil: '<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/>',
sticky: '<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>',
type: '<path d="M4 7V4h16v3"/><path d="M9 20h6"/><path d="M12 4v16"/>',
minus: '<path d="M5 12h14"/>',
play: '<path d="M6 3l14 9-14 9z"/>',
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"/>',
branch: '<path d="M6 3v12"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/>',
"user-check": '<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="m16 11 2 2 4-4"/>',
image: '<rect width="18" height="18" x="3" y="3" rx="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',
sheet: '<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/>',
"chevron-right": '<path d="m9 18 6-6-6-6"/>',
"chevron-down": '<path d="m6 9 6 6 6-6"/>',
terminal2: '<rect width="20" height="16" x="2" y="4" rx="2"/><path d="m6 10 3 2-3 2"/><path d="M12 14h4"/>',
};
const icon = (n) => `<svg class="i" viewBox="0 0 24 24" aria-hidden="true">${ICONS[n] || ""}</svg>`;
const paint = (scope = document) => scope.querySelectorAll("svg[data-i]").forEach((s) => { s.setAttribute("viewBox", "0 0 24 24"); s.setAttribute("aria-hidden", "true"); s.innerHTML = ICONS[s.dataset.i] || ""; });
paint();
// ---------- bot faces: the app's own drawing (mobile/index.html avatarSvg) ----------
function avatarSvg(shape, col) {
const P = Math.PI, f = (n) => n.toFixed(3), range = (n) => [...Array(n).keys()];
const pts = (a) => `<polygon points="${a.map(([x, y]) => f(x) + "," + f(y)).join(" ")}"/>`;
const circ = (x, y, r) => `<circle cx="${f(x)}" cy="${f(y)}" r="${f(r)}"/>`;
let body;
switch (shape) {
case "squircle": body = `<rect x="-0.92" y="-0.92" width="1.84" height="1.84" rx="0.42"/>`; break;
case "hex": body = pts(range(6).map((i) => { const a = i / 6 * 2 * P + P / 6; return [Math.cos(a), Math.sin(a)]; })); break;
case "gem": body = pts([[-0.55, -0.8], [0.55, -0.8], [1, -0.2], [0, 1], [-1, -0.2]]); break;
case "cloud": body = circ(-0.45, 0.15, 0.55) + circ(0.45, 0.15, 0.55) + circ(0, -0.2, 0.65) + circ(0, 0.35, 0.55); break;
case "blob": body = pts(range(40).map((i) => { const a = i / 40 * 2 * P, r = 0.92 + 0.08 * Math.sin(3 * a); return [r * Math.cos(a), r * Math.sin(a)]; })); break;
case "star": body = pts(range(10).map((i) => { const a = -P / 2 + i * P / 5, r = i % 2 ? 0.48 : 1.05; return [r * Math.cos(a), 0.08 + r * Math.sin(a)]; })); break;
default: body = circ(0, 0, 0.95);
}
const rgb = [1, 3, 5].map((i) => parseInt(col.slice(i, i + 2), 16));
const eye = rgb[0] + rgb[1] + rgb[2] > 600 ? "#1c1c1c" : "#fcfcfc";
const eyes = [-0.27, 0.27].map((x) => `<ellipse cx="${x}" cy="0.02" rx="0.11" ry="0.22" transform="rotate(-20 ${x} 0.02)"/>`).join("");
const edge = rgb[0] + rgb[1] + rgb[2] < 150 ? ` style="stroke:var(--line)" stroke-width="0.08"` : "";
return `<svg viewBox="-1.1 -1.1 2.2 2.2" aria-hidden="true"><g fill="${col}"${edge}>${body}</g><g fill="${eye}">${eyes}</g></svg>`;
}
const BOTS = [
{name: "Bot", shape: "squircle", color: "#1c1c1c", about: "什麼都能聊的第一個 Bot,也幫你建其他 Bot。", model: "gpt-5 · ChatGPT 方案"},
{name: "研究助理", shape: "circle", color: "#0d9655", about: "查資料、比較、整理成一頁表格和圖表,之後更新同一頁。", model: "gemini-2.5-pro"},
{name: "寫作夥伴", shape: "cloud", color: "#7442d1", about: "寫信、改稿、想標題,記得你喜歡的語氣。", model: "claude-sonnet"},
{name: "電腦助手", shape: "gem", color: "#126fd4", about: "整理檔案、跑指令、開瀏覽器填表,動手前先問你。", model: "grok-4 · 備用 qwen3(Ollama)"},
];
const face = (b) => avatarSvg(b.shape, b.color);
$("crew-cards").innerHTML = BOTS.map((b) => `<article class="mate"><span class="av">${face(b)}</span><h3>${b.name}</h3><p>${b.about}</p><div class="model">${b.model}</div></article>`).join("");
document.querySelectorAll(".said .av").forEach((el) => { const i = +el.dataset.bot; el.innerHTML = i === 0 ? `<svg viewBox="0 0 30 30" aria-hidden="true"><circle cx="15" cy="15" r="14" fill="var(--soft2)"/><text x="15" y="19.5" text-anchor="middle" font-size="12" font-weight="600" fill="currentColor">你</text></svg>` : face(BOTS[i]); });
$("phone-rows").innerHTML = [
[BOTS[3], '<span class="wait">等你允許:執行指令</span>', "剛剛"],
[BOTS[1], "<span>今天的三則 AI 新聞整理好了</span>", "09:01"],
[BOTS[2], "<span>遊記的開頭寫好了,你看看</span>", "昨天"],
[BOTS[0], "<span>好,明天早上 7:30 提醒你</span>", "週三"],
].map(([b, line, t]) => `<div class="prow"><span class="av">${face(b)}</span><div style="min-width:0"><b>${b.name}</b>${line}</div><time>${t}</time></div>`).join("");
$("day").insertAdjacentHTML("beforeend", [
["07:30", BOTS[0], "天氣和今天的行程", "每天", "done", "完成"],
["09:00", BOTS[1], "整理三則 AI 新聞", "每個工作日", "done", "完成"],
["14:12", BOTS[3], "PR 合併後跑測試、部署", "PR 合併時", "run", "進行中"],
["18:00", BOTS[2], "週報草稿", "每週五", "", "等一下"],
].map(([t, b, what, when, cls, word]) => `<div class="slot"><time>${t}</time><span class="av">${face(b)}</span><div style="min-width:0"><b>${what}</b><span>${b.name} · ${when}</span></div><span class="state ${cls}">${word}</span></div>`).join(""));
// ---------- the app, to try: the desktop app's places, each one working a little ----------
const esc = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({"&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;"}[c]));
const calm = matchMedia("(prefers-reduced-motion: reduce)");
const wait = (ms) => new Promise((r) => setTimeout(r, ms));
const pace = (ms) => wait(calm.matches ? 0 : ms);
const app = $("app");
const STOP = new Error("stop");
const now = () => Date.now();
const since = (t) => { const s = (now() - t) / 1000; return s < 60 ? "剛剛" : s < 3600 ? Math.floor(s / 60) + " 分鐘前" : s < 86400 ? Math.floor(s / 3600) + " 小時前" : Math.floor(s / 86400) + " 天前"; };
const EXTRA = [
{hello: "什麼都能聊,也幫你建其他 Bot", about: "什麼都能聊,也幫你建其他 Bot、排例行任務。", tag: "雲端", model: "ChatGPT 方案 · gpt-5 · 雲端", offers: ["remind", "newbot"]},
{hello: "查資料、整理成一頁", about: "查資料、比較、整理成一頁表格和圖表。", tag: "雲端", model: "Gemini · gemini-2.5-pro · 雲端", offers: ["meet", "quote"]},
{hello: "寫信、改稿,記得你的語氣", about: "改稿、翻譯、想標題,記得你喜歡的語氣。", tag: "雲端", model: "Claude · claude-sonnet · 雲端", offers: ["leave", "casual"]},
{hello: "整理檔案、開瀏覽器,先問你", about: "整理檔案、跑指令、開瀏覽器填表,動手前先問你。", tag: "這台電腦", model: "xAI · grok-4 · 備用 Ollama qwen3", offers: ["photos", "form"]},
];
const people = BOTS.map((b, i) => ({...b, ...EXTRA[i], id: String(i)}));
people.push({id: "l", name: "本機模型", shape: "hex", color: "#86592e", later: true, hello: "在你自己的電腦上跑,不用連網", about: "用你電腦上的 Ollama,資料不離開這台電腦。", tag: "這台電腦", model: "Ollama · qwen3 · 這台電腦", offers: ["local"]});
const GROUP = {id: "g", name: "旅遊小組", group: true, members: [1, 2, 3], hello: "研究助理、寫作夥伴、電腦助手", about: "成員輪流回答,各用各的模型;「@名字」交棒。", tag: "3 位成員", model: "群組 · 各用各的模型", offers: ["trip"]};
const all = () => [...people, GROUP];
const byId = (id) => all().find((p) => p.id === String(id));
const groupFace = (g) => { const c = g.members.map((i) => BOTS[i].color); return `<svg viewBox="0 0 40 40" aria-hidden="true"><circle cx="13.5" cy="15" r="9" fill="${c[0]}"/><circle cx="26.5" cy="15" r="9" fill="${c[1]}"/><circle cx="20" cy="26.5" r="9" fill="${c[2]}"/></svg>`; };
const faceOf = (p) => p.group ? groupFace(p) : avatarSvg(p.shape, p.color);
const greet = () => { const h = new Date().getHours(); return h < 11 ? "早安" : h < 18 ? "午安" : "晚安"; };
const C = {}, TASKS = [], RULES = [], INSTALLED = new Set(["pdf", "xlsx", "docx", "pptx", "web-design", "deep-research", "browser-automation", "skill-creator"]);
const DROPS = [{text: "第三季報表.xlsx", from: "MacBook Pro → 這台電腦", at: now() - 3 * 3600e3}];
const FILES = [
{name: "IMG_2041.heic", kind: "img", bot: "3", at: now() - 26 * 3600e3, h: ["#f6b26b", "#e06666"]},
{name: "收據-1121.jpg", kind: "img", bot: "3", at: now() - 30 * 3600e3, h: ["#9fc5e8", "#6fa8dc"]},
{name: "競品比較.xlsx", kind: "sheet", bot: "1", at: now() - 2 * 86400e3},
{name: "發表會講稿.docx", kind: "doc", bot: "2", at: now() - 3 * 86400e3},
{name: "封面草圖.png", kind: "img", bot: "2", at: now() - 9 * 86400e3, h: ["#b4a7d6", "#8e7cc3"]},
];
const ROUTINES = [
{t: "08:30", what: "競品掃描", who: "0", days: "daily", when: "每天 08:30"},
{t: "09:00", what: "晨間發布簡報", who: "1", days: "weekdays", when: "每個工作日 09:00"},
{t: "17:30", what: "週報整理", who: "2", days: [5], when: "每週五 17:30"},
];
let cur = "3", nav = "chat", view = "desk", inMain = true, fresh = "", ALWAYS = false, toastT = 0;
function toast(t) {
app.querySelector(".app-toast")?.remove();
const d = document.createElement("div"); d.className = "app-toast"; d.textContent = t; app.appendChild(d);
clearTimeout(toastT); toastT = setTimeout(() => d.remove(), 2600);
}
function conv(id) {
if (C[id]) return C[id];
const p = byId(id), el = document.createElement("div");
el.className = "msgs"; el.hidden = true;
el.innerHTML = `<div class="hello"><span class="av">${faceOf(p)}</span><small>${greet()}</small><h3>嗨,我是 ${esc(p.name)}</h3><p>${esc(p.about)}</p></div><div class="hello-offers"></div><div class="hello-model">${esc(p.model)}</div>`;
$("convs").appendChild(el);
return (C[id] = {el, busy: false, waiting: false, unread: false, queue: [], last: "", started: false, stopped: false, task: null, deny: null});
}
const looking = (id) => nav === "chat" && id === cur && (inMain || !app.classList.contains("m"));
const needs = () => TASKS.filter((t) => t.status === "waiting").length + (WF.state === "waiting" ? 1 : 0);
function drawBadge() {
const n = needs(), b = $("badge");
b.hidden = !n; b.textContent = n;
$("pchips").innerHTML = [["sched", "calendar", "日程"], ["wf", "workflow", "工作流"], ["tasks", "circle-check", "任務"], ["files", "folder", "檔案"], ["market", "grid", "市集"], ["settings", "gear", "設定"]]
.map(([k, i, l]) => `<button ${k === "sched" || k === "wf" ? `data-nav="${k}"` : `data-modal="${k}"`}>${icon(i)}${l}${k === "tasks" && n ? ` <b>${n}</b>` : ""}</button>`).join("");
}
function drawSide() {
const q = ($("find").value || "").trim();
const tile = (p) => { const c = C[p.id] || {}; return `<button class="bot ${p.id === cur && nav === "chat" ? "on" : ""} ${c.waiting ? "waiting" : c.unread ? "unread" : ""} ${p.id === fresh ? "pop" : ""}" data-bot="${p.id}" ${q && !p.name.includes(q) ? "hidden" : ""}><span class="av">${faceOf(p)}${p.id === "0" ? `<i class="star"><svg viewBox="0 0 24 24"><path d="M12 2l2.9 6.6 7.1.6-5.4 4.7 1.6 7L12 17.3 5.8 21l1.6-7L2 9.2l7.1-.6z"/></svg></i>` : ""}</span><span class="nm"><b>${esc(p.name)}</b><i class="pv">${esc(c.last || p.hello)}</i></span><i class="dot"></i></button>`; };
$("side-bots").innerHTML = people.filter((p) => !p.later).map(tile).join("");
$("side-list").innerHTML = `<div class="grp">Bot</div><div class="list">${people.filter((p) => p.later).map(tile).join("")}</div><div class="grp">群組</div><div class="list">${tile(GROUP)}</div>`;
fresh = "";
drawBadge();
}
function drawOffers() {
const p = byId(cur), c = conv(cur);
const chips = c.busy || c.waiting ? "" : (p.offers || []).map((k) => `<button class="offer" data-sc="${k}">${esc(SC[k].label)}</button>`).join("");
c.el.querySelector(".hello-offers").innerHTML = c.started ? "" : chips;
$("offers").innerHTML = c.started ? chips : "";
const send = $("send");
send.innerHTML = c.busy ? icon("square") : icon("arrow-up");
send.classList.toggle("go", c.busy || !!$("say").value.trim());
send.setAttribute("aria-label", c.busy ? "停止" : "送出");
$("queued").textContent = c.queue.length ? `已排入「${c.queue[c.queue.length - 1]}」,Bot 會在下一步看到` : "";
requestAnimationFrame(() => { c.el.scrollTop = c.el.scrollHeight; });
}
function layout() {
const narrow = matchMedia("(max-width: 760px)").matches;
app.classList.toggle("m", narrow || view === "phone");
app.classList.toggle("framed", view === "phone" && !narrow);
app.classList.toggle("in-main", inMain);
["chat", "wf", "sched"].forEach((k) => { $("v-" + k).hidden = nav !== k; });
app.querySelectorAll(".rail [data-nav]").forEach((b) => b.classList.toggle("on", b.dataset.nav === nav));
if (nav === "sched") drawSched();
if (nav === "wf") requestAnimationFrame(sizeBoard);
}
function go(where) { nav = where; inMain = true; $("modal").hidden = true; closeMenu(); if (where === "wf") drawWF(); layout(); drawSide(); }
function open(id) {
cur = String(id); nav = "chat"; inMain = true;
const c = conv(cur), p = byId(cur);
c.unread = false;
for (const k in C) C[k].el.hidden = k !== cur;
$("bar-name").textContent = p.name;
$("bar-tag").textContent = p.tag;
$("say").placeholder = `傳訊息給 ${p.name}`;
$("modal").hidden = true; closeMenu();
layout(); drawSide(); drawOffers();
}
// ---------- one conversation, a piece at a time ----------
function post(id, html, cls) {
const c = conv(id), d = document.createElement("div");
if (cls) d.className = cls;
d.innerHTML = html;
c.el.appendChild(d);
if (id === cur) c.el.scrollTop = c.el.scrollHeight;
return d;
}
function told(id, line) { const c = conv(id); c.last = line; if (!looking(id)) c.unread = true; drawSide(); }
const check = (id) => { if (C[id].stopped) throw STOP; };
async function say(id, text, who) {
check(id);
const c = conv(id), b = who == null ? null : BOTS[who];
const box = post(id, b ? `<span class="av">${avatarSvg(b.shape, b.color)}</span><div><b class="nm">${esc(b.name)}</b><span class="tx"><span class="typing"><i></i><i></i><i></i></span></span></div>` : `<span class="tx"><span class="typing"><i></i><i></i><i></i></span></span>`, b ? "b gb" : "b");
await pace(500 + Math.random() * 400);
const tx = box.querySelector(".tx");
if (c.stopped) { box.remove(); throw STOP; }
if (calm.matches) tx.textContent = text;
else for (let i = 0; i < text.length; i += 2) { if (c.stopped) { tx.textContent = text.slice(0, i) + "…"; throw STOP; } tx.textContent = text.slice(0, i + 2); if (id === cur) c.el.scrollTop = c.el.scrollHeight; await wait(20); }
told(id, (b ? b.name + ":" : "") + text.replace(/\n+/g, " "));
}
async function step(id, label, ms = 700) {
check(id);
const s = post(id, `${icon("loader")}<span>${esc(label)}</span>`, "step run");
const t = C[id].task; if (t) { t.steps++; t.doing = label; t.status = "running"; }
await pace(ms);
s.className = "step ok"; s.querySelector("svg").outerHTML = icon("check");
check(id);
}
const refused = (id, label) => post(id, `${icon("x")}<span>${esc(label)} · 你拒絕了</span>`, "step no");
function ask(id, o) {
check(id);
const c = conv(id);
if (ALWAYS && !o.every) { post(id, `${icon("zap")}<span>一律放行:自動允許「${esc(o.short)}」</span>`, "step ok"); return Promise.resolve("once"); }
c.waiting = true; if (c.task) { c.task.status = "waiting"; c.task.doing = "等你允許:" + o.short; }
drawOffers();
const card = post(id, `<h5>${esc(o.title)}</h5><div class="what">${esc(o.what)}</div>${o.code ? `<code>${esc(o.code)}</code>` : ""}<div class="row"><button class="yes" data-a="once">${o.always ? "允許一次" : "允許"}</button>${o.always ? '<button data-a="always">一律允許</button>' : ""}<button data-a="reject">拒絕</button></div>${o.hint ? `<div class="hint">${icon("zap")}${esc(o.hint)}</div>` : ""}`, "ask");
const p = byId(id), who = p.group ? BOTS[o.who ?? 3] : p;
const line = post(id, `<span class="av">${avatarSvg(who.shape, who.color)}</span>等你決定`, "waitline");
told(id, "等你允許:" + o.short);
return new Promise((done) => {
const end = (a) => { card.remove(); line.remove(); c.waiting = false; c.deny = null; if (c.task) c.task.status = "running"; drawSide(); drawOffers(); done(a); };
c.deny = () => end("stop");
card.querySelectorAll("button").forEach((btn) => btn.onclick = () => end(btn.dataset.a));
});
}
const card = (id, html) => post(id, html, "card");
function addFile(f) { if (!FILES.some((x) => x.name === f.name)) FILES.unshift({...f, at: now(), fresh: true}); }
// ---------- what each bot can show (made-up files, names and numbers) ----------
const SC = {
photos: {label: "把下載資料夾的照片照月份整理好", keys: /照片|相片|整理|下載/, run: async (id) => {
await say(id, "我先看看有哪些照片。");
await step(id, "列出檔案 · 下載/");
await say(id, "找到 48 張照片,拍攝時間在 4 到 6 月。我會建立三個資料夾,再把照片搬進去。");
const a = await ask(id, {title: "允許 電腦助手 在你的電腦上執行任務嗎?", what: "它想在你的電腦上執行:", code: "mkdir -p 2026-04 2026-05 2026-06 && mv IMG_04*.jpg 2026-04/", always: true, hint: "之後都直接操作,不再一個個問", short: "執行指令"});
if (a === "reject") { refused(id, "執行指令"); await say(id, "好,我不動檔案。要不要我先列出每張照片會放到哪個資料夾,你看過再決定?"); return; }
if (a === "always" && !RULES.includes("在工作區建資料夾、搬檔案")) RULES.push("在工作區建資料夾、搬檔案");
await step(id, a === "always" ? "執行指令 · 一律允許(設定 › 權限 看得到這條)" : "執行指令 · 已允許", 900);
await step(id, "確認結果 · 3 個資料夾、48 張照片", 600);
await say(id, "整理好了:2026-04 有 17 張、2026-05 有 19 張、2026-06 有 12 張。其他檔案我沒動。");
}},
form: {label: "打開瀏覽器,幫我填好工作坊報名表", keys: /瀏覽器|報名|表單|填|網頁/, run: async (id) => {
await say(id, "我用我自己的電腦開瀏覽器,你隨時能看畫面、接手。");
await step(id, "打開瀏覽器 · Bot 的電腦", 800);
const shot = post(id, `<div class="url"><i></i><i></i><i></i><span>workshop.example/signup</span></div><div class="page"><h6>冬季工作坊報名</h6>${["姓名", "Email", "場次"].map((k) => `<div class="field">${k}<span class="v"></span></div>`).join("")}</div><div class="cap">${icon("monitor")}Bot 的電腦 · 跑在 Docker 裡,跟你的電腦隔開</div>`, "shot");
const vals = ["陳小安", "an@example.com", "12/6(六)下午場"];
for (const [i, v] of shot.querySelectorAll(".v").entries()) {
v.classList.add("typing-now");
for (let j = 1; j <= vals[i].length; j++) { check(id); v.textContent = vals[i].slice(0, j); await pace(45); }
v.classList.remove("typing-now");
}
await say(id, "填好了。送出是對外的動作,要先問你。");
const a = await ask(id, {title: "允許 電腦助手 送出表單嗎?", what: "要在 workshop.example 送出「冬季工作坊報名」:陳小安、an@example.com、12/6 下午場。", short: "送出表單"});
if (a === "reject") { refused(id, "送出表單"); await say(id, "好,先不送。表單我留著沒關,你想自己看一下再送也可以。"); return; }
await step(id, "送出表單 · 已允許", 800);
await step(id, "讀頁面確認 · 出現「報名成功」", 700);
await say(id, "送出了,頁面顯示「報名成功」,確認信會寄到 an@example.com。");
}},
meet: {label: "整理這週會議紀錄的重點", keys: /會議|紀錄|重點|摘要/, run: async (id) => {
await step(id, "讀檔案 · 會議紀錄/(3 個檔案)", 1000);
await say(id, "三場會議看完了,重點寫成一頁:");
card(id, `<div class="hd">${icon("file-text")}這週會議重點<small>頁面 · 剛剛更新</small></div><div class="tiles"><div class="tile"><b>3</b><span>場會議</span></div><div class="tile"><b>7</b><span>個待辦</span></div><div class="tile"><b>2</b><span>個決定</span></div></div><ul class="todo"><li><em>決定</em>官網 12 月上線,先中文再英文</li><li><em>決定</em>手機版先做通知和允許</li><li><em>待辦</em>Amy 週三前給首頁設計稿</li><li><em>待辦</em>小安 準備發表會講稿</li></ul>`);
addFile({name: "這週會議重點.md", kind: "doc", bot: id});
await say(id, "之後有新的會議紀錄,我更新同一頁,舊版會留著。");
}},
quote: {label: "把三份報價單做成比較表", keys: /報價|比較|價格|表/, run: async (id) => {
await step(id, "讀檔案 · 報價單(3 份 PDF)", 1000);
card(id, `<div class="hd">${icon("chart")}三家報價比較</div><div class="tblw"><table class="tbl"><tr><th></th><th>甲公司</th><th>乙公司</th><th>丙公司</th></tr><tr><td>總價</td><td>NT$48,000</td><td>NT$52,000</td><td class="best">NT$45,500</td></tr><tr><td>交期</td><td>14 天</td><td class="best">7 天</td><td>21 天</td></tr><tr><td>保固</td><td>1 年</td><td class="best">2 年</td><td>1 年</td></tr></table></div>`);
addFile({name: "三家報價比較.xlsx", kind: "sheet", bot: id});
await say(id, "丙最便宜,但要等三週;乙貴 8%,一週就到,保固兩年。急的話選乙。");
}},
leave: {label: "幫我寫一封請假信", keys: /請假|信|郵件|email/i, run: async (id) => {
post(id, `${icon("bookmark")}帶著記憶:你喜歡簡短、不要太客套`, "mem");
await say(id, "主旨:12/6(五)請假一天\n\n經理好:\n我 12/6(五)想請一天特休,處理家裡的事。手上的報表週四會先交,當天有急事可以打我手機。\n\n謝謝!\n小安");
addFile({name: "請假信.md", kind: "doc", bot: id});
await say(id, "要我直接寄出嗎?寄出前會再問你一次。");
}},
casual: {label: "把「敬請於本週五前回覆,以利後續作業」改口語", keys: /口語|改|潤/, run: async (id) => {
await say(id, "「麻煩這週五前回我一下,我好接著安排。」");
await say(id, "想更短的話:「週五前回我就好,謝謝!」");
}},
remind: {label: "每個工作日早上 9 點提醒我站起來動一動", keys: /提醒|每天|每週|每個|點/, run: async (id) => {
await step(id, "排例行任務", 800);
card(id, `<div class="routine"><span class="ico">${icon("clock")}</span><div><b>提醒你站起來動一動</b><span>每個工作日 09:00 · 下次:明天 09:00</span></div><span class="ok-pill">排好了</span></div>`);
if (!ROUTINES.some((r) => r.fresh)) ROUTINES.push({t: "09:00", what: "提醒你站起來動一動", who: "0", days: "weekdays", when: "每個工作日 09:00", fresh: true});
await say(id, "排好了,到時候會傳通知到你的手機。左邊的「日程」看得到。");
}},
newbot: {label: "幫我建一個記帳用的 Bot", keys: /建|新|記帳|bot/i, run: async (id) => {
if (byId("4")) { await say(id, "記帳小幫手已經在左邊了,點它就能開始。"); return; }
await step(id, "建立 Bot · 記帳小幫手", 900);
makeBot(TPLS[1]);
card(id, `<div class="newbot"><span class="av">${avatarSvg("star", "#d2550a")}</span><div><b>記帳小幫手</b><span>用你預設的模型 · 只讀寫「記帳」資料夾 · 不能動你的電腦</span></div></div>`);
await say(id, "建好了,在左邊。點它,跟它說「午餐 120」試試。");
}},
spend: {label: "午餐 120", keys: /\d/, run: async (id, text) => {
const n = +((text.match(/\d+/) || ["120"])[0]);
await say(id, `記好了:今天餐飲 ${n.toLocaleString()} 元。這個月餐飲花了 ${(3360 + n).toLocaleString()} 元,比上個月同一天少 8%。`);
}},
month: {label: "這個月花最多的是什麼?", keys: /最多|這個月|報表|花/, run: async (id) => {
card(id, `<div class="hd">${icon("chart")}這個月的支出</div><div class="bars"><div>餐飲<i style="width:100%"></i><b>3,480</b></div><div>交通<i style="width:36%"></i><b>1,260</b></div><div>訂閱<i style="width:28%"></i><b>990</b></div></div>`);
addFile({name: "這個月支出.csv", kind: "sheet", bot: id});
await say(id, "餐飲最多,大多是平日午餐。訂閱裡有兩個重複的影音服務,要我列出來嗎?");
}},
local: {label: "不連網路,幫我摘要這份合約", keys: /合約|摘要|離線|網路/, run: async (id) => {
await step(id, "讀檔案 · 租約.pdf(在這台電腦上)", 1000);
await say(id, "三個重點:\n1. 租期兩年,滿一年後可以提前一個月通知解約。\n2. 押金兩個月,退租後 14 天內退還。\n3. 小修繕房客負責,水電管線房東負責。");
await say(id, "全程用這台電腦上的 Ollama 跑,合約沒有送到任何雲端。");
}},
whoami: {label: "你會做什麼?", keys: /會|做|什麼/, run: async (id) => { await say(id, byId(id).about + " 這是網頁示範;裝好 AnyBot 之後,我就能真的做這些事。"); }},
trip: {label: "週末想去台南兩天,幫我排一下", keys: /台南|旅|玩|週末|排/, run: async (id) => {
await say(id, "我查了天氣:週日午後可能下雨,室內景點排在週日下午。行程放在頁面「台南兩天」。", 1);
addFile({name: "台南兩天.pdf", kind: "pdf", bot: "1"});
await say(id, "我補一個寫遊記的角度:用三家早餐串起兩天。@電腦助手 幫忙訂週六晚上的民宿?", 2);
await say(id, "好,我開瀏覽器找了三間,最喜歡中西區那間老屋,一晚 NT$2,400。", 3);
const a = await ask(id, {title: "允許 電腦助手 付款嗎?", what: "付款每次都問:週六一晚民宿 NT$2,400。卡號由 AnyBot 從保險庫填進網頁,模型看不到。", short: "付款", every: true, who: 3});
if (a === "reject") { refused(id, "付款"); await say(id, "好,先不訂。三間候選我放進頁面「台南兩天」了。", 3); return; }
await step(id, "付款 · 已允許", 900);
await say(id, "訂好了,確認信會寄到你的信箱。(這是網頁示範,沒有真的訂)", 3);
}},
};
const FALLBACK = {run: async (id, text) => {
const p = byId(id), short = text.length > 24 ? text.slice(0, 24) + "…" : text;
await say(id, `這是網頁上的示範,我只會上面那幾件事。裝好 AnyBot 之後,「${short}」我就能真的幫你做;要動到電腦時會先問你。`, p.group ? p.members[0] : null);
}};
async function run(id, sc, text) {
const c = conv(id), p = byId(id);
if (c.busy) { c.queue.push(text); drawOffers(); return; }
c.busy = true; c.started = true; c.stopped = false;
post(id, esc(text), "u"); c.last = text;
c.task = sc === FALLBACK ? null : {bot: id, text, status: "running", at: now(), steps: 0, doing: ""};
if (c.task) TASKS.unshift(c.task);
drawSide(); drawOffers();
try { await sc.run(id, text); if (c.task) c.task.status = "done"; }
catch (e) { if (e !== STOP) throw e; post(id, `${icon("x")}<span>你按了停止</span>`, "step no"); if (c.task) { c.task.status = "stopped"; c.task.doing = "你按了停止"; } }
finally { c.busy = false; c.stopped = false; if (c.task) c.task.at = now(); }
while (c.queue.length) { const q = c.queue.shift(); post(id, esc(q), "u"); drawOffers(); await say(id, `收到你剛剛補的「${q}」,我記下來了。`, p.group ? p.members[0] : null); }
drawSide(); drawOffers();
}
function route(id, text) {
const p = byId(id);
run(id, (p.offers || []).map((k) => SC[k]).find((s) => s.keys.test(text)) || FALLBACK, text);
}
function stopRun(id) { const c = conv(id); if (!c.busy) return; c.stopped = true; if (c.deny) c.deny(); }
// ---------- bots made from 市集 › Bot 範本 ----------
const TPLS = [
{key: "trip", id: "t1", name: "旅遊規劃師", shape: "blob", color: "#0d9381", about: "排行程、比機票和住宿,訂之前先問你。"},
{key: "acct", id: "4", name: "記帳小幫手", shape: "star", color: "#d2550a", about: "跟我說「午餐 120」就記一筆,月底給你報表。", offers: ["spend", "month"], hello: "跟我說「午餐 120」就記一筆", tag: "只讀寫「記帳」資料夾"},
{key: "cs", id: "t2", name: "客服小幫手", shape: "hex", color: "#c82779", about: "照你的常見問題回覆客人,沒把握的先問你。"},
{key: "code", id: "t3", name: "程式助手", shape: "squircle", color: "#126fd4", about: "讀程式、跑測試、開 PR,改之前先問你。"},
{key: "fit", id: "t4", name: "健身教練", shape: "circle", color: "#c82532", about: "排每週的課表,提醒你運動、記錄進度。"},
];
function makeBot(t) {
if (byId(t.id)) return false;
people.push({id: t.id, name: t.name, shape: t.shape, color: t.color, later: true, about: t.about, hello: t.hello || t.about, tag: t.tag || "雲端", model: "ChatGPT 方案 · gpt-5 · 雲端", offers: t.offers || ["whoami"]});
fresh = t.id; drawSide();
return true;
}
// ---------- 工作流 ----------
const WF = {state: "waiting", z: 0.9, decide: null, runs: [{at: "今天 09:00", how: "等你確認"}, {at: "昨天 09:00", how: "完成"}, {at: "前天 09:00", how: "條件沒過:只有兩則有連結,停下來"}],
nodes: {
trig: {kind: "觸發器", icon: "clock", x: 286, y: 20, text: "每天 09:00", sub: "下次執行 · 明天 09:00", s: "done"},
step: {kind: "助手", icon: "bot", x: 286, y: 140, who: "研究助理", text: "找今天熱門的 5 則 AI 新聞,整理成清單,每則附連結。", s: "done"},
cond: {kind: "條件", icon: "branch", x: 286, y: 262, who: "Bot", text: "至少三則、每則都有連結", s: "done"},
ok: {kind: "審批", icon: "user-check", x: 176, y: 384, text: "要把早報傳給你嗎?", s: "waiting"},
out: {kind: "輸出", icon: "send", x: 176, y: 496, text: "傳到你的手機,也放進「Bot」的聊天", s: ""},
no: {kind: "輸出", icon: "send", x: 410, y: 384, text: "告訴你今天湊不到三則", s: ""},
note: {kind: "note", x: 40, y: 150, text: "週末改成十點\n\n— 你", s: ""},
},
edges: [["trig", "step"], ["step", "cond"], ["cond", "ok", "是"], ["cond", "no", "否"], ["ok", "out"]],
added: 0};
const WORD = {done: "完成", running: "執行中", waiting: "等你確認", stopped: "停止", skipped: "略過", "": ""};
function nodeHtml(k, n) {
if (n.kind === "note") return `<div class="node note" data-node="${k}" style="left:${n.x}px;top:${n.y}px"><div class="nb">${esc(n.text)}</div></div>`;
return `<div class="node ${n.s}" data-node="${k}" style="left:${n.x}px;top:${n.y}px"><div class="nh">${icon(n.icon)}${esc(n.kind)}<span class="ns ${n.s}">${WORD[n.s] || ""}</span></div><div class="nb">${n.who ? `<b>${esc(n.who)}</b>` : ""}${esc(n.text)}${n.sub ? `<br><span style="color:var(--text3)">${esc(n.sub)}</span>` : ""}</div>${k === "trig" ? `<button class="go" data-wf="run">立即執行 ▷</button>` : ""}</div>`;
}
function drawWF() {
const v = $("v-wf"), running = WF.state === "running" || WF.state === "waiting";
v.innerHTML = `<div class="bar"><button class="ib back" data-back aria-label="回到清單"><svg class="i" viewBox="0 0 24 24">${ICONS["chevron-left"]}</svg></button><button class="crumb" data-nav="chat">${icon("chevron-left")}聊天</button><h4>每天早上的 AI 新聞早報</h4><span class="sp"></span><button class="tb wide" data-modal="runs">執行紀錄</button>${running ? `<button class="tb stop" data-wf="halt">${icon("square")}停止</button>` : `<button class="tb solid" data-wf="run">${icon("play")}執行</button>`}</div>
<div class="canvas" id="canvas"><div class="board-wrap" id="board-wrap"><div class="board" id="board"><svg class="edges" id="edges"></svg>${Object.entries(WF.nodes).map(([k, n]) => nodeHtml(k, n)).join("")}</div></div></div>
${WF.state === "waiting" ? `<div class="wf-banner"><span>等你確認:要把早報傳給你嗎?</span><button class="yes" data-wf="go">繼續</button><button data-wf="halt">停止</button></div>` : WF.state === "done" ? `<div class="wf-banner done"><span>${icon("check")} 這次跑完了,早報放進「Bot」的聊天</span></div>` : ""}
<div class="wf-zoom"><button class="rb" data-zoom="-1" aria-label="縮小">${icon("minus")}</button><span>${Math.round(WF.z * 100)}%</span><button class="rb" data-zoom="1" aria-label="放大">${icon("plus")}</button></div>
<div class="wf-tools"><button class="rb on keep" title="選取" data-tool>${icon("mouse-pointer")}</button><button class="rb" title="移動畫布" data-tool>${icon("hand")}</button><span class="sep"></span><button class="rb" title="畫筆" data-tool>${icon("pencil")}</button><button class="rb keep" title="便利貼" data-note>${icon("sticky")}</button><button class="rb" title="方框" data-tool>${icon("square")}</button><button class="rb" title="文字" data-tool>${icon("type")}</button><button class="add" data-wf="add">${icon("plus")}新增節點</button></div>`;
sizeBoard();
}
function sizeBoard() {
const b = $("board"), w = $("board-wrap"); if (!b) return;
const cv = $("canvas");
WF.ez = app.classList.contains("m") && cv ? Math.min(WF.z, (cv.clientWidth - 12) / 760) : WF.z;
b.style.transform = `scale(${WF.ez})`;
w.style.width = 760 * WF.ez + "px"; w.style.height = 640 * WF.ez + "px";
drawEdges();
}
function drawEdges() {
const svg = $("edges"); if (!svg) return;
const box = (k) => { const el = $("board").querySelector(`[data-node="${k}"]`), n = WF.nodes[k]; return {x: n.x, y: n.y, w: el ? el.offsetWidth : 186, h: el ? el.offsetHeight : 80}; };
svg.innerHTML = WF.edges.map(([a, b, label]) => {
const A = box(a), B = box(b);
const x1 = A.x + A.w / 2, y1 = A.y + A.h, x2 = B.x + B.w / 2, y2 = B.y, m = Math.max(24, (y2 - y1) / 2);
const on = WF.nodes[a].s === "done" && WF.nodes[b].s && WF.nodes[b].s !== "skipped" && WF.nodes[b].s !== "stopped";
return `<path class="${on ? "on" : ""}" d="M${x1},${y1} C${x1},${y1 + m} ${x2},${y2 - m} ${x2},${y2}" marker-end="url(#arr)"/>${label ? `<text x="${(x1 + x2) / 2 + (x2 < x1 ? -14 : 6)}" y="${y1 + 18}">${label}</text>` : ""}`;
}).join("") + `<defs><marker id="arr" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10 z" fill="currentColor" style="color:var(--text3)"/></marker></defs>`;
}
const setNode = (k, s) => { WF.nodes[k].s = s; if (nav === "wf") drawWF(); };
async function wfRun() {
if (WF.state === "running" || WF.state === "waiting") return;
for (const k of ["trig", "step", "cond", "ok", "out", "no"]) WF.nodes[k].s = "";
WF.state = "running"; if (nav === "wf") drawWF();
for (const k of ["trig", "step", "cond"]) { setNode(k, "running"); await pace(k === "step" ? 1500 : 800); if (WF.state !== "running") return; setNode(k, "done"); }
setNode("no", "skipped");
WF.state = "waiting"; setNode("ok", "waiting"); WF.runs.unshift({at: "剛剛", how: "等你確認"}); drawBadge();
}
async function wfDecide(goOn) {
if (WF.state !== "waiting" && WF.state !== "running") return;
if (!goOn) { WF.state = "stopped"; for (const k of ["ok", "out", "no"]) if (WF.nodes[k].s !== "done") WF.nodes[k].s = k === "ok" ? "stopped" : "skipped"; WF.runs[0] = {at: WF.runs[0].at, how: "你按了停止"}; drawBadge(); if (nav === "wf") drawWF(); return; }
WF.state = "running"; setNode("ok", "done"); setNode("no", WF.nodes.no.s || "skipped"); drawBadge();
setNode("out", "running"); await pace(900); setNode("out", "done");
WF.state = "done"; WF.runs[0] = {at: WF.runs[0].at, how: "完成"};
const c = conv("0"); c.started = true;
post("0", `${icon("workflow")}<span>工作流「每天早上的 AI 新聞早報」</span>`, "step ok");
card("0", `<div class="hd">${icon("file-text")}今天的 AI 新聞早報<small>5 則 · 都有連結</small></div><ul class="todo"><li><em>1</em>開源模型在程式評測上追近閉源模型</li><li><em>2</em>手機上跑的小模型越來越多</li><li><em>3</em>各家開始比「代理」做事的可靠度</li></ul>`);
told("0", "今天的 AI 新聞早報(工作流)");
if (nav === "wf") drawWF();
}
// Drag a node (the board is scaled, so a finger's pixels are divided by the zoom).
let drag = null;
app.addEventListener("pointerdown", (e) => {
const el = e.target.closest(".node"); if (!el || e.target.closest("button")) return;
const n = WF.nodes[el.dataset.node];
drag = {el, n, x: e.clientX, y: e.clientY, ox: n.x, oy: n.y};
el.setPointerCapture(e.pointerId);
});
app.addEventListener("pointermove", (e) => {
if (!drag) return;
drag.n.x = Math.max(0, Math.min(760 - 120, drag.ox + (e.clientX - drag.x) / (WF.ez || WF.z)));
drag.n.y = Math.max(0, Math.min(600, drag.oy + (e.clientY - drag.y) / (WF.ez || WF.z)));
drag.el.style.left = drag.n.x + "px"; drag.el.style.top = drag.n.y + "px";
drawEdges();
});
app.addEventListener("pointerup", () => { drag = null; });
// ---------- 日程 ----------
const SCH = {off: 0, mode: ""};
const WD = ["週日", "週一", "週二", "週三", "週四", "週五", "週六"];
const hm = (t) => t.split(":").map(Number);
const occurs = (r, d) => r.days === "daily" || (r.days === "weekdays" ? d.getDay() >= 1 && d.getDay() <= 5 : r.days.includes(d.getDay()));
function items(d) {
const list = ROUTINES.filter((r) => occurs(r, d)).map((r) => ({...r, wf: false}));
list.push({t: "09:00", what: "每天早上的 AI 新聞早報", who: "1", wf: true, when: "每天 09:00"});
return list.sort((a, b) => a.t.localeCompare(b.t)).map((r) => {
const [h, m] = hm(r.t), at = new Date(d); at.setHours(h, m, 0, 0);
const today = at.toDateString() === new Date().toDateString();
let s = at.getTime() < now() ? "done" : "coming";
if (s === "done" && !r.wf && !r.fresh && (d.getDate() * 7 + r.what.length) % 11 === 0) s = "failed";
if (r.fresh && at.getTime() < now()) s = "coming";
if (r.wf && today) s = WF.state === "waiting" ? "waiting" : WF.state === "done" ? "done" : WF.state === "stopped" ? "failed" : s;
return {...r, s, at};
});
}
const itemHtml = (r) => `<div class="it"><span class="t">${r.s === "done" ? icon("check").replace('class="i"', 'class="i ok"') : r.s === "failed" ? icon("x").replace('class="i"', 'class="i no"') : r.s === "waiting" ? icon("hand").replace('class="i"', 'class="i wait"') : ""}${r.t}<span class="av">${r.wf ? icon("workflow") : faceOf(byId(r.who))}</span></span><b>${esc(r.what)}</b></div>`;
function drawSched() {
const m = app.classList.contains("m"), mode = SCH.mode || (m ? "day" : "week");
const base = new Date(); base.setHours(0, 0, 0, 0);
const start = new Date(base); start.setDate(base.getDate() - ((base.getDay() + 6) % 7) + SCH.off * 7);
const days = [...Array(7).keys()].map((i) => { const d = new Date(start); d.setDate(start.getDate() + i); return d; });
const end = days[6];
const range = mode === "week" ? `${start.getMonth() + 1}月${start.getDate()}日 – ${end.getMonth() === start.getMonth() ? "" : end.getMonth() + 1 + "月"}${end.getDate()}日` : mode === "day" ? (() => { const d = new Date(base); d.setDate(base.getDate() + SCH.off); return `${d.getMonth() + 1}月${d.getDate()}日(${WD[d.getDay()]})`; })() : (() => { const d = new Date(base.getFullYear(), base.getMonth() + SCH.off, 1); return `${d.getFullYear()} 年 ${d.getMonth() + 1} 月`; })();
let body = "";
if (mode === "week") body = `<div class="week">${days.map((d) => `<div class="dcol ${d.getTime() === base.getTime() ? "today" : ""}"><h5>${WD[d.getDay()]} ${d.getDate()}日</h5>${items(d).filter((r) => !r.wf || d.getTime() >= base.getTime() - 86400e3 * 6).map(itemHtml).join("")}</div>`).join("")}</div>`;
else if (mode === "day") { const d = new Date(base); d.setDate(base.getDate() + SCH.off); body = `<div class="dayl">${items(d).map((r) => `<div class="it"><span class="t">${r.t}</span><b>${esc(r.what)}<br><span style="color:var(--text3);font-size:var(--fs-cap)">${esc(r.wf ? "工作流" : byId(r.who).name)} · ${esc(r.when)}</span></b><span class="t">${r.s === "done" ? icon("check").replace('class="i"', 'class="i ok"') + "完成" : r.s === "failed" ? icon("x").replace('class="i"', 'class="i no"') + "失敗" : r.s === "waiting" ? icon("hand").replace('class="i"', 'class="i wait"') + "等你確認" : "還沒到"}</span></div>`).join("")}</div>`; }
else { const first = new Date(base.getFullYear(), base.getMonth() + SCH.off, 1), lead = (first.getDay() + 6) % 7; body = `<div class="month">${["一", "二", "三", "四", "五", "六", "日"].map((w) => `<span style="font-size:var(--fs-cap);color:var(--text3);padding:0 6px">${w}</span>`).join("")}${[...Array(35).keys()].map((i) => { const d = new Date(first); d.setDate(1 - lead + i); return `<div class="${d.getMonth() !== first.getMonth() ? "out" : ""} ${d.getTime() === base.getTime() ? "today" : ""}">${d.getDate()}<br>${items(d).map(() => "<i></i>").join("")}</div>`; }).join("")}</div>`; }
const next = ROUTINES.map((r) => { const d = new Date(); for (let i = 0; i < 8; i++) { const x = new Date(base); x.setDate(base.getDate() + i); const [h, mi] = hm(r.t); x.setHours(h, mi); if (occurs(r, x) && x.getTime() > now()) return {...r, at: x}; } return null; }).filter(Boolean).sort((a, b) => a.at - b.at);
const when = (x) => { const d = Math.round((new Date(x).setHours(0, 0, 0, 0) - base.getTime()) / 86400e3); return (d === 0 ? "今天" : d === 1 ? "明天" : WD[x.getDay()]) + " " + x.toTimeString().slice(0, 5); };
$("v-sched").innerHTML = `<div class="bar"><button class="ib back" data-back aria-label="回到清單">${icon("chevron-left")}</button><button class="crumb" data-nav="chat">${icon("chevron-left")}聊天</button><h4>日程</h4></div>
<div class="sched"><div class="sch-top"><button class="ib" data-sch="-1" aria-label="往前">${icon("chevron-left")}</button><button class="today" data-sch="0">今天</button><button class="ib" data-sch="1" aria-label="往後">${icon("chevron-right")}</button><span class="range">${range}</span><div class="seg">${[["day", "日"], ["week", "週"], ["month", "月"]].map(([k, l]) => `<button data-schmode="${k}" class="${mode === k ? "on" : ""}">${l}</button>`).join("")}</div></div>
${body}
<div class="coming"><h5>即將執行</h5>${next.map((r) => `<div class="crow ${r.fresh ? "fresh" : ""}"><span>${esc(r.what)} · ${when(r.at)} · ${esc(r.when)}</span><span class="av">${faceOf(byId(r.who))}</span></div>`).join("")}<div class="crow"><span>每天早上的 AI 新聞早報 · 明天 09:00 · 每天 09:00(工作流)</span><span class="av">${icon("workflow")}</span></div></div>
<button class="addr" data-addroutine>+ 新增例行任務</button></div>`;
}
// ---------- dialogs ----------
const MK = {
conn: [["files", "讀寫你指定資料夾裡的檔案", "#f6d5c3", "#c0562a"], ["memory", "長期記憶:把人、事、關係記成知識圖", "#f6d5c3", "#c0562a"], ["thinking", "一步步拆解難題", "#f3e2c7", "#b0701c"], ["fetch", "抓網頁內容轉成文字", "#f6d0e0", "#b8306e"], ["git", "查看和操作 Git 版本庫", "#cfe8df", "#1f7a5c"], ["time", "時間和時區換算", "#cfe8df", "#1f7a5c"], ["playwright", "用真的瀏覽器開網頁、點按、截圖", "#f6d0e0", "#b8306e"], ["github", "看 issue、開 PR(要金鑰)", "#cfe8df", "#1f7a5c"]],
skill: [["pdf", "讀、合併、填寫 PDF"], ["xlsx", "做表格、算公式、畫圖表"], ["docx", "寫 Word 文件"], ["pptx", "做簡報"], ["web-design", "做好看的網頁"], ["deep-research", "多來源深入研究"], ["browser-automation", "瀏覽器自動化"], ["skill-creator", "把做法存成新技能"]],
};
const MS = {kind: "conn", lib: "all", libView: "grid", tf: "all", set: "general", dev: "MacBook Pro"};
function showModal(kind, arg) {
closeMenu();
const m = $("modal");
m.hidden = false; m.dataset.kind = kind;
if (arg === "tpl") MS.kind = "tpl";
const head = (t) => `<div class="dlg-h"><h4>${t}</h4><button class="ib" data-close aria-label="關閉">${icon("x")}</button></div>`;
let html = "";
if (kind === "tasks") {
const list = TASKS.filter((t) => MS.tf === "all" || (MS.tf === "need" ? t.status === "waiting" : MS.tf === "run" ? t.status === "running" : t.status === "done" || t.status === "stopped"));
const wfTask = WF.state === "waiting" && (MS.tf === "all" || MS.tf === "need") ? `<button class="tk" data-nav="wf"><span class="av">${icon("workflow")}</span><div><div class="hd">工作流 · 排程開的<span class="st waiting">等你確認</span></div><div class="tx">每天早上的 AI 新聞早報</div><div class="ln">現在:等你確認「要把早報傳給你嗎?」</div></div></button>` : "";
const SW = {waiting: "等你", running: "進行中", done: "完成", stopped: "停止"};
html = `<div class="dlg">${head("任務")}<div class="dlg-b one"><div class="dmain"><div class="dtop">${[["all", "全部"], ["need", "要看的"], ["run", "進行中"], ["done", "做完的"]].map(([k, l]) => `<button class="chipb ${MS.tf === k ? "on" : ""}" data-tf="${k}">${l}</button>`).join("")}</div><div class="tasks">${wfTask}${list.map((t) => { const p = byId(t.bot); return `<button class="tk" data-bot="${t.bot}"><span class="av">${faceOf(p)}</span><div><div class="hd">${esc(p.name)} · 你開的<span class="st ${t.status}">${SW[t.status]}</span></div><div class="tx">${esc(t.text)}</div><div class="ln">${t.steps} 步 · 最後動靜 ${since(t.at)}${t.doing ? " · " + esc(t.doing) : ""}</div></div></button>`; }).join("")}${!list.length && !wfTask ? `<div class="empty-note">這裡沒有。交代 Bot 做一件事,它就會出現在這裡。</div>` : ""}</div></div></div></div>`;
} else if (kind === "files") {
const kinds = [["all", "全部"], ["img", "圖片"], ["doc", "文件"], ["sheet", "表格"], ["pdf", "PDF"]];
const q = MS.libQ || "";
const byBot = MS.lib.startsWith("bot:") ? MS.lib.slice(4) : "";
const pool = FILES.filter((f) => (!byBot || f.bot === byBot) && (MS.lib !== "week" || now() - f.at < 7 * 86400e3) && (!q || f.name.includes(q)));
const shown = pool.filter((f) => !MS.fk || MS.fk === "all" || f.kind === MS.fk);
const ic = {img: "image", doc: "file-text", sheet: "sheet", pdf: "file-text"};
const bots = [...new Set(FILES.map((f) => f.bot))];
html = `<div class="dlg">${head("所有檔案")}<div class="dlg-b"><div class="dside"><input id="lib-q" placeholder="搜尋檔案名稱" value="${esc(q)}"><button class="${MS.lib === "all" ? "on" : ""}" data-lib="all">所有檔案<em>${FILES.length}</em></button><button class="${MS.lib === "week" ? "on" : ""}" data-lib="week">最近 7 天<em>${FILES.filter((f) => now() - f.at < 7 * 86400e3).length}</em></button><h6>Bot</h6>${bots.map((b) => `<button class="${MS.lib === "bot:" + b ? "on" : ""}" data-lib="bot:${b}">${esc(byId(b).name)}<em>${FILES.filter((f) => f.bot === b).length}</em></button>`).join("")}</div>
<div class="dmain"><div class="dtop">${kinds.map(([k, l]) => `<button class="chipb ${(MS.fk || "all") === k ? "on" : ""}" data-fk="${k}">${l} ${k === "all" ? pool.length : pool.filter((f) => f.kind === k).length}</button>`).join("")}<span style="flex:1"></span><div class="seg" style="margin:0"><button class="${MS.libView === "grid" ? "on" : ""}" data-lv="grid">格子</button><button class="${MS.libView === "list" ? "on" : ""}" data-lv="list">清單</button></div></div>
${MS.libView === "grid" ? `<div class="files">${shown.map((f) => `<button class="fcard ${f.fresh ? "fresh" : ""}" data-file="${esc(f.name)}"><span class="th ${f.kind === "img" ? "img" : ""}" ${f.h ? `style="--h1:${f.h[0]};--h2:${f.h[1]}"` : ""}>${icon(ic[f.kind])}</span><b>${esc(f.name)}</b><span>${esc(byId(f.bot).name)} · ${since(f.at)}</span></button>`).join("")}</div>` : `<div class="flist">${shown.map((f) => `<button class="frow" data-file="${esc(f.name)}">${icon(ic[f.kind])}<b style="font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">${esc(f.name)}</b><span>${esc(byId(f.bot).name)} · ${since(f.at)}</span></button>`).join("")}</div>`}
${shown.length ? "" : `<div class="empty-note">沒有符合的檔案。Bot 交給你的、你傳給 Bot 的檔案都會出現在這裡。</div>`}</div></div></div>`;
} else if (kind === "market") {
const cnt = {conn: 8, skill: 16, tpl: TPLS.length};
let right = "";
if (MS.kind === "conn") right = `<h5>連接器</h5><p class="desc">讓 Bot 用別的服務的工具:檔案、網頁、GitHub…(MCP)</p><div class="mk">${MK.conn.map(([n, d, bg, fg]) => `<div class="mkc"><span class="lt" style="background:${bg};color:${fg}">${n[0].toUpperCase()}</span><b>${n}<small>官方</small></b><button class="add ${INSTALLED.has(n) ? "done" : ""}" data-install="${n}">${INSTALLED.has(n) ? "已加入" : "加入"}</button><p>${d}</p></div>`).join("")}</div>`;
else if (MS.kind === "skill") right = `<h5>技能</h5><p class="desc">Agent Skills(SKILL.md):Bot 照著做的做法,也能從 GitHub 裝</p><div class="mk">${MK.skill.map(([n, d]) => `<div class="mkc"><span class="lt" style="background:var(--soft2);color:var(--fg)">${n[0].toUpperCase()}</span><b>${n}<small>內建</small></b><button class="add ${INSTALLED.has(n) ? "done" : ""}" data-install="${n}">${INSTALLED.has(n) ? "已安裝" : "安裝"}</button><p>${d}</p></div>`).join("")}</div>`;
else right = `<h5>Bot 範本</h5><p class="desc">從範本建一個新的 Bot,建好就在左邊</p><div class="mk">${TPLS.map((t) => `<div class="mkc"><span class="av">${avatarSvg(t.shape, t.color)}</span><b>${t.name}</b><button class="add ${byId(t.id) ? "done" : ""}" data-tpl="${t.key}">${byId(t.id) ? "已建立" : "建立"}</button><p>${t.about}</p></div>`).join("")}</div>`;
html = `<div class="dlg">${head("市集")}<div class="dlg-b"><div class="dside"><input placeholder="搜尋市集" aria-label="搜尋市集">${[["conn", "連接器"], ["skill", "技能"], ["tpl", "Bot 範本"]].map(([k, l]) => `<button class="${MS.kind === k ? "on" : ""}" data-mk="${k}">${l}<em>${cnt[k]}</em></button>`).join("")}<h6>已安裝</h6>${[...INSTALLED].map((n) => `<span class="inst">${n}<em>${MK.conn.some((c) => c[0] === n) ? "連接器" : "技能"}</em></span>`).join("")}</div><div class="dmain">${right}</div></div></div>`;
} else if (kind === "settings") {
const tabs = [["general", "一般"], ["profile", "個人資料"], ["models", "模型"], ["integ", "整合"], ["computers", "電腦"], ["perms", "權限"], ["vault", "保險庫"], ["voice", "語音"], ["updates", "更新"]];
const mode = root.dataset.theme || "";
const row = (k, r, cls = "", wrap = false) => `<div class="srow ${wrap ? "wrap" : ""}"><div>${k}</div><div class="r ${cls}">${r}</div></div>`;
const P = {
general: `<h5>外觀</h5><div class="sgroup"><div class="srow"><div>主題</div><div class="seg" style="margin:0">${[["light", "淺色"], ["dark", "深色"], ["", "跟著系統"]].map(([k, l]) => `<button data-mode="${k}" class="${mode === k ? "on" : ""}">${l}</button>`).join("")}</div></div><div class="srow wrap"><div>風格<small>顏色和聊天背景的花紋一起換,電腦和手機同步</small></div><div class="swatches" id="app-sw"></div></div>${row("語言", `<span class="fake-select">自動偵測(繁體中文)${icon("chevron-down")}</span>`)}</div><h5>記憶與文件</h5><div class="sgroup">${row("用意思找記憶<small>在這台電腦上算,不會上傳</small>", `<div class="seg" style="margin:0"><button class="on">本機模型</button><button>Ollama</button><button>關閉</button></div>`, "", true)}${row("Bot 可以翻的資料夾", "~/筆記")}</div>`,
profile: `<div class="sgroup">${row("名字", "你")}${row("關於你<small>所有 Bot 共用的記憶</small>", "喜歡簡短、不要太客套")}${row("時區", "Asia/Taipei")}</div>`,
models: `<div class="sgroup">${row("ChatGPT 方案<small>用帳號登入,用方案的額度</small>", "已登入", "ok")}${row("OpenAI", "可以用", "ok")}${row("Claude", "可以用", "ok")}${row("Gemini", "可以用", "ok")}${row("xAI", "可以用", "ok")}${row("OpenRouter", "未設定")}${row("Ollama<small>在這台電腦上跑</small>", "qwen3 · 可以用", "ok")}</div>`,
integ: `<h5>連接器</h5><div class="sgroup">${[...INSTALLED].filter((n) => MK.conn.some((c) => c[0] === n)).map((n) => row(n, "已連上", "ok")).join("") || row("還沒有", `<button class="chipb" data-modal="market">去市集加</button>`)}</div><h5>訊息管道</h5><div class="sgroup">${row("Telegram", "未連接")}${row("Slack", "未連接")}${row("Mac 的「訊息」", "未連接")}</div>`,
computers: `<div class="sgroup">${row("這台電腦<small>macOS · 你正在用</small>", "連上了", "ok")}${row("Bot 的電腦<small>Docker 裡的 Linux 桌面 · gVisor 隔離</small>", "執行中", "ok")}${row("客廳 Linux<small>手腳 · 大腦簽過名的指令才聽</small>", "離線")}</div>`,
perms: `<div class="sgroup"><div class="srow"><div>一律放行<small>什麼都不問,全部直接做(付款這類每次都問的照樣問)</small></div><button class="switch danger" role="switch" aria-checked="${ALWAYS}" data-always aria-label="一律放行"></button></div>${row("智慧模式<small>卡片幾分鐘沒回,看檔案、上網這類自己判斷</small>", "一直開著")}${row("等幾秒自己回答", "300 秒")}</div><h5>一律允許的</h5><div class="sgroup">${RULES.length ? RULES.map((r) => row(r, "一律允許")).join("") : row("還沒有規則<small>卡片上按「一律允許」就會加在這裡</small>", "")}</div>`,
vault: `<div class="sgroup">${row("workshop.example<small>an@example.com</small>", "••••••••")}${row("信用卡<small>末四碼 4242</small>", "••••")}</div><p class="desc" style="margin:0">密碼和卡號由 AnyBot 直接填進網頁,模型看不到。</p>`,
voice: `<div class="sgroup">${row("聽(說話輸入)", "OpenAI · 可以用", "ok")}${row("說(唸出回答)", "xAI · 可以用", "ok")}</div>`,
updates: `<div class="sgroup">${row("版本", "已是最新版", "ok")}${row("沒人用的時候自動更新 Bot 的電腦", `<button class="switch" role="switch" aria-checked="true" data-toggle aria-label="自動更新"></button>`)}</div>`,
};
html = `<div class="dlg">${head("設定")}<div class="dlg-b"><div class="dside"><input placeholder="搜尋設定…" aria-label="搜尋設定">${tabs.map(([k, l]) => `<button class="${MS.set === k ? "on" : ""}" data-set="${k}">${l}</button>`).join("")}</div><div class="dmain">${P[MS.set]}</div></div></div>`;
} else if (kind === "drops") {
html = `<div class="dlg sm">${head("傳送到其他裝置")}<div class="dlg-b one"><div class="dmain"><div class="devs">${["MacBook Pro", "你的手機", "客廳 Linux"].map((d) => `<button class="chipb ${MS.dev === d ? "on" : ""}" data-dev="${d}">${d}</button>`).join("")}</div><button class="big-btn" data-pick>${icon("arrow-up")}選擇檔案或照片</button><div class="drop-in"><textarea id="drop-text" placeholder="或貼上一段文字、網址(對方收到就在剪貼簿裡)"></textarea><button class="big-btn soft" data-droptext>傳送文字</button></div><h5 style="margin-top:6px">最近 7 天</h5><div class="flist">${DROPS.map((d) => `<div class="frow">${icon(d.text.includes(".") ? "file-text" : "copy")}<b style="font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">${esc(d.text)}</b><span>${esc(d.from)} · 已送達 · ${since(d.at)}</span></div>`).join("")}</div></div></div></div>`;
} else if (kind === "runs") {
html = `<div class="dlg sm">${head("執行紀錄")}<div class="dlg-b one"><div class="dmain"><div class="flist">${WF.runs.map((r) => `<div class="frow">${icon(r.how === "完成" ? "check" : r.how.includes("等你") ? "hand" : "x")}<b style="font-weight:500">${esc(r.at)}</b><span>${esc(r.how)}</span></div>`).join("")}</div></div></div></div>`;
}
m.innerHTML = html;
if (kind === "settings") drawPickers();
app.querySelectorAll(".rail [data-modal]").forEach((b) => b.classList.toggle("on", b.dataset.modal === kind));
}
function closeModal() { $("modal").hidden = true; app.querySelectorAll(".rail [data-modal]").forEach((b) => b.classList.remove("on")); }
function closeMenu() { app.querySelector(".menu")?.remove(); }
function setAlways(on) {
ALWAYS = on;
$("alwaysbar").hidden = !on; $("zap").hidden = !on;
if (on) for (const k in C) if (C[k].waiting) { const y = C[k].el.querySelector(".ask button.yes"); y && y.click(); }
}
// ---------- the app's controls ----------
app.addEventListener("click", (e) => {
const t = (s) => e.target.closest(s);
let b;
if (t("[data-close]") || e.target === $("modal")) return closeModal();
if ((b = t("[data-bot]"))) return open(b.dataset.bot);
if ((b = t("[data-nav]"))) return b.dataset.nav === "chat" && app.classList.contains("m") ? (inMain = false, layout(), drawSide()) : b.dataset.nav === "chat" ? open(cur) : go(b.dataset.nav);
if (t("[data-back]")) { inMain = false; closeModal(); layout(); drawSide(); return; }
if ((b = t("[data-modal]"))) return showModal(b.dataset.modal, b.dataset.arg);
if ((b = t("[data-sc]"))) return run(cur, SC[b.dataset.sc], SC[b.dataset.sc].label);
if ((b = t("[data-toast]"))) return toast(b.dataset.toast);
if (t("[data-always-off]")) { setAlways(false); toast("已關閉一律放行"); return; }
if (t("[data-always]")) { setAlways(!ALWAYS); showModal("settings"); toast(ALWAYS ? "一律放行打開了:回到聊天試試看" : "已關閉一律放行"); return; }
if ((b = t("[data-toggle]"))) { b.setAttribute("aria-checked", String(b.getAttribute("aria-checked") !== "true")); return; }
if ((b = t("[data-wf]"))) { const a = b.dataset.wf; if (a === "run") wfRun(); else if (a === "go") wfDecide(true); else if (a === "halt") wfDecide(false); else if (a === "add") { WF.added++; WF.nodes["n" + WF.added] = {kind: "助手", icon: "bot", x: 520, y: 120 + WF.added * 36, who: "Bot", text: "新的步驟:跟它說要做什麼", s: ""}; drawWF(); toast("拖拉節點換位置;真的 AnyBot 裡可以接線、選 Bot"); } return; }
if (t("[data-note]")) { WF.added++; WF.nodes["s" + WF.added] = {kind: "note", x: 560, y: 380 + WF.added * 12, text: "記一下\n\n— 你"}; drawWF(); return; }
if ((b = t("[data-tool]"))) { b.parentElement.querySelectorAll("[data-tool]").forEach((x) => x.classList.toggle("on", x === b)); return; }
if ((b = t("[data-zoom]"))) { WF.z = Math.min(1.4, Math.max(0.5, Math.round((WF.z + 0.1 * +b.dataset.zoom) * 10) / 10)); drawWF(); return; }
if ((b = t("[data-sch]"))) { SCH.off = +b.dataset.sch === 0 ? 0 : SCH.off + +b.dataset.sch; drawSched(); return; }
if ((b = t("[data-schmode]"))) { SCH.mode = b.dataset.schmode; SCH.off = 0; drawSched(); return; }
if (t("[data-addroutine]")) { open("0"); $("say").value = "每個工作日早上 9 點提醒我站起來動一動"; $("say").focus(); drawOffers(); return; }
if ((b = t("[data-tf]"))) { MS.tf = b.dataset.tf; showModal("tasks"); return; }
if ((b = t("[data-lib]"))) { MS.lib = b.dataset.lib; showModal("files"); return; }
if ((b = t("[data-fk]"))) { MS.fk = b.dataset.fk; showModal("files"); return; }
if ((b = t("[data-lv]"))) { MS.libView = b.dataset.lv; showModal("files"); return; }
if ((b = t("[data-file]"))) { const f = FILES.find((x) => x.name === b.dataset.file); if (f) { open(f.bot); toast(`「${f.name}」在 ${byId(f.bot).name} 的聊天裡`); } return; }
if ((b = t("[data-mk]"))) { MS.kind = b.dataset.mk; showModal("market"); return; }
if ((b = t("[data-install]"))) { const n = b.dataset.install; INSTALLED.has(n) ? INSTALLED.delete(n) : INSTALLED.add(n); showModal("market"); return; }
if ((b = t("[data-tpl]"))) { const tp = TPLS.find((x) => x.key === b.dataset.tpl); if (makeBot(tp)) toast(`已建立「${tp.name}」,在左邊`); showModal("market"); return; }
if ((b = t("[data-set]"))) { MS.set = b.dataset.set; showModal("settings"); return; }
if ((b = t("#modal [data-mode]"))) { if (b.dataset.mode) root.dataset.theme = b.dataset.mode; else delete root.dataset.theme; store.set("anybot-site-mode", b.dataset.mode || null); showModal("settings"); return; }
if ((b = t("[data-dev]"))) { MS.dev = b.dataset.dev; showModal("drops"); return; }
if (t("[data-pick]")) { DROPS.unshift({text: "截圖 " + new Date().toISOString().slice(0, 10) + ".png", from: "這台電腦 → " + MS.dev, at: now()}); showModal("drops"); return; }
if (t("[data-droptext]")) { const v = ($("drop-text").value || "").trim(); if (!v) return toast("先打一段文字"); DROPS.unshift({text: v, from: "這台電腦 → " + MS.dev, at: now()}); showModal("drops"); return; }
if (t("#share")) return toast("示範:真的 AnyBot 會產生一個分享這段對話的連結");
if (t("#more")) {
if (app.querySelector(".menu")) return closeMenu();
const menu = document.createElement("div"); menu.className = "menu";
menu.innerHTML = `<button data-menu="new">${icon("plus")}開始新對話</button><button data-menu="unread">${icon("bell")}標示為未讀</button><button data-modal="settings">${icon("gear")}設定</button>`;
$("v-chat").appendChild(menu); return;
}
if ((b = t("[data-menu]"))) {
closeMenu();
if (b.dataset.menu === "new") { const c = conv(cur); if (c.busy) return toast("它正在做事,先按停止"); c.el.remove(); delete C[cur]; open(cur); toast("開始新對話;剛剛那段留在「過去的對話」"); }
else { conv(cur).unread = true; inMain = false; layout(); drawSide(); }
return;
}
if (!t(".menu")) closeMenu();
});
$("find-btn").onclick = (e) => { e.stopPropagation(); const f = $("find"); f.hidden = !f.hidden; if (!f.hidden) f.focus(); else { f.value = ""; drawSide(); } };
$("find").addEventListener("input", drawSide);
app.addEventListener("input", (e) => { if (e.target.id === "lib-q") { MS.libQ = e.target.value; const pos = e.target.selectionStart; showModal("files"); const q = $("lib-q"); q.focus(); q.setSelectionRange(pos, pos); } });
const sayIn = $("say");
sayIn.addEventListener("input", drawOffers);
$("composer").addEventListener("submit", (e) => {
e.preventDefault();
const c = conv(cur), v = sayIn.value.trim();
if (!v && c.busy) return stopRun(cur);
if (!v) return;
sayIn.value = ""; route(cur, v); drawOffers();
});
document.querySelectorAll("[data-view]").forEach((b) => b.onclick = () => { view = b.dataset.view; document.querySelectorAll("[data-view]").forEach((x) => x.setAttribute("aria-selected", String(x === b))); layout(); });
matchMedia("(max-width: 760px)").addEventListener("change", layout);
open("3");
run("3", SC.photos, SC.photos.label);
// ---------- 風格 (src/theme.rs TEMPLATES: text, background, accent; light and dark) ----------
const TPL = [
{id: "paper", name: "紙", about: "溫暖的紙和墨,黏土色點綴", l: ["#25221f", "#faf9f6", "#c06244"], d: ["#f2f0eb", "#1e1d1b", "#d88366"], bd: ""},
{id: "night", name: "夜", about: "冷靜的灰,一點靛藍", l: ["#202124", "#f6f6f8", "#5e6ad2"], d: ["#f0f0f2", "#101112", "#7c87e0"], bd: ""},
{id: "ink", name: "墨", about: "只有黑和白,最安靜", l: ["#0d0d0d", "#f9f9f9", "#0d0d0d"], d: ["#f7f7f7", "#0a0a0a", "#f7f7f7"], bd: ""},
{id: "moss", name: "苔", about: "綠色的紙,背景有點點", l: ["#1f2420", "#f4f6f2", "#4a7c59"], d: ["#ecf0ea", "#151815", "#7faa8a"], bd: "dots"},
{id: "ocean", name: "海", about: "藍色的海,背景有波浪", l: ["#13293d", "#f2f7fb", "#1f7ab8"], d: ["#e3eef7", "#0c1822", "#5fb0e6"], bd: "waves"},
{id: "candy", name: "糖", about: "粉粉的糖果色,背景有點點", l: ["#3b2340", "#fff5fa", "#d6457f"], d: ["#f7e6f0", "#1f1420", "#f07aab"], bd: "dots"},
{id: "sunset", name: "夕陽", about: "橘紅的傍晚,暖暖的", l: ["#3a2214", "#fff6ee", "#e06a2c"], d: ["#f6e9de", "#1d130d", "#f29a5c"], bd: "waves"},
{id: "terminal", name: "終端機", about: "黑底綠字,背景有格線", l: ["#0e2a12", "#f1f7ee", "#2d8a3e"], d: ["#a8f0a0", "#07100a", "#4fe36a"], bd: "grid"},
];
const v = ([f, b, a]) => `--fg:${f};--bg:${b};--accent:${a};`;
const css = TPL.slice(1).map((t) => `:root[data-style="${t.id}"]{${v(t.l)}}@media (prefers-color-scheme: dark){:root[data-style="${t.id}"]:not([data-theme="light"]){${v(t.d)}}}:root[data-style="${t.id}"][data-theme="dark"]{${v(t.d)}}`).join("\n");
const st = document.createElement("style"); st.textContent = css; document.head.appendChild(st);
const dark = () => root.dataset.theme === "dark" || (root.dataset.theme !== "light" && matchMedia("(prefers-color-scheme: dark)").matches);
function drawPickers() {
const cur = root.dataset.style || "paper", dk = dark();
const sw = TPL.map((t) => { const [f, b, a] = dk ? t.d : t.l; return `<button class="sw ${t.id === cur ? "on" : ""}" data-style="${t.id}" title="${t.about}"><i style="background:${b};--f:${f};--a:${a}"></i>${t.name}</button>`; }).join("");
$("swatches").innerHTML = sw;
if ($("app-sw")) $("app-sw").innerHTML = sw;
$("gallery").innerHTML = TPL.map((t) => { const [f, b, a] = dk ? t.d : t.l; return `<button class="tpl ${t.id === cur ? "on" : ""}" data-style="${t.id}" aria-pressed="${t.id === cur}"><span class="pic" style="--f:${f};--b:${b};--a:${a}"><i></i><s><b></b></s></span><span class="meta"><b>${t.name}</b><span>${t.about}</span></span></button>`; }).join("");
document.querySelectorAll(".pop .modes button").forEach((b) => b.classList.toggle("on", (root.dataset.theme || "") === b.dataset.mode));
}
function setStyle(id, keep = true) {
const t = TPL.find((x) => x.id === id) || TPL[0];
root.dataset.style = t.id;
document.body.classList.remove("dots", "grid", "waves");
if (t.bd) document.body.classList.add(t.bd);
if (keep) store.set("anybot-site-style", t.id === "paper" ? null : t.id);
drawPickers();
}
document.addEventListener("click", (e) => { const b = e.target.closest("[data-style]"); if (b && b.matches("button")) setStyle(b.dataset.style); });
document.querySelectorAll(".pop .modes button").forEach((b) => b.onclick = () => { if (b.dataset.mode) root.dataset.theme = b.dataset.mode; else delete root.dataset.theme; store.set("anybot-site-mode", b.dataset.mode || null); drawPickers(); });
matchMedia("(prefers-color-scheme: dark)").addEventListener("change", drawPickers);
new MutationObserver(drawPickers).observe(root, {attributes: true, attributeFilter: ["data-theme"]});
const savedMode = store.get("anybot-site-mode"); if (savedMode === "light" || savedMode === "dark") root.dataset.theme = savedMode;
setStyle(store.get("anybot-site-style") || "paper", false);
const pop = $("style-pop"), pbtn = $("style-btn");
pbtn.onclick = (e) => { e.stopPropagation(); pop.hidden = !pop.hidden; pbtn.setAttribute("aria-expanded", String(!pop.hidden)); };
document.addEventListener("click", (e) => { if (!pop.hidden && !pop.contains(e.target) && e.target !== pbtn) { pop.hidden = true; pbtn.setAttribute("aria-expanded", "false"); } });
document.addEventListener("keydown", (e) => { if (e.key === "Escape" && !pop.hidden) { pop.hidden = true; pbtn.setAttribute("aria-expanded", "false"); pbtn.focus(); } });
// ---------- install ----------
const BASE = "https://code.30cm.net/daniel.w/AnyBot/raw/branch/main";
const CMDS = {
unix: [`curl -fsSL ${BASE}/install.sh | sh`, "第一次編譯 5–15 分鐘,之後更新 1–2 分鐘。apt、dnf、yum、pacman、zypper、apk、xbps 都認得。"],
win: [`irm ${BASE}/install.ps1 | iex`, "在 PowerShell 貼上。Windows 10 和 11,x64 或 arm64。"],
server: [`curl -fsSL ${BASE}/install.sh | sh -s -- server`, "帳號伺服器加大腦,任何有 Docker 的 Linux、2 GB 以上。只問網址、帳號、密碼,HTTPS 它自己處理。"],
};
function tab(k) {
document.querySelectorAll("[data-tab]").forEach((b) => b.setAttribute("aria-selected", String(b.dataset.tab === k)));
$("cmd-text").textContent = CMDS[k][0];
$("cmd-note").textContent = CMDS[k][1];
}
document.querySelectorAll("[data-tab]").forEach((b) => b.onclick = () => tab(b.dataset.tab));
tab(/Windows/.test(navigator.userAgent) ? "win" : "unix");
$("copy").onclick = async () => {
const label = $("copy").querySelector("span");
try { await navigator.clipboard.writeText($("cmd-text").textContent); label.textContent = "已複製"; }
catch { const r = document.createRange(); r.selectNodeContents($("cmd-text")); const s = getSelection(); s.removeAllRanges(); s.addRange(r); label.textContent = "已選取,按 ⌘C"; }
setTimeout(() => label.textContent = "複製", 1800);
};
// ---------- top bar edge ----------
const top = $("top");
const edge = () => top.classList.toggle("scrolled", scrollY > 8);
addEventListener("scroll", edge, {passive: true}); edge();
})();
</script>
</body>
</html>