feat: Vestige v2.0.0 "Cognitive Leap" — 3D dashboard, HyDE search, WebSocket events

The biggest release in Vestige history. Complete visual and cognitive overhaul.

Dashboard:
- SvelteKit 2 + Three.js 3D neural visualization at localhost:3927/dashboard
- 7 interactive pages: Graph, Memories, Timeline, Feed, Explore, Intentions, Stats
- WebSocket event bus with 16 event types, real-time 3D animations
- Bloom post-processing, GPU instanced rendering, force-directed layout
- Dream visualization mode, FSRS retention curves, command palette (Cmd+K)
- Keyboard shortcuts, responsive mobile layout, PWA installable
- Single binary deployment via include_dir! (22MB)

Engine:
- HyDE query expansion (intent classification + 3-5 semantic variants + centroid)
- fastembed 5.11 with optional Nomic v2 MoE + Qwen3 reranker + Metal GPU
- Emotional memory module (#29)
- Criterion benchmark suite

Backend:
- Axum WebSocket at /ws with heartbeat + event broadcast
- 7 new REST endpoints for cognitive operations
- Event emission from MCP tools via shared broadcast channel
- CORS for SvelteKit dev mode

Distribution:
- GitHub issue templates (bug report, feature request)
- CHANGELOG with comprehensive v2.0 release notes
- README updated with dashboard docs, architecture diagram, comparison table

734 tests passing, zero warnings, 22MB release binary.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sam Valladares 2026-02-22 03:07:25 -06:00
parent 26cee040a5
commit c2d28f3433
321 changed files with 32695 additions and 4727 deletions

View file

@ -0,0 +1,253 @@
{
"../../node_modules/.pnpm/@sveltejs+kit@2.53.0_@sveltejs+vite-plugin-svelte@5.1.1_svelte@5.53.2_vite@6.4.1_@types_da6f945e4bdc5861c12f795ef3b5ca26/node_modules/@sveltejs/kit/src/runtime/app/server/remote/index.js": {
"file": "remote-entry.js",
"name": "remote-entry",
"src": "../../node_modules/.pnpm/@sveltejs+kit@2.53.0_@sveltejs+vite-plugin-svelte@5.1.1_svelte@5.53.2_vite@6.4.1_@types_da6f945e4bdc5861c12f795ef3b5ca26/node_modules/@sveltejs/kit/src/runtime/app/server/remote/index.js",
"isEntry": true,
"imports": [
"_shared.js",
"_utils.js",
"_server.js",
"_environment.js"
]
},
"../../node_modules/.pnpm/@sveltejs+kit@2.53.0_@sveltejs+vite-plugin-svelte@5.1.1_svelte@5.53.2_vite@6.4.1_@types_da6f945e4bdc5861c12f795ef3b5ca26/node_modules/@sveltejs/kit/src/runtime/components/svelte-5/error.svelte": {
"file": "entries/fallbacks/error.svelte.js",
"name": "entries/fallbacks/error.svelte",
"src": "../../node_modules/.pnpm/@sveltejs+kit@2.53.0_@sveltejs+vite-plugin-svelte@5.1.1_svelte@5.53.2_vite@6.4.1_@types_da6f945e4bdc5861c12f795ef3b5ca26/node_modules/@sveltejs/kit/src/runtime/components/svelte-5/error.svelte",
"isEntry": true,
"imports": [
"_index.js",
"_state.svelte.js",
"_exports.js",
"_utils2.js",
"_index2.js",
"_root.js"
]
},
"../../node_modules/.pnpm/@sveltejs+kit@2.53.0_@sveltejs+vite-plugin-svelte@5.1.1_svelte@5.53.2_vite@6.4.1_@types_da6f945e4bdc5861c12f795ef3b5ca26/node_modules/@sveltejs/kit/src/runtime/server/index.js": {
"file": "index.js",
"name": "index",
"src": "../../node_modules/.pnpm/@sveltejs+kit@2.53.0_@sveltejs+vite-plugin-svelte@5.1.1_svelte@5.53.2_vite@6.4.1_@types_da6f945e4bdc5861c12f795ef3b5ca26/node_modules/@sveltejs/kit/src/runtime/server/index.js",
"isEntry": true,
"imports": [
"_utils.js",
"_server.js",
"_shared.js",
"_index.js",
"_exports.js",
"_utils2.js",
"_index2.js",
"_internal.js"
]
},
".svelte-kit/generated/server/internal.js": {
"file": "internal.js",
"name": "internal",
"src": ".svelte-kit/generated/server/internal.js",
"isEntry": true,
"imports": [
"_root.js",
"_environment.js",
"_server.js",
"_internal.js"
]
},
"_api.js": {
"file": "chunks/api.js",
"name": "api"
},
"_environment.js": {
"file": "chunks/environment.js",
"name": "environment"
},
"_exports.js": {
"file": "chunks/exports.js",
"name": "exports"
},
"_index.js": {
"file": "chunks/index.js",
"name": "index",
"imports": [
"_utils.js"
]
},
"_index2.js": {
"file": "chunks/index2.js",
"name": "index",
"imports": [
"_index.js"
]
},
"_index3.js": {
"file": "chunks/index3.js",
"name": "index"
},
"_internal.js": {
"file": "chunks/internal.js",
"name": "internal",
"imports": [
"_root.js",
"_environment.js",
"_server.js"
]
},
"_root.js": {
"file": "chunks/root.js",
"name": "root",
"imports": [
"_index.js"
]
},
"_server.js": {
"file": "chunks/server.js",
"name": "server"
},
"_shared.js": {
"file": "chunks/shared.js",
"name": "shared",
"imports": [
"_utils2.js",
"_utils.js"
]
},
"_state.svelte.js": {
"file": "chunks/state.svelte.js",
"name": "state.svelte",
"imports": [
"_index.js",
"_exports.js",
"_root.js"
]
},
"_utils.js": {
"file": "chunks/utils.js",
"name": "utils"
},
"_utils2.js": {
"file": "chunks/utils2.js",
"name": "utils"
},
"_websocket.js": {
"file": "chunks/websocket.js",
"name": "websocket",
"imports": [
"_index2.js"
]
},
"src/routes/(app)/+layout.svelte": {
"file": "entries/pages/(app)/_layout.svelte.js",
"name": "entries/pages/(app)/_layout.svelte",
"src": "src/routes/(app)/+layout.svelte",
"isEntry": true
},
"src/routes/(app)/explore/+page.svelte": {
"file": "entries/pages/(app)/explore/_page.svelte.js",
"name": "entries/pages/(app)/explore/_page.svelte",
"src": "src/routes/(app)/explore/+page.svelte",
"isEntry": true,
"imports": [
"_index.js"
]
},
"src/routes/(app)/feed/+page.svelte": {
"file": "entries/pages/(app)/feed/_page.svelte.js",
"name": "entries/pages/(app)/feed/_page.svelte",
"src": "src/routes/(app)/feed/+page.svelte",
"isEntry": true,
"imports": [
"_index.js",
"_websocket.js",
"_index3.js"
]
},
"src/routes/(app)/graph/+page.svelte": {
"file": "entries/pages/(app)/graph/_page.svelte.js",
"name": "entries/pages/(app)/graph/_page.svelte",
"src": "src/routes/(app)/graph/+page.svelte",
"isEntry": true,
"imports": [
"_index.js",
"_api.js",
"_websocket.js"
]
},
"src/routes/(app)/intentions/+page.svelte": {
"file": "entries/pages/(app)/intentions/_page.svelte.js",
"name": "entries/pages/(app)/intentions/_page.svelte",
"src": "src/routes/(app)/intentions/+page.svelte",
"isEntry": true,
"imports": [
"_index.js"
]
},
"src/routes/(app)/memories/+page.svelte": {
"file": "entries/pages/(app)/memories/_page.svelte.js",
"name": "entries/pages/(app)/memories/_page.svelte",
"src": "src/routes/(app)/memories/+page.svelte",
"isEntry": true,
"imports": [
"_index.js",
"_api.js",
"_index3.js"
]
},
"src/routes/(app)/settings/+page.svelte": {
"file": "entries/pages/(app)/settings/_page.svelte.js",
"name": "entries/pages/(app)/settings/_page.svelte",
"src": "src/routes/(app)/settings/+page.svelte",
"isEntry": true,
"imports": [
"_index.js",
"_websocket.js"
]
},
"src/routes/(app)/stats/+page.svelte": {
"file": "entries/pages/(app)/stats/_page.svelte.js",
"name": "entries/pages/(app)/stats/_page.svelte",
"src": "src/routes/(app)/stats/+page.svelte",
"isEntry": true,
"imports": [
"_index.js"
]
},
"src/routes/(app)/timeline/+page.svelte": {
"file": "entries/pages/(app)/timeline/_page.svelte.js",
"name": "entries/pages/(app)/timeline/_page.svelte",
"src": "src/routes/(app)/timeline/+page.svelte",
"isEntry": true,
"imports": [
"_index.js",
"_api.js",
"_index3.js"
]
},
"src/routes/+layout.svelte": {
"file": "entries/pages/_layout.svelte.js",
"name": "entries/pages/_layout.svelte",
"src": "src/routes/+layout.svelte",
"isEntry": true,
"imports": [
"_index.js",
"_exports.js",
"_utils2.js",
"_root.js",
"_state.svelte.js",
"_server.js",
"_websocket.js"
],
"css": [
"_app/immutable/assets/_layout.CWCL9vmt.css"
]
},
"src/routes/+page.svelte": {
"file": "entries/pages/_page.svelte.js",
"name": "entries/pages/_page.svelte",
"src": "src/routes/+page.svelte",
"isEntry": true,
"imports": [
"_index.js",
"_websocket.js"
]
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,54 @@
const BASE = "/api";
async function fetcher(path, options) {
const res = await fetch(`${BASE}${path}`, {
headers: { "Content-Type": "application/json" },
...options
});
if (!res.ok) throw new Error(`API ${res.status}: ${res.statusText}`);
return res.json();
}
const api = {
// Memories
memories: {
list: (params) => {
const qs = params ? "?" + new URLSearchParams(params).toString() : "";
return fetcher(`/memories${qs}`);
},
get: (id) => fetcher(`/memories/${id}`),
delete: (id) => fetcher(`/memories/${id}`, { method: "DELETE" }),
promote: (id) => fetcher(`/memories/${id}/promote`, { method: "POST" }),
demote: (id) => fetcher(`/memories/${id}/demote`, { method: "POST" })
},
// Search
search: (q, limit = 20) => fetcher(`/search?q=${encodeURIComponent(q)}&limit=${limit}`),
// Stats & Health
stats: () => fetcher("/stats"),
health: () => fetcher("/health"),
// Timeline
timeline: (days = 7, limit = 200) => fetcher(`/timeline?days=${days}&limit=${limit}`),
// Graph
graph: (params) => {
const qs = params ? "?" + new URLSearchParams(
Object.entries(params).filter(([, v]) => v !== void 0).map(([k, v]) => [k, String(v)])
).toString() : "";
return fetcher(`/graph${qs}`);
},
// Cognitive operations
dream: () => fetcher("/dream", { method: "POST" }),
explore: (fromId, action = "associations", toId, limit = 10) => fetcher("/explore", {
method: "POST",
body: JSON.stringify({ from_id: fromId, action, to_id: toId, limit })
}),
predict: () => fetcher("/predict", { method: "POST" }),
importance: (content) => fetcher("/importance", {
method: "POST",
body: JSON.stringify({ content })
}),
consolidate: () => fetcher("/consolidate", { method: "POST" }),
retentionDistribution: () => fetcher("/retention-distribution"),
// Intentions
intentions: (status = "active") => fetcher(`/intentions?status=${status}`)
};
export {
api as a
};

View file

@ -0,0 +1,11 @@
let prerendering = false;
function set_building() {
}
function set_prerendering() {
prerendering = true;
}
export {
set_prerendering as a,
prerendering as p,
set_building as s
};

View file

@ -0,0 +1,174 @@
const SCHEME = /^[a-z][a-z\d+\-.]+:/i;
const internal = new URL("sveltekit-internal://");
function resolve(base, path) {
if (path[0] === "/" && path[1] === "/") return path;
let url = new URL(base, internal);
url = new URL(path, url);
return url.protocol === internal.protocol ? url.pathname + url.search + url.hash : url.href;
}
function normalize_path(path, trailing_slash) {
if (path === "/" || trailing_slash === "ignore") return path;
if (trailing_slash === "never") {
return path.endsWith("/") ? path.slice(0, -1) : path;
} else if (trailing_slash === "always" && !path.endsWith("/")) {
return path + "/";
}
return path;
}
function decode_pathname(pathname) {
return pathname.split("%25").map(decodeURI).join("%25");
}
function decode_params(params) {
for (const key in params) {
params[key] = decodeURIComponent(params[key]);
}
return params;
}
function make_trackable(url, callback, search_params_callback, allow_hash = false) {
const tracked = new URL(url);
Object.defineProperty(tracked, "searchParams", {
value: new Proxy(tracked.searchParams, {
get(obj, key) {
if (key === "get" || key === "getAll" || key === "has") {
return (param, ...rest) => {
search_params_callback(param);
return obj[key](param, ...rest);
};
}
callback();
const value = Reflect.get(obj, key);
return typeof value === "function" ? value.bind(obj) : value;
}
}),
enumerable: true,
configurable: true
});
const tracked_url_properties = ["href", "pathname", "search", "toString", "toJSON"];
if (allow_hash) tracked_url_properties.push("hash");
for (const property of tracked_url_properties) {
Object.defineProperty(tracked, property, {
get() {
callback();
return url[property];
},
enumerable: true,
configurable: true
});
}
{
tracked[Symbol.for("nodejs.util.inspect.custom")] = (depth, opts, inspect) => {
return inspect(url, opts);
};
tracked.searchParams[Symbol.for("nodejs.util.inspect.custom")] = (depth, opts, inspect) => {
return inspect(url.searchParams, opts);
};
}
if (!allow_hash) {
disable_hash(tracked);
}
return tracked;
}
function disable_hash(url) {
allow_nodejs_console_log(url);
Object.defineProperty(url, "hash", {
get() {
throw new Error(
"Cannot access event.url.hash. Consider using `page.url.hash` inside a component instead"
);
}
});
}
function disable_search(url) {
allow_nodejs_console_log(url);
for (const property of ["search", "searchParams"]) {
Object.defineProperty(url, property, {
get() {
throw new Error(`Cannot access url.${property} on a page with prerendering enabled`);
}
});
}
}
function allow_nodejs_console_log(url) {
{
url[Symbol.for("nodejs.util.inspect.custom")] = (depth, opts, inspect) => {
return inspect(new URL(url), opts);
};
}
}
function validator(expected) {
function validate(module, file) {
if (!module) return;
for (const key in module) {
if (key[0] === "_" || expected.has(key)) continue;
const values = [...expected.values()];
const hint = hint_for_supported_files(key, file?.slice(file.lastIndexOf("."))) ?? `valid exports are ${values.join(", ")}, or anything with a '_' prefix`;
throw new Error(`Invalid export '${key}'${file ? ` in ${file}` : ""} (${hint})`);
}
}
return validate;
}
function hint_for_supported_files(key, ext = ".js") {
const supported_files = [];
if (valid_layout_exports.has(key)) {
supported_files.push(`+layout${ext}`);
}
if (valid_page_exports.has(key)) {
supported_files.push(`+page${ext}`);
}
if (valid_layout_server_exports.has(key)) {
supported_files.push(`+layout.server${ext}`);
}
if (valid_page_server_exports.has(key)) {
supported_files.push(`+page.server${ext}`);
}
if (valid_server_exports.has(key)) {
supported_files.push(`+server${ext}`);
}
if (supported_files.length > 0) {
return `'${key}' is a valid export in ${supported_files.slice(0, -1).join(", ")}${supported_files.length > 1 ? " or " : ""}${supported_files.at(-1)}`;
}
}
const valid_layout_exports = /* @__PURE__ */ new Set([
"load",
"prerender",
"csr",
"ssr",
"trailingSlash",
"config"
]);
const valid_page_exports = /* @__PURE__ */ new Set([...valid_layout_exports, "entries"]);
const valid_layout_server_exports = /* @__PURE__ */ new Set([...valid_layout_exports]);
const valid_page_server_exports = /* @__PURE__ */ new Set([...valid_layout_server_exports, "actions", "entries"]);
const valid_server_exports = /* @__PURE__ */ new Set([
"GET",
"POST",
"PATCH",
"PUT",
"DELETE",
"OPTIONS",
"HEAD",
"fallback",
"prerender",
"trailingSlash",
"config",
"entries"
]);
const validate_layout_exports = validator(valid_layout_exports);
const validate_page_exports = validator(valid_page_exports);
const validate_layout_server_exports = validator(valid_layout_server_exports);
const validate_page_server_exports = validator(valid_page_server_exports);
const validate_server_exports = validator(valid_server_exports);
export {
SCHEME as S,
decode_params as a,
validate_layout_exports as b,
validate_page_server_exports as c,
disable_search as d,
validate_page_exports as e,
decode_pathname as f,
validate_server_exports as g,
make_trackable as m,
normalize_path as n,
resolve as r,
validate_layout_server_exports as v
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,107 @@
import { n as noop, ae as safe_not_equal, af as subscribe_to_store, ag as run_all } from "./index.js";
const subscriber_queue = [];
function readable(value, start) {
return {
subscribe: writable(value, start).subscribe
};
}
function writable(value, start = noop) {
let stop = null;
const subscribers = /* @__PURE__ */ new Set();
function set(new_value) {
if (safe_not_equal(value, new_value)) {
value = new_value;
if (stop) {
const run_queue = !subscriber_queue.length;
for (const subscriber of subscribers) {
subscriber[1]();
subscriber_queue.push(subscriber, value);
}
if (run_queue) {
for (let i = 0; i < subscriber_queue.length; i += 2) {
subscriber_queue[i][0](subscriber_queue[i + 1]);
}
subscriber_queue.length = 0;
}
}
}
}
function update(fn) {
set(fn(
/** @type {T} */
value
));
}
function subscribe(run, invalidate = noop) {
const subscriber = [run, invalidate];
subscribers.add(subscriber);
if (subscribers.size === 1) {
stop = start(set, update) || noop;
}
run(
/** @type {T} */
value
);
return () => {
subscribers.delete(subscriber);
if (subscribers.size === 0 && stop) {
stop();
stop = null;
}
};
}
return { set, update, subscribe };
}
function derived(stores, fn, initial_value) {
const single = !Array.isArray(stores);
const stores_array = single ? [stores] : stores;
if (!stores_array.every(Boolean)) {
throw new Error("derived() expects stores as input, got a falsy value");
}
const auto = fn.length < 2;
return readable(initial_value, (set, update) => {
let started = false;
const values = [];
let pending = 0;
let cleanup = noop;
const sync = () => {
if (pending) {
return;
}
cleanup();
const result = fn(single ? values[0] : values, set, update);
if (auto) {
set(result);
} else {
cleanup = typeof result === "function" ? result : noop;
}
};
const unsubscribers = stores_array.map(
(store, i) => subscribe_to_store(
store,
(value) => {
values[i] = value;
pending &= ~(1 << i);
if (started) {
sync();
}
},
() => {
pending |= 1 << i;
}
)
);
started = true;
sync();
return function stop() {
run_all(unsubscribers);
cleanup();
started = false;
};
});
}
export {
derived as d,
readable as r,
writable as w
};

View file

@ -0,0 +1,35 @@
const NODE_TYPE_COLORS = {
fact: "#3b82f6",
// blue
concept: "#8b5cf6",
// purple
event: "#f59e0b",
// amber
person: "#10b981",
// emerald
place: "#06b6d4",
// cyan
note: "#6b7280",
// gray
pattern: "#ec4899",
// pink
decision: "#ef4444"
// red
};
const EVENT_TYPE_COLORS = {
MemoryCreated: "#10b981",
MemoryUpdated: "#3b82f6",
MemoryDeleted: "#ef4444",
SearchPerformed: "#6366f1",
DreamStarted: "#8b5cf6",
DreamCompleted: "#a855f7",
ConsolidationStarted: "#f59e0b",
ConsolidationCompleted: "#f97316",
ConnectionDiscovered: "#06b6d4",
ImportanceScored: "#ec4899",
Heartbeat: "#6b7280"
};
export {
EVENT_TYPE_COLORS as E,
NODE_TYPE_COLORS as N
};

View file

@ -0,0 +1,147 @@
import { r as root } from "./root.js";
import "./environment.js";
import "./server.js";
let public_env = {};
function set_private_env(environment) {
}
function set_public_env(environment) {
public_env = environment;
}
let read_implementation = null;
function set_read_implementation(fn) {
read_implementation = fn;
}
function set_manifest(_) {
}
const options = {
app_template_contains_nonce: false,
async: false,
csp: { "mode": "auto", "directives": { "upgrade-insecure-requests": false, "block-all-mixed-content": false }, "reportOnly": { "upgrade-insecure-requests": false, "block-all-mixed-content": false } },
csrf_check_origin: true,
csrf_trusted_origins: [],
embedded: false,
env_public_prefix: "PUBLIC_",
env_private_prefix: "",
hash_routing: false,
hooks: null,
// added lazily, via `get_hooks`
preload_strategy: "modulepreload",
root,
service_worker: false,
service_worker_options: void 0,
templates: {
app: ({ head, body, assets, nonce, env }) => `<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<meta name="theme-color" content="#050510" />
<meta name="description" content="Vestige — Cognitive Memory Dashboard. 3D visualization of your AI's long-term memory." />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="apple-mobile-web-app-title" content="Vestige" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="apple-touch-icon" href="/favicon.svg" />
<link rel="manifest" href="/manifest.json" />
` + head + '\n <title>Vestige</title>\n </head>\n <body data-sveltekit-preload-data="hover">\n <div style="display: contents">' + body + "</div>\n </body>\n</html>\n",
error: ({ status, message }) => '<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <title>' + message + `</title>
<style>
body {
--bg: white;
--fg: #222;
--divider: #ccc;
background: var(--bg);
color: var(--fg);
font-family:
system-ui,
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
Oxygen,
Ubuntu,
Cantarell,
'Open Sans',
'Helvetica Neue',
sans-serif;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
}
.error {
display: flex;
align-items: center;
max-width: 32rem;
margin: 0 1rem;
}
.status {
font-weight: 200;
font-size: 3rem;
line-height: 1;
position: relative;
top: -0.05rem;
}
.message {
border-left: 1px solid var(--divider);
padding: 0 0 0 1rem;
margin: 0 0 0 1rem;
min-height: 2.5rem;
display: flex;
align-items: center;
}
.message h1 {
font-weight: 400;
font-size: 1em;
margin: 0;
}
@media (prefers-color-scheme: dark) {
body {
--bg: #222;
--fg: #ddd;
--divider: #666;
}
}
</style>
</head>
<body>
<div class="error">
<span class="status">` + status + '</span>\n <div class="message">\n <h1>' + message + "</h1>\n </div>\n </div>\n </body>\n</html>\n"
},
version_hash: "1m0l582"
};
async function get_hooks() {
let handle;
let handleFetch;
let handleError;
let handleValidationError;
let init;
let reroute;
let transport;
return {
handle,
handleFetch,
handleError,
handleValidationError,
init,
reroute,
transport
};
}
export {
set_public_env as a,
set_read_implementation as b,
set_manifest as c,
get_hooks as g,
options as o,
public_env as p,
read_implementation as r,
set_private_env as s
};

View file

@ -0,0 +1,966 @@
import { H as HYDRATION_ERROR, C as COMMENT_NODE, h as HYDRATION_END, i as HYDRATION_START, j as HYDRATION_START_ELSE, k as get_next_sibling, l as effect_tracking, m as get, r as render_effect, o as source, p as untrack, q as increment, t as queue_micro_task, v as active_effect, B as BOUNDARY_EFFECT, w as block, x as branch, y as create_text, z as Batch, A as pause_effect, D as move_effect, E as set_signal_status, F as DIRTY, G as schedule_effect, M as MAYBE_DIRTY, I as defer_effect, J as set_active_effect, K as set_active_reaction, L as set_component_context, N as handle_error, O as active_reaction, P as component_context, Q as internal_set, R as destroy_effect, S as invoke_error_boundary, T as svelte_boundary_reset_onerror, U as HYDRATION_START_FAILED, V as EFFECT_TRANSPARENT, W as EFFECT_PRESERVED, X as define_property, Y as init_operations, Z as get_first_child, _ as hydration_failed, $ as clear_text_content, a0 as component_root, a1 as array_from, a2 as is_passive_event, a3 as push, a4 as pop, a5 as set, a6 as LEGACY_PROPS, a7 as flushSync, a8 as mutable_source, a9 as render, aa as setContext, ab as derived } from "./index.js";
function hydration_mismatch(location) {
{
console.warn(`https://svelte.dev/e/hydration_mismatch`);
}
}
function svelte_boundary_reset_noop() {
{
console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
}
}
let hydrating = false;
function set_hydrating(value) {
hydrating = value;
}
let hydrate_node;
function set_hydrate_node(node) {
if (node === null) {
hydration_mismatch();
throw HYDRATION_ERROR;
}
return hydrate_node = node;
}
function hydrate_next() {
return set_hydrate_node(get_next_sibling(hydrate_node));
}
function next(count = 1) {
if (hydrating) {
var i = count;
var node = hydrate_node;
while (i--) {
node = /** @type {TemplateNode} */
get_next_sibling(node);
}
hydrate_node = node;
}
}
function skip_nodes(remove = true) {
var depth = 0;
var node = hydrate_node;
while (true) {
if (node.nodeType === COMMENT_NODE) {
var data = (
/** @type {Comment} */
node.data
);
if (data === HYDRATION_END) {
if (depth === 0) return node;
depth -= 1;
} else if (data === HYDRATION_START || data === HYDRATION_START_ELSE || // "[1", "[2", etc. for if blocks
data[0] === "[" && !isNaN(Number(data.slice(1)))) {
depth += 1;
}
}
var next2 = (
/** @type {TemplateNode} */
get_next_sibling(node)
);
if (remove) node.remove();
node = next2;
}
}
function createSubscriber(start) {
let subscribers = 0;
let version = source(0);
let stop;
return () => {
if (effect_tracking()) {
get(version);
render_effect(() => {
if (subscribers === 0) {
stop = untrack(() => start(() => increment(version)));
}
subscribers += 1;
return () => {
queue_micro_task(() => {
subscribers -= 1;
if (subscribers === 0) {
stop?.();
stop = void 0;
increment(version);
}
});
};
});
}
};
}
var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
function boundary(node, props, children, transform_error) {
new Boundary(node, props, children, transform_error);
}
class Boundary {
/** @type {Boundary | null} */
parent;
is_pending = false;
/**
* API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
* Inherited from parent boundary, or defaults to identity.
* @type {(error: unknown) => unknown}
*/
transform_error;
/** @type {TemplateNode} */
#anchor;
/** @type {TemplateNode | null} */
#hydrate_open = hydrating ? hydrate_node : null;
/** @type {BoundaryProps} */
#props;
/** @type {((anchor: Node) => void)} */
#children;
/** @type {Effect} */
#effect;
/** @type {Effect | null} */
#main_effect = null;
/** @type {Effect | null} */
#pending_effect = null;
/** @type {Effect | null} */
#failed_effect = null;
/** @type {DocumentFragment | null} */
#offscreen_fragment = null;
#local_pending_count = 0;
#pending_count = 0;
#pending_count_update_queued = false;
/** @type {Set<Effect>} */
#dirty_effects = /* @__PURE__ */ new Set();
/** @type {Set<Effect>} */
#maybe_dirty_effects = /* @__PURE__ */ new Set();
/**
* A source containing the number of pending async deriveds/expressions.
* Only created if `$effect.pending()` is used inside the boundary,
* otherwise updating the source results in needless `Batch.ensure()`
* calls followed by no-op flushes
* @type {Source<number> | null}
*/
#effect_pending = null;
#effect_pending_subscriber = createSubscriber(() => {
this.#effect_pending = source(this.#local_pending_count);
return () => {
this.#effect_pending = null;
};
});
/**
* @param {TemplateNode} node
* @param {BoundaryProps} props
* @param {((anchor: Node) => void)} children
* @param {((error: unknown) => unknown) | undefined} [transform_error]
*/
constructor(node, props, children, transform_error) {
this.#anchor = node;
this.#props = props;
this.#children = (anchor) => {
var effect = (
/** @type {Effect} */
active_effect
);
effect.b = this;
effect.f |= BOUNDARY_EFFECT;
children(anchor);
};
this.parent = /** @type {Effect} */
active_effect.b;
this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
this.#effect = block(() => {
if (hydrating) {
const comment = (
/** @type {Comment} */
this.#hydrate_open
);
hydrate_next();
const server_rendered_pending = comment.data === HYDRATION_START_ELSE;
const server_rendered_failed = comment.data.startsWith(HYDRATION_START_FAILED);
if (server_rendered_failed) {
const serialized_error = JSON.parse(comment.data.slice(HYDRATION_START_FAILED.length));
this.#hydrate_failed_content(serialized_error);
} else if (server_rendered_pending) {
this.#hydrate_pending_content();
} else {
this.#hydrate_resolved_content();
}
} else {
this.#render();
}
}, flags);
if (hydrating) {
this.#anchor = hydrate_node;
}
}
#hydrate_resolved_content() {
try {
this.#main_effect = branch(() => this.#children(this.#anchor));
} catch (error) {
this.error(error);
}
}
/**
* @param {unknown} error The deserialized error from the server's hydration comment
*/
#hydrate_failed_content(error) {
const failed = this.#props.failed;
if (!failed) return;
this.#failed_effect = branch(() => {
failed(
this.#anchor,
() => error,
() => () => {
}
);
});
}
#hydrate_pending_content() {
const pending = this.#props.pending;
if (!pending) return;
this.is_pending = true;
this.#pending_effect = branch(() => pending(this.#anchor));
queue_micro_task(() => {
var fragment = this.#offscreen_fragment = document.createDocumentFragment();
var anchor = create_text();
fragment.append(anchor);
this.#main_effect = this.#run(() => {
Batch.ensure();
return branch(() => this.#children(anchor));
});
if (this.#pending_count === 0) {
this.#anchor.before(fragment);
this.#offscreen_fragment = null;
pause_effect(
/** @type {Effect} */
this.#pending_effect,
() => {
this.#pending_effect = null;
}
);
this.#resolve();
}
});
}
#render() {
try {
this.is_pending = this.has_pending_snippet();
this.#pending_count = 0;
this.#local_pending_count = 0;
this.#main_effect = branch(() => {
this.#children(this.#anchor);
});
if (this.#pending_count > 0) {
var fragment = this.#offscreen_fragment = document.createDocumentFragment();
move_effect(this.#main_effect, fragment);
const pending = (
/** @type {(anchor: Node) => void} */
this.#props.pending
);
this.#pending_effect = branch(() => pending(this.#anchor));
} else {
this.#resolve();
}
} catch (error) {
this.error(error);
}
}
#resolve() {
this.is_pending = false;
for (const e of this.#dirty_effects) {
set_signal_status(e, DIRTY);
schedule_effect(e);
}
for (const e of this.#maybe_dirty_effects) {
set_signal_status(e, MAYBE_DIRTY);
schedule_effect(e);
}
this.#dirty_effects.clear();
this.#maybe_dirty_effects.clear();
}
/**
* Defer an effect inside a pending boundary until the boundary resolves
* @param {Effect} effect
*/
defer_effect(effect) {
defer_effect(effect, this.#dirty_effects, this.#maybe_dirty_effects);
}
/**
* Returns `false` if the effect exists inside a boundary whose pending snippet is shown
* @returns {boolean}
*/
is_rendered() {
return !this.is_pending && (!this.parent || this.parent.is_rendered());
}
has_pending_snippet() {
return !!this.#props.pending;
}
/**
* @template T
* @param {() => T} fn
*/
#run(fn) {
var previous_effect = active_effect;
var previous_reaction = active_reaction;
var previous_ctx = component_context;
set_active_effect(this.#effect);
set_active_reaction(this.#effect);
set_component_context(this.#effect.ctx);
try {
return fn();
} catch (e) {
handle_error(e);
return null;
} finally {
set_active_effect(previous_effect);
set_active_reaction(previous_reaction);
set_component_context(previous_ctx);
}
}
/**
* Updates the pending count associated with the currently visible pending snippet,
* if any, such that we can replace the snippet with content once work is done
* @param {1 | -1} d
*/
#update_pending_count(d) {
if (!this.has_pending_snippet()) {
if (this.parent) {
this.parent.#update_pending_count(d);
}
return;
}
this.#pending_count += d;
if (this.#pending_count === 0) {
this.#resolve();
if (this.#pending_effect) {
pause_effect(this.#pending_effect, () => {
this.#pending_effect = null;
});
}
if (this.#offscreen_fragment) {
this.#anchor.before(this.#offscreen_fragment);
this.#offscreen_fragment = null;
}
}
}
/**
* Update the source that powers `$effect.pending()` inside this boundary,
* and controls when the current `pending` snippet (if any) is removed.
* Do not call from inside the class
* @param {1 | -1} d
*/
update_pending_count(d) {
this.#update_pending_count(d);
this.#local_pending_count += d;
if (!this.#effect_pending || this.#pending_count_update_queued) return;
this.#pending_count_update_queued = true;
queue_micro_task(() => {
this.#pending_count_update_queued = false;
if (this.#effect_pending) {
internal_set(this.#effect_pending, this.#local_pending_count);
}
});
}
get_effect_pending() {
this.#effect_pending_subscriber();
return get(
/** @type {Source<number>} */
this.#effect_pending
);
}
/** @param {unknown} error */
error(error) {
var onerror = this.#props.onerror;
let failed = this.#props.failed;
if (!onerror && !failed) {
throw error;
}
if (this.#main_effect) {
destroy_effect(this.#main_effect);
this.#main_effect = null;
}
if (this.#pending_effect) {
destroy_effect(this.#pending_effect);
this.#pending_effect = null;
}
if (this.#failed_effect) {
destroy_effect(this.#failed_effect);
this.#failed_effect = null;
}
if (hydrating) {
set_hydrate_node(
/** @type {TemplateNode} */
this.#hydrate_open
);
next();
set_hydrate_node(skip_nodes());
}
var did_reset = false;
var calling_on_error = false;
const reset = () => {
if (did_reset) {
svelte_boundary_reset_noop();
return;
}
did_reset = true;
if (calling_on_error) {
svelte_boundary_reset_onerror();
}
if (this.#failed_effect !== null) {
pause_effect(this.#failed_effect, () => {
this.#failed_effect = null;
});
}
this.#run(() => {
Batch.ensure();
this.#render();
});
};
const handle_error_result = (transformed_error) => {
try {
calling_on_error = true;
onerror?.(transformed_error, reset);
calling_on_error = false;
} catch (error2) {
invoke_error_boundary(error2, this.#effect && this.#effect.parent);
}
if (failed) {
this.#failed_effect = this.#run(() => {
Batch.ensure();
try {
return branch(() => {
var effect = (
/** @type {Effect} */
active_effect
);
effect.b = this;
effect.f |= BOUNDARY_EFFECT;
failed(
this.#anchor,
() => transformed_error,
() => reset
);
});
} catch (error2) {
invoke_error_boundary(
error2,
/** @type {Effect} */
this.#effect.parent
);
return null;
}
});
}
};
queue_micro_task(() => {
var result;
try {
result = this.transform_error(error);
} catch (e) {
invoke_error_boundary(e, this.#effect && this.#effect.parent);
return;
}
if (result !== null && typeof result === "object" && typeof /** @type {any} */
result.then === "function") {
result.then(
handle_error_result,
/** @param {unknown} e */
(e) => invoke_error_boundary(e, this.#effect && this.#effect.parent)
);
} else {
handle_error_result(result);
}
});
}
}
const event_symbol = Symbol("events");
const all_registered_events = /* @__PURE__ */ new Set();
const root_event_handles = /* @__PURE__ */ new Set();
let last_propagated_event = null;
function handle_event_propagation(event) {
var handler_element = this;
var owner_document = (
/** @type {Node} */
handler_element.ownerDocument
);
var event_name = event.type;
var path = event.composedPath?.() || [];
var current_target = (
/** @type {null | Element} */
path[0] || event.target
);
last_propagated_event = event;
var path_idx = 0;
var handled_at = last_propagated_event === event && event[event_symbol];
if (handled_at) {
var at_idx = path.indexOf(handled_at);
if (at_idx !== -1 && (handler_element === document || handler_element === /** @type {any} */
window)) {
event[event_symbol] = handler_element;
return;
}
var handler_idx = path.indexOf(handler_element);
if (handler_idx === -1) {
return;
}
if (at_idx <= handler_idx) {
path_idx = at_idx;
}
}
current_target = /** @type {Element} */
path[path_idx] || event.target;
if (current_target === handler_element) return;
define_property(event, "currentTarget", {
configurable: true,
get() {
return current_target || owner_document;
}
});
var previous_reaction = active_reaction;
var previous_effect = active_effect;
set_active_reaction(null);
set_active_effect(null);
try {
var throw_error;
var other_errors = [];
while (current_target !== null) {
var parent_element = current_target.assignedSlot || current_target.parentNode || /** @type {any} */
current_target.host || null;
try {
var delegated = current_target[event_symbol]?.[event_name];
if (delegated != null && (!/** @type {any} */
current_target.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
// -> the target could not have been disabled because it emits the event in the first place
event.target === current_target)) {
delegated.call(current_target, event);
}
} catch (error) {
if (throw_error) {
other_errors.push(error);
} else {
throw_error = error;
}
}
if (event.cancelBubble || parent_element === handler_element || parent_element === null) {
break;
}
current_target = parent_element;
}
if (throw_error) {
for (let error of other_errors) {
queueMicrotask(() => {
throw error;
});
}
throw throw_error;
}
} finally {
event[event_symbol] = handler_element;
delete event.currentTarget;
set_active_reaction(previous_reaction);
set_active_effect(previous_effect);
}
}
function assign_nodes(start, end) {
var effect = (
/** @type {Effect} */
active_effect
);
if (effect.nodes === null) {
effect.nodes = { start, end, a: null, t: null };
}
}
function mount(component, options) {
return _mount(component, options);
}
function hydrate(component, options) {
init_operations();
options.intro = options.intro ?? false;
const target = options.target;
const was_hydrating = hydrating;
const previous_hydrate_node = hydrate_node;
try {
var anchor = get_first_child(target);
while (anchor && (anchor.nodeType !== COMMENT_NODE || /** @type {Comment} */
anchor.data !== HYDRATION_START)) {
anchor = get_next_sibling(anchor);
}
if (!anchor) {
throw HYDRATION_ERROR;
}
set_hydrating(true);
set_hydrate_node(
/** @type {Comment} */
anchor
);
const instance = _mount(component, { ...options, anchor });
set_hydrating(false);
return (
/** @type {Exports} */
instance
);
} catch (error) {
if (error instanceof Error && error.message.split("\n").some((line) => line.startsWith("https://svelte.dev/e/"))) {
throw error;
}
if (error !== HYDRATION_ERROR) {
console.warn("Failed to hydrate: ", error);
}
if (options.recover === false) {
hydration_failed();
}
init_operations();
clear_text_content(target);
set_hydrating(false);
return mount(component, options);
} finally {
set_hydrating(was_hydrating);
set_hydrate_node(previous_hydrate_node);
}
}
const listeners = /* @__PURE__ */ new Map();
function _mount(Component, { target, anchor, props = {}, events, context, intro = true, transformError }) {
init_operations();
var component = void 0;
var unmount2 = component_root(() => {
var anchor_node = anchor ?? target.appendChild(create_text());
boundary(
/** @type {TemplateNode} */
anchor_node,
{
pending: () => {
}
},
(anchor_node2) => {
push({});
var ctx = (
/** @type {ComponentContext} */
component_context
);
if (context) ctx.c = context;
if (events) {
props.$$events = events;
}
if (hydrating) {
assign_nodes(
/** @type {TemplateNode} */
anchor_node2,
null
);
}
component = Component(anchor_node2, props) || {};
if (hydrating) {
active_effect.nodes.end = hydrate_node;
if (hydrate_node === null || hydrate_node.nodeType !== COMMENT_NODE || /** @type {Comment} */
hydrate_node.data !== HYDRATION_END) {
hydration_mismatch();
throw HYDRATION_ERROR;
}
}
pop();
},
transformError
);
var registered_events = /* @__PURE__ */ new Set();
var event_handle = (events2) => {
for (var i = 0; i < events2.length; i++) {
var event_name = events2[i];
if (registered_events.has(event_name)) continue;
registered_events.add(event_name);
var passive = is_passive_event(event_name);
for (const node of [target, document]) {
var counts = listeners.get(node);
if (counts === void 0) {
counts = /* @__PURE__ */ new Map();
listeners.set(node, counts);
}
var count = counts.get(event_name);
if (count === void 0) {
node.addEventListener(event_name, handle_event_propagation, { passive });
counts.set(event_name, 1);
} else {
counts.set(event_name, count + 1);
}
}
}
};
event_handle(array_from(all_registered_events));
root_event_handles.add(event_handle);
return () => {
for (var event_name of registered_events) {
for (const node of [target, document]) {
var counts = (
/** @type {Map<string, number>} */
listeners.get(node)
);
var count = (
/** @type {number} */
counts.get(event_name)
);
if (--count == 0) {
node.removeEventListener(event_name, handle_event_propagation);
counts.delete(event_name);
if (counts.size === 0) {
listeners.delete(node);
}
} else {
counts.set(event_name, count);
}
}
}
root_event_handles.delete(event_handle);
if (anchor_node !== anchor) {
anchor_node.parentNode?.removeChild(anchor_node);
}
};
});
mounted_components.set(component, unmount2);
return component;
}
let mounted_components = /* @__PURE__ */ new WeakMap();
function unmount(component, options) {
const fn = mounted_components.get(component);
if (fn) {
mounted_components.delete(component);
return fn(options);
}
return Promise.resolve();
}
function asClassComponent$1(component) {
return class extends Svelte4Component {
/** @param {any} options */
constructor(options) {
super({
component,
...options
});
}
};
}
class Svelte4Component {
/** @type {any} */
#events;
/** @type {Record<string, any>} */
#instance;
/**
* @param {ComponentConstructorOptions & {
* component: any;
* }} options
*/
constructor(options) {
var sources = /* @__PURE__ */ new Map();
var add_source = (key, value) => {
var s = mutable_source(value, false, false);
sources.set(key, s);
return s;
};
const props = new Proxy(
{ ...options.props || {}, $$events: {} },
{
get(target, prop) {
return get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
},
has(target, prop) {
if (prop === LEGACY_PROPS) return true;
get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
return Reflect.has(target, prop);
},
set(target, prop, value) {
set(sources.get(prop) ?? add_source(prop, value), value);
return Reflect.set(target, prop, value);
}
}
);
this.#instance = (options.hydrate ? hydrate : mount)(options.component, {
target: options.target,
anchor: options.anchor,
props,
context: options.context,
intro: options.intro ?? false,
recover: options.recover,
transformError: options.transformError
});
if (!options?.props?.$$host || options.sync === false) {
flushSync();
}
this.#events = props.$$events;
for (const key of Object.keys(this.#instance)) {
if (key === "$set" || key === "$destroy" || key === "$on") continue;
define_property(this, key, {
get() {
return this.#instance[key];
},
/** @param {any} value */
set(value) {
this.#instance[key] = value;
},
enumerable: true
});
}
this.#instance.$set = /** @param {Record<string, any>} next */
(next2) => {
Object.assign(props, next2);
};
this.#instance.$destroy = () => {
unmount(this.#instance);
};
}
/** @param {Record<string, any>} props */
$set(props) {
this.#instance.$set(props);
}
/**
* @param {string} event
* @param {(...args: any[]) => any} callback
* @returns {any}
*/
$on(event, callback) {
this.#events[event] = this.#events[event] || [];
const cb = (...args) => callback.call(this, ...args);
this.#events[event].push(cb);
return () => {
this.#events[event] = this.#events[event].filter(
/** @param {any} fn */
(fn) => fn !== cb
);
};
}
$destroy() {
this.#instance.$destroy();
}
}
function asClassComponent(component) {
const component_constructor = asClassComponent$1(component);
const _render = (props, { context, csp, transformError } = {}) => {
const result = render(component, { props, context, csp, transformError });
const munged = Object.defineProperties(
/** @type {LegacyRenderResult & PromiseLike<LegacyRenderResult>} */
{},
{
css: {
value: { code: "", map: null }
},
head: {
get: () => result.head
},
html: {
get: () => result.body
},
then: {
/**
* this is not type-safe, but honestly it's the best I can do right now, and it's a straightforward function.
*
* @template TResult1
* @template [TResult2=never]
* @param { (value: LegacyRenderResult) => TResult1 } onfulfilled
* @param { (reason: unknown) => TResult2 } onrejected
*/
value: (onfulfilled, onrejected) => {
{
const user_result = onfulfilled({
css: munged.css,
head: munged.head,
html: munged.html
});
return Promise.resolve(user_result);
}
}
}
}
);
return munged;
};
component_constructor.render = _render;
return component_constructor;
}
function Root($$renderer, $$props) {
$$renderer.component(($$renderer2) => {
let {
stores,
page,
constructors,
components = [],
form,
data_0 = null,
data_1 = null,
data_2 = null
} = $$props;
{
setContext("__svelte__", stores);
}
{
stores.page.set(page);
}
const Pyramid_2 = derived(() => constructors[2]);
if (constructors[1]) {
$$renderer2.push("<!--[-->");
const Pyramid_0 = constructors[0];
if (Pyramid_0) {
$$renderer2.push("<!--[-->");
Pyramid_0($$renderer2, {
data: data_0,
form,
params: page.params,
children: ($$renderer3) => {
if (constructors[2]) {
$$renderer3.push("<!--[-->");
const Pyramid_1 = constructors[1];
if (Pyramid_1) {
$$renderer3.push("<!--[-->");
Pyramid_1($$renderer3, {
data: data_1,
form,
params: page.params,
children: ($$renderer4) => {
if (Pyramid_2()) {
$$renderer4.push("<!--[-->");
Pyramid_2()($$renderer4, { data: data_2, form, params: page.params });
$$renderer4.push("<!--]-->");
} else {
$$renderer4.push("<!--[!-->");
$$renderer4.push("<!--]-->");
}
},
$$slots: { default: true }
});
$$renderer3.push("<!--]-->");
} else {
$$renderer3.push("<!--[!-->");
$$renderer3.push("<!--]-->");
}
} else {
$$renderer3.push("<!--[!-->");
const Pyramid_1 = constructors[1];
if (Pyramid_1) {
$$renderer3.push("<!--[-->");
Pyramid_1($$renderer3, { data: data_1, form, params: page.params });
$$renderer3.push("<!--]-->");
} else {
$$renderer3.push("<!--[!-->");
$$renderer3.push("<!--]-->");
}
}
$$renderer3.push(`<!--]-->`);
},
$$slots: { default: true }
});
$$renderer2.push("<!--]-->");
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push("<!--]-->");
}
} else {
$$renderer2.push("<!--[!-->");
const Pyramid_0 = constructors[0];
if (Pyramid_0) {
$$renderer2.push("<!--[-->");
Pyramid_0($$renderer2, { data: data_0, form, params: page.params });
$$renderer2.push("<!--]-->");
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push("<!--]-->");
}
}
$$renderer2.push(`<!--]--> `);
{
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]-->`);
});
}
const root = asClassComponent(Root);
export {
root as r
};

View file

@ -0,0 +1,25 @@
let base = "/dashboard";
let assets = base;
const app_dir = "_app";
const relative = true;
const initial = { base, assets };
function override(paths) {
base = paths.base;
assets = paths.assets;
}
function reset() {
base = initial.base;
assets = initial.assets;
}
function set_assets(path) {
assets = initial.assets = path;
}
export {
assets as a,
base as b,
app_dir as c,
reset as d,
override as o,
relative as r,
set_assets as s
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,17 @@
import { n as noop } from "./index.js";
import "./exports.js";
import "@sveltejs/kit/internal/server";
import "./root.js";
const is_legacy = noop.toString().includes("$$") || /function \w+\(\) \{\}/.test(noop.toString());
if (is_legacy) {
({
data: {},
form: null,
error: null,
params: {},
route: { id: null },
state: {},
status: -1,
url: new URL("https://example.com")
});
}

View file

@ -0,0 +1,123 @@
const BROWSER = false;
const escaped = {
"<": "\\u003C",
"\\": "\\\\",
"\b": "\\b",
"\f": "\\f",
"\n": "\\n",
"\r": "\\r",
" ": "\\t",
"\u2028": "\\u2028",
"\u2029": "\\u2029"
};
class DevalueError extends Error {
/**
* @param {string} message
* @param {string[]} keys
* @param {any} [value] - The value that failed to be serialized
* @param {any} [root] - The root value being serialized
*/
constructor(message, keys, value, root) {
super(message);
this.name = "DevalueError";
this.path = keys.join("");
this.value = value;
this.root = root;
}
}
function is_primitive(thing) {
return Object(thing) !== thing;
}
const object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(
Object.prototype
).sort().join("\0");
function is_plain_object(thing) {
const proto = Object.getPrototypeOf(thing);
return proto === Object.prototype || proto === null || Object.getPrototypeOf(proto) === null || Object.getOwnPropertyNames(proto).sort().join("\0") === object_proto_names;
}
function get_type(thing) {
return Object.prototype.toString.call(thing).slice(8, -1);
}
function get_escaped_char(char) {
switch (char) {
case '"':
return '\\"';
case "<":
return "\\u003C";
case "\\":
return "\\\\";
case "\n":
return "\\n";
case "\r":
return "\\r";
case " ":
return "\\t";
case "\b":
return "\\b";
case "\f":
return "\\f";
case "\u2028":
return "\\u2028";
case "\u2029":
return "\\u2029";
default:
return char < " " ? `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}` : "";
}
}
function stringify_string(str) {
let result = "";
let last_pos = 0;
const len = str.length;
for (let i = 0; i < len; i += 1) {
const char = str[i];
const replacement = get_escaped_char(char);
if (replacement) {
result += str.slice(last_pos, i) + replacement;
last_pos = i + 1;
}
}
return `"${last_pos === 0 ? str : result + str.slice(last_pos)}"`;
}
function enumerable_symbols(object) {
return Object.getOwnPropertySymbols(object).filter(
(symbol) => Object.getOwnPropertyDescriptor(object, symbol).enumerable
);
}
const is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
function stringify_key(key) {
return is_identifier.test(key) ? "." + key : "[" + JSON.stringify(key) + "]";
}
function is_valid_array_index(s) {
if (s.length === 0) return false;
if (s.length > 1 && s.charCodeAt(0) === 48) return false;
for (let i = 0; i < s.length; i++) {
const c = s.charCodeAt(i);
if (c < 48 || c > 57) return false;
}
const n = +s;
if (n >= 2 ** 32 - 1) return false;
if (n < 0) return false;
return true;
}
function valid_array_indices(array) {
const keys = Object.keys(array);
for (var i = keys.length - 1; i >= 0; i--) {
if (is_valid_array_index(keys[i])) {
break;
}
}
keys.length = i + 1;
return keys;
}
export {
BROWSER as B,
DevalueError as D,
is_plain_object as a,
stringify_string as b,
escaped as c,
enumerable_symbols as e,
get_type as g,
is_primitive as i,
stringify_key as s,
valid_array_indices as v
};

View file

@ -0,0 +1,43 @@
const text_encoder = new TextEncoder();
const text_decoder = new TextDecoder();
function get_relative_path(from, to) {
const from_parts = from.split(/[/\\]/);
const to_parts = to.split(/[/\\]/);
from_parts.pop();
while (from_parts[0] === to_parts[0]) {
from_parts.shift();
to_parts.shift();
}
let i = from_parts.length;
while (i--) from_parts[i] = "..";
return from_parts.concat(to_parts).join("/");
}
function base64_encode(bytes) {
if (globalThis.Buffer) {
return globalThis.Buffer.from(bytes).toString("base64");
}
let binary = "";
for (let i = 0; i < bytes.length; i++) {
binary += String.fromCharCode(bytes[i]);
}
return btoa(binary);
}
function base64_decode(encoded) {
if (globalThis.Buffer) {
const buffer = globalThis.Buffer.from(encoded, "base64");
return new Uint8Array(buffer);
}
const binary = atob(encoded);
const bytes = new Uint8Array(binary.length);
for (let i = 0; i < binary.length; i++) {
bytes[i] = binary.charCodeAt(i);
}
return bytes;
}
export {
text_encoder as a,
base64_encode as b,
base64_decode as c,
get_relative_path as g,
text_decoder as t
};

View file

@ -0,0 +1,85 @@
import { d as derived, w as writable } from "./index2.js";
const MAX_EVENTS = 200;
function createWebSocketStore() {
const { subscribe, set, update } = writable({
connected: false,
events: [],
lastHeartbeat: null,
error: null
});
let ws = null;
let reconnectTimer = null;
let reconnectAttempts = 0;
function connect(url) {
const wsUrl = url || (window.location.port === "5173" ? `ws://${window.location.hostname}:3927/ws` : `ws://${window.location.host}/ws`);
if (ws?.readyState === WebSocket.OPEN) return;
try {
ws = new WebSocket(wsUrl);
ws.onopen = () => {
reconnectAttempts = 0;
update((s) => ({ ...s, connected: true, error: null }));
};
ws.onmessage = (event) => {
try {
const parsed = JSON.parse(event.data);
update((s) => {
if (parsed.type === "Heartbeat") {
return { ...s, lastHeartbeat: parsed };
}
const events = [parsed, ...s.events].slice(0, MAX_EVENTS);
return { ...s, events };
});
} catch {
}
};
ws.onclose = () => {
update((s) => ({ ...s, connected: false }));
scheduleReconnect(wsUrl);
};
ws.onerror = () => {
update((s) => ({ ...s, error: "WebSocket connection failed" }));
};
} catch (e) {
update((s) => ({ ...s, error: String(e) }));
}
}
function scheduleReconnect(url) {
if (reconnectTimer) clearTimeout(reconnectTimer);
const delay = Math.min(1e3 * 2 ** reconnectAttempts, 3e4);
reconnectAttempts++;
reconnectTimer = setTimeout(() => connect(url), delay);
}
function disconnect() {
if (reconnectTimer) clearTimeout(reconnectTimer);
ws?.close();
ws = null;
set({ connected: false, events: [], lastHeartbeat: null, error: null });
}
function clearEvents() {
update((s) => ({ ...s, events: [] }));
}
return {
subscribe,
connect,
disconnect,
clearEvents
};
}
const websocket = createWebSocketStore();
const isConnected = derived(websocket, ($ws) => $ws.connected);
const eventFeed = derived(websocket, ($ws) => $ws.events);
derived(websocket, ($ws) => $ws.lastHeartbeat);
const memoryCount = derived(
websocket,
($ws) => $ws.lastHeartbeat?.data?.memory_count ?? 0
);
const avgRetention = derived(
websocket,
($ws) => $ws.lastHeartbeat?.data?.avg_retention ?? 0
);
export {
avgRetention as a,
eventFeed as e,
isConnected as i,
memoryCount as m
};

View file

@ -0,0 +1,44 @@
import { g as getContext, c as escape_html } from "../../chunks/index.js";
import "../../chunks/state.svelte.js";
import "@sveltejs/kit/internal";
import "../../chunks/exports.js";
import "../../chunks/utils2.js";
import { w as writable } from "../../chunks/index2.js";
import "@sveltejs/kit/internal/server";
import "../../chunks/root.js";
function create_updated_store() {
const { set, subscribe } = writable(false);
{
return {
subscribe,
// eslint-disable-next-line @typescript-eslint/require-await
check: async () => false
};
}
}
const stores = {
updated: /* @__PURE__ */ create_updated_store()
};
({
check: stores.updated.check
});
function context() {
return getContext("__request__");
}
const page$1 = {
get error() {
return context().page.error;
},
get status() {
return context().page.status;
}
};
const page = page$1;
function Error$1($$renderer, $$props) {
$$renderer.component(($$renderer2) => {
$$renderer2.push(`<h1>${escape_html(page.status)}</h1> <p>${escape_html(page.error?.message)}</p>`);
});
}
export {
Error$1 as default
};

View file

@ -0,0 +1,8 @@
function _layout($$renderer, $$props) {
let { children } = $$props;
children($$renderer);
$$renderer.push(`<!---->`);
}
export {
_layout as default
};

View file

@ -0,0 +1,53 @@
import { e as ensure_array_like, b as attr_class, c as escape_html, a as attr, d as stringify } from "../../../../chunks/index.js";
function _page($$renderer, $$props) {
$$renderer.component(($$renderer2) => {
let searchQuery = "";
let mode = "associations";
let importanceText = "";
const MODE_INFO = {
associations: {
icon: "◎",
desc: "Spreading activation — find related memories via graph traversal"
},
chains: {
icon: "⟿",
desc: "Build reasoning path from source to target memory"
},
bridges: {
icon: "⬡",
desc: "Find connecting memories between two concepts"
}
};
$$renderer2.push(`<div class="p-6 max-w-5xl mx-auto space-y-8"><h1 class="text-xl text-bright font-semibold">Explore Connections</h1> <div class="grid grid-cols-3 gap-2"><!--[-->`);
const each_array = ensure_array_like(["associations", "chains", "bridges"]);
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
let m = each_array[$$index];
$$renderer2.push(`<button${attr_class(`flex flex-col items-center gap-1 p-3 rounded-lg text-sm transition ${stringify(mode === m ? "bg-synapse/15 text-synapse-glow border border-synapse/40" : "bg-surface/30 text-dim border border-subtle/20 hover:border-subtle/40")}`)}><span class="text-xl">${escape_html(MODE_INFO[m].icon)}</span> <span class="font-medium">${escape_html(m.charAt(0).toUpperCase() + m.slice(1))}</span> <span class="text-[10px] text-muted text-center">${escape_html(MODE_INFO[m].desc)}</span></button>`);
}
$$renderer2.push(`<!--]--></div> <div class="space-y-3"><label class="text-xs text-dim font-medium">Source Memory</label> <div class="flex gap-2"><input type="text" placeholder="Search for a memory to explore from..."${attr("value", searchQuery)} class="flex-1 px-4 py-2.5 bg-surface border border-subtle/40 rounded-lg text-text text-sm placeholder:text-muted focus:outline-none focus:border-synapse/60 transition"/> <button class="px-4 py-2.5 bg-synapse/20 border border-synapse/40 text-synapse-glow text-sm rounded-lg hover:bg-synapse/30 transition">Find</button></div></div> `);
{
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> `);
{
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> `);
{
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> <div class="pt-8 border-t border-subtle/20"><h2 class="text-lg text-bright font-semibold mb-4">Importance Scorer</h2> <p class="text-xs text-muted mb-3">4-channel neuroscience scoring: novelty, arousal, reward, attention</p> <textarea placeholder="Paste any text to score its importance..." class="w-full h-24 px-4 py-3 bg-surface border border-subtle/40 rounded-lg text-text text-sm placeholder:text-muted resize-none focus:outline-none focus:border-synapse/60 transition">`);
const $$body = escape_html(importanceText);
if ($$body) {
$$renderer2.push(`${$$body}`);
}
$$renderer2.push(`</textarea> <button class="mt-2 px-4 py-2 bg-dream/20 border border-dream/40 text-dream-glow text-sm rounded-lg hover:bg-dream/30 transition">Score</button> `);
{
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div></div>`);
});
}
export {
_page as default
};

