hermes-web-ui 0.6.0-beta.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/client/assets/js/{ChannelsView-9bNGmPOL.js → ChannelsView-CvORJMzg.js} +1 -1
  2. package/dist/client/assets/js/{ChatView-CrMN1j5u.js → ChatView-DihfBNUf.js} +1 -1
  3. package/dist/client/assets/js/{FileRenameModal-C4oWOgjw.js → FileRenameModal-DN-U6DZT.js} +1 -1
  4. package/dist/client/assets/js/{FilesView-pDP8mSTZ.js → FilesView-BxW5kOlO.js} +1 -1
  5. package/dist/client/assets/js/{GroupChatView-BV3Dxn4i.js → GroupChatView-Cdyg0EOz.js} +1 -1
  6. package/dist/client/assets/js/{HistoryMessageList-CHk-rOIr.js → HistoryMessageList-S77rD1zj.js} +1 -1
  7. package/dist/client/assets/js/{HistoryView-RE-m9Yx6.js → HistoryView-DM7qDtZb.js} +1 -1
  8. package/dist/client/assets/js/{JobsView-BkXCTE4b.js → JobsView-BqylpVBm.js} +1 -1
  9. package/dist/client/assets/js/{KanbanView-Bwlm-lFI.js → KanbanView-C8uXrTRt.js} +1 -1
  10. package/dist/client/assets/js/{LoginView-Cil7q9fA.js → LoginView-ISxozFfh.js} +1 -1
  11. package/dist/client/assets/js/{LogsView-BRXZpNpB.js → LogsView-CtCOjFb5.js} +1 -1
  12. package/dist/client/assets/js/{MarkdownRenderer-BbsOzYq-.js → MarkdownRenderer-BJbqsrMI.js} +1 -1
  13. package/dist/client/assets/js/{MemoryView-BeY8xybk.js → MemoryView-Bc-a9i1U.js} +1 -1
  14. package/dist/client/assets/js/{MessageItem-DWHvbLzg.js → MessageItem-DOA2nFJg.js} +1 -1
  15. package/dist/client/assets/js/{ModelsView-C33B9WXE.js → ModelsView-CmcXLgHA.js} +1 -1
  16. package/dist/client/assets/js/{OutlinePanel-CxJshR71.js → OutlinePanel-D2LVzKPs.js} +1 -1
  17. package/dist/client/assets/js/{PerformanceView-Bcs2X6p5.js → PerformanceView-BIMfq0BU.js} +1 -1
  18. package/dist/client/assets/js/{PluginsView-ClPgLZw1.js → PluginsView-DfSS_RTl.js} +1 -1
  19. package/dist/client/assets/js/{ProfilesView-C4kzKN1z.js → ProfilesView-CVh7LT-n.js} +1 -1
  20. package/dist/client/assets/js/{SettingRow-BAmGrtcn.js → SettingRow-Dt5XWkpQ.js} +1 -1
  21. package/dist/client/assets/js/{SettingsView-BuKFsiAz.js → SettingsView-hA4C1YcG.js} +1 -1
  22. package/dist/client/assets/js/{SkillsUsageView-CRcgWp1p.js → SkillsUsageView-_ToBXkb1.js} +1 -1
  23. package/dist/client/assets/js/{SkillsView-B2j4jJMz.js → SkillsView-DMUkyn3M.js} +1 -1
  24. package/dist/client/assets/js/{TerminalView-0vvlfSha.js → TerminalView-CS_MwrJD.js} +1 -1
  25. package/dist/client/assets/js/{UsageView-3v8bYw4Z.js → UsageView-D6o-9cR-.js} +1 -1
  26. package/dist/client/assets/js/{_plugin-vue_export-helper-B8gz9Iqn.js → _plugin-vue_export-helper-CHoatqkO.js} +2 -2
  27. package/dist/client/assets/js/{index-Cuk9R8hy.js → index-DpU5R9KV.js} +1 -1
  28. package/dist/client/assets/js/{models-Of46_lGf.js → models-CDdUhb_e.js} +1 -1
  29. package/dist/client/assets/js/profiles-CyjgPK1f.js +1 -0
  30. package/dist/client/assets/js/{session-browser-prefs-IGK7Xpdn.js → session-browser-prefs-C6G-jnbR.js} +1 -1
  31. package/dist/client/assets/js/{skills-BQ2jtPxK.js → skills-vuknhTFJ.js} +1 -1
  32. package/dist/client/index.html +3 -3
  33. package/dist/server/index.js +2 -2
  34. package/dist/server/index.js.map +1 -1
  35. package/package.json +1 -1
  36. package/dist/client/assets/js/profiles-DiEn61KW.js +0 -1
