@markus-global/cli 0.10.0-rc.0 → 0.10.1-rc.0

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 (65) hide show
  1. package/dist/markus.mjs +219 -28
  2. package/dist/web-ui/assets/{CommentInput-DVEZsFdH.js → CommentInput-C745UDMQ.js} +1 -1
  3. package/dist/web-ui/assets/{ContentRenderer-D7liy5Ei.js → ContentRenderer-BL3f4UN5.js} +2 -2
  4. package/dist/web-ui/assets/{DeliverableShareModal-3Z6n5SPB.js → DeliverableShareModal-o1pbK67c.js} +1 -1
  5. package/dist/web-ui/assets/{Deliverables-pJ0mZrCG.js → Deliverables-D4ugAcBA.js} +1 -1
  6. package/dist/web-ui/assets/{Notifications-B7m8KM5F.js → Notifications-DA8vJKEr.js} +1 -1
  7. package/dist/web-ui/assets/{Search-Dg1QnxMv.js → Search-xvm7dGkp.js} +1 -1
  8. package/dist/web-ui/assets/{Settings-KeOQ8NBT.js → Settings-x1XJ8_4m.js} +1 -1
  9. package/dist/web-ui/assets/{Store-znN3kITL.js → Store-CcHbeFLa.js} +1 -1
  10. package/dist/web-ui/assets/{Team-B3HjBTMx.js → Team-YUOVSMYB.js} +38 -38
  11. package/dist/web-ui/assets/{Work-CLAetrCe.js → Work-CWfGwHiq.js} +1 -1
  12. package/dist/web-ui/assets/{arc-DLJKkSLU.js → arc-De0cSzJU.js} +1 -1
  13. package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-CErxJL8z.js → architectureDiagram-3BPJPVTR-BdWCyUwY.js} +1 -1
  14. package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-DhnC1GHJ.js → blockDiagram-GPEHLZMM-Cl6FrDyx.js} +1 -1
  15. package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-CWcg6zCh.js → c4Diagram-AAUBKEIU-DoleWwBp.js} +1 -1
  16. package/dist/web-ui/assets/channel-DZexGcNx.js +1 -0
  17. package/dist/web-ui/assets/{chunk-2J33WTMH-BOcDAFHW.js → chunk-2J33WTMH-CS1slQfm.js} +1 -1
  18. package/dist/web-ui/assets/{chunk-4BX2VUAB-Dc8q34rQ.js → chunk-4BX2VUAB-BWcch029.js} +1 -1
  19. package/dist/web-ui/assets/{chunk-55IACEB6-CjeuFc0_.js → chunk-55IACEB6-DSbMTTT3.js} +1 -1
  20. package/dist/web-ui/assets/{chunk-727SXJPM-DsyO9cPr.js → chunk-727SXJPM-CqJoKpmq.js} +1 -1
  21. package/dist/web-ui/assets/{chunk-AQP2D5EJ-DOhY_Zn6.js → chunk-AQP2D5EJ-pqcLwNvB.js} +1 -1
  22. package/dist/web-ui/assets/{chunk-FMBD7UC4-C4wQwaKj.js → chunk-FMBD7UC4-vTCMHNNd.js} +1 -1
  23. package/dist/web-ui/assets/{chunk-ND2GUHAM-DAxE9n6p.js → chunk-ND2GUHAM-CiYrvIJ7.js} +1 -1
  24. package/dist/web-ui/assets/{chunk-QZHKN3VN-BqskBLc5.js → chunk-QZHKN3VN-s1fyx_zY.js} +1 -1
  25. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-Ba64yqov.js +1 -0
  26. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-Ba64yqov.js +1 -0
  27. package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-q7ZrVkOv.js → cose-bilkent-S5V4N54A-CoLgGvvR.js} +1 -1
  28. package/dist/web-ui/assets/{dagre-BM42HDAG-CzpG9RNW.js → dagre-BM42HDAG-B5HqSIjs.js} +1 -1
  29. package/dist/web-ui/assets/{diagram-2AECGRRQ-Cq3sRUJD.js → diagram-2AECGRRQ-XvD9iWFV.js} +1 -1
  30. package/dist/web-ui/assets/{diagram-5GNKFQAL-BZlWfVNc.js → diagram-5GNKFQAL-C_RwD4mX.js} +1 -1
  31. package/dist/web-ui/assets/{diagram-KO2AKTUF-BR3FEkPK.js → diagram-KO2AKTUF-ooulajaZ.js} +1 -1
  32. package/dist/web-ui/assets/{diagram-LMA3HP47-BhgVodCu.js → diagram-LMA3HP47-DPrVAE1l.js} +1 -1
  33. package/dist/web-ui/assets/{diagram-OG6HWLK6-aEqNtQM7.js → diagram-OG6HWLK6-DtGUL9Ar.js} +1 -1
  34. package/dist/web-ui/assets/{docx-preview-BCUdrB1J.js → docx-preview-Bbv-to1F.js} +1 -1
  35. package/dist/web-ui/assets/{erDiagram-TEJ5UH35-CmKuqvTk.js → erDiagram-TEJ5UH35-Dt1LIcRW.js} +1 -1
  36. package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-B9PwU7vi.js → flowDiagram-I6XJVG4X-BGkeNe73.js} +1 -1
  37. package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-D4eRLO6n.js → ganttDiagram-6RSMTGT7-BBFM37Si.js} +1 -1
  38. package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-BX5vzMBG.js → gitGraphDiagram-PVQCEYII-DDZslnia.js} +1 -1
  39. package/dist/web-ui/assets/index-CtvWAPSx.js +882 -0
  40. package/dist/web-ui/assets/{infoDiagram-5YYISTIA-isLK7RCT.js → infoDiagram-5YYISTIA-CCeNBOcz.js} +1 -1
  41. package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-D_KwMIC_.js → ishikawaDiagram-YF4QCWOH-Dzz-ZwGx.js} +1 -1
  42. package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-BERHrAd2.js → journeyDiagram-JHISSGLW-Bf1MpoEJ.js} +1 -1
  43. package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-iWhVeCEA.js → kanban-definition-UN3LZRKU-Cct3iwex.js} +1 -1
  44. package/dist/web-ui/assets/{mermaid.core-DBb2SvbA.js → mermaid.core-SSIWILrc.js} +5 -5
  45. package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-B1e7ShjO.js → mindmap-definition-RKZ34NQL-905mFjP0.js} +1 -1
  46. package/dist/web-ui/assets/{pieDiagram-4H26LBE5-CINLSMM2.js → pieDiagram-4H26LBE5-ByZUSYyz.js} +1 -1
  47. package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-5OsDJzw-.js → quadrantDiagram-W4KKPZXB-CaV2JZmU.js} +1 -1
  48. package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-TckyECvk.js → requirementDiagram-4Y6WPE33-BwZH9jjo.js} +1 -1
  49. package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-BBUaDX49.js → sankeyDiagram-5OEKKPKP-BS5G0r-a.js} +1 -1
  50. package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-CDvlRmkY.js → sequenceDiagram-3UESZ5HK-C39toITa.js} +1 -1
  51. package/dist/web-ui/assets/{stateDiagram-AJRCARHV-KuO58ZEJ.js → stateDiagram-AJRCARHV-B8kaqqlT.js} +1 -1
  52. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-W2oTLuaB.js +1 -0
  53. package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-De3GteSx.js → timeline-definition-PNZ67QCA-CJ0-XG2F.js} +1 -1
  54. package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-B-XEM6Hx.js → vennDiagram-CIIHVFJN-eeoPYmS4.js} +1 -1
  55. package/dist/web-ui/assets/{wardley-L42UT6IY-DX7ioE-0.js → wardley-L42UT6IY-Cd0jXy6w.js} +1 -1
  56. package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-BrOYIz-Z.js → wardleyDiagram-YWT4CUSO-Bsm8d7ET.js} +1 -1
  57. package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-CQANrcat.js → xychartDiagram-2RQKCTM6-COj4Y_b2.js} +1 -1
  58. package/dist/web-ui/index.html +1 -1
  59. package/package.json +1 -1
  60. package/templates/roles/data-analyst/ROLE.md +184 -0
  61. package/dist/web-ui/assets/channel-DXLppOOi.js +0 -1
  62. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-Ugc4ArHR.js +0 -1
  63. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-Ugc4ArHR.js +0 -1
  64. package/dist/web-ui/assets/index-BrU2YO3p.js +0 -713
  65. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-DxZVvQnr.js +0 -1
package/dist/markus.mjs CHANGED
@@ -203448,7 +203448,11 @@ function createSettingsTools(ctx) {
203448
203448
  maxOutputTokens: m.maxOutputTokens,
203449
203449
  cost: m.cost,
203450
203450
  reasoning: m.reasoning,
203451
- vision: m.inputTypes?.includes("image")
203451
+ vision: m.inputTypes?.includes("image"),
203452
+ // Explicit capability declaration (imageGeneration/tts/stt/…).
203453
+ // Lets agents see at a glance which non-chat models a provider
203454
+ // can actually serve — no id-guessing needed.
203455
+ capabilities: m.capabilities ?? []
203452
203456
  })) ?? []