View file

@ -0,0 +1,85 @@
import { c as escape_html, s as store_get, e as ensure_array_like, ac as attr_style, d as stringify, f as unsubscribe_stores } from "../../../../chunks/index.js";
import { e as eventFeed } from "../../../../chunks/websocket.js";
import { E as EVENT_TYPE_COLORS } from "../../../../chunks/index3.js";
function _page($$renderer, $$props) {
$$renderer.component(($$renderer2) => {
var $$store_subs;
function formatTime(ts) {
return new Date(ts).toLocaleTimeString();
}
function eventIcon(type) {
const icons = {
MemoryCreated: "+",
MemoryUpdated: "~",
MemoryDeleted: "×",
MemoryPromoted: "↑",
MemoryDemoted: "↓",
SearchPerformed: "◎",
DreamStarted: "◈",
DreamProgress: "◈",
DreamCompleted: "◈",
ConsolidationStarted: "◉",
ConsolidationCompleted: "◉",
RetentionDecayed: "↘",
ConnectionDiscovered: "━",
ActivationSpread: "◬",
ImportanceScored: "◫",
Heartbeat: "♡"
};
return icons[type] || "·";
}
function eventSummary(event) {
const d = event.data;
switch (event.type) {
case "MemoryCreated":
return `New ${d.node_type}: "${String(d.content_preview).slice(0, 60)}..."`;
case "SearchPerformed":
return `Searched "${d.query}" → ${d.result_count} results (${d.duration_ms}ms)`;
case "DreamStarted":
return `Dream started with ${d.memory_count} memories`;
case "DreamCompleted":
return `Dream complete: ${d.connections_found} connections, ${d.insights_generated} insights (${d.duration_ms}ms)`;
case "ConsolidationStarted":
return "Consolidation cycle started";
case "ConsolidationCompleted":
return `Consolidated ${d.nodes_processed} nodes, ${d.decay_applied} decayed (${d.duration_ms}ms)`;
case "ConnectionDiscovered":
return `Connection: ${String(d.connection_type)} (weight: ${Number(d.weight).toFixed(2)})`;
case "ImportanceScored":
return `Scored ${Number(d.composite_score).toFixed(2)}: "${String(d.content_preview).slice(0, 50)}..."`;
case "MemoryPromoted":
return `Promoted → ${(Number(d.new_retention) * 100).toFixed(0)}% retention`;
case "MemoryDemoted":
return `Demoted → ${(Number(d.new_retention) * 100).toFixed(0)}% retention`;
default:
return JSON.stringify(d).slice(0, 100);
}
}
$$renderer2.push(`<div class="p-6 max-w-4xl mx-auto space-y-6"><div class="flex items-center justify-between"><h1 class="text-xl text-bright font-semibold">Live Feed</h1> <div class="flex gap-3"><span class="text-dim text-sm">${escape_html(store_get($$store_subs ??= {}, "$eventFeed", eventFeed).length)} events</span> <button class="text-xs text-muted hover:text-text transition">Clear</button></div></div> `);
if (store_get($$store_subs ??= {}, "$eventFeed", eventFeed).length === 0) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="text-center py-20 text-dim"><div class="text-4xl mb-4">◉</div> <p>Waiting for cognitive events...</p> <p class="text-sm text-muted mt-2">Events appear here in real-time as Vestige thinks.</p></div>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<div class="space-y-2"><!--[-->`);
const each_array = ensure_array_like(store_get($$store_subs ??= {}, "$eventFeed", eventFeed));
for (let i = 0, $$length = each_array.length; i < $$length; i++) {
let event = each_array[i];
$$renderer2.push(`<div class="flex items-start gap-3 p-3 bg-surface/40 border border-subtle/15 rounded-lg hover:border-subtle/30 transition-all duration-200"${attr_style(`border-left: 3px solid ${stringify(EVENT_TYPE_COLORS[event.type] || "#6b7280")}`)}><div class="w-6 h-6 rounded flex items-center justify-center text-xs flex-shrink-0"${attr_style(`background: ${stringify(EVENT_TYPE_COLORS[event.type] || "#6b7280")}20; color: ${stringify(EVENT_TYPE_COLORS[event.type] || "#6b7280")}`)}>${escape_html(eventIcon(event.type))}</div> <div class="flex-1 min-w-0"><div class="flex items-center gap-2 mb-0.5"><span class="text-xs font-medium"${attr_style(`color: ${stringify(EVENT_TYPE_COLORS[event.type] || "#6b7280")}`)}>${escape_html(event.type)}</span> `);
if (event.data.timestamp) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<span class="text-xs text-muted">${escape_html(formatTime(String(event.data.timestamp)))}</span>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div> <p class="text-sm text-dim">${escape_html(eventSummary(event))}</p></div></div>`);
}
$$renderer2.push(`<!--]--></div>`);
}
$$renderer2.push(`<!--]--></div>`);
if ($$store_subs) unsubscribe_stores($$store_subs);
});
}
export {
_page as default
};

