@quanthermes/hermes-web-ui 0.6.18 → 0.6.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/client/assets/js/{ChannelsView-DNfeMm-1.js → ChannelsView-BhvSQz3q.js} +1 -1
  2. package/dist/client/assets/js/{ChatView-CJ5xzaMG.js → ChatView-BBWSbOTc.js} +1 -1
  3. package/dist/client/assets/js/{CodingAgentsView-Dvtip0gX.js → CodingAgentsView-TsPWnQ-e.js} +1 -1
  4. package/dist/client/assets/js/{DevicesView-_WSWarB0.js → DevicesView-gWT295OX.js} +1 -1
  5. package/dist/client/assets/js/{FileRenameModal-yIh1kICM.js → FileRenameModal-CEFCYODC.js} +1 -1
  6. package/dist/client/assets/js/{FilesView-COieCqv9.js → FilesView-ClheDLjZ.js} +1 -1
  7. package/dist/client/assets/js/{GroupChatView-CMMdH9qi.js → GroupChatView-DN8mpn70.js} +1 -1
  8. package/dist/client/assets/js/{HistoryMessageList-63JhmxYI.js → HistoryMessageList-B2QMRyzN.js} +1 -1
  9. package/dist/client/assets/js/{HistoryView-CIZhEOTj.js → HistoryView-DYCFFpGg.js} +1 -1
  10. package/dist/client/assets/js/{JobsView-lL7xjV0S.js → JobsView-B-iy-ie4.js} +1 -1
  11. package/dist/client/assets/js/{KanbanView-qn0UtlHi.js → KanbanView-C0rUTSNF.js} +1 -1
  12. package/dist/client/assets/js/{LoginView-63v15BI4.js → LoginView-Dc3El_qw.js} +1 -1
  13. package/dist/client/assets/js/{LogsView-BSvpf5U4.js → LogsView-DwyBT7qp.js} +1 -1
  14. package/dist/client/assets/js/{MarkdownRenderer-THTJMUql.js → MarkdownRenderer-DZb1wMbL.js} +1 -1
  15. package/dist/client/assets/js/{McpManagerView-CA1rzPZs.js → McpManagerView-Dr_hv62e.js} +1 -1
  16. package/dist/client/assets/js/{MemoryView-CnEwNN35.js → MemoryView-CI2_Cy3L.js} +1 -1
  17. package/dist/client/assets/js/{MessageItem-C09jnu6X.js → MessageItem-CVPb7Btj.js} +1 -1
  18. package/dist/client/assets/js/{ModelsView-D9xMGX4E.js → ModelsView-CVsIIan4.js} +1 -1
  19. package/dist/client/assets/js/{OutlinePanel-HsWM7mLO.js → OutlinePanel-C_mZy_cq.js} +1 -1
  20. package/dist/client/assets/js/{PerformanceView-BTqaCcZT.js → PerformanceView-CVfmqAtJ.js} +1 -1
  21. package/dist/client/assets/js/{PluginsView-CRYHgkbM.js → PluginsView-DyuTCtts.js} +1 -1
  22. package/dist/client/assets/js/{ProfilesView-DEI5M20S.js → ProfilesView-B_g8Q3Cy.js} +1 -1
  23. package/dist/client/assets/js/{SettingRow-BlmnHYa0.js → SettingRow-BMYsP5uq.js} +1 -1
  24. package/dist/client/assets/js/{SettingsView-CE9zvzef.js → SettingsView-w0qkQi4m.js} +1 -1
  25. package/dist/client/assets/js/{SkillsUsageView-DurYN8k5.js → SkillsUsageView-KLg_9UJX.js} +1 -1
  26. package/dist/client/assets/js/{SkillsView-CMkth-Fm.js → SkillsView-O7EXzlgA.js} +1 -1
  27. package/dist/client/assets/js/{TerminalPanel-CeRILXkF.js → TerminalPanel-DVuhjZrt.js} +1 -1
  28. package/dist/client/assets/js/{TerminalView-BOCX7lvf.js → TerminalView-DVRlT_-o.js} +1 -1
  29. package/dist/client/assets/js/{UsageView-BuPt2L6B.js → UsageView-C6M2Id1b.js} +1 -1
  30. package/dist/client/assets/js/{VersionPreviewView-DQyROuWd.js → VersionPreviewView-wn0OxFjS.js} +1 -1
  31. package/dist/client/assets/js/{VirtualMessageList-Dty9wvSA.js → VirtualMessageList-ftkWv6i1.js} +1 -1
  32. package/dist/client/assets/js/{_plugin-vue_export-helper-BYiIU0Pd.js → _plugin-vue_export-helper-BIeGRfrQ.js} +2 -2
  33. package/dist/client/assets/js/{index-j9YvpyYe.js → index-Bkiif2Pf.js} +1 -1
  34. package/dist/client/assets/js/{models-ChbKk2Oo.js → models-BxWy-mRj.js} +1 -1
  35. package/dist/client/assets/js/{session-browser-prefs-BHcPARE8.js → session-browser-prefs-Byq_ViZP.js} +1 -1
  36. package/dist/client/assets/js/{skills-Fvhr-K4b.js → skills-aFq9azFz.js} +1 -1
  37. package/dist/client/assets/js/{system-BHEG2KFs.js → system-Bm5rA-WZ.js} +1 -1
  38. package/dist/client/assets/js/{useSttSettings-Cqov9Pdt.js → useSttSettings-DEm4lbwe.js} +1 -1
  39. package/dist/client/index.html +3 -3
  40. package/dist/server/index.js +3 -3
  41. package/package.json +7 -5
