@sonicjs-cms/core 3.0.0-beta.24 → 3.0.0-beta.25

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 (137) hide show
  1. package/bin/db-reset.js +39 -22
  2. package/dist/admin-documents-form.template-JWV5GITD.js +6 -0
  3. package/dist/{admin-documents-form.template-55V2ZGWT.js.map → admin-documents-form.template-JWV5GITD.js.map} +1 -1
  4. package/dist/admin-documents-form.template-UWKGVAMW.cjs +19 -0
  5. package/dist/{admin-layout-catalyst.template-6UQGLCKI.js.map → admin-documents-form.template-UWKGVAMW.cjs.map} +1 -1
  6. package/dist/admin-layout-catalyst.template-MOQ3BBXA.cjs +21 -0
  7. package/dist/{admin-layout-catalyst.template-3XZXDGF7.cjs.map → admin-layout-catalyst.template-MOQ3BBXA.cjs.map} +1 -1
  8. package/dist/admin-layout-catalyst.template-WCYMQVTZ.js +7 -0
  9. package/dist/{admin-documents-form.template-YNAVMJCV.cjs.map → admin-layout-catalyst.template-WCYMQVTZ.js.map} +1 -1
  10. package/dist/{chunk-RJ2O5IIE.js → chunk-2D3A4X52.js} +2 -2
  11. package/dist/{chunk-RJ2O5IIE.js.map → chunk-2D3A4X52.js.map} +1 -1
  12. package/dist/{chunk-FHPEM77Y.js → chunk-2OXFMMA3.js} +11 -10
  13. package/dist/chunk-2OXFMMA3.js.map +1 -0
  14. package/dist/{chunk-SOZUG52O.js → chunk-3KGY4IBW.js} +3 -3
  15. package/dist/{chunk-SOZUG52O.js.map → chunk-3KGY4IBW.js.map} +1 -1
  16. package/dist/{chunk-I767LVN7.cjs → chunk-6OA77UM7.cjs} +757 -471
  17. package/dist/chunk-6OA77UM7.cjs.map +1 -0
  18. package/dist/{chunk-URIBTX27.js → chunk-73RTFFMX.js} +3 -3
  19. package/dist/{chunk-URIBTX27.js.map → chunk-73RTFFMX.js.map} +1 -1
  20. package/dist/{chunk-VC5XVPLM.js → chunk-7P5OCUPS.js} +424 -138
  21. package/dist/chunk-7P5OCUPS.js.map +1 -0
  22. package/dist/{chunk-3TMTYJAJ.js → chunk-BDQ55MWV.js} +18 -2
  23. package/dist/chunk-BDQ55MWV.js.map +1 -0
  24. package/dist/{chunk-KKNEYIZJ.cjs → chunk-BJ6NJL2E.cjs} +7 -12
  25. package/dist/chunk-BJ6NJL2E.cjs.map +1 -0
  26. package/dist/{chunk-VGEZNFWH.js → chunk-C54MH5UI.js} +5 -4
  27. package/dist/chunk-C54MH5UI.js.map +1 -0
  28. package/dist/{chunk-BBEKHLTW.cjs → chunk-CN3T3TDI.cjs} +9 -9
  29. package/dist/{chunk-BBEKHLTW.cjs.map → chunk-CN3T3TDI.cjs.map} +1 -1
  30. package/dist/{chunk-LNI3FYSI.js → chunk-CWIGQYRR.js} +7 -12
  31. package/dist/chunk-CWIGQYRR.js.map +1 -0
  32. package/dist/{chunk-BP52BFIV.cjs → chunk-D6FWEYQE.cjs} +6 -5
  33. package/dist/chunk-D6FWEYQE.cjs.map +1 -0
  34. package/dist/{chunk-UIHIXTIS.js → chunk-D7RLBBHE.js} +2 -2
  35. package/dist/{chunk-UIHIXTIS.js.map → chunk-D7RLBBHE.js.map} +1 -1
  36. package/dist/{chunk-IXUHXTHW.cjs → chunk-DLTT7QZU.cjs} +17 -6
  37. package/dist/chunk-DLTT7QZU.cjs.map +1 -0
  38. package/dist/{chunk-BHND5PEV.js → chunk-E3TQG7AA.js} +3 -3
  39. package/dist/{chunk-BHND5PEV.js.map → chunk-E3TQG7AA.js.map} +1 -1
  40. package/dist/{chunk-37V3RET3.cjs → chunk-E7E3NL3Y.cjs} +24 -23
  41. package/dist/chunk-E7E3NL3Y.cjs.map +1 -0
  42. package/dist/{chunk-VYQVDL2M.js → chunk-F26HP3B6.js} +36 -5
  43. package/dist/chunk-F26HP3B6.js.map +1 -0
  44. package/dist/{chunk-QZGABF2M.js → chunk-FVAK4C6L.js} +17 -6
  45. package/dist/chunk-FVAK4C6L.js.map +1 -0
  46. package/dist/{chunk-BJROXF4N.js → chunk-HSDJDWLV.js} +19 -4
  47. package/dist/chunk-HSDJDWLV.js.map +1 -0
  48. package/dist/{chunk-QJUJNTIU.cjs → chunk-I7MIRRFJ.cjs} +43 -12
  49. package/dist/chunk-I7MIRRFJ.cjs.map +1 -0
  50. package/dist/{chunk-LTZ5WYOK.cjs → chunk-JCBDXEY2.cjs} +18 -2
  51. package/dist/chunk-JCBDXEY2.cjs.map +1 -0
  52. package/dist/{chunk-UYJQDDEE.cjs → chunk-MI2YXCK4.cjs} +14 -8
  53. package/dist/chunk-MI2YXCK4.cjs.map +1 -0
  54. package/dist/{chunk-A2SN3RVL.cjs → chunk-MOGK3U4A.cjs} +2 -2
  55. package/dist/{chunk-A2SN3RVL.cjs.map → chunk-MOGK3U4A.cjs.map} +1 -1
  56. package/dist/{chunk-E66UVONV.cjs → chunk-OUBUS74I.cjs} +24 -9
  57. package/dist/chunk-OUBUS74I.cjs.map +1 -0
  58. package/dist/{chunk-GMMCCIQO.cjs → chunk-RSBZITK3.cjs} +3 -3
  59. package/dist/{chunk-GMMCCIQO.cjs.map → chunk-RSBZITK3.cjs.map} +1 -1
  60. package/dist/{chunk-THFZSDIU.js → chunk-SXC4HPK6.js} +14 -8
  61. package/dist/chunk-SXC4HPK6.js.map +1 -0
  62. package/dist/{chunk-JMJM7DMM.cjs → chunk-TT3TQSCZ.cjs} +5 -5
  63. package/dist/{chunk-JMJM7DMM.cjs.map → chunk-TT3TQSCZ.cjs.map} +1 -1
  64. package/dist/{chunk-QCJHCSOK.cjs → chunk-YAURVGUK.cjs} +2 -2
  65. package/dist/{chunk-QCJHCSOK.cjs.map → chunk-YAURVGUK.cjs.map} +1 -1
  66. package/dist/config-4TIHSNW6.js +6 -0
  67. package/dist/{config-6FB2BXMP.js.map → config-4TIHSNW6.js.map} +1 -1
  68. package/dist/{config-OCH7S4WK.cjs → config-XN2ETAJ3.cjs} +5 -5
  69. package/dist/{config-OCH7S4WK.cjs.map → config-XN2ETAJ3.cjs.map} +1 -1
  70. package/dist/{define-plugin-D_6D9vVZ.d.ts → define-plugin-DDe8a_bh.d.ts} +3 -0
  71. package/dist/{define-plugin-DMcvEy_C.d.cts → define-plugin-rjXmGOgu.d.cts} +3 -0
  72. package/dist/index.cjs +408 -370
  73. package/dist/index.cjs.map +1 -1
  74. package/dist/index.d.cts +10 -2
  75. package/dist/index.d.ts +10 -2
  76. package/dist/index.js +67 -29
  77. package/dist/index.js.map +1 -1
  78. package/dist/middleware.cjs +35 -35
  79. package/dist/middleware.d.cts +4 -1
  80. package/dist/middleware.d.ts +4 -1
  81. package/dist/middleware.js +6 -6
  82. package/dist/migrations-JAHMI5MK.js +4 -0
  83. package/dist/{migrations-Z6D27NAW.js.map → migrations-JAHMI5MK.js.map} +1 -1
  84. package/dist/migrations-KU4V6T73.cjs +13 -0
  85. package/dist/{migrations-FGXZPKDC.cjs.map → migrations-KU4V6T73.cjs.map} +1 -1
  86. package/dist/plugins.cjs +40 -40
  87. package/dist/plugins.d.cts +1 -1
  88. package/dist/plugins.d.ts +1 -1
  89. package/dist/plugins.js +3 -3
  90. package/dist/rbac-AORZ6O3N.cjs +14 -0
  91. package/dist/{rbac-7QZ4JZ2E.cjs.map → rbac-AORZ6O3N.cjs.map} +1 -1
  92. package/dist/rbac-P44772FP.js +5 -0
  93. package/dist/{rbac-Y43IEQOP.js.map → rbac-P44772FP.js.map} +1 -1
  94. package/dist/routes.cjs +31 -31
  95. package/dist/routes.js +11 -11
  96. package/dist/services.cjs +18 -18
  97. package/dist/services.d.cts +1 -1
  98. package/dist/services.d.ts +1 -1
  99. package/dist/services.js +2 -2
  100. package/dist/{telemetry-Cku1ax74.d.cts → telemetry-QFlTv9f8.d.cts} +1 -1
  101. package/dist/{telemetry-Cku1ax74.d.ts → telemetry-QFlTv9f8.d.ts} +1 -1
  102. package/dist/templates.cjs +17 -17
  103. package/dist/templates.js +3 -3
  104. package/dist/types.d.cts +1 -1
  105. package/dist/types.d.ts +1 -1
  106. package/dist/utils.cjs +12 -12
  107. package/dist/utils.d.cts +1 -1
  108. package/dist/utils.d.ts +1 -1
  109. package/dist/utils.js +2 -2
  110. package/package.json +5 -10
  111. package/dist/admin-documents-form.template-55V2ZGWT.js +0 -6
  112. package/dist/admin-documents-form.template-YNAVMJCV.cjs +0 -19
  113. package/dist/admin-layout-catalyst.template-3XZXDGF7.cjs +0 -21
  114. package/dist/admin-layout-catalyst.template-6UQGLCKI.js +0 -7
  115. package/dist/chunk-37V3RET3.cjs.map +0 -1
  116. package/dist/chunk-3TMTYJAJ.js.map +0 -1
  117. package/dist/chunk-BJROXF4N.js.map +0 -1
  118. package/dist/chunk-BP52BFIV.cjs.map +0 -1
  119. package/dist/chunk-E66UVONV.cjs.map +0 -1
  120. package/dist/chunk-FHPEM77Y.js.map +0 -1
  121. package/dist/chunk-I767LVN7.cjs.map +0 -1
  122. package/dist/chunk-IXUHXTHW.cjs.map +0 -1
  123. package/dist/chunk-KKNEYIZJ.cjs.map +0 -1
  124. package/dist/chunk-LNI3FYSI.js.map +0 -1
  125. package/dist/chunk-LTZ5WYOK.cjs.map +0 -1
  126. package/dist/chunk-QJUJNTIU.cjs.map +0 -1
  127. package/dist/chunk-QZGABF2M.js.map +0 -1
  128. package/dist/chunk-THFZSDIU.js.map +0 -1
  129. package/dist/chunk-UYJQDDEE.cjs.map +0 -1
  130. package/dist/chunk-VC5XVPLM.js.map +0 -1
  131. package/dist/chunk-VGEZNFWH.js.map +0 -1
  132. package/dist/chunk-VYQVDL2M.js.map +0 -1
  133. package/dist/config-6FB2BXMP.js +0 -6
  134. package/dist/migrations-FGXZPKDC.cjs +0 -13
  135. package/dist/migrations-Z6D27NAW.js +0 -4
  136. package/dist/rbac-7QZ4JZ2E.cjs +0 -14
  137. package/dist/rbac-Y43IEQOP.js +0 -5
package/dist/index.cjs CHANGED
@@ -1,27 +1,27 @@
1
1
  'use strict';
2
2
 
3
- var chunkGMMCCIQO_cjs = require('./chunk-GMMCCIQO.cjs');
4
- var chunkI767LVN7_cjs = require('./chunk-I767LVN7.cjs');
3
+ var chunkRSBZITK3_cjs = require('./chunk-RSBZITK3.cjs');
4
+ var chunk6OA77UM7_cjs = require('./chunk-6OA77UM7.cjs');
5
5
  require('./chunk-XWVDSM2L.cjs');
6
- require('./chunk-JMJM7DMM.cjs');
6
+ require('./chunk-TT3TQSCZ.cjs');
7
7
  var chunk36Z3AKX3_cjs = require('./chunk-36Z3AKX3.cjs');
8
8
  var chunkYA3TJ65D_cjs = require('./chunk-YA3TJ65D.cjs');
9
9
  var chunkYP7GW2G5_cjs = require('./chunk-YP7GW2G5.cjs');
10
- var chunk37V3RET3_cjs = require('./chunk-37V3RET3.cjs');
11
- var chunkLTZ5WYOK_cjs = require('./chunk-LTZ5WYOK.cjs');
10
+ var chunkE7E3NL3Y_cjs = require('./chunk-E7E3NL3Y.cjs');
11
+ var chunkJCBDXEY2_cjs = require('./chunk-JCBDXEY2.cjs');
12
12
  var chunkKIGVVO6N_cjs = require('./chunk-KIGVVO6N.cjs');
13
- var chunkQCJHCSOK_cjs = require('./chunk-QCJHCSOK.cjs');
14
- var chunkA2SN3RVL_cjs = require('./chunk-A2SN3RVL.cjs');
15
- var chunkBBEKHLTW_cjs = require('./chunk-BBEKHLTW.cjs');
16
- var chunkE66UVONV_cjs = require('./chunk-E66UVONV.cjs');
17
- var chunkUYJQDDEE_cjs = require('./chunk-UYJQDDEE.cjs');
18
- var chunkQJUJNTIU_cjs = require('./chunk-QJUJNTIU.cjs');
19
- var chunkBP52BFIV_cjs = require('./chunk-BP52BFIV.cjs');
13
+ var chunkYAURVGUK_cjs = require('./chunk-YAURVGUK.cjs');
14
+ var chunkMOGK3U4A_cjs = require('./chunk-MOGK3U4A.cjs');
15
+ var chunkCN3T3TDI_cjs = require('./chunk-CN3T3TDI.cjs');
16
+ var chunkOUBUS74I_cjs = require('./chunk-OUBUS74I.cjs');
17
+ var chunkMI2YXCK4_cjs = require('./chunk-MI2YXCK4.cjs');
18
+ var chunkI7MIRRFJ_cjs = require('./chunk-I7MIRRFJ.cjs');
19
+ var chunkD6FWEYQE_cjs = require('./chunk-D6FWEYQE.cjs');
20
20
  var chunkJ6JTWD2A_cjs = require('./chunk-J6JTWD2A.cjs');
21
- var chunkIXUHXTHW_cjs = require('./chunk-IXUHXTHW.cjs');
21
+ var chunkDLTT7QZU_cjs = require('./chunk-DLTT7QZU.cjs');
22
22
  var chunkRCQ2HIQD_cjs = require('./chunk-RCQ2HIQD.cjs');
23
23
  require('./chunk-P3XDZL6Q.cjs');
24
- var chunkKKNEYIZJ_cjs = require('./chunk-KKNEYIZJ.cjs');
24
+ var chunkBJ6NJL2E_cjs = require('./chunk-BJ6NJL2E.cjs');
25
25
  var chunkMNWKYY5E_cjs = require('./chunk-MNWKYY5E.cjs');
26
26
  var chunkQTFKZBLC_cjs = require('./chunk-QTFKZBLC.cjs');
27
27
  require('./chunk-IGJUBJBW.cjs');
@@ -263,7 +263,7 @@ var DatabaseToolsService = class {
263
263
  };
264
264
 
265
265
  // src/templates/pages/admin-database-table.template.ts
266
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
266
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
267
267
  function renderDatabaseTablePage(data) {
268
268
  const totalPages = Math.ceil(data.totalRows / data.pageSize);
269
269
  const startRow = (data.currentPage - 1) * data.pageSize + 1;
@@ -613,7 +613,7 @@ function renderDatabaseTablePage(data) {
613
613
  user: data.user,
614
614
  content: pageContent
615
615
  };
616
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
616
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
617
617
  }