@@ -1 +1 @@
1
- import{n as w}from"./rolldown-runtime-BKwlnUi0.js";import{A as N,Bt as jt,Ct as Gt,Ht as h,I as H,Nt as qt,Pt as P,Q as Z,S as oe,Tt as n,U as Xt,V as ne,W as D,X as ue,at as U,bt as Ut,c as M,ct as s,d as Pt,dt as A,f as $,gt as te,h as de,it as K,l as xt,lt as I,m as re,nt as y,o as Qt,p as J,rt as ee,s as W,st as z,t as F,tt as se,u as ve,vt as S,w as Zt,y as Y,z as k,zt as e}from"./ui-vendor-BMwF7QXa.js";import{c as es,n as R,o as ts,r as L,s as ss}from"./vue-vendor-kBYBtqCg.js";import{l as as,n as B,t as O,u as ls}from"./_plugin-vue_export-helper-B8gz9Iqn.js";import{g as ce,p as is,r as ns,t as os}from"./profiles-DiEn61KW.js";import{H as us,U as rs,b as G,c as ds,d as vs,f as cs,i as ps,l as Ht,n as ms,o as _s,p as pe,r as gs,s as hs,t as fs,y as q}from"./index-Cuk9R8hy.js";import{n as X,t as _}from"./SettingRow-BAmGrtcn.js";import{n as ys,t as bs}from"./session-browser-prefs-IGK7Xpdn.js";import{a as ws,c as Ss,i as Us,n as Ps,o as xs,r as me,t as _e}from"./ttsHelpers-CEvJOgh2.js";import{n as Hs,t as ks}from"./models-Of46_lGf.js";var ge,kt,he=w((()=>{D(),F(),R(),q(),us(),X(),ge={class:"settings-section"},kt=I({__name:"DisplaySettings",setup(E){const t=G(),a=Y(),{t:l}=L(),{brightness:u,setBrightness:m}=rs(),f=[{label:l("settings.display.themeLight"),value:"light"},{label:l("settings.display.themeDark"),value:"dark"},{label:l("settings.display.themeSystem"),value:"system"}];async function r(i){try{await t.saveSection("display",i),a.success(l("settings.saved"))}catch{a.error(l("settings.saveFailed"))}}function v(i){const o=i;m(o),r({skin:o})}return(i,o)=>(S(),U("section",ge,[s(_,{label:e(l)("settings.display.theme"),hint:e(l)("settings.display.themeHint")},{default:n(()=>[s(e(N),{value:e(u),options:f,size:"small","consistent-menu-width":!1,class:"input-sm","onUpdate:value":v},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.display.streaming"),hint:e(l)("settings.display.streamingHint")},{default:n(()=>[s(e(M),{value:e(t).display.streaming,"onUpdate:value":o[0]||(o[0]=p=>r({streaming:p}))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.display.compact"),hint:e(l)("settings.display.compactHint")},{default:n(()=>[s(e(M),{value:e(t).display.compact,"onUpdate:value":o[1]||(o[1]=p=>r({compact:p}))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.display.showReasoning"),hint:e(l)("settings.display.showReasoningHint")},{default:n(()=>[s(e(M),{value:e(t).display.show_reasoning,"onUpdate:value":o[2]||(o[2]=p=>r({show_reasoning:p}))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.display.showCost"),hint:e(l)("settings.display.showCostHint")},{default:n(()=>[s(e(M),{value:e(t).display.show_cost,"onUpdate:value":o[3]||(o[3]=p=>r({show_cost:p}))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.display.inlineDiffs"),hint:e(l)("settings.display.inlineDiffsHint")},{default:n(()=>[s(e(M),{value:e(t).display.inline_diffs,"onUpdate:value":o[4]||(o[4]=p=>r({inline_diffs:p}))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.display.bellOnComplete"),hint:e(l)("settings.display.bellOnCompleteHint")},{default:n(()=>[s(e(M),{value:e(t).display.bell_on_complete,"onUpdate:value":o[5]||(o[5]=p=>r({bell_on_complete:p}))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.display.busyInputMode"),hint:e(l)("settings.display.busyInputModeHint")},{default:n(()=>[s(e(M),{value:e(t).display.busy_input_mode==="interrupt","onUpdate:value":o[6]||(o[6]=p=>r({busy_input_mode:p?"interrupt":"off"}))},null,8,["value"])]),_:1},8,["label","hint"])]))}})})),zs=w((()=>{})),zt,Cs=w((()=>{he(),he(),zs(),B(),zt=O(kt,[["__scopeId","data-v-e5486815"]])})),fe,Ct,ye=w((()=>{D(),F(),R(),q(),X(),fe={class:"settings-section"},Ct=I({__name:"AgentSettings",setup(E){const t=G(),a=Y(),{t:l}=L(),u={};function m(r){t.updateLocal("agent",r),t.saveSection("agent",r).then(()=>{a.success(l("settings.saved"))}).catch(()=>{a.error(l("settings.saveFailed"))})}function f(r,v){t.updateLocal("agent",{[r]:v}),u[r]&&clearTimeout(u[r]),u[r]=setTimeout(async()=>{try{await t.saveSection("agent",{[r]:v}),a.success(l("settings.saved"))}catch{a.error(l("settings.saveFailed"))}},300)}return(r,v)=>(S(),U("section",fe,[s(_,{label:e(l)("settings.agent.maxTurns"),hint:e(l)("settings.agent.maxTurnsHint")},{default:n(()=>[s(e($),{value:e(t).agent.max_turns,min:1,max:200,step:5,size:"small",class:"input-sm","onUpdate:value":v[0]||(v[0]=i=>i!=null&&f("max_turns",i))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.agent.gatewayTimeout"),hint:e(l)("settings.agent.gatewayTimeoutHint")},{default:n(()=>[s(e($),{value:e(t).agent.gateway_timeout,min:60,max:7200,step:60,size:"small",class:"input-sm","onUpdate:value":v[1]||(v[1]=i=>i!=null&&f("gateway_timeout",i))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.agent.restartDrainTimeout"),hint:e(l)("settings.agent.restartDrainTimeoutHint")},{default:n(()=>[s(e($),{value:e(t).agent.restart_drain_timeout,min:10,max:300,step:10,size:"small",class:"input-sm","onUpdate:value":v[2]||(v[2]=i=>i!=null&&f("restart_drain_timeout",i))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.agent.toolEnforcement"),hint:e(l)("settings.agent.toolEnforcementHint")},{default:n(()=>[s(e(N),{value:e(t).agent.tool_use_enforcement||"auto",options:[{label:e(l)("settings.agent.auto"),value:"auto"},{label:e(l)("settings.agent.always"),value:"always"},{label:e(l)("settings.agent.never"),value:"never"}],size:"small",class:"input-sm","onUpdate:value":v[3]||(v[3]=i=>m({tool_use_enforcement:i}))},null,8,["value","options"])]),_:1},8,["label","hint"])]))}})})),Ns=w((()=>{})),Nt,Ms=w((()=>{ye(),ye(),Ns(),B(),Nt=O(Ct,[["__scopeId","data-v-d06d83a7"]])})),be,Mt,we=w((()=>{D(),F(),R(),q(),X(),be={class:"settings-section"},Mt=I({__name:"MemorySettings",setup(E){const t=G(),a=Y(),{t:l}=L(),u={};function m(r){t.updateLocal("memory",r),t.saveSection("memory",r).then(()=>{a.success(l("settings.saved"))}).catch(()=>{a.error(l("settings.saveFailed"))})}function f(r,v){t.updateLocal("memory",{[r]:v}),u[r]&&clearTimeout(u[r]),u[r]=setTimeout(async()=>{try{await t.saveSection("memory",{[r]:v}),a.success(l("settings.saved"))}catch{a.error(l("settings.saveFailed"))}},300)}return(r,v)=>(S(),U("section",be,[s(_,{label:e(l)("settings.memory.enabled"),hint:e(l)("settings.memory.enabledHint")},{default:n(()=>[s(e(M),{value:e(t).memory.memory_enabled,"onUpdate:value":v[0]||(v[0]=i=>m({memory_enabled:i}))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.memory.userProfile"),hint:e(l)("settings.memory.userProfileHint")},{default:n(()=>[s(e(M),{value:e(t).memory.user_profile_enabled,"onUpdate:value":v[1]||(v[1]=i=>m({user_profile_enabled:i}))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.memory.charLimit"),hint:e(l)("settings.memory.charLimitHint")},{default:n(()=>[s(e($),{value:e(t).memory.memory_char_limit,min:100,max:1e4,step:100,size:"small",class:"input-sm","onUpdate:value":v[2]||(v[2]=i=>i!=null&&f("memory_char_limit",i))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.memory.userCharLimit"),hint:e(l)("settings.memory.userCharLimitHint")},{default:n(()=>[s(e($),{value:e(t).memory.user_char_limit,min:100,max:1e4,step:100,size:"small",class:"input-sm","onUpdate:value":v[3]||(v[3]=i=>i!=null&&f("user_char_limit",i))},null,8,["value"])]),_:1},8,["label","hint"])]))}})})),Vs=w((()=>{})),Vt,Ts=w((()=>{we(),we(),Vs(),B(),Vt=O(Mt,[["__scopeId","data-v-b2529605"]])})),Se,Tt,Ue=w((()=>{D(),F(),R(),q(),X(),Se={class:"settings-section"},Tt=I({__name:"CompressionSettings",setup(E){const t=G(),a=Y(),{t:l}=L(),u={enabled:!0,threshold:.5,target_ratio:.2,protect_last_n:20,protect_first_n:3},m={};function f(v){t.updateLocal("compression",v),t.saveSection("compression",v).then(()=>{a.success(l("settings.saved"))}).catch(()=>{a.error(l("settings.saveFailed"))})}function r(v,i){t.updateLocal("compression",{[v]:i}),m[v]&&clearTimeout(m[v]),m[v]=setTimeout(async()=>{try{await t.saveSection("compression",{[v]:i}),a.success(l("settings.saved"))}catch{a.error(l("settings.saveFailed"))}},300)}return(v,i)=>(S(),U("section",Se,[s(_,{label:e(l)("settings.compression.enabled"),hint:e(l)("settings.compression.enabledHint")},{default:n(()=>[s(e(M),{value:e(t).compression.enabled??u.enabled,size:"small","onUpdate:value":i[0]||(i[0]=o=>f({enabled:o}))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.compression.threshold"),hint:e(l)("settings.compression.thresholdHint")},{default:n(()=>[s(e($),{value:e(t).compression.threshold??u.threshold,min:.1,max:.95,step:.05,size:"small",class:"input-sm","onUpdate:value":i[1]||(i[1]=o=>o!=null&&r("threshold",o))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.compression.targetRatio"),hint:e(l)("settings.compression.targetRatioHint")},{default:n(()=>[s(e($),{value:e(t).compression.target_ratio??u.target_ratio,min:.05,max:.8,step:.05,size:"small",class:"input-sm","onUpdate:value":i[2]||(i[2]=o=>o!=null&&r("target_ratio",o))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.compression.protectLastN"),hint:e(l)("settings.compression.protectLastNHint")},{default:n(()=>[s(e($),{value:e(t).compression.protect_last_n??u.protect_last_n,min:0,max:200,step:1,size:"small",class:"input-sm","onUpdate:value":i[3]||(i[3]=o=>o!=null&&r("protect_last_n",o))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.compression.protectFirstN"),hint:e(l)("settings.compression.protectFirstNHint")},{default:n(()=>[s(e($),{value:e(t).compression.protect_first_n??u.protect_first_n,min:0,max:50,step:1,size:"small",class:"input-sm","onUpdate:value":i[4]||(i[4]=o=>o!=null&&r("protect_first_n",o))},null,8,["value"])]),_:1},8,["label","hint"])]))}})})),As=w((()=>{})),At,Ks=w((()=>{Ue(),Ue(),As(),B(),At=O(Tt,[["__scopeId","data-v-b584a6a0"]])})),Pe,Kt,xe=w((()=>{D(),F(),R(),q(),bs(),X(),Pe={class:"settings-section"},Kt=I({__name:"SessionSettings",setup(E){const t=G(),a=ys(),l=Y(),{t:u}=L(),m={};function f(i){t.updateLocal("session_reset",i),t.saveSection("session_reset",i).then(()=>{l.success(u("settings.saved"))}).catch(()=>{l.error(u("settings.saveFailed"))})}function r(i,o){t.updateLocal("session_reset",{[i]:o}),m[i]&&clearTimeout(m[i]),m[i]=setTimeout(async()=>{try{await t.saveSection("session_reset",{[i]:o}),l.success(u("settings.saved"))}catch{l.error(u("settings.saveFailed"))}},300)}async function v(i){try{await t.saveSection("approvals",{mode:i?"manual":"off"}),l.success(u("settings.saved"))}catch{l.error(u("settings.saveFailed"))}}return(i,o)=>(S(),U("section",Pe,[s(_,{label:e(u)("settings.session.requireAuth"),hint:e(u)("settings.session.requireAuthHint")},{default:n(()=>[s(e(M),{value:e(t).approvals.mode==="manual","onUpdate:value":v},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(u)("settings.session.mode"),hint:e(u)("settings.session.modeHint")},{default:n(()=>[s(e(N),{value:e(t).sessionReset.mode||"both",options:[{label:e(u)("settings.session.modeBoth"),value:"both"},{label:e(u)("settings.session.modeIdle"),value:"idle"},{label:e(u)("settings.session.modeDaily"),value:"daily"},{label:e(u)("settings.session.modeNone"),value:"none"}],size:"small",class:"input-md","onUpdate:value":o[0]||(o[0]=p=>f({mode:p}))},null,8,["value","options"])]),_:1},8,["label","hint"]),s(_,{label:e(u)("settings.session.idleMinutes"),hint:e(u)("settings.session.idleMinutesHint")},{default:n(()=>[s(e($),{value:e(t).sessionReset.idle_minutes,min:10,max:10080,step:30,size:"small",class:"input-sm","onUpdate:value":o[1]||(o[1]=p=>p!=null&&r("idle_minutes",p))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(u)("settings.session.atHour"),hint:e(u)("settings.session.atHourHint")},{default:n(()=>[s(e($),{value:e(t).sessionReset.at_hour,min:0,max:23,step:1,size:"small",class:"input-sm","onUpdate:value":o[2]||(o[2]=p=>p!=null&&r("at_hour",p))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(u)("settings.session.liveMonitorHumanOnly"),hint:e(u)("settings.session.liveMonitorHumanOnlyHint")},{default:n(()=>[s(e(M),{value:e(a).humanOnly,"onUpdate:value":o[3]||(o[3]=p=>e(a).setHumanOnly(p))},null,8,["value"])]),_:1},8,["label","hint"])]))}})})),$s=w((()=>{})),$t,Ds=w((()=>{xe(),xe(),$s(),B(),$t=O(Kt,[["__scopeId","data-v-a317c50b"]])})),He,Dt,ke=w((()=>{D(),F(),R(),q(),X(),He={class:"settings-section"},Dt=I({__name:"PrivacySettings",setup(E){const t=G(),a=Y(),{t:l}=L();async function u(m){try{await t.saveSection("privacy",m),a.success(l("settings.saved"))}catch{a.error(l("settings.saveFailed"))}}return(m,f)=>(S(),U("section",He,[s(_,{label:e(l)("settings.privacy.redactPii"),hint:e(l)("settings.privacy.redactPiiHint")},{default:n(()=>[s(e(M),{value:e(t).privacy.redact_pii,"onUpdate:value":f[0]||(f[0]=r=>u({redact_pii:r}))},null,8,["value"])]),_:1},8,["label","hint"])]))}})})),Is=w((()=>{})),It,Fs=w((()=>{ke(),ke(),Is(),B(),It=O(Dt,[["__scopeId","data-v-43145f27"]])})),ze,Ce,Ne,Me,Ve,Te,Ae,Ke,Ft,$e=w((()=>{D(),F(),ks(),is(),R(),ze={class:"settings-section"},Ce={key:0,class:"empty-hint"},Ne={class:"provider-header"},Me={class:"provider-name"},Ve={key:0,class:"provider-fields"},Te={class:"field-row"},Ae={key:1,class:"provider-fields"},Ke={class:"field-row"},Ft=I({__name:"ModelSettings",setup(E){const{t}=L(),a=Hs(),l=Y(),u=P(null),m=P({});te(()=>{a.providers.length===0&&a.fetchProviders()});const f=o=>!a.providers.find(p=>p.provider===o)?.builtin&&o.startsWith("custom:");function r(o){if(!(o in m.value)){const p=a.providers.find(b=>b.provider===o);m.value[o]=p?.api_key||""}return m.value[o]}async function v(o){const p=r(o);if(!p.trim()){l.warning(t("settings.models.apiKeyPlaceholder"));return}u.value=o;try{await ce(o,{api_key:p.trim()}),l.success(t("settings.models.saved")),await a.fetchProviders()}catch(b){l.error(b.message||t("settings.models.saveFailed"))}finally{u.value=null}}async function i(o){const p=r(o);u.value=o;try{await ce(o,{api_key:p.trim()}),l.success(t("settings.models.saved")),await a.fetchProviders()}catch(b){l.error(b.message||t("settings.models.saveFailed"))}finally{u.value=null}}return(o,p)=>(S(),U("section",ze,[s(e(xt),{show:e(a).loading},{default:n(()=>[e(a).providers.length===0?(S(),U("div",Ce,[s(e(Xt),{description:e(t)("settings.models.noProviders")},null,8,["description"])])):K("",!0),(S(!0),U(Z,null,Ut(e(a).providers,b=>(S(),U("div",{key:b.provider,class:"provider-section"},[y("div",Ne,[y("h4",Me,h(b.label),1),y("span",{class:jt(["type-badge",f(b.provider)?"custom":"builtin"])},h(f(b.provider)?e(t)("models.customType"):e(t)("models.builtIn")),3)]),f(b.provider)?(S(),U("div",Ae,[y("div",Ke,[s(e(k),{value:r(b.provider),type:"password","show-password-on":"click",placeholder:e(t)("settings.models.apiKeyPlaceholder"),autocomplete:"off","onUpdate:value":x=>m.value[b.provider]=x},null,8,["value","placeholder","onUpdate:value"]),s(e(H),{type:"primary",size:"small",loading:u.value===b.provider,onClick:x=>i(b.provider)},{default:n(()=>[z(h(e(t)("settings.models.save")),1)]),_:1},8,["loading","onClick"])])])):(S(),U("div",Ve,[y("div",Te,[s(e(k),{value:r(b.provider),type:"password","show-password-on":"click",placeholder:e(t)("settings.models.apiKeyPlaceholder"),autocomplete:"off","onUpdate:value":x=>m.value[b.provider]=x},null,8,["value","placeholder","onUpdate:value"]),s(e(H),{type:"primary",size:"small",loading:u.value===b.provider,onClick:x=>v(b.provider)},{default:n(()=>[z(h(e(t)("settings.models.save")),1)]),_:1},8,["loading","onClick"])])]))]))),128))]),_:1},8,["show"])]))}})})),Rs=w((()=>{})),Rt,Ls=w((()=>{$e(),$e(),Rs(),B(),Rt=O(Ft,[["__scopeId","data-v-8cd750e1"]])})),De,Ie,Fe,Re,Le,Be,Oe,Ee,We,Je,Ye,je,Ge,qe,Xe,Qe,Ze,Lt,et=w((()=>{D(),F(),R(),Ht(),De={class:"account-settings"},Ie={class:"section-desc"},Fe={class:"configured-section"},Re={class:"action-row"},Le={class:"action-label"},Be={class:"action-buttons"},Oe={class:"locked-ips-section"},Ee={class:"section-title"},We={class:"action-row",style:{"margin-bottom":"12px"}},Je={class:"action-label"},Ye={class:"action-buttons"},je={key:0,class:"locked-list"},Ge={class:"locked-info"},qe={class:"locked-ip"},Xe={class:"locked-badge"},Qe={class:"locked-ttl"},Ze={key:1,class:"empty-hint"},Lt=I({__name:"AccountSettings",setup(E){const{t}=L(),a=Y(),l=P(null),u=P(!1),m=P(!1),f=P(""),r=P(""),v=P(""),i=P(!1),o=P(""),p=P("");te(async()=>{try{l.value=(await _s()).username}catch{}});async function b(){if(r.value!==v.value){a.error(t("login.passwordMismatch"));return}if(r.value.length<6){a.error(t("login.passwordTooShort"));return}u.value=!0;try{await fs(f.value,r.value),m.value=!1,f.value="",r.value="",v.value="",a.success(t("login.passwordChanged"))}catch(d){a.error(d.message||t("common.saveFailed"))}finally{u.value=!1}}async function x(){if(p.value.trim().length<2){a.error(t("login.usernameTooShort"));return}u.value=!0;try{await ms(o.value,p.value.trim()),l.value=p.value.trim(),i.value=!1,o.value="",p.value="",a.success(t("login.usernameChanged"))}catch(d){a.error(d.message||t("common.saveFailed"))}finally{u.value=!1}}function j(){f.value="",r.value="",v.value="",m.value=!0}function C(){o.value="",p.value="",i.value=!0}const V=P([]),T=P(!1);async function Q(){T.value=!0;try{V.value=await hs()}catch{}finally{T.value=!1}}async function ae(d){try{await cs(d),a.success(t("settings.lockedIps.unlocked")),await Q()}catch(c){a.error(c.message||t("common.saveFailed"))}}async function le(){try{const d=await vs();a.success(t("settings.lockedIps.allUnlocked",{count:d})),await Q()}catch(d){a.error(d.message||t("common.saveFailed"))}}function ie(d){const c=Math.max(0,Math.round((d-Date.now())/6e4));return c>0?`${c} min`:t("common.expired")}return te(()=>{Q()}),(d,c)=>(S(),U("div",De,[y("p",Ie,h(e(t)("login.setupDescription")),1),y("div",Fe,[y("div",Re,[y("span",Le,h(e(t)("login.passwordLoginConfigured",{username:l.value})),1),y("div",Be,[s(e(H),{onClick:j},{default:n(()=>[z(h(e(t)("login.changePassword")),1)]),_:1}),s(e(H),{onClick:C},{default:n(()=>[z(h(e(t)("login.changeUsername")),1)]),_:1})])])]),y("div",Oe,[y("h3",Ee,h(e(t)("settings.lockedIps.title")),1),y("div",We,[y("span",Je,h(e(t)("settings.lockedIps.count",{count:V.value.length})),1),y("div",Ye,[s(e(H),{size:"small",loading:T.value,onClick:Q},{default:n(()=>[z(h(e(t)("common.retry")),1)]),_:1},8,["loading"]),V.value.length>0?(S(),ee(e(Pt),{key:0,onPositiveClick:le},{trigger:n(()=>[s(e(H),{size:"small",type:"warning"},{default:n(()=>[z(h(e(t)("settings.lockedIps.unlockAll")),1)]),_:1})]),default:n(()=>[z(" "+h(e(t)("settings.lockedIps.unlockAllConfirm")),1)]),_:1})):K("",!0)])]),V.value.length>0?(S(),U("div",je,[(S(!0),U(Z,null,Ut(V.value,g=>(S(),U("div",{key:g.ip+g.type,class:"locked-item"},[y("div",Ge,[y("span",qe,h(g.ip),1),y("span",Xe,h(g.type),1),y("span",Qe,h(ie(g.lockedUntil)),1)]),s(e(H),{size:"tiny",type:"error",ghost:"",onClick:Xs=>ae(g.ip)},{default:n(()=>[z(h(e(t)("settings.lockedIps.unlock")),1)]),_:1},8,["onClick"])]))),128))])):(S(),U("p",Ze,h(e(t)("settings.lockedIps.empty")),1))]),s(e(oe),{show:m.value,"onUpdate:show":c[4]||(c[4]=g=>m.value=g),preset:"dialog",title:e(t)("login.changePassword")},{action:n(()=>[s(e(H),{onClick:c[3]||(c[3]=g=>m.value=!1)},{default:n(()=>[z(h(e(t)("common.cancel")),1)]),_:1}),s(e(H),{type:"primary",loading:u.value,onClick:b},{default:n(()=>[z(h(e(t)("common.save")),1)]),_:1},8,["loading"])]),default:n(()=>[s(e(re),{"label-placement":"top"},{default:n(()=>[s(e(J),{label:e(t)("login.currentPassword")},{default:n(()=>[s(e(k),{value:f.value,"onUpdate:value":c[0]||(c[0]=g=>f.value=g),type:"password","show-password-on":"click",placeholder:e(t)("login.currentPassword")},null,8,["value","placeholder"])]),_:1},8,["label"]),s(e(J),{label:e(t)("login.newPassword")},{default:n(()=>[s(e(k),{value:r.value,"onUpdate:value":c[1]||(c[1]=g=>r.value=g),type:"password","show-password-on":"click",placeholder:e(t)("login.newPassword")},null,8,["value","placeholder"])]),_:1},8,["label"]),s(e(J),{label:e(t)("login.confirmPassword")},{default:n(()=>[s(e(k),{value:v.value,"onUpdate:value":c[2]||(c[2]=g=>v.value=g),type:"password","show-password-on":"click",placeholder:e(t)("login.confirmPassword"),onKeyup:ue(b,["enter"])},null,8,["value","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["show","title"]),s(e(oe),{show:i.value,"onUpdate:show":c[8]||(c[8]=g=>i.value=g),preset:"dialog",title:e(t)("login.changeUsername")},{action:n(()=>[s(e(H),{onClick:c[7]||(c[7]=g=>i.value=!1)},{default:n(()=>[z(h(e(t)("common.cancel")),1)]),_:1}),s(e(H),{type:"primary",loading:u.value,onClick:x},{default:n(()=>[z(h(e(t)("common.save")),1)]),_:1},8,["loading"])]),default:n(()=>[s(e(re),{"label-placement":"top"},{default:n(()=>[s(e(J),{label:e(t)("login.currentPassword")},{default:n(()=>[s(e(k),{value:o.value,"onUpdate:value":c[5]||(c[5]=g=>o.value=g),type:"password","show-password-on":"click",placeholder:e(t)("login.currentPassword")},null,8,["value","placeholder"])]),_:1},8,["label"]),s(e(J),{label:e(t)("login.newUsername")},{default:n(()=>[s(e(k),{value:p.value,"onUpdate:value":c[6]||(c[6]=g=>p.value=g),placeholder:e(t)("login.usernamePlaceholder"),onKeyup:ue(x,["enter"])},null,8,["value","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["show","title"])]))}})})),Bs=w((()=>{})),Bt,Os=w((()=>{et(),et(),Bs(),B(),Bt=O(Lt,[["__scopeId","data-v-20466872"]])})),tt,st,at,lt,Ot,it=w((()=>{D(),F(),R(),Ht(),tt={class:"user-management"},st={class:"toolbar"},at={class:"section-title"},lt={class:"section-desc"},Ot=I({__name:"UserManagementSettings",setup(E){const{t}=L(),a=Y(),l=P(!1),u=P(!1),m=P([]),f=P([]),r=P(!1),v=P(null),i=qt({username:"",password:"",role:"admin",status:"active",profiles:[]}),o=se(()=>[{label:t("users.roles.admin"),value:"admin"},{label:t("users.roles.superAdmin"),value:"super_admin"}]),p=se(()=>[{label:t("users.status.active"),value:"active"},{label:t("users.status.disabled"),value:"disabled"}]),b=se(()=>f.value.map(d=>({label:d,value:d})));function x(){v.value=null,i.username="",i.password="",i.role="admin",i.status="active",i.profiles=[]}async function j(){l.value=!0;try{const d=await ds();m.value=d.users,f.value=d.profiles}catch(d){a.error(d.message||t("users.loadFailed"))}finally{l.value=!1}}function C(){x(),r.value=!0}function V(d){v.value=d,i.username=d.username,i.password="",i.role=d.role,i.status=d.status,i.profiles=[...d.profiles],r.value=!0}async function T(){if(i.username.trim().length<2){a.error(t("login.usernameTooShort"));return}if(!v.value&&i.password.length<6){a.error(t("login.passwordTooShort"));return}if(i.password&&i.password.length<6){a.error(t("login.passwordTooShort"));return}u.value=!0;try{const d={username:i.username.trim(),password:i.password||void 0,role:i.role,status:i.status,profiles:i.role==="super_admin"?[]:i.profiles,defaultProfile:i.profiles[0]||null},c=v.value?await pe(v.value.id,d):await gs({...d,password:i.password});m.value=c.users,f.value=c.profiles,r.value=!1,x(),a.success(t("common.saved"))}catch(d){a.error(d.message||t("common.saveFailed"))}finally{u.value=!1}}async function Q(d,c){u.value=!0;try{const g=await pe(d.id,{status:c});m.value=g.users,f.value=g.profiles,a.success(t("common.saved"))}catch(g){a.error(g.message||t("common.saveFailed"))}finally{u.value=!1}}async function ae(d){u.value=!0;try{const c=await ps(d.id);m.value=c.users,f.value=c.profiles,a.success(t("common.saved"))}catch(c){a.error(c.message||t("common.deleteFailed"))}finally{u.value=!1}}function le(d){return d?new Date(d).toLocaleString():"-"}const ie=se(()=>[{title:t("users.username"),key:"username",minWidth:140},{title:t("users.role"),key:"role",width:130,render:d=>A(ne,{size:"small",type:d.role==="super_admin"?"warning":"default"},{default:()=>d.role==="super_admin"?t("users.roles.superAdmin"):t("users.roles.admin")})},{title:t("users.statusLabel"),key:"status",width:110,render:d=>A(ne,{size:"small",type:d.status==="active"?"success":"error"},{default:()=>d.status==="active"?t("users.status.active"):t("users.status.disabled")})},{title:t("users.profiles"),key:"profiles",minWidth:200,render:d=>d.role==="super_admin"?A("span",{class:"muted"},t("users.allProfiles")):A(de,{size:4},{default:()=>d.profiles.length?d.profiles.map(c=>A(ne,{size:"small",bordered:!1},{default:()=>c})):A("span",{class:"muted"},t("users.noProfiles"))})},{title:t("users.lastLogin"),key:"last_login_at",minWidth:170,render:d=>le(d.last_login_at)},{title:t("common.edit"),key:"actions",width:280,render:d=>A(de,{size:8},{default:()=>[A(H,{size:"small",onClick:()=>V(d)},{default:()=>t("common.edit")}),A(H,{size:"small",type:d.status==="active"?"warning":"primary",ghost:!0,loading:u.value,onClick:()=>Q(d,d.status==="active"?"disabled":"active")},{default:()=>d.status==="active"?t("users.disable"):t("users.enable")}),A(Pt,{onPositiveClick:()=>ae(d)},{trigger:()=>A(H,{size:"small",type:"error",ghost:!0,loading:u.value},{default:()=>t("common.delete")}),default:()=>t("users.deleteConfirm")})]})}]);return te(j),(d,c)=>(S(),U("div",tt,[y("div",st,[y("div",null,[y("h3",at,h(e(t)("users.title")),1),y("p",lt,h(e(t)("users.description")),1)]),s(e(H),{type:"primary",onClick:C},{default:n(()=>[z(h(e(t)("users.create")),1)]),_:1})]),s(e(Zt),{columns:ie.value,data:m.value,loading:l.value,bordered:!1,"single-line":!1,size:"small"},null,8,["columns","data","loading"]),s(e(oe),{show:r.value,"onUpdate:show":c[6]||(c[6]=g=>r.value=g),preset:"dialog",title:v.value?e(t)("users.edit"):e(t)("users.create")},{action:n(()=>[s(e(H),{onClick:c[5]||(c[5]=g=>r.value=!1)},{default:n(()=>[z(h(e(t)("common.cancel")),1)]),_:1}),s(e(H),{type:"primary",loading:u.value,onClick:T},{default:n(()=>[z(h(e(t)("common.save")),1)]),_:1},8,["loading"])]),default:n(()=>[s(e(re),{"label-placement":"top"},{default:n(()=>[s(e(J),{label:e(t)("users.username")},{default:n(()=>[s(e(k),{value:i.username,"onUpdate:value":c[0]||(c[0]=g=>i.username=g),placeholder:e(t)("login.usernamePlaceholder")},null,8,["value","placeholder"])]),_:1},8,["label"]),s(e(J),{label:v.value?e(t)("users.newPasswordOptional"):e(t)("login.newPassword")},{default:n(()=>[s(e(k),{value:i.password,"onUpdate:value":c[1]||(c[1]=g=>i.password=g),type:"password","show-password-on":"click",placeholder:e(t)("login.passwordPlaceholder")},null,8,["value","placeholder"])]),_:1},8,["label"]),s(e(J),{label:e(t)("users.role")},{default:n(()=>[s(e(N),{value:i.role,"onUpdate:value":c[2]||(c[2]=g=>i.role=g),options:o.value},null,8,["value","options"])]),_:1},8,["label"]),s(e(J),{label:e(t)("users.statusLabel")},{default:n(()=>[s(e(N),{value:i.status,"onUpdate:value":c[3]||(c[3]=g=>i.status=g),options:p.value},null,8,["value","options"])]),_:1},8,["label"]),i.role!=="super_admin"?(S(),ee(e(J),{key:0,label:e(t)("users.profiles")},{default:n(()=>[s(e(N),{value:i.profiles,"onUpdate:value":c[4]||(c[4]=g=>i.profiles=g),multiple:"",filterable:"",options:b.value,placeholder:e(t)("users.profilesPlaceholder")},null,8,["value","options","placeholder"])]),_:1},8,["label"])):K("",!0)]),_:1})]),_:1},8,["show","title"])]))}})})),Es=w((()=>{})),Et,Ws=w((()=>{it(),it(),Es(),B(),Et=O(Ot,[["__scopeId","data-v-bcd3f33a"]])})),nt,ot,ut,rt,dt,vt,ct,pt,mt,_t,gt,Wt,ht=w((()=>{D(),F(),R(),Us(),xs(),Ps(),X(),nt={class:"voice-settings"},ot={class:"provider-hint"},ut={class:"provider-hint"},rt={class:"slider-row"},dt={class:"slider-value"},vt={class:"slider-row"},ct={class:"slider-value"},pt={class:"provider-hint"},mt={class:"test-section"},_t={class:"test-title"},gt={class:"test-row"},Wt=I({__name:"VoiceSettings",setup(E){const{t}=L(),a=ws(),l=Ss(),u=P(t("settings.voice.testTextDefault")),m=P(!1),f=[{label:t("settings.voice.providerWebSpeech"),value:"webspeech"},{label:t("settings.voice.providerOpenai"),value:"openai"},{label:t("settings.voice.providerCustom"),value:"custom"},{label:t("settings.voice.providerEdge"),value:"edge"},{label:t("settings.voice.providerMimo"),value:"mimo"}],r=[{label:"tts-1",value:"tts-1"},{label:"tts-1-hd",value:"tts-1-hd"}],v=[{label:"Alloy",value:"alloy"},{label:"Echo",value:"echo"},{label:"Fable",value:"fable"},{label:"Nova",value:"nova"},{label:"Onyx",value:"onyx"},{label:"Shimmer",value:"shimmer"}],i=[{label:"晓晓 (zh-CN-XiaoxiaoNeural)",value:"zh-CN-XiaoxiaoNeural"},{label:"晓萱 (zh-CN-XiaoxuanNeural)",value:"zh-CN-XiaoxuanNeural"},{label:"云希 (zh-CN-YunxiNeural)",value:"zh-CN-YunxiNeural"},{label:"云健 (zh-CN-YunjianNeural)",value:"zh-CN-YunjianNeural"},{label:"云扬 (zh-CN-YunyangNeural)",value:"zh-CN-YunyangNeural"},{label:"小晨 (zh-TW-HsiaoChenNeural)",value:"zh-TW-HsiaoChenNeural"},{label:"小宇 (zh-TW-HsiaoYuNeural)",value:"zh-TW-HsiaoYuNeural"},{label:"云哲 (zh-TW-YunJheNeural)",value:"zh-TW-YunJheNeural"},{label:"希雅 (zh-HK-HiuGaaiNeural)",value:"zh-HK-HiuGaaiNeural"},{label:"希文 (zh-HK-HiuMaanNeural)",value:"zh-HK-HiuMaanNeural"},{label:"文龙 (zh-HK-WanLungNeural)",value:"zh-HK-WanLungNeural"},{label:"Jenny (en-US-JennyNeural)",value:"en-US-JennyNeural"},{label:"Aria (en-US-AriaNeural)",value:"en-US-AriaNeural"},{label:"Guy (en-US-GuyNeural)",value:"en-US-GuyNeural"},{label:"Sonia (en-GB-SoniaNeural)",value:"en-GB-SoniaNeural"},{label:"Ryan (en-GB-RyanNeural)",value:"en-GB-RyanNeural"},{label:"Nanami (ja-JP-NanamiNeural)",value:"ja-JP-NanamiNeural"},{label:"Keita (ja-JP-KeitaNeural)",value:"ja-JP-KeitaNeural"},{label:"Sun-Hi (ko-KR-SunHiNeural)",value:"ko-KR-SunHiNeural"},{label:"InJoon (ko-KR-InJoonNeural)",value:"ko-KR-InJoonNeural"},{label:"Denise (fr-FR-DeniseNeural)",value:"fr-FR-DeniseNeural"},{label:"Henri (fr-FR-HenriNeural)",value:"fr-FR-HenriNeural"},{label:"Katja (de-DE-KatjaNeural)",value:"de-DE-KatjaNeural"},{label:"Conrad (de-DE-ConradNeural)",value:"de-DE-ConradNeural"}],o=P([]);te(()=>{if("speechSynthesis"in window){const C=window.speechSynthesis.getVoices();C.length&&(o.value=C),window.speechSynthesis.onvoiceschanged=()=>{o.value=window.speechSynthesis.getVoices()}}});const p=[{label:"https://api.xiaomimimo.com/v1",value:"https://api.xiaomimimo.com/v1"},{label:"https://token-plan-cn.xiaomimimo.com/v1",value:"https://token-plan-cn.xiaomimimo.com/v1"}],b=[{label:t("settings.voice.mimoModelPreset"),value:"mimo-v2.5-tts"},{label:t("settings.voice.mimoModelVoiceDesign"),value:"mimo-v2.5-tts-voicedesign"}],x=[{label:"冰糖 (中文·女)",value:"冰糖"},{label:"茉莉 (中文·女)",value:"茉莉"},{label:"苏打 (中文·男)",value:"苏打"},{label:"白桦 (中文·男)",value:"白桦"},{label:"Mia (English·Female)",value:"Mia"},{label:"Chloe (English·Female)",value:"Chloe"},{label:"Milo (English·Male)",value:"Milo"},{label:"Dean (English·Male)",value:"Dean"}];async function j(){const C=u.value.trim();if(C){m.value=!0;try{if(a.provider.value==="webspeech")l.stop(!1),l.speakViaBrowser("__test__",C,{voiceName:a.webspeechVoice.value||void 0});else if(a.provider.value==="openai"){if(!a.openaiBaseUrl.value){console.warn("[VoiceSettings] OpenAI base URL empty");return}await l.openaiPlay("__test__",C,{baseUrl:a.openaiBaseUrl.value,apiKey:a.openaiApiKey.value||void 0,model:a.openaiModel.value,voice:a.openaiVoice.value})}else if(a.provider.value==="custom"){if(!a.customUrl.value){console.warn("[VoiceSettings] Custom URL empty");return}await l.openaiPlay("__test__",C,{baseUrl:a.customUrl.value,apiKey:a.customApiKey.value||void 0})}else if(a.provider.value==="edge")await l.openaiPlay("__test__",C,{baseUrl:"/api/tts/proxy",voice:a.edgeVoice.value,rate:me(a.edgeRate.value),pitch:_e(a.edgePitchHz.value)});else if(a.provider.value==="mimo"){if(!a.mimoApiKey.value){console.warn("[VoiceSettings] MiMo API Key empty");return}await l.mimoPlay("__test__",C,{baseUrl:a.mimoBaseUrl.value,apiKey:a.mimoApiKey.value,model:a.mimoModel.value,voice:a.mimoVoice.value,voiceDesignDesc:a.mimoVoiceDesignDesc.value||void 0,stylePrompt:a.mimoStylePrompt.value||void 0})}}catch(V){console.error("[VoiceSettings] Test failed:",V)}finally{m.value=!1}}}return(C,V)=>(S(),U("div",nt,[s(_,{label:e(t)("settings.voice.ttsProvider"),hint:e(t)("settings.voice.ttsProviderHint")},{default:n(()=>[s(e(N),{value:e(a).provider.value,options:f,size:"small",style:{width:"300px"},"onUpdate:value":e(a).setProvider},null,8,["value","onUpdate:value"])]),_:1},8,["label","hint"]),e(a).provider.value==="webspeech"?(S(),ee(_,{key:0,label:e(t)("settings.voice.webspeechVoice"),hint:e(t)("settings.voice.webspeechVoiceHint")},{default:n(()=>[s(e(N),{value:e(a).webspeechVoice.value,size:"small",filterable:"",style:{width:"320px"},placeholder:e(t)("settings.voice.webspeechVoicePlaceholder"),"consistent-menu-width":!1,options:o.value.map(T=>({label:`${T.name} (${T.lang})`,value:T.name})),"onUpdate:value":e(a).setWebSpeechVoice},null,8,["value","placeholder","options","onUpdate:value"])]),_:1},8,["label","hint"])):K("",!0),e(a).provider.value==="openai"?(S(),U(Z,{key:1},[s(_,{label:e(t)("settings.voice.openaiKey"),hint:e(t)("settings.voice.openaiKeyHint")},{default:n(()=>[s(e(k),{value:e(a).openaiApiKey.value,type:"password",size:"small","show-password-on":"click",style:{width:"360px"},placeholder:"sk-...","onUpdate:value":e(a).setOpenaiApiKey},null,8,["value","onUpdate:value"])]),_:1},8,["label","hint"]),s(_,{label:e(t)("settings.voice.openaiUrl"),hint:e(t)("settings.voice.openaiUrlHint")},{default:n(()=>[s(e(k),{value:e(a).openaiBaseUrl.value,size:"small",style:{width:"360px"},placeholder:"https://api.openai.com/v1/audio/speech","onUpdate:value":e(a).setOpenaiBaseUrl},null,8,["value","onUpdate:value"])]),_:1},8,["label","hint"]),s(_,{label:e(t)("settings.voice.openaiModel"),hint:e(t)("settings.voice.openaiModelHint")},{default:n(()=>[s(e(N),{value:e(a).openaiModel.value,options:r,size:"small",style:{width:"200px"},"onUpdate:value":e(a).setOpenaiModel},null,8,["value","onUpdate:value"])]),_:1},8,["label","hint"]),s(_,{label:e(t)("settings.voice.openaiVoice"),hint:e(t)("settings.voice.openaiVoiceHint")},{default:n(()=>[s(e(N),{value:e(a).openaiVoice.value,options:v,size:"small",style:{width:"200px"},"onUpdate:value":e(a).setOpenaiVoice},null,8,["value","onUpdate:value"])]),_:1},8,["label","hint"])],64)):K("",!0),e(a).provider.value==="custom"?(S(),U(Z,{key:2},[y("div",ot,h(e(t)("settings.voice.customHint")),1),s(_,{label:e(t)("settings.voice.customUrl"),hint:e(t)("settings.voice.customUrlHint")},{default:n(()=>[s(e(k),{value:e(a).customUrl.value,size:"small",style:{width:"360px"},placeholder:e(t)("settings.voice.customUrlPlaceholder"),"onUpdate:value":e(a).setCustomUrl},null,8,["value","placeholder","onUpdate:value"])]),_:1},8,["label","hint"]),s(_,{label:e(t)("settings.voice.customApiKey"),hint:e(t)("settings.voice.customApiKeyHint")},{default:n(()=>[s(e(k),{value:e(a).customApiKey.value,type:"password",size:"small","show-password-on":"click",style:{width:"360px"},placeholder:e(t)("settings.voice.customApiKeyPlaceholder"),"onUpdate:value":e(a).setCustomApiKey},null,8,["value","placeholder","onUpdate:value"])]),_:1},8,["label","hint"])],64)):K("",!0),e(a).provider.value==="edge"?(S(),U(Z,{key:3},[y("div",ut,h(e(t)("settings.voice.edgeHint")),1),s(_,{label:e(t)("settings.voice.edgeVoice"),hint:e(t)("settings.voice.edgeVoiceHint")},{default:n(()=>[s(e(N),{value:e(a).edgeVoice.value,options:i,size:"small",filterable:"",style:{width:"320px"},"consistent-menu-width":!1,"onUpdate:value":e(a).setEdgeVoice},null,8,["value","onUpdate:value"])]),_:1},8,["label","hint"]),s(_,{label:e(t)("settings.voice.edgeRate"),hint:e(t)("settings.voice.edgeRateHint")},{default:n(()=>[y("div",rt,[s(e(ve),{value:e(a).edgeRate.value,min:.5,max:2,step:.05,style:{width:"200px"},"onUpdate:value":e(a).setEdgeRate},null,8,["value","onUpdate:value"]),y("span",dt,h(e(a).edgeRate.value.toFixed(2))+"x ("+h(e(me)(e(a).edgeRate.value))+")",1)])]),_:1},8,["label","hint"]),s(_,{label:e(t)("settings.voice.edgePitch"),hint:e(t)("settings.voice.edgePitchHint")},{default:n(()=>[y("div",vt,[s(e(ve),{value:e(a).edgePitchHz.value,min:-20,max:20,step:1,style:{width:"200px"},"onUpdate:value":e(a).setEdgePitchHz},null,8,["value","onUpdate:value"]),y("span",ct,h(e(a).edgePitchHz.value>0?"+":"")+h(e(a).edgePitchHz.value)+" Hz ("+h(e(_e)(e(a).edgePitchHz.value))+")",1)])]),_:1},8,["label","hint"])],64)):K("",!0),e(a).provider.value==="mimo"?(S(),U(Z,{key:4},[y("div",pt,h(e(t)("settings.voice.mimoHint")),1),s(_,{label:e(t)("settings.voice.mimoApiKey"),hint:e(t)("settings.voice.mimoApiKeyHint")},{default:n(()=>[s(e(k),{value:e(a).mimoApiKey.value,type:"password",size:"small","show-password-on":"click",style:{width:"360px"},placeholder:e(t)("settings.voice.mimoApiKeyPlaceholder"),"onUpdate:value":e(a).setMimoApiKey},null,8,["value","placeholder","onUpdate:value"])]),_:1},8,["label","hint"]),s(_,{label:e(t)("settings.voice.mimoBaseUrl"),hint:e(t)("settings.voice.mimoBaseUrlHint")},{default:n(()=>[s(e(N),{value:e(a).mimoBaseUrl.value,options:p,size:"small",filterable:"",tag:"",style:{width:"360px"},"onUpdate:value":e(a).setMimoBaseUrl},null,8,["value","onUpdate:value"])]),_:1},8,["label","hint"]),s(_,{label:e(t)("settings.voice.mimoModel"),hint:e(t)("settings.voice.mimoModelHint")},{default:n(()=>[s(e(N),{value:e(a).mimoModel.value,options:b,size:"small",style:{width:"320px"},"onUpdate:value":e(a).setMimoModel},null,8,["value","onUpdate:value"])]),_:1},8,["label","hint"]),e(a).mimoModel.value==="mimo-v2.5-tts"?(S(),ee(_,{key:0,label:e(t)("settings.voice.mimoVoice"),hint:e(t)("settings.voice.mimoVoiceHint")},{default:n(()=>[s(e(N),{value:e(a).mimoVoice.value,options:x,size:"small",style:{width:"200px"},"onUpdate:value":e(a).setMimoVoice},null,8,["value","onUpdate:value"])]),_:1},8,["label","hint"])):K("",!0),e(a).mimoModel.value==="mimo-v2.5-tts-voicedesign"?(S(),ee(_,{key:1,label:e(t)("settings.voice.mimoVoiceDesignPrompt"),hint:e(t)("settings.voice.mimoVoiceDesignPromptHint")},{default:n(()=>[s(e(k),{value:e(a).mimoVoiceDesignDesc.value,type:"textarea",size:"small",style:{width:"360px"},rows:3,placeholder:e(t)("settings.voice.mimoVoiceDesignPromptPlaceholder"),"onUpdate:value":e(a).setMimoVoiceDesignDesc},null,8,["value","placeholder","onUpdate:value"])]),_:1},8,["label","hint"])):K("",!0),s(_,{label:e(t)("settings.voice.mimoStylePrompt"),hint:e(t)("settings.voice.mimoStylePromptHint")},{default:n(()=>[s(e(k),{value:e(a).mimoStylePrompt.value,type:"textarea",size:"small",style:{width:"360px"},rows:2,placeholder:e(t)("settings.voice.mimoStylePromptPlaceholder"),"onUpdate:value":e(a).setMimoStylePrompt},null,8,["value","placeholder","onUpdate:value"])]),_:1},8,["label","hint"])],64)):K("",!0),y("div",mt,[y("h4",_t,h(e(t)("settings.voice.testTitle")),1),y("div",gt,[s(e(k),{value:u.value,"onUpdate:value":V[0]||(V[0]=T=>u.value=T),size:"small",style:{width:"360px"},placeholder:e(t)("settings.voice.testTextPlaceholder"),disabled:m.value,onKeyup:ue(j,["enter"])},null,8,["value","placeholder","disabled"]),s(e(H),{size:"small",type:"primary",loading:m.value,disabled:m.value,onClick:j},{default:n(()=>[z(h(m.value?e(t)("settings.voice.testButtonPlaying"):e(t)("settings.voice.testButton")),1)]),_:1},8,["loading","disabled"])])])]))}})})),Js=w((()=>{})),Jt,Ys=w((()=>{ht(),ht(),Js(),B(),Jt=O(Wt,[["__scopeId","data-v-9ae9034b"]])})),ft,yt,bt,wt,Yt,St=w((()=>{D(),ts(),F(),R(),q(),Cs(),Ms(),Ts(),Ks(),Ds(),Fs(),Ls(),Os(),Ws(),Ys(),as(),os(),ft={class:"settings-view"},yt={class:"page-header"},bt={class:"header-title"},wt={class:"settings-content"},Yt=I({__name:"SettingsView",setup(E){const t=G(),a=ns(),{t:l}=L(),u=ls(),m=ss(),f=es(),r=P("account"),v=se(()=>new Set(["account",...u?["users"]:[],"display","agent","memory","compression","session","privacy","models","voice"]));function i(b){const x=typeof b=="string"?b:"";return v.value.has(x)?x:"account"}function o(b){r.value=i(b),f.replace({query:{...m.query,tab:r.value==="account"?void 0:r.value}})}Gt(()=>m.query.tab,b=>{r.value=i(b)},{immediate:!0});async function p(){(!a.activeProfileName||a.profiles.length===0)&&await a.fetchProfiles(),await t.fetchSettings()}return te(()=>{p()}),(b,x)=>(S(),U("div",ft,[y("header",yt,[y("h2",bt,h(e(l)("settings.title")),1)]),y("div",wt,[s(e(xt),{show:e(t).loading||e(t).saving,size:"large",description:e(l)("common.loading")},{default:n(()=>[s(e(Qt),{value:r.value,"onUpdate:value":[x[0]||(x[0]=j=>r.value=j),o],type:"line",animated:""},{default:n(()=>[s(e(W),{name:"account",tab:e(l)("settings.tabs.account")},{default:n(()=>[s(Bt)]),_:1},8,["tab"]),e(u)?(S(),ee(e(W),{key:0,name:"users",tab:e(l)("settings.tabs.users")},{default:n(()=>[s(Et)]),_:1},8,["tab"])):K("",!0),s(e(W),{name:"display",tab:e(l)("settings.tabs.display")},{default:n(()=>[s(zt)]),_:1},8,["tab"]),s(e(W),{name:"agent",tab:e(l)("settings.tabs.agent")},{default:n(()=>[s(Nt)]),_:1},8,["tab"]),s(e(W),{name:"memory",tab:e(l)("settings.tabs.memory")},{default:n(()=>[s(Vt)]),_:1},8,["tab"]),s(e(W),{name:"compression",tab:e(l)("settings.tabs.compression")},{default:n(()=>[s(At)]),_:1},8,["tab"]),s(e(W),{name:"session",tab:e(l)("settings.tabs.session")},{default:n(()=>[s($t)]),_:1},8,["tab"]),s(e(W),{name:"privacy",tab:e(l)("settings.tabs.privacy")},{default:n(()=>[s(It)]),_:1},8,["tab"]),s(e(W),{name:"models",tab:e(l)("settings.tabs.models")},{default:n(()=>[s(Rt)]),_:1},8,["tab"]),s(e(W),{name:"voice",tab:e(l)("settings.tabs.voice")},{default:n(()=>[s(Jt)]),_:1},8,["tab"])]),_:1},8,["value"])]),_:1},8,["show","description"])])]))}})})),js=w((()=>{})),Gs,qs=w((()=>{St(),St(),js(),B(),Gs=O(Yt,[["__scopeId","data-v-efce8ba1"]])}));qs();export{Gs as default};
1
+ import{n as w}from"./rolldown-runtime-BKwlnUi0.js";import{A as N,Bt as jt,Ct as Gt,Ht as h,I as H,Nt as qt,Pt as P,Q as Z,S as oe,Tt as n,U as Xt,V as ne,W as D,X as ue,at as U,bt as Ut,c as M,ct as s,d as Pt,dt as A,f as $,gt as te,h as de,it as K,l as xt,lt as I,m as re,nt as y,o as Qt,p as J,rt as ee,s as W,st as z,t as F,tt as se,u as ve,vt as S,w as Zt,y as Y,z as k,zt as e}from"./ui-vendor-BMwF7QXa.js";import{c as es,n as R,o as ts,r as L,s as ss}from"./vue-vendor-kBYBtqCg.js";import{l as as,n as B,t as O,u as ls}from"./_plugin-vue_export-helper-CHoatqkO.js";import{g as ce,p as is,r as ns,t as os}from"./profiles-CyjgPK1f.js";import{H as us,U as rs,b as G,c as ds,d as vs,f as cs,i as ps,l as Ht,n as ms,o as _s,p as pe,r as gs,s as hs,t as fs,y as q}from"./index-DpU5R9KV.js";import{n as X,t as _}from"./SettingRow-Dt5XWkpQ.js";import{n as ys,t as bs}from"./session-browser-prefs-C6G-jnbR.js";import{a as ws,c as Ss,i as Us,n as Ps,o as xs,r as me,t as _e}from"./ttsHelpers-CEvJOgh2.js";import{n as Hs,t as ks}from"./models-CDdUhb_e.js";var ge,kt,he=w((()=>{D(),F(),R(),q(),us(),X(),ge={class:"settings-section"},kt=I({__name:"DisplaySettings",setup(E){const t=G(),a=Y(),{t:l}=L(),{brightness:u,setBrightness:m}=rs(),f=[{label:l("settings.display.themeLight"),value:"light"},{label:l("settings.display.themeDark"),value:"dark"},{label:l("settings.display.themeSystem"),value:"system"}];async function r(i){try{await t.saveSection("display",i),a.success(l("settings.saved"))}catch{a.error(l("settings.saveFailed"))}}function v(i){const o=i;m(o),r({skin:o})}return(i,o)=>(S(),U("section",ge,[s(_,{label:e(l)("settings.display.theme"),hint:e(l)("settings.display.themeHint")},{default:n(()=>[s(e(N),{value:e(u),options:f,size:"small","consistent-menu-width":!1,class:"input-sm","onUpdate:value":v},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.display.streaming"),hint:e(l)("settings.display.streamingHint")},{default:n(()=>[s(e(M),{value:e(t).display.streaming,"onUpdate:value":o[0]||(o[0]=p=>r({streaming:p}))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.display.compact"),hint:e(l)("settings.display.compactHint")},{default:n(()=>[s(e(M),{value:e(t).display.compact,"onUpdate:value":o[1]||(o[1]=p=>r({compact:p}))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.display.showReasoning"),hint:e(l)("settings.display.showReasoningHint")},{default:n(()=>[s(e(M),{value:e(t).display.show_reasoning,"onUpdate:value":o[2]||(o[2]=p=>r({show_reasoning:p}))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.display.showCost"),hint:e(l)("settings.display.showCostHint")},{default:n(()=>[s(e(M),{value:e(t).display.show_cost,"onUpdate:value":o[3]||(o[3]=p=>r({show_cost:p}))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.display.inlineDiffs"),hint:e(l)("settings.display.inlineDiffsHint")},{default:n(()=>[s(e(M),{value:e(t).display.inline_diffs,"onUpdate:value":o[4]||(o[4]=p=>r({inline_diffs:p}))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.display.bellOnComplete"),hint:e(l)("settings.display.bellOnCompleteHint")},{default:n(()=>[s(e(M),{value:e(t).display.bell_on_complete,"onUpdate:value":o[5]||(o[5]=p=>r({bell_on_complete:p}))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.display.busyInputMode"),hint:e(l)("settings.display.busyInputModeHint")},{default:n(()=>[s(e(M),{value:e(t).display.busy_input_mode==="interrupt","onUpdate:value":o[6]||(o[6]=p=>r({busy_input_mode:p?"interrupt":"off"}))},null,8,["value"])]),_:1},8,["label","hint"])]))}})})),zs=w((()=>{})),zt,Cs=w((()=>{he(),he(),zs(),B(),zt=O(kt,[["__scopeId","data-v-e5486815"]])})),fe,Ct,ye=w((()=>{D(),F(),R(),q(),X(),fe={class:"settings-section"},Ct=I({__name:"AgentSettings",setup(E){const t=G(),a=Y(),{t:l}=L(),u={};function m(r){t.updateLocal("agent",r),t.saveSection("agent",r).then(()=>{a.success(l("settings.saved"))}).catch(()=>{a.error(l("settings.saveFailed"))})}function f(r,v){t.updateLocal("agent",{[r]:v}),u[r]&&clearTimeout(u[r]),u[r]=setTimeout(async()=>{try{await t.saveSection("agent",{[r]:v}),a.success(l("settings.saved"))}catch{a.error(l("settings.saveFailed"))}},300)}return(r,v)=>(S(),U("section",fe,[s(_,{label:e(l)("settings.agent.maxTurns"),hint:e(l)("settings.agent.maxTurnsHint")},{default:n(()=>[s(e($),{value:e(t).agent.max_turns,min:1,max:200,step:5,size:"small",class:"input-sm","onUpdate:value":v[0]||(v[0]=i=>i!=null&&f("max_turns",i))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.agent.gatewayTimeout"),hint:e(l)("settings.agent.gatewayTimeoutHint")},{default:n(()=>[s(e($),{value:e(t).agent.gateway_timeout,min:60,max:7200,step:60,size:"small",class:"input-sm","onUpdate:value":v[1]||(v[1]=i=>i!=null&&f("gateway_timeout",i))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.agent.restartDrainTimeout"),hint:e(l)("settings.agent.restartDrainTimeoutHint")},{default:n(()=>[s(e($),{value:e(t).agent.restart_drain_timeout,min:10,max:300,step:10,size:"small",class:"input-sm","onUpdate:value":v[2]||(v[2]=i=>i!=null&&f("restart_drain_timeout",i))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.agent.toolEnforcement"),hint:e(l)("settings.agent.toolEnforcementHint")},{default:n(()=>[s(e(N),{value:e(t).agent.tool_use_enforcement||"auto",options:[{label:e(l)("settings.agent.auto"),value:"auto"},{label:e(l)("settings.agent.always"),value:"always"},{label:e(l)("settings.agent.never"),value:"never"}],size:"small",class:"input-sm","onUpdate:value":v[3]||(v[3]=i=>m({tool_use_enforcement:i}))},null,8,["value","options"])]),_:1},8,["label","hint"])]))}})})),Ns=w((()=>{})),Nt,Ms=w((()=>{ye(),ye(),Ns(),B(),Nt=O(Ct,[["__scopeId","data-v-d06d83a7"]])})),be,Mt,we=w((()=>{D(),F(),R(),q(),X(),be={class:"settings-section"},Mt=I({__name:"MemorySettings",setup(E){const t=G(),a=Y(),{t:l}=L(),u={};function m(r){t.updateLocal("memory",r),t.saveSection("memory",r).then(()=>{a.success(l("settings.saved"))}).catch(()=>{a.error(l("settings.saveFailed"))})}function f(r,v){t.updateLocal("memory",{[r]:v}),u[r]&&clearTimeout(u[r]),u[r]=setTimeout(async()=>{try{await t.saveSection("memory",{[r]:v}),a.success(l("settings.saved"))}catch{a.error(l("settings.saveFailed"))}},300)}return(r,v)=>(S(),U("section",be,[s(_,{label:e(l)("settings.memory.enabled"),hint:e(l)("settings.memory.enabledHint")},{default:n(()=>[s(e(M),{value:e(t).memory.memory_enabled,"onUpdate:value":v[0]||(v[0]=i=>m({memory_enabled:i}))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.memory.userProfile"),hint:e(l)("settings.memory.userProfileHint")},{default:n(()=>[s(e(M),{value:e(t).memory.user_profile_enabled,"onUpdate:value":v[1]||(v[1]=i=>m({user_profile_enabled:i}))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.memory.charLimit"),hint:e(l)("settings.memory.charLimitHint")},{default:n(()=>[s(e($),{value:e(t).memory.memory_char_limit,min:100,max:1e4,step:100,size:"small",class:"input-sm","onUpdate:value":v[2]||(v[2]=i=>i!=null&&f("memory_char_limit",i))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.memory.userCharLimit"),hint:e(l)("settings.memory.userCharLimitHint")},{default:n(()=>[s(e($),{value:e(t).memory.user_char_limit,min:100,max:1e4,step:100,size:"small",class:"input-sm","onUpdate:value":v[3]||(v[3]=i=>i!=null&&f("user_char_limit",i))},null,8,["value"])]),_:1},8,["label","hint"])]))}})})),Vs=w((()=>{})),Vt,Ts=w((()=>{we(),we(),Vs(),B(),Vt=O(Mt,[["__scopeId","data-v-b2529605"]])})),Se,Tt,Ue=w((()=>{D(),F(),R(),q(),X(),Se={class:"settings-section"},Tt=I({__name:"CompressionSettings",setup(E){const t=G(),a=Y(),{t:l}=L(),u={enabled:!0,threshold:.5,target_ratio:.2,protect_last_n:20,protect_first_n:3},m={};function f(v){t.updateLocal("compression",v),t.saveSection("compression",v).then(()=>{a.success(l("settings.saved"))}).catch(()=>{a.error(l("settings.saveFailed"))})}function r(v,i){t.updateLocal("compression",{[v]:i}),m[v]&&clearTimeout(m[v]),m[v]=setTimeout(async()=>{try{await t.saveSection("compression",{[v]:i}),a.success(l("settings.saved"))}catch{a.error(l("settings.saveFailed"))}},300)}return(v,i)=>(S(),U("section",Se,[s(_,{label:e(l)("settings.compression.enabled"),hint:e(l)("settings.compression.enabledHint")},{default:n(()=>[s(e(M),{value:e(t).compression.enabled??u.enabled,size:"small","onUpdate:value":i[0]||(i[0]=o=>f({enabled:o}))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.compression.threshold"),hint:e(l)("settings.compression.thresholdHint")},{default:n(()=>[s(e($),{value:e(t).compression.threshold??u.threshold,min:.1,max:.95,step:.05,size:"small",class:"input-sm","onUpdate:value":i[1]||(i[1]=o=>o!=null&&r("threshold",o))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.compression.targetRatio"),hint:e(l)("settings.compression.targetRatioHint")},{default:n(()=>[s(e($),{value:e(t).compression.target_ratio??u.target_ratio,min:.05,max:.8,step:.05,size:"small",class:"input-sm","onUpdate:value":i[2]||(i[2]=o=>o!=null&&r("target_ratio",o))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.compression.protectLastN"),hint:e(l)("settings.compression.protectLastNHint")},{default:n(()=>[s(e($),{value:e(t).compression.protect_last_n??u.protect_last_n,min:0,max:200,step:1,size:"small",class:"input-sm","onUpdate:value":i[3]||(i[3]=o=>o!=null&&r("protect_last_n",o))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(l)("settings.compression.protectFirstN"),hint:e(l)("settings.compression.protectFirstNHint")},{default:n(()=>[s(e($),{value:e(t).compression.protect_first_n??u.protect_first_n,min:0,max:50,step:1,size:"small",class:"input-sm","onUpdate:value":i[4]||(i[4]=o=>o!=null&&r("protect_first_n",o))},null,8,["value"])]),_:1},8,["label","hint"])]))}})})),As=w((()=>{})),At,Ks=w((()=>{Ue(),Ue(),As(),B(),At=O(Tt,[["__scopeId","data-v-b584a6a0"]])})),Pe,Kt,xe=w((()=>{D(),F(),R(),q(),bs(),X(),Pe={class:"settings-section"},Kt=I({__name:"SessionSettings",setup(E){const t=G(),a=ys(),l=Y(),{t:u}=L(),m={};function f(i){t.updateLocal("session_reset",i),t.saveSection("session_reset",i).then(()=>{l.success(u("settings.saved"))}).catch(()=>{l.error(u("settings.saveFailed"))})}function r(i,o){t.updateLocal("session_reset",{[i]:o}),m[i]&&clearTimeout(m[i]),m[i]=setTimeout(async()=>{try{await t.saveSection("session_reset",{[i]:o}),l.success(u("settings.saved"))}catch{l.error(u("settings.saveFailed"))}},300)}async function v(i){try{await t.saveSection("approvals",{mode:i?"manual":"off"}),l.success(u("settings.saved"))}catch{l.error(u("settings.saveFailed"))}}return(i,o)=>(S(),U("section",Pe,[s(_,{label:e(u)("settings.session.requireAuth"),hint:e(u)("settings.session.requireAuthHint")},{default:n(()=>[s(e(M),{value:e(t).approvals.mode==="manual","onUpdate:value":v},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(u)("settings.session.mode"),hint:e(u)("settings.session.modeHint")},{default:n(()=>[s(e(N),{value:e(t).sessionReset.mode||"both",options:[{label:e(u)("settings.session.modeBoth"),value:"both"},{label:e(u)("settings.session.modeIdle"),value:"idle"},{label:e(u)("settings.session.modeDaily"),value:"daily"},{label:e(u)("settings.session.modeNone"),value:"none"}],size:"small",class:"input-md","onUpdate:value":o[0]||(o[0]=p=>f({mode:p}))},null,8,["value","options"])]),_:1},8,["label","hint"]),s(_,{label:e(u)("settings.session.idleMinutes"),hint:e(u)("settings.session.idleMinutesHint")},{default:n(()=>[s(e($),{value:e(t).sessionReset.idle_minutes,min:10,max:10080,step:30,size:"small",class:"input-sm","onUpdate:value":o[1]||(o[1]=p=>p!=null&&r("idle_minutes",p))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(u)("settings.session.atHour"),hint:e(u)("settings.session.atHourHint")},{default:n(()=>[s(e($),{value:e(t).sessionReset.at_hour,min:0,max:23,step:1,size:"small",class:"input-sm","onUpdate:value":o[2]||(o[2]=p=>p!=null&&r("at_hour",p))},null,8,["value"])]),_:1},8,["label","hint"]),s(_,{label:e(u)("settings.session.liveMonitorHumanOnly"),hint:e(u)("settings.session.liveMonitorHumanOnlyHint")},{default:n(()=>[s(e(M),{value:e(a).humanOnly,"onUpdate:value":o[3]||(o[3]=p=>e(a).setHumanOnly(p))},null,8,["value"])]),_:1},8,["label","hint"])]))}})})),$s=w((()=>{})),$t,Ds=w((()=>{xe(),xe(),$s(),B(),$t=O(Kt,[["__scopeId","data-v-a317c50b"]])})),He,Dt,ke=w((()=>{D(),F(),R(),q(),X(),He={class:"settings-section"},Dt=I({__name:"PrivacySettings",setup(E){const t=G(),a=Y(),{t:l}=L();async function u(m){try{await t.saveSection("privacy",m),a.success(l("settings.saved"))}catch{a.error(l("settings.saveFailed"))}}return(m,f)=>(S(),U("section",He,[s(_,{label:e(l)("settings.privacy.redactPii"),hint:e(l)("settings.privacy.redactPiiHint")},{default:n(()=>[s(e(M),{value:e(t).privacy.redact_pii,"onUpdate:value":f[0]||(f[0]=r=>u({redact_pii:r}))},null,8,["value"])]),_:1},8,["label","hint"])]))}})})),Is=w((()=>{})),It,Fs=w((()=>{ke(),ke(),Is(),B(),It=O(Dt,[["__scopeId","data-v-43145f27"]])})),ze,Ce,Ne,Me,Ve,Te,Ae,Ke,Ft,$e=w((()=>{D(),F(),ks(),is(),R(),ze={class:"settings-section"},Ce={key:0,class:"empty-hint"},Ne={class:"provider-header"},Me={class:"provider-name"},Ve={key:0,class:"provider-fields"},Te={class:"field-row"},Ae={key:1,class:"provider-fields"},Ke={class:"field-row"},Ft=I({__name:"ModelSettings",setup(E){const{t}=L(),a=Hs(),l=Y(),u=P(null),m=P({});te(()=>{a.providers.length===0&&a.fetchProviders()});const f=o=>!a.providers.find(p=>p.provider===o)?.builtin&&o.startsWith("custom:");function r(o){if(!(o in m.value)){const p=a.providers.find(b=>b.provider===o);m.value[o]=p?.api_key||""}return m.value[o]}async function v(o){const p=r(o);if(!p.trim()){l.warning(t("settings.models.apiKeyPlaceholder"));return}u.value=o;try{await ce(o,{api_key:p.trim()}),l.success(t("settings.models.saved")),await a.fetchProviders()}catch(b){l.error(b.message||t("settings.models.saveFailed"))}finally{u.value=null}}async function i(o){const p=r(o);u.value=o;try{await ce(o,{api_key:p.trim()}),l.success(t("settings.models.saved")),await a.fetchProviders()}catch(b){l.error(b.message||t("settings.models.saveFailed"))}finally{u.value=null}}return(o,p)=>(S(),U("section",ze,[s(e(xt),{show:e(a).loading},{default:n(()=>[e(a).providers.length===0?(S(),U("div",Ce,[s(e(Xt),{description:e(t)("settings.models.noProviders")},null,8,["description"])])):K("",!0),(S(!0),U(Z,null,Ut(e(a).providers,b=>(S(),U("div",{key:b.provider,class:"provider-section"},[y("div",Ne,[y("h4",Me,h(b.label),1),y("span",{class:jt(["type-badge",f(b.provider)?"custom":"builtin"])},h(f(b.provider)?e(t)("models.customType"):e(t)("models.builtIn")),3)]),f(b.provider)?(S(),U("div",Ae,[y("div",Ke,[s(e(k),{value:r(b.provider),type:"password","show-password-on":"click",placeholder:e(t)("settings.models.apiKeyPlaceholder"),autocomplete:"off","onUpdate:value":x=>m.value[b.provider]=x},null,8,["value","placeholder","onUpdate:value"]),s(e(H),{type:"primary",size:"small",loading:u.value===b.provider,onClick:x=>i(b.provider)},{default:n(()=>[z(h(e(t)("settings.models.save")),1)]),_:1},8,["loading","onClick"])])])):(S(),U("div",Ve,[y("div",Te,[s(e(k),{value:r(b.provider),type:"password","show-password-on":"click",placeholder:e(t)("settings.models.apiKeyPlaceholder"),autocomplete:"off","onUpdate:value":x=>m.value[b.provider]=x},null,8,["value","placeholder","onUpdate:value"]),s(e(H),{type:"primary",size:"small",loading:u.value===b.provider,onClick:x=>v(b.provider)},{default:n(()=>[z(h(e(t)("settings.models.save")),1)]),_:1},8,["loading","onClick"])])]))]))),128))]),_:1},8,["show"])]))}})})),Rs=w((()=>{})),Rt,Ls=w((()=>{$e(),$e(),Rs(),B(),Rt=O(Ft,[["__scopeId","data-v-8cd750e1"]])})),De,Ie,Fe,Re,Le,Be,Oe,Ee,We,Je,Ye,je,Ge,qe,Xe,Qe,Ze,Lt,et=w((()=>{D(),F(),R(),Ht(),De={class:"account-settings"},Ie={class:"section-desc"},Fe={class:"configured-section"},Re={class:"action-row"},Le={class:"action-label"},Be={class:"action-buttons"},Oe={class:"locked-ips-section"},Ee={class:"section-title"},We={class:"action-row",style:{"margin-bottom":"12px"}},Je={class:"action-label"},Ye={class:"action-buttons"},je={key:0,class:"locked-list"},Ge={class:"locked-info"},qe={class:"locked-ip"},Xe={class:"locked-badge"},Qe={class:"locked-ttl"},Ze={key:1,class:"empty-hint"},Lt=I({__name:"AccountSettings",setup(E){const{t}=L(),a=Y(),l=P(null),u=P(!1),m=P(!1),f=P(""),r=P(""),v=P(""),i=P(!1),o=P(""),p=P("");te(async()=>{try{l.value=(await _s()).username}catch{}});async function b(){if(r.value!==v.value){a.error(t("login.passwordMismatch"));return}if(r.value.length<6){a.error(t("login.passwordTooShort"));return}u.value=!0;try{await fs(f.value,r.value),m.value=!1,f.value="",r.value="",v.value="",a.success(t("login.passwordChanged"))}catch(d){a.error(d.message||t("common.saveFailed"))}finally{u.value=!1}}async function x(){if(p.value.trim().length<2){a.error(t("login.usernameTooShort"));return}u.value=!0;try{await ms(o.value,p.value.trim()),l.value=p.value.trim(),i.value=!1,o.value="",p.value="",a.success(t("login.usernameChanged"))}catch(d){a.error(d.message||t("common.saveFailed"))}finally{u.value=!1}}function j(){f.value="",r.value="",v.value="",m.value=!0}function C(){o.value="",p.value="",i.value=!0}const V=P([]),T=P(!1);async function Q(){T.value=!0;try{V.value=await hs()}catch{}finally{T.value=!1}}async function ae(d){try{await cs(d),a.success(t("settings.lockedIps.unlocked")),await Q()}catch(c){a.error(c.message||t("common.saveFailed"))}}async function le(){try{const d=await vs();a.success(t("settings.lockedIps.allUnlocked",{count:d})),await Q()}catch(d){a.error(d.message||t("common.saveFailed"))}}function ie(d){const c=Math.max(0,Math.round((d-Date.now())/6e4));return c>0?`${c} min`:t("common.expired")}return te(()=>{Q()}),(d,c)=>(S(),U("div",De,[y("p",Ie,h(e(t)("login.setupDescription")),1),y("div",Fe,[y("div",Re,[y("span",Le,h(e(t)("login.passwordLoginConfigured",{username:l.value})),1),y("div",Be,[s(e(H),{onClick:j},{default:n(()=>[z(h(e(t)("login.changePassword")),1)]),_:1}),s(e(H),{onClick:C},{default:n(()=>[z(h(e(t)("login.changeUsername")),1)]),_:1})])])]),y("div",Oe,[y("h3",Ee,h(e(t)("settings.lockedIps.title")),1),y("div",We,[y("span",Je,h(e(t)("settings.lockedIps.count",{count:V.value.length})),1),y("div",Ye,[s(e(H),{size:"small",loading:T.value,onClick:Q},{default:n(()=>[z(h(e(t)("common.retry")),1)]),_:1},8,["loading"]),V.value.length>0?(S(),ee(e(Pt),{key:0,onPositiveClick:le},{trigger:n(()=>[s(e(H),{size:"small",type:"warning"},{default:n(()=>[z(h(e(t)("settings.lockedIps.unlockAll")),1)]),_:1})]),default:n(()=>[z(" "+h(e(t)("settings.lockedIps.unlockAllConfirm")),1)]),_:1})):K("",!0)])]),V.value.length>0?(S(),U("div",je,[(S(!0),U(Z,null,Ut(V.value,g=>(S(),U("div",{key:g.ip+g.type,class:"locked-item"},[y("div",Ge,[y("span",qe,h(g.ip),1),y("span",Xe,h(g.type),1),y("span",Qe,h(ie(g.lockedUntil)),1)]),s(e(H),{size:"tiny",type:"error",ghost:"",onClick:Xs=>ae(g.ip)},{default:n(()=>[z(h(e(t)("settings.lockedIps.unlock")),1)]),_:1},8,["onClick"])]))),128))])):(S(),U("p",Ze,h(e(t)("settings.lockedIps.empty")),1))]),s(e(oe),{show:m.value,"onUpdate:show":c[4]||(c[4]=g=>m.value=g),preset:"dialog",title:e(t)("login.changePassword")},{action:n(()=>[s(e(H),{onClick:c[3]||(c[3]=g=>m.value=!1)},{default:n(()=>[z(h(e(t)("common.cancel")),1)]),_:1}),s(e(H),{type:"primary",loading:u.value,onClick:b},{default:n(()=>[z(h(e(t)("common.save")),1)]),_:1},8,["loading"])]),default:n(()=>[s(e(re),{"label-placement":"top"},{default:n(()=>[s(e(J),{label:e(t)("login.currentPassword")},{default:n(()=>[s(e(k),{value:f.value,"onUpdate:value":c[0]||(c[0]=g=>f.value=g),type:"password","show-password-on":"click",placeholder:e(t)("login.currentPassword")},null,8,["value","placeholder"])]),_:1},8,["label"]),s(e(J),{label:e(t)("login.newPassword")},{default:n(()=>[s(e(k),{value:r.value,"onUpdate:value":c[1]||(c[1]=g=>r.value=g),type:"password","show-password-on":"click",placeholder:e(t)("login.newPassword")},null,8,["value","placeholder"])]),_:1},8,["label"]),s(e(J),{label:e(t)("login.confirmPassword")},{default:n(()=>[s(e(k),{value:v.value,"onUpdate:value":c[2]||(c[2]=g=>v.value=g),type:"password","show-password-on":"click",placeholder:e(t)("login.confirmPassword"),onKeyup:ue(b,["enter"])},null,8,["value","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["show","title"]),s(e(oe),{show:i.value,"onUpdate:show":c[8]||(c[8]=g=>i.value=g),preset:"dialog",title:e(t)("login.changeUsername")},{action:n(()=>[s(e(H),{onClick:c[7]||(c[7]=g=>i.value=!1)},{default:n(()=>[z(h(e(t)("common.cancel")),1)]),_:1}),s(e(H),{type:"primary",loading:u.value,onClick:x},{default:n(()=>[z(h(e(t)("common.save")),1)]),_:1},8,["loading"])]),default:n(()=>[s(e(re),{"label-placement":"top"},{default:n(()=>[s(e(J),{label:e(t)("login.currentPassword")},{default:n(()=>[s(e(k),{value:o.value,"onUpdate:value":c[5]||(c[5]=g=>o.value=g),type:"password","show-password-on":"click",placeholder:e(t)("login.currentPassword")},null,8,["value","placeholder"])]),_:1},8,["label"]),s(e(J),{label:e(t)("login.newUsername")},{default:n(()=>[s(e(k),{value:p.value,"onUpdate:value":c[6]||(c[6]=g=>p.value=g),placeholder:e(t)("login.usernamePlaceholder"),onKeyup:ue(x,["enter"])},null,8,["value","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["show","title"])]))}})})),Bs=w((()=>{})),Bt,Os=w((()=>{et(),et(),Bs(),B(),Bt=O(Lt,[["__scopeId","data-v-20466872"]])})),tt,st,at,lt,Ot,it=w((()=>{D(),F(),R(),Ht(),tt={class:"user-management"},st={class:"toolbar"},at={class:"section-title"},lt={class:"section-desc"},Ot=I({__name:"UserManagementSettings",setup(E){const{t}=L(),a=Y(),l=P(!1),u=P(!1),m=P([]),f=P([]),r=P(!1),v=P(null),i=qt({username:"",password:"",role:"admin",status:"active",profiles:[]}),o=se(()=>[{label:t("users.roles.admin"),value:"admin"},{label:t("users.roles.superAdmin"),value:"super_admin"}]),p=se(()=>[{label:t("users.status.active"),value:"active"},{label:t("users.status.disabled"),value:"disabled"}]),b=se(()=>f.value.map(d=>({label:d,value:d})));function x(){v.value=null,i.username="",i.password="",i.role="admin",i.status="active",i.profiles=[]}async function j(){l.value=!0;try{const d=await ds();m.value=d.users,f.value=d.profiles}catch(d){a.error(d.message||t("users.loadFailed"))}finally{l.value=!1}}function C(){x(),r.value=!0}function V(d){v.value=d,i.username=d.username,i.password="",i.role=d.role,i.status=d.status,i.profiles=[...d.profiles],r.value=!0}async function T(){if(i.username.trim().length<2){a.error(t("login.usernameTooShort"));return}if(!v.value&&i.password.length<6){a.error(t("login.passwordTooShort"));return}if(i.password&&i.password.length<6){a.error(t("login.passwordTooShort"));return}u.value=!0;try{const d={username:i.username.trim(),password:i.password||void 0,role:i.role,status:i.status,profiles:i.role==="super_admin"?[]:i.profiles,defaultProfile:i.profiles[0]||null},c=v.value?await pe(v.value.id,d):await gs({...d,password:i.password});m.value=c.users,f.value=c.profiles,r.value=!1,x(),a.success(t("common.saved"))}catch(d){a.error(d.message||t("common.saveFailed"))}finally{u.value=!1}}async function Q(d,c){u.value=!0;try{const g=await pe(d.id,{status:c});m.value=g.users,f.value=g.profiles,a.success(t("common.saved"))}catch(g){a.error(g.message||t("common.saveFailed"))}finally{u.value=!1}}async function ae(d){u.value=!0;try{const c=await ps(d.id);m.value=c.users,f.value=c.profiles,a.success(t("common.saved"))}catch(c){a.error(c.message||t("common.deleteFailed"))}finally{u.value=!1}}function le(d){return d?new Date(d).toLocaleString():"-"}const ie=se(()=>[{title:t("users.username"),key:"username",minWidth:140},{title:t("users.role"),key:"role",width:130,render:d=>A(ne,{size:"small",type:d.role==="super_admin"?"warning":"default"},{default:()=>d.role==="super_admin"?t("users.roles.superAdmin"):t("users.roles.admin")})},{title:t("users.statusLabel"),key:"status",width:110,render:d=>A(ne,{size:"small",type:d.status==="active"?"success":"error"},{default:()=>d.status==="active"?t("users.status.active"):t("users.status.disabled")})},{title:t("users.profiles"),key:"profiles",minWidth:200,render:d=>d.role==="super_admin"?A("span",{class:"muted"},t("users.allProfiles")):A(de,{size:4},{default:()=>d.profiles.length?d.profiles.map(c=>A(ne,{size:"small",bordered:!1},{default:()=>c})):A("span",{class:"muted"},t("users.noProfiles"))})},{title:t("users.lastLogin"),key:"last_login_at",minWidth:170,render:d=>le(d.last_login_at)},{title:t("common.edit"),key:"actions",width:280,render:d=>A(de,{size:8},{default:()=>[A(H,{size:"small",onClick:()=>V(d)},{default:()=>t("common.edit")}),A(H,{size:"small",type:d.status==="active"?"warning":"primary",ghost:!0,loading:u.value,onClick:()=>Q(d,d.status==="active"?"disabled":"active")},{default:()=>d.status==="active"?t("users.disable"):t("users.enable")}),A(Pt,{onPositiveClick:()=>ae(d)},{trigger:()=>A(H,{size:"small",type:"error",ghost:!0,loading:u.value},{default:()=>t("common.delete")}),default:()=>t("users.deleteConfirm")})]})}]);return te(j),(d,c)=>(S(),U("div",tt,[y("div",st,[y("div",null,[y("h3",at,h(e(t)("users.title")),1),y("p",lt,h(e(t)("users.description")),1)]),s(e(H),{type:"primary",onClick:C},{default:n(()=>[z(h(e(t)("users.create")),1)]),_:1})]),s(e(Zt),{columns:ie.value,data:m.value,loading:l.value,bordered:!1,"single-line":!1,size:"small"},null,8,["columns","data","loading"]),s(e(oe),{show:r.value,"onUpdate:show":c[6]||(c[6]=g=>r.value=g),preset:"dialog",title:v.value?e(t)("users.edit"):e(t)("users.create")},{action:n(()=>[s(e(H),{onClick:c[5]||(c[5]=g=>r.value=!1)},{default:n(()=>[z(h(e(t)("common.cancel")),1)]),_:1}),s(e(H),{type:"primary",loading:u.value,onClick:T},{default:n(()=>[z(h(e(t)("common.save")),1)]),_:1},8,["loading"])]),default:n(()=>[s(e(re),{"label-placement":"top"},{default:n(()=>[s(e(J),{label:e(t)("users.username")},{default:n(()=>[s(e(k),{value:i.username,"onUpdate:value":c[0]||(c[0]=g=>i.username=g),placeholder:e(t)("login.usernamePlaceholder")},null,8,["value","placeholder"])]),_:1},8,["label"]),s(e(J),{label:v.value?e(t)("users.newPasswordOptional"):e(t)("login.newPassword")},{default:n(()=>[s(e(k),{value:i.password,"onUpdate:value":c[1]||(c[1]=g=>i.password=g),type:"password","show-password-on":"click",placeholder:e(t)("login.passwordPlaceholder")},null,8,["value","placeholder"])]),_:1},8,["label"]),s(e(J),{label:e(t)("users.role")},{default:n(()=>[s(e(N),{value:i.role,"onUpdate:value":c[2]||(c[2]=g=>i.role=g),options:o.value},null,8,["value","options"])]),_:1},8,["label"]),s(e(J),{label:e(t)("users.statusLabel")},{default:n(()=>[s(e(N),{value:i.status,"onUpdate:value":c[3]||(c[3]=g=>i.status=g),options:p.value},null,8,["value","options"])]),_:1},8,["label"]),i.role!=="super_admin"?(S(),ee(e(J),{key:0,label:e(t)("users.profiles")},{default:n(()=>[s(e(N),{value:i.profiles,"onUpdate:value":c[4]||(c[4]=g=>i.profiles=g),multiple:"",filterable:"",options:b.value,placeholder:e(t)("users.profilesPlaceholder")},null,8,["value","options","placeholder"])]),_:1},8,["label"])):K("",!0)]),_:1})]),_:1},8,["show","title"])]))}})})),Es=w((()=>{})),Et,Ws=w((()=>{it(),it(),Es(),B(),Et=O(Ot,[["__scopeId","data-v-bcd3f33a"]])})),nt,ot,ut,rt,dt,vt,ct,pt,mt,_t,gt,Wt,ht=w((()=>{D(),F(),R(),Us(),xs(),Ps(),X(),nt={class:"voice-settings"},ot={class:"provider-hint"},ut={class:"provider-hint"},rt={class:"slider-row"},dt={class:"slider-value"},vt={class:"slider-row"},ct={class:"slider-value"},pt={class:"provider-hint"},mt={class:"test-section"},_t={class:"test-title"},gt={class:"test-row"},Wt=I({__name:"VoiceSettings",setup(E){const{t}=L(),a=ws(),l=Ss(),u=P(t("settings.voice.testTextDefault")),m=P(!1),f=[{label:t("settings.voice.providerWebSpeech"),value:"webspeech"},{label:t("settings.voice.providerOpenai"),value:"openai"},{label:t("settings.voice.providerCustom"),value:"custom"},{label:t("settings.voice.providerEdge"),value:"edge"},{label:t("settings.voice.providerMimo"),value:"mimo"}],r=[{label:"tts-1",value:"tts-1"},{label:"tts-1-hd",value:"tts-1-hd"}],v=[{label:"Alloy",value:"alloy"},{label:"Echo",value:"echo"},{label:"Fable",value:"fable"},{label:"Nova",value:"nova"},{label:"Onyx",value:"onyx"},{label:"Shimmer",value:"shimmer"}],i=[{label:"晓晓 (zh-CN-XiaoxiaoNeural)",value:"zh-CN-XiaoxiaoNeural"},{label:"晓萱 (zh-CN-XiaoxuanNeural)",value:"zh-CN-XiaoxuanNeural"},{label:"云希 (zh-CN-YunxiNeural)",value:"zh-CN-YunxiNeural"},{label:"云健 (zh-CN-YunjianNeural)",value:"zh-CN-YunjianNeural"},{label:"云扬 (zh-CN-YunyangNeural)",value:"zh-CN-YunyangNeural"},{label:"小晨 (zh-TW-HsiaoChenNeural)",value:"zh-TW-HsiaoChenNeural"},{label:"小宇 (zh-TW-HsiaoYuNeural)",value:"zh-TW-HsiaoYuNeural"},{label:"云哲 (zh-TW-YunJheNeural)",value:"zh-TW-YunJheNeural"},{label:"希雅 (zh-HK-HiuGaaiNeural)",value:"zh-HK-HiuGaaiNeural"},{label:"希文 (zh-HK-HiuMaanNeural)",value:"zh-HK-HiuMaanNeural"},{label:"文龙 (zh-HK-WanLungNeural)",value:"zh-HK-WanLungNeural"},{label:"Jenny (en-US-JennyNeural)",value:"en-US-JennyNeural"},{label:"Aria (en-US-AriaNeural)",value:"en-US-AriaNeural"},{label:"Guy (en-US-GuyNeural)",value:"en-US-GuyNeural"},{label:"Sonia (en-GB-SoniaNeural)",value:"en-GB-SoniaNeural"},{label:"Ryan (en-GB-RyanNeural)",value:"en-GB-RyanNeural"},{label:"Nanami (ja-JP-NanamiNeural)",value:"ja-JP-NanamiNeural"},{label:"Keita (ja-JP-KeitaNeural)",value:"ja-JP-KeitaNeural"},{label:"Sun-Hi (ko-KR-SunHiNeural)",value:"ko-KR-SunHiNeural"},{label:"InJoon (ko-KR-InJoonNeural)",value:"ko-KR-InJoonNeural"},{label:"Denise (fr-FR-DeniseNeural)",value:"fr-FR-DeniseNeural"},{label:"Henri (fr-FR-HenriNeural)",value:"fr-FR-HenriNeural"},{label:"Katja (de-DE-KatjaNeural)",value:"de-DE-KatjaNeural"},{label:"Conrad (de-DE-ConradNeural)",value:"de-DE-ConradNeural"}],o=P([]);te(()=>{if("speechSynthesis"in window){const C=window.speechSynthesis.getVoices();C.length&&(o.value=C),window.speechSynthesis.onvoiceschanged=()=>{o.value=window.speechSynthesis.getVoices()}}});const p=[{label:"https://api.xiaomimimo.com/v1",value:"https://api.xiaomimimo.com/v1"},{label:"https://token-plan-cn.xiaomimimo.com/v1",value:"https://token-plan-cn.xiaomimimo.com/v1"}],b=[{label:t("settings.voice.mimoModelPreset"),value:"mimo-v2.5-tts"},{label:t("settings.voice.mimoModelVoiceDesign"),value:"mimo-v2.5-tts-voicedesign"}],x=[{label:"冰糖 (中文·女)",value:"冰糖"},{label:"茉莉 (中文·女)",value:"茉莉"},{label:"苏打 (中文·男)",value:"苏打"},{label:"白桦 (中文·男)",value:"白桦"},{label:"Mia (English·Female)",value:"Mia"},{label:"Chloe (English·Female)",value:"Chloe"},{label:"Milo (English·Male)",value:"Milo"},{label:"Dean (English·Male)",value:"Dean"}];async function j(){const C=u.value.trim();if(C){m.value=!0;try{if(a.provider.value==="webspeech")l.stop(!1),l.speakViaBrowser("__test__",C,{voiceName:a.webspeechVoice.value||void 0});else if(a.provider.value==="openai"){if(!a.openaiBaseUrl.value){console.warn("[VoiceSettings] OpenAI base URL empty");return}await l.openaiPlay("__test__",C,{baseUrl:a.openaiBaseUrl.value,apiKey:a.openaiApiKey.value||void 0,model:a.openaiModel.value,voice:a.openaiVoice.value})}else if(a.provider.value==="custom"){if(!a.customUrl.value){console.warn("[VoiceSettings] Custom URL empty");return}await l.openaiPlay("__test__",C,{baseUrl:a.customUrl.value,apiKey:a.customApiKey.value||void 0})}else if(a.provider.value==="edge")await l.openaiPlay("__test__",C,{baseUrl:"/api/tts/proxy",voice:a.edgeVoice.value,rate:me(a.edgeRate.value),pitch:_e(a.edgePitchHz.value)});else if(a.provider.value==="mimo"){if(!a.mimoApiKey.value){console.warn("[VoiceSettings] MiMo API Key empty");return}await l.mimoPlay("__test__",C,{baseUrl:a.mimoBaseUrl.value,apiKey:a.mimoApiKey.value,model:a.mimoModel.value,voice:a.mimoVoice.value,voiceDesignDesc:a.mimoVoiceDesignDesc.value||void 0,stylePrompt:a.mimoStylePrompt.value||void 0})}}catch(V){console.error("[VoiceSettings] Test failed:",V)}finally{m.value=!1}}}return(C,V)=>(S(),U("div",nt,[s(_,{label:e(t)("settings.voice.ttsProvider"),hint:e(t)("settings.voice.ttsProviderHint")},{default:n(()=>[s(e(N),{value:e(a).provider.value,options:f,size:"small",style:{width:"300px"},"onUpdate:value":e(a).setProvider},null,8,["value","onUpdate:value"])]),_:1},8,["label","hint"]),e(a).provider.value==="webspeech"?(S(),ee(_,{key:0,label:e(t)("settings.voice.webspeechVoice"),hint:e(t)("settings.voice.webspeechVoiceHint")},{default:n(()=>[s(e(N),{value:e(a).webspeechVoice.value,size:"small",filterable:"",style:{width:"320px"},placeholder:e(t)("settings.voice.webspeechVoicePlaceholder"),"consistent-menu-width":!1,options:o.value.map(T=>({label:`${T.name} (${T.lang})`,value:T.name})),"onUpdate:value":e(a).setWebSpeechVoice},null,8,["value","placeholder","options","onUpdate:value"])]),_:1},8,["label","hint"])):K("",!0),e(a).provider.value==="openai"?(S(),U(Z,{key:1},[s(_,{label:e(t)("settings.voice.openaiKey"),hint:e(t)("settings.voice.openaiKeyHint")},{default:n(()=>[s(e(k),{value:e(a).openaiApiKey.value,type:"password",size:"small","show-password-on":"click",style:{width:"360px"},placeholder:"sk-...","onUpdate:value":e(a).setOpenaiApiKey},null,8,["value","onUpdate:value"])]),_:1},8,["label","hint"]),s(_,{label:e(t)("settings.voice.openaiUrl"),hint:e(t)("settings.voice.openaiUrlHint")},{default:n(()=>[s(e(k),{value:e(a).openaiBaseUrl.value,size:"small",style:{width:"360px"},placeholder:"https://api.openai.com/v1/audio/speech","onUpdate:value":e(a).setOpenaiBaseUrl},null,8,["value","onUpdate:value"])]),_:1},8,["label","hint"]),s(_,{label:e(t)("settings.voice.openaiModel"),hint:e(t)("settings.voice.openaiModelHint")},{default:n(()=>[s(e(N),{value:e(a).openaiModel.value,options:r,size:"small",style:{width:"200px"},"onUpdate:value":e(a).setOpenaiModel},null,8,["value","onUpdate:value"])]),_:1},8,["label","hint"]),s(_,{label:e(t)("settings.voice.openaiVoice"),hint:e(t)("settings.voice.openaiVoiceHint")},{default:n(()=>[s(e(N),{value:e(a).openaiVoice.value,options:v,size:"small",style:{width:"200px"},"onUpdate:value":e(a).setOpenaiVoice},null,8,["value","onUpdate:value"])]),_:1},8,["label","hint"])],64)):K("",!0),e(a).provider.value==="custom"?(S(),U(Z,{key:2},[y("div",ot,h(e(t)("settings.voice.customHint")),1),s(_,{label:e(t)("settings.voice.customUrl"),hint:e(t)("settings.voice.customUrlHint")},{default:n(()=>[s(e(k),{value:e(a).customUrl.value,size:"small",style:{width:"360px"},placeholder:e(t)("settings.voice.customUrlPlaceholder"),"onUpdate:value":e(a).setCustomUrl},null,8,["value","placeholder","onUpdate:value"])]),_:1},8,["label","hint"]),s(_,{label:e(t)("settings.voice.customApiKey"),hint:e(t)("settings.voice.customApiKeyHint")},{default:n(()=>[s(e(k),{value:e(a).customApiKey.value,type:"password",size:"small","show-password-on":"click",style:{width:"360px"},placeholder:e(t)("settings.voice.customApiKeyPlaceholder"),"onUpdate:value":e(a).setCustomApiKey},null,8,["value","placeholder","onUpdate:value"])]),_:1},8,["label","hint"])],64)):K("",!0),e(a).provider.value==="edge"?(S(),U(Z,{key:3},[y("div",ut,h(e(t)("settings.voice.edgeHint")),1),s(_,{label:e(t)("settings.voice.edgeVoice"),hint:e(t)("settings.voice.edgeVoiceHint")},{default:n(()=>[s(e(N),{value:e(a).edgeVoice.value,options:i,size:"small",filterable:"",style:{width:"320px"},"consistent-menu-width":!1,"onUpdate:value":e(a).setEdgeVoice},null,8,["value","onUpdate:value"])]),_:1},8,["label","hint"]),s(_,{label:e(t)("settings.voice.edgeRate"),hint:e(t)("settings.voice.edgeRateHint")},{default:n(()=>[y("div",rt,[s(e(ve),{value:e(a).edgeRate.value,min:.5,max:2,step:.05,style:{width:"200px"},"onUpdate:value":e(a).setEdgeRate},null,8,["value","onUpdate:value"]),y("span",dt,h(e(a).edgeRate.value.toFixed(2))+"x ("+h(e(me)(e(a).edgeRate.value))+")",1)])]),_:1},8,["label","hint"]),s(_,{label:e(t)("settings.voice.edgePitch"),hint:e(t)("settings.voice.edgePitchHint")},{default:n(()=>[y("div",vt,[s(e(ve),{value:e(a).edgePitchHz.value,min:-20,max:20,step:1,style:{width:"200px"},"onUpdate:value":e(a).setEdgePitchHz},null,8,["value","onUpdate:value"]),y("span",ct,h(e(a).edgePitchHz.value>0?"+":"")+h(e(a).edgePitchHz.value)+" Hz ("+h(e(_e)(e(a).edgePitchHz.value))+")",1)])]),_:1},8,["label","hint"])],64)):K("",!0),e(a).provider.value==="mimo"?(S(),U(Z,{key:4},[y("div",pt,h(e(t)("settings.voice.mimoHint")),1),s(_,{label:e(t)("settings.voice.mimoApiKey"),hint:e(t)("settings.voice.mimoApiKeyHint")},{default:n(()=>[s(e(k),{value:e(a).mimoApiKey.value,type:"password",size:"small","show-password-on":"click",style:{width:"360px"},placeholder:e(t)("settings.voice.mimoApiKeyPlaceholder"),"onUpdate:value":e(a).setMimoApiKey},null,8,["value","placeholder","onUpdate:value"])]),_:1},8,["label","hint"]),s(_,{label:e(t)("settings.voice.mimoBaseUrl"),hint:e(t)("settings.voice.mimoBaseUrlHint")},{default:n(()=>[s(e(N),{value:e(a).mimoBaseUrl.value,options:p,size:"small",filterable:"",tag:"",style:{width:"360px"},"onUpdate:value":e(a).setMimoBaseUrl},null,8,["value","onUpdate:value"])]),_:1},8,["label","hint"]),s(_,{label:e(t)("settings.voice.mimoModel"),hint:e(t)("settings.voice.mimoModelHint")},{default:n(()=>[s(e(N),{value:e(a).mimoModel.value,options:b,size:"small",style:{width:"320px"},"onUpdate:value":e(a).setMimoModel},null,8,["value","onUpdate:value"])]),_:1},8,["label","hint"]),e(a).mimoModel.value==="mimo-v2.5-tts"?(S(),ee(_,{key:0,label:e(t)("settings.voice.mimoVoice"),hint:e(t)("settings.voice.mimoVoiceHint")},{default:n(()=>[s(e(N),{value:e(a).mimoVoice.value,options:x,size:"small",style:{width:"200px"},"onUpdate:value":e(a).setMimoVoice},null,8,["value","onUpdate:value"])]),_:1},8,["label","hint"])):K("",!0),e(a).mimoModel.value==="mimo-v2.5-tts-voicedesign"?(S(),ee(_,{key:1,label:e(t)("settings.voice.mimoVoiceDesignPrompt"),hint:e(t)("settings.voice.mimoVoiceDesignPromptHint")},{default:n(()=>[s(e(k),{value:e(a).mimoVoiceDesignDesc.value,type:"textarea",size:"small",style:{width:"360px"},rows:3,placeholder:e(t)("settings.voice.mimoVoiceDesignPromptPlaceholder"),"onUpdate:value":e(a).setMimoVoiceDesignDesc},null,8,["value","placeholder","onUpdate:value"])]),_:1},8,["label","hint"])):K("",!0),s(_,{label:e(t)("settings.voice.mimoStylePrompt"),hint:e(t)("settings.voice.mimoStylePromptHint")},{default:n(()=>[s(e(k),{value:e(a).mimoStylePrompt.value,type:"textarea",size:"small",style:{width:"360px"},rows:2,placeholder:e(t)("settings.voice.mimoStylePromptPlaceholder"),"onUpdate:value":e(a).setMimoStylePrompt},null,8,["value","placeholder","onUpdate:value"])]),_:1},8,["label","hint"])],64)):K("",!0),y("div",mt,[y("h4",_t,h(e(t)("settings.voice.testTitle")),1),y("div",gt,[s(e(k),{value:u.value,"onUpdate:value":V[0]||(V[0]=T=>u.value=T),size:"small",style:{width:"360px"},placeholder:e(t)("settings.voice.testTextPlaceholder"),disabled:m.value,onKeyup:ue(j,["enter"])},null,8,["value","placeholder","disabled"]),s(e(H),{size:"small",type:"primary",loading:m.value,disabled:m.value,onClick:j},{default:n(()=>[z(h(m.value?e(t)("settings.voice.testButtonPlaying"):e(t)("settings.voice.testButton")),1)]),_:1},8,["loading","disabled"])])])]))}})})),Js=w((()=>{})),Jt,Ys=w((()=>{ht(),ht(),Js(),B(),Jt=O(Wt,[["__scopeId","data-v-9ae9034b"]])})),ft,yt,bt,wt,Yt,St=w((()=>{D(),ts(),F(),R(),q(),Cs(),Ms(),Ts(),Ks(),Ds(),Fs(),Ls(),Os(),Ws(),Ys(),as(),os(),ft={class:"settings-view"},yt={class:"page-header"},bt={class:"header-title"},wt={class:"settings-content"},Yt=I({__name:"SettingsView",setup(E){const t=G(),a=ns(),{t:l}=L(),u=ls(),m=ss(),f=es(),r=P("account"),v=se(()=>new Set(["account",...u?["users"]:[],"display","agent","memory","compression","session","privacy","models","voice"]));function i(b){const x=typeof b=="string"?b:"";return v.value.has(x)?x:"account"}function o(b){r.value=i(b),f.replace({query:{...m.query,tab:r.value==="account"?void 0:r.value}})}Gt(()=>m.query.tab,b=>{r.value=i(b)},{immediate:!0});async function p(){(!a.activeProfileName||a.profiles.length===0)&&await a.fetchProfiles(),await t.fetchSettings()}return te(()=>{p()}),(b,x)=>(S(),U("div",ft,[y("header",yt,[y("h2",bt,h(e(l)("settings.title")),1)]),y("div",wt,[s(e(xt),{show:e(t).loading||e(t).saving,size:"large",description:e(l)("common.loading")},{default:n(()=>[s(e(Qt),{value:r.value,"onUpdate:value":[x[0]||(x[0]=j=>r.value=j),o],type:"line",animated:""},{default:n(()=>[s(e(W),{name:"account",tab:e(l)("settings.tabs.account")},{default:n(()=>[s(Bt)]),_:1},8,["tab"]),e(u)?(S(),ee(e(W),{key:0,name:"users",tab:e(l)("settings.tabs.users")},{default:n(()=>[s(Et)]),_:1},8,["tab"])):K("",!0),s(e(W),{name:"display",tab:e(l)("settings.tabs.display")},{default:n(()=>[s(zt)]),_:1},8,["tab"]),s(e(W),{name:"agent",tab:e(l)("settings.tabs.agent")},{default:n(()=>[s(Nt)]),_:1},8,["tab"]),s(e(W),{name:"memory",tab:e(l)("settings.tabs.memory")},{default:n(()=>[s(Vt)]),_:1},8,["tab"]),s(e(W),{name:"compression",tab:e(l)("settings.tabs.compression")},{default:n(()=>[s(At)]),_:1},8,["tab"]),s(e(W),{name:"session",tab:e(l)("settings.tabs.session")},{default:n(()=>[s($t)]),_:1},8,["tab"]),s(e(W),{name:"privacy",tab:e(l)("settings.tabs.privacy")},{default:n(()=>[s(It)]),_:1},8,["tab"]),s(e(W),{name:"models",tab:e(l)("settings.tabs.models")},{default:n(()=>[s(Rt)]),_:1},8,["tab"]),s(e(W),{name:"voice",tab:e(l)("settings.tabs.voice")},{default:n(()=>[s(Jt)]),_:1},8,["tab"])]),_:1},8,["value"])]),_:1},8,["show","description"])])]))}})})),js=w((()=>{})),Gs,qs=w((()=>{St(),St(),js(),B(),Gs=O(Yt,[["__scopeId","data-v-efce8ba1"]])}));qs();export{Gs as default};
@@ -1 +1 @@
1
- import{n as q}from"./rolldown-runtime-BKwlnUi0.js";import{Bt as E,Ht as a,I as K,Pt as m,Q as p,Tt as O,Vt as f,W as sl,at as r,bt as b,ct as Q,gt as al,it as F,lt as tl,nt as e,st as V,t as il,tt as v,vt as n,zt as i}from"./ui-vendor-BMwF7QXa.js";import{n as ol,r as rl}from"./vue-vendor-kBYBtqCg.js";import{n as nl,t as ul}from"./_plugin-vue_export-helper-B8gz9Iqn.js";import{r as dl,t as cl}from"./profiles-DiEn61KW.js";import{i as _l,o as vl}from"./skills-BQ2jtPxK.js";var W,j,G,J,X,Y,Z,ee,le,se,ae,te,ie,oe,re,ne,ue,de,ce,_e,ve,he,ke,pe,me,ge,ye,fe,be,Se,Ue,we,xe,Ve,Ce,Me,De,$e,Fe,Be,Pe,qe,Te,ze,Ae,Ie,Le,Ne,He,Re,B,P,Ke,Ee=q((()=>{sl(),ol(),il(),cl(),vl(),W={class:"skills-usage-view"},j={class:"page-header"},G={class:"header-text"},J={class:"header-title"},X={class:"header-subtitle"},Y={class:"skills-usage-toolbar"},Z=["aria-label"],ee={class:"skills-usage-content"},le={key:0,class:"skills-usage-state error"},se={key:1,class:"skills-usage-state"},ae={key:0,class:"inline-error"},te={class:"overview-grid"},ie={class:"panel-header"},oe={key:0,class:"skills-usage-state compact"},re={class:"skill-bar-chart"},ne=["onMouseenter","onFocusin","onMouseleave","onFocusout"],ue={class:"skill-bar-track"},de=["data-skill"],ce={class:"tooltip-date"},_e={class:"tooltip-row total"},ve={class:"bar-dates"},he=["aria-label"],ke={class:"summary-card primary"},pe={class:"summary-label"},me={class:"summary-value"},ge={class:"summary-card"},ye={class:"summary-label"},fe={class:"summary-value"},be={class:"summary-card"},Se={class:"summary-label"},Ue={class:"summary-value"},we={class:"summary-card"},xe={class:"summary-label"},Ve={class:"summary-value"},Ce={class:"usage-panel"},Me={class:"panel-header"},De={key:0,class:"skills-usage-state compact"},$e=["aria-label"],Fe={class:"skills-row table-head",role:"row"},Be={role:"columnheader"},Pe={role:"columnheader"},qe={role:"columnheader"},Te={role:"columnheader"},ze={role:"columnheader"},Ae={class:"skill-name",role:"cell"},Ie={role:"cell"},Le={role:"cell"},Ne={class:"share-cell",role:"cell"},He={class:"share-bar"},Re={class:"last-used",role:"cell"},B=6,P="#5b6b84",Ke=tl({__name:"SkillsUsageView",setup(ml){const{t}=rl(),C=dl(),Oe=[7,30,90,365],T=["#2f6eea","#f26d3d","#f49a5c","#9aa7ff","#8f2c8f","#00c2d1"],h=m(7),g=m(!1),k=m(""),S=m({});let U=0;const z={},o=v(()=>S.value[h.value]??null),A=v(()=>(o.value?.summary.total_skill_actions??0)>0),Qe=v(()=>Math.max(...(o.value?.by_day??[]).map(s=>s.total_count),1)),We=v(()=>g.value&&!!o.value),w=m(null),x=m(null),y=v(()=>o.value?.by_day.find(s=>s.date===w.value)??null),je=v(()=>y.value?N(y.value):[]),Ge=v(()=>{const s=o.value?.by_day.length??0;return x.value===null||s<=0?"align-right":x.value>=s/2?"align-left":"align-right"}),M=v(()=>(o.value?.top_skills??[]).slice(0,B)),Je=v(()=>new Set(M.value.map(s=>s.skill)));function I(s){return`${s.toFixed(1)}%`}function Xe(s){return s?new Date(s*1e3).toLocaleString():"—"}function Ye(s){return`${Math.max(2,s/Qe.value*100)}%`}function Ze(s){return Math.max(s,0)}function L(s){return s.total_count||s.view_count+s.manage_count}function el(){const s=Math.max((o.value?.top_skills.length??0)-B,0);return s>0?`${t("skillsUsage.otherSkills")} (+${s})`:t("skillsUsage.otherSkills")}function D(s){const d=M.value.findIndex(l=>l.skill===s);return d>=0?T[d%T.length]:P}function N(s){const d=s.skills??[],l=new Map(d.map(u=>[u.skill,L(u)])),_=M.value.map(u=>({key:u.skill,label:u.skill,count:l.get(u.skill)??0,color:D(u.skill)})).filter(u=>u.count>0),c=d.filter(u=>!Je.value.has(u.skill)).reduce((u,ll)=>u+L(ll),0);return c>0&&_.push({key:"other-skills",label:el(),count:c,color:P}),_}function H(s,d){w.value=s.date,x.value=d}function R(s){w.value===s.date&&(w.value=null,x.value=null)}async function $(s=h.value,d=!1){h.value=s,(!C.activeProfileName||C.profiles.length===0)&&await C.fetchProfiles();const l=++U;z[s]=l,g.value=!0,(!S.value[s]||d)&&(k.value="");try{const _=await _l(s);z[s]===l&&(S.value={...S.value,[s]:_}),l===U&&(k.value="")}catch(_){l===U&&(k.value=_?.message||t("skillsUsage.loadFailed"))}finally{l===U&&(g.value=!1)}}return al(()=>{$(7)}),(s,d)=>(n(),r("div",W,[e("header",j,[e("div",G,[e("h2",J,a(i(t)("skillsUsage.title")),1),e("p",X,a(i(t)("skillsUsage.subtitle")),1)]),e("div",Y,[e("div",{class:"period-selector",role:"group","aria-label":i(t)("skillsUsage.periodSelector")},[(n(),r(p,null,b(Oe,l=>Q(i(K),{key:l,size:"small",secondary:h.value===l,quaternary:h.value!==l,type:h.value===l?"primary":"default","aria-pressed":h.value===l?"true":"false",onClick:_=>$(l)},{default:O(()=>[V(a(i(t)("skillsUsage.periodLabel",{days:l})),1)]),_:2},1032,["secondary","quaternary","type","aria-pressed","onClick"])),64))],8,Z),Q(i(K),{size:"small",quaternary:"",loading:g.value,onClick:d[0]||(d[0]=l=>$(h.value,!0))},{default:O(()=>[V(a(i(t)("skillsUsage.refresh")),1)]),_:1},8,["loading"])])]),e("div",ee,[k.value&&!o.value?(n(),r("div",le,a(k.value),1)):g.value&&!o.value?(n(),r("div",se,a(i(t)("common.loading")),1)):o.value?(n(),r(p,{key:2},[k.value?(n(),r("div",ae,a(k.value),1)):F("",!0),e("section",te,[e("div",{class:E(["usage-panel chart-panel",{"is-refreshing":We.value}]),"data-testid":"skills-usage-chart"},[e("div",ie,[e("h3",null,a(i(t)("skillsUsage.dailyTrend")),1),e("span",null,a(i(t)("skillsUsage.periodSummary",{days:o.value.period_days})),1)]),A.value?(n(),r(p,{key:1},[e("div",re,[(n(!0),r(p,null,b(o.value.by_day,(l,_)=>(n(),r("div",{key:l.date,class:"skill-bar-col",tabindex:"0",onMouseenter:c=>H(l,_),onFocusin:c=>H(l,_),onMouseleave:c=>R(l),onFocusout:c=>R(l)},[e("div",ue,[e("div",{class:"skill-bar-fill",style:f({height:Ye(l.total_count)})},[(n(!0),r(p,null,b(N(l),c=>(n(),r("div",{key:c.key,class:"skill-bar-segment","data-skill":c.key,style:f({flex:Ze(c.count),background:c.color})},null,12,de))),128))],4)])],40,ne))),128))]),y.value?(n(),r("div",{key:0,class:E(["floating-tooltip",Ge.value])},[e("div",ce,a(y.value.date),1),(n(!0),r(p,null,b(je.value,l=>(n(),r("div",{key:l.key,class:"tooltip-row"},[e("i",{class:"tooltip-dot",style:f({background:l.color})},null,4),e("span",null,a(l.label),1),e("strong",null,a(l.count),1)]))),128)),e("div",_e,[e("span",null,a(i(t)("skillsUsage.totalActions")),1),e("strong",null,a(y.value.total_count),1)])],2)):F("",!0),e("div",ve,[e("span",null,a(o.value.by_day[0]?.date.slice(5)),1),e("span",null,a(o.value.by_day[o.value.by_day.length-1]?.date.slice(5)),1)])],64)):(n(),r("div",oe,a(i(t)("skillsUsage.noData")),1))],2),e("div",{class:"summary-grid","data-testid":"skills-usage-stats","aria-label":i(t)("skillsUsage.summary")},[e("div",ke,[e("div",pe,a(i(t)("skillsUsage.totalActions")),1),e("div",me,a(o.value.summary.total_skill_actions),1)]),e("div",ge,[e("div",ye,a(i(t)("skillsUsage.loads")),1),e("div",fe,a(o.value.summary.total_skill_loads),1)]),e("div",be,[e("div",Se,a(i(t)("skillsUsage.edits")),1),e("div",Ue,a(o.value.summary.total_skill_edits),1)]),e("div",we,[e("div",xe,a(i(t)("skillsUsage.distinctSkills")),1),e("div",Ve,a(o.value.summary.distinct_skills_used),1)])],8,he)]),e("section",Ce,[e("div",Me,[e("h3",null,a(i(t)("skillsUsage.topSkills")),1),e("span",null,a(i(t)("skillsUsage.periodSummary",{days:o.value.period_days})),1)]),A.value?(n(),r("div",{key:1,class:"skills-table",role:"table","aria-label":i(t)("skillsUsage.topSkills")},[e("div",Fe,[e("span",Be,a(i(t)("skillsUsage.skill")),1),e("span",Pe,a(i(t)("skillsUsage.loads")),1),e("span",qe,a(i(t)("skillsUsage.edits")),1),e("span",Te,a(i(t)("skillsUsage.share")),1),e("span",ze,a(i(t)("skillsUsage.lastUsed")),1)]),(n(!0),r(p,null,b(o.value.top_skills,l=>(n(),r("div",{key:l.skill,class:"skills-row",role:"row"},[e("span",Ae,[e("i",{class:"skill-color-dot",style:f({background:D(l.skill)})},null,4),V(" "+a(l.skill),1)]),e("span",Ie,a(l.view_count),1),e("span",Le,a(l.manage_count),1),e("span",Ne,[e("span",He,[e("span",{style:f({width:I(l.percentage),background:D(l.skill)})},null,4)]),V(" "+a(I(l.percentage)),1)]),e("span",Re,a(Xe(l.last_used_at)),1)]))),128))],8,$e)):(n(),r("div",De,a(i(t)("skillsUsage.noData")),1))])],64)):F("",!0)])]))}})})),hl=q((()=>{})),kl,pl=q((()=>{Ee(),Ee(),hl(),nl(),kl=ul(Ke,[["__scopeId","data-v-efe6595e"]])}));pl();export{kl as default};
1
+ import{n as q}from"./rolldown-runtime-BKwlnUi0.js";import{Bt as E,Ht as a,I as K,Pt as m,Q as p,Tt as O,Vt as f,W as sl,at as r,bt as b,ct as Q,gt as al,it as F,lt as tl,nt as e,st as V,t as il,tt as v,vt as n,zt as i}from"./ui-vendor-BMwF7QXa.js";import{n as ol,r as rl}from"./vue-vendor-kBYBtqCg.js";import{n as nl,t as ul}from"./_plugin-vue_export-helper-CHoatqkO.js";import{r as dl,t as cl}from"./profiles-CyjgPK1f.js";import{i as _l,o as vl}from"./skills-vuknhTFJ.js";var W,j,G,J,X,Y,Z,ee,le,se,ae,te,ie,oe,re,ne,ue,de,ce,_e,ve,he,ke,pe,me,ge,ye,fe,be,Se,Ue,we,xe,Ve,Ce,Me,De,$e,Fe,Be,Pe,qe,Te,ze,Ae,Ie,Le,Ne,He,Re,B,P,Ke,Ee=q((()=>{sl(),ol(),il(),cl(),vl(),W={class:"skills-usage-view"},j={class:"page-header"},G={class:"header-text"},J={class:"header-title"},X={class:"header-subtitle"},Y={class:"skills-usage-toolbar"},Z=["aria-label"],ee={class:"skills-usage-content"},le={key:0,class:"skills-usage-state error"},se={key:1,class:"skills-usage-state"},ae={key:0,class:"inline-error"},te={class:"overview-grid"},ie={class:"panel-header"},oe={key:0,class:"skills-usage-state compact"},re={class:"skill-bar-chart"},ne=["onMouseenter","onFocusin","onMouseleave","onFocusout"],ue={class:"skill-bar-track"},de=["data-skill"],ce={class:"tooltip-date"},_e={class:"tooltip-row total"},ve={class:"bar-dates"},he=["aria-label"],ke={class:"summary-card primary"},pe={class:"summary-label"},me={class:"summary-value"},ge={class:"summary-card"},ye={class:"summary-label"},fe={class:"summary-value"},be={class:"summary-card"},Se={class:"summary-label"},Ue={class:"summary-value"},we={class:"summary-card"},xe={class:"summary-label"},Ve={class:"summary-value"},Ce={class:"usage-panel"},Me={class:"panel-header"},De={key:0,class:"skills-usage-state compact"},$e=["aria-label"],Fe={class:"skills-row table-head",role:"row"},Be={role:"columnheader"},Pe={role:"columnheader"},qe={role:"columnheader"},Te={role:"columnheader"},ze={role:"columnheader"},Ae={class:"skill-name",role:"cell"},Ie={role:"cell"},Le={role:"cell"},Ne={class:"share-cell",role:"cell"},He={class:"share-bar"},Re={class:"last-used",role:"cell"},B=6,P="#5b6b84",Ke=tl({__name:"SkillsUsageView",setup(ml){const{t}=rl(),C=dl(),Oe=[7,30,90,365],T=["#2f6eea","#f26d3d","#f49a5c","#9aa7ff","#8f2c8f","#00c2d1"],h=m(7),g=m(!1),k=m(""),S=m({});let U=0;const z={},o=v(()=>S.value[h.value]??null),A=v(()=>(o.value?.summary.total_skill_actions??0)>0),Qe=v(()=>Math.max(...(o.value?.by_day??[]).map(s=>s.total_count),1)),We=v(()=>g.value&&!!o.value),w=m(null),x=m(null),y=v(()=>o.value?.by_day.find(s=>s.date===w.value)??null),je=v(()=>y.value?N(y.value):[]),Ge=v(()=>{const s=o.value?.by_day.length??0;return x.value===null||s<=0?"align-right":x.value>=s/2?"align-left":"align-right"}),M=v(()=>(o.value?.top_skills??[]).slice(0,B)),Je=v(()=>new Set(M.value.map(s=>s.skill)));function I(s){return`${s.toFixed(1)}%`}function Xe(s){return s?new Date(s*1e3).toLocaleString():"—"}function Ye(s){return`${Math.max(2,s/Qe.value*100)}%`}function Ze(s){return Math.max(s,0)}function L(s){return s.total_count||s.view_count+s.manage_count}function el(){const s=Math.max((o.value?.top_skills.length??0)-B,0);return s>0?`${t("skillsUsage.otherSkills")} (+${s})`:t("skillsUsage.otherSkills")}function D(s){const d=M.value.findIndex(l=>l.skill===s);return d>=0?T[d%T.length]:P}function N(s){const d=s.skills??[],l=new Map(d.map(u=>[u.skill,L(u)])),_=M.value.map(u=>({key:u.skill,label:u.skill,count:l.get(u.skill)??0,color:D(u.skill)})).filter(u=>u.count>0),c=d.filter(u=>!Je.value.has(u.skill)).reduce((u,ll)=>u+L(ll),0);return c>0&&_.push({key:"other-skills",label:el(),count:c,color:P}),_}function H(s,d){w.value=s.date,x.value=d}function R(s){w.value===s.date&&(w.value=null,x.value=null)}async function $(s=h.value,d=!1){h.value=s,(!C.activeProfileName||C.profiles.length===0)&&await C.fetchProfiles();const l=++U;z[s]=l,g.value=!0,(!S.value[s]||d)&&(k.value="");try{const _=await _l(s);z[s]===l&&(S.value={...S.value,[s]:_}),l===U&&(k.value="")}catch(_){l===U&&(k.value=_?.message||t("skillsUsage.loadFailed"))}finally{l===U&&(g.value=!1)}}return al(()=>{$(7)}),(s,d)=>(n(),r("div",W,[e("header",j,[e("div",G,[e("h2",J,a(i(t)("skillsUsage.title")),1),e("p",X,a(i(t)("skillsUsage.subtitle")),1)]),e("div",Y,[e("div",{class:"period-selector",role:"group","aria-label":i(t)("skillsUsage.periodSelector")},[(n(),r(p,null,b(Oe,l=>Q(i(K),{key:l,size:"small",secondary:h.value===l,quaternary:h.value!==l,type:h.value===l?"primary":"default","aria-pressed":h.value===l?"true":"false",onClick:_=>$(l)},{default:O(()=>[V(a(i(t)("skillsUsage.periodLabel",{days:l})),1)]),_:2},1032,["secondary","quaternary","type","aria-pressed","onClick"])),64))],8,Z),Q(i(K),{size:"small",quaternary:"",loading:g.value,onClick:d[0]||(d[0]=l=>$(h.value,!0))},{default:O(()=>[V(a(i(t)("skillsUsage.refresh")),1)]),_:1},8,["loading"])])]),e("div",ee,[k.value&&!o.value?(n(),r("div",le,a(k.value),1)):g.value&&!o.value?(n(),r("div",se,a(i(t)("common.loading")),1)):o.value?(n(),r(p,{key:2},[k.value?(n(),r("div",ae,a(k.value),1)):F("",!0),e("section",te,[e("div",{class:E(["usage-panel chart-panel",{"is-refreshing":We.value}]),"data-testid":"skills-usage-chart"},[e("div",ie,[e("h3",null,a(i(t)("skillsUsage.dailyTrend")),1),e("span",null,a(i(t)("skillsUsage.periodSummary",{days:o.value.period_days})),1)]),A.value?(n(),r(p,{key:1},[e("div",re,[(n(!0),r(p,null,b(o.value.by_day,(l,_)=>(n(),r("div",{key:l.date,class:"skill-bar-col",tabindex:"0",onMouseenter:c=>H(l,_),onFocusin:c=>H(l,_),onMouseleave:c=>R(l),onFocusout:c=>R(l)},[e("div",ue,[e("div",{class:"skill-bar-fill",style:f({height:Ye(l.total_count)})},[(n(!0),r(p,null,b(N(l),c=>(n(),r("div",{key:c.key,class:"skill-bar-segment","data-skill":c.key,style:f({flex:Ze(c.count),background:c.color})},null,12,de))),128))],4)])],40,ne))),128))]),y.value?(n(),r("div",{key:0,class:E(["floating-tooltip",Ge.value])},[e("div",ce,a(y.value.date),1),(n(!0),r(p,null,b(je.value,l=>(n(),r("div",{key:l.key,class:"tooltip-row"},[e("i",{class:"tooltip-dot",style:f({background:l.color})},null,4),e("span",null,a(l.label),1),e("strong",null,a(l.count),1)]))),128)),e("div",_e,[e("span",null,a(i(t)("skillsUsage.totalActions")),1),e("strong",null,a(y.value.total_count),1)])],2)):F("",!0),e("div",ve,[e("span",null,a(o.value.by_day[0]?.date.slice(5)),1),e("span",null,a(o.value.by_day[o.value.by_day.length-1]?.date.slice(5)),1)])],64)):(n(),r("div",oe,a(i(t)("skillsUsage.noData")),1))],2),e("div",{class:"summary-grid","data-testid":"skills-usage-stats","aria-label":i(t)("skillsUsage.summary")},[e("div",ke,[e("div",pe,a(i(t)("skillsUsage.totalActions")),1),e("div",me,a(o.value.summary.total_skill_actions),1)]),e("div",ge,[e("div",ye,a(i(t)("skillsUsage.loads")),1),e("div",fe,a(o.value.summary.total_skill_loads),1)]),e("div",be,[e("div",Se,a(i(t)("skillsUsage.edits")),1),e("div",Ue,a(o.value.summary.total_skill_edits),1)]),e("div",we,[e("div",xe,a(i(t)("skillsUsage.distinctSkills")),1),e("div",Ve,a(o.value.summary.distinct_skills_used),1)])],8,he)]),e("section",Ce,[e("div",Me,[e("h3",null,a(i(t)("skillsUsage.topSkills")),1),e("span",null,a(i(t)("skillsUsage.periodSummary",{days:o.value.period_days})),1)]),A.value?(n(),r("div",{key:1,class:"skills-table",role:"table","aria-label":i(t)("skillsUsage.topSkills")},[e("div",Fe,[e("span",Be,a(i(t)("skillsUsage.skill")),1),e("span",Pe,a(i(t)("skillsUsage.loads")),1),e("span",qe,a(i(t)("skillsUsage.edits")),1),e("span",Te,a(i(t)("skillsUsage.share")),1),e("span",ze,a(i(t)("skillsUsage.lastUsed")),1)]),(n(!0),r(p,null,b(o.value.top_skills,l=>(n(),r("div",{key:l.skill,class:"skills-row",role:"row"},[e("span",Ae,[e("i",{class:"skill-color-dot",style:f({background:D(l.skill)})},null,4),V(" "+a(l.skill),1)]),e("span",Ie,a(l.view_count),1),e("span",Le,a(l.manage_count),1),e("span",Ne,[e("span",He,[e("span",{style:f({width:I(l.percentage),background:D(l.skill)})},null,4)]),V(" "+a(I(l.percentage)),1)]),e("span",Re,a(Xe(l.last_used_at)),1)]))),128))],8,$e)):(n(),r("div",De,a(i(t)("skillsUsage.noData")),1))])],64)):F("",!0)])]))}})})),hl=q((()=>{})),kl,pl=q((()=>{Ee(),Ee(),hl(),nl(),kl=ul(Ke,[["__scopeId","data-v-efe6595e"]])}));pl();export{kl as default};
@@ -1 +1 @@
1
- import{n as M}from"./rolldown-runtime-BKwlnUi0.js";import{Bt as b,Ct as Je,Ht as u,Pt as _,Q as D,W as N,Z as nl,_t as ol,at as n,bt as Q,c as rl,ct as H,gt as ul,it as w,lt as R,nt as e,rt as q,st as F,t as W,tt as I,vt as a,y as Oe,z as dl,zt as h}from"./ui-vendor-BMwF7QXa.js";import{n as A,r as E}from"./vue-vendor-kBYBtqCg.js";import{n as K,t as Z}from"./_plugin-vue_export-helper-B8gz9Iqn.js";import{r as cl,t as vl}from"./profiles-DiEn61KW.js";import{n as Xe,t as U}from"./MarkdownRenderer-BbsOzYq-.js";import{a as hl,l as kl,n as G,o as j,r as _l,s as gl}from"./skills-BQ2jtPxK.js";var J,O,X,Y,ee,le,te,se,ie,ae,ne,oe,re,ue,de,ce,ve,he,ke,_e,ge,Ye,pe=M((()=>{N(),W(),j(),A(),J={class:"skill-list"},O={key:0,class:"skill-empty"},X=["onClick"],Y={class:"category-name"},ee={class:"category-count"},le={key:0,class:"category-skills"},te=["onClick"],se={class:"skill-info"},ie={class:"skill-name"},ae=["title"],ne=["title"],oe={key:0,class:"skill-desc"},re={key:1,class:"skill-category archive-section"},ue={class:"category-name"},de={class:"category-count"},ce={key:0,class:"category-skills"},ve=["onClick"],he={class:"skill-info"},ke={class:"skill-name"},_e=["title"],ge={key:0,class:"skill-desc"},Ye=R({__name:"SkillList",props:{categories:{},archived:{},selectedSkill:{},searchQuery:{},sourceFilter:{}},emits:["select"],setup(v,{emit:$}){const{t:g}=E(),z=Oe(),o=v,V=$,f=_(new Set),c=_(!0),k=_(new Set),C=I(()=>{let r=o.archived;if(o.sourceFilter&&o.sourceFilter!=="modified"&&(r=r.filter(s=>(s.source||"local")===o.sourceFilter)),o.searchQuery){const s=o.searchQuery.toLowerCase();r=r.filter(l=>l.name.toLowerCase().includes(s)||l.description.toLowerCase().includes(s))}return r}),p=I(()=>{let r=o.categories;if(o.sourceFilter&&(r=r.map(s=>({...s,skills:s.skills.filter(l=>o.sourceFilter==="modified"?l.modified:(l.source||"local")===o.sourceFilter)})).filter(s=>s.skills.length>0)),o.searchQuery){const s=o.searchQuery.toLowerCase();r=r.map(l=>({...l,skills:l.skills.filter(t=>t.name.toLowerCase().includes(s)||t.description.toLowerCase().includes(s))})).filter(l=>l.skills.length>0||l.name.toLowerCase().includes(s))}return r});function S(r){f.value.has(r)?f.value.delete(r):f.value.add(r)}function B(r,s){V("select",r,s)}function x(r,s){return`${r}/${s.name}`}async function P(r,s,l){if(!k.value.has(s)){k.value.add(s);try{await kl(s,l);const t=o.categories.find(m=>m.name===r)?.skills.find(m=>m.name===s);t&&(t.enabled=l)}catch(t){z.error(g("skills.toggleFailed")+`: ${t.message}`)}finally{k.value.delete(s)}}}return(r,s)=>(a(),n("div",J,[p.value.length===0?(a(),n("div",O,u(v.searchQuery?h(g)("skills.noMatch"):h(g)("skills.noSkills")),1)):w("",!0),(a(!0),n(D,null,Q(p.value,l=>(a(),n("div",{key:l.name,class:"skill-category"},[e("button",{class:"category-header",onClick:t=>S(l.name)},[(a(),n("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:b(["category-arrow",{collapsed:f.value.has(l.name)}])},[...s[2]||(s[2]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),e("span",Y,u(l.name),1),e("span",ee,u(l.skills.length),1)],8,X),f.value.has(l.name)?w("",!0):(a(),n("div",le,[(a(!0),n(D,null,Q(l.skills,t=>(a(),n("button",{key:x(l.name,t),class:b(["skill-item",[{active:v.selectedSkill===x(l.name,t)},`source-${t.source||"local"}`]]),onClick:m=>B(l.name,t.name)},[e("div",se,[e("span",ie,[e("span",{class:b(["source-dot",`dot-${t.source||"local"}`]),title:h(g)(`skills.source.${t.source||"local"}`)},null,10,ae),F(" "+u(t.name)+" ",1),t.modified?(a(),n("span",{key:0,class:"modified-badge",title:h(g)("skills.modified")},"✎",8,ne)):w("",!0)]),t.description?(a(),n("span",oe,u(t.description),1)):w("",!0)]),H(h(rl),{size:"small",value:t.enabled!==!1,loading:k.value.has(t.name),"onUpdate:value":m=>P(l.name,t.name,m),onClick:s[0]||(s[0]=nl(()=>{},["stop"]))},null,8,["value","loading","onUpdate:value"])],10,te))),128))]))]))),128)),C.value.length>0||v.archived.length>0?(a(),n("div",re,[e("button",{class:"category-header archive-header",onClick:s[1]||(s[1]=l=>c.value=!c.value)},[(a(),n("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:b(["category-arrow",{collapsed:c.value}])},[...s[3]||(s[3]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),e("span",ue,u(h(g)("skills.archived")),1),e("span",de,u(v.archived.length),1)]),c.value?w("",!0):(a(),n("div",ce,[(a(!0),n(D,null,Q(C.value,l=>(a(),n("button",{key:x(".archive",l),class:b(["skill-item skill-archived",{active:v.selectedSkill===x(".archive",l)}]),onClick:t=>B(".archive",l.name)},[e("div",he,[e("span",ke,[e("span",{class:b(["source-dot",`dot-${l.source||"local"}`]),title:h(g)(`skills.source.${l.source||"local"}`)},null,10,_e),F(" "+u(l.name),1)]),l.description?(a(),n("span",ge,u(l.description),1)):w("",!0)])],10,ve))),128))]))])):w("",!0)]))}})})),pl=M((()=>{})),el,ml=M((()=>{pe(),pe(),pl(),K(),el=Z(Ye,[["__scopeId","data-v-e16dc912"]])})),me,fe,ye,we,$e,Ce,Se,be,xe,Le,Fe,Be,Me,Ve,ze,Pe,Te,De,ll,Qe=M((()=>{N(),Xe(),j(),A(),W(),me={class:"skill-detail"},fe={class:"detail-title"},ye={class:"detail-category"},we={class:"detail-name"},$e={class:"usage-stats"},Ce=["disabled","title"],Se=["fill"],be={key:0,class:"usage-stat",title:"Views"},xe={key:1,class:"usage-stat",title:"Uses"},Le={key:2,class:"usage-stat",title:"Patches"},Fe={key:0,class:"detail-loading"},Be={key:0,class:"detail-breadcrumb"},Me={class:"breadcrumb-path"},Ve={class:"detail-content"},ze={key:1,class:"detail-files"},Pe={class:"files-header"},Te={class:"files-list"},De=["onClick"],ll=R({__name:"SkillDetail",props:{category:{},skill:{},skillName:{},patchCount:{},useCount:{},viewCount:{},pinned:{type:Boolean}},emits:["pinToggled"],setup(v,{emit:$}){const{t:g}=E(),z=Oe(),o=v,V=$,f=_(""),c=_([]),k=_(!1),C=_(""),p=_(null),S=_(!1);async function B(){k.value=!0,p.value=null,C.value="",c.value=[],f.value="";try{const l=`${o.category}/${o.skill}/SKILL.md`,[t,m]=await Promise.all([G(l),_l(o.category,o.skill)]);f.value=t,c.value=m.filter(L=>!L.isDir&&L.path!=="SKILL.md")}catch(l){f.value=g("skills.loadFailed")+`: ${l.message}`}finally{k.value=!1}}async function x(l){S.value=!0,p.value=l;try{const t=`${o.category}/${o.skill}/`;let m=l;if(l.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(l)){const L=l.replace(/\\/g,"/").split(/(?:^|\/)(?:\.hermes|hermes)\/skills\//)[1];L&&(m=L.split("/").slice(2).join("/"))}C.value=await G(`${t}${m}`)}catch(t){C.value=g("skills.fileLoadFailed")+`: ${t.message}`}finally{S.value=!1}}function P(){p.value=null,C.value=""}const r=_(!1);async function s(){if(!r.value){r.value=!0;try{const l=!o.pinned;await gl(o.skillName,l),V("pinToggled",o.skillName,l)}catch(l){z.error(g("skills.pinFailed")+`: ${l.message}`)}finally{r.value=!1}}}return Je(()=>`${o.category}/${o.skill}`,B,{immediate:!0}),(l,t)=>(a(),n("div",me,[e("div",fe,[e("span",ye,u(v.category),1),t[4]||(t[4]=e("span",{class:"detail-separator"},"/",-1)),e("span",we,u(v.skill),1),e("div",$e,[e("button",{class:b(["pin-toggle",{active:v.pinned}]),disabled:r.value,title:v.pinned?h(g)("skills.unpin"):h(g)("skills.pin"),onClick:s},[(a(),n("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:v.pinned?"currentColor":"none",stroke:"currentColor","stroke-width":"2"},[...t[0]||(t[0]=[e("path",{d:"M16 12V4h1V2H7v2h1v8l-2 2v2h5.2v6h1.6v-6H18v-2l-2-2z"},null,-1)])],8,Se))],10,Ce),v.viewCount!=null?(a(),n("span",be,[t[1]||(t[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)),F(" "+u(v.viewCount),1)])):w("",!0),v.useCount!=null?(a(),n("span",xe,[t[2]||(t[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)),F(" "+u(v.useCount),1)])):w("",!0),v.patchCount!=null?(a(),n("span",Le,[t[3]||(t[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)),F(" "+u(v.patchCount),1)])):w("",!0)])]),k.value&&!f.value?(a(),n("div",Fe,u(h(g)("common.loading")),1)):(a(),n(D,{key:1},[p.value?(a(),n("div",Be,[e("button",{class:"back-btn",onClick:P},[t[5]||(t[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)),F(" "+u(h(g)("skills.backTo"))+" "+u(v.skill),1)]),e("span",Me,u(p.value),1)])):w("",!0),e("div",Ve,[p.value?(a(),q(U,{key:0,content:C.value},null,8,["content"])):(a(),q(U,{key:1,content:f.value},null,8,["content"]))]),!p.value&&c.value.length>0?(a(),n("div",ze,[e("div",Pe,u(h(g)("skills.attachedFiles")),1),e("div",Te,[(a(!0),n(D,null,Q(c.value,m=>(a(),n("button",{key:m.path,class:"file-item",onClick:L=>x(m.path)},[t[6]||(t[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,u(m.path),1)],8,De))),128))])])):w("",!0)],64))]))}})})),fl=M((()=>{})),tl,yl=M((()=>{Qe(),Qe(),fl(),K(),tl=Z(ll,[["__scopeId","data-v-e1b89b0f"]])})),qe,Ie,He,Ue,Ne,Re,We,Ae,Ee,Ke,Ze,je,sl,Ge=M((()=>{N(),W(),A(),ml(),yl(),Xe(),j(),vl(),qe={class:"skills-view"},Ie={class:"page-header"},He={style:{display:"flex","align-items":"center",gap:"8px"}},Ue={class:"header-title"},Ne={class:"source-legend"},Re={class:"skills-content"},We={key:0,class:"skills-loading"},Ae={key:1,class:"skills-layout"},Ee={key:0,class:"skills-sidebar"},Ke={class:"skills-main"},Ze={key:1,class:"recommendations-panel"},je={key:1,class:"empty-detail"},sl=R({__name:"SkillsView",setup(v){const{t:$,locale:g}=E(),z=cl(),o=_([]),V=_([]),f=_(!1),c=_(""),k=_(""),C=_(""),p=_(!0),S=_(null),B=_("");let x=null,P=0;const r=I(()=>String(g.value).startsWith("zh")?"/skill-recommendations.zh.md":"/skill-recommendations.en.md"),s=I(()=>!c.value||!k.value?null:c.value===".archive"?V.value.find(d=>d.name===k.value)??null:o.value.find(d=>d.name===c.value)?.skills.find(d=>d.name===k.value)??null);function l(d){p.value=!d.matches}ul(()=>{x=window.matchMedia("(max-width: 768px)"),l(x),x.addEventListener("change",l),t(),m()}),ol(()=>{x?.removeEventListener("change",l)});async function t(){f.value=!0;try{(!z.activeProfileName||z.profiles.length===0)&&await z.fetchProfiles();const d=await hl();o.value=d.categories,V.value=d.archived}catch(d){console.error("Failed to load skills:",d)}finally{f.value=!1}}async function m(){const d=++P;try{const i=await fetch(r.value);if(!i.ok)throw new Error(`HTTP ${i.status}`);const y=await i.text();d===P&&(B.value=y)}catch(i){d===P&&(B.value=""),console.error("Failed to load skill recommendations:",i)}}Je(r,m);function L(d){S.value=S.value===d?null:d}function il(d,i){if(c.value===d&&k.value===i){c.value="",k.value="";return}c.value=d,k.value=i,window.innerWidth<=768&&(p.value=!1)}function al(d,i){if(c.value===".archive"){const y=V.value.find(T=>T.name===d);y&&(y.pinned=i)}else{const y=o.value.find(T=>T.name===c.value)?.skills.find(T=>T.name===d);y&&(y.pinned=i)}}return(d,i)=>(a(),n("div",qe,[e("header",Ie,[e("div",He,[e("h2",Ue,u(h($)("skills.title")),1),p.value?w("",!0):(a(),n("button",{key:0,class:"sidebar-toggle",onClick:i[0]||(i[0]=y=>p.value=!0)},[...i[7]||(i[7]=[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",Ne,[e("button",{class:b(["legend-item",{active:S.value==="builtin"}]),onClick:i[1]||(i[1]=y=>L("builtin"))},[i[8]||(i[8]=e("span",{class:"legend-dot dot-builtin"},null,-1)),F(u(h($)("skills.source.builtin")),1)],2),e("button",{class:b(["legend-item",{active:S.value==="hub"}]),onClick:i[2]||(i[2]=y=>L("hub"))},[i[9]||(i[9]=e("span",{class:"legend-dot dot-hub"},null,-1)),F(u(h($)("skills.source.hub")),1)],2),e("button",{class:b(["legend-item",{active:S.value==="local"}]),onClick:i[3]||(i[3]=y=>L("local"))},[i[10]||(i[10]=e("span",{class:"legend-dot dot-local"},null,-1)),F(u(h($)("skills.source.local")),1)],2),e("button",{class:b(["legend-item",{active:S.value==="modified"}]),onClick:i[4]||(i[4]=y=>L("modified"))},[i[11]||(i[11]=e("span",{class:"modified-icon"},"✎",-1)),F(u(h($)("skills.modified")),1)],2)]),H(h(dl),{value:C.value,"onUpdate:value":i[5]||(i[5]=y=>C.value=y),placeholder:h($)("skills.searchPlaceholder"),size:"small",clearable:"",style:{width:"160px"}},null,8,["value","placeholder"])]),e("div",Re,[f.value&&o.value.length===0?(a(),n("div",We,u(h($)("common.loading")),1)):(a(),n("div",Ae,[e("div",{class:b(["mobile-backdrop",{active:p.value}]),onClick:i[6]||(i[6]=y=>p.value=!1)},null,2),p.value?(a(),n("div",Ee,[H(el,{categories:o.value,archived:V.value,"selected-skill":c.value&&k.value?`${c.value}/${k.value}`:null,"search-query":C.value,"source-filter":S.value,onSelect:il},null,8,["categories","archived","selected-skill","search-query","source-filter"])])):w("",!0),e("div",Ke,[c.value&&k.value?(a(),q(tl,{key:0,category:c.value,skill:k.value,"skill-name":s.value?.name||k.value,"patch-count":s.value?.patchCount,"use-count":s.value?.useCount,"view-count":s.value?.viewCount,pinned:s.value?.pinned,onPinToggled:al},null,8,["category","skill","skill-name","patch-count","use-count","view-count","pinned"])):(a(),n("div",Ze,[B.value?(a(),q(U,{key:0,content:B.value},null,8,["content"])):(a(),n("div",je,[i[12]||(i[12]=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,u(h($)("skills.noMatch")),1)]))]))])]))])]))}})})),wl=M((()=>{})),$l,Cl=M((()=>{Ge(),Ge(),wl(),K(),$l=Z(sl,[["__scopeId","data-v-ed46c05f"]])}));Cl();export{$l as default};
1
+ import{n as M}from"./rolldown-runtime-BKwlnUi0.js";import{Bt as b,Ct as Je,Ht as u,Pt as _,Q as D,W as N,Z as nl,_t as ol,at as n,bt as Q,c as rl,ct as H,gt as ul,it as w,lt as R,nt as e,rt as q,st as F,t as W,tt as I,vt as a,y as Oe,z as dl,zt as h}from"./ui-vendor-BMwF7QXa.js";import{n as A,r as E}from"./vue-vendor-kBYBtqCg.js";import{n as K,t as Z}from"./_plugin-vue_export-helper-CHoatqkO.js";import{r as cl,t as vl}from"./profiles-CyjgPK1f.js";import{n as Xe,t as U}from"./MarkdownRenderer-BJbqsrMI.js";import{a as hl,l as kl,n as G,o as j,r as _l,s as gl}from"./skills-vuknhTFJ.js";var J,O,X,Y,ee,le,te,se,ie,ae,ne,oe,re,ue,de,ce,ve,he,ke,_e,ge,Ye,pe=M((()=>{N(),W(),j(),A(),J={class:"skill-list"},O={key:0,class:"skill-empty"},X=["onClick"],Y={class:"category-name"},ee={class:"category-count"},le={key:0,class:"category-skills"},te=["onClick"],se={class:"skill-info"},ie={class:"skill-name"},ae=["title"],ne=["title"],oe={key:0,class:"skill-desc"},re={key:1,class:"skill-category archive-section"},ue={class:"category-name"},de={class:"category-count"},ce={key:0,class:"category-skills"},ve=["onClick"],he={class:"skill-info"},ke={class:"skill-name"},_e=["title"],ge={key:0,class:"skill-desc"},Ye=R({__name:"SkillList",props:{categories:{},archived:{},selectedSkill:{},searchQuery:{},sourceFilter:{}},emits:["select"],setup(v,{emit:$}){const{t:g}=E(),z=Oe(),o=v,V=$,f=_(new Set),c=_(!0),k=_(new Set),C=I(()=>{let r=o.archived;if(o.sourceFilter&&o.sourceFilter!=="modified"&&(r=r.filter(s=>(s.source||"local")===o.sourceFilter)),o.searchQuery){const s=o.searchQuery.toLowerCase();r=r.filter(l=>l.name.toLowerCase().includes(s)||l.description.toLowerCase().includes(s))}return r}),p=I(()=>{let r=o.categories;if(o.sourceFilter&&(r=r.map(s=>({...s,skills:s.skills.filter(l=>o.sourceFilter==="modified"?l.modified:(l.source||"local")===o.sourceFilter)})).filter(s=>s.skills.length>0)),o.searchQuery){const s=o.searchQuery.toLowerCase();r=r.map(l=>({...l,skills:l.skills.filter(t=>t.name.toLowerCase().includes(s)||t.description.toLowerCase().includes(s))})).filter(l=>l.skills.length>0||l.name.toLowerCase().includes(s))}return r});function S(r){f.value.has(r)?f.value.delete(r):f.value.add(r)}function B(r,s){V("select",r,s)}function x(r,s){return`${r}/${s.name}`}async function P(r,s,l){if(!k.value.has(s)){k.value.add(s);try{await kl(s,l);const t=o.categories.find(m=>m.name===r)?.skills.find(m=>m.name===s);t&&(t.enabled=l)}catch(t){z.error(g("skills.toggleFailed")+`: ${t.message}`)}finally{k.value.delete(s)}}}return(r,s)=>(a(),n("div",J,[p.value.length===0?(a(),n("div",O,u(v.searchQuery?h(g)("skills.noMatch"):h(g)("skills.noSkills")),1)):w("",!0),(a(!0),n(D,null,Q(p.value,l=>(a(),n("div",{key:l.name,class:"skill-category"},[e("button",{class:"category-header",onClick:t=>S(l.name)},[(a(),n("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:b(["category-arrow",{collapsed:f.value.has(l.name)}])},[...s[2]||(s[2]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),e("span",Y,u(l.name),1),e("span",ee,u(l.skills.length),1)],8,X),f.value.has(l.name)?w("",!0):(a(),n("div",le,[(a(!0),n(D,null,Q(l.skills,t=>(a(),n("button",{key:x(l.name,t),class:b(["skill-item",[{active:v.selectedSkill===x(l.name,t)},`source-${t.source||"local"}`]]),onClick:m=>B(l.name,t.name)},[e("div",se,[e("span",ie,[e("span",{class:b(["source-dot",`dot-${t.source||"local"}`]),title:h(g)(`skills.source.${t.source||"local"}`)},null,10,ae),F(" "+u(t.name)+" ",1),t.modified?(a(),n("span",{key:0,class:"modified-badge",title:h(g)("skills.modified")},"✎",8,ne)):w("",!0)]),t.description?(a(),n("span",oe,u(t.description),1)):w("",!0)]),H(h(rl),{size:"small",value:t.enabled!==!1,loading:k.value.has(t.name),"onUpdate:value":m=>P(l.name,t.name,m),onClick:s[0]||(s[0]=nl(()=>{},["stop"]))},null,8,["value","loading","onUpdate:value"])],10,te))),128))]))]))),128)),C.value.length>0||v.archived.length>0?(a(),n("div",re,[e("button",{class:"category-header archive-header",onClick:s[1]||(s[1]=l=>c.value=!c.value)},[(a(),n("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:b(["category-arrow",{collapsed:c.value}])},[...s[3]||(s[3]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),e("span",ue,u(h(g)("skills.archived")),1),e("span",de,u(v.archived.length),1)]),c.value?w("",!0):(a(),n("div",ce,[(a(!0),n(D,null,Q(C.value,l=>(a(),n("button",{key:x(".archive",l),class:b(["skill-item skill-archived",{active:v.selectedSkill===x(".archive",l)}]),onClick:t=>B(".archive",l.name)},[e("div",he,[e("span",ke,[e("span",{class:b(["source-dot",`dot-${l.source||"local"}`]),title:h(g)(`skills.source.${l.source||"local"}`)},null,10,_e),F(" "+u(l.name),1)]),l.description?(a(),n("span",ge,u(l.description),1)):w("",!0)])],10,ve))),128))]))])):w("",!0)]))}})})),pl=M((()=>{})),el,ml=M((()=>{pe(),pe(),pl(),K(),el=Z(Ye,[["__scopeId","data-v-e16dc912"]])})),me,fe,ye,we,$e,Ce,Se,be,xe,Le,Fe,Be,Me,Ve,ze,Pe,Te,De,ll,Qe=M((()=>{N(),Xe(),j(),A(),W(),me={class:"skill-detail"},fe={class:"detail-title"},ye={class:"detail-category"},we={class:"detail-name"},$e={class:"usage-stats"},Ce=["disabled","title"],Se=["fill"],be={key:0,class:"usage-stat",title:"Views"},xe={key:1,class:"usage-stat",title:"Uses"},Le={key:2,class:"usage-stat",title:"Patches"},Fe={key:0,class:"detail-loading"},Be={key:0,class:"detail-breadcrumb"},Me={class:"breadcrumb-path"},Ve={class:"detail-content"},ze={key:1,class:"detail-files"},Pe={class:"files-header"},Te={class:"files-list"},De=["onClick"],ll=R({__name:"SkillDetail",props:{category:{},skill:{},skillName:{},patchCount:{},useCount:{},viewCount:{},pinned:{type:Boolean}},emits:["pinToggled"],setup(v,{emit:$}){const{t:g}=E(),z=Oe(),o=v,V=$,f=_(""),c=_([]),k=_(!1),C=_(""),p=_(null),S=_(!1);async function B(){k.value=!0,p.value=null,C.value="",c.value=[],f.value="";try{const l=`${o.category}/${o.skill}/SKILL.md`,[t,m]=await Promise.all([G(l),_l(o.category,o.skill)]);f.value=t,c.value=m.filter(L=>!L.isDir&&L.path!=="SKILL.md")}catch(l){f.value=g("skills.loadFailed")+`: ${l.message}`}finally{k.value=!1}}async function x(l){S.value=!0,p.value=l;try{const t=`${o.category}/${o.skill}/`;let m=l;if(l.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(l)){const L=l.replace(/\\/g,"/").split(/(?:^|\/)(?:\.hermes|hermes)\/skills\//)[1];L&&(m=L.split("/").slice(2).join("/"))}C.value=await G(`${t}${m}`)}catch(t){C.value=g("skills.fileLoadFailed")+`: ${t.message}`}finally{S.value=!1}}function P(){p.value=null,C.value=""}const r=_(!1);async function s(){if(!r.value){r.value=!0;try{const l=!o.pinned;await gl(o.skillName,l),V("pinToggled",o.skillName,l)}catch(l){z.error(g("skills.pinFailed")+`: ${l.message}`)}finally{r.value=!1}}}return Je(()=>`${o.category}/${o.skill}`,B,{immediate:!0}),(l,t)=>(a(),n("div",me,[e("div",fe,[e("span",ye,u(v.category),1),t[4]||(t[4]=e("span",{class:"detail-separator"},"/",-1)),e("span",we,u(v.skill),1),e("div",$e,[e("button",{class:b(["pin-toggle",{active:v.pinned}]),disabled:r.value,title:v.pinned?h(g)("skills.unpin"):h(g)("skills.pin"),onClick:s},[(a(),n("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:v.pinned?"currentColor":"none",stroke:"currentColor","stroke-width":"2"},[...t[0]||(t[0]=[e("path",{d:"M16 12V4h1V2H7v2h1v8l-2 2v2h5.2v6h1.6v-6H18v-2l-2-2z"},null,-1)])],8,Se))],10,Ce),v.viewCount!=null?(a(),n("span",be,[t[1]||(t[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)),F(" "+u(v.viewCount),1)])):w("",!0),v.useCount!=null?(a(),n("span",xe,[t[2]||(t[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)),F(" "+u(v.useCount),1)])):w("",!0),v.patchCount!=null?(a(),n("span",Le,[t[3]||(t[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)),F(" "+u(v.patchCount),1)])):w("",!0)])]),k.value&&!f.value?(a(),n("div",Fe,u(h(g)("common.loading")),1)):(a(),n(D,{key:1},[p.value?(a(),n("div",Be,[e("button",{class:"back-btn",onClick:P},[t[5]||(t[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)),F(" "+u(h(g)("skills.backTo"))+" "+u(v.skill),1)]),e("span",Me,u(p.value),1)])):w("",!0),e("div",Ve,[p.value?(a(),q(U,{key:0,content:C.value},null,8,["content"])):(a(),q(U,{key:1,content:f.value},null,8,["content"]))]),!p.value&&c.value.length>0?(a(),n("div",ze,[e("div",Pe,u(h(g)("skills.attachedFiles")),1),e("div",Te,[(a(!0),n(D,null,Q(c.value,m=>(a(),n("button",{key:m.path,class:"file-item",onClick:L=>x(m.path)},[t[6]||(t[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,u(m.path),1)],8,De))),128))])])):w("",!0)],64))]))}})})),fl=M((()=>{})),tl,yl=M((()=>{Qe(),Qe(),fl(),K(),tl=Z(ll,[["__scopeId","data-v-e1b89b0f"]])})),qe,Ie,He,Ue,Ne,Re,We,Ae,Ee,Ke,Ze,je,sl,Ge=M((()=>{N(),W(),A(),ml(),yl(),Xe(),j(),vl(),qe={class:"skills-view"},Ie={class:"page-header"},He={style:{display:"flex","align-items":"center",gap:"8px"}},Ue={class:"header-title"},Ne={class:"source-legend"},Re={class:"skills-content"},We={key:0,class:"skills-loading"},Ae={key:1,class:"skills-layout"},Ee={key:0,class:"skills-sidebar"},Ke={class:"skills-main"},Ze={key:1,class:"recommendations-panel"},je={key:1,class:"empty-detail"},sl=R({__name:"SkillsView",setup(v){const{t:$,locale:g}=E(),z=cl(),o=_([]),V=_([]),f=_(!1),c=_(""),k=_(""),C=_(""),p=_(!0),S=_(null),B=_("");let x=null,P=0;const r=I(()=>String(g.value).startsWith("zh")?"/skill-recommendations.zh.md":"/skill-recommendations.en.md"),s=I(()=>!c.value||!k.value?null:c.value===".archive"?V.value.find(d=>d.name===k.value)??null:o.value.find(d=>d.name===c.value)?.skills.find(d=>d.name===k.value)??null);function l(d){p.value=!d.matches}ul(()=>{x=window.matchMedia("(max-width: 768px)"),l(x),x.addEventListener("change",l),t(),m()}),ol(()=>{x?.removeEventListener("change",l)});async function t(){f.value=!0;try{(!z.activeProfileName||z.profiles.length===0)&&await z.fetchProfiles();const d=await hl();o.value=d.categories,V.value=d.archived}catch(d){console.error("Failed to load skills:",d)}finally{f.value=!1}}async function m(){const d=++P;try{const i=await fetch(r.value);if(!i.ok)throw new Error(`HTTP ${i.status}`);const y=await i.text();d===P&&(B.value=y)}catch(i){d===P&&(B.value=""),console.error("Failed to load skill recommendations:",i)}}Je(r,m);function L(d){S.value=S.value===d?null:d}function il(d,i){if(c.value===d&&k.value===i){c.value="",k.value="";return}c.value=d,k.value=i,window.innerWidth<=768&&(p.value=!1)}function al(d,i){if(c.value===".archive"){const y=V.value.find(T=>T.name===d);y&&(y.pinned=i)}else{const y=o.value.find(T=>T.name===c.value)?.skills.find(T=>T.name===d);y&&(y.pinned=i)}}return(d,i)=>(a(),n("div",qe,[e("header",Ie,[e("div",He,[e("h2",Ue,u(h($)("skills.title")),1),p.value?w("",!0):(a(),n("button",{key:0,class:"sidebar-toggle",onClick:i[0]||(i[0]=y=>p.value=!0)},[...i[7]||(i[7]=[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",Ne,[e("button",{class:b(["legend-item",{active:S.value==="builtin"}]),onClick:i[1]||(i[1]=y=>L("builtin"))},[i[8]||(i[8]=e("span",{class:"legend-dot dot-builtin"},null,-1)),F(u(h($)("skills.source.builtin")),1)],2),e("button",{class:b(["legend-item",{active:S.value==="hub"}]),onClick:i[2]||(i[2]=y=>L("hub"))},[i[9]||(i[9]=e("span",{class:"legend-dot dot-hub"},null,-1)),F(u(h($)("skills.source.hub")),1)],2),e("button",{class:b(["legend-item",{active:S.value==="local"}]),onClick:i[3]||(i[3]=y=>L("local"))},[i[10]||(i[10]=e("span",{class:"legend-dot dot-local"},null,-1)),F(u(h($)("skills.source.local")),1)],2),e("button",{class:b(["legend-item",{active:S.value==="modified"}]),onClick:i[4]||(i[4]=y=>L("modified"))},[i[11]||(i[11]=e("span",{class:"modified-icon"},"✎",-1)),F(u(h($)("skills.modified")),1)],2)]),H(h(dl),{value:C.value,"onUpdate:value":i[5]||(i[5]=y=>C.value=y),placeholder:h($)("skills.searchPlaceholder"),size:"small",clearable:"",style:{width:"160px"}},null,8,["value","placeholder"])]),e("div",Re,[f.value&&o.value.length===0?(a(),n("div",We,u(h($)("common.loading")),1)):(a(),n("div",Ae,[e("div",{class:b(["mobile-backdrop",{active:p.value}]),onClick:i[6]||(i[6]=y=>p.value=!1)},null,2),p.value?(a(),n("div",Ee,[H(el,{categories:o.value,archived:V.value,"selected-skill":c.value&&k.value?`${c.value}/${k.value}`:null,"search-query":C.value,"source-filter":S.value,onSelect:il},null,8,["categories","archived","selected-skill","search-query","source-filter"])])):w("",!0),e("div",Ke,[c.value&&k.value?(a(),q(tl,{key:0,category:c.value,skill:k.value,"skill-name":s.value?.name||k.value,"patch-count":s.value?.patchCount,"use-count":s.value?.useCount,"view-count":s.value?.viewCount,pinned:s.value?.pinned,onPinToggled:al},null,8,["category","skill","skill-name","patch-count","use-count","view-count","pinned"])):(a(),n("div",Ze,[B.value?(a(),q(U,{key:0,content:B.value},null,8,["content"])):(a(),n("div",je,[i[12]||(i[12]=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,u(h($)("skills.noMatch")),1)]))]))])]))])]))}})})),wl=M((()=>{})),$l,Cl=M((()=>{Ge(),Ge(),wl(),K(),$l=Z(sl,[["__scopeId","data-v-ed46c05f"]])}));Cl();export{$l as default};
@@ -1,3 +1,3 @@
1
- import{n as S}from"./rolldown-runtime-BKwlnUi0.js";import{A as xe,Bt as E,D as Te,Ht as f,I as L,Pt as w,Q as Me,Tt as h,Vt as Se,W as Ae,Z as Re,_t as We,at as b,bt as Ye,ct as p,d as Ge,gt as Ee,it as B,lt as Le,nt as r,rt as ze,st as z,t as Oe,tt as O,vt as d,y as $e,zt as n}from"./ui-vendor-BMwF7QXa.js";import{n as Ve,r as De}from"./vue-vendor-kBYBtqCg.js";import{l as Ie,n as Ne,o as Pe,s as Ue,t as He}from"./_plugin-vue_export-helper-B8gz9Iqn.js";import{a as Fe,i as je,n as qe,o as Je,r as Ke,s as Qe,t as Xe}from"./xterm-CN_HBdCu.js";var U,H,F,j,q,J,K,Q,X,Z,ee,te,ae,re,ie,ne,le,oe,ce,$,V,fe,se=S((()=>{Ae(),Qe(),je(),Ke(),Xe(),Ie(),Oe(),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"},K=["onClick"],Q={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"},ie={class:"terminal-header"},ne={class:"header-left"},le={key:0,class:"header-session-title"},oe={class:"header-actions"},ce={class:"terminal-container"},$="hermes_terminal_theme",V=18,fe=Le({__name:"TerminalView",setup(rt){const{t:g}=De(),de=$e(),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($)||"default");let i=null;const u=new Map;let s=null,_=null,A=null,y=null,k=null,v=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=Pe(),t=Ue(),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 I(){const e=he();i=new WebSocket(e),i.onopen=()=>{},i.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)},i.onopen=()=>{},i.onclose=()=>{setTimeout(I,3e3)},i.onerror=()=>{}}function T(e){!i||i.readyState!==WebSocket.OPEN||i.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 S}from"./rolldown-runtime-BKwlnUi0.js";import{A as xe,Bt as E,D as Te,Ht as f,I as L,Pt as w,Q as Me,Tt as h,Vt as Se,W as Ae,Z as Re,_t as We,at as b,bt as Ye,ct as p,d as Ge,gt as Ee,it as B,lt as Le,nt as r,rt as ze,st as z,t as Oe,tt as O,vt as d,y as $e,zt as n}from"./ui-vendor-BMwF7QXa.js";import{n as Ve,r as De}from"./vue-vendor-kBYBtqCg.js";import{l as Ie,n as Ne,o as Pe,s as Ue,t as He}from"./_plugin-vue_export-helper-CHoatqkO.js";import{a as Fe,i as je,n as qe,o as Je,r as Ke,s as Qe,t as Xe}from"./xterm-CN_HBdCu.js";var U,H,F,j,q,J,K,Q,X,Z,ee,te,ae,re,ie,ne,le,oe,ce,$,V,fe,se=S((()=>{Ae(),Qe(),je(),Ke(),Xe(),Ie(),Oe(),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"},K=["onClick"],Q={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"},ie={class:"terminal-header"},ne={class:"header-left"},le={key:0,class:"header-session-title"},oe={class:"header-actions"},ce={class:"terminal-container"},$="hermes_terminal_theme",V=18,fe=Le({__name:"TerminalView",setup(rt){const{t:g}=De(),de=$e(),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($)||"default");let i=null;const u=new Map;let s=null,_=null,A=null,y=null,k=null,v=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=Pe(),t=Ue(),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 I(){const e=he();i=new WebSocket(e),i.onopen=()=>{},i.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)},i.onopen=()=>{},i.onclose=()=>{setTimeout(I,3e3)},i.onerror=()=>{}}function T(e){!i||i.readyState!==WebSocket.OPEN||i.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}}),M=new Fe;a.loadAddon(M),a.loadAddon(new qe),a.onData(Ce=>{i?.readyState===WebSocket.OPEN&&i.send(Ce)}),t={term:a,fitAddon:M,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,_=t.fitAddon,ve(),T({type:"switch",sessionId:e}),y?.matches&&(o.value=!1)}function ke(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,_=null,c.value?W(c.value):(N(),R()))}function ve(){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(),_e()}),A.observe(m.value),setTimeout(()=>Y(),50),setTimeout(()=>Y(),200)}}function N(){if(!m.value)return;const e=m.value;for(;e.firstChild;)e.removeChild(e.firstChild)}function Y(){if(_)try{_.fit()}catch{}}function _e(){if(!(!s||!i||i.readyState!==WebSocket.OPEN))try{T({type:"resize",cols:s.cols,rows:s.rows})}catch{}}function ye(e){if(e.touches.length!==1){k=null,v=0;return}k=e.touches[0].clientY,v=0}function we(e){if(!s||e.touches.length!==1||k===null)return;const t=e.touches[0].clientY;v+=k-t,k=t;const a=Math.trunc(v/V);a!==0&&(s.scrollLines(a),v-=a*V,e.preventDefault())}function P(){k=null,v=0}function pe(e){x.value=e,localStorage.setItem($,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 Ee(()=>{y=window.matchMedia("(max-width: 768px)"),G(y),y.addEventListener("change",G),I()}),We(()=>{y?.removeEventListener("change",G),N();for(const e of u.values())e.term.dispose();u.clear(),s=null,_=null,i?.close(),i=null}),(e,t)=>(d(),b("div",U,[r("div",{class:E(["session-backdrop",{active:o.value}]),onClick:t[0]||(t[0]=a=>o.value=!1)},null,2),r("aside",{class:E(["session-list",{collapsed:!o.value}])},[r("div",H,[o.value?(d(),b("span",F,f(n(g)("terminal.sessions")),1)):B("",!0),r("div",j,[p(n(Te),{trigger:"hover"},{trigger:h(()=>[p(n(L),{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(()=>[z(" "+f(n(g)("terminal.newTab")),1)]),_:1})])]),o.value?(d(),b("div",q,[l.value.length===0?(d(),b("div",J,f(n(g)("common.loading")),1)):B("",!0),(d(!0),b(Me,null,Ye(l.value,a=>(d(),b("button",{key:a.id,class:E(["session-item",{active:a.id===c.value,exited:a.exited}]),onClick:M=>W(a.id)},[r("div",Q,[r("span",X,f(a.title),1),r("span",Z,[r("span",ee,f(a.shell),1),a.exited?(d(),b("span",te,f(n(g)("terminal.sessionExited")),1)):(d(),b("span",ae,f(Be(a.createdAt)),1))])]),l.value.length>1?(d(),ze(n(Ge),{key:0,onPositiveClick:M=>ke(a.id)},{trigger:h(()=>[r("button",{class:"session-item-delete",onClick:t[1]||(t[1]=Re(()=>{},["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(()=>[z(" "+f(n(g)("terminal.closeSession")),1)]),_:1},8,["onPositiveClick"])):B("",!0)],10,K))),128))])):B("",!0)],2),r("div",re,[r("header",ie,[r("div",ne,[p(n(L),{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?(d(),b("span",le,f(D.value.title),1)):B("",!0)]),r("div",oe,[p(n(xe),{value:x.value,options:be.value,size:"small","consistent-menu-width":!1,class:"theme-select","onUpdate:value":pe},null,8,["value","options"]),p(n(L),{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(()=>[z(" "+f(n(g)("terminal.newTab")),1)]),_:1})])]),r("div",ce,[r("div",{ref_key:"terminalRef",ref:m,class:"terminal-xterm",style:Se({backgroundColor:ue.value}),onTouchstart:ye,onTouchmove:we,onTouchend:P,onTouchcancel:P},null,36)])])]))}})})),Ze=S((()=>{})),et=S((()=>{})),tt,at=S((()=>{se(),se(),Ze(),et(),Ne(),tt=He(fe,[["__scopeId","data-v-55f3d690"]])}));at();export{tt as default};
@@ -1 +1 @@
1
- import{n as y}from"./rolldown-runtime-BKwlnUi0.js";import{Ht as t,I as q,Pt as V,Q as S,Tt as N,Vt as m,W as C,at as c,bt as M,ct as x,gt as st,it as b,lt as R,nt as e,st as T,t as at,tt as k,vt as p,zt as s}from"./ui-vendor-BMwF7QXa.js";import{d as ot,n as D,r as F,u as nt}from"./vue-vendor-kBYBtqCg.js";import{n as B,t as H}from"./_plugin-vue_export-helper-B8gz9Iqn.js";import{r as lt,t as it}from"./profiles-DiEn61KW.js";import{I as ut,L as rt}from"./index-Cuk9R8hy.js";function je(d){return(d||"").trim()||"unknown"}function w(d,a){return a<=0?0:d/a*100}function W(d){const a=je(d);let o=0;for(let _=0;_<a.length;_+=1)o=(o<<5)-o+a.charCodeAt(_),o|=0;return L[Math.abs(o)%L.length]}var L,P,I=y((()=>{rt(),ot(),C(),L=["#4fd1c5","#63b3ed","#f6ad55","#b794f4","#68d391","#fc8181","#f687b3","#90cdf4","#fbd38d","#9ae6b4"],P=nt("usage",()=>{const d=V(null),a=V(!1);let o=0;async function _(u=30){const v=++o;a.value=!0;try{const $=await ut(u);v===o&&(d.value=$)}catch($){v===o&&console.error("Failed to load usage stats:",$)}finally{v===o&&(a.value=!1)}}const g=k(()=>!!d.value&&d.value.total_sessions>0),r=k(()=>d.value?.total_input_tokens??0),h=k(()=>d.value?.total_output_tokens??0),i=k(()=>r.value+h.value),n=k(()=>d.value?.total_sessions??0),l=k(()=>d.value?.total_cache_read_tokens??0),f=k(()=>{const u=r.value+l.value;return u===0?null:l.value/u*100}),z=k(()=>d.value?.total_cost??0),O=k(()=>d.value?d.value.model_usage.map(u=>{const v=je(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:W(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:d,isLoading:a,hasData:g,loadSessions:_,totalInputTokens:r,totalOutputTokens:h,totalTokens:i,totalSessions:n,totalCacheTokens:l,cacheHitRate:f,estimatedCost:z,modelUsage:O,modelLegend:k(()=>{const u=new Set;return O.value.filter(v=>u.has(v.model)?!1:(u.add(v.model),!0)).map(v=>({model:v.model,color:v.color}))}),dailyUsage:k(()=>(d.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(!d.value||d.value.daily_usage.length===0)return 0;const u=d.value.daily_usage.filter($=>$.sessions>0).length,v=Math.max(1,u);return n.value/v}),getModelColor:W}})})),K,A,E,Q,j,G,J,X,Y,Z,ee,te,se,ae,oe,ne,Ge,le=y((()=>{C(),D(),I(),K={class:"stat-cards"},A={class:"stat-card"},E={class:"stat-label"},Q={class:"stat-value"},j={class:"stat-sub"},G={class:"stat-card"},J={class:"stat-label"},X={class:"stat-value"},Y={class:"stat-sub"},Z={class:"stat-card"},ee={class:"stat-label"},te={class:"stat-value"},se={class:"stat-card"},ae={class:"stat-label"},oe={class:"stat-value"},ne={key:0,class:"stat-sub"},Ge=R({__name:"StatCards",setup(d){const{t:a}=F(),o=P();function _(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)=>(p(),c("div",K,[e("div",A,[e("div",E,t(s(a)("usage.totalTokens")),1),e("div",Q,t(_(s(o).totalTokens)),1),e("div",j,t(_(s(o).totalInputTokens))+" "+t(s(a)("usage.inputTokens"))+" / "+t(_(s(o).totalOutputTokens))+" "+t(s(a)("usage.outputTokens")),1)]),e("div",G,[e("div",J,t(s(a)("usage.totalSessions")),1),e("div",X,t(s(o).totalSessions),1),e("div",Y,t(s(a)("usage.avgPerDay",{n:s(o).avgSessionsPerDay.toFixed(1)})),1)]),e("div",Z,[e("div",ee,t(s(a)("usage.estimatedCost")),1),e("div",te,t(g(s(o).estimatedCost)),1)]),e("div",se,[e("div",ae,t(s(a)("usage.cacheHitRate")),1),e("div",oe,t(s(o).cacheHitRate!==null?s(o).cacheHitRate.toFixed(1)+"%":"--"),1),s(o).cacheHitRate!==null?(p(),c("div",ne,t(_(s(o).totalCacheTokens))+" "+t(s(a)("usage.tokens")),1)):b("",!0)])]))}})})),dt=y((()=>{})),Je,_t=y((()=>{le(),le(),dt(),B(),Je=H(Ge,[["__scopeId","data-v-3a594781"]])})),ie,ue,re,de,_e,ce,pe,ve,he,ge,ke,Xe,ye=y((()=>{C(),D(),I(),ie={class:"model-breakdown"},ue={class:"section-title"},re={class:"model-legend","aria-label":"Token type legend"},de={class:"legend-item"},_e={class:"legend-item"},ce={class:"legend-item"},pe={class:"model-list"},ve=["title"],he={class:"model-bar-wrap"},ge=["title"],ke={key:0},Xe=R({__name:"ModelBreakdown",setup(d){const{t:a}=F(),o=P(),_=k(()=>Math.max(...o.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)=>(p(),c("div",ie,[e("h3",ue,t(s(a)("usage.modelBreakdown")),1),e("div",re,[e("div",de,[i[0]||(i[0]=e("span",{class:"legend-swatch input"},null,-1)),T(t(s(a)("usage.inputTokens")),1)]),e("div",_e,[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,[(p(!0),c(S,null,M(s(o).modelUsage,n=>(p(),c("div",{key:n.model,class:"model-row"},[e("span",{class:"model-swatch",style:m({background:n.color})},null,4),e("span",{class:"model-name",title:n.model},t(n.model),9,ve),e("div",he,[e("div",{class:"model-bar",style:m({width:n.visualTokens/_.value*100+"%"})},[n.inputTokens>0?(p(),c("div",{key:0,class:"model-bar-segment input",style:m({width:n.inputPercent+"%"})},null,4)):b("",!0),n.outputTokens>0?(p(),c("div",{key:1,class:"model-bar-segment output",style:m({width:n.outputPercent+"%"})},null,4)):b("",!0),n.cacheTokens>0?(p(),c("div",{key:2,class:"model-bar-segment cache",style:m({width:n.cachePercent+"%"})},null,4)):b("",!0)],4)]),e("span",{class:"model-tokens",title:`${s(a)("usage.inputTokens")}: ${g(n.inputTokens)} · ${s(a)("usage.outputTokens")}: ${g(n.outputTokens)} · ${s(a)("usage.cacheRead")}: ${g(n.cacheTokens)} · ${s(a)("usage.cacheHitRate")}: ${r(n)}`},[T(t(g(n.totalTokens))+" ",1),n.cacheTokens>0?(p(),c("small",ke,"+"+t(g(n.cacheTokens)),1)):b("",!0)],8,ge)]))),128))])]))}})})),ct=y((()=>{})),Ye,pt=y((()=>{ye(),ye(),ct(),B(),Ye=H(Xe,[["__scopeId","data-v-692258ec"]])})),fe,me,Te,$e,be,we,xe,Se,Ce,Pe,Ue,Me,Re,De,Fe,Be,He,Ie,Ve,Ze,Le=y((()=>{C(),D(),I(),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"},Ie={class:"legend-item"},Ve={class:"trend-table"},Ze=R({__name:"DailyTrend",setup(d){const{t:a}=F(),o=P();function _(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 n=i.input_tokens+i.cache_read_tokens;return n===0?"--":(i.cache_read_tokens/n*100).toFixed(1)+"%"}const h=k(()=>Math.max(...o.dailyUsage.map(i=>i.visualTokens),1));return(i,n)=>(p(),c("div",fe,[e("h3",me,t(s(a)("usage.dailyTrend")),1),e("div",Te,[(p(!0),c(S,null,M(s(o).dailyUsage,l=>(p(),c("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?(p(),c("div",{key:0,class:"bar-segment output",style:m({height:l.outputPercent+"%"})},null,4)):b("",!0),l.input_tokens>0?(p(),c("div",{key:1,class:"bar-segment input",style:m({height:l.inputPercent+"%"})},null,4)):b("",!0),l.cache_read_tokens>0?(p(),c("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(_(l.input_tokens)),1),e("div",Se,t(s(a)("usage.outputTokens"))+": "+t(_(l.output_tokens)),1),e("div",Ce,t(s(a)("usage.cacheRead"))+": "+t(_(l.cache_read_tokens)),1),e("div",Pe,t(s(a)("usage.cacheWrite"))+": "+t(_(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(o).dailyUsage[0]?.date.slice(5)),1),e("span",null,t(s(o).dailyUsage[s(o).dailyUsage.length-1]?.date.slice(5)),1)]),e("div",Fe,[e("div",Be,[n[0]||(n[0]=e("span",{class:"legend-swatch input"},null,-1)),T(t(s(a)("usage.inputTokens")),1)]),e("div",He,[n[1]||(n[1]=e("span",{class:"legend-swatch output"},null,-1)),T(t(s(a)("usage.outputTokens")),1)]),e("div",Ie,[n[2]||(n[2]=e("span",{class:"legend-swatch cache"},null,-1)),T(t(s(a)("usage.cacheRead")),1)])]),e("div",Ve,[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,[(p(!0),c(S,null,M([...s(o).dailyUsage].reverse(),l=>(p(),c("tr",{key:l.date},[e("td",null,t(l.date),1),e("td",null,t(_(l.input_tokens)),1),e("td",null,t(_(l.output_tokens)),1),e("td",null,t(_(l.cache_read_tokens)),1),e("td",null,t(_(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"]])})),ze,Oe,qe,Ne,We,Ke,Ae,Ee,tt,Qe=y((()=>{C(),at(),D(),I(),it(),_t(),pt(),ht(),ze={class:"usage-view"},Oe={class:"page-header"},qe={class:"header-title"},Ne={class:"usage-toolbar"},We={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(d){const{t:a}=F(),o=P(),_=lt(),g=[{label:"7d",days:7},{label:"30d",days:30},{label:"90d",days:90},{label:"365d",days:365}],r=V(30);async function h(){(!_.activeProfileName||_.profiles.length===0)&&await _.fetchProfiles()}async function i(n=r.value){r.value=n,await h(),await o.loadSessions(n)}return st(()=>{i(30)}),(n,l)=>(p(),c("div",ze,[e("header",Oe,[e("h2",qe,t(s(a)("usage.title")),1),e("div",Ne,[e("div",We,[(p(),c(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:z=>i(f.days)},{default:N(()=>[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(o).isLoading,onClick:l[0]||(l[0]=f=>i())},{default:N(()=>[T(t(s(a)("usage.refresh")),1)]),_:1},8,["loading"])])]),e("div",Ke,[s(o).isLoading&&!s(o).hasData?(p(),c("div",Ae,t(s(a)("common.loading")),1)):s(o).hasData?(p(),c(S,{key:1},[x(Je),x(Ye),x(et)],64)):(p(),c("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-BKwlnUi0.js";import{Ht as t,I as q,Pt as V,Q as S,Tt as N,Vt as m,W as C,at as c,bt as M,ct as x,gt as st,it as b,lt as R,nt as e,st as T,t as at,tt as k,vt as p,zt as s}from"./ui-vendor-BMwF7QXa.js";import{d as ot,n as D,r as F,u as nt}from"./vue-vendor-kBYBtqCg.js";import{n as B,t as H}from"./_plugin-vue_export-helper-CHoatqkO.js";import{r as lt,t as it}from"./profiles-CyjgPK1f.js";import{I as ut,L as rt}from"./index-DpU5R9KV.js";function je(d){return(d||"").trim()||"unknown"}function w(d,a){return a<=0?0:d/a*100}function W(d){const a=je(d);let o=0;for(let _=0;_<a.length;_+=1)o=(o<<5)-o+a.charCodeAt(_),o|=0;return L[Math.abs(o)%L.length]}var L,P,I=y((()=>{rt(),ot(),C(),L=["#4fd1c5","#63b3ed","#f6ad55","#b794f4","#68d391","#fc8181","#f687b3","#90cdf4","#fbd38d","#9ae6b4"],P=nt("usage",()=>{const d=V(null),a=V(!1);let o=0;async function _(u=30){const v=++o;a.value=!0;try{const $=await ut(u);v===o&&(d.value=$)}catch($){v===o&&console.error("Failed to load usage stats:",$)}finally{v===o&&(a.value=!1)}}const g=k(()=>!!d.value&&d.value.total_sessions>0),r=k(()=>d.value?.total_input_tokens??0),h=k(()=>d.value?.total_output_tokens??0),i=k(()=>r.value+h.value),n=k(()=>d.value?.total_sessions??0),l=k(()=>d.value?.total_cache_read_tokens??0),f=k(()=>{const u=r.value+l.value;return u===0?null:l.value/u*100}),z=k(()=>d.value?.total_cost??0),O=k(()=>d.value?d.value.model_usage.map(u=>{const v=je(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:W(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:d,isLoading:a,hasData:g,loadSessions:_,totalInputTokens:r,totalOutputTokens:h,totalTokens:i,totalSessions:n,totalCacheTokens:l,cacheHitRate:f,estimatedCost:z,modelUsage:O,modelLegend:k(()=>{const u=new Set;return O.value.filter(v=>u.has(v.model)?!1:(u.add(v.model),!0)).map(v=>({model:v.model,color:v.color}))}),dailyUsage:k(()=>(d.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(!d.value||d.value.daily_usage.length===0)return 0;const u=d.value.daily_usage.filter($=>$.sessions>0).length,v=Math.max(1,u);return n.value/v}),getModelColor:W}})})),K,A,E,Q,j,G,J,X,Y,Z,ee,te,se,ae,oe,ne,Ge,le=y((()=>{C(),D(),I(),K={class:"stat-cards"},A={class:"stat-card"},E={class:"stat-label"},Q={class:"stat-value"},j={class:"stat-sub"},G={class:"stat-card"},J={class:"stat-label"},X={class:"stat-value"},Y={class:"stat-sub"},Z={class:"stat-card"},ee={class:"stat-label"},te={class:"stat-value"},se={class:"stat-card"},ae={class:"stat-label"},oe={class:"stat-value"},ne={key:0,class:"stat-sub"},Ge=R({__name:"StatCards",setup(d){const{t:a}=F(),o=P();function _(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)=>(p(),c("div",K,[e("div",A,[e("div",E,t(s(a)("usage.totalTokens")),1),e("div",Q,t(_(s(o).totalTokens)),1),e("div",j,t(_(s(o).totalInputTokens))+" "+t(s(a)("usage.inputTokens"))+" / "+t(_(s(o).totalOutputTokens))+" "+t(s(a)("usage.outputTokens")),1)]),e("div",G,[e("div",J,t(s(a)("usage.totalSessions")),1),e("div",X,t(s(o).totalSessions),1),e("div",Y,t(s(a)("usage.avgPerDay",{n:s(o).avgSessionsPerDay.toFixed(1)})),1)]),e("div",Z,[e("div",ee,t(s(a)("usage.estimatedCost")),1),e("div",te,t(g(s(o).estimatedCost)),1)]),e("div",se,[e("div",ae,t(s(a)("usage.cacheHitRate")),1),e("div",oe,t(s(o).cacheHitRate!==null?s(o).cacheHitRate.toFixed(1)+"%":"--"),1),s(o).cacheHitRate!==null?(p(),c("div",ne,t(_(s(o).totalCacheTokens))+" "+t(s(a)("usage.tokens")),1)):b("",!0)])]))}})})),dt=y((()=>{})),Je,_t=y((()=>{le(),le(),dt(),B(),Je=H(Ge,[["__scopeId","data-v-3a594781"]])})),ie,ue,re,de,_e,ce,pe,ve,he,ge,ke,Xe,ye=y((()=>{C(),D(),I(),ie={class:"model-breakdown"},ue={class:"section-title"},re={class:"model-legend","aria-label":"Token type legend"},de={class:"legend-item"},_e={class:"legend-item"},ce={class:"legend-item"},pe={class:"model-list"},ve=["title"],he={class:"model-bar-wrap"},ge=["title"],ke={key:0},Xe=R({__name:"ModelBreakdown",setup(d){const{t:a}=F(),o=P(),_=k(()=>Math.max(...o.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)=>(p(),c("div",ie,[e("h3",ue,t(s(a)("usage.modelBreakdown")),1),e("div",re,[e("div",de,[i[0]||(i[0]=e("span",{class:"legend-swatch input"},null,-1)),T(t(s(a)("usage.inputTokens")),1)]),e("div",_e,[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,[(p(!0),c(S,null,M(s(o).modelUsage,n=>(p(),c("div",{key:n.model,class:"model-row"},[e("span",{class:"model-swatch",style:m({background:n.color})},null,4),e("span",{class:"model-name",title:n.model},t(n.model),9,ve),e("div",he,[e("div",{class:"model-bar",style:m({width:n.visualTokens/_.value*100+"%"})},[n.inputTokens>0?(p(),c("div",{key:0,class:"model-bar-segment input",style:m({width:n.inputPercent+"%"})},null,4)):b("",!0),n.outputTokens>0?(p(),c("div",{key:1,class:"model-bar-segment output",style:m({width:n.outputPercent+"%"})},null,4)):b("",!0),n.cacheTokens>0?(p(),c("div",{key:2,class:"model-bar-segment cache",style:m({width:n.cachePercent+"%"})},null,4)):b("",!0)],4)]),e("span",{class:"model-tokens",title:`${s(a)("usage.inputTokens")}: ${g(n.inputTokens)} · ${s(a)("usage.outputTokens")}: ${g(n.outputTokens)} · ${s(a)("usage.cacheRead")}: ${g(n.cacheTokens)} · ${s(a)("usage.cacheHitRate")}: ${r(n)}`},[T(t(g(n.totalTokens))+" ",1),n.cacheTokens>0?(p(),c("small",ke,"+"+t(g(n.cacheTokens)),1)):b("",!0)],8,ge)]))),128))])]))}})})),ct=y((()=>{})),Ye,pt=y((()=>{ye(),ye(),ct(),B(),Ye=H(Xe,[["__scopeId","data-v-692258ec"]])})),fe,me,Te,$e,be,we,xe,Se,Ce,Pe,Ue,Me,Re,De,Fe,Be,He,Ie,Ve,Ze,Le=y((()=>{C(),D(),I(),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"},Ie={class:"legend-item"},Ve={class:"trend-table"},Ze=R({__name:"DailyTrend",setup(d){const{t:a}=F(),o=P();function _(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 n=i.input_tokens+i.cache_read_tokens;return n===0?"--":(i.cache_read_tokens/n*100).toFixed(1)+"%"}const h=k(()=>Math.max(...o.dailyUsage.map(i=>i.visualTokens),1));return(i,n)=>(p(),c("div",fe,[e("h3",me,t(s(a)("usage.dailyTrend")),1),e("div",Te,[(p(!0),c(S,null,M(s(o).dailyUsage,l=>(p(),c("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?(p(),c("div",{key:0,class:"bar-segment output",style:m({height:l.outputPercent+"%"})},null,4)):b("",!0),l.input_tokens>0?(p(),c("div",{key:1,class:"bar-segment input",style:m({height:l.inputPercent+"%"})},null,4)):b("",!0),l.cache_read_tokens>0?(p(),c("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(_(l.input_tokens)),1),e("div",Se,t(s(a)("usage.outputTokens"))+": "+t(_(l.output_tokens)),1),e("div",Ce,t(s(a)("usage.cacheRead"))+": "+t(_(l.cache_read_tokens)),1),e("div",Pe,t(s(a)("usage.cacheWrite"))+": "+t(_(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(o).dailyUsage[0]?.date.slice(5)),1),e("span",null,t(s(o).dailyUsage[s(o).dailyUsage.length-1]?.date.slice(5)),1)]),e("div",Fe,[e("div",Be,[n[0]||(n[0]=e("span",{class:"legend-swatch input"},null,-1)),T(t(s(a)("usage.inputTokens")),1)]),e("div",He,[n[1]||(n[1]=e("span",{class:"legend-swatch output"},null,-1)),T(t(s(a)("usage.outputTokens")),1)]),e("div",Ie,[n[2]||(n[2]=e("span",{class:"legend-swatch cache"},null,-1)),T(t(s(a)("usage.cacheRead")),1)])]),e("div",Ve,[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,[(p(!0),c(S,null,M([...s(o).dailyUsage].reverse(),l=>(p(),c("tr",{key:l.date},[e("td",null,t(l.date),1),e("td",null,t(_(l.input_tokens)),1),e("td",null,t(_(l.output_tokens)),1),e("td",null,t(_(l.cache_read_tokens)),1),e("td",null,t(_(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"]])})),ze,Oe,qe,Ne,We,Ke,Ae,Ee,tt,Qe=y((()=>{C(),at(),D(),I(),it(),_t(),pt(),ht(),ze={class:"usage-view"},Oe={class:"page-header"},qe={class:"header-title"},Ne={class:"usage-toolbar"},We={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(d){const{t:a}=F(),o=P(),_=lt(),g=[{label:"7d",days:7},{label:"30d",days:30},{label:"90d",days:90},{label:"365d",days:365}],r=V(30);async function h(){(!_.activeProfileName||_.profiles.length===0)&&await _.fetchProfiles()}async function i(n=r.value){r.value=n,await h(),await o.loadSessions(n)}return st(()=>{i(30)}),(n,l)=>(p(),c("div",ze,[e("header",Oe,[e("h2",qe,t(s(a)("usage.title")),1),e("div",Ne,[e("div",We,[(p(),c(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:z=>i(f.days)},{default:N(()=>[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(o).isLoading,onClick:l[0]||(l[0]=f=>i())},{default:N(()=>[T(t(s(a)("usage.refresh")),1)]),_:1},8,["loading"])])]),e("div",Ke,[s(o).isLoading&&!s(o).hasData?(p(),c("div",Ae,t(s(a)("common.loading")),1)):s(o).hasData?(p(),c(S,{key:1},[x(Je),x(Ye),x(et)],64)):(p(),c("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};