@@ -1 +1 @@
1
- import{n as H}from"./rolldown-runtime-M0oDzQ_3.js";import{$t as j,Cn as Gl,Dn as K,K as Zl,Mn as Jl,Ot as A,Pn as T,Pt as ne,Qn as l,Qt as ie,Tn as t,V as se,Wn as _,Wt as J,Y as nt,an as F,cn as ot,ct as rt,dn as N,er as R,ft as oe,i as dt,in as W,ln as I,m as re,nn as G,on as n,rn as e,rr as r,t as Y,un as V,wn as ut}from"./ui-vendor-dYn1tJGA.js";import{c as O,l as X}from"./vue-vendor-DZ4A_GHn.js";import{n as ee,t as le}from"./_plugin-vue_export-helper-BYiIU0Pd.js";import{X as ct,Y as vt}from"./index-j9YvpyYe.js";import{n as Nl,t as ae}from"./MarkdownRenderer-THTJMUql.js";import{a as ht,c as pt,d as kt,i as de,l as te,n as _t,p as ft,s as mt,t as gt,u as yt}from"./skills-Fvhr-K4b.js";var ue,ce,ve,he,pe,ke,_e,fe,me,ge,ye,we,$e,be,Ce,xe,Se,Me,De,Fe,Le,ze,Be,Ie,Pe,Te,Ve,Re,Ue,Ee,He,Qe,qe,je,Ae,We,Yl,Ke=H((()=>{J(),Y(),te(),O(),ue={class:"skill-list"},ce={key:0,class:"skill-empty"},ve=["title","onClick"],he={class:"path-header-text"},pe={class:"category-count"},ke={key:0,class:"path-group-body"},_e=["onClick"],fe={class:"category-name"},me={class:"category-count"},ge={key:0,class:"category-skills"},ye=["onClick"],we={class:"skill-info"},$e={class:"skill-name"},be=["title"],Ce=["title"],xe={key:0,class:"skill-desc"},Se=["onClick"],Me={class:"category-name"},De={class:"category-count"},Fe={key:0,class:"category-skills"},Le=["onClick"],ze={class:"skill-info"},Be={class:"skill-name"},Ie=["title"],Pe=["title"],Te={key:0,class:"skill-desc"},Ve=["title","disabled","onClick"],Re={key:3,class:"skill-category archive-section"},Ue={class:"category-name"},Ee={class:"category-count"},He={key:0,class:"category-skills"},Qe=["onClick"],qe={class:"skill-info"},je={class:"skill-name"},Ae=["title"],We={key:0,class:"skill-desc"},Yl=N({__name:"SkillList",props:{categories:{},archived:{},selectedSkill:{},searchQuery:{},sourceFilter:{}},emits:["select","deleted"],setup(S,{emit:z}){const{t:p}=X(),u=se(),y=nt(),$=S,f=z,v=_(new Set),h=_(!0),D=_(new Set),C=_(new Set),P=G(()=>{let o=$.archived;if($.sourceFilter&&$.sourceFilter!=="modified"&&(o=o.filter(i=>(i.source||"local")===$.sourceFilter)),$.searchQuery){const i=$.searchQuery.toLowerCase();o=o.filter(s=>s.name.toLowerCase().includes(i)||s.description.toLowerCase().includes(i))}return o}),E=G(()=>{let o=$.categories;if($.sourceFilter&&(o=o.map(i=>({...i,skills:i.skills.filter(s=>$.sourceFilter==="modified"?s.modified:(s.source||"local")===$.sourceFilter)})).filter(i=>i.skills.length>0)),$.searchQuery){const i=$.searchQuery.toLowerCase();o=o.map(s=>({...s,skills:s.skills.filter(d=>d.name.toLowerCase().includes(i)||d.description.toLowerCase().includes(i))})).filter(s=>s.skills.length>0||s.name.toLowerCase().includes(i))}return o}),Q=G(()=>{if($.sourceFilter!=="external")return null;const o=new Map,i=[],s=new Map;for(const d of E.value)for(const m of d.skills){const q=m.sourcePath||"";o.has(q)||(o.set(q,new Map),i.push(q),s.set(q,[]));const g=o.get(q);g.has(d.name)||(g.set(d.name,[]),s.get(q).push(d.name)),g.get(d.name).push(m)}return i.map(d=>({path:d,categories:s.get(d).map(m=>({name:m,skills:o.get(d).get(m)}))}))}),U=_(new Set);function w(o){U.value.has(o)?U.value.delete(o):U.value.add(o)}function B(o){return o||"(unknown)"}function k(o){v.value.has(o)?v.value.delete(o):v.value.add(o)}function c(o,i){f("select",o,i)}function x(o,i){return`${o}/${i.name}`}async function M(o,i,s){if(!D.value.has(i)){D.value.add(i);try{await ft(i,s);const d=$.categories.find(m=>m.name===o)?.skills.find(m=>m.name===i);d&&(d.enabled=s)}catch(d){u.error(p("skills.toggleFailed")+`: ${d.message}`)}finally{D.value.delete(i)}}}function b(o,i){C.value.has(i)||y.warning({title:p("skills.delete"),content:p("skills.deleteConfirm",{name:i}),positiveText:p("common.delete"),negativeText:p("common.cancel"),onPositiveClick:async()=>{C.value.add(i);try{await gt(o,i),u.success(p("skills.deleteSuccess")),u.info(p("skills.reloadHint"),{duration:6e3}),f("deleted",o,i)}catch(s){u.error(p("skills.deleteFailed")+`: ${s.message}`)}finally{C.value.delete(i)}}})}return(o,i)=>(t(),n("div",ue,[E.value.length===0?(t(),n("div",ce,r(S.searchQuery?l(p)("skills.noMatch"):l(p)("skills.noSkills")),1)):F("",!0),Q.value?(t(!0),n(j,{key:1},K(Q.value,s=>(t(),n("div",{key:s.path||"__unknown__",class:"skill-path-group"},[e("button",{class:"path-header",title:s.path||"",onClick:d=>w(s.path)},[(t(),n("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:R(["category-arrow",{collapsed:U.value.has(s.path)}])},[...i[3]||(i[3]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),i[4]||(i[4]=e("span",{class:"path-header-icon"},[e("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("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"})])],-1)),e("span",he,r(B(s.path)),1),e("span",pe,r(s.categories.reduce((d,m)=>d+m.skills.length,0)),1)],8,ve),U.value.has(s.path)?F("",!0):(t(),n("div",ke,[(t(!0),n(j,null,K(s.categories,d=>(t(),n("div",{key:d.name,class:"skill-category"},[e("button",{class:"category-header sub",onClick:m=>k(s.path+"::"+d.name)},[(t(),n("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:R(["category-arrow",{collapsed:v.value.has(s.path+"::"+d.name)}])},[...i[5]||(i[5]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),e("span",fe,r(d.name),1),e("span",me,r(d.skills.length),1)],8,_e),v.value.has(s.path+"::"+d.name)?F("",!0):(t(),n("div",ge,[(t(!0),n(j,null,K(d.skills,m=>(t(),n("button",{key:x(d.name,m),class:R(["skill-item",[{active:S.selectedSkill===x(d.name,m)},`source-${m.source||"local"}`]]),onClick:q=>c(d.name,m.name)},[e("div",we,[e("span",$e,[e("span",{class:R(["source-dot",`dot-${m.source||"local"}`]),title:l(p)(`skills.source.${m.source||"local"}`)},null,10,be),I(" "+r(m.name)+" ",1),m.modified?(t(),n("span",{key:0,class:"modified-badge",title:l(p)("skills.modified")},"✎",8,Ce)):F("",!0)]),m.description?(t(),n("span",xe,r(m.description),1)):F("",!0)]),V(l(re),{size:"small",value:m.enabled!==!1,loading:D.value.has(m.name),"onUpdate:value":q=>M(d.name,m.name,q),onClick:i[0]||(i[0]=ie(()=>{},["stop"]))},null,8,["value","loading","onUpdate:value"])],10,ye))),128))]))]))),128))]))]))),128)):(t(!0),n(j,{key:2},K(E.value,s=>(t(),n("div",{key:s.name,class:"skill-category"},[e("button",{class:"category-header",onClick:d=>k(s.name)},[(t(),n("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:R(["category-arrow",{collapsed:v.value.has(s.name)}])},[...i[6]||(i[6]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),e("span",Me,r(s.name),1),e("span",De,r(s.skills.length),1)],8,Se),v.value.has(s.name)?F("",!0):(t(),n("div",Fe,[(t(!0),n(j,null,K(s.skills,d=>(t(),n("button",{key:x(s.name,d),class:R(["skill-item",[{active:S.selectedSkill===x(s.name,d)},`source-${d.source||"local"}`]]),onClick:m=>c(s.name,d.name)},[e("div",ze,[e("span",Be,[e("span",{class:R(["source-dot",`dot-${d.source||"local"}`]),title:l(p)(`skills.source.${d.source||"local"}`)},null,10,Ie),I(" "+r(d.name)+" ",1),d.modified?(t(),n("span",{key:0,class:"modified-badge",title:l(p)("skills.modified")},"✎",8,Pe)):F("",!0)]),d.description?(t(),n("span",Te,r(d.description),1)):F("",!0)]),(d.source??"local")==="local"?(t(),n("button",{key:0,class:"skill-action-btn",title:l(p)("skills.delete"),disabled:C.value.has(d.name),onClick:ie(m=>b(s.name,d.name),["stop"])},[...i[7]||(i[7]=[ot('<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-d16f70a7><polyline points="3 6 5 6 21 6" data-v-d16f70a7></polyline><path d="M19 6l-2 14a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L5 6" data-v-d16f70a7></path><path d="M10 11v6" data-v-d16f70a7></path><path d="M14 11v6" data-v-d16f70a7></path><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2" data-v-d16f70a7></path></svg>',1)])],8,Ve)):F("",!0),V(l(re),{size:"small",value:d.enabled!==!1,loading:D.value.has(d.name),"onUpdate:value":m=>M(s.name,d.name,m),onClick:i[1]||(i[1]=ie(()=>{},["stop"]))},null,8,["value","loading","onUpdate:value"])],10,Le))),128))]))]))),128)),P.value.length>0||S.archived.length>0?(t(),n("div",Re,[e("button",{class:"category-header archive-header",onClick:i[2]||(i[2]=s=>h.value=!h.value)},[(t(),n("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:R(["category-arrow",{collapsed:h.value}])},[...i[8]||(i[8]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),e("span",Ue,r(l(p)("skills.archived")),1),e("span",Ee,r(S.archived.length),1)]),h.value?F("",!0):(t(),n("div",He,[(t(!0),n(j,null,K(P.value,s=>(t(),n("button",{key:x(".archive",s),class:R(["skill-item skill-archived",{active:S.selectedSkill===x(".archive",s)}]),onClick:d=>c(".archive",s.name)},[e("div",qe,[e("span",je,[e("span",{class:R(["source-dot",`dot-${s.source||"local"}`]),title:l(p)(`skills.source.${s.source||"local"}`)},null,10,Ae),I(" "+r(s.name),1)]),s.description?(t(),n("span",We,r(s.description),1)):F("",!0)])],10,Qe))),128))]))])):F("",!0)]))}})})),wt=H((()=>{})),Ol,$t=H((()=>{Ke(),Ke(),wt(),ee(),Ol=le(Yl,[["__scopeId","data-v-d16f70a7"]])})),Ge,Ze,Je,Ne,Ye,Oe,Xe,el,ll,tl,sl,il,al,nl,ol,rl,dl,ul,Xl,cl=H((()=>{J(),Nl(),te(),O(),Y(),Ge={class:"skill-detail"},Ze={class:"detail-title"},Je={class:"detail-category"},Ne={class:"detail-name"},Ye={class:"usage-stats"},Oe=["disabled","title"],Xe=["fill"],el={key:0,class:"usage-stat",title:"Views"},ll={key:1,class:"usage-stat",title:"Uses"},tl={key:2,class:"usage-stat",title:"Patches"},sl={key:0,class:"detail-loading"},il={key:0,class:"detail-breadcrumb"},al={class:"breadcrumb-path"},nl={class:"detail-content"},ol={key:1,class:"detail-files"},rl={class:"files-header"},dl={class:"files-list"},ul=["onClick"],Xl=N({__name:"SkillDetail",props:{category:{},skill:{},skillName:{},patchCount:{},useCount:{},viewCount:{},pinned:{type:Boolean}},emits:["pinToggled"],setup(S,{emit:z}){const{t:p}=X(),u=se(),y=S,$=z,f=_(""),v=_([]),h=_(!1),D=_(""),C=_(null),P=_(!1);async function E(){h.value=!0,C.value=null,D.value="",v.value=[],f.value="";try{const k=`${y.category}/${y.skill}/SKILL.md`,[c,x]=await Promise.all([de(k),ht(y.category,y.skill)]);f.value=c,v.value=x.filter(M=>!M.isDir&&M.path!=="SKILL.md")}catch(k){f.value=p("skills.loadFailed")+`: ${k.message}`}finally{h.value=!1}}async function Q(k){P.value=!0,C.value=k;try{const c=`${y.category}/${y.skill}/`;let x=k;if(k.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(k)){const M=k.replace(/\\/g,"/").split(/(?:^|\/)(?:\.hermes|hermes)\/skills\//)[1];M&&(x=M.split("/").slice(2).join("/"))}D.value=await de(`${c}${x}`)}catch(c){D.value=p("skills.fileLoadFailed")+`: ${c.message}`}finally{P.value=!1}}function U(){C.value=null,D.value=""}const w=_(!1);async function B(){if(!w.value){w.value=!0;try{const k=!y.pinned;await yt(y.skillName,k),$("pinToggled",y.skillName,k)}catch(k){u.error(p("skills.pinFailed")+`: ${k.message}`)}finally{w.value=!1}}}return Jl(()=>`${y.category}/${y.skill}`,E,{immediate:!0}),(k,c)=>(t(),n("div",Ge,[e("div",Ze,[e("span",Je,r(S.category),1),c[4]||(c[4]=e("span",{class:"detail-separator"},"/",-1)),e("span",Ne,r(S.skill),1),e("div",Ye,[e("button",{class:R(["pin-toggle",{active:S.pinned}]),disabled:w.value,title:S.pinned?l(p)("skills.unpin"):l(p)("skills.pin"),onClick:B},[(t(),n("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:S.pinned?"currentColor":"none",stroke:"currentColor","stroke-width":"2"},[...c[0]||(c[0]=[e("path",{d:"M16 12V4h1V2H7v2h1v8l-2 2v2h5.2v6h1.6v-6H18v-2l-2-2z"},null,-1)])],8,Xe))],10,Oe),S.viewCount!=null?(t(),n("span",el,[c[1]||(c[1]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e("circle",{cx:"12",cy:"12",r:"3"})],-1)),I(" "+r(S.viewCount),1)])):F("",!0),S.useCount!=null?(t(),n("span",ll,[c[2]||(c[2]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("polyline",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})],-1)),I(" "+r(S.useCount),1)])):F("",!0),S.patchCount!=null?(t(),n("span",tl,[c[3]||(c[3]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M12 20h9"}),e("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})],-1)),I(" "+r(S.patchCount),1)])):F("",!0)])]),h.value&&!f.value?(t(),n("div",sl,r(l(p)("common.loading")),1)):(t(),n(j,{key:1},[C.value?(t(),n("div",il,[e("button",{class:"back-btn",onClick:U},[c[5]||(c[5]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("polyline",{points:"15 18 9 12 15 6"})],-1)),I(" "+r(l(p)("skills.backTo"))+" "+r(S.skill),1)]),e("span",al,r(C.value),1)])):F("",!0),e("div",nl,[C.value?(t(),W(ae,{key:0,content:D.value},null,8,["content"])):(t(),W(ae,{key:1,content:f.value},null,8,["content"]))]),!C.value&&v.value.length>0?(t(),n("div",ol,[e("div",rl,r(l(p)("skills.attachedFiles")),1),e("div",dl,[(t(!0),n(j,null,K(v.value,x=>(t(),n("button",{key:x.path,class:"file-item",onClick:M=>Q(x.path)},[c[6]||(c[6]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[e("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e("polyline",{points:"14 2 14 8 20 8"})],-1)),e("span",null,r(x.path),1)],8,ul))),128))])])):F("",!0)],64))]))}})})),bt=H((()=>{})),et,Ct=H((()=>{cl(),cl(),bt(),ee(),et=le(Xl,[["__scopeId","data-v-e1b89b0f"]])})),vl,hl,pl,kl,_l,fl,ml,gl,lt,yl=H((()=>{J(),Y(),te(),O(),vl={class:"form-row"},hl={class:"hint"},pl={class:"form-row"},kl={class:"field-label"},_l={class:"form-row"},fl={key:1,class:"folder-picker"},ml={key:0,class:"folder-info"},gl={class:"modal-footer"},lt=N({__name:"SkillImportModal",emits:["close","saved"],setup(S,{emit:z}){const p=z,{t:u}=X(),y=se(),$=_(!0),f=_(!1),v=_("folder"),h=_([]),D=_([]),C=_(""),P=_(""),E=_(null),Q=G(()=>v.value==="zip"?h.value.length>0:D.value.length>0);function U(){h.value=[],D.value=[],C.value=""}function w({file:M}){return(M.name?.toLowerCase()||"").endsWith(".zip")?!0:(y.warning(u("skills.importInvalidFile")),!1)}function B(){E.value?.click()}function k(M){const b=M.target.files;if(!b||b.length===0)return;const o=[];for(let s=0;s<b.length;s++)o.push(b[s]);D.value=o;const i=o[0].webkitRelativePath;C.value=i?i.split("/")[0]:""}async function c(){if(!Q.value){y.warning(u("skills.importNoSelection"));return}let M=[];if(v.value==="zip")for(const b of h.value)b.file&&M.push(b.file);else M=D.value;if(M.length===0){y.error(u("skills.importFailed"));return}f.value=!0;try{const b=await pt(M,P.value.trim()||void 0);y.success(u("skills.importSuccess")+(b?.name?`: ${b.name}`:"")),y.info(u("skills.reloadHint"),{duration:6e3}),p("saved")}catch(b){y.error(u("skills.importFailed")+`: ${b.message}`)}finally{f.value=!1}}function x(){f.value||($.value=!1,setTimeout(()=>p("close"),200))}return(M,b)=>(t(),W(l(Zl),{show:$.value,"onUpdate:show":b[3]||(b[3]=o=>$.value=o),preset:"card",title:l(u)("skills.importTitle"),style:{width:"min(480px, calc(100vw - 32px))"},"mask-closable":!f.value,onAfterLeave:b[4]||(b[4]=o=>p("close"))},{footer:T(()=>[e("div",gl,[V(l(A),{disabled:f.value,onClick:x},{default:T(()=>[I(r(l(u)("common.cancel")),1)]),_:1},8,["disabled"]),V(l(A),{type:"primary",loading:f.value,disabled:!Q.value,onClick:c},{default:T(()=>[I(r(l(u)("common.confirm")),1)]),_:1},8,["loading","disabled"])])]),default:T(()=>[e("div",vl,[V(l(rt),{value:v.value,"onUpdate:value":[b[0]||(b[0]=o=>v.value=o),U],size:"small",disabled:f.value},{default:T(()=>[V(l(oe),{value:"folder"},{default:T(()=>[I(r(l(u)("skills.importModeFolder")),1)]),_:1}),V(l(oe),{value:"zip"},{default:T(()=>[I(r(l(u)("skills.importModeZip")),1)]),_:1})]),_:1},8,["value","disabled"]),e("p",hl,r(v.value==="zip"?l(u)("skills.importHintZip"):l(u)("skills.importHintFolder")),1)]),e("div",pl,[e("label",kl,r(l(u)("skills.importTargetCategory")),1),V(l(ne),{value:P.value,"onUpdate:value":b[1]||(b[1]=o=>P.value=o),size:"small",placeholder:l(u)("skills.importTargetCategoryPlaceholder"),disabled:f.value},null,8,["value","placeholder","disabled"])]),e("div",_l,[v.value==="zip"?(t(),W(l(dt),{key:0,"file-list":h.value,"onUpdate:fileList":b[2]||(b[2]=o=>h.value=o),max:1,accept:".zip","default-upload":!1,disabled:f.value,onBeforeUpload:w},{default:T(()=>[V(l(A),{disabled:f.value},{default:T(()=>[I(r(l(u)("skills.importSelectFile")),1)]),_:1},8,["disabled"])]),_:1},8,["file-list","disabled"])):(t(),n("div",fl,[e("input",{ref_key:"folderInputRef",ref:E,type:"file",webkitdirectory:"",multiple:"",style:{display:"none"},onChange:k},null,544),V(l(A),{disabled:f.value,onClick:B},{default:T(()=>[I(r(l(u)("skills.importSelectFolder")),1)]),_:1},8,["disabled"]),C.value?(t(),n("span",ml,r(C.value)+" ("+r(D.value.length)+" "+r(l(u)("skills.importFileCount"))+") ",1)):F("",!0)]))])]),_:1},8,["show","title","mask-closable"]))}})})),xt=H((()=>{})),tt,St=H((()=>{yl(),yl(),xt(),ee(),tt=le(lt,[["__scopeId","data-v-6cc6068d"]])})),wl,$l,bl,Cl,xl,Sl,Ml,Dl,Fl,st,Ll=H((()=>{J(),Y(),O(),te(),wl={class:"hint"},$l={key:0,class:"state-row"},bl={key:1,class:"state-row empty"},Cl={key:2,class:"dir-list"},xl={class:"dir-input-wrap"},Sl={key:0,class:"hint-tag broken"},Ml={key:1,class:"hint-tag broken"},Dl=["title","disabled","onClick"],Fl={class:"modal-footer"},st=N({__name:"SkillExternalDirsModal",emits:["close","saved"],setup(S,{emit:z}){const p=z,{t:u}=X(),y=se(),$=_(!0),f=_(!1),v=_(!0),h=_([]);function D(w){return w.exists?w.isDir?{raw:w.raw,hint:null}:{raw:w.raw,hint:"notdir"}:{raw:w.raw,hint:"missing"}}Gl(async()=>{try{h.value=(await _t()).map(D)}catch(w){y.error(u("skills.externalDirs.loadFailed")+`: ${w.message}`)}finally{v.value=!1}});function C(){h.value.push({raw:"",hint:null})}function P(w){h.value.splice(w,1)}function E(w){h.value[w]&&(h.value[w].hint=null)}async function Q(){const w=[],B=new Set;for(const k of h.value){const c=k.raw.trim();c&&(B.has(c)||(B.add(c),w.push(c)))}f.value=!0;try{await kt(w),y.success(u("skills.externalDirs.saveSuccess")),p("saved")}catch(k){y.error(u("skills.externalDirs.saveFailed")+`: ${k.message}`)}finally{f.value=!1}}function U(){f.value||($.value=!1,setTimeout(()=>p("close"),200))}return(w,B)=>(t(),W(l(Zl),{show:$.value,"onUpdate:show":B[0]||(B[0]=k=>$.value=k),preset:"card",title:l(u)("skills.externalDirs.title"),style:{width:"min(560px, calc(100vw - 32px))"},"mask-closable":!f.value,onAfterLeave:B[1]||(B[1]=k=>p("close"))},{footer:T(()=>[e("div",Fl,[V(l(A),{disabled:f.value,onClick:U},{default:T(()=>[I(r(l(u)("common.cancel")),1)]),_:1},8,["disabled"]),V(l(A),{type:"primary",loading:f.value,disabled:v.value,onClick:Q},{default:T(()=>[I(r(l(u)("common.save")),1)]),_:1},8,["loading","disabled"])])]),default:T(()=>[e("p",wl,r(l(u)("skills.externalDirs.hint")),1),v.value?(t(),n("div",$l,r(l(u)("common.loading")),1)):h.value.length===0?(t(),n("div",bl,r(l(u)("skills.externalDirs.empty")),1)):(t(),n("ul",Cl,[(t(!0),n(j,null,K(h.value,(k,c)=>(t(),n("li",{key:c,class:"dir-row"},[e("div",xl,[V(l(ne),{value:k.raw,"onUpdate:value":[x=>k.raw=x,x=>E(c)],size:"small",placeholder:l(u)("skills.externalDirs.placeholder"),disabled:f.value},null,8,["value","onUpdate:value","placeholder","disabled"]),k.hint==="missing"?(t(),n("span",Sl,r(l(u)("skills.externalDirs.missing")),1)):k.hint==="notdir"?(t(),n("span",Ml,r(l(u)("skills.externalDirs.notDir")),1)):F("",!0)]),e("button",{class:"row-remove",title:l(u)("skills.externalDirs.removeRow"),disabled:f.value,onClick:x=>P(c)},[...B[2]||(B[2]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])],8,Dl)]))),128))])),V(l(A),{size:"small",disabled:f.value,onClick:C},{icon:T(()=>[...B[3]||(B[3]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)])]),default:T(()=>[I(" "+r(l(u)("skills.externalDirs.add")),1)]),_:1},8,["disabled"])]),_:1},8,["show","title","mask-closable"]))}})})),Mt=H((()=>{})),it,Dt=H((()=>{Ll(),Ll(),Mt(),ee(),it=le(st,[["__scopeId","data-v-134aef16"]])})),zl,Bl,Il,Pl,Tl,Vl,Rl,Ul,El,Hl,Ql,ql,jl,Al,Wl,at,Kl=H((()=>{J(),Y(),O(),$t(),Ct(),St(),Dt(),Nl(),te(),vt(),zl={class:"skills-view"},Bl={class:"page-header"},Il={style:{display:"flex","align-items":"center",gap:"8px"}},Pl={class:"header-title"},Tl={class:"source-legend"},Vl={class:"header-actions"},Rl={class:"header-action-label"},Ul={class:"header-action-label"},El={class:"skills-content"},Hl={key:0,class:"skills-loading"},Ql={key:1,class:"skills-layout"},ql={key:0,class:"skills-sidebar"},jl={class:"skills-main"},Al={key:1,class:"recommendations-panel"},Wl={key:1,class:"empty-detail"},at=N({__name:"SkillsView",setup(S){const{t:z,locale:p}=X(),u=ct(),y=_([]),$=_([]),f=_(!1),v=_(""),h=_(""),D=_(""),C=_(!0),P=_(null),E=_(""),Q=_(!1),U=_(!1);let w=null,B=0;const k=G(()=>String(p.value).startsWith("zh")?"/skill-recommendations.zh.md":"/skill-recommendations.en.md"),c=G(()=>!v.value||!h.value?null:v.value===".archive"?$.value.find(g=>g.name===h.value)??null:y.value.find(g=>g.name===v.value)?.skills.find(g=>g.name===h.value)??null);function x(g){C.value=!g.matches}Gl(()=>{w=window.matchMedia("(max-width: 768px)"),x(w),w.addEventListener("change",x),M(),b()}),ut(()=>{w?.removeEventListener("change",x)});async function M(){f.value=!0;try{(!u.activeProfileName||u.profiles.length===0)&&await u.fetchProfiles();const g=await mt();y.value=g.categories,$.value=g.archived}catch(g){console.error("Failed to load skills:",g)}finally{f.value=!1}}async function b(){const g=++B;try{const a=await fetch(k.value);if(!a.ok)throw new Error(`HTTP ${a.status}`);const L=await a.text();if(/^\s*<!doctype html/i.test(L)||/^\s*<html[\s>]/i.test(L))throw new Error("Skill recommendations file was not found");g===B&&(E.value=L)}catch(a){g===B&&(E.value=""),console.error("Failed to load skill recommendations:",a)}}Jl(k,b);function o(g){P.value=P.value===g?null:g}function i(g,a){if(v.value===g&&h.value===a){v.value="",h.value="";return}v.value=g,h.value=a,window.innerWidth<=768&&(C.value=!1)}function s(g,a){v.value===g&&h.value===a&&(v.value="",h.value=""),M()}function d(){Q.value=!1,M()}function m(){U.value=!1,M()}function q(g,a){if(v.value===".archive"){const L=$.value.find(Z=>Z.name===g);L&&(L.pinned=a)}else{const L=y.value.find(Z=>Z.name===v.value)?.skills.find(Z=>Z.name===g);L&&(L.pinned=a)}}return(g,a)=>(t(),n("div",zl,[e("header",Bl,[e("div",Il,[e("h2",Pl,r(l(z)("skills.title")),1),C.value?F("",!0):(t(),n("button",{key:0,class:"sidebar-toggle",onClick:a[0]||(a[0]=L=>C.value=!0)},[...a[12]||(a[12]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),e("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e("line",{x1:"3",y1:"18",x2:"21",y2:"18"})],-1)])]))]),e("div",Tl,[e("button",{class:R(["legend-item",{active:P.value==="builtin"}]),onClick:a[1]||(a[1]=L=>o("builtin"))},[a[13]||(a[13]=e("span",{class:"legend-dot dot-builtin"},null,-1)),I(r(l(z)("skills.source.builtin")),1)],2),e("button",{class:R(["legend-item",{active:P.value==="hub"}]),onClick:a[2]||(a[2]=L=>o("hub"))},[a[14]||(a[14]=e("span",{class:"legend-dot dot-hub"},null,-1)),I(r(l(z)("skills.source.hub")),1)],2),e("button",{class:R(["legend-item",{active:P.value==="local"}]),onClick:a[3]||(a[3]=L=>o("local"))},[a[15]||(a[15]=e("span",{class:"legend-dot dot-local"},null,-1)),I(r(l(z)("skills.source.local")),1)],2),e("button",{class:R(["legend-item",{active:P.value==="external"}]),onClick:a[4]||(a[4]=L=>o("external"))},[a[16]||(a[16]=e("span",{class:"legend-dot dot-external"},null,-1)),I(r(l(z)("skills.source.external")),1)],2),e("button",{class:R(["legend-item",{active:P.value==="modified"}]),onClick:a[5]||(a[5]=L=>o("modified"))},[a[17]||(a[17]=e("span",{class:"modified-icon"},"✎",-1)),I(r(l(z)("skills.modified")),1)],2)]),e("div",Vl,[V(l(A),{class:"header-action-btn",size:"small",title:l(z)("skills.import"),onClick:a[6]||(a[6]=L=>Q.value=!0)},{icon:T(()=>[...a[18]||(a[18]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e("polyline",{points:"17 8 12 3 7 8"}),e("line",{x1:"12",y1:"3",x2:"12",y2:"15"})],-1)])]),default:T(()=>[e("span",Rl,r(l(z)("skills.import")),1)]),_:1},8,["title"]),V(l(A),{class:"header-action-btn",size:"small",title:l(z)("skills.externalDirs.manage"),onClick:a[7]||(a[7]=L=>U.value=!0)},{icon:T(()=>[...a[19]||(a[19]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("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"})],-1)])]),default:T(()=>[e("span",Ul,r(l(z)("skills.externalDirs.manage")),1)]),_:1},8,["title"]),V(l(ne),{value:D.value,"onUpdate:value":a[8]||(a[8]=L=>D.value=L),placeholder:l(z)("skills.searchPlaceholder"),size:"small",clearable:"",style:{width:"160px"}},null,8,["value","placeholder"])])]),Q.value?(t(),W(tt,{key:0,onClose:a[9]||(a[9]=L=>Q.value=!1),onSaved:d})):F("",!0),U.value?(t(),W(it,{key:1,onClose:a[10]||(a[10]=L=>U.value=!1),onSaved:m})):F("",!0),e("div",El,[f.value&&y.value.length===0?(t(),n("div",Hl,r(l(z)("common.loading")),1)):(t(),n("div",Ql,[e("div",{class:R(["mobile-backdrop",{active:C.value}]),onClick:a[11]||(a[11]=L=>C.value=!1)},null,2),C.value?(t(),n("div",ql,[V(Ol,{categories:y.value,archived:$.value,"selected-skill":v.value&&h.value?`${v.value}/${h.value}`:null,"search-query":D.value,"source-filter":P.value,onSelect:i,onDeleted:s},null,8,["categories","archived","selected-skill","search-query","source-filter"])])):F("",!0),e("div",jl,[v.value&&h.value?(t(),W(et,{key:0,category:v.value,skill:h.value,"skill-name":c.value?.name||h.value,"patch-count":c.value?.patchCount,"use-count":c.value?.useCount,"view-count":c.value?.viewCount,pinned:c.value?.pinned,onPinToggled:q},null,8,["category","skill","skill-name","patch-count","use-count","view-count","pinned"])):(t(),n("div",Al,[E.value?(t(),W(ae,{key:0,content:E.value},null,8,["content"])):(t(),n("div",Wl,[a[20]||(a[20]=e("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1",opacity:"0.2"},[e("polygon",{points:"12 2 2 7 12 12 22 7 12 2"}),e("polyline",{points:"2 17 12 22 22 17"}),e("polyline",{points:"2 12 12 17 22 12"})],-1)),e("span",null,r(l(z)("skills.noMatch")),1)]))]))])]))])]))}})})),Ft=H((()=>{})),Lt,zt=H((()=>{Kl(),Kl(),Ft(),ee(),Lt=le(at,[["__scopeId","data-v-f3601ac9"]])}));zt();export{Lt as default};
1
+ import{n as H}from"./rolldown-runtime-M0oDzQ_3.js";import{$t as j,Cn as Gl,Dn as K,K as Zl,Mn as Jl,Ot as A,Pn as T,Pt as ne,Qn as l,Qt as ie,Tn as t,V as se,Wn as _,Wt as J,Y as nt,an as F,cn as ot,ct as rt,dn as N,er as R,ft as oe,i as dt,in as W,ln as I,m as re,nn as G,on as n,rn as e,rr as r,t as Y,un as V,wn as ut}from"./ui-vendor-dYn1tJGA.js";import{c as O,l as X}from"./vue-vendor-DZ4A_GHn.js";import{n as ee,t as le}from"./_plugin-vue_export-helper-BIeGRfrQ.js";import{X as ct,Y as vt}from"./index-Bkiif2Pf.js";import{n as Nl,t as ae}from"./MarkdownRenderer-DZb1wMbL.js";import{a as ht,c as pt,d as kt,i as de,l as te,n as _t,p as ft,s as mt,t as gt,u as yt}from"./skills-aFq9azFz.js";var ue,ce,ve,he,pe,ke,_e,fe,me,ge,ye,we,$e,be,Ce,xe,Se,Me,De,Fe,Le,ze,Be,Ie,Pe,Te,Ve,Re,Ue,Ee,He,Qe,qe,je,Ae,We,Yl,Ke=H((()=>{J(),Y(),te(),O(),ue={class:"skill-list"},ce={key:0,class:"skill-empty"},ve=["title","onClick"],he={class:"path-header-text"},pe={class:"category-count"},ke={key:0,class:"path-group-body"},_e=["onClick"],fe={class:"category-name"},me={class:"category-count"},ge={key:0,class:"category-skills"},ye=["onClick"],we={class:"skill-info"},$e={class:"skill-name"},be=["title"],Ce=["title"],xe={key:0,class:"skill-desc"},Se=["onClick"],Me={class:"category-name"},De={class:"category-count"},Fe={key:0,class:"category-skills"},Le=["onClick"],ze={class:"skill-info"},Be={class:"skill-name"},Ie=["title"],Pe=["title"],Te={key:0,class:"skill-desc"},Ve=["title","disabled","onClick"],Re={key:3,class:"skill-category archive-section"},Ue={class:"category-name"},Ee={class:"category-count"},He={key:0,class:"category-skills"},Qe=["onClick"],qe={class:"skill-info"},je={class:"skill-name"},Ae=["title"],We={key:0,class:"skill-desc"},Yl=N({__name:"SkillList",props:{categories:{},archived:{},selectedSkill:{},searchQuery:{},sourceFilter:{}},emits:["select","deleted"],setup(S,{emit:z}){const{t:p}=X(),u=se(),y=nt(),$=S,f=z,v=_(new Set),h=_(!0),D=_(new Set),C=_(new Set),P=G(()=>{let o=$.archived;if($.sourceFilter&&$.sourceFilter!=="modified"&&(o=o.filter(i=>(i.source||"local")===$.sourceFilter)),$.searchQuery){const i=$.searchQuery.toLowerCase();o=o.filter(s=>s.name.toLowerCase().includes(i)||s.description.toLowerCase().includes(i))}return o}),E=G(()=>{let o=$.categories;if($.sourceFilter&&(o=o.map(i=>({...i,skills:i.skills.filter(s=>$.sourceFilter==="modified"?s.modified:(s.source||"local")===$.sourceFilter)})).filter(i=>i.skills.length>0)),$.searchQuery){const i=$.searchQuery.toLowerCase();o=o.map(s=>({...s,skills:s.skills.filter(d=>d.name.toLowerCase().includes(i)||d.description.toLowerCase().includes(i))})).filter(s=>s.skills.length>0||s.name.toLowerCase().includes(i))}return o}),Q=G(()=>{if($.sourceFilter!=="external")return null;const o=new Map,i=[],s=new Map;for(const d of E.value)for(const m of d.skills){const q=m.sourcePath||"";o.has(q)||(o.set(q,new Map),i.push(q),s.set(q,[]));const g=o.get(q);g.has(d.name)||(g.set(d.name,[]),s.get(q).push(d.name)),g.get(d.name).push(m)}return i.map(d=>({path:d,categories:s.get(d).map(m=>({name:m,skills:o.get(d).get(m)}))}))}),U=_(new Set);function w(o){U.value.has(o)?U.value.delete(o):U.value.add(o)}function B(o){return o||"(unknown)"}function k(o){v.value.has(o)?v.value.delete(o):v.value.add(o)}function c(o,i){f("select",o,i)}function x(o,i){return`${o}/${i.name}`}async function M(o,i,s){if(!D.value.has(i)){D.value.add(i);try{await ft(i,s);const d=$.categories.find(m=>m.name===o)?.skills.find(m=>m.name===i);d&&(d.enabled=s)}catch(d){u.error(p("skills.toggleFailed")+`: ${d.message}`)}finally{D.value.delete(i)}}}function b(o,i){C.value.has(i)||y.warning({title:p("skills.delete"),content:p("skills.deleteConfirm",{name:i}),positiveText:p("common.delete"),negativeText:p("common.cancel"),onPositiveClick:async()=>{C.value.add(i);try{await gt(o,i),u.success(p("skills.deleteSuccess")),u.info(p("skills.reloadHint"),{duration:6e3}),f("deleted",o,i)}catch(s){u.error(p("skills.deleteFailed")+`: ${s.message}`)}finally{C.value.delete(i)}}})}return(o,i)=>(t(),n("div",ue,[E.value.length===0?(t(),n("div",ce,r(S.searchQuery?l(p)("skills.noMatch"):l(p)("skills.noSkills")),1)):F("",!0),Q.value?(t(!0),n(j,{key:1},K(Q.value,s=>(t(),n("div",{key:s.path||"__unknown__",class:"skill-path-group"},[e("button",{class:"path-header",title:s.path||"",onClick:d=>w(s.path)},[(t(),n("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:R(["category-arrow",{collapsed:U.value.has(s.path)}])},[...i[3]||(i[3]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),i[4]||(i[4]=e("span",{class:"path-header-icon"},[e("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("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"})])],-1)),e("span",he,r(B(s.path)),1),e("span",pe,r(s.categories.reduce((d,m)=>d+m.skills.length,0)),1)],8,ve),U.value.has(s.path)?F("",!0):(t(),n("div",ke,[(t(!0),n(j,null,K(s.categories,d=>(t(),n("div",{key:d.name,class:"skill-category"},[e("button",{class:"category-header sub",onClick:m=>k(s.path+"::"+d.name)},[(t(),n("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:R(["category-arrow",{collapsed:v.value.has(s.path+"::"+d.name)}])},[...i[5]||(i[5]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),e("span",fe,r(d.name),1),e("span",me,r(d.skills.length),1)],8,_e),v.value.has(s.path+"::"+d.name)?F("",!0):(t(),n("div",ge,[(t(!0),n(j,null,K(d.skills,m=>(t(),n("button",{key:x(d.name,m),class:R(["skill-item",[{active:S.selectedSkill===x(d.name,m)},`source-${m.source||"local"}`]]),onClick:q=>c(d.name,m.name)},[e("div",we,[e("span",$e,[e("span",{class:R(["source-dot",`dot-${m.source||"local"}`]),title:l(p)(`skills.source.${m.source||"local"}`)},null,10,be),I(" "+r(m.name)+" ",1),m.modified?(t(),n("span",{key:0,class:"modified-badge",title:l(p)("skills.modified")},"✎",8,Ce)):F("",!0)]),m.description?(t(),n("span",xe,r(m.description),1)):F("",!0)]),V(l(re),{size:"small",value:m.enabled!==!1,loading:D.value.has(m.name),"onUpdate:value":q=>M(d.name,m.name,q),onClick:i[0]||(i[0]=ie(()=>{},["stop"]))},null,8,["value","loading","onUpdate:value"])],10,ye))),128))]))]))),128))]))]))),128)):(t(!0),n(j,{key:2},K(E.value,s=>(t(),n("div",{key:s.name,class:"skill-category"},[e("button",{class:"category-header",onClick:d=>k(s.name)},[(t(),n("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:R(["category-arrow",{collapsed:v.value.has(s.name)}])},[...i[6]||(i[6]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),e("span",Me,r(s.name),1),e("span",De,r(s.skills.length),1)],8,Se),v.value.has(s.name)?F("",!0):(t(),n("div",Fe,[(t(!0),n(j,null,K(s.skills,d=>(t(),n("button",{key:x(s.name,d),class:R(["skill-item",[{active:S.selectedSkill===x(s.name,d)},`source-${d.source||"local"}`]]),onClick:m=>c(s.name,d.name)},[e("div",ze,[e("span",Be,[e("span",{class:R(["source-dot",`dot-${d.source||"local"}`]),title:l(p)(`skills.source.${d.source||"local"}`)},null,10,Ie),I(" "+r(d.name)+" ",1),d.modified?(t(),n("span",{key:0,class:"modified-badge",title:l(p)("skills.modified")},"✎",8,Pe)):F("",!0)]),d.description?(t(),n("span",Te,r(d.description),1)):F("",!0)]),(d.source??"local")==="local"?(t(),n("button",{key:0,class:"skill-action-btn",title:l(p)("skills.delete"),disabled:C.value.has(d.name),onClick:ie(m=>b(s.name,d.name),["stop"])},[...i[7]||(i[7]=[ot('<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-d16f70a7><polyline points="3 6 5 6 21 6" data-v-d16f70a7></polyline><path d="M19 6l-2 14a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L5 6" data-v-d16f70a7></path><path d="M10 11v6" data-v-d16f70a7></path><path d="M14 11v6" data-v-d16f70a7></path><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2" data-v-d16f70a7></path></svg>',1)])],8,Ve)):F("",!0),V(l(re),{size:"small",value:d.enabled!==!1,loading:D.value.has(d.name),"onUpdate:value":m=>M(s.name,d.name,m),onClick:i[1]||(i[1]=ie(()=>{},["stop"]))},null,8,["value","loading","onUpdate:value"])],10,Le))),128))]))]))),128)),P.value.length>0||S.archived.length>0?(t(),n("div",Re,[e("button",{class:"category-header archive-header",onClick:i[2]||(i[2]=s=>h.value=!h.value)},[(t(),n("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:R(["category-arrow",{collapsed:h.value}])},[...i[8]||(i[8]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),e("span",Ue,r(l(p)("skills.archived")),1),e("span",Ee,r(S.archived.length),1)]),h.value?F("",!0):(t(),n("div",He,[(t(!0),n(j,null,K(P.value,s=>(t(),n("button",{key:x(".archive",s),class:R(["skill-item skill-archived",{active:S.selectedSkill===x(".archive",s)}]),onClick:d=>c(".archive",s.name)},[e("div",qe,[e("span",je,[e("span",{class:R(["source-dot",`dot-${s.source||"local"}`]),title:l(p)(`skills.source.${s.source||"local"}`)},null,10,Ae),I(" "+r(s.name),1)]),s.description?(t(),n("span",We,r(s.description),1)):F("",!0)])],10,Qe))),128))]))])):F("",!0)]))}})})),wt=H((()=>{})),Ol,$t=H((()=>{Ke(),Ke(),wt(),ee(),Ol=le(Yl,[["__scopeId","data-v-d16f70a7"]])})),Ge,Ze,Je,Ne,Ye,Oe,Xe,el,ll,tl,sl,il,al,nl,ol,rl,dl,ul,Xl,cl=H((()=>{J(),Nl(),te(),O(),Y(),Ge={class:"skill-detail"},Ze={class:"detail-title"},Je={class:"detail-category"},Ne={class:"detail-name"},Ye={class:"usage-stats"},Oe=["disabled","title"],Xe=["fill"],el={key:0,class:"usage-stat",title:"Views"},ll={key:1,class:"usage-stat",title:"Uses"},tl={key:2,class:"usage-stat",title:"Patches"},sl={key:0,class:"detail-loading"},il={key:0,class:"detail-breadcrumb"},al={class:"breadcrumb-path"},nl={class:"detail-content"},ol={key:1,class:"detail-files"},rl={class:"files-header"},dl={class:"files-list"},ul=["onClick"],Xl=N({__name:"SkillDetail",props:{category:{},skill:{},skillName:{},patchCount:{},useCount:{},viewCount:{},pinned:{type:Boolean}},emits:["pinToggled"],setup(S,{emit:z}){const{t:p}=X(),u=se(),y=S,$=z,f=_(""),v=_([]),h=_(!1),D=_(""),C=_(null),P=_(!1);async function E(){h.value=!0,C.value=null,D.value="",v.value=[],f.value="";try{const k=`${y.category}/${y.skill}/SKILL.md`,[c,x]=await Promise.all([de(k),ht(y.category,y.skill)]);f.value=c,v.value=x.filter(M=>!M.isDir&&M.path!=="SKILL.md")}catch(k){f.value=p("skills.loadFailed")+`: ${k.message}`}finally{h.value=!1}}async function Q(k){P.value=!0,C.value=k;try{const c=`${y.category}/${y.skill}/`;let x=k;if(k.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(k)){const M=k.replace(/\\/g,"/").split(/(?:^|\/)(?:\.hermes|hermes)\/skills\//)[1];M&&(x=M.split("/").slice(2).join("/"))}D.value=await de(`${c}${x}`)}catch(c){D.value=p("skills.fileLoadFailed")+`: ${c.message}`}finally{P.value=!1}}function U(){C.value=null,D.value=""}const w=_(!1);async function B(){if(!w.value){w.value=!0;try{const k=!y.pinned;await yt(y.skillName,k),$("pinToggled",y.skillName,k)}catch(k){u.error(p("skills.pinFailed")+`: ${k.message}`)}finally{w.value=!1}}}return Jl(()=>`${y.category}/${y.skill}`,E,{immediate:!0}),(k,c)=>(t(),n("div",Ge,[e("div",Ze,[e("span",Je,r(S.category),1),c[4]||(c[4]=e("span",{class:"detail-separator"},"/",-1)),e("span",Ne,r(S.skill),1),e("div",Ye,[e("button",{class:R(["pin-toggle",{active:S.pinned}]),disabled:w.value,title:S.pinned?l(p)("skills.unpin"):l(p)("skills.pin"),onClick:B},[(t(),n("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:S.pinned?"currentColor":"none",stroke:"currentColor","stroke-width":"2"},[...c[0]||(c[0]=[e("path",{d:"M16 12V4h1V2H7v2h1v8l-2 2v2h5.2v6h1.6v-6H18v-2l-2-2z"},null,-1)])],8,Xe))],10,Oe),S.viewCount!=null?(t(),n("span",el,[c[1]||(c[1]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e("circle",{cx:"12",cy:"12",r:"3"})],-1)),I(" "+r(S.viewCount),1)])):F("",!0),S.useCount!=null?(t(),n("span",ll,[c[2]||(c[2]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("polyline",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})],-1)),I(" "+r(S.useCount),1)])):F("",!0),S.patchCount!=null?(t(),n("span",tl,[c[3]||(c[3]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M12 20h9"}),e("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})],-1)),I(" "+r(S.patchCount),1)])):F("",!0)])]),h.value&&!f.value?(t(),n("div",sl,r(l(p)("common.loading")),1)):(t(),n(j,{key:1},[C.value?(t(),n("div",il,[e("button",{class:"back-btn",onClick:U},[c[5]||(c[5]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("polyline",{points:"15 18 9 12 15 6"})],-1)),I(" "+r(l(p)("skills.backTo"))+" "+r(S.skill),1)]),e("span",al,r(C.value),1)])):F("",!0),e("div",nl,[C.value?(t(),W(ae,{key:0,content:D.value},null,8,["content"])):(t(),W(ae,{key:1,content:f.value},null,8,["content"]))]),!C.value&&v.value.length>0?(t(),n("div",ol,[e("div",rl,r(l(p)("skills.attachedFiles")),1),e("div",dl,[(t(!0),n(j,null,K(v.value,x=>(t(),n("button",{key:x.path,class:"file-item",onClick:M=>Q(x.path)},[c[6]||(c[6]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[e("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e("polyline",{points:"14 2 14 8 20 8"})],-1)),e("span",null,r(x.path),1)],8,ul))),128))])])):F("",!0)],64))]))}})})),bt=H((()=>{})),et,Ct=H((()=>{cl(),cl(),bt(),ee(),et=le(Xl,[["__scopeId","data-v-e1b89b0f"]])})),vl,hl,pl,kl,_l,fl,ml,gl,lt,yl=H((()=>{J(),Y(),te(),O(),vl={class:"form-row"},hl={class:"hint"},pl={class:"form-row"},kl={class:"field-label"},_l={class:"form-row"},fl={key:1,class:"folder-picker"},ml={key:0,class:"folder-info"},gl={class:"modal-footer"},lt=N({__name:"SkillImportModal",emits:["close","saved"],setup(S,{emit:z}){const p=z,{t:u}=X(),y=se(),$=_(!0),f=_(!1),v=_("folder"),h=_([]),D=_([]),C=_(""),P=_(""),E=_(null),Q=G(()=>v.value==="zip"?h.value.length>0:D.value.length>0);function U(){h.value=[],D.value=[],C.value=""}function w({file:M}){return(M.name?.toLowerCase()||"").endsWith(".zip")?!0:(y.warning(u("skills.importInvalidFile")),!1)}function B(){E.value?.click()}function k(M){const b=M.target.files;if(!b||b.length===0)return;const o=[];for(let s=0;s<b.length;s++)o.push(b[s]);D.value=o;const i=o[0].webkitRelativePath;C.value=i?i.split("/")[0]:""}async function c(){if(!Q.value){y.warning(u("skills.importNoSelection"));return}let M=[];if(v.value==="zip")for(const b of h.value)b.file&&M.push(b.file);else M=D.value;if(M.length===0){y.error(u("skills.importFailed"));return}f.value=!0;try{const b=await pt(M,P.value.trim()||void 0);y.success(u("skills.importSuccess")+(b?.name?`: ${b.name}`:"")),y.info(u("skills.reloadHint"),{duration:6e3}),p("saved")}catch(b){y.error(u("skills.importFailed")+`: ${b.message}`)}finally{f.value=!1}}function x(){f.value||($.value=!1,setTimeout(()=>p("close"),200))}return(M,b)=>(t(),W(l(Zl),{show:$.value,"onUpdate:show":b[3]||(b[3]=o=>$.value=o),preset:"card",title:l(u)("skills.importTitle"),style:{width:"min(480px, calc(100vw - 32px))"},"mask-closable":!f.value,onAfterLeave:b[4]||(b[4]=o=>p("close"))},{footer:T(()=>[e("div",gl,[V(l(A),{disabled:f.value,onClick:x},{default:T(()=>[I(r(l(u)("common.cancel")),1)]),_:1},8,["disabled"]),V(l(A),{type:"primary",loading:f.value,disabled:!Q.value,onClick:c},{default:T(()=>[I(r(l(u)("common.confirm")),1)]),_:1},8,["loading","disabled"])])]),default:T(()=>[e("div",vl,[V(l(rt),{value:v.value,"onUpdate:value":[b[0]||(b[0]=o=>v.value=o),U],size:"small",disabled:f.value},{default:T(()=>[V(l(oe),{value:"folder"},{default:T(()=>[I(r(l(u)("skills.importModeFolder")),1)]),_:1}),V(l(oe),{value:"zip"},{default:T(()=>[I(r(l(u)("skills.importModeZip")),1)]),_:1})]),_:1},8,["value","disabled"]),e("p",hl,r(v.value==="zip"?l(u)("skills.importHintZip"):l(u)("skills.importHintFolder")),1)]),e("div",pl,[e("label",kl,r(l(u)("skills.importTargetCategory")),1),V(l(ne),{value:P.value,"onUpdate:value":b[1]||(b[1]=o=>P.value=o),size:"small",placeholder:l(u)("skills.importTargetCategoryPlaceholder"),disabled:f.value},null,8,["value","placeholder","disabled"])]),e("div",_l,[v.value==="zip"?(t(),W(l(dt),{key:0,"file-list":h.value,"onUpdate:fileList":b[2]||(b[2]=o=>h.value=o),max:1,accept:".zip","default-upload":!1,disabled:f.value,onBeforeUpload:w},{default:T(()=>[V(l(A),{disabled:f.value},{default:T(()=>[I(r(l(u)("skills.importSelectFile")),1)]),_:1},8,["disabled"])]),_:1},8,["file-list","disabled"])):(t(),n("div",fl,[e("input",{ref_key:"folderInputRef",ref:E,type:"file",webkitdirectory:"",multiple:"",style:{display:"none"},onChange:k},null,544),V(l(A),{disabled:f.value,onClick:B},{default:T(()=>[I(r(l(u)("skills.importSelectFolder")),1)]),_:1},8,["disabled"]),C.value?(t(),n("span",ml,r(C.value)+" ("+r(D.value.length)+" "+r(l(u)("skills.importFileCount"))+") ",1)):F("",!0)]))])]),_:1},8,["show","title","mask-closable"]))}})})),xt=H((()=>{})),tt,St=H((()=>{yl(),yl(),xt(),ee(),tt=le(lt,[["__scopeId","data-v-6cc6068d"]])})),wl,$l,bl,Cl,xl,Sl,Ml,Dl,Fl,st,Ll=H((()=>{J(),Y(),O(),te(),wl={class:"hint"},$l={key:0,class:"state-row"},bl={key:1,class:"state-row empty"},Cl={key:2,class:"dir-list"},xl={class:"dir-input-wrap"},Sl={key:0,class:"hint-tag broken"},Ml={key:1,class:"hint-tag broken"},Dl=["title","disabled","onClick"],Fl={class:"modal-footer"},st=N({__name:"SkillExternalDirsModal",emits:["close","saved"],setup(S,{emit:z}){const p=z,{t:u}=X(),y=se(),$=_(!0),f=_(!1),v=_(!0),h=_([]);function D(w){return w.exists?w.isDir?{raw:w.raw,hint:null}:{raw:w.raw,hint:"notdir"}:{raw:w.raw,hint:"missing"}}Gl(async()=>{try{h.value=(await _t()).map(D)}catch(w){y.error(u("skills.externalDirs.loadFailed")+`: ${w.message}`)}finally{v.value=!1}});function C(){h.value.push({raw:"",hint:null})}function P(w){h.value.splice(w,1)}function E(w){h.value[w]&&(h.value[w].hint=null)}async function Q(){const w=[],B=new Set;for(const k of h.value){const c=k.raw.trim();c&&(B.has(c)||(B.add(c),w.push(c)))}f.value=!0;try{await kt(w),y.success(u("skills.externalDirs.saveSuccess")),p("saved")}catch(k){y.error(u("skills.externalDirs.saveFailed")+`: ${k.message}`)}finally{f.value=!1}}function U(){f.value||($.value=!1,setTimeout(()=>p("close"),200))}return(w,B)=>(t(),W(l(Zl),{show:$.value,"onUpdate:show":B[0]||(B[0]=k=>$.value=k),preset:"card",title:l(u)("skills.externalDirs.title"),style:{width:"min(560px, calc(100vw - 32px))"},"mask-closable":!f.value,onAfterLeave:B[1]||(B[1]=k=>p("close"))},{footer:T(()=>[e("div",Fl,[V(l(A),{disabled:f.value,onClick:U},{default:T(()=>[I(r(l(u)("common.cancel")),1)]),_:1},8,["disabled"]),V(l(A),{type:"primary",loading:f.value,disabled:v.value,onClick:Q},{default:T(()=>[I(r(l(u)("common.save")),1)]),_:1},8,["loading","disabled"])])]),default:T(()=>[e("p",wl,r(l(u)("skills.externalDirs.hint")),1),v.value?(t(),n("div",$l,r(l(u)("common.loading")),1)):h.value.length===0?(t(),n("div",bl,r(l(u)("skills.externalDirs.empty")),1)):(t(),n("ul",Cl,[(t(!0),n(j,null,K(h.value,(k,c)=>(t(),n("li",{key:c,class:"dir-row"},[e("div",xl,[V(l(ne),{value:k.raw,"onUpdate:value":[x=>k.raw=x,x=>E(c)],size:"small",placeholder:l(u)("skills.externalDirs.placeholder"),disabled:f.value},null,8,["value","onUpdate:value","placeholder","disabled"]),k.hint==="missing"?(t(),n("span",Sl,r(l(u)("skills.externalDirs.missing")),1)):k.hint==="notdir"?(t(),n("span",Ml,r(l(u)("skills.externalDirs.notDir")),1)):F("",!0)]),e("button",{class:"row-remove",title:l(u)("skills.externalDirs.removeRow"),disabled:f.value,onClick:x=>P(c)},[...B[2]||(B[2]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])],8,Dl)]))),128))])),V(l(A),{size:"small",disabled:f.value,onClick:C},{icon:T(()=>[...B[3]||(B[3]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)])]),default:T(()=>[I(" "+r(l(u)("skills.externalDirs.add")),1)]),_:1},8,["disabled"])]),_:1},8,["show","title","mask-closable"]))}})})),Mt=H((()=>{})),it,Dt=H((()=>{Ll(),Ll(),Mt(),ee(),it=le(st,[["__scopeId","data-v-134aef16"]])})),zl,Bl,Il,Pl,Tl,Vl,Rl,Ul,El,Hl,Ql,ql,jl,Al,Wl,at,Kl=H((()=>{J(),Y(),O(),$t(),Ct(),St(),Dt(),Nl(),te(),vt(),zl={class:"skills-view"},Bl={class:"page-header"},Il={style:{display:"flex","align-items":"center",gap:"8px"}},Pl={class:"header-title"},Tl={class:"source-legend"},Vl={class:"header-actions"},Rl={class:"header-action-label"},Ul={class:"header-action-label"},El={class:"skills-content"},Hl={key:0,class:"skills-loading"},Ql={key:1,class:"skills-layout"},ql={key:0,class:"skills-sidebar"},jl={class:"skills-main"},Al={key:1,class:"recommendations-panel"},Wl={key:1,class:"empty-detail"},at=N({__name:"SkillsView",setup(S){const{t:z,locale:p}=X(),u=ct(),y=_([]),$=_([]),f=_(!1),v=_(""),h=_(""),D=_(""),C=_(!0),P=_(null),E=_(""),Q=_(!1),U=_(!1);let w=null,B=0;const k=G(()=>String(p.value).startsWith("zh")?"/skill-recommendations.zh.md":"/skill-recommendations.en.md"),c=G(()=>!v.value||!h.value?null:v.value===".archive"?$.value.find(g=>g.name===h.value)??null:y.value.find(g=>g.name===v.value)?.skills.find(g=>g.name===h.value)??null);function x(g){C.value=!g.matches}Gl(()=>{w=window.matchMedia("(max-width: 768px)"),x(w),w.addEventListener("change",x),M(),b()}),ut(()=>{w?.removeEventListener("change",x)});async function M(){f.value=!0;try{(!u.activeProfileName||u.profiles.length===0)&&await u.fetchProfiles();const g=await mt();y.value=g.categories,$.value=g.archived}catch(g){console.error("Failed to load skills:",g)}finally{f.value=!1}}async function b(){const g=++B;try{const a=await fetch(k.value);if(!a.ok)throw new Error(`HTTP ${a.status}`);const L=await a.text();if(/^\s*<!doctype html/i.test(L)||/^\s*<html[\s>]/i.test(L))throw new Error("Skill recommendations file was not found");g===B&&(E.value=L)}catch(a){g===B&&(E.value=""),console.error("Failed to load skill recommendations:",a)}}Jl(k,b);function o(g){P.value=P.value===g?null:g}function i(g,a){if(v.value===g&&h.value===a){v.value="",h.value="";return}v.value=g,h.value=a,window.innerWidth<=768&&(C.value=!1)}function s(g,a){v.value===g&&h.value===a&&(v.value="",h.value=""),M()}function d(){Q.value=!1,M()}function m(){U.value=!1,M()}function q(g,a){if(v.value===".archive"){const L=$.value.find(Z=>Z.name===g);L&&(L.pinned=a)}else{const L=y.value.find(Z=>Z.name===v.value)?.skills.find(Z=>Z.name===g);L&&(L.pinned=a)}}return(g,a)=>(t(),n("div",zl,[e("header",Bl,[e("div",Il,[e("h2",Pl,r(l(z)("skills.title")),1),C.value?F("",!0):(t(),n("button",{key:0,class:"sidebar-toggle",onClick:a[0]||(a[0]=L=>C.value=!0)},[...a[12]||(a[12]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),e("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e("line",{x1:"3",y1:"18",x2:"21",y2:"18"})],-1)])]))]),e("div",Tl,[e("button",{class:R(["legend-item",{active:P.value==="builtin"}]),onClick:a[1]||(a[1]=L=>o("builtin"))},[a[13]||(a[13]=e("span",{class:"legend-dot dot-builtin"},null,-1)),I(r(l(z)("skills.source.builtin")),1)],2),e("button",{class:R(["legend-item",{active:P.value==="hub"}]),onClick:a[2]||(a[2]=L=>o("hub"))},[a[14]||(a[14]=e("span",{class:"legend-dot dot-hub"},null,-1)),I(r(l(z)("skills.source.hub")),1)],2),e("button",{class:R(["legend-item",{active:P.value==="local"}]),onClick:a[3]||(a[3]=L=>o("local"))},[a[15]||(a[15]=e("span",{class:"legend-dot dot-local"},null,-1)),I(r(l(z)("skills.source.local")),1)],2),e("button",{class:R(["legend-item",{active:P.value==="external"}]),onClick:a[4]||(a[4]=L=>o("external"))},[a[16]||(a[16]=e("span",{class:"legend-dot dot-external"},null,-1)),I(r(l(z)("skills.source.external")),1)],2),e("button",{class:R(["legend-item",{active:P.value==="modified"}]),onClick:a[5]||(a[5]=L=>o("modified"))},[a[17]||(a[17]=e("span",{class:"modified-icon"},"✎",-1)),I(r(l(z)("skills.modified")),1)],2)]),e("div",Vl,[V(l(A),{class:"header-action-btn",size:"small",title:l(z)("skills.import"),onClick:a[6]||(a[6]=L=>Q.value=!0)},{icon:T(()=>[...a[18]||(a[18]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e("polyline",{points:"17 8 12 3 7 8"}),e("line",{x1:"12",y1:"3",x2:"12",y2:"15"})],-1)])]),default:T(()=>[e("span",Rl,r(l(z)("skills.import")),1)]),_:1},8,["title"]),V(l(A),{class:"header-action-btn",size:"small",title:l(z)("skills.externalDirs.manage"),onClick:a[7]||(a[7]=L=>U.value=!0)},{icon:T(()=>[...a[19]||(a[19]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("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"})],-1)])]),default:T(()=>[e("span",Ul,r(l(z)("skills.externalDirs.manage")),1)]),_:1},8,["title"]),V(l(ne),{value:D.value,"onUpdate:value":a[8]||(a[8]=L=>D.value=L),placeholder:l(z)("skills.searchPlaceholder"),size:"small",clearable:"",style:{width:"160px"}},null,8,["value","placeholder"])])]),Q.value?(t(),W(tt,{key:0,onClose:a[9]||(a[9]=L=>Q.value=!1),onSaved:d})):F("",!0),U.value?(t(),W(it,{key:1,onClose:a[10]||(a[10]=L=>U.value=!1),onSaved:m})):F("",!0),e("div",El,[f.value&&y.value.length===0?(t(),n("div",Hl,r(l(z)("common.loading")),1)):(t(),n("div",Ql,[e("div",{class:R(["mobile-backdrop",{active:C.value}]),onClick:a[11]||(a[11]=L=>C.value=!1)},null,2),C.value?(t(),n("div",ql,[V(Ol,{categories:y.value,archived:$.value,"selected-skill":v.value&&h.value?`${v.value}/${h.value}`:null,"search-query":D.value,"source-filter":P.value,onSelect:i,onDeleted:s},null,8,["categories","archived","selected-skill","search-query","source-filter"])])):F("",!0),e("div",jl,[v.value&&h.value?(t(),W(et,{key:0,category:v.value,skill:h.value,"skill-name":c.value?.name||h.value,"patch-count":c.value?.patchCount,"use-count":c.value?.useCount,"view-count":c.value?.viewCount,pinned:c.value?.pinned,onPinToggled:q},null,8,["category","skill","skill-name","patch-count","use-count","view-count","pinned"])):(t(),n("div",Al,[E.value?(t(),W(ae,{key:0,content:E.value},null,8,["content"])):(t(),n("div",Wl,[a[20]||(a[20]=e("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1",opacity:"0.2"},[e("polygon",{points:"12 2 2 7 12 12 22 7 12 2"}),e("polyline",{points:"2 17 12 22 22 17"}),e("polyline",{points:"2 12 12 17 22 12"})],-1)),e("span",null,r(l(z)("skills.noMatch")),1)]))]))])]))])]))}})})),Ft=H((()=>{})),Lt,zt=H((()=>{Kl(),Kl(),Ft(),ee(),Lt=le(at,[["__scopeId","data-v-f3601ac9"]])}));zt();export{Lt as default};
@@ -1,3 +1,3 @@
1
- import{n as L}from"./rolldown-runtime-M0oDzQ_3.js";import{$t as G,Dn as ze,Mn as De,Ot as I,Pn as m,Qn as r,Qt as Ue,Tn as c,V as We,Wn as b,Wt as Ye,an as R,dn as Fe,er as ee,in as Ge,ln as w,mt as He,nn as H,nr as Je,on as d,ot as Ve,rn as i,rr as s,t as Ke,un as A,w as qe,wn as je}from"./ui-vendor-dYn1tJGA.js";import{c as Qe,l as Xe}from"./vue-vendor-DZ4A_GHn.js";import{f as C,n as Ze,o as et,s as tt,t as nt,u as Ce}from"./_plugin-vue_export-helper-BYiIU0Pd.js";import{a as it,i as at,n as ot,o as rt,r as st,s as lt,t as ct}from"./xterm-CraVE7U3.js";async function St(){return C("/api/coding-agents")}async function At(l){return C(`/api/coding-agents/${l}/install`,{method:"POST"})}async function $t(l){return C(`/api/coding-agents/${l}`,{method:"DELETE"})}async function Bt(l,a,_={}){const g=new URLSearchParams;_.profile&&g.set("profile",_.profile),_.provider&&g.set("provider",_.provider);const p=g.toString();return C(`/api/coding-agents/${l}/config-files/${encodeURIComponent(a)}${p?`?${p}`:""}`)}async function Et(l,a,_,g={}){return C(`/api/coding-agents/${l}/config-files/${encodeURIComponent(a)}`,{method:"PUT",body:JSON.stringify({content:_,profile:g.profile,provider:g.provider})})}async function Ot(l,a){return C(`/api/coding-agents/${l}/launch/prepare`,{method:"POST",body:JSON.stringify(a)})}async function Mt(l,a){return C(`/api/coding-agents/${l}/launch/native`,{method:"POST",body:JSON.stringify(a)})}var Nt=L((()=>{Ce()})),te,ne,ie,ae,oe,re,se,le,ce,ue,de,fe,he,me,ge,_e,ve,be,J,pe,V,ye,ke,Te,we=L((()=>{Ye(),lt(),at(),st(),ct(),Ce(),Ke(),Qe(),te={class:"terminal-panel-drawer"},ne={class:"sidebar-header"},ie={class:"sidebar-title"},ae={class:"session-list"},oe={key:0,class:"session-error"},re={key:1,class:"session-empty"},se=["onClick"],le={class:"session-item-content"},ce={class:"session-item-title"},ue={class:"session-item-meta"},de={class:"session-item-shell"},fe={key:0,class:"session-item-status"},he={key:1,class:"session-item-time"},me={class:"terminal-main"},ge={class:"terminal-header"},_e={key:0,class:"header-session-title"},ve={class:"header-actions"},be={class:"terminal-container"},J="hermes_terminal_theme",pe=3,V=18,ye=128,ke=8,Te=Fe({__name:"TerminalPanel",props:{visible:{type:Boolean},initialCommand:{}},setup(l){const{t:a}=Xe(),_=We(),g=l,p={default:{label:"Default",theme:{background:"#1a1a2e",foreground:"#e0e0e0",cursor:"#4cc9f0",cursorAccent:"#1a1a2e",selectionBackground:"rgba(76, 201, 240, 0.3)",black:"#000000",red:"#e06c75",green:"#98c379",yellow:"#e5c07b",blue:"#61afef",magenta:"#c678dd",cyan:"#56b6c2",white:"#abb2bf",brightBlack:"#5c6370",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"}},"solarized-dark":{label:"Solarized Dark",theme:{background:"#002b36",foreground:"#839496",cursor:"#93a1a1",cursorAccent:"#002b36",selectionBackground:"rgba(147, 161, 161, 0.3)",black:"#073642",red:"#dc322f",green:"#859900",yellow:"#b58900",blue:"#268bd2",magenta:"#d33682",cyan:"#2aa198",white:"#eee8d5",brightBlack:"#002b36",brightRed:"#cb4b16",brightGreen:"#586e75",brightYellow:"#657b83",brightBlue:"#839496",brightMagenta:"#6c71c4",brightCyan:"#93a1a1",brightWhite:"#fdf6e3"}},"tokyo-night":{label:"Tokyo Night",theme:{background:"#1a1b26",foreground:"#a9b1d6",cursor:"#c0caf5",cursorAccent:"#1a1b26",selectionBackground:"rgba(192, 202, 245, 0.2)",black:"#15161e",red:"#f7768e",green:"#9ece6a",yellow:"#e0af68",blue:"#7aa2f7",magenta:"#bb9af7",cyan:"#7dcfff",white:"#a9b1d6",brightBlack:"#414868",brightRed:"#f7768e",brightGreen:"#9ece6a",brightYellow:"#e0af68",brightBlue:"#7aa2f7",brightMagenta:"#bb9af7",brightCyan:"#7dcfff",brightWhite:"#c0caf5"}},"github-dark":{label:"GitHub Dark",theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#58a6ff",cursorAccent:"#0d1117",selectionBackground:"rgba(88, 166, 255, 0.25)",black:"#484f58",red:"#ff7b72",green:"#7ee787",yellow:"#ffa657",blue:"#79c0ff",magenta:"#d2a8ff",cyan:"#a5d6ff",white:"#c9d1d9",brightBlack:"#6e7681",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#58a6ff",brightMagenta:"#bc8cff",brightCyan:"#79c0ff",brightWhite:"#f0f6fc"}}},T=b(null),u=b([]),f=b(null),N=b(localStorage.getItem(J)||"default"),y=b(null),$=b(!1),B=b(!1);let o=null;const v=new Map;let h=null,E=null,z=null,D=0,x=null,S=0;const K=b(!1),P=new Set,q=H(()=>u.value.find(e=>e.id===f.value)||null),xe=H(()=>Object.entries(p).map(([e,t])=>({label:t.label,value:e}))),Se=H(()=>p[N.value]?.theme.background??"#1a1a2e");function Ae(){const e=et(),t=tt(),n=t?t.startsWith("https")?"wss:":"ws:":location.protocol==="https:"?"wss:":"ws:";return t?`${n}//${new URL(t).host}/api/hermes/terminal${e?`?token=${encodeURIComponent(e)}`:""}`:`${n}//${location.host}/api/hermes/terminal${e?`?token=${encodeURIComponent(e)}`:""}`}function U(){if(D>=pe){y.value=a("terminal.connectionFailed"),$.value=!1;return}const e=Ae();y.value=null,$.value=!0,D++,o=new WebSocket(e),o.onopen=()=>{$.value=!1,y.value=null},o.onmessage=t=>{const n=typeof t.data=="string"?t.data:"";if(n.charCodeAt(0)===123)try{$e(JSON.parse(n))}catch{}else h?.write(n)},o.onclose=t=>{if($.value=!1,t.code===1e3||t.code===1003||t.code===1008){y.value=a("terminal.connectionClosed");return}setTimeout(U,3e3)},o.onerror=t=>{console.error("[Terminal] WebSocket error:",t),y.value=a("terminal.connectionError")}}function O(e){!o||o.readyState!==WebSocket.OPEN||o.send(typeof e=="string"?e:JSON.stringify(e))}function $e(e){switch(e.type){case"created":D=0,u.value.push({id:e.id,shell:e.shell,pid:e.pid,title:`${e.shell} #${u.value.length+1}`,createdAt:Date.now(),exited:!1}),Y(e.id),Be();break;case"exited":{const t=u.value.find(n=>n.id===e.id);t&&(t.exited=!0,f.value===e.id&&h?.write(`\r
1
+ import{n as L}from"./rolldown-runtime-M0oDzQ_3.js";import{$t as G,Dn as ze,Mn as De,Ot as I,Pn as m,Qn as r,Qt as Ue,Tn as c,V as We,Wn as b,Wt as Ye,an as R,dn as Fe,er as ee,in as Ge,ln as w,mt as He,nn as H,nr as Je,on as d,ot as Ve,rn as i,rr as s,t as Ke,un as A,w as qe,wn as je}from"./ui-vendor-dYn1tJGA.js";import{c as Qe,l as Xe}from"./vue-vendor-DZ4A_GHn.js";import{f as C,n as Ze,o as et,s as tt,t as nt,u as Ce}from"./_plugin-vue_export-helper-BIeGRfrQ.js";import{a as it,i as at,n as ot,o as rt,r as st,s as lt,t as ct}from"./xterm-CraVE7U3.js";async function St(){return C("/api/coding-agents")}async function At(l){return C(`/api/coding-agents/${l}/install`,{method:"POST"})}async function $t(l){return C(`/api/coding-agents/${l}`,{method:"DELETE"})}async function Bt(l,a,_={}){const g=new URLSearchParams;_.profile&&g.set("profile",_.profile),_.provider&&g.set("provider",_.provider);const p=g.toString();return C(`/api/coding-agents/${l}/config-files/${encodeURIComponent(a)}${p?`?${p}`:""}`)}async function Et(l,a,_,g={}){return C(`/api/coding-agents/${l}/config-files/${encodeURIComponent(a)}`,{method:"PUT",body:JSON.stringify({content:_,profile:g.profile,provider:g.provider})})}async function Ot(l,a){return C(`/api/coding-agents/${l}/launch/prepare`,{method:"POST",body:JSON.stringify(a)})}async function Mt(l,a){return C(`/api/coding-agents/${l}/launch/native`,{method:"POST",body:JSON.stringify(a)})}var Nt=L((()=>{Ce()})),te,ne,ie,ae,oe,re,se,le,ce,ue,de,fe,he,me,ge,_e,ve,be,J,pe,V,ye,ke,Te,we=L((()=>{Ye(),lt(),at(),st(),ct(),Ce(),Ke(),Qe(),te={class:"terminal-panel-drawer"},ne={class:"sidebar-header"},ie={class:"sidebar-title"},ae={class:"session-list"},oe={key:0,class:"session-error"},re={key:1,class:"session-empty"},se=["onClick"],le={class:"session-item-content"},ce={class:"session-item-title"},ue={class:"session-item-meta"},de={class:"session-item-shell"},fe={key:0,class:"session-item-status"},he={key:1,class:"session-item-time"},me={class:"terminal-main"},ge={class:"terminal-header"},_e={key:0,class:"header-session-title"},ve={class:"header-actions"},be={class:"terminal-container"},J="hermes_terminal_theme",pe=3,V=18,ye=128,ke=8,Te=Fe({__name:"TerminalPanel",props:{visible:{type:Boolean},initialCommand:{}},setup(l){const{t:a}=Xe(),_=We(),g=l,p={default:{label:"Default",theme:{background:"#1a1a2e",foreground:"#e0e0e0",cursor:"#4cc9f0",cursorAccent:"#1a1a2e",selectionBackground:"rgba(76, 201, 240, 0.3)",black:"#000000",red:"#e06c75",green:"#98c379",yellow:"#e5c07b",blue:"#61afef",magenta:"#c678dd",cyan:"#56b6c2",white:"#abb2bf",brightBlack:"#5c6370",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"}},"solarized-dark":{label:"Solarized Dark",theme:{background:"#002b36",foreground:"#839496",cursor:"#93a1a1",cursorAccent:"#002b36",selectionBackground:"rgba(147, 161, 161, 0.3)",black:"#073642",red:"#dc322f",green:"#859900",yellow:"#b58900",blue:"#268bd2",magenta:"#d33682",cyan:"#2aa198",white:"#eee8d5",brightBlack:"#002b36",brightRed:"#cb4b16",brightGreen:"#586e75",brightYellow:"#657b83",brightBlue:"#839496",brightMagenta:"#6c71c4",brightCyan:"#93a1a1",brightWhite:"#fdf6e3"}},"tokyo-night":{label:"Tokyo Night",theme:{background:"#1a1b26",foreground:"#a9b1d6",cursor:"#c0caf5",cursorAccent:"#1a1b26",selectionBackground:"rgba(192, 202, 245, 0.2)",black:"#15161e",red:"#f7768e",green:"#9ece6a",yellow:"#e0af68",blue:"#7aa2f7",magenta:"#bb9af7",cyan:"#7dcfff",white:"#a9b1d6",brightBlack:"#414868",brightRed:"#f7768e",brightGreen:"#9ece6a",brightYellow:"#e0af68",brightBlue:"#7aa2f7",brightMagenta:"#bb9af7",brightCyan:"#7dcfff",brightWhite:"#c0caf5"}},"github-dark":{label:"GitHub Dark",theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#58a6ff",cursorAccent:"#0d1117",selectionBackground:"rgba(88, 166, 255, 0.25)",black:"#484f58",red:"#ff7b72",green:"#7ee787",yellow:"#ffa657",blue:"#79c0ff",magenta:"#d2a8ff",cyan:"#a5d6ff",white:"#c9d1d9",brightBlack:"#6e7681",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#58a6ff",brightMagenta:"#bc8cff",brightCyan:"#79c0ff",brightWhite:"#f0f6fc"}}},T=b(null),u=b([]),f=b(null),N=b(localStorage.getItem(J)||"default"),y=b(null),$=b(!1),B=b(!1);let o=null;const v=new Map;let h=null,E=null,z=null,D=0,x=null,S=0;const K=b(!1),P=new Set,q=H(()=>u.value.find(e=>e.id===f.value)||null),xe=H(()=>Object.entries(p).map(([e,t])=>({label:t.label,value:e}))),Se=H(()=>p[N.value]?.theme.background??"#1a1a2e");function Ae(){const e=et(),t=tt(),n=t?t.startsWith("https")?"wss:":"ws:":location.protocol==="https:"?"wss:":"ws:";return t?`${n}//${new URL(t).host}/api/hermes/terminal${e?`?token=${encodeURIComponent(e)}`:""}`:`${n}//${location.host}/api/hermes/terminal${e?`?token=${encodeURIComponent(e)}`:""}`}function U(){if(D>=pe){y.value=a("terminal.connectionFailed"),$.value=!1;return}const e=Ae();y.value=null,$.value=!0,D++,o=new WebSocket(e),o.onopen=()=>{$.value=!1,y.value=null},o.onmessage=t=>{const n=typeof t.data=="string"?t.data:"";if(n.charCodeAt(0)===123)try{$e(JSON.parse(n))}catch{}else h?.write(n)},o.onclose=t=>{if($.value=!1,t.code===1e3||t.code===1003||t.code===1008){y.value=a("terminal.connectionClosed");return}setTimeout(U,3e3)},o.onerror=t=>{console.error("[Terminal] WebSocket error:",t),y.value=a("terminal.connectionError")}}function O(e){!o||o.readyState!==WebSocket.OPEN||o.send(typeof e=="string"?e:JSON.stringify(e))}function $e(e){switch(e.type){case"created":D=0,u.value.push({id:e.id,shell:e.shell,pid:e.pid,title:`${e.shell} #${u.value.length+1}`,createdAt:Date.now(),exited:!1}),Y(e.id),Be();break;case"exited":{const t=u.value.find(n=>n.id===e.id);t&&(t.exited=!0,f.value===e.id&&h?.write(`\r
2
2
  \x1B[90m[${a("terminal.processExited",{code:e.exitCode})}]\x1B[0m\r
3
3
  `));break}case"error":_.error(e.message);break}}function W(){O({type:"create"})}function Be(){const e=g.initialCommand?.trim();!e||K.value||(K.value=!0,j(`${e}\r`,0,100))}function j(e,t,n){const k=setTimeout(()=>{if(P.delete(k),!o||o.readyState!==WebSocket.OPEN)return;const M=Math.min(t+ye,e.length);O({type:"input",data:e.slice(t,M)}),M<e.length&&j(e,M,ke)},n);P.add(k)}function Ee(e){let t=v.get(e);if(!t){const n=new rt({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',theme:{...p[N.value].theme}}),k=new it;n.loadAddon(k),n.loadAddon(new ot),n.onData(M=>{o?.readyState===WebSocket.OPEN&&o.send(M)}),t={term:n,fitAddon:k,opened:!1},v.set(e,t)}return t}function Y(e){if(f.value===e)return;f.value=e;const t=Ee(e);h=t.term,E=t.fitAddon,Me(),O({type:"switch",sessionId:e})}function Oe(e){O({type:"close",sessionId:e}),u.value=u.value.filter(n=>n.id!==e);const t=v.get(e);t&&(t.term.dispose(),v.delete(e)),f.value===e&&(f.value=u.value.length>0?u.value[0].id:null,h=null,E=null,f.value?Y(f.value):(Q(),W()))}function Me(){if(!T.value)return;const e=T.value;for(;e.firstChild;)e.removeChild(e.firstChild);const t=v.get(f.value);if(t){if(!t.opened)t.term.open(e),t.opened=!0;else{const n=t.term.element;n&&e.appendChild(n)}z?.disconnect(),z=new ResizeObserver(()=>{F(),Ne()}),z.observe(T.value),setTimeout(()=>F(),50),setTimeout(()=>F(),200)}}function Q(){if(!T.value)return;const e=T.value;for(;e.firstChild;)e.removeChild(e.firstChild)}function F(){if(E)try{E.fit()}catch{}}function Ne(){if(!(!h||!o||o.readyState!==WebSocket.OPEN))try{O({type:"resize",cols:h.cols,rows:h.rows})}catch{}}function Pe(e){if(e.touches.length!==1){x=null,S=0;return}x=e.touches[0].clientY,S=0}function Ie(e){if(!h||e.touches.length!==1||x===null)return;const t=e.touches[0].clientY;S+=x-t,x=t;const n=Math.trunc(S/V);n!==0&&(h.scrollLines(n),S-=n*V,e.preventDefault())}function X(){x=null,S=0}function Re(e){N.value=e,localStorage.setItem(J,e);const t=p[e]?.theme;if(t)for(const n of v.values())n.term.options.theme={...t}}function Le(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}let Z=!1;return De(()=>g.visible,e=>{e&&!Z&&!o&&(Z=!0,U())},{immediate:!0}),je(()=>{for(const e of P)clearTimeout(e);P.clear(),Q();for(const e of v.values())e.term.dispose();v.clear(),h=null,E=null,o?.close(),o=null}),(e,t)=>(c(),d("div",te,[B.value?(c(),d("div",{key:0,class:"sidebar-overlay",onClick:t[0]||(t[0]=n=>B.value=!1)})):R("",!0),i("div",{class:ee(["terminal-sidebar",{"mobile-visible":B.value}])},[i("div",ne,[i("span",ie,s(r(a)("terminal.sessions")),1),A(r(Ve),{trigger:"hover"},{trigger:m(()=>[A(r(I),{quaternary:"",size:"tiny",onClick:W,circle:""},{icon:m(()=>[...t[3]||(t[3]=[i("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),i("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)])]),_:1})]),default:m(()=>[w(" "+s(r(a)("terminal.newTab")),1)]),_:1})]),i("div",ae,[y.value?(c(),d("div",oe,[t[4]||(t[4]=i("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i("circle",{cx:"12",cy:"12",r:"10"}),i("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),i("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})],-1)),i("span",null,s(y.value),1),A(r(I),{size:"tiny",onClick:U},{default:m(()=>[w(s(r(a)("common.retry")),1)]),_:1})])):u.value.length===0?(c(),d("div",re,[$.value?(c(),d(G,{key:0},[w(s(r(a)("common.loading")),1)],64)):(c(),d(G,{key:1},[w(s(r(a)("terminal.noSessions")),1)],64))])):R("",!0),(c(!0),d(G,null,ze(u.value,n=>(c(),d("button",{key:n.id,class:ee(["session-item",{active:n.id===f.value,exited:n.exited}]),onClick:k=>Y(n.id)},[i("div",le,[i("span",ce,s(n.title),1),i("span",ue,[i("span",de,s(n.shell),1),n.exited?(c(),d("span",fe,s(r(a)("terminal.sessionExited")),1)):(c(),d("span",he,s(Le(n.createdAt)),1))])]),u.value.length>1?(c(),Ge(r(qe),{key:0,onPositiveClick:k=>Oe(n.id)},{trigger:m(()=>[i("button",{class:"session-item-delete",onClick:t[1]||(t[1]=Ue(()=>{},["stop"]))},[...t[5]||(t[5]=[i("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),default:m(()=>[w(" "+s(r(a)("terminal.closeSession")),1)]),_:1},8,["onPositiveClick"])):R("",!0)],10,se))),128))])],2),i("div",me,[i("header",ge,[q.value?(c(),d("span",_e,s(q.value.title),1)):R("",!0),i("div",ve,[A(r(I),{size:"small",onClick:t[2]||(t[2]=n=>B.value=!B.value),class:"sidebar-toggle"},{icon:m(()=>[...t[6]||(t[6]=[i("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),i("line",{x1:"9",y1:"3",x2:"9",y2:"21"})],-1)])]),default:m(()=>[w(" "+s(r(a)("terminal.sessions")),1)]),_:1}),A(r(He),{value:N.value,options:xe.value,size:"small","consistent-menu-width":!1,class:"theme-select","onUpdate:value":Re},null,8,["value","options"]),A(r(I),{size:"small",onClick:W},{icon:m(()=>[...t[7]||(t[7]=[i("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),i("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)])]),default:m(()=>[w(" "+s(r(a)("terminal.newTab")),1)]),_:1})])]),i("div",be,[i("div",{ref_key:"terminalRef",ref:T,class:"terminal-xterm",style:Je({backgroundColor:Se.value}),onTouchstart:Pe,onTouchmove:Ie,onTouchend:X,onTouchcancel:X},null,36)])])]))}})})),ut=L((()=>{})),dt,Pt=L((()=>{we(),we(),ut(),Ze(),dt=nt(Te,[["__scopeId","data-v-a51aa2d6"]])}));export{Nt as a,Ot as c,St as i,Bt as l,Pt as n,At as o,$t as r,Mt as s,dt as t,Et as u};
@@ -1,3 +1,3 @@
1
- import{n as M}from"./rolldown-runtime-M0oDzQ_3.js";import{$t as xe,Cn as Te,Dn as Se,Ot as E,Pn as h,Qn as i,Qt as Me,Tn as f,V as Ae,Wn as w,Wt as Re,an as p,dn as We,er as L,in as Ye,ln as $,mt as Ge,nn as O,nr as Ee,on as b,ot as Le,rn as r,rr as d,t as $e,un as B,w as Oe,wn as ze}from"./ui-vendor-dYn1tJGA.js";import{c as Ve,l as De}from"./vue-vendor-DZ4A_GHn.js";import{n as Ne,o as Ie,s as Pe,t as Ue,u as He}from"./_plugin-vue_export-helper-BYiIU0Pd.js";import{a as Fe,i as Je,n as Qe,o as je,r as qe,s as Ke,t as Xe}from"./xterm-CraVE7U3.js";var U,H,F,J,Q,j,q,K,X,Z,ee,te,ae,re,ne,ie,le,oe,ce,z,V,fe,se=M((()=>{Re(),Ke(),Je(),qe(),Xe(),He(),$e(),Ve(),U={class:"terminal-panel"},H={class:"session-list-header"},F={key:0,class:"session-list-title"},J={class:"session-list-actions"},Q={key:0,class:"session-items"},j={key:0,class:"session-empty"},q=["onClick"],K={class:"session-item-content"},X={class:"session-item-title"},Z={class:"session-item-meta"},ee={class:"session-item-shell"},te={key:0,class:"session-item-status"},ae={key:1,class:"session-item-time"},re={class:"terminal-main"},ne={class:"terminal-header"},ie={class:"header-left"},le={key:0,class:"header-session-title"},oe={class:"header-actions"},ce={class:"terminal-container"},z="hermes_terminal_theme",V=18,fe=We({__name:"TerminalView",setup(rt){const{t:g}=De(),de=Ae(),C={default:{label:"Default",theme:{background:"#1a1a2e",foreground:"#e0e0e0",cursor:"#4cc9f0",cursorAccent:"#1a1a2e",selectionBackground:"rgba(76, 201, 240, 0.3)",black:"#000000",red:"#e06c75",green:"#98c379",yellow:"#e5c07b",blue:"#61afef",magenta:"#c678dd",cyan:"#56b6c2",white:"#abb2bf",brightBlack:"#5c6370",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"}},"solarized-dark":{label:"Solarized Dark",theme:{background:"#002b36",foreground:"#839496",cursor:"#93a1a1",cursorAccent:"#002b36",selectionBackground:"rgba(147, 161, 161, 0.3)",black:"#073642",red:"#dc322f",green:"#859900",yellow:"#b58900",blue:"#268bd2",magenta:"#d33682",cyan:"#2aa198",white:"#eee8d5",brightBlack:"#002b36",brightRed:"#cb4b16",brightGreen:"#586e75",brightYellow:"#657b83",brightBlue:"#839496",brightMagenta:"#6c71c4",brightCyan:"#93a1a1",brightWhite:"#fdf6e3"}},"solarized-light":{label:"Solarized Light",theme:{background:"#fdf6e3",foreground:"#657b83",cursor:"#586e75",cursorAccent:"#fdf6e3",selectionBackground:"rgba(88, 110, 117, 0.3)",black:"#073642",red:"#dc322f",green:"#859900",yellow:"#b58900",blue:"#268bd2",magenta:"#d33682",cyan:"#2aa198",white:"#eee8d5",brightBlack:"#002b36",brightRed:"#cb4b16",brightGreen:"#586e75",brightYellow:"#657b83",brightBlue:"#839496",brightMagenta:"#6c71c4",brightCyan:"#93a1a1",brightWhite:"#fdf6e3"}},monokai:{label:"Monokai",theme:{background:"#272822",foreground:"#f8f8f2",cursor:"#f8f8f0",cursorAccent:"#272822",selectionBackground:"rgba(248, 248, 242, 0.2)",black:"#272822",red:"#f92672",green:"#a6e22e",yellow:"#f4bf75",blue:"#66d9ef",magenta:"#ae81ff",cyan:"#a1efe4",white:"#f8f8f2",brightBlack:"#75715e",brightRed:"#fd971f",brightGreen:"#a6e22e",brightYellow:"#e6db74",brightBlue:"#66d9ef",brightMagenta:"#ae81ff",brightCyan:"#a1efe4",brightWhite:"#f9f8f5"}},dracula:{label:"Dracula",theme:{background:"#282a36",foreground:"#f8f8f2",cursor:"#f8f8f2",cursorAccent:"#282a36",selectionBackground:"rgba(248, 248, 242, 0.2)",black:"#21222c",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#bd93f9",magenta:"#ff79c6",cyan:"#8be9fd",white:"#f8f8f2",brightBlack:"#6272a4",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#ffffff"}},nord:{label:"Nord",theme:{background:"#2e3440",foreground:"#d8dee9",cursor:"#d8dee9",cursorAccent:"#2e3440",selectionBackground:"rgba(216, 222, 233, 0.2)",black:"#3b4252",red:"#bf616a",green:"#a3be8c",yellow:"#ebcb8b",blue:"#81a1c1",magenta:"#b48ead",cyan:"#88c0d0",white:"#e5e9f0",brightBlack:"#4c566a",brightRed:"#bf616a",brightGreen:"#a3be8c",brightYellow:"#ebcb8b",brightBlue:"#81a1c1",brightMagenta:"#b48ead",brightCyan:"#8fbcbb",brightWhite:"#eceff4"}},"one-dark":{label:"One Dark",theme:{background:"#282c34",foreground:"#abb2bf",cursor:"#528bff",cursorAccent:"#282c34",selectionBackground:"rgba(82, 139, 255, 0.25)",black:"#282c34",red:"#e06c75",green:"#98c379",yellow:"#e5c07b",blue:"#61afef",magenta:"#c678dd",cyan:"#56b6c2",white:"#abb2bf",brightBlack:"#5c6370",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"}},"github-dark":{label:"GitHub Dark",theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#58a6ff",cursorAccent:"#0d1117",selectionBackground:"rgba(88, 166, 255, 0.25)",black:"#484f58",red:"#ff7b72",green:"#7ee787",yellow:"#ffa657",blue:"#79c0ff",magenta:"#d2a8ff",cyan:"#a5d6ff",white:"#c9d1d9",brightBlack:"#6e7681",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#58a6ff",brightMagenta:"#bc8cff",brightCyan:"#79c0ff",brightWhite:"#f0f6fc"}},"tokyo-night":{label:"Tokyo Night",theme:{background:"#1a1b26",foreground:"#a9b1d6",cursor:"#c0caf5",cursorAccent:"#1a1b26",selectionBackground:"rgba(192, 202, 245, 0.2)",black:"#15161e",red:"#f7768e",green:"#9ece6a",yellow:"#e0af68",blue:"#7aa2f7",magenta:"#bb9af7",cyan:"#7dcfff",white:"#a9b1d6",brightBlack:"#414868",brightRed:"#f7768e",brightGreen:"#9ece6a",brightYellow:"#e0af68",brightBlue:"#7aa2f7",brightMagenta:"#bb9af7",brightCyan:"#7dcfff",brightWhite:"#c0caf5"}},"github-light":{label:"GitHub Light",theme:{background:"#ffffff",foreground:"#24292f",cursor:"#0969da",cursorAccent:"#ffffff",selectionBackground:"rgba(9, 105, 218, 0.2)",black:"#24292f",red:"#cf222e",green:"#116329",yellow:"#4d2d00",blue:"#0969da",magenta:"#8250df",cyan:"#1b7c83",white:"#57606a",brightBlack:"#57606a",brightRed:"#a40e26",brightGreen:"#1a7f37",brightYellow:"#633c01",brightBlue:"#218bff",brightMagenta:"#a475f4",brightCyan:"#3192aa",brightWhite:"#8c959f"}},"catppuccin-latte":{label:"Catppuccin Latte",theme:{background:"#eff1f5",foreground:"#4c4f69",cursor:"#dc8a78",cursorAccent:"#eff1f5",selectionBackground:"rgba(220, 138, 120, 0.2)",black:"#5c5f77",red:"#d20f39",green:"#40a02b",yellow:"#df8e1d",blue:"#1e66f5",magenta:"#ea76cb",cyan:"#179299",white:"#4c4f69",brightBlack:"#6c6f85",brightRed:"#d20f39",brightGreen:"#40a02b",brightYellow:"#df8e1d",brightBlue:"#1e66f5",brightMagenta:"#ea76cb",brightCyan:"#179299",brightWhite:"#bcc0cc"}},"alabaster-light":{label:"Alabaster",theme:{background:"#f7f7f7",foreground:"#434343",cursor:"#528bff",cursorAccent:"#f7f7f7",selectionBackground:"rgba(82, 139, 255, 0.2)",black:"#000000",red:"#aa3731",green:"#448c27",yellow:"#cb9000",blue:"#325cc0",magenta:"#7a3e9d",cyan:"#0083b2",white:"#434343",brightBlack:"#777777",brightRed:"#f05050",brightGreen:"#60cb00",brightYellow:"#ffbc5d",brightBlue:"#0070ea",brightMagenta:"#ca64e2",brightCyan:"#00aacb",brightWhite:"#999999"}},"xterm-light":{label:"XTerm Light",theme:{background:"#fafafa",foreground:"#383a42",cursor:"#526fff",cursorAccent:"#fafafa",selectionBackground:"rgba(82, 111, 255, 0.2)",black:"#383a42",red:"#e45649",green:"#50a14f",yellow:"#c18401",blue:"#4078f2",magenta:"#a626a4",cyan:"#0184bc",white:"#a0a1a7",brightBlack:"#4f525e",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"}},"one-light":{label:"One Light",theme:{background:"#fafafa",foreground:"#383a42",cursor:"#526eff",cursorAccent:"#fafafa",selectionBackground:"rgba(82, 110, 255, 0.2)",black:"#383a42",red:"#e45649",green:"#50a14f",yellow:"#c18401",blue:"#4078f2",magenta:"#a626a4",cyan:"#0184bc",white:"#a0a1a7",brightBlack:"#4f525e",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"}},"gruvbox-light":{label:"Gruvbox Light",theme:{background:"#fbf1c7",foreground:"#3c3836",cursor:"#9d0006",cursorAccent:"#fbf1c7",selectionBackground:"rgba(157, 0, 6, 0.15)",black:"#fbf1c7",red:"#cc241d",green:"#98971a",yellow:"#d79921",blue:"#458588",magenta:"#b16286",cyan:"#689d6a",white:"#504945",brightBlack:"#928374",brightRed:"#9d0006",brightGreen:"#79740e",brightYellow:"#b57614",brightBlue:"#076678",brightMagenta:"#8f3f71",brightCyan:"#427b58",brightWhite:"#3c3836"}}},m=w(null),o=w(!0),l=w([]),c=w(null),x=w(localStorage.getItem(z)||"default");let n=null;const u=new Map;let s=null,v=null,A=null,y=null,_=null,k=0;const D=O(()=>l.value.find(e=>e.id===c.value)||null),be=O(()=>Object.entries(C).map(([e,t])=>({label:t.label,value:e}))),ue=O(()=>C[x.value]?.theme.background??"#1a1a2e");function he(){const e=Ie(),t=Pe(),a=t?t.startsWith("https")?"wss:":"ws:":location.protocol==="https:"?"wss:":"ws:";return t?`${a}//${new URL(t).host}/api/hermes/terminal${e?`?token=${encodeURIComponent(e)}`:""}`:`${a}//${location.host}/api/hermes/terminal${e?`?token=${encodeURIComponent(e)}`:""}`}function N(){const e=he();n=new WebSocket(e),n.onopen=()=>{},n.onmessage=t=>{const a=typeof t.data=="string"?t.data:"";if(a.charCodeAt(0)===123)try{ge(JSON.parse(a))}catch{}else s?.write(a)},n.onopen=()=>{},n.onclose=()=>{setTimeout(N,3e3)},n.onerror=()=>{}}function T(e){!n||n.readyState!==WebSocket.OPEN||n.send(typeof e=="string"?e:JSON.stringify(e))}function ge(e){switch(e.type){case"created":l.value.push({id:e.id,shell:e.shell,pid:e.pid,title:`${e.shell} #${l.value.length+1}`,createdAt:Date.now(),exited:!1}),W(e.id);break;case"switched":break;case"exited":{const t=l.value.find(a=>a.id===e.id);t&&(t.exited=!0,c.value===e.id&&s?.write(`\r
1
+ import{n as M}from"./rolldown-runtime-M0oDzQ_3.js";import{$t as xe,Cn as Te,Dn as Se,Ot as E,Pn as h,Qn as i,Qt as Me,Tn as f,V as Ae,Wn as w,Wt as Re,an as p,dn as We,er as L,in as Ye,ln as $,mt as Ge,nn as O,nr as Ee,on as b,ot as Le,rn as r,rr as d,t as $e,un as B,w as Oe,wn as ze}from"./ui-vendor-dYn1tJGA.js";import{c as Ve,l as De}from"./vue-vendor-DZ4A_GHn.js";import{n as Ne,o as Ie,s as Pe,t as Ue,u as He}from"./_plugin-vue_export-helper-BIeGRfrQ.js";import{a as Fe,i as Je,n as Qe,o as je,r as qe,s as Ke,t as Xe}from"./xterm-CraVE7U3.js";var U,H,F,J,Q,j,q,K,X,Z,ee,te,ae,re,ne,ie,le,oe,ce,z,V,fe,se=M((()=>{Re(),Ke(),Je(),qe(),Xe(),He(),$e(),Ve(),U={class:"terminal-panel"},H={class:"session-list-header"},F={key:0,class:"session-list-title"},J={class:"session-list-actions"},Q={key:0,class:"session-items"},j={key:0,class:"session-empty"},q=["onClick"],K={class:"session-item-content"},X={class:"session-item-title"},Z={class:"session-item-meta"},ee={class:"session-item-shell"},te={key:0,class:"session-item-status"},ae={key:1,class:"session-item-time"},re={class:"terminal-main"},ne={class:"terminal-header"},ie={class:"header-left"},le={key:0,class:"header-session-title"},oe={class:"header-actions"},ce={class:"terminal-container"},z="hermes_terminal_theme",V=18,fe=We({__name:"TerminalView",setup(rt){const{t:g}=De(),de=Ae(),C={default:{label:"Default",theme:{background:"#1a1a2e",foreground:"#e0e0e0",cursor:"#4cc9f0",cursorAccent:"#1a1a2e",selectionBackground:"rgba(76, 201, 240, 0.3)",black:"#000000",red:"#e06c75",green:"#98c379",yellow:"#e5c07b",blue:"#61afef",magenta:"#c678dd",cyan:"#56b6c2",white:"#abb2bf",brightBlack:"#5c6370",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"}},"solarized-dark":{label:"Solarized Dark",theme:{background:"#002b36",foreground:"#839496",cursor:"#93a1a1",cursorAccent:"#002b36",selectionBackground:"rgba(147, 161, 161, 0.3)",black:"#073642",red:"#dc322f",green:"#859900",yellow:"#b58900",blue:"#268bd2",magenta:"#d33682",cyan:"#2aa198",white:"#eee8d5",brightBlack:"#002b36",brightRed:"#cb4b16",brightGreen:"#586e75",brightYellow:"#657b83",brightBlue:"#839496",brightMagenta:"#6c71c4",brightCyan:"#93a1a1",brightWhite:"#fdf6e3"}},"solarized-light":{label:"Solarized Light",theme:{background:"#fdf6e3",foreground:"#657b83",cursor:"#586e75",cursorAccent:"#fdf6e3",selectionBackground:"rgba(88, 110, 117, 0.3)",black:"#073642",red:"#dc322f",green:"#859900",yellow:"#b58900",blue:"#268bd2",magenta:"#d33682",cyan:"#2aa198",white:"#eee8d5",brightBlack:"#002b36",brightRed:"#cb4b16",brightGreen:"#586e75",brightYellow:"#657b83",brightBlue:"#839496",brightMagenta:"#6c71c4",brightCyan:"#93a1a1",brightWhite:"#fdf6e3"}},monokai:{label:"Monokai",theme:{background:"#272822",foreground:"#f8f8f2",cursor:"#f8f8f0",cursorAccent:"#272822",selectionBackground:"rgba(248, 248, 242, 0.2)",black:"#272822",red:"#f92672",green:"#a6e22e",yellow:"#f4bf75",blue:"#66d9ef",magenta:"#ae81ff",cyan:"#a1efe4",white:"#f8f8f2",brightBlack:"#75715e",brightRed:"#fd971f",brightGreen:"#a6e22e",brightYellow:"#e6db74",brightBlue:"#66d9ef",brightMagenta:"#ae81ff",brightCyan:"#a1efe4",brightWhite:"#f9f8f5"}},dracula:{label:"Dracula",theme:{background:"#282a36",foreground:"#f8f8f2",cursor:"#f8f8f2",cursorAccent:"#282a36",selectionBackground:"rgba(248, 248, 242, 0.2)",black:"#21222c",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#bd93f9",magenta:"#ff79c6",cyan:"#8be9fd",white:"#f8f8f2",brightBlack:"#6272a4",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#ffffff"}},nord:{label:"Nord",theme:{background:"#2e3440",foreground:"#d8dee9",cursor:"#d8dee9",cursorAccent:"#2e3440",selectionBackground:"rgba(216, 222, 233, 0.2)",black:"#3b4252",red:"#bf616a",green:"#a3be8c",yellow:"#ebcb8b",blue:"#81a1c1",magenta:"#b48ead",cyan:"#88c0d0",white:"#e5e9f0",brightBlack:"#4c566a",brightRed:"#bf616a",brightGreen:"#a3be8c",brightYellow:"#ebcb8b",brightBlue:"#81a1c1",brightMagenta:"#b48ead",brightCyan:"#8fbcbb",brightWhite:"#eceff4"}},"one-dark":{label:"One Dark",theme:{background:"#282c34",foreground:"#abb2bf",cursor:"#528bff",cursorAccent:"#282c34",selectionBackground:"rgba(82, 139, 255, 0.25)",black:"#282c34",red:"#e06c75",green:"#98c379",yellow:"#e5c07b",blue:"#61afef",magenta:"#c678dd",cyan:"#56b6c2",white:"#abb2bf",brightBlack:"#5c6370",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"}},"github-dark":{label:"GitHub Dark",theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#58a6ff",cursorAccent:"#0d1117",selectionBackground:"rgba(88, 166, 255, 0.25)",black:"#484f58",red:"#ff7b72",green:"#7ee787",yellow:"#ffa657",blue:"#79c0ff",magenta:"#d2a8ff",cyan:"#a5d6ff",white:"#c9d1d9",brightBlack:"#6e7681",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#58a6ff",brightMagenta:"#bc8cff",brightCyan:"#79c0ff",brightWhite:"#f0f6fc"}},"tokyo-night":{label:"Tokyo Night",theme:{background:"#1a1b26",foreground:"#a9b1d6",cursor:"#c0caf5",cursorAccent:"#1a1b26",selectionBackground:"rgba(192, 202, 245, 0.2)",black:"#15161e",red:"#f7768e",green:"#9ece6a",yellow:"#e0af68",blue:"#7aa2f7",magenta:"#bb9af7",cyan:"#7dcfff",white:"#a9b1d6",brightBlack:"#414868",brightRed:"#f7768e",brightGreen:"#9ece6a",brightYellow:"#e0af68",brightBlue:"#7aa2f7",brightMagenta:"#bb9af7",brightCyan:"#7dcfff",brightWhite:"#c0caf5"}},"github-light":{label:"GitHub Light",theme:{background:"#ffffff",foreground:"#24292f",cursor:"#0969da",cursorAccent:"#ffffff",selectionBackground:"rgba(9, 105, 218, 0.2)",black:"#24292f",red:"#cf222e",green:"#116329",yellow:"#4d2d00",blue:"#0969da",magenta:"#8250df",cyan:"#1b7c83",white:"#57606a",brightBlack:"#57606a",brightRed:"#a40e26",brightGreen:"#1a7f37",brightYellow:"#633c01",brightBlue:"#218bff",brightMagenta:"#a475f4",brightCyan:"#3192aa",brightWhite:"#8c959f"}},"catppuccin-latte":{label:"Catppuccin Latte",theme:{background:"#eff1f5",foreground:"#4c4f69",cursor:"#dc8a78",cursorAccent:"#eff1f5",selectionBackground:"rgba(220, 138, 120, 0.2)",black:"#5c5f77",red:"#d20f39",green:"#40a02b",yellow:"#df8e1d",blue:"#1e66f5",magenta:"#ea76cb",cyan:"#179299",white:"#4c4f69",brightBlack:"#6c6f85",brightRed:"#d20f39",brightGreen:"#40a02b",brightYellow:"#df8e1d",brightBlue:"#1e66f5",brightMagenta:"#ea76cb",brightCyan:"#179299",brightWhite:"#bcc0cc"}},"alabaster-light":{label:"Alabaster",theme:{background:"#f7f7f7",foreground:"#434343",cursor:"#528bff",cursorAccent:"#f7f7f7",selectionBackground:"rgba(82, 139, 255, 0.2)",black:"#000000",red:"#aa3731",green:"#448c27",yellow:"#cb9000",blue:"#325cc0",magenta:"#7a3e9d",cyan:"#0083b2",white:"#434343",brightBlack:"#777777",brightRed:"#f05050",brightGreen:"#60cb00",brightYellow:"#ffbc5d",brightBlue:"#0070ea",brightMagenta:"#ca64e2",brightCyan:"#00aacb",brightWhite:"#999999"}},"xterm-light":{label:"XTerm Light",theme:{background:"#fafafa",foreground:"#383a42",cursor:"#526fff",cursorAccent:"#fafafa",selectionBackground:"rgba(82, 111, 255, 0.2)",black:"#383a42",red:"#e45649",green:"#50a14f",yellow:"#c18401",blue:"#4078f2",magenta:"#a626a4",cyan:"#0184bc",white:"#a0a1a7",brightBlack:"#4f525e",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"}},"one-light":{label:"One Light",theme:{background:"#fafafa",foreground:"#383a42",cursor:"#526eff",cursorAccent:"#fafafa",selectionBackground:"rgba(82, 110, 255, 0.2)",black:"#383a42",red:"#e45649",green:"#50a14f",yellow:"#c18401",blue:"#4078f2",magenta:"#a626a4",cyan:"#0184bc",white:"#a0a1a7",brightBlack:"#4f525e",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"}},"gruvbox-light":{label:"Gruvbox Light",theme:{background:"#fbf1c7",foreground:"#3c3836",cursor:"#9d0006",cursorAccent:"#fbf1c7",selectionBackground:"rgba(157, 0, 6, 0.15)",black:"#fbf1c7",red:"#cc241d",green:"#98971a",yellow:"#d79921",blue:"#458588",magenta:"#b16286",cyan:"#689d6a",white:"#504945",brightBlack:"#928374",brightRed:"#9d0006",brightGreen:"#79740e",brightYellow:"#b57614",brightBlue:"#076678",brightMagenta:"#8f3f71",brightCyan:"#427b58",brightWhite:"#3c3836"}}},m=w(null),o=w(!0),l=w([]),c=w(null),x=w(localStorage.getItem(z)||"default");let n=null;const u=new Map;let s=null,v=null,A=null,y=null,_=null,k=0;const D=O(()=>l.value.find(e=>e.id===c.value)||null),be=O(()=>Object.entries(C).map(([e,t])=>({label:t.label,value:e}))),ue=O(()=>C[x.value]?.theme.background??"#1a1a2e");function he(){const e=Ie(),t=Pe(),a=t?t.startsWith("https")?"wss:":"ws:":location.protocol==="https:"?"wss:":"ws:";return t?`${a}//${new URL(t).host}/api/hermes/terminal${e?`?token=${encodeURIComponent(e)}`:""}`:`${a}//${location.host}/api/hermes/terminal${e?`?token=${encodeURIComponent(e)}`:""}`}function N(){const e=he();n=new WebSocket(e),n.onopen=()=>{},n.onmessage=t=>{const a=typeof t.data=="string"?t.data:"";if(a.charCodeAt(0)===123)try{ge(JSON.parse(a))}catch{}else s?.write(a)},n.onopen=()=>{},n.onclose=()=>{setTimeout(N,3e3)},n.onerror=()=>{}}function T(e){!n||n.readyState!==WebSocket.OPEN||n.send(typeof e=="string"?e:JSON.stringify(e))}function ge(e){switch(e.type){case"created":l.value.push({id:e.id,shell:e.shell,pid:e.pid,title:`${e.shell} #${l.value.length+1}`,createdAt:Date.now(),exited:!1}),W(e.id);break;case"switched":break;case"exited":{const t=l.value.find(a=>a.id===e.id);t&&(t.exited=!0,c.value===e.id&&s?.write(`\r
2
2
  \x1B[90m[${g("terminal.processExited",{code:e.exitCode})}]\x1B[0m\r
3
3
  `));break}case"error":de.error(e.message);break}}function R(){T({type:"create"})}function me(e){let t=u.get(e);if(!t){const a=new je({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',theme:{...C[x.value].theme}}),S=new Fe;a.loadAddon(S),a.loadAddon(new Qe),a.onData(Ce=>{n?.readyState===WebSocket.OPEN&&n.send(Ce)}),t={term:a,fitAddon:S,opened:!1},u.set(e,t)}return t}function W(e){if(c.value===e)return;c.value=e;const t=me(e);s=t.term,v=t.fitAddon,ke(),T({type:"switch",sessionId:e}),y?.matches&&(o.value=!1)}function _e(e){T({type:"close",sessionId:e}),l.value=l.value.filter(a=>a.id!==e);const t=u.get(e);t&&(t.term.dispose(),u.delete(e)),c.value===e&&(c.value=l.value.length>0?l.value[0].id:null,s=null,v=null,c.value?W(c.value):(I(),R()))}function ke(){if(!m.value)return;const e=m.value;for(;e.firstChild;)e.removeChild(e.firstChild);const t=u.get(c.value);if(t){if(!t.opened)t.term.open(e),t.opened=!0;else{const a=t.term.element;a&&e.appendChild(a)}A?.disconnect(),A=new ResizeObserver(()=>{Y(),ve()}),A.observe(m.value),setTimeout(()=>Y(),50),setTimeout(()=>Y(),200)}}function I(){if(!m.value)return;const e=m.value;for(;e.firstChild;)e.removeChild(e.firstChild)}function Y(){if(v)try{v.fit()}catch{}}function ve(){if(!(!s||!n||n.readyState!==WebSocket.OPEN))try{T({type:"resize",cols:s.cols,rows:s.rows})}catch{}}function ye(e){if(e.touches.length!==1){_=null,k=0;return}_=e.touches[0].clientY,k=0}function we(e){if(!s||e.touches.length!==1||_===null)return;const t=e.touches[0].clientY;k+=_-t,_=t;const a=Math.trunc(k/V);a!==0&&(s.scrollLines(a),k-=a*V,e.preventDefault())}function P(){_=null,k=0}function pe(e){x.value=e,localStorage.setItem(z,e);const t=C[e]?.theme;if(t)for(const a of u.values())a.term.options.theme={...t}}function Be(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function G(e){e.matches&&o.value&&(o.value=!1)}return Te(()=>{y=window.matchMedia("(max-width: 768px)"),G(y),y.addEventListener("change",G),N()}),ze(()=>{y?.removeEventListener("change",G),I();for(const e of u.values())e.term.dispose();u.clear(),s=null,v=null,n?.close(),n=null}),(e,t)=>(f(),b("div",U,[r("div",{class:L(["session-backdrop",{active:o.value}]),onClick:t[0]||(t[0]=a=>o.value=!1)},null,2),r("aside",{class:L(["session-list",{collapsed:!o.value}])},[r("div",H,[o.value?(f(),b("span",F,d(i(g)("terminal.sessions")),1)):p("",!0),r("div",J,[B(i(Le),{trigger:"hover"},{trigger:h(()=>[B(i(E),{quaternary:"",size:"tiny",onClick:R,circle:""},{icon:h(()=>[...t[3]||(t[3]=[r("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[r("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),r("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)])]),_:1})]),default:h(()=>[$(" "+d(i(g)("terminal.newTab")),1)]),_:1})])]),o.value?(f(),b("div",Q,[l.value.length===0?(f(),b("div",j,d(i(g)("common.loading")),1)):p("",!0),(f(!0),b(xe,null,Se(l.value,a=>(f(),b("button",{key:a.id,class:L(["session-item",{active:a.id===c.value,exited:a.exited}]),onClick:S=>W(a.id)},[r("div",K,[r("span",X,d(a.title),1),r("span",Z,[r("span",ee,d(a.shell),1),a.exited?(f(),b("span",te,d(i(g)("terminal.sessionExited")),1)):(f(),b("span",ae,d(Be(a.createdAt)),1))])]),l.value.length>1?(f(),Ye(i(Oe),{key:0,onPositiveClick:S=>_e(a.id)},{trigger:h(()=>[r("button",{class:"session-item-delete",onClick:t[1]||(t[1]=Me(()=>{},["stop"]))},[...t[4]||(t[4]=[r("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[r("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),default:h(()=>[$(" "+d(i(g)("terminal.closeSession")),1)]),_:1},8,["onPositiveClick"])):p("",!0)],10,q))),128))])):p("",!0)],2),r("div",re,[r("header",ne,[r("div",ie,[B(i(E),{quaternary:"",size:"small",onClick:t[2]||(t[2]=a=>o.value=!o.value),circle:""},{icon:h(()=>[...t[5]||(t[5]=[r("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[r("rect",{x:"3",y:"3",width:"7",height:"7"}),r("rect",{x:"14",y:"3",width:"7",height:"7"}),r("rect",{x:"3",y:"14",width:"7",height:"7"}),r("rect",{x:"14",y:"14",width:"7",height:"7"})],-1)])]),_:1}),D.value?(f(),b("span",le,d(D.value.title),1)):p("",!0)]),r("div",oe,[B(i(Ge),{value:x.value,options:be.value,size:"small","consistent-menu-width":!1,class:"theme-select","onUpdate:value":pe},null,8,["value","options"]),B(i(E),{size:"small",onClick:R},{icon:h(()=>[...t[6]||(t[6]=[r("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[r("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),r("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)])]),default:h(()=>[$(" "+d(i(g)("terminal.newTab")),1)]),_:1})])]),r("div",ce,[r("div",{ref_key:"terminalRef",ref:m,class:"terminal-xterm",style:Ee({backgroundColor:ue.value}),onTouchstart:ye,onTouchmove:we,onTouchend:P,onTouchcancel:P},null,36)])])]))}})})),Ze=M((()=>{})),et=M((()=>{})),tt,at=M((()=>{se(),se(),Ze(),et(),Ne(),tt=Ue(fe,[["__scopeId","data-v-33848db6"]])}));at();export{tt as default};
@@ -1 +1 @@
1
- import{n as y}from"./rolldown-runtime-M0oDzQ_3.js";import{$t as S,Cn as st,Dn as M,Ot as q,Pn as z,Qn as s,Tn as c,Wn as I,Wt as C,an as b,dn as R,ln as T,nn as k,nr as m,on as p,rn as e,rr as t,t as at,un as x}from"./ui-vendor-dYn1tJGA.js";import{_ as nt,c as D,g as ot,l as F}from"./vue-vendor-DZ4A_GHn.js";import{n as B,t as H}from"./_plugin-vue_export-helper-BYiIU0Pd.js";import{H as lt,W as it,X as ut,Y as rt}from"./index-j9YvpyYe.js";function Xe(_){return(_||"").trim()||"unknown"}function w(_,a){return a<=0?0:_/a*100}function N(_){const a=Xe(_);let n=0;for(let d=0;d<a.length;d+=1)n=(n<<5)-n+a.charCodeAt(d),n|=0;return L[Math.abs(n)%L.length]}var L,P,V=y((()=>{it(),nt(),C(),L=["#4fd1c5","#63b3ed","#f6ad55","#b794f4","#68d391","#fc8181","#f687b3","#90cdf4","#fbd38d","#9ae6b4"],P=ot("usage",()=>{const _=I(null),a=I(!1);let n=0;async function d(u=30){const v=++n;a.value=!0;try{const $=await lt(u);v===n&&(_.value=$)}catch($){v===n&&console.error("Failed to load usage stats:",$)}finally{v===n&&(a.value=!1)}}const g=k(()=>!!_.value&&_.value.total_sessions>0),r=k(()=>_.value?.total_input_tokens??0),h=k(()=>_.value?.total_output_tokens??0),i=k(()=>r.value+h.value),o=k(()=>_.value?.total_sessions??0),l=k(()=>_.value?.total_cache_read_tokens??0),f=k(()=>{const u=r.value+l.value;return u===0?null:l.value/u*100}),O=k(()=>_.value?.total_cost??0),W=k(()=>_.value?_.value.model_usage.map(u=>{const v=Xe(u.model),$=u.input_tokens+u.output_tokens,U=$+u.cache_read_tokens;return{model:v,inputTokens:u.input_tokens,outputTokens:u.output_tokens,cacheTokens:u.cache_read_tokens,cacheWriteTokens:u.cache_write_tokens,totalTokens:$,visualTokens:U,sessions:u.sessions,color:N(v),inputPercent:w(u.input_tokens,U),outputPercent:w(u.output_tokens,U),cachePercent:w(u.cache_read_tokens,U)}}).sort((u,v)=>v.visualTokens-u.visualTokens):[]);return{stats:_,isLoading:a,hasData:g,loadSessions:d,totalInputTokens:r,totalOutputTokens:h,totalTokens:i,totalSessions:o,totalCacheTokens:l,cacheHitRate:f,estimatedCost:O,modelUsage:W,modelLegend:k(()=>{const u=new Set;return W.value.filter(v=>u.has(v.model)?!1:(u.add(v.model),!0)).map(v=>({model:v.model,color:v.color}))}),dailyUsage:k(()=>(_.value?.daily_usage??[]).map(u=>{const v=u.input_tokens+u.output_tokens+u.cache_read_tokens;return{...u,visualTokens:v,inputPercent:w(u.input_tokens,v),outputPercent:w(u.output_tokens,v),cachePercent:w(u.cache_read_tokens,v)}})),avgSessionsPerDay:k(()=>{if(!_.value||_.value.daily_usage.length===0)return 0;const u=_.value.daily_usage.filter($=>$.sessions>0).length,v=Math.max(1,u);return o.value/v}),getModelColor:N}})})),K,A,E,Q,X,Y,j,G,J,Z,ee,te,se,ae,ne,oe,Ye,le=y((()=>{C(),D(),V(),K={class:"stat-cards"},A={class:"stat-card"},E={class:"stat-label"},Q={class:"stat-value"},X={class:"stat-sub"},Y={class:"stat-card"},j={class:"stat-label"},G={class:"stat-value"},J={class:"stat-sub"},Z={class:"stat-card"},ee={class:"stat-label"},te={class:"stat-value"},se={class:"stat-card"},ae={class:"stat-label"},ne={class:"stat-value"},oe={key:0,class:"stat-sub"},Ye=R({__name:"StatCards",setup(_){const{t:a}=F(),n=P();function d(r){return r>=1e6?(r/1e6).toFixed(1)+"M":r>=1e3?(r/1e3).toFixed(1)+"K":String(r)}function g(r){return r===0?"$0.00":r<.01?"<$0.01":"$"+r.toFixed(2)}return(r,h)=>(c(),p("div",K,[e("div",A,[e("div",E,t(s(a)("usage.totalTokens")),1),e("div",Q,t(d(s(n).totalTokens)),1),e("div",X,t(d(s(n).totalInputTokens))+" "+t(s(a)("usage.inputTokens"))+" / "+t(d(s(n).totalOutputTokens))+" "+t(s(a)("usage.outputTokens")),1)]),e("div",Y,[e("div",j,t(s(a)("usage.totalSessions")),1),e("div",G,t(s(n).totalSessions),1),e("div",J,t(s(a)("usage.avgPerDay",{n:s(n).avgSessionsPerDay.toFixed(1)})),1)]),e("div",Z,[e("div",ee,t(s(a)("usage.estimatedCost")),1),e("div",te,t(g(s(n).estimatedCost)),1)]),e("div",se,[e("div",ae,t(s(a)("usage.cacheHitRate")),1),e("div",ne,t(s(n).cacheHitRate!==null?s(n).cacheHitRate.toFixed(1)+"%":"--"),1),s(n).cacheHitRate!==null?(c(),p("div",oe,t(d(s(n).totalCacheTokens))+" "+t(s(a)("usage.tokens")),1)):b("",!0)])]))}})})),_t=y((()=>{})),je,dt=y((()=>{le(),le(),_t(),B(),je=H(Ye,[["__scopeId","data-v-3a594781"]])})),ie,ue,re,_e,de,ce,pe,ve,he,ge,ke,Ge,ye=y((()=>{C(),D(),V(),ie={class:"model-breakdown"},ue={class:"section-title"},re={class:"model-legend","aria-label":"Token type legend"},_e={class:"legend-item"},de={class:"legend-item"},ce={class:"legend-item"},pe={class:"model-list"},ve=["title"],he={class:"model-bar-wrap"},ge=["title"],ke={key:0},Ge=R({__name:"ModelBreakdown",setup(_){const{t:a}=F(),n=P(),d=k(()=>Math.max(...n.modelUsage.map(h=>h.visualTokens),1));function g(h){return h>=1e6?(h/1e6).toFixed(1)+"M":h>=1e3?(h/1e3).toFixed(1)+"K":String(h)}function r(h){const i=h.inputTokens+h.cacheTokens;return i===0?"--":(h.cacheTokens/i*100).toFixed(1)+"%"}return(h,i)=>(c(),p("div",ie,[e("h3",ue,t(s(a)("usage.modelBreakdown")),1),e("div",re,[e("div",_e,[i[0]||(i[0]=e("span",{class:"legend-swatch input"},null,-1)),T(t(s(a)("usage.inputTokens")),1)]),e("div",de,[i[1]||(i[1]=e("span",{class:"legend-swatch output"},null,-1)),T(t(s(a)("usage.outputTokens")),1)]),e("div",ce,[i[2]||(i[2]=e("span",{class:"legend-swatch cache"},null,-1)),T(t(s(a)("usage.cacheRead")),1)])]),e("div",pe,[(c(!0),p(S,null,M(s(n).modelUsage,o=>(c(),p("div",{key:o.model,class:"model-row"},[e("span",{class:"model-swatch",style:m({background:o.color})},null,4),e("span",{class:"model-name",title:o.model},t(o.model),9,ve),e("div",he,[e("div",{class:"model-bar",style:m({width:o.visualTokens/d.value*100+"%"})},[o.inputTokens>0?(c(),p("div",{key:0,class:"model-bar-segment input",style:m({width:o.inputPercent+"%"})},null,4)):b("",!0),o.outputTokens>0?(c(),p("div",{key:1,class:"model-bar-segment output",style:m({width:o.outputPercent+"%"})},null,4)):b("",!0),o.cacheTokens>0?(c(),p("div",{key:2,class:"model-bar-segment cache",style:m({width:o.cachePercent+"%"})},null,4)):b("",!0)],4)]),e("span",{class:"model-tokens",title:`${s(a)("usage.inputTokens")}: ${g(o.inputTokens)} · ${s(a)("usage.outputTokens")}: ${g(o.outputTokens)} · ${s(a)("usage.cacheRead")}: ${g(o.cacheTokens)} · ${s(a)("usage.cacheHitRate")}: ${r(o)}`},[T(t(g(o.totalTokens))+" ",1),o.cacheTokens>0?(c(),p("small",ke,"+"+t(g(o.cacheTokens)),1)):b("",!0)],8,ge)]))),128))])]))}})})),ct=y((()=>{})),Je,pt=y((()=>{ye(),ye(),ct(),B(),Je=H(Ge,[["__scopeId","data-v-692258ec"]])})),fe,me,Te,$e,be,we,xe,Se,Ce,Pe,Ue,Me,Re,De,Fe,Be,He,Ve,Ie,Ze,Le=y((()=>{C(),D(),V(),fe={class:"daily-trend"},me={class:"section-title"},Te={class:"bar-chart"},$e={class:"bar-track"},be={class:"bar-tooltip"},we={class:"tooltip-date"},xe={class:"tooltip-row"},Se={class:"tooltip-row"},Ce={class:"tooltip-row"},Pe={class:"tooltip-row"},Ue={class:"tooltip-row"},Me={class:"tooltip-row"},Re={class:"tooltip-row"},De={class:"bar-dates"},Fe={class:"chart-legend","aria-label":"Token type legend"},Be={class:"legend-item"},He={class:"legend-item"},Ve={class:"legend-item"},Ie={class:"trend-table"},Ze=R({__name:"DailyTrend",setup(_){const{t:a}=F(),n=P();function d(i){return i>=1e6?(i/1e6).toFixed(1)+"M":i>=1e3?(i/1e3).toFixed(1)+"K":String(i)}function g(i){return i===0?"$0.00":i<.01?"<$0.01":"$"+i.toFixed(2)}function r(i){const o=i.input_tokens+i.cache_read_tokens;return o===0?"--":(i.cache_read_tokens/o*100).toFixed(1)+"%"}const h=k(()=>Math.max(...n.dailyUsage.map(i=>i.visualTokens),1));return(i,o)=>(c(),p("div",fe,[e("h3",me,t(s(a)("usage.dailyTrend")),1),e("div",Te,[(c(!0),p(S,null,M(s(n).dailyUsage,l=>(c(),p("div",{key:l.date,class:"bar-col"},[e("div",$e,[e("div",{class:"bar-stack",style:m({height:l.visualTokens/h.value*100+"%"})},[l.output_tokens>0?(c(),p("div",{key:0,class:"bar-segment output",style:m({height:l.outputPercent+"%"})},null,4)):b("",!0),l.input_tokens>0?(c(),p("div",{key:1,class:"bar-segment input",style:m({height:l.inputPercent+"%"})},null,4)):b("",!0),l.cache_read_tokens>0?(c(),p("div",{key:2,class:"bar-segment cache",style:m({height:l.cachePercent+"%"})},null,4)):b("",!0)],4)]),e("div",be,[e("div",we,t(l.date),1),e("div",xe,t(s(a)("usage.inputTokens"))+": "+t(d(l.input_tokens)),1),e("div",Se,t(s(a)("usage.outputTokens"))+": "+t(d(l.output_tokens)),1),e("div",Ce,t(s(a)("usage.cacheRead"))+": "+t(d(l.cache_read_tokens)),1),e("div",Pe,t(s(a)("usage.cacheWrite"))+": "+t(d(l.cache_write_tokens)),1),e("div",Ue,t(s(a)("usage.cacheHitRate"))+": "+t(r(l)),1),e("div",Me,t(s(a)("usage.sessions"))+": "+t(l.sessions),1),e("div",Re,t(s(a)("usage.cost"))+": "+t(g(l.cost)),1)])]))),128))]),e("div",De,[e("span",null,t(s(n).dailyUsage[0]?.date.slice(5)),1),e("span",null,t(s(n).dailyUsage[s(n).dailyUsage.length-1]?.date.slice(5)),1)]),e("div",Fe,[e("div",Be,[o[0]||(o[0]=e("span",{class:"legend-swatch input"},null,-1)),T(t(s(a)("usage.inputTokens")),1)]),e("div",He,[o[1]||(o[1]=e("span",{class:"legend-swatch output"},null,-1)),T(t(s(a)("usage.outputTokens")),1)]),e("div",Ve,[o[2]||(o[2]=e("span",{class:"legend-swatch cache"},null,-1)),T(t(s(a)("usage.cacheRead")),1)])]),e("div",Ie,[e("table",null,[e("thead",null,[e("tr",null,[e("th",null,t(s(a)("usage.date")),1),e("th",null,t(s(a)("usage.inputTokens")),1),e("th",null,t(s(a)("usage.outputTokens")),1),e("th",null,t(s(a)("usage.cacheRead")),1),e("th",null,t(s(a)("usage.cacheWrite")),1),e("th",null,t(s(a)("usage.cacheHitRate")),1),e("th",null,t(s(a)("usage.sessions")),1),e("th",null,t(s(a)("usage.cost")),1)])]),e("tbody",null,[(c(!0),p(S,null,M([...s(n).dailyUsage].reverse(),l=>(c(),p("tr",{key:l.date},[e("td",null,t(l.date),1),e("td",null,t(d(l.input_tokens)),1),e("td",null,t(d(l.output_tokens)),1),e("td",null,t(d(l.cache_read_tokens)),1),e("td",null,t(d(l.cache_write_tokens)),1),e("td",null,t(r(l)),1),e("td",null,t(l.sessions),1),e("td",null,t(g(l.cost)),1)]))),128))])])])]))}})})),vt=y((()=>{})),et,ht=y((()=>{Le(),Le(),vt(),B(),et=H(Ze,[["__scopeId","data-v-9eb202e8"]])})),Oe,We,qe,ze,Ne,Ke,Ae,Ee,tt,Qe=y((()=>{C(),at(),D(),V(),rt(),dt(),pt(),ht(),Oe={class:"usage-view"},We={class:"page-header"},qe={class:"header-title"},ze={class:"usage-toolbar"},Ne={class:"period-selector",role:"group","aria-label":"Usage statistics period"},Ke={class:"usage-content"},Ae={key:0,class:"usage-loading"},Ee={key:2,class:"usage-empty"},tt=R({__name:"UsageView",setup(_){const{t:a}=F(),n=P(),d=ut(),g=[{label:"7d",days:7},{label:"30d",days:30},{label:"90d",days:90},{label:"365d",days:365}],r=I(30);async function h(){(!d.activeProfileName||d.profiles.length===0)&&await d.fetchProfiles()}async function i(o=r.value){r.value=o,await h(),await n.loadSessions(o)}return st(()=>{i(30)}),(o,l)=>(c(),p("div",Oe,[e("header",We,[e("h2",qe,t(s(a)("usage.title")),1),e("div",ze,[e("div",Ne,[(c(),p(S,null,M(g,f=>x(s(q),{key:f.days,class:"period-option",size:"small",type:r.value===f.days?"primary":"default",secondary:r.value===f.days,quaternary:r.value!==f.days,"aria-pressed":r.value===f.days,onClick:O=>i(f.days)},{default:z(()=>[T(t(f.label),1)]),_:2},1032,["type","secondary","quaternary","aria-pressed","onClick"])),64))]),x(s(q),{class:"refresh-button",size:"small",quaternary:"",loading:s(n).isLoading,onClick:l[0]||(l[0]=f=>i())},{default:z(()=>[T(t(s(a)("usage.refresh")),1)]),_:1},8,["loading"])])]),e("div",Ke,[s(n).isLoading&&!s(n).hasData?(c(),p("div",Ae,t(s(a)("common.loading")),1)):s(n).hasData?(c(),p(S,{key:1},[x(je),x(Je),x(et)],64)):(c(),p("div",Ee,t(s(a)("usage.noData")),1))])]))}})})),gt=y((()=>{})),kt,yt=y((()=>{Qe(),Qe(),gt(),B(),kt=H(tt,[["__scopeId","data-v-b6148568"]])}));yt();export{kt as default};
1
+ import{n as y}from"./rolldown-runtime-M0oDzQ_3.js";import{$t as S,Cn as st,Dn as M,Ot as q,Pn as z,Qn as s,Tn as c,Wn as I,Wt as C,an as b,dn as R,ln as T,nn as k,nr as m,on as p,rn as e,rr as t,t as at,un as x}from"./ui-vendor-dYn1tJGA.js";import{_ as nt,c as D,g as ot,l as F}from"./vue-vendor-DZ4A_GHn.js";import{n as B,t as H}from"./_plugin-vue_export-helper-BIeGRfrQ.js";import{H as lt,W as it,X as ut,Y as rt}from"./index-Bkiif2Pf.js";function Xe(_){return(_||"").trim()||"unknown"}function w(_,a){return a<=0?0:_/a*100}function N(_){const a=Xe(_);let n=0;for(let d=0;d<a.length;d+=1)n=(n<<5)-n+a.charCodeAt(d),n|=0;return L[Math.abs(n)%L.length]}var L,P,V=y((()=>{it(),nt(),C(),L=["#4fd1c5","#63b3ed","#f6ad55","#b794f4","#68d391","#fc8181","#f687b3","#90cdf4","#fbd38d","#9ae6b4"],P=ot("usage",()=>{const _=I(null),a=I(!1);let n=0;async function d(u=30){const v=++n;a.value=!0;try{const $=await lt(u);v===n&&(_.value=$)}catch($){v===n&&console.error("Failed to load usage stats:",$)}finally{v===n&&(a.value=!1)}}const g=k(()=>!!_.value&&_.value.total_sessions>0),r=k(()=>_.value?.total_input_tokens??0),h=k(()=>_.value?.total_output_tokens??0),i=k(()=>r.value+h.value),o=k(()=>_.value?.total_sessions??0),l=k(()=>_.value?.total_cache_read_tokens??0),f=k(()=>{const u=r.value+l.value;return u===0?null:l.value/u*100}),O=k(()=>_.value?.total_cost??0),W=k(()=>_.value?_.value.model_usage.map(u=>{const v=Xe(u.model),$=u.input_tokens+u.output_tokens,U=$+u.cache_read_tokens;return{model:v,inputTokens:u.input_tokens,outputTokens:u.output_tokens,cacheTokens:u.cache_read_tokens,cacheWriteTokens:u.cache_write_tokens,totalTokens:$,visualTokens:U,sessions:u.sessions,color:N(v),inputPercent:w(u.input_tokens,U),outputPercent:w(u.output_tokens,U),cachePercent:w(u.cache_read_tokens,U)}}).sort((u,v)=>v.visualTokens-u.visualTokens):[]);return{stats:_,isLoading:a,hasData:g,loadSessions:d,totalInputTokens:r,totalOutputTokens:h,totalTokens:i,totalSessions:o,totalCacheTokens:l,cacheHitRate:f,estimatedCost:O,modelUsage:W,modelLegend:k(()=>{const u=new Set;return W.value.filter(v=>u.has(v.model)?!1:(u.add(v.model),!0)).map(v=>({model:v.model,color:v.color}))}),dailyUsage:k(()=>(_.value?.daily_usage??[]).map(u=>{const v=u.input_tokens+u.output_tokens+u.cache_read_tokens;return{...u,visualTokens:v,inputPercent:w(u.input_tokens,v),outputPercent:w(u.output_tokens,v),cachePercent:w(u.cache_read_tokens,v)}})),avgSessionsPerDay:k(()=>{if(!_.value||_.value.daily_usage.length===0)return 0;const u=_.value.daily_usage.filter($=>$.sessions>0).length,v=Math.max(1,u);return o.value/v}),getModelColor:N}})})),K,A,E,Q,X,Y,j,G,J,Z,ee,te,se,ae,ne,oe,Ye,le=y((()=>{C(),D(),V(),K={class:"stat-cards"},A={class:"stat-card"},E={class:"stat-label"},Q={class:"stat-value"},X={class:"stat-sub"},Y={class:"stat-card"},j={class:"stat-label"},G={class:"stat-value"},J={class:"stat-sub"},Z={class:"stat-card"},ee={class:"stat-label"},te={class:"stat-value"},se={class:"stat-card"},ae={class:"stat-label"},ne={class:"stat-value"},oe={key:0,class:"stat-sub"},Ye=R({__name:"StatCards",setup(_){const{t:a}=F(),n=P();function d(r){return r>=1e6?(r/1e6).toFixed(1)+"M":r>=1e3?(r/1e3).toFixed(1)+"K":String(r)}function g(r){return r===0?"$0.00":r<.01?"<$0.01":"$"+r.toFixed(2)}return(r,h)=>(c(),p("div",K,[e("div",A,[e("div",E,t(s(a)("usage.totalTokens")),1),e("div",Q,t(d(s(n).totalTokens)),1),e("div",X,t(d(s(n).totalInputTokens))+" "+t(s(a)("usage.inputTokens"))+" / "+t(d(s(n).totalOutputTokens))+" "+t(s(a)("usage.outputTokens")),1)]),e("div",Y,[e("div",j,t(s(a)("usage.totalSessions")),1),e("div",G,t(s(n).totalSessions),1),e("div",J,t(s(a)("usage.avgPerDay",{n:s(n).avgSessionsPerDay.toFixed(1)})),1)]),e("div",Z,[e("div",ee,t(s(a)("usage.estimatedCost")),1),e("div",te,t(g(s(n).estimatedCost)),1)]),e("div",se,[e("div",ae,t(s(a)("usage.cacheHitRate")),1),e("div",ne,t(s(n).cacheHitRate!==null?s(n).cacheHitRate.toFixed(1)+"%":"--"),1),s(n).cacheHitRate!==null?(c(),p("div",oe,t(d(s(n).totalCacheTokens))+" "+t(s(a)("usage.tokens")),1)):b("",!0)])]))}})})),_t=y((()=>{})),je,dt=y((()=>{le(),le(),_t(),B(),je=H(Ye,[["__scopeId","data-v-3a594781"]])})),ie,ue,re,_e,de,ce,pe,ve,he,ge,ke,Ge,ye=y((()=>{C(),D(),V(),ie={class:"model-breakdown"},ue={class:"section-title"},re={class:"model-legend","aria-label":"Token type legend"},_e={class:"legend-item"},de={class:"legend-item"},ce={class:"legend-item"},pe={class:"model-list"},ve=["title"],he={class:"model-bar-wrap"},ge=["title"],ke={key:0},Ge=R({__name:"ModelBreakdown",setup(_){const{t:a}=F(),n=P(),d=k(()=>Math.max(...n.modelUsage.map(h=>h.visualTokens),1));function g(h){return h>=1e6?(h/1e6).toFixed(1)+"M":h>=1e3?(h/1e3).toFixed(1)+"K":String(h)}function r(h){const i=h.inputTokens+h.cacheTokens;return i===0?"--":(h.cacheTokens/i*100).toFixed(1)+"%"}return(h,i)=>(c(),p("div",ie,[e("h3",ue,t(s(a)("usage.modelBreakdown")),1),e("div",re,[e("div",_e,[i[0]||(i[0]=e("span",{class:"legend-swatch input"},null,-1)),T(t(s(a)("usage.inputTokens")),1)]),e("div",de,[i[1]||(i[1]=e("span",{class:"legend-swatch output"},null,-1)),T(t(s(a)("usage.outputTokens")),1)]),e("div",ce,[i[2]||(i[2]=e("span",{class:"legend-swatch cache"},null,-1)),T(t(s(a)("usage.cacheRead")),1)])]),e("div",pe,[(c(!0),p(S,null,M(s(n).modelUsage,o=>(c(),p("div",{key:o.model,class:"model-row"},[e("span",{class:"model-swatch",style:m({background:o.color})},null,4),e("span",{class:"model-name",title:o.model},t(o.model),9,ve),e("div",he,[e("div",{class:"model-bar",style:m({width:o.visualTokens/d.value*100+"%"})},[o.inputTokens>0?(c(),p("div",{key:0,class:"model-bar-segment input",style:m({width:o.inputPercent+"%"})},null,4)):b("",!0),o.outputTokens>0?(c(),p("div",{key:1,class:"model-bar-segment output",style:m({width:o.outputPercent+"%"})},null,4)):b("",!0),o.cacheTokens>0?(c(),p("div",{key:2,class:"model-bar-segment cache",style:m({width:o.cachePercent+"%"})},null,4)):b("",!0)],4)]),e("span",{class:"model-tokens",title:`${s(a)("usage.inputTokens")}: ${g(o.inputTokens)} · ${s(a)("usage.outputTokens")}: ${g(o.outputTokens)} · ${s(a)("usage.cacheRead")}: ${g(o.cacheTokens)} · ${s(a)("usage.cacheHitRate")}: ${r(o)}`},[T(t(g(o.totalTokens))+" ",1),o.cacheTokens>0?(c(),p("small",ke,"+"+t(g(o.cacheTokens)),1)):b("",!0)],8,ge)]))),128))])]))}})})),ct=y((()=>{})),Je,pt=y((()=>{ye(),ye(),ct(),B(),Je=H(Ge,[["__scopeId","data-v-692258ec"]])})),fe,me,Te,$e,be,we,xe,Se,Ce,Pe,Ue,Me,Re,De,Fe,Be,He,Ve,Ie,Ze,Le=y((()=>{C(),D(),V(),fe={class:"daily-trend"},me={class:"section-title"},Te={class:"bar-chart"},$e={class:"bar-track"},be={class:"bar-tooltip"},we={class:"tooltip-date"},xe={class:"tooltip-row"},Se={class:"tooltip-row"},Ce={class:"tooltip-row"},Pe={class:"tooltip-row"},Ue={class:"tooltip-row"},Me={class:"tooltip-row"},Re={class:"tooltip-row"},De={class:"bar-dates"},Fe={class:"chart-legend","aria-label":"Token type legend"},Be={class:"legend-item"},He={class:"legend-item"},Ve={class:"legend-item"},Ie={class:"trend-table"},Ze=R({__name:"DailyTrend",setup(_){const{t:a}=F(),n=P();function d(i){return i>=1e6?(i/1e6).toFixed(1)+"M":i>=1e3?(i/1e3).toFixed(1)+"K":String(i)}function g(i){return i===0?"$0.00":i<.01?"<$0.01":"$"+i.toFixed(2)}function r(i){const o=i.input_tokens+i.cache_read_tokens;return o===0?"--":(i.cache_read_tokens/o*100).toFixed(1)+"%"}const h=k(()=>Math.max(...n.dailyUsage.map(i=>i.visualTokens),1));return(i,o)=>(c(),p("div",fe,[e("h3",me,t(s(a)("usage.dailyTrend")),1),e("div",Te,[(c(!0),p(S,null,M(s(n).dailyUsage,l=>(c(),p("div",{key:l.date,class:"bar-col"},[e("div",$e,[e("div",{class:"bar-stack",style:m({height:l.visualTokens/h.value*100+"%"})},[l.output_tokens>0?(c(),p("div",{key:0,class:"bar-segment output",style:m({height:l.outputPercent+"%"})},null,4)):b("",!0),l.input_tokens>0?(c(),p("div",{key:1,class:"bar-segment input",style:m({height:l.inputPercent+"%"})},null,4)):b("",!0),l.cache_read_tokens>0?(c(),p("div",{key:2,class:"bar-segment cache",style:m({height:l.cachePercent+"%"})},null,4)):b("",!0)],4)]),e("div",be,[e("div",we,t(l.date),1),e("div",xe,t(s(a)("usage.inputTokens"))+": "+t(d(l.input_tokens)),1),e("div",Se,t(s(a)("usage.outputTokens"))+": "+t(d(l.output_tokens)),1),e("div",Ce,t(s(a)("usage.cacheRead"))+": "+t(d(l.cache_read_tokens)),1),e("div",Pe,t(s(a)("usage.cacheWrite"))+": "+t(d(l.cache_write_tokens)),1),e("div",Ue,t(s(a)("usage.cacheHitRate"))+": "+t(r(l)),1),e("div",Me,t(s(a)("usage.sessions"))+": "+t(l.sessions),1),e("div",Re,t(s(a)("usage.cost"))+": "+t(g(l.cost)),1)])]))),128))]),e("div",De,[e("span",null,t(s(n).dailyUsage[0]?.date.slice(5)),1),e("span",null,t(s(n).dailyUsage[s(n).dailyUsage.length-1]?.date.slice(5)),1)]),e("div",Fe,[e("div",Be,[o[0]||(o[0]=e("span",{class:"legend-swatch input"},null,-1)),T(t(s(a)("usage.inputTokens")),1)]),e("div",He,[o[1]||(o[1]=e("span",{class:"legend-swatch output"},null,-1)),T(t(s(a)("usage.outputTokens")),1)]),e("div",Ve,[o[2]||(o[2]=e("span",{class:"legend-swatch cache"},null,-1)),T(t(s(a)("usage.cacheRead")),1)])]),e("div",Ie,[e("table",null,[e("thead",null,[e("tr",null,[e("th",null,t(s(a)("usage.date")),1),e("th",null,t(s(a)("usage.inputTokens")),1),e("th",null,t(s(a)("usage.outputTokens")),1),e("th",null,t(s(a)("usage.cacheRead")),1),e("th",null,t(s(a)("usage.cacheWrite")),1),e("th",null,t(s(a)("usage.cacheHitRate")),1),e("th",null,t(s(a)("usage.sessions")),1),e("th",null,t(s(a)("usage.cost")),1)])]),e("tbody",null,[(c(!0),p(S,null,M([...s(n).dailyUsage].reverse(),l=>(c(),p("tr",{key:l.date},[e("td",null,t(l.date),1),e("td",null,t(d(l.input_tokens)),1),e("td",null,t(d(l.output_tokens)),1),e("td",null,t(d(l.cache_read_tokens)),1),e("td",null,t(d(l.cache_write_tokens)),1),e("td",null,t(r(l)),1),e("td",null,t(l.sessions),1),e("td",null,t(g(l.cost)),1)]))),128))])])])]))}})})),vt=y((()=>{})),et,ht=y((()=>{Le(),Le(),vt(),B(),et=H(Ze,[["__scopeId","data-v-9eb202e8"]])})),Oe,We,qe,ze,Ne,Ke,Ae,Ee,tt,Qe=y((()=>{C(),at(),D(),V(),rt(),dt(),pt(),ht(),Oe={class:"usage-view"},We={class:"page-header"},qe={class:"header-title"},ze={class:"usage-toolbar"},Ne={class:"period-selector",role:"group","aria-label":"Usage statistics period"},Ke={class:"usage-content"},Ae={key:0,class:"usage-loading"},Ee={key:2,class:"usage-empty"},tt=R({__name:"UsageView",setup(_){const{t:a}=F(),n=P(),d=ut(),g=[{label:"7d",days:7},{label:"30d",days:30},{label:"90d",days:90},{label:"365d",days:365}],r=I(30);async function h(){(!d.activeProfileName||d.profiles.length===0)&&await d.fetchProfiles()}async function i(o=r.value){r.value=o,await h(),await n.loadSessions(o)}return st(()=>{i(30)}),(o,l)=>(c(),p("div",Oe,[e("header",We,[e("h2",qe,t(s(a)("usage.title")),1),e("div",ze,[e("div",Ne,[(c(),p(S,null,M(g,f=>x(s(q),{key:f.days,class:"period-option",size:"small",type:r.value===f.days?"primary":"default",secondary:r.value===f.days,quaternary:r.value!==f.days,"aria-pressed":r.value===f.days,onClick:O=>i(f.days)},{default:z(()=>[T(t(f.label),1)]),_:2},1032,["type","secondary","quaternary","aria-pressed","onClick"])),64))]),x(s(q),{class:"refresh-button",size:"small",quaternary:"",loading:s(n).isLoading,onClick:l[0]||(l[0]=f=>i())},{default:z(()=>[T(t(s(a)("usage.refresh")),1)]),_:1},8,["loading"])])]),e("div",Ke,[s(n).isLoading&&!s(n).hasData?(c(),p("div",Ae,t(s(a)("common.loading")),1)):s(n).hasData?(c(),p(S,{key:1},[x(je),x(Je),x(et)],64)):(c(),p("div",Ee,t(s(a)("usage.noData")),1))])]))}})})),gt=y((()=>{})),kt,yt=y((()=>{Qe(),Qe(),gt(),B(),kt=H(tt,[["__scopeId","data-v-b6148568"]])}));yt();export{kt as default};
@@ -1 +1 @@
1
- import{n as f}from"./rolldown-runtime-M0oDzQ_3.js";import{Cn as xe,It as ke,M as Te,Mn as D,Ot as b,Pn as n,Q as Ce,Qn as e,Rt as I,Tn as B,V as Ie,Wn as g,Wt as ee,X as d,an as Be,dn as ae,in as Le,ln as v,mt as Ne,nn as P,on as te,rn as r,rr as s,t as Me,un as l,wn as Oe}from"./ui-vendor-dYn1tJGA.js";import{c as ie,l as se}from"./vue-vendor-DZ4A_GHn.js";import{n as le,t as ne}from"./_plugin-vue_export-helper-BYiIU0Pd.js";import{_ as $e,d as De,f as Ge,g as Re,o as ze,s as je,u as Ae}from"./system-BHEG2KFs.js";var G,R,z,j,A,E,F,H,J,K,Q,ue,U=f((()=>{ee(),Me(),ie(),Ae(),G={class:"github-preview-settings"},R={class:"settings-section"},z={class:"control-row"},j={class:"section-description"},A=["href"],E={class:"log-output"},F={class:"log-output-header"},H={class:"log-box"},J={class:"log-title"},K={class:"log-box"},Q={class:"log-title"},ue=ae({__name:"GithubPreviewSettings",setup(ce){const{t:a}=se(),p=Ie(),m=g(!1),y=g(!1),S=g(""),V=g([]),_=g(""),t=g(null),x=g(""),L=g(!1);let h=null;const _e=P(()=>V.value.map(i=>({label:i.name,value:i.name}))),ve=P(()=>t.value?.action_log||""),de=P(()=>t.value?.dev_log||""),w=P(()=>S.value||t.value?.active_action||""),k=P(()=>!!w.value),ge={prepare:"githubPreview.prepareSuccess",install:"githubPreview.installSuccess",start:"githubPreview.startSuccess",stop:"githubPreview.stopSuccess"};function pe(i){const o=String(i?.message||""),c=o.indexOf("{");if(!(c<0))try{const u=JSON.parse(o.slice(c));u&&typeof u=="object"&&"preview_dir"in u&&(t.value=u)}catch{}}function C(i,o){return i==="node_environment_missing"?a("githubPreview.nodeEnvironmentMissing"):o||a("githubPreview.actionFailed")}function fe(i){const o=String(i?.message||""),c=o.indexOf("{");if(c<0)return null;try{const u=JSON.parse(o.slice(c));return u&&typeof u=="object"?u:null}catch{return null}}async function N(){t.value=await ze(),!_.value&&t.value.current_tag&&(_.value=t.value.current_tag)}async function he(){y.value=!0;try{V.value=(await je()).tags,!_.value&&V.value[0]&&(_.value=V.value[0].name)}finally{y.value=!1}}async function M(){m.value=!0;try{await Promise.all([N(),he()])}finally{m.value=!1}}async function T(i,o,c){S.value=i;try{const u=await o();if(t.value=u,u.success===!1){p.warning(C(u.code,u.message));return}!u.accepted&&!u.active_action&&p.success(a(c))}catch(u){pe(u);const $=fe(u);p.error(C($?.code,$?.message||u?.message))}finally{S.value=""}}async function we(){try{await N()}catch{}}function be(){h||(h=window.setInterval(()=>{we()},2e3))}function O(){h&&(window.clearInterval(h),h=null)}function Pe(){return _.value?_.value:(p.warning(a("githubPreview.selectTag")),null)}async function me(){const i=Pe();i&&await T("prepare",()=>Ge(i),"githubPreview.prepareSuccess")}async function ye(){await T("install",async()=>{const i=await De();return i.success!==!1&&!i.accepted&&!i.active_action&&!i.installed?{...i,success:!1,message:i.message||a("githubPreview.actionFailed")}:i},"githubPreview.installSuccess")}async function Se(){await T("start",()=>Re(_.value||void 0),"githubPreview.startSuccess")}async function Ve(){await T("stop",$e,"githubPreview.stopSuccess")}return xe(async()=>{await M(),x.value=t.value?.last_action_completed_at||"",L.value=!0}),Oe(()=>{O()}),D(()=>t.value?.active_action||"",i=>{i?be():O()}),D(()=>t.value?.last_action_completed_at||"",i=>{if(!i)return;if(!L.value){x.value=i;return}if(i===x.value||S.value)return;x.value=i;const o=t.value?.last_action||"";if(t.value?.last_action_success===!1){p.error(C(t.value.last_action_code,t.value.last_action_message));return}const c=ge[o];c&&p.success(a(c))}),(i,o)=>(B(),te("div",G,[r("div",R,[r("div",z,[l(e(Ne),{value:_.value,"onUpdate:value":o[0]||(o[0]=c=>_.value=c),class:"tag-select",filterable:"",loading:y.value,options:_e.value,placeholder:e(a)("githubPreview.selectTag")},null,8,["value","loading","options","placeholder"]),l(e(Te),null,{default:n(()=>[l(e(b),{type:"primary",loading:w.value==="prepare",disabled:k.value||!_.value,onClick:me},{default:n(()=>[v(s(e(a)("githubPreview.prepare")),1)]),_:1},8,["loading","disabled"]),l(e(b),{loading:w.value==="install",disabled:k.value||!t.value?.has_package,onClick:ye},{default:n(()=>[v(s(e(a)("githubPreview.install")),1)]),_:1},8,["loading","disabled"]),l(e(b),{type:"success",loading:w.value==="start",disabled:k.value||!t.value?.installed,onClick:Se},{default:n(()=>[v(s(e(a)("githubPreview.start")),1)]),_:1},8,["loading","disabled"]),l(e(b),{loading:w.value==="stop",disabled:k.value||!t.value?.running,onClick:Ve},{default:n(()=>[v(s(e(a)("githubPreview.stop")),1)]),_:1},8,["loading","disabled"]),l(e(b),{loading:m.value||y.value,onClick:M},{default:n(()=>[v(s(e(a)("githubPreview.refresh")),1)]),_:1},8,["loading"])]),_:1})]),r("p",j,s(e(a)("githubPreview.description")),1),l(e(ke),{type:"info",bordered:!1,class:"preview-note"},{default:n(()=>[v(s(e(a)("githubPreview.note")),1)]),_:1}),t.value?(B(),Le(e(Ce),{key:0,column:1,bordered:"",size:"small",class:"status-table"},{default:n(()=>[l(e(d),{label:e(a)("githubPreview.path")},{default:n(()=>[r("code",null,s(t.value.preview_dir),1)]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.webuiHome")},{default:n(()=>[r("code",null,s(t.value.webui_home),1)]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.currentTag")},{default:n(()=>[v(s(t.value.current_tag||"-"),1)]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.repoReady")},{default:n(()=>[l(e(I),{size:"small",type:t.value.has_package?"success":"default"},{default:n(()=>[v(s(t.value.has_package?e(a)("githubPreview.yes"):e(a)("githubPreview.no")),1)]),_:1},8,["type"])]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.dependencies")},{default:n(()=>[l(e(I),{size:"small",type:t.value.installed?"success":"warning"},{default:n(()=>[v(s(t.value.installed?e(a)("githubPreview.yes"):e(a)("githubPreview.no")),1)]),_:1},8,["type"])]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.running")},{default:n(()=>[l(e(I),{size:"small",type:t.value.running?"success":"default"},{default:n(()=>[v(s(t.value.running?`PID ${t.value.pid}`:e(a)("githubPreview.notRunning")),1)]),_:1},8,["type"])]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.open")},{default:n(()=>[r("a",{href:t.value.frontend_url,target:"_blank",rel:"noopener noreferrer"},s(t.value.frontend_url),9,A)]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.log")},{default:n(()=>[r("code",null,s(t.value.action_log_path),1)]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.devLog")},{default:n(()=>[r("code",null,s(t.value.dev_log_path),1)]),_:1},8,["label"])]),_:1})):Be("",!0),r("div",E,[r("div",F,s(e(a)("githubPreview.logOutput")),1),r("div",H,[r("div",J,s(e(a)("githubPreview.actionLog")),1),r("pre",null,s(ve.value||"-"),1)]),r("div",K,[r("div",Q,s(e(a)("githubPreview.devLog")),1),r("pre",null,s(de.value||"-"),1)])])])]))}})})),Ee=f((()=>{})),re,Fe=f((()=>{U(),U(),Ee(),le(),re=ne(ue,[["__scopeId","data-v-721cf76a"]])})),W,q,X,Z,oe,Y=f((()=>{ee(),ie(),Fe(),W={class:"version-preview-view"},q={class:"page-header"},X={class:"header-title"},Z={class:"page-content"},oe=ae({__name:"VersionPreviewView",setup(ce){const{t:a}=se();return(p,m)=>(B(),te("div",W,[r("header",q,[r("h2",X,s(e(a)("githubPreview.title")),1)]),r("div",Z,[l(re)])]))}})})),He=f((()=>{})),Je,Ke=f((()=>{Y(),Y(),He(),le(),Je=ne(oe,[["__scopeId","data-v-1447333d"]])}));Ke();export{Je as default};
1
+ import{n as f}from"./rolldown-runtime-M0oDzQ_3.js";import{Cn as xe,It as ke,M as Te,Mn as D,Ot as b,Pn as n,Q as Ce,Qn as e,Rt as I,Tn as B,V as Ie,Wn as g,Wt as ee,X as d,an as Be,dn as ae,in as Le,ln as v,mt as Ne,nn as P,on as te,rn as r,rr as s,t as Me,un as l,wn as Oe}from"./ui-vendor-dYn1tJGA.js";import{c as ie,l as se}from"./vue-vendor-DZ4A_GHn.js";import{n as le,t as ne}from"./_plugin-vue_export-helper-BIeGRfrQ.js";import{_ as $e,d as De,f as Ge,g as Re,o as ze,s as je,u as Ae}from"./system-Bm5rA-WZ.js";var G,R,z,j,A,E,F,H,J,K,Q,ue,U=f((()=>{ee(),Me(),ie(),Ae(),G={class:"github-preview-settings"},R={class:"settings-section"},z={class:"control-row"},j={class:"section-description"},A=["href"],E={class:"log-output"},F={class:"log-output-header"},H={class:"log-box"},J={class:"log-title"},K={class:"log-box"},Q={class:"log-title"},ue=ae({__name:"GithubPreviewSettings",setup(ce){const{t:a}=se(),p=Ie(),m=g(!1),y=g(!1),S=g(""),V=g([]),_=g(""),t=g(null),x=g(""),L=g(!1);let h=null;const _e=P(()=>V.value.map(i=>({label:i.name,value:i.name}))),ve=P(()=>t.value?.action_log||""),de=P(()=>t.value?.dev_log||""),w=P(()=>S.value||t.value?.active_action||""),k=P(()=>!!w.value),ge={prepare:"githubPreview.prepareSuccess",install:"githubPreview.installSuccess",start:"githubPreview.startSuccess",stop:"githubPreview.stopSuccess"};function pe(i){const o=String(i?.message||""),c=o.indexOf("{");if(!(c<0))try{const u=JSON.parse(o.slice(c));u&&typeof u=="object"&&"preview_dir"in u&&(t.value=u)}catch{}}function C(i,o){return i==="node_environment_missing"?a("githubPreview.nodeEnvironmentMissing"):o||a("githubPreview.actionFailed")}function fe(i){const o=String(i?.message||""),c=o.indexOf("{");if(c<0)return null;try{const u=JSON.parse(o.slice(c));return u&&typeof u=="object"?u:null}catch{return null}}async function N(){t.value=await ze(),!_.value&&t.value.current_tag&&(_.value=t.value.current_tag)}async function he(){y.value=!0;try{V.value=(await je()).tags,!_.value&&V.value[0]&&(_.value=V.value[0].name)}finally{y.value=!1}}async function M(){m.value=!0;try{await Promise.all([N(),he()])}finally{m.value=!1}}async function T(i,o,c){S.value=i;try{const u=await o();if(t.value=u,u.success===!1){p.warning(C(u.code,u.message));return}!u.accepted&&!u.active_action&&p.success(a(c))}catch(u){pe(u);const $=fe(u);p.error(C($?.code,$?.message||u?.message))}finally{S.value=""}}async function we(){try{await N()}catch{}}function be(){h||(h=window.setInterval(()=>{we()},2e3))}function O(){h&&(window.clearInterval(h),h=null)}function Pe(){return _.value?_.value:(p.warning(a("githubPreview.selectTag")),null)}async function me(){const i=Pe();i&&await T("prepare",()=>Ge(i),"githubPreview.prepareSuccess")}async function ye(){await T("install",async()=>{const i=await De();return i.success!==!1&&!i.accepted&&!i.active_action&&!i.installed?{...i,success:!1,message:i.message||a("githubPreview.actionFailed")}:i},"githubPreview.installSuccess")}async function Se(){await T("start",()=>Re(_.value||void 0),"githubPreview.startSuccess")}async function Ve(){await T("stop",$e,"githubPreview.stopSuccess")}return xe(async()=>{await M(),x.value=t.value?.last_action_completed_at||"",L.value=!0}),Oe(()=>{O()}),D(()=>t.value?.active_action||"",i=>{i?be():O()}),D(()=>t.value?.last_action_completed_at||"",i=>{if(!i)return;if(!L.value){x.value=i;return}if(i===x.value||S.value)return;x.value=i;const o=t.value?.last_action||"";if(t.value?.last_action_success===!1){p.error(C(t.value.last_action_code,t.value.last_action_message));return}const c=ge[o];c&&p.success(a(c))}),(i,o)=>(B(),te("div",G,[r("div",R,[r("div",z,[l(e(Ne),{value:_.value,"onUpdate:value":o[0]||(o[0]=c=>_.value=c),class:"tag-select",filterable:"",loading:y.value,options:_e.value,placeholder:e(a)("githubPreview.selectTag")},null,8,["value","loading","options","placeholder"]),l(e(Te),null,{default:n(()=>[l(e(b),{type:"primary",loading:w.value==="prepare",disabled:k.value||!_.value,onClick:me},{default:n(()=>[v(s(e(a)("githubPreview.prepare")),1)]),_:1},8,["loading","disabled"]),l(e(b),{loading:w.value==="install",disabled:k.value||!t.value?.has_package,onClick:ye},{default:n(()=>[v(s(e(a)("githubPreview.install")),1)]),_:1},8,["loading","disabled"]),l(e(b),{type:"success",loading:w.value==="start",disabled:k.value||!t.value?.installed,onClick:Se},{default:n(()=>[v(s(e(a)("githubPreview.start")),1)]),_:1},8,["loading","disabled"]),l(e(b),{loading:w.value==="stop",disabled:k.value||!t.value?.running,onClick:Ve},{default:n(()=>[v(s(e(a)("githubPreview.stop")),1)]),_:1},8,["loading","disabled"]),l(e(b),{loading:m.value||y.value,onClick:M},{default:n(()=>[v(s(e(a)("githubPreview.refresh")),1)]),_:1},8,["loading"])]),_:1})]),r("p",j,s(e(a)("githubPreview.description")),1),l(e(ke),{type:"info",bordered:!1,class:"preview-note"},{default:n(()=>[v(s(e(a)("githubPreview.note")),1)]),_:1}),t.value?(B(),Le(e(Ce),{key:0,column:1,bordered:"",size:"small",class:"status-table"},{default:n(()=>[l(e(d),{label:e(a)("githubPreview.path")},{default:n(()=>[r("code",null,s(t.value.preview_dir),1)]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.webuiHome")},{default:n(()=>[r("code",null,s(t.value.webui_home),1)]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.currentTag")},{default:n(()=>[v(s(t.value.current_tag||"-"),1)]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.repoReady")},{default:n(()=>[l(e(I),{size:"small",type:t.value.has_package?"success":"default"},{default:n(()=>[v(s(t.value.has_package?e(a)("githubPreview.yes"):e(a)("githubPreview.no")),1)]),_:1},8,["type"])]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.dependencies")},{default:n(()=>[l(e(I),{size:"small",type:t.value.installed?"success":"warning"},{default:n(()=>[v(s(t.value.installed?e(a)("githubPreview.yes"):e(a)("githubPreview.no")),1)]),_:1},8,["type"])]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.running")},{default:n(()=>[l(e(I),{size:"small",type:t.value.running?"success":"default"},{default:n(()=>[v(s(t.value.running?`PID ${t.value.pid}`:e(a)("githubPreview.notRunning")),1)]),_:1},8,["type"])]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.open")},{default:n(()=>[r("a",{href:t.value.frontend_url,target:"_blank",rel:"noopener noreferrer"},s(t.value.frontend_url),9,A)]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.log")},{default:n(()=>[r("code",null,s(t.value.action_log_path),1)]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.devLog")},{default:n(()=>[r("code",null,s(t.value.dev_log_path),1)]),_:1},8,["label"])]),_:1})):Be("",!0),r("div",E,[r("div",F,s(e(a)("githubPreview.logOutput")),1),r("div",H,[r("div",J,s(e(a)("githubPreview.actionLog")),1),r("pre",null,s(ve.value||"-"),1)]),r("div",K,[r("div",Q,s(e(a)("githubPreview.devLog")),1),r("pre",null,s(de.value||"-"),1)])])])]))}})})),Ee=f((()=>{})),re,Fe=f((()=>{U(),U(),Ee(),le(),re=ne(ue,[["__scopeId","data-v-721cf76a"]])})),W,q,X,Z,oe,Y=f((()=>{ee(),ie(),Fe(),W={class:"version-preview-view"},q={class:"page-header"},X={class:"header-title"},Z={class:"page-content"},oe=ae({__name:"VersionPreviewView",setup(ce){const{t:a}=se();return(p,m)=>(B(),te("div",W,[r("header",q,[r("h2",X,s(e(a)("githubPreview.title")),1)]),r("div",Z,[l(re)])]))}})})),He=f((()=>{})),Je,Ke=f((()=>{Y(),Y(),He(),le(),Je=ne(oe,[["__scopeId","data-v-1447333d"]])}));Ke();export{Je as default};
@@ -1 +1 @@
1
- import{n as k}from"./rolldown-runtime-M0oDzQ_3.js";import{Cn as ve,Mn as Te,On as x,Pn as A,Qn as C,Tn as O,Wn as S,Wt as Q,an as H,dn as ye,nn as W,nr as Se,on as Y,un as G,xn as be,yn as h}from"./ui-vendor-dYn1tJGA.js";import{a as we,n as Me,r as xe,t as Ae}from"./vue-vendor-DZ4A_GHn.js";import{n as He,t as ke}from"./_plugin-vue_export-helper-BYiIU0Pd.js";function Be(){try{return localStorage.getItem(E)!=="false"}catch{return!0}}function J(o){B.value=o;try{localStorage.setItem(E,String(o))}catch{}}function Fe(){J(!B.value)}function Ce(){return{toolTraceVisible:B,setToolTraceVisible:J,toggleToolTraceVisible:Fe}}var E,B,Oe=k((()=>{Q(),E="hermes_show_tool_calls",B=S(Be())})),K,j,U=k((()=>{Q(),Me(),Ae(),K={key:0,class:"virtual-message-list-empty"},j=ye({__name:"VirtualMessageList",props:{messages:{},estimatedItemHeight:{default:180},overscan:{default:8},rowGap:{default:16},padding:{default:"20px"},topThreshold:{default:120}},emits:["scroll","topReach"],setup(o,{expose:X,emit:Z}){const m=o,$=Z,z=S(null),T=S(null),b=S(0),ee=S(0);let w=0,c=null,f=0,p=0,q=0,g=!1,i=null,F=0,d=null,u=null;const te=W(()=>m.messages.map(le)),ne=W(()=>Math.max(m.estimatedItemHeight,m.estimatedItemHeight*m.overscan));function le(e){return String(e.id)}function s(){return z.value?.querySelector(".virtual-message-list")??null}function a(){const e=s();e&&(b.value=e.scrollTop,ee.value=e.clientHeight)}function y(e=120){q=Date.now()+e}function re(){return Date.now()<q}function M(){w=0,c!=null&&(cancelAnimationFrame(c),c=null),f=0,p=0}function oe(){const e=b.value;a(),re()||(b.value-e<-1?g=!0:v(32)&&(g=!1),(g||!v(96))&&M()),$("scroll"),b.value<=m.topThreshold&&$("topReach")}function ie(e){e.deltaY<-1&&(g=!0,M())}function D(){a(),(Date.now()<w||v(64))&&L(2),d&&V(d.token,4)}function v(e=200){const t=s();return t?t.scrollHeight-t.scrollTop-t.clientHeight<e:!0}function se(e=200){return!g&&v(e)}function ae(e={}){const t=typeof e=="number"?e:e.frames??2,n=typeof e=="number"?400:e.keepAliveMs??400;g=!1,w=Date.now()+n,h(()=>{L(t)})}function ce(){const e=s();return y(),T.value?.scrollToBottom(),e?(e.scrollTop=Math.max(0,e.scrollHeight-e.clientHeight),a(),!0):!1}function L(e=1){if(f=Math.max(f,e),c!=null)return;const t=()=>{if(ce()?(p=0,f-=1):p+=1,f<=0&&Date.now()>=w){c=null,f=0,p=0;return}if(p>30){c=null,f=0,p=0;return}c=requestAnimationFrame(t)};c=requestAnimationFrame(t)}function ue(e,t){const n=s();if(!n)return null;const r=document.getElementById(t);if(r instanceof HTMLElement&&n.contains(r))return r;const l=document.getElementById(`message-${e}`);return l instanceof HTMLElement&&n.contains(l)?l:null}function me(e,t){const n=s();if(!n)return;const r=n.getBoundingClientRect(),l=e.getBoundingClientRect(),_=t==="center"?l.top+l.height/2-(r.top+r.height/2):l.top-r.top-24;Math.abs(_)>1&&(y(),n.scrollTop=Math.max(0,n.scrollTop+_)),a()}function R(e,t){y(),T.value?.scrollToItem(e,t),a()}function V(e,t=1){i!=null&&cancelAnimationFrame(i);const n=r=>{const l=d;if(!l||l.token!==e){i=null;return}const _=ue(l.messageId,l.anchorId);if(_?me(_,l.align):R(l.index,{align:l.align,offset:l.align==="start"?-24:0}),r<=1){i=null,d=null;return}i=requestAnimationFrame(()=>n(r-1))};i=requestAnimationFrame(()=>n(t))}function I(){F+=1,d=null,i!=null&&(cancelAnimationFrame(i),i=null)}function fe(e){const t=m.messages.findIndex(r=>String(r.id)===e);if(t<0)return;I();const n=F;d={token:n,index:t,messageId:e,anchorId:`message-${e}`,align:"center"},h(()=>{R(t,{align:"center"}),V(n,8)})}function ge(e,t){const n=m.messages.findIndex(l=>String(l.id)===e);if(n<0)return;I();const r=F;d={token:r,index:n,messageId:e,anchorId:t,align:"start"},h(()=>{R(n,{align:"start",offset:-24}),V(r,10)})}function de(){const e=s();return e?{scrollTop:e.scrollTop,scrollHeight:e.scrollHeight}:null}function _e(e){e&&h(()=>{const t=s();if(!t)return;const n=Math.max(0,t.scrollHeight-e.scrollHeight+e.scrollTop);y(),T.value?.scrollToPosition(n),t.scrollTop=n,a()})}function he(){const e=s();return e?{scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,wasNearBottom:v(64)}:null}function pe(e,t=4){e&&(M(),g=!e.wasNearBottom,u!=null&&cancelAnimationFrame(u),h(()=>{let n=t;const r=()=>{const l=s();if(!l){u=null;return}const _=Math.max(0,l.scrollHeight-l.clientHeight),N=Math.min(_,Math.max(0,e.scrollTop));if(y(),T.value?.scrollToPosition(N),l.scrollTop=N,a(),n-=1,n<=0){u=null;return}u=requestAnimationFrame(r)};u=requestAnimationFrame(r)}))}let P=null;return ve(()=>{h(()=>{a();const e=s();e&&typeof ResizeObserver<"u"&&(P=new ResizeObserver(D),P.observe(e))})}),be(()=>{M(),i!=null&&cancelAnimationFrame(i),u!=null&&cancelAnimationFrame(u),P?.disconnect()}),Te(te,()=>{I(),h(a)}),X({isNearBottom:v,shouldAutoFollowBottom:se,scrollToBottom:ae,scrollToMessage:fe,scrollToAnchor:ge,captureScrollPosition:de,restoreScrollPosition:_e,captureViewportPosition:he,restoreViewportPosition:pe}),(e,t)=>(O(),Y("div",{ref_key:"hostRef",ref:z,class:"virtual-message-list-host",style:Se({"--virtual-row-gap":`${o.rowGap}px`,"--virtual-list-padding":o.padding})},[G(C(we),{ref_key:"scrollerRef",ref:T,class:"virtual-message-list",items:o.messages,"key-field":"id","min-item-size":o.estimatedItemHeight,buffer:ne.value,"flow-mode":!0,prerender:o.overscan,onScrollPassive:oe,onWheelPassive:ie,onResize:D,onVisible:a},{before:A(()=>[o.messages.length>0?x(e.$slots,"before",{key:0},void 0,!0):H("",!0)]),default:A(({item:n,index:r,active:l})=>[G(C(xe),{item:n,index:r,active:l,class:"virtual-row"},{default:A(()=>[l?x(e.$slots,"item",{key:0,message:n},void 0,!0):H("",!0)]),_:2},1032,["item","index","active"])]),after:A(()=>[o.messages.length>0?x(e.$slots,"after",{key:0},void 0,!0):H("",!0)]),_:3},8,["items","min-item-size","buffer","prerender"]),o.messages.length===0&&e.$slots.empty?(O(),Y("div",K,[x(e.$slots,"empty",{},void 0,!0)])):H("",!0)],4))}})})),Re=k((()=>{})),Ve,We=k((()=>{U(),U(),Re(),He(),Ve=ke(j,[["__scopeId","data-v-c2c35ff4"]])}));export{Ce as i,We as n,Oe as r,Ve as t};
1
+ import{n as k}from"./rolldown-runtime-M0oDzQ_3.js";import{Cn as ve,Mn as Te,On as x,Pn as A,Qn as C,Tn as O,Wn as S,Wt as Q,an as H,dn as ye,nn as W,nr as Se,on as Y,un as G,xn as be,yn as h}from"./ui-vendor-dYn1tJGA.js";import{a as we,n as Me,r as xe,t as Ae}from"./vue-vendor-DZ4A_GHn.js";import{n as He,t as ke}from"./_plugin-vue_export-helper-BIeGRfrQ.js";function Be(){try{return localStorage.getItem(E)!=="false"}catch{return!0}}function J(o){B.value=o;try{localStorage.setItem(E,String(o))}catch{}}function Fe(){J(!B.value)}function Ce(){return{toolTraceVisible:B,setToolTraceVisible:J,toggleToolTraceVisible:Fe}}var E,B,Oe=k((()=>{Q(),E="hermes_show_tool_calls",B=S(Be())})),K,j,U=k((()=>{Q(),Me(),Ae(),K={key:0,class:"virtual-message-list-empty"},j=ye({__name:"VirtualMessageList",props:{messages:{},estimatedItemHeight:{default:180},overscan:{default:8},rowGap:{default:16},padding:{default:"20px"},topThreshold:{default:120}},emits:["scroll","topReach"],setup(o,{expose:X,emit:Z}){const m=o,$=Z,z=S(null),T=S(null),b=S(0),ee=S(0);let w=0,c=null,f=0,p=0,q=0,g=!1,i=null,F=0,d=null,u=null;const te=W(()=>m.messages.map(le)),ne=W(()=>Math.max(m.estimatedItemHeight,m.estimatedItemHeight*m.overscan));function le(e){return String(e.id)}function s(){return z.value?.querySelector(".virtual-message-list")??null}function a(){const e=s();e&&(b.value=e.scrollTop,ee.value=e.clientHeight)}function y(e=120){q=Date.now()+e}function re(){return Date.now()<q}function M(){w=0,c!=null&&(cancelAnimationFrame(c),c=null),f=0,p=0}function oe(){const e=b.value;a(),re()||(b.value-e<-1?g=!0:v(32)&&(g=!1),(g||!v(96))&&M()),$("scroll"),b.value<=m.topThreshold&&$("topReach")}function ie(e){e.deltaY<-1&&(g=!0,M())}function D(){a(),(Date.now()<w||v(64))&&L(2),d&&V(d.token,4)}function v(e=200){const t=s();return t?t.scrollHeight-t.scrollTop-t.clientHeight<e:!0}function se(e=200){return!g&&v(e)}function ae(e={}){const t=typeof e=="number"?e:e.frames??2,n=typeof e=="number"?400:e.keepAliveMs??400;g=!1,w=Date.now()+n,h(()=>{L(t)})}function ce(){const e=s();return y(),T.value?.scrollToBottom(),e?(e.scrollTop=Math.max(0,e.scrollHeight-e.clientHeight),a(),!0):!1}function L(e=1){if(f=Math.max(f,e),c!=null)return;const t=()=>{if(ce()?(p=0,f-=1):p+=1,f<=0&&Date.now()>=w){c=null,f=0,p=0;return}if(p>30){c=null,f=0,p=0;return}c=requestAnimationFrame(t)};c=requestAnimationFrame(t)}function ue(e,t){const n=s();if(!n)return null;const r=document.getElementById(t);if(r instanceof HTMLElement&&n.contains(r))return r;const l=document.getElementById(`message-${e}`);return l instanceof HTMLElement&&n.contains(l)?l:null}function me(e,t){const n=s();if(!n)return;const r=n.getBoundingClientRect(),l=e.getBoundingClientRect(),_=t==="center"?l.top+l.height/2-(r.top+r.height/2):l.top-r.top-24;Math.abs(_)>1&&(y(),n.scrollTop=Math.max(0,n.scrollTop+_)),a()}function R(e,t){y(),T.value?.scrollToItem(e,t),a()}function V(e,t=1){i!=null&&cancelAnimationFrame(i);const n=r=>{const l=d;if(!l||l.token!==e){i=null;return}const _=ue(l.messageId,l.anchorId);if(_?me(_,l.align):R(l.index,{align:l.align,offset:l.align==="start"?-24:0}),r<=1){i=null,d=null;return}i=requestAnimationFrame(()=>n(r-1))};i=requestAnimationFrame(()=>n(t))}function I(){F+=1,d=null,i!=null&&(cancelAnimationFrame(i),i=null)}function fe(e){const t=m.messages.findIndex(r=>String(r.id)===e);if(t<0)return;I();const n=F;d={token:n,index:t,messageId:e,anchorId:`message-${e}`,align:"center"},h(()=>{R(t,{align:"center"}),V(n,8)})}function ge(e,t){const n=m.messages.findIndex(l=>String(l.id)===e);if(n<0)return;I();const r=F;d={token:r,index:n,messageId:e,anchorId:t,align:"start"},h(()=>{R(n,{align:"start",offset:-24}),V(r,10)})}function de(){const e=s();return e?{scrollTop:e.scrollTop,scrollHeight:e.scrollHeight}:null}function _e(e){e&&h(()=>{const t=s();if(!t)return;const n=Math.max(0,t.scrollHeight-e.scrollHeight+e.scrollTop);y(),T.value?.scrollToPosition(n),t.scrollTop=n,a()})}function he(){const e=s();return e?{scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,wasNearBottom:v(64)}:null}function pe(e,t=4){e&&(M(),g=!e.wasNearBottom,u!=null&&cancelAnimationFrame(u),h(()=>{let n=t;const r=()=>{const l=s();if(!l){u=null;return}const _=Math.max(0,l.scrollHeight-l.clientHeight),N=Math.min(_,Math.max(0,e.scrollTop));if(y(),T.value?.scrollToPosition(N),l.scrollTop=N,a(),n-=1,n<=0){u=null;return}u=requestAnimationFrame(r)};u=requestAnimationFrame(r)}))}let P=null;return ve(()=>{h(()=>{a();const e=s();e&&typeof ResizeObserver<"u"&&(P=new ResizeObserver(D),P.observe(e))})}),be(()=>{M(),i!=null&&cancelAnimationFrame(i),u!=null&&cancelAnimationFrame(u),P?.disconnect()}),Te(te,()=>{I(),h(a)}),X({isNearBottom:v,shouldAutoFollowBottom:se,scrollToBottom:ae,scrollToMessage:fe,scrollToAnchor:ge,captureScrollPosition:de,restoreScrollPosition:_e,captureViewportPosition:he,restoreViewportPosition:pe}),(e,t)=>(O(),Y("div",{ref_key:"hostRef",ref:z,class:"virtual-message-list-host",style:Se({"--virtual-row-gap":`${o.rowGap}px`,"--virtual-list-padding":o.padding})},[G(C(we),{ref_key:"scrollerRef",ref:T,class:"virtual-message-list",items:o.messages,"key-field":"id","min-item-size":o.estimatedItemHeight,buffer:ne.value,"flow-mode":!0,prerender:o.overscan,onScrollPassive:oe,onWheelPassive:ie,onResize:D,onVisible:a},{before:A(()=>[o.messages.length>0?x(e.$slots,"before",{key:0},void 0,!0):H("",!0)]),default:A(({item:n,index:r,active:l})=>[G(C(xe),{item:n,index:r,active:l,class:"virtual-row"},{default:A(()=>[l?x(e.$slots,"item",{key:0,message:n},void 0,!0):H("",!0)]),_:2},1032,["item","index","active"])]),after:A(()=>[o.messages.length>0?x(e.$slots,"after",{key:0},void 0,!0):H("",!0)]),_:3},8,["items","min-item-size","buffer","prerender"]),o.messages.length===0&&e.$slots.empty?(O(),Y("div",K,[x(e.$slots,"empty",{},void 0,!0)])):H("",!0)],4))}})})),Re=k((()=>{})),Ve,We=k((()=>{U(),U(),Re(),He(),Ve=ke(j,[["__scopeId","data-v-c2c35ff4"]])}));export{Ce as i,We as n,Oe as r,Ve as t};
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/js/LoginView-63v15BI4.js","assets/js/rolldown-runtime-M0oDzQ_3.js","assets/js/index-j9YvpyYe.js","assets/js/ui-vendor-dYn1tJGA.js","assets/js/mermaid-CWQI515T.js","assets/js/vendor-B1Lfatlz.js","assets/css/vendor-DX3NCGtF.css","assets/js/vue-vendor-DZ4A_GHn.js","assets/css/vue-vendor-WE_HbAyV.css","assets/js/system-BHEG2KFs.js","assets/css/index-C-LxXPm3.css","assets/css/LoginView-IIrJ_GoG.css","assets/js/ChatView-CJ5xzaMG.js","assets/js/TerminalPanel-CeRILXkF.js","assets/js/xterm-CraVE7U3.js","assets/css/xterm-sLQPUA_C.css","assets/css/TerminalPanel-BxkUIUNe.css","assets/js/FileRenameModal-yIh1kICM.js","assets/js/monaco-editor-YM0cdSGX.js","assets/css/monaco-editor-DPqmyJk4.css","assets/js/MarkdownRenderer-THTJMUql.js","assets/js/clipboard-1NPxC3YL.js","assets/css/MarkdownRenderer-Bu1ravZB.css","assets/css/FileRenameModal-Bw_Ko0hp.css","assets/js/useSttSettings-Cqov9Pdt.js","assets/js/ttsHelpers-CzQCvABU.js","assets/js/MessageItem-C09jnu6X.js","assets/css/MessageItem-D64Zn7IM.css","assets/js/OutlinePanel-HsWM7mLO.js","assets/css/OutlinePanel-B51GOew8.css","assets/js/VirtualMessageList-Dty9wvSA.js","assets/css/VirtualMessageList-CcNUGYX2.css","assets/js/session-browser-prefs-BHcPARE8.js","assets/css/ChatView-CDaw_MTN.css","assets/js/HistoryView-CIZhEOTj.js","assets/js/HistoryMessageList-63JhmxYI.js","assets/css/HistoryMessageList-CclLeIKr.css","assets/css/HistoryView-Xczi6ZUK.css","assets/js/JobsView-lL7xjV0S.js","assets/css/JobsView-Cee7ajYc.css","assets/js/KanbanView-qn0UtlHi.js","assets/css/KanbanView-CrXMhPna.css","assets/js/ModelsView-D9xMGX4E.js","assets/js/models-ChbKk2Oo.js","assets/css/ModelsView-bY11vK7a.css","assets/js/ProfilesView-DEI5M20S.js","assets/css/ProfilesView-CoEv7kNy.css","assets/js/LogsView-BSvpf5U4.js","assets/css/LogsView-CMxhihg_.css","assets/js/UsageView-BuPt2L6B.js","assets/css/UsageView-Bynio95y.css","assets/js/PerformanceView-BTqaCcZT.js","assets/css/PerformanceView-Dn2GtW7Y.css","assets/js/SkillsUsageView-DurYN8k5.js","assets/js/skills-Fvhr-K4b.js","assets/css/SkillsUsageView-DI5G1isc.css","assets/js/SkillsView-CMkth-Fm.js","assets/css/SkillsView-BkR9Cpj7.css","assets/js/PluginsView-CRYHgkbM.js","assets/css/PluginsView-Ba01BGn6.css","assets/js/MemoryView-CnEwNN35.js","assets/css/MemoryView-D4KbI4DT.css","assets/js/SettingsView-CE9zvzef.js","assets/js/SettingRow-BlmnHYa0.js","assets/css/SettingRow-BU_KTQ5j.css","assets/css/SettingsView-D1yfQHHJ.css","assets/js/ChannelsView-DNfeMm-1.js","assets/css/ChannelsView-CNjHdgx7.css","assets/js/TerminalView-BOCX7lvf.js","assets/css/TerminalView-k1bjf-Lu.css","assets/js/DevicesView-_WSWarB0.js","assets/css/DevicesView-DCL8DVxE.css","assets/js/GroupChatView-CMMdH9qi.js","assets/css/GroupChatView-Dli0ky8y.css","assets/js/FilesView-COieCqv9.js","assets/css/FilesView-DKhQkHBw.css","assets/js/CodingAgentsView-Dvtip0gX.js","assets/css/CodingAgentsView-Dw6IMlYi.css","assets/js/VersionPreviewView-DQyROuWd.js","assets/css/VersionPreviewView-BZm7MZcY.css","assets/js/McpManagerView-CA1rzPZs.js","assets/css/McpManagerView-k-CYIs7F.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/js/LoginView-Dc3El_qw.js","assets/js/rolldown-runtime-M0oDzQ_3.js","assets/js/index-Bkiif2Pf.js","assets/js/ui-vendor-dYn1tJGA.js","assets/js/mermaid-CWQI515T.js","assets/js/vendor-B1Lfatlz.js","assets/css/vendor-DX3NCGtF.css","assets/js/vue-vendor-DZ4A_GHn.js","assets/css/vue-vendor-WE_HbAyV.css","assets/js/system-Bm5rA-WZ.js","assets/css/index-C-LxXPm3.css","assets/css/LoginView-IIrJ_GoG.css","assets/js/ChatView-BBWSbOTc.js","assets/js/TerminalPanel-DVuhjZrt.js","assets/js/xterm-CraVE7U3.js","assets/css/xterm-sLQPUA_C.css","assets/css/TerminalPanel-BxkUIUNe.css","assets/js/FileRenameModal-CEFCYODC.js","assets/js/monaco-editor-YM0cdSGX.js","assets/css/monaco-editor-DPqmyJk4.css","assets/js/MarkdownRenderer-DZb1wMbL.js","assets/js/clipboard-1NPxC3YL.js","assets/css/MarkdownRenderer-Bu1ravZB.css","assets/css/FileRenameModal-Bw_Ko0hp.css","assets/js/useSttSettings-DEm4lbwe.js","assets/js/ttsHelpers-CzQCvABU.js","assets/js/MessageItem-CVPb7Btj.js","assets/css/MessageItem-D64Zn7IM.css","assets/js/OutlinePanel-C_mZy_cq.js","assets/css/OutlinePanel-B51GOew8.css","assets/js/VirtualMessageList-ftkWv6i1.js","assets/css/VirtualMessageList-CcNUGYX2.css","assets/js/session-browser-prefs-Byq_ViZP.js","assets/css/ChatView-CDaw_MTN.css","assets/js/HistoryView-DYCFFpGg.js","assets/js/HistoryMessageList-B2QMRyzN.js","assets/css/HistoryMessageList-CclLeIKr.css","assets/css/HistoryView-Xczi6ZUK.css","assets/js/JobsView-B-iy-ie4.js","assets/css/JobsView-Cee7ajYc.css","assets/js/KanbanView-C0rUTSNF.js","assets/css/KanbanView-CrXMhPna.css","assets/js/ModelsView-CVsIIan4.js","assets/js/models-BxWy-mRj.js","assets/css/ModelsView-bY11vK7a.css","assets/js/ProfilesView-B_g8Q3Cy.js","assets/css/ProfilesView-CoEv7kNy.css","assets/js/LogsView-DwyBT7qp.js","assets/css/LogsView-CMxhihg_.css","assets/js/UsageView-C6M2Id1b.js","assets/css/UsageView-Bynio95y.css","assets/js/PerformanceView-CVfmqAtJ.js","assets/css/PerformanceView-Dn2GtW7Y.css","assets/js/SkillsUsageView-KLg_9UJX.js","assets/js/skills-aFq9azFz.js","assets/css/SkillsUsageView-DI5G1isc.css","assets/js/SkillsView-O7EXzlgA.js","assets/css/SkillsView-BkR9Cpj7.css","assets/js/PluginsView-DyuTCtts.js","assets/css/PluginsView-Ba01BGn6.css","assets/js/MemoryView-CI2_Cy3L.js","assets/css/MemoryView-D4KbI4DT.css","assets/js/SettingsView-w0qkQi4m.js","assets/js/SettingRow-BMYsP5uq.js","assets/css/SettingRow-BU_KTQ5j.css","assets/css/SettingsView-D1yfQHHJ.css","assets/js/ChannelsView-BhvSQz3q.js","assets/css/ChannelsView-CNjHdgx7.css","assets/js/TerminalView-DVRlT_-o.js","assets/css/TerminalView-k1bjf-Lu.css","assets/js/DevicesView-gWT295OX.js","assets/css/DevicesView-DCL8DVxE.css","assets/js/GroupChatView-DN8mpn70.js","assets/css/GroupChatView-Dli0ky8y.css","assets/js/FilesView-ClheDLjZ.js","assets/css/FilesView-DKhQkHBw.css","assets/js/CodingAgentsView-TsPWnQ-e.js","assets/css/CodingAgentsView-Dw6IMlYi.css","assets/js/VersionPreviewView-wn0OxFjS.js","assets/css/VersionPreviewView-BZm7MZcY.css","assets/js/McpManagerView-Dr_hv62e.js","assets/css/McpManagerView-k-CYIs7F.css"])))=>i.map(i=>d[i]);
2
2
  import{n as h}from"./rolldown-runtime-M0oDzQ_3.js";import{d as y,f as I,u as P}from"./vue-vendor-DZ4A_GHn.js";import{B as R,z as r}from"./mermaid-CWQI515T.js";function D(){return typeof window<"u"&&window.hermesDesktop?.isDesktop===!0}function A(){return D()?c:localStorage.getItem("hermes_server_url")||c}function m(){return localStorage.getItem("hermes_api_key")||""}function j(e){localStorage.setItem("hermes_api_key",e)}function d(){localStorage.removeItem("hermes_api_key")}function E(){return!!m()}function O(){const e=m().split(".")[1];if(!e)return null;try{const n=e.replace(/-/g,"+").replace(/_/g,"/"),t=n.padEnd(Math.ceil(n.length/4)*4,"="),s=JSON.parse(atob(t));return s.role==="super_admin"||s.role==="admin"?s.role:null}catch{return null}}function L(){return O()==="super_admin"}function q(){const e=m().split(".")[1];if(!e)return null;try{const n=e.replace(/-/g,"+").replace(/_/g,"/"),t=n.padEnd(Math.ceil(n.length/4)*4,"="),s=JSON.parse(atob(t));return typeof s.username=="string"&&s.username.length>0?s.username:null}catch{return null}}function T(){return localStorage.getItem("hermes_active_profile_name")}function V(e){if(typeof e!="string")return!1;try{const n=JSON.parse(e);return typeof n?.profile=="string"&&n.profile.trim().length>0}catch{return!1}}function S(e,n){try{const t=new URL(e,"http://hermes.local");if(t.searchParams.has("profile")||t.pathname.startsWith("/api/hermes/profiles")||g(t.pathname))return!1}catch{if(e.startsWith("/api/hermes/profiles")||g(e.split("?")[0]||e))return!1}return!V(n.body)}function g(e){return e==="/api/hermes/sessions"||e==="/api/hermes/sessions/batch-delete"||e==="/api/hermes/search/sessions"||e==="/api/hermes/sessions/search"||e==="/api/hermes/sessions/conversations"}function _(e){typeof window>"u"||window.dispatchEvent(new CustomEvent("hermes-auth-notice",{detail:{kind:e}}))}function p(e){if(typeof e=="string")return e;if(e==null)return"";if(typeof e!="object")return String(e);const n=e;for(const t of["message","error","detail","description"]){const s=p(n[t]);if(s)return s}if(Array.isArray(e))return e.map(p).filter(Boolean).join(`
3
- `);try{return JSON.stringify(e)}catch{return String(e)}}function v(e,n){const t=e.trim();if(!t)return n;try{return p(JSON.parse(t))||t}catch{return t}}async function W(e,n={}){const t=`${A()}${e}`,s={...typeof FormData<"u"&&n.body instanceof FormData?{}:{"Content-Type":"application/json"},...n.headers},a=m();a&&(s.Authorization=`Bearer ${a}`);const u=T();u&&S(e,n)&&(s["X-Hermes-Profile"]=u);const o=await fetch(t,{...n,headers:s}),l=!e.startsWith("/api/hermes/v1/")&&!e.startsWith("/v1/");if(o.status===401&&l)throw d(),_("expired"),i.currentRoute.value.name!=="login"&&i.replace({name:"login"}),new Error("Unauthorized");if(!o.ok){const f=await o.text().catch(()=>"");throw o.status===403&&l&&(f.includes("User is disabled or does not exist")?(d(),_("expired"),i.currentRoute.value.name!=="login"&&i.replace({name:"login"})):_("forbidden")),new Error(`API Error ${o.status}: ${v(f,o.statusText)}`)}return o.json()}function x(){return A()}var c,w=h((()=>{b(),c=""})),i,b=h((()=>{I(),w(),R(),i=P({history:y(),routes:[{path:"/",name:"login",component:()=>r(()=>import("./LoginView-63v15BI4.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])),meta:{public:!0}},{path:"/hermes/chat",name:"hermes.chat",component:()=>r(()=>import("./ChatView-CJ5xzaMG.js"),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33]))},{path:"/hermes/session/:sessionId",name:"hermes.session",component:()=>r(()=>import("./ChatView-CJ5xzaMG.js"),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33]))},{path:"/hermes/history",name:"hermes.history",component:()=>r(()=>import("./HistoryView-CIZhEOTj.js"),__vite__mapDeps([34,1,2,3,4,5,6,7,8,9,10,35,26,25,20,21,22,27,30,31,36,28,29,32,37]))},{path:"/hermes/history/session/:sessionId",name:"hermes.historySession",component:()=>r(()=>import("./HistoryView-CIZhEOTj.js"),__vite__mapDeps([34,1,2,3,4,5,6,7,8,9,10,35,26,25,20,21,22,27,30,31,36,28,29,32,37]))},{path:"/hermes/jobs",name:"hermes.jobs",component:()=>r(()=>import("./JobsView-lL7xjV0S.js"),__vite__mapDeps([38,1,2,3,4,5,6,7,8,9,10,20,21,22,39]))},{path:"/hermes/kanban",name:"hermes.kanban",component:()=>r(()=>import("./KanbanView-qn0UtlHi.js"),__vite__mapDeps([40,1,2,3,4,5,6,7,8,9,10,35,26,25,20,21,22,27,30,31,36,41]))},{path:"/hermes/models",name:"hermes.models",component:()=>r(()=>import("./ModelsView-D9xMGX4E.js"),__vite__mapDeps([42,1,2,3,4,5,6,7,8,9,10,43,21,44]))},{path:"/hermes/profiles",name:"hermes.profiles",component:()=>r(()=>import("./ProfilesView-DEI5M20S.js"),__vite__mapDeps([45,1,2,3,4,5,6,7,8,9,10,46])),meta:{requiresSuperAdmin:!0}},{path:"/hermes/logs",name:"hermes.logs",component:()=>r(()=>import("./LogsView-BSvpf5U4.js"),__vite__mapDeps([47,1,3,4,7,5,6,8,48]))},{path:"/hermes/usage",name:"hermes.usage",component:()=>r(()=>import("./UsageView-BuPt2L6B.js"),__vite__mapDeps([49,1,2,3,4,5,6,7,8,9,10,50]))},{path:"/hermes/performance",name:"hermes.performance",component:()=>r(()=>import("./PerformanceView-BTqaCcZT.js"),__vite__mapDeps([51,1,3,4,7,5,6,8,52])),meta:{requiresSuperAdmin:!0}},{path:"/hermes/skills-usage",name:"hermes.skillsUsage",component:()=>r(()=>import("./SkillsUsageView-DurYN8k5.js"),__vite__mapDeps([53,1,2,3,4,5,6,7,8,9,10,54,55]))},{path:"/hermes/skills",name:"hermes.skills",component:()=>r(()=>import("./SkillsView-CMkth-Fm.js"),__vite__mapDeps([56,1,2,3,4,5,6,7,8,9,10,54,20,21,22,57]))},{path:"/hermes/plugins",name:"hermes.plugins",component:()=>r(()=>import("./PluginsView-CRYHgkbM.js"),__vite__mapDeps([58,1,2,3,4,5,6,7,8,9,10,59]))},{path:"/hermes/memory",name:"hermes.memory",component:()=>r(()=>import("./MemoryView-CnEwNN35.js"),__vite__mapDeps([60,1,2,3,4,5,6,7,8,9,10,54,20,21,22,61]))},{path:"/hermes/settings",name:"hermes.settings",component:()=>r(()=>import("./SettingsView-CE9zvzef.js"),__vite__mapDeps([62,1,2,3,4,5,6,7,8,9,10,24,25,63,64,43,32,65]))},{path:"/hermes/channels",name:"hermes.channels",component:()=>r(()=>import("./ChannelsView-DNfeMm-1.js"),__vite__mapDeps([66,1,2,3,4,5,6,7,8,9,10,63,64,67]))},{path:"/hermes/terminal",name:"hermes.terminal",component:()=>r(()=>import("./TerminalView-BOCX7lvf.js"),__vite__mapDeps([68,1,3,4,14,15,7,5,6,8,69]))},{path:"/hermes/devices",name:"hermes.devices",component:()=>r(()=>import("./DevicesView-_WSWarB0.js"),__vite__mapDeps([70,1,3,4,7,5,6,8,71]))},{path:"/hermes/group-chat",name:"hermes.groupChat",component:()=>r(()=>import("./GroupChatView-CMMdH9qi.js"),__vite__mapDeps([72,1,2,3,4,5,6,7,8,9,10,25,20,21,22,30,31,73]))},{path:"/hermes/group-chat/room/:roomId",name:"hermes.groupChatRoom",component:()=>r(()=>import("./GroupChatView-CMMdH9qi.js"),__vite__mapDeps([72,1,2,3,4,5,6,7,8,9,10,25,20,21,22,30,31,73]))},{path:"/hermes/files",name:"hermes.files",component:()=>r(()=>import("./FilesView-COieCqv9.js"),__vite__mapDeps([74,1,2,3,4,5,6,7,8,9,10,17,18,19,20,21,22,23,75]))},{path:"/hermes/coding-agents",name:"hermes.codingAgents",component:()=>r(()=>import("./CodingAgentsView-Dvtip0gX.js"),__vite__mapDeps([76,1,2,3,4,5,6,7,8,9,10,13,14,15,16,77]))},{path:"/hermes/version-preview",name:"hermes.versionPreview",component:()=>r(()=>import("./VersionPreviewView-DQyROuWd.js"),__vite__mapDeps([78,1,3,4,7,5,6,8,9,79])),meta:{requiresSuperAdmin:!0}},{path:"/hermes/mcp",name:"hermes.mcp",component:()=>r(()=>import("./McpManagerView-CA1rzPZs.js"),__vite__mapDeps([80,1,3,4,5,6,7,8,81])),meta:{requiresSuperAdmin:!0}}]}),i.beforeEach((e,n,t)=>{if(e.meta.public){if(e.name==="login"&&E()){t({path:"/hermes/chat"});return}t();return}if(!E()){t({name:"login"});return}if(e.meta.requiresSuperAdmin&&!L()){t({name:"hermes.chat"});return}t()})})),k,z=h((()=>{k=(e,n)=>{const t=e.__vccOpts||e;for(const[s,a]of n)t[s]=a;return t}}));export{T as a,q as c,L as d,W as f,i,E as l,z as n,m as o,j as p,b as r,x as s,k as t,w as u};
3
+ `);try{return JSON.stringify(e)}catch{return String(e)}}function v(e,n){const t=e.trim();if(!t)return n;try{return p(JSON.parse(t))||t}catch{return t}}async function W(e,n={}){const t=`${A()}${e}`,s={...typeof FormData<"u"&&n.body instanceof FormData?{}:{"Content-Type":"application/json"},...n.headers},a=m();a&&(s.Authorization=`Bearer ${a}`);const u=T();u&&S(e,n)&&(s["X-Hermes-Profile"]=u);const o=await fetch(t,{...n,headers:s}),l=!e.startsWith("/api/hermes/v1/")&&!e.startsWith("/v1/");if(o.status===401&&l)throw d(),_("expired"),i.currentRoute.value.name!=="login"&&i.replace({name:"login"}),new Error("Unauthorized");if(!o.ok){const f=await o.text().catch(()=>"");throw o.status===403&&l&&(f.includes("User is disabled or does not exist")?(d(),_("expired"),i.currentRoute.value.name!=="login"&&i.replace({name:"login"})):_("forbidden")),new Error(`API Error ${o.status}: ${v(f,o.statusText)}`)}return o.json()}function x(){return A()}var c,w=h((()=>{b(),c=""})),i,b=h((()=>{I(),w(),R(),i=P({history:y(),routes:[{path:"/",name:"login",component:()=>r(()=>import("./LoginView-Dc3El_qw.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])),meta:{public:!0}},{path:"/hermes/chat",name:"hermes.chat",component:()=>r(()=>import("./ChatView-BBWSbOTc.js"),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33]))},{path:"/hermes/session/:sessionId",name:"hermes.session",component:()=>r(()=>import("./ChatView-BBWSbOTc.js"),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33]))},{path:"/hermes/history",name:"hermes.history",component:()=>r(()=>import("./HistoryView-DYCFFpGg.js"),__vite__mapDeps([34,1,2,3,4,5,6,7,8,9,10,35,26,25,20,21,22,27,30,31,36,28,29,32,37]))},{path:"/hermes/history/session/:sessionId",name:"hermes.historySession",component:()=>r(()=>import("./HistoryView-DYCFFpGg.js"),__vite__mapDeps([34,1,2,3,4,5,6,7,8,9,10,35,26,25,20,21,22,27,30,31,36,28,29,32,37]))},{path:"/hermes/jobs",name:"hermes.jobs",component:()=>r(()=>import("./JobsView-B-iy-ie4.js"),__vite__mapDeps([38,1,2,3,4,5,6,7,8,9,10,20,21,22,39]))},{path:"/hermes/kanban",name:"hermes.kanban",component:()=>r(()=>import("./KanbanView-C0rUTSNF.js"),__vite__mapDeps([40,1,2,3,4,5,6,7,8,9,10,35,26,25,20,21,22,27,30,31,36,41]))},{path:"/hermes/models",name:"hermes.models",component:()=>r(()=>import("./ModelsView-CVsIIan4.js"),__vite__mapDeps([42,1,2,3,4,5,6,7,8,9,10,43,21,44]))},{path:"/hermes/profiles",name:"hermes.profiles",component:()=>r(()=>import("./ProfilesView-B_g8Q3Cy.js"),__vite__mapDeps([45,1,2,3,4,5,6,7,8,9,10,46])),meta:{requiresSuperAdmin:!0}},{path:"/hermes/logs",name:"hermes.logs",component:()=>r(()=>import("./LogsView-DwyBT7qp.js"),__vite__mapDeps([47,1,3,4,7,5,6,8,48]))},{path:"/hermes/usage",name:"hermes.usage",component:()=>r(()=>import("./UsageView-C6M2Id1b.js"),__vite__mapDeps([49,1,2,3,4,5,6,7,8,9,10,50]))},{path:"/hermes/performance",name:"hermes.performance",component:()=>r(()=>import("./PerformanceView-CVfmqAtJ.js"),__vite__mapDeps([51,1,3,4,7,5,6,8,52])),meta:{requiresSuperAdmin:!0}},{path:"/hermes/skills-usage",name:"hermes.skillsUsage",component:()=>r(()=>import("./SkillsUsageView-KLg_9UJX.js"),__vite__mapDeps([53,1,2,3,4,5,6,7,8,9,10,54,55]))},{path:"/hermes/skills",name:"hermes.skills",component:()=>r(()=>import("./SkillsView-O7EXzlgA.js"),__vite__mapDeps([56,1,2,3,4,5,6,7,8,9,10,54,20,21,22,57]))},{path:"/hermes/plugins",name:"hermes.plugins",component:()=>r(()=>import("./PluginsView-DyuTCtts.js"),__vite__mapDeps([58,1,2,3,4,5,6,7,8,9,10,59]))},{path:"/hermes/memory",name:"hermes.memory",component:()=>r(()=>import("./MemoryView-CI2_Cy3L.js"),__vite__mapDeps([60,1,2,3,4,5,6,7,8,9,10,54,20,21,22,61]))},{path:"/hermes/settings",name:"hermes.settings",component:()=>r(()=>import("./SettingsView-w0qkQi4m.js"),__vite__mapDeps([62,1,2,3,4,5,6,7,8,9,10,24,25,63,64,43,32,65]))},{path:"/hermes/channels",name:"hermes.channels",component:()=>r(()=>import("./ChannelsView-BhvSQz3q.js"),__vite__mapDeps([66,1,2,3,4,5,6,7,8,9,10,63,64,67]))},{path:"/hermes/terminal",name:"hermes.terminal",component:()=>r(()=>import("./TerminalView-DVRlT_-o.js"),__vite__mapDeps([68,1,3,4,14,15,7,5,6,8,69]))},{path:"/hermes/devices",name:"hermes.devices",component:()=>r(()=>import("./DevicesView-gWT295OX.js"),__vite__mapDeps([70,1,3,4,7,5,6,8,71]))},{path:"/hermes/group-chat",name:"hermes.groupChat",component:()=>r(()=>import("./GroupChatView-DN8mpn70.js"),__vite__mapDeps([72,1,2,3,4,5,6,7,8,9,10,25,20,21,22,30,31,73]))},{path:"/hermes/group-chat/room/:roomId",name:"hermes.groupChatRoom",component:()=>r(()=>import("./GroupChatView-DN8mpn70.js"),__vite__mapDeps([72,1,2,3,4,5,6,7,8,9,10,25,20,21,22,30,31,73]))},{path:"/hermes/files",name:"hermes.files",component:()=>r(()=>import("./FilesView-ClheDLjZ.js"),__vite__mapDeps([74,1,2,3,4,5,6,7,8,9,10,17,18,19,20,21,22,23,75]))},{path:"/hermes/coding-agents",name:"hermes.codingAgents",component:()=>r(()=>import("./CodingAgentsView-TsPWnQ-e.js"),__vite__mapDeps([76,1,2,3,4,5,6,7,8,9,10,13,14,15,16,77]))},{path:"/hermes/version-preview",name:"hermes.versionPreview",component:()=>r(()=>import("./VersionPreviewView-wn0OxFjS.js"),__vite__mapDeps([78,1,3,4,7,5,6,8,9,79])),meta:{requiresSuperAdmin:!0}},{path:"/hermes/mcp",name:"hermes.mcp",component:()=>r(()=>import("./McpManagerView-Dr_hv62e.js"),__vite__mapDeps([80,1,3,4,5,6,7,8,81])),meta:{requiresSuperAdmin:!0}}]}),i.beforeEach((e,n,t)=>{if(e.meta.public){if(e.name==="login"&&E()){t({path:"/hermes/chat"});return}t();return}if(!E()){t({name:"login"});return}if(e.meta.requiresSuperAdmin&&!L()){t({name:"hermes.chat"});return}t()})})),k,z=h((()=>{k=(e,n)=>{const t=e.__vccOpts||e;for(const[s,a]of n)t[s]=a;return t}}));export{T as a,q as c,L as d,W as f,i,E as l,z as n,m as o,j as p,b as r,x as s,k as t,w as u};