View file

@ -0,0 +1,103 @@
import { ad as ssr_context, a as attr, b as attr_class, c as escape_html, s as store_get, f as unsubscribe_stores, d as stringify } from "../../../../chunks/index.js";
import { a as api } from "../../../../chunks/api.js";
import { e as eventFeed } from "../../../../chunks/websocket.js";
function onDestroy(fn) {
/** @type {SSRContext} */
ssr_context.r.on_destroy(fn);
}
function Graph3D($$renderer, $$props) {
$$renderer.component(($$renderer2) => {
let animationId;
onDestroy(() => {
cancelAnimationFrame(animationId);
window.removeEventListener("resize", onResize);
});
function onResize() {
return;
}
$$renderer2.push(`<div class="w-full h-full"></div>`);
});
}
function _page($$renderer, $$props) {
$$renderer.component(($$renderer2) => {
var $$store_subs;
let graphData = null;
let loading = true;
let error = "";
let isDreaming = false;
let searchQuery = "";
let maxNodes = 150;
async function loadGraph(query, centerId) {
loading = true;
error = "";
try {
graphData = await api.graph({
max_nodes: maxNodes,
depth: 3,
query: query || void 0,
center_id: centerId || void 0
});
} catch {
error = "No memories yet. Start using Vestige to populate your graph.";
} finally {
loading = false;
}
}
$$renderer2.push(`<div class="h-full relative">`);
if (loading) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="h-full flex items-center justify-center"><div class="text-center space-y-4"><div class="w-16 h-16 mx-auto rounded-full border-2 border-synapse/30 border-t-synapse animate-spin"></div> <p class="text-dim text-sm">Loading memory graph...</p></div></div>`);
} else if (error) {
$$renderer2.push("<!--[1-->");
$$renderer2.push(`<div class="h-full flex items-center justify-center"><div class="text-center space-y-4 max-w-md px-8"><div class="text-5xl opacity-30">◎</div> <h2 class="text-xl text-bright">Your Mind Awaits</h2> <p class="text-dim text-sm">${escape_html(error)}</p></div></div>`);
} else if (graphData) {
$$renderer2.push("<!--[2-->");
Graph3D($$renderer2, {
nodes: graphData.nodes,
edges: graphData.edges,
centerId: graphData.center_id,
events: store_get($$store_subs ??= {}, "$eventFeed", eventFeed)
});
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> <div class="absolute top-4 left-4 right-4 z-10 flex items-center gap-3"><div class="flex gap-2 flex-1 max-w-md"><input type="text" placeholder="Center graph on..."${attr("value", searchQuery)} class="flex-1 px-3 py-2 bg-abyss/80 backdrop-blur-sm border border-subtle/30 rounded-lg text-text text-sm placeholder:text-muted focus:outline-none focus:border-synapse/50 transition"/> <button class="px-3 py-2 bg-synapse/20 border border-synapse/40 text-synapse-glow text-sm rounded-lg hover:bg-synapse/30 transition backdrop-blur-sm">Focus</button></div> <div class="flex gap-2 ml-auto">`);
$$renderer2.select(
{
value: maxNodes,
onchange: () => loadGraph(),
class: "px-2 py-2 bg-abyss/80 backdrop-blur-sm border border-subtle/30 rounded-lg text-dim text-xs"
},
($$renderer3) => {
$$renderer3.option({ value: 50 }, ($$renderer4) => {
$$renderer4.push(`50 nodes`);
});
$$renderer3.option({ value: 100 }, ($$renderer4) => {
$$renderer4.push(`100 nodes`);
});
$$renderer3.option({ value: 150 }, ($$renderer4) => {
$$renderer4.push(`150 nodes`);
});
$$renderer3.option({ value: 200 }, ($$renderer4) => {
$$renderer4.push(`200 nodes`);
});
}
);
$$renderer2.push(` <button${attr("disabled", isDreaming, true)}${attr_class(`px-4 py-2 rounded-lg bg-dream/20 border border-dream/40 text-dream-glow text-sm hover:bg-dream/30 transition-all backdrop-blur-sm disabled:opacity-50 ${stringify("")}`)}>${escape_html("◈ Dream")}</button> <button class="px-3 py-2 bg-abyss/80 backdrop-blur-sm border border-subtle/30 rounded-lg text-dim text-sm hover:text-text transition">↻</button></div></div> <div class="absolute bottom-4 left-4 z-10 text-xs text-dim backdrop-blur-sm bg-abyss/60 rounded-lg px-3 py-2 border border-subtle/20">`);
if (graphData) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<span>${escape_html(graphData.nodeCount)} nodes</span> <span class="mx-2 text-subtle">·</span> <span>${escape_html(graphData.edgeCount)} edges</span> <span class="mx-2 text-subtle">·</span> <span>depth ${escape_html(graphData.depth)}</span>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div> `);
{
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div>`);
if ($$store_subs) unsubscribe_stores($$store_subs);
});
}
export {
_page as default
};