618
618
  function generatePageNumbers(currentPage, totalPages) {
619
619
  const pages = [];
@@ -701,7 +701,7 @@ function formatCellValue(value, colName) {
701
701
  // src/plugins/core-plugins/database-tools-plugin/admin-routes.ts
702
702
  function createDatabaseToolsAdminRoutes() {
703
703
  const router3 = new hono.Hono();
704
- router3.use("*", chunk37V3RET3_cjs.requireAuth());
704
+ router3.use("*", chunkE7E3NL3Y_cjs.requireAuth());
705
705
  router3.get("/api/stats", async (c) => {
706
706
  try {
707
707
  const user = c.get("user");
@@ -1110,7 +1110,7 @@ var SiteConfigService = class {
1110
1110
 
1111
1111
  // src/plugins/core-plugins/email-plugin/routes/admin.ts
1112
1112
  var adminRoutes = new hono.Hono();
1113
- adminRoutes.use("*", chunk37V3RET3_cjs.requireAuth());
1113
+ adminRoutes.use("*", chunkE7E3NL3Y_cjs.requireAuth());
1114
1114
  adminRoutes.post("/settings", async (c) => {
1115
1115
  if (c.get("user")?.role !== "admin") {
1116
1116
  return c.json({ error: "admin role required" }, 403);
@@ -1148,7 +1148,7 @@ adminRoutes.post("/test", async (c) => {
1148
1148
  const { subject, html: html4, text } = renderTestEmail({ siteName });
1149
1149
  try {
1150
1150
  const settingsLoaded = await settings.load();
1151
- const result = await chunkI767LVN7_cjs.getEmailService().send({
1151
+ const result = await chunk6OA77UM7_cjs.getEmailService().send({
1152
1152
  to,
1153
1153
  subject,
1154
1154
  html: html4,
@@ -1230,7 +1230,7 @@ function makeOnRegistrationCompleted(env) {
1230
1230
  siteName,
1231
1231
  loginUrl: siteConfig.buildLoginUrl(siteUrl)
1232
1232
  });
1233
- const result = await chunkI767LVN7_cjs.getEmailService().send({
1233
+ const result = await chunk6OA77UM7_cjs.getEmailService().send({
1234
1234
  to: user.email,
1235
1235
  subject,
1236
1236
  html: html4,
@@ -1304,7 +1304,7 @@ function makeOnPasswordResetRequested(env) {
1304
1304
  expiresAt: Date.now() + DEFAULT_EXPIRY_MS,
1305
1305
  siteName
1306
1306
  });
1307
- const result = await chunkI767LVN7_cjs.getEmailService().send({
1307
+ const result = await chunk6OA77UM7_cjs.getEmailService().send({
1308
1308
  to: user.email,
1309
1309
  subject,
1310
1310
  html: html4,
@@ -1372,7 +1372,7 @@ function makeOnPasswordResetCompleted(env) {
1372
1372
  supportEmail,
1373
1373
  when: Date.now()
1374
1374
  });
1375
- const result = await chunkI767LVN7_cjs.getEmailService().send({
1375
+ const result = await chunk6OA77UM7_cjs.getEmailService().send({
1376
1376
  to: user.email,
1377
1377
  subject,
1378
1378
  html: html4,
@@ -2113,7 +2113,7 @@ var CloudflareEmailProvider = class {
2113
2113
  }
2114
2114
  }
2115
2115
  };
2116
- var emailPluginV3 = chunkBP52BFIV_cjs.definePlugin({
2116
+ var emailPluginV3 = chunkD6FWEYQE_cjs.definePlugin({
2117
2117
  id: "email",
2118
2118
  version: "1.0.0",
2119
2119
  name: "Email",
@@ -2127,7 +2127,7 @@ var emailPluginV3 = chunkBP52BFIV_cjs.definePlugin({
2127
2127
  const db = env.DB;
2128
2128
  if (db) {
2129
2129
  try {
2130
- const typeRegistry = new chunk37V3RET3_cjs.DocumentTypeRegistry(db);
2130
+ const typeRegistry = new chunkE7E3NL3Y_cjs.DocumentTypeRegistry(db);
2131
2131
  await typeRegistry.register({
2132
2132
  id: "email_log",
2133
2133
  name: "email_log",
@@ -2142,7 +2142,7 @@ var emailPluginV3 = chunkBP52BFIV_cjs.definePlugin({
2142
2142
  } catch {
2143
2143
  }
2144
2144
  }
2145
- if (!chunkI767LVN7_cjs.hasEmailService()) {
2145
+ if (!chunk6OA77UM7_cjs.hasEmailService()) {
2146
2146
  const settings = db ? await new EmailSettingsService(db).load() : {};
2147
2147
  const envResendKey = typeof env.RESEND_API_KEY === "string" && env.RESEND_API_KEY ? env.RESEND_API_KEY : void 0;
2148
2148
  const cfEmailBinding = env.EMAIL;
@@ -2160,7 +2160,7 @@ var emailPluginV3 = chunkBP52BFIV_cjs.definePlugin({
2160
2160
  } else {
2161
2161
  provider = resolveEmailProvider({ env });
2162
2162
  }
2163
- chunkI767LVN7_cjs.setEmailService(new EmailService({ ...serviceOpts, provider }));
2163
+ chunk6OA77UM7_cjs.setEmailService(new EmailService({ ...serviceOpts, provider }));
2164
2164
  }
2165
2165
  ctx.hooks.on("auth:registration:completed", makeOnRegistrationCompleted(env));
2166
2166
  ctx.hooks.on("auth:password-reset:requested", makeOnPasswordResetRequested(env));
@@ -2171,7 +2171,7 @@ var emailPluginV3 = chunkBP52BFIV_cjs.definePlugin({
2171
2171
  var BATCH_SIZE = 100;
2172
2172
  ({
2173
2173
  schema: zod.z.record(zod.z.string(), zod.z.unknown())});
2174
- var emailReconciliationPlugin = chunkBP52BFIV_cjs.definePlugin({
2174
+ var emailReconciliationPlugin = chunkD6FWEYQE_cjs.definePlugin({
2175
2175
  id: "email-reconciliation",
2176
2176
  version: "1.0.0",
2177
2177
  description: "Hourly cron that backfills email delivery state from provider status APIs. Only active for providers that implement EmailProvider.reconcile().",
@@ -2192,11 +2192,11 @@ var emailReconciliationPlugin = chunkBP52BFIV_cjs.definePlugin({
2192
2192
  console.warn("[email-reconciliation] No DB binding in cron env \u2014 skipping.");
2193
2193
  return;
2194
2194
  }
2195
- if (!chunkI767LVN7_cjs.hasEmailService()) {
2195
+ if (!chunk6OA77UM7_cjs.hasEmailService()) {
2196
2196
  console.warn("[email-reconciliation] EmailService not initialized \u2014 skipping.");
2197
2197
  return;
2198
2198
  }
2199
- const emailService = chunkI767LVN7_cjs.getEmailService();
2199
+ const emailService = chunk6OA77UM7_cjs.getEmailService();
2200
2200
  let rows = [];
2201
2201
  try {
2202
2202
  const result = await db.prepare(
@@ -2683,8 +2683,8 @@ function buildOtpApi() {
2683
2683
  loginUrl: settings.loginUrl || "",
2684
2684
  loginButtonText: settings.loginButtonText || ""
2685
2685
  });
2686
- if (chunkI767LVN7_cjs.hasEmailService()) {
2687
- const sent = await chunkI767LVN7_cjs.getEmailService().send({
2686
+ if (chunk6OA77UM7_cjs.hasEmailService()) {
2687
+ const sent = await chunk6OA77UM7_cjs.getEmailService().send({
2688
2688
  to: normalizedEmail,
2689
2689
  subject: `Your login code for ${siteName}`,
2690
2690
  flow: "otp",
@@ -2786,21 +2786,21 @@ function buildOtpApi() {
2786
2786
  error: "Account is deactivated"
2787
2787
  }, 403);
2788
2788
  }
2789
- const tokenTtl = await chunk37V3RET3_cjs.getJwtExpirySecondsFromDb(db, c.env);
2790
- const token = await chunk37V3RET3_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET, tokenTtl);
2789
+ const tokenTtl = await chunkE7E3NL3Y_cjs.getJwtExpirySecondsFromDb(db, c.env);
2790
+ const token = await chunkE7E3NL3Y_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET, tokenTtl);
2791
2791
  cookie.setCookie(c, "auth_token", token, {
2792
2792
  httpOnly: true,
2793
2793
  secure: true,
2794
2794
  sameSite: "Strict",
2795
2795
  maxAge: tokenTtl
2796
2796
  });
2797
- chunkI767LVN7_cjs.dispatchHookEvent(
2797
+ chunk6OA77UM7_cjs.dispatchHookEvent(
2798
2798
  c,
2799
2799
  "auth:otp:verified",
2800
2800
  { user: { id: user.id, email: user.email, role: user.role } },
2801
2801
  "fire-and-forget"
2802
2802
  );
2803
- const customData = await chunkI767LVN7_cjs.getCustomData(db, user.id);
2803
+ const customData = await chunk6OA77UM7_cjs.getCustomData(db, user.id);
2804
2804
  const { is_active: _isActive, ...publicUser } = user;
2805
2805
  return c.json({
2806
2806
  success: true,
@@ -2845,7 +2845,7 @@ function buildOtpApi() {
2845
2845
  });
2846
2846
  return otpAPI;
2847
2847
  }
2848
- var otpLoginPlugin = chunkBP52BFIV_cjs.definePlugin({
2848
+ var otpLoginPlugin = chunkD6FWEYQE_cjs.definePlugin({
2849
2849
  id: "otp-login",
2850
2850
  version: "1.0.0",
2851
2851
  name: "OTP Login",
@@ -3243,15 +3243,15 @@ function buildOauthApi() {
3243
3243
  if (!user || !user.is_active) {
3244
3244
  return c.redirect("/auth/login?error=Account is deactivated");
3245
3245
  }
3246
- const tokenTtl2 = await chunk37V3RET3_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3247
- const jwt2 = await chunk37V3RET3_cjs.AuthManager.generateToken(
3246
+ const tokenTtl2 = await chunkE7E3NL3Y_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3247
+ const jwt2 = await chunkE7E3NL3Y_cjs.AuthManager.generateToken(
3248
3248
  user.id,
3249
3249
  user.email,
3250
3250
  user.role,
3251
3251
  c.env.JWT_SECRET,
3252
3252
  tokenTtl2
3253
3253
  );
3254
- chunk37V3RET3_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
3254
+ chunkE7E3NL3Y_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
3255
3255
  return c.redirect("/admin");
3256
3256
  }
3257
3257
  const existingUser = await oauthService.findUserByEmail(profile.email);
@@ -3268,15 +3268,15 @@ function buildOauthApi() {
3268
3268
  tokenExpiresAt: tokenExpiresAt ?? void 0,
3269
3269
  profileData: JSON.stringify(profile)
3270
3270
  });
3271
- const tokenTtl2 = await chunk37V3RET3_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3272
- const jwt2 = await chunk37V3RET3_cjs.AuthManager.generateToken(
3271
+ const tokenTtl2 = await chunkE7E3NL3Y_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3272
+ const jwt2 = await chunkE7E3NL3Y_cjs.AuthManager.generateToken(
3273
3273
  existingUser.id,
3274
3274
  existingUser.email,
3275
3275
  existingUser.role,
3276
3276
  c.env.JWT_SECRET,
3277
3277
  tokenTtl2
3278
3278
  );
3279
- chunk37V3RET3_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
3279
+ chunkE7E3NL3Y_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
3280
3280
  return c.redirect("/admin");
3281
3281
  }
3282
3282
  const newUserId = await oauthService.createUserFromOAuth(profile);
@@ -3289,15 +3289,15 @@ function buildOauthApi() {
3289
3289
  tokenExpiresAt: tokenExpiresAt ?? void 0,
3290
3290
  profileData: JSON.stringify(profile)
3291
3291
  });
3292
- const tokenTtl = await chunk37V3RET3_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3293
- const jwt = await chunk37V3RET3_cjs.AuthManager.generateToken(
3292
+ const tokenTtl = await chunkE7E3NL3Y_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3293
+ const jwt = await chunkE7E3NL3Y_cjs.AuthManager.generateToken(
3294
3294
  newUserId,
3295
3295
  profile.email.toLowerCase(),
3296
3296
  "viewer",
3297
3297
  c.env.JWT_SECRET,
3298
3298
  tokenTtl
3299
3299
  );
3300
- chunk37V3RET3_cjs.AuthManager.setAuthCookie(c, jwt, { sameSite: "Lax", maxAge: tokenTtl });
3300
+ chunkE7E3NL3Y_cjs.AuthManager.setAuthCookie(c, jwt, { sameSite: "Lax", maxAge: tokenTtl });
3301
3301
  return c.redirect("/admin");
3302
3302
  } catch (error) {
3303
3303
  console.error("OAuth callback error:", error);
@@ -3392,7 +3392,7 @@ function buildOauthApi() {
3392
3392
  });
3393
3393
  return oauthAPI;
3394
3394
  }
3395
- var oauthProvidersPlugin = chunkBP52BFIV_cjs.definePlugin({
3395
+ var oauthProvidersPlugin = chunkD6FWEYQE_cjs.definePlugin({
3396
3396
  id: "oauth-providers",
3397
3397
  version: "1.0.0",
3398
3398
  name: "OAuth Providers",
@@ -3976,7 +3976,7 @@ var AISearchService = class {
3976
3976
  */
3977
3977
  async detectNewCollections() {
3978
3978
  try {
3979
- const allCollections = chunkQCJHCSOK_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => ({
3979
+ const allCollections = chunkYAURVGUK_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => ({
3980
3980
  id: r.id,
3981
3981
  name: r.name,
3982
3982
  display_name: r.displayName,
@@ -4028,7 +4028,7 @@ var AISearchService = class {
4028
4028
  */
4029
4029
  async getAllCollections() {
4030
4030
  try {
4031
- const allCollections = chunkQCJHCSOK_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).sort((a, b) => a.displayName.localeCompare(b.displayName)).map((r) => ({
4031
+ const allCollections = chunkYAURVGUK_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).sort((a, b) => a.displayName.localeCompare(b.displayName)).map((r) => ({
4032
4032
  id: r.id,
4033
4033
  name: r.name,
4034
4034
  display_name: r.displayName,
@@ -4367,7 +4367,7 @@ var IndexManager = class {
4367
4367
  */
4368
4368
  async indexCollection(collectionId) {
4369
4369
  try {
4370
- const registry = chunkQCJHCSOK_cjs.getCollectionRegistry();
4370
+ const registry = chunkYAURVGUK_cjs.getCollectionRegistry();
4371
4371
  const record = registry.getById(collectionId) ?? registry.getByName(collectionId);
4372
4372
  if (!record) {
4373
4373
  throw new Error(`Collection ${collectionId} not found`);
@@ -4983,7 +4983,7 @@ function renderSettingsPage(data) {
4983
4983
  }, 30000);
4984
4984
  </script>
4985
4985
  `;
4986
- return chunkE66UVONV_cjs.renderAdminLayout({
4986
+ return chunkOUBUS74I_cjs.renderAdminLayout({
4987
4987
  title: "AI Search Settings",
4988
4988
  pageTitle: "AI Search Settings",
4989
4989
  currentPath: "/admin/plugins/ai-search/settings",
@@ -4994,7 +4994,7 @@ function renderSettingsPage(data) {
4994
4994
 
4995
4995
  // src/plugins/core-plugins/ai-search-plugin/routes/admin.ts
4996
4996
  var adminRoutes2 = new hono.Hono();
4997
- adminRoutes2.use("*", chunk37V3RET3_cjs.requireAuth());
4997
+ adminRoutes2.use("*", chunkE7E3NL3Y_cjs.requireAuth());
4998
4998
  adminRoutes2.get("/", async (c) => {
4999
4999
  try {
5000
5000
  const user = c.get("user");
@@ -5235,7 +5235,7 @@ var manifest_default = {
5235
5235
  author: "SonicJS"};
5236
5236
 
5237
5237
  // src/plugins/core-plugins/ai-search-plugin/index.ts
5238
- var aiSearchPlugin = chunkBP52BFIV_cjs.definePlugin({
5238
+ var aiSearchPlugin = chunkD6FWEYQE_cjs.definePlugin({
5239
5239
  id: manifest_default.id,
5240
5240
  version: manifest_default.version,
5241
5241
  name: manifest_default.name,
@@ -5288,7 +5288,7 @@ var SecurityAuditService = class {
5288
5288
  constructor(db, settings = DEFAULT_SETTINGS2) {
5289
5289
  this.db = db;
5290
5290
  this.settings = settings;
5291
- this.docsService = new chunkLTZ5WYOK_cjs.DocumentsService(db, {
5291
+ this.docsService = new chunkJCBDXEY2_cjs.DocumentsService(db, {
5292
5292
  queryableFields: QUERYABLE_FIELDS,
5293
5293
  maxVersionsPerRoot: 1,
5294
5294
  tenantId: TENANT
@@ -5536,7 +5536,7 @@ function rowToEvent(row) {
5536
5536
  }
5537
5537
 
5538
5538
  // src/plugins/core-plugins/security-audit-plugin/components/dashboard-page.ts
5539
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
5539
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
5540
5540
  function formatTimestamp(ts) {
5541
5541
  const date = new Date(ts);
5542
5542
  const now = Date.now();
@@ -5735,11 +5735,11 @@ function renderSecurityDashboard(data) {
5735
5735
  version,
5736
5736
  dynamicMenuItems
5737
5737
  };
5738
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
5738
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
5739
5739
  }
5740
5740
 
5741
5741
  // src/plugins/core-plugins/security-audit-plugin/components/event-log-page.ts
5742
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
5742
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
5743
5743
  function formatTimestamp2(ts) {
5744
5744
  const date = new Date(ts);
5745
5745
  return date.toLocaleDateString("en-US", {
@@ -5946,11 +5946,11 @@ function renderEventLogPage(data) {
5946
5946
  version,
5947
5947
  dynamicMenuItems
5948
5948
  };
5949
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
5949
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
5950
5950
  }
5951
5951
 
5952
5952
  // src/plugins/core-plugins/security-audit-plugin/components/settings-page.ts
5953
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
5953
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
5954
5954
  function renderSecuritySettingsPage(data) {
5955
5955
  const { settings, user, version, message, dynamicMenuItems } = data;
5956
5956
  const content2 = `
@@ -6103,12 +6103,12 @@ function renderSecuritySettingsPage(data) {
6103
6103
  version,
6104
6104
  dynamicMenuItems
6105
6105
  };
6106
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
6106
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
6107
6107
  }
6108
6108
 
6109
6109
  // src/plugins/core-plugins/security-audit-plugin/routes/admin.ts
6110
6110
  var adminRoutes3 = new hono.Hono();
6111
- adminRoutes3.use("*", chunk37V3RET3_cjs.requireAuth());
6111
+ adminRoutes3.use("*", chunkE7E3NL3Y_cjs.requireAuth());
6112
6112
  adminRoutes3.use("*", async (c, next) => {
6113
6113
  const user = c.get("user");
6114
6114
  if (user?.role !== "admin") {
@@ -6118,7 +6118,7 @@ adminRoutes3.use("*", async (c, next) => {
6118
6118
  });
6119
6119
  async function getSettings(db) {
6120
6120
  try {
6121
- const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
6121
+ const pluginService = new chunkYAURVGUK_cjs.PluginService(db);
6122
6122
  const plugin2 = await pluginService.getPlugin("security-audit");
6123
6123
  if (plugin2?.settings) {
6124
6124
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -6223,7 +6223,7 @@ adminRoutes3.post("/settings", async (c) => {
6223
6223
  autoPurge: body["retention.autoPurge"] === "true"
6224
6224
  }
6225
6225
  };
6226
- const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
6226
+ const pluginService = new chunkYAURVGUK_cjs.PluginService(db);
6227
6227
  await pluginService.updatePluginSettings("security-audit", settings);
6228
6228
  if (c.req.header("HX-Request")) {
6229
6229
  return c.json({ success: true });
@@ -6385,7 +6385,7 @@ var BruteForceDetector = class {
6385
6385
 
6386
6386
  // src/plugins/core-plugins/security-audit-plugin/routes/api.ts
6387
6387
  var apiRoutes2 = new hono.Hono();
6388
- apiRoutes2.use("*", chunk37V3RET3_cjs.requireAuth());
6388
+ apiRoutes2.use("*", chunkE7E3NL3Y_cjs.requireAuth());
6389
6389
  apiRoutes2.use("*", async (c, next) => {
6390
6390
  const user = c.get("user");
6391
6391
  if (user?.role !== "admin") {
@@ -6395,7 +6395,7 @@ apiRoutes2.use("*", async (c, next) => {
6395
6395
  });
6396
6396
  async function getSettings2(db) {
6397
6397
  try {
6398
- const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
6398
+ const pluginService = new chunkYAURVGUK_cjs.PluginService(db);
6399
6399
  const plugin2 = await pluginService.getPlugin("security-audit");
6400
6400
  if (plugin2?.settings) {
6401
6401
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -6543,7 +6543,7 @@ function generateFingerprint(ip, userAgent) {
6543
6543
  }
6544
6544
  async function getPluginSettings(db) {
6545
6545
  try {
6546
- const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
6546
+ const pluginService = new chunkYAURVGUK_cjs.PluginService(db);
6547
6547
  const plugin2 = await pluginService.getPlugin("security-audit");
6548
6548
  if (plugin2?.settings) {
6549
6549
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -6774,7 +6774,7 @@ async function logAuthEvent(c, db, settings, ip, userAgent, countryCode, fingerp
6774
6774
 
6775
6775
  // src/plugins/core-plugins/security-audit-plugin/index.ts
6776
6776
  var SECURITY_ICON = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"/></svg>`;
6777
- var securityAuditPlugin = chunkBP52BFIV_cjs.definePlugin({
6777
+ var securityAuditPlugin = chunkD6FWEYQE_cjs.definePlugin({
6778
6778
  id: "security-audit",
6779
6779
  version: "1.0.0",
6780
6780
  name: "Security Audit",
@@ -6824,7 +6824,7 @@ var ApiKeyService = class {
6824
6824
  db;
6825
6825
  tenantId;
6826
6826
  docService() {
6827
- return new chunkLTZ5WYOK_cjs.DocumentsService(this.db, {
6827
+ return new chunkJCBDXEY2_cjs.DocumentsService(this.db, {
6828
6828
  queryableFields: API_KEY_QUERYABLE,
6829
6829
  tenantId: this.tenantId,
6830
6830
  maxVersionsPerRoot: 1
@@ -6850,7 +6850,7 @@ var ApiKeyService = class {
6850
6850
  const prefix = secret.slice(0, DISPLAY_PREFIX_LEN);
6851
6851
  const expiresAt = input.expiresAt ?? null;
6852
6852
  const doc = await this.docService().create(
6853
- chunkI767LVN7_cjs.createDocumentSchema.parse({
6853
+ chunk6OA77UM7_cjs.createDocumentSchema.parse({
6854
6854
  typeId: "api_key",
6855
6855
  tenantId: this.tenantId,
6856
6856
  title: name,
@@ -6943,7 +6943,7 @@ var ApiKeyService = class {
6943
6943
  };
6944
6944
 
6945
6945
  // src/plugins/core-plugins/api-keys-plugin/components/keys-page.ts
6946
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
6946
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
6947
6947
  function fmtDate(ms) {
6948
6948
  if (!ms) return "\u2014";
6949
6949
  try {
@@ -7144,7 +7144,7 @@ function renderApiKeysPage(data) {
7144
7144
  version,
7145
7145
  dynamicMenuItems
7146
7146
  };
7147
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
7147
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
7148
7148
  }
7149
7149
 
7150
7150
  // src/plugins/core-plugins/api-keys-plugin/types.ts
@@ -7163,7 +7163,7 @@ var createSchema = zod.z.object({
7163
7163
  });
7164
7164
  async function getSettings3(db) {
7165
7165
  try {
7166
- const plugin2 = await new chunkQCJHCSOK_cjs.PluginService(db).getPlugin("api-keys");
7166
+ const plugin2 = await new chunkYAURVGUK_cjs.PluginService(db).getPlugin("api-keys");
7167
7167
  if (plugin2?.settings) {
7168
7168
  const s = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
7169
7169
  return { ...DEFAULT_SETTINGS3, ...s };
@@ -7172,7 +7172,7 @@ async function getSettings3(db) {
7172
7172
  }
7173
7173
  return DEFAULT_SETTINGS3;
7174
7174
  }
7175
- adminRoutes4.use("*", chunk37V3RET3_cjs.requireAuth());
7175
+ adminRoutes4.use("*", chunkE7E3NL3Y_cjs.requireAuth());
7176
7176
  adminRoutes4.use("*", async (c, next) => {
7177
7177
  const user = c.get("user");
7178
7178
  if (user?.role !== "admin") {
@@ -7257,7 +7257,7 @@ function apiKeyAuthMiddleware() {
7257
7257
 
7258
7258
  // src/plugins/core-plugins/api-keys-plugin/index.ts
7259
7259
  var KEY_ICON = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"/></svg>`;
7260
- var apiKeysPlugin = chunkBP52BFIV_cjs.definePlugin({
7260
+ var apiKeysPlugin = chunkD6FWEYQE_cjs.definePlugin({
7261
7261
  id: "api-keys",
7262
7262
  version: "1.0.0-beta.1",
7263
7263
  name: "API Keys",
@@ -7643,7 +7643,7 @@ var StripeEventService = class {
7643
7643
  };
7644
7644
 
7645
7645
  // src/plugins/core-plugins/stripe-plugin/components/subscriptions-page.ts
7646
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
7646
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
7647
7647
 
7648
7648
  // src/plugins/core-plugins/stripe-plugin/components/tab-bar.ts
7649
7649
  var TABS = [
@@ -7776,7 +7776,7 @@ function renderSubscriptionsPage(data) {
7776
7776
  version,
7777
7777
  dynamicMenuItems
7778
7778
  };
7779
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
7779
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
7780
7780
  }
7781
7781
  function statsCard(label, value, colorClass) {
7782
7782
  return `
@@ -7856,7 +7856,7 @@ function renderPagination2(page, totalPages, status) {
7856
7856
  }
7857
7857
 
7858
7858
  // src/plugins/core-plugins/stripe-plugin/components/events-page.ts
7859
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
7859
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
7860
7860
  function renderEventsPage(data) {
7861
7861
  const { events, stats, types, filters, user, version, dynamicMenuItems } = data;
7862
7862
  const content2 = `
@@ -7929,7 +7929,7 @@ function renderEventsPage(data) {
7929
7929
  version,
7930
7930
  dynamicMenuItems
7931
7931
  };
7932
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
7932
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
7933
7933
  }
7934
7934
  function eventStatsCard(label, value, colorClass) {
7935
7935
  return `
@@ -8028,7 +8028,7 @@ var DEFAULT_SETTINGS4 = {
8028
8028
 
8029
8029
  // src/plugins/core-plugins/stripe-plugin/routes/admin.ts
8030
8030
  var adminRoutes5 = new hono.Hono();
8031
- adminRoutes5.use("*", chunk37V3RET3_cjs.requireAuth());
8031
+ adminRoutes5.use("*", chunkE7E3NL3Y_cjs.requireAuth());
8032
8032
  adminRoutes5.use("*", async (c, next) => {
8033
8033
  const user = c.get("user");
8034
8034
  if (user?.role !== "admin") {
@@ -8038,7 +8038,7 @@ adminRoutes5.use("*", async (c, next) => {
8038
8038
  });
8039
8039
  async function getSettings4(db) {
8040
8040
  try {
8041
- const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
8041
+ const pluginService = new chunkYAURVGUK_cjs.PluginService(db);
8042
8042
  const plugin2 = await pluginService.getPlugin("stripe");
8043
8043
  if (plugin2?.settings) {
8044
8044
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -8101,7 +8101,7 @@ adminRoutes5.get("/settings", async (c) => {
8101
8101
  const db = c.env.DB;
8102
8102
  const user = c.get("user");
8103
8103
  const settings = await getSettings4(db);
8104
- const { renderAdminLayoutCatalyst: renderAdminLayoutCatalyst2 } = await import('./admin-layout-catalyst.template-3XZXDGF7.cjs');
8104
+ const { renderAdminLayoutCatalyst: renderAdminLayoutCatalyst2 } = await import('./admin-layout-catalyst.template-MOQ3BBXA.cjs');
8105
8105
  const content2 = `
8106
8106
  <div>
8107
8107
  <div class="mb-6">
@@ -8361,7 +8361,7 @@ function timingSafeEqual(a, b) {
8361
8361
  var apiRoutes3 = new hono.Hono();
8362
8362
  async function getSettings5(db) {
8363
8363
  try {
8364
- const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
8364
+ const pluginService = new chunkYAURVGUK_cjs.PluginService(db);
8365
8365
  const plugin2 = await pluginService.getPlugin("stripe");
8366
8366
  if (plugin2?.settings) {
8367
8367
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -8512,7 +8512,7 @@ apiRoutes3.post("/webhook", async (c) => {
8512
8512
  }
8513
8513
  return c.json({ received: true });
8514
8514
  });
8515
- apiRoutes3.post("/create-checkout-session", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8515
+ apiRoutes3.post("/create-checkout-session", chunkE7E3NL3Y_cjs.requireAuth(), async (c) => {
8516
8516
  const db = c.env.DB;
8517
8517
  const user = c.get("user");
8518
8518
  if (!user) return c.json({ error: "Unauthorized" }, 401);
@@ -8552,7 +8552,7 @@ apiRoutes3.post("/create-checkout-session", chunk37V3RET3_cjs.requireAuth(), asy
8552
8552
  });
8553
8553
  return c.json({ sessionId: session.id, url: session.url });
8554
8554
  });
8555
- apiRoutes3.get("/subscription", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8555
+ apiRoutes3.get("/subscription", chunkE7E3NL3Y_cjs.requireAuth(), async (c) => {
8556
8556
  const user = c.get("user");
8557
8557
  if (!user) return c.json({ error: "Unauthorized" }, 401);
8558
8558
  const db = c.env.DB;
@@ -8564,7 +8564,7 @@ apiRoutes3.get("/subscription", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8564
8564
  }
8565
8565
  return c.json({ subscription });
8566
8566
  });
8567
- apiRoutes3.get("/subscriptions", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8567
+ apiRoutes3.get("/subscriptions", chunkE7E3NL3Y_cjs.requireAuth(), async (c) => {
8568
8568
  const user = c.get("user");
8569
8569
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
8570
8570
  const db = c.env.DB;
@@ -8580,7 +8580,7 @@ apiRoutes3.get("/subscriptions", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8580
8580
  const result = await subscriptionService.list(filters);
8581
8581
  return c.json(result);
8582
8582
  });
8583
- apiRoutes3.get("/stats", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8583
+ apiRoutes3.get("/stats", chunkE7E3NL3Y_cjs.requireAuth(), async (c) => {
8584
8584
  const user = c.get("user");
8585
8585
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
8586
8586
  const db = c.env.DB;
@@ -8589,7 +8589,7 @@ apiRoutes3.get("/stats", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8589
8589
  const stats = await subscriptionService.getStats();
8590
8590
  return c.json(stats);
8591
8591
  });
8592
- apiRoutes3.post("/sync-subscriptions", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8592
+ apiRoutes3.post("/sync-subscriptions", chunkE7E3NL3Y_cjs.requireAuth(), async (c) => {
8593
8593
  const user = c.get("user");
8594
8594
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
8595
8595
  const db = c.env.DB;
@@ -8637,7 +8637,7 @@ apiRoutes3.post("/sync-subscriptions", chunk37V3RET3_cjs.requireAuth(), async (c
8637
8637
  }, 500);
8638
8638
  }
8639
8639
  });
8640
- apiRoutes3.get("/events", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8640
+ apiRoutes3.get("/events", chunkE7E3NL3Y_cjs.requireAuth(), async (c) => {
8641
8641
  const user = c.get("user");
8642
8642
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
8643
8643
  const db = c.env.DB;
@@ -8660,7 +8660,7 @@ apiRoutes3.get("/events", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8660
8660
 
8661
8661
  // src/plugins/core-plugins/stripe-plugin/index.ts
8662
8662
  var STRIPE_ICON = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"/></svg>`;
8663
- var stripePlugin = chunkBP52BFIV_cjs.definePlugin({
8663
+ var stripePlugin = chunkD6FWEYQE_cjs.definePlugin({
8664
8664
  id: "stripe",
8665
8665
  version: "1.0.0",
8666
8666
  name: "Stripe",
@@ -8681,7 +8681,7 @@ var stripePlugin = chunkBP52BFIV_cjs.definePlugin({
8681
8681
  });
8682
8682
 
8683
8683
  // src/templates/pages/admin-forms-list.template.ts
8684
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
8684
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
8685
8685
  function renderFormsListPage(data) {
8686
8686
  const tableData = {
8687
8687
  tableId: "forms-table",
@@ -8933,7 +8933,7 @@ function renderFormsListPage(data) {
8933
8933
 
8934
8934
  <!-- Forms Table -->
8935
8935
  <div class="bg-white dark:bg-zinc-900 rounded-lg border border-zinc-950/5 dark:border-white/10 overflow-hidden">
8936
- ${chunkI767LVN7_cjs.renderTable(tableData)}
8936
+ ${chunk6OA77UM7_cjs.renderTable(tableData)}
8937
8937
  </div>
8938
8938
  </div>
8939
8939
  `;
@@ -8943,11 +8943,11 @@ function renderFormsListPage(data) {
8943
8943
  user: data.user,
8944
8944
  version: data.version
8945
8945
  };
8946
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
8946
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
8947
8947
  }
8948
8948
 
8949
8949
  // src/templates/pages/admin-forms-builder.template.ts
8950
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
8950
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
8951
8951
  function getTurnstileComponentScript() {
8952
8952
  return `
8953
8953
  (function() {
@@ -10160,11 +10160,11 @@ ${getTurnstileComponentScript()}
10160
10160
  user: data.user,
10161
10161
  version: data.version
10162
10162
  };
10163
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
10163
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
10164
10164
  }
10165
10165
 
10166
10166
  // src/templates/pages/admin-forms-create.template.ts
10167
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
10167
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
10168
10168
  function renderFormCreatePage(data) {
10169
10169
  const pageContent = `
10170
10170
  <div class="max-w-3xl mx-auto">
@@ -10357,13 +10357,13 @@ function renderFormCreatePage(data) {
10357
10357
  user: data.user,
10358
10358
  version: data.version
10359
10359
  };
10360
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
10360
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
10361
10361
  }
10362
10362
 
10363
10363
  // src/routes/admin-forms.ts
10364
10364
  var isTableMissing = (err) => String(err?.message ?? err?.cause?.message ?? "").includes("no such table: forms");
10365
10365
  var adminFormsRoutes = new hono.Hono();
10366
- adminFormsRoutes.use("*", chunk37V3RET3_cjs.requireAuth());
10366
+ adminFormsRoutes.use("*", chunkE7E3NL3Y_cjs.requireAuth());
10367
10367
  adminFormsRoutes.get("/", async (c) => {
10368
10368
  try {
10369
10369
  const user = c.get("user");
@@ -10536,7 +10536,7 @@ adminFormsRoutes.get("/:id/builder", async (c) => {
10536
10536
  if (!form) {
10537
10537
  return c.html("<p>Form not found</p>", 404);
10538
10538
  }
10539
- const turnstileService = new chunkQJUJNTIU_cjs.TurnstileService(db);
10539
+ const turnstileService = new chunkI7MIRRFJ_cjs.TurnstileService(db);
10540
10540
  const turnstileSettings = await turnstileService.getSettings();
10541
10541
  const pageData = {
10542
10542
  id: form.id,
@@ -10705,7 +10705,7 @@ publicFormsRoutes.get("/:identifier/turnstile-config", async (c) => {
10705
10705
  if (!form) {
10706
10706
  return c.json({ error: "Form not found" }, 404);
10707
10707
  }
10708
- const turnstileService = new chunkQJUJNTIU_cjs.TurnstileService(db);
10708
+ const turnstileService = new chunkI7MIRRFJ_cjs.TurnstileService(db);
10709
10709
  const globalSettings = await turnstileService.getSettings();
10710
10710
  const formSettings = form.turnstile_settings ? JSON.parse(form.turnstile_settings) : { inherit: true };
10711
10711
  const enabled = form.turnstile_enabled === 1 || formSettings.inherit && globalSettings?.enabled;
@@ -11135,7 +11135,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
11135
11135
  const turnstileEnabled = form.turnstile_enabled === 1;
11136
11136
  const turnstileSettings = form.turnstile_settings ? JSON.parse(form.turnstile_settings) : { inherit: true };
11137
11137
  if (turnstileEnabled || turnstileSettings.inherit) {
11138
- const turnstileService = new chunkQJUJNTIU_cjs.TurnstileService(db);
11138
+ const turnstileService = new chunkI7MIRRFJ_cjs.TurnstileService(db);
11139
11139
  const globalEnabled = await turnstileService.isEnabled();
11140
11140
  if (globalEnabled || turnstileEnabled) {
11141
11141
  const turnstileToken = body.data?.turnstile || body.turnstile;
@@ -11197,7 +11197,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
11197
11197
  });
11198
11198
 
11199
11199
  // src/plugins/core-plugins/forms-plugin/index.ts
11200
- var formsPlugin = chunkBP52BFIV_cjs.definePlugin({
11200
+ var formsPlugin = chunkD6FWEYQE_cjs.definePlugin({
11201
11201
  id: "forms",
11202
11202
  version: "1.0.0",
11203
11203
  name: "Forms",
@@ -11215,9 +11215,9 @@ var formsPlugin = chunkBP52BFIV_cjs.definePlugin({
11215
11215
  activate: async () => console.info("\u2705 Forms plugin activated"),
11216
11216
  deactivate: async () => console.info("\u274C Forms plugin deactivated")
11217
11217
  });
11218
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
11218
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
11219
11219
  var adminRbacRoutes = new hono.Hono();
11220
- adminRbacRoutes.use("*", chunk37V3RET3_cjs.requireRbac("rbac", "manage"));
11220
+ adminRbacRoutes.use("*", chunkE7E3NL3Y_cjs.requireRbac("rbac", "manage"));
11221
11221
  var esc = (s) => String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
11222
11222
  var TABS2 = `
11223
11223
  <div class="border-b border-zinc-950/10 dark:border-white/10 mb-6">
@@ -11227,7 +11227,7 @@ var TABS2 = `
11227
11227
  </nav>
11228
11228
  </div>`;
11229
11229
  adminRbacRoutes.get("/", async (c) => {
11230
- const rbac = new chunkLTZ5WYOK_cjs.RbacService(c.env.DB);
11230
+ const rbac = new chunkJCBDXEY2_cjs.RbacService(c.env.DB);
11231
11231
  const [roles, verbs, resources, grants] = await Promise.all([
11232
11232
  rbac.getRoles(),
11233
11233
  rbac.getVerbs(),
@@ -11521,11 +11521,11 @@ adminRbacRoutes.get("/", async (c) => {
11521
11521
  </script>`;
11522
11522
  const u = c.get("user");
11523
11523
  return c.html(
11524
- chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
11524
+ chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
11525
11525
  title: "Roles & Permissions",
11526
11526
  pageTitle: "Roles & Permissions",
11527
11527
  currentPath: "/admin/users",
11528
- version: chunkKKNEYIZJ_cjs.getCoreVersion(),
11528
+ version: chunkBJ6NJL2E_cjs.getCoreVersion(),
11529
11529
  user: u ? { name: u.email || "Admin", email: u.email || "", role: u.role || "admin" } : void 0,
11530
11530
  content: content2
11531
11531
  })
@@ -11549,7 +11549,7 @@ adminRbacRoutes.post("/grants", async (c) => {
11549
11549
  pairsByRole.get(roleId).push({ resource, verb, scope });
11550
11550
  }
11551
11551
  }
11552
- const rbac = new chunkLTZ5WYOK_cjs.RbacService(c.env.DB);
11552
+ const rbac = new chunkJCBDXEY2_cjs.RbacService(c.env.DB);
11553
11553
  for (const id of saveRoleIds) {
11554
11554
  await rbac.setRoleGrants(id, pairsByRole.get(id) || []);
11555
11555
  }
@@ -11570,7 +11570,7 @@ adminRbacRoutes.post("/grants", async (c) => {
11570
11570
  adminRbacRoutes.post("/roles/bulk", async (c) => {
11571
11571
  const form = await c.req.formData();
11572
11572
  const roleIds = String(form.get("role_ids") || "").split(",").filter(Boolean);
11573
- const rbac = new chunkLTZ5WYOK_cjs.RbacService(c.env.DB);
11573
+ const rbac = new chunkJCBDXEY2_cjs.RbacService(c.env.DB);
11574
11574
  for (const roleId of roleIds) {
11575
11575
  const displayName = String(form.get(`display_name_${roleId}`) || "").trim();
11576
11576
  const nameVal = form.get(`name_${roleId}`) ? String(form.get(`name_${roleId}`)).trim() : void 0;
@@ -11595,7 +11595,7 @@ adminRbacRoutes.post("/roles", async (c) => {
11595
11595
  const displayName = String(form.get("display_name") || "").trim();
11596
11596
  if (name && displayName) {
11597
11597
  try {
11598
- await new chunkLTZ5WYOK_cjs.RbacService(c.env.DB).createRole(name, displayName);
11598
+ await new chunkJCBDXEY2_cjs.RbacService(c.env.DB).createRole(name, displayName);
11599
11599
  } catch {
11600
11600
  }
11601
11601
  }
@@ -11610,7 +11610,7 @@ adminRbacRoutes.post("/roles/:id", async (c) => {
11610
11610
  const portalAccess = form.get("portal_access") === "1";
11611
11611
  if (displayName) {
11612
11612
  try {
11613
- const rbac = new chunkLTZ5WYOK_cjs.RbacService(c.env.DB);
11613
+ const rbac = new chunkJCBDXEY2_cjs.RbacService(c.env.DB);
11614
11614
  if (roleId !== "role-admin") {
11615
11615
  await rbac.updateRoleAndPortalAccess(roleId, displayName, name, portalAccess, description);
11616
11616
  } else {
@@ -11622,7 +11622,7 @@ adminRbacRoutes.post("/roles/:id", async (c) => {
11622
11622
  return c.redirect(`/admin/rbac#roles-verbs`);
11623
11623
  });
11624
11624
  adminRbacRoutes.post("/roles/:id/delete", async (c) => {
11625
- await new chunkLTZ5WYOK_cjs.RbacService(c.env.DB).deleteRole(c.req.param("id"));
11625
+ await new chunkJCBDXEY2_cjs.RbacService(c.env.DB).deleteRole(c.req.param("id"));
11626
11626
  return c.redirect("/admin/rbac#roles-verbs");
11627
11627
  });
11628
11628
  adminRbacRoutes.post("/verbs", async (c) => {
@@ -11630,18 +11630,18 @@ adminRbacRoutes.post("/verbs", async (c) => {
11630
11630
  const name = String(form.get("name") || "").trim();
11631
11631
  if (name) {
11632
11632
  try {
11633
- await new chunkLTZ5WYOK_cjs.RbacService(c.env.DB).createVerb(name);
11633
+ await new chunkJCBDXEY2_cjs.RbacService(c.env.DB).createVerb(name);
11634
11634
  } catch {
11635
11635
  }
11636
11636
  }
11637
11637
  return c.redirect("/admin/rbac#roles-verbs");
11638
11638
  });
11639
11639
  adminRbacRoutes.post("/verbs/:id/delete", async (c) => {
11640
- await new chunkLTZ5WYOK_cjs.RbacService(c.env.DB).deleteVerb(c.req.param("id"));
11640
+ await new chunkJCBDXEY2_cjs.RbacService(c.env.DB).deleteVerb(c.req.param("id"));
11641
11641
  return c.redirect("/admin/rbac#roles-verbs");
11642
11642
  });
11643
11643
  adminRbacRoutes.get("/check", async (c) => {
11644
- const rbac = new chunkLTZ5WYOK_cjs.RbacService(c.env.DB);
11644
+ const rbac = new chunkJCBDXEY2_cjs.RbacService(c.env.DB);
11645
11645
  const resource = c.req.query("resource") || "";
11646
11646
  const verb = c.req.query("verb") || "";
11647
11647
  const roleId = c.req.query("role");
@@ -11662,7 +11662,7 @@ adminRbacRoutes.get("/check", async (c) => {
11662
11662
  });
11663
11663
 
11664
11664
  // src/middleware/plugin-menu.ts
11665
- var REGISTRY_MENU_PLUGINS = Object.values(chunkQCJHCSOK_cjs.PLUGIN_REGISTRY).filter((p) => p.adminMenu !== null).map((p) => ({
11665
+ var REGISTRY_MENU_PLUGINS = Object.values(chunkYAURVGUK_cjs.PLUGIN_REGISTRY).filter((p) => p.adminMenu !== null).map((p) => ({
11666
11666
  id: p.id,
11667
11667
  label: p.adminMenu.label,
11668
11668
  path: p.adminMenu.path,
@@ -11716,9 +11716,9 @@ function pluginMenuMiddleware() {
11716
11716
  if (!path.startsWith("/admin")) {
11717
11717
  return next();
11718
11718
  }
11719
+ const db = c.env.DB;
11719
11720
  let activeMenuItems = [];
11720
11721
  try {
11721
- const db = c.env.DB;
11722
11722
  const pluginIds = REGISTRY_MENU_PLUGINS.map((p) => p.id);
11723
11723
  if (pluginIds.length > 0) {
11724
11724
  const placeholders = pluginIds.map(() => "?").join(",");
@@ -11741,10 +11741,25 @@ function pluginMenuMiddleware() {
11741
11741
  } catch {
11742
11742
  }
11743
11743
  const user = c.get("user");
11744
- const singletonItems = chunkBP52BFIV_cjs.resolvePluginMenuItems(user ? { role: user.role } : void 0);
11744
+ const singletonItems = chunkD6FWEYQE_cjs.resolvePluginMenuItems(user ? { role: user.role } : void 0);
11745
+ const singletonPluginIds = [...new Set(
11746
+ singletonItems.map((i) => i.pluginId).filter((id) => !!id)
11747
+ )];
11748
+ let activeSingletonIds = /* @__PURE__ */ new Set();
11749
+ try {
11750
+ if (singletonPluginIds.length > 0) {
11751
+ const ph = singletonPluginIds.map(() => "?").join(",");
11752
+ const result = await db.prepare(
11753
+ `SELECT slug FROM documents WHERE type_id = 'plugin' AND tenant_id = 'default' AND slug IN (${ph}) AND q_plugin_status = 'active' AND is_current_draft = 1 AND deleted_at IS NULL`
11754
+ ).bind(...singletonPluginIds).all();
11755
+ activeSingletonIds = new Set((result.results || []).map((r) => r.slug));
11756
+ }
11757
+ } catch {
11758
+ }
11745
11759
  const existingPaths = new Set(activeMenuItems.map((i) => i.path));
11746
11760
  for (const item of singletonItems) {
11747
- if (!existingPaths.has(item.path)) {
11761
+ const isActive = !item.pluginId || activeSingletonIds.has(item.pluginId);
11762
+ if (isActive && !existingPaths.has(item.path)) {
11748
11763
  activeMenuItems.push({ label: item.label, path: item.path, icon: item.icon, order: item.order });
11749
11764
  }
11750
11765
  }
@@ -12310,7 +12325,7 @@ var SYSTEM_MENU_ITEMS = [
12310
12325
  ];
12311
12326
 
12312
12327
  // src/plugins/core-plugins/menu-plugin/templates/admin-menu-list.template.ts
12313
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
12328
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
12314
12329
  function pluginStatusBadge(status) {
12315
12330
  if (status === "inactive") {
12316
12331
  return `<span class="inline-flex items-center rounded-md px-2 py-0.5 text-xs font-medium bg-red-50 dark:bg-red-500/10 text-red-700 dark:text-red-400 ring-1 ring-inset ring-red-600/20 dark:ring-red-500/20 ml-1">disabled</span>`;
@@ -12462,7 +12477,7 @@ function renderMenuListPage(data) {
12462
12477
  dynamicMenuItems: data.dynamicMenuItems,
12463
12478
  content: pageContent
12464
12479
  };
12465
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
12480
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
12466
12481
  }
12467
12482
  function renderMenuSettingsContent(items, pluginStatuses = {}, message) {
12468
12483
  const messageBanner = "";
@@ -12567,7 +12582,7 @@ function renderMenuSettingsContent(items, pluginStatuses = {}, message) {
12567
12582
  }
12568
12583
 
12569
12584
  // src/plugins/core-plugins/menu-plugin/templates/admin-menu-form.template.ts
12570
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
12585
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
12571
12586
 
12572
12587
  // src/plugins/core-plugins/menu-plugin/templates/icon-picker.template.ts
12573
12588
  var ICONS = [
@@ -12903,7 +12918,7 @@ function renderMenuFormPage(data) {
12903
12918
  dynamicMenuItems: data.dynamicMenuItems,
12904
12919
  content: pageContent
12905
12920
  };
12906
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
12921
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
12907
12922
  }
12908
12923
 
12909
12924
  // src/plugins/core-plugins/menu-plugin/routes/admin-menu.ts
@@ -12913,8 +12928,8 @@ function sanitizeUrl(url) {
12913
12928
  return trimmed;
12914
12929
  }
12915
12930
  var adminMenuRoutes = new hono.Hono();
12916
- adminMenuRoutes.use("*", chunk37V3RET3_cjs.requireAuth());
12917
- adminMenuRoutes.use("*", chunk37V3RET3_cjs.requireRole(["admin"]));
12931
+ adminMenuRoutes.use("*", chunkE7E3NL3Y_cjs.requireAuth());
12932
+ adminMenuRoutes.use("*", chunkE7E3NL3Y_cjs.requireRole(["admin"]));
12918
12933
  adminMenuRoutes.get("/", async (c) => {
12919
12934
  const db = c.env.DB;
12920
12935
  const user = c.get("user");
@@ -13128,7 +13143,7 @@ adminMenuRoutes.post("/:id/move-down", async (c) => {
13128
13143
  }
13129
13144
  return c.redirect("/admin/menu");
13130
13145
  });
13131
- var menuPlugin = chunkBP52BFIV_cjs.definePlugin({
13146
+ var menuPlugin = chunkD6FWEYQE_cjs.definePlugin({
13132
13147
  id: "menu",
13133
13148
  version: "1.0.0",
13134
13149
  name: "Menu Manager",
@@ -13143,7 +13158,7 @@ var menuPlugin = chunkBP52BFIV_cjs.definePlugin({
13143
13158
  const db = env.DB;
13144
13159
  if (!db) return;
13145
13160
  try {
13146
- const typeRegistry = new chunk37V3RET3_cjs.DocumentTypeRegistry(db);
13161
+ const typeRegistry = new chunkE7E3NL3Y_cjs.DocumentTypeRegistry(db);
13147
13162
  await typeRegistry.register({
13148
13163
  id: "menu_item",
13149
13164
  name: "menu_item",
@@ -13178,7 +13193,7 @@ var menuPlugin = chunkBP52BFIV_cjs.definePlugin({
13178
13193
  lockedFields: [...item.lockedFields]
13179
13194
  }, item.sortOrder);
13180
13195
  }
13181
- await chunkI767LVN7_cjs.reconcileMenuFromPlugins(db);
13196
+ await chunk6OA77UM7_cjs.reconcileMenuFromPlugins(db);
13182
13197
  } catch {
13183
13198
  }
13184
13199
  },
@@ -13196,9 +13211,9 @@ var menuPlugin = chunkBP52BFIV_cjs.definePlugin({
13196
13211
  }
13197
13212
  }
13198
13213
  });
13199
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
13214
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
13200
13215
  var adminRoutes6 = new hono.Hono();
13201
- adminRoutes6.use("*", chunk37V3RET3_cjs.requireAuth());
13216
+ adminRoutes6.use("*", chunkE7E3NL3Y_cjs.requireAuth());
13202
13217
  adminRoutes6.use("*", async (c, next) => {
13203
13218
  const user = c.get("user");
13204
13219
  if (user?.role !== "admin") {
@@ -13314,7 +13329,7 @@ adminRoutes6.get("/", async (c) => {
13314
13329
  </div>
13315
13330
  </div>
13316
13331
  `;
13317
- return c.html(chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
13332
+ return c.html(chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
13318
13333
  title: "Analytics",
13319
13334
  pageTitle: "Analytics Dashboard",
13320
13335
  currentPath: "/admin/analytics",
@@ -13345,7 +13360,7 @@ var QUERYABLE_FIELDS2 = [
13345
13360
  var EventTrackingService = class {
13346
13361
  constructor(db) {
13347
13362
  this.db = db;
13348
- this.docsService = new chunkLTZ5WYOK_cjs.DocumentsService(db, {
13363
+ this.docsService = new chunkJCBDXEY2_cjs.DocumentsService(db, {
13349
13364
  queryableFields: QUERYABLE_FIELDS2,
13350
13365
  maxVersionsPerRoot: 1,
13351
13366
  tenantId: TENANT2
@@ -13554,7 +13569,7 @@ apiRoutes4.get("/stats", async (c) => {
13554
13569
  });
13555
13570
 
13556
13571
  // src/plugins/core-plugins/analytics/index.ts
13557
- var analyticsPlugin = chunkBP52BFIV_cjs.definePlugin({
13572
+ var analyticsPlugin = chunkD6FWEYQE_cjs.definePlugin({
13558
13573
  id: "core-analytics",
13559
13574
  version: "1.0.0",
13560
13575
  name: "Analytics",
@@ -13701,7 +13716,7 @@ function esc2(s) {
13701
13716
  return (s || "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
13702
13717
  }
13703
13718
  async function getVariablesMap(db) {
13704
- let variables = chunkI767LVN7_cjs.getVariablesCached();
13719
+ let variables = chunk6OA77UM7_cjs.getVariablesCached();
13705
13720
  if (variables) return variables;
13706
13721
  try {
13707
13722
  const { results } = await db.prepare(
@@ -13711,7 +13726,7 @@ async function getVariablesMap(db) {
13711
13726
  for (const row of results || []) {
13712
13727
  variables.set(row.key, row.value);
13713
13728
  }
13714
- chunkI767LVN7_cjs.setVariablesCache(variables);
13729
+ chunk6OA77UM7_cjs.setVariablesCache(variables);
13715
13730
  return variables;
13716
13731
  } catch {
13717
13732
  return /* @__PURE__ */ new Map();
@@ -13780,7 +13795,7 @@ apiRoutes5.post("/", async (c) => {
13780
13795
  await db.prepare(
13781
13796
  "INSERT INTO global_variables (key, value, description, category, is_active) VALUES (?, ?, ?, ?, ?)"
13782
13797
  ).bind(key, value || "", description || "", category || "general", isActive !== false ? 1 : 0).run();
13783
- chunkI767LVN7_cjs.invalidateVariablesCache();
13798
+ chunk6OA77UM7_cjs.invalidateVariablesCache();
13784
13799
  const created = await db.prepare("SELECT * FROM global_variables WHERE key = ?").bind(key).first();
13785
13800
  return c.json({ success: true, data: formatVariable(created) }, 201);
13786
13801
  } catch {
@@ -13825,7 +13840,7 @@ apiRoutes5.put("/:id", async (c) => {
13825
13840
  updates.push("updated_at = strftime('%s', 'now')");
13826
13841
  params.push(id);
13827
13842
  await db.prepare(`UPDATE global_variables SET ${updates.join(", ")} WHERE id = ?`).bind(...params).run();
13828
- chunkI767LVN7_cjs.invalidateVariablesCache();
13843
+ chunk6OA77UM7_cjs.invalidateVariablesCache();
13829
13844
  const updated = await db.prepare("SELECT * FROM global_variables WHERE id = ?").bind(id).first();
13830
13845
  return c.json({ success: true, data: formatVariable(updated) });
13831
13846
  } catch {
@@ -13839,7 +13854,7 @@ apiRoutes5.delete("/:id", async (c) => {
13839
13854
  const existing = await db.prepare("SELECT id FROM global_variables WHERE id = ?").bind(id).first();
13840
13855
  if (!existing) return c.json({ error: "Variable not found" }, 404);
13841
13856
  await db.prepare("DELETE FROM global_variables WHERE id = ?").bind(id).run();
13842
- chunkI767LVN7_cjs.invalidateVariablesCache();
13857
+ chunk6OA77UM7_cjs.invalidateVariablesCache();
13843
13858
  return c.json({ success: true });
13844
13859
  } catch {
13845
13860
  return c.json({ success: false, error: "Failed to delete variable" }, 500);
@@ -13899,7 +13914,7 @@ adminRoutes7.put("/:id", async (c) => {
13899
13914
  const value = body.value;
13900
13915
  if (value !== void 0) {
13901
13916
  await db.prepare("UPDATE global_variables SET value = ?, updated_at = strftime('%s', 'now') WHERE id = ?").bind(value, id).run();
13902
- chunkI767LVN7_cjs.invalidateVariablesCache();
13917
+ chunk6OA77UM7_cjs.invalidateVariablesCache();
13903
13918
  }
13904
13919
  return c.html('<span class="text-green-400 text-xs">Saved</span>');
13905
13920
  });
@@ -13907,7 +13922,7 @@ adminRoutes7.post("/:id/toggle", async (c) => {
13907
13922
  const db = c.env.DB;
13908
13923
  const id = c.req.param("id");
13909
13924
  await db.prepare("UPDATE global_variables SET is_active = CASE WHEN is_active = 1 THEN 0 ELSE 1 END, updated_at = strftime('%s', 'now') WHERE id = ?").bind(id).run();
13910
- chunkI767LVN7_cjs.invalidateVariablesCache();
13925
+ chunk6OA77UM7_cjs.invalidateVariablesCache();
13911
13926
  c.header("HX-Redirect", "/admin/global-variables");
13912
13927
  return c.body(null, 204);
13913
13928
  });
@@ -13928,7 +13943,7 @@ adminRoutes7.post("/", async (c) => {
13928
13943
  await db.prepare(
13929
13944
  "INSERT INTO global_variables (key, value, description, category) VALUES (?, ?, ?, ?)"
13930
13945
  ).bind(key, value, description, category).run();
13931
- chunkI767LVN7_cjs.invalidateVariablesCache();
13946
+ chunk6OA77UM7_cjs.invalidateVariablesCache();
13932
13947
  c.header("HX-Redirect", "/admin/global-variables");
13933
13948
  return c.body(null, 204);
13934
13949
  });
@@ -13947,7 +13962,7 @@ adminRoutes7.post("/settings/editor-integration", async (c) => {
13947
13962
  adminRoutes7.delete("/:id", async (c) => {
13948
13963
  const db = c.env.DB;
13949
13964
  await db.prepare("DELETE FROM global_variables WHERE id = ?").bind(c.req.param("id")).run();
13950
- chunkI767LVN7_cjs.invalidateVariablesCache();
13965
+ chunk6OA77UM7_cjs.invalidateVariablesCache();
13951
13966
  return c.html("");
13952
13967
  });
13953
13968
  function renderAdminPage(variables, editorStatus = { editorActive: false, activeEditorName: "", enableEditorIntegration: true }) {
@@ -14265,7 +14280,7 @@ function renderAdminPage(variables, editorStatus = { editorActive: false, active
14265
14280
  </div>
14266
14281
  ` });
14267
14282
  }
14268
- var globalVariablesPlugin = chunkBP52BFIV_cjs.definePlugin({
14283
+ var globalVariablesPlugin = chunkD6FWEYQE_cjs.definePlugin({
14269
14284
  id: "global-variables",
14270
14285
  version: "1.1.0",
14271
14286
  name: "Global Variables",
@@ -14288,7 +14303,7 @@ var globalVariablesPlugin = chunkBP52BFIV_cjs.definePlugin({
14288
14303
  if (!db || !data) return data;
14289
14304
  const variables = await getVariablesMap(db);
14290
14305
  if (variables.size === 0) return data;
14291
- return chunkI767LVN7_cjs.resolveVariablesInObject(data, variables);
14306
+ return chunk6OA77UM7_cjs.resolveVariablesInObject(data, variables);
14292
14307
  } catch {
14293
14308
  return data;
14294
14309
  }
@@ -14306,7 +14321,7 @@ var globalVariablesPlugin = chunkBP52BFIV_cjs.definePlugin({
14306
14321
  },
14307
14322
  activate: async () => console.info("[GlobalVariables] Plugin activated"),
14308
14323
  deactivate: async () => {
14309
- chunkI767LVN7_cjs.invalidateVariablesCache();
14324
+ chunk6OA77UM7_cjs.invalidateVariablesCache();
14310
14325
  console.info("[GlobalVariables] Plugin deactivated, cache cleared");
14311
14326
  },
14312
14327
  uninstall: async (ctx) => {
@@ -14872,7 +14887,7 @@ function renderAdminPage2(shortcodes, editorStatus = { editorActive: false, acti
14872
14887
  </div>
14873
14888
  ` });
14874
14889
  }
14875
- var shortcodesPlugin = chunkBP52BFIV_cjs.definePlugin({
14890
+ var shortcodesPlugin = chunkD6FWEYQE_cjs.definePlugin({
14876
14891
  id: "shortcodes",
14877
14892
  version: "1.0.0",
14878
14893
  name: "Shortcodes",
@@ -14956,7 +14971,7 @@ helloWorldRoutes.get("/", async (c) => {
14956
14971
  </html>
14957
14972
  `);
14958
14973
  });
14959
- var helloWorldPlugin = chunkBP52BFIV_cjs.definePlugin({
14974
+ var helloWorldPlugin = chunkD6FWEYQE_cjs.definePlugin({
14960
14975
  id: "hello-world",
14961
14976
  version: "1.0.0",
14962
14977
  name: "Hello World",
@@ -15003,7 +15018,7 @@ var manifest_default2 = {
15003
15018
  author: "SonicJS Team"};
15004
15019
 
15005
15020
  // src/plugins/core-plugins/multi-tenant-plugin/templates/tenants-list.template.ts
15006
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
15021
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
15007
15022
  function statusBadge2(status) {
15008
15023
  return status === "active" ? '<span class="inline-flex items-center rounded-md bg-emerald-500/10 px-2 py-1 text-xs font-medium text-emerald-600 dark:text-emerald-400">Active</span>' : '<span class="inline-flex items-center rounded-md bg-zinc-500/10 px-2 py-1 text-xs font-medium text-zinc-600 dark:text-zinc-400">Inactive</span>';
15009
15024
  }
@@ -15076,7 +15091,7 @@ function renderTenantsList(data) {
15076
15091
  </table>
15077
15092
  </div>
15078
15093
  </div>`;
15079
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
15094
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
15080
15095
  title: "Tenants - SonicJS",
15081
15096
  pageTitle: "Tenants",
15082
15097
  currentPath: "/admin/tenants",
@@ -15095,7 +15110,7 @@ function renderTenantsInactive(data) {
15095
15110
  <a href="/admin/plugins" class="mt-6 inline-flex items-center rounded-lg bg-zinc-950 px-3.5 py-2 text-sm font-semibold text-white hover:bg-zinc-800 dark:bg-white dark:text-zinc-950 dark:hover:bg-zinc-200">Go to Plugins</a>
15096
15111
  </div>
15097
15112
  </div>`;
15098
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
15113
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
15099
15114
  title: "Tenants - SonicJS",
15100
15115
  pageTitle: "Tenants",
15101
15116
  currentPath: "/admin/tenants",
@@ -15106,7 +15121,7 @@ function renderTenantsInactive(data) {
15106
15121
  }
15107
15122
 
15108
15123
  // src/plugins/core-plugins/multi-tenant-plugin/templates/tenant-form.template.ts
15109
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
15124
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
15110
15125
  function fieldErrors(errors, field) {
15111
15126
  const list = errors?.[field];
15112
15127
  if (!list || list.length === 0) return "";
@@ -15174,7 +15189,7 @@ function renderTenantForm(data) {
15174
15189
  </form>
15175
15190
  </div>
15176
15191
  </div>`;
15177
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
15192
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
15178
15193
  title: `${data.isEdit ? "Edit Tenant" : "New Tenant"} - SonicJS`,
15179
15194
  pageTitle: data.isEdit ? "Edit Tenant" : "New Tenant",
15180
15195
  currentPath: "/admin/tenants",
@@ -15185,9 +15200,9 @@ function renderTenantForm(data) {
15185
15200
  }
15186
15201
 
15187
15202
  // src/plugins/core-plugins/multi-tenant-plugin/templates/tenant-members.template.ts
15188
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
15203
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
15189
15204
  function roleOptions(selected) {
15190
- return chunkI767LVN7_cjs.VALID_MEMBER_ROLES.map(
15205
+ return chunk6OA77UM7_cjs.VALID_MEMBER_ROLES.map(
15191
15206
  (r) => `<option value="${r}" ${r === selected ? "selected" : ""}>${r}</option>`
15192
15207
  ).join("");
15193
15208
  }
@@ -15249,7 +15264,7 @@ function renderInvitations(slug, invitations) {
15249
15264
  <div>
15250
15265
  <label for="invite-role" class="mb-1 block text-xs font-medium text-zinc-500 dark:text-zinc-400">Role</label>
15251
15266
  <select id="invite-role" name="role" class="rounded-lg border border-zinc-950/10 bg-white px-2 py-2 text-sm text-zinc-950 dark:border-white/10 dark:bg-zinc-800 dark:text-white">
15252
- ${chunkI767LVN7_cjs.VALID_MEMBER_ROLES.map((r) => `<option value="${r}" ${r === "viewer" ? "selected" : ""}>${r}</option>`).join("")}
15267
+ ${chunk6OA77UM7_cjs.VALID_MEMBER_ROLES.map((r) => `<option value="${r}" ${r === "viewer" ? "selected" : ""}>${r}</option>`).join("")}
15253
15268
  </select>
15254
15269
  </div>
15255
15270
  <button type="submit" data-send-invite class="rounded-lg bg-zinc-950 px-3.5 py-2 text-sm font-semibold text-white hover:bg-zinc-800 dark:bg-white dark:text-zinc-950 dark:hover:bg-zinc-200">Invite</button>
@@ -15332,7 +15347,7 @@ function renderTenantMembers(data) {
15332
15347
 
15333
15348
  ${renderInvitations(data.slug, data.invitations)}
15334
15349
  </div>`;
15335
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
15350
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
15336
15351
  title: `Members - ${data.tenantName} - SonicJS`,
15337
15352
  pageTitle: "Tenant Members",
15338
15353
  currentPath: "/admin/tenants",
@@ -15343,9 +15358,9 @@ function renderTenantMembers(data) {
15343
15358
  }
15344
15359
 
15345
15360
  // src/plugins/core-plugins/multi-tenant-plugin/templates/user-memberships.template.ts
15346
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
15361
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
15347
15362
  function roleOptions2(selected) {
15348
- return chunkI767LVN7_cjs.VALID_MEMBER_ROLES.map(
15363
+ return chunk6OA77UM7_cjs.VALID_MEMBER_ROLES.map(
15349
15364
  (r) => `<option value="${r}" ${r === selected ? "selected" : ""}>${r}</option>`
15350
15365
  ).join("");
15351
15366
  }
@@ -15418,7 +15433,7 @@ function renderUserMemberships(data) {
15418
15433
  </table>
15419
15434
  </div>
15420
15435
  </div>`;
15421
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
15436
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
15422
15437
  title: `Tenant memberships - ${data.userEmail} - SonicJS`,
15423
15438
  pageTitle: "Tenant memberships",
15424
15439
  currentPath: "/admin/users",
@@ -15429,7 +15444,7 @@ function renderUserMemberships(data) {
15429
15444
  }
15430
15445
 
15431
15446
  // src/plugins/core-plugins/multi-tenant-plugin/templates/role-usage.template.ts
15432
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
15447
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
15433
15448
  function renderRoleUsage(data) {
15434
15449
  const role = chunkMNWKYY5E_cjs.escapeHtml(data.roleName);
15435
15450
  const rows = data.assignments.length ? data.assignments.map((a) => `
@@ -15464,7 +15479,7 @@ function renderRoleUsage(data) {
15464
15479
  </table>
15465
15480
  </div>
15466
15481
  </div>`;
15467
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
15482
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
15468
15483
  title: `Role usage - ${data.roleName} - SonicJS`,
15469
15484
  pageTitle: "Role usage",
15470
15485
  currentPath: "/admin/tenants",
@@ -15507,7 +15522,7 @@ function zodToFieldErrors(error) {
15507
15522
  }
15508
15523
  async function isMultiTenantActive(db) {
15509
15524
  try {
15510
- const plugin2 = await new chunkQCJHCSOK_cjs.PluginService(db).getPlugin(chunkQCJHCSOK_cjs.MULTI_TENANT_PLUGIN_ID);
15525
+ const plugin2 = await new chunkYAURVGUK_cjs.PluginService(db).getPlugin(chunkYAURVGUK_cjs.MULTI_TENANT_PLUGIN_ID);
15511
15526
  return plugin2?.status === "active";
15512
15527
  } catch {
15513
15528
  return false;
@@ -15515,7 +15530,7 @@ async function isMultiTenantActive(db) {
15515
15530
  }
15516
15531
  function createTenantAdminRoutes() {
15517
15532
  const routes2 = new hono.Hono();
15518
- routes2.use("*", chunk37V3RET3_cjs.requireAuth());
15533
+ routes2.use("*", chunkE7E3NL3Y_cjs.requireAuth());
15519
15534
  routes2.use("*", async (c, next) => {
15520
15535
  const user = c.get("user");
15521
15536
  if (user?.role !== "admin") {
@@ -15529,7 +15544,7 @@ function createTenantAdminRoutes() {
15529
15544
  const form = await c.req.formData();
15530
15545
  const slug = String(form.get("tenant") ?? "").trim().toLowerCase();
15531
15546
  const redirect = String(form.get("redirect") ?? "");
15532
- const svc = new chunkI767LVN7_cjs.TenantService(db);
15547
+ const svc = new chunk6OA77UM7_cjs.TenantService(db);
15533
15548
  const tenant = await svc.getTenantBySlug(slug);
15534
15549
  if (!tenant || tenant.status !== "active") {
15535
15550
  return c.json({ error: "Unknown or inactive tenant" }, 400);
@@ -15539,7 +15554,7 @@ function createTenantAdminRoutes() {
15539
15554
  if (!user.isSuperAdmin && !await svc.isMember(user.userId, slug)) {
15540
15555
  return c.json({ error: "You are not a member of this tenant" }, 403);
15541
15556
  }
15542
- cookie.setCookie(c, chunkQCJHCSOK_cjs.TENANT_COOKIE, slug, {
15557
+ cookie.setCookie(c, chunkYAURVGUK_cjs.TENANT_COOKIE, slug, {
15543
15558
  path: "/",
15544
15559
  httpOnly: true,
15545
15560
  sameSite: "Lax",
@@ -15556,7 +15571,7 @@ function createTenantAdminRoutes() {
15556
15571
  if (!user) return c.redirect("/auth/login");
15557
15572
  const token = c.req.query("token") ?? "";
15558
15573
  try {
15559
- const { slug } = await new chunkI767LVN7_cjs.TenantService(db).acceptInvitation(token, user.userId, user.email);
15574
+ const { slug } = await new chunk6OA77UM7_cjs.TenantService(db).acceptInvitation(token, user.userId, user.email);
15560
15575
  return c.redirect(`/admin/tenants/${slug}/members?message=Invitation accepted`);
15561
15576
  } catch (error) {
15562
15577
  const message = error instanceof Error ? error.message : "Failed to accept invitation";
@@ -15584,7 +15599,7 @@ function createTenantAdminRoutes() {
15584
15599
  const userId = c.req.param("userId");
15585
15600
  const target = await db.prepare("SELECT id, email FROM auth_user WHERE id = ?").bind(userId).first();
15586
15601
  if (!target?.id) return c.redirect("/admin/users?message=User not found&type=error");
15587
- const svc = new chunkI767LVN7_cjs.TenantService(db);
15602
+ const svc = new chunk6OA77UM7_cjs.TenantService(db);
15588
15603
  const [memberships, allTenants] = await Promise.all([svc.listUserMemberships(userId), svc.listTenants()]);
15589
15604
  const memberSlugs = new Set(memberships.map((m) => m.slug));
15590
15605
  const availableTenants = allTenants.filter((t) => t.status === "active" && !memberSlugs.has(t.slug)).map((t) => ({ slug: t.slug, name: t.name }));
@@ -15609,10 +15624,10 @@ function createTenantAdminRoutes() {
15609
15624
  const slug = String(form.get("slug") ?? "").trim().toLowerCase();
15610
15625
  const role = String(form.get("role") ?? "viewer");
15611
15626
  const redirectTo = String(form.get("_redirect") ?? "") || `/admin/tenants/users/${userId}`;
15612
- if (!chunkI767LVN7_cjs.isValidMemberRole(role)) throw new Error(`Invalid role '${role}'`);
15627
+ if (!chunk6OA77UM7_cjs.isValidMemberRole(role)) throw new Error(`Invalid role '${role}'`);
15613
15628
  const target = await db.prepare("SELECT email FROM auth_user WHERE id = ?").bind(userId).first();
15614
15629
  if (!target) throw new Error("User not found");
15615
- const svc = new chunkI767LVN7_cjs.TenantService(db);
15630
+ const svc = new chunk6OA77UM7_cjs.TenantService(db);
15616
15631
  if (!await svc.getTenantBySlug(slug)) throw new Error("Tenant not found");
15617
15632
  if (await svc.isMember(userId, slug)) throw new Error(`Already a member of '${slug}'`);
15618
15633
  await svc.addMember(slug, userId, role, target.email ?? null);
@@ -15631,7 +15646,7 @@ function createTenantAdminRoutes() {
15631
15646
  const form = await c.req.formData();
15632
15647
  const role = String(form.get("role") ?? "");
15633
15648
  const redirectTo = String(form.get("_redirect") ?? "") || `/admin/tenants/users/${userId}`;
15634
- await new chunkI767LVN7_cjs.TenantService(db).setMemberRole(slug, userId, role);
15649
+ await new chunk6OA77UM7_cjs.TenantService(db).setMemberRole(slug, userId, role);
15635
15650
  return c.redirect(`${redirectTo}?message=Role updated`);
15636
15651
  } catch (error) {
15637
15652
  const message = error instanceof Error ? error.message : "Failed to update role";
@@ -15646,7 +15661,7 @@ function createTenantAdminRoutes() {
15646
15661
  try {
15647
15662
  const form = await c.req.formData();
15648
15663
  const redirectTo = String(form.get("_redirect") ?? "") || `/admin/tenants/users/${userId}`;
15649
- await new chunkI767LVN7_cjs.TenantService(db).removeMember(slug, userId);
15664
+ await new chunk6OA77UM7_cjs.TenantService(db).removeMember(slug, userId);
15650
15665
  return c.redirect(`${redirectTo}?message=Removed from ${encodeURIComponent(slug)}`);
15651
15666
  } catch (error) {
15652
15667
  const message = error instanceof Error ? error.message : "Failed to remove membership";
@@ -15661,7 +15676,7 @@ function createTenantAdminRoutes() {
15661
15676
  return c.html(renderTenantsInactive({ user: userShape(cur), version }));
15662
15677
  }
15663
15678
  const roleName = c.req.param("roleName");
15664
- const assignments = await new chunkI767LVN7_cjs.TenantService(db).listAssignmentsByRole(roleName);
15679
+ const assignments = await new chunk6OA77UM7_cjs.TenantService(db).listAssignmentsByRole(roleName);
15665
15680
  return c.html(renderRoleUsage({ roleName, assignments, user: userShape(cur), version }));
15666
15681
  });
15667
15682
  routes2.get("/", async (c) => {
@@ -15671,7 +15686,7 @@ function createTenantAdminRoutes() {
15671
15686
  if (!await isMultiTenantActive(db)) {
15672
15687
  return c.html(renderTenantsInactive({ user: userShape(user), version }));
15673
15688
  }
15674
- const svc = new chunkI767LVN7_cjs.TenantService(db);
15689
+ const svc = new chunk6OA77UM7_cjs.TenantService(db);
15675
15690
  await svc.ensureDefaultTenant();
15676
15691
  const tenants = await svc.listTenants();
15677
15692
  const [docRes, memberRes] = await db.batch([
@@ -15710,7 +15725,7 @@ function createTenantAdminRoutes() {
15710
15725
  formEntries = Object.fromEntries(form.entries());
15711
15726
  const validated = tenantFormSchema.parse(formEntries);
15712
15727
  if (!validated.slug) throw new zod.z.ZodError([{ code: "custom", message: "Slug is required", path: ["slug"] }]);
15713
- const svc = new chunkI767LVN7_cjs.TenantService(db);
15728
+ const svc = new chunk6OA77UM7_cjs.TenantService(db);
15714
15729
  await svc.createTenant({
15715
15730
  name: validated.name,
15716
15731
  slug: validated.slug,
@@ -15735,7 +15750,7 @@ function createTenantAdminRoutes() {
15735
15750
  if (!await isMultiTenantActive(db)) {
15736
15751
  return c.html(renderTenantsInactive({ user: userShape(user), version }));
15737
15752
  }
15738
- const tenant = await new chunkI767LVN7_cjs.TenantService(db).getTenantBySlug(c.req.param("slug"));
15753
+ const tenant = await new chunk6OA77UM7_cjs.TenantService(db).getTenantBySlug(c.req.param("slug"));
15739
15754
  if (!tenant) return c.redirect("/admin/tenants?message=Tenant not found&type=error");
15740
15755
  return c.html(renderTenantForm({ tenant, isEdit: true, user: userShape(user), version }));
15741
15756
  });
@@ -15745,7 +15760,7 @@ function createTenantAdminRoutes() {
15745
15760
  const version = c.get("appVersion");
15746
15761
  const slug = c.req.param("slug");
15747
15762
  if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
15748
- const svc = new chunkI767LVN7_cjs.TenantService(db);
15763
+ const svc = new chunk6OA77UM7_cjs.TenantService(db);
15749
15764
  try {
15750
15765
  const form = await c.req.formData();
15751
15766
  const validated = tenantFormSchema.parse(Object.fromEntries(form.entries()));
@@ -15770,7 +15785,7 @@ function createTenantAdminRoutes() {
15770
15785
  const slug = c.req.param("slug");
15771
15786
  if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
15772
15787
  try {
15773
- await new chunkI767LVN7_cjs.TenantService(db).deleteTenant(slug);
15788
+ await new chunk6OA77UM7_cjs.TenantService(db).deleteTenant(slug);
15774
15789
  return c.redirect("/admin/tenants?message=Tenant deleted successfully");
15775
15790
  } catch (error) {
15776
15791
  const message = error instanceof Error ? error.message : "Failed to delete tenant";
@@ -15785,7 +15800,7 @@ function createTenantAdminRoutes() {
15785
15800
  return c.html(renderTenantsInactive({ user: userShape(user), version }));
15786
15801
  }
15787
15802
  const slug = c.req.param("slug");
15788
- const svc = new chunkI767LVN7_cjs.TenantService(db);
15803
+ const svc = new chunk6OA77UM7_cjs.TenantService(db);
15789
15804
  const tenant = await svc.getTenantBySlug(slug);
15790
15805
  if (!tenant) return c.redirect("/admin/tenants?message=Tenant not found&type=error");
15791
15806
  const [members, invitations] = await Promise.all([svc.listMembers(slug), svc.listInvitations(slug)]);
@@ -15811,7 +15826,7 @@ function createTenantAdminRoutes() {
15811
15826
  const form = await c.req.formData();
15812
15827
  const email = String(form.get("email") ?? "");
15813
15828
  const role = String(form.get("role") ?? "viewer");
15814
- await new chunkI767LVN7_cjs.TenantService(db).addMemberByEmail(slug, email, role);
15829
+ await new chunk6OA77UM7_cjs.TenantService(db).addMemberByEmail(slug, email, role);
15815
15830
  return c.redirect(`/admin/tenants/${slug}/members?message=Member added`);
15816
15831
  } catch (error) {
15817
15832
  const message = error instanceof Error ? error.message : "Failed to add member";
@@ -15826,7 +15841,7 @@ function createTenantAdminRoutes() {
15826
15841
  try {
15827
15842
  const form = await c.req.formData();
15828
15843
  const role = String(form.get("role") ?? "");
15829
- await new chunkI767LVN7_cjs.TenantService(db).setMemberRole(slug, userId, role);
15844
+ await new chunk6OA77UM7_cjs.TenantService(db).setMemberRole(slug, userId, role);
15830
15845
  return c.redirect(`/admin/tenants/${slug}/members?message=Role updated`);
15831
15846
  } catch (error) {
15832
15847
  const message = error instanceof Error ? error.message : "Failed to update role";
@@ -15839,7 +15854,7 @@ function createTenantAdminRoutes() {
15839
15854
  const userId = c.req.param("userId");
15840
15855
  if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
15841
15856
  try {
15842
- await new chunkI767LVN7_cjs.TenantService(db).removeMember(slug, userId);
15857
+ await new chunk6OA77UM7_cjs.TenantService(db).removeMember(slug, userId);
15843
15858
  return c.redirect(`/admin/tenants/${slug}/members?message=Member removed`);
15844
15859
  } catch (error) {
15845
15860
  const message = error instanceof Error ? error.message : "Failed to remove member";
@@ -15855,12 +15870,12 @@ function createTenantAdminRoutes() {
15855
15870
  const form = await c.req.formData();
15856
15871
  const email = String(form.get("email") ?? "");
15857
15872
  const role = String(form.get("role") ?? "viewer");
15858
- const token = await new chunkI767LVN7_cjs.TenantService(db).createInvitation(slug, email, role, user?.userId ?? null);
15873
+ const token = await new chunk6OA77UM7_cjs.TenantService(db).createInvitation(slug, email, role, user?.userId ?? null);
15859
15874
  const origin = c.req.header("origin") || new URL(c.req.url).origin;
15860
15875
  const acceptUrl = `${origin}/join/invite?token=${encodeURIComponent(token)}`;
15861
15876
  let note;
15862
15877
  let noteType = "";
15863
- const svc2 = chunkI767LVN7_cjs.hasEmailService() ? chunkI767LVN7_cjs.getEmailService() : null;
15878
+ const svc2 = chunk6OA77UM7_cjs.hasEmailService() ? chunk6OA77UM7_cjs.getEmailService() : null;
15864
15879
  const hasRealProvider = !!svc2 && svc2.getProviderName() !== "console";
15865
15880
  if (hasRealProvider) {
15866
15881
  const result = await svc2.send({
@@ -15901,7 +15916,7 @@ function createTenantAdminRoutes() {
15901
15916
  WHERE i.id = ? AND t.slug = ? AND i.status = 'pending'`
15902
15917
  ).bind(id, slug).first();
15903
15918
  if (!inv) throw new Error("Invitation not found or already used");
15904
- const svc2 = chunkI767LVN7_cjs.hasEmailService() ? chunkI767LVN7_cjs.getEmailService() : null;
15919
+ const svc2 = chunk6OA77UM7_cjs.hasEmailService() ? chunk6OA77UM7_cjs.getEmailService() : null;
15905
15920
  const hasRealProvider = !!svc2 && svc2.getProviderName() !== "console";
15906
15921
  if (!hasRealProvider) throw new Error("No email plugin active");
15907
15922
  const origin = c.req.header("origin") || new URL(c.req.url).origin;
@@ -15926,7 +15941,7 @@ function createTenantAdminRoutes() {
15926
15941
  const id = c.req.param("id");
15927
15942
  if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
15928
15943
  try {
15929
- await new chunkI767LVN7_cjs.TenantService(db).revokeInvitation(slug, id);
15944
+ await new chunk6OA77UM7_cjs.TenantService(db).revokeInvitation(slug, id);
15930
15945
  return c.redirect(`/admin/tenants/${slug}/members?message=Invitation revoked`);
15931
15946
  } catch (error) {
15932
15947
  const message = error instanceof Error ? error.message : "Failed to revoke invitation";
@@ -16156,7 +16171,7 @@ function createJoinRoutes() {
16156
16171
  if (existing) return rerender("An account with this email already exists. Please sign in instead.");
16157
16172
  try {
16158
16173
  const userId = crypto.randomUUID();
16159
- const passwordHash = await chunk37V3RET3_cjs.AuthManager.hashPassword(password);
16174
+ const passwordHash = await chunkE7E3NL3Y_cjs.AuthManager.hashPassword(password);
16160
16175
  const now = Date.now();
16161
16176
  const nowSec = Math.floor(now / 1e3);
16162
16177
  await db.batch([
@@ -16169,8 +16184,8 @@ function createJoinRoutes() {
16169
16184
  VALUES (?, ?, ?, 'credential', ?, ?, ?)`
16170
16185
  ).bind(`cred-${userId}`, userId, userId, passwordHash, nowSec, nowSec)
16171
16186
  ]);
16172
- await new chunkI767LVN7_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
16173
- const auth = chunkGMMCCIQO_cjs.createAuth(c.env);
16187
+ await new chunk6OA77UM7_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
16188
+ const auth = chunkRSBZITK3_cjs.createAuth(c.env);
16174
16189
  const origin = new URL(c.req.url).origin;
16175
16190
  const baReq = new Request(`${origin}/auth/sign-in/email`, {
16176
16191
  method: "POST",
@@ -16225,7 +16240,7 @@ function createJoinRoutes() {
16225
16240
  version
16226
16241
  }), 400);
16227
16242
  try {
16228
- const auth = chunkGMMCCIQO_cjs.createAuth(c.env);
16243
+ const auth = chunkRSBZITK3_cjs.createAuth(c.env);
16229
16244
  const origin = new URL(c.req.url).origin;
16230
16245
  const baReq = new Request(`${origin}/auth/sign-in/email`, {
16231
16246
  method: "POST",
@@ -16237,7 +16252,7 @@ function createJoinRoutes() {
16237
16252
  const baBody = await baRes.json();
16238
16253
  const userId = baBody?.user?.id;
16239
16254
  if (!userId) return rerender("Sign-in succeeded but could not read user ID.");
16240
- await new chunkI767LVN7_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
16255
+ await new chunk6OA77UM7_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
16241
16256
  const headers = new Headers({ Location: "/admin?message=Welcome! You have joined " + encodeURIComponent(inv.tenantName) });
16242
16257
  copyBaCookies(baRes, headers);
16243
16258
  return new Response(null, { status: 302, headers });
@@ -16251,7 +16266,7 @@ function createJoinRoutes() {
16251
16266
 
16252
16267
  // src/plugins/core-plugins/multi-tenant-plugin/index.ts
16253
16268
  var TENANT_ICON = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3.75 21h16.5M4.5 3h15M5.25 3v18m13.5-18v18M9 6.75h1.5m-1.5 3h1.5m-1.5 3h1.5m3-6H15m-1.5 3H15m-1.5 3H15M9 21v-3.375c0-.621.504-1.125 1.125-1.125h3.75c.621 0 1.125.504 1.125 1.125V21"/></svg>`;
16254
- var multiTenantPlugin = chunkBP52BFIV_cjs.definePlugin({
16269
+ var multiTenantPlugin = chunkD6FWEYQE_cjs.definePlugin({
16255
16270
  id: manifest_default2.id,
16256
16271
  version: "1.0.0",
16257
16272
  name: manifest_default2.name,
@@ -16266,30 +16281,30 @@ var multiTenantPlugin = chunkBP52BFIV_cjs.definePlugin({
16266
16281
  { label: "Tenants", path: "/admin/tenants", icon: TENANT_ICON, order: 80 }
16267
16282
  ],
16268
16283
  activate: async () => {
16269
- chunkQCJHCSOK_cjs.invalidateTenantCache();
16284
+ chunkYAURVGUK_cjs.invalidateTenantCache();
16270
16285
  console.info("\u2705 Multi-Tenant plugin activated");
16271
16286
  },
16272
16287
  deactivate: async () => {
16273
- chunkQCJHCSOK_cjs.invalidateTenantCache();
16288
+ chunkYAURVGUK_cjs.invalidateTenantCache();
16274
16289
  console.info("\u274C Multi-Tenant plugin deactivated");
16275
16290
  }
16276
16291
  });
16277
16292
  var routes = new hono.Hono();
16278
- routes.use("*", chunk37V3RET3_cjs.requireAuth());
16279
- routes.use("*", chunk37V3RET3_cjs.requireRole(["admin", "editor"]));
16293
+ routes.use("*", chunkE7E3NL3Y_cjs.requireAuth());
16294
+ routes.use("*", chunkE7E3NL3Y_cjs.requireRole(["admin", "editor"]));
16280
16295
  routes.get("/:rootId", async (c) => {
16281
16296
  const { rootId } = c.req.param();
16282
16297
  const db = c.env.DB;
16283
- const scope = await chunkI767LVN7_cjs.resolveDocScope(c, db, { rootId });
16298
+ const scope = await chunk6OA77UM7_cjs.resolveDocScope(c, db, { rootId });
16284
16299
  if (!scope) {
16285
16300
  return c.html('<p class="text-zinc-500 dark:text-zinc-400 p-4">Document not found.</p>', 404);
16286
16301
  }
16287
16302
  if (!scope.docType?.settings?.versioning) {
16288
16303
  return c.html('<p class="text-zinc-500 dark:text-zinc-400 p-4">Versioning not enabled for this type.</p>', 404);
16289
16304
  }
16290
- const denied = await chunkI767LVN7_cjs.denyIfNotAllowed(c, db, rootId, "read", scope.docType?.settings, scope.tenantId);
16305
+ const denied = await chunk6OA77UM7_cjs.denyIfNotAllowed(c, db, rootId, "read", scope.docType?.settings, scope.tenantId);
16291
16306
  if (denied) return denied;
16292
- const repo = new chunkI767LVN7_cjs.DocumentRepository(db, scope.tenantId);
16307
+ const repo = new chunk6OA77UM7_cjs.DocumentRepository(db, scope.tenantId);
16293
16308
  const versions = await repo.getVersionHistory(rootId);
16294
16309
  const safeRootIdAttr = chunkMNWKYY5E_cjs.escapeHtml(rootId);
16295
16310
  const rows = versions.map((v) => {
@@ -16382,14 +16397,14 @@ routes.post("/:rootId/restore/:versionNumber", async (c) => {
16382
16397
  const { rootId, versionNumber } = c.req.param();
16383
16398
  const db = c.env.DB;
16384
16399
  const user = c.get("user");
16385
- const scope = await chunkI767LVN7_cjs.resolveDocScope(c, db, { rootId });
16400
+ const scope = await chunk6OA77UM7_cjs.resolveDocScope(c, db, { rootId });
16386
16401
  if (!scope) {
16387
16402
  return c.json({ error: "Document not found" }, 404);
16388
16403
  }
16389
16404
  if (!scope.docType?.settings?.versioning) {
16390
16405
  return c.json({ error: "Versioning not enabled for this type" }, 404);
16391
16406
  }
16392
- const denied = await chunkI767LVN7_cjs.denyIfNotAllowed(c, db, rootId, "update", scope.docType?.settings, scope.tenantId);
16407
+ const denied = await chunk6OA77UM7_cjs.denyIfNotAllowed(c, db, rootId, "update", scope.docType?.settings, scope.tenantId);
16393
16408
  if (denied) return denied;
16394
16409
  const row = await db.prepare("SELECT * FROM documents WHERE root_id = ? AND tenant_id = ? AND version_number = ? LIMIT 1").bind(rootId, scope.tenantId, Number(versionNumber)).first();
16395
16410
  if (!row) {
@@ -16399,7 +16414,7 @@ routes.post("/:rootId/restore/:versionNumber", async (c) => {
16399
16414
  const title = row.title ?? null;
16400
16415
  const slug = row.slug ?? null;
16401
16416
  const docType = scope.docType;
16402
- const svc = new chunkLTZ5WYOK_cjs.DocumentsService(db, {
16417
+ const svc = new chunkJCBDXEY2_cjs.DocumentsService(db, {
16403
16418
  queryableFields: docType?.queryableFields ?? [],
16404
16419
  typeSchemaVersion: docType?.schemaVersion ?? 1,
16405
16420
  maxVersionsPerRoot: docType?.settings?.maxVersionsPerRoot ?? 50,
@@ -16412,7 +16427,7 @@ routes.post("/:rootId/restore/:versionNumber", async (c) => {
16412
16427
  var routes_default = routes;
16413
16428
 
16414
16429
  // src/plugins/core-plugins/versioning-plugin/index.ts
16415
- var versioningPlugin = chunkBP52BFIV_cjs.definePlugin({
16430
+ var versioningPlugin = chunkD6FWEYQE_cjs.definePlugin({
16416
16431
  id: "versioning",
16417
16432
  version: "1.0.0",
16418
16433
  name: "Versioning",
@@ -16489,8 +16504,8 @@ function createMagicLinkAuthPlugin() {
16489
16504
  const baseUrl = new URL(c.req.url).origin;
16490
16505
  const magicLink = `${baseUrl}/auth/magic-link/verify?token=${token}`;
16491
16506
  try {
16492
- if (chunkI767LVN7_cjs.hasEmailService()) {
16493
- await chunkI767LVN7_cjs.getEmailService().send({
16507
+ if (chunk6OA77UM7_cjs.hasEmailService()) {
16508
+ await chunk6OA77UM7_cjs.getEmailService().send({
16494
16509
  to: normalizedEmail,
16495
16510
  subject: "Your Magic Link to Sign In",
16496
16511
  flow: "magic-link",
@@ -16567,19 +16582,19 @@ function createMagicLinkAuthPlugin() {
16567
16582
  SET used = 1, used_at = ?
16568
16583
  WHERE id = ?
16569
16584
  `).bind(Date.now(), magicLink.id).run();
16570
- const tokenTtl = await chunk37V3RET3_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
16571
- const jwtToken = await chunk37V3RET3_cjs.AuthManager.generateToken(
16585
+ const tokenTtl = await chunkE7E3NL3Y_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
16586
+ const jwtToken = await chunkE7E3NL3Y_cjs.AuthManager.generateToken(
16572
16587
  user.id,
16573
16588
  user.email,
16574
16589
  user.role,
16575
16590
  c.env.JWT_SECRET,
16576
16591
  tokenTtl
16577
16592
  );
16578
- chunk37V3RET3_cjs.AuthManager.setAuthCookie(c, jwtToken, { maxAge: tokenTtl });
16593
+ chunkE7E3NL3Y_cjs.AuthManager.setAuthCookie(c, jwtToken, { maxAge: tokenTtl });
16579
16594
  await db.prepare(`
16580
16595
  UPDATE auth_user SET last_login_at = ? WHERE id = ?
16581
16596
  `).bind(Date.now(), user.id).run();
16582
- chunkI767LVN7_cjs.dispatchHookEvent(
16597
+ chunk6OA77UM7_cjs.dispatchHookEvent(
16583
16598
  c,
16584
16599
  "auth:magic-link:consumed",
16585
16600
  { user: { id: user.id, email: user.email, role: user.role } },
@@ -17064,7 +17079,7 @@ async function warmCollections(db) {
17064
17079
  const collectionCache = chunkYA3TJ65D_cjs.getCacheService(config);
17065
17080
  let count = 0;
17066
17081
  try {
17067
- const results = chunkQCJHCSOK_cjs.getCollectionRegistry().listActive().map(chunkQCJHCSOK_cjs.collectionRecordToRow);
17082
+ const results = chunkYAURVGUK_cjs.getCollectionRegistry().listActive().map(chunkYAURVGUK_cjs.collectionRecordToRow);
17068
17083
  for (const collection of results) {
17069
17084
  const key = collectionCache.generateKey("item", collection.id);
17070
17085
  await collectionCache.set(key, collection);
@@ -17131,7 +17146,7 @@ async function warmNamespace(namespace, entries) {
17131
17146
  }
17132
17147
 
17133
17148
  // src/templates/pages/admin-cache.template.ts
17134
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
17149
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
17135
17150
  function renderCacheDashboard(data) {
17136
17151
  const pageContent = `
17137
17152
  <div class="space-y-6">
@@ -17335,7 +17350,7 @@ function renderCacheDashboard(data) {
17335
17350
  </script>
17336
17351
 
17337
17352
  <!-- Confirmation Dialogs -->
17338
- ${chunkI767LVN7_cjs.renderConfirmationDialog({
17353
+ ${chunk6OA77UM7_cjs.renderConfirmationDialog({
17339
17354
  id: "clear-all-cache-confirm",
17340
17355
  title: "Clear All Cache",
17341
17356
  message: "Are you sure you want to clear all cache entries? This cannot be undone.",
@@ -17346,7 +17361,7 @@ function renderCacheDashboard(data) {
17346
17361
  onConfirm: "performClearAllCaches()"
17347
17362
  })}
17348
17363
 
17349
- ${chunkI767LVN7_cjs.renderConfirmationDialog({
17364
+ ${chunk6OA77UM7_cjs.renderConfirmationDialog({
17350
17365
  id: "clear-namespace-cache-confirm",
17351
17366
  title: "Clear Namespace Cache",
17352
17367
  message: "Clear cache for this namespace?",
@@ -17357,7 +17372,7 @@ function renderCacheDashboard(data) {
17357
17372
  onConfirm: "performClearNamespaceCache()"
17358
17373
  })}
17359
17374
 
17360
- ${chunkI767LVN7_cjs.getConfirmationDialogScript()}
17375
+ ${chunk6OA77UM7_cjs.getConfirmationDialogScript()}
17361
17376
  `;
17362
17377
  const layoutData = {
17363
17378
  title: "Cache System",
@@ -17367,7 +17382,7 @@ function renderCacheDashboard(data) {
17367
17382
  version: data.version,
17368
17383
  content: pageContent
17369
17384
  };
17370
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
17385
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
17371
17386
  }
17372
17387
  function renderCollectionSettingsTab(collections) {
17373
17388
  if (collections.length === 0) {
@@ -17623,7 +17638,7 @@ app.get("/", async (c) => {
17623
17638
  const totalRequests = totalHits + totalMisses;
17624
17639
  const overallHitRate = totalRequests > 0 ? totalHits / totalRequests * 100 : 0;
17625
17640
  const DEFAULT_TTL = chunkYA3TJ65D_cjs.CACHE_CONFIGS.api?.ttl ?? 300;
17626
- const collections = chunkQCJHCSOK_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => {
17641
+ const collections = chunkYAURVGUK_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => {
17627
17642
  const cacheOverride = r.cache;
17628
17643
  const cacheEnabled = cacheOverride?.enabled !== false;
17629
17644
  const hasCustomTtl = typeof cacheOverride?.ttl === "number";
@@ -18160,9 +18175,9 @@ var faviconSvg = `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
18160
18175
  // src/app.ts
18161
18176
  function createSonicJSApp(config = {}) {
18162
18177
  const app2 = new hono.Hono();
18163
- const appVersion = config.version || chunkKKNEYIZJ_cjs.getCoreVersion();
18178
+ const appVersion = config.version || chunkBJ6NJL2E_cjs.getCoreVersion();
18164
18179
  const appName = config.name || "SonicJS AI";
18165
- const hookSystem = new chunkQJUJNTIU_cjs.HookSystemImpl();
18180
+ const hookSystem = new chunkI7MIRRFJ_cjs.HookSystemImpl();
18166
18181
  chunkJ6JTWD2A_cjs.setHookSystem(hookSystem);
18167
18182
  const magicLinkPlugin = createMagicLinkAuthPlugin();
18168
18183
  const corePluginsBeforeCatchAll = [
@@ -18170,7 +18185,7 @@ function createSonicJSApp(config = {}) {
18170
18185
  apiKeysPlugin,
18171
18186
  aiSearchPlugin,
18172
18187
  oauthProvidersPlugin,
18173
- chunkI767LVN7_cjs.userProfilesPlugin,
18188
+ chunk6OA77UM7_cjs.userProfilesPlugin,
18174
18189
  otpLoginPlugin,
18175
18190
  analyticsPlugin,
18176
18191
  stripePlugin,
@@ -18180,24 +18195,24 @@ function createSonicJSApp(config = {}) {
18180
18195
  shortcodesPlugin,
18181
18196
  helloWorldPlugin,
18182
18197
  multiTenantPlugin,
18183
- chunkI767LVN7_cjs.lexicalEditorPlugin,
18198
+ chunk6OA77UM7_cjs.lexicalEditorPlugin,
18184
18199
  versioningPlugin,
18185
18200
  menuPlugin
18186
18201
  ];
18187
18202
  const corePluginsAfterCatchAll = [emailPluginV3, magicLinkPlugin, emailReconciliationPlugin];
18188
- const wirePlugins = chunkQJUJNTIU_cjs.createPluginWirer(
18203
+ const wirePlugins = chunkI7MIRRFJ_cjs.createPluginWirer(
18189
18204
  () => [...corePluginsBeforeCatchAll, ...corePluginsAfterCatchAll, ...config.plugins?.register ?? []],
18190
18205
  // The capability-gated `ctx.cap.email` resolves to the app EmailService, which
18191
18206
  // is initialized (below) just before wiring on the first request.
18192
18207
  () => ({
18193
18208
  hooks: hookSystem,
18194
18209
  env: firstRequestEnv,
18195
- providers: { email: () => chunkI767LVN7_cjs.getEmailService() }
18210
+ providers: { email: () => chunk6OA77UM7_cjs.getEmailService() }
18196
18211
  })
18197
18212
  );
18198
18213
  let firstRequestEnv;
18199
18214
  const initEmailService = async (env = {}) => {
18200
- if (chunkI767LVN7_cjs.hasEmailService()) return;
18215
+ if (chunk6OA77UM7_cjs.hasEmailService()) return;
18201
18216
  let provider;
18202
18217
  let defaultFrom = config.email?.from;
18203
18218
  let defaultReplyTo;
@@ -18232,14 +18247,14 @@ function createSonicJSApp(config = {}) {
18232
18247
  }
18233
18248
  }
18234
18249
  defaultFrom = defaultFrom || env.DEFAULT_FROM_EMAIL || "noreply@sonicjs.local";
18235
- chunkI767LVN7_cjs.setEmailService(new EmailService({ provider, defaultFrom, defaultReplyTo, db: env.DB }));
18250
+ chunk6OA77UM7_cjs.setEmailService(new EmailService({ provider, defaultFrom, defaultReplyTo, db: env.DB }));
18236
18251
  };
18237
18252
  app2.use("*", async (c, next) => {
18238
18253
  c.set("appVersion", appVersion);
18239
18254
  await next();
18240
18255
  });
18241
- app2.use("*", chunk37V3RET3_cjs.metricsMiddleware());
18242
- app2.use("*", chunk37V3RET3_cjs.bootstrapMiddleware(config));
18256
+ app2.use("*", chunkE7E3NL3Y_cjs.metricsMiddleware());
18257
+ app2.use("*", chunkE7E3NL3Y_cjs.bootstrapMiddleware(config, [...corePluginsBeforeCatchAll, ...corePluginsAfterCatchAll, ...config.plugins?.register ?? []]));
18243
18258
  const boot = async (env) => {
18244
18259
  if (config.plugins?.disableAll) return;
18245
18260
  firstRequestEnv = env;
@@ -18277,13 +18292,13 @@ function createSonicJSApp(config = {}) {
18277
18292
  allowHeaders: ["Content-Type", "Authorization", "X-API-Key"],
18278
18293
  credentials: true
18279
18294
  }));
18280
- app2.use("*", chunk37V3RET3_cjs.securityHeadersMiddleware());
18281
- app2.use("*", chunk37V3RET3_cjs.csrfProtection());
18295
+ app2.use("*", chunkE7E3NL3Y_cjs.securityHeadersMiddleware());
18296
+ app2.use("*", chunkE7E3NL3Y_cjs.csrfProtection());
18282
18297
  app2.use("*", async (c, next) => {
18283
18298
  try {
18284
18299
  const reqUrl = new URL(c.req.url);
18285
18300
  const requestBaseURL = `${reqUrl.protocol}//${reqUrl.host}`;
18286
- const auth = chunkGMMCCIQO_cjs.createAuth(c.env, config.auth?.extendBetterAuth, requestBaseURL);
18301
+ const auth = chunkRSBZITK3_cjs.createAuth(c.env, config.auth?.extendBetterAuth, requestBaseURL);
18287
18302
  const session = await auth.api.getSession({ headers: c.req.raw.headers });
18288
18303
  if (session?.user) {
18289
18304
  const u = session.user;
@@ -18311,14 +18326,37 @@ function createSonicJSApp(config = {}) {
18311
18326
  await next();
18312
18327
  });
18313
18328
  app2.use("*", apiKeyAuthMiddleware());
18329
+ app2.use("*", async (c, next) => {
18330
+ if (!c.get("user")) {
18331
+ const authHeader = c.req.header("Authorization");
18332
+ if (authHeader?.startsWith("Bearer ") && !authHeader.startsWith("Bearer sk_")) {
18333
+ const token = authHeader.slice(7);
18334
+ try {
18335
+ const secret = c.env?.JWT_SECRET;
18336
+ const payload = await chunkE7E3NL3Y_cjs.AuthManager.verifyToken(token, secret);
18337
+ if (payload) {
18338
+ c.set("user", {
18339
+ userId: payload.userId,
18340
+ email: payload.email,
18341
+ role: payload.role,
18342
+ exp: payload.exp,
18343
+ iat: payload.iat
18344
+ });
18345
+ }
18346
+ } catch {
18347
+ }
18348
+ }
18349
+ }
18350
+ await next();
18351
+ });
18314
18352
  if (config.middleware?.afterAuth) {
18315
18353
  for (const middleware of config.middleware.afterAuth) {
18316
18354
  app2.use("*", middleware);
18317
18355
  }
18318
18356
  }
18319
- app2.use("*", chunkQCJHCSOK_cjs.tenantMiddleware());
18320
- app2.use("/admin/*", chunk37V3RET3_cjs.requireAuth());
18321
- app2.use("/admin/*", chunk37V3RET3_cjs.requireRbac("portal", "access"));
18357
+ app2.use("*", chunkYAURVGUK_cjs.tenantMiddleware());
18358
+ app2.use("/admin/*", chunkE7E3NL3Y_cjs.requireAuth());
18359
+ app2.use("/admin/*", chunkE7E3NL3Y_cjs.requireRbac("portal", "access"));
18322
18360
  app2.use("/admin/*", pluginMenuMiddleware());
18323
18361
  app2.use("/admin/*", menuMiddleware());
18324
18362
  const NAV_LANDING = [
@@ -18336,7 +18374,7 @@ function createSonicJSApp(config = {}) {
18336
18374
  if (!user?.userId) return next();
18337
18375
  let perms = [];
18338
18376
  try {
18339
- const { RbacService: RbacService2 } = await import('./rbac-7QZ4JZ2E.cjs');
18377
+ const { RbacService: RbacService2 } = await import('./rbac-AORZ6O3N.cjs');
18340
18378
  perms = await new RbacService2(c.env.DB, c.env.CACHE_KV).permissionsForUser(user.userId);
18341
18379
  } catch {
18342
18380
  return next();
@@ -18365,43 +18403,43 @@ function createSonicJSApp(config = {}) {
18365
18403
  });
18366
18404
  app2.route("/api/security-audit", apiRoutes2);
18367
18405
  app2.route("/admin/plugins/security-audit", adminRoutes3);
18368
- app2.route("/api/media", chunkI767LVN7_cjs.api_media_default);
18369
- app2.route("/api/system", chunkI767LVN7_cjs.api_system_default);
18370
- app2.route("/api/documents", chunkI767LVN7_cjs.apiDocumentsRoutes);
18371
- app2.route("/api", chunkI767LVN7_cjs.api_default);
18372
- app2.route("/admin/documents", chunkI767LVN7_cjs.adminDocumentsRoutes);
18373
- chunkQJUJNTIU_cjs.registerPluginRoutes(app2, [formsPlugin], { source: "core" });
18374
- app2.route("/admin/api", chunkI767LVN7_cjs.admin_api_default);
18375
- app2.route("/admin/collections", chunkI767LVN7_cjs.adminCollectionsRoutes);
18376
- app2.route("/admin/settings", chunkI767LVN7_cjs.adminSettingsRoutes);
18377
- app2.route("/admin/api-reference", chunkI767LVN7_cjs.router2);
18406
+ app2.route("/api/media", chunk6OA77UM7_cjs.api_media_default);
18407
+ app2.route("/api/system", chunk6OA77UM7_cjs.api_system_default);
18408
+ app2.route("/api/documents", chunk6OA77UM7_cjs.apiDocumentsRoutes);
18409
+ app2.route("/api", chunk6OA77UM7_cjs.api_default);
18410
+ app2.route("/admin/documents", chunk6OA77UM7_cjs.adminDocumentsRoutes);
18411
+ chunkI7MIRRFJ_cjs.registerPluginRoutes(app2, [formsPlugin], { source: "core" });
18412
+ app2.route("/admin/api", chunk6OA77UM7_cjs.admin_api_default);
18413
+ app2.route("/admin/collections", chunk6OA77UM7_cjs.adminCollectionsRoutes);
18414
+ app2.route("/admin/settings", chunk6OA77UM7_cjs.adminSettingsRoutes);
18415
+ app2.route("/admin/api-reference", chunk6OA77UM7_cjs.router2);
18378
18416
  app2.route("/admin/database-tools", createDatabaseToolsAdminRoutes());
18379
- app2.route("/admin/content", chunkI767LVN7_cjs.admin_content_default);
18380
- app2.route("/admin/media", chunkI767LVN7_cjs.adminMediaRoutes);
18417
+ app2.route("/admin/content", chunk6OA77UM7_cjs.admin_content_default);
18418
+ app2.route("/admin/media", chunk6OA77UM7_cjs.adminMediaRoutes);
18381
18419
  app2.use("/auth/*", securityAuditMiddleware());
18382
18420
  if (!config.plugins?.disableAll) {
18383
- chunkQJUJNTIU_cjs.registerPluginRoutes(app2, corePluginsBeforeCatchAll, { source: "core" });
18421
+ chunkI7MIRRFJ_cjs.registerPluginRoutes(app2, corePluginsBeforeCatchAll, { source: "core" });
18384
18422
  app2.route("/admin/cache", cache_default.getRoutes());
18385
18423
  if (config.plugins?.register && config.plugins.register.length > 0) {
18386
- chunkQJUJNTIU_cjs.registerPluginRoutes(app2, config.plugins.register, { source: "user" });
18424
+ chunkI7MIRRFJ_cjs.registerPluginRoutes(app2, config.plugins.register, { source: "user" });
18387
18425
  }
18388
18426
  }
18389
18427
  app2.route("/api/events", apiRoutes4);
18390
- app2.route("/admin/dashboard", chunkI767LVN7_cjs.router);
18391
- app2.route("/admin/plugins", chunkI767LVN7_cjs.adminPluginRoutes);
18392
- app2.route("/admin/logs", chunkI767LVN7_cjs.adminLogsRoutes);
18428
+ app2.route("/admin/dashboard", chunk6OA77UM7_cjs.router);
18429
+ app2.route("/admin/plugins", chunk6OA77UM7_cjs.adminPluginRoutes);
18430
+ app2.route("/admin/logs", chunk6OA77UM7_cjs.adminLogsRoutes);
18393
18431
  app2.route("/admin/rbac", adminRbacRoutes);
18394
- app2.route("/admin", chunkI767LVN7_cjs.userRoutes);
18395
- app2.route("/auth", chunkI767LVN7_cjs.auth_default);
18432
+ app2.route("/admin", chunk6OA77UM7_cjs.userRoutes);
18433
+ app2.route("/auth", chunk6OA77UM7_cjs.auth_default);
18396
18434
  app2.on(["GET", "POST"], "/auth/*", (c) => {
18397
18435
  const reqUrl = new URL(c.req.url);
18398
18436
  const requestBaseURL = `${reqUrl.protocol}//${reqUrl.host}`;
18399
- const auth = chunkGMMCCIQO_cjs.createAuth(c.env, config.auth?.extendBetterAuth, requestBaseURL);
18437
+ const auth = chunkRSBZITK3_cjs.createAuth(c.env, config.auth?.extendBetterAuth, requestBaseURL);
18400
18438
  return auth.handler(c.req.raw);
18401
18439
  });
18402
- app2.route("/", chunkI767LVN7_cjs.test_cleanup_default);
18440
+ app2.route("/", chunk6OA77UM7_cjs.test_cleanup_default);
18403
18441
  if (!config.plugins?.disableAll) {
18404
- chunkQJUJNTIU_cjs.registerPluginRoutes(app2, corePluginsAfterCatchAll, { source: "core" });
18442
+ chunkI7MIRRFJ_cjs.registerPluginRoutes(app2, corePluginsAfterCatchAll, { source: "core" });
18405
18443
  }
18406
18444
  if (!config.plugins?.disableAll) {
18407
18445
  const allMountedPlugins = [
@@ -18411,10 +18449,10 @@ function createSonicJSApp(config = {}) {
18411
18449
  ...config.plugins?.register ?? []
18412
18450
  ];
18413
18451
  const userPlugins = (config.plugins?.register ?? []).filter(
18414
- (p) => !chunkQCJHCSOK_cjs.PLUGIN_REGISTRY[p.id]
18452
+ (p) => !chunkYAURVGUK_cjs.PLUGIN_REGISTRY[p.id]
18415
18453
  );
18416
- chunkBP52BFIV_cjs.setPluginMenu(userPlugins.flatMap((p) => p.menu ?? []));
18417
- chunkBP52BFIV_cjs.setPluginDefinitions(allMountedPlugins);
18454
+ chunkD6FWEYQE_cjs.setPluginMenu(userPlugins.flatMap((p) => (p.menu ?? []).map((m) => ({ ...m, pluginId: p.id }))));
18455
+ chunkD6FWEYQE_cjs.setPluginDefinitions(allMountedPlugins);
18418
18456
  }
18419
18457
  app2.get("/favicon.svg", (c) => {
18420
18458
  return new Response(faviconSvg, {
@@ -19282,7 +19320,7 @@ var RedirectService = class {
19282
19320
  env;
19283
19321
  cloudflareService = null;
19284
19322
  getDocService() {
19285
- return new chunkLTZ5WYOK_cjs.DocumentsService(this.db, {
19323
+ return new chunkJCBDXEY2_cjs.DocumentsService(this.db, {
19286
19324
  queryableFields: REDIRECT_QUERYABLE_FIELDS,
19287
19325
  maxVersionsPerRoot: 1,
19288
19326
  tenantId: TENANT3
@@ -20585,7 +20623,7 @@ function renderLayout(title, content2) {
20585
20623
  }
20586
20624
  </style>
20587
20625
  `;
20588
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
20626
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
20589
20627
  title,
20590
20628
  currentPath: "/admin/redirects",
20591
20629
  content: customStyles + content2.toString()
@@ -20950,7 +20988,7 @@ function getFormScripts() {
20950
20988
  `;
20951
20989
  }
20952
20990
  function renderLayout2(title, content2) {
20953
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
20991
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
20954
20992
  title,
20955
20993
  currentPath: "/admin/redirects",
20956
20994
  content: content2.toString()
@@ -21908,7 +21946,7 @@ function createRedirectApiRoutes() {
21908
21946
  });
21909
21947
  return api;
21910
21948
  }
21911
- var redirectPlugin = chunkBP52BFIV_cjs.definePlugin({
21949
+ var redirectPlugin = chunkD6FWEYQE_cjs.definePlugin({
21912
21950
  id: manifest_default3.id,
21913
21951
  version: manifest_default3.version,
21914
21952
  name: manifest_default3.name,
@@ -21926,7 +21964,7 @@ var redirectPlugin = chunkBP52BFIV_cjs.definePlugin({
21926
21964
  async onBoot(ctx) {
21927
21965
  const db = ctx.env?.DB;
21928
21966
  if (!db) return;
21929
- const registry = new chunk37V3RET3_cjs.DocumentTypeRegistry(db);
21967
+ const registry = new chunkE7E3NL3Y_cjs.DocumentTypeRegistry(db);
21930
21968
  await registry.register({
21931
21969
  id: "redirect",
21932
21970
  name: "redirect",
@@ -22332,10 +22370,10 @@ function shapeDocument(doc, redactFields) {
22332
22370
  };
22333
22371
  }
22334
22372
  async function resolveType(ctx, typeId) {
22335
- const docType = await new chunk37V3RET3_cjs.DocumentTypeRegistry(ctx.db).findById(typeId);
22373
+ const docType = await new chunkE7E3NL3Y_cjs.DocumentTypeRegistry(ctx.db).findById(typeId);
22336
22374
  if (!docType || !docType.isActive) throw new McpToolError(`Unknown document type: ${typeId}`);
22337
- const effTenant = chunkI767LVN7_cjs.effectiveTenantForType(ctx.tenantId, docType.settings);
22338
- const repo = new chunkI767LVN7_cjs.DocumentRepository(ctx.db, effTenant);
22375
+ const effTenant = chunk6OA77UM7_cjs.effectiveTenantForType(ctx.tenantId, docType.settings);
22376
+ const repo = new chunk6OA77UM7_cjs.DocumentRepository(ctx.db, effTenant);
22339
22377
  return { docType, repo };
22340
22378
  }
22341
22379
  async function execList(ctx, typeId, args) {
@@ -22373,11 +22411,11 @@ async function execGet(ctx, typeId, args) {
22373
22411
 
22374
22412
  // src/plugins/core-plugins/mcp-plugin/tools/mutations.ts
22375
22413
  async function resolveWriteScope(ctx, typeId) {
22376
- const docType = await new chunk37V3RET3_cjs.DocumentTypeRegistry(ctx.db).findById(typeId);
22414
+ const docType = await new chunkE7E3NL3Y_cjs.DocumentTypeRegistry(ctx.db).findById(typeId);
22377
22415
  if (!docType || !docType.isActive) throw new McpToolError(`Unknown document type: ${typeId}`);
22378
- const effTenant = chunkI767LVN7_cjs.effectiveTenantForType(ctx.tenantId, docType.settings);
22379
- const repo = new chunkI767LVN7_cjs.DocumentRepository(ctx.db, effTenant);
22380
- const svc = new chunkLTZ5WYOK_cjs.DocumentsService(ctx.db, {
22416
+ const effTenant = chunk6OA77UM7_cjs.effectiveTenantForType(ctx.tenantId, docType.settings);
22417
+ const repo = new chunk6OA77UM7_cjs.DocumentRepository(ctx.db, effTenant);
22418
+ const svc = new chunkJCBDXEY2_cjs.DocumentsService(ctx.db, {
22381
22419
  queryableFields: docType.queryableFields ?? [],
22382
22420
  typeSchemaVersion: docType.schemaVersion,
22383
22421
  maxVersionsPerRoot: docType.settings?.maxVersionsPerRoot,
@@ -22391,7 +22429,7 @@ async function assertAllowed(scope, ctx, rootId, permission) {
22391
22429
  if (!ok) throw new McpToolError(`Permission denied: cannot ${permission} ${scope.docType.id}`);
22392
22430
  }
22393
22431
  function applyUserFieldDefaults(data, typeId, userId) {
22394
- const col = chunkQCJHCSOK_cjs.getCollectionRegistry().getByName(typeId);
22432
+ const col = chunkYAURVGUK_cjs.getCollectionRegistry().getByName(typeId);
22395
22433
  if (!col?.schema?.properties) return data;
22396
22434
  const props = col.schema.properties;
22397
22435
  const patched = { ...data };
@@ -22404,7 +22442,7 @@ async function execCreate(ctx, typeId, args) {
22404
22442
  const scope = await resolveWriteScope(ctx, typeId);
22405
22443
  await assertAllowed(scope, ctx, "", "create");
22406
22444
  const data = redact(applyUserFieldDefaults(args.data ?? {}, typeId, ctx.userId), ctx.redactFields);
22407
- const input = chunkI767LVN7_cjs.createDocumentSchema.parse({
22445
+ const input = chunk6OA77UM7_cjs.createDocumentSchema.parse({
22408
22446
  typeId,
22409
22447
  tenantId: scope.effTenant,
22410
22448
  title: args.title ?? null,
@@ -22422,7 +22460,7 @@ async function execUpdate(ctx, typeId, args) {
22422
22460
  const current = await scope.repo.getCurrentDraft(args.id);
22423
22461
  if (!current || current.typeId !== typeId) throw new McpToolError("Document not found");
22424
22462
  await assertAllowed(scope, ctx, args.id, "update");
22425
- const patch = chunkI767LVN7_cjs.updateDocumentSchema.parse({
22463
+ const patch = chunk6OA77UM7_cjs.updateDocumentSchema.parse({
22426
22464
  ...args.title !== void 0 ? { title: args.title } : {},
22427
22465
  ...args.slug !== void 0 ? { slug: args.slug } : {},
22428
22466
  ...args.data !== void 0 ? { data: redact(args.data, ctx.redactFields) } : {}
@@ -22528,8 +22566,8 @@ function createMcpRoutes(options = {}) {
22528
22566
  rpcError(id, JSON_RPC.UNAUTHORIZED, "Unauthorized: provide a valid API key via Authorization: Bearer sk_...")
22529
22567
  );
22530
22568
  }
22531
- const { tenantId, principalSet, userId } = chunkI767LVN7_cjs.getDocumentRequestContext(c);
22532
- const registry = chunkQCJHCSOK_cjs.getCollectionRegistry();
22569
+ const { tenantId, principalSet, userId } = chunk6OA77UM7_cjs.getDocumentRequestContext(c);
22570
+ const registry = chunkYAURVGUK_cjs.getCollectionRegistry();
22533
22571
  const active = registry.listActive();
22534
22572
  const collections = new Map(active.map((col) => [col.name, col]));
22535
22573
  const cfg = resolveMcpConfig(options, active);
@@ -22629,7 +22667,7 @@ function createMcpRoutes(options = {}) {
22629
22667
  }
22630
22668
 
22631
22669
  // src/plugins/core-plugins/mcp-plugin/admin/templates.ts
22632
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
22670
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
22633
22671
  function accessBadge(ok) {
22634
22672
  return ok ? `<span class="inline-flex items-center rounded-full bg-emerald-50 dark:bg-emerald-900/20 px-2 py-0.5 text-xs font-medium text-emerald-700 dark:text-emerald-400 ring-1 ring-emerald-600/20 dark:ring-emerald-400/20">Yes</span>` : `<span class="inline-flex items-center rounded-full bg-zinc-100 dark:bg-zinc-800 px-2 py-0.5 text-xs font-medium text-zinc-500 dark:text-zinc-400 ring-1 ring-zinc-200 dark:ring-zinc-700">No</span>`;
22635
22673
  }
@@ -22812,13 +22850,13 @@ function renderMcpDashboardPage(data) {
22812
22850
  version,
22813
22851
  dynamicMenuItems
22814
22852
  };
22815
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
22853
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
22816
22854
  }
22817
22855
 
22818
22856
  // src/plugins/core-plugins/mcp-plugin/admin/routes.ts
22819
22857
  function createMcpAdminRoutes(options = {}) {
22820
22858
  const routes2 = new hono.Hono();
22821
- routes2.use("*", chunk37V3RET3_cjs.requireAuth());
22859
+ routes2.use("*", chunkE7E3NL3Y_cjs.requireAuth());
22822
22860
  routes2.use("*", async (c, next) => {
22823
22861
  const user = c.get("user");
22824
22862
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
@@ -22827,7 +22865,7 @@ function createMcpAdminRoutes(options = {}) {
22827
22865
  routes2.get("/", async (c) => {
22828
22866
  const url = new URL(c.req.url);
22829
22867
  const endpointUrl = `${url.protocol}//${url.host}/mcp`;
22830
- const registry = chunkQCJHCSOK_cjs.getCollectionRegistry();
22868
+ const registry = chunkYAURVGUK_cjs.getCollectionRegistry();
22831
22869
  const active = registry.listActive();
22832
22870
  const collections = new Map(active.map((col) => [col.name, col]));
22833
22871
  const cfg = resolveMcpConfig(options, active);
@@ -22850,7 +22888,7 @@ function createMcpAdminRoutes(options = {}) {
22850
22888
  // src/plugins/core-plugins/mcp-plugin/index.ts
22851
22889
  var MCP_ICON = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg>`;
22852
22890
  function mcpPlugin(options = {}) {
22853
- return chunkBP52BFIV_cjs.definePlugin({
22891
+ return chunkD6FWEYQE_cjs.definePlugin({
22854
22892
  id: "mcp",
22855
22893
  version: "1.0.0",
22856
22894
  name: "MCP Server",
@@ -22869,91 +22907,91 @@ function createMcpPlugin(options) {
22869
22907
  }
22870
22908
 
22871
22909
  // src/index.ts
22872
- var VERSION = chunkKKNEYIZJ_cjs.package_default.version;
22910
+ var VERSION = chunkBJ6NJL2E_cjs.package_default.version;
22873
22911
 
22874
22912
  Object.defineProperty(exports, "DocumentRepository", {
22875
22913
  enumerable: true,
22876
- get: function () { return chunkI767LVN7_cjs.DocumentRepository; }
22914
+ get: function () { return chunk6OA77UM7_cjs.DocumentRepository; }
22877
22915
  });
22878
22916
  Object.defineProperty(exports, "ROUTES_INFO", {
22879
22917
  enumerable: true,
22880
- get: function () { return chunkI767LVN7_cjs.ROUTES_INFO; }
22918
+ get: function () { return chunk6OA77UM7_cjs.ROUTES_INFO; }
22881
22919
  });
22882
22920
  Object.defineProperty(exports, "adminApiRoutes", {
22883
22921
  enumerable: true,
22884
- get: function () { return chunkI767LVN7_cjs.admin_api_default; }
22922
+ get: function () { return chunk6OA77UM7_cjs.admin_api_default; }
22885
22923
  });
22886
22924
  Object.defineProperty(exports, "adminCheckboxRoutes", {
22887
22925
  enumerable: true,
22888
- get: function () { return chunkI767LVN7_cjs.adminCheckboxRoutes; }
22926
+ get: function () { return chunk6OA77UM7_cjs.adminCheckboxRoutes; }
22889
22927
  });
22890
22928
  Object.defineProperty(exports, "adminCollectionsRoutes", {
22891
22929
  enumerable: true,
22892
- get: function () { return chunkI767LVN7_cjs.adminCollectionsRoutes; }
22930
+ get: function () { return chunk6OA77UM7_cjs.adminCollectionsRoutes; }
22893
22931
  });
22894
22932
  Object.defineProperty(exports, "adminContentRoutes", {
22895
22933
  enumerable: true,
22896
- get: function () { return chunkI767LVN7_cjs.admin_content_default; }
22934
+ get: function () { return chunk6OA77UM7_cjs.admin_content_default; }
22897
22935
  });
22898
22936
  Object.defineProperty(exports, "adminDashboardRoutes", {
22899
22937
  enumerable: true,
22900
- get: function () { return chunkI767LVN7_cjs.router; }
22938
+ get: function () { return chunk6OA77UM7_cjs.router; }
22901
22939
  });
22902
22940
  Object.defineProperty(exports, "adminLogsRoutes", {
22903
22941
  enumerable: true,
22904
- get: function () { return chunkI767LVN7_cjs.adminLogsRoutes; }
22942
+ get: function () { return chunk6OA77UM7_cjs.adminLogsRoutes; }
22905
22943
  });
22906
22944
  Object.defineProperty(exports, "adminMediaRoutes", {
22907
22945
  enumerable: true,
22908
- get: function () { return chunkI767LVN7_cjs.adminMediaRoutes; }
22946
+ get: function () { return chunk6OA77UM7_cjs.adminMediaRoutes; }
22909
22947
  });
22910
22948
  Object.defineProperty(exports, "adminPluginRoutes", {
22911
22949
  enumerable: true,
22912
- get: function () { return chunkI767LVN7_cjs.adminPluginRoutes; }
22950
+ get: function () { return chunk6OA77UM7_cjs.adminPluginRoutes; }
22913
22951
  });
22914
22952
  Object.defineProperty(exports, "adminSettingsRoutes", {
22915
22953
  enumerable: true,
22916
- get: function () { return chunkI767LVN7_cjs.adminSettingsRoutes; }
22954
+ get: function () { return chunk6OA77UM7_cjs.adminSettingsRoutes; }
22917
22955
  });
22918
22956
  Object.defineProperty(exports, "adminUsersRoutes", {
22919
22957
  enumerable: true,
22920
- get: function () { return chunkI767LVN7_cjs.userRoutes; }
22958
+ get: function () { return chunk6OA77UM7_cjs.userRoutes; }
22921
22959
  });
22922
22960
  Object.defineProperty(exports, "apiContentCrudRoutes", {
22923
22961
  enumerable: true,
22924
- get: function () { return chunkI767LVN7_cjs.api_content_crud_default; }
22962
+ get: function () { return chunk6OA77UM7_cjs.api_content_crud_default; }
22925
22963
  });
22926
22964
  Object.defineProperty(exports, "apiMediaRoutes", {
22927
22965
  enumerable: true,
22928
- get: function () { return chunkI767LVN7_cjs.api_media_default; }
22966
+ get: function () { return chunk6OA77UM7_cjs.api_media_default; }
22929
22967
  });
22930
22968
  Object.defineProperty(exports, "apiRoutes", {
22931
22969
  enumerable: true,
22932
- get: function () { return chunkI767LVN7_cjs.api_default; }
22970
+ get: function () { return chunk6OA77UM7_cjs.api_default; }
22933
22971
  });
22934
22972
  Object.defineProperty(exports, "apiSystemRoutes", {
22935
22973
  enumerable: true,
22936
- get: function () { return chunkI767LVN7_cjs.api_system_default; }
22974
+ get: function () { return chunk6OA77UM7_cjs.api_system_default; }
22937
22975
  });
22938
22976
  Object.defineProperty(exports, "authRoutes", {
22939
22977
  enumerable: true,
22940
- get: function () { return chunkI767LVN7_cjs.auth_default; }
22978
+ get: function () { return chunk6OA77UM7_cjs.auth_default; }
22941
22979
  });
22942
22980
  Object.defineProperty(exports, "createUserProfilesPlugin", {
22943
22981
  enumerable: true,
22944
- get: function () { return chunkI767LVN7_cjs.createUserProfilesPlugin; }
22982
+ get: function () { return chunk6OA77UM7_cjs.createUserProfilesPlugin; }
22945
22983
  });
22946
22984
  Object.defineProperty(exports, "defineUserProfile", {
22947
22985
  enumerable: true,
22948
- get: function () { return chunkI767LVN7_cjs.defineUserProfile; }
22986
+ get: function () { return chunk6OA77UM7_cjs.defineUserProfile; }
22949
22987
  });
22950
22988
  Object.defineProperty(exports, "getUserProfileConfig", {
22951
22989
  enumerable: true,
22952
- get: function () { return chunkI767LVN7_cjs.getUserProfileConfig; }
22990
+ get: function () { return chunk6OA77UM7_cjs.getUserProfileConfig; }
22953
22991
  });
22954
22992
  Object.defineProperty(exports, "userProfilesPlugin", {
22955
22993
  enumerable: true,
22956
- get: function () { return chunkI767LVN7_cjs.userProfilesPlugin; }
22994
+ get: function () { return chunk6OA77UM7_cjs.userProfilesPlugin; }
22957
22995
  });
22958
22996
  Object.defineProperty(exports, "Logger", {
22959
22997
  enumerable: true,
@@ -23109,259 +23147,259 @@ Object.defineProperty(exports, "workflowHistory", {
23109
23147
  });
23110
23148
  Object.defineProperty(exports, "AuthManager", {
23111
23149
  enumerable: true,
23112
- get: function () { return chunk37V3RET3_cjs.AuthManager; }
23150
+ get: function () { return chunkE7E3NL3Y_cjs.AuthManager; }
23113
23151
  });
23114
23152
  Object.defineProperty(exports, "PermissionManager", {
23115
23153
  enumerable: true,
23116
- get: function () { return chunk37V3RET3_cjs.PermissionManager; }
23154
+ get: function () { return chunkE7E3NL3Y_cjs.PermissionManager; }
23117
23155
  });
23118
23156
  Object.defineProperty(exports, "bootstrapDocumentTypes", {
23119
23157
  enumerable: true,
23120
- get: function () { return chunk37V3RET3_cjs.bootstrapDocumentTypes; }
23158
+ get: function () { return chunkE7E3NL3Y_cjs.bootstrapDocumentTypes; }
23121
23159
  });
23122
23160
  Object.defineProperty(exports, "bootstrapMiddleware", {
23123
23161
  enumerable: true,
23124
- get: function () { return chunk37V3RET3_cjs.bootstrapMiddleware; }
23162
+ get: function () { return chunkE7E3NL3Y_cjs.bootstrapMiddleware; }
23125
23163
  });
23126
23164
  Object.defineProperty(exports, "cacheHeaders", {
23127
23165
  enumerable: true,
23128
- get: function () { return chunk37V3RET3_cjs.cacheHeaders; }
23166
+ get: function () { return chunkE7E3NL3Y_cjs.cacheHeaders; }
23129
23167
  });
23130
23168
  Object.defineProperty(exports, "compressionMiddleware", {
23131
23169
  enumerable: true,
23132
- get: function () { return chunk37V3RET3_cjs.compressionMiddleware; }
23170
+ get: function () { return chunkE7E3NL3Y_cjs.compressionMiddleware; }
23133
23171
  });
23134
23172
  Object.defineProperty(exports, "detailedLoggingMiddleware", {
23135
23173
  enumerable: true,
23136
- get: function () { return chunk37V3RET3_cjs.detailedLoggingMiddleware; }
23174
+ get: function () { return chunkE7E3NL3Y_cjs.detailedLoggingMiddleware; }
23137
23175
  });
23138
23176
  Object.defineProperty(exports, "getActivePlugins", {
23139
23177
  enumerable: true,
23140
- get: function () { return chunk37V3RET3_cjs.getActivePlugins; }
23178
+ get: function () { return chunkE7E3NL3Y_cjs.getActivePlugins; }
23141
23179
  });
23142
23180
  Object.defineProperty(exports, "isPluginActive", {
23143
23181
  enumerable: true,
23144
- get: function () { return chunk37V3RET3_cjs.isPluginActive; }
23182
+ get: function () { return chunkE7E3NL3Y_cjs.isPluginActive; }
23145
23183
  });
23146
23184
  Object.defineProperty(exports, "logActivity", {
23147
23185
  enumerable: true,
23148
- get: function () { return chunk37V3RET3_cjs.logActivity; }
23186
+ get: function () { return chunkE7E3NL3Y_cjs.logActivity; }
23149
23187
  });
23150
23188
  Object.defineProperty(exports, "loggingMiddleware", {
23151
23189
  enumerable: true,
23152
- get: function () { return chunk37V3RET3_cjs.loggingMiddleware; }
23190
+ get: function () { return chunkE7E3NL3Y_cjs.loggingMiddleware; }
23153
23191
  });
23154
23192
  Object.defineProperty(exports, "optionalAuth", {
23155
23193
  enumerable: true,
23156
- get: function () { return chunk37V3RET3_cjs.optionalAuth; }
23194
+ get: function () { return chunkE7E3NL3Y_cjs.optionalAuth; }
23157
23195
  });
23158
23196
  Object.defineProperty(exports, "performanceLoggingMiddleware", {
23159
23197
  enumerable: true,
23160
- get: function () { return chunk37V3RET3_cjs.performanceLoggingMiddleware; }
23198
+ get: function () { return chunkE7E3NL3Y_cjs.performanceLoggingMiddleware; }
23161
23199
  });
23162
23200
  Object.defineProperty(exports, "requireActivePlugin", {
23163
23201
  enumerable: true,
23164
- get: function () { return chunk37V3RET3_cjs.requireActivePlugin; }
23202
+ get: function () { return chunkE7E3NL3Y_cjs.requireActivePlugin; }
23165
23203
  });
23166
23204
  Object.defineProperty(exports, "requireActivePlugins", {
23167
23205
  enumerable: true,
23168
- get: function () { return chunk37V3RET3_cjs.requireActivePlugins; }
23206
+ get: function () { return chunkE7E3NL3Y_cjs.requireActivePlugins; }
23169
23207
  });
23170
23208
  Object.defineProperty(exports, "requireAnyPermission", {
23171
23209
  enumerable: true,
23172
- get: function () { return chunk37V3RET3_cjs.requireAnyPermission; }
23210
+ get: function () { return chunkE7E3NL3Y_cjs.requireAnyPermission; }
23173
23211
  });
23174
23212
  Object.defineProperty(exports, "requireAuth", {
23175
23213
  enumerable: true,
23176
- get: function () { return chunk37V3RET3_cjs.requireAuth; }
23214
+ get: function () { return chunkE7E3NL3Y_cjs.requireAuth; }
23177
23215
  });
23178
23216
  Object.defineProperty(exports, "requirePermission", {
23179
23217
  enumerable: true,
23180
- get: function () { return chunk37V3RET3_cjs.requirePermission; }
23218
+ get: function () { return chunkE7E3NL3Y_cjs.requirePermission; }
23181
23219
  });
23182
23220
  Object.defineProperty(exports, "requireRole", {
23183
23221
  enumerable: true,
23184
- get: function () { return chunk37V3RET3_cjs.requireRole; }
23222
+ get: function () { return chunkE7E3NL3Y_cjs.requireRole; }
23185
23223
  });
23186
23224
  Object.defineProperty(exports, "securityHeaders", {
23187
23225
  enumerable: true,
23188
- get: function () { return chunk37V3RET3_cjs.securityHeadersMiddleware; }
23226
+ get: function () { return chunkE7E3NL3Y_cjs.securityHeadersMiddleware; }
23189
23227
  });
23190
23228
  Object.defineProperty(exports, "securityLoggingMiddleware", {
23191
23229
  enumerable: true,
23192
- get: function () { return chunk37V3RET3_cjs.securityLoggingMiddleware; }
23230
+ get: function () { return chunkE7E3NL3Y_cjs.securityLoggingMiddleware; }
23193
23231
  });
23194
23232
  Object.defineProperty(exports, "DocumentsService", {
23195
23233
  enumerable: true,
23196
- get: function () { return chunkLTZ5WYOK_cjs.DocumentsService; }
23234
+ get: function () { return chunkJCBDXEY2_cjs.DocumentsService; }
23197
23235
  });
23198
23236
  Object.defineProperty(exports, "RbacService", {
23199
23237
  enumerable: true,
23200
- get: function () { return chunkLTZ5WYOK_cjs.RbacService; }
23238
+ get: function () { return chunkJCBDXEY2_cjs.RbacService; }
23201
23239
  });
23202
23240
  Object.defineProperty(exports, "PluginBootstrapService", {
23203
23241
  enumerable: true,
23204
- get: function () { return chunkQCJHCSOK_cjs.PluginBootstrapService; }
23242
+ get: function () { return chunkYAURVGUK_cjs.PluginBootstrapService; }
23205
23243
  });
23206
23244
  Object.defineProperty(exports, "PluginServiceClass", {
23207
23245
  enumerable: true,
23208
- get: function () { return chunkQCJHCSOK_cjs.PluginService; }
23246
+ get: function () { return chunkYAURVGUK_cjs.PluginService; }
23209
23247
  });
23210
23248
  Object.defineProperty(exports, "getAvailableCollectionNames", {
23211
23249
  enumerable: true,
23212
- get: function () { return chunkQCJHCSOK_cjs.getAvailableCollectionNames; }
23250
+ get: function () { return chunkYAURVGUK_cjs.getAvailableCollectionNames; }
23213
23251
  });
23214
23252
  Object.defineProperty(exports, "loadCollectionConfig", {
23215
23253
  enumerable: true,
23216
- get: function () { return chunkQCJHCSOK_cjs.loadCollectionConfig; }
23254
+ get: function () { return chunkYAURVGUK_cjs.loadCollectionConfig; }
23217
23255
  });
23218
23256
  Object.defineProperty(exports, "loadCollectionConfigs", {
23219
23257
  enumerable: true,
23220
- get: function () { return chunkQCJHCSOK_cjs.loadCollectionConfigs; }
23258
+ get: function () { return chunkYAURVGUK_cjs.loadCollectionConfigs; }
23221
23259
  });
23222
23260
  Object.defineProperty(exports, "registerCollections", {
23223
23261
  enumerable: true,
23224
- get: function () { return chunkQCJHCSOK_cjs.registerCollections; }
23262
+ get: function () { return chunkYAURVGUK_cjs.registerCollections; }
23225
23263
  });
23226
23264
  Object.defineProperty(exports, "validateCollectionConfig", {
23227
23265
  enumerable: true,
23228
- get: function () { return chunkQCJHCSOK_cjs.validateCollectionConfig; }
23266
+ get: function () { return chunkYAURVGUK_cjs.validateCollectionConfig; }
23229
23267
  });
23230
23268
  Object.defineProperty(exports, "MigrationService", {
23231
23269
  enumerable: true,
23232
- get: function () { return chunkA2SN3RVL_cjs.MigrationService; }
23270
+ get: function () { return chunkMOGK3U4A_cjs.MigrationService; }
23233
23271
  });
23234
23272
  Object.defineProperty(exports, "renderFilterBar", {
23235
23273
  enumerable: true,
23236
- get: function () { return chunkBBEKHLTW_cjs.renderFilterBar; }
23274
+ get: function () { return chunkCN3T3TDI_cjs.renderFilterBar; }
23237
23275
  });
23238
23276
  Object.defineProperty(exports, "getConfirmationDialogScript", {
23239
23277
  enumerable: true,
23240
- get: function () { return chunkE66UVONV_cjs.getConfirmationDialogScript; }
23278
+ get: function () { return chunkOUBUS74I_cjs.getConfirmationDialogScript; }
23241
23279
  });
23242
23280
  Object.defineProperty(exports, "renderAlert", {
23243
23281
  enumerable: true,
23244
- get: function () { return chunkE66UVONV_cjs.renderAlert; }
23282
+ get: function () { return chunkOUBUS74I_cjs.renderAlert; }
23245
23283
  });
23246
23284
  Object.defineProperty(exports, "renderConfirmationDialog", {
23247
23285
  enumerable: true,
23248
- get: function () { return chunkE66UVONV_cjs.renderConfirmationDialog; }
23286
+ get: function () { return chunkOUBUS74I_cjs.renderConfirmationDialog; }
23249
23287
  });
23250
23288
  Object.defineProperty(exports, "renderForm", {
23251
23289
  enumerable: true,
23252
- get: function () { return chunkE66UVONV_cjs.renderForm; }
23290
+ get: function () { return chunkOUBUS74I_cjs.renderForm; }
23253
23291
  });
23254
23292
  Object.defineProperty(exports, "renderFormField", {
23255
23293
  enumerable: true,
23256
- get: function () { return chunkE66UVONV_cjs.renderFormField; }
23294
+ get: function () { return chunkOUBUS74I_cjs.renderFormField; }
23257
23295
  });
23258
23296
  Object.defineProperty(exports, "renderPagination", {
23259
23297
  enumerable: true,
23260
- get: function () { return chunkE66UVONV_cjs.renderPagination; }
23298
+ get: function () { return chunkOUBUS74I_cjs.renderPagination; }
23261
23299
  });
23262
23300
  Object.defineProperty(exports, "renderTable", {
23263
23301
  enumerable: true,
23264
- get: function () { return chunkE66UVONV_cjs.renderTable; }
23302
+ get: function () { return chunkOUBUS74I_cjs.renderTable; }
23265
23303
  });
23266
23304
  Object.defineProperty(exports, "renderAdminLayoutCatalyst", {
23267
23305
  enumerable: true,
23268
- get: function () { return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst; }
23306
+ get: function () { return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst; }
23269
23307
  });
23270
23308
  Object.defineProperty(exports, "HookSystemImpl", {
23271
23309
  enumerable: true,
23272
- get: function () { return chunkQJUJNTIU_cjs.HookSystemImpl; }
23310
+ get: function () { return chunkI7MIRRFJ_cjs.HookSystemImpl; }
23273
23311
  });
23274
23312
  Object.defineProperty(exports, "HookUtils", {
23275
23313
  enumerable: true,
23276
- get: function () { return chunkQJUJNTIU_cjs.HookUtils; }
23314
+ get: function () { return chunkI7MIRRFJ_cjs.HookUtils; }
23277
23315
  });
23278
23316
  Object.defineProperty(exports, "PluginDependencyCycleError", {
23279
23317
  enumerable: true,
23280
- get: function () { return chunkQJUJNTIU_cjs.PluginDependencyCycleError; }
23318
+ get: function () { return chunkI7MIRRFJ_cjs.PluginDependencyCycleError; }
23281
23319
  });
23282
23320
  Object.defineProperty(exports, "PluginManagerClass", {
23283
23321
  enumerable: true,
23284
- get: function () { return chunkQJUJNTIU_cjs.PluginManager; }
23322
+ get: function () { return chunkI7MIRRFJ_cjs.PluginManager; }
23285
23323
  });
23286
23324
  Object.defineProperty(exports, "PluginRegistryImpl", {
23287
23325
  enumerable: true,
23288
- get: function () { return chunkQJUJNTIU_cjs.PluginRegistryImpl; }
23326
+ get: function () { return chunkI7MIRRFJ_cjs.PluginRegistryImpl; }
23289
23327
  });
23290
23328
  Object.defineProperty(exports, "PluginValidatorClass", {
23291
23329
  enumerable: true,
23292
- get: function () { return chunkQJUJNTIU_cjs.PluginValidator; }
23330
+ get: function () { return chunkI7MIRRFJ_cjs.PluginValidator; }
23293
23331
  });
23294
23332
  Object.defineProperty(exports, "RegisterPluginsError", {
23295
23333
  enumerable: true,
23296
- get: function () { return chunkQJUJNTIU_cjs.RegisterPluginsError; }
23334
+ get: function () { return chunkI7MIRRFJ_cjs.RegisterPluginsError; }
23297
23335
  });
23298
23336
  Object.defineProperty(exports, "ScopedHookSystemClass", {
23299
23337
  enumerable: true,
23300
- get: function () { return chunkQJUJNTIU_cjs.ScopedHookSystem; }
23338
+ get: function () { return chunkI7MIRRFJ_cjs.ScopedHookSystem; }
23301
23339
  });
23302
23340
  Object.defineProperty(exports, "collectCronSchedules", {
23303
23341
  enumerable: true,
23304
- get: function () { return chunkQJUJNTIU_cjs.collectCronSchedules; }
23342
+ get: function () { return chunkI7MIRRFJ_cjs.collectCronSchedules; }
23305
23343
  });
23306
23344
  Object.defineProperty(exports, "collectCrons", {
23307
23345
  enumerable: true,
23308
- get: function () { return chunkQJUJNTIU_cjs.collectCrons; }
23346
+ get: function () { return chunkI7MIRRFJ_cjs.collectCrons; }
23309
23347
  });
23310
23348
  Object.defineProperty(exports, "createScheduledHandler", {
23311
23349
  enumerable: true,
23312
- get: function () { return chunkQJUJNTIU_cjs.createScheduledHandler; }
23350
+ get: function () { return chunkI7MIRRFJ_cjs.createScheduledHandler; }
23313
23351
  });
23314
23352
  Object.defineProperty(exports, "dispatchCronTick", {
23315
23353
  enumerable: true,
23316
- get: function () { return chunkQJUJNTIU_cjs.dispatchCronTick; }
23354
+ get: function () { return chunkI7MIRRFJ_cjs.dispatchCronTick; }
23317
23355
  });
23318
23356
  Object.defineProperty(exports, "registerPlugins", {
23319
23357
  enumerable: true,
23320
- get: function () { return chunkQJUJNTIU_cjs.registerPlugins; }
23358
+ get: function () { return chunkI7MIRRFJ_cjs.registerPlugins; }
23321
23359
  });
23322
23360
  Object.defineProperty(exports, "topoSort", {
23323
23361
  enumerable: true,
23324
- get: function () { return chunkQJUJNTIU_cjs.topoSort; }
23362
+ get: function () { return chunkI7MIRRFJ_cjs.topoSort; }
23325
23363
  });
23326
23364
  Object.defineProperty(exports, "applySchemaDefaults", {
23327
23365
  enumerable: true,
23328
- get: function () { return chunkBP52BFIV_cjs.applySchemaDefaults; }
23366
+ get: function () { return chunkD6FWEYQE_cjs.applySchemaDefaults; }
23329
23367
  });
23330
23368
  Object.defineProperty(exports, "definePlugin", {
23331
23369
  enumerable: true,
23332
- get: function () { return chunkBP52BFIV_cjs.definePlugin; }
23370
+ get: function () { return chunkD6FWEYQE_cjs.definePlugin; }
23333
23371
  });
23334
23372
  Object.defineProperty(exports, "getPluginMenu", {
23335
23373
  enumerable: true,
23336
- get: function () { return chunkBP52BFIV_cjs.getPluginMenu; }
23374
+ get: function () { return chunkD6FWEYQE_cjs.getPluginMenu; }
23337
23375
  });
23338
23376
  Object.defineProperty(exports, "isDefinedPlugin", {
23339
23377
  enumerable: true,
23340
- get: function () { return chunkBP52BFIV_cjs.isDefinedPlugin; }
23378
+ get: function () { return chunkD6FWEYQE_cjs.isDefinedPlugin; }
23341
23379
  });
23342
23380
  Object.defineProperty(exports, "parseConfigSchema", {
23343
23381
  enumerable: true,
23344
- get: function () { return chunkBP52BFIV_cjs.parseConfigSchema; }
23382
+ get: function () { return chunkD6FWEYQE_cjs.parseConfigSchema; }
23345
23383
  });
23346
23384
  Object.defineProperty(exports, "parseFormDataToSettings", {
23347
23385
  enumerable: true,
23348
- get: function () { return chunkBP52BFIV_cjs.parseFormDataToSettings; }
23386
+ get: function () { return chunkD6FWEYQE_cjs.parseFormDataToSettings; }
23349
23387
  });
23350
23388
  Object.defineProperty(exports, "renderSchemaFields", {
23351
23389
  enumerable: true,
23352
- get: function () { return chunkBP52BFIV_cjs.renderSchemaFields; }
23390
+ get: function () { return chunkD6FWEYQE_cjs.renderSchemaFields; }
23353
23391
  });
23354
23392
  Object.defineProperty(exports, "resetPluginMenu", {
23355
23393
  enumerable: true,
23356
- get: function () { return chunkBP52BFIV_cjs.resetPluginMenu; }
23394
+ get: function () { return chunkD6FWEYQE_cjs.resetPluginMenu; }
23357
23395
  });
23358
23396
  Object.defineProperty(exports, "resolvePluginMenuItems", {
23359
23397
  enumerable: true,
23360
- get: function () { return chunkBP52BFIV_cjs.resolvePluginMenuItems; }
23398
+ get: function () { return chunkD6FWEYQE_cjs.resolvePluginMenuItems; }
23361
23399
  });
23362
23400
  Object.defineProperty(exports, "setPluginMenu", {
23363
23401
  enumerable: true,
23364
- get: function () { return chunkBP52BFIV_cjs.setPluginMenu; }
23402
+ get: function () { return chunkD6FWEYQE_cjs.setPluginMenu; }
23365
23403
  });
23366
23404
  Object.defineProperty(exports, "getHookSystem", {
23367
23405
  enumerable: true,
@@ -23385,23 +23423,23 @@ Object.defineProperty(exports, "setHookSystem", {
23385
23423
  });
23386
23424
  Object.defineProperty(exports, "QueryFilterBuilder", {
23387
23425
  enumerable: true,
23388
- get: function () { return chunkIXUHXTHW_cjs.QueryFilterBuilder; }
23426
+ get: function () { return chunkDLTT7QZU_cjs.QueryFilterBuilder; }
23389
23427
  });
23390
23428
  Object.defineProperty(exports, "TemplateRenderer", {
23391
23429
  enumerable: true,
23392
- get: function () { return chunkIXUHXTHW_cjs.TemplateRenderer; }
23430
+ get: function () { return chunkDLTT7QZU_cjs.TemplateRenderer; }
23393
23431
  });
23394
23432
  Object.defineProperty(exports, "buildQuery", {
23395
23433
  enumerable: true,
23396
- get: function () { return chunkIXUHXTHW_cjs.buildQuery; }
23434
+ get: function () { return chunkDLTT7QZU_cjs.buildQuery; }
23397
23435
  });
23398
23436
  Object.defineProperty(exports, "renderTemplate", {
23399
23437
  enumerable: true,
23400
- get: function () { return chunkIXUHXTHW_cjs.renderTemplate; }
23438
+ get: function () { return chunkDLTT7QZU_cjs.renderTemplate; }
23401
23439
  });
23402
23440
  Object.defineProperty(exports, "templateRenderer", {
23403
23441
  enumerable: true,
23404
- get: function () { return chunkIXUHXTHW_cjs.templateRenderer; }
23442
+ get: function () { return chunkDLTT7QZU_cjs.templateRenderer; }
23405
23443
  });
23406
23444
  Object.defineProperty(exports, "metricsTracker", {
23407
23445
  enumerable: true,
@@ -23409,11 +23447,11 @@ Object.defineProperty(exports, "metricsTracker", {
23409
23447
  });
23410
23448
  Object.defineProperty(exports, "SONICJS_VERSION", {
23411
23449
  enumerable: true,
23412
- get: function () { return chunkKKNEYIZJ_cjs.SONICJS_VERSION; }
23450
+ get: function () { return chunkBJ6NJL2E_cjs.SONICJS_VERSION; }
23413
23451
  });
23414
23452
  Object.defineProperty(exports, "getCoreVersion", {
23415
23453
  enumerable: true,
23416
- get: function () { return chunkKKNEYIZJ_cjs.getCoreVersion; }
23454
+ get: function () { return chunkBJ6NJL2E_cjs.getCoreVersion; }
23417
23455
  });
23418
23456
  Object.defineProperty(exports, "escapeHtml", {
23419
23457
  enumerable: true,