203453
203457
  };
203454
203458
  });
@@ -203569,6 +203573,26 @@ function createSettingsTools(ctx) {
203569
203573
  model: {
203570
203574
  type: "string",
203571
203575
  description: 'Default model ID (e.g. "deepseek-v4-flash")'
203576
+ },
203577
+ image_generation_timeout_ms: {
203578
+ type: "number",
203579
+ description: "Optional timeout in ms for image generation calls (default 600000 = 10min; raise for very slow local/self-hosted servers)"
203580
+ },
203581
+ tts_timeout_ms: {
203582
+ type: "number",
203583
+ description: "Optional timeout in ms for text-to-speech calls (default 600000 = 10min)"
203584
+ },
203585
+ stt_timeout_ms: {
203586
+ type: "number",
203587
+ description: "Optional timeout in ms for speech-to-text calls (default 600000 = 10min)"
203588
+ },
203589
+ video_generation_timeout_ms: {
203590
+ type: "number",
203591
+ description: "Optional timeout in ms for video generation calls (default 600000 = 10min)"
203592
+ },
203593
+ decision_timeout_ms: {
203594
+ type: "number",
203595
+ description: "Optional timeout in ms for decision calls (default 60000)"
203572
203596
  }
203573
203597
  },
203574
203598
  required: ["name", "model"]