View file

@ -0,0 +1,57 @@
import { c as escape_html, e as ensure_array_like, b as attr_class, d as stringify } from "../../../../chunks/index.js";
function _page($$renderer, $$props) {
$$renderer.component(($$renderer2) => {
let intentions = [];
let predictions = [];
let statusFilter = "active";
$$renderer2.push(`<div class="p-6 max-w-5xl mx-auto space-y-8"><div class="flex items-center justify-between"><h1 class="text-xl text-bright font-semibold">Intentions &amp; Predictions</h1> <span class="text-xs text-muted">${escape_html(intentions.length)} intentions</span></div> <div class="space-y-4"><div class="flex items-center gap-2"><h2 class="text-sm text-bright font-semibold">Prospective Memory</h2> <span class="text-xs text-muted">"Remember to do X when Y happens"</span></div> <div class="flex gap-1.5"><!--[-->`);
const each_array = ensure_array_like(["active", "fulfilled", "snoozed", "cancelled", "all"]);
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
let status = each_array[$$index];
$$renderer2.push(`<button${attr_class(`px-3 py-1.5 rounded-lg text-xs transition ${stringify(statusFilter === status ? "bg-synapse/20 text-synapse-glow border border-synapse/40" : "bg-surface/40 text-dim border border-subtle/20 hover:border-subtle/40")}`)}>${escape_html(status.charAt(0).toUpperCase() + status.slice(1))}</button>`);
}
$$renderer2.push(`<!--]--></div> `);
{
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="space-y-2"><!--[-->`);
const each_array_1 = ensure_array_like(Array(4));
for (let $$index_1 = 0, $$length = each_array_1.length; $$index_1 < $$length; $$index_1++) {
each_array_1[$$index_1];
$$renderer2.push(`<div class="h-16 bg-surface/50 rounded-lg animate-pulse"></div>`);
}
$$renderer2.push(`<!--]--></div>`);
}
$$renderer2.push(`<!--]--></div> <div class="pt-6 border-t border-subtle/20 space-y-4"><div class="flex items-center gap-2"><h2 class="text-sm text-bright font-semibold">Predicted Needs</h2> <span class="text-xs text-muted">What you might need next</span></div> `);
if (predictions.length === 0) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="text-center py-8 text-dim"><div class="text-3xl mb-3 opacity-20">◬</div> <p class="text-sm">No predictions yet. Use Vestige more to train the predictive model.</p></div>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<div class="space-y-2"><!--[-->`);
const each_array_3 = ensure_array_like(predictions);
for (let i = 0, $$length = each_array_3.length; i < $$length; i++) {
let pred = each_array_3[i];
$$renderer2.push(`<div class="p-3 bg-surface/40 border border-subtle/20 rounded-lg flex items-start gap-3"><div class="w-6 h-6 rounded-full bg-dream/20 text-dream-glow text-xs flex items-center justify-center flex-shrink-0 mt-0.5">${escape_html(i + 1)}</div> <div class="flex-1 min-w-0"><p class="text-sm text-text line-clamp-2">${escape_html(pred.content)}</p> <div class="flex gap-3 mt-1 text-xs text-muted"><span>${escape_html(pred.nodeType)}</span> `);
if (pred.retention) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<span>${escape_html((Number(pred.retention) * 100).toFixed(0))}% retention</span>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> `);
if (pred.predictedNeed) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<span class="text-dream-glow">${escape_html(pred.predictedNeed)} need</span>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div></div></div>`);
}
$$renderer2.push(`<!--]--></div>`);
}
$$renderer2.push(`<!--]--></div></div>`);
});
}
export {
_page as default
};

