hermes-web-ui 0.5.34-beta.1 → 0.5.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/js/{ChannelsView-Br-rl8MM.js → ChannelsView-BCAR00sd.js} +1 -1
- package/dist/client/assets/js/{ChatView-BVhgFDjO.js → ChatView-OMtKkBOT.js} +1 -1
- package/dist/client/assets/js/{FileRenameModal-DzQpI0rK.js → FileRenameModal-DGnmmJBS.js} +1 -1
- package/dist/client/assets/js/{FilesView-BBP7WSuC.js → FilesView-CPRvSmVN.js} +1 -1
- package/dist/client/assets/js/{GroupChatView-BvAA5221.js → GroupChatView-BHbFk5XX.js} +1 -1
- package/dist/client/assets/js/{HistoryMessageList-DXkIRYPR.js → HistoryMessageList-BghxqP7e.js} +1 -1
- package/dist/client/assets/js/{HistoryView-IBOKr1VZ.js → HistoryView-BAFlJdLo.js} +1 -1
- package/dist/client/assets/js/{JobsView-Dt1UY8BV.js → JobsView-DizE9SLP.js} +1 -1
- package/dist/client/assets/js/{KanbanView-BuN97CZx.js → KanbanView-DbX9YUP1.js} +1 -1
- package/dist/client/assets/js/{LoginView-Bq9h2K4w.js → LoginView-V5AQgsLv.js} +1 -1
- package/dist/client/assets/js/{LogsView-BvriwpL9.js → LogsView-D4lc8e6U.js} +1 -1
- package/dist/client/assets/js/{MarkdownRenderer-DvkMz9DC.js → MarkdownRenderer-CdhBsVZY.js} +1 -1
- package/dist/client/assets/js/{MemoryView-BDV49noZ.js → MemoryView-BTLneK0h.js} +1 -1
- package/dist/client/assets/js/{MessageItem-05UPjoUy.js → MessageItem-ClybD2bU.js} +1 -1
- package/dist/client/assets/js/{ModelsView-B3jJGzrZ.js → ModelsView-OjwzEQHQ.js} +1 -1
- package/dist/client/assets/js/{OutlinePanel-CRuhqmKn.js → OutlinePanel-CQYGEF5y.js} +1 -1
- package/dist/client/assets/js/{PluginsView-Dq88iPYH.js → PluginsView-44vb8dID.js} +1 -1
- package/dist/client/assets/js/{ProfilesView-BYMcwMPh.js → ProfilesView-DccgvW5-.js} +1 -1
- package/dist/client/assets/js/{SettingRow-ClGoB4p9.js → SettingRow-C_5lbZtm.js} +1 -1
- package/dist/client/assets/js/{SettingsView-BHhPGL6h.js → SettingsView-FDpv40C1.js} +1 -1
- package/dist/client/assets/js/{SkillsUsageView-DxQqOh9T.js → SkillsUsageView-CHYYZ5-Y.js} +1 -1
- package/dist/client/assets/js/{SkillsView-_66_corY.js → SkillsView-CntGJRjC.js} +1 -1
- package/dist/client/assets/js/{TerminalView-BXrMzrQ3.js → TerminalView-hyGNfwpd.js} +1 -1
- package/dist/client/assets/js/{UsageView-B_I3RKlp.js → UsageView-oRkYlsix.js} +1 -1
- package/dist/client/assets/js/_plugin-vue_export-helper-DSvknO3W.js +2 -0
- package/dist/client/assets/js/{auth-CS-f3EOR.js → auth-w9NXFGhI.js} +1 -1
- package/dist/client/assets/js/index-BPkv55ib.js +1 -0
- package/dist/client/assets/js/{models-P6P9HvdV.js → models-DSIvp7WE.js} +1 -1
- package/dist/client/assets/js/{session-browser-prefs-BL8nUm3K.js → session-browser-prefs-BuDjwgV-.js} +1 -1
- package/dist/client/assets/js/{skills-CJjcA2b7.js → skills-CtAjhfhj.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/client/assets/js/_plugin-vue_export-helper-BwtYqnFW.js +0 -2
- package/dist/client/assets/js/index-CEEIeN-5.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as U}from"./rolldown-runtime-BKwlnUi0.js";import{B as Te,F as te,Mt as R,Nt as L,R as p,Rt as e,St as Be,U as N,Vt as S,Z as z,_t as v,bt as Re,c as g,ct as Q,et as Ve,gt as Ie,ht as Pe,it as _,l as xe,nt as F,ot as D,rt as b,st as n,t as J,tt as C,wt as o,y as Le,yt as De,z as $e,zt as ne}from"./ui-vendor-Do3bR-2m.js";import{n as O,r as j}from"./vue-vendor-CTEo-aiR.js";import{n as E,t as G}from"./_plugin-vue_export-helper-BwtYqnFW.js";import{c as We,d as Ne,f as Qe,l as Fe,o as we,s as qe,u as Je}from"./index-CEEIeN-5.js";import{n as Oe,t as s}from"./SettingRow-ClGoB4p9.js";var ie,oe,re,se,ye,ue=U((()=>{N(),J(),O(),ie={class:"platform-info"},oe=["innerHTML"],re={class:"platform-name"},se={key:0,class:"platform-card-body"},ye=Q({__name:"PlatformCard",props:{name:{},icon:{},config:{},credentials:{},exclusive:{type:Boolean}},setup(A){const h=A,q=L(!0),{t:a}=j(),H=Ve(()=>{const x=h.credentials;if(!x)return!1;const w=["token","api_key","app_id","client_id","secret","app_secret","client_secret","access_token","bot_id","account_id","enabled"];return[x,x.extra].filter(Boolean).some(M=>w.some(T=>{const y=M[T];return y!=null&&y!==""&&y!==!1}))});return(x,w)=>(v(),_("div",{class:ne(["platform-card",{configured:H.value}])},[C("div",{class:"platform-card-header",onClick:w[0]||(w[0]=M=>q.value=!q.value)},[C("div",ie,[C("span",{class:"platform-icon",innerHTML:A.icon},null,8,oe),C("span",re,S(A.name),1),n(e(Te),{type:H.value?"success":"default",size:"small",round:""},{default:o(()=>[D(S(H.value?e(a)("common.configured"):e(a)("common.notConfigured")),1)]),_:1},8,["type"])]),C("span",{class:ne(["expand-icon",{expanded:q.value}])},"▾",2)]),q.value?(v(),_("div",se,[A.exclusive?(v(),F(e($e),{key:0,type:"warning","show-icon":!0,class:"exclusive-alert"},{default:o(()=>[D(S(e(a)("platform.exclusiveTokenWarning")),1)]),_:1})):b("",!0),Re(x.$slots,"default",{},void 0,!0)])):b("",!0)],2))}})})),je=U((()=>{})),ze,Ee=U((()=>{ue(),ue(),je(),E(),ze=G(ye,[["__scopeId","data-v-e27ecbbe"]])})),de,pe,ce,me,fe,Ce,ve=U((()=>{N(),J(),O(),we(),Fe(),Ee(),Oe(),de={class:"settings-section"},pe={class:"weixin-qr-section"},ce={key:1,class:"weixin-qr-loading"},me={key:2,class:"weixin-qr-hint"},fe={class:"platform-actions"},Ce=Q({__name:"PlatformSettings",setup(A){const h=qe(),q=Le(),{t:a}=j(),H=R({}),x=R({}),w=R({}),M=R({}),T=R({});function y(i){return JSON.parse(JSON.stringify(i||{}))}function $(i,l){for(const[m,t]of Object.entries(l))t&&typeof t=="object"&&!Array.isArray(t)?i[m]=$({...i[m]||{}},t):i[m]=t;return i}function d(i){return x[i]||(x[i]=y(h[i])),x[i]}function u(i){return w[i]||(w[i]=y(B(i))),w[i]}function c(i,l){x[i]=$({...d(i)},l),M[i]=!0}function f(i,l){w[i]=$({...u(i)},l),T[i]=!0}function Z(i,l){return JSON.stringify(i||{})===JSON.stringify(l||{})}function K(i){return!!M[i]&&!!x[i]&&!Z(x[i],h[i])}function X(i){return!!T[i]&&!!w[i]&&!Z(w[i],B(i))}function Se(i){return K(i)||X(i)}function r(i){return!!H[i]}async function Me(i){H[i]=!0;try{const l=K(i),m=X(i);l&&await h.saveSection(i,d(i),{restart:!m}),m&&(await Ne(i,u(i)),await h.fetchSettings()),x[i]=y(h[i]),w[i]=y(B(i)),M[i]=!1,T[i]=!1,q.success(a("settings.saved"))}catch(l){q.error(l?.message||a("settings.saveFailed"))}finally{H[i]=!1}}function B(i){return h.platforms[i]||{}}function Y(i){return i===!0||i==="true"}const ee=L(""),V=L(""),k=L("idle");let I=null;async function Ae(){k.value="loading",ee.value="",V.value="",le();try{const i=await We();V.value=i.qrcode,ee.value=i.qrcode_url,window.open(i.qrcode_url,"_blank"),k.value="waiting",P()}catch(i){k.value="error",q.error(i.message||a("platform.qrFetching"))}}function P(){V.value&&(I=setTimeout(async()=>{try{const i=await Je(V.value);i.status==="wait"?P():i.status==="scaned"?(k.value="scaned",P()):i.status==="expired"?k.value="expired":i.status==="confirmed"&&(k.value="confirmed",await Qe({account_id:i.account_id,token:i.token,base_url:i.base_url}),await h.fetchSettings(),q.success(a("settings.saved")))}catch{P()}},3e3))}function le(){I&&(clearTimeout(I),I=null)}Ie(()=>{le()});const ae=[{key:"telegram",name:"Telegram",exclusive:!0,icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.479.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"/></svg>'},{key:"discord",name:"Discord",exclusive:!0,icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189z"/></svg>'},{key:"slack",name:"Slack",exclusive:!0,icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zm1.271 0a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zm0 1.271a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zm10.122 0a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V5.042zm-1.27 0a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zm0-1.27a2.527 2.527 0 0 1 2.523-2.52h6.313A2.528 2.528 0 0 1 24 18.956a2.528 2.528 0 0 1-2.522 2.523h-6.313z"/></svg>'},{key:"whatsapp",name:"WhatsApp",exclusive:!0,icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"/></svg>'},{key:"matrix",name:"Matrix",icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M.632.55v22.9H2.28V24H0V0h2.28v.55zm7.043 7.26v1.157h.033c.309-.443.683-.784 1.117-1.024.433-.245.936-.365 1.5-.365.54 0 1.033.107 1.48.324.448.217.786.619 1.017 1.205.24-.376.558-.702.956-.98.398-.277.872-.414 1.424-.414.41 0 .784.065 1.122.194.34.13.629.325.87.588.241.263.428.59.56.984.132.393.198.85.198 1.368v5.89h-2.49v-4.893c0-.268-.016-.525-.048-.77a1.627 1.627 0 00-.2-.63 1.028 1.028 0 00-.392-.426 1.294 1.294 0 00-.616-.134c-.277 0-.508.05-.693.15a1.043 1.043 0 00-.43.41 1.768 1.768 0 00-.214.616 4.15 4.15 0 00-.06.74v4.937H9.29v-4.937c0-.25-.01-.498-.032-.742a1.84 1.84 0 00-.166-.638.998.998 0 00-.363-.448 1.206 1.206 0 00-.624-.154c-.26 0-.483.048-.67.144a1.055 1.055 0 00-.436.402 1.744 1.744 0 00-.227.616 4.108 4.108 0 00-.063.74v4.937H5.21V7.81zm15.693 15.64V.55H21.72V0H24v24h-2.28v-.55z"/></svg>'},{key:"feishu",name:"Feishu",exclusive:!0,icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M6.59 3.41a2.25 2.25 0 0 1 3.182 0L13.5 7.14l-3.182 3.182L6.59 7.59a2.25 2.25 0 0 1 0-3.182zm5.303 5.303L15.075 5.53a2.25 2.25 0 0 1 3.182 3.182L15.075 11.894 11.893 8.713zM3.41 6.59a2.25 2.25 0 0 1 3.182 0l3.182 3.182-3.182 3.182a2.25 2.25 0 0 1-3.182-3.182L3.41 6.59zm5.303 5.303L11.894 15.075a2.25 2.25 0 0 1-3.182 3.182L5.53 15.075 8.713 11.893zm5.303-5.303L17.478 9.778a2.25 2.25 0 0 1-3.182 3.182L10.53 10.075l3.182-3.182 0 .023z"/></svg>'},{key:"dingtalk",name:"DingTalk",exclusive:!0,icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M19.76 7.05c-.23-.52-.7-.9-1.26-1.02L5.35 3.2c-.77-.16-1.51.38-1.58 1.16-.22 2.55.17 5.4 1.13 7.66.97 2.29 2.52 4.11 4.45 4.82l-1.28 3.03c-.17.4.24.79.63.59l9.47-4.83c.34-.17.55-.52.55-.9v-3.12c.73-.4 1.22-1.17 1.22-2.06 0-.87-.08-1.73-.18-2.5zm-3.66 5.95-5.19 2.65.76-1.8c.12-.29-.03-.62-.33-.72-2.1-.73-3.56-3.54-3.95-6.73l9.27 2c.04.38.07.76.07 1.15 0 .45-.36.81-.81.81h-2.79c-.35 0-.63.28-.63.63s.28.63.63.63h2.97V13z"/></svg>'},{key:"qqbot",name:"QQBot",exclusive:!0,icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C7.58 2 4 5.27 4 9.31c0 2.3 1.15 4.34 2.95 5.68-.13.58-.48 1.62-1.26 2.53-.24.28-.05.72.32.73 1.72.05 3.02-.68 3.69-1.15.72.16 1.49.25 2.3.25 4.42 0 8-3.27 8-7.31S16.42 2 12 2zm-3.2 7.63c-.63 0-1.14-.55-1.14-1.23s.51-1.23 1.14-1.23 1.14.55 1.14 1.23-.51 1.23-1.14 1.23zm6.4 0c-.63 0-1.14-.55-1.14-1.23s.51-1.23 1.14-1.23 1.14.55 1.14 1.23-.51 1.23-1.14 1.23zM5.5 20.5a.5.5 0 0 1 .5-.5h12a.5.5 0 0 1 0 1H6a.5.5 0 0 1-.5-.5z"/></svg>'},{key:"weixin",name:"Weixin",exclusive:!0,icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 01.213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 00.167-.054l1.903-1.114a.864.864 0 01.717-.098 10.16 10.16 0 002.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 01-1.162 1.178A1.17 1.17 0 014.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 01-1.162 1.178 1.17 1.17 0 01-1.162-1.178c0-.651.52-1.18 1.162-1.18zm3.68 4.025c-3.694 0-6.69 2.462-6.69 5.496 0 3.034 2.996 5.496 6.69 5.496.753 0 1.477-.1 2.158-.28a.66.66 0 01.548.074l1.46.854a.25.25 0 00.127.041.224.224 0 00.221-.225c0-.055-.022-.109-.037-.162l-.298-1.131a.453.453 0 01.163-.509C21.81 18.613 22.77 16.973 22.77 15.512c0-3.034-2.996-5.496-6.69-5.496h.198zm-2.454 3.347c.491 0 .889.404.889.902a.896.896 0 01-.889.903.896.896 0 01-.889-.903c0-.498.398-.902.889-.902zm4.912 0c.491 0 .889.404.889.902a.896.896 0 01-.889.903.896.896 0 01-.889-.903c0-.498.398-.902.889-.902z"/></svg>'},{key:"wecom",name:"WeCom",icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 01.213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 00.167-.054l1.903-1.114a.864.864 0 01.717-.098 10.16 10.16 0 002.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 01-1.162 1.178A1.17 1.17 0 014.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 01-1.162 1.178 1.17 1.17 0 01-1.162-1.178c0-.651.52-1.18 1.162-1.18zm3.68 4.025c-3.694 0-6.69 2.462-6.69 5.496 0 3.034 2.996 5.496 6.69 5.496.753 0 1.477-.1 2.158-.28a.66.66 0 01.548.074l1.46.854a.25.25 0 00.127.041.224.224 0 00.221-.225c0-.055-.022-.109-.037-.162l-.298-1.131a.453.453 0 01.163-.509C21.81 18.613 22.77 16.973 22.77 15.512c0-3.034-2.996-5.496-6.69-5.496h.198zm-2.454 3.347c.491 0 .889.404.889.902a.896.896 0 01-.889.903.896.896 0 01-.889-.903c0-.498.398-.902.889-.902zm4.912 0c.491 0 .889.404.889.902a.896.896 0 01-.889.903.896.896 0 01-.889-.903c0-.498.398-.902.889-.902z"/></svg>'}];return Be(()=>ae.map(i=>({key:i.key,config:h[i.key],credentials:B(i.key)})),i=>{for(const l of i)M[l.key]||(x[l.key]=y(l.config)),T[l.key]||(w[l.key]=y(l.credentials))},{deep:!0,immediate:!0}),(i,l)=>(v(),_("section",de,[(v(),_(z,null,De(ae,m=>n(ze,{key:m.key,name:m.name,icon:m.icon,exclusive:m.exclusive,config:e(h)[m.key],credentials:B(m.key)},{default:o(()=>[m.key==="telegram"?(v(),_(z,{key:0},[n(s,{label:e(a)("platform.botToken"),hint:e(a)("platform.botTokenHint")},{default:o(()=>[n(e(p),{value:u("telegram").token||"",loading:r("telegram"),clearable:"",size:"small",class:"input-lg",placeholder:"123456:ABC-DEF...","onUpdate:value":l[0]||(l[0]=t=>f("telegram",{token:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.requireMention"),hint:e(a)("platform.requireMentionGroup")},{default:o(()=>[n(e(g),{value:d("telegram").require_mention,loading:r("telegram"),"onUpdate:value":l[1]||(l[1]=t=>c("telegram",{require_mention:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.reactions"),hint:e(a)("platform.reactionsHint")},{default:o(()=>[n(e(g),{value:d("telegram").reactions,loading:r("telegram"),"onUpdate:value":l[2]||(l[2]=t=>c("telegram",{reactions:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.freeResponseChats"),hint:e(a)("platform.freeResponseChatsHint")},{default:o(()=>[n(e(p),{value:d("telegram").free_response_chats||"",loading:r("telegram"),size:"small",placeholder:"chat_id1,chat_id2","onUpdate:value":l[3]||(l[3]=t=>c("telegram",{free_response_chats:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.mentionPatterns"),hint:e(a)("platform.mentionPatternsHint")},{default:o(()=>[n(e(p),{value:(d("telegram").mention_patterns||[]).join(", "),loading:r("telegram"),size:"small",placeholder:"pattern1, pattern2","onUpdate:value":l[4]||(l[4]=t=>c("telegram",{mention_patterns:t?t.split(",").map(W=>W.trim()):[]}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),m.key==="discord"?(v(),_(z,{key:1},[n(s,{label:e(a)("platform.botToken"),hint:e(a)("platform.botTokenHint")},{default:o(()=>[n(e(p),{value:u("discord").token||"",loading:r("discord"),clearable:"",size:"small",class:"input-lg",placeholder:"Bot token...","onUpdate:value":l[5]||(l[5]=t=>f("discord",{token:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.requireMention"),hint:e(a)("platform.requireMentionChannel")},{default:o(()=>[n(e(g),{value:d("discord").require_mention,loading:r("discord"),"onUpdate:value":l[6]||(l[6]=t=>c("discord",{require_mention:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.autoThread"),hint:e(a)("platform.autoThreadHint")},{default:o(()=>[n(e(g),{value:d("discord").auto_thread,loading:r("discord"),"onUpdate:value":l[7]||(l[7]=t=>c("discord",{auto_thread:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.reactions"),hint:e(a)("platform.reactionsHint")},{default:o(()=>[n(e(g),{value:d("discord").reactions,loading:r("discord"),"onUpdate:value":l[8]||(l[8]=t=>c("discord",{reactions:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.freeResponseChannels"),hint:e(a)("platform.freeResponseChannelsHint")},{default:o(()=>[n(e(p),{value:d("discord").free_response_channels||"",loading:r("discord"),size:"small",placeholder:"channel_id1,channel_id2","onUpdate:value":l[9]||(l[9]=t=>c("discord",{free_response_channels:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.allowedChannels"),hint:e(a)("platform.allowedChannelsHint")},{default:o(()=>[n(e(p),{value:d("discord").allowed_channels||"",loading:r("discord"),size:"small",placeholder:"channel_id1,channel_id2","onUpdate:value":l[10]||(l[10]=t=>c("discord",{allowed_channels:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.ignoredChannels"),hint:e(a)("platform.ignoredChannelsHint")},{default:o(()=>[n(e(p),{value:d("discord").ignored_channels||"",loading:r("discord"),size:"small",placeholder:"channel_id1,channel_id2","onUpdate:value":l[11]||(l[11]=t=>c("discord",{ignored_channels:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.noThreadChannels"),hint:e(a)("platform.noThreadChannelsHint")},{default:o(()=>[n(e(p),{value:d("discord").no_thread_channels||"",loading:r("discord"),size:"small",placeholder:"channel_id1,channel_id2","onUpdate:value":l[12]||(l[12]=t=>c("discord",{no_thread_channels:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),m.key==="slack"?(v(),_(z,{key:2},[n(s,{label:e(a)("platform.botToken"),hint:e(a)("platform.botTokenHint")},{default:o(()=>[n(e(p),{value:u("slack").token||"",loading:r("slack"),clearable:"",size:"small",class:"input-lg",placeholder:"xoxb-...","onUpdate:value":l[13]||(l[13]=t=>f("slack",{token:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.requireMention"),hint:e(a)("platform.requireMentionChannel")},{default:o(()=>[n(e(g),{value:d("slack").require_mention,loading:r("slack"),"onUpdate:value":l[14]||(l[14]=t=>c("slack",{require_mention:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.allowBots"),hint:e(a)("platform.allowBotsHint")},{default:o(()=>[n(e(g),{value:d("slack").allow_bots,loading:r("slack"),"onUpdate:value":l[15]||(l[15]=t=>c("slack",{allow_bots:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.freeResponseChannels"),hint:e(a)("platform.freeResponseChannelsHint")},{default:o(()=>[n(e(p),{value:d("slack").free_response_channels||"",loading:r("slack"),size:"small",placeholder:"channel_id1,channel_id2","onUpdate:value":l[16]||(l[16]=t=>c("slack",{free_response_channels:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),m.key==="whatsapp"?(v(),_(z,{key:3},[n(s,{label:e(a)("platform.waEnabled"),hint:e(a)("platform.waEnabledHint")},{default:o(()=>[n(e(g),{value:u("whatsapp").enabled,loading:r("whatsapp"),"onUpdate:value":l[17]||(l[17]=t=>f("whatsapp",{enabled:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.requireMention"),hint:e(a)("platform.requireMentionGroup")},{default:o(()=>[n(e(g),{value:d("whatsapp").require_mention,loading:r("whatsapp"),"onUpdate:value":l[18]||(l[18]=t=>c("whatsapp",{require_mention:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.freeResponseChats"),hint:e(a)("platform.freeResponseChatsHint")},{default:o(()=>[n(e(p),{value:d("whatsapp").free_response_chats||"",loading:r("whatsapp"),size:"small",placeholder:"chat_id1,chat_id2","onUpdate:value":l[19]||(l[19]=t=>c("whatsapp",{free_response_chats:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.mentionPatterns"),hint:e(a)("platform.mentionPatternsHint")},{default:o(()=>[n(e(p),{value:(d("whatsapp").mention_patterns||[]).join(", "),loading:r("whatsapp"),size:"small",placeholder:"pattern1, pattern2","onUpdate:value":l[20]||(l[20]=t=>c("whatsapp",{mention_patterns:t?t.split(",").map(W=>W.trim()):[]}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),m.key==="matrix"?(v(),_(z,{key:4},[n(s,{label:e(a)("platform.accessToken"),hint:e(a)("platform.accessTokenHint")},{default:o(()=>[n(e(p),{value:u("matrix").token||"",loading:r("matrix"),clearable:"",size:"small",class:"input-lg",placeholder:"syt_...","onUpdate:value":l[21]||(l[21]=t=>f("matrix",{token:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.homeserver"),hint:e(a)("platform.homeserverHint")},{default:o(()=>[n(e(p),{value:u("matrix").extra?.homeserver||"",loading:r("matrix"),clearable:"",size:"small",class:"input-lg",placeholder:"https://matrix.org","onUpdate:value":l[22]||(l[22]=t=>f("matrix",{extra:{...u("matrix").extra,homeserver:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.requireMention"),hint:e(a)("platform.requireMentionRoom")},{default:o(()=>[n(e(g),{value:d("matrix").require_mention,loading:r("matrix"),"onUpdate:value":l[23]||(l[23]=t=>c("matrix",{require_mention:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.autoThread"),hint:e(a)("platform.autoThreadHintRoom")},{default:o(()=>[n(e(g),{value:d("matrix").auto_thread,loading:r("matrix"),"onUpdate:value":l[24]||(l[24]=t=>c("matrix",{auto_thread:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.dmMentionThreads"),hint:e(a)("platform.dmMentionThreadsHint")},{default:o(()=>[n(e(g),{value:d("matrix").dm_mention_threads,loading:r("matrix"),"onUpdate:value":l[25]||(l[25]=t=>c("matrix",{dm_mention_threads:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.freeResponseRooms"),hint:e(a)("platform.freeResponseRoomsHint")},{default:o(()=>[n(e(p),{value:d("matrix").free_response_rooms||"",loading:r("matrix"),size:"small",placeholder:"room_id1,room_id2","onUpdate:value":l[26]||(l[26]=t=>c("matrix",{free_response_rooms:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),m.key==="feishu"?(v(),_(z,{key:5},[n(s,{label:e(a)("platform.appId"),hint:e(a)("platform.appIdHint")},{default:o(()=>[n(e(p),{value:u("feishu").extra?.app_id||"",loading:r("feishu"),clearable:"",size:"small",class:"input-lg",placeholder:"cli_...","onUpdate:value":l[27]||(l[27]=t=>f("feishu",{extra:{...u("feishu").extra,app_id:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.appSecret"),hint:e(a)("platform.appSecretHint")},{default:o(()=>[n(e(p),{value:u("feishu").extra?.app_secret||"",loading:r("feishu"),clearable:"",size:"small",class:"input-lg",placeholder:"App Secret","onUpdate:value":l[28]||(l[28]=t=>f("feishu",{extra:{...u("feishu").extra,app_secret:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.requireMention"),hint:e(a)("platform.requireMentionGroup")},{default:o(()=>[n(e(g),{value:d("feishu").require_mention,loading:r("feishu"),"onUpdate:value":l[29]||(l[29]=t=>c("feishu",{require_mention:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.freeResponseChats"),hint:e(a)("platform.freeResponseChatsHint")},{default:o(()=>[n(e(p),{value:d("feishu").free_response_chats||"",loading:r("feishu"),size:"small",placeholder:"chat_id1,chat_id2","onUpdate:value":l[30]||(l[30]=t=>c("feishu",{free_response_chats:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),m.key==="dingtalk"?(v(),_(z,{key:6},[n(s,{label:e(a)("platform.clientId"),hint:e(a)("platform.clientIdHint")},{default:o(()=>[n(e(p),{value:u("dingtalk").extra?.client_id||"",loading:r("dingtalk"),clearable:"",size:"small",class:"input-lg",placeholder:"Client ID","onUpdate:value":l[31]||(l[31]=t=>f("dingtalk",{extra:{...u("dingtalk").extra,client_id:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.clientSecret"),hint:e(a)("platform.clientSecretHint")},{default:o(()=>[n(e(p),{value:u("dingtalk").extra?.client_secret||"",loading:r("dingtalk"),clearable:"",size:"small",class:"input-lg",placeholder:"Client Secret","onUpdate:value":l[32]||(l[32]=t=>f("dingtalk",{extra:{...u("dingtalk").extra,client_secret:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.allowAllUsers"),hint:e(a)("platform.allowAllUsersHint")},{default:o(()=>[n(e(g),{value:Y(u("dingtalk").allow_all_users),loading:r("dingtalk"),"onUpdate:value":l[33]||(l[33]=t=>f("dingtalk",{allow_all_users:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.allowedUsers"),hint:e(a)("platform.allowedUsersHint")},{default:o(()=>[n(e(p),{value:u("dingtalk").allowed_users||"",loading:r("dingtalk"),clearable:"",size:"small",class:"input-lg",placeholder:"user_id1,user_id2","onUpdate:value":l[34]||(l[34]=t=>f("dingtalk",{allowed_users:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.requireMention"),hint:e(a)("platform.requireMentionGroup")},{default:o(()=>[n(e(g),{value:d("dingtalk").require_mention,loading:r("dingtalk"),"onUpdate:value":l[35]||(l[35]=t=>c("dingtalk",{require_mention:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.freeResponseChats"),hint:e(a)("platform.freeResponseChatsHint")},{default:o(()=>[n(e(p),{value:d("dingtalk").free_response_chats||"",loading:r("dingtalk"),size:"small",placeholder:"chat_id1,chat_id2","onUpdate:value":l[36]||(l[36]=t=>c("dingtalk",{free_response_chats:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),m.key==="qqbot"?(v(),_(z,{key:7},[n(s,{label:e(a)("platform.qqAppId"),hint:e(a)("platform.qqAppIdHint")},{default:o(()=>[n(e(p),{value:u("qqbot").extra?.app_id||"",loading:r("qqbot"),clearable:"",size:"small",class:"input-lg",placeholder:"App ID","onUpdate:value":l[37]||(l[37]=t=>f("qqbot",{extra:{...u("qqbot").extra,app_id:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.qqAppSecret"),hint:e(a)("platform.qqAppSecretHint")},{default:o(()=>[n(e(p),{value:u("qqbot").extra?.client_secret||"",loading:r("qqbot"),clearable:"",size:"small",class:"input-lg",placeholder:"App Secret","onUpdate:value":l[38]||(l[38]=t=>f("qqbot",{extra:{...u("qqbot").extra,client_secret:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.allowedUsers"),hint:e(a)("platform.allowedUsersHint")},{default:o(()=>[n(e(p),{value:u("qqbot").allowed_users||"",loading:r("qqbot"),clearable:"",size:"small",class:"input-lg",placeholder:"openid1,openid2","onUpdate:value":l[39]||(l[39]=t=>f("qqbot",{allowed_users:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.allowAllUsers"),hint:e(a)("platform.allowAllUsersHint")},{default:o(()=>[n(e(g),{value:Y(u("qqbot").allow_all_users),loading:r("qqbot"),"onUpdate:value":l[40]||(l[40]=t=>f("qqbot",{allow_all_users:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.qqMarkdown"),hint:e(a)("platform.qqMarkdownHint")},{default:o(()=>[n(e(g),{value:d("qqbot").extra?.markdown_support??!0,loading:r("qqbot"),"onUpdate:value":l[41]||(l[41]=t=>c("qqbot",{extra:{...d("qqbot").extra,markdown_support:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),m.key==="weixin"?(v(),_(z,{key:8},[C("div",pe,[k.value==="idle"||k.value==="error"||k.value==="expired"||k.value==="confirmed"?(v(),F(e(te),{key:0,type:"primary",size:"small",onClick:Ae},{default:o(()=>[D(S(k.value==="confirmed"?e(a)("platform.qrRelogin"):e(a)("platform.qrLogin")),1)]),_:1})):b("",!0),k.value==="loading"?(v(),_("div",ce,[n(e(xe),{size:"small"}),C("span",null,S(e(a)("platform.qrFetching")),1)])):b("",!0),k.value==="waiting"||k.value==="scaned"?(v(),_("div",me,S(k.value==="scaned"?e(a)("platform.qrScanedHint"):e(a)("platform.qrScanHint")),1)):b("",!0)]),n(s,{label:e(a)("platform.weixinToken"),hint:e(a)("platform.weixinTokenHint")},{default:o(()=>[n(e(p),{value:u("weixin").token||"",loading:r("weixin"),clearable:"",size:"small",class:"input-lg",placeholder:"Token","onUpdate:value":l[42]||(l[42]=t=>f("weixin",{token:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.accountId"),hint:e(a)("platform.accountIdHint")},{default:o(()=>[n(e(p),{value:u("weixin").extra?.account_id||"",loading:r("weixin"),clearable:"",size:"small",class:"input-lg",placeholder:"Account ID","onUpdate:value":l[43]||(l[43]=t=>f("weixin",{extra:{...u("weixin").extra,account_id:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),m.key==="wecom"?(v(),_(z,{key:9},[n(s,{label:e(a)("platform.botId"),hint:e(a)("platform.botIdHint")},{default:o(()=>[n(e(p),{value:u("wecom").extra?.bot_id||"",loading:r("wecom"),clearable:"",size:"small",class:"input-lg",placeholder:"Bot ID","onUpdate:value":l[44]||(l[44]=t=>f("wecom",{extra:{...u("wecom").extra,bot_id:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.appSecret"),hint:e(a)("platform.wecomSecretHint")},{default:o(()=>[n(e(p),{value:u("wecom").extra?.secret||"",loading:r("wecom"),clearable:"",size:"small",class:"input-lg",placeholder:"Secret","onUpdate:value":l[45]||(l[45]=t=>f("wecom",{extra:{...u("wecom").extra,secret:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),C("div",fe,[n(e(te),{type:"primary",size:"small",loading:r(m.key),disabled:!Se(m.key),onClick:t=>Me(m.key)},{default:o(()=>[D(S(e(a)("common.save")),1)]),_:1},8,["loading","disabled","onClick"])])]),_:2},1032,["name","icon","exclusive","config","credentials"])),64))]))}})})),Ge=U((()=>{})),Ue,Ze=U((()=>{ve(),ve(),Ge(),E(),Ue=G(Ce,[["__scopeId","data-v-3287f08c"]])})),ge,_e,he,be,He,ke=U((()=>{N(),J(),O(),we(),Ze(),ge={class:"channels-view"},_e={class:"page-header"},he={class:"header-title"},be={class:"channels-content"},He=Q({__name:"ChannelsView",setup(A){const h=qe(),{t:q}=j();return Pe(()=>{h.fetchSettings()}),(a,H)=>(v(),_("div",ge,[C("header",_e,[C("h2",he,S(e(q)("sidebar.channels")),1)]),C("div",be,[n(e(xe),{show:e(h).loading||e(h).saving,size:"large",description:e(q)("common.loading")},{default:o(()=>[e(h).loading?b("",!0):(v(),F(Ue,{key:0}))]),_:1},8,["show","description"])])]))}})})),Ke=U((()=>{})),Xe,Ye=U((()=>{ke(),ke(),Ke(),E(),Xe=G(He,[["__scopeId","data-v-e25dbf6c"]])}));Ye();export{Xe as default};
|
|
1
|
+
import{n as U}from"./rolldown-runtime-BKwlnUi0.js";import{B as Te,F as te,Mt as R,Nt as L,R as p,Rt as e,St as Be,U as N,Vt as S,Z as z,_t as v,bt as Re,c as g,ct as Q,et as Ve,gt as Ie,ht as Pe,it as _,l as xe,nt as F,ot as D,rt as b,st as n,t as J,tt as C,wt as o,y as Le,yt as De,z as $e,zt as ne}from"./ui-vendor-Do3bR-2m.js";import{n as O,r as j}from"./vue-vendor-CTEo-aiR.js";import{n as E,t as G}from"./_plugin-vue_export-helper-DSvknO3W.js";import{c as We,d as Ne,f as Qe,l as Fe,o as we,s as qe,u as Je}from"./index-BPkv55ib.js";import{n as Oe,t as s}from"./SettingRow-C_5lbZtm.js";var ie,oe,re,se,ye,ue=U((()=>{N(),J(),O(),ie={class:"platform-info"},oe=["innerHTML"],re={class:"platform-name"},se={key:0,class:"platform-card-body"},ye=Q({__name:"PlatformCard",props:{name:{},icon:{},config:{},credentials:{},exclusive:{type:Boolean}},setup(A){const h=A,q=L(!0),{t:a}=j(),H=Ve(()=>{const x=h.credentials;if(!x)return!1;const w=["token","api_key","app_id","client_id","secret","app_secret","client_secret","access_token","bot_id","account_id","enabled"];return[x,x.extra].filter(Boolean).some(M=>w.some(T=>{const y=M[T];return y!=null&&y!==""&&y!==!1}))});return(x,w)=>(v(),_("div",{class:ne(["platform-card",{configured:H.value}])},[C("div",{class:"platform-card-header",onClick:w[0]||(w[0]=M=>q.value=!q.value)},[C("div",ie,[C("span",{class:"platform-icon",innerHTML:A.icon},null,8,oe),C("span",re,S(A.name),1),n(e(Te),{type:H.value?"success":"default",size:"small",round:""},{default:o(()=>[D(S(H.value?e(a)("common.configured"):e(a)("common.notConfigured")),1)]),_:1},8,["type"])]),C("span",{class:ne(["expand-icon",{expanded:q.value}])},"▾",2)]),q.value?(v(),_("div",se,[A.exclusive?(v(),F(e($e),{key:0,type:"warning","show-icon":!0,class:"exclusive-alert"},{default:o(()=>[D(S(e(a)("platform.exclusiveTokenWarning")),1)]),_:1})):b("",!0),Re(x.$slots,"default",{},void 0,!0)])):b("",!0)],2))}})})),je=U((()=>{})),ze,Ee=U((()=>{ue(),ue(),je(),E(),ze=G(ye,[["__scopeId","data-v-e27ecbbe"]])})),de,pe,ce,me,fe,Ce,ve=U((()=>{N(),J(),O(),we(),Fe(),Ee(),Oe(),de={class:"settings-section"},pe={class:"weixin-qr-section"},ce={key:1,class:"weixin-qr-loading"},me={key:2,class:"weixin-qr-hint"},fe={class:"platform-actions"},Ce=Q({__name:"PlatformSettings",setup(A){const h=qe(),q=Le(),{t:a}=j(),H=R({}),x=R({}),w=R({}),M=R({}),T=R({});function y(i){return JSON.parse(JSON.stringify(i||{}))}function $(i,l){for(const[m,t]of Object.entries(l))t&&typeof t=="object"&&!Array.isArray(t)?i[m]=$({...i[m]||{}},t):i[m]=t;return i}function d(i){return x[i]||(x[i]=y(h[i])),x[i]}function u(i){return w[i]||(w[i]=y(B(i))),w[i]}function c(i,l){x[i]=$({...d(i)},l),M[i]=!0}function f(i,l){w[i]=$({...u(i)},l),T[i]=!0}function Z(i,l){return JSON.stringify(i||{})===JSON.stringify(l||{})}function K(i){return!!M[i]&&!!x[i]&&!Z(x[i],h[i])}function X(i){return!!T[i]&&!!w[i]&&!Z(w[i],B(i))}function Se(i){return K(i)||X(i)}function r(i){return!!H[i]}async function Me(i){H[i]=!0;try{const l=K(i),m=X(i);l&&await h.saveSection(i,d(i),{restart:!m}),m&&(await Ne(i,u(i)),await h.fetchSettings()),x[i]=y(h[i]),w[i]=y(B(i)),M[i]=!1,T[i]=!1,q.success(a("settings.saved"))}catch(l){q.error(l?.message||a("settings.saveFailed"))}finally{H[i]=!1}}function B(i){return h.platforms[i]||{}}function Y(i){return i===!0||i==="true"}const ee=L(""),V=L(""),k=L("idle");let I=null;async function Ae(){k.value="loading",ee.value="",V.value="",le();try{const i=await We();V.value=i.qrcode,ee.value=i.qrcode_url,window.open(i.qrcode_url,"_blank"),k.value="waiting",P()}catch(i){k.value="error",q.error(i.message||a("platform.qrFetching"))}}function P(){V.value&&(I=setTimeout(async()=>{try{const i=await Je(V.value);i.status==="wait"?P():i.status==="scaned"?(k.value="scaned",P()):i.status==="expired"?k.value="expired":i.status==="confirmed"&&(k.value="confirmed",await Qe({account_id:i.account_id,token:i.token,base_url:i.base_url}),await h.fetchSettings(),q.success(a("settings.saved")))}catch{P()}},3e3))}function le(){I&&(clearTimeout(I),I=null)}Ie(()=>{le()});const ae=[{key:"telegram",name:"Telegram",exclusive:!0,icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.479.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"/></svg>'},{key:"discord",name:"Discord",exclusive:!0,icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189z"/></svg>'},{key:"slack",name:"Slack",exclusive:!0,icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zm1.271 0a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zm0 1.271a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zm10.122 0a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V5.042zm-1.27 0a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zm0-1.27a2.527 2.527 0 0 1 2.523-2.52h6.313A2.528 2.528 0 0 1 24 18.956a2.528 2.528 0 0 1-2.522 2.523h-6.313z"/></svg>'},{key:"whatsapp",name:"WhatsApp",exclusive:!0,icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"/></svg>'},{key:"matrix",name:"Matrix",icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M.632.55v22.9H2.28V24H0V0h2.28v.55zm7.043 7.26v1.157h.033c.309-.443.683-.784 1.117-1.024.433-.245.936-.365 1.5-.365.54 0 1.033.107 1.48.324.448.217.786.619 1.017 1.205.24-.376.558-.702.956-.98.398-.277.872-.414 1.424-.414.41 0 .784.065 1.122.194.34.13.629.325.87.588.241.263.428.59.56.984.132.393.198.85.198 1.368v5.89h-2.49v-4.893c0-.268-.016-.525-.048-.77a1.627 1.627 0 00-.2-.63 1.028 1.028 0 00-.392-.426 1.294 1.294 0 00-.616-.134c-.277 0-.508.05-.693.15a1.043 1.043 0 00-.43.41 1.768 1.768 0 00-.214.616 4.15 4.15 0 00-.06.74v4.937H9.29v-4.937c0-.25-.01-.498-.032-.742a1.84 1.84 0 00-.166-.638.998.998 0 00-.363-.448 1.206 1.206 0 00-.624-.154c-.26 0-.483.048-.67.144a1.055 1.055 0 00-.436.402 1.744 1.744 0 00-.227.616 4.108 4.108 0 00-.063.74v4.937H5.21V7.81zm15.693 15.64V.55H21.72V0H24v24h-2.28v-.55z"/></svg>'},{key:"feishu",name:"Feishu",exclusive:!0,icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M6.59 3.41a2.25 2.25 0 0 1 3.182 0L13.5 7.14l-3.182 3.182L6.59 7.59a2.25 2.25 0 0 1 0-3.182zm5.303 5.303L15.075 5.53a2.25 2.25 0 0 1 3.182 3.182L15.075 11.894 11.893 8.713zM3.41 6.59a2.25 2.25 0 0 1 3.182 0l3.182 3.182-3.182 3.182a2.25 2.25 0 0 1-3.182-3.182L3.41 6.59zm5.303 5.303L11.894 15.075a2.25 2.25 0 0 1-3.182 3.182L5.53 15.075 8.713 11.893zm5.303-5.303L17.478 9.778a2.25 2.25 0 0 1-3.182 3.182L10.53 10.075l3.182-3.182 0 .023z"/></svg>'},{key:"dingtalk",name:"DingTalk",exclusive:!0,icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M19.76 7.05c-.23-.52-.7-.9-1.26-1.02L5.35 3.2c-.77-.16-1.51.38-1.58 1.16-.22 2.55.17 5.4 1.13 7.66.97 2.29 2.52 4.11 4.45 4.82l-1.28 3.03c-.17.4.24.79.63.59l9.47-4.83c.34-.17.55-.52.55-.9v-3.12c.73-.4 1.22-1.17 1.22-2.06 0-.87-.08-1.73-.18-2.5zm-3.66 5.95-5.19 2.65.76-1.8c.12-.29-.03-.62-.33-.72-2.1-.73-3.56-3.54-3.95-6.73l9.27 2c.04.38.07.76.07 1.15 0 .45-.36.81-.81.81h-2.79c-.35 0-.63.28-.63.63s.28.63.63.63h2.97V13z"/></svg>'},{key:"qqbot",name:"QQBot",exclusive:!0,icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C7.58 2 4 5.27 4 9.31c0 2.3 1.15 4.34 2.95 5.68-.13.58-.48 1.62-1.26 2.53-.24.28-.05.72.32.73 1.72.05 3.02-.68 3.69-1.15.72.16 1.49.25 2.3.25 4.42 0 8-3.27 8-7.31S16.42 2 12 2zm-3.2 7.63c-.63 0-1.14-.55-1.14-1.23s.51-1.23 1.14-1.23 1.14.55 1.14 1.23-.51 1.23-1.14 1.23zm6.4 0c-.63 0-1.14-.55-1.14-1.23s.51-1.23 1.14-1.23 1.14.55 1.14 1.23-.51 1.23-1.14 1.23zM5.5 20.5a.5.5 0 0 1 .5-.5h12a.5.5 0 0 1 0 1H6a.5.5 0 0 1-.5-.5z"/></svg>'},{key:"weixin",name:"Weixin",exclusive:!0,icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 01.213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 00.167-.054l1.903-1.114a.864.864 0 01.717-.098 10.16 10.16 0 002.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 01-1.162 1.178A1.17 1.17 0 014.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 01-1.162 1.178 1.17 1.17 0 01-1.162-1.178c0-.651.52-1.18 1.162-1.18zm3.68 4.025c-3.694 0-6.69 2.462-6.69 5.496 0 3.034 2.996 5.496 6.69 5.496.753 0 1.477-.1 2.158-.28a.66.66 0 01.548.074l1.46.854a.25.25 0 00.127.041.224.224 0 00.221-.225c0-.055-.022-.109-.037-.162l-.298-1.131a.453.453 0 01.163-.509C21.81 18.613 22.77 16.973 22.77 15.512c0-3.034-2.996-5.496-6.69-5.496h.198zm-2.454 3.347c.491 0 .889.404.889.902a.896.896 0 01-.889.903.896.896 0 01-.889-.903c0-.498.398-.902.889-.902zm4.912 0c.491 0 .889.404.889.902a.896.896 0 01-.889.903.896.896 0 01-.889-.903c0-.498.398-.902.889-.902z"/></svg>'},{key:"wecom",name:"WeCom",icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 01.213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 00.167-.054l1.903-1.114a.864.864 0 01.717-.098 10.16 10.16 0 002.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 01-1.162 1.178A1.17 1.17 0 014.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 01-1.162 1.178 1.17 1.17 0 01-1.162-1.178c0-.651.52-1.18 1.162-1.18zm3.68 4.025c-3.694 0-6.69 2.462-6.69 5.496 0 3.034 2.996 5.496 6.69 5.496.753 0 1.477-.1 2.158-.28a.66.66 0 01.548.074l1.46.854a.25.25 0 00.127.041.224.224 0 00.221-.225c0-.055-.022-.109-.037-.162l-.298-1.131a.453.453 0 01.163-.509C21.81 18.613 22.77 16.973 22.77 15.512c0-3.034-2.996-5.496-6.69-5.496h.198zm-2.454 3.347c.491 0 .889.404.889.902a.896.896 0 01-.889.903.896.896 0 01-.889-.903c0-.498.398-.902.889-.902zm4.912 0c.491 0 .889.404.889.902a.896.896 0 01-.889.903.896.896 0 01-.889-.903c0-.498.398-.902.889-.902z"/></svg>'}];return Be(()=>ae.map(i=>({key:i.key,config:h[i.key],credentials:B(i.key)})),i=>{for(const l of i)M[l.key]||(x[l.key]=y(l.config)),T[l.key]||(w[l.key]=y(l.credentials))},{deep:!0,immediate:!0}),(i,l)=>(v(),_("section",de,[(v(),_(z,null,De(ae,m=>n(ze,{key:m.key,name:m.name,icon:m.icon,exclusive:m.exclusive,config:e(h)[m.key],credentials:B(m.key)},{default:o(()=>[m.key==="telegram"?(v(),_(z,{key:0},[n(s,{label:e(a)("platform.botToken"),hint:e(a)("platform.botTokenHint")},{default:o(()=>[n(e(p),{value:u("telegram").token||"",loading:r("telegram"),clearable:"",size:"small",class:"input-lg",placeholder:"123456:ABC-DEF...","onUpdate:value":l[0]||(l[0]=t=>f("telegram",{token:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.requireMention"),hint:e(a)("platform.requireMentionGroup")},{default:o(()=>[n(e(g),{value:d("telegram").require_mention,loading:r("telegram"),"onUpdate:value":l[1]||(l[1]=t=>c("telegram",{require_mention:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.reactions"),hint:e(a)("platform.reactionsHint")},{default:o(()=>[n(e(g),{value:d("telegram").reactions,loading:r("telegram"),"onUpdate:value":l[2]||(l[2]=t=>c("telegram",{reactions:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.freeResponseChats"),hint:e(a)("platform.freeResponseChatsHint")},{default:o(()=>[n(e(p),{value:d("telegram").free_response_chats||"",loading:r("telegram"),size:"small",placeholder:"chat_id1,chat_id2","onUpdate:value":l[3]||(l[3]=t=>c("telegram",{free_response_chats:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.mentionPatterns"),hint:e(a)("platform.mentionPatternsHint")},{default:o(()=>[n(e(p),{value:(d("telegram").mention_patterns||[]).join(", "),loading:r("telegram"),size:"small",placeholder:"pattern1, pattern2","onUpdate:value":l[4]||(l[4]=t=>c("telegram",{mention_patterns:t?t.split(",").map(W=>W.trim()):[]}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),m.key==="discord"?(v(),_(z,{key:1},[n(s,{label:e(a)("platform.botToken"),hint:e(a)("platform.botTokenHint")},{default:o(()=>[n(e(p),{value:u("discord").token||"",loading:r("discord"),clearable:"",size:"small",class:"input-lg",placeholder:"Bot token...","onUpdate:value":l[5]||(l[5]=t=>f("discord",{token:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.requireMention"),hint:e(a)("platform.requireMentionChannel")},{default:o(()=>[n(e(g),{value:d("discord").require_mention,loading:r("discord"),"onUpdate:value":l[6]||(l[6]=t=>c("discord",{require_mention:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.autoThread"),hint:e(a)("platform.autoThreadHint")},{default:o(()=>[n(e(g),{value:d("discord").auto_thread,loading:r("discord"),"onUpdate:value":l[7]||(l[7]=t=>c("discord",{auto_thread:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.reactions"),hint:e(a)("platform.reactionsHint")},{default:o(()=>[n(e(g),{value:d("discord").reactions,loading:r("discord"),"onUpdate:value":l[8]||(l[8]=t=>c("discord",{reactions:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.freeResponseChannels"),hint:e(a)("platform.freeResponseChannelsHint")},{default:o(()=>[n(e(p),{value:d("discord").free_response_channels||"",loading:r("discord"),size:"small",placeholder:"channel_id1,channel_id2","onUpdate:value":l[9]||(l[9]=t=>c("discord",{free_response_channels:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.allowedChannels"),hint:e(a)("platform.allowedChannelsHint")},{default:o(()=>[n(e(p),{value:d("discord").allowed_channels||"",loading:r("discord"),size:"small",placeholder:"channel_id1,channel_id2","onUpdate:value":l[10]||(l[10]=t=>c("discord",{allowed_channels:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.ignoredChannels"),hint:e(a)("platform.ignoredChannelsHint")},{default:o(()=>[n(e(p),{value:d("discord").ignored_channels||"",loading:r("discord"),size:"small",placeholder:"channel_id1,channel_id2","onUpdate:value":l[11]||(l[11]=t=>c("discord",{ignored_channels:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.noThreadChannels"),hint:e(a)("platform.noThreadChannelsHint")},{default:o(()=>[n(e(p),{value:d("discord").no_thread_channels||"",loading:r("discord"),size:"small",placeholder:"channel_id1,channel_id2","onUpdate:value":l[12]||(l[12]=t=>c("discord",{no_thread_channels:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),m.key==="slack"?(v(),_(z,{key:2},[n(s,{label:e(a)("platform.botToken"),hint:e(a)("platform.botTokenHint")},{default:o(()=>[n(e(p),{value:u("slack").token||"",loading:r("slack"),clearable:"",size:"small",class:"input-lg",placeholder:"xoxb-...","onUpdate:value":l[13]||(l[13]=t=>f("slack",{token:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.requireMention"),hint:e(a)("platform.requireMentionChannel")},{default:o(()=>[n(e(g),{value:d("slack").require_mention,loading:r("slack"),"onUpdate:value":l[14]||(l[14]=t=>c("slack",{require_mention:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.allowBots"),hint:e(a)("platform.allowBotsHint")},{default:o(()=>[n(e(g),{value:d("slack").allow_bots,loading:r("slack"),"onUpdate:value":l[15]||(l[15]=t=>c("slack",{allow_bots:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.freeResponseChannels"),hint:e(a)("platform.freeResponseChannelsHint")},{default:o(()=>[n(e(p),{value:d("slack").free_response_channels||"",loading:r("slack"),size:"small",placeholder:"channel_id1,channel_id2","onUpdate:value":l[16]||(l[16]=t=>c("slack",{free_response_channels:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),m.key==="whatsapp"?(v(),_(z,{key:3},[n(s,{label:e(a)("platform.waEnabled"),hint:e(a)("platform.waEnabledHint")},{default:o(()=>[n(e(g),{value:u("whatsapp").enabled,loading:r("whatsapp"),"onUpdate:value":l[17]||(l[17]=t=>f("whatsapp",{enabled:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.requireMention"),hint:e(a)("platform.requireMentionGroup")},{default:o(()=>[n(e(g),{value:d("whatsapp").require_mention,loading:r("whatsapp"),"onUpdate:value":l[18]||(l[18]=t=>c("whatsapp",{require_mention:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.freeResponseChats"),hint:e(a)("platform.freeResponseChatsHint")},{default:o(()=>[n(e(p),{value:d("whatsapp").free_response_chats||"",loading:r("whatsapp"),size:"small",placeholder:"chat_id1,chat_id2","onUpdate:value":l[19]||(l[19]=t=>c("whatsapp",{free_response_chats:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.mentionPatterns"),hint:e(a)("platform.mentionPatternsHint")},{default:o(()=>[n(e(p),{value:(d("whatsapp").mention_patterns||[]).join(", "),loading:r("whatsapp"),size:"small",placeholder:"pattern1, pattern2","onUpdate:value":l[20]||(l[20]=t=>c("whatsapp",{mention_patterns:t?t.split(",").map(W=>W.trim()):[]}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),m.key==="matrix"?(v(),_(z,{key:4},[n(s,{label:e(a)("platform.accessToken"),hint:e(a)("platform.accessTokenHint")},{default:o(()=>[n(e(p),{value:u("matrix").token||"",loading:r("matrix"),clearable:"",size:"small",class:"input-lg",placeholder:"syt_...","onUpdate:value":l[21]||(l[21]=t=>f("matrix",{token:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.homeserver"),hint:e(a)("platform.homeserverHint")},{default:o(()=>[n(e(p),{value:u("matrix").extra?.homeserver||"",loading:r("matrix"),clearable:"",size:"small",class:"input-lg",placeholder:"https://matrix.org","onUpdate:value":l[22]||(l[22]=t=>f("matrix",{extra:{...u("matrix").extra,homeserver:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.requireMention"),hint:e(a)("platform.requireMentionRoom")},{default:o(()=>[n(e(g),{value:d("matrix").require_mention,loading:r("matrix"),"onUpdate:value":l[23]||(l[23]=t=>c("matrix",{require_mention:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.autoThread"),hint:e(a)("platform.autoThreadHintRoom")},{default:o(()=>[n(e(g),{value:d("matrix").auto_thread,loading:r("matrix"),"onUpdate:value":l[24]||(l[24]=t=>c("matrix",{auto_thread:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.dmMentionThreads"),hint:e(a)("platform.dmMentionThreadsHint")},{default:o(()=>[n(e(g),{value:d("matrix").dm_mention_threads,loading:r("matrix"),"onUpdate:value":l[25]||(l[25]=t=>c("matrix",{dm_mention_threads:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.freeResponseRooms"),hint:e(a)("platform.freeResponseRoomsHint")},{default:o(()=>[n(e(p),{value:d("matrix").free_response_rooms||"",loading:r("matrix"),size:"small",placeholder:"room_id1,room_id2","onUpdate:value":l[26]||(l[26]=t=>c("matrix",{free_response_rooms:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),m.key==="feishu"?(v(),_(z,{key:5},[n(s,{label:e(a)("platform.appId"),hint:e(a)("platform.appIdHint")},{default:o(()=>[n(e(p),{value:u("feishu").extra?.app_id||"",loading:r("feishu"),clearable:"",size:"small",class:"input-lg",placeholder:"cli_...","onUpdate:value":l[27]||(l[27]=t=>f("feishu",{extra:{...u("feishu").extra,app_id:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.appSecret"),hint:e(a)("platform.appSecretHint")},{default:o(()=>[n(e(p),{value:u("feishu").extra?.app_secret||"",loading:r("feishu"),clearable:"",size:"small",class:"input-lg",placeholder:"App Secret","onUpdate:value":l[28]||(l[28]=t=>f("feishu",{extra:{...u("feishu").extra,app_secret:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.requireMention"),hint:e(a)("platform.requireMentionGroup")},{default:o(()=>[n(e(g),{value:d("feishu").require_mention,loading:r("feishu"),"onUpdate:value":l[29]||(l[29]=t=>c("feishu",{require_mention:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.freeResponseChats"),hint:e(a)("platform.freeResponseChatsHint")},{default:o(()=>[n(e(p),{value:d("feishu").free_response_chats||"",loading:r("feishu"),size:"small",placeholder:"chat_id1,chat_id2","onUpdate:value":l[30]||(l[30]=t=>c("feishu",{free_response_chats:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),m.key==="dingtalk"?(v(),_(z,{key:6},[n(s,{label:e(a)("platform.clientId"),hint:e(a)("platform.clientIdHint")},{default:o(()=>[n(e(p),{value:u("dingtalk").extra?.client_id||"",loading:r("dingtalk"),clearable:"",size:"small",class:"input-lg",placeholder:"Client ID","onUpdate:value":l[31]||(l[31]=t=>f("dingtalk",{extra:{...u("dingtalk").extra,client_id:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.clientSecret"),hint:e(a)("platform.clientSecretHint")},{default:o(()=>[n(e(p),{value:u("dingtalk").extra?.client_secret||"",loading:r("dingtalk"),clearable:"",size:"small",class:"input-lg",placeholder:"Client Secret","onUpdate:value":l[32]||(l[32]=t=>f("dingtalk",{extra:{...u("dingtalk").extra,client_secret:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.allowAllUsers"),hint:e(a)("platform.allowAllUsersHint")},{default:o(()=>[n(e(g),{value:Y(u("dingtalk").allow_all_users),loading:r("dingtalk"),"onUpdate:value":l[33]||(l[33]=t=>f("dingtalk",{allow_all_users:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.allowedUsers"),hint:e(a)("platform.allowedUsersHint")},{default:o(()=>[n(e(p),{value:u("dingtalk").allowed_users||"",loading:r("dingtalk"),clearable:"",size:"small",class:"input-lg",placeholder:"user_id1,user_id2","onUpdate:value":l[34]||(l[34]=t=>f("dingtalk",{allowed_users:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.requireMention"),hint:e(a)("platform.requireMentionGroup")},{default:o(()=>[n(e(g),{value:d("dingtalk").require_mention,loading:r("dingtalk"),"onUpdate:value":l[35]||(l[35]=t=>c("dingtalk",{require_mention:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.freeResponseChats"),hint:e(a)("platform.freeResponseChatsHint")},{default:o(()=>[n(e(p),{value:d("dingtalk").free_response_chats||"",loading:r("dingtalk"),size:"small",placeholder:"chat_id1,chat_id2","onUpdate:value":l[36]||(l[36]=t=>c("dingtalk",{free_response_chats:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),m.key==="qqbot"?(v(),_(z,{key:7},[n(s,{label:e(a)("platform.qqAppId"),hint:e(a)("platform.qqAppIdHint")},{default:o(()=>[n(e(p),{value:u("qqbot").extra?.app_id||"",loading:r("qqbot"),clearable:"",size:"small",class:"input-lg",placeholder:"App ID","onUpdate:value":l[37]||(l[37]=t=>f("qqbot",{extra:{...u("qqbot").extra,app_id:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.qqAppSecret"),hint:e(a)("platform.qqAppSecretHint")},{default:o(()=>[n(e(p),{value:u("qqbot").extra?.client_secret||"",loading:r("qqbot"),clearable:"",size:"small",class:"input-lg",placeholder:"App Secret","onUpdate:value":l[38]||(l[38]=t=>f("qqbot",{extra:{...u("qqbot").extra,client_secret:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.allowedUsers"),hint:e(a)("platform.allowedUsersHint")},{default:o(()=>[n(e(p),{value:u("qqbot").allowed_users||"",loading:r("qqbot"),clearable:"",size:"small",class:"input-lg",placeholder:"openid1,openid2","onUpdate:value":l[39]||(l[39]=t=>f("qqbot",{allowed_users:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.allowAllUsers"),hint:e(a)("platform.allowAllUsersHint")},{default:o(()=>[n(e(g),{value:Y(u("qqbot").allow_all_users),loading:r("qqbot"),"onUpdate:value":l[40]||(l[40]=t=>f("qqbot",{allow_all_users:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.qqMarkdown"),hint:e(a)("platform.qqMarkdownHint")},{default:o(()=>[n(e(g),{value:d("qqbot").extra?.markdown_support??!0,loading:r("qqbot"),"onUpdate:value":l[41]||(l[41]=t=>c("qqbot",{extra:{...d("qqbot").extra,markdown_support:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),m.key==="weixin"?(v(),_(z,{key:8},[C("div",pe,[k.value==="idle"||k.value==="error"||k.value==="expired"||k.value==="confirmed"?(v(),F(e(te),{key:0,type:"primary",size:"small",onClick:Ae},{default:o(()=>[D(S(k.value==="confirmed"?e(a)("platform.qrRelogin"):e(a)("platform.qrLogin")),1)]),_:1})):b("",!0),k.value==="loading"?(v(),_("div",ce,[n(e(xe),{size:"small"}),C("span",null,S(e(a)("platform.qrFetching")),1)])):b("",!0),k.value==="waiting"||k.value==="scaned"?(v(),_("div",me,S(k.value==="scaned"?e(a)("platform.qrScanedHint"):e(a)("platform.qrScanHint")),1)):b("",!0)]),n(s,{label:e(a)("platform.weixinToken"),hint:e(a)("platform.weixinTokenHint")},{default:o(()=>[n(e(p),{value:u("weixin").token||"",loading:r("weixin"),clearable:"",size:"small",class:"input-lg",placeholder:"Token","onUpdate:value":l[42]||(l[42]=t=>f("weixin",{token:t}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.accountId"),hint:e(a)("platform.accountIdHint")},{default:o(()=>[n(e(p),{value:u("weixin").extra?.account_id||"",loading:r("weixin"),clearable:"",size:"small",class:"input-lg",placeholder:"Account ID","onUpdate:value":l[43]||(l[43]=t=>f("weixin",{extra:{...u("weixin").extra,account_id:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),m.key==="wecom"?(v(),_(z,{key:9},[n(s,{label:e(a)("platform.botId"),hint:e(a)("platform.botIdHint")},{default:o(()=>[n(e(p),{value:u("wecom").extra?.bot_id||"",loading:r("wecom"),clearable:"",size:"small",class:"input-lg",placeholder:"Bot ID","onUpdate:value":l[44]||(l[44]=t=>f("wecom",{extra:{...u("wecom").extra,bot_id:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"]),n(s,{label:e(a)("platform.appSecret"),hint:e(a)("platform.wecomSecretHint")},{default:o(()=>[n(e(p),{value:u("wecom").extra?.secret||"",loading:r("wecom"),clearable:"",size:"small",class:"input-lg",placeholder:"Secret","onUpdate:value":l[45]||(l[45]=t=>f("wecom",{extra:{...u("wecom").extra,secret:t}}))},null,8,["value","loading"])]),_:1},8,["label","hint"])],64)):b("",!0),C("div",fe,[n(e(te),{type:"primary",size:"small",loading:r(m.key),disabled:!Se(m.key),onClick:t=>Me(m.key)},{default:o(()=>[D(S(e(a)("common.save")),1)]),_:1},8,["loading","disabled","onClick"])])]),_:2},1032,["name","icon","exclusive","config","credentials"])),64))]))}})})),Ge=U((()=>{})),Ue,Ze=U((()=>{ve(),ve(),Ge(),E(),Ue=G(Ce,[["__scopeId","data-v-3287f08c"]])})),ge,_e,he,be,He,ke=U((()=>{N(),J(),O(),we(),Ze(),ge={class:"channels-view"},_e={class:"page-header"},he={class:"header-title"},be={class:"channels-content"},He=Q({__name:"ChannelsView",setup(A){const h=qe(),{t:q}=j();return Pe(()=>{h.fetchSettings()}),(a,H)=>(v(),_("div",ge,[C("header",_e,[C("h2",he,S(e(q)("sidebar.channels")),1)]),C("div",be,[n(e(xe),{show:e(h).loading||e(h).saving,size:"large",description:e(q)("common.loading")},{default:o(()=>[e(h).loading?b("",!0):(v(),F(Ue,{key:0}))]),_:1},8,["show","description"])])]))}})})),Ke=U((()=>{})),Xe,Ye=U((()=>{ke(),ke(),Ke(),E(),Xe=G(He,[["__scopeId","data-v-e25dbf6c"]])}));Ye();export{Xe as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as O}from"./rolldown-runtime-BKwlnUi0.js";import{Bt as Ue,E as we,F as G,G as wt,J as kt,Nt as h,Q as Mo,R as _t,Rt as t,S as ze,St as J,Tt as tt,U as ve,Vt as r,X as bt,Y as At,Z as W,_t as o,c as To,ct as he,d as ja,et as D,f as Po,gt as lt,ht as _e,it as i,k as Be,l as Bo,nt as K,ot as V,pt as ke,q as Io,rt as y,st as k,t as Ne,tt as e,w as Fo,wt as w,y as xt,yt as te,zt as X}from"./ui-vendor-Do3bR-2m.js";import{n as xe,r as Ce}from"./vue-vendor-CTEo-aiR.js";import{a as Lo,c as at,d as Ct,h as be,l as ot,m as nt,n as pe,o as Do,p as st,t as fe}from"./_plugin-vue_export-helper-
|
|
1
|
+
import{n as O}from"./rolldown-runtime-BKwlnUi0.js";import{Bt as Ue,E as we,F as G,G as wt,J as kt,Nt as h,Q as Mo,R as _t,Rt as t,S as ze,St as J,Tt as tt,U as ve,Vt as r,X as bt,Y as At,Z as W,_t as o,c as To,ct as he,d as ja,et as D,f as Po,gt as lt,ht as _e,it as i,k as Be,l as Bo,nt as K,ot as V,pt as ke,q as Io,rt as y,st as k,t as Ne,tt as e,w as Fo,wt as w,y as xt,yt as te,zt as X}from"./ui-vendor-Do3bR-2m.js";import{n as xe,r as Ce}from"./vue-vendor-CTEo-aiR.js";import{a as Lo,c as at,d as Ct,h as be,l as ot,m as nt,n as pe,o as Do,p as st,t as fe}from"./_plugin-vue_export-helper-DSvknO3W.js";import{D as Ao,E as Eo,S as Ro,T as zo,b as Ya,g as Uo,h as No,n as it,o as Oo,p as Vo,s as qo,t as rt,x as Ho}from"./index-BPkv55ib.js";import{n as Go,t as Wo}from"./session-browser-prefs-BuDjwgV-.js";import{n as jo,t as Yo}from"./clipboard-4x9B6X3a.js";import{n as Ka,t as Xa}from"./useToolTraceVisibility-Cf4Rek-6.js";import{a as Et,i as Ko,n as Xo,o as Rt,r as zt,s as Jo,t as Qo}from"./OutlinePanel-CQYGEF5y.js";import{n as Zo,t as en}from"./MessageItem-ClybD2bU.js";import{a as tn,i as sn,n as ln,o as an,r as on,s as nn,t as rn}from"./xterm-CN_HBdCu.js";import{_ as un,a as dn,b as cn,c as vn,d as hn,f as pn,g as fn,h as mn,i as _n,l as gn,m as yn,n as wn,o as kn,p as bn,r as xn,s as Cn,t as Sn,u as $n,v as Mn,y as Tn}from"./FileRenameModal-DGnmmJBS.js";var Ut,Nt,Ot,Vt,qt,Ht,Gt,Wt,jt,Yt,Ja,Kt=O((()=>{ve(),Ne(),at(),Ut={class:"folder-picker"},Nt={key:0,class:"folder-picker-loading"},Ot={key:1,class:"folder-tree"},Vt={class:"folder-name"},qt=["onClick"],Ht=["onClick"],Gt=["onClick"],Wt={key:0,class:"folder-empty"},jt={key:2,class:"folder-selected"},Yt={class:"folder-selected-path"},Ja=he({__name:"FolderPicker",props:{modelValue:{}},emits:["update:modelValue"],setup(H,{emit:s}){const v=H,U=s,I=h(!1),m=h(""),n=h([]),M=h(new Set),A=h(new Map),R=h(new Set),B=h(v.modelValue||"");J(()=>v.modelValue,P=>{B.value=P||""});async function z(P=""){try{return await ot(`/api/hermes/workspace/folders${P?`?path=${encodeURIComponent(P)}`:""}`)}catch{return null}}_e(async()=>{I.value=!0;const P=await z();P&&(m.value=P.base,n.value=P.folders),I.value=!1});async function C(P){if(M.value.has(P.path)){M.value.delete(P.path),M.value=new Set(M.value);return}if(M.value.add(P.path),M.value=new Set(M.value),!A.value.has(P.path)){R.value.add(P.path),R.value=new Set(R.value);const p=await z(P.path);A.value.set(P.path,p?.folders||[]),A.value=new Map(A.value),R.value.delete(P.path),R.value=new Set(R.value)}}function F(P){const p=`${m.value}/${P.path}`;B.value=p,U("update:modelValue",p)}function S(){B.value=m.value,U("update:modelValue",m.value)}const T=D(()=>{const P=[];function p(c,b){for(const E of c){const q=M.value.has(E.path),$=R.value.has(E.path),Q=A.value.get(E.path);P.push({folder:E,depth:b,isExpanded:q,isLoading:$,hasChildren:Q?Q.length>0:null}),q&&Q&&Q.length>0&&p(Q,b+1)}}return p(n.value,0),P});return(P,p)=>(o(),i("div",Ut,[I.value?(o(),i("div",Nt,[k(t(Bo),{size:"small"})])):(o(),i("div",Ot,[e("div",{class:X(["folder-item root",{selected:B.value===m.value}]),onClick:S},[p[0]||(p[0]=e("span",{class:"folder-icon"},"📂",-1)),e("span",Vt,r(m.value||"/"),1)],2),(o(!0),i(W,null,te(T.value,c=>(o(),i("div",{key:c.folder.path,class:X(["folder-item",{selected:B.value===`${m.value}/${c.folder.path}`}]),style:Ue({paddingLeft:`${12+c.depth*16}px`})},[e("span",{class:"folder-expand",onClick:bt(b=>C(c.folder),["stop"])},[c.isLoading?(o(),i(W,{key:0},[V("⏳")],64)):(o(),i(W,{key:1},[V(r(c.isExpanded?"▼":"▶"),1)],64))],8,qt),e("span",{class:"folder-icon",onClick:b=>F(c.folder)},"📁",8,Ht),e("span",{class:"folder-name",onClick:b=>F(c.folder)},r(c.folder.name),9,Gt)],6))),128)),(o(!0),i(W,null,te(T.value,c=>(o(),i(W,{key:"empty-"+c.folder.path},[c.isExpanded&&!c.isLoading&&c.hasChildren===!1?(o(),i("div",{key:0,class:"folder-item empty",style:Ue({paddingLeft:`${28+c.depth*16}px`})},[...p[1]||(p[1]=[e("span",{class:"folder-empty-text"},"(空)",-1)])],4)):y("",!0)],64))),128)),n.value.length===0&&!I.value?(o(),i("div",Wt," 暂无工作区文件夹 ")):y("",!0)])),B.value?(o(),i("div",jt,[p[2]||(p[2]=e("span",{class:"folder-selected-label"},"已选择:",-1)),e("span",Yt,r(B.value),1)])):y("",!0)]))}})})),Pn=O((()=>{})),Qa,Bn=O((()=>{Kt(),Kt(),Pn(),pe(),Qa=fe(Ja,[["__scopeId","data-v-4399bad5"]])}));async function In(H,s,v){return(await ot(`/api/hermes/model-context/${encodeURIComponent(H)}/${encodeURIComponent(s)}`,{method:"PUT",body:JSON.stringify({provider:H,model:s,context_limit:v})})).data}var Fn=O((()=>{at()})),Xt,Jt,Qt,Zt,es,ts,ss,ls,as,os,ns,is,rs,us,ds,cs,vs,hs,ps,fs,ms,Za,_s=O((()=>{ve(),rt(),nt(),Ct(),Ya(),Fn(),Ne(),xe(),Xa(),Xt={class:"chat-input-area"},Jt={class:"input-top-bar"},Qt={class:"auto-play-speech-switch"},Zt={key:1,class:"context-bar"},es={key:0,class:"attachment-previews"},ts=["src","alt"],ss={key:1,class:"attachment-file"},ls={class:"file-name"},as={class:"file-size"},os=["onClick"],ns=["placeholder"],is=["onMousedown","onMouseenter"],rs={class:"slash-command-name"},us={key:0,class:"slash-command-args"},ds={class:"slash-command-desc"},cs={class:"input-actions"},vs={class:"context-edit-content"},hs={style:{"margin-bottom":"16px",color:"#666"}},ps={style:{"margin-top":"12px","font-size":"12px",color:"#999"}},fs={style:{display:"flex","justify-content":"flex-end",gap:"8px"}},ms=2e5,Za=he({__name:"ChatInput",setup(H){const s=it(),{t:v}=Ce(),U=xt(),{toolTraceVisible:I,toggleToolTraceVisible:m}=Ka(),n=h(""),M=h(),A=h(),R=h(),B=h([]),z=h(!1),C=h(0),F=h(!1),S=D(()=>[{name:"usage",args:"",description:v("chat.slashCommands.usage")},{name:"status",args:"",description:v("chat.slashCommands.status")},{name:"abort",args:"",description:v("chat.slashCommands.abort")},{name:"queue",args:v("chat.slashCommandArgs.message"),description:v("chat.slashCommands.queue")},{name:"clear",args:"",description:v("chat.slashCommands.clear")},{name:"clear",args:"--history",insertText:"clear --history",description:v("chat.slashCommands.clearHistory")},{name:"title",args:v("chat.slashCommandArgs.title"),description:v("chat.slashCommands.title")},{name:"compress",args:"",description:v("chat.slashCommands.compress")},{name:"steer",args:v("chat.slashCommandArgs.text"),description:v("chat.slashCommands.steer")},{name:"destroy",args:"",description:v("chat.slashCommands.destroy")}]),T=h(!1),P=h(""),p=h(0),c=D(()=>s.activeSession?.source==="cli"),b=D(()=>{const u=P.value.toLowerCase();return S.value.filter(_=>_.name.includes(u)||_.insertText?.includes(u))}),E=h(null);function q(u){u.preventDefault();const _=M.value;if(!_)return;const x=_.clientHeight,ne=u.clientY;function j(vt){const ht=x-(vt.clientY-ne);E.value=Math.max(20,Math.min(400,Math.round(ht)))}function We(){document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",We),document.body.style.cursor="",document.body.style.userSelect=""}document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",j),document.addEventListener("mouseup",We)}const $=h(!1);_e(()=>{const u=localStorage.getItem("autoPlaySpeech");u!==null&&($.value=u==="true",s.setAutoPlaySpeech($.value))}),J($,u=>{localStorage.setItem("autoPlaySpeech",String(u)),s.setAutoPlaySpeech(u)});const Q=D(()=>n.value.trim()||B.value.length>0);function se(){ke(()=>{A.value&&A.value.querySelector(".active")?.scrollIntoView({block:"nearest",behavior:"instant"})})}function de(){if(!c.value){T.value=!1;return}const u=M.value;if(!u)return;const _=u.selectionStart,x=n.value.slice(0,_);if(!x.startsWith("/")||x.includes(" ")||x.includes(`
|
|
2
2
|
`)){T.value=!1;return}P.value=x.slice(1),p.value=0,T.value=b.value.length>0}function Se(u){n.value=`/${u.insertText||u.name} `,T.value=!1,ke(()=>{const _=M.value;if(!_)return;const x=n.value.length;_.setSelectionRange(x,x),_.focus()})}const ee=h(2e5),ie=h(!1),le=h(2e5),me=h(!1);async function Ie(){le.value=ee.value,ie.value=!0}async function $e(){if(!le.value||le.value<=0){U.error(v("chat.contextEditInvalid"));return}me.value=!0;try{const u=s.activeSession?.provider||be().selectedProvider||"",_=s.activeSession?.model||be().selectedModel||"";if(!u||!_){U.error(v("chat.contextEditFailed"));return}await In(u,_,le.value),ee.value=le.value,ie.value=!1,U.success(v("chat.contextEditSuccess"))}catch(u){U.error(`${v("chat.contextEditFailed")}: ${u.message||""}`)}finally{me.value=!1}}async function Y(){try{const u=s.activeSession;ee.value=await Uo(u?.profile||st().activeProfileName||void 0,u?.provider||void 0,u?.model||void 0)}catch{ee.value=ms}}_e(Y),J(()=>st().activeProfileName,Y),J(()=>be().selectedProvider,Y),J(()=>be().selectedModel,Y),J(()=>s.activeSession?.id,Y),J(()=>s.activeSession?.profile,Y),J(()=>s.activeSession?.provider,Y),J(()=>s.activeSession?.model,Y);const ae=D(()=>{const u=s.activeSession?.contextTokens;return typeof u=="number"&&Number.isFinite(u)&&u>0?u:(s.activeSession?.inputTokens??0)+(s.activeSession?.outputTokens??0)}),re=D(()=>Math.max(0,ee.value-ae.value)),Z=D(()=>Math.min(ae.value/ee.value*100,100));function oe(u){return u>=1e6?(u/1e6).toFixed(1)+"M":u>=1e3?(u/1e3).toFixed(1)+"k":String(u)}function ue(u){if(B.value.find(ne=>ne.name===u.name))return;const _=Date.now().toString(36)+Math.random().toString(36).slice(2,8),x=URL.createObjectURL(u);B.value.push({id:_,name:u.name,type:u.type,size:u.size,url:x,file:u})}function ge(){R.value?.click()}function ye(u){const _=u.target;if(_.files){for(const x of _.files)ue(x);_.value=""}}function f(u){const _=Array.from(u.clipboardData?.items||[]).filter(x=>x.type.startsWith("image/"));if(_.length){u.preventDefault();for(const x of _){const ne=x.getAsFile();if(!ne)continue;const j=x.type.split("/")[1]||"png";ue(new File([ne],`pasted-${Date.now()}.${j}`,{type:x.type}))}}}function g(u){u.preventDefault()}function L(u){u.preventDefault(),u.dataTransfer?.types.includes("Files")&&(C.value++,z.value=!0)}function ce(){C.value--,C.value<=0&&(C.value=0,z.value=!1)}function Me(u){u.preventDefault(),C.value=0,z.value=!1;const _=Array.from(u.dataTransfer?.files||[]);if(_.length){for(const x of _)ue(x);M.value?.focus()}}function Fe(){const u=n.value.trim();!u&&B.value.length===0||(s.sendMessage(u,B.value.length>0?B.value:void 0),n.value="",B.value=[],T.value=!1,M.value&&(M.value.style.height="auto"))}function ut(){F.value=!0}function dt(){requestAnimationFrame(()=>{F.value=!1,de()})}function ct(u){return F.value||u.isComposing||u.keyCode===229}function Te(u){if(T.value&&b.value.length>0){if(u.key==="ArrowDown"){u.preventDefault(),p.value=(p.value+1)%b.value.length,se();return}if(u.key==="ArrowUp"){u.preventDefault(),p.value=(p.value-1+b.value.length)%b.value.length,se();return}if(u.key==="Enter"||u.key==="Tab"){u.preventDefault(),Se(b.value[p.value]);return}if(u.key==="Escape"){u.preventDefault(),T.value=!1;return}}u.key!=="Enter"||u.shiftKey||ct(u)||(u.preventDefault(),Fe())}function Oe(u){const _=u.target;F.value||de(),E.value===null&&(_.style.height="auto",_.style.height=Math.min(_.scrollHeight,100)+"px")}function Ve(u){p.value=u}function Le(u){if(!T.value)return;const _=u.target;!_.closest(".slash-command-dropdown")&&!_.closest(".input-wrapper")&&(T.value=!1)}_e(()=>{document.addEventListener("mousedown",Le)}),lt(()=>{document.removeEventListener("mousedown",Le)});function qe(u){const _=B.value.findIndex(x=>x.id===u);_!==-1&&(URL.revokeObjectURL(B.value[_].url),B.value.splice(_,1))}function He(u){return u<1024?u+" B":u<1024*1024?(u/1024).toFixed(1)+" KB":(u/(1024*1024)).toFixed(1)+" MB"}function Ge(u){return u.startsWith("image/")}return(u,_)=>(o(),i("div",Xt,[e("div",Jt,[k(t(we),{trigger:"hover"},{trigger:w(()=>[k(t(G),{quaternary:"",size:"tiny",onClick:ge,circle:""},{icon:w(()=>[..._[6]||(_[6]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[e("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})],-1)])]),_:1})]),default:w(()=>[V(" "+r(t(v)("chat.attachFiles")),1)]),_:1}),e("div",Qt,[k(t(we),{trigger:"hover"},{trigger:w(()=>[..._[7]||(_[7]=[e("div",{class:"switch-label"},[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("polygon",{points:"5 3 19 12 5 21 5 3"})])],-1)])]),default:w(()=>[V(" "+r(t(v)("chat.autoPlaySpeech")),1)]),_:1}),k(t(To),{size:"small",value:$.value,"onUpdate:value":_[0]||(_[0]=x=>$.value=x),round:!1},null,8,["value"])]),k(t(we),{trigger:"hover"},{trigger:w(()=>[k(t(G),{quaternary:"",size:"tiny",class:X(["tool-trace-toggle",{active:t(I)}]),"aria-label":t(I)?t(v)("chat.hideToolCalls"):t(v)("chat.showToolCalls"),onClick:t(m)},{default:w(()=>[..._[8]||(_[8]=[e("svg",{class:"tool-trace-icon",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},[e("path",{d:"M14.7 6.3a4.5 4.5 0 0 0-5.8 5.8L3.5 17.5a2.1 2.1 0 0 0 3 3l5.4-5.4a4.5 4.5 0 0 0 5.8-5.8l-3 3-3-3 3-3z"})],-1)])]),_:1},8,["class","aria-label","onClick"])]),default:w(()=>[V(" "+r(t(I)?t(v)("chat.hideToolCalls"):t(v)("chat.showToolCalls")),1)]),_:1}),ae.value>0?(o(),i("span",{key:0,class:X(["context-info",{"context-warning":Z.value>80}])},[V(r(oe(ae.value))+" / ",1),k(t(we),{trigger:"hover"},{trigger:w(()=>[e("span",{class:"context-limit-editable",onClick:Ie},r(oe(ee.value)),1)]),default:w(()=>[e("span",null,r(t(v)("chat.contextClickToEdit")),1)]),_:1}),V(" · "+r(t(v)("chat.contextRemaining"))+" "+r(oe(re.value)),1)],2)):y("",!0),ae.value>0?(o(),i("div",Zt,[e("div",{class:X(["context-bar-fill",{"context-bar-warn":Z.value>60&&Z.value<=80,"context-bar-danger":Z.value>80}]),style:Ue({width:`${Z.value}%`})},null,6)])):y("",!0)]),B.value.length>0?(o(),i("div",es,[(o(!0),i(W,null,te(B.value,x=>(o(),i("div",{key:x.id,class:X(["attachment-preview",{image:Ge(x.type)}])},[Ge(x.type)?(o(),i("img",{key:0,src:x.url,alt:x.name,class:"attachment-thumb"},null,8,ts)):(o(),i("div",ss,[_[9]||(_[9]=e("svg",{width:"20",height:"20",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",ls,r(x.name),1),e("span",as,r(He(x.size)),1)])),e("button",{class:"attachment-remove",onClick:ne=>qe(x.id)},[..._[10]||(_[10]=[e("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])],8,os)],2))),128))])):y("",!0),e("div",{class:X(["input-wrapper",{"drag-over":z.value}]),onDragover:g,onDragenter:L,onDragleave:ce,onDrop:Me},[e("input",{ref_key:"fileInputRef",ref:R,type:"file",multiple:"",class:"file-input-hidden",onChange:ye},null,544),e("div",{class:"resize-handle",onMousedown:q},null,32),tt(e("textarea",{ref_key:"textareaRef",ref:M,"onUpdate:modelValue":_[1]||(_[1]=x=>n.value=x),class:"input-textarea",style:Ue(E.value?{height:E.value+"px"}:{}),placeholder:t(v)("chat.inputPlaceholder"),rows:"1",onKeydown:Te,onCompositionstart:ut,onCompositionend:dt,onInput:Oe,onPaste:f},null,44,ns),[[Io,n.value]]),k(wt,{name:"dropdown-fade"},{default:w(()=>[T.value&&b.value.length>0?(o(),i("div",{key:0,ref_key:"commandDropdownRef",ref:A,class:"slash-command-dropdown"},[(o(!0),i(W,null,te(b.value,(x,ne)=>(o(),i("div",{key:x.name,class:X(["slash-command-item",{active:ne===p.value}]),onMousedown:bt(j=>Se(x),["prevent"]),onMouseenter:j=>Ve(ne)},[e("span",rs,"/"+r(x.name),1),x.args?(o(),i("span",us,r(x.args),1)):y("",!0),e("span",ds,r(x.description),1)],42,is))),128))],512)):y("",!0)]),_:1}),e("div",cs,[t(s).isStreaming?(o(),K(t(G),{key:0,size:"small",type:"error",disabled:t(s).isAborting,onClick:_[2]||(_[2]=x=>t(s).stopStreaming())},{default:w(()=>[V(r(t(v)("chat.stop")),1)]),_:1},8,["disabled"])):y("",!0),k(t(G),{size:"small",type:"primary",disabled:!Q.value,onClick:Fe},{icon:w(()=>[..._[11]||(_[11]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),e("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})],-1)])]),default:w(()=>[V(" "+r(t(v)("chat.send")),1)]),_:1},8,["disabled"])])],34),k(t(ze),{show:ie.value,"onUpdate:show":_[5]||(_[5]=x=>ie.value=x),title:t(v)("chat.contextEditTitle"),"mask-closable":!0,preset:"card",style:{width:"400px"}},{footer:w(()=>[e("div",fs,[k(t(G),{onClick:_[4]||(_[4]=x=>ie.value=!1),disabled:me.value},{default:w(()=>[V(r(t(v)("chat.contextEditCancel")),1)]),_:1},8,["disabled"]),k(t(G),{type:"primary",onClick:$e,loading:me.value},{default:w(()=>[V(r(t(v)("chat.contextEditSave")),1)]),_:1},8,["loading"])])]),default:w(()=>[e("div",vs,[e("p",hs,r(t(v)("chat.contextEditDesc")),1),k(t(Po),{value:le.value,"onUpdate:value":_[3]||(_[3]=x=>le.value=x),min:1e3,max:1e7,step:1e3,"show-button":!1,placeholder:t(v)("chat.contextEditPlaceholder"),style:{width:"100%"}},{suffix:w(()=>[..._[12]||(_[12]=[e("span",{style:{color:"#999"}},"tokens",-1)])]),_:1},8,["value","placeholder"]),e("div",ps,r(t(v)("chat.contextEditHint")),1)])]),_:1},8,["show","title"])]))}})})),Ln=O((()=>{})),eo,Dn=O((()=>{_s(),_s(),Ln(),pe(),eo=fe(Za,[["__scopeId","data-v-f61c7e4f"]])}));async function An(H={}){const s=new URLSearchParams;return H.humanOnly===!1&&s.set("humanOnly","false"),H.source&&s.set("source",H.source),H.limit!=null&&s.set("limit",String(H.limit)),(await ot(`/api/hermes/sessions/conversations${s.toString()?`?${s.toString()}`:""}`)).sessions}async function En(H,s={}){const v=new URLSearchParams;s.humanOnly===!1&&v.set("humanOnly","false"),s.source&&v.set("source",s.source);const U=v.toString()?`?${v.toString()}`:"";return ot(`/api/hermes/sessions/conversations/${encodeURIComponent(H)}/messages${U}`)}var Rn=O((()=>{at()})),gs,ys,ws,ks,bs,xs,Cs,Ss,$s,Ms,Ts,Ps,Bs,Is,Fs,Ls,Ds,As,Es,Rs,zs,Us,to,Ns=O((()=>{ve(),Rn(),Jo(),nt(),xe(),gs={class:"conversation-monitor"},ys={class:"conversation-monitor__sidebar"},ws={key:0,class:"conversation-monitor__empty"},ks={key:1,class:"conversation-monitor__empty"},bs=["aria-pressed","onClick"],xs={class:"conversation-monitor__session-title-row"},Cs={class:"conversation-monitor__session-title"},Ss={key:0,class:"conversation-monitor__session-live"},$s={class:"conversation-monitor__session-meta"},Ms={key:0,class:"conversation-monitor__session-preview"},Ts={class:"conversation-monitor__detail"},Ps={key:0,class:"conversation-monitor__detail-header"},Bs={class:"conversation-monitor__detail-title"},Is={class:"conversation-monitor__detail-meta"},Fs=["title"],Ls={key:1,class:"conversation-monitor__empty conversation-monitor__empty--error"},Ds={key:2,class:"conversation-monitor__empty"},As={key:3,class:"conversation-monitor__empty"},Es={key:4,class:"conversation-monitor__messages"},Rs={class:"conversation-monitor__message-meta"},zs={class:"conversation-monitor__message-content"},Us=15e3,to=he({__name:"ConversationMonitorPane",props:{humanOnly:{type:Boolean}},setup(H){const s=H,{t:v}=Ce(),U=be(),I=h([]),m=h(null),n=h(null),M=h(!1),A=h(!1),R=h("");let B=null,z=0,C=0;const F=D(()=>I.value.find(E=>E.id===m.value)||null),S=D(()=>F.value?.model?U.displayModelName(F.value.model,F.value.provider):"");function T(E){return v(E==="user"?"chat.monitorRoleUser":"chat.monitorRoleAssistant")}function P(E){return v("chat.linkedSessions",{count:E})}function p(){z+=1,C+=1}async function c(E=!1){const q=++z;E||(M.value=!0,R.value="");try{const $=await An({humanOnly:s.humanOnly});if(q!==z)return;if(I.value=$,!$.length){m.value=null,n.value=null;return}(!m.value||!$.some(Q=>Q.id===m.value))&&(m.value=$[0].id)}catch($){if(q!==z||E)return;R.value=$?.message||String($),I.value=[],m.value=null,n.value=null}finally{!E&&q===z&&(M.value=!1)}}async function b(E,q=!1){const $=++C;if(!E){n.value=null;return}const Q=s.humanOnly;q||(A.value=!0,R.value="");try{const se=await En(E,{humanOnly:Q});if($!==C||E!==m.value||Q!==s.humanOnly)return;n.value=se}catch(se){if($!==C||q)return;R.value=se?.message||String(se),n.value=null}finally{!q&&$===C&&(A.value=!1)}}return J(m,async E=>{await b(E,!1)}),J(()=>s.humanOnly,async()=>{p(),m.value=null,n.value=null,await c(!1)}),_e(async()=>{await c(!1),B=setInterval(async()=>{await c(!0),m.value&&await b(m.value,!0)},Us)}),lt(()=>{p(),B&&clearInterval(B)}),(E,q)=>(o(),i("div",gs,[e("aside",ys,[M.value&&I.value.length===0?(o(),i("div",ws,r(t(v)("common.loading")),1)):I.value.length===0?(o(),i("div",ks,r(t(v)("chat.noSessions")),1)):y("",!0),(o(!0),i(W,null,te(I.value,$=>(o(),i("button",{key:$.id,class:X(["conversation-monitor__session",{active:$.id===m.value}]),"aria-pressed":$.id===m.value,onClick:Q=>m.value=$.id},[e("div",xs,[e("span",Cs,r($.title||$.preview||$.id),1),$.is_active?(o(),i("span",Ss,r(t(v)("chat.recentBadge")),1)):y("",!0)]),e("div",$s,r(t(Rt)($.source))+" · "+r(t(Et)($.last_active)),1),$.preview?(o(),i("div",Ms,r($.preview),1)):y("",!0)],10,bs))),128))]),e("section",Ts,[F.value?(o(),i("header",Ps,[e("div",Bs,r(F.value.title||F.value.preview||F.value.id),1),e("div",Is,[e("span",null,r(t(Rt)(F.value.source)),1),q[0]||(q[0]=e("span",null,"·",-1)),e("span",{title:F.value.model},r(S.value),9,Fs),q[1]||(q[1]=e("span",null,"·",-1)),e("span",null,r(P(F.value.thread_session_count)),1)])])):y("",!0),R.value?(o(),i("div",Ls,r(R.value),1)):A.value&&!n.value?(o(),i("div",Ds,r(t(v)("common.loading")),1)):!n.value||n.value.messages.length===0?(o(),i("div",As,r(t(v)("chat.noVisibleMessages")),1)):(o(),i("div",Es,[(o(!0),i(W,null,te(n.value.messages,$=>(o(),i("article",{key:`${$.session_id}-${$.id}`,class:X(["conversation-monitor__message",`role-${$.role}`])},[e("div",Rs,r(T($.role))+" · "+r(t(Et)($.timestamp)),1),e("div",zs,r($.content),1)],2))),128))]))])]))}})})),zn=O((()=>{})),so,Un=O((()=>{Ns(),Ns(),zn(),pe(),so=fe(to,[["__scopeId","data-v-71fcd8c4"]])})),lo,Nn=O((()=>{lo="/assets/mp4/thinking-light-BjeGd2gJ.mp4"})),ao,On=O((()=>{ao="/assets/mp4/thinking-dark-yYkYRZLs.mp4"})),Os,Vs,qs,Hs,Gs,Ws,js,Ys,Ks,Xs,Js,Qs,Zs,el,tl,sl,ll,al,ol,nl,il,rl,ul,dl,cl,vl,oo,hl=O((()=>{ve(),Ao(),xe(),Zo(),rt(),Nn(),On(),zo(),Xa(),Os={key:0,class:"empty-state"},Vs={key:0,class:"streaming-indicator"},qs=["src"],Hs={key:0,class:"tool-calls-panel"},Gs={key:0,class:"tool-call-item compression-item"},Ws={key:0,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5",class:"tool-call-icon"},js={key:1,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5",class:"tool-call-icon"},Ys={class:"tool-call-name"},Ks={key:2,class:"tool-call-spinner"},Xs={key:1,class:"tool-call-item compression-item"},Js={key:0,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5",class:"tool-call-icon"},Qs={key:1,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5",class:"tool-call-icon"},Zs={class:"tool-call-name"},el={key:2,class:"tool-call-spinner"},tl={class:"tool-call-name"},sl={key:0,class:"tool-call-preview"},ll=["title"],al={key:2,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"tool-call-success-icon"},ol={key:3,class:"tool-call-spinner"},nl={key:4,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"tool-call-error-icon"},il={key:0,class:"queue-float-panel"},rl={class:"queue-float-header"},ul={class:"queue-float-list"},dl={class:"queue-index"},cl={class:"queue-text"},vl=["title","onClick"],oo=he({__name:"MessageList",setup(H){const s=it(),{t:v}=Ce(),{isDark:U}=Eo(),{toolTraceVisible:I}=Ka(),m=h();function n(p){return p>=1e6?(p/1e6).toFixed(1)+"M":p>=1e3?(p/1e3).toFixed(1)+"K":String(p)}function M(p){return p<1?`${Math.round(p*1e3)}ms`:p<60?`${Math.round(p*10)/10}s`:`${Math.floor(p/60)}m ${Math.round(p%60)}s`}const A=D(()=>{const p=s.messages;let c=-1;for(let b=p.length-1;b>=0;b--)if(p[b].role==="user"){c=b;break}return[...p.filter((b,E)=>b.role==="tool"&&E>c)].reverse()}),R=D(()=>A.value.filter(p=>!!p.toolName)),B=D(()=>{const p=new Set(A.value.map(c=>c.id));return s.messages.filter(c=>c.role==="tool"?I.value&&!!c.toolName&&!(s.isRunActive&&p.has(c.id)):!(c.role==="assistant"&&c.isStreaming&&!c.content?.trim()&&c.reasoning?.trim()&&A.value.length===0))}),z=D(()=>{const p=s.activeSessionId;return p?s.queuedUserMessages.get(p)||[]:[]});function C(p){const c=s.activeSessionId;c&&s.removeQueuedMessage(c,p)}function F(p){const c=p.replace(/\s+/g," ").trim();return c.length>48?`${c.slice(0,48)}...`:c}function S(p=200){const c=m.value;return c?c.scrollHeight-c.scrollTop-c.clientHeight<p:!0}function T(){ke(()=>{m.value&&(m.value.scrollTop=m.value.scrollHeight)})}function P(p){ke(()=>{const c=document.getElementById(`message-${p}`);c&&c.scrollIntoView({block:"center"})})}return J(()=>s.activeSessionId,p=>{if(p){if(s.focusMessageId){ke(()=>P(s.focusMessageId));return}ke(()=>T())}},{immediate:!0}),J(()=>s.focusMessageId,p=>{p&&P(p)}),J(()=>s.isRunActive,p=>{p&&T()}),J(()=>s.messages[s.messages.length-1]?.content,()=>{if(s.focusMessageId){P(s.focusMessageId);return}S()&&T()}),J(A,()=>{if(s.focusMessageId){P(s.focusMessageId);return}S()&&T()}),(p,c)=>(o(),i("div",{ref_key:"listRef",ref:m,class:"message-list"},[t(s).messages.length===0?(o(),i("div",Os,[c[0]||(c[0]=e("img",{src:"/logo.png",alt:"Hermes",class:"empty-logo"},null,-1)),e("p",null,r(t(v)("chat.emptyState")),1)])):y("",!0),(o(!0),i(W,null,te(B.value,b=>(o(),K(en,{key:b.id,message:b,highlight:t(s).focusMessageId===b.id},null,8,["message","highlight"]))),128)),k(wt,{name:"fade"},{default:w(()=>[t(s).isRunActive||t(s).abortState?(o(),i("div",Vs,[e("video",{src:t(U)?t(ao):t(lo),autoplay:"",loop:"",muted:"",playsinline:"",class:"thinking-video"},null,8,qs),R.value.length>0||t(s).compressionState||t(s).abortState?(o(),i("div",Hs,[t(s).abortState?(o(),i("div",Gs,[t(s).abortState.aborting?(o(),i("svg",Ws,[...c[1]||(c[1]=[e("path",{d:"M10 9v6m4-6v6M5 5h14v14H5z"},null,-1)])])):(o(),i("svg",js,[...c[2]||(c[2]=[e("path",{d:"M5 13l4 4L19 7"},null,-1)])])),e("span",Ys,r(t(s).abortState.aborting?"Pausing... waiting for the run to stop and sync":t(s).abortState.synced?"Paused and synced":"Paused"),1),t(s).abortState.aborting?(o(),i("span",Ks)):y("",!0)])):y("",!0),t(s).compressionState?(o(),i("div",Xs,[t(s).compressionState.compressing?(o(),i("svg",Js,[...c[3]||(c[3]=[e("path",{d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"},null,-1)])])):t(s).compressionState.compressed?(o(),i("svg",Qs,[...c[4]||(c[4]=[e("path",{d:"M5 13l4 4L19 7"},null,-1)])])):y("",!0),e("span",Zs,r(t(s).compressionState.compressing?`Compressing... (${t(s).compressionState.messageCount} msgs, ~${n(t(s).compressionState.beforeTokens)} tokens)`:t(s).compressionState.compressed?`Compressed ${t(s).compressionState.messageCount} msgs: ~${n(t(s).compressionState.beforeTokens)} → ~${n(t(s).compressionState.afterTokens)} tokens`:"Compression skipped"),1),t(s).compressionState.compressing?(o(),i("span",el)):y("",!0)])):y("",!0),(o(!0),i(W,null,te(R.value,b=>(o(),i("div",{key:b.id,class:"tool-call-item"},[c[7]||(c[7]=e("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5",class:"tool-call-icon"},[e("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})],-1)),e("span",tl,r(b.toolName),1),b.toolPreview?(o(),i("span",sl,r(b.toolPreview),1)):y("",!0),b.toolDuration&&b.toolStatus!=="running"?(o(),i("span",{key:1,class:"tool-call-duration",title:p.$t("chat.executionDuration")},r(M(b.toolDuration)),9,ll)):y("",!0),b.toolStatus==="done"?(o(),i("svg",al,[...c[5]||(c[5]=[e("circle",{cx:"12",cy:"12",r:"10",fill:"currentColor","fill-opacity":"0.15"},null,-1),e("path",{d:"M8 12L11 15L16 9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",fill:"none"},null,-1)])])):y("",!0),b.toolStatus==="running"?(o(),i("span",ol)):y("",!0),b.toolStatus==="error"?(o(),i("svg",nl,[...c[6]||(c[6]=[e("circle",{cx:"12",cy:"12",r:"10",fill:"currentColor","fill-opacity":"0.15"},null,-1),e("path",{d:"M15 9L9 15M9 9L15 15",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",fill:"none"},null,-1)])])):y("",!0)]))),128))])):y("",!0)])):y("",!0)]),_:1}),k(wt,{name:"queue-float"},{default:w(()=>[z.value.length>0?(o(),i("div",il,[e("div",rl,[c[8]||(c[8]=e("span",{class:"queue-orbit","aria-hidden":"true"},[e("span")],-1)),e("span",null,r(t(v)("chat.messageQueue")),1),e("strong",null,r(z.value.length),1)]),e("div",ul,[(o(!0),i(W,null,te(z.value,(b,E)=>(o(),i("div",{key:b.id,class:"queue-float-item"},[e("span",dl,r(E+1),1),e("span",cl,r(F(b.content)),1),e("button",{type:"button",class:"queue-remove",title:t(v)("chat.removeQueuedMessage"),onClick:q=>C(b.id)},[...c[9]||(c[9]=[e("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])],8,vl)]))),128))])])):y("",!0)]),_:1})],512))}})})),Vn=O((()=>{})),no,qn=O((()=>{hl(),hl(),Vn(),pe(),no=fe(oo,[["__scopeId","data-v-3797adda"]])})),pl,fl,ml,_l,gl,yl,wl,kl,bl,xl,Cl,Sl,$l,Ml,Tl,Pl,Bl,Il,gt,Fl,yt,io,Ll=O((()=>{ve(),nn(),sn(),on(),rn(),at(),Ne(),xe(),pl={class:"terminal-panel-drawer"},fl={class:"sidebar-header"},ml={class:"sidebar-title"},_l={class:"session-list"},gl={key:0,class:"session-error"},yl={key:1,class:"session-empty"},wl=["onClick"],kl={class:"session-item-content"},bl={class:"session-item-title"},xl={class:"session-item-meta"},Cl={class:"session-item-shell"},Sl={key:0,class:"session-item-status"},$l={key:1,class:"session-item-time"},Ml={class:"terminal-main"},Tl={class:"terminal-header"},Pl={key:0,class:"header-session-title"},Bl={class:"header-actions"},Il={class:"terminal-container"},gt="hermes_terminal_theme",Fl=3,yt=18,io=he({__name:"TerminalPanel",props:{visible:{type:Boolean}},setup(H){const{t:s}=Ce(),v=xt(),U=H,I={default:{label:"Default",theme:{background:"#1a1a2e",foreground:"#e0e0e0",cursor:"#4cc9f0",cursorAccent:"#1a1a2e",selectionBackground:"rgba(76, 201, 240, 0.3)",black:"#000000",red:"#e06c75",green:"#98c379",yellow:"#e5c07b",blue:"#61afef",magenta:"#c678dd",cyan:"#56b6c2",white:"#abb2bf",brightBlack:"#5c6370",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"}},"solarized-dark":{label:"Solarized Dark",theme:{background:"#002b36",foreground:"#839496",cursor:"#93a1a1",cursorAccent:"#002b36",selectionBackground:"rgba(147, 161, 161, 0.3)",black:"#073642",red:"#dc322f",green:"#859900",yellow:"#b58900",blue:"#268bd2",magenta:"#d33682",cyan:"#2aa198",white:"#eee8d5",brightBlack:"#002b36",brightRed:"#cb4b16",brightGreen:"#586e75",brightYellow:"#657b83",brightBlue:"#839496",brightMagenta:"#6c71c4",brightCyan:"#93a1a1",brightWhite:"#fdf6e3"}},"tokyo-night":{label:"Tokyo Night",theme:{background:"#1a1b26",foreground:"#a9b1d6",cursor:"#c0caf5",cursorAccent:"#1a1b26",selectionBackground:"rgba(192, 202, 245, 0.2)",black:"#15161e",red:"#f7768e",green:"#9ece6a",yellow:"#e0af68",blue:"#7aa2f7",magenta:"#bb9af7",cyan:"#7dcfff",white:"#a9b1d6",brightBlack:"#414868",brightRed:"#f7768e",brightGreen:"#9ece6a",brightYellow:"#e0af68",brightBlue:"#7aa2f7",brightMagenta:"#bb9af7",brightCyan:"#7dcfff",brightWhite:"#c0caf5"}},"github-dark":{label:"GitHub Dark",theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#58a6ff",cursorAccent:"#0d1117",selectionBackground:"rgba(88, 166, 255, 0.25)",black:"#484f58",red:"#ff7b72",green:"#7ee787",yellow:"#ffa657",blue:"#79c0ff",magenta:"#d2a8ff",cyan:"#a5d6ff",white:"#c9d1d9",brightBlack:"#6e7681",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#58a6ff",brightMagenta:"#bc8cff",brightCyan:"#79c0ff",brightWhite:"#f0f6fc"}}},m=h(null),n=h([]),M=h(null),A=h(localStorage.getItem(gt)||"default"),R=h(null),B=h(!1),z=h(!1);let C=null;const F=new Map;let S=null,T=null,P=null,p=0,c=null,b=0;const E=D(()=>n.value.find(f=>f.id===M.value)||null),q=D(()=>Object.entries(I).map(([f,g])=>({label:g.label,value:f}))),$=D(()=>I[A.value]?.theme.background??"#1a1a2e");function Q(){const f=Lo(),g=Do(),L=g?g.startsWith("https")?"wss:":"ws:":location.protocol==="https:"?"wss:":"ws:";return g?`${L}//${new URL(g).host}/api/hermes/terminal${f?`?token=${encodeURIComponent(f)}`:""}`:`${L}//${location.host}/api/hermes/terminal${f?`?token=${encodeURIComponent(f)}`:""}`}function se(){if(p>=Fl){R.value=s("terminal.connectionFailed"),B.value=!1;return}const f=Q();R.value=null,B.value=!0,p++,C=new WebSocket(f),C.onopen=()=>{B.value=!1,R.value=null},C.onmessage=g=>{const L=typeof g.data=="string"?g.data:"";if(L.charCodeAt(0)===123)try{Se(JSON.parse(L))}catch{}else S?.write(L)},C.onclose=g=>{if(B.value=!1,g.code===1e3||g.code===1003||g.code===1008){R.value=s("terminal.connectionClosed");return}setTimeout(se,3e3)},C.onerror=g=>{console.error("[Terminal] WebSocket error:",g),R.value=s("terminal.connectionError")}}function de(f){!C||C.readyState!==WebSocket.OPEN||C.send(typeof f=="string"?f:JSON.stringify(f))}function Se(f){switch(f.type){case"created":p=0,n.value.push({id:f.id,shell:f.shell,pid:f.pid,title:`${f.shell} #${n.value.length+1}`,createdAt:Date.now(),exited:!1}),le(f.id);break;case"exited":{const g=n.value.find(L=>L.id===f.id);g&&(g.exited=!0,M.value===f.id&&S?.write(`\r
|
|
3
3
|
\x1B[90m[${s("terminal.processExited",{code:f.exitCode})}]\x1B[0m\r
|
|
4
4
|
`));break}case"error":v.error(f.message);break}}function ee(){de({type:"create"})}function ie(f){let g=F.get(f);if(!g){const L=new an({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',theme:{...I[A.value].theme}}),ce=new tn;L.loadAddon(ce),L.loadAddon(new ln),L.onData(Me=>{C?.readyState===WebSocket.OPEN&&C.send(Me)}),g={term:L,fitAddon:ce,opened:!1},F.set(f,g)}return g}function le(f){if(M.value===f)return;M.value=f;const g=ie(f);S=g.term,T=g.fitAddon,Ie(),de({type:"switch",sessionId:f})}function me(f){de({type:"close",sessionId:f}),n.value=n.value.filter(L=>L.id!==f);const g=F.get(f);g&&(g.term.dispose(),F.delete(f)),M.value===f&&(M.value=n.value.length>0?n.value[0].id:null,S=null,T=null,M.value?le(M.value):($e(),ee()))}function Ie(){if(!m.value)return;const f=m.value;for(;f.firstChild;)f.removeChild(f.firstChild);const g=F.get(M.value);if(g){if(!g.opened)g.term.open(f),g.opened=!0;else{const L=g.term.element;L&&f.appendChild(L)}P?.disconnect(),P=new ResizeObserver(()=>{Y(),ae()}),P.observe(m.value),setTimeout(()=>Y(),50),setTimeout(()=>Y(),200)}}function $e(){if(!m.value)return;const f=m.value;for(;f.firstChild;)f.removeChild(f.firstChild)}function Y(){if(T)try{T.fit()}catch{}}function ae(){if(!(!S||!C||C.readyState!==WebSocket.OPEN))try{de({type:"resize",cols:S.cols,rows:S.rows})}catch{}}function re(f){if(f.touches.length!==1){c=null,b=0;return}c=f.touches[0].clientY,b=0}function Z(f){if(!S||f.touches.length!==1||c===null)return;const g=f.touches[0].clientY;b+=c-g,c=g;const L=Math.trunc(b/yt);L!==0&&(S.scrollLines(L),b-=L*yt,f.preventDefault())}function oe(){c=null,b=0}function ue(f){A.value=f,localStorage.setItem(gt,f);const g=I[f]?.theme;if(g)for(const L of F.values())L.term.options.theme={...g}}function ge(f){return new Date(f).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}let ye=!1;return J(()=>U.visible,f=>{f&&!ye&&!C&&(ye=!0,se())},{immediate:!0}),lt(()=>{$e();for(const f of F.values())f.term.dispose();F.clear(),S=null,T=null,C?.close(),C=null}),(f,g)=>(o(),i("div",pl,[z.value?(o(),i("div",{key:0,class:"sidebar-overlay",onClick:g[0]||(g[0]=L=>z.value=!1)})):y("",!0),e("div",{class:X(["terminal-sidebar",{"mobile-visible":z.value}])},[e("div",fl,[e("span",ml,r(t(s)("terminal.sessions")),1),k(t(we),{trigger:"hover"},{trigger:w(()=>[k(t(G),{quaternary:"",size:"tiny",onClick:ee,circle:""},{icon:w(()=>[...g[3]||(g[3]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)])]),_:1})]),default:w(()=>[V(" "+r(t(s)("terminal.newTab")),1)]),_:1})]),e("div",_l,[R.value?(o(),i("div",gl,[g[4]||(g[4]=e("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("circle",{cx:"12",cy:"12",r:"10"}),e("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})],-1)),e("span",null,r(R.value),1),k(t(G),{size:"tiny",onClick:se},{default:w(()=>[V(r(t(s)("common.retry")),1)]),_:1})])):n.value.length===0?(o(),i("div",yl,[B.value?(o(),i(W,{key:0},[V(r(t(s)("common.loading")),1)],64)):(o(),i(W,{key:1},[V(r(t(s)("terminal.noSessions")),1)],64))])):y("",!0),(o(!0),i(W,null,te(n.value,L=>(o(),i("button",{key:L.id,class:X(["session-item",{active:L.id===M.value,exited:L.exited}]),onClick:ce=>le(L.id)},[e("div",kl,[e("span",bl,r(L.title),1),e("span",xl,[e("span",Cl,r(L.shell),1),L.exited?(o(),i("span",Sl,r(t(s)("terminal.sessionExited")),1)):(o(),i("span",$l,r(ge(L.createdAt)),1))])]),n.value.length>1?(o(),K(t(ja),{key:0,onPositiveClick:ce=>me(L.id)},{trigger:w(()=>[e("button",{class:"session-item-delete",onClick:g[1]||(g[1]=bt(()=>{},["stop"]))},[...g[5]||(g[5]=[e("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),default:w(()=>[V(" "+r(t(s)("terminal.closeSession")),1)]),_:1},8,["onPositiveClick"])):y("",!0)],10,wl))),128))])],2),e("div",Ml,[e("header",Tl,[E.value?(o(),i("span",Pl,r(E.value.title),1)):y("",!0),e("div",Bl,[k(t(G),{size:"small",onClick:g[2]||(g[2]=L=>z.value=!z.value),class:"sidebar-toggle"},{icon:w(()=>[...g[6]||(g[6]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e("line",{x1:"9",y1:"3",x2:"9",y2:"21"})],-1)])]),default:w(()=>[V(" "+r(t(s)("terminal.sessions")),1)]),_:1}),k(t(Be),{value:A.value,options:q.value,size:"small","consistent-menu-width":!1,class:"theme-select","onUpdate:value":ue},null,8,["value","options"]),k(t(G),{size:"small",onClick:ee},{icon:w(()=>[...g[7]||(g[7]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)])]),default:w(()=>[V(" "+r(t(s)("terminal.newTab")),1)]),_:1})])]),e("div",Il,[e("div",{ref_key:"terminalRef",ref:m,class:"terminal-xterm",style:Ue({backgroundColor:$.value}),onTouchstart:re,onTouchmove:Z,onTouchend:oe,onTouchcancel:oe},null,36)])])]))}})})),Hn=O((()=>{})),ro,Gn=O((()=>{Ll(),Ll(),Hn(),pe(),ro=fe(io,[["__scopeId","data-v-e87bb3e6"]])})),Dl,Al,El,Rl,uo,zl=O((()=>{ve(),Tn(),xe(),Ne(),Mn(),fn(),yn(),pn(),$n(),vn(),kn(),_n(),wn(),Dl={class:"files-panel-drawer"},Al={class:"files-main-panel"},El={class:"main-toolbar"},Rl={class:"files-content"},uo=he({__name:"FilesPanel",setup(H){const s=cn(),{t:v}=Ce(),U=h(null),I=h(!1),m=h(!1),n=h("newFile"),M=h(null),A=h(!1);function R(F,S){U.value?.show(F,S)}function B(){n.value="newFile",M.value=null,m.value=!0}function z(){n.value="newFolder",M.value=null,m.value=!0}function C(F){n.value="rename",M.value=F,m.value=!0}return _e(()=>{s.fetchEntries("")}),(F,S)=>(o(),i("div",Dl,[A.value?(o(),i("div",{key:0,class:"sidebar-overlay",onClick:S[0]||(S[0]=T=>A.value=!1)})):y("",!0),e("div",{class:X(["files-tree-panel",{"mobile-visible":A.value}])},[k(un)],2),e("div",Al,[e("div",El,[k(t(G),{size:"small",onClick:S[1]||(S[1]=T=>A.value=!A.value),class:"sidebar-toggle"},{icon:w(()=>[...S[5]||(S[5]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e("line",{x1:"9",y1:"3",x2:"9",y2:"21"})],-1)])]),default:w(()=>[V(" "+r(t(v)("files.fileTree")),1)]),_:1}),k(bn,{onShowNewFile:B,onShowNewFolder:z,onShowUpload:S[2]||(S[2]=T=>I.value=!0)})]),k(mn),e("div",Rl,[t(s).editingFile?(o(),K(Cn,{key:0})):t(s).previewFile?(o(),K(dn,{key:1})):(o(),K(hn,{key:2,onContextmenuEntry:R}))])]),k(gn,{ref_key:"contextMenuRef",ref:U,onRename:C},null,512),k(xn,{show:I.value,"onUpdate:show":S[3]||(S[3]=T=>I.value=T)},null,8,["show"]),k(Sn,{show:m.value,"onUpdate:show":S[4]||(S[4]=T=>m.value=T),mode:n.value,entry:M.value},null,8,["show","mode","entry"])]))}})})),Wn=O((()=>{})),co,jn=O((()=>{zl(),zl(),Wn(),pe(),co=fe(uo,[["__scopeId","data-v-efc529cd"]])})),Ul,Nl,Ol,Vl,ql,vo,Hl=O((()=>{ve(),xe(),Gn(),jn(),Ul={class:"drawer-header"},Nl={class:"drawer-tabs"},Ol={class:"drawer-content"},Vl={class:"drawer-pane"},ql={class:"drawer-pane"},vo=he({__name:"DrawerPanel",props:{show:{type:Boolean},activeTab:{default:"files"}},emits:["update:show"],setup(H,{emit:s}){const v=H,U=s,{t:I}=Ce(),m=h(v.activeTab);J(()=>v.activeTab,M=>{M&&(m.value=M)});function n(){U("update:show",!1)}return(M,A)=>(o(),K(Mo,{to:"body"},[H.show?(o(),i("div",{key:0,class:"drawer-overlay",onClick:n})):y("",!0),e("div",{class:X(["drawer-panel",{show:H.show}])},[e("div",Ul,[e("div",Nl,[e("button",{class:X(["tab-button",{active:m.value==="files"}]),onClick:A[0]||(A[0]=R=>m.value="files")},r(t(I)("drawer.files")),3),e("button",{class:X(["tab-button",{active:m.value==="terminal"}]),onClick:A[1]||(A[1]=R=>m.value="terminal")},r(t(I)("drawer.terminal")),3)]),e("button",{class:"close-button",onClick:n},[...A[2]||(A[2]=[e("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),e("div",Ol,[tt(e("div",Vl,[k(co)],512),[[kt,m.value==="files"]]),tt(e("div",ql,[k(ro,{visible:m.value==="terminal"&&H.show},null,8,["visible"])],512),[[kt,m.value==="terminal"]])])],2)]))}})})),Yn=O((()=>{})),ho,Kn=O((()=>{Hl(),Hl(),Yn(),pe(),ho=fe(vo,[["__scopeId","data-v-9e646a0b"]])})),Gl,Wl,jl,Yl,Kl,Xl,Jl,Ql,Zl,ea,ta,sa,la,aa,oa,na,ia,ra,ua,da,ca,va,ha,pa,fa,ma,_a,ga,ya,wa,ka,ba,xa,Ca,Sa,$a,Ma,Ta,Pa,Ba,Ia,Fa,La,Da,Aa,Ea,Ra,za,Ua,Na,Oa,Va,qa,po,Ha=O((()=>{ve(),Ya(),rt(),nt(),Ct(),Wo(),Ne(),xe(),jo(),Bn(),Dn(),Un(),qn(),Ko(),Kn(),Xo(),Gl={class:"chat-panel"},Wl={class:"session-list-header"},jl={key:0,class:"session-list-title"},Yl={class:"session-list-actions"},Kl={key:0,class:"session-profile-filter"},Xl={key:1,class:"session-items"},Jl={key:0,class:"session-loading"},Ql={key:1,class:"session-empty"},Zl={class:"session-group-header session-group-header--static"},ea={class:"session-group-label"},ta={class:"session-group-count"},sa={class:"session-model-list"},la=["onClick"],aa={class:"session-model-group-label"},oa={class:"session-model-group-count"},na={class:"session-model-group-items"},ia=["title","onClick"],ra={class:"session-model-item-label"},ua={class:"session-model-item-name"},da={key:0,class:"session-model-item-id"},ca={key:0,class:"session-model-badge-preview"},va={key:1,class:"session-model-badge-disabled"},ha={key:2,class:"session-model-badge-custom"},pa={key:3,class:"session-model-check",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},fa={key:0,class:"session-model-empty"},ma={class:"session-model-custom"},_a={class:"session-model-custom-row"},ga={class:"session-model-custom-hint"},ya={class:"new-chat-form"},wa={class:"new-chat-field"},ka={class:"new-chat-label"},ba={class:"new-chat-field"},xa={class:"new-chat-label"},Ca={class:"new-chat-field"},Sa={class:"new-chat-label"},$a={class:"new-chat-actions"},Ma={class:"chat-main"},Ta={class:"chat-header"},Pa={class:"header-left"},Ba={class:"header-session-title"},Ia=["title"],Fa={class:"header-actions"},La={class:"chat-content-wrapper"},Da={class:"chat-main-content"},Aa={key:0,class:"approval-bar"},Ea={class:"approval-content"},Ra={class:"approval-main"},za={class:"approval-kicker"},Ua={class:"approval-title"},Na={class:"approval-desc"},Oa={class:"approval-command"},Va={class:"approval-actions"},qa={class:"drawer-button-wrapper"},po=he({__name:"ChatPanel",setup(H){const s=it(),v=be(),U=st(),I=Go(),m=xt(),{t:n}=Ce(),M=h(!1),A=h("files"),R=h(!1),B=h("chat"),z=h(!1),C=h(new Set),F=h(!1),S=h(!1),T=h(typeof window>"u"||!window.matchMedia("(max-width: 768px)").matches);let P=null;const p=h(!1);function c(a){s.switchSession(a),P?.matches&&(T.value=!1)}function b(a){p.value=a.matches,a.matches&&T.value&&(T.value=!1)}_e(()=>{P=window.matchMedia("(max-width: 768px)"),b(P),P.addEventListener("change",b),U.profiles.length===0&&U.fetchProfiles()}),lt(()=>{P?.removeEventListener("change",b)});const E=h(!1),q=h(""),$=h(null),Q=h(null),se=D(()=>s.sessionProfileFilter),de=D(()=>[{label:n("chat.allProfiles"),value:"__all__"},...U.profiles.map(a=>({label:a.name,value:a.name}))]);async function Se(a){s.sessionProfileFilter=a==="__all__"?null:a,await s.loadSessions(s.sessionProfileFilter)}function ee(a){return[...a].sort((l,d)=>(d.updatedAt||0)-(l.updatedAt||0))}const ie=D(()=>ee(s.sessions.filter(a=>I.isPinned(a.id)))),le=D(()=>ee(s.sessions.filter(a=>!I.isPinned(a.id))));J(()=>[s.sessionsLoaded,...s.sessions.map(a=>a.id)],a=>{const l=a.slice(1);!a[0]||l.length===0||I.pruneMissingSessions(l)},{immediate:!0});const me=D(()=>s.activeSession?.title||n("chat.newChat")),Ie=D(()=>B.value==="live"?n("chat.liveSessions"):me.value),$e=D(()=>s.activePendingApproval),Y=D(()=>$e.value),ae=h(!1),re=h("default"),Z=h(""),oe=h(""),ue=h(!1);function ge(a){return v.profileModelGroups.find(l=>l.profile===a)?.groups||[]}function ye(a){const l=ge(a),d=v.profileModelGroups.find(Re=>Re.profile===a),N=d?.default_provider||"",ft=d?.default||"",mt=(N?l.find(Re=>Re.provider===N):void 0)||l.find(Re=>Re.models.length>0);return{provider:mt?.provider||"",model:mt?.models.includes(ft)?ft:mt?.models[0]||""}}const f=D(()=>(U.profiles.length>0?U.profiles:[{name:"default"}]).map(a=>({label:a.name,value:a.name}))),g=D(()=>ge(re.value)),L=D(()=>g.value.map(a=>({label:a.label||a.provider,value:a.provider}))),ce=D(()=>{const a=g.value.find(l=>l.provider===Z.value);return(a?.models||[]).map(l=>({label:v.displayModelName(l,a?.provider),value:l}))});function Me(){const a=ye(re.value);Z.value=a.provider,oe.value=a.model}async function Fe(){ae.value=!0,ue.value=!0;try{U.profiles.length===0&&await U.fetchProfiles(),v.modelGroups.length===0&&v.profileModelGroups.length===0&&await v.loadModels(),re.value=U.activeProfileName||U.profiles.find(a=>a.active)?.name||U.profiles[0]?.name||"default",Me()}finally{ue.value=!1}}function ut(a){re.value=a,Me()}function dt(a){Z.value=a,oe.value=ce.value[0]?.value||""}function ct(){s.newChat({profile:re.value,provider:Z.value,model:oe.value}),ae.value=!1}function Te(a){s.respondApproval(a)}async function Oe(a){const l=a||s.activeSessionId;l&&(await Yo(l)?m.success(n("common.copied")):m.error(n("common.copied")+" ✗"))}function Ve(a){I.removePinned(a),s.deleteSession(a),m.success(n("chat.sessionDeleted"))}function Le(){S.value||(z.value=!z.value,z.value||(C.value.clear(),F.value=!1))}function qe(a){S.value||(C.value.has(a)?C.value.delete(a):C.value.add(a),C.value=new Set(C.value),C.value.size===0&&(F.value=!1))}function He(a){return C.value.has(a)}async function Ge(){if(C.value.size===0||S.value)return;const a=Array.from(C.value);S.value=!0;try{const l=await Vo(a);if(l.deleted>0){for(const d of a)I.removePinned(d);await s.loadSessions(s.sessionProfileFilter),m.success(n("chat.batchDeleteSuccess",{count:l.deleted})),l.failed>0&&m.warning(n("chat.batchDeletePartial",{failed:l.failed}))}else m.error(n("chat.batchDeleteFailed"))}catch{m.error(n("chat.batchDeleteFailed"))}finally{S.value=!1,F.value=!1,z.value=!1,C.value.clear()}}function u(){return Ge(),!1}function _(){if(!S.value){C.value.clear();for(const a of s.sessions)a.id!==s.activeSessionId&&C.value.add(a.id);C.value=new Set(C.value)}}const x=D(()=>C.value.size),ne=D(()=>s.sessions.some(a=>a.id!==s.activeSessionId)),j=h(null),We=D(()=>j.value?I.isPinned(j.value):!1),vt=D(()=>j.value&&s.sessions.find(a=>a.id===j.value)||null),ht=D(()=>{const a=[{label:n(We.value?"chat.unpin":"chat.pin"),key:"pin"},{label:n("chat.rename"),key:"rename"},{label:n("chat.setWorkspace"),key:"workspace"}];return vt.value?.source==="cli"&&a.push({label:n("chat.setModel"),key:"model"}),a.push({label:n("chat.export"),key:"export",children:[{label:n("chat.exportFull"),key:"export-full",children:[{label:"JSON",key:"export-full-json"},{label:"TXT",key:"export-full-txt"}]},{label:n("chat.exportCompressed"),key:"export-compressed",children:[{label:"JSON",key:"export-compressed-json"},{label:"TXT",key:"export-compressed-txt"}]}]}),a.push({label:n("chat.copySessionId"),key:"copy-id"}),a});function St(a,l){a.preventDefault(),j.value=l,je.value=!0,$t.value=a.clientX,Mt.value=a.clientY}const je=h(!1),$t=h(0),Mt=h(0);function Tt(a){return a==="export-full-json"?{mode:"full",ext:"json"}:a==="export-full-txt"?{mode:"full",ext:"txt"}:a==="export-compressed-json"?{mode:"compressed",ext:"json"}:a==="export-compressed-txt"?{mode:"compressed",ext:"txt"}:null}async function _o(a){if(je.value=!1,!!j.value){if(a==="pin"){I.togglePinned(j.value);return}if(a==="copy-id")Oe(j.value);else if(Tt(a)){const{mode:l,ext:d}=Tt(a),N=l==="compressed"?m.loading(n("chat.exportCompressing"),{duration:0}):null;try{await No(j.value,l,d),N?.destroy(),m.success(n("chat.exportSuccess"))}catch{N?.destroy(),m.error(n("chat.exportFailed"))}}else if(a==="workspace"){const l=s.sessions.find(d=>d.id===j.value);De.value=j.value,Pe.value=l?.workspace||"",Ye.value=!0}else if(a==="model")await ko(j.value);else if(a==="rename"){const l=s.sessions.find(d=>d.id===j.value);$.value=j.value,q.value=l?.title||"",E.value=!0,ke(()=>{Q.value?.focus()})}}}function go(){je.value=!1}async function Pt(){if(!(!$.value||!q.value.trim())){if(await Ho($.value,q.value.trim())){const a=s.sessions.find(l=>l.id===$.value);a&&(a.title=q.value.trim()),s.activeSession?.id===$.value&&(s.activeSession.title=q.value.trim()),m.success(n("chat.renamed"))}else m.error(n("chat.renameFailed"));E.value=!1}}const Ye=h(!1),Pe=h(""),De=h(null);async function yo(){if(De.value){if(await Ro(De.value,Pe.value||null)){const a=s.sessions.find(l=>l.id===De.value);a&&(a.workspace=Pe.value||null),s.activeSession?.id===De.value&&(s.activeSession.workspace=Pe.value||null),m.success(n("chat.workspaceSet"))}else m.error(n("chat.workspaceSetFailed"));Ye.value=!1}}const Ke=h(!1),Xe=h(null),Ae=h(""),Je=h({}),Qe=h(""),Ee=h(""),Ze=h(""),et=h(""),Bt=D(()=>s.sessions.find(a=>a.id===Xe.value)?.profile||null),pt=D(()=>Bt.value?ge(Bt.value):[]),wo=D(()=>pt.value.map(a=>({label:a.label,value:a.provider}))),It=D(()=>pt.value.map(a=>({...a,models:[...a.models,...(v.customModels[a.provider]||[]).filter(l=>!a.models.includes(l))]}))),Ft=D(()=>{const a=Ae.value.trim().toLowerCase();return a?It.value.map(l=>({...l,models:l.models.filter(d=>{const N=v.displayModelName(d,l.provider);return d.toLowerCase().includes(a)||N.toLowerCase().includes(a)})})).filter(l=>l.models.length>0||l.label.toLowerCase().includes(a)):It.value});async function ko(a){v.modelGroups.length===0&&v.profileModelGroups.length===0&&await v.loadModels();const l=s.sessions.find(N=>N.id===a),d=l?.profile?ye(l.profile):{provider:"",model:""};Xe.value=a,Qe.value=l?.model||d.model||"",Ee.value=l?.provider||d.provider||"",et.value=Ee.value,Ae.value="",Ze.value="",Je.value={},Ke.value=!0}function Lt(a){return!!Je.value[a]}function bo(a){Je.value[a]=!Je.value[a]}function xo(a,l){return(v.customModels[l]||[]).includes(a)}function Co(a,l){return v.displayModelName(a,l)}function So(a,l){return v.getModelAlias(a,l)}async function Dt(a,l){pt.value.find(d=>d.provider===l)?.model_meta?.[a]?.disabled||!Xe.value||(await s.switchSessionModel(a,l,Xe.value)?(Qe.value=a,Ee.value=l,Ke.value=!1,m.success(n("chat.modelSet"))):m.error(n("chat.modelSetFailed")))}async function $o(){const a=Ze.value.trim(),l=et.value;!a||!l||await Dt(a,l)}return(a,l)=>(o(),i("div",Gl,[B.value==="chat"?(o(),i("div",{key:0,class:X(["session-backdrop",{active:T.value}]),onClick:l[0]||(l[0]=d=>T.value=!1)},null,2)):y("",!0),B.value==="chat"?(o(),i("aside",{key:1,class:X(["session-list",{collapsed:!T.value}])},[e("div",Wl,[T.value?(o(),i("span",jl,r(t(n)("chat.webUiSessions")),1)):y("",!0),e("div",Yl,[e("button",{class:"session-close-btn",onClick:l[1]||(l[1]=d=>T.value=!1)},[...l[23]||(l[23]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])]),z.value?y("",!0):(o(),K(t(G),{key:0,quaternary:"",size:"tiny",onClick:Le,title:t(n)("chat.toggleBatchMode")},{icon:w(()=>[...l[24]||(l[24]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M9 11l3 3L22 4"}),e("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})],-1)])]),_:1},8,["title"])),z.value?(o(),K(t(G),{key:1,quaternary:"",size:"tiny",onClick:_,disabled:!ne.value||S.value,title:t(n)("chat.selectAll")},{icon:w(()=>[...l[25]||(l[25]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M9 11l3 3L22 4"}),e("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})],-1)])]),_:1},8,["disabled","title"])):y("",!0),z.value&&x.value>0?(o(),K(t(ja),{key:2,show:F.value,"onUpdate:show":l[2]||(l[2]=d=>F.value=d),"positive-button-props":{loading:S.value,disabled:S.value},"negative-button-props":{disabled:S.value},onPositiveClick:u},{trigger:w(()=>[k(t(G),{quaternary:"",size:"tiny",type:"error",loading:S.value,disabled:S.value},{icon:w(()=>[...l[26]||(l[26]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("polyline",{points:"3 6 5 6 21 6"}),e("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)])]),_:1},8,["loading","disabled"])]),default:w(()=>[V(" "+r(t(n)("chat.confirmBatchDelete",{count:x.value})),1)]),_:1},8,["show","positive-button-props","negative-button-props"])):y("",!0),z.value?(o(),K(t(G),{key:3,quaternary:"",size:"tiny",onClick:Le,disabled:S.value},{icon:w(()=>[...l[27]||(l[27]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])]),_:1},8,["disabled"])):y("",!0),k(t(G),{quaternary:"",size:"tiny",circle:"",onClick:Fe},{icon:w(()=>[...l[28]||(l[28]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)])]),_:1})])]),T.value?(o(),i("div",Kl,[k(t(Be),{value:se.value||"__all__",options:de.value,size:"small",loading:t(U).loading,"onUpdate:value":Se},null,8,["value","options","loading"])])):y("",!0),T.value?(o(),i("div",Xl,[t(s).isLoadingSessions&&t(s).sessions.length===0?(o(),i("div",Jl,r(t(n)("common.loading")),1)):t(s).sessions.length===0?(o(),i("div",Ql,r(t(n)("chat.noSessions")),1)):y("",!0),ie.value.length>0?(o(),i(W,{key:2},[e("div",Zl,[e("span",ea,r(t(n)("chat.pinned")),1),e("span",ta,r(ie.value.length),1)]),(o(!0),i(W,null,te(ie.value,d=>(o(),K(zt,{key:`pinned-${d.id}`,session:d,active:d.id===t(s).activeSessionId,pinned:!0,"can-delete":d.id!==t(s).activeSessionId||t(s).sessions.length>1,streaming:t(s).isSessionLive(d.id),selectable:z.value,selected:He(d.id),"show-profile":!0,onSelect:N=>c(d.id),onContextmenu:N=>St(N,d.id),onDelete:N=>Ve(d.id),onToggleSelect:N=>qe(d.id)},null,8,["session","active","can-delete","streaming","selectable","selected","onSelect","onContextmenu","onDelete","onToggleSelect"]))),128))],64)):y("",!0),(o(!0),i(W,null,te(le.value,d=>(o(),K(zt,{key:d.id,session:d,active:d.id===t(s).activeSessionId,pinned:!1,"can-delete":d.id!==t(s).activeSessionId||t(s).sessions.length>1,streaming:t(s).isSessionLive(d.id),selectable:z.value,selected:He(d.id),"show-profile":!0,onSelect:N=>c(d.id),onContextmenu:N=>St(N,d.id),onDelete:N=>Ve(d.id),onToggleSelect:N=>qe(d.id)},null,8,["session","active","can-delete","streaming","selectable","selected","onSelect","onContextmenu","onDelete","onToggleSelect"]))),128))])):y("",!0)],2)):y("",!0),k(t(Fo),{placement:"bottom-start",trigger:"manual",x:$t.value,y:Mt.value,options:ht.value,show:je.value,onSelect:_o,onClickoutside:go},null,8,["x","y","options","show"]),k(t(ze),{show:E.value,"onUpdate:show":l[4]||(l[4]=d=>E.value=d),preset:"dialog",title:t(n)("chat.renameSession"),"positive-text":t(n)("common.ok"),"negative-text":t(n)("common.cancel"),onPositiveClick:Pt},{default:w(()=>[k(t(_t),{ref_key:"renameInputRef",ref:Q,value:q.value,"onUpdate:value":l[3]||(l[3]=d=>q.value=d),placeholder:t(n)("chat.enterNewTitle"),onKeydown:At(Pt,["enter"])},null,8,["value","placeholder"])]),_:1},8,["show","title","positive-text","negative-text"]),k(t(ze),{show:Ye.value,"onUpdate:show":l[6]||(l[6]=d=>Ye.value=d),preset:"dialog",title:t(n)("chat.setWorkspaceTitle"),"positive-text":t(n)("common.ok"),"negative-text":t(n)("common.cancel"),style:{width:"520px"},onPositiveClick:yo},{default:w(()=>[k(Qa,{modelValue:Pe.value,"onUpdate:modelValue":l[5]||(l[5]=d=>Pe.value=d)},null,8,["modelValue"])]),_:1},8,["show","title","positive-text","negative-text"]),k(t(ze),{show:Ke.value,"onUpdate:show":l[10]||(l[10]=d=>Ke.value=d),preset:"card",title:t(n)("chat.setModelTitle"),style:{width:"min(480px, calc(100vw - 32px))"},"mask-closable":!0},{default:w(()=>[k(t(_t),{value:Ae.value,"onUpdate:value":l[7]||(l[7]=d=>Ae.value=d),placeholder:t(n)("models.searchPlaceholder"),clearable:"",size:"small",class:"session-model-search"},null,8,["value","placeholder"]),e("div",sa,[(o(!0),i(W,null,te(Ft.value,d=>(o(),i("div",{key:d.provider,class:"session-model-group"},[e("div",{class:"session-model-group-header",onClick:N=>bo(d.provider)},[(o(),i("svg",{class:X(["session-model-group-arrow",{collapsed:Lt(d.provider)}]),width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[...l[29]||(l[29]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),e("span",aa,r(d.label),1),e("span",oa,r(d.models.length),1)],8,la),tt(e("div",na,[(o(!0),i(W,null,te(d.models,N=>(o(),i("div",{key:N,class:X(["session-model-item",{active:N===Qe.value&&d.provider===Ee.value,disabled:!!d.model_meta?.[N]?.disabled}]),title:d.model_meta?.[N]?.disabled?t(n)("models.disabledTooltip"):"",onClick:ft=>Dt(N,d.provider)},[e("span",ra,[e("span",ua,r(Co(N,d.provider)),1),So(N,d.provider)?(o(),i("span",da,r(t(n)("models.aliasCanonical",{model:N})),1)):y("",!0)]),d.model_meta?.[N]?.preview?(o(),i("span",ca,r(t(n)("models.previewBadge")),1)):y("",!0),d.model_meta?.[N]?.disabled?(o(),i("span",va,r(t(n)("models.disabledBadge")),1)):y("",!0),xo(N,d.provider)?(o(),i("span",ha,r(t(n)("models.customBadge")),1)):y("",!0),N===Qe.value&&d.provider===Ee.value?(o(),i("svg",pa,[...l[30]||(l[30]=[e("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):y("",!0)],10,ia))),128))],512),[[kt,!Lt(d.provider)]])]))),128)),Ft.value.length===0?(o(),i("div",fa,r(Ae.value?"No results":"No models"),1)):y("",!0),e("div",ma,[e("div",_a,[k(t(Be),{value:et.value,"onUpdate:value":l[8]||(l[8]=d=>et.value=d),options:wo.value,size:"small",class:"session-model-custom-provider"},null,8,["value","options"]),k(t(_t),{value:Ze.value,"onUpdate:value":l[9]||(l[9]=d=>Ze.value=d),placeholder:t(n)("models.customModelPlaceholder"),size:"small",class:"session-model-custom-input",onKeydown:At($o,["enter"])},null,8,["value","placeholder"])]),e("div",ga,r(t(n)("models.customModelHint")),1)])])]),_:1},8,["show","title"]),k(t(ze),{show:ae.value,"onUpdate:show":l[13]||(l[13]=d=>ae.value=d),preset:"card",title:t(n)("chat.newChat"),style:{width:"min(440px, calc(100vw - 32px))"},"mask-closable":!0},{footer:w(()=>[e("div",$a,[k(t(G),{onClick:l[12]||(l[12]=d=>ae.value=!1)},{default:w(()=>[V(r(t(n)("common.cancel")),1)]),_:1}),k(t(G),{type:"primary",disabled:!re.value||!Z.value||!oe.value,onClick:ct},{default:w(()=>[V(r(t(n)("chat.newChat")),1)]),_:1},8,["disabled"])])]),default:w(()=>[e("div",ya,[e("label",wa,[e("span",ka,r(t(n)("sidebar.profiles")),1),k(t(Be),{value:re.value,options:f.value,loading:ue.value||t(U).loading,"onUpdate:value":ut},null,8,["value","options","loading"])]),e("label",ba,[e("span",xa,r(t(n)("models.provider")),1),k(t(Be),{value:Z.value,options:L.value,disabled:ue.value,"onUpdate:value":dt},null,8,["value","options","disabled"])]),e("label",Ca,[e("span",Sa,r(t(n)("models.models")),1),k(t(Be),{value:oe.value,"onUpdate:value":l[11]||(l[11]=d=>oe.value=d),options:ce.value,disabled:ue.value||!Z.value,filterable:""},null,8,["value","options","disabled"])])])]),_:1},8,["show","title"]),e("div",Ma,[e("header",Ta,[e("div",Pa,[B.value==="chat"?(o(),K(t(G),{key:0,quaternary:"",size:"small",onClick:l[14]||(l[14]=d=>T.value=!T.value),circle:""},{icon:w(()=>[...l[31]||(l[31]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[e("rect",{x:"3",y:"3",width:"7",height:"7"}),e("rect",{x:"14",y:"3",width:"7",height:"7"}),e("rect",{x:"3",y:"14",width:"7",height:"7"}),e("rect",{x:"14",y:"14",width:"7",height:"7"})],-1)])]),_:1})):y("",!0),e("span",Ba,r(Ie.value),1),t(s).activeSession?.workspace?(o(),i("span",{key:1,class:"workspace-badge",title:t(s).activeSession.workspace},"📁 "+r(t(s).activeSession.workspace.split("/").pop()||t(s).activeSession.workspace),9,Ia)):y("",!0)]),e("div",Fa,[B.value==="chat"?(o(),i(W,{key:0},[k(t(we),{trigger:"hover"},{trigger:w(()=>[k(t(G),{quaternary:"",size:"small",onClick:l[15]||(l[15]=d=>R.value=!R.value),circle:""},{icon:w(()=>[...l[32]||(l[32]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[e("path",{d:"M3 12h18M3 6h18M3 18h18"})],-1)])]),_:1})]),default:w(()=>[V(" "+r(t(n)("chat.outlineTitle")),1)]),_:1}),k(t(we),{trigger:"hover"},{trigger:w(()=>[k(t(G),{quaternary:"",size:"small",onClick:l[16]||(l[16]=d=>Oe()),circle:""},{icon:w(()=>[...l[33]||(l[33]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[e("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),e("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})],-1)])]),_:1})]),default:w(()=>[V(" "+r(t(n)("chat.copySessionId")),1)]),_:1}),k(t(G),{size:"small",circle:p.value,onClick:Fe},{icon:w(()=>[...l[34]||(l[34]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)])]),default:w(()=>[p.value?y("",!0):(o(),i(W,{key:0},[V(r(t(n)("chat.newChat")),1)],64))]),_:1},8,["circle"])],64)):y("",!0)])]),B.value==="chat"?(o(),i(W,{key:0},[e("div",La,[e("div",Da,[k(no)]),R.value?(o(),K(Qo,{key:0,messages:t(s).messages},null,8,["messages"])):y("",!0)]),Y.value?(o(),i("div",Aa,[l[35]||(l[35]=e("div",{class:"approval-icon","aria-hidden":"true"},[e("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10"}),e("path",{d:"m9 12 2 2 4-4"})])],-1)),e("div",Ea,[e("div",Ra,[e("div",za,r(t(n)("chat.approvalKicker")),1),e("div",Ua,r(t(n)("chat.approvalTitle")),1),e("div",Na,r(Y.value.description),1),e("code",Oa,r(Y.value.command),1)]),e("div",Va,[Y.value.choices.includes("once")?(o(),K(t(G),{key:0,size:"small",type:"primary",onClick:l[17]||(l[17]=d=>Te("once"))},{default:w(()=>[V(r(t(n)("chat.approvalAllowOnce")),1)]),_:1})):y("",!0),Y.value.choices.includes("session")?(o(),K(t(G),{key:1,size:"small",secondary:"",onClick:l[18]||(l[18]=d=>Te("session"))},{default:w(()=>[V(r(t(n)("chat.approvalAllowSession")),1)]),_:1})):y("",!0),Y.value.choices.includes("always")?(o(),K(t(G),{key:2,size:"small",secondary:"",onClick:l[19]||(l[19]=d=>Te("always"))},{default:w(()=>[V(r(t(n)("chat.approvalAlways")),1)]),_:1})):y("",!0),Y.value.choices.includes("deny")?(o(),K(t(G),{key:3,size:"small",type:"error",secondary:"",onClick:l[20]||(l[20]=d=>Te("deny"))},{default:w(()=>[V(r(t(n)("chat.approvalDeny")),1)]),_:1})):y("",!0)])])])):y("",!0),k(eo)],64)):(o(),K(so,{key:1,"human-only":t(I).humanOnly},null,8,["human-only"]))]),e("div",qa,[e("div",{class:"drawer-button",onClick:l[21]||(l[21]=d=>M.value=!0)},[...l[36]||(l[36]=[e("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[e("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e("line",{x1:"9",y1:"3",x2:"9",y2:"21"}),e("line",{x1:"15",y1:"3",x2:"15",y2:"21"})],-1)])])]),k(ho,{show:M.value,"onUpdate:show":l[22]||(l[22]=d=>M.value=d),"active-tab":A.value},null,8,["show","active-tab"])]))}})})),Xn=O((()=>{})),fo,Jn=O((()=>{Ha(),Ha(),Xn(),pe(),fo=fe(po,[["__scopeId","data-v-4955a7dd"]])})),Ga,mo,Wa=O((()=>{ve(),Jn(),nt(),rt(),Ct(),Oo(),Ga={class:"chat-view"},mo=he({__name:"ChatView",setup(H){const s=be(),v=it(),U=st(),I=qo();return _e(async()=>{s.loadModels(),await Promise.all([U.fetchProfiles(),I.fetchSettings()]),v.loadSessions()}),(m,n)=>(o(),i("div",Ga,[k(fo)]))}})})),Qn=O((()=>{})),Zn,ei=O((()=>{Wa(),Wa(),Qn(),pe(),Zn=fe(mo,[["__scopeId","data-v-c6869148"]])}));ei();export{Zn as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as w}from"./rolldown-runtime-BKwlnUi0.js";import{C as Re,F as E,H as pt,I as te,L as _t,Nt as C,R as ft,Rt as e,S as Ne,St as vt,T as mt,U as M,Vt as m,X as ae,Y as ht,Z as qe,_t as b,a as wt,ct as B,et as J,h as H,ht as Ke,it as $,l as gt,mt as yt,nt as N,ot as x,pt as Ft,r as kt,rt as R,st as F,t as P,tt as y,ut as ie,w as bt,wt as h,y as V,yt as Ae}from"./ui-vendor-Do3bR-2m.js";import{d as Ct,n as U,r as L,u as xt}from"./vue-vendor-CTEo-aiR.js";import{a as Ve,c as St,l as q,n as K,o as Je,t as A}from"./_plugin-vue_export-helper-BwtYqnFW.js";import{An as $t,On as Tt,kn as Et,t as Dt}from"./monaco-editor-l5q9SV0p.js";import{n as Mt,t as zt}from"./clipboard-4x9B6X3a.js";import{l as Xe,n as Bt,s as He,t as Pt}from"./MarkdownRenderer-DvkMz9DC.js";async function We(i=""){const s=new URLSearchParams;i&&s.set("path",i);const t=s.toString();return q(`/api/hermes/files/list${t?`?${t}`:""}`)}async function se(i){return q(`/api/hermes/files/read?path=${encodeURIComponent(i)}`)}async function le(i,s){await q("/api/hermes/files/write",{method:"PUT",body:JSON.stringify({path:i,content:s})})}async function Ut(i,s=!1){await q("/api/hermes/files/delete",{method:"DELETE",body:JSON.stringify({path:i,recursive:s})})}async function Lt(i,s){await q("/api/hermes/files/rename",{method:"POST",body:JSON.stringify({oldPath:i,newPath:s})})}async function jt(i){await q("/api/hermes/files/mkdir",{method:"POST",body:JSON.stringify({path:i})})}async function It(i,s){await q("/api/hermes/files/copy",{method:"POST",body:JSON.stringify({srcPath:i,destPath:s})})}async function Ot(i,s){const t=Je(),n=new FormData;for(const g of s)n.append("file",g);const a=new URLSearchParams;i&&a.set("path",i);const l=a.toString(),r=`${t}/api/hermes/files/upload${l?`?${l}`:""}`,c={},_=Ve();_&&(c.Authorization=`Bearer ${_}`);const u=await fetch(r,{method:"POST",headers:c,body:n});if(!u.ok){const g=await u.json().catch(()=>({error:`HTTP ${u.status}`}));throw new Error(g.error||`Upload failed: ${u.status}`)}return(await u.json()).files}function Rt(i,s){const t=Je(),n=new URLSearchParams({path:i});s&&n.set("name",s);const a=Ve();return a&&n.set("token",a),`${t}/api/hermes/download?${n.toString()}`}var Y=w((()=>{St()}));function Nt(i){const s=i.split("/").pop()||"";return s==="Dockerfile"?"dockerfile":s==="Makefile"?"makefile":Ge["."+s.split(".").pop()?.toLowerCase()]||"plaintext"}function Z(i){const s=i.lastIndexOf(".");return s>=0?i.slice(s).toLowerCase():""}function Q(i){return Ye.has(Z(i))}function ee(i){const s=Z(i);return s===".md"||s===".markdown"}function G(i){return!new Set([".png",".jpg",".jpeg",".gif",".webp",".bmp",".ico",".zip",".gz",".tar",".7z",".rar",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".mp3",".mp4",".wav",".webm",".avi",".mov",".exe",".dll",".so",".dylib",".bin",".dat",".db",".sqlite"]).has(Z(i))}function X(i,s,t){return!!(i===s||t&&i.startsWith(s+"/"))}var Ge,Ye,z,j=w((()=>{Ct(),M(),Y(),Ge={".js":"javascript",".jsx":"javascript",".ts":"typescript",".tsx":"typescript",".json":"json",".jsonc":"json",".html":"html",".htm":"html",".css":"css",".scss":"scss",".less":"less",".md":"markdown",".markdown":"markdown",".py":"python",".yaml":"yaml",".yml":"yaml",".xml":"xml",".sh":"shell",".bash":"shell",".zsh":"shell",".sql":"sql",".go":"go",".rs":"rust",".java":"java",".c":"c",".h":"c",".cpp":"cpp",".hpp":"cpp",".toml":"ini",".ini":"ini",".env":"ini",".vue":"html",".dockerfile":"dockerfile",".graphql":"graphql",".lua":"lua",".r":"r",".rb":"ruby",".php":"php",".swift":"swift",".kt":"kotlin"},Ye=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".bmp",".ico"]),z=xt("files",()=>{const i=C(""),s=C([]),t=C(!1),n=C("name"),a=C("asc"),l=C(null),r=C(null),c=J(()=>i.value?i.value.split("/").filter(Boolean):[]),_=J(()=>{const o=[...s.value];return o.sort((k,I)=>{if(k.isDir!==I.isDir)return k.isDir?-1:1;let O=0;switch(n.value){case"name":O=k.name.localeCompare(I.name);break;case"size":O=k.size-I.size;break;case"modTime":O=k.modTime.localeCompare(I.modTime);break}return a.value==="asc"?O:-O}),o});async function u(o){o!==void 0&&o!==i.value&&(r.value=null),o!==void 0&&(i.value=o),t.value=!0;try{s.value=(await We(i.value)).entries}catch(k){throw console.error("Failed to fetch files:",k),k}finally{t.value=!1}}function g(o){return u(o)}function S(){const o=i.value.split("/").filter(Boolean);return o.pop(),u(o.join("/"))}async function d(o){const k=await se(o);l.value={path:o,content:k.content,originalContent:k.content,language:Nt(o)}}async function p(){l.value&&(await le(l.value.path,l.value.content),l.value.originalContent=l.value.content)}function f(){l.value=null}async function D(o){if(Q(o.name))r.value={path:o.path,type:"image"};else if(ee(o.name)){const k=await se(o.path);r.value={path:o.path,type:"markdown",content:k.content}}}function T(){r.value=null}async function v(o){const k=i.value?`${i.value}/${o}`:o;await jt(k),await u()}async function W(o){const k=i.value?`${i.value}/${o}`:o;await le(k,""),await u()}async function ot(o){await Ut(o.path,o.isDir),r.value&&X(r.value.path,o.path,o.isDir)&&(r.value=null),l.value&&X(l.value.path,o.path,o.isDir)&&(l.value=null),await u()}async function rt(o,k){const I=o.path.includes("/")?o.path.slice(0,o.path.lastIndexOf("/")):"",O=I?`${I}/${k}`:k;await Lt(o.path,O),r.value&&X(r.value.path,o.path,o.isDir)&&(r.value=null),l.value&&X(l.value.path,o.path,o.isDir)&&(l.value=null),await u()}async function ut(o,k){await It(o.path,k),await u()}async function ct(o){await Ot(i.value,o),await u()}function dt(o){n.value===o?a.value=a.value==="asc"?"desc":"asc":(n.value=o,a.value="asc")}return{currentPath:i,entries:s,loading:t,sortBy:n,sortOrder:a,editingFile:l,previewFile:r,pathSegments:c,sortedEntries:_,hasUnsavedChanges:J(()=>l.value?l.value.content!==l.value.originalContent:!1),fetchEntries:u,navigateTo:g,navigateUp:S,openEditor:d,saveEditor:p,closeEditor:f,openPreview:D,closePreview:T,createDir:v,createFile:W,deleteEntry:ot,renameEntry:rt,copyEntry:ut,uploadFiles:ct,setSort:dt}})})),ne,Ze,oe=w((()=>{M(),P(),U(),j(),Y(),ne={class:"file-tree"},Ze=B({__name:"FileTree",setup(i){const{t:s}=L(),t=z(),n=C([]),a=C([]);async function l(u){try{return(await We(u)).entries.filter(g=>g.isDir).sort((g,S)=>g.name.localeCompare(S.name)).map(g=>({key:g.path,label:g.name,isLeaf:!1}))}catch{return[]}}async function r(u){u.children=await l(u.key)}function c(u){u.length>0&&(a.value=u,t.navigateTo(u[0]))}function _(){a.value=[],t.navigateTo("")}return Ke(async()=>{n.value=await l("")}),(u,g)=>(b(),$("div",ne,[y("div",{class:"tree-header",onClick:_},[g[0]||(g[0]=y("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},[y("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),y("polyline",{points:"9 22 9 12 15 12 15 22"})],-1)),y("span",null,m(e(s)("files.breadcrumbRoot")),1)]),F(e(wt),{data:n.value,"selected-keys":a.value,"on-load":r,"expand-on-click":"","block-line":"","onUpdate:selectedKeys":c},null,8,["data","selected-keys"])]))}})})),qt=w((()=>{})),Kt,_a=w((()=>{oe(),oe(),qt(),K(),Kt=A(Ze,[["__scopeId","data-v-7f00b3bc"]])})),re,Qe,ue=w((()=>{M(),U(),P(),j(),re={class:"file-breadcrumb"},Qe=B({__name:"FileBreadcrumb",setup(i){const{t:s}=L(),t=z();function n(a){if(a<0)t.navigateTo("");else{const l=t.pathSegments.slice(0,a+1).join("/");t.navigateTo(l)}}return(a,l)=>(b(),$("div",re,[F(e(_t),null,{default:h(()=>[F(e(te),{onClick:l[0]||(l[0]=r=>n(-1))},{default:h(()=>[x(m(e(s)("files.breadcrumbRoot")),1)]),_:1}),(b(!0),$(qe,null,Ae(e(t).pathSegments,(r,c)=>(b(),N(e(te),{key:c,onClick:_=>n(c)},{default:h(()=>[x(m(r),1)]),_:2},1032,["onClick"]))),128))]),_:1})]))}})})),At=w((()=>{})),Vt,fa=w((()=>{ue(),ue(),At(),K(),Vt=A(Qe,[["__scopeId","data-v-061302de"]])})),ce,et,de=w((()=>{M(),P(),U(),j(),ce={class:"file-toolbar"},et=B({__name:"FileToolbar",emits:["showNewFile","showNewFolder","showUpload"],setup(i,{emit:s}){const{t}=L(),n=V(),a=z(),l=s;async function r(){try{await a.fetchEntries()}catch{n.error(t("files.backendError"))}}return(c,_)=>(b(),$("div",ce,[F(e(H),{size:8,wrap:!0,class:"toolbar-space"},{default:h(()=>[F(e(E),{size:"small",onClick:_[0]||(_[0]=u=>l("showNewFile")),class:"toolbar-btn"},{default:h(()=>[x(m(e(t)("files.newFile")),1)]),_:1}),F(e(E),{size:"small",onClick:_[1]||(_[1]=u=>l("showNewFolder")),class:"toolbar-btn"},{default:h(()=>[x(m(e(t)("files.newFolder")),1)]),_:1}),F(e(E),{size:"small",onClick:_[2]||(_[2]=u=>l("showUpload")),class:"toolbar-btn"},{default:h(()=>[x(m(e(t)("files.upload")),1)]),_:1}),F(e(E),{size:"small",onClick:r,class:"toolbar-btn"},{default:h(()=>[x(m(e(t)("files.refresh")),1)]),_:1})]),_:1})]))}})})),Jt=w((()=>{})),Xt,va=w((()=>{de(),de(),Jt(),K(),Xt=A(et,[["__scopeId","data-v-64269d74"]])})),pe,_e,fe,ve,me,he,we,ge,ye,Fe,ke,be,tt,Ce=w((()=>{M(),P(),U(),j(),Xe(),pe={class:"file-list"},_e={key:1,class:"file-list-items"},fe={class:"file-list-header"},ve={key:0,class:"sort-indicator"},me={key:0,class:"sort-indicator"},he={key:0,class:"sort-indicator"},we=["onDblclick","onContextmenu"],ge={class:"file-name"},ye={class:"file-icon"},Fe={class:"file-size"},ke={class:"file-date"},be={class:"file-actions"},tt=B({__name:"FileList",emits:["contextmenu-entry"],setup(i,{emit:s}){const{t}=L(),n=V(),a=z(),l=s;function r(d){if(d===0)return"—";const p=["B","KB","MB","GB"];let f=0,D=d;for(;D>=1024&&f<p.length-1;)D/=1024,f++;return`${D.toFixed(f===0?0:1)} ${p[f]}`}function c(d){return d?new Date(d).toLocaleString():"—"}function _(d){return d.isDir?"📁":{yaml:"⚙️",yml:"⚙️",json:"📋",toml:"⚙️",md:"📝",txt:"📄",log:"📄",py:"🐍",js:"📜",ts:"📜",vue:"💚",png:"🖼️",jpg:"🖼️",jpeg:"🖼️",gif:"🖼️",svg:"🖼️",webp:"🖼️",zip:"📦",gz:"📦",tar:"📦",sh:"⚡",bash:"⚡"}[d.name.split(".").pop()?.toLowerCase()||""]||"📄"}function u(d){d.isDir?a.navigateTo(d.path):G(d.name)?a.openEditor(d.path):(Q(d.name)||ee(d.name))&&a.openPreview(d)}function g(d,p){d.preventDefault(),l("contextmenu-entry",d,p)}async function S(d){try{await He(d.path,d.name)}catch(p){n.error(p.message||t("files.backendError"))}}return(d,p)=>(b(),$("div",pe,[F(e(gt),{show:e(a).loading},{default:h(()=>[!e(a).loading&&e(a).sortedEntries.length===0?(b(),N(e(pt),{key:0,description:e(t)("files.emptyDir")},null,8,["description"])):(b(),$("div",_e,[y("div",fe,[y("div",{class:"file-name sort-header",onClick:p[0]||(p[0]=f=>e(a).setSort("name"))},[x(m(e(t)("files.name"))+" ",1),e(a).sortBy==="name"?(b(),$("span",ve,m(e(a).sortOrder==="asc"?"↑":"↓"),1)):R("",!0)]),y("div",{class:"file-size sort-header",onClick:p[1]||(p[1]=f=>e(a).setSort("size"))},[x(m(e(t)("files.size"))+" ",1),e(a).sortBy==="size"?(b(),$("span",me,m(e(a).sortOrder==="asc"?"↑":"↓"),1)):R("",!0)]),y("div",{class:"file-date sort-header",onClick:p[2]||(p[2]=f=>e(a).setSort("modTime"))},[x(m(e(t)("files.modified"))+" ",1),e(a).sortBy==="modTime"?(b(),$("span",he,m(e(a).sortOrder==="asc"?"↑":"↓"),1)):R("",!0)]),p[3]||(p[3]=y("div",{class:"file-actions-placeholder"},null,-1))]),(b(!0),$(qe,null,Ae(e(a).sortedEntries,f=>(b(),$("div",{key:f.path,class:"file-list-row",onDblclick:D=>u(f),onContextmenu:D=>g(D,f)},[y("div",ge,[y("span",ye,m(_(f)),1),y("span",null,m(f.name),1)]),y("div",Fe,m(f.isDir?"—":r(f.size)),1),y("div",ke,m(c(f.modTime)),1),y("div",be,[e(G)(f.name)&&!f.isDir?(b(),N(e(E),{key:0,size:"tiny",quaternary:"",onClick:ae(D=>e(a).openEditor(f.path),["stop"]),title:e(t)("files.edit")},{default:h(()=>[...p[4]||(p[4]=[x("✏️",-1)])]),_:1},8,["onClick","title"])):R("",!0),f.isDir?R("",!0):(b(),N(e(E),{key:1,size:"tiny",quaternary:"",onClick:ae(D=>S(f),["stop"]),title:e(t)("files.download")},{default:h(()=>[...p[5]||(p[5]=[x("⬇️",-1)])]),_:1},8,["onClick","title"]))])],40,we))),128))]))]),_:1},8,["show"])]))}})})),Ht=w((()=>{})),Wt,ma=w((()=>{Ce(),Ce(),Ht(),K(),Wt=A(tt,[["__scopeId","data-v-ab2593c7"]])}));function Gt(i){return i.absolutePath||i.path}var Yt=w((()=>{})),at,xe=w((()=>{M(),P(),U(),j(),Xe(),Mt(),Yt(),at=B({__name:"FileContextMenu",emits:["rename"],setup(i,{expose:s,emit:t}){const{t:n}=L(),a=V(),l=Re(),r=z(),c=C(!1),_=C(0),u=C(0),g=C(null),S=t;function d(T,v){g.value=v,_.value=T.clientX,u.value=T.clientY,c.value=!1,Ft(()=>{c.value=!0})}function p(){const T=g.value;if(!T)return[];const v=[];return T.isDir?v.push({label:n("files.open"),key:"open"}):(G(T.name)&&v.push({label:n("files.edit"),key:"edit"}),(Q(T.name)||ee(T.name))&&v.push({label:n("files.preview"),key:"preview"}),v.push({label:n("files.download"),key:"download"})),v.push({type:"divider",key:"d1"}),v.push({label:n("files.copyPath"),key:"copyPath"}),v.push({label:n("files.rename"),key:"rename"}),v.push({type:"divider",key:"d2"}),v.push({label:n("files.delete"),key:"delete"}),v}async function f(T){c.value=!1;const v=g.value;if(v)switch(T){case"open":r.navigateTo(v.path);break;case"edit":try{await r.openEditor(v.path)}catch{a.error(n("files.backendError"))}break;case"preview":try{await r.openPreview(v)}catch{a.error(n("files.backendError"))}break;case"download":try{await He(v.path,v.name)}catch(W){a.error(W.message)}break;case"copyPath":await zt(Gt(v))?a.success(n("files.pathCopied")):a.error(n("files.pathCopied")+" ✗");break;case"rename":S("rename",v);break;case"delete":l.warning({title:n("files.delete"),content:v.isDir?n("files.confirmDeleteDir",{name:v.name}):n("files.confirmDelete",{name:v.name}),positiveText:n("common.delete"),negativeText:n("common.cancel"),onPositiveClick:async()=>{try{await r.deleteEntry(v),a.success(n("files.deleted"))}catch{a.error(n("files.deleteFailed"))}}});break}}function D(){c.value=!1}return s({show:d}),(T,v)=>(b(),N(e(bt),{show:c.value,x:_.value,y:u.value,options:p(),placement:"bottom-start",trigger:"manual",onSelect:f,onClickoutside:D},null,8,["show","x","y","options"]))}})})),Zt,ha=w((()=>{xe(),xe(),Zt=at})),Se,$e,Te,it,Ee=w((()=>{M(),P(),U(),j(),Dt(),Se={class:"file-editor"},$e={class:"editor-header"},Te={class:"editor-filename"},it=B({__name:"FileEditor",setup(i){self.MonacoEnvironment={getWorker(g,S){return new Worker(new URL("/assets/editor.worker-DtO216D1.js",""+import.meta.url),{type:"module"})}};const{t:s}=L(),t=V(),n=Re(),a=z(),l=C(null);let r=null;const c=C(!1);Ke(()=>{!l.value||!a.editingFile||(r=$t.create(l.value,{value:a.editingFile.content,language:a.editingFile.language,theme:document.documentElement.classList.contains("dark")?"vs-dark":"vs",minimap:{enabled:!1},fontSize:13,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"on"}),r.onDidChangeModelContent(()=>{a.editingFile&&(a.editingFile.content=r.getValue())}),r.addCommand(Et.CtrlCmd|Tt.KeyS,()=>{_()}))}),yt(()=>{r?.dispose(),r=null});async function _(){c.value=!0;try{await a.saveEditor(),t.success(s("files.saved"))}catch{t.error(s("files.saveFailed"))}finally{c.value=!1}}function u(){a.hasUnsavedChanges?n.warning({title:s("files.unsavedChanges"),positiveText:s("common.ok"),negativeText:s("common.cancel"),onPositiveClick:()=>{a.closeEditor()}}):a.closeEditor()}return(g,S)=>(b(),$("div",Se,[y("div",$e,[y("span",Te,m(e(a).editingFile?.path),1),F(e(H),null,{default:h(()=>[F(e(E),{size:"small",type:"primary",loading:c.value,onClick:_},{default:h(()=>[x(m(e(s)("files.saveFile")),1)]),_:1},8,["loading"]),F(e(E),{size:"small",onClick:u},{default:h(()=>[x(m(e(s)("files.closeEditor")),1)]),_:1})]),_:1})]),y("div",{ref_key:"editorContainer",ref:l,class:"editor-container"},null,512)]))}})})),Qt=w((()=>{})),ea,wa=w((()=>{Ee(),Ee(),Qt(),K(),ea=A(it,[["__scopeId","data-v-1ae26b53"]])})),De,Me,ze,Be,Pe,Ue,st,Le=w((()=>{M(),P(),U(),j(),Y(),Bt(),De={key:0,class:"file-preview"},Me={class:"preview-header"},ze={class:"preview-filename"},Be={class:"preview-content"},Pe=["src","alt"],Ue={key:1,class:"preview-markdown"},st=B({__name:"FilePreview",setup(i){const{t:s}=L(),t=z();function n(){return t.previewFile?Rt(t.previewFile.path):""}const a=()=>ie("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"currentColor"},[ie("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})]);return(l,r)=>e(t).previewFile?(b(),$("div",De,[y("div",Me,[y("span",ze,m(e(t).previewFile.path),1),F(e(E),{size:"small",quaternary:"",onClick:r[0]||(r[0]=c=>e(t).closePreview())},{icon:h(()=>[F(e(mt),null,{default:h(()=>[F(a)]),_:1})]),default:h(()=>[x(" "+m(e(s)("files.closePreview")),1)]),_:1})]),y("div",Be,[e(t).previewFile.type==="image"?(b(),$("img",{key:0,src:n(),class:"preview-image",alt:e(t).previewFile.path},null,8,Pe)):e(t).previewFile.type==="markdown"?(b(),$("div",Ue,[F(Pt,{content:e(t).previewFile.content||""},null,8,["content"])])):R("",!0)])])):R("",!0)}})})),ta=w((()=>{})),aa,ga=w((()=>{Le(),Le(),ta(),K(),aa=A(st,[["__scopeId","data-v-a9f9eb37"]])})),je,lt,Ie=w((()=>{M(),P(),U(),j(),je={class:"upload-dragger"},lt=B({__name:"FileUploadModal",props:{show:{type:Boolean}},emits:["update:show"],setup(i,{emit:s}){const{t}=L(),n=V(),a=z(),l=i,r=s,c=C(!1),_=C([]);function u(d){_.value=d.fileList.map(p=>p.file).filter(p=>p!=null)}async function g(){if(_.value.length!==0){c.value=!0;try{await a.uploadFiles(_.value),n.success(t("files.uploadSuccess",{count:_.value.length})),_.value=[],r("update:show",!1)}catch(d){n.error(d.message||t("files.uploadFailed"))}finally{c.value=!1}}}function S(){_.value=[],r("update:show",!1)}return(d,p)=>(b(),N(e(Ne),{show:l.show,preset:"dialog",title:e(t)("files.upload"),"onUpdate:show":S,style:{width:"500px"}},{action:h(()=>[F(e(H),null,{default:h(()=>[F(e(E),{onClick:S},{default:h(()=>[x(m(e(t)("common.cancel")),1)]),_:1}),F(e(E),{type:"primary",loading:c.value,disabled:_.value.length===0,onClick:g},{default:h(()=>[x(m(e(t)("files.upload"))+" ("+m(_.value.length)+") ",1)]),_:1},8,["loading","disabled"])]),_:1})]),default:h(()=>[F(e(kt),{multiple:"","directory-dnd":"","default-upload":!1,onChange:u},{default:h(()=>[y("div",je,[y("p",null,m(e(t)("files.dragDropHint")),1)])]),_:1})]),_:1},8,["show","title"]))}})})),ia=w((()=>{})),sa,ya=w((()=>{Ie(),Ie(),ia(),K(),sa=A(lt,[["__scopeId","data-v-e54e68b1"]])})),nt,Oe=w((()=>{M(),P(),U(),j(),nt=B({__name:"FileRenameModal",props:{show:{type:Boolean},mode:{},entry:{}},emits:["update:show"],setup(i,{emit:s}){const{t}=L(),n=V(),a=z(),l=i,r=s,c=C(""),_=C(!1);vt(()=>l.show,d=>{d&&(l.mode==="rename"&&l.entry?c.value=l.entry.name:c.value="")});const u=J(()=>{switch(l.mode){case"newFile":return t("files.newFile");case"newFolder":return t("files.newFolder");case"rename":return t("files.rename")}}),g=J(()=>{switch(l.mode){case"newFile":return t("files.newFileName");case"newFolder":return t("files.newFolderName");case"rename":return t("files.renameTo")}});async function S(){if(c.value.trim()){_.value=!0;try{switch(l.mode){case"newFile":await a.createFile(c.value.trim()),n.success(t("files.created"));break;case"newFolder":await a.createDir(c.value.trim()),n.success(t("files.created"));break;case"rename":l.entry&&(await a.renameEntry(l.entry,c.value.trim()),n.success(t("files.renamed")));break}r("update:show",!1)}catch(d){const p=l.mode==="rename"?t("files.renameFailed"):t("files.createFailed");n.error(d.message||p)}finally{_.value=!1}}}return(d,p)=>(b(),N(e(Ne),{show:l.show,preset:"dialog",title:u.value,"onUpdate:show":p[2]||(p[2]=f=>r("update:show",!1)),style:{width:"400px"}},{action:h(()=>[F(e(H),null,{default:h(()=>[F(e(E),{onClick:p[1]||(p[1]=f=>r("update:show",!1))},{default:h(()=>[x(m(e(t)("common.cancel")),1)]),_:1}),F(e(E),{type:"primary",loading:_.value,disabled:!c.value.trim(),onClick:S},{default:h(()=>[x(m(e(t)("common.ok")),1)]),_:1},8,["loading","disabled"])]),_:1})]),default:h(()=>[F(e(ft),{value:c.value,"onUpdate:value":p[0]||(p[0]=f=>c.value=f),placeholder:g.value,onKeydown:ht(S,["enter"]),autofocus:""},null,8,["value","placeholder"])]),_:1},8,["show","title"]))}})})),la,Fa=w((()=>{Oe(),Oe(),la=nt}));export{Kt as _,aa as a,z as b,wa as c,Wt as d,ma as f,fa as g,Vt as h,ya as i,Zt as l,va as m,Fa as n,ga as o,Xt as p,sa as r,ea as s,la as t,ha as u,_a as v,j as y};
|
|
1
|
+
import{n as w}from"./rolldown-runtime-BKwlnUi0.js";import{C as Re,F as E,H as pt,I as te,L as _t,Nt as C,R as ft,Rt as e,S as Ne,St as vt,T as mt,U as M,Vt as m,X as ae,Y as ht,Z as qe,_t as b,a as wt,ct as B,et as J,h as H,ht as Ke,it as $,l as gt,mt as yt,nt as N,ot as x,pt as Ft,r as kt,rt as R,st as F,t as P,tt as y,ut as ie,w as bt,wt as h,y as V,yt as Ae}from"./ui-vendor-Do3bR-2m.js";import{d as Ct,n as U,r as L,u as xt}from"./vue-vendor-CTEo-aiR.js";import{a as Ve,c as St,l as q,n as K,o as Je,t as A}from"./_plugin-vue_export-helper-DSvknO3W.js";import{An as $t,On as Tt,kn as Et,t as Dt}from"./monaco-editor-l5q9SV0p.js";import{n as Mt,t as zt}from"./clipboard-4x9B6X3a.js";import{l as Xe,n as Bt,s as He,t as Pt}from"./MarkdownRenderer-CdhBsVZY.js";async function We(i=""){const s=new URLSearchParams;i&&s.set("path",i);const t=s.toString();return q(`/api/hermes/files/list${t?`?${t}`:""}`)}async function se(i){return q(`/api/hermes/files/read?path=${encodeURIComponent(i)}`)}async function le(i,s){await q("/api/hermes/files/write",{method:"PUT",body:JSON.stringify({path:i,content:s})})}async function Ut(i,s=!1){await q("/api/hermes/files/delete",{method:"DELETE",body:JSON.stringify({path:i,recursive:s})})}async function Lt(i,s){await q("/api/hermes/files/rename",{method:"POST",body:JSON.stringify({oldPath:i,newPath:s})})}async function jt(i){await q("/api/hermes/files/mkdir",{method:"POST",body:JSON.stringify({path:i})})}async function It(i,s){await q("/api/hermes/files/copy",{method:"POST",body:JSON.stringify({srcPath:i,destPath:s})})}async function Ot(i,s){const t=Je(),n=new FormData;for(const g of s)n.append("file",g);const a=new URLSearchParams;i&&a.set("path",i);const l=a.toString(),r=`${t}/api/hermes/files/upload${l?`?${l}`:""}`,c={},_=Ve();_&&(c.Authorization=`Bearer ${_}`);const u=await fetch(r,{method:"POST",headers:c,body:n});if(!u.ok){const g=await u.json().catch(()=>({error:`HTTP ${u.status}`}));throw new Error(g.error||`Upload failed: ${u.status}`)}return(await u.json()).files}function Rt(i,s){const t=Je(),n=new URLSearchParams({path:i});s&&n.set("name",s);const a=Ve();return a&&n.set("token",a),`${t}/api/hermes/download?${n.toString()}`}var Y=w((()=>{St()}));function Nt(i){const s=i.split("/").pop()||"";return s==="Dockerfile"?"dockerfile":s==="Makefile"?"makefile":Ge["."+s.split(".").pop()?.toLowerCase()]||"plaintext"}function Z(i){const s=i.lastIndexOf(".");return s>=0?i.slice(s).toLowerCase():""}function Q(i){return Ye.has(Z(i))}function ee(i){const s=Z(i);return s===".md"||s===".markdown"}function G(i){return!new Set([".png",".jpg",".jpeg",".gif",".webp",".bmp",".ico",".zip",".gz",".tar",".7z",".rar",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".mp3",".mp4",".wav",".webm",".avi",".mov",".exe",".dll",".so",".dylib",".bin",".dat",".db",".sqlite"]).has(Z(i))}function X(i,s,t){return!!(i===s||t&&i.startsWith(s+"/"))}var Ge,Ye,z,j=w((()=>{Ct(),M(),Y(),Ge={".js":"javascript",".jsx":"javascript",".ts":"typescript",".tsx":"typescript",".json":"json",".jsonc":"json",".html":"html",".htm":"html",".css":"css",".scss":"scss",".less":"less",".md":"markdown",".markdown":"markdown",".py":"python",".yaml":"yaml",".yml":"yaml",".xml":"xml",".sh":"shell",".bash":"shell",".zsh":"shell",".sql":"sql",".go":"go",".rs":"rust",".java":"java",".c":"c",".h":"c",".cpp":"cpp",".hpp":"cpp",".toml":"ini",".ini":"ini",".env":"ini",".vue":"html",".dockerfile":"dockerfile",".graphql":"graphql",".lua":"lua",".r":"r",".rb":"ruby",".php":"php",".swift":"swift",".kt":"kotlin"},Ye=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".bmp",".ico"]),z=xt("files",()=>{const i=C(""),s=C([]),t=C(!1),n=C("name"),a=C("asc"),l=C(null),r=C(null),c=J(()=>i.value?i.value.split("/").filter(Boolean):[]),_=J(()=>{const o=[...s.value];return o.sort((k,I)=>{if(k.isDir!==I.isDir)return k.isDir?-1:1;let O=0;switch(n.value){case"name":O=k.name.localeCompare(I.name);break;case"size":O=k.size-I.size;break;case"modTime":O=k.modTime.localeCompare(I.modTime);break}return a.value==="asc"?O:-O}),o});async function u(o){o!==void 0&&o!==i.value&&(r.value=null),o!==void 0&&(i.value=o),t.value=!0;try{s.value=(await We(i.value)).entries}catch(k){throw console.error("Failed to fetch files:",k),k}finally{t.value=!1}}function g(o){return u(o)}function S(){const o=i.value.split("/").filter(Boolean);return o.pop(),u(o.join("/"))}async function d(o){const k=await se(o);l.value={path:o,content:k.content,originalContent:k.content,language:Nt(o)}}async function p(){l.value&&(await le(l.value.path,l.value.content),l.value.originalContent=l.value.content)}function f(){l.value=null}async function D(o){if(Q(o.name))r.value={path:o.path,type:"image"};else if(ee(o.name)){const k=await se(o.path);r.value={path:o.path,type:"markdown",content:k.content}}}function T(){r.value=null}async function v(o){const k=i.value?`${i.value}/${o}`:o;await jt(k),await u()}async function W(o){const k=i.value?`${i.value}/${o}`:o;await le(k,""),await u()}async function ot(o){await Ut(o.path,o.isDir),r.value&&X(r.value.path,o.path,o.isDir)&&(r.value=null),l.value&&X(l.value.path,o.path,o.isDir)&&(l.value=null),await u()}async function rt(o,k){const I=o.path.includes("/")?o.path.slice(0,o.path.lastIndexOf("/")):"",O=I?`${I}/${k}`:k;await Lt(o.path,O),r.value&&X(r.value.path,o.path,o.isDir)&&(r.value=null),l.value&&X(l.value.path,o.path,o.isDir)&&(l.value=null),await u()}async function ut(o,k){await It(o.path,k),await u()}async function ct(o){await Ot(i.value,o),await u()}function dt(o){n.value===o?a.value=a.value==="asc"?"desc":"asc":(n.value=o,a.value="asc")}return{currentPath:i,entries:s,loading:t,sortBy:n,sortOrder:a,editingFile:l,previewFile:r,pathSegments:c,sortedEntries:_,hasUnsavedChanges:J(()=>l.value?l.value.content!==l.value.originalContent:!1),fetchEntries:u,navigateTo:g,navigateUp:S,openEditor:d,saveEditor:p,closeEditor:f,openPreview:D,closePreview:T,createDir:v,createFile:W,deleteEntry:ot,renameEntry:rt,copyEntry:ut,uploadFiles:ct,setSort:dt}})})),ne,Ze,oe=w((()=>{M(),P(),U(),j(),Y(),ne={class:"file-tree"},Ze=B({__name:"FileTree",setup(i){const{t:s}=L(),t=z(),n=C([]),a=C([]);async function l(u){try{return(await We(u)).entries.filter(g=>g.isDir).sort((g,S)=>g.name.localeCompare(S.name)).map(g=>({key:g.path,label:g.name,isLeaf:!1}))}catch{return[]}}async function r(u){u.children=await l(u.key)}function c(u){u.length>0&&(a.value=u,t.navigateTo(u[0]))}function _(){a.value=[],t.navigateTo("")}return Ke(async()=>{n.value=await l("")}),(u,g)=>(b(),$("div",ne,[y("div",{class:"tree-header",onClick:_},[g[0]||(g[0]=y("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},[y("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),y("polyline",{points:"9 22 9 12 15 12 15 22"})],-1)),y("span",null,m(e(s)("files.breadcrumbRoot")),1)]),F(e(wt),{data:n.value,"selected-keys":a.value,"on-load":r,"expand-on-click":"","block-line":"","onUpdate:selectedKeys":c},null,8,["data","selected-keys"])]))}})})),qt=w((()=>{})),Kt,_a=w((()=>{oe(),oe(),qt(),K(),Kt=A(Ze,[["__scopeId","data-v-7f00b3bc"]])})),re,Qe,ue=w((()=>{M(),U(),P(),j(),re={class:"file-breadcrumb"},Qe=B({__name:"FileBreadcrumb",setup(i){const{t:s}=L(),t=z();function n(a){if(a<0)t.navigateTo("");else{const l=t.pathSegments.slice(0,a+1).join("/");t.navigateTo(l)}}return(a,l)=>(b(),$("div",re,[F(e(_t),null,{default:h(()=>[F(e(te),{onClick:l[0]||(l[0]=r=>n(-1))},{default:h(()=>[x(m(e(s)("files.breadcrumbRoot")),1)]),_:1}),(b(!0),$(qe,null,Ae(e(t).pathSegments,(r,c)=>(b(),N(e(te),{key:c,onClick:_=>n(c)},{default:h(()=>[x(m(r),1)]),_:2},1032,["onClick"]))),128))]),_:1})]))}})})),At=w((()=>{})),Vt,fa=w((()=>{ue(),ue(),At(),K(),Vt=A(Qe,[["__scopeId","data-v-061302de"]])})),ce,et,de=w((()=>{M(),P(),U(),j(),ce={class:"file-toolbar"},et=B({__name:"FileToolbar",emits:["showNewFile","showNewFolder","showUpload"],setup(i,{emit:s}){const{t}=L(),n=V(),a=z(),l=s;async function r(){try{await a.fetchEntries()}catch{n.error(t("files.backendError"))}}return(c,_)=>(b(),$("div",ce,[F(e(H),{size:8,wrap:!0,class:"toolbar-space"},{default:h(()=>[F(e(E),{size:"small",onClick:_[0]||(_[0]=u=>l("showNewFile")),class:"toolbar-btn"},{default:h(()=>[x(m(e(t)("files.newFile")),1)]),_:1}),F(e(E),{size:"small",onClick:_[1]||(_[1]=u=>l("showNewFolder")),class:"toolbar-btn"},{default:h(()=>[x(m(e(t)("files.newFolder")),1)]),_:1}),F(e(E),{size:"small",onClick:_[2]||(_[2]=u=>l("showUpload")),class:"toolbar-btn"},{default:h(()=>[x(m(e(t)("files.upload")),1)]),_:1}),F(e(E),{size:"small",onClick:r,class:"toolbar-btn"},{default:h(()=>[x(m(e(t)("files.refresh")),1)]),_:1})]),_:1})]))}})})),Jt=w((()=>{})),Xt,va=w((()=>{de(),de(),Jt(),K(),Xt=A(et,[["__scopeId","data-v-64269d74"]])})),pe,_e,fe,ve,me,he,we,ge,ye,Fe,ke,be,tt,Ce=w((()=>{M(),P(),U(),j(),Xe(),pe={class:"file-list"},_e={key:1,class:"file-list-items"},fe={class:"file-list-header"},ve={key:0,class:"sort-indicator"},me={key:0,class:"sort-indicator"},he={key:0,class:"sort-indicator"},we=["onDblclick","onContextmenu"],ge={class:"file-name"},ye={class:"file-icon"},Fe={class:"file-size"},ke={class:"file-date"},be={class:"file-actions"},tt=B({__name:"FileList",emits:["contextmenu-entry"],setup(i,{emit:s}){const{t}=L(),n=V(),a=z(),l=s;function r(d){if(d===0)return"—";const p=["B","KB","MB","GB"];let f=0,D=d;for(;D>=1024&&f<p.length-1;)D/=1024,f++;return`${D.toFixed(f===0?0:1)} ${p[f]}`}function c(d){return d?new Date(d).toLocaleString():"—"}function _(d){return d.isDir?"📁":{yaml:"⚙️",yml:"⚙️",json:"📋",toml:"⚙️",md:"📝",txt:"📄",log:"📄",py:"🐍",js:"📜",ts:"📜",vue:"💚",png:"🖼️",jpg:"🖼️",jpeg:"🖼️",gif:"🖼️",svg:"🖼️",webp:"🖼️",zip:"📦",gz:"📦",tar:"📦",sh:"⚡",bash:"⚡"}[d.name.split(".").pop()?.toLowerCase()||""]||"📄"}function u(d){d.isDir?a.navigateTo(d.path):G(d.name)?a.openEditor(d.path):(Q(d.name)||ee(d.name))&&a.openPreview(d)}function g(d,p){d.preventDefault(),l("contextmenu-entry",d,p)}async function S(d){try{await He(d.path,d.name)}catch(p){n.error(p.message||t("files.backendError"))}}return(d,p)=>(b(),$("div",pe,[F(e(gt),{show:e(a).loading},{default:h(()=>[!e(a).loading&&e(a).sortedEntries.length===0?(b(),N(e(pt),{key:0,description:e(t)("files.emptyDir")},null,8,["description"])):(b(),$("div",_e,[y("div",fe,[y("div",{class:"file-name sort-header",onClick:p[0]||(p[0]=f=>e(a).setSort("name"))},[x(m(e(t)("files.name"))+" ",1),e(a).sortBy==="name"?(b(),$("span",ve,m(e(a).sortOrder==="asc"?"↑":"↓"),1)):R("",!0)]),y("div",{class:"file-size sort-header",onClick:p[1]||(p[1]=f=>e(a).setSort("size"))},[x(m(e(t)("files.size"))+" ",1),e(a).sortBy==="size"?(b(),$("span",me,m(e(a).sortOrder==="asc"?"↑":"↓"),1)):R("",!0)]),y("div",{class:"file-date sort-header",onClick:p[2]||(p[2]=f=>e(a).setSort("modTime"))},[x(m(e(t)("files.modified"))+" ",1),e(a).sortBy==="modTime"?(b(),$("span",he,m(e(a).sortOrder==="asc"?"↑":"↓"),1)):R("",!0)]),p[3]||(p[3]=y("div",{class:"file-actions-placeholder"},null,-1))]),(b(!0),$(qe,null,Ae(e(a).sortedEntries,f=>(b(),$("div",{key:f.path,class:"file-list-row",onDblclick:D=>u(f),onContextmenu:D=>g(D,f)},[y("div",ge,[y("span",ye,m(_(f)),1),y("span",null,m(f.name),1)]),y("div",Fe,m(f.isDir?"—":r(f.size)),1),y("div",ke,m(c(f.modTime)),1),y("div",be,[e(G)(f.name)&&!f.isDir?(b(),N(e(E),{key:0,size:"tiny",quaternary:"",onClick:ae(D=>e(a).openEditor(f.path),["stop"]),title:e(t)("files.edit")},{default:h(()=>[...p[4]||(p[4]=[x("✏️",-1)])]),_:1},8,["onClick","title"])):R("",!0),f.isDir?R("",!0):(b(),N(e(E),{key:1,size:"tiny",quaternary:"",onClick:ae(D=>S(f),["stop"]),title:e(t)("files.download")},{default:h(()=>[...p[5]||(p[5]=[x("⬇️",-1)])]),_:1},8,["onClick","title"]))])],40,we))),128))]))]),_:1},8,["show"])]))}})})),Ht=w((()=>{})),Wt,ma=w((()=>{Ce(),Ce(),Ht(),K(),Wt=A(tt,[["__scopeId","data-v-ab2593c7"]])}));function Gt(i){return i.absolutePath||i.path}var Yt=w((()=>{})),at,xe=w((()=>{M(),P(),U(),j(),Xe(),Mt(),Yt(),at=B({__name:"FileContextMenu",emits:["rename"],setup(i,{expose:s,emit:t}){const{t:n}=L(),a=V(),l=Re(),r=z(),c=C(!1),_=C(0),u=C(0),g=C(null),S=t;function d(T,v){g.value=v,_.value=T.clientX,u.value=T.clientY,c.value=!1,Ft(()=>{c.value=!0})}function p(){const T=g.value;if(!T)return[];const v=[];return T.isDir?v.push({label:n("files.open"),key:"open"}):(G(T.name)&&v.push({label:n("files.edit"),key:"edit"}),(Q(T.name)||ee(T.name))&&v.push({label:n("files.preview"),key:"preview"}),v.push({label:n("files.download"),key:"download"})),v.push({type:"divider",key:"d1"}),v.push({label:n("files.copyPath"),key:"copyPath"}),v.push({label:n("files.rename"),key:"rename"}),v.push({type:"divider",key:"d2"}),v.push({label:n("files.delete"),key:"delete"}),v}async function f(T){c.value=!1;const v=g.value;if(v)switch(T){case"open":r.navigateTo(v.path);break;case"edit":try{await r.openEditor(v.path)}catch{a.error(n("files.backendError"))}break;case"preview":try{await r.openPreview(v)}catch{a.error(n("files.backendError"))}break;case"download":try{await He(v.path,v.name)}catch(W){a.error(W.message)}break;case"copyPath":await zt(Gt(v))?a.success(n("files.pathCopied")):a.error(n("files.pathCopied")+" ✗");break;case"rename":S("rename",v);break;case"delete":l.warning({title:n("files.delete"),content:v.isDir?n("files.confirmDeleteDir",{name:v.name}):n("files.confirmDelete",{name:v.name}),positiveText:n("common.delete"),negativeText:n("common.cancel"),onPositiveClick:async()=>{try{await r.deleteEntry(v),a.success(n("files.deleted"))}catch{a.error(n("files.deleteFailed"))}}});break}}function D(){c.value=!1}return s({show:d}),(T,v)=>(b(),N(e(bt),{show:c.value,x:_.value,y:u.value,options:p(),placement:"bottom-start",trigger:"manual",onSelect:f,onClickoutside:D},null,8,["show","x","y","options"]))}})})),Zt,ha=w((()=>{xe(),xe(),Zt=at})),Se,$e,Te,it,Ee=w((()=>{M(),P(),U(),j(),Dt(),Se={class:"file-editor"},$e={class:"editor-header"},Te={class:"editor-filename"},it=B({__name:"FileEditor",setup(i){self.MonacoEnvironment={getWorker(g,S){return new Worker(new URL("/assets/editor.worker-DtO216D1.js",""+import.meta.url),{type:"module"})}};const{t:s}=L(),t=V(),n=Re(),a=z(),l=C(null);let r=null;const c=C(!1);Ke(()=>{!l.value||!a.editingFile||(r=$t.create(l.value,{value:a.editingFile.content,language:a.editingFile.language,theme:document.documentElement.classList.contains("dark")?"vs-dark":"vs",minimap:{enabled:!1},fontSize:13,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"on"}),r.onDidChangeModelContent(()=>{a.editingFile&&(a.editingFile.content=r.getValue())}),r.addCommand(Et.CtrlCmd|Tt.KeyS,()=>{_()}))}),yt(()=>{r?.dispose(),r=null});async function _(){c.value=!0;try{await a.saveEditor(),t.success(s("files.saved"))}catch{t.error(s("files.saveFailed"))}finally{c.value=!1}}function u(){a.hasUnsavedChanges?n.warning({title:s("files.unsavedChanges"),positiveText:s("common.ok"),negativeText:s("common.cancel"),onPositiveClick:()=>{a.closeEditor()}}):a.closeEditor()}return(g,S)=>(b(),$("div",Se,[y("div",$e,[y("span",Te,m(e(a).editingFile?.path),1),F(e(H),null,{default:h(()=>[F(e(E),{size:"small",type:"primary",loading:c.value,onClick:_},{default:h(()=>[x(m(e(s)("files.saveFile")),1)]),_:1},8,["loading"]),F(e(E),{size:"small",onClick:u},{default:h(()=>[x(m(e(s)("files.closeEditor")),1)]),_:1})]),_:1})]),y("div",{ref_key:"editorContainer",ref:l,class:"editor-container"},null,512)]))}})})),Qt=w((()=>{})),ea,wa=w((()=>{Ee(),Ee(),Qt(),K(),ea=A(it,[["__scopeId","data-v-1ae26b53"]])})),De,Me,ze,Be,Pe,Ue,st,Le=w((()=>{M(),P(),U(),j(),Y(),Bt(),De={key:0,class:"file-preview"},Me={class:"preview-header"},ze={class:"preview-filename"},Be={class:"preview-content"},Pe=["src","alt"],Ue={key:1,class:"preview-markdown"},st=B({__name:"FilePreview",setup(i){const{t:s}=L(),t=z();function n(){return t.previewFile?Rt(t.previewFile.path):""}const a=()=>ie("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"currentColor"},[ie("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})]);return(l,r)=>e(t).previewFile?(b(),$("div",De,[y("div",Me,[y("span",ze,m(e(t).previewFile.path),1),F(e(E),{size:"small",quaternary:"",onClick:r[0]||(r[0]=c=>e(t).closePreview())},{icon:h(()=>[F(e(mt),null,{default:h(()=>[F(a)]),_:1})]),default:h(()=>[x(" "+m(e(s)("files.closePreview")),1)]),_:1})]),y("div",Be,[e(t).previewFile.type==="image"?(b(),$("img",{key:0,src:n(),class:"preview-image",alt:e(t).previewFile.path},null,8,Pe)):e(t).previewFile.type==="markdown"?(b(),$("div",Ue,[F(Pt,{content:e(t).previewFile.content||""},null,8,["content"])])):R("",!0)])])):R("",!0)}})})),ta=w((()=>{})),aa,ga=w((()=>{Le(),Le(),ta(),K(),aa=A(st,[["__scopeId","data-v-a9f9eb37"]])})),je,lt,Ie=w((()=>{M(),P(),U(),j(),je={class:"upload-dragger"},lt=B({__name:"FileUploadModal",props:{show:{type:Boolean}},emits:["update:show"],setup(i,{emit:s}){const{t}=L(),n=V(),a=z(),l=i,r=s,c=C(!1),_=C([]);function u(d){_.value=d.fileList.map(p=>p.file).filter(p=>p!=null)}async function g(){if(_.value.length!==0){c.value=!0;try{await a.uploadFiles(_.value),n.success(t("files.uploadSuccess",{count:_.value.length})),_.value=[],r("update:show",!1)}catch(d){n.error(d.message||t("files.uploadFailed"))}finally{c.value=!1}}}function S(){_.value=[],r("update:show",!1)}return(d,p)=>(b(),N(e(Ne),{show:l.show,preset:"dialog",title:e(t)("files.upload"),"onUpdate:show":S,style:{width:"500px"}},{action:h(()=>[F(e(H),null,{default:h(()=>[F(e(E),{onClick:S},{default:h(()=>[x(m(e(t)("common.cancel")),1)]),_:1}),F(e(E),{type:"primary",loading:c.value,disabled:_.value.length===0,onClick:g},{default:h(()=>[x(m(e(t)("files.upload"))+" ("+m(_.value.length)+") ",1)]),_:1},8,["loading","disabled"])]),_:1})]),default:h(()=>[F(e(kt),{multiple:"","directory-dnd":"","default-upload":!1,onChange:u},{default:h(()=>[y("div",je,[y("p",null,m(e(t)("files.dragDropHint")),1)])]),_:1})]),_:1},8,["show","title"]))}})})),ia=w((()=>{})),sa,ya=w((()=>{Ie(),Ie(),ia(),K(),sa=A(lt,[["__scopeId","data-v-e54e68b1"]])})),nt,Oe=w((()=>{M(),P(),U(),j(),nt=B({__name:"FileRenameModal",props:{show:{type:Boolean},mode:{},entry:{}},emits:["update:show"],setup(i,{emit:s}){const{t}=L(),n=V(),a=z(),l=i,r=s,c=C(""),_=C(!1);vt(()=>l.show,d=>{d&&(l.mode==="rename"&&l.entry?c.value=l.entry.name:c.value="")});const u=J(()=>{switch(l.mode){case"newFile":return t("files.newFile");case"newFolder":return t("files.newFolder");case"rename":return t("files.rename")}}),g=J(()=>{switch(l.mode){case"newFile":return t("files.newFileName");case"newFolder":return t("files.newFolderName");case"rename":return t("files.renameTo")}});async function S(){if(c.value.trim()){_.value=!0;try{switch(l.mode){case"newFile":await a.createFile(c.value.trim()),n.success(t("files.created"));break;case"newFolder":await a.createDir(c.value.trim()),n.success(t("files.created"));break;case"rename":l.entry&&(await a.renameEntry(l.entry,c.value.trim()),n.success(t("files.renamed")));break}r("update:show",!1)}catch(d){const p=l.mode==="rename"?t("files.renameFailed"):t("files.createFailed");n.error(d.message||p)}finally{_.value=!1}}}return(d,p)=>(b(),N(e(Ne),{show:l.show,preset:"dialog",title:u.value,"onUpdate:show":p[2]||(p[2]=f=>r("update:show",!1)),style:{width:"400px"}},{action:h(()=>[F(e(H),null,{default:h(()=>[F(e(E),{onClick:p[1]||(p[1]=f=>r("update:show",!1))},{default:h(()=>[x(m(e(t)("common.cancel")),1)]),_:1}),F(e(E),{type:"primary",loading:_.value,disabled:!c.value.trim(),onClick:S},{default:h(()=>[x(m(e(t)("common.ok")),1)]),_:1},8,["loading","disabled"])]),_:1})]),default:h(()=>[F(e(ft),{value:c.value,"onUpdate:value":p[0]||(p[0]=f=>c.value=f),placeholder:g.value,onKeydown:ht(S,["enter"]),autofocus:""},null,8,["value","placeholder"])]),_:1},8,["show","title"]))}})})),la,Fa=w((()=>{Oe(),Oe(),la=nt}));export{Kt as _,aa as a,z as b,wa as c,Wt as d,ma as f,fa as g,Vt as h,ya as i,Zt as l,va as m,Fa as n,ga as o,Xt as p,sa as r,ea as s,la as t,ha as u,_a as v,j as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as f}from"./rolldown-runtime-BKwlnUi0.js";import{Nt as a,Rt as F,U as k,_t as u,ct as N,ht as S,it as U,nt as d,st as l,tt as v}from"./ui-vendor-Do3bR-2m.js";import{n as b,t as B}from"./_plugin-vue_export-helper-
|
|
1
|
+
import{n as f}from"./rolldown-runtime-BKwlnUi0.js";import{Nt as a,Rt as F,U as k,_t as u,ct as N,ht as S,it as U,nt as d,st as l,tt as v}from"./ui-vendor-Do3bR-2m.js";import{n as b,t as B}from"./_plugin-vue_export-helper-DSvknO3W.js";import{_ as E,a as C,b as T,c as L,d as P,f as I,g as $,h as j,i as q,l as z,m as A,n as D,o as G,p as H,r as J,s as K,t as O,u as Q,v as W,y as X}from"./FileRenameModal-DGnmmJBS.js";var w,m,c,h,M,y=f((()=>{k(),X(),W(),$(),A(),I(),Q(),L(),G(),q(),D(),w={class:"files-view"},m={class:"files-tree-panel"},c={class:"files-main-panel"},h={class:"files-content"},M=N({__name:"FilesView",setup(le){const _=T(),p=a(null),r=a(!1),t=a(!1),i=a("newFile"),n=a(null);function x(s,e){p.value?.show(s,e)}function R(){i.value="newFile",n.value=null,t.value=!0}function V(){i.value="newFolder",n.value=null,t.value=!0}function g(s){i.value="rename",n.value=s,t.value=!0}return S(()=>{_.fetchEntries("")}),(s,e)=>(u(),U("div",w,[v("div",m,[l(E)]),v("div",c,[l(H,{onShowNewFile:R,onShowNewFolder:V,onShowUpload:e[0]||(e[0]=o=>r.value=!0)}),l(j),v("div",h,[F(_).editingFile?(u(),d(K,{key:0})):F(_).previewFile?(u(),d(C,{key:1})):(u(),d(P,{key:2,onContextmenuEntry:x}))])]),l(z,{ref_key:"contextMenuRef",ref:p,onRename:g},null,512),l(J,{show:r.value,"onUpdate:show":e[1]||(e[1]=o=>r.value=o)},null,8,["show"]),l(O,{show:t.value,"onUpdate:show":e[2]||(e[2]=o=>t.value=o),mode:i.value,entry:n.value},null,8,["show","mode","entry"])]))}})})),Y=f((()=>{})),Z,ee=f((()=>{y(),y(),Y(),b(),Z=B(M,[["__scopeId","data-v-4513759a"]])}));ee();export{Z as default};
|