schub 0.1.13 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,6 +14,29 @@
14
14
  bun add -g schub@latest
15
15
  ```
16
16
 
17
+ ## Test A Local Built Package (No Publish)
18
+
19
+ From the monorepo root:
20
+
21
+ ```bash
22
+ # 1) Build the CLI + bundled dashboard + bundled API
23
+ bun run --cwd packages/schub build:bundle
24
+
25
+ # 2) Run the built package entrypoint
26
+ # (set explicit local paths so the run is isolated/reproducible)
27
+ SCHUB_DB_PATH=/tmp/schub-local.db \
28
+ SCHUB_STORAGE_PATH=/tmp/schub-local-storage \
29
+ node packages/schub/dist/index.js dashboard
30
+ ```
31
+
32
+ From another project/repo, you can run the exact same built package via absolute path:
33
+
34
+ ```bash
35
+ SCHUB_DB_PATH=/tmp/schub-local.db \
36
+ SCHUB_STORAGE_PATH=/tmp/schub-local-storage \
37
+ node /absolute/path/to/schub/packages/schub/dist/index.js dashboard
38
+ ```
39
+
17
40
  ## Usage
18
41
 
19
42
  Run the CLI using `schub`.
@@ -31955,13 +31955,95 @@ var createAgentsService = (overrides = {}) => {
31955
31955
  return { checkAvailability, listModels };
31956
31956
  };
31957
31957
 
31958
+ // ../schub-services/src/services/docs.ts
31959
+ import { existsSync as existsSync2, readFileSync } from "node:fs";
31960
+ import path3 from "node:path";
31961
+ var createDocsError = (code, message) => Object.assign(new Error(message), { code });
31962
+ var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
31963
+ var normalizeSidebarLink = (link) => {
31964
+ const trimmed = link.trim();
31965
+ if (!trimmed) {
31966
+ throw createDocsError("DOCS_CONFIG_INVALID", "Docs sidebar links must be non-empty strings.");
31967
+ }
31968
+ return trimmed;
31969
+ };
31970
+ var parseSidebarItem = (value, location) => {
31971
+ if (!isRecord(value)) {
31972
+ throw createDocsError("DOCS_CONFIG_INVALID", `Invalid sidebar item at ${location}.`);
31973
+ }
31974
+ const text2 = typeof value.text === "string" ? value.text.trim() : "";
31975
+ const link = typeof value.link === "string" ? normalizeSidebarLink(value.link) : undefined;
31976
+ const items = Array.isArray(value.items) ? value.items.map((item, index) => parseSidebarItem(item, `${location}.items[${index}]`)) : undefined;
31977
+ if (!text2) {
31978
+ throw createDocsError("DOCS_CONFIG_INVALID", `Sidebar item at ${location} is missing a valid text field.`);
31979
+ }
31980
+ if (!link && (!items || items.length === 0)) {
31981
+ throw createDocsError("DOCS_CONFIG_INVALID", `Sidebar item at ${location} must include link or items.`);
31982
+ }
31983
+ return { text: text2, link, items };
31984
+ };
31985
+ var parseDocsSidebar = (content) => {
31986
+ if (!isRecord(content)) {
31987
+ throw createDocsError("DOCS_CONFIG_INVALID", "docs.json must contain an object.");
31988
+ }
31989
+ if (!Array.isArray(content.sidebar)) {
31990
+ throw createDocsError("DOCS_CONFIG_INVALID", "docs.json must include a sidebar array.");
31991
+ }
31992
+ return content.sidebar.map((item, index) => parseSidebarItem(item, `sidebar[${index}]`));
31993
+ };
31994
+ var normalizeDocumentPath = (docsRoot, link) => {
31995
+ const withoutParams = link.split("?")[0]?.split("#")[0] ?? "";
31996
+ const trimmed = withoutParams.trim();
31997
+ if (!trimmed || /^[a-zA-Z]+:\/\//.test(trimmed)) {
31998
+ throw createDocsError("DOCS_LINK_INVALID", `Unsupported docs link: ${link}`);
31999
+ }
32000
+ const normalized = trimmed.replace(/^\/+/, "");
32001
+ const withExtension = normalized.endsWith(".md") ? normalized : `${normalized}.md`;
32002
+ const resolved = path3.resolve(docsRoot, withExtension);
32003
+ const relative = path3.relative(docsRoot, resolved);
32004
+ if (!relative || relative.startsWith("..") || path3.isAbsolute(relative)) {
32005
+ throw createDocsError("DOCS_LINK_INVALID", `Docs link resolves outside .schub/docs: ${link}`);
32006
+ }
32007
+ return relative;
32008
+ };
32009
+ var isDocsServiceError = (value) => value instanceof Error && ("code" in value) && typeof value.code === "string";
32010
+ var createDocsService = (rootPath = process.env.SCHUB_CWD ?? process.cwd()) => {
32011
+ const docsRoot = path3.join(rootPath, ".schub", "docs");
32012
+ const docsConfigPath = path3.join(docsRoot, "docs.json");
32013
+ const getIndex = () => {
32014
+ if (!existsSync2(docsConfigPath)) {
32015
+ throw createDocsError("DOCS_CONFIG_NOT_FOUND", "Docs config not found at .schub/docs/docs.json");
32016
+ }
32017
+ let parsed;
32018
+ try {
32019
+ parsed = JSON.parse(readFileSync(docsConfigPath, "utf8"));
32020
+ } catch {
32021
+ throw createDocsError("DOCS_CONFIG_INVALID", "Unable to parse .schub/docs/docs.json");
32022
+ }
32023
+ return { sidebar: parseDocsSidebar(parsed) };
32024
+ };
32025
+ const getDocument = (link) => {
32026
+ const relativePath = normalizeDocumentPath(docsRoot, link);
32027
+ const absolutePath = path3.join(docsRoot, relativePath);
32028
+ if (!existsSync2(absolutePath)) {
32029
+ throw createDocsError("DOCS_DOCUMENT_NOT_FOUND", `Docs markdown file not found: ${relativePath}`);
32030
+ }
32031
+ return {
32032
+ link,
32033
+ path: relativePath.replaceAll(path3.sep, "/"),
32034
+ content: readFileSync(absolutePath, "utf8")
32035
+ };
32036
+ };
32037
+ return { getIndex, getDocument };
32038
+ };
32039
+
31958
32040
  // ../schub-services/src/services/files.ts
31959
32041
  import { createHash } from "node:crypto";
31960
32042
  import fs3 from "node:fs";
31961
32043
 
31962
32044
  // ../schub-services/src/storage/paths.ts
31963
32045
  import fs2 from "node:fs";
31964
- import path3 from "node:path";
32046
+ import path4 from "node:path";
31965
32047
  var resolveStorageRoot = (storagePath) => {
31966
32048
  if (!storagePath) {
31967
32049
  throw new Error("Storage path is required. Set SCHUB_STORAGE_PATH or pass storagePath.");
@@ -31972,9 +32054,9 @@ var ensureStorageRoot = (storageRoot) => {
31972
32054
  fs2.mkdirSync(storageRoot, { recursive: true });
31973
32055
  };
31974
32056
  var ensureProjectStorageRoot = (storageRoot, projectId) => {
31975
- fs2.mkdirSync(path3.join(storageRoot, projectId), { recursive: true });
32057
+ fs2.mkdirSync(path4.join(storageRoot, projectId), { recursive: true });
31976
32058
  };
31977
- var resolveFileStoragePath = (storageRoot, projectId, fileId) => path3.join(storageRoot, projectId, fileId);
32059
+ var resolveFileStoragePath = (storageRoot, projectId, fileId) => path4.join(storageRoot, projectId, fileId);
31978
32060
 
31979
32061
  // ../schub-services/src/services/files.ts
31980
32062
  var nowTimestamp = () => new Date().toISOString();
@@ -32089,15 +32171,15 @@ var defaultServerHost = "127.0.0.1";
32089
32171
  var defaultServerPort = 4096;
32090
32172
  var maxServerPortAttempts = 20;
32091
32173
  var buildServerUrl = (host, port) => `http://${host}:${port}`;
