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

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 (51) hide show
  1. package/dist/{chunk-RDH6PUOP.js → chunk-4LVVMVQI.js} +2 -2
  2. package/dist/{chunk-RDH6PUOP.js.map → chunk-4LVVMVQI.js.map} +1 -1
  3. package/dist/{chunk-WCA4VENG.js → chunk-4UYJPHSV.js} +5 -5
  4. package/dist/{chunk-WCA4VENG.js.map → chunk-4UYJPHSV.js.map} +1 -1
  5. package/dist/{chunk-DSXEVMOM.js → chunk-5U75XP74.js} +2 -2
  6. package/dist/{chunk-DSXEVMOM.js.map → chunk-5U75XP74.js.map} +1 -1
  7. package/dist/{chunk-DTGCXWWM.cjs → chunk-5UXU3LP4.cjs} +10 -10
  8. package/dist/{chunk-DTGCXWWM.cjs.map → chunk-5UXU3LP4.cjs.map} +1 -1
  9. package/dist/{chunk-GMZ5TGYP.js → chunk-7OTOXWEB.js} +3 -3
  10. package/dist/{chunk-GMZ5TGYP.js.map → chunk-7OTOXWEB.js.map} +1 -1
  11. package/dist/{chunk-3E7IROND.cjs → chunk-7RUW244J.cjs} +217 -208
  12. package/dist/chunk-7RUW244J.cjs.map +1 -0
  13. package/dist/{chunk-5RSB5SEK.cjs → chunk-A4KUJ3LD.cjs} +4 -4
  14. package/dist/{chunk-5RSB5SEK.cjs.map → chunk-A4KUJ3LD.cjs.map} +1 -1
  15. package/dist/{chunk-AQJEMVAY.cjs → chunk-AOUVUF32.cjs} +3 -3
  16. package/dist/{chunk-AQJEMVAY.cjs.map → chunk-AOUVUF32.cjs.map} +1 -1
  17. package/dist/{chunk-4SHNHNRP.cjs → chunk-FCLKX2OS.cjs} +15 -15
  18. package/dist/{chunk-4SHNHNRP.cjs.map → chunk-FCLKX2OS.cjs.map} +1 -1
  19. package/dist/{chunk-MYQ7KZUQ.js → chunk-GICS5AIO.js} +4 -4
  20. package/dist/{chunk-MYQ7KZUQ.js.map → chunk-GICS5AIO.js.map} +1 -1
  21. package/dist/{chunk-W53J3BJ2.js → chunk-JEX3UPZL.js} +3 -3
  22. package/dist/{chunk-W53J3BJ2.js.map → chunk-JEX3UPZL.js.map} +1 -1
  23. package/dist/{chunk-5ARIHAGN.cjs → chunk-KVBHB7QP.cjs} +2 -2
  24. package/dist/{chunk-5ARIHAGN.cjs.map → chunk-KVBHB7QP.cjs.map} +1 -1
  25. package/dist/{chunk-TQG5FNNR.cjs → chunk-OJC4G5JE.cjs} +2 -2
  26. package/dist/{chunk-TQG5FNNR.cjs.map → chunk-OJC4G5JE.cjs.map} +1 -1
  27. package/dist/{chunk-5UCMLBRQ.js → chunk-ZP77LTN4.js} +24 -15
  28. package/dist/chunk-ZP77LTN4.js.map +1 -0
  29. package/dist/index.cjs +450 -321
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.js +204 -75
  32. package/dist/index.js.map +1 -1
  33. package/dist/middleware.cjs +33 -33
  34. package/dist/middleware.js +4 -4
  35. package/dist/migrations-HMX5SPN2.js +4 -0
  36. package/dist/{migrations-HZJ6U6SX.js.map → migrations-HMX5SPN2.js.map} +1 -1
  37. package/dist/migrations-V73ARYV5.cjs +13 -0
  38. package/dist/{migrations-VQAFXMU7.cjs.map → migrations-V73ARYV5.cjs.map} +1 -1
  39. package/dist/plugins.cjs +40 -40
  40. package/dist/plugins.js +3 -3
  41. package/dist/routes.cjs +26 -26
  42. package/dist/routes.js +6 -6
  43. package/dist/services.cjs +18 -18
  44. package/dist/services.js +2 -2
  45. package/dist/utils.cjs +3 -3
  46. package/dist/utils.js +1 -1
  47. package/package.json +1 -1
  48. package/dist/chunk-3E7IROND.cjs.map +0 -1
  49. package/dist/chunk-5UCMLBRQ.js.map +0 -1
  50. package/dist/migrations-HZJ6U6SX.js +0 -4
  51. package/dist/migrations-VQAFXMU7.cjs +0 -13
package/dist/index.cjs CHANGED
@@ -1,27 +1,27 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkGMMCCIQO_cjs = require('./chunk-GMMCCIQO.cjs');
4
- var chunk3E7IROND_cjs = require('./chunk-3E7IROND.cjs');
4
+ var chunk7RUW244J_cjs = require('./chunk-7RUW244J.cjs');
5
5
  require('./chunk-XWVDSM2L.cjs');
6
6
  require('./chunk-N32OWET6.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 chunk4SHNHNRP_cjs = require('./chunk-4SHNHNRP.cjs');
10
+ var chunkFCLKX2OS_cjs = require('./chunk-FCLKX2OS.cjs');
11
11
  var chunkLTZ5WYOK_cjs = require('./chunk-LTZ5WYOK.cjs');
12
12
  var chunkKIGVVO6N_cjs = require('./chunk-KIGVVO6N.cjs');
13
- var chunk5ARIHAGN_cjs = require('./chunk-5ARIHAGN.cjs');
14
- var chunkTQG5FNNR_cjs = require('./chunk-TQG5FNNR.cjs');
13
+ var chunkKVBHB7QP_cjs = require('./chunk-KVBHB7QP.cjs');
14
+ var chunkOJC4G5JE_cjs = require('./chunk-OJC4G5JE.cjs');
15
15
  var chunkCRGUD4KC_cjs = require('./chunk-CRGUD4KC.cjs');
16
16
  var chunkPXNTCCPE_cjs = require('./chunk-PXNTCCPE.cjs');
17
17
  var chunkK623Q6WD_cjs = require('./chunk-K623Q6WD.cjs');
18
- var chunkDTGCXWWM_cjs = require('./chunk-DTGCXWWM.cjs');
19
- var chunk5RSB5SEK_cjs = require('./chunk-5RSB5SEK.cjs');
18
+ var chunk5UXU3LP4_cjs = require('./chunk-5UXU3LP4.cjs');
19
+ var chunkA4KUJ3LD_cjs = require('./chunk-A4KUJ3LD.cjs');
20
20
  var chunkJ6JTWD2A_cjs = require('./chunk-J6JTWD2A.cjs');
21
21
  var chunkIXUHXTHW_cjs = require('./chunk-IXUHXTHW.cjs');
22
22
  var chunkRCQ2HIQD_cjs = require('./chunk-RCQ2HIQD.cjs');
23
23
  require('./chunk-P3XDZL6Q.cjs');
24
- var chunkAQJEMVAY_cjs = require('./chunk-AQJEMVAY.cjs');
24
+ var chunkAOUVUF32_cjs = require('./chunk-AOUVUF32.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');
@@ -182,9 +182,9 @@ var DatabaseToolsService = class {
182
182
  }
183
183
  }
184
184
  /**
185
- * Get table data with optional pagination and sorting
185
+ * Get table data with optional pagination, sorting, and search
186
186
  */
