cc-viewer 1.6.150 → 1.6.151
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.
- package/dist/assets/{App-DP-0i8Ja.js → App-BJu57k_5.js} +2 -2
- package/dist/assets/{AppHeader.module-wR4kDF4P.js → AppHeader.module-Bg7z8ADB.js} +4 -4
- package/dist/assets/{Mobile-BFOQmkp4.js → Mobile-BC6ADES_.js} +1 -1
- package/dist/assets/{_baseUniq-BH--lZ56.js → _baseUniq-BwBNtJMN.js} +1 -1
- package/dist/assets/{arc-DuE3gXDC.js → arc-F7vqZIx-.js} +1 -1
- package/dist/assets/{architectureDiagram-Q4EWVU46-BmVFUzbp.js → architectureDiagram-Q4EWVU46-GoNIwEB1.js} +1 -1
- package/dist/assets/{blockDiagram-DXYQGD6D-CHE-o8T6.js → blockDiagram-DXYQGD6D-BGoUpMqH.js} +1 -1
- package/dist/assets/{c4Diagram-AHTNJAMY-BgFBQL-i.js → c4Diagram-AHTNJAMY-Bv7xPWh-.js} +1 -1
- package/dist/assets/channel-BOwULHhE.js +1 -0
- package/dist/assets/{chunk-4BX2VUAB-BITi8Ykk.js → chunk-4BX2VUAB-BI7_KVN8.js} +1 -1
- package/dist/assets/{chunk-4TB4RGXK-Bx4z_59V.js → chunk-4TB4RGXK-Ctn2C5iB.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-CA-TJAgh.js → chunk-55IACEB6-C6uyr00m.js} +1 -1
- package/dist/assets/{chunk-EDXVE4YY-DzOQQTg9.js → chunk-EDXVE4YY-BQpSHS6P.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-BaACQxY5.js → chunk-FMBD7UC4-BBc8zgyV.js} +1 -1
- package/dist/assets/{chunk-OYMX7WX6-DKczxPO9.js → chunk-OYMX7WX6-B5frDZ6K.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-Dj3fSOFp.js → chunk-QZHKN3VN-Tv-dupFm.js} +1 -1
- package/dist/assets/{chunk-YZCP3GAM-DJ8v2pfv.js → chunk-YZCP3GAM-BdJcEk6V.js} +1 -1
- package/dist/assets/classDiagram-6PBFFD2Q-u59iSjCz.js +1 -0
- package/dist/assets/classDiagram-v2-HSJHXN6E-u59iSjCz.js +1 -0
- package/dist/assets/clone-jw3cPJcg.js +1 -0
- package/dist/assets/{cose-bilkent-S5V4N54A-BU7YoX3F.js → cose-bilkent-S5V4N54A-Bf3zJGK_.js} +1 -1
- package/dist/assets/{dagre-KV5264BT-DY8vNFde.js → dagre-KV5264BT-B0zj3Uop.js} +1 -1
- package/dist/assets/{diagram-5BDNPKRD-eV6JGgXJ.js → diagram-5BDNPKRD-CPb3KupW.js} +1 -1
- package/dist/assets/{diagram-G4DWMVQ6-DqbxWi0F.js → diagram-G4DWMVQ6-CAd3FOK3.js} +1 -1
- package/dist/assets/{diagram-MMDJMWI5-6I41h901.js → diagram-MMDJMWI5-Do_kk1p9.js} +1 -1
- package/dist/assets/{diagram-TYMM5635-Cdhzv9fb.js → diagram-TYMM5635-D8v3xR3v.js} +1 -1
- package/dist/assets/{erDiagram-SMLLAGMA-DB_vE7YR.js → erDiagram-SMLLAGMA-GGS-Y49r.js} +1 -1
- package/dist/assets/{flowDiagram-DWJPFMVM-DoZnmM1w.js → flowDiagram-DWJPFMVM-XlNRg6WT.js} +1 -1
- package/dist/assets/{ganttDiagram-T4ZO3ILL-BHjY0DFL.js → ganttDiagram-T4ZO3ILL-CzjVUF_m.js} +1 -1
- package/dist/assets/{gitGraphDiagram-UUTBAWPF-By9jkYoP.js → gitGraphDiagram-UUTBAWPF-C7e3QO7g.js} +1 -1
- package/dist/assets/{graph-BtHiB5DZ.js → graph-rl9YDFsZ.js} +1 -1
- package/dist/assets/{index-Ch53RAwh.js → index-DMibh3-N.js} +2 -2
- package/dist/assets/{infoDiagram-42DDH7IO-Atsg-gLP.js → infoDiagram-42DDH7IO-Bz6vWc83.js} +1 -1
- package/dist/assets/{ishikawaDiagram-UXIWVN3A-CHeVhW_6.js → ishikawaDiagram-UXIWVN3A-otCS5Rez.js} +1 -1
- package/dist/assets/{journeyDiagram-VCZTEJTY-rAXD4kjc.js → journeyDiagram-VCZTEJTY-Dto4eM1j.js} +1 -1
- package/dist/assets/{kanban-definition-6JOO6SKY-BNkAcu_2.js → kanban-definition-6JOO6SKY-Cw2CLO1H.js} +1 -1
- package/dist/assets/{layout-CS0VFUTO.js → layout-UJXAnFs_.js} +1 -1
- package/dist/assets/{linear-ByNZVXE9.js → linear-aT285Zzo.js} +1 -1
- package/dist/assets/{mermaid.core-CYFQULah.js → mermaid.core-DF5xqjrS.js} +4 -4
- package/dist/assets/{min-CA7ITCai.js → min-YvRNbr-e.js} +1 -1
- package/dist/assets/{mindmap-definition-QFDTVHPH-B-NsO7bK.js → mindmap-definition-QFDTVHPH-0NC_RbSJ.js} +1 -1
- package/dist/assets/{pieDiagram-DEJITSTG-TPrSeQ1p.js → pieDiagram-DEJITSTG-Bfz8FvqH.js} +1 -1
- package/dist/assets/{quadrantDiagram-34T5L4WZ-CJV_CT2r.js → quadrantDiagram-34T5L4WZ-BL2Pcm6-.js} +1 -1
- package/dist/assets/{requirementDiagram-MS252O5E-C2gVRAVu.js → requirementDiagram-MS252O5E-BBhoN09V.js} +1 -1
- package/dist/assets/{sankeyDiagram-XADWPNL6-eYCBpZqF.js → sankeyDiagram-XADWPNL6-BNc3tE5N.js} +1 -1
- package/dist/assets/{sequenceDiagram-FGHM5R23-D2Vq0c9j.js → sequenceDiagram-FGHM5R23-GmzDhRck.js} +1 -1
- package/dist/assets/{stateDiagram-FHFEXIEX-DieqEg6U.js → stateDiagram-FHFEXIEX-DrCzoSBV.js} +1 -1
- package/dist/assets/stateDiagram-v2-QKLJ7IA2-BccG4kPG.js +1 -0
- package/dist/assets/{timeline-definition-GMOUNBTQ-D0g6d_ok.js → timeline-definition-GMOUNBTQ-CeFAUSVL.js} +1 -1
- package/dist/assets/{vennDiagram-DHZGUBPP-D56gJuMe.js → vennDiagram-DHZGUBPP-T2ZTnXd_.js} +1 -1
- package/dist/assets/{wardley-RL74JXVD-D62yld9d.js → wardley-RL74JXVD-DNnj442N.js} +1 -1
- package/dist/assets/{wardleyDiagram-NUSXRM2D-ZdD5Ga0-.js → wardleyDiagram-NUSXRM2D-BNEL8OBd.js} +1 -1
- package/dist/assets/{xychartDiagram-5P7HB3ND-CuCoJi3h.js → xychartDiagram-5P7HB3ND-CLOx51nC.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/channel-B2-68tYz.js +0 -1
- package/dist/assets/classDiagram-6PBFFD2Q-DXiBlSEE.js +0 -1
- package/dist/assets/classDiagram-v2-HSJHXN6E-DXiBlSEE.js +0 -1
- package/dist/assets/clone-BIaW3klD.js +0 -1
- package/dist/assets/stateDiagram-v2-QKLJ7IA2-C3jWdLWh.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-
|
|
2
|
-
var IB=Object.defineProperty;var MB=(t,e,n)=>e in t?IB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Fe=(t,e,n)=>MB(t,typeof e!="symbol"?e+"":e,n);import{g as L$,R as G,c as jB,r as f,d as V$,j as _,_ as y6,b as an,a as Ai,i as Lu}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-DF5xqjrS.js","assets/index-DMibh3-N.js","assets/index-DCtZ2KSX.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var IB=Object.defineProperty;var MB=(t,e,n)=>e in t?IB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Fe=(t,e,n)=>MB(t,typeof e!="symbol"?e+"":e,n);import{g as L$,R as G,c as jB,r as f,d as V$,j as _,_ as y6,b as an,a as Ai,i as Lu}from"./index-DMibh3-N.js";function NB(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 ub={exports:{}};/*!
|
|
3
3
|
Copyright (c) 2018 Jed Watson.
|
|
4
4
|
Licensed under the MIT License (MIT), see
|
|
5
5
|
http://jedwatson.github.io/classnames
|
|
@@ -715,7 +715,7 @@ Code Review поточних git-змін з різних перспектив
|
|
|
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 є обов'язковими"},"ui.ultraplan":{zh:"UltraPlan",en:"UltraPlan","zh-TW":"UltraPlan",ko:"UltraPlan",ja:"UltraPlan",de:"UltraPlan",es:"UltraPlan",fr:"UltraPlan",it:"UltraPlan",da:"UltraPlan",pl:"UltraPlan",ru:"UltraPlan",ar:"UltraPlan",no:"UltraPlan","pt-BR":"UltraPlan",th:"UltraPlan",tr:"UltraPlan",uk:"UltraPlan"},"ui.ultraplan.title":{zh:"UltraPlan — 至尊许愿机",en:"UltraPlan — Ultimate Wishing Machine","zh-TW":"UltraPlan — 至尊許願機",ko:"UltraPlan — 최고의 소원 기계",ja:"UltraPlan — 究極のウィッシングマシン",de:"UltraPlan — Ultimative Wunschmaschine",es:"UltraPlan — Máquina de deseos suprema",fr:"UltraPlan — Machine à vœux suprême",it:"UltraPlan — Macchina dei desideri suprema",da:"UltraPlan — Den ultimative ønskemaskine",pl:"UltraPlan — Najwyższa maszyna życzeń",ru:"UltraPlan — Супер-машина желаний",ar:"UltraPlan — آلة الأمنيات العظمى",no:"UltraPlan — Den ultimate ønskemaskinen","pt-BR":"UltraPlan — Máquina de desejos suprema",th:"UltraPlan — เครื่องอธิษฐานสูงสุด",tr:"UltraPlan — Nihai dilek makinesi",uk:"UltraPlan — Найвища машина бажань"},"ui.ultraplan.modeAuto":{zh:"自适应模式",en:"Adaptive Mode","zh-TW":"自適應模式",ko:"적응형 모드",ja:"アダプティブモード",de:"Adaptiver Modus",es:"Modo adaptativo",fr:"Mode adaptatif",it:"Modalità adattiva",da:"Adaptiv tilstand",pl:"Tryb adaptacyjny",ru:"Адаптивный режим",ar:"وضع تكيفي",no:"Adaptiv modus","pt-BR":"Modo adaptativo",th:"โหมดปรับตัว",tr:"Uyarlanabilir mod",uk:"Адаптивний режим"},"ui.ultraplan.modeForced":{zh:"强制执行 UltraPlan",en:"Force UltraPlan","zh-TW":"強制執行 UltraPlan",ko:"UltraPlan 강제 실행",ja:"UltraPlan 強制実行",de:"UltraPlan erzwingen",es:"Forzar UltraPlan",fr:"Forcer UltraPlan",it:"Forza UltraPlan",da:"Gennemtving UltraPlan",pl:"Wymuś UltraPlan",ru:"Принудительный UltraPlan",ar:"فرض UltraPlan",no:"Tving UltraPlan","pt-BR":"Forçar UltraPlan",th:"บังคับ UltraPlan",tr:"UltraPlan'ı zorla",uk:"Примусовий UltraPlan"},"ui.ultraplan.agentTeamRequired":{zh:"UltraPlan 需要开启 Agent Team 才能使用",en:"UltraPlan requires Agent Team to be enabled","zh-TW":"UltraPlan 需要開啟 Agent Team 才能使用",ko:"UltraPlan을 사용하려면 Agent Team을 활성화해야 합니다",ja:"UltraPlan を使用するには Agent Team を有効にする必要があります",de:"UltraPlan erfordert die Aktivierung von Agent Team",es:"UltraPlan requiere que Agent Team esté activado",fr:"UltraPlan nécessite l'activation de Agent Team",it:"UltraPlan richiede che Agent Team sia attivato",da:"UltraPlan kræver at Agent Team er aktiveret",pl:"UltraPlan wymaga włączonego Agent Team",ru:"UltraPlan требует включённого Agent Team",ar:"UltraPlan يتطلب تفعيل Agent Team",no:"UltraPlan krever at Agent Team er aktivert","pt-BR":"UltraPlan requer que o Agent Team esteja ativado",th:"UltraPlan ต้องเปิดใช้งาน Agent Team",tr:"UltraPlan için Agent Team'in etkinleştirilmesi gerekir",uk:"UltraPlan потребує увімкненого Agent Team"},"ui.ultraplan.placeholder":{zh:"这是一个超级许愿机,它能完成非常复杂的任务,只有普通输入无法完成的任务才需要启用该功能",en:"This is a super wishing machine for complex tasks. Only use it when normal input can't handle the job.","zh-TW":"這是一個超級許願機,它能完成非常複雜的任務,只有普通輸入無法完成的任務才需要啟用該功能",ko:"복잡한 작업을 위한 슈퍼 위시 머신입니다. 일반 입력으로 처리할 수 없는 작업에만 사용하세요.",ja:"これは超複雑なタスクを処理できるスーパーウィッシングマシンです。通常の入力では対応できないタスクにのみ使用してください。",de:"Dies ist eine Super-Wunschmaschine für komplexe Aufgaben. Verwenden Sie sie nur, wenn normale Eingaben nicht ausreichen.",es:"Esta es una súper máquina de deseos para tareas complejas. Úsala solo cuando la entrada normal no pueda manejar el trabajo.",fr:"C'est une super machine à vœux pour les tâches complexes. Utilisez-la uniquement quand l'entrée normale ne suffit pas.",it:"Questa è una super macchina dei desideri per compiti complessi. Usala solo quando l'input normale non è sufficiente.",da:"Dette er en super-ønskemaskine til komplekse opgaver. Brug den kun, når normal input ikke kan klare opgaven.",pl:"To super maszyna życzeń do złożonych zadań. Używaj jej tylko, gdy normalne dane wejściowe nie wystarczą.",ru:"Это супер-машина желаний для сложных задач. Используйте только когда обычный ввод не справляется.",ar:"هذه آلة أمنيات خارقة للمهام المعقدة. استخدمها فقط عندما لا يكفي الإدخال العادي.",no:"Dette er en super-ønskemaskin for komplekse oppgaver. Bruk den kun når vanlig input ikke kan håndtere jobben.","pt-BR":"Esta é uma super máquina de desejos para tarefas complexas. Use apenas quando a entrada normal não conseguir lidar com o trabalho.",th:"นี่คือเครื่องอธิษฐานสุดยอดสำหรับงานที่ซับซ้อน ใช้เฉพาะเมื่อการป้อนข้อมูลปกติไม่สามารถจัดการได้",tr:"Bu, karmaşık görevler için süper bir dilek makinesidir. Yalnızca normal giriş yeterli olmadığında kullanın.",uk:"Це супер-машина бажань для складних завдань. Використовуйте лише коли звичайний ввід не справляється."},"ui.ultraplan.send":{zh:"发送",en:"Send","zh-TW":"發送",ko:"보내기",ja:"送信",de:"Senden",es:"Enviar",fr:"Envoyer",it:"Invia",da:"Send",pl:"Wyślij",ru:"Отправить",ar:"إرسال",no:"Send","pt-BR":"Enviar",th:"ส่ง",tr:"Gönder",uk:"Надіслати"},"ui.ultraplan.upload":{zh:"添加附件",en:"Add Attachment","zh-TW":"新增附件",ko:"첨부 추가",ja:"添付を追加",de:"Anhang hinzufügen",es:"Agregar adjunto",fr:"Ajouter une pièce jointe",it:"Aggiungi allegato",da:"Tilføj vedhæftning",pl:"Dodaj załącznik",ru:"Добавить вложение",ar:"إضافة مرفق",no:"Legg til vedlegg","pt-BR":"Adicionar anexo",th:"เพิ่มไฟล์แนบ",tr:"Ek ekle",uk:"Додати вкладення"},"ui.ultraplan.contextWarning":{zh:"当前模型上下文窗口为 200K,很容易不够一次 UltraPlan 运行,务必在运行之前执行 /clear 命令。",en:"The current model has a 200K context window, which may not be enough for a single UltraPlan run. Make sure to run /clear before starting.","zh-TW":"目前模型的上下文窗口為 200K,可能不足以完成一次 UltraPlan 執行,請務必在執行前先執行 /clear 指令。",ko:"현재 모델의 컨텍스트 창은 200K로, 한 번의 UltraPlan 실행에 충분하지 않을 수 있습니다. 시작 전에 /clear 명령을 실행하세요.",ja:"現在のモデルのコンテキストウィンドウは200Kで、1回のUltraPlan実行には不十分な場合があります。開始前に必ず /clear コマンドを実行してください。",de:"Das aktuelle Modell hat ein 200K-Kontextfenster, das für einen einzelnen UltraPlan-Lauf möglicherweise nicht ausreicht. Führen Sie vor dem Start /clear aus.",es:"El modelo actual tiene una ventana de contexto de 200K, que puede no ser suficiente para una ejecución de UltraPlan. Asegúrese de ejecutar /clear antes de comenzar.",fr:"Le modèle actuel a une fenêtre de contexte de 200K, ce qui peut être insuffisant pour une exécution UltraPlan. Exécutez /clear avant de commencer.",it:"Il modello attuale ha una finestra di contesto di 200K, che potrebbe non essere sufficiente per un'esecuzione di UltraPlan. Eseguire /clear prima di iniziare.",da:"Den aktuelle model har et 200K kontekstvindue, hvilket muligvis ikke er nok til en enkelt UltraPlan-kørsel. Kør /clear inden start.",pl:"Bieżący model ma okno kontekstu 200K, które może nie wystarczyć na jedno uruchomienie UltraPlan. Przed rozpoczęciem wykonaj /clear.",ru:"Текущая модель имеет контекстное окно 200K, которого может не хватить для одного запуска UltraPlan. Обязательно выполните /clear перед запуском.",ar:"نافذة السياق للنموذج الحالي هي 200K، وقد لا تكفي لتشغيل UltraPlan واحد. تأكد من تنفيذ /clear قبل البدء.",no:"Gjeldende modell har et 200K kontekstvindu, som kanskje ikke er nok for én UltraPlan-kjøring. Kjør /clear før du starter.","pt-BR":"O modelo atual tem uma janela de contexto de 200K, que pode não ser suficiente para uma execução do UltraPlan. Execute /clear antes de iniciar.",th:"โมเดลปัจจุบันมีหน้าต่างบริบท 200K ซึ่งอาจไม่เพียงพอสำหรับการรัน UltraPlan ครั้งเดียว ให้รันคำสั่ง /clear ก่อนเริ่ม",tr:"Mevcut modelin 200K bağlam penceresi var ve tek bir UltraPlan çalıştırması için yeterli olmayabilir. Başlamadan önce /clear komutunu çalıştırın.",uk:"Поточна модель має контекстне вікно 200K, якого може не вистачити для одного запуску UltraPlan. Обов'язково виконайте /clear перед запуском."},"ui.taskNotification.result":{zh:"结果详情",en:"Result details","zh-TW":"結果詳情",ko:"결과 상세",ja:"結果の詳細",de:"Ergebnisdetails",es:"Detalles del resultado",fr:"Détails du résultat",it:"Dettagli del risultato",da:"Resultatdetaljer",pl:"Szczegóły wyniku",ru:"Подробности результата",ar:"تفاصيل النتيجة",no:"Resultatdetaljer","pt-BR":"Detalhes do resultado",th:"รายละเอียดผลลัพธ์",tr:"Sonuç detayları",uk:"Деталі результату"}},Tu={};for(const[t,e]of Object.entries($ue))for(const[n,i]of Object.entries(e))Tu[n]||(Tu[n]={}),Tu[n][t]=i;let xP="zh";const Om={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 bue(t){if(!t)return"en";const e=t.toLowerCase().replace(/_/g,"-");if(Om[e])return Om[e];const n=e.split("-")[0];return Om[n]?Om[n]:"en"}function Sue(){return typeof navigator<"u"&&navigator.language?bue(navigator.language):"en"}function c7(t){xP=Tu[t]?t:"en"}function E_(){return xP}function oe(t,e){var i;let n=((i=Tu[xP])==null?void 0:i[t])||Tu.en[t]||t;if(e)for(const[r,s]of Object.entries(e))n=n.replaceAll(`{${r}}`,s);return n}c7(Sue());const JR=new URLSearchParams(window.location.search).get("token");function ut(t){if(!JR)return t;const e=t.includes("?")?"&":"?";return`${t}${e}token=${JR}`}const yue="_root_2zmas_2",_ue="_inner_2zmas_10",wue="_header_2zmas_17",xue="_headerTitle_2zmas_22",Que="_headerFolderIcon_2zmas_27",Pue="_headerSubtitle_2zmas_32",Cue="_addButtonRow_2zmas_36",Tue="_loadingCenter_2zmas_42",kue="_emptyState_2zmas_47",Rue="_card_2zmas_52",Eue="_cardRow_2zmas_59",Xue="_cardLeft_2zmas_65",zue="_cardNameRow_2zmas_70",Aue="_cardName_2zmas_70",Iue="_cardPath_2zmas_82",Mue="_cardMeta_2zmas_87",jue="_dirPathHeader_2zmas_96",Nue="_dirCurrentPath_2zmas_104",Wue="_dirFolderIcon_2zmas_113",Lue="_dirList_2zmas_118",Vue="_dirListCenter_2zmas_124",Bue="_dirItem_2zmas_129",Yue="_dirItemInner_2zmas_137",Due="_dirItemName_2zmas_145",Uue="_dirGitTag_2zmas_153",que="_dirFooter_2zmas_162",Zue="_dirPathInputRow_2zmas_170",Gue="_dirPathInput_2zmas_170",ni={root:yue,inner:_ue,header:wue,headerTitle:xue,headerFolderIcon:Que,headerSubtitle:Pue,addButtonRow:Cue,loadingCenter:Tue,emptyState:kue,card:Rue,cardRow:Eue,cardLeft:Xue,cardNameRow:zue,cardName:Aue,cardPath:Iue,cardMeta:Mue,dirPathHeader:jue,dirCurrentPath:Nue,dirFolderIcon:Wue,dirList:Lue,dirListCenter:Vue,dirItem:Bue,dirItemInner:Yue,dirItemName:Due,dirGitTag:Uue,dirFooter:que,dirPathInputRow:Zue,dirPathInput:Gue},{Text:Zc,Title:Fue}=Ka;function Hue(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 Kue(t){if(!t)return"";const e=Date.now()-new Date(t).getTime(),n=Math.floor(e/6e4);if(n<1)return oe("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 Jue({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(ut(g)).then(v=>v.json()).then(v=>{v.error?wn.error(v.error):(r(v.current),o(v.parent),l(v.dirs||[]),h(v.current)),d(!1)}).catch(()=>{wn.error("Failed to browse directory"),d(!1)})},[]);f.useEffect(()=>{t&&O("")},[t,O]);const p=()=>{const m=u.trim();m&&O(m)};return _.jsxs(yi,{title:oe("ui.workspaces.selectDir"),open:t,onCancel:e,footer:null,width:600,styles:{body:{padding:"12px 0"}},children:[_.jsxs("div",{className:ni.dirPathHeader,children:[_.jsx(Gn,{type:"text",icon:_.jsx(due,{}),disabled:!s,onClick:()=>s&&O(s),size:"small"}),_.jsxs(Zc,{className:ni.dirCurrentPath,children:[_.jsx(Iv,{className:ni.dirFolderIcon}),i]})]}),_.jsx("div",{className:ni.dirList,children:c?_.jsx("div",{className:ni.dirListCenter,children:_.jsx(ka,{})}):a.length===0?_.jsx("div",{className:ni.dirListCenter,children:_.jsx(Zc,{type:"secondary",children:oe("ui.workspaces.emptyDir")})}):a.map(m=>_.jsxs("div",{className:ni.dirItem,onMouseEnter:g=>g.currentTarget.style.background="var(--bg-elevated)",onMouseLeave:g=>g.currentTarget.style.background="transparent",children:[_.jsxs("div",{className:ni.dirItemInner,onClick:()=>O(m.path),children:[_.jsx(GM,{style:{color:m.hasGit?"var(--color-primary)":"var(--text-muted)",fontSize:16,flexShrink:0}}),_.jsx(Zc,{className:ni.dirItemName,children:m.name}),m.hasGit&&_.jsxs(jv,{color:"blue",className:ni.dirGitTag,children:[_.jsx(Oue,{style:{marginRight:2}}),"git"]})]}),_.jsx(Gn,{type:"primary",size:"small",onClick:g=>{g.stopPropagation(),n(m.path)},children:oe("ui.workspaces.select")})]},m.path))}),_.jsxs("div",{className:ni.dirFooter,children:[_.jsxs(Gn,{type:"primary",ghost:!0,block:!0,icon:_.jsx(Iv,{}),onClick:()=>n(i),children:[oe("ui.workspaces.selectCurrent")," — ",i.split("/").pop()||i]}),_.jsxs("div",{className:ni.dirPathInputRow,children:[_.jsx(Jo,{size:"small",value:u,onChange:m=>h(m.target.value),onPressEnter:p,placeholder:oe("ui.workspaces.pathPlaceholder"),className:ni.dirPathInput}),_.jsx(Gn,{size:"small",onClick:p,children:oe("ui.workspaces.goTo")})]})]})]})}function ehe({onLaunch:t}){const[e,n]=f.useState([]),[i,r]=f.useState(!0),[s,o]=f.useState(null),[a,l]=f.useState(!1),c=()=>{fetch(ut("/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(ut("/api/workspaces/add"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:O})}).then(p=>p.json()).then(p=>{p.error?wn.error(p.error):c()}).catch(()=>wn.error("Failed to add workspace"))},u=O=>{fetch(ut(`/api/workspaces/${O}`),{method:"DELETE"}).then(p=>p.json()).then(()=>c()).catch(()=>{})},h=(O,p=!1)=>{var g;o(O.id);const m=[];if(p&&m.push("--dangerously-skip-permissions"),O.logCount>0&&m.push("-c"),(g=window.electronAPI)!=null&&g.launchWorkspace){window.electronAPI.launchWorkspace(O.path,m),o(null);return}fetch(ut("/api/workspaces/launch"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:O.path,extraArgs:m})}).then(v=>v.json()).then(v=>{v.error?(wn.error(v.error),o(null)):t({projectName:v.projectName,path:O.path})}).catch(()=>{wn.error("Launch failed"),o(null)})};return _.jsxs("div",{className:ni.root,children:[_.jsxs("div",{className:ni.inner,children:[_.jsxs("div",{className:ni.header,children:[_.jsxs(Fue,{level:3,className:ni.headerTitle,children:[_.jsx(Iv,{className:ni.headerFolderIcon}),oe("ui.workspaces.title")]}),_.jsx(Zc,{type:"secondary",className:ni.headerSubtitle,children:oe("ui.workspaces.subtitle")})]}),_.jsx("div",{className:ni.addButtonRow,children:_.jsx(Gn,{type:"primary",icon:_.jsx(DI,{}),onClick:()=>l(!0),size:"large",children:oe("ui.workspaces.browse")})}),i?_.jsx("div",{className:ni.loadingCenter,children:_.jsx(ka,{})}):e.length===0?_.jsx(Vs,{description:_.jsx(Zc,{type:"secondary",children:oe("ui.workspaces.empty")}),className:ni.emptyState}):_.jsx(yM,{dataSource:e,renderItem:O=>_.jsx(cP,{size:"small",className:ni.card,hoverable:!0,onClick:()=>h(O,!1),children:_.jsxs("div",{className:ni.cardRow,children:[_.jsxs("div",{className:ni.cardLeft,children:[_.jsx("div",{className:ni.cardNameRow,children:_.jsx(Zc,{strong:!0,className:ni.cardName,children:O.projectName})}),_.jsx(Zc,{type:"secondary",className:ni.cardPath,children:O.path}),_.jsxs("div",{className:ni.cardMeta,children:[_.jsxs("span",{children:[_.jsx(Ure,{style:{marginRight:4}}),Kue(O.lastUsed)]}),O.logCount>0&&_.jsxs("span",{children:[_.jsx(mue,{style:{marginRight:4}}),O.logCount," logs (",Hue(O.totalSize),")"]})]})]}),_.jsxs(x0,{children:[_.jsx(Gn,{type:"primary",icon:_.jsx(KR,{}),loading:s===O.id,onClick:p=>{p.stopPropagation(),h(O,!1)},children:oe("ui.workspaces.normalLaunch")}),_.jsx(Gn,{icon:_.jsx(KR,{}),loading:s===O.id,onClick:p=>{p.stopPropagation(),h(O,!0)},style:{background:"#d97706",borderColor:"#d97706",color:"#fff"},children:oe("ui.workspaces.skipPermLaunch")}),_.jsx(QM,{title:oe("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:_.jsx(Gn,{type:"text",danger:!0,icon:_.jsx(fde,{}),onClick:p=>p.stopPropagation()})})]})]})},O.id)})]}),_.jsx(Jue,{open:a,onClose:()=>l(!1),onSelect:d})]})}const the="_iconBtn_5ojec_1",nhe={iconBtn:the};function ihe({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=_.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:_.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=_.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:[_.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"}),_.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 _.jsx("span",{role:"button",tabIndex:0,onClick:s,onKeyDown:o,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),title:e,className:nhe.iconBtn,style:{opacity:i?1:.7},children:i?l:a})}function rhe(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 she=/You are a Claude agent/i,uS=new WeakMap;function X_(t){if(!t)return!1;const e=uS.get(t);if(e!==void 0)return e;if(t.teammate)return uS.set(t,!1),!1;const n=rhe(t.body||{}),i=she.test(n);return uS.set(t,i),i}function ohe(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 e5=/command execution specialist|file search specialist|planning specialist|general-purpose agent/i,d7=/running as an agent in a team|Agent Teammate Communication/i;function Ju(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 fm=new WeakMap;function QP(t){if(!t)return!1;const e=fm.get(t);if(e!==void 0)return e;if(t.teammate)return fm.set(t,!0),!0;if(X_(t))return t.teammate||(t.teammate=ohe(t)||null),fm.set(t,!0),!0;const n=Ju(t.body||{}),i=d7.test(n);return fm.set(t,i),i}const t5=new WeakMap;function Ns(t){if(!t)return!1;const e=t5.get(t);if(e!==void 0)return e;const n=ahe(t);return t5.set(t,n),n}function ahe(t){if(!t||QP(t))return!1;if(t.mainAgent){const s=Ju(t.body||{});return!e5.test(s)}const e=t.body||{};if(!e.system||!Array.isArray(e.tools))return!1;const n=Ju(e);if(!n.includes("You are Claude Code")||e5.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 z_(t){return t?/^Base directory for this skill:/i.test(t.trim()):!1}function lhe(t){return t?t.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/gi,"").replace(/<local-command-caveat>[\s\S]*?<\/local-command-caveat>/gi,"").replace(/<local-command-stdout>[\s\S]*?<\/local-command-stdout>/gi,"").replace(/<command-name>[\s\S]*?<\/command-name>/gi,"").replace(/<command-message>[\s\S]*?<\/command-message>/gi,"").replace(/<command-args>[\s\S]*?<\/command-args>/gi,"").replace(/<teammate-message[\s\S]*?<\/teammate-message>/gi,"").replace(/<task-notification>[\s\S]*?<\/task-notification>/gi,"").trim():""}function rd(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 Nv(t){if(!Array.isArray(t))return{commands:[],textBlocks:[],skillBlocks:[],teammateBlocks:[],taskNotificationBlocks:[]};const e=[];for(const l of t){if(l.type!=="text")continue;const c=l.text||"",d=/<teammate-message\s+([^>]*)>([\s\S]*?)<\/teammate-message>/gi;let u;for(;(u=d.exec(c))!==null;){const h=u[1],O=u[2].trim(),p=h.match(/teammate_id="([^"]*)"/),m=h.match(/color="([^"]*)"/),g=h.match(/summary="([^"]*)"/),v=p?p[1]:"teammate",$=m?m[1]:null;if(O.startsWith("{"))try{const b=JSON.parse(O);if(b&&b.type){e.push({id:v,color:$,summary:null,content:null,status:b.type,statusFrom:b.from||v});continue}}catch{}e.push({id:v,color:$,summary:g?g[1]:null,content:O,status:null})}}const n=[];if(t.some(l=>l.type==="text"&&/<task-notification>/i.test(l.text||"")))for(const l of t){if(l.type!=="text")continue;const c=l.text||"",d=/<task-notification>([\s\S]*?)<\/task-notification>/gi;let u;for(;(u=d.exec(c))!==null;){const h=u[1],O=g=>{const v=h.match(new RegExp(`<${g}>([\\s\\S]*?)<\\/${g}>`,"i"));return v?v[1].trim():null},p=h.match(/<usage>([\s\S]*?)<\/usage>/i);let m=null;if(p){const g=v=>{const $=p[1].match(new RegExp(`<${v}>([\\s\\S]*?)<\\/${v}>`,"i"));return $?$[1].trim():null};m={totalTokens:Number(g("total_tokens")||0),toolUses:Number(g("tool_uses")||0),durationMs:Number(g("duration_ms")||0)}}n.push({taskId:O("task-id"),status:O("status"),summary:O("summary"),result:O("result"),usage:m})}}const r=t.some(l=>l.type==="text"&&/<command-message>/i.test(l.text||"")),s=[];if(r)for(const l of t){if(l.type!=="text")continue;const c=(l.text||"").match(/<command-name>\s*([^<]*)<\/command-name>/i);if(c){const d=c[1].trim();s.push(d.startsWith("/")?d:`/${d}`)}}let o=t.filter(l=>l.type==="text"&&!rd(l.text));for(const l of t){if(l.type!=="text"||!rd(l.text))continue;const c=lhe(l.text);c&&o.push({...l,text:c})}r&&(o=o.filter(l=>!/<command-message>/i.test(l.text||"")));const a=o.filter(l=>z_(l.text));return a.length>0&&(o=o.filter(l=>!z_(l.text))),{commands:s,textBlocks:o,skillBlocks:a,teammateBlocks:e,taskNotificationBlocks:n}}function che(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 pm=new Map;let hS=0,n5=null;const i5=60,r5=/<teammate-message[^>]*>/;function dhe(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=r5.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=r5.exec(s.text);if(o)return s.text.slice(o.index+o[0].length).trimStart()}return""}function uhe(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 s5(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!==n5&&(pm.clear(),hS=0,n5=e);for(let s=hS;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,i5);d&&pm.set(d,c.name)}}if(hS=t.length,pm.size!==0)for(const s of t){if(s.teammate||!X_(s)&&!d7.test(Ju(s.body||{})))continue;let o=dhe(s);if(!o&&X_(s)&&(o=uhe(s)),!o)continue;const a=o.slice(0,i5),l=pm.get(a);l&&(s.teammate=l,s._cachedTeammateName===null&&(s._cachedTeammateName=l))}}function hhe(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 vl(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,_slimmed:!1,_fullEntryIndex:void 0,body:{...t.body,messages:n.body.messages.slice(0,t._messageCount),system:n.body.system}}}function Ohe(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 fhe=[{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 phe(t){if(!t)return 2e5;for(const e of fhe)if(e.match.test(t))return e.tokens;return 2e5}function u7(t,e,n,i){var r,s;for(let o=n;o<e.length;o++){const a=e[o];if(Ns(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?vl(i,e):i,h=ghe(u,a);h&&t.set(o,h)}}}i=a}}return i}function mhe(t){const e=new Map;return u7(e,t,0,null),e}const o5=new WeakMap;function mm(t,e){let n=o5.get(t);if(n||(n={},o5.set(t,n)),n[e]===void 0){const i=Ef(t.body);n[e]=JSON.stringify(i==null?void 0:i[e])}return n[e]}function ghe(t,e){if(e.timestamp-t.timestamp>300*1e3)return{reason:"ttl",reasons:["ttl"]};const i=Ef(t.body),r=Ef(e.body);if(!i||!r)return{reason:"key_change",reasons:["key_change"]};const s=[];i.model!==r.model&&s.push("model_change");const o=mm(t,"system"),a=mm(e,"system");o!==a&&s.push("system_change");const l=mm(t,"tools"),c=mm(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 A_(t){return t?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):""}function h7(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
717
|
`):JSON.stringify(t.content):String(t.content??"")}const vhe=[{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 Wv(t){if(!t)return null;for(const e of vhe)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}}const $he={Claude:3,OpenAI:3,Gemini:5,DeepSeek:5,Qwen:5,GLM:10,Kimi:10,MiniMax:10},bhe=10;function a5(t){const e=Wv(t);return e&&$he[e.provider]||bhe}function zg(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 She(t){return t==null||t===0?"0":t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"K":String(t)}function Ef(t){if(Array.isArray(t))return t.map(Ef);if(t&&typeof t=="object"){const e={};for(const n of Object.keys(t))n.startsWith("_")||(e[n]=Ef(t[n]));return e}return t}function dYe(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 uYe(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=mhe(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 hYe(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 OYe(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"||!z_(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 l5(t){return typeof t!="string"?!1:t.includes("<system-reminder>")&&t.includes("# claudeMd")}function c5(t){return typeof t!="string"?!1:t.includes("<system-reminder>")&&t.includes("skills are available")}function fYe(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(l5(i))return!0}else if(Array.isArray(i)){for(const r of i)if(r.type==="text"&&l5(r.text))return!0}}return!1}function pYe(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(c5(i))return!0}else if(Array.isArray(i)){for(const r of i)if(r.type==="text"&&c5(r.text))return!0}}return!1}function mYe(t){return t?t.replace(/^claude-/,"").replace(/-\d{8,}$/,""):null}function Ag(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 OS(t){return t.filter(Ag)}function gYe(t,e){for(let n=e-1;n>=0;n--)if(Ns(t[n])&&t[n].timestamp)return t[n].timestamp;return null}function yhe(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(Ns(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&&r.cacheReadTokens>0&&n.messages.length>0&&(c=n.messages.length-1),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_use"){const p=O.input?JSON.stringify(O.input):"",m=p.length>200?p.substring(0,200)+"...":p;r.messages.push(`[${u.role}] ${O.name}(${m})`)}else if(O.type==="tool_result"){const p=h7(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 _he="ccv_entryCache",pc="entries",PP="cache",CP="ccv_cacheMeta",whe=2,O7=10080*60*1e3;let Zd=null,Gd=null;function kh(){return Zd?Promise.resolve(Zd):Gd||(Gd=new Promise((t,e)=>{const n=indexedDB.open(_he,whe);n.onupgradeneeded=()=>{const i=n.result;i.objectStoreNames.contains(pc)||i.createObjectStore(pc),i.objectStoreNames.contains("sessions")||i.createObjectStore("sessions"),i.objectStoreNames.contains("session_index")||i.createObjectStore("session_index")},n.onsuccess=()=>{Zd=n.result,Zd.onclose=()=>{Zd=null},Gd=null,t(Zd)},n.onerror=()=>{Gd=null,e(n.error)}}),Gd)}let d5=0;function xhe(t,e){try{const n=e[e.length-1],i=(n==null?void 0:n.timestamp)||null;i&&localStorage.setItem(CP,JSON.stringify({projectName:t,lastTs:i,count:e.length}))}catch{}}function Qhe(){try{localStorage.removeItem(CP)}catch{}}function u5(){try{const t=localStorage.getItem(CP);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 jl(t,e){if(!t||!Array.isArray(e)||e.length===0)return;const n=++d5;try{const i=await kh();return n!==d5?void 0:(xhe(t,e),new Promise(r=>{const s=i.transaction(pc,"readwrite");s.objectStore(pc).put({projectName:t,entries:e,ts:Date.now()},PP),s.oncomplete=()=>r(),s.onerror=()=>r()}))}catch{}}async function Phe(t){try{const e=await kh();return new Promise(n=>{const r=e.transaction(pc,"readonly").objectStore(pc).get(PP);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>O7?(I_(),n(null)):n(s.entries)},r.onerror=()=>n(null)})}catch{return null}}async function I_(){Qhe();try{const t=await kh();return new Promise(e=>{const n=t.transaction(pc,"readwrite");n.objectStore(pc).delete(PP),n.oncomplete=()=>e(),n.onerror=()=>e()})}catch{}}async function gm(t,e,n){if(!(!t||n==null))try{const i=await kh(),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 Che(t,e){try{const n=await kh(),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>O7?r(null):r(a.entries)},o.onerror=()=>r(null)})}catch{return null}}async function vm(t,e){if(!(!t||!Array.isArray(e)))try{const n=await kh();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 da=8;function $m(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=The(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 The(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 Kh(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 fS(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 khe(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 Lv(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 M_(t){return t._deltaFormat&&t.mainAgent}function Jh(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(!M_(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)&&(Lv(o)?e=[...a]:(e=[...e,...a],o.body.messages=e,o._totalMessageCount&&e.length!==o._totalMessageCount&&n.push(s)))}return n.length>0&&Rhe(t,n),t}function Rhe(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||Lv(a))&&c>=s){r.body.messages=l.slice(0,s);break}}}}function Ehe(){let t=[];return{reconstruct(e){var i,r,s;if(e.inProgress){if(M_(e)&&!Lv(e)){const o=(i=e.body)==null?void 0:i.messages;Array.isArray(o)&&(e.body.messages=[...t,...o])}return e}if(!M_(e))return e.mainAgent&&Array.isArray((r=e.body)==null?void 0:r.messages)&&(t=[...e.body.messages]),e;const n=(s=e.body)==null?void 0:s.messages;return Array.isArray(n)&&(Lv(e)?t=[...n]:(t=[...t,...n],e.body.messages=t)),e},reset(){t=[]}}}/*! @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:f7,setPrototypeOf:h5,isFrozen:Xhe,getPrototypeOf:zhe,getOwnPropertyDescriptor:Ahe}=Object;let{freeze:Ps,seal:Ao,create:Ig}=Object,{apply:j_,construct:N_}=typeof Reflect<"u"&&Reflect;Ps||(Ps=function(e){return e});Ao||(Ao=function(e){return e});j_||(j_=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)});N_||(N_=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 bm=Cs(Array.prototype.forEach),Ihe=Cs(Array.prototype.lastIndexOf),O5=Cs(Array.prototype.pop),eO=Cs(Array.prototype.push),Mhe=Cs(Array.prototype.splice),Mg=Cs(String.prototype.toLowerCase),pS=Cs(String.prototype.toString),mS=Cs(String.prototype.match),tO=Cs(String.prototype.replace),jhe=Cs(String.prototype.indexOf),Nhe=Cs(String.prototype.trim),no=Cs(Object.prototype.hasOwnProperty),ps=Cs(RegExp.prototype.test),nO=Whe(TypeError);function Cs(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 j_(t,e,i)}}function Whe(t){return function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return N_(t,n)}}function yn(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Mg;h5&&h5(t,null);let i=e.length;for(;i--;){let r=e[i];if(typeof r=="string"){const s=n(r);s!==r&&(Xhe(e)||(e[i]=s),r=s)}t[r]=!0}return t}function Lhe(t){for(let e=0;e<t.length;e++)no(t,e)||(t[e]=null);return t}function $a(t){const e=Ig(null);for(const[n,i]of f7(t))no(t,n)&&(Array.isArray(i)?e[n]=Lhe(i):i&&typeof i=="object"&&i.constructor===Object?e[n]=$a(i):e[n]=i);return e}function iO(t,e){for(;t!==null;){const i=Ahe(t,e);if(i){if(i.get)return Cs(i.get);if(typeof i.value=="function")return Cs(i.value)}t=zhe(t)}function n(){return null}return n}const f5=Ps(["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"]),gS=Ps(["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"]),vS=Ps(["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"]),Vhe=Ps(["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"]),$S=Ps(["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"]),Bhe=Ps(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),p5=Ps(["#text"]),m5=Ps(["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"]),bS=Ps(["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"]),g5=Ps(["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"]),Sm=Ps(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Yhe=Ao(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Dhe=Ao(/<%[\w\W]*|[\w\W]*%>/gm),Uhe=Ao(/\$\{[\w\W]*/gm),qhe=Ao(/^data-[\-\w.\u00B7-\uFFFF]+$/),Zhe=Ao(/^aria-[\-\w]+$/),p7=Ao(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ghe=Ao(/^(?:\w+script|data):/i),Fhe=Ao(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),m7=Ao(/^html$/i),Hhe=Ao(/^[a-z][.\w]*(-[.\w]+)+$/i);var v5=Object.freeze({__proto__:null,ARIA_ATTR:Zhe,ATTR_WHITESPACE:Fhe,CUSTOM_ELEMENT:Hhe,DATA_ATTR:qhe,DOCTYPE_NAME:m7,ERB_EXPR:Dhe,IS_ALLOWED_URI:p7,IS_SCRIPT_OR_DATA:Ghe,MUSTACHE_EXPR:Yhe,TMPLIT_EXPR:Uhe});const rO={element:1,text:3,progressingInstruction:7,comment:8,document:9},Khe=function(){return typeof window>"u"?null:window},Jhe=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}},$5=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function g7(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Khe();const e=Ge=>g7(Ge);if(e.version="3.3.3",e.removed=[],!t||!t.document||t.document.nodeType!==rO.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=iO(p,"cloneNode"),g=iO(p,"remove"),v=iO(p,"nextSibling"),$=iO(p,"childNodes"),b=iO(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:x,createDocumentFragment:k,getElementsByTagName:T}=n,{importNode:z}=i;let E=$5();e.isSupported=typeof f7=="function"&&typeof b=="function"&&Q&&Q.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:P,ERB_EXPR:C,TMPLIT_EXPR:w,DATA_ATTR:R,ARIA_ATTR:X,IS_SCRIPT_OR_DATA:A,ATTR_WHITESPACE:M,CUSTOM_ELEMENT:j}=v5;let{IS_ALLOWED_URI:N}=v5,W=null;const B=yn({},[...f5,...gS,...vS,...$S,...p5]);let L=null;const D=yn({},[...m5,...bS,...g5,...Sm]);let q=Object.seal(Ig(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}})),te=null,le=null;const F=Object.seal(Ig(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ne=!0,he=!0,ce=!1,ie=!0,H=!1,Y=!0,Z=!1,V=!1,ee=!1,se=!1,pe=!1,be=!1,ue=!0,ge=!1;const Oe="user-content-";let me=!0,Pe=!1,Ie={},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 Te=null;const Qe=yn({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),We="http://www.w3.org/1998/Math/MathML",Ne="http://www.w3.org/2000/svg",Ve="http://www.w3.org/1999/xhtml";let Xe=Ve,qe=!1,nt=null;const ft=yn({},[We,Ne,Ve],pS);let Wt=yn({},["mi","mo","mn","ms","mtext"]),Yt=yn({},["annotation-xml"]);const At=yn({},["title","style","font","a","script"]);let rn=null;const ae=["application/xhtml+xml","text/html"],ye="text/html";let _e=null,Je=null;const _t=n.createElement("form"),Be=function(de){return de instanceof RegExp||de instanceof Function},Ae=function(){let de=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Je&&Je===de)){if((!de||typeof de!="object")&&(de={}),de=$a(de),rn=ae.indexOf(de.PARSER_MEDIA_TYPE)===-1?ye:de.PARSER_MEDIA_TYPE,_e=rn==="application/xhtml+xml"?pS:Mg,W=no(de,"ALLOWED_TAGS")?yn({},de.ALLOWED_TAGS,_e):B,L=no(de,"ALLOWED_ATTR")?yn({},de.ALLOWED_ATTR,_e):D,nt=no(de,"ALLOWED_NAMESPACES")?yn({},de.ALLOWED_NAMESPACES,pS):ft,Te=no(de,"ADD_URI_SAFE_ATTR")?yn($a(Qe),de.ADD_URI_SAFE_ATTR,_e):Qe,De=no(de,"ADD_DATA_URI_TAGS")?yn($a(et),de.ADD_DATA_URI_TAGS,_e):et,Ue=no(de,"FORBID_CONTENTS")?yn({},de.FORBID_CONTENTS,_e):Ze,te=no(de,"FORBID_TAGS")?yn({},de.FORBID_TAGS,_e):$a({}),le=no(de,"FORBID_ATTR")?yn({},de.FORBID_ATTR,_e):$a({}),Ie=no(de,"USE_PROFILES")?de.USE_PROFILES:!1,ne=de.ALLOW_ARIA_ATTR!==!1,he=de.ALLOW_DATA_ATTR!==!1,ce=de.ALLOW_UNKNOWN_PROTOCOLS||!1,ie=de.ALLOW_SELF_CLOSE_IN_ATTR!==!1,H=de.SAFE_FOR_TEMPLATES||!1,Y=de.SAFE_FOR_XML!==!1,Z=de.WHOLE_DOCUMENT||!1,se=de.RETURN_DOM||!1,pe=de.RETURN_DOM_FRAGMENT||!1,be=de.RETURN_TRUSTED_TYPE||!1,ee=de.FORCE_BODY||!1,ue=de.SANITIZE_DOM!==!1,ge=de.SANITIZE_NAMED_PROPS||!1,me=de.KEEP_CONTENT!==!1,Pe=de.IN_PLACE||!1,N=de.ALLOWED_URI_REGEXP||p7,Xe=de.NAMESPACE||Ve,Wt=de.MATHML_TEXT_INTEGRATION_POINTS||Wt,Yt=de.HTML_INTEGRATION_POINTS||Yt,q=de.CUSTOM_ELEMENT_HANDLING||{},de.CUSTOM_ELEMENT_HANDLING&&Be(de.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(q.tagNameCheck=de.CUSTOM_ELEMENT_HANDLING.tagNameCheck),de.CUSTOM_ELEMENT_HANDLING&&Be(de.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(q.attributeNameCheck=de.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),de.CUSTOM_ELEMENT_HANDLING&&typeof de.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(q.allowCustomizedBuiltInElements=de.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),H&&(he=!1),pe&&(se=!0),Ie&&(W=yn({},p5),L=Ig(null),Ie.html===!0&&(yn(W,f5),yn(L,m5)),Ie.svg===!0&&(yn(W,gS),yn(L,bS),yn(L,Sm)),Ie.svgFilters===!0&&(yn(W,vS),yn(L,bS),yn(L,Sm)),Ie.mathMl===!0&&(yn(W,$S),yn(L,g5),yn(L,Sm))),no(de,"ADD_TAGS")||(F.tagCheck=null),no(de,"ADD_ATTR")||(F.attributeCheck=null),de.ADD_TAGS&&(typeof de.ADD_TAGS=="function"?F.tagCheck=de.ADD_TAGS:(W===B&&(W=$a(W)),yn(W,de.ADD_TAGS,_e))),de.ADD_ATTR&&(typeof de.ADD_ATTR=="function"?F.attributeCheck=de.ADD_ATTR:(L===D&&(L=$a(L)),yn(L,de.ADD_ATTR,_e))),de.ADD_URI_SAFE_ATTR&&yn(Te,de.ADD_URI_SAFE_ATTR,_e),de.FORBID_CONTENTS&&(Ue===Ze&&(Ue=$a(Ue)),yn(Ue,de.FORBID_CONTENTS,_e)),de.ADD_FORBID_CONTENTS&&(Ue===Ze&&(Ue=$a(Ue)),yn(Ue,de.ADD_FORBID_CONTENTS,_e)),me&&(W["#text"]=!0),Z&&yn(W,["html","head","body"]),W.table&&(yn(W,["tbody"]),delete te.tbody),de.TRUSTED_TYPES_POLICY){if(typeof de.TRUSTED_TYPES_POLICY.createHTML!="function")throw nO('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof de.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw nO('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=de.TRUSTED_TYPES_POLICY,y=S.createHTML("")}else S===void 0&&(S=Jhe(O,r)),S!==null&&typeof y=="string"&&(y=S.createHTML(""));Ps&&Ps(de),Je=de}},Re=yn({},[...gS,...vS,...Vhe]),xe=yn({},[...$S,...Bhe]),Ee=function(de){let ve=b(de);(!ve||!ve.tagName)&&(ve={namespaceURI:Xe,tagName:"template"});const ke=Mg(de.tagName),dt=Mg(ve.tagName);return nt[de.namespaceURI]?de.namespaceURI===Ne?ve.namespaceURI===Ve?ke==="svg":ve.namespaceURI===We?ke==="svg"&&(dt==="annotation-xml"||Wt[dt]):!!Re[ke]:de.namespaceURI===We?ve.namespaceURI===Ve?ke==="math":ve.namespaceURI===Ne?ke==="math"&&Yt[dt]:!!xe[ke]:de.namespaceURI===Ve?ve.namespaceURI===Ne&&!Yt[dt]||ve.namespaceURI===We&&!Wt[dt]?!1:!xe[ke]&&(At[ke]||!Re[ke]):!!(rn==="application/xhtml+xml"&&nt[de.namespaceURI]):!1},we=function(de){eO(e.removed,{element:de});try{b(de).removeChild(de)}catch{g(de)}},Ye=function(de,ve){try{eO(e.removed,{attribute:ve.getAttributeNode(de),from:ve})}catch{eO(e.removed,{attribute:null,from:ve})}if(ve.removeAttribute(de),de==="is")if(se||pe)try{we(ve)}catch{}else try{ve.setAttribute(de,"")}catch{}},gt=function(de){let ve=null,ke=null;if(ee)de="<remove></remove>"+de;else{const tt=mS(de,/^[\r\n\t ]+/);ke=tt&&tt[0]}rn==="application/xhtml+xml"&&Xe===Ve&&(de='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+de+"</body></html>");const dt=S?S.createHTML(de):de;if(Xe===Ve)try{ve=new h().parseFromString(dt,rn)}catch{}if(!ve||!ve.documentElement){ve=Q.createDocument(Xe,"template",null);try{ve.documentElement.innerHTML=qe?y:dt}catch{}}const mt=ve.body||ve.documentElement;return de&&ke&&mt.insertBefore(n.createTextNode(ke),mt.childNodes[0]||null),Xe===Ve?T.call(ve,Z?"html":"body")[0]:Z?ve.documentElement:mt},vt=function(de){return x.call(de.ownerDocument||de,de,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ut=function(de){return de instanceof u&&(typeof de.nodeName!="string"||typeof de.textContent!="string"||typeof de.removeChild!="function"||!(de.attributes instanceof d)||typeof de.removeAttribute!="function"||typeof de.setAttribute!="function"||typeof de.namespaceURI!="string"||typeof de.insertBefore!="function"||typeof de.hasChildNodes!="function")},st=function(de){return typeof a=="function"&&de instanceof a};function He(Ge,de,ve){bm(Ge,ke=>{ke.call(e,de,ve,Je)})}const Ct=function(de){let ve=null;if(He(E.beforeSanitizeElements,de,null),Ut(de))return we(de),!0;const ke=_e(de.nodeName);if(He(E.uponSanitizeElement,de,{tagName:ke,allowedTags:W}),Y&&de.hasChildNodes()&&!st(de.firstElementChild)&&ps(/<[/\w!]/g,de.innerHTML)&&ps(/<[/\w!]/g,de.textContent)||de.nodeType===rO.progressingInstruction||Y&&de.nodeType===rO.comment&&ps(/<[/\w]/g,de.data))return we(de),!0;if(!(F.tagCheck instanceof Function&&F.tagCheck(ke))&&(!W[ke]||te[ke])){if(!te[ke]&&Kt(ke)&&(q.tagNameCheck instanceof RegExp&&ps(q.tagNameCheck,ke)||q.tagNameCheck instanceof Function&&q.tagNameCheck(ke)))return!1;if(me&&!Ue[ke]){const dt=b(de)||de.parentNode,mt=$(de)||de.childNodes;if(mt&&dt){const tt=mt.length;for(let it=tt-1;it>=0;--it){const Rt=m(mt[it],!0);Rt.__removalCount=(de.__removalCount||0)+1,dt.insertBefore(Rt,v(de))}}}return we(de),!0}return de instanceof l&&!Ee(de)||(ke==="noscript"||ke==="noembed"||ke==="noframes")&&ps(/<\/no(script|embed|frames)/i,de.innerHTML)?(we(de),!0):(H&&de.nodeType===rO.text&&(ve=de.textContent,bm([P,C,w],dt=>{ve=tO(ve,dt," ")}),de.textContent!==ve&&(eO(e.removed,{element:de.cloneNode()}),de.textContent=ve)),He(E.afterSanitizeElements,de,null),!1)},Zt=function(de,ve,ke){if(le[ve]||ue&&(ve==="id"||ve==="name")&&(ke in n||ke in _t))return!1;if(!(he&&!le[ve]&&ps(R,ve))){if(!(ne&&ps(X,ve))){if(!(F.attributeCheck instanceof Function&&F.attributeCheck(ve,de))){if(!L[ve]||le[ve]){if(!(Kt(de)&&(q.tagNameCheck instanceof RegExp&&ps(q.tagNameCheck,de)||q.tagNameCheck instanceof Function&&q.tagNameCheck(de))&&(q.attributeNameCheck instanceof RegExp&&ps(q.attributeNameCheck,ve)||q.attributeNameCheck instanceof Function&&q.attributeNameCheck(ve,de))||ve==="is"&&q.allowCustomizedBuiltInElements&&(q.tagNameCheck instanceof RegExp&&ps(q.tagNameCheck,ke)||q.tagNameCheck instanceof Function&&q.tagNameCheck(ke))))return!1}else if(!Te[ve]){if(!ps(N,tO(ke,M,""))){if(!((ve==="src"||ve==="xlink:href"||ve==="href")&&de!=="script"&&jhe(ke,"data:")===0&&De[de])){if(!(ce&&!ps(A,tO(ke,M,"")))){if(ke)return!1}}}}}}}return!0},Kt=function(de){return de!=="annotation-xml"&&mS(de,j)},Jt=function(de){He(E.beforeSanitizeAttributes,de,null);const{attributes:ve}=de;if(!ve||Ut(de))return;const ke={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:L,forceKeepAttr:void 0};let dt=ve.length;for(;dt--;){const mt=ve[dt],{name:tt,namespaceURI:it,value:Rt}=mt,Gt=_e(tt),Se=Rt;let ze=tt==="value"?Se:Nhe(Se);if(ke.attrName=Gt,ke.attrValue=ze,ke.keepAttr=!0,ke.forceKeepAttr=void 0,He(E.uponSanitizeAttribute,de,ke),ze=ke.attrValue,ge&&(Gt==="id"||Gt==="name")&&(Ye(tt,de),ze=Oe+ze),Y&&ps(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ze)){Ye(tt,de);continue}if(Gt==="attributename"&&mS(ze,"href")){Ye(tt,de);continue}if(ke.forceKeepAttr)continue;if(!ke.keepAttr){Ye(tt,de);continue}if(!ie&&ps(/\/>/i,ze)){Ye(tt,de);continue}H&&bm([P,C,w],qt=>{ze=tO(ze,qt," ")});const rt=_e(de.nodeName);if(!Zt(rt,Gt,ze)){Ye(tt,de);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!==Se)try{it?de.setAttributeNS(it,tt,ze):de.setAttribute(tt,ze),Ut(de)?we(de):O5(e.removed)}catch{Ye(tt,de)}}He(E.afterSanitizeAttributes,de,null)},mn=function Ge(de){let ve=null;const ke=vt(de);for(He(E.beforeSanitizeShadowDOM,de,null);ve=ke.nextNode();)He(E.uponSanitizeShadowNode,ve,null),Ct(ve),Jt(ve),ve.content instanceof s&&Ge(ve.content);He(E.afterSanitizeShadowDOM,de,null)};return e.sanitize=function(Ge){let de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ve=null,ke=null,dt=null,mt=null;if(qe=!Ge,qe&&(Ge="<!-->"),typeof Ge!="string"&&!st(Ge))if(typeof Ge.toString=="function"){if(Ge=Ge.toString(),typeof Ge!="string")throw nO("dirty is not a string, aborting")}else throw nO("toString is not a function");if(!e.isSupported)return Ge;if(V||Ae(de),e.removed=[],typeof Ge=="string"&&(Pe=!1),Pe){if(Ge.nodeName){const Rt=_e(Ge.nodeName);if(!W[Rt]||te[Rt])throw nO("root node is forbidden and cannot be sanitized in-place")}}else if(Ge instanceof a)ve=gt("<!---->"),ke=ve.ownerDocument.importNode(Ge,!0),ke.nodeType===rO.element&&ke.nodeName==="BODY"||ke.nodeName==="HTML"?ve=ke:ve.appendChild(ke);else{if(!se&&!H&&!Z&&Ge.indexOf("<")===-1)return S&&be?S.createHTML(Ge):Ge;if(ve=gt(Ge),!ve)return se?null:be?y:""}ve&&ee&&we(ve.firstChild);const tt=vt(Pe?Ge:ve);for(;dt=tt.nextNode();)Ct(dt),Jt(dt),dt.content instanceof s&&mn(dt.content);if(Pe)return Ge;if(se){if(pe)for(mt=k.call(ve.ownerDocument);ve.firstChild;)mt.appendChild(ve.firstChild);else mt=ve;return(L.shadowroot||L.shadowrootmode)&&(mt=z.call(i,mt,!0)),mt}let it=Z?ve.outerHTML:ve.innerHTML;return Z&&W["!doctype"]&&ve.ownerDocument&&ve.ownerDocument.doctype&&ve.ownerDocument.doctype.name&&ps(m7,ve.ownerDocument.doctype.name)&&(it="<!DOCTYPE "+ve.ownerDocument.doctype.name+`>
|
|
718
|
-
`+it),H&&bm([P,C,w],Rt=>{it=tO(it,Rt," ")}),S&&be?S.createHTML(it):it},e.setConfig=function(){let Ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ae(Ge),V=!0},e.clearConfig=function(){Je=null,V=!1},e.isValidAttribute=function(Ge,de,ve){Je||Ae({});const ke=_e(Ge),dt=_e(de);return Zt(ke,dt,ve)},e.addHook=function(Ge,de){typeof de=="function"&&eO(E[Ge],de)},e.removeHook=function(Ge,de){if(de!==void 0){const ve=Ihe(E[Ge],de);return ve===-1?void 0:Mhe(E[Ge],ve,1)[0]}return O5(E[Ge])},e.removeHooks=function(Ge){E[Ge]=[]},e.removeAllHooks=function(){E=$5()},e}var R0=g7();let sO=null,jg=null,b5=!1,SS=null,W_=new Set;const eOe={theme:"dark",darkMode:!0,themeVariables:{darkMode:!0,background:"#0d1117",primaryColor:"#1a3a5c",primaryTextColor:"#c9d1d9",primaryBorderColor:"#30363d",lineColor:"#58a6ff",secondaryColor:"#161b22",tertiaryColor:"#0d1117",nodeTextColor:"#c9d1d9",edgeLabelBackground:"#0d1117"}},tOe={theme:"default",darkMode:!1,themeVariables:{darkMode:!1,background:"#FFFFFF",primaryColor:"#dce8f5",primaryTextColor:"#1a1a1a",primaryBorderColor:"#E0E0E0",lineColor:"#0969DA",secondaryColor:"#F0F0F0",tertiaryColor:"#F5F5F5",nodeTextColor:"#1a1a1a",edgeLabelBackground:"#FFFFFF"}};function v7(){return document.documentElement.getAttribute("data-theme")==="light"?tOe:eOe}function nOe(){return sO||(sO=y6(()=>import("./mermaid.core-CYFQULah.js").then(t=>t.bC),__vite__mapDeps([0,1,2])).then(t=>{const e=t.default,n=v7();return e.initialize({startOnLoad:!1,securityLevel:"strict",flowchart:{useMaxWidth:!0},...n}),jg=e,e}).catch(()=>(sO=null,null)),sO)}async function iOe(t){if(!t)return;const e=t.querySelectorAll("code.language-mermaid");if(e.length===0)return;const n=await nOe();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.dataset.mermaidSrc=s,l.innerHTML=R0.sanitize(a,{USE_PROFILES:{svg:!0,svgFilters:!0},ADD_TAGS:["style","foreignObject"]}),r.replaceWith(l)}catch{}}}function rOe(){SS||(SS=requestAnimationFrame(()=>{SS=null;const t=W_;W_=new Set;for(const e of t)e.isConnected&&iOe(e)}))}function sOe(){if(b5||typeof document>"u")return;b5=!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"))){W_.add(s),rOe();return}}),e=()=>t.observe(document.body,{childList:!0,subtree:!0});document.body?e():document.addEventListener("DOMContentLoaded",e)}async function oOe(){if(!jg)return;const t=v7();jg.initialize({startOnLoad:!1,securityLevel:"strict",flowchart:{useMaxWidth:!0},...t});const e=document.querySelectorAll(".mermaid-diagram[data-mermaid-src]");for(const n of e){const i=n.dataset.mermaidSrc;try{const r="mmd-"+Math.random().toString(36).slice(2,9),{svg:s}=await jg.render(r,i);n.innerHTML=R0.sanitize(s,{USE_PROFILES:{svg:!0,svgFilters:!0},ADD_TAGS:["style","foreignObject"]})}catch{}}}const aOe="_layout_195sz_1",lOe="_header_195sz_6",cOe="_content_195sz_14",dOe="_mainContainer_195sz_19",uOe="_leftPanel_195sz_24",hOe="_leftPanelHeader_195sz_36",OOe="_leftPanelCount_195sz_47",fOe="_leftPanelBody_195sz_53",pOe="_rightPanel_195sz_58",mOe="_modalActions_195sz_64",gOe="_spinCenter_195sz_68",vOe="_emptyCenter_195sz_73",$Oe="_logListContainer_195sz_83",bOe="_loadingOverlay_195sz_131",SOe="_dragOverlay_195sz_144",yOe="_dragOverlayContent_195sz_158",_Oe="_dragIcon_195sz_167",wOe="_loadingText_195sz_171",xOe="_mobileLoadingOverlay_195sz_177",QOe="_mobileLoadingSpinner_195sz_189",POe="_mobileLoadingLabel_195sz_202",COe="_footer_195sz_208",TOe="_footerRight_195sz_219",kOe="_footerLink_195sz_232",ROe="_footerIcon_195sz_244",EOe="_footerSep_195sz_249",XOe="_footerVersion_195sz_254",zOe="_footerVersionNew_195sz_264",AOe="_newBadge_195sz_274",IOe="_guideContainer_195sz_286",MOe="_guideContent_195sz_294",jOe="_guideTitle_195sz_299",NOe="_guideStep_195sz_306",WOe="_guideStepNum_195sz_312",LOe="_guideStepBody_195sz_327",VOe="_guideText_195sz_332",BOe="_guideCode_195sz_339",YOe="_mobileChatOverlay_195sz_352",DOe="_mobileChatOverlayVisible_195sz_364",UOe="_mobileNavBtn_195sz_368",qOe="_mobileChatInner_195sz_373",ZOe="_mobileGitDiffOverlay_195sz_392",GOe="_mobileGitDiffOverlayVisible_195sz_404",FOe="_mobileGitDiffInner_195sz_408",HOe="_mobileMenuBtn_195sz_435",KOe="_mobileMenuOverlay_195sz_452",JOe="_mobileMenuDropdown_195sz_458",efe="_mobileMenuItem_195sz_472",tfe="_mobileStatsOverlay_195sz_490",nfe="_mobileStatsOverlayVisible_195sz_502",ife="_mobileStatsInner_195sz_506",rfe="_mobileLogMgmtOverlay_195sz_513",sfe="_mobileLogMgmtOverlayVisible_195sz_525",ofe="_mobileLogMgmtHeader_195sz_529",afe="_mobileLogMgmtTitle_195sz_538",lfe="_mobileLogMgmtClose_195sz_544",cfe="_mobileLogMgmtActions_195sz_559",dfe="_mobileLogMgmtBody_195sz_567",ufe="_mobileSettingsOverlay_195sz_574",hfe="_mobileSettingsOverlayVisible_195sz_586",Ofe="_mobilePromptOverlay_195sz_590",ffe="_mobilePromptOverlayVisible_195sz_602",pfe="_mobilePromptBody_195sz_606",mfe="_mobilePromptList_195sz_614",gfe="_mobilePromptItem_195sz_620",vfe="_mobilePromptTimestamp_195sz_625",$fe="_mobilePromptCard_195sz_632",bfe="_mobilePromptPreText_195sz_640",Sfe="_tableTimestampCell_195sz_650",yfe="_tablePreviewText_195sz_654",_fe="_tablePreviewTextClickable_195sz_663",wfe="_tableTag_195sz_673",xfe="_tableActionsCell_195sz_679",Qfe="_mobileCLIRoot_195sz_685",Pfe="_mobileCLIHeader_195sz_694",Cfe="_mobileCLIHeaderLeft_195sz_705",Tfe="_mobileCLIStatusLabel_195sz_711",kfe="_mobileCLIHeaderRight_195sz_716",Rfe="_mobileCLIBody_195sz_722",Efe="_mobileSettingsBody_195sz_731",Xfe="_mobileSettingsSectionTitle_195sz_735",zfe="_mobileSettingsRow_195sz_742",Afe="_mobileSettingsLabel_195sz_750",Ife="_mobilePromptEmpty_195sz_756",Mfe="_mobilePromptHeader_195sz_763",jfe="_mobilePromptCount_195sz_771",Nfe="_chatViewWrapper_195sz_777",Wfe="_resumeFooterRight_195sz_783",Lfe="_resumeFooterLeft_195sz_788",Vfe="_resumeCheckboxOpacity_195sz_792",Bfe="_btnMarginLeft_195sz_796",Yfe="_btnMarginRight_195sz_800",Dfe="_modalTitleInline_195sz_805",Ufe="_previewPopover_195sz_812",qfe="_previewItem_195sz_818",Zfe="_previewText_195sz_830",il={layout:aOe,header:lOe,content:cOe,mainContainer:dOe,leftPanel:uOe,leftPanelHeader:hOe,leftPanelCount:OOe,leftPanelBody:fOe,rightPanel:pOe,modalActions:mOe,spinCenter:gOe,emptyCenter:vOe,logListContainer:$Oe,loadingOverlay:bOe,dragOverlay:SOe,dragOverlayContent:yOe,dragIcon:_Oe,loadingText:wOe,mobileLoadingOverlay:xOe,mobileLoadingSpinner:QOe,mobileLoadingLabel:POe,footer:COe,footerRight:TOe,footerLink:kOe,footerIcon:ROe,footerSep:EOe,footerVersion:XOe,footerVersionNew:zOe,newBadge:AOe,guideContainer:IOe,guideContent:MOe,guideTitle:jOe,guideStep:NOe,guideStepNum:WOe,guideStepBody:LOe,guideText:VOe,guideCode:BOe,mobileChatOverlay:YOe,mobileChatOverlayVisible:DOe,mobileNavBtn:UOe,mobileChatInner:qOe,mobileGitDiffOverlay:ZOe,mobileGitDiffOverlayVisible:GOe,mobileGitDiffInner:FOe,mobileMenuBtn:HOe,mobileMenuOverlay:KOe,mobileMenuDropdown:JOe,mobileMenuItem:efe,mobileStatsOverlay:tfe,mobileStatsOverlayVisible:nfe,mobileStatsInner:ife,mobileLogMgmtOverlay:rfe,mobileLogMgmtOverlayVisible:sfe,mobileLogMgmtHeader:ofe,mobileLogMgmtTitle:afe,mobileLogMgmtClose:lfe,mobileLogMgmtActions:cfe,mobileLogMgmtBody:dfe,mobileSettingsOverlay:ufe,mobileSettingsOverlayVisible:hfe,mobilePromptOverlay:Ofe,mobilePromptOverlayVisible:ffe,mobilePromptBody:pfe,mobilePromptList:mfe,mobilePromptItem:gfe,mobilePromptTimestamp:vfe,mobilePromptCard:$fe,mobilePromptPreText:bfe,tableTimestampCell:Sfe,tablePreviewText:yfe,tablePreviewTextClickable:_fe,tableTag:wfe,tableActionsCell:xfe,mobileCLIRoot:Qfe,mobileCLIHeader:Pfe,mobileCLIHeaderLeft:Cfe,mobileCLIStatusLabel:Tfe,mobileCLIHeaderRight:kfe,mobileCLIBody:Rfe,mobileSettingsBody:Efe,mobileSettingsSectionTitle:Xfe,mobileSettingsRow:zfe,mobileSettingsLabel:Afe,mobilePromptEmpty:Ife,mobilePromptHeader:Mfe,mobilePromptCount:jfe,chatViewWrapper:Nfe,resumeFooterRight:Wfe,resumeFooterLeft:Lfe,resumeCheckboxOpacity:Vfe,btnMarginLeft:Bfe,btnMarginRight:Yfe,modalTitleInline:Dfe,previewPopover:Ufe,previewItem:qfe,previewText:Zfe},S5=an&&!Ai?30:100;class vYe extends G.Component{constructor(n){super(n);Fe(this,"_resetSSETimeout",()=>{this._sseTimeoutTimer&&clearTimeout(this._sseTimeoutTimer),this._sseReconnectCount=0,this._sseTimeoutTimer=setTimeout(()=>{console.warn("SSE heartbeat timeout, reconnecting..."),this._reconnectSSE()},45e3)});Fe(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._sseSlimmer||(this._sseSlimmer=Ohe(Ns)),this._sseReconstructor||(this._sseReconstructor=Ehe());for(const p of n){const m=this._sseReconstructor.reconstruct(p),g=`${m.timestamp}|${m.url}`,v=this._requestIndexMap.get(g);if(v!==void 0)r[v]=m,this._sseSlimmer&&this._sseSlimmer.onDedup(v);else{const $=r.length;this._sseSlimmer&&this._sseSlimmer.processEntry(m,r,$),this._requestIndexMap.set(g,$),r.push(m)}if(Ns(m)&&!m.inProgress&&((d=(c=m.response)==null?void 0:c.body)!=null&&d.usage)){const $=yhe([m]);$&&($.system.length>0||$.messages.length>0||$.tools.length>0)&&(this._lastKvCacheContent=$)}if(Ns(m)){const $=(h=(u=m.response)==null?void 0:u.body)==null?void 0:h.usage;if($!=null&&$.cache_creation){const b=$.cache_creation,S=m.timestamp?new Date(m.timestamp).getTime():Date.now();let y=null,Q=null;if(b.ephemeral_1h_input_tokens>0?(y=S+3600*1e3,Q="1h"):b.ephemeral_5m_input_tokens>0&&(y=S+300*1e3,Q="5m"),y&&y>Date.now()){s=y;const x=($.cache_read_input_tokens||0)+($.cache_creation_input_tokens||0);o=x>0?She(x):Q,localStorage.setItem("ccv_cacheExpireAt",String(s)),localStorage.setItem("ccv_cacheType",o)}}}if(Ns(m)&&m.body&&Array.isArray(m.body.messages)&&!m._slimmed){const $=m.timestamp||new Date().toISOString(),b=a.length>0?a[a.length-1]:null,S=(b==null?void 0:b.messages)||[],y=m.body.messages,Q=S.length,x=((O=m.body.metadata)==null?void 0:O.user_id)||null,T=!(x!==null&&(b==null?void 0:b.userId)===x)&&Q>0&&y.length<Q*.5&&Q-y.length>4;if(Q>4&&y.length<=4&&y.length<Q*.5)continue;T?this._currentSessionId=$:this._currentSessionId===null&&(this._currentSessionId=$);for(let E=0;E<y.length;E++)!T&&E<Q&&S[E]._timestamp?y[E]._timestamp=S[E]._timestamp:y[E]._timestamp||(y[E]._timestamp=$);a=this.mergeMainAgentSessions(a,m)}m._sessionId=this._currentSessionId}let l=i.selectedIndex;return a.length>S5&&(a=a.slice(-S5)),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:OS(p.requests);return m.length>0?{selectedIndex:m.length-1}:null}return null})},200)),{requests:r,cacheExpireAt:s,cacheType:o,mainAgentSessions:a}},()=>{an&&this.state.projectName&&(this._cacheSaveTimer&&clearTimeout(this._cacheSaveTimer),this._cacheSaveTimer=setTimeout(()=>{this.state.projectName&&this.state.sessionIndex.length===0&&jl(this.state.projectName,this.state.requests)},5e3),this.state.mainAgentSessions.length>da+2&&(this._evictionTimer||(this._evictionTimer=setTimeout(()=>{this._evictionTimer=null,this._evictColdSessions()},1e4))))})});Fe(this,"handleSelectRequest",n=>{this.setState({selectedIndex:n,scrollCenter:!1})});Fe(this,"handleScrollDone",()=>{this.setState({scrollCenter:!1})});Fe(this,"handleScrollTsDone",()=>{this.setState({chatScrollToTs:null})});Fe(this,"handleWorkspaceLaunch",({projectName:n})=>{this._isLocalLog=!1,this._localLogFile=null,this.setState({workspaceMode:!1,projectName:n,viewMode:"chat",cliMode:!0,terminalVisible:!1})});Fe(this,"handleReturnToWorkspaces",()=>{fetch(ut("/api/workspaces/stop"),{method:"POST"}).then(()=>{this._rebuildRequestIndex([]),this.setState({workspaceMode:!0,requests:[],mainAgentSessions:[],projectName:"",selectedIndex:null})}).catch(()=>{})});Fe(this,"handleProxyProfileChange",n=>{fetch(ut("/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(()=>{})});Fe(this,"handleLangChange",()=>{const n=E_();this.setState({lang:n}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lang:n})}).catch(()=>{})});Fe(this,"handleCollapseToolResultsChange",n=>{this.setState({collapseToolResults:n}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({collapseToolResults:n})}).catch(()=>{})});Fe(this,"handleExpandThinkingChange",n=>{this.setState({expandThinking:n}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expandThinking:n})}).catch(()=>{})});Fe(this,"handleExpandDiffChange",n=>{this.setState({expandDiff:n}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expandDiff:n})}).catch(()=>{})});Fe(this,"handleAutoApproveChange",n=>{this.setState({autoApproveSeconds:n}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoApproveSeconds:n})}).catch(()=>{})});Fe(this,"handleThemeColorChange",n=>{this.setState({themeColor:n}),document.documentElement.setAttribute("data-theme",n==="light"?"light":"dark"),oOe(),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({themeColor:n})}).catch(()=>{}),window.dispatchEvent(new CustomEvent("ccv-focus-terminal"))});Fe(this,"handleLogDirChange",n=>{if(!n||typeof n!="string")return;const i=n.trim();i&&(this.setState({logDir:i}),fetch(ut("/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(()=>{}))});Fe(this,"handleShowFullToolContentChange",n=>{this.setState({showFullToolContent:n}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({showFullToolContent:n})}).catch(()=>{})});Fe(this,"handleFilterIrrelevantChange",n=>{this.setState(i=>{const r=!n,s=r?i.requests:OS(i.requests);return{showAll:r,selectedIndex:s.length>0?s.length-1:null}}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filterIrrelevant:n})}).catch(()=>{})});Fe(this,"handleImportLocalLogs",()=>{this.setState({importModalVisible:!0,localLogsLoading:!0}),fetch(ut("/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})})});Fe(this,"handleCloseImportModal",()=>{this.setState({importModalVisible:!1,selectedLogs:new Set})});Fe(this,"handleRefreshStats",()=>{this.setState({refreshingStats:!0}),fetch(ut("/api/refresh-stats"),{method:"POST"}).then(n=>n.json()).then(n=>{if(!n.ok)throw new Error(n.error||"refresh failed");return fetch(ut("/api/local-logs"))}).then(n=>n.json()).then(n=>{const{_currentProject:i,...r}=n;this.setState({localLogs:r,refreshingStats:!1}),wn.success(oe("ui.refreshStatsSuccess"))}).catch(()=>{this.setState({refreshingStats:!1}),wn.error(oe("ui.refreshStatsFailed"))})});Fe(this,"handleToggleLogSelect",(n,i)=>{this.setState(r=>{const s=new Set(r.selectedLogs);return i?s.add(n):s.delete(n),{selectedLogs:s}})});Fe(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)){wn.warning(oe("ui.mergeLatestNotAllowed"));return}for(let c=1;c<o.length;c++)if(o[c]-o[c-1]!==1){wn.warning(oe("ui.mergeNotConsecutive"));return}if(o.reduce((c,d)=>c+s[d].size,0)>500*1024*1024){wn.warning(oe("ui.mergeTooLarge"));return}const l=o.map(c=>s[c].file).reverse();fetch(ut("/api/merge-logs"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:l})}).then(c=>c.json()).then(c=>{c.ok?(wn.success(oe("ui.mergeSuccess")),this.setState({selectedLogs:new Set}),this.handleImportLocalLogs()):wn.error(c.error||"Merge failed")}).catch(()=>wn.error("Merge failed"))});Fe(this,"handleDeleteLogs",()=>{const{selectedLogs:n}=this.state;n.size!==0&&yi.confirm({title:oe("ui.deleteLogs"),content:oe("ui.deleteLogsConfirm",{count:n.size}),okText:oe("ui.deleteLogs"),okButtonProps:{danger:!0},cancelText:oe("ui.cancel"),onOk:()=>{const i=[...n];fetch(ut("/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&&wn.success(oe("ui.deleteSuccess",{count:s})),o>0&&wn.error(oe("ui.deleteFailed",{count:o})),this.setState({selectedLogs:new Set}),this.handleImportLocalLogs()}}).catch(()=>wn.error("Delete failed"))}})});Fe(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(ut("/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})});Fe(this,"handleDownloadLogFile",n=>{const i=ut(`/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)});Fe(this,"handleResumeChoice",n=>{this.state.resumeRememberChoice&&(this.setState({resumeAutoChoice:n}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resumeAutoChoice:n})}).catch(()=>{})),fetch(ut("/api/resume-choice"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({choice:n})}).catch(i=>console.error("resume-choice failed:",i))});Fe(this,"handleResumeAutoChoiceToggle",n=>{const i=n?"continue":null;this.setState({resumeAutoChoice:i}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resumeAutoChoice:i})}).catch(()=>{})});Fe(this,"handleResumeAutoChoiceChange",n=>{this.setState({resumeAutoChoice:n}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resumeAutoChoice:n})}).catch(()=>{})});Fe(this,"_finishLocalLoad",(n,i)=>{if(n.length===0){wn.error(oe("ui.noLogs")),this.setState({fileLoading:!1,fileLoadingCount:0});return}this.animateLoadingCount(n.length,()=>{this._batchSlim(n);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:E_(),userProfile:null,projectName:"",resumeModalVisible:!1,resumeFileName:"",resumeRememberChoice:!1,resumeAutoChoice:null,autoApproveSeconds:0,collapseToolResults:!0,expandThinking:!0,expandDiff:!1,logDir:"",showFullToolContent:!1,showThinkingSummaries:!1,themeColor:"dark",claudeMissing:!1,updateModalVisible:!1,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=G.createRef(),this._layoutRef=G.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._sseSlimmer=null,this._sseReconstructor=null}_batchSlim(n){const i=hhe(Ns);for(let r=0;r<n.length;r++)i.process(n[r],n,r);i.finalize(n)}_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,this._sseReconstructor=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,this._sseReconstructor=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),Ag(d)&&o.push(d),Ns(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(ut("/api/claude-settings")).then(r=>r.json()).then(r=>{r.showThinkingSummaries&&this.setState({showThinkingSummaries:!0}),r.claudeAvailable===!1&&this.setState({claudeMissing:!0})}).catch(()=>{}),this._prefsReady=fetch(ut("/api/preferences")).then(r=>r.json()).then(r=>{r.lang&&(c7(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}),typeof r.autoApproveSeconds=="number"&&this.setState({autoApproveSeconds:r.autoApproveSeconds}),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;this.setState({showAll:!s}),r.logDir&&this.setState({logDir:r.logDir});const o=new URLSearchParams(window.location.search).get("theme");return(o==="light"||o==="dark")&&(this.setState({themeColor:o}),document.documentElement.setAttribute("data-theme",o)),r}).catch(()=>({})),fetch(ut("/api/user-profile")).then(r=>r.json()).then(r=>this.setState({userProfile:r})).catch(()=>{}),fetch(ut("/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(ut("/api/project-name")).then(r=>r.json()).then(r=>{const s=r.projectName||"";this.setState({projectName:s}),s&&(document.title=s),an&&s&&!i&&this.state.requests.length===0&&Phe(s).then(o=>{if(o&&this.state.requests.length===0){this._batchSlim(o);const{mainAgentSessions:a,filtered:l}=this._processEntries(o);if(a.length>da){const c=$m(o,a),d=o.map(p=>p._slimmed?vl(p,o):p),{hotEntries:u,allSessions:h}=Kh(d,a,c,da);this._sseSlimmer=null,this._sseReconstructor=null;const O=u.filter(p=>Ag(p));this._oldestTs=u.length>0?u[0].timestamp:null,this.setState({requests:u,selectedIndex:O.length>0?O.length-1:null,mainAgentSessions:h,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(ut("/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&&an)try{const n=Jh([...this._chunkedEntries]);if(Array.isArray(n)&&n.length>0){this._batchSlim(n);const{mainAgentSessions:i}=this._processEntries(n);if(this.setState({requests:n,mainAgentSessions:i}),this.state.projectName){const r=u5(),s=r&&r.projectName===this.state.projectName?r.count:0;n.length>=s&&jl(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._sseReconstructor=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(ut(`/api/entries/page?before=${encodeURIComponent(this._oldestTs)}&limit=100`))).json();if(Array.isArray(i.entries)&&i.entries.length>0){const s=[...Jh(i.entries),...this.state.requests];this._batchSlim(s);const{mainAgentSessions:o}=this._processEntries(s);if(this._oldestTs=i.oldestTimestamp,an&&o.length>da){const a=$m(s,o),l=fS(this.state.sessionIndex,a),c=s.map(p=>p._slimmed?vl(p,s):p),{hotEntries:d,allSessions:u,coldGroups:h}=Kh(c,o,l,da);this._sseSlimmer=null,this._sseReconstructor=null;const O=this.state.projectName;if(O){for(const[p,m]of h)gm(O,p,m);vm(O,l),jl(O,s)}this.setState({requests:d,mainAgentSessions:u,sessionIndex:l,hasMoreHistory:!!i.hasMore,loadingMore:!1})}else this.setState({requests:s,mainAgentSessions:o,hasMoreHistory:!!i.hasMore,loadingMore:!1}),an&&this.state.projectName&&jl(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(an){const r=u5();r&&r.lastTs&&r.count>0&&(n=`/events?since=${encodeURIComponent(r.lastTs)}&cc=${r.count}&project=${encodeURIComponent(r.projectName||"")}`,i=!0)}!i&&an&&(n="/events?limit=200"),i||this.setState({fileLoading:!0,fileLoadingCount:0}),this.eventSource=new EventSource(ut(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(ut("/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&&an&&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)?Jh(o):o;if(Array.isArray(a)&&a.length>0){this._batchSlim(a);const{mainAgentSessions:l,filtered:c}=this._processEntries(a);if(an&&l.length>da){const d=$m(a,l),u=s?fS(this.state.sessionIndex,d):d,h=a.map(b=>b._slimmed?vl(b,a):b),{hotEntries:O,allSessions:p,coldGroups:m}=Kh(h,l,u,da);this._sseSlimmer=null,this._sseReconstructor=null;const g=this.state.projectName;if(g){for(const[b,S]of m)gm(g,b,S);vm(g,u),jl(g,a)}const v=O.filter(b=>Ag(b)),$={requests:O,selectedIndex:v.length>0?v.length-1:null,mainAgentSessions:p,sessionIndex:u,fileLoading:!1,fileLoadingCount:0};s||($.hasMoreHistory=!!this._hasMoreHistory),this.setState($)}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),an&&this.state.projectName&&jl(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)){s.length>0&&this._batchSlim(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}),an&&this.state.projectName&&jl(this.state.projectName,s)}):(this.setState({requests:s,selectedIndex:null,mainAgentSessions:o,fileLoading:!1,fileLoadingCount:0,serverCachedContent:null}),an&&I_())}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}),an&&I_()}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(ut("/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(ut(`/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=Jh(i);if(this._batchSlim(s),Array.isArray(s)&&s.length>0){const{mainAgentSessions:o,filtered:a}=this._processEntries(s);this.setState({requests:s,selectedIndex:a.length>0?a.length-1:null,mainAgentSessions:o,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 Che(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(ut(`/api/entries/page?before=${encodeURIComponent(r.lastTs)}&limit=200`))).json()).entries||[])}if(i&&i.length>0){const s=[...Jh(i),...this.state.requests];this._batchSlim(s);const{mainAgentSessions:o}=this._processEntries(s),a=$m(s,o),l=fS(this.state.sessionIndex,a),c=s.map(p=>p._slimmed?vl(p,s):p),{hotEntries:d,allSessions:u,coldGroups:h}=Kh(c,o,l,da,new Set([n]));this._sseSlimmer=null,this._sseReconstructor=null;const O=this.state.projectName;if(O){for(const[p,m]of h)gm(O,p,m);vm(O,l),jl(O,s)}this.setState({requests:d,mainAgentSessions:u,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(!an||i.length<=da)return;const s=n.map(d=>d._slimmed?vl(d,n):d),{hotEntries:o,allSessions:a,coldGroups:l}=Kh(s,i,this.state.sessionIndex,da);this._sseSlimmer=null,this._sseReconstructor=null;const c=this.state.sessionIndex;if(r){for(const[d,u]of l)gm(r,d,u);vm(r,c)}this.setState({requests:o,mainAgentSessions:a,sessionIndex:c})}mergeMainAgentSessions(n,i){return khe(n,i)}renderLogTable(n,i){const r=[{title:"",dataIndex:"file",key:"check",width:40,fixed:i?"left":!1,render:s=>_.jsx(Ql,{checked:this.state.selectedLogs.has(s)||!1,onClick:o=>o.stopPropagation(),onChange:o=>{o.stopPropagation(),this.handleToggleLogSelect(s,o.target.checked)}})},{title:oe("ui.logTime"),dataIndex:"timestamp",key:"time",width:i?150:180,render:s=>_.jsx("span",{className:il.tableTimestampCell,children:this.formatTimestamp(s,i)})},{title:oe("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?_.jsx("span",{className:il.tablePreviewText,children:a}):_.jsx(_o,{trigger:i?"click":"hover",placement:i?"bottomLeft":"leftTop",autoAdjustOverflow:{adjustX:!1,adjustY:!0},overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-hover)",borderRadius:8,padding:0,maxHeight:400,overflowY:"auto"},content:_.jsx("div",{className:il.previewPopover,children:s.map((l,c)=>_.jsx("div",{className:il.previewItem,children:_.jsx("pre",{className:il.previewText,children:l})},c))}),children:_.jsx("span",{className:il.tablePreviewTextClickable,style:{textDecoration:i?"underline dotted #666":"none"},children:a})})}},...i?[]:[{title:oe("ui.logTurns"),dataIndex:"turns",key:"turns",width:80,render:s=>_.jsx(jv,{className:il.tableTag,children:s||0})}],{title:oe("ui.logSize"),dataIndex:"size",key:"size",width:90,render:s=>_.jsx(jv,{className:il.tableTag,children:this.formatSize(s)})},{title:oe("ui.logActions"),key:"actions",width:i?160:180,render:(s,o)=>_.jsxs("span",{className:il.tableActionsCell,children:[_.jsx(Gn,{size:"small",type:"primary",onClick:a=>{a.stopPropagation(),this.handleOpenLogFile(o.file)},children:oe("ui.openLog")}),_.jsx(Gn,{size:"small",icon:_.jsx(l7,{}),onClick:a=>{a.stopPropagation(),this.handleDownloadLogFile(o.file)},children:oe("ui.downloadLog")})]})}];return _.jsx(Xl,{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:OS(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=u7(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 _.jsx(sa,{theme:this.themeConfig,children:_.jsx(ehe,{onLaunch:this.handleWorkspaceLaunch})})}get themeConfig(){return this.state.themeColor==="light"?{algorithm:DR.defaultAlgorithm,token:{colorPrimary:"#0969DA",colorBgContainer:"#FFFFFF",colorBgLayout:"#FAFAFA",colorBgElevated:"#FFFFFF",colorBorder:"#E0E0E0",controlOutline:"transparent",controlOutlineWidth:0}}:{algorithm:DR.darkAlgorithm,token:{colorPrimary:"#1668dc",colorBgContainer:"#111",colorBgLayout:"#0a0a0a",colorBgElevated:"#1e1e1e",colorBorder:"#2a2a2a",controlOutline:"transparent",controlOutlineWidth:0}}}}function TP(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var kd=TP();function $7(t){kd=t}var Wc={exec:()=>null};function Mn(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(ys.caret,"$1"),n=n.replace(r,o),i},getRegex:()=>new RegExp(n,e)};return i}var Gfe=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),ys={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,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)}}>`)},Ffe=/^(?:[ \t]*(?:\n|$))+/,Hfe=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Kfe=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Xp=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Jfe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,kP=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,b7=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,S7=Mn(b7).replace(/bull/g,kP).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(),epe=Mn(b7).replace(/bull/g,kP).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(),RP=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,tpe=/^[^\n]+/,EP=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,npe=Mn(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",EP).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ipe=Mn(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,kP).getRegex(),E0="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",XP=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,rpe=Mn("^ {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",XP).replace("tag",E0).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),y7=Mn(RP).replace("hr",Xp).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",E0).getRegex(),spe=Mn(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",y7).getRegex(),zP={blockquote:spe,code:Hfe,def:npe,fences:Kfe,heading:Jfe,hr:Xp,html:rpe,lheading:S7,list:ipe,newline:Ffe,paragraph:y7,table:Wc,text:tpe},y5=Mn("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Xp).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",E0).getRegex(),ope={...zP,lheading:epe,table:y5,paragraph:Mn(RP).replace("hr",Xp).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",y5).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",E0).getRegex()},ape={...zP,html:Mn(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",XP).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:Wc,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Mn(RP).replace("hr",Xp).replace("heading",` *#{1,6} *[^
|
|
718
|
+
`+it),H&&bm([P,C,w],Rt=>{it=tO(it,Rt," ")}),S&&be?S.createHTML(it):it},e.setConfig=function(){let Ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ae(Ge),V=!0},e.clearConfig=function(){Je=null,V=!1},e.isValidAttribute=function(Ge,de,ve){Je||Ae({});const ke=_e(Ge),dt=_e(de);return Zt(ke,dt,ve)},e.addHook=function(Ge,de){typeof de=="function"&&eO(E[Ge],de)},e.removeHook=function(Ge,de){if(de!==void 0){const ve=Ihe(E[Ge],de);return ve===-1?void 0:Mhe(E[Ge],ve,1)[0]}return O5(E[Ge])},e.removeHooks=function(Ge){E[Ge]=[]},e.removeAllHooks=function(){E=$5()},e}var R0=g7();let sO=null,jg=null,b5=!1,SS=null,W_=new Set;const eOe={theme:"dark",darkMode:!0,themeVariables:{darkMode:!0,background:"#0d1117",primaryColor:"#1a3a5c",primaryTextColor:"#c9d1d9",primaryBorderColor:"#30363d",lineColor:"#58a6ff",secondaryColor:"#161b22",tertiaryColor:"#0d1117",nodeTextColor:"#c9d1d9",edgeLabelBackground:"#0d1117"}},tOe={theme:"default",darkMode:!1,themeVariables:{darkMode:!1,background:"#FFFFFF",primaryColor:"#dce8f5",primaryTextColor:"#1a1a1a",primaryBorderColor:"#E0E0E0",lineColor:"#0969DA",secondaryColor:"#F0F0F0",tertiaryColor:"#F5F5F5",nodeTextColor:"#1a1a1a",edgeLabelBackground:"#FFFFFF"}};function v7(){return document.documentElement.getAttribute("data-theme")==="light"?tOe:eOe}function nOe(){return sO||(sO=y6(()=>import("./mermaid.core-DF5xqjrS.js").then(t=>t.bC),__vite__mapDeps([0,1,2])).then(t=>{const e=t.default,n=v7();return e.initialize({startOnLoad:!1,securityLevel:"strict",flowchart:{useMaxWidth:!0},...n}),jg=e,e}).catch(()=>(sO=null,null)),sO)}async function iOe(t){if(!t)return;const e=t.querySelectorAll("code.language-mermaid");if(e.length===0)return;const n=await nOe();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.dataset.mermaidSrc=s,l.innerHTML=R0.sanitize(a,{USE_PROFILES:{svg:!0,svgFilters:!0},ADD_TAGS:["style","foreignObject"]}),r.replaceWith(l)}catch{}}}function rOe(){SS||(SS=requestAnimationFrame(()=>{SS=null;const t=W_;W_=new Set;for(const e of t)e.isConnected&&iOe(e)}))}function sOe(){if(b5||typeof document>"u")return;b5=!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"))){W_.add(s),rOe();return}}),e=()=>t.observe(document.body,{childList:!0,subtree:!0});document.body?e():document.addEventListener("DOMContentLoaded",e)}async function oOe(){if(!jg)return;const t=v7();jg.initialize({startOnLoad:!1,securityLevel:"strict",flowchart:{useMaxWidth:!0},...t});const e=document.querySelectorAll(".mermaid-diagram[data-mermaid-src]");for(const n of e){const i=n.dataset.mermaidSrc;try{const r="mmd-"+Math.random().toString(36).slice(2,9),{svg:s}=await jg.render(r,i);n.innerHTML=R0.sanitize(s,{USE_PROFILES:{svg:!0,svgFilters:!0},ADD_TAGS:["style","foreignObject"]})}catch{}}}const aOe="_layout_195sz_1",lOe="_header_195sz_6",cOe="_content_195sz_14",dOe="_mainContainer_195sz_19",uOe="_leftPanel_195sz_24",hOe="_leftPanelHeader_195sz_36",OOe="_leftPanelCount_195sz_47",fOe="_leftPanelBody_195sz_53",pOe="_rightPanel_195sz_58",mOe="_modalActions_195sz_64",gOe="_spinCenter_195sz_68",vOe="_emptyCenter_195sz_73",$Oe="_logListContainer_195sz_83",bOe="_loadingOverlay_195sz_131",SOe="_dragOverlay_195sz_144",yOe="_dragOverlayContent_195sz_158",_Oe="_dragIcon_195sz_167",wOe="_loadingText_195sz_171",xOe="_mobileLoadingOverlay_195sz_177",QOe="_mobileLoadingSpinner_195sz_189",POe="_mobileLoadingLabel_195sz_202",COe="_footer_195sz_208",TOe="_footerRight_195sz_219",kOe="_footerLink_195sz_232",ROe="_footerIcon_195sz_244",EOe="_footerSep_195sz_249",XOe="_footerVersion_195sz_254",zOe="_footerVersionNew_195sz_264",AOe="_newBadge_195sz_274",IOe="_guideContainer_195sz_286",MOe="_guideContent_195sz_294",jOe="_guideTitle_195sz_299",NOe="_guideStep_195sz_306",WOe="_guideStepNum_195sz_312",LOe="_guideStepBody_195sz_327",VOe="_guideText_195sz_332",BOe="_guideCode_195sz_339",YOe="_mobileChatOverlay_195sz_352",DOe="_mobileChatOverlayVisible_195sz_364",UOe="_mobileNavBtn_195sz_368",qOe="_mobileChatInner_195sz_373",ZOe="_mobileGitDiffOverlay_195sz_392",GOe="_mobileGitDiffOverlayVisible_195sz_404",FOe="_mobileGitDiffInner_195sz_408",HOe="_mobileMenuBtn_195sz_435",KOe="_mobileMenuOverlay_195sz_452",JOe="_mobileMenuDropdown_195sz_458",efe="_mobileMenuItem_195sz_472",tfe="_mobileStatsOverlay_195sz_490",nfe="_mobileStatsOverlayVisible_195sz_502",ife="_mobileStatsInner_195sz_506",rfe="_mobileLogMgmtOverlay_195sz_513",sfe="_mobileLogMgmtOverlayVisible_195sz_525",ofe="_mobileLogMgmtHeader_195sz_529",afe="_mobileLogMgmtTitle_195sz_538",lfe="_mobileLogMgmtClose_195sz_544",cfe="_mobileLogMgmtActions_195sz_559",dfe="_mobileLogMgmtBody_195sz_567",ufe="_mobileSettingsOverlay_195sz_574",hfe="_mobileSettingsOverlayVisible_195sz_586",Ofe="_mobilePromptOverlay_195sz_590",ffe="_mobilePromptOverlayVisible_195sz_602",pfe="_mobilePromptBody_195sz_606",mfe="_mobilePromptList_195sz_614",gfe="_mobilePromptItem_195sz_620",vfe="_mobilePromptTimestamp_195sz_625",$fe="_mobilePromptCard_195sz_632",bfe="_mobilePromptPreText_195sz_640",Sfe="_tableTimestampCell_195sz_650",yfe="_tablePreviewText_195sz_654",_fe="_tablePreviewTextClickable_195sz_663",wfe="_tableTag_195sz_673",xfe="_tableActionsCell_195sz_679",Qfe="_mobileCLIRoot_195sz_685",Pfe="_mobileCLIHeader_195sz_694",Cfe="_mobileCLIHeaderLeft_195sz_705",Tfe="_mobileCLIStatusLabel_195sz_711",kfe="_mobileCLIHeaderRight_195sz_716",Rfe="_mobileCLIBody_195sz_722",Efe="_mobileSettingsBody_195sz_731",Xfe="_mobileSettingsSectionTitle_195sz_735",zfe="_mobileSettingsRow_195sz_742",Afe="_mobileSettingsLabel_195sz_750",Ife="_mobilePromptEmpty_195sz_756",Mfe="_mobilePromptHeader_195sz_763",jfe="_mobilePromptCount_195sz_771",Nfe="_chatViewWrapper_195sz_777",Wfe="_resumeFooterRight_195sz_783",Lfe="_resumeFooterLeft_195sz_788",Vfe="_resumeCheckboxOpacity_195sz_792",Bfe="_btnMarginLeft_195sz_796",Yfe="_btnMarginRight_195sz_800",Dfe="_modalTitleInline_195sz_805",Ufe="_previewPopover_195sz_812",qfe="_previewItem_195sz_818",Zfe="_previewText_195sz_830",il={layout:aOe,header:lOe,content:cOe,mainContainer:dOe,leftPanel:uOe,leftPanelHeader:hOe,leftPanelCount:OOe,leftPanelBody:fOe,rightPanel:pOe,modalActions:mOe,spinCenter:gOe,emptyCenter:vOe,logListContainer:$Oe,loadingOverlay:bOe,dragOverlay:SOe,dragOverlayContent:yOe,dragIcon:_Oe,loadingText:wOe,mobileLoadingOverlay:xOe,mobileLoadingSpinner:QOe,mobileLoadingLabel:POe,footer:COe,footerRight:TOe,footerLink:kOe,footerIcon:ROe,footerSep:EOe,footerVersion:XOe,footerVersionNew:zOe,newBadge:AOe,guideContainer:IOe,guideContent:MOe,guideTitle:jOe,guideStep:NOe,guideStepNum:WOe,guideStepBody:LOe,guideText:VOe,guideCode:BOe,mobileChatOverlay:YOe,mobileChatOverlayVisible:DOe,mobileNavBtn:UOe,mobileChatInner:qOe,mobileGitDiffOverlay:ZOe,mobileGitDiffOverlayVisible:GOe,mobileGitDiffInner:FOe,mobileMenuBtn:HOe,mobileMenuOverlay:KOe,mobileMenuDropdown:JOe,mobileMenuItem:efe,mobileStatsOverlay:tfe,mobileStatsOverlayVisible:nfe,mobileStatsInner:ife,mobileLogMgmtOverlay:rfe,mobileLogMgmtOverlayVisible:sfe,mobileLogMgmtHeader:ofe,mobileLogMgmtTitle:afe,mobileLogMgmtClose:lfe,mobileLogMgmtActions:cfe,mobileLogMgmtBody:dfe,mobileSettingsOverlay:ufe,mobileSettingsOverlayVisible:hfe,mobilePromptOverlay:Ofe,mobilePromptOverlayVisible:ffe,mobilePromptBody:pfe,mobilePromptList:mfe,mobilePromptItem:gfe,mobilePromptTimestamp:vfe,mobilePromptCard:$fe,mobilePromptPreText:bfe,tableTimestampCell:Sfe,tablePreviewText:yfe,tablePreviewTextClickable:_fe,tableTag:wfe,tableActionsCell:xfe,mobileCLIRoot:Qfe,mobileCLIHeader:Pfe,mobileCLIHeaderLeft:Cfe,mobileCLIStatusLabel:Tfe,mobileCLIHeaderRight:kfe,mobileCLIBody:Rfe,mobileSettingsBody:Efe,mobileSettingsSectionTitle:Xfe,mobileSettingsRow:zfe,mobileSettingsLabel:Afe,mobilePromptEmpty:Ife,mobilePromptHeader:Mfe,mobilePromptCount:jfe,chatViewWrapper:Nfe,resumeFooterRight:Wfe,resumeFooterLeft:Lfe,resumeCheckboxOpacity:Vfe,btnMarginLeft:Bfe,btnMarginRight:Yfe,modalTitleInline:Dfe,previewPopover:Ufe,previewItem:qfe,previewText:Zfe},S5=an&&!Ai?30:100;class vYe extends G.Component{constructor(n){super(n);Fe(this,"_resetSSETimeout",()=>{this._sseTimeoutTimer&&clearTimeout(this._sseTimeoutTimer),this._sseReconnectCount=0,this._sseTimeoutTimer=setTimeout(()=>{console.warn("SSE heartbeat timeout, reconnecting..."),this._reconnectSSE()},45e3)});Fe(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._sseSlimmer||(this._sseSlimmer=Ohe(Ns)),this._sseReconstructor||(this._sseReconstructor=Ehe());for(const p of n){const m=this._sseReconstructor.reconstruct(p),g=`${m.timestamp}|${m.url}`,v=this._requestIndexMap.get(g);if(v!==void 0)r[v]=m,this._sseSlimmer&&this._sseSlimmer.onDedup(v);else{const $=r.length;this._sseSlimmer&&this._sseSlimmer.processEntry(m,r,$),this._requestIndexMap.set(g,$),r.push(m)}if(Ns(m)&&!m.inProgress&&((d=(c=m.response)==null?void 0:c.body)!=null&&d.usage)){const $=yhe([m]);$&&($.system.length>0||$.messages.length>0||$.tools.length>0)&&(this._lastKvCacheContent=$)}if(Ns(m)){const $=(h=(u=m.response)==null?void 0:u.body)==null?void 0:h.usage;if($!=null&&$.cache_creation){const b=$.cache_creation,S=m.timestamp?new Date(m.timestamp).getTime():Date.now();let y=null,Q=null;if(b.ephemeral_1h_input_tokens>0?(y=S+3600*1e3,Q="1h"):b.ephemeral_5m_input_tokens>0&&(y=S+300*1e3,Q="5m"),y&&y>Date.now()){s=y;const x=($.cache_read_input_tokens||0)+($.cache_creation_input_tokens||0);o=x>0?She(x):Q,localStorage.setItem("ccv_cacheExpireAt",String(s)),localStorage.setItem("ccv_cacheType",o)}}}if(Ns(m)&&m.body&&Array.isArray(m.body.messages)&&!m._slimmed){const $=m.timestamp||new Date().toISOString(),b=a.length>0?a[a.length-1]:null,S=(b==null?void 0:b.messages)||[],y=m.body.messages,Q=S.length,x=((O=m.body.metadata)==null?void 0:O.user_id)||null,T=!(x!==null&&(b==null?void 0:b.userId)===x)&&Q>0&&y.length<Q*.5&&Q-y.length>4;if(Q>4&&y.length<=4&&y.length<Q*.5)continue;T?this._currentSessionId=$:this._currentSessionId===null&&(this._currentSessionId=$);for(let E=0;E<y.length;E++)!T&&E<Q&&S[E]._timestamp?y[E]._timestamp=S[E]._timestamp:y[E]._timestamp||(y[E]._timestamp=$);a=this.mergeMainAgentSessions(a,m)}m._sessionId=this._currentSessionId}let l=i.selectedIndex;return a.length>S5&&(a=a.slice(-S5)),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:OS(p.requests);return m.length>0?{selectedIndex:m.length-1}:null}return null})},200)),{requests:r,cacheExpireAt:s,cacheType:o,mainAgentSessions:a}},()=>{an&&this.state.projectName&&(this._cacheSaveTimer&&clearTimeout(this._cacheSaveTimer),this._cacheSaveTimer=setTimeout(()=>{this.state.projectName&&this.state.sessionIndex.length===0&&jl(this.state.projectName,this.state.requests)},5e3),this.state.mainAgentSessions.length>da+2&&(this._evictionTimer||(this._evictionTimer=setTimeout(()=>{this._evictionTimer=null,this._evictColdSessions()},1e4))))})});Fe(this,"handleSelectRequest",n=>{this.setState({selectedIndex:n,scrollCenter:!1})});Fe(this,"handleScrollDone",()=>{this.setState({scrollCenter:!1})});Fe(this,"handleScrollTsDone",()=>{this.setState({chatScrollToTs:null})});Fe(this,"handleWorkspaceLaunch",({projectName:n})=>{this._isLocalLog=!1,this._localLogFile=null,this.setState({workspaceMode:!1,projectName:n,viewMode:"chat",cliMode:!0,terminalVisible:!1})});Fe(this,"handleReturnToWorkspaces",()=>{fetch(ut("/api/workspaces/stop"),{method:"POST"}).then(()=>{this._rebuildRequestIndex([]),this.setState({workspaceMode:!0,requests:[],mainAgentSessions:[],projectName:"",selectedIndex:null})}).catch(()=>{})});Fe(this,"handleProxyProfileChange",n=>{fetch(ut("/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(()=>{})});Fe(this,"handleLangChange",()=>{const n=E_();this.setState({lang:n}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lang:n})}).catch(()=>{})});Fe(this,"handleCollapseToolResultsChange",n=>{this.setState({collapseToolResults:n}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({collapseToolResults:n})}).catch(()=>{})});Fe(this,"handleExpandThinkingChange",n=>{this.setState({expandThinking:n}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expandThinking:n})}).catch(()=>{})});Fe(this,"handleExpandDiffChange",n=>{this.setState({expandDiff:n}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expandDiff:n})}).catch(()=>{})});Fe(this,"handleAutoApproveChange",n=>{this.setState({autoApproveSeconds:n}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoApproveSeconds:n})}).catch(()=>{})});Fe(this,"handleThemeColorChange",n=>{this.setState({themeColor:n}),document.documentElement.setAttribute("data-theme",n==="light"?"light":"dark"),oOe(),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({themeColor:n})}).catch(()=>{}),window.dispatchEvent(new CustomEvent("ccv-focus-terminal"))});Fe(this,"handleLogDirChange",n=>{if(!n||typeof n!="string")return;const i=n.trim();i&&(this.setState({logDir:i}),fetch(ut("/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(()=>{}))});Fe(this,"handleShowFullToolContentChange",n=>{this.setState({showFullToolContent:n}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({showFullToolContent:n})}).catch(()=>{})});Fe(this,"handleFilterIrrelevantChange",n=>{this.setState(i=>{const r=!n,s=r?i.requests:OS(i.requests);return{showAll:r,selectedIndex:s.length>0?s.length-1:null}}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filterIrrelevant:n})}).catch(()=>{})});Fe(this,"handleImportLocalLogs",()=>{this.setState({importModalVisible:!0,localLogsLoading:!0}),fetch(ut("/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})})});Fe(this,"handleCloseImportModal",()=>{this.setState({importModalVisible:!1,selectedLogs:new Set})});Fe(this,"handleRefreshStats",()=>{this.setState({refreshingStats:!0}),fetch(ut("/api/refresh-stats"),{method:"POST"}).then(n=>n.json()).then(n=>{if(!n.ok)throw new Error(n.error||"refresh failed");return fetch(ut("/api/local-logs"))}).then(n=>n.json()).then(n=>{const{_currentProject:i,...r}=n;this.setState({localLogs:r,refreshingStats:!1}),wn.success(oe("ui.refreshStatsSuccess"))}).catch(()=>{this.setState({refreshingStats:!1}),wn.error(oe("ui.refreshStatsFailed"))})});Fe(this,"handleToggleLogSelect",(n,i)=>{this.setState(r=>{const s=new Set(r.selectedLogs);return i?s.add(n):s.delete(n),{selectedLogs:s}})});Fe(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)){wn.warning(oe("ui.mergeLatestNotAllowed"));return}for(let c=1;c<o.length;c++)if(o[c]-o[c-1]!==1){wn.warning(oe("ui.mergeNotConsecutive"));return}if(o.reduce((c,d)=>c+s[d].size,0)>500*1024*1024){wn.warning(oe("ui.mergeTooLarge"));return}const l=o.map(c=>s[c].file).reverse();fetch(ut("/api/merge-logs"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:l})}).then(c=>c.json()).then(c=>{c.ok?(wn.success(oe("ui.mergeSuccess")),this.setState({selectedLogs:new Set}),this.handleImportLocalLogs()):wn.error(c.error||"Merge failed")}).catch(()=>wn.error("Merge failed"))});Fe(this,"handleDeleteLogs",()=>{const{selectedLogs:n}=this.state;n.size!==0&&yi.confirm({title:oe("ui.deleteLogs"),content:oe("ui.deleteLogsConfirm",{count:n.size}),okText:oe("ui.deleteLogs"),okButtonProps:{danger:!0},cancelText:oe("ui.cancel"),onOk:()=>{const i=[...n];fetch(ut("/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&&wn.success(oe("ui.deleteSuccess",{count:s})),o>0&&wn.error(oe("ui.deleteFailed",{count:o})),this.setState({selectedLogs:new Set}),this.handleImportLocalLogs()}}).catch(()=>wn.error("Delete failed"))}})});Fe(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(ut("/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})});Fe(this,"handleDownloadLogFile",n=>{const i=ut(`/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)});Fe(this,"handleResumeChoice",n=>{this.state.resumeRememberChoice&&(this.setState({resumeAutoChoice:n}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resumeAutoChoice:n})}).catch(()=>{})),fetch(ut("/api/resume-choice"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({choice:n})}).catch(i=>console.error("resume-choice failed:",i))});Fe(this,"handleResumeAutoChoiceToggle",n=>{const i=n?"continue":null;this.setState({resumeAutoChoice:i}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resumeAutoChoice:i})}).catch(()=>{})});Fe(this,"handleResumeAutoChoiceChange",n=>{this.setState({resumeAutoChoice:n}),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resumeAutoChoice:n})}).catch(()=>{})});Fe(this,"_finishLocalLoad",(n,i)=>{if(n.length===0){wn.error(oe("ui.noLogs")),this.setState({fileLoading:!1,fileLoadingCount:0});return}this.animateLoadingCount(n.length,()=>{this._batchSlim(n);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:E_(),userProfile:null,projectName:"",resumeModalVisible:!1,resumeFileName:"",resumeRememberChoice:!1,resumeAutoChoice:null,autoApproveSeconds:0,collapseToolResults:!0,expandThinking:!0,expandDiff:!1,logDir:"",showFullToolContent:!1,showThinkingSummaries:!1,themeColor:"dark",claudeMissing:!1,updateModalVisible:!1,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=G.createRef(),this._layoutRef=G.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._sseSlimmer=null,this._sseReconstructor=null}_batchSlim(n){const i=hhe(Ns);for(let r=0;r<n.length;r++)i.process(n[r],n,r);i.finalize(n)}_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,this._sseReconstructor=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,this._sseReconstructor=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),Ag(d)&&o.push(d),Ns(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(ut("/api/claude-settings")).then(r=>r.json()).then(r=>{r.showThinkingSummaries&&this.setState({showThinkingSummaries:!0}),r.claudeAvailable===!1&&this.setState({claudeMissing:!0})}).catch(()=>{}),this._prefsReady=fetch(ut("/api/preferences")).then(r=>r.json()).then(r=>{r.lang&&(c7(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}),typeof r.autoApproveSeconds=="number"&&this.setState({autoApproveSeconds:r.autoApproveSeconds}),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;this.setState({showAll:!s}),r.logDir&&this.setState({logDir:r.logDir});const o=new URLSearchParams(window.location.search).get("theme");return(o==="light"||o==="dark")&&(this.setState({themeColor:o}),document.documentElement.setAttribute("data-theme",o)),r}).catch(()=>({})),fetch(ut("/api/user-profile")).then(r=>r.json()).then(r=>this.setState({userProfile:r})).catch(()=>{}),fetch(ut("/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(ut("/api/project-name")).then(r=>r.json()).then(r=>{const s=r.projectName||"";this.setState({projectName:s}),s&&(document.title=s),an&&s&&!i&&this.state.requests.length===0&&Phe(s).then(o=>{if(o&&this.state.requests.length===0){this._batchSlim(o);const{mainAgentSessions:a,filtered:l}=this._processEntries(o);if(a.length>da){const c=$m(o,a),d=o.map(p=>p._slimmed?vl(p,o):p),{hotEntries:u,allSessions:h}=Kh(d,a,c,da);this._sseSlimmer=null,this._sseReconstructor=null;const O=u.filter(p=>Ag(p));this._oldestTs=u.length>0?u[0].timestamp:null,this.setState({requests:u,selectedIndex:O.length>0?O.length-1:null,mainAgentSessions:h,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(ut("/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&&an)try{const n=Jh([...this._chunkedEntries]);if(Array.isArray(n)&&n.length>0){this._batchSlim(n);const{mainAgentSessions:i}=this._processEntries(n);if(this.setState({requests:n,mainAgentSessions:i}),this.state.projectName){const r=u5(),s=r&&r.projectName===this.state.projectName?r.count:0;n.length>=s&&jl(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._sseReconstructor=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(ut(`/api/entries/page?before=${encodeURIComponent(this._oldestTs)}&limit=100`))).json();if(Array.isArray(i.entries)&&i.entries.length>0){const s=[...Jh(i.entries),...this.state.requests];this._batchSlim(s);const{mainAgentSessions:o}=this._processEntries(s);if(this._oldestTs=i.oldestTimestamp,an&&o.length>da){const a=$m(s,o),l=fS(this.state.sessionIndex,a),c=s.map(p=>p._slimmed?vl(p,s):p),{hotEntries:d,allSessions:u,coldGroups:h}=Kh(c,o,l,da);this._sseSlimmer=null,this._sseReconstructor=null;const O=this.state.projectName;if(O){for(const[p,m]of h)gm(O,p,m);vm(O,l),jl(O,s)}this.setState({requests:d,mainAgentSessions:u,sessionIndex:l,hasMoreHistory:!!i.hasMore,loadingMore:!1})}else this.setState({requests:s,mainAgentSessions:o,hasMoreHistory:!!i.hasMore,loadingMore:!1}),an&&this.state.projectName&&jl(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(an){const r=u5();r&&r.lastTs&&r.count>0&&(n=`/events?since=${encodeURIComponent(r.lastTs)}&cc=${r.count}&project=${encodeURIComponent(r.projectName||"")}`,i=!0)}!i&&an&&(n="/events?limit=200"),i||this.setState({fileLoading:!0,fileLoadingCount:0}),this.eventSource=new EventSource(ut(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(ut("/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&&an&&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)?Jh(o):o;if(Array.isArray(a)&&a.length>0){this._batchSlim(a);const{mainAgentSessions:l,filtered:c}=this._processEntries(a);if(an&&l.length>da){const d=$m(a,l),u=s?fS(this.state.sessionIndex,d):d,h=a.map(b=>b._slimmed?vl(b,a):b),{hotEntries:O,allSessions:p,coldGroups:m}=Kh(h,l,u,da);this._sseSlimmer=null,this._sseReconstructor=null;const g=this.state.projectName;if(g){for(const[b,S]of m)gm(g,b,S);vm(g,u),jl(g,a)}const v=O.filter(b=>Ag(b)),$={requests:O,selectedIndex:v.length>0?v.length-1:null,mainAgentSessions:p,sessionIndex:u,fileLoading:!1,fileLoadingCount:0};s||($.hasMoreHistory=!!this._hasMoreHistory),this.setState($)}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),an&&this.state.projectName&&jl(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)){s.length>0&&this._batchSlim(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}),an&&this.state.projectName&&jl(this.state.projectName,s)}):(this.setState({requests:s,selectedIndex:null,mainAgentSessions:o,fileLoading:!1,fileLoadingCount:0,serverCachedContent:null}),an&&I_())}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}),an&&I_()}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(ut("/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(ut(`/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=Jh(i);if(this._batchSlim(s),Array.isArray(s)&&s.length>0){const{mainAgentSessions:o,filtered:a}=this._processEntries(s);this.setState({requests:s,selectedIndex:a.length>0?a.length-1:null,mainAgentSessions:o,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 Che(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(ut(`/api/entries/page?before=${encodeURIComponent(r.lastTs)}&limit=200`))).json()).entries||[])}if(i&&i.length>0){const s=[...Jh(i),...this.state.requests];this._batchSlim(s);const{mainAgentSessions:o}=this._processEntries(s),a=$m(s,o),l=fS(this.state.sessionIndex,a),c=s.map(p=>p._slimmed?vl(p,s):p),{hotEntries:d,allSessions:u,coldGroups:h}=Kh(c,o,l,da,new Set([n]));this._sseSlimmer=null,this._sseReconstructor=null;const O=this.state.projectName;if(O){for(const[p,m]of h)gm(O,p,m);vm(O,l),jl(O,s)}this.setState({requests:d,mainAgentSessions:u,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(!an||i.length<=da)return;const s=n.map(d=>d._slimmed?vl(d,n):d),{hotEntries:o,allSessions:a,coldGroups:l}=Kh(s,i,this.state.sessionIndex,da);this._sseSlimmer=null,this._sseReconstructor=null;const c=this.state.sessionIndex;if(r){for(const[d,u]of l)gm(r,d,u);vm(r,c)}this.setState({requests:o,mainAgentSessions:a,sessionIndex:c})}mergeMainAgentSessions(n,i){return khe(n,i)}renderLogTable(n,i){const r=[{title:"",dataIndex:"file",key:"check",width:40,fixed:i?"left":!1,render:s=>_.jsx(Ql,{checked:this.state.selectedLogs.has(s)||!1,onClick:o=>o.stopPropagation(),onChange:o=>{o.stopPropagation(),this.handleToggleLogSelect(s,o.target.checked)}})},{title:oe("ui.logTime"),dataIndex:"timestamp",key:"time",width:i?150:180,render:s=>_.jsx("span",{className:il.tableTimestampCell,children:this.formatTimestamp(s,i)})},{title:oe("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?_.jsx("span",{className:il.tablePreviewText,children:a}):_.jsx(_o,{trigger:i?"click":"hover",placement:i?"bottomLeft":"leftTop",autoAdjustOverflow:{adjustX:!1,adjustY:!0},overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-hover)",borderRadius:8,padding:0,maxHeight:400,overflowY:"auto"},content:_.jsx("div",{className:il.previewPopover,children:s.map((l,c)=>_.jsx("div",{className:il.previewItem,children:_.jsx("pre",{className:il.previewText,children:l})},c))}),children:_.jsx("span",{className:il.tablePreviewTextClickable,style:{textDecoration:i?"underline dotted #666":"none"},children:a})})}},...i?[]:[{title:oe("ui.logTurns"),dataIndex:"turns",key:"turns",width:80,render:s=>_.jsx(jv,{className:il.tableTag,children:s||0})}],{title:oe("ui.logSize"),dataIndex:"size",key:"size",width:90,render:s=>_.jsx(jv,{className:il.tableTag,children:this.formatSize(s)})},{title:oe("ui.logActions"),key:"actions",width:i?160:180,render:(s,o)=>_.jsxs("span",{className:il.tableActionsCell,children:[_.jsx(Gn,{size:"small",type:"primary",onClick:a=>{a.stopPropagation(),this.handleOpenLogFile(o.file)},children:oe("ui.openLog")}),_.jsx(Gn,{size:"small",icon:_.jsx(l7,{}),onClick:a=>{a.stopPropagation(),this.handleDownloadLogFile(o.file)},children:oe("ui.downloadLog")})]})}];return _.jsx(Xl,{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:OS(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=u7(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 _.jsx(sa,{theme:this.themeConfig,children:_.jsx(ehe,{onLaunch:this.handleWorkspaceLaunch})})}get themeConfig(){return this.state.themeColor==="light"?{algorithm:DR.defaultAlgorithm,token:{colorPrimary:"#0969DA",colorBgContainer:"#FFFFFF",colorBgLayout:"#FAFAFA",colorBgElevated:"#FFFFFF",colorBorder:"#E0E0E0",controlOutline:"transparent",controlOutlineWidth:0}}:{algorithm:DR.darkAlgorithm,token:{colorPrimary:"#1668dc",colorBgContainer:"#111",colorBgLayout:"#0a0a0a",colorBgElevated:"#1e1e1e",colorBorder:"#2a2a2a",controlOutline:"transparent",controlOutlineWidth:0}}}}function TP(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var kd=TP();function $7(t){kd=t}var Wc={exec:()=>null};function Mn(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(ys.caret,"$1"),n=n.replace(r,o),i},getRegex:()=>new RegExp(n,e)};return i}var Gfe=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),ys={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,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)}}>`)},Ffe=/^(?:[ \t]*(?:\n|$))+/,Hfe=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Kfe=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Xp=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Jfe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,kP=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,b7=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,S7=Mn(b7).replace(/bull/g,kP).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(),epe=Mn(b7).replace(/bull/g,kP).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(),RP=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,tpe=/^[^\n]+/,EP=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,npe=Mn(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",EP).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ipe=Mn(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,kP).getRegex(),E0="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",XP=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,rpe=Mn("^ {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",XP).replace("tag",E0).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),y7=Mn(RP).replace("hr",Xp).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",E0).getRegex(),spe=Mn(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",y7).getRegex(),zP={blockquote:spe,code:Hfe,def:npe,fences:Kfe,heading:Jfe,hr:Xp,html:rpe,lheading:S7,list:ipe,newline:Ffe,paragraph:y7,table:Wc,text:tpe},y5=Mn("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Xp).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",E0).getRegex(),ope={...zP,lheading:epe,table:y5,paragraph:Mn(RP).replace("hr",Xp).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",y5).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",E0).getRegex()},ape={...zP,html:Mn(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",XP).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:Wc,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Mn(RP).replace("hr",Xp).replace("heading",` *#{1,6} *[^
|
|
719
719
|
]`).replace("lheading",S7).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},lpe=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,cpe=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,_7=/^( {2,}|\\)\n(?!\s*$)/,dpe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Rh=/[\p{P}\p{S}]/u,X0=/[\s\p{P}\p{S}]/u,AP=/[^\s\p{P}\p{S}]/u,upe=Mn(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,X0).getRegex(),w7=/(?!~)[\p{P}\p{S}]/u,hpe=/(?!~)[\s\p{P}\p{S}]/u,Ope=/(?:[^\s\p{P}\p{S}]|~)/u,fpe=Mn(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Gfe?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),x7=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ppe=Mn(x7,"u").replace(/punct/g,Rh).getRegex(),mpe=Mn(x7,"u").replace(/punct/g,w7).getRegex(),Q7="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",gpe=Mn(Q7,"gu").replace(/notPunctSpace/g,AP).replace(/punctSpace/g,X0).replace(/punct/g,Rh).getRegex(),vpe=Mn(Q7,"gu").replace(/notPunctSpace/g,Ope).replace(/punctSpace/g,hpe).replace(/punct/g,w7).getRegex(),$pe=Mn("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,AP).replace(/punctSpace/g,X0).replace(/punct/g,Rh).getRegex(),bpe=Mn(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Rh).getRegex(),Spe="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ype=Mn(Spe,"gu").replace(/notPunctSpace/g,AP).replace(/punctSpace/g,X0).replace(/punct/g,Rh).getRegex(),_pe=Mn(/\\(punct)/,"gu").replace(/punct/g,Rh).getRegex(),wpe=Mn(/^<(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(),xpe=Mn(XP).replace("(?:-->|$)","-->").getRegex(),Qpe=Mn("^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",xpe).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Vv=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ppe=Mn(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Vv).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),P7=Mn(/^!?\[(label)\]\[(ref)\]/).replace("label",Vv).replace("ref",EP).getRegex(),C7=Mn(/^!?\[(ref)\](?:\[\])?/).replace("ref",EP).getRegex(),Cpe=Mn("reflink|nolink(?!\\()","g").replace("reflink",P7).replace("nolink",C7).getRegex(),_5=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,IP={_backpedal:Wc,anyPunctuation:_pe,autolink:wpe,blockSkip:fpe,br:_7,code:cpe,del:Wc,delLDelim:Wc,delRDelim:Wc,emStrongLDelim:ppe,emStrongRDelimAst:gpe,emStrongRDelimUnd:$pe,escape:lpe,link:Ppe,nolink:C7,punctuation:upe,reflink:P7,reflinkSearch:Cpe,tag:Qpe,text:dpe,url:Wc},Tpe={...IP,link:Mn(/^!?\[(label)\]\((.*?)\)/).replace("label",Vv).getRegex(),reflink:Mn(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Vv).getRegex()},L_={...IP,emStrongRDelimAst:vpe,emStrongLDelim:mpe,delLDelim:bpe,delRDelim:ype,url:Mn(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",_5).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:Mn(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",_5).getRegex()},kpe={...L_,br:Mn(_7).replace("{2,}","*").getRegex(),text:Mn(L_.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ym={normal:zP,gfm:ope,pedantic:ape},oO={normal:IP,gfm:L_,breaks:kpe,pedantic:Tpe},Rpe={"&":"&","<":"<",">":">",'"':""","'":"'"},w5=t=>Rpe[t];function ba(t,e){if(e){if(ys.escapeTest.test(t))return t.replace(ys.escapeReplace,w5)}else if(ys.escapeTestNoEncode.test(t))return t.replace(ys.escapeReplaceNoEncode,w5);return t}function x5(t){try{t=encodeURI(t).replace(ys.percentDecode,"%")}catch{return null}return t}function Q5(t,e){var s;let n=t.replace(ys.findPipe,(o,a,l)=>{let c=!1,d=a;for(;--d>=0&&l[d]==="\\";)c=!c;return c?"|":" |"}),i=n.split(ys.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(ys.slashPipe,"|");return i}function aO(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 Epe(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 Xpe(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 P5(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 zpe(t,e,n){let i=t.match(n.other.indentCodeCompensation);if(i===null)return e;let r=i[1];return e.split(`
|
|
720
720
|
`).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(`
|
|
721
721
|
`)}var Bv=class{constructor(e){Fe(this,"options");Fe(this,"rules");Fe(this,"lexer");this.options=e||kd}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:aO(i,`
|
|
@@ -1172,7 +1172,7 @@ If the code changes are substantial and the project utilizes Git, initiate \`Tea
|
|
|
1172
1172
|
Once the review report is generated, analyze it to formulate a set of recommended modifications; proceed to implement these recommended modifications by default.
|
|
1173
1173
|
</system-reminder>`};function iwe(t,e="auto",n){const i=KE[e]||KE.auto,r=[];return r.push(i),t&&r.push("",t),r.join(`
|
|
1174
1174
|
`)}const rwe="_helpBtn_19lpl_1",swe="_modalBody_19lpl_25",owe="_spinWrap_19lpl_124",JS={helpBtn:rwe,modalBody:swe,spinWrap:owe},awe=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","QRCode","UltraPlan"]);function lwe({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||!awe.has(t))return null;const d=f.useCallback(async()=>{i(!0),s(!0),a(""),c(t);const h=E_();let O=null;try{const p=await fetch(ut(`/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(sd(O))}else a("<p>Document not found.</p>");s(!1)},[t]),u=an&&!Ai?{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 _.jsxs(_.Fragment,{children:[_.jsx("span",{className:JS.helpBtn,onClick:h=>{h.stopPropagation(),h.nativeEvent.stopImmediatePropagation(),d()},onMouseDown:h=>{h.stopPropagation(),h.nativeEvent.stopImmediatePropagation()},onPointerDown:h=>{h.stopPropagation(),h.nativeEvent.stopImmediatePropagation()},children:"?"}),_.jsx(yi,{title:l,open:n,onCancel:()=>i(!1),footer:null,width:an&&!Ai?"98vw":800,centered:an&&!Ai,styles:u,...e?{zIndex:e}:{},wrapProps:{onMouseDown:h=>h.stopPropagation()},children:r?_.jsx("div",{className:JS.spinWrap,children:_.jsx(ka,{})}):_.jsx("div",{className:JS.modalBody,dangerouslySetInnerHTML:{__html:o}})})]})}const JE={background:"#0a0a0a",foreground:"#d4d4d4",cursor:"#0a0a0a",selectionBackground:"#264f78",black:"#000000",red:"#ef4444",green:"#73c991",yellow:"#fbbf24",blue:"#3b82f6",magenta:"#d946ef",cyan:"#06b6d4",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#ff7b7b",brightGreen:"#9ddc6f",brightYellow:"#ffce5b",brightBlue:"#66b3ff",brightMagenta:"#e88ce8",brightCyan:"#7eddd9",brightWhite:"#ffffff"},eX={background:"#ffffff",foreground:"#333333",cursor:"#333333",selectionBackground:"#cce5ff",black:"#000000",red:"#CD3131",green:"#107C10",yellow:"#949800",blue:"#0451A5",magenta:"#BC05BC",cyan:"#0598BC",white:"#555555",brightBlack:"#666666",brightRed:"#CD3131",brightGreen:"#14CE14",brightYellow:"#B5BA00",brightBlue:"#0451A5",brightMagenta:"#BC05BC",brightCyan:"#0598BC",brightWhite:"#A5A5A5"},cwe=[{label:"↑",seq:"\x1B[A"},{label:"↓",seq:"\x1B[B"},{label:"←",seq:"\x1B[D"},{label:"→",seq:"\x1B[C"},{label:"Enter",seq:"\r"},{label:"Tab",seq:" "},{label:"Esc",seq:"\x1B"},{label:"Ctrl+C",seq:""}];function dwe(){return _.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[_.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),_.jsx("polyline",{points:"17 8 12 3 7 8"}),_.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]})}function tX(){return _.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[_.jsx("circle",{cx:"12",cy:"12",r:"2.5"}),_.jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4"}),_.jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",transform:"rotate(60 12 12)"}),_.jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",transform:"rotate(120 12 12)"})]})}function Im(){return _.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[_.jsx("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),_.jsx("circle",{cx:"9",cy:"7",r:"4"}),_.jsx("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),_.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}async function bu(t){if(t.size>104857600)throw new Error("File too large (max 100MB)");const n=new FormData;n.append("file",t);const r=await(await fetch(ut("/api/upload"),{method:"POST",body:n})).json();if(!r.ok)throw new Error(r.error||"Upload failed");return r.path}class uwe extends G.Component{constructor(n){super(n);Fe(this,"_handlePaste",n=>{var s,o,a,l;const i=(s=n.clipboardData)==null?void 0:s.items;if(i){for(const c of i)if(c.type.startsWith("image/")){n.preventDefault(),n.stopPropagation();const d=c.getAsFile();d&&this._uploadClipboardImage(d);return}}if((a=(o=this.terminal)==null?void 0:o.modes)!=null&&a.bracketedPasteMode)return;const r=(l=n.clipboardData)==null?void 0:l.getData("text");if(!(!r||!this.ws||this.ws.readyState!==WebSocket.OPEN)&&(r.includes(`
|
|
1175
|
-
`)||r.includes("\r"))){n.preventDefault(),n.stopPropagation();const c=`\x1B[200~${r}\x1B[201~`;this.ws.send(JSON.stringify({type:"input",data:c}))}});Fe(this,"_uploadClipboardImage",async n=>{try{const i=await this._downscaleForRetina(n),r=await bu(i);this.props.onFilePath&&this.props.onFilePath(r),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"image-upload-notify",path:r,source:"terminal"})),this.terminal&&this.terminal.focus()}catch(i){console.error("[CC Viewer] Clipboard image upload failed:",i),wn.error(oe("ui.terminal.pasteImageFailed"))}});Fe(this,"handleVirtualKey",n=>{var i,r;if(this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"input",data:n})),an&&!Ai){const s=(i=this.containerRef.current)==null?void 0:i.querySelector(".xterm-helper-textarea");s&&s.blur()}else(r=this.terminal)==null||r.focus()});Fe(this,"_vkTouchStart",n=>{n.preventDefault();const i=n.touches[0];this._vkStartX=i.clientX,this._vkStartY=i.clientY,this._vkMoved=!1,this._vkTarget=n.currentTarget,this._vkTarget.classList.add(ot.virtualKeyPressed)});Fe(this,"_vkTouchMove",n=>{if(this._vkMoved)return;const i=n.touches[0],r=i.clientX-this._vkStartX,s=i.clientY-this._vkStartY;r*r+s*s>64&&(this._vkMoved=!0)});Fe(this,"_vkTouchEnd",(n,i)=>{var r;i.preventDefault(),(r=this._vkTarget)==null||r.classList.remove(ot.virtualKeyPressed),this._vkTarget=null,this._vkMoved||n()});Fe(this,"handleFileUpload",async n=>{var r;const i=(r=n.target.files)==null?void 0:r[0];if(i){try{const s=await bu(i);this.props.onFilePath&&this.props.onFilePath(s),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"image-upload-notify",path:s,source:"terminal"})),(!an||Ai)&&this.terminal&&this.terminal.focus()}catch(s){console.error("[CC Viewer] Upload failed:",s)}n.target.value=""}});Fe(this,"_savePresetShortcuts",(n,i)=>{const r={presetShortcuts:n.map(s=>{const o={teamName:s.teamName,description:s.description};return s.builtinId&&(o.builtinId=s.builtinId),s.modified&&(o.modified=!0),o})};i&&(r.dismissedBuiltinPresets=[...i]),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}).then(()=>{window.dispatchEvent(new Event("ccv-presets-changed"))}).catch(()=>{})});Fe(this,"handlePresetAdd",()=>{const n=this.state.presetAddText.trim(),i=this.state.presetAddName.trim();if(!n&&!i)return;const{presetEditId:r,presetItems:s}=this.state;let o;r?o=s.map(a=>{if(a.id!==r)return a;const l={...a,teamName:i,description:n};return a.builtinId&&(l.modified=!0),l}):o=[...s,{id:Date.now(),teamName:i,description:n}],this.setState({presetItems:o,presetAddVisible:!1,presetAddText:"",presetAddName:"",presetEditId:null}),this._savePresetShortcuts(o)});Fe(this,"handlePresetDelete",()=>{const{presetItems:n,presetSelected:i}=this.state;if(i.size===0)return;const r=new Set(this._dismissedBuiltinPresets||[]);for(const o of n)i.has(o.id)&&o.builtinId&&r.add(o.builtinId);this._dismissedBuiltinPresets=r;const s=n.filter(o=>!i.has(o.id));this.setState({presetItems:s,presetSelected:new Set}),this._savePresetShortcuts(s,r)});Fe(this,"handlePresetToggle",n=>{this.setState(i=>{const r=new Set(i.presetSelected);return r.has(n)?r.delete(n):r.add(n),{presetSelected:r}})});Fe(this,"_dragIdx",null);Fe(this,"_dragOverIdx",null);Fe(this,"handleDragStart",(n,i)=>{i.stopPropagation(),this._dragIdx=n,i.dataTransfer.effectAllowed="move",i.dataTransfer.setData("text/x-preset-reorder",String(n)),requestAnimationFrame(()=>this.forceUpdate())});Fe(this,"handleDragOver",(n,i)=>{i.preventDefault(),i.stopPropagation(),i.dataTransfer.dropEffect="move",this._dragOverIdx!==n&&(this._dragOverIdx=n,this.forceUpdate())});Fe(this,"handleDragEnd",n=>{n&&n.stopPropagation(),this._dragIdx=null,this._dragOverIdx=null,this.forceUpdate()});Fe(this,"handleDragLeave",(n,i)=>{i.stopPropagation(),this._dragOverIdx===n&&(this._dragOverIdx=null,this.forceUpdate())});Fe(this,"handleDrop",(n,i)=>{i.preventDefault(),i.stopPropagation();const r=this._dragIdx;if(r===null||r===n){this.handleDragEnd();return}const s=[...this.state.presetItems],[o]=s.splice(r,1);s.splice(r<n?n-1:n,0,o),this.setState({presetItems:s}),this._savePresetShortcuts(s),this.handleDragEnd()});Fe(this,"handlePresetSend",n=>{n&&(this.setState({agentTeamPopoverOpen:!1}),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"input",data:`\x1B[200~${n}\x1B[201~`})),(!an||Ai)&&this.terminal&&this.terminal.focus())});Fe(this,"handleUltraplanSend",()=>{const n=this.state.ultraplanPrompt.trim();if(!n&&this.state.ultraplanFiles.length===0)return;const i=this.state.ultraplanFiles.map(o=>`"${o.path}"`).join(" "),r=i?n?`${i} ${n}`:i:n,s=iwe(r,this.state.ultraplanVariant);this.setState({ultraplanOpen:!1,ultraplanPrompt:"",ultraplanVariant:"auto",ultraplanFiles:[]}),s&&this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"input",data:`\x1B[200~${s}\x1B[201~\r`})),(!an||Ai)&&this.terminal&&this.terminal.focus()});Fe(this,"handleUltraplanUpload",async()=>{const n=document.createElement("input");n.type="file",n.onchange=async i=>{var s;const r=(s=i.target.files)==null?void 0:s[0];if(r)try{const o=await bu(r);this.setState(a=>({ultraplanFiles:[...a.ultraplanFiles,{name:r.name,path:o}]}))}catch(o){console.error("Ultraplan upload failed:",o),wn.error((o==null?void 0:o.message)||"Upload failed")}},n.click()});Fe(this,"handleUltraplanPaste",async n=>{var r;const i=(r=n.clipboardData)==null?void 0:r.items;if(i){for(const s of i)if(s.type.startsWith("image/")){n.preventDefault();const o=s.getAsFile();if(!o)return;try{const a=await bu(o),l=o.name||`paste-${Date.now()}.png`;this.setState(c=>({ultraplanFiles:[...c.ultraplanFiles,{name:l,path:a}]}))}catch(a){console.error("Ultraplan paste upload failed:",a),wn.error((a==null?void 0:a.message)||"Upload failed")}return}}});Fe(this,"handleUltraplanRemoveFile",n=>{this.setState(i=>({ultraplanFiles:i.ultraplanFiles.filter((r,s)=>s!==n)}))});Fe(this,"handleEnableAgentTeam",()=>{this.state.agentTeamEnabling||(this.setState({agentTeamEnabling:!0}),this.ws&&this.ws.readyState===WebSocket.OPEN&&(this.ws.send(JSON.stringify({type:"input",data:`Add "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" to the env object in ~/.claude/settings.json. If the env key does not exist, create it. Preserve all existing content. Only modify this one field. If ~/.claude/settings.json does not exist, instead add the line: export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 to the user's shell profile (~/.zshrc or ~/.bashrc).`+"\r"})),wn.success("需要重启 Claude Code 才能生效")),(!an||Ai)&&this.terminal&&this.terminal.focus())});this.containerRef=G.createRef(),this.fileInputRef=G.createRef(),this.terminal=null,this.fitAddon=null,this.ws=null,this.resizeObserver=null,this.state={terminalFocused:!1,agentTeamEnabled:!1,agentTeamPopoverOpen:!1,ultraplanOpen:!1,ultraplanVariant:"auto",ultraplanPrompt:"",ultraplanFiles:[],presetModalVisible:!1,presetItems:[],presetSelected:new Set,presetAddVisible:!1,presetAddText:"",presetAddName:"",presetEditId:null}}componentDidMount(){this.initTerminal(),this.connectWebSocket(),this.setupResizeObserver(),fetch(ut("/api/claude-settings")).then(n=>n.json()).then(n=>{var r;const i=((r=n==null?void 0:n.env)==null?void 0:r.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS)==="1";this.setState({agentTeamEnabled:i})}).catch(()=>{}),this._loadPresetShortcuts(),this._onPresetsChanged=()=>this._loadPresetShortcuts(),window.addEventListener("ccv-presets-changed",this._onPresetsChanged),this._onFocusTerminal=()=>{var n,i;this.terminal&&((i=(n=this.containerRef)==null?void 0:n.current)==null?void 0:i.offsetWidth)>0&&this.terminal.focus()},window.addEventListener("ccv-focus-terminal",this._onFocusTerminal),this._themeObserver=new MutationObserver(()=>{if(this.terminal){const n=document.documentElement.getAttribute("data-theme")!=="light";this.terminal.options.theme=n?JE:eX}}),this._themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}_loadPresetShortcuts(){fetch(ut("/api/preferences")).then(n=>n.json()).then(n=>{const i=Array.isArray(n.dismissedBuiltinPresets)?new Set(n.dismissedBuiltinPresets):new Set;this._dismissedBuiltinPresets=i;let r=[];Array.isArray(n.presetShortcuts)&&(r=n.presetShortcuts.map((o,a)=>typeof o=="string"?{id:Date.now()+a,teamName:"",description:o}:{id:Date.now()+a,teamName:o.teamName||"",description:o.description||"",...o.builtinId?{builtinId:o.builtinId}:{},...o.modified?{modified:!0}:{}}));const s=new Set(r.filter(o=>o.builtinId).map(o=>o.builtinId));for(const o of iN)i.has(o.builtinId)||s.has(o.builtinId)||r.unshift({id:Date.now()+Math.random(),builtinId:o.builtinId,teamName:o.teamName,description:o.description});this.setState({presetItems:r})}).catch(()=>{})}componentWillUnmount(){var n;(n=this.terminal)!=null&&n.textarea&&(this.terminal.textarea.removeEventListener("focus",this._handleTermFocus),this.terminal.textarea.removeEventListener("blur",this._handleTermBlur)),this._themeObserver&&(this._themeObserver.disconnect(),this._themeObserver=null),window.removeEventListener("ccv-presets-changed",this._onPresetsChanged),window.removeEventListener("ccv-focus-terminal",this._onFocusTerminal),this._stopMobileMomentum&&this._stopMobileMomentum(),this._writeTimer&&cancelAnimationFrame(this._writeTimer),this._wsReconnectTimer&&clearTimeout(this._wsReconnectTimer),this.ws&&(this.ws.onclose=null,this.ws.close(),this.ws=null),this._resizeDebounceTimer&&clearTimeout(this._resizeDebounceTimer),this._webglRecoveryTimer&&clearTimeout(this._webglRecoveryTimer),this.resizeObserver&&this.resizeObserver.disconnect(),this.webglAddon&&(this.webglAddon.dispose(),this.webglAddon=null),this.terminal&&(this.terminal.textarea&&this.terminal.textarea.removeEventListener("paste",this._handlePaste,!0),this.terminal.dispose())}initTerminal(){const n=document.documentElement.getAttribute("data-theme")!=="light";this.terminal=new zSe({cursorBlink:!1,cursorStyle:"bar",cursorWidth:1,cursorInactiveStyle:"none",fontSize:an&&!Ai?11:13,fontFamily:'Menlo, Monaco, "Courier New", monospace',theme:n?JE:eX,allowProposedApi:!0,scrollback:Ai?3e3:Lu?200:an?1e3:3e3,smoothScrollDuration:0,scrollOnUserInput:!0}),this.fitAddon=new MSe,this.terminal.loadAddon(this.fitAddon),this.terminal.loadAddon(new wye);const i=new Hye;this.terminal.loadAddon(i),this.terminal.unicode.activeVersion="11",this.terminal.open(this.containerRef.current),this._handleTermFocus=()=>this.setState({terminalFocused:!0}),this._handleTermBlur=()=>this.setState({terminalFocused:!1});const r=this.terminal.textarea;r&&(r.addEventListener("focus",this._handleTermFocus),r.addEventListener("blur",this._handleTermBlur)),Lu||this._loadWebglAddon(!1),this._writeBuffer="",this._writeTimer=null,requestAnimationFrame(an&&!Ai?()=>{this._mobileFixedResize()}:()=>{this.fitAddon.fit(),this.terminal.focus()}),this.terminal.attachCustomKeyEventHandler(s=>{var o,a,l,c,d,u;if(s.type==="keydown"&&s.key==="Enter"&&s.shiftKey)return this.ws&&this.ws.readyState===WebSocket.OPEN?(this.ws.send(JSON.stringify({type:"input",data:`\x1B[200~
|
|
1175
|
+
`)||r.includes("\r"))){n.preventDefault(),n.stopPropagation();const c=`\x1B[200~${r}\x1B[201~`;this.ws.send(JSON.stringify({type:"input",data:c}))}});Fe(this,"_uploadClipboardImage",async n=>{try{const i=await this._downscaleForRetina(n),r=await bu(i);this.props.onFilePath&&this.props.onFilePath(r),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"image-upload-notify",path:r,source:"terminal"})),this.terminal&&this.terminal.focus()}catch(i){console.error("[CC Viewer] Clipboard image upload failed:",i),wn.error(oe("ui.terminal.pasteImageFailed"))}});Fe(this,"handleVirtualKey",n=>{var i,r;if(this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"input",data:n})),an&&!Ai){const s=(i=this.containerRef.current)==null?void 0:i.querySelector(".xterm-helper-textarea");s&&s.blur()}else(r=this.terminal)==null||r.focus()});Fe(this,"_vkTouchStart",n=>{n.preventDefault();const i=n.touches[0];this._vkStartX=i.clientX,this._vkStartY=i.clientY,this._vkMoved=!1,this._vkTarget=n.currentTarget,this._vkTarget.classList.add(ot.virtualKeyPressed)});Fe(this,"_vkTouchMove",n=>{if(this._vkMoved)return;const i=n.touches[0],r=i.clientX-this._vkStartX,s=i.clientY-this._vkStartY;r*r+s*s>64&&(this._vkMoved=!0)});Fe(this,"_vkTouchEnd",(n,i)=>{var r;i.preventDefault(),(r=this._vkTarget)==null||r.classList.remove(ot.virtualKeyPressed),this._vkTarget=null,this._vkMoved||n()});Fe(this,"handleFileUpload",async n=>{var r;const i=(r=n.target.files)==null?void 0:r[0];if(i){try{const s=await bu(i);this.props.onFilePath&&this.props.onFilePath(s),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"image-upload-notify",path:s,source:"terminal"})),(!an||Ai)&&this.terminal&&this.terminal.focus()}catch(s){console.error("[CC Viewer] Upload failed:",s)}n.target.value=""}});Fe(this,"_savePresetShortcuts",(n,i)=>{const r={presetShortcuts:n.map(s=>{const o={teamName:s.teamName,description:s.description};return s.builtinId&&(o.builtinId=s.builtinId),s.modified&&(o.modified=!0),o})};i&&(r.dismissedBuiltinPresets=[...i]),fetch(ut("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}).then(()=>{window.dispatchEvent(new Event("ccv-presets-changed"))}).catch(()=>{})});Fe(this,"handlePresetAdd",()=>{const n=this.state.presetAddText.trim(),i=this.state.presetAddName.trim();if(!n&&!i)return;const{presetEditId:r,presetItems:s}=this.state;let o;r?o=s.map(a=>{if(a.id!==r)return a;const l={...a,teamName:i,description:n};return a.builtinId&&(l.modified=!0),l}):o=[...s,{id:Date.now(),teamName:i,description:n}],this.setState({presetItems:o,presetAddVisible:!1,presetAddText:"",presetAddName:"",presetEditId:null}),this._savePresetShortcuts(o)});Fe(this,"handlePresetDelete",()=>{const{presetItems:n,presetSelected:i}=this.state;if(i.size===0)return;const r=new Set(this._dismissedBuiltinPresets||[]);for(const o of n)i.has(o.id)&&o.builtinId&&r.add(o.builtinId);this._dismissedBuiltinPresets=r;const s=n.filter(o=>!i.has(o.id));this.setState({presetItems:s,presetSelected:new Set}),this._savePresetShortcuts(s,r)});Fe(this,"handlePresetToggle",n=>{this.setState(i=>{const r=new Set(i.presetSelected);return r.has(n)?r.delete(n):r.add(n),{presetSelected:r}})});Fe(this,"_dragIdx",null);Fe(this,"_dragOverIdx",null);Fe(this,"handleDragStart",(n,i)=>{i.stopPropagation(),this._dragIdx=n,i.dataTransfer.effectAllowed="move",i.dataTransfer.setData("text/x-preset-reorder",String(n)),requestAnimationFrame(()=>this.forceUpdate())});Fe(this,"handleDragOver",(n,i)=>{i.preventDefault(),i.stopPropagation(),i.dataTransfer.dropEffect="move",this._dragOverIdx!==n&&(this._dragOverIdx=n,this.forceUpdate())});Fe(this,"handleDragEnd",n=>{n&&n.stopPropagation(),this._dragIdx=null,this._dragOverIdx=null,this.forceUpdate()});Fe(this,"handleDragLeave",(n,i)=>{i.stopPropagation(),this._dragOverIdx===n&&(this._dragOverIdx=null,this.forceUpdate())});Fe(this,"handleDrop",(n,i)=>{i.preventDefault(),i.stopPropagation();const r=this._dragIdx;if(r===null||r===n){this.handleDragEnd();return}const s=[...this.state.presetItems],[o]=s.splice(r,1);s.splice(r<n?n-1:n,0,o),this.setState({presetItems:s}),this._savePresetShortcuts(s),this.handleDragEnd()});Fe(this,"handlePresetSend",n=>{n&&(this.setState({agentTeamPopoverOpen:!1}),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"input",data:`\x1B[200~${n}\x1B[201~`})),(!an||Ai)&&this.terminal&&this.terminal.focus())});Fe(this,"handleUltraplanSend",()=>{const n=this.state.ultraplanPrompt.trim();if(!n&&this.state.ultraplanFiles.length===0)return;const i=this.state.ultraplanFiles.map(o=>`"${o.path}"`).join(" "),r=i?n?`${i} ${n}`:i:n,s=iwe(r,this.state.ultraplanVariant);this.setState({ultraplanOpen:!1,ultraplanPrompt:"",ultraplanVariant:"auto",ultraplanFiles:[]}),s&&this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"input",data:`\x1B[200~${s}\x1B[201~\r`})),(!an||Ai)&&this.terminal&&this.terminal.focus()});Fe(this,"handleUltraplanUpload",async()=>{const n=document.createElement("input");n.type="file",n.onchange=async i=>{var s;const r=(s=i.target.files)==null?void 0:s[0];if(r)try{const o=await bu(r);this.setState(a=>({ultraplanFiles:[...a.ultraplanFiles,{name:r.name,path:o}]}))}catch(o){console.error("Ultraplan upload failed:",o),wn.error((o==null?void 0:o.message)||"Upload failed")}},n.click()});Fe(this,"handleUltraplanPaste",async n=>{var r;const i=(r=n.clipboardData)==null?void 0:r.items;if(i){for(const s of i)if(s.type.startsWith("image/")){n.preventDefault();const o=s.getAsFile();if(!o)return;try{const a=await bu(o),l=o.name||`paste-${Date.now()}.png`;this.setState(c=>({ultraplanFiles:[...c.ultraplanFiles,{name:l,path:a}]}))}catch(a){console.error("Ultraplan paste upload failed:",a),wn.error((a==null?void 0:a.message)||"Upload failed")}return}}});Fe(this,"handleUltraplanRemoveFile",n=>{this.setState(i=>({ultraplanFiles:i.ultraplanFiles.filter((r,s)=>s!==n)}))});Fe(this,"handleEnableAgentTeam",()=>{this.state.agentTeamEnabling||(this.setState({agentTeamEnabling:!0}),this.ws&&this.ws.readyState===WebSocket.OPEN&&(this.ws.send(JSON.stringify({type:"input",data:`Add "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" to the env object in ~/.claude/settings.json. If the env key does not exist, create it. Preserve all existing content. Only modify this one field. If ~/.claude/settings.json does not exist, instead add the line: export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 to the user's shell profile (~/.zshrc or ~/.bashrc).`+"\r"})),wn.success("需要重启 Claude Code 才能生效")),(!an||Ai)&&this.terminal&&this.terminal.focus())});this.containerRef=G.createRef(),this.fileInputRef=G.createRef(),this.terminal=null,this.fitAddon=null,this.ws=null,this.resizeObserver=null,this.state={terminalFocused:!1,agentTeamEnabled:!1,agentTeamPopoverOpen:!1,ultraplanOpen:!1,ultraplanVariant:"subagents",ultraplanPrompt:"",ultraplanFiles:[],presetModalVisible:!1,presetItems:[],presetSelected:new Set,presetAddVisible:!1,presetAddText:"",presetAddName:"",presetEditId:null}}componentDidMount(){this.initTerminal(),this.connectWebSocket(),this.setupResizeObserver(),fetch(ut("/api/claude-settings")).then(n=>n.json()).then(n=>{var r;const i=((r=n==null?void 0:n.env)==null?void 0:r.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS)==="1";this.setState({agentTeamEnabled:i})}).catch(()=>{}),this._loadPresetShortcuts(),this._onPresetsChanged=()=>this._loadPresetShortcuts(),window.addEventListener("ccv-presets-changed",this._onPresetsChanged),this._onFocusTerminal=()=>{var n,i;this.terminal&&((i=(n=this.containerRef)==null?void 0:n.current)==null?void 0:i.offsetWidth)>0&&this.terminal.focus()},window.addEventListener("ccv-focus-terminal",this._onFocusTerminal),this._themeObserver=new MutationObserver(()=>{if(this.terminal){const n=document.documentElement.getAttribute("data-theme")!=="light";this.terminal.options.theme=n?JE:eX}}),this._themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}_loadPresetShortcuts(){fetch(ut("/api/preferences")).then(n=>n.json()).then(n=>{const i=Array.isArray(n.dismissedBuiltinPresets)?new Set(n.dismissedBuiltinPresets):new Set;this._dismissedBuiltinPresets=i;let r=[];Array.isArray(n.presetShortcuts)&&(r=n.presetShortcuts.map((o,a)=>typeof o=="string"?{id:Date.now()+a,teamName:"",description:o}:{id:Date.now()+a,teamName:o.teamName||"",description:o.description||"",...o.builtinId?{builtinId:o.builtinId}:{},...o.modified?{modified:!0}:{}}));const s=new Set(r.filter(o=>o.builtinId).map(o=>o.builtinId));for(const o of iN)i.has(o.builtinId)||s.has(o.builtinId)||r.unshift({id:Date.now()+Math.random(),builtinId:o.builtinId,teamName:o.teamName,description:o.description});this.setState({presetItems:r})}).catch(()=>{})}componentWillUnmount(){var n;(n=this.terminal)!=null&&n.textarea&&(this.terminal.textarea.removeEventListener("focus",this._handleTermFocus),this.terminal.textarea.removeEventListener("blur",this._handleTermBlur)),this._themeObserver&&(this._themeObserver.disconnect(),this._themeObserver=null),window.removeEventListener("ccv-presets-changed",this._onPresetsChanged),window.removeEventListener("ccv-focus-terminal",this._onFocusTerminal),this._stopMobileMomentum&&this._stopMobileMomentum(),this._writeTimer&&cancelAnimationFrame(this._writeTimer),this._wsReconnectTimer&&clearTimeout(this._wsReconnectTimer),this.ws&&(this.ws.onclose=null,this.ws.close(),this.ws=null),this._resizeDebounceTimer&&clearTimeout(this._resizeDebounceTimer),this._webglRecoveryTimer&&clearTimeout(this._webglRecoveryTimer),this.resizeObserver&&this.resizeObserver.disconnect(),this.webglAddon&&(this.webglAddon.dispose(),this.webglAddon=null),this.terminal&&(this.terminal.textarea&&this.terminal.textarea.removeEventListener("paste",this._handlePaste,!0),this.terminal.dispose())}initTerminal(){const n=document.documentElement.getAttribute("data-theme")!=="light";this.terminal=new zSe({cursorBlink:!1,cursorStyle:"bar",cursorWidth:1,cursorInactiveStyle:"none",fontSize:an&&!Ai?11:13,fontFamily:'Menlo, Monaco, "Courier New", monospace',theme:n?JE:eX,allowProposedApi:!0,scrollback:Ai?3e3:Lu?200:an?1e3:3e3,smoothScrollDuration:0,scrollOnUserInput:!0}),this.fitAddon=new MSe,this.terminal.loadAddon(this.fitAddon),this.terminal.loadAddon(new wye);const i=new Hye;this.terminal.loadAddon(i),this.terminal.unicode.activeVersion="11",this.terminal.open(this.containerRef.current),this._handleTermFocus=()=>this.setState({terminalFocused:!0}),this._handleTermBlur=()=>this.setState({terminalFocused:!1});const r=this.terminal.textarea;r&&(r.addEventListener("focus",this._handleTermFocus),r.addEventListener("blur",this._handleTermBlur)),Lu||this._loadWebglAddon(!1),this._writeBuffer="",this._writeTimer=null,requestAnimationFrame(an&&!Ai?()=>{this._mobileFixedResize()}:()=>{this.fitAddon.fit(),this.terminal.focus()}),this.terminal.attachCustomKeyEventHandler(s=>{var o,a,l,c,d,u;if(s.type==="keydown"&&s.key==="Enter"&&s.shiftKey)return this.ws&&this.ws.readyState===WebSocket.OPEN?(this.ws.send(JSON.stringify({type:"input",data:`\x1B[200~
|
|
1176
1176
|
\x1B[201~`})),!1):!0;if(s.type==="keydown"&&s.key==="Enter"&&!s.shiftKey&&!s.ctrlKey&&!s.metaKey){const h=this.props.pendingImages,O=((l=(a=(o=this.terminal)==null?void 0:o.buffer)==null?void 0:a.active)==null?void 0:l.type)==="alternate";if((h==null?void 0:h.length)>0&&!O&&((c=this.ws)==null?void 0:c.readyState)===WebSocket.OPEN){const p=h.map(m=>`'${m.path.replace(/'/g,"'\\''")}'`).join(" ");return this.ws.send(JSON.stringify({type:"input",data:p+" "})),(u=(d=this.props).onClearPendingImages)==null||u.call(d),!1}}return!0}),this.terminal.onData(s=>{this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"input",data:s}))}),this.terminal.textarea&&this.terminal.textarea.addEventListener("paste",this._handlePaste,!0),an&&this._setupMobileTouchScroll()}_setupMobileTouchScroll(){var p;const n=(p=this.containerRef.current)==null?void 0:p.querySelector(".xterm-screen");if(!n)return;const i=this.terminal,r=()=>{var g,v,$,b;const m=(b=($=(v=(g=i._core)==null?void 0:g._renderService)==null?void 0:v.dimensions)==null?void 0:$.css)==null?void 0:b.cell;return(m==null?void 0:m.height)||15};let s=0,o=0,a=null,l=0,c=0,d=null,u=[];const h=()=>{a&&(cancelAnimationFrame(a),a=null),d&&(cancelAnimationFrame(d),d=null),c=0,l=0},O=()=>{if(d=null,c===0)return;l+=c,c=0;const m=r(),g=Math.trunc(l/m);g!==0&&(i.scrollLines(g),l-=g*m)};n.addEventListener("touchstart",m=>{h(),m.touches.length===1&&(s=m.touches[0].clientY,o=performance.now(),u=[])},{passive:!0}),n.addEventListener("touchmove",m=>{if(m.touches.length!==1)return;const g=m.touches[0].clientY,v=performance.now(),$=v-o,b=s-g;if($>0){const S=b/$*16;for(u.push({v:S,t:v});u.length>0&&v-u[0].t>100;)u.shift()}c+=b,d||(d=requestAnimationFrame(O)),s=g,o=v},{passive:!0}),n.addEventListener("touchend",()=>{if(d&&(cancelAnimationFrame(d),d=null),c!==0){l+=c,c=0;const b=r(),S=Math.trunc(l/b);S!==0&&i.scrollLines(S),l=0}let m=0;if(u.length>=2){let b=0,S=0;const y=u[u.length-1].t;for(const Q of u){const x=Math.max(0,1-(y-Q.t)/100);S+=Q.v*x,b+=x}m=b>0?S/b:0}if(u=[],Math.abs(m)<.5)return;const g=.95;let v=0;const $=()=>{if(Math.abs(m)<.3){const y=r(),Q=Math.round(v/y);Q!==0&&i.scrollLines(Q),a=null;return}v+=m;const b=r(),S=Math.trunc(v/b);S!==0&&(i.scrollLines(S),v-=S*b),m*=g,a=requestAnimationFrame($)};a=requestAnimationFrame($)},{passive:!0}),this._stopMobileMomentum=h}connectWebSocket(){const i=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`;this.ws=new WebSocket(i),this.ws.onmessage=r=>{try{const s=JSON.parse(r.data);s.type==="data"?this._throttledWrite(s.data):s.type==="exit"?(this._flushWrite(),this.terminal.write(`\r
|
|
1177
1177
|
\x1B[33m${oe("ui.terminal.exited",{code:s.exitCode??"?"})}\x1B[0m\r
|
|
1178
1178
|
`),this.terminal.write(`\x1B[90m${oe("ui.terminal.pressEnterForShell")}\x1B[0m\r
|