32092
- var buildRequestUrl = (baseUrl, path4, directory) => {
32093
- const url2 = new URL(path4, baseUrl);
32174
+ var buildRequestUrl = (baseUrl, path5, directory) => {
32175
+ const url2 = new URL(path5, baseUrl);
32094
32176
  url2.searchParams.set("directory", directory);
32095
32177
  return url2.toString();
32096
32178
  };
32097
- var createFileServerStore = (path4) => ({
32179
+ var createFileServerStore = (path5) => ({
32098
32180
  read: async () => {
32099
32181
  try {
32100
- const raw2 = await readFile(path4, "utf8");
32182
+ const raw2 = await readFile(path5, "utf8");
32101
32183
  const value = raw2.trim();
32102
32184
  return value.length > 0 ? value : null;
32103
32185
  } catch {
@@ -32105,13 +32187,13 @@ var createFileServerStore = (path4) => ({
32105
32187
  }
32106
32188
  },
32107
32189
  write: async (url2) => {
32108
- await mkdir(dirname(path4), { recursive: true });
32109
- await writeFile(path4, `${url2}
32190
+ await mkdir(dirname(path5), { recursive: true });
32191
+ await writeFile(path5, `${url2}
32110
32192
  `, "utf8");
32111
32193
  },
32112
32194
  clear: async () => {
32113
32195
  try {
32114
- await unlink(path4);
32196
+ await unlink(path5);
32115
32197
  } catch {
32116
32198
  return;
32117
32199
  }
@@ -33811,6 +33893,7 @@ var createServices = (config2 = {}) => {
33811
33893
  const storageRoot = resolveStorageRoot(config2.storagePath);
33812
33894
  ensureStorageRoot(storageRoot);
33813
33895
  const agents = createAgentsService();
33896
+ const docs = createDocsService();
33814
33897
  const files2 = createFilesService(db, storageRoot);
33815
33898
  const opencode = createOpencodeService();
33816
33899
  const proposalStatuses = createProposalStatusesService(db);
@@ -33824,6 +33907,7 @@ var createServices = (config2 = {}) => {
33824
33907
  const workspaces2 = createWorkspacesService(db);
33825
33908
  return {
33826
33909
  agents,
33910
+ docs,
33827
33911
  files: files2,
33828
33912
  opencode,
33829
33913
  proposalStatuses,
@@ -33968,18 +34052,18 @@ var colorStatus = async (status) => {
33968
34052
  }
33969
34053
  return `${status}`;
33970
34054
  };
33971
- async function log(fn, prefix, method, path4, status = 0, elapsed) {
33972
- const out = prefix === "<--" ? `${prefix} ${method} ${path4}` : `${prefix} ${method} ${path4} ${await colorStatus(status)} ${elapsed}`;
34055
+ async function log(fn, prefix, method, path5, status = 0, elapsed) {
34056
+ const out = prefix === "<--" ? `${prefix} ${method} ${path5}` : `${prefix} ${method} ${path5} ${await colorStatus(status)} ${elapsed}`;
33973
34057
  fn(out);
33974
34058
  }
33975
34059
  var logger = (fn = console.log) => {
33976
34060
  return async function logger2(c, next) {
33977
34061
  const { method, url: url2 } = c.req;
33978
- const path4 = url2.slice(url2.indexOf("/", 8));
33979
- await log(fn, "<--", method, path4);
34062
+ const path5 = url2.slice(url2.indexOf("/", 8));
34063
+ await log(fn, "<--", method, path5);
33980
34064
  const start = Date.now();
33981
34065
  await next();
33982
- await log(fn, "-->", method, path4, c.res.status, time3(start));
34066
+ await log(fn, "-->", method, path5, c.res.status, time3(start));
33983
34067
  };
33984
34068
  };
33985
34069
 
@@ -34064,6 +34148,145 @@ var registerContainerRoutes = (router) => {
34064
34148
  ]);
34065
34149
  };
34066
34150
 
34151
+ // ../schub-api/src/responses.ts
34152
+ var apiSuccessSchema = (schema) => exports_external.object({ success: exports_external.literal(true), data: schema });
34153
+ var apiErrorSchema = exports_external.object({
34154
+ success: exports_external.literal(false),
34155
+ message: exports_external.string(),
34156
+ error_data: exports_external.unknown().optional()
34157
+ });
34158
+ var okResponse = (data) => ({
34159
+ success: true,
34160
+ data
34161
+ });
34162
+ var errorResponse = (message, error_data) => error_data ? { success: false, message, error_data } : { success: false, message };
34163
+
34164
+ // ../schub-api/src/routes/docs.ts
34165
+ var docsSidebarItemSchema = exports_external.object({
34166
+ text: exports_external.string(),
34167
+ link: exports_external.string().optional(),
34168
+ items: exports_external.array(exports_external.any()).optional()
34169
+ });
34170
+ var docsIndexSchema = exports_external.object({
34171
+ sidebar: exports_external.array(docsSidebarItemSchema)
34172
+ });
34173
+ var docsContentSchema = exports_external.object({
34174
+ link: exports_external.string(),
34175
+ path: exports_external.string(),
34176
+ content: exports_external.string()
34177
+ });
34178
+ var docsContentQuerySchema = exports_external.object({
34179
+ link: exports_external.string().min(1)
34180
+ });
34181
+ var resolveDocsError = (error48) => {
34182
+ if (!isDocsServiceError(error48)) {
34183
+ return {
34184
+ status: 500,
34185
+ body: errorResponse("Failed to read docs", { code: "DOCS_UNKNOWN_ERROR" })
34186
+ };
34187
+ }
34188
+ if (error48.code === "DOCS_CONFIG_NOT_FOUND" || error48.code === "DOCS_DOCUMENT_NOT_FOUND") {
34189
+ return {
34190
+ status: 404,
34191
+ body: errorResponse(error48.message, { code: error48.code })
34192
+ };
34193
+ }
34194
+ return {
34195
+ status: 400,
34196
+ body: errorResponse(error48.message, { code: error48.code })
34197
+ };
34198
+ };
34199
+ var registerDocsRoutes = (router) => {
34200
+ const indexRoute = createRoute({
34201
+ method: "get",
34202
+ path: "/docs",
34203
+ tags: ["Docs"],
34204
+ summary: "Read local docs index",
34205
+ responses: {
34206
+ 200: {
34207
+ description: "Docs index",
34208
+ content: {
34209
+ "application/json": {
34210
+ schema: apiSuccessSchema(docsIndexSchema)
34211
+ }
34212
+ }
34213
+ },
34214
+ 400: {
34215
+ description: "Invalid docs config",
34216
+ content: {
34217
+ "application/json": {
34218
+ schema: apiErrorSchema
34219
+ }
34220
+ }
34221
+ },
34222
+ 404: {
34223
+ description: "Docs config not found",
34224
+ content: {
34225
+ "application/json": {
34226
+ schema: apiErrorSchema
34227
+ }
34228
+ }
34229
+ }
34230
+ }
34231
+ });
34232
+ const indexHandler = (c) => {
34233
+ try {
34234
+ const data = c.get("services").docs.getIndex();
34235
+ return c.json(okResponse(data), 200);
34236
+ } catch (error48) {
34237
+ const resolved = resolveDocsError(error48);
34238
+ return c.json(resolved.body, resolved.status);
34239
+ }
34240
+ };
34241
+ router.openapi(indexRoute, indexHandler);
34242
+ const contentRoute = createRoute({
34243
+ method: "get",
34244
+ path: "/docs/content",
34245
+ tags: ["Docs"],
34246
+ summary: "Read docs markdown content",
34247
+ request: {
34248
+ query: docsContentQuerySchema
34249
+ },
34250
+ responses: {
34251
+ 200: {
34252
+ description: "Docs markdown content",
34253
+ content: {
34254
+ "application/json": {
34255
+ schema: apiSuccessSchema(docsContentSchema)
34256
+ }
34257
+ }
34258
+ },
34259
+ 400: {
34260
+ description: "Invalid docs link",
34261
+ content: {
34262
+ "application/json": {
34263
+ schema: apiErrorSchema
34264
+ }
34265
+ }
34266
+ },
34267
+ 404: {
34268
+ description: "Markdown file not found",
34269
+ content: {
34270
+ "application/json": {
34271
+ schema: apiErrorSchema
34272
+ }
34273
+ }
34274
+ }
34275
+ }
34276
+ });
34277
+ const contentHandler = (c) => {
34278
+ const { link } = c.req.valid("query");
34279
+ try {
34280
+ const data = c.get("services").docs.getDocument(link);
34281
+ return c.json(okResponse(data), 200);
34282
+ } catch (error48) {
34283
+ const resolved = resolveDocsError(error48);
34284
+ return c.json(resolved.body, resolved.status);
34285
+ }
34286
+ };
34287
+ router.openapi(contentRoute, contentHandler);
34288
+ };
34289
+
34067
34290
  // ../schub-api/src/routes/drafts.ts
34068
34291
  var registerDraftRoutes = (router) => {
34069
34292
  registerPlaceholderRoutes(router, "Drafts", [
@@ -34095,21 +34318,6 @@ var registerExecutionProcessRoutes = (router) => {
34095
34318
 
34096
34319
  // ../schub-api/src/routes/files.ts
34097
34320
  import { readFile as readFile2 } from "node:fs/promises";
34098
-
34099
- // ../schub-api/src/responses.ts
34100
- var apiSuccessSchema = (schema) => exports_external.object({ success: exports_external.literal(true), data: schema });
34101
- var apiErrorSchema = exports_external.object({
34102
- success: exports_external.literal(false),
34103
- message: exports_external.string(),
34104
- error_data: exports_external.unknown().optional()
34105
- });
34106
- var okResponse = (data) => ({
34107
- success: true,
34108
- data
34109
- });
34110
- var errorResponse = (message, error_data) => error_data ? { success: false, message, error_data } : { success: false, message };
34111
-
34112
- // ../schub-api/src/routes/files.ts
34113
34321
  var fileSchema = exports_external.object({
34114
34322
  id: exports_external.string(),
34115
34323
  project_id: exports_external.string(),
@@ -34435,18 +34643,18 @@ var expandHomePath = (value) => {
34435
34643
  return value;
34436
34644
  };
34437
34645
  var resolveRootPath = (value) => resolve(expandHomePath(value) ?? process.env.SCHUB_CWD ?? process.cwd());
34438
- var isGitRepo = async (path4) => {
34646
+ var isGitRepo = async (path5) => {
34439
34647
  try {
34440
- const gitStat = await stat(join3(path4, ".git"));
34648
+ const gitStat = await stat(join3(path5, ".git"));
34441
34649
  return gitStat.isDirectory();
34442
34650
  } catch {
34443
34651
  return false;
34444
34652
  }
34445
34653
  };
34446
- var listDirectoryEntries = async (path4) => {
34447
- const entries = await readdir(path4, { withFileTypes: true });
34654
+ var listDirectoryEntries = async (path5) => {
34655
+ const entries = await readdir(path5, { withFileTypes: true });
34448
34656
  const mapped = await Promise.all(entries.map(async (entry) => {
34449
- const fullPath = join3(path4, entry.name);
34657
+ const fullPath = join3(path5, entry.name);
34450
34658
  const isDirectory = entry.isDirectory();
34451
34659
  return {
34452
34660
  name: entry.name,
@@ -34464,18 +34672,18 @@ var listGitRepos = async (rootPath) => {
34464
34672
  const next = queue.shift();
34465
34673
  if (!next)
34466
34674
  break;
34467
- const { path: path4, depth } = next;
34675
+ const { path: path5, depth } = next;
34468
34676
  let entries = [];
34469
34677
  try {
34470
- entries = await readdir(path4, { withFileTypes: true });
34678
+ entries = await readdir(path5, { withFileTypes: true });
34471
34679
  } catch {
34472
34680
  continue;
34473
34681
  }
34474
34682
  const hasGit = entries.some((entry) => entry.isDirectory() && entry.name === ".git");
34475
34683
  if (hasGit) {
34476
34684
  repos2.push({
34477
- name: basename2(path4),
34478
- path: path4,
34685
+ name: basename2(path5),
34686
+ path: path5,
34479
34687
  is_directory: true,
34480
34688
  is_git_repo: true
34481
34689
  });
@@ -34489,7 +34697,7 @@ var listGitRepos = async (rootPath) => {
34489
34697
  return;
34490
34698
  if (SKIP_DIRS.has(entry.name))
34491
34699
  return;
34492
- queue.push({ path: join3(path4, entry.name), depth: depth + 1 });
34700
+ queue.push({ path: join3(path5, entry.name), depth: depth + 1 });
34493
34701
  });
34494
34702
  }
34495
34703
  return repos2;
@@ -34523,8 +34731,8 @@ var registerFilesystemRoutes = (router) => {
34523
34731
  }
34524
34732
  });
34525
34733
  const directoryHandler = async (c) => {
34526
- const { path: path4 } = c.req.valid("query");
34527
- const resolvedPath = resolveRootPath(path4);
34734
+ const { path: path5 } = c.req.valid("query");
34735
+ const resolvedPath = resolveRootPath(path5);
34528
34736
  try {
34529
34737
  const entries = await listDirectoryEntries(resolvedPath);
34530
34738
  return c.json(okResponse({ current_path: resolvedPath, entries }), 200);
@@ -34562,8 +34770,8 @@ var registerFilesystemRoutes = (router) => {
34562
34770
  }
34563
34771
  });
34564
34772
  const gitReposHandler = async (c) => {
34565
- const { path: path4 } = c.req.valid("query");
34566
- const resolvedPath = resolveRootPath(path4);
34773
+ const { path: path5 } = c.req.valid("query");
34774
+ const resolvedPath = resolveRootPath(path5);
34567
34775
  try {
34568
34776
  const repos2 = await listGitRepos(resolvedPath);
34569
34777
  return c.json(okResponse(repos2), 200);
@@ -36629,7 +36837,7 @@ var registerTicketStatusRoutes = (router) => {
36629
36837
 
36630
36838
  // ../schub-api/src/routes/tickets.ts
36631
36839
  import { spawnSync as spawnSync2 } from "node:child_process";
36632
- import { existsSync as existsSync2, mkdirSync } from "node:fs";
36840
+ import { existsSync as existsSync3, mkdirSync } from "node:fs";
36633
36841
  import { join as join5 } from "node:path";
36634
36842
  var runGit = (cwd, args) => {
36635
36843
  return spawnSync2("git", args, {
@@ -36646,7 +36854,7 @@ var createAttemptWorktree = (options) => {
36646
36854
  const gitRoot = gitRootResult.stdout.trim();
36647
36855
  const worktreePath = join5(gitRoot, ".schub", "worktrees", options.ticketShorthand, `attempt-${options.attemptNumber}`);
36648
36856
  const branchName = `ticket/${options.ticketShorthand}/attempt-${options.attemptNumber}`;
36649
- if (existsSync2(worktreePath)) {
36857
+ if (existsSync3(worktreePath)) {
36650
36858
  throw new Error(`Worktree path already exists: ${worktreePath}`);
36651
36859
  }
36652
36860
  const branchCheck = runGit(gitRoot, ["show-ref", "--verify", "--quiet", `refs/heads/${branchName}`]);
@@ -37319,6 +37527,7 @@ var createRoutes = (options) => {
37319
37527
  const routes = new OpenAPIHono;
37320
37528
  registerSystemRoutes(routes);
37321
37529
  registerContainerRoutes(routes);
37530
+ registerDocsRoutes(routes);
37322
37531
  registerProjectRoutes(routes, options.upgradeWebSocket);
37323
37532
  registerTicketStatusRoutes(routes);
37324
37533
  registerProposalRoutes(routes);
@@ -1 +1 @@
1
- import{c as f,r as u,k as E,j as a,o as p}from"./index-cKNLpxLp.js";function x(c){const e=f.c(5),{equation:i,inline:n}=c,l=u.useRef(null);let o,t;e[0]!==i||e[1]!==n?(o=()=>{const s=l.current;s!==null&&E.render(i,s,{displayMode:!n,errorColor:"#cc0000",output:"html",strict:"warn",throwOnError:!1,trust:!1})},t=[i,n],e[0]=i,e[1]=n,e[2]=o,e[3]=t):(o=e[2],t=e[3]),u.useEffect(o,t);let r;return e[4]===Symbol.for("react.memo_cache_sentinel")?(r=a.jsxs(a.Fragment,{children:[a.jsx("img",{src:"#",alt:""}),a.jsx("span",{ref:l}),a.jsx("img",{src:"#",alt:""})]}),e[4]=r):r=e[4],r}class d extends u.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){this.props.onError(e)}render(){return this.state.hasError?null:this.props.children}}function j(c){const e=f.c(8),{equation:i,inline:n}=c,[l]=p(),[o]=u.useState(i);let t;e[0]!==l?(t=m=>l._onError(m),e[0]=l,e[1]=t):t=e[1];let r;e[2]!==o||e[3]!==n?(r=a.jsx(x,{equation:o,inline:n}),e[2]=o,e[3]=n,e[4]=r):r=e[4];let s;return e[5]!==t||e[6]!==r?(s=a.jsx(d,{onError:t,children:r}),e[5]=t,e[6]=r,e[7]=s):s=e[7],s}export{j as default};
1
+ import{c as f,r as u,k as E,j as a,o as p}from"./index-DhqXvDTi.js";function x(c){const e=f.c(5),{equation:i,inline:n}=c,l=u.useRef(null);let o,t;e[0]!==i||e[1]!==n?(o=()=>{const s=l.current;s!==null&&E.render(i,s,{displayMode:!n,errorColor:"#cc0000",output:"html",strict:"warn",throwOnError:!1,trust:!1})},t=[i,n],e[0]=i,e[1]=n,e[2]=o,e[3]=t):(o=e[2],t=e[3]),u.useEffect(o,t);let r;return e[4]===Symbol.for("react.memo_cache_sentinel")?(r=a.jsxs(a.Fragment,{children:[a.jsx("img",{src:"#",alt:""}),a.jsx("span",{ref:l}),a.jsx("img",{src:"#",alt:""})]}),e[4]=r):r=e[4],r}class d extends u.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){this.props.onError(e)}render(){return this.state.hasError?null:this.props.children}}function j(c){const e=f.c(8),{equation:i,inline:n}=c,[l]=p(),[o]=u.useState(i);let t;e[0]!==l?(t=m=>l._onError(m),e[0]=l,e[1]=t):t=e[1];let r;e[2]!==o||e[3]!==n?(r=a.jsx(x,{equation:o,inline:n}),e[2]=o,e[3]=n,e[4]=r):r=e[4];let s;return e[5]!==t||e[6]!==r?(s=a.jsx(d,{onError:t,children:r}),e[5]=t,e[6]=r,e[7]=s):s=e[7],s}export{j as default};