@sonicjs-cms/core 3.0.0-beta.21 → 3.0.0-beta.23

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.
Files changed (106) hide show
  1. package/dist/adapters.cjs +512 -0
  2. package/dist/adapters.cjs.map +1 -0
  3. package/dist/adapters.d.cts +342 -0
  4. package/dist/adapters.d.ts +342 -0
  5. package/dist/adapters.js +501 -0
  6. package/dist/adapters.js.map +1 -0
  7. package/dist/admin-documents-form.template-55V2ZGWT.js +6 -0
  8. package/dist/{admin-documents-form.template-DDSH6ROU.js.map → admin-documents-form.template-55V2ZGWT.js.map} +1 -1
  9. package/dist/admin-documents-form.template-YNAVMJCV.cjs +19 -0
  10. package/dist/{admin-layout-catalyst.template-YQ4EMF2J.js.map → admin-documents-form.template-YNAVMJCV.cjs.map} +1 -1
  11. package/dist/admin-layout-catalyst.template-3XZXDGF7.cjs +21 -0
  12. package/dist/{admin-layout-catalyst.template-KDHKVLXR.cjs.map → admin-layout-catalyst.template-3XZXDGF7.cjs.map} +1 -1
  13. package/dist/admin-layout-catalyst.template-6UQGLCKI.js +7 -0
  14. package/dist/{admin-documents-form.template-LSZKGA5J.cjs.map → admin-layout-catalyst.template-6UQGLCKI.js.map} +1 -1
  15. package/dist/{chunk-7OTOXWEB.js → chunk-2MIYYAO4.js} +49 -4
  16. package/dist/chunk-2MIYYAO4.js.map +1 -0
  17. package/dist/{chunk-A4KUJ3LD.cjs → chunk-4WMZGHIC.cjs} +53 -4
  18. package/dist/chunk-4WMZGHIC.cjs.map +1 -0
  19. package/dist/{chunk-5U75XP74.js → chunk-A46IRC5A.js} +3 -3
  20. package/dist/chunk-A46IRC5A.js.map +1 -0
  21. package/dist/{chunk-KVBHB7QP.cjs → chunk-AT4ZQGEZ.cjs} +17 -2
  22. package/dist/chunk-AT4ZQGEZ.cjs.map +1 -0
  23. package/dist/{chunk-CRGUD4KC.cjs → chunk-BBEKHLTW.cjs} +9 -9
  24. package/dist/{chunk-CRGUD4KC.cjs.map → chunk-BBEKHLTW.cjs.map} +1 -1
  25. package/dist/{chunk-RMRJGMDE.js → chunk-BHND5PEV.js} +3 -3
  26. package/dist/{chunk-RMRJGMDE.js.map → chunk-BHND5PEV.js.map} +1 -1
  27. package/dist/{chunk-OBA2RYZN.js → chunk-BJROXF4N.js} +3 -3
  28. package/dist/{chunk-OBA2RYZN.js.map → chunk-BJROXF4N.js.map} +1 -1
  29. package/dist/{chunk-AOUVUF32.cjs → chunk-C3ZQP5NW.cjs} +12 -5
  30. package/dist/chunk-C3ZQP5NW.cjs.map +1 -0
  31. package/dist/{chunk-7RUW244J.cjs → chunk-CTYLCWMO.cjs} +487 -315
  32. package/dist/chunk-CTYLCWMO.cjs.map +1 -0
  33. package/dist/{chunk-4UYJPHSV.js → chunk-DIBCKCUE.js} +6 -6
  34. package/dist/{chunk-4UYJPHSV.js.map → chunk-DIBCKCUE.js.map} +1 -1
  35. package/dist/{chunk-JEX3UPZL.js → chunk-DPLJYTHE.js} +12 -5
  36. package/dist/chunk-DPLJYTHE.js.map +1 -0
  37. package/dist/{chunk-PXNTCCPE.cjs → chunk-E66UVONV.cjs} +8 -8
  38. package/dist/{chunk-PXNTCCPE.cjs.map → chunk-E66UVONV.cjs.map} +1 -1
  39. package/dist/{chunk-FCLKX2OS.cjs → chunk-IS54FPB7.cjs} +18 -18
  40. package/dist/{chunk-FCLKX2OS.cjs.map → chunk-IS54FPB7.cjs.map} +1 -1
  41. package/dist/{chunk-N32OWET6.cjs → chunk-JMJM7DMM.cjs} +5 -5
  42. package/dist/{chunk-N32OWET6.cjs.map → chunk-JMJM7DMM.cjs.map} +1 -1
  43. package/dist/{chunk-4LVVMVQI.js → chunk-KS24NPPL.js} +17 -2
  44. package/dist/chunk-KS24NPPL.js.map +1 -0
  45. package/dist/{chunk-5UXU3LP4.cjs → chunk-RFBW5RRH.cjs} +11 -59
  46. package/dist/chunk-RFBW5RRH.cjs.map +1 -0
  47. package/dist/{chunk-ZP77LTN4.js → chunk-SK5CHFJP.js} +193 -22
  48. package/dist/chunk-SK5CHFJP.js.map +1 -0
  49. package/dist/{chunk-5V62WT6M.js → chunk-THFZSDIU.js} +4 -2
  50. package/dist/chunk-THFZSDIU.js.map +1 -0
  51. package/dist/{chunk-JQISFW6U.js → chunk-URIBTX27.js} +3 -3
  52. package/dist/{chunk-JQISFW6U.js.map → chunk-URIBTX27.js.map} +1 -1
  53. package/dist/{chunk-K623Q6WD.cjs → chunk-UYJQDDEE.cjs} +4 -2
  54. package/dist/chunk-UYJQDDEE.cjs.map +1 -0
  55. package/dist/{chunk-OJC4G5JE.cjs → chunk-VGHEKIJL.cjs} +3 -3
  56. package/dist/chunk-VGHEKIJL.cjs.map +1 -0
  57. package/dist/{chunk-GICS5AIO.js → chunk-XXRR54AB.js} +5 -49
  58. package/dist/chunk-XXRR54AB.js.map +1 -0
  59. package/dist/{define-plugin-DsKiGu1q.d.cts → define-plugin-DMcvEy_C.d.cts} +33 -0
  60. package/dist/{define-plugin-BYIey6sp.d.ts → define-plugin-D_6D9vVZ.d.ts} +33 -0
  61. package/dist/index.cjs +1807 -332
  62. package/dist/index.cjs.map +1 -1
  63. package/dist/index.d.cts +2 -2
  64. package/dist/index.d.ts +2 -2
  65. package/dist/index.js +1502 -27
  66. package/dist/index.js.map +1 -1
  67. package/dist/middleware.cjs +34 -34
  68. package/dist/middleware.js +5 -5
  69. package/dist/migrations-XQ6EX6HX.js +4 -0
  70. package/dist/{migrations-HMX5SPN2.js.map → migrations-XQ6EX6HX.js.map} +1 -1
  71. package/dist/migrations-ZD7Y5NUC.cjs +13 -0
  72. package/dist/{migrations-V73ARYV5.cjs.map → migrations-ZD7Y5NUC.cjs.map} +1 -1
  73. package/dist/plugins.cjs +40 -40
  74. package/dist/plugins.d.cts +1 -1
  75. package/dist/plugins.d.ts +1 -1
  76. package/dist/plugins.js +3 -3
  77. package/dist/routes.cjs +29 -29
  78. package/dist/routes.js +9 -9
  79. package/dist/services.cjs +18 -18
  80. package/dist/services.js +2 -2
  81. package/dist/templates.cjs +17 -17
  82. package/dist/templates.js +3 -3
  83. package/dist/utils.cjs +3 -3
  84. package/dist/utils.js +1 -1
  85. package/migrations/0001_core.sql +7 -1
  86. package/package.json +10 -3
  87. package/dist/admin-documents-form.template-DDSH6ROU.js +0 -6
  88. package/dist/admin-documents-form.template-LSZKGA5J.cjs +0 -19
  89. package/dist/admin-layout-catalyst.template-KDHKVLXR.cjs +0 -21
  90. package/dist/admin-layout-catalyst.template-YQ4EMF2J.js +0 -7
  91. package/dist/chunk-4LVVMVQI.js.map +0 -1
  92. package/dist/chunk-5U75XP74.js.map +0 -1
  93. package/dist/chunk-5UXU3LP4.cjs.map +0 -1
  94. package/dist/chunk-5V62WT6M.js.map +0 -1
  95. package/dist/chunk-7OTOXWEB.js.map +0 -1
  96. package/dist/chunk-7RUW244J.cjs.map +0 -1
  97. package/dist/chunk-A4KUJ3LD.cjs.map +0 -1
  98. package/dist/chunk-AOUVUF32.cjs.map +0 -1
  99. package/dist/chunk-GICS5AIO.js.map +0 -1
  100. package/dist/chunk-JEX3UPZL.js.map +0 -1
  101. package/dist/chunk-K623Q6WD.cjs.map +0 -1
  102. package/dist/chunk-KVBHB7QP.cjs.map +0 -1
  103. package/dist/chunk-OJC4G5JE.cjs.map +0 -1
  104. package/dist/chunk-ZP77LTN4.js.map +0 -1
  105. package/dist/migrations-HMX5SPN2.js +0 -4
  106. package/dist/migrations-V73ARYV5.cjs +0 -13
@@ -1,20 +1,20 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkXWVDSM2L_cjs = require('./chunk-XWVDSM2L.cjs');
4
- var chunkN32OWET6_cjs = require('./chunk-N32OWET6.cjs');
4
+ var chunkJMJM7DMM_cjs = require('./chunk-JMJM7DMM.cjs');
5
5
  var chunk36Z3AKX3_cjs = require('./chunk-36Z3AKX3.cjs');
6
- var chunkFCLKX2OS_cjs = require('./chunk-FCLKX2OS.cjs');
6
+ var chunkIS54FPB7_cjs = require('./chunk-IS54FPB7.cjs');
7
7
  var chunkLTZ5WYOK_cjs = require('./chunk-LTZ5WYOK.cjs');
8
8
  var chunkKIGVVO6N_cjs = require('./chunk-KIGVVO6N.cjs');
9
- var chunkKVBHB7QP_cjs = require('./chunk-KVBHB7QP.cjs');
10
- var chunkOJC4G5JE_cjs = require('./chunk-OJC4G5JE.cjs');
11
- var chunkPXNTCCPE_cjs = require('./chunk-PXNTCCPE.cjs');
12
- var chunkK623Q6WD_cjs = require('./chunk-K623Q6WD.cjs');
13
- var chunkA4KUJ3LD_cjs = require('./chunk-A4KUJ3LD.cjs');
9
+ var chunkAT4ZQGEZ_cjs = require('./chunk-AT4ZQGEZ.cjs');
10
+ var chunkVGHEKIJL_cjs = require('./chunk-VGHEKIJL.cjs');
11
+ var chunkE66UVONV_cjs = require('./chunk-E66UVONV.cjs');
12
+ var chunkUYJQDDEE_cjs = require('./chunk-UYJQDDEE.cjs');
13
+ var chunk4WMZGHIC_cjs = require('./chunk-4WMZGHIC.cjs');
14
14
  var chunkJ6JTWD2A_cjs = require('./chunk-J6JTWD2A.cjs');
15
15
  var chunkIXUHXTHW_cjs = require('./chunk-IXUHXTHW.cjs');
16
16
  var chunkRCQ2HIQD_cjs = require('./chunk-RCQ2HIQD.cjs');
17
- var chunkAOUVUF32_cjs = require('./chunk-AOUVUF32.cjs');
17
+ var chunkC3ZQP5NW_cjs = require('./chunk-C3ZQP5NW.cjs');
18
18
  var chunkMNWKYY5E_cjs = require('./chunk-MNWKYY5E.cjs');
19
19
  var hono = require('hono');
20
20
  var zod = require('zod');
@@ -259,7 +259,7 @@ function getDocumentRequestContext(c) {
259
259
 
260
260
  // src/routes/api-documents.ts
261
261
  async function aclAllowsRead(db, tenantId, principalSet, row, preloadedType) {
262
- const docType = preloadedType ?? await new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db).findById(row.type_id);
262
+ const docType = preloadedType ?? await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db).findById(row.type_id);
263
263
  if (!docType) return false;
264
264
  return new DocumentRepository(db, tenantId).isAllowed(principalSet, row.root_id, "read", docType.settings);
265
265
  }
@@ -277,7 +277,7 @@ apiDocumentsRoutes.get("/", async (c) => {
277
277
  if (!typeId) {
278
278
  return c.json({ error: "type query parameter is required" }, 400);
279
279
  }
280
- const registry = new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db);
280
+ const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(db);
281
281
  const docType = await registry.findById(typeId);
282
282
  if (!docType || !docType.isActive) {
283
283
  return c.json({ error: "Unknown document type" }, 400);
@@ -359,7 +359,7 @@ apiDocumentsRoutes.get("/root/:rootId", async (c) => {
359
359
  AND (expires_at IS NULL OR expires_at > ?) LIMIT 1`
360
360
  ).bind(rootId, now, now).first();
361
361
  if (!row) return c.json({ error: "Not found" }, 404);
362
- const docType = await new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db).findById(row.type_id);
362
+ const docType = await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db).findById(row.type_id);
363
363
  const effTenant = effectiveTenantForType(tenantId, docType?.settings);
364
364
  if (row.tenant_id !== effTenant) return c.json({ error: "Not found" }, 404);
365
365
  if (!await aclAllowsRead(db, effTenant, principalSet, row, docType)) {
@@ -395,7 +395,7 @@ apiDocumentsRoutes.get("/:id", async (c) => {
395
395
  AND (expires_at IS NULL OR expires_at > ?) LIMIT 1`
396
396
  ).bind(id, now, now).first();
397
397
  if (!row) return c.json({ error: "Not found" }, 404);
398
- const docType = await new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db).findById(row.type_id);
398
+ const docType = await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db).findById(row.type_id);
399
399
  const effTenant = effectiveTenantForType(tenantId, docType?.settings);
400
400
  if (row.tenant_id !== effTenant) return c.json({ error: "Not found" }, 404);
401
401
  if (!await aclAllowsRead(db, effTenant, principalSet, row, docType)) {
@@ -465,17 +465,17 @@ async function resolveDocScope(c, db, by, opts = {}) {
465
465
  const draft = opts.currentDraftOnly ? " AND is_current_draft = 1" : "";
466
466
  const row = await db.prepare(`SELECT type_id, root_id, tenant_id FROM documents WHERE ${col} = ?${draft} LIMIT 1`).bind(val).first();
467
467
  if (!row) return null;
468
- const docType = await new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db).findById(row.type_id);
468
+ const docType = await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db).findById(row.type_id);
469
469
  const tenantId = effectiveTenantForType(getRequestTenant(c), docType?.settings);
470
470
  if (row.tenant_id !== tenantId) return null;
471
471
  return { typeId: row.type_id, rootId: row.root_id, tenantId, docType };
472
472
  }
473
473
  var adminDocumentsRoutes = new hono.Hono();