View file

@ -0,0 +1,109 @@
import { c as escape_html, a as attr, e as ensure_array_like, b as attr_class, d as stringify, ac as attr_style } from "../../../../chunks/index.js";
import { a as api } from "../../../../chunks/api.js";
import { N as NODE_TYPE_COLORS } from "../../../../chunks/index3.js";
function _page($$renderer, $$props) {
$$renderer.component(($$renderer2) => {
let memories = [];
let searchQuery = "";
let selectedType = "";
let selectedTag = "";
let minRetention = 0;
let loading = true;
let selectedMemory = null;
async function loadMemories() {
loading = true;
try {
const params = {};
if (searchQuery) ;
if (selectedType) ;
if (selectedTag) ;
if (minRetention > 0) ;
const res = await api.memories.list(params);
memories = res.memories;
} catch {
memories = [];
} finally {
loading = false;
}
}
function retentionColor(r) {
if (r > 0.7) return "#10b981";
if (r > 0.4) return "#f59e0b";
return "#ef4444";
}
$$renderer2.push(`<div class="p-6 max-w-6xl mx-auto space-y-6"><div class="flex items-center justify-between"><h1 class="text-xl text-bright font-semibold">Memories</h1> <span class="text-dim text-sm">${escape_html(memories.length)} results</span></div> <div class="flex gap-3 flex-wrap"><input type="text" placeholder="Search memories..."${attr("value", searchQuery)} class="flex-1 min-w-64 px-4 py-2.5 bg-surface border border-subtle/40 rounded-lg text-text text-sm placeholder:text-muted focus:outline-none focus:border-synapse/60 focus:ring-1 focus:ring-synapse/30 transition"/> `);
$$renderer2.select(
{
value: selectedType,
onchange: loadMemories,
class: "px-3 py-2.5 bg-surface border border-subtle/40 rounded-lg text-dim text-sm focus:outline-none"
},
($$renderer3) => {
$$renderer3.option({ value: "" }, ($$renderer4) => {
$$renderer4.push(`All types`);
});
$$renderer3.option({ value: "fact" }, ($$renderer4) => {
$$renderer4.push(`Fact`);
});
$$renderer3.option({ value: "concept" }, ($$renderer4) => {
$$renderer4.push(`Concept`);
});
$$renderer3.option({ value: "event" }, ($$renderer4) => {
$$renderer4.push(`Event`);
});
$$renderer3.option({ value: "person" }, ($$renderer4) => {
$$renderer4.push(`Person`);
});
$$renderer3.option({ value: "place" }, ($$renderer4) => {
$$renderer4.push(`Place`);
});
$$renderer3.option({ value: "note" }, ($$renderer4) => {
$$renderer4.push(`Note`);
});
$$renderer3.option({ value: "pattern" }, ($$renderer4) => {
$$renderer4.push(`Pattern`);
});
$$renderer3.option({ value: "decision" }, ($$renderer4) => {
$$renderer4.push(`Decision`);
});
}
);
$$renderer2.push(` <div class="flex items-center gap-2 text-xs text-dim"><span>Min retention:</span> <input type="range" min="0" max="1" step="0.1"${attr("value", minRetention)} class="w-24 accent-synapse"/> <span>${escape_html((minRetention * 100).toFixed(0))}%</span></div></div> `);
if (loading) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="grid gap-3"><!--[-->`);
const each_array = ensure_array_like(Array(8));
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
each_array[$$index];
$$renderer2.push(`<div class="h-24 bg-surface/50 rounded-lg animate-pulse"></div>`);
}
$$renderer2.push(`<!--]--></div>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<div class="grid gap-3"><!--[-->`);
const each_array_1 = ensure_array_like(memories);
for (let $$index_2 = 0, $$length = each_array_1.length; $$index_2 < $$length; $$index_2++) {
let memory = each_array_1[$$index_2];
$$renderer2.push(`<button${attr_class(`text-left p-4 bg-surface/50 border border-subtle/20 rounded-lg hover:border-synapse/30 hover:bg-surface transition-all duration-200 group ${stringify(selectedMemory?.id === memory.id ? "border-synapse/50 glow-synapse" : "")}`)}><div class="flex items-start justify-between gap-4"><div class="flex-1 min-w-0"><div class="flex items-center gap-2 mb-2"><span class="w-2 h-2 rounded-full"${attr_style(`background: ${stringify(NODE_TYPE_COLORS[memory.nodeType] || "#6b7280")}`)}></span> <span class="text-xs text-dim">${escape_html(memory.nodeType)}</span> <!--[-->`);
const each_array_2 = ensure_array_like(memory.tags.slice(0, 3));
for (let $$index_1 = 0, $$length2 = each_array_2.length; $$index_1 < $$length2; $$index_1++) {
let tag = each_array_2[$$index_1];
$$renderer2.push(`<span class="text-xs px-1.5 py-0.5 bg-deep rounded text-muted">${escape_html(tag)}</span>`);
}
$$renderer2.push(`<!--]--></div> <p class="text-sm text-text leading-relaxed line-clamp-2">${escape_html(memory.content)}</p></div> <div class="flex flex-col items-end gap-1 flex-shrink-0"><div class="w-12 h-1.5 bg-deep rounded-full overflow-hidden"><div class="h-full rounded-full"${attr_style(`width: ${stringify(memory.retentionStrength * 100)}%; background: ${stringify(retentionColor(memory.retentionStrength))}`)}></div></div> <span class="text-xs text-muted">${escape_html((memory.retentionStrength * 100).toFixed(0))}%</span></div></div> `);
if (selectedMemory?.id === memory.id) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="mt-4 pt-4 border-t border-subtle/20 space-y-3"><p class="text-sm text-text whitespace-pre-wrap">${escape_html(memory.content)}</p> <div class="grid grid-cols-3 gap-3 text-xs text-dim"><div>Storage: ${escape_html((memory.storageStrength * 100).toFixed(1))}%</div> <div>Retrieval: ${escape_html((memory.retrievalStrength * 100).toFixed(1))}%</div> <div>Created: ${escape_html(new Date(memory.createdAt).toLocaleDateString())}</div></div> <div class="flex gap-2"><button class="px-3 py-1.5 bg-recall/20 text-recall text-xs rounded hover:bg-recall/30">Promote</button> <button class="px-3 py-1.5 bg-decay/20 text-decay text-xs rounded hover:bg-decay/30">Demote</button> <button class="px-3 py-1.5 bg-decay/10 text-decay/60 text-xs rounded hover:bg-decay/20 ml-auto">Delete</button></div></div>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></button>`);
}
$$renderer2.push(`<!--]--></div>`);
}
$$renderer2.push(`<!--]--></div>`);
});
}
export {
_page as default
};

View file

@ -0,0 +1,51 @@
import { c as escape_html, s as store_get, ac as attr_style, d as stringify, b as attr_class, a as attr, e as ensure_array_like, f as unsubscribe_stores } from "../../../../chunks/index.js";
import { m as memoryCount, a as avgRetention, i as isConnected } from "../../../../chunks/websocket.js";
function _page($$renderer, $$props) {
$$renderer.component(($$renderer2) => {
var $$store_subs;
let consolidating = false;
let dreaming = false;
$$renderer2.push(`<div class="p-6 max-w-4xl mx-auto space-y-8"><div class="flex items-center justify-between"><h1 class="text-xl text-bright font-semibold">Settings &amp; System</h1> <button class="text-xs text-dim hover:text-text transition">Refresh</button></div> <div class="grid grid-cols-2 md:grid-cols-4 gap-3"><div class="p-4 bg-surface/30 border border-subtle/20 rounded-lg text-center"><div class="text-2xl text-bright font-bold">${escape_html(store_get($$store_subs ??= {}, "$memoryCount", memoryCount))}</div> <div class="text-xs text-dim mt-1">Memories</div></div> <div class="p-4 bg-surface/30 border border-subtle/20 rounded-lg text-center"><div class="text-2xl font-bold"${attr_style(`color: ${stringify(store_get($$store_subs ??= {}, "$avgRetention", avgRetention) > 0.7 ? "#10b981" : store_get($$store_subs ??= {}, "$avgRetention", avgRetention) > 0.4 ? "#f59e0b" : "#ef4444")}`)}>${escape_html((store_get($$store_subs ??= {}, "$avgRetention", avgRetention) * 100).toFixed(1))}%</div> <div class="text-xs text-dim mt-1">Avg Retention</div></div> <div class="p-4 bg-surface/30 border border-subtle/20 rounded-lg text-center"><div class="text-2xl text-bright font-bold flex items-center justify-center gap-2"><div${attr_class(`w-2.5 h-2.5 rounded-full ${stringify(store_get($$store_subs ??= {}, "$isConnected", isConnected) ? "bg-recall animate-pulse-glow" : "bg-decay")}`)}></div> <span class="text-sm">${escape_html(store_get($$store_subs ??= {}, "$isConnected", isConnected) ? "Online" : "Offline")}</span></div> <div class="text-xs text-dim mt-1">WebSocket</div></div> <div class="p-4 bg-surface/30 border border-subtle/20 rounded-lg text-center"><div class="text-2xl text-synapse-glow font-bold">v2.0</div> <div class="text-xs text-dim mt-1">Vestige</div></div></div> <section class="space-y-4"><h2 class="text-sm text-bright font-semibold flex items-center gap-2"><span class="text-dream">◈</span> Cognitive Operations</h2> <div class="p-4 bg-surface/30 border border-subtle/20 rounded-lg space-y-3"><div class="flex items-center justify-between"><div><div class="text-sm text-text font-medium">FSRS-6 Consolidation</div> <div class="text-xs text-dim">Apply spaced-repetition decay, regenerate embeddings, run maintenance</div></div> <button${attr("disabled", consolidating, true)} class="px-4 py-2 bg-warning/20 border border-warning/40 text-warning text-sm rounded-lg hover:bg-warning/30 transition disabled:opacity-50 flex items-center gap-2">`);
{
$$renderer2.push("<!--[!-->");
$$renderer2.push(`Consolidate`);
}
$$renderer2.push(`<!--]--></button></div> `);
{
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div> <div class="p-4 bg-surface/30 border border-subtle/20 rounded-lg space-y-3"><div class="flex items-center justify-between"><div><div class="text-sm text-text font-medium">Memory Dream Cycle</div> <div class="text-xs text-dim">Replay memories, discover hidden connections, synthesize insights</div></div> <button${attr("disabled", dreaming, true)}${attr_class(`px-4 py-2 bg-dream/20 border border-dream/40 text-dream-glow text-sm rounded-lg hover:bg-dream/30 transition disabled:opacity-50 flex items-center gap-2 ${stringify("")}`)}>`);
{
$$renderer2.push("<!--[!-->");
$$renderer2.push(`Dream`);
}
$$renderer2.push(`<!--]--></button></div> `);
{
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div></section> `);
{
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> <section class="space-y-4"><h2 class="text-sm text-bright font-semibold flex items-center gap-2"><span class="text-synapse">⌨</span> Keyboard Shortcuts</h2> <div class="p-4 bg-surface/30 border border-subtle/20 rounded-lg"><div class="grid grid-cols-2 gap-2 text-xs"><!--[-->`);
const each_array_2 = ensure_array_like([
{ key: "⌘ K", desc: "Command palette" },
{ key: "/", desc: "Focus search" },
{ key: "G", desc: "Go to Graph" },
{ key: "M", desc: "Go to Memories" },
{ key: "T", desc: "Go to Timeline" },
{ key: "F", desc: "Go to Feed" },
{ key: "E", desc: "Go to Explore" },
{ key: "S", desc: "Go to Stats" }
]);
for (let $$index_2 = 0, $$length = each_array_2.length; $$index_2 < $$length; $$index_2++) {
let shortcut = each_array_2[$$index_2];
$$renderer2.push(`<div class="flex items-center gap-2 py-1"><kbd class="px-1.5 py-0.5 bg-deep rounded text-[10px] font-mono text-muted min-w-[2rem] text-center">${escape_html(shortcut.key)}</kbd> <span class="text-dim">${escape_html(shortcut.desc)}</span></div>`);
}
$$renderer2.push(`<!--]--></div></div></section> <section class="space-y-4"><h2 class="text-sm text-bright font-semibold flex items-center gap-2"><span class="text-memory">◎</span> About</h2> <div class="p-4 bg-surface/30 border border-subtle/20 rounded-lg space-y-3"><div class="flex items-center gap-4"><div class="w-12 h-12 rounded-xl bg-gradient-to-br from-dream to-synapse flex items-center justify-center text-bright text-xl font-bold shadow-lg shadow-synapse/20">V</div> <div><div class="text-sm text-bright font-semibold">Vestige v2.0 "Cognitive Leap"</div> <div class="text-xs text-dim">Your AI's long-term memory system</div></div></div> <div class="grid grid-cols-2 gap-2 text-xs text-dim pt-2 border-t border-subtle/10"><div>29 cognitive modules</div> <div>FSRS-6 spaced repetition</div> <div>Nomic Embed v1.5 (256d)</div> <div>Jina Reranker v1 Turbo</div> <div>USearch HNSW (20x FAISS)</div> <div>Local-first, zero cloud</div></div> <div class="text-[10px] text-muted pt-1">Built with Rust + Axum + SvelteKit 2 + Svelte 5 + Three.js + Tailwind CSS 4</div></div></section></div>`);
if ($$store_subs) unsubscribe_stores($$store_subs);
});
}
export {
_page as default
};

