@rubytech/create-maxy-code 0.1.348 → 0.1.350

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 (102) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/docs/superpowers/plans/2026-06-23-account-filesystem-schema.md +544 -0
  3. package/payload/platform/docs/superpowers/specs/2026-06-23-account-filesystem-schema-design.md +170 -0
  4. package/payload/platform/lib/graph-style/dist/index.d.ts +1 -1
  5. package/payload/platform/lib/graph-style/dist/index.d.ts.map +1 -1
  6. package/payload/platform/lib/graph-style/dist/index.js +20 -12
  7. package/payload/platform/lib/graph-style/dist/index.js.map +1 -1
  8. package/payload/platform/lib/graph-style/src/__tests__/parity.test.ts +9 -9
  9. package/payload/platform/lib/graph-style/src/index.ts +20 -12
  10. package/payload/platform/lib/graph-write/dist/index.d.ts.map +1 -1
  11. package/payload/platform/lib/graph-write/dist/index.js +3 -2
  12. package/payload/platform/lib/graph-write/dist/index.js.map +1 -1
  13. package/payload/platform/lib/graph-write/src/index.ts +3 -2
  14. package/payload/platform/neo4j/schema.cypher +110 -31
  15. package/payload/platform/plugins/.claude-plugin/marketplace.json +5 -0
  16. package/payload/platform/plugins/admin/hooks/__tests__/fs-schema-guard.test.sh +68 -0
  17. package/payload/platform/plugins/admin/hooks/fs-schema-guard.sh +108 -0
  18. package/payload/platform/plugins/admin/hooks/lib/maxy-mcp-plugins.txt +1 -0
  19. package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +36 -3
  20. package/payload/platform/plugins/docs/references/calendar-booking.md +1 -1
  21. package/payload/platform/plugins/docs/references/joblogic.md +28 -0
  22. package/payload/platform/plugins/docs/references/memory-guide.md +1 -1
  23. package/payload/platform/plugins/joblogic/.claude-plugin/plugin.json +21 -0
  24. package/payload/platform/plugins/joblogic/PLUGIN.md +182 -0
  25. package/payload/platform/plugins/joblogic/lib/mcp-spawn-tee/index.js +193 -0
  26. package/payload/platform/plugins/joblogic/lib/mcp-spawn-tee/package.json +3 -0
  27. package/payload/platform/plugins/joblogic/mcp/dist/index.d.ts +2 -0
  28. package/payload/platform/plugins/joblogic/mcp/dist/index.d.ts.map +1 -0
  29. package/payload/platform/plugins/joblogic/mcp/dist/index.js +229 -0
  30. package/payload/platform/plugins/joblogic/mcp/dist/index.js.map +1 -0
  31. package/payload/platform/plugins/joblogic/mcp/dist/lib/auth.d.ts +31 -0
  32. package/payload/platform/plugins/joblogic/mcp/dist/lib/auth.d.ts.map +1 -0
  33. package/payload/platform/plugins/joblogic/mcp/dist/lib/auth.js +78 -0
  34. package/payload/platform/plugins/joblogic/mcp/dist/lib/auth.js.map +1 -0
  35. package/payload/platform/plugins/joblogic/mcp/dist/lib/client.d.ts +35 -0
  36. package/payload/platform/plugins/joblogic/mcp/dist/lib/client.d.ts.map +1 -0
  37. package/payload/platform/plugins/joblogic/mcp/dist/lib/client.js +106 -0
  38. package/payload/platform/plugins/joblogic/mcp/dist/lib/client.js.map +1 -0
  39. package/payload/platform/plugins/joblogic/mcp/dist/lib/idempotency.d.ts +8 -0
  40. package/payload/platform/plugins/joblogic/mcp/dist/lib/idempotency.d.ts.map +1 -0
  41. package/payload/platform/plugins/joblogic/mcp/dist/lib/idempotency.js +41 -0
  42. package/payload/platform/plugins/joblogic/mcp/dist/lib/idempotency.js.map +1 -0
  43. package/payload/platform/plugins/joblogic/mcp/dist/lib/secrets.d.ts +21 -0
  44. package/payload/platform/plugins/joblogic/mcp/dist/lib/secrets.d.ts.map +1 -0
  45. package/payload/platform/plugins/joblogic/mcp/dist/lib/secrets.js +47 -0
  46. package/payload/platform/plugins/joblogic/mcp/dist/lib/secrets.js.map +1 -0
  47. package/payload/platform/plugins/joblogic/mcp/package.json +10 -0
  48. package/payload/platform/plugins/joblogic/skills/joblogic/SKILL.md +32 -0
  49. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/relationship-patterns.test.js +28 -22
  50. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/relationship-patterns.test.js.map +1 -1
  51. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/schema-cypher-drift.test.js +8 -4
  52. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/schema-cypher-drift.test.js.map +1 -1
  53. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/schema-write-path-task802.test.js +39 -10
  54. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/schema-write-path-task802.test.js.map +1 -1
  55. package/payload/platform/plugins/memory/mcp/dist/lib/relationship-patterns.d.ts +1 -1
  56. package/payload/platform/plugins/memory/mcp/dist/lib/relationship-patterns.js +1 -1
  57. package/payload/platform/plugins/memory/references/schema-construction.md +152 -57
  58. package/payload/platform/plugins/memory/references/schema-trades.md +22 -24
  59. package/payload/platform/scripts/lib/provision-account-dir.sh +22 -3
  60. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.d.ts.map +1 -1
  61. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js +46 -0
  62. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js.map +1 -1
  63. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
  64. package/payload/platform/services/claude-session-manager/dist/http-server.js +45 -1
  65. package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
  66. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts +11 -0
  67. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
  68. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +18 -0
  69. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
  70. package/payload/platform/services/claude-session-manager/dist/system-prompt.d.ts +1 -0
  71. package/payload/platform/services/claude-session-manager/dist/system-prompt.d.ts.map +1 -1
  72. package/payload/platform/services/claude-session-manager/dist/system-prompt.js +16 -0
  73. package/payload/platform/services/claude-session-manager/dist/system-prompt.js.map +1 -1
  74. package/payload/platform/templates/account-schema/SCHEMA.md +54 -0
  75. package/payload/server/public/assets/{AdminLoginScreens-B_5wYcR-.js → AdminLoginScreens-BEzoTk56.js} +1 -1
  76. package/payload/server/public/assets/{AdminShell-CMV3XY-s.js → AdminShell-BG7YD4UO.js} +1 -1
  77. package/payload/server/public/assets/{Checkbox-LplFUKpb.js → Checkbox-CvTFOczj.js} +1 -1
  78. package/payload/server/public/assets/{OperatorConversations-C4Cx814-.css → OperatorConversations-CnP9Y6g2.css} +1 -1
  79. package/payload/server/public/assets/{admin-3QQtd7j2.js → admin-Bhxa1HOy.js} +1 -1
  80. package/payload/server/public/assets/{browser-D5q26eZL.js → browser-BAQFuyma.js} +1 -1
  81. package/payload/server/public/assets/calendar-sSr6zUjW.js +1 -0
  82. package/payload/server/public/assets/chat-ZH4Fsyu0.js +1 -0
  83. package/payload/server/public/assets/data-CBrgiyPM.js +1 -0
  84. package/payload/server/public/assets/{graph-DFQbqmi9.js → graph-DbGjFYPS.js} +1 -1
  85. package/payload/server/public/assets/graph-labels-IGIEr-uc.js +1 -0
  86. package/payload/server/public/assets/{operator-BlCyq4q1.js → operator-Ba5afDyM.js} +1 -1
  87. package/payload/server/public/assets/{page-drg1V-yA.js → page-D7uwMUOy.js} +1 -1
  88. package/payload/server/public/assets/{public-BVjeYfsD.js → public-DikYWzOd.js} +1 -1
  89. package/payload/server/public/browser.html +4 -4
  90. package/payload/server/public/calendar.html +4 -4
  91. package/payload/server/public/chat.html +5 -5
  92. package/payload/server/public/data.html +4 -4
  93. package/payload/server/public/graph.html +6 -6
  94. package/payload/server/public/index.html +6 -6
  95. package/payload/server/public/operator.html +7 -7
  96. package/payload/server/public/public.html +5 -5
  97. package/payload/server/server.js +92 -31
  98. package/payload/server/public/assets/calendar-Csbdj7rp.js +0 -1
  99. package/payload/server/public/assets/chat-Ct86qtMI.js +0 -1
  100. package/payload/server/public/assets/data-HwT5wPmj.js +0 -1
  101. package/payload/server/public/assets/graph-labels-kCti2CaC.js +0 -1
  102. /package/payload/server/public/assets/{OperatorConversations-Bp-g80PM.js → OperatorConversations-DU8CqO-z.js} +0 -0