474
- adminDocumentsRoutes.use("*", chunkFCLKX2OS_cjs.requireAuth());
475
- adminDocumentsRoutes.use("*", chunkFCLKX2OS_cjs.requireRole(["admin", "editor"]));
474
+ adminDocumentsRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
475
+ adminDocumentsRoutes.use("*", chunkIS54FPB7_cjs.requireRole(["admin", "editor"]));
476
476
  adminDocumentsRoutes.get("/types", async (c) => {
477
477
  try {
478
- const registry = new chunkFCLKX2OS_cjs.DocumentTypeRegistry(c.env.DB);
478
+ const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(c.env.DB);
479
479
  const types = await registry.findAll();
480
480
  return c.json({ data: types });
481
481
  } catch (error) {
@@ -503,7 +503,7 @@ adminDocumentsRoutes.get("/", async (c) => {
503
503
  if (!typeId) {
504
504
  return c.json({ error: "type query parameter is required" }, 400);
505
505
  }
506
- const registry = new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db);
506
+ const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(db);
507
507
  const docType = await registry.findById(typeId);
508
508
  if (!docType || !docType.isActive) {
509
509
  return c.json({ error: "Unknown document type" }, 400);
@@ -614,7 +614,7 @@ adminDocumentsRoutes.post("/", async (c) => {
614
614
  const input = validation.data;
615
615
  const db = c.env.DB;
616
616
  const user = c.get("user");
617
- const registry = new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db);
617
+ const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(db);
618
618
  const docType = await registry.findById(input.typeId);
619
619
  if (!docType || !docType.isActive) {
620
620
  return c.json({ error: "Unknown document type" }, 400);
@@ -746,7 +746,7 @@ adminDocumentsRoutes.post("/types/:typeId/reindex", async (c) => {
746
746
  try {
747
747
  const { typeId } = c.req.param();
748
748
  const db = c.env.DB;
749
- const registry = new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db);
749
+ const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(db);
750
750
  const docType = await registry.findById(typeId);
751
751
  if (!docType) return c.json({ error: "Unknown document type" }, 400);
752
752
  const reindexTenant = effectiveTenantForType(getRequestTenant(c), docType.settings);
@@ -900,13 +900,13 @@ async function resolveContentVariables(contentData, db) {
900
900
  // src/routes/api-content-crud.ts
901
901
  var apiContentCrudRoutes = new hono.Hono();
902
902
  async function resolveDocBacking(db, collectionIdOrName) {
903
- const registry = chunkKVBHB7QP_cjs.getCollectionRegistry();
903
+ const registry = chunkAT4ZQGEZ_cjs.getCollectionRegistry();
904
904
  const record = registry.getBySlugOrName(collectionIdOrName) ?? registry.getById(collectionIdOrName);
905
905
  if (record) {
906
- const docType2 = await new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db).findById(record.name);
906
+ const docType2 = await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db).findById(record.name);
907
907
  return docType2 ? { coll: { id: record.id, name: record.name }, docType: docType2 } : null;
908
908
  }
909
- const docType = await new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db).findById(collectionIdOrName);
909
+ const docType = await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db).findById(collectionIdOrName);
910
910
  if (docType) {
911
911
  return { coll: { id: collectionIdOrName, name: collectionIdOrName }, docType };
912
912
  }
@@ -949,7 +949,7 @@ apiContentCrudRoutes.get("/check-slug", async (c) => {
949
949
  }, 500);
950
950
  }
951
951
  });
952
- apiContentCrudRoutes.get("/:id", chunkFCLKX2OS_cjs.optionalAuth(), async (c) => {
952
+ apiContentCrudRoutes.get("/:id", chunkIS54FPB7_cjs.optionalAuth(), async (c) => {
953
953
  try {
954
954
  const id = c.req.param("id");
955
955
  const db = c.env.DB;
@@ -959,7 +959,7 @@ apiContentCrudRoutes.get("/:id", chunkFCLKX2OS_cjs.optionalAuth(), async (c) =>
959
959
  ).bind(id, getRequestTenant(c)).first();
960
960
  let transformedContent;
961
961
  if (docRow) {
962
- const coll = chunkKVBHB7QP_cjs.getCollectionRegistry().getByName(docRow.type_id);
962
+ const coll = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getByName(docRow.type_id);
963
963
  transformedContent = {
964
964
  id: docRow.root_id,
965
965
  title: docRow.title,
@@ -993,7 +993,7 @@ apiContentCrudRoutes.get("/:id", chunkFCLKX2OS_cjs.optionalAuth(), async (c) =>
993
993
  }, 500);
994
994
  }
995
995
  });
996
- apiContentCrudRoutes.post("/", chunkFCLKX2OS_cjs.requireAuth(), chunkFCLKX2OS_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
996
+ apiContentCrudRoutes.post("/", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
997
997
  try {
998
998
  const db = c.env.DB;
999
999
  const user = c.get("user");
@@ -1068,7 +1068,7 @@ apiContentCrudRoutes.post("/", chunkFCLKX2OS_cjs.requireAuth(), chunkFCLKX2OS_cj
1068
1068
  }, 500);
1069
1069
  }
1070
1070
  });
1071
- apiContentCrudRoutes.put("/:id", chunkFCLKX2OS_cjs.requireAuth(), chunkFCLKX2OS_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
1071
+ apiContentCrudRoutes.put("/:id", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
1072
1072
  try {
1073
1073
  const id = c.req.param("id");
1074
1074
  const db = c.env.DB;
@@ -1090,7 +1090,7 @@ apiContentCrudRoutes.put("/:id", chunkFCLKX2OS_cjs.requireAuth(), chunkFCLKX2OS_
1090
1090
  } catch (err) {
1091
1091
  return c.json({ error: "Write cancelled by plugin", details: String(err) }, 400);
1092
1092
  }
1093
- const docType = await new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db).findById(docRow.type_id);
1093
+ const docType = await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db).findById(docRow.type_id);
1094
1094
  const svc = new chunkLTZ5WYOK_cjs.DocumentsService(db, {
1095
1095
  queryableFields: docType?.queryableFields ?? [],
1096
1096
  typeSchemaVersion: docType?.schemaVersion ?? 1,
@@ -1113,7 +1113,7 @@ apiContentCrudRoutes.put("/:id", chunkFCLKX2OS_cjs.requireAuth(), chunkFCLKX2OS_
1113
1113
  const cache = chunk36Z3AKX3_cjs.getCacheService(chunk36Z3AKX3_cjs.CACHE_CONFIGS.api);
1114
1114
  await cache.invalidate("content-filtered:*");
1115
1115
  await cache.invalidate("collection-content-filtered:*");
1116
- const coll = chunkKVBHB7QP_cjs.getCollectionRegistry().getByName(docRow.type_id);
1116
+ const coll = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getByName(docRow.type_id);
1117
1117
  const saved = await db.prepare("SELECT * FROM documents WHERE id = ?").bind(newDraft.id).first();
1118
1118
  const savedData = saved?.data ? JSON.parse(saved.data) : {};
1119
1119
  dispatchHookEvent(c, "content:after:update", { collection: docRow.type_id, id, data: savedData, user: actor }, "fire-and-forget");
@@ -1134,7 +1134,7 @@ apiContentCrudRoutes.put("/:id", chunkFCLKX2OS_cjs.requireAuth(), chunkFCLKX2OS_
1134
1134
  }, 500);
1135
1135
  }
1136
1136
  });
1137
- apiContentCrudRoutes.delete("/:id", chunkFCLKX2OS_cjs.requireAuth(), chunkFCLKX2OS_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
1137
+ apiContentCrudRoutes.delete("/:id", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
1138
1138
  try {
1139
1139
  const id = c.req.param("id");
1140
1140
  const db = c.env.DB;
@@ -1260,7 +1260,7 @@ apiRoutes.use("*", async (c, next) => {
1260
1260
  c.header("X-Response-Time", `${totalTime}ms`);
1261
1261
  });
1262
1262
  apiRoutes.use("*", async (c, next) => {
1263
- const cacheEnabled = await chunkFCLKX2OS_cjs.isPluginActive(c.env.DB, "core-cache");
1263
+ const cacheEnabled = await chunkIS54FPB7_cjs.isPluginActive(c.env.DB, "core-cache");
1264
1264
  c.set("cacheEnabled", cacheEnabled);
1265
1265
  await next();
1266
1266
  });
@@ -1283,7 +1283,7 @@ apiRoutes.get("/", (c) => {
1283
1283
  openapi: "3.0.0",
1284
1284
  info: {
1285
1285
  title: "SonicJS AI API",
1286
- version: chunkAOUVUF32_cjs.getCoreVersion(),
1286
+ version: chunkC3ZQP5NW_cjs.getCoreVersion(),
1287
1287
  description: "RESTful API for SonicJS headless CMS - a modern, AI-powered content management system built on Cloudflare Workers",
1288
1288
  contact: {
1289
1289
  name: "SonicJS Support",
@@ -1713,8 +1713,8 @@ apiRoutes.get("/collections", async (c) => {
1713
1713
  }
1714
1714
  c.header("X-Cache-Status", "MISS");
1715
1715
  c.header("X-Cache-Source", "registry");
1716
- const records = chunkKVBHB7QP_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal);
1717
- const transformedResults = records.map(chunkKVBHB7QP_cjs.collectionRecordToRow);
1716
+ const records = chunkAT4ZQGEZ_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal);
1717
+ const transformedResults = records.map(chunkAT4ZQGEZ_cjs.collectionRecordToRow);
1718
1718
  const responseData = {
1719
1719
  data: transformedResults,
1720
1720
  meta: addTimingMeta(c, {
@@ -1735,7 +1735,7 @@ apiRoutes.get("/collections", async (c) => {
1735
1735
  return c.json({ error: "Failed to fetch collections" }, 500);
1736
1736
  }
1737
1737
  });
1738
- apiRoutes.get("/content", chunkFCLKX2OS_cjs.optionalAuth(), async (c) => {
1738
+ apiRoutes.get("/content", chunkIS54FPB7_cjs.optionalAuth(), async (c) => {
1739
1739
  const executionStart = Date.now();
1740
1740
  try {
1741
1741
  const db = c.env.DB;
@@ -1744,7 +1744,7 @@ apiRoutes.get("/content", chunkFCLKX2OS_cjs.optionalAuth(), async (c) => {
1744
1744
  const collIdByName = /* @__PURE__ */ new Map();
1745
1745
  let typeId;
1746
1746
  let typeIds;
1747
- const registry = chunkKVBHB7QP_cjs.getCollectionRegistry();
1747
+ const registry = chunkAT4ZQGEZ_cjs.getCollectionRegistry();
1748
1748
  if (queryParams.collection) {
1749
1749
  const collectionName = queryParams.collection;
1750
1750
  const record = registry.getByName(collectionName);
@@ -1843,13 +1843,13 @@ apiRoutes.get("/content", chunkFCLKX2OS_cjs.optionalAuth(), async (c) => {
1843
1843
  }, 500);
1844
1844
  }
1845
1845
  });
1846
- apiRoutes.get("/collections/:collection/content", chunkFCLKX2OS_cjs.optionalAuth(), async (c) => {
1846
+ apiRoutes.get("/collections/:collection/content", chunkIS54FPB7_cjs.optionalAuth(), async (c) => {
1847
1847
  const executionStart = Date.now();
1848
1848
  try {
1849
1849
  const collection = c.req.param("collection");
1850
1850
  const db = c.env.DB;
1851
1851
  const queryParams = c.req.query();
1852
- const record = chunkKVBHB7QP_cjs.getCollectionRegistry().getBySlugOrName(collection);
1852
+ const record = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getBySlugOrName(collection);
1853
1853
  if (!record || record.isActive === false) {
1854
1854
  return c.json({ error: "Collection not found" }, 404);
1855
1855
  }
@@ -1905,7 +1905,7 @@ apiRoutes.get("/collections/:collection/content", chunkFCLKX2OS_cjs.optionalAuth
1905
1905
  const responseData = {
1906
1906
  data: transformedResults,
1907
1907
  meta: addTimingMeta(c, {
1908
- ...includeCollection ? { collection: chunkKVBHB7QP_cjs.collectionRecordToRow(record) } : {},
1908
+ ...includeCollection ? { collection: chunkAT4ZQGEZ_cjs.collectionRecordToRow(record) } : {},
1909
1909
  count: results.length,
1910
1910
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1911
1911
  // D44: echo the caller's filter with the access policy applied (status=published forced for
@@ -1930,13 +1930,13 @@ apiRoutes.get("/collections/:collection/content", chunkFCLKX2OS_cjs.optionalAuth
1930
1930
  }
1931
1931
  });
1932
1932
  apiRoutes.route("/content", api_content_crud_default);
1933
- apiRoutes.get("/:collection", chunkFCLKX2OS_cjs.optionalAuth(), async (c) => {
1933
+ apiRoutes.get("/:collection", chunkIS54FPB7_cjs.optionalAuth(), async (c) => {
1934
1934
  const executionStart = Date.now();
1935
1935
  try {
1936
1936
  const collection = c.req.param("collection");
1937
1937
  const db = c.env.DB;
1938
1938
  const queryParams = c.req.query();
1939
- const record = chunkKVBHB7QP_cjs.getCollectionRegistry().getBySlugOrName(collection);
1939
+ const record = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getBySlugOrName(collection);
1940
1940
  if (!record || record.isActive === false) {
1941
1941
  return c.json({ error: "Collection not found" }, 404);
1942
1942
  }
@@ -1976,7 +1976,7 @@ apiRoutes.get("/:collection", chunkFCLKX2OS_cjs.optionalAuth(), async (c) => {
1976
1976
  const responseData = {
1977
1977
  data: transformedResults,
1978
1978
  meta: addTimingMeta(c, {
1979
- ...includeCollection ? { collection: chunkKVBHB7QP_cjs.collectionRecordToRow(record) } : {},
1979
+ ...includeCollection ? { collection: chunkAT4ZQGEZ_cjs.collectionRecordToRow(record) } : {},
1980
1980
  count: results.length,
1981
1981
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1982
1982
  filter: normalizePublicContentFilter(filter, role),
@@ -1994,12 +1994,12 @@ apiRoutes.get("/:collection", chunkFCLKX2OS_cjs.optionalAuth(), async (c) => {
1994
1994
  return c.json({ error: "Failed to fetch content", details: error instanceof Error ? error.message : String(error) }, 500);
1995
1995
  }
1996
1996
  });
1997
- apiRoutes.get("/:collection/:id", chunkFCLKX2OS_cjs.optionalAuth(), async (c) => {
1997
+ apiRoutes.get("/:collection/:id", chunkIS54FPB7_cjs.optionalAuth(), async (c) => {
1998
1998
  try {
1999
1999
  const collection = c.req.param("collection");
2000
2000
  const id = c.req.param("id");
2001
2001
  const db = c.env.DB;
2002
- const record = chunkKVBHB7QP_cjs.getCollectionRegistry().getBySlugOrName(collection);
2002
+ const record = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getBySlugOrName(collection);
2003
2003
  if (!record || record.isActive === false) {
2004
2004
  return c.json({ error: "Collection not found" }, 404);
2005
2005
  }
@@ -2008,7 +2008,7 @@ apiRoutes.get("/:collection/:id", chunkFCLKX2OS_cjs.optionalAuth(), async (c) =>
2008
2008
  privileged ? "SELECT * FROM documents WHERE root_id = ? AND type_id = ? AND tenant_id = 'default' AND is_current_draft = 1 AND deleted_at IS NULL" : "SELECT * FROM documents WHERE root_id = ? AND type_id = ? AND tenant_id = 'default' AND is_published = 1 AND deleted_at IS NULL"
2009
2009
  ).bind(id, record.name).first();
2010
2010
  if (!docRow) return c.json({ error: "Content not found" }, 404);
2011
- const coll = chunkKVBHB7QP_cjs.getCollectionRegistry().getByName(docRow.type_id);
2011
+ const coll = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getByName(docRow.type_id);
2012
2012
  const transformedContent = {
2013
2013
  id: docRow.root_id,
2014
2014
  title: docRow.title,
@@ -2026,7 +2026,7 @@ apiRoutes.get("/:collection/:id", chunkFCLKX2OS_cjs.optionalAuth(), async (c) =>
2026
2026
  return c.json({ error: "Failed to fetch content", details: error instanceof Error ? error.message : String(error) }, 500);
2027
2027
  }
2028
2028
  });
2029
- apiRoutes.post("/:collection", chunkFCLKX2OS_cjs.requireAuth(), chunkFCLKX2OS_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
2029
+ apiRoutes.post("/:collection", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
2030
2030
  try {
2031
2031
  const collection = c.req.param("collection");
2032
2032
  const db = c.env.DB;
@@ -2059,14 +2059,14 @@ apiRoutes.post("/:collection", chunkFCLKX2OS_cjs.requireAuth(), chunkFCLKX2OS_cj
2059
2059
  return c.json({ error: "Failed to create content", details: error instanceof Error ? error.message : String(error) }, 500);
2060
2060
  }
2061
2061
  });
2062
- apiRoutes.put("/:collection/:id", chunkFCLKX2OS_cjs.requireAuth(), chunkFCLKX2OS_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
2062
+ apiRoutes.put("/:collection/:id", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
2063
2063
  try {
2064
2064
  const collection = c.req.param("collection");
2065
2065
  const id = c.req.param("id");
2066
2066
  const db = c.env.DB;
2067
2067
  const user = c.get("user");
2068
2068
  const body = await c.req.json();
2069
- const collRecord = chunkKVBHB7QP_cjs.getCollectionRegistry().getBySlugOrName(collection);
2069
+ const collRecord = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getBySlugOrName(collection);
2070
2070
  const typeName = collRecord?.name ?? collection;
2071
2071
  const docRow = await db.prepare("SELECT root_id, type_id FROM documents WHERE root_id = ? AND type_id = ? AND tenant_id = 'default' AND is_current_draft = 1 AND deleted_at IS NULL").bind(id, typeName).first();
2072
2072
  if (!docRow) return c.json({ error: "Content not found" }, 404);
@@ -2078,7 +2078,7 @@ apiRoutes.put("/:collection/:id", chunkFCLKX2OS_cjs.requireAuth(), chunkFCLKX2OS
2078
2078
  } catch (err) {
2079
2079
  return c.json({ error: "Write cancelled by plugin", details: String(err) }, 400);
2080
2080
  }
2081
- const docType = await new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db).findById(docRow.type_id);
2081
+ const docType = await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db).findById(docRow.type_id);
2082
2082
  const svc = new chunkLTZ5WYOK_cjs.DocumentsService(db, { queryableFields: docType?.queryableFields ?? [], typeSchemaVersion: docType?.schemaVersion ?? 1, maxVersionsPerRoot: docType?.settings?.maxVersionsPerRoot ?? 50, tenantId: "default", versioning: docType?.settings?.versioning ?? false });
2083
2083
  const input = {};
2084
2084
  if (body.title !== void 0) input.title = body.title;
@@ -2095,7 +2095,7 @@ apiRoutes.put("/:collection/:id", chunkFCLKX2OS_cjs.requireAuth(), chunkFCLKX2OS
2095
2095
  const cache = chunk36Z3AKX3_cjs.getCacheService(chunk36Z3AKX3_cjs.CACHE_CONFIGS.api);
2096
2096
  await cache.invalidate("content-filtered:*");
2097
2097
  await cache.invalidate("collection-content-filtered:*");
2098
- const coll = chunkKVBHB7QP_cjs.getCollectionRegistry().getByName(docRow.type_id);
2098
+ const coll = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getByName(docRow.type_id);
2099
2099
  const saved = await db.prepare("SELECT * FROM documents WHERE id = ?").bind(newDraft.id).first();
2100
2100
  const savedData = saved?.data ? JSON.parse(saved.data) : {};
2101
2101
  dispatchHookEvent(c, "content:after:update", { collection: docRow.type_id, id, data: savedData, user: actor }, "fire-and-forget");
@@ -2107,13 +2107,13 @@ apiRoutes.put("/:collection/:id", chunkFCLKX2OS_cjs.requireAuth(), chunkFCLKX2OS
2107
2107
  return c.json({ error: "Failed to update content", details: error instanceof Error ? error.message : String(error) }, 500);
2108
2108
  }
2109
2109
  });
2110
- apiRoutes.delete("/:collection/:id", chunkFCLKX2OS_cjs.requireAuth(), chunkFCLKX2OS_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
2110
+ apiRoutes.delete("/:collection/:id", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
2111
2111
  try {
2112
2112
  const collection = c.req.param("collection");
2113
2113
  const id = c.req.param("id");
2114
2114
  const db = c.env.DB;
2115
2115
  const user = c.get("user");
2116
- const collRecord = chunkKVBHB7QP_cjs.getCollectionRegistry().getBySlugOrName(collection);
2116
+ const collRecord = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getBySlugOrName(collection);
2117
2117
  const typeName = collRecord?.name ?? collection;
2118
2118
  const docRow = await db.prepare("SELECT type_id FROM documents WHERE root_id = ? AND type_id = ? AND tenant_id = 'default' AND deleted_at IS NULL LIMIT 1").bind(id, typeName).first();
2119
2119
  if (!docRow) return c.json({ error: "Content not found" }, 404);
@@ -2335,7 +2335,7 @@ var fileValidationSchema = zod.z.object({
2335
2335
  // 50MB max
2336
2336
  });
2337
2337
  var apiMediaRoutes = new hono.Hono();
2338
- apiMediaRoutes.use("*", chunkFCLKX2OS_cjs.requireAuth());
2338
+ apiMediaRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
2339
2339
  apiMediaRoutes.post("/upload", async (c) => {
2340
2340
  try {
2341
2341
  const user = c.get("user");
@@ -3033,7 +3033,7 @@ apiSystemRoutes.get("/info", (c) => {
3033
3033
  apiSystemRoutes.get("/stats", async (c) => {
3034
3034
  try {
3035
3035
  const db = c.env.DB;
3036
- const typeIds = chunkKVBHB7QP_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => r.name);
3036
+ const typeIds = chunkAT4ZQGEZ_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => r.name);
3037
3037
  let contentStats = null;
3038
3038
  if (typeIds.length > 0) {
3039
3039
  const placeholders = typeIds.map(() => "?").join(",");
@@ -3108,12 +3108,12 @@ apiSystemRoutes.get("/env", (c) => {
3108
3108
  });
3109
3109
  var api_system_default = apiSystemRoutes;
3110
3110
  var adminApiRoutes = new hono.Hono();
3111
- adminApiRoutes.use("*", chunkFCLKX2OS_cjs.requireAuth());
3112
- adminApiRoutes.use("*", chunkFCLKX2OS_cjs.requireRole(["admin", "editor"]));
3111
+ adminApiRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
3112
+ adminApiRoutes.use("*", chunkIS54FPB7_cjs.requireRole(["admin", "editor"]));
3113
3113
  adminApiRoutes.get("/stats", async (c) => {
3114
3114
  try {
3115
3115
  const db = c.env.DB;
3116
- const userCollections = chunkKVBHB7QP_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal);
3116
+ const userCollections = chunkAT4ZQGEZ_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal);
3117
3117
  const collectionsCount = userCollections.length;
3118
3118
  let contentCount = 0;
3119
3119
  if (userCollections.length > 0) {
@@ -3204,7 +3204,7 @@ adminApiRoutes.get("/collections", async (c) => {
3204
3204
  try {
3205
3205
  const search = c.req.query("search") || "";
3206
3206
  const includeInactive = c.req.query("includeInactive") === "true";
3207
- let records = chunkKVBHB7QP_cjs.getCollectionRegistry().list().filter((r) => !r.internal);
3207
+ let records = chunkAT4ZQGEZ_cjs.getCollectionRegistry().list().filter((r) => !r.internal);
3208
3208
  if (!includeInactive) records = records.filter((r) => r.isActive !== false);
3209
3209
  if (search) {
3210
3210
  const needle = search.toLowerCase();
@@ -3236,7 +3236,7 @@ adminApiRoutes.get("/collections", async (c) => {
3236
3236
  adminApiRoutes.get("/collections/:id", async (c) => {
3237
3237
  try {
3238
3238
  const id = c.req.param("id");
3239
- const registry = chunkKVBHB7QP_cjs.getCollectionRegistry();
3239
+ const registry = chunkAT4ZQGEZ_cjs.getCollectionRegistry();
3240
3240
  const record = registry.getById(id) ?? registry.getByName(id);
3241
3241
  if (!record) {
3242
3242
  return c.json({ error: "Collection not found" }, 404);
@@ -3286,7 +3286,7 @@ adminApiRoutes.get("/references", async (c) => {
3286
3286
  if (collectionParams.length === 0) {
3287
3287
  return c.json({ error: "Collection is required" }, 400);
3288
3288
  }
3289
- const registry = chunkKVBHB7QP_cjs.getCollectionRegistry();
3289
+ const registry = chunkAT4ZQGEZ_cjs.getCollectionRegistry();
3290
3290
  const matched = collectionParams.map((param) => registry.getById(param) ?? registry.getByName(param)).filter((r) => !!r);
3291
3291
  const seen = /* @__PURE__ */ new Set();
3292
3292
  const collections = matched.filter((r) => {
@@ -3401,7 +3401,7 @@ adminApiRoutes.patch("/collections/:id", collectionsReadOnly);
3401
3401
  adminApiRoutes.delete("/collections/:id", collectionsReadOnly);
3402
3402
  adminApiRoutes.get("/migrations/status", async (c) => {
3403
3403
  try {
3404
- const { MigrationService: MigrationService2 } = await import('./migrations-V73ARYV5.cjs');
3404
+ const { MigrationService: MigrationService2 } = await import('./migrations-ZD7Y5NUC.cjs');
3405
3405
  const db = c.env.DB;
3406
3406
  const migrationService = new MigrationService2(db);
3407
3407
  const status = await migrationService.getMigrationStatus();
@@ -3444,7 +3444,7 @@ adminApiRoutes.post("/migrations/run", async (c) => {
3444
3444
  });
3445
3445
  adminApiRoutes.get("/migrations/validate", async (c) => {
3446
3446
  try {
3447
- const { MigrationService: MigrationService2 } = await import('./migrations-V73ARYV5.cjs');
3447
+ const { MigrationService: MigrationService2 } = await import('./migrations-ZD7Y5NUC.cjs');
3448
3448
  const db = c.env.DB;
3449
3449
  const migrationService = new MigrationService2(db);
3450
3450
  const validation = await migrationService.validateSchema();
@@ -3594,8 +3594,8 @@ function renderLoginPage(data, demoLoginActive = false) {
3594
3594
  <div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
3595
3595
  <div class="bg-zinc-900 shadow-sm ring-1 ring-white/10 rounded-xl px-6 py-8 sm:px-10">
3596
3596
  <!-- Alerts -->
3597
- ${data.error ? `<div class="mb-6">${chunkPXNTCCPE_cjs.renderAlert({ type: "error", message: data.error })}</div>` : ""}
3598
- ${data.message ? `<div class="mb-6">${chunkPXNTCCPE_cjs.renderAlert({ type: "success", message: data.message })}</div>` : ""}
3597
+ ${data.error ? `<div class="mb-6">${chunkE66UVONV_cjs.renderAlert({ type: "error", message: data.error })}</div>` : ""}
3598
+ ${data.message ? `<div class="mb-6">${chunkE66UVONV_cjs.renderAlert({ type: "success", message: data.message })}</div>` : ""}
3599
3599
 
3600
3600
  <!-- Form Response (HTMX target) -->
3601
3601
  <div id="form-response" class="mb-6"></div>
@@ -3759,7 +3759,7 @@ function renderRegisterPage(data) {
3759
3759
  <div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
3760
3760
  <div class="bg-zinc-900 shadow-sm ring-1 ring-white/10 rounded-xl px-6 py-8 sm:px-10">
3761
3761
  <!-- Alerts -->
3762
- ${data.error ? `<div class="mb-6">${chunkPXNTCCPE_cjs.renderAlert({ type: "error", message: data.error })}</div>` : ""}
3762
+ ${data.error ? `<div class="mb-6">${chunkE66UVONV_cjs.renderAlert({ type: "error", message: data.error })}</div>` : ""}
3763
3763
 
3764
3764
  <!-- Form -->
3765
3765
  <form
@@ -3859,7 +3859,7 @@ function renderRegisterPage(data) {
3859
3859
  }
3860
3860
 
3861
3861
  // src/services/email/email-service-singleton.ts
3862
- var singleton = chunkA4KUJ3LD_cjs.createServiceSingleton("EmailService");
3862
+ var singleton = chunk4WMZGHIC_cjs.createServiceSingleton("EmailService");
3863
3863
  function setEmailService(service2) {
3864
3864
  singleton.set(service2);
3865
3865
  }
@@ -4667,7 +4667,7 @@ function getLexicalInitScript(settings = {}) {
4667
4667
  </script>
4668
4668
  `;
4669
4669
  }
4670
- var lexicalEditorPlugin = chunkA4KUJ3LD_cjs.definePlugin({
4670
+ var lexicalEditorPlugin = chunk4WMZGHIC_cjs.definePlugin({
4671
4671
  id: "lexical-editor",
4672
4672
  version: "1.0.0",
4673
4673
  name: "Lexical Editor",
@@ -7073,7 +7073,7 @@ api.put("/:userId", async (c) => {
7073
7073
  await saveCustomData(db, userId, sanitized);
7074
7074
  return c.json({ success: true });
7075
7075
  });
7076
- var userProfilesPlugin = chunkA4KUJ3LD_cjs.definePlugin({
7076
+ var userProfilesPlugin = chunk4WMZGHIC_cjs.definePlugin({
7077
7077
  id: "user-profiles",
7078
7078
  version: "1.0.0",
7079
7079
  name: "User Profiles",
@@ -7111,8 +7111,8 @@ function renderPasswordResetEmail(resetLink, firstName) {
7111
7111
  async function setCsrfCookie(c, maxAge) {
7112
7112
  const secret = c.env?.JWT_SECRET || JWT_SECRET_FALLBACK;
7113
7113
  const isDev = c.env?.ENVIRONMENT === "development" || !c.env?.ENVIRONMENT;
7114
- const csrfToken = await chunkFCLKX2OS_cjs.generateCsrfToken(secret);
7115
- const cookieMaxAge = await chunkFCLKX2OS_cjs.getJwtExpirySecondsFromDb(c.env?.DB, c.env);
7114
+ const csrfToken = await chunkIS54FPB7_cjs.generateCsrfToken(secret);
7115
+ const cookieMaxAge = await chunkIS54FPB7_cjs.getJwtExpirySecondsFromDb(c.env?.DB, c.env);
7116
7116
  cookie.setCookie(c, "csrf_token", csrfToken, {
7117
7117
  httpOnly: false,
7118
7118
  secure: !isDev,
@@ -7171,7 +7171,7 @@ var loginSchema = zod.z.object({
7171
7171
  });
7172
7172
  authRoutes.post(
7173
7173
  "/register",
7174
- chunkFCLKX2OS_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "register" }),
7174
+ chunkIS54FPB7_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "register" }),
7175
7175
  async (c) => {
7176
7176
  try {
7177
7177
  const db = c.env.DB;
@@ -7207,7 +7207,7 @@ authRoutes.post(
7207
7207
  if (existingUser) {
7208
7208
  return c.json({ error: "User with this email already exists" }, 400);
7209
7209
  }
7210
- const passwordHash = await chunkFCLKX2OS_cjs.AuthManager.hashPassword(password);
7210
+ const passwordHash = await chunkIS54FPB7_cjs.AuthManager.hashPassword(password);
7211
7211
  const userId = crypto.randomUUID();
7212
7212
  const now = /* @__PURE__ */ new Date();
7213
7213
  const nowSec = Math.floor(now.getTime() / 1e3);
@@ -7240,8 +7240,8 @@ authRoutes.post(
7240
7240
  { user: { id: userId, email: normalizedEmail, role: "viewer" } },
7241
7241
  "fire-and-forget"
7242
7242
  );
7243
- const tokenTtl = await chunkFCLKX2OS_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
7244
- const token = await chunkFCLKX2OS_cjs.AuthManager.generateToken(userId, normalizedEmail, "viewer", c.env.JWT_SECRET, tokenTtl);
7243
+ const tokenTtl = await chunkIS54FPB7_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
7244
+ const token = await chunkIS54FPB7_cjs.AuthManager.generateToken(userId, normalizedEmail, "viewer", c.env.JWT_SECRET, tokenTtl);
7245
7245
  cookie.setCookie(c, "auth_token", token, {
7246
7246
  httpOnly: true,
7247
7247
  secure: true,
@@ -7273,7 +7273,7 @@ authRoutes.post(
7273
7273
  );
7274
7274
  authRoutes.post(
7275
7275
  "/login",
7276
- chunkFCLKX2OS_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "login" }),
7276
+ chunkIS54FPB7_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "login" }),
7277
7277
  async (c) => {
7278
7278
  try {
7279
7279
  const body = await c.req.json();
@@ -7305,8 +7305,8 @@ authRoutes.post(
7305
7305
  await setCsrfCookie(c);
7306
7306
  const baBody = await baRes.json();
7307
7307
  const user = baBody.user ?? {};
7308
- const tokenTtl = await chunkFCLKX2OS_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
7309
- const token = await chunkFCLKX2OS_cjs.AuthManager.generateToken(
7308
+ const tokenTtl = await chunkIS54FPB7_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
7309
+ const token = await chunkIS54FPB7_cjs.AuthManager.generateToken(
7310
7310
  user.id,
7311
7311
  user.email,
7312
7312
  user.role ?? "viewer",
@@ -7367,7 +7367,7 @@ authRoutes.get("/logout", async (c) => {
7367
7367
  clearCsrfCookie(c);
7368
7368
  return c.redirect("/auth/login?message=You have been logged out successfully");
7369
7369
  });
7370
- authRoutes.get("/me", chunkFCLKX2OS_cjs.requireAuth(), async (c) => {
7370
+ authRoutes.get("/me", chunkIS54FPB7_cjs.requireAuth(), async (c) => {
7371
7371
  try {
7372
7372
  const user = c.get("user");
7373
7373
  if (!user) {
@@ -7387,7 +7387,7 @@ authRoutes.get("/me", chunkFCLKX2OS_cjs.requireAuth(), async (c) => {
7387
7387
  });
7388
7388
  authRoutes.post(
7389
7389
  "/refresh",
7390
- chunkFCLKX2OS_cjs.rateLimit({ max: 60, windowMs: 60 * 1e3, keyPrefix: "refresh" }),
7390
+ chunkIS54FPB7_cjs.rateLimit({ max: 60, windowMs: 60 * 1e3, keyPrefix: "refresh" }),
7391
7391
  async (c) => {
7392
7392
  try {
7393
7393
  let token = c.req.header("Authorization")?.replace("Bearer ", "");
@@ -7396,8 +7396,8 @@ authRoutes.post(
7396
7396
  return c.json({ error: "Authentication required" }, 401);
7397
7397
  }
7398
7398
  const db = c.env.DB;
7399
- const grace = await chunkFCLKX2OS_cjs.getJwtRefreshGraceSecondsFromDb(db, c.env);
7400
- const payload = await chunkFCLKX2OS_cjs.AuthManager.verifyToken(token, c.env.JWT_SECRET, grace);
7399
+ const grace = await chunkIS54FPB7_cjs.getJwtRefreshGraceSecondsFromDb(db, c.env);
7400
+ const payload = await chunkIS54FPB7_cjs.AuthManager.verifyToken(token, c.env.JWT_SECRET, grace);
7401
7401
  if (!payload) {
7402
7402
  return c.json({ error: "Invalid or expired token" }, 401);
7403
7403
  }
@@ -7405,8 +7405,8 @@ authRoutes.post(
7405
7405
  if (!row || !row.is_active) {
7406
7406
  return c.json({ error: "User is not active" }, 401);
7407
7407
  }
7408
- const tokenTtl = await chunkFCLKX2OS_cjs.getJwtExpirySecondsFromDb(db, c.env);
7409
- const newToken = await chunkFCLKX2OS_cjs.AuthManager.generateToken(row.id, row.email, row.role, c.env.JWT_SECRET, tokenTtl);
7408
+ const tokenTtl = await chunkIS54FPB7_cjs.getJwtExpirySecondsFromDb(db, c.env);
7409
+ const newToken = await chunkIS54FPB7_cjs.AuthManager.generateToken(row.id, row.email, row.role, c.env.JWT_SECRET, tokenTtl);
7410
7410
  cookie.setCookie(c, "auth_token", newToken, {
7411
7411
  httpOnly: true,
7412
7412
  secure: true,
@@ -7426,7 +7426,7 @@ authRoutes.post(
7426
7426
  );
7427
7427
  authRoutes.post(
7428
7428
  "/register/form",
7429
- chunkFCLKX2OS_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "register" }),
7429
+ chunkIS54FPB7_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "register" }),
7430
7430
  async (c) => {
7431
7431
  try {
7432
7432
  const db = c.env.DB;
@@ -7471,7 +7471,7 @@ authRoutes.post(
7471
7471
  </div>
7472
7472
  `);
7473
7473
  }
7474
- const passwordHash = await chunkFCLKX2OS_cjs.AuthManager.hashPassword(password);
7474
+ const passwordHash = await chunkIS54FPB7_cjs.AuthManager.hashPassword(password);
7475
7475
  const role = isFirstUser ? "admin" : "viewer";
7476
7476
  const userId = crypto.randomUUID();
7477
7477
  const now = /* @__PURE__ */ new Date();
@@ -7513,8 +7513,8 @@ authRoutes.post(
7513
7513
  { user: { id: userId, email: normalizedEmail, role } },
7514
7514
  "fire-and-forget"
7515
7515
  );
7516
- const tokenTtl = await chunkFCLKX2OS_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
7517
- const token = await chunkFCLKX2OS_cjs.AuthManager.generateToken(userId, normalizedEmail, role, c.env.JWT_SECRET, tokenTtl);
7516
+ const tokenTtl = await chunkIS54FPB7_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
7517
+ const token = await chunkIS54FPB7_cjs.AuthManager.generateToken(userId, normalizedEmail, role, c.env.JWT_SECRET, tokenTtl);
7518
7518
  cookie.setCookie(c, "auth_token", token, {
7519
7519
  httpOnly: true,
7520
7520
  secure: false,
@@ -7546,7 +7546,7 @@ authRoutes.post(
7546
7546
  );
7547
7547
  authRoutes.post(
7548
7548
  "/login/form",
7549
- chunkFCLKX2OS_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "login" }),
7549
+ chunkIS54FPB7_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "login" }),
7550
7550
  async (c) => {
7551
7551
  try {
7552
7552
  const formData = await c.req.formData();
@@ -7615,14 +7615,14 @@ authRoutes.post(
7615
7615
  );
7616
7616
  authRoutes.post(
7617
7617
  "/seed-admin",
7618
- chunkFCLKX2OS_cjs.rateLimit({ max: 10, windowMs: 60 * 1e3, keyPrefix: "seed-admin" }),
7618
+ chunkIS54FPB7_cjs.rateLimit({ max: 10, windowMs: 60 * 1e3, keyPrefix: "seed-admin" }),
7619
7619
  async (c) => {
7620
7620
  try {
7621
7621
  const db = c.env.DB;
7622
7622
  const rbac = new chunkLTZ5WYOK_cjs.RbacService(db);
7623
7623
  const results = [];
7624
7624
  const upsertSeedUser = async (opts) => {
7625
- const passwordHash = await chunkFCLKX2OS_cjs.AuthManager.hashPassword(opts.password);
7625
+ const passwordHash = await chunkIS54FPB7_cjs.AuthManager.hashPassword(opts.password);
7626
7626
  const nowMs = Date.now();
7627
7627
  const nowSec = Math.floor(nowMs / 1e3);
7628
7628
  const existing = await db.prepare("SELECT id FROM auth_user WHERE email = ?").bind(opts.email).first();
@@ -7847,7 +7847,7 @@ authRoutes.post("/accept-invitation", async (c) => {
7847
7847
  if (invitationAge > maxAge) {
7848
7848
  return c.json({ error: "Invitation has expired" }, 400);
7849
7849
  }
7850
- const passwordHash = await chunkFCLKX2OS_cjs.AuthManager.hashPassword(password);
7850
+ const passwordHash = await chunkIS54FPB7_cjs.AuthManager.hashPassword(password);
7851
7851
  const updateStmt = db.prepare(`
7852
7852
  UPDATE auth_user SET
7853
7853
  password_hash = ?,
@@ -7864,8 +7864,8 @@ authRoutes.post("/accept-invitation", async (c) => {
7864
7864
  Date.now(),
7865
7865
  invitedUser.id
7866
7866
  ).run();
7867
- const tokenTtl = await chunkFCLKX2OS_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
7868
- const authToken = await chunkFCLKX2OS_cjs.AuthManager.generateToken(invitedUser.id, invitedUser.email, invitedUser.role, c.env.JWT_SECRET, tokenTtl);
7867
+ const tokenTtl = await chunkIS54FPB7_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
7868
+ const authToken = await chunkIS54FPB7_cjs.AuthManager.generateToken(invitedUser.id, invitedUser.email, invitedUser.role, c.env.JWT_SECRET, tokenTtl);
7869
7869
  cookie.setCookie(c, "auth_token", authToken, {
7870
7870
  httpOnly: true,
7871
7871
  secure: true,
@@ -7881,7 +7881,7 @@ authRoutes.post("/accept-invitation", async (c) => {
7881
7881
  });
7882
7882
  authRoutes.post(
7883
7883
  "/request-password-reset",
7884
- chunkFCLKX2OS_cjs.rateLimit({ max: 3, windowMs: 15 * 60 * 1e3, keyPrefix: "password-reset" }),
7884
+ chunkIS54FPB7_cjs.rateLimit({ max: 3, windowMs: 15 * 60 * 1e3, keyPrefix: "password-reset" }),
7885
7885
  async (c) => {
7886
7886
  try {
7887
7887
  const formData = await c.req.formData();
@@ -8118,7 +8118,7 @@ authRoutes.post("/reset-password", async (c) => {
8118
8118
  if (Date.now() > user.password_reset_expires) {
8119
8119
  return c.json({ error: "Reset token has expired" }, 400);
8120
8120
  }
8121
- const newPasswordHash = await chunkFCLKX2OS_cjs.AuthManager.hashPassword(password);
8121
+ const newPasswordHash = await chunkIS54FPB7_cjs.AuthManager.hashPassword(password);
8122
8122
  try {
8123
8123
  const historyStmt = db.prepare(`
8124
8124
  INSERT INTO auth_password_history (id, user_id, password_hash, created_at)
@@ -8332,7 +8332,7 @@ app.post("/test-seed-defaults", async (c) => {
8332
8332
  var test_cleanup_default = app;
8333
8333
 
8334
8334
  // src/plugins/available/easy-mdx/index.ts
8335
- chunkA4KUJ3LD_cjs.definePlugin({
8335
+ chunk4WMZGHIC_cjs.definePlugin({
8336
8336
  id: "easy-mdx",
8337
8337
  version: "1.0.0",
8338
8338
  name: "EasyMDE Markdown Editor",
@@ -8532,7 +8532,7 @@ function getMDXEditorInitScript(config) {
8532
8532
  }
8533
8533
 
8534
8534
  // src/plugins/available/tinymce-plugin/index.ts
8535
- chunkA4KUJ3LD_cjs.definePlugin({
8535
+ chunk4WMZGHIC_cjs.definePlugin({
8536
8536
  id: "tinymce-plugin",
8537
8537
  version: "1.0.0",
8538
8538
  name: "TinyMCE",
@@ -8802,7 +8802,7 @@ function getQuillCDN(version = "2.0.2") {
8802
8802
  </style>
8803
8803
  `;
8804
8804
  }
8805
- chunkA4KUJ3LD_cjs.definePlugin({
8805
+ chunk4WMZGHIC_cjs.definePlugin({
8806
8806
  id: "quill-editor",
8807
8807
  version: "1.0.0",
8808
8808
  name: "Quill Editor",
@@ -8814,7 +8814,7 @@ chunkA4KUJ3LD_cjs.definePlugin({
8814
8814
  });
8815
8815
 
8816
8816
  // src/templates/pages/admin-content-form.template.ts
8817
- chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
8817
+ chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
8818
8818
  function renderContentFormPage(data, opts) {
8819
8819
  const isEdit = data.isEdit || !!data.id;
8820
8820
  const title = isEdit ? `Edit: ${data.title || "Content"}` : `New ${data.collection.display_name}`;
@@ -8896,8 +8896,8 @@ function renderContentFormPage(data, opts) {
8896
8896
  <!-- Form Content -->
8897
8897
  <div class="px-6 py-6">
8898
8898
  <div id="form-messages">
8899
- ${data.error ? chunkPXNTCCPE_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
8900
- ${data.success ? chunkPXNTCCPE_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
8899
+ ${data.error ? chunkE66UVONV_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
8900
+ ${data.success ? chunkE66UVONV_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
8901
8901
  </div>
8902
8902
 
8903
8903
  <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
@@ -9133,7 +9133,7 @@ function renderContentFormPage(data, opts) {
9133
9133
  </div>
9134
9134
 
9135
9135
  <!-- Confirmation Dialogs -->
9136
- ${chunkPXNTCCPE_cjs.renderConfirmationDialog({
9136
+ ${chunkE66UVONV_cjs.renderConfirmationDialog({
9137
9137
  id: "duplicate-content-confirm",
9138
9138
  title: "Duplicate Content",
9139
9139
  message: "Create a copy of this content?",
@@ -9144,7 +9144,7 @@ function renderContentFormPage(data, opts) {
9144
9144
  onConfirm: "performDuplicateContent()"
9145
9145
  })}
9146
9146
 
9147
- ${chunkPXNTCCPE_cjs.renderConfirmationDialog({
9147
+ ${chunkE66UVONV_cjs.renderConfirmationDialog({
9148
9148
  id: "delete-content-confirm",
9149
9149
  title: "Delete Content",
9150
9150
  message: "Are you sure you want to delete this content? This action cannot be undone.",
@@ -9155,7 +9155,7 @@ function renderContentFormPage(data, opts) {
9155
9155
  onConfirm: `performDeleteContent('${data.id}')`
9156
9156
  })}
9157
9157
 
9158
- ${chunkPXNTCCPE_cjs.renderConfirmationDialog({
9158
+ ${chunkE66UVONV_cjs.renderConfirmationDialog({
9159
9159
  id: "delete-repeater-item-confirm",
9160
9160
  title: "Delete Item",
9161
9161
  message: "Are you sure you want to delete this item? This action cannot be undone.",
@@ -9166,7 +9166,7 @@ function renderContentFormPage(data, opts) {
9166
9166
  onConfirm: "performRepeaterDelete()"
9167
9167
  })}
9168
9168
 
9169
- ${chunkPXNTCCPE_cjs.renderConfirmationDialog({
9169
+ ${chunkE66UVONV_cjs.renderConfirmationDialog({
9170
9170
  id: "delete-block-confirm",
9171
9171
  title: "Delete Block",
9172
9172
  message: "Are you sure you want to delete this block? This action cannot be undone.",
@@ -9177,7 +9177,7 @@ function renderContentFormPage(data, opts) {
9177
9177
  onConfirm: "performRepeaterDelete()"
9178
9178
  })}
9179
9179
 
9180
- ${chunkPXNTCCPE_cjs.getConfirmationDialogScript()}
9180
+ ${chunkE66UVONV_cjs.getConfirmationDialogScript()}
9181
9181
 
9182
9182
  ${data.lexicalEnabled ? getLexicalStyles() : "<!-- Lexical plugin not active -->"}
9183
9183
 
@@ -10263,11 +10263,11 @@ function renderContentFormPage(data, opts) {
10263
10263
  content: pageContent,
10264
10264
  version: data.version
10265
10265
  };
10266
- return chunkK623Q6WD_cjs.renderAdminLayoutCatalyst(layoutData);
10266
+ return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
10267
10267
  }
10268
10268
 
10269
10269
  // src/templates/pages/admin-content-list.template.ts
10270
- chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
10270
+ chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
10271
10271
  function renderContentListPage(data) {
10272
10272
  const urlParams = new URLSearchParams();
10273
10273
  if (data.modelName && data.modelName !== "all") urlParams.set("model", data.modelName);
@@ -10701,8 +10701,8 @@ function renderContentListPage(data) {
10701
10701
 
10702
10702
  <!-- Content List -->
10703
10703
  <div id="content-list">
10704
- ${chunkPXNTCCPE_cjs.renderTable(tableData)}
10705
- ${chunkPXNTCCPE_cjs.renderPagination(paginationData)}
10704
+ ${chunkE66UVONV_cjs.renderTable(tableData)}
10705
+ ${chunkE66UVONV_cjs.renderPagination(paginationData)}
10706
10706
  </div>
10707
10707
 
10708
10708
  </div>
@@ -10912,7 +10912,7 @@ function renderContentListPage(data) {
10912
10912
  </script>
10913
10913
 
10914
10914
  <!-- Confirmation Dialog for Bulk Actions -->
10915
- ${chunkPXNTCCPE_cjs.renderConfirmationDialog({
10915
+ ${chunkE66UVONV_cjs.renderConfirmationDialog({
10916
10916
  id: "bulk-action-confirm",
10917
10917
  title: "Confirm Bulk Action",
10918
10918
  message: "Are you sure you want to perform this action? This operation will affect multiple items.",
@@ -10924,7 +10924,7 @@ function renderContentListPage(data) {
10924
10924
  })}
10925
10925
 
10926
10926
  <!-- Confirmation Dialog Script -->
10927
- ${chunkPXNTCCPE_cjs.getConfirmationDialogScript()}
10927
+ ${chunkE66UVONV_cjs.getConfirmationDialogScript()}
10928
10928
 
10929
10929
  <!-- Advanced Search Modal -->
10930
10930
  <div id="advancedSearchModal" class="hidden fixed inset-0 z-50 overflow-y-auto" aria-labelledby="modal-title" role="dialog" aria-modal="true">
@@ -11221,7 +11221,7 @@ function renderContentListPage(data) {
11221
11221
  version: data.version,
11222
11222
  content: pageContent
11223
11223
  };
11224
- return chunkK623Q6WD_cjs.renderAdminLayoutCatalyst(layoutData);
11224
+ return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
11225
11225
  }
11226
11226
 
11227
11227
  // src/routes/admin-content-field-types.ts
@@ -11376,7 +11376,7 @@ function extractFieldData(fields, formData, options = {}) {
11376
11376
  }
11377
11377
  return { data, errors };
11378
11378
  }
11379
- adminContentRoutes.use("*", chunkFCLKX2OS_cjs.requireAuth());
11379
+ adminContentRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
11380
11380
  async function getCollectionFields(db, collectionId) {
11381
11381
  console.log(`[getCollectionFields] Loading fields for collection: ${collectionId}`);
11382
11382
  const collectionStmt = db.prepare("SELECT schema, queryable_fields FROM document_types WHERE id = ?");
@@ -11403,7 +11403,7 @@ async function getCollectionFields(db, collectionId) {
11403
11403
  };
11404
11404
  });
11405
11405
  }
11406
- const codeCollections2 = await chunkKVBHB7QP_cjs.loadCollectionConfigs();
11406
+ const codeCollections2 = await chunkAT4ZQGEZ_cjs.loadCollectionConfigs();
11407
11407
  const codeMatch = codeCollections2.find((c) => c.name === collectionId);
11408
11408
  if (codeMatch && codeMatch.schema?.properties) {
11409
11409
  console.log(`[getCollectionFields] DB doc type has no properties \u2014 using code collection schema`);
@@ -11435,7 +11435,7 @@ async function getCollectionFields(db, collectionId) {
11435
11435
  }
11436
11436
  }
11437
11437
  console.log(`[getCollectionFields] Not in database, checking code collections`);
11438
- const codeCollections = await chunkKVBHB7QP_cjs.loadCollectionConfigs();
11438
+ const codeCollections = await chunkAT4ZQGEZ_cjs.loadCollectionConfigs();
11439
11439
  console.log(`[getCollectionFields] Found ${codeCollections.length} code collections`);
11440
11440
  const codeCollection = codeCollections.find((c) => c.name === collectionId);
11441
11441
  if (codeCollection && codeCollection.schema) {
@@ -11489,7 +11489,7 @@ async function getCollection(db, collectionId) {
11489
11489
  };
11490
11490
  }
11491
11491
  console.log(`[getCollection] Not in database, checking code collections`);
11492
- const codeCollections = await chunkKVBHB7QP_cjs.loadCollectionConfigs();
11492
+ const codeCollections = await chunkAT4ZQGEZ_cjs.loadCollectionConfigs();
11493
11493
  const codeCollection = codeCollections.find((c) => c.name === collectionId);
11494
11494
  if (codeCollection) {
11495
11495
  console.log(`[getCollection] Found code collection: ${collectionId}`);
@@ -11508,7 +11508,7 @@ async function getCollection(db, collectionId) {
11508
11508
  }
11509
11509
  async function getDocBackingType(db, collectionName) {
11510
11510
  if (!collectionName) return null;
11511
- const dt = await new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db).findById(collectionName);
11511
+ const dt = await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db).findById(collectionName);
11512
11512
  return dt && dt.isActive ? dt : null;
11513
11513
  }
11514
11514
  async function getCollectionByName(db, name) {
@@ -11525,7 +11525,7 @@ async function getCollectionByName(db, name) {
11525
11525
  };
11526
11526
  }
11527
11527
  console.log(`[getCollectionByName] Not in database, checking code collections`);
11528
- const codeCollections = await chunkKVBHB7QP_cjs.loadCollectionConfigs();
11528
+ const codeCollections = await chunkAT4ZQGEZ_cjs.loadCollectionConfigs();
11529
11529
  const codeCollection = codeCollections.find((c) => c.name === name);
11530
11530
  if (codeCollection) {
11531
11531
  console.log(`[getCollectionByName] Found code collection: ${name}`);
@@ -11541,7 +11541,7 @@ async function getCollectionByName(db, name) {
11541
11541
  return null;
11542
11542
  }
11543
11543
  async function loadContentEditorFlags(db) {
11544
- const flags = { workflowEnabled: await chunkFCLKX2OS_cjs.isPluginActive(db, "workflow") };
11544
+ const flags = { workflowEnabled: await chunkIS54FPB7_cjs.isPluginActive(db, "workflow") };
11545
11545
  const editors = [
11546
11546
  ["tinymce-plugin", "tinymce"],
11547
11547
  ["quill-editor", "quill"],
@@ -11549,10 +11549,10 @@ async function loadContentEditorFlags(db) {
11549
11549
  ["lexical-editor", "lexical"]
11550
11550
  ];
11551
11551
  for (const [plugin, key] of editors) {
11552
- const enabled = await chunkFCLKX2OS_cjs.isPluginActive(db, plugin);
11552
+ const enabled = await chunkIS54FPB7_cjs.isPluginActive(db, plugin);
11553
11553
  flags[`${key}Enabled`] = enabled;
11554
11554
  if (enabled) {
11555
- const ps = new chunkKVBHB7QP_cjs.PluginService(db);
11555
+ const ps = new chunkAT4ZQGEZ_cjs.PluginService(db);
11556
11556
  const p = await ps.getPlugin(plugin);
11557
11557
  flags[`${key}Settings`] = p?.settings;
11558
11558
  }
@@ -11588,9 +11588,9 @@ adminContentRoutes.get("/", async (c) => {
11588
11588
  const offset = (page - 1) * limit;
11589
11589
  const collectionsStmt = db.prepare("SELECT id, name, display_name FROM document_types WHERE is_active = 1 ORDER BY display_name");
11590
11590
  const { results: collectionsResults } = await collectionsStmt.all();
11591
- const codeCollections = await chunkKVBHB7QP_cjs.loadCollectionConfigs();
11591
+ const codeCollections = await chunkAT4ZQGEZ_cjs.loadCollectionConfigs();
11592
11592
  const codeCollectionMap = new Map(codeCollections.map((c2) => [c2.name, c2]));
11593
- const docTypeRegistry = new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db);
11593
+ const docTypeRegistry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(db);
11594
11594
  const docTypes = (await docTypeRegistry.findAll()).filter((dt) => !dt.settings?.internal && !dt.isAuth);
11595
11595
  const visibleTypeIds = new Set(docTypes.map((dt) => dt.id));
11596
11596
  const allCollections = [
@@ -11602,7 +11602,7 @@ adminContentRoutes.get("/", async (c) => {
11602
11602
  ...allCollections.map((c2) => ({ name: c2.name, displayName: c2.displayName })),
11603
11603
  ...docTypes.filter((dt) => !collectionNames.has(dt.id)).map((dt) => ({ name: `doc:${dt.id}`, displayName: dt.displayName }))
11604
11604
  ];
11605
- const newContentCollections = await chunkKVBHB7QP_cjs.getVisibleCollections(db);
11605
+ const newContentCollections = await chunkAT4ZQGEZ_cjs.getVisibleCollections(db);
11606
11606
  const docBackedCollection = !modelName.startsWith("doc:") && modelName !== "all" ? docTypes.find((dt) => dt.id === modelName) : void 0;
11607
11607
  const isDocModel = modelName.startsWith("doc:") || !!docBackedCollection;
11608
11608
  if (isDocModel) {
@@ -11879,9 +11879,9 @@ adminContentRoutes.get("/new", async (c) => {
11879
11879
  const collectionsStmt = db2.prepare("SELECT id, name, display_name, description FROM document_types WHERE is_active = 1 ORDER BY display_name");
11880
11880
  const { results } = await collectionsStmt.all();
11881
11881
  const visibleTypeIds = new Set(
11882
- (await new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db2).findAll()).filter((dt) => !dt.settings?.internal && !dt.isAuth).map((dt) => dt.id)
11882
+ (await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db2).findAll()).filter((dt) => !dt.settings?.internal && !dt.isAuth).map((dt) => dt.id)
11883
11883
  );
11884
- const codeCollections = await chunkKVBHB7QP_cjs.loadCollectionConfigs();
11884
+ const codeCollections = await chunkAT4ZQGEZ_cjs.loadCollectionConfigs();
11885
11885
  const dbCollectionNames = new Set((results || []).map((r) => r.name));
11886
11886
  const allCollections = [
11887
11887
  ...codeCollections.filter((c2) => !dbCollectionNames.has(c2.name)).map((c2) => ({
@@ -11947,32 +11947,32 @@ adminContentRoutes.get("/new", async (c) => {
11947
11947
  return c.html(renderContentFormPage(formData2));
11948
11948
  }
11949
11949
  const fields = await getCollectionFields(db, collection.id);
11950
- const workflowEnabled = await chunkFCLKX2OS_cjs.isPluginActive(db, "workflow");
11951
- const tinymceEnabled = await chunkFCLKX2OS_cjs.isPluginActive(db, "tinymce-plugin");
11950
+ const workflowEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "workflow");
11951
+ const tinymceEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "tinymce-plugin");
11952
11952
  let tinymceSettings;
11953
11953
  if (tinymceEnabled) {
11954
- const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
11954
+ const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
11955
11955
  const tinymcePlugin2 = await pluginService.getPlugin("tinymce-plugin");
11956
11956
  tinymceSettings = tinymcePlugin2?.settings;
11957
11957
  }
11958
- const quillEnabled = await chunkFCLKX2OS_cjs.isPluginActive(db, "quill-editor");
11958
+ const quillEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "quill-editor");
11959
11959
  let quillSettings;
11960
11960
  if (quillEnabled) {
11961
- const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
11961
+ const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
11962
11962
  const quillPlugin = await pluginService.getPlugin("quill-editor");
11963
11963
  quillSettings = quillPlugin?.settings;
11964
11964
  }
11965
- const mdxeditorEnabled = await chunkFCLKX2OS_cjs.isPluginActive(db, "easy-mdx");
11965
+ const mdxeditorEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "easy-mdx");
11966
11966
  let mdxeditorSettings;
11967
11967
  if (mdxeditorEnabled) {
11968
- const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
11968
+ const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
11969
11969
  const mdxeditorPlugin = await pluginService.getPlugin("easy-mdx");
11970
11970
  mdxeditorSettings = mdxeditorPlugin?.settings;
11971
11971
  }
11972
- const lexicalEnabled = await chunkFCLKX2OS_cjs.isPluginActive(db, "lexical-editor");
11972
+ const lexicalEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "lexical-editor");
11973
11973
  let lexicalSettings;
11974
11974
  if (lexicalEnabled) {
11975
- const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
11975
+ const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
11976
11976
  const lexicalPlugin = await pluginService.getPlugin("lexical-editor");
11977
11977
  lexicalSettings = lexicalPlugin?.settings;
11978
11978
  }
@@ -12100,32 +12100,32 @@ adminContentRoutes.get("/:id/edit", async (c) => {
12100
12100
  };
12101
12101
  const fields = await getCollectionFields(db, content.collection_id);
12102
12102
  const contentData = content.data ? JSON.parse(content.data) : {};
12103
- const workflowEnabled = await chunkFCLKX2OS_cjs.isPluginActive(db, "workflow");
12104
- const tinymceEnabled = await chunkFCLKX2OS_cjs.isPluginActive(db, "tinymce-plugin");
12103
+ const workflowEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "workflow");
12104
+ const tinymceEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "tinymce-plugin");
12105
12105
  let tinymceSettings;
12106
12106
  if (tinymceEnabled) {
12107
- const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
12107
+ const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
12108
12108
  const tinymcePlugin2 = await pluginService.getPlugin("tinymce-plugin");
12109
12109
  tinymceSettings = tinymcePlugin2?.settings;
12110
12110
  }
12111
- const quillEnabled = await chunkFCLKX2OS_cjs.isPluginActive(db, "quill-editor");
12111
+ const quillEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "quill-editor");
12112
12112
  let quillSettings;
12113
12113
  if (quillEnabled) {
12114
- const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
12114
+ const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
12115
12115
  const quillPlugin = await pluginService.getPlugin("quill-editor");
12116
12116
  quillSettings = quillPlugin?.settings;
12117
12117
  }
12118
- const mdxeditorEnabled = await chunkFCLKX2OS_cjs.isPluginActive(db, "easy-mdx");
12118
+ const mdxeditorEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "easy-mdx");
12119
12119
  let mdxeditorSettings;
12120
12120
  if (mdxeditorEnabled) {
12121
- const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
12121
+ const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
12122
12122
  const mdxeditorPlugin = await pluginService.getPlugin("easy-mdx");
12123
12123
  mdxeditorSettings = mdxeditorPlugin?.settings;
12124
12124
  }
12125
- const lexicalEnabled = await chunkFCLKX2OS_cjs.isPluginActive(db, "lexical-editor");
12125
+ const lexicalEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "lexical-editor");
12126
12126
  let lexicalSettings;
12127
12127
  if (lexicalEnabled) {
12128
- const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
12128
+ const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
12129
12129
  const lexicalPlugin = await pluginService.getPlugin("lexical-editor");
12130
12130
  lexicalSettings = lexicalPlugin?.settings;
12131
12131
  }
@@ -12498,7 +12498,7 @@ adminContentRoutes.put("/:id", async (c) => {
12498
12498
  `);
12499
12499
  }
12500
12500
  });
12501
- adminContentRoutes.post("/preview", chunkFCLKX2OS_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
12501
+ adminContentRoutes.post("/preview", chunkIS54FPB7_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
12502
12502
  try {
12503
12503
  const formData = await c.req.formData();
12504
12504
  const collectionId = formData.get("collection_id");
@@ -12817,7 +12817,7 @@ adminContentRoutes.delete("/:id", async (c) => {
12817
12817
  return c.json({ success: false, error: "Failed to delete content" }, 500);
12818
12818
  }
12819
12819
  });
12820
- adminContentRoutes.get("/:id/version/:version/preview", chunkFCLKX2OS_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
12820
+ adminContentRoutes.get("/:id/version/:version/preview", chunkIS54FPB7_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
12821
12821
  try {
12822
12822
  const id = c.req.param("id");
12823
12823
  const version = parseInt(c.req.param("version") || "0");
@@ -12913,7 +12913,7 @@ function parseDocFormData(formData, queryableFields = []) {
12913
12913
  return { title, slug, data };
12914
12914
  }
12915
12915
  async function getDocService(db, typeId, tenantId) {
12916
- const registry = new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db);
12916
+ const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(db);
12917
12917
  const docType = await registry.findById(typeId);
12918
12918
  const svc = new chunkLTZ5WYOK_cjs.DocumentsService(db, {
12919
12919
  queryableFields: docType?.queryableFields ?? [],
@@ -12926,10 +12926,10 @@ async function getDocService(db, typeId, tenantId) {
12926
12926
  }
12927
12927
  adminContentRoutes.get("/documents/:typeId/new", async (c) => {
12928
12928
  const { typeId } = c.req.param();
12929
- const registry = new chunkFCLKX2OS_cjs.DocumentTypeRegistry(c.env.DB);
12929
+ const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(c.env.DB);
12930
12930
  const docType = await registry.findById(typeId);
12931
12931
  if (!docType) return c.html("<p>Unknown document type.</p>", 404);
12932
- return c.html(chunkN32OWET6_cjs.renderDocumentFormPage({ docType, isEdit: false, user: userCtx(c) }));
12932
+ return c.html(chunkJMJM7DMM_cjs.renderDocumentFormPage({ docType, isEdit: false, user: userCtx(c) }));
12933
12933
  });
12934
12934
  adminContentRoutes.post("/documents/:typeId/new", async (c) => {
12935
12935
  const { typeId } = c.req.param();
@@ -12951,17 +12951,17 @@ adminContentRoutes.post("/documents/:typeId/new", async (c) => {
12951
12951
  }), user?.userId);
12952
12952
  return c.redirect(`/admin/content/documents/${typeId}/${doc.rootId}/edit?message=Created+successfully`);
12953
12953
  } catch (err) {
12954
- const registry = new chunkFCLKX2OS_cjs.DocumentTypeRegistry(c.env.DB);
12954
+ const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(c.env.DB);
12955
12955
  const docType = await registry.findById(typeId);
12956
12956
  if (!docType) return c.html("<p>Unknown document type.</p>", 404);
12957
- return c.html(chunkN32OWET6_cjs.renderDocumentFormPage({ docType, isEdit: false, user: userCtx(c), message: err?.message ?? "Failed to create", messageType: "error" }));
12957
+ return c.html(chunkJMJM7DMM_cjs.renderDocumentFormPage({ docType, isEdit: false, user: userCtx(c), message: err?.message ?? "Failed to create", messageType: "error" }));
12958
12958
  }
12959
12959
  });
12960
12960
  adminContentRoutes.get("/documents/:typeId/:rootId/edit", async (c) => {
12961
12961
  const { typeId, rootId } = c.req.param();
12962
12962
  const db = c.env.DB;
12963
12963
  const message = c.req.query("message");
12964
- const registry = new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db);
12964
+ const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(db);
12965
12965
  const docType = await registry.findById(typeId);
12966
12966
  if (!docType) return c.html("<p>Unknown document type.</p>", 404);
12967
12967
  const tenantId = reqTenant(c);
@@ -13008,7 +13008,7 @@ adminContentRoutes.get("/documents/:typeId/:rootId/edit", async (c) => {
13008
13008
  createdAt: draftRow.created_at,
13009
13009
  updatedAt: draftRow.updated_at
13010
13010
  };
13011
- return c.html(chunkN32OWET6_cjs.renderDocumentFormPage({ docType, doc, publishedDoc, isEdit: true, message, user: userCtx(c), versioningEnabled: docType?.settings?.versioning === true }));
13011
+ return c.html(chunkJMJM7DMM_cjs.renderDocumentFormPage({ docType, doc, publishedDoc, isEdit: true, message, user: userCtx(c), versioningEnabled: docType?.settings?.versioning === true }));
13012
13012
  });
13013
13013
  adminContentRoutes.post("/documents/:typeId/:rootId", async (c) => {
13014
13014
  const { typeId, rootId } = c.req.param();
@@ -13073,8 +13073,8 @@ adminContentRoutes.post("/documents/:typeId/:documentId/delete", async (c) => {
13073
13073
  adminContentRoutes.get("/documents/:typeId/:rootId/versions", async (c) => {
13074
13074
  const { typeId, rootId } = c.req.param();
13075
13075
  const db = c.env.DB;
13076
- const { renderVersionHistoryFragment } = await import('./admin-documents-form.template-LSZKGA5J.cjs');
13077
- const registry = new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db);
13076
+ const { renderVersionHistoryFragment } = await import('./admin-documents-form.template-YNAVMJCV.cjs');
13077
+ const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(db);
13078
13078
  const docType = await registry.findById(typeId);
13079
13079
  if (!docType) return c.html("<div>Unknown type.</div>", 404);
13080
13080
  const result = await db.prepare(
@@ -13094,7 +13094,7 @@ adminContentRoutes.get("/documents/:typeId/:rootId/versions", async (c) => {
13094
13094
  var admin_content_default = adminContentRoutes;
13095
13095
 
13096
13096
  // src/templates/pages/admin-profile.template.ts
13097
- chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
13097
+ chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
13098
13098
  function renderAvatarImage(avatarUrl, firstName, lastName) {
13099
13099
  return `<div id="avatar-image-container" class="w-24 h-24 rounded-full mx-auto mb-4 overflow-hidden bg-gradient-to-br from-cyan-400 to-purple-400 flex items-center justify-center ring-4 ring-zinc-950/5 dark:ring-white/10">
13100
13100
  ${avatarUrl ? `<img src="${avatarUrl}" alt="Profile picture" class="w-full h-full object-cover">` : `<span class="text-2xl font-bold text-white">${firstName.charAt(0)}${lastName.charAt(0)}</span>`}
@@ -13114,8 +13114,8 @@ function renderProfilePage(data) {
13114
13114
  </div>
13115
13115
 
13116
13116
  <!-- Alert Messages -->
13117
- ${data.error ? chunkPXNTCCPE_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
13118
- ${data.success ? chunkPXNTCCPE_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
13117
+ ${data.error ? chunkE66UVONV_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
13118
+ ${data.success ? chunkE66UVONV_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
13119
13119
 
13120
13120
  <!-- Profile Form -->
13121
13121
  <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
@@ -13492,7 +13492,7 @@ function renderProfilePage(data) {
13492
13492
  version: data.version,
13493
13493
  content: pageContent
13494
13494
  };
13495
- return chunkK623Q6WD_cjs.renderAdminLayoutCatalyst(layoutData);
13495
+ return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
13496
13496
  }
13497
13497
 
13498
13498
  // src/templates/pages/admin-activity-logs.template.ts
@@ -13702,7 +13702,7 @@ function renderActivityLogsPage(data) {
13702
13702
  user: data.user,
13703
13703
  content: pageContent
13704
13704
  };
13705
- return chunkPXNTCCPE_cjs.renderAdminLayout(layoutData);
13705
+ return chunkE66UVONV_cjs.renderAdminLayout(layoutData);
13706
13706
  }
13707
13707
  function getActionBadgeClass(action) {
13708
13708
  if (action.includes("login") || action.includes("logout")) {
@@ -13722,7 +13722,7 @@ function formatAction(action) {
13722
13722
  }
13723
13723
 
13724
13724
  // src/templates/pages/admin-user-edit.template.ts
13725
- chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
13725
+ chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
13726
13726
 
13727
13727
  // src/templates/components/confirmation-dialog.template.ts
13728
13728
  function renderConfirmationDialog2(options) {
@@ -13918,8 +13918,8 @@ function renderUserEditPage(data) {
13918
13918
 
13919
13919
  <!-- Alert Messages -->
13920
13920
  <div id="form-messages" class="mb-6 empty:mb-0">
13921
- ${data.error ? chunkPXNTCCPE_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
13922
- ${data.success ? chunkPXNTCCPE_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
13921
+ ${data.error ? chunkE66UVONV_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
13922
+ ${data.success ? chunkE66UVONV_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
13923
13923
  </div>
13924
13924
 
13925
13925
  <!-- User Edit Form -->
@@ -14241,11 +14241,11 @@ function renderUserEditPage(data) {
14241
14241
  user: data.user,
14242
14242
  content: pageContent
14243
14243
  };
14244
- return chunkK623Q6WD_cjs.renderAdminLayoutCatalyst(layoutData);
14244
+ return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
14245
14245
  }
14246
14246
 
14247
14247
  // src/templates/pages/admin-user-new.template.ts
14248
- chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
14248
+ chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
14249
14249
  function renderUserNewPage(data) {
14250
14250
  const pageContent = `
14251
14251
  <div>
@@ -14284,8 +14284,8 @@ function renderUserNewPage(data) {
14284
14284
 
14285
14285
  <!-- Alert Messages -->
14286
14286
  <div id="form-messages">
14287
- ${data.error ? chunkPXNTCCPE_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
14288
- ${data.success ? chunkPXNTCCPE_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
14287
+ ${data.error ? chunkE66UVONV_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
14288
+ ${data.success ? chunkE66UVONV_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
14289
14289
  </div>
14290
14290
 
14291
14291
  <!-- User New Form -->
@@ -14515,11 +14515,11 @@ function renderUserNewPage(data) {
14515
14515
  user: data.user,
14516
14516
  content: pageContent
14517
14517
  };
14518
- return chunkK623Q6WD_cjs.renderAdminLayoutCatalyst(layoutData);
14518
+ return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
14519
14519
  }
14520
14520
 
14521
14521
  // src/templates/pages/admin-users-list.template.ts
14522
- chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
14522
+ chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
14523
14523
  function renderUsersListPage(data) {
14524
14524
  const columns = [
14525
14525
  {
@@ -14675,8 +14675,8 @@ function renderUsersListPage(data) {
14675
14675
  </div>
14676
14676
 
14677
14677
  <!-- Alert Messages -->
14678
- ${data.error ? chunkPXNTCCPE_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
14679
- ${data.success ? chunkPXNTCCPE_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
14678
+ ${data.error ? chunkE66UVONV_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
14679
+ ${data.success ? chunkE66UVONV_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
14680
14680
 
14681
14681
  <!-- Stats -->
14682
14682
  <div class="mb-6">
@@ -14853,10 +14853,10 @@ function renderUsersListPage(data) {
14853
14853
  </div>
14854
14854
 
14855
14855
  <!-- Users Table -->
14856
- ${chunkPXNTCCPE_cjs.renderTable(tableData)}
14856
+ ${chunkE66UVONV_cjs.renderTable(tableData)}
14857
14857
 
14858
14858
  <!-- Pagination -->
14859
- ${data.pagination ? chunkPXNTCCPE_cjs.renderPagination(data.pagination) : ""}
14859
+ ${data.pagination ? chunkE66UVONV_cjs.renderPagination(data.pagination) : ""}
14860
14860
  </div>
14861
14861
 
14862
14862
  <script>
@@ -14927,7 +14927,7 @@ function renderUsersListPage(data) {
14927
14927
  version: data.version,
14928
14928
  content: pageContent
14929
14929
  };
14930
- return chunkK623Q6WD_cjs.renderAdminLayoutCatalyst(layoutData);
14930
+ return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
14931
14931
  }
14932
14932
 
14933
14933
  // src/plugins/core-plugins/multi-tenant-plugin/services/tenant-service.ts
@@ -15007,7 +15007,7 @@ var TenantService = class {
15007
15007
  SET name = ?, domain = ?, status = ?, notes = ?, updated_at = ?
15008
15008
  WHERE slug = ?
15009
15009
  `).bind(name, domain, status, notes, now, slug).run();
15010
- chunkKVBHB7QP_cjs.invalidateTenantCache();
15010
+ chunkAT4ZQGEZ_cjs.invalidateTenantCache();
15011
15011
  const updated = await this.getTenantBySlug(slug);
15012
15012
  if (!updated) throw new Error("Tenant not found");
15013
15013
  return updated;
@@ -15025,7 +15025,7 @@ var TenantService = class {
15025
15025
  throw new Error(`Tenant '${slug}' still owns ${docCount} document(s). Delete or migrate its content first.`);
15026
15026
  }
15027
15027
  await this.db.prepare(`DELETE FROM auth_tenant WHERE slug = ?`).bind(slug).run();
15028
- chunkKVBHB7QP_cjs.invalidateTenantCache();
15028
+ chunkAT4ZQGEZ_cjs.invalidateTenantCache();
15029
15029
  }
15030
15030
  // ─── Membership (auth_tenant_member) ───────────────────────────────────────
15031
15031
  // Tenant resolution and the admin switcher are gated on membership: an authed user may only
@@ -15269,7 +15269,7 @@ var TenantService = class {
15269
15269
  INSERT INTO auth_tenant (id, name, slug, status, domain, notes, metadata, created_at, updated_at)
15270
15270
  VALUES (?, ?, ?, 'active', ?, ?, '{}', ?, ?)
15271
15271
  `).bind(id, input.name, input.slug, input.domain, input.notes, now, now).run();
15272
- chunkKVBHB7QP_cjs.invalidateTenantCache();
15272
+ chunkAT4ZQGEZ_cjs.invalidateTenantCache();
15273
15273
  const created = await this.getTenantBySlug(input.slug);
15274
15274
  if (!created) throw new Error("Failed to create tenant");
15275
15275
  return created;
@@ -15293,14 +15293,14 @@ function mapRowToTenant(row) {
15293
15293
 
15294
15294
  // src/routes/admin-users.ts
15295
15295
  var userRoutes = new hono.Hono();
15296
- userRoutes.use("*", chunkFCLKX2OS_cjs.requireAuth());
15297
- userRoutes.use("/users/*", chunkFCLKX2OS_cjs.requireRole(["admin"]));
15298
- userRoutes.use("/users", chunkFCLKX2OS_cjs.requireRole(["admin"]));
15299
- userRoutes.use("/invite-user", chunkFCLKX2OS_cjs.requireRole(["admin"]));
15300
- userRoutes.use("/resend-invitation/*", chunkFCLKX2OS_cjs.requireRole(["admin"]));
15301
- userRoutes.use("/cancel-invitation/*", chunkFCLKX2OS_cjs.requireRole(["admin"]));
15302
- userRoutes.use("/activity-logs", chunkFCLKX2OS_cjs.requireRole(["admin"]));
15303
- userRoutes.use("/activity-logs/*", chunkFCLKX2OS_cjs.requireRole(["admin"]));
15296
+ userRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
15297
+ userRoutes.use("/users/*", chunkIS54FPB7_cjs.requireRole(["admin"]));
15298
+ userRoutes.use("/users", chunkIS54FPB7_cjs.requireRole(["admin"]));
15299
+ userRoutes.use("/invite-user", chunkIS54FPB7_cjs.requireRole(["admin"]));
15300
+ userRoutes.use("/resend-invitation/*", chunkIS54FPB7_cjs.requireRole(["admin"]));
15301
+ userRoutes.use("/cancel-invitation/*", chunkIS54FPB7_cjs.requireRole(["admin"]));
15302
+ userRoutes.use("/activity-logs", chunkIS54FPB7_cjs.requireRole(["admin"]));
15303
+ userRoutes.use("/activity-logs/*", chunkIS54FPB7_cjs.requireRole(["admin"]));
15304
15304
  userRoutes.get("/", (c) => {
15305
15305
  return c.redirect("/admin/dashboard");
15306
15306
  });
@@ -15411,7 +15411,7 @@ userRoutes.put("/profile", async (c) => {
15411
15411
  const language = formData.get("language")?.toString() || "en";
15412
15412
  const emailNotifications = formData.get("email_notifications") === "1";
15413
15413
  if (!firstName || !lastName || !email) {
15414
- return c.html(chunkN32OWET6_cjs.renderAlert({
15414
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15415
15415
  type: "error",
15416
15416
  message: "First name, last name, and email are required.",
15417
15417
  dismissible: true
@@ -15419,7 +15419,7 @@ userRoutes.put("/profile", async (c) => {
15419
15419
  }
15420
15420
  const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
15421
15421
  if (!emailRegex.test(email)) {
15422
- return c.html(chunkN32OWET6_cjs.renderAlert({
15422
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15423
15423
  type: "error",
15424
15424
  message: "Please enter a valid email address.",
15425
15425
  dismissible: true
@@ -15431,7 +15431,7 @@ userRoutes.put("/profile", async (c) => {
15431
15431
  `);
15432
15432
  const existingUser = await checkStmt.bind(email, user.userId).first();
15433
15433
  if (existingUser) {
15434
- return c.html(chunkN32OWET6_cjs.renderAlert({
15434
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15435
15435
  type: "error",
15436
15436
  message: "Email is already taken by another user.",
15437
15437
  dismissible: true
@@ -15463,11 +15463,11 @@ userRoutes.put("/profile", async (c) => {
15463
15463
  const validation = validateCustomData(sanitized, profileConfig);
15464
15464
  if (!validation.valid) {
15465
15465
  const errorMessages = Object.values(validation.errors).join(", ");
15466
- return c.html(chunkN32OWET6_cjs.renderAlert({ type: "error", message: errorMessages, dismissible: true }), 400);
15466
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({ type: "error", message: errorMessages, dismissible: true }), 400);
15467
15467
  }
15468
15468
  await saveCustomData(db, user.userId, sanitized);
15469
15469
  }
15470
- await chunkFCLKX2OS_cjs.logActivity(
15470
+ await chunkIS54FPB7_cjs.logActivity(
15471
15471
  db,
15472
15472
  user.userId,
15473
15473
  "profile.update",
@@ -15477,14 +15477,14 @@ userRoutes.put("/profile", async (c) => {
15477
15477
  c.req.header("x-forwarded-for") || c.req.header("cf-connecting-ip"),
15478
15478
  c.req.header("user-agent")
15479
15479
  );
15480
- return c.html(chunkN32OWET6_cjs.renderAlert({
15480
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15481
15481
  type: "success",
15482
15482
  message: "Profile updated successfully!",
15483
15483
  dismissible: true
15484
15484
  }));
15485
15485
  } catch (error) {
15486
15486
  console.error("Profile update error:", error);
15487
- return c.html(chunkN32OWET6_cjs.renderAlert({
15487
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15488
15488
  type: "error",
15489
15489
  message: "Failed to update profile. Please try again.",
15490
15490
  dismissible: true
@@ -15498,7 +15498,7 @@ userRoutes.post("/profile/avatar", async (c) => {
15498
15498
  const formData = await c.req.formData();
15499
15499
  const avatarFile = formData.get("avatar");
15500
15500
  if (!avatarFile || typeof avatarFile === "string" || !avatarFile.name) {
15501
- return c.html(chunkN32OWET6_cjs.renderAlert({
15501
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15502
15502
  type: "error",
15503
15503
  message: "Please select an image file.",
15504
15504
  dismissible: true
@@ -15506,7 +15506,7 @@ userRoutes.post("/profile/avatar", async (c) => {
15506
15506
  }
15507
15507
  const allowedTypes = ["image/jpeg", "image/png", "image/gif", "image/webp"];
15508
15508
  if (!allowedTypes.includes(avatarFile.type)) {
15509
- return c.html(chunkN32OWET6_cjs.renderAlert({
15509
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15510
15510
  type: "error",
15511
15511
  message: "Please upload a valid image file (JPEG, PNG, GIF, or WebP).",
15512
15512
  dismissible: true
@@ -15514,7 +15514,7 @@ userRoutes.post("/profile/avatar", async (c) => {
15514
15514
  }
15515
15515
  const maxSize = 5 * 1024 * 1024;
15516
15516
  if (avatarFile.size > maxSize) {
15517
- return c.html(chunkN32OWET6_cjs.renderAlert({
15517
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15518
15518
  type: "error",
15519
15519
  message: "Image file must be smaller than 5MB.",
15520
15520
  dismissible: true
@@ -15530,7 +15530,7 @@ userRoutes.post("/profile/avatar", async (c) => {
15530
15530
  SELECT first_name, last_name FROM auth_user WHERE id = ?
15531
15531
  `);
15532
15532
  const userData = await userStmt.bind(user.userId).first();
15533
- await chunkFCLKX2OS_cjs.logActivity(
15533
+ await chunkIS54FPB7_cjs.logActivity(
15534
15534
  db,
15535
15535
  user.userId,
15536
15536
  "profile.avatar_update",
@@ -15540,7 +15540,7 @@ userRoutes.post("/profile/avatar", async (c) => {
15540
15540
  c.req.header("x-forwarded-for") || c.req.header("cf-connecting-ip"),
15541
15541
  c.req.header("user-agent")
15542
15542
  );
15543
- const alertHtml = chunkN32OWET6_cjs.renderAlert({
15543
+ const alertHtml = chunkJMJM7DMM_cjs.renderAlert({
15544
15544
  type: "success",
15545
15545
  message: "Profile picture updated successfully!",
15546
15546
  dismissible: true
@@ -15554,7 +15554,7 @@ userRoutes.post("/profile/avatar", async (c) => {
15554
15554
  return c.html(alertHtml + avatarImageWithOob);
15555
15555
  } catch (error) {
15556
15556
  console.error("Avatar upload error:", error);
15557
- return c.html(chunkN32OWET6_cjs.renderAlert({
15557
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15558
15558
  type: "error",
15559
15559
  message: "Failed to upload profile picture. Please try again.",
15560
15560
  dismissible: true
@@ -15570,21 +15570,21 @@ userRoutes.post("/profile/password", async (c) => {
15570
15570
  const newPassword = formData.get("new_password")?.toString() || "";
15571
15571
  const confirmPassword = formData.get("confirm_password")?.toString() || "";
15572
15572
  if (!currentPassword || !newPassword || !confirmPassword) {
15573
- return c.html(chunkN32OWET6_cjs.renderAlert({
15573
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15574
15574
  type: "error",
15575
15575
  message: "All password fields are required.",
15576
15576
  dismissible: true
15577
15577
  }));
15578
15578
  }
15579
15579
  if (newPassword !== confirmPassword) {
15580
- return c.html(chunkN32OWET6_cjs.renderAlert({
15580
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15581
15581
  type: "error",
15582
15582
  message: "New passwords do not match.",
15583
15583
  dismissible: true
15584
15584
  }));
15585
15585
  }
15586
15586
  if (newPassword.length < 8) {
15587
- return c.html(chunkN32OWET6_cjs.renderAlert({
15587
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15588
15588
  type: "error",
15589
15589
  message: "New password must be at least 8 characters long.",
15590
15590
  dismissible: true
@@ -15595,21 +15595,21 @@ userRoutes.post("/profile/password", async (c) => {
15595
15595
  `);
15596
15596
  const userData = await userStmt.bind(user.userId).first();
15597
15597
  if (!userData) {
15598
- return c.html(chunkN32OWET6_cjs.renderAlert({
15598
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15599
15599
  type: "error",
15600
15600
  message: "User not found.",
15601
15601
  dismissible: true
15602
15602
  }));
15603
15603
  }
15604
- const validPassword = await chunkFCLKX2OS_cjs.AuthManager.verifyPassword(currentPassword, userData.password_hash);
15604
+ const validPassword = await chunkIS54FPB7_cjs.AuthManager.verifyPassword(currentPassword, userData.password_hash);
15605
15605
  if (!validPassword) {
15606
- return c.html(chunkN32OWET6_cjs.renderAlert({
15606
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15607
15607
  type: "error",
15608
15608
  message: "Current password is incorrect.",
15609
15609
  dismissible: true
15610
15610
  }));
15611
15611
  }
15612
- const newPasswordHash = await chunkFCLKX2OS_cjs.AuthManager.hashPassword(newPassword);
15612
+ const newPasswordHash = await chunkIS54FPB7_cjs.AuthManager.hashPassword(newPassword);
15613
15613
  const historyStmt = db.prepare(`
15614
15614
  INSERT INTO auth_password_history (id, user_id, password_hash, created_at)
15615
15615
  VALUES (?, ?, ?, ?)
@@ -15625,7 +15625,7 @@ userRoutes.post("/profile/password", async (c) => {
15625
15625
  WHERE id = ?
15626
15626
  `);
15627
15627
  await updateStmt.bind(newPasswordHash, Date.now(), user.userId).run();
15628
- await chunkFCLKX2OS_cjs.logActivity(
15628
+ await chunkIS54FPB7_cjs.logActivity(
15629
15629
  db,
15630
15630
  user.userId,
15631
15631
  "profile.password_change",
@@ -15635,14 +15635,14 @@ userRoutes.post("/profile/password", async (c) => {
15635
15635
  c.req.header("x-forwarded-for") || c.req.header("cf-connecting-ip"),
15636
15636
  c.req.header("user-agent")
15637
15637
  );
15638
- return c.html(chunkN32OWET6_cjs.renderAlert({
15638
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15639
15639
  type: "success",
15640
15640
  message: "Password updated successfully!",
15641
15641
  dismissible: true
15642
15642
  }));
15643
15643
  } catch (error) {
15644
15644
  console.error("Password change error:", error);
15645
- return c.html(chunkN32OWET6_cjs.renderAlert({
15645
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15646
15646
  type: "error",
15647
15647
  message: "Failed to update password. Please try again.",
15648
15648
  dismissible: true
@@ -15692,7 +15692,7 @@ userRoutes.get("/users", async (c) => {
15692
15692
  `);
15693
15693
  const countResult = await countStmt.bind(...params).first();
15694
15694
  const totalUsers = countResult?.total || 0;
15695
- await chunkFCLKX2OS_cjs.logActivity(
15695
+ await chunkIS54FPB7_cjs.logActivity(
15696
15696
  db,
15697
15697
  user.userId,
15698
15698
  "users.list_view",
@@ -15763,7 +15763,7 @@ userRoutes.get("/users", async (c) => {
15763
15763
  if (isApiRequest) {
15764
15764
  return c.json({ error: "Failed to load users" }, 500);
15765
15765
  }
15766
- return c.html(chunkN32OWET6_cjs.renderAlert({
15766
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15767
15767
  type: "error",
15768
15768
  message: "Failed to load users. Please try again.",
15769
15769
  dismissible: true
@@ -15794,7 +15794,7 @@ userRoutes.get("/users/new", async (c) => {
15794
15794
  return c.html(renderUserNewPage(pageData));
15795
15795
  } catch (error) {
15796
15796
  console.error("User new page error:", error);
15797
- return c.html(chunkN32OWET6_cjs.renderAlert({
15797
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15798
15798
  type: "error",
15799
15799
  message: "Failed to load user creation page. Please try again.",
15800
15800
  dismissible: true
@@ -15828,12 +15828,12 @@ userRoutes.post("/users/new", async (c) => {
15828
15828
  const validation = validateCustomData(sanitized, profileConfig);
15829
15829
  if (!validation.valid) {
15830
15830
  const errorMessages = Object.values(validation.errors).join(", ");
15831
- return c.html(chunkN32OWET6_cjs.renderAlert({ type: "error", message: errorMessages, dismissible: true }), 400);
15831
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({ type: "error", message: errorMessages, dismissible: true }), 400);
15832
15832
  }
15833
15833
  sanitizedRegistrationCustom = sanitized;
15834
15834
  }
15835
15835
  if (!firstName || !lastName || !email || !password) {
15836
- return c.html(chunkN32OWET6_cjs.renderAlert({
15836
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15837
15837
  type: "error",
15838
15838
  message: "First name, last name, email, and password are required.",
15839
15839
  dismissible: true
@@ -15841,21 +15841,21 @@ userRoutes.post("/users/new", async (c) => {
15841
15841
  }
15842
15842
  const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
15843
15843
  if (!emailRegex.test(email)) {
15844
- return c.html(chunkN32OWET6_cjs.renderAlert({
15844
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15845
15845
  type: "error",
15846
15846
  message: "Please enter a valid email address.",
15847
15847
  dismissible: true
15848
15848
  }));
15849
15849
  }
15850
15850
  if (password.length < 8) {
15851
- return c.html(chunkN32OWET6_cjs.renderAlert({
15851
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15852
15852
  type: "error",
15853
15853
  message: "Password must be at least 8 characters long.",
15854
15854
  dismissible: true
15855
15855
  }));
15856
15856
  }
15857
15857
  if (password !== confirmPassword) {
15858
- return c.html(chunkN32OWET6_cjs.renderAlert({
15858
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15859
15859
  type: "error",
15860
15860
  message: "Passwords do not match.",
15861
15861
  dismissible: true
@@ -15867,13 +15867,13 @@ userRoutes.post("/users/new", async (c) => {
15867
15867
  `);
15868
15868
  const existingUser = await checkStmt.bind(email).first();
15869
15869
  if (existingUser) {
15870
- return c.html(chunkN32OWET6_cjs.renderAlert({
15870
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15871
15871
  type: "error",
15872
15872
  message: "Email is already taken.",
15873
15873
  dismissible: true
15874
15874
  }));
15875
15875
  }
15876
- const passwordHash = await chunkFCLKX2OS_cjs.AuthManager.hashPassword(password);
15876
+ const passwordHash = await chunkIS54FPB7_cjs.AuthManager.hashPassword(password);
15877
15877
  const userId = crypto.randomUUID();
15878
15878
  const createStmt = db.prepare(`
15879
15879
  INSERT INTO auth_user (
@@ -15898,7 +15898,7 @@ userRoutes.post("/users/new", async (c) => {
15898
15898
  if (sanitizedRegistrationCustom !== null && Object.keys(sanitizedRegistrationCustom).length > 0) {
15899
15899
  await writeProfileData(db, userId, { custom: sanitizedRegistrationCustom }, user.userId);
15900
15900
  }
15901
- await chunkFCLKX2OS_cjs.logActivity(
15901
+ await chunkIS54FPB7_cjs.logActivity(
15902
15902
  db,
15903
15903
  user.userId,
15904
15904
  "user!.create",
@@ -15912,7 +15912,7 @@ userRoutes.post("/users/new", async (c) => {
15912
15912
  return c.body(null, 200);
15913
15913
  } catch (error) {
15914
15914
  console.error("User creation error:", error);
15915
- return c.html(chunkN32OWET6_cjs.renderAlert({
15915
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15916
15916
  type: "error",
15917
15917
  message: "Failed to create user!. Please try again.",
15918
15918
  dismissible: true
@@ -15937,7 +15937,7 @@ userRoutes.get("/users/:id", async (c) => {
15937
15937
  if (!userRecord) {
15938
15938
  return c.json({ error: "User not found" }, 404);
15939
15939
  }
15940
- await chunkFCLKX2OS_cjs.logActivity(
15940
+ await chunkIS54FPB7_cjs.logActivity(
15941
15941
  db,
15942
15942
  user.userId,
15943
15943
  "user!.view",
@@ -15982,7 +15982,7 @@ userRoutes.get("/users/:id/edit", async (c) => {
15982
15982
  `);
15983
15983
  const userToEdit = await userStmt.bind(userId).first();
15984
15984
  if (!userToEdit) {
15985
- return c.html(chunkN32OWET6_cjs.renderAlert({
15985
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
15986
15986
  type: "error",
15987
15987
  message: "User not found",
15988
15988
  dismissible: true
@@ -16052,7 +16052,7 @@ userRoutes.get("/users/:id/edit", async (c) => {
16052
16052
  return c.html(renderUserEditPage(pageData));
16053
16053
  } catch (error) {
16054
16054
  console.error("User edit page error:", error);
16055
- return c.html(chunkN32OWET6_cjs.renderAlert({
16055
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
16056
16056
  type: "error",
16057
16057
  message: "Failed to load user. Please try again.",
16058
16058
  dismissible: true
@@ -16085,12 +16085,12 @@ userRoutes.put("/users/:id", async (c) => {
16085
16085
  const validation = validateCustomData(sanitized, profileConfig);
16086
16086
  if (!validation.valid) {
16087
16087
  const errorMessages = Object.values(validation.errors).join(", ");
16088
- return c.html(chunkN32OWET6_cjs.renderAlert({ type: "error", message: errorMessages, dismissible: true }), 400);
16088
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({ type: "error", message: errorMessages, dismissible: true }), 400);
16089
16089
  }
16090
16090
  sanitizedCustom = sanitized;
16091
16091
  }
16092
16092
  if (!email) {
16093
- return c.html(chunkN32OWET6_cjs.renderAlert({
16093
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
16094
16094
  type: "error",
16095
16095
  message: "Email is required.",
16096
16096
  dismissible: true
@@ -16098,7 +16098,7 @@ userRoutes.put("/users/:id", async (c) => {
16098
16098
  }
16099
16099
  const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
16100
16100
  if (!emailRegex.test(email)) {
16101
- return c.html(chunkN32OWET6_cjs.renderAlert({
16101
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
16102
16102
  type: "error",
16103
16103
  message: "Please enter a valid email address.",
16104
16104
  dismissible: true
@@ -16106,14 +16106,14 @@ userRoutes.put("/users/:id", async (c) => {
16106
16106
  }
16107
16107
  if (newPassword) {
16108
16108
  if (newPassword.length < 8) {
16109
- return c.html(chunkN32OWET6_cjs.renderAlert({
16109
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
16110
16110
  type: "error",
16111
16111
  message: "Password must be at least 8 characters long.",
16112
16112
  dismissible: true
16113
16113
  }));
16114
16114
  }
16115
16115
  if (newPassword !== confirmPassword) {
16116
- return c.html(chunkN32OWET6_cjs.renderAlert({
16116
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
16117
16117
  type: "error",
16118
16118
  message: "Passwords do not match.",
16119
16119
  dismissible: true
@@ -16126,7 +16126,7 @@ userRoutes.put("/users/:id", async (c) => {
16126
16126
  `);
16127
16127
  const existingUser = await checkStmt.bind(email, userId).first();
16128
16128
  if (existingUser) {
16129
- return c.html(chunkN32OWET6_cjs.renderAlert({
16129
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
16130
16130
  type: "error",
16131
16131
  message: "Email is already taken by another user.",
16132
16132
  dismissible: true
@@ -16151,7 +16151,7 @@ userRoutes.put("/users/:id", async (c) => {
16151
16151
  userId
16152
16152
  ).run();
16153
16153
  if (newPassword) {
16154
- const passwordHash = await chunkFCLKX2OS_cjs.AuthManager.hashPassword(newPassword);
16154
+ const passwordHash = await chunkIS54FPB7_cjs.AuthManager.hashPassword(newPassword);
16155
16155
  const updatePasswordStmt = db.prepare(`
16156
16156
  UPDATE auth_user SET password_hash = ?, updated_at = ? WHERE id = ?
16157
16157
  `);
@@ -16164,7 +16164,7 @@ userRoutes.put("/users/:id", async (c) => {
16164
16164
  ...sanitizedCustom !== null ? { custom: sanitizedCustom } : {}
16165
16165
  }, user.userId);
16166
16166
  }
16167
- await chunkFCLKX2OS_cjs.logActivity(
16167
+ await chunkIS54FPB7_cjs.logActivity(
16168
16168
  db,
16169
16169
  user.userId,
16170
16170
  "user.update",
@@ -16174,7 +16174,7 @@ userRoutes.put("/users/:id", async (c) => {
16174
16174
  c.req.header("x-forwarded-for") || c.req.header("cf-connecting-ip"),
16175
16175
  c.req.header("user-agent")
16176
16176
  );
16177
- return c.html(chunkN32OWET6_cjs.renderAlert({
16177
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
16178
16178
  type: "success",
16179
16179
  message: "User updated successfully!",
16180
16180
  dismissible: true,
@@ -16182,7 +16182,7 @@ userRoutes.put("/users/:id", async (c) => {
16182
16182
  }));
16183
16183
  } catch (error) {
16184
16184
  console.error("User update error:", error);
16185
- return c.html(chunkN32OWET6_cjs.renderAlert({
16185
+ return c.html(chunkJMJM7DMM_cjs.renderAlert({
16186
16186
  type: "error",
16187
16187
  message: "Failed to update user. Please try again.",
16188
16188
  dismissible: true
@@ -16210,7 +16210,7 @@ userRoutes.post("/users/:id/toggle", async (c) => {
16210
16210
  UPDATE auth_user SET is_active = ?, updated_at = ? WHERE id = ?
16211
16211
  `);
16212
16212
  await toggleStmt.bind(active ? 1 : 0, Date.now(), userId).run();
16213
- await chunkFCLKX2OS_cjs.logActivity(
16213
+ await chunkIS54FPB7_cjs.logActivity(
16214
16214
  db,
16215
16215
  user.userId,
16216
16216
  active ? "user.activate" : "user.deactivate",
@@ -16251,7 +16251,7 @@ userRoutes.delete("/users/:id", async (c) => {
16251
16251
  DELETE FROM auth_user WHERE id = ?
16252
16252
  `);
16253
16253
  await deleteStmt.bind(userId).run();
16254
- await chunkFCLKX2OS_cjs.logActivity(
16254
+ await chunkIS54FPB7_cjs.logActivity(
16255
16255
  db,
16256
16256
  user.userId,
16257
16257
  "user!.hard_delete",
@@ -16270,7 +16270,7 @@ userRoutes.delete("/users/:id", async (c) => {
16270
16270
  UPDATE auth_user SET is_active = 0, updated_at = ? WHERE id = ?
16271
16271
  `);
16272
16272
  await deleteStmt.bind(Date.now(), userId).run();
16273
- await chunkFCLKX2OS_cjs.logActivity(
16273
+ await chunkIS54FPB7_cjs.logActivity(
16274
16274
  db,
16275
16275
  user.userId,
16276
16276
  "user!.soft_delete",
@@ -16336,7 +16336,7 @@ userRoutes.post("/invite-user", async (c) => {
16336
16336
  Date.now(),
16337
16337
  Date.now()
16338
16338
  ).run();
16339
- await chunkFCLKX2OS_cjs.logActivity(
16339
+ await chunkIS54FPB7_cjs.logActivity(
16340
16340
  db,
16341
16341
  user.userId,
16342
16342
  "user!.invite_sent",
@@ -16393,7 +16393,7 @@ userRoutes.post("/resend-invitation/:id", async (c) => {
16393
16393
  Date.now(),
16394
16394
  userId
16395
16395
  ).run();
16396
- await chunkFCLKX2OS_cjs.logActivity(
16396
+ await chunkIS54FPB7_cjs.logActivity(
16397
16397
  db,
16398
16398
  user.userId,
16399
16399
  "user!.invitation_resent",
@@ -16429,7 +16429,7 @@ userRoutes.delete("/cancel-invitation/:id", async (c) => {
16429
16429
  }
16430
16430
  const deleteStmt = db.prepare(`DELETE FROM auth_user WHERE id = ?`);
16431
16431
  await deleteStmt.bind(userId).run();
16432
- await chunkFCLKX2OS_cjs.logActivity(
16432
+ await chunkIS54FPB7_cjs.logActivity(
16433
16433
  db,
16434
16434
  user.userId,
16435
16435
  "user!.invitation_cancelled",
@@ -16678,7 +16678,7 @@ function getFileIcon(mimeType) {
16678
16678
  }
16679
16679
 
16680
16680
  // src/templates/pages/admin-media-library.template.ts
16681
- chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
16681
+ chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
16682
16682
  function renderMediaLibraryPage(data) {
16683
16683
  const pageContent = `
16684
16684
  <div>
@@ -17613,7 +17613,7 @@ function renderMediaLibraryPage(data) {
17613
17613
  version: data.version,
17614
17614
  content: pageContent
17615
17615
  };
17616
- return chunkK623Q6WD_cjs.renderAdminLayoutCatalyst(layoutData);
17616
+ return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
17617
17617
  }
17618
17618
 
17619
17619
  // src/templates/components/media-file-details.template.ts
@@ -17810,7 +17810,7 @@ var fileValidationSchema2 = zod.z.object({
17810
17810
  // 50MB max
17811
17811
  });
17812
17812
  var adminMediaRoutes = new hono.Hono();
17813
- adminMediaRoutes.use("*", chunkFCLKX2OS_cjs.requireAuth());
17813
+ adminMediaRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
17814
17814
  adminMediaRoutes.get("/", async (c) => {
17815
17815
  try {
17816
17816
  const user = c.get("user");
@@ -17852,7 +17852,7 @@ adminMediaRoutes.get("/selector", async (c) => {
17852
17852
  const { searchParams } = new URL(c.req.url);
17853
17853
  const search = searchParams.get("search") || "";
17854
17854
  const db = c.env.DB;
17855
- const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
17855
+ const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
17856
17856
  const mediaPlugin = await pluginService.getPlugin("core-media");
17857
17857
  if (!mediaPlugin || mediaPlugin.status !== "active") {
17858
17858
  return c.html(html.html`
@@ -18228,7 +18228,7 @@ adminMediaRoutes.put("/:id", async (c) => {
18228
18228
  `);
18229
18229
  }
18230
18230
  });
18231
- adminMediaRoutes.delete("/cleanup", chunkFCLKX2OS_cjs.requireRole("admin"), async (c) => {
18231
+ adminMediaRoutes.delete("/cleanup", chunkIS54FPB7_cjs.requireRole("admin"), async (c) => {
18232
18232
  try {
18233
18233
  const db = c.env.DB;
18234
18234
  const allMediaStmt = db.prepare("SELECT id, r2_key, filename FROM media WHERE deleted_at IS NULL");
@@ -18486,7 +18486,7 @@ function generateMediaItemHTML(file) {
18486
18486
  }
18487
18487
 
18488
18488
  // src/templates/pages/admin-plugins-list.template.ts
18489
- chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
18489
+ chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
18490
18490
  function renderPluginsListPage(data) {
18491
18491
  const categories = [
18492
18492
  { value: "content", label: "Content Management" },
@@ -18969,7 +18969,7 @@ function renderPluginsListPage(data) {
18969
18969
  version: data.version,
18970
18970
  content: pageContent
18971
18971
  };
18972
- return chunkK623Q6WD_cjs.renderAdminLayoutCatalyst(layoutData);
18972
+ return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
18973
18973
  }
18974
18974
  function renderPluginCard(plugin) {
18975
18975
  const statusColors = {
@@ -19346,8 +19346,9 @@ function escapeHtmlAttr(value) {
19346
19346
  return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
19347
19347
  }
19348
19348
  function renderPluginSettingsPage(data) {
19349
- const { plugin, activity = [], user } = data;
19350
- const hasUserSettings = Object.keys(plugin.settings || {}).some((k) => !k.startsWith("_"));
19349
+ const { plugin, activity = [], user, settingsTabData } = data;
19350
+ const pluginDef = chunk4WMZGHIC_cjs.getPluginDefinition(plugin.id || plugin.name);
19351
+ const hasUserSettings = pluginDef?.settingsTabContent != null || Object.keys(plugin.settings || {}).some((k) => !k.startsWith("_"));
19351
19352
  const defaultTab = hasUserSettings ? "settings" : "info";
19352
19353
  const pageContent = `
19353
19354
  <div class="w-full px-4 sm:px-6 lg:px-8 py-6">
@@ -19427,7 +19428,7 @@ function renderPluginSettingsPage(data) {
19427
19428
  <div id="tab-content">
19428
19429
  <!-- Settings Tab -->
19429
19430
  <div id="settings-content" class="tab-content hidden">
19430
- ${hasUserSettings ? renderSettingsTab(plugin) : ""}
19431
+ ${hasUserSettings ? renderSettingsTab(plugin, settingsTabData) : ""}
19431
19432
  </div>
19432
19433
 
19433
19434
  <!-- Activity Tab -->
@@ -19623,7 +19624,7 @@ function renderPluginSettingsPage(data) {
19623
19624
  user,
19624
19625
  content: pageContent
19625
19626
  };
19626
- return chunkPXNTCCPE_cjs.renderAdminLayout(layoutData);
19627
+ return chunkE66UVONV_cjs.renderAdminLayout(layoutData);
19627
19628
  }
19628
19629
  function renderStatusBadge(status) {
19629
19630
  const statusColors = {
@@ -19648,10 +19649,14 @@ function renderToggleButton(plugin) {
19648
19649
  }
19649
19650
  return plugin.status === "active" ? `<button onclick="togglePlugin('${plugin.id}', 'deactivate')" class="bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-colors">Deactivate</button>` : `<button onclick="togglePlugin('${plugin.id}', 'activate')" class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-colors">Activate</button>`;
19650
19651
  }
19651
- function renderSettingsTab(plugin) {
19652
+ function renderSettingsTab(plugin, settingsTabData) {
19652
19653
  const settings = plugin.settings || {};
19653
19654
  const pluginId = plugin.id || plugin.name;
19654
19655
  const hasUserKeys = Object.keys(settings).some((k) => !k.startsWith("_"));
19656
+ const pluginDef = chunk4WMZGHIC_cjs.getPluginDefinition(pluginId);
19657
+ if (pluginDef?.settingsTabContent) {
19658
+ return pluginDef.settingsTabContent.render({ plugin, settings, data: settingsTabData });
19659
+ }
19655
19660
  const customRenderer = pluginSettingsComponents[pluginId];
19656
19661
  if (customRenderer) {
19657
19662
  return `
@@ -20722,10 +20727,162 @@ defineUserProfile({
20722
20727
  `;
20723
20728
  }
20724
20729
 
20730
+ // src/plugins/core-plugins/menu-plugin/services/menu-reconcile.ts
20731
+ async function upsertPluginRow(db, slug, entry, visible) {
20732
+ const now = Math.floor(Date.now() / 1e3);
20733
+ const existing = await db.prepare(
20734
+ `SELECT id FROM documents
20735
+ WHERE slug = ? AND type_id = 'menu_item' AND tenant_id = 'default'
20736
+ AND is_current_draft = 1 AND deleted_at IS NULL`
20737
+ ).bind(slug).first();
20738
+ if (existing) {
20739
+ await db.prepare(
20740
+ `UPDATE documents
20741
+ SET data = json_set(data, '$.url', ?, '$.pluginId', ?, '$.visible', ?),
20742
+ visible = ?,
20743
+ updated_at = ?
20744
+ WHERE id = ? AND tenant_id = 'default'`
20745
+ ).bind(entry.url, entry.pluginId, visible ? 1 : 0, visible ? 1 : 0, now, existing.id).run();
20746
+ return;
20747
+ }
20748
+ const id = chunkKIGVVO6N_cjs.nanoid();
20749
+ const data = JSON.stringify({
20750
+ label: entry.label,
20751
+ url: entry.url,
20752
+ icon: entry.icon,
20753
+ target: "_self",
20754
+ isExternal: false,
20755
+ visible,
20756
+ parent: null,
20757
+ source: "plugin",
20758
+ pluginId: entry.pluginId,
20759
+ permissions: [],
20760
+ lockedFields: ["url"],
20761
+ sortOrder: entry.sortOrder
20762
+ });
20763
+ await db.prepare(
20764
+ `INSERT INTO documents (id, root_id, type_id, type_version, version_of_id, version_number,
20765
+ is_current_draft, is_published, status, parent_root_id, slug, path, title, zone,
20766
+ sort_order, visible, published_at, scheduled_at, expires_at, deleted_at,
20767
+ tenant_id, locale, translation_group_id, data, metadata,
20768
+ owner_id, created_by, updated_by, created_at, updated_at)
20769
+ VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`
20770
+ ).bind(
20771
+ id,
20772
+ id,
20773
+ "menu_item",
20774
+ 1,
20775
+ null,
20776
+ 1,
20777
+ 1,
20778
+ 0,
20779
+ "draft",
20780
+ "",
20781
+ slug,
20782
+ null,
20783
+ entry.label,
20784
+ null,
20785
+ entry.sortOrder,
20786
+ visible ? 1 : 0,
20787
+ null,
20788
+ null,
20789
+ null,
20790
+ null,
20791
+ "default",
20792
+ "default",
20793
+ "",
20794
+ data,
20795
+ "{}",
20796
+ null,
20797
+ null,
20798
+ null,
20799
+ now,
20800
+ now
20801
+ ).run();
20802
+ }
20803
+ async function deactivateStalePluginRows(db, activePluginIds) {
20804
+ const now = Math.floor(Date.now() / 1e3);
20805
+ const rows = await db.prepare(
20806
+ `SELECT id, data FROM documents
20807
+ WHERE type_id = 'menu_item' AND tenant_id = 'default'
20808
+ AND is_current_draft = 1 AND deleted_at IS NULL
20809
+ AND json_extract(data, '$.source') = 'plugin'`
20810
+ ).all();
20811
+ const stale = (rows.results ?? []).filter((row) => {
20812
+ let pluginId;
20813
+ try {
20814
+ pluginId = JSON.parse(row.data)?.pluginId;
20815
+ } catch {
20816
+ return false;
20817
+ }
20818
+ return pluginId !== void 0 && !activePluginIds.has(pluginId);
20819
+ });
20820
+ if (stale.length === 0) return;
20821
+ await db.batch(
20822
+ stale.map(
20823
+ (row) => db.prepare(
20824
+ `UPDATE documents
20825
+ SET data = json_set(data, '$.visible', 0), visible = 0, updated_at = ?
20826
+ WHERE id = ? AND tenant_id = 'default'`
20827
+ ).bind(now, row.id)
20828
+ )
20829
+ );
20830
+ }
20831
+ async function fetchActivePluginIds(db) {
20832
+ try {
20833
+ const rows = await db.prepare(
20834
+ `SELECT slug FROM documents
20835
+ WHERE type_id = 'plugin' AND tenant_id = 'default'
20836
+ AND is_current_draft = 1 AND deleted_at IS NULL
20837
+ AND json_extract(data, '$.status') = 'active'`
20838
+ ).all();
20839
+ return new Set((rows.results ?? []).map((r) => r.slug));
20840
+ } catch {
20841
+ return /* @__PURE__ */ new Set();
20842
+ }
20843
+ }
20844
+ async function reconcileMenuFromPlugins(db) {
20845
+ try {
20846
+ const singletonEntries = chunk4WMZGHIC_cjs.getPluginMenu();
20847
+ const manifestEntries = Object.values(chunkAT4ZQGEZ_cjs.PLUGIN_REGISTRY).filter(
20848
+ (p) => p.adminMenu !== null
20849
+ );
20850
+ const byPluginId = /* @__PURE__ */ new Map();
20851
+ manifestEntries.forEach((p, idx) => {
20852
+ const menu = p.adminMenu;
20853
+ byPluginId.set(p.id, {
20854
+ pluginId: p.id,
20855
+ label: menu.label,
20856
+ url: menu.path,
20857
+ icon: menu.icon,
20858
+ sortOrder: 100 + idx * 10
20859
+ });
20860
+ });
20861
+ singletonEntries.forEach((entry, idx) => {
20862
+ const pathParts = entry.path.replace(/\/$/, "").split("/");
20863
+ const pluginId = pathParts[pathParts.length - 1] || entry.label.toLowerCase().replace(/\s+/g, "-");
20864
+ byPluginId.set(pluginId, {
20865
+ pluginId,
20866
+ label: entry.label,
20867
+ url: entry.path,
20868
+ icon: entry.icon ?? "puzzle-piece",
20869
+ sortOrder: 100 + idx * 10
20870
+ });
20871
+ });
20872
+ const activeIds = await fetchActivePluginIds(db);
20873
+ for (const [pluginId, entry] of byPluginId) {
20874
+ const slug = `menu:plugin:${pluginId}`;
20875
+ await upsertPluginRow(db, slug, entry, activeIds.has(pluginId));
20876
+ }
20877
+ await deactivateStalePluginRows(db, activeIds);
20878
+ } catch {
20879
+ }
20880
+ }
20881
+
20725
20882
  // src/routes/admin-plugins.ts
20726
20883
  var adminPluginRoutes = new hono.Hono();
20727
- adminPluginRoutes.use("*", chunkFCLKX2OS_cjs.requireAuth());
20728
- var AVAILABLE_PLUGINS = Object.values(chunkKVBHB7QP_cjs.PLUGIN_REGISTRY).map((p) => ({
20884
+ adminPluginRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
20885
+ var AVAILABLE_PLUGINS = Object.values(chunkAT4ZQGEZ_cjs.PLUGIN_REGISTRY).map((p) => ({
20729
20886
  id: p.id,
20730
20887
  name: p.codeName,
20731
20888
  display_name: p.displayName,
@@ -20745,7 +20902,7 @@ adminPluginRoutes.get("/", async (c) => {
20745
20902
  if (user?.role !== "admin") {
20746
20903
  return c.text("Access denied", 403);
20747
20904
  }
20748
- const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
20905
+ const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
20749
20906
  let installedPlugins = [];
20750
20907
  let stats = { total: 0, active: 0, inactive: 0, errors: 0, uninstalled: 0 };
20751
20908
  try {
@@ -20754,9 +20911,11 @@ adminPluginRoutes.get("/", async (c) => {
20754
20911
  } catch (error) {
20755
20912
  console.error("Error loading plugins:", error);
20756
20913
  }
20757
- const installedPluginIds = new Set(installedPlugins.map((p) => p.id));
20914
+ const registryIds = new Set(AVAILABLE_PLUGINS.map((p) => p.id));
20915
+ const validInstalledPlugins = installedPlugins.filter((p) => registryIds.has(p.id));
20916
+ const installedPluginIds = new Set(validInstalledPlugins.map((p) => p.id));
20758
20917
  const uninstalledPlugins = AVAILABLE_PLUGINS.filter((p) => !installedPluginIds.has(p.id));
20759
- const templatePlugins = installedPlugins.map((p) => ({
20918
+ const templatePlugins = validInstalledPlugins.map((p) => ({
20760
20919
  id: p.id,
20761
20920
  name: p.name,
20762
20921
  displayName: p.display_name,
@@ -20792,7 +20951,7 @@ adminPluginRoutes.get("/", async (c) => {
20792
20951
  }));
20793
20952
  const allPlugins = [...templatePlugins, ...uninstalledTemplatePlugins];
20794
20953
  stats.uninstalled = uninstalledPlugins.length;
20795
- stats.total = installedPlugins.length + uninstalledPlugins.length;
20954
+ stats.total = validInstalledPlugins.length + uninstalledPlugins.length;
20796
20955
  const pageData = {
20797
20956
  plugins: allPlugins,
20798
20957
  stats,
@@ -20817,10 +20976,10 @@ adminPluginRoutes.get("/:id", async (c) => {
20817
20976
  if (user?.role !== "admin") {
20818
20977
  return c.redirect("/admin/plugins");
20819
20978
  }
20820
- const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
20979
+ const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
20821
20980
  let plugin = await pluginService.getPlugin(pluginId);
20822
20981
  if (!plugin) {
20823
- const def = chunkA4KUJ3LD_cjs.getPluginDefinition(pluginId);
20982
+ const def = chunk4WMZGHIC_cjs.getPluginDefinition(pluginId);
20824
20983
  if (!def) return c.text("Plugin not found", 404);
20825
20984
  plugin = await pluginService.ensurePlugin(pluginId, {
20826
20985
  displayName: def.displayName ?? pluginId,
@@ -20891,6 +21050,15 @@ adminPluginRoutes.get("/:id", async (c) => {
20891
21050
  timestamp: item.timestamp,
20892
21051
  user: item.userId || null
20893
21052
  }));
21053
+ const pluginDef = chunk4WMZGHIC_cjs.getPluginDefinition(pluginId);
21054
+ let settingsTabData = void 0;
21055
+ if (pluginDef?.settingsTabContent?.loadData) {
21056
+ try {
21057
+ settingsTabData = await pluginDef.settingsTabContent.loadData(db);
21058
+ } catch (e) {
21059
+ console.error(`settingsTabContent.loadData failed for plugin "${pluginId}":`, e);
21060
+ }
21061
+ }
20894
21062
  const pageData = {
20895
21063
  plugin: templatePlugin,
20896
21064
  activity: templateActivity,
@@ -20898,7 +21066,8 @@ adminPluginRoutes.get("/:id", async (c) => {
20898
21066
  name: user?.email || "User",
20899
21067
  email: user?.email || "",
20900
21068
  role: user?.role || "user"
20901
- }
21069
+ },
21070
+ settingsTabData
20902
21071
  };
20903
21072
  return c.html(renderPluginSettingsPage(pageData));
20904
21073
  } catch (error) {
@@ -20911,14 +21080,14 @@ adminPluginRoutes.get("/:id/configure", async (c) => {
20911
21080
  const user = c.get("user");
20912
21081
  const pluginId = c.req.param("id");
20913
21082
  if (user?.role !== "admin") return c.redirect("/admin/plugins");
20914
- const def = chunkA4KUJ3LD_cjs.getPluginDefinition(pluginId);
21083
+ const def = chunk4WMZGHIC_cjs.getPluginDefinition(pluginId);
20915
21084
  if (!def?.configSchema) return c.text("No schema-driven settings for this plugin", 404);
20916
21085
  const db = c.env.DB;
20917
- const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
21086
+ const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
20918
21087
  const plugin = await pluginService.getPlugin(pluginId);
20919
21088
  const stored = plugin?.settings ?? {};
20920
- const values = chunkA4KUJ3LD_cjs.applySchemaDefaults(def.configSchema, stored);
20921
- const fieldsHtml = chunkA4KUJ3LD_cjs.renderSchemaFields(def.configSchema, values);
21089
+ const values = chunk4WMZGHIC_cjs.applySchemaDefaults(def.configSchema, stored);
21090
+ const fieldsHtml = chunk4WMZGHIC_cjs.renderSchemaFields(def.configSchema, values);
20922
21091
  const displayName = plugin?.display_name ?? def.displayName ?? def.id;
20923
21092
  return c.html(`<!DOCTYPE html>
20924
21093
  <html lang="en"><head>
@@ -20945,12 +21114,12 @@ adminPluginRoutes.post("/:id/configure", async (c) => {
20945
21114
  const user = c.get("user");
20946
21115
  const pluginId = c.req.param("id");
20947
21116
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
20948
- const def = chunkA4KUJ3LD_cjs.getPluginDefinition(pluginId);
21117
+ const def = chunk4WMZGHIC_cjs.getPluginDefinition(pluginId);
20949
21118
  if (!def?.configSchema) return c.text("No schema-driven settings for this plugin", 404);
20950
21119
  const form = await c.req.formData();
20951
- const parsed = chunkA4KUJ3LD_cjs.parseFormDataToSettings(def.configSchema, form);
21120
+ const parsed = chunk4WMZGHIC_cjs.parseFormDataToSettings(def.configSchema, form);
20952
21121
  const db = c.env.DB;
20953
- const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
21122
+ const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
20954
21123
  await pluginService.ensurePlugin(pluginId, {
20955
21124
  displayName: def.displayName ?? pluginId,
20956
21125
  version: def.version,
@@ -20974,8 +21143,9 @@ adminPluginRoutes.post("/:id/activate", async (c) => {
20974
21143
  if (user?.role !== "admin") {
20975
21144
  return c.json({ error: "Access denied" }, 403);
20976
21145
  }
20977
- const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
21146
+ const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
20978
21147
  await pluginService.activatePlugin(pluginId);
21148
+ await reconcileMenuFromPlugins(db);
20979
21149
  return c.json({ success: true });
20980
21150
  } catch (error) {
20981
21151
  console.error("Error activating plugin:", error);
@@ -20991,8 +21161,9 @@ adminPluginRoutes.post("/:id/deactivate", async (c) => {
20991
21161
  if (user?.role !== "admin") {
20992
21162
  return c.json({ error: "Access denied" }, 403);
20993
21163
  }
20994
- const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
21164
+ const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
20995
21165
  await pluginService.deactivatePlugin(pluginId);
21166
+ await reconcileMenuFromPlugins(db);
20996
21167
  return c.json({ success: true });
20997
21168
  } catch (error) {
20998
21169
  console.error("Error deactivating plugin:", error);
@@ -21008,8 +21179,8 @@ adminPluginRoutes.post("/install", async (c) => {
21008
21179
  return c.json({ error: "Access denied" }, 403);
21009
21180
  }
21010
21181
  const body = await c.req.json();
21011
- const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
21012
- const registryEntry = chunkKVBHB7QP_cjs.findPluginByCodeName(body.name) || chunkKVBHB7QP_cjs.PLUGIN_REGISTRY[body.name] || chunkKVBHB7QP_cjs.PLUGIN_REGISTRY[body.id];
21182
+ const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
21183
+ const registryEntry = chunkAT4ZQGEZ_cjs.findPluginByCodeName(body.name) || chunkAT4ZQGEZ_cjs.PLUGIN_REGISTRY[body.name] || chunkAT4ZQGEZ_cjs.PLUGIN_REGISTRY[body.id];
21013
21184
  if (!registryEntry) {
21014
21185
  return c.json({ error: "Plugin not found in registry" }, 404);
21015
21186
  }
@@ -21042,7 +21213,7 @@ adminPluginRoutes.post("/:id/uninstall", async (c) => {
21042
21213
  if (user?.role !== "admin") {
21043
21214
  return c.json({ error: "Access denied" }, 403);
21044
21215
  }
21045
- const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
21216
+ const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
21046
21217
  await pluginService.uninstallPlugin(pluginId);
21047
21218
  return c.json({ success: true });
21048
21219
  } catch (error) {
@@ -21060,7 +21231,7 @@ adminPluginRoutes.post("/:id/settings", async (c) => {
21060
21231
  return c.json({ error: "Access denied" }, 403);
21061
21232
  }
21062
21233
  const settings = await c.req.json();
21063
- const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
21234
+ const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
21064
21235
  const existingPlugin = await pluginService.getPlugin(pluginId);
21065
21236
  const existingSettings = existingPlugin?.settings ?? {};
21066
21237
  await pluginService.updatePluginSettings(pluginId, { ...existingSettings, ...settings });
@@ -21095,7 +21266,7 @@ function formatLastUpdated(timestamp) {
21095
21266
  }
21096
21267
 
21097
21268
  // src/templates/pages/admin-logs-list.template.ts
21098
- chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
21269
+ chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
21099
21270
  function renderLogsListPage(data) {
21100
21271
  const { logs, pagination, filters, user } = data;
21101
21272
  const content = `
@@ -21406,7 +21577,7 @@ function renderLogsListPage(data) {
21406
21577
  user,
21407
21578
  content
21408
21579
  };
21409
- return chunkK623Q6WD_cjs.renderAdminLayoutCatalyst(layoutData);
21580
+ return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
21410
21581
  }
21411
21582
  function renderLogDetailsPage(data) {
21412
21583
  const { log, user } = data;
@@ -21618,7 +21789,7 @@ function renderLogDetailsPage(data) {
21618
21789
  </div>
21619
21790
  </div>
21620
21791
  `;
21621
- return chunkPXNTCCPE_cjs.adminLayoutV2({
21792
+ return chunkE66UVONV_cjs.adminLayoutV2({
21622
21793
  title: `Log Details - ${log.id}`,
21623
21794
  user,
21624
21795
  content
@@ -21861,7 +22032,7 @@ function renderLogConfigPage(data) {
21861
22032
 
21862
22033
  <script src="https://unpkg.com/htmx.org@1.9.6"></script>
21863
22034
  `;
21864
- return chunkPXNTCCPE_cjs.adminLayoutV2({
22035
+ return chunkE66UVONV_cjs.adminLayoutV2({
21865
22036
  title: "Log Configuration",
21866
22037
  user,
21867
22038
  content
@@ -21870,7 +22041,7 @@ function renderLogConfigPage(data) {
21870
22041
 
21871
22042
  // src/routes/admin-logs.ts
21872
22043
  var adminLogsRoutes = new hono.Hono();
21873
- adminLogsRoutes.use("*", chunkFCLKX2OS_cjs.requireAuth());
22044
+ adminLogsRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
21874
22045
  adminLogsRoutes.get("/", async (c) => {
21875
22046
  try {
21876
22047
  const user = c.get("user");
@@ -22242,7 +22413,7 @@ adminCheckboxRoutes.get("/", (c) => {
22242
22413
  role: user.role
22243
22414
  } : void 0
22244
22415
  };
22245
- return c.html(chunkPXNTCCPE_cjs.renderCheckboxPage(pageData));
22416
+ return c.html(chunkE66UVONV_cjs.renderCheckboxPage(pageData));
22246
22417
  });
22247
22418
 
22248
22419
  // src/templates/pages/admin-dashboard.template.ts
@@ -22314,7 +22485,7 @@ function renderDashboardPage(data) {
22314
22485
  version: data.version,
22315
22486
  content: pageContent
22316
22487
  };
22317
- return chunkPXNTCCPE_cjs.renderAdminLayout(layoutData);
22488
+ return chunkE66UVONV_cjs.renderAdminLayout(layoutData);
22318
22489
  }
22319
22490
  function renderStatsCards(stats) {
22320
22491
  const cards = [
@@ -22862,9 +23033,9 @@ function renderStorageUsage(databaseSizeBytes, mediaSizeBytes) {
22862
23033
  }
22863
23034
 
22864
23035
  // src/routes/admin-dashboard.ts
22865
- var VERSION = chunkAOUVUF32_cjs.getCoreVersion();
23036
+ var VERSION = chunkC3ZQP5NW_cjs.getCoreVersion();
22866
23037
  var router = new hono.Hono();
22867
- router.use("*", chunkFCLKX2OS_cjs.requireAuth());
23038
+ router.use("*", chunkIS54FPB7_cjs.requireAuth());
22868
23039
  router.get("/", async (c) => {
22869
23040
  const user = c.get("user");
22870
23041
  try {
@@ -23054,7 +23225,7 @@ router.get("/system-status", async (c) => {
23054
23225
  });
23055
23226
 
23056
23227
  // src/templates/pages/admin-collections-list.template.ts
23057
- chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
23228
+ chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
23058
23229
 
23059
23230
  // src/templates/components/table.template.ts
23060
23231
  function renderTable2(data) {
@@ -23536,11 +23707,11 @@ function renderCollectionsListPage(data) {
23536
23707
  version: data.version,
23537
23708
  content: pageContent
23538
23709
  };
23539
- return chunkK623Q6WD_cjs.renderAdminLayoutCatalyst(layoutData);
23710
+ return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
23540
23711
  }
23541
23712
 
23542
23713
  // src/templates/pages/admin-collections-form.template.ts
23543
- chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
23714
+ chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
23544
23715
  function getFieldTypeBadge(fieldType) {
23545
23716
  const typeLabels = {
23546
23717
  "text": "Text",
@@ -23713,8 +23884,8 @@ function renderCollectionFormPage(data) {
23713
23884
  <!-- Form Content -->
23714
23885
  <div class="px-6 py-6">
23715
23886
  <div id="form-messages"></div>
23716
- ${data.error ? chunkN32OWET6_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
23717
- ${data.success ? chunkN32OWET6_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
23887
+ ${data.error ? chunkJMJM7DMM_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
23888
+ ${data.success ? chunkJMJM7DMM_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
23718
23889
 
23719
23890
  <!-- Form Styling -->
23720
23891
  <style>
@@ -23825,7 +23996,7 @@ function renderCollectionFormPage(data) {
23825
23996
  }
23826
23997
  </style>
23827
23998
 
23828
- ${chunkPXNTCCPE_cjs.renderForm(formData)}
23999
+ ${chunkE66UVONV_cjs.renderForm(formData)}
23829
24000
 
23830
24001
  ${isEdit && data.managed ? `
23831
24002
  <!-- Read-Only Fields Display for Managed Collections -->
@@ -24823,13 +24994,13 @@ function renderCollectionFormPage(data) {
24823
24994
  version: data.version,
24824
24995
  content: pageContent
24825
24996
  };
24826
- return chunkK623Q6WD_cjs.renderAdminLayoutCatalyst(layoutData);
24997
+ return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
24827
24998
  }
24828
24999
 
24829
25000
  // src/routes/admin-collections.ts
24830
- chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
25001
+ chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
24831
25002
  var adminCollectionsRoutes = new hono.Hono();
24832
- adminCollectionsRoutes.use("*", chunkFCLKX2OS_cjs.requireAuth());
25003
+ adminCollectionsRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
24833
25004
  adminCollectionsRoutes.get("/", async (c) => {
24834
25005
  try {
24835
25006
  const user = c.get("user");
@@ -24846,7 +25017,7 @@ adminCollectionsRoutes.get("/", async (c) => {
24846
25017
  results = queryResults.results ?? [];
24847
25018
  } catch (e) {
24848
25019
  }
24849
- const codeCollections = chunkKVBHB7QP_cjs.getCollectionRegistry().list();
25020
+ const codeCollections = chunkAT4ZQGEZ_cjs.getCollectionRegistry().list();
24850
25021
  const codeCollectionsMap = new Map(
24851
25022
  codeCollections.map((cfg) => {
24852
25023
  const fieldCount = cfg.schema?.properties ? Object.keys(cfg.schema.properties).length : 0;
@@ -24860,7 +25031,7 @@ adminCollectionsRoutes.get("/", async (c) => {
24860
25031
  field_count: fieldCount,
24861
25032
  managed: cfg.managed !== false,
24862
25033
  source_type: "code",
24863
- internal: chunkKVBHB7QP_cjs.isCodeCollectionInternal(cfg),
25034
+ internal: chunkAT4ZQGEZ_cjs.isCodeCollectionInternal(cfg),
24864
25035
  versioning: cfg.versioning === true
24865
25036
  }];
24866
25037
  })
@@ -24899,7 +25070,7 @@ adminCollectionsRoutes.get("/", async (c) => {
24899
25070
  field_count: fieldCount,
24900
25071
  managed: false,
24901
25072
  source_type: row.source === "code" || row.source === "system" || row.source === "plugin" ? "code" : "user",
24902
- internal: chunkKVBHB7QP_cjs.isDbDocTypeInternal(row.source),
25073
+ internal: chunkAT4ZQGEZ_cjs.isDbDocTypeInternal(row.source),
24903
25074
  versioning: dbVersioning
24904
25075
  };
24905
25076
  });
@@ -25056,11 +25227,11 @@ export const myPlugin = definePlugin({
25056
25227
  `;
25057
25228
  const u = user;
25058
25229
  return c.html(
25059
- chunkK623Q6WD_cjs.renderAdminLayoutCatalyst({
25230
+ chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
25060
25231
  title: "Add a Collection",
25061
25232
  pageTitle: "Add a Collection",
25062
25233
  currentPath: "/admin/collections",
25063
- version: chunkAOUVUF32_cjs.getCoreVersion(),
25234
+ version: chunkC3ZQP5NW_cjs.getCoreVersion(),
25064
25235
  user: u ? { name: u.email ?? "Admin", email: u.email ?? "", role: u.role ?? "admin" } : void 0,
25065
25236
  content
25066
25237
  })
@@ -25077,7 +25248,7 @@ adminCollectionsRoutes.get("/:id", async (c) => {
25077
25248
  collection = await stmt.bind(id).first();
25078
25249
  } catch {
25079
25250
  }
25080
- const registryRecord = chunkKVBHB7QP_cjs.getCollectionRegistry().getById(id) ?? chunkKVBHB7QP_cjs.getCollectionRegistry().getByName(id);
25251
+ const registryRecord = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getById(id) ?? chunkAT4ZQGEZ_cjs.getCollectionRegistry().getByName(id);
25081
25252
  if (!collection && !registryRecord) {
25082
25253
  const formData2 = {
25083
25254
  isEdit: true,
@@ -25124,9 +25295,9 @@ adminCollectionsRoutes.get("/:id", async (c) => {
25124
25295
  isCodeDriven = true;
25125
25296
  }
25126
25297
  const [tinymceActive, quillActive, mdxeditorActive] = await Promise.all([
25127
- chunkFCLKX2OS_cjs.isPluginActive(db, "tinymce-plugin"),
25128
- chunkFCLKX2OS_cjs.isPluginActive(db, "quill-editor"),
25129
- chunkFCLKX2OS_cjs.isPluginActive(db, "easy-mdx")
25298
+ chunkIS54FPB7_cjs.isPluginActive(db, "tinymce-plugin"),
25299
+ chunkIS54FPB7_cjs.isPluginActive(db, "quill-editor"),
25300
+ chunkIS54FPB7_cjs.isPluginActive(db, "easy-mdx")
25130
25301
  ]);
25131
25302
  const displayName = collection?.display_name ?? registryRecord?.displayName ?? id;
25132
25303
  const formData = {
@@ -25146,9 +25317,9 @@ adminCollectionsRoutes.get("/:id", async (c) => {
25146
25317
  console.error("Error fetching collection:", error);
25147
25318
  const user = c.get("user");
25148
25319
  const [tinymceActive, quillActive, mdxeditorActive] = await Promise.all([
25149
- chunkFCLKX2OS_cjs.isPluginActive(db, "tinymce-plugin"),
25150
- chunkFCLKX2OS_cjs.isPluginActive(db, "quill-editor"),
25151
- chunkFCLKX2OS_cjs.isPluginActive(db, "easy-mdx")
25320
+ chunkIS54FPB7_cjs.isPluginActive(db, "tinymce-plugin"),
25321
+ chunkIS54FPB7_cjs.isPluginActive(db, "quill-editor"),
25322
+ chunkIS54FPB7_cjs.isPluginActive(db, "easy-mdx")
25152
25323
  ]);
25153
25324
  const formData = {
25154
25325
  isEdit: true,
@@ -25162,7 +25333,7 @@ adminCollectionsRoutes.get("/:id", async (c) => {
25162
25333
  });
25163
25334
 
25164
25335
  // src/templates/pages/admin-settings.template.ts
25165
- chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
25336
+ chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
25166
25337
  function renderSettingsPage(data) {
25167
25338
  const activeTab = data.activeTab || "general";
25168
25339
  const pageContent = `
@@ -25552,7 +25723,7 @@ function renderSettingsPage(data) {
25552
25723
  version: data.version,
25553
25724
  content: pageContent
25554
25725
  };
25555
- return chunkK623Q6WD_cjs.renderAdminLayoutCatalyst(layoutData);
25726
+ return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
25556
25727
  }
25557
25728
  function renderTabButton(tabId, label, iconPath, activeTab) {
25558
25729
  const isActive = activeTab === tabId;
@@ -26097,7 +26268,7 @@ function renderDatabaseToolsSettings(settings) {
26097
26268
 
26098
26269
  // src/routes/admin-settings.ts
26099
26270
  var adminSettingsRoutes = new hono.Hono();
26100
- adminSettingsRoutes.use("*", chunkFCLKX2OS_cjs.requireAuth());
26271
+ adminSettingsRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
26101
26272
  function getMockSettings(user) {
26102
26273
  return {
26103
26274
  general: {
@@ -26200,7 +26371,7 @@ adminSettingsRoutes.get("/database-tools", (c) => {
26200
26371
  adminSettingsRoutes.get("/api/migrations/status", async (c) => {
26201
26372
  try {
26202
26373
  const db = c.env.DB;
26203
- const migrationService = new chunkOJC4G5JE_cjs.MigrationService(db);
26374
+ const migrationService = new chunkVGHEKIJL_cjs.MigrationService(db);
26204
26375
  const status = await migrationService.getMigrationStatus();
26205
26376
  return c.json({
26206
26377
  success: true,
@@ -26240,7 +26411,7 @@ adminSettingsRoutes.post("/api/migrations/run", async (c) => {
26240
26411
  adminSettingsRoutes.get("/api/migrations/validate", async (c) => {
26241
26412
  try {
26242
26413
  const db = c.env.DB;
26243
- const migrationService = new chunkOJC4G5JE_cjs.MigrationService(db);
26414
+ const migrationService = new chunkVGHEKIJL_cjs.MigrationService(db);
26244
26415
  const validation = await migrationService.validateSchema();
26245
26416
  return c.json({
26246
26417
  success: true,
@@ -26498,7 +26669,7 @@ adminSettingsRoutes.post("/", async (c) => {
26498
26669
  });
26499
26670
 
26500
26671
  // src/templates/pages/admin-api-reference.template.ts
26501
- chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
26672
+ chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
26502
26673
  function renderAuthBadge(auth) {
26503
26674
  if (auth === true) {
26504
26675
  return `
@@ -26829,20 +27000,20 @@ function renderAPIReferencePage(data) {
26829
27000
  version: data.version,
26830
27001
  content: pageContent
26831
27002
  };
26832
- return chunkK623Q6WD_cjs.renderAdminLayoutCatalyst(layoutData);
27003
+ return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
26833
27004
  }
26834
27005
 
26835
27006
  // src/routes/admin-api-reference.ts
26836
- var VERSION2 = chunkAOUVUF32_cjs.getCoreVersion();
27007
+ var VERSION2 = chunkC3ZQP5NW_cjs.getCoreVersion();
26837
27008
  var router2 = new hono.Hono();
26838
- router2.use("*", chunkFCLKX2OS_cjs.requireAuth());
27009
+ router2.use("*", chunkIS54FPB7_cjs.requireAuth());
26839
27010
  router2.get("/", async (c) => {
26840
27011
  const user = c.get("user");
26841
27012
  try {
26842
27013
  const app2 = chunk36Z3AKX3_cjs.getAppInstance();
26843
27014
  const baseEndpoints = chunk36Z3AKX3_cjs.buildRouteList(app2);
26844
27015
  const collectionRoutes = [];
26845
- const collections = chunkKVBHB7QP_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal);
27016
+ const collections = chunkAT4ZQGEZ_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal);
26846
27017
  const methodOrder = { GET: 0, POST: 1, PUT: 2, PATCH: 3, DELETE: 4 };
26847
27018
  for (const col of collections) {
26848
27019
  const displayName = col.displayName || col.name;
@@ -26948,6 +27119,7 @@ exports.hasEmailService = hasEmailService;
26948
27119
  exports.invalidateVariablesCache = invalidateVariablesCache;
26949
27120
  exports.isValidMemberRole = isValidMemberRole;
26950
27121
  exports.lexicalEditorPlugin = lexicalEditorPlugin;
27122
+ exports.reconcileMenuFromPlugins = reconcileMenuFromPlugins;
26951
27123
  exports.renderConfirmationDialog = renderConfirmationDialog2;
26952
27124
  exports.renderTable = renderTable2;
26953
27125
  exports.resolveDocScope = resolveDocScope;
@@ -26959,5 +27131,5 @@ exports.setVariablesCache = setVariablesCache;
26959
27131
  exports.test_cleanup_default = test_cleanup_default;
26960
27132
  exports.userProfilesPlugin = userProfilesPlugin;
26961
27133
  exports.userRoutes = userRoutes;
26962
- //# sourceMappingURL=chunk-7RUW244J.cjs.map
26963
- //# sourceMappingURL=chunk-7RUW244J.cjs.map
27134
+ //# sourceMappingURL=chunk-CTYLCWMO.cjs.map
27135
+ //# sourceMappingURL=chunk-CTYLCWMO.cjs.map