187
- async getTableData(tableName, limit = 100, offset = 0, sortColumn, sortDirection = "asc") {
187
+ async getTableData(tableName, limit = 100, offset = 0, sortColumn, sortDirection = "asc", search) {
188
188
  try {
189
189
  const tables = await this.getTables();
190
190
  if (!tables.includes(tableName)) {
@@ -195,14 +195,26 @@ var DatabaseToolsService = class {
195
195
  if (sortColumn && !columns.includes(sortColumn)) {
196
196
  sortColumn = void 0;
197
197
  }
198
- const countResult = await this.db.prepare(`SELECT COUNT(*) as count FROM ${tableName}`).first();
198
+ const searchTerm = search?.trim();
199
+ let whereClause = "";
200
+ let bindings = [];
201
+ if (searchTerm) {
202
+ const conditions = columns.map(() => `CAST(? AS TEXT) IS NOT NULL AND CAST(? AS TEXT) LIKE ?`).join(" OR ");
203
+ const colConditions = columns.map((col) => `CAST("${col}" AS TEXT) LIKE ?`).join(" OR ");
204
+ whereClause = ` WHERE (${colConditions})`;
205
+ bindings = columns.map(() => `%${searchTerm}%`);
206
+ }
207
+ const countQuery = `SELECT COUNT(*) as count FROM "${tableName}"${whereClause}`;
208
+ const countStmt = this.db.prepare(countQuery);
209
+ const countResult = bindings.length > 0 ? await countStmt.bind(...bindings).first() : await countStmt.first();
199
210
  const totalRows = countResult?.count || 0;
200
- let query = `SELECT * FROM ${tableName}`;
211
+ let query = `SELECT * FROM "${tableName}"${whereClause}`;
201
212
  if (sortColumn) {
202
- query += ` ORDER BY ${sortColumn} ${sortDirection.toUpperCase()}`;
213
+ query += ` ORDER BY "${sortColumn}" ${sortDirection.toUpperCase()}`;
203
214
  }
204
215
  query += ` LIMIT ${limit} OFFSET ${offset}`;
205
- const dataResult = await this.db.prepare(query).all();
216
+ const dataStmt = this.db.prepare(query);
217
+ const dataResult = bindings.length > 0 ? await dataStmt.bind(...bindings).all() : await dataStmt.all();
206
218
  return {
207
219
  tableName,
208
220
  columns,
@@ -306,6 +318,43 @@ function renderDatabaseTablePage(data) {
306
318
  </div>
307
319
  </div>
308
320
 
321
+ <!-- Search bar -->
322
+ <div class="flex items-center gap-3">
323
+ <div class="relative flex-1 max-w-xl">
324
+ <div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
325
+ <svg class="h-4 w-4 text-zinc-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
326
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0"/>
327
+ </svg>
328
+ </div>
329
+ <input
330
+ id="searchInput"
331
+ type="text"
332
+ placeholder="Search all columns including JSON data..."
333
+ value="${escapeHtml2(data.search || "")}"
334
+ class="block w-full rounded-lg border-0 py-2.5 pl-10 pr-10 text-sm text-zinc-900 dark:text-white bg-white dark:bg-zinc-800 ring-1 ring-inset ring-zinc-300 dark:ring-zinc-700 placeholder:text-zinc-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600"
335
+ onkeydown="if(event.key==='Enter') doSearch()"
336
+ />
337
+ ${data.search ? `
338
+ <button
339
+ onclick="clearSearch()"
340
+ class="absolute inset-y-0 right-0 flex items-center pr-3 text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-200"
341
+ title="Clear search"
342
+ >
343
+ <svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
344
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
345
+ </svg>
346
+ </button>
347
+ ` : ""}
348
+ </div>
349
+ <button
350
+ onclick="doSearch()"
351
+ class="inline-flex items-center justify-center rounded-lg bg-indigo-600 px-4 py-2.5 text-sm font-semibold text-white hover:bg-indigo-500 transition-colors shadow-sm"
352
+ >
353
+ Search
354
+ </button>
355
+ ${data.search ? `<span class="text-sm text-zinc-500 dark:text-zinc-400">Filtered: <strong class="text-zinc-900 dark:text-white">${escapeHtml2(data.search)}</strong></span>` : ""}
356
+ </div>
357
+
309
358
  <!-- Table Card -->
310
359
  <div class="rounded-xl bg-white dark:bg-zinc-900 shadow-sm ring-1 ring-zinc-950/5 dark:ring-white/10 overflow-hidden">
311
360
  <!-- Table -->
@@ -340,7 +389,7 @@ function renderDatabaseTablePage(data) {
340
389
  <tr class="${idx % 2 === 0 ? "bg-white dark:bg-zinc-900" : "bg-zinc-50 dark:bg-zinc-900/50"}">
341
390
  ${data.columns.map((col) => `
342
391
  <td class="px-4 py-3 text-sm text-zinc-700 dark:text-zinc-300 whitespace-nowrap max-w-xs overflow-hidden text-ellipsis" title="${escapeHtml2(String(row[col] ?? ""))}">
343
- ${formatCellValue(row[col])}
392
+ ${formatCellValue(row[col], col)}
344
393
  </td>
345
394
  `).join("")}
346
395
  </tr>
@@ -416,79 +465,143 @@ function renderDatabaseTablePage(data) {
416
465
  </div>
417
466
  </div>
418
467
 
468
+ <!-- JSON Viewer Modal -->
469
+ <div id="jsonModal" class="fixed inset-0 z-50 hidden" role="dialog" aria-modal="true">
470
+ <div class="fixed inset-0 bg-black/60 backdrop-blur-sm" onclick="closeJsonModal()"></div>
471
+ <div class="fixed inset-0 flex items-center justify-center p-4 pointer-events-none">
472
+ <div class="pointer-events-auto relative w-full max-w-4xl max-h-[85vh] flex flex-col rounded-xl bg-white dark:bg-zinc-900 shadow-2xl ring-1 ring-zinc-950/10 dark:ring-white/10">
473
+ <div class="flex items-center justify-between px-6 py-4 border-b border-zinc-200 dark:border-zinc-700">
474
+ <div>
475
+ <h3 id="jsonModalTitle" class="text-base font-semibold text-zinc-900 dark:text-white">Field Value</h3>
476
+ <p id="jsonModalSubtitle" class="text-xs text-zinc-500 dark:text-zinc-400 mt-0.5"></p>
477
+ </div>
478
+ <div class="flex items-center gap-2">
479
+ <button onclick="copyJsonValue()" class="inline-flex items-center gap-1.5 rounded-lg bg-zinc-100 dark:bg-zinc-800 px-3 py-1.5 text-xs font-medium text-zinc-700 dark:text-zinc-300 hover:bg-zinc-200 dark:hover:bg-zinc-700 transition-colors">
480
+ <svg class="h-3.5 w-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
481
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/>
482
+ </svg>
483
+ Copy
484
+ </button>
485
+ <button onclick="closeJsonModal()" class="rounded-lg p-1.5 text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors">
486
+ <svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
487
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
488
+ </svg>
489
+ </button>
490
+ </div>
491
+ </div>
492
+ <div class="flex-1 overflow-auto p-6">
493
+ <pre id="jsonModalContent" class="text-sm font-mono text-zinc-800 dark:text-zinc-200 whitespace-pre-wrap break-words leading-relaxed"></pre>
494
+ </div>
495
+ </div>
496
+ </div>
497
+ </div>
498
+
419
499
  <script>
420
500
  const currentTableName = '${data.tableName}';
421
501
  let currentPage = ${data.currentPage};
422
502
  let currentPageSize = ${data.pageSize};
423
503
  let currentSort = '${data.sortColumn || ""}';
424
504
  let currentSortDir = '${data.sortDirection || "asc"}';
505
+ let currentSearch = ${JSON.stringify(data.search || "")};
506
+
507
+ function buildParams(overrides = {}) {
508
+ const params = new URLSearchParams();
509
+ const p = { page: currentPage, pageSize: currentPageSize, sort: currentSort, dir: currentSortDir, search: currentSearch, ...overrides };
510
+ if (p.page) params.set('page', p.page);
511
+ if (p.pageSize) params.set('pageSize', p.pageSize);
512
+ if (p.sort) { params.set('sort', p.sort); params.set('dir', p.dir || 'asc'); }
513
+ if (p.search) params.set('search', p.search);
514
+ return params;
515
+ }
425
516
 
426
517
  function goToPage(page) {
427
518
  if (page < 1 || page > ${totalPages}) return;
428
- const params = new URLSearchParams();
429
- params.set('page', page);
430
- params.set('pageSize', currentPageSize);
431
- if (currentSort) {
432
- params.set('sort', currentSort);
433
- params.set('dir', currentSortDir);
434
- }
435
- window.location.href = \`/admin/database-tools/tables/\${currentTableName}?\${params}\`;
519
+ window.location.href = \`/admin/database-tools/tables/\${currentTableName}?\${buildParams({ page })}\`;
436
520
  }
437
521
 
438
522
  function sortTable(column) {
439
- let newDir = 'asc';
440
- if (currentSort === column && currentSortDir === 'asc') {
441
- newDir = 'desc';
442
- }
443
-
444
- const params = new URLSearchParams();
445
- params.set('page', '1');
446
- params.set('pageSize', currentPageSize);
447
- params.set('sort', column);
448
- params.set('dir', newDir);
449
- window.location.href = \`/admin/database-tools/tables/\${currentTableName}?\${params}\`;
523
+ const newDir = (currentSort === column && currentSortDir === 'asc') ? 'desc' : 'asc';
524
+ window.location.href = \`/admin/database-tools/tables/\${currentTableName}?\${buildParams({ page: 1, sort: column, dir: newDir })}\`;
450
525
  }
451
526
 
452
527
  function changePageSize(newSize) {
453
- const params = new URLSearchParams();
454
- params.set('page', '1');
455
- params.set('pageSize', newSize);
456
- if (currentSort) {
457
- params.set('sort', currentSort);
458
- params.set('dir', currentSortDir);
459
- }
460
- window.location.href = \`/admin/database-tools/tables/\${currentTableName}?\${params}\`;
528
+ window.location.href = \`/admin/database-tools/tables/\${currentTableName}?\${buildParams({ page: 1, pageSize: newSize })}\`;
461
529
  }
462
530
 
463
531
  function refreshTableData() {
464
532
  window.location.reload();
465
533
  }
466
534
 
467
- function formatCellValue(value) {
468
- if (value === null || value === undefined) {
469
- return '<span class="text-zinc-400 dark:text-zinc-500 italic">null</span>';
470
- }
471
- if (typeof value === 'boolean') {
472
- return \`<span class="px-2 py-0.5 rounded text-xs font-medium \${value ? 'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400' : 'bg-zinc-100 text-zinc-800 dark:bg-zinc-800 dark:text-zinc-400'}">\${value}</span>\`;
473
- }
474
- if (typeof value === 'object') {
475
- return '<span class="text-xs font-mono text-zinc-600 dark:text-zinc-400">' + JSON.stringify(value).substring(0, 50) + (JSON.stringify(value).length > 50 ? '...' : '') + '</span>';
476
- }
477
- const str = String(value);
478
- if (str.length > 100) {
479
- return escapeHtml(str.substring(0, 100)) + '...';
535
+ function doSearch() {
536
+ const val = document.getElementById('searchInput').value.trim();
537
+ window.location.href = \`/admin/database-tools/tables/\${currentTableName}?\${buildParams({ page: 1, search: val })}\`;
538
+ }
539
+
540
+ function clearSearch() {
541
+ window.location.href = \`/admin/database-tools/tables/\${currentTableName}?\${buildParams({ page: 1, search: '' })}\`;
542
+ }
543
+
544
+ // JSON viewer modal
545
+ let _jsonModalValue = '';
546
+
547
+ function openJsonModal(rawValue, colName) {
548
+ // rawValue comes from dataset \u2014 browser already decoded HTML entities, so it's the original string
549
+ _jsonModalValue = rawValue;
550
+ document.getElementById('jsonModalTitle').textContent = colName;
551
+ const el = document.getElementById('jsonModalContent');
552
+ const subtitle = document.getElementById('jsonModalSubtitle');
553
+ try {
554
+ const parsed = JSON.parse(rawValue);
555
+ const pretty = JSON.stringify(parsed, null, 2);
556
+ subtitle.textContent = 'JSON \u2022 ' + rawValue.length + ' chars';
557
+ el.innerHTML = syntaxHighlight(pretty);
558
+ } catch {
559
+ el.textContent = rawValue;
560
+ subtitle.textContent = rawValue.length + ' chars';
480
561
  }
481
- return escapeHtml(str);
562
+ document.getElementById('jsonModal').classList.remove('hidden');
563
+ document.body.style.overflow = 'hidden';
482
564
  }
483
565
 
566
+ function closeJsonModal() {
567
+ document.getElementById('jsonModal').classList.add('hidden');
568
+ document.body.style.overflow = '';
569
+ }
570
+
571
+ function copyJsonValue() {
572
+ navigator.clipboard.writeText(_jsonModalValue).then(() => {
573
+ const btn = event.currentTarget;
574
+ const orig = btn.innerHTML;
575
+ btn.textContent = 'Copied!';
576
+ setTimeout(() => { btn.innerHTML = orig; }, 1500);
577
+ });
578
+ }
579
+
580
+ function syntaxHighlight(json) {
581
+ json = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
582
+ return json.replace(/("(\\\\u[a-zA-Z0-9]{4}|\\\\[^u]|[^\\\\"])*"(\\s*:)?|\\b(true|false|null)\\b|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?)/g, function(match) {
583
+ let cls = 'text-purple-600 dark:text-purple-400'; // number
584
+ if (/^"/.test(match)) {
585
+ if (/:$/.test(match)) {
586
+ cls = 'text-blue-600 dark:text-blue-400 font-medium'; // key
587
+ } else {
588
+ cls = 'text-green-700 dark:text-green-400'; // string value
589
+ }
590
+ } else if (/true|false/.test(match)) {
591
+ cls = 'text-orange-600 dark:text-orange-400';
592
+ } else if (/null/.test(match)) {
593
+ cls = 'text-zinc-400 italic';
594
+ }
595
+ return \`<span class="\${cls}">\${match}</span>\`;
596
+ });
597
+ }
598
+
599
+ document.addEventListener('keydown', (e) => {
600
+ if (e.key === 'Escape') closeJsonModal();
601
+ });
602
+
484
603
  function escapeHtml(text) {
485
- const map = {
486
- '&': '&amp;',
487
- '<': '&lt;',
488
- '>': '&gt;',
489
- '"': '&quot;',
490
- "'": '&#039;'
491
- };
604
+ const map = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#039;' };
492
605
  return String(text).replace(/[&<>"']/g, m => map[m]);
493
606
  }
494
607
  </script>
@@ -555,7 +668,16 @@ function escapeHtml2(text) {
555
668
  };
556
669
  return String(text).replace(/[&<>"']/g, (m) => map[m] || m);
557
670
  }
558
- function formatCellValue(value) {
671
+ function isJsonString(str2) {
672
+ const s = str2.trim();
673
+ return (s.startsWith("{") || s.startsWith("[")) && (s.endsWith("}") || s.endsWith("]"));
674
+ }
675
+ function jsonButton(raw, colName) {
676
+ const preview = raw.length > 60 ? escapeHtml2(raw.substring(0, 60)) + "\u2026" : escapeHtml2(raw);
677
+ return `<button data-json-val="${escapeHtml2(raw)}" data-col-name="${escapeHtml2(colName)}" onclick="openJsonModal(this.dataset.jsonVal, this.dataset.colName)" class="text-left text-xs font-mono text-indigo-600 dark:text-indigo-400 hover:underline">${preview}</button>`;
678
+ }
679
+ function formatCellValue(value, colName) {
680
+ const col = colName || "value";
559
681
  if (value === null || value === void 0) {
560
682
  return '<span class="text-zinc-400 dark:text-zinc-500 italic">null</span>';
561
683
  }
@@ -563,11 +685,15 @@ function formatCellValue(value) {
563
685
  return `<span class="px-2 py-0.5 rounded text-xs font-medium ${value ? "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400" : "bg-zinc-100 text-zinc-800 dark:bg-zinc-800 dark:text-zinc-400"}">${value}</span>`;
564
686
  }
565
687
  if (typeof value === "object") {
566
- return '<span class="text-xs font-mono text-zinc-600 dark:text-zinc-400">' + JSON.stringify(value).substring(0, 50) + (JSON.stringify(value).length > 50 ? "..." : "") + "</span>";
688
+ return jsonButton(JSON.stringify(value), col);
567
689
  }
568
690
  const str2 = String(value);
569
- if (str2.length > 100) {
570
- return escapeHtml2(str2.substring(0, 100)) + "...";
691
+ if (isJsonString(str2)) {
692
+ return jsonButton(str2, col);
693
+ }
694
+ if (str2.length > 120) {
695
+ const preview = escapeHtml2(str2.substring(0, 120)) + "\u2026";
696
+ return `<button data-json-val="${escapeHtml2(str2)}" data-col-name="${escapeHtml2(col)}" onclick="openJsonModal(this.dataset.jsonVal, this.dataset.colName)" class="text-left text-sm text-zinc-700 dark:text-zinc-300 hover:underline">${preview}</button>`;
571
697
  }
572
698
  return escapeHtml2(str2);
573
699
  }
@@ -575,7 +701,7 @@ function formatCellValue(value) {
575
701
  // src/plugins/core-plugins/database-tools-plugin/admin-routes.ts
576
702
  function createDatabaseToolsAdminRoutes() {
577
703
  const router3 = new hono.Hono();
578
- router3.use("*", chunk4SHNHNRP_cjs.requireAuth());
704
+ router3.use("*", chunkFCLKX2OS_cjs.requireAuth());
579
705
  router3.get("/api/stats", async (c) => {
580
706
  try {
581
707
  const user = c.get("user");
@@ -702,9 +828,10 @@ function createDatabaseToolsAdminRoutes() {
702
828
  const offset = parseInt(c.req.query("offset") || "0");
703
829
  const sortColumn = c.req.query("sort");
704
830
  const sortDirection = c.req.query("dir") || "asc";
831
+ const search = c.req.query("search");
705
832
  const db = c.env.DB;
706
833
  const service = new DatabaseToolsService(db);
707
- const tableData = await service.getTableData(tableName, limit, offset, sortColumn, sortDirection);
834
+ const tableData = await service.getTableData(tableName, limit, offset, sortColumn, sortDirection, search);
708
835
  return c.json({
709
836
  success: true,
710
837
  data: tableData
@@ -728,10 +855,11 @@ function createDatabaseToolsAdminRoutes() {
728
855
  const pageSize = parseInt(c.req.query("pageSize") || "20");
729
856
  const sortColumn = c.req.query("sort");
730
857
  const sortDirection = c.req.query("dir") || "asc";
858
+ const search = c.req.query("search");
731
859
  const offset = (page - 1) * pageSize;
732
860
  const db = c.env.DB;
733
861
  const service = new DatabaseToolsService(db);
734
- const tableData = await service.getTableData(tableName, pageSize, offset, sortColumn, sortDirection);
862
+ const tableData = await service.getTableData(tableName, pageSize, offset, sortColumn, sortDirection, search);
735
863
  const pageData = {
736
864
  user: {
737
865
  name: user.email.split("@")[0] || "Unknown",
@@ -745,7 +873,8 @@ function createDatabaseToolsAdminRoutes() {
745
873
  currentPage: page,
746
874
  pageSize,
747
875
  sortColumn,
748
- sortDirection
876
+ sortDirection,
877
+ search
749
878
  };
750
879
  return c.html(renderDatabaseTablePage(pageData));
751
880
  } catch (error) {
@@ -981,7 +1110,7 @@ var SiteConfigService = class {
981
1110
 
982
1111
  // src/plugins/core-plugins/email-plugin/routes/admin.ts
983
1112
  var adminRoutes = new hono.Hono();
984
- adminRoutes.use("*", chunk4SHNHNRP_cjs.requireAuth());
1113
+ adminRoutes.use("*", chunkFCLKX2OS_cjs.requireAuth());
985
1114
  adminRoutes.post("/settings", async (c) => {
986
1115
  if (c.get("user")?.role !== "admin") {
987
1116
  return c.json({ error: "admin role required" }, 403);
@@ -1019,7 +1148,7 @@ adminRoutes.post("/test", async (c) => {
1019
1148
  const { subject, html: html4, text } = renderTestEmail({ siteName });
1020
1149
  try {
1021
1150
  const settingsLoaded = await settings.load();
1022
- const result = await chunk3E7IROND_cjs.getEmailService().send({
1151
+ const result = await chunk7RUW244J_cjs.getEmailService().send({
1023
1152
  to,
1024
1153
  subject,
1025
1154
  html: html4,
@@ -1101,7 +1230,7 @@ function makeOnRegistrationCompleted(env) {
1101
1230
  siteName,
1102
1231
  loginUrl: siteConfig.buildLoginUrl(siteUrl)
1103
1232
  });
1104
- const result = await chunk3E7IROND_cjs.getEmailService().send({
1233
+ const result = await chunk7RUW244J_cjs.getEmailService().send({
1105
1234
  to: user.email,
1106
1235
  subject,
1107
1236
  html: html4,
@@ -1175,7 +1304,7 @@ function makeOnPasswordResetRequested(env) {
1175
1304
  expiresAt: Date.now() + DEFAULT_EXPIRY_MS,
1176
1305
  siteName
1177
1306
  });
1178
- const result = await chunk3E7IROND_cjs.getEmailService().send({
1307
+ const result = await chunk7RUW244J_cjs.getEmailService().send({
1179
1308
  to: user.email,
1180
1309
  subject,
1181
1310
  html: html4,
@@ -1243,7 +1372,7 @@ function makeOnPasswordResetCompleted(env) {
1243
1372
  supportEmail,
1244
1373
  when: Date.now()
1245
1374
  });
1246
- const result = await chunk3E7IROND_cjs.getEmailService().send({
1375
+ const result = await chunk7RUW244J_cjs.getEmailService().send({
1247
1376
  to: user.email,
1248
1377
  subject,
1249
1378
  html: html4,
@@ -1984,7 +2113,7 @@ var CloudflareEmailProvider = class {
1984
2113
  }
1985
2114
  }
1986
2115
  };
1987
- var emailPluginV3 = chunk5RSB5SEK_cjs.definePlugin({
2116
+ var emailPluginV3 = chunkA4KUJ3LD_cjs.definePlugin({
1988
2117
  id: "email",
1989
2118
  version: "1.0.0",
1990
2119
  name: "Email",
@@ -1998,7 +2127,7 @@ var emailPluginV3 = chunk5RSB5SEK_cjs.definePlugin({
1998
2127
  const db = env.DB;
1999
2128
  if (db) {
2000
2129
  try {
2001
- const typeRegistry = new chunk4SHNHNRP_cjs.DocumentTypeRegistry(db);
2130
+ const typeRegistry = new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db);
2002
2131
  await typeRegistry.register({
2003
2132
  id: "email_log",
2004
2133
  name: "email_log",
@@ -2013,7 +2142,7 @@ var emailPluginV3 = chunk5RSB5SEK_cjs.definePlugin({
2013
2142
  } catch {
2014
2143
  }
2015
2144
  }
2016
- if (!chunk3E7IROND_cjs.hasEmailService()) {
2145
+ if (!chunk7RUW244J_cjs.hasEmailService()) {
2017
2146
  const settings = db ? await new EmailSettingsService(db).load() : {};
2018
2147
  const envResendKey = typeof env.RESEND_API_KEY === "string" && env.RESEND_API_KEY ? env.RESEND_API_KEY : void 0;
2019
2148
  const cfEmailBinding = env.EMAIL;
@@ -2031,7 +2160,7 @@ var emailPluginV3 = chunk5RSB5SEK_cjs.definePlugin({
2031
2160
  } else {
2032
2161
  provider = resolveEmailProvider({ env });
2033
2162
  }
2034
- chunk3E7IROND_cjs.setEmailService(new EmailService({ ...serviceOpts, provider }));
2163
+ chunk7RUW244J_cjs.setEmailService(new EmailService({ ...serviceOpts, provider }));
2035
2164
  }
2036
2165
  ctx.hooks.on("auth:registration:completed", makeOnRegistrationCompleted(env));
2037
2166
  ctx.hooks.on("auth:password-reset:requested", makeOnPasswordResetRequested(env));
@@ -2042,7 +2171,7 @@ var emailPluginV3 = chunk5RSB5SEK_cjs.definePlugin({
2042
2171
  var BATCH_SIZE = 100;
2043
2172
  ({
2044
2173
  schema: zod.z.record(zod.z.string(), zod.z.unknown())});
2045
- var emailReconciliationPlugin = chunk5RSB5SEK_cjs.definePlugin({
2174
+ var emailReconciliationPlugin = chunkA4KUJ3LD_cjs.definePlugin({
2046
2175
  id: "email-reconciliation",
2047
2176
  version: "1.0.0",
2048
2177
  description: "Hourly cron that backfills email delivery state from provider status APIs. Only active for providers that implement EmailProvider.reconcile().",
@@ -2063,11 +2192,11 @@ var emailReconciliationPlugin = chunk5RSB5SEK_cjs.definePlugin({
2063
2192
  console.warn("[email-reconciliation] No DB binding in cron env \u2014 skipping.");
2064
2193
  return;
2065
2194
  }
2066
- if (!chunk3E7IROND_cjs.hasEmailService()) {
2195
+ if (!chunk7RUW244J_cjs.hasEmailService()) {
2067
2196
  console.warn("[email-reconciliation] EmailService not initialized \u2014 skipping.");
2068
2197
  return;
2069
2198
  }
2070
- const emailService = chunk3E7IROND_cjs.getEmailService();
2199
+ const emailService = chunk7RUW244J_cjs.getEmailService();
2071
2200
  let rows = [];
2072
2201
  try {
2073
2202
  const result = await db.prepare(
@@ -2554,8 +2683,8 @@ function buildOtpApi() {
2554
2683
  loginUrl: settings.loginUrl || "",
2555
2684
  loginButtonText: settings.loginButtonText || ""
2556
2685
  });
2557
- if (chunk3E7IROND_cjs.hasEmailService()) {
2558
- const sent = await chunk3E7IROND_cjs.getEmailService().send({
2686
+ if (chunk7RUW244J_cjs.hasEmailService()) {
2687
+ const sent = await chunk7RUW244J_cjs.getEmailService().send({
2559
2688
  to: normalizedEmail,
2560
2689
  subject: `Your login code for ${siteName}`,
2561
2690
  flow: "otp",
@@ -2657,21 +2786,21 @@ function buildOtpApi() {
2657
2786
  error: "Account is deactivated"
2658
2787
  }, 403);
2659
2788
  }
2660
- const tokenTtl = await chunk4SHNHNRP_cjs.getJwtExpirySecondsFromDb(db, c.env);
2661
- const token = await chunk4SHNHNRP_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET, tokenTtl);
2789
+ const tokenTtl = await chunkFCLKX2OS_cjs.getJwtExpirySecondsFromDb(db, c.env);
2790
+ const token = await chunkFCLKX2OS_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET, tokenTtl);
2662
2791
  cookie.setCookie(c, "auth_token", token, {
2663
2792
  httpOnly: true,
2664
2793
  secure: true,
2665
2794
  sameSite: "Strict",
2666
2795
  maxAge: tokenTtl
2667
2796
  });
2668
- chunk3E7IROND_cjs.dispatchHookEvent(
2797
+ chunk7RUW244J_cjs.dispatchHookEvent(
2669
2798
  c,
2670
2799
  "auth:otp:verified",
2671
2800
  { user: { id: user.id, email: user.email, role: user.role } },
2672
2801
  "fire-and-forget"
2673
2802
  );
2674
- const customData = await chunk3E7IROND_cjs.getCustomData(db, user.id);
2803
+ const customData = await chunk7RUW244J_cjs.getCustomData(db, user.id);
2675
2804
  const { is_active: _isActive, ...publicUser } = user;
2676
2805
  return c.json({
2677
2806
  success: true,
@@ -2716,7 +2845,7 @@ function buildOtpApi() {
2716
2845
  });
2717
2846
  return otpAPI;
2718
2847
  }
2719
- var otpLoginPlugin = chunk5RSB5SEK_cjs.definePlugin({
2848
+ var otpLoginPlugin = chunkA4KUJ3LD_cjs.definePlugin({
2720
2849
  id: "otp-login",
2721
2850
  version: "1.0.0",
2722
2851
  name: "OTP Login",
@@ -3114,15 +3243,15 @@ function buildOauthApi() {
3114
3243
  if (!user || !user.is_active) {
3115
3244
  return c.redirect("/auth/login?error=Account is deactivated");
3116
3245
  }
3117
- const tokenTtl2 = await chunk4SHNHNRP_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3118
- const jwt2 = await chunk4SHNHNRP_cjs.AuthManager.generateToken(
3246
+ const tokenTtl2 = await chunkFCLKX2OS_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3247
+ const jwt2 = await chunkFCLKX2OS_cjs.AuthManager.generateToken(
3119
3248
  user.id,
3120
3249
  user.email,
3121
3250
  user.role,
3122
3251
  c.env.JWT_SECRET,
3123
3252
  tokenTtl2
3124
3253
  );
3125
- chunk4SHNHNRP_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
3254
+ chunkFCLKX2OS_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
3126
3255
  return c.redirect("/admin");
3127
3256
  }
3128
3257
  const existingUser = await oauthService.findUserByEmail(profile.email);
@@ -3139,15 +3268,15 @@ function buildOauthApi() {
3139
3268
  tokenExpiresAt: tokenExpiresAt ?? void 0,
3140
3269
  profileData: JSON.stringify(profile)
3141
3270
  });
3142
- const tokenTtl2 = await chunk4SHNHNRP_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3143
- const jwt2 = await chunk4SHNHNRP_cjs.AuthManager.generateToken(
3271
+ const tokenTtl2 = await chunkFCLKX2OS_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3272
+ const jwt2 = await chunkFCLKX2OS_cjs.AuthManager.generateToken(
3144
3273
  existingUser.id,
3145
3274
  existingUser.email,
3146
3275
  existingUser.role,
3147
3276
  c.env.JWT_SECRET,
3148
3277
  tokenTtl2
3149
3278
  );
3150
- chunk4SHNHNRP_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
3279
+ chunkFCLKX2OS_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
3151
3280
  return c.redirect("/admin");
3152
3281
  }
3153
3282
  const newUserId = await oauthService.createUserFromOAuth(profile);
@@ -3160,15 +3289,15 @@ function buildOauthApi() {
3160
3289
  tokenExpiresAt: tokenExpiresAt ?? void 0,
3161
3290
  profileData: JSON.stringify(profile)
3162
3291
  });
3163
- const tokenTtl = await chunk4SHNHNRP_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3164
- const jwt = await chunk4SHNHNRP_cjs.AuthManager.generateToken(
3292
+ const tokenTtl = await chunkFCLKX2OS_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3293
+ const jwt = await chunkFCLKX2OS_cjs.AuthManager.generateToken(
3165
3294
  newUserId,
3166
3295
  profile.email.toLowerCase(),
3167
3296
  "viewer",
3168
3297
  c.env.JWT_SECRET,
3169
3298
  tokenTtl
3170
3299
  );
3171
- chunk4SHNHNRP_cjs.AuthManager.setAuthCookie(c, jwt, { sameSite: "Lax", maxAge: tokenTtl });
3300
+ chunkFCLKX2OS_cjs.AuthManager.setAuthCookie(c, jwt, { sameSite: "Lax", maxAge: tokenTtl });
3172
3301
  return c.redirect("/admin");
3173
3302
  } catch (error) {
3174
3303
  console.error("OAuth callback error:", error);
@@ -3263,7 +3392,7 @@ function buildOauthApi() {
3263
3392
  });
3264
3393
  return oauthAPI;
3265
3394
  }
3266
- var oauthProvidersPlugin = chunk5RSB5SEK_cjs.definePlugin({
3395
+ var oauthProvidersPlugin = chunkA4KUJ3LD_cjs.definePlugin({
3267
3396
  id: "oauth-providers",
3268
3397
  version: "1.0.0",
3269
3398
  name: "OAuth Providers",
@@ -3847,7 +3976,7 @@ var AISearchService = class {
3847
3976
  */
3848
3977
  async detectNewCollections() {
3849
3978
  try {
3850
- const allCollections = chunk5ARIHAGN_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => ({
3979
+ const allCollections = chunkKVBHB7QP_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => ({
3851
3980
  id: r.id,
3852
3981
  name: r.name,
3853
3982
  display_name: r.displayName,
@@ -3899,7 +4028,7 @@ var AISearchService = class {
3899
4028
  */
3900
4029
  async getAllCollections() {
3901
4030
  try {
3902
- const allCollections = chunk5ARIHAGN_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).sort((a, b) => a.displayName.localeCompare(b.displayName)).map((r) => ({
4031
+ const allCollections = chunkKVBHB7QP_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).sort((a, b) => a.displayName.localeCompare(b.displayName)).map((r) => ({
3903
4032
  id: r.id,
3904
4033
  name: r.name,
3905
4034
  display_name: r.displayName,
@@ -4238,7 +4367,7 @@ var IndexManager = class {
4238
4367
  */
4239
4368
  async indexCollection(collectionId) {
4240
4369
  try {
4241
- const registry = chunk5ARIHAGN_cjs.getCollectionRegistry();
4370
+ const registry = chunkKVBHB7QP_cjs.getCollectionRegistry();
4242
4371
  const record = registry.getById(collectionId) ?? registry.getByName(collectionId);
4243
4372
  if (!record) {
4244
4373
  throw new Error(`Collection ${collectionId} not found`);
@@ -4865,7 +4994,7 @@ function renderSettingsPage(data) {
4865
4994
 
4866
4995
  // src/plugins/core-plugins/ai-search-plugin/routes/admin.ts
4867
4996
  var adminRoutes2 = new hono.Hono();
4868
- adminRoutes2.use("*", chunk4SHNHNRP_cjs.requireAuth());
4997
+ adminRoutes2.use("*", chunkFCLKX2OS_cjs.requireAuth());
4869
4998
  adminRoutes2.get("/", async (c) => {
4870
4999
  try {
4871
5000
  const user = c.get("user");
@@ -5106,7 +5235,7 @@ var manifest_default = {
5106
5235
  author: "SonicJS"};
5107
5236
 
5108
5237
  // src/plugins/core-plugins/ai-search-plugin/index.ts
5109
- var aiSearchPlugin = chunk5RSB5SEK_cjs.definePlugin({
5238
+ var aiSearchPlugin = chunkA4KUJ3LD_cjs.definePlugin({
5110
5239
  id: manifest_default.id,
5111
5240
  version: manifest_default.version,
5112
5241
  name: manifest_default.name,
@@ -5979,7 +6108,7 @@ function renderSecuritySettingsPage(data) {
5979
6108
 
5980
6109
  // src/plugins/core-plugins/security-audit-plugin/routes/admin.ts
5981
6110
  var adminRoutes3 = new hono.Hono();
5982
- adminRoutes3.use("*", chunk4SHNHNRP_cjs.requireAuth());
6111
+ adminRoutes3.use("*", chunkFCLKX2OS_cjs.requireAuth());
5983
6112
  adminRoutes3.use("*", async (c, next) => {
5984
6113
  const user = c.get("user");
5985
6114
  if (user?.role !== "admin") {
@@ -5989,7 +6118,7 @@ adminRoutes3.use("*", async (c, next) => {
5989
6118
  });
5990
6119
  async function getSettings(db) {
5991
6120
  try {
5992
- const pluginService = new chunk5ARIHAGN_cjs.PluginService(db);
6121
+ const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
5993
6122
  const plugin2 = await pluginService.getPlugin("security-audit");
5994
6123
  if (plugin2?.settings) {
5995
6124
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -6094,7 +6223,7 @@ adminRoutes3.post("/settings", async (c) => {
6094
6223
  autoPurge: body["retention.autoPurge"] === "true"
6095
6224
  }
6096
6225
  };
6097
- const pluginService = new chunk5ARIHAGN_cjs.PluginService(db);
6226
+ const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
6098
6227
  await pluginService.updatePluginSettings("security-audit", settings);
6099
6228
  if (c.req.header("HX-Request")) {
6100
6229
  return c.json({ success: true });
@@ -6256,7 +6385,7 @@ var BruteForceDetector = class {
6256
6385
 
6257
6386
  // src/plugins/core-plugins/security-audit-plugin/routes/api.ts
6258
6387
  var apiRoutes2 = new hono.Hono();
6259
- apiRoutes2.use("*", chunk4SHNHNRP_cjs.requireAuth());
6388
+ apiRoutes2.use("*", chunkFCLKX2OS_cjs.requireAuth());
6260
6389
  apiRoutes2.use("*", async (c, next) => {
6261
6390
  const user = c.get("user");
6262
6391
  if (user?.role !== "admin") {
@@ -6266,7 +6395,7 @@ apiRoutes2.use("*", async (c, next) => {
6266
6395
  });
6267
6396
  async function getSettings2(db) {
6268
6397
  try {
6269
- const pluginService = new chunk5ARIHAGN_cjs.PluginService(db);
6398
+ const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
6270
6399
  const plugin2 = await pluginService.getPlugin("security-audit");
6271
6400
  if (plugin2?.settings) {
6272
6401
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -6414,7 +6543,7 @@ function generateFingerprint(ip, userAgent) {
6414
6543
  }
6415
6544
  async function getPluginSettings(db) {
6416
6545
  try {
6417
- const pluginService = new chunk5ARIHAGN_cjs.PluginService(db);
6546
+ const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
6418
6547
  const plugin2 = await pluginService.getPlugin("security-audit");
6419
6548
  if (plugin2?.settings) {
6420
6549
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -6645,7 +6774,7 @@ async function logAuthEvent(c, db, settings, ip, userAgent, countryCode, fingerp
6645
6774
 
6646
6775
  // src/plugins/core-plugins/security-audit-plugin/index.ts
6647
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>`;
6648
- var securityAuditPlugin = chunk5RSB5SEK_cjs.definePlugin({
6777
+ var securityAuditPlugin = chunkA4KUJ3LD_cjs.definePlugin({
6649
6778
  id: "security-audit",
6650
6779
  version: "1.0.0",
6651
6780
  name: "Security Audit",
@@ -6721,7 +6850,7 @@ var ApiKeyService = class {
6721
6850
  const prefix = secret.slice(0, DISPLAY_PREFIX_LEN);
6722
6851
  const expiresAt = input.expiresAt ?? null;
6723
6852
  const doc = await this.docService().create(
6724
- chunk3E7IROND_cjs.createDocumentSchema.parse({
6853
+ chunk7RUW244J_cjs.createDocumentSchema.parse({
6725
6854
  typeId: "api_key",
6726
6855
  tenantId: this.tenantId,
6727
6856
  title: name,
@@ -6991,7 +7120,7 @@ var createSchema = zod.z.object({
6991
7120
  });
6992
7121
  async function getSettings3(db) {
6993
7122
  try {
6994
- const plugin2 = await new chunk5ARIHAGN_cjs.PluginService(db).getPlugin("api-keys");
7123
+ const plugin2 = await new chunkKVBHB7QP_cjs.PluginService(db).getPlugin("api-keys");
6995
7124
  if (plugin2?.settings) {
6996
7125
  const s = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
6997
7126
  return { ...DEFAULT_SETTINGS3, ...s };
@@ -7000,7 +7129,7 @@ async function getSettings3(db) {
7000
7129
  }
7001
7130
  return DEFAULT_SETTINGS3;
7002
7131
  }
7003
- adminRoutes4.use("*", chunk4SHNHNRP_cjs.requireAuth());
7132
+ adminRoutes4.use("*", chunkFCLKX2OS_cjs.requireAuth());
7004
7133
  adminRoutes4.use("*", async (c, next) => {
7005
7134
  const user = c.get("user");
7006
7135
  if (user?.role !== "admin") {
@@ -7085,7 +7214,7 @@ function apiKeyAuthMiddleware() {
7085
7214
 
7086
7215
  // src/plugins/core-plugins/api-keys-plugin/index.ts
7087
7216
  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>`;
7088
- var apiKeysPlugin = chunk5RSB5SEK_cjs.definePlugin({
7217
+ var apiKeysPlugin = chunkA4KUJ3LD_cjs.definePlugin({
7089
7218
  id: "api-keys",
7090
7219
  version: "1.0.0-beta.1",
7091
7220
  name: "API Keys",
@@ -7856,7 +7985,7 @@ var DEFAULT_SETTINGS4 = {
7856
7985
 
7857
7986
  // src/plugins/core-plugins/stripe-plugin/routes/admin.ts
7858
7987
  var adminRoutes5 = new hono.Hono();
7859
- adminRoutes5.use("*", chunk4SHNHNRP_cjs.requireAuth());
7988
+ adminRoutes5.use("*", chunkFCLKX2OS_cjs.requireAuth());
7860
7989
  adminRoutes5.use("*", async (c, next) => {
7861
7990
  const user = c.get("user");
7862
7991
  if (user?.role !== "admin") {
@@ -7866,7 +7995,7 @@ adminRoutes5.use("*", async (c, next) => {
7866
7995
  });
7867
7996
  async function getSettings4(db) {
7868
7997
  try {
7869
- const pluginService = new chunk5ARIHAGN_cjs.PluginService(db);
7998
+ const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
7870
7999
  const plugin2 = await pluginService.getPlugin("stripe");
7871
8000
  if (plugin2?.settings) {
7872
8001
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -8189,7 +8318,7 @@ function timingSafeEqual(a, b) {
8189
8318
  var apiRoutes3 = new hono.Hono();
8190
8319
  async function getSettings5(db) {
8191
8320
  try {
8192
- const pluginService = new chunk5ARIHAGN_cjs.PluginService(db);
8321
+ const pluginService = new chunkKVBHB7QP_cjs.PluginService(db);
8193
8322
  const plugin2 = await pluginService.getPlugin("stripe");
8194
8323
  if (plugin2?.settings) {
8195
8324
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -8340,7 +8469,7 @@ apiRoutes3.post("/webhook", async (c) => {
8340
8469
  }
8341
8470
  return c.json({ received: true });
8342
8471
  });
8343
- apiRoutes3.post("/create-checkout-session", chunk4SHNHNRP_cjs.requireAuth(), async (c) => {
8472
+ apiRoutes3.post("/create-checkout-session", chunkFCLKX2OS_cjs.requireAuth(), async (c) => {
8344
8473
  const db = c.env.DB;
8345
8474
  const user = c.get("user");
8346
8475
  if (!user) return c.json({ error: "Unauthorized" }, 401);
@@ -8380,7 +8509,7 @@ apiRoutes3.post("/create-checkout-session", chunk4SHNHNRP_cjs.requireAuth(), asy
8380
8509
  });
8381
8510
  return c.json({ sessionId: session.id, url: session.url });
8382
8511
  });
8383
- apiRoutes3.get("/subscription", chunk4SHNHNRP_cjs.requireAuth(), async (c) => {
8512
+ apiRoutes3.get("/subscription", chunkFCLKX2OS_cjs.requireAuth(), async (c) => {
8384
8513
  const user = c.get("user");
8385
8514
  if (!user) return c.json({ error: "Unauthorized" }, 401);
8386
8515
  const db = c.env.DB;
@@ -8392,7 +8521,7 @@ apiRoutes3.get("/subscription", chunk4SHNHNRP_cjs.requireAuth(), async (c) => {
8392
8521
  }
8393
8522
  return c.json({ subscription });
8394
8523
  });
8395
- apiRoutes3.get("/subscriptions", chunk4SHNHNRP_cjs.requireAuth(), async (c) => {
8524
+ apiRoutes3.get("/subscriptions", chunkFCLKX2OS_cjs.requireAuth(), async (c) => {
8396
8525
  const user = c.get("user");
8397
8526
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
8398
8527
  const db = c.env.DB;
@@ -8408,7 +8537,7 @@ apiRoutes3.get("/subscriptions", chunk4SHNHNRP_cjs.requireAuth(), async (c) => {
8408
8537
  const result = await subscriptionService.list(filters);
8409
8538
  return c.json(result);
8410
8539
  });
8411
- apiRoutes3.get("/stats", chunk4SHNHNRP_cjs.requireAuth(), async (c) => {
8540
+ apiRoutes3.get("/stats", chunkFCLKX2OS_cjs.requireAuth(), async (c) => {
8412
8541
  const user = c.get("user");
8413
8542
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
8414
8543
  const db = c.env.DB;
@@ -8417,7 +8546,7 @@ apiRoutes3.get("/stats", chunk4SHNHNRP_cjs.requireAuth(), async (c) => {
8417
8546
  const stats = await subscriptionService.getStats();
8418
8547
  return c.json(stats);
8419
8548
  });
8420
- apiRoutes3.post("/sync-subscriptions", chunk4SHNHNRP_cjs.requireAuth(), async (c) => {
8549
+ apiRoutes3.post("/sync-subscriptions", chunkFCLKX2OS_cjs.requireAuth(), async (c) => {
8421
8550
  const user = c.get("user");
8422
8551
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
8423
8552
  const db = c.env.DB;
@@ -8465,7 +8594,7 @@ apiRoutes3.post("/sync-subscriptions", chunk4SHNHNRP_cjs.requireAuth(), async (c
8465
8594
  }, 500);
8466
8595
  }
8467
8596
  });
8468
- apiRoutes3.get("/events", chunk4SHNHNRP_cjs.requireAuth(), async (c) => {
8597
+ apiRoutes3.get("/events", chunkFCLKX2OS_cjs.requireAuth(), async (c) => {
8469
8598
  const user = c.get("user");
8470
8599
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
8471
8600
  const db = c.env.DB;
@@ -8488,7 +8617,7 @@ apiRoutes3.get("/events", chunk4SHNHNRP_cjs.requireAuth(), async (c) => {
8488
8617
 
8489
8618
  // src/plugins/core-plugins/stripe-plugin/index.ts
8490
8619
  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>`;
8491
- var stripePlugin = chunk5RSB5SEK_cjs.definePlugin({
8620
+ var stripePlugin = chunkA4KUJ3LD_cjs.definePlugin({
8492
8621
  id: "stripe",
8493
8622
  version: "1.0.0",
8494
8623
  name: "Stripe",
@@ -8761,7 +8890,7 @@ function renderFormsListPage(data) {
8761
8890
 
8762
8891
  <!-- Forms Table -->
8763
8892
  <div class="bg-white dark:bg-zinc-900 rounded-lg border border-zinc-950/5 dark:border-white/10 overflow-hidden">
8764
- ${chunk3E7IROND_cjs.renderTable(tableData)}
8893
+ ${chunk7RUW244J_cjs.renderTable(tableData)}
8765
8894
  </div>
8766
8895
  </div>
8767
8896
  `;
@@ -10191,7 +10320,7 @@ function renderFormCreatePage(data) {
10191
10320
  // src/routes/admin-forms.ts
10192
10321
  var isTableMissing = (err) => String(err?.message ?? err?.cause?.message ?? "").includes("no such table: forms");
10193
10322
  var adminFormsRoutes = new hono.Hono();
10194
- adminFormsRoutes.use("*", chunk4SHNHNRP_cjs.requireAuth());
10323
+ adminFormsRoutes.use("*", chunkFCLKX2OS_cjs.requireAuth());
10195
10324
  adminFormsRoutes.get("/", async (c) => {
10196
10325
  try {
10197
10326
  const user = c.get("user");
@@ -10364,7 +10493,7 @@ adminFormsRoutes.get("/:id/builder", async (c) => {
10364
10493
  if (!form) {
10365
10494
  return c.html("<p>Form not found</p>", 404);
10366
10495
  }
10367
- const turnstileService = new chunkDTGCXWWM_cjs.TurnstileService(db);
10496
+ const turnstileService = new chunk5UXU3LP4_cjs.TurnstileService(db);
10368
10497
  const turnstileSettings = await turnstileService.getSettings();
10369
10498
  const pageData = {
10370
10499
  id: form.id,
@@ -10533,7 +10662,7 @@ publicFormsRoutes.get("/:identifier/turnstile-config", async (c) => {
10533
10662
  if (!form) {
10534
10663
  return c.json({ error: "Form not found" }, 404);
10535
10664
  }
10536
- const turnstileService = new chunkDTGCXWWM_cjs.TurnstileService(db);
10665
+ const turnstileService = new chunk5UXU3LP4_cjs.TurnstileService(db);
10537
10666
  const globalSettings = await turnstileService.getSettings();
10538
10667
  const formSettings = form.turnstile_settings ? JSON.parse(form.turnstile_settings) : { inherit: true };
10539
10668
  const enabled = form.turnstile_enabled === 1 || formSettings.inherit && globalSettings?.enabled;
@@ -10963,7 +11092,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
10963
11092
  const turnstileEnabled = form.turnstile_enabled === 1;
10964
11093
  const turnstileSettings = form.turnstile_settings ? JSON.parse(form.turnstile_settings) : { inherit: true };
10965
11094
  if (turnstileEnabled || turnstileSettings.inherit) {
10966
- const turnstileService = new chunkDTGCXWWM_cjs.TurnstileService(db);
11095
+ const turnstileService = new chunk5UXU3LP4_cjs.TurnstileService(db);
10967
11096
  const globalEnabled = await turnstileService.isEnabled();
10968
11097
  if (globalEnabled || turnstileEnabled) {
10969
11098
  const turnstileToken = body.data?.turnstile || body.turnstile;
@@ -11025,7 +11154,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
11025
11154
  });
11026
11155
 
11027
11156
  // src/plugins/core-plugins/forms-plugin/index.ts
11028
- var formsPlugin = chunk5RSB5SEK_cjs.definePlugin({
11157
+ var formsPlugin = chunkA4KUJ3LD_cjs.definePlugin({
11029
11158
  id: "forms",
11030
11159
  version: "1.0.0",
11031
11160
  name: "Forms",
@@ -11045,7 +11174,7 @@ var formsPlugin = chunk5RSB5SEK_cjs.definePlugin({
11045
11174
  });
11046
11175
  chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
11047
11176
  var adminRbacRoutes = new hono.Hono();
11048
- adminRbacRoutes.use("*", chunk4SHNHNRP_cjs.requireRbac("rbac", "manage"));
11177
+ adminRbacRoutes.use("*", chunkFCLKX2OS_cjs.requireRbac("rbac", "manage"));
11049
11178
  var esc = (s) => String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
11050
11179
  var TABS2 = `
11051
11180
  <div class="border-b border-zinc-950/10 dark:border-white/10 mb-6">
@@ -11353,7 +11482,7 @@ adminRbacRoutes.get("/", async (c) => {
11353
11482
  title: "Roles & Permissions",
11354
11483
  pageTitle: "Roles & Permissions",
11355
11484
  currentPath: "/admin/users",
11356
- version: chunkAQJEMVAY_cjs.getCoreVersion(),
11485
+ version: chunkAOUVUF32_cjs.getCoreVersion(),
11357
11486
  user: u ? { name: u.email || "Admin", email: u.email || "", role: u.role || "admin" } : void 0,
11358
11487
  content: content2
11359
11488
  })
@@ -11490,7 +11619,7 @@ adminRbacRoutes.get("/check", async (c) => {
11490
11619
  });
11491
11620
 
11492
11621
  // src/middleware/plugin-menu.ts
11493
- var REGISTRY_MENU_PLUGINS = Object.values(chunk5ARIHAGN_cjs.PLUGIN_REGISTRY).filter((p) => p.adminMenu !== null).map((p) => ({
11622
+ var REGISTRY_MENU_PLUGINS = Object.values(chunkKVBHB7QP_cjs.PLUGIN_REGISTRY).filter((p) => p.adminMenu !== null).map((p) => ({
11494
11623
  id: p.id,
11495
11624
  label: p.adminMenu.label,
11496
11625
  path: p.adminMenu.path,
@@ -11569,7 +11698,7 @@ function pluginMenuMiddleware() {
11569
11698
  } catch {
11570
11699
  }
11571
11700
  const user = c.get("user");
11572
- const singletonItems = chunkDTGCXWWM_cjs.resolvePluginMenuItems(user ? { role: user.role } : void 0);
11701
+ const singletonItems = chunk5UXU3LP4_cjs.resolvePluginMenuItems(user ? { role: user.role } : void 0);
11573
11702
  const existingPaths = new Set(activeMenuItems.map((i) => i.path));
11574
11703
  for (const item of singletonItems) {
11575
11704
  if (!existingPaths.has(item.path)) {
@@ -11596,7 +11725,7 @@ function pluginMenuMiddleware() {
11596
11725
  }
11597
11726
  chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
11598
11727
  var adminRoutes6 = new hono.Hono();
11599
- adminRoutes6.use("*", chunk4SHNHNRP_cjs.requireAuth());
11728
+ adminRoutes6.use("*", chunkFCLKX2OS_cjs.requireAuth());
11600
11729
  adminRoutes6.use("*", async (c, next) => {
11601
11730
  const user = c.get("user");
11602
11731
  if (user?.role !== "admin") {
@@ -11952,7 +12081,7 @@ apiRoutes4.get("/stats", async (c) => {
11952
12081
  });
11953
12082
 
11954
12083
  // src/plugins/core-plugins/analytics/index.ts
11955
- var analyticsPlugin = chunk5RSB5SEK_cjs.definePlugin({
12084
+ var analyticsPlugin = chunkA4KUJ3LD_cjs.definePlugin({
11956
12085
  id: "core-analytics",
11957
12086
  version: "1.0.0",
11958
12087
  name: "Analytics",
@@ -12099,7 +12228,7 @@ function esc2(s) {
12099
12228
  return (s || "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
12100
12229
  }
12101
12230
  async function getVariablesMap(db) {
12102
- let variables = chunk3E7IROND_cjs.getVariablesCached();
12231
+ let variables = chunk7RUW244J_cjs.getVariablesCached();
12103
12232
  if (variables) return variables;
12104
12233
  try {
12105
12234
  const { results } = await db.prepare(
@@ -12109,7 +12238,7 @@ async function getVariablesMap(db) {
12109
12238
  for (const row of results || []) {
12110
12239
  variables.set(row.key, row.value);
12111
12240
  }
12112
- chunk3E7IROND_cjs.setVariablesCache(variables);
12241
+ chunk7RUW244J_cjs.setVariablesCache(variables);
12113
12242
  return variables;
12114
12243
  } catch {
12115
12244
  return /* @__PURE__ */ new Map();
@@ -12178,7 +12307,7 @@ apiRoutes5.post("/", async (c) => {
12178
12307
  await db.prepare(
12179
12308
  "INSERT INTO global_variables (key, value, description, category, is_active) VALUES (?, ?, ?, ?, ?)"
12180
12309
  ).bind(key, value || "", description || "", category || "general", isActive !== false ? 1 : 0).run();
12181
- chunk3E7IROND_cjs.invalidateVariablesCache();
12310
+ chunk7RUW244J_cjs.invalidateVariablesCache();
12182
12311
  const created = await db.prepare("SELECT * FROM global_variables WHERE key = ?").bind(key).first();
12183
12312
  return c.json({ success: true, data: formatVariable(created) }, 201);
12184
12313
  } catch {
@@ -12223,7 +12352,7 @@ apiRoutes5.put("/:id", async (c) => {
12223
12352
  updates.push("updated_at = strftime('%s', 'now')");
12224
12353
  params.push(id);
12225
12354
  await db.prepare(`UPDATE global_variables SET ${updates.join(", ")} WHERE id = ?`).bind(...params).run();
12226
- chunk3E7IROND_cjs.invalidateVariablesCache();
12355
+ chunk7RUW244J_cjs.invalidateVariablesCache();
12227
12356
  const updated = await db.prepare("SELECT * FROM global_variables WHERE id = ?").bind(id).first();
12228
12357
  return c.json({ success: true, data: formatVariable(updated) });
12229
12358
  } catch {
@@ -12237,7 +12366,7 @@ apiRoutes5.delete("/:id", async (c) => {
12237
12366
  const existing = await db.prepare("SELECT id FROM global_variables WHERE id = ?").bind(id).first();
12238
12367
  if (!existing) return c.json({ error: "Variable not found" }, 404);
12239
12368
  await db.prepare("DELETE FROM global_variables WHERE id = ?").bind(id).run();
12240
- chunk3E7IROND_cjs.invalidateVariablesCache();
12369
+ chunk7RUW244J_cjs.invalidateVariablesCache();
12241
12370
  return c.json({ success: true });
12242
12371
  } catch {
12243
12372
  return c.json({ success: false, error: "Failed to delete variable" }, 500);
@@ -12297,7 +12426,7 @@ adminRoutes7.put("/:id", async (c) => {
12297
12426
  const value = body.value;
12298
12427
  if (value !== void 0) {
12299
12428
  await db.prepare("UPDATE global_variables SET value = ?, updated_at = strftime('%s', 'now') WHERE id = ?").bind(value, id).run();
12300
- chunk3E7IROND_cjs.invalidateVariablesCache();
12429
+ chunk7RUW244J_cjs.invalidateVariablesCache();
12301
12430
  }
12302
12431
  return c.html('<span class="text-green-400 text-xs">Saved</span>');
12303
12432
  });
@@ -12305,7 +12434,7 @@ adminRoutes7.post("/:id/toggle", async (c) => {
12305
12434
  const db = c.env.DB;
12306
12435
  const id = c.req.param("id");
12307
12436
  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();
12308
- chunk3E7IROND_cjs.invalidateVariablesCache();
12437
+ chunk7RUW244J_cjs.invalidateVariablesCache();
12309
12438
  c.header("HX-Redirect", "/admin/global-variables");
12310
12439
  return c.body(null, 204);
12311
12440
  });
@@ -12326,7 +12455,7 @@ adminRoutes7.post("/", async (c) => {
12326
12455
  await db.prepare(
12327
12456
  "INSERT INTO global_variables (key, value, description, category) VALUES (?, ?, ?, ?)"
12328
12457
  ).bind(key, value, description, category).run();
12329
- chunk3E7IROND_cjs.invalidateVariablesCache();
12458
+ chunk7RUW244J_cjs.invalidateVariablesCache();
12330
12459
  c.header("HX-Redirect", "/admin/global-variables");
12331
12460
  return c.body(null, 204);
12332
12461
  });
@@ -12345,7 +12474,7 @@ adminRoutes7.post("/settings/editor-integration", async (c) => {
12345
12474
  adminRoutes7.delete("/:id", async (c) => {
12346
12475
  const db = c.env.DB;
12347
12476
  await db.prepare("DELETE FROM global_variables WHERE id = ?").bind(c.req.param("id")).run();
12348
- chunk3E7IROND_cjs.invalidateVariablesCache();
12477
+ chunk7RUW244J_cjs.invalidateVariablesCache();
12349
12478
  return c.html("");
12350
12479
  });
12351
12480
  function renderAdminPage(variables, editorStatus = { editorActive: false, activeEditorName: "", enableEditorIntegration: true }) {
@@ -12663,7 +12792,7 @@ function renderAdminPage(variables, editorStatus = { editorActive: false, active
12663
12792
  </div>
12664
12793
  ` });
12665
12794
  }
12666
- var globalVariablesPlugin = chunk5RSB5SEK_cjs.definePlugin({
12795
+ var globalVariablesPlugin = chunkA4KUJ3LD_cjs.definePlugin({
12667
12796
  id: "global-variables",
12668
12797
  version: "1.1.0",
12669
12798
  name: "Global Variables",
@@ -12686,7 +12815,7 @@ var globalVariablesPlugin = chunk5RSB5SEK_cjs.definePlugin({
12686
12815
  if (!db || !data) return data;
12687
12816
  const variables = await getVariablesMap(db);
12688
12817
  if (variables.size === 0) return data;
12689
- return chunk3E7IROND_cjs.resolveVariablesInObject(data, variables);
12818
+ return chunk7RUW244J_cjs.resolveVariablesInObject(data, variables);
12690
12819
  } catch {
12691
12820
  return data;
12692
12821
  }
@@ -12704,7 +12833,7 @@ var globalVariablesPlugin = chunk5RSB5SEK_cjs.definePlugin({
12704
12833
  },
12705
12834
  activate: async () => console.info("[GlobalVariables] Plugin activated"),
12706
12835
  deactivate: async () => {
12707
- chunk3E7IROND_cjs.invalidateVariablesCache();
12836
+ chunk7RUW244J_cjs.invalidateVariablesCache();
12708
12837
  console.info("[GlobalVariables] Plugin deactivated, cache cleared");
12709
12838
  },
12710
12839
  uninstall: async (ctx) => {
@@ -13270,7 +13399,7 @@ function renderAdminPage2(shortcodes, editorStatus = { editorActive: false, acti
13270
13399
  </div>
13271
13400
  ` });
13272
13401
  }
13273
- var shortcodesPlugin = chunk5RSB5SEK_cjs.definePlugin({
13402
+ var shortcodesPlugin = chunkA4KUJ3LD_cjs.definePlugin({
13274
13403
  id: "shortcodes",
13275
13404
  version: "1.0.0",
13276
13405
  name: "Shortcodes",
@@ -13354,7 +13483,7 @@ helloWorldRoutes.get("/", async (c) => {
13354
13483
  </html>
13355
13484
  `);
13356
13485
  });
13357
- var helloWorldPlugin = chunk5RSB5SEK_cjs.definePlugin({
13486
+ var helloWorldPlugin = chunkA4KUJ3LD_cjs.definePlugin({
13358
13487
  id: "hello-world",
13359
13488
  version: "1.0.0",
13360
13489
  name: "Hello World",
@@ -13585,7 +13714,7 @@ function renderTenantForm(data) {
13585
13714
  // src/plugins/core-plugins/multi-tenant-plugin/templates/tenant-members.template.ts
13586
13715
  chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
13587
13716
  function roleOptions(selected) {
13588
- return chunk3E7IROND_cjs.VALID_MEMBER_ROLES.map(
13717
+ return chunk7RUW244J_cjs.VALID_MEMBER_ROLES.map(
13589
13718
  (r) => `<option value="${r}" ${r === selected ? "selected" : ""}>${r}</option>`
13590
13719
  ).join("");
13591
13720
  }
@@ -13647,7 +13776,7 @@ function renderInvitations(slug, invitations) {
13647
13776
  <div>
13648
13777
  <label for="invite-role" class="mb-1 block text-xs font-medium text-zinc-500 dark:text-zinc-400">Role</label>
13649
13778
  <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">
13650
- ${chunk3E7IROND_cjs.VALID_MEMBER_ROLES.map((r) => `<option value="${r}" ${r === "viewer" ? "selected" : ""}>${r}</option>`).join("")}
13779
+ ${chunk7RUW244J_cjs.VALID_MEMBER_ROLES.map((r) => `<option value="${r}" ${r === "viewer" ? "selected" : ""}>${r}</option>`).join("")}
13651
13780
  </select>
13652
13781
  </div>
13653
13782
  <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>
@@ -13743,7 +13872,7 @@ function renderTenantMembers(data) {
13743
13872
  // src/plugins/core-plugins/multi-tenant-plugin/templates/user-memberships.template.ts
13744
13873
  chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
13745
13874
  function roleOptions2(selected) {
13746
- return chunk3E7IROND_cjs.VALID_MEMBER_ROLES.map(
13875
+ return chunk7RUW244J_cjs.VALID_MEMBER_ROLES.map(
13747
13876
  (r) => `<option value="${r}" ${r === selected ? "selected" : ""}>${r}</option>`
13748
13877
  ).join("");
13749
13878
  }
@@ -13905,7 +14034,7 @@ function zodToFieldErrors(error) {
13905
14034
  }
13906
14035
  async function isMultiTenantActive(db) {
13907
14036
  try {
13908
- const plugin2 = await new chunk5ARIHAGN_cjs.PluginService(db).getPlugin(chunk5ARIHAGN_cjs.MULTI_TENANT_PLUGIN_ID);
14037
+ const plugin2 = await new chunkKVBHB7QP_cjs.PluginService(db).getPlugin(chunkKVBHB7QP_cjs.MULTI_TENANT_PLUGIN_ID);
13909
14038
  return plugin2?.status === "active";
13910
14039
  } catch {
13911
14040
  return false;
@@ -13913,7 +14042,7 @@ async function isMultiTenantActive(db) {
13913
14042
  }
13914
14043
  function createTenantAdminRoutes() {
13915
14044
  const routes2 = new hono.Hono();
13916
- routes2.use("*", chunk4SHNHNRP_cjs.requireAuth());
14045
+ routes2.use("*", chunkFCLKX2OS_cjs.requireAuth());
13917
14046
  routes2.use("*", async (c, next) => {
13918
14047
  const user = c.get("user");
13919
14048
  if (user?.role !== "admin") {
@@ -13927,7 +14056,7 @@ function createTenantAdminRoutes() {
13927
14056
  const form = await c.req.formData();
13928
14057
  const slug = String(form.get("tenant") ?? "").trim().toLowerCase();
13929
14058
  const redirect = String(form.get("redirect") ?? "");
13930
- const svc = new chunk3E7IROND_cjs.TenantService(db);
14059
+ const svc = new chunk7RUW244J_cjs.TenantService(db);
13931
14060
  const tenant = await svc.getTenantBySlug(slug);
13932
14061
  if (!tenant || tenant.status !== "active") {
13933
14062
  return c.json({ error: "Unknown or inactive tenant" }, 400);
@@ -13937,7 +14066,7 @@ function createTenantAdminRoutes() {
13937
14066
  if (!user.isSuperAdmin && !await svc.isMember(user.userId, slug)) {
13938
14067
  return c.json({ error: "You are not a member of this tenant" }, 403);
13939
14068
  }
13940
- cookie.setCookie(c, chunk5ARIHAGN_cjs.TENANT_COOKIE, slug, {
14069
+ cookie.setCookie(c, chunkKVBHB7QP_cjs.TENANT_COOKIE, slug, {
13941
14070
  path: "/",
13942
14071
  httpOnly: true,
13943
14072
  sameSite: "Lax",
@@ -13954,7 +14083,7 @@ function createTenantAdminRoutes() {
13954
14083
  if (!user) return c.redirect("/auth/login");
13955
14084
  const token = c.req.query("token") ?? "";
13956
14085
  try {
13957
- const { slug } = await new chunk3E7IROND_cjs.TenantService(db).acceptInvitation(token, user.userId, user.email);
14086
+ const { slug } = await new chunk7RUW244J_cjs.TenantService(db).acceptInvitation(token, user.userId, user.email);
13958
14087
  return c.redirect(`/admin/tenants/${slug}/members?message=Invitation accepted`);
13959
14088
  } catch (error) {
13960
14089
  const message = error instanceof Error ? error.message : "Failed to accept invitation";
@@ -13982,7 +14111,7 @@ function createTenantAdminRoutes() {
13982
14111
  const userId = c.req.param("userId");
13983
14112
  const target = await db.prepare("SELECT id, email FROM auth_user WHERE id = ?").bind(userId).first();
13984
14113
  if (!target?.id) return c.redirect("/admin/users?message=User not found&type=error");
13985
- const svc = new chunk3E7IROND_cjs.TenantService(db);
14114
+ const svc = new chunk7RUW244J_cjs.TenantService(db);
13986
14115
  const [memberships, allTenants] = await Promise.all([svc.listUserMemberships(userId), svc.listTenants()]);
13987
14116
  const memberSlugs = new Set(memberships.map((m) => m.slug));
13988
14117
  const availableTenants = allTenants.filter((t) => t.status === "active" && !memberSlugs.has(t.slug)).map((t) => ({ slug: t.slug, name: t.name }));
@@ -14007,10 +14136,10 @@ function createTenantAdminRoutes() {
14007
14136
  const slug = String(form.get("slug") ?? "").trim().toLowerCase();
14008
14137
  const role = String(form.get("role") ?? "viewer");
14009
14138
  const redirectTo = String(form.get("_redirect") ?? "") || `/admin/tenants/users/${userId}`;
14010
- if (!chunk3E7IROND_cjs.isValidMemberRole(role)) throw new Error(`Invalid role '${role}'`);
14139
+ if (!chunk7RUW244J_cjs.isValidMemberRole(role)) throw new Error(`Invalid role '${role}'`);
14011
14140
  const target = await db.prepare("SELECT email FROM auth_user WHERE id = ?").bind(userId).first();
14012
14141
  if (!target) throw new Error("User not found");
14013
- const svc = new chunk3E7IROND_cjs.TenantService(db);
14142
+ const svc = new chunk7RUW244J_cjs.TenantService(db);
14014
14143
  if (!await svc.getTenantBySlug(slug)) throw new Error("Tenant not found");
14015
14144
  if (await svc.isMember(userId, slug)) throw new Error(`Already a member of '${slug}'`);
14016
14145
  await svc.addMember(slug, userId, role, target.email ?? null);
@@ -14029,7 +14158,7 @@ function createTenantAdminRoutes() {
14029
14158
  const form = await c.req.formData();
14030
14159
  const role = String(form.get("role") ?? "");
14031
14160
  const redirectTo = String(form.get("_redirect") ?? "") || `/admin/tenants/users/${userId}`;
14032
- await new chunk3E7IROND_cjs.TenantService(db).setMemberRole(slug, userId, role);
14161
+ await new chunk7RUW244J_cjs.TenantService(db).setMemberRole(slug, userId, role);
14033
14162
  return c.redirect(`${redirectTo}?message=Role updated`);
14034
14163
  } catch (error) {
14035
14164
  const message = error instanceof Error ? error.message : "Failed to update role";
@@ -14044,7 +14173,7 @@ function createTenantAdminRoutes() {
14044
14173
  try {
14045
14174
  const form = await c.req.formData();
14046
14175
  const redirectTo = String(form.get("_redirect") ?? "") || `/admin/tenants/users/${userId}`;
14047
- await new chunk3E7IROND_cjs.TenantService(db).removeMember(slug, userId);
14176
+ await new chunk7RUW244J_cjs.TenantService(db).removeMember(slug, userId);
14048
14177
  return c.redirect(`${redirectTo}?message=Removed from ${encodeURIComponent(slug)}`);
14049
14178
  } catch (error) {
14050
14179
  const message = error instanceof Error ? error.message : "Failed to remove membership";
@@ -14059,7 +14188,7 @@ function createTenantAdminRoutes() {
14059
14188
  return c.html(renderTenantsInactive({ user: userShape(cur), version }));
14060
14189
  }
14061
14190
  const roleName = c.req.param("roleName");
14062
- const assignments = await new chunk3E7IROND_cjs.TenantService(db).listAssignmentsByRole(roleName);
14191
+ const assignments = await new chunk7RUW244J_cjs.TenantService(db).listAssignmentsByRole(roleName);
14063
14192
  return c.html(renderRoleUsage({ roleName, assignments, user: userShape(cur), version }));
14064
14193
  });
14065
14194
  routes2.get("/", async (c) => {
@@ -14069,7 +14198,7 @@ function createTenantAdminRoutes() {
14069
14198
  if (!await isMultiTenantActive(db)) {
14070
14199
  return c.html(renderTenantsInactive({ user: userShape(user), version }));
14071
14200
  }
14072
- const svc = new chunk3E7IROND_cjs.TenantService(db);
14201
+ const svc = new chunk7RUW244J_cjs.TenantService(db);
14073
14202
  await svc.ensureDefaultTenant();
14074
14203
  const tenants = await svc.listTenants();
14075
14204
  const [docRes, memberRes] = await db.batch([
@@ -14108,7 +14237,7 @@ function createTenantAdminRoutes() {
14108
14237
  formEntries = Object.fromEntries(form.entries());
14109
14238
  const validated = tenantFormSchema.parse(formEntries);
14110
14239
  if (!validated.slug) throw new zod.z.ZodError([{ code: "custom", message: "Slug is required", path: ["slug"] }]);
14111
- const svc = new chunk3E7IROND_cjs.TenantService(db);
14240
+ const svc = new chunk7RUW244J_cjs.TenantService(db);
14112
14241
  await svc.createTenant({
14113
14242
  name: validated.name,
14114
14243
  slug: validated.slug,
@@ -14133,7 +14262,7 @@ function createTenantAdminRoutes() {
14133
14262
  if (!await isMultiTenantActive(db)) {
14134
14263
  return c.html(renderTenantsInactive({ user: userShape(user), version }));
14135
14264
  }
14136
- const tenant = await new chunk3E7IROND_cjs.TenantService(db).getTenantBySlug(c.req.param("slug"));
14265
+ const tenant = await new chunk7RUW244J_cjs.TenantService(db).getTenantBySlug(c.req.param("slug"));
14137
14266
  if (!tenant) return c.redirect("/admin/tenants?message=Tenant not found&type=error");
14138
14267
  return c.html(renderTenantForm({ tenant, isEdit: true, user: userShape(user), version }));
14139
14268
  });
@@ -14143,7 +14272,7 @@ function createTenantAdminRoutes() {
14143
14272
  const version = c.get("appVersion");
14144
14273
  const slug = c.req.param("slug");
14145
14274
  if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
14146
- const svc = new chunk3E7IROND_cjs.TenantService(db);
14275
+ const svc = new chunk7RUW244J_cjs.TenantService(db);
14147
14276
  try {
14148
14277
  const form = await c.req.formData();
14149
14278
  const validated = tenantFormSchema.parse(Object.fromEntries(form.entries()));
@@ -14168,7 +14297,7 @@ function createTenantAdminRoutes() {
14168
14297
  const slug = c.req.param("slug");
14169
14298
  if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
14170
14299
  try {
14171
- await new chunk3E7IROND_cjs.TenantService(db).deleteTenant(slug);
14300
+ await new chunk7RUW244J_cjs.TenantService(db).deleteTenant(slug);
14172
14301
  return c.redirect("/admin/tenants?message=Tenant deleted successfully");
14173
14302
  } catch (error) {
14174
14303
  const message = error instanceof Error ? error.message : "Failed to delete tenant";
@@ -14183,7 +14312,7 @@ function createTenantAdminRoutes() {
14183
14312
  return c.html(renderTenantsInactive({ user: userShape(user), version }));
14184
14313
  }
14185
14314
  const slug = c.req.param("slug");
14186
- const svc = new chunk3E7IROND_cjs.TenantService(db);
14315
+ const svc = new chunk7RUW244J_cjs.TenantService(db);
14187
14316
  const tenant = await svc.getTenantBySlug(slug);
14188
14317
  if (!tenant) return c.redirect("/admin/tenants?message=Tenant not found&type=error");
14189
14318
  const [members, invitations] = await Promise.all([svc.listMembers(slug), svc.listInvitations(slug)]);
@@ -14209,7 +14338,7 @@ function createTenantAdminRoutes() {
14209
14338
  const form = await c.req.formData();
14210
14339
  const email = String(form.get("email") ?? "");
14211
14340
  const role = String(form.get("role") ?? "viewer");
14212
- await new chunk3E7IROND_cjs.TenantService(db).addMemberByEmail(slug, email, role);
14341
+ await new chunk7RUW244J_cjs.TenantService(db).addMemberByEmail(slug, email, role);
14213
14342
  return c.redirect(`/admin/tenants/${slug}/members?message=Member added`);
14214
14343
  } catch (error) {
14215
14344
  const message = error instanceof Error ? error.message : "Failed to add member";
@@ -14224,7 +14353,7 @@ function createTenantAdminRoutes() {
14224
14353
  try {
14225
14354
  const form = await c.req.formData();
14226
14355
  const role = String(form.get("role") ?? "");
14227
- await new chunk3E7IROND_cjs.TenantService(db).setMemberRole(slug, userId, role);
14356
+ await new chunk7RUW244J_cjs.TenantService(db).setMemberRole(slug, userId, role);
14228
14357
  return c.redirect(`/admin/tenants/${slug}/members?message=Role updated`);
14229
14358
  } catch (error) {
14230
14359
  const message = error instanceof Error ? error.message : "Failed to update role";
@@ -14237,7 +14366,7 @@ function createTenantAdminRoutes() {
14237
14366
  const userId = c.req.param("userId");
14238
14367
  if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
14239
14368
  try {
14240
- await new chunk3E7IROND_cjs.TenantService(db).removeMember(slug, userId);
14369
+ await new chunk7RUW244J_cjs.TenantService(db).removeMember(slug, userId);
14241
14370
  return c.redirect(`/admin/tenants/${slug}/members?message=Member removed`);
14242
14371
  } catch (error) {
14243
14372
  const message = error instanceof Error ? error.message : "Failed to remove member";
@@ -14253,12 +14382,12 @@ function createTenantAdminRoutes() {
14253
14382
  const form = await c.req.formData();
14254
14383
  const email = String(form.get("email") ?? "");
14255
14384
  const role = String(form.get("role") ?? "viewer");
14256
- const token = await new chunk3E7IROND_cjs.TenantService(db).createInvitation(slug, email, role, user?.userId ?? null);
14385
+ const token = await new chunk7RUW244J_cjs.TenantService(db).createInvitation(slug, email, role, user?.userId ?? null);
14257
14386
  const origin = c.req.header("origin") || new URL(c.req.url).origin;
14258
14387
  const acceptUrl = `${origin}/join/invite?token=${encodeURIComponent(token)}`;
14259
14388
  let note;
14260
14389
  let noteType = "";
14261
- const svc2 = chunk3E7IROND_cjs.hasEmailService() ? chunk3E7IROND_cjs.getEmailService() : null;
14390
+ const svc2 = chunk7RUW244J_cjs.hasEmailService() ? chunk7RUW244J_cjs.getEmailService() : null;
14262
14391
  const hasRealProvider = !!svc2 && svc2.getProviderName() !== "console";
14263
14392
  if (hasRealProvider) {
14264
14393
  const result = await svc2.send({
@@ -14299,7 +14428,7 @@ function createTenantAdminRoutes() {
14299
14428
  WHERE i.id = ? AND t.slug = ? AND i.status = 'pending'`
14300
14429
  ).bind(id, slug).first();
14301
14430
  if (!inv) throw new Error("Invitation not found or already used");
14302
- const svc2 = chunk3E7IROND_cjs.hasEmailService() ? chunk3E7IROND_cjs.getEmailService() : null;
14431
+ const svc2 = chunk7RUW244J_cjs.hasEmailService() ? chunk7RUW244J_cjs.getEmailService() : null;
14303
14432
  const hasRealProvider = !!svc2 && svc2.getProviderName() !== "console";
14304
14433
  if (!hasRealProvider) throw new Error("No email plugin active");
14305
14434
  const origin = c.req.header("origin") || new URL(c.req.url).origin;
@@ -14324,7 +14453,7 @@ function createTenantAdminRoutes() {
14324
14453
  const id = c.req.param("id");
14325
14454
  if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
14326
14455
  try {
14327
- await new chunk3E7IROND_cjs.TenantService(db).revokeInvitation(slug, id);
14456
+ await new chunk7RUW244J_cjs.TenantService(db).revokeInvitation(slug, id);
14328
14457
  return c.redirect(`/admin/tenants/${slug}/members?message=Invitation revoked`);
14329
14458
  } catch (error) {
14330
14459
  const message = error instanceof Error ? error.message : "Failed to revoke invitation";
@@ -14554,7 +14683,7 @@ function createJoinRoutes() {
14554
14683
  if (existing) return rerender("An account with this email already exists. Please sign in instead.");
14555
14684
  try {
14556
14685
  const userId = crypto.randomUUID();
14557
- const passwordHash = await chunk4SHNHNRP_cjs.AuthManager.hashPassword(password);
14686
+ const passwordHash = await chunkFCLKX2OS_cjs.AuthManager.hashPassword(password);
14558
14687
  const now = Date.now();
14559
14688
  const nowSec = Math.floor(now / 1e3);
14560
14689
  await db.batch([
@@ -14567,7 +14696,7 @@ function createJoinRoutes() {
14567
14696
  VALUES (?, ?, ?, 'credential', ?, ?, ?)`
14568
14697
  ).bind(`cred-${userId}`, userId, userId, passwordHash, nowSec, nowSec)
14569
14698
  ]);
14570
- await new chunk3E7IROND_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
14699
+ await new chunk7RUW244J_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
14571
14700
  const auth = chunkGMMCCIQO_cjs.createAuth(c.env);
14572
14701
  const origin = new URL(c.req.url).origin;
14573
14702
  const baReq = new Request(`${origin}/auth/sign-in/email`, {
@@ -14635,7 +14764,7 @@ function createJoinRoutes() {
14635
14764
  const baBody = await baRes.json();
14636
14765
  const userId = baBody?.user?.id;
14637
14766
  if (!userId) return rerender("Sign-in succeeded but could not read user ID.");
14638
- await new chunk3E7IROND_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
14767
+ await new chunk7RUW244J_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
14639
14768
  const headers = new Headers({ Location: "/admin?message=Welcome! You have joined " + encodeURIComponent(inv.tenantName) });
14640
14769
  copyBaCookies(baRes, headers);
14641
14770
  return new Response(null, { status: 302, headers });
@@ -14649,7 +14778,7 @@ function createJoinRoutes() {
14649
14778
 
14650
14779
  // src/plugins/core-plugins/multi-tenant-plugin/index.ts
14651
14780
  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>`;
14652
- var multiTenantPlugin = chunk5RSB5SEK_cjs.definePlugin({
14781
+ var multiTenantPlugin = chunkA4KUJ3LD_cjs.definePlugin({
14653
14782
  id: manifest_default2.id,
14654
14783
  version: "1.0.0",
14655
14784
  name: manifest_default2.name,
@@ -14664,30 +14793,30 @@ var multiTenantPlugin = chunk5RSB5SEK_cjs.definePlugin({
14664
14793
  { label: "Tenants", path: "/admin/tenants", icon: TENANT_ICON, order: 80 }
14665
14794
  ],
14666
14795
  activate: async () => {
14667
- chunk5ARIHAGN_cjs.invalidateTenantCache();
14796
+ chunkKVBHB7QP_cjs.invalidateTenantCache();
14668
14797
  console.info("\u2705 Multi-Tenant plugin activated");
14669
14798
  },
14670
14799
  deactivate: async () => {
14671
- chunk5ARIHAGN_cjs.invalidateTenantCache();
14800
+ chunkKVBHB7QP_cjs.invalidateTenantCache();
14672
14801
  console.info("\u274C Multi-Tenant plugin deactivated");
14673
14802
  }
14674
14803
  });
14675
14804
  var routes = new hono.Hono();
14676
- routes.use("*", chunk4SHNHNRP_cjs.requireAuth());
14677
- routes.use("*", chunk4SHNHNRP_cjs.requireRole(["admin", "editor"]));
14805
+ routes.use("*", chunkFCLKX2OS_cjs.requireAuth());
14806
+ routes.use("*", chunkFCLKX2OS_cjs.requireRole(["admin", "editor"]));
14678
14807
  routes.get("/:rootId", async (c) => {
14679
14808
  const { rootId } = c.req.param();
14680
14809
  const db = c.env.DB;
14681
- const scope = await chunk3E7IROND_cjs.resolveDocScope(c, db, { rootId });
14810
+ const scope = await chunk7RUW244J_cjs.resolveDocScope(c, db, { rootId });
14682
14811
  if (!scope) {
14683
14812
  return c.html('<p class="text-zinc-500 dark:text-zinc-400 p-4">Document not found.</p>', 404);
14684
14813
  }
14685
14814
  if (!scope.docType?.settings?.versioning) {
14686
14815
  return c.html('<p class="text-zinc-500 dark:text-zinc-400 p-4">Versioning not enabled for this type.</p>', 404);
14687
14816
  }
14688
- const denied = await chunk3E7IROND_cjs.denyIfNotAllowed(c, db, rootId, "read", scope.docType?.settings, scope.tenantId);
14817
+ const denied = await chunk7RUW244J_cjs.denyIfNotAllowed(c, db, rootId, "read", scope.docType?.settings, scope.tenantId);
14689
14818
  if (denied) return denied;
14690
- const repo = new chunk3E7IROND_cjs.DocumentRepository(db, scope.tenantId);
14819
+ const repo = new chunk7RUW244J_cjs.DocumentRepository(db, scope.tenantId);
14691
14820
  const versions = await repo.getVersionHistory(rootId);
14692
14821
  const safeRootIdAttr = chunkMNWKYY5E_cjs.escapeHtml(rootId);
14693
14822
  const rows = versions.map((v) => {
@@ -14780,14 +14909,14 @@ routes.post("/:rootId/restore/:versionNumber", async (c) => {
14780
14909
  const { rootId, versionNumber } = c.req.param();
14781
14910
  const db = c.env.DB;
14782
14911
  const user = c.get("user");
14783
- const scope = await chunk3E7IROND_cjs.resolveDocScope(c, db, { rootId });
14912
+ const scope = await chunk7RUW244J_cjs.resolveDocScope(c, db, { rootId });
14784
14913
  if (!scope) {
14785
14914
  return c.json({ error: "Document not found" }, 404);
14786
14915
  }
14787
14916
  if (!scope.docType?.settings?.versioning) {
14788
14917
  return c.json({ error: "Versioning not enabled for this type" }, 404);
14789
14918
  }
14790
- const denied = await chunk3E7IROND_cjs.denyIfNotAllowed(c, db, rootId, "update", scope.docType?.settings, scope.tenantId);
14919
+ const denied = await chunk7RUW244J_cjs.denyIfNotAllowed(c, db, rootId, "update", scope.docType?.settings, scope.tenantId);
14791
14920
  if (denied) return denied;
14792
14921
  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();
14793
14922
  if (!row) {
@@ -14810,7 +14939,7 @@ routes.post("/:rootId/restore/:versionNumber", async (c) => {
14810
14939
  var routes_default = routes;
14811
14940
 
14812
14941
  // src/plugins/core-plugins/versioning-plugin/index.ts
14813
- var versioningPlugin = chunk5RSB5SEK_cjs.definePlugin({
14942
+ var versioningPlugin = chunkA4KUJ3LD_cjs.definePlugin({
14814
14943
  id: "versioning",
14815
14944
  version: "1.0.0",
14816
14945
  name: "Versioning",
@@ -14887,8 +15016,8 @@ function createMagicLinkAuthPlugin() {
14887
15016
  const baseUrl = new URL(c.req.url).origin;
14888
15017
  const magicLink = `${baseUrl}/auth/magic-link/verify?token=${token}`;
14889
15018
  try {
14890
- if (chunk3E7IROND_cjs.hasEmailService()) {
14891
- await chunk3E7IROND_cjs.getEmailService().send({
15019
+ if (chunk7RUW244J_cjs.hasEmailService()) {
15020
+ await chunk7RUW244J_cjs.getEmailService().send({
14892
15021
  to: normalizedEmail,
14893
15022
  subject: "Your Magic Link to Sign In",
14894
15023
  flow: "magic-link",
@@ -14965,19 +15094,19 @@ function createMagicLinkAuthPlugin() {
14965
15094
  SET used = 1, used_at = ?
14966
15095
  WHERE id = ?
14967
15096
  `).bind(Date.now(), magicLink.id).run();
14968
- const tokenTtl = await chunk4SHNHNRP_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
14969
- const jwtToken = await chunk4SHNHNRP_cjs.AuthManager.generateToken(
15097
+ const tokenTtl = await chunkFCLKX2OS_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
15098
+ const jwtToken = await chunkFCLKX2OS_cjs.AuthManager.generateToken(
14970
15099
  user.id,
14971
15100
  user.email,
14972
15101
  user.role,
14973
15102
  c.env.JWT_SECRET,
14974
15103
  tokenTtl
14975
15104
  );
14976
- chunk4SHNHNRP_cjs.AuthManager.setAuthCookie(c, jwtToken, { maxAge: tokenTtl });
15105
+ chunkFCLKX2OS_cjs.AuthManager.setAuthCookie(c, jwtToken, { maxAge: tokenTtl });
14977
15106
  await db.prepare(`
14978
15107
  UPDATE auth_user SET last_login_at = ? WHERE id = ?
14979
15108
  `).bind(Date.now(), user.id).run();
14980
- chunk3E7IROND_cjs.dispatchHookEvent(
15109
+ chunk7RUW244J_cjs.dispatchHookEvent(
14981
15110
  c,
14982
15111
  "auth:magic-link:consumed",
14983
15112
  { user: { id: user.id, email: user.email, role: user.role } },
@@ -15462,7 +15591,7 @@ async function warmCollections(db) {
15462
15591
  const collectionCache = chunkYA3TJ65D_cjs.getCacheService(config);
15463
15592
  let count = 0;
15464
15593
  try {
15465
- const results = chunk5ARIHAGN_cjs.getCollectionRegistry().listActive().map(chunk5ARIHAGN_cjs.collectionRecordToRow);
15594
+ const results = chunkKVBHB7QP_cjs.getCollectionRegistry().listActive().map(chunkKVBHB7QP_cjs.collectionRecordToRow);
15466
15595
  for (const collection of results) {
15467
15596
  const key = collectionCache.generateKey("item", collection.id);
15468
15597
  await collectionCache.set(key, collection);
@@ -15733,7 +15862,7 @@ function renderCacheDashboard(data) {
15733
15862
  </script>
15734
15863
 
15735
15864
  <!-- Confirmation Dialogs -->
15736
- ${chunk3E7IROND_cjs.renderConfirmationDialog({
15865
+ ${chunk7RUW244J_cjs.renderConfirmationDialog({
15737
15866
  id: "clear-all-cache-confirm",
15738
15867
  title: "Clear All Cache",
15739
15868
  message: "Are you sure you want to clear all cache entries? This cannot be undone.",
@@ -15744,7 +15873,7 @@ function renderCacheDashboard(data) {
15744
15873
  onConfirm: "performClearAllCaches()"
15745
15874
  })}
15746
15875
 
15747
- ${chunk3E7IROND_cjs.renderConfirmationDialog({
15876
+ ${chunk7RUW244J_cjs.renderConfirmationDialog({
15748
15877
  id: "clear-namespace-cache-confirm",
15749
15878
  title: "Clear Namespace Cache",
15750
15879
  message: "Clear cache for this namespace?",
@@ -15755,7 +15884,7 @@ function renderCacheDashboard(data) {
15755
15884
  onConfirm: "performClearNamespaceCache()"
15756
15885
  })}
15757
15886
 
15758
- ${chunk3E7IROND_cjs.getConfirmationDialogScript()}
15887
+ ${chunk7RUW244J_cjs.getConfirmationDialogScript()}
15759
15888
  `;
15760
15889
  const layoutData = {
15761
15890
  title: "Cache System",
@@ -16021,7 +16150,7 @@ app.get("/", async (c) => {
16021
16150
  const totalRequests = totalHits + totalMisses;
16022
16151
  const overallHitRate = totalRequests > 0 ? totalHits / totalRequests * 100 : 0;
16023
16152
  const DEFAULT_TTL = chunkYA3TJ65D_cjs.CACHE_CONFIGS.api?.ttl ?? 300;
16024
- const collections = chunk5ARIHAGN_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => {
16153
+ const collections = chunkKVBHB7QP_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => {
16025
16154
  const cacheOverride = r.cache;
16026
16155
  const cacheEnabled = cacheOverride?.enabled !== false;
16027
16156
  const hasCustomTtl = typeof cacheOverride?.ttl === "number";
@@ -16558,9 +16687,9 @@ var faviconSvg = `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
16558
16687
  // src/app.ts
16559
16688
  function createSonicJSApp(config = {}) {
16560
16689
  const app2 = new hono.Hono();
16561
- const appVersion = config.version || chunkAQJEMVAY_cjs.getCoreVersion();
16690
+ const appVersion = config.version || chunkAOUVUF32_cjs.getCoreVersion();
16562
16691
  const appName = config.name || "SonicJS AI";
16563
- const hookSystem = new chunkDTGCXWWM_cjs.HookSystemImpl();
16692
+ const hookSystem = new chunk5UXU3LP4_cjs.HookSystemImpl();
16564
16693
  chunkJ6JTWD2A_cjs.setHookSystem(hookSystem);
16565
16694
  const magicLinkPlugin = createMagicLinkAuthPlugin();
16566
16695
  const corePluginsBeforeCatchAll = [
@@ -16568,7 +16697,7 @@ function createSonicJSApp(config = {}) {
16568
16697
  apiKeysPlugin,
16569
16698
  aiSearchPlugin,
16570
16699
  oauthProvidersPlugin,
16571
- chunk3E7IROND_cjs.userProfilesPlugin,
16700
+ chunk7RUW244J_cjs.userProfilesPlugin,
16572
16701
  otpLoginPlugin,
16573
16702
  analyticsPlugin,
16574
16703
  stripePlugin,
@@ -16578,23 +16707,23 @@ function createSonicJSApp(config = {}) {
16578
16707
  shortcodesPlugin,
16579
16708
  helloWorldPlugin,
16580
16709
  multiTenantPlugin,
16581
- chunk3E7IROND_cjs.lexicalEditorPlugin,
16710
+ chunk7RUW244J_cjs.lexicalEditorPlugin,
16582
16711
  versioningPlugin
16583
16712
  ];
16584
16713
  const corePluginsAfterCatchAll = [emailPluginV3, magicLinkPlugin, emailReconciliationPlugin];
16585
- const wirePlugins = chunkDTGCXWWM_cjs.createPluginWirer(
16714
+ const wirePlugins = chunk5UXU3LP4_cjs.createPluginWirer(
16586
16715
  () => [...corePluginsBeforeCatchAll, ...corePluginsAfterCatchAll, ...config.plugins?.register ?? []],
16587
16716
  // The capability-gated `ctx.cap.email` resolves to the app EmailService, which
16588
16717
  // is initialized (below) just before wiring on the first request.
16589
16718
  () => ({
16590
16719
  hooks: hookSystem,
16591
16720
  env: firstRequestEnv,
16592
- providers: { email: () => chunk3E7IROND_cjs.getEmailService() }
16721
+ providers: { email: () => chunk7RUW244J_cjs.getEmailService() }
16593
16722
  })
16594
16723
  );
16595
16724
  let firstRequestEnv;
16596
16725
  const initEmailService = async (env = {}) => {
16597
- if (chunk3E7IROND_cjs.hasEmailService()) return;
16726
+ if (chunk7RUW244J_cjs.hasEmailService()) return;
16598
16727
  let provider;
16599
16728
  let defaultFrom = config.email?.from;
16600
16729
  let defaultReplyTo;
@@ -16629,14 +16758,14 @@ function createSonicJSApp(config = {}) {
16629
16758
  }
16630
16759
  }
16631
16760
  defaultFrom = defaultFrom || env.DEFAULT_FROM_EMAIL || "noreply@sonicjs.local";
16632
- chunk3E7IROND_cjs.setEmailService(new EmailService({ provider, defaultFrom, defaultReplyTo, db: env.DB }));
16761
+ chunk7RUW244J_cjs.setEmailService(new EmailService({ provider, defaultFrom, defaultReplyTo, db: env.DB }));
16633
16762
  };
16634
16763
  app2.use("*", async (c, next) => {
16635
16764
  c.set("appVersion", appVersion);
16636
16765
  await next();
16637
16766
  });
16638
- app2.use("*", chunk4SHNHNRP_cjs.metricsMiddleware());
16639
- app2.use("*", chunk4SHNHNRP_cjs.bootstrapMiddleware(config));
16767
+ app2.use("*", chunkFCLKX2OS_cjs.metricsMiddleware());
16768
+ app2.use("*", chunkFCLKX2OS_cjs.bootstrapMiddleware(config));
16640
16769
  const boot = async (env) => {
16641
16770
  if (config.plugins?.disableAll) return;
16642
16771
  firstRequestEnv = env;
@@ -16674,8 +16803,8 @@ function createSonicJSApp(config = {}) {
16674
16803
  allowHeaders: ["Content-Type", "Authorization", "X-API-Key"],
16675
16804
  credentials: true
16676
16805
  }));
16677
- app2.use("*", chunk4SHNHNRP_cjs.securityHeadersMiddleware());
16678
- app2.use("*", chunk4SHNHNRP_cjs.csrfProtection());
16806
+ app2.use("*", chunkFCLKX2OS_cjs.securityHeadersMiddleware());
16807
+ app2.use("*", chunkFCLKX2OS_cjs.csrfProtection());
16679
16808
  app2.use("*", async (c, next) => {
16680
16809
  try {
16681
16810
  const reqUrl = new URL(c.req.url);
@@ -16713,9 +16842,9 @@ function createSonicJSApp(config = {}) {
16713
16842
  app2.use("*", middleware);
16714
16843
  }
16715
16844
  }
16716
- app2.use("*", chunk5ARIHAGN_cjs.tenantMiddleware());
16717
- app2.use("/admin/*", chunk4SHNHNRP_cjs.requireAuth());
16718
- app2.use("/admin/*", chunk4SHNHNRP_cjs.requireRbac("portal", "access"));
16845
+ app2.use("*", chunkKVBHB7QP_cjs.tenantMiddleware());
16846
+ app2.use("/admin/*", chunkFCLKX2OS_cjs.requireAuth());
16847
+ app2.use("/admin/*", chunkFCLKX2OS_cjs.requireRbac("portal", "access"));
16719
16848
  app2.use("/admin/*", pluginMenuMiddleware());
16720
16849
  const NAV_LANDING = [
16721
16850
  { path: "/admin/content", perm: "content:read" },
@@ -16761,43 +16890,43 @@ function createSonicJSApp(config = {}) {
16761
16890
  });
16762
16891
  app2.route("/api/security-audit", apiRoutes2);
16763
16892
  app2.route("/admin/plugins/security-audit", adminRoutes3);
16764
- app2.route("/api/media", chunk3E7IROND_cjs.api_media_default);
16765
- app2.route("/api/system", chunk3E7IROND_cjs.api_system_default);
16766
- app2.route("/api/documents", chunk3E7IROND_cjs.apiDocumentsRoutes);
16767
- app2.route("/api", chunk3E7IROND_cjs.api_default);
16768
- app2.route("/admin/documents", chunk3E7IROND_cjs.adminDocumentsRoutes);
16769
- chunkDTGCXWWM_cjs.registerPluginRoutes(app2, [formsPlugin], { source: "core" });
16770
- app2.route("/admin/api", chunk3E7IROND_cjs.admin_api_default);
16771
- app2.route("/admin/collections", chunk3E7IROND_cjs.adminCollectionsRoutes);
16772
- app2.route("/admin/settings", chunk3E7IROND_cjs.adminSettingsRoutes);
16773
- app2.route("/admin/api-reference", chunk3E7IROND_cjs.router2);
16893
+ app2.route("/api/media", chunk7RUW244J_cjs.api_media_default);
16894
+ app2.route("/api/system", chunk7RUW244J_cjs.api_system_default);
16895
+ app2.route("/api/documents", chunk7RUW244J_cjs.apiDocumentsRoutes);
16896
+ app2.route("/api", chunk7RUW244J_cjs.api_default);
16897
+ app2.route("/admin/documents", chunk7RUW244J_cjs.adminDocumentsRoutes);
16898
+ chunk5UXU3LP4_cjs.registerPluginRoutes(app2, [formsPlugin], { source: "core" });
16899
+ app2.route("/admin/api", chunk7RUW244J_cjs.admin_api_default);
16900
+ app2.route("/admin/collections", chunk7RUW244J_cjs.adminCollectionsRoutes);
16901
+ app2.route("/admin/settings", chunk7RUW244J_cjs.adminSettingsRoutes);
16902
+ app2.route("/admin/api-reference", chunk7RUW244J_cjs.router2);
16774
16903
  app2.route("/admin/database-tools", createDatabaseToolsAdminRoutes());
16775
- app2.route("/admin/content", chunk3E7IROND_cjs.admin_content_default);
16776
- app2.route("/admin/media", chunk3E7IROND_cjs.adminMediaRoutes);
16904
+ app2.route("/admin/content", chunk7RUW244J_cjs.admin_content_default);
16905
+ app2.route("/admin/media", chunk7RUW244J_cjs.adminMediaRoutes);
16777
16906
  app2.use("/auth/*", securityAuditMiddleware());
16778
16907
  if (!config.plugins?.disableAll) {
16779
- chunkDTGCXWWM_cjs.registerPluginRoutes(app2, corePluginsBeforeCatchAll, { source: "core" });
16908
+ chunk5UXU3LP4_cjs.registerPluginRoutes(app2, corePluginsBeforeCatchAll, { source: "core" });
16780
16909
  app2.route("/admin/cache", cache_default.getRoutes());
16781
16910
  if (config.plugins?.register && config.plugins.register.length > 0) {
16782
- chunkDTGCXWWM_cjs.registerPluginRoutes(app2, config.plugins.register, { source: "user" });
16911
+ chunk5UXU3LP4_cjs.registerPluginRoutes(app2, config.plugins.register, { source: "user" });
16783
16912
  }
16784
16913
  }
16785
16914
  app2.route("/api/events", apiRoutes4);
16786
- app2.route("/admin/dashboard", chunk3E7IROND_cjs.router);
16787
- app2.route("/admin/plugins", chunk3E7IROND_cjs.adminPluginRoutes);
16788
- app2.route("/admin/logs", chunk3E7IROND_cjs.adminLogsRoutes);
16915
+ app2.route("/admin/dashboard", chunk7RUW244J_cjs.router);
16916
+ app2.route("/admin/plugins", chunk7RUW244J_cjs.adminPluginRoutes);
16917
+ app2.route("/admin/logs", chunk7RUW244J_cjs.adminLogsRoutes);
16789
16918
  app2.route("/admin/rbac", adminRbacRoutes);
16790
- app2.route("/admin", chunk3E7IROND_cjs.userRoutes);
16791
- app2.route("/auth", chunk3E7IROND_cjs.auth_default);
16919
+ app2.route("/admin", chunk7RUW244J_cjs.userRoutes);
16920
+ app2.route("/auth", chunk7RUW244J_cjs.auth_default);
16792
16921
  app2.on(["GET", "POST"], "/auth/*", (c) => {
16793
16922
  const reqUrl = new URL(c.req.url);
16794
16923
  const requestBaseURL = `${reqUrl.protocol}//${reqUrl.host}`;
16795
16924
  const auth = chunkGMMCCIQO_cjs.createAuth(c.env, config.auth?.extendBetterAuth, requestBaseURL);
16796
16925
  return auth.handler(c.req.raw);
16797
16926
  });
16798
- app2.route("/", chunk3E7IROND_cjs.test_cleanup_default);
16927
+ app2.route("/", chunk7RUW244J_cjs.test_cleanup_default);
16799
16928
  if (!config.plugins?.disableAll) {
16800
- chunkDTGCXWWM_cjs.registerPluginRoutes(app2, corePluginsAfterCatchAll, { source: "core" });
16929
+ chunk5UXU3LP4_cjs.registerPluginRoutes(app2, corePluginsAfterCatchAll, { source: "core" });
16801
16930
  }
16802
16931
  if (!config.plugins?.disableAll) {
16803
16932
  const allMountedPlugins = [
@@ -16807,10 +16936,10 @@ function createSonicJSApp(config = {}) {
16807
16936
  ...config.plugins?.register ?? []
16808
16937
  ];
16809
16938
  const userPlugins = (config.plugins?.register ?? []).filter(
16810
- (p) => !chunk5ARIHAGN_cjs.PLUGIN_REGISTRY[p.id]
16939
+ (p) => !chunkKVBHB7QP_cjs.PLUGIN_REGISTRY[p.id]
16811
16940
  );
16812
- chunkDTGCXWWM_cjs.setPluginMenu(userPlugins.flatMap((p) => p.menu ?? []));
16813
- chunk5RSB5SEK_cjs.setPluginDefinitions(allMountedPlugins);
16941
+ chunk5UXU3LP4_cjs.setPluginMenu(userPlugins.flatMap((p) => p.menu ?? []));
16942
+ chunkA4KUJ3LD_cjs.setPluginDefinitions(allMountedPlugins);
16814
16943
  }
16815
16944
  app2.get("/favicon.svg", (c) => {
16816
16945
  return new Response(faviconSvg, {
@@ -20304,7 +20433,7 @@ function createRedirectApiRoutes() {
20304
20433
  });
20305
20434
  return api;
20306
20435
  }
20307
- var redirectPlugin = chunk5RSB5SEK_cjs.definePlugin({
20436
+ var redirectPlugin = chunkA4KUJ3LD_cjs.definePlugin({
20308
20437
  id: manifest_default3.id,
20309
20438
  version: manifest_default3.version,
20310
20439
  name: manifest_default3.name,
@@ -20322,7 +20451,7 @@ var redirectPlugin = chunk5RSB5SEK_cjs.definePlugin({
20322
20451
  async onBoot(ctx) {
20323
20452
  const db = ctx.env?.DB;
20324
20453
  if (!db) return;
20325
- const registry = new chunk4SHNHNRP_cjs.DocumentTypeRegistry(db);
20454
+ const registry = new chunkFCLKX2OS_cjs.DocumentTypeRegistry(db);
20326
20455
  await registry.register({
20327
20456
  id: "redirect",
20328
20457
  name: "redirect",
@@ -20438,91 +20567,91 @@ function createDb(d1$1) {
20438
20567
  }
20439
20568
 
20440
20569
  // src/index.ts
20441
- var VERSION = chunkAQJEMVAY_cjs.package_default.version;
20570
+ var VERSION = chunkAOUVUF32_cjs.package_default.version;
20442
20571
 
20443
20572
  Object.defineProperty(exports, "DocumentRepository", {
20444
20573
  enumerable: true,
20445
- get: function () { return chunk3E7IROND_cjs.DocumentRepository; }
20574
+ get: function () { return chunk7RUW244J_cjs.DocumentRepository; }
20446
20575
  });
20447
20576
  Object.defineProperty(exports, "ROUTES_INFO", {
20448
20577
  enumerable: true,
20449
- get: function () { return chunk3E7IROND_cjs.ROUTES_INFO; }
20578
+ get: function () { return chunk7RUW244J_cjs.ROUTES_INFO; }
20450
20579
  });
20451
20580
  Object.defineProperty(exports, "adminApiRoutes", {
20452
20581
  enumerable: true,
20453
- get: function () { return chunk3E7IROND_cjs.admin_api_default; }
20582
+ get: function () { return chunk7RUW244J_cjs.admin_api_default; }
20454
20583
  });
20455
20584
  Object.defineProperty(exports, "adminCheckboxRoutes", {
20456
20585
  enumerable: true,
20457
- get: function () { return chunk3E7IROND_cjs.adminCheckboxRoutes; }
20586
+ get: function () { return chunk7RUW244J_cjs.adminCheckboxRoutes; }
20458
20587
  });
20459
20588
  Object.defineProperty(exports, "adminCollectionsRoutes", {
20460
20589
  enumerable: true,
20461
- get: function () { return chunk3E7IROND_cjs.adminCollectionsRoutes; }
20590
+ get: function () { return chunk7RUW244J_cjs.adminCollectionsRoutes; }
20462
20591
  });
20463
20592
  Object.defineProperty(exports, "adminContentRoutes", {
20464
20593
  enumerable: true,
20465
- get: function () { return chunk3E7IROND_cjs.admin_content_default; }
20594
+ get: function () { return chunk7RUW244J_cjs.admin_content_default; }
20466
20595
  });
20467
20596
  Object.defineProperty(exports, "adminDashboardRoutes", {
20468
20597
  enumerable: true,
20469
- get: function () { return chunk3E7IROND_cjs.router; }
20598
+ get: function () { return chunk7RUW244J_cjs.router; }
20470
20599
  });
20471
20600
  Object.defineProperty(exports, "adminLogsRoutes", {
20472
20601
  enumerable: true,
20473
- get: function () { return chunk3E7IROND_cjs.adminLogsRoutes; }
20602
+ get: function () { return chunk7RUW244J_cjs.adminLogsRoutes; }
20474
20603
  });
20475
20604
  Object.defineProperty(exports, "adminMediaRoutes", {
20476
20605
  enumerable: true,
20477
- get: function () { return chunk3E7IROND_cjs.adminMediaRoutes; }
20606
+ get: function () { return chunk7RUW244J_cjs.adminMediaRoutes; }
20478
20607
  });
20479
20608
  Object.defineProperty(exports, "adminPluginRoutes", {
20480
20609
  enumerable: true,
20481
- get: function () { return chunk3E7IROND_cjs.adminPluginRoutes; }
20610
+ get: function () { return chunk7RUW244J_cjs.adminPluginRoutes; }
20482
20611
  });
20483
20612
  Object.defineProperty(exports, "adminSettingsRoutes", {
20484
20613
  enumerable: true,
20485
- get: function () { return chunk3E7IROND_cjs.adminSettingsRoutes; }
20614
+ get: function () { return chunk7RUW244J_cjs.adminSettingsRoutes; }
20486
20615
  });
20487
20616
  Object.defineProperty(exports, "adminUsersRoutes", {
20488
20617
  enumerable: true,
20489
- get: function () { return chunk3E7IROND_cjs.userRoutes; }
20618
+ get: function () { return chunk7RUW244J_cjs.userRoutes; }
20490
20619
  });
20491
20620
  Object.defineProperty(exports, "apiContentCrudRoutes", {
20492
20621
  enumerable: true,
20493
- get: function () { return chunk3E7IROND_cjs.api_content_crud_default; }
20622
+ get: function () { return chunk7RUW244J_cjs.api_content_crud_default; }
20494
20623
  });
20495
20624
  Object.defineProperty(exports, "apiMediaRoutes", {
20496
20625
  enumerable: true,
20497
- get: function () { return chunk3E7IROND_cjs.api_media_default; }
20626
+ get: function () { return chunk7RUW244J_cjs.api_media_default; }
20498
20627
  });
20499
20628
  Object.defineProperty(exports, "apiRoutes", {
20500
20629
  enumerable: true,
20501
- get: function () { return chunk3E7IROND_cjs.api_default; }
20630
+ get: function () { return chunk7RUW244J_cjs.api_default; }
20502
20631
  });
20503
20632
  Object.defineProperty(exports, "apiSystemRoutes", {
20504
20633
  enumerable: true,
20505
- get: function () { return chunk3E7IROND_cjs.api_system_default; }
20634
+ get: function () { return chunk7RUW244J_cjs.api_system_default; }
20506
20635
  });
20507
20636
  Object.defineProperty(exports, "authRoutes", {
20508
20637
  enumerable: true,
20509
- get: function () { return chunk3E7IROND_cjs.auth_default; }
20638
+ get: function () { return chunk7RUW244J_cjs.auth_default; }
20510
20639
  });
20511
20640
  Object.defineProperty(exports, "createUserProfilesPlugin", {
20512
20641
  enumerable: true,
20513
- get: function () { return chunk3E7IROND_cjs.createUserProfilesPlugin; }
20642
+ get: function () { return chunk7RUW244J_cjs.createUserProfilesPlugin; }
20514
20643
  });
20515
20644
  Object.defineProperty(exports, "defineUserProfile", {
20516
20645
  enumerable: true,
20517
- get: function () { return chunk3E7IROND_cjs.defineUserProfile; }
20646
+ get: function () { return chunk7RUW244J_cjs.defineUserProfile; }
20518
20647
  });
20519
20648
  Object.defineProperty(exports, "getUserProfileConfig", {
20520
20649
  enumerable: true,
20521
- get: function () { return chunk3E7IROND_cjs.getUserProfileConfig; }
20650
+ get: function () { return chunk7RUW244J_cjs.getUserProfileConfig; }
20522
20651
  });
20523
20652
  Object.defineProperty(exports, "userProfilesPlugin", {
20524
20653
  enumerable: true,
20525
- get: function () { return chunk3E7IROND_cjs.userProfilesPlugin; }
20654
+ get: function () { return chunk7RUW244J_cjs.userProfilesPlugin; }
20526
20655
  });
20527
20656
  Object.defineProperty(exports, "Logger", {
20528
20657
  enumerable: true,
@@ -20678,87 +20807,87 @@ Object.defineProperty(exports, "workflowHistory", {
20678
20807
  });
20679
20808
  Object.defineProperty(exports, "AuthManager", {
20680
20809
  enumerable: true,
20681
- get: function () { return chunk4SHNHNRP_cjs.AuthManager; }
20810
+ get: function () { return chunkFCLKX2OS_cjs.AuthManager; }
20682
20811
  });
20683
20812
  Object.defineProperty(exports, "PermissionManager", {
20684
20813
  enumerable: true,
20685
- get: function () { return chunk4SHNHNRP_cjs.PermissionManager; }
20814
+ get: function () { return chunkFCLKX2OS_cjs.PermissionManager; }
20686
20815
  });
20687
20816
  Object.defineProperty(exports, "bootstrapDocumentTypes", {
20688
20817
  enumerable: true,
20689
- get: function () { return chunk4SHNHNRP_cjs.bootstrapDocumentTypes; }
20818
+ get: function () { return chunkFCLKX2OS_cjs.bootstrapDocumentTypes; }
20690
20819
  });
20691
20820
  Object.defineProperty(exports, "bootstrapMiddleware", {
20692
20821
  enumerable: true,
20693
- get: function () { return chunk4SHNHNRP_cjs.bootstrapMiddleware; }
20822
+ get: function () { return chunkFCLKX2OS_cjs.bootstrapMiddleware; }
20694
20823
  });
20695
20824
  Object.defineProperty(exports, "cacheHeaders", {
20696
20825
  enumerable: true,
20697
- get: function () { return chunk4SHNHNRP_cjs.cacheHeaders; }
20826
+ get: function () { return chunkFCLKX2OS_cjs.cacheHeaders; }
20698
20827
  });
20699
20828
  Object.defineProperty(exports, "compressionMiddleware", {
20700
20829
  enumerable: true,
20701
- get: function () { return chunk4SHNHNRP_cjs.compressionMiddleware; }
20830
+ get: function () { return chunkFCLKX2OS_cjs.compressionMiddleware; }
20702
20831
  });
20703
20832
  Object.defineProperty(exports, "detailedLoggingMiddleware", {
20704
20833
  enumerable: true,
20705
- get: function () { return chunk4SHNHNRP_cjs.detailedLoggingMiddleware; }
20834
+ get: function () { return chunkFCLKX2OS_cjs.detailedLoggingMiddleware; }
20706
20835
  });
20707
20836
  Object.defineProperty(exports, "getActivePlugins", {
20708
20837
  enumerable: true,
20709
- get: function () { return chunk4SHNHNRP_cjs.getActivePlugins; }
20838
+ get: function () { return chunkFCLKX2OS_cjs.getActivePlugins; }
20710
20839
  });
20711
20840
  Object.defineProperty(exports, "isPluginActive", {
20712
20841
  enumerable: true,
20713
- get: function () { return chunk4SHNHNRP_cjs.isPluginActive; }
20842
+ get: function () { return chunkFCLKX2OS_cjs.isPluginActive; }
20714
20843
  });
20715
20844
  Object.defineProperty(exports, "logActivity", {
20716
20845
  enumerable: true,
20717
- get: function () { return chunk4SHNHNRP_cjs.logActivity; }
20846
+ get: function () { return chunkFCLKX2OS_cjs.logActivity; }
20718
20847
  });
20719
20848
  Object.defineProperty(exports, "loggingMiddleware", {
20720
20849
  enumerable: true,
20721
- get: function () { return chunk4SHNHNRP_cjs.loggingMiddleware; }
20850
+ get: function () { return chunkFCLKX2OS_cjs.loggingMiddleware; }
20722
20851
  });
20723
20852
  Object.defineProperty(exports, "optionalAuth", {
20724
20853
  enumerable: true,
20725
- get: function () { return chunk4SHNHNRP_cjs.optionalAuth; }
20854
+ get: function () { return chunkFCLKX2OS_cjs.optionalAuth; }
20726
20855
  });
20727
20856
  Object.defineProperty(exports, "performanceLoggingMiddleware", {
20728
20857
  enumerable: true,
20729
- get: function () { return chunk4SHNHNRP_cjs.performanceLoggingMiddleware; }
20858
+ get: function () { return chunkFCLKX2OS_cjs.performanceLoggingMiddleware; }
20730
20859
  });
20731
20860
  Object.defineProperty(exports, "requireActivePlugin", {
20732
20861
  enumerable: true,
20733
- get: function () { return chunk4SHNHNRP_cjs.requireActivePlugin; }
20862
+ get: function () { return chunkFCLKX2OS_cjs.requireActivePlugin; }
20734
20863
  });
20735
20864
  Object.defineProperty(exports, "requireActivePlugins", {
20736
20865
  enumerable: true,
20737
- get: function () { return chunk4SHNHNRP_cjs.requireActivePlugins; }
20866
+ get: function () { return chunkFCLKX2OS_cjs.requireActivePlugins; }
20738
20867
  });
20739
20868
  Object.defineProperty(exports, "requireAnyPermission", {
20740
20869
  enumerable: true,
20741
- get: function () { return chunk4SHNHNRP_cjs.requireAnyPermission; }
20870
+ get: function () { return chunkFCLKX2OS_cjs.requireAnyPermission; }
20742
20871
  });
20743
20872
  Object.defineProperty(exports, "requireAuth", {
20744
20873
  enumerable: true,
20745
- get: function () { return chunk4SHNHNRP_cjs.requireAuth; }
20874
+ get: function () { return chunkFCLKX2OS_cjs.requireAuth; }
20746
20875
  });
20747
20876
  Object.defineProperty(exports, "requirePermission", {
20748
20877
  enumerable: true,
20749
- get: function () { return chunk4SHNHNRP_cjs.requirePermission; }
20878
+ get: function () { return chunkFCLKX2OS_cjs.requirePermission; }
20750
20879
  });
20751
20880
  Object.defineProperty(exports, "requireRole", {
20752
20881
  enumerable: true,
20753
- get: function () { return chunk4SHNHNRP_cjs.requireRole; }
20882
+ get: function () { return chunkFCLKX2OS_cjs.requireRole; }
20754
20883
  });
20755
20884
  Object.defineProperty(exports, "securityHeaders", {
20756
20885
  enumerable: true,
20757
- get: function () { return chunk4SHNHNRP_cjs.securityHeadersMiddleware; }
20886
+ get: function () { return chunkFCLKX2OS_cjs.securityHeadersMiddleware; }
20758
20887
  });
20759
20888
  Object.defineProperty(exports, "securityLoggingMiddleware", {
20760
20889
  enumerable: true,
20761
- get: function () { return chunk4SHNHNRP_cjs.securityLoggingMiddleware; }
20890
+ get: function () { return chunkFCLKX2OS_cjs.securityLoggingMiddleware; }
20762
20891
  });
20763
20892
  Object.defineProperty(exports, "DocumentsService", {
20764
20893
  enumerable: true,
@@ -20770,35 +20899,35 @@ Object.defineProperty(exports, "RbacService", {
20770
20899
  });
20771
20900
  Object.defineProperty(exports, "PluginBootstrapService", {
20772
20901
  enumerable: true,
20773
- get: function () { return chunk5ARIHAGN_cjs.PluginBootstrapService; }
20902
+ get: function () { return chunkKVBHB7QP_cjs.PluginBootstrapService; }
20774
20903
  });
20775
20904
  Object.defineProperty(exports, "PluginServiceClass", {
20776
20905
  enumerable: true,
20777
- get: function () { return chunk5ARIHAGN_cjs.PluginService; }
20906
+ get: function () { return chunkKVBHB7QP_cjs.PluginService; }
20778
20907
  });
20779
20908
  Object.defineProperty(exports, "getAvailableCollectionNames", {
20780
20909
  enumerable: true,
20781
- get: function () { return chunk5ARIHAGN_cjs.getAvailableCollectionNames; }
20910
+ get: function () { return chunkKVBHB7QP_cjs.getAvailableCollectionNames; }
20782
20911
  });
20783
20912
  Object.defineProperty(exports, "loadCollectionConfig", {
20784
20913
  enumerable: true,
20785
- get: function () { return chunk5ARIHAGN_cjs.loadCollectionConfig; }
20914
+ get: function () { return chunkKVBHB7QP_cjs.loadCollectionConfig; }
20786
20915
  });
20787
20916
  Object.defineProperty(exports, "loadCollectionConfigs", {
20788
20917
  enumerable: true,
20789
- get: function () { return chunk5ARIHAGN_cjs.loadCollectionConfigs; }
20918
+ get: function () { return chunkKVBHB7QP_cjs.loadCollectionConfigs; }
20790
20919
  });
20791
20920
  Object.defineProperty(exports, "registerCollections", {
20792
20921
  enumerable: true,
20793
- get: function () { return chunk5ARIHAGN_cjs.registerCollections; }
20922
+ get: function () { return chunkKVBHB7QP_cjs.registerCollections; }
20794
20923
  });
20795
20924
  Object.defineProperty(exports, "validateCollectionConfig", {
20796
20925
  enumerable: true,
20797
- get: function () { return chunk5ARIHAGN_cjs.validateCollectionConfig; }
20926
+ get: function () { return chunkKVBHB7QP_cjs.validateCollectionConfig; }
20798
20927
  });
20799
20928
  Object.defineProperty(exports, "MigrationService", {
20800
20929
  enumerable: true,
20801
- get: function () { return chunkTQG5FNNR_cjs.MigrationService; }
20930
+ get: function () { return chunkOJC4G5JE_cjs.MigrationService; }
20802
20931
  });
20803
20932
  Object.defineProperty(exports, "renderFilterBar", {
20804
20933
  enumerable: true,
@@ -20838,99 +20967,99 @@ Object.defineProperty(exports, "renderAdminLayoutCatalyst", {
20838
20967
  });
20839
20968
  Object.defineProperty(exports, "HookSystemImpl", {
20840
20969
  enumerable: true,
20841
- get: function () { return chunkDTGCXWWM_cjs.HookSystemImpl; }
20970
+ get: function () { return chunk5UXU3LP4_cjs.HookSystemImpl; }
20842
20971
  });
20843
20972
  Object.defineProperty(exports, "HookUtils", {
20844
20973
  enumerable: true,
20845
- get: function () { return chunkDTGCXWWM_cjs.HookUtils; }
20974
+ get: function () { return chunk5UXU3LP4_cjs.HookUtils; }
20846
20975
  });
20847
20976
  Object.defineProperty(exports, "PluginDependencyCycleError", {
20848
20977
  enumerable: true,
20849
- get: function () { return chunkDTGCXWWM_cjs.PluginDependencyCycleError; }
20978
+ get: function () { return chunk5UXU3LP4_cjs.PluginDependencyCycleError; }
20850
20979
  });
20851
20980
  Object.defineProperty(exports, "PluginManagerClass", {
20852
20981
  enumerable: true,
20853
- get: function () { return chunkDTGCXWWM_cjs.PluginManager; }
20982
+ get: function () { return chunk5UXU3LP4_cjs.PluginManager; }
20854
20983
  });
20855
20984
  Object.defineProperty(exports, "PluginRegistryImpl", {
20856
20985
  enumerable: true,
20857
- get: function () { return chunkDTGCXWWM_cjs.PluginRegistryImpl; }
20986
+ get: function () { return chunk5UXU3LP4_cjs.PluginRegistryImpl; }
20858
20987
  });
20859
20988
  Object.defineProperty(exports, "PluginValidatorClass", {
20860
20989
  enumerable: true,
20861
- get: function () { return chunkDTGCXWWM_cjs.PluginValidator; }
20990
+ get: function () { return chunk5UXU3LP4_cjs.PluginValidator; }
20862
20991
  });
20863
20992
  Object.defineProperty(exports, "RegisterPluginsError", {
20864
20993
  enumerable: true,
20865
- get: function () { return chunkDTGCXWWM_cjs.RegisterPluginsError; }
20994
+ get: function () { return chunk5UXU3LP4_cjs.RegisterPluginsError; }
20866
20995
  });
20867
20996
  Object.defineProperty(exports, "ScopedHookSystemClass", {
20868
20997
  enumerable: true,
20869
- get: function () { return chunkDTGCXWWM_cjs.ScopedHookSystem; }
20998
+ get: function () { return chunk5UXU3LP4_cjs.ScopedHookSystem; }
20870
20999
  });
20871
21000
  Object.defineProperty(exports, "collectCronSchedules", {
20872
21001
  enumerable: true,
20873
- get: function () { return chunkDTGCXWWM_cjs.collectCronSchedules; }
21002
+ get: function () { return chunk5UXU3LP4_cjs.collectCronSchedules; }
20874
21003
  });
20875
21004
  Object.defineProperty(exports, "collectCrons", {
20876
21005
  enumerable: true,
20877
- get: function () { return chunkDTGCXWWM_cjs.collectCrons; }
21006
+ get: function () { return chunk5UXU3LP4_cjs.collectCrons; }
20878
21007
  });
20879
21008
  Object.defineProperty(exports, "createScheduledHandler", {
20880
21009
  enumerable: true,
20881
- get: function () { return chunkDTGCXWWM_cjs.createScheduledHandler; }
21010
+ get: function () { return chunk5UXU3LP4_cjs.createScheduledHandler; }
20882
21011
  });
20883
21012
  Object.defineProperty(exports, "dispatchCronTick", {
20884
21013
  enumerable: true,
20885
- get: function () { return chunkDTGCXWWM_cjs.dispatchCronTick; }
21014
+ get: function () { return chunk5UXU3LP4_cjs.dispatchCronTick; }
20886
21015
  });
20887
21016
  Object.defineProperty(exports, "getPluginMenu", {
20888
21017
  enumerable: true,
20889
- get: function () { return chunkDTGCXWWM_cjs.getPluginMenu; }
21018
+ get: function () { return chunk5UXU3LP4_cjs.getPluginMenu; }
20890
21019
  });
20891
21020
  Object.defineProperty(exports, "registerPlugins", {
20892
21021
  enumerable: true,
20893
- get: function () { return chunkDTGCXWWM_cjs.registerPlugins; }
21022
+ get: function () { return chunk5UXU3LP4_cjs.registerPlugins; }
20894
21023
  });
20895
21024
  Object.defineProperty(exports, "resetPluginMenu", {
20896
21025
  enumerable: true,
20897
- get: function () { return chunkDTGCXWWM_cjs.resetPluginMenu; }
21026
+ get: function () { return chunk5UXU3LP4_cjs.resetPluginMenu; }
20898
21027
  });
20899
21028
  Object.defineProperty(exports, "resolvePluginMenuItems", {
20900
21029
  enumerable: true,
20901
- get: function () { return chunkDTGCXWWM_cjs.resolvePluginMenuItems; }
21030
+ get: function () { return chunk5UXU3LP4_cjs.resolvePluginMenuItems; }
20902
21031
  });
20903
21032
  Object.defineProperty(exports, "setPluginMenu", {
20904
21033
  enumerable: true,
20905
- get: function () { return chunkDTGCXWWM_cjs.setPluginMenu; }
21034
+ get: function () { return chunk5UXU3LP4_cjs.setPluginMenu; }
20906
21035
  });
20907
21036
  Object.defineProperty(exports, "topoSort", {
20908
21037
  enumerable: true,
20909
- get: function () { return chunkDTGCXWWM_cjs.topoSort; }
21038
+ get: function () { return chunk5UXU3LP4_cjs.topoSort; }
20910
21039
  });
20911
21040
  Object.defineProperty(exports, "applySchemaDefaults", {
20912
21041
  enumerable: true,
20913
- get: function () { return chunk5RSB5SEK_cjs.applySchemaDefaults; }
21042
+ get: function () { return chunkA4KUJ3LD_cjs.applySchemaDefaults; }
20914
21043
  });
20915
21044
  Object.defineProperty(exports, "definePlugin", {
20916
21045
  enumerable: true,
20917
- get: function () { return chunk5RSB5SEK_cjs.definePlugin; }
21046
+ get: function () { return chunkA4KUJ3LD_cjs.definePlugin; }
20918
21047
  });
20919
21048
  Object.defineProperty(exports, "isDefinedPlugin", {
20920
21049
  enumerable: true,
20921
- get: function () { return chunk5RSB5SEK_cjs.isDefinedPlugin; }
21050
+ get: function () { return chunkA4KUJ3LD_cjs.isDefinedPlugin; }
20922
21051
  });
20923
21052
  Object.defineProperty(exports, "parseConfigSchema", {
20924
21053
  enumerable: true,
20925
- get: function () { return chunk5RSB5SEK_cjs.parseConfigSchema; }
21054
+ get: function () { return chunkA4KUJ3LD_cjs.parseConfigSchema; }
20926
21055
  });
20927
21056
  Object.defineProperty(exports, "parseFormDataToSettings", {
20928
21057
  enumerable: true,
20929
- get: function () { return chunk5RSB5SEK_cjs.parseFormDataToSettings; }
21058
+ get: function () { return chunkA4KUJ3LD_cjs.parseFormDataToSettings; }
20930
21059
  });
20931
21060
  Object.defineProperty(exports, "renderSchemaFields", {
20932
21061
  enumerable: true,
20933
- get: function () { return chunk5RSB5SEK_cjs.renderSchemaFields; }
21062
+ get: function () { return chunkA4KUJ3LD_cjs.renderSchemaFields; }
20934
21063
  });
20935
21064
  Object.defineProperty(exports, "getHookSystem", {
20936
21065
  enumerable: true,
@@ -20978,11 +21107,11 @@ Object.defineProperty(exports, "metricsTracker", {
20978
21107
  });
20979
21108
  Object.defineProperty(exports, "SONICJS_VERSION", {
20980
21109
  enumerable: true,
20981
- get: function () { return chunkAQJEMVAY_cjs.SONICJS_VERSION; }
21110
+ get: function () { return chunkAOUVUF32_cjs.SONICJS_VERSION; }
20982
21111
  });
20983
21112
  Object.defineProperty(exports, "getCoreVersion", {
20984
21113
  enumerable: true,
20985
- get: function () { return chunkAQJEMVAY_cjs.getCoreVersion; }
21114
+ get: function () { return chunkAOUVUF32_cjs.getCoreVersion; }
20986
21115
  });
20987
21116
  Object.defineProperty(exports, "escapeHtml", {
20988
21117
  enumerable: true,