mirror of
https://github.com/rightup/pyMC_Repeater.git
synced 2026-05-02 03:32:15 +02:00
2 lines
225 KiB
JavaScript
2 lines
225 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/leaflet-src-PYB8oVmQ.js","assets/chunk-DECur_0Z.js"])))=>i.map(i=>d[i]);
|
||
import{r as e}from"./chunk-DECur_0Z.js";import{A as t,C as n,D as r,E as i,K as a,R as o,S as s,b as c,c as l,dt as u,f as d,g as f,i as p,j as m,k as h,l as g,m as _,o as v,p as y,pt as b,r as x,s as S,u as C,w,x as T,z as E}from"./runtime-core.esm-bundler-HnidnMFy.js";import{o as D}from"./vue-router-Cr0wB7EX.js";import{a as O,n as k,t as A}from"./api-CbM6k1ZB.js";import{t as j}from"./system-BH4r-ii6.js";import{t as M}from"./_plugin-vue_export-helper-B7aGp3iI.js";import{c as N,d as P,f as F,h as I,l as L,m as R,p as z,u as B}from"./index-BFltqMtv.js";import{t as V}from"./ConfirmDialog-PLW-eI8u.js";/* empty css */import{n as ee,t as H}from"./preferences-Bv8i60GL.js";var U={class:`space-y-4`},W={key:0,class:`bg-green-100 dark:bg-green-500/20 border border-green-500/50 rounded-lg p-3`},G={class:`text-green-600 dark:text-green-400 text-sm`},te={key:1,class:`bg-red-100 dark:bg-red-500/20 border border-red-500/50 rounded-lg p-3`},K={class:`text-red-600 dark:text-red-400 text-sm`},ne={class:`flex justify-end gap-2`},q=[`disabled`],J=[`disabled`],Y={class:`bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3`},X={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},Z={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Q={key:1,class:`flex items-center gap-2`},re={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},$={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},ie={key:1},ae=[`value`],oe={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},se={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},ce={key:1},le=[`value`],ue={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},de={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},fe={key:1,class:`flex items-center gap-2`},pe={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},me={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},he={key:1},ge={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1`},_e={class:`text-content-primary dark:text-content-primary font-mono text-sm`},ve={key:2,class:`bg-yellow-500/10 dark:bg-yellow-500/10 border border-yellow-500/30 rounded-lg p-3`},ye=f({__name:`RadioSettings`,setup(e){let t=j(),n=v(()=>t.stats?.config?.radio||{}),r=E(!1),a=E(!1),o=E(null),s=E(null),c=E(0),l=E(0),u=E(0),d=E(0),f=E(0),p=E(0),_=[{value:7.8,label:`7.8 kHz`},{value:10.4,label:`10.4 kHz`},{value:15.6,label:`15.6 kHz`},{value:20.8,label:`20.8 kHz`},{value:31.25,label:`31.25 kHz`},{value:41.7,label:`41.7 kHz`},{value:62.5,label:`62.5 kHz`},{value:125,label:`125 kHz`},{value:250,label:`250 kHz`},{value:500,label:`500 kHz`}];h(n,e=>{e&&!r.value&&(c.value=e.frequency?Number((e.frequency/1e6).toFixed(3)):0,l.value=e.spreading_factor??0,u.value=e.bandwidth?Number((e.bandwidth/1e3).toFixed(1)):0,d.value=e.tx_power??0,f.value=e.coding_rate??0,p.value=e.preamble_length??0)},{immediate:!0});let T=v(()=>{let e=n.value.frequency;return e?(e/1e6).toFixed(3)+` MHz`:`Not set`}),D=v(()=>{let e=n.value.bandwidth;return e?(e/1e3).toFixed(1)+` kHz`:`Not set`}),O=v(()=>{let e=n.value.tx_power;return e===void 0?`Not set`:e+` dBm`}),k=v(()=>{let e=n.value.coding_rate;return e?`4/`+e:`Not set`}),M=v(()=>{let e=n.value.preamble_length;return e?e+` symbols`:`Not set`}),N=v(()=>n.value.spreading_factor??`Not set`),I=()=>{r.value=!0,o.value=null,s.value=null},L=()=>{r.value=!1,o.value=null;let e=n.value;c.value=e.frequency?Number((e.frequency/1e6).toFixed(3)):0,l.value=e.spreading_factor??0,u.value=e.bandwidth?Number((e.bandwidth/1e3).toFixed(1)):0,d.value=e.tx_power??0,f.value=e.coding_rate??0,p.value=e.preamble_length??0},R=async()=>{a.value=!0,o.value=null,s.value=null;try{let e={};c.value&&(e.frequency=c.value*1e6),l.value&&(e.spreading_factor=l.value),u.value&&(e.bandwidth=u.value*1e3),d.value&&(e.tx_power=d.value),f.value&&(e.coding_rate=f.value);let n=(await A.post(`/update_radio_config`,e)).data;n.message||n.persisted?(s.value=n.message||`Settings saved successfully`,r.value=!1,await t.fetchStats(),setTimeout(()=>{s.value=null},3e3)):n.error?o.value=n.error:o.value=`Unknown response from server`}catch(e){console.error(`Failed to update radio settings:`,e),o.value=e.response?.data?.error||`Failed to update settings`}finally{a.value=!1}};return(e,t)=>(w(),C(`div`,U,[s.value?(w(),C(`div`,W,[S(`p`,G,b(s.value),1)])):g(``,!0),o.value?(w(),C(`div`,te,[S(`p`,K,b(o.value),1)])):g(``,!0),S(`div`,ne,[r.value?(w(),C(x,{key:1},[S(`button`,{onClick:L,disabled:a.value,class:`px-3 sm: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 border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed`},` Cancel `,8,q),S(`button`,{onClick:R,disabled:a.value,class:`px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed`},b(a.value?`Saving...`:`Save Changes`),9,J)],64)):(w(),C(`button`,{key:0,onClick:I,class:`px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm`},` Edit Settings `))]),S(`div`,Y,[S(`div`,X,[t[6]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Frequency`,-1),r.value?(w(),C(`div`,Q,[m(S(`input`,{"onUpdate:modelValue":t[0]||=e=>c.value=e,type:`number`,step:`0.001`,min:`100`,max:`1000`,class:`w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},null,512),[[F,c.value,void 0,{number:!0}]]),t[5]||=S(`span`,{class:`text-content-muted dark:text-content-muted text-sm`},`MHz`,-1)])):(w(),C(`div`,Z,b(T.value),1))]),S(`div`,re,[t[7]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Spreading Factor`,-1),r.value?(w(),C(`div`,ie,[m(S(`select`,{"onUpdate:modelValue":t[1]||=e=>l.value=e,class:`px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},[(w(),C(x,null,i([5,6,7,8,9,10,11,12],e=>S(`option`,{key:e,value:e},b(e),9,ae)),64))],512),[[P,l.value,void 0,{number:!0}]])])):(w(),C(`div`,$,b(N.value),1))]),S(`div`,oe,[t[8]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Bandwidth`,-1),r.value?(w(),C(`div`,ce,[m(S(`select`,{"onUpdate:modelValue":t[2]||=e=>u.value=e,class:`px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},[(w(),C(x,null,i(_,e=>S(`option`,{key:e.value,value:e.value},b(e.label),9,le)),64))],512),[[P,u.value,void 0,{number:!0}]])])):(w(),C(`div`,se,b(D.value),1))]),S(`div`,ue,[t[10]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`TX Power`,-1),r.value?(w(),C(`div`,fe,[m(S(`input`,{"onUpdate:modelValue":t[3]||=e=>d.value=e,type:`number`,min:`2`,max:`30`,class:`w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},null,512),[[F,d.value,void 0,{number:!0}]]),t[9]||=S(`span`,{class:`text-content-muted dark:text-content-muted text-sm`},`dBm`,-1)])):(w(),C(`div`,de,b(O.value),1))]),S(`div`,pe,[t[12]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Coding Rate`,-1),r.value?(w(),C(`div`,he,[m(S(`select`,{"onUpdate:modelValue":t[4]||=e=>f.value=e,class:`px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},[...t[11]||=[S(`option`,{value:5},`4/5`,-1),S(`option`,{value:6},`4/6`,-1),S(`option`,{value:7},`4/7`,-1),S(`option`,{value:8},`4/8`,-1)]],512),[[P,f.value,void 0,{number:!0}]])])):(w(),C(`div`,me,b(k.value),1))]),S(`div`,ge,[t[13]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Preamble Length`,-1),S(`span`,_e,b(M.value),1)])]),r.value?(w(),C(`div`,ve,[...t[14]||=[S(`p`,{class:`text-yellow-700 dark:text-yellow-400 text-xs`},[S(`strong`,null,`Note:`),y(` Radio hardware changes (frequency, bandwidth, spreading factor, coding rate) may require a service restart to apply. `)],-1)]])):g(``,!0)]))}}),be={class:`glass-card border border-stroke-subtle dark:border-white/20 rounded-[15px] w-full max-w-3xl max-h-[90vh] flex flex-col shadow-2xl`},xe={class:`flex-1 relative min-h-[400px]`},Se={class:`p-6 border-t border-stroke-subtle dark:border-stroke/10 space-y-4`},Ce={class:`grid grid-cols-2 gap-4`},we=M(f({__name:`LocationPicker`,props:{isOpen:{type:Boolean},latitude:{},longitude:{}},emits:[`close`,`select`],setup(t,{emit:r}){let i=t,a=r,o=E(null),s=E(i.latitude||0),l=E(i.longitude||0),u=null,d=null,f=async()=>{if(o.value){p();try{let t=(await O(async()=>{let{default:t}=await import(`./leaflet-src-PYB8oVmQ.js`).then(t=>e(t.t(),1));return{default:t}},__vite__mapDeps([0,1]))).default;delete t.Icon.Default.prototype._getIconUrl,t.Icon.Default.mergeOptions({iconRetinaUrl:`https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png`,iconUrl:`https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png`,shadowUrl:`https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png`}),await c();let n=s.value||0,r=l.value||0,i=n===0&&r===0?2:13;u=t.map(o.value).setView([n,r],i);try{let e=t.tileLayer(`https://{s}.basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}{r}.png`,{maxZoom:19,attribution:`© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors © <a href="https://carto.com/attributions">CARTO</a>`,errorTileUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==`}),n=t.tileLayer(`https://{s}.basemaps.cartocdn.com/dark_only_labels/{z}/{x}/{y}{r}.png`,{maxZoom:19,attribution:``,errorTileUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==`});e.addTo(u),n.addTo(u)}catch(e){console.warn(`Error loading tiles:`,e)}(n!==0||r!==0)&&(d=t.marker([n,r]).addTo(u)),u.on(`click`,e=>{s.value=e.latlng.lat,l.value=e.latlng.lng,d?d.setLatLng(e.latlng):d=t.marker(e.latlng).addTo(u)}),setTimeout(()=>{u?.invalidateSize()},200)}catch(e){console.error(`Failed to initialize map:`,e)}}},p=()=>{u&&(u.remove(),u=null,d=null)};h(()=>i.isOpen,async e=>{e?(await c(),await f()):p()}),h(()=>[i.latitude,i.longitude],([e,t])=>{s.value=e,l.value=t});let _=()=>{a(`select`,{latitude:s.value,longitude:l.value}),a(`close`)},v=()=>{a(`close`)},b=()=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(async t=>{if(s.value=t.coords.latitude,l.value=t.coords.longitude,u){u.setView([s.value,l.value],13);let t=(await O(async()=>{let{default:t}=await import(`./leaflet-src-PYB8oVmQ.js`).then(t=>e(t.t(),1));return{default:t}},__vite__mapDeps([0,1]))).default;d?d.setLatLng([s.value,l.value]):d=t.marker([s.value,l.value]).addTo(u)}},e=>{console.error(`Error getting location:`,e),alert(`Unable to get current location. Please check browser permissions.`)}):alert(`Geolocation is not supported by this browser.`)};return n(()=>{p()}),(e,n)=>t.isOpen?(w(),C(`div`,{key:0,class:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm`,onClick:I(v,[`self`])},[S(`div`,be,[S(`div`,{class:`flex items-center justify-between p-6 border-b border-stroke-subtle dark:border-stroke/10`},[n[3]||=S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Select Location `,-1),S(`button`,{onClick:v,class:`text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors`},[...n[2]||=[S(`svg`,{class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),S(`div`,xe,[S(`div`,{ref_key:`mapContainer`,ref:o,class:`absolute inset-0 rounded-b-[15px] overflow-hidden`},null,512)]),S(`div`,Se,[S(`div`,Ce,[S(`div`,null,[n[4]||=S(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-muted mb-2`},`Latitude`,-1),m(S(`input`,{"onUpdate:modelValue":n[0]||=e=>s.value=e,type:`number`,step:`0.000001`,class:`w-full px-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary focus:outline-none focus:border-primary`,readonly:``},null,512),[[F,s.value,void 0,{number:!0}]])]),S(`div`,null,[n[5]||=S(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-muted mb-2`},`Longitude`,-1),m(S(`input`,{"onUpdate:modelValue":n[1]||=e=>l.value=e,type:`number`,step:`0.000001`,class:`w-full px-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary focus:outline-none focus:border-primary`,readonly:``},null,512),[[F,l.value,void 0,{number:!0}]])])]),S(`div`,{class:`flex gap-3`},[S(`button`,{onClick:b,class:`flex-1 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 border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm flex items-center justify-center gap-2`},[...n[6]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z`}),S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 11a3 3 0 11-6 0 3 3 0 016 0z`})],-1),y(` Use Current Location `,-1)]]),S(`button`,{onClick:v,class:`px-6 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 border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm`},` Cancel `),S(`button`,{onClick:_,class:`px-6 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm`},` Select Location `)]),n[7]||=S(`p`,{class:`text-content-muted dark:text-content-muted text-xs text-center`},` Click on the map to select a location `,-1)])])])):g(``,!0)}}),[[`__scopeId`,`data-v-fd94857e`]]),Te={class:`space-y-4`},Ee={key:0,class:`bg-green-100 dark:bg-green-500/10 border border-green-300 dark:border-green-500/30 rounded-lg p-3`},De={class:`text-green-700 dark:text-green-400 text-sm`},Oe={key:1,class:`bg-red-100 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 rounded-lg p-3`},ke={class:`text-red-700 dark:text-red-400 text-sm`},Ae={class:`flex justify-end gap-2`},je=[`disabled`],Me=[`disabled`],Ne={class:`bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3`},Pe={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},Fe={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm break-all`},Ie={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},Le={class:`text-content-primary dark:text-content-primary font-mono text-xs break-all`},Re={class:`flex flex-col sm:flex-row sm:justify-between sm:items-start py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},ze={class:`flex flex-col items-end gap-1`},Be={class:`text-content-primary dark:text-content-primary font-mono text-xs break-all sm:text-right sm:max-w-xs`},Ve={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},He={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Ue={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},We={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Ge={key:0,class:`flex justify-end`},Ke={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},qe={class:`text-content-primary dark:text-content-primary font-mono text-sm`},Je={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},Ye={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Xe={class:`flex flex-col py-2 gap-2`},Ze={class:`flex flex-col sm:flex-row sm:justify-between sm:items-start gap-1`},Qe={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm sm:ml-4`},$e={key:1,class:`flex items-center gap-2`},et={class:`bg-surface dark:bg-surface-elevated border border-stroke-subtle dark:border-stroke/20 rounded-[15px] shadow-2xl w-full max-w-md p-6 space-y-4`},tt={class:`block text-sm font-medium text-content-secondary dark:text-content-muted mb-2`},nt=[`maxlength`,`disabled`],rt={key:0,class:`text-red-500 text-xs mt-1`},it={key:1,class:`text-content-muted dark:text-content-muted text-xs mt-1`},at=[`disabled`],ot={key:0,class:`mt-2 bg-amber-500/10 border border-amber-500/30 rounded-lg p-3`},st={key:0,class:`flex items-center gap-3 bg-blue-500/10 border border-blue-500/30 rounded-lg p-3`},ct={class:`text-blue-700 dark:text-blue-400 text-xs font-medium`},lt={class:`text-blue-600 dark:text-blue-500 text-xs mt-0.5`},ut={key:1,class:`bg-red-500/10 border border-red-500/30 rounded-lg p-3`},dt={class:`text-red-600 dark:text-red-400 text-sm`},ft={key:2,class:`bg-green-500/10 border border-green-600/40 dark:border-green-500/30 rounded-lg p-3 space-y-2`},pt={class:`text-green-600 dark:text-green-400 text-sm font-medium`},mt={class:`font-mono text-xs break-all text-content-primary dark:text-content-primary`},ht={key:3,class:`bg-amber-500/10 border border-amber-500/30 rounded-lg p-3`},gt={class:`flex gap-2 mt-3`},_t=[`disabled`],vt=[`disabled`],yt={class:`flex justify-end gap-3 mt-6`},bt=[`disabled`],xt=[`disabled`],St=f({__name:`RepeaterSettings`,setup(e){let t=j(),n=v(()=>t.stats?.config||{}),r=v(()=>n.value.repeater||{}),i=v(()=>t.stats),a=E(!1),o=E(!1),s=E(null),c=E(null),d=E(!1),f=E(``),D=E(0),O=E(0),k=E(0),M=E(1),N=v(()=>n.value.mesh||{});h([n,r,N],()=>{if(!a.value){f.value=n.value.node_name||``,D.value=r.value.latitude||0,O.value=r.value.longitude||0,k.value=r.value.send_advert_interval_hours||0;let e=N.value.path_hash_mode;M.value=e===0||e===1||e===2?e+1:1}},{immediate:!0});let L=v(()=>n.value.node_name||`Not set`),R=v(()=>i.value?.local_hash||`Not available`),z=v(()=>{let e=i.value?.public_key;return!e||e===`Not set`?`Not set`:e}),B=v(()=>{let e=r.value.latitude;return e&&e!==0?e.toFixed(6):`Not set`}),V=v(()=>{let e=r.value.longitude;return e&&e!==0?e.toFixed(6):`Not set`}),ee=v(()=>{let e=r.value.mode;return e?e===`no_tx`?`No TX`:e.charAt(0).toUpperCase()+e.slice(1):`Not set`}),H=v(()=>{let e=r.value.send_advert_interval_hours;return e===void 0?`Not set`:e===0?`Disabled`:e+` hour`+(e===1?``:`s`)}),U=v(()=>{let e=N.value.path_hash_mode;return e===0||e===1||e===2?e+1+(e===0?` byte`:` bytes`):`Not set`}),W=()=>{a.value=!0,s.value=null,c.value=null},G=()=>{a.value=!1,s.value=null,f.value=n.value.node_name||``,D.value=r.value.latitude||0,O.value=r.value.longitude||0,k.value=r.value.send_advert_interval_hours||0;let e=N.value.path_hash_mode;M.value=e===0||e===1||e===2?e+1:1},te=async()=>{o.value=!0,s.value=null,c.value=null;try{let e={};f.value&&(e.node_name=f.value),e.latitude=D.value,e.longitude=O.value,e.flood_advert_interval_hours=k.value,e.path_hash_mode=M.value-1;let n=(await A.post(`/update_radio_config`,e)).data;n.message||n.persisted?(c.value=n.message||`Settings saved successfully`,a.value=!1,await t.fetchStats(),setTimeout(()=>{c.value=null},3e3)):n.error?s.value=n.error:s.value=`Unknown response from server`}catch(e){console.error(`Failed to update repeater settings:`,e),s.value=e.response?.data?.error||`Failed to update settings`}finally{o.value=!1}},K=()=>{d.value=!0},ne=e=>{D.value=e.latitude,O.value=e.longitude},q=E(!1),J=E(``),Y=E(!1),X=E(null),Z=E(null),Q=E(!1),re=E(!1),$=E(!1),ie=E(0),ae=null,oe=v(()=>$.value?8:4),se=v(()=>{let e=J.value.trim();return!e||e.length>oe.value?!1:/^[0-9a-fA-F]+$/.test(e)}),ce=v(()=>{let e=J.value.trim().length;return e===0?``:e===1?`Very fast — ~16 attempts on average`:e===2?`Fast — ~256 attempts on average`:e===3?`Moderate — ~4,096 attempts, a few seconds`:e===4?`Slow — ~65,536 attempts, may take 10-30 seconds`:e===5?`Very slow — ~1 million attempts, could take minutes`:e===6?`Extremely slow — ~16 million attempts, could take a very long time`:e===7?`Extreme — ~268 million attempts, may not complete`:`Extreme — ~4 billion attempts, extremely unlikely to complete`}),le=()=>{ie.value=0,ae=setInterval(()=>{ie.value++},1e3)},ue=()=>{ae&&=(clearInterval(ae),null)};T(()=>ue());let de=()=>{J.value=``,X.value=null,Z.value=null,Q.value=!1,$.value=!1,q.value=!0},fe=async()=>{Y.value=!0,Z.value=null,X.value=null,le();try{let e=await A.generateVanityKey(J.value.trim());e.success&&e.data?X.value=e.data:Z.value=e.error||`Generation failed`}catch(e){let t=e;Z.value=t.response?.data?.error||t.message||`Generation failed`}finally{ue(),Y.value=!1}},pe=async()=>{if(X.value){re.value=!0,Z.value=null;try{let e=await A.generateVanityKey(J.value.trim(),!0);e.success&&e.data?(X.value=e.data,Q.value=!1,q.value=!1,c.value=`New identity key applied. Restart the repeater for the change to take effect.`,await t.fetchStats(),setTimeout(()=>{c.value=null},8e3)):Z.value=e.error||`Failed to apply key`}catch(e){let t=e;Z.value=t.response?.data?.error||t.message||`Failed to apply key`}finally{re.value=!1}}};return(e,t)=>(w(),C(`div`,Te,[c.value?(w(),C(`div`,Ee,[S(`p`,De,b(c.value),1)])):g(``,!0),s.value?(w(),C(`div`,Oe,[S(`p`,ke,b(s.value),1)])):g(``,!0),S(`div`,Ae,[a.value?(w(),C(x,{key:1},[S(`button`,{onClick:G,disabled:o.value,class:`px-3 sm: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 border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed`},` Cancel `,8,je),S(`button`,{onClick:te,disabled:o.value,class:`px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed`},b(o.value?`Saving...`:`Save Changes`),9,Me)],64)):(w(),C(`button`,{key:0,onClick:W,class:`px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm`},` Edit Settings `))]),S(`div`,Ne,[S(`div`,Pe,[t[13]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Node Name`,-1),a.value?m((w(),C(`input`,{key:1,"onUpdate:modelValue":t[0]||=e=>f.value=e,type:`text`,maxlength:`50`,class:`w-full sm:w-64 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`,placeholder:`Enter node name`},null,512)),[[F,f.value]]):(w(),C(`div`,Fe,b(L.value),1))]),S(`div`,Ie,[t[14]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Local Hash`,-1),S(`span`,Le,b(R.value),1)]),S(`div`,Re,[t[15]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm flex-shrink-0`},`Public Key`,-1),S(`div`,ze,[S(`span`,Be,b(z.value),1),S(`button`,{onClick:de,class:`px-2 py-1 text-xs bg-primary/10 hover:bg-primary/20 text-content-secondary dark:text-content-muted rounded border border-primary/30 transition-colors`},` Generate New Key `)])]),S(`div`,Ve,[t[16]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Latitude`,-1),a.value?m((w(),C(`input`,{key:1,"onUpdate:modelValue":t[1]||=e=>D.value=e,type:`number`,step:`0.000001`,min:`-90`,max:`90`,class:`w-full sm:w-48 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},null,512)),[[F,D.value,void 0,{number:!0}]]):(w(),C(`div`,He,b(B.value),1))]),S(`div`,Ue,[t[17]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Longitude`,-1),a.value?m((w(),C(`input`,{key:1,"onUpdate:modelValue":t[2]||=e=>O.value=e,type:`number`,step:`0.000001`,min:`-180`,max:`180`,class:`w-full sm:w-48 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},null,512)),[[F,O.value,void 0,{number:!0}]]):(w(),C(`div`,We,b(V.value),1))]),a.value?(w(),C(`div`,Ge,[S(`button`,{onClick:K,class:`px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm flex items-center gap-2`,title:`Pick location on map`},[...t[18]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z`}),S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 11a3 3 0 11-6 0 3 3 0 016 0z`})],-1),y(` Pick Location on Map `,-1)]])])):g(``,!0),S(`div`,Ke,[t[19]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Mode`,-1),S(`span`,qe,b(ee.value),1)]),S(`div`,Je,[t[21]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Path hash length`,-1),a.value?m((w(),C(`select`,{key:1,"onUpdate:modelValue":t[3]||=e=>M.value=e,class:`w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},[...t[20]||=[S(`option`,{value:1},`1 byte`,-1),S(`option`,{value:2},`2 bytes`,-1),S(`option`,{value:3},`3 bytes`,-1)]],512)),[[P,M.value,void 0,{number:!0}]]):(w(),C(`div`,Ye,b(U.value),1))]),S(`div`,Xe,[S(`div`,Ze,[t[23]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Periodic Advertisement Interval`,-1),a.value?(w(),C(`div`,$e,[m(S(`input`,{"onUpdate:modelValue":t[4]||=e=>k.value=e,type:`number`,min:`0`,max:`48`,class:`w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},null,512),[[F,k.value,void 0,{number:!0}]]),t[22]||=S(`span`,{class:`text-content-muted dark:text-content-muted text-sm`},`hours`,-1)])):(w(),C(`div`,Qe,b(H.value),1))]),t[24]||=S(`span`,{class:`text-content-muted dark:text-content-muted text-xs`},`How often the repeater sends an advertisement packet (0 = disabled, 3-48 hours)`,-1)])]),_(we,{"is-open":d.value,latitude:D.value,longitude:O.value,onClose:t[5]||=e=>d.value=!1,onSelect:ne},null,8,[`is-open`,`latitude`,`longitude`]),(w(),l(p,{to:`body`},[q.value?(w(),C(`div`,{key:0,class:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm`,onClick:t[12]||=I(e=>q.value=!1,[`self`])},[S(`div`,et,[t[32]||=S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Generate Vanity Identity Key `,-1),t[33]||=S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Generate a new Ed25519 identity key whose public key starts with your chosen hex prefix (0-9, A-F). Longer prefixes take more time to find. `,-1),S(`div`,null,[S(`label`,tt,`Hex Prefix (1-`+b(oe.value)+` characters)`,1),m(S(`input`,{"onUpdate:modelValue":t[6]||=e=>J.value=e,type:`text`,maxlength:oe.value,placeholder:`e.g. F8A1`,disabled:Y.value,class:`w-full px-4 py-2 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-400 dark:placeholder-white/40 font-mono text-sm uppercase focus:outline-none focus:border-primary transition-colors disabled:opacity-50`},null,8,nt),[[F,J.value]]),J.value&&!se.value?(w(),C(`p`,rt,` Enter 1-`+b(oe.value)+` valid hex characters (0-9, A-F) `,1)):ce.value?(w(),C(`p`,it,b(ce.value),1)):g(``,!0)]),S(`div`,null,[S(`button`,{onClick:t[7]||=e=>$.value=!$.value,disabled:Y.value,class:`text-xs text-content-muted dark:text-content-muted hover:text-content-secondary dark:hover:text-content-secondary transition-colors disabled:opacity-50 flex items-center gap-1`},[(w(),C(`svg`,{class:u([`w-3 h-3 transition-transform`,{"rotate-90":$.value}]),fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[...t[25]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 5l7 7-7 7`},null,-1)]],2)),t[26]||=y(` Advanced `,-1)],8,at),$.value?(w(),C(`div`,ot,[...t[27]||=[S(`p`,{class:`text-amber-600 dark:text-amber-400 text-xs font-medium`},` Extended prefix mode (up to 8 characters) `,-1),S(`p`,{class:`text-amber-600 dark:text-amber-500 text-xs mt-1`},` Prefixes longer than 4 characters require exponentially more attempts and can take a very long time or may not complete at all. The request may time out. `,-1)]])):g(``,!0)]),Y.value?(w(),C(`div`,st,[t[28]||=S(`svg`,{class:`animate-spin h-5 w-5 text-blue-500 flex-shrink-0`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`},[S(`circle`,{class:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,"stroke-width":`4`}),S(`path`,{class:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})],-1),S(`div`,null,[S(`p`,ct,` Searching for key with prefix "`+b(J.value.toUpperCase())+`"... `,1),S(`p`,lt,` Elapsed: `+b(ie.value)+`s `,1)])])):g(``,!0),Z.value?(w(),C(`div`,ut,[S(`p`,dt,b(Z.value),1)])):g(``,!0),X.value?(w(),C(`div`,ft,[S(`p`,pt,` Key found in `+b(X.value.attempts.toLocaleString())+` attempts `,1),S(`div`,null,[t[29]||=S(`span`,{class:`text-xs text-content-muted dark:text-content-muted`},`Public Key:`,-1),S(`p`,mt,b(X.value.public_hex),1)])])):g(``,!0),Q.value&&X.value?(w(),C(`div`,ht,[t[30]||=S(`p`,{class:`text-amber-600 dark:text-amber-400 text-sm font-medium`},` Warning: This will replace your current identity key. `,-1),t[31]||=S(`p`,{class:`text-amber-600 dark:text-amber-500 text-xs mt-1`},` Your node address and public key will change. Other nodes will need to re-discover you. This cannot be undone unless you have a backup. `,-1),S(`div`,gt,[S(`button`,{onClick:pe,disabled:re.value,class:`px-3 py-1.5 bg-red-600 hover:bg-red-700 text-white rounded-lg text-xs transition-colors disabled:opacity-50`},b(re.value?`Applying...`:`Confirm Replace Key`),9,_t),S(`button`,{onClick:t[8]||=e=>Q.value=!1,disabled:re.value,class:`px-3 py-1.5 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 border border-stroke-subtle dark:border-stroke/20 text-xs transition-colors`},` Cancel `,8,vt)])])):g(``,!0),S(`div`,yt,[S(`button`,{onClick:t[9]||=e=>q.value=!1,disabled:Y.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 border border-stroke-subtle dark:border-stroke/10 transition-colors`},` Close `,8,bt),X.value?(w(),C(x,{key:1},[S(`button`,{onClick:t[10]||=e=>{X.value=null,Z.value=null},class:`px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 text-sm transition-colors`},` Try Again `),Q.value?g(``,!0):(w(),C(`button`,{key:0,onClick:t[11]||=e=>Q.value=!0,class:`px-4 py-2 bg-red-600/20 hover:bg-red-600/30 text-red-600 dark:text-red-400 rounded-lg border border-red-500/50 text-sm transition-colors`},` Apply Key `))],64)):(w(),C(`button`,{key:0,onClick:fe,disabled:!se.value||Y.value,class:`px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed`},b(Y.value?`Generating...`:`Generate`),9,xt))])])])):g(``,!0)]))]))}}),Ct={class:`space-y-4`},wt={key:0,class:`bg-green-100 dark:bg-green-500/20 border border-green-500 dark:border-green-500/50 rounded-lg p-3 text-green-700 dark:text-green-400 text-sm`},Tt={key:1,class:`bg-red-100 dark:bg-red-500/20 border border-red-500 dark:border-red-500/50 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm`},Et={class:`flex justify-end gap-2`},Dt=[`disabled`],Ot=[`disabled`],kt={class:`bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3`},At={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},jt={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Mt={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1`},Nt={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Pt=f({__name:`DutyCycle`,setup(e){let t=j(),n=v(()=>t.stats?.config?.duty_cycle||{}),r=v(()=>{let e=n.value.max_airtime_percent;return typeof e==`number`?e.toFixed(1)+`%`:e&&typeof e==`object`&&`parsedValue`in e?(e.parsedValue||0).toFixed(1)+`%`:`Not set`}),i=v(()=>n.value.enforcement_enabled?`Enabled`:`Disabled`),a=E(!1),o=E(!1),s=E(``),c=E(``),l=E(0),u=E(!0),d=()=>{let e=n.value.max_airtime_percent;typeof e==`number`?l.value=e:e&&typeof e==`object`&&`parsedValue`in e?l.value=e.parsedValue||0:l.value=6,u.value=n.value.enforcement_enabled!==!1,a.value=!0,s.value=``,c.value=``},f=()=>{a.value=!1,s.value=``,c.value=``},p=async()=>{o.value=!0,c.value=``,s.value=``;try{let e=(await k.post(`/api/update_duty_cycle_config`,{max_airtime_percent:l.value,enforcement_enabled:u.value})).data;e.message||e.persisted?(s.value=e.message||`Settings saved successfully`,a.value=!1,await t.fetchStats(),setTimeout(()=>{s.value=``},3e3)):c.value=`Failed to save settings`}catch(e){console.error(`Failed to save duty cycle settings:`,e),c.value=e.response?.data?.error||`Failed to save settings`}finally{o.value=!1}};return(e,t)=>(w(),C(`div`,Ct,[s.value?(w(),C(`div`,wt,b(s.value),1)):g(``,!0),c.value?(w(),C(`div`,Tt,b(c.value),1)):g(``,!0),S(`div`,Et,[a.value?(w(),C(x,{key:1},[S(`button`,{onClick:f,disabled:o.value,class:`px-3 sm: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 border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed`},` Cancel `,8,Dt),S(`button`,{onClick:p,disabled:o.value,class:`px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed`},b(o.value?`Saving...`:`Save Changes`),9,Ot)],64)):(w(),C(`button`,{key:0,onClick:d,class:`px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm`},` Edit Settings `))]),S(`div`,kt,[S(`div`,At,[t[2]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Max Airtime %`,-1),a.value?m((w(),C(`input`,{key:1,"onUpdate:modelValue":t[0]||=e=>l.value=e,type:`number`,step:`0.1`,min:`0.1`,max:`100`,class:`w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},null,512)),[[F,l.value,void 0,{number:!0}]]):(w(),C(`div`,jt,b(r.value),1))]),S(`div`,Mt,[t[4]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Enforcement`,-1),a.value?m((w(),C(`select`,{key:1,"onUpdate:modelValue":t[1]||=e=>u.value=e,class:`w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},[...t[3]||=[S(`option`,{value:!0},`Enabled`,-1),S(`option`,{value:!1},`Disabled`,-1)]],512)),[[P,u.value]]):(w(),C(`div`,Nt,b(i.value),1))])])]))}}),Ft={class:`space-y-4`},It={key:0,class:`bg-green-100 dark:bg-green-500/20 border border-green-500 dark:border-green-500/50 rounded-lg p-3 text-green-700 dark:text-green-400 text-sm`},Lt={key:1,class:`bg-red-100 dark:bg-red-500/20 border border-red-500 dark:border-red-500/50 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm`},Rt={class:`flex justify-end gap-2`},zt=[`disabled`],Bt=[`disabled`],Vt={class:`bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3`},Ht={class:`flex flex-col py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-2`},Ut={class:`flex flex-col sm:flex-row sm:justify-between sm:items-start gap-1`},Wt={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm sm:ml-4`},Gt={class:`flex flex-col py-2 gap-2`},Kt={class:`flex flex-col sm:flex-row sm:justify-between sm:items-start gap-1`},qt={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm sm:ml-4`},Jt=f({__name:`TransmissionDelays`,setup(e){let t=j(),n=v(()=>t.stats?.config?.delays||{}),r=v(()=>{let e=n.value.tx_delay_factor;if(e&&typeof e==`object`&&e&&`parsedValue`in e){let t=e.parsedValue;if(typeof t==`number`)return t.toFixed(2)+`x`}return`Not set`}),i=v(()=>{let e=n.value.direct_tx_delay_factor;return typeof e==`number`?e.toFixed(2)+`s`:`Not set`}),a=E(!1),o=E(!1),s=E(``),c=E(``),l=E(0),u=E(0),d=()=>{let e=n.value.tx_delay_factor;e&&typeof e==`object`&&`parsedValue`in e?l.value=e.parsedValue||1:typeof e==`number`?l.value=e:l.value=1;let t=n.value.direct_tx_delay_factor;u.value=typeof t==`number`?t:.5,a.value=!0,s.value=``,c.value=``},f=()=>{a.value=!1,s.value=``,c.value=``},p=async()=>{o.value=!0,c.value=``,s.value=``;try{let e=(await k.post(`/api/update_radio_config`,{tx_delay_factor:l.value,direct_tx_delay_factor:u.value})).data;e.message||e.persisted?(s.value=e.message||`Settings saved successfully`,a.value=!1,await t.fetchStats(),setTimeout(()=>{s.value=``},3e3)):c.value=`Failed to save settings`}catch(e){console.error(`Failed to save delay settings:`,e),c.value=e.response?.data?.error||`Failed to save settings`}finally{o.value=!1}};return(e,t)=>(w(),C(`div`,Ft,[s.value?(w(),C(`div`,It,b(s.value),1)):g(``,!0),c.value?(w(),C(`div`,Lt,b(c.value),1)):g(``,!0),S(`div`,Rt,[a.value?(w(),C(x,{key:1},[S(`button`,{onClick:f,disabled:o.value,class:`px-3 sm: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 border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed`},` Cancel `,8,zt),S(`button`,{onClick:p,disabled:o.value,class:`px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed`},b(o.value?`Saving...`:`Save Changes`),9,Bt)],64)):(w(),C(`button`,{key:0,onClick:d,class:`px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm`},` Edit Settings `))]),S(`div`,Vt,[S(`div`,Ht,[S(`div`,Ut,[t[2]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Flood TX Delay Factor`,-1),a.value?m((w(),C(`input`,{key:1,"onUpdate:modelValue":t[0]||=e=>l.value=e,type:`number`,step:`0.1`,min:`0`,max:`5`,class:`w-full sm:w-32 px-3 py-1.5 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},null,512)),[[F,l.value,void 0,{number:!0}]]):(w(),C(`div`,Wt,b(r.value),1))]),t[3]||=S(`span`,{class:`text-content-muted dark:text-content-muted text-xs`},`Multiplier for flood packet transmission delays (collision avoidance)`,-1)]),S(`div`,Gt,[S(`div`,Kt,[t[4]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Direct TX Delay Factor`,-1),a.value?m((w(),C(`input`,{key:1,"onUpdate:modelValue":t[1]||=e=>u.value=e,type:`number`,step:`0.1`,min:`0`,max:`5`,class:`w-full sm:w-32 px-3 py-1.5 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},null,512)),[[F,u.value,void 0,{number:!0}]]):(w(),C(`div`,qt,b(i.value),1))]),t[5]||=S(`span`,{class:`text-content-muted dark:text-content-muted text-xs`},`Base delay for direct-routed packet transmission (seconds)`,-1)])])]))}}),Yt=D(`treeState`,()=>{let e=o(new Set),t=o({value:null}),n=t=>{e.add(t)},r=t=>{e.delete(t)};return{expandedNodes:e,selectedNodeId:t,addExpandedNode:n,removeExpandedNode:r,isNodeExpanded:t=>e.has(t),setSelectedNode:e=>{t.value=e},toggleExpanded:t=>{e.has(t)?r(t):n(t)}}}),Xt={class:`select-none`},Zt={class:`flex-shrink-0`},Qt={key:0,class:`w-3.5 h-3.5 sm:w-4 sm:h-4 text-secondary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},$t={key:1,class:`w-3.5 h-3.5 sm:w-4 sm:h-4 text-accent-green`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},en={key:0,class:`hidden sm:flex items-center gap-1 ml-2`},tn={class:`relative group`},nn=[`title`],rn={key:0,class:`text-xs font-mono text-white/50 bg-white/5 px-1.5 py-0.5 rounded border border-white/10`},an={class:`flex justify-between items-start mb-4`},on={class:`bg-black/20 border border-white/10 rounded-md p-4 mb-4`},sn={class:`text-sm font-mono text-white/80 break-all leading-relaxed`},cn={class:`flex items-center gap-1 sm:gap-2 ml-auto flex-shrink-0`},ln={key:0,class:`hidden sm:flex items-center gap-1`},un=[`title`],dn={key:1,class:`hidden sm:flex items-center gap-1`},fn={key:2,class:`hidden sm:inline-block px-2 py-1 bg-white/10 text-white/60 text-xs rounded-full ml-1`},pn={key:0,class:`space-y-1`},mn=M(f({__name:`TreeNode`,props:{node:{},selectedNodeId:{},level:{},disabled:{type:Boolean}},emits:[`select`],setup(e,{emit:n}){let a=e,o=n,s=Yt(),c=E(!1),d=v({get:()=>s.isNodeExpanded(a.node.id),set:e=>{e?s.addExpandedNode(a.node.id):s.removeExpandedNode(a.node.id)}}),f=v(()=>a.node.children.length>0);function p(e){if(!e)return`Never`;let t=new Date().getTime()-e.getTime(),n=Math.floor(t/(1e3*60)),r=Math.floor(t/(1e3*60*60)),i=Math.floor(t/(1e3*60*60*24)),a=Math.floor(i/365);return n<60?`${n}m ago`:r<24?`${r}h ago`:i<365?`${i}d ago`:`${a}y ago`}function m(e){return e?e.length<=16?e:`${e.slice(0,8)}...${e.slice(-8)}`:`No key`}function h(){f.value&&(d.value=!d.value)}function T(){o(`select`,a.node.id)}function D(e){o(`select`,e)}function O(e){e.stopPropagation(),c.value=!c.value}function k(e){e.stopPropagation(),a.node.transport_key&&window.navigator?.clipboard&&window.navigator.clipboard.writeText(a.node.transport_key)}return(n,o)=>{let s=r(`TreeNode`,!0);return w(),C(`div`,Xt,[S(`div`,{class:u([`flex flex-wrap sm:flex-nowrap items-start sm:items-center gap-1 sm:gap-2 py-2 px-2 sm:px-3 rounded-lg cursor-pointer transition-all duration-200`,a.disabled?`opacity-50 cursor-not-allowed`:`hover:bg-white/5`,e.selectedNodeId===e.node.id&&!a.disabled?`bg-primary/20 text-primary`:`text-white/80 hover:text-white`,`ml-${e.level*4}`]),onClick:o[3]||=e=>!a.disabled&&T()},[S(`div`,{class:`flex-shrink-0 w-3 h-3 sm:w-4 sm:h-4 flex items-center justify-center`,onClick:I(h,[`stop`])},[f.value?(w(),C(`svg`,{key:0,class:u([`w-2.5 h-2.5 sm:w-3 sm:h-3 transition-transform duration-200`,d.value?`rotate-90`:`rotate-0`]),fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[...o[4]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 5l7 7-7 7`},null,-1)]],2)):g(``,!0)]),S(`div`,Zt,[a.node.name.startsWith(`#`)?(w(),C(`svg`,Qt,[...o[5]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M7 20l4-16m2 16l4-16M6 9h14M4 15h14`},null,-1)]])):(w(),C(`svg`,$t,[...o[6]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z`},null,-1)]]))]),S(`span`,{class:u([`font-mono text-xs sm:text-sm transition-colors duration-200 break-all`,e.selectedNodeId===e.node.id?`text-primary font-medium`:``])},b(e.node.name),3),e.node.transport_key?(w(),C(`div`,en,[S(`div`,tn,[S(`button`,{onClick:O,class:`p-1 rounded hover:bg-white/10 transition-colors`,title:c.value?`Hide full key`:`Show full key`},[...o[7]||=[S(`svg`,{class:`w-3 h-3 text-white/60 hover:text-white/80`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 12a3 3 0 11-6 0 3 3 0 016 0z`}),S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z`})],-1)]],8,nn),c.value?g(``,!0):(w(),C(`span`,rn,b(m(e.node.transport_key)),1)),c.value?(w(),C(`div`,{key:1,class:`fixed inset-0 z-[9998] flex items-center justify-center bg-black/70 backdrop-blur-md`,onClick:o[2]||=e=>c.value=!1},[S(`div`,{class:`bg-black/20 border border-white/20 rounded-lg shadow-lg p-6 max-w-2xl w-full mx-4`,onClick:o[1]||=I(()=>{},[`stop`])},[S(`div`,an,[o[9]||=S(`h3`,{class:`text-lg font-semibold text-white`},`Transport Key`,-1),S(`button`,{onClick:o[0]||=e=>c.value=!1,class:`text-white/60 hover:text-white transition-colors`},[...o[8]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),S(`div`,on,[S(`div`,sn,b(e.node.transport_key),1)]),S(`div`,{class:`flex justify-end`},[S(`button`,{onClick:k,class:`px-4 py-2 bg-accent-green/20 hover:bg-accent-green/30 border border-accent-green/50 text-accent-green rounded-lg transition-colors flex items-center gap-2`,title:`Copy to clipboard`},[...o[10]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z`})],-1),y(` Copy Key `,-1)]])])])])):g(``,!0)])])):g(``,!0),S(`div`,cn,[e.node.last_used?(w(),C(`div`,ln,[o[11]||=S(`svg`,{class:`w-3 h-3 text-white/40`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z`})],-1),S(`span`,{class:`text-xs text-white/50`,title:e.node.last_used.toLocaleString()},b(p(e.node.last_used)),9,un)])):(w(),C(`div`,dn,[...o[12]||=[S(`svg`,{class:`w-3 h-3 text-white/30`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z`})],-1),S(`span`,{class:`text-xs text-white/30 italic`},`Never`,-1)]])),S(`span`,{class:u([`px-1.5 sm:px-2 py-0.5 text-[10px] sm:text-xs font-medium rounded-md transition-colors`,e.node.floodPolicy===`allow`?`bg-accent-green/10 text-accent-green/90 border border-accent-green/20`:`bg-accent-red/10 text-accent-red/90 border border-accent-red/20`])},b(e.node.floodPolicy===`allow`?`ALLOW`:`DENY`),3),f.value?(w(),C(`span`,fn,` > `+b(e.node.children.length),1)):g(``,!0)])],2),_(N,{"enter-active-class":`transition-all duration-300 ease-out`,"enter-from-class":`opacity-0 max-h-0 overflow-hidden`,"enter-to-class":`opacity-100 max-h-screen overflow-visible`,"leave-active-class":`transition-all duration-300 ease-in`,"leave-from-class":`opacity-100 max-h-screen overflow-visible`,"leave-to-class":`opacity-0 max-h-0 overflow-hidden`},{default:t(()=>[d.value&&e.node.children.length>0?(w(),C(`div`,pn,[(w(!0),C(x,null,i(e.node.children,t=>(w(),l(s,{key:t.id,node:t,"selected-node-id":e.selectedNodeId,level:e.level+1,disabled:a.disabled,onSelect:D},null,8,[`node`,`selected-node-id`,`level`,`disabled`]))),128))])):g(``,!0)]),_:1})])}}}),[[`__scopeId`,`data-v-ed9c8a11`]]),hn={class:`flex items-center justify-between mb-6`},gn={class:`text-content-secondary dark:text-content-muted text-sm mt-1`},_n={key:0},vn={class:`text-primary font-mono`},yn={key:1},bn={for:`keyName`,class:`block text-sm font-medium text-white mb-2`},xn={class:`flex items-center gap-2`},Sn={key:0,class:`w-4 h-4 text-secondary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Cn={key:1,class:`w-4 h-4 text-accent-green`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},wn={class:`bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4`},Tn={class:`flex items-center gap-3 mb-2`},En={class:`flex items-center gap-2`},Dn={key:0,class:`w-5 h-5 text-secondary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},On={key:1,class:`w-5 h-5 text-accent-green`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},kn={class:`text-content-secondary dark:text-content-muted text-sm`},An={class:`grid grid-cols-2 gap-3`},jn={class:`relative cursor-pointer group`},Mn={class:`relative cursor-pointer group`},Nn={class:`flex gap-3 pt-4`},Pn=[`disabled`],Fn=f({__name:`AddKeyModal`,props:{show:{type:Boolean},selectedNodeName:{},selectedNodeId:{}},emits:[`close`,`add`],setup(e,{emit:t}){let n=e,r=t,i=E(``),a=E(``),o=E(`allow`),s=v(()=>i.value.startsWith(`#`)),c=v(()=>({type:s.value?`Region`:`Private Key`,description:s.value?`Regional organizational key`:`Individual assigned key`}));h(s,e=>{e?a.value=`This will create a new region for organizing keys`:a.value=`This will create a new private key entry`},{immediate:!0});let l=v(()=>i.value.trim().length>0),f=()=>{l.value&&(r(`add`,{name:i.value.trim(),floodPolicy:o.value,parentId:n.selectedNodeId}),i.value=``,a.value=``,o.value=`allow`)},p=()=>{i.value=``,a.value=``,o.value=`allow`,r(`close`)},_=e=>{e.target===e.currentTarget&&p()};return(t,r)=>e.show?(w(),C(`div`,{key:0,onClick:_,class:`fixed inset-0 bg-black/40 backdrop-blur-lg z-[99999] flex items-center justify-center p-4`,style:{"backdrop-filter":`blur(8px) saturate(180%)`,position:`fixed`,top:`0`,left:`0`,right:`0`,bottom:`0`}},[S(`div`,{class:`bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-6 w-full max-w-md border border-stroke-subtle dark:border-white/10`,onClick:r[3]||=I(()=>{},[`stop`])},[S(`div`,hn,[S(`div`,null,[r[5]||=S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Add New Entry `,-1),S(`p`,gn,[n.selectedNodeName?(w(),C(`span`,_n,[r[4]||=y(` Add to: `,-1),S(`span`,vn,b(n.selectedNodeName),1)])):(w(),C(`span`,yn,` Add to root level (#uk) `))])]),S(`button`,{onClick:p,class:`text-white/60 hover:text-white transition-colors`},[...r[6]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),S(`form`,{onSubmit:I(f,[`prevent`]),class:`space-y-4`},[S(`div`,null,[S(`label`,bn,[S(`div`,xn,[s.value?(w(),C(`svg`,Sn,[...r[7]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M7 20l4-16m2 16l4-16M6 9h14M4 15h14`},null,-1)]])):(w(),C(`svg`,Cn,[...r[8]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z`},null,-1)]])),r[9]||=y(` Region/Key Name `,-1)])]),m(S(`input`,{id:`keyName`,"onUpdate:modelValue":r[0]||=e=>i.value=e,type:`text`,placeholder:`Enter name (prefix with # for regions)`,class:`w-full px-4 py-3 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/50 focus:outline-none focus:border-primary focus:ring-2 focus:ring-primary/20 transition-colors`,autocomplete:`off`},null,512),[[F,i.value]])]),S(`div`,wn,[S(`div`,Tn,[S(`div`,En,[s.value?(w(),C(`svg`,Dn,[...r[10]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M7 20l4-16m2 16l4-16M6 9h14M4 15h14`},null,-1)]])):(w(),C(`svg`,On,[...r[11]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1221 9z`},null,-1)]])),S(`span`,{class:u([s.value?`text-secondary`:`text-accent-green`,`font-medium`])},b(c.value.type),3)]),S(`div`,{class:u([`flex-1 h-px`,s.value?`bg-secondary/20`:`bg-accent-green/20`])},null,2)]),S(`p`,kn,b(c.value.description),1)]),S(`div`,null,[r[14]||=S(`label`,{class:`block text-sm font-medium text-content-primary dark:text-content-primary mb-3`},[S(`div`,{class:`flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4 text-primary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z`})]),y(` Flood Policy `)])],-1),S(`div`,An,[S(`label`,jn,[m(S(`input`,{type:`radio`,"onUpdate:modelValue":r[1]||=e=>o.value=e,value:`allow`,class:`sr-only`},null,512),[[B,o.value]]),r[12]||=d(`<div class="flex items-center gap-3 p-3 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 rounded-lg group-has-[:checked]:border-accent-green/50 group-has-[:checked]:bg-accent-green/10 transition-colors"><div class="flex items-center justify-center w-4 h-4 border-2 border-stroke dark:border-stroke/30 rounded-full group-has-[:checked]:border-accent-green group-has-[:checked]:bg-accent-green transition-all"><div class="w-2 h-2 rounded-full bg-white scale-0 group-has-[:checked]:scale-100 transition-transform"></div></div><div class="flex-1"><div class="flex items-center gap-2"><svg class="w-4 h-4 text-accent-green" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg><span class="font-medium text-accent-green text-sm">Allow</span></div><p class="text-content-secondary dark:text-content-muted text-xs mt-1"> Permit flooding </p></div></div>`,1)]),S(`label`,Mn,[m(S(`input`,{type:`radio`,"onUpdate:modelValue":r[2]||=e=>o.value=e,value:`deny`,class:`sr-only`},null,512),[[B,o.value]]),r[13]||=d(`<div class="flex items-center gap-3 p-3 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 rounded-lg group-has-[:checked]:border-accent-red/50 group-has-[:checked]:bg-accent-red/10 transition-colors"><div class="flex items-center justify-center w-4 h-4 border-2 border-stroke dark:border-stroke/30 rounded-full group-has-[:checked]:border-accent-red group-has-[:checked]:bg-accent-red transition-all"><div class="w-2 h-2 rounded-full bg-white scale-0 group-has-[:checked]:scale-100 transition-transform"></div></div><div class="flex-1"><div class="flex items-center gap-2"><svg class="w-4 h-4 text-accent-red" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg><span class="font-medium text-accent-red text-sm">Deny</span></div><p class="text-content-secondary dark:text-content-muted text-xs mt-1"> Block flooding </p></div></div>`,1)])])]),S(`div`,Nn,[S(`button`,{type:`button`,onClick:p,class:`flex-1 px-4 py-3 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary rounded-lg transition-colors`},` Cancel `),S(`button`,{type:`submit`,disabled:!l.value,class:u([`flex-1 px-4 py-3 rounded-lg transition-colors font-medium`,l.value?`bg-accent-green/20 hover:bg-accent-green/30 border border-accent-green/50 text-accent-green`:`bg-background-mute dark:bg-stroke/5 border border-stroke-subtle dark:border-stroke/20 text-content-muted dark:text-content-muted cursor-not-allowed`])},` Add `+b(c.value.type),11,Pn)])],32)])])):g(``,!0)}}),In={class:`flex items-center justify-between mb-6`},Ln={class:`text-content-secondary dark:text-content-muted text-sm mt-1`},Rn={class:`text-primary font-mono`},zn={for:`keyName`,class:`block text-sm font-medium text-content-secondary dark:text-content-primary mb-2`},Bn={class:`flex items-center gap-2`},Vn={key:0,class:`w-4 h-4 text-secondary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Hn={key:1,class:`w-4 h-4 text-accent-green`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Un={class:`bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4`},Wn={class:`flex items-center gap-3 mb-2`},Gn={class:`flex items-center gap-2`},Kn={key:0,class:`w-5 h-5 text-secondary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},qn={key:1,class:`w-5 h-5 text-accent-green`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Jn={class:`text-content-secondary dark:text-content-muted text-sm`},Yn={key:0,class:`space-y-4`},Xn={key:0,class:`bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4`},Zn={class:`bg-background-mute dark:bg-black/20 border border-stroke-subtle dark:border-stroke/10 rounded-md p-3`},Qn={class:`text-xs font-mono text-content-primary dark:text-content-primary/80 break-all`},$n={key:1,class:`bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4`},er={class:`flex items-center justify-between`},tr={class:`text-sm text-content-secondary dark:text-content-muted`},nr={class:`text-xs text-content-muted dark:text-content-muted`},rr={class:`grid grid-cols-2 gap-3`},ir={class:`relative cursor-pointer group`},ar={class:`relative cursor-pointer group`},or={class:`flex gap-3 pt-4`},sr=[`disabled`],cr=f({__name:`EditKeyModal`,props:{show:{type:Boolean},node:{}},emits:[`close`,`save`,`request-delete`],setup(e,{emit:t}){let n=e,r=t,i=E(``),a=E(`allow`),o=v(()=>i.value.startsWith(`#`)),s=v(()=>({type:o.value?`Region`:`Private Key`,description:o.value?`Regional organizational key`:`Individual assigned key`}));h(()=>n.node,e=>{e?(i.value=e.name,a.value=e.floodPolicy):(i.value=``,a.value=`allow`)},{immediate:!0});let c=v(()=>i.value.trim().length>0&&n.node),l=e=>{let t=new Date().getTime()-e.getTime(),n=Math.floor(t/(1e3*60)),r=Math.floor(t/(1e3*60*60)),i=Math.floor(t/(1e3*60*60*24)),a=Math.floor(i/365);return n<60?`${n}m ago`:r<24?`${r}h ago`:i<365?`${i}d ago`:`${a}y ago`},f=e=>{window.navigator?.clipboard&&window.navigator.clipboard.writeText(e)},p=()=>{!c.value||!n.node||(r(`save`,{id:n.node.id,name:i.value.trim(),floodPolicy:a.value}),x())},_=()=>{n.node&&(r(`request-delete`,n.node),x())},x=()=>{r(`close`)},T=e=>{e.target===e.currentTarget&&x()};return(t,n)=>e.show?(w(),C(`div`,{key:0,onClick:T,class:`fixed inset-0 bg-black/50 backdrop-blur-lg z-[99999] flex items-center justify-center p-4`,style:{"backdrop-filter":`blur(8px) saturate(180%)`,position:`fixed`,top:`0`,left:`0`,right:`0`,bottom:`0`}},[S(`div`,{class:`bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-6 w-full max-w-lg border border-stroke-subtle dark:border-white/10`,onClick:n[4]||=I(()=>{},[`stop`])},[S(`div`,In,[S(`div`,null,[n[6]||=S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Edit Entry `,-1),S(`p`,Ln,[n[5]||=y(` Modify `,-1),S(`span`,Rn,b(e.node?.name),1)])]),S(`button`,{onClick:x,class:`text-white/60 hover:text-white transition-colors`},[...n[7]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),S(`form`,{onSubmit:I(p,[`prevent`]),class:`space-y-4`},[S(`div`,null,[S(`label`,zn,[S(`div`,Bn,[o.value?(w(),C(`svg`,Vn,[...n[8]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M7 20l4-16m2 16l4-16M6 9h14M4 15h14`},null,-1)]])):(w(),C(`svg`,Hn,[...n[9]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1721 9z`},null,-1)]])),n[10]||=y(` Region/Key Name `,-1)])]),m(S(`input`,{id:`keyName`,"onUpdate:modelValue":n[0]||=e=>i.value=e,type:`text`,placeholder:`Enter name (prefix with # for regions)`,class:`w-full px-4 py-3 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/50 focus:outline-none focus:border-primary focus:ring-2 focus:ring-primary/20 transition-colors`,autocomplete:`off`},null,512),[[F,i.value]])]),S(`div`,Un,[S(`div`,Wn,[S(`div`,Gn,[o.value?(w(),C(`svg`,Kn,[...n[11]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M7 20l4-16m2 16l4-16M6 9h14M4 15h14`},null,-1)]])):(w(),C(`svg`,qn,[...n[12]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1721 9z`},null,-1)]])),S(`span`,{class:u([o.value?`text-secondary`:`text-accent-green`,`font-medium`])},b(s.value.type),3)]),S(`div`,{class:u([`flex-1 h-px`,o.value?`bg-secondary/20`:`bg-accent-green/20`])},null,2)]),S(`p`,Jn,b(s.value.description),1)]),e.node?(w(),C(`div`,Yn,[e.node.transport_key?(w(),C(`div`,Xn,[n[14]||=d(`<div class="flex items-center gap-2 mb-3"><svg class="w-4 h-4 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"></path></svg><span class="text-sm font-medium text-content-primary dark:text-content-primary">Transport Key</span></div>`,1),S(`div`,Zn,[S(`div`,Qn,b(e.node.transport_key),1),S(`button`,{onClick:n[1]||=t=>f(e.node.transport_key||``),class:`mt-2 text-xs text-accent-green hover:text-accent-green/80 flex items-center gap-1`,title:`Copy to clipboard`},[...n[13]||=[S(`svg`,{class:`w-3 h-3`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z`})],-1),y(` Copy Key `,-1)]])])])):g(``,!0),e.node.last_used?(w(),C(`div`,$n,[n[15]||=S(`div`,{class:`flex items-center gap-2 mb-3`},[S(`svg`,{class:`w-4 h-4 text-primary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z`})]),S(`span`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},`Last Used`)],-1),S(`div`,er,[S(`div`,tr,b(e.node.last_used.toLocaleDateString())+` at `+b(e.node.last_used.toLocaleTimeString()),1),S(`div`,nr,b(l(e.node.last_used)),1)])])):g(``,!0)])):g(``,!0),S(`div`,null,[n[18]||=S(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-primary mb-3`},[S(`div`,{class:`flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4 text-primary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z`})]),y(` Flood Policy `)])],-1),S(`div`,rr,[S(`label`,ir,[m(S(`input`,{type:`radio`,"onUpdate:modelValue":n[2]||=e=>a.value=e,value:`allow`,class:`sr-only`},null,512),[[B,a.value]]),n[16]||=d(`<div class="flex items-center gap-3 p-3 bg-white/5 border border-white/20 rounded-lg group-has-[:checked]:border-accent-green/50 group-has-[:checked]:bg-accent-green/10 transition-colors"><div class="flex items-center justify-center w-4 h-4 border-2 border-white/30 rounded-full group-has-[:checked]:border-accent-green group-has-[:checked]:bg-accent-green transition-all"><div class="w-2 h-2 rounded-full bg-white scale-0 group-has-[:checked]:scale-100 transition-transform"></div></div><div class="flex-1"><div class="flex items-center gap-2"><svg class="w-4 h-4 text-accent-green" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg><span class="font-medium text-accent-green text-sm">Allow</span></div><p class="text-content-muted dark:text-content-muted text-xs mt-1"> Permit flooding </p></div></div>`,1)]),S(`label`,ar,[m(S(`input`,{type:`radio`,"onUpdate:modelValue":n[3]||=e=>a.value=e,value:`deny`,class:`sr-only`},null,512),[[B,a.value]]),n[17]||=d(`<div class="flex items-center gap-3 p-3 bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 rounded-lg group-has-[:checked]:border-accent-red/50 group-has-[:checked]:bg-accent-red/10 transition-colors"><div class="flex items-center justify-center w-4 h-4 border-2 border-stroke dark:border-stroke/30 rounded-full group-has-[:checked]:border-accent-red group-has-[:checked]:bg-accent-red transition-all"><div class="w-2 h-2 rounded-full bg-white scale-0 group-has-[:checked]:scale-100 transition-transform"></div></div><div class="flex-1"><div class="flex items-center gap-2"><svg class="w-4 h-4 text-accent-red" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg><span class="font-medium text-accent-red text-sm">Deny</span></div><p class="text-content-muted dark:text-content-muted text-xs mt-1"> Block flooding </p></div></div>`,1)])])]),S(`div`,or,[S(`button`,{type:`button`,onClick:_,class:`px-4 py-3 bg-accent-red/20 hover:bg-accent-red/30 border border-accent-red/50 text-accent-red rounded-lg transition-colors`},` Delete `),S(`button`,{type:`button`,onClick:x,class:`flex-1 px-4 py-3 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary rounded-lg transition-colors`},` Cancel `),S(`button`,{type:`submit`,disabled:!c.value,class:u([`flex-1 px-4 py-3 rounded-lg transition-colors font-medium`,c.value?`bg-accent-green/20 hover:bg-accent-green/30 border border-accent-green/50 text-accent-green`:`bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 text-content-muted dark:text-content-muted/70 cursor-not-allowed`])},` Save Changes `,10,sr)])],32)])])):g(``,!0)}}),lr={class:`flex items-center gap-3 mb-6`},ur={class:`text-content-secondary dark:text-content-muted text-sm mt-1`},dr={class:`text-accent-red font-mono`},fr={key:0,class:`bg-accent-red/10 border border-accent-red/30 rounded-lg p-4 mb-6`},pr={class:`flex items-start gap-3`},mr={class:`flex-1`},hr={class:`text-accent-red font-medium text-sm mb-2`},gr={class:`space-y-1 max-h-32 overflow-y-auto`},_r={key:0,class:`w-3 h-3 text-secondary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},vr={key:1,class:`w-3 h-3 text-accent-green`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},yr={class:`font-mono`},br={key:0,class:`text-content-secondary dark:text-content-muted text-xs`},xr={key:1,class:`mb-6`},Sr={class:`mb-3`},Cr={class:`relative`},wr={class:`space-y-2 max-h-40 overflow-y-auto border border-stroke-subtle dark:border-stroke/20 rounded-lg p-3 bg-gray-50 dark:bg-white/5`},Tr={key:0,class:`text-center py-4 text-content-secondary dark:text-content-muted text-sm`},Er={class:`relative`},Dr=[`value`],Or={class:`flex items-center gap-2 flex-1`},kr={class:`text-content-primary dark:text-content-primary font-mono text-sm`},Ar={key:0,class:`ml-auto px-2 py-0.5 bg-background-mute dark:bg-stroke/10 text-content-secondary dark:text-content-muted text-xs rounded-full`},jr={class:`flex gap-3`},Mr=f({__name:`DeleteConfirmModal`,props:{show:{type:Boolean},node:{},allNodes:{}},emits:[`close`,`delete-all`,`move-children`],setup(e,{emit:t}){let n=e,r=t,a=E(null),o=E(``),s=e=>{let t=[],n=e=>{for(let r of e.children)t.push(r),n(r)};return n(e),t},c=v(()=>n.node?s(n.node):[]),l=v(()=>{if(!n.node)return[];let e=new Set([n.node.id,...c.value.map(e=>e.id)]),t=n=>{let r=[];for(let i of n)i.name.startsWith(`#`)&&!e.has(i.id)&&r.push(i),i.children.length>0&&r.push(...t(i.children));return r};return t(n.allNodes)}),d=v(()=>{if(!o.value.trim())return l.value;let e=o.value.toLowerCase();return l.value.filter(t=>t.name.toLowerCase().includes(e))}),f=()=>{n.node&&(r(`delete-all`,n.node.id),h())},p=()=>{!n.node||!a.value||(r(`move-children`,{nodeId:n.node.id,targetParentId:a.value}),h())},h=()=>{a.value=null,o.value=``,r(`close`)},_=e=>{e.target===e.currentTarget&&h()};return(t,n)=>e.show&&e.node?(w(),C(`div`,{key:0,onClick:_,class:`fixed inset-0 bg-black/80 backdrop-blur-lg z-[99999] flex items-center justify-center p-4`,style:{"backdrop-filter":`blur(8px) saturate(180%)`,position:`fixed`,top:`0`,left:`0`,right:`0`,bottom:`0`}},[S(`div`,{class:`bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-6 w-full max-w-lg border border-stroke-subtle dark:border-white/10`,onClick:n[2]||=I(()=>{},[`stop`])},[S(`div`,lr,[n[6]||=S(`svg`,{class:`w-6 h-6 text-accent-red`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z`})],-1),S(`div`,null,[n[4]||=S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Confirm Deletion `,-1),S(`p`,ur,[n[3]||=y(` Deleting `,-1),S(`span`,dr,b(e.node?.name),1)])]),S(`button`,{onClick:h,class:`ml-auto text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors`},[...n[5]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),c.value.length>0?(w(),C(`div`,fr,[S(`div`,pr,[n[9]||=S(`svg`,{class:`w-5 h-5 text-accent-red flex-shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`})],-1),S(`div`,mr,[S(`h4`,hr,` This will affect `+b(c.value.length)+` child `+b(c.value.length===1?`entry`:`entries`)+`: `,1),S(`div`,gr,[(w(!0),C(x,null,i(c.value.slice(0,10),e=>(w(),C(`div`,{key:e.id,class:`flex items-center gap-2 text-xs text-content-secondary dark:text-content-primary/80`},[e.name.startsWith(`#`)?(w(),C(`svg`,_r,[...n[7]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M7 20l4-16m2 16l4-16M6 9h14M4 15h14`},null,-1)]])):(w(),C(`svg`,vr,[...n[8]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1721 9z`},null,-1)]])),S(`span`,yr,b(e.name),1),S(`span`,{class:u([`px-1 py-0.5 text-xs rounded`,e.floodPolicy===`allow`?`bg-accent-green/20 text-accent-green`:`bg-accent-red/20 text-accent-red`])},b(e.floodPolicy),3)]))),128)),c.value.length>10?(w(),C(`div`,br,` ...and `+b(c.value.length-10)+` more `,1)):g(``,!0)])])])])):g(``,!0),c.value.length>0&&l.value.length>0?(w(),C(`div`,xr,[n[13]||=S(`h4`,{class:`text-content-primary dark:text-content-primary font-medium text-sm mb-3`},` Move children to another region: `,-1),S(`div`,Sr,[S(`div`,Cr,[n[10]||=S(`svg`,{class:`absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-content-muted dark:text-content-muted`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z`})],-1),m(S(`input`,{"onUpdate:modelValue":n[0]||=e=>o.value=e,type:`text`,placeholder:`Search regions...`,class:`w-full pl-9 pr-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/50 focus:outline-none focus:border-primary focus:ring-2 focus:ring-primary/20 transition-colors text-sm`},null,512),[[F,o.value]])])]),S(`div`,wr,[d.value.length===0?(w(),C(`div`,Tr,b(o.value?`No regions match your search`:`No available regions`),1)):g(``,!0),(w(!0),C(x,null,i(d.value,e=>(w(),C(`label`,{key:e.id,class:`flex items-center gap-3 p-2 rounded cursor-pointer hover:bg-stroke-subtle dark:hover:bg-white/10 transition-colors group`},[S(`div`,Er,[m(S(`input`,{type:`radio`,value:e.id,"onUpdate:modelValue":n[1]||=e=>a.value=e,class:`sr-only peer`},null,8,Dr),[[B,a.value]]),n[11]||=S(`div`,{class:`w-4 h-4 border-2 border-stroke dark:border-stroke/30 rounded-full group-hover:border-stroke dark:group-hover:border-stroke/50 peer-checked:border-primary peer-checked:bg-primary/20 transition-all`},[S(`div`,{class:`w-2 h-2 rounded-full bg-primary scale-0 peer-checked:scale-100 transition-transform absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2`})],-1)]),S(`div`,Or,[n[12]||=S(`svg`,{class:`w-4 h-4 text-secondary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M7 20l4-16m2 16l4-16M6 9h14M4 15h14`})],-1),S(`span`,kr,b(e.name),1),e.children.length>0?(w(),C(`span`,Ar,b(e.children.length),1)):g(``,!0)])]))),128))])])):g(``,!0),S(`div`,jr,[S(`button`,{onClick:h,class:`flex-1 px-4 py-3 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary rounded-lg transition-colors`},` Cancel `),c.value.length>0&&a.value?(w(),C(`button`,{key:0,onClick:p,class:`flex-1 px-4 py-3 bg-primary/20 hover:bg-primary/30 border border-primary/50 text-primary rounded-lg transition-colors`},` Move & Delete `)):g(``,!0),S(`button`,{onClick:f,class:`flex-1 px-4 py-3 bg-accent-red/20 hover:bg-accent-red/30 border border-accent-red/50 text-accent-red rounded-lg transition-colors font-medium`},b(c.value.length>0?`Delete All`:`Delete`),1)])])])):g(``,!0)}}),Nr={class:`space-y-4 sm:space-y-6`},Pr={class:`flex flex-col sm:flex-row sm:justify-between sm:items-start gap-3`},Fr={class:`flex gap-2 flex-wrap`},Ir=[`disabled`],Lr=[`disabled`],Rr={class:`glass-card rounded-[15px] p-3 sm:p-4 border border-stroke-subtle dark:border-stroke/10 bg-background-mute dark:bg-white/5`},zr={class:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3`},Br={class:`flex items-center gap-2 sm:gap-3`},Vr={class:`flex bg-background-mute dark:bg-stroke/5 rounded-lg border border-stroke-subtle dark:border-stroke/20 p-0.5 sm:p-1`},Hr={class:`glass-card rounded-[15px] p-3 sm:p-6 border border-stroke-subtle dark:border-stroke/10`},Ur={key:0,class:`flex items-center justify-center py-8`},Wr={key:1,class:`text-center py-8`},Gr={class:`text-content-secondary dark:text-content-muted text-sm`},Kr={key:2,class:`text-center py-8`},qr={key:3,class:`space-y-2`},Jr=f({name:`TransportKeys`,__name:`TransportKeys`,setup(e){let t=Yt(),n=j(),r=E(!1),o=E(!1),c=E(!1),d=E(null),f=E(null),p=E(`deny`);h(v(()=>n.stats?.config?.mesh?.unscoped_flood_allow??null),e=>{e!==null&&(p.value=e?`allow`:`deny`)},{immediate:!0});let m=E([]),g=E(!1),T=E(null),D=e=>{let t=new Map,n=[];return e.forEach(e=>{let n={id:e.id,name:e.name,floodPolicy:e.flood_policy,transport_key:e.transport_key,last_used:e.last_used?new Date(e.last_used*1e3):void 0,parent_id:e.parent_id,children:[]};t.set(e.id,n)}),t.forEach(e=>{e.parent_id&&t.has(e.parent_id)?t.get(e.parent_id).children.push(e):n.push(e)}),n},O=async()=>{try{g.value=!0,T.value=null;let e=await A.getTransportKeys();e.success&&e.data?m.value=D(e.data):T.value=e.error||`Failed to load transport keys`}catch(e){T.value=e instanceof Error?e.message:`Unknown error occurred`,console.error(`Error loading transport keys:`,e)}finally{g.value=!1}};s(()=>{O()});function k(e,t){for(let n of e){if(n.id===t)return n;if(n.children){let e=k(n.children,t);if(e)return e}}return null}function M(){let e=t.selectedNodeId.value;if(e)return k(m.value,e)?.name}function N(e){t.setSelectedNode(e)}function P(){r.value=!0}function F(){if(t.selectedNodeId.value){let e=k(m.value,t.selectedNodeId.value);e&&(f.value=e,c.value=!0)}}function I(){if(t.selectedNodeId.value){let e=k(m.value,t.selectedNodeId.value);e&&(d.value=e,o.value=!0)}}let L=async e=>{try{let t=await A.createTransportKey(e.name,e.floodPolicy,void 0,e.parentId,void 0);t.success?await O():(console.error(`Failed to add transport key:`,t.error),T.value=t.error||`Failed to add transport key`)}catch(e){console.error(`Error adding transport key:`,e),T.value=e instanceof Error?e.message:`Unknown error occurred`}finally{r.value=!1}};function R(){r.value=!1}async function z(e){try{let t=e===`allow`,r=await A.updateUnscopedFloodPolicy(t);r.success?(p.value=e,await n.fetchStats()):(console.error(`Failed to update unscoped flood policy:`,r.error),T.value=r.error||`Failed to update unscoped flood policy`)}catch(e){console.error(`Error updating unscoped flood policy:`,e),T.value=e instanceof Error?e.message:`Failed to update unscoped flood policy`}}function B(){o.value=!1,d.value=null}async function V(e){try{let t=await A.updateTransportKey(e.id,e.name,e.floodPolicy);t.success?await O():(console.error(`Failed to update transport key:`,t.error),T.value=t.error||`Failed to update transport key`)}catch(e){console.error(`Error updating transport key:`,e),T.value=e instanceof Error?e.message:`Unknown error occurred`}finally{B()}}function ee(e){o.value=!1,d.value=null,f.value=e,c.value=!0}function H(){c.value=!1,f.value=null}async function U(e){try{let n=await A.deleteTransportKey(e);n.success?(await O(),t.setSelectedNode(null)):(console.error(`Failed to delete transport key:`,n.error),T.value=n.error||`Failed to delete transport key`)}catch(e){console.error(`Error deleting transport key:`,e),T.value=e instanceof Error?e.message:`Unknown error occurred`}finally{H()}}async function W(e){try{let n=await A.deleteTransportKey(e.nodeId);n.success?(await O(),t.setSelectedNode(null)):(console.error(`Failed to delete transport key:`,n.error),T.value=n.error||`Failed to delete transport key`)}catch(e){console.error(`Error deleting transport key:`,e),T.value=e instanceof Error?e.message:`Unknown error occurred`}finally{H()}}return(e,n)=>(w(),C(`div`,Nr,[S(`div`,Pr,[n[3]||=S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},` Regions/Keys `),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},` Manage regional key hierarchy `)],-1),S(`div`,Fr,[S(`button`,{onClick:P,class:`flex items-center gap-1.5 sm:gap-2 px-2.5 sm:px-3 py-1.5 sm:py-2 rounded-lg border transition-colors text-xs sm:text-sm bg-accent-green/10 hover:bg-accent-green/20 text-accent-green border-accent-green/30`},[...n[2]||=[S(`svg`,{class:`w-3.5 h-3.5 sm:w-4 sm:h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 4v16m8-8H4`})],-1),y(` Add `,-1)]]),S(`button`,{onClick:I,disabled:!a(t).selectedNodeId.value,class:u([`px-2.5 sm:px-4 py-1.5 sm:py-2 rounded-lg border transition-colors text-xs sm:text-sm`,a(t).selectedNodeId.value?`bg-accent-green/20 hover:bg-accent-green/30 text-accent-green border-accent-green/50`:`bg-background-mute dark:bg-stroke/10 text-content-muted dark:text-content-muted/70 border-stroke-subtle dark:border-stroke/20 cursor-not-allowed`])},` Edit `,10,Ir),S(`button`,{onClick:F,disabled:!a(t).selectedNodeId.value,class:u([`px-2.5 sm:px-4 py-1.5 sm:py-2 rounded-lg border transition-colors text-xs sm:text-sm`,a(t).selectedNodeId.value?`bg-accent-red/20 hover:bg-accent-red/30 text-accent-red border-accent-red/50`:`bg-background-mute dark:bg-stroke/10 text-content-muted dark:text-content-muted/70 border-stroke-subtle dark:border-stroke/20 cursor-not-allowed`])},` Delete `,10,Lr)])]),S(`div`,Rr,[S(`div`,zr,[n[4]||=S(`div`,null,[S(`h4`,{class:`text-xs sm:text-sm font-medium text-content-primary dark:text-content-primary mb-1`},` Unscoped Flood Policy (*) `),S(`p`,{class:`text-content-secondary dark:text-content-muted text-[10px] sm:text-xs`},` Allow or Deny unscoped flood packets `)],-1),S(`div`,Br,[S(`div`,Vr,[S(`button`,{onClick:n[0]||=e=>z(`deny`),class:u([`px-2 sm:px-3 py-1 text-[10px] sm:text-xs font-medium rounded transition-colors`,p.value===`deny`?`bg-accent-red/20 text-accent-red border border-accent-red/50`:`text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary`])},` DENY `,2),S(`button`,{onClick:n[1]||=e=>z(`allow`),class:u([`px-2 sm:px-3 py-1 text-[10px] sm:text-xs font-medium rounded transition-colors`,p.value===`allow`?`bg-accent-green/20 text-accent-green border border-accent-green/50`:`text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary`])},` ALLOW `,2)])])])]),S(`div`,Hr,[g.value?(w(),C(`div`,Ur,[...n[5]||=[S(`div`,{class:`animate-spin rounded-full h-8 w-8 border-b-2 border-accent-green`},null,-1),S(`span`,{class:`ml-2 text-content-secondary dark:text-content-muted`},`Loading transport keys...`,-1)]])):T.value?(w(),C(`div`,Wr,[n[6]||=S(`div`,{class:`text-accent-red mb-2`},`⚠️ Error loading transport keys`,-1),S(`div`,Gr,b(T.value),1),S(`button`,{onClick:O,class:`mt-4 px-4 py-2 bg-accent-green/20 hover:bg-accent-green/30 text-accent-green border border-accent-green/50 rounded-lg transition-colors`},` Retry `)])):m.value.length===0?(w(),C(`div`,Kr,[...n[7]||=[S(`div`,{class:`text-content-muted dark:text-content-muted mb-2`},` 📝 No transport keys found `,-1),S(`div`,{class:`text-content-muted dark:text-content-muted/60 text-sm`},` Add your first transport key to get started `,-1)]])):(w(),C(`div`,qr,[(w(!0),C(x,null,i(m.value,e=>(w(),l(mn,{key:e.id,node:e,"selected-node-id":a(t).selectedNodeId.value,level:0,onSelect:N},null,8,[`node`,`selected-node-id`]))),128))]))]),_(Fn,{show:r.value,"selected-node-name":M(),"selected-node-id":a(t).selectedNodeId.value||void 0,onClose:R,onAdd:L},null,8,[`show`,`selected-node-name`,`selected-node-id`]),_(cr,{show:o.value,node:d.value,onClose:B,onSave:V,onRequestDelete:ee},null,8,[`show`,`node`]),_(Mr,{show:c.value,node:f.value,"all-nodes":m.value,onClose:H,onDeleteAll:U,onMoveChildren:W},null,8,[`show`,`node`,`all-nodes`])]))}}),Yr={class:`space-y-4 sm:space-y-6`},Xr={class:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3`},Zr={key:0,class:`bg-red-500/10 border border-red-500/30 rounded-lg p-4`},Qr={class:`flex items-center gap-2 text-red-600 dark:text-red-400`},$r={key:1,class:`flex items-center justify-center py-12`},ei={key:2,class:`space-y-3`},ti={class:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3`},ni={class:`flex-1`},ri={class:`flex items-center gap-2 sm:gap-3`},ii={class:`min-w-0 flex-1`},ai={class:`text-content-primary dark:text-content-primary font-medium text-sm sm:text-base break-all`},oi={class:`flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-1 text-xs text-content-secondary dark:text-content-muted`},si={class:`truncate`},ci={class:`truncate`},li=[`onClick`,`disabled`],ui={key:3,class:`text-center py-12`},di={class:`bg-surface dark:bg-surface-elevated border border-stroke-subtle dark:border-stroke/20 rounded-[15px] p-6 max-w-md w-full shadow-2xl`},fi={class:`space-y-4`},pi={class:`flex justify-end gap-3 mt-6`},mi=[`disabled`],hi=[`disabled`],gi={class:`bg-surface dark:bg-surface-elevated border border-stroke-subtle dark:border-stroke/20 rounded-[15px] p-6 max-w-lg w-full shadow-2xl`},_i={class:`space-y-4`},vi={class:`flex gap-2`},yi=[`value`],bi={class:`bg-blue-500/10 border border-blue-500/30 rounded-lg p-4`},xi={class:`block bg-blue-500/20 px-3 py-2 rounded text-xs text-blue-100 font-mono overflow-x-auto`},Si=f({name:`APITokens`,__name:`APITokens`,setup(e){let t=E([]),n=E(!1),r=E(null),a=E(!1),o=E(``),c=E(null),l=E(!1),u=E(!1),f=E(null),p=async()=>{n.value=!0,r.value=null;try{let e=await A.get(`/auth/tokens`);t.value=(e.data||e).tokens||[]}catch(e){console.error(`Failed to fetch API tokens:`,e),r.value=e instanceof Error?e.message:`Failed to fetch tokens`}finally{n.value=!1}},h=async()=>{if(!o.value.trim()){r.value=`Token name is required`;return}n.value=!0,r.value=null;try{let e=await A.post(`/auth/tokens`,{name:o.value.trim()});c.value=(e.data||e).token||null,a.value=!1,l.value=!0,o.value=``,await p()}catch(e){console.error(`Failed to create API token:`,e),r.value=e instanceof Error?e.message:`Failed to create token`}finally{n.value=!1}},T=(e,t)=>{f.value={id:e,name:t},u.value=!0},D=async()=>{if(f.value){n.value=!0,r.value=null;try{await A.delete(`/auth/tokens/${f.value.id}`),await p(),u.value=!1,f.value=null}catch(e){console.error(`Failed to revoke API token:`,e),r.value=e instanceof Error?e.message:`Failed to revoke token`}finally{n.value=!1}}},O=()=>{a.value=!1,o.value=``,r.value=null},k=()=>{l.value=!1,c.value=null},j=()=>{c.value&&navigator.clipboard.writeText(c.value)},M=e=>e?new Date(e*1e3).toLocaleString():`Never`,N=v(()=>`${window.location.origin}/api/stats`);return s(()=>{p()}),(e,s)=>(w(),C(x,null,[S(`div`,Yr,[S(`div`,Xr,[s[5]||=S(`div`,null,[S(`h2`,{class:`text-lg sm:text-xl font-semibold text-content-primary dark:text-content-primary`},` API Tokens `),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm mt-1`},` Manage API tokens for machine-to-machine authentication `)],-1),S(`button`,{onClick:s[0]||=e=>a.value=!0,class:`px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors flex items-center justify-center gap-2 text-sm sm:text-base`},[...s[4]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 4v16m8-8H4`})],-1),y(` Create Token `,-1)]])]),s[20]||=d(`<div class="bg-blue-500/10 border border-blue-500/30 rounded-lg p-3 sm:p-4"><div class="flex gap-2 sm:gap-3"><svg class="w-4 h-4 sm:w-5 sm:h-5 text-blue-600 dark:text-blue-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg><div class="text-xs sm:text-sm text-blue-700 dark:text-blue-200"><p><strong>API tokens</strong> are used for machine-to-machine authentication. Include the token in the <code class="bg-blue-500/20 px-1 rounded">X-API-Key</code> header when making API requests. </p><p class="mt-2">Tokens are only shown once at creation. Store them securely.</p></div></div></div>`,1),r.value?(w(),C(`div`,Zr,[S(`div`,Qr,[s[6]||=S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})],-1),y(` `+b(r.value),1)])])):g(``,!0),n.value&&t.value.length===0?(w(),C(`div`,$r,[...s[7]||=[S(`div`,{class:`text-center`},[S(`div`,{class:`animate-spin w-8 h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-primary rounded-full mx-auto mb-4`}),S(`div`,{class:`text-content-secondary dark:text-content-muted`},`Loading tokens...`)],-1)]])):t.value.length>0?(w(),C(`div`,ei,[(w(!0),C(x,null,i(t.value,e=>(w(),C(`div`,{key:e.id,class:`bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-3 sm:p-4 hover:bg-stroke-subtle dark:hover:bg-white/10 transition-colors`},[S(`div`,ti,[S(`div`,ni,[S(`div`,ri,[s[8]||=S(`svg`,{class:`w-4 h-4 sm:w-5 sm:h-5 text-primary flex-shrink-0`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z`})],-1),S(`div`,ii,[S(`h3`,ai,b(e.name),1),S(`div`,oi,[S(`span`,si,`Created: `+b(M(e.created_at)),1),S(`span`,ci,`Last used: `+b(M(e.last_used)),1)])])])]),S(`button`,{onClick:t=>T(e.id,e.name),disabled:n.value,class:`w-full sm:w-auto px-3 py-1.5 bg-red-100 dark:bg-red-500/20 hover:bg-red-500/30 text-red-600 dark:text-red-400 rounded-lg border border-red-500/50 transition-colors disabled:opacity-50 text-sm`},` Revoke `,8,li)])]))),128))])):(w(),C(`div`,ui,[s[9]||=S(`svg`,{class:`w-16 h-16 text-content-muted dark:text-content-muted/40 mx-auto mb-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z`})],-1),s[10]||=S(`h3`,{class:`text-content-primary dark:text-content-primary font-medium mb-2`},`No API Tokens`,-1),s[11]||=S(`p`,{class:`text-content-secondary dark:text-content-muted text-sm mb-4`},` Create a token to enable API access `,-1),S(`button`,{onClick:s[1]||=e=>a.value=!0,class:`px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors`},` Create Your First Token `)])),a.value?(w(),C(`div`,{key:4,class:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm`,onClick:I(O,[`self`])},[S(`div`,di,[s[14]||=S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary mb-4`},` Create API Token `,-1),S(`div`,fi,[S(`div`,null,[s[12]||=S(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-muted mb-2`},`Token Name`,-1),m(S(`input`,{"onUpdate:modelValue":s[2]||=e=>o.value=e,type:`text`,placeholder:`e.g., Production Server, CI/CD Pipeline`,class:`w-full px-4 py-2 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-400 dark:placeholder-white/40 focus:outline-none focus:border-primary transition-colors`,onKeydown:R(h,[`enter`])},null,544),[[F,o.value]]),s[13]||=S(`p`,{class:`text-xs text-content-muted dark:text-content-muted mt-1`},` Give your token a descriptive name to identify its purpose `,-1)]),S(`div`,pi,[S(`button`,{onClick:O,disabled:n.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 border border-stroke-subtle dark:border-stroke/10 transition-colors disabled:opacity-50`},` Cancel `,8,mi),S(`button`,{onClick:h,disabled:n.value||!o.value.trim(),class:`px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors disabled:opacity-50`},b(n.value?`Creating...`:`Create Token`),9,hi)])])])])):g(``,!0),l.value&&c.value?(w(),C(`div`,{key:5,class:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm`,onClick:I(k,[`self`])},[S(`div`,gi,[s[19]||=S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary mb-4`},` Token Created Successfully `,-1),S(`div`,_i,[s[18]||=d(`<div class="bg-yellow-500/10 border border-yellow-500/30 rounded-lg p-4"><div class="flex gap-3"><svg class="w-5 h-5 text-yellow-600 dark:text-yellow-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg><div class="text-sm text-yellow-200"><strong>Save this token now!</strong> For security reasons, it will not be shown again. </div></div></div>`,1),S(`div`,null,[s[16]||=S(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-muted mb-2`},`Your API Token`,-1),S(`div`,vi,[S(`input`,{value:c.value,readonly:``,class:`flex-1 px-4 py-2 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary font-mono text-sm`},null,8,yi),S(`button`,{onClick:j,class:`px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors flex items-center gap-2`,title:`Copy to clipboard`},[...s[15]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z`})],-1),y(` Copy `,-1)]])])]),S(`div`,bi,[s[17]||=S(`p`,{class:`text-sm text-blue-200 mb-2`},[S(`strong`,null,`Usage Example:`)],-1),S(`code`,xi,` curl -H "X-API-Key: `+b(c.value)+`" `+b(N.value),1)]),S(`div`,{class:`flex justify-end mt-6`},[S(`button`,{onClick:k,class:`px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors`},` Done `)])])])])):g(``,!0)]),_(V,{show:u.value,title:`Revoke API Token`,message:`Are you sure you want to revoke the token '${f.value?.name}'? This action cannot be undone.`,"confirm-text":`Revoke`,"cancel-text":`Cancel`,variant:`danger`,onConfirm:D,onClose:s[3]||=e=>u.value=!1},null,8,[`show`,`message`])],64))}}),Ci={class:`space-y-6`},wi={class:`glass-card rounded-lg border border-stroke-subtle dark:border-stroke/10 p-6`},Ti={class:`space-y-4`},Ei={class:`flex items-center justify-between`},Di=[`disabled`],Oi={class:`glass-card rounded-lg border border-stroke-subtle dark:border-stroke/10 p-6`},ki={class:`space-y-4`},Ai={class:`space-y-3`},ji=[`checked`,`disabled`],Mi=[`checked`,`disabled`],Ni={class:`flex items-start gap-3`},Pi={key:0,class:`w-5 h-5 text-green-600 dark:text-green-400 flex-shrink-0 mt-0.5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`},Fi={key:1,class:`w-5 h-5 text-accent-cyan flex-shrink-0 mt-0.5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`},Ii={class:`flex-1`},Li={class:`text-sm font-medium text-content-primary dark:text-content-primary`},Ri={key:0,class:`text-xs text-green-600 dark:text-green-400 mt-1`},zi={key:1,class:`p-4 bg-amber-500/10 border border-amber-500/30 rounded-lg`},Bi={class:`flex items-start justify-between gap-3`},Vi=[`disabled`],Hi={key:0,class:`animate-spin h-4 w-4`,fill:`none`,viewBox:`0 0 24 24`},Ui={key:1,class:`w-4 h-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`},Wi={class:`flex items-center space-x-2`},Gi={key:0,class:`w-5 h-5 text-green-600 dark:text-green-400`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`},Ki={key:1,class:`w-5 h-5 text-red-600 dark:text-red-400`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`},qi=f({name:`WebSettings`,__name:`WebSettings`,setup(e){let t=E(!1),n=E(``),r=E(!1),i=E(!1),a=E(!1),c=E(!1),l=E(!0),f=o({cors_enabled:!1,use_default_frontend:!0}),p=v(()=>r.value?`bg-green-500/10 border-green-600/40 dark:border-green-500/30`:`bg-red-500/10 border-red-500/30`);async function m(){try{l.value=!0;let e=await A.get(`/check_pymc_console`);e.success&&e.data&&(c.value=e.data.exists,console.log(`PyMC Console exists:`,c.value))}catch(e){console.error(`Failed to check PyMC Console:`,e),c.value=!1}finally{l.value=!1}}async function h(){try{let e=await A.get(`/stats`);console.log(`WebSettings: Full response:`,e);let t=null;if(e.success&&e.data?t=e.data:e&&`version`in e&&(t=e),t){let e=t.config?.web||{};console.log(`WebSettings: webConfig:`,e),f.cors_enabled=e.cors_enabled===!0,console.log(`WebSettings: Set cors_enabled to:`,f.cors_enabled);let n=e.web_path;f.use_default_frontend=!n||n===``,console.log(`WebSettings: Set use_default_frontend to:`,f.use_default_frontend,`from web_path:`,n)}}catch(e){console.error(`Failed to load web settings:`,e),k(`Failed to load settings`,!1)}}async function _(){t.value=!0,n.value=``;try{let e={web:{cors_enabled:f.cors_enabled}};f.use_default_frontend?e.web.web_path=null:e.web.web_path=`/opt/pymc_console/web/html`;let t=await A.post(`/update_web_config`,e);t.success?(k(`Settings saved successfully`,!0),i.value=!0):k(t.error||`Failed to save settings`,!1)}catch(e){console.error(`Failed to save web settings:`,e),k(e.message||`Failed to save settings`,!1)}finally{t.value=!1}}async function T(){f.cors_enabled=!f.cors_enabled,await _()}async function D(){f.use_default_frontend=!0,await _()}async function O(){f.use_default_frontend=!1,await _()}function k(e,t){n.value=e,r.value=t,setTimeout(()=>{n.value=``},5e3)}async function j(){a.value=!0,n.value=``;try{let e=await A.post(`/restart_service`,{});e.success?(k(`Service restart initiated. Page will reload...`,!0),i.value=!1,setTimeout(()=>{window.location.reload()},2e3)):k(e.error||`Failed to restart service`,!1)}catch(e){e.code===`ERR_NETWORK`||e.message?.includes(`Network error`)?(k(`Service restarting... Page will reload`,!0),i.value=!1,setTimeout(()=>{window.location.reload()},3e3)):(console.error(`Failed to restart service:`,e),k(e.message||`Failed to restart service`,!1))}finally{a.value=!1}}return s(()=>{h(),m()}),(e,o)=>(w(),C(`div`,Ci,[S(`div`,wi,[o[1]||=S(`div`,{class:`flex items-start justify-between mb-4`},[S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` CORS Settings `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},` Control cross-origin resource sharing for API access `)])],-1),S(`div`,Ti,[S(`div`,Ei,[o[0]||=S(`div`,null,[S(`label`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},`Enable CORS`),S(`p`,{class:`text-xs text-content-secondary dark:text-content-muted mt-1`},` Allow web frontends from different origins to access the API `)],-1),S(`button`,{onClick:T,disabled:t.value,class:u([`relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2`,f.cors_enabled?`bg-cyan-600 dark:bg-teal-500 border-cyan-600 dark:border-teal-500`:`bg-gray-400 dark:bg-gray-600 border-gray-400 dark:border-gray-600`,t.value?`opacity-50 cursor-not-allowed`:`cursor-pointer`])},[S(`span`,{class:u([`inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg`,f.cors_enabled?`translate-x-5`:`translate-x-0.5`])},null,2)],10,Di)])])]),S(`div`,Oi,[o[11]||=S(`div`,{class:`flex items-start justify-between mb-4`},[S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` Web Frontend `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},` Choose which web interface to use `)])],-1),S(`div`,ki,[S(`div`,Ai,[S(`label`,{class:u([`flex items-start space-x-3 p-4 bg-background-mute dark:bg-background/30 rounded-lg border-2 cursor-pointer transition-all`,f.use_default_frontend?`border-accent-cyan bg-accent-cyan/10`:`border-stroke-subtle dark:border-stroke/10 hover:border-accent-cyan/50`])},[S(`input`,{type:`radio`,name:`frontend`,checked:f.use_default_frontend,onChange:D,disabled:t.value,class:`mt-1 h-4 w-4 text-accent-cyan focus:ring-accent-cyan focus:ring-offset-background`},null,40,ji),o[2]||=S(`div`,{class:`flex-1`},[S(`div`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},` Default Frontend `),S(`div`,{class:`text-xs text-content-secondary dark:text-content-muted mt-1`},` Built-in pyMC Repeater web interface `),S(`div`,{class:`text-xs text-content-muted dark:text-content-muted/60 mt-1 font-mono`},` Built-in `)],-1)],2),S(`label`,{class:u([`flex items-start space-x-3 p-4 bg-background-mute dark:bg-background/30 rounded-lg border-2 cursor-pointer transition-all`,f.use_default_frontend?`border-stroke-subtle dark:border-stroke/10 hover:border-accent-cyan/50`:`border-accent-cyan bg-accent-cyan/10`])},[S(`input`,{type:`radio`,name:`frontend`,checked:!f.use_default_frontend,onChange:O,disabled:t.value,class:`mt-1 h-4 w-4 text-accent-cyan focus:ring-accent-cyan focus:ring-offset-background`},null,40,Mi),o[3]||=d(`<div class="flex-1"><div class="flex items-center justify-between"><div class="text-sm font-medium text-content-primary dark:text-content-primary"> PyMC Console </div><span class="text-xs bg-orange-100 dark:bg-orange-500/20 text-orange-600 dark:text-orange-400 px-2 py-0.5 rounded-full border border-orange-500/30 font-medium">@Treehouse⚡</span></div><div class="text-xs text-content-secondary dark:text-content-muted mt-1"> Alternative web interface for pyMC Repeater </div><div class="text-xs text-content-muted dark:text-content-muted/60 mt-1 font-mono"> /opt/pymc_console/web/html </div></div>`,1)],2)]),l.value?g(``,!0):(w(),C(`div`,{key:0,class:u([`p-4 rounded-lg border`,c.value?`bg-green-500/5 border-green-500/20`:`bg-accent-cyan/5 border-accent-cyan/20`])},[S(`div`,Ni,[c.value?(w(),C(`svg`,Pi,[...o[4]||=[S(`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)]])):(w(),C(`svg`,Fi,[...o[5]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`},null,-1)]])),S(`div`,Ii,[S(`h4`,Li,b(c.value?`PyMC Console has been detected`:`PyMC Console Not Installed`),1),c.value?(w(),C(`p`,Ri,[...o[6]||=[y(` PyMC Console is installed at `,-1),S(`code`,{class:`text-green-700 dark:text-green-300`},`/opt/pymc_console/web/html`,-1)]])):(w(),C(x,{key:1},[o[7]||=d(`<p class="text-xs text-content-secondary dark:text-content-muted mt-1 mb-3"> PyMC Console must be installed at <code class="text-accent-cyan">/opt/pymc_console/web/html</code> before selecting this option. </p><a href="https://github.com/dmduran12/pymc_console-dist" target="_blank" rel="noopener noreferrer" class="inline-flex items-center gap-2 px-4 py-2 bg-accent-cyan/20 hover:bg-accent-cyan/30 border border-accent-cyan/50 text-accent-cyan rounded-lg text-sm font-medium transition-colors"><svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"></path></svg> PyMC Console Install Instructions </a>`,2)],64))])])],2)),i.value?(w(),C(`div`,zi,[S(`div`,Bi,[o[10]||=d(`<div class="flex items-start space-x-3 flex-1"><svg class="w-5 h-5 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg><div class="flex-1"><h4 class="text-sm font-medium text-amber-600 dark:text-amber-400"> Service restart required </h4><p class="text-xs text-amber-700 dark:text-amber-400/80 mt-1"> Web frontend changes will take effect after restarting the pymc-repeater service. </p></div></div>`,1),S(`button`,{onClick:j,disabled:a.value,class:`px-4 py-2 bg-amber-500 hover:bg-amber-600 disabled:bg-amber-500/50 text-white font-medium rounded-lg transition-colors disabled:cursor-not-allowed flex items-center gap-2 whitespace-nowrap`},[a.value?(w(),C(`svg`,Hi,[...o[8]||=[S(`circle`,{class:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,"stroke-width":`4`},null,-1),S(`path`,{class:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`},null,-1)]])):(w(),C(`svg`,Ui,[...o[9]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,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)]])),y(` `+b(a.value?`Restarting...`:`Restart Now`),1)],8,Vi)])])):g(``,!0)])]),n.value?(w(),C(`div`,{key:0,class:u([`p-4 rounded-lg border`,p.value])},[S(`div`,Wi,[r.value?(w(),C(`svg`,Gi,[...o[12]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 13l4 4L19 7`},null,-1)]])):(w(),C(`svg`,Ki,[...o[13]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`},null,-1)]])),S(`span`,{class:u(r.value?`text-green-600 dark:text-green-400`:`text-red-600 dark:text-red-400`)},b(n.value),3)])],2)):g(``,!0)]))}}),Ji={class:`space-y-4`},Yi={key:0,class:`bg-green-100 dark:bg-green-500/20 border border-green-500 dark:border-green-500/50 rounded-lg p-3 text-green-700 dark:text-green-400 text-sm`},Xi={key:1,class:`bg-red-100 dark:bg-red-500/20 border border-red-500 dark:border-red-500/50 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm`},Zi={class:`flex justify-between items-center`},Qi={class:`flex gap-2`},$i=[`disabled`],ea={class:`flex gap-2`},ta=[`disabled`],na=[`disabled`],ra={class:`bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3`},ia={key:0,class:`flex items-center justify-center py-4`},aa={key:1,class:`text-center py-4`},oa={class:`grid grid-cols-2 sm:grid-cols-4 gap-3`},sa={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg`},ca={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg`},la={class:`text-lg font-mono text-content-primary dark:text-content-primary`},ua={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg`},da={class:`text-lg font-mono text-green-600 dark:text-green-400`},fa={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg`},pa={class:`text-lg font-mono text-red-600 dark:text-red-400`},ma={key:0,class:`mt-2 p-2 bg-red-50 dark:bg-red-500/10 rounded-lg border border-red-200 dark:border-red-500/30`},ha={key:1,class:`mt-2 p-2 bg-orange-50 dark:bg-orange-500/10 rounded-lg border border-orange-200 dark:border-orange-500/30`},ga={class:`font-medium`},_a={class:`font-mono text-[10px] opacity-70`},va={class:`text-[10px]`},ya={class:`bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3`},ba={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},xa={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Sa={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},Ca={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},wa={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},Ta={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Ea={key:1,class:`flex items-center gap-2`},Da={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1`},Oa={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},ka={key:1,class:`flex items-center gap-2`},Aa={class:`bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3`},ja={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},Ma={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Na={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},Pa={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Fa={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},Ia={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},La={key:1,class:`flex items-center gap-2`},Ra={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},za={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Ba={key:1,class:`flex items-center gap-2`},Va={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1`},Ha={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Ua={key:1,class:`flex items-center gap-2`},Wa={class:`bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3`},Ga={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},Ka={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},qa={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1`},Ja={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Ya={key:1,class:`flex items-center gap-2`},Xa={class:`py-2`},Za={class:`grid grid-cols-3 gap-2 mt-2`},Qa={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg`},$a={key:0,class:`font-mono text-sm text-content-primary dark:text-content-primary`},eo={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg`},to={key:0,class:`font-mono text-sm text-content-primary dark:text-content-primary`},no={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg`},ro={key:0,class:`font-mono text-sm text-content-primary dark:text-content-primary`},io={class:`p-6 space-y-4`},ao={class:`flex justify-between items-start`},oo={class:`flex justify-end pt-4 border-t border-stroke-subtle dark:border-stroke/20`},so=f({__name:`AdvertSettings`,setup(e){let t=j(),n=v(()=>t.stats?.config?.repeater||{}),r=v(()=>n.value.advert_rate_limit||{}),a=v(()=>n.value.advert_penalty_box||{}),o=v(()=>n.value.advert_adaptive||{}),l=v(()=>o.value.thresholds||{}),f=E(!1),p=E(!1),_=E(``),T=E(``),D=E(!1),O=E(!1),A=E(null),M=E(!0),N=E(2),L=E(1),R=E(10),z=E(60),B=E(!0),V=E(2),ee=E(12),H=E(6),U=E(2),W=E(24),G=E(!0),te=E(.1),K=E(5),ne=E(.05),q=E(.2),J=E(.5),Y=async()=>{O.value=!0;try{let e=await k.get(`/api/advert_rate_limit_stats`);e.data?.success&&(A.value=e.data.data)}catch(e){console.error(`Failed to fetch rate limit stats:`,e)}finally{O.value=!1}};h([r,a,o],()=>{f.value||(M.value=r.value.enabled??!1,N.value=r.value.bucket_capacity??2,L.value=r.value.refill_tokens??1,R.value=Math.round((r.value.refill_interval_seconds??36e3)/3600),z.value=Math.round((r.value.min_interval_seconds??0)/60),B.value=a.value.enabled??!1,V.value=a.value.violation_threshold??2,ee.value=Math.round((a.value.violation_decay_seconds??43200)/3600),H.value=Math.round((a.value.base_penalty_seconds??21600)/3600),U.value=a.value.penalty_multiplier??2,W.value=Math.round((a.value.max_penalty_seconds??86400)/3600),G.value=o.value.enabled??!1,te.value=o.value.ewma_alpha??.1,K.value=Math.round((o.value.hysteresis_seconds??300)/60),ne.value=l.value.quiet_max??.05,q.value=l.value.normal_max??.2,J.value=l.value.busy_max??.5)},{immediate:!0}),s(()=>{Y()});let X=()=>{M.value=r.value.enabled??!1,N.value=r.value.bucket_capacity??2,L.value=r.value.refill_tokens??1,R.value=Math.round((r.value.refill_interval_seconds??36e3)/3600),z.value=Math.round((r.value.min_interval_seconds??0)/60),B.value=a.value.enabled??!1,V.value=a.value.violation_threshold??2,ee.value=Math.round((a.value.violation_decay_seconds??43200)/3600),H.value=Math.round((a.value.base_penalty_seconds??21600)/3600),U.value=a.value.penalty_multiplier??2,W.value=Math.round((a.value.max_penalty_seconds??86400)/3600),G.value=o.value.enabled??!1,te.value=o.value.ewma_alpha??.1,K.value=Math.round((o.value.hysteresis_seconds??300)/60),ne.value=l.value.quiet_max??.05,q.value=l.value.normal_max??.2,J.value=l.value.busy_max??.5},Z=()=>{f.value=!0,_.value=``,T.value=``},Q=()=>{f.value=!1,_.value=``,T.value=``,X()},re=async()=>{p.value=!0,T.value=``,_.value=``;try{let e={rate_limit_enabled:M.value,bucket_capacity:N.value,refill_tokens:L.value,refill_interval_seconds:R.value*3600,min_interval_seconds:z.value*60,penalty_enabled:B.value,violation_threshold:V.value,violation_decay_seconds:ee.value*3600,base_penalty_seconds:H.value*3600,penalty_multiplier:U.value,max_penalty_seconds:W.value*3600,adaptive_enabled:G.value,ewma_alpha:te.value,hysteresis_seconds:K.value*60,quiet_max:ne.value,normal_max:q.value,busy_max:J.value},n=(await k.post(`/api/update_advert_rate_limit_config`,e)).data;n.success?(_.value=n.data?.message||`Settings saved successfully`,await t.fetchStats(),await Y(),await c(),X(),f.value=!1,setTimeout(()=>{_.value=``},3e3)):(T.value=n.error||`Failed to save settings`,console.error(`[AdvertSettings] Save failed:`,n.error))}catch(e){console.error(`Failed to save advert settings:`,e),T.value=e.response?.data?.error||`Failed to save settings`}finally{p.value=!1}},$=v(()=>A.value?.adaptive?.current_tier||`unknown`),ie=v(()=>{switch($.value){case`quiet`:return`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400 border-green-500`;case`normal`:return`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 border-blue-500`;case`busy`:return`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400 border-yellow-500`;case`congested`:return`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400 border-red-500`;default:return`bg-gray-100 dark:bg-gray-500/20 text-gray-700 dark:text-gray-400 border-gray-500`}});return(e,t)=>(w(),C(`div`,Ji,[_.value?(w(),C(`div`,Yi,b(_.value),1)):g(``,!0),T.value?(w(),C(`div`,Xi,b(T.value),1)):g(``,!0),S(`div`,Zi,[S(`div`,Qi,[S(`button`,{onClick:Y,disabled:O.value,class:`px-3 py-1.5 text-xs bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-secondary dark:text-content-muted rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors disabled:opacity-50`},b(O.value?`Loading...`:`Refresh Stats`),9,$i),S(`button`,{onClick:t[0]||=e=>D.value=!0,class:`px-3 py-1.5 text-xs bg-blue-100 dark:bg-blue-500/20 hover:bg-blue-200 dark:hover:bg-blue-500/30 text-blue-700 dark:text-blue-400 rounded-lg border border-blue-500/50 transition-colors`,title:`How rate limiting works`},[...t[19]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`})],-1)]])]),S(`div`,ea,[f.value?(w(),C(x,{key:1},[S(`button`,{onClick:Q,disabled:p.value,class:`px-3 sm: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 border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed`},` Cancel `,8,ta),S(`button`,{onClick:re,disabled:p.value,class:`px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed`},b(p.value?`Saving...`:`Save Changes`),9,na)],64)):(w(),C(`button`,{key:0,onClick:Z,class:`px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm`},` Edit Settings `))])]),S(`div`,ra,[t[28]||=S(`h3`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},` Current Status `,-1),O.value&&!A.value?(w(),C(`div`,ia,[...t[20]||=[S(`div`,{class:`animate-spin w-5 h-5 border-2 border-stroke-subtle dark:border-stroke/20 border-t-cyan-500 dark:border-t-primary rounded-full`},null,-1),S(`span`,{class:`ml-2 text-sm text-content-muted`},`Loading stats...`,-1)]])):A.value?(w(),C(x,{key:2},[S(`div`,oa,[S(`div`,sa,[t[22]||=S(`div`,{class:`text-xs text-content-muted dark:text-content-muted`},`Mesh Tier`,-1),S(`div`,{class:u([`mt-1 px-2 py-0.5 rounded border text-xs font-medium inline-block`,ie.value])},b($.value.toUpperCase()),3)]),S(`div`,ca,[t[23]||=S(`div`,{class:`text-xs text-content-muted dark:text-content-muted`},`Adverts/min`,-1),S(`div`,la,b(A.value.metrics?.adverts_per_min_ewma?.toFixed(2)||`0.00`),1)]),S(`div`,ua,[t[24]||=S(`div`,{class:`text-xs text-content-muted dark:text-content-muted`},`Allowed`,-1),S(`div`,da,b(A.value.stats?.adverts_allowed||0),1)]),S(`div`,fa,[t[25]||=S(`div`,{class:`text-xs text-content-muted dark:text-content-muted`},`Dropped`,-1),S(`div`,pa,b(A.value.stats?.adverts_dropped||0),1)])]),Object.keys(A.value.active_penalties||{}).length>0?(w(),C(`div`,ma,[t[26]||=S(`div`,{class:`text-xs font-medium text-red-700 dark:text-red-400 mb-1`},` Active Penalties `,-1),(w(!0),C(x,null,i(A.value.active_penalties,(e,t)=>(w(),C(`div`,{key:t,class:`text-xs font-mono text-red-600 dark:text-red-400`},b(t)+`... - `+b(Math.round(e))+`s remaining `,1))),128))])):g(``,!0),A.value.recent_drops&&A.value.recent_drops.length>0?(w(),C(`div`,ha,[t[27]||=S(`div`,{class:`text-xs font-medium text-orange-700 dark:text-orange-400 mb-1`},` Recently Dropped Adverts `,-1),(w(!0),C(x,null,i(A.value.recent_drops,(e,t)=>(w(),C(`div`,{key:t,class:`text-xs text-orange-600 dark:text-orange-400 py-0.5`},[S(`span`,ga,b(e.name),1),S(`span`,_a,`(`+b(e.pubkey)+`...)`,1),S(`span`,va,` - `+b(e.reason)+` (`+b(e.seconds_ago)+`s ago)`,1)]))),128))])):g(``,!0)],64)):(w(),C(`div`,aa,[...t[21]||=[S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Stats not available. Click "Refresh Stats" to load. `,-1)]]))]),S(`div`,ya,[t[36]||=S(`h3`,{class:`text-sm font-medium text-content-primary dark:text-content-primary flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z`})]),y(` Token Bucket Rate Limiting `)],-1),t[37]||=S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Controls how many adverts each pubkey can send in a given time period. `,-1),S(`div`,ba,[t[30]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Rate Limiting`,-1),f.value?m((w(),C(`select`,{key:1,"onUpdate:modelValue":t[1]||=e=>M.value=e,class:`w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},[...t[29]||=[S(`option`,{value:!0},`Enabled`,-1),S(`option`,{value:!1},`Disabled`,-1)]],512)),[[P,M.value]]):(w(),C(`div`,xa,b(M.value?`Enabled`:`Disabled`),1))]),S(`div`,Sa,[t[31]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Bucket Capacity`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},`Max burst size (adverts)`)],-1),f.value?m((w(),C(`input`,{key:1,"onUpdate:modelValue":t[2]||=e=>N.value=e,type:`number`,min:`1`,max:`10`,class:`w-full sm:w-24 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},null,512)),[[F,N.value,void 0,{number:!0}]]):(w(),C(`div`,Ca,b(N.value),1))]),S(`div`,wa,[t[33]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Refill Interval`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Time between token refills `)],-1),f.value?(w(),C(`div`,Ea,[m(S(`input`,{"onUpdate:modelValue":t[3]||=e=>R.value=e,type:`number`,min:`1`,max:`48`,class:`w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},null,512),[[F,R.value,void 0,{number:!0}]]),t[32]||=S(`span`,{class:`text-content-muted text-sm`},`hours`,-1)])):(w(),C(`div`,Ta,b(R.value)+` hours `,1))]),S(`div`,Da,[t[35]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Minimum Interval`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Hard minimum between adverts `)],-1),f.value?(w(),C(`div`,ka,[m(S(`input`,{"onUpdate:modelValue":t[4]||=e=>z.value=e,type:`number`,min:`0`,max:`1440`,class:`w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},null,512),[[F,z.value,void 0,{number:!0}]]),t[34]||=S(`span`,{class:`text-content-muted text-sm`},`min`,-1)])):(w(),C(`div`,Oa,b(z.value)+` min `,1))])]),S(`div`,Aa,[t[47]||=S(`h3`,{class:`text-sm font-medium text-content-primary dark:text-content-primary flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636`})]),y(` Penalty Box (Repeat Offenders) `)],-1),t[48]||=S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Applies escalating cooldowns to pubkeys that repeatedly violate limits. `,-1),S(`div`,ja,[t[39]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Penalty Box`,-1),f.value?m((w(),C(`select`,{key:1,"onUpdate:modelValue":t[5]||=e=>B.value=e,class:`w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},[...t[38]||=[S(`option`,{value:!0},`Enabled`,-1),S(`option`,{value:!1},`Disabled`,-1)]],512)),[[P,B.value]]):(w(),C(`div`,Ma,b(B.value?`Enabled`:`Disabled`),1))]),S(`div`,Na,[t[40]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Violation Threshold`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Violations before penalty `)],-1),f.value?m((w(),C(`input`,{key:1,"onUpdate:modelValue":t[6]||=e=>V.value=e,type:`number`,min:`1`,max:`10`,class:`w-full sm:w-24 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},null,512)),[[F,V.value,void 0,{number:!0}]]):(w(),C(`div`,Pa,b(V.value),1))]),S(`div`,Fa,[t[42]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Base Penalty Duration`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},`First penalty duration`)],-1),f.value?(w(),C(`div`,La,[m(S(`input`,{"onUpdate:modelValue":t[7]||=e=>H.value=e,type:`number`,min:`1`,max:`48`,class:`w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},null,512),[[F,H.value,void 0,{number:!0}]]),t[41]||=S(`span`,{class:`text-content-muted text-sm`},`hours`,-1)])):(w(),C(`div`,Ia,b(H.value)+` hours `,1))]),S(`div`,Ra,[t[44]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Penalty Multiplier`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},`Escalation factor`)],-1),f.value?(w(),C(`div`,Ba,[m(S(`input`,{"onUpdate:modelValue":t[8]||=e=>U.value=e,type:`number`,min:`1`,max:`5`,step:`0.5`,class:`w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},null,512),[[F,U.value,void 0,{number:!0}]]),t[43]||=S(`span`,{class:`text-content-muted text-sm`},`x`,-1)])):(w(),C(`div`,za,b(U.value)+`x `,1))]),S(`div`,Va,[t[46]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Max Penalty Duration`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},`Maximum cooldown cap`)],-1),f.value?(w(),C(`div`,Ua,[m(S(`input`,{"onUpdate:modelValue":t[9]||=e=>W.value=e,type:`number`,min:`1`,max:`168`,class:`w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},null,512),[[F,W.value,void 0,{number:!0}]]),t[45]||=S(`span`,{class:`text-content-muted text-sm`},`hours`,-1)])):(w(),C(`div`,Ha,b(W.value)+` hours `,1))])]),S(`div`,Wa,[t[58]||=d(`<h3 class="text-sm font-medium text-content-primary dark:text-content-primary flex items-center gap-2"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"></path></svg> Adaptive Rate Limiting </h3><div class="p-3 bg-cyan-50 dark:bg-cyan-500/10 border border-cyan-200 dark:border-cyan-500/30 rounded-lg"><p class="text-xs text-cyan-700 dark:text-cyan-300 leading-relaxed"><strong>How the three systems work together:</strong> Each layer can be enabled/disabled independently and the others will still function. </p><ul class="text-xs text-cyan-700 dark:text-cyan-300 mt-2 space-y-1 ml-4 list-disc"><li><strong>Rate Limiting OFF:</strong> All limiting disabled — adverts pass through freely </li><li><strong>Adaptive OFF:</strong> Token bucket uses fixed limits (no tier scaling), penalty box still works </li><li><strong>Penalty Box OFF:</strong> Token bucket still applies, but no escalating cooldowns for repeat offenders </li></ul><p class="text-xs text-cyan-700 dark:text-cyan-300 mt-2"><strong>Decision flow when all enabled:</strong> Adaptive tier check → Penalty box check → Token bucket check → Violation recording (triggers penalty box) </p><p class="text-xs text-cyan-700 dark:text-cyan-300 mt-1"><strong>Activity tiers:</strong><span class="text-green-600 dark:text-green-400 font-medium">Quiet</span> (bypass limiting) → <span class="text-blue-600 dark:text-blue-400 font-medium">Normal</span> (lighter: 0.5x intervals) → <span class="text-yellow-600 dark:text-yellow-400 font-medium">Busy</span> (base: 1.0x intervals) → <span class="text-red-600 dark:text-red-400 font-medium">Congested</span> (stricter: 2.0x intervals) </p><p class="text-xs text-cyan-700 dark:text-cyan-300 mt-1"><strong>Note:</strong> Adaptive mode scales refill/min-interval timing; bucket capacity stays at the configured base value. </p></div>`,2),S(`div`,Ga,[t[50]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Adaptive Mode`,-1),f.value?m((w(),C(`select`,{key:1,"onUpdate:modelValue":t[10]||=e=>G.value=e,class:`w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},[...t[49]||=[S(`option`,{value:!0},`Enabled`,-1),S(`option`,{value:!1},`Disabled`,-1)]],512)),[[P,G.value]]):(w(),C(`div`,Ka,b(G.value?`Enabled`:`Disabled`),1))]),S(`div`,qa,[t[52]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Tier Change Delay`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},`Prevents tier flapping`)],-1),f.value?(w(),C(`div`,Ya,[m(S(`input`,{"onUpdate:modelValue":t[11]||=e=>K.value=e,type:`number`,min:`0`,max:`60`,class:`w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary`},null,512),[[F,K.value,void 0,{number:!0}]]),t[51]||=S(`span`,{class:`text-content-muted text-sm`},`min`,-1)])):(w(),C(`div`,Ja,b(K.value)+` min `,1))]),S(`div`,Xa,[t[56]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm mb-2 block`},`Activity Tier Thresholds (adverts/min)`,-1),S(`div`,Za,[S(`div`,Qa,[t[53]||=S(`div`,{class:`text-xs text-green-600 dark:text-green-400 mb-1`},`Quiet Max`,-1),f.value?m((w(),C(`input`,{key:1,"onUpdate:modelValue":t[12]||=e=>ne.value=e,type:`number`,min:`0`,max:`1`,step:`0.01`,class:`w-full px-2 py-1 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded text-content-primary dark:text-content-primary text-sm text-center focus:outline-none focus:border-primary`},null,512)),[[F,ne.value,void 0,{number:!0}]]):(w(),C(`div`,$a,b(ne.value),1))]),S(`div`,eo,[t[54]||=S(`div`,{class:`text-xs text-blue-600 dark:text-blue-400 mb-1`},`Normal Max`,-1),f.value?m((w(),C(`input`,{key:1,"onUpdate:modelValue":t[13]||=e=>q.value=e,type:`number`,min:`0`,max:`5`,step:`0.01`,class:`w-full px-2 py-1 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded text-content-primary dark:text-content-primary text-sm text-center focus:outline-none focus:border-primary`},null,512)),[[F,q.value,void 0,{number:!0}]]):(w(),C(`div`,to,b(q.value),1))]),S(`div`,no,[t[55]||=S(`div`,{class:`text-xs text-yellow-600 dark:text-yellow-400 mb-1`},`Busy Max`,-1),f.value?m((w(),C(`input`,{key:1,"onUpdate:modelValue":t[14]||=e=>J.value=e,type:`number`,min:`0`,max:`10`,step:`0.01`,class:`w-full px-2 py-1 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded text-content-primary dark:text-content-primary text-sm text-center focus:outline-none focus:border-primary`},null,512)),[[F,J.value,void 0,{number:!0}]]):(w(),C(`div`,ro,b(J.value),1))])]),t[57]||=S(`p`,{class:`text-xs text-content-muted dark:text-content-muted mt-2`},` Above Busy Max = Congested tier (strictest limiting) `,-1)])]),D.value?(w(),C(`div`,{key:2,class:`fixed inset-0 bg-black/50 flex items-start justify-center z-50 p-4 overflow-y-auto`,onClick:t[18]||=I(e=>D.value=!1,[`self`])},[S(`div`,{class:`bg-background dark:bg-background-dark rounded-lg shadow-xl max-w-3xl w-full my-8`,onClick:t[17]||=I(()=>{},[`stop`])},[S(`div`,io,[S(`div`,ao,[t[60]||=S(`h2`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` How Advert Rate Limiting Works `,-1),S(`button`,{onClick:t[15]||=e=>D.value=!1,class:`text-content-muted hover:text-content-primary dark:text-content-muted dark:hover:text-content-primary`},[...t[59]||=[S(`svg`,{class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),t[61]||=d(`<div class="bg-blue-50 dark:bg-blue-500/10 rounded-lg p-4 border border-blue-200 dark:border-blue-500/30"><h3 class="font-semibold text-blue-900 dark:text-blue-400 mb-2"> Why you may see the same advert more than once </h3><p class="text-sm text-blue-800 dark:text-blue-300 leading-relaxed"> Mesh traffic can reach your repeater through different paths, so duplicate advert packets are expected. </p><ul class="text-sm text-blue-800 dark:text-blue-300 mt-2 space-y-1 list-disc list-inside"><li>First copy arrives and is forwarded</li><li>Second copy arrives through another repeater path</li><li>Later copies may be dropped once limits are hit</li></ul><p class="text-sm text-blue-800 dark:text-blue-300 mt-2"> This is normal behavior and helps prevent repeated rebroadcasts from flooding the mesh. </p></div><div class="space-y-2"><h3 class="font-semibold text-content-primary dark:text-content-primary 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 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg> Token Bucket Rate Limiting </h3><p class="text-sm text-content-secondary dark:text-content-muted leading-relaxed"> Each sender has a token bucket. Every forwarded advert uses one token. </p><ul class="text-sm text-content-secondary dark:text-content-muted space-y-1 list-disc list-inside ml-4"><li><strong>Bucket Capacity:</strong> How many adverts can pass in a burst.</li><li><strong>Refill Rate:</strong> How quickly tokens come back over time.</li><li><strong>Min Interval:</strong> Optional gap between adverts from the same sender (usually set to 0). </li></ul><div class="mt-2 p-3 bg-background-mute dark:bg-white/5 rounded text-xs font-mono text-content-muted dark:text-content-muted"> Example (capacity 2):<br> - Copy 1 forwarded (2 → 1 tokens)<br> - Copy 2 forwarded (1 → 0 tokens)<br> - Copy 3 dropped (no tokens left) </div></div><div class="space-y-2"><h3 class="font-semibold text-content-primary dark:text-content-primary 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 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path></svg> Penalty Box (Repeat Offenders) </h3><p class="text-sm text-content-secondary dark:text-content-muted leading-relaxed"> If a sender keeps hitting the limit, it is temporarily blocked. </p><ul class="text-sm text-content-secondary dark:text-content-muted space-y-1 list-disc list-inside ml-4"><li><strong>Violation Threshold:</strong> How many hits before penalty starts.</li><li><strong>Base Penalty:</strong> First block duration.</li><li><strong>Multiplier:</strong> Repeated penalties get longer.</li><li><strong>Decay Time:</strong> Violations age out after stable behavior.</li></ul></div><div class="space-y-2"><h3 class="font-semibold text-content-primary dark:text-content-primary 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="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"></path></svg> Adaptive Mesh Activity Tiers </h3><p class="text-sm text-content-secondary dark:text-content-muted leading-relaxed"> Adaptive mode adjusts limits based on recent advert activity. </p><div class="mt-2 p-3 bg-background-mute dark:bg-white/5 rounded-lg text-sm text-content-secondary dark:text-content-muted"><span class="font-semibold">How Congestion is Measured:</span><ul class="mt-1 space-y-1 list-disc list-inside ml-2"><li><strong>What is counted:</strong> Advert packets only (not chat/data traffic) </li><li><strong>Smoothing:</strong> 60-second EWMA to avoid reacting to short spikes </li><li><strong>Score:</strong> Tier is based on adverts per minute</li><li><strong>Hysteresis:</strong> Tier changes must hold for 5 minutes</li></ul></div><div class="grid grid-cols-2 gap-2 mt-2"><div class="p-2 bg-green-50 dark:bg-green-500/10 rounded border border-green-500/30"><div class="text-xs font-semibold text-green-700 dark:text-green-400">QUIET</div><div class="text-xs text-green-600 dark:text-green-500">Activity < 0.05/min</div><div class="text-xs text-green-700 dark:text-green-400 font-medium mt-1"> No rate limiting </div></div><div class="p-2 bg-blue-50 dark:bg-blue-500/10 rounded border border-blue-500/30"><div class="text-xs font-semibold text-blue-700 dark:text-blue-400">NORMAL</div><div class="text-xs text-blue-600 dark:text-blue-500">Activity 0.05-0.20/min</div><div class="text-xs text-blue-700 dark:text-blue-400 font-medium mt-1"> Light limiting (50%) </div></div><div class="p-2 bg-yellow-50 dark:bg-yellow-500/10 rounded border border-yellow-500/30"><div class="text-xs font-semibold text-yellow-700 dark:text-yellow-400">BUSY</div><div class="text-xs text-yellow-600 dark:text-yellow-500"> Activity 0.20-0.50/min </div><div class="text-xs text-yellow-700 dark:text-yellow-400 font-medium mt-1"> Standard limiting (100%) </div></div><div class="p-2 bg-red-50 dark:bg-red-500/10 rounded border border-red-500/30"><div class="text-xs font-semibold text-red-700 dark:text-red-400">CONGESTED</div><div class="text-xs text-red-600 dark:text-red-500">Activity > 0.50/min</div><div class="text-xs text-red-700 dark:text-red-400 font-medium mt-1"> Aggressive (200%) </div></div></div><div class="mt-2 p-3 bg-background-mute dark:bg-white/5 rounded text-xs font-mono text-content-muted dark:text-content-muted"> Quick examples:<br> - 0.02 adverts/min → <span class="text-green-600 dark:text-green-400 font-semibold">QUIET</span> (bypass)<br> - 0.35 adverts/min → <span class="text-yellow-600 dark:text-yellow-400 font-semibold">BUSY</span> (tighter limits)<br> - 0.68 adverts/min → <span class="text-red-600 dark:text-red-400 font-semibold">CONGESTED</span> (strict limits) </div></div><div class="bg-green-50 dark:bg-green-500/10 rounded-lg p-4 border border-green-200 dark:border-green-500/30"><h3 class="font-semibold text-green-900 dark:text-green-400 mb-2"> Recommended starting settings </h3><ul class="text-sm text-green-800 dark:text-green-300 space-y-1 list-disc list-inside"><li><strong>Min Interval:</strong> 0 (disabled), let adaptive mode do the work</li><li><strong>Bucket Capacity:</strong> 2-3 tokens for normal mesh propagation</li><li><strong>Adaptive Mode:</strong> On</li><li><strong>Penalty Box:</strong> On</li></ul></div>`,5),S(`div`,oo,[S(`button`,{onClick:t[16]||=e=>D.value=!1,class:`px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors`},` Got it! `)])])])])):g(``,!0)]))}}),co=[{name:`US West only (US v1)`,website:`letsmesh.net`,brokers:[{enabled:!0,name:`MeshMapper`,host:`mqtt-us-v1.letsmesh.net`,port:443,audience:`mqtt-us-v1.letsmesh.net`,use_jwt_auth:!0,format:`letsmesh`,transport:`websockets`,retain_status:!1,tls:{enabled:!0,insecure:!1}}]},{name:`Europe only (EU v1)`,website:`letsmesh.net`,brokers:[{enabled:!0,name:`MeshMapper`,host:`mqtt-eu-v1.letsmesh.net`,port:443,audience:`mqtt-eu-v1.letsmesh.net`,use_jwt_auth:!0,format:`letsmesh`,transport:`websockets`,retain_status:!1,tls:{enabled:!0,insecure:!1}}]},{name:`MeshMapper`,website:`https://meshmapper.net`,brokers:[{enabled:!0,name:`MeshMapper`,host:`mqtt.meshmapper.cc`,port:443,audience:`mqtt.meshmapper.cc`,use_jwt_auth:!0,format:`letsmesh`,transport:`websockets`,retain_status:!1,tls:{enabled:!0,insecure:!1}}]}],lo={class:`space-y-6`},uo={class:`glass-card rounded-lg border border-stroke-subtle dark:border-stroke/10 p-6`},fo={class:`flex items-center justify-between mb-4`},po=[`disabled`],mo={key:0},ho={key:1},go={key:0,class:`text-sm text-content-secondary dark:text-content-muted`},_o={key:1,class:`space-y-3`},vo={class:`flex items-center gap-2`},yo={key:0,class:`space-y-2`},bo=[`title`],xo={key:1,class:`text-sm text-content-muted dark:text-content-muted/60 italic`},So={class:`glass-card rounded-lg border border-stroke-subtle dark:border-stroke/10 p-6`},Co={class:`flex items-start justify-between mb-6`},wo={key:0,class:`space-y-4`},To={class:`grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-3`},Eo={class:`mt-1 text-sm text-content-primary dark:text-content-primary font-mono`},Do={class:`mt-1 text-sm text-content-primary dark:text-content-primary`},Oo={class:`mt-1 text-sm text-content-primary dark:text-content-primary`},ko={class:`mt-1 text-sm text-content-primary dark:text-content-primary`},Ao={key:0,class:`mt-2 text-sm text-content-muted dark:text-content-muted/60 italic`},jo={key:1,class:`mt-2 space-y-1.5`},Mo={class:`min-w-0 flex-1`},No={class:u([`inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium`])},Po={key:0,class:`w-4 h-4 text-green-600 dark:text-green-500`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Fo={class:`text-sm font-medium text-content-primary dark:text-content-primary`},Io={class:`text-xs text-content-secondary dark:text-content-muted ml-2 font-mono`},Lo=[`title`],Ro={key:1,class:`space-y-5`},zo={class:`grid grid-cols-1 sm:grid-cols-2 gap-4`},Bo={class:`grid grid-cols-1 sm:grid-cols-2 gap-4`},Vo={class:`grid grid-cols-1 sm:grid-cols-2 gap-4`},Ho={class:`flex items-start justify-between mb-3 gap-3`},Uo={class:`flex items-center gap-2 flex-shrink-0`},Wo={class:`relative`},Go={key:0,class:`absolute right-0 top-full mt-1 z-20 w-64 rounded-lg shadow-lg border border-stroke-subtle dark:border-stroke/20 bg-white dark:bg-[var(--color-surface)] overflow-hidden`},Ko={class:`py-1`},qo=[`onClick`],Jo={class:`min-w-0 flex-1`},Yo={class:`text-sm font-medium text-content-primary dark:text-content-primary group-hover:text-cyan-700 dark:group-hover:text-primary transition-colors`},Xo={class:`text-xs text-content-secondary dark:text-content-muted`},Zo=[`href`],Qo={key:0,class:`flex flex-col items-center justify-center py-7 rounded-lg border-2 border-dashed border-stroke-subtle dark:border-stroke/20 text-content-secondary dark:text-content-muted`},$o={key:1,class:`space-y-2`},es={key:0,class:`flex items-center gap-3 px-4 py-2.5`},ts={class:`min-w-0 flex-1`},ns={class:`text-sm font-medium text-content-primary dark:text-content-primary`},rs={class:`text-xs font-mono text-content-secondary dark:text-content-muted ml-2`},is={key:0,class:`ml-2 text-xs text-red-500 dark:text-red-400`},as={class:`flex items-center gap-0.5 flex-shrink-0`},os=[`onClick`],ss=[`onClick`],cs={key:1,class:`p-4 space-y-3 bg-background-mute/60 dark:bg-background/20`},ls={class:`grid grid-cols-1 sm:grid-cols-2 gap-3`},us={class:`grid grid-cols-1 sm:grid-cols-2 gap-3`},ds={class:`sm:col-span-2`},fs={key:0},ps={key:1},ms={class:`grid grid-cols-1 sm:grid-cols-2 gap-3`},hs={class:`sm:col-span-2`},gs={class:`sm:col-span-2`},_s={key:2},vs={class:`col-span-full`},ys={class:`flex flex-wrap gap-2`},bs=[`onClick`],xs={class:`flex items-center gap-2 pt-1`},Ss=[`disabled`],Cs=[`onClick`],ws={key:0,class:`p-3 rounded-lg bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-700/30 text-green-700 dark:text-green-400 text-sm`},Ts={key:1,class:`p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-700/30 text-red-700 dark:text-red-400 text-sm`},Es={class:`flex items-center gap-3 pt-2`},Ds=[`disabled`],Os={key:0},ks={key:1},As=[`disabled`],js=M(f({__name:`LetsMeshSettings`,setup(e){let n=j(),r=v(()=>n.stats?.config?.mqtt_brokers||{}),o=[`REQ`,`RESPONSE`,`TXT_MSG`,`ACK`,`ADVERT`,`GRP_TXT`,`GRP_DATA`,`ANON_REQ`,`PATH`,`TRACE`,`RAW_CUSTOM`],c=co,l=E(!1),d=E(!1),f=E(``),p=E(``),T=E(``),D=E(300),O=E(``),A=E(``),M=E([]),R=E(null),z=E({_id:0,enabled:!0,name:``,host:``,port:443,format:`letsmesh`,use_jwt_auth:!1,transport:`websockets`,disallowedInput:[],retain_status:!1,tls:{enabled:!0,insecure:!1}}),B=E(!1);function V(e){B.value=!1,R.value!==null&&K(),e.brokers.forEach(e=>{let t=H(e);M.value.push(t)})}let ee=1;function H(e={}){return{_id:ee++,enabled:e.enabled??!0,name:e.name??``,host:e.host??``,port:e.port??0,audience:e.audience??``,format:e.format??`letsmesh`,use_jwt_auth:e.use_jwt_auth??!1,username:e.username??``,password:e.password??``,transport:e.transport??`websockets`,disallowedInput:Array.isArray(e.disallowedInput)?[...e.disallowedInput]:[],retain_status:e.retain_status??!1,base_topic:e.base_topic??``,tls:{enabled:e.tls?.enabled??!1,insecure:e.tls?.insecure??!1}}}function U(){let e=H();M.value.push(e),z.value={...e},R.value=e._id}function W(e){M.value=M.value.filter(t=>t._id!==e),R.value===e&&(R.value=null)}function G(e){z.value={...e},R.value=e._id}function te(){R.value=null}function K(){let e=z.value;if(!e.name.trim()||!e.host.trim()||e.use_jwt_auth&&!e.audience?.trim())return;let t=M.value.findIndex(t=>t._id===e._id);t!==-1&&M.value.splice(t,1,{...e}),R.value=null}function ne(){let e=z.value;(!e.audience||e.audience===e.host)&&(e.audience=e.host)}let q=v(()=>{let e={};return M.value.forEach(t=>{t.name.trim()?t.host.trim()?t.use_jwt_auth&&!t.audience?.trim()?e[t._id]=`Audience required for JWT auth`:(t.port<1||t.port>65535)&&(e[t._id]=`Port must be 1–65535`):e[t._id]=`Host required`:e[t._id]=`Name required`}),e}),J=v(()=>Object.keys(q.value).length>0),Y=E(null),X=E(!1);async function Z(){X.value=!0;try{let e=await k.get(`/api/mqtt_status`);e.data?.success&&(Y.value=e.data.data)}catch{}finally{X.value=!1}}function Q(){let e=r.value;T.value=e.iata_code??``,D.value=e.status_interval??300,O.value=e.owner??``,A.value=e.email??``,M.value=Array.isArray(e.brokers)?e.brokers.map(e=>H(e)):[]}h(r,()=>{l.value||Q()},{immediate:!0});function re(){Q(),R.value=null,l.value=!0,f.value=``,p.value=``}function $(){R.value=null,l.value=!1,f.value=``,p.value=``}function ie(e,t){e.disallowedInput||=[];let n=e.disallowedInput.indexOf(t);n===-1?e.disallowedInput.push(t):e.disallowedInput.splice(n,1)}async function ae(){if(R.value!==null&&K(),J.value){p.value=`Please fix broker errors before saving.`;return}d.value=!0,p.value=``,f.value=``;try{let e=(await k.post(`/api/update_mqtt_config`,{iata_code:T.value,status_interval:D.value,owner:O.value,email:A.value,brokers:M.value.map(e=>{let t={name:e.name,enabled:e.enabled,transport:e.transport,host:e.host,port:e.port,use_jwt_auth:e.use_jwt_auth,format:e.format,disallowed_packet_types:e.disallowedInput,base_topic:e.base_topic,retain_status:e.retain_status,tls:{enabled:e.tls?.enabled??!1,insecure:e.tls?.insecure??!1}};return e.use_jwt_auth?{...t,audience:e.audience}:{...t,username:e.username,password:e.password}})})).data;e?.success?(f.value=e.data?.message||`Settings saved`,l.value=!1,await n.fetchStats(),await Z(),setTimeout(()=>{f.value=``},5e3)):p.value=e?.error||`Save failed`}catch(e){let t=e;p.value=t?.response?.data?.error||t?.message||`Request failed`}finally{d.value=!1}}return s(Z),(e,n)=>(w(),C(`div`,lo,[S(`div`,uo,[S(`div`,fo,[n[21]||=S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` Observer Status `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},` Live LetsMesh broker connection state `)],-1),S(`button`,{onClick:Z,disabled:X.value,class:`px-3 py-1.5 text-xs rounded-lg bg-cyan-500/10 dark:bg-primary/10 hover:bg-cyan-500/20 dark:hover:bg-primary/20 text-cyan-700 dark:text-primary border border-cyan-400/30 dark:border-primary/30 transition-colors disabled:opacity-50`},[X.value?(w(),C(`span`,mo,`Refreshing…`)):(w(),C(`span`,ho,`↻ Refresh`))],8,po)]),Y.value?(w(),C(`div`,_o,[S(`div`,vo,[n[22]||=S(`span`,{class:`text-sm text-content-secondary dark:text-content-muted w-36`},`Handler`,-1),S(`span`,{class:u([`inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium`,Y.value.handler_active?`bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400`:`bg-gray-100 dark:bg-gray-800/50 text-gray-500 dark:text-gray-400`])},[S(`span`,{class:u([`w-1.5 h-1.5 rounded-full`,Y.value.handler_active?`bg-green-500`:`bg-gray-400`])},null,2),y(` `+b(Y.value.handler_active?`Active`:`Inactive`),1)],2)]),Y.value.brokers.length?(w(),C(`div`,yo,[(w(!0),C(x,null,i(Y.value.brokers,e=>(w(),C(`div`,{key:e.host,class:`flex items-center gap-2`},[S(`span`,{class:`text-sm text-content-secondary dark:text-content-muted w-36 truncate`,title:e.name},b(e.name),9,bo),S(`span`,{class:u([`inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium`,e.status.connected?`bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400`:e.status.reconnecting?`bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400`:`bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400`])},[S(`span`,{class:u([`w-1.5 h-1.5 rounded-full`,e.status.connected?`bg-green-500`:e.status.reconnecting?`bg-amber-500`:`bg-red-500`])},null,2),y(` `+b(e.status.connected?`Connected`:e.status.reconnecting?`Reconnecting…`:`Disconnected`),1)],2)]))),128))])):(w(),C(`div`,xo,` No broker connections configured. `))])):(w(),C(`div`,go,` Status unavailable — service may not be running. `))]),S(`div`,So,[S(`div`,Co,[n[23]||=S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` Observer Configuration `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},` Configure MQTT observer settings `)],-1),l.value?g(``,!0):(w(),C(`button`,{key:0,onClick:re,class:`px-4 py-2 text-sm rounded-lg bg-cyan-500/10 dark:bg-primary/10 hover:bg-cyan-500/20 dark:hover:bg-primary/20 text-cyan-700 dark:text-primary border border-cyan-400/30 dark:border-primary/30 transition-colors`},` Edit `))]),l.value?(w(),C(`div`,Ro,[S(`div`,zo,[S(`div`,null,[n[30]||=S(`label`,{class:`block text-sm font-medium text-content-primary dark:text-content-primary mb-1.5`},[y(` IATA Code `),S(`span`,{class:`text-content-secondary dark:text-content-muted font-normal text-xs ml-1`},`(e.g. SFO, LHR)`)],-1),m(S(`input`,{"onUpdate:modelValue":n[0]||=e=>T.value=e,type:`text`,maxlength:`10`,placeholder:`TEST`,class:`w-full px-3 py-2 text-sm rounded-lg bg-background-mute dark:bg-background/30 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary placeholder-content-muted dark:placeholder-content-muted/50 focus:outline-none focus:ring-2 focus:ring-cyan-500/40 dark:focus:ring-primary/40 font-mono`},null,512),[[F,T.value]])])]),S(`div`,Bo,[S(`div`,null,[n[31]||=S(`label`,{class:`block text-sm font-medium text-content-primary dark:text-content-primary mb-1.5`},`Owner / Callsign`,-1),m(S(`input`,{"onUpdate:modelValue":n[1]||=e=>O.value=e,type:`text`,placeholder:`Optional`,class:`w-full px-3 py-2 text-sm rounded-lg bg-background-mute dark:bg-background/30 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary placeholder-content-muted dark:placeholder-content-muted/50 focus:outline-none focus:ring-2 focus:ring-cyan-500/40 dark:focus:ring-primary/40`},null,512),[[F,O.value]])]),S(`div`,null,[n[32]||=S(`label`,{class:`block text-sm font-medium text-content-primary dark:text-content-primary mb-1.5`},`Email`,-1),m(S(`input`,{"onUpdate:modelValue":n[2]||=e=>A.value=e,type:`email`,placeholder:`Optional`,class:`w-full px-3 py-2 text-sm rounded-lg bg-background-mute dark:bg-background/30 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary placeholder-content-muted dark:placeholder-content-muted/50 focus:outline-none focus:ring-2 focus:ring-cyan-500/40 dark:focus:ring-primary/40`},null,512),[[F,A.value]])])]),S(`div`,Vo,[n[33]||=S(`label`,{class:`block text-sm font-medium text-content-primary dark:text-content-primary mb-1.5`},[y(` Status Heartbeat Interval `),S(`span`,{class:`text-content-secondary dark:text-content-muted font-normal text-xs ml-1`},`(seconds, min 60)`)],-1),m(S(`input`,{"onUpdate:modelValue":n[3]||=e=>D.value=e,type:`number`,min:`60`,max:`3600`,class:`w-32 px-3 py-2 text-sm rounded-lg bg-background-mute dark:bg-background/30 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary focus:outline-none focus:ring-2 focus:ring-cyan-500/40 dark:focus:ring-primary/40 font-mono`},null,512),[[F,D.value,void 0,{number:!0}]])]),S(`div`,null,[S(`div`,Ho,[n[40]||=S(`div`,{class:`min-w-0`},[S(`label`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},`Brokers`),S(`p`,{class:`text-xs text-content-secondary dark:text-content-muted mt-0.5`},` MQTT brokers `)],-1),S(`div`,Uo,[S(`div`,Wo,[S(`button`,{onClick:n[4]||=e=>B.value=!B.value,class:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg bg-background-mute dark:bg-background/30 hover:bg-stroke-subtle dark:hover:bg-stroke/10 text-content-secondary dark:text-content-muted border border-stroke-subtle dark:border-stroke/20 transition-colors`},[n[35]||=S(`svg`,{class:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M19 11H5m14 0l-4-4m4 4l-4 4`})],-1),n[36]||=y(` From Template `,-1),(w(),C(`svg`,{class:u([`w-3 h-3 ml-0.5 transition-transform`,B.value?`rotate-180`:``]),fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[...n[34]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M19 9l-7 7-7-7`},null,-1)]],2))]),_(N,{name:`dropdown`},{default:t(()=>[B.value?(w(),C(`div`,Go,[n[38]||=S(`div`,{class:`px-3 py-2 border-b border-stroke-subtle dark:border-stroke/10`},[S(`p`,{class:`text-xs font-medium text-content-secondary dark:text-content-muted uppercase tracking-wide`},` Known Networks `)],-1),S(`div`,Ko,[(w(!0),C(x,null,i(a(c),e=>(w(),C(`div`,{key:e.name,class:`flex items-center gap-2 px-3 py-2.5 hover:bg-background-mute dark:hover:bg-background/30 cursor-pointer group`,onClick:t=>V(e)},[S(`div`,Jo,[S(`p`,Yo,b(e.name),1),S(`p`,Xo,b(e.brokers.length)+` broker`+b(e.brokers.length===1?``:`s`),1)]),S(`a`,{href:e.website,target:`_blank`,rel:`noopener noreferrer`,title:`Visit website`,class:`flex-shrink-0 p-1 rounded hover:bg-cyan-500/10 dark:hover:bg-primary/10 text-content-secondary dark:text-content-muted hover:text-cyan-700 dark:hover:text-primary transition-colors`,onClick:n[5]||=I(()=>{},[`stop`])},[...n[37]||=[S(`svg`,{class:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14`})],-1)]],8,Zo)],8,qo))),128))])])):g(``,!0)]),_:1}),B.value?(w(),C(`div`,{key:0,class:`fixed inset-0 z-10`,onClick:n[6]||=e=>B.value=!1})):g(``,!0)]),S(`button`,{onClick:U,class:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg bg-cyan-500/10 dark:bg-primary/10 hover:bg-cyan-500/20 dark:hover:bg-primary/20 text-cyan-700 dark:text-primary border border-cyan-400/30 dark:border-primary/30 transition-colors`},[...n[39]||=[S(`svg`,{class:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 4v16m8-8H4`})],-1),y(` Add `,-1)]])])]),M.value.length?(w(),C(`div`,$o,[(w(!0),C(x,null,i(M.value,e=>(w(),C(`div`,{key:e._id,class:u([`rounded-lg border overflow-hidden transition-colors`,q.value[e._id]?`border-red-300 dark:border-red-700/50`:`border-stroke-subtle dark:border-stroke/10`])},[R.value===e._id?(w(),C(`div`,cs,[S(`div`,ls,[S(`div`,null,[n[44]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},[y(` Enabled `),S(`span`,{class:`text-red-500`},`*`)],-1),m(S(`input`,{"onUpdate:modelValue":n[7]||=e=>z.value.enabled=e,type:`checkbox`,class:`w-4 h-4 text-cyan-600 bg-background-mute border-stroke-subtle dark:border-stroke/20 focus:ring-cyan-500/40 dark:focus:ring-primary/40`},null,512),[[L,z.value.enabled]])]),S(`div`,null,[n[45]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},[y(` Retain Status`),S(`span`,{class:`text-red-500`},`*`),S(`span`,{class:`font-normal text-content-muted dark:text-content-muted/60 ml-1`},[y(` (Enable MQTT `),S(`a`,{href:`https://www.hivemq.com/blog/mqtt-essentials-part-8-retained-messages/`,class:`w-4 h-4 text-cyan-600 border-stroke-subtle dark:border-stroke/20 focus:ring-cyan-500/40 dark:focus:ring-primary/40`},`Retained`),y(` for status messages) `)])],-1),m(S(`input`,{"onUpdate:modelValue":n[8]||=e=>z.value.retain_status=e,type:`checkbox`,class:`w-4 h-4 text-cyan-600 bg-background-mute border-stroke-subtle dark:border-stroke/20 focus:ring-cyan-500/40 dark:focus:ring-primary/40`},null,512),[[L,z.value.retain_status]])]),S(`div`,null,[n[46]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},[y(` Name `),S(`span`,{class:`text-red-500`},`*`)],-1),m(S(`input`,{"onUpdate:modelValue":n[9]||=e=>z.value.name=e,type:`text`,placeholder:`Broker Name`,class:`w-full px-3 py-1.5 text-sm rounded-md bg-background-mute dark:bg-background/30 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary placeholder-content-muted dark:placeholder-content-muted/50 focus:outline-none focus:ring-2 focus:ring-cyan-500/40 dark:focus:ring-primary/40`},null,512),[[F,z.value.name]])]),S(`div`,null,[n[48]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},[y(` Transport `),S(`span`,{class:`text-red-500`},`*`),S(`span`,{class:`font-normal text-content-muted dark:text-content-muted/60 ml-1`})],-1),m(S(`select`,{"onUpdate:modelValue":n[10]||=e=>z.value.transport=e,class:`w-full px-3 py-1.5 text-sm rounded-md bg-background-mute dark:bg-background/30 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary focus:outline-none focus:ring-2 focus:ring-cyan-500/40 dark:focus:ring-primary/40`},[...n[47]||=[S(`option`,{value:`websockets`},`Websockets`,-1),S(`option`,{value:`tcp`},`TCP`,-1)]],512),[[P,z.value.transport]])]),S(`div`,null,[n[49]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},[y(` Host `),S(`span`,{class:`text-red-500`},`*`)],-1),m(S(`input`,{"onUpdate:modelValue":n[11]||=e=>z.value.host=e,type:`text`,placeholder:`mqtt.myserver.com`,onBlur:ne,class:`w-full px-3 py-1.5 text-sm rounded-md bg-background-mute dark:bg-background/30 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary placeholder-content-muted dark:placeholder-content-muted/50 focus:outline-none focus:ring-2 focus:ring-cyan-500/40 dark:focus:ring-primary/40 font-mono`},null,544),[[F,z.value.host]])]),S(`div`,us,[S(`div`,ds,[n[50]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},[y(` Port `),S(`span`,{class:`text-red-500`},`*`),S(`span`,{class:`font-normal text-content-muted dark:text-content-muted/60 ml-1`},`(Usually 443 for Websockets, 1883 for TCP)`)],-1),m(S(`input`,{"onUpdate:modelValue":n[12]||=e=>z.value.port=e,type:`number`,min:`0`,max:`65535`,placeholder:`0`,class:`w-full px-3 py-1.5 text-sm rounded-md bg-background-mute dark:bg-background/30 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary placeholder-content-muted dark:placeholder-content-muted/50 focus:outline-none focus:ring-2 focus:ring-cyan-500/40 dark:focus:ring-primary/40 font-mono`},null,512),[[F,z.value.port,void 0,{number:!0}]])]),S(`div`,null,[n[51]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},[y(` TLS - Enabled `),S(`span`,{class:`text-red-500`},`*`),S(`span`,{class:`font-normal text-content-muted dark:text-content-muted/60 ml-1`},`(Enable TLS)`)],-1),m(S(`input`,{"onUpdate:modelValue":n[13]||=e=>z.value.tls.enabled=e,type:`checkbox`,class:`px-3 py-1.5 text-sm rounded-md bg-background-mute dark:bg-background/30 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary placeholder-content-muted dark:placeholder-content-muted/50 focus:outline-none focus:ring-2 focus:ring-cyan-500/40 dark:focus:ring-primary/40 font-mono`},null,512),[[L,z.value.tls.enabled,void 0,{number:!0}]])]),S(`div`,null,[n[52]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},[y(` TLS - Insecure`),S(`span`,{class:`text-red-500`},`*`),S(`span`,{class:`font-normal text-content-muted dark:text-content-muted/60 ml-1`},`(Allow insecure TLS connections)`)],-1),m(S(`input`,{"onUpdate:modelValue":n[14]||=e=>z.value.tls.insecure=e,type:`checkbox`,class:`px-3 py-1.5 text-sm rounded-md bg-background-mute dark:bg-background/30 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary placeholder-content-muted dark:placeholder-content-muted/50 focus:outline-none focus:ring-2 focus:ring-cyan-500/40 dark:focus:ring-primary/40 font-mono`},null,512),[[L,z.value.tls.insecure,void 0,{number:!0}]])])]),S(`div`,null,[n[53]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},[y(` Use JWT Auth `),S(`span`,{class:`text-red-500`},`*`),S(`span`,{class:`font-normal text-content-muted dark:text-content-muted/60 ml-1`})],-1),m(S(`input`,{"onUpdate:modelValue":n[15]||=e=>z.value.use_jwt_auth=e,type:`checkbox`,placeholder:`true`,class:`px-3 py-1.5 text-sm rounded-md bg-background-mute dark:bg-background/30 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary placeholder-content-muted dark:placeholder-content-muted/50 focus:outline-none focus:ring-2 focus:ring-cyan-500/40 dark:focus:ring-primary/40 font-mono`},null,512),[[L,z.value.use_jwt_auth]])]),z.value.use_jwt_auth?(w(),C(`div`,fs,[n[54]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},[y(` Audience `),S(`span`,{class:`text-red-500`},`*`),S(`span`,{class:`font-normal text-content-muted dark:text-content-muted/60 ml-1`},`(JWT aud — usually same as host)`)],-1),m(S(`input`,{"onUpdate:modelValue":n[16]||=e=>z.value.audience=e,type:`text`,placeholder:`mqtt.myserver.com`,class:`w-full px-3 py-1.5 text-sm rounded-md bg-background-mute dark:bg-background/30 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary placeholder-content-muted dark:placeholder-content-muted/50 focus:outline-none focus:ring-2 focus:ring-cyan-500/40 dark:focus:ring-primary/40 font-mono`},null,512),[[F,z.value.audience]])])):(w(),C(`div`,ps,[S(`div`,ms,[n[57]||=S(`input`,{type:`text`,autocomplete:`username`,style:{display:`none`}},null,-1),n[58]||=S(`input`,{type:`password`,autocomplete:`current-password`,style:{display:`none`}},null,-1),S(`div`,hs,[n[55]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},[y(` Username `),S(`span`,{class:`font-normal text-content-muted dark:text-content-muted/60 ml-1`},` (Leave blank for anonymous auth) `)],-1),m(S(`input`,{autocomplete:`username`,"onUpdate:modelValue":n[17]||=e=>z.value.username=e,type:`text`,placeholder:`username`,class:`w-full px-3 py-1.5 text-sm rounded-md bg-background-mute dark:bg-background/30 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary placeholder-content-muted dark:placeholder-content-muted/50 focus:outline-none focus:ring-2 focus:ring-cyan-500/40 dark:focus:ring-primary/40`},null,512),[[F,z.value.username]])]),S(`div`,gs,[n[56]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},` Password `,-1),m(S(`input`,{autocomplete:`new-password`,"onUpdate:modelValue":n[18]||=e=>z.value.password=e,type:`password`,placeholder:``,readonly:``,onfocus:`this.removeAttribute('readonly');`,onblur:`this.setAttribute('readonly', true);`,class:`w-full px-3 py-1.5 text-sm rounded-md bg-background-mute dark:bg-background/30 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary placeholder-content-muted dark:placeholder-content-muted/50 focus:outline-none focus:ring-2 focus:ring-cyan-500/40 dark:focus:ring-primary/40`},null,512),[[F,z.value.password]])])])])),S(`div`,null,[n[60]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},[y(` Format `),S(`span`,{class:`text-red-500`},`*`),S(`span`,{class:`font-normal text-content-muted dark:text-content-muted/60 ml-1`})],-1),m(S(`select`,{"onUpdate:modelValue":n[19]||=e=>z.value.format=e,class:`w-full px-3 py-1.5 text-sm rounded-md bg-background-mute dark:bg-background/30 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary focus:outline-none focus:ring-2 focus:ring-cyan-500/40 dark:focus:ring-primary/40`},[...n[59]||=[S(`option`,{value:`letsmesh`},`LetsMesh MQTT format`,-1),S(`option`,{value:`mqtt`},`pyMC MQTT format`,-1)]],512),[[P,z.value.format]])]),z.value.format===`mqtt`?(w(),C(`div`,_s,[n[61]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},[y(` MQTT base topic `),S(`span`,{class:`font-normal text-content-muted dark:text-content-muted/60 ml-1`},`(Messages are sent to topics under this path. Example: <node_name>/advert) `)],-1),m(S(`input`,{"onUpdate:modelValue":n[20]||=e=>z.value.base_topic=e,class:`w-full px-3 py-1.5 text-sm rounded-md bg-background-mute dark:bg-background/30 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary focus:outline-none focus:ring-2 focus:ring-cyan-500/40 dark:focus:ring-primary/40`,placeholder:`meshcore/repeater`},null,512),[[F,z.value.base_topic]])])):g(``,!0),S(`div`,vs,[n[62]||=S(`label`,{class:`block text-sm font-medium text-content-primary dark:text-content-primary mb-2`},[y(` Block Packet Types `),S(`span`,{class:`text-content-secondary dark:text-content-muted font-normal text-xs ml-1`},` (prevent publishing to LetsMesh) `)],-1),S(`div`,ys,[(w(),C(x,null,i(o,e=>S(`button`,{key:e,onClick:t=>ie(z.value,e),class:u([`px-2.5 py-1 rounded text-xs font-mono font-medium border transition-colors`,z.value.disallowedInput?.includes(e)?`bg-red-100 dark:bg-red-900/30 border-red-300 dark:border-red-700/50 text-red-700 dark:text-red-400`:`bg-background-mute dark:bg-background/30 border-stroke-subtle dark:border-stroke/20 text-content-secondary dark:text-content-muted hover:border-cyan-400/50 dark:hover:border-primary/40`])},b(e),11,bs)),64))]),n[63]||=S(`p`,{class:`mt-1.5 text-xs text-content-secondary dark:text-content-muted`},[S(`span`,{class:`text-red-600 dark:text-red-400 font-medium`},`Red = blocked.`),y(` Leave all unselected to publish all packet types. `)],-1)])]),S(`div`,xs,[S(`button`,{onClick:K,disabled:!z.value.name.trim()||!z.value.host.trim()||z.value.port<=0||z.value.port>65535||z.value.use_jwt_auth&&!z.value.audience?.trim(),class:`px-3 py-1.5 text-xs font-medium rounded-md bg-cyan-600 dark:bg-teal-600 hover:bg-cyan-700 dark:hover:bg-teal-700 text-white transition-colors disabled:opacity-40 disabled:cursor-not-allowed`},` Done `,8,Ss),S(`button`,{onClick:te,class:`px-3 py-1.5 text-xs rounded-md border border-stroke-subtle dark:border-stroke/20 hover:bg-stroke-subtle dark:hover:bg-stroke/10 text-content-secondary dark:text-content-muted transition-colors`},` Cancel `),S(`button`,{onClick:t=>W(e._id),class:`ml-auto px-3 py-1.5 text-xs rounded-md border border-red-300/60 dark:border-red-700/30 hover:bg-red-50 dark:hover:bg-red-900/20 text-red-600 dark:text-red-400 transition-colors`},` Remove `,8,Cs)])])):(w(),C(`div`,es,[S(`div`,ts,[S(`span`,{class:u([`inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium`,e.enabled?`bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400`:`bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400`])},[S(`span`,{class:u([`w-1.5 h-1.5 rounded-full`,e.enabled?`bg-green-500`:`bg-red-500`])},null,2),y(` `+b(e.enabled?`Enabled`:`Disabled`),1)],2),S(`span`,ns,b(e.name||`(unnamed)`),1),S(`span`,rs,b(e.host||`—`)+`:`+b(e.port),1),q.value[e._id]?(w(),C(`span`,is,b(q.value[e._id]),1)):g(``,!0)]),S(`div`,as,[S(`button`,{onClick:t=>G(e),title:`Edit`,class:`p-1.5 rounded hover:bg-cyan-500/10 dark:hover:bg-primary/10 text-content-secondary dark:text-content-muted hover:text-cyan-700 dark:hover:text-primary transition-colors`},[...n[42]||=[S(`svg`,{class:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z`})],-1)]],8,os),S(`button`,{onClick:t=>W(e._id),title:`Remove`,class:`p-1.5 rounded hover:bg-red-500/10 dark:hover:bg-red-900/20 text-content-secondary dark:text-content-muted hover:text-red-600 dark:hover:text-red-400 transition-colors`},[...n[43]||=[S(`svg`,{class:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16`})],-1)]],8,ss)])]))],2))),128))])):(w(),C(`div`,Qo,[...n[41]||=[S(`svg`,{class:`w-7 h-7 mb-2 opacity-40`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`1.5`,d:`M5 12h14M5 12l4-4m-4 4l4 4`})],-1),S(`p`,{class:`text-sm`},`No brokers`,-1),S(`p`,{class:`text-xs mt-0.5 opacity-70`},`Add a MQTT broker`,-1)]]))]),n[64]||=S(`div`,{class:`flex items-start gap-2 p-3 rounded-lg bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-700/30 text-amber-700 dark:text-amber-400 text-xs`},[S(`svg`,{class:`w-4 h-4 mt-0.5 flex-shrink-0`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 9v2m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z`})]),y(` A service restart is required for MQTT broker changes to take effect. `)],-1),f.value?(w(),C(`div`,ws,b(f.value),1)):g(``,!0),p.value?(w(),C(`div`,Ts,b(p.value),1)):g(``,!0),S(`div`,Es,[S(`button`,{onClick:ae,disabled:d.value||J.value,class:`px-5 py-2 text-sm font-medium rounded-lg bg-cyan-600 dark:bg-teal-600 hover:bg-cyan-700 dark:hover:bg-teal-700 text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed`},[d.value?(w(),C(`span`,Os,`Saving…`)):(w(),C(`span`,ks,`Save Settings`))],8,Ds),S(`button`,{onClick:$,disabled:d.value,class:`px-4 py-2 text-sm rounded-lg bg-background-mute dark:bg-background/30 hover:bg-stroke-subtle dark:hover:bg-stroke/10 text-content-secondary dark:text-content-muted border border-stroke-subtle dark:border-stroke/20 transition-colors disabled:opacity-50`},` Cancel `,8,As)])])):(w(),C(`div`,wo,[S(`div`,To,[S(`div`,null,[n[24]||=S(`span`,{class:`text-xs font-medium text-content-secondary dark:text-content-muted uppercase tracking-wide`},`IATA Code`,-1),S(`p`,Eo,b(r.value.iata_code||`—`),1)]),S(`div`,null,[n[25]||=S(`span`,{class:`text-xs font-medium text-content-secondary dark:text-content-muted uppercase tracking-wide`},`Status Interval`,-1),S(`p`,Do,b(r.value.status_interval??300)+`s `,1)]),S(`div`,null,[n[26]||=S(`span`,{class:`text-xs font-medium text-content-secondary dark:text-content-muted uppercase tracking-wide`},`Owner`,-1),S(`p`,Oo,b(r.value.owner||`—`),1)]),S(`div`,null,[n[27]||=S(`span`,{class:`text-xs font-medium text-content-secondary dark:text-content-muted uppercase tracking-wide`},`Email`,-1),S(`p`,ko,b(r.value.email||`—`),1)])]),S(`div`,null,[n[29]||=S(`span`,{class:`text-xs font-medium text-content-secondary dark:text-content-muted uppercase tracking-wide`},`Brokers`,-1),r.value.brokers?.length?(w(),C(`div`,jo,[(w(!0),C(x,null,i(r.value.brokers,e=>(w(),C(`div`,{key:e.host,class:`flex items-center gap-3 px-3 py-2 rounded-lg bg-background-mute dark:bg-background/30 border border-stroke-subtle dark:border-stroke/10`},[S(`div`,Mo,[S(`span`,No,[e.enabled?(w(),C(`svg`,Po,[...n[28]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 13l4 4L19 7`},null,-1)]])):g(``,!0)]),S(`span`,Fo,b(e.name),1),S(`span`,Io,`Host: `+b(e.host)+`:`+b(e.port),1)]),S(`span`,{class:`text-xs text-content-secondary dark:text-content-muted font-mono truncate max-w-[140px]`,title:e.format},b(e.format),9,Lo)]))),128))])):(w(),C(`div`,Ao,` None configured `))])]))])]))}}),[[`__scopeId`,`data-v-45835eb1`]]),Ms={class:`space-y-6`},Ns={key:0,class:`rounded-lg border-2 border-red-500/50 dark:border-red-400/40 bg-red-100 dark:bg-red-500/10 p-4`},Ps={class:`glass-card rounded-lg border border-stroke-subtle dark:border-stroke/10 p-6`},Fs=[`disabled`],Is={key:0,class:`flex items-center gap-2`},Ls={key:1,class:`flex items-center gap-2`},Rs={key:0,class:`text-xs text-green-600 dark:text-green-400 mt-2`},zs={key:1,class:`text-xs text-red-500 dark:text-red-400 mt-2`},Bs={class:`glass-card rounded-lg border border-stroke-subtle dark:border-stroke/10 p-6`},Vs={key:0},Hs={key:1,class:`rounded-lg border-2 border-red-500/50 dark:border-red-400/40 bg-red-50 dark:bg-red-500/10 p-4`},Us={class:`flex items-start gap-3`},Ws={class:`flex-1`},Gs={class:`text-xs text-red-600 dark:text-red-400/80 mt-1`},Ks={class:`flex gap-2 mt-3`},qs=[`disabled`],Js=[`disabled`],Ys={key:2,class:`text-xs text-green-600 dark:text-green-400 mt-2`},Xs={key:3,class:`text-xs text-red-500 dark:text-red-400 mt-2`},Zs={class:`glass-card rounded-lg border border-stroke-subtle dark:border-stroke/10 p-6`},Qs={class:`space-y-3`},$s={class:`flex items-center gap-3 cursor-pointer px-4 py-3 bg-background-mute dark:bg-background/30 rounded-lg border-2 border-dashed border-stroke-subtle dark:border-stroke/20 hover:border-cyan-500/50 dark:hover:border-primary/50 transition-colors`},ec={class:`text-sm text-content-secondary dark:text-content-muted`},tc={key:0,class:`bg-background-mute dark:bg-background/30 rounded-lg p-4 border border-stroke-subtle dark:border-stroke/10`},nc={key:0,class:`text-xs text-content-secondary dark:text-content-muted space-y-1 mb-3`},rc={class:`font-mono`},ic={class:`font-mono`},ac={key:0,class:`text-amber-600 dark:text-amber-400 font-medium`},oc={key:1,class:`text-content-muted`},sc={class:`text-xs text-content-secondary dark:text-content-muted`},cc={class:`font-mono`},lc={key:1},uc={key:2,class:`rounded-lg border-2 border-amber-500/50 dark:border-amber-400/40 bg-amber-50 dark:bg-amber-500/10 p-4`},dc={class:`flex items-start gap-3`},fc={class:`flex-1`},pc={class:`text-xs text-amber-700 dark:text-amber-300/80 mt-1`},mc={class:`flex gap-2 mt-3`},hc=[`disabled`],gc=[`disabled`],_c={key:3,class:`text-xs text-green-600 dark:text-green-400 mt-2`},vc={key:4,class:`text-xs text-red-500 dark:text-red-400 mt-2`},yc={class:`glass-card rounded-lg border border-stroke-subtle dark:border-stroke/10 p-6`},bc={key:0},xc={key:1,class:`rounded-lg border-2 border-red-500/50 dark:border-red-400/40 bg-red-50 dark:bg-red-500/10 p-4`},Sc={class:`flex items-start gap-3`},Cc={class:`flex-1`},wc={class:`text-xs text-red-600 dark:text-red-400/80 mt-1`},Tc={class:`flex gap-2 mt-3`},Ec=[`disabled`],Dc=[`disabled`],Oc={key:2,class:`bg-background-mute dark:bg-background/30 rounded-lg p-4 border border-stroke-subtle dark:border-stroke/10 space-y-2`},kc={class:`flex items-center justify-between`},Ac={class:`text-xs text-content-secondary dark:text-content-muted space-y-1`},jc={class:`font-mono`},Mc={key:0},Nc={class:`font-mono`},Pc={key:1},Fc={class:`font-mono text-[10px] break-all`},Ic={key:3,class:`text-xs text-red-500 dark:text-red-400 mt-2`},Lc=f({__name:`BackupRestore`,setup(e){let t=v(()=>window.location.protocol===`http:`),n=E(!1),r=E(``),i=E(``);async function a(){n.value=!0,r.value=``,i.value=``;try{let e=await A.exportConfig(!1);if(!e.success||!e.data){i.value=e.error||`Export failed`;return}let t=new Blob([JSON.stringify(e.data,null,2)],{type:`application/json`}),n=URL.createObjectURL(t),a=document.createElement(`a`);a.href=n,a.download=`pymc-repeater-settings-${(e.data.meta?.exported_at||new Date().toISOString()).replace(/[:.]/g,`-`)}.json`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(n),r.value=`Settings exported successfully (secrets redacted).`}catch(e){i.value=e instanceof Error?e.message:`Export failed`}finally{n.value=!1}}let o=E(!1),s=E(!1),c=E(``),l=E(``);async function u(){s.value=!0,c.value=``,l.value=``;try{let e=await A.exportConfig(!0);if(!e.success||!e.data){l.value=e.error||`Export failed`;return}let t=new Blob([JSON.stringify(e.data,null,2)],{type:`application/json`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`pymc-repeater-full-backup-${(e.data.meta?.exported_at||new Date().toISOString()).replace(/[:.]/g,`-`)}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n),c.value=`Full backup exported (includes all secrets).`,o.value=!1}catch(e){l.value=e instanceof Error?e.message:`Export failed`}finally{s.value=!1}}let f=E(null),p=E(null),m=E(!1),h=E(!1),_=E(``),T=E(``),D=E(null),O=v(()=>p.value?.config?Object.keys(p.value.config).join(`, `):``),k=v(()=>{let e=p.value?.meta?.includes_secrets;return e===!0||e===`true`});function j(e){let t=e.target.files?.[0];if(!t)return;f.value=t,p.value=null,m.value=!1,_.value=``,T.value=``;let n=new FileReader;n.onload=e=>{try{let t=JSON.parse(e.target?.result);t.config&&typeof t.config==`object`?p.value={meta:t.meta,config:t.config}:typeof t==`object`&&!Array.isArray(t)?p.value={config:t}:T.value=`Invalid file format — expected a JSON config object.`}catch{T.value=`Invalid JSON file.`}},n.readAsText(t)}function M(){m.value=!1,p.value=null,f.value=null,D.value&&(D.value.value=``)}async function N(){if(p.value?.config){h.value=!0,_.value=``,T.value=``;try{let e=await A.importConfig(p.value.config);if(e.success){let t=e.data,n=e.message||t?.message||`Configuration imported.`;t?.restart_required&&(n+=` A service restart is required for radio changes to take effect.`),_.value=n,m.value=!1,p.value=null,f.value=null,D.value&&(D.value.value=``)}else T.value=e.error||`Import failed`}catch(e){T.value=e instanceof Error?e.message:`Import failed`}finally{h.value=!1}}}let P=E(!1),F=E(!1),I=E(null),L=E(``);async function R(){F.value=!0,L.value=``;try{let e=await A.exportIdentityKey();if(!e.success||!e.data){L.value=e.error||`Export failed`;return}I.value=e.data;let t=new Blob([e.data.identity_key_hex],{type:`text/plain`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`pymc-identity-${e.data.node_address||`key`}.hex`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}catch(e){L.value=e instanceof Error?e.message:`Export failed`}finally{F.value=!1}}return(e,v)=>(w(),C(`div`,Ms,[t.value?(w(),C(`div`,Ns,[...v[6]||=[d(`<div class="flex items-start gap-3"><svg class="w-6 h-6 text-red-600 dark:text-red-400 shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"></path></svg><div><h4 class="text-sm font-semibold text-red-700 dark:text-red-400"> Unencrypted Connection </h4><p class="text-xs text-red-600 dark:text-red-400/80 mt-1"> This page is served over <strong>HTTP</strong>, not HTTPS. Exported data (including identity keys) will be transmitted in <strong>plain text</strong>. Only use these features on a trusted local network. </p></div></div>`,1)]])):g(``,!0),S(`div`,Ps,[v[9]||=S(`div`,{class:`flex items-start justify-between mb-4`},[S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` Export Settings `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},[y(` Download the current configuration as a JSON file. Passwords, JWT secrets, and identity keys are `),S(`strong`,null,`redacted`),y(`. Safe to share or use as a template for other devices. `)])])],-1),S(`button`,{onClick:a,disabled:n.value,class:`px-4 py-2 bg-cyan-500/20 dark:bg-primary/20 hover:bg-cyan-500/30 dark:hover:bg-primary/30 text-cyan-900 dark:text-white rounded-lg border border-cyan-500/50 dark:border-primary/50 transition-colors disabled:opacity-50 disabled:cursor-not-allowed text-sm`},[n.value?(w(),C(`span`,Is,[...v[7]||=[S(`span`,{class:`animate-spin w-4 h-4 border-2 border-current border-t-transparent rounded-full inline-block`},null,-1),y(` Exporting… `,-1)]])):(w(),C(`span`,Ls,[...v[8]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4`})],-1),y(` Export Settings `,-1)]]))],8,Fs),r.value?(w(),C(`p`,Rs,b(r.value),1)):g(``,!0),i.value?(w(),C(`p`,zs,b(i.value),1)):g(``,!0)]),S(`div`,Bs,[v[15]||=d(`<div class="flex items-start justify-between mb-4"><div><h3 class="text-lg font-semibold text-content-primary dark:text-content-primary mb-1"> Full Backup </h3><p class="text-sm text-content-secondary dark:text-content-muted"> Download a complete backup including <strong>all passwords, JWT secrets, and identity keys</strong>. Required for restoring to a new device or recovering from a failed SD card. </p></div></div><div class="rounded-lg border border-red-500/30 dark:border-red-400/30 bg-red-50 dark:bg-red-500/10 p-3 mb-4"><p class="text-xs text-red-700 dark:text-red-400"><strong>Contains sensitive data.</strong> The backup file will include plain-text passwords and private keys. Store it securely and never share it. </p></div>`,2),o.value?g(``,!0):(w(),C(`div`,Vs,[S(`button`,{onClick:v[0]||=e=>o.value=!0,class:`px-4 py-2 bg-red-500/20 dark:bg-red-400/20 hover:bg-red-500/30 dark:hover:bg-red-400/30 text-red-900 dark:text-red-200 rounded-lg border border-red-500/50 dark:border-red-400/40 transition-colors text-sm`},[...v[10]||=[S(`span`,{class:`flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z`})]),y(` Full Backup `)],-1)]])])),o.value?(w(),C(`div`,Hs,[S(`div`,Us,[v[14]||=S(`svg`,{class:`w-5 h-5 text-red-600 dark:text-red-400 shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z`})],-1),S(`div`,Ws,[v[13]||=S(`h4`,{class:`text-sm font-semibold text-red-700 dark:text-red-400`},` Confirm Full Backup `,-1),S(`p`,Gs,[v[11]||=y(` This will export `,-1),v[12]||=S(`strong`,null,`all secrets in plain text`,-1),y(` including admin/guest passwords, JWT secret, and your repeater's private identity key`+b(t.value?` over an unencrypted HTTP connection`:``)+`. `,1)]),S(`div`,Ks,[S(`button`,{onClick:u,disabled:s.value,class:`px-4 py-2 bg-red-600 hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600 text-white rounded-lg transition-colors text-sm disabled:opacity-50`},b(s.value?`Exporting…`:`Yes, Export Full Backup`),9,qs),S(`button`,{onClick:v[1]||=e=>o.value=!1,disabled:s.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 text-sm`},` Cancel `,8,Js)])])])])):g(``,!0),c.value?(w(),C(`p`,Ys,b(c.value),1)):g(``,!0),l.value?(w(),C(`p`,Xs,b(l.value),1)):g(``,!0)]),S(`div`,Zs,[v[29]||=S(`div`,{class:`flex items-start justify-between mb-4`},[S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` Import Configuration `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},[y(` Restore configuration from a previously exported JSON file. Importing a `),S(`strong`,null,`full backup`),y(` will also restore passwords and identity keys. Importing a `),S(`strong`,null,`settings export`),y(` will only update non-sensitive settings. `)])])],-1),S(`div`,Qs,[S(`label`,$s,[v[16]||=S(`svg`,{class:`w-5 h-5 text-content-secondary dark:text-content-muted`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12`})],-1),S(`span`,ec,b(f.value?f.value.name:`Choose a config JSON file…`),1),S(`input`,{ref_key:`fileInputRef`,ref:D,type:`file`,accept:`.json,application/json`,class:`hidden`,onChange:j},null,544)]),p.value?(w(),C(`div`,tc,[v[20]||=S(`h4`,{class:`text-sm font-medium text-content-primary dark:text-content-primary mb-2`},` Import Preview `,-1),p.value.meta?(w(),C(`div`,nc,[S(`p`,null,[v[17]||=y(` Exported: `,-1),S(`span`,rc,b(p.value.meta.exported_at),1)]),S(`p`,null,[v[18]||=y(` Version: `,-1),S(`span`,ic,b(p.value.meta.version),1)]),p.value.meta.includes_secrets===`true`||p.value.meta.includes_secrets===!0?(w(),C(`p`,ac,` ⚠ Full backup — will restore passwords and identity keys `)):(w(),C(`p`,oc,` Settings only — existing secrets will not be changed `))])):g(``,!0),S(`p`,sc,[v[19]||=y(` Sections: `,-1),S(`span`,cc,b(O.value),1)])])):g(``,!0),p.value&&!m.value?(w(),C(`div`,lc,[S(`button`,{onClick:v[2]||=e=>m.value=!0,class:`px-4 py-2 bg-amber-500/20 dark:bg-amber-400/20 hover:bg-amber-500/30 dark:hover:bg-amber-400/30 text-amber-900 dark:text-amber-200 rounded-lg border border-amber-500/50 dark:border-amber-400/40 transition-colors text-sm`},` Review & Import `)])):g(``,!0),m.value?(w(),C(`div`,uc,[S(`div`,dc,[v[28]||=S(`svg`,{class:`w-5 h-5 text-amber-600 dark:text-amber-400 shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z`})],-1),S(`div`,fc,[v[27]||=S(`h4`,{class:`text-sm font-semibold text-amber-800 dark:text-amber-300`},` Confirm Import `,-1),S(`p`,pc,[v[24]||=y(` This will overwrite current settings for: `,-1),S(`strong`,null,b(O.value),1),v[25]||=y(`. `,-1),k.value?(w(),C(x,{key:0},[v[21]||=y(` This is a full backup — `,-1),v[22]||=S(`strong`,null,`passwords, JWT secrets, and identity keys will also be overwritten`,-1),v[23]||=y(`. `,-1)],64)):(w(),C(x,{key:1},[y(` Passwords and identity keys will not be changed. `)],64)),v[26]||=y(` Some changes (radio settings) require a service restart. `,-1)]),S(`div`,mc,[S(`button`,{onClick:N,disabled:h.value,class:`px-4 py-2 bg-amber-600 hover:bg-amber-700 dark:bg-amber-500 dark:hover:bg-amber-600 text-white rounded-lg transition-colors text-sm disabled:opacity-50`},b(h.value?`Importing…`:`Yes, Import`),9,hc),S(`button`,{onClick:M,disabled:h.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 text-sm`},` Cancel `,8,gc)])])])])):g(``,!0),_.value?(w(),C(`p`,_c,b(_.value),1)):g(``,!0),T.value?(w(),C(`p`,vc,b(T.value),1)):g(``,!0)])]),S(`div`,yc,[v[38]||=d(`<div class="flex items-start justify-between mb-4"><div><h3 class="text-lg font-semibold text-content-primary dark:text-content-primary mb-1"> Export Identity Key </h3><p class="text-sm text-content-secondary dark:text-content-muted"> Download the repeater's private identity key for backup. This key determines the node's address and cryptographic identity on the mesh. </p></div></div><div class="rounded-lg border border-red-500/30 dark:border-red-400/30 bg-red-50 dark:bg-red-500/10 p-3 mb-4"><p class="text-xs text-red-700 dark:text-red-400"><strong>Sensitive data.</strong> The identity key is the repeater's private key. Anyone with this key can impersonate your node. Store the exported file securely and never share it. </p></div>`,2),P.value?g(``,!0):(w(),C(`div`,bc,[S(`button`,{onClick:v[3]||=e=>P.value=!0,class:`px-4 py-2 bg-red-500/20 dark:bg-red-400/20 hover:bg-red-500/30 dark:hover:bg-red-400/30 text-red-900 dark:text-red-200 rounded-lg border border-red-500/50 dark:border-red-400/40 transition-colors text-sm`},[...v[30]||=[S(`span`,{class:`flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z`})]),y(` Export Identity Key `)],-1)]])])),P.value&&!I.value?(w(),C(`div`,xc,[S(`div`,Sc,[v[32]||=S(`svg`,{class:`w-5 h-5 text-red-600 dark:text-red-400 shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z`})],-1),S(`div`,Cc,[v[31]||=S(`h4`,{class:`text-sm font-semibold text-red-700 dark:text-red-400`},`Are you sure?`,-1),S(`p`,wc,` This will transmit your private key `+b(t.value?`over an unencrypted HTTP connection. `:``)+` and download it as a file. `,1),S(`div`,Tc,[S(`button`,{onClick:R,disabled:F.value,class:`px-4 py-2 bg-red-600 hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600 text-white rounded-lg transition-colors text-sm disabled:opacity-50`},b(F.value?`Exporting…`:`Yes, Export Key`),9,Ec),S(`button`,{onClick:v[4]||=e=>P.value=!1,disabled:F.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 text-sm`},` Cancel `,8,Dc)])])])])):g(``,!0),I.value?(w(),C(`div`,Oc,[S(`div`,kc,[v[33]||=S(`h4`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},` Key Exported `,-1),S(`button`,{onClick:v[5]||=e=>{I.value=null,P.value=!1},class:`text-xs text-content-muted hover:text-content-secondary transition-colors`},` Dismiss `)]),S(`div`,Ac,[S(`p`,null,[v[34]||=y(` Key length: `,-1),S(`span`,jc,b(I.value.key_length_bytes)+` bytes`,1)]),I.value.node_address?(w(),C(`p`,Mc,[v[35]||=y(` Node address: `,-1),S(`span`,Nc,b(I.value.node_address),1)])):g(``,!0),I.value.public_key_hex?(w(),C(`p`,Pc,[v[36]||=y(` Public key: `,-1),S(`span`,Fc,b(I.value.public_key_hex),1)])):g(``,!0)]),v[37]||=S(`p`,{class:`text-xs text-green-600 dark:text-green-400`},`File downloaded successfully.`,-1)])):g(``,!0),L.value?(w(),C(`p`,Ic,b(L.value),1)):g(``,!0)])]))}}),Rc={class:`space-y-6`},zc={class:`glass-card rounded-lg border border-stroke-subtle dark:border-stroke/10 p-6`},Bc={class:`flex items-start justify-between mb-4`},Vc=[`disabled`],Hc={key:0,class:`flex items-center gap-1.5`},Uc={key:1},Wc={key:0,class:`grid grid-cols-2 sm:grid-cols-4 gap-3 mb-6`},Gc={class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},Kc={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},qc={class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},Jc={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},Yc={class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},Xc={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},Zc={class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},Qc={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},$c={key:1,class:`flex items-center justify-center py-12`},el={key:2,class:`rounded-lg border border-red-500/30 dark:border-red-400/30 bg-red-50 dark:bg-red-500/10 p-3 mb-4`},tl={class:`text-xs text-red-700 dark:text-red-400`},nl={key:3},rl={class:`overflow-x-auto`},il={class:`w-full text-sm`},al={class:`py-2.5 pr-4`},ol={class:`font-mono text-content-primary dark:text-content-primary`},sl={class:`py-2.5 pr-4 text-right`},cl={class:`font-mono text-content-secondary dark:text-content-muted`},ll={class:`py-2.5 pr-4 text-right hidden sm:table-cell`},ul={key:0,class:`text-xs text-content-muted`},dl={class:`text-content-muted/60 ml-1`},fl={key:1,class:`text-xs text-content-muted/50`},pl={key:2,class:`text-xs text-content-muted/50`},ml={class:`py-2.5 text-right`},hl=[`onClick`,`disabled`],gl={key:0,class:`flex items-center gap-1`},_l={key:1},vl={key:1,class:`text-xs text-content-muted/50`},yl={key:0,class:`glass-card rounded-lg border-2 border-red-500/50 dark:border-red-400/40 bg-red-50 dark:bg-red-500/10 p-6`},bl={class:`flex items-start gap-3`},xl={class:`flex-1`},Sl={class:`text-sm font-semibold text-red-700 dark:text-red-400`},Cl={class:`text-xs text-red-600 dark:text-red-400/80 mt-1`},wl={class:`flex gap-2 mt-3`},Tl=[`disabled`],El=[`disabled`],Dl={class:`glass-card rounded-lg border border-stroke-subtle dark:border-stroke/10 p-6`},Ol={class:`flex flex-wrap gap-3`},kl=[`disabled`],Al=[`disabled`],jl={class:`flex items-center gap-2`},Ml={key:0,class:`text-xs text-green-600 dark:text-green-400 mt-3`},Nl={key:1,class:`text-xs text-green-600 dark:text-green-400 mt-3`},Pl=f({__name:`DatabaseManagement`,setup(e){let t=new Set([`packets`,`adverts`,`noise_floor`,`crc_errors`,`room_messages`,`room_client_sync`,`companion_contacts`,`companion_channels`,`companion_messages`,`companion_prefs`]),n=E(!1),r=E(``),a=E(null),o=E({}),c=E(null),l=E(``),u=E(!1),d=E(``),f=v(()=>a.value?a.value.tables.reduce((e,t)=>e+t.row_count,0):0);function p(e){return t.has(e)}function m(e){if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r<10?r.toFixed(1):Math.round(r)} ${t[n]}`}function h(e){return e?new Date(e*1e3).toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`}):`—`}function _(e,t){return!e||!t?0:Math.max(1,Math.round((t-e)/86400))}async function T(){n.value=!0,r.value=``;try{let e=await A.getDbStats();e.success&&e.data?a.value=e.data:r.value=e.error||`Failed to load database stats`}catch(e){r.value=e instanceof Error?e.message:`Failed to load database stats`}finally{n.value=!1}}function D(e,t){l.value=``,c.value={table:e,rowCount:t,executing:!1}}async function O(){if(!c.value)return;let{table:e}=c.value;c.value.executing=!0,l.value=``;try{let t=e===`all`?`all`:[e];e!==`all`&&(o.value[e]=!0);let n=await A.purgeTable(t);if(n.success){let t=n.data||{};l.value=`Deleted ${Object.values(t).reduce((e,t)=>e+(t.deleted||0),0).toLocaleString()} rows${e===`all`?` from all tables`:` from ${e}`}.`,c.value=null,await T()}else r.value=n.error||`Purge failed`,c.value=null}catch(e){r.value=e instanceof Error?e.message:`Purge failed`,c.value=null}finally{e!==`all`&&(o.value[e]=!1)}}async function k(){u.value=!0,d.value=``,r.value=``;try{let e=await A.vacuumDb();if(e.success&&e.data){let t=e.data.freed_bytes;d.value=t>0?`Compacted database — freed ${m(t)} (${m(e.data.size_before)} → ${m(e.data.size_after)}).`:`Database already compact (${m(e.data.size_after)}).`,await T()}else r.value=e.error||`Vacuum failed`}catch(e){r.value=e instanceof Error?e.message:`Vacuum failed`}finally{u.value=!1}}return s(T),(e,t)=>(w(),C(`div`,Rc,[S(`div`,zc,[S(`div`,Bc,[t[3]||=S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` Database Overview `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},` Storage usage and table statistics for the repeater database. `)],-1),S(`button`,{onClick:T,disabled:n.value,class:`px-3 py-1.5 bg-cyan-500/20 dark:bg-primary/20 hover:bg-cyan-500/30 dark:hover:bg-primary/30 text-cyan-900 dark:text-white rounded-lg border border-cyan-500/50 dark:border-primary/50 transition-colors text-sm disabled:opacity-50`},[n.value?(w(),C(`span`,Hc,[...t[2]||=[S(`span`,{class:`animate-spin w-3.5 h-3.5 border-2 border-current border-t-transparent rounded-full inline-block`},null,-1),y(` Loading… `,-1)]])):(w(),C(`span`,Uc,`Refresh`))],8,Vc)]),a.value?(w(),C(`div`,Wc,[S(`div`,Gc,[t[4]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Database Size`,-1),S(`p`,Kc,b(m(a.value.database_size_bytes)),1)]),S(`div`,qc,[t[5]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`RRD Metrics`,-1),S(`p`,Jc,b(m(a.value.rrd_size_bytes)),1)]),S(`div`,Yc,[t[6]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Total Size`,-1),S(`p`,Xc,b(m(a.value.database_size_bytes+a.value.rrd_size_bytes)),1)]),S(`div`,Zc,[t[7]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Total Rows`,-1),S(`p`,Qc,b(f.value.toLocaleString()),1)])])):g(``,!0),n.value&&!a.value?(w(),C(`div`,$c,[...t[8]||=[S(`div`,{class:`text-center`},[S(`div`,{class:`animate-spin w-8 h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-cyan-500 dark:border-t-primary rounded-full mx-auto mb-4`}),S(`div`,{class:`text-content-secondary dark:text-content-muted`},`Loading database info…`)],-1)]])):g(``,!0),r.value?(w(),C(`div`,el,[S(`p`,tl,b(r.value),1)])):g(``,!0),a.value&&a.value.tables.length>0?(w(),C(`div`,nl,[S(`div`,rl,[S(`table`,il,[t[10]||=S(`thead`,null,[S(`tr`,{class:`border-b border-stroke-subtle dark:border-stroke/10`},[S(`th`,{class:`text-left py-2 pr-4 text-xs font-medium text-content-muted uppercase tracking-wider`},` Table `),S(`th`,{class:`text-right py-2 pr-4 text-xs font-medium text-content-muted uppercase tracking-wider`},` Rows `),S(`th`,{class:`text-right py-2 pr-4 text-xs font-medium text-content-muted uppercase tracking-wider hidden sm:table-cell`},` Date Range `),S(`th`,{class:`text-right py-2 text-xs font-medium text-content-muted uppercase tracking-wider`},` Actions `)])],-1),S(`tbody`,null,[(w(!0),C(x,null,i(a.value.tables,e=>(w(),C(`tr`,{key:e.name,class:`border-b border-stroke-subtle/50 dark:border-stroke/5`},[S(`td`,al,[S(`span`,ol,b(e.name),1)]),S(`td`,sl,[S(`span`,cl,b(e.row_count.toLocaleString()),1)]),S(`td`,ll,[e.has_timestamp&&e.row_count>0?(w(),C(`span`,ul,[y(b(h(e.oldest_timestamp))+` — `+b(h(e.newest_timestamp))+` `,1),S(`span`,dl,`(`+b(_(e.oldest_timestamp,e.newest_timestamp))+`d)`,1)])):e.row_count===0?(w(),C(`span`,fl,`—`)):(w(),C(`span`,pl,`n/a`))]),S(`td`,ml,[p(e.name)&&e.row_count>0?(w(),C(`button`,{key:0,onClick:t=>D(e.name,e.row_count),disabled:o.value[e.name],class:`px-2.5 py-1 bg-red-500/10 dark:bg-red-400/10 hover:bg-red-500/20 dark:hover:bg-red-400/20 text-red-700 dark:text-red-400 rounded border border-red-500/30 dark:border-red-400/20 transition-colors text-xs disabled:opacity-50`},[o.value[e.name]?(w(),C(`span`,gl,[...t[9]||=[S(`span`,{class:`animate-spin w-3 h-3 border border-current border-t-transparent rounded-full inline-block`},null,-1),y(` Purging… `,-1)]])):(w(),C(`span`,_l,`Empty`))],8,hl)):p(e.name)?g(``,!0):(w(),C(`span`,vl,`—`))])]))),128))])])])])):g(``,!0)]),c.value?(w(),C(`div`,yl,[S(`div`,bl,[t[16]||=S(`svg`,{class:`w-5 h-5 text-red-600 dark:text-red-400 shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z`})],-1),S(`div`,xl,[S(`h4`,Sl,b(c.value.table===`all`?`Confirm Purge All Tables`:`Confirm Purge "${c.value.table}"`),1),S(`p`,Cl,[c.value.table===`all`?(w(),C(x,{key:0},[t[11]||=y(` This will permanently delete `,-1),t[12]||=S(`strong`,null,`all data`,-1),y(` from every data table (`+b(f.value.toLocaleString())+` rows total). This cannot be undone. `,1)],64)):(w(),C(x,{key:1},[t[13]||=y(` This will permanently delete `,-1),S(`strong`,null,b(c.value.rowCount.toLocaleString())+` rows`,1),t[14]||=y(` from `,-1),S(`strong`,null,b(c.value.table),1),t[15]||=y(`. This cannot be undone. `,-1)],64))]),S(`div`,wl,[S(`button`,{onClick:O,disabled:c.value.executing,class:`px-4 py-2 bg-red-600 hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600 text-white rounded-lg transition-colors text-sm disabled:opacity-50`},b(c.value.executing?`Purging…`:`Yes, Delete Data`),9,Tl),S(`button`,{onClick:t[0]||=e=>c.value=null,disabled:c.value.executing,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 text-sm`},` Cancel `,8,El)])])])])):g(``,!0),S(`div`,Dl,[t[19]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4`},` Maintenance `,-1),S(`div`,Ol,[S(`button`,{onClick:t[1]||=e=>D(`all`,f.value),disabled:!a.value||f.value===0,class:`px-4 py-2 bg-red-500/20 dark:bg-red-400/20 hover:bg-red-500/30 dark:hover:bg-red-400/30 text-red-900 dark:text-red-200 rounded-lg border border-red-500/50 dark:border-red-400/40 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed`},[...t[17]||=[S(`span`,{class:`flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16`})]),y(` Purge All Data `)],-1)]],8,kl),S(`button`,{onClick:k,disabled:u.value||!a.value,class:`px-4 py-2 bg-amber-500/20 dark:bg-amber-400/20 hover:bg-amber-500/30 dark:hover:bg-amber-400/30 text-amber-900 dark:text-amber-200 rounded-lg border border-amber-500/50 dark:border-amber-400/40 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed`},[S(`span`,jl,[t[18]||=S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,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`})],-1),y(` `+b(u.value?`Compacting…`:`Compact Database`),1)])],8,Al)]),d.value?(w(),C(`p`,Ml,b(d.value),1)):g(``,!0),l.value?(w(),C(`p`,Nl,b(l.value),1)):g(``,!0)])]))}}),Fl={class:`space-y-6`},Il={class:`glass-card rounded-lg border border-stroke-subtle dark:border-stroke/10 p-6`},Ll={class:`flex items-start justify-between mb-4`},Rl={class:`flex items-center gap-2`},zl=[`disabled`],Bl={key:0,class:`flex items-center gap-1.5`},Vl={key:1},Hl=[`disabled`],Ul={key:0,class:`flex items-center gap-1.5`},Wl={key:1},Gl={key:0,class:`mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/30 text-red-600 dark:text-red-400 text-sm`},Kl={key:1,class:`mb-4`},ql={class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10 inline-block`},Jl={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},Yl={key:2,class:`p-4 rounded-lg bg-cyan-500/10 dark:bg-primary/10 border border-cyan-400/30 dark:border-primary/30`},Xl={key:3},Zl=[`innerHTML`],Ql={class:`font-semibold text-sm`},$l={class:`text-sm mt-0.5 opacity-80`},eu={class:`grid grid-cols-2 sm:grid-cols-3 gap-3 mb-6`},tu={key:0,class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},nu={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},ru={key:1,class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},iu={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},au={key:2,class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},ou={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},su={key:0,class:`mb-6`},cu={class:`space-y-2`},lu={class:`flex items-start justify-between gap-3`},uu={class:`flex items-center gap-2 min-w-0`},du={class:`shrink-0 text-xs font-medium text-content-muted w-5 text-right`},fu={class:`text-right shrink-0`},pu={class:`text-xs text-content-muted`},mu={class:`mt-1.5 ml-7`},hu={class:`text-xs font-mono text-content-secondary dark:text-content-muted break-all`},gu={key:0,class:`text-xs text-content-muted mt-0.5`},_u={key:1,class:`mb-6 p-4 rounded-lg bg-green-500/10 border border-green-500/30 text-sm flex items-center gap-3`},vu={key:2},yu={key:0,class:`overflow-x-auto rounded-lg border border-stroke-subtle dark:border-stroke/10`},bu={class:`w-full text-sm`},xu={class:`px-3 py-2 text-content-muted font-mono text-xs`},Su={class:`px-3 py-2 text-content-primary dark:text-content-primary font-mono text-xs break-all`},Cu={class:`px-3 py-2 text-right font-mono text-xs text-content-secondary dark:text-content-muted whitespace-nowrap`},wu={class:`px-3 py-2 text-right font-mono text-xs text-content-secondary dark:text-content-muted`},Tu={key:4,class:`py-8 text-center text-content-muted text-sm`},Eu=M(f({__name:`MemoryDebug`,setup(e){let n=E(!1),r=E(!1),a=E(``),o=E(null),c=E(!1),l=E(null),f=E(!1),p=v(()=>o.value&&(o.value.current_top_20||o.value.growth_since_baseline));async function m(){n.value=!0,a.value=``;try{let e=await A.get(`memory_debug`);e.success&&e.data?(c.value=!!e.data.tracing,l.value=e.data.rss_mb??null,(e.data.current_top_20||e.data.growth_since_baseline)&&(o.value=e.data)):a.value=e.error||`Failed to fetch memory status`}catch(e){a.value=e instanceof Error?e.message:`Failed to fetch memory status`}finally{n.value=!1}}async function h(){r.value=!0,a.value=``;let e=c.value?`stop`:`start`;try{let t=await A.post(`memory_debug`,{action:e});t.success&&t.data?(c.value=!!t.data.tracing,e===`stop`&&(o.value=null,l.value=null)):a.value=t.error||`Failed to ${e} tracing`}catch(t){a.value=t instanceof Error?t.message:`Failed to ${e} tracing`}finally{r.value=!1,c.value&&await m()}}function T(e){return e.size_diff_kb>=100?`critical`:e.size_diff_kb>=10?`warning`:e.size_diff_kb>=1?`low`:`ok`}function D(e){let t=T(e);return t===`critical`?`Investigate`:t===`warning`?`Watch`:t===`low`?`Minor`:`Normal`}function O(e){let t=T(e);return t===`critical`?`bg-red-500/20 text-red-700 dark:text-red-400 border border-red-500/30`:t===`warning`?`bg-amber-500/20 text-amber-700 dark:text-amber-400 border border-amber-500/30`:t===`low`?`bg-blue-500/15 text-blue-600 dark:text-blue-400 border border-blue-500/20`:`bg-green-500/15 text-green-700 dark:text-green-400 border border-green-500/20`}function k(e){let t=T(e);return t===`critical`?`border-red-500/40 dark:border-red-500/30 bg-red-500/5 dark:bg-red-500/5`:t===`warning`?`border-amber-500/40 dark:border-amber-500/30 bg-amber-500/5 dark:bg-amber-500/5`:t===`low`?`border-stroke-subtle dark:border-stroke/10 bg-background-mute/50 dark:bg-background/20`:`border-stroke-subtle/50 dark:border-stroke/5 bg-background-mute/30 dark:bg-background/10 opacity-60`}function j(e){let t=T(e);return t===`critical`?`text-red-600 dark:text-red-400`:t===`warning`?`text-amber-600 dark:text-amber-400`:t===`low`?`text-blue-600 dark:text-blue-400`:`text-green-600 dark:text-green-500`}function M(e){return e>=1024?`${(e/1024).toFixed(1)} MB`:e>=10?`${Math.round(e)} KB`:`${e.toFixed(1)} KB`}function P(e){return e.replace(/.*\/site-packages\//,``).replace(/.*\/lib\/python[^/]*\//,``).replace(/.*\/repeater\//,`repeater/`)}let F=v(()=>o.value?.growth_since_baseline?o.value.growth_since_baseline.reduce((e,t)=>e+t.size_diff_kb,0):0),I=v(()=>F.value>=500?`critical`:F.value>=50?`warning`:F.value>=5?`low`:`ok`),L=v(()=>{let e=I.value;return e===`critical`?`border-red-500/40 dark:border-red-500/30 bg-red-500/10 dark:bg-red-500/10 text-red-800 dark:text-red-300`:e===`warning`?`border-amber-500/40 dark:border-amber-500/30 bg-amber-500/10 dark:bg-amber-500/10 text-amber-800 dark:text-amber-300`:e===`low`?`border-blue-500/30 bg-blue-500/10 dark:bg-blue-500/10 text-blue-800 dark:text-blue-300`:`border-green-500/30 bg-green-500/10 dark:bg-green-500/10 text-green-800 dark:text-green-300`}),R=v(()=>{let e=I.value;return e===`critical`?`<svg class="w-5 h-5 text-red-600 dark:text-red-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.34 16.5c-.77.833.192 2.5 1.732 2.5z"/></svg>`:e===`warning`?`<svg class="w-5 h-5 text-amber-600 dark:text-amber-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.34 16.5c-.77.833.192 2.5 1.732 2.5z"/></svg>`:e===`low`?`<svg class="w-5 h-5 text-blue-600 dark:text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>`:`<svg class="w-5 h-5 text-green-600 dark:text-green-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><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"/></svg>`}),z=v(()=>{let e=I.value;return e===`critical`?`Significant memory growth detected`:e===`warning`?`Some memory growth detected`:e===`low`?`Minor memory growth — likely normal`:`Memory looks healthy`}),B=v(()=>{let e=M(F.value),t=I.value;return t===`critical`?`Total growth: ${e}. Red items below need attention.`:t===`warning`?`Total growth: ${e}. Orange items below may need attention over time.`:t===`low`?`Total growth: ${e}. Nothing to worry about right now.`:`No significant growth since tracing started.`});return s(m),(e,s)=>(w(),C(`div`,Fl,[S(`div`,Il,[S(`div`,Ll,[s[3]||=S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` Memory Diagnostics `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},` Trace memory allocations to find leaks. Tracing adds overhead — only enable when needed. `)],-1),S(`div`,Rl,[c.value&&p.value?(w(),C(`button`,{key:0,onClick:m,disabled:n.value,class:`px-3 py-1.5 bg-cyan-500/20 dark:bg-primary/20 hover:bg-cyan-500/30 dark:hover:bg-primary/30 text-cyan-900 dark:text-white rounded-lg border border-cyan-500/50 dark:border-primary/50 transition-colors text-sm disabled:opacity-50`},[n.value?(w(),C(`span`,Bl,[...s[1]||=[S(`span`,{class:`animate-spin w-3.5 h-3.5 border-2 border-current border-t-transparent rounded-full inline-block`},null,-1),y(` Checking… `,-1)]])):(w(),C(`span`,Vl,`Check Again`))],8,zl)):g(``,!0),S(`button`,{onClick:h,disabled:r.value,class:u([`px-3 py-1.5 rounded-lg border text-sm transition-colors disabled:opacity-50`,c.value?`bg-red-500/20 hover:bg-red-500/30 text-red-700 dark:text-red-400 border-red-500/50`:`bg-green-500/20 hover:bg-green-500/30 text-green-700 dark:text-green-400 border-green-500/50`])},[r.value?(w(),C(`span`,Ul,[s[2]||=S(`span`,{class:`animate-spin w-3.5 h-3.5 border-2 border-current border-t-transparent rounded-full inline-block`},null,-1),y(` `+b(c.value?`Stopping…`:`Starting…`),1)])):(w(),C(`span`,Wl,b(c.value?`Stop Tracing`:`Start Tracing`),1))],10,Hl)])]),a.value?(w(),C(`div`,Gl,b(a.value),1)):g(``,!0),!c.value&&l.value!==null&&!n.value?(w(),C(`div`,Kl,[S(`div`,ql,[s[4]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Current Memory (RSS)`,-1),S(`p`,Jl,b(l.value)+` MB`,1)])])):g(``,!0),c.value&&!p.value&&!n.value?(w(),C(`div`,Yl,[...s[5]||=[d(`<div class="flex items-center gap-2 text-cyan-700 dark:text-primary" data-v-50d93367><svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" data-v-50d93367><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" data-v-50d93367></path></svg><span class="font-medium" data-v-50d93367>Tracing active</span></div><p class="mt-2 text-sm text-cyan-600 dark:text-primary/80" data-v-50d93367> Memory tracing is running. Let the repeater run for a few minutes, then click <strong data-v-50d93367>Check Again</strong> to see which parts of the code are using more memory. </p>`,2)]])):g(``,!0),o.value&&p.value?(w(),C(`div`,Xl,[S(`div`,{class:u([`mb-5 p-4 rounded-lg border flex items-start gap-3`,L.value])},[S(`div`,{class:`mt-0.5`,innerHTML:R.value},null,8,Zl),S(`div`,null,[S(`p`,Ql,b(z.value),1),S(`p`,$l,b(B.value),1)])],2),S(`div`,eu,[o.value.rss_mb===void 0?g(``,!0):(w(),C(`div`,tu,[s[6]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Total Memory Used`,-1),S(`p`,nu,b(o.value.rss_mb)+` MB`,1)])),o.value.traced_current_mb===void 0?g(``,!0):(w(),C(`div`,ru,[s[7]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Tracked Now`,-1),S(`p`,iu,b(o.value.traced_current_mb)+` MB`,1)])),o.value.traced_peak_mb===void 0?g(``,!0):(w(),C(`div`,au,[s[8]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Peak Tracked`,-1),S(`p`,ou,b(o.value.traced_peak_mb)+` MB`,1)]))]),o.value.growth_since_baseline&&o.value.growth_since_baseline.length>0?(w(),C(`div`,su,[s[9]||=S(`h4`,{class:`text-sm font-semibold text-content-primary dark:text-content-primary mb-1`},`Memory Growth Breakdown`,-1),s[10]||=S(`p`,{class:`text-xs text-content-muted mb-3`},` Items at the top with red/orange tags are the most likely cause of memory issues. Green items are normal and can be ignored. `,-1),S(`div`,cu,[(w(!0),C(x,null,i(o.value.growth_since_baseline,(e,t)=>(w(),C(`div`,{key:t,class:u([`rounded-lg border p-3 transition-colors`,k(e)])},[S(`div`,lu,[S(`div`,uu,[S(`span`,du,b(t+1),1),S(`span`,{class:u([`shrink-0 inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-semibold`,O(e)])},b(D(e)),3)]),S(`div`,fu,[S(`span`,{class:u([`font-mono text-sm font-semibold`,j(e)])},`+`+b(M(e.size_diff_kb)),3),S(`p`,pu,b(M(e.current_size_kb))+` total`,1)])]),S(`div`,mu,[S(`p`,hu,b(P(e.file)),1),e.count_diff===0?g(``,!0):(w(),C(`p`,gu,b(e.count_diff>0?`+`:``)+b(e.count_diff)+` new allocation`+b(Math.abs(e.count_diff)===1?``:`s`),1))])],2))),128))])])):o.value.growth_since_baseline&&o.value.growth_since_baseline.length===0?(w(),C(`div`,_u,[...s[11]||=[S(`svg`,{class:`w-5 h-5 text-green-600 dark:text-green-400 shrink-0`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})],-1),S(`span`,{class:`text-green-700 dark:text-green-400`},`No memory growth detected. Everything looks healthy.`,-1)]])):g(``,!0),o.value.current_top_20&&o.value.current_top_20.length>0?(w(),C(`div`,vu,[S(`button`,{onClick:s[0]||=e=>f.value=!f.value,class:`flex items-center gap-2 text-sm font-semibold text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors mb-3`},[(w(),C(`svg`,{class:u([`w-4 h-4 transition-transform`,{"rotate-90":f.value}]),fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[...s[12]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 5l7 7-7 7`},null,-1)]],2)),s[13]||=y(` Advanced: Current Top Allocations `,-1)]),_(N,{name:`expand`},{default:t(()=>[f.value?(w(),C(`div`,yu,[S(`table`,bu,[s[14]||=S(`thead`,null,[S(`tr`,{class:`bg-background-mute dark:bg-background/30 text-left`},[S(`th`,{class:`px-3 py-2 text-xs font-medium text-content-muted`},`#`),S(`th`,{class:`px-3 py-2 text-xs font-medium text-content-muted`},`Location`),S(`th`,{class:`px-3 py-2 text-xs font-medium text-content-muted text-right`},`Size`),S(`th`,{class:`px-3 py-2 text-xs font-medium text-content-muted text-right`},`Count`)])],-1),S(`tbody`,null,[(w(!0),C(x,null,i(o.value.current_top_20,(e,t)=>(w(),C(`tr`,{key:t,class:`border-t border-stroke-subtle/50 dark:border-stroke/5 hover:bg-background-mute/50 dark:hover:bg-background/20 transition-colors`},[S(`td`,xu,b(t+1),1),S(`td`,Su,b(P(e.file)),1),S(`td`,Cu,b(M(e.size_kb)),1),S(`td`,wu,b(e.count),1)]))),128))])])])):g(``,!0)]),_:1})])):g(``,!0)])):g(``,!0),!n.value&&!r.value&&!c.value&&!p.value&&!a.value&&l.value===null?(w(),C(`div`,Tu,[...s[15]||=[y(` Click `,-1),S(`strong`,null,`Start Tracing`,-1),y(` to enable memory diagnostics. `,-1),S(`br`,null,null,-1),S(`span`,{class:`text-xs`},`Tracing uses extra memory — remember to stop it when done.`,-1)]])):g(``,!0)])]))}}),[[`__scopeId`,`data-v-50d93367`]]),Du={class:`p-3 sm:p-6 space-y-4 sm:space-y-6`},Ou={class:`glass-card rounded-[15px] z-10 p-3 sm:p-4 border border-cyan-400 dark:border-primary/30 bg-cyan-500/10 dark:bg-primary/10`},ku={class:`text-cyan-700 dark:text-primary text-sm sm:text-base`},Au={class:`mt-1 sm:mt-2 text-cyan-600 dark:text-primary/80`},ju={class:`glass-card rounded-[15px] p-3 sm:p-6`},Mu={class:`relative -mx-3 sm:mx-0 mb-4 sm:mb-6`},Nu={key:0,class:`absolute left-0 top-0 bottom-[1px] w-12 z-10 flex items-center`},Pu={key:0,class:`absolute right-0 top-0 bottom-[1px] w-12 z-10 flex items-center justify-end`},Fu=[`onClick`],Iu={class:`flex items-center gap-1 sm:gap-2`},Lu={key:0,class:`w-3.5 h-3.5 sm:w-4 sm:h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Ru={key:1,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},zu={key:2,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Bu={key:3,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Vu={key:4,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Hu={key:5,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Uu={key:6,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Wu={key:7,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Gu={key:8,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Ku={key:9,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},qu={key:10,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Ju={key:11,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Yu={class:`min-h-[400px]`},Xu={key:0,class:`flex items-center justify-center py-12`},Zu={key:1,class:`flex items-center justify-center py-12`},Qu={class:`text-center`},$u={class:`text-content-secondary dark:text-content-muted text-sm mb-4`},ed={key:2},td=M(f({name:`ConfigurationView`,__name:`Configuration`,setup(e){let n=j(),o=E(H(`configuration_activeTab`,`radio`)),l=E(!1),d=E(null),f=E(!1),p=E(!1);function v(){if(!d.value)return;let e=d.value;p.value=e.scrollLeft>4,f.value=e.scrollLeft<e.scrollWidth-e.clientWidth-4}function T(e){d.value&&d.value.scrollBy({left:e===`right`?150:-150,behavior:`smooth`})}h(o,e=>ee(`configuration_activeTab`,e));let D=[{id:`radio`,label:`Radio Settings`,icon:`radio`},{id:`repeater`,label:`Repeater Settings`,icon:`repeater`},{id:`advert`,label:`Advert Limits`,icon:`advert`},{id:`duty`,label:`Duty Cycle`,icon:`duty`},{id:`delays`,label:`TX Delays`,icon:`delays`},{id:`transport`,label:`Regions/Keys`,icon:`keys`},{id:`api-tokens`,label:`API Tokens`,icon:`tokens`},{id:`web`,label:`Web Options`,icon:`web`},{id:`observer`,label:`Observer`,icon:`observer`},{id:`backup`,label:`Backup`,icon:`backup`},{id:`database`,label:`Database`,icon:`database`},{id:`memory`,label:`Memory`,icon:`memory`}];s(async()=>{try{await n.fetchStats(),l.value=!0}catch(e){console.error(`Failed to load configuration data:`,e),l.value=!0}c(()=>v())});function O(e){o.value=e}return(e,s)=>{let c=r(`router-link`);return w(),C(`div`,Du,[s[24]||=S(`div`,null,[S(`h1`,{class:`text-xl sm:text-2xl font-bold text-content-primary dark:text-content-primary`},` Configuration `),S(`p`,{class:`text-content-secondary dark:text-content-muted mt-1 sm:mt-2 text-sm sm:text-base`},` System configuration and settings `)],-1),S(`div`,Ou,[S(`div`,ku,[s[5]||=S(`strong`,null,`CAD Calibration Tool Available`,-1),S(`p`,Au,[s[4]||=y(` Optimize your Channel Activity Detection settings. `,-1),_(c,{to:`/cad-calibration`,class:`underline hover:text-cyan-800 dark:hover:text-primary transition-colors`},{default:t(()=>[...s[3]||=[y(` Launch CAD Calibration Tool → `,-1)]]),_:1})])])]),S(`div`,ju,[S(`div`,Mu,[_(N,{name:`tab-fade`},{default:t(()=>[p.value?(w(),C(`div`,Nu,[s[7]||=S(`div`,{class:`tab-fade-left absolute inset-0 pointer-events-none`},null,-1),S(`button`,{onClick:s[0]||=e=>T(`left`),class:`relative z-10 ml-1.5 w-6 h-6 flex items-center justify-center rounded-full bg-white dark:bg-zinc-900 shadow-md border border-gray-200 dark:border-white/10 text-gray-500 dark:text-gray-300`},[...s[6]||=[S(`svg`,{class:`w-3 h-3`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2.5`,d:`M15 19l-7-7 7-7`})],-1)]])])):g(``,!0)]),_:1}),_(N,{name:`tab-fade`},{default:t(()=>[f.value?(w(),C(`div`,Pu,[s[9]||=S(`div`,{class:`tab-fade-right absolute inset-0 pointer-events-none`},null,-1),S(`button`,{onClick:s[1]||=e=>T(`right`),class:`relative z-10 mr-1.5 w-6 h-6 flex items-center justify-center rounded-full bg-white dark:bg-zinc-900 shadow-md border border-gray-200 dark:border-white/10 text-gray-500 dark:text-gray-300`},[...s[8]||=[S(`svg`,{class:`w-3 h-3`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2.5`,d:`M9 5l7 7-7 7`})],-1)]])])):g(``,!0)]),_:1}),S(`div`,{ref_key:`tabsContainer`,ref:d,onScroll:v,class:`flex overflow-x-auto border-b border-stroke-subtle dark:border-stroke/10 px-3 sm:px-0 scrollbar-hide`},[(w(),C(x,null,i(D,e=>S(`button`,{key:e.id,onClick:t=>O(e.id),class:u([`px-3 sm:px-4 py-2 text-xs sm:text-sm font-medium transition-colors duration-200 border-b-2 mr-3 sm:mr-6 whitespace-nowrap flex-shrink-0`,o.value===e.id?`text-cyan-500 dark:text-primary border-cyan-500 dark:border-primary`:`text-content-secondary dark:text-content-muted border-transparent hover:text-content-primary dark:hover:text-content-primary hover:border-stroke-subtle dark:hover:border-stroke/30`])},[S(`div`,Iu,[e.icon===`radio`?(w(),C(`svg`,Lu,[...s[10]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.141 0M1.394 9.822c5.716-5.716 14.976-5.716 20.692 0`},null,-1)]])):e.icon===`repeater`?(w(),C(`svg`,Ru,[...s[11]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 12h14M5 12l4-4m-4 4l4 4`},null,-1)]])):e.icon===`advert`?(w(),C(`svg`,zu,[...s[12]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z`},null,-1)]])):e.icon===`duty`?(w(),C(`svg`,Bu,[...s[13]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z`},null,-1)]])):e.icon===`delays`?(w(),C(`svg`,Vu,[...s[14]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z`},null,-1)]])):e.icon===`keys`?(w(),C(`svg`,Hu,[...s[15]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z`},null,-1)]])):e.icon===`tokens`?(w(),C(`svg`,Uu,[...s[16]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z`},null,-1)]])):e.icon===`web`?(w(),C(`svg`,Wu,[...s[17]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9`},null,-1)]])):e.icon===`observer`?(w(),C(`svg`,Gu,[...s[18]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M3.055 11H5a2 2 0 012 2v1a2 2 0 002 2 2 2 0 012 2v2.945M8 3.935V5.5A2.5 2.5 0 0010.5 8h.5a2 2 0 012 2 2 2 0 104 0 2 2 0 012-2h1.064M15 20.488V18a2 2 0 012-2h3.064M21 12a9 9 0 11-18 0 9 9 0 0118 0z`},null,-1)]])):e.icon===`backup`?(w(),C(`svg`,Ku,[...s[19]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4`},null,-1)]])):e.icon===`database`?(w(),C(`svg`,qu,[...s[20]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4`},null,-1)]])):e.icon===`memory`?(w(),C(`svg`,Ju,[...s[21]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z`},null,-1)]])):g(``,!0),y(` `+b(e.label),1)])],10,Fu)),64))],544)]),S(`div`,Yu,[!l.value&&a(n).isLoading?(w(),C(`div`,Xu,[...s[22]||=[S(`div`,{class:`text-center`},[S(`div`,{class:`animate-spin w-8 h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-cyan-500 dark:border-t-primary rounded-full mx-auto mb-4`}),S(`div`,{class:`text-content-secondary dark:text-content-muted`},` Loading configuration... `)],-1)]])):a(n).error&&!l.value?(w(),C(`div`,Zu,[S(`div`,Qu,[s[23]||=S(`div`,{class:`text-red-500 dark:text-red-400 mb-2`},`Failed to load configuration`,-1),S(`div`,$u,b(a(n).error),1),S(`button`,{onClick:s[2]||=e=>a(n).fetchStats(),class:`px-4 py-2 bg-cyan-500/20 dark:bg-primary/20 hover:bg-cyan-500/30 dark:hover:bg-primary/30 text-cyan-900 dark:text-white rounded-lg border border-cyan-500/50 dark:border-primary/50 transition-colors`},` Retry `)])])):(w(),C(`div`,ed,[m(S(`div`,null,[_(ye,{key:`radio-settings`})],512),[[z,o.value===`radio`]]),m(S(`div`,null,[_(St,{key:`repeater-settings`})],512),[[z,o.value===`repeater`]]),m(S(`div`,null,[_(so,{key:`advert-settings`})],512),[[z,o.value===`advert`]]),m(S(`div`,null,[_(Pt,{key:`duty-cycle`})],512),[[z,o.value===`duty`]]),m(S(`div`,null,[_(Jt,{key:`transmission-delays`})],512),[[z,o.value===`delays`]]),m(S(`div`,null,[_(Jr,{key:`transport-keys`})],512),[[z,o.value===`transport`]]),m(S(`div`,null,[_(Si,{key:`api-tokens`})],512),[[z,o.value===`api-tokens`]]),m(S(`div`,null,[_(qi,{key:`web-settings`})],512),[[z,o.value===`web`]]),m(S(`div`,null,[_(js,{key:`letsmesh-settings`})],512),[[z,o.value===`observer`]]),m(S(`div`,null,[_(Lc,{key:`backup-restore`})],512),[[z,o.value===`backup`]]),m(S(`div`,null,[_(Pl,{key:`database-management`})],512),[[z,o.value===`database`]]),m(S(`div`,null,[_(Eu,{key:`memory-debug`})],512),[[z,o.value===`memory`]])]))])])])}}}),[[`__scopeId`,`data-v-e8f5e632`]]);export{td as default}; |