srvmd 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ARCHITECTURE.md CHANGED
@@ -158,11 +158,25 @@ sequenceDiagram
158
158
  - 不存在的路径返回壳,HTTP 状态为 404,Svelte 渲染错误页。
159
159
  - `-s` 回退到 `index.html` 时仍按用户静态 HTML 返回;回退到 `index.md` 时走 Svelte 壳。
160
160
 
161
+ ## 实时刷新
162
+
163
+ - watcher 监听 root 下的每个目录;文件写入和目录增删都会产生事件,事件在 `WATCH_DEBOUNCE_MS` 后合并发送,持续写入时由 `WATCH_MAX_WAIT_MS` 强制 flush。
164
+ - WebSocket 载荷为 `{ type: "reload", files: string[] }`,`files` 是相对 root 的路径(POSIX 分隔符),目录路径不带结尾 `/`。
165
+ - 服务端先 `documents.invalidate()` 再广播,客户端重取时不会命中旧缓存;只有 Markdown 路径会进入文档缓存。
166
+ - 浏览器不会一有事件就重取:`web/src/features/live/live.ts` 用与 resolver 一致的 clean URL 规则判断事件是否影响当前页。目录页对子树变更敏感,文档页只对自身源文件敏感(`/guide/` 上的 `guide/index.md` 不会因 `guide/other.md` 重取),`--single` 模式下全量刷新,CSS 变更触发整页 reload。
167
+ - 条件重取使用 `ETag` / `If-None-Match`;命中 304 时保留当前页面状态。
168
+ - 静态 HTML 页面不参与上述判断,`/__app/live-static.js` 收到任何事件都会整页 reload。
169
+
170
+ ## Page API 的条件请求
171
+
172
+ `GET /__api/page/*` 返回 `ETag` 并支持 `If-None-Match`(弱比较,支持 `*`)。ETag 由配置项、URL、源文件相对路径和内容 revision 组合而成;页面数据字段变化时必须在 `server/routes/page-api.ts` 的 `documentEtag` / `directoryEtag` 同步,否则条件请求会返回过期的 304。
173
+
161
174
  ## 页面数据契约
162
175
 