@@ -203578,12 +203602,14 @@ function createSettingsTools(ctx) {
203578
203602
  const apiKey = args["api_key"];
203579
203603
  const baseUrl = args["base_url"];
203580
203604
  const model = args["model"];
203605
+ const mediaTimeouts = pickMediaTimeoutFields(args);
203581
203606
  try {
203582
203607
  ctx.llmRouter.registerProviderFromConfig(name, {
203583
203608
  provider: name,
203584
203609
  model,
203585
203610
  apiKey,
203586
- baseUrl
203611
+ baseUrl,
203612
+ ...mediaTimeouts
203587
203613
  });
203588
203614
  if (ctx.persistConfig) {
203589
203615
  try {
@@ -203594,6 +203620,7 @@ function createSettingsTools(ctx) {
203594
203620
  ...apiKey ? { apiKey } : {},
203595
203621
  model,
203596
203622
  ...baseUrl ? { baseUrl } : {},
203623
+ ...mediaTimeouts,
203597
203624
  enabled: true
203598
203625
  }
203599
203626
  }
@@ -203635,6 +203662,26 @@ function createSettingsTools(ctx) {
203635
203662
  model: {
203636
203663
  type: "string",
203637
203664
  description: "New model ID (optional)"
203665
+ },
203666
+ image_generation_timeout_ms: {
203667
+ type: "number",
203668
+ description: "Optional timeout in ms for image generation calls (default 600000 = 10min)"
203669
+ },
203670
+ tts_timeout_ms: {
203671
+ type: "number",
203672
+ description: "Optional timeout in ms for text-to-speech calls (default 600000 = 10min)"
203673
+ },
203674
+ stt_timeout_ms: {
203675
+ type: "number",
203676
+ description: "Optional timeout in ms for speech-to-text calls (default 600000 = 10min)"
203677
+ },
203678
+ video_generation_timeout_ms: {
203679
+ type: "number",
203680
+ description: "Optional timeout in ms for video generation calls (default 600000 = 10min)"
203681
+ },
203682
+ decision_timeout_ms: {
203683
+ type: "number",
203684
+ description: "Optional timeout in ms for decision calls (default 60000)"
203638
203685
  }
203639
203686
  },
203640
203687
  required: ["provider"]
@@ -203644,6 +203691,7 @@ function createSettingsTools(ctx) {
203644
203691
  const apiKey = args["api_key"];
203645
203692
  const baseUrl = args["base_url"];
203646
203693
  const model = args["model"];
203694
+ const mediaTimeouts = pickMediaTimeoutFields(args);
203647
203695
  try {
203648
203696
  const provider = ctx.llmRouter.getProvider(providerName);
203649
203697
  if (!provider) {
@@ -203656,6 +203704,7 @@ function createSettingsTools(ctx) {
203656
203704
  configUpdate.apiKey = apiKey;
203657
203705
  if (baseUrl !== void 0)
203658
203706
  configUpdate.baseUrl = baseUrl;
203707
+ Object.assign(configUpdate, mediaTimeouts);
203659
203708
  provider.configure(configUpdate);
203660
203709
  if (ctx.persistConfig) {
203661
203710
  try {
@@ -203666,6 +203715,7 @@ function createSettingsTools(ctx) {
203666
203715
  updates.model = model;
203667
203716
  if (baseUrl !== void 0)
203668
203717
  updates.baseUrl = baseUrl || void 0;
203718
+ Object.assign(updates, mediaTimeouts);
203669
203719
  ctx.persistConfig({ llm: { providers: { [providerName]: updates } } });
203670
203720
  } catch (e) {
203671
203721
  log29.warn("Failed to persist provider edit", { error: String(e) });
@@ -203722,12 +203772,21 @@ function createSettingsTools(ctx) {
203722
203772
  vision: {
203723
203773
  type: "boolean",
203724
203774
  description: "Whether the model supports image input (optional)"
203775
+ },
203776
+ capabilities: {
203777
+ type: "array",
203778
+ items: {
203779
+ type: "string",
203780
+ enum: ["imageGeneration", "vision", "tts", "stt", "videoGeneration", "decision"]
203781
+ },
203782
+ description: "Explicit capability declaration for this model (OPTIONAL but recommended for non-chat models). Values: imageGeneration (text-to-image), vision (image input), tts, stt, videoGeneration, decision. When declared, capability routing trusts this list instead of guessing from the model id \u2014 use this for local/self-hosted models (Ollama, vLLM, diffusers servers) whose names do not match known commercial naming patterns."
203725
203783
  }
203726
203784
  },
203727
203785
  required: ["provider", "id", "name", "context_window", "max_output_tokens", "cost_input", "cost_output"]
203728
203786
  },
203729
203787
  async execute(args) {
203730
203788
  const providerName = args["provider"];
203789
+ const declaredCaps = Array.isArray(args["capabilities"]) ? args["capabilities"].filter((c) => typeof c === "string") : [];
203731
203790
  const modelDef = {
203732
203791
  id: args["id"],
203733
203792
  name: args["name"],
@@ -203739,7 +203798,8 @@ function createSettingsTools(ctx) {
203739
203798
  output: args["cost_output"]
203740
203799
  },
203741
203800
  ...args["reasoning"] ? { reasoning: true } : {},
203742
- ...args["vision"] ? { inputTypes: ["text", "image"] } : { inputTypes: ["text"] }
203801
+ ...args["vision"] ? { inputTypes: ["text", "image"] } : { inputTypes: ["text"] },
203802
+ ...declaredCaps.length > 0 ? { capabilities: declaredCaps } : {}
203743
203803
  };
203744
203804
  try {
203745
203805
  ctx.llmRouter.addCustomModel(providerName, modelDef);
@@ -203829,6 +203889,10 @@ function createSettingsTools(ctx) {
203829
203889
  fallback_model: {
203830
203890
  type: "string",
203831
203891
  description: "Optional fallback model"
203892
+ },
203893
+ force: {
203894
+ type: "boolean",
203895
+ description: "When true, bypass the model-name heuristic gate (e.g. a self-hosted image model whose id does not look like a commercial image model). Explicit capability declarations on the model (via llm_add_model capabilities=...) are still honored and preferred. Default false."
203832
203896
  }
203833
203897
  },
203834
203898
  required: ["capability_type", "provider", "model"]
@@ -203838,6 +203902,7 @@ function createSettingsTools(ctx) {
203838
203902
  const capabilityType = resolveCapabilityTypeArg(args, VALID);
203839
203903
  const provider = String(args["provider"] ?? "").trim();
203840
203904
  const model = String(args["model"] ?? "").trim();
203905
+ const force = args["force"] === true;
203841
203906
  try {
203842
203907
  if (!capabilityType) {
203843
203908
  const raw = args["capability_type"] ?? args["capabilityType"] ?? args["type"] ?? args["capability"];
@@ -203879,13 +203944,16 @@ function createSettingsTools(ctx) {
203879
203944
  hint: `Call llm_get_capability_routing and pick from usable_models.${capabilityType}.`
203880
203945
  });
203881
203946
  }
203882
- const mismatch = detectModelCapabilityMismatch(model, capabilityType);
203883
- if (mismatch) {
203884
- return JSON.stringify({
203885
- status: "error",
203886
- error: mismatch,
203887
- hint: `Use llm_get_capability_routing.usable_models.${capabilityType} to find a suitable model.`
203888
- });
203947
+ const declared = findModelDeclaredCapabilities(ctx.llmRouter, provider, model);
203948
+ if (!force && !declared) {
203949
+ const mismatch = detectModelCapabilityMismatch(model, capabilityType);
203950
+ if (mismatch) {
203951
+ return JSON.stringify({
203952
+ status: "error",
203953
+ error: mismatch,
203954
+ hint: `Use llm_get_capability_routing.usable_models.${capabilityType} to find a suitable model, or declare capabilities on this model via llm_add_model (capabilities: ["${CAP_TAG_BY_TYPE[capabilityType] ?? "imageGeneration"}"]), or pass force:true to override the name heuristic.`
203955
+ });
203956
+ }
203889
203957
  }
203890
203958
  }
203891
203959
  const assignment = { provider, model };
@@ -204087,6 +204155,32 @@ function createSettingsTools(ctx) {
204087
204155
  }
204088
204156
  ];
204089
204157
  }
204158
+ function findModelDeclaredCapabilities(router, provider, model) {
204159
+ const settings = router.getEnhancedSettings();
204160
+ const p = settings.providers[provider];
204161
+ if (!p?.models?.length)
204162
+ return void 0;
204163
+ const entry = p.models.find((m) => m.id === model);
204164
+ if (!entry?.capabilities?.length)
204165
+ return void 0;
204166
+ return entry.capabilities;
204167
+ }
204168
+ function pickMediaTimeoutFields(args) {
204169
+ const out = {};
204170
+ const pairs = [
204171
+ ["image_generation_timeout_ms", "imageGenerationTimeoutMs"],
204172
+ ["tts_timeout_ms", "ttsTimeoutMs"],
204173
+ ["stt_timeout_ms", "sttTimeoutMs"],
204174
+ ["video_generation_timeout_ms", "videoGenerationTimeoutMs"],
204175
+ ["decision_timeout_ms", "decisionTimeoutMs"]
204176
+ ];
204177
+ for (const [argKey, cfgKey] of pairs) {
204178
+ const v = args[argKey];
204179
+ if (typeof v === "number" && Number.isFinite(v) && v > 0)
204180
+ out[cfgKey] = v;
204181
+ }
204182
+ return out;
204183
+ }
204090
204184
  function resolveCapabilityTypeArg(args, valid) {
204091
204185
  const raw = args["capability_type"] ?? args["capabilityType"] ?? args["type"] ?? args["capability"];
204092
204186
  if (typeof raw !== "string" || !raw.trim())
@@ -204148,7 +204242,9 @@ var init_settings = __esm({
204148
204242
  decision: "decision"
204149
204243
  };
204150
204244
  CAPABILITY_MODEL_PATTERNS = {
204151
- image_generation: /\bdall-?e\b|gpt-image|flux|stable.?diffusion|sdxl|imagen|wanx|wan[.-]?ai|kolors|playground|cogview|glm-image|seedream|grok-imagine|image-01/i,
204245
+ // Include common local / self-hosted diffusion families so undeclared ids
204246
+ // (qwen-image-2.1, hunyuan-image, nano-banana, …) route without being told.
204247
+ image_generation: /\bdall-?e\b|gpt-image|flux|stable.?diffusion|sdxl|imagen|qwen[.-]?image|hunyuan|nano.?banana|ideogram|recraft|grok.?image|playground|cogview|glm-image|seedream|wanx|wan[.-]?ai|kolors|image-01/i,
204152
204248
  image_recognition: /\bvl\b|vision|visual|eye|gpt-4o|gemini|claude/i,
204153
204249
  // Dedicated TTS ids only — do NOT match bare "speech"/"voice" (too broad) or music models.
204154
204250
  audio_tts: /\btts\b|cosy.?voice|bark|xtts|orpheus|aura-?\d|tts-1|text[-_.]?to[-_.]?speech/i,
@@ -204314,6 +204410,14 @@ function resolveEffectiveCandidates(candidates, agentProvider, agentModel, ctx,
204314
204410
  };
204315
204411
  }
204316
204412
  if (agentModel) {
204413
+ const slash = agentModel.indexOf("/");
204414
+ if (slash > 0) {
204415
+ const prefix = agentModel.slice(0, slash);
204416
+ const bare = agentModel.slice(slash + 1);
204417
+ if (bare && (ctx.resolveProvider?.(prefix) || candidates.some((c) => c.name === prefix))) {
204418
+ return resolveEffectiveCandidates(candidates, prefix, bare, ctx, method);
204419
+ }
204420
+ }
204317
204421
  return { candidates: candidates.map((c) => ({ ...c, model: agentModel })) };
204318
204422
  }
204319
204423
  return { candidates };
@@ -204708,7 +204812,10 @@ function createMultiModalTools(ctx) {
204708
204812
  }
204709
204813
  const tried = candidates.map((c) => c.model ?? c.name).join(", ");
204710
204814
  log30.error(`Image generation failed on all ${candidates.length} provider(s)`);
204711
- return toolErr(`Image generation failed (tried: ${tried}): ${lastError instanceof Error ? lastError.message : String(lastError)}`, { hint: ROUTING_HINT, tried_models: candidates.map((c) => c.model).filter(Boolean) });
204815
+ return toolErr(`Image generation failed (tried: ${tried}): ${lastError instanceof Error ? lastError.message : String(lastError)}`, {
204816
+ hint: `${ROUTING_HINT} If the error mentions "model not found" / "not served for this capability", the selected model is a text/chat model, not an image model \u2014 pick from llm_get_capability_routing.usable_models.image_generation.`,
204817
+ tried_models: candidates.map((c) => c.model).filter(Boolean)
204818
+ });
204712
204819
  }
204713
204820
  },
204714
204821
  {
@@ -214033,6 +214140,11 @@ var init_openai = __esm({
214033
214140
  maxTokens;
214034
214141
  chatTimeoutMs;
214035
214142
  streamTimeoutMs;
214143
+ imageGenerationTimeoutMs;
214144
+ ttsTimeoutMs;
214145
+ sttTimeoutMs;
214146
+ videoGenerationTimeoutMs;
214147
+ decisionTimeoutMs;
214036
214148
  tokenResolver;
214037
214149
  /** Explicit decisions endpoint; when unset it is resolved from `baseUrl`. */
214038
214150
  decisionsUrl;
@@ -214045,6 +214157,11 @@ var init_openai = __esm({
214045
214157
  this.maxTokens = config?.maxTokens ?? DEFAULT_REQUEST_MAX_TOKENS;
214046
214158
  this.chatTimeoutMs = config?.timeoutMs ?? 9e4;
214047
214159
  this.streamTimeoutMs = config?.streamTimeoutMs ?? 18e4;
214160
+ this.imageGenerationTimeoutMs = config?.imageGenerationTimeoutMs ?? 6e5;
214161
+ this.ttsTimeoutMs = config?.ttsTimeoutMs ?? 6e5;
214162
+ this.sttTimeoutMs = config?.sttTimeoutMs ?? 6e5;
214163
+ this.videoGenerationTimeoutMs = config?.videoGenerationTimeoutMs ?? 6e5;
214164
+ this.decisionTimeoutMs = config?.decisionTimeoutMs ?? 6e4;
214048
214165
  this.decisionsUrl = config?.decisionsUrl;
214049
214166
  this.tokenResolver = tokenResolver;
214050
214167
  }
@@ -214061,6 +214178,16 @@ var init_openai = __esm({
214061
214178
  this.chatTimeoutMs = config.timeoutMs;
214062
214179
  if (config.streamTimeoutMs)
214063
214180
  this.streamTimeoutMs = config.streamTimeoutMs;
214181
+ if (config.imageGenerationTimeoutMs !== void 0)
214182
+ this.imageGenerationTimeoutMs = config.imageGenerationTimeoutMs;
214183
+ if (config.ttsTimeoutMs !== void 0)
214184
+ this.ttsTimeoutMs = config.ttsTimeoutMs;
214185
+ if (config.sttTimeoutMs !== void 0)
214186
+ this.sttTimeoutMs = config.sttTimeoutMs;
214187
+ if (config.videoGenerationTimeoutMs !== void 0)
214188
+ this.videoGenerationTimeoutMs = config.videoGenerationTimeoutMs;
214189
+ if (config.decisionTimeoutMs !== void 0)
214190
+ this.decisionTimeoutMs = config.decisionTimeoutMs;
214064
214191
  if (config.decisionsUrl)
214065
214192
  this.decisionsUrl = config.decisionsUrl;
214066
214193
  }
@@ -214468,7 +214595,7 @@ var init_openai = __esm({
214468
214595
  "X-Title": "Markus"
214469
214596
  },
214470
214597
  body: JSON.stringify(body),
214471
- signal: AbortSignal.timeout(6e4)
214598
+ signal: AbortSignal.timeout(this.decisionTimeoutMs)
214472
214599
  });
214473
214600
  if (!res.ok) {
214474
214601
  const errText = await res.text();
@@ -214503,7 +214630,7 @@ var init_openai = __esm({
214503
214630
  method: "POST",
214504
214631
  headers: { "Content-Type": "application/json", Authorization: authorization },
214505
214632
  body: JSON.stringify(body),
214506
- signal: AbortSignal.timeout(12e4)
214633
+ signal: AbortSignal.timeout(this.imageGenerationTimeoutMs)
214507
214634
  });
214508
214635
  if (!res.ok) {
214509
214636
  const errText = await res.text();
@@ -214540,7 +214667,7 @@ var init_openai = __esm({
214540
214667
  method: "POST",
214541
214668
  headers: { "Content-Type": "application/json", Authorization: authorization },
214542
214669
  body: JSON.stringify(body),
214543
- signal: AbortSignal.timeout(18e4)
214670
+ signal: AbortSignal.timeout(this.ttsTimeoutMs)
214544
214671
  });
214545
214672
  if (!res.ok) {
214546
214673
  const errText = await res.text();
@@ -214568,7 +214695,7 @@ var init_openai = __esm({
214568
214695
  method: "POST",
214569
214696
  headers: { Authorization: authorization },
214570
214697
  body: formData,
214571
- signal: AbortSignal.timeout(12e4)
214698
+ signal: AbortSignal.timeout(this.sttTimeoutMs)
214572
214699
  });
214573
214700
  if (!res.ok) {
214574
214701
  const errText = await res.text();
@@ -214732,7 +214859,7 @@ var init_minimax = __esm({
214732
214859
  method: "POST",
214733
214860
  headers: { "Content-Type": "application/json", Authorization: authorization },
214734
214861
  body: JSON.stringify(body),
214735
- signal: AbortSignal.timeout(12e4)
214862
+ signal: AbortSignal.timeout(this.imageGenerationTimeoutMs)
214736
214863
  });
214737
214864
  if (!res.ok) {
214738
214865
  const errText = await res.text();
@@ -214772,7 +214899,7 @@ var init_minimax = __esm({
214772
214899
  method: "POST",
214773
214900
  headers: { "Content-Type": "application/json", Authorization: authorization },
214774
214901
  body: JSON.stringify(body),
214775
- signal: AbortSignal.timeout(18e4)
214902
+ signal: AbortSignal.timeout(this.ttsTimeoutMs)
214776
214903
  });
214777
214904
  if (!res.ok) {
214778
214905
  const errText = await res.text();
@@ -214809,7 +214936,7 @@ var init_minimax = __esm({
214809
214936
  method: "POST",
214810
214937
  headers: { "Content-Type": "application/json", Authorization: authorization },
214811
214938
  body: JSON.stringify(body),
214812
- signal: AbortSignal.timeout(12e4)
214939
+ signal: AbortSignal.timeout(this.videoGenerationTimeoutMs)
214813
214940
  });
214814
214941
  if (!createRes.ok) {
214815
214942
  const errText = await createRes.text();
@@ -214956,7 +215083,7 @@ var init_dashscope = __esm({
214956
215083
  method: "POST",
214957
215084
  headers: { "Content-Type": "application/json", Authorization: authorization },
214958
215085
  body: JSON.stringify(body),
214959
- signal: AbortSignal.timeout(12e4)
215086
+ signal: AbortSignal.timeout(this.imageGenerationTimeoutMs)
214960
215087
  });
214961
215088
  if (!res.ok) {
214962
215089
  const errText = await res.text();
@@ -214997,7 +215124,7 @@ var init_dashscope = __esm({
214997
215124
  method: "POST",
214998
215125
  headers: { "Content-Type": "application/json", Authorization: authorization },
214999
215126
  body: JSON.stringify(body),
215000
- signal: AbortSignal.timeout(6e4)
215127
+ signal: AbortSignal.timeout(this.ttsTimeoutMs)
215001
215128
  });
215002
215129
  if (!res.ok) {
215003
215130
  const errText = await res.text();
@@ -215079,7 +215206,7 @@ var init_fireworks = __esm({
215079
215206
  Authorization: authorization
215080
215207
  },
215081
215208
  body: JSON.stringify(body),
215082
- signal: AbortSignal.timeout(12e4)
215209
+ signal: AbortSignal.timeout(this.imageGenerationTimeoutMs)
215083
215210
  });
215084
215211
  if (!res.ok) {
215085
215212
  const errText = await res.text();
@@ -216384,6 +216511,13 @@ var init_markus_provider = __esm({
216384
216511
  maxTokens;
216385
216512
  chatTimeoutMs;
216386
216513
  streamTimeoutMs;
216514
+ /** Generative-media client timeouts; each independently configurable per
216515
+ * provider (defaults match the historical hardcoded ceilings). */
216516
+ imageGenerationTimeoutMs;
216517
+ ttsTimeoutMs;
216518
+ sttTimeoutMs;
216519
+ videoGenerationTimeoutMs;
216520
+ decisionTimeoutMs;
216387
216521
  cuCache = new CUCache();
216388
216522
  /** Hub-served geo-aware model catalog URL. */
216389
216523
  modelsUrl = "";
@@ -216408,6 +216542,11 @@ var init_markus_provider = __esm({
216408
216542
  this.maxTokens = config?.maxTokens;
216409
216543
  this.chatTimeoutMs = config?.timeoutMs ?? CHAT_TIMEOUT_MS;
216410
216544
  this.streamTimeoutMs = config?.streamTimeoutMs ?? STREAM_TIMEOUT_MS;
216545
+ this.imageGenerationTimeoutMs = config?.imageGenerationTimeoutMs ?? 6e5;
216546
+ this.ttsTimeoutMs = config?.ttsTimeoutMs ?? 6e5;
216547
+ this.sttTimeoutMs = config?.sttTimeoutMs ?? 6e5;
216548
+ this.videoGenerationTimeoutMs = config?.videoGenerationTimeoutMs ?? 6e5;
216549
+ this.decisionTimeoutMs = config?.decisionTimeoutMs ?? 6e4;
216411
216550
  this.applyRetryConfig(config);
216412
216551
  this.modelsUrl = config?.modelsUrl ?? process.env["MARKUS_MODELS_URL"] ?? "";
216413
216552
  this.hubUrl = config?.hubUrl ?? process.env["MARKUS_HUB_URL"] ?? "";
@@ -216445,6 +216584,16 @@ var init_markus_provider = __esm({
216445
216584
  this.chatTimeoutMs = config.timeoutMs;
216446
216585
  if (config.streamTimeoutMs)
216447
216586
  this.streamTimeoutMs = config.streamTimeoutMs;
216587
+ if (config.imageGenerationTimeoutMs !== void 0)
216588
+ this.imageGenerationTimeoutMs = config.imageGenerationTimeoutMs;
216589
+ if (config.ttsTimeoutMs !== void 0)
216590
+ this.ttsTimeoutMs = config.ttsTimeoutMs;
216591
+ if (config.sttTimeoutMs !== void 0)
216592
+ this.sttTimeoutMs = config.sttTimeoutMs;
216593
+ if (config.videoGenerationTimeoutMs !== void 0)
216594
+ this.videoGenerationTimeoutMs = config.videoGenerationTimeoutMs;
216595
+ if (config.decisionTimeoutMs !== void 0)
216596
+ this.decisionTimeoutMs = config.decisionTimeoutMs;
216448
216597
  this.applyRetryConfig(config);
216449
216598
  }
216450
216599
  /** Whether OpenRouter credentials are available. */
@@ -217427,7 +217576,7 @@ var init_markus_provider = __esm({
217427
217576
  "X-Title": "Markus"
217428
217577
  },
217429
217578
  body: JSON.stringify(body),
217430
- signal: AbortSignal.timeout(6e4)
217579
+ signal: AbortSignal.timeout(this.decisionTimeoutMs)
217431
217580
  });
217432
217581
  if (!res.ok) {
217433
217582
  const errText = await res.text();
@@ -217486,7 +217635,7 @@ var init_markus_provider = __esm({
217486
217635
  method: "POST",
217487
217636
  headers: { "Content-Type": "application/json", Authorization: this.bearerOpenRouter() },
217488
217637
  body: JSON.stringify(body),
217489
- signal: AbortSignal.timeout(18e4)
217638
+ signal: AbortSignal.timeout(this.imageGenerationTimeoutMs)
217490
217639
  });
217491
217640
  if (!res.ok) {
217492
217641
  const errText = await res.text();
@@ -217568,7 +217717,7 @@ var init_markus_provider = __esm({
217568
217717
  headers: { "Content-Type": "application/json", Authorization: this.bearerOpenRouter() },
217569
217718
  body: JSON.stringify(body),
217570
217719
  // Long narration + MiniMax/Deepgram synthesis often exceeds 60s.
217571
- signal: AbortSignal.timeout(18e4)
217720
+ signal: AbortSignal.timeout(this.ttsTimeoutMs)
217572
217721
  });
217573
217722
  if (!res.ok) {
217574
217723
  const errText = await res.text();
@@ -217615,7 +217764,7 @@ var init_markus_provider = __esm({
217615
217764
  method: "POST",
217616
217765
  headers: { "Content-Type": "application/json", Authorization: this.bearerOpenRouter() },
217617
217766
  body: JSON.stringify(body),
217618
- signal: AbortSignal.timeout(12e4)
217767
+ signal: AbortSignal.timeout(this.sttTimeoutMs)
217619
217768
  });
217620
217769
  if (!res.ok) {
217621
217770
  const errText = await res.text();
@@ -217684,7 +217833,7 @@ var init_markus_provider = __esm({
217684
217833
  method: "POST",
217685
217834
  headers: { "Content-Type": "application/json", Authorization: this.bearerOpenRouter() },
217686
217835
  body: JSON.stringify(body),
217687
- signal: AbortSignal.timeout(12e4)
217836
+ signal: AbortSignal.timeout(this.videoGenerationTimeoutMs)
217688
217837
  });
217689
217838
  if (!createRes.ok) {
217690
217839
  const errText = await createRes.text();
@@ -220017,8 +220166,16 @@ var init_router2 = __esm({
220017
220166
  * Resolve a provider instance for a non-text modality (image_generation, audio_tts, etc.).
220018
220167
  * Returns the provider and the assigned model name WITHOUT mutating provider state.
220019
220168
  * The caller is responsible for passing `model` into the API call options.
220169
+ *
220170
+ * For non-text capabilities this NEVER falls back to the global text routing
220171
+ * default model id (deepseek/gpt-4o/…): posting a chat id to an image/tts/stt
220172
+ * endpoint yields a confusing upstream 404 ("model not found" / "not served for
220173
+ * this capability"). Unassigned capabilities resolve to the provider only; the
220174
+ * provider's own modality-appropriate default (or an explicit per-call model)
220175
+ * is used instead.
220020
220176
  */
220021
220177
  resolveModalityProvider(capabilityType) {
220178
+ const isText2 = capabilityType === "text";
220022
220179
  const assignment = this._capabilityRouting.assignments[capabilityType];
220023
220180
  if (assignment) {
220024
220181
  const provider = this.providers.get(assignment.provider);
@@ -220035,12 +220192,46 @@ var init_router2 = __esm({
220035
220192
  if (this._routingDefaultModel) {
220036
220193
  const p2 = this.providers.get(this._routingDefaultModel.provider);
220037
220194
  if (p2 && this.isAvailable(this._routingDefaultModel.provider)) {
220038
- return { provider: p2, model: this._routingDefaultModel.model };
220195
+ const model = isText2 || this.routingDefaultModelServesCapability(capabilityType) ? this._routingDefaultModel.model : void 0;
220196
+ return { provider: p2, ...model ? { model } : {} };
220039
220197
  }
220040
220198
  }
220041
220199
  const p = this.providers.get(this.defaultProvider);
220042
220200
  return p && this.isAvailable(this.defaultProvider) ? { provider: p } : void 0;
220043
220201
  }
220202
+ /**
220203
+ * True when the routing default model's catalog entry declares the requested
220204
+ * capability. Used to decide whether a non-text fallback may carry the model
220205
+ * id — a text/chat model must never be POSTed to a media endpoint.
220206
+ */
220207
+ routingDefaultModelServesCapability(capabilityType) {
220208
+ const r = this._routingDefaultModel;
220209
+ if (!r)
220210
+ return false;
220211
+ try {
220212
+ const entry = this.getProviderModels(r.provider).find((m) => m.id === r.model);
220213
+ if (!entry)
220214
+ return false;
220215
+ switch (capabilityType) {
220216
+ case "image_generation":
220217
+ return !!entry.capabilities?.includes("imageGeneration");
220218
+ case "audio_tts":
220219
+ return !!entry.capabilities?.includes("tts");
220220
+ case "audio_stt":
220221
+ return !!entry.capabilities?.includes("stt");
220222
+ case "video_generation":
220223
+ return !!entry.capabilities?.includes("videoGeneration");
220224
+ case "decision":
220225
+ return !!entry.capabilities?.includes("decision");
220226
+ case "image_recognition":
220227
+ return !!entry.inputTypes?.includes("image") || !!entry.capabilities?.includes("vision");
220228
+ default:
220229
+ return false;
220230
+ }
220231
+ } catch {
220232
+ return false;
220233
+ }
220234
+ }
220044
220235
  /**
220045
220236
  * Look up any registered provider by name for one-shot tool overrides
220046
220237
  * (`provider=` + `model=` on generate_image / text_to_speech / …).
@@ -1 +1 @@
1
- import{j as t,u as T,r as a,k as ee}from"./index-BrU2YO3p.js";const te=1920,ne=10*1024*1024,W=5,se=.8;function re(l,u,i){return new Promise((b,f)=>{const w=new Image;w.onload=()=>{let{width:r,height:s}=w;if(r<=u&&s<=u){b(l);return}r>s?(s=Math.round(s*(u/r)),r=u):(r=Math.round(r*(u/s)),s=u);const h=document.createElement("canvas");h.width=r,h.height=s;const g=h.getContext("2d");if(!g){f(new Error("Failed to get canvas context"));return}g.drawImage(w,0,0,r,s),b(h.toDataURL("image/jpeg",i))},w.onerror=()=>f(new Error("Failed to load image")),w.src=l})}function ae({candidates:l,filter:u,anchorRef:i,onSelect:b,selectedIndex:f,onIndexChange:w}){const{t:r}=T("common"),[s,h]=a.useState(null),g=a.useRef(null),y=l.filter(d=>d.name.toLowerCase().includes(u));return a.useEffect(()=>{const d=i.current;if(!d)return;const x=d.getBoundingClientRect();h({top:x.top+window.scrollY-4,left:x.left+window.scrollX+8})},[i,u]),a.useEffect(()=>{if(!g.current||!s)return;if(g.current.getBoundingClientRect().top<8){const x=i.current;if(!x)return;const c=x.getBoundingClientRect();h({top:c.bottom+window.scrollY+4,left:s.left})}},[s,i]),a.useEffect(()=>{f>=y.length&&w(Math.max(0,y.length-1))},[y.length,f,w]),a.useEffect(()=>{if(!g.current)return;g.current.querySelector('[data-selected="true"]')?.scrollIntoView({block:"nearest"})},[f]),!s||y.length===0?null:ee.createPortal(t.jsxs("div",{ref:g,style:{position:"absolute",top:s.top,left:s.left,transform:"translateY(-100%)"},className:"w-60 bg-surface-overlay border border-border-default rounded-lg shadow-xl z-[9999] max-h-48 overflow-y-auto",children:[t.jsx("div",{className:"px-2.5 py-1.5 text-[10px] text-fg-tertiary font-medium uppercase tracking-wider border-b border-border-default",children:r("commentInput.mentionHeading")}),y.map((d,x)=>t.jsxs("button",{"data-selected":x===f,onMouseDown:c=>{c.preventDefault(),b(d)},onMouseEnter:()=>w(x),className:`w-full text-left px-3 py-2 text-xs flex items-center gap-2 transition-colors ${x===f?"bg-brand-500/15 text-brand-500":"hover:bg-surface-elevated"}`,children:[t.jsx("span",{className:`w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-bold shrink-0 ${d.type==="human"?"bg-green-500/20 text-green-500":"bg-brand-500/20 text-brand-500"}`,children:d.name.slice(0,2).toUpperCase()}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("span",{className:"text-fg-primary font-medium",children:d.name}),t.jsx("span",{className:"text-fg-tertiary text-[10px] ml-1.5",children:d.subtitle??d.type})]}),d.type==="agent"&&t.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${d.online?"bg-green-400":"bg-gray-500"}`})]},d.id))]}),document.body)}function oe(l){return/^\w+$/.test(l)?`@${l}`:`@[${l}]`}const K=/@\[([^\]]+)\]|@([\w\p{L}\p{N}]+)/gu;function ie(l){const u=[];let i;for(K.lastIndex=0;(i=K.exec(l))!==null;)u.push(i[1]??i[2]);return u}function ce(l,u,i){const b=[];let f=0;const w=u.map(s=>s.name).sort((s,h)=>h.length-s.length);let r=0;for(;r<l.length;){const s=l.indexOf("@",r);if(s<0){b.push(t.jsx("span",{children:l.slice(r)},f++));break}if(s>r&&b.push(t.jsx("span",{children:l.slice(r,s)},f++)),l[s+1]==="["){const c=l.indexOf("]",s+2);if(c>s+2){const m=l.slice(s+2,c),j=u.find(k=>k.name.toLowerCase()===m.toLowerCase());b.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&j?"cursor-pointer hover:underline":""}`,onClick:i&&j?k=>i(j,k):void 0,title:j?`${j.name} (${j.role})`:void 0,children:["@",m]},f++)),r=c+1;continue}}const h=l.slice(s+1),g=h.toLowerCase(),y=w.find(c=>g.startsWith(c.toLowerCase()));if(y){const c=u.find(m=>m.name.toLowerCase()===y.toLowerCase());b.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&c?"cursor-pointer hover:underline":""}`,onClick:i&&c?m=>i(c,m):void 0,title:c?`${c.name} (${c.role})`:void 0,children:["@",y]},f++)),r=s+1+y.length;continue}const d=/^([\w\p{L}\p{N}]+)/u,x=h.match(d);if(x){const c=x[1],m=u.find(j=>j.name.toLowerCase()===c.toLowerCase());b.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&m?"cursor-pointer hover:underline":""}`,onClick:i&&m?j=>i(m,j):void 0,title:m?`${m.name} (${m.role})`:void 0,children:["@",c]},f++)),r=s+1+c.length;continue}b.push(t.jsx("span",{children:"@"},f++)),r=s+1}return b.length>0?b:[t.jsx("span",{children:l},0)]}function de({agents:l,humans:u,onSubmit:i,placeholder:b,replyTo:f,onCancelReply:w}){const{t:r}=T("common"),[s,h]=a.useState(""),[g,y]=a.useState(!1),[d,x]=a.useState(null),[c,m]=a.useState(!1),[j,k]=a.useState(""),[C,S]=a.useState([]),[B,I]=a.useState(0),[N,M]=a.useState([]),[z,A]=a.useState(!1),F=a.useRef(null),U=a.useRef(null),L=a.useRef(null),$=a.useMemo(()=>{const e=(u??[]).map(n=>({id:n.id,name:n.name,type:"human",subtitle:n.role}));for(const n of l)e.push({id:n.id,name:n.name,type:"agent",subtitle:n.role,online:n.status==="idle"||n.status==="working"});return e},[l,u]),D=$.filter(e=>e.name.toLowerCase().includes(j)),E=a.useCallback(e=>{const n=Array.from(e).filter(o=>o.type.startsWith("image/"));if(n.length!==0)for(const o of n){if(o.size>ne)continue;const p=new FileReader;p.onload=()=>{const R=p.result;re(R,te,se).then(v=>{M(_=>_.length>=W?_:[..._,{id:`img_${Date.now()}_${Math.random().toString(36).slice(2,6)}`,dataUrl:v,name:o.name}])})},p.readAsDataURL(o)}},[]),X=a.useCallback(e=>{M(n=>n.filter(o=>o.id!==e))},[]),Y=a.useCallback(e=>{const n=e.clipboardData?.files;if(n&&n.length>0){const o=Array.from(n).filter(p=>p.type.startsWith("image/"));o.length>0&&(e.preventDefault(),E(o))}},[E]),q=a.useCallback(e=>{e.preventDefault(),A(!1);const n=e.dataTransfer?.files;n&&n.length>0&&E(Array.from(n).filter(o=>o.type.startsWith("image/")))},[E]),H=a.useCallback(e=>{e.preventDefault(),A(!0)},[]),G=a.useCallback(()=>{A(!1)},[]),O=async()=>{if(!(!s.trim()&&N.length===0)){y(!0),x(null),L.current={content:s,mentions:[...C],images:[...N]};try{await i(s,C,[...N],f?.id),h(""),S([]),M([]),L.current=null,w?.()}catch(e){x(String(e instanceof Error?e.message:e)||r("commentInput.sendFailed"))}y(!1)}},Q=async()=>{if(!L.current)return;const{content:e,mentions:n,images:o}=L.current;y(!0),x(null);try{await i(e,n,o),h(""),S([]),M([]),L.current=null}catch(p){x(String(p instanceof Error?p.message:p)||r("commentInput.sendFailed"))}y(!1)},P=a.useCallback(e=>{h(n=>{const o=n.lastIndexOf("@"),p=oe(e.name);return o>=0?n.slice(0,o)+p+" ":n+p+" "}),C.includes(e.id)||S(n=>[...n,e.id]),m(!1),k(""),I(0),F.current?.focus()},[C]),V=e=>{h(e),x(null);const n=e.lastIndexOf("@");if(n>=0&&(n===0||e[n-1]===" ")){const p=e.slice(n+1).toLowerCase();if($.some(v=>v.name.toLowerCase().includes(p))){k(p),m(!0),I(0);return}}m(!1)},Z=e=>{if(c&&D.length>0){const n=e.key==="ArrowUp"||e.ctrlKey&&e.key==="p",o=e.key==="ArrowDown"||e.ctrlKey&&e.key==="n",p=e.key==="Enter"||e.key==="Tab",R=e.key==="Escape";if(n){e.preventDefault(),I(v=>(v-1+D.length)%D.length);return}if(o){e.preventDefault(),I(v=>(v+1)%D.length);return}if(p){e.preventDefault();const v=D[B];v&&P(v);return}if(R){e.preventDefault(),m(!1);return}}e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),O())},J=a.useCallback(()=>{setTimeout(()=>m(!1),200)},[]);return t.jsxs("div",{className:"relative",onDragOver:H,onDragLeave:G,onDrop:q,children:[z&&t.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-brand-500/10 rounded-lg border-2 border-dashed border-brand-500",children:t.jsx("span",{className:"text-sm text-brand-500 font-medium",children:r("commentInput.dragDropHint")})}),c&&t.jsx(ae,{candidates:$,filter:j,anchorRef:F,onSelect:P,selectedIndex:B,onIndexChange:I}),t.jsxs("div",{className:"border border-border-default rounded-lg bg-surface-elevated",children:[f&&t.jsxs("div",{className:"flex items-center gap-2 px-2.5 pt-2 pb-1 border-b border-border-default/50",children:[t.jsxs("div",{className:"flex-1 min-w-0 pl-2 border-l-2 border-brand-500/50",children:[t.jsx("span",{className:"text-[10px] font-medium text-brand-500",children:f.authorName}),t.jsx("p",{className:"text-[10px] text-fg-tertiary truncate",children:f.content})]}),t.jsx("button",{onClick:w,className:"text-fg-tertiary hover:text-fg-secondary shrink-0 p-0.5",children:t.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),C.length>0&&t.jsx("div",{className:"flex gap-1 px-2.5 pt-2 flex-wrap",children:C.map(e=>{const n=$.find(o=>o.id===e);return t.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded-full ${n?.type==="human"?"bg-green-500/15 text-green-500":"bg-brand-500/15 text-brand-500"}`,children:["@",n?.name??e,t.jsx("button",{onClick:()=>S(o=>o.filter(p=>p!==e)),className:"hover:text-red-400",children:"×"})]},e)})}),t.jsx("textarea",{ref:F,value:s,onChange:e=>V(e.target.value),onKeyDown:Z,onBlur:J,onPaste:Y,placeholder:b??r("commentInput.placeholder"),rows:2,className:"w-full px-2.5 py-2 text-xs bg-transparent text-fg-primary placeholder-fg-tertiary outline-none resize-none"}),N.length>0&&t.jsx("div",{className:"flex items-center gap-1.5 px-2.5 pb-1.5 overflow-x-auto",children:N.map(e=>t.jsxs("div",{className:"relative group/img shrink-0",children:[t.jsx("img",{src:e.dataUrl,alt:e.name,className:"w-12 h-12 rounded-lg object-cover border border-border-default"}),t.jsx("button",{onClick:()=>X(e.id),className:"absolute -top-1.5 -right-1.5 w-4 h-4 bg-surface-secondary border border-gray-600 rounded-full flex items-center justify-center text-fg-secondary hover:text-red-500 hover:border-red-500 text-[10px] opacity-0 group-hover/img:opacity-100 transition-opacity",title:r("commentInput.removeImage"),children:"×"})]},e.id))}),d&&t.jsxs("div",{className:"flex items-center gap-2 px-2.5 pb-1.5",children:[t.jsx("span",{className:"text-[11px] text-red-400 flex-1 truncate",children:d}),t.jsxs("button",{onClick:Q,disabled:g,className:"text-[11px] text-amber-500 hover:text-amber-400 font-medium transition-colors flex items-center gap-1",children:[t.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"23 4 23 10 17 10"}),t.jsx("path",{d:"M20.49 15a9 9 0 11-2.12-9.36L23 10"})]}),r("commentInput.retry")]})]}),t.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2",children:[t.jsx("button",{type:"button",onClick:()=>U.current?.click(),disabled:g||N.length>=W,className:"p-1 text-fg-tertiary hover:text-brand-500 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:r("commentInput.attachImage"),children:t.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),t.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),t.jsx("polyline",{points:"21 15 16 10 5 21"})]})}),t.jsx("input",{ref:U,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&E(e.target.files),e.target.value=""}}),t.jsx("button",{onClick:O,disabled:!s.trim()&&N.length===0||g,className:"px-3 py-1 text-[11px] font-medium bg-brand-500 text-white rounded-md hover:bg-brand-600 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:r(g?"commentInput.sending":"commentInput.submit")})]})]}),s.trim()&&!g&&t.jsx("div",{className:"mt-0.5 -mb-0.5 flex justify-end px-2.5 pointer-events-none select-none",children:t.jsx("span",{className:"text-[10px] text-fg-tertiary/80",children:r("common:shiftEnterHint")})}),t.jsx("p",{className:"mt-1 text-center text-[10px] text-fg-tertiary/80 select-none",children:r("aiDisclaimer")})]})}export{de as C,ie as p,ce as r};
1
+ import{j as t,u as T,r as a,k as ee}from"./index-CtvWAPSx.js";const te=1920,ne=10*1024*1024,W=5,se=.8;function re(l,u,i){return new Promise((b,f)=>{const w=new Image;w.onload=()=>{let{width:r,height:s}=w;if(r<=u&&s<=u){b(l);return}r>s?(s=Math.round(s*(u/r)),r=u):(r=Math.round(r*(u/s)),s=u);const h=document.createElement("canvas");h.width=r,h.height=s;const g=h.getContext("2d");if(!g){f(new Error("Failed to get canvas context"));return}g.drawImage(w,0,0,r,s),b(h.toDataURL("image/jpeg",i))},w.onerror=()=>f(new Error("Failed to load image")),w.src=l})}function ae({candidates:l,filter:u,anchorRef:i,onSelect:b,selectedIndex:f,onIndexChange:w}){const{t:r}=T("common"),[s,h]=a.useState(null),g=a.useRef(null),y=l.filter(d=>d.name.toLowerCase().includes(u));return a.useEffect(()=>{const d=i.current;if(!d)return;const x=d.getBoundingClientRect();h({top:x.top+window.scrollY-4,left:x.left+window.scrollX+8})},[i,u]),a.useEffect(()=>{if(!g.current||!s)return;if(g.current.getBoundingClientRect().top<8){const x=i.current;if(!x)return;const c=x.getBoundingClientRect();h({top:c.bottom+window.scrollY+4,left:s.left})}},[s,i]),a.useEffect(()=>{f>=y.length&&w(Math.max(0,y.length-1))},[y.length,f,w]),a.useEffect(()=>{if(!g.current)return;g.current.querySelector('[data-selected="true"]')?.scrollIntoView({block:"nearest"})},[f]),!s||y.length===0?null:ee.createPortal(t.jsxs("div",{ref:g,style:{position:"absolute",top:s.top,left:s.left,transform:"translateY(-100%)"},className:"w-60 bg-surface-overlay border border-border-default rounded-lg shadow-xl z-[9999] max-h-48 overflow-y-auto",children:[t.jsx("div",{className:"px-2.5 py-1.5 text-[10px] text-fg-tertiary font-medium uppercase tracking-wider border-b border-border-default",children:r("commentInput.mentionHeading")}),y.map((d,x)=>t.jsxs("button",{"data-selected":x===f,onMouseDown:c=>{c.preventDefault(),b(d)},onMouseEnter:()=>w(x),className:`w-full text-left px-3 py-2 text-xs flex items-center gap-2 transition-colors ${x===f?"bg-brand-500/15 text-brand-500":"hover:bg-surface-elevated"}`,children:[t.jsx("span",{className:`w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-bold shrink-0 ${d.type==="human"?"bg-green-500/20 text-green-500":"bg-brand-500/20 text-brand-500"}`,children:d.name.slice(0,2).toUpperCase()}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("span",{className:"text-fg-primary font-medium",children:d.name}),t.jsx("span",{className:"text-fg-tertiary text-[10px] ml-1.5",children:d.subtitle??d.type})]}),d.type==="agent"&&t.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${d.online?"bg-green-400":"bg-gray-500"}`})]},d.id))]}),document.body)}function oe(l){return/^\w+$/.test(l)?`@${l}`:`@[${l}]`}const K=/@\[([^\]]+)\]|@([\w\p{L}\p{N}]+)/gu;function ie(l){const u=[];let i;for(K.lastIndex=0;(i=K.exec(l))!==null;)u.push(i[1]??i[2]);return u}function ce(l,u,i){const b=[];let f=0;const w=u.map(s=>s.name).sort((s,h)=>h.length-s.length);let r=0;for(;r<l.length;){const s=l.indexOf("@",r);if(s<0){b.push(t.jsx("span",{children:l.slice(r)},f++));break}if(s>r&&b.push(t.jsx("span",{children:l.slice(r,s)},f++)),l[s+1]==="["){const c=l.indexOf("]",s+2);if(c>s+2){const m=l.slice(s+2,c),j=u.find(k=>k.name.toLowerCase()===m.toLowerCase());b.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&j?"cursor-pointer hover:underline":""}`,onClick:i&&j?k=>i(j,k):void 0,title:j?`${j.name} (${j.role})`:void 0,children:["@",m]},f++)),r=c+1;continue}}const h=l.slice(s+1),g=h.toLowerCase(),y=w.find(c=>g.startsWith(c.toLowerCase()));if(y){const c=u.find(m=>m.name.toLowerCase()===y.toLowerCase());b.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&c?"cursor-pointer hover:underline":""}`,onClick:i&&c?m=>i(c,m):void 0,title:c?`${c.name} (${c.role})`:void 0,children:["@",y]},f++)),r=s+1+y.length;continue}const d=/^([\w\p{L}\p{N}]+)/u,x=h.match(d);if(x){const c=x[1],m=u.find(j=>j.name.toLowerCase()===c.toLowerCase());b.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&m?"cursor-pointer hover:underline":""}`,onClick:i&&m?j=>i(m,j):void 0,title:m?`${m.name} (${m.role})`:void 0,children:["@",c]},f++)),r=s+1+c.length;continue}b.push(t.jsx("span",{children:"@"},f++)),r=s+1}return b.length>0?b:[t.jsx("span",{children:l},0)]}function de({agents:l,humans:u,onSubmit:i,placeholder:b,replyTo:f,onCancelReply:w}){const{t:r}=T("common"),[s,h]=a.useState(""),[g,y]=a.useState(!1),[d,x]=a.useState(null),[c,m]=a.useState(!1),[j,k]=a.useState(""),[C,S]=a.useState([]),[B,I]=a.useState(0),[N,M]=a.useState([]),[z,A]=a.useState(!1),F=a.useRef(null),U=a.useRef(null),L=a.useRef(null),$=a.useMemo(()=>{const e=(u??[]).map(n=>({id:n.id,name:n.name,type:"human",subtitle:n.role}));for(const n of l)e.push({id:n.id,name:n.name,type:"agent",subtitle:n.role,online:n.status==="idle"||n.status==="working"});return e},[l,u]),D=$.filter(e=>e.name.toLowerCase().includes(j)),E=a.useCallback(e=>{const n=Array.from(e).filter(o=>o.type.startsWith("image/"));if(n.length!==0)for(const o of n){if(o.size>ne)continue;const p=new FileReader;p.onload=()=>{const R=p.result;re(R,te,se).then(v=>{M(_=>_.length>=W?_:[..._,{id:`img_${Date.now()}_${Math.random().toString(36).slice(2,6)}`,dataUrl:v,name:o.name}])})},p.readAsDataURL(o)}},[]),X=a.useCallback(e=>{M(n=>n.filter(o=>o.id!==e))},[]),Y=a.useCallback(e=>{const n=e.clipboardData?.files;if(n&&n.length>0){const o=Array.from(n).filter(p=>p.type.startsWith("image/"));o.length>0&&(e.preventDefault(),E(o))}},[E]),q=a.useCallback(e=>{e.preventDefault(),A(!1);const n=e.dataTransfer?.files;n&&n.length>0&&E(Array.from(n).filter(o=>o.type.startsWith("image/")))},[E]),H=a.useCallback(e=>{e.preventDefault(),A(!0)},[]),G=a.useCallback(()=>{A(!1)},[]),O=async()=>{if(!(!s.trim()&&N.length===0)){y(!0),x(null),L.current={content:s,mentions:[...C],images:[...N]};try{await i(s,C,[...N],f?.id),h(""),S([]),M([]),L.current=null,w?.()}catch(e){x(String(e instanceof Error?e.message:e)||r("commentInput.sendFailed"))}y(!1)}},Q=async()=>{if(!L.current)return;const{content:e,mentions:n,images:o}=L.current;y(!0),x(null);try{await i(e,n,o),h(""),S([]),M([]),L.current=null}catch(p){x(String(p instanceof Error?p.message:p)||r("commentInput.sendFailed"))}y(!1)},P=a.useCallback(e=>{h(n=>{const o=n.lastIndexOf("@"),p=oe(e.name);return o>=0?n.slice(0,o)+p+" ":n+p+" "}),C.includes(e.id)||S(n=>[...n,e.id]),m(!1),k(""),I(0),F.current?.focus()},[C]),V=e=>{h(e),x(null);const n=e.lastIndexOf("@");if(n>=0&&(n===0||e[n-1]===" ")){const p=e.slice(n+1).toLowerCase();if($.some(v=>v.name.toLowerCase().includes(p))){k(p),m(!0),I(0);return}}m(!1)},Z=e=>{if(c&&D.length>0){const n=e.key==="ArrowUp"||e.ctrlKey&&e.key==="p",o=e.key==="ArrowDown"||e.ctrlKey&&e.key==="n",p=e.key==="Enter"||e.key==="Tab",R=e.key==="Escape";if(n){e.preventDefault(),I(v=>(v-1+D.length)%D.length);return}if(o){e.preventDefault(),I(v=>(v+1)%D.length);return}if(p){e.preventDefault();const v=D[B];v&&P(v);return}if(R){e.preventDefault(),m(!1);return}}e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),O())},J=a.useCallback(()=>{setTimeout(()=>m(!1),200)},[]);return t.jsxs("div",{className:"relative",onDragOver:H,onDragLeave:G,onDrop:q,children:[z&&t.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-brand-500/10 rounded-lg border-2 border-dashed border-brand-500",children:t.jsx("span",{className:"text-sm text-brand-500 font-medium",children:r("commentInput.dragDropHint")})}),c&&t.jsx(ae,{candidates:$,filter:j,anchorRef:F,onSelect:P,selectedIndex:B,onIndexChange:I}),t.jsxs("div",{className:"border border-border-default rounded-lg bg-surface-elevated",children:[f&&t.jsxs("div",{className:"flex items-center gap-2 px-2.5 pt-2 pb-1 border-b border-border-default/50",children:[t.jsxs("div",{className:"flex-1 min-w-0 pl-2 border-l-2 border-brand-500/50",children:[t.jsx("span",{className:"text-[10px] font-medium text-brand-500",children:f.authorName}),t.jsx("p",{className:"text-[10px] text-fg-tertiary truncate",children:f.content})]}),t.jsx("button",{onClick:w,className:"text-fg-tertiary hover:text-fg-secondary shrink-0 p-0.5",children:t.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),C.length>0&&t.jsx("div",{className:"flex gap-1 px-2.5 pt-2 flex-wrap",children:C.map(e=>{const n=$.find(o=>o.id===e);return t.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded-full ${n?.type==="human"?"bg-green-500/15 text-green-500":"bg-brand-500/15 text-brand-500"}`,children:["@",n?.name??e,t.jsx("button",{onClick:()=>S(o=>o.filter(p=>p!==e)),className:"hover:text-red-400",children:"×"})]},e)})}),t.jsx("textarea",{ref:F,value:s,onChange:e=>V(e.target.value),onKeyDown:Z,onBlur:J,onPaste:Y,placeholder:b??r("commentInput.placeholder"),rows:2,className:"w-full px-2.5 py-2 text-xs bg-transparent text-fg-primary placeholder-fg-tertiary outline-none resize-none"}),N.length>0&&t.jsx("div",{className:"flex items-center gap-1.5 px-2.5 pb-1.5 overflow-x-auto",children:N.map(e=>t.jsxs("div",{className:"relative group/img shrink-0",children:[t.jsx("img",{src:e.dataUrl,alt:e.name,className:"w-12 h-12 rounded-lg object-cover border border-border-default"}),t.jsx("button",{onClick:()=>X(e.id),className:"absolute -top-1.5 -right-1.5 w-4 h-4 bg-surface-secondary border border-gray-600 rounded-full flex items-center justify-center text-fg-secondary hover:text-red-500 hover:border-red-500 text-[10px] opacity-0 group-hover/img:opacity-100 transition-opacity",title:r("commentInput.removeImage"),children:"×"})]},e.id))}),d&&t.jsxs("div",{className:"flex items-center gap-2 px-2.5 pb-1.5",children:[t.jsx("span",{className:"text-[11px] text-red-400 flex-1 truncate",children:d}),t.jsxs("button",{onClick:Q,disabled:g,className:"text-[11px] text-amber-500 hover:text-amber-400 font-medium transition-colors flex items-center gap-1",children:[t.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"23 4 23 10 17 10"}),t.jsx("path",{d:"M20.49 15a9 9 0 11-2.12-9.36L23 10"})]}),r("commentInput.retry")]})]}),t.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2",children:[t.jsx("button",{type:"button",onClick:()=>U.current?.click(),disabled:g||N.length>=W,className:"p-1 text-fg-tertiary hover:text-brand-500 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:r("commentInput.attachImage"),children:t.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),t.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),t.jsx("polyline",{points:"21 15 16 10 5 21"})]})}),t.jsx("input",{ref:U,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&E(e.target.files),e.target.value=""}}),t.jsx("button",{onClick:O,disabled:!s.trim()&&N.length===0||g,className:"px-3 py-1 text-[11px] font-medium bg-brand-500 text-white rounded-md hover:bg-brand-600 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:r(g?"commentInput.sending":"commentInput.submit")})]})]}),s.trim()&&!g&&t.jsx("div",{className:"mt-0.5 -mb-0.5 flex justify-end px-2.5 pointer-events-none select-none",children:t.jsx("span",{className:"text-[10px] text-fg-tertiary/80",children:r("common:shiftEnterHint")})}),t.jsx("p",{className:"mt-1 text-center text-[10px] text-fg-tertiary/80 select-none",children:r("aiDisclaimer")})]})}export{de as C,ie as p,ce as r};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BrU2YO3p.js","assets/index-CT8Kx3sa.css"])))=>i.map(i=>d[i]);
2
- import{j as a,r as i,_ as f}from"./index-BrU2YO3p.js";const b=i.lazy(()=>f(()=>import("./index-BrU2YO3p.js").then(e=>e.b1),__vite__mapDeps([0,1])).then(e=>({default:e.MarkdownMessage}))),x=new Set(["ts","tsx","js","jsx","mjs","cjs","py","go","rs","java","kt","kts","c","cc","cpp","cxx","h","hpp","hxx","cs","rb","php","swift","scala","sh","bash","zsh","fish","ps1","sql","yaml","yml","toml","xml","css","scss","less","vue","svelte","graphql","gql","proto","dockerfile","makefile","cmake","rsx","r","lua","pl","pm","ex","exs","erl","hs","clj","zig","nim","dart","gradle","tf","hcl"]);function v(e){const t=e.split(/[/\\]/).pop()?.toLowerCase()||"";if(t==="dockerfile"||t==="makefile")return"code";const r=t.includes(".")?t.split(".").pop():"";switch(r){case"md":case"markdown":return"markdown";case"html":case"htm":return"html";case"json":case"jsonc":return"json";case"csv":case"tsv":return"csv";default:return r&&x.has(r)?"code":r?"text":void 0}}function w(e){const t=e.trimStart();if(/^<!doctype\s+html/i.test(t)||/^<html[\s>]/i.test(t))return"html";if(t.startsWith("{")||t.startsWith("["))try{return JSON.parse(e),"json"}catch{}}function S(e){if(e.format)return e.format;if(e.reference){const t=v(e.reference);if(t)return t}if(e.content){const t=w(e.content);if(t)return t}return e.reference?"text":"markdown"}function y({content:e,className:t,onSelection:r}){const c=i.useRef(null),[l,p]=i.useState(null);i.useEffect(()=>{const o=d=>{d.data?.type==="__htmlpreview_height"&&typeof d.data.height=="number"&&p(d.data.height),d.data?.type==="__htmlpreview_selection"&&r&&r(d.data)};return window.addEventListener("message",o),()=>window.removeEventListener("message",o)},[r]);const h=`<script>
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CtvWAPSx.js","assets/index-CT8Kx3sa.css"])))=>i.map(i=>d[i]);
2
+ import{j as a,r as i,_ as f}from"./index-CtvWAPSx.js";const b=i.lazy(()=>f(()=>import("./index-CtvWAPSx.js").then(e=>e.b1),__vite__mapDeps([0,1])).then(e=>({default:e.MarkdownMessage}))),x=new Set(["ts","tsx","js","jsx","mjs","cjs","py","go","rs","java","kt","kts","c","cc","cpp","cxx","h","hpp","hxx","cs","rb","php","swift","scala","sh","bash","zsh","fish","ps1","sql","yaml","yml","toml","xml","css","scss","less","vue","svelte","graphql","gql","proto","dockerfile","makefile","cmake","rsx","r","lua","pl","pm","ex","exs","erl","hs","clj","zig","nim","dart","gradle","tf","hcl"]);function v(e){const t=e.split(/[/\\]/).pop()?.toLowerCase()||"";if(t==="dockerfile"||t==="makefile")return"code";const r=t.includes(".")?t.split(".").pop():"";switch(r){case"md":case"markdown":return"markdown";case"html":case"htm":return"html";case"json":case"jsonc":return"json";case"csv":case"tsv":return"csv";default:return r&&x.has(r)?"code":r?"text":void 0}}function w(e){const t=e.trimStart();if(/^<!doctype\s+html/i.test(t)||/^<html[\s>]/i.test(t))return"html";if(t.startsWith("{")||t.startsWith("["))try{return JSON.parse(e),"json"}catch{}}function S(e){if(e.format)return e.format;if(e.reference){const t=v(e.reference);if(t)return t}if(e.content){const t=w(e.content);if(t)return t}return e.reference?"text":"markdown"}function y({content:e,className:t,onSelection:r}){const c=i.useRef(null),[l,p]=i.useState(null);i.useEffect(()=>{const o=d=>{d.data?.type==="__htmlpreview_height"&&typeof d.data.height=="number"&&p(d.data.height),d.data?.type==="__htmlpreview_selection"&&r&&r(d.data)};return window.addEventListener("message",o),()=>window.removeEventListener("message",o)},[r]);const h=`<script>
3
3
  (function(){
4
4
  function getXPath(el){
5
5
  if(!el||el.nodeType!==1)return'';