mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-07-06 18:01:34 +02:00
a48b29837a
- Add pre-restart config preflight to RestartModal with pass/warning/fail result panel and "Restart Anyway" confirmation for warnings - Add Site Identification (site_name) config field shown as browser title and login page caption - Add GET /api/validate_config and GET /api/site_info backend endpoints - Sync document.title with site_name via system store watchEffect - Fix authRegression.test.ts TS2367 type narrowing error - add new radio hardware and radio settings tabs
1 line
29 KiB
JavaScript
1 line
29 KiB
JavaScript
import{Ct as e,E as t,R as n,S as r,V as i,Y as a,c as o,f as ee,g as s,i as c,j as l,k as u,l as d,m as f,nt as p,o as m,p as h,r as g,s as _,u as v,xt as y}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{a as b,i as x,s as S,u as C}from"./runtime-dom.esm-bundler-fKU3dih-.js";import{t as w}from"./api-3gMnsCKh.js";import{t as T}from"./Spinner-CcYauG9D.js";import{n as E}from"./index-DTUpsCzx.js";import{t as D}from"./ConfirmDialog-DBlDmP2I.js";import{t as O}from"./MessageDialog-bhwyqS5K.js";var k={role:`dialog`,"aria-describedby":`import-modal-description`,class:`bg-white dark:bg-surface-elevated backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6 max-w-lg w-full max-h-[90vh] overflow-y-auto`},A={id:`import-modal-description`,class:`text-content-secondary dark:text-content-muted text-sm mb-4`},j={class:`mb-4`},M={class:`flex items-center gap-2 mb-2`},N={key:0,class:`text-content-muted dark:text-content-muted text-xs mb-2`},P={key:1,class:`flex flex-wrap gap-3 ml-6`},F=[`value`],I={class:`text-content-primary dark:text-content-primary text-sm capitalize`},L={class:`border-t border-stroke-subtle dark:border-white/10 pt-4 mt-4 mb-4`},R={class:`flex flex-wrap gap-3 mb-2`},z=[`value`],B={class:`text-content-primary dark:text-content-primary text-sm`},V={class:`flex flex-wrap items-center gap-2 mt-2`},H={class:`flex items-center gap-2`},te={key:1,class:`text-content-muted dark:text-content-muted text-sm`},ne={class:`border-t border-stroke-subtle dark:border-white/10 pt-4 mt-4 mb-4`},re={class:`flex flex-wrap items-center gap-2`},ie={key:0,role:`alert`,class:`mb-4 p-3 rounded-lg bg-accent-red/10 dark:bg-accent-red/20 border border-accent-red/30 text-accent-red text-sm`},U={key:1,class:`text-content-muted dark:text-content-muted text-sm mb-4`},ae={class:`flex justify-end gap-3`},W=[`disabled`],G=[`disabled`],K=s({name:`ImportRepeaterContactsModal`,__name:`ImportRepeaterContactsModal`,props:{isOpen:{type:Boolean},companionName:{}},emits:[`close`,`imported`],setup(t,{emit:ee}){let s=[`companion`,`repeater`,`room_server`,`sensor`],f=[{label:`All time`,value:null},{label:`Last 24 hours`,value:24},{label:`Last 7 days`,value:168},{label:`Last 30 days`,value:720},{label:`Custom`,value:`custom`}].slice(0,4),y=t,T=ee,E=a(!1),D=a(null),O=a(!0),K=a([]),q=a(null),J=a(``),Y=a(``),X=a(null),oe=a(null);function Z(){let e=q.value;if(e===null||e===`custom`){if(e===`custom`){let e=J.value;if(e===``||e===null)return;let t=Number(e);return Number.isInteger(t)&&t>=1?t:void 0}return}return e}function Q(){let e=Y.value;if(e===``||e===null)return;let t=Number(e);return Number.isInteger(t)&&t>=1?t:void 0}function se(){O.value=!0,K.value=[],q.value=null,J.value=``,Y.value=``,D.value=null}n(()=>y.isOpen,e=>{e&&(se(),r(()=>{oe.value?.focus()}))}),n(q,e=>{e===`custom`&&r(()=>{X.value?.focus()})});let ce=m(()=>{let e=O.value?`All types`:K.value.map(e=>e.replace(`_`,` `)).join(`, `),t,n=q.value;if(n===null)t=`all time`;else if(n===`custom`){let e=Z();t=e===void 0?`custom`:`last ${e} hours`}else t=n===24?`last 24 hours`:n===168?`last 7 days`:n===720?`last 30 days`:`all time`;let r=Q(),i=r===void 0?`no limit`:`max ${r} contacts`;return`Import: ${e}, ${t}, ${i}.`});function le(){if(q.value===`custom`){let e=Z();if(e===void 0||e<1)return`Custom recency must be at least 1 hour.`}let e=Q();if(Y.value!==``&&(e===void 0||e<1))return`Limit must be at least 1.`;if(!O.value&&K.value.length===0)return`Select at least one contact type or use All types.`;if(!O.value){let e=K.value.filter(e=>!s.includes(e));if(e.length>0)return`Invalid contact type: ${e.join(`, `)}`}return null}async function ue(){D.value=null;let e=le();if(e){D.value=e;return}let t={companion_name:y.companionName};!O.value&&K.value.length>0&&(t.contact_types=[...K.value]);let n=Z();n!==void 0&&(t.hours=n);let r=Q();r!==void 0&&(t.limit=r),E.value=!0;try{let e=await w.importRepeaterContacts(t);e.success&&e.data?(T(`imported`,e.data.imported),T(`close`)):D.value=e.error||`Import failed.`}catch(e){D.value=e instanceof Error?e.message:`Import failed.`}finally{E.value=!1}}function de(e){e.key===`Escape`&&T(`close`)}return(n,r)=>(u(),o(c,{to:`body`},[t.isOpen?(u(),v(`div`,{key:0,class:`fixed inset-0 bg-black/50 backdrop-blur-lg flex items-center justify-center z-[350] p-4`,onClick:r[7]||=C(e=>T(`close`),[`self`]),onKeydown:de},[_(`div`,k,[r[18]||=_(`h2`,{class:`text-xl font-bold text-content-primary dark:text-content-primary mb-4`},` Import repeater contacts `,-1),_(`p`,A,[r[8]||=h(` Seed `,-1),_(`strong`,null,e(t.companionName),1),r[9]||=h(` with contacts from the repeater's adverts. Results are ordered by most recent first. `,-1)]),_(`div`,j,[r[11]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},` Contact types `,-1),_(`label`,M,[i(_(`input`,{ref_key:`firstFocusRef`,ref:oe,"onUpdate:modelValue":r[0]||=e=>O.value=e,type:`checkbox`,class:`rounded border-stroke-subtle dark:border-stroke/20 text-primary focus:ring-primary/50`},null,512),[[x,O.value]]),r[10]||=_(`span`,{class:`text-content-primary dark:text-content-primary text-sm`},`All types`,-1)]),O.value?(u(),v(`p`,N,` Uncheck to filter by type (repeater, companion, room server, sensor). `)):d(``,!0),O.value?d(``,!0):(u(),v(`div`,P,[(u(),v(g,null,l(s,t=>_(`label`,{key:t,class:`flex items-center gap-2`},[i(_(`input`,{"onUpdate:modelValue":r[1]||=e=>K.value=e,type:`checkbox`,value:t,class:`rounded border-stroke-subtle dark:border-stroke/20 text-primary focus:ring-primary/50`},null,8,F),[[x,K.value]]),_(`span`,I,e(t.replace(`_`,` `)),1)])),64))]))]),_(`div`,L,[r[13]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},` Recency `,-1),_(`div`,R,[(u(!0),v(g,null,l(p(f),t=>(u(),v(`label`,{key:t.label,class:`flex items-center gap-2`},[i(_(`input`,{"onUpdate:modelValue":r[2]||=e=>q.value=e,type:`radio`,value:t.value,class:`border-stroke-subtle dark:border-stroke/20 text-primary focus:ring-primary/50`},null,8,z),[[b,q.value]]),_(`span`,B,e(t.label),1)]))),128))]),_(`div`,V,[_(`label`,H,[i(_(`input`,{"onUpdate:modelValue":r[3]||=e=>q.value=e,type:`radio`,value:`custom`,class:`border-stroke-subtle dark:border-stroke/20 text-primary focus:ring-primary/50`},null,512),[[b,q.value]]),r[12]||=_(`span`,{class:`text-content-primary dark:text-content-primary text-sm`},`Custom:`,-1)]),q.value===`custom`?i((u(),v(`input`,{key:0,ref_key:`customHoursInputRef`,ref:X,"onUpdate:modelValue":r[4]||=e=>J.value=e,type:`number`,min:`1`,placeholder:`e.g. 48`,class:`w-24 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-3 py-1.5 text-content-primary dark:text-content-primary text-sm placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50`},null,512)),[[S,J.value,void 0,{number:!0}]]):d(``,!0),q.value===`custom`?(u(),v(`span`,te,`hours`)):d(``,!0)])]),_(`div`,ne,[r[16]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},` Max contacts (optional) `,-1),_(`div`,re,[r[14]||=_(`span`,{class:`text-content-muted dark:text-content-muted text-sm`},`Import at most`,-1),i(_(`input`,{"onUpdate:modelValue":r[5]||=e=>Y.value=e,type:`number`,inputmode:`numeric`,min:`1`,placeholder:`No limit`,class:`w-32 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-3 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50`},null,512),[[S,Y.value,void 0,{number:!0}]]),r[15]||=_(`span`,{class:`text-content-muted dark:text-content-muted text-sm`},`contacts`,-1)]),r[17]||=_(`p`,{class:`text-content-muted dark:text-content-muted text-xs mt-1`},` Leave empty for no cap. Server caps at companion max. `,-1)]),D.value?(u(),v(`div`,ie,e(D.value),1)):d(``,!0),D.value?d(``,!0):(u(),v(`p`,U,e(ce.value),1)),_(`div`,ae,[_(`button`,{type:`button`,disabled:E.value,class:`px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg transition-colors disabled:opacity-50`,onClick:r[6]||=e=>T(`close`)},` Cancel `,8,W),_(`button`,{type:`button`,disabled:E.value,class:`btn-primary`,onClick:ue},e(E.value?`Importing…`:`Import`),9,G)])])],32)):d(``,!0)]))}}),q={class:`p-6 space-y-6`},J={key:0,class:`grid grid-cols-1 md:grid-cols-3 gap-4`},Y={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5`},X={class:`flex items-center justify-between`},oe={class:`text-3xl font-bold text-content-primary dark:text-content-primary mb-1`},Z={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5`},Q={class:`flex items-center justify-between`},se={class:`text-3xl font-bold text-primary mb-1`},ce={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5`},le={class:`flex items-center justify-between`},ue={key:0,class:`w-6 h-6 text-accent-green`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},de={key:1,class:`w-6 h-6 text-accent-yellow`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},fe={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6`},pe={key:0,class:`flex items-center justify-center py-12`},me={class:`text-center`},he={key:1,class:`flex items-center justify-center py-12`},ge={class:`text-center`},_e={class:`text-content-secondary dark:text-content-muted text-sm mb-4`},ve={key:2,class:`space-y-4`},ye={class:`flex items-start justify-between`},be={class:`flex-1`},xe={class:`flex items-center gap-3 mb-4`},Se={class:`relative`},Ce={key:0,class:`absolute inset-0 bg-accent-green/50 rounded-full animate-ping`},we={class:`text-xl font-bold text-content-primary dark:text-content-primary`},Te={key:0,class:`text-content-muted dark:text-content-muted text-sm`},Ee={class:`grid grid-cols-1 md:grid-cols-2 gap-3 text-sm mb-3`},De={class:`text-content-primary dark:text-content-primary/90 ml-2`},Oe={class:`text-content-primary dark:text-content-primary/90 ml-2`},ke={class:`text-content-primary dark:text-content-primary/90 ml-2`},Ae={class:`flex items-center gap-2`},je={key:0,class:`text-content-primary dark:text-content-primary/90 font-mono ml-2 text-xs`},Me={key:1,class:`text-content-muted dark:text-content-muted ml-2 text-xs`},Ne=[`onClick`],Pe={class:`text-xs text-content-muted dark:text-content-muted`},Fe={key:0,class:`ml-2 font-mono text-content-primary dark:text-content-primary/90 break-all`},Ie={key:1,class:`ml-2 text-content-muted dark:text-content-muted`},Le={class:`ml-4 flex flex-wrap gap-2`},Re=[`onClick`],ze=[`onClick`],Be=[`onClick`],Ve={key:3,class:`text-center py-12 text-content-secondary dark:text-content-muted`},He={class:`bg-white dark:bg-surface-elevated backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6 max-w-2xl w-full max-h-[90vh] overflow-y-auto`},Ue={class:`space-y-4`},We={class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},Ge={key:0},Ke={key:1,class:`text-content-secondary dark:text-content-muted text-sm`},qe={class:`grid grid-cols-2 gap-4`},Je={class:`bg-white dark:bg-surface-elevated backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6 max-w-2xl w-full max-h-[90vh] overflow-y-auto`},Ye={class:`space-y-4`},Xe={class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},Ze={key:0},Qe={class:`grid grid-cols-2 gap-4`},$e=5050,et=1,tt=65535,nt=s({name:`CompanionsView`,__name:`Companions`,setup(n){let r=a(!1),s=a(null),p=a(null),b=a(!1),x=a(!1),k=a(!1),A=a(null),j=a(``),M=a(!1),N=a(!1),P=a(new Set),F=a(!1),I=a(``),L=a(!1),R=a(``),z=a(!1),B=a({message:``,variant:`success`}),V=a({name:``,identity_key:``,type:`companion`,settings:{node_name:``,tcp_port:5e3,bind_address:`0.0.0.0`}});t(async()=>{await H()});async function H(){r.value=!0,s.value=null;try{let e=await w.getIdentities();e.success?p.value=e.data:s.value=e.error||`Failed to load identities`}catch(e){s.value=e instanceof Error?e.message:`Failed to load identities`}finally{r.value=!1}}async function te(){try{let e=await w.createIdentity({...V.value,settings:{node_name:V.value.settings.node_name||V.value.name,tcp_port:V.value.settings.tcp_port??5e3,bind_address:V.value.settings.bind_address||`0.0.0.0`}});e.success?(b.value=!1,W(),await H(),U(e.message||`Companion created successfully!`,`success`)):U(`Failed to create companion: ${e.error}`,`error`)}catch(e){U(`Error creating companion: ${e}`,`error`)}}async function ne(){let e={name:j.value,identity_key:A.value.identity_key,type:`companion`,settings:{node_name:A.value.settings?.node_name,tcp_port:A.value.settings?.tcp_port,bind_address:A.value.settings?.bind_address}};A.value.name!==j.value&&(e.new_name=A.value.name);try{let t=await w.updateIdentity(e);t.success?(x.value=!1,A.value=null,await H(),k.value=!0):U(`Failed to update companion: ${t.error}`,`error`)}catch(e){U(`Error updating companion: ${e}`,`error`)}}function re(e){I.value=e,F.value=!0}async function ie(){let e=I.value;F.value=!1;try{let t=await w.deleteIdentity(e,`companion`);t.success?(await H(),U(t.message||`Companion deleted successfully!`,`success`)):U(`Failed to delete companion: ${t.error}`,`error`)}catch(e){U(`Error deleting companion: ${e}`,`error`)}finally{I.value=``}}function U(e,t){B.value={message:e,variant:t},z.value=!0}function ae(e){A.value=JSON.parse(JSON.stringify(e)),j.value=A.value.name,delete A.value.new_name,A.value.settings||(A.value.settings={node_name:``,tcp_port:5e3,bind_address:`0.0.0.0`}),N.value=!1,x.value=!0}function W(){V.value={name:``,identity_key:``,type:`companion`,settings:{node_name:``,tcp_port:5e3,bind_address:`0.0.0.0`}},M.value=!1}function G(){b.value=!1,x.value=!1,A.value=null,M.value=!1,N.value=!1,W()}function nt(e){P.value.has(e)?P.value.delete(e):P.value.add(e)}let rt=()=>p.value?.configured_companions??[],it=m(()=>p.value?.configured_companions?.length??0),at=m(()=>p.value?.configured_companions?.filter(e=>e.registered).length??0),$=m(()=>at.value===it.value);function ot(){let e=rt();if(e.length===0)return $e;let t=e.map(e=>e.settings?.tcp_port??5e3),n=Math.max(...t)+1;return Math.min(tt,Math.max(et,n))}function st(){W(),V.value.settings.tcp_port=ot(),b.value=!0}function ct(e){R.value=e,L.value=!0}function lt(){L.value=!1,R.value=``}function ut(e){U(`Imported ${e} contact${e===1?``:`s`}.`,`success`),lt()}return(t,n)=>(u(),v(g,null,[_(`div`,q,[_(`div`,{class:`relative overflow-hidden rounded-[20px] p-6 mb-6 glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10`},[n[18]||=_(`div`,{class:`absolute inset-0 bg-gradient-to-br from-primary/20 via-secondary/10 to-accent-purple/20 opacity-50`},null,-1),n[19]||=_(`div`,{class:`absolute inset-0 bg-gradient-to-tl from-accent-green/10 via-transparent to-primary/10 animate-pulse`},null,-1),_(`div`,{class:`relative flex items-center justify-between`},[n[17]||=ee(`<div class="flex items-center gap-4"><div class="relative"><div class="absolute inset-0 bg-primary/30 blur-xl rounded-full"></div><div class="relative bg-primary/20 p-4 rounded-[15px] border border-primary/30"><svg class="w-8 h-8 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"></path></svg></div></div><div><h1 class="text-3xl font-bold text-content-primary dark:text-content-primary mb-1"> Companions </h1><p class="text-content-secondary dark:text-content-muted text-sm"> Manage companion identities (TCP frame server) </p></div></div>`,1),_(`button`,{onClick:st,class:`group relative px-6 py-3 bg-gradient-to-r from-primary/30 to-secondary/30 hover:from-primary/40 hover:to-secondary/40 text-content-primary dark:text-content-primary rounded-[12px] border border-primary/50 transition-all hover:scale-105 hover:shadow-lg hover:shadow-primary/20`},[...n[16]||=[_(`span`,{class:`flex items-center gap-2`},[_(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[_(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 4v16m8-8H4`})]),h(` Add Companion `)],-1)]])])]),p.value&&it.value>0?(u(),v(`div`,J,[_(`div`,Y,[_(`div`,X,[_(`div`,null,[n[20]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide`},` Total Configured `,-1),_(`div`,oe,e(it.value),1)]),n[21]||=_(`div`,{class:`bg-background-mute dark:bg-white/10 p-3 rounded-[12px]`},[_(`svg`,{class:`w-6 h-6 text-content-secondary dark:text-content-primary/70`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[_(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z`})])],-1)])]),_(`div`,Z,[_(`div`,Q,[_(`div`,null,[n[22]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide`},` Currently Registered `,-1),_(`div`,se,e(at.value),1)]),n[23]||=_(`div`,{class:`bg-primary/20 p-3 rounded-[12px]`},[_(`svg`,{class:`w-6 h-6 text-primary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[_(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 13l4 4L19 7`})])],-1)])]),_(`div`,ce,[_(`div`,le,[_(`div`,null,[n[24]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide`},` Status `,-1),_(`div`,{class:y([`text-3xl font-bold`,$.value?`text-accent-green`:`text-accent-yellow`])},e($.value?`Synced`:`Out of Sync`),3)]),_(`div`,{class:y([`p-3 rounded-[12px]`,$.value?`bg-accent-green/20`:`bg-accent-yellow/20`])},[$.value?(u(),v(`svg`,ue,[...n[25]||=[_(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z`},null,-1)]])):(u(),v(`svg`,de,[...n[26]||=[_(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`},null,-1)]]))],2)])])])):d(``,!0),_(`div`,fe,[r.value?(u(),v(`div`,pe,[_(`div`,me,[f(T,{class:`mx-auto mb-4`}),n[27]||=_(`div`,{class:`text-content-secondary dark:text-content-primary/70`},` Loading companions... `,-1)])])):s.value?(u(),v(`div`,he,[_(`div`,ge,[n[28]||=_(`div`,{class:`text-red-600 dark:text-red-400 mb-2`},`Failed to load companions`,-1),_(`div`,_e,e(s.value),1),_(`button`,{onClick:H,class:`btn-primary`},` Retry `)])])):p.value&&rt().length>0?(u(),v(`div`,ve,[(u(!0),v(g,null,l(rt(),t=>(u(),v(`div`,{key:t.name,class:`glass-card backdrop-blur-xl rounded-[15px] p-5 border border-stroke-subtle dark:border-white/10`},[_(`div`,ye,[_(`div`,be,[_(`div`,xe,[_(`div`,Se,[t.registered?(u(),v(`div`,Ce)):d(``,!0),_(`div`,{class:y([`relative w-3 h-3 rounded-full`,t.registered?`bg-accent-green`:`bg-accent-red`])},null,2)]),_(`h3`,we,e(t.name),1),_(`span`,{class:y([`px-3 py-1 text-xs font-semibold rounded-full`,t.registered?`bg-accent-green/20 text-accent-green border border-accent-green/30`:`bg-accent-red/20 text-accent-red border border-accent-red/30`])},e(t.registered?`● Active`:`○ Inactive`),3),t.hash?(u(),v(`span`,Te,e(t.hash),1)):d(``,!0)]),_(`div`,Ee,[_(`div`,null,[n[29]||=_(`span`,{class:`text-content-muted dark:text-content-muted`},`Node Name:`,-1),_(`span`,De,e(t.settings?.node_name||t.name),1)]),_(`div`,null,[n[30]||=_(`span`,{class:`text-content-muted dark:text-content-muted`},`TCP Port:`,-1),_(`span`,Oe,e(t.settings?.tcp_port??5e3),1)]),_(`div`,null,[n[31]||=_(`span`,{class:`text-content-muted dark:text-content-muted`},`Bind Address:`,-1),_(`span`,ke,e(t.settings?.bind_address||`0.0.0.0`),1)]),_(`div`,Ae,[n[32]||=_(`span`,{class:`text-content-muted dark:text-content-muted`},`Identity Key:`,-1),P.value.has(t.name)?(u(),v(`span`,je,e(t.identity_key),1)):(u(),v(`span`,Me,`••••••••••••••••`)),_(`button`,{onClick:e=>nt(t.name),class:`text-primary/70 hover:text-primary text-xs underline`},e(P.value.has(t.name)?`Hide`:`Show`),9,Ne)])]),_(`div`,Pe,[n[33]||=_(`span`,{class:`text-content-muted dark:text-content-muted`},`Public Key:`,-1),t.public_key?(u(),v(`span`,Fe,e(t.public_key),1)):(u(),v(`span`,Ie,`—`))])]),_(`div`,Le,[_(`button`,{onClick:e=>ct(t.name),class:`btn-primary-xs`},` Import contacts `,8,Re),_(`button`,{onClick:e=>ae(t),class:`btn-primary-xs`},` Edit `,8,ze),_(`button`,{onClick:e=>re(t.name),class:`btn-danger-xs`},` Delete `,8,Be)])])]))),128))])):(u(),v(`div`,Ve,[n[34]||=_(`svg`,{class:`w-16 h-16 mx-auto mb-4 text-content-muted dark:text-content-muted/60`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[_(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z`})],-1),n[35]||=_(`p`,{class:`text-lg mb-2`},`No companions configured`,-1),n[36]||=_(`p`,{class:`text-sm mb-4`},` Add a companion to run a TCP frame server for firmware or other clients `,-1),_(`button`,{onClick:st,class:`btn-primary`},` + Add Companion `)]))]),(u(),o(c,{to:`body`},[b.value?(u(),v(`div`,{key:0,class:`fixed inset-0 bg-black/50 backdrop-blur-lg flex items-center justify-center z-[300] p-4`,onClick:n[6]||=C(e=>b.value=!1,[`self`])},[_(`div`,He,[n[43]||=_(`h2`,{class:`text-xl font-bold text-content-primary dark:text-content-primary mb-4`},` Add Companion `,-1),_(`div`,Ue,[_(`div`,null,[n[37]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`Name *`,-1),i(_(`input`,{"onUpdate:modelValue":n[0]||=e=>V.value.name=e,type:`text`,placeholder:`e.g., TestCompanion`,class:`w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors`},null,512),[[S,V.value.name]])]),_(`div`,null,[_(`label`,We,[n[38]||=h(` Identity Key (Optional) `,-1),_(`button`,{onClick:n[1]||=e=>M.value=!M.value,type:`button`,class:`ml-2 text-primary/70 hover:text-primary text-xs underline`},e(M.value?`Hide`:`Show/Edit`),1)]),M.value?(u(),v(`div`,Ge,[i(_(`input`,{"onUpdate:modelValue":n[2]||=e=>V.value.identity_key=e,type:`text`,placeholder:`Leave empty to auto-generate (32 bytes hex)`,class:`w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary font-mono text-sm placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors`},null,512),[[S,V.value.identity_key]]),n[39]||=_(`p`,{class:`text-content-secondary dark:text-content-muted text-xs mt-1`},` 32 or 64 bytes hex. Leave empty to auto-generate. `,-1)])):(u(),v(`div`,Ke,` Will be auto-generated if not provided `))]),_(`div`,null,[n[40]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`Node Name`,-1),i(_(`input`,{"onUpdate:modelValue":n[3]||=e=>V.value.settings.node_name=e,type:`text`,placeholder:`Display name (defaults to Name)`,class:`w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors`},null,512),[[S,V.value.settings.node_name]])]),_(`div`,qe,[_(`div`,null,[n[41]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`TCP Port`,-1),i(_(`input`,{"onUpdate:modelValue":n[4]||=e=>V.value.settings.tcp_port=e,type:`number`,min:`1`,max:`65535`,class:`w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-primary/50 transition-colors`},null,512),[[S,V.value.settings.tcp_port,void 0,{number:!0}]])]),_(`div`,null,[n[42]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`Bind Address`,-1),i(_(`input`,{"onUpdate:modelValue":n[5]||=e=>V.value.settings.bind_address=e,type:`text`,placeholder:`0.0.0.0`,class:`w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors`},null,512),[[S,V.value.settings.bind_address]])])])]),_(`div`,{class:`flex justify-end gap-3 mt-6`},[_(`button`,{onClick:G,class:`px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg transition-colors`},` Cancel `),_(`button`,{onClick:te,class:`btn-primary`},` Create `)])])])):d(``,!0)])),(u(),o(c,{to:`body`},[x.value&&A.value?(u(),v(`div`,{key:0,class:`fixed inset-0 bg-black/50 backdrop-blur-lg flex items-center justify-center z-[300] p-4`,onClick:C(G,[`self`])},[_(`div`,Je,[n[49]||=_(`h2`,{class:`text-xl font-bold text-content-primary dark:text-content-primary mb-4`},` Edit Companion `,-1),_(`div`,Ye,[_(`div`,null,[n[44]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`Name *`,-1),i(_(`input`,{"onUpdate:modelValue":n[7]||=e=>A.value.name=e,type:`text`,class:`w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-primary/50 transition-colors`},null,512),[[S,A.value.name]])]),_(`div`,null,[_(`label`,Xe,[n[45]||=h(` Identity Key (Optional) `,-1),_(`button`,{onClick:n[8]||=e=>N.value=!N.value,type:`button`,class:`ml-2 text-primary/70 hover:text-primary text-xs underline`},e(N.value?`Hide`:`Show/Edit`),1)]),N.value?(u(),v(`div`,Ze,[i(_(`input`,{"onUpdate:modelValue":n[9]||=e=>A.value.identity_key=e,type:`text`,placeholder:`Leave empty to keep current key`,class:`w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary font-mono text-sm placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors`},null,512),[[S,A.value.identity_key]])])):d(``,!0)]),_(`div`,null,[n[46]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`Node Name`,-1),i(_(`input`,{"onUpdate:modelValue":n[10]||=e=>A.value.settings.node_name=e,type:`text`,class:`w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-primary/50 transition-colors`},null,512),[[S,A.value.settings.node_name]])]),_(`div`,Qe,[_(`div`,null,[n[47]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`TCP Port`,-1),i(_(`input`,{"onUpdate:modelValue":n[11]||=e=>A.value.settings.tcp_port=e,type:`number`,min:`1`,max:`65535`,class:`w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-primary/50 transition-colors`},null,512),[[S,A.value.settings.tcp_port,void 0,{number:!0}]])]),_(`div`,null,[n[48]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`Bind Address`,-1),i(_(`input`,{"onUpdate:modelValue":n[12]||=e=>A.value.settings.bind_address=e,type:`text`,class:`w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-primary/50 transition-colors`},null,512),[[S,A.value.settings.bind_address]])])])]),_(`div`,{class:`flex justify-end gap-3 mt-6`},[_(`button`,{onClick:G,class:`px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg transition-colors`},` Cancel `),_(`button`,{onClick:ne,class:`btn-primary`},` Update `)])])])):d(``,!0)]))]),f(K,{"is-open":L.value,"companion-name":R.value,onClose:lt,onImported:ut},null,8,[`is-open`,`companion-name`]),f(D,{show:F.value,title:`Delete Companion`,message:`Are you sure you want to delete '${I.value}'? Restart required to fully remove.`,"confirm-text":`Delete`,"cancel-text":`Cancel`,variant:`danger`,onClose:n[13]||=e=>F.value=!1,onConfirm:ie},null,8,[`show`,`message`]),f(O,{show:z.value,message:B.value.message,variant:B.value.variant,onClose:n[14]||=e=>z.value=!1},null,8,[`show`,`message`,`variant`]),f(E,{modelValue:k.value,"onUpdate:modelValue":n[15]||=e=>k.value=e,message:`Companion settings have been saved. A service restart is required for the changes to take effect.`},null,8,[`modelValue`])],64))}});export{nt as default}; |