163
176
  ```typescript
164
177
  type DocumentPayload = {
165
178
  kind: "document";
179
+ path: string;
166
180
  title: string;
167
181
  html: string;
168
182
  toc: TocItem[];
@@ -175,6 +189,7 @@ type DocumentPayload = {
175
189
 
176
190
  type DirectoryPayload = {
177
191
  kind: "directory";
192
+ path: string;
178
193
  heading: string;
179
194
  parentHref?: string;
180
195
  entries: DirEntry[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "srvmd",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Static file server with live-reloading Markdown rendering, built on Bun",
5
5
  "type": "module",
6
6
  "bin": {
@@ -29,5 +29,5 @@ export const MAX_HTML_INJECTION_BYTES = 5 * 1024 * 1024;
29
29
 
30
30
  export const WATCH_DEBOUNCE_MS = 80;
31
31
 
32
- /** Suffixes tried when resolving extensionless (clean) URLs, in order. */
33
- export const CLEAN_URL_SUFFIXES = [".md", ".markdown", ".html", ".htm"] as const;
32
+ /** Upper bound for a write burst; without it a resetting debounce never fires. */
33
+ export const WATCH_MAX_WAIT_MS = 250;
@@ -1,5 +1,6 @@
1
1
  import type { Highlighter } from "shiki";
2
2
  import type { ResolvedConfig } from "./config.ts";
3
+ import { isMarkdownFile } from "./file-kinds.ts";
3
4
  import { createHighlighterService, createRenderer, type Renderer } from "./markdown/index.ts";
4
5
  import { createDocumentStore, type DocumentStore } from "./services/documents.ts";
5
6
  import { createLiveReload, type LiveReload } from "./services/live/index.ts";
@@ -27,7 +28,8 @@ export async function createContext(config: ResolvedConfig): Promise<ServerConte
27
28
  ? await createLiveReload({
28
29
  root: config.root,
29
30
  ignore: config.ignore,
30
- onChange: () => documents.clear(),
31
+ // Directory and stylesheet events never enter the document cache.
32
+ onChange: files => documents.invalidate(files.filter(isMarkdownFile)),
31
33
  })
32
34
  : null;
33
35
 
@@ -47,10 +47,18 @@ export function methodNotAllowedResponse(cors: boolean): Response {
47
47
  return new Response("Method Not Allowed", { status: 405, headers });
48
48
  }
49
49
 
50
- function bodyResponse(body: string, status: number, method: string, cors: boolean, contentType: string): Response {
50
+ function bodyResponse(
51
+ body: string,
52
+ status: number,
53
+ method: string,
54
+ cors: boolean,
55
+ contentType: string,
56
+ etag?: string,
57
+ ): Response {
51
58
  const headers = baseHeaders(cors);
52
59
  headers.set("Content-Type", contentType);
53
60
  headers.set("Cache-Control", "no-store");
61
+ if (etag) headers.set("ETag", etag);
54
62
 
55
63
  if (method === "HEAD") {
56
64
  headers.set("Content-Length", String(Buffer.byteLength(body)));
@@ -60,8 +68,15 @@ function bodyResponse(body: string, status: number, method: string, cors: boolea
60
68
  return new Response(body, { status, headers });
61
69
  }
62
70
 
63
- export function jsonResponse(body: unknown, status: number, method: string, cors: boolean): Response {
64
- return bodyResponse(JSON.stringify(body), status, method, cors, "application/json; charset=utf-8");
71
+ export function jsonResponse(body: unknown, status: number, method: string, cors: boolean, etag?: string): Response {
72
+ return bodyResponse(JSON.stringify(body), status, method, cors, "application/json; charset=utf-8", etag);
73
+ }
74
+
75
+ export function notModifiedResponse(etag: string, cors: boolean): Response {
76
+ const headers = baseHeaders(cors);
77
+ headers.set("Cache-Control", "no-store");
78
+ headers.set("ETag", etag);
79
+ return new Response(null, { status: 304, headers });
65
80
  }
66
81
 
67
82
  export function jsonError(status: number, message: string, method: string, cors: boolean): Response {
@@ -19,15 +19,26 @@ export function applyValidators(headers: Headers, validators: Validators): void
19
19
  headers.set("Accept-Ranges", "bytes");
20
20
  }
21
21
 
22
+ /** Compare an If-None-Match header with a weak ETag (or `*`). */
23
+ export function matchesEtag(header: string | null, etag: string): boolean {
24
+ if (!header) return false;
25
+
26
+ const opaque = (value: string) => (value.startsWith("W/") ? value.slice(2) : value);
27
+ const expected = opaque(etag);
28
+
29
+ return header.split(",").some(value => {
30
+ const candidate = value.trim();
31
+ return candidate === "*" || opaque(candidate) === expected;
32
+ });
33
+ }
34
+
22
35
  /**
23
36
  * Evaluate If-None-Match first, then If-Modified-Since (the same precedence
24
37
  * RFC 9110 requires). Returns true when the client already has this version.
25
38
  */
26
39
  export function isNotModified(request: Request, validators: Validators, stats: Stats): boolean {
27
40
  const noneMatch = request.headers.get("if-none-match");
28
- if (noneMatch) {
29
- return noneMatch.split(",").some(value => value.trim() === validators.etag);
30
- }
41
+ if (noneMatch) return matchesEtag(noneMatch, validators.etag);
31
42
 
32
43
  const modifiedSince = request.headers.get("if-modified-since");
33
44
  if (!modifiedSince) return false;
@@ -42,6 +42,51 @@ const PRELOADED_LANGUAGES = [
42
42
  const CODE_BLOCK_RE = /<pre><code class="language-([^"]+)">([\s\S]*?)<\/code><\/pre>/g;
43
43
  const FENCE_RE = /^(?:```|~~~)[ \t]*([A-Za-z0-9_+#.-]+)/gm;
44
44
 
45
+ /** Per-highlighter output cache. Most code blocks survive a document edit unchanged. */
46
+ const MAX_CACHE_CHARS = 4 * 1024 * 1024;
47
+
48
+ type HighlightCache = {
49
+ entries: Map<string, string>;
50
+ chars: number;
51
+ };
52
+
53
+ const caches = new WeakMap<Highlighter, HighlightCache>();
54
+
55
+ function cacheFor(highlighter: Highlighter): HighlightCache {
56
+ let cache = caches.get(highlighter);
57
+ if (!cache) {
58
+ cache = { entries: new Map(), chars: 0 };
59
+ caches.set(highlighter, cache);
60
+ }
61
+ return cache;
62
+ }
63
+
64
+ function recall(cache: HighlightCache, key: string): string | undefined {
65
+ const value = cache.entries.get(key);
66
+ if (value === undefined) return undefined;
67
+
68
+ // Refresh LRU order.
69
+ cache.entries.delete(key);
70
+ cache.entries.set(key, value);
71
+ return value;
72
+ }
73
+
74
+ function remember(cache: HighlightCache, key: string, value: string): void {
75
+ const cost = key.length + value.length;
76
+ if (cost > MAX_CACHE_CHARS) return;
77
+
78
+ cache.entries.set(key, value);
79
+ cache.chars += cost;
80
+
81
+ while (cache.chars > MAX_CACHE_CHARS) {
82
+ const oldest = cache.entries.entries().next().value;
83
+ if (!oldest) break;
84
+ const [oldKey, oldValue] = oldest;
85
+ cache.entries.delete(oldKey);
86
+ cache.chars -= oldKey.length + oldValue.length;
87
+ }
88
+ }
89
+
45
90
  /**
46
91
  * Create a highlighter instance. Returns null when highlighting is
47
92
  * unavailable so callers can continue without it. No module-level singleton:
@@ -86,13 +131,23 @@ export async function ensureLanguages(
86
131
  }
87
132
 
88
133
  export function highlightCodeBlocks(html: string, highlighter: Highlighter): string {
134
+ const cache = cacheFor(highlighter);
135
+
89
136
  return html.replace(CODE_BLOCK_RE, (match, language: string, escaped: string) => {
90
137
  const code = decodeEntities(escaped).replace(/\n$/, "");
138
+ // The key covers everything codeToHtml() depends on: language, code and
139
+ // the fixed theme pair above. Add the theme here if it ever becomes configurable.
140
+ const key = `${language}\0${code}`;
141
+ const cached = recall(cache, key);
142
+ if (cached !== undefined) return cached;
143
+
91
144
  try {
92
- return highlighter.codeToHtml(code, {
145
+ const highlighted = highlighter.codeToHtml(code, {
93
146
  lang: language,
94
147
  themes: { light: THEMES.light, dark: THEMES.dark },
95
148
  });
149
+ remember(cache, key, highlighted);
150
+ return highlighted;
96
151
  } catch {
97
152
  return match;
98
153
  }
@@ -1,5 +1,5 @@
1
1
  import { extname } from "node:path";
2
- import { CLEAN_URL_SUFFIXES } from "../constants.ts";
2
+ import { CLEAN_URL_SUFFIXES } from "../../shared/constants.ts";
3
3
  import { isHtmlFile, isMarkdownFile } from "../file-kinds.ts";
4
4
  import type { ResolvedPath } from "../types.ts";
5
5
  import { resolveRequest } from "./path.ts";
@@ -3,12 +3,50 @@ import { buildBreadcrumbs } from "../../shared/breadcrumbs.ts";
3
3
  import type { DirectoryPayload, DocumentPayload, RedirectPayload } from "../../shared/contracts.ts";
4
4
  import type { ServerContext } from "../context.ts";
5
5
  import { stripMarkdownExtension } from "../file-kinds.ts";
6
- import { jsonError, jsonResponse } from "../http/respond.ts";
6
+ import { jsonError, jsonResponse, notModifiedResponse } from "../http/respond.ts";
7
+ import { matchesEtag } from "../http/validators.ts";
7
8
  import type { RenderedDocument } from "../markdown/index.ts";
8
9
  import type { Resource } from "../resolve/resource.ts";
9
10
  import { listDirectory } from "../services/directories.ts";
11
+ import type { DocumentEntry } from "../services/documents.ts";
10
12
  import type { DirectoryEntry, ResolvedPath } from "../types.ts";
11
13
 
14
+ /**
15
+ * Build the page validators. Keep these in sync with the payload builders below:
16
+ * every field that changes a payload must change its ETag, or a conditional
17
+ * request will keep serving an outdated page.
18
+ */
19
+ function etagOf(parts: readonly string[]): string {
20
+ return `W/"${Bun.hash(parts.join("\0")).toString(16)}"`;
21
+ }
22
+
23
+ function documentEtag(context: ServerContext, file: ResolvedPath, entry: DocumentEntry, url: URL): string {
24
+ const { config } = context;
25
+ return etagOf([
26
+ "document",
27
+ config.version,
28
+ config.rootLabel,
29
+ config.html,
30
+ config.highlight ? "highlight" : "plain",
31
+ config.math ? "math" : "no-math",
32
+ config.mermaid ? "mermaid" : "no-mermaid",
33
+ url.pathname,
34
+ file.relative,
35
+ entry.revision,
36
+ ]);
37
+ }
38
+
39
+ function directoryEtag(context: ServerContext, directory: ResolvedPath, entries: DirectoryEntry[], url: URL): string {
40
+ return etagOf([
41
+ "directory",
42
+ context.config.version,
43
+ context.config.rootLabel,
44
+ url.pathname,
45
+ directory.relative,
46
+ ...entries.map(entry => `${entry.name}\0${entry.kind}\0${entry.size ?? ""}\0${entry.mtime?.getTime() ?? ""}`),
47
+ ]);
48
+ }
49
+
12
50
  function documentPayload(
13
51
  context: ServerContext,
14
52
  file: ResolvedPath,
@@ -66,12 +104,18 @@ export async function respondPageApi(
66
104
 
67
105
  switch (resource.kind) {
68
106
  case "markdown": {
69
- const document = await context.documents.get(resource.file.path);
70
- return jsonResponse(documentPayload(context, resource.file, document, url), 200, method, config.cors);
107
+ const entry = await context.documents.get(resource.file.path);
108
+ const etag = documentEtag(context, resource.file, entry, url);
109
+ if (matchesEtag(request.headers.get("if-none-match"), etag)) return notModifiedResponse(etag, config.cors);
110
+
111
+ return jsonResponse(documentPayload(context, resource.file, entry.document, url), 200, method, config.cors, etag);
71
112
  }
72
113
  case "directory": {
73
114
  const entries = await listDirectory(resource.directory.path, config.root);
74
- return jsonResponse(directoryPayload(context, resource.directory, entries), 200, method, config.cors);
115
+ const etag = directoryEtag(context, resource.directory, entries, url);
116
+ if (matchesEtag(request.headers.get("if-none-match"), etag)) return notModifiedResponse(etag, config.cors);
117
+
118
+ return jsonResponse(directoryPayload(context, resource.directory, entries), 200, method, config.cors, etag);
75
119
  }
76
120
  case "redirect": {
77
121
  const payload: RedirectPayload = { kind: "redirect", location: resource.location };
@@ -19,6 +19,7 @@ export function appConfig(config: ResolvedConfig): AppConfig {
19
19
  version: config.version,
20
20
  theme: config.theme,
21
21
  live: config.live,
22
+ single: config.single,
22
23
  mermaid: config.mermaid,
23
24
  };
24
25
  }
@@ -2,42 +2,118 @@ import { stat } from "node:fs/promises";
2
2
  import { MAX_CACHED_DOCUMENTS } from "../constants.ts";
3
3
  import type { RenderedDocument, Renderer } from "../markdown/render.ts";
4
4
 
5
+ /** A rendered document plus the source revision used for HTTP validators. */
6
+ export type DocumentEntry = {
7
+ document: RenderedDocument;
8
+ revision: string;
9
+ };
10
+
5
11
  type CachedDocument = {
6
12
  mtimeMs: number;
7
13
  size: number;
8
- document: RenderedDocument;
14
+ entry: DocumentEntry;
15
+ };
16
+
17
+ type InflightDocument = {
18
+ generation: number;
19
+ promise: Promise<RenderedDocumentResult>;
20
+ };
21
+
22
+ type RenderedDocumentResult = {
23
+ entry: DocumentEntry;
24
+ /** A watcher event arrived during the render, so the result may be stale. */
25
+ stale: boolean;
9
26
  };
10
27
 
11
28
  export type DocumentStore = {
12
- get(path: string): Promise<RenderedDocument>;
13
- clear(): void;
29
+ get(path: string): Promise<DocumentEntry>;
30
+ invalidate(paths: readonly string[]): void;
14
31
  };
15
32
 
16
- /** Read + render Markdown, cached by (mtime, size) and invalidated by the watcher. */
33
+ /** Bound retries so a request cannot follow an endless edit stream forever. */
34
+ const MAX_RENDER_ATTEMPTS = 2;
35
+
36
+ function revisionOf(source: string): string {
37
+ return `${source.length.toString(36)}-${Bun.hash(source).toString(36)}`;
38
+ }
39
+
40
+ /**
41
+ * Read + render Markdown, cached by `(mtime, size)` and invalidated by path.
42
+ *
43
+ * Concurrent requests for the same path share one render. If a watcher event
44
+ * arrives while that render is running, the result is not cached and the next
45
+ * request renders the latest source. A request retries once so the client that
46
+ * triggered the invalidation does not receive the stale render.
47
+ */
17
48
  export function createDocumentStore(renderer: Renderer): DocumentStore {
18
49
  const cache = new Map<string, CachedDocument>();
50
+ const inflight = new Map<string, InflightDocument>();
51
+ const generations = new Map<string, number>();
19
52
 
20
- return {
21
- async get(path) {
22
- const info = await stat(path);
23
- const cached = cache.get(path);
24
- if (cached && cached.mtimeMs === info.mtimeMs && cached.size === info.size) {
25
- return cached.document;
26
- }
53
+ function evict(): void {
54
+ while (cache.size > MAX_CACHED_DOCUMENTS) {
55
+ const oldest = cache.keys().next().value;
56
+ if (oldest === undefined) return;
57
+ cache.delete(oldest);
58
+ }
59
+ }
27
60
 
61
+ function start(path: string, mtimeMs: number, size: number, generation: number): Promise<RenderedDocumentResult> {
62
+ const promise = (async () => {
28
63
  const source = await Bun.file(path).text();
29
64
  const document = await renderer.render(source);
30
- cache.set(path, { mtimeMs: info.mtimeMs, size: info.size, document });
65
+ const entry: DocumentEntry = { document, revision: revisionOf(source) };
66
+ const stale = (generations.get(path) ?? 0) !== generation;
67
+
68
+ if (!stale) {
69
+ cache.set(path, { mtimeMs, size, entry });
70
+ evict();
71
+ }
72
+
73
+ return { entry, stale };
74
+ })();
75
+
76
+ const next: InflightDocument = { generation, promise };
77
+ inflight.set(path, next);
78
+ const cleanup = () => {
79
+ if (inflight.get(path) === next) inflight.delete(path);
80
+ };
81
+ void promise.then(cleanup, cleanup);
82
+
83
+ return promise;
84
+ }
31
85
 
32
- if (cache.size > MAX_CACHED_DOCUMENTS) {
33
- const oldest = cache.keys().next().value;
34
- if (oldest) cache.delete(oldest);
86
+ return {
87
+ async get(path) {
88
+ let fallback: DocumentEntry | undefined;
89
+
90
+ for (let attempt = 0; attempt < MAX_RENDER_ATTEMPTS; attempt++) {
91
+ const info = await stat(path);
92
+ const cached = cache.get(path);
93
+ if (cached && cached.mtimeMs === info.mtimeMs && cached.size === info.size) {
94
+ // Refresh insertion order so the cache behaves as an LRU.
95
+ cache.delete(path);
96
+ cache.set(path, cached);
97
+ return cached.entry;
98
+ }
99
+
100
+ const pending = inflight.get(path);
101
+ const result = pending
102
+ ? await pending.promise
103
+ : await start(path, info.mtimeMs, info.size, generations.get(path) ?? 0);
104
+
105
+ if (!result.stale) return result.entry;
106
+ fallback = result.entry;
35
107
  }
36
108
 
37
- return document;
109
+ if (!fallback) throw new Error(`Failed to render ${path}`);
110
+ return fallback;
38
111
  },
39
- clear() {
40
- cache.clear();
112
+ invalidate(paths) {
113
+ for (const path of paths) {
114
+ generations.set(path, (generations.get(path) ?? 0) + 1);
115
+ cache.delete(path);
116
+ }
41
117
  },
42
118
  };
43
119
  }
@@ -1,4 +1,5 @@
1
1
  import type { Server, ServerWebSocket } from "bun";
2
+ import type { LiveReloadEvent } from "../../../shared/contracts.ts";
2
3
 
3
4
  type Socket = ServerWebSocket<undefined>;
4
5
 
@@ -29,7 +30,8 @@ export function createLiveHub(): LiveHub {
29
30
  // Clients are read-only; ignore inbound messages.
30
31
  },
31
32
  broadcast(files) {
32
- const payload = JSON.stringify({ type: "reload", files });
33
+ const event: LiveReloadEvent = { type: "reload", files };
34
+ const payload = JSON.stringify(event);
33
35
  for (const socket of sockets) {
34
36
  try {
35
37
  socket.send(payload);
@@ -1,3 +1,4 @@
1
+ import { relative, sep } from "node:path";
1
2
  import { createLiveHub, type LiveHub } from "./hub.ts";
2
3
  import { createWatcher } from "./watcher.ts";
3
4
 
@@ -6,6 +7,7 @@ export type LiveReload = LiveHub;
6
7
  export type LiveReloadOptions = {
7
8
  root: string;
8
9
  ignore?: string[];
10
+ /** Absolute paths of changed files and directories (directories have no trailing separator). */
9
11
  onChange?: (files: string[]) => void;
10
12
  };
11
13
 
@@ -17,7 +19,7 @@ export async function createLiveReload(options: LiveReloadOptions): Promise<Live
17
19
  ignore: options.ignore,
18
20
  onChange(files) {
19
21
  options.onChange?.(files);
20
- hub.broadcast(files);
22
+ hub.broadcast(files.map(file => relative(options.root, file).split(sep).join("/")));
21
23
  },
22
24
  });
23
25
 
@@ -1,7 +1,7 @@
1
1
  import { type Dirent, type FSWatcher, watch } from "node:fs";
2
- import { readdir } from "node:fs/promises";
2
+ import { readdir, stat } from "node:fs/promises";
3
3
  import { dirname, join, sep } from "node:path";
4
- import { IGNORED_NAMES, WATCH_DEBOUNCE_MS, WATCHED_EXTENSIONS } from "../../constants.ts";
4
+ import { IGNORED_NAMES, WATCH_DEBOUNCE_MS, WATCH_MAX_WAIT_MS, WATCHED_EXTENSIONS } from "../../constants.ts";
5
5
 
6
6
  export type Watcher = {
7
7
  close(): void;
@@ -25,21 +25,61 @@ export async function createWatcher(options: WatcherOptions): Promise<Watcher> {
25
25
  const watchers = new Map<string, FSWatcher>();
26
26
  const pending = new Set<string>();
27
27
  let timer: ReturnType<typeof setTimeout> | undefined;
28
+ let maxTimer: ReturnType<typeof setTimeout> | undefined;
29
+ let deadline = 0;
28
30
  let closed = false;
29
31
 
30
32
  const shouldIgnore = (name: string) => name.startsWith(".") || ignored.has(name);
31
33
 
32
34
  function flush(): void {
35
+ if (timer) clearTimeout(timer);
36
+ if (maxTimer) clearTimeout(maxTimer);
33
37
  timer = undefined;
34
- if (pending.size === 0) return;
35
- const files = [...pending];
38
+ maxTimer = undefined;
39
+ if (closed || pending.size === 0) return;
40
+ const changed = [...pending];
36
41
  pending.clear();
37
- options.onChange(files);
42
+ options.onChange(changed);
38
43
  }
39
44
 
40
45
  function schedule(): void {
46
+ if (maxTimer === undefined) {
47
+ deadline = Date.now() + WATCH_MAX_WAIT_MS;
48
+ maxTimer = setTimeout(flush, WATCH_MAX_WAIT_MS);
49
+ }
50
+
41
51
  if (timer) clearTimeout(timer);
42
- timer = setTimeout(flush, WATCH_DEBOUNCE_MS);
52
+ const remaining = Math.max(0, deadline - Date.now());
53
+ timer = setTimeout(flush, Math.min(WATCH_DEBOUNCE_MS, remaining));
54
+ }
55
+
56
+ function enqueue(path: string): void {
57
+ pending.add(path);
58
+ schedule();
59
+ }
60
+
61
+ /**
62
+ * `rename` covers create, delete and move without saying which. Watched file
63
+ * extensions are reported directly; anything else is checked against the
64
+ * filesystem so a new directory also refreshes the listings that show it.
65
+ * Deletions are reported from `reconcile`, which still knows the dropped
66
+ * watchers.
67
+ */
68
+ function handleRenameTarget(target: string, name: string): void {
69
+ if (watchers.has(target) || WATCHED_EXTENSIONS.test(name)) {
70
+ enqueue(target);
71
+ return;
72
+ }
73
+
74
+ void stat(target).then(
75
+ info => {
76
+ if (closed || !info.isDirectory()) return;
77
+ enqueue(target);
78
+ },
79
+ () => {
80
+ // Already gone: nothing new to watch or report.
81
+ },
82
+ );
43
83
  }
44
84
 
45
85
  async function addDirectory(directory: string): Promise<void> {
@@ -55,10 +95,16 @@ export async function createWatcher(options: WatcherOptions): Promise<Watcher> {
55
95
  const watcher = watch(directory, (event, filename) => {
56
96
  if (closed) return;
57
97
  const name = filename?.toString();
58
- if (event === "rename") void reconcile(directory);
98
+
99
+ if (event === "rename") {
100
+ void reconcile(directory);
101
+ if (!name || shouldIgnore(name)) return;
102
+ handleRenameTarget(join(directory, name), name);
103
+ return;
104
+ }
105
+
59
106
  if (!name || shouldIgnore(name) || !WATCHED_EXTENSIONS.test(name)) return;
60
- pending.add(join(directory, name));
61
- schedule();
107
+ enqueue(join(directory, name));
62
108
  });
63
109
  watcher.on("error", () => {
64
110
  watcher.close();
@@ -76,11 +122,12 @@ export async function createWatcher(options: WatcherOptions): Promise<Watcher> {
76
122
  }
77
123
  }
78
124
 
79
- function removeWatcherTree(target: string): void {
125
+ function removeWatcherTree(target: string, report = false): void {
80
126
  for (const [watched, watcher] of [...watchers]) {
81
127
  if (watched === target || watched.startsWith(target + sep)) {
82
128
  watcher.close();
83
129
  watchers.delete(watched);
130
+ if (report) enqueue(watched);
84
131
  }
85
132
  }
86
133
  }
@@ -90,7 +137,7 @@ export async function createWatcher(options: WatcherOptions): Promise<Watcher> {
90
137
  if (closed) return;
91
138
  const dirents = await readdir(directory, { withFileTypes: true }).catch(() => null);
92
139
  if (!dirents) {
93
- removeWatcherTree(directory);
140
+ removeWatcherTree(directory, true);
94
141
  return;
95
142
  }
96
143
 
@@ -107,7 +154,7 @@ export async function createWatcher(options: WatcherOptions): Promise<Watcher> {
107
154
  for (const watched of [...watchers.keys()]) {
108
155
  if (watched === directory) continue;
109
156
  if (dirname(watched) === directory && !childDirs.has(watched)) {
110
- removeWatcherTree(watched);
157
+ removeWatcherTree(watched, true);
111
158
  }
112
159
  }
113
160
  }
@@ -118,7 +165,9 @@ export async function createWatcher(options: WatcherOptions): Promise<Watcher> {
118
165
  close() {
119
166
  closed = true;
120
167
  if (timer) clearTimeout(timer);
168
+ if (maxTimer) clearTimeout(maxTimer);
121
169
  timer = undefined;
170
+ maxTimer = undefined;
122
171
  for (const watcher of watchers.values()) watcher.close();
123
172
  watchers.clear();
124
173
  },
@@ -12,6 +12,12 @@ export const LIVE_PATH = "/__serve_md_live";
12
12
  /** Prebuilt Mermaid browser runtime, loaded lazily. */
13
13
  export const MERMAID_RUNTIME_PATH = "/__serve_md_mermaid.js";
14
14
 
15
+ /**
16
+ * Suffixes tried when resolving extensionless (clean) URLs, in order.
17
+ * Shared so the browser applies the same URL rules when filtering live events.
18
+ */
19
+ export const CLEAN_URL_SUFFIXES = [".md", ".markdown", ".html", ".htm"] as const;
20
+
15
21
  /** The shell contains this JSON string token; the server replaces it with a JSON config object. */
16
22
  export const CONFIG_TOKEN = '"__SERVE_MD_CONFIG__"';
17
23
 
@@ -39,11 +39,18 @@ export type ApiErrorPayload = {
39
39
  };
40
40
  };
41
41
 
42
+ /** WebSocket live-reload event. Paths are files or directories relative to the served root (POSIX separators). */
43
+ export type LiveReloadEvent = {
44
+ type: "reload";
45
+ files: string[];
46
+ };
47
+
42
48
  /** Injected into the Svelte shell so the web app does not need a second config request. */
43
49
  export type AppConfig = {
44
50
  rootLabel: string;
45
51
  version: string;
46
52
  theme: Theme;
47
53
  live: boolean;
54
+ single: boolean;
48
55
  mermaid: boolean;
49
56
  };
@@ -0,0 +1,2 @@
1
+ import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./live-BEtNAdWQ.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var s=Array.isArray,c=Array.prototype.indexOf,l=Array.prototype.includes,u=Array.from,d=Object.defineProperty,f=Object.getOwnPropertyDescriptor,p=Object.getOwnPropertyDescriptors,m=Object.prototype,h=Array.prototype,g=Object.getPrototypeOf,_=Object.isExtensible,v=()=>{};function y(e){return e()}function b(e){for(var t=0;t<e.length;t++)e[t]()}function x(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var S=1024,C=2048,w=4096,ee=8192,te=16384,ne=32768,re=1<<25,ie=65536,ae=1<<18,oe=1<<19,se=1<<20,ce=1<<25,le=1<<21,ue=1<<22,de=1<<23,fe=Symbol(`$state`),pe=Symbol(`component`),me=Symbol(``),he=Symbol(`attributes`),ge=Symbol(`class`),_e=Symbol(`style`),ve=Symbol(`text`),ye=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},be=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`),xe={},T=Symbol(`uninitialized`),Se=`http://www.w3.org/1999/xhtml`,Ce=`http://www.w3.org/2000/svg`,we=`http://www.w3.org/1998/Math/MathML`;function Te(){console.warn(`https://svelte.dev/e/derived_inert`)}function Ee(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function De(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var E=!1;function Oe(e){E=e}var D;function O(e){if(e===null)throw Ee(),xe;return D=e}function ke(){return O(an(D))}function k(e){if(E){if(an(D)!==null)throw Ee(),xe;D=e}}function Ae(e=1){if(E){for(var t=e,n=D;t--;)n=an(n);D=n}}function je(e=!0){for(var t=0,n=D;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else(r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=an(n);e&&n.remove(),n=i}}function Me(e){if(!e||e.nodeType!==8)throw Ee(),xe;return e.data}function Ne(e){return e===this.v}function Pe(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Fe(e){return!Pe(e,this.v)}function Ie(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function Le(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function Re(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function ze(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function Be(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function Ve(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function He(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function Ue(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function We(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function Ge(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Ke(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var qe=!1;function Je(){qe=!0}var A=null;function Ye(e){A=e}function Xe(e,t=!1,n){A={p:A,i:!1,c:null,e:null,s:e,x:null,r:W,l:qe&&!t?{s:null,u:null,$:[]}:null}}function Ze(e){var t=A,n=t.e;if(n!==null){t.e=null;for(var r of n)yn(r)}return e!==void 0&&(t.x=e),t.i=!0,A=t.p,Qe(e)}function Qe(e={}){return d(e,pe,{value:!0}),e}function $e(){return!qe||A!==null&&A.l===null}var et=[];function tt(){var e=et;et=[],b(e)}function nt(e){if(et.length===0&&!Et){var t=et;queueMicrotask(()=>{t===et&&tt()})}et.push(e)}function rt(){for(;et.length>0;)tt()}var it=~(C|w|S);function j(e,t){e.f=e.f&it|t}function at(e){e.f&512||e.deps===null?j(e,S):j(e,w)}function ot(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),j(e,S)}function st(e){var t=U,n=W;Vn(null),Hn(null);try{return e()}finally{Vn(t),Hn(n)}}function ct(e,t,n,r){let i=$e()?ft:gt;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=W,c=lt(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function u(e){if(!(s.f&16384)){c();try{r([...o,...e])}catch(e){fn(e,s)}ut()}}var d=dt();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>mt(e))).then(u).catch(e=>fn(e,s)).finally(d)}l?l.then(()=>{s.f&16384?d():(c(),f(),ut())}):f()}function lt(){var e=W,t=U,n=A,r=M;return function(i=!0){Hn(e),Vn(t),Ye(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function ut(e=!0){Hn(null),Vn(null),Ye(null),e&&M?.deactivate()}function dt(){var e=W,t=e.b,n=M,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function ft(e){var t=2|C;return W!==null&&(W.f|=oe),{ctx:A,deps:null,effects:null,equals:Ne,f:t,fn:e,reactions:null,rv:0,v:T,wv:0,parent:W,ac:null}}var pt=Symbol(`obsolete`);function mt(e,t,n){let r=W;r===null&&Le();var i=void 0,a=Ut(T),o=!U,s=new Set;return Cn(()=>{var t=W,n=x();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==ye&&n.reject(e)}).finally(ut)}catch(e){n.reject(e),ut()}var c=M;if(o){if(t.f&32768)var l=dt();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(pt);else for(let e of s.values())e.reject(pt);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==pt&&(c.activate(),t?(a.f|=de,qt(a,t)):(a.f&8388608&&(a.f^=de),qt(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),_n(()=>{for(let e of s)e.reject(pt)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function ht(e){let t=ft(e);return Wn(t),t}function gt(e){let t=ft(e);return t.equals=Fe,t}function _t(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)H(t[n])}}function vt(e){var t,n=W,r=e.parent;if(!Rn&&r!==null&&e.v!==T&&r.f&24576)return Te(),e.v;Hn(r);try{_t(e),t=$n(e)}finally{Hn(n)}return t}function yt(e){var t=vt(e);!e.equals(t)&&(e.wv=Xn(),(!M?.is_fork||e.deps===null)&&(M===null?e.v=t:(M.capture(e,t,!0),Ct?.capture(e,t,!0)),e.deps===null))?j(e,S):Rn||(wt===null?at(e):(gn()||M?.is_fork)&&wt.set(e,t))}function bt(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac!==null&&st(()=>{t.ac.abort(ye),t.ac=null}),t.fn!==null&&(t.teardown=v),nr(t,0),On(t))}function xt(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&rr(t)}var St=null,M=null,Ct=null,wt=null,Tt=null,Et=!1,Dt=!1,Ot=null,kt=null,At=0,jt=1,Mt=class e{id=jt++;#e=!1;linked=!0;#t=null;#n=null;async_deriveds=new Map;current=new Map;previous=new Map;#r=new Set;#i=new Set;#a=0;#o=new Map;#s=null;#c=[];#l=[];#u=new Set;#d=new Set;#f=new Map;#p=new Set;is_fork=!1;#m=!1;constructor(){St===null?St=this:(St.#n=this,this.#t=St),St=this}#h(){if(this.is_fork)return!0;for(let n of this.#o.keys()){for(var e=n,t=!1;e.parent!==null;){if(this.#f.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(e){this.#f.has(e)||this.#f.set(e,{d:[],m:[]}),this.#p.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#f.get(e);if(n){this.#f.delete(e);for(var r of n.d)j(r,C),t(r);for(r of n.m)j(r,w),t(r)}this.#p.add(e)}#g(){var e=[];for(let i of this.#c)if(!(i.f&16384||!(i.f&6144))){for(var t=i,n=!1;t.parent!==null;){t=t.parent;var r=t.f;if(r&96){if(!(r&1024)){n=!0;break}t.f^=S}}n||e.push(t)}return this.#c=[],e}#_(){this.#e=!0;for(let e of this.#u)this.#d.delete(e),j(e,C),this.schedule(e);for(let e of this.#d)j(e,w),this.schedule(e);this.apply();for(var t=Ot=[],n=[],r=kt=[];this.#c.length>0;){At++>1e3&&(this.#S(),Pt());for(let e of this.#g())try{this.#v(e,t,n)}catch(t){throw zt(e),this.#h()||this.discard(),t}}if(M=null,r.length>0){var i=e.ensure();for(let e of r)i.schedule(e)}if(Ot=null,kt=null,this.#h()){this.#x(n),this.#x(t);for(let[e,t]of this.#f)Rt(e,t);r.length>0&&M.#_();return}let a=this.#y();if(a)this.#x(n),this.#x(t),a.#b(this);else{this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),Ct=this,It(n),It(t),Ct=null,this.#s?.resolve();var o=M;if(this.#a===0&&(this.#c.length===0||o!==null)&&this.#S(),this.#c.length>0){if(o!==null){for(let e of this.#c)o.#c.push(e);this.#c=[]}else o=this}o!==null&&(Vt.clear(),o.#_())}}#v(e,t,n){e.f^=S;for(var r=e.first;r!==null;){var i=r.f,a=!!(i&96);if(!(a&&i&1024||i&8192||this.#f.has(r))&&r.fn!==null){a?r.f^=S:i&4?t.push(r):Zn(r)&&(i&16&&this.#d.add(r),rr(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#y(){for(var e=this.#t;e!==null;){if(!e.is_fork){for(let[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=e.#t}return null}#b(e){for(let[t,n]of e.current)!this.previous.has(t)&&e.previous.has(t)&&this.previous.set(t,e.previous.get(t)),this.current.set(t,n);for(let[t,n]of e.async_deriveds){let e=this.async_deriveds.get(t);e&&n.promise.then(e.resolve).catch(e.reject)}e.async_deriveds.clear(),this.transfer_effects(e.#u,e.#d);let t=e=>{var n=e.reactions;if(n!==null&&!(e.f&2&&!(e.f&6144)))for(let e of n){var r=e.f;if(r&2)t(e);else{var i=e;r&4194320&&!this.async_deriveds.has(i)&&(this.#d.delete(i),j(i,C),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#S(),M=this,this.#_()}#x(e){for(var t=0;t<e.length;t+=1)ot(e[t],this.#u,this.#d)}capture(e,t,n=!1){e.v!==T&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[t,n]),wt?.set(e,t)),this.is_fork||(e.v=t)}activate(){M=this}deactivate(){M=null,wt=null}flush(){try{Dt=!0,M=this,this.#_()}finally{At=0,Tt=null,Ot=null,kt=null,Dt=!1,M=null,wt=null,Vt.clear()}}discard(){for(let e of this.#i)e(this);this.#i.clear();for(let e of this.async_deriveds.values())e.reject(pt);this.#S(),this.#s?.resolve()}register_created_effect(e){this.#l.push(e)}increment(e,t){if(this.#a+=1,e){let e=this.#o.get(t)??0;this.#o.set(t,e+1)}}decrement(e,t){if(--this.#a,e){let e=this.#o.get(t)??0;e===1?this.#o.delete(t):this.#o.set(t,e-1)}this.#m||(this.#m=!0,nt(()=>{this.#m=!1,this.linked&&this.flush()}))}transfer_effects(e,t){for(let t of e)this.#u.add(t);for(let e of t)this.#d.add(e);e.clear(),t.clear()}oncommit(e){this.#r.add(e)}ondiscard(e){this.#i.add(e)}settled(){return(this.#s??=x()).promise}static ensure(){if(M===null){let t=M=new e;!Dt&&!Et&&nt(()=>{t.#e||t.flush()})}return M}apply(){wt=null}schedule(e){Tt=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)?e.b.defer_effect(e):this.#c.push(e)}#S(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?St=e:t.#t=e,this.linked=!1}}};function Nt(e){var t=Et,n=Ct;Ct=null,Et=!0;try{var r;for(e&&(Nt(),r=e());;){if(rt(),M===null)return r;M.flush()}}finally{Et=t,Ct=n}}function Pt(){try{He()}catch(e){fn(e,Tt)}}var Ft=null;function It(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&Zn(r)&&(Ft=new Set,rr(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&jn(r),Ft?.size>0)){Vt.clear();for(let e of Ft){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Ft.has(n)&&(Ft.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||rr(n)}}Ft.clear()}}Ft=null}}function Lt(e){M.schedule(e)}function Rt(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),j(e,S);for(var n=e.first;n!==null;)Rt(n,t),n=n.next}}function zt(e){j(e,S);for(var t=e.first;t!==null;)zt(t),t=t.next}var Bt=new Set,Vt=new Map,Ht=!1;function Ut(e,t){return{f:0,v:e,reactions:null,equals:Ne,rv:0,wv:0}}function N(e,t){let n=Ut(e,t);return Wn(n),n}function Wt(e,t=!1,n=!0){let r=Ut(e);return t||(r.equals=Fe),qe&&n&&A!==null&&A.l!==null&&(A.l.s??=[]).push(r),r}function P(e,t,n=!1){return U!==null&&(!Bn||U.f&131072)&&$e()&&U.f&4325394&&(Un===null||!Un.has(e))&&Ge(),qt(e,n?Zt(t):t,kt)}var Gt=null,Kt=0;function qt(e,t,n=null){if(!e.equals(t)){Rn?Vt.set(e,t):Vt.has(e)||Vt.set(e,e.v);var r=Mt.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&vt(t),wt===null&&at(t)}e.wv=Xn(),Gt=null,Kt=0,Xt(e,C,n),Gt=null,$e()&&W!==null&&W.f&1024&&!(W.f&96)&&(q===null?Gn([e]):q.push(e)),!r.is_fork&&Bt.size>0&&!Ht&&Jt()}return t}function Jt(){Ht=!1;for(let e of Bt){e.f&1024&&j(e,w);let t;try{t=Zn(e)}catch{t=!0}t&&rr(e)}Bt.clear()}function Yt(e){P(e,e.v+1)}function Xt(e,t,n){var r=e.reactions;if(r!==null){var i=$e(),a=r.length;if(Kt+=a,Kt>1e5&&Gt===null&&(Gt=new Set),Gt!==null){if(Gt.has(e))return;Gt.add(e)}for(var o=0;o<a;o++){var s=r[o],c=s.f;if(i||s!==W){var l=(c&C)===0;if(l&&j(s,t),c&131072)Bt.add(s);else if(c&2){var u=s;wt?.delete(u),Xt(u,w,n)}else if(l){var d=s;c&16&&Ft!==null&&Ft.add(d),n===null?Lt(d):n.push(d)}}}}}function Zt(e){if(typeof e!=`object`||!e||fe in e||pe in e)return e;let t=g(e);if(t!==m&&t!==h)return e;var n=new Map,r=s(e),i=N(0),a=null,o=Jn,c=e=>{if(Jn===o)return e();var t=U,n=Jn;Vn(null),Yn(o);var r=e();return Vn(t),Yn(n),r};return r&&n.set(`length`,N(e.length,a)),new Proxy(e,{defineProperty(e,t,r){(!(`value`in r)||r.configurable===!1||r.enumerable===!1||r.writable===!1)&&Ue();var i=n.get(t);return i===void 0?c(()=>{var e=N(r.value,a);return n.set(t,e),e}):P(i,r.value,!0),!0},deleteProperty(e,t){var r=n.get(t);if(r===void 0){if(t in e){let e=c(()=>N(T,a));n.set(t,e),Yt(i)}}else P(r,T),Yt(i);return!0},get(t,r,i){if(r===fe)return e;var o=n.get(r),s=r in t;if(o===void 0&&(!s||f(t,r)?.writable)&&(o=c(()=>N(Zt(s?t[r]:T),a)),n.set(r,o)),o!==void 0){var l=J(o);return l===T?void 0:l}return Reflect.get(t,r,i)},getOwnPropertyDescriptor(e,t){this.has?.(e,t);var r=Reflect.getOwnPropertyDescriptor(e,t),i=n.get(t);if(i!==void 0){var a=J(i);if(a===T)return;if(r&&`value`in r)r.value=a;else return{enumerable:!0,configurable:!0,value:a,writable:!0}}return r},has(e,t){if(t===fe)return!0;var r=n.get(t),i=r!==void 0&&r.v!==T||Reflect.has(e,t);return(r!==void 0||W!==null&&(!i||f(e,t)?.writable))&&(r===void 0&&(r=c(()=>N(i?Zt(e[t]):T,a)),n.set(t,r)),J(r)===T)?!1:i},set(e,t,o,s){var l=n.get(t),u=t in e;if(r&&t===`length`)for(var d=o;d<l.v;d+=1){var p=n.get(d+``);p===void 0?d in e&&(p=c(()=>N(T,a)),n.set(d+``,p)):P(p,T)}if(l===void 0)(!u||f(e,t)?.writable)&&(l=c(()=>N(void 0,a)),P(l,Zt(o)),n.set(t,l));else{u=l.v!==T;var m=c(()=>Zt(o));P(l,m)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(s,o),!u){if(r&&typeof t==`string`){var g=n.get(`length`),_=Number(t);Number.isInteger(_)&&_>=g.v&&P(g,_+1)}Yt(i)}return!0},ownKeys(e){J(i);var t=Reflect.ownKeys(e).filter(e=>{var t=n.get(e);return t===void 0||t.v!==T});for(var[r,a]of n)a.v!==T&&!(r in e)&&t.push(r);return t},setPrototypeOf(){We()}})}var Qt,$t,en,tn,nn;function rn(){if(Qt===void 0){Qt=window,$t=document,en=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;tn=f(t,`firstChild`).get,nn=f(t,`nextSibling`).get,_(e)&&(e[ge]=void 0,e[he]=null,e[_e]=void 0,e.__e=void 0),_(n)&&(n[ve]=void 0)}}function F(e=``){return document.createTextNode(e)}function I(e){return tn.call(e)}function an(e){return nn.call(e)}function L(e,t){if(!E)return I(e);var n=I(D);if(n===null)n=D.appendChild(F());else if(t&&n.nodeType!==3){var r=F();return n?.before(r),O(r),r}return t&&un(n),O(n),n}function on(e,t=!1){if(!E){var n=I(e);return n instanceof Comment&&n.data===``?an(n):n}if(t){if(D?.nodeType!==3){var r=F();return D?.before(r),O(r),r}un(D)}return D}function R(e,t=!1){if(!E)return I(e);var n=L(e,t);return k(e),n}function z(e,t=1,n=!1){let r=E?D:e;for(var i;t--;)i=r,r=an(r);if(!E)return r;if(n){if(r?.nodeType!==3){var a=F();return r===null?i?.after(a):r.before(a),O(a),a}un(r)}return O(r),r}function sn(e){e.textContent=``}function cn(){return!1}function ln(e,t,n){return t==null||t===`http://www.w3.org/1999/xhtml`?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function un(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function dn(e){var t=W;if(t===null)return U.f|=de,e;if(!(t.f&32768)&&!(t.f&4))throw e;fn(e,t)}function fn(e,t){if(e===xe)throw e;if(!(t!==null&&t.f&16384)){for(;t!==null;){if(t.f&128&&!(t.f&33570816)){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}}function pn(e){W===null&&(U===null&&Ve(e),Be()),Rn&&ze(e)}function mn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function hn(e,t){var n=W;n!==null&&n.f&8192&&(e|=ee);var r={ctx:A,deps:null,nodes:null,f:e|C|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};M?.register_created_effect(r);var i=r;if(e&4)Ot===null?Mt.ensure().schedule(r):Ot.push(r);else if(t!==null){try{rr(r)}catch(e){throw H(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=ie))}if(i!==null&&(i.parent=n,n!==null&&mn(i,n),U!==null&&U.f&2&&!(e&64))){var a=U;(a.effects??=[]).push(i)}return r}function gn(){return U!==null&&!Bn}function _n(e){let t=hn(8,null);return j(t,S),t.teardown=e,t}function vn(e){pn(`$effect`);var t=W.f;if(!U&&t&32&&A!==null&&!A.i){var n=A;(n.e??=[]).push(e)}else return yn(e)}function yn(e){return hn(4|se,e)}function bn(e){return pn(`$effect.pre`),hn(8|se,e)}function xn(e){Mt.ensure();let t=hn(64|oe,e);return(e={})=>new Promise(n=>{e.outro?Mn(t,()=>{H(t),n(void 0)}):(H(t),n(void 0))})}function Sn(e){return hn(4,e)}function Cn(e){return hn(ue|oe,e)}function wn(e,t=0){return hn(8|t,e)}function B(e,t=[],n=[],r=[]){ct(r,t,n,t=>{hn(8,()=>{e(...t.map(J))})})}function Tn(e,t=[],n=[],r=[]){ct(r,t,n,t=>{hn(4,()=>e(...t.map(J)))})}function En(e,t=0){return hn(16|t,e)}function V(e){return hn(32|oe,e)}function Dn(e){var t=e.teardown;if(t!==null){let n=Rn,r=U;zn(!0),Vn(null);try{t.call(null)}catch(t){fn(t,e.parent)}finally{zn(n),Vn(r)}}}function On(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&st(()=>{e.abort(ye)});var r=n.next;n.f&64?n.parent=null:H(n,t),n=r}}function kn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||H(t),t=n}}function H(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(An(e.nodes.start,e.nodes.end),n=!0),e.f|=re,On(e,t&&!n),nr(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();Dn(e),e.f^=re,e.f|=te;var i=e.parent;i!==null&&i.first!==null&&jn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function An(e,t){for(;e!==null;){var n=e===t?null:an(e);e.remove(),e=n}}function jn(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Mn(e,t,n=!0){var r=[];e.f|=256,Nn(e,r,!0);var i=()=>{n&&H(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function Nn(e,t,n){if(!(e.f&8192)){e.f^=ee;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=!!(i.f&65536)||!!(i.f&32)&&!!(e.f&16);Nn(i,t,o?n:!1)}i=a}}}function Pn(e){e.f&=-257,Fn(e,!0)}function Fn(e,t){if(!(e.f&256)&&e.f&8192){e.f^=ee,e.f&1024||(j(e,C),Mt.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);Fn(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function In(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:an(n);t.append(n),n=i}}var Ln=null,Rn=!1;function zn(e){Rn=e}var U=null,Bn=!1;function Vn(e){U=e}var W=null;function Hn(e){W=e}var Un=null;function Wn(e){U!==null&&(U.f&2097152||U.f&2)&&(Un??=new Set).add(e)}var G=null,K=0,q=null;function Gn(e){q=e}var Kn=1,qn=0,Jn=qn;function Yn(e){Jn=e}function Xn(){return++Kn}function Zn(e){var t=e.f;if(t&2048)return!0;if(t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(Zn(a)&&yt(a),a.wv>e.wv)return!0}t&512&&wt===null&&j(e,S)}return!1}function Qn(e,t,n=!0){var r=e.reactions;if(r!==null&&!(Un!==null&&Un.has(e)))for(var i=0;i<r.length;i++){var a=r[i];a.f&2?Qn(a,t,!1):t===a&&(n?j(a,C):a.f&1024&&j(a,w),Lt(a))}}function $n(e){var t=G,n=K,r=q,i=U,a=Un,o=A,s=Bn,c=Jn,l=e.f;G=null,K=0,q=null,U=l&96?null:e,Un=null,Ye(e.ctx),Bn=!1,Jn=++qn,e.ac!==null&&(st(()=>{e.ac.abort(ye)}),e.ac=null);try{e.f|=le;var u=e.fn,d=u();e.f|=ne;var f=er(e);if($e()&&q!==null&&!Bn&&f!==null&&!(e.f&6146))for(var p=0;p<q.length;p++)Qn(q[p],e);if(i!==null&&i!==e){if(qn++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=qn;if(t!==null)for(let e of t)e.rv=qn;q!==null&&(r===null?r=q:r.push(...q))}return e.f&8388608&&(e.f^=de),d}catch(t){return er(e),dn(t)}finally{e.f^=le,G=t,K=n,q=r,U=i,Un=a,Ye(o),Bn=s,Jn=c}}function er(e){var t=e.deps,n=M?.is_fork;if(G!==null){var r;if(n||nr(e,K),t!==null&&K>0)for(t.length=K+G.length,r=0;r<G.length;r++)t[K+r]=G[r];else e.deps=t=G;if(gn()&&e.f&512)for(r=K;r<t.length;r++)(t[r].reactions??=[]).push(e)}else!n&&t!==null&&K<t.length&&(nr(e,K),t.length=K);return t}function tr(e,t){let n=t.reactions;if(n!==null){var r=c.call(n,e);if(r!==-1){var i=n.length-1;i===0?n=t.reactions=null:(n[r]=n[i],n.pop())}}if(n===null&&t.f&2&&(G===null||!l.call(G,t))){var a=t;a.f&512&&(a.f^=512),a.v!==T&&at(a),a.ac!==null&&st(()=>{a.ac.abort(ye),a.ac=null,j(a,C)}),bt(a),nr(a,0)}}function nr(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)tr(e,n[r])}function rr(e){var t=e.f;if(!(t&16384)){j(e,S);var n=W;W=e;try{t&16777232?kn(e):On(e),Dn(e);var r=$n(e);e.teardown=typeof r==`function`?r:null,e.wv=Kn}finally{W=n}}}async function ir(){await Promise.resolve(),Nt()}function J(e){var t=!!(e.f&2);if(Ln?.add(e),U!==null&&!Bn&&!(W!==null&&W.f&16384)&&(Un===null||!Un.has(e))){var n=U.deps;if(U.f&2097152)e.rv<qn&&(e.rv=qn,G===null&&n!==null&&n[K]===e?K++:G===null?G=[e]:G.push(e));else{U.deps??=[],l.call(U.deps,e)||U.deps.push(e);var r=e.reactions;r===null?e.reactions=[U]:l.call(r,U)||r.push(U)}}if(Rn&&Vt.has(e))return Vt.get(e);if(t){var i=e;if(Rn){var a=i.v;return(!(i.f&1024)&&i.reactions!==null||or(i))&&(a=vt(i)),Vt.set(i,a),a}var o=!(i.f&512)&&!Bn&&U!==null&&!!(U.f&512),s=(i.f&ne)===0;Zn(i)&&(o&&(i.f|=512),yt(i)),o&&!s&&(xt(i),ar(i))}if(wt?.has(e))return wt.get(e);if(e.f&8388608)throw e.v;return e.v}function ar(e){if(e.f|=512,e.deps!==null)for(let n of e.deps){var t=n.reactions;t===null?n.reactions=[e]:l.call(t,e)||t.push(e),n.f&2&&!(n.f&512)&&(xt(n),ar(n))}}function or(e){if(e.v===T)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(Vt.has(t)||t.f&2&&or(t))return!0;return!1}function sr(e){var t=Bn;try{return Bn=!0,e()}finally{Bn=t}}function cr(e){if(!(typeof e!=`object`||!e||e instanceof EventTarget)){if(fe in e)lr(e);else if(!Array.isArray(e))for(let t in e){let n=e[t];typeof n==`object`&&n&&fe in n&&lr(n)}}}function lr(e,t=new Set){if(typeof e==`object`&&e&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let n in e)try{lr(e[n],t)}catch{}let n=g(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){let t=p(n);for(let n in t){let r=t[n].get;if(r)try{r.call(e)}catch{}}}}}[...`allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback`.split(`.`)];var ur=[`touchstart`,`touchmove`];function dr(e){return ur.includes(e)}var fr=Symbol(`events`),pr=new Set,mr=new Set;function hr(e,t,n,r={}){function i(e){if(r.capture||br.call(t,e),!e.cancelBubble)return st(()=>n?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?(i.__removed=!1,nt(()=>{i.__removed||t.addEventListener(e,i,r)})):t.addEventListener(e,i,r),i}function gr(e,t,n,r,i){var a={capture:r,passive:i},o=hr(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&_n(()=>{o.__removed=!0,t.removeEventListener(e,o,a)})}function Y(e,t,n){(t[fr]??={})[e]=n}function _r(e){for(var t=0;t<e.length;t++)pr.add(e[t]);for(var n of mr)n(e)}var vr=null,yr=!1;function br(e){var t=this,n=t.ownerDocument,r=e.type,i=e.composedPath?.()||[],a=i[0]||e.target;vr=e,yr||(yr=!0,setTimeout(()=>{yr=!1,vr=null}));var o=0,s=vr===e&&e[fr];if(s){var c=i.indexOf(s);if(c!==-1&&(t===document||t===window)){e[fr]=t;return}var l=i.indexOf(t);if(l===-1)return;c<=l&&(o=c)}if(a=i[o]||e.target,a!==t){d(e,`currentTarget`,{configurable:!0,get(){return a||n}});var u=U,f=W;Vn(null),Hn(null);try{for(var p,m=[];a!==null&&a!==t;){try{var h=a[fr]?.[r];h!=null&&(!a.disabled||e.target===a)&&h.call(a,e)}catch(e){p?m.push(e):p=e}if(e.cancelBubble)break;o++,a=o<i.length?i[o]:null}if(p){for(let e of m)queueMicrotask(()=>{throw e});throw p}}finally{e[fr]=t,delete e.currentTarget,Vn(u),Hn(f)}}}var xr=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function Sr(e){return xr?.createHTML(e)??e}function Cr(e){var t=ln(`template`);return t.innerHTML=Sr(e.replaceAll(`<!>`,`<!---->`)),t.content}function wr(e,t){var n=W;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function X(e,t){var n=!!(t&1),r=!!(t&2),i,a=!e.startsWith(`<!>`);return()=>{if(E)return wr(D,null),D;i===void 0&&(i=Cr(a?e:`<!>`+e),n||(i=I(i)));var t=r||en?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=I(t),s=t.lastChild;wr(o,s)}else wr(t,t);return t}}function Tr(){if(E)return wr(D,null),D;var e=document.createDocumentFragment(),t=document.createComment(``),n=F();return e.append(t,n),wr(t,n),e}function Z(e,t){if(E){var n=W;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=D),ke()}else e!==null&&e.before(t)}function Er(e){let t=0,n=Ut(0),r;return()=>{gn()&&(J(n),wn(()=>(t===0&&(r=sr(()=>e(()=>Yt(n)))),t+=1,()=>{nt(()=>{--t,t===0&&(r?.(),r=void 0,Yt(n))})})))}}var Dr=ie|oe;function Or(e,t,n,r){new kr(e,t,n,r)}var kr=class{parent;is_pending=!1;transform_error;#e;#t=E?D:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=Er(()=>(this.#m=Ut(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=W;t.b=this,t.f|=128,n(e)},this.parent=W.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=En(()=>{if(E){let e=Me(this.#t);ke();let t=e===`[!`;if(e.startsWith(`[?`)){let t=JSON.parse(e.slice(2));this.#_(t)}else t?this.#b():this.#g()}else this.#x()},Dr),E&&(this.#e=D)}#g(){try{this.#a=V(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#v(e);nt(r),t&&(this.#s=V(()=>{t(this.#e,()=>e,()=>n)}))}#v(e){var t=!1,n=!1;let r=()=>{this.#y()||(t?De():(t=!0,n&&Ke(),this.#s!==null&&Mn(this.#s,()=>{this.#s=null}),this.#C(()=>{this.#x()})))};return{reset:r,invoke_onerror:()=>{if(!this.#y())try{n=!0,this.#n.onerror?.(e,r),n=!1}catch(e){fn(e,this.#i&&this.#i.parent)}}}}#y(){return(this.#i.f&(te|re))!==0}#b(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=V(()=>e(this.#e)),nt(()=>{if(!this.#y()){var e=this.#c=document.createDocumentFragment(),t=F(),n=!1;e.append(t),this.#a=this.#C(()=>{try{return V(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){fn(e,this.#i.parent)}return null}}),this.#a===null?(this.#c=null,n&&this.#S(M)):this.#u===0&&(this.#e.before(e),this.#c=null,Mn(this.#o,()=>{this.#o=null}),this.#S(M))}}))}#x(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=V(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();In(this.#a,e);let t=this.#n.pending;this.#o=V(()=>t(this.#e))}else this.#S(M)}catch(e){this.error(e)}}#S(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){ot(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#C(e){var t=W,n=U,r=A;Hn(this.#i),Vn(this.#i),Ye(this.#i.ctx);try{return Mt.ensure(),e()}finally{Hn(t),Vn(n),Ye(r)}}#w(e,t){this.has_pending_snippet()?(this.#u+=e,this.#u===0&&(this.#S(t),this.#o&&Mn(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))):this.parent&&this.parent.#w(e,t)}update_pending_count(e,t){this.#w(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,nt(()=>{this.#d=!1,this.#m&&qt(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),J(this.#m)}error(e){if(e===xe||!this.#n.onerror&&!this.#n.failed)throw e;M?.is_fork?(this.#a&&M.skip_effect(this.#a),this.#o&&M.skip_effect(this.#o),this.#s&&M.skip_effect(this.#s),M.oncommit(()=>{this.#y()||this.#T(e)})):this.#T(e)}#T(e){this.#a&&=(H(this.#a),null),this.#o&&=(H(this.#o),null),this.#s&&=(H(this.#s),null),E&&(O(this.#t),Ae(),O(je()));let t=this.#n.failed,n=e=>{if(this.#y())return;let{reset:n,invoke_onerror:r}=this.#v(e);r(),t&&!this.#y()&&(this.#s=this.#C(()=>{try{return V(()=>{var r=W;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return fn(e,this.#i.parent),null}}))};nt(()=>{if(!this.#y()){var t;try{t=this.transform_error(e)}catch(e){fn(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>fn(e,this.#i&&this.#i.parent)):n(t)}})}};function Q(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[ve]??=e.nodeValue)&&(e[ve]=n,e.nodeValue=`${n}`)}function Ar(e,t){return Mr(e,t)}var jr=new Map;function Mr(e,{target:t,anchor:n,props:r={},events:i,context:a,intro:o=!0,transformError:s}){rn();var c=void 0,l=xn(()=>{var o=n??t.appendChild(F());Or(o,{pending:()=>{}},t=>{Xe({});var n=A;if(a&&(n.c=a),i&&(r.$$events=i),E&&wr(t,null),c=e(t,r)||Qe(),E&&(W.nodes.end=D,D===null||D.nodeType!==8||D.data!==`]`))throw Ee(),xe;Ze()},s);var l=new Set,d=e=>{for(var n=0;n<e.length;n++){var r=e[n];if(!l.has(r)){l.add(r);var i=dr(r);for(let e of[t,document]){var a=jr.get(e);a===void 0&&(a=new Map,jr.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,br,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return d(u(pr)),mr.add(d),()=>{for(var e of l)for(let n of[t,document]){var r=jr.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,br),r.delete(e),r.size===0&&jr.delete(n)):r.set(e,i)}mr.delete(d),o!==n&&o.parentNode?.removeChild(o)}});return Nr.set(c,l),c}var Nr=new WeakMap;function Pr(e,t){let n=Nr.get(e);return n?(Nr.delete(e),n(t)):Promise.resolve()}var Fr=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)Pn(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(Pn(r.effect),this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(H(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();In(r,t),t.append(F()),this.#n.set(e,{effect:r,fragment:t})}else H(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Mn(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(H(n.effect),this.#n.delete(e))};ensure(e,t){var n=M,r=cn();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=F();i.append(a),this.#n.set(e,{effect:V(()=>t(a)),fragment:i})}else this.#t.set(e,V(()=>t(this.anchor)))}if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else E&&(this.anchor=D),this.#a(n)}};function $(e,t,n=!1){var r;E&&(r=D,ke());var i=new Fr(e),a=n?ie:0;function o(e,t){if(E){var n=Me(r);if(e!==parseInt(n.substring(1))){var a=je();O(a),i.anchor=a,Oe(!1),i.ensure(e,t),Oe(!0);return}}i.ensure(e,t)}En(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}function Ir(e,t,n){for(var r=[],i=t.length,a,o=t.length,s=0;s<i;s++){let n=t[s];Mn(n,()=>{if(a){if(a.pending.delete(n),a.done.add(n),a.pending.size===0){var t=e.outrogroups;Lr(e,u(a.done)),t.delete(a),t.size===0&&(e.outrogroups=null)}}else--o},!1)}if(o===0){var c=r.length===0&&n!==null&&e.pending.size===0;if(c){var l=n,d=l.parentNode;sn(d),d.append(l),e.items.clear()}Lr(e,t,!c)}else a={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(a)}function Lr(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i<t.length;i++){var a=t[i];r?.has(a)?(a.f|=ce,In(a,document.createDocumentFragment())):H(t[i],n)}}var Rr;function zr(e,t,n,r,i,a=null){var o=e,c=new Map;if(t&4){var l=e;o=E?O(I(l)):l.appendChild(F())}E&&ke();var d=null,f=gt(()=>{var e=n();return s(e)?e:e==null?[]:u(e)}),p=new Map,m=!0;function h(e){if(!(_.effect.f&16384)){_.pending.delete(e);var n=J(f);_.fallback=d,Vr(_,n,o,t,r),d!==null&&(n.length===0?d.f&33554432?(d.f^=ce,Ur(d,null,o)):Pn(d):Mn(d,()=>{d=null}))}}function g(e){_.pending.delete(e)}var _={effect:En(()=>{var e=J(f),s=e.length;let l=!1;E&&Me(o)===`[!`!=(s===0)&&(o=je(),O(o),Oe(!1),l=!0);for(var u=new Set,_=M,v=cn(),y=0;y<s;y+=1){E&&D.nodeType===8&&D.data===`]`&&(o=D,l=!0,Oe(!1));var b=e[y],x=r(b,y),S=m?null:c.get(x);S?(S.v&&qt(S.v,b),S.i&&qt(S.i,y),v&&_.unskip_effect(S.e)):(S=Hr(c,m?o:Rr??=F(),b,x,y,i,t,n),m||(S.e.f|=ce),c.set(x,S)),u.add(x)}if(s===0&&a&&!d&&(m?d=V(()=>a(o)):(d=V(()=>a(Rr??=F())),d.f|=ce)),s>u.size&&Re(``,``,``),E&&s>0&&O(je()),!m){if(p.set(_,u),v){for(let[e,t]of c)u.has(e)||_.skip_effect(t.e);_.oncommit(h),_.ondiscard(g)}else h(_)}l&&Oe(!0),J(f)}),flags:t,items:c,pending:p,outrogroups:null,fallback:d};m=!1,E&&(o=D)}function Br(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function Vr(e,t,n,r,i){var a=!!(r&8),o=t.length,s=e.items,c=Br(e.effect.first),l,d=null,f,p=[],m=[],h,g,_,v;if(a)for(v=0;v<o;v+=1)h=t[v],g=i(h,v),_=s.get(g).e,_.f&33554432||(_.nodes?.a?.measure(),(f??=new Set).add(_));for(v=0;v<o;v+=1){if(h=t[v],g=i(h,v),_=s.get(g).e,e.outrogroups!==null)for(let t of e.outrogroups)t.pending.delete(_),t.done.delete(_);if(_.f&8192&&(Pn(_),a&&(_.nodes?.a?.unfix(),(f??=new Set).delete(_))),_.f&33554432){if(_.f^=ce,_===c)Ur(_,null,n);else{var y=d?d.next:c;_===e.effect.last&&(e.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),Wr(e,d,_),Wr(e,_,y),Ur(_,y,n),d=_,p=[],m=[],c=Br(d.next);continue}}if(_!==c){if(l!==void 0&&l.has(_)){if(p.length<m.length){var b=m[0],x;d=b.prev;var S=p[0],C=p[p.length-1];for(x=0;x<p.length;x+=1)Ur(p[x],b,n);for(x=0;x<m.length;x+=1)l.delete(m[x]);Wr(e,S.prev,C.next),Wr(e,d,S),Wr(e,C,b),c=b,d=C,--v,p=[],m=[]}else l.delete(_),Ur(_,c,n),Wr(e,_.prev,_.next),Wr(e,_,d===null?e.effect.first:d.next),Wr(e,d,_),d=_;continue}for(p=[],m=[];c!==null&&c!==_;)(l??=new Set).add(c),m.push(c),c=Br(c.next);if(c===null)continue}_.f&33554432||p.push(_),d=_,c=Br(_.next)}if(e.outrogroups!==null){for(let t of e.outrogroups)t.pending.size===0&&(Lr(e,u(t.done)),e.outrogroups?.delete(t));e.outrogroups.size===0&&(e.outrogroups=null)}if(c!==null||l!==void 0){var w=[];if(l!==void 0)for(_ of l)_.f&8192||w.push(_);for(;c!==null;)!(c.f&8192)&&c!==e.fallback&&w.push(c),c=Br(c.next);var ee=w.length;if(ee>0){var te=r&4&&o===0?n:null;if(a){for(v=0;v<ee;v+=1)w[v].nodes?.a?.measure();for(v=0;v<ee;v+=1)w[v].nodes?.a?.fix()}Ir(e,w,te)}}a&&nt(()=>{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function Hr(e,t,n,r,i,a,o,s){var c=o&1?o&16?Ut(n):Wt(n,!1,!1):null,l=o&2?Ut(i):null;return{v:c,i:l,e:V(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function Ur(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=an(r);if(a.before(r),r===i)return;r=o}}function Wr(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Gr(e,t,n=!1,r=!1,i=!1,a=!1){var o=e,s=``;if(n){var c=e;E&&(o=O(I(c)))}B(()=>{var e=W;if(s===(s=t()??``))E&&ke();else if(n&&!E)e.nodes=null,c.innerHTML=s,s!==``&&wr(I(c),c.lastChild);else if(e.nodes!==null&&(An(e.nodes.start,e.nodes.end),e.nodes=null),s!==``){if(E){for(var a=D.data,l=ke(),u=l;l!==null&&(l.nodeType!==8||l.data!==``);)u=l,l=an(l);if(l===null)throw Ee(),xe;wr(D,u),o=O(l)}else{var d=ln(r?`svg`:i?`math`:`template`,r?Ce:i?we:void 0);d.innerHTML=s;var f=r||i?d:d.content;if(wr(I(f),f.lastChild),r||i)for(;I(f);)o.before(I(f));else o.before(f)}}})}function Kr(e,t){let n=null,r=E;var i;if(E){n=D;for(var a=I(document.head);a!==null&&(a.nodeType!==8||a.data!==e);)a=an(a);if(a===null)Oe(!1);else{var o=an(a);a.remove(),O(o)}}E||(i=document.head.appendChild(F()));try{En(()=>{var e=V(()=>t(i));e.f|=ae,E||(e.nodes===null?e.nodes={start:i,end:i,a:null,t:null}:e.nodes.end=i)})}finally{r&&(Oe(!0),O(n))}}function qr(e,t,n){Sn(()=>{var r=sr(()=>t(e,n?.())||{});if(n&&r?.update){var i=!1,a={};wn(()=>{var e=n();cr(e),i&&Pe(a,e)&&(a=e,r.update(e))}),i=!0}if(r?.destroy)return()=>r.destroy()})}var Jr=[...`
2
+ \r\f\xA0\v`];function Yr(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||Jr.includes(r[o-1]))&&(s===r.length||Jr.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function Xr(e,t=!1){var n=t?` !important;`:`;`,r=``;for(var i of Object.keys(e)){var a=e[i];a!=null&&a!==``&&(r+=` `+i+`: `+a+n)}return r}function Zr(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function Qr(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\/\*.*?\*\//g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(Zr)),i&&c.push(...Object.keys(i).map(Zr));var l=0,u=-1;let t=e.length;for(var d=0;d<t;d++){var f=e[d];if(s?f===`/`&&e[d-1]===`*`&&(s=!1):a?a===f&&(a=!1):f===`/`&&e[d+1]===`*`?s=!0:f===`"`||f===`'`?a=f:f===`(`?o++:f===`)`&&o--,!s&&a===!1&&o===0){if(f===`:`&&u===-1)u=d;else if(f===`;`||d===t-1){if(u!==-1){var p=Zr(e.substring(l,u).trim());if(!c.includes(p)){f!==`;`&&d++;var m=e.substring(l,d).trim();n+=` `+m+`;`}}l=d+1,u=-1}}}}return r&&(n+=Xr(r)),i&&(n+=Xr(i,!0)),n=n.trim(),n===``?null:n}return e==null?null:String(e)}function $r(e,t,n,r,i,a){var o=e[ge];if(E||o!==n||o===void 0){var s=Yr(n,r,a);(!E||s!==e.getAttribute(`class`))&&(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e[ge]=n}else if(a&&i!==a)for(var c in a){var l=!!a[c];(i==null||l!==!!i[c])&&e.classList.toggle(c,l)}return a}function ei(e,t={},n,r){for(var i in n){var a=n[i];t[i]!==a&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,a,r))}}function ti(e,t,n,r){var i=e[_e];if(E||i!==t){var a=Qr(t,r);(!E||a!==e.getAttribute(`style`))&&(a==null?e.removeAttribute(`style`):e.style.cssText=a),e[_e]=t}else r&&(Array.isArray(r)?(ei(e,n?.[0],r[0]),ei(e,n?.[1],r[1],`important`)):ei(e,n,r));return r}var ni=Symbol(`is custom element`),ri=Symbol(`is html`),ii=be?`link`:`LINK`;function ai(e,t,n,r){var i=oi(e);E&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===ii)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[me]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&ci(e).has(t)?e[t]=n:e.setAttribute(t,n))}function oi(e){return e[he]??={[ni]:e.nodeName.includes(`-`),[ri]:e.namespaceURI===Se}}var si=new Map;function ci(e){var t=e.getAttribute(`is`)||e.nodeName,n=si.get(t);if(n)return n;si.set(t,n=new Set);for(var r,i=e,a=Element.prototype;a!==i;){for(var o in r=p(i),r)r[o].set&&o!==`innerHTML`&&o!==`textContent`&&o!==`innerText`&&n.add(o);i=g(i)}return n}function li(e,t){return e===t||e?.[fe]===t}function ui(e=Qe(),t,n,r){var i=A.r,a=W;return Sn(()=>{var o,s;return wn(()=>{o=s,s=r?.()||[],sr(()=>{li(n(...s),e)||(t(e,...s),o&&li(n(...o),e)&&t(null,...o))})}),()=>{let r=a;for(;r!==i&&r.parent!==null&&r.parent.f&33554432;)r=r.parent;let o=()=>{s&&li(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}function di(e=!1){let t=A,n=t.l.u;if(!n)return;let r=()=>cr(t.s);if(e){let e=0,n={},i=ft(()=>{let r=!1,i=t.s;for(let e in i)i[e]!==n[e]&&(n[e]=i[e],r=!0);return r&&e++,e});r=()=>J(i)}n.b.length&&bn(()=>{fi(t,r),b(n.b)}),vn(()=>{let e=sr(()=>n.m.map(y));return()=>{for(let t of e)typeof t==`function`&&t()}}),n.a.length&&vn(()=>{fi(t,r),b(n.a)})}function fi(e,t){if(e.l.s)for(let t of e.l.s)J(t);t()}function pi(e){A===null&&Ie(`onMount`),qe&&A.l!==null?hi(A).m.push(e):vn(()=>{let t=sr(e);if(typeof t==`function`)return t})}function mi(e){A===null&&Ie(`onDestroy`),pi(()=>()=>sr(e))}function hi(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);var gi=class extends Error{status;constructor(e,t){super(t),this.name=`ApiError`,this.status=e}};async function _i(e,n={}){let r={Accept:`application/json`};n.etag&&(r[`If-None-Match`]=n.etag);let i=await fetch(`${t}${e}`,{signal:n.signal,headers:r});if(i.status===304)return{status:`not-modified`,etag:i.headers.get(`etag`)};if(!i.ok){let e=i.statusText||`Request failed with ${i.status}`;try{let t=await i.json();t.error?.message&&(e=t.error.message)}catch{}throw new gi(i.status,e)}return{status:`ok`,page:await i.json(),etag:i.headers.get(`etag`)}}var vi={rootLabel:`srvmd`,version:`0.0.0`,theme:`auto`,live:!1,single:!1,mermaid:!0};function yi(){if(typeof document>`u`)return vi;let t=document.getElementById(e);if(!t?.textContent)return vi;try{return{...vi,...JSON.parse(t.textContent)}}catch{return vi}}var bi=yi();Je();var xi=X(`<footer class="footer"> </footer>`);function Si(e,t){Xe(t,!1),di();var n=xi(),r=R(n);B(()=>Q(r,`Rendered by srvmd · ${bi.rootLabel??``}`)),Z(e,n),Ze()}function Ci(){return typeof document<`u`&&document.documentElement.dataset.theme===`dark`||typeof matchMedia==`function`&&matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}var wi=Zt({value:Ci()});function Ti(e){wi.value=e,typeof document<`u`&&(document.documentElement.dataset.theme=e);try{localStorage.setItem(a,e)}catch{}}function Ei(){Ti(wi.value===`dark`?`light`:`dark`)}var Di=X(`<button class="btn theme-toggle" type="button" title="Toggle dark mode" aria-label="Toggle dark mode"><svg class="icon-sun" viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><circle cx="12" cy="12" r="4.5" fill="none" stroke="currentColor" stroke-width="1.8"></circle><path d="M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M18.7 5.3l-1.4 1.4M6.7 17.3l-1.4 1.4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"></path></svg> <svg class="icon-moon" viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><path d="M20 14.5A8.5 8.5 0 0 1 9.5 4a8.5 8.5 0 1 0 10.5 10.5Z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"></path></svg></button>`);function Oi(e){var t=Di();Y(`click`,t,function(...e){Ei?.apply(this,e)}),Z(e,t)}_r([`click`]);var ki=X(`<span class="sep">/</span>`),Ai=X(`<span aria-current="page"> </span>`),ji=X(`<a> </a>`),Mi=X(`<!> <!>`,1),Ni=X(`<nav class="crumbs" aria-label="Breadcrumb"></nav>`);function Pi(e,t){Xe(t,!0);var n=Tr(),r=on(n),i=e=>{var n=Ni();zr(n,23,()=>t.crumbs,e=>`${e.href}:${e.label}`,(e,n,r)=>{var i=Mi(),a=on(i),o=e=>{Z(e,ki())};$(a,e=>{J(r)>0&&e(o)});var s=z(a,2),c=e=>{var t=Ai(),r=R(t,!0);B(()=>Q(r,J(n).label)),Z(e,t)},l=e=>{var t=ji(),r=R(t,!0);B(()=>{ai(t,`href`,J(n).href),Q(r,J(n).label)}),Z(e,t)};$(s,e=>{J(r)===t.crumbs.length-1?e(c):e(l,-1)}),Z(e,i)}),k(n),Z(e,n)};$(r,e=>{t.crumbs.length>0&&e(i)}),Z(e,n),Ze()}var Fi=X(`<a class="btn" title="View Markdown source">Raw</a>`),Ii=X(`<header class="topbar"><!> <div class="actions"><!> <!></div></header>`);function Li(e,t){var n=Ii(),r=L(n);Pi(r,{get crumbs(){return t.crumbs}});var i=z(r,2),a=L(i),o=e=>{var n=Fi();B(()=>ai(n,`href`,t.rawHref)),Z(e,n)};$(a,e=>{t.rawHref&&e(o)}),Oi(z(a,2),{}),k(i),k(n),Z(e,n)}var Ri=X(`<!> <div class="layout"><main class="content"><p class="loading">Loading…</p></main></div> <!>`,1);function zi(e,t){Xe(t,!0);let n=ht(()=>[{label:bi.rootLabel,href:`/`}]);var r=Ri(),i=on(r);Li(i,{get crumbs(){return J(n)}}),Si(z(i,4),{}),Z(e,r),Ze()}function Bi(e){if(e==null||!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n<10?n.toFixed(1):Math.round(n)} ${t[r]}`}function Vi(e){if(!e)return``;let t=new Date(e);if(Number.isNaN(t.getTime()))return``;let n=t.toISOString();return`${n.slice(0,10)} ${n.slice(11,16)}`}var Hi=X(`<li class="entry entry-dir"><span class="entry-icon">↩</span> <a>..</a></li>`),Ui=X(`<a class="raw-link" title="View source">raw</a>`),Wi=X(`<li><span class="entry-icon" aria-hidden="true"> </span> <a class="entry-name"> </a> <!> <span class="entry-meta"> </span></li>`),Gi=X(`<p class="empty">This directory is empty.</p>`),Ki=X(`<ul class="entries"><!> <!></ul> <!>`,1);function qi(e,t){Xe(t,!0);function n(e){let t=encodeURIComponent(e.name);return e.kind===`dir`?`${t}/`:t}function r(e){return e.kind===`dir`?`📁`:e.kind===`markdown`?`📝`:`📄`}function i(e){let t=[];return e.size!=null&&e.kind!==`dir`&&t.push(Bi(e.size)),e.mtime&&t.push(Vi(e.mtime)),t.join(` · `)}var a=Ki(),o=on(a),s=L(o),c=e=>{var n=Hi(),r=z(L(n),2);k(n),B(()=>ai(r,`href`,t.parentHref)),Z(e,n)};$(s,e=>{t.parentHref&&e(c)}),zr(z(s,2),17,()=>t.entries,e=>e.name,(e,t)=>{var a=Wi(),o=L(a),s=R(o,!0),c=z(o,2),l=R(c),u=z(c,2),d=e=>{var r=Ui();B(e=>ai(r,`href`,e),[()=>`${n(J(t))}?raw`]),Z(e,r)};$(u,e=>{J(t).kind===`markdown`&&e(d)});var f=R(z(u,2),!0);k(a),B((e,n,r)=>{$r(a,1,`entry entry-${J(t).kind}`),Q(s,e),ai(c,`href`,n),Q(l,`${J(t).name??``}${J(t).kind===`dir`?`/`:``}`),Q(f,r)},[()=>r(J(t)),()=>n(J(t)),()=>i(J(t))]),Z(e,a)}),k(o);var l=z(o,2),u=e=>{Z(e,Gi())};$(l,e=>{t.entries.length===0&&!t.parentHref&&e(u)}),Z(e,a),Ze()}var Ji=X(`<!> <div class="layout"><main class="content"><div class="listing"><h1> </h1> <!></div></main></div> <!>`,1);function Yi(e,t){Xe(t,!0);var n=Ji(),r=on(n);Li(r,{get crumbs(){return t.page.breadcrumbs}});var i=z(r,2),a=L(i),o=L(a),s=L(o),c=R(s,!0);qi(z(s,2),{get entries(){return t.page.entries},get parentHref(){return t.page.parentHref}}),k(o),k(a),k(i),Si(z(i,2),{}),B(()=>Q(c,t.page.heading)),Z(e,n),Ze()}var Xi=null;function Zi(){return globalThis.mermaid}function Qi(){let e=Zi();return e?Promise.resolve(e):(Xi??=new Promise((e,t)=>{let n=document.createElement(`script`);n.src=r,n.async=!0,n.addEventListener(`load`,()=>{let n=Zi();n?e(n):t(Error(`Mermaid did not initialize.`))}),n.addEventListener(`error`,()=>t(Error(`Failed to load the Mermaid bundle.`))),document.head.appendChild(n)}).catch(e=>{throw Xi=null,e}),Xi)}var $i=null,ea=Promise.resolve(),ta=0;function na(e,t){$i!==t&&(e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:t===`dark`?`dark`:`default`,themeVariables:{background:`transparent`},fontFamily:typeof document>`u`?void 0:getComputedStyle(document.body).fontFamily}),$i=t)}function ra(){let e=Error(`Mermaid render was cancelled`);return e.name=`AbortError`,e}function ia(e,t){let n=ea.then(()=>{if(t?.aborted)throw ra();return e()},()=>{if(t?.aborted)throw ra();return e()});return ea=n.then(()=>void 0,()=>void 0),n}function aa(e,t,n){return ia(async()=>{let r=await Qi();if(n?.aborted)throw ra();return na(r,t),ta+=1,r.render(`serve-md-mermaid-${ta}`,e)},n)}var oa=Zt({open:!1,source:``});function sa(e){oa.source=e,oa.open=!0}function ca(){oa.open=!1}var la=X(`<div class="mermaid-canvas"></div>`),ua=X(`<pre class="mermaid-source"><code> </code></pre>`),da=X(`<span class="mermaid-hint">Click to open fullscreen</span>`),fa=X(`<span class="mermaid-status"> </span>`),pa=X(`<span class="mermaid-pending">Rendering…</span>`),ma=X(`<div class="mermaid-figure" role="button"><!> <div class="mermaid-caption"><!></div></div>`);function ha(e,t){Xe(t,!0);let n=N(`pending`),r=N(``),i=N(``),a=N(void 0),o=0;function s(e){let t=e instanceof Error?e.message:String(e);return t.length>320?`${t.slice(0,317)}...`:t}vn(()=>{let e=++o,c=t.source,l=wi.value,u=new AbortController;return P(n,`pending`),P(r,``),P(i,``),aa(c,l,u.signal).then(t=>{e===o&&(P(r,t.svg,!0),P(n,`rendered`),ir().then(()=>{if(e!==o)return;let n=J(a)?.querySelector(`.mermaid-canvas`);n&&t.bindFunctions?.(n)}))}).catch(t=>{e!==o||u.signal.aborted||(P(i,s(t),!0),P(n,`error`))}),()=>{e===o&&o++,u.abort()}});function c(){J(n)===`rendered`&&sa(t.source)}function l(e){J(n)===`rendered`&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())}var u=ma(),d=L(u),f=e=>{var t=la();Gr(t,()=>J(r),!0),k(t),Z(e,t)},p=e=>{var n=ua(),r=R(L(n),!0);k(n),B(()=>Q(r,t.source)),Z(e,n)};$(d,e=>{J(n)===`rendered`?e(f):e(p,-1)});var m=z(d,2),h=L(m),g=e=>{Z(e,da())},_=e=>{var t=fa(),n=R(t);B(()=>Q(n,`Mermaid error: ${J(i)??``}`)),Z(e,t)},v=e=>{Z(e,pa())};$(h,e=>{J(n)===`rendered`?e(g):J(n)===`error`?e(_,1):e(v,-1)}),k(m),k(u),ui(u,e=>P(a,e),()=>J(a)),B(()=>{ai(u,`data-mermaid-state`,J(n)),ai(u,`tabindex`,J(n)===`rendered`?0:void 0),ai(u,`aria-disabled`,J(n)!==`rendered`),ai(u,`aria-label`,J(n)===`rendered`?`Open Mermaid diagram in fullscreen`:`Mermaid diagram`)}),Y(`click`,u,c),Y(`keydown`,u,l),Z(e,u),Ze()}_r([`click`,`keydown`]);function ga(e,t){let n=t,r=[],i=!1,a=0;function o(){for(let e of r)Pr(e.component);r=[]}function s(){if(i)return;let t=new Map(n.map(e=>[e.id,e.source])),a=new Map(r.map(e=>[e.id,e])),o=[];for(let n of e.querySelectorAll(`[data-mermaid-slot]`)){let e=n.dataset.mermaidSlot;if(e===void 0)continue;let r=t.get(e);if(r===void 0)continue;let i=a.get(e);i&&i.source===r&&i.target===n?(a.delete(e),o.push(i)):(i&&(Pr(i.component),a.delete(e)),o.push({id:e,source:r,target:n,component:Ar(ha,{target:n,props:{source:r}})}))}for(let e of a.values())Pr(e.component);r=o}function c(){let e=++a;ir().then(()=>{e===a&&!i&&s()})}return c(),{update(e){n=e,c()},destroy(){i=!0,a++,o()}}}var _a=X(`<div class="markdown-body"></div>`);function va(e,t){var n=_a();Gr(n,()=>t.html,!0),k(n),qr(n,(e,t)=>ga?.(e,t),()=>t.diagrams),Z(e,n)}var ya=X(`<li><a> </a></li>`),ba=X(`<aside class="toc" aria-label="Table of contents"><p class="toc-title">On this page</p> <ul></ul></aside>`);function xa(e,t){Xe(t,!0);let n=ht(()=>t.items.filter(e=>e.level>=2&&e.level<=4)),r=ht(()=>J(n).length>0?Math.min(...J(n).map(e=>e.level)):0);var i=Tr(),a=on(i),o=e=>{var t=ba(),i=z(L(t),2);zr(i,21,()=>J(n),e=>e.id,(e,t)=>{var n=ya(),i=L(n),a=R(i,!0);k(n),B(e=>{$r(n,1,e),ai(i,`href`,`#${J(t).id}`),Q(a,J(t).text)},[()=>`toc-level-${Math.min(J(t).level-J(r),2)}`]),Z(e,n)}),k(i),k(t),Z(e,t)};$(a,e=>{J(n).length>=2&&e(o)}),Z(e,i),Ze()}var Sa=X(`<div class="warning"> </div>`),Ca=X(`<!> <div><!> <main class="content"><!> <!></main></div> <!>`,1);function wa(e,t){Xe(t,!0);let n=ht(()=>t.page.toc.filter(e=>e.level>=2&&e.level<=4));var r=Ca(),i=on(r);Li(i,{get crumbs(){return t.page.breadcrumbs},get rawHref(){return t.page.rawHref}});var a=z(i,2);let o;var s=L(a);xa(s,{get items(){return t.page.toc}});var c=z(s,2),l=L(c),u=e=>{var n=Sa(),r=R(n,!0);B(()=>Q(r,t.page.warning)),Z(e,n)};$(l,e=>{t.page.warning&&e(u)}),va(z(l,2),{get html(){return t.page.html},get diagrams(){return t.page.mermaid}}),k(c),k(a),Si(z(a,2),{}),B(()=>o=$r(a,1,`layout`,null,o,{"has-toc":J(n).length>=2})),Z(e,r),Ze()}var Ta=X(`<!> <div class="layout"><main class="content"><div class="error-page"><p class="error-code"> </p> <h1> </h1> <p class="error-message"> </p> <p><a href="/">Go to the root directory</a></p></div></main></div> <!>`,1);function Ea(e,t){Xe(t,!0);let n=ht(()=>[{label:bi.rootLabel,href:`/`}]);var r=Ta(),i=on(r);Li(i,{get crumbs(){return J(n)}});var a=z(i,2),o=L(a),s=L(o),c=L(s),l=R(c,!0),u=z(c,2),d=R(u,!0),f=R(z(u,2),!0);Ae(2),k(s),k(o),k(a),Si(z(a,2),{}),B(()=>{Q(l,t.status),Q(d,t.status===404?`Page not found`:`Something went wrong`),Q(f,t.message)}),Z(e,r),Ze()}function Da(e){return Math.max(.1,Math.min(8,e))}function Oa(e,t,n,r,i=36){let a=Math.max(e,1),o=Math.max(t,1),s=Math.max(n-i*2,80),c=Math.max(r-i*2,80),l=Da(Math.min(s/a,c/o,1.5));return{width:a,height:o,scale:l,x:(n-a*l)/2,y:(r-o*l)/2}}function ka(e,t,n,r){let i=Da(r),a=i/e.scale;return{...e,scale:i,x:t-(t-e.x)*a,y:n-(n-e.y)*a}}function Aa(e,t,n,r){return ka(e,t/2,n/2,e.scale*r)}function ja(e,t,n){return{...e,x:e.x+t,y:e.y+n}}function Ma(e,t){let n=t,r=e=>n(e);return e.addEventListener(`wheel`,r,{passive:!1}),{update(e){n=e},destroy(){e.removeEventListener(`wheel`,r)}}}var Na=X(`<p class="mermaid-modal-loading">Rendering…</p>`),Pa=X(`<p class="mermaid-modal-error"> </p>`),Fa=X(`<dialog class="mermaid-modal" aria-label="Mermaid diagram viewer"><div class="mermaid-modal-bar"><span class="mermaid-modal-title">Mermaid diagram</span> <div class="mermaid-modal-actions"><button type="button" class="mermaid-modal-button" aria-label="Zoom out" title="Zoom out">−</button> <span class="mermaid-modal-zoom" aria-live="polite"> </span> <button type="button" class="mermaid-modal-button" aria-label="Zoom in" title="Zoom in">+</button> <button type="button" class="mermaid-modal-button" aria-label="Fit to window" title="Fit to window">Fit</button> <button type="button" class="mermaid-modal-button" aria-label="Close" title="Close">×</button></div></div> <div role="application" aria-label="Mermaid diagram viewport" tabindex="-1"><div class="mermaid-modal-stage"><!></div> <!> <!></div> <p class="mermaid-modal-hint">Drag to pan · Scroll or pinch to zoom · Esc to close</p></dialog>`);function Ia(e,t){Xe(t,!0);let n=N(void 0),r=N(void 0),i=N(void 0),a=N(null),o=N(``),s=N(!1),c=N(``),l=N(!1),u=0,d=new Map,f=null,p=null,m=ht(()=>J(a)?`width:${J(a).width*J(a).scale}px;height:${J(a).height*J(a).scale}px;transform:translate(${J(a).x}px, ${J(a).y}px)`:void 0),h=ht(()=>`${Math.round((J(a)?.scale??1)*100)}%`);function g(e){let t=e instanceof Error?e.message:String(e);return t.length>320?`${t.slice(0,317)}...`:t}function _(e){typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(e,0)}function v(e){let t=new DOMParser().parseFromString(e,`image/svg+xml`).documentElement,n=t.getAttribute(`viewBox`)??t.getAttribute(`viewbox`);if(n){let e=n.split(/[\s,]+/).map(Number),t=e[2],r=e[3];if(t&&r&&Number.isFinite(t)&&Number.isFinite(r))return{width:t,height:r}}let r=Number.parseFloat(t.getAttribute(`width`)??``),i=Number.parseFloat(t.getAttribute(`height`)??``);return{width:Number.isFinite(r)&&r>0?r:800,height:Number.isFinite(i)&&i>0?i:600}}function y(){J(a)&&J(r)&&P(a,Oa(J(a).width,J(a).height,J(r).clientWidth,J(r).clientHeight),!0)}function b(e){J(a)&&J(r)&&P(a,Aa(J(a),J(r).clientWidth,J(r).clientHeight,e),!0)}function x(){J(n)?.open?typeof J(n).close==`function`?J(n).close():(J(n).open=!1,S()):ca()}function S(){u++,ca(),P(o,``),P(a,null),P(c,``),P(s,!1),P(l,!1),d.clear(),f=null,p=null,document.documentElement.classList.remove(`mermaid-modal-open`)}function C(e){if(!J(a)||!J(r))return;e.preventDefault();let t=J(r).getBoundingClientRect(),n=e.deltaY;e.deltaMode===1?n*=16:e.deltaMode===2&&(n*=J(r).clientHeight),P(a,ka(J(a),e.clientX-t.left,e.clientY-t.top,J(a).scale*Math.exp(-n*.0015)),!0)}function w(){let e=[...d.values()],t=e[0],n=e[1];return!t||!n?null:{x:(t.x+n.x)/2,y:(t.y+n.y)/2,distance:Math.hypot(t.x-n.x,t.y-n.y)||1}}function ee(e){if(J(r)&&J(a)&&(e.pointerType!==`mouse`||e.button===0)){e.preventDefault(),d.set(e.pointerId,{x:e.clientX,y:e.clientY});try{J(r).setPointerCapture(e.pointerId)}catch{}P(l,!0),d.size>=2?(p=w(),f=null):f={x:e.clientX,y:e.clientY}}}function te(e){if(!J(r)||!J(a)||!d.has(e.pointerId))return;if(d.set(e.pointerId,{x:e.clientX,y:e.clientY}),d.size>=2){let e=w();if(p&&e){let t=J(r).getBoundingClientRect();P(a,ka(J(a),e.x-t.left,e.y-t.top,J(a).scale*(e.distance/p.distance)),!0),P(a,ja(J(a),e.x-p.x,e.y-p.y),!0)}p=e,f=null;return}let t=d.get(e.pointerId);f&&t&&(P(a,ja(J(a),t.x-f.x,t.y-f.y),!0),f=t)}function ne(e){if(J(r)&&d.has(e.pointerId)){if(d.delete(e.pointerId),J(r).hasPointerCapture(e.pointerId))try{J(r).releasePointerCapture(e.pointerId)}catch{}if(d.size===0)f=null,p=null,P(l,!1);else{p=null;let e=[...d.values()][0];f=e?{x:e.x,y:e.y}:null}}}function re(e){J(a)&&J(r)&&(e.key===`+`||e.key===`=`?(e.preventDefault(),b(1.25)):e.key===`-`?(e.preventDefault(),b(.8)):e.key===`0`?(e.preventDefault(),y()):e.key===`ArrowLeft`?(e.preventDefault(),P(a,ja(J(a),40,0),!0)):e.key===`ArrowRight`?(e.preventDefault(),P(a,ja(J(a),-40,0),!0)):e.key===`ArrowUp`?(e.preventDefault(),P(a,ja(J(a),0,40),!0)):e.key===`ArrowDown`&&(e.preventDefault(),P(a,ja(J(a),0,-40),!0)))}function ie(e){e.target===J(n)&&x()}vn(()=>{J(n)&&(oa.open?(J(n).open||(typeof J(n).showModal==`function`?J(n).showModal():J(n).open=!0),document.documentElement.classList.add(`mermaid-modal-open`)):J(n).open&&(typeof J(n).close==`function`?J(n).close():(J(n).open=!1,S())))}),vn(()=>{let e=oa.open,t=oa.source,n=wi.value;if(!e)return;let l=++u,d=new AbortController;return P(s,!0),P(c,``),P(o,``),P(a,null),aa(t,n,d.signal).then(e=>{if(l!==u)return;let t=v(e.svg);P(o,e.svg,!0),P(s,!1),P(a,Oa(t.width,t.height,800,600),!0),ir().then(()=>{l===u&&_(()=>{l===u&&(J(i)&&e.bindFunctions?.(J(i)),y(),J(r)?.focus())})})}).catch(e=>{l!==u||d.signal.aborted||(P(s,!1),P(c,g(e),!0))}),()=>{l===u&&u++,d.abort()}}),mi(()=>{u++,document.documentElement.classList.remove(`mermaid-modal-open`)});var ae=Fa(),oe=L(ae),se=z(L(oe),2),ce=L(se),le=z(ce,2),ue=R(le,!0),de=z(le,2),fe=z(de,2),pe=z(fe,2);k(se),k(oe);var me=z(oe,2);let he;var ge=L(me),_e=L(ge),ve=e=>{var t=Tr();Gr(on(t),()=>J(o)),Z(e,t)};$(_e,e=>{J(o)&&e(ve)}),k(ge),ui(ge,e=>P(i,e),()=>J(i));var ye=z(ge,2),be=e=>{Z(e,Na())};$(ye,e=>{J(s)&&e(be)});var xe=z(ye,2),T=e=>{var t=Pa(),n=R(t);B(()=>Q(n,`Mermaid error: ${J(c)??``}`)),Z(e,t)};$(xe,e=>{J(c)&&e(T)}),k(me),ui(me,e=>P(r,e),()=>J(r)),qr(me,(e,t)=>Ma?.(e,t),()=>C),Ae(2),k(ae),ui(ae,e=>P(n,e),()=>J(n)),B(()=>{Q(ue,J(h)),he=$r(me,1,`mermaid-modal-viewport`,null,he,{"is-dragging":J(l)}),ti(ge,J(m))}),gr(`close`,ae,S),Y(`click`,ae,ie),Y(`keydown`,ae,re),Y(`click`,ce,()=>b(.8)),Y(`click`,de,()=>b(1.25)),Y(`click`,fe,y),Y(`click`,pe,x),Y(`pointerdown`,me,ee),Y(`pointermove`,me,te),Y(`pointerup`,me,ne),gr(`pointercancel`,me,ne),Y(`dblclick`,me,y),Z(e,ae),Ze()}_r([`click`,`keydown`,`pointerdown`,`pointermove`,`pointerup`,`dblclick`]);var La=X(`<!> <!>`,1);function Ra(e,t){Xe(t,!0);let r=N(Zt({status:`loading`})),a=null,s=0,c=null,l=window.location.pathname,u=ht(()=>J(r).status===`error`?String(J(r).code):J(r).status===`ready`?J(r).page.kind===`document`?J(r).page.title:J(r).page.kind===`directory`?J(r).page.heading:`srvmd`:`srvmd`);function d(e){e.kind===`document`?document.documentElement.lang=e.lang??`en`:e.kind===`directory`&&(document.documentElement.lang=`en`)}async function f(e=!1){a?.abort();let t=new AbortController;a=t;let n=++s;e||P(r,{status:`loading`},!0);try{let i=await _i(l,{signal:t.signal,etag:J(r).status===`ready`?c:null});if(n!==s)return;if(i.status===`not-modified`){c=i.etag??c;return}let a=i.page;if(c=i.etag,a.kind===`redirect`){window.location.replace(a.location);return}e&&ca(),P(r,{status:`ready`,page:a},!0),d(a)}catch(e){if(t.signal.aborted||n!==s)return;let i=e instanceof gi?e.status:500,a=e instanceof Error?e.message:String(e);P(r,{status:`error`,code:i,message:a},!0)}}pi(()=>{f();let e=bi.live?o(e=>{if(e.files.some(i)){window.location.reload();return}let t=J(r).status===`ready`?J(r).page.kind:null;(bi.single||n(l,e.files,t))&&f(!0)}):void 0;return()=>{a?.abort(),e?.()}});var p=La();Kr(`16t12jp`,e=>{Tn(()=>{$t.title=J(u)??``})});var m=on(p),h=e=>{zi(e,{})},g=e=>{Ea(e,{get status(){return J(r).code},get message(){return J(r).message}})},_=e=>{wa(e,{get page(){return J(r).page}})},v=e=>{Yi(e,{get page(){return J(r).page}})},y=e=>{zi(e,{})};$(m,e=>{J(r).status===`loading`?e(h):J(r).status===`error`?e(g,1):J(r).page.kind===`document`?e(_,2):J(r).page.kind===`directory`?e(v,3):e(y,-1)}),Ia(z(m,2),{}),Z(e,p),Ze()}var za=document.getElementById(`app`);if(!za)throw Error(`Missing #app mount target`);Ar(Ra,{target:za});
@@ -0,0 +1 @@
1
+ var e=`/__api/page`,t=`/__serve_md_mermaid.js`,n=[`.md`,`.markdown`,`.html`,`.htm`],r=`serve-md-config`,i=`serve-md-theme`,a=/\.css$/i,o=[`index.md`,`index.html`];function s(e){try{return decodeURIComponent(e)}catch{return e}}function c(e){return e.replace(/^\/+/,``).replace(/\/+$/,``).toLowerCase()}function l(e){return e.slice(e.lastIndexOf(`/`)+1).includes(`.`)}function u(e){return a.test(e)}function d(e,t,r=null){if(t.length===0)return!0;let i=s(e),a=c(i),d=i===``||i.endsWith(`/`),f=r===`directory`||r===null&&d,p=a===``?o:o.map(e=>`${a}/${e}`);for(let e of t){let t=c(s(e));if(!t||u(t)||t===a||p.includes(t)||!l(a)&&n.some(e=>t===`${a}${e}`))return!0;if(f){let e=a===``?``:`${a}/`;if(e===``||t.startsWith(e))return!0}}return!1}function f(e){let t=!1,n=null,r=500,i;function a(){if(t)return;let o=location.protocol===`https:`?`wss:`:`ws:`;n=new WebSocket(`${o}//${location.host}/__serve_md_live`),n.onopen=()=>{r=500},n.onmessage=t=>{try{let n=JSON.parse(String(t.data));n.type===`reload`&&e(n)}catch{}},n.onclose=()=>{n=null,!t&&(r=Math.min(r*2,5e3),i=setTimeout(a,r))},n.onerror=()=>{n?.close()}}return a(),()=>{t=!0,i&&clearTimeout(i),n?.close()}}export{r as a,e as i,d as n,t as o,u as r,i as s,f as t};
@@ -7,8 +7,8 @@
7
7
  <title>srvmd</title>
8
8
  <script id="serve-md-config" type="application/json">"__SERVE_MD_CONFIG__"</script>
9
9
  <script src="/__app/theme-boot.js"></script>
10
- <script type="module" crossorigin src="/__app/assets/index-BjX1ijWA.js"></script>
11
- <link rel="modulepreload" crossorigin href="/__app/assets/live-CRaSJLxT.js">
10
+ <script type="module" crossorigin src="/__app/assets/index-NKmyLGCo.js"></script>
11
+ <link rel="modulepreload" crossorigin href="/__app/assets/live-BEtNAdWQ.js">
12
12
  <link rel="stylesheet" crossorigin href="/__app/assets/index-DRuRRv0z.css">
13
13
  </head>
14
14
  <body>
@@ -1 +1 @@
1
- import{t as e}from"./assets/live-CRaSJLxT.js";var t=`serve-md-scroll`;e(()=>{try{sessionStorage.setItem(t,String(window.scrollY))}catch{}window.location.reload()}),window.addEventListener(`load`,()=>{try{let e=sessionStorage.getItem(t);if(e===null)return;sessionStorage.removeItem(t),window.scrollTo({top:Number(e)})}catch{}});
1
+ import{t as e}from"./assets/live-BEtNAdWQ.js";var t=`serve-md-scroll`;e(()=>{try{sessionStorage.setItem(t,String(window.scrollY))}catch{}window.location.reload()}),window.addEventListener(`load`,()=>{try{let e=sessionStorage.getItem(t);if(e===null)return;sessionStorage.removeItem(t),window.scrollTo({top:Number(e)})}catch{}});
@@ -1,2 +0,0 @@
1
- import{a as e,i as t,n,r,t as i}from"./live-CRaSJLxT.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var a=Array.isArray,o=Array.prototype.indexOf,s=Array.prototype.includes,c=Array.from,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d=Object.getOwnPropertyDescriptors,f=Object.prototype,p=Array.prototype,m=Object.getPrototypeOf,h=Object.isExtensible,ee=()=>{};function g(e){return e()}function _(e){for(var t=0;t<e.length;t++)e[t]()}function v(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var y=1024,b=2048,x=4096,te=8192,ne=16384,re=32768,ie=1<<25,ae=65536,oe=1<<18,se=1<<19,ce=1<<20,le=1<<25,ue=1<<21,de=1<<22,fe=1<<23,pe=Symbol(`$state`),me=Symbol(`component`),he=Symbol(``),ge=Symbol(`attributes`),S=Symbol(`class`),_e=Symbol(`style`),ve=Symbol(`text`),ye=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},be=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`),xe={},C=Symbol(`uninitialized`),Se=`http://www.w3.org/1999/xhtml`,Ce=`http://www.w3.org/2000/svg`,we=`http://www.w3.org/1998/Math/MathML`;function Te(){console.warn(`https://svelte.dev/e/derived_inert`)}function Ee(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function De(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var w=!1;function Oe(e){w=e}var T;function E(e){if(e===null)throw Ee(),xe;return T=e}function ke(){return E(L(T))}function D(e){if(w){if(L(T)!==null)throw Ee(),xe;T=e}}function Ae(e=1){if(w){for(var t=e,n=T;t--;)n=L(n);T=n}}function je(e=!0){for(var t=0,n=T;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else(r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=L(n);e&&n.remove(),n=i}}function Me(e){if(!e||e.nodeType!==8)throw Ee(),xe;return e.data}function Ne(e){return e===this.v}function Pe(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Fe(e){return!Pe(e,this.v)}function Ie(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function Le(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function Re(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function ze(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function Be(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function Ve(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function He(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function Ue(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function We(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function Ge(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Ke(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var qe=!1;function Je(){qe=!0}var O=null;function Ye(e){O=e}function k(e,t=!1,n){O={p:O,i:!1,c:null,e:null,s:e,x:null,r:G,l:qe&&!t?{s:null,u:null,$:[]}:null}}function A(e){var t=O,n=t.e;if(n!==null){t.e=null;for(var r of n)gn(r)}return e!==void 0&&(t.x=e),t.i=!0,O=t.p,Xe(e)}function Xe(e={}){return l(e,me,{value:!0}),e}function Ze(){return!qe||O!==null&&O.l===null}var Qe=[];function $e(){var e=Qe;Qe=[],_(e)}function et(e){if(Qe.length===0&&!wt){var t=Qe;queueMicrotask(()=>{t===Qe&&$e()})}Qe.push(e)}function tt(){for(;Qe.length>0;)$e()}var nt=~(b|x|y);function j(e,t){e.f=e.f&nt|t}function rt(e){e.f&512||e.deps===null?j(e,y):j(e,x)}function it(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),j(e,y)}function at(e){var t=W,n=G;Rn(null),zn(null);try{return e()}finally{Rn(t),zn(n)}}function ot(e,t,n,r){let i=Ze()?ut:mt;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=G,c=st(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function u(e){if(!(s.f&16384)){c();try{r([...o,...e])}catch(e){ln(e,s)}ct()}}var d=lt();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>ft(e))).then(u).catch(e=>ln(e,s)).finally(d)}l?l.then(()=>{s.f&16384?d():(c(),f(),ct())}):f()}function st(){var e=G,t=W,n=O,r=M;return function(i=!0){zn(e),Rn(t),Ye(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function ct(e=!0){zn(null),Rn(null),Ye(null),e&&M?.deactivate()}function lt(){var e=G,t=e.b,n=M,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function ut(e){var t=2|b;return G!==null&&(G.f|=se),{ctx:O,deps:null,effects:null,equals:Ne,f:t,fn:e,reactions:null,rv:0,v:C,wv:0,parent:G,ac:null}}var dt=Symbol(`obsolete`);function ft(e,t,n){let r=G;r===null&&Le();var i=void 0,a=Vt(C),o=!W,s=new Set;return bn(()=>{var t=G,n=v();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==ye&&n.reject(e)}).finally(ct)}catch(e){n.reject(e),ct()}var c=M;if(o){if(t.f&32768)var l=lt();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(dt);else for(let e of s.values())e.reject(dt);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==dt&&(c.activate(),t?(a.f|=fe,Gt(a,t)):(a.f&8388608&&(a.f^=fe),Gt(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),mn(()=>{for(let e of s)e.reject(dt)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function pt(e){let t=ut(e);return Vn(t),t}function mt(e){let t=ut(e);return t.equals=Fe,t}function ht(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)U(t[n])}}function gt(e){var t,n=G,r=e.parent;if(!Fn&&r!==null&&e.v!==C&&r.f&24576)return Te(),e.v;zn(r);try{ht(e),t=Zn(e)}finally{zn(n)}return t}function _t(e){var t=gt(e);!e.equals(t)&&(e.wv=Jn(),(!M?.is_fork||e.deps===null)&&(M===null?e.v=t:(M.capture(e,t,!0),xt?.capture(e,t,!0)),e.deps===null))?j(e,y):Fn||(St===null?rt(e):(pn()||M?.is_fork)&&St.set(e,t))}function vt(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac!==null&&at(()=>{t.ac.abort(ye),t.ac=null}),t.fn!==null&&(t.teardown=ee),er(t,0),Tn(t))}function yt(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&tr(t)}var bt=null,M=null,xt=null,St=null,Ct=null,wt=!1,Tt=!1,Et=null,Dt=null,Ot=0,kt=1,At=class e{id=kt++;#e=!1;linked=!0;#t=null;#n=null;async_deriveds=new Map;current=new Map;previous=new Map;#r=new Set;#i=new Set;#a=0;#o=new Map;#s=null;#c=[];#l=[];#u=new Set;#d=new Set;#f=new Map;#p=new Set;is_fork=!1;#m=!1;constructor(){bt===null?bt=this:(bt.#n=this,this.#t=bt),bt=this}#h(){if(this.is_fork)return!0;for(let n of this.#o.keys()){for(var e=n,t=!1;e.parent!==null;){if(this.#f.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(e){this.#f.has(e)||this.#f.set(e,{d:[],m:[]}),this.#p.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#f.get(e);if(n){this.#f.delete(e);for(var r of n.d)j(r,b),t(r);for(r of n.m)j(r,x),t(r)}this.#p.add(e)}#g(){var e=[];for(let i of this.#c)if(!(i.f&16384||!(i.f&6144))){for(var t=i,n=!1;t.parent!==null;){t=t.parent;var r=t.f;if(r&96){if(!(r&1024)){n=!0;break}t.f^=y}}n||e.push(t)}return this.#c=[],e}#_(){this.#e=!0;for(let e of this.#u)this.#d.delete(e),j(e,b),this.schedule(e);for(let e of this.#d)j(e,x),this.schedule(e);this.apply();for(var t=Et=[],n=[],r=Dt=[];this.#c.length>0;){Ot++>1e3&&(this.#S(),Mt());for(let e of this.#g())try{this.#v(e,t,n)}catch(t){throw Lt(e),this.#h()||this.discard(),t}}if(M=null,r.length>0){var i=e.ensure();for(let e of r)i.schedule(e)}if(Et=null,Dt=null,this.#h()){this.#x(n),this.#x(t);for(let[e,t]of this.#f)It(e,t);r.length>0&&M.#_();return}let a=this.#y();if(a)this.#x(n),this.#x(t),a.#b(this);else{this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),xt=this,Pt(n),Pt(t),xt=null,this.#s?.resolve();var o=M;if(this.#a===0&&(this.#c.length===0||o!==null)&&this.#S(),this.#c.length>0){if(o!==null){for(let e of this.#c)o.#c.push(e);this.#c=[]}else o=this}o!==null&&(zt.clear(),o.#_())}}#v(e,t,n){e.f^=y;for(var r=e.first;r!==null;){var i=r.f,a=!!(i&96);if(!(a&&i&1024||i&8192||this.#f.has(r))&&r.fn!==null){a?r.f^=y:i&4?t.push(r):Yn(r)&&(i&16&&this.#d.add(r),tr(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#y(){for(var e=this.#t;e!==null;){if(!e.is_fork){for(let[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=e.#t}return null}#b(e){for(let[t,n]of e.current)!this.previous.has(t)&&e.previous.has(t)&&this.previous.set(t,e.previous.get(t)),this.current.set(t,n);for(let[t,n]of e.async_deriveds){let e=this.async_deriveds.get(t);e&&n.promise.then(e.resolve).catch(e.reject)}e.async_deriveds.clear(),this.transfer_effects(e.#u,e.#d);let t=e=>{var n=e.reactions;if(n!==null&&!(e.f&2&&!(e.f&6144)))for(let e of n){var r=e.f;if(r&2)t(e);else{var i=e;r&4194320&&!this.async_deriveds.has(i)&&(this.#d.delete(i),j(i,b),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#S(),M=this,this.#_()}#x(e){for(var t=0;t<e.length;t+=1)it(e[t],this.#u,this.#d)}capture(e,t,n=!1){e.v!==C&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[t,n]),St?.set(e,t)),this.is_fork||(e.v=t)}activate(){M=this}deactivate(){M=null,St=null}flush(){try{Tt=!0,M=this,this.#_()}finally{Ot=0,Ct=null,Et=null,Dt=null,Tt=!1,M=null,St=null,zt.clear()}}discard(){for(let e of this.#i)e(this);this.#i.clear();for(let e of this.async_deriveds.values())e.reject(dt);this.#S(),this.#s?.resolve()}register_created_effect(e){this.#l.push(e)}increment(e,t){if(this.#a+=1,e){let e=this.#o.get(t)??0;this.#o.set(t,e+1)}}decrement(e,t){if(--this.#a,e){let e=this.#o.get(t)??0;e===1?this.#o.delete(t):this.#o.set(t,e-1)}this.#m||(this.#m=!0,et(()=>{this.#m=!1,this.linked&&this.flush()}))}transfer_effects(e,t){for(let t of e)this.#u.add(t);for(let e of t)this.#d.add(e);e.clear(),t.clear()}oncommit(e){this.#r.add(e)}ondiscard(e){this.#i.add(e)}settled(){return(this.#s??=v()).promise}static ensure(){if(M===null){let t=M=new e;!Tt&&!wt&&et(()=>{t.#e||t.flush()})}return M}apply(){St=null}schedule(e){Ct=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)?e.b.defer_effect(e):this.#c.push(e)}#S(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?bt=e:t.#t=e,this.linked=!1}}};function jt(e){var t=wt,n=xt;xt=null,wt=!0;try{var r;for(e&&(jt(),r=e());;){if(tt(),M===null)return r;M.flush()}}finally{wt=t,xt=n}}function Mt(){try{He()}catch(e){ln(e,Ct)}}var Nt=null;function Pt(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&Yn(r)&&(Nt=new Set,tr(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&On(r),Nt?.size>0)){zt.clear();for(let e of Nt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Nt.has(n)&&(Nt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||tr(n)}}Nt.clear()}}Nt=null}}function Ft(e){M.schedule(e)}function It(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),j(e,y);for(var n=e.first;n!==null;)It(n,t),n=n.next}}function Lt(e){j(e,y);for(var t=e.first;t!==null;)Lt(t),t=t.next}var Rt=new Set,zt=new Map,Bt=!1;function Vt(e,t){return{f:0,v:e,reactions:null,equals:Ne,rv:0,wv:0}}function N(e,t){let n=Vt(e,t);return Vn(n),n}function Ht(e,t=!1,n=!0){let r=Vt(e);return t||(r.equals=Fe),qe&&n&&O!==null&&O.l!==null&&(O.l.s??=[]).push(r),r}function P(e,t,n=!1){return W!==null&&(!Ln||W.f&131072)&&Ze()&&W.f&4325394&&(Bn===null||!Bn.has(e))&&Ge(),Gt(e,n?Yt(t):t,Dt)}var Ut=null,Wt=0;function Gt(e,t,n=null){if(!e.equals(t)){Fn?zt.set(e,t):zt.has(e)||zt.set(e,e.v);var r=At.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&gt(t),St===null&&rt(t)}e.wv=Jn(),Ut=null,Wt=0,Jt(e,b,n),Ut=null,Ze()&&G!==null&&G.f&1024&&!(G.f&96)&&(Hn===null?Un([e]):Hn.push(e)),!r.is_fork&&Rt.size>0&&!Bt&&Kt()}return t}function Kt(){Bt=!1;for(let e of Rt){e.f&1024&&j(e,x);let t;try{t=Yn(e)}catch{t=!0}t&&tr(e)}Rt.clear()}function qt(e){P(e,e.v+1)}function Jt(e,t,n){var r=e.reactions;if(r!==null){var i=Ze(),a=r.length;if(Wt+=a,Wt>1e5&&Ut===null&&(Ut=new Set),Ut!==null){if(Ut.has(e))return;Ut.add(e)}for(var o=0;o<a;o++){var s=r[o],c=s.f;if(i||s!==G){var l=(c&b)===0;if(l&&j(s,t),c&131072)Rt.add(s);else if(c&2){var u=s;St?.delete(u),Jt(u,x,n)}else if(l){var d=s;c&16&&Nt!==null&&Nt.add(d),n===null?Ft(d):n.push(d)}}}}}function Yt(e){if(typeof e!=`object`||!e||pe in e||me in e)return e;let t=m(e);if(t!==f&&t!==p)return e;var n=new Map,r=a(e),i=N(0),o=null,s=Kn,c=e=>{if(Kn===s)return e();var t=W,n=Kn;Rn(null),qn(s);var r=e();return Rn(t),qn(n),r};return r&&n.set(`length`,N(e.length,o)),new Proxy(e,{defineProperty(e,t,r){(!(`value`in r)||r.configurable===!1||r.enumerable===!1||r.writable===!1)&&Ue();var i=n.get(t);return i===void 0?c(()=>{var e=N(r.value,o);return n.set(t,e),e}):P(i,r.value,!0),!0},deleteProperty(e,t){var r=n.get(t);if(r===void 0){if(t in e){let e=c(()=>N(C,o));n.set(t,e),qt(i)}}else P(r,C),qt(i);return!0},get(t,r,i){if(r===pe)return e;var a=n.get(r),s=r in t;if(a===void 0&&(!s||u(t,r)?.writable)&&(a=c(()=>N(Yt(s?t[r]:C),o)),n.set(r,a)),a!==void 0){var l=J(a);return l===C?void 0:l}return Reflect.get(t,r,i)},getOwnPropertyDescriptor(e,t){this.has?.(e,t);var r=Reflect.getOwnPropertyDescriptor(e,t),i=n.get(t);if(i!==void 0){var a=J(i);if(a===C)return;if(r&&`value`in r)r.value=a;else return{enumerable:!0,configurable:!0,value:a,writable:!0}}return r},has(e,t){if(t===pe)return!0;var r=n.get(t),i=r!==void 0&&r.v!==C||Reflect.has(e,t);return(r!==void 0||G!==null&&(!i||u(e,t)?.writable))&&(r===void 0&&(r=c(()=>N(i?Yt(e[t]):C,o)),n.set(t,r)),J(r)===C)?!1:i},set(e,t,a,s){var l=n.get(t),d=t in e;if(r&&t===`length`)for(var f=a;f<l.v;f+=1){var p=n.get(f+``);p===void 0?f in e&&(p=c(()=>N(C,o)),n.set(f+``,p)):P(p,C)}if(l===void 0)(!d||u(e,t)?.writable)&&(l=c(()=>N(void 0,o)),P(l,Yt(a)),n.set(t,l));else{d=l.v!==C;var m=c(()=>Yt(a));P(l,m)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(s,a),!d){if(r&&typeof t==`string`){var ee=n.get(`length`),g=Number(t);Number.isInteger(g)&&g>=ee.v&&P(ee,g+1)}qt(i)}return!0},ownKeys(e){J(i);var t=Reflect.ownKeys(e).filter(e=>{var t=n.get(e);return t===void 0||t.v!==C});for(var[r,a]of n)a.v!==C&&!(r in e)&&t.push(r);return t},setPrototypeOf(){We()}})}var Xt,Zt,Qt,$t,en;function tn(){if(Xt===void 0){Xt=window,Zt=document,Qt=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;$t=u(t,`firstChild`).get,en=u(t,`nextSibling`).get,h(e)&&(e[S]=void 0,e[ge]=null,e[_e]=void 0,e.__e=void 0),h(n)&&(n[ve]=void 0)}}function F(e=``){return document.createTextNode(e)}function I(e){return $t.call(e)}function L(e){return en.call(e)}function R(e,t){if(!w)return I(e);var n=I(T);if(n===null)n=T.appendChild(F());else if(t&&n.nodeType!==3){var r=F();return n?.before(r),E(r),r}return t&&sn(n),E(n),n}function nn(e,t=!1){if(!w){var n=I(e);return n instanceof Comment&&n.data===``?L(n):n}if(t){if(T?.nodeType!==3){var r=F();return T?.before(r),E(r),r}sn(T)}return T}function z(e,t=!1){if(!w)return I(e);var n=R(e,t);return D(e),n}function B(e,t=1,n=!1){let r=w?T:e;for(var i;t--;)i=r,r=L(r);if(!w)return r;if(n){if(r?.nodeType!==3){var a=F();return r===null?i?.after(a):r.before(a),E(a),a}sn(r)}return E(r),r}function rn(e){e.textContent=``}function an(){return!1}function on(e,t,n){return t==null||t===`http://www.w3.org/1999/xhtml`?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function sn(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function cn(e){var t=G;if(t===null)return W.f|=fe,e;if(!(t.f&32768)&&!(t.f&4))throw e;ln(e,t)}function ln(e,t){if(e===xe)throw e;if(!(t!==null&&t.f&16384)){for(;t!==null;){if(t.f&128&&!(t.f&33570816)){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}}function un(e){G===null&&(W===null&&Ve(e),Be()),Fn&&ze(e)}function dn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function fn(e,t){var n=G;n!==null&&n.f&8192&&(e|=te);var r={ctx:O,deps:null,nodes:null,f:e|b|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};M?.register_created_effect(r);var i=r;if(e&4)Et===null?At.ensure().schedule(r):Et.push(r);else if(t!==null){try{tr(r)}catch(e){throw U(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=ae))}if(i!==null&&(i.parent=n,n!==null&&dn(i,n),W!==null&&W.f&2&&!(e&64))){var a=W;(a.effects??=[]).push(i)}return r}function pn(){return W!==null&&!Ln}function mn(e){let t=fn(8,null);return j(t,y),t.teardown=e,t}function hn(e){un(`$effect`);var t=G.f;if(!W&&t&32&&O!==null&&!O.i){var n=O;(n.e??=[]).push(e)}else return gn(e)}function gn(e){return fn(4|ce,e)}function _n(e){return un(`$effect.pre`),fn(8|ce,e)}function vn(e){At.ensure();let t=fn(64|se,e);return(e={})=>new Promise(n=>{e.outro?kn(t,()=>{U(t),n(void 0)}):(U(t),n(void 0))})}function yn(e){return fn(4,e)}function bn(e){return fn(de|se,e)}function xn(e,t=0){return fn(8|t,e)}function V(e,t=[],n=[],r=[]){ot(r,t,n,t=>{fn(8,()=>{e(...t.map(J))})})}function Sn(e,t=[],n=[],r=[]){ot(r,t,n,t=>{fn(4,()=>e(...t.map(J)))})}function Cn(e,t=0){return fn(16|t,e)}function H(e){return fn(32|se,e)}function wn(e){var t=e.teardown;if(t!==null){let n=Fn,r=W;In(!0),Rn(null);try{t.call(null)}catch(t){ln(t,e.parent)}finally{In(n),Rn(r)}}}function Tn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&at(()=>{e.abort(ye)});var r=n.next;n.f&64?n.parent=null:U(n,t),n=r}}function En(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||U(t),t=n}}function U(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Dn(e.nodes.start,e.nodes.end),n=!0),e.f|=ie,Tn(e,t&&!n),er(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();wn(e),e.f^=ie,e.f|=ne;var i=e.parent;i!==null&&i.first!==null&&On(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Dn(e,t){for(;e!==null;){var n=e===t?null:L(e);e.remove(),e=n}}function On(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function kn(e,t,n=!0){var r=[];e.f|=256,An(e,r,!0);var i=()=>{n&&U(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function An(e,t,n){if(!(e.f&8192)){e.f^=te;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=!!(i.f&65536)||!!(i.f&32)&&!!(e.f&16);An(i,t,o?n:!1)}i=a}}}function jn(e){e.f&=-257,Mn(e,!0)}function Mn(e,t){if(!(e.f&256)&&e.f&8192){e.f^=te,e.f&1024||(j(e,b),At.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);Mn(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function Nn(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:L(n);t.append(n),n=i}}var Pn=null,Fn=!1;function In(e){Fn=e}var W=null,Ln=!1;function Rn(e){W=e}var G=null;function zn(e){G=e}var Bn=null;function Vn(e){W!==null&&(W.f&2097152||W.f&2)&&(Bn??=new Set).add(e)}var K=null,q=0,Hn=null;function Un(e){Hn=e}var Wn=1,Gn=0,Kn=Gn;function qn(e){Kn=e}function Jn(){return++Wn}function Yn(e){var t=e.f;if(t&2048)return!0;if(t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(Yn(a)&&_t(a),a.wv>e.wv)return!0}t&512&&St===null&&j(e,y)}return!1}function Xn(e,t,n=!0){var r=e.reactions;if(r!==null&&!(Bn!==null&&Bn.has(e)))for(var i=0;i<r.length;i++){var a=r[i];a.f&2?Xn(a,t,!1):t===a&&(n?j(a,b):a.f&1024&&j(a,x),Ft(a))}}function Zn(e){var t=K,n=q,r=Hn,i=W,a=Bn,o=O,s=Ln,c=Kn,l=e.f;K=null,q=0,Hn=null,W=l&96?null:e,Bn=null,Ye(e.ctx),Ln=!1,Kn=++Gn,e.ac!==null&&(at(()=>{e.ac.abort(ye)}),e.ac=null);try{e.f|=ue;var u=e.fn,d=u();e.f|=re;var f=Qn(e);if(Ze()&&Hn!==null&&!Ln&&f!==null&&!(e.f&6146))for(var p=0;p<Hn.length;p++)Xn(Hn[p],e);if(i!==null&&i!==e){if(Gn++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=Gn;if(t!==null)for(let e of t)e.rv=Gn;Hn!==null&&(r===null?r=Hn:r.push(...Hn))}return e.f&8388608&&(e.f^=fe),d}catch(t){return Qn(e),cn(t)}finally{e.f^=ue,K=t,q=n,Hn=r,W=i,Bn=a,Ye(o),Ln=s,Kn=c}}function Qn(e){var t=e.deps,n=M?.is_fork;if(K!==null){var r;if(n||er(e,q),t!==null&&q>0)for(t.length=q+K.length,r=0;r<K.length;r++)t[q+r]=K[r];else e.deps=t=K;if(pn()&&e.f&512)for(r=q;r<t.length;r++)(t[r].reactions??=[]).push(e)}else!n&&t!==null&&q<t.length&&(er(e,q),t.length=q);return t}function $n(e,t){let n=t.reactions;if(n!==null){var r=o.call(n,e);if(r!==-1){var i=n.length-1;i===0?n=t.reactions=null:(n[r]=n[i],n.pop())}}if(n===null&&t.f&2&&(K===null||!s.call(K,t))){var a=t;a.f&512&&(a.f^=512),a.v!==C&&rt(a),a.ac!==null&&at(()=>{a.ac.abort(ye),a.ac=null,j(a,b)}),vt(a),er(a,0)}}function er(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)$n(e,n[r])}function tr(e){var t=e.f;if(!(t&16384)){j(e,y);var n=G;G=e;try{t&16777232?En(e):Tn(e),wn(e);var r=Zn(e);e.teardown=typeof r==`function`?r:null,e.wv=Wn}finally{G=n}}}async function nr(){await Promise.resolve(),jt()}function J(e){var t=!!(e.f&2);if(Pn?.add(e),W!==null&&!Ln&&!(G!==null&&G.f&16384)&&(Bn===null||!Bn.has(e))){var n=W.deps;if(W.f&2097152)e.rv<Gn&&(e.rv=Gn,K===null&&n!==null&&n[q]===e?q++:K===null?K=[e]:K.push(e));else{W.deps??=[],s.call(W.deps,e)||W.deps.push(e);var r=e.reactions;r===null?e.reactions=[W]:s.call(r,W)||r.push(W)}}if(Fn&&zt.has(e))return zt.get(e);if(t){var i=e;if(Fn){var a=i.v;return(!(i.f&1024)&&i.reactions!==null||ir(i))&&(a=gt(i)),zt.set(i,a),a}var o=!(i.f&512)&&!Ln&&W!==null&&!!(W.f&512),c=(i.f&re)===0;Yn(i)&&(o&&(i.f|=512),_t(i)),o&&!c&&(yt(i),rr(i))}if(St?.has(e))return St.get(e);if(e.f&8388608)throw e.v;return e.v}function rr(e){if(e.f|=512,e.deps!==null)for(let n of e.deps){var t=n.reactions;t===null?n.reactions=[e]:s.call(t,e)||t.push(e),n.f&2&&!(n.f&512)&&(yt(n),rr(n))}}function ir(e){if(e.v===C)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(zt.has(t)||t.f&2&&ir(t))return!0;return!1}function ar(e){var t=Ln;try{return Ln=!0,e()}finally{Ln=t}}function or(e){if(!(typeof e!=`object`||!e||e instanceof EventTarget)){if(pe in e)sr(e);else if(!Array.isArray(e))for(let t in e){let n=e[t];typeof n==`object`&&n&&pe in n&&sr(n)}}}function sr(e,t=new Set){if(typeof e==`object`&&e&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let n in e)try{sr(e[n],t)}catch{}let n=m(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){let t=d(n);for(let n in t){let r=t[n].get;if(r)try{r.call(e)}catch{}}}}}[...`allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback`.split(`.`)];var cr=[`touchstart`,`touchmove`];function lr(e){return cr.includes(e)}var ur=Symbol(`events`),dr=new Set,fr=new Set;function pr(e,t,n,r={}){function i(e){if(r.capture||vr.call(t,e),!e.cancelBubble)return at(()=>n?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?(i.__removed=!1,et(()=>{i.__removed||t.addEventListener(e,i,r)})):t.addEventListener(e,i,r),i}function mr(e,t,n,r,i){var a={capture:r,passive:i},o=pr(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&mn(()=>{o.__removed=!0,t.removeEventListener(e,o,a)})}function Y(e,t,n){(t[ur]??={})[e]=n}function hr(e){for(var t=0;t<e.length;t++)dr.add(e[t]);for(var n of fr)n(e)}var gr=null,_r=!1;function vr(e){var t=this,n=t.ownerDocument,r=e.type,i=e.composedPath?.()||[],a=i[0]||e.target;gr=e,_r||(_r=!0,setTimeout(()=>{_r=!1,gr=null}));var o=0,s=gr===e&&e[ur];if(s){var c=i.indexOf(s);if(c!==-1&&(t===document||t===window)){e[ur]=t;return}var u=i.indexOf(t);if(u===-1)return;c<=u&&(o=c)}if(a=i[o]||e.target,a!==t){l(e,`currentTarget`,{configurable:!0,get(){return a||n}});var d=W,f=G;Rn(null),zn(null);try{for(var p,m=[];a!==null&&a!==t;){try{var h=a[ur]?.[r];h!=null&&(!a.disabled||e.target===a)&&h.call(a,e)}catch(e){p?m.push(e):p=e}if(e.cancelBubble)break;o++,a=o<i.length?i[o]:null}if(p){for(let e of m)queueMicrotask(()=>{throw e});throw p}}finally{e[ur]=t,delete e.currentTarget,Rn(d),zn(f)}}}var yr=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function br(e){return yr?.createHTML(e)??e}function xr(e){var t=on(`template`);return t.innerHTML=br(e.replaceAll(`<!>`,`<!---->`)),t.content}function Sr(e,t){var n=G;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function X(e,t){var n=!!(t&1),r=!!(t&2),i,a=!e.startsWith(`<!>`);return()=>{if(w)return Sr(T,null),T;i===void 0&&(i=xr(a?e:`<!>`+e),n||(i=I(i)));var t=r||Qt?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=I(t),s=t.lastChild;Sr(o,s)}else Sr(t,t);return t}}function Cr(){if(w)return Sr(T,null),T;var e=document.createDocumentFragment(),t=document.createComment(``),n=F();return e.append(t,n),Sr(t,n),e}function Z(e,t){if(w){var n=G;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=T),ke()}else e!==null&&e.before(t)}function wr(e){let t=0,n=Vt(0),r;return()=>{pn()&&(J(n),xn(()=>(t===0&&(r=ar(()=>e(()=>qt(n)))),t+=1,()=>{et(()=>{--t,t===0&&(r?.(),r=void 0,qt(n))})})))}}var Tr=ae|se;function Er(e,t,n,r){new Dr(e,t,n,r)}var Dr=class{parent;is_pending=!1;transform_error;#e;#t=w?T:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=wr(()=>(this.#m=Vt(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=G;t.b=this,t.f|=128,n(e)},this.parent=G.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=Cn(()=>{if(w){let e=Me(this.#t);ke();let t=e===`[!`;if(e.startsWith(`[?`)){let t=JSON.parse(e.slice(2));this.#_(t)}else t?this.#b():this.#g()}else this.#x()},Tr),w&&(this.#e=T)}#g(){try{this.#a=H(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#v(e);et(r),t&&(this.#s=H(()=>{t(this.#e,()=>e,()=>n)}))}#v(e){var t=!1,n=!1;let r=()=>{this.#y()||(t?De():(t=!0,n&&Ke(),this.#s!==null&&kn(this.#s,()=>{this.#s=null}),this.#C(()=>{this.#x()})))};return{reset:r,invoke_onerror:()=>{if(!this.#y())try{n=!0,this.#n.onerror?.(e,r),n=!1}catch(e){ln(e,this.#i&&this.#i.parent)}}}}#y(){return(this.#i.f&(ne|ie))!==0}#b(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=H(()=>e(this.#e)),et(()=>{if(!this.#y()){var e=this.#c=document.createDocumentFragment(),t=F(),n=!1;e.append(t),this.#a=this.#C(()=>{try{return H(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){ln(e,this.#i.parent)}return null}}),this.#a===null?(this.#c=null,n&&this.#S(M)):this.#u===0&&(this.#e.before(e),this.#c=null,kn(this.#o,()=>{this.#o=null}),this.#S(M))}}))}#x(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=H(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();Nn(this.#a,e);let t=this.#n.pending;this.#o=H(()=>t(this.#e))}else this.#S(M)}catch(e){this.error(e)}}#S(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){it(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#C(e){var t=G,n=W,r=O;zn(this.#i),Rn(this.#i),Ye(this.#i.ctx);try{return At.ensure(),e()}finally{zn(t),Rn(n),Ye(r)}}#w(e,t){this.has_pending_snippet()?(this.#u+=e,this.#u===0&&(this.#S(t),this.#o&&kn(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))):this.parent&&this.parent.#w(e,t)}update_pending_count(e,t){this.#w(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,et(()=>{this.#d=!1,this.#m&&Gt(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),J(this.#m)}error(e){if(e===xe||!this.#n.onerror&&!this.#n.failed)throw e;M?.is_fork?(this.#a&&M.skip_effect(this.#a),this.#o&&M.skip_effect(this.#o),this.#s&&M.skip_effect(this.#s),M.oncommit(()=>{this.#y()||this.#T(e)})):this.#T(e)}#T(e){this.#a&&=(U(this.#a),null),this.#o&&=(U(this.#o),null),this.#s&&=(U(this.#s),null),w&&(E(this.#t),Ae(),E(je()));let t=this.#n.failed,n=e=>{if(this.#y())return;let{reset:n,invoke_onerror:r}=this.#v(e);r(),t&&!this.#y()&&(this.#s=this.#C(()=>{try{return H(()=>{var r=G;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return ln(e,this.#i.parent),null}}))};et(()=>{if(!this.#y()){var t;try{t=this.transform_error(e)}catch(e){ln(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>ln(e,this.#i&&this.#i.parent)):n(t)}})}};function Q(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[ve]??=e.nodeValue)&&(e[ve]=n,e.nodeValue=`${n}`)}function Or(e,t){return Ar(e,t)}var kr=new Map;function Ar(e,{target:t,anchor:n,props:r={},events:i,context:a,intro:o=!0,transformError:s}){tn();var l=void 0,u=vn(()=>{var o=n??t.appendChild(F());Er(o,{pending:()=>{}},t=>{k({});var n=O;if(a&&(n.c=a),i&&(r.$$events=i),w&&Sr(t,null),l=e(t,r)||Xe(),w&&(G.nodes.end=T,T===null||T.nodeType!==8||T.data!==`]`))throw Ee(),xe;A()},s);var u=new Set,d=e=>{for(var n=0;n<e.length;n++){var r=e[n];if(!u.has(r)){u.add(r);var i=lr(r);for(let e of[t,document]){var a=kr.get(e);a===void 0&&(a=new Map,kr.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,vr,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return d(c(dr)),fr.add(d),()=>{for(var e of u)for(let n of[t,document]){var r=kr.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,vr),r.delete(e),r.size===0&&kr.delete(n)):r.set(e,i)}fr.delete(d),o!==n&&o.parentNode?.removeChild(o)}});return jr.set(l,u),l}var jr=new WeakMap;function Mr(e,t){let n=jr.get(e);return n?(jr.delete(e),n(t)):Promise.resolve()}var Nr=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)jn(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(jn(r.effect),this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(U(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();Nn(r,t),t.append(F()),this.#n.set(e,{effect:r,fragment:t})}else U(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),kn(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(U(n.effect),this.#n.delete(e))};ensure(e,t){var n=M,r=an();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=F();i.append(a),this.#n.set(e,{effect:H(()=>t(a)),fragment:i})}else this.#t.set(e,H(()=>t(this.anchor)))}if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else w&&(this.anchor=T),this.#a(n)}};function $(e,t,n=!1){var r;w&&(r=T,ke());var i=new Nr(e),a=n?ae:0;function o(e,t){if(w){var n=Me(r);if(e!==parseInt(n.substring(1))){var a=je();E(a),i.anchor=a,Oe(!1),i.ensure(e,t),Oe(!0);return}}i.ensure(e,t)}Cn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}function Pr(e,t,n){for(var r=[],i=t.length,a,o=t.length,s=0;s<i;s++){let n=t[s];kn(n,()=>{if(a){if(a.pending.delete(n),a.done.add(n),a.pending.size===0){var t=e.outrogroups;Fr(e,c(a.done)),t.delete(a),t.size===0&&(e.outrogroups=null)}}else--o},!1)}if(o===0){var l=r.length===0&&n!==null&&e.pending.size===0;if(l){var u=n,d=u.parentNode;rn(d),d.append(u),e.items.clear()}Fr(e,t,!l)}else a={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(a)}function Fr(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i<t.length;i++){var a=t[i];r?.has(a)?(a.f|=le,Nn(a,document.createDocumentFragment())):U(t[i],n)}}var Ir;function Lr(e,t,n,r,i,o=null){var s=e,l=new Map;if(t&4){var u=e;s=w?E(I(u)):u.appendChild(F())}w&&ke();var d=null,f=mt(()=>{var e=n();return a(e)?e:e==null?[]:c(e)}),p=new Map,m=!0;function h(e){if(!(g.effect.f&16384)){g.pending.delete(e);var n=J(f);g.fallback=d,zr(g,n,s,t,r),d!==null&&(n.length===0?d.f&33554432?(d.f^=le,Vr(d,null,s)):jn(d):kn(d,()=>{d=null}))}}function ee(e){g.pending.delete(e)}var g={effect:Cn(()=>{var e=J(f),a=e.length;let c=!1;w&&Me(s)===`[!`!=(a===0)&&(s=je(),E(s),Oe(!1),c=!0);for(var u=new Set,g=M,_=an(),v=0;v<a;v+=1){w&&T.nodeType===8&&T.data===`]`&&(s=T,c=!0,Oe(!1));var y=e[v],b=r(y,v),x=m?null:l.get(b);x?(x.v&&Gt(x.v,y),x.i&&Gt(x.i,v),_&&g.unskip_effect(x.e)):(x=Br(l,m?s:Ir??=F(),y,b,v,i,t,n),m||(x.e.f|=le),l.set(b,x)),u.add(b)}if(a===0&&o&&!d&&(m?d=H(()=>o(s)):(d=H(()=>o(Ir??=F())),d.f|=le)),a>u.size&&Re(``,``,``),w&&a>0&&E(je()),!m){if(p.set(g,u),_){for(let[e,t]of l)u.has(e)||g.skip_effect(t.e);g.oncommit(h),g.ondiscard(ee)}else h(g)}c&&Oe(!0),J(f)}),flags:t,items:l,pending:p,outrogroups:null,fallback:d};m=!1,w&&(s=T)}function Rr(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function zr(e,t,n,r,i){var a=!!(r&8),o=t.length,s=e.items,l=Rr(e.effect.first),u,d=null,f,p=[],m=[],h,ee,g,_;if(a)for(_=0;_<o;_+=1)h=t[_],ee=i(h,_),g=s.get(ee).e,g.f&33554432||(g.nodes?.a?.measure(),(f??=new Set).add(g));for(_=0;_<o;_+=1){if(h=t[_],ee=i(h,_),g=s.get(ee).e,e.outrogroups!==null)for(let t of e.outrogroups)t.pending.delete(g),t.done.delete(g);if(g.f&8192&&(jn(g),a&&(g.nodes?.a?.unfix(),(f??=new Set).delete(g))),g.f&33554432){if(g.f^=le,g===l)Vr(g,null,n);else{var v=d?d.next:l;g===e.effect.last&&(e.effect.last=g.prev),g.prev&&(g.prev.next=g.next),g.next&&(g.next.prev=g.prev),Hr(e,d,g),Hr(e,g,v),Vr(g,v,n),d=g,p=[],m=[],l=Rr(d.next);continue}}if(g!==l){if(u!==void 0&&u.has(g)){if(p.length<m.length){var y=m[0],b;d=y.prev;var x=p[0],te=p[p.length-1];for(b=0;b<p.length;b+=1)Vr(p[b],y,n);for(b=0;b<m.length;b+=1)u.delete(m[b]);Hr(e,x.prev,te.next),Hr(e,d,x),Hr(e,te,y),l=y,d=te,--_,p=[],m=[]}else u.delete(g),Vr(g,l,n),Hr(e,g.prev,g.next),Hr(e,g,d===null?e.effect.first:d.next),Hr(e,d,g),d=g;continue}for(p=[],m=[];l!==null&&l!==g;)(u??=new Set).add(l),m.push(l),l=Rr(l.next);if(l===null)continue}g.f&33554432||p.push(g),d=g,l=Rr(g.next)}if(e.outrogroups!==null){for(let t of e.outrogroups)t.pending.size===0&&(Fr(e,c(t.done)),e.outrogroups?.delete(t));e.outrogroups.size===0&&(e.outrogroups=null)}if(l!==null||u!==void 0){var ne=[];if(u!==void 0)for(g of u)g.f&8192||ne.push(g);for(;l!==null;)!(l.f&8192)&&l!==e.fallback&&ne.push(l),l=Rr(l.next);var re=ne.length;if(re>0){var ie=r&4&&o===0?n:null;if(a){for(_=0;_<re;_+=1)ne[_].nodes?.a?.measure();for(_=0;_<re;_+=1)ne[_].nodes?.a?.fix()}Pr(e,ne,ie)}}a&&et(()=>{if(f!==void 0)for(g of f)g.nodes?.a?.apply()})}function Br(e,t,n,r,i,a,o,s){var c=o&1?o&16?Vt(n):Ht(n,!1,!1):null,l=o&2?Vt(i):null;return{v:c,i:l,e:H(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function Vr(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=L(r);if(a.before(r),r===i)return;r=o}}function Hr(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Ur(e,t,n=!1,r=!1,i=!1,a=!1){var o=e,s=``;if(n){var c=e;w&&(o=E(I(c)))}V(()=>{var e=G;if(s===(s=t()??``))w&&ke();else if(n&&!w)e.nodes=null,c.innerHTML=s,s!==``&&Sr(I(c),c.lastChild);else if(e.nodes!==null&&(Dn(e.nodes.start,e.nodes.end),e.nodes=null),s!==``){if(w){for(var a=T.data,l=ke(),u=l;l!==null&&(l.nodeType!==8||l.data!==``);)u=l,l=L(l);if(l===null)throw Ee(),xe;Sr(T,u),o=E(l)}else{var d=on(r?`svg`:i?`math`:`template`,r?Ce:i?we:void 0);d.innerHTML=s;var f=r||i?d:d.content;if(Sr(I(f),f.lastChild),r||i)for(;I(f);)o.before(I(f));else o.before(f)}}})}function Wr(e,t){let n=null,r=w;var i;if(w){n=T;for(var a=I(document.head);a!==null&&(a.nodeType!==8||a.data!==e);)a=L(a);if(a===null)Oe(!1);else{var o=L(a);a.remove(),E(o)}}w||(i=document.head.appendChild(F()));try{Cn(()=>{var e=H(()=>t(i));e.f|=oe,w||(e.nodes===null?e.nodes={start:i,end:i,a:null,t:null}:e.nodes.end=i)})}finally{r&&(Oe(!0),E(n))}}function Gr(e,t,n){yn(()=>{var r=ar(()=>t(e,n?.())||{});if(n&&r?.update){var i=!1,a={};xn(()=>{var e=n();or(e),i&&Pe(a,e)&&(a=e,r.update(e))}),i=!0}if(r?.destroy)return()=>r.destroy()})}var Kr=[...`
2
- \r\f\xA0\v`];function qr(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||Kr.includes(r[o-1]))&&(s===r.length||Kr.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function Jr(e,t=!1){var n=t?` !important;`:`;`,r=``;for(var i of Object.keys(e)){var a=e[i];a!=null&&a!==``&&(r+=` `+i+`: `+a+n)}return r}function Yr(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function Xr(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\/\*.*?\*\//g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(Yr)),i&&c.push(...Object.keys(i).map(Yr));var l=0,u=-1;let t=e.length;for(var d=0;d<t;d++){var f=e[d];if(s?f===`/`&&e[d-1]===`*`&&(s=!1):a?a===f&&(a=!1):f===`/`&&e[d+1]===`*`?s=!0:f===`"`||f===`'`?a=f:f===`(`?o++:f===`)`&&o--,!s&&a===!1&&o===0){if(f===`:`&&u===-1)u=d;else if(f===`;`||d===t-1){if(u!==-1){var p=Yr(e.substring(l,u).trim());if(!c.includes(p)){f!==`;`&&d++;var m=e.substring(l,d).trim();n+=` `+m+`;`}}l=d+1,u=-1}}}}return r&&(n+=Jr(r)),i&&(n+=Jr(i,!0)),n=n.trim(),n===``?null:n}return e==null?null:String(e)}function Zr(e,t,n,r,i,a){var o=e[S];if(w||o!==n||o===void 0){var s=qr(n,r,a);(!w||s!==e.getAttribute(`class`))&&(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e[S]=n}else if(a&&i!==a)for(var c in a){var l=!!a[c];(i==null||l!==!!i[c])&&e.classList.toggle(c,l)}return a}function Qr(e,t={},n,r){for(var i in n){var a=n[i];t[i]!==a&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,a,r))}}function $r(e,t,n,r){var i=e[_e];if(w||i!==t){var a=Xr(t,r);(!w||a!==e.getAttribute(`style`))&&(a==null?e.removeAttribute(`style`):e.style.cssText=a),e[_e]=t}else r&&(Array.isArray(r)?(Qr(e,n?.[0],r[0]),Qr(e,n?.[1],r[1],`important`)):Qr(e,n,r));return r}var ei=Symbol(`is custom element`),ti=Symbol(`is html`),ni=be?`link`:`LINK`;function ri(e,t,n,r){var i=ii(e);w&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===ni)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[he]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&oi(e).has(t)?e[t]=n:e.setAttribute(t,n))}function ii(e){return e[ge]??={[ei]:e.nodeName.includes(`-`),[ti]:e.namespaceURI===Se}}var ai=new Map;function oi(e){var t=e.getAttribute(`is`)||e.nodeName,n=ai.get(t);if(n)return n;ai.set(t,n=new Set);for(var r,i=e,a=Element.prototype;a!==i;){for(var o in r=d(i),r)r[o].set&&o!==`innerHTML`&&o!==`textContent`&&o!==`innerText`&&n.add(o);i=m(i)}return n}function si(e,t){return e===t||e?.[pe]===t}function ci(e=Xe(),t,n,r){var i=O.r,a=G;return yn(()=>{var o,s;return xn(()=>{o=s,s=r?.()||[],ar(()=>{si(n(...s),e)||(t(e,...s),o&&si(n(...o),e)&&t(null,...o))})}),()=>{let r=a;for(;r!==i&&r.parent!==null&&r.parent.f&33554432;)r=r.parent;let o=()=>{s&&si(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}function li(e=!1){let t=O,n=t.l.u;if(!n)return;let r=()=>or(t.s);if(e){let e=0,n={},i=ut(()=>{let r=!1,i=t.s;for(let e in i)i[e]!==n[e]&&(n[e]=i[e],r=!0);return r&&e++,e});r=()=>J(i)}n.b.length&&_n(()=>{ui(t,r),_(n.b)}),hn(()=>{let e=ar(()=>n.m.map(g));return()=>{for(let t of e)typeof t==`function`&&t()}}),n.a.length&&hn(()=>{ui(t,r),_(n.a)})}function ui(e,t){if(e.l.s)for(let t of e.l.s)J(t);t()}function di(e){O===null&&Ie(`onMount`),qe&&O.l!==null?pi(O).m.push(e):hn(()=>{let t=ar(e);if(typeof t==`function`)return t})}function fi(e){O===null&&Ie(`onDestroy`),di(()=>()=>ar(e))}function pi(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);var mi=class extends Error{status;constructor(e,t){super(t),this.name=`ApiError`,this.status=e}};async function hi(e,t){let r=await fetch(`${n}${e}`,{signal:t,headers:{Accept:`application/json`}});if(!r.ok){let e=r.statusText||`Request failed with ${r.status}`;try{let t=await r.json();t.error?.message&&(e=t.error.message)}catch{}throw new mi(r.status,e)}return await r.json()}var gi={rootLabel:`srvmd`,version:`0.0.0`,theme:`auto`,live:!1,mermaid:!0};function _i(){if(typeof document>`u`)return gi;let e=document.getElementById(r);if(!e?.textContent)return gi;try{return{...gi,...JSON.parse(e.textContent)}}catch{return gi}}var vi=_i();Je();var yi=X(`<footer class="footer"> </footer>`);function bi(e,t){k(t,!1),li();var n=yi(),r=z(n);V(()=>Q(r,`Rendered by srvmd · ${vi.rootLabel??``}`)),Z(e,n),A()}function xi(){return typeof document<`u`&&document.documentElement.dataset.theme===`dark`||typeof matchMedia==`function`&&matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}var Si=Yt({value:xi()});function Ci(t){Si.value=t,typeof document<`u`&&(document.documentElement.dataset.theme=t);try{localStorage.setItem(e,t)}catch{}}function wi(){Ci(Si.value===`dark`?`light`:`dark`)}var Ti=X(`<button class="btn theme-toggle" type="button" title="Toggle dark mode" aria-label="Toggle dark mode"><svg class="icon-sun" viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><circle cx="12" cy="12" r="4.5" fill="none" stroke="currentColor" stroke-width="1.8"></circle><path d="M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M18.7 5.3l-1.4 1.4M6.7 17.3l-1.4 1.4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"></path></svg> <svg class="icon-moon" viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><path d="M20 14.5A8.5 8.5 0 0 1 9.5 4a8.5 8.5 0 1 0 10.5 10.5Z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"></path></svg></button>`);function Ei(e){var t=Ti();Y(`click`,t,function(...e){wi?.apply(this,e)}),Z(e,t)}hr([`click`]);var Di=X(`<span class="sep">/</span>`),Oi=X(`<span aria-current="page"> </span>`),ki=X(`<a> </a>`),Ai=X(`<!> <!>`,1),ji=X(`<nav class="crumbs" aria-label="Breadcrumb"></nav>`);function Mi(e,t){k(t,!0);var n=Cr(),r=nn(n),i=e=>{var n=ji();Lr(n,23,()=>t.crumbs,e=>`${e.href}:${e.label}`,(e,n,r)=>{var i=Ai(),a=nn(i),o=e=>{Z(e,Di())};$(a,e=>{J(r)>0&&e(o)});var s=B(a,2),c=e=>{var t=Oi(),r=z(t,!0);V(()=>Q(r,J(n).label)),Z(e,t)},l=e=>{var t=ki(),r=z(t,!0);V(()=>{ri(t,`href`,J(n).href),Q(r,J(n).label)}),Z(e,t)};$(s,e=>{J(r)===t.crumbs.length-1?e(c):e(l,-1)}),Z(e,i)}),D(n),Z(e,n)};$(r,e=>{t.crumbs.length>0&&e(i)}),Z(e,n),A()}var Ni=X(`<a class="btn" title="View Markdown source">Raw</a>`),Pi=X(`<header class="topbar"><!> <div class="actions"><!> <!></div></header>`);function Fi(e,t){var n=Pi(),r=R(n);Mi(r,{get crumbs(){return t.crumbs}});var i=B(r,2),a=R(i),o=e=>{var n=Ni();V(()=>ri(n,`href`,t.rawHref)),Z(e,n)};$(a,e=>{t.rawHref&&e(o)}),Ei(B(a,2),{}),D(i),D(n),Z(e,n)}var Ii=X(`<!> <div class="layout"><main class="content"><p class="loading">Loading…</p></main></div> <!>`,1);function Li(e,t){k(t,!0);let n=pt(()=>[{label:vi.rootLabel,href:`/`}]);var r=Ii(),i=nn(r);Fi(i,{get crumbs(){return J(n)}}),bi(B(i,4),{}),Z(e,r),A()}function Ri(e){if(e==null||!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n<10?n.toFixed(1):Math.round(n)} ${t[r]}`}function zi(e){if(!e)return``;let t=new Date(e);if(Number.isNaN(t.getTime()))return``;let n=t.toISOString();return`${n.slice(0,10)} ${n.slice(11,16)}`}var Bi=X(`<li class="entry entry-dir"><span class="entry-icon">↩</span> <a>..</a></li>`),Vi=X(`<a class="raw-link" title="View source">raw</a>`),Hi=X(`<li><span class="entry-icon" aria-hidden="true"> </span> <a class="entry-name"> </a> <!> <span class="entry-meta"> </span></li>`),Ui=X(`<p class="empty">This directory is empty.</p>`),Wi=X(`<ul class="entries"><!> <!></ul> <!>`,1);function Gi(e,t){k(t,!0);function n(e){let t=encodeURIComponent(e.name);return e.kind===`dir`?`${t}/`:t}function r(e){return e.kind===`dir`?`📁`:e.kind===`markdown`?`📝`:`📄`}function i(e){let t=[];return e.size!=null&&e.kind!==`dir`&&t.push(Ri(e.size)),e.mtime&&t.push(zi(e.mtime)),t.join(` · `)}var a=Wi(),o=nn(a),s=R(o),c=e=>{var n=Bi(),r=B(R(n),2);D(n),V(()=>ri(r,`href`,t.parentHref)),Z(e,n)};$(s,e=>{t.parentHref&&e(c)}),Lr(B(s,2),17,()=>t.entries,e=>e.name,(e,t)=>{var a=Hi(),o=R(a),s=z(o,!0),c=B(o,2),l=z(c),u=B(c,2),d=e=>{var r=Vi();V(e=>ri(r,`href`,e),[()=>`${n(J(t))}?raw`]),Z(e,r)};$(u,e=>{J(t).kind===`markdown`&&e(d)});var f=z(B(u,2),!0);D(a),V((e,n,r)=>{Zr(a,1,`entry entry-${J(t).kind}`),Q(s,e),ri(c,`href`,n),Q(l,`${J(t).name??``}${J(t).kind===`dir`?`/`:``}`),Q(f,r)},[()=>r(J(t)),()=>n(J(t)),()=>i(J(t))]),Z(e,a)}),D(o);var l=B(o,2),u=e=>{Z(e,Ui())};$(l,e=>{t.entries.length===0&&!t.parentHref&&e(u)}),Z(e,a),A()}var Ki=X(`<!> <div class="layout"><main class="content"><div class="listing"><h1> </h1> <!></div></main></div> <!>`,1);function qi(e,t){k(t,!0);var n=Ki(),r=nn(n);Fi(r,{get crumbs(){return t.page.breadcrumbs}});var i=B(r,2),a=R(i),o=R(a),s=R(o),c=z(s,!0);Gi(B(s,2),{get entries(){return t.page.entries},get parentHref(){return t.page.parentHref}}),D(o),D(a),D(i),bi(B(i,2),{}),V(()=>Q(c,t.page.heading)),Z(e,n),A()}var Ji=null;function Yi(){return globalThis.mermaid}function Xi(){let e=Yi();return e?Promise.resolve(e):(Ji??=new Promise((e,n)=>{let r=document.createElement(`script`);r.src=t,r.async=!0,r.addEventListener(`load`,()=>{let t=Yi();t?e(t):n(Error(`Mermaid did not initialize.`))}),r.addEventListener(`error`,()=>n(Error(`Failed to load the Mermaid bundle.`))),document.head.appendChild(r)}).catch(e=>{throw Ji=null,e}),Ji)}var Zi=null,Qi=Promise.resolve(),$i=0;function ea(e,t){Zi!==t&&(e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:t===`dark`?`dark`:`default`,themeVariables:{background:`transparent`},fontFamily:typeof document>`u`?void 0:getComputedStyle(document.body).fontFamily}),Zi=t)}function ta(e){let t=Qi.then(e,e);return Qi=t.then(()=>void 0,()=>void 0),t}function na(e,t){return ta(async()=>{let n=await Xi();return ea(n,t),$i+=1,n.render(`serve-md-mermaid-${$i}`,e)})}var ra=Yt({open:!1,source:``});function ia(e){ra.source=e,ra.open=!0}function aa(){ra.open=!1}var oa=X(`<div class="mermaid-canvas"></div>`),sa=X(`<pre class="mermaid-source"><code> </code></pre>`),ca=X(`<span class="mermaid-hint">Click to open fullscreen</span>`),la=X(`<span class="mermaid-status"> </span>`),ua=X(`<span class="mermaid-pending">Rendering…</span>`),da=X(`<div class="mermaid-figure" role="button"><!> <div class="mermaid-caption"><!></div></div>`);function fa(e,t){k(t,!0);let n=N(`pending`),r=N(``),i=N(``),a=N(void 0),o=0;function s(e){let t=e instanceof Error?e.message:String(e);return t.length>320?`${t.slice(0,317)}...`:t}hn(()=>{let e=++o,c=t.source,l=Si.value;return P(n,`pending`),P(r,``),P(i,``),na(c,l).then(t=>{e===o&&(P(r,t.svg,!0),P(n,`rendered`),nr().then(()=>{if(e!==o)return;let n=J(a)?.querySelector(`.mermaid-canvas`);n&&t.bindFunctions?.(n)}))}).catch(t=>{e===o&&(P(i,s(t),!0),P(n,`error`))}),()=>{e===o&&o++}});function c(){J(n)===`rendered`&&ia(t.source)}function l(e){J(n)===`rendered`&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())}var u=da(),d=R(u),f=e=>{var t=oa();Ur(t,()=>J(r),!0),D(t),Z(e,t)},p=e=>{var n=sa(),r=z(R(n),!0);D(n),V(()=>Q(r,t.source)),Z(e,n)};$(d,e=>{J(n)===`rendered`?e(f):e(p,-1)});var m=B(d,2),h=R(m),ee=e=>{Z(e,ca())},g=e=>{var t=la(),n=z(t);V(()=>Q(n,`Mermaid error: ${J(i)??``}`)),Z(e,t)},_=e=>{Z(e,ua())};$(h,e=>{J(n)===`rendered`?e(ee):J(n)===`error`?e(g,1):e(_,-1)}),D(m),D(u),ci(u,e=>P(a,e),()=>J(a)),V(()=>{ri(u,`data-mermaid-state`,J(n)),ri(u,`tabindex`,J(n)===`rendered`?0:void 0),ri(u,`aria-disabled`,J(n)!==`rendered`),ri(u,`aria-label`,J(n)===`rendered`?`Open Mermaid diagram in fullscreen`:`Mermaid diagram`)}),Y(`click`,u,c),Y(`keydown`,u,l),Z(e,u),A()}hr([`click`,`keydown`]);function pa(e,t){let n=t,r=[],i=!1,a=0;function o(){for(let e of r)Mr(e);r=[]}function s(){if(i)return;o();let t=new Map(n.map(e=>[e.id,e.source]));for(let n of e.querySelectorAll(`[data-mermaid-slot]`)){let e=n.dataset.mermaidSlot,i=e===void 0?void 0:t.get(e);i!==void 0&&r.push(Or(fa,{target:n,props:{source:i}}))}}function c(){let e=++a;nr().then(()=>{e===a&&!i&&s()})}return c(),{update(e){n=e,c()},destroy(){i=!0,a++,o()}}}var ma=X(`<div class="markdown-body"></div>`);function ha(e,t){var n=ma();Ur(n,()=>t.html,!0),D(n),Gr(n,(e,t)=>pa?.(e,t),()=>t.diagrams),Z(e,n)}var ga=X(`<li><a> </a></li>`),_a=X(`<aside class="toc" aria-label="Table of contents"><p class="toc-title">On this page</p> <ul></ul></aside>`);function va(e,t){k(t,!0);let n=pt(()=>t.items.filter(e=>e.level>=2&&e.level<=4)),r=pt(()=>J(n).length>0?Math.min(...J(n).map(e=>e.level)):0);var i=Cr(),a=nn(i),o=e=>{var t=_a(),i=B(R(t),2);Lr(i,21,()=>J(n),e=>e.id,(e,t)=>{var n=ga(),i=R(n),a=z(i,!0);D(n),V(e=>{Zr(n,1,e),ri(i,`href`,`#${J(t).id}`),Q(a,J(t).text)},[()=>`toc-level-${Math.min(J(t).level-J(r),2)}`]),Z(e,n)}),D(i),D(t),Z(e,t)};$(a,e=>{J(n).length>=2&&e(o)}),Z(e,i),A()}var ya=X(`<div class="warning"> </div>`),ba=X(`<!> <div><!> <main class="content"><!> <!></main></div> <!>`,1);function xa(e,t){k(t,!0);let n=pt(()=>t.page.toc.filter(e=>e.level>=2&&e.level<=4));var r=ba(),i=nn(r);Fi(i,{get crumbs(){return t.page.breadcrumbs},get rawHref(){return t.page.rawHref}});var a=B(i,2);let o;var s=R(a);va(s,{get items(){return t.page.toc}});var c=B(s,2),l=R(c),u=e=>{var n=ya(),r=z(n,!0);V(()=>Q(r,t.page.warning)),Z(e,n)};$(l,e=>{t.page.warning&&e(u)}),ha(B(l,2),{get html(){return t.page.html},get diagrams(){return t.page.mermaid}}),D(c),D(a),bi(B(a,2),{}),V(()=>o=Zr(a,1,`layout`,null,o,{"has-toc":J(n).length>=2})),Z(e,r),A()}var Sa=X(`<!> <div class="layout"><main class="content"><div class="error-page"><p class="error-code"> </p> <h1> </h1> <p class="error-message"> </p> <p><a href="/">Go to the root directory</a></p></div></main></div> <!>`,1);function Ca(e,t){k(t,!0);let n=pt(()=>[{label:vi.rootLabel,href:`/`}]);var r=Sa(),i=nn(r);Fi(i,{get crumbs(){return J(n)}});var a=B(i,2),o=R(a),s=R(o),c=R(s),l=z(c,!0),u=B(c,2),d=z(u,!0),f=z(B(u,2),!0);Ae(2),D(s),D(o),D(a),bi(B(a,2),{}),V(()=>{Q(l,t.status),Q(d,t.status===404?`Page not found`:`Something went wrong`),Q(f,t.message)}),Z(e,r),A()}function wa(e){return Math.max(.1,Math.min(8,e))}function Ta(e,t,n,r,i=36){let a=Math.max(e,1),o=Math.max(t,1),s=Math.max(n-i*2,80),c=Math.max(r-i*2,80),l=wa(Math.min(s/a,c/o,1.5));return{width:a,height:o,scale:l,x:(n-a*l)/2,y:(r-o*l)/2}}function Ea(e,t,n,r){let i=wa(r),a=i/e.scale;return{...e,scale:i,x:t-(t-e.x)*a,y:n-(n-e.y)*a}}function Da(e,t,n,r){return Ea(e,t/2,n/2,e.scale*r)}function Oa(e,t,n){return{...e,x:e.x+t,y:e.y+n}}function ka(e,t){let n=t,r=e=>n(e);return e.addEventListener(`wheel`,r,{passive:!1}),{update(e){n=e},destroy(){e.removeEventListener(`wheel`,r)}}}var Aa=X(`<p class="mermaid-modal-loading">Rendering…</p>`),ja=X(`<p class="mermaid-modal-error"> </p>`),Ma=X(`<dialog class="mermaid-modal" aria-label="Mermaid diagram viewer"><div class="mermaid-modal-bar"><span class="mermaid-modal-title">Mermaid diagram</span> <div class="mermaid-modal-actions"><button type="button" class="mermaid-modal-button" aria-label="Zoom out" title="Zoom out">−</button> <span class="mermaid-modal-zoom" aria-live="polite"> </span> <button type="button" class="mermaid-modal-button" aria-label="Zoom in" title="Zoom in">+</button> <button type="button" class="mermaid-modal-button" aria-label="Fit to window" title="Fit to window">Fit</button> <button type="button" class="mermaid-modal-button" aria-label="Close" title="Close">×</button></div></div> <div role="application" aria-label="Mermaid diagram viewport" tabindex="-1"><div class="mermaid-modal-stage"><!></div> <!> <!></div> <p class="mermaid-modal-hint">Drag to pan · Scroll or pinch to zoom · Esc to close</p></dialog>`);function Na(e,t){k(t,!0);let n=N(void 0),r=N(void 0),i=N(void 0),a=N(null),o=N(``),s=N(!1),c=N(``),l=N(!1),u=0,d=new Map,f=null,p=null,m=pt(()=>J(a)?`width:${J(a).width*J(a).scale}px;height:${J(a).height*J(a).scale}px;transform:translate(${J(a).x}px, ${J(a).y}px)`:void 0),h=pt(()=>`${Math.round((J(a)?.scale??1)*100)}%`);function ee(e){let t=e instanceof Error?e.message:String(e);return t.length>320?`${t.slice(0,317)}...`:t}function g(e){typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(e,0)}function _(e){let t=new DOMParser().parseFromString(e,`image/svg+xml`).documentElement,n=t.getAttribute(`viewBox`)??t.getAttribute(`viewbox`);if(n){let e=n.split(/[\s,]+/).map(Number),t=e[2],r=e[3];if(t&&r&&Number.isFinite(t)&&Number.isFinite(r))return{width:t,height:r}}let r=Number.parseFloat(t.getAttribute(`width`)??``),i=Number.parseFloat(t.getAttribute(`height`)??``);return{width:Number.isFinite(r)&&r>0?r:800,height:Number.isFinite(i)&&i>0?i:600}}function v(){J(a)&&J(r)&&P(a,Ta(J(a).width,J(a).height,J(r).clientWidth,J(r).clientHeight),!0)}function y(e){J(a)&&J(r)&&P(a,Da(J(a),J(r).clientWidth,J(r).clientHeight,e),!0)}function b(){J(n)?.open?typeof J(n).close==`function`?J(n).close():(J(n).open=!1,x()):aa()}function x(){u++,aa(),P(o,``),P(a,null),P(c,``),P(s,!1),P(l,!1),d.clear(),f=null,p=null,document.documentElement.classList.remove(`mermaid-modal-open`)}function te(e){if(!J(a)||!J(r))return;e.preventDefault();let t=J(r).getBoundingClientRect(),n=e.deltaY;e.deltaMode===1?n*=16:e.deltaMode===2&&(n*=J(r).clientHeight),P(a,Ea(J(a),e.clientX-t.left,e.clientY-t.top,J(a).scale*Math.exp(-n*.0015)),!0)}function ne(){let e=[...d.values()],t=e[0],n=e[1];return!t||!n?null:{x:(t.x+n.x)/2,y:(t.y+n.y)/2,distance:Math.hypot(t.x-n.x,t.y-n.y)||1}}function re(e){if(J(r)&&J(a)&&(e.pointerType!==`mouse`||e.button===0)){e.preventDefault(),d.set(e.pointerId,{x:e.clientX,y:e.clientY});try{J(r).setPointerCapture(e.pointerId)}catch{}P(l,!0),d.size>=2?(p=ne(),f=null):f={x:e.clientX,y:e.clientY}}}function ie(e){if(!J(r)||!J(a)||!d.has(e.pointerId))return;if(d.set(e.pointerId,{x:e.clientX,y:e.clientY}),d.size>=2){let e=ne();if(p&&e){let t=J(r).getBoundingClientRect();P(a,Ea(J(a),e.x-t.left,e.y-t.top,J(a).scale*(e.distance/p.distance)),!0),P(a,Oa(J(a),e.x-p.x,e.y-p.y),!0)}p=e,f=null;return}let t=d.get(e.pointerId);f&&t&&(P(a,Oa(J(a),t.x-f.x,t.y-f.y),!0),f=t)}function ae(e){if(J(r)&&d.has(e.pointerId)){if(d.delete(e.pointerId),J(r).hasPointerCapture(e.pointerId))try{J(r).releasePointerCapture(e.pointerId)}catch{}if(d.size===0)f=null,p=null,P(l,!1);else{p=null;let e=[...d.values()][0];f=e?{x:e.x,y:e.y}:null}}}function oe(e){J(a)&&J(r)&&(e.key===`+`||e.key===`=`?(e.preventDefault(),y(1.25)):e.key===`-`?(e.preventDefault(),y(.8)):e.key===`0`?(e.preventDefault(),v()):e.key===`ArrowLeft`?(e.preventDefault(),P(a,Oa(J(a),40,0),!0)):e.key===`ArrowRight`?(e.preventDefault(),P(a,Oa(J(a),-40,0),!0)):e.key===`ArrowUp`?(e.preventDefault(),P(a,Oa(J(a),0,40),!0)):e.key===`ArrowDown`&&(e.preventDefault(),P(a,Oa(J(a),0,-40),!0)))}function se(e){e.target===J(n)&&b()}hn(()=>{J(n)&&(ra.open?(J(n).open||(typeof J(n).showModal==`function`?J(n).showModal():J(n).open=!0),document.documentElement.classList.add(`mermaid-modal-open`)):J(n).open&&(typeof J(n).close==`function`?J(n).close():(J(n).open=!1,x())))}),hn(()=>{let e=ra.open,t=ra.source,n=Si.value;if(!e)return;let l=++u;return P(s,!0),P(c,``),P(o,``),P(a,null),na(t,n).then(e=>{if(l!==u)return;let t=_(e.svg);P(o,e.svg,!0),P(s,!1),P(a,Ta(t.width,t.height,800,600),!0),nr().then(()=>{l===u&&g(()=>{l===u&&(J(i)&&e.bindFunctions?.(J(i)),v(),J(r)?.focus())})})}).catch(e=>{l===u&&(P(s,!1),P(c,ee(e),!0))}),()=>{l===u&&u++}}),fi(()=>{u++,document.documentElement.classList.remove(`mermaid-modal-open`)});var ce=Ma(),le=R(ce),ue=B(R(le),2),de=R(ue),fe=B(de,2),pe=z(fe,!0),me=B(fe,2),he=B(me,2),ge=B(he,2);D(ue),D(le);var S=B(le,2);let _e;var ve=R(S),ye=R(ve),be=e=>{var t=Cr();Ur(nn(t),()=>J(o)),Z(e,t)};$(ye,e=>{J(o)&&e(be)}),D(ve),ci(ve,e=>P(i,e),()=>J(i));var xe=B(ve,2),C=e=>{Z(e,Aa())};$(xe,e=>{J(s)&&e(C)});var Se=B(xe,2),Ce=e=>{var t=ja(),n=z(t);V(()=>Q(n,`Mermaid error: ${J(c)??``}`)),Z(e,t)};$(Se,e=>{J(c)&&e(Ce)}),D(S),ci(S,e=>P(r,e),()=>J(r)),Gr(S,(e,t)=>ka?.(e,t),()=>te),Ae(2),D(ce),ci(ce,e=>P(n,e),()=>J(n)),V(()=>{Q(pe,J(h)),_e=Zr(S,1,`mermaid-modal-viewport`,null,_e,{"is-dragging":J(l)}),$r(ve,J(m))}),mr(`close`,ce,x),Y(`click`,ce,se),Y(`keydown`,ce,oe),Y(`click`,de,()=>y(.8)),Y(`click`,me,()=>y(1.25)),Y(`click`,he,v),Y(`click`,ge,b),Y(`pointerdown`,S,re),Y(`pointermove`,S,ie),Y(`pointerup`,S,ae),mr(`pointercancel`,S,ae),Y(`dblclick`,S,v),Z(e,ce),A()}hr([`click`,`keydown`,`pointerdown`,`pointermove`,`pointerup`,`dblclick`]);var Pa=X(`<!> <!>`,1);function Fa(e,t){k(t,!0);let n=N(Yt({status:`loading`})),r=null,a=0,o=window.location.pathname,s=pt(()=>J(n).status===`error`?String(J(n).code):J(n).status===`ready`?J(n).page.kind===`document`?J(n).page.title:J(n).page.kind===`directory`?J(n).page.heading:`srvmd`:`srvmd`);function c(e){e.kind===`document`?document.documentElement.lang=e.lang??`en`:e.kind===`directory`&&(document.documentElement.lang=`en`)}async function l(e=!1){r?.abort();let t=new AbortController;r=t;let i=++a;e||P(n,{status:`loading`},!0);try{let r=await hi(o,t.signal);if(i!==a)return;if(r.kind===`redirect`){window.location.replace(r.location);return}e&&aa(),P(n,{status:`ready`,page:r},!0),c(r)}catch(e){if(t.signal.aborted||i!==a)return;let r=e instanceof mi?e.status:500,o=e instanceof Error?e.message:String(e);P(n,{status:`error`,code:r,message:o},!0)}}di(()=>{l();let e=vi.live?i(()=>void l(!0)):void 0;return()=>{r?.abort(),e?.()}});var u=Pa();Wr(`16t12jp`,e=>{Sn(()=>{Zt.title=J(s)??``})});var d=nn(u),f=e=>{Li(e,{})},p=e=>{Ca(e,{get status(){return J(n).code},get message(){return J(n).message}})},m=e=>{xa(e,{get page(){return J(n).page}})},h=e=>{qi(e,{get page(){return J(n).page}})},ee=e=>{Li(e,{})};$(d,e=>{J(n).status===`loading`?e(f):J(n).status===`error`?e(p,1):J(n).page.kind===`document`?e(m,2):J(n).page.kind===`directory`?e(h,3):e(ee,-1)}),Na(B(d,2),{}),Z(e,u),A()}var Ia=document.getElementById(`app`);if(!Ia)throw Error(`Missing #app mount target`);Or(Fa,{target:Ia});
@@ -1 +0,0 @@
1
- var e=`/__api/page`,t=`/__serve_md_mermaid.js`,n=`serve-md-config`,r=`serve-md-theme`;function i(e){let t=!1,n=null,r=500,i;function a(){if(t)return;let o=location.protocol===`https:`?`wss:`:`ws:`;n=new WebSocket(`${o}//${location.host}/__serve_md_live`),n.onopen=()=>{r=500},n.onmessage=t=>{try{let n=JSON.parse(String(t.data));n.type===`reload`&&e(n)}catch{}},n.onclose=()=>{n=null,!t&&(r=Math.min(r*2,5e3),i=setTimeout(a,r))},n.onerror=()=>{n?.close()}}return a(),()=>{t=!0,i&&clearTimeout(i),n?.close()}}export{r as a,t as i,e as n,n as r,i as t};