@@ -419,20 +419,28 @@ var require_dist2 = __commonJS({
419
419
  Property: "#5C7A99",
420
420
  Viewing: "#D4A574",
421
421
  Offer: "#B08850",
422
- // Construction ontology (Task 773; labels registered in schema.cypher by
423
- // Task 650). Muted brick-red family — the construction register sits
422
+ // JobLogic service-delivery ontology (Task 1084; supersedes the Task 650/773
423
+ // homegrown set). Muted brick-red / earthy family — the service register sits
424
424
  // apart from people-terracotta, viewing-amber, and task-rose bands so
425
425
  // sitedesk legends read as their own group. Top-level (operator-entry)
426
- // labels only; child labels (LineItem, Milestone, Valuation,
427
- // VariationNote, CheckIn) intentionally stay fallback-grey. The
428
- // field-worker Worker label is an additional label on Person and takes
429
- // the Person colour. A subcontractor company's received invoices use the
430
- // supplier model (Organization + InboundInvoice), so they carry no
431
- // construction-specific colour.
426
+ // labels only; child labels (QuoteLine, Milestone, Valuation, VariationNote,
427
+ // JobCost, Contact, PurchaseOrderLine, InvoiceLine, InvoicePayment, Credit)
428
+ // intentionally stay fallback-grey. :Engineer is an additional label on
429
+ // Person and takes the Person colour; :Supplier is an additional label on
430
+ // Organization and takes the tobacco Organization colour. All hexes here are
431
+ // pairwise-unique across the registry.
432
432
  Job: "#8C3B2E",
433
- QuoteDocument: "#A65A4A",
433
+ Quote: "#A65A4A",
434
+ Invoice: "#6E4A1F",
434
435
  InboundInvoice: "#6B2A20",
435
436
  WhatsAppGroup: "#D4A096",
437
+ Customer: "#B5503C",
438
+ Site: "#C56B4A",
439
+ Asset: "#9E4A35",
440
+ Visit: "#C77A4E",
441
+ Part: "#7A3326",
442
+ PurchaseOrder: "#B07050",
443
+ PpmContract: "#8A4A3A",
436
444
  // External business entity — schema:Organization, written by memory-write
437
445
  // as the Supplier label. Warm tobacco — distinct hue from internal-business
438
446
  // slates so external entities are scannable at a glance.
@@ -581,7 +589,7 @@ var require_dist2 = __commonJS({
581
589
  if (composed.length > 0) {
582
590
  return composed.length > 24 ? composed.slice(0, 24) + "\u2026" : composed;
583
591
  }
584
- } else if (primaryLabel2 === "QuoteDocument") {
592
+ } else if (primaryLabel2 === "Quote") {
585
593
  const ref = typeof props.ref === "string" ? props.ref : "";
586
594
  if (ref.length > 0) {
587
595
  return ref.length > 24 ? ref.slice(0, 24) + "\u2026" : ref;
@@ -657,7 +665,7 @@ var require_dist2 = __commonJS({
657
665
  const composed = [client, jobId.length > 0 ? `#${jobId}` : ""].filter((s) => s.length > 0).join(" ");
658
666
  if (composed.length > 0)
659
667
  return composed;
660
- } else if (primaryLabel2 === "QuoteDocument") {
668
+ } else if (primaryLabel2 === "Quote") {
661
669
  const ref = typeof props.ref === "string" ? props.ref : "";
662
670
  if (ref.length > 0)
663
671
  return ref;
@@ -892,10 +900,11 @@ var require_dist3 = __commonJS({
892
900
  "TimelineEvent",
893
901
  "Report",
894
902
  "FileArtifact",
895
- // Construction vertical (Task 652) — the four text-bearing labels.
903
+ // Construction vertical (Task 652; renamed Task 1084) — the four
904
+ // text-bearing labels: Job, the priced :QuoteLine, its :Quote, :VariationNote.
896
905
  "Job",
897
- "LineItem",
898
- "QuoteDocument",
906
+ "QuoteLine",
907
+ "Quote",
899
908
  "VariationNote",
900
909
  // Knowledge-work vertical — the seven gap labels, each carrying a
901
910
  // CREATE VECTOR INDEX in schema.cypher so the chokepoint auto-embeds them.
@@ -7245,6 +7254,7 @@ var CHANNEL_REPLY_TOOL = "mcp__channel__reply";
7245
7254
  var CHANNEL_REPLY_DOCUMENT_TOOL = "mcp__channel__reply-document";
7246
7255
  var SEND_USER_FILE_TOOL = "SendUserFile";
7247
7256
  var CLI_MARKER_PREFIXES2 = ["<local-command-", "<command-name>", "<command-message>"];
7257
+ var HARNESS_LIFECYCLE_PREFIXES = ["<task-notification>"];
7248
7258
  var CHANNEL_WRAPPER2 = /^<channel\b([^>]*)>\n?([\s\S]*?)\n?<\/channel>$/;
7249
7259
  var SOURCE_ATTR2 = /\bsource="([^"]+)"/;
7250
7260
  var SOURCE_MAP = {
@@ -7420,6 +7430,7 @@ function parseTranscript(lines, queuedPendingSuppress = /* @__PURE__ */ new Map(
7420
7430
  const text = asString(msg.content);
7421
7431
  if (text === null) continue;
7422
7432
  if (CLI_MARKER_PREFIXES2.some((p) => text.startsWith(p))) continue;
7433
+ if (HARNESS_LIFECYCLE_PREFIXES.some((p) => text.startsWith(p))) continue;
7423
7434
  const isChannel = row.isMeta === true && typeof row.origin === "object" && row.origin !== null && row.origin.kind === "channel";
7424
7435
  if (isChannel) {
7425
7436
  renderOrSuppressChannelInbound(unwrapChannel(text), ts, out, queuedPendingSuppress);
@@ -12709,7 +12720,7 @@ import { createReadStream as createReadStream2, createWriteStream as createWrite
12709
12720
  import { readdir as readdir3, readFile as readFile5, stat as stat5, mkdir as mkdir3, unlink as unlink2, rename } from "fs/promises";
12710
12721
  import { realpathSync as realpathSync6 } from "fs";
12711
12722
  import { randomUUID as randomUUID10 } from "crypto";
12712
- import { basename as basename8, dirname as dirname6, join as join25, resolve as resolve24, sep as sep6 } from "path";
12723
+ import { basename as basename8, dirname as dirname6, join as join25, relative as relative4, resolve as resolve24, sep as sep6 } from "path";
12713
12724
  import { Readable as Readable2 } from "stream";
12714
12725
 
12715
12726
  // ../lib/graph-trash/src/index.ts
@@ -13862,6 +13873,26 @@ app20.get("/download", requireAdminSession, async (c) => {
13862
13873
  });
13863
13874
  var ZIP_MAX_FILES = 200;
13864
13875
  var ZIP_MAX_TOTAL_BYTES = 256 * 1024 * 1024;
13876
+ function zipMaxFiles() {
13877
+ const override = Number(process.env.MAXY_ZIP_MAX_FILES);
13878
+ return Number.isFinite(override) && override > 0 ? override : ZIP_MAX_FILES;
13879
+ }
13880
+ function zipMaxTotalBytes() {
13881
+ const override = Number(process.env.MAXY_ZIP_MAX_TOTAL_BYTES);
13882
+ return Number.isFinite(override) && override > 0 ? override : ZIP_MAX_TOTAL_BYTES;
13883
+ }
13884
+ async function* walkRegularFiles(dirAbsolute) {
13885
+ const dirents = await readdir3(dirAbsolute, { withFileTypes: true });
13886
+ for (const d of dirents) {
13887
+ if (d.isSymbolicLink()) continue;
13888
+ const child = join25(dirAbsolute, d.name);
13889
+ if (d.isDirectory()) {
13890
+ yield* walkRegularFiles(child);
13891
+ continue;
13892
+ }
13893
+ if (d.isFile()) yield child;
13894
+ }
13895
+ }
13865
13896
  app20.get("/download-zip", requireAdminSession, async (c) => {
13866
13897
  const cacheKey = c.var.cacheKey;
13867
13898
  const accountId = getAccountIdForSession(cacheKey);
@@ -13871,11 +13902,21 @@ app20.get("/download-zip", requireAdminSession, async (c) => {
13871
13902
  }
13872
13903
  const rawPaths = c.req.queries("path") ?? [];
13873
13904
  if (rawPaths.length === 0) return c.json({ error: "path required" }, 400);
13874
- if (rawPaths.length > ZIP_MAX_FILES) {
13875
- return c.json({ error: `Too many files (max ${ZIP_MAX_FILES})` }, 413);
13905
+ const maxFiles = zipMaxFiles();
13906
+ const maxTotalBytes = zipMaxTotalBytes();
13907
+ if (rawPaths.length > maxFiles) {
13908
+ return c.json({ error: `Too many files (max ${maxFiles})` }, 413);
13876
13909
  }
13877
13910
  const entries = [];
13878
13911
  let total = 0;
13912
+ let dirsWalked = 0;
13913
+ const addFile = async (absolute, size, member) => {
13914
+ if (entries.length >= maxFiles) return c.json({ error: `Too many files (max ${maxFiles})` }, 413);
13915
+ total += size;
13916
+ if (total > maxTotalBytes) return c.json({ error: "Selection too large to zip" }, 413);
13917
+ entries.push({ name: member, data: await readFile5(absolute) });
13918
+ return null;
13919
+ };
13879
13920
  for (const rawPath of rawPaths) {
13880
13921
  const resolution = resolveDataPath(rawPath);
13881
13922
  if (!resolution.ok) {
@@ -13891,12 +13932,24 @@ app20.get("/download-zip", requireAdminSession, async (c) => {
13891
13932
  }
13892
13933
  try {
13893
13934
  const info = await stat5(absolute);
13894
- if (!info.isFile()) return c.json({ error: "Path is not a file" }, 400);
13895
- total += info.size;
13896
- if (total > ZIP_MAX_TOTAL_BYTES) {
13897
- return c.json({ error: "Selection too large to zip" }, 413);
13935
+ if (info.isDirectory()) {
13936
+ dirsWalked++;
13937
+ const parentAbs = dirname6(absolute);
13938
+ for await (const fileAbs of walkRegularFiles(absolute)) {
13939
+ const within = relative4(absolute, fileAbs).split(sep6).join("/");
13940
+ const fileRel = relPath === "" || relPath === "." ? within : `${relPath}/${within}`;
13941
+ if (crossesForeignAccountPartition(fileRel, accountId)) continue;
13942
+ const fileInfo = await stat5(fileAbs);
13943
+ const member = relative4(parentAbs, fileAbs).split(sep6).join("/");
13944
+ const over = await addFile(fileAbs, fileInfo.size, member);
13945
+ if (over) return over;
13946
+ }
13947
+ } else if (info.isFile()) {
13948
+ const over = await addFile(absolute, info.size, basename8(absolute));
13949
+ if (over) return over;
13950
+ } else {
13951
+ return c.json({ error: "Path is not a file or directory" }, 400);
13898
13952
  }
13899
- entries.push({ name: basename8(absolute), data: await readFile5(absolute) });
13900
13953
  } catch (err) {
13901
13954
  const code = err.code;
13902
13955
  if (code === "ENOENT") return c.json({ error: "Not found" }, 404);
@@ -13904,7 +13957,7 @@ app20.get("/download-zip", requireAdminSession, async (c) => {
13904
13957
  }
13905
13958
  }
13906
13959
  const archive = buildZip(entries);
13907
- console.error(`[data] file-download-zip files=${entries.length} bytes=${archive.length}`);
13960
+ console.error(`[data] file-download-zip dirs=${dirsWalked} files=${entries.length} bytes=${archive.length}`);
13908
13961
  return new Response(new Uint8Array(archive), {
13909
13962
  status: 200,
13910
13963
  headers: {
@@ -15178,9 +15231,17 @@ var FILTER_TOP_LEVEL_LABELS = Object.freeze(
15178
15231
  "Viewing",
15179
15232
  "Offer",
15180
15233
  "Job",
15181
- "QuoteDocument",
15234
+ "Quote",
15235
+ "Invoice",
15182
15236
  "InboundInvoice",
15183
15237
  "WhatsAppGroup",
15238
+ "Customer",
15239
+ "Site",
15240
+ "Asset",
15241
+ "Visit",
15242
+ "Part",
15243
+ "PurchaseOrder",
15244
+ "PpmContract",
15184
15245
  "AdminConversation",
15185
15246
  "PublicConversation",
15186
15247
  "Task",
@@ -16256,13 +16317,13 @@ var graph_default_view_default = app26;
16256
16317
 
16257
16318
  // server/routes/admin/sidebar-artefacts.ts
16258
16319
  import { readdir as readdir4, stat as stat6 } from "fs/promises";
16259
- import { resolve as resolve25, relative as relative4, isAbsolute as isAbsolute2, sep as sep7, basename as basename9 } from "path";
16320
+ import { resolve as resolve25, relative as relative5, isAbsolute as isAbsolute2, sep as sep7, basename as basename9 } from "path";
16260
16321
  import { existsSync as existsSync24 } from "fs";
16261
16322
  var LIMIT = 50;
16262
16323
  var ADMIN_AGENT_FILES = ["IDENTITY.md", "SOUL.md", "KNOWLEDGE.md"];
16263
16324
  function toDataRootRelPath(absPath) {
16264
16325
  if (absPath !== DATA_ROOT && !absPath.startsWith(DATA_ROOT + sep7)) return null;
16265
- return relative4(DATA_ROOT, absPath);
16326
+ return relative5(DATA_ROOT, absPath);
16266
16327
  }
16267
16328
  var app27 = new Hono();
16268
16329
  app27.get("/", requireAdminSession, async (c) => {
@@ -16426,7 +16487,7 @@ async function readAgentTemplateRow(inp) {
16426
16487
  }
16427
16488
  }
16428
16489
  function isWithin(target, root) {
16429
- const rel = relative4(root, target);
16490
+ const rel = relative5(root, target);
16430
16491
  return !rel.startsWith("..") && !isAbsolute2(rel);
16431
16492
  }
16432
16493
  var sidebar_artefacts_default = app27;
@@ -19573,7 +19634,7 @@ async function startFileWatcher(opts = {}) {
19573
19634
 
19574
19635
  // app/lib/migrate-uploads.ts
19575
19636
  import { mkdir as mkdir5, readdir as readdir5, rename as rename2, rm as rm3 } from "fs/promises";
19576
- import { dirname as dirname8, relative as relative5, resolve as resolve31 } from "path";
19637
+ import { dirname as dirname8, relative as relative6, resolve as resolve31 } from "path";
19577
19638
  var ACCOUNT_UUID_RE4 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
19578
19639
  async function walkFiles(dir) {
19579
19640
  const out = [];
@@ -19603,13 +19664,13 @@ async function relocateTree(srcDir, destDir, dataRoot, accountId, session) {
19603
19664
  const files = await walkFiles(srcDir);
19604
19665
  let moved = 0;
19605
19666
  for (const oldAbs of files) {
19606
- const suffix = relative5(srcDir, oldAbs);
19667
+ const suffix = relative6(srcDir, oldAbs);
19607
19668
  const newAbs = resolve31(destDir, suffix);
19608
19669
  await mkdir5(dirname8(newAbs), { recursive: true });
19609
19670
  await rename2(oldAbs, newAbs);
19610
19671
  moved++;
19611
- const oldRel = relative5(dataRoot, oldAbs);
19612
- const newRel = relative5(dataRoot, newAbs);
19672
+ const oldRel = relative6(dataRoot, oldAbs);
19673
+ const newRel = relative6(dataRoot, newAbs);
19613
19674
  let linked = false;
19614
19675
  if (accountId && session) {
19615
19676
  const fa = await session.run(
@@ -1 +0,0 @@
1
- import{o as e}from"./chunk-CAM3fms7.js";import{A as t,B as n,C as r,F as i,I as a,O as o,R as s,T as c,U as l,V as u,v as d,w as f}from"./OperatorConversations-Bp-g80PM.js";import{d as p,g as m,t as h}from"./AdminShell-CMV3XY-s.js";var g=s(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),_=s(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),v=s(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),y=s(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),b=s(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),x=s(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),S=u(),C=e(l(),1);function w(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function T(e,t){let n=new Date(e);return n.setDate(n.getDate()+t),n}function E(e){let t=w(e),n=t.getDay();return T(t,n===0?-6:1-n)}function D(e){let t=E(e);return Array.from({length:7},(e,n)=>T(t,n))}function O(e){let t=E(new Date(e.getFullYear(),e.getMonth(),1));return Array.from({length:42},(e,n)=>T(t,n))}function k(){return Array.from({length:24},(e,t)=>t)}function A(e){let t=e.getFullYear();return Array.from({length:12},(e,n)=>new Date(t,n,1))}function j(e,t){switch(e){case`day`:{let e=w(t);return{from:e,to:T(e,1)}}case`week`:{let e=E(t);return{from:e,to:T(e,7)}}case`month`:{let e=E(new Date(t.getFullYear(),t.getMonth(),1));return{from:e,to:T(e,42)}}case`year`:return{from:new Date(t.getFullYear(),0,1),to:new Date(t.getFullYear()+1,0,1)}}}function M(e,t,n){switch(e){case`day`:return T(t,n);case`week`:return T(t,n*7);case`month`:return new Date(t.getFullYear(),t.getMonth()+n,1);case`year`:return new Date(t.getFullYear()+n,t.getMonth(),1)}}function N(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function P(e,t){return{role:`button`,tabIndex:0,onClick:()=>t(e),onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),t(e))}}}var F=r(),ee=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],I=3;function L(e){return e.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function R({anchor:e,meetings:t,onSelect:n}){let r=O(e),i=e.getMonth(),a=new Date;return(0,F.jsxs)(`div`,{className:`cal-month`,children:[(0,F.jsx)(`div`,{className:`cal-weekday-row`,children:ee.map(e=>(0,F.jsx)(`div`,{className:`cal-weekday`,children:e},e))}),(0,F.jsx)(`div`,{className:`cal-month-grid`,children:r.map(e=>{let r=t.filter(t=>N(new Date(t.startsAt),e)).sort((e,t)=>e.startsAt.localeCompare(t.startsAt)),o=e.getMonth()!==i,s=N(e,a);return(0,F.jsxs)(`div`,{className:`cal-cell${o?` cal-cell-out`:``}${s?` cal-cell-today`:``}`,children:[(0,F.jsx)(`div`,{className:`cal-cell-num`,children:e.getDate()}),r.slice(0,I).map(e=>(0,F.jsxs)(`div`,{className:`cal-chip`,title:e.title??`Untitled`,...P(e,n),children:[!e.isAllDay&&(0,F.jsx)(`span`,{className:`cal-chip-time`,children:L(new Date(e.startsAt))}),e.title??`Untitled`]},e.meetingId)),r.length>I&&(0,F.jsxs)(`div`,{className:`cal-more`,children:[`+`,r.length-I,` more`]})]},e.toISOString())})})]})}var z=1440,B=1.8;function V(e){return e.getHours()*60+e.getMinutes()}function H(e){return e.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function U({day:e,meetings:t,hourHeight:n,onSelect:r}){let i=n*24,a=t.filter(t=>!t.isAllDay&&N(new Date(t.startsAt),e));return(0,F.jsx)(`div`,{className:`cal-day-col`,children:(0,F.jsxs)(`div`,{className:`cal-hours`,style:{height:`${i}px`},children:[Array.from({length:24},(e,t)=>(0,F.jsx)(`div`,{className:`cal-hour-line`,style:{top:`${t*n}px`}},t)),a.map(t=>{let n=new Date(t.startsAt),i=t.endsAt?new Date(t.endsAt):new Date(n.getTime()+30*6e4),a=V(n),o=N(i,e)?V(i):z,s=a/z*100,c=Math.max((o-a)/z*100,B);return(0,F.jsxs)(`div`,{className:`cal-event`,style:{top:`${s}%`,height:`${c}%`},title:t.title??`Untitled`,...P(t,r),children:[(0,F.jsx)(`span`,{className:`cal-event-time`,children:H(n)}),(0,F.jsx)(`span`,{className:`cal-event-title`,children:t.title??`Untitled`})]},t.meetingId)})]})})}var W=44;function G(e){let t=new Date;return t.setHours(e,0,0,0),t.toLocaleTimeString([],{hour:`numeric`})}function K({anchor:e,meetings:t,onSelect:n}){let r=D(e),i=new Date;return(0,F.jsxs)(`div`,{className:`cal-timed`,children:[(0,F.jsxs)(`div`,{className:`cal-day-headrow`,children:[(0,F.jsx)(`div`,{className:`cal-timed-gutter`}),r.map(e=>(0,F.jsxs)(`div`,{className:`cal-day-head${N(e,i)?` cal-day-head-today`:``}`,children:[(0,F.jsx)(`span`,{className:`cal-day-head-name`,children:e.toLocaleDateString([],{weekday:`short`})}),(0,F.jsx)(`span`,{className:`cal-day-head-num`,children:e.getDate()})]},e.toISOString()))]}),(0,F.jsxs)(`div`,{className:`cal-allday-band`,children:[(0,F.jsx)(`div`,{className:`cal-timed-gutter`,children:`All-day`}),r.map(e=>(0,F.jsx)(`div`,{className:`cal-allday-cell`,children:t.filter(t=>t.isAllDay&&N(new Date(t.startsAt),e)).map(e=>(0,F.jsx)(`div`,{className:`cal-allday-chip`,title:e.title??`Untitled`,...P(e,n),children:e.title??`Untitled`},e.meetingId))},e.toISOString()))]}),(0,F.jsxs)(`div`,{className:`cal-timed-cols`,children:[(0,F.jsx)(`div`,{className:`cal-timed-gutter`,children:k().map(e=>(0,F.jsx)(`div`,{className:`cal-hour-label`,style:{height:`${W}px`},children:e===0?``:G(e)},e))}),r.map(e=>(0,F.jsx)(U,{day:e,meetings:t,hourHeight:W,onSelect:n},e.toISOString()))]})]})}var q=52;function J(e){let t=new Date;return t.setHours(e,0,0,0),t.toLocaleTimeString([],{hour:`numeric`})}function Y({anchor:e,meetings:t,onSelect:n}){let r=t.filter(t=>t.isAllDay&&N(new Date(t.startsAt),e));return(0,F.jsxs)(`div`,{className:`cal-timed cal-timed-single`,children:[(0,F.jsxs)(`div`,{className:`cal-allday-band`,children:[(0,F.jsx)(`div`,{className:`cal-timed-gutter`,children:`All-day`}),(0,F.jsx)(`div`,{className:`cal-allday-cell`,children:r.map(e=>(0,F.jsx)(`div`,{className:`cal-allday-chip`,title:e.title??`Untitled`,...P(e,n),children:e.title??`Untitled`},e.meetingId))})]}),(0,F.jsxs)(`div`,{className:`cal-timed-cols`,children:[(0,F.jsx)(`div`,{className:`cal-timed-gutter`,children:k().map(e=>(0,F.jsx)(`div`,{className:`cal-hour-label`,style:{height:`${q}px`},children:e===0?``:J(e)},e))}),(0,F.jsx)(U,{day:e,meetings:t,hourHeight:q,onSelect:n})]})]})}var X=[`M`,`T`,`W`,`T`,`F`,`S`,`S`];function Z(e){return`${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`}function te({anchor:e,meetings:t,onPickMonth:n}){let r=new Date,i=new Set(t.map(e=>Z(new Date(e.startsAt))));return(0,F.jsx)(`div`,{className:`cal-year`,children:(0,F.jsx)(`div`,{className:`cal-year-grid`,children:A(e).map(e=>{let t=O(e),a=e.getMonth();return(0,F.jsxs)(`button`,{type:`button`,className:`cal-mini`,onClick:()=>n(e),title:e.toLocaleDateString([],{month:`long`,year:`numeric`}),children:[(0,F.jsx)(`div`,{className:`cal-mini-title`,children:e.toLocaleDateString([],{month:`long`})}),(0,F.jsx)(`div`,{className:`cal-mini-weekrow`,children:X.map((e,t)=>(0,F.jsx)(`span`,{className:`cal-mini-weekday`,children:e},t))}),(0,F.jsx)(`div`,{className:`cal-mini-grid`,children:t.map(e=>{let t=e.getMonth()!==a,n=N(e,r),o=!t&&i.has(Z(e));return(0,F.jsxs)(`span`,{className:`cal-mini-day${t?` cal-mini-day-out`:``}${n?` cal-mini-day-today`:``}`,children:[e.getDate(),o&&(0,F.jsx)(`span`,{className:`cal-mini-dot`})]},e.toISOString())})})]},a)})})})}var ne={meeting:`Meeting`,event:`Event`,task:`Task`};function re(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function ie(e){return new Date(e).toISOString()}function Q(e){return Math.floor(new Date(e).getTime()/6e4)}function ae(e){let t=new Date(e.startsAt);if(e.isAllDay)return t.toLocaleDateString([],{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`});let n=t.toLocaleDateString([],{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`}),r=t.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`});return e.endsAt?`${n} · ${r} – ${new Date(e.endsAt).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}`:`${n} · ${r}`}function oe(e){if(!e)return null;let t=e.match(/filename="([^"]+)"/);return t?t[1]:null}function se(e,t){return e.email??`${e.name??`unknown`}-${t}`}function ce({a:e}){let t=e.name||e.email||`Unknown`,n=e.name&&e.email?e.email:null;return(0,F.jsxs)(`span`,{className:`cal-attendee-lines`,children:[(0,F.jsx)(`span`,{className:`cal-attendee-name`,children:t}),n&&(0,F.jsx)(`span`,{className:`cal-attendee-email`,children:n})]})}function le({meeting:e,adminFetch:n,onClose:r,onSaved:a,onDeleted:s}){let l=e.kind===`meeting`,[u,d]=(0,C.useState)(!1),[m,h]=(0,C.useState)(!1),[_,S]=(0,C.useState)(!1),[w,T]=(0,C.useState)(null),[E,D]=(0,C.useState)(e),[O,k]=(0,C.useState)(e.title??``),[A,j]=(0,C.useState)(re(e.startsAt)),[M,N]=(0,C.useState)(e.endsAt?re(e.endsAt):``),[P,ee]=(0,C.useState)(e.location??``),[I,L]=(0,C.useState)(e.privateNote??``),[R,z]=(0,C.useState)(``),[B,V]=(0,C.useState)(``),[H,U]=(0,C.useState)(!1);(0,C.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!_&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[_,r]);let W=(0,C.useCallback)(()=>{let e={},t=O.trim();t!==(E.title??``)&&(e.title=t);let n=ie(A);Q(n)!==Q(E.startsAt)&&(e.startsAt=n);let r=M?ie(M):null;(r===null?E.endsAt!==null:E.endsAt===null||Q(r)!==Q(E.endsAt))&&(e.endsAt=r);let i=P.trim()||null;i!==(E.location??null)&&(e.location=i);let a=I.trim()||null;return a!==(E.privateNote??null)&&(e.privateNote=a),e},[O,A,M,P,I,E]),G=(0,C.useCallback)(async()=>{let t=W();if(Object.keys(t).length===0){d(!1);return}S(!0),T(null);try{let r=await n(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});if(!r.ok)throw Error(`HTTP ${r.status}`);let i=await r.json();D(i.meeting),a(i.meeting),d(!1)}catch(e){T(e instanceof Error?e.message:`Save failed`)}finally{S(!1)}},[n,W,e.meetingId,a]),K=(0,C.useCallback)(async()=>{let t=R.trim(),r=B.trim();if(!(!t&&!r)){S(!0),T(null);try{let i=await n(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}/attendees`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:t||void 0,email:r||void 0})});if(!i.ok)throw Error(`HTTP ${i.status}`);let o=await i.json();D(o.meeting),a(o.meeting),z(``),V(``)}catch(e){T(e instanceof Error?e.message:`Add failed`)}finally{S(!1)}}},[n,R,B,e.meetingId,a]),q=(0,C.useCallback)(async t=>{let r=t.email?{email:t.email}:{name:t.name};S(!0),T(null);try{let t=await n(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}/attendees`,{method:`DELETE`,headers:{"content-type":`application/json`},body:JSON.stringify(r)});if(!t.ok)throw Error(`HTTP ${t.status}`);let i=await t.json();D(i.meeting),a(i.meeting)}catch(e){T(e instanceof Error?e.message:`Remove failed`)}finally{S(!1)}},[n,e.meetingId,a]),J=(0,C.useCallback)(async()=>{S(!0),T(null);try{let t=await n(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}`,{method:`DELETE`});if(!t.ok)throw Error(`HTTP ${t.status}`);s(e.meetingId)}catch(e){T(e instanceof Error?e.message:`Delete failed`),S(!1)}},[n,e.meetingId,s]),Y=(0,C.useCallback)(async()=>{S(!0),T(null);try{let t=await n(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}/ics?attendees=${H?`1`:`0`}`);if(!t.ok)throw Error(`HTTP ${t.status}`);let r=await t.blob(),i=oe(t.headers.get(`content-disposition`))??`meeting.ics`,a=URL.createObjectURL(r),o=document.createElement(`a`);o.href=a,o.download=i,document.body.appendChild(o),o.click(),o.remove(),URL.revokeObjectURL(a)}catch(e){T(e instanceof Error?e.message:`Download failed`)}finally{S(!1)}},[n,H,e.meetingId]),X=ne[e.kind??`meeting`],Z=R.trim().length>0||B.trim().length>0;return(0,F.jsx)(`div`,{className:`cal-modal-overlay`,onClick:()=>{_||r()},children:(0,F.jsxs)(`div`,{className:`cal-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":u?`Edit meeting`:`Meeting detail`,onClick:e=>e.stopPropagation(),children:[(0,F.jsxs)(`div`,{className:`cal-modal-header`,children:[(0,F.jsx)(`span`,{className:`cal-modal-kind`,children:X}),(0,F.jsx)(`button`,{type:`button`,className:`cal-modal-close`,onClick:r,"aria-label":`Close`,autoFocus:!0,disabled:_,children:(0,F.jsx)(f,{size:16})})]}),!u&&(0,F.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,F.jsx)(`div`,{className:`cal-modal-title`,children:E.title??`Untitled`}),(0,F.jsxs)(`div`,{className:`cal-modal-row`,children:[(0,F.jsx)(v,{size:14}),(0,F.jsx)(`span`,{children:ae(E)})]}),E.location&&(0,F.jsxs)(`div`,{className:`cal-modal-row`,children:[(0,F.jsx)(y,{size:14}),(0,F.jsx)(`span`,{children:E.location})]}),E.attendees.length>0&&(0,F.jsxs)(`div`,{className:`cal-modal-row cal-modal-row-top`,children:[(0,F.jsx)(p,{size:14}),(0,F.jsx)(`div`,{className:`cal-modal-attendees`,children:E.attendees.map((e,t)=>(0,F.jsx)(`div`,{className:`cal-attendee-row`,children:(0,F.jsx)(ce,{a:e})},se(e,t)))})]}),E.privateNote&&(0,F.jsxs)(`div`,{className:`cal-modal-row cal-modal-row-top`,children:[(0,F.jsx)(b,{size:14}),(0,F.jsx)(`span`,{className:`cal-modal-note`,children:E.privateNote})]}),(0,F.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,F.jsx)(g,{size:14}),(0,F.jsx)(`span`,{children:X})]})]}),u&&(0,F.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,F.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,F.jsx)(`span`,{children:`Title`}),(0,F.jsx)(`input`,{type:`text`,value:O,onChange:e=>k(e.target.value),disabled:_})]}),(0,F.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,F.jsx)(`span`,{children:`Start`}),(0,F.jsx)(`input`,{type:`datetime-local`,value:A,onChange:e=>j(e.target.value),disabled:_})]}),(0,F.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,F.jsx)(`span`,{children:`End`}),(0,F.jsx)(`input`,{type:`datetime-local`,value:M,onChange:e=>N(e.target.value),disabled:_})]}),(0,F.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,F.jsx)(`span`,{children:`Location`}),(0,F.jsx)(`input`,{type:`text`,value:P,onChange:e=>ee(e.target.value),disabled:_})]}),(0,F.jsxs)(`div`,{className:`cal-modal-field`,children:[(0,F.jsx)(`span`,{children:`Attendees`}),(0,F.jsxs)(`div`,{className:`cal-modal-attendees cal-modal-attendees-edit`,children:[E.attendees.length===0&&(0,F.jsx)(`div`,{className:`cal-attendee-empty`,children:`No attendees yet.`}),E.attendees.map((e,t)=>(0,F.jsxs)(`div`,{className:`cal-attendee-row cal-attendee-row-edit`,children:[(0,F.jsx)(ce,{a:e}),(0,F.jsx)(`button`,{type:`button`,className:`cal-attendee-remove`,onClick:()=>q(e),disabled:_,"aria-label":`Remove ${e.name||e.email||`attendee`}`,children:(0,F.jsx)(f,{size:13})})]},se(e,t)))]}),(0,F.jsxs)(`div`,{className:`cal-attendee-add`,children:[(0,F.jsx)(`input`,{type:`text`,placeholder:`Name`,value:R,onChange:e=>z(e.target.value),disabled:_,"aria-label":`Attendee name`}),(0,F.jsx)(`input`,{type:`email`,placeholder:`Email`,value:B,onChange:e=>V(e.target.value),disabled:_,"aria-label":`Attendee email`}),(0,F.jsx)(`button`,{type:`button`,className:`cal-modal-btn cal-attendee-add-btn`,onClick:K,disabled:_||!Z,"aria-label":`Add attendee`,children:_?(0,F.jsx)(t,{size:13,className:`spin`}):(0,F.jsx)(x,{size:13})})]})]}),(0,F.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,F.jsx)(`span`,{children:`Private note`}),(0,F.jsx)(`textarea`,{className:`cal-modal-textarea`,value:I,onChange:e=>L(e.target.value),disabled:_,rows:3,placeholder:`Only you and your team can see this.`})]})]}),w&&(0,F.jsx)(`div`,{className:`cal-modal-error`,children:w}),l&&(0,F.jsxs)(`div`,{className:`cal-modal-actions`,children:[!u&&!m&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>d(!0),disabled:_,children:[(0,F.jsx)(o,{size:14}),` Edit`]}),(0,F.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:()=>h(!0),disabled:_,children:[(0,F.jsx)(c,{size:14}),` Delete`]}),(0,F.jsxs)(`div`,{className:`cal-modal-download-group`,children:[(0,F.jsxs)(`label`,{className:`cal-modal-toggle`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>U(e.target.checked),disabled:_}),(0,F.jsx)(`span`,{children:`Include attendees`})]}),(0,F.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:Y,disabled:_,children:[_?(0,F.jsx)(t,{size:14,className:`spin`}):(0,F.jsx)(i,{size:14}),` Download`]})]})]}),u&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-primary`,onClick:G,disabled:_,children:[_?(0,F.jsx)(t,{size:14,className:`spin`}):null,` Save`]}),(0,F.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>{d(!1),T(null)},disabled:_,children:`Cancel`})]}),m&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{className:`cal-modal-confirm-text`,children:`Delete this meeting?`}),(0,F.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:J,disabled:_,children:[_?(0,F.jsx)(t,{size:14,className:`spin`}):null,` Delete`]}),(0,F.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>h(!1),disabled:_,children:`Cancel`})]})]})]})})}var $=`maxy-admin-session-key`,ue=[`day`,`week`,`month`,`year`];function de(e,t){switch(e){case`day`:return t.toLocaleDateString([],{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`});case`week`:{let{from:e,to:n}=j(`week`,t),r=new Date(n.getTime()-1);return`${e.toLocaleDateString([],{day:`numeric`,month:`short`})} – ${r.toLocaleDateString([],{day:`numeric`,month:`short`,year:`numeric`})}`}case`month`:return t.toLocaleDateString([],{month:`long`,year:`numeric`});case`year`:return String(t.getFullYear())}}function fe(){let[e,n]=(0,C.useState)(null),[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(void 0),[s,c]=(0,C.useState)(null),[l,u]=(0,C.useState)(void 0),[f,p]=(0,C.useState)(null),[g,_]=(0,C.useState)(null);(0,C.useEffect)(()=>{let e=!1,t=null;try{t=sessionStorage.getItem($)}catch{}if(!t){i(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(t)}`).then(async r=>{if(!e){if(r.status===401){try{sessionStorage.removeItem($)}catch{}window.location.href=`/`;return}if(r.ok)try{let e=await r.json();typeof e.businessName==`string`&&o(e.businessName),e.sessionId!==void 0&&c(e.sessionId??null),_(e.role??null),u(e.userName===void 0?null:e.userName),p(e.avatar??null)}catch{}n(t),i(!0)}}).catch(()=>{e||(n(t),i(!0))}),()=>{e=!0}},[]);let v=(0,C.useCallback)(()=>{try{sessionStorage.removeItem($)}catch{}window.location.href=`/`},[]),[y,b]=(0,C.useState)(!1),x=(0,C.useCallback)(async()=>{b(!0);try{let e=await m();if(e){try{sessionStorage.removeItem($)}catch{}window.location.href=`/`}return e}finally{b(!1)}},[]);return r?e?(0,F.jsx)(d,{cacheKey:e,surface:`calendar`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=calendar`);try{sessionStorage.removeItem($)}catch{}window.location.href=`/`},children:(0,F.jsx)(h,{cacheKey:e,businessName:a,sessionId:s,onLogout:v,onDisconnect:x,disconnecting:y,userName:l,userAvatar:f,role:g,children:(0,F.jsx)(pe,{cacheKey:e})})}):(0,F.jsx)(`div`,{className:`cal-page`,children:(0,F.jsxs)(`div`,{className:`cal-empty`,children:[(0,F.jsx)(`p`,{children:`You are not signed in.`}),(0,F.jsxs)(`p`,{children:[`Open the `,(0,F.jsx)(`a`,{href:`/`,className:`cal-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,F.jsx)(`div`,{className:`cal-page`,children:(0,F.jsxs)(`div`,{className:`cal-loading`,children:[(0,F.jsx)(t,{size:18,className:`spin`}),` Loading…`]})})}function pe({cacheKey:e}){let{adminFetch:r,sessionRefetchNonce:i}=n({initialCacheKey:e,surface:`calendar`}),[o,s]=(0,C.useState)(`month`),[c,l]=(0,C.useState)(()=>new Date),[u,d]=(0,C.useState)([]),[f,p]=(0,C.useState)(!1),[m,h]=(0,C.useState)(null),[v,y]=(0,C.useState)(null);(0,C.useEffect)(()=>{let e=!1,{from:t,to:n}=j(o,c);return p(!0),h(null),r(`/api/admin/calendar/meetings?from=${encodeURIComponent(t.toISOString())}&to=${encodeURIComponent(n.toISOString())}`).then(async t=>{if(e)return;if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();d(Array.isArray(n.meetings)?n.meetings:[])}).catch(t=>{e||(h(t instanceof Error?t.message:`Failed to load`),d([]))}).finally(()=>{e||p(!1)}),()=>{e=!0}},[o,c,i,r]);let b=(0,C.useCallback)(()=>l(new Date),[]),x=(0,C.useCallback)(()=>l(e=>M(o,e,-1)),[o]),S=(0,C.useCallback)(()=>l(e=>M(o,e,1)),[o]),w=(0,C.useCallback)(e=>{l(e),s(`month`)},[]);(0,C.useEffect)(()=>{y(null)},[o,c]);let T=(0,C.useCallback)(e=>{d(t=>t.map(t=>t.meetingId===e.meetingId?e:t)),y(e)},[]),E=(0,C.useCallback)(e=>{d(t=>t.filter(t=>t.meetingId!==e)),y(null)},[]);return(0,F.jsxs)(`div`,{className:`cal-page`,children:[(0,F.jsxs)(`header`,{className:`cal-header`,children:[(0,F.jsxs)(`div`,{className:`cal-title`,children:[(0,F.jsx)(g,{size:20}),` Calendar`]}),(0,F.jsxs)(`div`,{className:`cal-nav`,children:[(0,F.jsx)(`button`,{type:`button`,className:`cal-today-btn`,onClick:b,children:`Today`}),(0,F.jsx)(`button`,{type:`button`,className:`cal-nav-btn`,onClick:x,"aria-label":`Previous`,children:(0,F.jsx)(a,{size:18})}),(0,F.jsx)(`button`,{type:`button`,className:`cal-nav-btn`,onClick:S,"aria-label":`Next`,children:(0,F.jsx)(_,{size:18})}),(0,F.jsx)(`span`,{className:`cal-range-label`,children:de(o,c)}),f&&(0,F.jsx)(t,{size:16,className:`spin`})]}),(0,F.jsx)(`div`,{className:`cal-views`,children:ue.map(e=>(0,F.jsx)(`button`,{type:`button`,className:`cal-view-btn${e===o?` cal-view-btn-active`:``}`,onClick:()=>s(e),children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,F.jsxs)(`div`,{className:`cal-body`,children:[m&&(0,F.jsxs)(`div`,{className:`cal-error`,children:[`Could not load the calendar: `,m]}),o===`day`&&(0,F.jsx)(Y,{anchor:c,meetings:u,onSelect:y}),o===`week`&&(0,F.jsx)(K,{anchor:c,meetings:u,onSelect:y}),o===`month`&&(0,F.jsx)(R,{anchor:c,meetings:u,onSelect:y}),o===`year`&&(0,F.jsx)(te,{anchor:c,meetings:u,onPickMonth:w})]}),v&&(0,F.jsx)(le,{meeting:v,adminFetch:r,onClose:()=>y(null),onSaved:T,onDeleted:E})]})}(0,S.createRoot)(document.getElementById(`root`)).render((0,F.jsx)(fe,{}));
@@ -1 +0,0 @@
1
- import{C as e,V as t}from"./OperatorConversations-Bp-g80PM.js";import"./admin-types-Dg11L4MQ.js";import"./AdminShell-CMV3XY-s.js";import{n}from"./page-drg1V-yA.js";var r=t(),i=e();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
@@ -1 +0,0 @@
1
- import{o as e}from"./chunk-CAM3fms7.js";import{A as t,B as n,C as r,D as i,E as a,F as o,M as s,O as c,P as ee,R as l,T as te,U as u,V as d,_ as ne,d as f,f as p,p as re,t as ie,v as m,w as ae}from"./OperatorConversations-Bp-g80PM.js";import{i as oe,t as se}from"./graph-labels-kCti2CaC.js";var ce=l(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),le=l(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),ue=l(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),de=l(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),fe=l(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),pe=l(`mouse-pointer-click`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),me=l(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),h=d(),g=e(u(),1);function he(e){let t=new Set,n=[];for(let r of e)for(let e of r.labels)e&&(t.has(e)||se.has(e)&&(t.add(e),n.push(e)));return n}var _=r(),ge=/\.(png|jpe?g|gif|webp|svg)$/i;function _e(e){return ge.test(e)}var ve=`maxy-data-view`;function ye(){return typeof window>`u`?`list`:window.localStorage.getItem(ve)===`grid`?`grid`:`list`}function be(){let[e,n]=(0,g.useState)(null),[r,i]=(0,g.useState)(!1);return(0,g.useEffect)(()=>{let e=!1,t=null;try{t=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!t){n(null),i(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(t)}`).then(r=>{if(!e){if(r.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`;return}n(t),i(!0)}}).catch(()=>{e||(n(t),i(!0))}),()=>{e=!0}},[]),r?e?(0,_.jsx)(m,{cacheKey:e,surface:`data`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=data`);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},children:(0,_.jsx)(`div`,{className:`data-page data-page-full`,children:(0,_.jsx)(xe,{cacheKey:e})})}):(0,_.jsx)(`div`,{className:`data-page`,children:(0,_.jsxs)(`div`,{className:`data-empty`,children:[(0,_.jsx)(`p`,{children:`You are not signed in.`}),(0,_.jsxs)(`p`,{children:[`Open the `,(0,_.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,_.jsx)(`div`,{className:`data-page`,children:(0,_.jsxs)(`div`,{className:`data-loading`,children:[(0,_.jsx)(t,{size:18,className:`spin`}),` Loading…`]})})}function xe({cacheKey:e}){let{adminFetch:t,cacheKey:r,sessionRefetchNonce:i}=n({initialCacheKey:e,surface:`data`});return(0,_.jsx)(y,{adminFetch:t,cacheKey:r,sessionRefetchNonce:i})}function Se(){if(typeof window>`u`)return`.`;let e=new URLSearchParams(window.location.hash.replace(/^#/,``)).get(`path`);return e&&e.length>0?e:`.`}function Ce(e){if(typeof window>`u`)return;let t=new URL(window.location.href);t.hash=e===`.`?``:`path=${encodeURIComponent(e)}`,window.history.replaceState(window.history.state,``,t.toString())}function v(e){return new Promise((t,n)=>{let r=[],i=()=>e.readEntries(e=>{e.length===0?t(r):(r.push(...e),i())},n);i()})}function we(e){return new Promise((t,n)=>e.file(t,n))}async function Te(e,t=``){let n=[];for(let r of e){if(!r)continue;let e=t?`${t}/${r.name}`:r.name;if(r.isFile)n.push({file:await we(r),relpath:e});else if(r.isDirectory){let t=await v(r.createReader());n.push(...await Te(t,e))}}return n}function Ee(e,t){if(e===422&&typeof t==`string`){if(/exceeds the .* limit/i.test(t))return`size`;if(/unsupported file type/i.test(t))return`mime`}return`http=${e}`}function y({adminFetch:e,cacheKey:n,sessionRefetchNonce:r}){let[l,u]=(0,g.useState)(``),d=(0,g.useRef)(null),[m,se]=(0,g.useState)(``),[h,ge]=(0,g.useState)(null),[be,xe]=(0,g.useState)(`hybrid`),[v,we]=(0,g.useState)(!1),[y,b]=(0,g.useState)(null),[x,ke]=(0,g.useState)(null),[Me,Ne]=(0,g.useState)(0),[S,Pe]=(0,g.useState)(!1),[C,Fe]=(0,g.useState)(()=>Se()),[w,Ie]=(0,g.useState)(null),[T,Le]=(0,g.useState)(()=>ye()),[E,Re]=(0,g.useState)(null),[D,ze]=(0,g.useState)([]),[O,Be]=(0,g.useState)(!1),[Ve,He]=(0,g.useState)(null),[Ue,k]=(0,g.useState)(!1),[A,j]=(0,g.useState)(null),[We,M]=(0,g.useState)(null),[Ge,Ke]=(0,g.useState)(null),[qe,Je]=(0,g.useState)(!1),[Ye,Xe]=(0,g.useState)(null),N=(0,g.useRef)(null),[Ze,P]=(0,g.useState)(0),[Qe,F]=(0,g.useState)(!1),[$e,et]=(0,g.useState)(``),[I,L]=(0,g.useState)(null),[tt,nt]=(0,g.useState)(``),[rt,R]=(0,g.useState)(null),z=(()=>{let e=C===`.`?[]:C.split(`/`).filter(Boolean);return e.length>=2&&e[0]===`accounts`})();(0,g.useEffect)(()=>{console.info(`[data-ui] op=mount header=operator home=absent`)},[]);let it=(0,g.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]),at=(0,g.useCallback)(e=>{e===`chat`&&(window.location.href=`/`)},[]),[B,ot]=(0,g.useState)([]),[st,ct]=(0,g.useState)(`files`);(0,g.useEffect)(()=>{if(!n)return;let e=!1;return fetch(`/api/whatsapp-reader/conversations?session_key=${encodeURIComponent(n)}`).then(e=>e.ok?e.json():{conversations:[]}).then(t=>{e||ot(t.conversations??[])}).catch(()=>{}),()=>{e=!0}},[n]);let lt=(0,g.useMemo)(()=>[...new Set(B.map(e=>e.channel))],[B]),[ut,dt]=(0,g.useState)(!1),ft=(0,g.useRef)(null),[pt,V]=(0,g.useState)(!1),mt=(0,g.useRef)(null);(0,g.useEffect)(()=>{let e=l.trim();if(!e){se(``),ge(null),b(null);return}Pe(!1);let t=setTimeout(()=>se(e),300);return()=>clearTimeout(t)},[l]),(0,g.useEffect)(()=>{if(!m){we(!1);return}let t=!1;return we(!0),b(null),e(`/api/admin/graph-search?q=${encodeURIComponent(m)}&labels=FileArtifact&limit=20${S?`&threshold=0`:``}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(ge(e.results),xe(e.mode??`hybrid`),Ne(typeof e.suppressed==`number`?e.suppressed:0))}).catch(e=>{t||b(e instanceof Error?e.message:String(e))}).finally(()=>{t||we(!1)}),()=>{t=!0}},[m,e,r,S]);let ht=(0,g.useMemo)(()=>h?he(h):[],[h]),H=x&&ht.includes(x)?x:null,gt=(0,g.useMemo)(()=>h?H?h.filter(e=>e.labels.includes(H)):h:null,[h,H]),_t=(0,g.useCallback)(e=>{let t=e.properties.relativePath;if(typeof t!=`string`||t.length===0)return;let r=`/api/admin/files/download?session_key=${encodeURIComponent(n)}&path=${encodeURIComponent(t)}`,i=document.createElement(`a`);i.href=r,i.rel=`noopener noreferrer`,document.body.appendChild(i),i.click(),i.remove()},[n]);(0,g.useEffect)(()=>{if(!h)return;let e=h.filter(e=>{let t=e.properties.relativePath;return typeof t!=`string`||t.length===0});e.length>0&&console.warn(`[data-search] op=locate-link-missing nodeId=${e.map(e=>e.nodeId).join(`,`)}`)},[h]),(0,g.useEffect)(()=>{let t=!1;return Be(!0),He(null),e(`/api/admin/files?path=${encodeURIComponent(C===`.`?``:C)}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(Ie(e.entries),ze(e.displayPath??[]))}).catch(e=>{t||(Ie([]),ze([]),He(e instanceof Error?e.message:String(e)))}).finally(()=>{t||Be(!1)}),()=>{t=!0}},[e,C,Ze,r]),(0,g.useEffect)(()=>{Ce(C)},[C]);let vt=(0,g.useCallback)(()=>{P(e=>e+1)},[]),U=(0,g.useCallback)(e=>{dt(!1),Fe(e)},[]),yt=(0,g.useCallback)(e=>{let t=e.properties.relativePath;if(typeof t!=`string`||t.length===0)return;let n=t.lastIndexOf(`/`),r=n===-1?`.`:t.slice(0,n);console.log(`[data-search] op=locate nodeId=${e.nodeId} folder=${r}`),u(``),b(null),ke(null),U(r)},[U]),bt=(0,g.useCallback)(()=>{if(C===`.`||C===``)return;let e=C.split(`/`).filter(Boolean);e.pop(),Fe(e.length===0?`.`:e.join(`/`))},[C]),xt=(0,g.useCallback)(e=>{p(n,C===`.`?e.name:`${C}/${e.name}`)},[C,n]),[W,St]=(0,g.useState)(!1),[G,Ct]=(0,g.useState)(new Set),wt=(0,g.useRef)(null),K=(0,g.useRef)(!1),q=typeof navigator<`u`&&typeof navigator.share==`function`&&typeof navigator.canShare==`function`,Tt=(0,g.useCallback)(e=>{St(!0),Ct(new Set([e])),console.info(`[data-ui] op=select-enter count=1`)},[]),J=(0,g.useCallback)(e=>{St(!1),Ct(new Set),console.info(`[data-ui] op=select-exit reason=${e}`)},[]),Y=(0,g.useCallback)(e=>{Ct(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Et=(0,g.useCallback)(e=>{K.current=!1,wt.current=setTimeout(()=>{K.current=!0,Tt(e)},500)},[Tt]),X=(0,g.useCallback)(()=>{wt.current&&=(clearTimeout(wt.current),null)},[]),Dt=(0,g.useCallback)(e=>{if(K.current){K.current=!1;return}if(W){Y(e.name);return}xt(e)},[W,Y,xt]),Ot=(0,g.useCallback)(e=>{Le(e),typeof window<`u`&&window.localStorage.setItem(ve,e),console.info(`[data] op=view-mode mode=${e}`)},[]),kt=(0,g.useCallback)(e=>{if(K.current){K.current=!1;return}if(W){Y(e.name);return}Re({src:f(n,C===`.`?e.name:`${C}/${e.name}`),alt:e.displayName??e.name})},[W,Y,C,n]),Z=(0,g.useCallback)(()=>(w??[]).filter(e=>e.kind===`file`&&G.has(e.name)),[w,G]),At=(0,g.useCallback)(()=>{let e=Z();e.length===1?xt(e[0]):e.length>1&&re(n,e.map(e=>C===`.`?e.name:`${C}/${e.name}`)),J(`action`)},[Z,xt,C,n,J]),jt=(0,g.useCallback)(async()=>{let t=Z(),n=t.filter(e=>!e.protected),r=t.length-n.length;Xe(r>0?`${r} protected file(s) kept`:null);for(let t of n){let n=C===`.`?t.name:`${C}/${t.name}`;try{let t=await e(`/api/admin/files?path=${encodeURIComponent(n)}`,{method:`DELETE`}),r=await t.json().catch(()=>({error:`HTTP ${t.status}`}));if(!t.ok)throw Error(r.error??`HTTP ${t.status}`)}catch(e){Xe(e instanceof Error?e.message:String(e))}}P(e=>e+1),J(`action`)},[Z,C,e,J]),Mt=(0,g.useCallback)(async()=>{let e=Z();if(console.info(`[data-ui] op=share supported=${q} count=${e.length}`),q)try{let t=await Promise.all(e.map(async e=>{let t=C===`.`?e.name:`${C}/${e.name}`,r=`/api/admin/files/download?session_key=${encodeURIComponent(n)}&path=${encodeURIComponent(t)}`,i=await(await fetch(r)).blob();return new File([i],e.name,{type:i.type||`application/octet-stream`})}));navigator.canShare({files:t})&&await navigator.share({files:t})}catch(e){console.warn(`[data-ui] op=share-failed err=${e instanceof Error?e.message:String(e)}`)}},[Z,q,C,n]),Nt=(0,g.useCallback)(()=>{N.current?.click()},[]),Q=(0,g.useCallback)((e,t={})=>{let r=new URLSearchParams({session_key:n,path:C===`.`?``:C,filename:e.name});return t.relpath&&r.set(`relpath`,t.relpath),t.token&&r.set(`token`,t.token),new Promise(n=>{let i=new XMLHttpRequest;i.open(`POST`,`/api/admin/files/upload?${r.toString()}`),i.setRequestHeader(`Content-Type`,e.type||`application/octet-stream`),t.onProgress&&(i.upload.onprogress=e=>{e.lengthComputable&&t.onProgress(e.loaded,e.total)}),i.onload=()=>{let e={};try{e=JSON.parse(i.responseText)}catch{}n({status:i.status,data:e})},i.onerror=()=>n({status:0,data:{}}),i.onabort=()=>n({status:0,data:{error:`aborted`}}),i.send(e)})},[n,C]),Pt=(0,g.useCallback)(async e=>{M(null),k(!0),j({loaded:0,total:e.size});try{let{status:t,data:n}=await Q(e,{onProgress:(e,t)=>j({loaded:e,total:t})});t>=200&&t<300&&n.path?(Fe(n.path.split(`/`).slice(0,-1).join(`/`)||`.`),P(e=>e+1)):M(t===0?`Network error during upload — the connection failed before the server responded.`:n.error??`Upload failed (HTTP ${t}).`)}finally{k(!1),j(null),N.current&&(N.current.value=``)}},[Q]),Ft=(0,g.useCallback)(e=>{z&&Array.from(e.dataTransfer.types).includes(`Files`)&&(e.preventDefault(),Je(!0))},[z]),It=(0,g.useCallback)(e=>{e.currentTarget.contains(e.relatedTarget)||Je(!1)},[]),Lt=(0,g.useCallback)(async e=>{e.preventDefault(),Je(!1);let t=Math.random().toString(16).slice(2,10),n=Array.from(e.dataTransfer.items);if(console.info(`[data-ui] op=drop-received token=${t} items=${n.length}`),n.length===0)return;if(!z){console.info(`[data-ui] op=drop-rejected token=${t} reason=no-write`),M(`Open a folder inside your account to upload`);return}let r=n.map(e=>e.webkitGetAsEntry?.()).filter(e=>!!e);k(!0),M(null),Ke(null);let i=performance.now();try{let e=await Te(r),n=e.reduce((e,t)=>e+t.file.size,0),a=new Set(e.map(e=>e.relpath.split(`/`).slice(0,-1).join(`/`)).filter(Boolean)).size;console.info(`[data-ui] op=drop-walk token=${t} files=${e.length} dirs=${a} bytes=${n}`);let o=0,s=[];for(let n=0;n<e.length;n++){let{file:r,relpath:i}=e[n];console.info(`[data-ui] op=drop-file token=${t} rel="${i}" i=${n+1}/${e.length}`),j({loaded:0,total:r.size});let{status:a,data:c}=await Q(r,{relpath:i,token:t,onProgress:(e,t)=>j({loaded:e,total:t})});if(a>=200&&a<300)o++,console.info(`[data-ui] op=drop-file-ok token=${t} rel="${i}"`);else{let e=a===0?`http=0`:Ee(a,c.error);s.push(`${i} (${e})`),console.info(`[data-ui] op=drop-file-skip token=${t} rel="${i}" reason=${e}`)}}let c=Math.round(performance.now()-i);console.info(`[data-ui] op=drop-done token=${t} uploaded=${o} skipped=${s.length} ms=${c}`),Ke(`Uploaded ${o}, skipped ${s.length}${s.length?`: ${s.join(`, `)}`:``}`),P(e=>e+1)}catch(e){M(e instanceof Error?e.message:String(e))}finally{k(!1),j(null)}},[z,Q]),Rt=(0,g.useCallback)(async()=>{let t=$e.trim();if(t){R(null);try{let n=await e(`/api/admin/files/folder`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:C===`.`?``:C,name:t})}),r=await n.json().catch(()=>({error:`HTTP ${n.status}`}));if(!n.ok)throw Error(r.error??`HTTP ${n.status}`);F(!1),et(``),P(e=>e+1)}catch(e){R(e instanceof Error?e.message:String(e))}}},[e,$e,C]),zt=(0,g.useCallback)(async()=>{if(!I)return;let t=tt.trim();if(!t)return;R(null);let n=C===`.`?I:`${C}/${I}`;try{let r=await e(`/api/admin/files/rename`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:n,newName:t})}),i=await r.json().catch(()=>({error:`HTTP ${r.status}`}));if(!r.ok)throw Error(i.error??`HTTP ${r.status}`);L(null),nt(``),J(`action`),P(e=>e+1)}catch(e){R(e instanceof Error?e.message:String(e))}},[e,tt,I,C,J]);(0,g.useEffect)(()=>{if(!ut)return;let e=e=>{ft.current&&!ft.current.contains(e.target)&&dt(!1)},t=e=>{e.key===`Escape`&&dt(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[ut]),(0,g.useEffect)(()=>{if(!pt)return;let e=e=>{mt.current&&!mt.current.contains(e.target)&&V(!1)},t=e=>{e.key===`Escape`&&V(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[pt]);let $=(0,g.useCallback)(e=>D.slice(0,e+1).map(e=>e.name).join(`/`),[D]),Bt=D.length>=2,Vt=Bt?[{name:`.`,label:`data`},...D.slice(0,D.length-2).map((e,t)=>({name:$(t),label:e.displayName??e.name}))]:[];return(0,_.jsxs)(`main`,{className:`data-main`,children:[(0,_.jsx)(ne,{variant:`operator`,onNavigate:at,conversationsCount:B.length,conversationsChannels:lt,onOpenConversations:()=>ct(`conversations`),onToggleSidebar:()=>{},sidebarOpen:!1,onLogout:it,onDisconnect:async()=>!0,disconnecting:!1}),st===`conversations`?(0,_.jsx)(ie,{conversations:B,sessionKey:n,onBack:()=>ct(`files`)}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`data-toolbar`,children:[W?(0,_.jsxs)(`button`,{type:`button`,className:`data-select-cancel`,onClick:()=>J(`cancel`),"aria-label":`Cancel selection`,children:[(0,_.jsx)(ae,{size:14}),` Cancel`]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`data-search-input`,children:[l===``&&(0,_.jsx)(oe,{size:14}),(0,_.jsx)(`input`,{ref:d,type:`text`,value:l,onChange:e=>u(e.target.value),autoFocus:!0,autoComplete:`off`,spellCheck:!1}),v&&(0,_.jsx)(t,{size:14,className:`spin`}),l!==``&&(0,_.jsx)(`button`,{type:`button`,className:`data-search-inline-btn`,onClick:()=>{u(``),d.current?.focus()},title:`Clear search`,"aria-label":`Clear search`,children:(0,_.jsx)(ae,{size:14})})]}),(0,_.jsxs)(`div`,{className:`data-toolbar-actions`,ref:mt,children:[(0,_.jsx)(`button`,{type:`button`,className:`data-action-overflow`,onClick:()=>V(e=>!e),"aria-haspopup":`menu`,"aria-expanded":pt,"aria-label":`File actions`,title:`File actions`,children:(0,_.jsx)(ee,{size:16})}),(0,_.jsxs)(`div`,{className:`data-action-group`,role:`group`,"aria-label":`File actions`,"data-open":pt?`true`:void 0,children:[(0,_.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{vt(),V(!1)},disabled:O,title:`Refresh this folder`,"aria-label":`Refresh this folder`,children:[O?(0,_.jsx)(t,{size:16,className:`spin`}):(0,_.jsx)(i,{size:16}),(0,_.jsx)(`span`,{className:`data-action-label`,children:`Refresh`})]}),(0,_.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{Nt(),V(!1)},disabled:Ue||!z,title:z?`Upload a file`:`Open a folder inside your account to upload`,"aria-label":`Upload a file`,children:[Ue?A&&A.total>0?(0,_.jsxs)(`span`,{className:`data-upload-pct`,children:[Math.round(A.loaded/A.total*100),`%`]}):(0,_.jsx)(t,{size:16,className:`spin`}):(0,_.jsx)(me,{size:16}),(0,_.jsx)(`span`,{className:`data-action-label`,children:`Upload`})]}),(0,_.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{F(e=>!e),et(``),R(null),V(!1)},disabled:Ue||!z,title:z?`New folder`:`Open a folder inside your account to create one`,"aria-label":`New folder`,children:[(0,_.jsx)(le,{size:16}),(0,_.jsx)(`span`,{className:`data-action-label`,children:`New folder`})]}),(0,_.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{Ot(T===`grid`?`list`:`grid`),V(!1)},title:T===`grid`?`List view`:`Grid view`,"aria-label":T===`grid`?`Switch to list view`:`Switch to grid view`,"aria-pressed":T===`grid`,children:[T===`grid`?(0,_.jsx)(fe,{size:16}):(0,_.jsx)(de,{size:16}),(0,_.jsx)(`span`,{className:`data-action-label`,children:T===`grid`?`List view`:`Grid view`})]})]})]})]}),(0,_.jsxs)(`div`,{className:`data-breadcrumbs`,children:[C!==`.`&&(0,_.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost data-back-btn`,onClick:bt,title:`Up one level`,"aria-label":`Up one level`,children:(0,_.jsx)(ce,{size:14})}),Bt?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`span`,{className:`data-crumb-wrap`,ref:ft,children:[(0,_.jsx)(`button`,{type:`button`,className:`data-crumb data-crumb-ellipsis`,onClick:()=>dt(e=>!e),"aria-haspopup":`menu`,"aria-expanded":ut,"aria-label":`Show parent folders`,title:`Show parent folders`,children:`…`}),ut&&(0,_.jsx)(`div`,{className:`data-crumb-menu`,role:`menu`,children:Vt.map(e=>(0,_.jsx)(`button`,{type:`button`,role:`menuitem`,className:`data-crumb-menu-item`,onClick:()=>U(e.name),title:e.label,children:e.label},e.name))})]}),[D.length-2,D.length-1].map(e=>{let t=D[e];return(0,_.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,_.jsx)(`span`,{className:`data-crumb-sep`,children:`/`}),(0,_.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>U($(e)),title:t.name,children:t.displayName??t.name})]},$(e))})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>U(`.`),children:`data`}),D.map((e,t)=>(0,_.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,_.jsx)(`span`,{className:`data-crumb-sep`,children:`/`}),(0,_.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>U($(t)),title:e.name,children:e.displayName??e.name})]},$(t)))]})]}),Qe&&(0,_.jsxs)(`div`,{className:`data-inline-form`,children:[(0,_.jsx)(`input`,{type:`text`,className:`data-inline-input`,placeholder:`Folder name`,value:$e,autoFocus:!0,onChange:e=>et(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Rt(),e.key===`Escape`&&F(!1)}}),(0,_.jsx)(`button`,{type:`button`,className:`data-btn`,onClick:Rt,children:`Create`}),(0,_.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost`,onClick:()=>F(!1),children:`Cancel`})]}),I&&(0,_.jsxs)(`div`,{className:`data-inline-form`,children:[(0,_.jsx)(`input`,{type:`text`,className:`data-inline-input`,placeholder:`New name`,value:tt,autoFocus:!0,onChange:e=>nt(e.target.value),onKeyDown:e=>{e.key===`Enter`&&zt(),e.key===`Escape`&&L(null)}}),(0,_.jsx)(`button`,{type:`button`,className:`data-btn`,onClick:zt,children:`Rename`}),(0,_.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost`,onClick:()=>L(null),children:`Cancel`})]}),rt&&(0,_.jsx)(`div`,{className:`data-error`,children:rt}),(0,_.jsx)(`input`,{type:`file`,ref:N,hidden:!0,onChange:e=>{let t=e.target.files?.[0];t&&Pt(t)}})]}),(0,_.jsxs)(`div`,{className:`data-body`,"data-drag-active":qe?`true`:void 0,onDragEnter:Ft,onDragOver:Ft,onDragLeave:It,onDrop:Lt,children:[(y!==null||h!==null)&&(0,_.jsxs)(`section`,{className:`data-panel`,children:[y&&(0,_.jsxs)(`div`,{className:`data-error`,children:[`Search failed: `,y]}),ht.length>0&&(0,_.jsx)(`div`,{className:`data-chip-row`,role:`group`,"aria-label":`Filter by type`,children:ht.map(e=>{let t=e===H;return(0,_.jsx)(`button`,{type:`button`,className:`data-chip`,"data-active":t,onClick:()=>ke(t?null:e),children:Oe([e])??e},e)})}),h&&!v&&(0,_.jsxs)(`div`,{className:`data-results-meta`,children:[gt.length,` of `,h.length,` result`,h.length===1?``:`s`]}),h&&!v&&!H&&Me>0&&!S&&(0,_.jsxs)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>Pe(!0),children:[Me,` low-confidence result`,Me===1?``:`s`,` hidden — show all`]}),h&&!v&&!H&&S&&(0,_.jsx)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>Pe(!1),children:`Showing all results — hide low-confidence`}),h&&h.length===0&&!v&&(0,_.jsx)(`div`,{className:`data-empty-results`,children:`No matches. Try a different keyword.`}),gt&&gt.length>0&&(0,_.jsx)(`ul`,{className:`data-results`,children:gt.map(e=>(0,_.jsx)(De,{hit:e,mode:be,onDownload:_t,onLocate:yt},e.nodeId))})]}),(0,_.jsxs)(`section`,{className:`data-panel`,children:[A&&(0,_.jsxs)(`div`,{className:`data-upload-progress`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":A.total>0?Math.round(A.loaded/A.total*100):void 0,children:[(0,_.jsx)(`div`,{className:`data-upload-progress-track`,children:(0,_.jsx)(`div`,{className:`data-upload-progress-fill`,style:{width:`${A.total>0?Math.round(A.loaded/A.total*100):0}%`}})}),(0,_.jsxs)(`span`,{className:`data-upload-progress-label`,children:[`Uploading… `,A.total>0?`${Math.round(A.loaded/A.total*100)}%`:``]})]}),We&&(0,_.jsxs)(`div`,{className:`data-error`,children:[`Upload failed: `,We]}),Ge&&(0,_.jsx)(`div`,{className:`data-status`,children:Ge}),Ye&&(0,_.jsxs)(`div`,{className:`data-error`,children:[`Delete failed: `,Ye]}),Ve&&(0,_.jsx)(`div`,{className:`data-error`,children:Ve}),O&&(0,_.jsxs)(`div`,{className:`data-loading`,children:[(0,_.jsx)(t,{size:14,className:`spin`}),` Loading…`]}),!W&&!O&&w&&w.length>0&&(0,_.jsxs)(`div`,{className:`data-select-hint`,children:[(0,_.jsx)(pe,{size:13}),(0,_.jsx)(`span`,{children:`Press and hold a file to select, rename, or delete it.`})]}),!O&&w&&w.length===0&&!Ve&&(0,_.jsx)(`div`,{className:`data-empty-results`,children:`Empty directory.`}),!O&&w&&w.length>0&&T===`grid`&&(0,_.jsx)(`ul`,{className:`data-grid`,children:w.map(e=>{let t=e.displayName??e.name,r=W&&G.has(e.name);if(e.kind===`directory`)return(0,_.jsx)(`li`,{className:`data-grid-cell`,"data-selected":r?`true`:void 0,children:(0,_.jsxs)(`button`,{type:`button`,className:`data-grid-tile`,onPointerDown:()=>Et(e.name),onPointerUp:X,onPointerMove:X,onPointerLeave:X,onPointerCancel:X,onClick:()=>{if(K.current){K.current=!1;return}if(W){Y(e.name);return}U(C===`.`?e.name:`${C}/${e.name}`)},children:[W&&(0,_.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,_.jsx)(ue,{size:28,className:`data-grid-glyph`}),(0,_.jsx)(`span`,{className:`data-grid-label`,title:e.name,children:t})]})},e.name);if(e.kind===`file`){let i=_e(e.name),a=C===`.`?e.name:`${C}/${e.name}`;return(0,_.jsx)(`li`,{className:`data-grid-cell`,"data-selected":r?`true`:void 0,children:(0,_.jsxs)(`button`,{type:`button`,className:`data-grid-tile${i?` data-grid-tile-image`:``}`,onPointerDown:()=>Et(e.name),onPointerUp:X,onPointerMove:X,onPointerLeave:X,onPointerCancel:X,onClick:()=>i?kt(e):Dt(e),title:W?void 0:i?`Preview ${t}`:`Download ${t}`,children:[W&&(0,_.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),i?(0,_.jsx)(`img`,{className:`data-grid-thumb`,src:f(n,a),alt:t,loading:`lazy`,onError:()=>console.warn(`[data] op=thumb-error path=${a}`)}):(0,_.jsx)(s,{size:28,className:`data-grid-glyph`}),(0,_.jsx)(`span`,{className:`data-grid-label`,title:e.name,children:t}),!i&&(0,_.jsx)(`span`,{className:`data-grid-sub`,children:Ae(e.sizeBytes)})]})},e.name)}return(0,_.jsx)(`li`,{className:`data-grid-cell`,children:(0,_.jsxs)(`div`,{className:`data-grid-tile data-entry-disabled`,children:[(0,_.jsx)(s,{size:28,className:`data-grid-glyph`}),(0,_.jsx)(`span`,{className:`data-grid-label`,children:t}),(0,_.jsx)(`span`,{className:`data-grid-sub`,children:`special`})]})},e.name)})}),!O&&w&&w.length>0&&T===`list`&&(0,_.jsx)(`ul`,{className:`data-entries`,children:w.map(e=>{let t=e.displayName??e.name;if(e.kind===`directory`){let n=W&&G.has(e.name);return(0,_.jsx)(`li`,{className:`data-entry`,"data-selected":n?`true`:void 0,children:(0,_.jsxs)(`button`,{type:`button`,className:`data-entry-btn`,onPointerDown:()=>Et(e.name),onPointerUp:X,onPointerMove:X,onPointerLeave:X,onPointerCancel:X,onClick:()=>{if(K.current){K.current=!1;return}if(W){Y(e.name);return}U(C===`.`?e.name:`${C}/${e.name}`)},children:[W&&(0,_.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,_.jsx)(ue,{size:14}),(0,_.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t})]})},e.name)}if(e.kind===`file`){let n=W&&G.has(e.name);return(0,_.jsx)(`li`,{className:`data-entry`,"data-selected":n?`true`:void 0,children:(0,_.jsxs)(`button`,{type:`button`,className:`data-entry-btn data-entry-file`,onPointerDown:()=>Et(e.name),onPointerUp:X,onPointerMove:X,onPointerLeave:X,onPointerCancel:X,onClick:()=>Dt(e),title:W?void 0:`Download ${t}`,children:[W&&(0,_.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,_.jsxs)(`span`,{className:`data-entry-text`,children:[(0,_.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t}),(0,_.jsxs)(`span`,{className:`data-entry-meta`,title:`Modified ${je(e.modifiedAt)}`,children:[Ae(e.sizeBytes),` · `,je(e.modifiedAt)]})]})]})},e.name)}return(0,_.jsx)(`li`,{className:`data-entry`,children:(0,_.jsx)(`div`,{className:`data-entry-btn data-entry-file data-entry-disabled`,children:(0,_.jsxs)(`span`,{className:`data-entry-text`,children:[(0,_.jsx)(`span`,{className:`data-entry-name`,children:t}),(0,_.jsx)(`span`,{className:`data-entry-meta`,children:`special`})]})})},e.name)})})]})]}),W&&(0,_.jsx)(`div`,{className:`data-select-bar`,role:`toolbar`,"aria-label":`Selection actions`,children:(0,_.jsxs)(`div`,{className:`data-select-bar-inner`,children:[(0,_.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:Mt,disabled:!q||G.size===0,title:q?`Share selected files`:`Sharing is not supported on this device`,children:[(0,_.jsx)(a,{size:16}),` Share`]}),(0,_.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:At,disabled:G.size===0,children:[(0,_.jsx)(o,{size:16}),` Download`]}),(0,_.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:()=>{let e=[...G][0];e&&(L(e),nt(e))},disabled:G.size!==1,children:[(0,_.jsx)(c,{size:16}),` Rename`]}),(0,_.jsxs)(`button`,{type:`button`,className:`data-select-action data-select-delete`,onClick:jt,disabled:G.size===0,children:[(0,_.jsx)(te,{size:16}),` Delete`]})]})})]}),E&&(0,_.jsx)(`div`,{className:`chat-attachment-overlay`,role:`dialog`,"aria-label":E.alt,onClick:()=>Re(null),children:(0,_.jsx)(`img`,{className:`chat-attachment-overlay-image`,src:E.src,alt:E.alt})})]})}function De({hit:e,mode:t,onDownload:n,onLocate:r}){let i=b(e.properties),a=x(e.properties),o=Oe(e.labels),s=ke(e.properties),[c,ee]=(0,g.useState)(!1),l=a&&a.length>280,te=c||!l?a:a?.slice(0,280)+`…`,u=t===`bm25`?`bm25 ${e.bm25Score.toFixed(2)}`:`vector ${e.vectorScore.toFixed(2)} · bm25 ${e.bm25Score.toFixed(2)} · combined ${e.score.toFixed(2)}`,d=e.properties.relativePath,ne=typeof d==`string`&&d.length>0,f=ne?d.lastIndexOf(`/`):-1,p=ne?f===-1?`data`:d.slice(0,f):null;return(0,_.jsxs)(`li`,{className:`data-result`,children:[(0,_.jsxs)(`div`,{role:`button`,tabIndex:0,className:`data-result-open`,onClick:()=>n(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e))},"aria-label":`Download ${i??o??`file`}`,children:[o&&(0,_.jsx)(`div`,{className:`data-result-header`,children:(0,_.jsx)(`span`,{className:`data-result-labels`,children:o})}),i&&(0,_.jsx)(`div`,{className:`data-result-title`,children:i}),a&&(0,_.jsx)(`pre`,{className:`data-result-body`,children:te}),(0,_.jsxs)(`div`,{className:`data-result-scores`,children:[s&&(0,_.jsxs)(`span`,{className:`data-result-updated`,children:[`Updated `,je(s),` · `]}),u]})]}),ne&&(0,_.jsxs)(`button`,{type:`button`,className:`data-result-locate`,onClick:()=>r(e),title:`Locate in ${p}`,"aria-label":`Locate in ${p}`,children:[(0,_.jsx)(ue,{size:12}),p]}),l&&(0,_.jsx)(`button`,{type:`button`,className:`data-result-toggle`,onClick:()=>ee(e=>!e),children:c?`Show less`:`Show more`})]})}function Oe(e){if(e.length===0)return null;let t=e[0].replace(/([a-z])([A-Z])/g,`$1 $2`);return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function b(e){for(let t of[`title`,`name`,`summary`,`headline`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n.length>140?n.slice(0,140)+`…`:n}return null}function x(e){for(let t of[`content`,`summary`,`body`,`description`,`text`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function ke(e){for(let t of[`updatedAt`,`modifiedAt`,`fetchedAt`,`createdAt`,`lastModified`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function Ae(e){return e==null?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(1)} GB`}function je(e){try{let t=new Date(e);if(isNaN(t.getTime()))return`—`;let n=typeof navigator<`u`?navigator.languages&&navigator.languages.length>0?[...navigator.languages]:[navigator.language]:void 0;return t.toLocaleString(n,{dateStyle:`medium`,timeStyle:`short`})}catch{return`—`}}(0,h.createRoot)(document.getElementById(`root`)).render((0,_.jsx)(be,{}));
@@ -1 +0,0 @@
1
- import{t as e}from"./chunk-CAM3fms7.js";import{R as t}from"./OperatorConversations-Bp-g80PM.js";var n=t(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),r=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ALL_GRAPH_LABELS=e.FALLBACK_LABEL_COLOUR=e.GRAPH_LABEL_COLOURS=void 0,e.pickDisplayLabel=t,e.colourForLabel=n,e.resolveNodeColour=r,e.formatRunTimestamp=o,e.formatMessageTimestamp=s,e.pickShortLabel=c,e.pickDisplayName=l,e.GRAPH_LABEL_COLOURS={LocalBusiness:`#4F6B8A`,Service:`#6B85A0`,PriceSpecification:`#8AA0B8`,OpeningHoursSpecification:`#A8BACE`,Listing:`#3F5670`,Property:`#5C7A99`,Viewing:`#D4A574`,Offer:`#B08850`,Job:`#8C3B2E`,QuoteDocument:`#A65A4A`,InboundInvoice:`#6B2A20`,WhatsAppGroup:`#D4A096`,Organization:`#8A6B47`,Person:`#B86E4A`,UserProfile:`#D08960`,Preference:`#DFA67A`,AdminUser:`#8C5230`,AccessGrant:`#66381F`,KnowledgeDocument:`#6E8A5A`,ConversationArchive:`#4F6B3E`,Section:`#8AA876`,Chunk:`#A6C194`,DigitalDocument:`#5A7548`,CreativeWork:`#B5C9A2`,Question:`#C7D6B5`,FAQPage:`#95B385`,DefinedTerm:`#76906A`,Review:`#3F5A2E`,ImageObject:`#A0BB8C`,Conversation:`#6B5A85`,AdminConversation:`#4F4070`,PublicConversation:`#8A75A8`,Message:`#6B7280`,UserMessage:`#DFA67A`,AssistantMessage:`#C9A876`,ToolCall:`#B5ABCB`,Task:`#B0617A`,Project:`#8E4A60`,Event:`#C68095`,Workflow:`#3A6F77`,WorkflowStep:`#5A8E96`,WorkflowRun:`#7AAAB2`,StepResult:`#9CC4CB`,Email:`#6F7F4A`,EmailAccount:`#91A063`,Agent:`#B8893D`,Objective:`#3D5A98`,KeyResult:`#5E7BC4`,Decision:`#7E60B0`,Risk:`#C15B57`,Source:`#2F8FA6`,Finding:`#4FA389`,Hypothesis:`#9A8C3E`},e.FALLBACK_LABEL_COLOUR=`#94A3B8`,e.ALL_GRAPH_LABELS=Object.freeze(Object.keys(e.GRAPH_LABEL_COLOURS));function t(t){for(let n=1;n<t.length;n++)if(Object.prototype.hasOwnProperty.call(e.GRAPH_LABEL_COLOURS,t[n]))return t[n];return t[0]??null}function n(t){return e.GRAPH_LABEL_COLOURS[t]??e.FALLBACK_LABEL_COLOUR}function r(r){let i=t(r),a=i?n(i):e.FALLBACK_LABEL_COLOUR,o=0;for(let t=1;t<r.length;t++)Object.prototype.hasOwnProperty.call(e.GRAPH_LABEL_COLOURS,r[t])&&o++;return{displayLabel:i,colour:a,driftCandidates:o}}var i=/^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2})/,a=/^\d{4}-\d{2}-\d{2}T(\d{2}:\d{2}:\d{2})/;function o(e){let t=e.match(i);return t?`${t[1]} ${t[2]}`:null}function s(e){let t=e.match(a);return t?t[1]:null}function c(e){let t=e.properties,n=e.labels[0];if(n===`ToolCall`){let e=t.toolName;if(typeof e==`string`&&e.length>0)return e.length>24?e.slice(0,24)+`…`:e}else if(n===`WorkflowRun`){let e=t.startedAt;if(typeof e==`string`&&e.length>0){let t=o(e);if(t)return t}}else if(n===`WorkflowStep`){let e=t.label;if(typeof e==`string`&&e.length>0)return e.length>24?e.slice(0,24)+`…`:e}else if(n===`Person`){let e=[typeof t.givenName==`string`?t.givenName:``,typeof t.familyName==`string`?t.familyName:``].filter(e=>e.length>0).join(` `);if(e.length>0)return e.length>24?e.slice(0,24)+`…`:e}else if(n===`Agent`){let e=typeof t.displayName==`string`?t.displayName:``,n=typeof t.slug==`string`?t.slug:``,r=e.length>0?e:n;if(r.length>0)return r.length>24?r.slice(0,24)+`…`:r}else if(n===`Job`){let e=typeof t.client==`string`?t.client:``,n=typeof t.jobId==`string`?t.jobId:``,r=[e,n.length>0?`#${n}`:``].filter(e=>e.length>0).join(` `);if(r.length>0)return r.length>24?r.slice(0,24)+`…`:r}else if(n===`QuoteDocument`){let e=typeof t.ref==`string`?t.ref:``;if(e.length>0)return e.length>24?e.slice(0,24)+`…`:e}else if(n===`InboundInvoice`){let e=typeof t.supplier==`string`?t.supplier:``,n=typeof t.confirmationNumber==`string`?t.confirmationNumber:``,r=[e,n.length>0?`#${n}`:``].filter(e=>e.length>0).join(` `);if(r.length>0)return r.length>24?r.slice(0,24)+`…`:r}else if(n===`WhatsAppGroup`){let e=typeof t.clientName==`string`?t.clientName:``;if(e.length>0)return e.length>24?e.slice(0,24)+`…`:e}else if(n===`Message`){let e=typeof t.role==`string`?t.role:``,n=e===`user`?`user`:e===`assistant`?`asst`:e===`system`?`sys`:e===`tool`?`tool`:null,r=typeof t.createdAt==`string`?t.createdAt:``;if(n&&r){let e=s(r);if(e)return`${n} ${e}`}}for(let e of[`name`,`title`,`summary`,`givenName`,`subject`,`text`]){let n=t[e];if(typeof n==`string`&&n.length>0)return n.length>24?n.slice(0,24)+`…`:n}if(n===`Conversation`){let e=typeof t.sessionId==`string`?t.sessionId:null;if(e)return`Conv ${e.slice(0,8)}`}return n??`…`}function l(e){let t=e.properties,n=e.labels[0];if(n===`ToolCall`){let e=t.toolName;if(typeof e==`string`&&e.length>0)return e}else if(n===`WorkflowRun`){let e=t.startedAt;if(typeof e==`string`&&e.length>0){let t=o(e);if(t)return t}}else if(n===`WorkflowStep`){let e=t.label;if(typeof e==`string`&&e.length>0)return e}else if(n===`Person`){let e=[typeof t.givenName==`string`?t.givenName:``,typeof t.familyName==`string`?t.familyName:``].filter(e=>e.length>0).join(` `);if(e.length>0)return e}else if(n===`Agent`){let e=typeof t.displayName==`string`?t.displayName:``,n=typeof t.slug==`string`?t.slug:``,r=e.length>0?e:n;if(r.length>0)return r}else if(n===`Job`){let e=typeof t.client==`string`?t.client:``,n=typeof t.jobId==`string`?t.jobId:``,r=[e,n.length>0?`#${n}`:``].filter(e=>e.length>0).join(` `);if(r.length>0)return r}else if(n===`QuoteDocument`){let e=typeof t.ref==`string`?t.ref:``;if(e.length>0)return e}else if(n===`InboundInvoice`){let e=typeof t.supplier==`string`?t.supplier:``,n=typeof t.confirmationNumber==`string`?t.confirmationNumber:``,r=[e,n.length>0?`#${n}`:``].filter(e=>e.length>0).join(` `);if(r.length>0)return r}else if(n===`WhatsAppGroup`){let e=typeof t.clientName==`string`?t.clientName:``;if(e.length>0)return e}for(let e of[`name`,`title`,`summary`,`givenName`,`subject`,`text`]){let n=t[e];if(typeof n==`string`&&n.length>0)return n}if(n===`Conversation`){let e=typeof t.sessionId==`string`?t.sessionId:null;if(e)return`Conv ${e.slice(0,8)}`}return n??`…`}})),i=r();Object.freeze(new Set([`Chunk`,`GraphPreference`]));var a=Object.freeze(new Set(`LocalBusiness.Service.PriceSpecification.OpeningHoursSpecification.Organization.Person.UserProfile.Preference.AdminUser.AccessGrant.KnowledgeDocument.DigitalDocument.CreativeWork.Question.FAQPage.DefinedTerm.Review.ImageObject.Listing.Property.Viewing.Offer.Job.QuoteDocument.InboundInvoice.WhatsAppGroup.AdminConversation.PublicConversation.Task.Project.Event.Workflow.Email.EmailAccount.Agent.Objective.KeyResult.Decision.Risk.Source.Finding.Hypothesis`.split(`.`)));Object.freeze(new Set([`ToolCall`,`StepResult`,`WorkflowStep`,`WorkflowRun`])),Object.freeze(new Set([`HAS_TOOL_CALL`,`RUN_OF`,`HAS_STEP`,`HAS_RESULT`]));export{n as i,i as n,r,a as t};