View file

@ -0,0 +1,20 @@
import { e as ensure_array_like } from "../../../../chunks/index.js";
function _page($$renderer, $$props) {
$$renderer.component(($$renderer2) => {
$$renderer2.push(`<div class="p-6 max-w-5xl mx-auto space-y-6"><h1 class="text-xl text-bright font-semibold">System Stats</h1> `);
{
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="grid grid-cols-2 lg:grid-cols-4 gap-4"><!--[-->`);
const each_array = ensure_array_like(Array(8));
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
each_array[$$index];
$$renderer2.push(`<div class="h-24 bg-surface/50 rounded-lg animate-pulse"></div>`);
}
$$renderer2.push(`<!--]--></div>`);
}
$$renderer2.push(`<!--]--></div>`);
});
}
export {
_page as default
};

View file

@ -0,0 +1,97 @@
import { e as ensure_array_like, c as escape_html, ac as attr_style, d as stringify } from "../../../../chunks/index.js";
import { a as api } from "../../../../chunks/api.js";
import { N as NODE_TYPE_COLORS } from "../../../../chunks/index3.js";
function _page($$renderer, $$props) {
$$renderer.component(($$renderer2) => {
let timeline = [];
let loading = true;
let days = 14;
let expandedDay = null;
async function loadTimeline() {
loading = true;
try {
const res = await api.timeline(days, 500);
timeline = res.timeline;
} catch {
timeline = [];
} finally {
loading = false;
}
}
$$renderer2.push(`<div class="p-6 max-w-4xl mx-auto space-y-6"><div class="flex items-center justify-between"><h1 class="text-xl text-bright font-semibold">Timeline</h1> `);
$$renderer2.select(
{
value: days,
onchange: loadTimeline,
class: "px-3 py-2 bg-surface border border-subtle/40 rounded-lg text-dim text-sm"
},
($$renderer3) => {
$$renderer3.option({ value: 7 }, ($$renderer4) => {
$$renderer4.push(`7 days`);
});
$$renderer3.option({ value: 14 }, ($$renderer4) => {
$$renderer4.push(`14 days`);
});
$$renderer3.option({ value: 30 }, ($$renderer4) => {
$$renderer4.push(`30 days`);
});
$$renderer3.option({ value: 90 }, ($$renderer4) => {
$$renderer4.push(`90 days`);
});
}
);
$$renderer2.push(`</div> `);
if (loading) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="space-y-4"><!--[-->`);
const each_array = ensure_array_like(Array(7));
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
each_array[$$index];
$$renderer2.push(`<div class="h-16 bg-surface/50 rounded-lg animate-pulse"></div>`);
}
$$renderer2.push(`<!--]--></div>`);
} else if (timeline.length === 0) {
$$renderer2.push("<!--[1-->");
$$renderer2.push(`<div class="text-center py-20 text-dim"><p>No memories in the selected time range.</p></div>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<div class="relative"><div class="absolute left-6 top-0 bottom-0 w-px bg-subtle/30"></div> <div class="space-y-4"><!--[-->`);
const each_array_1 = ensure_array_like(timeline);
for (let $$index_3 = 0, $$length = each_array_1.length; $$index_3 < $$length; $$index_3++) {
let day = each_array_1[$$index_3];
$$renderer2.push(`<div class="relative pl-14"><div class="absolute left-4 top-3 w-5 h-5 rounded-full border-2 border-synapse bg-abyss flex items-center justify-center"><div class="w-2 h-2 rounded-full bg-synapse"></div></div> <button class="w-full text-left p-4 bg-surface/40 border border-subtle/20 rounded-lg hover:border-synapse/30 transition-all"><div class="flex items-center justify-between"><div><span class="text-sm text-bright font-medium">${escape_html(day.date)}</span> <span class="text-xs text-dim ml-2">${escape_html(day.count)} memories</span></div> <div class="flex gap-1"><!--[-->`);
const each_array_2 = ensure_array_like(day.memories.slice(0, 10));
for (let $$index_1 = 0, $$length2 = each_array_2.length; $$index_1 < $$length2; $$index_1++) {
let m = each_array_2[$$index_1];
$$renderer2.push(`<div class="w-2 h-2 rounded-full"${attr_style(`background: ${stringify(NODE_TYPE_COLORS[m.nodeType] || "#6b7280")}; opacity: ${stringify(0.3 + m.retentionStrength * 0.7)}`)}></div>`);
}
$$renderer2.push(`<!--]--> `);
if (day.memories.length > 10) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<span class="text-xs text-muted">+${escape_html(day.memories.length - 10)}</span>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div></div> `);
if (expandedDay === day.date) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="mt-3 pt-3 border-t border-subtle/20 space-y-2"><!--[-->`);
const each_array_3 = ensure_array_like(day.memories);
for (let $$index_2 = 0, $$length2 = each_array_3.length; $$index_2 < $$length2; $$index_2++) {
let m = each_array_3[$$index_2];
$$renderer2.push(`<div class="flex items-start gap-2 text-sm"><div class="w-2 h-2 mt-1.5 rounded-full flex-shrink-0"${attr_style(`background: ${stringify(NODE_TYPE_COLORS[m.nodeType] || "#6b7280")}`)}></div> <div class="flex-1 min-w-0"><span class="text-dim line-clamp-1">${escape_html(m.content)}</span></div> <span class="text-xs text-muted flex-shrink-0">${escape_html((m.retentionStrength * 100).toFixed(0))}%</span></div>`);
}
$$renderer2.push(`<!--]--></div>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></button></div>`);
}
$$renderer2.push(`<!--]--></div></div>`);
}
$$renderer2.push(`<!--]--></div>`);
});
}
export {
_page as default
};

View file

