@gafj/gafj 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +99 -0
- package/bin/cli.js +628 -0
- package/bridge/byo_key.js +50 -0
- package/bridge/credits.js +72 -0
- package/bridge/paste.js +44 -0
- package/bridge/providers/anthropic.js +16 -0
- package/bridge/providers/gemini.js +15 -0
- package/bridge/providers/index.js +39 -0
- package/bridge/providers/openai_compatible.js +17 -0
- package/core/extract.js +55 -0
- package/core/generators/excerpt.js +64 -0
- package/core/generators/packet.js +197 -0
- package/core/generators/serialize.js +56 -0
- package/core/generators/slice.js +61 -0
- package/core/house_rules.js +49 -0
- package/core/kb_import.js +257 -0
- package/core/migrations/002-profile.sql +3 -0
- package/core/migrations/003-discover.sql +49 -0
- package/core/parsers.js +79 -0
- package/core/practice.js +75 -0
- package/core/provenance.js +90 -0
- package/core/qr.js +185 -0
- package/core/rules/categories.md +5 -0
- package/core/rules/deep_answers.md +7 -0
- package/core/rules/discover.md +30 -0
- package/core/rules/extract.md +31 -0
- package/core/rules/followup.md +9 -0
- package/core/rules/index.js +32 -0
- package/core/rules/onepager.md +15 -0
- package/core/rules/practice.md +10 -0
- package/core/rules/prep.md +47 -0
- package/core/rules/resume.md +49 -0
- package/core/rules/rubric.md +120 -0
- package/core/schema.sql +342 -0
- package/core/schemas/categories.js +16 -0
- package/core/schemas/cover.js +10 -0
- package/core/schemas/deep_answers.js +16 -0
- package/core/schemas/discover.js +19 -0
- package/core/schemas/extract.js +32 -0
- package/core/schemas/followup.js +10 -0
- package/core/schemas/index.js +32 -0
- package/core/schemas/lang.js +111 -0
- package/core/schemas/onepager.js +26 -0
- package/core/schemas/practice.js +18 -0
- package/core/schemas/prep.js +15 -0
- package/core/schemas/resume.js +25 -0
- package/core/scoring.js +586 -0
- package/core/text.js +98 -0
- package/core/tracker_map.js +94 -0
- package/core/ulid.js +38 -0
- package/core/validators/highlight_body_match.js +49 -0
- package/core/validators/index.js +43 -0
- package/core/validators/metric_pairing.js +52 -0
- package/core/validators/no_confabulated_history.js +63 -0
- package/core/validators/no_dashes.js +31 -0
- package/core/validators/no_derived_tenure.js +60 -0
- package/core/validators/style_config.js +18 -0
- package/core/validators/verb_ladder.js +51 -0
- package/core/verbs.js +43 -0
- package/http/api.js +260 -0
- package/http/guard.js +106 -0
- package/http/headers.js +17 -0
- package/http/hosted.js +273 -0
- package/http/identity.js +70 -0
- package/http/server.js +136 -0
- package/http/sse.js +41 -0
- package/mcp/server.js +25 -0
- package/mcp/tools.js +237 -0
- package/package.json +59 -0
- package/store/backup.js +63 -0
- package/store/backup_dir.js +60 -0
- package/store/config.js +32 -0
- package/store/context.js +74 -0
- package/store/db.js +37 -0
- package/store/discover.js +120 -0
- package/store/events.js +28 -0
- package/store/export_xlsx.js +62 -0
- package/store/home.js +36 -0
- package/store/import_kb.js +88 -0
- package/store/import_tracker.js +195 -0
- package/store/ingest.js +140 -0
- package/store/kb.js +202 -0
- package/store/log.js +88 -0
- package/store/migrate.js +55 -0
- package/store/onboarding.js +267 -0
- package/store/packets.js +110 -0
- package/store/practice.js +52 -0
- package/store/proposals.js +119 -0
- package/store/reads.js +110 -0
- package/store/render.js +111 -0
- package/store/reply.js +19 -0
- package/store/review.js +64 -0
- package/store/scoring.js +134 -0
- package/store/settings.js +142 -0
- package/store/snapshot.js +88 -0
- package/store/transitions.js +391 -0
- package/store/tx.js +71 -0
- package/store/tz.js +24 -0
- package/ui/app.css +137 -0
- package/ui/app.js +75 -0
- package/ui/fonts/plexmono-400.woff2 +0 -0
- package/ui/fonts/plexmono-500.woff2 +0 -0
- package/ui/fonts/plexmono-600.woff2 +0 -0
- package/ui/fonts/spacegrotesk-var.woff2 +0 -0
- package/ui/hosted/signin.css +8 -0
- package/ui/hosted/signin.html +30 -0
- package/ui/hosted/signin.js +28 -0
- package/ui/icon-192.png +0 -0
- package/ui/icon-512.png +0 -0
- package/ui/index.html +20 -0
- package/ui/lib.js +92 -0
- package/ui/manifest.webmanifest +18 -0
- package/ui/screens/application.js +73 -0
- package/ui/screens/dashboard.js +37 -0
- package/ui/screens/document.js +64 -0
- package/ui/screens/interview.js +85 -0
- package/ui/screens/kb.js +142 -0
- package/ui/screens/packet.js +122 -0
- package/ui/screens/postings.js +92 -0
- package/ui/screens/settings.js +115 -0
- package/ui/vendor/preact.mjs +1 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { html, useState, useEffect } from "../vendor/preact.mjs";
|
|
2
|
+
import { api, useInstall } from "../lib.js";
|
|
3
|
+
|
|
4
|
+
/** Screen 6: AI route, providers (keys write-only), house rules per kind, data folder, backup, startup. */
|
|
5
|
+
|
|
6
|
+
const KINDS = ["resume", "cover", "onepager", "email", "prep", "deep_answers", "practice", "cheatsheet"];
|
|
7
|
+
|
|
8
|
+
export function Settings({ live }) {
|
|
9
|
+
const [s, setS] = useState(null);
|
|
10
|
+
const [err, setErr] = useState("");
|
|
11
|
+
const [msg, setMsg] = useState("");
|
|
12
|
+
const [prov, setProv] = useState(null);
|
|
13
|
+
const [mcp, setMcp] = useState(null);
|
|
14
|
+
const inst = useInstall();
|
|
15
|
+
const load = () => api.get("/api/settings").then((x) => { setS(x); setErr(""); }).catch((e) => setErr(e.message));
|
|
16
|
+
useEffect(() => { load(); }, [live]);
|
|
17
|
+
const put = async (patch) => { setMsg(""); try { setS(await api.put("/api/settings", patch)); setMsg("saved"); } catch (e) { setErr(e.message); } };
|
|
18
|
+
const post = async (path, body, label) => { setMsg(""); try { const r = await api.post(path, body); setMsg(label ? `${label}: ${r.file || r.message || JSON.stringify(r)}` : JSON.stringify(r)); await load(); } catch (e) { setErr(e.message); } };
|
|
19
|
+
if (err && !s) return html`<p class="error">${err}</p>`;
|
|
20
|
+
if (!s) return html`<p class="muted">loading</p>`;
|
|
21
|
+
const h = s.house_rules;
|
|
22
|
+
// house rules save whole: every PUT carries the current table so nothing silently resets
|
|
23
|
+
const hr = (patch) => put({ house_rules: { no_dashes: h.no_dashes, style_config: h.style_config, hyphen_allow: h.hyphen_allow, bullet_register: h.bullet_register, ...patch } });
|
|
24
|
+
const setSev = (rule, kind, sev) => hr({ [rule]: { ...h[rule], [kind]: sev } });
|
|
25
|
+
return html`<div>
|
|
26
|
+
<h1>Settings</h1>
|
|
27
|
+
${err ? html`<p class="error">${err}</p>` : ""}${msg ? html`<p class="small muted">${msg}</p>` : ""}
|
|
28
|
+
<h2>App</h2>
|
|
29
|
+
<div class="card">
|
|
30
|
+
${inst.installed ? html`<p>Installed as an app. It opens in its own window from the Start menu or dock.</p>`
|
|
31
|
+
: inst.canInstall ? html`<div class="row"><button class="primary" onClick=${inst.install}>Install GAF-J as an app</button><span class="small muted">own window, Start menu entry, no browser chrome</span></div>`
|
|
32
|
+
: html`<p class="small muted">To install as an app: in Chrome or Edge use the install icon at the right end of the address bar, or the browser menu, "Install GAF-J". The page must be open at its 127.0.0.1 address (it is). No service worker is registered on purpose: the UI is never served from a cache, so a stale screen cannot outlive the store.</p>`}
|
|
33
|
+
</div>
|
|
34
|
+
<h2>AI route</h2>
|
|
35
|
+
<div class="card">
|
|
36
|
+
${(s.hosted
|
|
37
|
+
? [["credits", "Credits: your documents run on the included AI, paid in credits"], ["paste", "Paste: copy a packet into any chat you already pay for, paste the JSON back"]]
|
|
38
|
+
: [["paste", "Paste: copy a packet into any chat, paste the JSON back"], ["mcp", "Claude Desktop / Claude Code through the local MCP server"], ["byo_key", "My providers: the local server calls the one you mark active"], ["credits", "Credits: the local server sends packets to the hosted relay with your sign-in token (relay not deployed yet)"]]
|
|
39
|
+
).map(([r, label]) => html`<div key=${r}><label><input type="radio" name="route" checked=${s.route === r} disabled=${r === "credits" && !s.hosted && !(s.credits && s.credits.has_token)} onChange=${() => put({ route: r })} /> ${label}</label></div>`)}
|
|
40
|
+
${s.hosted ? "" : html`<div class="row"><button onClick=${async () => setMcp(mcp ? null : await api.get("/api/mcp-config"))}>${mcp ? "hide" : "Print MCP config"}</button></div>`}
|
|
41
|
+
${mcp ? html`<div><p class="small">Claude Desktop, merge into mcpServers:</p><textarea readonly value=${JSON.stringify(mcp.desktop, null, 2)}></textarea><p class="small">Claude Code:</p><textarea readonly value=${mcp.code}></textarea></div>` : ""}
|
|
42
|
+
</div>
|
|
43
|
+
${s.hosted ? "" : html`<h2>My providers</h2>
|
|
44
|
+
<div class="card"><ul class="list">${s.providers.map((p) => html`<li key=${p.id}>
|
|
45
|
+
<label><input type="radio" name="active" checked=${s.active_provider_id === p.id} onChange=${() => put({ active_provider_id: p.id })} /></label>
|
|
46
|
+
<b>${p.label}</b> <span class="tag">${p.kind}</span> <span class="muted">${p.model || ""}</span> <span class="mono small">${p.key || "no key"}</span> <span class="muted small">${p.base_url || ""}</span>
|
|
47
|
+
${p.last_test ? html`<span class=${"tag " + (p.last_test.ok ? "passed" : "blocked")}>${p.last_test.ok ? "ok" : "failed"}</span>` : ""}
|
|
48
|
+
<button class="small" onClick=${() => post(`/api/settings/providers/${p.id}/test`, {}, "test")}>test</button>
|
|
49
|
+
<button class="small" onClick=${() => setProv({ id: p.id, kind: p.kind, label: p.label, model: p.model || "", base_url: p.base_url || "", api_key: "" })}>edit</button>
|
|
50
|
+
<button class="small danger" onClick=${async () => { await fetch(`/api/settings/providers/${p.id}`, { method: "DELETE", headers: { "content-type": "application/json" }, body: "{}" }); load(); }}>remove</button></li>`)}
|
|
51
|
+
${s.providers.length ? "" : html`<li class="muted">none; add one to use the byo_key route</li>`}</ul>
|
|
52
|
+
${prov ? html`<form class="inline" onSubmit=${async (e) => { e.preventDefault(); try { if (prov.id) await api.put(`/api/settings/providers/${prov.id}`, prov); else await api.post("/api/settings/providers", prov); setProv(null); load(); } catch (e2) { setErr(e2.message); } }}>
|
|
53
|
+
<select onChange=${(e) => setProv({ ...prov, kind: e.target.value })}>${["anthropic", "openai_compatible", "gemini"].map((k) => html`<option key=${k} value=${k} selected=${prov.kind === k}>${k}</option>`)}</select>
|
|
54
|
+
<input placeholder="label" value=${prov.label} onInput=${(e) => setProv({ ...prov, label: e.target.value })} />
|
|
55
|
+
<input placeholder="model" value=${prov.model} onInput=${(e) => setProv({ ...prov, model: e.target.value })} />
|
|
56
|
+
<input placeholder="base url (blank for the vendor default; http only on localhost)" value=${prov.base_url} onInput=${(e) => setProv({ ...prov, base_url: e.target.value })} />
|
|
57
|
+
<input type="password" placeholder=${prov.id ? "new key (blank keeps the stored one)" : "api key"} value=${prov.api_key} onInput=${(e) => setProv({ ...prov, api_key: e.target.value })} />
|
|
58
|
+
<button class="primary">save</button><button type="button" onClick=${() => setProv(null)}>cancel</button></form>` : html`<button class="small" onClick=${() => setProv({ id: null, kind: "anthropic", label: "", model: "", base_url: "", api_key: "" })}>+ add</button>`}
|
|
59
|
+
<p class="small muted">Keys live in config.json under your user only, never in the store, never in a log. A read shows the last four characters.</p>
|
|
60
|
+
</div>`}
|
|
61
|
+
<h2>Credits</h2>
|
|
62
|
+
<div class="card">
|
|
63
|
+
${s.hosted ? html`<p class="small muted">Signed in as ${s.email || "you"}. Documents run on the included AI and are paid in credits; the relay runs named operations on the packet the app built, never a free prompt, and never stores packet or reply text.</p>
|
|
64
|
+
<div class="row"><button type="button" onClick=${async () => { setMsg(""); try { const r = await api.get("/api/credits/balance"); setMsg(`balance: ${r.available} available`); await load(); } catch (e2) { setErr(e2.message); } }}>check balance</button>
|
|
65
|
+
${[["starter", "Starter"], ["campaign", "Campaign"], ["season", "Season"]].map(([k, label]) => html`<button type="button" key=${k} onClick=${async () => { setMsg(""); try { const r = await api.post("/api/credits/checkout", { pack: k }); location.href = r.url; } catch (e2) { setErr(e2.message); } }}>buy ${label}</button>`)}</div>
|
|
66
|
+
${s.credits && s.credits.last_balance ? html`<p class="small">${s.credits.last_balance.available} credits available (${s.credits.last_balance.reserved} held), checked ${s.credits.last_balance.at}</p>` : ""}` : html`<p class="small muted">A paid route for people without their own AI subscription. The relay is written and tested but not deployed; nothing here works until it is. The relay runs named operations on the packet the app built, never a free prompt, and never stores packet or reply text.</p>
|
|
67
|
+
<form class="inline" onSubmit=${(e) => { e.preventDefault(); const f = e.target.elements; put({ credits: { relay_url: f.relay.value, ...(f.token.value ? { id_token: f.token.value } : {}) } }); f.token.value = ""; }}>
|
|
68
|
+
<input name="relay" placeholder="relay url (https)" value=${(s.credits && s.credits.relay_url) || ""} />
|
|
69
|
+
<input name="token" type="password" placeholder=${s.credits && s.credits.has_token ? `sign-in token ${s.credits.token} (blank keeps it)` : "sign-in token"} />
|
|
70
|
+
<button class="primary">save</button>
|
|
71
|
+
<button type="button" onClick=${async () => { setMsg(""); try { const r = await api.get("/api/credits/balance"); setMsg(`balance: ${r.available} available`); await load(); } catch (e2) { setErr(e2.message); } }} disabled=${!(s.credits && s.credits.has_token)}>check balance</button>
|
|
72
|
+
${s.credits && s.credits.has_token ? html`<button type="button" class="danger" onClick=${() => put({ credits: { id_token: null } })}>sign out</button>` : ""}
|
|
73
|
+
</form>`}
|
|
74
|
+
${s.credits && s.credits.last_balance ? html`<p class="small">${s.credits.last_balance.available} credits available (${s.credits.last_balance.reserved} held), checked ${s.credits.last_balance.at}</p>` : ""}
|
|
75
|
+
</div>
|
|
76
|
+
<h2>Bullet register</h2>
|
|
77
|
+
<div class="card">
|
|
78
|
+
${[["result_first", "Result first (RAS): the figure leads, the action follows. \"29.3% off annual freight by rebidding 40 lanes.\""], ["action_first", "Action first: the verb leads, the result closes. \"Rebid 40 lanes, taking 29.3% off annual freight.\""], ["posting", "Let the posting decide: verb-led responsibility lines get action first, outcome-led lines get result first; the AI says which in its notes."]].map(([r, label]) => html`<div key=${r}><label><input type="radio" name="register" checked=${(h.bullet_register || "result_first") === r} onChange=${() => hr({ bullet_register: r })} /> ${label}</label></div>`)}
|
|
79
|
+
<p class="small muted">Same facts, same claims, same gate in every register; only the word order moves. Leadership scope always keeps the verb in front of the headcount.</p>
|
|
80
|
+
</div>
|
|
81
|
+
<h2>House rules</h2>
|
|
82
|
+
<div class="card">
|
|
83
|
+
<p class="small muted">Style rules only. Integrity rules (provenance, metrics, tenure, verbs, history) have no switch.</p>
|
|
84
|
+
<table class="cats"><thead><tr><th>rule</th>${KINDS.map((k) => html`<th key=${k}>${k}</th>`)}</tr></thead><tbody>
|
|
85
|
+
${["no_dashes", "style_config"].map((rule) => html`<tr key=${rule}><td>${rule}</td>${KINDS.map((k) => html`<td key=${k}><select onChange=${(e) => setSev(rule, k, e.target.value)}>${["block", "warn", "off"].map((sev) => html`<option key=${sev} value=${sev} selected=${(h[rule][k] || "warn") === sev}>${sev}</option>`)}</select></td>`)}</tr>`)}
|
|
86
|
+
</tbody></table>
|
|
87
|
+
<form class="inline" onSubmit=${(e) => { e.preventDefault(); const v = e.target.elements.allow.value.trim(); if (v) hr({ hyphen_allow: [...h.hyphen_allow, v] }); e.target.reset(); }}>
|
|
88
|
+
<span>allowed hyphen compounds: ${h.hyphen_allow.map((a) => html`<span class="tag" key=${a}>${a} <a href="#/settings" onClick=${(e) => { e.preventDefault(); hr({ hyphen_allow: h.hyphen_allow.filter((x) => x !== a) }); }}>×</a></span> `)}</span>
|
|
89
|
+
<input name="allow" placeholder="cross-functional" /><button>allow</button></form>
|
|
90
|
+
</div>
|
|
91
|
+
<h2>Thresholds</h2>
|
|
92
|
+
<div class="card"><form class="inline" onSubmit=${(e) => { e.preventDefault(); const f = e.target.elements; put({ thresholds: { thankyou_due_h: f.due.value, thankyou_overdue_h: f.overdue.value, register_switch_window_h: f.switch.value, invite_alert_h: f.invite.value, aging_days: f.aging.value, pursue_min: f.pursue.value } }); }}>
|
|
93
|
+
<label>thank-you due h <input name="due" class="narrow" value=${s.thresholds.thankyou_due_h} /></label>
|
|
94
|
+
<label>overdue h <input name="overdue" class="narrow" value=${s.thresholds.thankyou_overdue_h} /></label>
|
|
95
|
+
<label>register switch h <input name="switch" class="narrow" value=${s.thresholds.register_switch_window_h} /></label>
|
|
96
|
+
<label>invite alert h <input name="invite" class="narrow" value=${s.thresholds.invite_alert_h} /></label>
|
|
97
|
+
<label>aging days <input name="aging" class="narrow" value=${s.thresholds.aging_days} /></label>
|
|
98
|
+
<label>pursue floor (fit) <input name="pursue" class="narrow" value=${s.thresholds.pursue_min ?? 6} /></label>
|
|
99
|
+
<button class="primary">save</button></form></div>
|
|
100
|
+
<h2>Data</h2>
|
|
101
|
+
${s.hosted ? html`<div class="card">
|
|
102
|
+
<p class="small muted">Your record, documents, and campaign live in your account here. Export gives you the whole store as one file that opens in the free app on any PC (<span class="mono">gafj restore</span>). Delete removes everything, at once, for good.</p>
|
|
103
|
+
<div class="row"><a class="button" href="/account/export"><button type="button">Export my data</button></a>
|
|
104
|
+
<button type="button" class="danger" onClick=${async () => { if (!confirm("Delete your account and everything in it? Export first if you want a copy. This cannot be undone.")) return; try { await api.post("/account/delete", { confirm: "delete" }); location.href = "/signin"; } catch (e2) { setErr(e2.message); } }}>Delete my account</button>
|
|
105
|
+
<button type="button" onClick=${async () => { await api.post("/auth/signout", {}); location.href = "/signin"; }}>Sign out</button></div>
|
|
106
|
+
</div>` : html`<div class="card">
|
|
107
|
+
<div class="mono small">${s.home}</div>
|
|
108
|
+
<form class="inline" onSubmit=${(e) => { e.preventDefault(); put({ export_dir: e.target.elements.dir.value }); }}><label>export folder <input name="dir" value=${s.export_dir || ""} placeholder="defaults to the data folder" /></label><button>save</button></form>
|
|
109
|
+
<form class="inline" onSubmit=${(e) => { e.preventDefault(); put({ backup_dir: e.target.elements.bdir.value }); }}><label>backup folder <input name="bdir" value=${s.backup_dir || ""} placeholder="e.g. a Google Drive, OneDrive, or Dropbox folder" /></label><button>save</button></form>
|
|
110
|
+
<p class="small muted">Backups are consistent copies, one a day at startup plus any you take by hand, the newest 14 kept. A synced folder is the right place for them. The live store itself stays in the data folder above and must never sit in a synced folder.</p>
|
|
111
|
+
<div class="row"><button onClick=${() => post("/api/backup", {}, "backup written")}>Back up now</button><button onClick=${() => post("/api/restore-test", {}, "restore test")}>Restore test</button>${s.last_backup ? html`<span class="small muted">last: ${s.last_backup.file} (${s.last_backup.by}, ${s.last_backup.at})</span>` : ""}</div>
|
|
112
|
+
<p class="small muted">Startup at login: run <span class="mono">gafj install-startup</span> once from a terminal.</p>
|
|
113
|
+
</div>`}
|
|
114
|
+
</div>`;
|
|
115
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e,n,_,t,o,r,u,l={},i=[],c=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s(e,n){for(var _ in n)e[_]=n[_];return e}function f(e){var n=e.parentNode;n&&n.removeChild(e)}function a(n,_,t){var o,r,u,l={};for(u in _)"key"==u?o=_[u]:"ref"==u?r=_[u]:l[u]=_[u];if(arguments.length>2&&(l.children=arguments.length>3?e.call(arguments,2):t),"function"==typeof n&&null!=n.defaultProps)for(u in n.defaultProps)void 0===l[u]&&(l[u]=n.defaultProps[u]);return p(n,l,o,r,null)}function p(e,t,o,r,u){var l={type:e,props:t,key:o,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==u?++_:u};return null!=n.vnode&&n.vnode(l),l}function h(e){return e.children}function d(e,n){this.props=e,this.context=n}function v(e,n){if(null==n)return e.__?v(e.__,e.__.__k.indexOf(e)+1):null;for(var _;n<e.__k.length;n++)if(null!=(_=e.__k[n])&&null!=_.__e)return _.__e;return"function"==typeof e.type?v(e):null}function y(e){var n,_;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,n=0;n<e.__k.length;n++)if(null!=(_=e.__k[n])&&null!=_.__e){e.__e=e.__c.base=_.__e;break}return y(e)}}function m(e){(!e.__d&&(e.__d=!0)&&t.push(e)&&!g.__r++||r!==n.debounceRendering)&&((r=n.debounceRendering)||o)(g)}function g(){for(var e;g.__r=t.length;)e=t.sort(function(e,n){return e.__v.__b-n.__v.__b}),t=[],e.some(function(e){var n,_,t,o,r,u;e.__d&&(r=(o=(n=e).__v).__e,(u=n.__P)&&(_=[],(t=s({},o)).__v=o.__v+1,P(u,o,t,n.__n,void 0!==u.ownerSVGElement,null!=o.__h?[r]:null,_,null==r?v(o):r,o.__h),D(_,o),o.__e!=r&&y(o)))})}function k(e,n,_,t,o,r,u,c,s,f){var a,d,y,m,g,k,x,H=t&&t.__k||i,E=H.length;for(_.__k=[],a=0;a<n.length;a++)if(null!=(m=_.__k[a]=null==(m=n[a])||"boolean"==typeof m?null:"string"==typeof m||"number"==typeof m||"bigint"==typeof m?p(null,m,null,null,m):Array.isArray(m)?p(h,{children:m},null,null,null):m.__b>0?p(m.type,m.props,m.key,null,m.__v):m)){if(m.__=_,m.__b=_.__b+1,null===(y=H[a])||y&&m.key==y.key&&m.type===y.type)H[a]=void 0;else for(d=0;d<E;d++){if((y=H[d])&&m.key==y.key&&m.type===y.type){H[d]=void 0;break}y=null}P(e,m,y=y||l,o,r,u,c,s,f),g=m.__e,(d=m.ref)&&y.ref!=d&&(x||(x=[]),y.ref&&x.push(y.ref,null,m),x.push(d,m.__c||g,m)),null!=g?(null==k&&(k=g),"function"==typeof m.type&&null!=m.__k&&m.__k===y.__k?m.__d=s=b(m,s,e):s=C(e,m,y,H,g,s),f||"option"!==_.type?"function"==typeof _.type&&(_.__d=s):e.value=""):s&&y.__e==s&&s.parentNode!=e&&(s=v(y))}for(_.__e=k,a=E;a--;)null!=H[a]&&("function"==typeof _.type&&null!=H[a].__e&&H[a].__e==_.__d&&(_.__d=v(t,a+1)),U(H[a],H[a]));if(x)for(a=0;a<x.length;a++)T(x[a],x[++a],x[++a])}function b(e,n,_){var t,o;for(t=0;t<e.__k.length;t++)(o=e.__k[t])&&(o.__=e,n="function"==typeof o.type?b(o,n,_):C(_,o,o,e.__k,o.__e,n));return n}function C(e,n,_,t,o,r){var u,l,i;if(void 0!==n.__d)u=n.__d,n.__d=void 0;else if(null==_||o!=r||null==o.parentNode)e:if(null==r||r.parentNode!==e)e.appendChild(o),u=null;else{for(l=r,i=0;(l=l.nextSibling)&&i<t.length;i+=2)if(l==o)break e;e.insertBefore(o,r),u=r}return void 0!==u?u:o.nextSibling}function x(e,n,_){"-"===n[0]?e.setProperty(n,_):e[n]=null==_?"":"number"!=typeof _||c.test(n)?_:_+"px"}function H(e,n,_,t,o){var r;e:if("style"===n)if("string"==typeof _)e.style.cssText=_;else{if("string"==typeof t&&(e.style.cssText=t=""),t)for(n in t)_&&n in _||x(e.style,n,"");if(_)for(n in _)t&&_[n]===t[n]||x(e.style,n,_[n])}else if("o"===n[0]&&"n"===n[1])r=n!==(n=n.replace(/Capture$/,"")),n=n.toLowerCase()in e?n.toLowerCase().slice(2):n.slice(2),e.l||(e.l={}),e.l[n+r]=_,_?t||e.addEventListener(n,r?S:E,r):e.removeEventListener(n,r?S:E,r);else if("dangerouslySetInnerHTML"!==n){if(o)n=n.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if("href"!==n&&"list"!==n&&"form"!==n&&"tabIndex"!==n&&"download"!==n&&n in e)try{e[n]=null==_?"":_;break e}catch(e){}"function"==typeof _||(null!=_&&(!1!==_||"a"===n[0]&&"r"===n[1])?e.setAttribute(n,_):e.removeAttribute(n))}}function E(e){this.l[e.type+!1](n.event?n.event(e):e)}function S(e){this.l[e.type+!0](n.event?n.event(e):e)}function P(e,_,t,o,r,u,l,i,c){var f,a,p,v,y,m,g,b,C,x,H,E=_.type;if(void 0!==_.constructor)return null;null!=t.__h&&(c=t.__h,i=_.__e=t.__e,_.__h=null,u=[i]),(f=n.__b)&&f(_);try{e:if("function"==typeof E){if(b=_.props,C=(f=E.contextType)&&o[f.__c],x=f?C?C.props.value:f.__:o,t.__c?g=(a=_.__c=t.__c).__=a.__E:("prototype"in E&&E.prototype.render?_.__c=a=new E(b,x):(_.__c=a=new d(b,x),a.constructor=E,a.render=A),C&&C.sub(a),a.props=b,a.state||(a.state={}),a.context=x,a.__n=o,p=a.__d=!0,a.__h=[]),null==a.__s&&(a.__s=a.state),null!=E.getDerivedStateFromProps&&(a.__s==a.state&&(a.__s=s({},a.__s)),s(a.__s,E.getDerivedStateFromProps(b,a.__s))),v=a.props,y=a.state,p)null==E.getDerivedStateFromProps&&null!=a.componentWillMount&&a.componentWillMount(),null!=a.componentDidMount&&a.__h.push(a.componentDidMount);else{if(null==E.getDerivedStateFromProps&&b!==v&&null!=a.componentWillReceiveProps&&a.componentWillReceiveProps(b,x),!a.__e&&null!=a.shouldComponentUpdate&&!1===a.shouldComponentUpdate(b,a.__s,x)||_.__v===t.__v){a.props=b,a.state=a.__s,_.__v!==t.__v&&(a.__d=!1),a.__v=_,_.__e=t.__e,_.__k=t.__k,_.__k.forEach(function(e){e&&(e.__=_)}),a.__h.length&&l.push(a);break e}null!=a.componentWillUpdate&&a.componentWillUpdate(b,a.__s,x),null!=a.componentDidUpdate&&a.__h.push(function(){a.componentDidUpdate(v,y,m)})}a.context=x,a.props=b,a.state=a.__s,(f=n.__r)&&f(_),a.__d=!1,a.__v=_,a.__P=e,f=a.render(a.props,a.state,a.context),a.state=a.__s,null!=a.getChildContext&&(o=s(s({},o),a.getChildContext())),p||null==a.getSnapshotBeforeUpdate||(m=a.getSnapshotBeforeUpdate(v,y)),H=null!=f&&f.type===h&&null==f.key?f.props.children:f,k(e,Array.isArray(H)?H:[H],_,t,o,r,u,l,i,c),a.base=_.__e,_.__h=null,a.__h.length&&l.push(a),g&&(a.__E=a.__=null),a.__e=!1}else null==u&&_.__v===t.__v?(_.__k=t.__k,_.__e=t.__e):_.__e=w(t.__e,_,t,o,r,u,l,c);(f=n.diffed)&&f(_)}catch(e){_.__v=null,(c||null!=u)&&(_.__e=i,_.__h=!!c,u[u.indexOf(i)]=null),n.__e(e,_,t)}}function D(e,_){n.__c&&n.__c(_,e),e.some(function(_){try{e=_.__h,_.__h=[],e.some(function(e){e.call(_)})}catch(e){n.__e(e,_.__v)}})}function w(n,_,t,o,r,u,i,c){var s,a,p,h=t.props,d=_.props,y=_.type,m=0;if("svg"===y&&(r=!0),null!=u)for(;m<u.length;m++)if((s=u[m])&&(s===n||(y?s.localName==y:3==s.nodeType))){n=s,u[m]=null;break}if(null==n){if(null===y)return document.createTextNode(d);n=r?document.createElementNS("http://www.w3.org/2000/svg",y):document.createElement(y,d.is&&d),u=null,c=!1}if(null===y)h===d||c&&n.data===d||(n.data=d);else{if(u=u&&e.call(n.childNodes),a=(h=t.props||l).dangerouslySetInnerHTML,p=d.dangerouslySetInnerHTML,!c){if(null!=u)for(h={},m=0;m<n.attributes.length;m++)h[n.attributes[m].name]=n.attributes[m].value;(p||a)&&(p&&(a&&p.__html==a.__html||p.__html===n.innerHTML)||(n.innerHTML=p&&p.__html||""))}if(function(e,n,_,t,o){var r;for(r in _)"children"===r||"key"===r||r in n||H(e,r,null,_[r],t);for(r in n)o&&"function"!=typeof n[r]||"children"===r||"key"===r||"value"===r||"checked"===r||_[r]===n[r]||H(e,r,n[r],_[r],t)}(n,d,h,r,c),p)_.__k=[];else if(m=_.props.children,k(n,Array.isArray(m)?m:[m],_,t,o,r&&"foreignObject"!==y,u,i,u?u[0]:t.__k&&v(t,0),c),null!=u)for(m=u.length;m--;)null!=u[m]&&f(u[m]);c||("value"in d&&void 0!==(m=d.value)&&(m!==n.value||"progress"===y&&!m)&&H(n,"value",m,h.value,!1),"checked"in d&&void 0!==(m=d.checked)&&m!==n.checked&&H(n,"checked",m,h.checked,!1))}return n}function T(e,_,t){try{"function"==typeof e?e(_):e.current=_}catch(e){n.__e(e,t)}}function U(e,_,t){var o,r;if(n.unmount&&n.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||T(o,null,_)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){n.__e(e,_)}o.base=o.__P=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&U(o[r],_,"function"!=typeof e.type);t||null==e.__e||f(e.__e),e.__e=e.__d=void 0}function A(e,n,_){return this.constructor(e,_)}function M(_,t,o){var r,u,i;n.__&&n.__(_,t),u=(r="function"==typeof o)?null:o&&o.__k||t.__k,i=[],P(t,_=(!r&&o||t).__k=a(h,null,[_]),u||l,l,void 0!==t.ownerSVGElement,!r&&o?[o]:u?null:t.firstChild?e.call(t.childNodes):null,i,!r&&o?o:u?u.__e:t.firstChild,r),D(i,_)}function F(e,n){var _={__c:n="__cC"+u++,__:e,Consumer:function(e,n){return e.children(n)},Provider:function(e){var _,t;return this.getChildContext||(_=[],(t={})[n]=this,this.getChildContext=function(){return t},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&_.some(m)},this.sub=function(e){_.push(e);var n=e.componentWillUnmount;e.componentWillUnmount=function(){_.splice(_.indexOf(e),1),n&&n.call(e)}}),e.children}};return _.Provider.__=_.Consumer.contextType=_}e=i.slice,n={__e:function(e,n){for(var _,t,o;n=n.__;)if((_=n.__c)&&!_.__)try{if((t=_.constructor)&&null!=t.getDerivedStateFromError&&(_.setState(t.getDerivedStateFromError(e)),o=_.__d),null!=_.componentDidCatch&&(_.componentDidCatch(e),o=_.__d),o)return _.__E=_}catch(n){e=n}throw e}},_=0,d.prototype.setState=function(e,n){var _;_=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s({},this.state),"function"==typeof e&&(e=e(s({},_),this.props)),e&&s(_,e),null!=e&&this.__v&&(n&&this.__h.push(n),m(this))},d.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),m(this))},d.prototype.render=h,t=[],o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,g.__r=0,u=0;var L,N,W,R=0,I=[],O=n.__b,V=n.__r,q=n.diffed,B=n.__c,$=n.unmount;function j(e,_){n.__h&&n.__h(N,e,R||_),R=0;var t=N.__H||(N.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({}),t.__[e]}function G(e){return R=1,z(ie,e)}function z(e,n,_){var t=j(L++,2);return t.t=e,t.__c||(t.__=[_?_(n):ie(void 0,n),function(e){var n=t.t(t.__[0],e);t.__[0]!==n&&(t.__=[n,t.__[1]],t.__c.setState({}))}],t.__c=N),t.__}function J(e,_){var t=j(L++,3);!n.__s&&le(t.__H,_)&&(t.__=e,t.__H=_,N.__H.__h.push(t))}function K(e,_){var t=j(L++,4);!n.__s&&le(t.__H,_)&&(t.__=e,t.__H=_,N.__h.push(t))}function Q(e){return R=5,Y(function(){return{current:e}},[])}function X(e,n,_){R=6,K(function(){"function"==typeof e?e(n()):e&&(e.current=n())},null==_?_:_.concat(e))}function Y(e,n){var _=j(L++,7);return le(_.__H,n)&&(_.__=e(),_.__H=n,_.__h=e),_.__}function Z(e,n){return R=8,Y(function(){return e},n)}function ee(e){var n=N.context[e.__c],_=j(L++,9);return _.c=e,n?(null==_.__&&(_.__=!0,n.sub(N)),n.props.value):e.__}function ne(e,_){n.useDebugValue&&n.useDebugValue(_?_(e):e)}function _e(e){var n=j(L++,10),_=G();return n.__=e,N.componentDidCatch||(N.componentDidCatch=function(e){n.__&&n.__(e),_[1](e)}),[_[0],function(){_[1](void 0)}]}function te(){I.forEach(function(e){if(e.__P)try{e.__H.__h.forEach(re),e.__H.__h.forEach(ue),e.__H.__h=[]}catch(_){e.__H.__h=[],n.__e(_,e.__v)}}),I=[]}n.__b=function(e){N=null,O&&O(e)},n.__r=function(e){V&&V(e),L=0;var n=(N=e.__c).__H;n&&(n.__h.forEach(re),n.__h.forEach(ue),n.__h=[])},n.diffed=function(e){q&&q(e);var _=e.__c;_&&_.__H&&_.__H.__h.length&&(1!==I.push(_)&&W===n.requestAnimationFrame||((W=n.requestAnimationFrame)||function(e){var n,_=function(){clearTimeout(t),oe&&cancelAnimationFrame(n),setTimeout(e)},t=setTimeout(_,100);oe&&(n=requestAnimationFrame(_))})(te)),N=void 0},n.__c=function(e,_){_.some(function(e){try{e.__h.forEach(re),e.__h=e.__h.filter(function(e){return!e.__||ue(e)})}catch(t){_.some(function(e){e.__h&&(e.__h=[])}),_=[],n.__e(t,e.__v)}}),B&&B(e,_)},n.unmount=function(e){$&&$(e);var _=e.__c;if(_&&_.__H)try{_.__H.__.forEach(re)}catch(e){n.__e(e,_.__v)}};var oe="function"==typeof requestAnimationFrame;function re(e){var n=N;"function"==typeof e.__c&&e.__c(),N=n}function ue(e){var n=N;e.__c=e.__(),N=n}function le(e,n){return!e||e.length!==n.length||n.some(function(n,_){return n!==e[_]})}function ie(e,n){return"function"==typeof n?n(e):n}var ce=function(e,n,_,t){var o;n[0]=0;for(var r=1;r<n.length;r++){var u=n[r++],l=n[r]?(n[0]|=u?1:2,_[n[r++]]):n[++r];3===u?t[0]=l:4===u?t[1]=Object.assign(t[1]||{},l):5===u?(t[1]=t[1]||{})[n[++r]]=l:6===u?t[1][n[++r]]+=l+"":u?(o=e.apply(l,ce(e,l,_,["",null])),t.push(o),l[0]?n[0]|=2:(n[r-2]=0,n[r]=o)):t.push(l)}return t},se=new Map,fe=function(e){var n=se.get(this);return n||(n=new Map,se.set(this,n)),(n=ce(this,n.get(e)||(n.set(e,n=function(e){for(var n,_,t=1,o="",r="",u=[0],l=function(e){1===t&&(e||(o=o.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?u.push(0,e,o):3===t&&(e||o)?(u.push(3,e,o),t=2):2===t&&"..."===o&&e?u.push(4,e,0):2===t&&o&&!e?u.push(5,0,!0,o):t>=5&&((o||!e&&5===t)&&(u.push(t,0,o,_),t=6),e&&(u.push(t,e,0,_),t=6)),o=""},i=0;i<e.length;i++){i&&(1===t&&l(),l(i));for(var c=0;c<e[i].length;c++)n=e[i][c],1===t?"<"===n?(l(),u=[u],t=3):o+=n:4===t?"--"===o&&">"===n?(t=1,o=""):o=n+o[0]:r?n===r?r="":o+=n:'"'===n||"'"===n?r=n:">"===n?(l(),t=1):t&&("="===n?(t=5,_=o,o=""):"/"===n&&(t<5||">"===e[i][c+1])?(l(),3===t&&(u=u[0]),t=u,(u=u[0]).push(2,0,t),t=0):" "===n||"\t"===n||"\n"===n||"\r"===n?(l(),t=2):o+=n),3===t&&"!--"===o&&(t=4,u=u[0])}return l(),u}(e)),n),arguments,[])).length>1?n:n[0]}.bind(a);export{a as h,fe as html,M as render,d as Component,F as createContext,G as useState,z as useReducer,J as useEffect,K as useLayoutEffect,Q as useRef,X as useImperativeHandle,Y as useMemo,Z as useCallback,ee as useContext,ne as useDebugValue,_e as useErrorBoundary};
|