cc-viewer 1.6.113 → 1.6.114

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 (62) hide show
  1. package/dist/assets/{App-CR528DXO.js → App-CvkkNpvX.js} +1 -1
  2. package/dist/assets/AppHeader-CHYXJd_r.css +41 -0
  3. package/dist/assets/{AppHeader.module-BqQkBOwo.js → AppHeader.module-mIAKs56Y.js} +12 -12
  4. package/dist/assets/{Mobile-BUJRDFat.js → Mobile-BEMnfu7v.js} +1 -1
  5. package/dist/assets/{_basePickBy-BcgG4dyW.js → _basePickBy-CrqU3MaQ.js} +1 -1
  6. package/dist/assets/{_baseUniq-CEs2oCRB.js → _baseUniq-Cy3anRPM.js} +1 -1
  7. package/dist/assets/{arc-RVKTVLT_.js → arc-CIAth6Kc.js} +1 -1
  8. package/dist/assets/{architectureDiagram-2XIMDMQ5-CQ8yREZm.js → architectureDiagram-2XIMDMQ5-DkojZhvI.js} +1 -1
  9. package/dist/assets/{blockDiagram-WCTKOSBZ-kW5nxu9S.js → blockDiagram-WCTKOSBZ-MDfWmSHd.js} +1 -1
  10. package/dist/assets/{c4Diagram-IC4MRINW-DuoWNXf4.js → c4Diagram-IC4MRINW-Dem_n0Gf.js} +1 -1
  11. package/dist/assets/channel-hqmFrJ8s.js +1 -0
  12. package/dist/assets/{chunk-4BX2VUAB-Y5JDDmx9.js → chunk-4BX2VUAB-JP0bqHHY.js} +1 -1
  13. package/dist/assets/{chunk-55IACEB6-CyA8VUBD.js → chunk-55IACEB6-BOG_Bief.js} +1 -1
  14. package/dist/assets/{chunk-FMBD7UC4-9EzbmBfR.js → chunk-FMBD7UC4-90GNT8Vk.js} +1 -1
  15. package/dist/assets/{chunk-JSJVCQXG-CEYOQEEq.js → chunk-JSJVCQXG-BKNQ2G7k.js} +1 -1
  16. package/dist/assets/{chunk-KX2RTZJC-BFBgKma_.js → chunk-KX2RTZJC-faFju7qk.js} +1 -1
  17. package/dist/assets/{chunk-NQ4KR5QH-CRQkYUr2.js → chunk-NQ4KR5QH-DLvQtxv2.js} +1 -1
  18. package/dist/assets/{chunk-QZHKN3VN-B5OrLH5q.js → chunk-QZHKN3VN-CA3AZYz5.js} +1 -1
  19. package/dist/assets/{chunk-WL4C6EOR-BNVIXyVJ.js → chunk-WL4C6EOR-Bgmn44if.js} +1 -1
  20. package/dist/assets/classDiagram-VBA2DB6C-XU09-UFC.js +1 -0
  21. package/dist/assets/classDiagram-v2-RAHNMMFH-XU09-UFC.js +1 -0
  22. package/dist/assets/clone-C3ErSYKj.js +1 -0
  23. package/dist/assets/{cose-bilkent-S5V4N54A-Bw_hIlQh.js → cose-bilkent-S5V4N54A-Blm13miz.js} +1 -1
  24. package/dist/assets/{dagre-KLK3FWXG-BEVcrFbJ.js → dagre-KLK3FWXG-C7tAJzor.js} +1 -1
  25. package/dist/assets/{diagram-E7M64L7V-geOh8xLP.js → diagram-E7M64L7V-gJPVyRHZ.js} +1 -1
  26. package/dist/assets/{diagram-IFDJBPK2-D_UJkQwp.js → diagram-IFDJBPK2-C9YwrtcH.js} +1 -1
  27. package/dist/assets/{diagram-P4PSJMXO-D6fJnuqo.js → diagram-P4PSJMXO-Ch9GWmdg.js} +1 -1
  28. package/dist/assets/{erDiagram-INFDFZHY-BRBIIIG3.js → erDiagram-INFDFZHY-Cd_ndO8a.js} +1 -1
  29. package/dist/assets/{flowDiagram-PKNHOUZH-N1595vOT.js → flowDiagram-PKNHOUZH-Bw3Ngu7V.js} +1 -1
  30. package/dist/assets/{ganttDiagram-A5KZAMGK-CypTNGn_.js → ganttDiagram-A5KZAMGK-CpeqluHp.js} +1 -1
  31. package/dist/assets/{gitGraphDiagram-K3NZZRJ6-W089Z4eN.js → gitGraphDiagram-K3NZZRJ6-BV__frdB.js} +1 -1
  32. package/dist/assets/{graph-C2swi0En.js → graph-gX1BmtiL.js} +1 -1
  33. package/dist/assets/index-BuytiXrp.css +1 -0
  34. package/dist/assets/{index-Bsr4EPez.js → index-DbakmOTh.js} +2 -2
  35. package/dist/assets/{infoDiagram-LFFYTUFH-BZQNBX7Q.js → infoDiagram-LFFYTUFH-DZR2GsXL.js} +1 -1
  36. package/dist/assets/{ishikawaDiagram-PHBUUO56-DUWkPJz_.js → ishikawaDiagram-PHBUUO56-C4LVT2Te.js} +1 -1
  37. package/dist/assets/{journeyDiagram-4ABVD52K-DSg5fDdX.js → journeyDiagram-4ABVD52K-DaUxb53V.js} +1 -1
  38. package/dist/assets/{kanban-definition-K7BYSVSG-CX62t5PG.js → kanban-definition-K7BYSVSG-Dc7x3Qqb.js} +1 -1
  39. package/dist/assets/{layout-DCARvKN5.js → layout-CkGq-AuK.js} +1 -1
  40. package/dist/assets/{linear-B3JJRt1L.js → linear-C1lQD7pi.js} +1 -1
  41. package/dist/assets/{mermaid.core-Tmv8ZzzJ.js → mermaid.core-BMHOIuqW.js} +4 -4
  42. package/dist/assets/{mindmap-definition-YRQLILUH-DEtRP_RV.js → mindmap-definition-YRQLILUH-xNlRDvpa.js} +1 -1
  43. package/dist/assets/{pieDiagram-SKSYHLDU-DPc_B3Hk.js → pieDiagram-SKSYHLDU-DBHtK86G.js} +1 -1
  44. package/dist/assets/{quadrantDiagram-337W2JSQ-B4PdXPi6.js → quadrantDiagram-337W2JSQ-CgDAG02S.js} +1 -1
  45. package/dist/assets/{requirementDiagram-Z7DCOOCP-AvSvl4Ys.js → requirementDiagram-Z7DCOOCP-BiK9sKMn.js} +1 -1
  46. package/dist/assets/{sankeyDiagram-WA2Y5GQK-BO04KLhm.js → sankeyDiagram-WA2Y5GQK-B0_x6Lho.js} +1 -1
  47. package/dist/assets/{sequenceDiagram-2WXFIKYE-f9sbc48K.js → sequenceDiagram-2WXFIKYE-WUB5vob5.js} +1 -1
  48. package/dist/assets/{stateDiagram-RAJIS63D-Dbv-rShV.js → stateDiagram-RAJIS63D-GrvKaHOP.js} +1 -1
  49. package/dist/assets/stateDiagram-v2-FVOUBMTO-pIuQQfOp.js +1 -0
  50. package/dist/assets/{timeline-definition-YZTLITO2-kNLV_mtp.js → timeline-definition-YZTLITO2-Bme6pBR7.js} +1 -1
  51. package/dist/assets/{treemap-KZPCXAKY-Bdi8hX33.js → treemap-KZPCXAKY-BRbcHQNZ.js} +1 -1
  52. package/dist/assets/{vennDiagram-LZ73GAT5-BYfoBeem.js → vennDiagram-LZ73GAT5-C44vpqQM.js} +1 -1
  53. package/dist/assets/{xychartDiagram-JWTSCODW-snuBm0IP.js → xychartDiagram-JWTSCODW-CqsDc8Ay.js} +1 -1
  54. package/dist/index.html +2 -2
  55. package/package.json +1 -1
  56. package/dist/assets/AppHeader-FUNo9dWq.css +0 -41
  57. package/dist/assets/channel-DAabzuUb.js +0 -1
  58. package/dist/assets/classDiagram-VBA2DB6C-B9iOFUv5.js +0 -1
  59. package/dist/assets/classDiagram-v2-RAHNMMFH-B9iOFUv5.js +0 -1
  60. package/dist/assets/clone-D7O9lu2c.js +0 -1
  61. package/dist/assets/index-D85Mqmwa.css +0 -1
  62. package/dist/assets/stateDiagram-v2-FVOUBMTO-CKVUCjtl.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-Tmv8ZzzJ.js","assets/index-Bsr4EPez.js","assets/index-D85Mqmwa.css"])))=>i.map(i=>d[i]);
2
- var fB=Object.defineProperty;var pB=(t,e,n)=>e in t?fB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Je=(t,e,n)=>pB(t,typeof e!="symbol"?e+"":e,n);import{g as _0,R as Z,b as mB,r as f,c as Q0,j as w,a as Ft,_ as t6,i as OT}from"./index-Bsr4EPez.js";function gB(t,e){for(var n=0;n<e.length;n++){const i=e[n];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in t)){const s=Object.getOwnPropertyDescriptor(i,r);s&&Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var U$={exports:{}};/*!
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-BMHOIuqW.js","assets/index-DbakmOTh.js","assets/index-BuytiXrp.css"])))=>i.map(i=>d[i]);
2
+ var fB=Object.defineProperty;var pB=(t,e,n)=>e in t?fB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Je=(t,e,n)=>pB(t,typeof e!="symbol"?e+"":e,n);import{g as _0,R as Z,b as mB,r as f,c as Q0,j as w,a as Ft,_ as t6,i as OT}from"./index-DbakmOTh.js";function gB(t,e){for(var n=0;n<e.length;n++){const i=e[n];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in t)){const s=Object.getOwnPropertyDescriptor(i,r);s&&Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var U$={exports:{}};/*!
3
3
  Copyright (c) 2018 Jed Watson.
4
4
  Licensed under the MIT License (MIT), see
5
5
  http://jedwatson.github.io/classnames
@@ -714,7 +714,7 @@ Code Review поточних git-змін з різних перспектив
714
714
  Перевірте вимоги та побічні ефекти нового коду;
715
715
  Після звіту підсумуйте пропозиції;
716
716
  НЕ виконуйте одразу, спершу запитайте мене;`},"ui.terminal.addItem":{zh:"添加",en:"Add","zh-TW":"新增",ko:"추가",ja:"追加",de:"Hinzufügen",es:"Agregar",fr:"Ajouter",it:"Aggiungi",da:"Tilføj",pl:"Dodaj",ru:"Добавить",ar:"إضافة",no:"Legg til","pt-BR":"Adicionar",th:"เพิ่ม",tr:"Ekle",uk:"Додати"},"ui.terminal.deleteSelected":{zh:"删除",en:"Delete","zh-TW":"刪除",ko:"삭제",ja:"削除",de:"Löschen",es:"Eliminar",fr:"Supprimer",it:"Elimina",da:"Slet",pl:"Usuń",ru:"Удалить",ar:"حذف",no:"Slett","pt-BR":"Excluir",th:"ลบ",tr:"Sil",uk:"Видалити"},"ui.ok":{zh:"确定",en:"OK","zh-TW":"確定",ko:"확인",ja:"OK",de:"OK",es:"Aceptar",fr:"OK",it:"OK",da:"OK",pl:"OK",ru:"ОК",ar:"موافق",no:"OK","pt-BR":"OK",th:"ตกลง",tr:"Tamam",uk:"ОК"},"ui.terminal.editItem":{zh:"编辑",en:"Edit","zh-TW":"編輯",ko:"편집",ja:"編集",de:"Bearbeiten",es:"Editar",fr:"Modifier",it:"Modifica",da:"Rediger",pl:"Edytuj",ru:"Редактировать",ar:"تعديل",no:"Rediger","pt-BR":"Editar",th:"แก้ไข",tr:"Düzenle",uk:"Редагувати"},"ui.terminal.teamName":{zh:"名称:",en:"Name:","zh-TW":"名稱:",ko:"이름:",ja:"名前:",de:"Name:",es:"Nombre:",fr:"Nom :",it:"Nome:",da:"Navn:",pl:"Nazwa:",ru:"Имя:",ar:"الاسم:",no:"Navn:","pt-BR":"Nome:",th:"ชื่อ:",tr:"Ad:",uk:"Назва:"},"ui.terminal.teamDesc":{zh:"描述:",en:"Description:","zh-TW":"描述:",ko:"설명:",ja:"説明:",de:"Beschreibung:",es:"Descripción:",fr:"Description :",it:"Descrizione:",da:"Beskrivelse:",pl:"Opis:",ru:"Описание:",ar:"الوصف:",no:"Beskrivelse:","pt-BR":"Descrição:",th:"คำอธิบาย:",tr:"Açıklama:",uk:"Опис:"},"ui.terminal.teamNamePlaceholder":{zh:"输入 Team 名称...",en:"Enter team name...","zh-TW":"輸入 Team 名稱...",ko:"팀 이름 입력...",ja:"チーム名を入力...",de:"Teamname eingeben...",es:"Ingrese nombre del equipo...",fr:"Entrez le nom de l'équipe...",it:"Inserisci nome del team...",da:"Indtast teamnavn...",pl:"Wpisz nazwę zespołu...",ru:"Введите название команды...",ar:"أدخل اسم الفريق...",no:"Skriv inn teamnavn...","pt-BR":"Digite o nome da equipe...",th:"ป้อนชื่อทีม...",tr:"Takım adını girin...",uk:"Введіть назву команди..."},"ui.terminal.presetInputPlaceholder":{zh:"输入快捷方式文本...",en:"Enter shortcut text...","zh-TW":"輸入快捷方式文字...",ko:"단축키 텍스트 입력...",ja:"ショートカットテキストを入力...",de:"Verknüpfungstext eingeben...",es:"Ingrese texto del atajo...",fr:"Entrez le texte du raccourci...",it:"Inserisci testo scorciatoia...",da:"Indtast genvejstekst...",pl:"Wpisz tekst skrótu...",ru:"Введите текст ярлыка...",ar:"أدخل نص الاختصار...",no:"Skriv inn snarveitekst...","pt-BR":"Digite o texto do atalho...",th:"ป้อนข้อความทางลัด...",tr:"Kısayol metnini girin...",uk:"Введіть текст ярлика..."},"ui.terminal.pasteImageFailed":{zh:"粘贴图片上传失败",en:"Failed to upload pasted image","zh-TW":"貼上圖片上傳失敗",ko:"붙여넣은 이미지 업로드 실패",ja:"貼り付けた画像のアップロードに失敗しました",de:"Hochladen des eingefügten Bildes fehlgeschlagen",es:"Error al subir la imagen pegada",fr:"Échec du téléchargement de l'image collée",it:"Caricamento immagine incollata non riuscito",da:"Upload af indsat billede mislykkedes",pl:"Nie udało się przesłać wklejonego obrazu",ru:"Не удалось загрузить вставленное изображение",ar:"فشل رفع الصورة الملصقة",no:"Kunne ikke laste opp limt bilde","pt-BR":"Falha ao enviar imagem colada",th:"อัปโหลดรูปภาพที่วางไม่สำเร็จ",tr:"Yapıştırılan resim yüklenemedi",uk:"Не вдалося завантажити вставлене зображення"},"ui.terminal.upload":{zh:"上传文件",en:"Upload File","zh-TW":"上傳檔案",ko:"파일 업로드",ja:"ファイルをアップロード",de:"Datei hochladen",es:"Subir archivo",fr:"Télécharger un fichier",it:"Carica file",da:"Upload fil",pl:"Prześlij plik",ru:"Загрузить файл",ar:"رفع ملف",no:"Last opp fil","pt-BR":"Enviar arquivo",th:"อัปโหลดไฟล์",tr:"Dosya yükle",uk:"Завантажити файл"},"ui.editorSession.banner":{zh:"保存好以后,点我回到「终端」界面",en:"After saving, click here to return to Terminal","zh-TW":"儲存好以後,點我回到「終端」介面",ko:"저장 후 여기를 클릭하여 터미널로 돌아가기",ja:"保存後、ここをクリックしてターミナルに戻る",de:"Nach dem Speichern hier klicken, um zum Terminal zurückzukehren",es:"Después de guardar, haz clic aquí para volver a la Terminal",fr:"Après avoir enregistré, cliquez ici pour revenir au Terminal",it:"Dopo aver salvato, clicca qui per tornare al Terminale",da:"Klik her for at vende tilbage til Terminalen efter at have gemt",pl:"Po zapisaniu kliknij tutaj, aby wrócić do Terminala",ru:"После сохранения нажмите здесь, чтобы вернуться в Терминал",ar:"بعد الحفظ، انقر هنا للعودة إلى الطرفية",no:"Etter lagring, klikk her for å gå tilbake til Terminalen","pt-BR":"Após salvar, clique aqui para voltar ao Terminal",th:"หลังบันทึกแล้ว คลิกที่นี่เพื่อกลับไปที่เทอร์มินัล",tr:"Kaydettikten sonra Terminal'e dönmek için buraya tıklayın",uk:"Після збереження натисніть тут, щоб повернутися до Терміналу"},"ui.askSubmit":{zh:"提交",en:"Submit","zh-TW":"提交",ko:"제출",ja:"送信",de:"Absenden",es:"Enviar",fr:"Soumettre",it:"Invia",da:"Indsend",pl:"Wyślij",ru:"Отправить",ar:"إرسال",no:"Send inn","pt-BR":"Enviar",th:"ส่ง",tr:"Gönder",uk:"Надіслати"},"ui.askSubmitting":{zh:"提交中...",en:"Submitting...","zh-TW":"提交中...",ko:"제출 중...",ja:"送信中...",de:"Wird gesendet...",es:"Enviando...",fr:"Envoi en cours...",it:"Invio in corso...",da:"Indsender...",pl:"Wysyłanie...",ru:"Отправка...",ar:"جارٍ الإرسال...",no:"Sender inn...","pt-BR":"Enviando...",th:"กำลังส่ง...",tr:"Gönderiliyor...",uk:"Надсилання..."},"ui.askOther":{zh:"其他",en:"Other","zh-TW":"其他",ko:"기타",ja:"その他",de:"Andere",es:"Otro",fr:"Autre",it:"Altro",da:"Andet",pl:"Inne",ru:"Другое",ar:"أخرى",no:"Annet","pt-BR":"Outro",th:"อื่นๆ",tr:"Diğer",uk:"Інше"},"ui.askOtherPlaceholder":{zh:"输入你的回答...",en:"Type your answer...","zh-TW":"輸入你的回答...",ko:"답변을 입력하세요...",ja:"回答を入力...",de:"Geben Sie Ihre Antwort ein...",es:"Escribe tu respuesta...",fr:"Tapez votre réponse...",it:"Digita la tua risposta...",da:"Skriv dit svar...",pl:"Wpisz swoją odpowiedź...",ru:"Введите ваш ответ...",ar:"اكتب إجابتك...",no:"Skriv svaret ditt...","pt-BR":"Digite sua resposta...",th:"พิมพ์คำตอบของคุณ...",tr:"Cevabınızı yazın...",uk:"Введіть вашу відповідь..."},"ui.calibrationModelLabel":{zh:"手动校准主力模型:",en:"Calibrate model:","zh-TW":"手動校準主力模型:",ko:"모델 수동 보정:",ja:"モデル手動校正:",de:"Modell kalibrieren:",es:"Calibrar modelo:",fr:"Calibrer le modèle :",it:"Calibra modello:",da:"Kalibrer model:",pl:"Kalibruj model:",ru:"Калибровка модели:",ar:"معايرة النموذج:",no:"Kalibrer modell:","pt-BR":"Calibrar modelo:",th:"ปรับเทียบโมเดล:",tr:"Model kalibrasyonu:",uk:"Калібрування моделі:"},"ui.cachedContentTitle":{zh:"当前 KV-Cache 缓存内容",en:"Current KV-Cache Content","zh-TW":"當前 KV-Cache 快取內容",ko:"현재 KV-Cache 캐시 콘텐츠",ja:"現在の KV-Cache キャッシュ内容",de:"Aktueller KV-Cache Inhalt",es:"Contenido actual de KV-Cache",fr:"Contenu KV-Cache actuel",it:"Contenuto KV-Cache attuale",da:"Aktuelt KV-Cache indhold",pl:"Bieżąca zawartość KV-Cache",ru:"Текущее содержимое KV-Cache",ar:"محتوى KV-Cache الحالي",no:"Nåværende KV-Cache innhold","pt-BR":"Conteúdo atual do KV-Cache",th:"เนื้อหา KV-Cache ปัจจุบัน",tr:"Mevcut KV-Cache İçeriği",uk:"Поточний вміст KV-Cache"},"ui.noCachedContent":{zh:"暂无缓存内容",en:"No cached content","zh-TW":"暫無快取內容",ko:"캐시된 콘텐츠 없음",ja:"キャッシュ内容なし",de:"Kein zwischengespeicherter Inhalt",es:"Sin contenido en caché",fr:"Aucun contenu en cache",it:"Nessun contenuto in cache",da:"Intet cachelagret indhold",pl:"Brak zawartości w pamięci podręcznej",ru:"Нет кэшированного содержимого",ar:"لا يوجد محتوى مخزن مؤقتًا",no:"Ingen bufret innhold","pt-BR":"Sem conteúdo em cache",th:"ไม่มีเนื้อหาที่แคช",tr:"Önbelleğe alınmış içerik yok",uk:"Немає кешованого вмісту"},"ui.systemPrompt":{zh:"系统提示词",en:"System Prompt","zh-TW":"系統提示詞",ko:"시스템 프롬프트",ja:"システムプロンプト",de:"System-Prompt",es:"Prompt del sistema",fr:"Prompt système",it:"Prompt di sistema",da:"Systemprompt",pl:"Prompt systemowy",ru:"Системный промпт",ar:"موجه النظام",no:"Systemprompt","pt-BR":"Prompt do sistema",th:"พรอมต์ระบบ",tr:"Sistem İstemi",uk:"Системний промпт"},"ui.messages":{zh:"消息",en:"Messages","zh-TW":"訊息",ko:"메시지",ja:"メッセージ",de:"Nachrichten",es:"Mensajes",fr:"Messages",it:"Messaggi",da:"Beskeder",pl:"Wiadomości",ru:"Сообщения",ar:"الرسائل",no:"Meldinger","pt-BR":"Mensagens",th:"ข้อความ",tr:"Mesajlar",uk:"Повідомлення"},"ui.tools":{zh:"工具",en:"Tools","zh-TW":"工具",ko:"도구",ja:"ツール",de:"Werkzeuge",es:"Herramientas",fr:"Outils",it:"Strumenti",da:"Værktøjer",pl:"Narzędzia",ru:"Инструменты",ar:"الأدوات",no:"Verktøy","pt-BR":"Ferramentas",th:"เครื่องมือ",tr:"Araçlar",uk:"Інструменти"},"ui.tokens":{zh:"Token",en:"Tokens","zh-TW":"Token",ko:"토큰",ja:"トークン",de:"Token",es:"Tokens",fr:"Jetons",it:"Token",da:"Tokens",pl:"Tokeny",ru:"Токены",ar:"الرموز",no:"Tokens","pt-BR":"Tokens",th:"โทเค็น",tr:"Tokenler",uk:"Токени"},"ui.userPromptNav":{zh:"用户 Prompt 导航",en:"User Prompt Nav","zh-TW":"使用者 Prompt 導航",ko:"사용자 프롬프트 탐색",ja:"ユーザープロンプトナビ",de:"Benutzer-Prompt-Navigation",es:"Navegación de prompts",fr:"Navigation des prompts",it:"Navigazione prompt utente",da:"Bruger-prompt navigation",pl:"Nawigacja promptów",ru:"Навигация по промптам",ar:"تنقل المطالبات",no:"Bruker-prompt navigasjon","pt-BR":"Navegação de prompts",th:"นำทางพรอมต์ผู้ใช้",tr:"Kullanıcı İstemi Gezinme",uk:"Навігація промптів"},"ui.loadEarlierConversations":{zh:"加载更早的对话",en:"Load earlier conversations","zh-TW":"載入更早的對話",ko:"이전 대화 로드",ja:"以前の会話を読み込む",de:"Ältere Unterhaltungen laden",es:"Cargar conversaciones anteriores",fr:"Charger les conversations précédentes",it:"Carica conversazioni precedenti",da:"Indlæs ældre samtaler",pl:"Załaduj wcześniejsze rozmowy",ru:"Загрузить ранние разговоры",ar:"تحميل محادثات أقدم",no:"Last inn eldre samtaler","pt-BR":"Carregar conversas anteriores",th:"โหลดบทสนทนาก่อนหน้า",tr:"Eski konuşmaları yükle",uk:"Завантажити попередні розмови"},"ui.loadingMoreHistory":{zh:"加载中...",en:"Loading...","zh-TW":"載入中...",ko:"로딩 중...",ja:"読み込み中...",de:"Laden...",es:"Cargando...",fr:"Chargement...",it:"Caricamento...",da:"Indlæser...",pl:"Ładowanie...",ru:"Загрузка...",ar:"جارٍ التحميل...",no:"Laster...","pt-BR":"Carregando...",th:"กำลังโหลด...",tr:"Yükleniyor...",uk:"Завантаження..."},"ui.allConversationsLoaded":{zh:"已加载全部对话",en:"All conversations loaded","zh-TW":"已載入全部對話",ko:"모든 대화가 로드됨",ja:"すべての会話を読み込みました",de:"Alle Unterhaltungen geladen",es:"Todas las conversaciones cargadas",fr:"Toutes les conversations chargées",it:"Tutte le conversazioni caricate",da:"Alle samtaler indlæst",pl:"Wszystkie rozmowy załadowane",ru:"Все разговоры загружены",ar:"تم تحميل جميع المحادثات",no:"Alle samtaler lastet","pt-BR":"Todas as conversas carregadas",th:"โหลดบทสนทนาทั้งหมดแล้ว",tr:"Tüm konuşmalar yüklendi",uk:"Всі розмови завантажено"},"ui.loadSessionPlaceholder":{zh:"加载此会话 ({count} 条消息)",en:"Load this session ({count} messages)","zh-TW":"載入此對話 ({count} 則訊息)",ko:"이 세션 로드 ({count}개 메시지)",ja:"このセッションを読み込む ({count} メッセージ)",de:"Diese Sitzung laden ({count} Nachrichten)",es:"Cargar esta sesión ({count} mensajes)",fr:"Charger cette session ({count} messages)",it:"Carica questa sessione ({count} messaggi)",da:"Indlæs denne session ({count} beskeder)",pl:"Załaduj tę sesję ({count} wiadomości)",ru:"Загрузить эту сессию ({count} сообщений)",ar:"تحميل هذه الجلسة ({count} رسائل)",no:"Last inn denne økten ({count} meldinger)","pt-BR":"Carregar esta sessão ({count} mensagens)",th:"โหลดเซสชันนี้ ({count} ข้อความ)",tr:"Bu oturumu yükle ({count} mesaj)",uk:"Завантажити цю сесію ({count} повідомлень)"},"ui.proxySwitch":{zh:"代理热切换",en:"Hot-Switch Proxy","zh-TW":"代理熱切換",ko:"프록시 핫스위칭",ja:"プロキシ ホットスイッチ",de:"Proxy-Hotswitch",es:"Cambio rápido de proxy",fr:"Changement à chaud du proxy",it:"Cambio rapido proxy",da:"Proxy hot-switch",pl:"Szybkie przełączanie proxy",ru:"Горячее переключение прокси",ar:"تبديل الوكيل الفوري",no:"Proxy hot-switch","pt-BR":"Troca rápida de proxy",th:"สลับพร็อกซีแบบร้อน",tr:"Proxy hızlı geçiş",uk:"Гаряче перемикання проксі"},"ui.proxy.builtin":{zh:"内置",en:"Built-in","zh-TW":"內建",ko:"내장",ja:"ビルトイン",de:"Eingebaut",es:"Integrado",fr:"Intégré",it:"Integrato",da:"Indbygget",pl:"Wbudowany",ru:"Встроенный",ar:"مدمج",no:"Innebygd","pt-BR":"Integrado",th:"ในตัว",tr:"Yerleşik",uk:"Вбудований"},"ui.proxy.addProxy":{zh:"添加代理",en:"Add Proxy","zh-TW":"新增代理",ko:"프록시 추가",ja:"プロキシ追加",de:"Proxy hinzufügen",es:"Agregar proxy",fr:"Ajouter un proxy",it:"Aggiungi proxy",da:"Tilføj proxy",pl:"Dodaj proxy",ru:"Добавить прокси",ar:"إضافة وكيل",no:"Legg til proxy","pt-BR":"Adicionar proxy",th:"เพิ่มพร็อกซี",tr:"Proxy ekle",uk:"Додати проксі"},"ui.proxy.deleteProxy":{zh:"删除代理",en:"Delete Proxy","zh-TW":"刪除代理",ko:"프록시 삭제",ja:"プロキシ削除",de:"Proxy löschen",es:"Eliminar proxy",fr:"Supprimer le proxy",it:"Elimina proxy",da:"Slet proxy",pl:"Usuń proxy",ru:"Удалить прокси",ar:"حذف الوكيل",no:"Slett proxy","pt-BR":"Excluir proxy",th:"ลบพร็อกซี",tr:"Proxy sil",uk:"Видалити проксі"},"ui.proxy.deleteConfirm":{zh:"确定删除「{name}」?",en:'Delete "{name}"?',"zh-TW":"確定刪除「{name}」?",ko:'"{name}"을(를) 삭제하시겠습니까?',ja:"「{name}」を削除しますか?",de:"„{name}“ löschen?",es:'¿Eliminar "{name}"?',fr:"Supprimer « {name} » ?",it:'Eliminare "{name}"?',da:'Slet "{name}"?',pl:'Usunąć "{name}"?',ru:"Удалить «{name}»?",ar:'حذف "{name}"؟',no:'Slette "{name}"?',"pt-BR":'Excluir "{name}"?',th:'ลบ "{name}"?',tr:'"{name}" silinsin mi?',uk:"Видалити «{name}»?"},"ui.proxy.name":{zh:"名称",en:"Name","zh-TW":"名稱",ko:"이름",ja:"名前",de:"Name",es:"Nombre",fr:"Nom",it:"Nome",da:"Navn",pl:"Nazwa",ru:"Название",ar:"الاسم",no:"Navn","pt-BR":"Nome",th:"ชื่อ",tr:"Ad",uk:"Назва"},"ui.proxy.baseURL":{zh:"地址",en:"Base URL","zh-TW":"地址",ko:"주소",ja:"アドレス",de:"Adresse",es:"Dirección",fr:"Adresse",it:"Indirizzo",da:"Adresse",pl:"Adres",ru:"Адрес",ar:"العنوان",no:"Adresse","pt-BR":"Endereço",th:"ที่อยู่",tr:"Adres",uk:"Адреса"},"ui.proxy.apiKey":{zh:"API Key",en:"API Key","zh-TW":"API Key",ko:"API Key",ja:"API Key",de:"API Key",es:"API Key",fr:"API Key",it:"API Key",da:"API Key",pl:"API Key",ru:"API Key",ar:"API Key",no:"API Key","pt-BR":"API Key",th:"API Key",tr:"API Key",uk:"API Key"},"ui.proxy.models":{zh:"模型",en:"Models","zh-TW":"模型",ko:"모델",ja:"モデル",de:"Modelle",es:"Modelos",fr:"Modèles",it:"Modelli",da:"Modeller",pl:"Modele",ru:"Модели",ar:"النماذج",no:"Modeller","pt-BR":"Modelos",th:"โมเดล",tr:"Modeller",uk:"Моделі"},"ui.proxy.activeModel":{zh:"当前模型",en:"Active Model","zh-TW":"目前模型",ko:"현재 모델",ja:"現在のモデル",de:"Aktives Modell",es:"Modelo activo",fr:"Modèle actif",it:"Modello attivo",da:"Aktivt model",pl:"Aktywny model",ru:"Активная модель",ar:"النموذج النشط",no:"Aktiv modell","pt-BR":"Modelo ativo",th:"โมเดลที่ใช้งาน",tr:"Aktif model",uk:"Активна модель"},"ui.proxy.save":{zh:"保存",en:"Save","zh-TW":"儲存",ko:"저장",ja:"保存",de:"Speichern",es:"Guardar",fr:"Enregistrer",it:"Salva",da:"Gem",pl:"Zapisz",ru:"Сохранить",ar:"حفظ",no:"Lagre","pt-BR":"Salvar",th:"บันทึก",tr:"Kaydet",uk:"Зберегти"},"ui.proxy.cancel":{zh:"取消",en:"Cancel","zh-TW":"取消",ko:"취소",ja:"キャンセル",de:"Abbrechen",es:"Cancelar",fr:"Annuler",it:"Annulla",da:"Annuller",pl:"Anuluj",ru:"Отмена",ar:"إلغاء",no:"Avbryt","pt-BR":"Cancelar",th:"ยกเลิก",tr:"İptal",uk:"Скасувати"},"ui.proxy.openConfigDir":{zh:"打开配置文件目录",en:"Open config directory","zh-TW":"開啟設定檔目錄",ko:"설정 파일 디렉토리 열기",ja:"設定ファイルのディレクトリを開く",de:"Konfigurationsverzeichnis öffnen",es:"Abrir directorio de configuración",fr:"Ouvrir le dossier de configuration",it:"Apri cartella di configurazione",da:"Åbn konfigurationsmappe",pl:"Otwórz katalog konfiguracji",ru:"Открыть каталог конфигурации",ar:"فتح مجلد الإعدادات",no:"Åpne konfigurasjonsmappe","pt-BR":"Abrir diretório de configuração",th:"เปิดไดเรกทอรีการกำหนดค่า",tr:"Yapılandırma dizinini aç",uk:"Відкрити каталог конфігурації"},"ui.proxy.maxWarning":{zh:"如果你是 Claude 官方 Max 订阅用户,请勿使用该功能",en:"Do not use this feature if you are a Claude Max subscriber","zh-TW":"如果你是 Claude 官方 Max 訂閱用戶,請勿使用此功能",ko:"Claude Max 구독자인 경우 이 기능을 사용하지 마세요",ja:"Claude Max サブスクリプションをご利用の場合、この機能は使用しないでください",de:"Verwenden Sie diese Funktion nicht, wenn Sie Claude Max abonniert haben",es:"No utilice esta función si tiene suscripción Claude Max",fr:"N'utilisez pas cette fonction si vous êtes abonné Claude Max",it:"Non utilizzare questa funzione se sei abbonato a Claude Max",da:"Brug ikke denne funktion, hvis du har Claude Max-abonnement",pl:"Nie używaj tej funkcji, jeśli masz subskrypcję Claude Max",ru:"Не используйте эту функцию, если у вас подписка Claude Max",ar:"لا تستخدم هذه الميزة إذا كنت مشتركًا في Claude Max",no:"Ikke bruk denne funksjonen hvis du har Claude Max-abonnement","pt-BR":"Não use este recurso se você é assinante do Claude Max",th:"อย่าใช้ฟีเจอร์นี้หากคุณเป็นสมาชิก Claude Max",tr:"Claude Max abonesi iseniz bu özelliği kullanmayın",uk:"Не використовуйте цю функцію, якщо ви підписник Claude Max"},"ui.proxy.requiredFields":{zh:"名称、地址、API Key 为必填项",en:"Name, Base URL, and API Key are required","zh-TW":"名稱、地址、API Key 為必填項",ko:"이름, 주소, API Key는 필수 항목입니다",ja:"名前、アドレス、API Key は必須です",de:"Name, Adresse und API Key sind erforderlich",es:"Nombre, dirección y API Key son obligatorios",fr:"Nom, adresse et API Key sont obligatoires",it:"Nome, indirizzo e API Key sono obbligatori",da:"Navn, adresse og API Key er påkrævet",pl:"Nazwa, adres i API Key są wymagane",ru:"Название, адрес и API Key обязательны",ar:"الاسم والعنوان و API Key مطلوبة",no:"Navn, adresse og API Key er påkrevd","pt-BR":"Nome, endereço e API Key são obrigatórios",th:"ชื่อ ที่อยู่ และ API Key จำเป็นต้องกรอก",tr:"Ad, adres ve API Key zorunludur",uk:"Назва, адреса та API Key є обов'язковими"}},$u={};for(const[t,e]of Object.entries(tue))for(const[n,i]of Object.entries(e))$u[n]||($u[n]={}),$u[n][t]=i;let dP="zh";const em={zh:"zh","zh-cn":"zh","zh-hans":"zh","zh-tw":"zh-TW","zh-hk":"zh-TW","zh-hant":"zh-TW",en:"en",ko:"ko",de:"de",es:"es",fr:"fr",it:"it",da:"da",ja:"ja",pl:"pl",ru:"ru",ar:"ar",no:"no",nb:"no",nn:"no",pt:"pt-BR","pt-br":"pt-BR",th:"th",tr:"tr",uk:"uk"};function nue(t){if(!t)return"en";const e=t.toLowerCase().replace(/_/g,"-");if(em[e])return em[e];const n=e.split("-")[0];return em[n]?em[n]:"en"}function iue(){return typeof navigator<"u"&&navigator.language?nue(navigator.language):"en"}function NA(t){dP=$u[t]?t:"en"}function m_(){return dP}function le(t,e){var i;let n=((i=$u[dP])==null?void 0:i[t])||$u.en[t]||t;if(e)for(const[r,s]of Object.entries(e))n=n.replaceAll(`{${r}}`,s);return n}NA(iue());const j5=new URLSearchParams(window.location.search).get("token");function pt(t){if(!j5)return t;const e=t.includes("?")?"&":"?";return`${t}${e}token=${j5}`}const rue="_root_2zmas_2",sue="_inner_2zmas_10",oue="_header_2zmas_17",aue="_headerTitle_2zmas_22",lue="_headerFolderIcon_2zmas_27",cue="_headerSubtitle_2zmas_32",due="_addButtonRow_2zmas_36",uue="_loadingCenter_2zmas_42",hue="_emptyState_2zmas_47",Oue="_card_2zmas_52",fue="_cardRow_2zmas_59",pue="_cardLeft_2zmas_65",mue="_cardNameRow_2zmas_70",gue="_cardName_2zmas_70",vue="_cardPath_2zmas_82",$ue="_cardMeta_2zmas_87",bue="_dirPathHeader_2zmas_96",Sue="_dirCurrentPath_2zmas_104",yue="_dirFolderIcon_2zmas_113",_ue="_dirList_2zmas_118",Que="_dirListCenter_2zmas_124",xue="_dirItem_2zmas_129",wue="_dirItemInner_2zmas_137",Pue="_dirItemName_2zmas_145",Cue="_dirGitTag_2zmas_153",Tue="_dirFooter_2zmas_162",kue="_dirPathInputRow_2zmas_170",Rue="_dirPathInput_2zmas_170",ei={root:rue,inner:sue,header:oue,headerTitle:aue,headerFolderIcon:lue,headerSubtitle:cue,addButtonRow:due,loadingCenter:uue,emptyState:hue,card:Oue,cardRow:fue,cardLeft:pue,cardNameRow:mue,cardName:gue,cardPath:vue,cardMeta:$ue,dirPathHeader:bue,dirCurrentPath:Sue,dirFolderIcon:yue,dirList:_ue,dirListCenter:Que,dirItem:xue,dirItemInner:wue,dirItemName:Pue,dirGitTag:Cue,dirFooter:Tue,dirPathInputRow:kue,dirPathInput:Rue},{Text:Dc,Title:Eue}=kl;function Xue(t){if(!t)return"0 B";const e=["B","KB","MB","GB"];let n=0,i=t;for(;i>=1024&&n<e.length-1;)i/=1024,n++;return`${i.toFixed(n>0?1:0)} ${e[n]}`}function zue(t){if(!t)return"";const e=Date.now()-new Date(t).getTime(),n=Math.floor(e/6e4);if(n<1)return le("ui.workspaces.justNow");if(n<60)return`${n}m ago`;const i=Math.floor(n/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Iue({open:t,onClose:e,onSelect:n}){const[i,r]=f.useState(""),[s,o]=f.useState(null),[a,l]=f.useState([]),[c,d]=f.useState(!1),[u,h]=f.useState(""),O=f.useCallback(m=>{d(!0);const g=m?`/api/browse-dir?path=${encodeURIComponent(m)}`:"/api/browse-dir";fetch(pt(g)).then(v=>v.json()).then(v=>{v.error?ti.error(v.error):(r(v.current),o(v.parent),l(v.dirs||[]),h(v.current)),d(!1)}).catch(()=>{ti.error("Failed to browse directory"),d(!1)})},[]);f.useEffect(()=>{t&&O("")},[t,O]);const p=()=>{const m=u.trim();m&&O(m)};return w.jsxs(yi,{title:le("ui.workspaces.selectDir"),open:t,onCancel:e,footer:null,width:600,styles:{body:{padding:"12px 0"}},children:[w.jsxs("div",{className:ei.dirPathHeader,children:[w.jsx(ai,{type:"text",icon:w.jsx(Dde,{}),disabled:!s,onClick:()=>s&&O(s),size:"small"}),w.jsxs(Dc,{className:ei.dirCurrentPath,children:[w.jsx($v,{className:ei.dirFolderIcon}),i]})]}),w.jsx("div",{className:ei.dirList,children:c?w.jsx("div",{className:ei.dirListCenter,children:w.jsx(Ca,{})}):a.length===0?w.jsx("div",{className:ei.dirListCenter,children:w.jsx(Dc,{type:"secondary",children:le("ui.workspaces.emptyDir")})}):a.map(m=>w.jsxs("div",{className:ei.dirItem,onMouseEnter:g=>g.currentTarget.style.background="#1e1e1e",onMouseLeave:g=>g.currentTarget.style.background="transparent",children:[w.jsxs("div",{className:ei.dirItemInner,onClick:()=>O(m.path),children:[w.jsx(PA,{style:{color:m.hasGit?"#1668dc":"#666",fontSize:16,flexShrink:0}}),w.jsx(Dc,{className:ei.dirItemName,children:m.name}),m.hasGit&&w.jsxs(Sv,{color:"blue",className:ei.dirGitTag,children:[w.jsx(Zde,{style:{marginRight:2}}),"git"]})]}),w.jsx(ai,{type:"primary",size:"small",onClick:g=>{g.stopPropagation(),n(m.path)},children:le("ui.workspaces.select")})]},m.path))}),w.jsxs("div",{className:ei.dirFooter,children:[w.jsxs(ai,{type:"primary",ghost:!0,block:!0,icon:w.jsx($v,{}),onClick:()=>n(i),children:[le("ui.workspaces.selectCurrent")," — ",i.split("/").pop()||i]}),w.jsxs("div",{className:ei.dirPathInputRow,children:[w.jsx(Ko,{size:"small",value:u,onChange:m=>h(m.target.value),onPressEnter:p,placeholder:le("ui.workspaces.pathPlaceholder"),className:ei.dirPathInput}),w.jsx(ai,{size:"small",onClick:p,children:le("ui.workspaces.goTo")})]})]})]})}function Aue({onLaunch:t}){const[e,n]=f.useState([]),[i,r]=f.useState(!0),[s,o]=f.useState(null),[a,l]=f.useState(!1),c=()=>{fetch(pt("/api/workspaces")).then(O=>O.json()).then(O=>{n(O.workspaces||[]),r(!1)}).catch(()=>r(!1))};f.useEffect(()=>{c()},[]);const d=O=>{l(!1),fetch(pt("/api/workspaces/add"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:O})}).then(p=>p.json()).then(p=>{p.error?ti.error(p.error):c()}).catch(()=>ti.error("Failed to add workspace"))},u=O=>{fetch(pt(`/api/workspaces/${O}`),{method:"DELETE"}).then(p=>p.json()).then(()=>c()).catch(()=>{})},h=O=>{o(O.id),fetch(pt("/api/workspaces/launch"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:O.path})}).then(p=>p.json()).then(p=>{p.error?(ti.error(p.error),o(null)):t({projectName:p.projectName,path:O.path})}).catch(()=>{ti.error("Launch failed"),o(null)})};return w.jsxs("div",{className:ei.root,children:[w.jsxs("div",{className:ei.inner,children:[w.jsxs("div",{className:ei.header,children:[w.jsxs(Eue,{level:3,className:ei.headerTitle,children:[w.jsx($v,{className:ei.headerFolderIcon}),le("ui.workspaces.title")]}),w.jsx(Dc,{type:"secondary",className:ei.headerSubtitle,children:le("ui.workspaces.subtitle")})]}),w.jsx("div",{className:ei.addButtonRow,children:w.jsx(ai,{type:"primary",icon:w.jsx(QI,{}),onClick:()=>l(!0),size:"large",children:le("ui.workspaces.browse")})}),i?w.jsx("div",{className:ei.loadingCenter,children:w.jsx(Ca,{})}):e.length===0?w.jsx(Ls,{description:w.jsx(Dc,{type:"secondary",children:le("ui.workspaces.empty")}),className:ei.emptyState}):w.jsx(tA,{dataSource:e,renderItem:O=>w.jsx(Zw,{size:"small",className:ei.card,hoverable:!0,onClick:()=>h(O),children:w.jsxs("div",{className:ei.cardRow,children:[w.jsxs("div",{className:ei.cardLeft,children:[w.jsx("div",{className:ei.cardNameRow,children:w.jsx(Dc,{strong:!0,className:ei.cardName,children:O.projectName})}),w.jsx(Dc,{type:"secondary",className:ei.cardPath,children:O.path}),w.jsxs("div",{className:ei.cardMeta,children:[w.jsxs("span",{children:[w.jsx(Qre,{style:{marginRight:4}}),zue(O.lastUsed)]}),O.logCount>0&&w.jsxs("span",{children:[w.jsx(Hde,{style:{marginRight:4}}),O.logCount," logs (",Xue(O.totalSize),")"]})]})]}),w.jsxs(a$,{children:[w.jsx(ai,{type:"primary",icon:w.jsx(eue,{}),loading:s===O.id,onClick:p=>{p.stopPropagation(),h(O)},children:le("ui.workspaces.open")}),w.jsx(sA,{title:le("ui.workspaces.confirmRemove"),onConfirm:p=>{p==null||p.stopPropagation(),u(O.id)},onCancel:p=>p==null?void 0:p.stopPropagation(),okText:"Yes",cancelText:"No",children:w.jsx(ai,{type:"text",danger:!0,icon:w.jsx(qce,{}),onClick:p=>p.stopPropagation()})})]})]})},O.id)})]}),w.jsx(Iue,{open:a,onClose:()=>l(!1),onSelect:d})]})}const Mue="_iconBtn_5ojec_1",jue={iconBtn:Mue};function Nue({apiEndpoint:t,title:e,size:n=16}){const[i,r]=f.useState(!1),s=c=>{c.stopPropagation(),fetch(t,{method:"POST"}).catch(()=>{})},o=c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),s(c))},a=w.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})}),l=w.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-accent-yellow)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("path",{d:"M5 19a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4l2 2h5a2 2 0 0 1 2 2v1",fill:"none"}),w.jsx("path",{d:"M20 10H8.5A2.5 2.5 0 0 0 6 12.5L5 19h13.5a2 2 0 0 0 2-1.75l1-6.25A1 1 0 0 0 20.5 10z",fill:"var(--color-accent-yellow)",stroke:"var(--color-accent-yellow)"})]});return w.jsx("span",{role:"button",tabIndex:0,onClick:s,onKeyDown:o,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),title:e,className:jue.iconBtn,style:{opacity:i?1:.7},children:i?l:a})}function Wue(t){const e=t==null?void 0:t.system;return typeof e=="string"?e:Array.isArray(e)?e.map(n=>n&&n.text||"").join(""):""}const Lue=/You are a Claude agent/i,qb=new WeakMap;function g_(t){if(!t)return!1;const e=qb.get(t);if(e!==void 0)return e;if(t.teammate)return qb.set(t,!1),!1;const n=Wue(t.body||{}),i=Lue.test(n);return qb.set(t,i),i}function Vue(t){if(!(t!=null&&t.body))return null;const e=t.body.messages||[];if(e.length===0)return null;for(const n of e){if(n.role!=="user")continue;const i=n.content;let r="";if(typeof i=="string"?r=i:Array.isArray(i)&&(r=i.filter(o=>o&&o.type==="text").map(o=>o.text||"").join(" ")),!r)continue;const s=r.match(/Agent\s+(?:oh-my-claudecode:)?(\S+)\s+started/i)||r.match(/You are (\w+)[,.]/)||r.match(/name[::]\s*["']?(\w+)/i);if(s)return s[1]}return null}const N5=/command execution specialist|file search specialist|planning specialist|general-purpose agent/i,WA=/running as an agent in a team|Agent Teammate Communication/i;function Vu(t){const e=t==null?void 0:t.system;return typeof e=="string"?e:Array.isArray(e)?e.map(n=>n&&n.text||"").join(""):""}const tm=new WeakMap;function uP(t){if(!t)return!1;const e=tm.get(t);if(e!==void 0)return e;if(t.teammate)return tm.set(t,!0),!0;if(g_(t))return t.teammate||(t.teammate=Vue(t)||null),tm.set(t,!0),!0;const n=Vu(t.body||{}),i=WA.test(n);return tm.set(t,i),i}const W5=new WeakMap;function js(t){if(!t)return!1;const e=W5.get(t);if(e!==void 0)return e;const n=Bue(t);return W5.set(t,n),n}function Bue(t){if(!t||uP(t))return!1;if(t.mainAgent){const s=Vu(t.body||{});return!N5.test(s)}const e=t.body||{};if(!e.system||!Array.isArray(e.tools))return!1;const n=Vu(e);if(!n.includes("You are Claude Code")||N5.test(n))return!1;const i=Array.isArray(e.system),r=e.tools.some(s=>s.name==="ToolSearch");if(i&&r){const s=e.messages||[];if((s.length>0?typeof s[0].content=="string"?s[0].content:Array.isArray(s[0].content)?s[0].content.map(a=>a.text||"").join(""):"":"").includes("<available-deferred-tools>"))return!0}if(e.tools.length>5){const s=e.tools.some(l=>l.name==="Edit"),o=e.tools.some(l=>l.name==="Bash"),a=e.tools.some(l=>l.name==="Task"||l.name==="Agent");if(s&&o&&a)return!0}return!1}function v_(t){return t?/^Base directory for this skill:/i.test(t.trim()):!1}function yv(t){if(!t)return!0;const e=t.trim();return e?/Implement the following plan:/i.test(e)?!1:!!(/^<[a-zA-Z_][\w-]*[\s>]/i.test(e)||/^\[SUGGESTION MODE:/i.test(e)||/^Your response was cut off because it exceeded the output token limit/i.test(e)||/^Base directory for this skill:/i.test(e)):!0}function $_(t){if(!Array.isArray(t))return{commands:[],textBlocks:[],skillBlocks:[]};const e=t.some(s=>s.type==="text"&&/<command-message>/i.test(s.text||"")),n=[];if(e)for(const s of t){if(s.type!=="text")continue;const o=(s.text||"").match(/<command-name>\s*([^<]*)<\/command-name>/i);if(o){const a=o[1].trim();n.push(a.startsWith("/")?a:`/${a}`)}}let i=t.filter(s=>s.type==="text"&&!yv(s.text));e&&(i=i.filter(s=>!/<command-message>/i.test(s.text||"")));const r=i.filter(s=>v_(s.text));return r.length>0&&(i=i.filter(s=>!v_(s.text))),{commands:n,textBlocks:i,skillBlocks:r}}function Yue(t){var n;const e=t==null?void 0:t.messages;if(!Array.isArray(e))return null;for(let i=e.length-1;i>=0;i--){const r=e[i].content;if(Array.isArray(r))for(const s of r){if(s.type!=="tool_result")continue;const o=Array.isArray(s.content)?s.content:[s];for(const a of o){const l=a.text||(typeof a.content=="string"?a.content:"");if(!(!l||!l.includes('"sender"')))try{const c=JSON.parse(l);if((n=c==null?void 0:c.routing)!=null&&n.sender)return c.routing.sender}catch{}}}}return null}const nm=new Map;let Zb=0,L5=null;const V5=60,B5=/<teammate-message[^>]*>/;function Due(t){var r;const e=(r=t.body)==null?void 0:r.messages;if(!Array.isArray(e)||e.length===0)return"";const i=e[0].content;if(typeof i=="string"){const s=B5.exec(i);return s?i.slice(s.index+s[0].length).trimStart():""}if(Array.isArray(i))for(const s of i){if(s.type!=="text"||!s.text)continue;const o=B5.exec(s.text);if(o)return s.text.slice(o.index+o[0].length).trimStart()}return""}function Uue(t){var r;const e=(r=t.body)==null?void 0:r.messages;if(!Array.isArray(e)||e.length===0)return"";const i=e[0].content;if(typeof i=="string")return i.trimStart();if(Array.isArray(i)){for(const s of i)if(s.type==="text"&&s.text)return s.text.trimStart()}return""}function Y5(t){var n,i,r;if(!Array.isArray(t)||t.length===0)return;const e=((n=t[0])==null?void 0:n.timestamp)||null;e!==L5&&(nm.clear(),Zb=0,L5=e);for(let s=Zb;s<t.length;s++){const o=t[s];if(!o.mainAgent)continue;const a=(r=(i=o.response)==null?void 0:i.body)==null?void 0:r.content;if(Array.isArray(a))for(const l of a){if(l.type!=="tool_use"||l.name!=="Agent")continue;const c=l.input;if(!c||!c.name||!c.prompt)continue;const d=c.prompt.trimStart().slice(0,V5);d&&nm.set(d,c.name)}}if(Zb=t.length,nm.size!==0)for(const s of t){if(s.teammate||!g_(s)&&!WA.test(Vu(s.body||{})))continue;let o=Due(s);if(!o&&g_(s)&&(o=Uue(s)),!o)continue;const a=o.slice(0,V5),l=nm.get(a);l&&(s.teammate=l,s._cachedTeammateName===null&&(s._cachedTeammateName=l))}}function que(t){let e=-1,n=0,i=null;return{process(r,s,o){var d,u,h;if(!t(r)||!r.body||!Array.isArray(r.body.messages)||r.body.messages.length===0)return r;const a=r.body.messages.length,l=((d=r.body.metadata)==null?void 0:d.user_id)||null,c=n>0&&(a<n*.5&&n-a>4||i&&l&&l!==i);if(c&&a<=4&&n>4)return r;if(c)return e=o,n=a,i=l,r;if(e>=0&&e<s.length){const O=s[e];if(((h=(u=O.body)==null?void 0:u.messages)==null?void 0:h.length)>0){const p=O.body.messages.length,m=O._prevMsgCount||0,g=[];for(let v=m;v<p;v++)g.push(v);O._messageCount=p,O._messagesIndex=g,O._slimmed=!0,O.body.messages=[]}}return r._prevMsgCount=n,e=o,n=a,i=l,r},finalize(r){var c,d,u,h,O,p;let s=[],o=-1,a=0,l=null;for(let m=0;m<r.length;m++){const g=r[m],v=g._slimmed,$=((d=(c=g.body)==null?void 0:c.messages)==null?void 0:d.length)>0;if(!v&&!$||!v&&!t(g))continue;const b=g._messageCount||((h=(u=g.body)==null?void 0:u.messages)==null?void 0:h.length)||0,S=((p=(O=g.body)==null?void 0:O.metadata)==null?void 0:p.user_id)||null,y=a>0&&(b<a*.5&&a-b>4||l&&S&&S!==l);if(!(y&&b<=4&&a>10)){if(y){for(const Q of s)r[Q]._fullEntryIndex=o;s=[],o=-1,a=0}v&&s.push(m),($||!v)&&(o=m),a=b,l=S}}for(const m of s)r[m]._fullEntryIndex=o}}}function Zue(t,e){var i;if(!t._slimmed||t._fullEntryIndex==null)return t;const n=e[t._fullEntryIndex];return!((i=n==null?void 0:n.body)!=null&&i.messages)||n.body.messages.length<t._messageCount?t:{...t,body:{...t.body,messages:n.body.messages.slice(0,t._messageCount),system:n.body.system}}}function Gue(t){let e=-1,n=0,i=null;const r=new Set;return{processEntry(s,o,a){var u,h,O,p,m;if(!t(s)||!((h=(u=s.body)==null?void 0:u.messages)!=null&&h.length))return s;const l=s.body.messages.length,c=((O=s.body.metadata)==null?void 0:O.user_id)||null,d=n>0&&(l<n*.5&&n-l>4||i&&c&&c!==i);if(d&&l<=4&&n>4)return s;if(d)return r.clear(),e=a,n=l,i=c,s;if(e>=0&&e<o.length){const g=o[e];if(((m=(p=g.body)==null?void 0:p.messages)==null?void 0:m.length)>0){const v={...g,body:{...g.body},_messageCount:g.body.messages.length,_slimmed:!0,_fullEntryIndex:a};v.body.messages=[],o[e]=v,r.add(e)}}for(const g of r)o[g]._fullEntryIndex!==a&&(o[g]={...o[g],_fullEntryIndex:a});return s._prevMsgCount=n,e=a,n=l,i=c,s},onDedup(s){r.delete(s)}}}const Fue=[{match:/\[1m\]/i,tokens:1e6},{match:/opus/i,tokens:1e6},{match:/claude/i,tokens:2e5},{match:/gpt-4o|o1|o3|o4/i,tokens:128e3},{match:/gpt-4/i,tokens:128e3},{match:/gpt-3/i,tokens:16e3},{match:/deepseek/i,tokens:128e3}];function iBe(t){if(!t)return 2e5;for(const e of Fue)if(e.match.test(t))return e.tokens;return 2e5}function LA(t,e,n,i){var r,s;for(let o=n;o<e.length;o++){const a=e[o];if(js(a)){if(i){const l=(s=(r=a.response)==null?void 0:r.body)==null?void 0:s.usage;if(l){const c=l.cache_creation_input_tokens||0,d=l.cache_read_input_tokens||0;if(c>0&&c>d){const u=i._slimmed?Zue(i,e):i,h=Kue(u,a);h&&t.set(o,h)}}}i=a}}return i}function Hue(t){const e=new Map;return LA(e,t,0,null),e}const D5=new WeakMap;function im(t,e){let n=D5.get(t);if(n||(n={},D5.set(t,n)),n[e]===void 0){const i=gf(t.body);n[e]=JSON.stringify(i==null?void 0:i[e])}return n[e]}function Kue(t,e){if(e.timestamp-t.timestamp>300*1e3)return{reason:"ttl",reasons:["ttl"]};const i=gf(t.body),r=gf(e.body);if(!i||!r)return{reason:"key_change",reasons:["key_change"]};const s=[];i.model!==r.model&&s.push("model_change");const o=im(t,"system"),a=im(e,"system");o!==a&&s.push("system_change");const l=im(t,"tools"),c=im(e,"tools");l!==c&&s.push("tools_change");const d=i.messages||[],u=r.messages||[];if(u.length<d.length)s.push("msg_truncated");else{const h=Math.min(d.length,u.length);let O=!0;for(let p=0;p<h;p++)if(JSON.stringify(d[p])!==JSON.stringify(u[p])){O=!1;break}O||s.push("msg_modified")}return s.length===0&&s.push("key_change"),{reason:s[0],reasons:s}}function b_(t){return t?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):""}function VA(t){return t.content?typeof t.content=="string"?t.content:Array.isArray(t.content)?t.content.filter(e=>e.type==="text").map(e=>e.text).join(`
717
- `):JSON.stringify(t.content):String(t.content??"")}const Jue=[{match:/claude/i,name:"Claude",color:"#000000",svg:'<svg t="1771495509570" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1570" width="200" height="200"><path d="M198.4 678.4l198.4-115.2 6.4-12.8H243.2l-96-6.4-102.4-6.4-19.2-6.4-25.6-25.6v-12.8l19.2-12.8h32l64 6.4 96 6.4 70.4 6.4L384 512h19.2V492.8l-6.4-6.4-102.4-64-108.8-76.8-51.2-38.4-32-19.2-19.2-25.6-6.4-38.4 32-32h44.8l38.4 32 83.2 64L384 364.8l12.8 12.8 6.4-6.4-6.4-12.8L339.2 256l-64-108.8-25.6-38.4-6.4-25.6c0-12.8-6.4-19.2-6.4-32l32-44.8 19.2-6.4 44.8 6.4 19.2 12.8 25.6 57.6 44.8 96 64 128 19.2 38.4 6.4 38.4 6.4 12.8h6.4V384l6.4-70.4 12.8-89.6 12.8-115.2 6.4-32 19.2-38.4 32-19.2 25.6 12.8 19.2 32v19.2l-32 70.4-19.2 121.6-19.2 83.2h6.4l12.8-12.8 44.8-57.6 70.4-89.6 32-32 38.4-38.4 25.6-19.2h44.8l32 51.2-12.8 51.2-51.2 57.6-38.4 51.2-51.2 70.4-38.4 57.6v6.4h6.4l121.6-25.6 64-12.8 76.8-12.8 38.4 19.2 6.4 19.2-12.8 32-83.2 19.2-96 19.2-147.2 32 64 6.4h96l128 6.4 32 19.2 25.6 38.4-6.4 19.2-51.2 25.6-70.4-12.8-160-38.4-57.6-12.8h-6.4v6.4l44.8 44.8 83.2 76.8 108.8 102.4 6.4 25.6-12.8 19.2h-12.8l-96-70.4-38.4-32-83.2-70.4h-6.4v6.4l19.2 25.6 102.4 147.2 6.4 44.8-6.4 12.8-25.6 6.4-25.6-6.4-57.6-83.2-64-83.2-51.2-83.2-6.4 6.4-25.6 307.2-12.8 12.8-32 12.8-25.6-19.2-12.8-32 12.8-64 19.2-83.2 12.8-64 12.8-83.2 6.4-25.6h-6.4l-64 83.2-96 128-70.4 76.8-19.2 6.4-32-12.8v-25.6l19.2-25.6 102.4-128 64-83.2 38.4-51.2v-6.4l-268.8 172.8-51.2 12.8-19.2-19.2v-32l12.8-12.8 76.8-57.6z m0 0" fill="#D97757" p-id="1571"></path></svg>'},{match:/gpt|o1|o3|o4/i,name:"OpenAI",color:"#00000",svg:'<svg t="1771495569354" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2752" width="200" height="200"><path d="M565.265178 954.519092c-22.289934 0-48.400999-8.151747-67.952455-14.838727a103.425292 103.425292 0 0 1-26.875292-11.272338c-12.737105-7.769634-15.411897-8.342804-19.806198-24.773669 21.971506-5.158528 81.581157-41.905075 103.871091-55.342721 148.896757-89.159735 119.028246-10.444426 119.028246-364.981743 15.029784 3.566389 82.791182 32.415932 82.791182 57.316972 0 133.102747 20.570425 273.847757-52.604243 354.91943-22.799418 25.47421-91.834527 58.972796-138.388646 58.972796z m-433.061569-299.321966c258.626916 136.860193 184.369594 157.048504 357.721593 52.094759 44.579867-27.193719 90.433445-49.292596 132.593263-77.568969v101.896839c-95.528287 22.226248-272.319304 227.038896-419.050754 100.686815l-25.856323-25.155782c-37.319718-43.943012-45.344094-72.410442-45.344094-151.889977z m375.744596-19.105658c-19.933569-13.310275-79.479535-51.330533-101.896839-57.316972v-133.739602a1158.312326 1158.312326 0 0 0 101.896839-57.316973c43.943012 10.189684 70.690933 47.063603 114.633945 57.316973v127.371049c-17.831947 12.10025-95.846715 58.718054-114.633945 63.749211z m-426.693016-178.31947c0-63.685525-4.26693-90.306074 38.84817-145.776166 23.945757-30.88748 47.509402-39.612396 82.090641-57.953828v261.110652c44.134069 23.372588 83.873836 49.037854 129.345301 74.448379l131.765351 78.396881c-59.545966 15.921381-63.685525 61.32916-109.602788 33.753328-104.699003-62.730242-272.38299-129.345301-272.38299-243.91556z m866.123138 127.37105c0 79.543221-47.573087 161.188063-121.002497 178.31947v-165.582365c0-82.791182 9.743885-84.574377-48.910483-116.608196L565.265178 362.371082c15.79401-23.62733 22.608361-19.105657 48.146256-34.835982 41.714019-25.47421 39.039227-16.112438 117.053995 28.785857 94.190891 54.196382 216.849212 100.559444 216.849212 228.885777z m-541.326961-197.425127v-95.528287c43.751956-23.181531 90.688187-50.94842 133.357489-76.804743 82.154327-49.547338 95.528287-63.303412 185.006449-63.303412 48.464684 0 102.533695 36.746548 125.651541 65.405034 42.223503 52.22213 39.930824 92.662439 39.930824 151.125751-31.078536-16.494551-192.393971-121.002497-222.899337-121.002498s-229.650003 123.422547-261.110652 140.108155z m-50.94842 159.213812c-16.36718-10.95391-63.112355-39.99451-82.791183-44.579867 0-168.320842-33.880699-314.606493 67.952455-390.519639 56.043262-41.714019 113.169178-53.814269 181.376375-30.696423 25.47421 8.661231 35.536523 20.888852 56.36169 26.429493-11.781822 16.048752-80.68956 50.311565-102.278953 63.303412-154.564769 93.235608-120.620384 7.451206-120.620384 376.063024z m-292.953415 121.002498c0 169.148754 115.143429 280.853165 274.293556 273.847756 59.800708-2.674792 26.811606-7.705949 69.417222 25.47421 97.820966 76.741057 228.822091 73.747838 319.637649 1.018969a251.939936 251.939936 0 0 0 52.604244-55.661149c58.20857-85.274918-10.95391-45.598836 81.96327-83.619094 130.236898-53.241099 199.399378-217.358696 128.64476-355.428914-27.448461-53.559526-40.249252-28.849543-28.276373-104.699003 18.723544-118.582447-63.176041-230.032116-157.621674-269.771884-98.90362-41.586648-129.090559 12.737105-178.892639-37.574459A161.888604 161.888604 0 0 0 580.103905 28.913674C474.003821-27.766443 331.284559 1.528898 258.428319 93.681853c-81.326415 102.979494 9.489143 54.705866-92.407697 98.648878C15.149614 257.353652-33.251385 439.175825 41.579107 561.06992c56.807488 92.598753 20.570425 4.967471 20.570424 106.800625z" fill="#EFA474" p-id="2753"></path></svg>'},{match:/gemini/i,name:"Gemini",color:"#000000",svg:'<svg t="1771495622863" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4556" width="200" height="200"><path d="M960 512.896A477.248 477.248 0 0 0 512.896 960h-1.792A477.184 477.184 0 0 0 64 512.896v-1.792A477.184 477.184 0 0 0 511.104 64h1.792A477.248 477.248 0 0 0 960 511.104z" fill="#448AFF" p-id="4557"></path></svg>'},{match:/qwen/i,name:"Qwen",color:"#00000",svg:'<svg t="1771495640319" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5634" width="200" height="200"><path d="M537.782857 57.161143c16.749714 29.44 33.426286 58.953143 50.102857 88.502857a7.68 7.68 0 0 0 6.692572 3.913143h236.873143c7.424 0 13.750857 4.681143 19.017142 13.933714l62.061715 109.677714c8.082286 14.372571 10.24 20.370286 1.024 35.693715a2262.893714 2262.893714 0 0 0-32.438857 55.478857l-15.652572 28.086857c-4.534857 8.338286-9.508571 11.922286-1.718857 21.833143l113.152 197.851428c7.314286 12.8 4.754286 21.065143-1.828571 32.841143-18.651429 33.499429-37.632 66.742857-56.978286 99.84-6.765714 11.593143-14.994286 16.018286-29.001143 15.798857a1833.398857 1833.398857 0 0 0-99.291429 0.658286 4.242286 4.242286 0 0 0-3.437714 2.157714 24571.830857 24571.830857 0 0 1-115.419428 202.24c-7.204571 12.507429-16.201143 15.469714-30.939429 15.506286-42.532571 0.146286-85.430857 0.182857-128.731429 0.109714a22.930286 22.930286 0 0 1-19.821714-11.556571l-56.978286-99.108571a3.84 3.84 0 0 0-3.547428-2.121143h-218.331429a76.288 76.288 0 0 1-34.377143-3.913143l-68.388571-118.198857a23.149714 23.149714 0 0 1-0.073143-23.04l51.492572-90.441143a8.448 8.448 0 0 0 0-8.411429 23594.496 23594.496 0 0 1-80.018286-139.593143L47.542857 425.325714c-6.838857-13.202286-7.387429-21.138286 4.022857-41.179428 19.858286-34.669714 39.570286-69.302857 59.209143-103.936 5.632-9.984 12.946286-14.262857 24.905143-14.262857 36.827429-0.182857 73.654857-0.182857 110.445714-0.073143 1.901714 0 3.657143-1.024 4.571429-2.669715l119.734857-208.859428a20.845714 20.845714 0 0 1 17.993143-10.496c22.381714-0.036571 44.946286 0 67.547428-0.256l43.410286-0.987429c14.555429-0.109714 30.866286 1.389714 38.4 14.518857z m-146.432 17.188571a2.56 2.56 0 0 0-2.194286 1.28l-122.331428 213.942857a6.692571 6.692571 0 0 1-5.741714 3.364572H138.788571c-2.377143 0-2.962286 1.060571-1.755428 3.145143l247.917714 433.334857c1.060571 1.792 0.548571 2.633143-1.462857 2.669714l-119.222857 0.658286a9.289143 9.289143 0 0 0-8.557714 4.937143l-56.32 98.56c-1.865143 3.328-0.914286 5.046857 2.925714 5.046857l243.858286 0.365714c1.974857 0 3.401143 0.841143 4.425142 2.56l59.867429 104.704c1.974857 3.474286 3.913143 3.510857 5.924571 0l213.577143-373.76 33.426286-58.953143a2.340571 2.340571 0 0 1 4.096 0l60.745143 107.958857a5.193143 5.193143 0 0 0 4.571428 2.633143l117.906286-0.841143a1.718857 1.718857 0 0 0 1.462857-2.56l-123.721143-217.014857a4.608 4.608 0 0 1 0-4.827428l12.507429-21.613715 47.798857-84.370285c1.024-1.755429 0.512-2.633143-1.499428-2.633143H392.521143c-2.486857 0-3.108571-1.097143-1.828572-3.291429l61.184-106.861714a4.571429 4.571429 0 0 0 0-4.864l-58.258285-102.253714a2.56 2.56 0 0 0-2.267429-1.316572z m268.361143 342.198857c1.974857 0 2.486857 0.841143 1.462857 2.56l-35.474286 62.500572-111.542857 195.620571a2.377143 2.377143 0 0 1-2.121143 1.243429 2.486857 2.486857 0 0 1-2.121142-1.243429l-147.346286-257.353143c-0.841143-1.462857-0.402286-2.230857 1.206857-2.304l9.216-0.512 286.793143-0.512h-0.073143z" fill="#7D5DED" p-id="5635"></path></svg>'},{match:/kimi|moonshot/i,name:"Kimi",color:"#00000",svg:'<svg t="1771495664798" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6649" width="200" height="200"><path d="M731.062857 590.262857v318.317714h-148.589714V443.977143a146.285714 146.285714 0 0 1-146.285714 146.285714l-214.491429-0.036571v318.354285H73.142857V165.814857h148.553143v275.858286h180.882286l119.771428-275.858286h167.753143l-67.84 156.269714a255.524571 255.524571 0 0 1-106.678857 119.588572h66.925714a148.553143 148.553143 0 0 1 148.516572 148.589714z m120.758857-473.965714a99.035429 99.035429 0 0 1 0 198.070857h-99.035428V215.332571a99.035429 99.035429 0 0 1 99.035428-99.035428z" fill="#F4F4F4" p-id="6650"></path></svg>'},{match:/glm|chatglm/i,name:"GLM",color:"#00000",svg:'<svg data-name="glm" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 217.2 200"> <!-- Generator: Adobe Illustrator 29.8.2, SVG Export Plug-In . SVG Version: 2.1.1 Build 3) --> <defs> <style> .st0 { fill: #fff; } </style> </defs> <path class="st0" d="M86.8,190.4H0L131.3,4.8h85.8L86.8,190.4h0ZM212.8,190h-107.9l14.9-21.6c2.3-3.3,6-5.2,9.9-5.2h83.1v26.8h0ZM99.4,26.3c-2.3,3.3-6,5.2-9.9,5.2H6.4V4.8h107.9l-14.9,21.6Z"/> </svg>'},{match:/minimax|abab/i,name:"MiniMax",color:"#00000",svg:'<svg viewBox="0 0 24 24" fill="#fff"><path d="M4 8l4-4 4 4 4-4 4 4v8l-4 4-4-4-4 4-4-4z" fill="none" stroke="#fff" stroke-width="1.5" stroke-linejoin="round"/></svg>'},{match:/deepseek/i,name:"DeepSeek",color:"#00000",svg:'<svg t="1771495947541" class="icon" viewBox="0 0 1391 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11539" width="200" height="200"><path d="M1326.70201318 112.02090779c-12.94676356-6.47485468-18.53640721 5.86654827-26.0997327 12.13814316-2.57756953 2.02376031-4.77807747 4.65435413-6.9785854 7.08168819-18.91788751 20.63528526-41.02017805 34.19182812-69.92725218 32.57311444-42.23384508-2.42733405-78.29772513 11.12773591-110.16384908 44.10589703-6.77679853-40.66668282-29.28560862-64.94444203-63.55255448-80.52327231-17.95608583-8.09209545-36.06388005-16.1856638-48.63358202-33.78825438-8.74900746-12.5431898-11.12773591-26.50330641-15.52727888-40.26016327-2.7823022-8.29535522-5.56460442-16.79249731-14.92044538-18.20942411-10.19244639-1.61871367-14.16337637 7.08168818-18.15934561 14.36516325-15.93232553 29.74073376-22.12880269 62.51710799-21.49692994 95.69705596 1.36684831 74.65672404 32.27117059 134.13819156 93.62469006 176.42358804 6.9800583 4.8546681 8.77551959 9.71080912 6.57501165 16.79102439-4.17271686 14.56695011-9.18056624 28.7303265-13.55506995 43.29727663-2.78377509 9.30723537-6.95501906 11.32952278-16.74241882 7.28347507-33.66158524-14.36516325-62.745407-35.60875491-88.46513227-61.30196806-43.62425973-43.09548975-83.0772755-90.64060097-132.26613965-127.86659667a581.67054343 581.67054343 0 0 0-35.07703915-24.48101901c-50.20074429-49.77065841 6.57501167-90.63912807 19.72650789-95.49526908 13.73181759-5.05792788 4.77955037-22.4572587-39.65480265-22.25547181s-85.07599655 15.3770434-136.87041526 35.60875491c-7.58541892 3.03416756-15.55379103 5.25971475-23.69596499 7.08168819-47.03990759-9.10544849-95.84876434-11.12773591-146.8596019-5.26118765-96.02551195 10.92594905-172.73103555 57.25739323-229.12678412 136.36373875-67.72674425 95.09022244-83.68558192 203.13015422-64.13582165 315.82149435 20.48504978 118.76262107 79.88992666 217.09027084 171.13736114 293.97106918 94.6350973 79.71317902 203.61031862 118.76262107 327.93607117 111.27735913 75.51542292-4.45256725 159.57953934-14.77020989 254.41642354-96.71040901 23.92426399 12.13961607 49.03715574 16.99575708 90.66564019 20.63675815 32.09295007 3.03416756 62.97223311-1.61871367 86.87145788-6.67664152 37.45429471-8.09209545 34.84874013-43.49906349 21.31870939-49.97244528-109.7838417-52.19946535-85.68283009-30.95587367-107.58333373-48.15194474 55.78891504-67.37324899 139.85303146-137.3770918 172.73103555-364.17669887 2.60408167-18.00616433 0.40357375-29.33568711 0-43.90263724-0.20325977-8.90218873 1.76894914-12.34287584 11.75960867-13.35328309 27.49014733-3.23742733 54.19671351-10.92594905 78.70277179-24.68280588 71.11440706-39.65480265 99.81822142-104.80250446 106.59649284-182.89844271 1.01188015-11.9363563-0.20178686-24.27775924-12.56970195-30.54935413M706.87018452 814.87993343c-106.36966673-85.37941333-157.98733782-113.5014334-179.30604722-112.28776638-19.92829476 1.21366703-16.33737217 24.48101902-11.96286844 39.65480264 4.5777635 14.97199677 10.57098089 25.2896394 18.94145384 38.44113563 5.76786417 8.70040186 9.76383341 21.64863831-5.78995762 31.35944742-34.26841876 21.64863831-93.82647692-7.28347506-96.60730623-8.69892897-69.3454579-41.67856295-127.33635378-96.710409-168.1797842-171.97249368-39.45154288-72.43117687-62.33888747-150.1220685-66.13306983-233.07267483-1.01188015-20.02992464 4.77955037-27.11161282 24.27923214-30.75408682a235.19659216 235.19659216 0 0 1 77.91771774-2.02228741c108.59668681 16.18713669 201.05631542 65.75453531 278.54394728 144.25552022 44.23256614 44.71125762 77.69089163 98.12439001 112.1861365 150.32385536 36.64567431 55.43394691 76.0986901 108.24024576 126.29943438 151.53604947 17.72778682 15.17378365 31.86465106 26.7065662 45.41972102 35.20370829-40.84343042 4.65435413-108.99878765 5.66476139-155.60860936-31.96628094m51.00936468-334.83953883c0-8.90218873 6.9815312-15.98387693 15.75557791-15.98387693q2.98408908 0.05155138 5.36134463 1.01188017a15.85720779 15.85720779 0 0 1 10.16740714 14.97199676 15.78061715 15.78061715 0 0 1-15.73053865 15.98387691 15.60386953 15.60386953 0 0 1-15.55379103-15.98387691m158.39238446 82.95060635c-10.1423679 4.24930749-20.30830215 7.89178146-30.09570191 8.29535522-15.12370514 0.81009328-31.66286419-5.46150162-40.61513142-13.15002332-13.96011661-11.93782919-23.92573689-18.61447073-28.09845373-39.45301577-1.79546129-8.90218873-0.81009328-22.65904557 0.78505403-30.54935414 3.59092258-16.99575708-0.40504665-27.92023321-12.13961606-37.8343021-9.55910075-8.09356835-21.72522894-10.31911553-35.07703915-10.31911552-4.98281013 0-9.55910075-2.22407429-12.94823645-4.04604774a13.27669246 13.27669246 0 0 1-5.76639128-18.61299783c1.39041466-2.8323807 8.16868608-9.71228202 9.7623605-10.92594905 18.13136058-10.52090241 39.04649623-7.08021529 58.36795748 0.81009328 17.93104659 7.48526194 31.46107731 21.24359167 51.01083757 40.6666828 19.92829476 23.46913885 23.51921733 29.94399353 34.84874013 47.54511123 8.97877936 13.75685685 17.14746545 27.92023321 22.71206987 44.10442409 3.41270206 10.11732865-0.98684091 18.41121097-12.74644958 23.46913885" fill="#4D6BFE" p-id="11540"></path></svg>'}];function S_(t){if(!t)return null;for(const e of Jue)if(e.match.test(t))return{name:t.replace(/^claude-/,"").replace(/-\d{8,}$/,""),provider:e.name,color:e.color,svg:e.svg};return{name:t,provider:t,color:"#065f46",svg:null}}function y_(t){return t==="user"?'<svg viewBox="0 0 24 24"><path d="M12 12c2.7 0 4.8-2.1 4.8-4.8S14.7 2.4 12 2.4 7.2 4.5 7.2 7.2 9.3 12 12 12zm0 2.4c-3.2 0-9.6 1.6-9.6 4.8v2.4h19.2v-2.4c0-3.2-6.4-4.8-9.6-4.8z"/></svg>':t==="agent"?'<svg viewBox="0 0 24 24"><path d="M12 2a2 2 0 012 2c0 .74-.4 1.39-1 1.73V7h1a7 7 0 017 7h1a1 1 0 011 1v3a1 1 0 01-1 1h-1.17A7 7 0 0113 22h-2a7 7 0 01-6.83-3H3a1 1 0 01-1-1v-3a1 1 0 011-1h1a7 7 0 017-7h1V5.73c-.6-.34-1-.99-1-1.73a2 2 0 012-2zM9.5 13a1.5 1.5 0 100 3 1.5 1.5 0 000-3zm5 0a1.5 1.5 0 100 3 1.5 1.5 0 000-3z"/></svg>':t==="sub-search"||t==="sub-explore"?'<svg viewBox="0 0 1024 1024"><path d="M128.957606 76.608479v495.401496c0 20.428928-17.875312 38.304239-38.304239 38.304239S52.349127 592.438903 52.349127 572.009975V38.304239c0-20.428928 17.875312-38.304239 38.30424-38.304239h426.453865c20.428928 0 38.304239 17.875312 38.304239 38.304239s-17.875312 38.304239-38.304239 38.30424H128.957606z m127.680798 127.680798v495.401496c0 20.428928-17.875312 38.304239-38.304239 38.304239S180.029925 720.119701 180.029925 699.690773V165.985037c0-20.428928 17.875312-38.304239 38.30424-38.304239h426.453865c20.428928 0 38.304239 17.875312 38.304239 38.304239s-17.875312 38.304239-38.304239 38.30424H256.638404z m579.670823 291.112219v-150.663341H399.640898v515.830424h76.608479c0 38.304239 30.643392 68.947631 43.411471 89.376558h-145.55611c-33.197007 0-61.286783-28.089776-61.286783-63.840399V321.755611c0-35.750623 28.089776-63.840399 61.286783-63.840399h490.294264c33.197007 0 61.286783 28.089776 61.286784 63.840399V564.349127c-20.428928-22.982544-58.733167-56.179551-89.376559-68.947631zM486.46384 411.13217h255.361596c15.321696 0 25.53616 10.214464 25.53616 25.536159s-10.214464 25.53616-25.53616 25.53616H486.46384c-15.321696 0-25.53616-10.214464-25.536159-25.53616s10.214464-25.53616 25.536159-25.536159z m0 102.144638h102.144639c15.321696 0 25.53616 10.214464 25.536159 25.53616s-10.214464 25.53616-25.536159 25.536159h-102.144639c-15.321696 0-25.53616-10.214464-25.536159-25.536159s10.214464-25.53616 25.536159-25.53616z m503.062345 492.84788c-2.553616 2.553616-7.660848 10.214464-12.76808 10.214464-10.214464 10.214464-35.750623 10.214464-45.965088 0l-81.71571-71.501247c-28.089776 17.875312-63.840399 28.089776-99.591023 28.089776-102.144638 0-186.413965-84.269327-186.413965-186.413965s84.269327-186.413965 186.413965-186.413965 186.413965 84.269327 186.413965 186.413965c0 38.304239-10.214464 71.501247-30.643391 99.591022l81.715711 71.501247c12.76808 12.76808 12.76808 35.750623 2.553616 48.518703z m-240.039901-324.309227c-58.733167 0-104.698254 48.518703-104.698254 104.698255 0 58.733167 48.518703 104.698254 104.698254 104.698254s104.698254-48.518703 104.698255-104.698254c2.553616-58.733167-45.965087-104.698254-104.698255-104.698255z" fill="#ffffff"/></svg>':t==="sub-plan"?'<svg viewBox="0 0 1024 1024"><path d="M674.507676 598.338391 287.079856 598.338391c-14.136975 0-25.638937 11.499915-25.638937 25.63689 0 14.137998 11.501962 25.640983 25.638937 25.640983l387.42782 0c14.137998 0 25.640983-11.501962 25.640983-25.640983C700.148659 609.838306 688.646698 598.338391 674.507676 598.338391zM794.746154 384.583029c-14.137998 0-25.640983 11.501962-25.640983 25.63996l0 494.299873c0 0.130983 0 0.280386-0.001023 0.433882-0.899486 0.279363-2.665713 0.644683-5.764284 0.644683L200.047664 905.601426c-4.312212 0-7.564279-2.971681-7.564279-6.913457L192.483384 191.851493c0-4.493338 0.974188-8.28878 1.811252-9.821693l373.337917 0c14.136975 0 25.63996-11.501962 25.63996-25.63996 0-14.136975-11.501962-25.638937-25.63996-25.638937l-374.069581 0c-30.336936 0-52.357462 25.696242-52.357462 61.099566l0 706.836477c0 32.086789 26.396183 58.19133 58.84113 58.19133l563.293223 0c34.119075 0 57.042157-21.041222 57.042157-52.356438L820.382021 410.224012C820.383044 396.086014 808.883129 384.583029 794.746154 384.583029zM674.507676 745.295394 287.079856 745.295394c-14.136975 0-25.638937 11.499915-25.638937 25.63689 0 14.137998 11.501962 25.640983 25.638937 25.640983l387.42782 0c14.137998 0 25.640983-11.501962 25.640983-25.640983C700.148659 756.795309 688.646698 745.295394 674.507676 745.295394zM879.595634 157.107177c-3.77293-14.409175-12.871145-28.250414-24.964578-37.975916l-43.827181-35.240619c-12.880355-10.352789-29.27679-16.290011-44.986587-16.290011-16.876366 0-31.594579 6.747681-41.439808 18.995633l-19.624966 24.381293c-6.380314 7.968485-7.987928 17.577331-5.222955 26.916023l-114.241904 142.063553-2.486634 3.090385-22.812565 85.303828c-9.749038 30.859845 4.449335 48.075949 13.806447 55.608505 6.783497 5.450129 14.468526 8.728802 22.851451 9.754155 0.984421 0.246617 2.125407 0.488117 3.440355 0.632403 1.003863 0.110517 2.053776 0.167822 3.118014 0.167822l0.014326 0c4.588505 0 10.047844-0.9967 17.180288-3.13541l2.877537-1.065262 83.402525-41.897226 119.874181-149.07934c0.440022 0.017396 0.880043 0.032746 1.320065 0.032746 9.218966 0 17.411555-3.862981 23.077601-10.892071l19.562545-24.342408C880.924909 191.1976 884.15037 174.495196 879.595634 157.107177zM674.469813 348.564697l-56.738235 28.537963c-2.958378 0.579191-5.734608 1.684362-8.277524 3.296069-0.313132 0.198521-0.615007 0.385786-0.905626 0.562818 0.12382-0.318248 0.25378-0.639566 0.39295-0.971118 0.99977-2.437515 1.588171-5.022387 1.753947-7.702426l17.732873-66.078974 105.73209-131.488707 48.647977 39.113833L674.469813 348.564697zM831.385633 172.919305l-7.679913 9.550517-68.139913-54.779627 7.687076-9.56382c0.291642-0.132006 1.144056-0.38374 2.604314-0.38374 4.28356 0 9.735735 2.071172 13.570063 5.15644l43.832298 35.245735c3.493567 2.805906 6.421246 7.018857 7.642051 10.993378C831.497173 171.081447 831.492056 172.446537 831.385633 172.919305zM487.474932 291.067168l-200.394053 0c-14.136975 0-25.638937 11.501962-25.638937 25.63996 0 14.136975 11.501962 25.637913 25.638937 25.637913l200.394053 0c14.137998 0 25.63996-11.500938 25.63996-25.637913C513.114892 302.56913 501.611907 291.067168 487.474932 291.067168zM674.507676 438.023148 287.079856 438.023148c-14.136975 0-25.638937 11.500938-25.638937 25.638937s11.501962 25.638937 25.638937 25.638937l387.42782 0c14.137998 0 25.640983-11.501962 25.640983-25.638937S688.646698 438.023148 674.507676 438.023148z" fill="#ffffff"/></svg>':t==="teammate"?'<svg viewBox="0 0 24 24"><path d="M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z" fill="#ffffff"/></svg>':'<svg viewBox="0 0 1024 1024"><path d="M810.666667 384l53.333333-117.333333L981.333333 213.333333l-117.333333-53.333333L810.666667 42.666667l-53.333334 117.333333L640 213.333333l117.333333 53.333334L810.666667 384zM810.666667 640l-53.333334 117.333333L640 810.666667l117.333333 53.333333L810.666667 981.333333l53.333333-117.333333L981.333333 810.666667l-117.333333-53.333334L810.666667 640zM490.666667 405.333333L384 170.666667 277.333333 405.333333 42.666667 512l234.666666 106.666667L384 853.333333l106.666667-234.666666L725.333333 512l-234.666666-106.666667z m-64.426667 148.906667L384 647.253333l-42.24-93.013333L248.746667 512l93.013333-42.24L384 376.746667l42.24 93.013333 93.013333 42.24-93.013333 42.24z" fill="#ffffff"/></svg>'}function ehe(t){return t==null||t===0?"0":t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"K":String(t)}function gf(t){if(Array.isArray(t))return t.map(gf);if(t&&typeof t=="object"){const e={};for(const n of Object.keys(t))n.startsWith("_")||(e[n]=gf(t[n]));return e}return t}function rBe(t){var n,i,r;const e={};for(const s of t){const o=(i=(n=s.response)==null?void 0:n.body)==null?void 0:i.usage;if(!o)continue;const a=((r=s.body)==null?void 0:r.model)||"unknown";e[a]||(e[a]={input:0,output:0,cacheCreation:0,cacheRead:0});const l=e[a];l.input+=o.input_tokens||0,l.output+=o.output_tokens||0,l.cacheCreation+=o.cache_creation_input_tokens||0,l.cacheRead+=o.cache_read_input_tokens||0}return e}function sBe(t){var i,r,s;const e={ttl:{count:0,cacheCreate:0},system_change:{count:0,cacheCreate:0},tools_change:{count:0,cacheCreate:0},model_change:{count:0,cacheCreate:0},msg_truncated:{count:0,cacheCreate:0},msg_modified:{count:0,cacheCreate:0},key_change:{count:0,cacheCreate:0}},n=Hue(t);for(const[o,a]of n){const l=((s=(r=(i=t[o].response)==null?void 0:i.body)==null?void 0:r.usage)==null?void 0:s.cache_creation_input_tokens)||0,c=a.reasons||[a.reason];for(const d of c)e[d]&&(e[d].count++,e[d].cacheCreate+=l)}return e}function oBe(t){var n,i;const e={};for(const r of t){const s=(i=(n=r.response)==null?void 0:n.body)==null?void 0:i.content;if(Array.isArray(s))for(const o of s)o.type==="tool_use"&&o.name&&(e[o.name]=(e[o.name]||0)+1)}return Object.entries(e).sort((r,s)=>s[1]-r[1])}function aBe(t){var n;const e={};for(const i of t){const r=(n=i.body)==null?void 0:n.messages;if(Array.isArray(r))for(const s of r){if(s.role!=="user")continue;const o=s.content;if(Array.isArray(o))for(const a of o){if(a.type!=="text"||!v_(a.text))continue;const l=a.text.match(/^#\s+(.+)$/m),c=l?l[1]:"Skill";e[c]=(e[c]||0)+1}}}return Object.entries(e).sort((i,r)=>r[1]-i[1])}function U5(t){return typeof t!="string"?!1:t.includes("<system-reminder>")&&t.includes("# claudeMd")}function q5(t){return typeof t!="string"?!1:t.includes("<system-reminder>")&&t.includes("skills are available")}function lBe(t){const e=t==null?void 0:t.messages;if(!Array.isArray(e))return!1;for(const n of e){const i=n==null?void 0:n.content;if(typeof i=="string"){if(U5(i))return!0}else if(Array.isArray(i)){for(const r of i)if(r.type==="text"&&U5(r.text))return!0}}return!1}function cBe(t){const e=t==null?void 0:t.messages;if(!Array.isArray(e))return!1;for(const n of e){const i=n==null?void 0:n.content;if(typeof i=="string"){if(q5(i))return!0}else if(Array.isArray(i)){for(const r of i)if(r.type==="text"&&q5(r.text))return!0}}return!1}function dBe(t){return t?t.replace(/^claude-/,"").replace(/-\d{8,}$/,""):null}function $g(t){var n,i,r;if(!t)return!1;const e=t.url||"";return!(t.isHeartbeat||t.isCountTokens||/\/api\/eval\/sdk-/.test(e)||/\/messages\/count_tokens/.test(e)||t.inProgress===!0||t.response&&t.response.status===0||((n=t.body)==null?void 0:n.max_tokens)===1&&!((i=t.body)!=null&&i.system)&&(!((r=t.body)!=null&&r.tools)||t.body.tools.length===0))}function Gb(t){return t.filter($g)}function uBe(t,e){for(let n=e-1;n>=0;n--)if(js(t[n])&&t[n].timestamp)return t[n].timestamp;return null}function the(t){var s,o,a,l;if(!Array.isArray(t)||t.length===0)return null;let e=null;if(t.length===1)e=t[0];else{let c=null,d=null;for(let u=t.length-1;u>=0;u--)if(js(t[u])&&(c||(c=t[u]),(o=(s=t[u].response)==null?void 0:s.body)!=null&&o.usage)){d=t[u];break}e=d||c}if(!e||!e.body)return null;const n=e.body,i=(l=(a=e.response)==null?void 0:a.body)==null?void 0:l.usage,r={system:[],messages:[],tools:[],cacheCreateTokens:(i==null?void 0:i.cache_creation_input_tokens)||0,cacheReadTokens:(i==null?void 0:i.cache_read_input_tokens)||0};if(Array.isArray(n.system)){let c=-1;for(let d=n.system.length-1;d>=0;d--)if(n.system[d].cache_control){c=d;break}if(c>=0)for(let d=0;d<=c;d++){const u=n.system[d];u.type==="text"&&u.text&&r.system.push(u.text)}}if(Array.isArray(n.messages)){let c=-1;for(let d=n.messages.length-1;d>=0;d--){const u=n.messages[d].content;if(Array.isArray(u)){for(const h of u)if(h.cache_control){c=d;break}if(c>=0)break}}if(c>=0)for(let d=0;d<=c;d++){const u=n.messages[d],h=u.content;if(typeof h=="string")r.messages.push(`[${u.role}] ${h}`);else if(Array.isArray(h)){for(const O of h)if(O.type==="text"&&O.text)r.messages.push(`[${u.role}] ${O.text}`);else if(O.type==="tool_result"){const p=VA(O);p&&r.messages.push(`[tool_result: ${O.tool_use_id}] ${p}`)}}}}if(Array.isArray(n.tools)&&n.tools.length>0&&r.system.length>0)for(const c of n.tools)r.tools.push(`${c.name}: ${c.description||""}`);return r}const nhe="ccv_entryCache",hc="entries",hP="cache",OP="ccv_cacheMeta",ihe=2,BA=10080*60*1e3;let Wd=null,Ld=null;function $h(){return Wd?Promise.resolve(Wd):Ld||(Ld=new Promise((t,e)=>{const n=indexedDB.open(nhe,ihe);n.onupgradeneeded=()=>{const i=n.result;i.objectStoreNames.contains(hc)||i.createObjectStore(hc),i.objectStoreNames.contains("sessions")||i.createObjectStore("sessions"),i.objectStoreNames.contains("session_index")||i.createObjectStore("session_index")},n.onsuccess=()=>{Wd=n.result,Wd.onclose=()=>{Wd=null},Ld=null,t(Wd)},n.onerror=()=>{Ld=null,e(n.error)}}),Ld)}let Z5=0;function rhe(t,e){try{const n=e[e.length-1],i=(n==null?void 0:n.timestamp)||null;i&&localStorage.setItem(OP,JSON.stringify({projectName:t,lastTs:i,count:e.length}))}catch{}}function she(){try{localStorage.removeItem(OP)}catch{}}function G5(){try{const t=localStorage.getItem(OP);if(!t)return null;const e=JSON.parse(t);return e!=null&&e.lastTs&&(e==null?void 0:e.count)>0&&(e!=null&&e.projectName)?e:null}catch{return null}}async function Il(t,e){if(!t||!Array.isArray(e)||e.length===0)return;const n=++Z5;try{const i=await $h();return n!==Z5?void 0:(rhe(t,e),new Promise(r=>{const s=i.transaction(hc,"readwrite");s.objectStore(hc).put({projectName:t,entries:e,ts:Date.now()},hP),s.oncomplete=()=>r(),s.onerror=()=>r()}))}catch{}}async function ohe(t){try{const e=await $h();return new Promise(n=>{const r=e.transaction(hc,"readonly").objectStore(hc).get(hP);r.onsuccess=()=>{const s=r.result;!s||s.projectName!==t||!Array.isArray(s.entries)||s.entries.length===0?n(null):s.ts&&Date.now()-s.ts>BA?(__(),n(null)):n(s.entries)},r.onerror=()=>n(null)})}catch{return null}}async function __(){she();try{const t=await $h();return new Promise(e=>{const n=t.transaction(hc,"readwrite");n.objectStore(hc).delete(hP),n.oncomplete=()=>e(),n.onerror=()=>e()})}catch{}}async function rm(t,e,n){if(!(!t||n==null))try{const i=await $h(),r=`${t}:${e}`;return new Promise(s=>{const o=i.transaction("sessions","readwrite");o.objectStore("sessions").put({entries:n,ts:Date.now()},r),o.oncomplete=()=>s(),o.onerror=()=>s()})}catch{}}async function ahe(t,e){try{const n=await $h(),i=`${t}:${e}`;return new Promise(r=>{const o=n.transaction("sessions","readonly").objectStore("sessions").get(i);o.onsuccess=()=>{const a=o.result;!a||!Array.isArray(a.entries)||a.entries.length===0||a.ts&&Date.now()-a.ts>BA?r(null):r(a.entries)},o.onerror=()=>r(null)})}catch{return null}}async function sm(t,e){if(!(!t||!Array.isArray(e)))try{const n=await $h();return new Promise(i=>{const r=n.transaction("session_index","readwrite");r.objectStore("session_index").put({index:e,ts:Date.now()},t),r.oncomplete=()=>i(),r.onerror=()=>i()})}catch{}}const ca=8;function om(t,e){const n=new Map;for(const s of t){const o=s._sessionId;if(o==null)continue;const a=s.timestamp||null;let l=n.get(o);l||(l={firstTs:a,lastTs:a,entryCount:0},n.set(o,l)),l.entryCount++,a&&((!l.firstTs||a<l.firstTs)&&(l.firstTs=a),(!l.lastTs||a>l.lastTs)&&(l.lastTs=a))}const i=Array.from(n.keys()).sort(),r=[];for(let s=0;s<e.length;s++){const o=e[s],a=i[s]||(o==null?void 0:o.entryTimestamp)||null,l=a?n.get(a)||{firstTs:null,lastTs:null,entryCount:0}:{firstTs:null,lastTs:null,entryCount:0};let c=0,d="",u=null;if(o&&(c=o.messages?o.messages.length:0,u=o.userId||null,o.messages)){for(const h of o.messages)if(h.role==="user"){const O=lhe(h);if(O){d=O.slice(0,80);break}}}r.push({sessionId:a,firstTs:l.firstTs,lastTs:l.lastTs||(o==null?void 0:o.entryTimestamp)||null,entryCount:l.entryCount,msgCount:c,preview:d,userId:u})}return r}function lhe(t){if(!t)return"";if(typeof t.content=="string")return t.content;if(Array.isArray(t.content)){for(const e of t.content)if(e.type==="text"&&e.text)return e.text}return""}function Lh(t,e,n,i,r=new Set){if(n.length<=i)return{hotEntries:t,allSessions:e,coldGroups:new Map};const o=new Set(r);let a=i-o.size;for(let u=n.length-1;u>=0&&a>0;u--){const h=n[u].sessionId;o.has(h)||(o.add(h),a--)}const l=[],c=new Map;for(const u of t)if(o.has(u._sessionId))l.push(u);else{let h=c.get(u._sessionId);h||(h=[],c.set(u._sessionId,h)),h.push(u)}const d=e.map((u,h)=>{const O=n[h],p=O==null?void 0:O.sessionId;return p&&!o.has(p)?{_cold:!0,sessionId:p,preview:O.preview,msgCount:O.msgCount,firstTs:O.firstTs,lastTs:O.lastTs,userId:O.userId,messages:null,response:null,entryTimestamp:O.lastTs}:u});return{hotEntries:l,allSessions:d,coldGroups:c}}function Fb(t,e){if(!t||t.length===0)return e||[];if(!e||e.length===0)return t;const n=new Set(e.map(r=>r.sessionId)),i=[];for(const r of t)n.has(r.sessionId)||i.push(r);for(const r of e)i.push(r);return i.sort((r,s)=>r.sessionId===s.sessionId?0:r.sessionId==null?-1:s.sessionId==null?1:r.sessionId<s.sessionId?-1:1),i}function che(t,e){var d;const n=e.body.messages,i=e.response,r=((d=e.body.metadata)==null?void 0:d.user_id)||null,s=e.timestamp||null;if(t.length===0)return[{userId:r,messages:n,response:i,entryTimestamp:s}];const o=t[t.length-1],a=o.messages?o.messages.length:0,l=a>0&&n.length<a*.5&&a-n.length>4,c=r!==null&&r===o.userId;if(l&&n.length<=4&&a>4)return t;if(c||r===o.userId&&!l){const u=a,h=n.length;if(h>u){o.messages||(o.messages=[]);for(let O=u;O<h;O++)n[O]._timestamp||(n[O]._timestamp=s),o.messages.push(n[O])}else if(h<u){for(let O=0;O<n.length;O++)n[O]._timestamp||(n[O]._timestamp=s);o.messages=n}return o.response=i,o.entryTimestamp=s,[...t]}else return[...t,{userId:r,messages:n,response:i,entryTimestamp:s}]}function YA(t){var n;if(!t._deltaFormat||t._isCheckpoint)return!0;const e=(n=t.body)==null?void 0:n.messages;return!!(Array.isArray(e)&&t._totalMessageCount===e.length)}function dhe(t){return t._deltaFormat&&t.mainAgent}function Vh(t){var i,r;let e=[];const n=[];for(let s=0;s<t.length;s++){const o=t[s];if(o.inProgress)continue;if(!dhe(o)){o.mainAgent&&Array.isArray((i=o.body)==null?void 0:i.messages)&&(e=[...o.body.messages]);continue}const a=(r=o.body)==null?void 0:r.messages;Array.isArray(a)&&(YA(o)?e=[...a]:(e=[...e,...a],o.body.messages=e,o._totalMessageCount&&e.length!==o._totalMessageCount&&n.push(s)))}return n.length>0&&uhe(t,n),t}function uhe(t,e){var n;for(const i of e){const r=t[i],s=r._totalMessageCount;if(s)for(let o=i+1;o<t.length;o++){const a=t[o];if(!a.mainAgent||!Array.isArray((n=a.body)==null?void 0:n.messages))continue;const l=a.body.messages,c=a._totalMessageCount||l.length;if((!a._deltaFormat||YA(a))&&c>=s){r.body.messages=l.slice(0,s);break}}}}const hhe="_layout_1w405_1",Ohe="_header_1w405_6",fhe="_content_1w405_14",phe="_mainContainer_1w405_19",mhe="_leftPanel_1w405_24",ghe="_leftPanelHeader_1w405_32",vhe="_leftPanelCount_1w405_43",$he="_leftPanelBody_1w405_49",bhe="_rightPanel_1w405_54",She="_modalActions_1w405_60",yhe="_spinCenter_1w405_64",_he="_emptyCenter_1w405_69",Qhe="_logListContainer_1w405_79",xhe="_loadingOverlay_1w405_127",whe="_dragOverlay_1w405_140",Phe="_dragOverlayContent_1w405_154",Che="_dragIcon_1w405_163",The="_loadingText_1w405_167",khe="_mobileLoadingOverlay_1w405_173",Rhe="_mobileLoadingSpinner_1w405_185",Ehe="_mobileLoadingLabel_1w405_198",Xhe="_footer_1w405_204",zhe="_footerRight_1w405_215",Ihe="_footerLink_1w405_228",Ahe="_footerIcon_1w405_240",Mhe="_guideContainer_1w405_253",jhe="_guideContent_1w405_261",Nhe="_guideTitle_1w405_266",Whe="_guideStep_1w405_273",Lhe="_guideStepNum_1w405_279",Vhe="_guideStepBody_1w405_294",Bhe="_guideText_1w405_299",Yhe="_guideCode_1w405_306",Dhe="_mobileChatOverlay_1w405_319",Uhe="_mobileChatOverlayVisible_1w405_331",qhe="_mobileNavBtn_1w405_335",Zhe="_mobileChatInner_1w405_340",Ghe="_mobileGitDiffOverlay_1w405_348",Fhe="_mobileGitDiffOverlayVisible_1w405_360",Hhe="_mobileGitDiffInner_1w405_364",Khe="_mobileMenuBtn_1w405_372",Jhe="_mobileMenuOverlay_1w405_389",eOe="_mobileMenuDropdown_1w405_395",tOe="_mobileMenuItem_1w405_409",nOe="_mobileStatsOverlay_1w405_427",iOe="_mobileStatsOverlayVisible_1w405_439",rOe="_mobileStatsInner_1w405_443",sOe="_mobileLogMgmtOverlay_1w405_450",oOe="_mobileLogMgmtOverlayVisible_1w405_462",aOe="_mobileLogMgmtHeader_1w405_466",lOe="_mobileLogMgmtTitle_1w405_475",cOe="_mobileLogMgmtClose_1w405_481",dOe="_mobileLogMgmtActions_1w405_496",uOe="_mobileLogMgmtBody_1w405_504",hOe="_mobileSettingsOverlay_1w405_511",OOe="_mobileSettingsOverlayVisible_1w405_523",fOe="_mobilePromptOverlay_1w405_527",pOe="_mobilePromptOverlayVisible_1w405_539",mOe="_mobilePromptBody_1w405_543",gOe="_mobilePromptList_1w405_551",vOe="_mobilePromptItem_1w405_557",$Oe="_mobilePromptTimestamp_1w405_562",bOe="_mobilePromptCard_1w405_569",SOe="_mobilePromptPreText_1w405_577",yOe="_tableTimestampCell_1w405_587",_Oe="_tablePreviewText_1w405_591",QOe="_tablePreviewTextClickable_1w405_600",xOe="_tableTag_1w405_610",wOe="_tableActionsCell_1w405_616",POe="_mobileCLIRoot_1w405_622",COe="_mobileCLIHeader_1w405_631",TOe="_mobileCLIHeaderLeft_1w405_642",kOe="_mobileCLIStatusLabel_1w405_648",ROe="_mobileCLIHeaderRight_1w405_653",EOe="_mobileCLIBody_1w405_659",XOe="_mobileSettingsBody_1w405_668",zOe="_mobileSettingsSectionTitle_1w405_672",IOe="_mobileSettingsRow_1w405_679",AOe="_mobileSettingsLabel_1w405_687",MOe="_mobilePromptEmpty_1w405_693",jOe="_mobilePromptHeader_1w405_700",NOe="_mobilePromptCount_1w405_708",WOe="_chatViewWrapper_1w405_714",LOe="_resumeFooterRight_1w405_720",VOe="_resumeFooterLeft_1w405_725",BOe="_resumeCheckboxOpacity_1w405_729",YOe="_btnMarginLeft_1w405_733",DOe="_btnMarginRight_1w405_737",UOe="_modalTitleInline_1w405_742",qOe="_previewPopover_1w405_749",ZOe="_previewItem_1w405_755",GOe="_previewText_1w405_767",el={layout:hhe,header:Ohe,content:fhe,mainContainer:phe,leftPanel:mhe,leftPanelHeader:ghe,leftPanelCount:vhe,leftPanelBody:$he,rightPanel:bhe,modalActions:She,spinCenter:yhe,emptyCenter:_he,logListContainer:Qhe,loadingOverlay:xhe,dragOverlay:whe,dragOverlayContent:Phe,dragIcon:Che,loadingText:The,mobileLoadingOverlay:khe,mobileLoadingSpinner:Rhe,mobileLoadingLabel:Ehe,footer:Xhe,footerRight:zhe,footerLink:Ihe,footerIcon:Ahe,guideContainer:Mhe,guideContent:jhe,guideTitle:Nhe,guideStep:Whe,guideStepNum:Lhe,guideStepBody:Vhe,guideText:Bhe,guideCode:Yhe,mobileChatOverlay:Dhe,mobileChatOverlayVisible:Uhe,mobileNavBtn:qhe,mobileChatInner:Zhe,mobileGitDiffOverlay:Ghe,mobileGitDiffOverlayVisible:Fhe,mobileGitDiffInner:Hhe,mobileMenuBtn:Khe,mobileMenuOverlay:Jhe,mobileMenuDropdown:eOe,mobileMenuItem:tOe,mobileStatsOverlay:nOe,mobileStatsOverlayVisible:iOe,mobileStatsInner:rOe,mobileLogMgmtOverlay:sOe,mobileLogMgmtOverlayVisible:oOe,mobileLogMgmtHeader:aOe,mobileLogMgmtTitle:lOe,mobileLogMgmtClose:cOe,mobileLogMgmtActions:dOe,mobileLogMgmtBody:uOe,mobileSettingsOverlay:hOe,mobileSettingsOverlayVisible:OOe,mobilePromptOverlay:fOe,mobilePromptOverlayVisible:pOe,mobilePromptBody:mOe,mobilePromptList:gOe,mobilePromptItem:vOe,mobilePromptTimestamp:$Oe,mobilePromptCard:bOe,mobilePromptPreText:SOe,tableTimestampCell:yOe,tablePreviewText:_Oe,tablePreviewTextClickable:QOe,tableTag:xOe,tableActionsCell:wOe,mobileCLIRoot:POe,mobileCLIHeader:COe,mobileCLIHeaderLeft:TOe,mobileCLIStatusLabel:kOe,mobileCLIHeaderRight:ROe,mobileCLIBody:EOe,mobileSettingsBody:XOe,mobileSettingsSectionTitle:zOe,mobileSettingsRow:IOe,mobileSettingsLabel:AOe,mobilePromptEmpty:MOe,mobilePromptHeader:jOe,mobilePromptCount:NOe,chatViewWrapper:WOe,resumeFooterRight:LOe,resumeFooterLeft:VOe,resumeCheckboxOpacity:BOe,btnMarginLeft:YOe,btnMarginRight:DOe,modalTitleInline:UOe,previewPopover:qOe,previewItem:ZOe,previewText:GOe},F5=Ft?30:100;class hBe extends Z.Component{constructor(n){super(n);Je(this,"_resetSSETimeout",()=>{this._sseTimeoutTimer&&clearTimeout(this._sseTimeoutTimer),this._sseReconnectCount=0,this._sseTimeoutTimer=setTimeout(()=>{console.warn("SSE heartbeat timeout, reconnecting..."),this._reconnectSSE()},45e3)});Je(this,"_flushPendingEntries",()=>{this._flushRafId=null;const n=this._pendingEntries;this._pendingEntries=[],n.length!==0&&this.setState(i=>{var c,d,u,h,O;const r=[...i.requests];let s=i.cacheExpireAt,o=i.cacheType,a=i.mainAgentSessions;this._sseSlimEnabled&&!this._sseSlimmer&&(this._sseSlimmer=Gue(js));for(const p of n){const m=`${p.timestamp}|${p.url}`,g=this._requestIndexMap.get(m);if(g!==void 0)r[g]=p,this._sseSlimmer&&this._sseSlimmer.onDedup(g);else{const v=r.length;this._sseSlimmer&&this._sseSlimmer.processEntry(p,r,v),this._requestIndexMap.set(m,v),r.push(p)}if(js(p)&&!p.inProgress&&((d=(c=p.response)==null?void 0:c.body)!=null&&d.usage)){const v=the([p]);v&&(v.system.length>0||v.messages.length>0||v.tools.length>0)&&(this._lastKvCacheContent=v)}if(js(p)){const v=(h=(u=p.response)==null?void 0:u.body)==null?void 0:h.usage;if(v!=null&&v.cache_creation){const $=v.cache_creation,b=p.timestamp?new Date(p.timestamp).getTime():Date.now();let S=null,y=null;if($.ephemeral_1h_input_tokens>0?(S=b+3600*1e3,y="1h"):$.ephemeral_5m_input_tokens>0&&(S=b+300*1e3,y="5m"),S&&S>Date.now()){s=S;const Q=(v.cache_read_input_tokens||0)+(v.cache_creation_input_tokens||0);o=Q>0?ehe(Q):y,localStorage.setItem("ccv_cacheExpireAt",String(s)),localStorage.setItem("ccv_cacheType",o)}}}if(js(p)&&p.body&&Array.isArray(p.body.messages)&&!p._slimmed){const v=p.timestamp||new Date().toISOString(),$=a.length>0?a[a.length-1]:null,b=($==null?void 0:$.messages)||[],S=p.body.messages,y=b.length,Q=((O=p.body.metadata)==null?void 0:O.user_id)||null,P=!(Q!==null&&($==null?void 0:$.userId)===Q)&&y>0&&S.length<y*.5&&y-S.length>4;if(y>4&&S.length<=4&&S.length<y*.5)continue;P?this._currentSessionId=v:this._currentSessionId===null&&(this._currentSessionId=v);for(let X=0;X<S.length;X++)!P&&X<y&&b[X]._timestamp?S[X]._timestamp=b[X]._timestamp:S[X]._timestamp||(S[X]._timestamp=v);a=this.mergeMainAgentSessions(a,p)}p._sessionId=this._currentSessionId}let l=i.selectedIndex;return a.length>F5&&(a=a.slice(-F5)),l===null&&r.length>0&&(this._autoSelectTimer&&clearTimeout(this._autoSelectTimer),this._autoSelectTimer=setTimeout(()=>{this.setState(p=>{if(p.selectedIndex===null&&p.requests.length>0){const m=p.showAll?p.requests:Gb(p.requests);return m.length>0?{selectedIndex:m.length-1}:null}return null})},200)),{requests:r,cacheExpireAt:s,cacheType:o,mainAgentSessions:a}},()=>{Ft&&this.state.projectName&&(this._cacheSaveTimer&&clearTimeout(this._cacheSaveTimer),this._cacheSaveTimer=setTimeout(()=>{this.state.projectName&&this.state.sessionIndex.length===0&&Il(this.state.projectName,this.state.requests)},5e3),this.state.mainAgentSessions.length>ca+2&&(this._evictionTimer||(this._evictionTimer=setTimeout(()=>{this._evictionTimer=null,this._evictColdSessions()},1e4))))})});Je(this,"handleSelectRequest",n=>{this.setState({selectedIndex:n,scrollCenter:!1})});Je(this,"handleScrollDone",()=>{this.setState({scrollCenter:!1})});Je(this,"handleScrollTsDone",()=>{this.setState({chatScrollToTs:null})});Je(this,"handleWorkspaceLaunch",({projectName:n})=>{this._isLocalLog=!1,this._localLogFile=null,this.setState({workspaceMode:!1,projectName:n,viewMode:"chat",cliMode:!0})});Je(this,"handleReturnToWorkspaces",()=>{fetch(pt("/api/workspaces/stop"),{method:"POST"}).then(()=>{this._rebuildRequestIndex([]),this.setState({workspaceMode:!0,requests:[],mainAgentSessions:[],projectName:"",selectedIndex:null})}).catch(()=>{})});Je(this,"handleProxyProfileChange",n=>{fetch(pt("/api/proxy-profiles"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).then(i=>i.json()).then(()=>{this.setState({proxyProfiles:n.profiles,activeProxyId:n.active})}).catch(()=>{})});Je(this,"handleLangChange",()=>{const n=m_();this.setState({lang:n}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lang:n})}).catch(()=>{})});Je(this,"handleCollapseToolResultsChange",n=>{this.setState({collapseToolResults:n}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({collapseToolResults:n})}).catch(()=>{})});Je(this,"handleExpandThinkingChange",n=>{this.setState({expandThinking:n}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expandThinking:n})}).catch(()=>{})});Je(this,"handleExpandDiffChange",n=>{this.setState({expandDiff:n}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expandDiff:n})}).catch(()=>{})});Je(this,"handleThemeColorChange",n=>{this.setState({themeColor:n}),document.documentElement.setAttribute("data-theme",n==="light"?"light":"dark"),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({themeColor:n})}).catch(()=>{})});Je(this,"handleLogDirChange",n=>{if(!n||typeof n!="string")return;const i=n.trim();i&&(this.setState({logDir:i}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({logDir:i})}).then(r=>r.json()).then(r=>{r.logDir&&this.setState({logDir:r.logDir})}).catch(()=>{}))});Je(this,"handleShowFullToolContentChange",n=>{this.setState({showFullToolContent:n}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({showFullToolContent:n})}).catch(()=>{})});Je(this,"handleFilterIrrelevantChange",n=>{this.setState(i=>{const r=!n,s=r?i.requests:Gb(i.requests);return{showAll:r,selectedIndex:s.length>0?s.length-1:null}}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filterIrrelevant:n})}).catch(()=>{})});Je(this,"handleImportLocalLogs",()=>{this.setState({importModalVisible:!0,localLogsLoading:!0}),fetch(pt("/api/local-logs")).then(n=>n.json()).then(n=>{const{_currentProject:i,...r}=n;this.setState({localLogs:r,currentProject:i||"",localLogsLoading:!1})}).catch(()=>{this.setState({localLogs:{},localLogsLoading:!1})})});Je(this,"handleCloseImportModal",()=>{this.setState({importModalVisible:!1,selectedLogs:new Set})});Je(this,"handleRefreshStats",()=>{this.setState({refreshingStats:!0}),fetch(pt("/api/refresh-stats"),{method:"POST"}).then(n=>n.json()).then(n=>{if(!n.ok)throw new Error(n.error||"refresh failed");return fetch(pt("/api/local-logs"))}).then(n=>n.json()).then(n=>{const{_currentProject:i,...r}=n;this.setState({localLogs:r,refreshingStats:!1}),ti.success(le("ui.refreshStatsSuccess"))}).catch(()=>{this.setState({refreshingStats:!1}),ti.error(le("ui.refreshStatsFailed"))})});Je(this,"handleToggleLogSelect",(n,i)=>{this.setState(r=>{const s=new Set(r.selectedLogs);return i?s.add(n):s.delete(n),{selectedLogs:s}})});Je(this,"handleMergeLogs",()=>{const{selectedLogs:n,localLogs:i,currentProject:r}=this.state;if(n.size<2)return;const s=i[r];if(!s)return;const o=[];if(s.forEach((c,d)=>{n.has(c.file)&&o.push(d)}),o.sort((c,d)=>c-d),n.has(s[0].file)){ti.warning(le("ui.mergeLatestNotAllowed"));return}for(let c=1;c<o.length;c++)if(o[c]-o[c-1]!==1){ti.warning(le("ui.mergeNotConsecutive"));return}if(o.reduce((c,d)=>c+s[d].size,0)>500*1024*1024){ti.warning(le("ui.mergeTooLarge"));return}const l=o.map(c=>s[c].file).reverse();fetch(pt("/api/merge-logs"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:l})}).then(c=>c.json()).then(c=>{c.ok?(ti.success(le("ui.mergeSuccess")),this.setState({selectedLogs:new Set}),this.handleImportLocalLogs()):ti.error(c.error||"Merge failed")}).catch(()=>ti.error("Merge failed"))});Je(this,"handleDeleteLogs",()=>{const{selectedLogs:n}=this.state;n.size!==0&&yi.confirm({title:le("ui.deleteLogs"),content:le("ui.deleteLogsConfirm",{count:n.size}),okText:le("ui.deleteLogs"),okButtonProps:{danger:!0},cancelText:le("ui.cancel"),onOk:()=>{const i=[...n];fetch(pt("/api/delete-logs"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:i})}).then(r=>r.json()).then(r=>{if(r.results){const s=r.results.filter(a=>a.ok).length,o=r.results.filter(a=>a.error).length;s>0&&ti.success(le("ui.deleteSuccess",{count:s})),o>0&&ti.error(le("ui.deleteFailed",{count:o})),this.setState({selectedLogs:new Set}),this.handleImportLocalLogs()}}).catch(()=>ti.error("Delete failed"))}})});Je(this,"handleOpenLogFile",async n=>{let i=`${window.location.protocol}//${window.location.host}`,r=new URLSearchParams(window.location.search).get("token");if(!r)try{const o=await fetch(pt("/api/local-url"));if(o.ok){const a=await o.json();a.url&&(i=a.url.split("?")[0],r=new URL(a.url).searchParams.get("token"))}}catch{}const s=r?`&token=${encodeURIComponent(r)}`:"";window.open(`${i}?logfile=${encodeURIComponent(n)}${s}`,"_blank"),this.setState({importModalVisible:!1})});Je(this,"handleDownloadLogFile",n=>{const i=pt(`/api/download-log?file=${encodeURIComponent(n)}`),r=document.createElement("a");r.href=i,r.download="",document.body.appendChild(r),r.click(),document.body.removeChild(r)});Je(this,"handleResumeChoice",n=>{this.state.resumeRememberChoice&&(this.setState({resumeAutoChoice:n}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resumeAutoChoice:n})}).catch(()=>{})),fetch(pt("/api/resume-choice"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({choice:n})}).catch(i=>console.error("resume-choice failed:",i))});Je(this,"handleResumeAutoChoiceToggle",n=>{const i=n?"continue":null;this.setState({resumeAutoChoice:i}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resumeAutoChoice:i})}).catch(()=>{})});Je(this,"handleResumeAutoChoiceChange",n=>{this.setState({resumeAutoChoice:n}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resumeAutoChoice:n})}).catch(()=>{})});Je(this,"_finishLocalLoad",(n,i)=>{if(n.length===0){ti.error(le("ui.noLogs")),this.setState({fileLoading:!1,fileLoadingCount:0});return}this.animateLoadingCount(n.length,()=>{const{mainAgentSessions:r,filtered:s}=this._processEntries(n);this._isLocalLog=!0,this._localLogFile=i.length===1?i[0]:`${i.length} files`,this.eventSource&&(this.eventSource.close(),this.eventSource=null),this._streamingOffTimer&&(clearTimeout(this._streamingOffTimer),this._streamingOffTimer=null),this.setState({requests:n,selectedIndex:s.length>0?s.length-1:null,mainAgentSessions:r,importModalVisible:!1,fileLoading:!1,fileLoadingCount:0})})});const i=parseInt(localStorage.getItem("ccv_cacheExpireAt"),10)||null,r=localStorage.getItem("ccv_cacheType")||null,s=Date.now(),o=i&&i>s?i:null,a=o?r:null;this.state={requests:[],selectedIndex:null,viewMode:"raw",cacheExpireAt:o,cacheType:a,mainAgentSessions:[],importModalVisible:!1,localLogs:{},localLogsLoading:!1,refreshingStats:!1,showAll:!1,lang:m_(),userProfile:null,projectName:"",resumeModalVisible:!1,resumeFileName:"",resumeRememberChoice:!1,resumeAutoChoice:null,collapseToolResults:!0,expandThinking:!0,expandDiff:!1,logDir:"",showFullToolContent:!1,showThinkingSummaries:!1,themeColor:"dark",fileLoading:!1,fileLoadingCount:0,isDragging:!1,selectedLogs:new Set,githubStars:null,cliMode:!1,sdkMode:!1,workspaceMode:!1,serverCachedContent:null,updateInfo:null,pendingUploadPaths:[],contextWindow:null,isStreaming:!1,hasMoreHistory:!1,loadingMore:!1,sessionIndex:[],loadingSessionId:null,proxyProfiles:[],activeProxyId:"max",defaultConfig:null},this.eventSource=null,this._currentSessionId=null,this._autoSelectTimer=null,this._chunkedEntries=[],this._chunkedTotal=0,this.mainContainerRef=Z.createRef(),this._layoutRef=Z.createRef(),this._requestIndexMap=new Map,this._pendingEntries=[],this._flushRafId=null,this._cacheLossMap=new Map,this._cacheLossProcessedCount=0,this._cacheLossLastMainAgent=null,this._cacheLossShowAll=void 0,this._lastKvCacheContent=null,this._sseSlimEnabled=!Ft&&localStorage.getItem("ccv_sseSlim")==="true",this._sseSlimmer=null}_rebuildRequestIndex(n){this._requestIndexMap.clear();for(let i=0;i<n.length;i++){const r=n[i];this._requestIndexMap.set(`${r.timestamp}|${r.url}`,i)}this._cacheLossProcessedCount=0,this._cacheLossLastMainAgent=null,this._cacheLossMap=new Map,this._lastKvCacheContent=null,this._sseSlimmer=null}_processEntries(n){var l;let i=[],r=null,s=[];const o=[];this._requestIndexMap.clear(),this._cacheLossProcessedCount=0,this._cacheLossLastMainAgent=null,this._cacheLossMap=new Map,this._lastKvCacheContent=null,this._sseSlimmer=null;let a=null;for(let c=0;c<n.length;c++){const d=n[c];if(this._requestIndexMap.set(`${d.timestamp}|${d.url}`,c),$g(d)&&o.push(d),js(d)&&d.body&&Array.isArray(d.body.messages)){const u=d.body.messages,h=d._messageCount||u.length,O=((l=d.body.metadata)==null?void 0:l.user_id)||null,p=d.timestamp||new Date().toISOString(),m=i.length,g=m>0&&(h<m*.5&&m-h>4||r&&O&&O!==r),v=g&&h<=4&&m>4&&h<m*.5;g&&!v?(a=p,i=[]):a===null&&(a=p);for(let $=i.length;$<h;$++)i.push(p);if(u.length>0)for(let $=0;$<u.length;$++)u[$]._timestamp=i[$];r=O,d._slimmed||(s=this.mergeMainAgentSessions(s,d))}d._sessionId=a}return this._currentSessionId=a,{mainAgentSessions:s,filtered:o}}componentDidMount(){fetch(pt("/api/claude-settings")).then(r=>r.json()).then(r=>{r.showThinkingSummaries&&this.setState({showThinkingSummaries:!0})}).catch(()=>{}),this._prefsReady=fetch(pt("/api/preferences")).then(r=>r.json()).then(r=>{r.lang&&(NA(r.lang),this.setState({lang:r.lang})),r.collapseToolResults!==void 0&&this.setState({collapseToolResults:!!r.collapseToolResults}),r.expandThinking!==void 0&&this.setState({expandThinking:!!r.expandThinking}),r.expandDiff!==void 0&&this.setState({expandDiff:!!r.expandDiff}),r.showFullToolContent!==void 0&&this.setState({showFullToolContent:!!r.showFullToolContent}),r.resumeAutoChoice&&this.setState({resumeAutoChoice:r.resumeAutoChoice}),r.themeColor&&(this.setState({themeColor:r.themeColor}),document.documentElement.setAttribute("data-theme",r.themeColor==="light"?"light":"dark"));const s=r.filterIrrelevant!==void 0?!!r.filterIrrelevant:!0;return this.setState({showAll:!s}),r.logDir&&this.setState({logDir:r.logDir}),r}).catch(()=>({})),fetch(pt("/api/user-profile")).then(r=>r.json()).then(r=>this.setState({userProfile:r})).catch(()=>{}),fetch(pt("/api/proxy-profiles")).then(r=>r.json()).then(r=>{if(!r.profiles)return;let s=r.active||"max";const o=r.defaultConfig;if(s==="max"&&(o!=null&&o.origin)){const a=r.profiles.find(l=>{if(l.id==="max"||!l.baseURL)return!1;try{if(new URL(l.baseURL).origin!==o.origin)return!1}catch{return!1}if(o.apiKey&&l.apiKey){const c=o.apiKey.slice(-4),d=l.apiKey.slice(-4);if(c!==d)return!1}return!(o.model&&l.activeModel&&o.model!==l.activeModel)});a&&(s=a.id,this.handleProxyProfileChange({active:a.id,profiles:r.profiles}))}this.setState({proxyProfiles:r.profiles,activeProxyId:s,defaultConfig:o||null})}).catch(()=>{});const i=new URLSearchParams(window.location.search).get("logfile");fetch(pt("/api/project-name")).then(r=>r.json()).then(r=>{const s=r.projectName||"";this.setState({projectName:s}),s&&(document.title=s),Ft&&s&&!i&&this.state.requests.length===0&&ohe(s).then(o=>{if(o&&this.state.requests.length===0){const{mainAgentSessions:a,filtered:l}=this._processEntries(o);if(a.length>ca){const c=om(o,a),{hotEntries:d,allSessions:u}=Lh(o,a,c,ca),h=d.filter(O=>$g(O));this._oldestTs=d.length>0?d[0].timestamp:null,this.setState({requests:d,selectedIndex:h.length>0?h.length-1:null,mainAgentSessions:u,sessionIndex:c,hasMoreHistory:!!this._oldestTs,fileLoading:!1})}else this._oldestTs=o.length>0?o[0].timestamp:null,this.setState({requests:o,selectedIndex:l.length>0?l.length-1:null,mainAgentSessions:a,hasMoreHistory:!!this._oldestTs,fileLoading:!1})}})}).catch(()=>{}),fetch("https://api.github.com/repos/weiesky/cc-viewer").then(r=>r.json()).then(r=>{r.stargazers_count!=null&&this.setState({githubStars:r.stargazers_count})}).catch(()=>{}),fetch(pt("/api/cli-mode")).then(r=>r.json()).then(r=>{r.workspaceMode?this.setState({cliMode:!0,workspaceMode:!0,isWorkspaceServer:!0}):r.cliMode&&this.setState({cliMode:!0,sdkMode:!!r.sdkMode,viewMode:"chat"})}).catch(()=>{}),i?this.loadLocalLogFile(i):this.initSSE()}componentWillUnmount(){this.eventSource&&this.eventSource.close(),this._localLogES&&(this._localLogES.close(),this._localLogES=null),this._autoSelectTimer&&clearTimeout(this._autoSelectTimer),this._loadingCountTimer&&cancelAnimationFrame(this._loadingCountTimer),this._loadingCountRafId&&cancelAnimationFrame(this._loadingCountRafId),this._cacheSaveTimer&&clearTimeout(this._cacheSaveTimer),this._evictionTimer&&clearTimeout(this._evictionTimer),this._sseTimeoutTimer&&clearTimeout(this._sseTimeoutTimer),this._sseReconnectTimer&&clearTimeout(this._sseReconnectTimer),this._streamingOffTimer&&clearTimeout(this._streamingOffTimer)}_reconnectSSE(){if(this._sseReconnectCount>=10){console.error("SSE reconnect limit reached");return}if(this._sseReconnectCount=(this._sseReconnectCount||0)+1,this.eventSource&&(this.eventSource.close(),this.eventSource=null),this._streamingOffTimer&&(clearTimeout(this._streamingOffTimer),this._streamingOffTimer=null),this._flushRafId&&(cancelAnimationFrame(this._flushRafId),this._flushRafId=null),this._chunkedEntries&&this._chunkedEntries.length>0&&Ft)try{const n=Vh([...this._chunkedEntries]);if(Array.isArray(n)&&n.length>0){const{mainAgentSessions:i}=this._processEntries(n);if(this.setState({requests:n,mainAgentSessions:i}),this.state.projectName){const r=G5(),s=r&&r.projectName===this.state.projectName?r.count:0;n.length>=s&&Il(this.state.projectName,n)}}}catch(n){console.warn("Failed to save partial entries on reconnect:",n)}this._chunkedEntries=[],this._chunkedTotal=0,this._isIncremental=!1,this._loadingCountRafId&&(cancelAnimationFrame(this._loadingCountRafId),this._loadingCountRafId=null),this._pendingEntries=[],this.setState({isStreaming:!1}),this._sseSlimmer=null,this._sseReconnectTimer&&clearTimeout(this._sseReconnectTimer),this._sseReconnectTimer=setTimeout(()=>{this.initSSE()},2e3)}animateLoadingCount(n,i){this._loadingCountTimer&&(cancelAnimationFrame(this._loadingCountTimer),this._loadingCountTimer=null);const r=Math.min(800,Math.max(300,n*.5)),s=performance.now(),o=a=>{const l=Math.min((a-s)/r,1),c=Math.round(l*n);this.setState({fileLoadingCount:c}),l<1?this._loadingCountTimer=requestAnimationFrame(o):(this._loadingCountTimer=null,i())};this._loadingCountTimer=requestAnimationFrame(o)}async loadMoreHistory(){if(!(!this.state.hasMoreHistory||this._loadingMore)){this._loadingMore=!0,this.setState({loadingMore:!0});try{const i=await(await fetch(pt(`/api/entries/page?before=${encodeURIComponent(this._oldestTs)}&limit=100`))).json();if(Array.isArray(i.entries)&&i.entries.length>0){const s=[...Vh(i.entries),...this.state.requests],{mainAgentSessions:o}=this._processEntries(s);if(this._oldestTs=i.oldestTimestamp,Ft&&o.length>ca){const a=om(s,o),l=Fb(this.state.sessionIndex,a),{hotEntries:c,allSessions:d,coldGroups:u}=Lh(s,o,l,ca),h=this.state.projectName;if(h){for(const[O,p]of u)rm(h,O,p);sm(h,l),Il(h,s)}this.setState({requests:c,mainAgentSessions:d,sessionIndex:l,hasMoreHistory:!!i.hasMore,loadingMore:!1})}else this.setState({requests:s,mainAgentSessions:o,hasMoreHistory:!!i.hasMore,loadingMore:!1}),Ft&&this.state.projectName&&Il(this.state.projectName,s)}else this.setState({hasMoreHistory:!1,loadingMore:!1})}catch(n){console.error("loadMoreHistory failed:",n),this.setState({loadingMore:!1})}this._loadingMore=!1}}initSSE(){try{let n="/events",i=!1;if(Ft){const r=G5();r&&r.lastTs&&r.count>0&&(n=`/events?since=${encodeURIComponent(r.lastTs)}&cc=${r.count}&project=${encodeURIComponent(r.projectName||"")}`,i=!0)}!i&&Ft&&(n="/events?limit=200"),i||this.setState({fileLoading:!0,fileLoadingCount:0}),this.eventSource=new EventSource(pt(n)),this.eventSource.onmessage=r=>{this._resetSSETimeout(),this.handleEventMessage(r)},this.eventSource.onopen=()=>{this._resetSSETimeout()},this.eventSource.addEventListener("resume_prompt",r=>{this._resetSSETimeout();try{const s=JSON.parse(r.data);(this._prefsReady||Promise.resolve({})).then(o=>{o!=null&&o.resumeAutoChoice?fetch(pt("/api/resume-choice"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({choice:o.resumeAutoChoice})}).catch(a=>console.error("resume-choice failed:",a)):this.setState({resumeModalVisible:!0,resumeFileName:s.recentFileName||""})})}catch{}}),this.eventSource.addEventListener("resume_resolved",()=>{this._resetSSETimeout(),this.setState({resumeModalVisible:!1,resumeFileName:"",resumeRememberChoice:!1})}),this.eventSource.addEventListener("update_completed",r=>{this._resetSSETimeout();try{const s=JSON.parse(r.data);this.setState({updateInfo:{type:"completed",version:s.version}})}catch{}}),this.eventSource.addEventListener("update_major_available",r=>{this._resetSSETimeout();try{const s=JSON.parse(r.data);this.setState({updateInfo:{type:"major",version:s.version}})}catch{}}),this.eventSource.addEventListener("load_start",r=>{this._resetSSETimeout();try{const s=JSON.parse(r.data);this._chunkedEntries=[],this._chunkedTotal=s.total||0,this._isIncremental=!!s.incremental,this._hasMoreHistory=!!s.hasMore,this._oldestTs=s.oldestTs||null,this._isIncremental||this.setState({fileLoading:!0,fileLoadingCount:0})}catch{}}),this.eventSource.addEventListener("load_chunk",r=>{this._resetSSETimeout();try{const s=JSON.parse(r.data);Array.isArray(s)&&(this._chunkedEntries.push(...s),!this._isIncremental&&!this._loadingCountRafId&&(this._loadingCountRafId=requestAnimationFrame(()=>{this._loadingCountRafId=null,this.setState({fileLoadingCount:this._chunkedEntries.length})})))}catch{}}),this.eventSource.addEventListener("load_end",()=>{this._resetSSETimeout(),this._loadingCountRafId&&(cancelAnimationFrame(this._loadingCountRafId),this._loadingCountRafId=null);const r=this._chunkedEntries;this._chunkedEntries=[],this._chunkedTotal=0;const s=this._isIncremental;this._isIncremental=!1;let o;if(s&&Ft&&this.state.requests.length>0){if(r.length===0){this.setState({fileLoading:!1,fileLoadingCount:0});return}const l=(d,u)=>d.timestamp&&d.url?`${d.timestamp}|${d.url}`:`__nokey_c${u}`,c=new Map;this.state.requests.forEach((d,u)=>c.set(l(d,u),d)),r.forEach((d,u)=>c.set(d.timestamp&&d.url?`${d.timestamp}|${d.url}`:`__nokey_d${u}`,d)),o=Array.from(c.values())}else o=r;const a=Array.isArray(o)?Vh(o):o;if(Array.isArray(a)&&a.length>0){const{mainAgentSessions:l,filtered:c}=this._processEntries(a);if(Ft&&l.length>ca){const d=om(a,l),u=s?Fb(this.state.sessionIndex,d):d,{hotEntries:h,allSessions:O,coldGroups:p}=Lh(a,l,u,ca),m=this.state.projectName;if(m){for(const[$,b]of p)rm(m,$,b);sm(m,u),Il(m,a)}const g=h.filter($=>$g($)),v={requests:h,selectedIndex:g.length>0?g.length-1:null,mainAgentSessions:O,sessionIndex:u,fileLoading:!1,fileLoadingCount:0};s||(v.hasMoreHistory=!!this._hasMoreHistory),this.setState(v)}else{const d={requests:a,selectedIndex:c.length>0?c.length-1:null,mainAgentSessions:l,fileLoading:!1,fileLoadingCount:0};s||(d.hasMoreHistory=!!this._hasMoreHistory),this.setState(d),Ft&&this.state.projectName&&Il(this.state.projectName,a)}}else this.setState({fileLoading:!1,fileLoadingCount:0})}),this.eventSource.addEventListener("full_reload",r=>{this._resetSSETimeout();try{const s=JSON.parse(r.data);if(Array.isArray(s)){const{mainAgentSessions:o,filtered:a}=s.length>0?this._processEntries(s):{mainAgentSessions:[],filtered:[]};s.length>0?this.animateLoadingCount(s.length,()=>{this.setState({requests:s,selectedIndex:a.length>0?a.length-1:null,mainAgentSessions:o,fileLoading:!1,fileLoadingCount:0,serverCachedContent:null}),Ft&&this.state.projectName&&Il(this.state.projectName,s)}):(this.setState({requests:s,selectedIndex:null,mainAgentSessions:o,fileLoading:!1,fileLoadingCount:0,serverCachedContent:null}),Ft&&__())}else this.setState({fileLoading:!1,fileLoadingCount:0})}catch{this.setState({fileLoading:!1,fileLoadingCount:0})}}),this.eventSource.addEventListener("workspace_started",r=>{this._resetSSETimeout();try{const s=JSON.parse(r.data);this._loadingCountTimer&&(cancelAnimationFrame(this._loadingCountTimer),this._loadingCountTimer=null),this._rebuildRequestIndex([]),s.projectName&&(document.title=`${s.projectName} - CC Viewer`),this.setState({workspaceMode:!1,projectName:s.projectName||"",viewMode:"chat",cliMode:!0,requests:[],mainAgentSessions:[],selectedIndex:null}),Ft&&__()}catch{}}),this.eventSource.addEventListener("workspace_stopped",()=>{this._resetSSETimeout(),this._rebuildRequestIndex([]),this.setState({workspaceMode:!0,requests:[],mainAgentSessions:[],projectName:"",selectedIndex:null})}),this.eventSource.addEventListener("context_window",r=>{this._resetSSETimeout();try{const s=JSON.parse(r.data);this.setState({contextWindow:s})}catch{}}),this.eventSource.addEventListener("kv_cache_content",r=>{var s,o,a;this._resetSSETimeout();try{const l=JSON.parse(r.data);l&&(((s=l.system)==null?void 0:s.length)>0||((o=l.messages)==null?void 0:o.length)>0||((a=l.tools)==null?void 0:a.length)>0)&&this.setState({serverCachedContent:l})}catch(l){console.error("Failed to parse kv_cache_content:",l)}}),this.eventSource.addEventListener("proxy_profile",r=>{this._resetSSETimeout();try{const s=JSON.parse(r.data);s.active&&this.setState({activeProxyId:s.active}),s.profile&&fetch(pt("/api/proxy-profiles")).then(o=>o.json()).then(o=>{o.profiles&&this.setState({proxyProfiles:o.profiles,activeProxyId:o.active||"max"})}).catch(()=>{})}catch{}}),this.eventSource.addEventListener("ping",()=>{this._resetSSETimeout()}),this.eventSource.addEventListener("streaming_status",r=>{this._resetSSETimeout();try{JSON.parse(r.data).active?(clearTimeout(this._streamingOffTimer),this.setState({isStreaming:!0})):(clearTimeout(this._streamingOffTimer),this._streamingOffTimer=setTimeout(()=>{this.setState({isStreaming:!1})},2e3))}catch(s){console.error("Failed to parse streaming_status:",s)}}),this.eventSource.onerror=()=>console.error("SSE连接错误")}catch(n){console.error("EventSource初始化失败:",n),this.setState({fileLoading:!1,fileLoadingCount:0})}}loadLocalLogFile(n){this._isLocalLog=!0,this._localLogFile=n,this.setState({fileLoading:!0,fileLoadingCount:0,serverCachedContent:null}),this._localLogES&&(this._localLogES.close(),this._localLogES=null);const i=[],r=new EventSource(pt(`/api/local-log?file=${encodeURIComponent(n)}`));this._localLogES=r,r.addEventListener("load_start",s=>{try{const o=JSON.parse(s.data);this.setState({fileLoadingCount:0})}catch{}}),r.addEventListener("load_chunk",s=>{try{const o=JSON.parse(s.data);if(Array.isArray(o)){for(const a of o)i.push(a);this.setState({fileLoadingCount:i.length})}}catch{}}),r.addEventListener("load_end",()=>{r.close();const s=Vh(i),o=que(js);for(let a=0;a<s.length;a++)o.process(s[a],s,a);if(o.finalize(s),Array.isArray(s)&&s.length>0){const{mainAgentSessions:a,filtered:l}=this._processEntries(s);this.setState({requests:s,selectedIndex:l.length>0?l.length-1:null,mainAgentSessions:a,fileLoading:!1,fileLoadingCount:0,serverCachedContent:null})}else this.setState({fileLoading:!1,fileLoadingCount:0,serverCachedContent:null})}),r.onerror=()=>{r.close(),console.error("加载日志文件 SSE 连接错误"),this.setState({fileLoading:!1,fileLoadingCount:0})}}handleEventMessage(n){try{const i=JSON.parse(n.data);this._pendingEntries.push(i),this._flushRafId||(this._flushRafId=requestAnimationFrame(this._flushPendingEntries))}catch(i){console.error("处理事件消息失败:",i)}}async loadSession(n){if(this._loadingSessionId==null){this._loadingSessionId=n,this.setState({loadingSessionId:n});try{let i=await ahe(this.state.projectName,n);if(!i||i.length===0){const r=(this.state.sessionIndex||[]).find(s=>s.sessionId===n);r&&r.lastTs&&(i=(await(await fetch(pt(`/api/entries/page?before=${encodeURIComponent(r.lastTs)}&limit=200`))).json()).entries||[])}if(i&&i.length>0){const s=[...Vh(i),...this.state.requests],{mainAgentSessions:o}=this._processEntries(s),a=om(s,o),l=Fb(this.state.sessionIndex,a),{hotEntries:c,allSessions:d,coldGroups:u}=Lh(s,o,l,ca,new Set([n])),h=this.state.projectName;if(h){for(const[O,p]of u)rm(h,O,p);sm(h,l),Il(h,s)}this.setState({requests:c,mainAgentSessions:d,sessionIndex:l,loadingSessionId:null})}else this.setState({loadingSessionId:null})}catch(i){console.error("loadSession failed:",i),this.setState({loadingSessionId:null})}this._loadingSessionId=null}}_evictColdSessions(){const{requests:n,mainAgentSessions:i,projectName:r}=this.state;if(!Ft||i.length<=ca)return;const{hotEntries:s,allSessions:o,coldGroups:a}=Lh(n,i,this.state.sessionIndex,ca),l=this.state.sessionIndex;if(r){for(const[c,d]of a)rm(r,c,d);sm(r,l)}this.setState({requests:s,mainAgentSessions:o,sessionIndex:l})}mergeMainAgentSessions(n,i){return che(n,i)}renderLogTable(n,i){const r=[{title:"",dataIndex:"file",key:"check",width:40,fixed:i?"left":!1,render:s=>w.jsx(yl,{checked:this.state.selectedLogs.has(s)||!1,onClick:o=>o.stopPropagation(),onChange:o=>{o.stopPropagation(),this.handleToggleLogSelect(s,o.target.checked)}})},{title:le("ui.logTime"),dataIndex:"timestamp",key:"time",width:i?150:180,render:s=>w.jsx("span",{className:el.tableTimestampCell,children:this.formatTimestamp(s,i)})},{title:le("ui.logPreview"),dataIndex:"preview",key:"preview",width:i?150:void 0,ellipsis:!0,render:s=>{if(!Array.isArray(s)||s.length===0)return"—";const o=s[0],a=o.length<=30&&s.length>1?`${o} | ${s[1]}`:o;return s.length<=1?w.jsx("span",{className:el.tablePreviewText,children:a}):w.jsx(Sl,{trigger:i?"click":"hover",placement:i?"bottomLeft":"leftTop",autoAdjustOverflow:{adjustX:!1,adjustY:!0},overlayInnerStyle:{background:"#1e1e1e",border:"1px solid #3a3a3a",borderRadius:8,padding:0,maxHeight:400,overflowY:"auto"},content:w.jsx("div",{className:el.previewPopover,children:s.map((l,c)=>w.jsx("div",{className:el.previewItem,children:w.jsx("pre",{className:el.previewText,children:l})},c))}),children:w.jsx("span",{className:el.tablePreviewTextClickable,style:{textDecoration:i?"underline dotted #666":"none"},children:a})})}},...i?[]:[{title:le("ui.logTurns"),dataIndex:"turns",key:"turns",width:80,render:s=>w.jsx(Sv,{className:el.tableTag,children:s||0})}],{title:le("ui.logSize"),dataIndex:"size",key:"size",width:90,render:s=>w.jsx(Sv,{className:el.tableTag,children:this.formatSize(s)})},{title:le("ui.logActions"),key:"actions",width:i?160:180,render:(s,o)=>w.jsxs("span",{className:el.tableActionsCell,children:[w.jsx(ai,{size:"small",type:"primary",onClick:a=>{a.stopPropagation(),this.handleOpenLogFile(o.file)},children:le("ui.openLog")}),w.jsx(ai,{size:"small",icon:w.jsx(Vde,{}),onClick:a=>{a.stopPropagation(),this.handleDownloadLogFile(o.file)},children:le("ui.downloadLog")})]})}];return w.jsx(Tl,{size:"small",dataSource:n,columns:r,rowKey:"file",pagination:!1,scroll:i?{x:"max-content",y:"calc(100vh - 160px)"}:{y:400},onRow:s=>({onClick:()=>{const o=!this.state.selectedLogs.has(s.file);this.handleToggleLogSelect(s.file,o)},style:{cursor:"pointer"}})})}formatTimestamp(n,i){return!n||n.length<15?n:i?`${n.slice(4,6)}-${n.slice(6,8)} ${n.slice(9,11)}:${n.slice(11,13)}:${n.slice(13,15)}`:`${n.slice(0,4)}-${n.slice(4,6)}-${n.slice(6,8)} ${n.slice(9,11)}:${n.slice(11,13)}:${n.slice(13,15)}`}formatSize(n){return n<1024?n+" B":n<1024*1024?(n/1024).toFixed(1)+" KB":(n/(1024*1024)).toFixed(1)+" MB"}renderPrepare(){const{requests:n,selectedIndex:i,showAll:r,fileLoading:s,fileLoadingCount:o,mainAgentSessions:a,viewMode:l}=this.state;(this._filteredSource!==n||this._filteredShowAll!==r)&&(this._filteredSource=n,this._filteredShowAll=r,this._filteredRequests=r?n:Gb(n));const c=this._filteredRequests;this._cacheLossShowAll!==r&&(this._cacheLossShowAll=r,this._cacheLossMap=new Map,this._cacheLossLastMainAgent=null,this._cacheLossProcessedCount=0),c.length<this._cacheLossProcessedCount&&(this._cacheLossMap=new Map,this._cacheLossLastMainAgent=null,this._cacheLossProcessedCount=0),c.length>this._cacheLossProcessedCount&&(this._cacheLossLastMainAgent=LA(this._cacheLossMap,c,this._cacheLossProcessedCount,this._cacheLossLastMainAgent),this._cacheLossProcessedCount=c.length);const d=i!==null?c[i]:null;return{filteredRequests:c,selectedRequest:d,fileLoading:s,fileLoadingCount:o,mainAgentSessions:a,viewMode:l}}renderWorkspaceMode(){return w.jsx(ra,{theme:{algorithm:jb.darkAlgorithm,token:{colorPrimary:"#1668dc",colorBgContainer:"#111",colorBgLayout:"#0a0a0a",colorBgElevated:"#1e1e1e",colorBorder:"#2a2a2a"}},children:w.jsx(Aue,{onLaunch:this.handleWorkspaceLaunch})})}get themeConfig(){return this.state.themeColor==="light"?{algorithm:jb.defaultAlgorithm,token:{colorPrimary:"#0969DA",colorBgContainer:"#FFFFFF",colorBgLayout:"#FAFAFA",colorBgElevated:"#FFFFFF",colorBorder:"#E0E0E0",controlOutline:"transparent",controlOutlineWidth:0}}:{algorithm:jb.darkAlgorithm,token:{colorPrimary:"#1668dc",colorBgContainer:"#111",colorBgLayout:"#0a0a0a",colorBgElevated:"#1e1e1e",colorBorder:"#2a2a2a",controlOutline:"transparent",controlOutlineWidth:0}}}}function fP(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var _d=fP();function DA(t){_d=t}var Mc={exec:()=>null};function An(t,e=""){let n=typeof t=="string"?t:t.source,i={replace:(r,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(Ss.caret,"$1"),n=n.replace(r,o),i},getRegex:()=>new RegExp(n,e)};return i}var FOe=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Ss={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},HOe=/^(?:[ \t]*(?:\n|$))+/,KOe=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,JOe=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,$p=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,efe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,pP=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,UA=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,qA=An(UA).replace(/bull/g,pP).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),tfe=An(UA).replace(/bull/g,pP).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),mP=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,nfe=/^[^\n]+/,gP=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ife=An(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",gP).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),rfe=An(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,pP).getRegex(),O$="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",vP=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,sfe=An("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",vP).replace("tag",O$).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ZA=An(mP).replace("hr",$p).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",O$).getRegex(),ofe=An(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ZA).getRegex(),$P={blockquote:ofe,code:KOe,def:ife,fences:JOe,heading:efe,hr:$p,html:sfe,lheading:qA,list:rfe,newline:HOe,paragraph:ZA,table:Mc,text:nfe},H5=An("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",$p).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",O$).getRegex(),afe={...$P,lheading:tfe,table:H5,paragraph:An(mP).replace("hr",$p).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",H5).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",O$).getRegex()},lfe={...$P,html:An(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",vP).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Mc,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:An(mP).replace("hr",$p).replace("heading",` *#{1,6} *[^
717
+ `):JSON.stringify(t.content):String(t.content??"")}const Jue=[{match:/claude/i,name:"Claude",color:"var(--bg-model-avatar)",svg:'<svg t="1771495509570" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1570" width="200" height="200"><path d="M198.4 678.4l198.4-115.2 6.4-12.8H243.2l-96-6.4-102.4-6.4-19.2-6.4-25.6-25.6v-12.8l19.2-12.8h32l64 6.4 96 6.4 70.4 6.4L384 512h19.2V492.8l-6.4-6.4-102.4-64-108.8-76.8-51.2-38.4-32-19.2-19.2-25.6-6.4-38.4 32-32h44.8l38.4 32 83.2 64L384 364.8l12.8 12.8 6.4-6.4-6.4-12.8L339.2 256l-64-108.8-25.6-38.4-6.4-25.6c0-12.8-6.4-19.2-6.4-32l32-44.8 19.2-6.4 44.8 6.4 19.2 12.8 25.6 57.6 44.8 96 64 128 19.2 38.4 6.4 38.4 6.4 12.8h6.4V384l6.4-70.4 12.8-89.6 12.8-115.2 6.4-32 19.2-38.4 32-19.2 25.6 12.8 19.2 32v19.2l-32 70.4-19.2 121.6-19.2 83.2h6.4l12.8-12.8 44.8-57.6 70.4-89.6 32-32 38.4-38.4 25.6-19.2h44.8l32 51.2-12.8 51.2-51.2 57.6-38.4 51.2-51.2 70.4-38.4 57.6v6.4h6.4l121.6-25.6 64-12.8 76.8-12.8 38.4 19.2 6.4 19.2-12.8 32-83.2 19.2-96 19.2-147.2 32 64 6.4h96l128 6.4 32 19.2 25.6 38.4-6.4 19.2-51.2 25.6-70.4-12.8-160-38.4-57.6-12.8h-6.4v6.4l44.8 44.8 83.2 76.8 108.8 102.4 6.4 25.6-12.8 19.2h-12.8l-96-70.4-38.4-32-83.2-70.4h-6.4v6.4l19.2 25.6 102.4 147.2 6.4 44.8-6.4 12.8-25.6 6.4-25.6-6.4-57.6-83.2-64-83.2-51.2-83.2-6.4 6.4-25.6 307.2-12.8 12.8-32 12.8-25.6-19.2-12.8-32 12.8-64 19.2-83.2 12.8-64 12.8-83.2 6.4-25.6h-6.4l-64 83.2-96 128-70.4 76.8-19.2 6.4-32-12.8v-25.6l19.2-25.6 102.4-128 64-83.2 38.4-51.2v-6.4l-268.8 172.8-51.2 12.8-19.2-19.2v-32l12.8-12.8 76.8-57.6z m0 0" fill="#D97757" p-id="1571"></path></svg>'},{match:/gpt|o1|o3|o4/i,name:"OpenAI",color:"var(--bg-model-avatar)",svg:'<svg t="1771495569354" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2752" width="200" height="200"><path d="M565.265178 954.519092c-22.289934 0-48.400999-8.151747-67.952455-14.838727a103.425292 103.425292 0 0 1-26.875292-11.272338c-12.737105-7.769634-15.411897-8.342804-19.806198-24.773669 21.971506-5.158528 81.581157-41.905075 103.871091-55.342721 148.896757-89.159735 119.028246-10.444426 119.028246-364.981743 15.029784 3.566389 82.791182 32.415932 82.791182 57.316972 0 133.102747 20.570425 273.847757-52.604243 354.91943-22.799418 25.47421-91.834527 58.972796-138.388646 58.972796z m-433.061569-299.321966c258.626916 136.860193 184.369594 157.048504 357.721593 52.094759 44.579867-27.193719 90.433445-49.292596 132.593263-77.568969v101.896839c-95.528287 22.226248-272.319304 227.038896-419.050754 100.686815l-25.856323-25.155782c-37.319718-43.943012-45.344094-72.410442-45.344094-151.889977z m375.744596-19.105658c-19.933569-13.310275-79.479535-51.330533-101.896839-57.316972v-133.739602a1158.312326 1158.312326 0 0 0 101.896839-57.316973c43.943012 10.189684 70.690933 47.063603 114.633945 57.316973v127.371049c-17.831947 12.10025-95.846715 58.718054-114.633945 63.749211z m-426.693016-178.31947c0-63.685525-4.26693-90.306074 38.84817-145.776166 23.945757-30.88748 47.509402-39.612396 82.090641-57.953828v261.110652c44.134069 23.372588 83.873836 49.037854 129.345301 74.448379l131.765351 78.396881c-59.545966 15.921381-63.685525 61.32916-109.602788 33.753328-104.699003-62.730242-272.38299-129.345301-272.38299-243.91556z m866.123138 127.37105c0 79.543221-47.573087 161.188063-121.002497 178.31947v-165.582365c0-82.791182 9.743885-84.574377-48.910483-116.608196L565.265178 362.371082c15.79401-23.62733 22.608361-19.105657 48.146256-34.835982 41.714019-25.47421 39.039227-16.112438 117.053995 28.785857 94.190891 54.196382 216.849212 100.559444 216.849212 228.885777z m-541.326961-197.425127v-95.528287c43.751956-23.181531 90.688187-50.94842 133.357489-76.804743 82.154327-49.547338 95.528287-63.303412 185.006449-63.303412 48.464684 0 102.533695 36.746548 125.651541 65.405034 42.223503 52.22213 39.930824 92.662439 39.930824 151.125751-31.078536-16.494551-192.393971-121.002497-222.899337-121.002498s-229.650003 123.422547-261.110652 140.108155z m-50.94842 159.213812c-16.36718-10.95391-63.112355-39.99451-82.791183-44.579867 0-168.320842-33.880699-314.606493 67.952455-390.519639 56.043262-41.714019 113.169178-53.814269 181.376375-30.696423 25.47421 8.661231 35.536523 20.888852 56.36169 26.429493-11.781822 16.048752-80.68956 50.311565-102.278953 63.303412-154.564769 93.235608-120.620384 7.451206-120.620384 376.063024z m-292.953415 121.002498c0 169.148754 115.143429 280.853165 274.293556 273.847756 59.800708-2.674792 26.811606-7.705949 69.417222 25.47421 97.820966 76.741057 228.822091 73.747838 319.637649 1.018969a251.939936 251.939936 0 0 0 52.604244-55.661149c58.20857-85.274918-10.95391-45.598836 81.96327-83.619094 130.236898-53.241099 199.399378-217.358696 128.64476-355.428914-27.448461-53.559526-40.249252-28.849543-28.276373-104.699003 18.723544-118.582447-63.176041-230.032116-157.621674-269.771884-98.90362-41.586648-129.090559 12.737105-178.892639-37.574459A161.888604 161.888604 0 0 0 580.103905 28.913674C474.003821-27.766443 331.284559 1.528898 258.428319 93.681853c-81.326415 102.979494 9.489143 54.705866-92.407697 98.648878C15.149614 257.353652-33.251385 439.175825 41.579107 561.06992c56.807488 92.598753 20.570425 4.967471 20.570424 106.800625z" fill="#EFA474" p-id="2753"></path></svg>'},{match:/gemini/i,name:"Gemini",color:"var(--bg-model-avatar)",svg:'<svg t="1771495622863" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4556" width="200" height="200"><path d="M960 512.896A477.248 477.248 0 0 0 512.896 960h-1.792A477.184 477.184 0 0 0 64 512.896v-1.792A477.184 477.184 0 0 0 511.104 64h1.792A477.248 477.248 0 0 0 960 511.104z" fill="#448AFF" p-id="4557"></path></svg>'},{match:/qwen/i,name:"Qwen",color:"var(--bg-model-avatar)",svg:'<svg t="1771495640319" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5634" width="200" height="200"><path d="M537.782857 57.161143c16.749714 29.44 33.426286 58.953143 50.102857 88.502857a7.68 7.68 0 0 0 6.692572 3.913143h236.873143c7.424 0 13.750857 4.681143 19.017142 13.933714l62.061715 109.677714c8.082286 14.372571 10.24 20.370286 1.024 35.693715a2262.893714 2262.893714 0 0 0-32.438857 55.478857l-15.652572 28.086857c-4.534857 8.338286-9.508571 11.922286-1.718857 21.833143l113.152 197.851428c7.314286 12.8 4.754286 21.065143-1.828571 32.841143-18.651429 33.499429-37.632 66.742857-56.978286 99.84-6.765714 11.593143-14.994286 16.018286-29.001143 15.798857a1833.398857 1833.398857 0 0 0-99.291429 0.658286 4.242286 4.242286 0 0 0-3.437714 2.157714 24571.830857 24571.830857 0 0 1-115.419428 202.24c-7.204571 12.507429-16.201143 15.469714-30.939429 15.506286-42.532571 0.146286-85.430857 0.182857-128.731429 0.109714a22.930286 22.930286 0 0 1-19.821714-11.556571l-56.978286-99.108571a3.84 3.84 0 0 0-3.547428-2.121143h-218.331429a76.288 76.288 0 0 1-34.377143-3.913143l-68.388571-118.198857a23.149714 23.149714 0 0 1-0.073143-23.04l51.492572-90.441143a8.448 8.448 0 0 0 0-8.411429 23594.496 23594.496 0 0 1-80.018286-139.593143L47.542857 425.325714c-6.838857-13.202286-7.387429-21.138286 4.022857-41.179428 19.858286-34.669714 39.570286-69.302857 59.209143-103.936 5.632-9.984 12.946286-14.262857 24.905143-14.262857 36.827429-0.182857 73.654857-0.182857 110.445714-0.073143 1.901714 0 3.657143-1.024 4.571429-2.669715l119.734857-208.859428a20.845714 20.845714 0 0 1 17.993143-10.496c22.381714-0.036571 44.946286 0 67.547428-0.256l43.410286-0.987429c14.555429-0.109714 30.866286 1.389714 38.4 14.518857z m-146.432 17.188571a2.56 2.56 0 0 0-2.194286 1.28l-122.331428 213.942857a6.692571 6.692571 0 0 1-5.741714 3.364572H138.788571c-2.377143 0-2.962286 1.060571-1.755428 3.145143l247.917714 433.334857c1.060571 1.792 0.548571 2.633143-1.462857 2.669714l-119.222857 0.658286a9.289143 9.289143 0 0 0-8.557714 4.937143l-56.32 98.56c-1.865143 3.328-0.914286 5.046857 2.925714 5.046857l243.858286 0.365714c1.974857 0 3.401143 0.841143 4.425142 2.56l59.867429 104.704c1.974857 3.474286 3.913143 3.510857 5.924571 0l213.577143-373.76 33.426286-58.953143a2.340571 2.340571 0 0 1 4.096 0l60.745143 107.958857a5.193143 5.193143 0 0 0 4.571428 2.633143l117.906286-0.841143a1.718857 1.718857 0 0 0 1.462857-2.56l-123.721143-217.014857a4.608 4.608 0 0 1 0-4.827428l12.507429-21.613715 47.798857-84.370285c1.024-1.755429 0.512-2.633143-1.499428-2.633143H392.521143c-2.486857 0-3.108571-1.097143-1.828572-3.291429l61.184-106.861714a4.571429 4.571429 0 0 0 0-4.864l-58.258285-102.253714a2.56 2.56 0 0 0-2.267429-1.316572z m268.361143 342.198857c1.974857 0 2.486857 0.841143 1.462857 2.56l-35.474286 62.500572-111.542857 195.620571a2.377143 2.377143 0 0 1-2.121143 1.243429 2.486857 2.486857 0 0 1-2.121142-1.243429l-147.346286-257.353143c-0.841143-1.462857-0.402286-2.230857 1.206857-2.304l9.216-0.512 286.793143-0.512h-0.073143z" fill="#7D5DED" p-id="5635"></path></svg>'},{match:/kimi|moonshot/i,name:"Kimi",color:"var(--bg-model-avatar)",svg:'<svg t="1771495664798" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6649" width="200" height="200"><path d="M731.062857 590.262857v318.317714h-148.589714V443.977143a146.285714 146.285714 0 0 1-146.285714 146.285714l-214.491429-0.036571v318.354285H73.142857V165.814857h148.553143v275.858286h180.882286l119.771428-275.858286h167.753143l-67.84 156.269714a255.524571 255.524571 0 0 1-106.678857 119.588572h66.925714a148.553143 148.553143 0 0 1 148.516572 148.589714z m120.758857-473.965714a99.035429 99.035429 0 0 1 0 198.070857h-99.035428V215.332571a99.035429 99.035429 0 0 1 99.035428-99.035428z" fill="#F4F4F4" p-id="6650"></path></svg>'},{match:/glm|chatglm/i,name:"GLM",color:"var(--bg-model-avatar)",svg:'<svg data-name="glm" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 217.2 200"> <!-- Generator: Adobe Illustrator 29.8.2, SVG Export Plug-In . SVG Version: 2.1.1 Build 3) --> <defs> <style> .st0 { fill: #fff; } </style> </defs> <path class="st0" d="M86.8,190.4H0L131.3,4.8h85.8L86.8,190.4h0ZM212.8,190h-107.9l14.9-21.6c2.3-3.3,6-5.2,9.9-5.2h83.1v26.8h0ZM99.4,26.3c-2.3,3.3-6,5.2-9.9,5.2H6.4V4.8h107.9l-14.9,21.6Z"/> </svg>'},{match:/minimax|abab/i,name:"MiniMax",color:"var(--bg-model-avatar)",svg:'<svg viewBox="0 0 24 24" fill="#fff"><path d="M4 8l4-4 4 4 4-4 4 4v8l-4 4-4-4-4 4-4-4z" fill="none" stroke="#fff" stroke-width="1.5" stroke-linejoin="round"/></svg>'},{match:/deepseek/i,name:"DeepSeek",color:"var(--bg-model-avatar)",svg:'<svg t="1771495947541" class="icon" viewBox="0 0 1391 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11539" width="200" height="200"><path d="M1326.70201318 112.02090779c-12.94676356-6.47485468-18.53640721 5.86654827-26.0997327 12.13814316-2.57756953 2.02376031-4.77807747 4.65435413-6.9785854 7.08168819-18.91788751 20.63528526-41.02017805 34.19182812-69.92725218 32.57311444-42.23384508-2.42733405-78.29772513 11.12773591-110.16384908 44.10589703-6.77679853-40.66668282-29.28560862-64.94444203-63.55255448-80.52327231-17.95608583-8.09209545-36.06388005-16.1856638-48.63358202-33.78825438-8.74900746-12.5431898-11.12773591-26.50330641-15.52727888-40.26016327-2.7823022-8.29535522-5.56460442-16.79249731-14.92044538-18.20942411-10.19244639-1.61871367-14.16337637 7.08168818-18.15934561 14.36516325-15.93232553 29.74073376-22.12880269 62.51710799-21.49692994 95.69705596 1.36684831 74.65672404 32.27117059 134.13819156 93.62469006 176.42358804 6.9800583 4.8546681 8.77551959 9.71080912 6.57501165 16.79102439-4.17271686 14.56695011-9.18056624 28.7303265-13.55506995 43.29727663-2.78377509 9.30723537-6.95501906 11.32952278-16.74241882 7.28347507-33.66158524-14.36516325-62.745407-35.60875491-88.46513227-61.30196806-43.62425973-43.09548975-83.0772755-90.64060097-132.26613965-127.86659667a581.67054343 581.67054343 0 0 0-35.07703915-24.48101901c-50.20074429-49.77065841 6.57501167-90.63912807 19.72650789-95.49526908 13.73181759-5.05792788 4.77955037-22.4572587-39.65480265-22.25547181s-85.07599655 15.3770434-136.87041526 35.60875491c-7.58541892 3.03416756-15.55379103 5.25971475-23.69596499 7.08168819-47.03990759-9.10544849-95.84876434-11.12773591-146.8596019-5.26118765-96.02551195 10.92594905-172.73103555 57.25739323-229.12678412 136.36373875-67.72674425 95.09022244-83.68558192 203.13015422-64.13582165 315.82149435 20.48504978 118.76262107 79.88992666 217.09027084 171.13736114 293.97106918 94.6350973 79.71317902 203.61031862 118.76262107 327.93607117 111.27735913 75.51542292-4.45256725 159.57953934-14.77020989 254.41642354-96.71040901 23.92426399 12.13961607 49.03715574 16.99575708 90.66564019 20.63675815 32.09295007 3.03416756 62.97223311-1.61871367 86.87145788-6.67664152 37.45429471-8.09209545 34.84874013-43.49906349 21.31870939-49.97244528-109.7838417-52.19946535-85.68283009-30.95587367-107.58333373-48.15194474 55.78891504-67.37324899 139.85303146-137.3770918 172.73103555-364.17669887 2.60408167-18.00616433 0.40357375-29.33568711 0-43.90263724-0.20325977-8.90218873 1.76894914-12.34287584 11.75960867-13.35328309 27.49014733-3.23742733 54.19671351-10.92594905 78.70277179-24.68280588 71.11440706-39.65480265 99.81822142-104.80250446 106.59649284-182.89844271 1.01188015-11.9363563-0.20178686-24.27775924-12.56970195-30.54935413M706.87018452 814.87993343c-106.36966673-85.37941333-157.98733782-113.5014334-179.30604722-112.28776638-19.92829476 1.21366703-16.33737217 24.48101902-11.96286844 39.65480264 4.5777635 14.97199677 10.57098089 25.2896394 18.94145384 38.44113563 5.76786417 8.70040186 9.76383341 21.64863831-5.78995762 31.35944742-34.26841876 21.64863831-93.82647692-7.28347506-96.60730623-8.69892897-69.3454579-41.67856295-127.33635378-96.710409-168.1797842-171.97249368-39.45154288-72.43117687-62.33888747-150.1220685-66.13306983-233.07267483-1.01188015-20.02992464 4.77955037-27.11161282 24.27923214-30.75408682a235.19659216 235.19659216 0 0 1 77.91771774-2.02228741c108.59668681 16.18713669 201.05631542 65.75453531 278.54394728 144.25552022 44.23256614 44.71125762 77.69089163 98.12439001 112.1861365 150.32385536 36.64567431 55.43394691 76.0986901 108.24024576 126.29943438 151.53604947 17.72778682 15.17378365 31.86465106 26.7065662 45.41972102 35.20370829-40.84343042 4.65435413-108.99878765 5.66476139-155.60860936-31.96628094m51.00936468-334.83953883c0-8.90218873 6.9815312-15.98387693 15.75557791-15.98387693q2.98408908 0.05155138 5.36134463 1.01188017a15.85720779 15.85720779 0 0 1 10.16740714 14.97199676 15.78061715 15.78061715 0 0 1-15.73053865 15.98387691 15.60386953 15.60386953 0 0 1-15.55379103-15.98387691m158.39238446 82.95060635c-10.1423679 4.24930749-20.30830215 7.89178146-30.09570191 8.29535522-15.12370514 0.81009328-31.66286419-5.46150162-40.61513142-13.15002332-13.96011661-11.93782919-23.92573689-18.61447073-28.09845373-39.45301577-1.79546129-8.90218873-0.81009328-22.65904557 0.78505403-30.54935414 3.59092258-16.99575708-0.40504665-27.92023321-12.13961606-37.8343021-9.55910075-8.09356835-21.72522894-10.31911553-35.07703915-10.31911552-4.98281013 0-9.55910075-2.22407429-12.94823645-4.04604774a13.27669246 13.27669246 0 0 1-5.76639128-18.61299783c1.39041466-2.8323807 8.16868608-9.71228202 9.7623605-10.92594905 18.13136058-10.52090241 39.04649623-7.08021529 58.36795748 0.81009328 17.93104659 7.48526194 31.46107731 21.24359167 51.01083757 40.6666828 19.92829476 23.46913885 23.51921733 29.94399353 34.84874013 47.54511123 8.97877936 13.75685685 17.14746545 27.92023321 22.71206987 44.10442409 3.41270206 10.11732865-0.98684091 18.41121097-12.74644958 23.46913885" fill="#4D6BFE" p-id="11540"></path></svg>'}];function S_(t){if(!t)return null;for(const e of Jue)if(e.match.test(t))return{name:t.replace(/^claude-/,"").replace(/-\d{8,}$/,""),provider:e.name,color:e.color,svg:e.svg};return{name:t,provider:t,color:"var(--bg-model-avatar)",svg:null}}function y_(t){return t==="user"?'<svg viewBox="0 0 24 24"><path d="M12 12c2.7 0 4.8-2.1 4.8-4.8S14.7 2.4 12 2.4 7.2 4.5 7.2 7.2 9.3 12 12 12zm0 2.4c-3.2 0-9.6 1.6-9.6 4.8v2.4h19.2v-2.4c0-3.2-6.4-4.8-9.6-4.8z"/></svg>':t==="agent"?'<svg viewBox="0 0 24 24"><path d="M12 2a2 2 0 012 2c0 .74-.4 1.39-1 1.73V7h1a7 7 0 017 7h1a1 1 0 011 1v3a1 1 0 01-1 1h-1.17A7 7 0 0113 22h-2a7 7 0 01-6.83-3H3a1 1 0 01-1-1v-3a1 1 0 011-1h1a7 7 0 017-7h1V5.73c-.6-.34-1-.99-1-1.73a2 2 0 012-2zM9.5 13a1.5 1.5 0 100 3 1.5 1.5 0 000-3zm5 0a1.5 1.5 0 100 3 1.5 1.5 0 000-3z"/></svg>':t==="sub-search"||t==="sub-explore"?'<svg viewBox="0 0 1024 1024"><path d="M128.957606 76.608479v495.401496c0 20.428928-17.875312 38.304239-38.304239 38.304239S52.349127 592.438903 52.349127 572.009975V38.304239c0-20.428928 17.875312-38.304239 38.30424-38.304239h426.453865c20.428928 0 38.304239 17.875312 38.304239 38.304239s-17.875312 38.304239-38.304239 38.30424H128.957606z m127.680798 127.680798v495.401496c0 20.428928-17.875312 38.304239-38.304239 38.304239S180.029925 720.119701 180.029925 699.690773V165.985037c0-20.428928 17.875312-38.304239 38.30424-38.304239h426.453865c20.428928 0 38.304239 17.875312 38.304239 38.304239s-17.875312 38.304239-38.304239 38.30424H256.638404z m579.670823 291.112219v-150.663341H399.640898v515.830424h76.608479c0 38.304239 30.643392 68.947631 43.411471 89.376558h-145.55611c-33.197007 0-61.286783-28.089776-61.286783-63.840399V321.755611c0-35.750623 28.089776-63.840399 61.286783-63.840399h490.294264c33.197007 0 61.286783 28.089776 61.286784 63.840399V564.349127c-20.428928-22.982544-58.733167-56.179551-89.376559-68.947631zM486.46384 411.13217h255.361596c15.321696 0 25.53616 10.214464 25.53616 25.536159s-10.214464 25.53616-25.53616 25.53616H486.46384c-15.321696 0-25.53616-10.214464-25.536159-25.53616s10.214464-25.53616 25.536159-25.536159z m0 102.144638h102.144639c15.321696 0 25.53616 10.214464 25.536159 25.53616s-10.214464 25.53616-25.536159 25.536159h-102.144639c-15.321696 0-25.53616-10.214464-25.536159-25.536159s10.214464-25.53616 25.536159-25.53616z m503.062345 492.84788c-2.553616 2.553616-7.660848 10.214464-12.76808 10.214464-10.214464 10.214464-35.750623 10.214464-45.965088 0l-81.71571-71.501247c-28.089776 17.875312-63.840399 28.089776-99.591023 28.089776-102.144638 0-186.413965-84.269327-186.413965-186.413965s84.269327-186.413965 186.413965-186.413965 186.413965 84.269327 186.413965 186.413965c0 38.304239-10.214464 71.501247-30.643391 99.591022l81.715711 71.501247c12.76808 12.76808 12.76808 35.750623 2.553616 48.518703z m-240.039901-324.309227c-58.733167 0-104.698254 48.518703-104.698254 104.698255 0 58.733167 48.518703 104.698254 104.698254 104.698254s104.698254-48.518703 104.698255-104.698254c2.553616-58.733167-45.965087-104.698254-104.698255-104.698255z" fill="#ffffff"/></svg>':t==="sub-plan"?'<svg viewBox="0 0 1024 1024"><path d="M674.507676 598.338391 287.079856 598.338391c-14.136975 0-25.638937 11.499915-25.638937 25.63689 0 14.137998 11.501962 25.640983 25.638937 25.640983l387.42782 0c14.137998 0 25.640983-11.501962 25.640983-25.640983C700.148659 609.838306 688.646698 598.338391 674.507676 598.338391zM794.746154 384.583029c-14.137998 0-25.640983 11.501962-25.640983 25.63996l0 494.299873c0 0.130983 0 0.280386-0.001023 0.433882-0.899486 0.279363-2.665713 0.644683-5.764284 0.644683L200.047664 905.601426c-4.312212 0-7.564279-2.971681-7.564279-6.913457L192.483384 191.851493c0-4.493338 0.974188-8.28878 1.811252-9.821693l373.337917 0c14.136975 0 25.63996-11.501962 25.63996-25.63996 0-14.136975-11.501962-25.638937-25.63996-25.638937l-374.069581 0c-30.336936 0-52.357462 25.696242-52.357462 61.099566l0 706.836477c0 32.086789 26.396183 58.19133 58.84113 58.19133l563.293223 0c34.119075 0 57.042157-21.041222 57.042157-52.356438L820.382021 410.224012C820.383044 396.086014 808.883129 384.583029 794.746154 384.583029zM674.507676 745.295394 287.079856 745.295394c-14.136975 0-25.638937 11.499915-25.638937 25.63689 0 14.137998 11.501962 25.640983 25.638937 25.640983l387.42782 0c14.137998 0 25.640983-11.501962 25.640983-25.640983C700.148659 756.795309 688.646698 745.295394 674.507676 745.295394zM879.595634 157.107177c-3.77293-14.409175-12.871145-28.250414-24.964578-37.975916l-43.827181-35.240619c-12.880355-10.352789-29.27679-16.290011-44.986587-16.290011-16.876366 0-31.594579 6.747681-41.439808 18.995633l-19.624966 24.381293c-6.380314 7.968485-7.987928 17.577331-5.222955 26.916023l-114.241904 142.063553-2.486634 3.090385-22.812565 85.303828c-9.749038 30.859845 4.449335 48.075949 13.806447 55.608505 6.783497 5.450129 14.468526 8.728802 22.851451 9.754155 0.984421 0.246617 2.125407 0.488117 3.440355 0.632403 1.003863 0.110517 2.053776 0.167822 3.118014 0.167822l0.014326 0c4.588505 0 10.047844-0.9967 17.180288-3.13541l2.877537-1.065262 83.402525-41.897226 119.874181-149.07934c0.440022 0.017396 0.880043 0.032746 1.320065 0.032746 9.218966 0 17.411555-3.862981 23.077601-10.892071l19.562545-24.342408C880.924909 191.1976 884.15037 174.495196 879.595634 157.107177zM674.469813 348.564697l-56.738235 28.537963c-2.958378 0.579191-5.734608 1.684362-8.277524 3.296069-0.313132 0.198521-0.615007 0.385786-0.905626 0.562818 0.12382-0.318248 0.25378-0.639566 0.39295-0.971118 0.99977-2.437515 1.588171-5.022387 1.753947-7.702426l17.732873-66.078974 105.73209-131.488707 48.647977 39.113833L674.469813 348.564697zM831.385633 172.919305l-7.679913 9.550517-68.139913-54.779627 7.687076-9.56382c0.291642-0.132006 1.144056-0.38374 2.604314-0.38374 4.28356 0 9.735735 2.071172 13.570063 5.15644l43.832298 35.245735c3.493567 2.805906 6.421246 7.018857 7.642051 10.993378C831.497173 171.081447 831.492056 172.446537 831.385633 172.919305zM487.474932 291.067168l-200.394053 0c-14.136975 0-25.638937 11.501962-25.638937 25.63996 0 14.136975 11.501962 25.637913 25.638937 25.637913l200.394053 0c14.137998 0 25.63996-11.500938 25.63996-25.637913C513.114892 302.56913 501.611907 291.067168 487.474932 291.067168zM674.507676 438.023148 287.079856 438.023148c-14.136975 0-25.638937 11.500938-25.638937 25.638937s11.501962 25.638937 25.638937 25.638937l387.42782 0c14.137998 0 25.640983-11.501962 25.640983-25.638937S688.646698 438.023148 674.507676 438.023148z" fill="#ffffff"/></svg>':t==="teammate"?'<svg viewBox="0 0 24 24"><path d="M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z" fill="#ffffff"/></svg>':'<svg viewBox="0 0 1024 1024"><path d="M810.666667 384l53.333333-117.333333L981.333333 213.333333l-117.333333-53.333333L810.666667 42.666667l-53.333334 117.333333L640 213.333333l117.333333 53.333334L810.666667 384zM810.666667 640l-53.333334 117.333333L640 810.666667l117.333333 53.333333L810.666667 981.333333l53.333333-117.333333L981.333333 810.666667l-117.333333-53.333334L810.666667 640zM490.666667 405.333333L384 170.666667 277.333333 405.333333 42.666667 512l234.666666 106.666667L384 853.333333l106.666667-234.666666L725.333333 512l-234.666666-106.666667z m-64.426667 148.906667L384 647.253333l-42.24-93.013333L248.746667 512l93.013333-42.24L384 376.746667l42.24 93.013333 93.013333 42.24-93.013333 42.24z" fill="#ffffff"/></svg>'}function ehe(t){return t==null||t===0?"0":t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"K":String(t)}function gf(t){if(Array.isArray(t))return t.map(gf);if(t&&typeof t=="object"){const e={};for(const n of Object.keys(t))n.startsWith("_")||(e[n]=gf(t[n]));return e}return t}function rBe(t){var n,i,r;const e={};for(const s of t){const o=(i=(n=s.response)==null?void 0:n.body)==null?void 0:i.usage;if(!o)continue;const a=((r=s.body)==null?void 0:r.model)||"unknown";e[a]||(e[a]={input:0,output:0,cacheCreation:0,cacheRead:0});const l=e[a];l.input+=o.input_tokens||0,l.output+=o.output_tokens||0,l.cacheCreation+=o.cache_creation_input_tokens||0,l.cacheRead+=o.cache_read_input_tokens||0}return e}function sBe(t){var i,r,s;const e={ttl:{count:0,cacheCreate:0},system_change:{count:0,cacheCreate:0},tools_change:{count:0,cacheCreate:0},model_change:{count:0,cacheCreate:0},msg_truncated:{count:0,cacheCreate:0},msg_modified:{count:0,cacheCreate:0},key_change:{count:0,cacheCreate:0}},n=Hue(t);for(const[o,a]of n){const l=((s=(r=(i=t[o].response)==null?void 0:i.body)==null?void 0:r.usage)==null?void 0:s.cache_creation_input_tokens)||0,c=a.reasons||[a.reason];for(const d of c)e[d]&&(e[d].count++,e[d].cacheCreate+=l)}return e}function oBe(t){var n,i;const e={};for(const r of t){const s=(i=(n=r.response)==null?void 0:n.body)==null?void 0:i.content;if(Array.isArray(s))for(const o of s)o.type==="tool_use"&&o.name&&(e[o.name]=(e[o.name]||0)+1)}return Object.entries(e).sort((r,s)=>s[1]-r[1])}function aBe(t){var n;const e={};for(const i of t){const r=(n=i.body)==null?void 0:n.messages;if(Array.isArray(r))for(const s of r){if(s.role!=="user")continue;const o=s.content;if(Array.isArray(o))for(const a of o){if(a.type!=="text"||!v_(a.text))continue;const l=a.text.match(/^#\s+(.+)$/m),c=l?l[1]:"Skill";e[c]=(e[c]||0)+1}}}return Object.entries(e).sort((i,r)=>r[1]-i[1])}function U5(t){return typeof t!="string"?!1:t.includes("<system-reminder>")&&t.includes("# claudeMd")}function q5(t){return typeof t!="string"?!1:t.includes("<system-reminder>")&&t.includes("skills are available")}function lBe(t){const e=t==null?void 0:t.messages;if(!Array.isArray(e))return!1;for(const n of e){const i=n==null?void 0:n.content;if(typeof i=="string"){if(U5(i))return!0}else if(Array.isArray(i)){for(const r of i)if(r.type==="text"&&U5(r.text))return!0}}return!1}function cBe(t){const e=t==null?void 0:t.messages;if(!Array.isArray(e))return!1;for(const n of e){const i=n==null?void 0:n.content;if(typeof i=="string"){if(q5(i))return!0}else if(Array.isArray(i)){for(const r of i)if(r.type==="text"&&q5(r.text))return!0}}return!1}function dBe(t){return t?t.replace(/^claude-/,"").replace(/-\d{8,}$/,""):null}function $g(t){var n,i,r;if(!t)return!1;const e=t.url||"";return!(t.isHeartbeat||t.isCountTokens||/\/api\/eval\/sdk-/.test(e)||/\/messages\/count_tokens/.test(e)||t.inProgress===!0||t.response&&t.response.status===0||((n=t.body)==null?void 0:n.max_tokens)===1&&!((i=t.body)!=null&&i.system)&&(!((r=t.body)!=null&&r.tools)||t.body.tools.length===0))}function Gb(t){return t.filter($g)}function uBe(t,e){for(let n=e-1;n>=0;n--)if(js(t[n])&&t[n].timestamp)return t[n].timestamp;return null}function the(t){var s,o,a,l;if(!Array.isArray(t)||t.length===0)return null;let e=null;if(t.length===1)e=t[0];else{let c=null,d=null;for(let u=t.length-1;u>=0;u--)if(js(t[u])&&(c||(c=t[u]),(o=(s=t[u].response)==null?void 0:s.body)!=null&&o.usage)){d=t[u];break}e=d||c}if(!e||!e.body)return null;const n=e.body,i=(l=(a=e.response)==null?void 0:a.body)==null?void 0:l.usage,r={system:[],messages:[],tools:[],cacheCreateTokens:(i==null?void 0:i.cache_creation_input_tokens)||0,cacheReadTokens:(i==null?void 0:i.cache_read_input_tokens)||0};if(Array.isArray(n.system)){let c=-1;for(let d=n.system.length-1;d>=0;d--)if(n.system[d].cache_control){c=d;break}if(c>=0)for(let d=0;d<=c;d++){const u=n.system[d];u.type==="text"&&u.text&&r.system.push(u.text)}}if(Array.isArray(n.messages)){let c=-1;for(let d=n.messages.length-1;d>=0;d--){const u=n.messages[d].content;if(Array.isArray(u)){for(const h of u)if(h.cache_control){c=d;break}if(c>=0)break}}if(c>=0)for(let d=0;d<=c;d++){const u=n.messages[d],h=u.content;if(typeof h=="string")r.messages.push(`[${u.role}] ${h}`);else if(Array.isArray(h)){for(const O of h)if(O.type==="text"&&O.text)r.messages.push(`[${u.role}] ${O.text}`);else if(O.type==="tool_result"){const p=VA(O);p&&r.messages.push(`[tool_result: ${O.tool_use_id}] ${p}`)}}}}if(Array.isArray(n.tools)&&n.tools.length>0&&r.system.length>0)for(const c of n.tools)r.tools.push(`${c.name}: ${c.description||""}`);return r}const nhe="ccv_entryCache",hc="entries",hP="cache",OP="ccv_cacheMeta",ihe=2,BA=10080*60*1e3;let Wd=null,Ld=null;function $h(){return Wd?Promise.resolve(Wd):Ld||(Ld=new Promise((t,e)=>{const n=indexedDB.open(nhe,ihe);n.onupgradeneeded=()=>{const i=n.result;i.objectStoreNames.contains(hc)||i.createObjectStore(hc),i.objectStoreNames.contains("sessions")||i.createObjectStore("sessions"),i.objectStoreNames.contains("session_index")||i.createObjectStore("session_index")},n.onsuccess=()=>{Wd=n.result,Wd.onclose=()=>{Wd=null},Ld=null,t(Wd)},n.onerror=()=>{Ld=null,e(n.error)}}),Ld)}let Z5=0;function rhe(t,e){try{const n=e[e.length-1],i=(n==null?void 0:n.timestamp)||null;i&&localStorage.setItem(OP,JSON.stringify({projectName:t,lastTs:i,count:e.length}))}catch{}}function she(){try{localStorage.removeItem(OP)}catch{}}function G5(){try{const t=localStorage.getItem(OP);if(!t)return null;const e=JSON.parse(t);return e!=null&&e.lastTs&&(e==null?void 0:e.count)>0&&(e!=null&&e.projectName)?e:null}catch{return null}}async function Il(t,e){if(!t||!Array.isArray(e)||e.length===0)return;const n=++Z5;try{const i=await $h();return n!==Z5?void 0:(rhe(t,e),new Promise(r=>{const s=i.transaction(hc,"readwrite");s.objectStore(hc).put({projectName:t,entries:e,ts:Date.now()},hP),s.oncomplete=()=>r(),s.onerror=()=>r()}))}catch{}}async function ohe(t){try{const e=await $h();return new Promise(n=>{const r=e.transaction(hc,"readonly").objectStore(hc).get(hP);r.onsuccess=()=>{const s=r.result;!s||s.projectName!==t||!Array.isArray(s.entries)||s.entries.length===0?n(null):s.ts&&Date.now()-s.ts>BA?(__(),n(null)):n(s.entries)},r.onerror=()=>n(null)})}catch{return null}}async function __(){she();try{const t=await $h();return new Promise(e=>{const n=t.transaction(hc,"readwrite");n.objectStore(hc).delete(hP),n.oncomplete=()=>e(),n.onerror=()=>e()})}catch{}}async function rm(t,e,n){if(!(!t||n==null))try{const i=await $h(),r=`${t}:${e}`;return new Promise(s=>{const o=i.transaction("sessions","readwrite");o.objectStore("sessions").put({entries:n,ts:Date.now()},r),o.oncomplete=()=>s(),o.onerror=()=>s()})}catch{}}async function ahe(t,e){try{const n=await $h(),i=`${t}:${e}`;return new Promise(r=>{const o=n.transaction("sessions","readonly").objectStore("sessions").get(i);o.onsuccess=()=>{const a=o.result;!a||!Array.isArray(a.entries)||a.entries.length===0||a.ts&&Date.now()-a.ts>BA?r(null):r(a.entries)},o.onerror=()=>r(null)})}catch{return null}}async function sm(t,e){if(!(!t||!Array.isArray(e)))try{const n=await $h();return new Promise(i=>{const r=n.transaction("session_index","readwrite");r.objectStore("session_index").put({index:e,ts:Date.now()},t),r.oncomplete=()=>i(),r.onerror=()=>i()})}catch{}}const ca=8;function om(t,e){const n=new Map;for(const s of t){const o=s._sessionId;if(o==null)continue;const a=s.timestamp||null;let l=n.get(o);l||(l={firstTs:a,lastTs:a,entryCount:0},n.set(o,l)),l.entryCount++,a&&((!l.firstTs||a<l.firstTs)&&(l.firstTs=a),(!l.lastTs||a>l.lastTs)&&(l.lastTs=a))}const i=Array.from(n.keys()).sort(),r=[];for(let s=0;s<e.length;s++){const o=e[s],a=i[s]||(o==null?void 0:o.entryTimestamp)||null,l=a?n.get(a)||{firstTs:null,lastTs:null,entryCount:0}:{firstTs:null,lastTs:null,entryCount:0};let c=0,d="",u=null;if(o&&(c=o.messages?o.messages.length:0,u=o.userId||null,o.messages)){for(const h of o.messages)if(h.role==="user"){const O=lhe(h);if(O){d=O.slice(0,80);break}}}r.push({sessionId:a,firstTs:l.firstTs,lastTs:l.lastTs||(o==null?void 0:o.entryTimestamp)||null,entryCount:l.entryCount,msgCount:c,preview:d,userId:u})}return r}function lhe(t){if(!t)return"";if(typeof t.content=="string")return t.content;if(Array.isArray(t.content)){for(const e of t.content)if(e.type==="text"&&e.text)return e.text}return""}function Lh(t,e,n,i,r=new Set){if(n.length<=i)return{hotEntries:t,allSessions:e,coldGroups:new Map};const o=new Set(r);let a=i-o.size;for(let u=n.length-1;u>=0&&a>0;u--){const h=n[u].sessionId;o.has(h)||(o.add(h),a--)}const l=[],c=new Map;for(const u of t)if(o.has(u._sessionId))l.push(u);else{let h=c.get(u._sessionId);h||(h=[],c.set(u._sessionId,h)),h.push(u)}const d=e.map((u,h)=>{const O=n[h],p=O==null?void 0:O.sessionId;return p&&!o.has(p)?{_cold:!0,sessionId:p,preview:O.preview,msgCount:O.msgCount,firstTs:O.firstTs,lastTs:O.lastTs,userId:O.userId,messages:null,response:null,entryTimestamp:O.lastTs}:u});return{hotEntries:l,allSessions:d,coldGroups:c}}function Fb(t,e){if(!t||t.length===0)return e||[];if(!e||e.length===0)return t;const n=new Set(e.map(r=>r.sessionId)),i=[];for(const r of t)n.has(r.sessionId)||i.push(r);for(const r of e)i.push(r);return i.sort((r,s)=>r.sessionId===s.sessionId?0:r.sessionId==null?-1:s.sessionId==null?1:r.sessionId<s.sessionId?-1:1),i}function che(t,e){var d;const n=e.body.messages,i=e.response,r=((d=e.body.metadata)==null?void 0:d.user_id)||null,s=e.timestamp||null;if(t.length===0)return[{userId:r,messages:n,response:i,entryTimestamp:s}];const o=t[t.length-1],a=o.messages?o.messages.length:0,l=a>0&&n.length<a*.5&&a-n.length>4,c=r!==null&&r===o.userId;if(l&&n.length<=4&&a>4)return t;if(c||r===o.userId&&!l){const u=a,h=n.length;if(h>u){o.messages||(o.messages=[]);for(let O=u;O<h;O++)n[O]._timestamp||(n[O]._timestamp=s),o.messages.push(n[O])}else if(h<u){for(let O=0;O<n.length;O++)n[O]._timestamp||(n[O]._timestamp=s);o.messages=n}return o.response=i,o.entryTimestamp=s,[...t]}else return[...t,{userId:r,messages:n,response:i,entryTimestamp:s}]}function YA(t){var n;if(!t._deltaFormat||t._isCheckpoint)return!0;const e=(n=t.body)==null?void 0:n.messages;return!!(Array.isArray(e)&&t._totalMessageCount===e.length)}function dhe(t){return t._deltaFormat&&t.mainAgent}function Vh(t){var i,r;let e=[];const n=[];for(let s=0;s<t.length;s++){const o=t[s];if(o.inProgress)continue;if(!dhe(o)){o.mainAgent&&Array.isArray((i=o.body)==null?void 0:i.messages)&&(e=[...o.body.messages]);continue}const a=(r=o.body)==null?void 0:r.messages;Array.isArray(a)&&(YA(o)?e=[...a]:(e=[...e,...a],o.body.messages=e,o._totalMessageCount&&e.length!==o._totalMessageCount&&n.push(s)))}return n.length>0&&uhe(t,n),t}function uhe(t,e){var n;for(const i of e){const r=t[i],s=r._totalMessageCount;if(s)for(let o=i+1;o<t.length;o++){const a=t[o];if(!a.mainAgent||!Array.isArray((n=a.body)==null?void 0:n.messages))continue;const l=a.body.messages,c=a._totalMessageCount||l.length;if((!a._deltaFormat||YA(a))&&c>=s){r.body.messages=l.slice(0,s);break}}}}const hhe="_layout_1w405_1",Ohe="_header_1w405_6",fhe="_content_1w405_14",phe="_mainContainer_1w405_19",mhe="_leftPanel_1w405_24",ghe="_leftPanelHeader_1w405_32",vhe="_leftPanelCount_1w405_43",$he="_leftPanelBody_1w405_49",bhe="_rightPanel_1w405_54",She="_modalActions_1w405_60",yhe="_spinCenter_1w405_64",_he="_emptyCenter_1w405_69",Qhe="_logListContainer_1w405_79",xhe="_loadingOverlay_1w405_127",whe="_dragOverlay_1w405_140",Phe="_dragOverlayContent_1w405_154",Che="_dragIcon_1w405_163",The="_loadingText_1w405_167",khe="_mobileLoadingOverlay_1w405_173",Rhe="_mobileLoadingSpinner_1w405_185",Ehe="_mobileLoadingLabel_1w405_198",Xhe="_footer_1w405_204",zhe="_footerRight_1w405_215",Ihe="_footerLink_1w405_228",Ahe="_footerIcon_1w405_240",Mhe="_guideContainer_1w405_253",jhe="_guideContent_1w405_261",Nhe="_guideTitle_1w405_266",Whe="_guideStep_1w405_273",Lhe="_guideStepNum_1w405_279",Vhe="_guideStepBody_1w405_294",Bhe="_guideText_1w405_299",Yhe="_guideCode_1w405_306",Dhe="_mobileChatOverlay_1w405_319",Uhe="_mobileChatOverlayVisible_1w405_331",qhe="_mobileNavBtn_1w405_335",Zhe="_mobileChatInner_1w405_340",Ghe="_mobileGitDiffOverlay_1w405_348",Fhe="_mobileGitDiffOverlayVisible_1w405_360",Hhe="_mobileGitDiffInner_1w405_364",Khe="_mobileMenuBtn_1w405_372",Jhe="_mobileMenuOverlay_1w405_389",eOe="_mobileMenuDropdown_1w405_395",tOe="_mobileMenuItem_1w405_409",nOe="_mobileStatsOverlay_1w405_427",iOe="_mobileStatsOverlayVisible_1w405_439",rOe="_mobileStatsInner_1w405_443",sOe="_mobileLogMgmtOverlay_1w405_450",oOe="_mobileLogMgmtOverlayVisible_1w405_462",aOe="_mobileLogMgmtHeader_1w405_466",lOe="_mobileLogMgmtTitle_1w405_475",cOe="_mobileLogMgmtClose_1w405_481",dOe="_mobileLogMgmtActions_1w405_496",uOe="_mobileLogMgmtBody_1w405_504",hOe="_mobileSettingsOverlay_1w405_511",OOe="_mobileSettingsOverlayVisible_1w405_523",fOe="_mobilePromptOverlay_1w405_527",pOe="_mobilePromptOverlayVisible_1w405_539",mOe="_mobilePromptBody_1w405_543",gOe="_mobilePromptList_1w405_551",vOe="_mobilePromptItem_1w405_557",$Oe="_mobilePromptTimestamp_1w405_562",bOe="_mobilePromptCard_1w405_569",SOe="_mobilePromptPreText_1w405_577",yOe="_tableTimestampCell_1w405_587",_Oe="_tablePreviewText_1w405_591",QOe="_tablePreviewTextClickable_1w405_600",xOe="_tableTag_1w405_610",wOe="_tableActionsCell_1w405_616",POe="_mobileCLIRoot_1w405_622",COe="_mobileCLIHeader_1w405_631",TOe="_mobileCLIHeaderLeft_1w405_642",kOe="_mobileCLIStatusLabel_1w405_648",ROe="_mobileCLIHeaderRight_1w405_653",EOe="_mobileCLIBody_1w405_659",XOe="_mobileSettingsBody_1w405_668",zOe="_mobileSettingsSectionTitle_1w405_672",IOe="_mobileSettingsRow_1w405_679",AOe="_mobileSettingsLabel_1w405_687",MOe="_mobilePromptEmpty_1w405_693",jOe="_mobilePromptHeader_1w405_700",NOe="_mobilePromptCount_1w405_708",WOe="_chatViewWrapper_1w405_714",LOe="_resumeFooterRight_1w405_720",VOe="_resumeFooterLeft_1w405_725",BOe="_resumeCheckboxOpacity_1w405_729",YOe="_btnMarginLeft_1w405_733",DOe="_btnMarginRight_1w405_737",UOe="_modalTitleInline_1w405_742",qOe="_previewPopover_1w405_749",ZOe="_previewItem_1w405_755",GOe="_previewText_1w405_767",el={layout:hhe,header:Ohe,content:fhe,mainContainer:phe,leftPanel:mhe,leftPanelHeader:ghe,leftPanelCount:vhe,leftPanelBody:$he,rightPanel:bhe,modalActions:She,spinCenter:yhe,emptyCenter:_he,logListContainer:Qhe,loadingOverlay:xhe,dragOverlay:whe,dragOverlayContent:Phe,dragIcon:Che,loadingText:The,mobileLoadingOverlay:khe,mobileLoadingSpinner:Rhe,mobileLoadingLabel:Ehe,footer:Xhe,footerRight:zhe,footerLink:Ihe,footerIcon:Ahe,guideContainer:Mhe,guideContent:jhe,guideTitle:Nhe,guideStep:Whe,guideStepNum:Lhe,guideStepBody:Vhe,guideText:Bhe,guideCode:Yhe,mobileChatOverlay:Dhe,mobileChatOverlayVisible:Uhe,mobileNavBtn:qhe,mobileChatInner:Zhe,mobileGitDiffOverlay:Ghe,mobileGitDiffOverlayVisible:Fhe,mobileGitDiffInner:Hhe,mobileMenuBtn:Khe,mobileMenuOverlay:Jhe,mobileMenuDropdown:eOe,mobileMenuItem:tOe,mobileStatsOverlay:nOe,mobileStatsOverlayVisible:iOe,mobileStatsInner:rOe,mobileLogMgmtOverlay:sOe,mobileLogMgmtOverlayVisible:oOe,mobileLogMgmtHeader:aOe,mobileLogMgmtTitle:lOe,mobileLogMgmtClose:cOe,mobileLogMgmtActions:dOe,mobileLogMgmtBody:uOe,mobileSettingsOverlay:hOe,mobileSettingsOverlayVisible:OOe,mobilePromptOverlay:fOe,mobilePromptOverlayVisible:pOe,mobilePromptBody:mOe,mobilePromptList:gOe,mobilePromptItem:vOe,mobilePromptTimestamp:$Oe,mobilePromptCard:bOe,mobilePromptPreText:SOe,tableTimestampCell:yOe,tablePreviewText:_Oe,tablePreviewTextClickable:QOe,tableTag:xOe,tableActionsCell:wOe,mobileCLIRoot:POe,mobileCLIHeader:COe,mobileCLIHeaderLeft:TOe,mobileCLIStatusLabel:kOe,mobileCLIHeaderRight:ROe,mobileCLIBody:EOe,mobileSettingsBody:XOe,mobileSettingsSectionTitle:zOe,mobileSettingsRow:IOe,mobileSettingsLabel:AOe,mobilePromptEmpty:MOe,mobilePromptHeader:jOe,mobilePromptCount:NOe,chatViewWrapper:WOe,resumeFooterRight:LOe,resumeFooterLeft:VOe,resumeCheckboxOpacity:BOe,btnMarginLeft:YOe,btnMarginRight:DOe,modalTitleInline:UOe,previewPopover:qOe,previewItem:ZOe,previewText:GOe},F5=Ft?30:100;class hBe extends Z.Component{constructor(n){super(n);Je(this,"_resetSSETimeout",()=>{this._sseTimeoutTimer&&clearTimeout(this._sseTimeoutTimer),this._sseReconnectCount=0,this._sseTimeoutTimer=setTimeout(()=>{console.warn("SSE heartbeat timeout, reconnecting..."),this._reconnectSSE()},45e3)});Je(this,"_flushPendingEntries",()=>{this._flushRafId=null;const n=this._pendingEntries;this._pendingEntries=[],n.length!==0&&this.setState(i=>{var c,d,u,h,O;const r=[...i.requests];let s=i.cacheExpireAt,o=i.cacheType,a=i.mainAgentSessions;this._sseSlimEnabled&&!this._sseSlimmer&&(this._sseSlimmer=Gue(js));for(const p of n){const m=`${p.timestamp}|${p.url}`,g=this._requestIndexMap.get(m);if(g!==void 0)r[g]=p,this._sseSlimmer&&this._sseSlimmer.onDedup(g);else{const v=r.length;this._sseSlimmer&&this._sseSlimmer.processEntry(p,r,v),this._requestIndexMap.set(m,v),r.push(p)}if(js(p)&&!p.inProgress&&((d=(c=p.response)==null?void 0:c.body)!=null&&d.usage)){const v=the([p]);v&&(v.system.length>0||v.messages.length>0||v.tools.length>0)&&(this._lastKvCacheContent=v)}if(js(p)){const v=(h=(u=p.response)==null?void 0:u.body)==null?void 0:h.usage;if(v!=null&&v.cache_creation){const $=v.cache_creation,b=p.timestamp?new Date(p.timestamp).getTime():Date.now();let S=null,y=null;if($.ephemeral_1h_input_tokens>0?(S=b+3600*1e3,y="1h"):$.ephemeral_5m_input_tokens>0&&(S=b+300*1e3,y="5m"),S&&S>Date.now()){s=S;const Q=(v.cache_read_input_tokens||0)+(v.cache_creation_input_tokens||0);o=Q>0?ehe(Q):y,localStorage.setItem("ccv_cacheExpireAt",String(s)),localStorage.setItem("ccv_cacheType",o)}}}if(js(p)&&p.body&&Array.isArray(p.body.messages)&&!p._slimmed){const v=p.timestamp||new Date().toISOString(),$=a.length>0?a[a.length-1]:null,b=($==null?void 0:$.messages)||[],S=p.body.messages,y=b.length,Q=((O=p.body.metadata)==null?void 0:O.user_id)||null,P=!(Q!==null&&($==null?void 0:$.userId)===Q)&&y>0&&S.length<y*.5&&y-S.length>4;if(y>4&&S.length<=4&&S.length<y*.5)continue;P?this._currentSessionId=v:this._currentSessionId===null&&(this._currentSessionId=v);for(let X=0;X<S.length;X++)!P&&X<y&&b[X]._timestamp?S[X]._timestamp=b[X]._timestamp:S[X]._timestamp||(S[X]._timestamp=v);a=this.mergeMainAgentSessions(a,p)}p._sessionId=this._currentSessionId}let l=i.selectedIndex;return a.length>F5&&(a=a.slice(-F5)),l===null&&r.length>0&&(this._autoSelectTimer&&clearTimeout(this._autoSelectTimer),this._autoSelectTimer=setTimeout(()=>{this.setState(p=>{if(p.selectedIndex===null&&p.requests.length>0){const m=p.showAll?p.requests:Gb(p.requests);return m.length>0?{selectedIndex:m.length-1}:null}return null})},200)),{requests:r,cacheExpireAt:s,cacheType:o,mainAgentSessions:a}},()=>{Ft&&this.state.projectName&&(this._cacheSaveTimer&&clearTimeout(this._cacheSaveTimer),this._cacheSaveTimer=setTimeout(()=>{this.state.projectName&&this.state.sessionIndex.length===0&&Il(this.state.projectName,this.state.requests)},5e3),this.state.mainAgentSessions.length>ca+2&&(this._evictionTimer||(this._evictionTimer=setTimeout(()=>{this._evictionTimer=null,this._evictColdSessions()},1e4))))})});Je(this,"handleSelectRequest",n=>{this.setState({selectedIndex:n,scrollCenter:!1})});Je(this,"handleScrollDone",()=>{this.setState({scrollCenter:!1})});Je(this,"handleScrollTsDone",()=>{this.setState({chatScrollToTs:null})});Je(this,"handleWorkspaceLaunch",({projectName:n})=>{this._isLocalLog=!1,this._localLogFile=null,this.setState({workspaceMode:!1,projectName:n,viewMode:"chat",cliMode:!0})});Je(this,"handleReturnToWorkspaces",()=>{fetch(pt("/api/workspaces/stop"),{method:"POST"}).then(()=>{this._rebuildRequestIndex([]),this.setState({workspaceMode:!0,requests:[],mainAgentSessions:[],projectName:"",selectedIndex:null})}).catch(()=>{})});Je(this,"handleProxyProfileChange",n=>{fetch(pt("/api/proxy-profiles"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).then(i=>i.json()).then(()=>{this.setState({proxyProfiles:n.profiles,activeProxyId:n.active})}).catch(()=>{})});Je(this,"handleLangChange",()=>{const n=m_();this.setState({lang:n}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lang:n})}).catch(()=>{})});Je(this,"handleCollapseToolResultsChange",n=>{this.setState({collapseToolResults:n}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({collapseToolResults:n})}).catch(()=>{})});Je(this,"handleExpandThinkingChange",n=>{this.setState({expandThinking:n}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expandThinking:n})}).catch(()=>{})});Je(this,"handleExpandDiffChange",n=>{this.setState({expandDiff:n}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expandDiff:n})}).catch(()=>{})});Je(this,"handleThemeColorChange",n=>{this.setState({themeColor:n}),document.documentElement.setAttribute("data-theme",n==="light"?"light":"dark"),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({themeColor:n})}).catch(()=>{})});Je(this,"handleLogDirChange",n=>{if(!n||typeof n!="string")return;const i=n.trim();i&&(this.setState({logDir:i}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({logDir:i})}).then(r=>r.json()).then(r=>{r.logDir&&this.setState({logDir:r.logDir})}).catch(()=>{}))});Je(this,"handleShowFullToolContentChange",n=>{this.setState({showFullToolContent:n}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({showFullToolContent:n})}).catch(()=>{})});Je(this,"handleFilterIrrelevantChange",n=>{this.setState(i=>{const r=!n,s=r?i.requests:Gb(i.requests);return{showAll:r,selectedIndex:s.length>0?s.length-1:null}}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filterIrrelevant:n})}).catch(()=>{})});Je(this,"handleImportLocalLogs",()=>{this.setState({importModalVisible:!0,localLogsLoading:!0}),fetch(pt("/api/local-logs")).then(n=>n.json()).then(n=>{const{_currentProject:i,...r}=n;this.setState({localLogs:r,currentProject:i||"",localLogsLoading:!1})}).catch(()=>{this.setState({localLogs:{},localLogsLoading:!1})})});Je(this,"handleCloseImportModal",()=>{this.setState({importModalVisible:!1,selectedLogs:new Set})});Je(this,"handleRefreshStats",()=>{this.setState({refreshingStats:!0}),fetch(pt("/api/refresh-stats"),{method:"POST"}).then(n=>n.json()).then(n=>{if(!n.ok)throw new Error(n.error||"refresh failed");return fetch(pt("/api/local-logs"))}).then(n=>n.json()).then(n=>{const{_currentProject:i,...r}=n;this.setState({localLogs:r,refreshingStats:!1}),ti.success(le("ui.refreshStatsSuccess"))}).catch(()=>{this.setState({refreshingStats:!1}),ti.error(le("ui.refreshStatsFailed"))})});Je(this,"handleToggleLogSelect",(n,i)=>{this.setState(r=>{const s=new Set(r.selectedLogs);return i?s.add(n):s.delete(n),{selectedLogs:s}})});Je(this,"handleMergeLogs",()=>{const{selectedLogs:n,localLogs:i,currentProject:r}=this.state;if(n.size<2)return;const s=i[r];if(!s)return;const o=[];if(s.forEach((c,d)=>{n.has(c.file)&&o.push(d)}),o.sort((c,d)=>c-d),n.has(s[0].file)){ti.warning(le("ui.mergeLatestNotAllowed"));return}for(let c=1;c<o.length;c++)if(o[c]-o[c-1]!==1){ti.warning(le("ui.mergeNotConsecutive"));return}if(o.reduce((c,d)=>c+s[d].size,0)>500*1024*1024){ti.warning(le("ui.mergeTooLarge"));return}const l=o.map(c=>s[c].file).reverse();fetch(pt("/api/merge-logs"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:l})}).then(c=>c.json()).then(c=>{c.ok?(ti.success(le("ui.mergeSuccess")),this.setState({selectedLogs:new Set}),this.handleImportLocalLogs()):ti.error(c.error||"Merge failed")}).catch(()=>ti.error("Merge failed"))});Je(this,"handleDeleteLogs",()=>{const{selectedLogs:n}=this.state;n.size!==0&&yi.confirm({title:le("ui.deleteLogs"),content:le("ui.deleteLogsConfirm",{count:n.size}),okText:le("ui.deleteLogs"),okButtonProps:{danger:!0},cancelText:le("ui.cancel"),onOk:()=>{const i=[...n];fetch(pt("/api/delete-logs"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:i})}).then(r=>r.json()).then(r=>{if(r.results){const s=r.results.filter(a=>a.ok).length,o=r.results.filter(a=>a.error).length;s>0&&ti.success(le("ui.deleteSuccess",{count:s})),o>0&&ti.error(le("ui.deleteFailed",{count:o})),this.setState({selectedLogs:new Set}),this.handleImportLocalLogs()}}).catch(()=>ti.error("Delete failed"))}})});Je(this,"handleOpenLogFile",async n=>{let i=`${window.location.protocol}//${window.location.host}`,r=new URLSearchParams(window.location.search).get("token");if(!r)try{const o=await fetch(pt("/api/local-url"));if(o.ok){const a=await o.json();a.url&&(i=a.url.split("?")[0],r=new URL(a.url).searchParams.get("token"))}}catch{}const s=r?`&token=${encodeURIComponent(r)}`:"";window.open(`${i}?logfile=${encodeURIComponent(n)}${s}`,"_blank"),this.setState({importModalVisible:!1})});Je(this,"handleDownloadLogFile",n=>{const i=pt(`/api/download-log?file=${encodeURIComponent(n)}`),r=document.createElement("a");r.href=i,r.download="",document.body.appendChild(r),r.click(),document.body.removeChild(r)});Je(this,"handleResumeChoice",n=>{this.state.resumeRememberChoice&&(this.setState({resumeAutoChoice:n}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resumeAutoChoice:n})}).catch(()=>{})),fetch(pt("/api/resume-choice"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({choice:n})}).catch(i=>console.error("resume-choice failed:",i))});Je(this,"handleResumeAutoChoiceToggle",n=>{const i=n?"continue":null;this.setState({resumeAutoChoice:i}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resumeAutoChoice:i})}).catch(()=>{})});Je(this,"handleResumeAutoChoiceChange",n=>{this.setState({resumeAutoChoice:n}),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resumeAutoChoice:n})}).catch(()=>{})});Je(this,"_finishLocalLoad",(n,i)=>{if(n.length===0){ti.error(le("ui.noLogs")),this.setState({fileLoading:!1,fileLoadingCount:0});return}this.animateLoadingCount(n.length,()=>{const{mainAgentSessions:r,filtered:s}=this._processEntries(n);this._isLocalLog=!0,this._localLogFile=i.length===1?i[0]:`${i.length} files`,this.eventSource&&(this.eventSource.close(),this.eventSource=null),this._streamingOffTimer&&(clearTimeout(this._streamingOffTimer),this._streamingOffTimer=null),this.setState({requests:n,selectedIndex:s.length>0?s.length-1:null,mainAgentSessions:r,importModalVisible:!1,fileLoading:!1,fileLoadingCount:0})})});const i=parseInt(localStorage.getItem("ccv_cacheExpireAt"),10)||null,r=localStorage.getItem("ccv_cacheType")||null,s=Date.now(),o=i&&i>s?i:null,a=o?r:null;this.state={requests:[],selectedIndex:null,viewMode:"raw",cacheExpireAt:o,cacheType:a,mainAgentSessions:[],importModalVisible:!1,localLogs:{},localLogsLoading:!1,refreshingStats:!1,showAll:!1,lang:m_(),userProfile:null,projectName:"",resumeModalVisible:!1,resumeFileName:"",resumeRememberChoice:!1,resumeAutoChoice:null,collapseToolResults:!0,expandThinking:!0,expandDiff:!1,logDir:"",showFullToolContent:!1,showThinkingSummaries:!1,themeColor:"dark",fileLoading:!1,fileLoadingCount:0,isDragging:!1,selectedLogs:new Set,githubStars:null,cliMode:!1,sdkMode:!1,workspaceMode:!1,serverCachedContent:null,updateInfo:null,pendingUploadPaths:[],contextWindow:null,isStreaming:!1,hasMoreHistory:!1,loadingMore:!1,sessionIndex:[],loadingSessionId:null,proxyProfiles:[],activeProxyId:"max",defaultConfig:null},this.eventSource=null,this._currentSessionId=null,this._autoSelectTimer=null,this._chunkedEntries=[],this._chunkedTotal=0,this.mainContainerRef=Z.createRef(),this._layoutRef=Z.createRef(),this._requestIndexMap=new Map,this._pendingEntries=[],this._flushRafId=null,this._cacheLossMap=new Map,this._cacheLossProcessedCount=0,this._cacheLossLastMainAgent=null,this._cacheLossShowAll=void 0,this._lastKvCacheContent=null,this._sseSlimEnabled=!Ft&&localStorage.getItem("ccv_sseSlim")==="true",this._sseSlimmer=null}_rebuildRequestIndex(n){this._requestIndexMap.clear();for(let i=0;i<n.length;i++){const r=n[i];this._requestIndexMap.set(`${r.timestamp}|${r.url}`,i)}this._cacheLossProcessedCount=0,this._cacheLossLastMainAgent=null,this._cacheLossMap=new Map,this._lastKvCacheContent=null,this._sseSlimmer=null}_processEntries(n){var l;let i=[],r=null,s=[];const o=[];this._requestIndexMap.clear(),this._cacheLossProcessedCount=0,this._cacheLossLastMainAgent=null,this._cacheLossMap=new Map,this._lastKvCacheContent=null,this._sseSlimmer=null;let a=null;for(let c=0;c<n.length;c++){const d=n[c];if(this._requestIndexMap.set(`${d.timestamp}|${d.url}`,c),$g(d)&&o.push(d),js(d)&&d.body&&Array.isArray(d.body.messages)){const u=d.body.messages,h=d._messageCount||u.length,O=((l=d.body.metadata)==null?void 0:l.user_id)||null,p=d.timestamp||new Date().toISOString(),m=i.length,g=m>0&&(h<m*.5&&m-h>4||r&&O&&O!==r),v=g&&h<=4&&m>4&&h<m*.5;g&&!v?(a=p,i=[]):a===null&&(a=p);for(let $=i.length;$<h;$++)i.push(p);if(u.length>0)for(let $=0;$<u.length;$++)u[$]._timestamp=i[$];r=O,d._slimmed||(s=this.mergeMainAgentSessions(s,d))}d._sessionId=a}return this._currentSessionId=a,{mainAgentSessions:s,filtered:o}}componentDidMount(){fetch(pt("/api/claude-settings")).then(r=>r.json()).then(r=>{r.showThinkingSummaries&&this.setState({showThinkingSummaries:!0})}).catch(()=>{}),this._prefsReady=fetch(pt("/api/preferences")).then(r=>r.json()).then(r=>{r.lang&&(NA(r.lang),this.setState({lang:r.lang})),r.collapseToolResults!==void 0&&this.setState({collapseToolResults:!!r.collapseToolResults}),r.expandThinking!==void 0&&this.setState({expandThinking:!!r.expandThinking}),r.expandDiff!==void 0&&this.setState({expandDiff:!!r.expandDiff}),r.showFullToolContent!==void 0&&this.setState({showFullToolContent:!!r.showFullToolContent}),r.resumeAutoChoice&&this.setState({resumeAutoChoice:r.resumeAutoChoice}),r.themeColor&&(this.setState({themeColor:r.themeColor}),document.documentElement.setAttribute("data-theme",r.themeColor==="light"?"light":"dark"));const s=r.filterIrrelevant!==void 0?!!r.filterIrrelevant:!0;return this.setState({showAll:!s}),r.logDir&&this.setState({logDir:r.logDir}),r}).catch(()=>({})),fetch(pt("/api/user-profile")).then(r=>r.json()).then(r=>this.setState({userProfile:r})).catch(()=>{}),fetch(pt("/api/proxy-profiles")).then(r=>r.json()).then(r=>{if(!r.profiles)return;let s=r.active||"max";const o=r.defaultConfig;if(s==="max"&&(o!=null&&o.origin)){const a=r.profiles.find(l=>{if(l.id==="max"||!l.baseURL)return!1;try{if(new URL(l.baseURL).origin!==o.origin)return!1}catch{return!1}if(o.apiKey&&l.apiKey){const c=o.apiKey.slice(-4),d=l.apiKey.slice(-4);if(c!==d)return!1}return!(o.model&&l.activeModel&&o.model!==l.activeModel)});a&&(s=a.id,this.handleProxyProfileChange({active:a.id,profiles:r.profiles}))}this.setState({proxyProfiles:r.profiles,activeProxyId:s,defaultConfig:o||null})}).catch(()=>{});const i=new URLSearchParams(window.location.search).get("logfile");fetch(pt("/api/project-name")).then(r=>r.json()).then(r=>{const s=r.projectName||"";this.setState({projectName:s}),s&&(document.title=s),Ft&&s&&!i&&this.state.requests.length===0&&ohe(s).then(o=>{if(o&&this.state.requests.length===0){const{mainAgentSessions:a,filtered:l}=this._processEntries(o);if(a.length>ca){const c=om(o,a),{hotEntries:d,allSessions:u}=Lh(o,a,c,ca),h=d.filter(O=>$g(O));this._oldestTs=d.length>0?d[0].timestamp:null,this.setState({requests:d,selectedIndex:h.length>0?h.length-1:null,mainAgentSessions:u,sessionIndex:c,hasMoreHistory:!!this._oldestTs,fileLoading:!1})}else this._oldestTs=o.length>0?o[0].timestamp:null,this.setState({requests:o,selectedIndex:l.length>0?l.length-1:null,mainAgentSessions:a,hasMoreHistory:!!this._oldestTs,fileLoading:!1})}})}).catch(()=>{}),fetch("https://api.github.com/repos/weiesky/cc-viewer").then(r=>r.json()).then(r=>{r.stargazers_count!=null&&this.setState({githubStars:r.stargazers_count})}).catch(()=>{}),fetch(pt("/api/cli-mode")).then(r=>r.json()).then(r=>{r.workspaceMode?this.setState({cliMode:!0,workspaceMode:!0,isWorkspaceServer:!0}):r.cliMode&&this.setState({cliMode:!0,sdkMode:!!r.sdkMode,viewMode:"chat"})}).catch(()=>{}),i?this.loadLocalLogFile(i):this.initSSE()}componentWillUnmount(){this.eventSource&&this.eventSource.close(),this._localLogES&&(this._localLogES.close(),this._localLogES=null),this._autoSelectTimer&&clearTimeout(this._autoSelectTimer),this._loadingCountTimer&&cancelAnimationFrame(this._loadingCountTimer),this._loadingCountRafId&&cancelAnimationFrame(this._loadingCountRafId),this._cacheSaveTimer&&clearTimeout(this._cacheSaveTimer),this._evictionTimer&&clearTimeout(this._evictionTimer),this._sseTimeoutTimer&&clearTimeout(this._sseTimeoutTimer),this._sseReconnectTimer&&clearTimeout(this._sseReconnectTimer),this._streamingOffTimer&&clearTimeout(this._streamingOffTimer)}_reconnectSSE(){if(this._sseReconnectCount>=10){console.error("SSE reconnect limit reached");return}if(this._sseReconnectCount=(this._sseReconnectCount||0)+1,this.eventSource&&(this.eventSource.close(),this.eventSource=null),this._streamingOffTimer&&(clearTimeout(this._streamingOffTimer),this._streamingOffTimer=null),this._flushRafId&&(cancelAnimationFrame(this._flushRafId),this._flushRafId=null),this._chunkedEntries&&this._chunkedEntries.length>0&&Ft)try{const n=Vh([...this._chunkedEntries]);if(Array.isArray(n)&&n.length>0){const{mainAgentSessions:i}=this._processEntries(n);if(this.setState({requests:n,mainAgentSessions:i}),this.state.projectName){const r=G5(),s=r&&r.projectName===this.state.projectName?r.count:0;n.length>=s&&Il(this.state.projectName,n)}}}catch(n){console.warn("Failed to save partial entries on reconnect:",n)}this._chunkedEntries=[],this._chunkedTotal=0,this._isIncremental=!1,this._loadingCountRafId&&(cancelAnimationFrame(this._loadingCountRafId),this._loadingCountRafId=null),this._pendingEntries=[],this.setState({isStreaming:!1}),this._sseSlimmer=null,this._sseReconnectTimer&&clearTimeout(this._sseReconnectTimer),this._sseReconnectTimer=setTimeout(()=>{this.initSSE()},2e3)}animateLoadingCount(n,i){this._loadingCountTimer&&(cancelAnimationFrame(this._loadingCountTimer),this._loadingCountTimer=null);const r=Math.min(800,Math.max(300,n*.5)),s=performance.now(),o=a=>{const l=Math.min((a-s)/r,1),c=Math.round(l*n);this.setState({fileLoadingCount:c}),l<1?this._loadingCountTimer=requestAnimationFrame(o):(this._loadingCountTimer=null,i())};this._loadingCountTimer=requestAnimationFrame(o)}async loadMoreHistory(){if(!(!this.state.hasMoreHistory||this._loadingMore)){this._loadingMore=!0,this.setState({loadingMore:!0});try{const i=await(await fetch(pt(`/api/entries/page?before=${encodeURIComponent(this._oldestTs)}&limit=100`))).json();if(Array.isArray(i.entries)&&i.entries.length>0){const s=[...Vh(i.entries),...this.state.requests],{mainAgentSessions:o}=this._processEntries(s);if(this._oldestTs=i.oldestTimestamp,Ft&&o.length>ca){const a=om(s,o),l=Fb(this.state.sessionIndex,a),{hotEntries:c,allSessions:d,coldGroups:u}=Lh(s,o,l,ca),h=this.state.projectName;if(h){for(const[O,p]of u)rm(h,O,p);sm(h,l),Il(h,s)}this.setState({requests:c,mainAgentSessions:d,sessionIndex:l,hasMoreHistory:!!i.hasMore,loadingMore:!1})}else this.setState({requests:s,mainAgentSessions:o,hasMoreHistory:!!i.hasMore,loadingMore:!1}),Ft&&this.state.projectName&&Il(this.state.projectName,s)}else this.setState({hasMoreHistory:!1,loadingMore:!1})}catch(n){console.error("loadMoreHistory failed:",n),this.setState({loadingMore:!1})}this._loadingMore=!1}}initSSE(){try{let n="/events",i=!1;if(Ft){const r=G5();r&&r.lastTs&&r.count>0&&(n=`/events?since=${encodeURIComponent(r.lastTs)}&cc=${r.count}&project=${encodeURIComponent(r.projectName||"")}`,i=!0)}!i&&Ft&&(n="/events?limit=200"),i||this.setState({fileLoading:!0,fileLoadingCount:0}),this.eventSource=new EventSource(pt(n)),this.eventSource.onmessage=r=>{this._resetSSETimeout(),this.handleEventMessage(r)},this.eventSource.onopen=()=>{this._resetSSETimeout()},this.eventSource.addEventListener("resume_prompt",r=>{this._resetSSETimeout();try{const s=JSON.parse(r.data);(this._prefsReady||Promise.resolve({})).then(o=>{o!=null&&o.resumeAutoChoice?fetch(pt("/api/resume-choice"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({choice:o.resumeAutoChoice})}).catch(a=>console.error("resume-choice failed:",a)):this.setState({resumeModalVisible:!0,resumeFileName:s.recentFileName||""})})}catch{}}),this.eventSource.addEventListener("resume_resolved",()=>{this._resetSSETimeout(),this.setState({resumeModalVisible:!1,resumeFileName:"",resumeRememberChoice:!1})}),this.eventSource.addEventListener("update_completed",r=>{this._resetSSETimeout();try{const s=JSON.parse(r.data);this.setState({updateInfo:{type:"completed",version:s.version}})}catch{}}),this.eventSource.addEventListener("update_major_available",r=>{this._resetSSETimeout();try{const s=JSON.parse(r.data);this.setState({updateInfo:{type:"major",version:s.version}})}catch{}}),this.eventSource.addEventListener("load_start",r=>{this._resetSSETimeout();try{const s=JSON.parse(r.data);this._chunkedEntries=[],this._chunkedTotal=s.total||0,this._isIncremental=!!s.incremental,this._hasMoreHistory=!!s.hasMore,this._oldestTs=s.oldestTs||null,this._isIncremental||this.setState({fileLoading:!0,fileLoadingCount:0})}catch{}}),this.eventSource.addEventListener("load_chunk",r=>{this._resetSSETimeout();try{const s=JSON.parse(r.data);Array.isArray(s)&&(this._chunkedEntries.push(...s),!this._isIncremental&&!this._loadingCountRafId&&(this._loadingCountRafId=requestAnimationFrame(()=>{this._loadingCountRafId=null,this.setState({fileLoadingCount:this._chunkedEntries.length})})))}catch{}}),this.eventSource.addEventListener("load_end",()=>{this._resetSSETimeout(),this._loadingCountRafId&&(cancelAnimationFrame(this._loadingCountRafId),this._loadingCountRafId=null);const r=this._chunkedEntries;this._chunkedEntries=[],this._chunkedTotal=0;const s=this._isIncremental;this._isIncremental=!1;let o;if(s&&Ft&&this.state.requests.length>0){if(r.length===0){this.setState({fileLoading:!1,fileLoadingCount:0});return}const l=(d,u)=>d.timestamp&&d.url?`${d.timestamp}|${d.url}`:`__nokey_c${u}`,c=new Map;this.state.requests.forEach((d,u)=>c.set(l(d,u),d)),r.forEach((d,u)=>c.set(d.timestamp&&d.url?`${d.timestamp}|${d.url}`:`__nokey_d${u}`,d)),o=Array.from(c.values())}else o=r;const a=Array.isArray(o)?Vh(o):o;if(Array.isArray(a)&&a.length>0){const{mainAgentSessions:l,filtered:c}=this._processEntries(a);if(Ft&&l.length>ca){const d=om(a,l),u=s?Fb(this.state.sessionIndex,d):d,{hotEntries:h,allSessions:O,coldGroups:p}=Lh(a,l,u,ca),m=this.state.projectName;if(m){for(const[$,b]of p)rm(m,$,b);sm(m,u),Il(m,a)}const g=h.filter($=>$g($)),v={requests:h,selectedIndex:g.length>0?g.length-1:null,mainAgentSessions:O,sessionIndex:u,fileLoading:!1,fileLoadingCount:0};s||(v.hasMoreHistory=!!this._hasMoreHistory),this.setState(v)}else{const d={requests:a,selectedIndex:c.length>0?c.length-1:null,mainAgentSessions:l,fileLoading:!1,fileLoadingCount:0};s||(d.hasMoreHistory=!!this._hasMoreHistory),this.setState(d),Ft&&this.state.projectName&&Il(this.state.projectName,a)}}else this.setState({fileLoading:!1,fileLoadingCount:0})}),this.eventSource.addEventListener("full_reload",r=>{this._resetSSETimeout();try{const s=JSON.parse(r.data);if(Array.isArray(s)){const{mainAgentSessions:o,filtered:a}=s.length>0?this._processEntries(s):{mainAgentSessions:[],filtered:[]};s.length>0?this.animateLoadingCount(s.length,()=>{this.setState({requests:s,selectedIndex:a.length>0?a.length-1:null,mainAgentSessions:o,fileLoading:!1,fileLoadingCount:0,serverCachedContent:null}),Ft&&this.state.projectName&&Il(this.state.projectName,s)}):(this.setState({requests:s,selectedIndex:null,mainAgentSessions:o,fileLoading:!1,fileLoadingCount:0,serverCachedContent:null}),Ft&&__())}else this.setState({fileLoading:!1,fileLoadingCount:0})}catch{this.setState({fileLoading:!1,fileLoadingCount:0})}}),this.eventSource.addEventListener("workspace_started",r=>{this._resetSSETimeout();try{const s=JSON.parse(r.data);this._loadingCountTimer&&(cancelAnimationFrame(this._loadingCountTimer),this._loadingCountTimer=null),this._rebuildRequestIndex([]),s.projectName&&(document.title=`${s.projectName} - CC Viewer`),this.setState({workspaceMode:!1,projectName:s.projectName||"",viewMode:"chat",cliMode:!0,requests:[],mainAgentSessions:[],selectedIndex:null}),Ft&&__()}catch{}}),this.eventSource.addEventListener("workspace_stopped",()=>{this._resetSSETimeout(),this._rebuildRequestIndex([]),this.setState({workspaceMode:!0,requests:[],mainAgentSessions:[],projectName:"",selectedIndex:null})}),this.eventSource.addEventListener("context_window",r=>{this._resetSSETimeout();try{const s=JSON.parse(r.data);this.setState({contextWindow:s})}catch{}}),this.eventSource.addEventListener("kv_cache_content",r=>{var s,o,a;this._resetSSETimeout();try{const l=JSON.parse(r.data);l&&(((s=l.system)==null?void 0:s.length)>0||((o=l.messages)==null?void 0:o.length)>0||((a=l.tools)==null?void 0:a.length)>0)&&this.setState({serverCachedContent:l})}catch(l){console.error("Failed to parse kv_cache_content:",l)}}),this.eventSource.addEventListener("proxy_profile",r=>{this._resetSSETimeout();try{const s=JSON.parse(r.data);s.active&&this.setState({activeProxyId:s.active}),s.profile&&fetch(pt("/api/proxy-profiles")).then(o=>o.json()).then(o=>{o.profiles&&this.setState({proxyProfiles:o.profiles,activeProxyId:o.active||"max"})}).catch(()=>{})}catch{}}),this.eventSource.addEventListener("ping",()=>{this._resetSSETimeout()}),this.eventSource.addEventListener("streaming_status",r=>{this._resetSSETimeout();try{JSON.parse(r.data).active?(clearTimeout(this._streamingOffTimer),this.setState({isStreaming:!0})):(clearTimeout(this._streamingOffTimer),this._streamingOffTimer=setTimeout(()=>{this.setState({isStreaming:!1})},2e3))}catch(s){console.error("Failed to parse streaming_status:",s)}}),this.eventSource.onerror=()=>console.error("SSE连接错误")}catch(n){console.error("EventSource初始化失败:",n),this.setState({fileLoading:!1,fileLoadingCount:0})}}loadLocalLogFile(n){this._isLocalLog=!0,this._localLogFile=n,this.setState({fileLoading:!0,fileLoadingCount:0,serverCachedContent:null}),this._localLogES&&(this._localLogES.close(),this._localLogES=null);const i=[],r=new EventSource(pt(`/api/local-log?file=${encodeURIComponent(n)}`));this._localLogES=r,r.addEventListener("load_start",s=>{try{const o=JSON.parse(s.data);this.setState({fileLoadingCount:0})}catch{}}),r.addEventListener("load_chunk",s=>{try{const o=JSON.parse(s.data);if(Array.isArray(o)){for(const a of o)i.push(a);this.setState({fileLoadingCount:i.length})}}catch{}}),r.addEventListener("load_end",()=>{r.close();const s=Vh(i),o=que(js);for(let a=0;a<s.length;a++)o.process(s[a],s,a);if(o.finalize(s),Array.isArray(s)&&s.length>0){const{mainAgentSessions:a,filtered:l}=this._processEntries(s);this.setState({requests:s,selectedIndex:l.length>0?l.length-1:null,mainAgentSessions:a,fileLoading:!1,fileLoadingCount:0,serverCachedContent:null})}else this.setState({fileLoading:!1,fileLoadingCount:0,serverCachedContent:null})}),r.onerror=()=>{r.close(),console.error("加载日志文件 SSE 连接错误"),this.setState({fileLoading:!1,fileLoadingCount:0})}}handleEventMessage(n){try{const i=JSON.parse(n.data);this._pendingEntries.push(i),this._flushRafId||(this._flushRafId=requestAnimationFrame(this._flushPendingEntries))}catch(i){console.error("处理事件消息失败:",i)}}async loadSession(n){if(this._loadingSessionId==null){this._loadingSessionId=n,this.setState({loadingSessionId:n});try{let i=await ahe(this.state.projectName,n);if(!i||i.length===0){const r=(this.state.sessionIndex||[]).find(s=>s.sessionId===n);r&&r.lastTs&&(i=(await(await fetch(pt(`/api/entries/page?before=${encodeURIComponent(r.lastTs)}&limit=200`))).json()).entries||[])}if(i&&i.length>0){const s=[...Vh(i),...this.state.requests],{mainAgentSessions:o}=this._processEntries(s),a=om(s,o),l=Fb(this.state.sessionIndex,a),{hotEntries:c,allSessions:d,coldGroups:u}=Lh(s,o,l,ca,new Set([n])),h=this.state.projectName;if(h){for(const[O,p]of u)rm(h,O,p);sm(h,l),Il(h,s)}this.setState({requests:c,mainAgentSessions:d,sessionIndex:l,loadingSessionId:null})}else this.setState({loadingSessionId:null})}catch(i){console.error("loadSession failed:",i),this.setState({loadingSessionId:null})}this._loadingSessionId=null}}_evictColdSessions(){const{requests:n,mainAgentSessions:i,projectName:r}=this.state;if(!Ft||i.length<=ca)return;const{hotEntries:s,allSessions:o,coldGroups:a}=Lh(n,i,this.state.sessionIndex,ca),l=this.state.sessionIndex;if(r){for(const[c,d]of a)rm(r,c,d);sm(r,l)}this.setState({requests:s,mainAgentSessions:o,sessionIndex:l})}mergeMainAgentSessions(n,i){return che(n,i)}renderLogTable(n,i){const r=[{title:"",dataIndex:"file",key:"check",width:40,fixed:i?"left":!1,render:s=>w.jsx(yl,{checked:this.state.selectedLogs.has(s)||!1,onClick:o=>o.stopPropagation(),onChange:o=>{o.stopPropagation(),this.handleToggleLogSelect(s,o.target.checked)}})},{title:le("ui.logTime"),dataIndex:"timestamp",key:"time",width:i?150:180,render:s=>w.jsx("span",{className:el.tableTimestampCell,children:this.formatTimestamp(s,i)})},{title:le("ui.logPreview"),dataIndex:"preview",key:"preview",width:i?150:void 0,ellipsis:!0,render:s=>{if(!Array.isArray(s)||s.length===0)return"—";const o=s[0],a=o.length<=30&&s.length>1?`${o} | ${s[1]}`:o;return s.length<=1?w.jsx("span",{className:el.tablePreviewText,children:a}):w.jsx(Sl,{trigger:i?"click":"hover",placement:i?"bottomLeft":"leftTop",autoAdjustOverflow:{adjustX:!1,adjustY:!0},overlayInnerStyle:{background:"#1e1e1e",border:"1px solid #3a3a3a",borderRadius:8,padding:0,maxHeight:400,overflowY:"auto"},content:w.jsx("div",{className:el.previewPopover,children:s.map((l,c)=>w.jsx("div",{className:el.previewItem,children:w.jsx("pre",{className:el.previewText,children:l})},c))}),children:w.jsx("span",{className:el.tablePreviewTextClickable,style:{textDecoration:i?"underline dotted #666":"none"},children:a})})}},...i?[]:[{title:le("ui.logTurns"),dataIndex:"turns",key:"turns",width:80,render:s=>w.jsx(Sv,{className:el.tableTag,children:s||0})}],{title:le("ui.logSize"),dataIndex:"size",key:"size",width:90,render:s=>w.jsx(Sv,{className:el.tableTag,children:this.formatSize(s)})},{title:le("ui.logActions"),key:"actions",width:i?160:180,render:(s,o)=>w.jsxs("span",{className:el.tableActionsCell,children:[w.jsx(ai,{size:"small",type:"primary",onClick:a=>{a.stopPropagation(),this.handleOpenLogFile(o.file)},children:le("ui.openLog")}),w.jsx(ai,{size:"small",icon:w.jsx(Vde,{}),onClick:a=>{a.stopPropagation(),this.handleDownloadLogFile(o.file)},children:le("ui.downloadLog")})]})}];return w.jsx(Tl,{size:"small",dataSource:n,columns:r,rowKey:"file",pagination:!1,scroll:i?{x:"max-content",y:"calc(100vh - 160px)"}:{y:400},onRow:s=>({onClick:()=>{const o=!this.state.selectedLogs.has(s.file);this.handleToggleLogSelect(s.file,o)},style:{cursor:"pointer"}})})}formatTimestamp(n,i){return!n||n.length<15?n:i?`${n.slice(4,6)}-${n.slice(6,8)} ${n.slice(9,11)}:${n.slice(11,13)}:${n.slice(13,15)}`:`${n.slice(0,4)}-${n.slice(4,6)}-${n.slice(6,8)} ${n.slice(9,11)}:${n.slice(11,13)}:${n.slice(13,15)}`}formatSize(n){return n<1024?n+" B":n<1024*1024?(n/1024).toFixed(1)+" KB":(n/(1024*1024)).toFixed(1)+" MB"}renderPrepare(){const{requests:n,selectedIndex:i,showAll:r,fileLoading:s,fileLoadingCount:o,mainAgentSessions:a,viewMode:l}=this.state;(this._filteredSource!==n||this._filteredShowAll!==r)&&(this._filteredSource=n,this._filteredShowAll=r,this._filteredRequests=r?n:Gb(n));const c=this._filteredRequests;this._cacheLossShowAll!==r&&(this._cacheLossShowAll=r,this._cacheLossMap=new Map,this._cacheLossLastMainAgent=null,this._cacheLossProcessedCount=0),c.length<this._cacheLossProcessedCount&&(this._cacheLossMap=new Map,this._cacheLossLastMainAgent=null,this._cacheLossProcessedCount=0),c.length>this._cacheLossProcessedCount&&(this._cacheLossLastMainAgent=LA(this._cacheLossMap,c,this._cacheLossProcessedCount,this._cacheLossLastMainAgent),this._cacheLossProcessedCount=c.length);const d=i!==null?c[i]:null;return{filteredRequests:c,selectedRequest:d,fileLoading:s,fileLoadingCount:o,mainAgentSessions:a,viewMode:l}}renderWorkspaceMode(){return w.jsx(ra,{theme:{algorithm:jb.darkAlgorithm,token:{colorPrimary:"#1668dc",colorBgContainer:"#111",colorBgLayout:"#0a0a0a",colorBgElevated:"#1e1e1e",colorBorder:"#2a2a2a"}},children:w.jsx(Aue,{onLaunch:this.handleWorkspaceLaunch})})}get themeConfig(){return this.state.themeColor==="light"?{algorithm:jb.defaultAlgorithm,token:{colorPrimary:"#0969DA",colorBgContainer:"#FFFFFF",colorBgLayout:"#FAFAFA",colorBgElevated:"#FFFFFF",colorBorder:"#E0E0E0",controlOutline:"transparent",controlOutlineWidth:0}}:{algorithm:jb.darkAlgorithm,token:{colorPrimary:"#1668dc",colorBgContainer:"#111",colorBgLayout:"#0a0a0a",colorBgElevated:"#1e1e1e",colorBorder:"#2a2a2a",controlOutline:"transparent",controlOutlineWidth:0}}}}function fP(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var _d=fP();function DA(t){_d=t}var Mc={exec:()=>null};function An(t,e=""){let n=typeof t=="string"?t:t.source,i={replace:(r,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(Ss.caret,"$1"),n=n.replace(r,o),i},getRegex:()=>new RegExp(n,e)};return i}var FOe=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Ss={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},HOe=/^(?:[ \t]*(?:\n|$))+/,KOe=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,JOe=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,$p=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,efe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,pP=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,UA=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,qA=An(UA).replace(/bull/g,pP).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),tfe=An(UA).replace(/bull/g,pP).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),mP=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,nfe=/^[^\n]+/,gP=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ife=An(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",gP).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),rfe=An(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,pP).getRegex(),O$="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",vP=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,sfe=An("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",vP).replace("tag",O$).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ZA=An(mP).replace("hr",$p).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",O$).getRegex(),ofe=An(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ZA).getRegex(),$P={blockquote:ofe,code:KOe,def:ife,fences:JOe,heading:efe,hr:$p,html:sfe,lheading:qA,list:rfe,newline:HOe,paragraph:ZA,table:Mc,text:nfe},H5=An("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",$p).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",O$).getRegex(),afe={...$P,lheading:tfe,table:H5,paragraph:An(mP).replace("hr",$p).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",H5).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",O$).getRegex()},lfe={...$P,html:An(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",vP).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Mc,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:An(mP).replace("hr",$p).replace("heading",` *#{1,6} *[^
718
718
  ]`).replace("lheading",qA).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},cfe=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,dfe=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,GA=/^( {2,}|\\)\n(?!\s*$)/,ufe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,f$=/[\p{P}\p{S}]/u,bP=/[\s\p{P}\p{S}]/u,FA=/[^\s\p{P}\p{S}]/u,hfe=An(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,bP).getRegex(),HA=/(?!~)[\p{P}\p{S}]/u,Ofe=/(?!~)[\s\p{P}\p{S}]/u,ffe=/(?:[^\s\p{P}\p{S}]|~)/u,KA=/(?![*_])[\p{P}\p{S}]/u,pfe=/(?![*_])[\s\p{P}\p{S}]/u,mfe=/(?:[^\s\p{P}\p{S}]|[*_])/u,gfe=An(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",FOe?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),JA=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,vfe=An(JA,"u").replace(/punct/g,f$).getRegex(),$fe=An(JA,"u").replace(/punct/g,HA).getRegex(),eM="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",bfe=An(eM,"gu").replace(/notPunctSpace/g,FA).replace(/punctSpace/g,bP).replace(/punct/g,f$).getRegex(),Sfe=An(eM,"gu").replace(/notPunctSpace/g,ffe).replace(/punctSpace/g,Ofe).replace(/punct/g,HA).getRegex(),yfe=An("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,FA).replace(/punctSpace/g,bP).replace(/punct/g,f$).getRegex(),_fe=An(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,KA).getRegex(),Qfe="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",xfe=An(Qfe,"gu").replace(/notPunctSpace/g,mfe).replace(/punctSpace/g,pfe).replace(/punct/g,KA).getRegex(),wfe=An(/\\(punct)/,"gu").replace(/punct/g,f$).getRegex(),Pfe=An(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Cfe=An(vP).replace("(?:-->|$)","-->").getRegex(),Tfe=An("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Cfe).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),_v=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,kfe=An(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",_v).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),tM=An(/^!?\[(label)\]\[(ref)\]/).replace("label",_v).replace("ref",gP).getRegex(),nM=An(/^!?\[(ref)\](?:\[\])?/).replace("ref",gP).getRegex(),Rfe=An("reflink|nolink(?!\\()","g").replace("reflink",tM).replace("nolink",nM).getRegex(),K5=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,SP={_backpedal:Mc,anyPunctuation:wfe,autolink:Pfe,blockSkip:gfe,br:GA,code:dfe,del:Mc,delLDelim:Mc,delRDelim:Mc,emStrongLDelim:vfe,emStrongRDelimAst:bfe,emStrongRDelimUnd:yfe,escape:cfe,link:kfe,nolink:nM,punctuation:hfe,reflink:tM,reflinkSearch:Rfe,tag:Tfe,text:ufe,url:Mc},Efe={...SP,link:An(/^!?\[(label)\]\((.*?)\)/).replace("label",_v).getRegex(),reflink:An(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",_v).getRegex()},Q_={...SP,emStrongRDelimAst:Sfe,emStrongLDelim:$fe,delLDelim:_fe,delRDelim:xfe,url:An(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",K5).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:An(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",K5).getRegex()},Xfe={...Q_,br:An(GA).replace("{2,}","*").getRegex(),text:An(Q_.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},am={normal:$P,gfm:afe,pedantic:lfe},Bh={normal:SP,gfm:Q_,breaks:Xfe,pedantic:Efe},zfe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},J5=t=>zfe[t];function ga(t,e){if(e){if(Ss.escapeTest.test(t))return t.replace(Ss.escapeReplace,J5)}else if(Ss.escapeTestNoEncode.test(t))return t.replace(Ss.escapeReplaceNoEncode,J5);return t}function eR(t){try{t=encodeURI(t).replace(Ss.percentDecode,"%")}catch{return null}return t}function tR(t,e){var s;let n=t.replace(Ss.findPipe,(o,a,l)=>{let c=!1,d=a;for(;--d>=0&&l[d]==="\\";)c=!c;return c?"|":" |"}),i=n.split(Ss.splitPipe),r=0;if(i[0].trim()||i.shift(),i.length>0&&!((s=i.at(-1))!=null&&s.trim())&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;r<i.length;r++)i[r]=i[r].trim().replace(Ss.slashPipe,"|");return i}function Yh(t,e,n){let i=t.length;if(i===0)return"";let r=0;for(;r<i&&t.charAt(i-r-1)===e;)r++;return t.slice(0,i-r)}function Ife(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let i=0;i<t.length;i++)if(t[i]==="\\")i++;else if(t[i]===e[0])n++;else if(t[i]===e[1]&&(n--,n<0))return i;return n>0?-2:-1}function Afe(t,e=0){let n=e,i="";for(let r of t)if(r===" "){let s=4-n%4;i+=" ".repeat(s),n+=s}else i+=r,n++;return i}function nR(t,e,n,i,r){let s=e.href,o=e.title||null,a=t[1].replace(r.other.outputLinkReplace,"$1");i.state.inLink=!0;let l={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:o,text:a,tokens:i.inlineTokens(a)};return i.state.inLink=!1,l}function Mfe(t,e,n){let i=t.match(n.other.indentCodeCompensation);if(i===null)return e;let r=i[1];return e.split(`
719
719
  `).map(s=>{let o=s.match(n.other.beginningSpace);if(o===null)return s;let[a]=o;return a.length>=r.length?s.slice(r.length):s}).join(`
720
720
  `)}var Qv=class{constructor(e){Je(this,"options");Je(this,"rules");Je(this,"lexer");this.options=e||_d}space(e){let n=this.rules.block.newline.exec(e);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(e){let n=this.rules.block.code.exec(e);if(n){let i=n[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?i:Yh(i,`
@@ -773,7 +773,7 @@ ${t}</tr>
773
773
  `}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
774
774
  `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${ga(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let i=this.parser.parseInline(n),r=eR(t);if(r===null)return i;t=r;let s='<a href="'+t+'"';return e&&(s+=' title="'+ga(e)+'"'),s+=">"+i+"</a>",s}image({href:t,title:e,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));let r=eR(t);if(r===null)return ga(n);t=r;let s=`<img src="${t}" alt="${ga(n)}"`;return e&&(s+=` title="${ga(e)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:ga(t.text)}},yP=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Vo=class w_{constructor(e){Je(this,"options");Je(this,"renderer");Je(this,"textRenderer");this.options=e||_d,this.options.renderer=this.options.renderer||new xv,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new yP}static parse(e,n){return new w_(n).parse(e)}static parseInline(e,n){return new w_(n).parseInline(e)}parse(e){var i,r;let n="";for(let s=0;s<e.length;s++){let o=e[s];if((r=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&r[o.type]){let l=o,c=this.options.extensions.renderers[l.type].call({parser:this},l);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){n+=c||"";continue}}let a=o;switch(a.type){case"space":{n+=this.renderer.space(a);break}case"hr":{n+=this.renderer.hr(a);break}case"heading":{n+=this.renderer.heading(a);break}case"code":{n+=this.renderer.code(a);break}case"table":{n+=this.renderer.table(a);break}case"blockquote":{n+=this.renderer.blockquote(a);break}case"list":{n+=this.renderer.list(a);break}case"checkbox":{n+=this.renderer.checkbox(a);break}case"html":{n+=this.renderer.html(a);break}case"def":{n+=this.renderer.def(a);break}case"paragraph":{n+=this.renderer.paragraph(a);break}case"text":{n+=this.renderer.text(a);break}default:{let l='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(e,n=this.renderer){var r,s;let i="";for(let o=0;o<e.length;o++){let a=e[o];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[a.type]){let c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){i+=c||"";continue}}let l=a;switch(l.type){case"escape":{i+=n.text(l);break}case"html":{i+=n.html(l);break}case"link":{i+=n.link(l);break}case"image":{i+=n.image(l);break}case"checkbox":{i+=n.checkbox(l);break}case"strong":{i+=n.strong(l);break}case"em":{i+=n.em(l);break}case"codespan":{i+=n.codespan(l);break}case"br":{i+=n.br(l);break}case"del":{i+=n.del(l);break}case"text":{i+=n.text(l);break}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return i}},rg,$O=(rg=class{constructor(e){Je(this,"options");Je(this,"block");this.options=e||_d}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Lo.lex:Lo.lexInline}provideParser(){return this.block?Vo.parse:Vo.parseInline}},Je(rg,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),Je(rg,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),rg),jfe=class{constructor(...e){Je(this,"defaults",fP());Je(this,"options",this.setOptions);Je(this,"parse",this.parseMarkdown(!0));Je(this,"parseInline",this.parseMarkdown(!1));Je(this,"Parser",Vo);Je(this,"Renderer",xv);Je(this,"TextRenderer",yP);Je(this,"Lexer",Lo);Je(this,"Tokenizer",Qv);Je(this,"Hooks",$O);this.use(...e)}walkTokens(e,n){var r,s;let i=[];for(let o of e)switch(i=i.concat(n.call(this,o)),o.type){case"table":{let a=o;for(let l of a.header)i=i.concat(this.walkTokens(l.tokens,n));for(let l of a.rows)for(let c of l)i=i.concat(this.walkTokens(c.tokens,n));break}case"list":{let a=o;i=i.concat(this.walkTokens(a.items,n));break}default:{let a=o;(s=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&s[a.type]?this.defaults.extensions.childTokens[a.type].forEach(l=>{let c=a[l].flat(1/0);i=i.concat(this.walkTokens(c,n))}):a.tokens&&(i=i.concat(this.walkTokens(a.tokens,n)))}}return i}use(...e){let n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(i=>{let r={...i};if(r.async=this.defaults.async||r.async||!1,i.extensions&&(i.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let o=n.renderers[s.name];o?n.renderers[s.name]=function(...a){let l=s.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:n.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=n[s.level];o?o.unshift(s.tokenizer):n[s.level]=[s.tokenizer],s.start&&(s.level==="block"?n.startBlock?n.startBlock.push(s.start):n.startBlock=[s.start]:s.level==="inline"&&(n.startInline?n.startInline.push(s.start):n.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(n.childTokens[s.name]=s.childTokens)}),r.extensions=n),i.renderer){let s=this.defaults.renderer||new xv(this.defaults);for(let o in i.renderer){if(!(o in s))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,l=i.renderer[a],c=s[a];s[a]=(...d)=>{let u=l.apply(s,d);return u===!1&&(u=c.apply(s,d)),u||""}}r.renderer=s}if(i.tokenizer){let s=this.defaults.tokenizer||new Qv(this.defaults);for(let o in i.tokenizer){if(!(o in s))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,l=i.tokenizer[a],c=s[a];s[a]=(...d)=>{let u=l.apply(s,d);return u===!1&&(u=c.apply(s,d)),u}}r.tokenizer=s}if(i.hooks){let s=this.defaults.hooks||new $O;for(let o in i.hooks){if(!(o in s))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,l=i.hooks[a],c=s[a];$O.passThroughHooks.has(o)?s[a]=d=>{if(this.defaults.async&&$O.passThroughHooksRespectAsync.has(o))return(async()=>{let h=await l.call(s,d);return c.call(s,h)})();let u=l.call(s,d);return c.call(s,u)}:s[a]=(...d)=>{if(this.defaults.async)return(async()=>{let h=await l.apply(s,d);return h===!1&&(h=await c.apply(s,d)),h})();let u=l.apply(s,d);return u===!1&&(u=c.apply(s,d)),u}}r.hooks=s}if(i.walkTokens){let s=this.defaults.walkTokens,o=i.walkTokens;r.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),s&&(l=l.concat(s.call(this,a))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return Lo.lex(e,n??this.defaults)}parser(e,n){return Vo.parse(e,n??this.defaults)}parseMarkdown(e){return(n,i)=>{let r={...i},s={...this.defaults,...r},o=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let a=s.hooks?await s.hooks.preprocess(n):n,l=await(s.hooks?await s.hooks.provideLexer():e?Lo.lex:Lo.lexInline)(a,s),c=s.hooks?await s.hooks.processAllTokens(l):l;s.walkTokens&&await Promise.all(this.walkTokens(c,s.walkTokens));let d=await(s.hooks?await s.hooks.provideParser():e?Vo.parse:Vo.parseInline)(c,s);return s.hooks?await s.hooks.postprocess(d):d})().catch(o);try{s.hooks&&(n=s.hooks.preprocess(n));let a=(s.hooks?s.hooks.provideLexer():e?Lo.lex:Lo.lexInline)(n,s);s.hooks&&(a=s.hooks.processAllTokens(a)),s.walkTokens&&this.walkTokens(a,s.walkTokens);let l=(s.hooks?s.hooks.provideParser():e?Vo.parse:Vo.parseInline)(a,s);return s.hooks&&(l=s.hooks.postprocess(l)),l}catch(a){return o(a)}}}onError(e,n){return i=>{if(i.message+=`
775
775
  Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+ga(i.message+"",!0)+"</pre>";return n?Promise.resolve(r):r}if(n)return Promise.reject(i);throw i}}},cd=new jfe;function ni(t,e){return cd.parse(t,e)}ni.options=ni.setOptions=function(t){return cd.setOptions(t),ni.defaults=cd.defaults,DA(ni.defaults),ni};ni.getDefaults=fP;ni.defaults=_d;ni.use=function(...t){return cd.use(...t),ni.defaults=cd.defaults,DA(ni.defaults),ni};ni.walkTokens=function(t,e){return cd.walkTokens(t,e)};ni.parseInline=cd.parseInline;ni.Parser=Vo;ni.parser=Vo.parse;ni.Renderer=xv;ni.TextRenderer=yP;ni.Lexer=Lo;ni.lexer=Lo.lex;ni.Tokenizer=Qv;ni.Hooks=$O;ni.parse=ni;ni.options;ni.setOptions;ni.use;ni.walkTokens;ni.parseInline;Vo.parse;Lo.lex;/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:iM,setPrototypeOf:iR,isFrozen:Nfe,getPrototypeOf:Wfe,getOwnPropertyDescriptor:Lfe}=Object;let{freeze:ws,seal:Xo,create:bg}=Object,{apply:P_,construct:C_}=typeof Reflect<"u"&&Reflect;ws||(ws=function(e){return e});Xo||(Xo=function(e){return e});P_||(P_=function(e,n){for(var i=arguments.length,r=new Array(i>2?i-2:0),s=2;s<i;s++)r[s-2]=arguments[s];return e.apply(n,r)});C_||(C_=function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return new e(...i)});const lm=Ps(Array.prototype.forEach),Vfe=Ps(Array.prototype.lastIndexOf),rR=Ps(Array.prototype.pop),Dh=Ps(Array.prototype.push),Bfe=Ps(Array.prototype.splice),Sg=Ps(String.prototype.toLowerCase),Hb=Ps(String.prototype.toString),Kb=Ps(String.prototype.match),Uh=Ps(String.prototype.replace),Yfe=Ps(String.prototype.indexOf),Dfe=Ps(String.prototype.trim),to=Ps(Object.prototype.hasOwnProperty),Os=Ps(RegExp.prototype.test),qh=Ufe(TypeError);function Ps(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return P_(t,e,i)}}function Ufe(t){return function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return C_(t,n)}}function yn(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Sg;iR&&iR(t,null);let i=e.length;for(;i--;){let r=e[i];if(typeof r=="string"){const s=n(r);s!==r&&(Nfe(e)||(e[i]=s),r=s)}t[r]=!0}return t}function qfe(t){for(let e=0;e<t.length;e++)to(t,e)||(t[e]=null);return t}function va(t){const e=bg(null);for(const[n,i]of iM(t))to(t,n)&&(Array.isArray(i)?e[n]=qfe(i):i&&typeof i=="object"&&i.constructor===Object?e[n]=va(i):e[n]=i);return e}function Zh(t,e){for(;t!==null;){const i=Lfe(t,e);if(i){if(i.get)return Ps(i.get);if(typeof i.value=="function")return Ps(i.value)}t=Wfe(t)}function n(){return null}return n}const sR=ws(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Jb=ws(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),eS=ws(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Zfe=ws(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),tS=ws(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Gfe=ws(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),oR=ws(["#text"]),aR=ws(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),nS=ws(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),lR=ws(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),cm=ws(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ffe=Xo(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Hfe=Xo(/<%[\w\W]*|[\w\W]*%>/gm),Kfe=Xo(/\$\{[\w\W]*/gm),Jfe=Xo(/^data-[\-\w.\u00B7-\uFFFF]+$/),epe=Xo(/^aria-[\-\w]+$/),rM=Xo(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),tpe=Xo(/^(?:\w+script|data):/i),npe=Xo(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),sM=Xo(/^html$/i),ipe=Xo(/^[a-z][.\w]*(-[.\w]+)+$/i);var cR=Object.freeze({__proto__:null,ARIA_ATTR:epe,ATTR_WHITESPACE:npe,CUSTOM_ELEMENT:ipe,DATA_ATTR:Jfe,DOCTYPE_NAME:sM,ERB_EXPR:Hfe,IS_ALLOWED_URI:rM,IS_SCRIPT_OR_DATA:tpe,MUSTACHE_EXPR:Ffe,TMPLIT_EXPR:Kfe});const Gh={element:1,text:3,progressingInstruction:7,comment:8,document:9},rpe=function(){return typeof window>"u"?null:window},spe=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(i=n.getAttribute(r));const s="dompurify"+(i?"#"+i:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},dR=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function oM(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:rpe();const e=Ge=>oM(Ge);if(e.version="3.3.3",e.removed=[],!t||!t.document||t.document.nodeType!==Gh.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const i=n,r=i.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:c,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:u,DOMParser:h,trustedTypes:O}=t,p=l.prototype,m=Zh(p,"cloneNode"),g=Zh(p,"remove"),v=Zh(p,"nextSibling"),$=Zh(p,"childNodes"),b=Zh(p,"parentNode");if(typeof o=="function"){const Ge=n.createElement("template");Ge.content&&Ge.content.ownerDocument&&(n=Ge.content.ownerDocument)}let S,y="";const{implementation:Q,createNodeIterator:_,createDocumentFragment:P,getElementsByTagName:C}=n,{importNode:X}=i;let z=dR();e.isSupported=typeof iM=="function"&&typeof b=="function"&&Q&&Q.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:T,ERB_EXPR:k,TMPLIT_EXPR:x,DATA_ATTR:R,ARIA_ATTR:E,IS_SCRIPT_OR_DATA:I,ATTR_WHITESPACE:A,CUSTOM_ELEMENT:j}=cR;let{IS_ALLOWED_URI:N}=cR,L=null;const B=yn({},[...sR,...Jb,...eS,...tS,...oR]);let V=null;const Y=yn({},[...aR,...nS,...lR,...cm]);let W=Object.seal(bg(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),q=null,ne=null;const D=Object.seal(bg(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ee=!0,fe=!0,se=!1,te=!0,oe=!1,G=!0,H=!1,K=!1,ae=!1,de=!1,ve=!1,Se=!1,ue=!0,me=!1;const Oe="user-content-";let pe=!0,ke=!1,Ae={},Ue=null;const Ze=yn({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let De=null;const et=yn({},["audio","video","img","source","image","track"]);let Ce=null;const we=yn({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),We="http://www.w3.org/1998/Math/MathML",je="http://www.w3.org/2000/svg",Ve="http://www.w3.org/1999/xhtml";let Xe=Ve,qe=!1,nt=null;const ut=yn({},[We,je,Ve],Hb);let Nt=yn({},["mi","mo","mn","ms","mtext"]),Yt=yn({},["annotation-xml"]);const It=yn({},["title","style","font","a","script"]);let sn=null;const re=["application/xhtml+xml","text/html"],ye="text/html";let _e=null,Ke=null;const yt=n.createElement("form"),Be=function(ce){return ce instanceof RegExp||ce instanceof Function},Ie=function(){let ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ke&&Ke===ce)){if((!ce||typeof ce!="object")&&(ce={}),ce=va(ce),sn=re.indexOf(ce.PARSER_MEDIA_TYPE)===-1?ye:ce.PARSER_MEDIA_TYPE,_e=sn==="application/xhtml+xml"?Hb:Sg,L=to(ce,"ALLOWED_TAGS")?yn({},ce.ALLOWED_TAGS,_e):B,V=to(ce,"ALLOWED_ATTR")?yn({},ce.ALLOWED_ATTR,_e):Y,nt=to(ce,"ALLOWED_NAMESPACES")?yn({},ce.ALLOWED_NAMESPACES,Hb):ut,Ce=to(ce,"ADD_URI_SAFE_ATTR")?yn(va(we),ce.ADD_URI_SAFE_ATTR,_e):we,De=to(ce,"ADD_DATA_URI_TAGS")?yn(va(et),ce.ADD_DATA_URI_TAGS,_e):et,Ue=to(ce,"FORBID_CONTENTS")?yn({},ce.FORBID_CONTENTS,_e):Ze,q=to(ce,"FORBID_TAGS")?yn({},ce.FORBID_TAGS,_e):va({}),ne=to(ce,"FORBID_ATTR")?yn({},ce.FORBID_ATTR,_e):va({}),Ae=to(ce,"USE_PROFILES")?ce.USE_PROFILES:!1,ee=ce.ALLOW_ARIA_ATTR!==!1,fe=ce.ALLOW_DATA_ATTR!==!1,se=ce.ALLOW_UNKNOWN_PROTOCOLS||!1,te=ce.ALLOW_SELF_CLOSE_IN_ATTR!==!1,oe=ce.SAFE_FOR_TEMPLATES||!1,G=ce.SAFE_FOR_XML!==!1,H=ce.WHOLE_DOCUMENT||!1,de=ce.RETURN_DOM||!1,ve=ce.RETURN_DOM_FRAGMENT||!1,Se=ce.RETURN_TRUSTED_TYPE||!1,ae=ce.FORCE_BODY||!1,ue=ce.SANITIZE_DOM!==!1,me=ce.SANITIZE_NAMED_PROPS||!1,pe=ce.KEEP_CONTENT!==!1,ke=ce.IN_PLACE||!1,N=ce.ALLOWED_URI_REGEXP||rM,Xe=ce.NAMESPACE||Ve,Nt=ce.MATHML_TEXT_INTEGRATION_POINTS||Nt,Yt=ce.HTML_INTEGRATION_POINTS||Yt,W=ce.CUSTOM_ELEMENT_HANDLING||{},ce.CUSTOM_ELEMENT_HANDLING&&Be(ce.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(W.tagNameCheck=ce.CUSTOM_ELEMENT_HANDLING.tagNameCheck),ce.CUSTOM_ELEMENT_HANDLING&&Be(ce.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(W.attributeNameCheck=ce.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),ce.CUSTOM_ELEMENT_HANDLING&&typeof ce.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(W.allowCustomizedBuiltInElements=ce.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),oe&&(fe=!1),ve&&(de=!0),Ae&&(L=yn({},oR),V=bg(null),Ae.html===!0&&(yn(L,sR),yn(V,aR)),Ae.svg===!0&&(yn(L,Jb),yn(V,nS),yn(V,cm)),Ae.svgFilters===!0&&(yn(L,eS),yn(V,nS),yn(V,cm)),Ae.mathMl===!0&&(yn(L,tS),yn(V,lR),yn(V,cm))),to(ce,"ADD_TAGS")||(D.tagCheck=null),to(ce,"ADD_ATTR")||(D.attributeCheck=null),ce.ADD_TAGS&&(typeof ce.ADD_TAGS=="function"?D.tagCheck=ce.ADD_TAGS:(L===B&&(L=va(L)),yn(L,ce.ADD_TAGS,_e))),ce.ADD_ATTR&&(typeof ce.ADD_ATTR=="function"?D.attributeCheck=ce.ADD_ATTR:(V===Y&&(V=va(V)),yn(V,ce.ADD_ATTR,_e))),ce.ADD_URI_SAFE_ATTR&&yn(Ce,ce.ADD_URI_SAFE_ATTR,_e),ce.FORBID_CONTENTS&&(Ue===Ze&&(Ue=va(Ue)),yn(Ue,ce.FORBID_CONTENTS,_e)),ce.ADD_FORBID_CONTENTS&&(Ue===Ze&&(Ue=va(Ue)),yn(Ue,ce.ADD_FORBID_CONTENTS,_e)),pe&&(L["#text"]=!0),H&&yn(L,["html","head","body"]),L.table&&(yn(L,["tbody"]),delete q.tbody),ce.TRUSTED_TYPES_POLICY){if(typeof ce.TRUSTED_TYPES_POLICY.createHTML!="function")throw qh('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof ce.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw qh('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=ce.TRUSTED_TYPES_POLICY,y=S.createHTML("")}else S===void 0&&(S=spe(O,r)),S!==null&&typeof y=="string"&&(y=S.createHTML(""));ws&&ws(ce),Ke=ce}},Re=yn({},[...Jb,...eS,...Zfe]),xe=yn({},[...tS,...Gfe]),Ee=function(ce){let ge=b(ce);(!ge||!ge.tagName)&&(ge={namespaceURI:Xe,tagName:"template"});const Te=Sg(ce.tagName),ct=Sg(ge.tagName);return nt[ce.namespaceURI]?ce.namespaceURI===je?ge.namespaceURI===Ve?Te==="svg":ge.namespaceURI===We?Te==="svg"&&(ct==="annotation-xml"||Nt[ct]):!!Re[Te]:ce.namespaceURI===We?ge.namespaceURI===Ve?Te==="math":ge.namespaceURI===je?Te==="math"&&Yt[ct]:!!xe[Te]:ce.namespaceURI===Ve?ge.namespaceURI===je&&!Yt[ct]||ge.namespaceURI===We&&!Nt[ct]?!1:!xe[Te]&&(It[Te]||!Re[Te]):!!(sn==="application/xhtml+xml"&&nt[ce.namespaceURI]):!1},Qe=function(ce){Dh(e.removed,{element:ce});try{b(ce).removeChild(ce)}catch{g(ce)}},Ye=function(ce,ge){try{Dh(e.removed,{attribute:ge.getAttributeNode(ce),from:ge})}catch{Dh(e.removed,{attribute:null,from:ge})}if(ge.removeAttribute(ce),ce==="is")if(de||ve)try{Qe(ge)}catch{}else try{ge.setAttribute(ce,"")}catch{}},mt=function(ce){let ge=null,Te=null;if(ae)ce="<remove></remove>"+ce;else{const tt=Kb(ce,/^[\r\n\t ]+/);Te=tt&&tt[0]}sn==="application/xhtml+xml"&&Xe===Ve&&(ce='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+ce+"</body></html>");const ct=S?S.createHTML(ce):ce;if(Xe===Ve)try{ge=new h().parseFromString(ct,sn)}catch{}if(!ge||!ge.documentElement){ge=Q.createDocument(Xe,"template",null);try{ge.documentElement.innerHTML=qe?y:ct}catch{}}const ft=ge.body||ge.documentElement;return ce&&Te&&ft.insertBefore(n.createTextNode(Te),ft.childNodes[0]||null),Xe===Ve?C.call(ge,H?"html":"body")[0]:H?ge.documentElement:ft},gt=function(ce){return _.call(ce.ownerDocument||ce,ce,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ut=function(ce){return ce instanceof u&&(typeof ce.nodeName!="string"||typeof ce.textContent!="string"||typeof ce.removeChild!="function"||!(ce.attributes instanceof d)||typeof ce.removeAttribute!="function"||typeof ce.setAttribute!="function"||typeof ce.namespaceURI!="string"||typeof ce.insertBefore!="function"||typeof ce.hasChildNodes!="function")},st=function(ce){return typeof a=="function"&&ce instanceof a};function Fe(Ge,ce,ge){lm(Ge,Te=>{Te.call(e,ce,ge,Ke)})}const Pt=function(ce){let ge=null;if(Fe(z.beforeSanitizeElements,ce,null),Ut(ce))return Qe(ce),!0;const Te=_e(ce.nodeName);if(Fe(z.uponSanitizeElement,ce,{tagName:Te,allowedTags:L}),G&&ce.hasChildNodes()&&!st(ce.firstElementChild)&&Os(/<[/\w!]/g,ce.innerHTML)&&Os(/<[/\w!]/g,ce.textContent)||ce.nodeType===Gh.progressingInstruction||G&&ce.nodeType===Gh.comment&&Os(/<[/\w]/g,ce.data))return Qe(ce),!0;if(!(D.tagCheck instanceof Function&&D.tagCheck(Te))&&(!L[Te]||q[Te])){if(!q[Te]&&Jt(Te)&&(W.tagNameCheck instanceof RegExp&&Os(W.tagNameCheck,Te)||W.tagNameCheck instanceof Function&&W.tagNameCheck(Te)))return!1;if(pe&&!Ue[Te]){const ct=b(ce)||ce.parentNode,ft=$(ce)||ce.childNodes;if(ft&&ct){const tt=ft.length;for(let it=tt-1;it>=0;--it){const Tt=m(ft[it],!0);Tt.__removalCount=(ce.__removalCount||0)+1,ct.insertBefore(Tt,v(ce))}}}return Qe(ce),!0}return ce instanceof l&&!Ee(ce)||(Te==="noscript"||Te==="noembed"||Te==="noframes")&&Os(/<\/no(script|embed|frames)/i,ce.innerHTML)?(Qe(ce),!0):(oe&&ce.nodeType===Gh.text&&(ge=ce.textContent,lm([T,k,x],ct=>{ge=Uh(ge,ct," ")}),ce.textContent!==ge&&(Dh(e.removed,{element:ce.cloneNode()}),ce.textContent=ge)),Fe(z.afterSanitizeElements,ce,null),!1)},Zt=function(ce,ge,Te){if(ne[ge]||ue&&(ge==="id"||ge==="name")&&(Te in n||Te in yt))return!1;if(!(fe&&!ne[ge]&&Os(R,ge))){if(!(ee&&Os(E,ge))){if(!(D.attributeCheck instanceof Function&&D.attributeCheck(ge,ce))){if(!V[ge]||ne[ge]){if(!(Jt(ce)&&(W.tagNameCheck instanceof RegExp&&Os(W.tagNameCheck,ce)||W.tagNameCheck instanceof Function&&W.tagNameCheck(ce))&&(W.attributeNameCheck instanceof RegExp&&Os(W.attributeNameCheck,ge)||W.attributeNameCheck instanceof Function&&W.attributeNameCheck(ge,ce))||ge==="is"&&W.allowCustomizedBuiltInElements&&(W.tagNameCheck instanceof RegExp&&Os(W.tagNameCheck,Te)||W.tagNameCheck instanceof Function&&W.tagNameCheck(Te))))return!1}else if(!Ce[ge]){if(!Os(N,Uh(Te,A,""))){if(!((ge==="src"||ge==="xlink:href"||ge==="href")&&ce!=="script"&&Yfe(Te,"data:")===0&&De[ce])){if(!(se&&!Os(I,Uh(Te,A,"")))){if(Te)return!1}}}}}}}return!0},Jt=function(ce){return ce!=="annotation-xml"&&Kb(ce,j)},en=function(ce){Fe(z.beforeSanitizeAttributes,ce,null);const{attributes:ge}=ce;if(!ge||Ut(ce))return;const Te={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:V,forceKeepAttr:void 0};let ct=ge.length;for(;ct--;){const ft=ge[ct],{name:tt,namespaceURI:it,value:Tt}=ft,Gt=_e(tt),be=Tt;let ze=tt==="value"?be:Dfe(be);if(Te.attrName=Gt,Te.attrValue=ze,Te.keepAttr=!0,Te.forceKeepAttr=void 0,Fe(z.uponSanitizeAttribute,ce,Te),ze=Te.attrValue,me&&(Gt==="id"||Gt==="name")&&(Ye(tt,ce),ze=Oe+ze),G&&Os(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ze)){Ye(tt,ce);continue}if(Gt==="attributename"&&Kb(ze,"href")){Ye(tt,ce);continue}if(Te.forceKeepAttr)continue;if(!Te.keepAttr){Ye(tt,ce);continue}if(!te&&Os(/\/>/i,ze)){Ye(tt,ce);continue}oe&&lm([T,k,x],qt=>{ze=Uh(ze,qt," ")});const rt=_e(ce.nodeName);if(!Zt(rt,Gt,ze)){Ye(tt,ce);continue}if(S&&typeof O=="object"&&typeof O.getAttributeType=="function"&&!it)switch(O.getAttributeType(rt,Gt)){case"TrustedHTML":{ze=S.createHTML(ze);break}case"TrustedScriptURL":{ze=S.createScriptURL(ze);break}}if(ze!==be)try{it?ce.setAttributeNS(it,tt,ze):ce.setAttribute(tt,ze),Ut(ce)?Qe(ce):rR(e.removed)}catch{Ye(tt,ce)}}Fe(z.afterSanitizeAttributes,ce,null)},mn=function Ge(ce){let ge=null;const Te=gt(ce);for(Fe(z.beforeSanitizeShadowDOM,ce,null);ge=Te.nextNode();)Fe(z.uponSanitizeShadowNode,ge,null),Pt(ge),en(ge),ge.content instanceof s&&Ge(ge.content);Fe(z.afterSanitizeShadowDOM,ce,null)};return e.sanitize=function(Ge){let ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ge=null,Te=null,ct=null,ft=null;if(qe=!Ge,qe&&(Ge="<!-->"),typeof Ge!="string"&&!st(Ge))if(typeof Ge.toString=="function"){if(Ge=Ge.toString(),typeof Ge!="string")throw qh("dirty is not a string, aborting")}else throw qh("toString is not a function");if(!e.isSupported)return Ge;if(K||Ie(ce),e.removed=[],typeof Ge=="string"&&(ke=!1),ke){if(Ge.nodeName){const Tt=_e(Ge.nodeName);if(!L[Tt]||q[Tt])throw qh("root node is forbidden and cannot be sanitized in-place")}}else if(Ge instanceof a)ge=mt("<!---->"),Te=ge.ownerDocument.importNode(Ge,!0),Te.nodeType===Gh.element&&Te.nodeName==="BODY"||Te.nodeName==="HTML"?ge=Te:ge.appendChild(Te);else{if(!de&&!oe&&!H&&Ge.indexOf("<")===-1)return S&&Se?S.createHTML(Ge):Ge;if(ge=mt(Ge),!ge)return de?null:Se?y:""}ge&&ae&&Qe(ge.firstChild);const tt=gt(ke?Ge:ge);for(;ct=tt.nextNode();)Pt(ct),en(ct),ct.content instanceof s&&mn(ct.content);if(ke)return Ge;if(de){if(ve)for(ft=P.call(ge.ownerDocument);ge.firstChild;)ft.appendChild(ge.firstChild);else ft=ge;return(V.shadowroot||V.shadowrootmode)&&(ft=X.call(i,ft,!0)),ft}let it=H?ge.outerHTML:ge.innerHTML;return H&&L["!doctype"]&&ge.ownerDocument&&ge.ownerDocument.doctype&&ge.ownerDocument.doctype.name&&Os(sM,ge.ownerDocument.doctype.name)&&(it="<!DOCTYPE "+ge.ownerDocument.doctype.name+`>
776
- `+it),oe&&lm([T,k,x],Tt=>{it=Uh(it,Tt," ")}),S&&Se?S.createHTML(it):it},e.setConfig=function(){let Ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ie(Ge),K=!0},e.clearConfig=function(){Ke=null,K=!1},e.isValidAttribute=function(Ge,ce,ge){Ke||Ie({});const Te=_e(Ge),ct=_e(ce);return Zt(Te,ct,ge)},e.addHook=function(Ge,ce){typeof ce=="function"&&Dh(z[Ge],ce)},e.removeHook=function(Ge,ce){if(ce!==void 0){const ge=Vfe(z[Ge],ce);return ge===-1?void 0:Bfe(z[Ge],ge,1)[0]}return rR(z[Ge])},e.removeHooks=function(Ge){z[Ge]=[]},e.removeAllHooks=function(){z=dR()},e}var _P=oM();let Fh=null,uR=!1,iS=null,T_=new Set;function ope(){return Fh||(Fh=t6(()=>import("./mermaid.core-Tmv8ZzzJ.js").then(t=>t.bE),__vite__mapDeps([0,1,2])).then(t=>{const e=t.default;return e.initialize({startOnLoad:!1,theme:"dark",darkMode:!0,securityLevel:"strict",flowchart:{useMaxWidth:!0},themeVariables:{darkMode:!0,background:"#0d1117",primaryColor:"#1a3a5c",primaryTextColor:"#c9d1d9",primaryBorderColor:"#30363d",lineColor:"#58a6ff",secondaryColor:"#161b22",tertiaryColor:"#0d1117",nodeTextColor:"#c9d1d9",edgeLabelBackground:"#0d1117"}}),e}).catch(()=>(Fh=null,null)),Fh)}async function ape(t){if(!t)return;const e=t.querySelectorAll("code.language-mermaid");if(e.length===0)return;const n=await ope();if(n)for(const i of e){const r=i.parentElement;if(!r||r.dataset.mermaidRendered)continue;r.dataset.mermaidRendered="1";const s=i.textContent;try{const o="mmd-"+Math.random().toString(36).slice(2,9),{svg:a}=await n.render(o,s),l=document.createElement("div");l.className="mermaid-diagram",l.innerHTML=_P.sanitize(a,{USE_PROFILES:{svg:!0,svgFilters:!0},ADD_TAGS:["style","foreignObject"]}),r.replaceWith(l)}catch{}}}function lpe(){iS||(iS=requestAnimationFrame(()=>{iS=null;const t=T_;T_=new Set;for(const e of t)e.isConnected&&ape(e)}))}function cpe(){if(uR||typeof document>"u")return;uR=!0;const t=new MutationObserver(n=>{var i;for(const r of n)for(const s of r.addedNodes)if(s.nodeType===1&&((i=s.querySelector)!=null&&i.call(s,"code.language-mermaid"))){T_.add(s),lpe();return}}),e=()=>t.observe(document.body,{childList:!0,subtree:!0});document.body?e():document.addEventListener("DOMContentLoaded",e)}cpe();function bo(t){if(!t)return"";try{return _P.sanitize(ni.parse(t,{breaks:!0}))}catch{return b_(t)}}const dpe=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
776
+ `+it),oe&&lm([T,k,x],Tt=>{it=Uh(it,Tt," ")}),S&&Se?S.createHTML(it):it},e.setConfig=function(){let Ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ie(Ge),K=!0},e.clearConfig=function(){Ke=null,K=!1},e.isValidAttribute=function(Ge,ce,ge){Ke||Ie({});const Te=_e(Ge),ct=_e(ce);return Zt(Te,ct,ge)},e.addHook=function(Ge,ce){typeof ce=="function"&&Dh(z[Ge],ce)},e.removeHook=function(Ge,ce){if(ce!==void 0){const ge=Vfe(z[Ge],ce);return ge===-1?void 0:Bfe(z[Ge],ge,1)[0]}return rR(z[Ge])},e.removeHooks=function(Ge){z[Ge]=[]},e.removeAllHooks=function(){z=dR()},e}var _P=oM();let Fh=null,uR=!1,iS=null,T_=new Set;function ope(){return Fh||(Fh=t6(()=>import("./mermaid.core-BMHOIuqW.js").then(t=>t.bE),__vite__mapDeps([0,1,2])).then(t=>{const e=t.default;return e.initialize({startOnLoad:!1,theme:"dark",darkMode:!0,securityLevel:"strict",flowchart:{useMaxWidth:!0},themeVariables:{darkMode:!0,background:"#0d1117",primaryColor:"#1a3a5c",primaryTextColor:"#c9d1d9",primaryBorderColor:"#30363d",lineColor:"#58a6ff",secondaryColor:"#161b22",tertiaryColor:"#0d1117",nodeTextColor:"#c9d1d9",edgeLabelBackground:"#0d1117"}}),e}).catch(()=>(Fh=null,null)),Fh)}async function ape(t){if(!t)return;const e=t.querySelectorAll("code.language-mermaid");if(e.length===0)return;const n=await ope();if(n)for(const i of e){const r=i.parentElement;if(!r||r.dataset.mermaidRendered)continue;r.dataset.mermaidRendered="1";const s=i.textContent;try{const o="mmd-"+Math.random().toString(36).slice(2,9),{svg:a}=await n.render(o,s),l=document.createElement("div");l.className="mermaid-diagram",l.innerHTML=_P.sanitize(a,{USE_PROFILES:{svg:!0,svgFilters:!0},ADD_TAGS:["style","foreignObject"]}),r.replaceWith(l)}catch{}}}function lpe(){iS||(iS=requestAnimationFrame(()=>{iS=null;const t=T_;T_=new Set;for(const e of t)e.isConnected&&ape(e)}))}function cpe(){if(uR||typeof document>"u")return;uR=!0;const t=new MutationObserver(n=>{var i;for(const r of n)for(const s of r.addedNodes)if(s.nodeType===1&&((i=s.querySelector)!=null&&i.call(s,"code.language-mermaid"))){T_.add(s),lpe();return}}),e=()=>t.observe(document.body,{childList:!0,subtree:!0});document.body?e():document.addEventListener("DOMContentLoaded",e)}cpe();function bo(t){if(!t)return"";try{return _P.sanitize(ni.parse(t,{breaks:!0}))}catch{return b_(t)}}const dpe=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
777
777
  <!-- Bar chart: represents data analysis -->
778
778
  <!-- Three vertical bars of varying height -->
779
779
  <line x1="18" y1="20" x2="18" y2="10"/>
@@ -878,17 +878,17 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
878
878
  <!-- Wrench: represents hands-on execution and building -->
879
879
  <path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/>
880
880
  </svg>
881
- `,aM={worker:{svg:wpe},reviewer:{svg:Spe},researcher:{svg:bpe},explorer:{svg:gpe},analyst:{svg:dpe},tracer:{svg:Qpe},investigator:{svg:$pe},builder:{svg:hpe},implementer:{svg:vpe},auditor:{svg:upe},translator:{svg:xpe},security:{svg:_pe},scanner:{svg:ype},expert:{svg:mpe},executor:{svg:ppe},designer:{svg:fpe},default:{svg:Ope}},Ppe=[{prefix:"worker-",role:"worker"},{prefix:"reviewer-",role:"reviewer"},{prefix:"researcher-",role:"researcher"},{prefix:"explorer-",role:"explorer"},{prefix:"explore-",role:"explorer"},{prefix:"translator-",role:"translator"},{prefix:"svg-creator-",role:"designer"}],Cpe=[{suffix:"-reviewer",role:"reviewer"},{suffix:"-analyst",role:"analyst"},{suffix:"-tracer",role:"tracer"},{suffix:"-investigator",role:"investigator"},{suffix:"-builder",role:"builder"},{suffix:"-impl",role:"implementer"},{suffix:"-auditor",role:"auditor"},{suffix:"-scanner",role:"scanner"},{suffix:"-expert",role:"expert"},{suffix:"-executor",role:"executor"}],Tpe=[{keyword:"security",role:"security"},{keyword:"implementer",role:"implementer"},{keyword:"review",role:"reviewer"},{keyword:"explor",role:"explorer"},{keyword:"research",role:"researcher"},{keyword:"analy",role:"analyst"},{keyword:"trac",role:"tracer"},{keyword:"investigat",role:"investigator"},{keyword:"build",role:"builder"},{keyword:"audit",role:"auditor"},{keyword:"translat",role:"translator"},{keyword:"scan",role:"scanner"},{keyword:"expert",role:"expert"},{keyword:"execut",role:"executor"},{keyword:"design",role:"designer"},{keyword:"work",role:"worker"}],kpe=[{prefix:"cr-",role:"reviewer"},{prefix:"r-",role:"reviewer"},{prefix:"ui-",role:"reviewer"},{prefix:"ux-",role:"reviewer"}],dm=Object.keys(aM).filter(t=>t!=="default");function Rpe(t){const e=t.toLowerCase();for(const{prefix:n,role:i}of Ppe)if(e.startsWith(n))return i;for(const{suffix:n,role:i}of Cpe)if(e.endsWith(n))return i;for(const{keyword:n,role:i}of Tpe)if(e.includes(n))return i;for(const{prefix:n,role:i}of kpe)if(e.startsWith(n))return i;if(e.length>0){let n=0;for(let i=0;i<e.length;i++)n=e.charCodeAt(i)+((n<<5)-n);return dm[(n%dm.length+dm.length)%dm.length]}return"default"}const yg=["#5b6abf","#2a9d8f","#6366f1","#d97706","#3b82f6","#8b5cf6","#0e7490","#ea580c","#059669","#e11d48","#0284c7","#dc2626","#65a30d","#ca8a04","#9333ea","#db2777","#6b7280","#1d4ed8","#b45309","#047857"];function Epe(t){let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+((e<<5)-e);return(e%yg.length+yg.length)%yg.length}function Bu(t){let e=(t||"").trim();e=e.replace(/^Teammate:\s*/i,""),e=e.replace(/\([^)]*\)\s*$/,"").trim();const n=Rpe(e),i=aM[n],r=yg[Epe(e)];return{svg:i.svg,color:r,role:n}}const Xpe=["system-reminder","local-command-caveat","project-reminder","important-instruction-reminders","file-modified-reminder","todo-reminder","user-prompt-submit-hook","local-command-stdout","command-name","task-notification","environment_details","context"];function zpe(t){if(!t)return{segments:[]};const e=new RegExp("<("+Xpe.join("|")+")\\b[^>]*>([\\s\\S]*?)</\\1>","gi"),n=[];let i=0,r;for(;(r=e.exec(t))!==null;){if(r.index>i){const s=t.slice(i,r.index).trim();s&&n.push({type:"text",content:s})}n.push({type:"system-tag",tag:r[1],content:r[2].trim()}),i=r.index+r[0].length}if(i<t.length){const s=t.slice(i).trim();s&&n.push({type:"text",content:s})}return{segments:n}}function Ipe(t){const{segments:e}=zpe(t);return e.length===0?{segments:[]}:{segments:e}}const Ape="_avatar_1v5re_3",Mpe="_avatarImg_1v5re_13",jpe="_messageRow_1v5re_34",Npe="_messageRowEnd_1v5re_40",Wpe="_contentCol_1v5re_49",Lpe="_contentColLimited_1v5re_53",Vpe="_labelRow_1v5re_61",Bpe="_labelRowEnd_1v5re_68",Ype="_labelRight_1v5re_75",Dpe="_labelText_1v5re_83",Upe="_timeText_1v5re_87",qpe="_timeTextNoMargin_1v5re_93",Zpe="_labelTextRight_1v5re_99",Gpe="_bubbleUser_1v5re_106 _bubble_1v5re_21",Fpe="_bubbleAssistant_1v5re_118 _bubble_1v5re_21",Hpe="_bubbleHighlight_1v5re_134",Kpe="_bubbleHighlightFading_1v5re_138",Jpe="_borderSvg_1v5re_143",eme="_borderSvgInset_1v5re_152",tme="_borderSvgFading_1v5re_156",nme="_borderRect_1v5re_161",ime="_bubblePlan_1v5re_170 _bubble_1v5re_21",rme="_bubbleSubAgent_1v5re_178 _bubble_1v5re_21",sme="_systemTagLabel_1v5re_198",ome="_skillLabel_1v5re_202",ame="_systemTagPre_1v5re_207",lme="_collapseMargin_1v5re_215",cme="_collapseNoMargin_1v5re_219",dme="_thinkingLabel_1v5re_225",ume="_thinkingEmptyHint_1v5re_229",hme="_thinkingEmptyText_1v5re_237",Ome="_enableThinkingBtn_1v5re_242",fme="_bashCollapseLabel_1v5re_247",pme="_toolBox_1v5re_254",mme="_toolLabel_1v5re_267",gme="_simplifiedToolLabel_1v5re_271",vme="_simplifiedToolTag_1v5re_280",$me="_simplifiedToolPopoverContent_1v5re_298",bme="_codePre_1v5re_310",Sme="_pathTag_1v5re_340",yme="_pathTagClickable_1v5re_345",_me="_descSpan_1v5re_358",Qme="_secondarySpan_1v5re_363",xme="_patternSpan_1v5re_367",wme="_kvContainer_1v5re_373",Pme="_kvItem_1v5re_378",Cme="_kvKey_1v5re_382",Tme="_kvValue_1v5re_386",kme="_compactLabel_1v5re_407",Rme="_compactPre_1v5re_412",Eme="_viewRequestBtn_1v5re_422",Xme="_optionList_1v5re_436",zme="_optionDesc_1v5re_440",Ime="_questionSpacing_1v5re_454",Ame="_askQuestionBox_1v5re_467",Mme="_askQuestionHeader_1v5re_476",jme="_askQuestionText_1v5re_487",Nme="_askOptionItem_1v5re_493",Wme="_askOptionSelected_1v5re_502",Lme="_askCheckSvg_1v5re_511",Vme="_planModeBox_1v5re_518",Bme="_planStatusPending_1v5re_528",Yme="_planModeLabel_1v5re_533",Dme="_planModePermissions_1v5re_538",Ume="_planModePermLabel_1v5re_544",qme="_planModeHeader_1v5re_550",Zme="_planStatusBadge_1v5re_556",Gme="_planStatusApproved_1v5re_564",Fme="_planStatusRejected_1v5re_573",Hme="_planContentPreview_1v5re_591",Kme="_planFeedback_1v5re_603",Jme="_planFeedbackLabel_1v5re_612",ege="_planApprovalActions_1v5re_617",tge="_planApproveBtn_1v5re_624",nge="_planRejectBtn_1v5re_639",ige="_planOptionBtn_1v5re_654",rge="_dangerApprovalBox_1v5re_669",sge="_dangerApprovalBoxDenied_1v5re_678",oge="_ultraplanBadge_1v5re_682",age="_dangerApprovalHeader_1v5re_688",lge="_dangerApprovalIcon_1v5re_694",cge="_dangerApprovalLabel_1v5re_699",dge="_dangerApprovalActions_1v5re_704",uge="_dangerApproveBtn_1v5re_711",hge="_dangerRejectBtn_1v5re_726",Oge="_dangerOptionBtn_1v5re_741",fge="_dangerDeniedBadge_1v5re_756",pge="_dangerDeniedDetail_1v5re_767",mge="_planFeedbackInputWrap_1v5re_777",gge="_planFeedbackTextarea_1v5re_781",vge="_planFeedbackBtnRow_1v5re_801",$ge="_planFeedbackSendBtn_1v5re_808",bge="_planFeedbackCancelBtn_1v5re_828",Sge="_askQuestionInteractive_1v5re_845",yge="_askRadioGroup_1v5re_860",_ge="_askRadioItem_1v5re_868",Qge="_askRadioItemSelected_1v5re_883",xge="_askRadioDot_1v5re_887",wge="_askCheckboxGroup_1v5re_894",Pge="_askOtherInput_1v5re_920",Cge="_askSubmitRow_1v5re_933",Tge="_askSubmitBtn_1v5re_939",kge="_askMarkdownLayout_1v5re_959",Rge="_askMarkdownPreview_1v5re_970",Ege="_chatImageFallback_1v5re_994",Xge="_chatImageImg_1v5re_999",zge="_bubbleRelative_1v5re_1010",Ige="_skillSpacer_1v5re_1016",Age="_skillTimeIndent_1v5re_1023",Mge="_previewPlaceholder_1v5re_1027",$e={avatar:Ape,avatarImg:Mpe,messageRow:jpe,messageRowEnd:Npe,contentCol:Wpe,contentColLimited:Lpe,labelRow:Vpe,labelRowEnd:Bpe,labelRight:Ype,labelText:Dpe,timeText:Upe,timeTextNoMargin:qpe,labelTextRight:Zpe,bubbleUser:Gpe,bubbleAssistant:Fpe,bubbleHighlight:Hpe,bubbleHighlightFading:Kpe,borderSvg:Jpe,borderSvgInset:eme,borderSvgFading:tme,borderRect:nme,bubblePlan:ime,bubbleSubAgent:rme,systemTagLabel:sme,skillLabel:ome,systemTagPre:ame,collapseMargin:lme,collapseNoMargin:cme,thinkingLabel:dme,thinkingEmptyHint:ume,thinkingEmptyText:hme,enableThinkingBtn:Ome,bashCollapseLabel:fme,toolBox:pme,toolLabel:mme,simplifiedToolLabel:gme,simplifiedToolTag:vme,simplifiedToolPopoverContent:$me,codePre:bme,pathTag:Sme,pathTagClickable:yme,descSpan:_me,secondarySpan:Qme,patternSpan:xme,kvContainer:wme,kvItem:Pme,kvKey:Cme,kvValue:Tme,compactLabel:kme,compactPre:Rme,viewRequestBtn:Eme,optionList:Xme,optionDesc:zme,questionSpacing:Ime,askQuestionBox:Ame,askQuestionHeader:Mme,askQuestionText:jme,askOptionItem:Nme,askOptionSelected:Wme,askCheckSvg:Lme,planModeBox:Vme,planStatusPending:Bme,planModeLabel:Yme,planModePermissions:Dme,planModePermLabel:Ume,planModeHeader:qme,planStatusBadge:Zme,planStatusApproved:Gme,planStatusRejected:Fme,planContentPreview:Hme,planFeedback:Kme,planFeedbackLabel:Jme,planApprovalActions:ege,planApproveBtn:tge,planRejectBtn:nge,planOptionBtn:ige,dangerApprovalBox:rge,dangerApprovalBoxDenied:sge,ultraplanBadge:oge,dangerApprovalHeader:age,dangerApprovalIcon:lge,dangerApprovalLabel:cge,dangerApprovalActions:dge,dangerApproveBtn:uge,dangerRejectBtn:hge,dangerOptionBtn:Oge,dangerDeniedBadge:fge,dangerDeniedDetail:pge,planFeedbackInputWrap:mge,planFeedbackTextarea:gge,planFeedbackBtnRow:vge,planFeedbackSendBtn:$ge,planFeedbackCancelBtn:bge,askQuestionInteractive:Sge,askRadioGroup:yge,askRadioItem:_ge,askRadioItemSelected:Qge,askRadioDot:xge,askCheckboxGroup:wge,askOtherInput:Pge,askSubmitRow:Cge,askSubmitBtn:Tge,askMarkdownLayout:kge,askMarkdownPreview:Rge,chatImageFallback:Ege,chatImageImg:Xge,bubbleRelative:zge,skillSpacer:Ige,skillTimeIndent:Age,previewPlaceholder:Mge};class jge extends Z.Component{constructor(e){super(e),this.state={selections:{},multiSelections:{},otherActive:{},otherText:{},submitting:!1}}componentWillUnmount(){this._submitTimeout&&clearTimeout(this._submitTimeout)}render(){const{questions:e,onSubmit:n}=this.props,i=Array.isArray(e)?e:[],{selections:r,multiSelections:s,otherActive:o,otherText:a,submitting:l}=this.state,c=i.every((u,h)=>{if(o[h])return(a[h]||"").trim().length>0;if(u.multiSelect){const O=s[h];return O&&O.size>0}return r[h]!=null}),d=()=>{if(!c||l)return;this.setState({submitting:!0}),this._submitTimeout&&clearTimeout(this._submitTimeout),this._submitTimeout=setTimeout(()=>{this.setState({submitting:!1})},3e4);const u=i.map((h,O)=>{if(o[O]){const g=(h.options||[]).length;return{questionIndex:O,type:"other",optionIndex:g,text:(a[O]||"").trim(),isMultiSelect:!!h.multiSelect}}if(h.multiSelect){const g=s[O]||new Set,v=[];return(h.options||[]).forEach(($,b)=>{g.has($.label)&&v.push(b)}),{questionIndex:O,type:"multi",selectedIndices:v}}const p=r[O],m=(h.options||[]).findIndex(g=>g.label===p);return{questionIndex:O,type:"single",optionIndex:m}});n&&n(u)};return w.jsxs("div",{className:$e.askQuestionInteractive,children:[w.jsx("svg",{className:`${$e.borderSvg} ${$e.borderSvgInset}`,preserveAspectRatio:"none",children:w.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",rx:"6",ry:"6",fill:"none",stroke:"#1668dc",strokeWidth:"1",strokeDasharray:"6 4",className:$e.borderRect})}),i.map((u,h)=>{var $;const O=u.multiSelect,p=!O&&(($=u.options)==null?void 0:$.some(b=>b.preview)),m=r[h],g=p&&m?(u.options.find(b=>b.label===m)||{}).preview:null,v=w.jsxs("div",{children:[u.header&&w.jsx("span",{className:$e.askQuestionHeader,children:u.header}),w.jsx("div",{className:$e.askQuestionText,children:u.question}),O?w.jsxs("div",{className:$e.askCheckboxGroup,children:[(u.options||[]).map((b,S)=>{const y=!!(s[h]&&s[h].has(b.label));return w.jsxs("div",{className:`${$e.askRadioItem}${y?" "+$e.askRadioItemSelected:""}`,onClick:()=>{this.setState(Q=>{const _=Q.multiSelections[h]||new Set,P=new Set(_);return P.has(b.label)?P.delete(b.label):P.add(b.label),{multiSelections:{...Q.multiSelections,[h]:P},otherActive:{...Q.otherActive,[h]:!1}}})},children:[w.jsx("span",{className:$e.askRadioDot,children:y?"☑":"☐"}),b.label,b.description&&w.jsxs("span",{className:$e.optionDesc,children:["— ",b.description]})]},S)}),!(u.options||[]).some(b=>/^other$/i.test(b.label))&&w.jsxs("div",{className:`${$e.askRadioItem}${o[h]?" "+$e.askRadioItemSelected:""}`,onClick:()=>{this.setState(b=>({otherActive:{...b.otherActive,[h]:!0},multiSelections:{...b.multiSelections,[h]:new Set}}))},children:[w.jsx("span",{className:$e.askRadioDot,children:o[h]?"☑":"☐"}),le("ui.askOther")]})]}):w.jsxs("div",{className:$e.askRadioGroup,children:[(u.options||[]).map((b,S)=>{const y=/^other$/i.test(b.label),Q=y?o[h]:!o[h]&&m===b.label;return w.jsxs("div",{className:`${$e.askRadioItem}${Q?" "+$e.askRadioItemSelected:""}`,onClick:()=>{y?this.setState(_=>({otherActive:{..._.otherActive,[h]:!0},selections:{..._.selections,[h]:void 0}})):this.setState(_=>({selections:{..._.selections,[h]:b.label},otherActive:{..._.otherActive,[h]:!1}}))},children:[w.jsx("span",{className:$e.askRadioDot,children:Q?"◉":"○"}),b.label,b.description&&w.jsxs("span",{className:$e.optionDesc,children:["— ",b.description]})]},S)}),!(u.options||[]).some(b=>/^other$/i.test(b.label))&&w.jsxs("div",{className:`${$e.askRadioItem}${o[h]?" "+$e.askRadioItemSelected:""}`,onClick:()=>{this.setState(b=>({otherActive:{...b.otherActive,[h]:!0},selections:{...b.selections,[h]:void 0}}))},children:[w.jsx("span",{className:$e.askRadioDot,children:o[h]?"◉":"○"}),le("ui.askOther")]})]}),o[h]&&w.jsx("div",{className:$e.askOtherInput,children:w.jsx(Ko,{size:"small",placeholder:le("ui.askOtherPlaceholder"),value:a[h]||"",onChange:b=>this.setState(S=>({otherText:{...S.otherText,[h]:b.target.value}})),onPressEnter:()=>{c&&!l&&d()},autoFocus:!0})})]});return w.jsx("div",{className:h<i.length-1?$e.questionSpacing:void 0,children:p?w.jsxs("div",{className:$e.askMarkdownLayout,children:[v,w.jsx("div",{className:$e.askMarkdownPreview,children:g?w.jsx("pre",{children:g}):w.jsx("span",{className:$e.previewPlaceholder,children:"—"})})]}):v},h)}),w.jsx("div",{className:$e.askSubmitRow,children:w.jsx("button",{className:$e.askSubmitBtn,disabled:!c||l,onClick:d,children:le(l?"ui.askSubmitting":"ui.askSubmit")})})]})}}function jO(t){if(!t||!t.question)return!1;const e=t.question.toLowerCase();return/plan/i.test(e)&&(/approv/i.test(e)||/proceed/i.test(e)||/accept/i.test(e))}function rS(t){if(!t||!t.question)return!1;const e=t.question;if(jO(t))return!1;if(/do you want to (make this edit|write|proceed|create|delete)|allow\b.*\bto\b|want to allow|wants to (execute|run|read|write|access|create|delete|modify|use)|may .*(read|write|execute|run|access|create|delete|modify)|grant .*(access|permission)|permit/i.test(e))return!0;if(t.options&&t.options.length>=2){const n=t.options.map(s=>(s.text||"").toLowerCase()),i=n.some(s=>/^allow|^yes/i.test(s)),r=n.some(s=>/^no$|^no[^a-z]|^deny|^reject/i.test(s));if(i&&r)return!0}return!1}class Nge{diff(e,n,i={}){let r;typeof i=="function"?(r=i,i={}):"callback"in i&&(r=i.callback);const s=this.castInput(e,i),o=this.castInput(n,i),a=this.removeEmpty(this.tokenize(s,i)),l=this.removeEmpty(this.tokenize(o,i));return this.diffWithOptionsObj(a,l,i,r)}diffWithOptionsObj(e,n,i,r){var s;const o=$=>{if($=this.postProcess($,i),r){setTimeout(function(){r($)},0);return}else return $},a=n.length,l=e.length;let c=1,d=a+l;i.maxEditLength!=null&&(d=Math.min(d,i.maxEditLength));const u=(s=i.timeout)!==null&&s!==void 0?s:1/0,h=Date.now()+u,O=[{oldPos:-1,lastComponent:void 0}];let p=this.extractCommon(O[0],n,e,0,i);if(O[0].oldPos+1>=l&&p+1>=a)return o(this.buildValues(O[0].lastComponent,n,e));let m=-1/0,g=1/0;const v=()=>{for(let $=Math.max(m,-c);$<=Math.min(g,c);$+=2){let b;const S=O[$-1],y=O[$+1];S&&(O[$-1]=void 0);let Q=!1;if(y){const P=y.oldPos-$;Q=y&&0<=P&&P<a}const _=S&&S.oldPos+1<l;if(!Q&&!_){O[$]=void 0;continue}if(!_||Q&&S.oldPos<y.oldPos?b=this.addToPath(y,!0,!1,0,i):b=this.addToPath(S,!1,!0,1,i),p=this.extractCommon(b,n,e,$,i),b.oldPos+1>=l&&p+1>=a)return o(this.buildValues(b.lastComponent,n,e))||!0;O[$]=b,b.oldPos+1>=l&&(g=Math.min(g,$-1)),p+1>=a&&(m=Math.max(m,$+1))}c++};if(r)(function $(){setTimeout(function(){if(c>d||Date.now()>h)return r(void 0);v()||$()},0)})();else for(;c<=d&&Date.now()<=h;){const $=v();if($)return $}}addToPath(e,n,i,r,s){const o=e.lastComponent;return o&&!s.oneChangePerToken&&o.added===n&&o.removed===i?{oldPos:e.oldPos+r,lastComponent:{count:o.count+1,added:n,removed:i,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:n,removed:i,previousComponent:o}}}extractCommon(e,n,i,r,s){const o=n.length,a=i.length;let l=e.oldPos,c=l-r,d=0;for(;c+1<o&&l+1<a&&this.equals(i[l+1],n[c+1],s);)c++,l++,d++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(e.lastComponent={count:d,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,n,i){return i.comparator?i.comparator(e,n):e===n||!!i.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let i=0;i<e.length;i++)e[i]&&n.push(e[i]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,i){const r=[];let s;for(;e;)r.push(e),s=e.previousComponent,delete e.previousComponent,e=s;r.reverse();const o=r.length;let a=0,l=0,c=0;for(;a<o;a++){const d=r[a];if(d.removed)d.value=this.join(i.slice(c,c+d.count)),c+=d.count;else{if(!d.added&&this.useLongestToken){let u=n.slice(l,l+d.count);u=u.map(function(h,O){const p=i[c+O];return p.length>h.length?p:h}),d.value=this.join(u)}else d.value=this.join(n.slice(l,l+d.count));l+=d.count,d.added||(c+=d.count)}}return r}}class Wge extends Nge{constructor(){super(...arguments),this.tokenize=Vge}equals(e,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!e.includes(`
881
+ `,aM={worker:{svg:wpe},reviewer:{svg:Spe},researcher:{svg:bpe},explorer:{svg:gpe},analyst:{svg:dpe},tracer:{svg:Qpe},investigator:{svg:$pe},builder:{svg:hpe},implementer:{svg:vpe},auditor:{svg:upe},translator:{svg:xpe},security:{svg:_pe},scanner:{svg:ype},expert:{svg:mpe},executor:{svg:ppe},designer:{svg:fpe},default:{svg:Ope}},Ppe=[{prefix:"worker-",role:"worker"},{prefix:"reviewer-",role:"reviewer"},{prefix:"researcher-",role:"researcher"},{prefix:"explorer-",role:"explorer"},{prefix:"explore-",role:"explorer"},{prefix:"translator-",role:"translator"},{prefix:"svg-creator-",role:"designer"}],Cpe=[{suffix:"-reviewer",role:"reviewer"},{suffix:"-analyst",role:"analyst"},{suffix:"-tracer",role:"tracer"},{suffix:"-investigator",role:"investigator"},{suffix:"-builder",role:"builder"},{suffix:"-impl",role:"implementer"},{suffix:"-auditor",role:"auditor"},{suffix:"-scanner",role:"scanner"},{suffix:"-expert",role:"expert"},{suffix:"-executor",role:"executor"}],Tpe=[{keyword:"security",role:"security"},{keyword:"implementer",role:"implementer"},{keyword:"review",role:"reviewer"},{keyword:"explor",role:"explorer"},{keyword:"research",role:"researcher"},{keyword:"analy",role:"analyst"},{keyword:"trac",role:"tracer"},{keyword:"investigat",role:"investigator"},{keyword:"build",role:"builder"},{keyword:"audit",role:"auditor"},{keyword:"translat",role:"translator"},{keyword:"scan",role:"scanner"},{keyword:"expert",role:"expert"},{keyword:"execut",role:"executor"},{keyword:"design",role:"designer"},{keyword:"work",role:"worker"}],kpe=[{prefix:"cr-",role:"reviewer"},{prefix:"r-",role:"reviewer"},{prefix:"ui-",role:"reviewer"},{prefix:"ux-",role:"reviewer"}],dm=Object.keys(aM).filter(t=>t!=="default");function Rpe(t){const e=t.toLowerCase();for(const{prefix:n,role:i}of Ppe)if(e.startsWith(n))return i;for(const{suffix:n,role:i}of Cpe)if(e.endsWith(n))return i;for(const{keyword:n,role:i}of Tpe)if(e.includes(n))return i;for(const{prefix:n,role:i}of kpe)if(e.startsWith(n))return i;if(e.length>0){let n=0;for(let i=0;i<e.length;i++)n=e.charCodeAt(i)+((n<<5)-n);return dm[(n%dm.length+dm.length)%dm.length]}return"default"}const yg=["#5b6abf","#2a9d8f","#6366f1","#d97706","#3b82f6","#8b5cf6","#0e7490","#ea580c","#059669","#e11d48","#0284c7","#dc2626","#65a30d","#ca8a04","#9333ea","#db2777","#6b7280","#1d4ed8","#b45309","#047857"];function Epe(t){let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+((e<<5)-e);return(e%yg.length+yg.length)%yg.length}function Bu(t){let e=(t||"").trim();e=e.replace(/^Teammate:\s*/i,""),e=e.replace(/\([^)]*\)\s*$/,"").trim();const n=Rpe(e),i=aM[n],r=yg[Epe(e)];return{svg:i.svg,color:r,role:n}}const Xpe=["system-reminder","local-command-caveat","project-reminder","important-instruction-reminders","file-modified-reminder","todo-reminder","user-prompt-submit-hook","local-command-stdout","command-name","task-notification","environment_details","context"];function zpe(t){if(!t)return{segments:[]};const e=new RegExp("<("+Xpe.join("|")+")\\b[^>]*>([\\s\\S]*?)</\\1>","gi"),n=[];let i=0,r;for(;(r=e.exec(t))!==null;){if(r.index>i){const s=t.slice(i,r.index).trim();s&&n.push({type:"text",content:s})}n.push({type:"system-tag",tag:r[1],content:r[2].trim()}),i=r.index+r[0].length}if(i<t.length){const s=t.slice(i).trim();s&&n.push({type:"text",content:s})}return{segments:n}}function Ipe(t){const{segments:e}=zpe(t);return e.length===0?{segments:[]}:{segments:e}}const Ape="_avatar_fphu7_3",Mpe="_avatarImg_fphu7_13",jpe="_messageRow_fphu7_34",Npe="_messageRowEnd_fphu7_40",Wpe="_contentCol_fphu7_49",Lpe="_contentColLimited_fphu7_53",Vpe="_labelRow_fphu7_61",Bpe="_labelRowEnd_fphu7_68",Ype="_labelRight_fphu7_75",Dpe="_labelText_fphu7_83",Upe="_timeText_fphu7_87",qpe="_timeTextNoMargin_fphu7_93",Zpe="_labelTextRight_fphu7_99",Gpe="_bubbleUser_fphu7_106 _bubble_fphu7_21",Fpe="_bubbleAssistant_fphu7_118 _bubble_fphu7_21",Hpe="_bubbleHighlight_fphu7_134",Kpe="_bubbleHighlightFading_fphu7_138",Jpe="_borderSvg_fphu7_143",eme="_borderSvgInset_fphu7_152",tme="_borderSvgFading_fphu7_156",nme="_borderRect_fphu7_161",ime="_bubblePlan_fphu7_170 _bubble_fphu7_21",rme="_bubbleSubAgent_fphu7_178 _bubble_fphu7_21",sme="_systemTagLabel_fphu7_198",ome="_skillLabel_fphu7_202",ame="_systemTagPre_fphu7_207",lme="_collapseMargin_fphu7_215",cme="_collapseNoMargin_fphu7_219",dme="_thinkingLabel_fphu7_225",ume="_thinkingEmptyHint_fphu7_229",hme="_thinkingEmptyText_fphu7_237",Ome="_enableThinkingBtn_fphu7_242",fme="_bashCollapseLabel_fphu7_247",pme="_toolBox_fphu7_254",mme="_toolLabel_fphu7_267",gme="_simplifiedToolLabel_fphu7_271",vme="_simplifiedToolTag_fphu7_280",$me="_simplifiedToolPopoverContent_fphu7_298",bme="_codePre_fphu7_310",Sme="_pathTag_fphu7_341",yme="_pathTagClickable_fphu7_346",_me="_descSpan_fphu7_359",Qme="_secondarySpan_fphu7_364",xme="_patternSpan_fphu7_368",wme="_kvContainer_fphu7_374",Pme="_kvItem_fphu7_379",Cme="_kvKey_fphu7_383",Tme="_kvValue_fphu7_387",kme="_compactLabel_fphu7_408",Rme="_compactPre_fphu7_413",Eme="_viewRequestBtn_fphu7_423",Xme="_optionList_fphu7_437",zme="_optionDesc_fphu7_441",Ime="_questionSpacing_fphu7_455",Ame="_askQuestionBox_fphu7_468",Mme="_askQuestionHeader_fphu7_477",jme="_askQuestionText_fphu7_488",Nme="_askOptionItem_fphu7_494",Wme="_askOptionSelected_fphu7_503",Lme="_askCheckSvg_fphu7_512",Vme="_planModeBox_fphu7_519",Bme="_planStatusPending_fphu7_529",Yme="_planModeLabel_fphu7_534",Dme="_planModePermissions_fphu7_539",Ume="_planModePermLabel_fphu7_545",qme="_planModeHeader_fphu7_551",Zme="_planStatusBadge_fphu7_557",Gme="_planStatusApproved_fphu7_565",Fme="_planStatusRejected_fphu7_574",Hme="_planContentPreview_fphu7_592",Kme="_planFeedback_fphu7_604",Jme="_planFeedbackLabel_fphu7_613",ege="_planApprovalActions_fphu7_618",tge="_planApproveBtn_fphu7_625",nge="_planRejectBtn_fphu7_640",ige="_planOptionBtn_fphu7_655",rge="_dangerApprovalBox_fphu7_670",sge="_dangerApprovalBoxDenied_fphu7_679",oge="_ultraplanBadge_fphu7_683",age="_dangerApprovalHeader_fphu7_689",lge="_dangerApprovalIcon_fphu7_695",cge="_dangerApprovalLabel_fphu7_700",dge="_dangerApprovalActions_fphu7_705",uge="_dangerApproveBtn_fphu7_712",hge="_dangerRejectBtn_fphu7_727",Oge="_dangerOptionBtn_fphu7_742",fge="_dangerDeniedBadge_fphu7_757",pge="_dangerDeniedDetail_fphu7_768",mge="_planFeedbackInputWrap_fphu7_778",gge="_planFeedbackTextarea_fphu7_782",vge="_planFeedbackBtnRow_fphu7_802",$ge="_planFeedbackSendBtn_fphu7_809",bge="_planFeedbackCancelBtn_fphu7_829",Sge="_askQuestionInteractive_fphu7_846",yge="_askRadioGroup_fphu7_861",_ge="_askRadioItem_fphu7_869",Qge="_askRadioItemSelected_fphu7_884",xge="_askRadioDot_fphu7_888",wge="_askCheckboxGroup_fphu7_895",Pge="_askOtherInput_fphu7_921",Cge="_askSubmitRow_fphu7_934",Tge="_askSubmitBtn_fphu7_940",kge="_askMarkdownLayout_fphu7_960",Rge="_askMarkdownPreview_fphu7_971",Ege="_chatImageFallback_fphu7_995",Xge="_chatImageImg_fphu7_1000",zge="_bubbleRelative_fphu7_1011",Ige="_skillSpacer_fphu7_1017",Age="_skillTimeIndent_fphu7_1024",Mge="_previewPlaceholder_fphu7_1028",$e={avatar:Ape,avatarImg:Mpe,messageRow:jpe,messageRowEnd:Npe,contentCol:Wpe,contentColLimited:Lpe,labelRow:Vpe,labelRowEnd:Bpe,labelRight:Ype,labelText:Dpe,timeText:Upe,timeTextNoMargin:qpe,labelTextRight:Zpe,bubbleUser:Gpe,bubbleAssistant:Fpe,bubbleHighlight:Hpe,bubbleHighlightFading:Kpe,borderSvg:Jpe,borderSvgInset:eme,borderSvgFading:tme,borderRect:nme,bubblePlan:ime,bubbleSubAgent:rme,systemTagLabel:sme,skillLabel:ome,systemTagPre:ame,collapseMargin:lme,collapseNoMargin:cme,thinkingLabel:dme,thinkingEmptyHint:ume,thinkingEmptyText:hme,enableThinkingBtn:Ome,bashCollapseLabel:fme,toolBox:pme,toolLabel:mme,simplifiedToolLabel:gme,simplifiedToolTag:vme,simplifiedToolPopoverContent:$me,codePre:bme,pathTag:Sme,pathTagClickable:yme,descSpan:_me,secondarySpan:Qme,patternSpan:xme,kvContainer:wme,kvItem:Pme,kvKey:Cme,kvValue:Tme,compactLabel:kme,compactPre:Rme,viewRequestBtn:Eme,optionList:Xme,optionDesc:zme,questionSpacing:Ime,askQuestionBox:Ame,askQuestionHeader:Mme,askQuestionText:jme,askOptionItem:Nme,askOptionSelected:Wme,askCheckSvg:Lme,planModeBox:Vme,planStatusPending:Bme,planModeLabel:Yme,planModePermissions:Dme,planModePermLabel:Ume,planModeHeader:qme,planStatusBadge:Zme,planStatusApproved:Gme,planStatusRejected:Fme,planContentPreview:Hme,planFeedback:Kme,planFeedbackLabel:Jme,planApprovalActions:ege,planApproveBtn:tge,planRejectBtn:nge,planOptionBtn:ige,dangerApprovalBox:rge,dangerApprovalBoxDenied:sge,ultraplanBadge:oge,dangerApprovalHeader:age,dangerApprovalIcon:lge,dangerApprovalLabel:cge,dangerApprovalActions:dge,dangerApproveBtn:uge,dangerRejectBtn:hge,dangerOptionBtn:Oge,dangerDeniedBadge:fge,dangerDeniedDetail:pge,planFeedbackInputWrap:mge,planFeedbackTextarea:gge,planFeedbackBtnRow:vge,planFeedbackSendBtn:$ge,planFeedbackCancelBtn:bge,askQuestionInteractive:Sge,askRadioGroup:yge,askRadioItem:_ge,askRadioItemSelected:Qge,askRadioDot:xge,askCheckboxGroup:wge,askOtherInput:Pge,askSubmitRow:Cge,askSubmitBtn:Tge,askMarkdownLayout:kge,askMarkdownPreview:Rge,chatImageFallback:Ege,chatImageImg:Xge,bubbleRelative:zge,skillSpacer:Ige,skillTimeIndent:Age,previewPlaceholder:Mge};class jge extends Z.Component{constructor(e){super(e),this.state={selections:{},multiSelections:{},otherActive:{},otherText:{},submitting:!1}}componentWillUnmount(){this._submitTimeout&&clearTimeout(this._submitTimeout)}render(){const{questions:e,onSubmit:n}=this.props,i=Array.isArray(e)?e:[],{selections:r,multiSelections:s,otherActive:o,otherText:a,submitting:l}=this.state,c=i.every((u,h)=>{if(o[h])return(a[h]||"").trim().length>0;if(u.multiSelect){const O=s[h];return O&&O.size>0}return r[h]!=null}),d=()=>{if(!c||l)return;this.setState({submitting:!0}),this._submitTimeout&&clearTimeout(this._submitTimeout),this._submitTimeout=setTimeout(()=>{this.setState({submitting:!1})},3e4);const u=i.map((h,O)=>{if(o[O]){const g=(h.options||[]).length;return{questionIndex:O,type:"other",optionIndex:g,text:(a[O]||"").trim(),isMultiSelect:!!h.multiSelect}}if(h.multiSelect){const g=s[O]||new Set,v=[];return(h.options||[]).forEach(($,b)=>{g.has($.label)&&v.push(b)}),{questionIndex:O,type:"multi",selectedIndices:v}}const p=r[O],m=(h.options||[]).findIndex(g=>g.label===p);return{questionIndex:O,type:"single",optionIndex:m}});n&&n(u)};return w.jsxs("div",{className:$e.askQuestionInteractive,children:[w.jsx("svg",{className:`${$e.borderSvg} ${$e.borderSvgInset}`,preserveAspectRatio:"none",children:w.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",rx:"6",ry:"6",fill:"none",stroke:"#1668dc",strokeWidth:"1",strokeDasharray:"6 4",className:$e.borderRect})}),i.map((u,h)=>{var $;const O=u.multiSelect,p=!O&&(($=u.options)==null?void 0:$.some(b=>b.preview)),m=r[h],g=p&&m?(u.options.find(b=>b.label===m)||{}).preview:null,v=w.jsxs("div",{children:[u.header&&w.jsx("span",{className:$e.askQuestionHeader,children:u.header}),w.jsx("div",{className:$e.askQuestionText,children:u.question}),O?w.jsxs("div",{className:$e.askCheckboxGroup,children:[(u.options||[]).map((b,S)=>{const y=!!(s[h]&&s[h].has(b.label));return w.jsxs("div",{className:`${$e.askRadioItem}${y?" "+$e.askRadioItemSelected:""}`,onClick:()=>{this.setState(Q=>{const _=Q.multiSelections[h]||new Set,P=new Set(_);return P.has(b.label)?P.delete(b.label):P.add(b.label),{multiSelections:{...Q.multiSelections,[h]:P},otherActive:{...Q.otherActive,[h]:!1}}})},children:[w.jsx("span",{className:$e.askRadioDot,children:y?"☑":"☐"}),b.label,b.description&&w.jsxs("span",{className:$e.optionDesc,children:["— ",b.description]})]},S)}),!(u.options||[]).some(b=>/^other$/i.test(b.label))&&w.jsxs("div",{className:`${$e.askRadioItem}${o[h]?" "+$e.askRadioItemSelected:""}`,onClick:()=>{this.setState(b=>({otherActive:{...b.otherActive,[h]:!0},multiSelections:{...b.multiSelections,[h]:new Set}}))},children:[w.jsx("span",{className:$e.askRadioDot,children:o[h]?"☑":"☐"}),le("ui.askOther")]})]}):w.jsxs("div",{className:$e.askRadioGroup,children:[(u.options||[]).map((b,S)=>{const y=/^other$/i.test(b.label),Q=y?o[h]:!o[h]&&m===b.label;return w.jsxs("div",{className:`${$e.askRadioItem}${Q?" "+$e.askRadioItemSelected:""}`,onClick:()=>{y?this.setState(_=>({otherActive:{..._.otherActive,[h]:!0},selections:{..._.selections,[h]:void 0}})):this.setState(_=>({selections:{..._.selections,[h]:b.label},otherActive:{..._.otherActive,[h]:!1}}))},children:[w.jsx("span",{className:$e.askRadioDot,children:Q?"◉":"○"}),b.label,b.description&&w.jsxs("span",{className:$e.optionDesc,children:["— ",b.description]})]},S)}),!(u.options||[]).some(b=>/^other$/i.test(b.label))&&w.jsxs("div",{className:`${$e.askRadioItem}${o[h]?" "+$e.askRadioItemSelected:""}`,onClick:()=>{this.setState(b=>({otherActive:{...b.otherActive,[h]:!0},selections:{...b.selections,[h]:void 0}}))},children:[w.jsx("span",{className:$e.askRadioDot,children:o[h]?"◉":"○"}),le("ui.askOther")]})]}),o[h]&&w.jsx("div",{className:$e.askOtherInput,children:w.jsx(Ko,{size:"small",placeholder:le("ui.askOtherPlaceholder"),value:a[h]||"",onChange:b=>this.setState(S=>({otherText:{...S.otherText,[h]:b.target.value}})),onPressEnter:()=>{c&&!l&&d()},autoFocus:!0})})]});return w.jsx("div",{className:h<i.length-1?$e.questionSpacing:void 0,children:p?w.jsxs("div",{className:$e.askMarkdownLayout,children:[v,w.jsx("div",{className:$e.askMarkdownPreview,children:g?w.jsx("pre",{children:g}):w.jsx("span",{className:$e.previewPlaceholder,children:"—"})})]}):v},h)}),w.jsx("div",{className:$e.askSubmitRow,children:w.jsx("button",{className:$e.askSubmitBtn,disabled:!c||l,onClick:d,children:le(l?"ui.askSubmitting":"ui.askSubmit")})})]})}}function jO(t){if(!t||!t.question)return!1;const e=t.question.toLowerCase();return/plan/i.test(e)&&(/approv/i.test(e)||/proceed/i.test(e)||/accept/i.test(e))}function rS(t){if(!t||!t.question)return!1;const e=t.question;if(jO(t))return!1;if(/do you want to (make this edit|write|proceed|create|delete)|allow\b.*\bto\b|want to allow|wants to (execute|run|read|write|access|create|delete|modify|use)|may .*(read|write|execute|run|access|create|delete|modify)|grant .*(access|permission)|permit/i.test(e))return!0;if(t.options&&t.options.length>=2){const n=t.options.map(s=>(s.text||"").toLowerCase()),i=n.some(s=>/^allow|^yes/i.test(s)),r=n.some(s=>/^no$|^no[^a-z]|^deny|^reject/i.test(s));if(i&&r)return!0}return!1}class Nge{diff(e,n,i={}){let r;typeof i=="function"?(r=i,i={}):"callback"in i&&(r=i.callback);const s=this.castInput(e,i),o=this.castInput(n,i),a=this.removeEmpty(this.tokenize(s,i)),l=this.removeEmpty(this.tokenize(o,i));return this.diffWithOptionsObj(a,l,i,r)}diffWithOptionsObj(e,n,i,r){var s;const o=$=>{if($=this.postProcess($,i),r){setTimeout(function(){r($)},0);return}else return $},a=n.length,l=e.length;let c=1,d=a+l;i.maxEditLength!=null&&(d=Math.min(d,i.maxEditLength));const u=(s=i.timeout)!==null&&s!==void 0?s:1/0,h=Date.now()+u,O=[{oldPos:-1,lastComponent:void 0}];let p=this.extractCommon(O[0],n,e,0,i);if(O[0].oldPos+1>=l&&p+1>=a)return o(this.buildValues(O[0].lastComponent,n,e));let m=-1/0,g=1/0;const v=()=>{for(let $=Math.max(m,-c);$<=Math.min(g,c);$+=2){let b;const S=O[$-1],y=O[$+1];S&&(O[$-1]=void 0);let Q=!1;if(y){const P=y.oldPos-$;Q=y&&0<=P&&P<a}const _=S&&S.oldPos+1<l;if(!Q&&!_){O[$]=void 0;continue}if(!_||Q&&S.oldPos<y.oldPos?b=this.addToPath(y,!0,!1,0,i):b=this.addToPath(S,!1,!0,1,i),p=this.extractCommon(b,n,e,$,i),b.oldPos+1>=l&&p+1>=a)return o(this.buildValues(b.lastComponent,n,e))||!0;O[$]=b,b.oldPos+1>=l&&(g=Math.min(g,$-1)),p+1>=a&&(m=Math.max(m,$+1))}c++};if(r)(function $(){setTimeout(function(){if(c>d||Date.now()>h)return r(void 0);v()||$()},0)})();else for(;c<=d&&Date.now()<=h;){const $=v();if($)return $}}addToPath(e,n,i,r,s){const o=e.lastComponent;return o&&!s.oneChangePerToken&&o.added===n&&o.removed===i?{oldPos:e.oldPos+r,lastComponent:{count:o.count+1,added:n,removed:i,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:n,removed:i,previousComponent:o}}}extractCommon(e,n,i,r,s){const o=n.length,a=i.length;let l=e.oldPos,c=l-r,d=0;for(;c+1<o&&l+1<a&&this.equals(i[l+1],n[c+1],s);)c++,l++,d++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(e.lastComponent={count:d,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,n,i){return i.comparator?i.comparator(e,n):e===n||!!i.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let i=0;i<e.length;i++)e[i]&&n.push(e[i]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,i){const r=[];let s;for(;e;)r.push(e),s=e.previousComponent,delete e.previousComponent,e=s;r.reverse();const o=r.length;let a=0,l=0,c=0;for(;a<o;a++){const d=r[a];if(d.removed)d.value=this.join(i.slice(c,c+d.count)),c+=d.count;else{if(!d.added&&this.useLongestToken){let u=n.slice(l,l+d.count);u=u.map(function(h,O){const p=i[c+O];return p.length>h.length?p:h}),d.value=this.join(u)}else d.value=this.join(n.slice(l,l+d.count));l+=d.count,d.added||(c+=d.count)}}return r}}class Wge extends Nge{constructor(){super(...arguments),this.tokenize=Vge}equals(e,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!e.includes(`
882
882
  `))&&(e=e.trim()),(!i.newlineIsToken||!n.includes(`
883
883
  `))&&(n=n.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(e.endsWith(`
884
884
  `)&&(e=e.slice(0,-1)),n.endsWith(`
885
885
  `)&&(n=n.slice(0,-1))),super.equals(e,n,i)}}const Lge=new Wge;function lM(t,e,n){return Lge.diff(t,e,n)}function Vge(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
886
886
  `));const n=[],i=t.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let r=0;r<i.length;r++){const s=i[r];r%2&&!e.newlineIsToken?n[n.length-1]+=s:n.push(s)}return n}const Bge="_wrapper_vsc0z_1",Yge="_header_vsc0z_13",Dge="_headerRight_vsc0z_20",Uge="_filePath_vsc0z_28",qge="_filePathClickable_vsc0z_34",Zge="_toggle_vsc0z_46",Gge="_diffSummary_vsc0z_55",Fge="_diffBody_vsc0z_62",Hge="_gutter_vsc0z_72",Kge="_gutterRow_vsc0z_77",Jge="_lineNumOld_vsc0z_82",eve="_lineNumNew_vsc0z_83",tve="_prefix_vsc0z_90",nve="_codeWrap_vsc0z_98",ive="_codeInner_vsc0z_105",rve="_codeLine_vsc0z_110",sve="_rowContext_vsc0z_118",ove="_rowDel_vsc0z_123",ave="_rowAdd_vsc0z_131",ar={wrapper:Bge,header:Yge,headerRight:Dge,filePath:Uge,filePathClickable:qge,toggle:Zge,diffSummary:Gge,diffBody:Fge,gutter:Hge,gutterRow:Kge,lineNumOld:Jge,lineNumNew:eve,prefix:tve,codeWrap:nve,codeInner:ive,codeLine:rve,rowContext:sve,rowDel:ove,rowAdd:ave},{Text:sS}=kl;function lve(t,e,n){const i=lM(t,e),r=[];let s=n,o=n;for(const a of i){const l=a.value.replace(/\n$/,"").split(`
887
887
  `);if(a.value!=="")for(const c of l)a.added?r.push({type:"add",oldNum:null,newNum:o++,text:c}):a.removed?r.push({type:"del",oldNum:s++,newNum:null,text:c}):r.push({type:"context",oldNum:s++,newNum:o++,text:c})}return r}function cve({file_path:t,old_string:e,new_string:n,startLine:i=1,onOpenFile:r}){const[s,o]=f.useState(!1),a=f.useMemo(()=>lve(e,n,i),[e,n,i]),l=a.filter(p=>p.type==="add").length,c=a.filter(p=>p.type==="del").length,d=f.useMemo(()=>{let p=1;for(const m of a)m.oldNum!=null&&m.oldNum>p&&(p=m.oldNum),m.newNum!=null&&m.newNum>p&&(p=m.newNum);return p},[a]),h=String(d).length*8+10,O=p=>p==="del"?ar.rowDel:p==="add"?ar.rowAdd:ar.rowContext;return w.jsxs("div",{className:ar.wrapper,children:[w.jsxs("div",{className:ar.header,children:[w.jsxs(sS,{className:r?ar.filePathClickable:ar.filePath,children:["Edit: ",w.jsx("span",{onClick:r?p=>{p.stopPropagation(),r(t)}:void 0,children:t})]}),w.jsxs("span",{className:ar.headerRight,children:[w.jsx(sS,{className:ar.diffSummary,children:le("ui.diffSummary",{added:l,removed:c})}),w.jsx(sS,{className:ar.toggle,onClick:()=>o(p=>!p),children:le(s?"ui.expand":"ui.collapse")})]})]}),!s&&w.jsxs("div",{className:ar.diffBody,children:[w.jsx("div",{className:ar.gutter,style:{"--line-num-w":`${h}px`},children:a.map((p,m)=>{const g=p.type==="del"?"-":p.type==="add"?"+":" ";return w.jsxs("div",{className:`${ar.gutterRow} ${O(p.type)}`,children:[w.jsx("span",{className:ar.lineNumOld,style:{width:h},children:p.oldNum??""}),w.jsx("span",{className:ar.lineNumNew,style:{width:h},children:p.newNum??""}),w.jsx("span",{className:ar.prefix,children:g})]},m)})}),w.jsx("div",{className:ar.codeWrap,children:w.jsx("div",{className:ar.codeInner,children:a.map((p,m)=>w.jsx("div",{className:`${ar.codeLine} ${O(p.type)}`,children:p.text},m))})})]})]})}const dve="_plainResult_hq7oa_1",uve="_plainTitle_hq7oa_14",hve="_plainPre_hq7oa_18",Ove="_codeResult_hq7oa_27",fve="_codeHeader_hq7oa_39",pve="_codeTitle_hq7oa_51",mve="_codeToggle_hq7oa_56",gve="_codePre_hq7oa_63",vve="_markdownBody_hq7oa_73",fs={plainResult:dve,plainTitle:uve,plainPre:hve,codeResult:Ove,codeHeader:fve,codeTitle:pve,codeToggle:mve,codePre:gve,markdownBody:vve},{Text:Vd}=kl,Bd={js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",css:"css",scss:"css",less:"css",html:"html",htm:"html",xml:"xml",svg:"xml",json:"json",yaml:"yaml",yml:"yaml",toml:"toml",sh:"shell",bash:"shell",zsh:"shell",md:"markdown",sql:"sql"},$ve=["Read","Grep","Glob","Bash","Write","Edit"];function bve(t,e,n){if(!e)return null;const i=e.file_path||"";if(i){const r=i.split(".").pop().toLowerCase();if(Bd[r])return Bd[r]}if(t==="Bash")return"shell-output";if(t==="Glob")return"file-list";if(t==="Grep"){const r=e.glob||"";if(r){const s=r.replace(/[{}*]/g,",").split(",").filter(Boolean);for(const o of s){const a=o.replace(/^\./,"").toLowerCase();if(Bd[a])return Bd[a]}}if(e.output_mode==="files_with_matches"||!e.output_mode)return"file-list";if(e.output_mode==="content"&&n){const s=n.match(/^[\w/.~-]+\.([\w]+):\d+/m);if(s&&Bd[s[1].toLowerCase()])return Bd[s[1].toLowerCase()]}return"shell-output"}return n?Sve(n):null}function Sve(t){const e=t.substring(0,2e3);return/^\s*[\[{]/.test(e)&&/[}\]]\s*$/.test(e.trimEnd())?"json":/^\s*<!DOCTYPE|^\s*<html|^\s*<\?xml/i.test(e)?"html":/^#!.*python/m.test(e)||/\bdef\s+\w+\s*\(.*\)\s*:/m.test(e)||/\bclass\s+\w+.*:/m.test(e)||/^\s*(from\s+\w+\s+import|import\s+\w+)/m.test(e)&&/:$/.test(e)?"python":/\bfn\s+\w+\s*\(/.test(e)&&/\blet\s+(mut\s+)?\w+/.test(e)?"rust":/^package\s+\w+/m.test(e)&&/\bfunc\s+/.test(e)?"go":/\bpublic\s+(class|interface|static)\b/.test(e)?"java":/\bdef\s+\w+/.test(e)&&/\bend\b/.test(e)&&!/;/.test(e)?"ruby":/^#!.*\b(bash|sh|zsh)\b/m.test(e)?"shell":/\b(const|let|var)\s+\w+\s*=/.test(e)&&(/=>/.test(e)||/\brequire\s*\(/.test(e))||/^\s*import\s+.*\s+from\s+['"]/.test(e)||/^\s*export\s+(default\s+)?(function|class|const)\b/m.test(e)?"javascript":/[.#][\w-]+\s*\{[\s\S]*?:\s*[\w#]/.test(e)?"css":/^[\w-]+\s*:(\s+\S|$)/m.test(e)&&!/[{;]/.test(e)?"yaml":/\b(SELECT|INSERT|UPDATE|DELETE|CREATE\s+TABLE)\b/i.test(e)?"sql":null}const yve={javascript:[{pattern:/(\/\/.*$)/gm,cls:"hl-comment"},{pattern:/(\/\*[\s\S]*?\*\/)/g,cls:"hl-comment"},{pattern:/('(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`)/g,cls:"hl-string"},{pattern:/\b(const|let|var|function|return|if|else|for|while|class|import|export|from|default|new|this|async|await|try|catch|throw|switch|case|break|continue|typeof|instanceof|in|of|null|undefined|true|false)\b/g,cls:"hl-keyword"},{pattern:/\b(\d+\.?\d*)\b/g,cls:"hl-number"}],typescript:null,python:[{pattern:/(#.*$)/gm,cls:"hl-comment"},{pattern:/('''[\s\S]*?'''|"""[\s\S]*?"""|'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*")/g,cls:"hl-string"},{pattern:/\b(def|class|return|if|elif|else|for|while|import|from|as|try|except|finally|raise|with|yield|lambda|pass|break|continue|and|or|not|in|is|None|True|False|self|async|await)\b/g,cls:"hl-keyword"},{pattern:/\b(\d+\.?\d*)\b/g,cls:"hl-number"}],go:[{pattern:/(\/\/.*$)/gm,cls:"hl-comment"},{pattern:/(\/\*[\s\S]*?\*\/)/g,cls:"hl-comment"},{pattern:/('(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`]*`)/g,cls:"hl-string"},{pattern:/\b(func|return|if|else|for|range|switch|case|default|break|continue|go|defer|select|chan|map|struct|interface|package|import|var|const|type|nil|true|false|make|new|append|len|cap)\b/g,cls:"hl-keyword"},{pattern:/\b(\d+\.?\d*)\b/g,cls:"hl-number"}],rust:[{pattern:/(\/\/.*$)/gm,cls:"hl-comment"},{pattern:/("(?:[^"\\]|\\.)*")/g,cls:"hl-string"},{pattern:/\b(fn|let|mut|return|if|else|for|while|loop|match|struct|enum|impl|trait|pub|use|mod|crate|self|super|where|async|await|move|ref|true|false|Some|None|Ok|Err)\b/g,cls:"hl-keyword"},{pattern:/\b(\d+\.?\d*)\b/g,cls:"hl-number"}],java:[{pattern:/(\/\/.*$)/gm,cls:"hl-comment"},{pattern:/(\/\*[\s\S]*?\*\/)/g,cls:"hl-comment"},{pattern:/("(?:[^"\\]|\\.)*")/g,cls:"hl-string"},{pattern:/\b(public|private|protected|class|interface|extends|implements|return|if|else|for|while|switch|case|break|continue|new|this|super|static|final|void|int|long|double|float|boolean|char|String|import|package|try|catch|throw|throws|null|true|false)\b/g,cls:"hl-keyword"},{pattern:/\b(\d+\.?\d*[fFdDlL]?)\b/g,cls:"hl-number"}],ruby:[{pattern:/(#.*$)/gm,cls:"hl-comment"},{pattern:/('(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*")/g,cls:"hl-string"},{pattern:/\b(def|end|class|module|return|if|elsif|else|unless|for|while|do|begin|rescue|ensure|raise|yield|block_given\?|nil|true|false|self|require|include|attr_accessor|attr_reader)\b/g,cls:"hl-keyword"},{pattern:/\b(\d+\.?\d*)\b/g,cls:"hl-number"}],css:[{pattern:/(\/\*[\s\S]*?\*\/)/g,cls:"hl-comment"},{pattern:/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/g,cls:"hl-string"},{pattern:/([.#][\w-]+)/g,cls:"hl-keyword"},{pattern:/\b(\d+\.?\d*(px|em|rem|%|vh|vw|s|ms)?)\b/g,cls:"hl-number"}],json:[{pattern:/("(?:[^"\\]|\\.)*")\s*:/g,cls:"hl-keyword"},{pattern:/:\s*("(?:[^"\\]|\\.)*")/g,cls:"hl-string"},{pattern:/\b(true|false|null)\b/g,cls:"hl-keyword"},{pattern:/\b(-?\d+\.?\d*([eE][+-]?\d+)?)\b/g,cls:"hl-number"}],shell:[{pattern:/(#.*$)/gm,cls:"hl-comment"},{pattern:/('(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*")/g,cls:"hl-string"},{pattern:/\b(if|then|else|elif|fi|for|while|do|done|case|esac|function|return|exit|export|source|alias|cd|ls|grep|find|echo|cat|mkdir|rm|cp|mv|chmod|sudo|apt|npm|pip|git)\b/g,cls:"hl-keyword"}],sql:[{pattern:/(--.*$)/gm,cls:"hl-comment"},{pattern:/('(?:[^'\\]|\\.)*')/g,cls:"hl-string"},{pattern:/\b(SELECT|FROM|WHERE|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER|TABLE|INDEX|JOIN|LEFT|RIGHT|INNER|OUTER|ON|AND|OR|NOT|IN|IS|NULL|AS|ORDER|BY|GROUP|HAVING|LIMIT|OFFSET|UNION|SET|VALUES|INTO|DISTINCT|COUNT|SUM|AVG|MAX|MIN|LIKE|BETWEEN|EXISTS|CASE|WHEN|THEN|ELSE|END)\b/gi,cls:"hl-keyword"},{pattern:/\b(\d+\.?\d*)\b/g,cls:"hl-number"}],html:[{pattern:/(<!--[\s\S]*?-->)/g,cls:"hl-comment"},{pattern:/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/g,cls:"hl-string"},{pattern:/(<\/?[\w-]+|\/?>)/g,cls:"hl-keyword"}],xml:null,yaml:[{pattern:/(#.*$)/gm,cls:"hl-comment"},{pattern:/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/g,cls:"hl-string"},{pattern:/^([\w.-]+)\s*:/gm,cls:"hl-keyword"},{pattern:/\b(true|false|null|yes|no)\b/gi,cls:"hl-keyword"},{pattern:/\b(\d+\.?\d*)\b/g,cls:"hl-number"}],markdown:[{pattern:/^(#{1,6}\s.*$)/gm,cls:"hl-keyword"},{pattern:/(`[^`]+`)/g,cls:"hl-string"},{pattern:/(\*\*[^*]+\*\*|__[^_]+__)/g,cls:"hl-keyword"},{pattern:/(\[[^\]]+\]\([^)]+\))/g,cls:"hl-string"}],toml:[{pattern:/(#.*$)/gm,cls:"hl-comment"},{pattern:/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/g,cls:"hl-string"},{pattern:/^([\w.-]+)\s*=/gm,cls:"hl-keyword"},{pattern:/(\[[\w.-]+\])/g,cls:"hl-keyword"},{pattern:/\b(true|false)\b/g,cls:"hl-keyword"},{pattern:/\b(\d+\.?\d*)\b/g,cls:"hl-number"}]},_ve=[{pattern:/(\/\/.*$|#.*$)/gm,cls:"hl-comment"},{pattern:/('(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`)/g,cls:"hl-string"},{pattern:/\b(\d+\.?\d*)\b/g,cls:"hl-number"}],Qve=[{pattern:/^([\w/.~-]+:\d+[:-])/gm,cls:"hl-keyword"},{pattern:/('(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*")/g,cls:"hl-string"},{pattern:/\b(\d+\.?\d*)\b/g,cls:"hl-number"}],xve=[{pattern:/^(.*\.(jsx?|tsx?|mjs|cjs))$/gm,cls:"hl-string"},{pattern:/^(.*\.(py|rb|go|rs|java|c|cpp|h))$/gm,cls:"hl-keyword"},{pattern:/^(.*\.(json|ya?ml|toml|xml|html?|css|scss|less|md))$/gm,cls:"hl-number"},{pattern:/^(.*\.(log|txt|csv|jsonl))$/gm,cls:"hl-comment"}];function wve(t,e){let n=e;n==="typescript"&&(n="javascript"),n==="xml"&&(n="html"),(n==="c"||n==="cpp")&&(n="javascript");let i;n==="shell-output"?i=Qve:n==="file-list"?i=xve:i=yve[n]||_ve;const r=/^(\s*\d+→)/gm,s=[];let o=t.replace(r,d=>{const u=s.length;return s.push(d),`L${u}`});const a=b_(o),l=[];let c=a;for(const d of i)d.pattern.lastIndex=0,c=c.replace(d.pattern,u=>{const h=l.length;return l.push(`<span class="${d.cls}">${u}</span>`),`P${h}`});return c=c.replace(/\x02P(\d+)\x02/g,(d,u)=>l[parseInt(u)]),c=c.replace(/\x01L(\d+)\x01/g,(d,u)=>`<span class="hl-linenum">${b_(s[parseInt(u)])}</span>`),c}function hR({toolName:t,toolInput:e,resultText:n,defaultCollapsed:i}){const[r,s]=f.useState(i??!1);f.useEffect(()=>{s(i??!1)},[i]);const o=$ve.includes(t),a=o?bve(t,e,n):null,l=n.length>5e3?n.substring(0,5e3)+`
888
- ... (truncated)`:n;let c=t?le("ui.toolReturnNamed",{name:t}):"Result";if(e){const u=e.file_path||e.path||"";if(u){const h=u.split("/");c=`${t}: ${h[h.length-1]}`}}if(!o)return t==="Task"?w.jsxs("div",{className:fs.plainResult,children:[w.jsxs("div",{className:fs.codeHeader,children:[w.jsx(Vd,{type:"secondary",className:fs.plainTitle,children:c}),w.jsx(Vd,{className:fs.codeToggle,onClick:()=>s(u=>!u),children:le(r?"ui.expand":"ui.collapse")})]}),!r&&w.jsx("div",{className:`chat-md ${fs.markdownBody}`,dangerouslySetInnerHTML:{__html:bo(l)}})]}):w.jsxs("div",{className:fs.plainResult,children:[w.jsxs("div",{className:fs.codeHeader,children:[w.jsx(Vd,{type:"secondary",className:fs.plainTitle,children:c}),w.jsx(Vd,{className:fs.codeToggle,onClick:()=>s(u=>!u),children:le(r?"ui.expand":"ui.collapse")})]}),!r&&w.jsx("pre",{className:fs.plainPre,children:l})]});const d=wve(l,a||"fallback");return w.jsxs("div",{className:`tool-result-code ${fs.codeResult}`,children:[w.jsxs("div",{className:fs.codeHeader,children:[w.jsxs(Vd,{className:fs.codeTitle,children:[c,a?` (${a})`:""]}),w.jsx(Vd,{className:fs.codeToggle,onClick:()=>s(u=>!u),children:le(r?"ui.expand":"ui.collapse")})]}),!r&&w.jsx("pre",{className:`code-highlight ${fs.codePre}`,dangerouslySetInnerHTML:{__html:d}})]})}const Pve="_overlay_vzro5_1",Cve="_dragging_vzro5_21",Tve="_closing_vzro5_22",kve="_closeBtn_vzro5_34",Rve="_imageArea_vzro5_54",Eve="_image_vzro5_54",Xve="_spinner_vzro5_76",zve="_zoomLabel_vzro5_89",Ive="_errorMsg_vzro5_103",Ao={overlay:Pve,dragging:Cve,closing:Tve,closeBtn:kve,imageArea:Rve,image:Eve,spinner:Xve,zoomLabel:zve,errorMsg:Ive},Ave=.1,Mve=10,jve=150;function QP({src:t,alt:e,onClose:n}){const[i,r]=f.useState(1),[s,o]=f.useState({x:0,y:0}),[a,l]=f.useState(!1),[c,d]=f.useState(!1),[u,h]=f.useState(!1),[O,p]=f.useState(!1),m=f.useRef(null),g=f.useRef(null),v=f.useRef(null),$=f.useRef(null),b=f.useRef({zoom:1,offset:{x:0,y:0}}),S=f.useRef(!0),y=A=>Math.min(Mve,Math.max(Ave,A));f.useEffect(()=>{b.current.zoom=i},[i]),f.useEffect(()=>{b.current.offset=s},[s]),f.useEffect(()=>()=>{S.current=!1},[]);const Q=f.useCallback(()=>{p(!0)},[]);f.useEffect(()=>{if(!O)return;const A=setTimeout(()=>{S.current&&n()},jve);return()=>clearTimeout(A)},[O,n]),f.useEffect(()=>{const A=L=>{L.key==="Escape"&&Q()};window.addEventListener("keydown",A);const j=document.body.style.overflow,N=document.body.style.scrollbarGutter;return document.body.style.overflow="hidden",document.body.style.scrollbarGutter="stable",()=>{window.removeEventListener("keydown",A),document.body.style.overflow=j,document.body.style.scrollbarGutter=N}},[Q]);const _=f.useCallback(A=>{d(!0);const j=A.target,N=window.innerWidth*.9,L=window.innerHeight*.9;if(j.naturalWidth>N||j.naturalHeight>L){const B=Math.min(N/j.naturalWidth,L/j.naturalHeight),V=Math.min(1,B);r(V)}},[]),P=f.useCallback(A=>{A.preventDefault(),A.stopPropagation(),r(j=>{const N=y(j*(A.deltaY<0?1.06:.9433962264150942)),L=N/j;return o(B=>({x:B.x*L,y:B.y*L})),N})},[]);f.useEffect(()=>{const A=$.current;if(A)return A.addEventListener("wheel",P,{passive:!1}),()=>A.removeEventListener("wheel",P)},[P]);const C=f.useCallback(A=>{if(A.button!==0)return;A.preventDefault();const{offset:j}=b.current;m.current={startX:A.clientX,startY:A.clientY,ox:j.x,oy:j.y},l(!0);const N=B=>{m.current&&o({x:m.current.ox+B.clientX-m.current.startX,y:m.current.oy+B.clientY-m.current.startY})},L=()=>{m.current=null,S.current&&l(!1),window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",L)};window.addEventListener("mousemove",N),window.addEventListener("mouseup",L)},[]),X=f.useCallback(A=>{const{zoom:j,offset:N}=b.current;if(A.touches.length===2){const L=A.touches[0].clientX-A.touches[1].clientX,B=A.touches[0].clientY-A.touches[1].clientY;v.current={dist:Math.hypot(L,B),zoom:j,ox:N.x,oy:N.y,isPinch:!0}}else A.touches.length===1&&(v.current={startX:A.touches[0].clientX,startY:A.touches[0].clientY,ox:N.x,oy:N.y,isPinch:!1,moved:!1})},[]),z=f.useCallback(A=>{if(v.current){if(A.preventDefault(),v.current.isPinch&&A.touches.length===2){const j=A.touches[0].clientX-A.touches[1].clientX,N=A.touches[0].clientY-A.touches[1].clientY,B=Math.hypot(j,N)/v.current.dist;r(y(v.current.zoom*B))}else if(A.touches.length===1){if(v.current.isPinch){const{offset:L}=b.current;v.current={startX:A.touches[0].clientX,startY:A.touches[0].clientY,ox:L.x,oy:L.y,isPinch:!1,moved:!1};return}const j=A.touches[0].clientX-v.current.startX,N=A.touches[0].clientY-v.current.startY;(Math.abs(j)>5||Math.abs(N)>5)&&(v.current.moved=!0),o({x:v.current.ox+j,y:v.current.oy+N})}}},[]),T=f.useCallback(A=>{if(v.current){if(A.touches.length>0){v.current=null;return}if(!v.current.isPinch&&!v.current.moved&&A.changedTouches.length===1){const j=A.target;(j===$.current||j.classList.contains(Ao.imageArea))&&Q()}v.current=null}},[Q]),k=f.useCallback(A=>{(A.target===$.current||A.target.classList.contains(Ao.imageArea))&&Q()},[Q]),x=f.useCallback(A=>{A.stopPropagation(),r(j=>(o({x:0,y:0}),j>1.1?1:2.5))},[]),R=le("ui.imageLightbox.close"),E=[Ao.overlay,a&&Ao.dragging,O&&Ao.closing].filter(Boolean).join(" "),I=w.jsxs("div",{className:E,ref:$,role:"dialog","aria-modal":"true","aria-label":e||"Image preview",onClick:k,onTouchStart:X,onTouchMove:z,onTouchEnd:T,children:[w.jsx("button",{className:Ao.closeBtn,onClick:Q,title:R,"aria-label":R,children:w.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),w.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),w.jsx("div",{className:Ao.imageArea,children:u?w.jsx("div",{className:Ao.errorMsg,children:"Failed to load image"}):w.jsxs(w.Fragment,{children:[!c&&w.jsx("div",{className:Ao.spinner}),w.jsx("img",{ref:g,className:Ao.image,src:t,alt:e||"",draggable:!1,onLoad:_,onError:()=>h(!0),onMouseDown:C,onDoubleClick:x,style:{transform:`translate(${s.x}px, ${s.y}px) scale(${i})`,opacity:c?1:0}})]})}),i!==1&&w.jsxs("div",{className:Ao.zoomLabel,children:[Math.round(i*100),"%"]})]});return sd.createPortal(I,document.body)}const wv="/assets/default-avatar-CT9tlZjd.svg",cM="/assets/default-model-avatar-DlbUPjyv.svg",{Text:Ur}=kl;function Nve({src:t,alt:e,fallbackText:n}){const[i,r]=Z.useState(!1),[s,o]=Z.useState(!1);return i?w.jsx("span",{className:$e.chatImageFallback,children:n}):w.jsxs(w.Fragment,{children:[w.jsx("img",{src:t,alt:e,className:$e.chatImageImg,loading:"lazy",decoding:"async",onClick:()=>o(!0),onError:()=>r(!0)}),s&&w.jsx(QP,{src:t,alt:e,onClose:()=>o(!1)})]})}class gs extends Z.Component{constructor(e){super(e),this.state={planFeedbackInput:!1,planFeedbackText:"",planFeedbackOptNumber:null,planApprovalSubmitting:!1}}shouldComponentUpdate(e,n){if(this.state!==n)return!0;const i=this.props,r=e;return i.role!==r.role||i.content!==r.content||i.text!==r.text||i.timestamp!==r.timestamp||i.highlight!==r.highlight||i.collapseToolResults!==r.collapseToolResults||i.expandThinking!==r.expandThinking||i.showFullToolContent!==r.showFullToolContent||i.showThinkingSummaries!==r.showThinkingSummaries||i.toolResultMap!==r.toolResultMap||i.readContentMap!==r.readContentMap||i.editSnapshotMap!==r.editSnapshotMap||i.askAnswerMap!==r.askAnswerMap||i.planApprovalMap!==r.planApprovalMap||i.latestPlanContent!==r.latestPlanContent||i.ptyPrompt!==r.ptyPrompt||i.cliMode!==r.cliMode||i.lastPendingAskId!==r.lastPendingAskId||i.lastPendingPlanId!==r.lastPendingPlanId||i.activePlanPrompt!==r.activePlanPrompt||i.activeDangerousPrompt!==r.activeDangerousPrompt||i.requestIndex!==r.requestIndex||i.label!==r.label||i.isTeammate!==r.isTeammate||i.userProfile!==r.userProfile||i.modelInfo!==r.modelInfo||i.resultText!==r.resultText||i.toolName!==r.toolName||i.onViewRequest!==r.onViewRequest||i.onOpenFile!==r.onOpenFile||i.onPlanApprovalClick!==r.onPlanApprovalClick||i.onPlanFeedbackSubmit!==r.onPlanFeedbackSubmit||i.onDangerousApprovalClick!==r.onDangerousApprovalClick||i.onAskQuestionSubmit!==r.onAskQuestionSubmit}componentDidUpdate(e){e.lastPendingAskId!==this.props.lastPendingAskId&&this.setState({askSelections:{},askMultiSelections:{},askOtherActive:{},askOtherText:{},askSubmitting:!1}),e.lastPendingPlanId!==this.props.lastPendingPlanId&&this.setState({planApprovalSubmitting:!1})}formatTime(e){if(!e)return null;try{const n=new Date(e),i=r=>String(r).padStart(2,"0");return`${i(n.getMonth()+1)}-${i(n.getDate())} ${i(n.getHours())}:${i(n.getMinutes())}:${i(n.getSeconds())}`}catch{return null}}renderViewRequestBtn(){const{requestIndex:e,onViewRequest:n}=this.props;return e==null||!n?null:w.jsx("span",{className:$e.viewRequestBtn,onClick:i=>{i.stopPropagation(),n(e)},children:le("ui.viewRequest")})}renderLabel(e,n){const{timestamp:i}=this.props,r=this.formatTime(i);return w.jsxs("div",{className:$e.labelRow,children:[w.jsxs(Ur,{type:"secondary",className:$e.labelText,children:[e,n||""]}),w.jsxs("span",{className:$e.labelRight,children:[this.renderViewRequestBtn(),r&&w.jsx(Ur,{className:$e.timeText,children:r})]})]})}renderModelAvatar(e){return e!=null&&e.svg?w.jsx("div",{className:$e.avatar,style:{background:e.color||"#6b21a8"},dangerouslySetInnerHTML:{__html:e.svg}}):w.jsx("img",{src:cM,className:$e.avatarImg,alt:(e==null?void 0:e.name)||"Agent"})}renderUserAvatar(e){const{userProfile:n}=this.props;return n!=null&&n.avatar?w.jsx("img",{src:n.avatar,className:$e.avatarImg,alt:n.name||"User",onError:i=>{i.target.onerror=null,i.target.src=wv}}):w.jsx("img",{src:wv,className:$e.avatarImg,alt:(n==null?void 0:n.name)||"User"})}getUserName(){const{userProfile:e}=this.props;return(e==null?void 0:e.name)||"User"}renderSegments(e){return e.map((n,i)=>n.type==="system-tag"?w.jsx(Ah,{ghost:!0,size:"small",items:[{key:"1",label:w.jsx(Ur,{type:"secondary",className:$e.systemTagLabel,children:n.tag}),children:w.jsx("pre",{className:$e.systemTagPre,children:n.content})}],className:$e.collapseMargin},i):w.jsx("div",{className:"chat-md",dangerouslySetInnerHTML:{__html:bo(n.content)}},i))}renderToolCall(e){var d,u;if(typeof e.input=="string")try{const h=e.input.replace(/^\[object Object\]/,"");e={...e,input:JSON.parse(h)}}catch{}if(e.name==="Edit"&&e.input&&e.input.old_string!=null&&e.input.new_string!=null){const h=this.props.editSnapshotMap||{},O=e.input.file_path||"";let p=1;const m=h[e.id];if(m&&e.input.old_string){const g=m.plainText.indexOf(e.input.old_string);if(g>=0){const $=m.plainText.substring(0,g).split(`
889
- `).length-1;p=m.lineNums[$]??$+1}}return w.jsx(cve,{file_path:O,old_string:e.input.old_string,new_string:e.input.new_string,startLine:p,onOpenFile:this.props.onOpenFile},e.id)}const n=e.input&&typeof e.input=="object"?e.input:{},i=(h,O)=>w.jsxs("div",{className:$e.toolBox,children:[w.jsx(Ur,{strong:!0,className:$e.toolLabel,children:h}),O]},e.id),r=(h,O)=>w.jsx("pre",{className:$e.codePre,style:{color:O},children:h}),s=this.props.onOpenFile,o=h=>s?w.jsx("span",{className:$e.pathTagClickable,onClick:O=>{O.stopPropagation(),s(h)},children:h}):w.jsx("span",{className:$e.pathTag,children:h});if(e.name==="Bash"){const h=n.command||"",O=n.description||"",p=h.split(`
890
- `).length;return p>5?w.jsxs("div",{className:$e.toolBox,children:[w.jsxs(Ur,{strong:!0,className:$e.toolLabel,children:["Bash",O?w.jsxs("span",{className:$e.descSpan,children:[" — ",O]}):""]}),w.jsx(Ah,{ghost:!0,size:"small",items:[{key:"1",label:w.jsxs(Ur,{type:"secondary",className:$e.bashCollapseLabel,children:[le("ui.bashCommand")," (",p," ",le("ui.lines"),")"]}),children:r(h,"#c9d1d9")}],className:$e.collapseMargin})]},e.id):i(w.jsxs(w.Fragment,{children:["Bash",O?w.jsxs("span",{className:$e.descSpan,children:[" — ",O]}):""]}),r(h,"#c9d1d9"))}if(e.name==="Read"){const h=n.file_path||"",O=[];n.offset&&O.push(`offset: ${n.offset}`),n.limit&&O.push(`limit: ${n.limit}`);const p=O.length?` (${O.join(", ")})`:"";return i(w.jsxs(w.Fragment,{children:["Read: ",o(h),w.jsx("span",{className:$e.secondarySpan,children:p})]}),null)}if(e.name==="Write"){const h=n.file_path||"",O=n.content||"",p=O.split(`
891
- `);return i(w.jsxs(w.Fragment,{children:["Write: ",o(h)," ",w.jsxs("span",{className:$e.secondarySpan,children:["(",p.length," lines)"]})]}),r(O,"#c9d1d9"))}if(e.name==="Glob"){const h=n.pattern||"",O=n.path||"";return i(w.jsxs(w.Fragment,{children:["Glob: ",w.jsx("span",{className:$e.patternSpan,children:h}),O?w.jsxs("span",{className:$e.secondarySpan,children:[" in ",O]}):""]}),null)}if(e.name==="Grep"){const h=n.pattern||"",O=n.path||"",p=[];n.glob&&p.push(`glob: ${n.glob}`),n.output_mode&&p.push(`mode: ${n.output_mode}`),n.head_limit&&p.push(`limit: ${n.head_limit}`);const m=p.length?` (${p.join(", ")})`:"";return i(w.jsxs(w.Fragment,{children:["Grep: ",w.jsxs("span",{className:$e.patternSpan,children:["/",h,"/"]}),O?w.jsxs("span",{className:$e.secondarySpan,children:[" in ",O]}):"",w.jsx("span",{className:$e.secondarySpan,children:m})]}),null)}if(e.name==="Task"){const h=n.subagent_type||"",O=n.description||"";return i(w.jsxs(w.Fragment,{children:["Task(",h,O?": "+O:"",")"]}),null)}if(e.name==="AskUserQuestion"){const h=Array.isArray(n.questions)?n.questions:[],{askAnswerMap:O}=this.props,p=(O==null?void 0:O[e.id])||{},m=p.__rejected__===!0,g=!m&&Object.keys(p).length>0;if(!g&&!m&&this.props.onAskQuestionSubmit&&e.id===this.props.lastPendingAskId)return this.renderAskQuestionInteractive(e.id,h);const b=w.jsx("svg",{className:$e.askCheckSvg,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:w.jsx("path",{d:"M3 8.5L6.5 12L13 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})});return w.jsx("div",{className:$e.askQuestionBox,children:h.map((S,y)=>{var z;const Q=p[S.question],_=Q!=null&&S.multiSelect?Q.split(",").map(T=>T.trim()):[],P=T=>Q==null?!1:S.multiSelect?_.includes(T):Q===T,C=(z=S.options)==null?void 0:z.some(T=>P(T.label)),X=g&&Q!=null&&!C;return w.jsxs("div",{className:y<h.length-1?$e.questionSpacing:void 0,children:[S.header&&w.jsx("span",{className:$e.askQuestionHeader,children:S.header}),w.jsx("div",{className:$e.askQuestionText,children:S.question}),w.jsxs("div",{className:$e.optionList,children:[S.options&&S.options.map((T,k)=>{const x=P(T.label);return w.jsxs("div",{className:`${$e.askOptionItem}${x?" "+$e.askOptionSelected:""}`,children:[x?b:"○"," ",T.label,T.description&&w.jsxs("span",{className:$e.optionDesc,children:["— ",T.description]})]},k)}),X&&w.jsxs("div",{className:`${$e.askOptionItem} ${$e.askOptionSelected}`,children:[b," ",Q]})]})]},y)})},e.id)}if(e.name==="EnterPlanMode")return w.jsx("div",{className:$e.planModeBox,children:w.jsx("span",{className:$e.planModeLabel,children:le("ui.enterPlanMode")})},e.id);if(e.name==="ExitPlanMode"){const h=n.allowedPrompts||[],{planApprovalMap:O}=this.props,p=O&&O[e.id]||{status:"pending"},m=p.status==="pending",g=m&&this.props.cliMode&&e.id===this.props.lastPendingPlanId;let v=null;if(m){if(v=this.props.latestPlanContent||null,!v&&Array.isArray(this.props.content))for(const P of this.props.content){if(P===e)break;P.type==="tool_use"&&P.name==="Write"&&((d=P.input)!=null&&d.file_path)&&/\.claude\/plans\//i.test(P.input.file_path)&&P.input.content&&(v=P.input.content)}if(!v&&Array.isArray(this.props.content)){const P=[];for(const C of this.props.content){if(C===e)break;C.type==="text"&&C.text&&P.push(C.text)}v=P.join(`
888
+ ... (truncated)`:n;let c=t?le("ui.toolReturnNamed",{name:t}):"Result";if(e){const u=e.file_path||e.path||"";if(u){const h=u.split("/");c=`${t}: ${h[h.length-1]}`}}if(!o)return t==="Task"?w.jsxs("div",{className:fs.plainResult,children:[w.jsxs("div",{className:fs.codeHeader,children:[w.jsx(Vd,{type:"secondary",className:fs.plainTitle,children:c}),w.jsx(Vd,{className:fs.codeToggle,onClick:()=>s(u=>!u),children:le(r?"ui.expand":"ui.collapse")})]}),!r&&w.jsx("div",{className:`chat-md ${fs.markdownBody}`,dangerouslySetInnerHTML:{__html:bo(l)}})]}):w.jsxs("div",{className:fs.plainResult,children:[w.jsxs("div",{className:fs.codeHeader,children:[w.jsx(Vd,{type:"secondary",className:fs.plainTitle,children:c}),w.jsx(Vd,{className:fs.codeToggle,onClick:()=>s(u=>!u),children:le(r?"ui.expand":"ui.collapse")})]}),!r&&w.jsx("pre",{className:fs.plainPre,children:l})]});const d=wve(l,a||"fallback");return w.jsxs("div",{className:`tool-result-code ${fs.codeResult}`,children:[w.jsxs("div",{className:fs.codeHeader,children:[w.jsxs(Vd,{className:fs.codeTitle,children:[c,a?` (${a})`:""]}),w.jsx(Vd,{className:fs.codeToggle,onClick:()=>s(u=>!u),children:le(r?"ui.expand":"ui.collapse")})]}),!r&&w.jsx("pre",{className:`code-highlight ${fs.codePre}`,dangerouslySetInnerHTML:{__html:d}})]})}const Pve="_overlay_vzro5_1",Cve="_dragging_vzro5_21",Tve="_closing_vzro5_22",kve="_closeBtn_vzro5_34",Rve="_imageArea_vzro5_54",Eve="_image_vzro5_54",Xve="_spinner_vzro5_76",zve="_zoomLabel_vzro5_89",Ive="_errorMsg_vzro5_103",Ao={overlay:Pve,dragging:Cve,closing:Tve,closeBtn:kve,imageArea:Rve,image:Eve,spinner:Xve,zoomLabel:zve,errorMsg:Ive},Ave=.1,Mve=10,jve=150;function QP({src:t,alt:e,onClose:n}){const[i,r]=f.useState(1),[s,o]=f.useState({x:0,y:0}),[a,l]=f.useState(!1),[c,d]=f.useState(!1),[u,h]=f.useState(!1),[O,p]=f.useState(!1),m=f.useRef(null),g=f.useRef(null),v=f.useRef(null),$=f.useRef(null),b=f.useRef({zoom:1,offset:{x:0,y:0}}),S=f.useRef(!0),y=A=>Math.min(Mve,Math.max(Ave,A));f.useEffect(()=>{b.current.zoom=i},[i]),f.useEffect(()=>{b.current.offset=s},[s]),f.useEffect(()=>()=>{S.current=!1},[]);const Q=f.useCallback(()=>{p(!0)},[]);f.useEffect(()=>{if(!O)return;const A=setTimeout(()=>{S.current&&n()},jve);return()=>clearTimeout(A)},[O,n]),f.useEffect(()=>{const A=L=>{L.key==="Escape"&&Q()};window.addEventListener("keydown",A);const j=document.body.style.overflow,N=document.body.style.scrollbarGutter;return document.body.style.overflow="hidden",document.body.style.scrollbarGutter="stable",()=>{window.removeEventListener("keydown",A),document.body.style.overflow=j,document.body.style.scrollbarGutter=N}},[Q]);const _=f.useCallback(A=>{d(!0);const j=A.target,N=window.innerWidth*.9,L=window.innerHeight*.9;if(j.naturalWidth>N||j.naturalHeight>L){const B=Math.min(N/j.naturalWidth,L/j.naturalHeight),V=Math.min(1,B);r(V)}},[]),P=f.useCallback(A=>{A.preventDefault(),A.stopPropagation(),r(j=>{const N=y(j*(A.deltaY<0?1.06:.9433962264150942)),L=N/j;return o(B=>({x:B.x*L,y:B.y*L})),N})},[]);f.useEffect(()=>{const A=$.current;if(A)return A.addEventListener("wheel",P,{passive:!1}),()=>A.removeEventListener("wheel",P)},[P]);const C=f.useCallback(A=>{if(A.button!==0)return;A.preventDefault();const{offset:j}=b.current;m.current={startX:A.clientX,startY:A.clientY,ox:j.x,oy:j.y},l(!0);const N=B=>{m.current&&o({x:m.current.ox+B.clientX-m.current.startX,y:m.current.oy+B.clientY-m.current.startY})},L=()=>{m.current=null,S.current&&l(!1),window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",L)};window.addEventListener("mousemove",N),window.addEventListener("mouseup",L)},[]),X=f.useCallback(A=>{const{zoom:j,offset:N}=b.current;if(A.touches.length===2){const L=A.touches[0].clientX-A.touches[1].clientX,B=A.touches[0].clientY-A.touches[1].clientY;v.current={dist:Math.hypot(L,B),zoom:j,ox:N.x,oy:N.y,isPinch:!0}}else A.touches.length===1&&(v.current={startX:A.touches[0].clientX,startY:A.touches[0].clientY,ox:N.x,oy:N.y,isPinch:!1,moved:!1})},[]),z=f.useCallback(A=>{if(v.current){if(A.preventDefault(),v.current.isPinch&&A.touches.length===2){const j=A.touches[0].clientX-A.touches[1].clientX,N=A.touches[0].clientY-A.touches[1].clientY,B=Math.hypot(j,N)/v.current.dist;r(y(v.current.zoom*B))}else if(A.touches.length===1){if(v.current.isPinch){const{offset:L}=b.current;v.current={startX:A.touches[0].clientX,startY:A.touches[0].clientY,ox:L.x,oy:L.y,isPinch:!1,moved:!1};return}const j=A.touches[0].clientX-v.current.startX,N=A.touches[0].clientY-v.current.startY;(Math.abs(j)>5||Math.abs(N)>5)&&(v.current.moved=!0),o({x:v.current.ox+j,y:v.current.oy+N})}}},[]),T=f.useCallback(A=>{if(v.current){if(A.touches.length>0){v.current=null;return}if(!v.current.isPinch&&!v.current.moved&&A.changedTouches.length===1){const j=A.target;(j===$.current||j.classList.contains(Ao.imageArea))&&Q()}v.current=null}},[Q]),k=f.useCallback(A=>{(A.target===$.current||A.target.classList.contains(Ao.imageArea))&&Q()},[Q]),x=f.useCallback(A=>{A.stopPropagation(),r(j=>(o({x:0,y:0}),j>1.1?1:2.5))},[]),R=le("ui.imageLightbox.close"),E=[Ao.overlay,a&&Ao.dragging,O&&Ao.closing].filter(Boolean).join(" "),I=w.jsxs("div",{className:E,ref:$,role:"dialog","aria-modal":"true","aria-label":e||"Image preview",onClick:k,onTouchStart:X,onTouchMove:z,onTouchEnd:T,children:[w.jsx("button",{className:Ao.closeBtn,onClick:Q,title:R,"aria-label":R,children:w.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),w.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),w.jsx("div",{className:Ao.imageArea,children:u?w.jsx("div",{className:Ao.errorMsg,children:"Failed to load image"}):w.jsxs(w.Fragment,{children:[!c&&w.jsx("div",{className:Ao.spinner}),w.jsx("img",{ref:g,className:Ao.image,src:t,alt:e||"",draggable:!1,onLoad:_,onError:()=>h(!0),onMouseDown:C,onDoubleClick:x,style:{transform:`translate(${s.x}px, ${s.y}px) scale(${i})`,opacity:c?1:0}})]})}),i!==1&&w.jsxs("div",{className:Ao.zoomLabel,children:[Math.round(i*100),"%"]})]});return sd.createPortal(I,document.body)}const wv="/assets/default-avatar-CT9tlZjd.svg",cM="/assets/default-model-avatar-DlbUPjyv.svg",{Text:Ur}=kl;function Nve({src:t,alt:e,fallbackText:n}){const[i,r]=Z.useState(!1),[s,o]=Z.useState(!1);return i?w.jsx("span",{className:$e.chatImageFallback,children:n}):w.jsxs(w.Fragment,{children:[w.jsx("img",{src:t,alt:e,className:$e.chatImageImg,loading:"lazy",decoding:"async",onClick:()=>o(!0),onError:()=>r(!0)}),s&&w.jsx(QP,{src:t,alt:e,onClose:()=>o(!1)})]})}class gs extends Z.Component{constructor(e){super(e),this.state={planFeedbackInput:!1,planFeedbackText:"",planFeedbackOptNumber:null,planApprovalSubmitting:!1}}shouldComponentUpdate(e,n){if(this.state!==n)return!0;const i=this.props,r=e;return i.role!==r.role||i.content!==r.content||i.text!==r.text||i.timestamp!==r.timestamp||i.highlight!==r.highlight||i.collapseToolResults!==r.collapseToolResults||i.expandThinking!==r.expandThinking||i.showFullToolContent!==r.showFullToolContent||i.showThinkingSummaries!==r.showThinkingSummaries||i.toolResultMap!==r.toolResultMap||i.readContentMap!==r.readContentMap||i.editSnapshotMap!==r.editSnapshotMap||i.askAnswerMap!==r.askAnswerMap||i.planApprovalMap!==r.planApprovalMap||i.latestPlanContent!==r.latestPlanContent||i.ptyPrompt!==r.ptyPrompt||i.cliMode!==r.cliMode||i.lastPendingAskId!==r.lastPendingAskId||i.lastPendingPlanId!==r.lastPendingPlanId||i.activePlanPrompt!==r.activePlanPrompt||i.activeDangerousPrompt!==r.activeDangerousPrompt||i.requestIndex!==r.requestIndex||i.label!==r.label||i.isTeammate!==r.isTeammate||i.userProfile!==r.userProfile||i.modelInfo!==r.modelInfo||i.resultText!==r.resultText||i.toolName!==r.toolName||i.onViewRequest!==r.onViewRequest||i.onOpenFile!==r.onOpenFile||i.onPlanApprovalClick!==r.onPlanApprovalClick||i.onPlanFeedbackSubmit!==r.onPlanFeedbackSubmit||i.onDangerousApprovalClick!==r.onDangerousApprovalClick||i.onAskQuestionSubmit!==r.onAskQuestionSubmit}componentDidUpdate(e){e.lastPendingAskId!==this.props.lastPendingAskId&&this.setState({askSelections:{},askMultiSelections:{},askOtherActive:{},askOtherText:{},askSubmitting:!1}),e.lastPendingPlanId!==this.props.lastPendingPlanId&&this.setState({planApprovalSubmitting:!1})}formatTime(e){if(!e)return null;try{const n=new Date(e),i=r=>String(r).padStart(2,"0");return`${i(n.getMonth()+1)}-${i(n.getDate())} ${i(n.getHours())}:${i(n.getMinutes())}:${i(n.getSeconds())}`}catch{return null}}renderViewRequestBtn(){const{requestIndex:e,onViewRequest:n}=this.props;return e==null||!n?null:w.jsx("span",{className:$e.viewRequestBtn,onClick:i=>{i.stopPropagation(),n(e)},children:le("ui.viewRequest")})}renderLabel(e,n){const{timestamp:i}=this.props,r=this.formatTime(i);return w.jsxs("div",{className:$e.labelRow,children:[w.jsxs(Ur,{type:"secondary",className:$e.labelText,children:[e,n||""]}),w.jsxs("span",{className:$e.labelRight,children:[this.renderViewRequestBtn(),r&&w.jsx(Ur,{className:$e.timeText,children:r})]})]})}renderModelAvatar(e){return e!=null&&e.svg?w.jsx("div",{className:$e.avatar,style:{background:e.color||"var(--bg-model-avatar)"},dangerouslySetInnerHTML:{__html:e.svg}}):w.jsx("img",{src:cM,className:$e.avatarImg,alt:(e==null?void 0:e.name)||"Agent"})}renderUserAvatar(e){const{userProfile:n}=this.props;return n!=null&&n.avatar?w.jsx("img",{src:n.avatar,className:$e.avatarImg,alt:n.name||"User",onError:i=>{i.target.onerror=null,i.target.src=wv}}):w.jsx("img",{src:wv,className:$e.avatarImg,alt:(n==null?void 0:n.name)||"User"})}getUserName(){const{userProfile:e}=this.props;return(e==null?void 0:e.name)||"User"}renderSegments(e){return e.map((n,i)=>n.type==="system-tag"?w.jsx(Ah,{ghost:!0,size:"small",items:[{key:"1",label:w.jsx(Ur,{type:"secondary",className:$e.systemTagLabel,children:n.tag}),children:w.jsx("pre",{className:$e.systemTagPre,children:n.content})}],className:$e.collapseMargin},i):w.jsx("div",{className:"chat-md",dangerouslySetInnerHTML:{__html:bo(n.content)}},i))}renderToolCall(e){var d,u;if(typeof e.input=="string")try{const h=e.input.replace(/^\[object Object\]/,"");e={...e,input:JSON.parse(h)}}catch{}if(e.name==="Edit"&&e.input&&e.input.old_string!=null&&e.input.new_string!=null){const h=this.props.editSnapshotMap||{},O=e.input.file_path||"";let p=1;const m=h[e.id];if(m&&e.input.old_string){const g=m.plainText.indexOf(e.input.old_string);if(g>=0){const $=m.plainText.substring(0,g).split(`
889
+ `).length-1;p=m.lineNums[$]??$+1}}return w.jsx(cve,{file_path:O,old_string:e.input.old_string,new_string:e.input.new_string,startLine:p,onOpenFile:this.props.onOpenFile},e.id)}const n=e.input&&typeof e.input=="object"?e.input:{},i=(h,O)=>w.jsxs("div",{className:$e.toolBox,children:[w.jsx(Ur,{strong:!0,className:$e.toolLabel,children:h}),O]},e.id),r=h=>w.jsx("pre",{className:$e.codePre,children:h}),s=this.props.onOpenFile,o=h=>s?w.jsx("span",{className:$e.pathTagClickable,onClick:O=>{O.stopPropagation(),s(h)},children:h}):w.jsx("span",{className:$e.pathTag,children:h});if(e.name==="Bash"){const h=n.command||"",O=n.description||"",p=h.split(`
890
+ `).length;return p>5?w.jsxs("div",{className:$e.toolBox,children:[w.jsxs(Ur,{strong:!0,className:$e.toolLabel,children:["Bash",O?w.jsxs("span",{className:$e.descSpan,children:[" — ",O]}):""]}),w.jsx(Ah,{ghost:!0,size:"small",items:[{key:"1",label:w.jsxs(Ur,{type:"secondary",className:$e.bashCollapseLabel,children:[le("ui.bashCommand")," (",p," ",le("ui.lines"),")"]}),children:r(h)}],className:$e.collapseMargin})]},e.id):i(w.jsxs(w.Fragment,{children:["Bash",O?w.jsxs("span",{className:$e.descSpan,children:[" — ",O]}):""]}),r(h))}if(e.name==="Read"){const h=n.file_path||"",O=[];n.offset&&O.push(`offset: ${n.offset}`),n.limit&&O.push(`limit: ${n.limit}`);const p=O.length?` (${O.join(", ")})`:"";return i(w.jsxs(w.Fragment,{children:["Read: ",o(h),w.jsx("span",{className:$e.secondarySpan,children:p})]}),null)}if(e.name==="Write"){const h=n.file_path||"",O=n.content||"",p=O.split(`
891
+ `);return i(w.jsxs(w.Fragment,{children:["Write: ",o(h)," ",w.jsxs("span",{className:$e.secondarySpan,children:["(",p.length," lines)"]})]}),r(O))}if(e.name==="Glob"){const h=n.pattern||"",O=n.path||"";return i(w.jsxs(w.Fragment,{children:["Glob: ",w.jsx("span",{className:$e.patternSpan,children:h}),O?w.jsxs("span",{className:$e.secondarySpan,children:[" in ",O]}):""]}),null)}if(e.name==="Grep"){const h=n.pattern||"",O=n.path||"",p=[];n.glob&&p.push(`glob: ${n.glob}`),n.output_mode&&p.push(`mode: ${n.output_mode}`),n.head_limit&&p.push(`limit: ${n.head_limit}`);const m=p.length?` (${p.join(", ")})`:"";return i(w.jsxs(w.Fragment,{children:["Grep: ",w.jsxs("span",{className:$e.patternSpan,children:["/",h,"/"]}),O?w.jsxs("span",{className:$e.secondarySpan,children:[" in ",O]}):"",w.jsx("span",{className:$e.secondarySpan,children:m})]}),null)}if(e.name==="Task"){const h=n.subagent_type||"",O=n.description||"";return i(w.jsxs(w.Fragment,{children:["Task(",h,O?": "+O:"",")"]}),null)}if(e.name==="AskUserQuestion"){const h=Array.isArray(n.questions)?n.questions:[],{askAnswerMap:O}=this.props,p=(O==null?void 0:O[e.id])||{},m=p.__rejected__===!0,g=!m&&Object.keys(p).length>0;if(!g&&!m&&this.props.onAskQuestionSubmit&&e.id===this.props.lastPendingAskId)return this.renderAskQuestionInteractive(e.id,h);const b=w.jsx("svg",{className:$e.askCheckSvg,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:w.jsx("path",{d:"M3 8.5L6.5 12L13 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})});return w.jsx("div",{className:$e.askQuestionBox,children:h.map((S,y)=>{var z;const Q=p[S.question],_=Q!=null&&S.multiSelect?Q.split(",").map(T=>T.trim()):[],P=T=>Q==null?!1:S.multiSelect?_.includes(T):Q===T,C=(z=S.options)==null?void 0:z.some(T=>P(T.label)),X=g&&Q!=null&&!C;return w.jsxs("div",{className:y<h.length-1?$e.questionSpacing:void 0,children:[S.header&&w.jsx("span",{className:$e.askQuestionHeader,children:S.header}),w.jsx("div",{className:$e.askQuestionText,children:S.question}),w.jsxs("div",{className:$e.optionList,children:[S.options&&S.options.map((T,k)=>{const x=P(T.label);return w.jsxs("div",{className:`${$e.askOptionItem}${x?" "+$e.askOptionSelected:""}`,children:[x?b:"○"," ",T.label,T.description&&w.jsxs("span",{className:$e.optionDesc,children:["— ",T.description]})]},k)}),X&&w.jsxs("div",{className:`${$e.askOptionItem} ${$e.askOptionSelected}`,children:[b," ",Q]})]})]},y)})},e.id)}if(e.name==="EnterPlanMode")return w.jsx("div",{className:$e.planModeBox,children:w.jsx("span",{className:$e.planModeLabel,children:le("ui.enterPlanMode")})},e.id);if(e.name==="ExitPlanMode"){const h=n.allowedPrompts||[],{planApprovalMap:O}=this.props,p=O&&O[e.id]||{status:"pending"},m=p.status==="pending",g=m&&this.props.cliMode&&e.id===this.props.lastPendingPlanId;let v=null;if(m){if(v=this.props.latestPlanContent||null,!v&&Array.isArray(this.props.content))for(const P of this.props.content){if(P===e)break;P.type==="tool_use"&&P.name==="Write"&&((d=P.input)!=null&&d.file_path)&&/\.claude\/plans\//i.test(P.input.file_path)&&P.input.content&&(v=P.input.content)}if(!v&&Array.isArray(this.props.content)){const P=[];for(const C of this.props.content){if(C===e)break;C.type==="text"&&C.text&&P.push(C.text)}v=P.join(`
892
892
 
893
893
  `).trim()||null}}if(p.status==="approved"&&p.planContent)return w.jsx("div",{className:$e.bubblePlan,children:w.jsx("div",{className:"chat-md",dangerouslySetInnerHTML:{__html:bo(p.planContent)}})},e.id);const $=jO(this.props.ptyPrompt)?this.props.ptyPrompt:this.props.activePlanPrompt||null,b=[{number:1,text:le("ui.planApprove"),selected:!0},{number:2,text:le("ui.planApproveWithEdits"),selected:!1},{number:3,text:le("ui.planReject"),selected:!1}],S=(u=$==null?void 0:$.options)!=null&&u.length?$.options:b,y=p.status==="approved"?$e.planStatusApproved:p.status==="rejected"?$e.planStatusRejected:p.status==="ultraplan"?$e.planStatusApproved:$e.planStatusPending,Q=p.status==="approved"?"✓":p.status==="rejected"?"✗":p.status==="ultraplan"?"⚡":"●",_=p.status==="approved"?"ui.planApproved":p.status==="rejected"?"ui.planRejected":p.status==="ultraplan"?"ui.planUltraplan":"ui.planPending";return w.jsxs("div",{className:`${$e.planModeBox} ${y}`,children:[g&&w.jsx("svg",{className:`${$e.borderSvg} ${$e.borderSvgInset}`,preserveAspectRatio:"none",children:w.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",rx:"6",ry:"6",fill:"none",stroke:"var(--color-primary)",strokeWidth:"1",strokeDasharray:"6 4",className:$e.borderRect})}),w.jsxs("div",{className:$e.planModeHeader,children:[w.jsx("span",{className:$e.planModeLabel,children:le(m?"ui.exitPlanMode":"ui.exitPlanModeResolved")}),!g&&w.jsxs("span",{className:`${$e.planStatusBadge} ${y}`,children:[Q," ",le(_)]})]}),m&&v&&w.jsx("div",{className:$e.planContentPreview,children:w.jsx("div",{className:"chat-md",dangerouslySetInnerHTML:{__html:bo(v)}})}),h.length>0&&w.jsxs("div",{className:$e.planModePermissions,children:[w.jsx("div",{className:$e.planModePermLabel,children:le("ui.allowedPrompts")}),h.map((P,C)=>w.jsxs("div",{className:$e.askOptionItem,children:["• ",P.prompt||P.tool]},C))]}),g&&!this.state.planFeedbackInput&&w.jsx("div",{className:$e.planApprovalActions,children:this.state.planApprovalSubmitting?w.jsx("button",{className:$e.planOptionBtn,disabled:!0,children:le("ui.askSubmitting")}):S.map((P,C)=>{const X=(P.text||"").toLowerCase();let z=$e.planOptionBtn;/yes|approve|accept|proceed/i.test(X)||$==null&&C===0?z=$e.planApproveBtn:(/no|reject|deny|feedback/i.test(X)||$==null&&C===2)&&(z=$e.planRejectBtn);const T=/type|tell|change|feedback|edit/i.test(P.text||"")||$==null&&C===1;return w.jsx("button",{className:z,onClick:()=>{T?this.setState({planFeedbackInput:!0,planFeedbackOptNumber:P.number,planFeedbackText:""}):(this.setState({planApprovalSubmitting:!0}),this.props.onPlanApprovalClick(P.number))},children:P.text},P.number)})}),g&&this.state.planFeedbackInput&&w.jsxs("div",{className:$e.planFeedbackInputWrap,children:[w.jsx("textarea",{className:$e.planFeedbackTextarea,placeholder:le("ui.planFeedbackPlaceholder"),value:this.state.planFeedbackText,onChange:P=>this.setState({planFeedbackText:P.target.value}),onKeyDown:P=>{if((P.ctrlKey||P.metaKey)&&P.key==="Enter"){P.preventDefault();const C=this.state.planFeedbackText.trim();C&&this.props.onPlanFeedbackSubmit&&(this.props.onPlanFeedbackSubmit(this.state.planFeedbackOptNumber,C),this.setState({planFeedbackInput:!1,planFeedbackText:"",planFeedbackOptNumber:null}))}},autoFocus:!0,rows:3}),w.jsxs("div",{className:$e.planFeedbackBtnRow,children:[w.jsx("button",{className:$e.planFeedbackCancelBtn,onClick:()=>this.setState({planFeedbackInput:!1,planFeedbackText:"",planFeedbackOptNumber:null}),children:le("ui.cancel")}),w.jsx("button",{className:$e.planFeedbackSendBtn,disabled:!this.state.planFeedbackText.trim(),onClick:()=>{const P=this.state.planFeedbackText.trim();P&&this.props.onPlanFeedbackSubmit&&(this.props.onPlanFeedbackSubmit(this.state.planFeedbackOptNumber,P),this.setState({planFeedbackInput:!1,planFeedbackText:"",planFeedbackOptNumber:null}))},children:le("ui.planFeedbackSubmit")})]})]}),p.status==="rejected"&&p.feedback&&w.jsxs("div",{className:$e.planFeedback,children:[w.jsxs("span",{className:$e.planFeedbackLabel,children:[le("ui.planFeedback"),":"]})," ",p.feedback]})]},e.id)}let a=e.name;const l=Object.keys(n);if(l.length===0)return i(a,null);const c=l.map(h=>{const O=n[h],p=typeof O=="string"?O:JSON.stringify(O),m=e.name==="Agent"||e.name==="TaskCreate"||p.length<=200?p:p.substring(0,200)+"...";return w.jsxs("div",{className:$e.kvItem,children:[w.jsxs("span",{className:$e.kvKey,children:[h,": "]}),w.jsx("span",{className:$e.kvValue,children:m})]},h)});return i(a,w.jsx("div",{className:$e.kvContainer,children:c}))}renderDangerApproval(e,n){if(!n)return null;const i=n.options||[];return w.jsxs("div",{className:$e.dangerApprovalBox,children:[w.jsxs("div",{className:$e.dangerApprovalHeader,children:[w.jsx("span",{className:$e.dangerApprovalIcon,children:"⚠"}),w.jsx("span",{className:$e.dangerApprovalLabel,children:le("ui.dangerApproval")})]}),w.jsx("div",{className:$e.dangerApprovalActions,children:i.map(r=>{const s=(r.text||"").toLowerCase();let o=$e.dangerOptionBtn;return/^no/i.test(s)||/deny/i.test(s)?o=$e.dangerRejectBtn:(/^yes/i.test(s)||/allow/i.test(s))&&(o=$e.dangerApproveBtn),w.jsx("button",{className:o,onClick:()=>{this.props.onDangerousApprovalClick&&this.props.onDangerousApprovalClick(r.number)},children:r.text},r.number)})})]},`danger-${e}`)}renderAskQuestionInteractive(e,n){return w.jsx(jge,{questions:n,onSubmit:i=>{this.props.onAskQuestionSubmit&&this.props.onAskQuestionSubmit(i,e,n)}},e)}renderHighlightBubble(e,n){const{highlight:i}=this.props,r=`${e}${i==="active"?" "+$e.bubbleHighlight:""}${i==="fading"?" "+$e.bubbleHighlightFading:""}`,s=e===$e.bubbleUser;return w.jsxs("div",{className:`${r} ${$e.bubbleRelative}`,children:[(i==="active"||i==="fading")&&w.jsx("svg",{className:`${$e.borderSvg}${i==="fading"?" "+$e.borderSvgFading:""}`,preserveAspectRatio:"none",children:w.jsx("rect",{x:"0.5",y:"0.5",width:"calc(100% - 1px)",height:"calc(100% - 1px)",rx:"8",ry:"8",fill:"none",stroke:s?"var(--text-white)":"var(--color-primary)",strokeWidth:"1",strokeDasharray:"6 4",className:$e.borderRect})}),n]})}renderUserMessage(){const{text:e,timestamp:n}=this.props,i=this.formatTime(n),r=this.getUserName();return e&&e.includes("This session is being continued from a previous conversation that ran out of context")?w.jsxs("div",{className:$e.messageRowEnd,children:[w.jsxs("div",{className:$e.contentColLimited,children:[w.jsxs("div",{className:$e.labelRow,children:[i&&w.jsx(Ur,{className:$e.timeTextNoMargin,children:i}),this.renderViewRequestBtn(),w.jsxs(Ur,{type:"secondary",className:$e.labelTextRight,children:[r," — /compact"]})]}),this.renderHighlightBubble($e.bubbleUser,w.jsx(Ah,{ghost:!0,size:"small",items:[{key:"1",label:w.jsx(Ur,{className:$e.compactLabel,children:"Compact Summary"}),children:w.jsx("pre",{className:$e.compactPre,children:e})}],className:$e.collapseNoMargin}))]}),this.renderUserAvatar("#1e40af")]}):w.jsxs("div",{className:$e.messageRowEnd,children:[w.jsxs("div",{className:$e.contentColLimited,children:[w.jsxs("div",{className:$e.labelRow,children:[i&&w.jsx(Ur,{className:$e.timeTextNoMargin,children:i}),this.renderViewRequestBtn(),w.jsx(Ur,{type:"secondary",className:$e.labelTextRight,children:r})]}),this.renderHighlightBubble($e.bubbleUser,this.renderUserTextWithImages(e))]}),this.renderUserAvatar("#1e40af")]})}renderUserTextWithImages(e){if(!e)return e||"";const n=/\.(png|jpe?g|gif|webp|svg|bmp|ico)$/i,i=/\[Image(?:\s*#\d+)?(?::?\s*source)?:\s*([^\]]+)\]|"(\/tmp\/cc-viewer-uploads\/[^"]+?)"/g,r=[];let s=0,o;for(;(o=i.exec(e))!==null;){const a=(o[1]||o[2]||"").trim();if(!a||!n.test(a))continue;o.index>s&&r.push(w.jsx("span",{children:e.slice(s,o.index)},`t-${s}`));const l=o[0];r.push(w.jsx(Nve,{src:pt(`/api/file-raw?path=${encodeURIComponent(a)}`),alt:a.split("/").pop(),fallbackText:l},`img-${o.index}`)),s=o.index+o[0].length}return r.length===0?e:(s<e.length&&r.push(w.jsx("span",{children:e.slice(s)},`t-${s}`)),w.jsx(w.Fragment,{children:r}))}renderToolResult(e){return e?w.jsx(hR,{toolName:e.toolName,toolInput:e.toolInput,resultText:e.resultText,defaultCollapsed:this.props.collapseToolResults}):null}renderAssistantContent(e,n={}){const i=e.filter(c=>c.type==="thinking"),r=e.filter(c=>c.type==="text"),s=e.filter(c=>c.type==="tool_use");let o=[];i.forEach((c,d)=>{const u=c.thinking||"",h=!u.trim();o.push(w.jsx(Ah,{ghost:!0,size:"small",defaultActiveKey:this.props.expandThinking?["1"]:[],items:[{key:"1",label:w.jsx(Ur,{type:"secondary",className:$e.thinkingLabel,children:le("ui.thinking")}),children:h?w.jsxs("div",{className:$e.thinkingEmptyHint,children:[w.jsx(Ur,{type:"secondary",className:$e.thinkingEmptyText,children:le("ui.thinkingEmpty")}),!this.props.showThinkingSummaries&&w.jsx(Fo,{title:le("ui.enableThinkingSummariesTip"),children:w.jsx(ai,{size:"small",type:"primary",ghost:!0,className:$e.enableThinkingBtn,onClick:async O=>{O.stopPropagation();try{(await fetch(pt("/api/claude-settings"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({showThinkingSummaries:!0})})).ok&&ti.success(le("ui.enableThinkingSummariesTip"))}catch{ti.error("Failed to save setting")}},children:le("ui.enableThinkingSummaries")})})]}):w.jsx("div",{className:"chat-md",dangerouslySetInnerHTML:{__html:bo(u)}})}],className:$e.collapseMargin},`think-${d}-${this.props.expandThinking?"e":"c"}`))}),r.forEach((c,d)=>{if(c.text){const{segments:u}=Ipe(c.text);o.push(w.jsx("div",{className:"chat-boxer",children:this.renderSegments(u)},`text-${d}`))}});const a=!this.props.showFullToolContent;let l=!1;return s.forEach((c,d)=>{const u=c.name==="Edit"||c.name==="Write"||c.name==="EnterPlanMode"||c.name==="ExitPlanMode"||c.name==="AskUserQuestion"||c.name==="Agent"||c.name==="TaskCreate";a&&!u?(l||(l=!0,o.push(w.jsx("span",{className:$e.simplifiedToolLabel,children:le("ui.toolsUsed")},`stag-label-${d}`))),o.push(w.jsx(Sl,{placement:"top",overlayClassName:"simplifiedToolPopover",overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-hover)",borderRadius:8,padding:0},content:w.jsx("div",{className:$e.simplifiedToolPopoverContent,children:this.renderToolCall(c)}),mouseEnterDelay:.3,...Ft?{trigger:"click",getPopupContainer:p=>p.parentElement}:{},children:w.jsx("span",{className:$e.simplifiedToolTag,children:c.name})},`stag-${c.id}`))):(l=!1,o.push(this.renderToolCall(c)));const h=n[c.id];if(!h&&!s.slice(0,d).some(p=>!n[p.id])&&this.props.activeDangerousPrompt&&this.props.cliMode){const p=this.props.activeDangerousPrompt;o.push(this.renderDangerApproval(c.id,p))}if(h){const m=(this.props.planApprovalMap||{})[c.id];c.name==="ExitPlanMode"&&m&&m.status==="approved"&&m.planContent||(a?h.isPermissionDenied&&o.push(w.jsx(Z.Fragment,{children:h.isUltraplan?w.jsx("div",{className:$e.ultraplanBadge,children:"◇ Ultraplan"}):w.jsxs("div",{className:`${$e.dangerApprovalBox} ${$e.dangerApprovalBoxDenied}`,children:[w.jsxs("span",{className:$e.dangerDeniedBadge,children:["✗ ",le("ui.dangerDenied")]}),h.resultText&&w.jsx("div",{className:$e.dangerDeniedDetail,children:h.resultText})]})},`tr-denied-${c.id}`)):h.isPermissionDenied?o.push(w.jsx(Z.Fragment,{children:h.isUltraplan?w.jsx("div",{className:$e.ultraplanBadge,children:"◇ Ultraplan"}):w.jsxs("div",{className:`${$e.dangerApprovalBox} ${$e.dangerApprovalBoxDenied}`,children:[w.jsxs("span",{className:$e.dangerDeniedBadge,children:["✗ ",le("ui.dangerDenied")]}),h.resultText&&w.jsx("div",{className:$e.dangerDeniedDetail,children:h.resultText})]})},`tr-denied-${c.id}`)):o.push(w.jsx(Z.Fragment,{children:this.renderToolResult(h)},`tr-${c.id}`)))}}),o}renderAssistantMessage(){const{content:e,toolResultMap:n={},modelInfo:i}=this.props,r=this.renderAssistantContent(e,n);return r.length===0?null:w.jsxs("div",{className:$e.messageRow,children:[this.renderModelAvatar(i),w.jsxs("div",{className:$e.contentCol,children:[this.renderLabel((i==null?void 0:i.name)||"MainAgent"),this.renderHighlightBubble($e.bubbleAssistant,r)]})]})}_getSubAvatarType(){if(this.props.isTeammate)return"teammate";const n=(this.props.label||"").match(/SubAgent:\s*(\w+)/i),i=n?n[1].toLowerCase():"";return i==="explore"||i==="search"?"sub-search":i==="plan"?"sub-plan":"sub"}renderSubAgentChatMessage(){const{content:e,toolResultMap:n={},label:i}=this.props,r=this.renderAssistantContent(e,n);return r.length===0?null:w.jsxs("div",{className:$e.messageRowEnd,children:[w.jsxs("div",{className:$e.contentColLimited,children:[w.jsxs("div",{className:$e.labelRowEnd,children:[this.formatTime(this.props.timestamp)&&w.jsx(Ur,{className:$e.timeText,children:this.formatTime(this.props.timestamp)}),this.renderViewRequestBtn(),w.jsx(Ur,{type:"secondary",className:$e.labelTextRight,children:i||"SubAgent"})]}),this.renderHighlightBubble($e.bubbleAssistant,r)]}),(()=>{const s=this.props.isTeammate?Bu(i):null;return w.jsx("div",{className:$e.avatar,style:{background:s?s.color:"var(--bg-surface)"},dangerouslySetInnerHTML:{__html:s?s.svg:y_(this._getSubAvatarType())}})})()]})}renderSubAgentMessage(){const{label:e,resultText:n,toolName:i,toolInput:r}=this.props,s=this.props.isTeammate?Bu(e):null;return w.jsxs("div",{className:$e.messageRow,children:[w.jsx("div",{className:$e.avatar,style:{background:s?s.color:"var(--bg-surface)"},dangerouslySetInnerHTML:{__html:s?s.svg:y_(this._getSubAvatarType())}}),w.jsxs("div",{className:$e.contentCol,children:[this.renderLabel(e),w.jsx("div",{className:$e.bubbleSubAgent,children:w.jsx(hR,{toolName:i,toolInput:r,resultText:n})})]})]})}renderPlanPromptMessage(){const{text:e,timestamp:n,modelInfo:i}=this.props;this.formatTime(n);const r=(e||"").replace(/^[\s\S]*?Implement the following plan:\s*/i,"");return w.jsxs("div",{className:$e.messageRow,children:[this.renderModelAvatar(i),w.jsxs("div",{className:$e.contentColLimited,children:[this.renderLabel((i==null?void 0:i.name)||"MainAgent"," (Plan)"),w.jsx("div",{className:$e.bubblePlan,children:w.jsx("div",{className:"chat-md",dangerouslySetInnerHTML:{__html:bo(r)}})})]})]})}renderSkillLoadedMessage(){const{text:e,skillName:n,timestamp:i}=this.props,r=this.formatTime(i);return w.jsxs("div",{className:$e.messageRow,children:[w.jsx("div",{className:$e.skillSpacer}),w.jsx("div",{className:$e.contentCol,children:w.jsx(Ah,{ghost:!0,size:"small",items:[{key:"1",label:w.jsxs("span",{className:$e.skillLabel,children:["📦 ",le("ui.skillLoaded"),": ",n,r&&w.jsx(Ur,{className:`${$e.timeTextNoMargin} ${$e.skillTimeIndent}`,children:r})]}),children:w.jsx("div",{className:"chat-md",dangerouslySetInnerHTML:{__html:bo(e)}})}],className:$e.collapseNoMargin})})]})}render(){const{role:e}=this.props;return e==="user"?this.renderUserMessage():e==="skill-loaded"?this.renderSkillLoadedMessage():e==="plan-prompt"?this.renderPlanPromptMessage():e==="assistant"?this.renderAssistantMessage():e==="sub-agent-chat"?this.renderSubAgentChatMessage():e==="sub-agent"?this.renderSubAgentMessage():null}}/**
894
894
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
@@ -1088,17 +1088,17 @@ https://github.com/highlightjs/highlight.js/issues/2277`),un=be,qt=ze),rt===void
1088
1088
  `).map((m,g)=>({type:"add",oldNum:null,newNum:g+1,text:m})):s?(e||"").split(`
1089
1089
  `).map((m,g)=>({type:"del",oldNum:g+1,newNum:null,text:m})):yAe(e,n),[e,n,s,o]),u=f.useMemo(()=>{let p=0,m=0;return d.map(g=>{let v;return g.type==="del"?(v=l[p]??"",p++):g.type==="add"?(v=c[m]??"",m++):(v=c[m]??"",p++,m++),{...g,html:v}})},[d,l,c]),h=u.filter(p=>p.type==="add").length,O=u.filter(p=>p.type==="del").length;return w.jsxs("div",{className:Di.fullFileDiffView,children:[w.jsxs("div",{className:Di.diffSummary,children:[h>0&&w.jsxs("span",{className:Di.addedBadge,children:["+",h]}),O>0&&w.jsxs("span",{className:Di.deletedBadge,children:["-",O]})]}),w.jsxs("div",{className:Di.codeContainer,children:[w.jsx("div",{className:Di.lineNumberCol,ref:i,children:u.map((p,m)=>{let g=Di.lineNumNormal;return p.type==="add"?g=Di.lineNumAdd:p.type==="del"&&(g=Di.lineNumDelete),w.jsxs("div",{className:`${Di.lineNumRow} ${g}`,children:[w.jsx("span",{className:Di.oldLineNum,children:p.oldNum??""}),w.jsx("span",{className:Di.newLineNum,children:p.newNum??""})]},m)})}),w.jsxs("div",{className:Di.codeColWrap,children:[w.jsx("div",{className:Di.codeCol,ref:r,children:w.jsx("div",{className:Di.codeInner,children:u.map((p,m)=>{let g;p.type==="add"?g=Di.lineAdd:p.type==="del"?g=Di.lineDelete:g=Di.lineNormal;const v=p.type==="add"?"+":p.type==="del"?"-":" ";return w.jsxs("div",{className:`${Di.codeLine} ${g}`,children:[w.jsx("span",{className:Di.linePrefix,children:v}),w.jsx("span",{className:Di.lineContent,dangerouslySetInnerHTML:{__html:p.html||" "}})]},m)})})}),w.jsx($Ae,{diffLines:u,scrollRef:r})]})]})]})}const QAe="_gitDiffView_197od_1",xAe="_closing_197od_21",wAe="_header_197od_36",PAe="_headerLeft_197od_46",CAe="_backBtn_197od_54",TAe="_filePath_197od_75",kAe="_diffBadge_197od_91",RAe="_headerRight_197od_103",EAe="_closeBtn_197od_109",XAe="_contentContainer_197od_129",zAe="_loading_197od_135",IAe="_error_197od_144",AAe="_binaryNotice_197od_155",MAe="_largeFileWarning_197od_167",jAe="_fileSize_197od_180",NAe="_imagePreviewWrap_197od_186",WAe="_imagePreview_197od_186",zr={gitDiffView:QAe,closing:xAe,header:wAe,headerLeft:PAe,backBtn:CAe,filePath:TAe,diffBadge:kAe,headerRight:RAe,closeBtn:EAe,contentContainer:XAe,loading:zAe,error:IAe,binaryNotice:AAe,largeFileWarning:MAe,fileSize:jAe,imagePreviewWrap:NAe,imagePreview:WAe};function _3(t,e){const n=(t||"").split(`
1090
1090
  `),i=(e||"").split(`
1091
- `);for(let r=0;r<i.length;r++)if(n[r]!==i[r])return r+1;return 1}function LAe({filePath:t,onClose:e,onOpenFile:n}){const[i,r]=f.useState(null),[s,o]=f.useState(null),[a,l]=f.useState(!0),[c,d]=f.useState(!1),[u,h]=f.useState(!1),O=f.useRef(!0),p=f.useRef(null),m=f.useCallback(()=>{if(c)return;d(!0);const g=p.current;g?g.addEventListener("animationend",()=>e(),{once:!0}):e()},[c,e]);return f.useEffect(()=>(O.current=!0,l(!0),r(null),o(null),h(!1),fetch(pt(`/api/git-diff?files=${encodeURIComponent(t)}`)).then(g=>g.ok?g.json():g.json().then(v=>{throw new Error(v.error||"Failed to load diff")}).catch(()=>{throw new Error(`HTTP ${g.status}`)})).then(g=>{O.current&&(g.diffs&&g.diffs[0]?r(g.diffs[0]):o("No diff data available"),l(!1))}).catch(g=>{O.current&&(o(`${le("ui.fileLoadError")}: ${g.message}`),l(!1))}),()=>{O.current=!1}),[t]),w.jsxs("div",{ref:p,className:`${zr.gitDiffView}${c?` ${zr.closing}`:""}`,children:[w.jsxs("div",{className:zr.header,children:[w.jsxs("div",{className:zr.headerLeft,children:[w.jsx("button",{className:zr.backBtn,onClick:m,title:le("ui.backToChat"),children:w.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("polyline",{points:"15 18 9 12 15 6"})})}),w.jsx("span",{className:zr.filePath,onClick:()=>{if(n&&i){const g=_3(i.old_content,i.new_content);n(t,g)}},role:"button",tabIndex:0,onKeyDown:g=>{if((g.key==="Enter"||g.key===" ")&&n&&i){const v=_3(i.old_content,i.new_content);n(t,v)}},children:t}),w.jsx("span",{className:zr.diffBadge,children:"DIFF"})]}),w.jsx("div",{className:zr.headerRight,children:w.jsx("button",{className:zr.closeBtn,onClick:m,title:le("ui.backToChat"),children:w.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),w.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})})]}),w.jsxs("div",{className:zr.contentContainer,children:[a&&w.jsx("div",{className:zr.loading,children:le("ui.loading")}),s&&w.jsx("div",{className:zr.error,children:s}),!a&&!s&&i&&w.jsx(w.Fragment,{children:i.is_large?w.jsxs("div",{className:zr.largeFileWarning,children:[w.jsx("p",{children:le("ui.largeFileWarning")}),w.jsxs("p",{className:zr.fileSize,children:[le("ui.fileSize"),": ",(i.size/(1024*1024)).toFixed(2)," MB"]})]}):pV(t)&&!i.is_deleted?w.jsxs("div",{className:zr.imagePreviewWrap,children:[w.jsx("img",{className:zr.imagePreview,src:pt(`/api/file-raw?path=${encodeURIComponent(t)}`),alt:t,onClick:()=>h(!0)}),u&&w.jsx(QP,{src:pt(`/api/file-raw?path=${encodeURIComponent(t)}`),alt:t,onClose:()=>h(!1)})]}):i.is_binary?w.jsx("div",{className:zr.binaryNotice,children:le("ui.binaryFileNotice")}):w.jsx(_Ae,{file_path:t,old_string:i.old_content,new_string:i.new_content})})]})]})}const VAe="_panel_107wt_1",BAe="_panelGlobal_107wt_15",YAe="_toolName_107wt_30",DAe="_command_107wt_34",UAe="_allowBtn_107wt_40",qAe="_allowSessionBtn_107wt_41",ZAe="_denyBtn_107wt_42",GAe="_borderSvg_107wt_47",FAe="_borderSvgInset_107wt_56",HAe="_borderRect_107wt_60",KAe="_exiting_107wt_79",JAe="_header_107wt_83",eMe="_label_107wt_97",tMe="_body_107wt_104",nMe="_detail_107wt_124",iMe="_actions_107wt_135",qr={panel:VAe,panelGlobal:BAe,toolName:YAe,command:DAe,allowBtn:UAe,allowSessionBtn:qAe,denyBtn:ZAe,borderSvg:GAe,borderSvgInset:FAe,borderRect:HAe,exiting:KAe,header:JAe,label:eMe,body:tMe,detail:nMe,actions:iMe};function Q3({toolName:t,toolInput:e,requestId:n,onAllow:i,onAllowSession:r,onDeny:s,visible:o,global:a}){const l=f.useRef(null),c=f.useRef(null),d=f.useRef(null),[u,h]=f.useState(!1),[O,p]=f.useState(!1);f.useEffect(()=>{if(o)h(!0),p(!1),d.current=document.activeElement,requestAnimationFrame(()=>{var $;return($=c.current)==null?void 0:$.focus()});else if(u){p(!0);const $=setTimeout(()=>{h(!1),p(!1)},200);return()=>clearTimeout($)}},[o]);const m=f.useCallback($=>{var b;if($.key==="Escape"){s(n);return}if($.key==="Tab"){$.preventDefault();const S=(b=l.current)==null?void 0:b.querySelectorAll("button");if(!(S!=null&&S.length))return;const y=Array.from(S),Q=y.indexOf(document.activeElement),_=$.shiftKey?Q<=0?y.length-1:Q-1:Q>=y.length-1?0:Q+1;y[_].focus()}},[s,n]),g=f.useMemo(()=>{if(!e)return"";switch(t){case"Bash":return e.command||"";case"Edit":return e.file_path||"";case"Write":return e.file_path||"";case"NotebookEdit":return e.notebook_path||"";default:return JSON.stringify(e,null,2).slice(0,500)}},[t,e]),v=f.useMemo(()=>{if(!e)return null;if(t==="Bash"&&e.description)return e.description;if(t==="Edit"&&e.old_string!=null){const $=String(e.old_string).slice(0,80),b=String(e.new_string).slice(0,80);return`${$} → ${b}`}return null},[t,e]);return u?w.jsxs("div",{ref:l,className:`${a?qr.panelGlobal:qr.panel}${O?` ${qr.exiting}`:""}`,onKeyDown:m,children:[w.jsx("svg",{className:`${qr.borderSvg} ${qr.borderSvgInset}`,preserveAspectRatio:"none",children:w.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",rx:"12",ry:"12",fill:"none",stroke:"#f59e0b",strokeWidth:"1",strokeDasharray:"6 4",className:qr.borderRect})}),w.jsxs("div",{className:qr.header,children:[w.jsx("span",{className:qr.toolName,children:t}),w.jsx("span",{className:qr.label,children:le("ui.permission.approvalRequired")})]}),w.jsxs("div",{className:qr.body,children:[w.jsx("pre",{className:qr.command,children:g}),v&&w.jsx("div",{className:qr.detail,children:v})]}),w.jsxs("div",{className:qr.actions,children:[w.jsx("button",{className:qr.denyBtn,onClick:()=>s(n),children:le("ui.permission.deny")}),r&&w.jsx("button",{className:qr.allowSessionBtn,onClick:()=>r(n),children:le("ui.permission.allowSession")}),w.jsx("button",{ref:c,className:qr.allowBtn,onClick:()=>i(n),children:le("ui.permission.allow")})]})]}):null}function JC(t){const e=t==null?void 0:t.content;if(typeof e=="string")return e;if(Array.isArray(e)){for(const n of e)if((n==null?void 0:n.type)==="text"&&n.text)return n.text}return""}function rMe(t){const e=t.body||{},n=Vu(e);if(/Extract any file paths/i.test(n)||/process Bash commands/i.test(n)||/command execution specialist/i.test(n))return"Bash";if(/file search specialist/i.test(n))return"Search";if(/planning specialist/i.test(n))return"Plan";if(/general-purpose agent/i.test(n))return"General";const i=e.messages||[];for(let r=i.length-1;r>=0;r--){if(i[r].role!=="user")continue;const s=JC(i[r]);if(/^Command:/m.test(s))return"Bash";break}return null}function sMe(t){var i;const e=(i=t.body)==null?void 0:i.messages;if(!Array.isArray(e)||e.length!==1)return!1;const n=e[0];return n.role==="user"&&n.content==="count"}function oMe(t,e){var l;const n=t.body||{},i=n.tools,r=n.messages||[];if(Array.isArray(i)&&i.length>0||r.length!==1||r[0].role!=="user")return!1;const s=JC(r[0]);if(!s||s.trim()==="count")return!1;const o=s.trim();if(/^Command:/m.test(s)||/^<policy_spec>/i.test(o)||/^<task-notification>/i.test(o))return!1;const a=Vu(n);if(!a.includes("Claude Code")||/process Bash commands/i.test(a)||/Extract any file paths/i.test(a))return!1;if(e){const c=((l=e.body)==null?void 0:l.messages)||[],d=s.slice(0,80);if(c.some(h=>{const O=h==null?void 0:h.content;return typeof O=="string"?O.includes(d):Array.isArray(O)?O.some(p=>(p==null?void 0:p.type)==="text"&&p.text&&p.text.includes(d)):!1}))return!0}return!1}function Lx(t,e){var i;if(uP(t))return t.teammate?{type:"Teammate",subType:t.teammate}:(t._cachedTeammateName===void 0&&(t._cachedTeammateName=Yue(t.body)||null),{type:"Teammate",subType:t._cachedTeammateName});if(js(t))return{type:"MainAgent",subType:null};if(t.isCountTokens||sMe(t))return{type:"Count",subType:null};if(oMe(t,e)){const r=JC((((i=t.body)==null?void 0:i.messages)||[])[0]);return/Implement the following plan:/i.test(r.trim())?{type:"Plan",subType:"Prompt"}:{type:"Preflight",subType:null}}return{type:"SubAgent",subType:rMe(t)}}function RV(t,e){return t==="Teammate"&&e?`Teammate:${e}`:t==="Plan"&&e?`Plan:${e}`:t==="SubAgent"&&e?`SubAgent:${e}`:t}function EV(t,e){const n=t||"X";if(!e)return`Teammate: ${n}`;const i=e.replace(/^claude-/i,"").replace(/-\d{8}$/,"");return`Teammate: ${n}(${i})`}const aMe="\x1B[B",XV="\x1B[A",Vx="\x1B[C",lMe=" ",ih="\r";function N$(t,e){const n=[],i=e-t,r=i>0?aMe:XV;for(let s=0;s<Math.abs(i);s++)n.push(r);return n}function W$(t){if(t&&t.options){const e=t.options.findIndex(n=>n.selected);return e>=0?e:0}return 0}function cMe(t,e,n=!1){const i=[];let r=W$(e),s=t.optionIndex;if(e&&e.options){const o=t.optionIndex+1,a=e.options.findIndex(l=>l.number===o);a>=0&&(s=a)}return i.push(...N$(r,s)),i.push(ih),n&&t.isLast&&i.push(ih),i}function dMe(t,e,n=!1){const i=[],r=(t.selectedIndices||[]).slice().sort((o,a)=>o-a);let s=W$(e);for(const o of r)i.push(...N$(s,o)),i.push(lMe),s=o;return i.push(Vx),(t.isLast||!n)&&i.push(ih),i}function uMe(t,e,n=!1){const i=[];let r=W$(e);const s=t.optionIndex;i.push(...N$(r,s));const o=t.text||"";for(const a of o)i.push(a);return i.push(ih),n&&t.isLast&&i.push(ih),i}function hMe(t,e,n=!1){const i=[];let r=W$(e);const s=t.optionIndex;i.push(...N$(r,s));const o=t.text||"";for(const a of o)i.push(a);if(o.length>0){const a=[...o];i.push(a[a.length-1])}return i.push(Vx),i.push(XV),i.push(Vx),(t.isLast||!n)&&i.push(ih),i}function OMe(t,e,n=!1){return t.type==="multi"?dMe(t,e,n):t.type==="other"&&t.isMultiSelect?hMe(t,e,n):t.type==="other"?uMe(t,e,n):cMe(t,e,n)}const b0=new WeakMap;function x3(t){return b0.get(t)||null}function fMe(t,e){b0.set(t,e)}function zV(){return{toolUseMap:{},toolResultMap:{},readContentMap:{},editSnapshotMap:{},askAnswerMap:{},planApprovalMap:{},latestPlanContent:null,_fileState:{}}}function Gg(t,e,n){var d,u;const{toolUseMap:i,toolResultMap:r,readContentMap:s,editSnapshotMap:o,askAnswerMap:a,planApprovalMap:l,_fileState:c}=t;for(let h=n;h<e.length;h++){const O=e[h];if(O.role==="assistant"&&Array.isArray(O.content)){for(const p of O.content)if(p.type==="tool_use"){let m=p;if(typeof p.input=="string")try{const g=p.input.replace(/^\[object Object\]/,"");m={...p,input:JSON.parse(g)}}catch{}if(i[m.id]=m,m.name==="Write"&&((d=m.input)!=null&&d.file_path)&&/[/\\]\.claude[/\\]plans[/\\]/.test(m.input.file_path)&&m.input.content&&(t.latestPlanContent=m.input.content),m.name==="Edit"&&m.input){const g=m.input.file_path,v=m.input.old_string,$=m.input.new_string;if(g&&v!=null&&$!=null&&c[g]){const b=c[g];o[m.id]={plainText:b.plainText,lineNums:b.lineNums.slice()};const S=b.plainText.indexOf(v);if(S>=0){const Q=b.plainText.substring(0,S).split(`
1091
+ `);for(let r=0;r<i.length;r++)if(n[r]!==i[r])return r+1;return 1}function LAe({filePath:t,onClose:e,onOpenFile:n}){const[i,r]=f.useState(null),[s,o]=f.useState(null),[a,l]=f.useState(!0),[c,d]=f.useState(!1),[u,h]=f.useState(!1),O=f.useRef(!0),p=f.useRef(null),m=f.useCallback(()=>{if(c)return;d(!0);const g=p.current;g?g.addEventListener("animationend",()=>e(),{once:!0}):e()},[c,e]);return f.useEffect(()=>(O.current=!0,l(!0),r(null),o(null),h(!1),fetch(pt(`/api/git-diff?files=${encodeURIComponent(t)}`)).then(g=>g.ok?g.json():g.json().then(v=>{throw new Error(v.error||"Failed to load diff")}).catch(()=>{throw new Error(`HTTP ${g.status}`)})).then(g=>{O.current&&(g.diffs&&g.diffs[0]?r(g.diffs[0]):o("No diff data available"),l(!1))}).catch(g=>{O.current&&(o(`${le("ui.fileLoadError")}: ${g.message}`),l(!1))}),()=>{O.current=!1}),[t]),w.jsxs("div",{ref:p,className:`${zr.gitDiffView}${c?` ${zr.closing}`:""}`,children:[w.jsxs("div",{className:zr.header,children:[w.jsxs("div",{className:zr.headerLeft,children:[w.jsx("button",{className:zr.backBtn,onClick:m,title:le("ui.backToChat"),children:w.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("polyline",{points:"15 18 9 12 15 6"})})}),w.jsx("span",{className:zr.filePath,onClick:()=>{if(n&&i){const g=_3(i.old_content,i.new_content);n(t,g)}},role:"button",tabIndex:0,onKeyDown:g=>{if((g.key==="Enter"||g.key===" ")&&n&&i){const v=_3(i.old_content,i.new_content);n(t,v)}},children:t}),w.jsx("span",{className:zr.diffBadge,children:"DIFF"})]}),w.jsx("div",{className:zr.headerRight,children:w.jsx("button",{className:zr.closeBtn,onClick:m,title:le("ui.backToChat"),children:w.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),w.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})})]}),w.jsxs("div",{className:zr.contentContainer,children:[a&&w.jsx("div",{className:zr.loading,children:le("ui.loading")}),s&&w.jsx("div",{className:zr.error,children:s}),!a&&!s&&i&&w.jsx(w.Fragment,{children:i.is_large?w.jsxs("div",{className:zr.largeFileWarning,children:[w.jsx("p",{children:le("ui.largeFileWarning")}),w.jsxs("p",{className:zr.fileSize,children:[le("ui.fileSize"),": ",(i.size/(1024*1024)).toFixed(2)," MB"]})]}):pV(t)&&!i.is_deleted?w.jsxs("div",{className:zr.imagePreviewWrap,children:[w.jsx("img",{className:zr.imagePreview,src:pt(`/api/file-raw?path=${encodeURIComponent(t)}`),alt:t,onClick:()=>h(!0)}),u&&w.jsx(QP,{src:pt(`/api/file-raw?path=${encodeURIComponent(t)}`),alt:t,onClose:()=>h(!1)})]}):i.is_binary?w.jsx("div",{className:zr.binaryNotice,children:le("ui.binaryFileNotice")}):w.jsx(_Ae,{file_path:t,old_string:i.old_content,new_string:i.new_content})})]})]})}const VAe="_panel_pnqwz_1",BAe="_panelGlobal_pnqwz_15",YAe="_toolName_pnqwz_30",DAe="_command_pnqwz_34",UAe="_allowBtn_pnqwz_40",qAe="_allowSessionBtn_pnqwz_41",ZAe="_denyBtn_pnqwz_42",GAe="_borderSvg_pnqwz_47",FAe="_borderSvgInset_pnqwz_56",HAe="_borderRect_pnqwz_60",KAe="_exiting_pnqwz_79",JAe="_header_pnqwz_83",eMe="_label_pnqwz_97",tMe="_body_pnqwz_104",nMe="_detail_pnqwz_124",iMe="_actions_pnqwz_135",qr={panel:VAe,panelGlobal:BAe,toolName:YAe,command:DAe,allowBtn:UAe,allowSessionBtn:qAe,denyBtn:ZAe,borderSvg:GAe,borderSvgInset:FAe,borderRect:HAe,exiting:KAe,header:JAe,label:eMe,body:tMe,detail:nMe,actions:iMe};function Q3({toolName:t,toolInput:e,requestId:n,onAllow:i,onAllowSession:r,onDeny:s,visible:o,global:a}){const l=f.useRef(null),c=f.useRef(null),d=f.useRef(null),[u,h]=f.useState(!1),[O,p]=f.useState(!1);f.useEffect(()=>{if(o)h(!0),p(!1),d.current=document.activeElement,requestAnimationFrame(()=>{var $;return($=c.current)==null?void 0:$.focus()});else if(u){p(!0);const $=setTimeout(()=>{h(!1),p(!1)},200);return()=>clearTimeout($)}},[o]);const m=f.useCallback($=>{var b;if($.key==="Escape"){s(n);return}if($.key==="Tab"){$.preventDefault();const S=(b=l.current)==null?void 0:b.querySelectorAll("button");if(!(S!=null&&S.length))return;const y=Array.from(S),Q=y.indexOf(document.activeElement),_=$.shiftKey?Q<=0?y.length-1:Q-1:Q>=y.length-1?0:Q+1;y[_].focus()}},[s,n]),g=f.useMemo(()=>{if(!e)return"";switch(t){case"Bash":return e.command||"";case"Edit":return e.file_path||"";case"Write":return e.file_path||"";case"NotebookEdit":return e.notebook_path||"";default:return JSON.stringify(e,null,2).slice(0,500)}},[t,e]),v=f.useMemo(()=>{if(!e)return null;if(t==="Bash"&&e.description)return e.description;if(t==="Edit"&&e.old_string!=null){const $=String(e.old_string).slice(0,80),b=String(e.new_string).slice(0,80);return`${$} → ${b}`}return null},[t,e]);return u?w.jsxs("div",{ref:l,className:`${a?qr.panelGlobal:qr.panel}${O?` ${qr.exiting}`:""}`,onKeyDown:m,children:[w.jsx("svg",{className:`${qr.borderSvg} ${qr.borderSvgInset}`,preserveAspectRatio:"none",children:w.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",rx:"12",ry:"12",fill:"none",stroke:"var(--color-approval-border)",strokeWidth:"1",strokeDasharray:"6 4",className:qr.borderRect})}),w.jsxs("div",{className:qr.header,children:[w.jsx("span",{className:qr.toolName,children:t}),w.jsx("span",{className:qr.label,children:le("ui.permission.approvalRequired")})]}),w.jsxs("div",{className:qr.body,children:[w.jsx("pre",{className:qr.command,children:g}),v&&w.jsx("div",{className:qr.detail,children:v})]}),w.jsxs("div",{className:qr.actions,children:[w.jsx("button",{className:qr.denyBtn,onClick:()=>s(n),children:le("ui.permission.deny")}),r&&w.jsx("button",{className:qr.allowSessionBtn,onClick:()=>r(n),children:le("ui.permission.allowSession")}),w.jsx("button",{ref:c,className:qr.allowBtn,onClick:()=>i(n),children:le("ui.permission.allow")})]})]}):null}function JC(t){const e=t==null?void 0:t.content;if(typeof e=="string")return e;if(Array.isArray(e)){for(const n of e)if((n==null?void 0:n.type)==="text"&&n.text)return n.text}return""}function rMe(t){const e=t.body||{},n=Vu(e);if(/Extract any file paths/i.test(n)||/process Bash commands/i.test(n)||/command execution specialist/i.test(n))return"Bash";if(/file search specialist/i.test(n))return"Search";if(/planning specialist/i.test(n))return"Plan";if(/general-purpose agent/i.test(n))return"General";const i=e.messages||[];for(let r=i.length-1;r>=0;r--){if(i[r].role!=="user")continue;const s=JC(i[r]);if(/^Command:/m.test(s))return"Bash";break}return null}function sMe(t){var i;const e=(i=t.body)==null?void 0:i.messages;if(!Array.isArray(e)||e.length!==1)return!1;const n=e[0];return n.role==="user"&&n.content==="count"}function oMe(t,e){var l;const n=t.body||{},i=n.tools,r=n.messages||[];if(Array.isArray(i)&&i.length>0||r.length!==1||r[0].role!=="user")return!1;const s=JC(r[0]);if(!s||s.trim()==="count")return!1;const o=s.trim();if(/^Command:/m.test(s)||/^<policy_spec>/i.test(o)||/^<task-notification>/i.test(o))return!1;const a=Vu(n);if(!a.includes("Claude Code")||/process Bash commands/i.test(a)||/Extract any file paths/i.test(a))return!1;if(e){const c=((l=e.body)==null?void 0:l.messages)||[],d=s.slice(0,80);if(c.some(h=>{const O=h==null?void 0:h.content;return typeof O=="string"?O.includes(d):Array.isArray(O)?O.some(p=>(p==null?void 0:p.type)==="text"&&p.text&&p.text.includes(d)):!1}))return!0}return!1}function Lx(t,e){var i;if(uP(t))return t.teammate?{type:"Teammate",subType:t.teammate}:(t._cachedTeammateName===void 0&&(t._cachedTeammateName=Yue(t.body)||null),{type:"Teammate",subType:t._cachedTeammateName});if(js(t))return{type:"MainAgent",subType:null};if(t.isCountTokens||sMe(t))return{type:"Count",subType:null};if(oMe(t,e)){const r=JC((((i=t.body)==null?void 0:i.messages)||[])[0]);return/Implement the following plan:/i.test(r.trim())?{type:"Plan",subType:"Prompt"}:{type:"Preflight",subType:null}}return{type:"SubAgent",subType:rMe(t)}}function RV(t,e){return t==="Teammate"&&e?`Teammate:${e}`:t==="Plan"&&e?`Plan:${e}`:t==="SubAgent"&&e?`SubAgent:${e}`:t}function EV(t,e){const n=t||"X";if(!e)return`Teammate: ${n}`;const i=e.replace(/^claude-/i,"").replace(/-\d{8}$/,"");return`Teammate: ${n}(${i})`}const aMe="\x1B[B",XV="\x1B[A",Vx="\x1B[C",lMe=" ",ih="\r";function N$(t,e){const n=[],i=e-t,r=i>0?aMe:XV;for(let s=0;s<Math.abs(i);s++)n.push(r);return n}function W$(t){if(t&&t.options){const e=t.options.findIndex(n=>n.selected);return e>=0?e:0}return 0}function cMe(t,e,n=!1){const i=[];let r=W$(e),s=t.optionIndex;if(e&&e.options){const o=t.optionIndex+1,a=e.options.findIndex(l=>l.number===o);a>=0&&(s=a)}return i.push(...N$(r,s)),i.push(ih),n&&t.isLast&&i.push(ih),i}function dMe(t,e,n=!1){const i=[],r=(t.selectedIndices||[]).slice().sort((o,a)=>o-a);let s=W$(e);for(const o of r)i.push(...N$(s,o)),i.push(lMe),s=o;return i.push(Vx),(t.isLast||!n)&&i.push(ih),i}function uMe(t,e,n=!1){const i=[];let r=W$(e);const s=t.optionIndex;i.push(...N$(r,s));const o=t.text||"";for(const a of o)i.push(a);return i.push(ih),n&&t.isLast&&i.push(ih),i}function hMe(t,e,n=!1){const i=[];let r=W$(e);const s=t.optionIndex;i.push(...N$(r,s));const o=t.text||"";for(const a of o)i.push(a);if(o.length>0){const a=[...o];i.push(a[a.length-1])}return i.push(Vx),i.push(XV),i.push(Vx),(t.isLast||!n)&&i.push(ih),i}function OMe(t,e,n=!1){return t.type==="multi"?dMe(t,e,n):t.type==="other"&&t.isMultiSelect?hMe(t,e,n):t.type==="other"?uMe(t,e,n):cMe(t,e,n)}const b0=new WeakMap;function x3(t){return b0.get(t)||null}function fMe(t,e){b0.set(t,e)}function zV(){return{toolUseMap:{},toolResultMap:{},readContentMap:{},editSnapshotMap:{},askAnswerMap:{},planApprovalMap:{},latestPlanContent:null,_fileState:{}}}function Gg(t,e,n){var d,u;const{toolUseMap:i,toolResultMap:r,readContentMap:s,editSnapshotMap:o,askAnswerMap:a,planApprovalMap:l,_fileState:c}=t;for(let h=n;h<e.length;h++){const O=e[h];if(O.role==="assistant"&&Array.isArray(O.content)){for(const p of O.content)if(p.type==="tool_use"){let m=p;if(typeof p.input=="string")try{const g=p.input.replace(/^\[object Object\]/,"");m={...p,input:JSON.parse(g)}}catch{}if(i[m.id]=m,m.name==="Write"&&((d=m.input)!=null&&d.file_path)&&/[/\\]\.claude[/\\]plans[/\\]/.test(m.input.file_path)&&m.input.content&&(t.latestPlanContent=m.input.content),m.name==="Edit"&&m.input){const g=m.input.file_path,v=m.input.old_string,$=m.input.new_string;if(g&&v!=null&&$!=null&&c[g]){const b=c[g];o[m.id]={plainText:b.plainText,lineNums:b.lineNums.slice()};const S=b.plainText.indexOf(v);if(S>=0){const Q=b.plainText.substring(0,S).split(`
1092
1092
  `).length-1,_=v.split(`
1093
1093
  `).length,P=$.split(`
1094
1094
  `).length,C=P-_;if(b.plainText=b.plainText.substring(0,S)+$+b.plainText.substring(S+v.length),C!==0){const X=b.lineNums[Q]||Q+1,z=[];for(let T=0;T<P;T++)z.push(X+T);b.lineNums=[...b.lineNums.slice(0,Q),...z,...b.lineNums.slice(Q+_).map(T=>T+C)]}/[/\\]\.claude[/\\]plans[/\\]/.test(g)&&(t.latestPlanContent=b.plainText)}}}}}else if(O.role==="user"&&Array.isArray(O.content)){for(const p of O.content)if(p.type==="tool_result"){const m=i[p.tool_use_id];let g=le("ui.toolReturn"),v=null,$=null;if(m)if(v=m.name,$=m.input,m.name==="Task"&&m.input){const _=m.input.subagent_type||"",P=m.input.description||"";g=`SubAgent: ${_}${P?" — "+P:""}`}else g=le("ui.toolReturnNamed",{name:m.name});const b=VA(p),S=!!p.is_error,y=S&&b&&/doesn't want to proceed|Permission.*denied|rejected.*tool use|interrupted by user for tool use/i.test(b),Q=y&&b&&/ultraplan/i.test(b);if(r[p.tool_use_id]={label:g,toolName:v,toolInput:$,resultText:b,isError:S,isPermissionDenied:y,isUltraplan:Q},m&&m.name==="Read"&&((u=m.input)!=null&&u.file_path)){s[m.input.file_path]=b;const _=b.split(`
1095
1095
  `),P=[],C=[];for(const X of _){const z=X.match(/^\s*(\d+)[\t→](.*)$/);z&&(C.push(parseInt(z[1],10)),P.push(z[2]))}if(P.length>0){const X=c[m.input.file_path];if(X){const z=new Map,T=X.plainText.split(`
1096
1096
  `);for(let x=0;x<X.lineNums.length;x++)z.set(X.lineNums[x],T[x]);for(let x=0;x<C.length;x++)z.set(C[x],P[x]);const k=[...z.keys()].sort((x,R)=>x-R);c[m.input.file_path]={plainText:k.map(x=>z.get(x)).join(`
1097
1097
  `),lineNums:k}}else c[m.input.file_path]={plainText:P.join(`
1098
- `),lineNums:C}}}if(m&&m.name==="AskUserQuestion"){const _=gMe(b);Object.keys(_).length===0&&y?a[p.tool_use_id]={__rejected__:!0}:a[p.tool_use_id]=_,t._askDirty=(t._askDirty||0)+1}if(m&&m.name==="ExitPlanMode"){if(y){const _=b.match(/the user said:\s*([\s\S]*)/i);l[p.tool_use_id]={status:Q?"ultraplan":"rejected",feedback:_?_[1].trim():""}}else l[p.tool_use_id]=vMe(b);t._planDirty=(t._planDirty||0)+1,t.latestPlanContent=null}}}}}function pMe(t){const e=zV();return Gg(e,t,0),e}function mMe(t){let e=b0.get(t);return e||(e=pMe(t),b0.set(t,e)),e}function gMe(t){const e={},n=/"([^"]+)"="([^"]*)"/g;let i;for(;(i=n.exec(t))!==null;)e[i[1]]=i[2];return e}function vMe(t){if(!t)return{status:"pending"};if(/User has approved/i.test(t)){const e=t.match(/##\s*Approved Plan:\s*\n([\s\S]*)/i);return{status:"approved",planContent:e?e[1].trim():""}}if(/User rejected/i.test(t)){const e=t.match(/feedback:\s*(.+)/i)||t.match(/User rejected[^:]*:\s*(.+)/i);return{status:"rejected",feedback:e?e[1].trim():""}}return{status:"pending"}}function $Me(t){var s,o,a,l,c,d,u,h,O,p,m,g,v,$,b,S,y,Q,_;const e=[];let n=-1;function i(P,C){var X,z;for(let T=C+1;T<t.length&&T<=C+10;T++){const k=(z=(X=t[T])==null?void 0:X.body)==null?void 0:z.messages;if(Array.isArray(k))for(const x of k){const R=x.role==="user"&&Array.isArray(x.content)?x.content:[];for(const E of R)if(E.type==="tool_result"&&E.tool_use_id===P)return typeof E.content=="string"?E.content:JSON.stringify(E.content||"")}}return null}function r(P){return!P||P.includes('"success":true')||P.includes('"success": true')||P.includes("Cleaned up")?!0:!P.includes("Cannot cleanup")}for(let P=0;P<t.length;P++){const C=t[P],X=(o=(s=C.response)==null?void 0:s.body)==null?void 0:o.content;if(Array.isArray(X))for(const z of X){if(z.type!=="tool_use")continue;const T=z.name,k=typeof z.input=="string"?(()=>{try{return JSON.parse(z.input)}catch{return{}}})():z.input||{};if(T==="TeamCreate"){const x=i(z.id,P);if(x&&(x.includes('"error":')||x.includes('"error" :')||x.includes("Already leading team")))continue;const R=k.team_name||k.teamName||"unknown",E=C.timestamp||((a=C.response)==null?void 0:a.timestamp);n>=0&&!e[n].endTime&&(e[n].endTime=E,e[n].endRequestIndex=Math.max(e[n].requestIndex,P-1),e[n]._inferredEnd=!0);const I={name:R,startTime:E,endTime:null,requestIndex:P,endRequestIndex:null,taskCount:0,teammateCount:0,_teammates:new Set};e.push(I),n=e.length-1}else if(T==="TeamDelete"){const x=i(z.id,P);if(!r(x))continue;const R=C.timestamp||((l=C.response)==null?void 0:l.timestamp);if(n<0){let E="unknown";try{E=JSON.parse(x).team_name||E}catch{}let I=0,A=((c=t[0])==null?void 0:c.timestamp)||((u=(d=t[0])==null?void 0:d.response)==null?void 0:u.timestamp);for(let N=0;N<P;N++){const L=(p=(O=(h=t[N])==null?void 0:h.response)==null?void 0:O.body)==null?void 0:p.content;if(Array.isArray(L)){for(const B of L)if(B.type==="tool_use"&&B.name==="Agent"){const V=typeof B.input=="string"?(()=>{try{return JSON.parse(B.input)}catch{return{}}})():B.input||{};if((V.team_name||V.teamName)===E){I=N,A=((m=t[N])==null?void 0:m.timestamp)||((v=(g=t[N])==null?void 0:g.response)==null?void 0:v.timestamp);break}}if(I>0)break}}const j={name:E,startTime:A,endTime:R,requestIndex:I,endRequestIndex:P,taskCount:0,teammateCount:0,_teammates:new Set,_inferredStart:!0};for(let N=I;N<P;N++){const L=(S=(b=($=t[N])==null?void 0:$.response)==null?void 0:b.body)==null?void 0:S.content;if(Array.isArray(L)){for(const B of L)if(B.type==="tool_use")if(B.name==="Agent"){const Y=(typeof B.input=="string"?(()=>{try{return JSON.parse(B.input)}catch{return{}}})():B.input||{}).name||"";j._teammates.has(Y)||(j._teammates.add(Y),j.teammateCount++)}else(B.name==="TaskCreate"||B.name==="TaskUpdate")&&j.taskCount++}}e.push(j);continue}e[n].endTime=R,e[n].endRequestIndex=P,n=-1}else if(T==="SendMessage"){if(n>=0&&((y=k.message)==null?void 0:y.type)==="shutdown_request"){const x=C.timestamp||((Q=C.response)==null?void 0:Q.timestamp);e[n]._lastShutdownTime=x,e[n]._lastShutdownRequestIdx=P}}else if(T==="TaskCreate"||T==="TaskUpdate")n>=0&&e[n].taskCount++;else if(T==="Agent"){const x=k.team_name||k.teamName,R=k.name||"";let E=-1;if(x){for(let I=e.length-1;I>=0;I--)if(e[I].name===x&&!e[I].endTime){E=I;break}}if(E<0&&n>=0&&(E=n),E>=0){const I=e[E];I._teammates.has(R)||(I._teammates.add(R),I.teammateCount++)}}}}for(const P of e)if(!P.endTime)if(P._lastShutdownTime)P.endTime=P._lastShutdownTime,P.endRequestIndex=P._lastShutdownRequestIdx,P._inferredEnd=!0;else{const C=t[t.length-1],X=((_=C==null?void 0:C.response)==null?void 0:_.timestamp)||(C==null?void 0:C.timestamp);X&&P.startTime!==X&&(P.endTime=X,P.endRequestIndex=t.length-1,P._inferredEnd=!0)}return e}function bMe(t,e,n){var X,z,T,k,x,R,E,I,A,j,N,L,B,V,Y,W,q,ne,D,ee,fe,se,te,oe;const i=t.requestIndex,r=t.endRequestIndex!=null?t.endRequestIndex+1:e.length,s=e.slice(i,r),o=t.startTime,a=t.endTime||((z=(X=e[r-1])==null?void 0:X.response)==null?void 0:z.timestamp)||((T=e[r-1])==null?void 0:T.timestamp),l={};let c=null;for(let G=i;G<r&&G<e.length;G++){const H=e[G];H.timestamp&&(l[H.timestamp]=G),(k=H.body)!=null&&k.model&&(c=H.body.model)}const d=S_(c),u=[];let h=!1;if(n){let G=null;for(const K of n)for(const ae of K.messages||[]){const de=ae._timestamp;!de||ae.role!=="user"||de<=o&&(!G||de>G)&&(G=de)}const H=G||o;for(const K of n)for(const ae of K.messages||[]){const de=ae._timestamp;if(!de||de<H||a&&de>a||ae.role!=="user")continue;const ve=ae.content;if(Array.isArray(ve)){const{textBlocks:Se}=$_(ve);for(const ue of Se)ue.text&&ue.text.trim()&&(u.push({type:"user",text:ue.text,timestamp:de}),h=!0)}else typeof ve=="string"&&!yv(ve)&&(u.push({type:"user",text:ve,timestamp:de}),h=!0)}}if(!h){const G=e[t.requestIndex],H=((x=G==null?void 0:G.body)==null?void 0:x.messages)||[];for(let K=H.length-1;K>=0;K--){if(H[K].role!=="user")continue;const ae=H[K].content;if(Array.isArray(ae)){const{textBlocks:de}=$_(ae);for(const ve of de)ve.text&&ve.text.trim()&&(u.push({type:"user",text:ve.text,timestamp:o}),h=!0)}else typeof ae=="string"&&!yv(ae)&&(u.push({type:"user",text:ae,timestamp:o}),h=!0);if(h)break}}if(!h)for(let G=0;G<s.length;G++){const H=(E=(R=s[G].response)==null?void 0:R.body)==null?void 0:E.content;if(Array.isArray(H)){for(const K of H)if(K.type==="text"&&K.text&&K.text.trim()){u.push({type:"context",text:K.text.trim(),timestamp:((I=s[G].response)==null?void 0:I.timestamp)||s[G].timestamp}),h=!0;break}if(h)break}}for(let G=0;G<s.length;G++){const H=s[G],K=(j=(A=H.response)==null?void 0:A.body)==null?void 0:j.content;if(!Array.isArray(K)||K.length===0)continue;const ae=Lx(H,s[G+1]),de=js(H),ve=ae.type==="SubAgent"||ae.type==="Teammate";if(de)u.push({type:"assistant",content:K,timestamp:((N=H.response)==null?void 0:N.timestamp)||H.timestamp,requestIndex:i+G,modelInfo:d});else if(ve){const Se={},ue=((L=H.body)==null?void 0:L.messages)||[];for(const me of ue)if(me.role==="tool_result"||me.role==="user"&&Array.isArray(me.content)){const Oe=Array.isArray(me.content)?me.content:[me];for(const pe of Oe)pe.type==="tool_result"&&pe.tool_use_id&&(Se[pe.tool_use_id]={resultText:typeof pe.content=="string"?pe.content:JSON.stringify(pe.content)})}u.push({type:"sub-agent",content:K,toolResultMap:Se,label:ae.type==="Teammate"?EV(ae.subType,(B=H.body)==null?void 0:B.model):RV(ae.type,ae.subType),isTeammate:ae.type==="Teammate",timestamp:H.timestamp,requestIndex:i+G})}}u.sort((G,H)=>(G.timestamp||"").localeCompare(H.timestamp||""));const O=["#1668dc","#52c41a","#faad14","#eb2f96","#722ed1","#13c2c2","#fa541c","#2f54eb"],p=[],m=new Map,g=new Date(o).getTime(),v=new Date(a||Date.now()).getTime(),$=[];let b=g;const S=new Map,y=new Map;let Q=1;for(let G=0;G<s.length;G++){const H=s[G],K=(Y=(V=H.response)==null?void 0:V.body)==null?void 0:Y.content;if(!Array.isArray(K))continue;const ae=((W=H.response)==null?void 0:W.timestamp)||H.timestamp,de=ae,ve=new Date(ae).getTime(),Se=js(H);for(const ue of K){if(ue.type!=="tool_use")continue;const me=ue.name,Oe=typeof ue.input=="string"?(()=>{try{return JSON.parse(ue.input)}catch{return{}}})():ue.input||{};if(me==="Agent"&&Oe.name){const pe=p.length;p.push({name:Oe.name,color:O[pe%O.length],type:((q=Oe.subagent_type)==null?void 0:q.split(":").pop())||"",spawnTime:de,claimTime:null,doneTime:null,shutdownTime:null,taskSubject:null,events:[{ts:ve,label:"spawn"}]}),m.set(Oe.name,pe)}else if(me==="TaskCreate"){if(Oe.subject){const pe=String(Oe.taskId||Q++);S.set(pe,Oe.subject)}}else if(me==="TaskUpdate"){const pe=Oe.owner,ke=Oe.taskId!=null?String(Oe.taskId):null;pe&&ke&&y.set(ke,pe);let Ae=null;if(pe&&m.has(pe))Ae=p[m.get(pe)];else if(ke){const Ue=y.get(ke);if(Ue&&m.has(Ue))Ae=p[m.get(Ue)];else{const Ze=parseInt(ke,10);Ze>0&&Ze<=p.length&&(Ae=p[Ze-1],y.set(ke,Ae.name))}}Ae&&(Oe.status==="in_progress"&&!Ae.claimTime&&(Ae.claimTime=de,Ae.events.push({ts:ve,label:"claim"})),Oe.status==="completed"&&!Ae.doneTime&&(Ae.doneTime=de,Ae.events.push({ts:ve,label:"done"})),ke&&S.has(ke)&&!Ae.taskSubject&&(Ae.taskSubject=S.get(ke)))}else if(me==="SendMessage")if(((ne=Oe.message)==null?void 0:ne.type)==="shutdown_request"&&Oe.to&&m.has(Oe.to)){const pe=p[m.get(Oe.to)];pe.shutdownTime=de,pe.events.push({ts:ve,label:"shutdown"})}else((D=Oe.message)==null?void 0:D.type)==="shutdown_response"&&m.has(Oe.to==="team-lead"?"":Oe.to)||(Oe.to&&Oe.to!=="team-lead"&&m.has(Oe.to)?p[m.get(Oe.to)].events.push({ts:ve,label:"msg-in"}):Oe.to==="team-lead"&&(typeof Oe.message=="string"||Oe.message&&!Oe.message.type)&&ve>b&&($.push({start:b,end:ve,label:"report-received",color:"#52c41a"}),b=ve));if(Se&&(me==="TeamCreate"||me==="TaskCreate"||me==="Agent"||me==="SendMessage"||me==="TeamDelete")){const pe=me==="TeamCreate"?"create":me==="TaskCreate"?"tasks":me==="Agent"?"spawn":me==="SendMessage"?"msg":"cleanup";ve>b&&($.push({start:b,end:ve,label:pe,color:me==="TeamDelete"?"#52c41a":me==="SendMessage"?"#ff4d4f":"#1668dc"}),b=ve)}}if(Se)for(const ue of K)ue.type==="text"&&ue.text?ve>b&&($.push({start:b,end:ve,label:"text",color:"#196ae1"}),b=ve):ue.type==="thinking"&&ve>b&&($.push({start:b,end:ve,label:"thinking",color:"#722ed1"}),b=ve)}for(let G=0;G<s.length;G++){const H=s[G];if(js(H))continue;const K=(fe=(ee=H.response)==null?void 0:ee.body)==null?void 0:fe.content;if(!Array.isArray(K))continue;const ae=((se=H.response)==null?void 0:se.timestamp)||H.timestamp,de=new Date(ae).getTime(),ve=Lx(H,s[G+1]),Se=ve.type==="Teammate"?ve.subType:null;if(Se){let ue=m.has(Se)?m.get(Se):void 0;if(ue===void 0){for(const[me,Oe]of m)if(Se.includes(me)||me.includes(Se)){ue=Oe;break}}if(ue!==void 0){const me=p[ue];for(const Oe of K)Oe.type==="tool_use"&&Oe.name&&me.events.push({ts:de,label:"tool:"+Oe.name})}}}const _=/<teammate-message\s+teammate_id="([^"]+)"[^>]*summary="([^"]*)"[^>]*>([\s\S]*?)<\/teammate-message>/g,P=new Set;p.forEach(G=>{G.teammateMessages=[]});for(let G=0;G<s.length;G++){const H=s[G],K=((te=H.body)==null?void 0:te.messages)||[];for(const ae of K)if(!(ae.role!=="user"||!Array.isArray(ae.content)))for(const de of ae.content){if(de.type!=="text"||!de.text)continue;let ve;for(_.lastIndex=0;(ve=_.exec(de.text))!==null;){const[,Se,ue,me]=ve;if(Se==="system"||Se==="team-lead")continue;const Oe=Se+"|"+ue+"|"+me.trim().slice(0,100);if(!P.has(Oe)){P.add(Oe);for(const pe of p)if(Se===pe.name||Se.includes(pe.name)||pe.name.includes(Se)){if(ue&&me.trim()){pe.teammateMessages.push({summary:ue,content:me.trim()});const ke=H.timestamp||((oe=H.response)==null?void 0:oe.timestamp);u.push({type:"teammate-report",agentName:pe.name,agentColor:Bu(pe.name).color,summary:ue,content:me.trim(),timestamp:ke})}break}}}}}b<v&&$.push({start:b,end:v,label:"idle",color:"#333"});const C={spawn:"#555",claim:"#faad14",done:"#52c41a",shutdown:"#ff4d4f","msg-in":"#1668dc",report:"#52c41a","report-received":"#52c41a",text:"#196ae1",thinking:"#722ed1"};return p.forEach(G=>{var ae;const H=new Date(G.spawnTime).getTime(),K=new Date(G.doneTime||G.shutdownTime||a||Date.now()).getTime();G.duration=K-H,G.events.sort((de,ve)=>de.ts-ve.ts),G.segments=[];for(let de=0;de<G.events.length;de++){const ve=G.events[de],Se=((ae=G.events[de+1])==null?void 0:ae.ts)||(G.shutdownTime?new Date(G.shutdownTime).getTime():v);G.segments.push({start:ve.ts,end:Se,label:ve.label,color:C[ve.label]||(ve.label.startsWith("tool:")?"#888":G.color)})}}),{entries:u,teamAgents:p,leadSegments:$,teamTotalStart:g,teamTotalEnd:v,modelInfo:d,teamRequests:s}}const SMe="_teamActiveSpinner_1f772_1",yMe="_teamPopover_1f772_17",_Me="_teamPopoverTitle_1f772_23",QMe="_teamPopoverItem_1f772_31",xMe="_teamPopoverName_1f772_45",wMe="_teamPopoverMeta_1f772_53",PMe="_teamPopoverTime_1f772_60",CMe="_teamModalBody_1f772_66",TMe="_teamGanttToggle_1f772_76",kMe="_ganttExportBtn_1f772_90",RMe="_teamGanttWrap_1f772_106",EMe="_teamGanttResizer_1f772_115",XMe="_teamGanttRow_1f772_128",zMe="_teamGanttLabel_1f772_135",IMe="_teamGanttTrack_1f772_147",AMe="_teamGanttBar_1f772_156",MMe="_teamGanttDiamond_1f772_164",jMe="_teamGanttArrows_1f772_181",NMe="_teamGanttIndicator_1f772_191",WMe="_teamModalLayout_1f772_203",LMe="_teamAgentCards_1f772_208",VMe="_teamAgentCard_1f772_208",BMe="_teamAgentCardActive_1f772_230",YMe="_teamAgentCardHeader_1f772_234",DMe="_teamAgentAvatar_1f772_240",UMe="_teamAgentName_1f772_257",qMe="_teamAgentType_1f772_266",ZMe="_teamAgentStatus_1f772_272",GMe="_teamAgentPopover_1f772_277",FMe="_teamAgentPopTeammateMsg_1f772_282",HMe="_teamAgentPopTmSummary_1f772_290",KMe="_teamAgentPopTmContent_1f772_297",JMe="_teamAgentPopTask_1f772_303",eje="_teamAgentPopMsg_1f772_312",tje="_teammateReportEntry_1f772_325",nje="_teammateReportHeader_1f772_333",ije="_teammateReportName_1f772_342",rje="_teammateReportSummary_1f772_348",sje="_teammateReportBody_1f772_357",oje="_teamModalContent_1f772_363",aje="_teamBtnRelative_1f772_371",lje="_ganttLabelLead_1f772_375",cje="_ganttLabelAgent_1f772_380",dje="_ganttTimeAxisRow_1f772_384",uje="_ganttTimeAxisTrack_1f772_388",hje="_ganttTickLabel_1f772_394",Oje="_teamPopoverStatus_1f772_402",fje="_ganttIndicatorInitial_1f772_407",pje="_teamModalTitle_1f772_411",mje="_teamLeadCard_1f772_416",gje="_agentNoMessages_1f772_420",vje="_teamAgentCardClickable_1f772_425",$je="_agentStatusDurSuffix_1f772_430",kt={teamActiveSpinner:SMe,teamPopover:yMe,teamPopoverTitle:_Me,teamPopoverItem:QMe,teamPopoverName:xMe,teamPopoverMeta:wMe,teamPopoverTime:PMe,teamModalBody:CMe,teamGanttToggle:TMe,ganttExportBtn:kMe,teamGanttWrap:RMe,teamGanttResizer:EMe,teamGanttRow:XMe,teamGanttLabel:zMe,teamGanttTrack:IMe,teamGanttBar:AMe,teamGanttDiamond:MMe,teamGanttArrows:jMe,teamGanttIndicator:NMe,teamModalLayout:WMe,teamAgentCards:LMe,teamAgentCard:VMe,teamAgentCardActive:BMe,teamAgentCardHeader:YMe,teamAgentAvatar:DMe,teamAgentName:UMe,teamAgentType:qMe,teamAgentStatus:ZMe,teamAgentPopover:GMe,teamAgentPopTeammateMsg:FMe,teamAgentPopTmSummary:HMe,teamAgentPopTmContent:KMe,teamAgentPopTask:JMe,teamAgentPopMsg:eje,teammateReportEntry:tje,teammateReportHeader:nje,teammateReportName:ije,teammateReportSummary:rje,teammateReportBody:sje,teamModalContent:oje,teamBtnRelative:aje,ganttLabelLead:lje,ganttLabelAgent:cje,ganttTimeAxisRow:dje,ganttTimeAxisTrack:uje,ganttTickLabel:hje,teamPopoverStatus:Oje,ganttIndicatorInitial:fje,teamModalTitle:pje,teamLeadCard:mje,agentNoMessages:gje,teamAgentCardClickable:vje,agentStatusDurSuffix:$je};function w3({requests:t,onOpenSession:e,navBtnClass:n}){const i=f.useRef({requests:null,result:[]});i.current.requests!==t&&(i.current={requests:t,result:$Me(t)});const r=i.current.result;if(r.length===0)return null;const s=w.jsxs("div",{className:kt.teamPopover,children:[w.jsxs("div",{className:kt.teamPopoverTitle,children:[le("ui.teamSessions")," (",r.length,")"]}),r.map((a,l)=>{const c=a.startTime?new Date(a.startTime).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"",d=a.endTime?a._inferredEnd?"⏱":"✓":"●",u=a.endTime?a._inferredEnd?"var(--text-tertiary)":"var(--color-success)":"var(--color-warning-light)";return w.jsxs("div",{className:kt.teamPopoverItem,onClick:()=>e(a),children:[w.jsx("span",{className:kt.teamPopoverStatus,style:{color:u},children:d}),w.jsx("span",{className:kt.teamPopoverName,children:a.name}),w.jsxs("span",{className:kt.teamPopoverMeta,children:[a.teammateCount,"p · ",a.taskCount,"t"]}),w.jsx("span",{className:kt.teamPopoverTime,children:c})]},l)})]}),o=r.some(a=>!a.endTime||a._inferredEnd);return w.jsx(Sl,{content:s,trigger:"hover",placement:"rightTop",overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-light)",padding:0},children:w.jsxs("button",{className:`${n||""} ${kt.teamBtnRelative}`,title:le("ui.teamSessions"),children:[w.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),w.jsx("circle",{cx:"9",cy:"7",r:"4"}),w.jsx("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),w.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}),o&&w.jsx("span",{className:kt.teamActiveSpinner})]})})}function bje({teamAgents:t,teamTotalStart:e,teamTotalEnd:n,leadSegments:i,ganttWrapRef:r,ganttIndicatorRef:s,ganttHeight:o,onGanttHeightChange:a}){const[l,c]=f.useState(!0);if(!t||t.length===0)return null;const d=n-e||1,u=p=>((p-e)/d*100).toFixed(2),h=(p,m)=>((m-p)/d*100).toFixed(2),O=[];for(let p=0;p<=4;p++){const m=e+d*p/4,g=new Date(m);O.push({pct:p*25,label:g.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})})}return w.jsxs("div",{children:[w.jsxs("div",{className:kt.teamGanttToggle,onClick:()=>c(p=>!p),children:[l?"▼":"▶"," Timeline",l&&w.jsx("span",{className:kt.ganttExportBtn,title:le("ui.exportTimelinePng")||"Export as PNG",onClick:p=>{p.stopPropagation();const m=r.current;if(!m)return;const g=m.style.maxHeight,v=m.style.height,$=m.style.overflow;m.style.maxHeight="none",m.style.height="auto",m.style.overflow="visible",t6(async()=>{const{default:b}=await import("./html2canvas.esm-QH1iLAAe.js");return{default:b}},[]).then(({default:b})=>{b(m,{backgroundColor:"#0a0a0a",scale:2,useCORS:!0}).then(S=>{m.style.maxHeight=g,m.style.height=v,m.style.overflow=$;const y=document.createElement("a");y.download=`team-timeline-${Date.now()}.png`,y.href=S.toDataURL("image/png"),y.click()}).catch(()=>{m.style.maxHeight=g,m.style.height=v,m.style.overflow=$})}).catch(()=>{m.style.maxHeight=g,m.style.height=v,m.style.overflow=$})},children:w.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),w.jsx("polyline",{points:"7 10 12 15 17 10"}),w.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})})]}),l&&w.jsxs(w.Fragment,{children:[w.jsxs("div",{ref:r,className:kt.teamGanttWrap,style:o?{maxHeight:"none",height:o}:void 0,children:[w.jsxs("div",{className:kt.teamGanttRow,children:[w.jsx("div",{className:`${kt.teamGanttLabel} ${kt.ganttLabelLead}`,children:"team-lead"}),w.jsxs("div",{className:kt.teamGanttTrack,children:[i&&i.map((p,m)=>{const g=p.label==="thinking"?"var(--color-code-purple)":p.label==="report-received"?"var(--color-success)":"var(--color-primary)",v=p.label==="idle"?.15:p.label==="text"?.5:p.label==="thinking"?.4:p.label==="report-received"?.6:.7;return w.jsx("div",{className:kt.teamGanttBar,title:p.label,style:{left:u(p.start)+"%",width:h(p.start,p.end)+"%",background:g,opacity:v}},`b${m}`)}),i&&i.filter(p=>p.label!=="idle").map((p,m)=>{const g={create:"Team Created",tasks:"Tasks Created",spawn:"Agents Spawned",msg:"SendMessage",cleanup:"Team Cleanup",text:"Status Update",thinking:"Thinking...","report-received":"Report Received"},v=p.label==="thinking"?"var(--color-code-purple)":p.label==="report-received"?"var(--color-success)":"var(--color-primary)";return w.jsx(Fo,{title:g[p.label]||p.label,children:w.jsx("span",{className:kt.teamGanttDiamond,style:{left:u(p.start)+"%",color:v},children:"◆"})},`d${m}`)})]})]}),t.map((p,m)=>w.jsxs("div",{className:kt.teamGanttRow,children:[w.jsx("div",{className:`${kt.teamGanttLabel} ${kt.ganttLabelAgent}`,children:p.name}),w.jsxs("div",{className:kt.teamGanttTrack,children:[p.segments.map((g,v)=>{const $=g.label.startsWith("tool:"),b=g.label==="spawn"?.2:g.label==="claim"?.7:g.label==="done"?.4:g.label==="shutdown"?.1:g.label==="report"?.9:.5;return w.jsx("div",{className:kt.teamGanttBar,title:g.label,style:{left:u(g.start)+"%",width:h(g.start,g.end)+"%",background:"#eee",opacity:b}},`b${v}`)}),p.events.filter(g=>!g.label.startsWith("tool:")).map((g,v)=>{const b={spawn:"Agent Spawned",claim:"Task Claimed",done:"Task Completed",shutdown:"Shutdown Request","msg-in":"Message Received",report:"Report Submitted"}[g.label]||g.label;return w.jsx(Fo,{title:`${p.name}: ${b}`,children:w.jsx("span",{className:`${kt.teamGanttDiamond} ${kt.ganttLabelAgent}`,style:{left:u(g.ts)+"%"},children:"◆"})},`d${v}`)})]})]},m)),w.jsxs("div",{className:`${kt.teamGanttRow} ${kt.ganttTimeAxisRow}`,children:[w.jsx("div",{className:kt.teamGanttLabel}),w.jsx("div",{className:`${kt.teamGanttTrack} ${kt.ganttTimeAxisTrack}`,children:O.map((p,m)=>w.jsx("span",{className:kt.ganttTickLabel,style:{left:p.pct+"%"},children:p.label},m))})]}),(()=>{const g=[];if(t.forEach(($,b)=>{const S=(b+1)*25+12.5;if($.doneTime){const y=new Date($.doneTime).getTime();g.push({key:`${b}-done`,xPct:u(y),fromY:S,toY:12.5,color:"var(--color-warning-light)"})}$.events.filter(y=>y.label==="report").forEach((y,Q)=>{g.push({key:`${b}-rpt-${Q}`,xPct:u(y.ts),fromY:S,toY:12.5,color:"var(--color-success)"})})}),g.length===0)return null;const v=(t.length+2)*25;return w.jsxs("svg",{className:kt.teamGanttArrows,style:{height:v},children:[w.jsxs("defs",{children:[w.jsx("marker",{id:"gantt-arrow-yellow",markerWidth:"8",markerHeight:"8",refX:"6",refY:"4",orient:"auto",children:w.jsx("path",{d:"M0,1 L7,4 L0,7 Z",fill:"var(--color-warning-light)"})}),w.jsx("marker",{id:"gantt-arrow-green",markerWidth:"8",markerHeight:"8",refX:"6",refY:"4",orient:"auto",children:w.jsx("path",{d:"M0,1 L7,4 L0,7 Z",fill:"var(--color-success)"})})]}),g.map($=>w.jsx("line",{x1:$.xPct+"%",y1:$.fromY,x2:$.xPct+"%",y2:$.toY+5,stroke:$.color,strokeWidth:"1.5",strokeDasharray:"4,3",opacity:"0.7",markerEnd:$.color==="var(--color-success)"?"url(#gantt-arrow-green)":"url(#gantt-arrow-yellow)"},$.key))]})})(),w.jsx("div",{ref:s,className:`${kt.teamGanttIndicator} ${kt.ganttIndicatorInitial}`})]}),w.jsx("div",{className:kt.teamGanttResizer,onMouseDown:p=>{p.preventDefault();const m=r.current;if(!m)return;const g=p.clientY,v=m.getBoundingClientRect().height,$=S=>{const y=Math.max(60,v+S.clientY-g);a(y)},b=()=>{document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",b)};document.addEventListener("mousemove",$),document.addEventListener("mouseup",b)}})]})]})}function P3({session:t,requests:e,mainAgentSessions:n,collapseToolResults:i,expandThinking:r,userProfile:s,onViewRequest:o,onClose:a}){const l=f.useRef(null),c=f.useRef(null),d=f.useRef(null),u=f.useRef(null),h=f.useRef(null),[O,p]=f.useState(null),[m,g]=f.useState(null);f.useEffect(()=>()=>{h.current&&cancelAnimationFrame(h.current)},[]);const v=f.useRef({team:null,requests:null,mainAgentSessions:null,result:null}),$=f.useMemo(()=>{if(!t)return null;const X=v.current;if(X.team===t&&X.requests===e&&X.mainAgentSessions===n)return X.result;const z=bMe(t,e,n);return v.current={team:t,requests:e,mainAgentSessions:n,result:z},z},[t,e,n]),b=$?$.teamTotalStart:0,S=$?$.teamTotalEnd:0,y=f.useCallback(()=>{h.current||(h.current=requestAnimationFrame(()=>{var j;h.current=null;const X=l.current;if(!X)return;const z=X.getBoundingClientRect().top;let T=null;for(const N of X.children){const L=N.getAttribute("data-timestamp");if(!L)continue;if(N.getBoundingClientRect().bottom>z){T=L;break}}if(!T)return;const k=new Date(T).getTime(),x=S-b||1,R=Math.max(0,Math.min(100,(k-b)/x*100)),E=c.current;if(!E)return;(!u.current||!u.current.isConnected)&&(u.current=(j=E.parentElement)==null?void 0:j.querySelector('[class*="teamGanttTrack"]'));const I=E.parentElement,A=u.current;if(A){const N=I.getBoundingClientRect(),L=A.getBoundingClientRect(),B=L.left-N.left,V=L.width;E.style.left=B+V*R/100+"px",E.style.height=I.scrollHeight+"px"}}))},[b,S]);if(!t)return null;const{entries:Q,teamAgents:_,leadSegments:P,modelInfo:C}=$;return w.jsx(yi,{open:!0,onCancel:()=>{u.current=null,a()},footer:null,closable:!0,maskClosable:!0,zIndex:1100,width:"calc(100vw - 80px)",title:w.jsxs("span",{className:kt.teamModalTitle,children:["Team: ",t.name]}),styles:{header:{background:"var(--bg-container)",borderBottom:"1px solid var(--border-primary)",padding:"12px 20px"},body:{background:"var(--bg-base)",height:"calc(100vh - 160px)",overflow:"hidden",padding:0},mask:{background:"rgba(0,0,0,0.7)"},content:{background:"var(--bg-container)",border:"1px solid var(--border-primary)",borderRadius:8,padding:0}},centered:!0,children:w.jsxs("div",{className:kt.teamModalLayout,children:[w.jsxs("div",{className:kt.teamAgentCards,children:[w.jsxs("div",{className:`${kt.teamAgentCard} ${kt.teamLeadCard}`,children:[w.jsxs("div",{className:kt.teamAgentCardHeader,children:[C!=null&&C.svg?w.jsx("div",{className:kt.teamAgentAvatar,style:{background:C.color||"#6b21a8"},dangerouslySetInnerHTML:{__html:C.svg}}):w.jsx("img",{src:cM,className:kt.teamAgentAvatar,alt:"lead"}),w.jsx("div",{className:kt.teamAgentName,children:"team-lead"})]}),w.jsx("div",{className:kt.teamAgentType,children:"orchestrator"}),w.jsx("div",{className:kt.teamAgentStatus,style:{color:t.endTime?t._inferredEnd?"var(--text-tertiary)":"var(--color-success)":"var(--color-warning-light)"},children:t.endTime?t._inferredEnd?"⏱ ended":"✓ done":"● active"})]}),_.map((X,z)=>{const T=!!X.doneTime,k=Math.round(X.duration/1e3),x=k>=60?`${Math.floor(k/60)}m${k%60}s`:`${k}s`,R=Q.filter(I=>I.type==="sub-agent"&&I.label&&I.label.includes(X.name)),E=w.jsxs("div",{className:kt.teamAgentPopover,children:[X.teammateMessages&&X.teammateMessages.length>0&&w.jsx("div",{className:kt.teamAgentPopTeammateMsg,children:X.teammateMessages.map((I,A)=>w.jsxs("div",{children:[I.summary&&w.jsx("div",{className:kt.teamAgentPopTmSummary,children:I.summary}),w.jsx("div",{className:`${kt.teamAgentPopTmContent} chat-md`,dangerouslySetInnerHTML:{__html:bo(I.content.length>3e3?I.content.slice(0,3e3)+`
1098
+ `),lineNums:C}}}if(m&&m.name==="AskUserQuestion"){const _=gMe(b);Object.keys(_).length===0&&y?a[p.tool_use_id]={__rejected__:!0}:a[p.tool_use_id]=_,t._askDirty=(t._askDirty||0)+1}if(m&&m.name==="ExitPlanMode"){if(y){const _=b.match(/the user said:\s*([\s\S]*)/i);l[p.tool_use_id]={status:Q?"ultraplan":"rejected",feedback:_?_[1].trim():""}}else l[p.tool_use_id]=vMe(b);t._planDirty=(t._planDirty||0)+1,t.latestPlanContent=null}}}}}function pMe(t){const e=zV();return Gg(e,t,0),e}function mMe(t){let e=b0.get(t);return e||(e=pMe(t),b0.set(t,e)),e}function gMe(t){const e={},n=/"([^"]+)"="([^"]*)"/g;let i;for(;(i=n.exec(t))!==null;)e[i[1]]=i[2];return e}function vMe(t){if(!t)return{status:"pending"};if(/User has approved/i.test(t)){const e=t.match(/##\s*Approved Plan:\s*\n([\s\S]*)/i);return{status:"approved",planContent:e?e[1].trim():""}}if(/User rejected/i.test(t)){const e=t.match(/feedback:\s*(.+)/i)||t.match(/User rejected[^:]*:\s*(.+)/i);return{status:"rejected",feedback:e?e[1].trim():""}}return{status:"pending"}}function $Me(t){var s,o,a,l,c,d,u,h,O,p,m,g,v,$,b,S,y,Q,_;const e=[];let n=-1;function i(P,C){var X,z;for(let T=C+1;T<t.length&&T<=C+10;T++){const k=(z=(X=t[T])==null?void 0:X.body)==null?void 0:z.messages;if(Array.isArray(k))for(const x of k){const R=x.role==="user"&&Array.isArray(x.content)?x.content:[];for(const E of R)if(E.type==="tool_result"&&E.tool_use_id===P)return typeof E.content=="string"?E.content:JSON.stringify(E.content||"")}}return null}function r(P){return!P||P.includes('"success":true')||P.includes('"success": true')||P.includes("Cleaned up")?!0:!P.includes("Cannot cleanup")}for(let P=0;P<t.length;P++){const C=t[P],X=(o=(s=C.response)==null?void 0:s.body)==null?void 0:o.content;if(Array.isArray(X))for(const z of X){if(z.type!=="tool_use")continue;const T=z.name,k=typeof z.input=="string"?(()=>{try{return JSON.parse(z.input)}catch{return{}}})():z.input||{};if(T==="TeamCreate"){const x=i(z.id,P);if(x&&(x.includes('"error":')||x.includes('"error" :')||x.includes("Already leading team")))continue;const R=k.team_name||k.teamName||"unknown",E=C.timestamp||((a=C.response)==null?void 0:a.timestamp);n>=0&&!e[n].endTime&&(e[n].endTime=E,e[n].endRequestIndex=Math.max(e[n].requestIndex,P-1),e[n]._inferredEnd=!0);const I={name:R,startTime:E,endTime:null,requestIndex:P,endRequestIndex:null,taskCount:0,teammateCount:0,_teammates:new Set};e.push(I),n=e.length-1}else if(T==="TeamDelete"){const x=i(z.id,P);if(!r(x))continue;const R=C.timestamp||((l=C.response)==null?void 0:l.timestamp);if(n<0){let E="unknown";try{E=JSON.parse(x).team_name||E}catch{}let I=0,A=((c=t[0])==null?void 0:c.timestamp)||((u=(d=t[0])==null?void 0:d.response)==null?void 0:u.timestamp);for(let N=0;N<P;N++){const L=(p=(O=(h=t[N])==null?void 0:h.response)==null?void 0:O.body)==null?void 0:p.content;if(Array.isArray(L)){for(const B of L)if(B.type==="tool_use"&&B.name==="Agent"){const V=typeof B.input=="string"?(()=>{try{return JSON.parse(B.input)}catch{return{}}})():B.input||{};if((V.team_name||V.teamName)===E){I=N,A=((m=t[N])==null?void 0:m.timestamp)||((v=(g=t[N])==null?void 0:g.response)==null?void 0:v.timestamp);break}}if(I>0)break}}const j={name:E,startTime:A,endTime:R,requestIndex:I,endRequestIndex:P,taskCount:0,teammateCount:0,_teammates:new Set,_inferredStart:!0};for(let N=I;N<P;N++){const L=(S=(b=($=t[N])==null?void 0:$.response)==null?void 0:b.body)==null?void 0:S.content;if(Array.isArray(L)){for(const B of L)if(B.type==="tool_use")if(B.name==="Agent"){const Y=(typeof B.input=="string"?(()=>{try{return JSON.parse(B.input)}catch{return{}}})():B.input||{}).name||"";j._teammates.has(Y)||(j._teammates.add(Y),j.teammateCount++)}else(B.name==="TaskCreate"||B.name==="TaskUpdate")&&j.taskCount++}}e.push(j);continue}e[n].endTime=R,e[n].endRequestIndex=P,n=-1}else if(T==="SendMessage"){if(n>=0&&((y=k.message)==null?void 0:y.type)==="shutdown_request"){const x=C.timestamp||((Q=C.response)==null?void 0:Q.timestamp);e[n]._lastShutdownTime=x,e[n]._lastShutdownRequestIdx=P}}else if(T==="TaskCreate"||T==="TaskUpdate")n>=0&&e[n].taskCount++;else if(T==="Agent"){const x=k.team_name||k.teamName,R=k.name||"";let E=-1;if(x){for(let I=e.length-1;I>=0;I--)if(e[I].name===x&&!e[I].endTime){E=I;break}}if(E<0&&n>=0&&(E=n),E>=0){const I=e[E];I._teammates.has(R)||(I._teammates.add(R),I.teammateCount++)}}}}for(const P of e)if(!P.endTime)if(P._lastShutdownTime)P.endTime=P._lastShutdownTime,P.endRequestIndex=P._lastShutdownRequestIdx,P._inferredEnd=!0;else{const C=t[t.length-1],X=((_=C==null?void 0:C.response)==null?void 0:_.timestamp)||(C==null?void 0:C.timestamp);X&&P.startTime!==X&&(P.endTime=X,P.endRequestIndex=t.length-1,P._inferredEnd=!0)}return e}function bMe(t,e,n){var X,z,T,k,x,R,E,I,A,j,N,L,B,V,Y,W,q,ne,D,ee,fe,se,te,oe;const i=t.requestIndex,r=t.endRequestIndex!=null?t.endRequestIndex+1:e.length,s=e.slice(i,r),o=t.startTime,a=t.endTime||((z=(X=e[r-1])==null?void 0:X.response)==null?void 0:z.timestamp)||((T=e[r-1])==null?void 0:T.timestamp),l={};let c=null;for(let G=i;G<r&&G<e.length;G++){const H=e[G];H.timestamp&&(l[H.timestamp]=G),(k=H.body)!=null&&k.model&&(c=H.body.model)}const d=S_(c),u=[];let h=!1;if(n){let G=null;for(const K of n)for(const ae of K.messages||[]){const de=ae._timestamp;!de||ae.role!=="user"||de<=o&&(!G||de>G)&&(G=de)}const H=G||o;for(const K of n)for(const ae of K.messages||[]){const de=ae._timestamp;if(!de||de<H||a&&de>a||ae.role!=="user")continue;const ve=ae.content;if(Array.isArray(ve)){const{textBlocks:Se}=$_(ve);for(const ue of Se)ue.text&&ue.text.trim()&&(u.push({type:"user",text:ue.text,timestamp:de}),h=!0)}else typeof ve=="string"&&!yv(ve)&&(u.push({type:"user",text:ve,timestamp:de}),h=!0)}}if(!h){const G=e[t.requestIndex],H=((x=G==null?void 0:G.body)==null?void 0:x.messages)||[];for(let K=H.length-1;K>=0;K--){if(H[K].role!=="user")continue;const ae=H[K].content;if(Array.isArray(ae)){const{textBlocks:de}=$_(ae);for(const ve of de)ve.text&&ve.text.trim()&&(u.push({type:"user",text:ve.text,timestamp:o}),h=!0)}else typeof ae=="string"&&!yv(ae)&&(u.push({type:"user",text:ae,timestamp:o}),h=!0);if(h)break}}if(!h)for(let G=0;G<s.length;G++){const H=(E=(R=s[G].response)==null?void 0:R.body)==null?void 0:E.content;if(Array.isArray(H)){for(const K of H)if(K.type==="text"&&K.text&&K.text.trim()){u.push({type:"context",text:K.text.trim(),timestamp:((I=s[G].response)==null?void 0:I.timestamp)||s[G].timestamp}),h=!0;break}if(h)break}}for(let G=0;G<s.length;G++){const H=s[G],K=(j=(A=H.response)==null?void 0:A.body)==null?void 0:j.content;if(!Array.isArray(K)||K.length===0)continue;const ae=Lx(H,s[G+1]),de=js(H),ve=ae.type==="SubAgent"||ae.type==="Teammate";if(de)u.push({type:"assistant",content:K,timestamp:((N=H.response)==null?void 0:N.timestamp)||H.timestamp,requestIndex:i+G,modelInfo:d});else if(ve){const Se={},ue=((L=H.body)==null?void 0:L.messages)||[];for(const me of ue)if(me.role==="tool_result"||me.role==="user"&&Array.isArray(me.content)){const Oe=Array.isArray(me.content)?me.content:[me];for(const pe of Oe)pe.type==="tool_result"&&pe.tool_use_id&&(Se[pe.tool_use_id]={resultText:typeof pe.content=="string"?pe.content:JSON.stringify(pe.content)})}u.push({type:"sub-agent",content:K,toolResultMap:Se,label:ae.type==="Teammate"?EV(ae.subType,(B=H.body)==null?void 0:B.model):RV(ae.type,ae.subType),isTeammate:ae.type==="Teammate",timestamp:H.timestamp,requestIndex:i+G})}}u.sort((G,H)=>(G.timestamp||"").localeCompare(H.timestamp||""));const O=["#1668dc","#52c41a","#faad14","#eb2f96","#722ed1","#13c2c2","#fa541c","#2f54eb"],p=[],m=new Map,g=new Date(o).getTime(),v=new Date(a||Date.now()).getTime(),$=[];let b=g;const S=new Map,y=new Map;let Q=1;for(let G=0;G<s.length;G++){const H=s[G],K=(Y=(V=H.response)==null?void 0:V.body)==null?void 0:Y.content;if(!Array.isArray(K))continue;const ae=((W=H.response)==null?void 0:W.timestamp)||H.timestamp,de=ae,ve=new Date(ae).getTime(),Se=js(H);for(const ue of K){if(ue.type!=="tool_use")continue;const me=ue.name,Oe=typeof ue.input=="string"?(()=>{try{return JSON.parse(ue.input)}catch{return{}}})():ue.input||{};if(me==="Agent"&&Oe.name){const pe=p.length;p.push({name:Oe.name,color:O[pe%O.length],type:((q=Oe.subagent_type)==null?void 0:q.split(":").pop())||"",spawnTime:de,claimTime:null,doneTime:null,shutdownTime:null,taskSubject:null,events:[{ts:ve,label:"spawn"}]}),m.set(Oe.name,pe)}else if(me==="TaskCreate"){if(Oe.subject){const pe=String(Oe.taskId||Q++);S.set(pe,Oe.subject)}}else if(me==="TaskUpdate"){const pe=Oe.owner,ke=Oe.taskId!=null?String(Oe.taskId):null;pe&&ke&&y.set(ke,pe);let Ae=null;if(pe&&m.has(pe))Ae=p[m.get(pe)];else if(ke){const Ue=y.get(ke);if(Ue&&m.has(Ue))Ae=p[m.get(Ue)];else{const Ze=parseInt(ke,10);Ze>0&&Ze<=p.length&&(Ae=p[Ze-1],y.set(ke,Ae.name))}}Ae&&(Oe.status==="in_progress"&&!Ae.claimTime&&(Ae.claimTime=de,Ae.events.push({ts:ve,label:"claim"})),Oe.status==="completed"&&!Ae.doneTime&&(Ae.doneTime=de,Ae.events.push({ts:ve,label:"done"})),ke&&S.has(ke)&&!Ae.taskSubject&&(Ae.taskSubject=S.get(ke)))}else if(me==="SendMessage")if(((ne=Oe.message)==null?void 0:ne.type)==="shutdown_request"&&Oe.to&&m.has(Oe.to)){const pe=p[m.get(Oe.to)];pe.shutdownTime=de,pe.events.push({ts:ve,label:"shutdown"})}else((D=Oe.message)==null?void 0:D.type)==="shutdown_response"&&m.has(Oe.to==="team-lead"?"":Oe.to)||(Oe.to&&Oe.to!=="team-lead"&&m.has(Oe.to)?p[m.get(Oe.to)].events.push({ts:ve,label:"msg-in"}):Oe.to==="team-lead"&&(typeof Oe.message=="string"||Oe.message&&!Oe.message.type)&&ve>b&&($.push({start:b,end:ve,label:"report-received",color:"#52c41a"}),b=ve));if(Se&&(me==="TeamCreate"||me==="TaskCreate"||me==="Agent"||me==="SendMessage"||me==="TeamDelete")){const pe=me==="TeamCreate"?"create":me==="TaskCreate"?"tasks":me==="Agent"?"spawn":me==="SendMessage"?"msg":"cleanup";ve>b&&($.push({start:b,end:ve,label:pe,color:me==="TeamDelete"?"#52c41a":me==="SendMessage"?"#ff4d4f":"#1668dc"}),b=ve)}}if(Se)for(const ue of K)ue.type==="text"&&ue.text?ve>b&&($.push({start:b,end:ve,label:"text",color:"#196ae1"}),b=ve):ue.type==="thinking"&&ve>b&&($.push({start:b,end:ve,label:"thinking",color:"#722ed1"}),b=ve)}for(let G=0;G<s.length;G++){const H=s[G];if(js(H))continue;const K=(fe=(ee=H.response)==null?void 0:ee.body)==null?void 0:fe.content;if(!Array.isArray(K))continue;const ae=((se=H.response)==null?void 0:se.timestamp)||H.timestamp,de=new Date(ae).getTime(),ve=Lx(H,s[G+1]),Se=ve.type==="Teammate"?ve.subType:null;if(Se){let ue=m.has(Se)?m.get(Se):void 0;if(ue===void 0){for(const[me,Oe]of m)if(Se.includes(me)||me.includes(Se)){ue=Oe;break}}if(ue!==void 0){const me=p[ue];for(const Oe of K)Oe.type==="tool_use"&&Oe.name&&me.events.push({ts:de,label:"tool:"+Oe.name})}}}const _=/<teammate-message\s+teammate_id="([^"]+)"[^>]*summary="([^"]*)"[^>]*>([\s\S]*?)<\/teammate-message>/g,P=new Set;p.forEach(G=>{G.teammateMessages=[]});for(let G=0;G<s.length;G++){const H=s[G],K=((te=H.body)==null?void 0:te.messages)||[];for(const ae of K)if(!(ae.role!=="user"||!Array.isArray(ae.content)))for(const de of ae.content){if(de.type!=="text"||!de.text)continue;let ve;for(_.lastIndex=0;(ve=_.exec(de.text))!==null;){const[,Se,ue,me]=ve;if(Se==="system"||Se==="team-lead")continue;const Oe=Se+"|"+ue+"|"+me.trim().slice(0,100);if(!P.has(Oe)){P.add(Oe);for(const pe of p)if(Se===pe.name||Se.includes(pe.name)||pe.name.includes(Se)){if(ue&&me.trim()){pe.teammateMessages.push({summary:ue,content:me.trim()});const ke=H.timestamp||((oe=H.response)==null?void 0:oe.timestamp);u.push({type:"teammate-report",agentName:pe.name,agentColor:Bu(pe.name).color,summary:ue,content:me.trim(),timestamp:ke})}break}}}}}b<v&&$.push({start:b,end:v,label:"idle",color:"#333"});const C={spawn:"#555",claim:"#faad14",done:"#52c41a",shutdown:"#ff4d4f","msg-in":"#1668dc",report:"#52c41a","report-received":"#52c41a",text:"#196ae1",thinking:"#722ed1"};return p.forEach(G=>{var ae;const H=new Date(G.spawnTime).getTime(),K=new Date(G.doneTime||G.shutdownTime||a||Date.now()).getTime();G.duration=K-H,G.events.sort((de,ve)=>de.ts-ve.ts),G.segments=[];for(let de=0;de<G.events.length;de++){const ve=G.events[de],Se=((ae=G.events[de+1])==null?void 0:ae.ts)||(G.shutdownTime?new Date(G.shutdownTime).getTime():v);G.segments.push({start:ve.ts,end:Se,label:ve.label,color:C[ve.label]||(ve.label.startsWith("tool:")?"#888":G.color)})}}),{entries:u,teamAgents:p,leadSegments:$,teamTotalStart:g,teamTotalEnd:v,modelInfo:d,teamRequests:s}}const SMe="_teamActiveSpinner_1f772_1",yMe="_teamPopover_1f772_17",_Me="_teamPopoverTitle_1f772_23",QMe="_teamPopoverItem_1f772_31",xMe="_teamPopoverName_1f772_45",wMe="_teamPopoverMeta_1f772_53",PMe="_teamPopoverTime_1f772_60",CMe="_teamModalBody_1f772_66",TMe="_teamGanttToggle_1f772_76",kMe="_ganttExportBtn_1f772_90",RMe="_teamGanttWrap_1f772_106",EMe="_teamGanttResizer_1f772_115",XMe="_teamGanttRow_1f772_128",zMe="_teamGanttLabel_1f772_135",IMe="_teamGanttTrack_1f772_147",AMe="_teamGanttBar_1f772_156",MMe="_teamGanttDiamond_1f772_164",jMe="_teamGanttArrows_1f772_181",NMe="_teamGanttIndicator_1f772_191",WMe="_teamModalLayout_1f772_203",LMe="_teamAgentCards_1f772_208",VMe="_teamAgentCard_1f772_208",BMe="_teamAgentCardActive_1f772_230",YMe="_teamAgentCardHeader_1f772_234",DMe="_teamAgentAvatar_1f772_240",UMe="_teamAgentName_1f772_257",qMe="_teamAgentType_1f772_266",ZMe="_teamAgentStatus_1f772_272",GMe="_teamAgentPopover_1f772_277",FMe="_teamAgentPopTeammateMsg_1f772_282",HMe="_teamAgentPopTmSummary_1f772_290",KMe="_teamAgentPopTmContent_1f772_297",JMe="_teamAgentPopTask_1f772_303",eje="_teamAgentPopMsg_1f772_312",tje="_teammateReportEntry_1f772_325",nje="_teammateReportHeader_1f772_333",ije="_teammateReportName_1f772_342",rje="_teammateReportSummary_1f772_348",sje="_teammateReportBody_1f772_357",oje="_teamModalContent_1f772_363",aje="_teamBtnRelative_1f772_371",lje="_ganttLabelLead_1f772_375",cje="_ganttLabelAgent_1f772_380",dje="_ganttTimeAxisRow_1f772_384",uje="_ganttTimeAxisTrack_1f772_388",hje="_ganttTickLabel_1f772_394",Oje="_teamPopoverStatus_1f772_402",fje="_ganttIndicatorInitial_1f772_407",pje="_teamModalTitle_1f772_411",mje="_teamLeadCard_1f772_416",gje="_agentNoMessages_1f772_420",vje="_teamAgentCardClickable_1f772_425",$je="_agentStatusDurSuffix_1f772_430",kt={teamActiveSpinner:SMe,teamPopover:yMe,teamPopoverTitle:_Me,teamPopoverItem:QMe,teamPopoverName:xMe,teamPopoverMeta:wMe,teamPopoverTime:PMe,teamModalBody:CMe,teamGanttToggle:TMe,ganttExportBtn:kMe,teamGanttWrap:RMe,teamGanttResizer:EMe,teamGanttRow:XMe,teamGanttLabel:zMe,teamGanttTrack:IMe,teamGanttBar:AMe,teamGanttDiamond:MMe,teamGanttArrows:jMe,teamGanttIndicator:NMe,teamModalLayout:WMe,teamAgentCards:LMe,teamAgentCard:VMe,teamAgentCardActive:BMe,teamAgentCardHeader:YMe,teamAgentAvatar:DMe,teamAgentName:UMe,teamAgentType:qMe,teamAgentStatus:ZMe,teamAgentPopover:GMe,teamAgentPopTeammateMsg:FMe,teamAgentPopTmSummary:HMe,teamAgentPopTmContent:KMe,teamAgentPopTask:JMe,teamAgentPopMsg:eje,teammateReportEntry:tje,teammateReportHeader:nje,teammateReportName:ije,teammateReportSummary:rje,teammateReportBody:sje,teamModalContent:oje,teamBtnRelative:aje,ganttLabelLead:lje,ganttLabelAgent:cje,ganttTimeAxisRow:dje,ganttTimeAxisTrack:uje,ganttTickLabel:hje,teamPopoverStatus:Oje,ganttIndicatorInitial:fje,teamModalTitle:pje,teamLeadCard:mje,agentNoMessages:gje,teamAgentCardClickable:vje,agentStatusDurSuffix:$je};function w3({requests:t,onOpenSession:e,navBtnClass:n}){const i=f.useRef({requests:null,result:[]});i.current.requests!==t&&(i.current={requests:t,result:$Me(t)});const r=i.current.result;if(r.length===0)return null;const s=w.jsxs("div",{className:kt.teamPopover,children:[w.jsxs("div",{className:kt.teamPopoverTitle,children:[le("ui.teamSessions")," (",r.length,")"]}),r.map((a,l)=>{const c=a.startTime?new Date(a.startTime).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"",d=a.endTime?a._inferredEnd?"⏱":"✓":"●",u=a.endTime?a._inferredEnd?"var(--text-tertiary)":"var(--color-success)":"var(--color-warning-light)";return w.jsxs("div",{className:kt.teamPopoverItem,onClick:()=>e(a),children:[w.jsx("span",{className:kt.teamPopoverStatus,style:{color:u},children:d}),w.jsx("span",{className:kt.teamPopoverName,children:a.name}),w.jsxs("span",{className:kt.teamPopoverMeta,children:[a.teammateCount,"p · ",a.taskCount,"t"]}),w.jsx("span",{className:kt.teamPopoverTime,children:c})]},l)})]}),o=r.some(a=>!a.endTime||a._inferredEnd);return w.jsx(Sl,{content:s,trigger:"hover",placement:"rightTop",overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-light)",padding:0},children:w.jsxs("button",{className:`${n||""} ${kt.teamBtnRelative}`,title:le("ui.teamSessions"),children:[w.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),w.jsx("circle",{cx:"9",cy:"7",r:"4"}),w.jsx("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),w.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}),o&&w.jsx("span",{className:kt.teamActiveSpinner})]})})}function bje({teamAgents:t,teamTotalStart:e,teamTotalEnd:n,leadSegments:i,ganttWrapRef:r,ganttIndicatorRef:s,ganttHeight:o,onGanttHeightChange:a}){const[l,c]=f.useState(!0);if(!t||t.length===0)return null;const d=n-e||1,u=p=>((p-e)/d*100).toFixed(2),h=(p,m)=>((m-p)/d*100).toFixed(2),O=[];for(let p=0;p<=4;p++){const m=e+d*p/4,g=new Date(m);O.push({pct:p*25,label:g.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})})}return w.jsxs("div",{children:[w.jsxs("div",{className:kt.teamGanttToggle,onClick:()=>c(p=>!p),children:[l?"▼":"▶"," Timeline",l&&w.jsx("span",{className:kt.ganttExportBtn,title:le("ui.exportTimelinePng")||"Export as PNG",onClick:p=>{p.stopPropagation();const m=r.current;if(!m)return;const g=m.style.maxHeight,v=m.style.height,$=m.style.overflow;m.style.maxHeight="none",m.style.height="auto",m.style.overflow="visible",t6(async()=>{const{default:b}=await import("./html2canvas.esm-QH1iLAAe.js");return{default:b}},[]).then(({default:b})=>{b(m,{backgroundColor:"#0a0a0a",scale:2,useCORS:!0}).then(S=>{m.style.maxHeight=g,m.style.height=v,m.style.overflow=$;const y=document.createElement("a");y.download=`team-timeline-${Date.now()}.png`,y.href=S.toDataURL("image/png"),y.click()}).catch(()=>{m.style.maxHeight=g,m.style.height=v,m.style.overflow=$})}).catch(()=>{m.style.maxHeight=g,m.style.height=v,m.style.overflow=$})},children:w.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),w.jsx("polyline",{points:"7 10 12 15 17 10"}),w.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})})]}),l&&w.jsxs(w.Fragment,{children:[w.jsxs("div",{ref:r,className:kt.teamGanttWrap,style:o?{maxHeight:"none",height:o}:void 0,children:[w.jsxs("div",{className:kt.teamGanttRow,children:[w.jsx("div",{className:`${kt.teamGanttLabel} ${kt.ganttLabelLead}`,children:"team-lead"}),w.jsxs("div",{className:kt.teamGanttTrack,children:[i&&i.map((p,m)=>{const g=p.label==="thinking"?"var(--color-code-purple)":p.label==="report-received"?"var(--color-success)":"var(--color-primary)",v=p.label==="idle"?.15:p.label==="text"?.5:p.label==="thinking"?.4:p.label==="report-received"?.6:.7;return w.jsx("div",{className:kt.teamGanttBar,title:p.label,style:{left:u(p.start)+"%",width:h(p.start,p.end)+"%",background:g,opacity:v}},`b${m}`)}),i&&i.filter(p=>p.label!=="idle").map((p,m)=>{const g={create:"Team Created",tasks:"Tasks Created",spawn:"Agents Spawned",msg:"SendMessage",cleanup:"Team Cleanup",text:"Status Update",thinking:"Thinking...","report-received":"Report Received"},v=p.label==="thinking"?"var(--color-code-purple)":p.label==="report-received"?"var(--color-success)":"var(--color-primary)";return w.jsx(Fo,{title:g[p.label]||p.label,children:w.jsx("span",{className:kt.teamGanttDiamond,style:{left:u(p.start)+"%",color:v},children:"◆"})},`d${m}`)})]})]}),t.map((p,m)=>w.jsxs("div",{className:kt.teamGanttRow,children:[w.jsx("div",{className:`${kt.teamGanttLabel} ${kt.ganttLabelAgent}`,children:p.name}),w.jsxs("div",{className:kt.teamGanttTrack,children:[p.segments.map((g,v)=>{const $=g.label.startsWith("tool:"),b=g.label==="spawn"?.2:g.label==="claim"?.7:g.label==="done"?.4:g.label==="shutdown"?.1:g.label==="report"?.9:.5;return w.jsx("div",{className:kt.teamGanttBar,title:g.label,style:{left:u(g.start)+"%",width:h(g.start,g.end)+"%",background:"#eee",opacity:b}},`b${v}`)}),p.events.filter(g=>!g.label.startsWith("tool:")).map((g,v)=>{const b={spawn:"Agent Spawned",claim:"Task Claimed",done:"Task Completed",shutdown:"Shutdown Request","msg-in":"Message Received",report:"Report Submitted"}[g.label]||g.label;return w.jsx(Fo,{title:`${p.name}: ${b}`,children:w.jsx("span",{className:`${kt.teamGanttDiamond} ${kt.ganttLabelAgent}`,style:{left:u(g.ts)+"%"},children:"◆"})},`d${v}`)})]})]},m)),w.jsxs("div",{className:`${kt.teamGanttRow} ${kt.ganttTimeAxisRow}`,children:[w.jsx("div",{className:kt.teamGanttLabel}),w.jsx("div",{className:`${kt.teamGanttTrack} ${kt.ganttTimeAxisTrack}`,children:O.map((p,m)=>w.jsx("span",{className:kt.ganttTickLabel,style:{left:p.pct+"%"},children:p.label},m))})]}),(()=>{const g=[];if(t.forEach(($,b)=>{const S=(b+1)*25+12.5;if($.doneTime){const y=new Date($.doneTime).getTime();g.push({key:`${b}-done`,xPct:u(y),fromY:S,toY:12.5,color:"var(--color-warning-light)"})}$.events.filter(y=>y.label==="report").forEach((y,Q)=>{g.push({key:`${b}-rpt-${Q}`,xPct:u(y.ts),fromY:S,toY:12.5,color:"var(--color-success)"})})}),g.length===0)return null;const v=(t.length+2)*25;return w.jsxs("svg",{className:kt.teamGanttArrows,style:{height:v},children:[w.jsxs("defs",{children:[w.jsx("marker",{id:"gantt-arrow-yellow",markerWidth:"8",markerHeight:"8",refX:"6",refY:"4",orient:"auto",children:w.jsx("path",{d:"M0,1 L7,4 L0,7 Z",fill:"var(--color-warning-light)"})}),w.jsx("marker",{id:"gantt-arrow-green",markerWidth:"8",markerHeight:"8",refX:"6",refY:"4",orient:"auto",children:w.jsx("path",{d:"M0,1 L7,4 L0,7 Z",fill:"var(--color-success)"})})]}),g.map($=>w.jsx("line",{x1:$.xPct+"%",y1:$.fromY,x2:$.xPct+"%",y2:$.toY+5,stroke:$.color,strokeWidth:"1.5",strokeDasharray:"4,3",opacity:"0.7",markerEnd:$.color==="var(--color-success)"?"url(#gantt-arrow-green)":"url(#gantt-arrow-yellow)"},$.key))]})})(),w.jsx("div",{ref:s,className:`${kt.teamGanttIndicator} ${kt.ganttIndicatorInitial}`})]}),w.jsx("div",{className:kt.teamGanttResizer,onMouseDown:p=>{p.preventDefault();const m=r.current;if(!m)return;const g=p.clientY,v=m.getBoundingClientRect().height,$=S=>{const y=Math.max(60,v+S.clientY-g);a(y)},b=()=>{document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",b)};document.addEventListener("mousemove",$),document.addEventListener("mouseup",b)}})]})]})}function P3({session:t,requests:e,mainAgentSessions:n,collapseToolResults:i,expandThinking:r,userProfile:s,onViewRequest:o,onClose:a}){const l=f.useRef(null),c=f.useRef(null),d=f.useRef(null),u=f.useRef(null),h=f.useRef(null),[O,p]=f.useState(null),[m,g]=f.useState(null);f.useEffect(()=>()=>{h.current&&cancelAnimationFrame(h.current)},[]);const v=f.useRef({team:null,requests:null,mainAgentSessions:null,result:null}),$=f.useMemo(()=>{if(!t)return null;const X=v.current;if(X.team===t&&X.requests===e&&X.mainAgentSessions===n)return X.result;const z=bMe(t,e,n);return v.current={team:t,requests:e,mainAgentSessions:n,result:z},z},[t,e,n]),b=$?$.teamTotalStart:0,S=$?$.teamTotalEnd:0,y=f.useCallback(()=>{h.current||(h.current=requestAnimationFrame(()=>{var j;h.current=null;const X=l.current;if(!X)return;const z=X.getBoundingClientRect().top;let T=null;for(const N of X.children){const L=N.getAttribute("data-timestamp");if(!L)continue;if(N.getBoundingClientRect().bottom>z){T=L;break}}if(!T)return;const k=new Date(T).getTime(),x=S-b||1,R=Math.max(0,Math.min(100,(k-b)/x*100)),E=c.current;if(!E)return;(!u.current||!u.current.isConnected)&&(u.current=(j=E.parentElement)==null?void 0:j.querySelector('[class*="teamGanttTrack"]'));const I=E.parentElement,A=u.current;if(A){const N=I.getBoundingClientRect(),L=A.getBoundingClientRect(),B=L.left-N.left,V=L.width;E.style.left=B+V*R/100+"px",E.style.height=I.scrollHeight+"px"}}))},[b,S]);if(!t)return null;const{entries:Q,teamAgents:_,leadSegments:P,modelInfo:C}=$;return w.jsx(yi,{open:!0,onCancel:()=>{u.current=null,a()},footer:null,closable:!0,maskClosable:!0,zIndex:1100,width:"calc(100vw - 80px)",title:w.jsxs("span",{className:kt.teamModalTitle,children:["Team: ",t.name]}),styles:{header:{background:"var(--bg-container)",borderBottom:"1px solid var(--border-primary)",padding:"12px 20px"},body:{background:"var(--bg-base)",height:"calc(100vh - 160px)",overflow:"hidden",padding:0},mask:{background:"rgba(0,0,0,0.7)"},content:{background:"var(--bg-container)",border:"1px solid var(--border-primary)",borderRadius:8,padding:0}},centered:!0,children:w.jsxs("div",{className:kt.teamModalLayout,children:[w.jsxs("div",{className:kt.teamAgentCards,children:[w.jsxs("div",{className:`${kt.teamAgentCard} ${kt.teamLeadCard}`,children:[w.jsxs("div",{className:kt.teamAgentCardHeader,children:[C!=null&&C.svg?w.jsx("div",{className:kt.teamAgentAvatar,style:{background:C.color||"var(--bg-model-avatar)"},dangerouslySetInnerHTML:{__html:C.svg}}):w.jsx("img",{src:cM,className:kt.teamAgentAvatar,alt:"lead"}),w.jsx("div",{className:kt.teamAgentName,children:"team-lead"})]}),w.jsx("div",{className:kt.teamAgentType,children:"orchestrator"}),w.jsx("div",{className:kt.teamAgentStatus,style:{color:t.endTime?t._inferredEnd?"var(--text-tertiary)":"var(--color-success)":"var(--color-warning-light)"},children:t.endTime?t._inferredEnd?"⏱ ended":"✓ done":"● active"})]}),_.map((X,z)=>{const T=!!X.doneTime,k=Math.round(X.duration/1e3),x=k>=60?`${Math.floor(k/60)}m${k%60}s`:`${k}s`,R=Q.filter(I=>I.type==="sub-agent"&&I.label&&I.label.includes(X.name)),E=w.jsxs("div",{className:kt.teamAgentPopover,children:[X.teammateMessages&&X.teammateMessages.length>0&&w.jsx("div",{className:kt.teamAgentPopTeammateMsg,children:X.teammateMessages.map((I,A)=>w.jsxs("div",{children:[I.summary&&w.jsx("div",{className:kt.teamAgentPopTmSummary,children:I.summary}),w.jsx("div",{className:`${kt.teamAgentPopTmContent} chat-md`,dangerouslySetInnerHTML:{__html:bo(I.content.length>3e3?I.content.slice(0,3e3)+`
1099
1099
 
1100
1100
  ...`:I.content)}})]},A))}),X.taskSubject&&w.jsx("div",{className:kt.teamAgentPopTask,children:X.taskSubject}),R.length>0?R.map((I,A)=>{const j=(I.content||[]).filter(N=>N.type==="text").map(N=>N.text).join(`
1101
1101
  `);return j.trim()?w.jsx("div",{className:`${kt.teamAgentPopMsg} chat-md`,dangerouslySetInnerHTML:{__html:bo(j.length>2e3?j.slice(0,2e3)+`
1102
1102
 
1103
- ...`:j)}},A):null}):w.jsx("div",{className:kt.agentNoMessages,children:"No messages"})]});return w.jsx(Sl,{content:E,trigger:"click",placement:"right",autoAdjustOverflow:!0,overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-light)",padding:0,maxWidth:800,maxHeight:"70vh",overflowY:"auto"},onOpenChange:I=>p(I?z:null),children:w.jsxs("div",{className:`${kt.teamAgentCard} ${kt.teamAgentCardClickable} ${O===z?kt.teamAgentCardActive:""}`,children:[w.jsxs("div",{className:kt.teamAgentCardHeader,children:[(()=>{const I=Bu(X.name);return w.jsx("div",{className:kt.teamAgentAvatar,style:{background:I.color},dangerouslySetInnerHTML:{__html:I.svg}})})(),w.jsx("div",{className:kt.teamAgentName,children:X.name})]}),w.jsx("div",{className:kt.teamAgentType,children:X.type}),w.jsxs("div",{className:kt.teamAgentStatus,style:{color:T?"var(--color-success)":"var(--color-warning-light)"},children:[T?"✓ done":"● working"," ",w.jsxs("span",{className:kt.agentStatusDurSuffix,children:["· ",x]})]})]})},z)})]}),w.jsxs("div",{className:kt.teamModalContent,children:[w.jsx(bje,{teamAgents:_,teamTotalStart:b,teamTotalEnd:S,leadSegments:P,ganttWrapRef:d,ganttIndicatorRef:c,ganttHeight:m,onGanttHeightChange:g}),w.jsxs("div",{className:kt.teamModalBody,ref:l,onScroll:y,children:[Q.map((X,z)=>w.jsxs("div",{"data-timestamp":X.timestamp,children:[X.type==="user"&&w.jsx(gs,{role:"user",text:X.text,timestamp:X.timestamp,userProfile:s,modelInfo:C,requestIndex:X.requestIndex,onViewRequest:o}),X.type==="assistant"&&w.jsx(gs,{role:"assistant",content:X.content,timestamp:X.timestamp,modelInfo:X.modelInfo,collapseToolResults:i,expandThinking:r,toolResultMap:{},askAnswerMap:{},requestIndex:X.requestIndex,onViewRequest:o}),X.type==="sub-agent"&&w.jsx(gs,{role:"sub-agent-chat",content:X.content,toolResultMap:X.toolResultMap,label:X.label,isTeammate:X.isTeammate,timestamp:X.timestamp,collapseToolResults:i,expandThinking:r,requestIndex:X.requestIndex,onViewRequest:o}),X.type==="context"&&w.jsx(gs,{role:"assistant",content:[{type:"text",text:X.text}],timestamp:X.timestamp,modelInfo:C,collapseToolResults:i,expandThinking:r,toolResultMap:{},askAnswerMap:{}}),X.type==="teammate-report"&&w.jsxs("div",{className:kt.teammateReportEntry,children:[w.jsxs("div",{className:kt.teammateReportHeader,children:[(()=>{const T=Bu(X.agentName);return w.jsx("div",{className:kt.teamAgentAvatar,style:{background:T.color},dangerouslySetInnerHTML:{__html:T.svg}})})(),w.jsx("span",{className:kt.teammateReportName,children:X.agentName}),w.jsx("span",{className:kt.teammateReportSummary,children:X.summary})]}),w.jsx("div",{className:`${kt.teammateReportBody} chat-md`,dangerouslySetInnerHTML:{__html:bo(X.content)}})]})]},`tw-${z}`)),Q.length===0&&w.jsx(Ls,{description:"No entries",image:Ls.PRESENTED_IMAGE_SIMPLE})]})]})]})})}const Sje="_snapLine_1qd8k_1",yje="_snapLineActive_1qd8k_13",_je="_snapPreview_1qd8k_24",B1={snapLine:Sje,snapLineActive:yje,snapPreview:_je};function Qje({isDragging:t,activeSnapLine:e,snapLines:n,currentLeft:i}){if(!t)return null;let r=null;if(e){const a=e.linePosition,l=Math.min(i,a),c=Math.abs(a-i);r=w.jsx("div",{className:B1.snapPreview,style:{left:`${l}px`,width:`${c}px`}})}const s=[...n].map(a=>({...a,dist:Math.abs(a.linePosition-i)})).sort((a,l)=>a.dist-l.dist);let o=null;if(s.length>0){const a=s[0],l=e&&e.cols===a.cols;o=w.jsx("div",{className:l?B1.snapLineActive:B1.snapLine,style:{left:`${a.linePosition}px`}},a.cols)}return w.jsxs(w.Fragment,{children:[r,o]})}const xje="_roleFilterBar_os5cl_1",wje="_roleChip_os5cl_10",Pje="_roleChipActive_os5cl_10",Cje="_roleAvatar_os5cl_31",Tje="_roleAvatarImg_os5cl_44",kje="_roleName_os5cl_51",Rje="_roleCheck_os5cl_56",Rc={roleFilterBar:xje,roleChip:wje,roleChipActive:Pje,roleAvatar:Cje,roleAvatarImg:Tje,roleName:kje,roleCheck:Rje};function Eje({roles:t,selectedRoles:e,onToggle:n}){return!t||t.length===0?null:w.jsx("div",{className:Rc.roleFilterBar,children:t.map(i=>{const r=e.has(i.key);return w.jsxs("button",{className:r?Rc.roleChipActive:Rc.roleChip,onClick:()=>n(i.key),children:[i.avatarImg?w.jsx("img",{src:i.avatarImg,className:Rc.roleAvatarImg,alt:i.name,onError:s=>{s.target.onerror=null,s.target.style.display="none";const o=s.target.parentNode.querySelector("[data-role-avatar-fallback]");o&&(o.style.display="")}}):null,w.jsx("div",{className:Rc.roleAvatar,style:{background:i.color||"rgba(255,255,255,0.1)",display:i.avatarImg?"none":""},"data-role-avatar-fallback":"",dangerouslySetInnerHTML:{__html:i.avatarSvg||y_(i.avatarType)}}),w.jsx("span",{className:Rc.roleName,children:i.name}),r&&w.jsx("span",{className:Rc.roleCheck,children:"✓"})]},i.key)})})}const Xje="_chatInputBar_1jg84_1",zje="_chatInputWrapper_1jg84_7",Ije="_chatTextareaWrap_1jg84_21",Aje="_chatTextarea_1jg84_21",Mje="_chatInputBottom_1jg84_46",jje="_plusArea_1jg84_53",Nje="_plusBtn_1jg84_57",Wje="_plusBtnOpen_1jg84_71",Lje="_plusOverlay_1jg84_81",Vje="_plusMenu_1jg84_90",Bje="_plusMenuItem_1jg84_103",Yje="_plusMenuItemMuted_1jg84_123",Dje="_presetLabel_1jg84_142",Uje="_chatInputHint_1jg84_148",qje="_chatInputHintSep_1jg84_156",Zje="_chatInputHintTerminal_1jg84_160",Gje="_chatInputHintMobile_1jg84_164",Fje="_sendBtn_1jg84_172",Hje="_sendBtnDisabled_1jg84_187",Kje="_ghostText_1jg84_198",Jje="_suggestionChip_1jg84_214",eNe="_suggestionChipText_1jg84_230",tNe="_suggestionChipAction_1jg84_239",nNe="_imagePreviewStrip_1jg84_246",iNe="_imagePreviewItem_1jg84_258",rNe="_imagePreviewThumb_1jg84_268",sNe="_imagePreviewRemove_1jg84_275",oNe="_filePreviewChip_1jg84_301",aNe="_filePreviewName_1jg84_319",lNe="_filePreviewClose_1jg84_327",cNe="_streaming_1jg84_450",dNe="_streamingFading_1jg84_451",uNe="_streamingSvg_1jg84_461",hNe="_streamingSvgFading_1jg84_472",wn={chatInputBar:Xje,chatInputWrapper:zje,chatTextareaWrap:Ije,chatTextarea:Aje,chatInputBottom:Mje,plusArea:jje,plusBtn:Nje,plusBtnOpen:Wje,plusOverlay:Lje,plusMenu:Vje,plusMenuItem:Bje,plusMenuItemMuted:Yje,presetLabel:Dje,chatInputHint:Uje,chatInputHintSep:qje,chatInputHintTerminal:Zje,chatInputHintMobile:Gje,sendBtn:Fje,sendBtnDisabled:Hje,ghostText:Kje,suggestionChip:Jje,suggestionChipText:eNe,suggestionChipAction:tNe,imagePreviewStrip:nNe,imagePreviewItem:iNe,imagePreviewThumb:rNe,imagePreviewRemove:sNe,filePreviewChip:oNe,filePreviewName:aNe,filePreviewClose:lNe,streaming:cNe,streamingFading:dNe,streamingSvg:uNe,streamingSvgFading:hNe};function ONe({inputRef:t,inputEmpty:e,inputSuggestion:n,terminalVisible:i,onKeyDown:r,onChange:s,onSend:o,onSuggestionClick:a,onUploadPath:l,presetItems:c,onPresetSend:d,onOpenPresetModal:u,isStreaming:h,streamingFading:O,pendingImages:p,onRemovePendingImage:m}){const[g,v]=f.useState(!1),$=async b=>{var y;const S=(y=b.clipboardData)==null?void 0:y.items;if(S){for(const Q of S)if(Q.type.startsWith("image/")){b.preventDefault();try{const _=Q.getAsFile();if(!_)return;const P=await Av(_);l==null||l(P)}catch(_){console.error("[CC Viewer] Paste image upload failed:",_)}return}}};return i?n?w.jsxs("div",{className:wn.suggestionChip,onClick:a,children:[w.jsx("span",{className:wn.suggestionChipText,children:n}),w.jsx("span",{className:wn.suggestionChipAction,children:"↵"})]}):null:w.jsx("div",{className:wn.chatInputBar,children:w.jsxs("div",{className:`${wn.chatInputWrapper}${h?` ${wn.streaming}`:""}${O?` ${wn.streamingFading}`:""}`,children:[(h||O)&&w.jsxs("svg",{className:`${wn.streamingSvg}${O?` ${wn.streamingSvgFading}`:""}`,children:[w.jsx("defs",{children:w.jsxs("filter",{id:"ccv-streamGlow",children:[w.jsx("feGaussianBlur",{stdDeviation:"2",result:"blur"}),w.jsxs("feMerge",{children:[w.jsx("feMergeNode",{in:"blur"}),w.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),[{da:"20 30",op:.08,off:0},{da:"16 34",op:.15,off:-4},{da:"11 39",op:.3,off:-9},{da:"6 44",op:.6,off:-14},{da:"3 47",op:1,off:-17}].map((b,S,y)=>w.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",rx:"16",ry:"16",pathLength:"100",fill:"none",strokeWidth:"1.5",stroke:"var(--color-primary-lighter)",strokeOpacity:b.op,strokeLinecap:"round",strokeDasharray:b.da,filter:S===y.length-1?"url(#ccv-streamGlow)":void 0,children:w.jsx("animate",{attributeName:"stroke-dashoffset",from:b.off,to:b.off-100,dur:"2.5s",repeatCount:"indefinite"})},S))]}),w.jsxs("div",{className:wn.chatTextareaWrap,children:[p&&p.length>0&&w.jsx("div",{className:wn.imagePreviewStrip,children:p.map((b,S)=>{const y=b.path.split("/").pop()||b.path;return/\.(png|jpg|jpeg|gif|svg|webp|ico)$/i.test(y)?w.jsxs("div",{className:wn.imagePreviewItem,children:[w.jsx("img",{src:pt(`/api/file-raw?path=${encodeURIComponent(b.path)}`),className:wn.imagePreviewThumb,alt:y}),w.jsx("button",{className:wn.imagePreviewRemove,onClick:()=>m==null?void 0:m(S),title:le("ui.chatInput.removeImage"),children:"×"})]},b.path):w.jsxs("div",{className:wn.filePreviewChip,children:[w.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),w.jsx("polyline",{points:"14 2 14 8 20 8"})]}),w.jsx("span",{className:wn.filePreviewName,children:y}),w.jsx("button",{className:wn.filePreviewClose,onClick:()=>m==null?void 0:m(S),title:le("ui.chatInput.removeImage"),children:"×"})]},b.path)})}),w.jsx("textarea",{ref:t,className:wn.chatTextarea,placeholder:n?"":le("ui.chatInput.placeholder"),rows:1,onKeyDown:r,onInput:s,onPaste:$}),n&&e&&w.jsx("div",{className:wn.ghostText,children:n})]}),w.jsxs("div",{className:wn.chatInputBottom,children:[w.jsxs("div",{className:wn.plusArea,children:[w.jsx("button",{className:`${wn.plusBtn}${g?` ${wn.plusBtnOpen}`:""}`,onClick:()=>v(b=>!b),title:le("ui.chatInput.more"),children:w.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),w.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),g&&w.jsxs(w.Fragment,{children:[w.jsx("div",{className:wn.plusOverlay,onClick:()=>v(!1)}),w.jsxs("div",{className:wn.plusMenu,children:[c&&c.length>0&&u&&w.jsxs("button",{className:`${wn.plusMenuItem} ${wn.plusMenuItemMuted}`,onClick:()=>{v(!1),u()},children:[w.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("circle",{cx:"12",cy:"12",r:"3"}),w.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),w.jsx("span",{className:wn.presetLabel,children:le("ui.terminal.customShortcuts")})]}),c&&c.length>0&&c.map(b=>{const S=b.builtinId&&!b.modified,y=S?le(b.teamName):b.teamName,Q=S?le(b.description):b.description;return w.jsxs("button",{className:wn.plusMenuItem,onClick:()=>{v(!1),d==null||d(Q)},title:Q,children:[w.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),w.jsx("circle",{cx:"9",cy:"7",r:"4"}),w.jsx("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),w.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}),w.jsx("span",{className:wn.presetLabel,children:y||Q})]},b.id)}),w.jsxs("button",{className:wn.plusMenuItem,onClick:()=>{v(!1);const b=document.createElement("input");b.type="file",b.onchange=async S=>{var Q;const y=(Q=S.target.files)==null?void 0:Q[0];if(y)try{const _=await Av(y);l(_)}catch(_){console.error("[CC Viewer] Upload failed:",_)}},b.click()},children:[w.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),w.jsx("polyline",{points:"17 8 12 3 7 8"}),w.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),w.jsx("span",{children:le("ui.terminal.upload")})]})]})]})]}),w.jsx("div",{className:Ft?wn.chatInputHintMobile:wn.chatInputHint,children:Ft?le("ui.chatInput.hintMobile"):w.jsxs(w.Fragment,{children:[le(n&&e?"ui.chatInput.hintTab":"ui.chatInput.hintEnter"),w.jsx("span",{className:wn.chatInputHintSep,children:" · "}),w.jsx("span",{className:wn.chatInputHintTerminal,children:le("ui.chatInput.hintTerminal")})]})}),w.jsx("button",{className:`${wn.sendBtn} ${e&&!(p!=null&&p.length)?wn.sendBtnDisabled:""}`,onClick:o,disabled:e&&!(p!=null&&p.length),title:le("ui.chatInput.send"),children:w.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),w.jsx("polyline",{points:"5 12 12 5 19 12"})]})})]})]})})}function Y1(t,e){const n={presetShortcuts:t.map(i=>{const r={teamName:i.teamName,description:i.description};return i.builtinId&&(r.builtinId=i.builtinId),i.modified&&(r.modified=!0),r})};e&&(n.dismissedBuiltinPresets=[...e]),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).then(()=>{window.dispatchEvent(new Event("ccv-presets-changed"))}).catch(()=>{})}function fNe({open:t,onClose:e,items:n,onItemsChange:i,dismissedBuiltinPresets:r}){const[s,o]=f.useState(new Set),[a,l]=f.useState(!1),[c,d]=f.useState(""),[u,h]=f.useState(""),[O,p]=f.useState(null),m=f.useRef(null),g=f.useRef(null),[,v]=f.useState(0),$=f.useRef(new Set(r||[])),b=f.useCallback(()=>{o(new Set),e()},[e]),S=f.useCallback(T=>{o(k=>{const x=new Set(k);return x.has(T)?x.delete(T):x.add(T),x})},[]),y=f.useCallback(()=>{if(s.size===0)return;const T=new Set($.current);for(const x of n)s.has(x.id)&&x.builtinId&&T.add(x.builtinId);$.current=T;const k=n.filter(x=>!s.has(x.id));o(new Set),i(k),Y1(k,T)},[n,s,i]),Q=f.useCallback(()=>{const T=u.trim(),k=c.trim();if(!T&&!k)return;let x;O?x=n.map(R=>{if(R.id!==O)return R;const E={...R,teamName:k,description:T};return R.builtinId&&(E.modified=!0),E}):x=[...n,{id:Date.now(),teamName:k,description:T}],i(x),Y1(x),l(!1),d(""),h(""),p(null)},[n,c,u,O,i]),_=(T,k)=>{k.stopPropagation(),m.current=T,k.dataTransfer.effectAllowed="move",requestAnimationFrame(()=>v(x=>x+1))},P=(T,k)=>{k.preventDefault(),k.stopPropagation(),k.dataTransfer.dropEffect="move",g.current!==T&&(g.current=T,v(x=>x+1))},C=()=>{m.current=null,g.current=null,v(T=>T+1)},X=(T,k)=>{k.stopPropagation(),g.current===T&&(g.current=null,v(x=>x+1))},z=(T,k)=>{k.preventDefault(),k.stopPropagation();const x=m.current;if(x===null||x===T){C();return}const R=[...n],[E]=R.splice(x,1);R.splice(x<T?T-1:T,0,E),i(R),Y1(R),C()};return w.jsxs(w.Fragment,{children:[w.jsxs(yi,{title:le("ui.terminal.presetShortcuts"),open:t,onCancel:b,footer:null,width:800,styles:{content:{background:"var(--bg-elevated)",border:"1px solid var(--border-light)"},header:{background:"var(--bg-elevated)",borderBottom:"none"}},children:[w.jsx("div",{className:Et.presetSectionHeader,children:w.jsx("span",{className:Et.presetSectionTitle,children:le("ui.terminal.agentTeamCustom")})}),w.jsx("div",{className:Et.presetList,onDragOver:T=>{T.preventDefault(),T.stopPropagation()},onDrop:T=>{T.preventDefault(),T.stopPropagation()},children:n.length===0?w.jsx("div",{className:Et.presetListEmptyHint,children:"—"}):n.map((T,k)=>{const x=T.builtinId&&!T.modified,R=x?le(T.teamName):T.teamName,E=x?le(T.description):T.description;return w.jsxs("div",{className:`${Et.presetRow} ${m.current===k?Et.presetRowDragging:""} ${g.current===k&&m.current!==k?Et.presetRowDragOver:""}`,onDragOver:I=>P(k,I),onDragLeave:I=>X(k,I),onDrop:I=>z(k,I),onDragEnd:C,children:[w.jsx("span",{className:Et.dragHandle,draggable:!0,onDragStart:I=>_(k,I),children:w.jsxs("svg",{viewBox:"0 0 10 16",width:"10",height:"16",fill:"currentColor",children:[w.jsx("circle",{cx:"3",cy:"3",r:"1.2"}),w.jsx("circle",{cx:"7",cy:"3",r:"1.2"}),w.jsx("circle",{cx:"3",cy:"8",r:"1.2"}),w.jsx("circle",{cx:"7",cy:"8",r:"1.2"}),w.jsx("circle",{cx:"3",cy:"13",r:"1.2"}),w.jsx("circle",{cx:"7",cy:"13",r:"1.2"})]})}),w.jsx(yl,{checked:s.has(T.id),onChange:()=>S(T.id)}),w.jsx("span",{className:Et.presetName,title:R,children:R||"—"}),w.jsx("span",{className:Et.presetText,title:E,children:E}),w.jsx(ai,{size:"small",type:"link",onClick:()=>{l(!0),d(x?le(T.teamName):T.teamName),h(x?le(T.description):T.description),p(T.id)},children:le("ui.terminal.editItem")})]},T.id)})}),w.jsxs("div",{className:Et.presetActions,children:[w.jsx(ai,{size:"small",danger:!0,disabled:s.size===0,onClick:y,children:le("ui.terminal.deleteSelected")}),w.jsx(ai,{size:"small",onClick:()=>{l(!0),d(""),h(""),p(null)},children:le("ui.terminal.addItem")})]})]}),w.jsxs(yi,{title:le(O?"ui.terminal.editItem":"ui.terminal.addItem"),open:a,onCancel:()=>{l(!1),d(""),h(""),p(null)},onOk:Q,okText:le(O?"ui.ok":"ui.terminal.addItem"),cancelText:le("ui.cancel"),okButtonProps:{disabled:!u.trim()&&!c.trim()},width:"fit-content",styles:{content:{background:"var(--bg-elevated)",border:"1px solid var(--border-light)"},header:{background:"var(--bg-elevated)",borderBottom:"none"}},children:[w.jsxs("div",{className:Et.presetFormField,children:[w.jsxs("label",{className:Et.presetFormLabel,children:["Team ",le("ui.terminal.teamName")]}),w.jsx("input",{className:Et.presetInput,placeholder:le("ui.terminal.teamNamePlaceholder"),value:c,onChange:T=>d(T.target.value)})]}),w.jsxs("div",{children:[w.jsxs("label",{className:Et.presetFormLabel,children:["Team ",le("ui.terminal.teamDesc")]}),w.jsx("textarea",{className:Et.presetTextarea,rows:6,placeholder:le("ui.terminal.presetInputPlaceholder"),value:u,onChange:T=>h(T.target.value),onKeyDown:T=>{T.key==="Enter"&&T.stopPropagation()}})]})]})]})}const L$=0,yc=1,kh=2,IV=4;function C3(t){return()=>t}function pNe(t){t()}function AV(t,e){return n=>t(e(n))}function T3(t,e){return()=>t(e)}function mNe(t,e){return n=>t(e,n)}function eT(t){return t!==void 0}function gNe(...t){return()=>{t.map(pNe)}}function Rh(){}function V$(t,e){return e(t),t}function vNe(t,e){return e(t)}function _i(...t){return t}function Zn(t,e){return t(yc,e)}function On(t,e){t(L$,e)}function tT(t){t(kh)}function Ci(t){return t(IV)}function Lt(t,e){return Zn(t,mNe(e,L$))}function Zo(t,e){const n=t(yc,i=>{n(),e(i)});return n}function k3(t){let e,n;return i=>r=>{e=r,n&&clearTimeout(n),n=setTimeout(()=>{i(e)},t)}}function MV(t,e){return t===e}function bi(t=MV){let e;return n=>i=>{t(e,i)||(e=i,n(i))}}function Kt(t){return e=>n=>{t(n)&&e(n)}}function Xt(t){return e=>AV(e,t)}function Qa(t){return e=>()=>{e(t)}}function He(t,...e){const n=$Ne(...e);return((i,r)=>{switch(i){case kh:tT(t);return;case yc:return Zn(t,n(r))}})}function za(t,e){return n=>i=>{n(e=t(e,i))}}function md(t){return e=>n=>{t>0?t--:e(n)}}function gl(t){let e=null,n;return i=>r=>{e=r,!n&&(n=setTimeout(()=>{n=void 0,i(e)},t))}}function pn(...t){const e=new Array(t.length);let n=0,i=null;const r=2**t.length-1;return t.forEach((s,o)=>{const a=2**o;Zn(s,l=>{const c=n;n|=a,e[o]=l,c!==r&&n===r&&i&&(i(),i=null)})}),s=>o=>{const a=()=>{s([o].concat(e))};n===r?a():i=a}}function $Ne(...t){return e=>t.reduceRight(vNe,e)}function bNe(t){let e,n;const i=()=>e==null?void 0:e();return function(r,s){switch(r){case yc:return s?n===s?void 0:(i(),n=s,e=Zn(t,s),e):(i(),Rh);case kh:i(),n=null;return}}}function ot(t){let e=t;const n=Xn();return((i,r)=>{switch(i){case L$:e=r;break;case yc:{r(e);break}case IV:return e}return n(i,r)})}function es(t,e){return V$(ot(e),n=>Lt(t,n))}function Xn(){const t=[];return((e,n)=>{switch(e){case L$:t.slice().forEach(i=>{i(n)});return;case kh:t.splice(0,t.length);return;case yc:return t.push(n),()=>{const i=t.indexOf(n);i>-1&&t.splice(i,1)}}})}function lo(t){return V$(Xn(),e=>Lt(t,e))}function Vn(t,e=[],{singleton:n}={singleton:!0}){return{constructor:t,dependencies:e,id:SNe(),singleton:n}}const SNe=()=>Symbol();function yNe(t){const e=new Map,n=({constructor:i,dependencies:r,id:s,singleton:o})=>{if(o&&e.has(s))return e.get(s);const a=i(r.map(l=>n(l)));return o&&e.set(s,a),a};return n(t)}function nr(...t){const e=Xn(),n=new Array(t.length);let i=0;const r=2**t.length-1;return t.forEach((s,o)=>{const a=2**o;Zn(s,l=>{n[o]=l,i|=a,i===r&&On(e,n)})}),function(s,o){switch(s){case kh:{tT(e);return}case yc:return i===r&&o(n),Zn(e,o)}}}function Ht(t,e=MV){return He(t,bi(e))}function Bx(...t){return function(e,n){switch(e){case kh:return;case yc:return gNe(...t.map(i=>Zn(i,n)))}}}const fr={DEBUG:0,INFO:1,WARN:2,ERROR:3},_Ne={[fr.DEBUG]:"debug",[fr.ERROR]:"error",[fr.INFO]:"log",[fr.WARN]:"warn"},QNe=()=>typeof globalThis>"u"?window:globalThis,_c=Vn(()=>{const t=ot(fr.ERROR);return{log:ot((e,n,i=fr.INFO)=>{const r=QNe().VIRTUOSO_LOG_LEVEL??Ci(t);i>=r&&console[_Ne[i]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",e,n)}),logLevel:t}},[],{singleton:!0});function wd(t,e,n){return nT(t,e,n).callbackRef}function nT(t,e,n){const i=Z.useRef(null);let r=o=>{};const s=Z.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(o=>{const a=()=>{const l=o[0].target;l.offsetParent!==null&&t(l)};n?a():requestAnimationFrame(a)}):null,[t,n]);return r=o=>{o&&e?(s==null||s.observe(o),i.current=o):(i.current&&(s==null||s.unobserve(i.current)),i.current=null)},{callbackRef:r,ref:i}}function xNe(t,e,n,i,r,s,o,a,l){const c=Z.useCallback(d=>{const u=wNe(d.children,e,a?"offsetWidth":"offsetHeight",r);let h=d.parentElement;for(;h.dataset.virtuosoScroller===void 0;)h=h.parentElement;const O=h.lastElementChild.dataset.viewportType==="window";let p;O&&(p=h.ownerDocument.defaultView);const m=o?a?o.scrollLeft:o.scrollTop:O?a?p.scrollX||p.document.documentElement.scrollLeft:p.scrollY||p.document.documentElement.scrollTop:a?h.scrollLeft:h.scrollTop,g=o?a?o.scrollWidth:o.scrollHeight:O?a?p.document.documentElement.scrollWidth:p.document.documentElement.scrollHeight:a?h.scrollWidth:h.scrollHeight,v=o?a?o.offsetWidth:o.offsetHeight:O?a?p.innerWidth:p.innerHeight:a?h.offsetWidth:h.offsetHeight;i({scrollHeight:g,scrollTop:Math.max(m,0),viewportHeight:v}),s==null||s(a?R3("column-gap",getComputedStyle(d).columnGap,r):R3("row-gap",getComputedStyle(d).rowGap,r)),u!==null&&t(u)},[t,e,r,s,o,i,a]);return nT(c,n,l)}function wNe(t,e,n,i){const r=t.length;if(r===0)return null;const s=[];for(let o=0;o<r;o++){const a=t.item(o);if(a.dataset.index===void 0)continue;const l=parseInt(a.dataset.index),c=parseFloat(a.dataset.knownSize),d=e(a,n);if(d===0&&i("Zero-sized element, this should not happen",{child:a},fr.ERROR),d===c)continue;const u=s[s.length-1];s.length===0||u.size!==d||u.endIndex!==l-1?s.push({endIndex:l,size:d,startIndex:l}):s[s.length-1].endIndex++}return s}function R3(t,e,n){return e!=="normal"&&(e==null?void 0:e.endsWith("px"))!==!0&&n(`${t} was not resolved to pixel value correctly`,e,fr.WARN),e==="normal"?0:parseInt(e??"0",10)}function jV(t,e,n){const i=Z.useRef(null),r=Z.useCallback(l=>{if(!(l!=null&&l.offsetParent))return;const c=l.getBoundingClientRect(),d=c.width;let u,h;if(e){const O=e.getBoundingClientRect(),p=c.top-O.top;h=O.height-Math.max(0,p),u=p+e.scrollTop}else{const O=o.current.ownerDocument.defaultView;h=O.innerHeight-Math.max(0,c.top),u=c.top+O.scrollY}i.current={offsetTop:u,visibleHeight:h,visibleWidth:d},t(i.current)},[t,e]),{callbackRef:s,ref:o}=nT(r,!0,n),a=Z.useCallback(()=>{r(o.current)},[r,o]);return Z.useEffect(()=>{var c;if(e){e.addEventListener("scroll",a);const d=new ResizeObserver(()=>{requestAnimationFrame(a)});return d.observe(e),()=>{e.removeEventListener("scroll",a),d.unobserve(e)}}const l=(c=o.current)==null?void 0:c.ownerDocument.defaultView;return l==null||l.addEventListener("scroll",a),l==null||l.addEventListener("resize",a),()=>{l==null||l.removeEventListener("scroll",a),l==null||l.removeEventListener("resize",a)}},[a,e,o]),s}const zs=Vn(()=>{const t=Xn(),e=Xn(),n=ot(0),i=Xn(),r=ot(0),s=Xn(),o=Xn(),a=ot(0),l=ot(0),c=ot(0),d=ot(0),u=Xn(),h=Xn(),O=ot(!1),p=ot(!1),m=ot(!1);return Lt(He(t,Xt(({scrollTop:g})=>g)),e),Lt(He(t,Xt(({scrollHeight:g})=>g)),o),Lt(e,r),{deviation:n,fixedFooterHeight:c,fixedHeaderHeight:l,footerHeight:d,headerHeight:a,horizontalDirection:p,scrollBy:h,scrollContainerState:t,scrollHeight:o,scrollingInProgress:O,scrollTo:u,scrollTop:e,skipAnimationFrameInResizeObserver:m,smoothScrollTargetReached:i,statefulScrollTop:r,viewportHeight:s}},[],{singleton:!0}),Zf={lvl:0};function NV(t,e){const n=t.length;if(n===0)return[];let{index:i,value:r}=e(t[0]);const s=[];for(let o=1;o<n;o++){const{index:a,value:l}=e(t[o]);s.push({end:a-1,start:i,value:r}),i=a,r=l}return s.push({end:1/0,start:i,value:r}),s}function li(t){return t===Zf}function Gf(t,e){if(!li(t))return e===t.k?t.v:e<t.k?Gf(t.l,e):Gf(t.r,e)}function na(t,e,n="k"){if(li(t))return[-1/0,void 0];if(Number(t[n])===e)return[t.k,t.v];if(Number(t[n])<e){const i=na(t.r,e,n);return i[0]===-1/0?[t.k,t.v]:i}return na(t.l,e,n)}function so(t,e,n){return li(t)?VV(e,n,1):e===t.k?hr(t,{k:e,v:n}):e<t.k?E3(hr(t,{l:so(t.l,e,n)})):E3(hr(t,{r:so(t.r,e,n)}))}function Tu(){return Zf}function ku(t,e,n){if(li(t))return[];const i=na(t,e)[0];return PNe(Dx(t,i,n))}function Yx(t,e){if(li(t))return Zf;const{k:n,l:i,r}=t;if(e===n){if(li(i))return r;if(li(r))return i;const[s,o]=LV(i);return Fg(hr(t,{k:s,l:WV(i),v:o}))}return e<n?Fg(hr(t,{l:Yx(i,e)})):Fg(hr(t,{r:Yx(r,e)}))}function Jc(t){return li(t)?[]:[...Jc(t.l),{k:t.k,v:t.v},...Jc(t.r)]}function Dx(t,e,n){if(li(t))return[];const{k:i,l:r,r:s,v:o}=t;let a=[];return i>e&&(a=a.concat(Dx(r,e,n))),i>=e&&i<=n&&a.push({k:i,v:o}),i<=n&&(a=a.concat(Dx(s,e,n))),a}function Fg(t){const{l:e,lvl:n,r:i}=t;if(i.lvl>=n-1&&e.lvl>=n-1)return t;if(n>i.lvl+1){if(D1(e))return BV(hr(t,{lvl:n-1}));if(!li(e)&&!li(e.r))return hr(e.r,{l:hr(e,{r:e.r.l}),lvl:n,r:hr(t,{l:e.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(D1(t))return Ux(hr(t,{lvl:n-1}));if(!li(i)&&!li(i.l)){const r=i.l,s=D1(r)?i.lvl-1:i.lvl;return hr(r,{l:hr(t,{lvl:n-1,r:r.l}),lvl:r.lvl+1,r:Ux(hr(i,{l:r.r,lvl:s}))})}throw new Error("Unexpected empty nodes")}function hr(t,e){return VV(e.k!==void 0?e.k:t.k,e.v!==void 0?e.v:t.v,e.lvl!==void 0?e.lvl:t.lvl,e.l!==void 0?e.l:t.l,e.r!==void 0?e.r:t.r)}function WV(t){return li(t.r)?t.l:Fg(hr(t,{r:WV(t.r)}))}function D1(t){return li(t)||t.lvl>t.r.lvl}function LV(t){return li(t.r)?[t.k,t.v]:LV(t.r)}function VV(t,e,n,i=Zf,r=Zf){return{k:t,l:i,lvl:n,r,v:e}}function E3(t){return Ux(BV(t))}function BV(t){const{l:e}=t;return!li(e)&&e.lvl===t.lvl?hr(e,{r:hr(t,{l:e.r})}):t}function Ux(t){const{lvl:e,r:n}=t;return!li(n)&&!li(n.r)&&n.lvl===e&&n.r.lvl===e?hr(n,{l:hr(t,{r:n.l}),lvl:e+1}):t}function PNe(t){return NV(t,({k:e,v:n})=>({index:e,value:n}))}function YV(t,e){return!!(t&&t.startIndex===e.startIndex&&t.endIndex===e.endIndex)}function Ff(t,e){return!!(t&&t[0]===e[0]&&t[1]===e[1])}const iT=Vn(()=>({recalcInProgress:ot(!1)}),[],{singleton:!0});function DV(t,e,n){return t[S0(t,e,n)]}function S0(t,e,n,i=0){let r=t.length-1;for(;i<=r;){const s=Math.floor((i+r)/2),o=t[s],a=n(o,e);if(a===0)return s;if(a===-1){if(r-i<2)return s-1;r=s-1}else{if(r===i)return s;i=s+1}}throw new Error(`Failed binary finding record in array - ${t.join(",")}, searched for ${e}`)}function CNe(t,e,n,i){const r=S0(t,e,i),s=S0(t,n,i,r);return t.slice(r,s+1)}function bc(t,e){return Math.round(t.getBoundingClientRect()[e])}function B$(t){return!li(t.groupOffsetTree)}function rT({index:t},e){return e===t?0:e<t?-1:1}function TNe(){return{groupIndices:[],groupOffsetTree:Tu(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Tu()}}function kNe(t,e){let n=li(t)?0:1/0;for(const i of e){const{endIndex:r,size:s,startIndex:o}=i;if(n=Math.min(n,o),li(t)){t=so(t,0,s);continue}const a=ku(t,o-1,r+1);if(a.some(MNe(i)))continue;let l=!1,c=!1;for(const{end:d,start:u,value:h}of a)l?(r>=u||s===h)&&(t=Yx(t,u)):(c=h!==s,l=!0),d>r&&r>=u&&h!==s&&(t=so(t,r+1,h));c&&(t=so(t,o,s))}return[t,n]}function RNe(t){return typeof t.groupIndex<"u"}function ENe({offset:t},e){return e===t?0:e<t?-1:1}function Hf(t,e,n){if(e.length===0)return 0;const{index:i,offset:r,size:s}=DV(e,t,rT),o=t-i,a=s*o+(o-1)*n+r;return a>0?a+n:a}function UV(t,e){if(!B$(e))return t;let n=0;for(;e.groupIndices[n]<=t+n;)n++;return t+n}function qV(t,e,n){if(RNe(t))return e.groupIndices[t.groupIndex]+1;const i=t.index==="LAST"?n:t.index;let r=UV(i,e);return r=Math.max(0,r,Math.min(n,r)),r}function XNe(t,e,n,i=0){return i>0&&(e=Math.max(e,DV(t,i,rT).offset)),NV(CNe(t,e,n,ENe),ANe)}function zNe(t,[e,n,i,r]){e.length>0&&i("received item sizes",e,fr.DEBUG);const s=t.sizeTree;let o=s,a=0;if(n.length>0&&li(s)&&e.length===2){const h=e[0].size,O=e[1].size;o=n.reduce((p,m)=>so(so(p,m,h),m+1,O),o)}else[o,a]=kNe(o,e);if(o===s)return t;const{lastIndex:l,lastOffset:c,lastSize:d,offsetTree:u}=qx(t.offsetTree,a,o,r);return{groupIndices:n,groupOffsetTree:n.reduce((h,O)=>so(h,O,Hf(O,u,r)),Tu()),lastIndex:l,lastOffset:c,lastSize:d,offsetTree:u,sizeTree:o}}function INe(t){return Jc(t).map(({k:e,v:n},i,r)=>{const s=r[i+1];return{endIndex:s!==void 0?s.k-1:1/0,size:n,startIndex:e}})}function X3(t,e){let n=0,i=0;for(;n<t;)n+=e[i+1]-e[i]-1,i++;return i-(n===t?0:1)}function qx(t,e,n,i){let r=t,s=0,o=0,a=0,l=0;if(e!==0){l=S0(r,e-1,rT),a=r[l].offset;const c=na(n,e-1);s=c[0],o=c[1],r.length&&r[l].size===na(n,e)[1]&&(l-=1),r=r.slice(0,l+1)}else r=[];for(const{start:c,value:d}of ku(n,e,1/0)){const u=c-s,h=u*o+a+u*i;r.push({index:c,offset:h,size:d}),s=c,a=h,o=d}return{lastIndex:s,lastOffset:a,lastSize:o,offsetTree:r}}function ANe(t){return{index:t.index,value:t}}function MNe(t){const{endIndex:e,size:n,startIndex:i}=t;return r=>r.start===i&&(r.end===e||r.end===1/0)&&r.value===n}const jNe={offsetHeight:"height",offsetWidth:"width"},Ja=Vn(([{log:t},{recalcInProgress:e}])=>{const n=Xn(),i=Xn(),r=es(i,0),s=Xn(),o=Xn(),a=ot(0),l=ot([]),c=ot(void 0),d=ot(void 0),u=ot(void 0),h=ot(void 0),O=ot((_,P)=>bc(_,jNe[P])),p=ot(void 0),m=ot(0),g=TNe(),v=es(He(n,pn(l,t,m),za(zNe,g),bi()),g),$=es(He(l,bi(),za((_,P)=>({current:P,prev:_.current}),{current:[],prev:[]}),Xt(({prev:_})=>_)),[]);Lt(He(l,Kt(_=>_.length>0),pn(v,m),Xt(([_,P,C])=>{const X=_.reduce((z,T,k)=>so(z,T,Hf(T,P.offsetTree,C)||k),Tu());return{...P,groupIndices:_,groupOffsetTree:X}})),v),Lt(He(i,pn(v),Kt(([_,{lastIndex:P}])=>_<P),Xt(([_,{lastIndex:P,lastSize:C}])=>[{endIndex:P,size:C,startIndex:_}])),n),Lt(c,d);const b=es(He(c,Xt(_=>_===void 0)),!0);Lt(He(d,Kt(_=>_!==void 0&&li(Ci(v).sizeTree)),Xt(_=>{const P=Ci(u),C=Ci(l).length>0;return P!==void 0&&P!==0?C?[{endIndex:0,size:P,startIndex:0},{endIndex:1,size:_,startIndex:1}]:[]:[{endIndex:0,size:_,startIndex:0}]})),n),Lt(He(h,Kt(_=>_!==void 0&&_.length>0&&li(Ci(v).sizeTree)),Xt(_=>{const P=[];let C=_[0],X=0;for(let z=1;z<_.length;z++){const T=_[z];T!==C&&(P.push({endIndex:z-1,size:C,startIndex:X}),C=T,X=z)}return P.push({endIndex:_.length-1,size:C,startIndex:X}),P})),n),Lt(He(l,pn(u,d),Kt(([,_,P])=>_!==void 0&&P!==void 0),Xt(([_,P,C])=>{const X=[];for(let z=0;z<_.length;z++){const T=_[z],k=_[z+1];X.push({startIndex:T,endIndex:T,size:P}),k!==void 0&&X.push({startIndex:T+1,endIndex:k-1,size:C})}return X})),n);const S=lo(He(n,pn(v),za(({sizes:_},[P,C])=>({changed:C!==_,sizes:C}),{changed:!1,sizes:g}),Xt(_=>_.changed)));Zn(He(a,za((_,P)=>({diff:_.prev-P,prev:P}),{diff:0,prev:0}),Xt(_=>_.diff)),_=>{const{groupIndices:P}=Ci(v);if(_>0)On(e,!0),On(s,_+X3(_,P));else if(_<0){const C=Ci($);C.length>0&&(_-=X3(-_,C)),On(o,_)}}),Zn(He(a,pn(t)),([_,P])=>{_<0&&P("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:a},fr.ERROR)});const y=lo(s);Lt(He(s,pn(v),Xt(([_,P])=>{const C=P.groupIndices.length>0,X=[],z=P.lastSize;if(C){const T=Gf(P.sizeTree,0);let k=0,x=0;for(;k<_;){const E=P.groupIndices[x],I=P.groupIndices.length===x+1?1/0:P.groupIndices[x+1]-E-1;X.push({endIndex:E,size:T,startIndex:E}),X.push({endIndex:E+1+I-1,size:z,startIndex:E+1}),x++,k+=I+1}const R=Jc(P.sizeTree);return k!==_&&R.shift(),R.reduce((E,{k:I,v:A})=>{let j=E.ranges;return E.prevSize!==0&&(j=[...E.ranges,{endIndex:I+_-1,size:E.prevSize,startIndex:E.prevIndex}]),{prevIndex:I+_,prevSize:A,ranges:j}},{prevIndex:_,prevSize:0,ranges:X}).ranges}return Jc(P.sizeTree).reduce((T,{k,v:x})=>({prevIndex:k+_,prevSize:x,ranges:[...T.ranges,{endIndex:k+_-1,size:T.prevSize,startIndex:T.prevIndex}]}),{prevIndex:0,prevSize:z,ranges:[]}).ranges})),n);const Q=lo(He(o,pn(v,m),Xt(([_,{offsetTree:P},C])=>{const X=-_;return Hf(X,P,C)})));return Lt(He(o,pn(v,m),Xt(([_,P,C])=>{if(P.groupIndices.length>0){if(li(P.sizeTree))return P;let z=Tu();const T=Ci($);let k=0,x=0,R=0;for(;k<-_;){R=T[x];const E=T[x+1]-R-1;x++,k+=E+1}if(z=Jc(P.sizeTree).reduce((E,{k:I,v:A})=>so(E,Math.max(0,I+_),A),z),k!==-_){const E=Gf(P.sizeTree,R);z=so(z,0,E);const I=na(P.sizeTree,-_+1)[1];z=so(z,1,I)}return{...P,sizeTree:z,...qx(P.offsetTree,0,z,C)}}const X=Jc(P.sizeTree).reduce((z,{k:T,v:k})=>so(z,Math.max(0,T+_),k),Tu());return{...P,sizeTree:X,...qx(P.offsetTree,0,X,C)}})),v),{beforeUnshiftWith:y,data:p,defaultItemSize:d,firstItemIndex:a,fixedItemSize:c,fixedGroupSize:u,gap:m,groupIndices:l,heightEstimates:h,itemSize:O,listRefresh:S,shiftWith:o,shiftWithOffset:Q,sizeRanges:n,sizes:v,statefulTotalCount:r,totalCount:i,trackItemSizes:b,unshiftWith:s}},_i(_c,iT),{singleton:!0});function NNe(t){return t.reduce((e,n)=>(e.groupIndices.push(e.totalCount),e.totalCount+=n+1,e),{groupIndices:[],totalCount:0})}const ZV=Vn(([{groupIndices:t,sizes:e,totalCount:n},{headerHeight:i,scrollTop:r}])=>{const s=Xn(),o=Xn(),a=lo(He(s,Xt(NNe)));return Lt(He(a,Xt(l=>l.totalCount)),n),Lt(He(a,Xt(l=>l.groupIndices)),t),Lt(He(nr(r,e,i),Kt(([l,c])=>B$(c)),Xt(([l,c,d])=>na(c.groupOffsetTree,Math.max(l-d,0),"v")[0]),bi(),Xt(l=>[l])),o),{groupCounts:s,topItemsIndexes:o}},_i(Ja,zs)),Qc=Vn(([{log:t}])=>{const e=ot(!1),n=lo(He(e,Kt(i=>i),bi()));return Zn(e,i=>{i&&Ci(t)("props updated",{},fr.DEBUG)}),{didMount:n,propsReady:e}},_i(_c),{singleton:!0}),WNe=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function GV(t){const e=typeof t=="number"?{index:t}:t;return e.align||(e.align="start"),(!e.behavior||!WNe)&&(e.behavior="auto"),e.offset===void 0&&(e.offset=0),e}const zp=Vn(([{gap:t,listRefresh:e,sizes:n,totalCount:i},{fixedFooterHeight:r,fixedHeaderHeight:s,footerHeight:o,headerHeight:a,scrollingInProgress:l,scrollTo:c,smoothScrollTargetReached:d,viewportHeight:u},{log:h}])=>{const O=Xn(),p=Xn(),m=ot(0);let g=null,v=null,$=null;function b(){g!==null&&(g(),g=null),$!==null&&($(),$=null),v&&(clearTimeout(v),v=null),On(l,!1)}return Lt(He(O,pn(n,u,i,m,a,o,h),pn(t,s,r),Xt(([[S,y,Q,_,P,C,X,z],T,k,x])=>{const R=GV(S),{align:E,behavior:I,offset:A}=R,j=_-1,N=qV(R,y,j);let L=Hf(N,y.offsetTree,T)+C;E==="end"?(L+=k+na(y.sizeTree,N)[1]-Q+x,N===j&&(L+=X)):E==="center"?L+=(k+na(y.sizeTree,N)[1]-Q+x)/2:L-=P,A!==void 0&&A!==0&&(L+=A);const B=V=>{b(),V?(z("retrying to scroll to",{location:S},fr.DEBUG),On(O,S)):(On(p,!0),z("list did not change, scroll successful",{},fr.DEBUG))};if(b(),I==="smooth"){let V=!1;$=Zn(e,Y=>{V=V||Y}),g=Zo(d,()=>{B(V)})}else g=Zo(He(e,LNe(150)),B);return v=setTimeout(()=>{b()},1200),On(l,!0),z("scrolling from index to",{behavior:I,index:N,top:L},fr.DEBUG),{behavior:I,top:L}})),c),{scrollTargetReached:p,scrollToIndex:O,topListHeight:m}},_i(Ja,zs,_c),{singleton:!0});function LNe(t){return e=>{const n=setTimeout(()=>{e(!1)},t);return i=>{i&&(e(!0),clearTimeout(n))}}}function sT(t,e){t===0?e():requestAnimationFrame(()=>{sT(t-1,e)})}function oT(t,e){const n=e-1;return typeof t=="number"?t:t.index==="LAST"?n:t.index}const Ip=Vn(([{defaultItemSize:t,listRefresh:e,sizes:n},{scrollTop:i},{scrollTargetReached:r,scrollToIndex:s},{didMount:o}])=>{const a=ot(!0),l=ot(0),c=ot(!0);return Lt(He(o,pn(l),Kt(([d,u])=>u!==0),Qa(!1)),a),Lt(He(o,pn(l),Kt(([d,u])=>u!==0),Qa(!1)),c),Zn(He(nr(e,o),pn(a,n,t,c),Kt(([[,d],u,{sizeTree:h},O,p])=>d&&(!li(h)||eT(O))&&!u&&!p),pn(l)),([,d])=>{Zo(r,()=>{On(c,!0)}),sT(4,()=>{Zo(i,()=>{On(a,!0)}),On(s,d)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:l,scrolledToInitialItem:a}},_i(Ja,zs,zp,Qc),{singleton:!0});function FV(t,e){return Math.abs(t-e)<1.01}const Kf="up",HO="down",VNe="none",BNe={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},YNe=0,Ap=Vn(([{footerHeight:t,headerHeight:e,scrollBy:n,scrollContainerState:i,scrollTop:r,viewportHeight:s}])=>{const o=ot(!1),a=ot(!0),l=Xn(),c=Xn(),d=ot(4),u=ot(YNe),h=es(He(Bx(He(Ht(r),md(1),Qa(!0)),He(Ht(r),md(1),Qa(!1),k3(100))),bi()),!1),O=es(He(Bx(He(n,Qa(!0)),He(n,Qa(!1),k3(200))),bi()),!1);Lt(He(nr(Ht(r),Ht(u)),Xt(([$,b])=>$<=b),bi()),a),Lt(He(a,gl(50)),c);const p=lo(He(nr(i,Ht(s),Ht(e),Ht(t),Ht(d)),za(($,[{scrollHeight:b,scrollTop:S},y,Q,_,P])=>{const C=S+y-b>-P,X={scrollHeight:b,scrollTop:S,viewportHeight:y};if(C){let T,k;return S>$.state.scrollTop?(T="SCROLLED_DOWN",k=$.state.scrollTop-S):(T="SIZE_DECREASED",k=$.state.scrollTop-S||$.scrollTopDelta),{atBottom:!0,atBottomBecause:T,scrollTopDelta:k,state:X}}let z;return X.scrollHeight>$.state.scrollHeight?z="SIZE_INCREASED":y<$.state.viewportHeight?z="VIEWPORT_HEIGHT_DECREASING":S<$.state.scrollTop?z="SCROLLING_UPWARDS":z="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:z,state:X}},BNe),bi(($,b)=>$!==void 0&&$.atBottom===b.atBottom))),m=es(He(i,za(($,{scrollHeight:b,scrollTop:S,viewportHeight:y})=>{if(!FV($.scrollHeight,b)){const Q=b-(S+y)<1;return $.scrollTop!==S&&Q?{changed:!0,jump:$.scrollTop-S,scrollHeight:b,scrollTop:S}:{changed:!0,jump:0,scrollHeight:b,scrollTop:S}}return{changed:!1,jump:0,scrollHeight:b,scrollTop:S}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Kt($=>$.changed),Xt($=>$.jump)),0);Lt(He(p,Xt($=>$.atBottom)),o),Lt(He(o,gl(50)),l);const g=ot(HO);Lt(He(i,Xt(({scrollTop:$})=>$),bi(),za(($,b)=>Ci(O)?{direction:$.direction,prevScrollTop:b}:{direction:b<$.prevScrollTop?Kf:HO,prevScrollTop:b},{direction:HO,prevScrollTop:0}),Xt($=>$.direction)),g),Lt(He(i,gl(50),Qa(VNe)),g);const v=ot(0);return Lt(He(h,Kt($=>!$),Qa(0)),v),Lt(He(r,gl(100),pn(h),Kt(([$,b])=>b),za(([$,b],[S])=>[b,S],[0,0]),Xt(([$,b])=>b-$)),v),{atBottomState:p,atBottomStateChange:l,atBottomThreshold:d,atTopStateChange:c,atTopThreshold:u,isAtBottom:o,isAtTop:a,isScrolling:h,lastJumpDueToItemResize:m,scrollDirection:g,scrollVelocity:v}},_i(zs)),Jf="top",ep="bottom",z3="none";function I3(t,e,n){return typeof t=="number"?n===Kf&&e===Jf||n===HO&&e===ep?t:0:n===Kf?e===Jf?t.main:t.reverse:e===ep?t.main:t.reverse}function A3(t,e){return typeof t=="number"?t:t[e]??0}const aT=Vn(([{deviation:t,fixedHeaderHeight:e,headerHeight:n,scrollTop:i,viewportHeight:r}])=>{const s=Xn(),o=ot(0),a=ot(0),l=ot(0),c=es(He(nr(Ht(i),Ht(r),Ht(n),Ht(s,Ff),Ht(l),Ht(o),Ht(e),Ht(t),Ht(a)),Xt(([d,u,h,[O,p],m,g,v,$,b])=>{const S=d-$,y=g+v,Q=Math.max(h-S,0);let _=z3;const P=A3(b,Jf),C=A3(b,ep);return O-=$,O+=h+v,p+=h+v,p-=$,O>d+y-P&&(_=Kf),p<d-Q+u+C&&(_=HO),_!==z3?[Math.max(S-h-I3(m,Jf,_)-P,0),S-Q-v+u+I3(m,ep,_)+C]:null}),Kt(d=>d!==null),bi(Ff)),[0,0]);return{increaseViewportBy:a,listBoundary:s,overscan:l,topListHeight:o,visibleRange:c}},_i(zs),{singleton:!0});function DNe(t,e,n){if(B$(e)){const i=UV(t,e);return[{index:na(e.groupOffsetTree,i)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:i,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:t,offset:0,size:0}]}const U1={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Hg(t,e,n,i,r,s){const{lastIndex:o,lastOffset:a,lastSize:l}=r;let c=0,d=0;if(t.length>0){c=t[0].offset;const m=t[t.length-1];d=m.offset+m.size}const u=n-o,h=a+u*l+(u-1)*i,O=c,p=h-d;return{bottom:d,firstItemIndex:s,items:M3(t,r,s),offsetBottom:p,offsetTop:c,top:O,topItems:M3(e,r,s),topListHeight:e.reduce((m,g)=>g.size+m,0),totalCount:n}}function HV(t,e,n,i,r,s){let o=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-o>=t)break;o++}const a=t+o,l=oT(e,a),c=Array.from({length:a}).map((d,u)=>({data:s[u+l],index:u+l,offset:0,size:0}));return Hg(c,[],a,r,n,i)}function M3(t,e,n){if(t.length===0)return[];if(!B$(e))return t.map(c=>({...c,index:c.index+n,originalIndex:c.index}));const i=t[0].index,r=t[t.length-1].index,s=[],o=ku(e.groupOffsetTree,i,r);let a,l=0;for(const c of t){(!a||a.end<c.index)&&(a=o.shift(),l=e.groupIndices.indexOf(a.start));let d;c.index===a.start?d={index:l,type:"group"}:d={groupIndex:l,index:c.index-(l+1)+n},s.push({...d,data:c.data,offset:c.offset,originalIndex:c.index,size:c.size})}return s}function j3(t,e){return t===void 0?0:typeof t=="number"?t:t[e]??0}const Pd=Vn(([{data:t,firstItemIndex:e,gap:n,sizes:i,totalCount:r},s,{listBoundary:o,topListHeight:a,visibleRange:l},{initialTopMostItemIndex:c,scrolledToInitialItem:d},{topListHeight:u},h,{didMount:O},{recalcInProgress:p}])=>{const m=ot([]),g=ot(0),v=Xn(),$=ot(0);Lt(s.topItemsIndexes,m);const b=es(He(nr(O,p,Ht(l,Ff),Ht(r),Ht(i),Ht(c),d,Ht(m),Ht(e),Ht(n),Ht($),t),Kt(([_,P,,C,,,,,,,,X])=>{const z=X!==void 0&&X.length!==C;return _&&!P&&!z}),Xt(([,,[_,P],C,X,z,T,k,x,R,E,I])=>{var ee,fe;const A=X,{offsetTree:j,sizeTree:N}=A,L=Ci(g);if(C===0)return{...U1,totalCount:C};if(_===0&&P===0)return L===0?{...U1,totalCount:C}:HV(L,z,X,x,R,I||[]);if(li(N))return L>0?null:Hg(DNe(oT(z,C),A,I),[],C,R,A,x);const B=[];if(k.length>0){const se=k[0],te=k[k.length-1];let oe=0;for(const G of ku(N,se,te)){const H=G.value,K=Math.max(G.start,se),ae=Math.min(G.end,te);for(let de=K;de<=ae;de++)B.push({data:I==null?void 0:I[de],index:de,offset:oe,size:H}),oe+=H}}if(!T)return Hg([],B,C,R,A,x);const V=k.length>0?k[k.length-1]+1:0,Y=XNe(j,_,P,V);if(Y.length===0)return null;const W=C-1,q=V$([],se=>{for(const te of Y){const oe=te.value;let G=oe.offset,H=te.start;const K=oe.size;if(oe.offset<_){H+=Math.floor((_-oe.offset+R)/(K+R));const de=H-te.start;G+=de*K+de*R}H<V&&(G+=(V-H)*K,H=V);const ae=Math.min(te.end,W);for(let de=H;de<=ae&&!(G>=P);de++)se.push({data:I==null?void 0:I[de],index:de,offset:G,size:K}),G+=K+R}}),ne=j3(E,Jf),D=j3(E,ep);if(q.length>0&&(ne>0||D>0)){const se=q[0],te=q[q.length-1];if(ne>0&&se.index>V){const oe=Math.min(ne,se.index-V),G=[];let H=se.offset;for(let K=se.index-1;K>=se.index-oe;K--){const ae=((ee=ku(N,K,K)[0])==null?void 0:ee.value)??se.size;H-=ae+R,G.unshift({data:I==null?void 0:I[K],index:K,offset:H,size:ae})}q.unshift(...G)}if(D>0&&te.index<W){const oe=Math.min(D,W-te.index);let G=te.offset+te.size+R;for(let H=te.index+1;H<=te.index+oe;H++){const K=((fe=ku(N,H,H)[0])==null?void 0:fe.value)??te.size;q.push({data:I==null?void 0:I[H],index:H,offset:G,size:K}),G+=K+R}}}return Hg(q,B,C,R,A,x)}),Kt(_=>_!==null),bi()),U1);Lt(He(t,Kt(eT),Xt(_=>_==null?void 0:_.length)),r),Lt(He(b,Xt(_=>_.topListHeight)),u),Lt(u,a),Lt(He(b,Xt(_=>[_.top,_.bottom])),o),Lt(He(b,Xt(_=>_.items)),v);const S=lo(He(b,Kt(({items:_})=>_.length>0),pn(r,t),Kt(([{items:_},P])=>_[_.length-1].originalIndex===P-1),Xt(([,_,P])=>[_-1,P]),bi(Ff),Xt(([_])=>_))),y=lo(He(b,gl(200),Kt(({items:_,topItems:P})=>_.length>0&&_[0].originalIndex===P.length),Xt(({items:_})=>_[0].index),bi())),Q=lo(He(b,Kt(({items:_})=>_.length>0),Xt(({items:_})=>{let P=0,C=_.length-1;for(;_[P].type==="group"&&P<C;)P++;for(;_[C].type==="group"&&C>P;)C--;return{endIndex:_[C].index,startIndex:_[P].index}}),bi(YV)));return{endReached:S,initialItemCount:g,itemsRendered:v,listState:b,minOverscanItemCount:$,rangeChanged:Q,startReached:y,topItemsIndexes:m,...h}},_i(Ja,ZV,aT,Ip,zp,Ap,Qc,iT),{singleton:!0}),KV=Vn(([{fixedFooterHeight:t,fixedHeaderHeight:e,footerHeight:n,headerHeight:i},{listState:r}])=>{const s=Xn(),o=es(He(nr(n,t,i,e,r),Xt(([a,l,c,d,u])=>a+l+c+d+u.offsetBottom+u.bottom)),0);return Lt(Ht(o),s),{totalListHeight:o,totalListHeightChanged:s}},_i(zs,Pd),{singleton:!0}),UNe=Vn(([{viewportHeight:t},{totalListHeight:e}])=>{const n=ot(!1),i=es(He(nr(n,t,e),Kt(([r])=>r),Xt(([,r,s])=>Math.max(0,r-s)),gl(0),bi()),0);return{alignToBottom:n,paddingTopAddition:i}},_i(zs,KV),{singleton:!0}),JV=Vn(()=>({context:ot(null)})),qNe=({itemBottom:t,itemTop:e,locationParams:{align:n,behavior:i,...r},viewportBottom:s,viewportTop:o})=>e<o?{...r,align:n??"start",...i!==void 0?{behavior:i}:{}}:t>s?{...r,align:n??"end",...i!==void 0?{behavior:i}:{}}:null,eB=Vn(([{gap:t,sizes:e,totalCount:n},{fixedFooterHeight:i,fixedHeaderHeight:r,headerHeight:s,scrollingInProgress:o,scrollTop:a,viewportHeight:l},{scrollToIndex:c}])=>{const d=Xn();return Lt(He(d,pn(e,l,n,s,r,i,a),pn(t),Xt(([[u,h,O,p,m,g,v,$],b])=>{const{calculateViewLocation:S=qNe,done:y,...Q}=u,_=qV(u,h,p-1),P=Hf(_,h.offsetTree,b)+m+g,C=P+na(h.sizeTree,_)[1],X=$+g,z=$+O-v,T=S({itemBottom:C,itemTop:P,locationParams:Q,viewportBottom:z,viewportTop:X});return T!==null?y&&Zo(He(o,Kt(k=>!k),md(Ci(o)?1:2)),y):y==null||y(),T}),Kt(u=>u!==null)),c),{scrollIntoView:d}},_i(Ja,zs,zp,Pd,_c),{singleton:!0});function N3(t){return t===!1?!1:t==="smooth"?"smooth":"auto"}const ZNe=(t,e)=>typeof t=="function"?N3(t(e)):e&&N3(t),GNe=Vn(([{listRefresh:t,totalCount:e,fixedItemSize:n,data:i},{atBottomState:r,isAtBottom:s},{scrollToIndex:o},{scrolledToInitialItem:a},{didMount:l,propsReady:c},{log:d},{scrollingInProgress:u},{context:h},{scrollIntoView:O}])=>{const p=ot(!1),m=Xn();let g=null;function v(y){On(o,{align:"end",behavior:y,index:"LAST"})}Zn(He(nr(He(Ht(e),md(1)),l),pn(Ht(p),s,a,u),Xt(([[y,Q],_,P,C,X])=>{let z=Q&&C,T="auto";return z&&(T=ZNe(_,P||X),z=z&&T!==!1),{followOutputBehavior:T,shouldFollow:z,totalCount:y}}),Kt(({shouldFollow:y})=>y)),({followOutputBehavior:y,totalCount:Q})=>{g!==null&&(g(),g=null),Ci(n)!==void 0?requestAnimationFrame(()=>{Ci(d)("following output to ",{totalCount:Q},fr.DEBUG),v(y)}):g=Zo(t,()=>{Ci(d)("following output to ",{totalCount:Q},fr.DEBUG),v(y),g=null})});function $(y){const Q=Zo(r,_=>{y&&!_.atBottom&&_.notAtBottomBecause==="SIZE_INCREASED"&&g===null&&(Ci(d)("scrolling to bottom due to increased size",{},fr.DEBUG),v("auto"))});setTimeout(Q,100)}Zn(He(nr(Ht(p),e,c),Kt(([y,,Q])=>y!==!1&&Q),za(({value:y},[,Q])=>({refreshed:y===Q,value:Q}),{refreshed:!1,value:0}),Kt(({refreshed:y})=>y),pn(p,e)),([,y])=>{Ci(a)&&$(y!==!1)}),Zn(m,()=>{$(Ci(p)!==!1)}),Zn(nr(Ht(p),r),([y,Q])=>{y!==!1&&!Q.atBottom&&Q.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&v("auto")});const b=ot(null),S=Xn();return Lt(Bx(He(Ht(i),Xt(y=>(y==null?void 0:y.length)??0)),He(Ht(e))),S),Zn(He(nr(He(S,md(1)),l),pn(Ht(b),a,u,h),Xt(([[y,Q],_,P,C,X])=>Q&&P&&(_==null?void 0:_({context:X,totalCount:y,scrollingInProgress:C}))),Kt(y=>!!y),gl(0)),y=>{g!==null&&(g(),g=null),Ci(n)!==void 0?requestAnimationFrame(()=>{Ci(d)("scrolling into view",{}),On(O,y)}):g=Zo(t,()=>{Ci(d)("scrolling into view",{}),On(O,y),g=null})}),{autoscrollToBottom:m,followOutput:p,scrollIntoViewOnChange:b}},_i(Ja,Ap,zp,Ip,Qc,_c,zs,JV,eB)),FNe=Vn(([{data:t,firstItemIndex:e,gap:n,sizes:i},{initialTopMostItemIndex:r},{initialItemCount:s,listState:o},{didMount:a}])=>(Lt(He(a,pn(s),Kt(([,l])=>l!==0),pn(r,i,e,n,t),Xt(([[,l],c,d,u,h,O=[]])=>HV(l,c,d,u,h,O))),o),{}),_i(Ja,Ip,Pd,Qc),{singleton:!0}),HNe=Vn(([{didMount:t},{scrollTo:e},{listState:n}])=>{const i=ot(0);return Zn(He(t,pn(i),Kt(([,r])=>r!==0),Xt(([,r])=>({top:r}))),r=>{Zo(He(n,md(1),Kt(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{On(e,r)})})}),{initialScrollTop:i}},_i(Qc,zs,Pd),{singleton:!0}),tB=Vn(([{scrollVelocity:t}])=>{const e=ot(!1),n=Xn(),i=ot(!1);return Lt(He(t,pn(i,e,n),Kt(([r,s])=>s!==!1&&s!==void 0),Xt(([r,s,o,a])=>{const{enter:l,exit:c}=s;if(o){if(c(r,a))return!1}else if(l(r,a))return!0;return o}),bi()),e),Zn(He(nr(e,t,n),pn(i)),([[r,s,o],a])=>{r&&a!==!1&&a!==void 0&&a.change&&a.change(s,o)}),{isSeeking:e,scrollSeekConfiguration:i,scrollSeekRangeChanged:n,scrollVelocity:t}},_i(Ap),{singleton:!0}),lT=Vn(([{scrollContainerState:t,scrollTo:e}])=>{const n=Xn(),i=Xn(),r=Xn(),s=ot(!1),o=ot(void 0);return Lt(He(nr(n,i),Xt(([{scrollHeight:a,scrollTop:l,viewportHeight:c},{offsetTop:d}])=>({scrollHeight:a,scrollTop:Math.max(0,l-d),viewportHeight:c}))),t),Lt(He(e,pn(i),Xt(([a,{offsetTop:l}])=>({...a,top:a.top+l}))),r),{customScrollParent:o,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:r,windowViewportRect:i}},_i(zs)),KNe=Vn(([{sizeRanges:t,sizes:e},{headerHeight:n,scrollTop:i},{initialTopMostItemIndex:r},{didMount:s},{useWindowScroll:o,windowScrollContainerState:a,windowViewportRect:l}])=>{const c=Xn(),d=ot(void 0),u=ot(null),h=ot(null);return Lt(a,u),Lt(l,h),Zn(He(c,pn(e,i,o,u,h,n)),([O,p,m,g,v,$,b])=>{const S=INe(p.sizeTree);g&&v!==null&&$!==null&&(m=v.scrollTop-$.offsetTop),m-=b,O({ranges:S,scrollTop:m})}),Lt(He(d,Kt(eT),Xt(JNe)),r),Lt(He(s,pn(d),Kt(([,O])=>O!==void 0),bi(),Xt(([,O])=>O.ranges)),t),{getState:c,restoreStateFrom:d}},_i(Ja,zs,Ip,Qc,lT));function JNe(t){return{align:"start",index:0,offset:t.scrollTop}}const eWe=Vn(([{topItemsIndexes:t}])=>{const e=ot(0);return Lt(He(e,Kt(n=>n>=0),Xt(n=>Array.from({length:n}).map((i,r)=>r))),t),{topItemCount:e}},_i(Pd));function nB(t){let e=!1,n;return(()=>(e||(e=!0,n=t()),n))}const tWe=nB(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),nWe=Vn(([{deviation:t,scrollBy:e,scrollingInProgress:n,scrollTop:i},{isAtBottom:r,isScrolling:s,lastJumpDueToItemResize:o,scrollDirection:a},{listState:l},{beforeUnshiftWith:c,gap:d,shiftWithOffset:u,sizes:h},{log:O},{recalcInProgress:p}])=>{const m=lo(He(l,pn(o),za(([,v,$,b],[{bottom:S,items:y,offsetBottom:Q,totalCount:_},P])=>{const C=S+Q;let X=0;return $===_&&v.length>0&&y.length>0&&(y[0].originalIndex===0&&v[0].originalIndex===0||(X=C-b,X!==0&&(X+=P))),[X,y,_,C]},[0,[],0,0]),Kt(([v])=>v!==0),pn(i,a,n,r,O,p),Kt(([,v,$,b,,,S])=>!S&&!b&&v!==0&&$===Kf),Xt(([[v],,,,,$])=>($("Upward scrolling compensation",{amount:v},fr.DEBUG),v))));function g(v){v>0?(On(e,{behavior:"auto",top:-v}),On(t,0)):(On(t,0),On(e,{behavior:"auto",top:-v}))}return Zn(He(m,pn(t,s)),([v,$,b])=>{b&&tWe()?On(t,$-v):g(-v)}),Zn(He(nr(es(s,!1),t,p),Kt(([v,$,b])=>!v&&!b&&$!==0),Xt(([v,$])=>$),gl(1)),g),Lt(He(u,Xt(v=>({top:-v}))),e),Zn(He(c,pn(h,d),Xt(([v,{groupIndices:$,lastSize:b,sizeTree:S},y])=>{function Q(z){return z*(b+y)}if($.length===0)return Q(v);let _=0;const P=Gf(S,0);let C=0,X=0;for(;C<v;){C++,_+=P;let z=$.length===X+1?1/0:$[X+1]-$[X]-1;C+z>v&&(_-=P,z=v-C+1),C+=z,_+=Q(z),X++}return _})),v=>{On(t,v),requestAnimationFrame(()=>{On(e,{top:v}),requestAnimationFrame(()=>{On(t,0),On(p,!1)})})}),{deviation:t}},_i(zs,Ap,Pd,Ja,_c,iT)),iWe=Vn(([t,e,n,i,r,s,o,a,l,c,d])=>({...t,...e,...n,...i,...r,...s,...o,...a,...l,...c,...d}),_i(aT,FNe,Qc,tB,KV,HNe,UNe,lT,eB,_c,JV)),iB=Vn(([{data:t,defaultItemSize:e,firstItemIndex:n,fixedItemSize:i,fixedGroupSize:r,gap:s,groupIndices:o,heightEstimates:a,itemSize:l,sizeRanges:c,sizes:d,statefulTotalCount:u,totalCount:h,trackItemSizes:O},{initialItemFinalLocationReached:p,initialTopMostItemIndex:m,scrolledToInitialItem:g},v,$,b,S,{scrollToIndex:y},Q,{topItemCount:_},{groupCounts:P},C])=>{const{listState:X,minOverscanItemCount:z,topItemsIndexes:T,rangeChanged:k,...x}=S;return Lt(k,C.scrollSeekRangeChanged),Lt(He(C.windowViewportRect,Xt(R=>R.visibleHeight)),v.viewportHeight),{data:t,defaultItemHeight:e,firstItemIndex:n,fixedItemHeight:i,fixedGroupHeight:r,gap:s,groupCounts:P,heightEstimates:a,initialItemFinalLocationReached:p,initialTopMostItemIndex:m,scrolledToInitialItem:g,sizeRanges:c,topItemCount:_,topItemsIndexes:T,totalCount:h,...b,groupIndices:o,itemSize:l,listState:X,minOverscanItemCount:z,scrollToIndex:y,statefulTotalCount:u,trackItemSizes:O,rangeChanged:k,...x,...C,...v,sizes:d,...$}},_i(Ja,Ip,zs,KNe,GNe,Pd,zp,nWe,eWe,ZV,iWe));function rWe(t,e){const n={},i={};let r=0;const s=t.length;for(;r<s;)i[t[r]]=1,r+=1;for(const o in e)Object.hasOwn(i,o)||(n[o]=e[o]);return n}const ng=typeof document<"u"?Z.useLayoutEffect:Z.useEffect;function rB(t,e,n){const i=Object.keys(e.required||{}),r=Object.keys(e.optional||{}),s=Object.keys(e.methods||{}),o=Object.keys(e.events||{}),a=Z.createContext({});function l(g,v){g.propsReady!==void 0&&On(g.propsReady,!1);for(const $ of i){const b=g[e.required[$]];On(b,v[$])}for(const $ of r)if($ in v){const b=g[e.optional[$]];On(b,v[$])}g.propsReady!==void 0&&On(g.propsReady,!0)}function c(g){return s.reduce((v,$)=>(v[$]=b=>{const S=g[e.methods[$]];On(S,b)},v),{})}function d(g){return o.reduce((v,$)=>(v[$]=bNe(g[e.events[$]]),v),{})}const u=Z.forwardRef(function(g,v){const{children:$,...b}=g,[S]=Z.useState(()=>V$(yNe(t),_=>{l(_,b)})),[y]=Z.useState(T3(d,S));ng(()=>{for(const _ of o)_ in b&&Zn(y[_],b[_]);return()=>{Object.values(y).map(tT)}},[b,y,S]),ng(()=>{l(S,b)}),Z.useImperativeHandle(v,C3(c(S)));const Q=n;return w.jsx(a.Provider,{value:S,children:n!==void 0?w.jsx(Q,{...rWe([...i,...r,...o],b),children:$}):$})}),h=g=>{const v=Z.useContext(a);return Z.useCallback($=>{On(v[g],$)},[v,g])},O=g=>{const v=Z.useContext(a)[g],$=Z.useCallback(b=>Zn(v,b),[v]);return Z.useSyncExternalStore($,()=>Ci(v),()=>Ci(v))},p=g=>{const v=Z.useContext(a)[g],[$,b]=Z.useState(T3(Ci,v));return ng(()=>Zn(v,S=>{S!==$&&b(C3(S))}),[v,$]),$},m=Z.version.startsWith("18")?O:p;return{Component:u,useEmitter:(g,v)=>{const $=Z.useContext(a)[g];ng(()=>Zn($,v),[v,$])},useEmitterValue:m,usePublisher:h}}const sB=Z.createContext(void 0),oB=Z.createContext(void 0),q1="-webkit-sticky",W3="sticky",cT=nB(()=>{if(typeof document>"u")return W3;const t=document.createElement("div");return t.style.position=q1,t.style.position===q1?q1:W3}),aB=typeof document<"u"?Z.useLayoutEffect:Z.useEffect;function Z1(t){return"self"in t}function sWe(t){return"body"in t}function lB(t,e,n,i=Rh,r,s){const o=Z.useRef(null),a=Z.useRef(null),l=Z.useRef(null),c=Z.useCallback(h=>{let O,p,m;const g=h.target;if(sWe(g)||Z1(g)){const $=Z1(g)?g:g.defaultView;m=s===!0?$.scrollX:$.scrollY,O=s===!0?$.document.documentElement.scrollWidth:$.document.documentElement.scrollHeight,p=s===!0?$.innerWidth:$.innerHeight}else m=s===!0?g.scrollLeft:g.scrollTop,O=s===!0?g.scrollWidth:g.scrollHeight,p=s===!0?g.offsetWidth:g.offsetHeight;const v=()=>{t({scrollHeight:O,scrollTop:Math.max(m,0),viewportHeight:p})};h.suppressFlushSync===!0?v():sd.flushSync(v),a.current!==null&&(m===a.current||m<=0||m===O-p)&&(a.current=null,e(!0),l.current&&(clearTimeout(l.current),l.current=null))},[t,e,s]);Z.useEffect(()=>{const h=r||o.current;return i(r||o.current),c({suppressFlushSync:!0,target:h}),h.addEventListener("scroll",c,{passive:!0}),()=>{i(null),h.removeEventListener("scroll",c)}},[o,c,n,i,r]);function d(h){const O=o.current;if(!O||(s===!0?"offsetWidth"in O&&O.offsetWidth===0:"offsetHeight"in O&&O.offsetHeight===0))return;const p=h.behavior==="smooth";let m,g,v;Z1(O)?(g=Math.max(bc(O.document.documentElement,s===!0?"width":"height"),s===!0?O.document.documentElement.scrollWidth:O.document.documentElement.scrollHeight),m=s===!0?O.innerWidth:O.innerHeight,v=s===!0?window.scrollX:window.scrollY):(g=O[s===!0?"scrollWidth":"scrollHeight"],m=bc(O,s===!0?"width":"height"),v=O[s===!0?"scrollLeft":"scrollTop"]);const $=g-m;if(h.top=Math.ceil(Math.max(Math.min($,h.top),0)),FV(m,g)||h.top===v){t({scrollHeight:g,scrollTop:v,viewportHeight:m}),p&&e(!0);return}p?(a.current=h.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,a.current=null,e(!0)},1e3)):a.current=null,s===!0&&(h={...h.behavior!==void 0?{behavior:h.behavior}:{},left:h.top}),O.scrollTo(h)}function u(h){s===!0&&(h={...h.behavior!==void 0?{behavior:h.behavior}:{},...h.top!==void 0?{left:h.top}:{}}),o.current.scrollBy(h)}return{scrollByCallback:u,scrollerRef:o,scrollToCallback:d}}function dT(t){return t}const oWe=Vn(()=>{const t=ot(a=>`Item ${a}`),e=ot(a=>`Group ${a}`),n=ot({}),i=ot(dT),r=ot("div"),s=ot(Rh),o=(a,l=null)=>es(He(n,Xt(c=>c[a]),bi()),l);return{components:n,computeItemKey:i,EmptyPlaceholder:o("EmptyPlaceholder"),FooterComponent:o("Footer"),GroupComponent:o("Group","div"),groupContent:e,HeaderComponent:o("Header"),HeaderFooterTag:r,ItemComponent:o("Item","div"),itemContent:t,ListComponent:o("List","div"),ScrollerComponent:o("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:o("ScrollSeekPlaceholder"),TopItemListComponent:o("TopItemList")}}),aWe=Vn(([t,e])=>({...t,...e}),_i(iB,oWe)),lWe=({height:t})=>w.jsx("div",{style:{height:t}}),cWe={overflowAnchor:"none",position:cT(),zIndex:1},cB={overflowAnchor:"none"},dWe={...cB,display:"inline-block",height:"100%"},L3=Z.memo(function({showTopList:t=!1}){const e=ln("listState"),n=Po("sizeRanges"),i=ln("useWindowScroll"),r=ln("customScrollParent"),s=Po("windowScrollContainerState"),o=Po("scrollContainerState"),a=r||i?s:o,l=ln("itemContent"),c=ln("context"),d=ln("groupContent"),u=ln("trackItemSizes"),h=ln("itemSize"),O=ln("log"),p=Po("gap"),m=ln("horizontalDirection"),{callbackRef:g}=xNe(n,h,u,t?Rh:a,O,p,r,m,ln("skipAnimationFrameInResizeObserver")),[v,$]=Z.useState(0);uT("deviation",x=>{v!==x&&$(x)});const b=ln("EmptyPlaceholder"),S=ln("ScrollSeekPlaceholder")??lWe,y=ln("ListComponent"),Q=ln("ItemComponent"),_=ln("GroupComponent"),P=ln("computeItemKey"),C=ln("isSeeking"),X=ln("groupIndices").length>0,z=ln("alignToBottom"),T=ln("initialItemFinalLocationReached"),k=t?{}:{boxSizing:"border-box",...m?{display:"inline-block",height:"100%",marginLeft:v!==0?v:z?"auto":0,paddingLeft:e.offsetTop,paddingRight:e.offsetBottom,whiteSpace:"nowrap"}:{marginTop:v!==0?v:z?"auto":0,paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},...T?{}:{visibility:"hidden"}};return!t&&e.totalCount===0&&b!==null&&b!==void 0?w.jsx(b,{...Jr(b,c)}):w.jsx(y,{...Jr(y,c),"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",ref:g,style:k,children:(t?e.topItems:e.items).map(x=>{const R=x.originalIndex,E=P(R+e.firstItemIndex,x.data,c);return C?f.createElement(S,{...Jr(S,c),height:x.size,index:x.index,key:E,type:x.type||"item",...x.type==="group"?{}:{groupIndex:x.groupIndex}}):x.type==="group"?f.createElement(_,{...Jr(_,c),"data-index":R,"data-item-index":x.index,"data-known-size":x.size,key:E,style:cWe},d(x.index,c)):f.createElement(Q,{...Jr(Q,c),...fWe(Q,x.data),"data-index":R,"data-item-group-index":x.groupIndex,"data-item-index":x.index,"data-known-size":x.size,key:E,style:m?dWe:cB},X?l(x.index,x.groupIndex,x.data,c):l(x.index,x.data,c))})})}),uWe={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},hWe={outline:"none",overflowX:"auto",position:"relative"},Y$=t=>({height:"100%",position:"absolute",top:0,width:"100%",...t?{display:"flex",flexDirection:"column"}:void 0}),OWe={position:cT(),top:0,width:"100%",zIndex:1};function Jr(t,e){if(typeof t!="string")return{context:e}}function fWe(t,e){return{item:typeof t=="string"?void 0:e}}const pWe=Z.memo(function(){const t=ln("HeaderComponent"),e=Po("headerHeight"),n=ln("HeaderFooterTag"),i=wd(Z.useMemo(()=>s=>{e(bc(s,"height"))},[e]),!0,ln("skipAnimationFrameInResizeObserver")),r=ln("context");return t!=null?w.jsx(n,{ref:i,children:w.jsx(t,{...Jr(t,r)})}):null}),mWe=Z.memo(function(){const t=ln("FooterComponent"),e=Po("footerHeight"),n=ln("HeaderFooterTag"),i=wd(Z.useMemo(()=>s=>{e(bc(s,"height"))},[e]),!0,ln("skipAnimationFrameInResizeObserver")),r=ln("context");return t!=null?w.jsx(n,{ref:i,children:w.jsx(t,{...Jr(t,r)})}):null});function dB({useEmitter:t,useEmitterValue:e,usePublisher:n}){return Z.memo(function({children:i,style:r,context:s,...o}){const a=n("scrollContainerState"),l=e("ScrollerComponent"),c=n("smoothScrollTargetReached"),d=e("scrollerRef"),u=e("horizontalDirection")||!1,{scrollByCallback:h,scrollerRef:O,scrollToCallback:p}=lB(a,c,l,d,void 0,u);return t("scrollTo",p),t("scrollBy",h),w.jsx(l,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:O,style:{...u?hWe:uWe,...r},tabIndex:0,...o,...Jr(l,s),children:i})})}function uB({useEmitter:t,useEmitterValue:e,usePublisher:n}){return Z.memo(function({children:i,style:r,context:s,...o}){const a=n("windowScrollContainerState"),l=e("ScrollerComponent"),c=n("smoothScrollTargetReached"),d=e("totalListHeight"),u=e("deviation"),h=e("customScrollParent"),O=Z.useRef(null),p=e("scrollerRef"),{scrollByCallback:m,scrollerRef:g,scrollToCallback:v}=lB(a,c,l,p,h);return aB(()=>{var $;return g.current=h||(($=O.current)==null?void 0:$.ownerDocument.defaultView),()=>{g.current=null}},[g,h]),t("windowScrollTo",v),t("scrollBy",m),w.jsx(l,{ref:O,"data-virtuoso-scroller":!0,style:{position:"relative",...r,...d!==0?{height:d+u}:void 0},...o,...Jr(l,s),children:i})})}const gWe=({children:t})=>{const e=Z.useContext(sB),n=Po("viewportHeight"),i=Po("fixedItemHeight"),r=ln("alignToBottom"),s=ln("horizontalDirection"),o=Z.useMemo(()=>AV(n,l=>bc(l,s?"width":"height")),[n,s]),a=wd(o,!0,ln("skipAnimationFrameInResizeObserver"));return Z.useEffect(()=>{e&&(n(e.viewportHeight),i(e.itemHeight))},[e,n,i]),w.jsx("div",{"data-viewport-type":"element",ref:a,style:Y$(r),children:t})},vWe=({children:t})=>{const e=Z.useContext(sB),n=Po("windowViewportRect"),i=Po("fixedItemHeight"),r=ln("customScrollParent"),s=jV(n,r,ln("skipAnimationFrameInResizeObserver")),o=ln("alignToBottom");return Z.useEffect(()=>{e&&(i(e.itemHeight),n({offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:100}))},[e,n,i]),w.jsx("div",{"data-viewport-type":"window",ref:s,style:Y$(o),children:t})},$We=({children:t})=>{const e=ln("TopItemListComponent")??"div",n=ln("headerHeight"),i={...OWe,marginTop:`${n}px`},r=ln("context");return w.jsx(e,{style:i,...Jr(e,r),children:t})},bWe=Z.memo(function(t){const e=ln("useWindowScroll"),n=ln("topItemsIndexes").length>0,i=ln("customScrollParent"),r=ln("context");return w.jsxs(i||e?_We:yWe,{...t,context:r,children:[n&&w.jsx($We,{children:w.jsx(L3,{showTopList:!0})}),w.jsxs(i||e?vWe:gWe,{children:[w.jsx(pWe,{}),w.jsx(L3,{}),w.jsx(mWe,{})]})]})}),{Component:SWe,useEmitter:uT,useEmitterValue:ln,usePublisher:Po}=rB(aWe,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},bWe),yWe=dB({useEmitter:uT,useEmitterValue:ln,usePublisher:Po}),_We=uB({useEmitter:uT,useEmitterValue:ln,usePublisher:Po}),QWe=SWe,xWe=Vn(()=>{const t=ot(c=>w.jsxs("td",{children:["Item $",c]})),e=ot(null),n=ot(c=>w.jsxs("td",{colSpan:1e3,children:["Group ",c]})),i=ot(null),r=ot(null),s=ot({}),o=ot(dT),a=ot(Rh),l=(c,d=null)=>es(He(s,Xt(u=>u[c]),bi()),d);return{components:s,computeItemKey:o,context:e,EmptyPlaceholder:l("EmptyPlaceholder"),FillerRow:l("FillerRow"),fixedFooterContent:r,fixedHeaderContent:i,itemContent:t,groupContent:n,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TableBodyComponent:l("TableBody","tbody"),TableComponent:l("Table","table"),TableFooterComponent:l("TableFoot","tfoot"),TableHeadComponent:l("TableHead","thead"),TableRowComponent:l("TableRow","tr"),GroupComponent:l("Group","tr")}});_i(iB,xWe);cT();const V3={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},wWe={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:B3,floor:y0,max:KO,min:G1,round:Y3}=Math;function D3(t,e,n){return Array.from({length:e-t+1}).map((i,r)=>({data:n===null?null:n[r+t],index:r+t}))}function PWe(t){return{...wWe,items:t}}function ig(t,e){return t!==void 0&&t.width===e.width&&t.height===e.height}function CWe(t,e){return t!==void 0&&t.column===e.column&&t.row===e.row}const TWe=Vn(([{increaseViewportBy:t,listBoundary:e,overscan:n,visibleRange:i},{footerHeight:r,headerHeight:s,scrollBy:o,scrollContainerState:a,scrollTo:l,scrollTop:c,smoothScrollTargetReached:d,viewportHeight:u},h,O,{didMount:p,propsReady:m},{customScrollParent:g,useWindowScroll:v,windowScrollContainerState:$,windowScrollTo:b,windowViewportRect:S},y])=>{const Q=ot(0),_=ot(0),P=ot(V3),C=ot({height:0,width:0}),X=ot({height:0,width:0}),z=Xn(),T=Xn(),k=ot(0),x=ot(null),R=ot({column:0,row:0}),E=Xn(),I=Xn(),A=ot(!1),j=ot(0),N=ot(!0),L=ot(!1),B=ot(!1);Zn(He(p,pn(j),Kt(([D,ee])=>ee!==0)),()=>{On(N,!1)}),Zn(He(nr(p,N,X,C,j,L),Kt(([D,ee,fe,se,,te])=>D&&!ee&&fe.height!==0&&se.height!==0&&!te)),([,,,,D])=>{On(L,!0),sT(1,()=>{On(z,D)}),Zo(He(c),()=>{On(e,[0,0]),On(N,!0)})}),Lt(He(I,Kt(D=>D!=null&&D.scrollTop>0),Qa(0)),_),Zn(He(p,pn(I),Kt(([,D])=>D!=null)),([,D])=>{D&&(On(C,D.viewport),On(X,D.item),On(R,D.gap),D.scrollTop>0&&(On(A,!0),Zo(He(c,md(1)),ee=>{On(A,!1)}),On(l,{top:D.scrollTop})))}),Lt(He(C,Xt(({height:D})=>D)),u),Lt(He(nr(Ht(C,ig),Ht(X,ig),Ht(R,(D,ee)=>D!==void 0&&D.column===ee.column&&D.row===ee.row),Ht(c)),Xt(([D,ee,fe,se])=>({gap:fe,item:ee,scrollTop:se,viewport:D}))),E),Lt(He(nr(Ht(Q),i,Ht(R,CWe),Ht(X,ig),Ht(C,ig),Ht(x),Ht(_),Ht(A),Ht(N),Ht(j)),Kt(([,,,,,,,D])=>!D),Xt(([D,[ee,fe],se,te,oe,G,H,,K,ae])=>{const{column:de,row:ve}=se,{height:Se,width:ue}=te,{width:me}=oe;if(H===0&&(D===0||me===0))return V3;if(ue===0){const Ce=oT(ae,D),we=Ce+Math.max(H-1,0);return PWe(D3(Ce,we,G))}const Oe=hB(me,ue,de);let pe,ke;K?ee===0&&fe===0&&H>0?(pe=0,ke=H-1):(pe=Oe*y0((ee+ve)/(Se+ve)),ke=Oe*B3((fe+ve)/(Se+ve))-1,ke=G1(D-1,KO(ke,Oe-1)),pe=G1(ke,KO(0,pe))):(pe=0,ke=-1);const Ae=D3(pe,ke,G),{bottom:Ue,top:Ze}=U3(oe,se,te,Ae),De=B3(D/Oe),et=De*Se+(De-1)*ve-Ue;return{bottom:Ue,itemHeight:Se,items:Ae,itemWidth:ue,offsetBottom:et,offsetTop:Ze,top:Ze}})),P),Lt(He(x,Kt(D=>D!==null),Xt(D=>D.length)),Q),Lt(He(nr(C,X,P,R),Kt(([D,ee,{items:fe}])=>fe.length>0&&ee.height!==0&&D.height!==0),Xt(([D,ee,{items:fe},se])=>{const{bottom:te,top:oe}=U3(D,se,ee,fe);return[oe,te]}),bi(Ff)),e);const V=ot(!1);Lt(He(c,pn(V),Xt(([D,ee])=>ee||D!==0)),V);const Y=lo(He(nr(P,Q),Kt(([{items:D}])=>D.length>0),pn(V),Kt(([[D,ee],fe])=>{const se=D.items[D.items.length-1].index===ee-1;return(fe||D.bottom>0&&D.itemHeight>0&&D.offsetBottom===0&&D.items.length===ee)&&se}),Xt(([[,D]])=>D-1),bi())),W=lo(He(Ht(P),Kt(({items:D})=>D.length>0&&D[0].index===0),Qa(0),bi())),q=lo(He(Ht(P),pn(A),Kt(([{items:D},ee])=>D.length>0&&!ee),Xt(([{items:D}])=>({endIndex:D[D.length-1].index,startIndex:D[0].index})),bi(YV),gl(0)));Lt(q,O.scrollSeekRangeChanged),Lt(He(z,pn(C,X,Q,R),Xt(([D,ee,fe,se,te])=>{const oe=GV(D),{align:G,behavior:H,offset:K}=oe;let ae=oe.index;ae==="LAST"&&(ae=se-1),ae=KO(0,ae,G1(se-1,ae));let de=Zx(ee,te,fe,ae);return G==="end"?de=Y3(de-ee.height+fe.height):G==="center"&&(de=Y3(de-ee.height/2+fe.height/2)),K!==void 0&&K!==0&&(de+=K),{behavior:H,top:de}})),l);const ne=es(He(P,Xt(D=>D.offsetBottom+D.bottom)),0);return Lt(He(S,Xt(D=>({height:D.visibleHeight,width:D.visibleWidth}))),C),{customScrollParent:g,data:x,deviation:k,footerHeight:r,gap:R,headerHeight:s,increaseViewportBy:t,initialItemCount:_,itemDimensions:X,overscan:n,restoreStateFrom:I,scrollBy:o,scrollContainerState:a,scrollHeight:T,scrollTo:l,scrollToIndex:z,scrollTop:c,smoothScrollTargetReached:d,totalCount:Q,useWindowScroll:v,viewportDimensions:C,windowScrollContainerState:$,windowScrollTo:b,windowViewportRect:S,...O,gridState:P,horizontalDirection:B,initialTopMostItemIndex:j,totalListHeight:ne,...h,endReached:Y,propsReady:m,rangeChanged:q,startReached:W,stateChanged:E,stateRestoreInProgress:A,...y}},_i(aT,zs,Ap,tB,Qc,lT,_c));function hB(t,e,n){return KO(1,y0((t+n)/(y0(e)+n)))}function U3(t,e,n,i){const{height:r}=n;if(r===void 0||i.length===0)return{bottom:0,top:0};const s=Zx(t,e,n,i[0].index);return{bottom:Zx(t,e,n,i[i.length-1].index)+r,top:s}}function Zx(t,e,n,i){const r=hB(t.width,n.width,e.column),s=y0(i/r),o=s*n.height+KO(0,s-1)*e.row;return o>0?o+e.row:o}const kWe=Vn(()=>{const t=ot(u=>`Item ${u}`),e=ot({}),n=ot(null),i=ot("virtuoso-grid-item"),r=ot("virtuoso-grid-list"),s=ot(dT),o=ot("div"),a=ot(Rh),l=(u,h=null)=>es(He(e,Xt(O=>O[u]),bi()),h),c=ot(!1),d=ot(!1);return Lt(Ht(d),c),{components:e,computeItemKey:s,context:n,FooterComponent:l("Footer"),HeaderComponent:l("Header"),headerFooterTag:o,itemClassName:i,ItemComponent:l("Item","div"),itemContent:t,listClassName:r,ListComponent:l("List","div"),readyStateChanged:c,reportReadyState:d,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),RWe=Vn(([t,e])=>({...t,...e}),_i(TWe,kWe)),EWe=Z.memo(function(){const t=Pi("gridState"),e=Pi("listClassName"),n=Pi("itemClassName"),i=Pi("itemContent"),r=Pi("computeItemKey"),s=Pi("isSeeking"),o=Co("scrollHeight"),a=Pi("ItemComponent"),l=Pi("ListComponent"),c=Pi("ScrollSeekPlaceholder"),d=Pi("context"),u=Co("itemDimensions"),h=Co("gap"),O=Pi("log"),p=Pi("stateRestoreInProgress"),m=Co("reportReadyState"),g=wd(Z.useMemo(()=>v=>{const $=v.parentElement.parentElement.scrollHeight;o($);const b=v.firstChild;if(b!==null){const{height:S,width:y}=b.getBoundingClientRect();u({height:S,width:y})}h({column:q3("column-gap",getComputedStyle(v).columnGap,O),row:q3("row-gap",getComputedStyle(v).rowGap,O)})},[o,u,h,O]),!0,!1);return aB(()=>{t.itemHeight>0&&t.itemWidth>0&&m(!0)},[t]),p?null:w.jsx(l,{className:e,ref:g,...Jr(l,d),"data-testid":"virtuoso-item-list",style:{paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},children:t.items.map(v=>{const $=r(v.index,v.data,d);return s?w.jsx(c,{...Jr(c,d),height:t.itemHeight,index:v.index,width:t.itemWidth},$):f.createElement(a,{...Jr(a,d),className:n,"data-index":v.index,key:$},i(v.index,v.data,d))})})}),XWe=Z.memo(function(){const t=Pi("HeaderComponent"),e=Co("headerHeight"),n=Pi("headerFooterTag"),i=wd(Z.useMemo(()=>s=>{e(bc(s,"height"))},[e]),!0,!1),r=Pi("context");return t!=null?w.jsx(n,{ref:i,children:w.jsx(t,{...Jr(t,r)})}):null}),zWe=Z.memo(function(){const t=Pi("FooterComponent"),e=Co("footerHeight"),n=Pi("headerFooterTag"),i=wd(Z.useMemo(()=>s=>{e(bc(s,"height"))},[e]),!0,!1),r=Pi("context");return t!=null?w.jsx(n,{ref:i,children:w.jsx(t,{...Jr(t,r)})}):null}),IWe=({children:t})=>{const e=Z.useContext(oB),n=Co("itemDimensions"),i=Co("viewportDimensions"),r=wd(Z.useMemo(()=>s=>{i(s.getBoundingClientRect())},[i]),!0,!1);return Z.useEffect(()=>{e&&(i({height:e.viewportHeight,width:e.viewportWidth}),n({height:e.itemHeight,width:e.itemWidth}))},[e,i,n]),w.jsx("div",{ref:r,style:Y$(!1),children:t})},AWe=({children:t})=>{const e=Z.useContext(oB),n=Co("windowViewportRect"),i=Co("itemDimensions"),r=Pi("customScrollParent"),s=jV(n,r,!1);return Z.useEffect(()=>{e&&(i({height:e.itemHeight,width:e.itemWidth}),n({offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:e.viewportWidth}))},[e,n,i]),w.jsx("div",{ref:s,style:Y$(!1),children:t})},MWe=Z.memo(function({...t}){const e=Pi("useWindowScroll"),n=Pi("customScrollParent"),i=n||e?NWe:jWe,r=n||e?AWe:IWe,s=Pi("context");return w.jsx(i,{...t,...Jr(i,s),children:w.jsxs(r,{children:[w.jsx(XWe,{}),w.jsx(EWe,{}),w.jsx(zWe,{})]})})}),{useEmitter:OB,useEmitterValue:Pi,usePublisher:Co}=rB(RWe,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},MWe),jWe=dB({useEmitter:OB,useEmitterValue:Pi,usePublisher:Co}),NWe=uB({useEmitter:OB,useEmitterValue:Pi,usePublisher:Co});function q3(t,e,n){return e!=="normal"&&(e==null?void 0:e.endsWith("px"))!==!0&&n(`${t} was not resolved to pixel value correctly`,e,fr.WARN),e==="normal"?0:parseInt(e??"0",10)}const WWe="_centerEmpty_1op79_1",LWe="_container_1op79_8",VWe="_mobileVirtuoso_1op79_18",BWe="_sessionDividerText_1op79_23",YWe="_lastResponseLabel_1op79_28",DWe="_splitContainer_1op79_32",UWe="_chatSection_1op79_39",qWe="_vResizer_1op79_47",ZWe="_terminalToggle_1op79_61",GWe="_messageListWrap_1op79_84",FWe="_stickyBottomBtn_1op79_92",HWe="_loadMoreWrap_1op79_144",KWe="_loadMoreBtn_1op79_150",JWe="_navSidebar_1op79_166",eLe="_navBtn_1op79_183",tLe="_navBtnActive_1op79_203",nLe="_navAvatarImg_1op79_223",iLe="_userPromptNavList_1op79_230",rLe="_userPromptNavItem_1op79_239",sLe="_terminalPanelWrap_1op79_259",oLe="_navSidebarContent_1op79_266",aLe="_innerSplitArea_1op79_274",lLe="_chatSectionFlex_1op79_281",cLe="_overlayPanel_1op79_290",dLe="_streamingSpinnerWrap_1op79_298",uLe="_streamingSpinnerHidden_1op79_305",hLe="_sessionDivider_1op79_23",OLe="_loadMoreBtnLoading_1op79_314",fLe="_lastResponseDivider_1op79_319",Vt={centerEmpty:WWe,container:LWe,mobileVirtuoso:VWe,sessionDividerText:BWe,lastResponseLabel:YWe,splitContainer:DWe,chatSection:UWe,vResizer:qWe,terminalToggle:ZWe,messageListWrap:GWe,stickyBottomBtn:FWe,loadMoreWrap:HWe,loadMoreBtn:KWe,navSidebar:JWe,navBtn:eLe,navBtnActive:tLe,navAvatarImg:nLe,userPromptNavList:iLe,userPromptNavItem:rLe,terminalPanelWrap:sLe,navSidebarContent:oLe,innerSplitArea:aLe,chatSectionFlex:lLe,overlayPanel:cLe,streamingSpinnerWrap:dLe,streamingSpinnerHidden:uLe,sessionDivider:hLe,loadMoreBtnLoading:OLe,lastResponseDivider:fLe},{Text:F1}=kl,H1=240,pLe=100,mLe={},Z3={},gLe=Z.forwardRef((t,e)=>w.jsx("div",{ref:e,...t,className:Vt.container}));function vLe(){return 100+Math.random()*50}class xDe extends Z.Component{constructor(n){super(n);Je(this,"handleStickToBottom",()=>{this.setState({stickyBottom:!0},()=>{if(Ft&&this.virtuosoRef.current)this.virtuosoRef.current.scrollToIndex({index:"LAST",behavior:"smooth"});else{const n=this.containerRef.current;n&&(n.scrollTop=n.scrollHeight)}})});Je(this,"_addPendingImage",(n,i)=>{n&&this.setState(r=>r.pendingImages.length>=20||r.pendingImages.some(s=>s.path===n)?null:{pendingImages:[...r.pendingImages,{path:n,source:i}]})});Je(this,"_removePendingImage",n=>{this.setState(i=>{const r=i.pendingImages[n];if(!r)return null;const s=i.pendingImages.filter((o,a)=>a!==n);return r.path&&this._inputWs&&this._inputWs.readyState===WebSocket.OPEN&&this._inputWs.send(JSON.stringify({type:"image-remove-notify",path:r.path})),{pendingImages:s}})});Je(this,"_clearPendingImages",()=>{this.state.pendingImages.length>0&&this.setState({pendingImages:[]})});Je(this,"handleLoadMore",()=>{var o;this._mobileExtraItems+=pLe;const n=((o=this.state.allItems)==null?void 0:o.length)||0,i=this.buildAllItems(),r=this._applyMobileSlice(i),s=r.length-n;if(Ft&&this.virtuosoRef.current)this.setState({allItems:r,lastResponseItems:this._lastResponseItems,visibleCount:r.length},()=>{this.virtuosoRef.current&&s>0&&this.virtuosoRef.current.scrollToIndex({index:s,align:"start"})});else{const a=this.containerRef.current,l=a?a.scrollHeight:0,c=a?a.scrollTop:0;this.setState({allItems:r,lastResponseItems:this._lastResponseItems,visibleCount:r.length},()=>{if(a){const d=a.scrollHeight;a.scrollTop=c+(d-l)}})}});Je(this,"handlePresetSend",n=>{if(!n)return;const i=this._inputRef.current;i&&(i.value=n,i.style.height="auto",i.style.height=Math.min(i.scrollHeight,Ft?160:120)+"px",this.setState({inputEmpty:!1}),i.focus())});Je(this,"handlePromptOptionClick",n=>{if(this._promptSubmitting)return;const i=this._inputWs;if(!i||i.readyState!==WebSocket.OPEN)return;let r=this.state.ptyPrompt;r||(r=this.state.ptyPromptHistory.slice().reverse().find(h=>h.status==="active")||{options:Array.from({length:Math.max(n,3)},(h,O)=>({number:O+1,selected:O===0}))}),this._promptSubmitting=!0;const s=r.options,o=s.findIndex(h=>h.number===n);let a=s.findIndex(h=>h.selected);a<0&&(a=0);const l=o-a,c=l>0?"\x1B[B":"\x1B[A",d=Math.abs(l),u=h=>{h<d?(i.send(JSON.stringify({type:"input",data:c})),setTimeout(()=>u(h+1),30)):setTimeout(()=>{i.readyState===WebSocket.OPEN&&i.send(JSON.stringify({type:"input",data:"\r"}))},50)};u(0),this._currentPtyPrompt=null,this.setState(h=>{const O=h.ptyPromptHistory.slice(),p=O[O.length-1];return p&&p.status==="active"&&(O[O.length-1]={...p,status:"answered",selectedNumber:n}),{ptyPrompt:null,ptyPromptHistory:O}}),this._ptyBuffer="",this._ptyDebounceTimer&&clearTimeout(this._ptyDebounceTimer),setTimeout(()=>{this._promptSubmitting=!1},500)});Je(this,"handlePermissionAllow",n=>{const i=this._inputWs;i&&i.readyState===WebSocket.OPEN&&i.send(JSON.stringify({type:"perm-hook-answer",id:n,decision:"allow"})),this.setState({pendingPermission:null})});Je(this,"handlePermissionAllowSession",n=>{const i=this._inputWs;i&&i.readyState===WebSocket.OPEN&&i.send(JSON.stringify({type:"perm-hook-answer",id:n,decision:"allow",allowSession:!0})),this.setState({pendingPermission:null})});Je(this,"handlePermissionDeny",n=>{const i=this._inputWs;i&&i.readyState===WebSocket.OPEN&&i.send(JSON.stringify({type:"perm-hook-answer",id:n,decision:"deny"})),this.setState({pendingPermission:null})});Je(this,"handlePlanApprove",n=>{const i=this._inputWs;i&&i.readyState===WebSocket.OPEN&&i.send(JSON.stringify({type:"sdk-plan-answer",id:n,approve:!0})),this.setState({pendingPlanApproval:null})});Je(this,"handlePlanReject",(n,i)=>{const r=this._inputWs;r&&r.readyState===WebSocket.OPEN&&r.send(JSON.stringify({type:"sdk-plan-answer",id:n,approve:!1,feedback:i||""})),this.setState({pendingPlanApproval:null})});Je(this,"handlePlanFeedbackSubmit",(n,i)=>{const r=this._inputWs;if(!r||r.readyState!==WebSocket.OPEN)return;let s=this.state.ptyPrompt;s||(s=this.state.ptyPromptHistory.slice().reverse().find(O=>O.status==="active")||{options:Array.from({length:Math.max(n,3)},(O,p)=>({number:p+1,selected:p===0}))});const o=s.options,a=o.findIndex(O=>O.number===n);let l=o.findIndex(O=>O.selected);l<0&&(l=0);const c=a-l,d=c>0?"\x1B[B":"\x1B[A",u=Math.abs(c),h=O=>{O<u?(r.send(JSON.stringify({type:"input",data:d})),setTimeout(()=>h(O+1),30)):setTimeout(()=>{r.send(JSON.stringify({type:"input",data:"\r"}));const p=this._ptyBuffer;let m=0;const g=()=>{if(m++,m>20||this._ptyBuffer!==p){r.readyState===WebSocket.OPEN&&(r.send(JSON.stringify({type:"input",data:i})),setTimeout(()=>{r.send(JSON.stringify({type:"input",data:"\r"}))},50));return}setTimeout(g,100)};setTimeout(g,100)},50)};h(0),this._currentPtyPrompt=null,this.setState(O=>{const p=O.ptyPromptHistory.slice(),m=p[p.length-1];return m&&m.status==="active"&&(p[p.length-1]={...m,status:"answered",selectedNumber:n}),{ptyPrompt:null,ptyPromptHistory:p}}),this._ptyBuffer="",this._ptyDebounceTimer&&clearTimeout(this._ptyDebounceTimer)});Je(this,"handleAskQuestionSubmit",(n,i,r)=>{var s,o;if(i&&r){const a={};for(const l of n){const c=r[l.questionIndex];if(c)if(l.type==="other")a[c.question]=l.text;else if(l.type==="multi"){const d=l.selectedIndices.map(u=>{var h;return(h=(c.options||[])[u])==null?void 0:h.label}).filter(Boolean);a[c.question]=d.join(", ")}else a[c.question]=((s=(c.options||[])[l.optionIndex])==null?void 0:s.label)||""}this.setState(l=>({localAskAnswers:{...l.localAskAnswers||{},[i]:a}}))}if(this.props.sdkMode){const a=i||this._sdkAskId;if(!a)return;const l=this._inputWs;if(l&&l.readyState===WebSocket.OPEN){const c={},d=this._askHookQuestions||r;for(const u of n){const h=d==null?void 0:d[u.questionIndex];if(h)if(u.type==="other")c[h.question]=u.text;else if(u.type==="multi"){const O=u.selectedIndices.map(p=>{var m;return(m=(h.options||[])[p])==null?void 0:m.label}).filter(Boolean);c[h.question]=O.join(", ")}else c[h.question]=((o=(h.options||[])[u.optionIndex])==null?void 0:o.label)||""}l.send(JSON.stringify({type:"sdk-ask-answer",id:a,answers:c})),this._sdkAskId=null}return}if(this._askHookActive&&!this._askSubmitting){this._submitViaHookBridge(n);return}if(!this._askHookActive&&!this._askSubmitting&&this._inputWs&&this._inputWs.readyState===WebSocket.OPEN){this._pendingHookAnswers=n,this._askHookWaitRetries=0,this._askSubmitting=!0,this._waitForHookBridge();return}this._submitViaPty(n)});Je(this,"handleInputSend",()=>{const n=this._inputRef.current;if(!n)return;const i=n.value.trim(),r=this.state.pendingImages.map(o=>`"${o.path.replace(/"/g,"")}"`).join(" "),s=r?i?`${r} ${i}`:r:i;s&&this._inputWs&&this._inputWs.readyState===WebSocket.OPEN&&(this.props.sdkMode?this._inputWs.send(JSON.stringify({type:"sdk-user-message",text:s})):(this._inputWs.send(JSON.stringify({type:"input",data:s})),setTimeout(()=>{this._inputWs&&this._inputWs.readyState===WebSocket.OPEN&&this._inputWs.send(JSON.stringify({type:"input",data:"\r"}))},50)),n.value="",n.style.height="auto",this._clearPendingImages(),this.setState({inputEmpty:!0,pendingInput:i||r,inputSuggestion:null},()=>this.scrollToBottom()))});Je(this,"handleInputKeyDown",n=>{if(n.key==="Tab"&&this.state.inputSuggestion){n.preventDefault();const i=this._inputRef.current;i&&(i.value=this.state.inputSuggestion,i.style.height="auto",i.style.height=Math.min(i.scrollHeight,120)+"px"),this.setState({inputSuggestion:null,inputEmpty:!1});return}n.key==="Enter"&&!n.shiftKey&&!n.isComposing&&n.keyCode!==229&&(n.preventDefault(),this.handleInputSend())});Je(this,"handleInputChange",n=>{const i=n.target;i.style.height="auto",i.style.height=Math.min(i.scrollHeight,120)+"px";const r=!i.value.trim();this.setState({inputEmpty:r}),this.state.inputSuggestion&&!r&&this.setState({inputSuggestion:null})});Je(this,"handleSuggestionToTerminal",()=>{const n=this.state.inputSuggestion;!n||!this._inputWs||this._inputWs.readyState!==WebSocket.OPEN||(this._inputWs.send(JSON.stringify({type:"input",data:n})),setTimeout(()=>{this._inputWs&&this._inputWs.readyState===WebSocket.OPEN&&this._inputWs.send(JSON.stringify({type:"input",data:"\r"}))},50),this.setState({inputSuggestion:null,pendingInput:n},()=>this.scrollToBottom()))});Je(this,"handleUploadPath",n=>{this._addPendingImage(n,"chat"),this._inputWs&&this._inputWs.readyState===WebSocket.OPEN&&this._inputWs.send(JSON.stringify({type:"image-upload-notify",path:n,source:"chat"}))});Je(this,"handleSplitMouseDown",n=>{n.preventDefault(),this._resizing=!0,this._dragTarget="terminal";let i=[];const r=this.innerSplitRef.current;if(r){const l=r.getBoundingClientRect().width,c=7.8,d=[60,80,100,120],u=5;i=d.map(h=>{const O=h*c,p=O+u;if(p>l*.75||p<l*.15)return null;const m=l-O-u;return{cols:h,terminalPx:O,linePosition:m}}).filter(h=>h!==null)}this.setState({isDragging:!0,snapLines:i});const s=a=>{if(!this._resizing)return;const l=this.innerSplitRef.current;if(!l)return;const c=l.getBoundingClientRect(),d=c.width;let u=c.right-a.clientX;u=Math.max(200,Math.min(d*.75,u));let h=null;if(i.length>0){let p=1/0,m=null;for(const g of i){const v=Math.abs(a.clientX-c.left-g.linePosition);v<p&&(p=v,m=g)}m&&p<60&&(h=m)}this.setState({terminalWidth:u,activeSnapLine:h})},o=()=>{if(this._resizing=!1,this._dragTarget=null,this.state.activeSnapLine){const a=this.state.activeSnapLine.terminalPx;localStorage.setItem("cc-viewer-terminal-width",a.toString()),this.setState({terminalWidth:a,isDragging:!1,activeSnapLine:null,snapLines:[],needsInitialSnap:!1})}else localStorage.setItem("cc-viewer-terminal-width",this.state.terminalWidth.toString()),this.setState({isDragging:!1,activeSnapLine:null,snapLines:[],needsInitialSnap:!1});document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",o),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",s),document.addEventListener("mouseup",o),document.body.style.cursor="col-resize",document.body.style.userSelect="none"});Je(this,"handleSidebarMouseDown",n=>{n.preventDefault(),this._resizing=!0,this._dragTarget="sidebar";const i=[180,240,300,360],r=this.innerSplitRef.current;let s=[];if(r){const l=r.getBoundingClientRect().width;s=i.filter(c=>c<l*.4).map(c=>({cols:c,terminalPx:c,linePosition:c}))}this.setState({isDragging:!0,snapLines:s});const o=l=>{if(!this._resizing)return;const c=this.innerSplitRef.current;if(!c)return;const d=c.getBoundingClientRect(),u=d.width;let h=l.clientX-d.left;h=Math.max(160,Math.min(u*.4,h));let O=null;if(s.length>0){let m=1/0,g=null;for(const v of s){const $=Math.abs(h-v.linePosition);$<m&&(m=$,g=v)}g&&m<60&&(O=g)}this.setState({sidebarWidth:h,activeSnapLine:O})},a=()=>{if(this._resizing=!1,this._dragTarget=null,this.state.activeSnapLine){const l=this.state.activeSnapLine.linePosition;localStorage.setItem("cc-viewer-sidebar-width",l.toString()),this.setState({sidebarWidth:l,isDragging:!1,activeSnapLine:null,snapLines:[]})}else localStorage.setItem("cc-viewer-sidebar-width",this.state.sidebarWidth.toString()),this.setState({isDragging:!1,activeSnapLine:null,snapLines:[]});document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",a),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",o),document.addEventListener("mouseup",a),document.body.style.cursor="col-resize",document.body.style.userSelect="none"});Je(this,"handleToggleExpandPath",n=>{this.setState(i=>{const r=new Set(i.fileExplorerExpandedPaths);return r.has(n)?r.delete(n):r.add(n),{fileExplorerExpandedPaths:r}})});Je(this,"handleMdImageClick",n=>{const i=n.target.closest(".chat-md img");i&&i.src&&(n.preventDefault(),this.setState({mdLightboxSrc:i.src}))});Je(this,"handleOpenToolFilePath",async n=>{if(!n)return;let i=n;if(n.startsWith("/")){if(!this._projectDirCache)try{const o=await fetch(pt("/api/project-dir"));if(o.ok){const a=await o.json();a&&a.dir&&(this._projectDirCache=a.dir)}}catch{}this._projectDirCache&&n.startsWith(this._projectDirCache+"/")&&(i=n.slice(this._projectDirCache.length+1))}const r=i.split("/"),s=[];for(let o=1;o<r.length;o++)s.push(r.slice(0,o).join("/"));this._setFileExplorerOpen(!0),this.setState(o=>{const a=new Set(o.fileExplorerExpandedPaths);return s.forEach(l=>a.add(l)),{currentFile:i,currentGitDiff:null,scrollToLine:null,fileExplorerExpandedPaths:a}})});this.containerRef=Z.createRef(),this.virtuosoRef=Z.createRef(),this.splitContainerRef=Z.createRef(),this.innerSplitRef=Z.createRef(),this._incToolState=null,this._incToolProcessedCount=0,this._incToolSessionIdx=-1,this._prevSessions=null,this._reqScanCache={tsToIndex:{},modelName:null,subAgentEntries:[],processedCount:0};const i=localStorage.getItem("cc-viewer-terminal-width"),r=i?parseFloat(i):null;this.state={visibleCount:0,loading:!1,allItems:[],lastResponseItems:null,highlightTs:null,highlightFading:!1,highlightVisibleIdx:-1,sidebarWidth:parseInt(localStorage.getItem("cc-viewer-sidebar-width"),10)||240,terminalWidth:r||624,needsInitialSnap:r===null,inputEmpty:!0,pendingInput:null,stickyBottom:!0,ptyPrompt:null,ptyPromptHistory:[],inputSuggestion:null,fileExplorerOpen:!Ft&&localStorage.getItem("ccv_fileExplorerOpen")!=="false",currentFile:null,currentGitDiff:null,scrollToLine:null,fileExplorerExpandedPaths:new Set,gitChangesOpen:!1,snapLines:[],activeSnapLine:null,isDragging:!1,fileVersion:0,editorSessionId:null,editorFilePath:null,fileExplorerRefresh:0,gitChangesRefresh:0,roleFilterOpen:!1,roleFilterSelected:new Set,teamModalSession:null,mdLightboxSrc:null,streamingFading:!1,presetItems:[],mobilePresetModalVisible:!1,localAskAnswers:{},pendingPermission:null,pendingPlanApproval:null,pendingImages:[]},this._processedToolIds=new Set,this._projectDirCache=null,this._fileRefreshTimer=null,this._gitRefreshTimer=null,this._queueTimer=null,this._prevItemsLen=0,this._scrollTargetIdx=null,this._scrollTargetRef=Z.createRef(),this._scrollFadeTimer=null,this._resizing=!1,this._dragTarget=null,this._inputWs=null,this._inputRef=Z.createRef(),this._ptyBuffer="",this._ptyDataSeq=0,this._ptyDebounceTimer=null,this._currentPtyPrompt=null,this._askHookActive=!1,this._askHookQuestions=null,this._pendingHookAnswers=null,this._askHookWaitRetries=0,this._hookWaitTimer=null,this._mobileExtraItems=0,this._mobileSliceOffset=0,this._totalItemCount=0}_setFileExplorerOpen(n){localStorage.setItem("ccv_fileExplorerOpen",String(n)),this.setState({fileExplorerOpen:n})}_checkToolFileChanges(){var o,a;const n=this.props.mainAgentSessions;if(!n||n.length===0)return;this._processedToolIds.size>5e3&&this._processedToolIds.clear();let i=!1,r=!1,s=!1;for(const l of n){const c=[];if((a=(o=l.response)==null?void 0:o.body)!=null&&a.content&&c.push(l.response.body.content),Array.isArray(l.messages))for(const d of l.messages)d.role==="assistant"&&Array.isArray(d.content)&&c.push(d.content);for(const d of c)for(const u of d){if(u.type!=="tool_use"||!u.id||this._processedToolIds.has(u.id))continue;this._processedToolIds.add(u.id);const h=u.name;let O=u.input;if(typeof O=="string")try{O=JSON.parse(O.replace(/^\[object Object\]/,""))}catch{O={}}if(h==="Write"?(i=!0,r=!0):h==="Edit"||h==="NotebookEdit"?r=!0:h==="Bash"&&O&&O.command&&K7e(O.command)&&(i=!0,r=!0),(h==="Write"||h==="Edit"||h==="NotebookEdit")&&this.state.currentFile){const p=O&&O.file_path;if(p){let m=p;m.startsWith("/")&&this._projectDirCache&&m.startsWith(this._projectDirCache+"/")&&(m=m.slice(this._projectDirCache.length+1)),(m===this.state.currentFile||m.startsWith("/")&&m.endsWith("/"+this.state.currentFile))&&(s=!0)}}}}i&&this.state.fileExplorerOpen&&(clearTimeout(this._fileRefreshTimer),this._fileRefreshTimer=setTimeout(()=>{this.setState(l=>({fileExplorerRefresh:l.fileExplorerRefresh+1}))},500)),r&&this.state.gitChangesOpen&&(clearTimeout(this._gitRefreshTimer),this._gitRefreshTimer=setTimeout(()=>{this.setState(l=>({gitChangesRefresh:l.gitChangesRefresh+1}))},500)),s&&(clearTimeout(this._contentRefreshTimer),this._contentRefreshTimer=setTimeout(()=>{this.setState(l=>({fileVersion:l.fileVersion+1}))},500))}componentDidMount(){this.startRender(),this.props.cliMode&&this.connectInputWs(),Ft||this._bindStickyScroll(),this.state.needsInitialSnap&&this.props.cliMode&&this.props.terminalVisible&&this._snapToInitialPosition(),this._loadPresets(),this._onPresetsChanged=()=>this._loadPresets(),window.addEventListener("ccv-presets-changed",this._onPresetsChanged)}shouldComponentUpdate(n,i){return n.requests!==this.props.requests||n.mainAgentSessions!==this.props.mainAgentSessions||n.collapseToolResults!==this.props.collapseToolResults||n.expandThinking!==this.props.expandThinking||n.showFullToolContent!==this.props.showFullToolContent||n.scrollToTimestamp!==this.props.scrollToTimestamp||n.cliMode!==this.props.cliMode||n.terminalVisible!==this.props.terminalVisible||n.userProfile!==this.props.userProfile||n.pendingUploadPaths!==this.props.pendingUploadPaths||n.isStreaming!==this.props.isStreaming||n.hasMoreHistory!==this.props.hasMoreHistory||n.loadingMore!==this.props.loadingMore||n.loadingSessionId!==this.props.loadingSessionId||n.lang!==this.props.lang||n.showThinkingSummaries!==this.props.showThinkingSummaries||n.fileLoading!==this.props.fileLoading||i!==this.state}componentDidUpdate(n,i){if(i.pendingPermission!==this.state.pendingPermission&&this.props.onPendingPermission&&(this.state.pendingPermission?this.props.onPendingPermission({permission:this.state.pendingPermission,handlers:{allow:this.handlePermissionAllow,allowSession:this.props.sdkMode?this.handlePermissionAllowSession:null,deny:this.handlePermissionDeny}}):this.props.onPendingPermission(null)),i.pendingPlanApproval!==this.state.pendingPlanApproval&&this.props.onPendingPlanApproval&&(this.state.pendingPlanApproval?this.props.onPendingPlanApproval({plan:this.state.pendingPlanApproval,handlers:{approve:this.handlePlanApprove,reject:this.handlePlanReject}}):this.props.onPendingPlanApproval(null)),Ft&&i.lastResponseItems!==this.state.lastResponseItems&&this.state.stickyBottom&&(this._stickyScrollLock=!0,requestAnimationFrame(()=>{const r=this._virtuosoScrollerEl;r&&(r.scrollTop=r.scrollHeight),requestAnimationFrame(()=>{this._stickyScrollLock=!1})})),n.isStreaming&&!this.props.isStreaming&&(this.setState({streamingFading:!0}),clearTimeout(this._streamingFadeTimer),this._streamingFadeTimer=setTimeout(()=>{this.setState({streamingFading:!1})},500)),!n.isStreaming&&this.props.isStreaming&&this.state.streamingFading&&(clearTimeout(this._streamingFadeTimer),this.setState({streamingFading:!1})),this.props.pendingUploadPaths&&this.props.pendingUploadPaths.length>0&&this.props.pendingUploadPaths!==n.pendingUploadPaths){for(const r of this.props.pendingUploadPaths){const s=r.replace(/^"|"$/g,"");this._addPendingImage(s,"drop")}this.props.onUploadPathsConsumed&&this.props.onUploadPathsConsumed()}if(n.mainAgentSessions!==this.props.mainAgentSessions){if(this.props.mainAgentSessions!==this._prevSessions){const r=this._prevSessions||[],s=this.props.mainAgentSessions||[];(r.length!==s.length||r.some((a,l)=>a!==s[l]))&&(this._incToolState=null,this._incToolProcessedCount=0,this._incToolSessionIdx=-1,this._reqScanCache={tsToIndex:{},modelName:null,subAgentEntries:[],processedCount:0,subAgentProcessedCount:0}),this._prevSessions=this.props.mainAgentSessions}Ft&&(this._mobileExtraItems=0),this.startRender(),this.state.pendingInput&&this.setState({pendingInput:null}),this._clearPendingImages(),this._updateSuggestion(),this._checkToolFileChanges()}else if(n.requests!==this.props.requests)this._reqScanCache.tsToIndex={},this._reqScanCache.processedCount=0,this._reqScanCache.subAgentEntries=[],this._reqScanCache.subAgentProcessedCount=0,this.startRender();else if(n.collapseToolResults!==this.props.collapseToolResults||n.expandThinking!==this.props.expandThinking){const r=this.buildAllItems(),s=this._applyMobileSlice(r);this.setState({allItems:s,lastResponseItems:this._lastResponseItems,visibleCount:s.length})}if(i.localAskAnswers!==this.state.localAskAnswers&&n.mainAgentSessions===this.props.mainAgentSessions&&n.requests===this.props.requests&&this.startRender(),!n.scrollToTimestamp&&this.props.scrollToTimestamp)if(Ft&&this.props.scrollToTimestamp){const r=this.buildAllItems(),s=this._scrollTargetIdx;if(s!=null){const a=H1+this._mobileExtraItems,l=r.length>a?r.length-a:0;s<l&&(this._mobileExtraItems=r.length-s-H1,this._mobileExtraItems<0&&(this._mobileExtraItems=0))}const o=this._applyMobileSlice(r);this.setState({allItems:o,lastResponseItems:this._lastResponseItems,visibleCount:o.length},()=>this.scrollToBottom())}else{const r=this.buildAllItems(),s=this._applyMobileSlice(r);this.setState({allItems:s,lastResponseItems:this._lastResponseItems,visibleCount:s.length},()=>this.scrollToBottom())}Ft&&this.props.mobileChatVisible&&!n.mobileChatVisible&&requestAnimationFrame(()=>{if(this.virtuosoRef.current)this.virtuosoRef.current.scrollToIndex({index:"LAST"});else{const r=this.containerRef.current;r&&(r.scrollTop=r.scrollHeight)}}),!n.cliMode&&this.props.cliMode&&this.connectInputWs(),Ft||this._rebindStickyEl()}componentWillUnmount(){this._unmounted=!0,window.removeEventListener("ccv-presets-changed",this._onPresetsChanged),this.props.onPendingPermission&&this.props.onPendingPermission(null),this.props.onPendingPlanApproval&&this.props.onPendingPlanApproval(null),this._queueTimer&&clearTimeout(this._queueTimer),this._fadeClearTimer&&clearTimeout(this._fadeClearTimer),this._ptyDebounceTimer&&clearTimeout(this._ptyDebounceTimer),this._fileRefreshTimer&&clearTimeout(this._fileRefreshTimer),this._gitRefreshTimer&&clearTimeout(this._gitRefreshTimer),this._contentRefreshTimer&&clearTimeout(this._contentRefreshTimer),this._wsReconnectTimer&&clearTimeout(this._wsReconnectTimer),this._waitForWsTimer&&clearTimeout(this._waitForWsTimer),this._waitForPtyTimer&&clearTimeout(this._waitForPtyTimer),this._planFeedbackTimer&&clearTimeout(this._planFeedbackTimer),this._streamingFadeTimer&&clearTimeout(this._streamingFadeTimer),this._hookWaitTimer&&clearTimeout(this._hookWaitTimer),this._pendingHookAnswers=null,this._unbindScrollFade(),Ft||this._unbindStickyScroll(),this._inputWs&&(this._inputWs.close(),this._inputWs=null)}startRender(){this._queueTimer&&clearTimeout(this._queueTimer);const n=this.state.stickyBottom;this._stickyScrollLock=!0;const i=this.buildAllItems(),r=this._lastResponseItems,s=this._applyMobileSlice(i);this._prevItemsLen=s.length,this.setState({allItems:s,lastResponseItems:r,visibleCount:s.length,loading:!1},()=>{this.scrollToBottom(n),requestAnimationFrame(()=>{this._stickyScrollLock=!1})})}queueNext(n,i){n>=i||(this._queueTimer=setTimeout(()=>{this.setState({visibleCount:n+1},()=>{this.scrollToBottom(),this.queueNext(n+1,i)})},vLe()))}_isNearBottom(){const n=this.containerRef.current;return n?n.scrollHeight-n.scrollTop-n.clientHeight<=30:!0}scrollToBottom(n){const i=n??this.state.stickyBottom;if(Ft&&this.virtuosoRef.current){if(this._scrollTargetIdx!=null){this.virtuosoRef.current.scrollToIndex({index:this._scrollTargetIdx,align:"center"});const r=this.props.scrollToTimestamp;this._scrollTargetRef=Z.createRef(),r&&(this.setState({highlightTs:r,highlightFading:!1}),this._bindScrollFade()),this.props.onScrollTsDone&&this.props.onScrollTsDone();return}i&&(this.virtuosoRef.current.scrollToIndex({index:"LAST",behavior:"auto"}),this.state.lastResponseItems&&requestAnimationFrame(()=>{const r=this._virtuosoScrollerEl;r&&(r.scrollTop=r.scrollHeight)}));return}if(this._scrollTargetRef.current){const r=this._scrollTargetRef.current,s=this.containerRef.current;s&&r.offsetHeight>s.clientHeight?r.scrollIntoView({block:"start",behavior:"instant"}):r.scrollIntoView({block:"center",behavior:"instant"});const o=this.props.scrollToTimestamp;this._scrollTargetRef=Z.createRef(),o&&(this.setState({highlightTs:o,highlightFading:!1}),this._bindScrollFade()),this.props.onScrollTsDone&&this.props.onScrollTsDone();return}if(i){const r=this.containerRef.current;r&&(r.scrollTop=r.scrollHeight)}}_bindStickyScroll(){this._stickyScrollRafId=null,this._onStickyScroll=()=>{this._stickyScrollLock||this._stickyScrollRafId||(this._stickyScrollRafId=requestAnimationFrame(()=>{this._stickyScrollRafId=null;const n=this.containerRef.current;if(!n)return;const i=n.scrollHeight-n.scrollTop-n.clientHeight;this.state.stickyBottom&&i>50?this.setState({stickyBottom:!1}):!this.state.stickyBottom&&i<=10&&this.setState({stickyBottom:!0})}))},this._rebindStickyEl()}_rebindStickyEl(){const n=this.containerRef.current;n!==this._stickyBoundEl&&(this._stickyBoundEl&&this._stickyBoundEl.removeEventListener("scroll",this._onStickyScroll),this._stickyBoundEl=n,n&&n.addEventListener("scroll",this._onStickyScroll,{passive:!0}))}_unbindStickyScroll(){this._stickyBoundEl&&this._onStickyScroll&&(this._stickyBoundEl.removeEventListener("scroll",this._onStickyScroll),this._stickyBoundEl=null),this._stickyScrollRafId&&(cancelAnimationFrame(this._stickyScrollRafId),this._stickyScrollRafId=null)}_getScrollContainer(){return Ft?this._virtuosoScrollerEl:this.containerRef.current}_bindScrollFade(){this._unbindScrollFade(),this._scrollFadeDelayTimer=setTimeout(()=>{const n=this._getScrollContainer();n&&(this._scrollFadeBoundEl=n,this._onScrollFade=()=>{this.setState({highlightFading:!0}),this._fadeClearTimer=setTimeout(()=>{this.setState({highlightTs:null,highlightFading:!1,highlightVisibleIdx:-1})},2e3),this._unbindScrollFade()},n.addEventListener("scroll",this._onScrollFade,{passive:!0}))},500)}_unbindScrollFade(){this._scrollFadeDelayTimer&&(clearTimeout(this._scrollFadeDelayTimer),this._scrollFadeDelayTimer=null),this._fadeClearTimer&&(clearTimeout(this._fadeClearTimer),this._fadeClearTimer=null),this._onScrollFade&&this._scrollFadeBoundEl&&(this._scrollFadeBoundEl.removeEventListener("scroll",this._onScrollFade),this._scrollFadeBoundEl=null,this._onScrollFade=null)}renderSessionMessages(n,i,r,s){const{userProfile:o,collapseToolResults:a,expandThinking:l,showFullToolContent:c,showThinkingSummaries:d,onViewRequest:u}=this.props;let h=x3(n);if(h&&n.length>this._incToolProcessedCount&&(Gg(h,n,this._incToolProcessedCount),this._incToolProcessedCount=n.length),!h){const x=parseInt(i.slice(1),10);this._incToolSessionIdx===x&&n.length>=this._incToolProcessedCount&&this._incToolProcessedCount>0?Gg(this._incToolState,n,this._incToolProcessedCount):(this._incToolState=zV(),Gg(this._incToolState,n,0),this._incToolSessionIdx=x),this._incToolProcessedCount=n.length,h=this._incToolState,fMe(n,h)}const{toolUseMap:O,toolResultMap:p,readContentMap:m,editSnapshotMap:g,askAnswerMap:v,latestPlanContent:$}=h,b=h._planDirty||0;(this._prevPlanCache!==h.planApprovalMap||this._prevPlanDirty!==b)&&(this._mergedPlanApprovalMap={...h.planApprovalMap},this._prevPlanCache=h.planApprovalMap,this._prevPlanDirty=b);const S=this._mergedPlanApprovalMap||h.planApprovalMap,y=this.props.cliMode&&this.state.ptyPromptHistory.slice().reverse().find(x=>jO(x)&&x.status==="active")||null,Q=this.props.cliMode&&this.state.ptyPromptHistory.slice().reverse().find(x=>rS(x)&&x.status==="active")||null;let _=null,P=null;const C=new Set,X=this.state.localAskAnswers||{},z=(h==null?void 0:h._askDirty)||0;(this._prevAskCache!==v||this._prevLocalAsk!==X||this._prevAskDirty!==z)&&(this._mergedAskAnswerMap=Object.keys(X).length>0?{...v,...X}:v,this._prevAskCache=v,this._prevLocalAsk=X,this._prevAskDirty=z);const T=this._mergedAskAnswerMap;for(const x of n)if(x.role==="assistant"&&Array.isArray(x.content))for(const R of x.content){if(R.type==="tool_use"&&R.name==="ExitPlanMode"){const E=S[R.id];(!E||E.status==="pending")&&(_=R.id)}if(R.type==="tool_use"&&R.name==="AskUserQuestion"){C.add(R.id);const E=T[R.id];(!E||Object.keys(E).length===0)&&(P=R.id)}}const k=[];for(let x=0;x<n.length;x++){const R=n[x],E=R.content,I=R._timestamp||null,A=I?s[I]:void 0,j=A!=null&&u?{requestIndex:A,onViewRequest:u}:mLe;if(R.role==="user"){if(Array.isArray(E)){const N=E.find(B=>B.type==="text"&&/^\[SUGGESTION MODE:/i.test((B.text||"").trim())),L=E.filter(B=>B.type==="tool_result");if(!(N&&L.length>0)){const{commands:B,textBlocks:V,skillBlocks:Y}=$_(E);for(let W=0;W<B.length;W++)k.push(w.jsx(gs,{role:"user",text:B[W],timestamp:I,userProfile:o,modelInfo:r,...j},`${i}-cmd-${x}-${W}`));for(const W of Y){const q=W.text.match(/^#\s+(.+)$/m),ne=q?q[1]:"Skill";k.push(w.jsx(gs,{role:"skill-loaded",text:W.text,skillName:ne,timestamp:I,...j},`${i}-skill-${x}`))}for(let W=0;W<V.length;W++){const q=/Implement the following plan:/i.test(V[W].text||"");k.push(w.jsx(gs,{role:q?"plan-prompt":"user",text:V[W].text,timestamp:I,userProfile:o,modelInfo:r,...j},`${i}-user-${x}-${W}`))}}}else if(typeof E=="string"&&!yv(E)){const N=/Implement the following plan:/i.test(E);k.push(w.jsx(gs,{role:N?"plan-prompt":"user",text:E,timestamp:I,userProfile:o,modelInfo:r,...j},`${i}-user-${x}`))}}else if(R.role==="assistant"){const N=P&&Array.isArray(E)&&E.some(B=>B.type==="tool_use"&&B.name==="AskUserQuestion"&&B.id===P)?P:null,L=_&&Array.isArray(E)&&E.some(B=>B.type==="tool_use"&&B.name==="ExitPlanMode"&&B.id===_)?_:null;Array.isArray(E)?k.push(w.jsx(gs,{role:"assistant",content:E,toolResultMap:p,readContentMap:m,editSnapshotMap:g,askAnswerMap:T,planApprovalMap:S,latestPlanContent:$,timestamp:I,modelInfo:r,collapseToolResults:a,expandThinking:l,showFullToolContent:c,showThinkingSummaries:d,ptyPrompt:this.state.ptyPrompt,activePlanPrompt:y,activeDangerousPrompt:Q,lastPendingPlanId:L,lastPendingAskId:N,onPlanApprovalClick:this.handlePromptOptionClick,onPlanFeedbackSubmit:this.handlePlanFeedbackSubmit,onDangerousApprovalClick:this.handlePromptOptionClick,onAskQuestionSubmit:this.handleAskQuestionSubmit,cliMode:this.props.cliMode,onOpenFile:this.handleOpenToolFilePath,...j},`${i}-asst-${x}`)):typeof E=="string"&&k.push(w.jsx(gs,{role:"assistant",content:[{type:"text",text:E}],toolResultMap:p,readContentMap:m,editSnapshotMap:g,askAnswerMap:T,planApprovalMap:S,latestPlanContent:$,timestamp:I,modelInfo:r,collapseToolResults:a,expandThinking:l,showFullToolContent:c,showThinkingSummaries:d,ptyPrompt:this.state.ptyPrompt,activePlanPrompt:y,activeDangerousPrompt:Q,lastPendingPlanId:L,lastPendingAskId:N,onPlanApprovalClick:this.handlePromptOptionClick,onPlanFeedbackSubmit:this.handlePlanFeedbackSubmit,onDangerousApprovalClick:this.handlePromptOptionClick,onAskQuestionSubmit:this.handleAskQuestionSubmit,cliMode:this.props.cliMode,onOpenFile:this.handleOpenToolFilePath,...j},`${i}-asst-${x}`))}}return k}_buildTeammateFallbackItems(){var u,h,O,p;const{requests:n,collapseToolResults:i,expandThinking:r,showFullToolContent:s,onViewRequest:o}=this.props;if(!n||n.length===0)return[];Y5(n);const a=new Map;for(const m of n){if(!uP(m)||!((h=(u=m.body)==null?void 0:u.messages)!=null&&h.length))continue;const g=m.teammate||"teammate",v=a.get(g);(!v||m.body.messages.length>=v.messages.length)&&a.set(g,{messages:m.body.messages,response:m.response,timestamp:m.timestamp})}if(a.size===0)return[];const l=null,c=[];let d=0;for(const[m,g]of a){c.push(w.jsx(Pb,{className:Vt.sessionDivider,children:w.jsx(F1,{className:Vt.sessionDividerText,children:m})},`tm-div-${d}`));const v=this.renderSessionMessages(g.messages,`tm${d}`,l,{});if(c.push(...v),d===a.size-1&&((p=(O=g.response)==null?void 0:O.body)!=null&&p.content)){const $=g.response.body.content;if(Array.isArray($)){const b=$.filter(S=>S.type==="text"&&S.text).map((S,y)=>w.jsx(gs,{role:"assistant",content:[S],collapseToolResults:i,expandThinking:r,showFullToolContent:s,onViewRequest:o,onOpenFile:this.handleOpenToolFilePath},`tm-resp-${d}-${y}`));b.length>0&&(this._lastResponseItems=b)}}d++}return c}buildAllItems(){var g,v,$,b,S;const{mainAgentSessions:n,requests:i,collapseToolResults:r,expandThinking:s,showFullToolContent:o,onViewRequest:a}=this.props;if(this._lastResponseItems=null,this._lastResponseAskQuestions=null,!n||n.length===0)return this._buildTeammateFallbackItems();const l=this._reqScanCache;if(i){const y=i.length>=l.processedCount?l.processedCount:0;y===0&&(l.tsToIndex={},l.modelName=null);for(let _=y;_<i.length;_++){const P=i[_],C=js(P);C&&P.timestamp&&(l.tsToIndex[P.timestamp]=_),C&&((g=P.body)!=null&&g.model)&&(l.modelName=P.body.model)}l.processedCount=i.length,Y5(i);let Q=l.subAgentProcessedCount||0;if(Q>0&&Q<i.length)for(Q--;l.subAgentEntries.length>0&&l.subAgentEntries[l.subAgentEntries.length-1].requestIndex>=Q;)l.subAgentEntries.pop();for(let _=Q;_<i.length;_++){const P=i[_];if(!P.timestamp)continue;const C=Lx(P,i[_+1]);if(C.type==="SubAgent"||C.type==="Teammate"){const X=($=(v=P.response)==null?void 0:v.body)==null?void 0:$.content;if(Array.isArray(X)&&X.length>0){const z=mMe(((b=P.body)==null?void 0:b.messages)||[]).toolResultMap,T=C.type==="Teammate";l.subAgentEntries.push({timestamp:P.timestamp,content:X,toolResultMap:z,label:T?EV(C.subType,(S=P.body)==null?void 0:S.model):RV(C.type,C.subType),isTeammate:T,requestIndex:_})}}}l.subAgentProcessedCount=i.length}const c=l.tsToIndex,d=S_(l.modelName),u=l.subAgentEntries,h=[],O={};(this.props.hasMoreHistory||this.props.loadingMore)&&h.push(w.jsx("div",{className:Vt.loadMoreWrap,children:this.props.loadingMore?w.jsxs("div",{className:`${Vt.loadMoreBtn} ${Vt.loadMoreBtnLoading}`,children:[w.jsx(Ca,{size:"small",style:{marginRight:8}}),le("ui.loadingMoreHistory")]}):w.jsx("button",{className:Vt.loadMoreBtn,onClick:()=>this.props.onLoadMoreHistory&&this.props.onLoadMoreHistory(),children:le("ui.loadEarlierConversations")})},"load-more-history"));let p=0;n.forEach((y,Q)=>{var P,C,X,z,T;if(Q>0&&h.push(w.jsx(Pb,{className:Vt.sessionDivider,children:w.jsx(F1,{className:Vt.sessionDividerText,children:"Session"})},`session-div-${Q}`)),y._cold){const k=this.props.loadingSessionId===y.sessionId;h.push(w.jsx("div",{className:Vt.loadMoreWrap,children:k?w.jsxs("div",{className:`${Vt.loadMoreBtn} ${Vt.loadMoreBtnLoading}`,children:[w.jsx(Ca,{size:"small",style:{marginRight:8}}),le("ui.loadingMoreHistory")]}):w.jsx("button",{className:Vt.loadMoreBtn,onClick:()=>this.props.onLoadSession&&this.props.onLoadSession(y.sessionId),children:le("ui.loadSessionPlaceholder",{count:y.msgCount})})},`cold-session-${Q}`));return}const _=this.renderSessionMessages(y.messages,`s${Q}`,d,c);for(const k of _){const x=k.props.timestamp;for(;p<u.length&&x&&u[p].timestamp<=x;){const R=u[p];R.timestamp&&(O[R.timestamp]=h.length),h.push(w.jsx(gs,{role:"sub-agent-chat",content:R.content,toolResultMap:R.toolResultMap,label:R.label,isTeammate:R.isTeammate,timestamp:R.timestamp,collapseToolResults:r,expandThinking:s,showFullToolContent:o,requestIndex:R.requestIndex,onViewRequest:a,onOpenFile:this.handleOpenToolFilePath},`sub-${R.requestIndex}-${R.timestamp}`)),p++}x&&(O[x]=h.length),h.push(k)}for(;p<u.length;){const k=u[p],x=Q<n.length-1&&((C=(P=n[Q+1].messages)==null?void 0:P[0])==null?void 0:C._timestamp);if(x&&k.timestamp>x)break;k.timestamp&&(O[k.timestamp]=h.length),h.push(w.jsx(gs,{role:"sub-agent-chat",content:k.content,toolResultMap:k.toolResultMap,label:k.label,isTeammate:k.isTeammate,timestamp:k.timestamp,collapseToolResults:r,expandThinking:s,showFullToolContent:o,requestIndex:k.requestIndex,onViewRequest:a,onOpenFile:this.handleOpenToolFilePath},`sub-${k.requestIndex}-${k.timestamp}`)),p++}if(Q===n.length-1&&((z=(X=y.response)==null?void 0:X.body)!=null&&z.content)){const k=y.response.body.content;if(Array.isArray(k)){const x=k.some(I=>I.type==="tool_use"&&(I.name==="AskUserQuestion"||I.name==="ExitPlanMode"));if(!(k.some(I=>I.type==="text"&&typeof I.text=="string"&&I.text.includes("[SUGGESTION MODE:"))&&!x)){const I=new Set;for(const D of y.messages)if(D.role==="assistant"&&Array.isArray(D.content))for(const ee of D.content)ee.type==="tool_use"&&ee.name==="AskUserQuestion"&&I.add(ee.id);y.entryTimestamp&&(O[y.entryTimestamp]=h.length);let A=null,j=null;const N=this.state.localAskAnswers||{};for(const D of k){if(D.type==="tool_use"&&D.name==="AskUserQuestion"){const ee=N[D.id];(!ee||Object.keys(ee).length===0)&&(A=D.id)}D.type==="tool_use"&&D.name==="ExitPlanMode"&&(j=D.id)}this._lastResponseAskQuestions=new Set;for(const D of k)if(D.type==="tool_use"&&D.name==="AskUserQuestion"){const ee=(T=D.input)==null?void 0:T.questions;if(Array.isArray(ee))for(const fe of ee)fe.question&&this._lastResponseAskQuestions.add(fe.question)}const L=x3(y.messages)||{},B=L.planApprovalMap||{},V=L.latestPlanContent||null,Y=this.props.cliMode&&this.state.ptyPromptHistory.slice().reverse().find(D=>jO(D)&&D.status==="active")||null,W=this.props.cliMode&&this.state.ptyPromptHistory.slice().reverse().find(D=>rS(D)&&D.status==="active")||null,q=k.filter(D=>D.type!=="tool_use"||D.name==="AskUserQuestion"&&!I.has(D.id)||D.name==="ExitPlanMode");if(!q.some(D=>D.type==="text"?typeof D.text=="string"&&D.text.trim().length>0:D.type==="tool_use"?!0:D.type==="thinking"?typeof D.thinking=="string"&&D.thinking.trim().length>0:!1))return;this._lastResponseItems=w.jsxs(Z.Fragment,{children:[w.jsx(Pb,{className:Vt.lastResponseDivider,children:w.jsx(F1,{type:"secondary",className:Vt.lastResponseLabel,children:le("ui.lastResponse")})}),w.jsx(gs,{role:"assistant",content:q,timestamp:y.entryTimestamp,modelInfo:d,collapseToolResults:r,expandThinking:s,showFullToolContent:o,toolResultMap:Z3,askAnswerMap:Object.keys(N).length>0?N:Z3,planApprovalMap:B,latestPlanContent:V,lastPendingAskId:A,lastPendingPlanId:j,activePlanPrompt:Y,activeDangerousPrompt:W,ptyPrompt:this.state.ptyPrompt,onPlanApprovalClick:this.handlePromptOptionClick,onPlanFeedbackSubmit:this.handlePlanFeedbackSubmit,onDangerousApprovalClick:this.handlePromptOptionClick,cliMode:this.props.cliMode,onAskQuestionSubmit:this.handleAskQuestionSubmit,onOpenFile:this.handleOpenToolFilePath},"resp-asst")]},"last-response-group")}}}});const{scrollToTimestamp:m}=this.props;return this._scrollTargetIdx=m&&O[m]!=null?O[m]:null,this._tsItemMap=O,h}_applyMobileSlice(n){if(!Ft)return this._mobileSliceOffset=0,this._totalItemCount=n.length,n;this._totalItemCount=n.length;const i=H1+this._mobileExtraItems;if(n.length<=i)return this._mobileSliceOffset=0,n;const r=n.length-i;if(this._mobileSliceOffset=r,this._scrollTargetIdx!=null&&(this._scrollTargetIdx-=r,this._scrollTargetIdx<0&&(this._scrollTargetIdx=null)),this._tsItemMap){const s={};for(const[o,a]of Object.entries(this._tsItemMap)){const l=a-r;l>=0&&(s[o]=l)}this._tsItemMap=s}return n.slice(r)}_extractSuggestion(){var h;const{mainAgentSessions:n}=this.props;if(!(n!=null&&n.length))return null;const i=n[n.length-1],r=i==null?void 0:i.messages;if(!Array.isArray(r)||r.length===0)return null;const s=r[r.length-1];if((s==null?void 0:s.role)!=="user")return null;const o=s.content;if(!(Array.isArray(o)?o.some(O=>O.type==="text"&&/^\[SUGGESTION MODE:/i.test((O.text||"").trim())):typeof o=="string"&&/^\[SUGGESTION MODE:/im.test(o.trim())))return null;const l=i==null?void 0:i.response;if(!l)return null;const c=l.body;if(!c)return null;const d=c.stop_reason;if(d!=="end_turn"&&d!=="max_tokens")return null;const u=c.content;if(!Array.isArray(u))return null;for(let O=u.length-1;O>=0;O--)if(u[O].type==="text"&&((h=u[O].text)!=null&&h.trim()))return u[O].text.trim();return null}_updateSuggestion(){const n=this._extractSuggestion();this.setState({inputSuggestion:n||null})}_loadPresets(){let n=!1;fetch(pt("/api/claude-settings")).then(i=>i.json()).then(i=>{var r;n=((r=i==null?void 0:i.env)==null?void 0:r.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS)==="1"}).catch(()=>{}).then(()=>{n&&fetch(pt("/api/preferences")).then(i=>i.json()).then(i=>{const r=Array.isArray(i.dismissedBuiltinPresets)?new Set(i.dismissedBuiltinPresets):new Set;let s=[];Array.isArray(i.presetShortcuts)&&(s=i.presetShortcuts.map((a,l)=>typeof a=="string"?{id:Date.now()+l,teamName:"",description:a}:{id:Date.now()+l,teamName:a.teamName||"",description:a.description||"",...a.builtinId?{builtinId:a.builtinId}:{},...a.modified?{modified:!0}:{}}));const o=new Set(s.filter(a=>a.builtinId).map(a=>a.builtinId));for(const a of Ij)r.has(a.builtinId)||o.has(a.builtinId)||s.unshift({id:Date.now()+Math.random(),builtinId:a.builtinId,teamName:a.teamName,description:a.description});this.setState({presetItems:s})}).catch(()=>{})})}connectInputWs(){const i=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`;this._inputWs=new WebSocket(i),this._inputWs.onmessage=r=>{var s,o;try{const a=JSON.parse(r.data);a.type==="data"?this._appendPtyData(a.data):a.type==="exit"?this._clearPtyPrompt():a.type==="ask-hook-pending"?(this._askHookActive=!0,this._askHookQuestions=a.questions):a.type==="ask-hook-timeout"?(this._askHookActive=!1,this._askHookQuestions=null):a.type==="sdk-plan-pending"?this.setState({pendingPlanApproval:{id:a.id,input:a.input}}):a.type==="sdk-ask-pending"?(this._askHookActive=!0,this._askHookQuestions=a.questions,this._sdkAskId=a.id):a.type==="sdk-ask-timeout"?(this._askHookActive=!1,this._askHookQuestions=null,this._sdkAskId=null):a.type==="perm-hook-pending"?this.setState({pendingPermission:{id:a.id,toolName:a.toolName,input:a.input}}):a.type==="perm-hook-timeout"?this.setState({pendingPermission:null}):a.type==="perm-hook-resolved"?((s=this.state.pendingPermission)==null?void 0:s.id)===a.id&&this.setState({pendingPermission:null}):a.type==="ask-hook-resolved"?(this._askHookActive=!1,this._askHookQuestions=null):a.type==="sdk-ask-resolved"?this._sdkAskId===a.id&&(this._askHookActive=!1,this._askHookQuestions=null,this._sdkAskId=null):a.type==="sdk-plan-resolved"?((o=this.state.pendingPlanApproval)==null?void 0:o.id)===a.id&&this.setState({pendingPlanApproval:null}):a.type==="image-upload-notify"?this._addPendingImage(a.path,a.source):a.type==="image-remove-notify"&&a.path&&this.setState(l=>{const c=l.pendingImages.filter(d=>d.path!==a.path);return c.length===l.pendingImages.length?null:{pendingImages:c}})}catch{}},this._inputWs.onclose=()=>{(this.state.pendingPermission||this.state.pendingPlanApproval)&&this.setState({pendingPermission:null,pendingPlanApproval:null}),this._sdkAskId=null,this._askHookActive=!1,this._askHookQuestions=null,this._wsReconnectTimer=setTimeout(()=>{!this._unmounted&&this.splitContainerRef.current&&this.props.cliMode&&this.connectInputWs()},2e3)}}_stripAnsi(n){return n.replace(/\x1b\[[0-9;]*[A-Za-z]/g,"").replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g,"").replace(/\x1b[^[\]](.|$)/g,"").replace(/[\x00-\x08\x0b\x0c\x0e-\x1f]/g,"")}_appendPtyData(n){const i=this._stripAnsi(n);this._ptyBuffer+=i,this._ptyDataSeq++,this._ptyBuffer.length>4096&&(this._ptyBuffer=this._ptyBuffer.slice(-4096)),this._ptyDebounceTimer&&clearTimeout(this._ptyDebounceTimer),this._ptyDebounceTimer=setTimeout(()=>this._detectPrompt(),200)}_detectPrompt(){const n=this._ptyBuffer.trimEnd();let i=null,r=null;const s=n.match(/([^\n]*\?)\s*\n((?:\s*[❯>]?\s*\d+\.\s+[^\n]+\n?){2,})(?:\n[^\d❯>\n][^\n]*)?$/);if(s){i=s[1].trim();const o=s[2].match(/\s*([❯>])?\s*(\d+)\.\s+([^\n]+)/g);o&&(r=o.map(a=>{const l=a.match(/\s*([❯>])?\s*(\d+)\.\s+(.+)/);return{number:parseInt(l[2],10),text:l[3].trim(),selected:!!l[1]}}))}if(!r){const o=n.match(/([^\n]+)\n((?:\s+[❯>]?\s+[^\n]+\n?){2,})(?:\n[^\s❯>\n][^\n]*)?$/);if(o){const a=o[1].trim(),c=o[2].split(`
1103
+ ...`:j)}},A):null}):w.jsx("div",{className:kt.agentNoMessages,children:"No messages"})]});return w.jsx(Sl,{content:E,trigger:"click",placement:"right",autoAdjustOverflow:!0,overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-light)",padding:0,maxWidth:800,maxHeight:"70vh",overflowY:"auto"},onOpenChange:I=>p(I?z:null),children:w.jsxs("div",{className:`${kt.teamAgentCard} ${kt.teamAgentCardClickable} ${O===z?kt.teamAgentCardActive:""}`,children:[w.jsxs("div",{className:kt.teamAgentCardHeader,children:[(()=>{const I=Bu(X.name);return w.jsx("div",{className:kt.teamAgentAvatar,style:{background:I.color},dangerouslySetInnerHTML:{__html:I.svg}})})(),w.jsx("div",{className:kt.teamAgentName,children:X.name})]}),w.jsx("div",{className:kt.teamAgentType,children:X.type}),w.jsxs("div",{className:kt.teamAgentStatus,style:{color:T?"var(--color-success)":"var(--color-warning-light)"},children:[T?"✓ done":"● working"," ",w.jsxs("span",{className:kt.agentStatusDurSuffix,children:["· ",x]})]})]})},z)})]}),w.jsxs("div",{className:kt.teamModalContent,children:[w.jsx(bje,{teamAgents:_,teamTotalStart:b,teamTotalEnd:S,leadSegments:P,ganttWrapRef:d,ganttIndicatorRef:c,ganttHeight:m,onGanttHeightChange:g}),w.jsxs("div",{className:kt.teamModalBody,ref:l,onScroll:y,children:[Q.map((X,z)=>w.jsxs("div",{"data-timestamp":X.timestamp,children:[X.type==="user"&&w.jsx(gs,{role:"user",text:X.text,timestamp:X.timestamp,userProfile:s,modelInfo:C,requestIndex:X.requestIndex,onViewRequest:o}),X.type==="assistant"&&w.jsx(gs,{role:"assistant",content:X.content,timestamp:X.timestamp,modelInfo:X.modelInfo,collapseToolResults:i,expandThinking:r,toolResultMap:{},askAnswerMap:{},requestIndex:X.requestIndex,onViewRequest:o}),X.type==="sub-agent"&&w.jsx(gs,{role:"sub-agent-chat",content:X.content,toolResultMap:X.toolResultMap,label:X.label,isTeammate:X.isTeammate,timestamp:X.timestamp,collapseToolResults:i,expandThinking:r,requestIndex:X.requestIndex,onViewRequest:o}),X.type==="context"&&w.jsx(gs,{role:"assistant",content:[{type:"text",text:X.text}],timestamp:X.timestamp,modelInfo:C,collapseToolResults:i,expandThinking:r,toolResultMap:{},askAnswerMap:{}}),X.type==="teammate-report"&&w.jsxs("div",{className:kt.teammateReportEntry,children:[w.jsxs("div",{className:kt.teammateReportHeader,children:[(()=>{const T=Bu(X.agentName);return w.jsx("div",{className:kt.teamAgentAvatar,style:{background:T.color},dangerouslySetInnerHTML:{__html:T.svg}})})(),w.jsx("span",{className:kt.teammateReportName,children:X.agentName}),w.jsx("span",{className:kt.teammateReportSummary,children:X.summary})]}),w.jsx("div",{className:`${kt.teammateReportBody} chat-md`,dangerouslySetInnerHTML:{__html:bo(X.content)}})]})]},`tw-${z}`)),Q.length===0&&w.jsx(Ls,{description:"No entries",image:Ls.PRESENTED_IMAGE_SIMPLE})]})]})]})})}const Sje="_snapLine_1qd8k_1",yje="_snapLineActive_1qd8k_13",_je="_snapPreview_1qd8k_24",B1={snapLine:Sje,snapLineActive:yje,snapPreview:_je};function Qje({isDragging:t,activeSnapLine:e,snapLines:n,currentLeft:i}){if(!t)return null;let r=null;if(e){const a=e.linePosition,l=Math.min(i,a),c=Math.abs(a-i);r=w.jsx("div",{className:B1.snapPreview,style:{left:`${l}px`,width:`${c}px`}})}const s=[...n].map(a=>({...a,dist:Math.abs(a.linePosition-i)})).sort((a,l)=>a.dist-l.dist);let o=null;if(s.length>0){const a=s[0],l=e&&e.cols===a.cols;o=w.jsx("div",{className:l?B1.snapLineActive:B1.snapLine,style:{left:`${a.linePosition}px`}},a.cols)}return w.jsxs(w.Fragment,{children:[r,o]})}const xje="_roleFilterBar_os5cl_1",wje="_roleChip_os5cl_10",Pje="_roleChipActive_os5cl_10",Cje="_roleAvatar_os5cl_31",Tje="_roleAvatarImg_os5cl_44",kje="_roleName_os5cl_51",Rje="_roleCheck_os5cl_56",Rc={roleFilterBar:xje,roleChip:wje,roleChipActive:Pje,roleAvatar:Cje,roleAvatarImg:Tje,roleName:kje,roleCheck:Rje};function Eje({roles:t,selectedRoles:e,onToggle:n}){return!t||t.length===0?null:w.jsx("div",{className:Rc.roleFilterBar,children:t.map(i=>{const r=e.has(i.key);return w.jsxs("button",{className:r?Rc.roleChipActive:Rc.roleChip,onClick:()=>n(i.key),children:[i.avatarImg?w.jsx("img",{src:i.avatarImg,className:Rc.roleAvatarImg,alt:i.name,onError:s=>{s.target.onerror=null,s.target.style.display="none";const o=s.target.parentNode.querySelector("[data-role-avatar-fallback]");o&&(o.style.display="")}}):null,w.jsx("div",{className:Rc.roleAvatar,style:{background:i.color||"rgba(255,255,255,0.1)",display:i.avatarImg?"none":""},"data-role-avatar-fallback":"",dangerouslySetInnerHTML:{__html:i.avatarSvg||y_(i.avatarType)}}),w.jsx("span",{className:Rc.roleName,children:i.name}),r&&w.jsx("span",{className:Rc.roleCheck,children:"✓"})]},i.key)})})}const Xje="_chatInputBar_dd8pm_1",zje="_chatInputWrapper_dd8pm_7",Ije="_chatTextareaWrap_dd8pm_21",Aje="_chatTextarea_dd8pm_21",Mje="_chatInputBottom_dd8pm_46",jje="_plusArea_dd8pm_53",Nje="_plusBtn_dd8pm_57",Wje="_plusBtnOpen_dd8pm_71",Lje="_plusOverlay_dd8pm_81",Vje="_plusMenu_dd8pm_90",Bje="_plusMenuItem_dd8pm_103",Yje="_plusMenuItemMuted_dd8pm_123",Dje="_presetLabel_dd8pm_142",Uje="_chatInputHint_dd8pm_148",qje="_chatInputHintSep_dd8pm_156",Zje="_chatInputHintTerminal_dd8pm_160",Gje="_chatInputHintMobile_dd8pm_164",Fje="_sendBtn_dd8pm_172",Hje="_sendBtnDisabled_dd8pm_187",Kje="_ghostText_dd8pm_198",Jje="_suggestionChip_dd8pm_214",eNe="_suggestionChipText_dd8pm_230",tNe="_suggestionChipAction_dd8pm_239",nNe="_imagePreviewStrip_dd8pm_246",iNe="_imagePreviewItem_dd8pm_258",rNe="_imagePreviewThumb_dd8pm_268",sNe="_imagePreviewRemove_dd8pm_275",oNe="_filePreviewChip_dd8pm_301",aNe="_filePreviewName_dd8pm_319",lNe="_filePreviewClose_dd8pm_327",cNe="_streaming_dd8pm_450",dNe="_streamingFading_dd8pm_451",uNe="_streamingSvg_dd8pm_461",hNe="_streamingSvgFading_dd8pm_472",wn={chatInputBar:Xje,chatInputWrapper:zje,chatTextareaWrap:Ije,chatTextarea:Aje,chatInputBottom:Mje,plusArea:jje,plusBtn:Nje,plusBtnOpen:Wje,plusOverlay:Lje,plusMenu:Vje,plusMenuItem:Bje,plusMenuItemMuted:Yje,presetLabel:Dje,chatInputHint:Uje,chatInputHintSep:qje,chatInputHintTerminal:Zje,chatInputHintMobile:Gje,sendBtn:Fje,sendBtnDisabled:Hje,ghostText:Kje,suggestionChip:Jje,suggestionChipText:eNe,suggestionChipAction:tNe,imagePreviewStrip:nNe,imagePreviewItem:iNe,imagePreviewThumb:rNe,imagePreviewRemove:sNe,filePreviewChip:oNe,filePreviewName:aNe,filePreviewClose:lNe,streaming:cNe,streamingFading:dNe,streamingSvg:uNe,streamingSvgFading:hNe};function ONe({inputRef:t,inputEmpty:e,inputSuggestion:n,terminalVisible:i,onKeyDown:r,onChange:s,onSend:o,onSuggestionClick:a,onUploadPath:l,presetItems:c,onPresetSend:d,onOpenPresetModal:u,isStreaming:h,streamingFading:O,pendingImages:p,onRemovePendingImage:m}){const[g,v]=f.useState(!1),$=async b=>{var y;const S=(y=b.clipboardData)==null?void 0:y.items;if(S){for(const Q of S)if(Q.type.startsWith("image/")){b.preventDefault();try{const _=Q.getAsFile();if(!_)return;const P=await Av(_);l==null||l(P)}catch(_){console.error("[CC Viewer] Paste image upload failed:",_)}return}}};return i?n?w.jsxs("div",{className:wn.suggestionChip,onClick:a,children:[w.jsx("span",{className:wn.suggestionChipText,children:n}),w.jsx("span",{className:wn.suggestionChipAction,children:"↵"})]}):null:w.jsx("div",{className:wn.chatInputBar,children:w.jsxs("div",{className:`${wn.chatInputWrapper}${h?` ${wn.streaming}`:""}${O?` ${wn.streamingFading}`:""}`,children:[(h||O)&&w.jsxs("svg",{className:`${wn.streamingSvg}${O?` ${wn.streamingSvgFading}`:""}`,children:[w.jsx("defs",{children:w.jsxs("filter",{id:"ccv-streamGlow",children:[w.jsx("feGaussianBlur",{stdDeviation:"2",result:"blur"}),w.jsxs("feMerge",{children:[w.jsx("feMergeNode",{in:"blur"}),w.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),[{da:"20 30",op:.08,off:0},{da:"16 34",op:.15,off:-4},{da:"11 39",op:.3,off:-9},{da:"6 44",op:.6,off:-14},{da:"3 47",op:1,off:-17}].map((b,S,y)=>w.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",rx:"16",ry:"16",pathLength:"100",fill:"none",strokeWidth:"1.5",stroke:"var(--color-primary-lighter)",strokeOpacity:b.op,strokeLinecap:"round",strokeDasharray:b.da,filter:S===y.length-1?"url(#ccv-streamGlow)":void 0,children:w.jsx("animate",{attributeName:"stroke-dashoffset",from:b.off,to:b.off-100,dur:"2.5s",repeatCount:"indefinite"})},S))]}),w.jsxs("div",{className:wn.chatTextareaWrap,children:[p&&p.length>0&&w.jsx("div",{className:wn.imagePreviewStrip,children:p.map((b,S)=>{const y=b.path.split("/").pop()||b.path;return/\.(png|jpg|jpeg|gif|svg|webp|ico)$/i.test(y)?w.jsxs("div",{className:wn.imagePreviewItem,children:[w.jsx("img",{src:pt(`/api/file-raw?path=${encodeURIComponent(b.path)}`),className:wn.imagePreviewThumb,alt:y}),w.jsx("button",{className:wn.imagePreviewRemove,onClick:()=>m==null?void 0:m(S),title:le("ui.chatInput.removeImage"),children:"×"})]},b.path):w.jsxs("div",{className:wn.filePreviewChip,children:[w.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),w.jsx("polyline",{points:"14 2 14 8 20 8"})]}),w.jsx("span",{className:wn.filePreviewName,children:y}),w.jsx("button",{className:wn.filePreviewClose,onClick:()=>m==null?void 0:m(S),title:le("ui.chatInput.removeImage"),children:"×"})]},b.path)})}),w.jsx("textarea",{ref:t,className:wn.chatTextarea,placeholder:n?"":le("ui.chatInput.placeholder"),rows:1,onKeyDown:r,onInput:s,onPaste:$}),n&&e&&w.jsx("div",{className:wn.ghostText,children:n})]}),w.jsxs("div",{className:wn.chatInputBottom,children:[w.jsxs("div",{className:wn.plusArea,children:[w.jsx("button",{className:`${wn.plusBtn}${g?` ${wn.plusBtnOpen}`:""}`,onClick:()=>v(b=>!b),title:le("ui.chatInput.more"),children:w.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),w.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),g&&w.jsxs(w.Fragment,{children:[w.jsx("div",{className:wn.plusOverlay,onClick:()=>v(!1)}),w.jsxs("div",{className:wn.plusMenu,children:[c&&c.length>0&&u&&w.jsxs("button",{className:`${wn.plusMenuItem} ${wn.plusMenuItemMuted}`,onClick:()=>{v(!1),u()},children:[w.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("circle",{cx:"12",cy:"12",r:"3"}),w.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),w.jsx("span",{className:wn.presetLabel,children:le("ui.terminal.customShortcuts")})]}),c&&c.length>0&&c.map(b=>{const S=b.builtinId&&!b.modified,y=S?le(b.teamName):b.teamName,Q=S?le(b.description):b.description;return w.jsxs("button",{className:wn.plusMenuItem,onClick:()=>{v(!1),d==null||d(Q)},title:Q,children:[w.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),w.jsx("circle",{cx:"9",cy:"7",r:"4"}),w.jsx("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),w.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}),w.jsx("span",{className:wn.presetLabel,children:y||Q})]},b.id)}),w.jsxs("button",{className:wn.plusMenuItem,onClick:()=>{v(!1);const b=document.createElement("input");b.type="file",b.onchange=async S=>{var Q;const y=(Q=S.target.files)==null?void 0:Q[0];if(y)try{const _=await Av(y);l(_)}catch(_){console.error("[CC Viewer] Upload failed:",_)}},b.click()},children:[w.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),w.jsx("polyline",{points:"17 8 12 3 7 8"}),w.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),w.jsx("span",{children:le("ui.terminal.upload")})]})]})]})]}),w.jsx("div",{className:Ft?wn.chatInputHintMobile:wn.chatInputHint,children:Ft?le("ui.chatInput.hintMobile"):w.jsxs(w.Fragment,{children:[le(n&&e?"ui.chatInput.hintTab":"ui.chatInput.hintEnter"),w.jsx("span",{className:wn.chatInputHintSep,children:" · "}),w.jsx("span",{className:wn.chatInputHintTerminal,children:le("ui.chatInput.hintTerminal")})]})}),w.jsx("button",{className:`${wn.sendBtn} ${e&&!(p!=null&&p.length)?wn.sendBtnDisabled:""}`,onClick:o,disabled:e&&!(p!=null&&p.length),title:le("ui.chatInput.send"),children:w.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),w.jsx("polyline",{points:"5 12 12 5 19 12"})]})})]})]})})}function Y1(t,e){const n={presetShortcuts:t.map(i=>{const r={teamName:i.teamName,description:i.description};return i.builtinId&&(r.builtinId=i.builtinId),i.modified&&(r.modified=!0),r})};e&&(n.dismissedBuiltinPresets=[...e]),fetch(pt("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).then(()=>{window.dispatchEvent(new Event("ccv-presets-changed"))}).catch(()=>{})}function fNe({open:t,onClose:e,items:n,onItemsChange:i,dismissedBuiltinPresets:r}){const[s,o]=f.useState(new Set),[a,l]=f.useState(!1),[c,d]=f.useState(""),[u,h]=f.useState(""),[O,p]=f.useState(null),m=f.useRef(null),g=f.useRef(null),[,v]=f.useState(0),$=f.useRef(new Set(r||[])),b=f.useCallback(()=>{o(new Set),e()},[e]),S=f.useCallback(T=>{o(k=>{const x=new Set(k);return x.has(T)?x.delete(T):x.add(T),x})},[]),y=f.useCallback(()=>{if(s.size===0)return;const T=new Set($.current);for(const x of n)s.has(x.id)&&x.builtinId&&T.add(x.builtinId);$.current=T;const k=n.filter(x=>!s.has(x.id));o(new Set),i(k),Y1(k,T)},[n,s,i]),Q=f.useCallback(()=>{const T=u.trim(),k=c.trim();if(!T&&!k)return;let x;O?x=n.map(R=>{if(R.id!==O)return R;const E={...R,teamName:k,description:T};return R.builtinId&&(E.modified=!0),E}):x=[...n,{id:Date.now(),teamName:k,description:T}],i(x),Y1(x),l(!1),d(""),h(""),p(null)},[n,c,u,O,i]),_=(T,k)=>{k.stopPropagation(),m.current=T,k.dataTransfer.effectAllowed="move",requestAnimationFrame(()=>v(x=>x+1))},P=(T,k)=>{k.preventDefault(),k.stopPropagation(),k.dataTransfer.dropEffect="move",g.current!==T&&(g.current=T,v(x=>x+1))},C=()=>{m.current=null,g.current=null,v(T=>T+1)},X=(T,k)=>{k.stopPropagation(),g.current===T&&(g.current=null,v(x=>x+1))},z=(T,k)=>{k.preventDefault(),k.stopPropagation();const x=m.current;if(x===null||x===T){C();return}const R=[...n],[E]=R.splice(x,1);R.splice(x<T?T-1:T,0,E),i(R),Y1(R),C()};return w.jsxs(w.Fragment,{children:[w.jsxs(yi,{title:le("ui.terminal.presetShortcuts"),open:t,onCancel:b,footer:null,width:800,styles:{content:{background:"var(--bg-elevated)",border:"1px solid var(--border-light)"},header:{background:"var(--bg-elevated)",borderBottom:"none"}},children:[w.jsx("div",{className:Et.presetSectionHeader,children:w.jsx("span",{className:Et.presetSectionTitle,children:le("ui.terminal.agentTeamCustom")})}),w.jsx("div",{className:Et.presetList,onDragOver:T=>{T.preventDefault(),T.stopPropagation()},onDrop:T=>{T.preventDefault(),T.stopPropagation()},children:n.length===0?w.jsx("div",{className:Et.presetListEmptyHint,children:"—"}):n.map((T,k)=>{const x=T.builtinId&&!T.modified,R=x?le(T.teamName):T.teamName,E=x?le(T.description):T.description;return w.jsxs("div",{className:`${Et.presetRow} ${m.current===k?Et.presetRowDragging:""} ${g.current===k&&m.current!==k?Et.presetRowDragOver:""}`,onDragOver:I=>P(k,I),onDragLeave:I=>X(k,I),onDrop:I=>z(k,I),onDragEnd:C,children:[w.jsx("span",{className:Et.dragHandle,draggable:!0,onDragStart:I=>_(k,I),children:w.jsxs("svg",{viewBox:"0 0 10 16",width:"10",height:"16",fill:"currentColor",children:[w.jsx("circle",{cx:"3",cy:"3",r:"1.2"}),w.jsx("circle",{cx:"7",cy:"3",r:"1.2"}),w.jsx("circle",{cx:"3",cy:"8",r:"1.2"}),w.jsx("circle",{cx:"7",cy:"8",r:"1.2"}),w.jsx("circle",{cx:"3",cy:"13",r:"1.2"}),w.jsx("circle",{cx:"7",cy:"13",r:"1.2"})]})}),w.jsx(yl,{checked:s.has(T.id),onChange:()=>S(T.id)}),w.jsx("span",{className:Et.presetName,title:R,children:R||"—"}),w.jsx("span",{className:Et.presetText,title:E,children:E}),w.jsx(ai,{size:"small",type:"link",onClick:()=>{l(!0),d(x?le(T.teamName):T.teamName),h(x?le(T.description):T.description),p(T.id)},children:le("ui.terminal.editItem")})]},T.id)})}),w.jsxs("div",{className:Et.presetActions,children:[w.jsx(ai,{size:"small",danger:!0,disabled:s.size===0,onClick:y,children:le("ui.terminal.deleteSelected")}),w.jsx(ai,{size:"small",onClick:()=>{l(!0),d(""),h(""),p(null)},children:le("ui.terminal.addItem")})]})]}),w.jsxs(yi,{title:le(O?"ui.terminal.editItem":"ui.terminal.addItem"),open:a,onCancel:()=>{l(!1),d(""),h(""),p(null)},onOk:Q,okText:le(O?"ui.ok":"ui.terminal.addItem"),cancelText:le("ui.cancel"),okButtonProps:{disabled:!u.trim()&&!c.trim()},width:"fit-content",styles:{content:{background:"var(--bg-elevated)",border:"1px solid var(--border-light)"},header:{background:"var(--bg-elevated)",borderBottom:"none"}},children:[w.jsxs("div",{className:Et.presetFormField,children:[w.jsxs("label",{className:Et.presetFormLabel,children:["Team ",le("ui.terminal.teamName")]}),w.jsx("input",{className:Et.presetInput,placeholder:le("ui.terminal.teamNamePlaceholder"),value:c,onChange:T=>d(T.target.value)})]}),w.jsxs("div",{children:[w.jsxs("label",{className:Et.presetFormLabel,children:["Team ",le("ui.terminal.teamDesc")]}),w.jsx("textarea",{className:Et.presetTextarea,rows:6,placeholder:le("ui.terminal.presetInputPlaceholder"),value:u,onChange:T=>h(T.target.value),onKeyDown:T=>{T.key==="Enter"&&T.stopPropagation()}})]})]})]})}const L$=0,yc=1,kh=2,IV=4;function C3(t){return()=>t}function pNe(t){t()}function AV(t,e){return n=>t(e(n))}function T3(t,e){return()=>t(e)}function mNe(t,e){return n=>t(e,n)}function eT(t){return t!==void 0}function gNe(...t){return()=>{t.map(pNe)}}function Rh(){}function V$(t,e){return e(t),t}function vNe(t,e){return e(t)}function _i(...t){return t}function Zn(t,e){return t(yc,e)}function On(t,e){t(L$,e)}function tT(t){t(kh)}function Ci(t){return t(IV)}function Lt(t,e){return Zn(t,mNe(e,L$))}function Zo(t,e){const n=t(yc,i=>{n(),e(i)});return n}function k3(t){let e,n;return i=>r=>{e=r,n&&clearTimeout(n),n=setTimeout(()=>{i(e)},t)}}function MV(t,e){return t===e}function bi(t=MV){let e;return n=>i=>{t(e,i)||(e=i,n(i))}}function Kt(t){return e=>n=>{t(n)&&e(n)}}function Xt(t){return e=>AV(e,t)}function Qa(t){return e=>()=>{e(t)}}function He(t,...e){const n=$Ne(...e);return((i,r)=>{switch(i){case kh:tT(t);return;case yc:return Zn(t,n(r))}})}function za(t,e){return n=>i=>{n(e=t(e,i))}}function md(t){return e=>n=>{t>0?t--:e(n)}}function gl(t){let e=null,n;return i=>r=>{e=r,!n&&(n=setTimeout(()=>{n=void 0,i(e)},t))}}function pn(...t){const e=new Array(t.length);let n=0,i=null;const r=2**t.length-1;return t.forEach((s,o)=>{const a=2**o;Zn(s,l=>{const c=n;n|=a,e[o]=l,c!==r&&n===r&&i&&(i(),i=null)})}),s=>o=>{const a=()=>{s([o].concat(e))};n===r?a():i=a}}function $Ne(...t){return e=>t.reduceRight(vNe,e)}function bNe(t){let e,n;const i=()=>e==null?void 0:e();return function(r,s){switch(r){case yc:return s?n===s?void 0:(i(),n=s,e=Zn(t,s),e):(i(),Rh);case kh:i(),n=null;return}}}function ot(t){let e=t;const n=Xn();return((i,r)=>{switch(i){case L$:e=r;break;case yc:{r(e);break}case IV:return e}return n(i,r)})}function es(t,e){return V$(ot(e),n=>Lt(t,n))}function Xn(){const t=[];return((e,n)=>{switch(e){case L$:t.slice().forEach(i=>{i(n)});return;case kh:t.splice(0,t.length);return;case yc:return t.push(n),()=>{const i=t.indexOf(n);i>-1&&t.splice(i,1)}}})}function lo(t){return V$(Xn(),e=>Lt(t,e))}function Vn(t,e=[],{singleton:n}={singleton:!0}){return{constructor:t,dependencies:e,id:SNe(),singleton:n}}const SNe=()=>Symbol();function yNe(t){const e=new Map,n=({constructor:i,dependencies:r,id:s,singleton:o})=>{if(o&&e.has(s))return e.get(s);const a=i(r.map(l=>n(l)));return o&&e.set(s,a),a};return n(t)}function nr(...t){const e=Xn(),n=new Array(t.length);let i=0;const r=2**t.length-1;return t.forEach((s,o)=>{const a=2**o;Zn(s,l=>{n[o]=l,i|=a,i===r&&On(e,n)})}),function(s,o){switch(s){case kh:{tT(e);return}case yc:return i===r&&o(n),Zn(e,o)}}}function Ht(t,e=MV){return He(t,bi(e))}function Bx(...t){return function(e,n){switch(e){case kh:return;case yc:return gNe(...t.map(i=>Zn(i,n)))}}}const fr={DEBUG:0,INFO:1,WARN:2,ERROR:3},_Ne={[fr.DEBUG]:"debug",[fr.ERROR]:"error",[fr.INFO]:"log",[fr.WARN]:"warn"},QNe=()=>typeof globalThis>"u"?window:globalThis,_c=Vn(()=>{const t=ot(fr.ERROR);return{log:ot((e,n,i=fr.INFO)=>{const r=QNe().VIRTUOSO_LOG_LEVEL??Ci(t);i>=r&&console[_Ne[i]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",e,n)}),logLevel:t}},[],{singleton:!0});function wd(t,e,n){return nT(t,e,n).callbackRef}function nT(t,e,n){const i=Z.useRef(null);let r=o=>{};const s=Z.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(o=>{const a=()=>{const l=o[0].target;l.offsetParent!==null&&t(l)};n?a():requestAnimationFrame(a)}):null,[t,n]);return r=o=>{o&&e?(s==null||s.observe(o),i.current=o):(i.current&&(s==null||s.unobserve(i.current)),i.current=null)},{callbackRef:r,ref:i}}function xNe(t,e,n,i,r,s,o,a,l){const c=Z.useCallback(d=>{const u=wNe(d.children,e,a?"offsetWidth":"offsetHeight",r);let h=d.parentElement;for(;h.dataset.virtuosoScroller===void 0;)h=h.parentElement;const O=h.lastElementChild.dataset.viewportType==="window";let p;O&&(p=h.ownerDocument.defaultView);const m=o?a?o.scrollLeft:o.scrollTop:O?a?p.scrollX||p.document.documentElement.scrollLeft:p.scrollY||p.document.documentElement.scrollTop:a?h.scrollLeft:h.scrollTop,g=o?a?o.scrollWidth:o.scrollHeight:O?a?p.document.documentElement.scrollWidth:p.document.documentElement.scrollHeight:a?h.scrollWidth:h.scrollHeight,v=o?a?o.offsetWidth:o.offsetHeight:O?a?p.innerWidth:p.innerHeight:a?h.offsetWidth:h.offsetHeight;i({scrollHeight:g,scrollTop:Math.max(m,0),viewportHeight:v}),s==null||s(a?R3("column-gap",getComputedStyle(d).columnGap,r):R3("row-gap",getComputedStyle(d).rowGap,r)),u!==null&&t(u)},[t,e,r,s,o,i,a]);return nT(c,n,l)}function wNe(t,e,n,i){const r=t.length;if(r===0)return null;const s=[];for(let o=0;o<r;o++){const a=t.item(o);if(a.dataset.index===void 0)continue;const l=parseInt(a.dataset.index),c=parseFloat(a.dataset.knownSize),d=e(a,n);if(d===0&&i("Zero-sized element, this should not happen",{child:a},fr.ERROR),d===c)continue;const u=s[s.length-1];s.length===0||u.size!==d||u.endIndex!==l-1?s.push({endIndex:l,size:d,startIndex:l}):s[s.length-1].endIndex++}return s}function R3(t,e,n){return e!=="normal"&&(e==null?void 0:e.endsWith("px"))!==!0&&n(`${t} was not resolved to pixel value correctly`,e,fr.WARN),e==="normal"?0:parseInt(e??"0",10)}function jV(t,e,n){const i=Z.useRef(null),r=Z.useCallback(l=>{if(!(l!=null&&l.offsetParent))return;const c=l.getBoundingClientRect(),d=c.width;let u,h;if(e){const O=e.getBoundingClientRect(),p=c.top-O.top;h=O.height-Math.max(0,p),u=p+e.scrollTop}else{const O=o.current.ownerDocument.defaultView;h=O.innerHeight-Math.max(0,c.top),u=c.top+O.scrollY}i.current={offsetTop:u,visibleHeight:h,visibleWidth:d},t(i.current)},[t,e]),{callbackRef:s,ref:o}=nT(r,!0,n),a=Z.useCallback(()=>{r(o.current)},[r,o]);return Z.useEffect(()=>{var c;if(e){e.addEventListener("scroll",a);const d=new ResizeObserver(()=>{requestAnimationFrame(a)});return d.observe(e),()=>{e.removeEventListener("scroll",a),d.unobserve(e)}}const l=(c=o.current)==null?void 0:c.ownerDocument.defaultView;return l==null||l.addEventListener("scroll",a),l==null||l.addEventListener("resize",a),()=>{l==null||l.removeEventListener("scroll",a),l==null||l.removeEventListener("resize",a)}},[a,e,o]),s}const zs=Vn(()=>{const t=Xn(),e=Xn(),n=ot(0),i=Xn(),r=ot(0),s=Xn(),o=Xn(),a=ot(0),l=ot(0),c=ot(0),d=ot(0),u=Xn(),h=Xn(),O=ot(!1),p=ot(!1),m=ot(!1);return Lt(He(t,Xt(({scrollTop:g})=>g)),e),Lt(He(t,Xt(({scrollHeight:g})=>g)),o),Lt(e,r),{deviation:n,fixedFooterHeight:c,fixedHeaderHeight:l,footerHeight:d,headerHeight:a,horizontalDirection:p,scrollBy:h,scrollContainerState:t,scrollHeight:o,scrollingInProgress:O,scrollTo:u,scrollTop:e,skipAnimationFrameInResizeObserver:m,smoothScrollTargetReached:i,statefulScrollTop:r,viewportHeight:s}},[],{singleton:!0}),Zf={lvl:0};function NV(t,e){const n=t.length;if(n===0)return[];let{index:i,value:r}=e(t[0]);const s=[];for(let o=1;o<n;o++){const{index:a,value:l}=e(t[o]);s.push({end:a-1,start:i,value:r}),i=a,r=l}return s.push({end:1/0,start:i,value:r}),s}function li(t){return t===Zf}function Gf(t,e){if(!li(t))return e===t.k?t.v:e<t.k?Gf(t.l,e):Gf(t.r,e)}function na(t,e,n="k"){if(li(t))return[-1/0,void 0];if(Number(t[n])===e)return[t.k,t.v];if(Number(t[n])<e){const i=na(t.r,e,n);return i[0]===-1/0?[t.k,t.v]:i}return na(t.l,e,n)}function so(t,e,n){return li(t)?VV(e,n,1):e===t.k?hr(t,{k:e,v:n}):e<t.k?E3(hr(t,{l:so(t.l,e,n)})):E3(hr(t,{r:so(t.r,e,n)}))}function Tu(){return Zf}function ku(t,e,n){if(li(t))return[];const i=na(t,e)[0];return PNe(Dx(t,i,n))}function Yx(t,e){if(li(t))return Zf;const{k:n,l:i,r}=t;if(e===n){if(li(i))return r;if(li(r))return i;const[s,o]=LV(i);return Fg(hr(t,{k:s,l:WV(i),v:o}))}return e<n?Fg(hr(t,{l:Yx(i,e)})):Fg(hr(t,{r:Yx(r,e)}))}function Jc(t){return li(t)?[]:[...Jc(t.l),{k:t.k,v:t.v},...Jc(t.r)]}function Dx(t,e,n){if(li(t))return[];const{k:i,l:r,r:s,v:o}=t;let a=[];return i>e&&(a=a.concat(Dx(r,e,n))),i>=e&&i<=n&&a.push({k:i,v:o}),i<=n&&(a=a.concat(Dx(s,e,n))),a}function Fg(t){const{l:e,lvl:n,r:i}=t;if(i.lvl>=n-1&&e.lvl>=n-1)return t;if(n>i.lvl+1){if(D1(e))return BV(hr(t,{lvl:n-1}));if(!li(e)&&!li(e.r))return hr(e.r,{l:hr(e,{r:e.r.l}),lvl:n,r:hr(t,{l:e.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(D1(t))return Ux(hr(t,{lvl:n-1}));if(!li(i)&&!li(i.l)){const r=i.l,s=D1(r)?i.lvl-1:i.lvl;return hr(r,{l:hr(t,{lvl:n-1,r:r.l}),lvl:r.lvl+1,r:Ux(hr(i,{l:r.r,lvl:s}))})}throw new Error("Unexpected empty nodes")}function hr(t,e){return VV(e.k!==void 0?e.k:t.k,e.v!==void 0?e.v:t.v,e.lvl!==void 0?e.lvl:t.lvl,e.l!==void 0?e.l:t.l,e.r!==void 0?e.r:t.r)}function WV(t){return li(t.r)?t.l:Fg(hr(t,{r:WV(t.r)}))}function D1(t){return li(t)||t.lvl>t.r.lvl}function LV(t){return li(t.r)?[t.k,t.v]:LV(t.r)}function VV(t,e,n,i=Zf,r=Zf){return{k:t,l:i,lvl:n,r,v:e}}function E3(t){return Ux(BV(t))}function BV(t){const{l:e}=t;return!li(e)&&e.lvl===t.lvl?hr(e,{r:hr(t,{l:e.r})}):t}function Ux(t){const{lvl:e,r:n}=t;return!li(n)&&!li(n.r)&&n.lvl===e&&n.r.lvl===e?hr(n,{l:hr(t,{r:n.l}),lvl:e+1}):t}function PNe(t){return NV(t,({k:e,v:n})=>({index:e,value:n}))}function YV(t,e){return!!(t&&t.startIndex===e.startIndex&&t.endIndex===e.endIndex)}function Ff(t,e){return!!(t&&t[0]===e[0]&&t[1]===e[1])}const iT=Vn(()=>({recalcInProgress:ot(!1)}),[],{singleton:!0});function DV(t,e,n){return t[S0(t,e,n)]}function S0(t,e,n,i=0){let r=t.length-1;for(;i<=r;){const s=Math.floor((i+r)/2),o=t[s],a=n(o,e);if(a===0)return s;if(a===-1){if(r-i<2)return s-1;r=s-1}else{if(r===i)return s;i=s+1}}throw new Error(`Failed binary finding record in array - ${t.join(",")}, searched for ${e}`)}function CNe(t,e,n,i){const r=S0(t,e,i),s=S0(t,n,i,r);return t.slice(r,s+1)}function bc(t,e){return Math.round(t.getBoundingClientRect()[e])}function B$(t){return!li(t.groupOffsetTree)}function rT({index:t},e){return e===t?0:e<t?-1:1}function TNe(){return{groupIndices:[],groupOffsetTree:Tu(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Tu()}}function kNe(t,e){let n=li(t)?0:1/0;for(const i of e){const{endIndex:r,size:s,startIndex:o}=i;if(n=Math.min(n,o),li(t)){t=so(t,0,s);continue}const a=ku(t,o-1,r+1);if(a.some(MNe(i)))continue;let l=!1,c=!1;for(const{end:d,start:u,value:h}of a)l?(r>=u||s===h)&&(t=Yx(t,u)):(c=h!==s,l=!0),d>r&&r>=u&&h!==s&&(t=so(t,r+1,h));c&&(t=so(t,o,s))}return[t,n]}function RNe(t){return typeof t.groupIndex<"u"}function ENe({offset:t},e){return e===t?0:e<t?-1:1}function Hf(t,e,n){if(e.length===0)return 0;const{index:i,offset:r,size:s}=DV(e,t,rT),o=t-i,a=s*o+(o-1)*n+r;return a>0?a+n:a}function UV(t,e){if(!B$(e))return t;let n=0;for(;e.groupIndices[n]<=t+n;)n++;return t+n}function qV(t,e,n){if(RNe(t))return e.groupIndices[t.groupIndex]+1;const i=t.index==="LAST"?n:t.index;let r=UV(i,e);return r=Math.max(0,r,Math.min(n,r)),r}function XNe(t,e,n,i=0){return i>0&&(e=Math.max(e,DV(t,i,rT).offset)),NV(CNe(t,e,n,ENe),ANe)}function zNe(t,[e,n,i,r]){e.length>0&&i("received item sizes",e,fr.DEBUG);const s=t.sizeTree;let o=s,a=0;if(n.length>0&&li(s)&&e.length===2){const h=e[0].size,O=e[1].size;o=n.reduce((p,m)=>so(so(p,m,h),m+1,O),o)}else[o,a]=kNe(o,e);if(o===s)return t;const{lastIndex:l,lastOffset:c,lastSize:d,offsetTree:u}=qx(t.offsetTree,a,o,r);return{groupIndices:n,groupOffsetTree:n.reduce((h,O)=>so(h,O,Hf(O,u,r)),Tu()),lastIndex:l,lastOffset:c,lastSize:d,offsetTree:u,sizeTree:o}}function INe(t){return Jc(t).map(({k:e,v:n},i,r)=>{const s=r[i+1];return{endIndex:s!==void 0?s.k-1:1/0,size:n,startIndex:e}})}function X3(t,e){let n=0,i=0;for(;n<t;)n+=e[i+1]-e[i]-1,i++;return i-(n===t?0:1)}function qx(t,e,n,i){let r=t,s=0,o=0,a=0,l=0;if(e!==0){l=S0(r,e-1,rT),a=r[l].offset;const c=na(n,e-1);s=c[0],o=c[1],r.length&&r[l].size===na(n,e)[1]&&(l-=1),r=r.slice(0,l+1)}else r=[];for(const{start:c,value:d}of ku(n,e,1/0)){const u=c-s,h=u*o+a+u*i;r.push({index:c,offset:h,size:d}),s=c,a=h,o=d}return{lastIndex:s,lastOffset:a,lastSize:o,offsetTree:r}}function ANe(t){return{index:t.index,value:t}}function MNe(t){const{endIndex:e,size:n,startIndex:i}=t;return r=>r.start===i&&(r.end===e||r.end===1/0)&&r.value===n}const jNe={offsetHeight:"height",offsetWidth:"width"},Ja=Vn(([{log:t},{recalcInProgress:e}])=>{const n=Xn(),i=Xn(),r=es(i,0),s=Xn(),o=Xn(),a=ot(0),l=ot([]),c=ot(void 0),d=ot(void 0),u=ot(void 0),h=ot(void 0),O=ot((_,P)=>bc(_,jNe[P])),p=ot(void 0),m=ot(0),g=TNe(),v=es(He(n,pn(l,t,m),za(zNe,g),bi()),g),$=es(He(l,bi(),za((_,P)=>({current:P,prev:_.current}),{current:[],prev:[]}),Xt(({prev:_})=>_)),[]);Lt(He(l,Kt(_=>_.length>0),pn(v,m),Xt(([_,P,C])=>{const X=_.reduce((z,T,k)=>so(z,T,Hf(T,P.offsetTree,C)||k),Tu());return{...P,groupIndices:_,groupOffsetTree:X}})),v),Lt(He(i,pn(v),Kt(([_,{lastIndex:P}])=>_<P),Xt(([_,{lastIndex:P,lastSize:C}])=>[{endIndex:P,size:C,startIndex:_}])),n),Lt(c,d);const b=es(He(c,Xt(_=>_===void 0)),!0);Lt(He(d,Kt(_=>_!==void 0&&li(Ci(v).sizeTree)),Xt(_=>{const P=Ci(u),C=Ci(l).length>0;return P!==void 0&&P!==0?C?[{endIndex:0,size:P,startIndex:0},{endIndex:1,size:_,startIndex:1}]:[]:[{endIndex:0,size:_,startIndex:0}]})),n),Lt(He(h,Kt(_=>_!==void 0&&_.length>0&&li(Ci(v).sizeTree)),Xt(_=>{const P=[];let C=_[0],X=0;for(let z=1;z<_.length;z++){const T=_[z];T!==C&&(P.push({endIndex:z-1,size:C,startIndex:X}),C=T,X=z)}return P.push({endIndex:_.length-1,size:C,startIndex:X}),P})),n),Lt(He(l,pn(u,d),Kt(([,_,P])=>_!==void 0&&P!==void 0),Xt(([_,P,C])=>{const X=[];for(let z=0;z<_.length;z++){const T=_[z],k=_[z+1];X.push({startIndex:T,endIndex:T,size:P}),k!==void 0&&X.push({startIndex:T+1,endIndex:k-1,size:C})}return X})),n);const S=lo(He(n,pn(v),za(({sizes:_},[P,C])=>({changed:C!==_,sizes:C}),{changed:!1,sizes:g}),Xt(_=>_.changed)));Zn(He(a,za((_,P)=>({diff:_.prev-P,prev:P}),{diff:0,prev:0}),Xt(_=>_.diff)),_=>{const{groupIndices:P}=Ci(v);if(_>0)On(e,!0),On(s,_+X3(_,P));else if(_<0){const C=Ci($);C.length>0&&(_-=X3(-_,C)),On(o,_)}}),Zn(He(a,pn(t)),([_,P])=>{_<0&&P("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:a},fr.ERROR)});const y=lo(s);Lt(He(s,pn(v),Xt(([_,P])=>{const C=P.groupIndices.length>0,X=[],z=P.lastSize;if(C){const T=Gf(P.sizeTree,0);let k=0,x=0;for(;k<_;){const E=P.groupIndices[x],I=P.groupIndices.length===x+1?1/0:P.groupIndices[x+1]-E-1;X.push({endIndex:E,size:T,startIndex:E}),X.push({endIndex:E+1+I-1,size:z,startIndex:E+1}),x++,k+=I+1}const R=Jc(P.sizeTree);return k!==_&&R.shift(),R.reduce((E,{k:I,v:A})=>{let j=E.ranges;return E.prevSize!==0&&(j=[...E.ranges,{endIndex:I+_-1,size:E.prevSize,startIndex:E.prevIndex}]),{prevIndex:I+_,prevSize:A,ranges:j}},{prevIndex:_,prevSize:0,ranges:X}).ranges}return Jc(P.sizeTree).reduce((T,{k,v:x})=>({prevIndex:k+_,prevSize:x,ranges:[...T.ranges,{endIndex:k+_-1,size:T.prevSize,startIndex:T.prevIndex}]}),{prevIndex:0,prevSize:z,ranges:[]}).ranges})),n);const Q=lo(He(o,pn(v,m),Xt(([_,{offsetTree:P},C])=>{const X=-_;return Hf(X,P,C)})));return Lt(He(o,pn(v,m),Xt(([_,P,C])=>{if(P.groupIndices.length>0){if(li(P.sizeTree))return P;let z=Tu();const T=Ci($);let k=0,x=0,R=0;for(;k<-_;){R=T[x];const E=T[x+1]-R-1;x++,k+=E+1}if(z=Jc(P.sizeTree).reduce((E,{k:I,v:A})=>so(E,Math.max(0,I+_),A),z),k!==-_){const E=Gf(P.sizeTree,R);z=so(z,0,E);const I=na(P.sizeTree,-_+1)[1];z=so(z,1,I)}return{...P,sizeTree:z,...qx(P.offsetTree,0,z,C)}}const X=Jc(P.sizeTree).reduce((z,{k:T,v:k})=>so(z,Math.max(0,T+_),k),Tu());return{...P,sizeTree:X,...qx(P.offsetTree,0,X,C)}})),v),{beforeUnshiftWith:y,data:p,defaultItemSize:d,firstItemIndex:a,fixedItemSize:c,fixedGroupSize:u,gap:m,groupIndices:l,heightEstimates:h,itemSize:O,listRefresh:S,shiftWith:o,shiftWithOffset:Q,sizeRanges:n,sizes:v,statefulTotalCount:r,totalCount:i,trackItemSizes:b,unshiftWith:s}},_i(_c,iT),{singleton:!0});function NNe(t){return t.reduce((e,n)=>(e.groupIndices.push(e.totalCount),e.totalCount+=n+1,e),{groupIndices:[],totalCount:0})}const ZV=Vn(([{groupIndices:t,sizes:e,totalCount:n},{headerHeight:i,scrollTop:r}])=>{const s=Xn(),o=Xn(),a=lo(He(s,Xt(NNe)));return Lt(He(a,Xt(l=>l.totalCount)),n),Lt(He(a,Xt(l=>l.groupIndices)),t),Lt(He(nr(r,e,i),Kt(([l,c])=>B$(c)),Xt(([l,c,d])=>na(c.groupOffsetTree,Math.max(l-d,0),"v")[0]),bi(),Xt(l=>[l])),o),{groupCounts:s,topItemsIndexes:o}},_i(Ja,zs)),Qc=Vn(([{log:t}])=>{const e=ot(!1),n=lo(He(e,Kt(i=>i),bi()));return Zn(e,i=>{i&&Ci(t)("props updated",{},fr.DEBUG)}),{didMount:n,propsReady:e}},_i(_c),{singleton:!0}),WNe=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function GV(t){const e=typeof t=="number"?{index:t}:t;return e.align||(e.align="start"),(!e.behavior||!WNe)&&(e.behavior="auto"),e.offset===void 0&&(e.offset=0),e}const zp=Vn(([{gap:t,listRefresh:e,sizes:n,totalCount:i},{fixedFooterHeight:r,fixedHeaderHeight:s,footerHeight:o,headerHeight:a,scrollingInProgress:l,scrollTo:c,smoothScrollTargetReached:d,viewportHeight:u},{log:h}])=>{const O=Xn(),p=Xn(),m=ot(0);let g=null,v=null,$=null;function b(){g!==null&&(g(),g=null),$!==null&&($(),$=null),v&&(clearTimeout(v),v=null),On(l,!1)}return Lt(He(O,pn(n,u,i,m,a,o,h),pn(t,s,r),Xt(([[S,y,Q,_,P,C,X,z],T,k,x])=>{const R=GV(S),{align:E,behavior:I,offset:A}=R,j=_-1,N=qV(R,y,j);let L=Hf(N,y.offsetTree,T)+C;E==="end"?(L+=k+na(y.sizeTree,N)[1]-Q+x,N===j&&(L+=X)):E==="center"?L+=(k+na(y.sizeTree,N)[1]-Q+x)/2:L-=P,A!==void 0&&A!==0&&(L+=A);const B=V=>{b(),V?(z("retrying to scroll to",{location:S},fr.DEBUG),On(O,S)):(On(p,!0),z("list did not change, scroll successful",{},fr.DEBUG))};if(b(),I==="smooth"){let V=!1;$=Zn(e,Y=>{V=V||Y}),g=Zo(d,()=>{B(V)})}else g=Zo(He(e,LNe(150)),B);return v=setTimeout(()=>{b()},1200),On(l,!0),z("scrolling from index to",{behavior:I,index:N,top:L},fr.DEBUG),{behavior:I,top:L}})),c),{scrollTargetReached:p,scrollToIndex:O,topListHeight:m}},_i(Ja,zs,_c),{singleton:!0});function LNe(t){return e=>{const n=setTimeout(()=>{e(!1)},t);return i=>{i&&(e(!0),clearTimeout(n))}}}function sT(t,e){t===0?e():requestAnimationFrame(()=>{sT(t-1,e)})}function oT(t,e){const n=e-1;return typeof t=="number"?t:t.index==="LAST"?n:t.index}const Ip=Vn(([{defaultItemSize:t,listRefresh:e,sizes:n},{scrollTop:i},{scrollTargetReached:r,scrollToIndex:s},{didMount:o}])=>{const a=ot(!0),l=ot(0),c=ot(!0);return Lt(He(o,pn(l),Kt(([d,u])=>u!==0),Qa(!1)),a),Lt(He(o,pn(l),Kt(([d,u])=>u!==0),Qa(!1)),c),Zn(He(nr(e,o),pn(a,n,t,c),Kt(([[,d],u,{sizeTree:h},O,p])=>d&&(!li(h)||eT(O))&&!u&&!p),pn(l)),([,d])=>{Zo(r,()=>{On(c,!0)}),sT(4,()=>{Zo(i,()=>{On(a,!0)}),On(s,d)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:l,scrolledToInitialItem:a}},_i(Ja,zs,zp,Qc),{singleton:!0});function FV(t,e){return Math.abs(t-e)<1.01}const Kf="up",HO="down",VNe="none",BNe={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},YNe=0,Ap=Vn(([{footerHeight:t,headerHeight:e,scrollBy:n,scrollContainerState:i,scrollTop:r,viewportHeight:s}])=>{const o=ot(!1),a=ot(!0),l=Xn(),c=Xn(),d=ot(4),u=ot(YNe),h=es(He(Bx(He(Ht(r),md(1),Qa(!0)),He(Ht(r),md(1),Qa(!1),k3(100))),bi()),!1),O=es(He(Bx(He(n,Qa(!0)),He(n,Qa(!1),k3(200))),bi()),!1);Lt(He(nr(Ht(r),Ht(u)),Xt(([$,b])=>$<=b),bi()),a),Lt(He(a,gl(50)),c);const p=lo(He(nr(i,Ht(s),Ht(e),Ht(t),Ht(d)),za(($,[{scrollHeight:b,scrollTop:S},y,Q,_,P])=>{const C=S+y-b>-P,X={scrollHeight:b,scrollTop:S,viewportHeight:y};if(C){let T,k;return S>$.state.scrollTop?(T="SCROLLED_DOWN",k=$.state.scrollTop-S):(T="SIZE_DECREASED",k=$.state.scrollTop-S||$.scrollTopDelta),{atBottom:!0,atBottomBecause:T,scrollTopDelta:k,state:X}}let z;return X.scrollHeight>$.state.scrollHeight?z="SIZE_INCREASED":y<$.state.viewportHeight?z="VIEWPORT_HEIGHT_DECREASING":S<$.state.scrollTop?z="SCROLLING_UPWARDS":z="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:z,state:X}},BNe),bi(($,b)=>$!==void 0&&$.atBottom===b.atBottom))),m=es(He(i,za(($,{scrollHeight:b,scrollTop:S,viewportHeight:y})=>{if(!FV($.scrollHeight,b)){const Q=b-(S+y)<1;return $.scrollTop!==S&&Q?{changed:!0,jump:$.scrollTop-S,scrollHeight:b,scrollTop:S}:{changed:!0,jump:0,scrollHeight:b,scrollTop:S}}return{changed:!1,jump:0,scrollHeight:b,scrollTop:S}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Kt($=>$.changed),Xt($=>$.jump)),0);Lt(He(p,Xt($=>$.atBottom)),o),Lt(He(o,gl(50)),l);const g=ot(HO);Lt(He(i,Xt(({scrollTop:$})=>$),bi(),za(($,b)=>Ci(O)?{direction:$.direction,prevScrollTop:b}:{direction:b<$.prevScrollTop?Kf:HO,prevScrollTop:b},{direction:HO,prevScrollTop:0}),Xt($=>$.direction)),g),Lt(He(i,gl(50),Qa(VNe)),g);const v=ot(0);return Lt(He(h,Kt($=>!$),Qa(0)),v),Lt(He(r,gl(100),pn(h),Kt(([$,b])=>b),za(([$,b],[S])=>[b,S],[0,0]),Xt(([$,b])=>b-$)),v),{atBottomState:p,atBottomStateChange:l,atBottomThreshold:d,atTopStateChange:c,atTopThreshold:u,isAtBottom:o,isAtTop:a,isScrolling:h,lastJumpDueToItemResize:m,scrollDirection:g,scrollVelocity:v}},_i(zs)),Jf="top",ep="bottom",z3="none";function I3(t,e,n){return typeof t=="number"?n===Kf&&e===Jf||n===HO&&e===ep?t:0:n===Kf?e===Jf?t.main:t.reverse:e===ep?t.main:t.reverse}function A3(t,e){return typeof t=="number"?t:t[e]??0}const aT=Vn(([{deviation:t,fixedHeaderHeight:e,headerHeight:n,scrollTop:i,viewportHeight:r}])=>{const s=Xn(),o=ot(0),a=ot(0),l=ot(0),c=es(He(nr(Ht(i),Ht(r),Ht(n),Ht(s,Ff),Ht(l),Ht(o),Ht(e),Ht(t),Ht(a)),Xt(([d,u,h,[O,p],m,g,v,$,b])=>{const S=d-$,y=g+v,Q=Math.max(h-S,0);let _=z3;const P=A3(b,Jf),C=A3(b,ep);return O-=$,O+=h+v,p+=h+v,p-=$,O>d+y-P&&(_=Kf),p<d-Q+u+C&&(_=HO),_!==z3?[Math.max(S-h-I3(m,Jf,_)-P,0),S-Q-v+u+I3(m,ep,_)+C]:null}),Kt(d=>d!==null),bi(Ff)),[0,0]);return{increaseViewportBy:a,listBoundary:s,overscan:l,topListHeight:o,visibleRange:c}},_i(zs),{singleton:!0});function DNe(t,e,n){if(B$(e)){const i=UV(t,e);return[{index:na(e.groupOffsetTree,i)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:i,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:t,offset:0,size:0}]}const U1={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Hg(t,e,n,i,r,s){const{lastIndex:o,lastOffset:a,lastSize:l}=r;let c=0,d=0;if(t.length>0){c=t[0].offset;const m=t[t.length-1];d=m.offset+m.size}const u=n-o,h=a+u*l+(u-1)*i,O=c,p=h-d;return{bottom:d,firstItemIndex:s,items:M3(t,r,s),offsetBottom:p,offsetTop:c,top:O,topItems:M3(e,r,s),topListHeight:e.reduce((m,g)=>g.size+m,0),totalCount:n}}function HV(t,e,n,i,r,s){let o=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-o>=t)break;o++}const a=t+o,l=oT(e,a),c=Array.from({length:a}).map((d,u)=>({data:s[u+l],index:u+l,offset:0,size:0}));return Hg(c,[],a,r,n,i)}function M3(t,e,n){if(t.length===0)return[];if(!B$(e))return t.map(c=>({...c,index:c.index+n,originalIndex:c.index}));const i=t[0].index,r=t[t.length-1].index,s=[],o=ku(e.groupOffsetTree,i,r);let a,l=0;for(const c of t){(!a||a.end<c.index)&&(a=o.shift(),l=e.groupIndices.indexOf(a.start));let d;c.index===a.start?d={index:l,type:"group"}:d={groupIndex:l,index:c.index-(l+1)+n},s.push({...d,data:c.data,offset:c.offset,originalIndex:c.index,size:c.size})}return s}function j3(t,e){return t===void 0?0:typeof t=="number"?t:t[e]??0}const Pd=Vn(([{data:t,firstItemIndex:e,gap:n,sizes:i,totalCount:r},s,{listBoundary:o,topListHeight:a,visibleRange:l},{initialTopMostItemIndex:c,scrolledToInitialItem:d},{topListHeight:u},h,{didMount:O},{recalcInProgress:p}])=>{const m=ot([]),g=ot(0),v=Xn(),$=ot(0);Lt(s.topItemsIndexes,m);const b=es(He(nr(O,p,Ht(l,Ff),Ht(r),Ht(i),Ht(c),d,Ht(m),Ht(e),Ht(n),Ht($),t),Kt(([_,P,,C,,,,,,,,X])=>{const z=X!==void 0&&X.length!==C;return _&&!P&&!z}),Xt(([,,[_,P],C,X,z,T,k,x,R,E,I])=>{var ee,fe;const A=X,{offsetTree:j,sizeTree:N}=A,L=Ci(g);if(C===0)return{...U1,totalCount:C};if(_===0&&P===0)return L===0?{...U1,totalCount:C}:HV(L,z,X,x,R,I||[]);if(li(N))return L>0?null:Hg(DNe(oT(z,C),A,I),[],C,R,A,x);const B=[];if(k.length>0){const se=k[0],te=k[k.length-1];let oe=0;for(const G of ku(N,se,te)){const H=G.value,K=Math.max(G.start,se),ae=Math.min(G.end,te);for(let de=K;de<=ae;de++)B.push({data:I==null?void 0:I[de],index:de,offset:oe,size:H}),oe+=H}}if(!T)return Hg([],B,C,R,A,x);const V=k.length>0?k[k.length-1]+1:0,Y=XNe(j,_,P,V);if(Y.length===0)return null;const W=C-1,q=V$([],se=>{for(const te of Y){const oe=te.value;let G=oe.offset,H=te.start;const K=oe.size;if(oe.offset<_){H+=Math.floor((_-oe.offset+R)/(K+R));const de=H-te.start;G+=de*K+de*R}H<V&&(G+=(V-H)*K,H=V);const ae=Math.min(te.end,W);for(let de=H;de<=ae&&!(G>=P);de++)se.push({data:I==null?void 0:I[de],index:de,offset:G,size:K}),G+=K+R}}),ne=j3(E,Jf),D=j3(E,ep);if(q.length>0&&(ne>0||D>0)){const se=q[0],te=q[q.length-1];if(ne>0&&se.index>V){const oe=Math.min(ne,se.index-V),G=[];let H=se.offset;for(let K=se.index-1;K>=se.index-oe;K--){const ae=((ee=ku(N,K,K)[0])==null?void 0:ee.value)??se.size;H-=ae+R,G.unshift({data:I==null?void 0:I[K],index:K,offset:H,size:ae})}q.unshift(...G)}if(D>0&&te.index<W){const oe=Math.min(D,W-te.index);let G=te.offset+te.size+R;for(let H=te.index+1;H<=te.index+oe;H++){const K=((fe=ku(N,H,H)[0])==null?void 0:fe.value)??te.size;q.push({data:I==null?void 0:I[H],index:H,offset:G,size:K}),G+=K+R}}}return Hg(q,B,C,R,A,x)}),Kt(_=>_!==null),bi()),U1);Lt(He(t,Kt(eT),Xt(_=>_==null?void 0:_.length)),r),Lt(He(b,Xt(_=>_.topListHeight)),u),Lt(u,a),Lt(He(b,Xt(_=>[_.top,_.bottom])),o),Lt(He(b,Xt(_=>_.items)),v);const S=lo(He(b,Kt(({items:_})=>_.length>0),pn(r,t),Kt(([{items:_},P])=>_[_.length-1].originalIndex===P-1),Xt(([,_,P])=>[_-1,P]),bi(Ff),Xt(([_])=>_))),y=lo(He(b,gl(200),Kt(({items:_,topItems:P})=>_.length>0&&_[0].originalIndex===P.length),Xt(({items:_})=>_[0].index),bi())),Q=lo(He(b,Kt(({items:_})=>_.length>0),Xt(({items:_})=>{let P=0,C=_.length-1;for(;_[P].type==="group"&&P<C;)P++;for(;_[C].type==="group"&&C>P;)C--;return{endIndex:_[C].index,startIndex:_[P].index}}),bi(YV)));return{endReached:S,initialItemCount:g,itemsRendered:v,listState:b,minOverscanItemCount:$,rangeChanged:Q,startReached:y,topItemsIndexes:m,...h}},_i(Ja,ZV,aT,Ip,zp,Ap,Qc,iT),{singleton:!0}),KV=Vn(([{fixedFooterHeight:t,fixedHeaderHeight:e,footerHeight:n,headerHeight:i},{listState:r}])=>{const s=Xn(),o=es(He(nr(n,t,i,e,r),Xt(([a,l,c,d,u])=>a+l+c+d+u.offsetBottom+u.bottom)),0);return Lt(Ht(o),s),{totalListHeight:o,totalListHeightChanged:s}},_i(zs,Pd),{singleton:!0}),UNe=Vn(([{viewportHeight:t},{totalListHeight:e}])=>{const n=ot(!1),i=es(He(nr(n,t,e),Kt(([r])=>r),Xt(([,r,s])=>Math.max(0,r-s)),gl(0),bi()),0);return{alignToBottom:n,paddingTopAddition:i}},_i(zs,KV),{singleton:!0}),JV=Vn(()=>({context:ot(null)})),qNe=({itemBottom:t,itemTop:e,locationParams:{align:n,behavior:i,...r},viewportBottom:s,viewportTop:o})=>e<o?{...r,align:n??"start",...i!==void 0?{behavior:i}:{}}:t>s?{...r,align:n??"end",...i!==void 0?{behavior:i}:{}}:null,eB=Vn(([{gap:t,sizes:e,totalCount:n},{fixedFooterHeight:i,fixedHeaderHeight:r,headerHeight:s,scrollingInProgress:o,scrollTop:a,viewportHeight:l},{scrollToIndex:c}])=>{const d=Xn();return Lt(He(d,pn(e,l,n,s,r,i,a),pn(t),Xt(([[u,h,O,p,m,g,v,$],b])=>{const{calculateViewLocation:S=qNe,done:y,...Q}=u,_=qV(u,h,p-1),P=Hf(_,h.offsetTree,b)+m+g,C=P+na(h.sizeTree,_)[1],X=$+g,z=$+O-v,T=S({itemBottom:C,itemTop:P,locationParams:Q,viewportBottom:z,viewportTop:X});return T!==null?y&&Zo(He(o,Kt(k=>!k),md(Ci(o)?1:2)),y):y==null||y(),T}),Kt(u=>u!==null)),c),{scrollIntoView:d}},_i(Ja,zs,zp,Pd,_c),{singleton:!0});function N3(t){return t===!1?!1:t==="smooth"?"smooth":"auto"}const ZNe=(t,e)=>typeof t=="function"?N3(t(e)):e&&N3(t),GNe=Vn(([{listRefresh:t,totalCount:e,fixedItemSize:n,data:i},{atBottomState:r,isAtBottom:s},{scrollToIndex:o},{scrolledToInitialItem:a},{didMount:l,propsReady:c},{log:d},{scrollingInProgress:u},{context:h},{scrollIntoView:O}])=>{const p=ot(!1),m=Xn();let g=null;function v(y){On(o,{align:"end",behavior:y,index:"LAST"})}Zn(He(nr(He(Ht(e),md(1)),l),pn(Ht(p),s,a,u),Xt(([[y,Q],_,P,C,X])=>{let z=Q&&C,T="auto";return z&&(T=ZNe(_,P||X),z=z&&T!==!1),{followOutputBehavior:T,shouldFollow:z,totalCount:y}}),Kt(({shouldFollow:y})=>y)),({followOutputBehavior:y,totalCount:Q})=>{g!==null&&(g(),g=null),Ci(n)!==void 0?requestAnimationFrame(()=>{Ci(d)("following output to ",{totalCount:Q},fr.DEBUG),v(y)}):g=Zo(t,()=>{Ci(d)("following output to ",{totalCount:Q},fr.DEBUG),v(y),g=null})});function $(y){const Q=Zo(r,_=>{y&&!_.atBottom&&_.notAtBottomBecause==="SIZE_INCREASED"&&g===null&&(Ci(d)("scrolling to bottom due to increased size",{},fr.DEBUG),v("auto"))});setTimeout(Q,100)}Zn(He(nr(Ht(p),e,c),Kt(([y,,Q])=>y!==!1&&Q),za(({value:y},[,Q])=>({refreshed:y===Q,value:Q}),{refreshed:!1,value:0}),Kt(({refreshed:y})=>y),pn(p,e)),([,y])=>{Ci(a)&&$(y!==!1)}),Zn(m,()=>{$(Ci(p)!==!1)}),Zn(nr(Ht(p),r),([y,Q])=>{y!==!1&&!Q.atBottom&&Q.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&v("auto")});const b=ot(null),S=Xn();return Lt(Bx(He(Ht(i),Xt(y=>(y==null?void 0:y.length)??0)),He(Ht(e))),S),Zn(He(nr(He(S,md(1)),l),pn(Ht(b),a,u,h),Xt(([[y,Q],_,P,C,X])=>Q&&P&&(_==null?void 0:_({context:X,totalCount:y,scrollingInProgress:C}))),Kt(y=>!!y),gl(0)),y=>{g!==null&&(g(),g=null),Ci(n)!==void 0?requestAnimationFrame(()=>{Ci(d)("scrolling into view",{}),On(O,y)}):g=Zo(t,()=>{Ci(d)("scrolling into view",{}),On(O,y),g=null})}),{autoscrollToBottom:m,followOutput:p,scrollIntoViewOnChange:b}},_i(Ja,Ap,zp,Ip,Qc,_c,zs,JV,eB)),FNe=Vn(([{data:t,firstItemIndex:e,gap:n,sizes:i},{initialTopMostItemIndex:r},{initialItemCount:s,listState:o},{didMount:a}])=>(Lt(He(a,pn(s),Kt(([,l])=>l!==0),pn(r,i,e,n,t),Xt(([[,l],c,d,u,h,O=[]])=>HV(l,c,d,u,h,O))),o),{}),_i(Ja,Ip,Pd,Qc),{singleton:!0}),HNe=Vn(([{didMount:t},{scrollTo:e},{listState:n}])=>{const i=ot(0);return Zn(He(t,pn(i),Kt(([,r])=>r!==0),Xt(([,r])=>({top:r}))),r=>{Zo(He(n,md(1),Kt(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{On(e,r)})})}),{initialScrollTop:i}},_i(Qc,zs,Pd),{singleton:!0}),tB=Vn(([{scrollVelocity:t}])=>{const e=ot(!1),n=Xn(),i=ot(!1);return Lt(He(t,pn(i,e,n),Kt(([r,s])=>s!==!1&&s!==void 0),Xt(([r,s,o,a])=>{const{enter:l,exit:c}=s;if(o){if(c(r,a))return!1}else if(l(r,a))return!0;return o}),bi()),e),Zn(He(nr(e,t,n),pn(i)),([[r,s,o],a])=>{r&&a!==!1&&a!==void 0&&a.change&&a.change(s,o)}),{isSeeking:e,scrollSeekConfiguration:i,scrollSeekRangeChanged:n,scrollVelocity:t}},_i(Ap),{singleton:!0}),lT=Vn(([{scrollContainerState:t,scrollTo:e}])=>{const n=Xn(),i=Xn(),r=Xn(),s=ot(!1),o=ot(void 0);return Lt(He(nr(n,i),Xt(([{scrollHeight:a,scrollTop:l,viewportHeight:c},{offsetTop:d}])=>({scrollHeight:a,scrollTop:Math.max(0,l-d),viewportHeight:c}))),t),Lt(He(e,pn(i),Xt(([a,{offsetTop:l}])=>({...a,top:a.top+l}))),r),{customScrollParent:o,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:r,windowViewportRect:i}},_i(zs)),KNe=Vn(([{sizeRanges:t,sizes:e},{headerHeight:n,scrollTop:i},{initialTopMostItemIndex:r},{didMount:s},{useWindowScroll:o,windowScrollContainerState:a,windowViewportRect:l}])=>{const c=Xn(),d=ot(void 0),u=ot(null),h=ot(null);return Lt(a,u),Lt(l,h),Zn(He(c,pn(e,i,o,u,h,n)),([O,p,m,g,v,$,b])=>{const S=INe(p.sizeTree);g&&v!==null&&$!==null&&(m=v.scrollTop-$.offsetTop),m-=b,O({ranges:S,scrollTop:m})}),Lt(He(d,Kt(eT),Xt(JNe)),r),Lt(He(s,pn(d),Kt(([,O])=>O!==void 0),bi(),Xt(([,O])=>O.ranges)),t),{getState:c,restoreStateFrom:d}},_i(Ja,zs,Ip,Qc,lT));function JNe(t){return{align:"start",index:0,offset:t.scrollTop}}const eWe=Vn(([{topItemsIndexes:t}])=>{const e=ot(0);return Lt(He(e,Kt(n=>n>=0),Xt(n=>Array.from({length:n}).map((i,r)=>r))),t),{topItemCount:e}},_i(Pd));function nB(t){let e=!1,n;return(()=>(e||(e=!0,n=t()),n))}const tWe=nB(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),nWe=Vn(([{deviation:t,scrollBy:e,scrollingInProgress:n,scrollTop:i},{isAtBottom:r,isScrolling:s,lastJumpDueToItemResize:o,scrollDirection:a},{listState:l},{beforeUnshiftWith:c,gap:d,shiftWithOffset:u,sizes:h},{log:O},{recalcInProgress:p}])=>{const m=lo(He(l,pn(o),za(([,v,$,b],[{bottom:S,items:y,offsetBottom:Q,totalCount:_},P])=>{const C=S+Q;let X=0;return $===_&&v.length>0&&y.length>0&&(y[0].originalIndex===0&&v[0].originalIndex===0||(X=C-b,X!==0&&(X+=P))),[X,y,_,C]},[0,[],0,0]),Kt(([v])=>v!==0),pn(i,a,n,r,O,p),Kt(([,v,$,b,,,S])=>!S&&!b&&v!==0&&$===Kf),Xt(([[v],,,,,$])=>($("Upward scrolling compensation",{amount:v},fr.DEBUG),v))));function g(v){v>0?(On(e,{behavior:"auto",top:-v}),On(t,0)):(On(t,0),On(e,{behavior:"auto",top:-v}))}return Zn(He(m,pn(t,s)),([v,$,b])=>{b&&tWe()?On(t,$-v):g(-v)}),Zn(He(nr(es(s,!1),t,p),Kt(([v,$,b])=>!v&&!b&&$!==0),Xt(([v,$])=>$),gl(1)),g),Lt(He(u,Xt(v=>({top:-v}))),e),Zn(He(c,pn(h,d),Xt(([v,{groupIndices:$,lastSize:b,sizeTree:S},y])=>{function Q(z){return z*(b+y)}if($.length===0)return Q(v);let _=0;const P=Gf(S,0);let C=0,X=0;for(;C<v;){C++,_+=P;let z=$.length===X+1?1/0:$[X+1]-$[X]-1;C+z>v&&(_-=P,z=v-C+1),C+=z,_+=Q(z),X++}return _})),v=>{On(t,v),requestAnimationFrame(()=>{On(e,{top:v}),requestAnimationFrame(()=>{On(t,0),On(p,!1)})})}),{deviation:t}},_i(zs,Ap,Pd,Ja,_c,iT)),iWe=Vn(([t,e,n,i,r,s,o,a,l,c,d])=>({...t,...e,...n,...i,...r,...s,...o,...a,...l,...c,...d}),_i(aT,FNe,Qc,tB,KV,HNe,UNe,lT,eB,_c,JV)),iB=Vn(([{data:t,defaultItemSize:e,firstItemIndex:n,fixedItemSize:i,fixedGroupSize:r,gap:s,groupIndices:o,heightEstimates:a,itemSize:l,sizeRanges:c,sizes:d,statefulTotalCount:u,totalCount:h,trackItemSizes:O},{initialItemFinalLocationReached:p,initialTopMostItemIndex:m,scrolledToInitialItem:g},v,$,b,S,{scrollToIndex:y},Q,{topItemCount:_},{groupCounts:P},C])=>{const{listState:X,minOverscanItemCount:z,topItemsIndexes:T,rangeChanged:k,...x}=S;return Lt(k,C.scrollSeekRangeChanged),Lt(He(C.windowViewportRect,Xt(R=>R.visibleHeight)),v.viewportHeight),{data:t,defaultItemHeight:e,firstItemIndex:n,fixedItemHeight:i,fixedGroupHeight:r,gap:s,groupCounts:P,heightEstimates:a,initialItemFinalLocationReached:p,initialTopMostItemIndex:m,scrolledToInitialItem:g,sizeRanges:c,topItemCount:_,topItemsIndexes:T,totalCount:h,...b,groupIndices:o,itemSize:l,listState:X,minOverscanItemCount:z,scrollToIndex:y,statefulTotalCount:u,trackItemSizes:O,rangeChanged:k,...x,...C,...v,sizes:d,...$}},_i(Ja,Ip,zs,KNe,GNe,Pd,zp,nWe,eWe,ZV,iWe));function rWe(t,e){const n={},i={};let r=0;const s=t.length;for(;r<s;)i[t[r]]=1,r+=1;for(const o in e)Object.hasOwn(i,o)||(n[o]=e[o]);return n}const ng=typeof document<"u"?Z.useLayoutEffect:Z.useEffect;function rB(t,e,n){const i=Object.keys(e.required||{}),r=Object.keys(e.optional||{}),s=Object.keys(e.methods||{}),o=Object.keys(e.events||{}),a=Z.createContext({});function l(g,v){g.propsReady!==void 0&&On(g.propsReady,!1);for(const $ of i){const b=g[e.required[$]];On(b,v[$])}for(const $ of r)if($ in v){const b=g[e.optional[$]];On(b,v[$])}g.propsReady!==void 0&&On(g.propsReady,!0)}function c(g){return s.reduce((v,$)=>(v[$]=b=>{const S=g[e.methods[$]];On(S,b)},v),{})}function d(g){return o.reduce((v,$)=>(v[$]=bNe(g[e.events[$]]),v),{})}const u=Z.forwardRef(function(g,v){const{children:$,...b}=g,[S]=Z.useState(()=>V$(yNe(t),_=>{l(_,b)})),[y]=Z.useState(T3(d,S));ng(()=>{for(const _ of o)_ in b&&Zn(y[_],b[_]);return()=>{Object.values(y).map(tT)}},[b,y,S]),ng(()=>{l(S,b)}),Z.useImperativeHandle(v,C3(c(S)));const Q=n;return w.jsx(a.Provider,{value:S,children:n!==void 0?w.jsx(Q,{...rWe([...i,...r,...o],b),children:$}):$})}),h=g=>{const v=Z.useContext(a);return Z.useCallback($=>{On(v[g],$)},[v,g])},O=g=>{const v=Z.useContext(a)[g],$=Z.useCallback(b=>Zn(v,b),[v]);return Z.useSyncExternalStore($,()=>Ci(v),()=>Ci(v))},p=g=>{const v=Z.useContext(a)[g],[$,b]=Z.useState(T3(Ci,v));return ng(()=>Zn(v,S=>{S!==$&&b(C3(S))}),[v,$]),$},m=Z.version.startsWith("18")?O:p;return{Component:u,useEmitter:(g,v)=>{const $=Z.useContext(a)[g];ng(()=>Zn($,v),[v,$])},useEmitterValue:m,usePublisher:h}}const sB=Z.createContext(void 0),oB=Z.createContext(void 0),q1="-webkit-sticky",W3="sticky",cT=nB(()=>{if(typeof document>"u")return W3;const t=document.createElement("div");return t.style.position=q1,t.style.position===q1?q1:W3}),aB=typeof document<"u"?Z.useLayoutEffect:Z.useEffect;function Z1(t){return"self"in t}function sWe(t){return"body"in t}function lB(t,e,n,i=Rh,r,s){const o=Z.useRef(null),a=Z.useRef(null),l=Z.useRef(null),c=Z.useCallback(h=>{let O,p,m;const g=h.target;if(sWe(g)||Z1(g)){const $=Z1(g)?g:g.defaultView;m=s===!0?$.scrollX:$.scrollY,O=s===!0?$.document.documentElement.scrollWidth:$.document.documentElement.scrollHeight,p=s===!0?$.innerWidth:$.innerHeight}else m=s===!0?g.scrollLeft:g.scrollTop,O=s===!0?g.scrollWidth:g.scrollHeight,p=s===!0?g.offsetWidth:g.offsetHeight;const v=()=>{t({scrollHeight:O,scrollTop:Math.max(m,0),viewportHeight:p})};h.suppressFlushSync===!0?v():sd.flushSync(v),a.current!==null&&(m===a.current||m<=0||m===O-p)&&(a.current=null,e(!0),l.current&&(clearTimeout(l.current),l.current=null))},[t,e,s]);Z.useEffect(()=>{const h=r||o.current;return i(r||o.current),c({suppressFlushSync:!0,target:h}),h.addEventListener("scroll",c,{passive:!0}),()=>{i(null),h.removeEventListener("scroll",c)}},[o,c,n,i,r]);function d(h){const O=o.current;if(!O||(s===!0?"offsetWidth"in O&&O.offsetWidth===0:"offsetHeight"in O&&O.offsetHeight===0))return;const p=h.behavior==="smooth";let m,g,v;Z1(O)?(g=Math.max(bc(O.document.documentElement,s===!0?"width":"height"),s===!0?O.document.documentElement.scrollWidth:O.document.documentElement.scrollHeight),m=s===!0?O.innerWidth:O.innerHeight,v=s===!0?window.scrollX:window.scrollY):(g=O[s===!0?"scrollWidth":"scrollHeight"],m=bc(O,s===!0?"width":"height"),v=O[s===!0?"scrollLeft":"scrollTop"]);const $=g-m;if(h.top=Math.ceil(Math.max(Math.min($,h.top),0)),FV(m,g)||h.top===v){t({scrollHeight:g,scrollTop:v,viewportHeight:m}),p&&e(!0);return}p?(a.current=h.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,a.current=null,e(!0)},1e3)):a.current=null,s===!0&&(h={...h.behavior!==void 0?{behavior:h.behavior}:{},left:h.top}),O.scrollTo(h)}function u(h){s===!0&&(h={...h.behavior!==void 0?{behavior:h.behavior}:{},...h.top!==void 0?{left:h.top}:{}}),o.current.scrollBy(h)}return{scrollByCallback:u,scrollerRef:o,scrollToCallback:d}}function dT(t){return t}const oWe=Vn(()=>{const t=ot(a=>`Item ${a}`),e=ot(a=>`Group ${a}`),n=ot({}),i=ot(dT),r=ot("div"),s=ot(Rh),o=(a,l=null)=>es(He(n,Xt(c=>c[a]),bi()),l);return{components:n,computeItemKey:i,EmptyPlaceholder:o("EmptyPlaceholder"),FooterComponent:o("Footer"),GroupComponent:o("Group","div"),groupContent:e,HeaderComponent:o("Header"),HeaderFooterTag:r,ItemComponent:o("Item","div"),itemContent:t,ListComponent:o("List","div"),ScrollerComponent:o("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:o("ScrollSeekPlaceholder"),TopItemListComponent:o("TopItemList")}}),aWe=Vn(([t,e])=>({...t,...e}),_i(iB,oWe)),lWe=({height:t})=>w.jsx("div",{style:{height:t}}),cWe={overflowAnchor:"none",position:cT(),zIndex:1},cB={overflowAnchor:"none"},dWe={...cB,display:"inline-block",height:"100%"},L3=Z.memo(function({showTopList:t=!1}){const e=ln("listState"),n=Po("sizeRanges"),i=ln("useWindowScroll"),r=ln("customScrollParent"),s=Po("windowScrollContainerState"),o=Po("scrollContainerState"),a=r||i?s:o,l=ln("itemContent"),c=ln("context"),d=ln("groupContent"),u=ln("trackItemSizes"),h=ln("itemSize"),O=ln("log"),p=Po("gap"),m=ln("horizontalDirection"),{callbackRef:g}=xNe(n,h,u,t?Rh:a,O,p,r,m,ln("skipAnimationFrameInResizeObserver")),[v,$]=Z.useState(0);uT("deviation",x=>{v!==x&&$(x)});const b=ln("EmptyPlaceholder"),S=ln("ScrollSeekPlaceholder")??lWe,y=ln("ListComponent"),Q=ln("ItemComponent"),_=ln("GroupComponent"),P=ln("computeItemKey"),C=ln("isSeeking"),X=ln("groupIndices").length>0,z=ln("alignToBottom"),T=ln("initialItemFinalLocationReached"),k=t?{}:{boxSizing:"border-box",...m?{display:"inline-block",height:"100%",marginLeft:v!==0?v:z?"auto":0,paddingLeft:e.offsetTop,paddingRight:e.offsetBottom,whiteSpace:"nowrap"}:{marginTop:v!==0?v:z?"auto":0,paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},...T?{}:{visibility:"hidden"}};return!t&&e.totalCount===0&&b!==null&&b!==void 0?w.jsx(b,{...Jr(b,c)}):w.jsx(y,{...Jr(y,c),"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",ref:g,style:k,children:(t?e.topItems:e.items).map(x=>{const R=x.originalIndex,E=P(R+e.firstItemIndex,x.data,c);return C?f.createElement(S,{...Jr(S,c),height:x.size,index:x.index,key:E,type:x.type||"item",...x.type==="group"?{}:{groupIndex:x.groupIndex}}):x.type==="group"?f.createElement(_,{...Jr(_,c),"data-index":R,"data-item-index":x.index,"data-known-size":x.size,key:E,style:cWe},d(x.index,c)):f.createElement(Q,{...Jr(Q,c),...fWe(Q,x.data),"data-index":R,"data-item-group-index":x.groupIndex,"data-item-index":x.index,"data-known-size":x.size,key:E,style:m?dWe:cB},X?l(x.index,x.groupIndex,x.data,c):l(x.index,x.data,c))})})}),uWe={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},hWe={outline:"none",overflowX:"auto",position:"relative"},Y$=t=>({height:"100%",position:"absolute",top:0,width:"100%",...t?{display:"flex",flexDirection:"column"}:void 0}),OWe={position:cT(),top:0,width:"100%",zIndex:1};function Jr(t,e){if(typeof t!="string")return{context:e}}function fWe(t,e){return{item:typeof t=="string"?void 0:e}}const pWe=Z.memo(function(){const t=ln("HeaderComponent"),e=Po("headerHeight"),n=ln("HeaderFooterTag"),i=wd(Z.useMemo(()=>s=>{e(bc(s,"height"))},[e]),!0,ln("skipAnimationFrameInResizeObserver")),r=ln("context");return t!=null?w.jsx(n,{ref:i,children:w.jsx(t,{...Jr(t,r)})}):null}),mWe=Z.memo(function(){const t=ln("FooterComponent"),e=Po("footerHeight"),n=ln("HeaderFooterTag"),i=wd(Z.useMemo(()=>s=>{e(bc(s,"height"))},[e]),!0,ln("skipAnimationFrameInResizeObserver")),r=ln("context");return t!=null?w.jsx(n,{ref:i,children:w.jsx(t,{...Jr(t,r)})}):null});function dB({useEmitter:t,useEmitterValue:e,usePublisher:n}){return Z.memo(function({children:i,style:r,context:s,...o}){const a=n("scrollContainerState"),l=e("ScrollerComponent"),c=n("smoothScrollTargetReached"),d=e("scrollerRef"),u=e("horizontalDirection")||!1,{scrollByCallback:h,scrollerRef:O,scrollToCallback:p}=lB(a,c,l,d,void 0,u);return t("scrollTo",p),t("scrollBy",h),w.jsx(l,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:O,style:{...u?hWe:uWe,...r},tabIndex:0,...o,...Jr(l,s),children:i})})}function uB({useEmitter:t,useEmitterValue:e,usePublisher:n}){return Z.memo(function({children:i,style:r,context:s,...o}){const a=n("windowScrollContainerState"),l=e("ScrollerComponent"),c=n("smoothScrollTargetReached"),d=e("totalListHeight"),u=e("deviation"),h=e("customScrollParent"),O=Z.useRef(null),p=e("scrollerRef"),{scrollByCallback:m,scrollerRef:g,scrollToCallback:v}=lB(a,c,l,p,h);return aB(()=>{var $;return g.current=h||(($=O.current)==null?void 0:$.ownerDocument.defaultView),()=>{g.current=null}},[g,h]),t("windowScrollTo",v),t("scrollBy",m),w.jsx(l,{ref:O,"data-virtuoso-scroller":!0,style:{position:"relative",...r,...d!==0?{height:d+u}:void 0},...o,...Jr(l,s),children:i})})}const gWe=({children:t})=>{const e=Z.useContext(sB),n=Po("viewportHeight"),i=Po("fixedItemHeight"),r=ln("alignToBottom"),s=ln("horizontalDirection"),o=Z.useMemo(()=>AV(n,l=>bc(l,s?"width":"height")),[n,s]),a=wd(o,!0,ln("skipAnimationFrameInResizeObserver"));return Z.useEffect(()=>{e&&(n(e.viewportHeight),i(e.itemHeight))},[e,n,i]),w.jsx("div",{"data-viewport-type":"element",ref:a,style:Y$(r),children:t})},vWe=({children:t})=>{const e=Z.useContext(sB),n=Po("windowViewportRect"),i=Po("fixedItemHeight"),r=ln("customScrollParent"),s=jV(n,r,ln("skipAnimationFrameInResizeObserver")),o=ln("alignToBottom");return Z.useEffect(()=>{e&&(i(e.itemHeight),n({offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:100}))},[e,n,i]),w.jsx("div",{"data-viewport-type":"window",ref:s,style:Y$(o),children:t})},$We=({children:t})=>{const e=ln("TopItemListComponent")??"div",n=ln("headerHeight"),i={...OWe,marginTop:`${n}px`},r=ln("context");return w.jsx(e,{style:i,...Jr(e,r),children:t})},bWe=Z.memo(function(t){const e=ln("useWindowScroll"),n=ln("topItemsIndexes").length>0,i=ln("customScrollParent"),r=ln("context");return w.jsxs(i||e?_We:yWe,{...t,context:r,children:[n&&w.jsx($We,{children:w.jsx(L3,{showTopList:!0})}),w.jsxs(i||e?vWe:gWe,{children:[w.jsx(pWe,{}),w.jsx(L3,{}),w.jsx(mWe,{})]})]})}),{Component:SWe,useEmitter:uT,useEmitterValue:ln,usePublisher:Po}=rB(aWe,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},bWe),yWe=dB({useEmitter:uT,useEmitterValue:ln,usePublisher:Po}),_We=uB({useEmitter:uT,useEmitterValue:ln,usePublisher:Po}),QWe=SWe,xWe=Vn(()=>{const t=ot(c=>w.jsxs("td",{children:["Item $",c]})),e=ot(null),n=ot(c=>w.jsxs("td",{colSpan:1e3,children:["Group ",c]})),i=ot(null),r=ot(null),s=ot({}),o=ot(dT),a=ot(Rh),l=(c,d=null)=>es(He(s,Xt(u=>u[c]),bi()),d);return{components:s,computeItemKey:o,context:e,EmptyPlaceholder:l("EmptyPlaceholder"),FillerRow:l("FillerRow"),fixedFooterContent:r,fixedHeaderContent:i,itemContent:t,groupContent:n,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TableBodyComponent:l("TableBody","tbody"),TableComponent:l("Table","table"),TableFooterComponent:l("TableFoot","tfoot"),TableHeadComponent:l("TableHead","thead"),TableRowComponent:l("TableRow","tr"),GroupComponent:l("Group","tr")}});_i(iB,xWe);cT();const V3={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},wWe={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:B3,floor:y0,max:KO,min:G1,round:Y3}=Math;function D3(t,e,n){return Array.from({length:e-t+1}).map((i,r)=>({data:n===null?null:n[r+t],index:r+t}))}function PWe(t){return{...wWe,items:t}}function ig(t,e){return t!==void 0&&t.width===e.width&&t.height===e.height}function CWe(t,e){return t!==void 0&&t.column===e.column&&t.row===e.row}const TWe=Vn(([{increaseViewportBy:t,listBoundary:e,overscan:n,visibleRange:i},{footerHeight:r,headerHeight:s,scrollBy:o,scrollContainerState:a,scrollTo:l,scrollTop:c,smoothScrollTargetReached:d,viewportHeight:u},h,O,{didMount:p,propsReady:m},{customScrollParent:g,useWindowScroll:v,windowScrollContainerState:$,windowScrollTo:b,windowViewportRect:S},y])=>{const Q=ot(0),_=ot(0),P=ot(V3),C=ot({height:0,width:0}),X=ot({height:0,width:0}),z=Xn(),T=Xn(),k=ot(0),x=ot(null),R=ot({column:0,row:0}),E=Xn(),I=Xn(),A=ot(!1),j=ot(0),N=ot(!0),L=ot(!1),B=ot(!1);Zn(He(p,pn(j),Kt(([D,ee])=>ee!==0)),()=>{On(N,!1)}),Zn(He(nr(p,N,X,C,j,L),Kt(([D,ee,fe,se,,te])=>D&&!ee&&fe.height!==0&&se.height!==0&&!te)),([,,,,D])=>{On(L,!0),sT(1,()=>{On(z,D)}),Zo(He(c),()=>{On(e,[0,0]),On(N,!0)})}),Lt(He(I,Kt(D=>D!=null&&D.scrollTop>0),Qa(0)),_),Zn(He(p,pn(I),Kt(([,D])=>D!=null)),([,D])=>{D&&(On(C,D.viewport),On(X,D.item),On(R,D.gap),D.scrollTop>0&&(On(A,!0),Zo(He(c,md(1)),ee=>{On(A,!1)}),On(l,{top:D.scrollTop})))}),Lt(He(C,Xt(({height:D})=>D)),u),Lt(He(nr(Ht(C,ig),Ht(X,ig),Ht(R,(D,ee)=>D!==void 0&&D.column===ee.column&&D.row===ee.row),Ht(c)),Xt(([D,ee,fe,se])=>({gap:fe,item:ee,scrollTop:se,viewport:D}))),E),Lt(He(nr(Ht(Q),i,Ht(R,CWe),Ht(X,ig),Ht(C,ig),Ht(x),Ht(_),Ht(A),Ht(N),Ht(j)),Kt(([,,,,,,,D])=>!D),Xt(([D,[ee,fe],se,te,oe,G,H,,K,ae])=>{const{column:de,row:ve}=se,{height:Se,width:ue}=te,{width:me}=oe;if(H===0&&(D===0||me===0))return V3;if(ue===0){const Ce=oT(ae,D),we=Ce+Math.max(H-1,0);return PWe(D3(Ce,we,G))}const Oe=hB(me,ue,de);let pe,ke;K?ee===0&&fe===0&&H>0?(pe=0,ke=H-1):(pe=Oe*y0((ee+ve)/(Se+ve)),ke=Oe*B3((fe+ve)/(Se+ve))-1,ke=G1(D-1,KO(ke,Oe-1)),pe=G1(ke,KO(0,pe))):(pe=0,ke=-1);const Ae=D3(pe,ke,G),{bottom:Ue,top:Ze}=U3(oe,se,te,Ae),De=B3(D/Oe),et=De*Se+(De-1)*ve-Ue;return{bottom:Ue,itemHeight:Se,items:Ae,itemWidth:ue,offsetBottom:et,offsetTop:Ze,top:Ze}})),P),Lt(He(x,Kt(D=>D!==null),Xt(D=>D.length)),Q),Lt(He(nr(C,X,P,R),Kt(([D,ee,{items:fe}])=>fe.length>0&&ee.height!==0&&D.height!==0),Xt(([D,ee,{items:fe},se])=>{const{bottom:te,top:oe}=U3(D,se,ee,fe);return[oe,te]}),bi(Ff)),e);const V=ot(!1);Lt(He(c,pn(V),Xt(([D,ee])=>ee||D!==0)),V);const Y=lo(He(nr(P,Q),Kt(([{items:D}])=>D.length>0),pn(V),Kt(([[D,ee],fe])=>{const se=D.items[D.items.length-1].index===ee-1;return(fe||D.bottom>0&&D.itemHeight>0&&D.offsetBottom===0&&D.items.length===ee)&&se}),Xt(([[,D]])=>D-1),bi())),W=lo(He(Ht(P),Kt(({items:D})=>D.length>0&&D[0].index===0),Qa(0),bi())),q=lo(He(Ht(P),pn(A),Kt(([{items:D},ee])=>D.length>0&&!ee),Xt(([{items:D}])=>({endIndex:D[D.length-1].index,startIndex:D[0].index})),bi(YV),gl(0)));Lt(q,O.scrollSeekRangeChanged),Lt(He(z,pn(C,X,Q,R),Xt(([D,ee,fe,se,te])=>{const oe=GV(D),{align:G,behavior:H,offset:K}=oe;let ae=oe.index;ae==="LAST"&&(ae=se-1),ae=KO(0,ae,G1(se-1,ae));let de=Zx(ee,te,fe,ae);return G==="end"?de=Y3(de-ee.height+fe.height):G==="center"&&(de=Y3(de-ee.height/2+fe.height/2)),K!==void 0&&K!==0&&(de+=K),{behavior:H,top:de}})),l);const ne=es(He(P,Xt(D=>D.offsetBottom+D.bottom)),0);return Lt(He(S,Xt(D=>({height:D.visibleHeight,width:D.visibleWidth}))),C),{customScrollParent:g,data:x,deviation:k,footerHeight:r,gap:R,headerHeight:s,increaseViewportBy:t,initialItemCount:_,itemDimensions:X,overscan:n,restoreStateFrom:I,scrollBy:o,scrollContainerState:a,scrollHeight:T,scrollTo:l,scrollToIndex:z,scrollTop:c,smoothScrollTargetReached:d,totalCount:Q,useWindowScroll:v,viewportDimensions:C,windowScrollContainerState:$,windowScrollTo:b,windowViewportRect:S,...O,gridState:P,horizontalDirection:B,initialTopMostItemIndex:j,totalListHeight:ne,...h,endReached:Y,propsReady:m,rangeChanged:q,startReached:W,stateChanged:E,stateRestoreInProgress:A,...y}},_i(aT,zs,Ap,tB,Qc,lT,_c));function hB(t,e,n){return KO(1,y0((t+n)/(y0(e)+n)))}function U3(t,e,n,i){const{height:r}=n;if(r===void 0||i.length===0)return{bottom:0,top:0};const s=Zx(t,e,n,i[0].index);return{bottom:Zx(t,e,n,i[i.length-1].index)+r,top:s}}function Zx(t,e,n,i){const r=hB(t.width,n.width,e.column),s=y0(i/r),o=s*n.height+KO(0,s-1)*e.row;return o>0?o+e.row:o}const kWe=Vn(()=>{const t=ot(u=>`Item ${u}`),e=ot({}),n=ot(null),i=ot("virtuoso-grid-item"),r=ot("virtuoso-grid-list"),s=ot(dT),o=ot("div"),a=ot(Rh),l=(u,h=null)=>es(He(e,Xt(O=>O[u]),bi()),h),c=ot(!1),d=ot(!1);return Lt(Ht(d),c),{components:e,computeItemKey:s,context:n,FooterComponent:l("Footer"),HeaderComponent:l("Header"),headerFooterTag:o,itemClassName:i,ItemComponent:l("Item","div"),itemContent:t,listClassName:r,ListComponent:l("List","div"),readyStateChanged:c,reportReadyState:d,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),RWe=Vn(([t,e])=>({...t,...e}),_i(TWe,kWe)),EWe=Z.memo(function(){const t=Pi("gridState"),e=Pi("listClassName"),n=Pi("itemClassName"),i=Pi("itemContent"),r=Pi("computeItemKey"),s=Pi("isSeeking"),o=Co("scrollHeight"),a=Pi("ItemComponent"),l=Pi("ListComponent"),c=Pi("ScrollSeekPlaceholder"),d=Pi("context"),u=Co("itemDimensions"),h=Co("gap"),O=Pi("log"),p=Pi("stateRestoreInProgress"),m=Co("reportReadyState"),g=wd(Z.useMemo(()=>v=>{const $=v.parentElement.parentElement.scrollHeight;o($);const b=v.firstChild;if(b!==null){const{height:S,width:y}=b.getBoundingClientRect();u({height:S,width:y})}h({column:q3("column-gap",getComputedStyle(v).columnGap,O),row:q3("row-gap",getComputedStyle(v).rowGap,O)})},[o,u,h,O]),!0,!1);return aB(()=>{t.itemHeight>0&&t.itemWidth>0&&m(!0)},[t]),p?null:w.jsx(l,{className:e,ref:g,...Jr(l,d),"data-testid":"virtuoso-item-list",style:{paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},children:t.items.map(v=>{const $=r(v.index,v.data,d);return s?w.jsx(c,{...Jr(c,d),height:t.itemHeight,index:v.index,width:t.itemWidth},$):f.createElement(a,{...Jr(a,d),className:n,"data-index":v.index,key:$},i(v.index,v.data,d))})})}),XWe=Z.memo(function(){const t=Pi("HeaderComponent"),e=Co("headerHeight"),n=Pi("headerFooterTag"),i=wd(Z.useMemo(()=>s=>{e(bc(s,"height"))},[e]),!0,!1),r=Pi("context");return t!=null?w.jsx(n,{ref:i,children:w.jsx(t,{...Jr(t,r)})}):null}),zWe=Z.memo(function(){const t=Pi("FooterComponent"),e=Co("footerHeight"),n=Pi("headerFooterTag"),i=wd(Z.useMemo(()=>s=>{e(bc(s,"height"))},[e]),!0,!1),r=Pi("context");return t!=null?w.jsx(n,{ref:i,children:w.jsx(t,{...Jr(t,r)})}):null}),IWe=({children:t})=>{const e=Z.useContext(oB),n=Co("itemDimensions"),i=Co("viewportDimensions"),r=wd(Z.useMemo(()=>s=>{i(s.getBoundingClientRect())},[i]),!0,!1);return Z.useEffect(()=>{e&&(i({height:e.viewportHeight,width:e.viewportWidth}),n({height:e.itemHeight,width:e.itemWidth}))},[e,i,n]),w.jsx("div",{ref:r,style:Y$(!1),children:t})},AWe=({children:t})=>{const e=Z.useContext(oB),n=Co("windowViewportRect"),i=Co("itemDimensions"),r=Pi("customScrollParent"),s=jV(n,r,!1);return Z.useEffect(()=>{e&&(i({height:e.itemHeight,width:e.itemWidth}),n({offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:e.viewportWidth}))},[e,n,i]),w.jsx("div",{ref:s,style:Y$(!1),children:t})},MWe=Z.memo(function({...t}){const e=Pi("useWindowScroll"),n=Pi("customScrollParent"),i=n||e?NWe:jWe,r=n||e?AWe:IWe,s=Pi("context");return w.jsx(i,{...t,...Jr(i,s),children:w.jsxs(r,{children:[w.jsx(XWe,{}),w.jsx(EWe,{}),w.jsx(zWe,{})]})})}),{useEmitter:OB,useEmitterValue:Pi,usePublisher:Co}=rB(RWe,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},MWe),jWe=dB({useEmitter:OB,useEmitterValue:Pi,usePublisher:Co}),NWe=uB({useEmitter:OB,useEmitterValue:Pi,usePublisher:Co});function q3(t,e,n){return e!=="normal"&&(e==null?void 0:e.endsWith("px"))!==!0&&n(`${t} was not resolved to pixel value correctly`,e,fr.WARN),e==="normal"?0:parseInt(e??"0",10)}const WWe="_centerEmpty_gfdt4_1",LWe="_container_gfdt4_8",VWe="_mobileVirtuoso_gfdt4_18",BWe="_sessionDividerText_gfdt4_23",YWe="_lastResponseLabel_gfdt4_28",DWe="_splitContainer_gfdt4_32",UWe="_chatSection_gfdt4_39",qWe="_vResizer_gfdt4_47",ZWe="_terminalToggle_gfdt4_61",GWe="_messageListWrap_gfdt4_84",FWe="_stickyBottomBtn_gfdt4_92",HWe="_loadMoreWrap_gfdt4_144",KWe="_loadMoreBtn_gfdt4_150",JWe="_navSidebar_gfdt4_166",eLe="_navBtn_gfdt4_183",tLe="_navBtnActive_gfdt4_203",nLe="_navAvatarImg_gfdt4_223",iLe="_userPromptNavList_gfdt4_230",rLe="_userPromptNavItem_gfdt4_239",sLe="_terminalPanelWrap_gfdt4_259",oLe="_navSidebarContent_gfdt4_266",aLe="_innerSplitArea_gfdt4_274",lLe="_chatSectionFlex_gfdt4_281",cLe="_overlayPanel_gfdt4_290",dLe="_streamingSpinnerWrap_gfdt4_298",uLe="_streamingSpinnerHidden_gfdt4_305",hLe="_sessionDivider_gfdt4_23",OLe="_loadMoreBtnLoading_gfdt4_314",fLe="_lastResponseDivider_gfdt4_319",Vt={centerEmpty:WWe,container:LWe,mobileVirtuoso:VWe,sessionDividerText:BWe,lastResponseLabel:YWe,splitContainer:DWe,chatSection:UWe,vResizer:qWe,terminalToggle:ZWe,messageListWrap:GWe,stickyBottomBtn:FWe,loadMoreWrap:HWe,loadMoreBtn:KWe,navSidebar:JWe,navBtn:eLe,navBtnActive:tLe,navAvatarImg:nLe,userPromptNavList:iLe,userPromptNavItem:rLe,terminalPanelWrap:sLe,navSidebarContent:oLe,innerSplitArea:aLe,chatSectionFlex:lLe,overlayPanel:cLe,streamingSpinnerWrap:dLe,streamingSpinnerHidden:uLe,sessionDivider:hLe,loadMoreBtnLoading:OLe,lastResponseDivider:fLe},{Text:F1}=kl,H1=240,pLe=100,mLe={},Z3={},gLe=Z.forwardRef((t,e)=>w.jsx("div",{ref:e,...t,className:Vt.container}));function vLe(){return 100+Math.random()*50}class xDe extends Z.Component{constructor(n){super(n);Je(this,"handleStickToBottom",()=>{this.setState({stickyBottom:!0},()=>{if(Ft&&this.virtuosoRef.current)this.virtuosoRef.current.scrollToIndex({index:"LAST",behavior:"smooth"});else{const n=this.containerRef.current;n&&(n.scrollTop=n.scrollHeight)}})});Je(this,"_addPendingImage",(n,i)=>{n&&this.setState(r=>r.pendingImages.length>=20||r.pendingImages.some(s=>s.path===n)?null:{pendingImages:[...r.pendingImages,{path:n,source:i}]})});Je(this,"_removePendingImage",n=>{this.setState(i=>{const r=i.pendingImages[n];if(!r)return null;const s=i.pendingImages.filter((o,a)=>a!==n);return r.path&&this._inputWs&&this._inputWs.readyState===WebSocket.OPEN&&this._inputWs.send(JSON.stringify({type:"image-remove-notify",path:r.path})),{pendingImages:s}})});Je(this,"_clearPendingImages",()=>{this.state.pendingImages.length>0&&this.setState({pendingImages:[]})});Je(this,"handleLoadMore",()=>{var o;this._mobileExtraItems+=pLe;const n=((o=this.state.allItems)==null?void 0:o.length)||0,i=this.buildAllItems(),r=this._applyMobileSlice(i),s=r.length-n;if(Ft&&this.virtuosoRef.current)this.setState({allItems:r,lastResponseItems:this._lastResponseItems,visibleCount:r.length},()=>{this.virtuosoRef.current&&s>0&&this.virtuosoRef.current.scrollToIndex({index:s,align:"start"})});else{const a=this.containerRef.current,l=a?a.scrollHeight:0,c=a?a.scrollTop:0;this.setState({allItems:r,lastResponseItems:this._lastResponseItems,visibleCount:r.length},()=>{if(a){const d=a.scrollHeight;a.scrollTop=c+(d-l)}})}});Je(this,"handlePresetSend",n=>{if(!n)return;const i=this._inputRef.current;i&&(i.value=n,i.style.height="auto",i.style.height=Math.min(i.scrollHeight,Ft?160:120)+"px",this.setState({inputEmpty:!1}),i.focus())});Je(this,"handlePromptOptionClick",n=>{if(this._promptSubmitting)return;const i=this._inputWs;if(!i||i.readyState!==WebSocket.OPEN)return;let r=this.state.ptyPrompt;r||(r=this.state.ptyPromptHistory.slice().reverse().find(h=>h.status==="active")||{options:Array.from({length:Math.max(n,3)},(h,O)=>({number:O+1,selected:O===0}))}),this._promptSubmitting=!0;const s=r.options,o=s.findIndex(h=>h.number===n);let a=s.findIndex(h=>h.selected);a<0&&(a=0);const l=o-a,c=l>0?"\x1B[B":"\x1B[A",d=Math.abs(l),u=h=>{h<d?(i.send(JSON.stringify({type:"input",data:c})),setTimeout(()=>u(h+1),30)):setTimeout(()=>{i.readyState===WebSocket.OPEN&&i.send(JSON.stringify({type:"input",data:"\r"}))},50)};u(0),this._currentPtyPrompt=null,this.setState(h=>{const O=h.ptyPromptHistory.slice(),p=O[O.length-1];return p&&p.status==="active"&&(O[O.length-1]={...p,status:"answered",selectedNumber:n}),{ptyPrompt:null,ptyPromptHistory:O}}),this._ptyBuffer="",this._ptyDebounceTimer&&clearTimeout(this._ptyDebounceTimer),setTimeout(()=>{this._promptSubmitting=!1},500)});Je(this,"handlePermissionAllow",n=>{const i=this._inputWs;i&&i.readyState===WebSocket.OPEN&&i.send(JSON.stringify({type:"perm-hook-answer",id:n,decision:"allow"})),this.setState({pendingPermission:null})});Je(this,"handlePermissionAllowSession",n=>{const i=this._inputWs;i&&i.readyState===WebSocket.OPEN&&i.send(JSON.stringify({type:"perm-hook-answer",id:n,decision:"allow",allowSession:!0})),this.setState({pendingPermission:null})});Je(this,"handlePermissionDeny",n=>{const i=this._inputWs;i&&i.readyState===WebSocket.OPEN&&i.send(JSON.stringify({type:"perm-hook-answer",id:n,decision:"deny"})),this.setState({pendingPermission:null})});Je(this,"handlePlanApprove",n=>{const i=this._inputWs;i&&i.readyState===WebSocket.OPEN&&i.send(JSON.stringify({type:"sdk-plan-answer",id:n,approve:!0})),this.setState({pendingPlanApproval:null})});Je(this,"handlePlanReject",(n,i)=>{const r=this._inputWs;r&&r.readyState===WebSocket.OPEN&&r.send(JSON.stringify({type:"sdk-plan-answer",id:n,approve:!1,feedback:i||""})),this.setState({pendingPlanApproval:null})});Je(this,"handlePlanFeedbackSubmit",(n,i)=>{const r=this._inputWs;if(!r||r.readyState!==WebSocket.OPEN)return;let s=this.state.ptyPrompt;s||(s=this.state.ptyPromptHistory.slice().reverse().find(O=>O.status==="active")||{options:Array.from({length:Math.max(n,3)},(O,p)=>({number:p+1,selected:p===0}))});const o=s.options,a=o.findIndex(O=>O.number===n);let l=o.findIndex(O=>O.selected);l<0&&(l=0);const c=a-l,d=c>0?"\x1B[B":"\x1B[A",u=Math.abs(c),h=O=>{O<u?(r.send(JSON.stringify({type:"input",data:d})),setTimeout(()=>h(O+1),30)):setTimeout(()=>{r.send(JSON.stringify({type:"input",data:"\r"}));const p=this._ptyBuffer;let m=0;const g=()=>{if(m++,m>20||this._ptyBuffer!==p){r.readyState===WebSocket.OPEN&&(r.send(JSON.stringify({type:"input",data:i})),setTimeout(()=>{r.send(JSON.stringify({type:"input",data:"\r"}))},50));return}setTimeout(g,100)};setTimeout(g,100)},50)};h(0),this._currentPtyPrompt=null,this.setState(O=>{const p=O.ptyPromptHistory.slice(),m=p[p.length-1];return m&&m.status==="active"&&(p[p.length-1]={...m,status:"answered",selectedNumber:n}),{ptyPrompt:null,ptyPromptHistory:p}}),this._ptyBuffer="",this._ptyDebounceTimer&&clearTimeout(this._ptyDebounceTimer)});Je(this,"handleAskQuestionSubmit",(n,i,r)=>{var s,o;if(i&&r){const a={};for(const l of n){const c=r[l.questionIndex];if(c)if(l.type==="other")a[c.question]=l.text;else if(l.type==="multi"){const d=l.selectedIndices.map(u=>{var h;return(h=(c.options||[])[u])==null?void 0:h.label}).filter(Boolean);a[c.question]=d.join(", ")}else a[c.question]=((s=(c.options||[])[l.optionIndex])==null?void 0:s.label)||""}this.setState(l=>({localAskAnswers:{...l.localAskAnswers||{},[i]:a}}))}if(this.props.sdkMode){const a=i||this._sdkAskId;if(!a)return;const l=this._inputWs;if(l&&l.readyState===WebSocket.OPEN){const c={},d=this._askHookQuestions||r;for(const u of n){const h=d==null?void 0:d[u.questionIndex];if(h)if(u.type==="other")c[h.question]=u.text;else if(u.type==="multi"){const O=u.selectedIndices.map(p=>{var m;return(m=(h.options||[])[p])==null?void 0:m.label}).filter(Boolean);c[h.question]=O.join(", ")}else c[h.question]=((o=(h.options||[])[u.optionIndex])==null?void 0:o.label)||""}l.send(JSON.stringify({type:"sdk-ask-answer",id:a,answers:c})),this._sdkAskId=null}return}if(this._askHookActive&&!this._askSubmitting){this._submitViaHookBridge(n);return}if(!this._askHookActive&&!this._askSubmitting&&this._inputWs&&this._inputWs.readyState===WebSocket.OPEN){this._pendingHookAnswers=n,this._askHookWaitRetries=0,this._askSubmitting=!0,this._waitForHookBridge();return}this._submitViaPty(n)});Je(this,"handleInputSend",()=>{const n=this._inputRef.current;if(!n)return;const i=n.value.trim(),r=this.state.pendingImages.map(o=>`"${o.path.replace(/"/g,"")}"`).join(" "),s=r?i?`${r} ${i}`:r:i;s&&this._inputWs&&this._inputWs.readyState===WebSocket.OPEN&&(this.props.sdkMode?this._inputWs.send(JSON.stringify({type:"sdk-user-message",text:s})):(this._inputWs.send(JSON.stringify({type:"input",data:s})),setTimeout(()=>{this._inputWs&&this._inputWs.readyState===WebSocket.OPEN&&this._inputWs.send(JSON.stringify({type:"input",data:"\r"}))},50)),n.value="",n.style.height="auto",this._clearPendingImages(),this.setState({inputEmpty:!0,pendingInput:i||r,inputSuggestion:null},()=>this.scrollToBottom()))});Je(this,"handleInputKeyDown",n=>{if(n.key==="Tab"&&this.state.inputSuggestion){n.preventDefault();const i=this._inputRef.current;i&&(i.value=this.state.inputSuggestion,i.style.height="auto",i.style.height=Math.min(i.scrollHeight,120)+"px"),this.setState({inputSuggestion:null,inputEmpty:!1});return}n.key==="Enter"&&!n.shiftKey&&!n.isComposing&&n.keyCode!==229&&(n.preventDefault(),this.handleInputSend())});Je(this,"handleInputChange",n=>{const i=n.target;i.style.height="auto",i.style.height=Math.min(i.scrollHeight,120)+"px";const r=!i.value.trim();this.setState({inputEmpty:r}),this.state.inputSuggestion&&!r&&this.setState({inputSuggestion:null})});Je(this,"handleSuggestionToTerminal",()=>{const n=this.state.inputSuggestion;!n||!this._inputWs||this._inputWs.readyState!==WebSocket.OPEN||(this._inputWs.send(JSON.stringify({type:"input",data:n})),setTimeout(()=>{this._inputWs&&this._inputWs.readyState===WebSocket.OPEN&&this._inputWs.send(JSON.stringify({type:"input",data:"\r"}))},50),this.setState({inputSuggestion:null,pendingInput:n},()=>this.scrollToBottom()))});Je(this,"handleUploadPath",n=>{this._addPendingImage(n,"chat"),this._inputWs&&this._inputWs.readyState===WebSocket.OPEN&&this._inputWs.send(JSON.stringify({type:"image-upload-notify",path:n,source:"chat"}))});Je(this,"handleSplitMouseDown",n=>{n.preventDefault(),this._resizing=!0,this._dragTarget="terminal";let i=[];const r=this.innerSplitRef.current;if(r){const l=r.getBoundingClientRect().width,c=7.8,d=[60,80,100,120],u=5;i=d.map(h=>{const O=h*c,p=O+u;if(p>l*.75||p<l*.15)return null;const m=l-O-u;return{cols:h,terminalPx:O,linePosition:m}}).filter(h=>h!==null)}this.setState({isDragging:!0,snapLines:i});const s=a=>{if(!this._resizing)return;const l=this.innerSplitRef.current;if(!l)return;const c=l.getBoundingClientRect(),d=c.width;let u=c.right-a.clientX;u=Math.max(200,Math.min(d*.75,u));let h=null;if(i.length>0){let p=1/0,m=null;for(const g of i){const v=Math.abs(a.clientX-c.left-g.linePosition);v<p&&(p=v,m=g)}m&&p<60&&(h=m)}this.setState({terminalWidth:u,activeSnapLine:h})},o=()=>{if(this._resizing=!1,this._dragTarget=null,this.state.activeSnapLine){const a=this.state.activeSnapLine.terminalPx;localStorage.setItem("cc-viewer-terminal-width",a.toString()),this.setState({terminalWidth:a,isDragging:!1,activeSnapLine:null,snapLines:[],needsInitialSnap:!1})}else localStorage.setItem("cc-viewer-terminal-width",this.state.terminalWidth.toString()),this.setState({isDragging:!1,activeSnapLine:null,snapLines:[],needsInitialSnap:!1});document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",o),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",s),document.addEventListener("mouseup",o),document.body.style.cursor="col-resize",document.body.style.userSelect="none"});Je(this,"handleSidebarMouseDown",n=>{n.preventDefault(),this._resizing=!0,this._dragTarget="sidebar";const i=[180,240,300,360],r=this.innerSplitRef.current;let s=[];if(r){const l=r.getBoundingClientRect().width;s=i.filter(c=>c<l*.4).map(c=>({cols:c,terminalPx:c,linePosition:c}))}this.setState({isDragging:!0,snapLines:s});const o=l=>{if(!this._resizing)return;const c=this.innerSplitRef.current;if(!c)return;const d=c.getBoundingClientRect(),u=d.width;let h=l.clientX-d.left;h=Math.max(160,Math.min(u*.4,h));let O=null;if(s.length>0){let m=1/0,g=null;for(const v of s){const $=Math.abs(h-v.linePosition);$<m&&(m=$,g=v)}g&&m<60&&(O=g)}this.setState({sidebarWidth:h,activeSnapLine:O})},a=()=>{if(this._resizing=!1,this._dragTarget=null,this.state.activeSnapLine){const l=this.state.activeSnapLine.linePosition;localStorage.setItem("cc-viewer-sidebar-width",l.toString()),this.setState({sidebarWidth:l,isDragging:!1,activeSnapLine:null,snapLines:[]})}else localStorage.setItem("cc-viewer-sidebar-width",this.state.sidebarWidth.toString()),this.setState({isDragging:!1,activeSnapLine:null,snapLines:[]});document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",a),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",o),document.addEventListener("mouseup",a),document.body.style.cursor="col-resize",document.body.style.userSelect="none"});Je(this,"handleToggleExpandPath",n=>{this.setState(i=>{const r=new Set(i.fileExplorerExpandedPaths);return r.has(n)?r.delete(n):r.add(n),{fileExplorerExpandedPaths:r}})});Je(this,"handleMdImageClick",n=>{const i=n.target.closest(".chat-md img");i&&i.src&&(n.preventDefault(),this.setState({mdLightboxSrc:i.src}))});Je(this,"handleOpenToolFilePath",async n=>{if(!n)return;let i=n;if(n.startsWith("/")){if(!this._projectDirCache)try{const o=await fetch(pt("/api/project-dir"));if(o.ok){const a=await o.json();a&&a.dir&&(this._projectDirCache=a.dir)}}catch{}this._projectDirCache&&n.startsWith(this._projectDirCache+"/")&&(i=n.slice(this._projectDirCache.length+1))}const r=i.split("/"),s=[];for(let o=1;o<r.length;o++)s.push(r.slice(0,o).join("/"));this._setFileExplorerOpen(!0),this.setState(o=>{const a=new Set(o.fileExplorerExpandedPaths);return s.forEach(l=>a.add(l)),{currentFile:i,currentGitDiff:null,scrollToLine:null,fileExplorerExpandedPaths:a}})});this.containerRef=Z.createRef(),this.virtuosoRef=Z.createRef(),this.splitContainerRef=Z.createRef(),this.innerSplitRef=Z.createRef(),this._incToolState=null,this._incToolProcessedCount=0,this._incToolSessionIdx=-1,this._prevSessions=null,this._reqScanCache={tsToIndex:{},modelName:null,subAgentEntries:[],processedCount:0};const i=localStorage.getItem("cc-viewer-terminal-width"),r=i?parseFloat(i):null;this.state={visibleCount:0,loading:!1,allItems:[],lastResponseItems:null,highlightTs:null,highlightFading:!1,highlightVisibleIdx:-1,sidebarWidth:parseInt(localStorage.getItem("cc-viewer-sidebar-width"),10)||240,terminalWidth:r||624,needsInitialSnap:r===null,inputEmpty:!0,pendingInput:null,stickyBottom:!0,ptyPrompt:null,ptyPromptHistory:[],inputSuggestion:null,fileExplorerOpen:!Ft&&localStorage.getItem("ccv_fileExplorerOpen")!=="false",currentFile:null,currentGitDiff:null,scrollToLine:null,fileExplorerExpandedPaths:new Set,gitChangesOpen:!1,snapLines:[],activeSnapLine:null,isDragging:!1,fileVersion:0,editorSessionId:null,editorFilePath:null,fileExplorerRefresh:0,gitChangesRefresh:0,roleFilterOpen:!1,roleFilterSelected:new Set,teamModalSession:null,mdLightboxSrc:null,streamingFading:!1,presetItems:[],mobilePresetModalVisible:!1,localAskAnswers:{},pendingPermission:null,pendingPlanApproval:null,pendingImages:[]},this._processedToolIds=new Set,this._projectDirCache=null,this._fileRefreshTimer=null,this._gitRefreshTimer=null,this._queueTimer=null,this._prevItemsLen=0,this._scrollTargetIdx=null,this._scrollTargetRef=Z.createRef(),this._scrollFadeTimer=null,this._resizing=!1,this._dragTarget=null,this._inputWs=null,this._inputRef=Z.createRef(),this._ptyBuffer="",this._ptyDataSeq=0,this._ptyDebounceTimer=null,this._currentPtyPrompt=null,this._askHookActive=!1,this._askHookQuestions=null,this._pendingHookAnswers=null,this._askHookWaitRetries=0,this._hookWaitTimer=null,this._mobileExtraItems=0,this._mobileSliceOffset=0,this._totalItemCount=0}_setFileExplorerOpen(n){localStorage.setItem("ccv_fileExplorerOpen",String(n)),this.setState({fileExplorerOpen:n})}_checkToolFileChanges(){var o,a;const n=this.props.mainAgentSessions;if(!n||n.length===0)return;this._processedToolIds.size>5e3&&this._processedToolIds.clear();let i=!1,r=!1,s=!1;for(const l of n){const c=[];if((a=(o=l.response)==null?void 0:o.body)!=null&&a.content&&c.push(l.response.body.content),Array.isArray(l.messages))for(const d of l.messages)d.role==="assistant"&&Array.isArray(d.content)&&c.push(d.content);for(const d of c)for(const u of d){if(u.type!=="tool_use"||!u.id||this._processedToolIds.has(u.id))continue;this._processedToolIds.add(u.id);const h=u.name;let O=u.input;if(typeof O=="string")try{O=JSON.parse(O.replace(/^\[object Object\]/,""))}catch{O={}}if(h==="Write"?(i=!0,r=!0):h==="Edit"||h==="NotebookEdit"?r=!0:h==="Bash"&&O&&O.command&&K7e(O.command)&&(i=!0,r=!0),(h==="Write"||h==="Edit"||h==="NotebookEdit")&&this.state.currentFile){const p=O&&O.file_path;if(p){let m=p;m.startsWith("/")&&this._projectDirCache&&m.startsWith(this._projectDirCache+"/")&&(m=m.slice(this._projectDirCache.length+1)),(m===this.state.currentFile||m.startsWith("/")&&m.endsWith("/"+this.state.currentFile))&&(s=!0)}}}}i&&this.state.fileExplorerOpen&&(clearTimeout(this._fileRefreshTimer),this._fileRefreshTimer=setTimeout(()=>{this.setState(l=>({fileExplorerRefresh:l.fileExplorerRefresh+1}))},500)),r&&this.state.gitChangesOpen&&(clearTimeout(this._gitRefreshTimer),this._gitRefreshTimer=setTimeout(()=>{this.setState(l=>({gitChangesRefresh:l.gitChangesRefresh+1}))},500)),s&&(clearTimeout(this._contentRefreshTimer),this._contentRefreshTimer=setTimeout(()=>{this.setState(l=>({fileVersion:l.fileVersion+1}))},500))}componentDidMount(){this.startRender(),this.props.cliMode&&this.connectInputWs(),Ft||this._bindStickyScroll(),this.state.needsInitialSnap&&this.props.cliMode&&this.props.terminalVisible&&this._snapToInitialPosition(),this._loadPresets(),this._onPresetsChanged=()=>this._loadPresets(),window.addEventListener("ccv-presets-changed",this._onPresetsChanged)}shouldComponentUpdate(n,i){return n.requests!==this.props.requests||n.mainAgentSessions!==this.props.mainAgentSessions||n.collapseToolResults!==this.props.collapseToolResults||n.expandThinking!==this.props.expandThinking||n.showFullToolContent!==this.props.showFullToolContent||n.scrollToTimestamp!==this.props.scrollToTimestamp||n.cliMode!==this.props.cliMode||n.terminalVisible!==this.props.terminalVisible||n.userProfile!==this.props.userProfile||n.pendingUploadPaths!==this.props.pendingUploadPaths||n.isStreaming!==this.props.isStreaming||n.hasMoreHistory!==this.props.hasMoreHistory||n.loadingMore!==this.props.loadingMore||n.loadingSessionId!==this.props.loadingSessionId||n.lang!==this.props.lang||n.showThinkingSummaries!==this.props.showThinkingSummaries||n.fileLoading!==this.props.fileLoading||i!==this.state}componentDidUpdate(n,i){if(i.pendingPermission!==this.state.pendingPermission&&this.props.onPendingPermission&&(this.state.pendingPermission?this.props.onPendingPermission({permission:this.state.pendingPermission,handlers:{allow:this.handlePermissionAllow,allowSession:this.props.sdkMode?this.handlePermissionAllowSession:null,deny:this.handlePermissionDeny}}):this.props.onPendingPermission(null)),i.pendingPlanApproval!==this.state.pendingPlanApproval&&this.props.onPendingPlanApproval&&(this.state.pendingPlanApproval?this.props.onPendingPlanApproval({plan:this.state.pendingPlanApproval,handlers:{approve:this.handlePlanApprove,reject:this.handlePlanReject}}):this.props.onPendingPlanApproval(null)),Ft&&i.lastResponseItems!==this.state.lastResponseItems&&this.state.stickyBottom&&(this._stickyScrollLock=!0,requestAnimationFrame(()=>{const r=this._virtuosoScrollerEl;r&&(r.scrollTop=r.scrollHeight),requestAnimationFrame(()=>{this._stickyScrollLock=!1})})),n.isStreaming&&!this.props.isStreaming&&(this.setState({streamingFading:!0}),clearTimeout(this._streamingFadeTimer),this._streamingFadeTimer=setTimeout(()=>{this.setState({streamingFading:!1})},500)),!n.isStreaming&&this.props.isStreaming&&this.state.streamingFading&&(clearTimeout(this._streamingFadeTimer),this.setState({streamingFading:!1})),this.props.pendingUploadPaths&&this.props.pendingUploadPaths.length>0&&this.props.pendingUploadPaths!==n.pendingUploadPaths){for(const r of this.props.pendingUploadPaths){const s=r.replace(/^"|"$/g,"");this._addPendingImage(s,"drop")}this.props.onUploadPathsConsumed&&this.props.onUploadPathsConsumed()}if(n.mainAgentSessions!==this.props.mainAgentSessions){if(this.props.mainAgentSessions!==this._prevSessions){const r=this._prevSessions||[],s=this.props.mainAgentSessions||[];(r.length!==s.length||r.some((a,l)=>a!==s[l]))&&(this._incToolState=null,this._incToolProcessedCount=0,this._incToolSessionIdx=-1,this._reqScanCache={tsToIndex:{},modelName:null,subAgentEntries:[],processedCount:0,subAgentProcessedCount:0}),this._prevSessions=this.props.mainAgentSessions}Ft&&(this._mobileExtraItems=0),this.startRender(),this.state.pendingInput&&this.setState({pendingInput:null}),this._clearPendingImages(),this._updateSuggestion(),this._checkToolFileChanges()}else if(n.requests!==this.props.requests)this._reqScanCache.tsToIndex={},this._reqScanCache.processedCount=0,this._reqScanCache.subAgentEntries=[],this._reqScanCache.subAgentProcessedCount=0,this.startRender();else if(n.collapseToolResults!==this.props.collapseToolResults||n.expandThinking!==this.props.expandThinking){const r=this.buildAllItems(),s=this._applyMobileSlice(r);this.setState({allItems:s,lastResponseItems:this._lastResponseItems,visibleCount:s.length})}if(i.localAskAnswers!==this.state.localAskAnswers&&n.mainAgentSessions===this.props.mainAgentSessions&&n.requests===this.props.requests&&this.startRender(),!n.scrollToTimestamp&&this.props.scrollToTimestamp)if(Ft&&this.props.scrollToTimestamp){const r=this.buildAllItems(),s=this._scrollTargetIdx;if(s!=null){const a=H1+this._mobileExtraItems,l=r.length>a?r.length-a:0;s<l&&(this._mobileExtraItems=r.length-s-H1,this._mobileExtraItems<0&&(this._mobileExtraItems=0))}const o=this._applyMobileSlice(r);this.setState({allItems:o,lastResponseItems:this._lastResponseItems,visibleCount:o.length},()=>this.scrollToBottom())}else{const r=this.buildAllItems(),s=this._applyMobileSlice(r);this.setState({allItems:s,lastResponseItems:this._lastResponseItems,visibleCount:s.length},()=>this.scrollToBottom())}Ft&&this.props.mobileChatVisible&&!n.mobileChatVisible&&requestAnimationFrame(()=>{if(this.virtuosoRef.current)this.virtuosoRef.current.scrollToIndex({index:"LAST"});else{const r=this.containerRef.current;r&&(r.scrollTop=r.scrollHeight)}}),!n.cliMode&&this.props.cliMode&&this.connectInputWs(),Ft||this._rebindStickyEl()}componentWillUnmount(){this._unmounted=!0,window.removeEventListener("ccv-presets-changed",this._onPresetsChanged),this.props.onPendingPermission&&this.props.onPendingPermission(null),this.props.onPendingPlanApproval&&this.props.onPendingPlanApproval(null),this._queueTimer&&clearTimeout(this._queueTimer),this._fadeClearTimer&&clearTimeout(this._fadeClearTimer),this._ptyDebounceTimer&&clearTimeout(this._ptyDebounceTimer),this._fileRefreshTimer&&clearTimeout(this._fileRefreshTimer),this._gitRefreshTimer&&clearTimeout(this._gitRefreshTimer),this._contentRefreshTimer&&clearTimeout(this._contentRefreshTimer),this._wsReconnectTimer&&clearTimeout(this._wsReconnectTimer),this._waitForWsTimer&&clearTimeout(this._waitForWsTimer),this._waitForPtyTimer&&clearTimeout(this._waitForPtyTimer),this._planFeedbackTimer&&clearTimeout(this._planFeedbackTimer),this._streamingFadeTimer&&clearTimeout(this._streamingFadeTimer),this._hookWaitTimer&&clearTimeout(this._hookWaitTimer),this._pendingHookAnswers=null,this._unbindScrollFade(),Ft||this._unbindStickyScroll(),this._inputWs&&(this._inputWs.close(),this._inputWs=null)}startRender(){this._queueTimer&&clearTimeout(this._queueTimer);const n=this.state.stickyBottom;this._stickyScrollLock=!0;const i=this.buildAllItems(),r=this._lastResponseItems,s=this._applyMobileSlice(i);this._prevItemsLen=s.length,this.setState({allItems:s,lastResponseItems:r,visibleCount:s.length,loading:!1},()=>{this.scrollToBottom(n),requestAnimationFrame(()=>{this._stickyScrollLock=!1})})}queueNext(n,i){n>=i||(this._queueTimer=setTimeout(()=>{this.setState({visibleCount:n+1},()=>{this.scrollToBottom(),this.queueNext(n+1,i)})},vLe()))}_isNearBottom(){const n=this.containerRef.current;return n?n.scrollHeight-n.scrollTop-n.clientHeight<=30:!0}scrollToBottom(n){const i=n??this.state.stickyBottom;if(Ft&&this.virtuosoRef.current){if(this._scrollTargetIdx!=null){this.virtuosoRef.current.scrollToIndex({index:this._scrollTargetIdx,align:"center"});const r=this.props.scrollToTimestamp;this._scrollTargetRef=Z.createRef(),r&&(this.setState({highlightTs:r,highlightFading:!1}),this._bindScrollFade()),this.props.onScrollTsDone&&this.props.onScrollTsDone();return}i&&(this.virtuosoRef.current.scrollToIndex({index:"LAST",behavior:"auto"}),this.state.lastResponseItems&&requestAnimationFrame(()=>{const r=this._virtuosoScrollerEl;r&&(r.scrollTop=r.scrollHeight)}));return}if(this._scrollTargetRef.current){const r=this._scrollTargetRef.current,s=this.containerRef.current;s&&r.offsetHeight>s.clientHeight?r.scrollIntoView({block:"start",behavior:"instant"}):r.scrollIntoView({block:"center",behavior:"instant"});const o=this.props.scrollToTimestamp;this._scrollTargetRef=Z.createRef(),o&&(this.setState({highlightTs:o,highlightFading:!1}),this._bindScrollFade()),this.props.onScrollTsDone&&this.props.onScrollTsDone();return}if(i){const r=this.containerRef.current;r&&(r.scrollTop=r.scrollHeight)}}_bindStickyScroll(){this._stickyScrollRafId=null,this._onStickyScroll=()=>{this._stickyScrollLock||this._stickyScrollRafId||(this._stickyScrollRafId=requestAnimationFrame(()=>{this._stickyScrollRafId=null;const n=this.containerRef.current;if(!n)return;const i=n.scrollHeight-n.scrollTop-n.clientHeight;this.state.stickyBottom&&i>50?this.setState({stickyBottom:!1}):!this.state.stickyBottom&&i<=10&&this.setState({stickyBottom:!0})}))},this._rebindStickyEl()}_rebindStickyEl(){const n=this.containerRef.current;n!==this._stickyBoundEl&&(this._stickyBoundEl&&this._stickyBoundEl.removeEventListener("scroll",this._onStickyScroll),this._stickyBoundEl=n,n&&n.addEventListener("scroll",this._onStickyScroll,{passive:!0}))}_unbindStickyScroll(){this._stickyBoundEl&&this._onStickyScroll&&(this._stickyBoundEl.removeEventListener("scroll",this._onStickyScroll),this._stickyBoundEl=null),this._stickyScrollRafId&&(cancelAnimationFrame(this._stickyScrollRafId),this._stickyScrollRafId=null)}_getScrollContainer(){return Ft?this._virtuosoScrollerEl:this.containerRef.current}_bindScrollFade(){this._unbindScrollFade(),this._scrollFadeDelayTimer=setTimeout(()=>{const n=this._getScrollContainer();n&&(this._scrollFadeBoundEl=n,this._onScrollFade=()=>{this.setState({highlightFading:!0}),this._fadeClearTimer=setTimeout(()=>{this.setState({highlightTs:null,highlightFading:!1,highlightVisibleIdx:-1})},2e3),this._unbindScrollFade()},n.addEventListener("scroll",this._onScrollFade,{passive:!0}))},500)}_unbindScrollFade(){this._scrollFadeDelayTimer&&(clearTimeout(this._scrollFadeDelayTimer),this._scrollFadeDelayTimer=null),this._fadeClearTimer&&(clearTimeout(this._fadeClearTimer),this._fadeClearTimer=null),this._onScrollFade&&this._scrollFadeBoundEl&&(this._scrollFadeBoundEl.removeEventListener("scroll",this._onScrollFade),this._scrollFadeBoundEl=null,this._onScrollFade=null)}renderSessionMessages(n,i,r,s){const{userProfile:o,collapseToolResults:a,expandThinking:l,showFullToolContent:c,showThinkingSummaries:d,onViewRequest:u}=this.props;let h=x3(n);if(h&&n.length>this._incToolProcessedCount&&(Gg(h,n,this._incToolProcessedCount),this._incToolProcessedCount=n.length),!h){const x=parseInt(i.slice(1),10);this._incToolSessionIdx===x&&n.length>=this._incToolProcessedCount&&this._incToolProcessedCount>0?Gg(this._incToolState,n,this._incToolProcessedCount):(this._incToolState=zV(),Gg(this._incToolState,n,0),this._incToolSessionIdx=x),this._incToolProcessedCount=n.length,h=this._incToolState,fMe(n,h)}const{toolUseMap:O,toolResultMap:p,readContentMap:m,editSnapshotMap:g,askAnswerMap:v,latestPlanContent:$}=h,b=h._planDirty||0;(this._prevPlanCache!==h.planApprovalMap||this._prevPlanDirty!==b)&&(this._mergedPlanApprovalMap={...h.planApprovalMap},this._prevPlanCache=h.planApprovalMap,this._prevPlanDirty=b);const S=this._mergedPlanApprovalMap||h.planApprovalMap,y=this.props.cliMode&&this.state.ptyPromptHistory.slice().reverse().find(x=>jO(x)&&x.status==="active")||null,Q=this.props.cliMode&&this.state.ptyPromptHistory.slice().reverse().find(x=>rS(x)&&x.status==="active")||null;let _=null,P=null;const C=new Set,X=this.state.localAskAnswers||{},z=(h==null?void 0:h._askDirty)||0;(this._prevAskCache!==v||this._prevLocalAsk!==X||this._prevAskDirty!==z)&&(this._mergedAskAnswerMap=Object.keys(X).length>0?{...v,...X}:v,this._prevAskCache=v,this._prevLocalAsk=X,this._prevAskDirty=z);const T=this._mergedAskAnswerMap;for(const x of n)if(x.role==="assistant"&&Array.isArray(x.content))for(const R of x.content){if(R.type==="tool_use"&&R.name==="ExitPlanMode"){const E=S[R.id];(!E||E.status==="pending")&&(_=R.id)}if(R.type==="tool_use"&&R.name==="AskUserQuestion"){C.add(R.id);const E=T[R.id];(!E||Object.keys(E).length===0)&&(P=R.id)}}const k=[];for(let x=0;x<n.length;x++){const R=n[x],E=R.content,I=R._timestamp||null,A=I?s[I]:void 0,j=A!=null&&u?{requestIndex:A,onViewRequest:u}:mLe;if(R.role==="user"){if(Array.isArray(E)){const N=E.find(B=>B.type==="text"&&/^\[SUGGESTION MODE:/i.test((B.text||"").trim())),L=E.filter(B=>B.type==="tool_result");if(!(N&&L.length>0)){const{commands:B,textBlocks:V,skillBlocks:Y}=$_(E);for(let W=0;W<B.length;W++)k.push(w.jsx(gs,{role:"user",text:B[W],timestamp:I,userProfile:o,modelInfo:r,...j},`${i}-cmd-${x}-${W}`));for(const W of Y){const q=W.text.match(/^#\s+(.+)$/m),ne=q?q[1]:"Skill";k.push(w.jsx(gs,{role:"skill-loaded",text:W.text,skillName:ne,timestamp:I,...j},`${i}-skill-${x}`))}for(let W=0;W<V.length;W++){const q=/Implement the following plan:/i.test(V[W].text||"");k.push(w.jsx(gs,{role:q?"plan-prompt":"user",text:V[W].text,timestamp:I,userProfile:o,modelInfo:r,...j},`${i}-user-${x}-${W}`))}}}else if(typeof E=="string"&&!yv(E)){const N=/Implement the following plan:/i.test(E);k.push(w.jsx(gs,{role:N?"plan-prompt":"user",text:E,timestamp:I,userProfile:o,modelInfo:r,...j},`${i}-user-${x}`))}}else if(R.role==="assistant"){const N=P&&Array.isArray(E)&&E.some(B=>B.type==="tool_use"&&B.name==="AskUserQuestion"&&B.id===P)?P:null,L=_&&Array.isArray(E)&&E.some(B=>B.type==="tool_use"&&B.name==="ExitPlanMode"&&B.id===_)?_:null;Array.isArray(E)?k.push(w.jsx(gs,{role:"assistant",content:E,toolResultMap:p,readContentMap:m,editSnapshotMap:g,askAnswerMap:T,planApprovalMap:S,latestPlanContent:$,timestamp:I,modelInfo:r,collapseToolResults:a,expandThinking:l,showFullToolContent:c,showThinkingSummaries:d,ptyPrompt:this.state.ptyPrompt,activePlanPrompt:y,activeDangerousPrompt:Q,lastPendingPlanId:L,lastPendingAskId:N,onPlanApprovalClick:this.handlePromptOptionClick,onPlanFeedbackSubmit:this.handlePlanFeedbackSubmit,onDangerousApprovalClick:this.handlePromptOptionClick,onAskQuestionSubmit:this.handleAskQuestionSubmit,cliMode:this.props.cliMode,onOpenFile:this.handleOpenToolFilePath,...j},`${i}-asst-${x}`)):typeof E=="string"&&k.push(w.jsx(gs,{role:"assistant",content:[{type:"text",text:E}],toolResultMap:p,readContentMap:m,editSnapshotMap:g,askAnswerMap:T,planApprovalMap:S,latestPlanContent:$,timestamp:I,modelInfo:r,collapseToolResults:a,expandThinking:l,showFullToolContent:c,showThinkingSummaries:d,ptyPrompt:this.state.ptyPrompt,activePlanPrompt:y,activeDangerousPrompt:Q,lastPendingPlanId:L,lastPendingAskId:N,onPlanApprovalClick:this.handlePromptOptionClick,onPlanFeedbackSubmit:this.handlePlanFeedbackSubmit,onDangerousApprovalClick:this.handlePromptOptionClick,onAskQuestionSubmit:this.handleAskQuestionSubmit,cliMode:this.props.cliMode,onOpenFile:this.handleOpenToolFilePath,...j},`${i}-asst-${x}`))}}return k}_buildTeammateFallbackItems(){var u,h,O,p;const{requests:n,collapseToolResults:i,expandThinking:r,showFullToolContent:s,onViewRequest:o}=this.props;if(!n||n.length===0)return[];Y5(n);const a=new Map;for(const m of n){if(!uP(m)||!((h=(u=m.body)==null?void 0:u.messages)!=null&&h.length))continue;const g=m.teammate||"teammate",v=a.get(g);(!v||m.body.messages.length>=v.messages.length)&&a.set(g,{messages:m.body.messages,response:m.response,timestamp:m.timestamp})}if(a.size===0)return[];const l=null,c=[];let d=0;for(const[m,g]of a){c.push(w.jsx(Pb,{className:Vt.sessionDivider,children:w.jsx(F1,{className:Vt.sessionDividerText,children:m})},`tm-div-${d}`));const v=this.renderSessionMessages(g.messages,`tm${d}`,l,{});if(c.push(...v),d===a.size-1&&((p=(O=g.response)==null?void 0:O.body)!=null&&p.content)){const $=g.response.body.content;if(Array.isArray($)){const b=$.filter(S=>S.type==="text"&&S.text).map((S,y)=>w.jsx(gs,{role:"assistant",content:[S],collapseToolResults:i,expandThinking:r,showFullToolContent:s,onViewRequest:o,onOpenFile:this.handleOpenToolFilePath},`tm-resp-${d}-${y}`));b.length>0&&(this._lastResponseItems=b)}}d++}return c}buildAllItems(){var g,v,$,b,S;const{mainAgentSessions:n,requests:i,collapseToolResults:r,expandThinking:s,showFullToolContent:o,onViewRequest:a}=this.props;if(this._lastResponseItems=null,this._lastResponseAskQuestions=null,!n||n.length===0)return this._buildTeammateFallbackItems();const l=this._reqScanCache;if(i){const y=i.length>=l.processedCount?l.processedCount:0;y===0&&(l.tsToIndex={},l.modelName=null);for(let _=y;_<i.length;_++){const P=i[_],C=js(P);C&&P.timestamp&&(l.tsToIndex[P.timestamp]=_),C&&((g=P.body)!=null&&g.model)&&(l.modelName=P.body.model)}l.processedCount=i.length,Y5(i);let Q=l.subAgentProcessedCount||0;if(Q>0&&Q<i.length)for(Q--;l.subAgentEntries.length>0&&l.subAgentEntries[l.subAgentEntries.length-1].requestIndex>=Q;)l.subAgentEntries.pop();for(let _=Q;_<i.length;_++){const P=i[_];if(!P.timestamp)continue;const C=Lx(P,i[_+1]);if(C.type==="SubAgent"||C.type==="Teammate"){const X=($=(v=P.response)==null?void 0:v.body)==null?void 0:$.content;if(Array.isArray(X)&&X.length>0){const z=mMe(((b=P.body)==null?void 0:b.messages)||[]).toolResultMap,T=C.type==="Teammate";l.subAgentEntries.push({timestamp:P.timestamp,content:X,toolResultMap:z,label:T?EV(C.subType,(S=P.body)==null?void 0:S.model):RV(C.type,C.subType),isTeammate:T,requestIndex:_})}}}l.subAgentProcessedCount=i.length}const c=l.tsToIndex,d=S_(l.modelName),u=l.subAgentEntries,h=[],O={};(this.props.hasMoreHistory||this.props.loadingMore)&&h.push(w.jsx("div",{className:Vt.loadMoreWrap,children:this.props.loadingMore?w.jsxs("div",{className:`${Vt.loadMoreBtn} ${Vt.loadMoreBtnLoading}`,children:[w.jsx(Ca,{size:"small",style:{marginRight:8}}),le("ui.loadingMoreHistory")]}):w.jsx("button",{className:Vt.loadMoreBtn,onClick:()=>this.props.onLoadMoreHistory&&this.props.onLoadMoreHistory(),children:le("ui.loadEarlierConversations")})},"load-more-history"));let p=0;n.forEach((y,Q)=>{var P,C,X,z,T;if(Q>0&&h.push(w.jsx(Pb,{className:Vt.sessionDivider,children:w.jsx(F1,{className:Vt.sessionDividerText,children:"Session"})},`session-div-${Q}`)),y._cold){const k=this.props.loadingSessionId===y.sessionId;h.push(w.jsx("div",{className:Vt.loadMoreWrap,children:k?w.jsxs("div",{className:`${Vt.loadMoreBtn} ${Vt.loadMoreBtnLoading}`,children:[w.jsx(Ca,{size:"small",style:{marginRight:8}}),le("ui.loadingMoreHistory")]}):w.jsx("button",{className:Vt.loadMoreBtn,onClick:()=>this.props.onLoadSession&&this.props.onLoadSession(y.sessionId),children:le("ui.loadSessionPlaceholder",{count:y.msgCount})})},`cold-session-${Q}`));return}const _=this.renderSessionMessages(y.messages,`s${Q}`,d,c);for(const k of _){const x=k.props.timestamp;for(;p<u.length&&x&&u[p].timestamp<=x;){const R=u[p];R.timestamp&&(O[R.timestamp]=h.length),h.push(w.jsx(gs,{role:"sub-agent-chat",content:R.content,toolResultMap:R.toolResultMap,label:R.label,isTeammate:R.isTeammate,timestamp:R.timestamp,collapseToolResults:r,expandThinking:s,showFullToolContent:o,requestIndex:R.requestIndex,onViewRequest:a,onOpenFile:this.handleOpenToolFilePath},`sub-${R.requestIndex}-${R.timestamp}`)),p++}x&&(O[x]=h.length),h.push(k)}for(;p<u.length;){const k=u[p],x=Q<n.length-1&&((C=(P=n[Q+1].messages)==null?void 0:P[0])==null?void 0:C._timestamp);if(x&&k.timestamp>x)break;k.timestamp&&(O[k.timestamp]=h.length),h.push(w.jsx(gs,{role:"sub-agent-chat",content:k.content,toolResultMap:k.toolResultMap,label:k.label,isTeammate:k.isTeammate,timestamp:k.timestamp,collapseToolResults:r,expandThinking:s,showFullToolContent:o,requestIndex:k.requestIndex,onViewRequest:a,onOpenFile:this.handleOpenToolFilePath},`sub-${k.requestIndex}-${k.timestamp}`)),p++}if(Q===n.length-1&&((z=(X=y.response)==null?void 0:X.body)!=null&&z.content)){const k=y.response.body.content;if(Array.isArray(k)){const x=k.some(I=>I.type==="tool_use"&&(I.name==="AskUserQuestion"||I.name==="ExitPlanMode"));if(!(k.some(I=>I.type==="text"&&typeof I.text=="string"&&I.text.includes("[SUGGESTION MODE:"))&&!x)){const I=new Set;for(const D of y.messages)if(D.role==="assistant"&&Array.isArray(D.content))for(const ee of D.content)ee.type==="tool_use"&&ee.name==="AskUserQuestion"&&I.add(ee.id);y.entryTimestamp&&(O[y.entryTimestamp]=h.length);let A=null,j=null;const N=this.state.localAskAnswers||{};for(const D of k){if(D.type==="tool_use"&&D.name==="AskUserQuestion"){const ee=N[D.id];(!ee||Object.keys(ee).length===0)&&(A=D.id)}D.type==="tool_use"&&D.name==="ExitPlanMode"&&(j=D.id)}this._lastResponseAskQuestions=new Set;for(const D of k)if(D.type==="tool_use"&&D.name==="AskUserQuestion"){const ee=(T=D.input)==null?void 0:T.questions;if(Array.isArray(ee))for(const fe of ee)fe.question&&this._lastResponseAskQuestions.add(fe.question)}const L=x3(y.messages)||{},B=L.planApprovalMap||{},V=L.latestPlanContent||null,Y=this.props.cliMode&&this.state.ptyPromptHistory.slice().reverse().find(D=>jO(D)&&D.status==="active")||null,W=this.props.cliMode&&this.state.ptyPromptHistory.slice().reverse().find(D=>rS(D)&&D.status==="active")||null,q=k.filter(D=>D.type!=="tool_use"||D.name==="AskUserQuestion"&&!I.has(D.id)||D.name==="ExitPlanMode");if(!q.some(D=>D.type==="text"?typeof D.text=="string"&&D.text.trim().length>0:D.type==="tool_use"?!0:D.type==="thinking"?typeof D.thinking=="string"&&D.thinking.trim().length>0:!1))return;this._lastResponseItems=w.jsxs(Z.Fragment,{children:[w.jsx(Pb,{className:Vt.lastResponseDivider,children:w.jsx(F1,{type:"secondary",className:Vt.lastResponseLabel,children:le("ui.lastResponse")})}),w.jsx(gs,{role:"assistant",content:q,timestamp:y.entryTimestamp,modelInfo:d,collapseToolResults:r,expandThinking:s,showFullToolContent:o,toolResultMap:Z3,askAnswerMap:Object.keys(N).length>0?N:Z3,planApprovalMap:B,latestPlanContent:V,lastPendingAskId:A,lastPendingPlanId:j,activePlanPrompt:Y,activeDangerousPrompt:W,ptyPrompt:this.state.ptyPrompt,onPlanApprovalClick:this.handlePromptOptionClick,onPlanFeedbackSubmit:this.handlePlanFeedbackSubmit,onDangerousApprovalClick:this.handlePromptOptionClick,cliMode:this.props.cliMode,onAskQuestionSubmit:this.handleAskQuestionSubmit,onOpenFile:this.handleOpenToolFilePath},"resp-asst")]},"last-response-group")}}}});const{scrollToTimestamp:m}=this.props;return this._scrollTargetIdx=m&&O[m]!=null?O[m]:null,this._tsItemMap=O,h}_applyMobileSlice(n){if(!Ft)return this._mobileSliceOffset=0,this._totalItemCount=n.length,n;this._totalItemCount=n.length;const i=H1+this._mobileExtraItems;if(n.length<=i)return this._mobileSliceOffset=0,n;const r=n.length-i;if(this._mobileSliceOffset=r,this._scrollTargetIdx!=null&&(this._scrollTargetIdx-=r,this._scrollTargetIdx<0&&(this._scrollTargetIdx=null)),this._tsItemMap){const s={};for(const[o,a]of Object.entries(this._tsItemMap)){const l=a-r;l>=0&&(s[o]=l)}this._tsItemMap=s}return n.slice(r)}_extractSuggestion(){var h;const{mainAgentSessions:n}=this.props;if(!(n!=null&&n.length))return null;const i=n[n.length-1],r=i==null?void 0:i.messages;if(!Array.isArray(r)||r.length===0)return null;const s=r[r.length-1];if((s==null?void 0:s.role)!=="user")return null;const o=s.content;if(!(Array.isArray(o)?o.some(O=>O.type==="text"&&/^\[SUGGESTION MODE:/i.test((O.text||"").trim())):typeof o=="string"&&/^\[SUGGESTION MODE:/im.test(o.trim())))return null;const l=i==null?void 0:i.response;if(!l)return null;const c=l.body;if(!c)return null;const d=c.stop_reason;if(d!=="end_turn"&&d!=="max_tokens")return null;const u=c.content;if(!Array.isArray(u))return null;for(let O=u.length-1;O>=0;O--)if(u[O].type==="text"&&((h=u[O].text)!=null&&h.trim()))return u[O].text.trim();return null}_updateSuggestion(){const n=this._extractSuggestion();this.setState({inputSuggestion:n||null})}_loadPresets(){let n=!1;fetch(pt("/api/claude-settings")).then(i=>i.json()).then(i=>{var r;n=((r=i==null?void 0:i.env)==null?void 0:r.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS)==="1"}).catch(()=>{}).then(()=>{n&&fetch(pt("/api/preferences")).then(i=>i.json()).then(i=>{const r=Array.isArray(i.dismissedBuiltinPresets)?new Set(i.dismissedBuiltinPresets):new Set;let s=[];Array.isArray(i.presetShortcuts)&&(s=i.presetShortcuts.map((a,l)=>typeof a=="string"?{id:Date.now()+l,teamName:"",description:a}:{id:Date.now()+l,teamName:a.teamName||"",description:a.description||"",...a.builtinId?{builtinId:a.builtinId}:{},...a.modified?{modified:!0}:{}}));const o=new Set(s.filter(a=>a.builtinId).map(a=>a.builtinId));for(const a of Ij)r.has(a.builtinId)||o.has(a.builtinId)||s.unshift({id:Date.now()+Math.random(),builtinId:a.builtinId,teamName:a.teamName,description:a.description});this.setState({presetItems:s})}).catch(()=>{})})}connectInputWs(){const i=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`;this._inputWs=new WebSocket(i),this._inputWs.onmessage=r=>{var s,o;try{const a=JSON.parse(r.data);a.type==="data"?this._appendPtyData(a.data):a.type==="exit"?this._clearPtyPrompt():a.type==="ask-hook-pending"?(this._askHookActive=!0,this._askHookQuestions=a.questions):a.type==="ask-hook-timeout"?(this._askHookActive=!1,this._askHookQuestions=null):a.type==="sdk-plan-pending"?this.setState({pendingPlanApproval:{id:a.id,input:a.input}}):a.type==="sdk-ask-pending"?(this._askHookActive=!0,this._askHookQuestions=a.questions,this._sdkAskId=a.id):a.type==="sdk-ask-timeout"?(this._askHookActive=!1,this._askHookQuestions=null,this._sdkAskId=null):a.type==="perm-hook-pending"?this.setState({pendingPermission:{id:a.id,toolName:a.toolName,input:a.input}}):a.type==="perm-hook-timeout"?this.setState({pendingPermission:null}):a.type==="perm-hook-resolved"?((s=this.state.pendingPermission)==null?void 0:s.id)===a.id&&this.setState({pendingPermission:null}):a.type==="ask-hook-resolved"?(this._askHookActive=!1,this._askHookQuestions=null):a.type==="sdk-ask-resolved"?this._sdkAskId===a.id&&(this._askHookActive=!1,this._askHookQuestions=null,this._sdkAskId=null):a.type==="sdk-plan-resolved"?((o=this.state.pendingPlanApproval)==null?void 0:o.id)===a.id&&this.setState({pendingPlanApproval:null}):a.type==="image-upload-notify"?this._addPendingImage(a.path,a.source):a.type==="image-remove-notify"&&a.path&&this.setState(l=>{const c=l.pendingImages.filter(d=>d.path!==a.path);return c.length===l.pendingImages.length?null:{pendingImages:c}})}catch{}},this._inputWs.onclose=()=>{(this.state.pendingPermission||this.state.pendingPlanApproval)&&this.setState({pendingPermission:null,pendingPlanApproval:null}),this._sdkAskId=null,this._askHookActive=!1,this._askHookQuestions=null,this._wsReconnectTimer=setTimeout(()=>{!this._unmounted&&this.splitContainerRef.current&&this.props.cliMode&&this.connectInputWs()},2e3)}}_stripAnsi(n){return n.replace(/\x1b\[[0-9;]*[A-Za-z]/g,"").replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g,"").replace(/\x1b[^[\]](.|$)/g,"").replace(/[\x00-\x08\x0b\x0c\x0e-\x1f]/g,"")}_appendPtyData(n){const i=this._stripAnsi(n);this._ptyBuffer+=i,this._ptyDataSeq++,this._ptyBuffer.length>4096&&(this._ptyBuffer=this._ptyBuffer.slice(-4096)),this._ptyDebounceTimer&&clearTimeout(this._ptyDebounceTimer),this._ptyDebounceTimer=setTimeout(()=>this._detectPrompt(),200)}_detectPrompt(){const n=this._ptyBuffer.trimEnd();let i=null,r=null;const s=n.match(/([^\n]*\?)\s*\n((?:\s*[❯>]?\s*\d+\.\s+[^\n]+\n?){2,})(?:\n[^\d❯>\n][^\n]*)?$/);if(s){i=s[1].trim();const o=s[2].match(/\s*([❯>])?\s*(\d+)\.\s+([^\n]+)/g);o&&(r=o.map(a=>{const l=a.match(/\s*([❯>])?\s*(\d+)\.\s+(.+)/);return{number:parseInt(l[2],10),text:l[3].trim(),selected:!!l[1]}}))}if(!r){const o=n.match(/([^\n]+)\n((?:\s+[❯>]?\s+[^\n]+\n?){2,})(?:\n[^\s❯>\n][^\n]*)?$/);if(o){const a=o[1].trim(),c=o[2].split(`
1104
1104
  `).filter(u=>u.trim()),d=[];for(const u of c){const h=u.match(/^\s*([❯>])?\s+(.+)/);h&&h[2].trim()&&d.push({number:d.length+1,text:h[2].trim(),selected:!!h[1]})}d.length>=2&&d.some(u=>u.selected)&&(i=a,r=d)}}if(i&&r){if(/^[■\s]*[~\/.:]/.test(i)&&/\//.test(i)||/^[*■✦⏎]/.test(i))return;const o=this.state.ptyPrompt,a={question:i,options:r};o&&o.question===i?(this._currentPtyPrompt=a,this.setState({ptyPrompt:a})):(this._currentPtyPrompt=a,this.setState(l=>{const c=l.ptyPromptHistory.slice();if(l.ptyPrompt){const d=c[c.length-1];d&&d.status==="active"&&(c[c.length-1]={...d,status:"dismissed"})}return c.push({...a,status:"active",selectedNumber:null,timestamp:new Date().toISOString()}),c.length>200&&c.splice(0,c.length-200),{ptyPrompt:a,ptyPromptHistory:c}}),this.scrollToBottom());return}if(this.state.ptyPrompt){if(jO(this.state.ptyPrompt)||rS(this.state.ptyPrompt)||this._askSubmitting)return;this._currentPtyPrompt=null,this.setState(o=>{const a=o.ptyPromptHistory.slice(),l=a[a.length-1];return l&&l.status==="active"&&(a[a.length-1]={...l,status:"dismissed"}),{ptyPrompt:null,ptyPromptHistory:a}})}}_clearPtyPrompt(){this._ptyBuffer="",this._currentPtyPrompt=null,this._ptyDebounceTimer&&clearTimeout(this._ptyDebounceTimer),this.state.ptyPrompt&&this.setState({ptyPrompt:null})}_planSubmissionSteps(n){return n.map((i,r)=>({...i,isLast:r===n.length-1}))}_waitForHookBridge(){if(!this._unmounted){if(this._askHookActive){const n=this._pendingHookAnswers;this._pendingHookAnswers=null,this._submitViaHookBridge(n);return}if(this._askHookWaitRetries=(this._askHookWaitRetries||0)+1,this._askHookWaitRetries>30){const n=this._pendingHookAnswers;this._pendingHookAnswers=null,this._submitViaPty(n);return}this._hookWaitTimer=setTimeout(()=>this._waitForHookBridge(),100)}}_submitViaPty(n){const i=this._inputWs;if(!i||i.readyState!==WebSocket.OPEN){this._askAnswerQueue=this._planSubmissionSteps(n),this._askSubmitting=!0,this._isMultiQuestionForm=n.length>1,this.connectInputWs(),this._askWsRetries=0,this._waitForWsAndSubmit();return}if(this._askAnswerQueue=this._planSubmissionSteps(n),this._askSubmitting=!0,this._isMultiQuestionForm=n.length>1,!this._currentPtyPrompt){this._askPromptRetries=0,this._waitForPtyPromptAndSubmit();return}this._processNextAskAnswer()}_waitForWsAndSubmit(){if(this._askWsRetries=(this._askWsRetries||0)+1,this._askWsRetries>30){this._askSubmitting=!1,this._askAnswerQueue=[];return}if(this._inputWs&&this._inputWs.readyState===WebSocket.OPEN){this._currentPtyPrompt?this._processNextAskAnswer():(this._askPromptRetries=0,this._waitForPtyPromptAndSubmit());return}this._waitForWsTimer=setTimeout(()=>this._waitForWsAndSubmit(),100)}_waitForPtyPromptAndSubmit(){if(this._askPromptRetries=(this._askPromptRetries||0)+1,this._askPromptRetries>50){this._processNextAskAnswer();return}if(this._currentPtyPrompt){this._processNextAskAnswer();return}this._waitForPtyTimer=setTimeout(()=>this._waitForPtyPromptAndSubmit(),100)}_processNextAskAnswer(){if(!this._askAnswerQueue||this._askAnswerQueue.length===0){this._askSubmitting=!1;return}const n=this._askAnswerQueue.shift();if(n.type==="other"&&n.isMultiSelect){this._submitViaSequentialQueue(n,{settleMs:500});return}n.type==="other"?this._submitOtherAnswer(n):n.type==="multi"?this._submitMultiSelectAnswer(n):this._submitSingleSelectAnswer(n)}_submitSingleSelectAnswer(n){this._submitViaSequentialQueue(n)}_submitMultiSelectAnswer(n){this._submitViaSequentialQueue(n)}_submitOtherAnswer(n){this._submitViaSequentialQueue(n)}_submitViaSequentialQueue(n,i={}){const r=this._inputWs;if(!r||r.readyState!==WebSocket.OPEN){this._askSubmitting=!1;return}const s=!!this._isMultiQuestionForm,o=OMe(n,this.state.ptyPrompt,s),a=i.settleMs||300,l=c=>{try{JSON.parse(c.data).type==="input-sequential-done"&&(r.removeEventListener("message",l),this._finishCurrentAskAnswer())}catch{}};r.addEventListener("message",l),r.send(JSON.stringify({type:"input-sequential",chunks:o,settleMs:a})),setTimeout(()=>{r.removeEventListener("message",l),this._askSubmitting&&this._finishCurrentAskAnswer()},15e3)}_finishCurrentAskAnswer(){this._currentPtyPrompt=null,this.setState(n=>{const i=n.ptyPromptHistory.slice(),r=i[i.length-1];return r&&r.status==="active"&&(i[i.length-1]={...r,status:"answered"}),{ptyPrompt:null,ptyPromptHistory:i}}),(!this._askAnswerQueue||this._askAnswerQueue.length===0)&&this._ptyDebounceTimer&&clearTimeout(this._ptyDebounceTimer),this._askAnswerQueue&&this._askAnswerQueue.length>0?setTimeout(()=>{this._processNextAskAnswer()},500):this._askSubmitting=!1}_submitViaHookBridge(n){var o,a;const i=this._inputWs;if(!i||i.readyState!==WebSocket.OPEN){this._askHookActive=!1,this._askHookQuestions=null,this._submitViaPty(n);return}this._askSubmitting=!0;const r=this._askHookQuestions||[],s={};for(const l of n){const c=r[l.questionIndex];if(!c)continue;const d=c.question;if(l.type==="other")s[d]=l.text||"";else if(l.type==="multi"){const u=(l.selectedIndices||[]).map(h=>{var O,p;return(p=(O=c.options)==null?void 0:O[h])==null?void 0:p.label}).filter(Boolean);s[d]=u.join(", ")}else s[d]=((a=(o=c.options)==null?void 0:o[l.optionIndex])==null?void 0:a.label)||""}i.send(JSON.stringify({type:"ask-hook-answer",answers:s})),this._askSubmitting=!1,this._currentPtyPrompt=null,this.setState(l=>{const c=l.ptyPromptHistory.slice(),d=c[c.length-1];return d&&d.status==="active"&&(c[c.length-1]={...d,status:"answered"}),{ptyPrompt:null,ptyPromptHistory:c}}),this._ptyDebounceTimer&&clearTimeout(this._ptyDebounceTimer)}_snapToInitialPosition(){this.setState({terminalWidth:468,needsInitialSnap:!1}),localStorage.setItem("cc-viewer-terminal-width","468")}_buildUserPromptNav(){const n=this._currentVisible;if(!n||n.length===0)return null;if(this._navCacheVisible===n&&this._navCacheResult)return this._navCacheResult;const i=[],r=new Set;for(let o=0;o<n.length;o++){const a=n[o].props;if(!a||a.role!=="user")continue;const l=a.text||"";if(!l)continue;const c=l.replace(/\[Image(?:\s*#\d+)?(?::?\s*source)?:\s*[^\]]+\]/gi,"").replace(/"\/tmp\/cc-viewer-uploads\/[^"]+"/g,"").trim();if(!c)continue;const d=c.substring(0,100);if(r.has(d))continue;r.add(d);const u=c.length>80?c.substring(0,80)+"...":c;i.push({display:u,visibleIdx:o,timestamp:a.timestamp||null})}if(i.length===0)return this._navCacheVisible=n,this._navCacheResult=null,null;const s=w.jsx("div",{className:Vt.userPromptNavList,children:i.map((o,a)=>w.jsx("div",{className:Vt.userPromptNavItem,onClick:()=>this._scrollToUserPrompt(o.visibleIdx,o.timestamp),children:o.display},o.visibleIdx))});return this._navCacheVisible=n,this._navCacheResult=s,s}_scrollToUserPrompt(n,i){n==null||n<0||(i?this.setState({highlightTs:i,highlightFading:!1,highlightVisibleIdx:n},()=>{this._doScrollToVisibleIdx(n),this._bindScrollFade()}):this._doScrollToVisibleIdx(n))}_doScrollToVisibleIdx(n){if(Ft&&this.virtuosoRef.current)this.virtuosoRef.current.scrollToIndex({index:n,align:"center",behavior:"smooth"});else{const i=this.containerRef.current;i&&i.children[n]&&i.children[n].scrollIntoView({behavior:"smooth",block:"center"})}}render(){var L,B,V,Y;const{mainAgentSessions:n,cliMode:i,terminalVisible:r,onToggleTerminal:s}=this.props,{allItems:o,visibleCount:a,loading:l,terminalWidth:c,sidebarWidth:d,lastResponseItems:u}=this.state;let h=0;if(this.state.isDragging){if(this._dragTarget==="sidebar")h=d;else if(this._dragTarget==="terminal"){const W=this.innerSplitRef.current;W&&(h=W.getBoundingClientRect().width-c-5)}}const p=(!n||n.length===0)&&(!o||o.length===0);if(p&&!i)return this.props.fileLoading?null:w.jsx("div",{className:Vt.centerEmpty,children:w.jsx(Ls,{description:le("ui.noChat")})});if(l&&!i)return w.jsx("div",{className:Vt.centerEmpty,children:w.jsx(Ca,{size:"large"})});const m=new Map,g=this.props.userProfile,v=this._reqScanCache?S_(this._reqScanCache.modelName):null;for(const W of o){if(!W||!W.props)continue;const q=W.props.role;if(q==="user"||q==="plan-prompt")m.has("user")||m.set("user",{key:"user",name:(g==null?void 0:g.name)||"User",avatarType:"user",color:"rgba(255,255,255,0.1)",avatarImg:(g==null?void 0:g.avatar)||null});else if(q==="assistant")m.has("assistant")||m.set("assistant",{key:"assistant",name:(v==null?void 0:v.short)||(v==null?void 0:v.name)||"Claude",avatarType:"agent",color:(v==null?void 0:v.color)||"rgba(255,255,255,0.1)",avatarSvg:(v==null?void 0:v.svg)||null});else if(q==="sub-agent-chat"){const ne=W.props.label||"SubAgent",D=`sub:${ne}`;if(!m.has(D)){const ee=W.props.isTeammate;let fe="sub";if(ee)fe="teammate";else{const te=ne.match(/SubAgent:\s*(\w+)/i),oe=te?te[1].toLowerCase():"";oe==="explore"||oe==="search"?fe="sub-search":oe==="plan"&&(fe="sub-plan")}const se=ee?Bu(ne):null;m.set(D,{key:D,name:ne.length>12?ne.slice(0,12)+"…":ne,avatarType:fe,avatarSvg:se?se.svg:void 0,color:se?se.color:"rgba(255,255,255,0.1)"})}}}const $=Array.from(m.values());let b=o;const S=this.state.roleFilterSelected.size;S>0&&S<$.length&&(b=o.filter(W=>{if(!W||!W.props)return!0;const q=W.props.role;if(q==="user"||q==="plan-prompt")return this.state.roleFilterSelected.has("user");if(q==="assistant")return this.state.roleFilterSelected.has("assistant");if(q==="sub-agent-chat"){const ne=`sub:${W.props.label||"SubAgent"}`;return this.state.roleFilterSelected.has(ne)}return!1}));const y=S>0&&S<$.length,Q=u&&y&&!this.state.roleFilterSelected.has("assistant")?null:u,_=this._scrollTargetIdx,{highlightTs:P,highlightFading:C,highlightVisibleIdx:X}=this.state,z=b.slice(0,y?b.length:a);this._currentVisible=z;const T=X>=0&&X<z.length?X:P!=null?z.findIndex(W=>{var q;return((q=W.props)==null?void 0:q.timestamp)===P}):-1,{pendingInput:k,stickyBottom:x,ptyPromptHistory:R}=this.state,E=i&&k?w.jsx(gs,{role:"user",text:k,timestamp:new Date().toISOString(),userProfile:this.props.userProfile},"pending-input"):null,I=x?null:w.jsxs("button",{className:Vt.stickyBottomBtn,onClick:this.handleStickToBottom,children:[w.jsx("span",{children:le("ui.stickyBottom")}),w.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),A=Ft&&this._mobileSliceOffset>0?w.jsx("div",{className:Vt.loadMoreWrap,children:w.jsx("button",{className:Vt.loadMoreBtn,onClick:this.handleLoadMore,children:le("ui.loadMoreHistory",{count:this._mobileSliceOffset})})}):null,j=this.state.roleFilterOpen&&$.length>0?w.jsx(Eje,{roles:$,selectedRoles:this.state.roleFilterSelected,onToggle:W=>this.setState(q=>{const ne=new Set(q.roleFilterSelected);return ne.has(W)?ne.delete(W):ne.add(W),{roleFilterSelected:ne}})}):null,N=p||l?w.jsxs("div",{className:Vt.messageListWrap,children:[w.jsxs("div",{ref:this.containerRef,className:Vt.container,children:[!i||l?w.jsx("div",{className:Vt.centerEmpty,children:l?w.jsx(Ca,{size:"large"}):w.jsx(Ls,{description:le("ui.noChat")})}):null,E]}),I]}):w.jsxs("div",{className:Vt.messageListWrap,onClick:this.handleMdImageClick,children:[j,this.state.mdLightboxSrc&&w.jsx(QP,{src:this.state.mdLightboxSrc,alt:"",onClose:()=>this.setState({mdLightboxSrc:null})}),Ft?(this._virtuosoHeader=A,this._virtuosoFooter=w.jsxs(w.Fragment,{children:[w.jsx("div",{className:`${Vt.streamingSpinnerWrap}${this.props.isStreaming?"":" "+Vt.streamingSpinnerHidden}`,children:w.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",children:[w.jsx("defs",{children:w.jsxs("linearGradient",{id:"ccv-spinnerGrad",x1:"0",y1:"0",x2:"1",y2:"1",children:[w.jsx("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"1"}),w.jsx("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0.1"})]})}),w.jsx("circle",{cx:"10",cy:"10",r:"7.5",fill:"none",strokeWidth:"2",stroke:"url(#ccv-spinnerGrad)",strokeLinecap:"round",pathLength:"100",strokeDasharray:"75 25",children:w.jsx("animateTransform",{attributeName:"transform",type:"rotate",from:"0 10 10",to:"360 10 10",dur:"0.8s",repeatCount:"indefinite"})})]})}),Q,E]}),w.jsx(QWe,{ref:this.virtuosoRef,className:Vt.mobileVirtuoso,data:z,initialTopMostItemIndex:Math.max(0,z.length-1),followOutput:this.state.stickyBottom?"smooth":!1,atBottomStateChange:W=>{if(!this._stickyScrollLock){if(!W&&this.state.stickyBottom&&this._virtuosoScrollerEl){const q=this._virtuosoScrollerEl;if(q.scrollHeight-q.scrollTop-q.clientHeight<=60)return}W!==this.state.stickyBottom&&this.setState({stickyBottom:W})}},atBottomThreshold:60,increaseViewportBy:{top:400,bottom:200},computeItemKey:W=>{var q;return((q=z[W])==null?void 0:q.key)||`v-${W}`},itemContent:W=>{const q=z[W],ne=W===_,D=W===T;let ee=q;return D&&(ee=Z.cloneElement(ee,{highlight:C?"fading":"active"})),ne?w.jsx("div",{ref:this._scrollTargetRef,children:ee}):ee},scrollerRef:W=>{this._virtuosoScrollerEl=W},context:{header:this._virtuosoHeader,footer:this._virtuosoFooter},components:this._virtuosoComponents||(this._virtuosoComponents={Scroller:gLe,Header:({context:W})=>W.header,Footer:({context:W})=>W.footer})})):w.jsxs("div",{ref:this.containerRef,className:Vt.container,children:[A,z.map((W,q)=>{const ne=q===_,D=q===T;let ee=W;return D&&(ee=Z.cloneElement(ee,{highlight:C?"fading":"active"})),ne?w.jsx("div",{ref:this._scrollTargetRef,children:ee},W.key+"-anchor"):ee}),w.jsx("div",{className:`${Vt.streamingSpinnerWrap}${this.props.isStreaming?"":" "+Vt.streamingSpinnerHidden}`,children:w.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",children:[w.jsx("defs",{children:w.jsxs("linearGradient",{id:"ccv-spinnerGrad-desktop",x1:"0",y1:"0",x2:"1",y2:"1",children:[w.jsx("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"1"}),w.jsx("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0.1"})]})}),w.jsx("circle",{cx:"10",cy:"10",r:"7.5",fill:"none",strokeWidth:"2",stroke:"url(#ccv-spinnerGrad-desktop)",strokeLinecap:"round",pathLength:"100",strokeDasharray:"75 25",children:w.jsx("animateTransform",{attributeName:"transform",type:"rotate",from:"0 10 10",to:"360 10 10",dur:"0.8s",repeatCount:"indefinite"})})]})}),Q&&(_!=null&&_>=z.length?w.jsx("div",{ref:this._scrollTargetRef,children:Q},"last-resp-anchor"):Q),E]}),I]});return i?w.jsxs(w.Fragment,{children:[w.jsxs("div",{ref:this.splitContainerRef,className:Vt.splitContainer,children:[w.jsxs("div",{className:Vt.navSidebar,children:[w.jsx("button",{className:this.state.roleFilterOpen?Vt.navBtnActive:Vt.navBtn,onClick:()=>this.setState(W=>W.roleFilterOpen?{roleFilterOpen:!1,roleFilterSelected:new Set}:{roleFilterOpen:!0}),title:le("ui.roleFilter"),children:w.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})})}),w.jsx("button",{className:this.state.fileExplorerOpen?Vt.navBtnActive:Vt.navBtn,onClick:()=>{this._setFileExplorerOpen(!this.state.fileExplorerOpen),this.setState({gitChangesOpen:!1})},title:le("ui.fileExplorer"),children:w.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 2h9a2 2 0 0 1 2 2z"})})}),w.jsx("button",{className:this.state.gitChangesOpen?Vt.navBtnActive:Vt.navBtn,onClick:()=>this.setState(W=>(this._setFileExplorerOpen(!1),{gitChangesOpen:!W.gitChangesOpen})),title:le("ui.gitChanges"),children:w.jsx("svg",{width:"24",height:"24",viewBox:"0 0 1024 1024",fill:"currentColor",children:w.jsx("path",{d:"M759.53332137 326.35000897c0-48.26899766-39.4506231-87.33284994-87.87432908-86.6366625-46.95397689 0.69618746-85.08957923 39.14120645-85.39899588 86.09518335-0.23206249 40.68828971 27.53808201 74.87882971 65.13220519 84.47074592 10.82958281 2.78474987 18.41029078 12.37666607 18.64235327 23.51566553 0.38677082 21.11768647-3.40358317 44.40128953-17.24997834 63.81718442-22.20064476 31.17372767-62.42480948 42.46743545-97.93037026 52.44612248-22.43270724 6.26568719-38.75443563 7.89012462-53.14230994 9.28249954-20.42149901 2.01120825-39.76003975 3.94506233-63.89453858 17.79145747-5.10537475 2.93945818-10.13339535 6.18833303-14.85199928 9.74662453-4.09977063 3.09416652-9.90133285 0.15470833-9.90133286-4.95066641V302.60228095c0-9.43720788 5.26008307-18.17822829 13.69168683-22.3553531 28.69839444-14.23316598 48.42370599-43.93716454 48.19164353-78.20505872-0.38677082-48.57841433-41.15241468-87.71962076-89.730829-86.01782918C338.80402918 117.57112321 301.59667683 155.70672553 301.59667683 202.58334827c0 34.03583169 19.64795738 63.50776777 48.1916435 77.66357958 8.43160375 4.17712479 13.69168685 12.76343689 13.69168684 22.12329062v419.02750058c0 9.43720788-5.26008307 18.17822829-13.69168684 22.3553531-28.69839444 14.23316598-48.42370599 43.93716454-48.1916435 78.20505872 0.30941665 48.57841433 41.07506052 87.6422666 89.65347484 86.01782918C437.74000359 906.42887679 474.87000179 868.2159203 474.87000179 821.41665173c0-34.03583169-19.64795738-63.50776777-48.1916435-77.66357958-8.43160375-4.17712479-13.69168685-12.76343689-13.69168684-22.12329062v-14.85199926c0-32.48874844 15.39347842-63.27570528 42.00331048-81.91805854 2.39797906-1.70179159 4.95066642-3.32622901 7.50335379-4.79595812 14.92935344-8.58631209 25.91364457-9.66927037 44.09187287-11.4484161 15.62554091-1.54708326 35.04143581-3.48093734 61.65126786-10.90693699 39.06385228-10.98429114 92.51557887-25.91364457 124.84961898-71.39789238 18.56499911-26.06835292 27.38337367-58.01562219 26.37776956-95.14562041-0.15470833-5.33743724-0.54147915-10.67487447-1.08295828-16.16702004-0.85089578-8.27689543 2.70739569-16.24437421 9.12779121-21.50445729 19.57060322-15.78024923 32.02462345-39.99210223 32.02462345-67.14341343zM351.1033411 202.58334827c0-20.49885317 16.63114503-37.12999821 37.1299982-37.1299982s37.12999821 16.63114503 37.12999821 37.1299982-16.63114503 37.12999821-37.12999821 37.1299982-37.12999821-16.63114503-37.1299982-37.1299982z m74.25999641 618.83330346c0 20.49885317-16.63114503 37.12999821-37.12999821 37.1299982s-37.12999821-16.63114503-37.1299982-37.1299982 16.63114503-37.12999821 37.1299982-37.1299982 37.12999821 16.63114503 37.12999821 37.1299982z m247.53332139-457.93664456c-20.49885317 0-37.12999821-16.63114503-37.1299982-37.1299982s16.63114503-37.12999821 37.1299982-37.12999821 37.12999821 16.63114503 37.1299982 37.12999821-16.63114503 37.12999821-37.1299982 37.1299982z"})})}),w.jsx(w3,{requests:this.props.requests,onOpenSession:W=>this.setState({teamModalSession:W}),navBtnClass:Vt.navBtn}),w.jsx(Sl,{content:this._buildUserPromptNav(),trigger:"hover",placement:"rightTop",overlayStyle:{maxWidth:400},children:w.jsx("button",{className:Vt.navBtn,title:le("ui.userPromptNav"),children:w.jsx("img",{src:((L=this.props.userProfile)==null?void 0:L.avatar)||wv,className:Vt.navAvatarImg,alt:"User",onError:W=>{W.target.onerror=null,W.target.src=wv}})})})]}),w.jsxs("div",{className:Vt.innerSplitArea,ref:this.innerSplitRef,children:[w.jsx(Qje,{isDragging:this.state.isDragging,activeSnapLine:this.state.activeSnapLine,snapLines:this.state.snapLines,currentLeft:h}),this.state.fileExplorerOpen&&w.jsx(b_e,{style:{width:this.state.sidebarWidth},refreshTrigger:this.state.fileExplorerRefresh,onClose:()=>this._setFileExplorerOpen(!1),onFileClick:W=>this.setState({currentFile:W,currentGitDiff:null,scrollToLine:null}),expandedPaths:this.state.fileExplorerExpandedPaths,onToggleExpand:this.handleToggleExpandPath,currentFile:this.state.currentFile,onFileRenamed:(W,q)=>{this.setState(ne=>({currentFile:ne.currentFile===W?q:ne.currentFile,fileExplorerRefresh:ne.fileExplorerRefresh+1}))}}),this.state.gitChangesOpen&&w.jsx(G7e,{style:{width:this.state.sidebarWidth},refreshTrigger:this.state.gitChangesRefresh,onClose:()=>this.setState({gitChangesOpen:!1}),onFileClick:W=>this.setState({currentGitDiff:W,currentFile:null}),onOpenFile:W=>{const q=W.split("/"),ne=[];for(let D=1;D<q.length;D++)ne.push(q.slice(0,D).join("/"));this._setFileExplorerOpen(!0),this.setState(D=>{const ee=new Set(D.fileExplorerExpandedPaths);return ne.forEach(fe=>ee.add(fe)),{currentGitDiff:null,currentFile:W,scrollToLine:null,gitChangesOpen:!1,fileExplorerExpandedPaths:ee}})}}),(this.state.fileExplorerOpen||this.state.gitChangesOpen)&&w.jsx("div",{className:Vt.vResizer,onMouseDown:this.handleSidebarMouseDown}),w.jsx("div",{className:Vt.chatSection,children:w.jsxs("div",{className:Vt.chatSectionFlex,children:[this.state.currentGitDiff&&w.jsx("div",{className:Vt.overlayPanel,children:w.jsx(LAe,{filePath:this.state.currentGitDiff,onClose:()=>this.setState({currentGitDiff:null}),onOpenFile:(W,q)=>{const ne=W.split("/"),D=[];for(let ee=1;ee<ne.length;ee++)D.push(ne.slice(0,ee).join("/"));this._setFileExplorerOpen(!0),this.setState(ee=>{const fe=new Set(ee.fileExplorerExpandedPaths);return D.forEach(se=>fe.add(se)),{currentGitDiff:null,currentFile:W,scrollToLine:q||1,gitChangesOpen:!1,fileExplorerExpandedPaths:fe}})}})}),this.state.currentFile&&w.jsx("div",{className:Vt.overlayPanel,children:pV(this.state.currentFile)?w.jsx(Q7e,{filePath:this.state.currentFile,editorSession:!!this.state.editorSessionId,onClose:()=>{this.state.editorSessionId&&fetch(pt("/api/editor-done"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:this.state.editorSessionId})}).catch(()=>{}),this.setState({currentFile:null,fileVersion:0,editorSessionId:null,editorFilePath:null})}},this.state.fileVersion):w.jsx(i7e,{filePath:this.state.currentFile,scrollToLine:this.state.scrollToLine,editorSession:!!this.state.editorSessionId,onClose:()=>{this.state.editorSessionId&&fetch(pt("/api/editor-done"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:this.state.editorSessionId})}).catch(()=>{}),this.setState({currentFile:null,fileVersion:0,editorSessionId:null,editorFilePath:null})}},this.state.fileVersion)}),N,!this.props.onPendingPermission&&w.jsx(Q3,{toolName:(B=this.state.pendingPermission)==null?void 0:B.toolName,toolInput:(V=this.state.pendingPermission)==null?void 0:V.input,requestId:(Y=this.state.pendingPermission)==null?void 0:Y.id,onAllow:this.handlePermissionAllow,onAllowSession:this.props.sdkMode?this.handlePermissionAllowSession:null,onDeny:this.handlePermissionDeny,visible:!!this.state.pendingPermission}),!this.props.onPendingPlanApproval&&this.state.pendingPlanApproval&&w.jsx(Q3,{toolName:"ExitPlanMode",toolInput:this.state.pendingPlanApproval.input,requestId:this.state.pendingPlanApproval.id,onAllow:this.handlePlanApprove,onDeny:W=>this.handlePlanReject(W,""),visible:!0}),w.jsx(ONe,{inputRef:this._inputRef,inputEmpty:this.state.inputEmpty,inputSuggestion:this.state.inputSuggestion,terminalVisible:r,onKeyDown:this.handleInputKeyDown,onChange:this.handleInputChange,onSend:this.handleInputSend,onSuggestionClick:this.handleSuggestionToTerminal,onUploadPath:this.handleUploadPath,presetItems:this.state.presetItems,onPresetSend:this.handlePresetSend,onOpenPresetModal:()=>this.setState({mobilePresetModalVisible:!0}),isStreaming:this.props.isStreaming,streamingFading:this.state.streamingFading,pendingImages:this.state.pendingImages,onRemovePendingImage:this._removePendingImage})]})}),i&&!this.props.sdkMode&&s&&w.jsx("div",{className:Vt.terminalToggle,onClick:s,title:le(r?"ui.collapseTerminal":"ui.expandTerminal"),children:w.jsx("svg",{viewBox:"0 0 8 24",width:"8",height:"24",children:r?w.jsx("path",{d:"M4 8 L7 12 L4 16",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}):w.jsx("path",{d:"M4 8 L1 12 L4 16",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})}),r&&w.jsxs(w.Fragment,{children:[w.jsx("div",{className:Vt.vResizer,onMouseDown:this.handleSplitMouseDown}),w.jsx("div",{className:Vt.terminalPanelWrap,style:{width:c},children:w.jsx(n_e,{onEditorOpen:(W,q)=>{this.setState({editorSessionId:W,editorFilePath:q,currentFile:q,currentGitDiff:null,scrollToLine:null,fileVersion:(this.state.fileVersion||0)+1})},onFilePath:W=>{this._addPendingImage(W,"terminal")},pendingImages:this.state.pendingImages,onRemovePendingImage:this._removePendingImage,onClearPendingImages:this._clearPendingImages})})]})]})]}),w.jsx(P3,{session:this.state.teamModalSession,requests:this.props.requests,mainAgentSessions:this.props.mainAgentSessions,collapseToolResults:this.props.collapseToolResults,expandThinking:this.props.expandThinking,showFullToolContent:this.props.showFullToolContent,userProfile:this.props.userProfile,onViewRequest:this.props.onViewRequest,onClose:()=>this.setState({teamModalSession:null})}),w.jsx(fNe,{open:this.state.mobilePresetModalVisible,onClose:()=>this.setState({mobilePresetModalVisible:!1}),items:this.state.presetItems,onItemsChange:W=>this.setState({presetItems:W})})]}):w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:Vt.splitContainer,children:[w.jsxs("div",{className:Vt.navSidebar,children:[w.jsx("button",{className:this.state.roleFilterOpen?Vt.navBtnActive:Vt.navBtn,onClick:()=>this.setState(W=>W.roleFilterOpen?{roleFilterOpen:!1,roleFilterSelected:new Set}:{roleFilterOpen:!0}),title:le("ui.roleFilter"),children:w.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})})}),w.jsx(w3,{requests:this.props.requests,onOpenSession:W=>this.setState({teamModalSession:W}),navBtnClass:Vt.navBtn})]}),w.jsx("div",{className:Vt.navSidebarContent,children:N})]}),w.jsx(P3,{session:this.state.teamModalSession,requests:this.props.requests,mainAgentSessions:this.props.mainAgentSessions,collapseToolResults:this.props.collapseToolResults,expandThinking:this.props.expandThinking,showFullToolContent:this.props.showFullToolContent,userProfile:this.props.userProfile,onViewRequest:this.props.onViewRequest,onClose:()=>this.setState({teamModalSession:null})})]})}}const $Le="_helpBtn_1jfv0_1",bLe="_modalBody_1jfv0_25",SLe="_spinWrap_1jfv0_124",K1={helpBtn:$Le,modalBody:bLe,spinWrap:SLe},yLe=new Set(["Tool-Bash","Tool-Read","Tool-Edit","Tool-Write","Tool-Glob","Tool-Grep","Tool-NotebookEdit","Tool-WebFetch","Tool-WebSearch","Tool-Task","Tool-Agent","Tool-TaskOutput","Tool-TaskStop","Tool-TaskCreate","Tool-TaskGet","Tool-TaskUpdate","Tool-TaskList","Tool-TeamCreate","Tool-TeamDelete","Tool-SendMessage","SubAgent-Search","Tool-EnterPlanMode","Tool-ExitPlanMode","Tool-AskUserQuestion","Tool-Skill","Tool-getDiagnostics","Tool-executeCode","Tool-EnterWorktree","MainAgent","Teammate","BodyFields","ResponseFields","Tools","ToolsFirst","CacheRebuild","BodyDiffJSON","TranslateContextPollution","KVCacheContent","ProxySwitch","GlobalSettings"]);function wDe({doc:t,zIndex:e}){const[n,i]=f.useState(!1),[r,s]=f.useState(!1),[o,a]=f.useState(""),[l,c]=f.useState("");if(!t||!yLe.has(t))return null;const d=f.useCallback(async()=>{i(!0),s(!0),a(""),c(t);const h=m_();let O=null;try{const p=await fetch(pt(`/api/concept?lang=${h}&doc=${encodeURIComponent(t)}`));p.ok&&(O=await p.text())}catch{}if(O){const p=O.match(/^#\s+(.+)/m);p&&c(p[1]),a(bo(O))}else a("<p>Document not found.</p>");s(!1)},[t]),u=Ft?{header:{padding:"8px 12px",margin:0},body:{maxHeight:"80vh",overflow:"auto",padding:"8px 10px"},content:{padding:0}}:{body:{padding:"16px 24px 24px",background:"var(--bg-container)",borderRadius:"4px"},content:{padding:"12px 20px"}};return w.jsxs(w.Fragment,{children:[w.jsx("span",{className:K1.helpBtn,onClick:h=>{h.stopPropagation(),h.nativeEvent.stopImmediatePropagation(),d()},onMouseDown:h=>{h.stopPropagation(),h.nativeEvent.stopImmediatePropagation()},onPointerDown:h=>{h.stopPropagation(),h.nativeEvent.stopImmediatePropagation()},children:"?"}),w.jsx(yi,{title:l,open:n,onCancel:()=>i(!1),footer:null,width:Ft?"98vw":800,centered:Ft,styles:u,...e?{zIndex:e}:{},wrapProps:{onMouseDown:h=>h.stopPropagation()},children:r?w.jsx("div",{className:K1.spinWrap,children:w.jsx(Ca,{})}):w.jsx("div",{className:K1.modalBody,dangerouslySetInnerHTML:{__html:o}})})]})}const _Le="_headerBar_1xe5p_2",QLe="_logoWrap_1xe5p_10",xLe="_logoWrapActive_1xe5p_17",wLe="_logoImage_1xe5p_26",PLe="_logoImageActive_1xe5p_36",CLe="_compactBtn_1xe5p_41",TLe="_compactBtnNoBorder_1xe5p_47",kLe="_tokenStatsTag_1xe5p_55",RLe="_tokenStatsIcon_1xe5p_63",ELe="_liveTag_1xe5p_68",XLe="_liveTagFill_1xe5p_83",zLe="_liveTagContent_1xe5p_93",ILe="_liveTagHistory_1xe5p_100",ALe="_liveTagText_1xe5p_106",MLe="_countdownStrong_1xe5p_111",jLe="_qrcodePopover_1xe5p_116",NLe="_qrcodeTitle_1xe5p_134",WLe="_qrcodeUrlInput_1xe5p_141",LLe="_qrcodeUrlCopy_1xe5p_147",VLe="_settingsGroupBox_1xe5p_158",BLe="_settingsGroupTitle_1xe5p_166",YLe="_settingsItem_1xe5p_175",DLe="_settingsLabel_1xe5p_182",ULe="_settingsDivider_1xe5p_186",qLe="_logDirInput_1xe5p_191",ZLe="_tokenStatsEmpty_1xe5p_201",GLe="_tokenStatsContainer_1xe5p_208",FLe="_tokenStatsColumn_1xe5p_214",HLe="_toolStatsColumn_1xe5p_218",KLe="_modelCard_1xe5p_223",JLe="_modelCardSpaced_1xe5p_230 _modelCard_1xe5p_223",e9e="_modelName_1xe5p_236",t9e="_statsTable_1xe5p_246",n9e="_th_1xe5p_251",i9e="_td_1xe5p_261",r9e="_label_1xe5p_270",s9e="_rowBorder_1xe5p_280",o9e="_rebuildTotalRow_1xe5p_292",a9e="_promptExportBar_1xe5p_301",l9e="_promptScrollArea_1xe5p_305",c9e="_promptEmpty_1xe5p_310",d9e="_promptTimestamp_1xe5p_316",u9e="_textPromptCard_1xe5p_324",h9e="_preText_1xe5p_333",O9e="_systemCollapse_1xe5p_343",f9e="_systemLabel_1xe5p_350",p9e="_preSys_1xe5p_355",m9e="_promptTextarea_1xe5p_365",g9e="_projectStatsCenter_1xe5p_381",v9e="_projectStatsEmpty_1xe5p_387",$9e="_projectStatsContent_1xe5p_394",b9e="_projectStatsUpdated_1xe5p_400",S9e="_projectStatsSummary_1xe5p_406",y9e="_projectStatCard_1xe5p_412",_9e="_projectStatValue_1xe5p_420",Q9e="_projectStatLabel_1xe5p_428",x9e="_projectStatsSection_1xe5p_434",w9e="_projectStatsSectionTitle_1xe5p_440",P9e="_projectStatsModelCard_1xe5p_448",C9e="_projectStatsModelHeader_1xe5p_455",T9e="_projectStatsModelName_1xe5p_464",k9e="_projectStatsModelCount_1xe5p_470",R9e="_pluginDirHint_1xe5p_477",E9e="_pluginDirPath_1xe5p_483",X9e="_pluginList_1xe5p_496",z9e="_pluginItem_1xe5p_502",I9e="_pluginInfo_1xe5p_512",A9e="_pluginName_1xe5p_520",M9e="_pluginFile_1xe5p_526",j9e="_pluginHooks_1xe5p_532",N9e="_pluginHookTag_1xe5p_539",W9e="_pluginActions_1xe5p_548",L9e="_pluginEmpty_1xe5p_556",V9e="_cachePopover_1xe5p_563",B9e="_cacheScrollArea_1xe5p_567",Y9e="_cachePopoverTitle_1xe5p_572",D9e="_cachePopoverHeader_1xe5p_581",U9e="_cacheCopyBtn_1xe5p_587",q9e="_cachePopoverEmpty_1xe5p_599",Z9e="_cacheTokenInfo_1xe5p_605",G9e="_cacheSection_1xe5p_614",F9e="_cacheSectionTitle_1xe5p_618",H9e="_cacheSectionArrow_1xe5p_639",K9e="_cacheCodeBlock_1xe5p_647",J9e="_cacheCodeBlockSystem_1xe5p_661",eVe="_cacheNavBtn_1xe5p_675",tVe="_cacheNavList_1xe5p_690",nVe="_cacheNavItem_1xe5p_696",iVe="_cacheBlockHighlight_1xe5p_712",rVe="_cacheBlockHighlightFading_1xe5p_717",sVe="_cacheBorderSvg_1xe5p_722",oVe="_cacheBorderSvgFading_1xe5p_731",aVe="_cacheBorderRect_1xe5p_736",lVe="_thLeft_1xe5p_746",cVe="_cacheCalibrationLabel_1xe5p_751",dVe="_calibrationSelect_1xe5p_759",uVe="_cachePopoverPlaceholder_1xe5p_765",hVe="_cacheWriteToken_1xe5p_770",OVe="_cacheReadToken_1xe5p_774",fVe="_cacheCtxPercent_1xe5p_778",pVe="_pluginModalFooter_1xe5p_784",mVe="_pluginModalFooterLeft_1xe5p_789",gVe="_pluginDirLabel_1xe5p_795",vVe="_pluginEmptyTitle_1xe5p_800",$Ve="_pluginEmptyHint_1xe5p_805",bVe="_cdnUrlLabel_1xe5p_811",SVe="_cdnInput_1xe5p_817",yVe="_titleIcon_1xe5p_824",_Ve="_countryFlagIcon_1xe5p_829",QVe="_svgIcon_1xe5p_835",xVe="_iconMirror_1xe5p_840",wVe="_langGrid_1xe5p_845",PVe="_langBtn_1xe5p_855",CVe="_countryInfoPopover_1xe5p_861",TVe="_countryInfoMeta_1xe5p_867",kVe="_disabledMenuItem_1xe5p_872",RVe="_currentProcessBtn_1xe5p_877",EVe="_proxySwapIcon_1xe5p_882",XVe="_fullWidthSelect_1xe5p_887",zVe="_proxyProfileTag_1xe5p_892",IVe="_proxyWarning_1xe5p_906",AVe="_proxyList_1xe5p_916",MVe="_proxyItem_1xe5p_922",jVe="_proxyItemActive_1xe5p_934",NVe="_proxyItemMain_1xe5p_939",WVe="_proxyItemInfo_1xe5p_947",LVe="_proxyItemNameRow_1xe5p_953",VVe="_proxyItemName_1xe5p_953",BVe="_proxyItemDetail_1xe5p_965",YVe="_proxyBuiltinTag_1xe5p_974",DVe="_proxyItemActions_1xe5p_984",UVe="_proxyEditForm_1xe5p_990",qVe="_proxyEditRow_1xe5p_998",ZVe="_proxyRequired_1xe5p_1008",GVe="_proxyEditDivider_1xe5p_1013",FVe="_proxyEditBtns_1xe5p_1018",PDe={headerBar:_Le,logoWrap:QLe,logoWrapActive:xLe,logoImage:wLe,logoImageActive:PLe,compactBtn:CLe,compactBtnNoBorder:TLe,tokenStatsTag:kLe,tokenStatsIcon:RLe,liveTag:ELe,liveTagFill:XLe,liveTagContent:zLe,liveTagHistory:ILe,liveTagText:ALe,countdownStrong:MLe,qrcodePopover:jLe,qrcodeTitle:NLe,qrcodeUrlInput:WLe,qrcodeUrlCopy:LLe,settingsGroupBox:VLe,settingsGroupTitle:BLe,settingsItem:YLe,settingsLabel:DLe,settingsDivider:ULe,logDirInput:qLe,tokenStatsEmpty:ZLe,tokenStatsContainer:GLe,tokenStatsColumn:FLe,toolStatsColumn:HLe,modelCard:KLe,modelCardSpaced:JLe,modelName:e9e,statsTable:t9e,th:n9e,td:i9e,label:r9e,rowBorder:s9e,rebuildTotalRow:o9e,promptExportBar:a9e,promptScrollArea:l9e,promptEmpty:c9e,promptTimestamp:d9e,textPromptCard:u9e,preText:h9e,systemCollapse:O9e,systemLabel:f9e,preSys:p9e,promptTextarea:m9e,projectStatsCenter:g9e,projectStatsEmpty:v9e,projectStatsContent:$9e,projectStatsUpdated:b9e,projectStatsSummary:S9e,projectStatCard:y9e,projectStatValue:_9e,projectStatLabel:Q9e,projectStatsSection:x9e,projectStatsSectionTitle:w9e,projectStatsModelCard:P9e,projectStatsModelHeader:C9e,projectStatsModelName:T9e,projectStatsModelCount:k9e,pluginDirHint:R9e,pluginDirPath:E9e,pluginList:X9e,pluginItem:z9e,pluginInfo:I9e,pluginName:A9e,pluginFile:M9e,pluginHooks:j9e,pluginHookTag:N9e,pluginActions:W9e,pluginEmpty:L9e,cachePopover:V9e,cacheScrollArea:B9e,cachePopoverTitle:Y9e,cachePopoverHeader:D9e,cacheCopyBtn:U9e,cachePopoverEmpty:q9e,cacheTokenInfo:Z9e,cacheSection:G9e,cacheSectionTitle:F9e,cacheSectionArrow:H9e,cacheCodeBlock:K9e,cacheCodeBlockSystem:J9e,cacheNavBtn:eVe,cacheNavList:tVe,cacheNavItem:nVe,cacheBlockHighlight:iVe,cacheBlockHighlightFading:rVe,cacheBorderSvg:sVe,cacheBorderSvgFading:oVe,cacheBorderRect:aVe,thLeft:lVe,cacheCalibrationLabel:cVe,calibrationSelect:dVe,cachePopoverPlaceholder:uVe,cacheWriteToken:hVe,cacheReadToken:OVe,cacheCtxPercent:fVe,pluginModalFooter:pVe,pluginModalFooterLeft:mVe,pluginDirLabel:gVe,pluginEmptyTitle:vVe,pluginEmptyHint:$Ve,cdnUrlLabel:bVe,cdnInput:SVe,titleIcon:yVe,countryFlagIcon:_Ve,svgIcon:QVe,iconMirror:xVe,langGrid:wVe,langBtn:PVe,countryInfoPopover:CVe,countryInfoMeta:TVe,disabledMenuItem:kVe,currentProcessBtn:RVe,proxySwapIcon:EVe,fullWidthSelect:XVe,proxyProfileTag:zVe,proxyWarning:IVe,proxyList:AVe,proxyItem:MVe,proxyItemActive:jVe,proxyItemMain:NVe,proxyItemInfo:WVe,proxyItemNameRow:LVe,proxyItemName:VVe,proxyItemDetail:BVe,proxyBuiltinTag:YVe,proxyItemActions:DVe,proxyEditForm:UVe,proxyEditRow:qVe,proxyRequired:ZVe,proxyEditDivider:GVe,proxyEditBtns:FVe};export{as as $,hBe as A,ai as B,zt as C,qce as D,nBe as E,_Ae as F,Eoe as G,dh as H,dn as I,Vde as J,Rn as K,Q3 as L,jt as M,Cl as N,Nue as O,is as P,Si as Q,Zde as R,Ca as S,n_e as T,he as U,F as V,U as W,at as X,fn as Y,_w as Z,Pe as _,e8 as a,x8 as a0,ov as a1,yd as a2,Go as a3,U0 as a4,XH as a5,Ts as a6,ip as a7,Nu as a8,X0 as a9,Fce as aA,M7 as aB,ah as aC,Ls as aD,tA as aE,dBe as aF,RV as aG,Fo as aH,kl as aI,j7 as aJ,Mu as aK,bo as aL,gf as aM,U5 as aN,q5 as aO,Zue as aP,lBe as aQ,cBe as aR,Gb as aS,uBe as aT,Av as aU,yl as aV,dy as aW,tD as aX,JY as aY,cc as aa,ns as ab,tBe as ac,pi as ad,eBe as ae,Me as af,Lte as ag,Vw as ah,the as ai,Sde as aj,ti as ak,Sl as al,Y5 as am,Ah as an,yi as ao,NA as ap,m_ as aq,a$ as ar,fh as as,Sv as at,iBe as au,Ko as av,TI as aw,Op as ax,QI as ay,Tl as az,Yr as b,ie as c,ia as d,pt as e,rBe as f,En as g,oBe as h,D7 as i,aBe as j,sBe as k,Lx as l,cn as m,wDe as n,ehe as o,_P as p,yv as q,Gn as r,PDe as s,le as t,J as u,$_ as v,js as w,el as x,ra as y,xDe as z};