@ -0,0 +1,97 @@
import { g as getContext, e as ensure_array_like, s as store_get, a as attr, b as attr_class, c as escape_html, d as stringify, f as unsubscribe_stores } from "../../chunks/index.js";
import "@sveltejs/kit/internal";
import "../../chunks/exports.js";
import "../../chunks/utils2.js";
import "@sveltejs/kit/internal/server";
import "../../chunks/root.js";
import "../../chunks/state.svelte.js";
import { b as base } from "../../chunks/server.js";
import { i as isConnected, m as memoryCount, a as avgRetention } from "../../chunks/websocket.js";
const getStores = () => {
const stores$1 = getContext("__svelte__");
return {
/** @type {typeof page} */
page: {
subscribe: stores$1.page.subscribe
},
/** @type {typeof navigating} */
navigating: {
subscribe: stores$1.navigating.subscribe
},
/** @type {typeof updated} */
updated: stores$1.updated
};
};
const page = {
subscribe(fn) {
const store = getStores().page;
return store.subscribe(fn);
}
};
function _layout($$renderer, $$props) {
$$renderer.component(($$renderer2) => {
var $$store_subs;
let { children } = $$props;
const nav = [
{ href: "/", label: "Graph", icon: "◎", shortcut: "G" },
{
href: "/memories",
label: "Memories",
icon: "◈",
shortcut: "M"
},
{
href: "/timeline",
label: "Timeline",
icon: "◷",
shortcut: "T"
},
{ href: "/feed", label: "Feed", icon: "◉", shortcut: "F" },
{ href: "/explore", label: "Explore", icon: "◬", shortcut: "E" },
{
href: "/intentions",
label: "Intentions",
icon: "◇",
shortcut: "I"
},
{ href: "/stats", label: "Stats", icon: "◫", shortcut: "S" },
{
href: "/settings",
label: "Settings",
icon: "⚙",
shortcut: ","
}
];
const mobileNav = nav.slice(0, 5);
function isActive(href, currentPath) {
const path = currentPath.startsWith(base) ? currentPath.slice(base.length) || "/" : currentPath;
if (href === "/") return path === "/" || path === "/graph";
return path.startsWith(href);
}
$$renderer2.push(`<div class="flex flex-col md:flex-row h-screen overflow-hidden bg-void"><nav class="hidden md:flex w-16 lg:w-56 flex-shrink-0 bg-abyss border-r border-subtle/30 flex-col"><a href="/" class="flex items-center gap-3 px-4 py-5 border-b border-subtle/20"><div class="w-8 h-8 rounded-lg bg-gradient-to-br from-dream to-synapse flex items-center justify-center text-bright text-sm font-bold">V</div> <span class="hidden lg:block text-sm font-semibold text-bright tracking-wide">VESTIGE</span></a> <div class="flex-1 py-3 flex flex-col gap-1 px-2"><!--[-->`);
const each_array = ensure_array_like(nav);
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
let item = each_array[$$index];
const active = isActive(item.href, store_get($$store_subs ??= {}, "$page", page).url.pathname);
$$renderer2.push(`<a${attr("href", item.href)}${attr_class(`flex items-center gap-3 px-3 py-2.5 rounded-lg transition-all duration-200 text-sm ${stringify(active ? "bg-synapse/15 text-synapse-glow border border-synapse/30 shadow-[0_0_12px_rgba(99,102,241,0.15)]" : "text-dim hover:text-text hover:bg-surface border border-transparent")}`)}><span class="text-base w-5 text-center">${escape_html(item.icon)}</span> <span class="hidden lg:block">${escape_html(item.label)}</span> <span class="hidden lg:block ml-auto text-[10px] text-muted/50 font-mono">${escape_html(item.shortcut)}</span></a>`);
}
$$renderer2.push(`<!--]--></div> <div class="px-2 pb-2"><button class="w-full flex items-center gap-2 px-3 py-2 rounded-lg text-xs text-muted hover:text-dim hover:bg-surface/50 transition border border-subtle/20"><span class="text-[10px] font-mono bg-surface/60 px-1.5 py-0.5 rounded">⌘K</span> <span class="hidden lg:block">Command</span></button></div> <div class="px-3 py-4 border-t border-subtle/20 space-y-2"><div class="flex items-center gap-2 text-xs"><div${attr_class(`w-2 h-2 rounded-full ${stringify(store_get($$store_subs ??= {}, "$isConnected", isConnected) ? "bg-recall animate-pulse-glow" : "bg-decay")}`)}></div> <span class="hidden lg:block text-dim">${escape_html(store_get($$store_subs ??= {}, "$isConnected", isConnected) ? "Connected" : "Offline")}</span></div> <div class="hidden lg:block text-xs text-muted"><div>${escape_html(store_get($$store_subs ??= {}, "$memoryCount", memoryCount))} memories</div> <div>${escape_html((store_get($$store_subs ??= {}, "$avgRetention", avgRetention) * 100).toFixed(0))}% retention</div></div></div></nav> <main class="flex-1 overflow-y-auto pb-16 md:pb-0"><div class="animate-page-in svelte-12qhfyh">`);
children($$renderer2);
$$renderer2.push(`<!----></div></main> <nav class="md:hidden fixed bottom-0 inset-x-0 bg-abyss/95 backdrop-blur-xl border-t border-subtle/30 z-40 safe-bottom svelte-12qhfyh"><div class="flex items-center justify-around px-2 py-1"><!--[-->`);
const each_array_1 = ensure_array_like(mobileNav);
for (let $$index_1 = 0, $$length = each_array_1.length; $$index_1 < $$length; $$index_1++) {
let item = each_array_1[$$index_1];
const active = isActive(item.href, store_get($$store_subs ??= {}, "$page", page).url.pathname);
$$renderer2.push(`<a${attr("href", item.href)}${attr_class(`flex flex-col items-center gap-0.5 px-3 py-2 rounded-lg transition-all min-w-[3.5rem] ${stringify(active ? "text-synapse-glow" : "text-muted")}`)}><span class="text-lg">${escape_html(item.icon)}</span> <span class="text-[9px]">${escape_html(item.label)}</span></a>`);
}
$$renderer2.push(`<!--]--> <button class="flex flex-col items-center gap-0.5 px-3 py-2 rounded-lg text-muted min-w-[3.5rem]"><span class="text-lg">⋯</span> <span class="text-[9px]">More</span></button></div></nav></div> `);
{
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]-->`);
if ($$store_subs) unsubscribe_stores($$store_subs);
});
}
export {
_layout as default
};

View file

@ -0,0 +1,24 @@
import { a as attr, b as attr_class, c as escape_html, d as stringify } from "../../chunks/index.js";
import "../../chunks/websocket.js";
function _page($$renderer, $$props) {
$$renderer.component(($$renderer2) => {
let isDreaming = false;
$$renderer2.push(`<div class="h-full relative">`);
{
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="h-full flex items-center justify-center"><div class="text-center space-y-4"><div class="w-16 h-16 mx-auto rounded-full border-2 border-synapse/30 border-t-synapse animate-spin"></div> <p class="text-dim text-sm">Loading memory graph...</p></div></div>`);
}
$$renderer2.push(`<!--]--> <div class="absolute top-4 left-4 flex gap-2 z-10"><button${attr("disabled", isDreaming, true)}${attr_class(`px-4 py-2 rounded-lg bg-dream/20 border border-dream/40 text-dream-glow text-sm hover:bg-dream/30 transition-all disabled:opacity-50 backdrop-blur-sm ${stringify("")}`)}>${escape_html("◎ Dream")}</button></div> <div class="absolute top-4 right-4 z-10 text-xs text-dim backdrop-blur-sm bg-abyss/60 rounded-lg px-3 py-2 border border-subtle/20">`);
{
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div> `);
{
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div>`);
});
}
export {
_page as default
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
import "./chunks/root.js";
import { s, a } from "./chunks/environment.js";
import { s as s2 } from "./chunks/server.js";
import { g, o, c, s as s3, a as a2, b } from "./chunks/internal.js";
export {
g as get_hooks,
o as options,
s2 as set_assets,
s as set_building,
c as set_manifest,
a as set_prerendering,
s3 as set_private_env,
a2 as set_public_env,
b as set_read_implementation
};

View file

@ -0,0 +1,104 @@
export const manifest = (() => {
function __memo(fn) {
let value;
return () => value ??= (value = fn());
}
return {
appDir: "_app",
appPath: "dashboard/_app",
assets: new Set(["favicon.svg","manifest.json"]),
mimeTypes: {".svg":"image/svg+xml",".json":"application/json"},
_: {
client: {start:"_app/immutable/entry/start.BdzkYIOY.js",app:"_app/immutable/entry/app.BBPt9AEJ.js",imports:["_app/immutable/entry/start.BdzkYIOY.js","_app/immutable/chunks/rHGvVkdq.js","_app/immutable/chunks/DleE0ac1.js","_app/immutable/chunks/DrTsYth1.js","_app/immutable/chunks/DZf5toYK.js","_app/immutable/entry/app.BBPt9AEJ.js","_app/immutable/chunks/DleE0ac1.js","_app/immutable/chunks/8PSwG_AU.js","_app/immutable/chunks/wmwKEafM.js","_app/immutable/chunks/DZf5toYK.js","_app/immutable/chunks/BHs8FnOA.js","_app/immutable/chunks/BolYP48w.js","_app/immutable/chunks/D6XtQ4nY.js","_app/immutable/chunks/D-x7U94i.js","_app/immutable/chunks/M1z6VHZC.js","_app/immutable/chunks/DrTsYth1.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},
nodes: [
__memo(() => import('./nodes/0.js')),
__memo(() => import('./nodes/1.js')),
__memo(() => import('./nodes/2.js')),
__memo(() => import('./nodes/3.js')),
__memo(() => import('./nodes/4.js')),
__memo(() => import('./nodes/5.js')),
__memo(() => import('./nodes/6.js')),
__memo(() => import('./nodes/7.js')),
__memo(() => import('./nodes/8.js')),
__memo(() => import('./nodes/9.js')),
__memo(() => import('./nodes/10.js')),
__memo(() => import('./nodes/11.js'))
],
remotes: {
},
routes: [
{
id: "/",
pattern: /^\/$/,
params: [],
page: { layouts: [0,], errors: [1,], leaf: 3 },
endpoint: null
},
{
id: "/(app)/explore",
pattern: /^\/explore\/?$/,
params: [],
page: { layouts: [0,2,], errors: [1,,], leaf: 4 },
endpoint: null
},
{
id: "/(app)/feed",
pattern: /^\/feed\/?$/,
params: [],
page: { layouts: [0,2,], errors: [1,,], leaf: 5 },
endpoint: null
},
{
id: "/(app)/graph",
pattern: /^\/graph\/?$/,
params: [],
page: { layouts: [0,2,], errors: [1,,], leaf: 6 },
endpoint: null
},
{
id: "/(app)/intentions",
pattern: /^\/intentions\/?$/,
params: [],
page: { layouts: [0,2,], errors: [1,,], leaf: 7 },
endpoint: null
},
{
id: "/(app)/memories",
pattern: /^\/memories\/?$/,
params: [],
page: { layouts: [0,2,], errors: [1,,], leaf: 8 },
endpoint: null
},
{
id: "/(app)/settings",
pattern: /^\/settings\/?$/,
params: [],
page: { layouts: [0,2,], errors: [1,,], leaf: 9 },
endpoint: null
},
{
id: "/(app)/stats",
pattern: /^\/stats\/?$/,
params: [],
page: { layouts: [0,2,], errors: [1,,], leaf: 10 },
endpoint: null
},
{
id: "/(app)/timeline",
pattern: /^\/timeline\/?$/,
params: [],
page: { layouts: [0,2,], errors: [1,,], leaf: 11 },
endpoint: null
}
],
prerendered_routes: new Set([]),
matchers: async () => {
return { };
},
server_assets: {}
}
}
})();

View file

@ -0,0 +1,104 @@
export const manifest = (() => {
function __memo(fn) {
let value;
return () => value ??= (value = fn());
}
return {
appDir: "_app",
appPath: "dashboard/_app",
assets: new Set(["favicon.svg","manifest.json"]),
mimeTypes: {".svg":"image/svg+xml",".json":"application/json"},
_: {
client: {start:"_app/immutable/entry/start.BdzkYIOY.js",app:"_app/immutable/entry/app.BBPt9AEJ.js",imports:["_app/immutable/entry/start.BdzkYIOY.js","_app/immutable/chunks/rHGvVkdq.js","_app/immutable/chunks/DleE0ac1.js","_app/immutable/chunks/DrTsYth1.js","_app/immutable/chunks/DZf5toYK.js","_app/immutable/entry/app.BBPt9AEJ.js","_app/immutable/chunks/DleE0ac1.js","_app/immutable/chunks/8PSwG_AU.js","_app/immutable/chunks/wmwKEafM.js","_app/immutable/chunks/DZf5toYK.js","_app/immutable/chunks/BHs8FnOA.js","_app/immutable/chunks/BolYP48w.js","_app/immutable/chunks/D6XtQ4nY.js","_app/immutable/chunks/D-x7U94i.js","_app/immutable/chunks/M1z6VHZC.js","_app/immutable/chunks/DrTsYth1.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},
nodes: [
__memo(() => import('./nodes/0.js')),
__memo(() => import('./nodes/1.js')),
__memo(() => import('./nodes/2.js')),
__memo(() => import('./nodes/3.js')),
__memo(() => import('./nodes/4.js')),
__memo(() => import('./nodes/5.js')),
__memo(() => import('./nodes/6.js')),
__memo(() => import('./nodes/7.js')),
__memo(() => import('./nodes/8.js')),
__memo(() => import('./nodes/9.js')),
__memo(() => import('./nodes/10.js')),
__memo(() => import('./nodes/11.js'))
],
remotes: {
},
routes: [
{
id: "/",
pattern: /^\/$/,
params: [],
page: { layouts: [0,], errors: [1,], leaf: 3 },
endpoint: null
},
{
id: "/(app)/explore",
pattern: /^\/explore\/?$/,
params: [],
page: { layouts: [0,2,], errors: [1,,], leaf: 4 },
endpoint: null
},
{
id: "/(app)/feed",
pattern: /^\/feed\/?$/,
params: [],
page: { layouts: [0,2,], errors: [1,,], leaf: 5 },
endpoint: null
},
{
id: "/(app)/graph",
pattern: /^\/graph\/?$/,
params: [],
page: { layouts: [0,2,], errors: [1,,], leaf: 6 },
endpoint: null
},
{
id: "/(app)/intentions",
pattern: /^\/intentions\/?$/,
params: [],
page: { layouts: [0,2,], errors: [1,,], leaf: 7 },
endpoint: null
},
{
id: "/(app)/memories",
pattern: /^\/memories\/?$/,
params: [],
page: { layouts: [0,2,], errors: [1,,], leaf: 8 },
endpoint: null
},
{
id: "/(app)/settings",
pattern: /^\/settings\/?$/,
params: [],
page: { layouts: [0,2,], errors: [1,,], leaf: 9 },
endpoint: null
},
{
id: "/(app)/stats",
pattern: /^\/stats\/?$/,
params: [],
page: { layouts: [0,2,], errors: [1,,], leaf: 10 },
endpoint: null
},
{
id: "/(app)/timeline",
pattern: /^\/timeline\/?$/,
params: [],
page: { layouts: [0,2,], errors: [1,,], leaf: 11 },
endpoint: null
}
],
prerendered_routes: new Set([]),
matchers: async () => {
return { };
},
server_assets: {}
}
}
})();

View file

@ -0,0 +1,8 @@
export const index = 0;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/pages/_layout.svelte.js')).default;
export const imports = ["_app/immutable/nodes/0.CVv5sZN_.js","_app/immutable/chunks/wmwKEafM.js","_app/immutable/chunks/DleE0ac1.js","_app/immutable/chunks/DZf5toYK.js","_app/immutable/chunks/8PSwG_AU.js","_app/immutable/chunks/BHs8FnOA.js","_app/immutable/chunks/BolYP48w.js","_app/immutable/chunks/BsRos8Kb.js","_app/immutable/chunks/CVDMn5X_.js","_app/immutable/chunks/ChQRIhGP.js","_app/immutable/chunks/BK028jHP.js","_app/immutable/chunks/D6XtQ4nY.js","_app/immutable/chunks/M1z6VHZC.js","_app/immutable/chunks/DrTsYth1.js","_app/immutable/chunks/rHGvVkdq.js","_app/immutable/chunks/kVvujbiQ.js"];
export const stylesheets = ["_app/immutable/assets/0.T9JGZ_uB.css"];
export const fonts = [];

View file

@ -0,0 +1,8 @@
export const index = 1;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/fallbacks/error.svelte.js')).default;
export const imports = ["_app/immutable/nodes/1.wR9SFDr_.js","_app/immutable/chunks/wmwKEafM.js","_app/immutable/chunks/DleE0ac1.js","_app/immutable/chunks/CtRgAcWZ.js","_app/immutable/chunks/8PSwG_AU.js","_app/immutable/chunks/rHGvVkdq.js","_app/immutable/chunks/DrTsYth1.js","_app/immutable/chunks/DZf5toYK.js"];
export const stylesheets = [];
export const fonts = [];

View file

@ -0,0 +1,8 @@
export const index = 10;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/pages/(app)/stats/_page.svelte.js')).default;
export const imports = ["_app/immutable/nodes/10.MRR5NpnA.js","_app/immutable/chunks/wmwKEafM.js","_app/immutable/chunks/DleE0ac1.js","_app/immutable/chunks/DZf5toYK.js","_app/immutable/chunks/8PSwG_AU.js","_app/immutable/chunks/BHs8FnOA.js","_app/immutable/chunks/BolYP48w.js","_app/immutable/chunks/BsRos8Kb.js","_app/immutable/chunks/D6n3ggvw.js","_app/immutable/chunks/BcuCGYSa.js"];
export const stylesheets = [];
export const fonts = [];

View file

@ -0,0 +1,8 @@
export const index = 11;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/pages/(app)/timeline/_page.svelte.js')).default;
export const imports = ["_app/immutable/nodes/11.DwFmilUf.js","_app/immutable/chunks/wmwKEafM.js","_app/immutable/chunks/DleE0ac1.js","_app/immutable/chunks/DZf5toYK.js","_app/immutable/chunks/8PSwG_AU.js","_app/immutable/chunks/BHs8FnOA.js","_app/immutable/chunks/BolYP48w.js","_app/immutable/chunks/BsRos8Kb.js","_app/immutable/chunks/D6n3ggvw.js","_app/immutable/chunks/DYdHPHRa.js","_app/immutable/chunks/BcuCGYSa.js","_app/immutable/chunks/CHfZNXj4.js"];
export const stylesheets = [];
export const fonts = [];

View file

@ -0,0 +1,8 @@
export const index = 2;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/pages/(app)/_layout.svelte.js')).default;
export const imports = ["_app/immutable/nodes/2.VW3Ep--L.js","_app/immutable/chunks/wmwKEafM.js","_app/immutable/chunks/DleE0ac1.js","_app/immutable/chunks/CVDMn5X_.js","_app/immutable/chunks/BolYP48w.js"];
export const stylesheets = [];
export const fonts = [];

View file

@ -0,0 +1,8 @@
export const index = 3;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/pages/_page.svelte.js')).default;
export const imports = ["_app/immutable/nodes/3.DlJxvrxN.js","_app/immutable/chunks/wmwKEafM.js","_app/immutable/chunks/DleE0ac1.js","_app/immutable/chunks/DZf5toYK.js","_app/immutable/chunks/8PSwG_AU.js","_app/immutable/chunks/BHs8FnOA.js","_app/immutable/chunks/BolYP48w.js","_app/immutable/chunks/BsRos8Kb.js","_app/immutable/chunks/BK028jHP.js","_app/immutable/chunks/D6n3ggvw.js","_app/immutable/chunks/M1z6VHZC.js","_app/immutable/chunks/DrTsYth1.js","_app/immutable/chunks/CVZIBdRK.js","_app/immutable/chunks/D6XtQ4nY.js","_app/immutable/chunks/D-x7U94i.js","_app/immutable/chunks/CHfZNXj4.js","_app/immutable/chunks/BcuCGYSa.js","_app/immutable/chunks/kVvujbiQ.js"];
export const stylesheets = [];
export const fonts = [];

View file

@ -0,0 +1,8 @@
export const index = 4;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/pages/(app)/explore/_page.svelte.js')).default;
export const imports = ["_app/immutable/nodes/4.JZRJcAXm.js","_app/immutable/chunks/wmwKEafM.js","_app/immutable/chunks/DleE0ac1.js","_app/immutable/chunks/8PSwG_AU.js","_app/immutable/chunks/BHs8FnOA.js","_app/immutable/chunks/BolYP48w.js","_app/immutable/chunks/BsRos8Kb.js","_app/immutable/chunks/ChQRIhGP.js","_app/immutable/chunks/BK028jHP.js","_app/immutable/chunks/D6n3ggvw.js","_app/immutable/chunks/BcuCGYSa.js"];
export const stylesheets = [];
export const fonts = [];

View file

@ -0,0 +1,8 @@
export const index = 5;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/pages/(app)/feed/_page.svelte.js')).default;
export const imports = ["_app/immutable/nodes/5.CJ3qOnwc.js","_app/immutable/chunks/wmwKEafM.js","_app/immutable/chunks/DleE0ac1.js","_app/immutable/chunks/CtRgAcWZ.js","_app/immutable/chunks/8PSwG_AU.js","_app/immutable/chunks/BHs8FnOA.js","_app/immutable/chunks/BolYP48w.js","_app/immutable/chunks/BsRos8Kb.js","_app/immutable/chunks/D6n3ggvw.js","_app/immutable/chunks/M1z6VHZC.js","_app/immutable/chunks/DrTsYth1.js","_app/immutable/chunks/kVvujbiQ.js","_app/immutable/chunks/CHfZNXj4.js"];
export const stylesheets = [];
export const fonts = [];

View file

@ -0,0 +1,8 @@
export const index = 6;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/pages/(app)/graph/_page.svelte.js')).default;
export const imports = ["_app/immutable/nodes/6.BbuG7uIt.js","_app/immutable/chunks/wmwKEafM.js","_app/immutable/chunks/DleE0ac1.js","_app/immutable/chunks/DZf5toYK.js","_app/immutable/chunks/8PSwG_AU.js","_app/immutable/chunks/BHs8FnOA.js","_app/immutable/chunks/BolYP48w.js","_app/immutable/chunks/BsRos8Kb.js","_app/immutable/chunks/ChQRIhGP.js","_app/immutable/chunks/BK028jHP.js","_app/immutable/chunks/D6n3ggvw.js","_app/immutable/chunks/DYdHPHRa.js","_app/immutable/chunks/M1z6VHZC.js","_app/immutable/chunks/DrTsYth1.js","_app/immutable/chunks/CVZIBdRK.js","_app/immutable/chunks/D6XtQ4nY.js","_app/immutable/chunks/D-x7U94i.js","_app/immutable/chunks/CHfZNXj4.js","_app/immutable/chunks/BcuCGYSa.js","_app/immutable/chunks/kVvujbiQ.js"];
export const stylesheets = [];
export const fonts = [];

View file

@ -0,0 +1,8 @@
export const index = 7;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/pages/(app)/intentions/_page.svelte.js')).default;
export const imports = ["_app/immutable/nodes/7.CenRva5o.js","_app/immutable/chunks/wmwKEafM.js","_app/immutable/chunks/DleE0ac1.js","_app/immutable/chunks/DZf5toYK.js","_app/immutable/chunks/8PSwG_AU.js","_app/immutable/chunks/BHs8FnOA.js","_app/immutable/chunks/BolYP48w.js","_app/immutable/chunks/BsRos8Kb.js","_app/immutable/chunks/BK028jHP.js","_app/immutable/chunks/BcuCGYSa.js"];
export const stylesheets = [];
export const fonts = [];

View file

@ -0,0 +1,8 @@
export const index = 8;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/pages/(app)/memories/_page.svelte.js')).default;
export const imports = ["_app/immutable/nodes/8.Dd_gKrfw.js","_app/immutable/chunks/wmwKEafM.js","_app/immutable/chunks/DleE0ac1.js","_app/immutable/chunks/DZf5toYK.js","_app/immutable/chunks/8PSwG_AU.js","_app/immutable/chunks/BHs8FnOA.js","_app/immutable/chunks/BolYP48w.js","_app/immutable/chunks/BsRos8Kb.js","_app/immutable/chunks/ChQRIhGP.js","_app/immutable/chunks/BK028jHP.js","_app/immutable/chunks/D6n3ggvw.js","_app/immutable/chunks/DYdHPHRa.js","_app/immutable/chunks/BcuCGYSa.js","_app/immutable/chunks/CHfZNXj4.js"];
export const stylesheets = [];
export const fonts = [];

View file

@ -0,0 +1,8 @@
export const index = 9;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/pages/(app)/settings/_page.svelte.js')).default;
export const imports = ["_app/immutable/nodes/9.CFdF6F7Z.js","_app/immutable/chunks/wmwKEafM.js","_app/immutable/chunks/DleE0ac1.js","_app/immutable/chunks/8PSwG_AU.js","_app/immutable/chunks/BHs8FnOA.js","_app/immutable/chunks/BolYP48w.js","_app/immutable/chunks/BsRos8Kb.js","_app/immutable/chunks/BK028jHP.js","_app/immutable/chunks/D6n3ggvw.js","_app/immutable/chunks/M1z6VHZC.js","_app/immutable/chunks/DrTsYth1.js","_app/immutable/chunks/BcuCGYSa.js","_app/immutable/chunks/kVvujbiQ.js"];
export const stylesheets = [];
export const fonts = [];

View file

@ -0,0 +1,557 @@
import { get_request_store, with_request_store } from "@sveltejs/kit/internal/server";
import { error, json } from "@sveltejs/kit";
import { v as stringify_remote_arg, w as parse, x as flatten_issues, y as create_field_proxy, z as normalize_issue, A as set_nested_value, B as deep_set, l as stringify, j as create_remote_key, h as handle_error_and_jsonify } from "./chunks/shared.js";
import { ValidationError, HttpError, SvelteKitError } from "@sveltejs/kit/internal";
import { B as BROWSER } from "./chunks/utils.js";
import { b as base, c as app_dir } from "./chunks/server.js";
import { p as prerendering } from "./chunks/environment.js";
function create_validator(validate_or_fn, maybe_fn) {
if (!maybe_fn) {
return (arg) => {
if (arg !== void 0) {
error(400, "Bad Request");
}
};
}
if (validate_or_fn === "unchecked") {
return (arg) => arg;
}
if ("~standard" in validate_or_fn) {
return async (arg) => {
const { event, state } = get_request_store();
const result = await validate_or_fn["~standard"].validate(arg);
if (result.issues) {
error(
400,
await state.handleValidationError({
issues: result.issues,
event
})
);
}
return result.value;
};
}
throw new Error(
'Invalid validator passed to remote function. Expected "unchecked" or a Standard Schema (https://standardschema.dev)'
);
}
async function get_response(info, arg, state, get_result) {
await 0;
const cache = get_cache(info, state);
return cache[stringify_remote_arg(arg, state.transport)] ??= get_result();
}
function parse_remote_response(data, transport) {
const revivers = {};
for (const key in transport) {
revivers[key] = transport[key].decode;
}
return parse(data, revivers);
}
async function run_remote_function(event, state, allow_cookies, get_input, fn) {
const store = {
event: {
...event,
setHeaders: () => {
throw new Error("setHeaders is not allowed in remote functions");
},
cookies: {
...event.cookies,
set: (name, value, opts) => {
if (!allow_cookies) {
throw new Error("Cannot set cookies in `query` or `prerender` functions");
}
if (opts.path && !opts.path.startsWith("/")) {
throw new Error("Cookies set in remote functions must have an absolute path");
}
return event.cookies.set(name, value, opts);
},
delete: (name, opts) => {
if (!allow_cookies) {
throw new Error("Cannot delete cookies in `query` or `prerender` functions");
}
if (opts.path && !opts.path.startsWith("/")) {
throw new Error("Cookies deleted in remote functions must have an absolute path");
}
return event.cookies.delete(name, opts);
}
}
},
state: {
...state,
is_in_remote_function: true
}
};
const input = await with_request_store(store, get_input);
return with_request_store(store, () => fn(input));
}
function get_cache(info, state = get_request_store().state) {
let cache = state.remote_data?.get(info);
if (cache === void 0) {
cache = {};
(state.remote_data ??= /* @__PURE__ */ new Map()).set(info, cache);
}
return cache;
}
// @__NO_SIDE_EFFECTS__
function command(validate_or_fn, maybe_fn) {
const fn = maybe_fn ?? validate_or_fn;
const validate = create_validator(validate_or_fn, maybe_fn);
const __ = { type: "command", id: "", name: "" };
const wrapper = (arg) => {
const { event, state } = get_request_store();
if (state.is_endpoint_request) {
if (!["POST", "PUT", "PATCH", "DELETE"].includes(event.request.method)) {
throw new Error(
`Cannot call a command (\`${__.name}(${maybe_fn ? "..." : ""})\`) from a ${event.request.method} handler`
);
}
} else if (!event.isRemoteRequest) {
throw new Error(
`Cannot call a command (\`${__.name}(${maybe_fn ? "..." : ""})\`) during server-side rendering`
);
}
state.refreshes ??= {};
const promise = Promise.resolve(
run_remote_function(event, state, true, () => validate(arg), fn)
);
promise.updates = () => {
throw new Error(`Cannot call '${__.name}(...).updates(...)' on the server`);
};
return (
/** @type {ReturnType<RemoteCommand<Input, Output>>} */
promise
);
};
Object.defineProperty(wrapper, "__", { value: __ });
Object.defineProperty(wrapper, "pending", {
get: () => 0
});
return wrapper;
}
// @__NO_SIDE_EFFECTS__
function form(validate_or_fn, maybe_fn) {
const fn = maybe_fn ?? validate_or_fn;
const schema = !maybe_fn || validate_or_fn === "unchecked" ? null : (
/** @type {any} */
validate_or_fn
);
function create_instance(key) {
const instance = {};
instance.method = "POST";
Object.defineProperty(instance, "enhance", {
value: () => {
return { action: instance.action, method: instance.method };
}
});
const __ = {
type: "form",
name: "",
id: "",
fn: async (data, meta, form_data) => {
const output = {};
output.submission = true;
const { event, state } = get_request_store();
const validated = await schema?.["~standard"].validate(data);
if (meta.validate_only) {
return validated?.issues?.map((issue) => normalize_issue(issue, true)) ?? [];
}
if (validated?.issues !== void 0) {
handle_issues(output, validated.issues, form_data);
} else {
if (validated !== void 0) {
data = validated.value;
}
state.refreshes ??= {};
const issue = create_issues();
try {
output.result = await run_remote_function(
event,
state,
true,
() => data,
(data2) => !maybe_fn ? fn() : fn(data2, issue)
);
} catch (e) {
if (e instanceof ValidationError) {
handle_issues(output, e.issues, form_data);
} else {
throw e;
}
}
}
if (!event.isRemoteRequest) {
get_cache(__, state)[""] ??= output;
}
return output;
}
};
Object.defineProperty(instance, "__", { value: __ });
Object.defineProperty(instance, "action", {
get: () => `?/remote=${__.id}`,
enumerable: true
});
Object.defineProperty(instance, "fields", {
get() {
const data = get_cache(__)?.[""];
const issues = flatten_issues(data?.issues ?? []);
return create_field_proxy(
{},
() => data?.input ?? {},
(path, value) => {
if (data?.submission) {
return;
}
const input = path.length === 0 ? value : deep_set(data?.input ?? {}, path.map(String), value);
(get_cache(__)[""] ??= {}).input = input;
},
() => issues
);
}
});
Object.defineProperty(instance, "result", {
get() {
try {
return get_cache(__)?.[""]?.result;
} catch {
return void 0;
}
}
});
Object.defineProperty(instance, "pending", {
get: () => 0
});
Object.defineProperty(instance, "preflight", {
// preflight is a noop on the server
value: () => instance
});
Object.defineProperty(instance, "validate", {
value: () => {
throw new Error("Cannot call validate() on the server");
}
});
if (key == void 0) {
Object.defineProperty(instance, "for", {
/** @type {RemoteForm<any, any>['for']} */
value: (key2) => {
const { state } = get_request_store();
const cache_key = __.id + "|" + JSON.stringify(key2);
let instance2 = (state.form_instances ??= /* @__PURE__ */ new Map()).get(cache_key);
if (!instance2) {
instance2 = create_instance(key2);
instance2.__.id = `${__.id}/${encodeURIComponent(JSON.stringify(key2))}`;
instance2.__.name = __.name;
state.form_instances.set(cache_key, instance2);
}
return instance2;
}
});
}
return instance;
}
return create_instance();
}
function handle_issues(output, issues, form_data) {
output.issues = issues.map((issue) => normalize_issue(issue, true));
if (form_data) {
output.input = {};
for (let key of form_data.keys()) {
if (/^[.\]]?_/.test(key)) continue;
const is_array = key.endsWith("[]");
const values = form_data.getAll(key).filter((value) => typeof value === "string");
if (is_array) key = key.slice(0, -2);
set_nested_value(
/** @type {Record<string, any>} */
output.input,
key,
is_array ? values : values[0]
);
}
}
}
function create_issues() {
return (
/** @type {InvalidField<any>} */
new Proxy(
/** @param {string} message */
(message) => {
if (typeof message !== "string") {
throw new Error(
"`invalid` should now be imported from `@sveltejs/kit` to throw validation issues. The second parameter provided to the form function (renamed to `issue`) is still used to construct issues, e.g. `invalid(issue.field('message'))`. For more info see https://github.com/sveltejs/kit/pulls/14768"
);
}
return create_issue(message);
},
{
get(target, prop) {
if (typeof prop === "symbol") return (
/** @type {any} */
target[prop]
);
return create_issue_proxy(prop, []);
}
}
)
);
function create_issue(message, path = []) {
return {
message,
path
};
}
function create_issue_proxy(key, path) {
const new_path = [...path, key];
const issue_func = (message) => create_issue(message, new_path);
return new Proxy(issue_func, {
get(target, prop) {
if (typeof prop === "symbol") return (
/** @type {any} */
target[prop]
);
if (/^\d+$/.test(prop)) {
return create_issue_proxy(parseInt(prop, 10), new_path);
}
return create_issue_proxy(prop, new_path);
}
});
}
}
// @__NO_SIDE_EFFECTS__
function prerender(validate_or_fn, fn_or_options, maybe_options) {
const maybe_fn = typeof fn_or_options === "function" ? fn_or_options : void 0;
const options = maybe_options ?? (maybe_fn ? void 0 : fn_or_options);
const fn = maybe_fn ?? validate_or_fn;
const validate = create_validator(validate_or_fn, maybe_fn);
const __ = {
type: "prerender",
id: "",
name: "",
has_arg: !!maybe_fn,
inputs: options?.inputs,
dynamic: options?.dynamic
};
const wrapper = (arg) => {
const promise = (async () => {
const { event, state } = get_request_store();
const payload = stringify_remote_arg(arg, state.transport);
const id = __.id;
const url = `${base}/${app_dir}/remote/${id}${payload ? `/${payload}` : ""}`;
if (!state.prerendering && !BROWSER && !event.isRemoteRequest) {
try {
return await get_response(__, arg, state, async () => {
const key = stringify_remote_arg(arg, state.transport);
const cache = get_cache(__, state);
const promise3 = cache[key] ??= fetch(new URL(url, event.url.origin).href).then(
async (response) => {
if (!response.ok) {
throw new Error("Prerendered response not found");
}
const prerendered = await response.json();
if (prerendered.type === "error") {
error(prerendered.status, prerendered.error);
}
return prerendered.result;
}
);
return parse_remote_response(await promise3, state.transport);
});
} catch {
}
}
if (state.prerendering?.remote_responses.has(url)) {
return (
/** @type {Promise<any>} */
state.prerendering.remote_responses.get(url)
);
}
const promise2 = get_response(
__,
arg,
state,
() => run_remote_function(event, state, false, () => validate(arg), fn)
);
if (state.prerendering) {
state.prerendering.remote_responses.set(url, promise2);
}
const result = await promise2;
if (state.prerendering) {
const body = { type: "result", result: stringify(result, state.transport) };
state.prerendering.dependencies.set(url, {
body: JSON.stringify(body),
response: json(body)
});
}
return result;
})();
promise.catch(() => {
});
return (
/** @type {RemoteResource<Output>} */
promise
);
};
Object.defineProperty(wrapper, "__", { value: __ });
return wrapper;
}
// @__NO_SIDE_EFFECTS__
function query(validate_or_fn, maybe_fn) {
const fn = maybe_fn ?? validate_or_fn;
const validate = create_validator(validate_or_fn, maybe_fn);
const __ = { type: "query", id: "", name: "" };
const wrapper = (arg) => {
if (prerendering) {
throw new Error(
`Cannot call query '${__.name}' while prerendering, as prerendered pages need static data. Use 'prerender' from $app/server instead`
);
}
const { event, state } = get_request_store();
const get_remote_function_result = () => run_remote_function(event, state, false, () => validate(arg), fn);
const promise = get_response(__, arg, state, get_remote_function_result);
promise.catch(() => {
});
promise.set = (value) => update_refresh_value(get_refresh_context(__, "set", arg), value);
promise.refresh = () => {
const refresh_context = get_refresh_context(__, "refresh", arg);
const is_immediate_refresh = !refresh_context.cache[refresh_context.cache_key];
const value = is_immediate_refresh ? promise : get_remote_function_result();
return update_refresh_value(refresh_context, value, is_immediate_refresh);
};
promise.withOverride = () => {
throw new Error(`Cannot call '${__.name}.withOverride()' on the server`);
};
return (
/** @type {RemoteQuery<Output>} */
promise
);
};
Object.defineProperty(wrapper, "__", { value: __ });
return wrapper;
}
// @__NO_SIDE_EFFECTS__
function batch(validate_or_fn, maybe_fn) {
const fn = maybe_fn ?? validate_or_fn;
const validate = create_validator(validate_or_fn, maybe_fn);
const __ = {
type: "query_batch",
id: "",
name: "",
run: async (args, options) => {
const { event, state } = get_request_store();
return run_remote_function(
event,
state,
false,
async () => Promise.all(args.map(validate)),
async (input) => {
const get_result = await fn(input);
return Promise.all(
input.map(async (arg, i) => {
try {
return { type: "result", data: get_result(arg, i) };
} catch (error2) {
return {
type: "error",
error: await handle_error_and_jsonify(event, state, options, error2),
status: error2 instanceof HttpError || error2 instanceof SvelteKitError ? error2.status : 500
};
}
})
);
}
);
}
};
let batching = { args: [], resolvers: [] };
const wrapper = (arg) => {
if (prerendering) {
throw new Error(
`Cannot call query.batch '${__.name}' while prerendering, as prerendered pages need static data. Use 'prerender' from $app/server instead`
);
}
const { event, state } = get_request_store();
const get_remote_function_result = () => {
return new Promise((resolve, reject) => {
batching.args.push(arg);
batching.resolvers.push({ resolve, reject });
if (batching.args.length > 1) return;
setTimeout(async () => {
const batched = batching;
batching = { args: [], resolvers: [] };
try {
return await run_remote_function(
event,
state,
false,
async () => Promise.all(batched.args.map(validate)),
async (input) => {
const get_result = await fn(input);
for (let i = 0; i < batched.resolvers.length; i++) {
try {
batched.resolvers[i].resolve(get_result(input[i], i));
} catch (error2) {
batched.resolvers[i].reject(error2);
}
}
}
);
} catch (error2) {
for (const resolver of batched.resolvers) {
resolver.reject(error2);
}
}
}, 0);
});
};
const promise = get_response(__, arg, state, get_remote_function_result);
promise.catch(() => {
});
promise.set = (value) => update_refresh_value(get_refresh_context(__, "set", arg), value);
promise.refresh = () => {
const refresh_context = get_refresh_context(__, "refresh", arg);
const is_immediate_refresh = !refresh_context.cache[refresh_context.cache_key];
const value = is_immediate_refresh ? promise : get_remote_function_result();
return update_refresh_value(refresh_context, value, is_immediate_refresh);
};
promise.withOverride = () => {
throw new Error(`Cannot call '${__.name}.withOverride()' on the server`);
};
return (
/** @type {RemoteQuery<Output>} */
promise
);
};
Object.defineProperty(wrapper, "__", { value: __ });
return wrapper;
}
Object.defineProperty(query, "batch", { value: batch, enumerable: true });
function get_refresh_context(__, action, arg) {
const { state } = get_request_store();
const { refreshes } = state;
if (!refreshes) {
const name = __.type === "query_batch" ? `query.batch '${__.name}'` : `query '${__.name}'`;
throw new Error(
`Cannot call ${action} on ${name} because it is not executed in the context of a command/form remote function`
);
}
const cache = get_cache(__, state);
const cache_key = stringify_remote_arg(arg, state.transport);
const refreshes_key = create_remote_key(__.id, cache_key);
return { __, state, refreshes, refreshes_key, cache, cache_key };
}
function update_refresh_value({ __, refreshes, refreshes_key, cache, cache_key }, value, is_immediate_refresh = false) {
const promise = Promise.resolve(value);
if (!is_immediate_refresh) {
cache[cache_key] = promise;
}
if (__.id) {
refreshes[refreshes_key] = promise;
}
return promise.then(() => {
});
}
export {
command,
form,
prerender,
query
};