mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-07-06 09:52:37 +02:00
a6170f70ed
- Updated IdentityManager to include public key in identity details when retrieving identities. - Introduced a new method in RepeaterDaemon for adding companions from configuration, supporting hot-reload functionality. - Enhanced error handling for companion registration, ensuring proper validation of identity keys and settings. - Updated API endpoints to include configured companions in the response, improving visibility of companion status and configuration.
3 lines
138 KiB
JavaScript
3 lines
138 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/leaflet-src-BtisrQHC.js","assets/_commonjsHelpers-CqkleIqs.js"])))=>i.map(i=>d[i]);
|
|
import{a as G,M as re,c as B,r as m,D as te,b as r,g as L,e,t as c,F as K,w as S,v as V,h as Z,q as oe,k as U,L as q,p as o,P as we,s as Y,E as ie,S as me,x as pe,f as O,y as de,d as _e,U as ce,j as D,l as ve,N as xe,V as be,T as Ce,i as Q,W as ne,o as ae,u as J,X as $e,Q as ee}from"./index-DyUIpN7m.js";/* empty css */import{_ as Me}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-CVxh_fqf.js";import{g as Ae,s as Se}from"./preferences-DtwbSSgO.js";const je={class:"space-y-4"},Te={key:0,class:"bg-green-100 dark:bg-green-500/20 border border-green-500/50 rounded-lg p-3"},Ne={class:"text-green-600 dark:text-green-400 text-sm"},Be={key:1,class:"bg-red-100 dark:bg-red-500/20 border border-red-500/50 rounded-lg p-3"},Ee={class:"text-red-600 dark:text-red-400 text-sm"},Le={class:"flex justify-end gap-2"},Fe=["disabled"],Pe=["disabled"],ze={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},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"},De={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Ie={key:1,class:"flex items-center gap-2"},He={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"},Ue={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Re={key:1},Ke=["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"},qe={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},We={key:1},Ge=["value"],Qe={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={key:1,class:"flex items-center gap-2"},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"},Ze={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},et={key:1},tt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1"},ot={class:"text-content-primary dark:text-content-primary font-mono text-sm"},rt={key:2,class:"bg-yellow-500/10 dark:bg-yellow-500/10 border border-yellow-500/30 rounded-lg p-3"},st=G({__name:"RadioSettings",setup(I){const _=re(),d=B(()=>_.stats?.config?.radio||{}),v=m(!1),k=m(!1),i=m(null),u=m(null),s=m(0),p=m(0),y=m(0),h=m(0),N=m(0),M=m(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"}];te(d,C=>{C&&!v.value&&(s.value=C.frequency?Number((C.frequency/1e6).toFixed(3)):0,p.value=C.spreading_factor??0,y.value=C.bandwidth?Number((C.bandwidth/1e3).toFixed(1)):0,h.value=C.tx_power??0,N.value=C.coding_rate??0,M.value=C.preamble_length??0)},{immediate:!0});const n=B(()=>{const C=d.value.frequency;return C?(C/1e6).toFixed(3)+" MHz":"Not set"}),t=B(()=>{const C=d.value.bandwidth;return C?(C/1e3).toFixed(1)+" kHz":"Not set"}),a=B(()=>{const C=d.value.tx_power;return C!==void 0?C+" dBm":"Not set"}),A=B(()=>{const C=d.value.coding_rate;return C?"4/"+C:"Not set"}),b=B(()=>{const C=d.value.preamble_length;return C?C+" symbols":"Not set"}),x=B(()=>d.value.spreading_factor??"Not set"),g=()=>{v.value=!0,i.value=null,u.value=null},z=()=>{v.value=!1,i.value=null;const C=d.value;s.value=C.frequency?Number((C.frequency/1e6).toFixed(3)):0,p.value=C.spreading_factor??0,y.value=C.bandwidth?Number((C.bandwidth/1e3).toFixed(1)):0,h.value=C.tx_power??0,N.value=C.coding_rate??0,M.value=C.preamble_length??0},W=async()=>{k.value=!0,i.value=null,u.value=null;try{const C={};s.value&&(C.frequency=s.value*1e6),p.value&&(C.spreading_factor=p.value),y.value&&(C.bandwidth=y.value*1e3),h.value&&(C.tx_power=h.value),N.value&&(C.coding_rate=N.value);const P=(await q.post("/update_radio_config",C)).data;P.message||P.persisted?(u.value=P.message||"Settings saved successfully",v.value=!1,await _.fetchStats(),setTimeout(()=>{u.value=null},3e3)):P.error?i.value=P.error:i.value="Unknown response from server"}catch(C){console.error("Failed to update radio settings:",C);const j=C;i.value=j.response?.data?.error||"Failed to update settings"}finally{k.value=!1}};return(C,j)=>(o(),r("div",je,[u.value?(o(),r("div",Te,[e("p",Ne,c(u.value),1)])):L("",!0),i.value?(o(),r("div",Be,[e("p",Ee,c(i.value),1)])):L("",!0),e("div",Le,[v.value?(o(),r(K,{key:1},[e("button",{onClick:z,disabled:k.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,Fe),e("button",{onClick:W,disabled:k.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"},c(k.value?"Saving...":"Save Changes"),9,Pe)],64)):(o(),r("button",{key:0,onClick:g,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 "))]),e("div",ze,[e("div",Ve,[j[6]||(j[6]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Frequency",-1)),v.value?(o(),r("div",Ie,[S(e("input",{"onUpdate:modelValue":j[0]||(j[0]=P=>s.value=P),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),[[V,s.value,void 0,{number:!0}]]),j[5]||(j[5]=e("span",{class:"text-content-muted dark:text-content-muted text-sm"},"MHz",-1))])):(o(),r("div",De,c(n.value),1))]),e("div",He,[j[7]||(j[7]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Spreading Factor",-1)),v.value?(o(),r("div",Re,[S(e("select",{"onUpdate:modelValue":j[1]||(j[1]=P=>p.value=P),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"},[(o(),r(K,null,Z([5,6,7,8,9,10,11,12],P=>e("option",{key:P,value:P},c(P),9,Ke)),64))],512),[[oe,p.value,void 0,{number:!0}]])])):(o(),r("div",Ue,c(x.value),1))]),e("div",Oe,[j[8]||(j[8]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Bandwidth",-1)),v.value?(o(),r("div",We,[S(e("select",{"onUpdate:modelValue":j[2]||(j[2]=P=>y.value=P),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"},[(o(),r(K,null,Z($,P=>e("option",{key:P.value,value:P.value},c(P.label),9,Ge)),64))],512),[[oe,y.value,void 0,{number:!0}]])])):(o(),r("div",qe,c(t.value),1))]),e("div",Qe,[j[10]||(j[10]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"TX Power",-1)),v.value?(o(),r("div",Xe,[S(e("input",{"onUpdate:modelValue":j[3]||(j[3]=P=>h.value=P),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),[[V,h.value,void 0,{number:!0}]]),j[9]||(j[9]=e("span",{class:"text-content-muted dark:text-content-muted text-sm"},"dBm",-1))])):(o(),r("div",Ye,c(a.value),1))]),e("div",Je,[j[12]||(j[12]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Coding Rate",-1)),v.value?(o(),r("div",et,[S(e("select",{"onUpdate:modelValue":j[4]||(j[4]=P=>N.value=P),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"},j[11]||(j[11]=[e("option",{value:5},"4/5",-1),e("option",{value:6},"4/6",-1),e("option",{value:7},"4/7",-1),e("option",{value:8},"4/8",-1)]),512),[[oe,N.value,void 0,{number:!0}]])])):(o(),r("div",Ze,c(A.value),1))]),e("div",tt,[j[13]||(j[13]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Preamble Length",-1)),e("span",ot,c(b.value),1)])]),v.value?(o(),r("div",rt,j[14]||(j[14]=[e("p",{class:"text-yellow-700 dark:text-yellow-400 text-xs"},[e("strong",null,"Note:"),U(" Radio hardware changes (frequency, bandwidth, spreading factor, coding rate) may require a service restart to apply. ")],-1)]))):L("",!0)]))}}),nt={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"},at={class:"flex-1 relative min-h-[400px]"},lt={class:"p-6 border-t border-stroke-subtle dark:border-stroke/10 space-y-4"},dt={class:"grid grid-cols-2 gap-4"},it=G({__name:"LocationPicker",props:{isOpen:{type:Boolean},latitude:{},longitude:{}},emits:["close","select"],setup(I,{emit:_}){const d=I,v=_,k=m(null),i=m(d.latitude||0),u=m(d.longitude||0);let s=null,p=null;const y=async()=>{if(k.value){h();try{const n=(await me(async()=>{const{default:b}=await import("./leaflet-src-BtisrQHC.js").then(x=>x.l);return{default:b}},__vite__mapDeps([0,1]))).default;delete n.Icon.Default.prototype._getIconUrl,n.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 ie();const t=i.value||0,a=u.value||0,A=t===0&&a===0?2:13;s=n.map(k.value).setView([t,a],A);try{const b=n.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=="}),x=n.tileLayer("https://{s}.basemaps.cartocdn.com/dark_only_labels/{z}/{x}/{y}{r}.png",{maxZoom:19,attribution:"",errorTileUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="});b.addTo(s),x.addTo(s)}catch(b){console.warn("Error loading tiles:",b)}(t!==0||a!==0)&&(p=n.marker([t,a]).addTo(s)),s.on("click",b=>{i.value=b.latlng.lat,u.value=b.latlng.lng,p?p.setLatLng(b.latlng):p=n.marker(b.latlng).addTo(s)}),setTimeout(()=>{s?.invalidateSize()},200)}catch(n){console.error("Failed to initialize map:",n)}}},h=()=>{s&&(s.remove(),s=null,p=null)};te(()=>d.isOpen,async n=>{n?(await ie(),await y()):h()}),te(()=>[d.latitude,d.longitude],([n,t])=>{i.value=n,u.value=t});const N=()=>{v("select",{latitude:i.value,longitude:u.value}),v("close")},M=()=>{v("close")},$=()=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(async n=>{if(i.value=n.coords.latitude,u.value=n.coords.longitude,s){s.setView([i.value,u.value],13);const t=(await me(async()=>{const{default:a}=await import("./leaflet-src-BtisrQHC.js").then(A=>A.l);return{default:a}},__vite__mapDeps([0,1]))).default;p?p.setLatLng([i.value,u.value]):p=t.marker([i.value,u.value]).addTo(s)}},n=>{console.error("Error getting location:",n),alert("Unable to get current location. Please check browser permissions.")}):alert("Geolocation is not supported by this browser.")};return we(()=>{h()}),(n,t)=>n.isOpen?(o(),r("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:Y(M,["self"])},[e("div",nt,[e("div",{class:"flex items-center justify-between p-6 border-b border-stroke-subtle dark:border-stroke/10"},[t[3]||(t[3]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"Select Location",-1)),e("button",{onClick:M,class:"text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors"},t[2]||(t[2]=[e("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("div",at,[e("div",{ref_key:"mapContainer",ref:k,class:"absolute inset-0 rounded-b-[15px] overflow-hidden"},null,512)]),e("div",lt,[e("div",dt,[e("div",null,[t[4]||(t[4]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-muted mb-2"},"Latitude",-1)),S(e("input",{"onUpdate:modelValue":t[0]||(t[0]=a=>i.value=a),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),[[V,i.value,void 0,{number:!0}]])]),e("div",null,[t[5]||(t[5]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-muted mb-2"},"Longitude",-1)),S(e("input",{"onUpdate:modelValue":t[1]||(t[1]=a=>u.value=a),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),[[V,u.value,void 0,{number:!0}]])])]),e("div",{class:"flex gap-3"},[e("button",{onClick:$,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"},t[6]||(t[6]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("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"}),e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})],-1),U(" Use Current Location ",-1)])),e("button",{onClick:M,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 "),e("button",{onClick:N,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 ")]),t[7]||(t[7]=e("p",{class:"text-content-muted dark:text-content-muted text-xs text-center"},"Click on the map to select a location",-1))])])])):L("",!0)}}),ct=pe(it,[["__scopeId","data-v-186d3c86"]]),ut={class:"space-y-4"},mt={key:0,class:"bg-green-100 dark:bg-green-500/10 border border-green-300 dark:border-green-500/30 rounded-lg p-3"},pt={class:"text-green-700 dark:text-green-400 text-sm"},vt={key:1,class:"bg-red-100 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 rounded-lg p-3"},xt={class:"text-red-700 dark:text-red-400 text-sm"},bt={class:"flex justify-end gap-2"},kt=["disabled"],gt=["disabled"],yt={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},ft={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"},ht={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm break-all"},wt={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"},_t={class:"text-content-primary dark:text-content-primary font-mono text-xs break-all"},Ct={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"},$t={class:"text-content-primary dark:text-content-primary font-mono text-xs break-all sm:text-right sm:max-w-xs"},Mt={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"},At={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},St={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"},Tt={key:0,class:"flex justify-end"},Nt={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"},Bt={class:"text-content-primary dark:text-content-primary font-mono text-sm"},Et={class:"flex flex-col py-2 gap-2"},Lt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-1"},Ft={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm sm:ml-4"},Pt={key:1,class:"flex items-center gap-2"},zt=G({__name:"RepeaterSettings",setup(I){const _=re(),d=B(()=>_.stats?.config||{}),v=B(()=>d.value.repeater||{}),k=B(()=>_.stats),i=m(!1),u=m(!1),s=m(null),p=m(null),y=m(!1),h=m(""),N=m(0),M=m(0),$=m(0);te([d,v],()=>{i.value||(h.value=d.value.node_name||"",N.value=v.value.latitude||0,M.value=v.value.longitude||0,$.value=v.value.send_advert_interval_hours||0)},{immediate:!0});const n=B(()=>d.value.node_name||"Not set"),t=B(()=>k.value?.local_hash||"Not available"),a=B(()=>{const F=k.value?.public_key;return!F||F==="Not set"?"Not set":F}),A=B(()=>{const F=v.value.latitude;return F&&F!==0?F.toFixed(6):"Not set"}),b=B(()=>{const F=v.value.longitude;return F&&F!==0?F.toFixed(6):"Not set"}),x=B(()=>{const F=v.value.mode;return F?F.charAt(0).toUpperCase()+F.slice(1):"Not set"}),g=B(()=>{const F=v.value.send_advert_interval_hours;return F===void 0?"Not set":F===0?"Disabled":F+" hour"+(F!==1?"s":"")}),z=()=>{i.value=!0,s.value=null,p.value=null},W=()=>{i.value=!1,s.value=null,h.value=d.value.node_name||"",N.value=v.value.latitude||0,M.value=v.value.longitude||0,$.value=v.value.send_advert_interval_hours||0},C=async()=>{u.value=!0,s.value=null,p.value=null;try{const F={};h.value&&(F.node_name=h.value),F.latitude=N.value,F.longitude=M.value,F.flood_advert_interval_hours=$.value;const w=(await q.post("/update_radio_config",F)).data;w.message||w.persisted?(p.value=w.message||"Settings saved successfully",i.value=!1,await _.fetchStats(),setTimeout(()=>{p.value=null},3e3)):w.error?s.value=w.error:s.value="Unknown response from server"}catch(F){console.error("Failed to update repeater settings:",F);const E=F;s.value=E.response?.data?.error||"Failed to update settings"}finally{u.value=!1}},j=()=>{y.value=!0},P=F=>{N.value=F.latitude,M.value=F.longitude};return(F,E)=>(o(),r("div",ut,[p.value?(o(),r("div",mt,[e("p",pt,c(p.value),1)])):L("",!0),s.value?(o(),r("div",vt,[e("p",xt,c(s.value),1)])):L("",!0),e("div",bt,[i.value?(o(),r(K,{key:1},[e("button",{onClick:W,disabled:u.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,kt),e("button",{onClick:C,disabled:u.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"},c(u.value?"Saving...":"Save Changes"),9,gt)],64)):(o(),r("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 "))]),e("div",yt,[e("div",ft,[E[5]||(E[5]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Node Name",-1)),i.value?S((o(),r("input",{key:1,"onUpdate:modelValue":E[0]||(E[0]=w=>h.value=w),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)),[[V,h.value]]):(o(),r("div",ht,c(n.value),1))]),e("div",wt,[E[6]||(E[6]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Local Hash",-1)),e("span",_t,c(t.value),1)]),e("div",Ct,[E[7]||(E[7]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm flex-shrink-0"},"Public Key",-1)),e("span",$t,c(a.value),1)]),e("div",Mt,[E[8]||(E[8]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Latitude",-1)),i.value?S((o(),r("input",{key:1,"onUpdate:modelValue":E[1]||(E[1]=w=>N.value=w),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)),[[V,N.value,void 0,{number:!0}]]):(o(),r("div",At,c(A.value),1))]),e("div",St,[E[9]||(E[9]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Longitude",-1)),i.value?S((o(),r("input",{key:1,"onUpdate:modelValue":E[2]||(E[2]=w=>M.value=w),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)),[[V,M.value,void 0,{number:!0}]]):(o(),r("div",jt,c(b.value),1))]),i.value?(o(),r("div",Tt,[e("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 text-sm flex items-center gap-2",title:"Pick location on map"},E[10]||(E[10]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("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"}),e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})],-1),U(" Pick Location on Map ",-1)]))])):L("",!0),e("div",Nt,[E[11]||(E[11]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Mode",-1)),e("span",Bt,c(x.value),1)]),e("div",Et,[e("div",Lt,[E[13]||(E[13]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Periodic Advertisement Interval",-1)),i.value?(o(),r("div",Pt,[S(e("input",{"onUpdate:modelValue":E[3]||(E[3]=w=>$.value=w),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),[[V,$.value,void 0,{number:!0}]]),E[12]||(E[12]=e("span",{class:"text-content-muted dark:text-content-muted text-sm"},"hours",-1))])):(o(),r("div",Ft,c(g.value),1))]),E[14]||(E[14]=e("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))])]),O(ct,{"is-open":y.value,latitude:N.value,longitude:M.value,onClose:E[4]||(E[4]=w=>y.value=!1),onSelect:P},null,8,["is-open","latitude","longitude"])]))}}),Vt={class:"space-y-4"},Dt={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"},It={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"},Ht={class:"flex justify-end gap-2"},Ut=["disabled"],Rt=["disabled"],Kt={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},Ot={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"},qt={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Wt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1"},Gt={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Qt=G({__name:"DutyCycle",setup(I){const _=re(),d=B(()=>_.stats?.config?.duty_cycle||{}),v=B(()=>{const n=d.value.max_airtime_percent;return typeof n=="number"?n.toFixed(1)+"%":n&&typeof n=="object"&&"parsedValue"in n?(n.parsedValue||0).toFixed(1)+"%":"Not set"}),k=B(()=>d.value.enforcement_enabled?"Enabled":"Disabled"),i=m(!1),u=m(!1),s=m(""),p=m(""),y=m(0),h=m(!0),N=()=>{const n=d.value.max_airtime_percent;typeof n=="number"?y.value=n:n&&typeof n=="object"&&"parsedValue"in n?y.value=n.parsedValue||0:y.value=6,h.value=d.value.enforcement_enabled!==!1,i.value=!0,s.value="",p.value=""},M=()=>{i.value=!1,s.value="",p.value=""},$=async()=>{u.value=!0,p.value="",s.value="";try{const t=(await de.post("/api/update_duty_cycle_config",{max_airtime_percent:y.value,enforcement_enabled:h.value})).data;t.message||t.persisted?(s.value=t.message||"Settings saved successfully",i.value=!1,await _.fetchStats(),setTimeout(()=>{s.value=""},3e3)):p.value="Failed to save settings"}catch(n){console.error("Failed to save duty cycle settings:",n),p.value=n.response?.data?.error||"Failed to save settings"}finally{u.value=!1}};return(n,t)=>(o(),r("div",Vt,[s.value?(o(),r("div",Dt,c(s.value),1)):L("",!0),p.value?(o(),r("div",It,c(p.value),1)):L("",!0),e("div",Ht,[i.value?(o(),r(K,{key:1},[e("button",{onClick:M,disabled:u.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,Ut),e("button",{onClick:$,disabled:u.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"},c(u.value?"Saving...":"Save Changes"),9,Rt)],64)):(o(),r("button",{key:0,onClick:N,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 "))]),e("div",Kt,[e("div",Ot,[t[2]||(t[2]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Max Airtime %",-1)),i.value?S((o(),r("input",{key:1,"onUpdate:modelValue":t[0]||(t[0]=a=>y.value=a),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)),[[V,y.value,void 0,{number:!0}]]):(o(),r("div",qt,c(v.value),1))]),e("div",Wt,[t[4]||(t[4]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Enforcement",-1)),i.value?S((o(),r("select",{key:1,"onUpdate:modelValue":t[1]||(t[1]=a=>h.value=a),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]||(t[3]=[e("option",{value:!0},"Enabled",-1),e("option",{value:!1},"Disabled",-1)]),512)),[[oe,h.value]]):(o(),r("div",Gt,c(k.value),1))])])]))}}),Yt={class:"space-y-4"},Xt={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"},Jt={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"},Zt={class:"flex justify-end gap-2"},eo=["disabled"],to=["disabled"],oo={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},ro={class:"flex flex-col py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-2"},so={class:"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-1"},no={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm sm:ml-4"},ao={class:"flex flex-col py-2 gap-2"},lo={class:"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-1"},io={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm sm:ml-4"},co=G({__name:"TransmissionDelays",setup(I){const _=re(),d=B(()=>_.stats?.config?.delays||{}),v=B(()=>{const n=d.value.tx_delay_factor;if(n&&typeof n=="object"&&n!==null&&"parsedValue"in n){const t=n.parsedValue;if(typeof t=="number")return t.toFixed(2)+"x"}return"Not set"}),k=B(()=>{const n=d.value.direct_tx_delay_factor;return typeof n=="number"?n.toFixed(2)+"s":"Not set"}),i=m(!1),u=m(!1),s=m(""),p=m(""),y=m(0),h=m(0),N=()=>{const n=d.value.tx_delay_factor;n&&typeof n=="object"&&"parsedValue"in n?y.value=n.parsedValue||1:typeof n=="number"?y.value=n:y.value=1;const t=d.value.direct_tx_delay_factor;h.value=typeof t=="number"?t:.5,i.value=!0,s.value="",p.value=""},M=()=>{i.value=!1,s.value="",p.value=""},$=async()=>{u.value=!0,p.value="",s.value="";try{const t=(await de.post("/api/update_radio_config",{tx_delay_factor:y.value,direct_tx_delay_factor:h.value})).data;t.message||t.persisted?(s.value=t.message||"Settings saved successfully",i.value=!1,await _.fetchStats(),setTimeout(()=>{s.value=""},3e3)):p.value="Failed to save settings"}catch(n){console.error("Failed to save delay settings:",n),p.value=n.response?.data?.error||"Failed to save settings"}finally{u.value=!1}};return(n,t)=>(o(),r("div",Yt,[s.value?(o(),r("div",Xt,c(s.value),1)):L("",!0),p.value?(o(),r("div",Jt,c(p.value),1)):L("",!0),e("div",Zt,[i.value?(o(),r(K,{key:1},[e("button",{onClick:M,disabled:u.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,eo),e("button",{onClick:$,disabled:u.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"},c(u.value?"Saving...":"Save Changes"),9,to)],64)):(o(),r("button",{key:0,onClick:N,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 "))]),e("div",oo,[e("div",ro,[e("div",so,[t[2]||(t[2]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Flood TX Delay Factor",-1)),i.value?S((o(),r("input",{key:1,"onUpdate:modelValue":t[0]||(t[0]=a=>y.value=a),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)),[[V,y.value,void 0,{number:!0}]]):(o(),r("div",no,c(v.value),1))]),t[3]||(t[3]=e("span",{class:"text-content-muted dark:text-content-muted text-xs"},"Multiplier for flood packet transmission delays (collision avoidance)",-1))]),e("div",ao,[e("div",lo,[t[4]||(t[4]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Direct TX Delay Factor",-1)),i.value?S((o(),r("input",{key:1,"onUpdate:modelValue":t[1]||(t[1]=a=>h.value=a),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)),[[V,h.value,void 0,{number:!0}]]):(o(),r("div",io,c(k.value),1))]),t[5]||(t[5]=e("span",{class:"text-content-muted dark:text-content-muted text-xs"},"Base delay for direct-routed packet transmission (seconds)",-1))])])]))}}),ke=_e("treeState",()=>{const I=ce(new Set),_=ce({value:null}),d=s=>{I.add(s)},v=s=>{I.delete(s)};return{expandedNodes:I,selectedNodeId:_,addExpandedNode:d,removeExpandedNode:v,isNodeExpanded:s=>I.has(s),setSelectedNode:s=>{_.value=s},toggleExpanded:s=>{I.has(s)?v(s):d(s)}}}),uo={class:"select-none"},mo={class:"flex-shrink-0"},po={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"},vo={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"},xo={key:0,class:"hidden sm:flex items-center gap-1 ml-2"},bo={class:"relative group"},ko=["title"],go={key:0,class:"text-xs font-mono text-white/50 bg-white/5 px-1.5 py-0.5 rounded border border-white/10"},yo={class:"flex justify-between items-start mb-4"},fo={class:"bg-black/20 border border-white/10 rounded-md p-4 mb-4"},ho={class:"text-sm font-mono text-white/80 break-all leading-relaxed"},wo={class:"flex items-center gap-1 sm:gap-2 ml-auto flex-shrink-0"},_o={key:0,class:"hidden sm:flex items-center gap-1"},Co=["title"],$o={key:1,class:"hidden sm:flex items-center gap-1"},Mo={key:2,class:"hidden sm:inline-block px-2 py-1 bg-white/10 text-white/60 text-xs rounded-full ml-1"},Ao={key:0,class:"space-y-1"},So=G({__name:"TreeNode",props:{node:{},selectedNodeId:{},level:{},disabled:{type:Boolean}},emits:["select"],setup(I,{emit:_}){const d=I,v=_,k=ke(),i=m(!1),u=B({get:()=>k.isNodeExpanded(d.node.id),set:t=>{t?k.addExpandedNode(d.node.id):k.removeExpandedNode(d.node.id)}}),s=B(()=>d.node.children.length>0);function p(t){if(!t)return"Never";const A=new Date().getTime()-t.getTime(),b=Math.floor(A/(1e3*60)),x=Math.floor(A/(1e3*60*60)),g=Math.floor(A/(1e3*60*60*24)),z=Math.floor(g/365);return b<60?`${b}m ago`:x<24?`${x}h ago`:g<365?`${g}d ago`:`${z}y ago`}function y(t){return t?t.length<=16?t:`${t.slice(0,8)}...${t.slice(-8)}`:"No key"}function h(){if(s.value){const t=!u.value;u.value=t}}function N(){v("select",d.node.id)}function M(t){v("select",t)}function $(t){t.stopPropagation(),i.value=!i.value}function n(t){t.stopPropagation(),d.node.transport_key&&window.navigator?.clipboard&&window.navigator.clipboard.writeText(d.node.transport_key)}return(t,a)=>{const A=be("TreeNode",!0);return o(),r("div",uo,[e("div",{class:D(["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",d.disabled?"opacity-50 cursor-not-allowed":"hover:bg-white/5",t.selectedNodeId===t.node.id&&!d.disabled?"bg-primary/20 text-primary":"text-white/80 hover:text-white",`ml-${t.level*4}`]),onClick:a[3]||(a[3]=b=>!d.disabled&&N())},[e("div",{class:"flex-shrink-0 w-3 h-3 sm:w-4 sm:h-4 flex items-center justify-center",onClick:Y(h,["stop"])},[s.value?(o(),r("svg",{key:0,class:D(["w-2.5 h-2.5 sm:w-3 sm:h-3 transition-transform duration-200",u.value?"rotate-90":"rotate-0"]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},a[4]||(a[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)]),2)):L("",!0)]),e("div",mo,[d.node.name.startsWith("#")?(o(),r("svg",po,a[5]||(a[5]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(o(),r("svg",vo,a[6]||(a[6]=[e("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("span",{class:D(["font-mono text-xs sm:text-sm transition-colors duration-200 break-all",t.selectedNodeId===t.node.id?"text-primary font-medium":""])},c(t.node.name),3),t.node.transport_key?(o(),r("div",xo,[e("div",bo,[e("button",{onClick:$,class:"p-1 rounded hover:bg-white/10 transition-colors",title:i.value?"Hide full key":"Show full key"},a[7]||(a[7]=[e("svg",{class:"w-3 h-3 text-white/60 hover:text-white/80",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),e("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,ko),i.value?L("",!0):(o(),r("span",go,c(y(t.node.transport_key)),1)),i.value?(o(),r("div",{key:1,class:"fixed inset-0 z-[9998] flex items-center justify-center bg-black/70 backdrop-blur-md",onClick:a[2]||(a[2]=b=>i.value=!1)},[e("div",{class:"bg-black/20 border border-white/20 rounded-lg shadow-lg p-6 max-w-2xl w-full mx-4",onClick:a[1]||(a[1]=Y(()=>{},["stop"]))},[e("div",yo,[a[9]||(a[9]=e("h3",{class:"text-lg font-semibold text-white"},"Transport Key",-1)),e("button",{onClick:a[0]||(a[0]=b=>i.value=!1),class:"text-white/60 hover:text-white transition-colors"},a[8]||(a[8]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("div",fo,[e("div",ho,c(t.node.transport_key),1)]),e("div",{class:"flex justify-end"},[e("button",{onClick:n,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"},a[10]||(a[10]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("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),U(" Copy Key ",-1)]))])])])):L("",!0)])])):L("",!0),e("div",wo,[t.node.last_used?(o(),r("div",_o,[a[11]||(a[11]=e("svg",{class:"w-3 h-3 text-white/40",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("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)),e("span",{class:"text-xs text-white/50",title:t.node.last_used.toLocaleString()},c(p(t.node.last_used)),9,Co)])):(o(),r("div",$o,a[12]||(a[12]=[e("svg",{class:"w-3 h-3 text-white/30",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("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),e("span",{class:"text-xs text-white/30 italic"},"Never",-1)]))),e("span",{class:D(["px-1.5 sm:px-2 py-0.5 text-[10px] sm:text-xs font-medium rounded-md transition-colors",t.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"])},c(t.node.floodPolicy==="allow"?"ALLOW":"DENY"),3),s.value?(o(),r("span",Mo," > "+c(t.node.children.length),1)):L("",!0)])],2),O(Ce,{"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:ve(()=>[u.value&&t.node.children.length>0?(o(),r("div",Ao,[(o(!0),r(K,null,Z(t.node.children,b=>(o(),xe(A,{key:b.id,node:b,"selected-node-id":t.selectedNodeId,level:t.level+1,disabled:d.disabled,onSelect:M},null,8,["node","selected-node-id","level","disabled"]))),128))])):L("",!0)]),_:1})])}}}),jo=pe(So,[["__scopeId","data-v-59e9974c"]]),To={class:"flex items-center justify-between mb-6"},No={class:"text-content-secondary dark:text-content-muted text-sm mt-1"},Bo={key:0},Eo={class:"text-primary font-mono"},Lo={key:1},Fo={for:"keyName",class:"block text-sm font-medium text-white mb-2"},Po={class:"flex items-center gap-2"},zo={key:0,class:"w-4 h-4 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Vo={key:1,class:"w-4 h-4 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Do={class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4"},Io={class:"flex items-center gap-3 mb-2"},Ho={class:"flex items-center gap-2"},Uo={key:0,class:"w-5 h-5 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ro={key:1,class:"w-5 h-5 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ko={class:"text-content-secondary dark:text-content-muted text-sm"},Oo={class:"grid grid-cols-2 gap-3"},qo={class:"relative cursor-pointer group"},Wo={class:"relative cursor-pointer group"},Go={class:"flex gap-3 pt-4"},Qo=["disabled"],Yo=G({__name:"AddKeyModal",props:{show:{type:Boolean},selectedNodeName:{},selectedNodeId:{}},emits:["close","add"],setup(I,{emit:_}){const d=I,v=_,k=m(""),i=m(""),u=m("allow"),s=B(()=>k.value.startsWith("#")),p=B(()=>({type:s.value?"Region":"Private Key",description:s.value?"Regional organizational key":"Individual assigned key"}));te(s,$=>{$?i.value="This will create a new region for organizing keys":i.value="This will create a new private key entry"},{immediate:!0});const y=B(()=>k.value.trim().length>0),h=()=>{y.value&&(v("add",{name:k.value.trim(),floodPolicy:u.value,parentId:d.selectedNodeId}),k.value="",i.value="",u.value="allow")},N=()=>{k.value="",i.value="",u.value="allow",v("close")},M=$=>{$.target===$.currentTarget&&N()};return($,n)=>$.show?(o(),r("div",{key:0,onClick:M,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"}},[e("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:n[3]||(n[3]=Y(()=>{},["stop"]))},[e("div",To,[e("div",null,[n[5]||(n[5]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"Add New Entry",-1)),e("p",No,[d.selectedNodeName?(o(),r("span",Bo,[n[4]||(n[4]=U(" Add to: ",-1)),e("span",Eo,c(d.selectedNodeName),1)])):(o(),r("span",Lo," Add to root level (#uk) "))])]),e("button",{onClick:N,class:"text-white/60 hover:text-white transition-colors"},n[6]||(n[6]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("form",{onSubmit:Y(h,["prevent"]),class:"space-y-4"},[e("div",null,[e("label",Fo,[e("div",Po,[s.value?(o(),r("svg",zo,n[7]||(n[7]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(o(),r("svg",Vo,n[8]||(n[8]=[e("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)]))),n[9]||(n[9]=U(" Region/Key Name ",-1))])]),S(e("input",{id:"keyName","onUpdate:modelValue":n[0]||(n[0]=t=>k.value=t),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),[[V,k.value]])]),e("div",Do,[e("div",Io,[e("div",Ho,[s.value?(o(),r("svg",Uo,n[10]||(n[10]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(o(),r("svg",Ro,n[11]||(n[11]=[e("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)]))),e("span",{class:D([s.value?"text-secondary":"text-accent-green","font-medium"])},c(p.value.type),3)]),e("div",{class:D(["flex-1 h-px",s.value?"bg-secondary/20":"bg-accent-green/20"])},null,2)]),e("p",Ko,c(p.value.description),1)]),e("div",null,[n[14]||(n[14]=e("label",{class:"block text-sm font-medium text-content-primary dark:text-content-primary mb-3"},[e("div",{class:"flex items-center gap-2"},[e("svg",{class:"w-4 h-4 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("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"})]),U(" Flood Policy ")])],-1)),e("div",Oo,[e("label",qo,[S(e("input",{type:"radio","onUpdate:modelValue":n[1]||(n[1]=t=>u.value=t),value:"allow",class:"sr-only"},null,512),[[ne,u.value]]),n[12]||(n[12]=Q('<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))]),e("label",Wo,[S(e("input",{type:"radio","onUpdate:modelValue":n[2]||(n[2]=t=>u.value=t),value:"deny",class:"sr-only"},null,512),[[ne,u.value]]),n[13]||(n[13]=Q('<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))])])]),e("div",Go,[e("button",{type:"button",onClick:N,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 "),e("button",{type:"submit",disabled:!y.value,class:D(["flex-1 px-4 py-3 rounded-lg transition-colors font-medium",y.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 "+c(p.value.type),11,Qo)])],32)])])):L("",!0)}}),Xo={class:"flex items-center justify-between mb-6"},Jo={class:"text-content-secondary dark:text-content-muted text-sm mt-1"},Zo={class:"text-primary font-mono"},er={for:"keyName",class:"block text-sm font-medium text-content-secondary dark:text-content-primary mb-2"},tr={class:"flex items-center gap-2"},or={key:0,class:"w-4 h-4 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},rr={key:1,class:"w-4 h-4 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},sr={class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4"},nr={class:"flex items-center gap-3 mb-2"},ar={class:"flex items-center gap-2"},lr={key:0,class:"w-5 h-5 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},dr={key:1,class:"w-5 h-5 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ir={class:"text-content-secondary dark:text-content-muted text-sm"},cr={key:0,class:"space-y-4"},ur={key:0,class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4"},mr={class:"bg-background-mute dark:bg-black/20 border border-stroke-subtle dark:border-stroke/10 rounded-md p-3"},pr={class:"text-xs font-mono text-content-primary dark:text-content-primary/80 break-all"},vr={key:1,class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4"},xr={class:"flex items-center justify-between"},br={class:"text-sm text-content-secondary dark:text-content-muted"},kr={class:"text-xs text-content-muted dark:text-content-muted"},gr={class:"grid grid-cols-2 gap-3"},yr={class:"relative cursor-pointer group"},fr={class:"relative cursor-pointer group"},hr={class:"flex gap-3 pt-4"},wr=["disabled"],_r=G({__name:"EditKeyModal",props:{show:{type:Boolean},node:{}},emits:["close","save","request-delete"],setup(I,{emit:_}){const d=I,v=_,k=m(""),i=m("allow"),u=B(()=>k.value.startsWith("#")),s=B(()=>({type:u.value?"Region":"Private Key",description:u.value?"Regional organizational key":"Individual assigned key"}));te(()=>d.node,t=>{t?(k.value=t.name,i.value=t.floodPolicy):(k.value="",i.value="allow")},{immediate:!0});const p=B(()=>k.value.trim().length>0&&d.node),y=t=>{const A=new Date().getTime()-t.getTime(),b=Math.floor(A/(1e3*60)),x=Math.floor(A/(1e3*60*60)),g=Math.floor(A/(1e3*60*60*24)),z=Math.floor(g/365);return b<60?`${b}m ago`:x<24?`${x}h ago`:g<365?`${g}d ago`:`${z}y ago`},h=t=>{window.navigator?.clipboard&&window.navigator.clipboard.writeText(t)},N=()=>{!p.value||!d.node||(v("save",{id:d.node.id,name:k.value.trim(),floodPolicy:i.value}),$())},M=()=>{d.node&&(v("request-delete",d.node),$())},$=()=>{v("close")},n=t=>{t.target===t.currentTarget&&$()};return(t,a)=>t.show?(o(),r("div",{key:0,onClick:n,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"}},[e("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:a[4]||(a[4]=Y(()=>{},["stop"]))},[e("div",Xo,[e("div",null,[a[6]||(a[6]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"Edit Entry",-1)),e("p",Jo,[a[5]||(a[5]=U(" Modify ",-1)),e("span",Zo,c(t.node?.name),1)])]),e("button",{onClick:$,class:"text-white/60 hover:text-white transition-colors"},a[7]||(a[7]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("form",{onSubmit:Y(N,["prevent"]),class:"space-y-4"},[e("div",null,[e("label",er,[e("div",tr,[u.value?(o(),r("svg",or,a[8]||(a[8]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(o(),r("svg",rr,a[9]||(a[9]=[e("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)]))),a[10]||(a[10]=U(" Region/Key Name ",-1))])]),S(e("input",{id:"keyName","onUpdate:modelValue":a[0]||(a[0]=A=>k.value=A),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),[[V,k.value]])]),e("div",sr,[e("div",nr,[e("div",ar,[u.value?(o(),r("svg",lr,a[11]||(a[11]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(o(),r("svg",dr,a[12]||(a[12]=[e("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)]))),e("span",{class:D([u.value?"text-secondary":"text-accent-green","font-medium"])},c(s.value.type),3)]),e("div",{class:D(["flex-1 h-px",u.value?"bg-secondary/20":"bg-accent-green/20"])},null,2)]),e("p",ir,c(s.value.description),1)]),t.node?(o(),r("div",cr,[t.node.transport_key?(o(),r("div",ur,[a[14]||(a[14]=Q('<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)),e("div",mr,[e("div",pr,c(t.node.transport_key),1),e("button",{onClick:a[1]||(a[1]=A=>h(t.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"},a[13]||(a[13]=[e("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("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),U(" Copy Key ",-1)]))])])):L("",!0),t.node.last_used?(o(),r("div",vr,[a[15]||(a[15]=e("div",{class:"flex items-center gap-2 mb-3"},[e("svg",{class:"w-4 h-4 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("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"})]),e("span",{class:"text-sm font-medium text-content-primary dark:text-content-primary"},"Last Used")],-1)),e("div",xr,[e("div",br,c(t.node.last_used.toLocaleDateString())+" at "+c(t.node.last_used.toLocaleTimeString()),1),e("div",kr,c(y(t.node.last_used)),1)])])):L("",!0)])):L("",!0),e("div",null,[a[18]||(a[18]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-primary mb-3"},[e("div",{class:"flex items-center gap-2"},[e("svg",{class:"w-4 h-4 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("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"})]),U(" Flood Policy ")])],-1)),e("div",gr,[e("label",yr,[S(e("input",{type:"radio","onUpdate:modelValue":a[2]||(a[2]=A=>i.value=A),value:"allow",class:"sr-only"},null,512),[[ne,i.value]]),a[16]||(a[16]=Q('<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))]),e("label",fr,[S(e("input",{type:"radio","onUpdate:modelValue":a[3]||(a[3]=A=>i.value=A),value:"deny",class:"sr-only"},null,512),[[ne,i.value]]),a[17]||(a[17]=Q('<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))])])]),e("div",hr,[e("button",{type:"button",onClick:M,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 "),e("button",{type:"button",onClick:$,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 "),e("button",{type:"submit",disabled:!p.value,class:D(["flex-1 px-4 py-3 rounded-lg transition-colors font-medium",p.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,wr)])],32)])])):L("",!0)}}),Cr={class:"flex items-center gap-3 mb-6"},$r={class:"text-content-secondary dark:text-content-muted text-sm mt-1"},Mr={class:"text-accent-red font-mono"},Ar={key:0,class:"bg-accent-red/10 border border-accent-red/30 rounded-lg p-4 mb-6"},Sr={class:"flex items-start gap-3"},jr={class:"flex-1"},Tr={class:"text-accent-red font-medium text-sm mb-2"},Nr={class:"space-y-1 max-h-32 overflow-y-auto"},Br={key:0,class:"w-3 h-3 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Er={key:1,class:"w-3 h-3 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Lr={class:"font-mono"},Fr={key:0,class:"text-content-secondary dark:text-content-muted text-xs"},Pr={key:1,class:"mb-6"},zr={class:"mb-3"},Vr={class:"relative"},Dr={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"},Ir={key:0,class:"text-center py-4 text-content-secondary dark:text-content-muted text-sm"},Hr={class:"relative"},Ur=["value"],Rr={class:"flex items-center gap-2 flex-1"},Kr={class:"text-content-primary dark:text-content-primary font-mono text-sm"},Or={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"},qr={class:"flex gap-3"},Wr=G({__name:"DeleteConfirmModal",props:{show:{type:Boolean},node:{},allNodes:{}},emits:["close","delete-all","move-children"],setup(I,{emit:_}){const d=I,v=_,k=m(null),i=m(""),u=n=>{const t=[],a=A=>{for(const b of A.children)t.push(b),a(b)};return a(n),t},s=B(()=>d.node?u(d.node):[]),p=B(()=>{if(!d.node)return[];const n=new Set([d.node.id,...s.value.map(a=>a.id)]),t=a=>{const A=[];for(const b of a)b.name.startsWith("#")&&!n.has(b.id)&&A.push(b),b.children.length>0&&A.push(...t(b.children));return A};return t(d.allNodes)}),y=B(()=>{if(!i.value.trim())return p.value;const n=i.value.toLowerCase();return p.value.filter(t=>t.name.toLowerCase().includes(n))}),h=()=>{d.node&&(v("delete-all",d.node.id),M())},N=()=>{!d.node||!k.value||(v("move-children",{nodeId:d.node.id,targetParentId:k.value}),M())},M=()=>{k.value=null,i.value="",v("close")},$=n=>{n.target===n.currentTarget&&M()};return(n,t)=>n.show&&n.node?(o(),r("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"}},[e("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:t[2]||(t[2]=Y(()=>{},["stop"]))},[e("div",Cr,[t[6]||(t[6]=e("svg",{class:"w-6 h-6 text-accent-red",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("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)),e("div",null,[t[4]||(t[4]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"Confirm Deletion",-1)),e("p",$r,[t[3]||(t[3]=U(" Deleting ",-1)),e("span",Mr,c(n.node?.name),1)])]),e("button",{onClick:M,class:"ml-auto text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors"},t[5]||(t[5]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),s.value.length>0?(o(),r("div",Ar,[e("div",Sr,[t[9]||(t[9]=e("svg",{class:"w-5 h-5 text-accent-red flex-shrink-0 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("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)),e("div",jr,[e("h4",Tr," This will affect "+c(s.value.length)+" child "+c(s.value.length===1?"entry":"entries")+": ",1),e("div",Nr,[(o(!0),r(K,null,Z(s.value.slice(0,10),a=>(o(),r("div",{key:a.id,class:"flex items-center gap-2 text-xs text-content-secondary dark:text-content-primary/80"},[a.name.startsWith("#")?(o(),r("svg",Br,t[7]||(t[7]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(o(),r("svg",Er,t[8]||(t[8]=[e("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)]))),e("span",Lr,c(a.name),1),e("span",{class:D(["px-1 py-0.5 text-xs rounded",a.floodPolicy==="allow"?"bg-accent-green/20 text-accent-green":"bg-accent-red/20 text-accent-red"])},c(a.floodPolicy),3)]))),128)),s.value.length>10?(o(),r("div",Fr," ...and "+c(s.value.length-10)+" more ",1)):L("",!0)])])])])):L("",!0),s.value.length>0&&p.value.length>0?(o(),r("div",Pr,[t[13]||(t[13]=e("h4",{class:"text-content-primary dark:text-content-primary font-medium text-sm mb-3"},"Move children to another region:",-1)),e("div",zr,[e("div",Vr,[t[10]||(t[10]=e("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"},[e("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)),S(e("input",{"onUpdate:modelValue":t[0]||(t[0]=a=>i.value=a),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),[[V,i.value]])])]),e("div",Dr,[y.value.length===0?(o(),r("div",Ir,c(i.value?"No regions match your search":"No available regions"),1)):L("",!0),(o(!0),r(K,null,Z(y.value,a=>(o(),r("label",{key:a.id,class:"flex items-center gap-3 p-2 rounded cursor-pointer hover:bg-stroke-subtle dark:hover:bg-white/10 transition-colors group"},[e("div",Hr,[S(e("input",{type:"radio",value:a.id,"onUpdate:modelValue":t[1]||(t[1]=A=>k.value=A),class:"sr-only peer"},null,8,Ur),[[ne,k.value]]),t[11]||(t[11]=e("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"},[e("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))]),e("div",Rr,[t[12]||(t[12]=e("svg",{class:"w-4 h-4 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"})],-1)),e("span",Kr,c(a.name),1),a.children.length>0?(o(),r("span",Or,c(a.children.length),1)):L("",!0)])]))),128))])])):L("",!0),e("div",qr,[e("button",{onClick:M,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.value.length>0&&k.value?(o(),r("button",{key:0,onClick:N,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 ")):L("",!0),e("button",{onClick:h,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"},c(s.value.length>0?"Delete All":"Delete"),1)])])])):L("",!0)}}),Gr={class:"space-y-4 sm:space-y-6"},Qr={class:"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-3"},Yr={class:"flex gap-2 flex-wrap"},Xr=["disabled"],Jr=["disabled"],Zr=["disabled"],es={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"},ts={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3"},os={class:"flex items-center gap-2 sm:gap-3"},rs={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"},ss={class:"glass-card rounded-[15px] p-3 sm:p-6 border border-stroke-subtle dark:border-stroke/10"},ns={key:0,class:"flex items-center justify-center py-8"},as={key:1,class:"text-center py-8"},ls={class:"text-content-secondary dark:text-content-muted text-sm"},ds={key:2,class:"text-center py-8"},is={key:3,class:"space-y-2"},cs=G({name:"TransportKeys",__name:"TransportKeys",setup(I){const _=ke(),d=m(!1),v=m(!1),k=m(!1),i=m(null),u=m(null),s=m("deny"),p=m([]),y=m(!1),h=m(null),N=w=>{const f=new Map,H=[];return w.forEach(R=>{const se={id:R.id,name:R.name,floodPolicy:R.flood_policy,transport_key:R.transport_key,last_used:R.last_used?new Date(R.last_used*1e3):void 0,parent_id:R.parent_id,children:[]};f.set(R.id,se)}),f.forEach(R=>{R.parent_id&&f.has(R.parent_id)?f.get(R.parent_id).children.push(R):H.push(R)}),H},M=async()=>{try{y.value=!0,h.value=null;const w=await q.getTransportKeys();w.success&&w.data?p.value=N(w.data):h.value=w.error||"Failed to load transport keys"}catch(w){h.value=w instanceof Error?w.message:"Unknown error occurred",console.error("Error loading transport keys:",w)}finally{y.value=!1}};ae(()=>{M()});function $(w,f){for(const H of w){if(H.id===f)return H;if(H.children){const R=$(H.children,f);if(R)return R}}return null}function n(){const w=_.selectedNodeId.value;return w?$(p.value,w)?.name:void 0}function t(w){s.value==="deny"&&_.setSelectedNode(w)}function a(){s.value==="deny"&&(d.value=!0)}function A(){if(s.value==="deny"&&_.selectedNodeId.value){const w=$(p.value,_.selectedNodeId.value);w&&(u.value=w,k.value=!0)}}function b(){if(s.value==="deny"&&_.selectedNodeId.value){const w=$(p.value,_.selectedNodeId.value);w&&(i.value=w,v.value=!0)}}const x=async w=>{try{const f=await q.createTransportKey(w.name,w.floodPolicy,void 0,w.parentId,void 0);f.success?await M():(console.error("Failed to add transport key:",f.error),h.value=f.error||"Failed to add transport key")}catch(f){console.error("Error adding transport key:",f),h.value=f instanceof Error?f.message:"Unknown error occurred"}finally{d.value=!1}};function g(){d.value=!1}async function z(w){try{const f=w==="allow",H=await q.updateGlobalFloodPolicy(f);H.success?s.value=w:(console.error("Failed to update global flood policy:",H.error),h.value=H.error||"Failed to update global flood policy")}catch(f){console.error("Error updating global flood policy:",f),h.value=f instanceof Error?f.message:"Failed to update global flood policy"}}function W(){v.value=!1,i.value=null}async function C(w){try{const f=await q.updateTransportKey(w.id,w.name,w.floodPolicy);f.success?await M():(console.error("Failed to update transport key:",f.error),h.value=f.error||"Failed to update transport key")}catch(f){console.error("Error updating transport key:",f),h.value=f instanceof Error?f.message:"Unknown error occurred"}finally{W()}}function j(w){v.value=!1,i.value=null,u.value=w,k.value=!0}function P(){k.value=!1,u.value=null}async function F(w){try{const f=await q.deleteTransportKey(w);f.success?(await M(),_.setSelectedNode(null)):(console.error("Failed to delete transport key:",f.error),h.value=f.error||"Failed to delete transport key")}catch(f){console.error("Error deleting transport key:",f),h.value=f instanceof Error?f.message:"Unknown error occurred"}finally{P()}}async function E(w){try{const f=await q.deleteTransportKey(w.nodeId);f.success?(await M(),_.setSelectedNode(null)):(console.error("Failed to delete transport key:",f.error),h.value=f.error||"Failed to delete transport key")}catch(f){console.error("Error deleting transport key:",f),h.value=f instanceof Error?f.message:"Unknown error occurred"}finally{P()}}return(w,f)=>(o(),r("div",Gr,[e("div",Qr,[f[3]||(f[3]=e("div",null,[e("h3",{class:"text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2"},"Regions/Keys"),e("p",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Manage regional key hierarchy")],-1)),e("div",Yr,[e("button",{onClick:a,disabled:s.value==="allow",class:D(["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",s.value==="allow"?"bg-background-mute dark:bg-white/5 text-content-muted dark:text-content-muted/70 border-stroke-subtle dark:border-stroke/20 cursor-not-allowed":"bg-accent-green/10 hover:bg-accent-green/20 text-accent-green border-accent-green/30"])},f[2]||(f[2]=[e("svg",{class:"w-3.5 h-3.5 sm:w-4 sm:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),U(" Add ",-1)]),10,Xr),e("button",{onClick:b,disabled:!J(_).selectedNodeId.value||s.value==="allow",class:D(["px-2.5 sm:px-4 py-1.5 sm:py-2 rounded-lg border transition-colors text-xs sm:text-sm",!J(_).selectedNodeId.value||s.value==="allow"?"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":"bg-accent-green/20 hover:bg-accent-green/30 text-accent-green border-accent-green/50"])}," Edit ",10,Jr),e("button",{onClick:A,disabled:!J(_).selectedNodeId.value||s.value==="allow",class:D(["px-2.5 sm:px-4 py-1.5 sm:py-2 rounded-lg border transition-colors text-xs sm:text-sm",!J(_).selectedNodeId.value||s.value==="allow"?"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":"bg-accent-red/20 hover:bg-accent-red/30 text-accent-red border-accent-red/50"])}," Delete ",10,Zr)])]),e("div",es,[e("div",ts,[f[4]||(f[4]=e("div",null,[e("h4",{class:"text-xs sm:text-sm font-medium text-content-primary dark:text-content-primary mb-1"},"Global Flood Policy (*)"),e("p",{class:"text-content-secondary dark:text-content-muted text-[10px] sm:text-xs"},"Master control for repeater flooding")],-1)),e("div",os,[e("div",rs,[e("button",{onClick:f[0]||(f[0]=H=>z("deny")),class:D(["px-2 sm:px-3 py-1 text-[10px] sm:text-xs font-medium rounded transition-colors",s.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),e("button",{onClick:f[1]||(f[1]=H=>z("allow")),class:D(["px-2 sm:px-3 py-1 text-[10px] sm:text-xs font-medium rounded transition-colors",s.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)])])])]),e("div",ss,[y.value?(o(),r("div",ns,f[5]||(f[5]=[e("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-accent-green"},null,-1),e("span",{class:"ml-2 text-content-secondary dark:text-content-muted"},"Loading transport keys...",-1)]))):h.value?(o(),r("div",as,[f[6]||(f[6]=e("div",{class:"text-accent-red mb-2"},"⚠️ Error loading transport keys",-1)),e("div",ls,c(h.value),1),e("button",{onClick:M,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 ")])):p.value.length===0?(o(),r("div",ds,f[7]||(f[7]=[e("div",{class:"text-content-muted dark:text-content-muted mb-2"},"📝 No transport keys found",-1),e("div",{class:"text-content-muted dark:text-content-muted/60 text-sm"},"Add your first transport key to get started",-1)]))):(o(),r("div",is,[(o(!0),r(K,null,Z(p.value,H=>(o(),xe(jo,{key:H.id,node:H,"selected-node-id":J(_).selectedNodeId.value,level:0,disabled:s.value==="allow",onSelect:t},null,8,["node","selected-node-id","disabled"]))),128))]))]),O(Yo,{show:d.value,"selected-node-name":n(),"selected-node-id":J(_).selectedNodeId.value||void 0,onClose:g,onAdd:x},null,8,["show","selected-node-name","selected-node-id"]),O(_r,{show:v.value,node:i.value,onClose:W,onSave:C,onRequestDelete:j},null,8,["show","node"]),O(Wr,{show:k.value,node:u.value,"all-nodes":p.value,onClose:P,onDeleteAll:F,onMoveChildren:E},null,8,["show","node","all-nodes"])]))}}),us={class:"space-y-4 sm:space-y-6"},ms={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3"},ps={key:0,class:"bg-red-500/10 border border-red-500/30 rounded-lg p-4"},vs={class:"flex items-center gap-2 text-red-600 dark:text-red-400"},xs={key:1,class:"flex items-center justify-center py-12"},bs={key:2,class:"space-y-3"},ks={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3"},gs={class:"flex-1"},ys={class:"flex items-center gap-2 sm:gap-3"},fs={class:"min-w-0 flex-1"},hs={class:"text-content-primary dark:text-content-primary font-medium text-sm sm:text-base break-all"},ws={class:"flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-1 text-xs text-content-secondary dark:text-content-muted"},_s={class:"truncate"},Cs={class:"truncate"},$s=["onClick","disabled"],Ms={key:3,class:"text-center py-12"},As={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"},Ss={class:"space-y-4"},js={class:"flex justify-end gap-3 mt-6"},Ts=["disabled"],Ns=["disabled"],Bs={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"},Es={class:"space-y-4"},Ls={class:"flex gap-2"},Fs=["value"],Ps={class:"bg-blue-500/10 border border-blue-500/30 rounded-lg p-4"},zs={class:"block bg-blue-500/20 px-3 py-2 rounded text-xs text-blue-100 font-mono overflow-x-auto"},Vs=G({name:"APITokens",__name:"APITokens",setup(I){const _=m([]),d=m(!1),v=m(null),k=m(!1),i=m(""),u=m(null),s=m(!1),p=m(!1),y=m(null),h=async()=>{d.value=!0,v.value=null;try{const x=await q.get("/auth/tokens"),g=x.data||x;_.value=g.tokens||[]}catch(x){console.error("Failed to fetch API tokens:",x),v.value=x instanceof Error?x.message:"Failed to fetch tokens"}finally{d.value=!1}},N=async()=>{if(!i.value.trim()){v.value="Token name is required";return}d.value=!0,v.value=null;try{const x=await q.post("/auth/tokens",{name:i.value.trim()}),g=x.data||x;u.value=g.token||null,k.value=!1,s.value=!0,i.value="",await h()}catch(x){console.error("Failed to create API token:",x),v.value=x instanceof Error?x.message:"Failed to create token"}finally{d.value=!1}},M=(x,g)=>{y.value={id:x,name:g},p.value=!0},$=async()=>{if(y.value){d.value=!0,v.value=null;try{await q.delete(`/auth/tokens/${y.value.id}`),await h(),p.value=!1,y.value=null}catch(x){console.error("Failed to revoke API token:",x),v.value=x instanceof Error?x.message:"Failed to revoke token"}finally{d.value=!1}}},n=()=>{k.value=!1,i.value="",v.value=null},t=()=>{s.value=!1,u.value=null},a=()=>{u.value&&navigator.clipboard.writeText(u.value)},A=x=>x?new Date(x*1e3).toLocaleString():"Never",b=B(()=>`${window.location.origin}/api/stats`);return ae(()=>{h()}),(x,g)=>(o(),r(K,null,[e("div",us,[e("div",ms,[g[5]||(g[5]=e("div",null,[e("h2",{class:"text-lg sm:text-xl font-semibold text-content-primary dark:text-content-primary"},"API Tokens"),e("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)),e("button",{onClick:g[0]||(g[0]=z=>k.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"},g[4]||(g[4]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),U(" Create Token ",-1)]))]),g[20]||(g[20]=Q('<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)),v.value?(o(),r("div",ps,[e("div",vs,[g[6]||(g[6]=e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("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)),U(" "+c(v.value),1)])])):L("",!0),d.value&&_.value.length===0?(o(),r("div",xs,g[7]||(g[7]=[e("div",{class:"text-center"},[e("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"}),e("div",{class:"text-content-secondary dark:text-content-muted"},"Loading tokens...")],-1)]))):_.value.length>0?(o(),r("div",bs,[(o(!0),r(K,null,Z(_.value,z=>(o(),r("div",{key:z.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"},[e("div",ks,[e("div",gs,[e("div",ys,[g[8]||(g[8]=e("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"},[e("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)),e("div",fs,[e("h3",hs,c(z.name),1),e("div",ws,[e("span",_s,"Created: "+c(A(z.created_at)),1),e("span",Cs,"Last used: "+c(A(z.last_used)),1)])])])]),e("button",{onClick:W=>M(z.id,z.name),disabled:d.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,$s)])]))),128))])):(o(),r("div",Ms,[g[9]||(g[9]=e("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"},[e("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)),g[10]||(g[10]=e("h3",{class:"text-content-primary dark:text-content-primary font-medium mb-2"},"No API Tokens",-1)),g[11]||(g[11]=e("p",{class:"text-content-secondary dark:text-content-muted text-sm mb-4"},"Create a token to enable API access",-1)),e("button",{onClick:g[1]||(g[1]=z=>k.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 ")])),k.value?(o(),r("div",{key:4,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:Y(n,["self"])},[e("div",As,[g[14]||(g[14]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary mb-4"},"Create API Token",-1)),e("div",Ss,[e("div",null,[g[12]||(g[12]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-muted mb-2"},"Token Name",-1)),S(e("input",{"onUpdate:modelValue":g[2]||(g[2]=z=>i.value=z),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:$e(N,["enter"])},null,544),[[V,i.value]]),g[13]||(g[13]=e("p",{class:"text-xs text-content-muted dark:text-content-muted mt-1"},"Give your token a descriptive name to identify its purpose",-1))]),e("div",js,[e("button",{onClick:n,disabled:d.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,Ts),e("button",{onClick:N,disabled:d.value||!i.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"},c(d.value?"Creating...":"Create Token"),9,Ns)])])])])):L("",!0),s.value&&u.value?(o(),r("div",{key:5,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:Y(t,["self"])},[e("div",Bs,[g[19]||(g[19]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary mb-4"},"Token Created Successfully",-1)),e("div",Es,[g[18]||(g[18]=Q('<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)),e("div",null,[g[16]||(g[16]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-muted mb-2"},"Your API Token",-1)),e("div",Ls,[e("input",{value:u.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,Fs),e("button",{onClick:a,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"},g[15]||(g[15]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("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),U(" Copy ",-1)]))])]),e("div",Ps,[g[17]||(g[17]=e("p",{class:"text-sm text-blue-200 mb-2"},[e("strong",null,"Usage Example:")],-1)),e("code",zs,' curl -H "X-API-Key: '+c(u.value)+'" '+c(b.value),1)]),e("div",{class:"flex justify-end mt-6"},[e("button",{onClick:t,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 ")])])])])):L("",!0)]),O(Me,{show:p.value,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${y.value?.name}'? This action cannot be undone.`,"confirm-text":"Revoke","cancel-text":"Cancel",variant:"danger",onConfirm:$,onClose:g[3]||(g[3]=z=>p.value=!1)},null,8,["show","message"])],64))}}),Ds={class:"space-y-6"},Is={class:"glass-card rounded-lg border border-stroke-subtle dark:border-stroke/10 p-6"},Hs={class:"space-y-4"},Us={class:"flex items-center justify-between"},Rs=["disabled"],Ks={class:"glass-card rounded-lg border border-stroke-subtle dark:border-stroke/10 p-6"},Os={class:"space-y-4"},qs={class:"space-y-3"},Ws=["checked","disabled"],Gs=["checked","disabled"],Qs={class:"flex items-start gap-3"},Ys={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"},Xs={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"},Js={class:"flex-1"},Zs={class:"text-sm font-medium text-content-primary dark:text-content-primary"},en={key:0,class:"text-xs text-green-600 dark:text-green-400 mt-1"},tn={key:1,class:"p-4 bg-amber-500/10 border border-amber-500/30 rounded-lg"},on={class:"flex items-start justify-between gap-3"},rn=["disabled"],sn={key:0,class:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24"},nn={key:1,class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},an={class:"flex items-center space-x-2"},ln={key:0,class:"w-5 h-5 text-green-600 dark:text-green-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},dn={key:1,class:"w-5 h-5 text-red-600 dark:text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},cn=G({name:"WebSettings",__name:"WebSettings",setup(I){const _=m(!1),d=m(""),v=m(!1),k=m(!1),i=m(!1),u=m(!1),s=m(!0),p=ce({cors_enabled:!1,use_default_frontend:!0}),y=B(()=>v.value?"bg-green-500/10 border-green-600/40 dark:border-green-500/30":"bg-red-500/10 border-red-500/30");async function h(){try{s.value=!0;const b=await q.get("/check_pymc_console");b.success&&b.data&&(u.value=b.data.exists,console.log("PyMC Console exists:",u.value))}catch(b){console.error("Failed to check PyMC Console:",b),u.value=!1}finally{s.value=!1}}async function N(){try{const b=await q.get("/stats");console.log("WebSettings: Full response:",b);let x=null;if(b.success&&b.data?x=b.data:b&&"version"in b&&(x=b),x){const g=x.config?.web||{};console.log("WebSettings: webConfig:",g),p.cors_enabled=g.cors_enabled===!0,console.log("WebSettings: Set cors_enabled to:",p.cors_enabled);const z=g.web_path;p.use_default_frontend=!z||z==="",console.log("WebSettings: Set use_default_frontend to:",p.use_default_frontend,"from web_path:",z)}}catch(b){console.error("Failed to load web settings:",b),a("Failed to load settings",!1)}}async function M(){_.value=!0,d.value="";try{const b={web:{cors_enabled:p.cors_enabled}};p.use_default_frontend?b.web.web_path=null:b.web.web_path="/opt/pymc_console/web/html";const x=await q.post("/update_web_config",b);x.success?(a("Settings saved successfully",!0),k.value=!0):a(x.error||"Failed to save settings",!1)}catch(b){console.error("Failed to save web settings:",b),a(b.message||"Failed to save settings",!1)}finally{_.value=!1}}async function $(){p.cors_enabled=!p.cors_enabled,await M()}async function n(){p.use_default_frontend=!0,await M()}async function t(){p.use_default_frontend=!1,await M()}function a(b,x){d.value=b,v.value=x,setTimeout(()=>{d.value=""},5e3)}async function A(){i.value=!0,d.value="";try{const b=await q.post("/restart_service",{});b.success?(a("Service restart initiated. Page will reload...",!0),k.value=!1,setTimeout(()=>{window.location.reload()},2e3)):a(b.error||"Failed to restart service",!1)}catch(b){b.code==="ERR_NETWORK"||b.message?.includes("Network error")?(a("Service restarting... Page will reload",!0),k.value=!1,setTimeout(()=>{window.location.reload()},3e3)):(console.error("Failed to restart service:",b),a(b.message||"Failed to restart service",!1))}finally{i.value=!1}}return ae(()=>{N(),h()}),(b,x)=>(o(),r("div",Ds,[e("div",Is,[x[1]||(x[1]=e("div",{class:"flex items-start justify-between mb-4"},[e("div",null,[e("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-1"},"CORS Settings"),e("p",{class:"text-sm text-content-secondary dark:text-content-muted"},"Control cross-origin resource sharing for API access")])],-1)),e("div",Hs,[e("div",Us,[x[0]||(x[0]=e("div",null,[e("label",{class:"text-sm font-medium text-content-primary dark:text-content-primary"},"Enable CORS"),e("p",{class:"text-xs text-content-secondary dark:text-content-muted mt-1"},"Allow web frontends from different origins to access the API")],-1)),e("button",{onClick:$,disabled:_.value,class:D(["relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",p.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",_.value?"opacity-50 cursor-not-allowed":"cursor-pointer"])},[e("span",{class:D(["inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",p.cors_enabled?"translate-x-5":"translate-x-0.5"])},null,2)],10,Rs)])])]),e("div",Ks,[x[11]||(x[11]=e("div",{class:"flex items-start justify-between mb-4"},[e("div",null,[e("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-1"},"Web Frontend"),e("p",{class:"text-sm text-content-secondary dark:text-content-muted"},"Choose which web interface to use")])],-1)),e("div",Os,[e("div",qs,[e("label",{class:D(["flex items-start space-x-3 p-4 bg-background-mute dark:bg-background/30 rounded-lg border-2 cursor-pointer transition-all",p.use_default_frontend?"border-accent-cyan bg-accent-cyan/10":"border-stroke-subtle dark:border-stroke/10 hover:border-accent-cyan/50"])},[e("input",{type:"radio",name:"frontend",checked:p.use_default_frontend,onChange:n,disabled:_.value,class:"mt-1 h-4 w-4 text-accent-cyan focus:ring-accent-cyan focus:ring-offset-background"},null,40,Ws),x[2]||(x[2]=e("div",{class:"flex-1"},[e("div",{class:"text-sm font-medium text-content-primary dark:text-content-primary"},"Default Frontend"),e("div",{class:"text-xs text-content-secondary dark:text-content-muted mt-1"},"Built-in pyMC Repeater web interface"),e("div",{class:"text-xs text-content-muted dark:text-content-muted/60 mt-1 font-mono"},"Built-in")],-1))],2),e("label",{class:D(["flex items-start space-x-3 p-4 bg-background-mute dark:bg-background/30 rounded-lg border-2 cursor-pointer transition-all",p.use_default_frontend?"border-stroke-subtle dark:border-stroke/10 hover:border-accent-cyan/50":"border-accent-cyan bg-accent-cyan/10"])},[e("input",{type:"radio",name:"frontend",checked:!p.use_default_frontend,onChange:t,disabled:_.value,class:"mt-1 h-4 w-4 text-accent-cyan focus:ring-accent-cyan focus:ring-offset-background"},null,40,Gs),x[3]||(x[3]=Q('<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)]),s.value?L("",!0):(o(),r("div",{key:0,class:D(["p-4 rounded-lg border",u.value?"bg-green-500/5 border-green-500/20":"bg-accent-cyan/5 border-accent-cyan/20"])},[e("div",Qs,[u.value?(o(),r("svg",Ys,x[4]||(x[4]=[e("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)]))):(o(),r("svg",Xs,x[5]||(x[5]=[e("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)]))),e("div",Js,[e("h4",Zs,c(u.value?"PyMC Console has been detected":"PyMC Console Not Installed"),1),u.value?(o(),r("p",en,x[6]||(x[6]=[U(" PyMC Console is installed at ",-1),e("code",{class:"text-green-700 dark:text-green-300"},"/opt/pymc_console/web/html",-1)]))):(o(),r(K,{key:1},[x[7]||(x[7]=Q('<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)),k.value?(o(),r("div",tn,[e("div",on,[x[10]||(x[10]=Q('<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)),e("button",{onClick:A,disabled:i.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"},[i.value?(o(),r("svg",sn,x[8]||(x[8]=[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e("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)]))):(o(),r("svg",nn,x[9]||(x[9]=[e("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)]))),U(" "+c(i.value?"Restarting...":"Restart Now"),1)],8,rn)])])):L("",!0)])]),d.value?(o(),r("div",{key:0,class:D(["p-4 rounded-lg border",y.value])},[e("div",an,[v.value?(o(),r("svg",ln,x[12]||(x[12]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"},null,-1)]))):(o(),r("svg",dn,x[13]||(x[13]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"},null,-1)]))),e("span",{class:D(v.value?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400")},c(d.value),3)])],2)):L("",!0)]))}}),un={class:"space-y-4"},mn={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"},pn={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"},vn={class:"flex justify-between items-center"},xn={class:"flex gap-2"},bn=["disabled"],kn={class:"flex gap-2"},gn=["disabled"],yn=["disabled"],fn={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},hn={key:0,class:"flex items-center justify-center py-4"},wn={key:1,class:"text-center py-4"},_n={class:"grid grid-cols-2 sm:grid-cols-4 gap-3"},Cn={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},$n={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},Mn={class:"text-lg font-mono text-content-primary dark:text-content-primary"},An={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},Sn={class:"text-lg font-mono text-green-600 dark:text-green-400"},jn={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},Tn={class:"text-lg font-mono text-red-600 dark:text-red-400"},Nn={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"},Bn={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"},En={class:"font-medium"},Ln={class:"font-mono text-[10px] opacity-70"},Fn={class:"text-[10px]"},Pn={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},zn={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"},Vn={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Dn={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"},In={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Hn={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"},Un={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Rn={key:1,class:"flex items-center gap-2"},Kn={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1"},On={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},qn={key:1,class:"flex items-center gap-2"},Wn={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},Gn={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"},Qn={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Yn={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"},Xn={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Jn={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"},Zn={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},ea={key:1,class:"flex items-center gap-2"},ta={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"},oa={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},ra={key:1,class:"flex items-center gap-2"},sa={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1"},na={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},aa={key:1,class:"flex items-center gap-2"},la={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},da={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"},ca={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"},ua={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},ma={key:1,class:"flex items-center gap-2"},pa={class:"py-2"},va={class:"grid grid-cols-3 gap-2 mt-2"},xa={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},ba={key:0,class:"font-mono text-sm text-content-primary dark:text-content-primary"},ka={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},ga={key:0,class:"font-mono text-sm text-content-primary dark:text-content-primary"},ya={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},fa={key:0,class:"font-mono text-sm text-content-primary dark:text-content-primary"},ha={class:"p-6 space-y-4"},wa={class:"flex justify-between items-start"},_a={class:"flex justify-end pt-4 border-t border-stroke-subtle dark:border-stroke/20"},Ca=G({__name:"AdvertSettings",setup(I){const _=re(),d=B(()=>_.stats?.config?.repeater||{}),v=B(()=>d.value.advert_rate_limit||{}),k=B(()=>d.value.advert_penalty_box||{}),i=B(()=>d.value.advert_adaptive||{}),u=B(()=>i.value.thresholds||{}),s=m(!1),p=m(!1),y=m(""),h=m(""),N=m(!1),M=m(!1),$=m(null),n=m(!0),t=m(2),a=m(1),A=m(10),b=m(60),x=m(!0),g=m(2),z=m(12),W=m(6),C=m(2),j=m(24),P=m(!0),F=m(.1),E=m(5),w=m(.05),f=m(.2),H=m(.5),R=async()=>{M.value=!0;try{const X=await de.get("/api/advert_rate_limit_stats");X.data?.success&&($.value=X.data.data)}catch(X){console.error("Failed to fetch rate limit stats:",X)}finally{M.value=!1}};te([v,k,i],()=>{console.log("[AdvertSettings] Watch triggered, isEditing:",s.value),s.value?console.log("[AdvertSettings] Watch skipped (editing mode)"):(console.log("[AdvertSettings] Watch loading values from store"),console.log("[AdvertSettings] rateLimitConfig:",v.value),console.log("[AdvertSettings] penaltyConfig:",k.value),console.log("[AdvertSettings] adaptiveConfig:",i.value),n.value=v.value.enabled??!1,t.value=v.value.bucket_capacity??2,a.value=v.value.refill_tokens??1,A.value=Math.round((v.value.refill_interval_seconds??36e3)/3600),b.value=Math.round((v.value.min_interval_seconds??0)/60),x.value=k.value.enabled??!1,g.value=k.value.violation_threshold??2,z.value=Math.round((k.value.violation_decay_seconds??43200)/3600),W.value=Math.round((k.value.base_penalty_seconds??21600)/3600),C.value=k.value.penalty_multiplier??2,j.value=Math.round((k.value.max_penalty_seconds??86400)/3600),P.value=i.value.enabled??!1,F.value=i.value.ewma_alpha??.1,E.value=Math.round((i.value.hysteresis_seconds??300)/60),w.value=u.value.quiet_max??.05,f.value=u.value.normal_max??.2,H.value=u.value.busy_max??.5,console.log("[AdvertSettings] Watch loaded values:"),console.log(" rateLimitEnabled:",n.value),console.log(" minIntervalMinutes:",b.value))},{immediate:!0}),ae(()=>{R()});const se=()=>{console.log("[AdvertSettings] reloadFormValues called"),console.log("[AdvertSettings] rateLimitConfig:",v.value),console.log("[AdvertSettings] penaltyConfig:",k.value),console.log("[AdvertSettings] adaptiveConfig:",i.value),n.value=v.value.enabled??!1,t.value=v.value.bucket_capacity??2,a.value=v.value.refill_tokens??1,A.value=Math.round((v.value.refill_interval_seconds??36e3)/3600),b.value=Math.round((v.value.min_interval_seconds??0)/60),x.value=k.value.enabled??!1,g.value=k.value.violation_threshold??2,z.value=Math.round((k.value.violation_decay_seconds??43200)/3600),W.value=Math.round((k.value.base_penalty_seconds??21600)/3600),C.value=k.value.penalty_multiplier??2,j.value=Math.round((k.value.max_penalty_seconds??86400)/3600),P.value=i.value.enabled??!1,F.value=i.value.ewma_alpha??.1,E.value=Math.round((i.value.hysteresis_seconds??300)/60),w.value=u.value.quiet_max??.05,f.value=u.value.normal_max??.2,H.value=u.value.busy_max??.5,console.log("[AdvertSettings] Form values after reload:"),console.log(" rateLimitEnabled:",n.value),console.log(" minIntervalMinutes:",b.value),console.log(" penaltyEnabled:",x.value),console.log(" adaptiveEnabled:",P.value)},ge=()=>{s.value=!0,y.value="",h.value=""},ye=()=>{s.value=!1,y.value="",h.value="",se()},fe=async()=>{p.value=!0,h.value="",y.value="";try{const X={rate_limit_enabled:n.value,bucket_capacity:t.value,refill_tokens:a.value,refill_interval_seconds:A.value*3600,min_interval_seconds:b.value*60,penalty_enabled:x.value,violation_threshold:g.value,violation_decay_seconds:z.value*3600,base_penalty_seconds:W.value*3600,penalty_multiplier:C.value,max_penalty_seconds:j.value*3600,adaptive_enabled:P.value,ewma_alpha:F.value,hysteresis_seconds:E.value*60,quiet_max:w.value,normal_max:f.value,busy_max:H.value};console.log("[AdvertSettings] Sending save request with payload:",X);const T=(await de.post("/api/update_advert_rate_limit_config",X)).data;console.log("[AdvertSettings] API response:",T),T.success?(y.value=T.data?.message||"Settings saved successfully",console.log("[AdvertSettings] Save successful, fetching updated config..."),await _.fetchStats(),console.log("[AdvertSettings] systemStore.fetchStats() complete"),console.log("[AdvertSettings] rateLimitConfig after fetchStats:",v.value),await R(),console.log("[AdvertSettings] fetchStats() complete"),await ie(),console.log("[AdvertSettings] nextTick() complete, calling reloadFormValues()"),se(),console.log("[AdvertSettings] reloadFormValues() complete, exiting edit mode"),s.value=!1,setTimeout(()=>{y.value=""},3e3)):(h.value=T.error||"Failed to save settings",console.error("[AdvertSettings] Save failed:",T.error))}catch(X){console.error("Failed to save advert settings:",X),h.value=X.response?.data?.error||"Failed to save settings"}finally{p.value=!1}},ue=B(()=>$.value?.adaptive?.current_tier||"unknown"),he=B(()=>{switch(ue.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(X,l)=>(o(),r("div",un,[y.value?(o(),r("div",mn,c(y.value),1)):L("",!0),h.value?(o(),r("div",pn,c(h.value),1)):L("",!0),e("div",vn,[e("div",xn,[e("button",{onClick:R,disabled:M.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"},c(M.value?"Loading...":"Refresh Stats"),9,bn),e("button",{onClick:l[0]||(l[0]=T=>N.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"},l[19]||(l[19]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("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)]))]),e("div",kn,[s.value?(o(),r(K,{key:1},[e("button",{onClick:ye,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,gn),e("button",{onClick:fe,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"},c(p.value?"Saving...":"Save Changes"),9,yn)],64)):(o(),r("button",{key:0,onClick:ge,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 "))])]),e("div",fn,[l[28]||(l[28]=e("h3",{class:"text-sm font-medium text-content-primary dark:text-content-primary"},"Current Status",-1)),M.value&&!$.value?(o(),r("div",hn,l[20]||(l[20]=[e("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),e("span",{class:"ml-2 text-sm text-content-muted"},"Loading stats...",-1)]))):$.value?(o(),r(K,{key:2},[e("div",_n,[e("div",Cn,[l[22]||(l[22]=e("div",{class:"text-xs text-content-muted dark:text-content-muted"},"Mesh Tier",-1)),e("div",{class:D(["mt-1 px-2 py-0.5 rounded border text-xs font-medium inline-block",he.value])},c(ue.value.toUpperCase()),3)]),e("div",$n,[l[23]||(l[23]=e("div",{class:"text-xs text-content-muted dark:text-content-muted"},"Adverts/min",-1)),e("div",Mn,c($.value.metrics?.adverts_per_min_ewma?.toFixed(2)||"0.00"),1)]),e("div",An,[l[24]||(l[24]=e("div",{class:"text-xs text-content-muted dark:text-content-muted"},"Allowed",-1)),e("div",Sn,c($.value.stats?.adverts_allowed||0),1)]),e("div",jn,[l[25]||(l[25]=e("div",{class:"text-xs text-content-muted dark:text-content-muted"},"Dropped",-1)),e("div",Tn,c($.value.stats?.adverts_dropped||0),1)])]),Object.keys($.value.active_penalties||{}).length>0?(o(),r("div",Nn,[l[26]||(l[26]=e("div",{class:"text-xs font-medium text-red-700 dark:text-red-400 mb-1"},"Active Penalties",-1)),(o(!0),r(K,null,Z($.value.active_penalties,(T,le)=>(o(),r("div",{key:le,class:"text-xs font-mono text-red-600 dark:text-red-400"},c(le)+"... - "+c(Math.round(T))+"s remaining ",1))),128))])):L("",!0),$.value.recent_drops&&$.value.recent_drops.length>0?(o(),r("div",Bn,[l[27]||(l[27]=e("div",{class:"text-xs font-medium text-orange-700 dark:text-orange-400 mb-1"},"Recently Dropped Adverts",-1)),(o(!0),r(K,null,Z($.value.recent_drops,(T,le)=>(o(),r("div",{key:le,class:"text-xs text-orange-600 dark:text-orange-400 py-0.5"},[e("span",En,c(T.name),1),e("span",Ln,"("+c(T.pubkey)+"...)",1),e("span",Fn," - "+c(T.reason)+" ("+c(T.seconds_ago)+"s ago)",1)]))),128))])):L("",!0)],64)):(o(),r("div",wn,l[21]||(l[21]=[e("p",{class:"text-xs text-content-muted dark:text-content-muted"},' Stats not available. Click "Refresh Stats" to load. ',-1)])))]),e("div",Pn,[l[36]||(l[36]=e("h3",{class:"text-sm font-medium text-content-primary dark:text-content-primary flex items-center gap-2"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("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"})]),U(" Token Bucket Rate Limiting ")],-1)),l[37]||(l[37]=e("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)),e("div",zn,[l[30]||(l[30]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Rate Limiting",-1)),s.value?S((o(),r("select",{key:1,"onUpdate:modelValue":l[1]||(l[1]=T=>n.value=T),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"},l[29]||(l[29]=[e("option",{value:!0},"Enabled",-1),e("option",{value:!1},"Disabled",-1)]),512)),[[oe,n.value]]):(o(),r("div",Vn,c(n.value?"Enabled":"Disabled"),1))]),e("div",Dn,[l[31]||(l[31]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Bucket Capacity"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Max burst size (adverts)")],-1)),s.value?S((o(),r("input",{key:1,"onUpdate:modelValue":l[2]||(l[2]=T=>t.value=T),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)),[[V,t.value,void 0,{number:!0}]]):(o(),r("div",In,c(t.value),1))]),e("div",Hn,[l[33]||(l[33]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Refill Interval"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Time between token refills")],-1)),s.value?(o(),r("div",Rn,[S(e("input",{"onUpdate:modelValue":l[3]||(l[3]=T=>A.value=T),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),[[V,A.value,void 0,{number:!0}]]),l[32]||(l[32]=e("span",{class:"text-content-muted text-sm"},"hours",-1))])):(o(),r("div",Un,c(A.value)+" hours",1))]),e("div",Kn,[l[35]||(l[35]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Minimum Interval"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Hard minimum between adverts")],-1)),s.value?(o(),r("div",qn,[S(e("input",{"onUpdate:modelValue":l[4]||(l[4]=T=>b.value=T),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),[[V,b.value,void 0,{number:!0}]]),l[34]||(l[34]=e("span",{class:"text-content-muted text-sm"},"min",-1))])):(o(),r("div",On,c(b.value)+" min",1))])]),e("div",Wn,[l[47]||(l[47]=e("h3",{class:"text-sm font-medium text-content-primary dark:text-content-primary flex items-center gap-2"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("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"})]),U(" Penalty Box (Repeat Offenders) ")],-1)),l[48]||(l[48]=e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Applies escalating cooldowns to pubkeys that repeatedly violate limits.",-1)),e("div",Gn,[l[39]||(l[39]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Penalty Box",-1)),s.value?S((o(),r("select",{key:1,"onUpdate:modelValue":l[5]||(l[5]=T=>x.value=T),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"},l[38]||(l[38]=[e("option",{value:!0},"Enabled",-1),e("option",{value:!1},"Disabled",-1)]),512)),[[oe,x.value]]):(o(),r("div",Qn,c(x.value?"Enabled":"Disabled"),1))]),e("div",Yn,[l[40]||(l[40]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Violation Threshold"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Violations before penalty")],-1)),s.value?S((o(),r("input",{key:1,"onUpdate:modelValue":l[6]||(l[6]=T=>g.value=T),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)),[[V,g.value,void 0,{number:!0}]]):(o(),r("div",Xn,c(g.value),1))]),e("div",Jn,[l[42]||(l[42]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Base Penalty Duration"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"First penalty duration")],-1)),s.value?(o(),r("div",ea,[S(e("input",{"onUpdate:modelValue":l[7]||(l[7]=T=>W.value=T),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),[[V,W.value,void 0,{number:!0}]]),l[41]||(l[41]=e("span",{class:"text-content-muted text-sm"},"hours",-1))])):(o(),r("div",Zn,c(W.value)+" hours",1))]),e("div",ta,[l[44]||(l[44]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Penalty Multiplier"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Escalation factor")],-1)),s.value?(o(),r("div",ra,[S(e("input",{"onUpdate:modelValue":l[8]||(l[8]=T=>C.value=T),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),[[V,C.value,void 0,{number:!0}]]),l[43]||(l[43]=e("span",{class:"text-content-muted text-sm"},"x",-1))])):(o(),r("div",oa,c(C.value)+"x",1))]),e("div",sa,[l[46]||(l[46]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Max Penalty Duration"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Maximum cooldown cap")],-1)),s.value?(o(),r("div",aa,[S(e("input",{"onUpdate:modelValue":l[9]||(l[9]=T=>j.value=T),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),[[V,j.value,void 0,{number:!0}]]),l[45]||(l[45]=e("span",{class:"text-content-muted text-sm"},"hours",-1))])):(o(),r("div",na,c(j.value)+" hours",1))])]),e("div",la,[l[58]||(l[58]=Q('<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)),e("div",da,[l[50]||(l[50]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Adaptive Mode",-1)),s.value?S((o(),r("select",{key:1,"onUpdate:modelValue":l[10]||(l[10]=T=>P.value=T),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"},l[49]||(l[49]=[e("option",{value:!0},"Enabled",-1),e("option",{value:!1},"Disabled",-1)]),512)),[[oe,P.value]]):(o(),r("div",ia,c(P.value?"Enabled":"Disabled"),1))]),e("div",ca,[l[52]||(l[52]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Tier Change Delay"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Prevents tier flapping")],-1)),s.value?(o(),r("div",ma,[S(e("input",{"onUpdate:modelValue":l[11]||(l[11]=T=>E.value=T),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),[[V,E.value,void 0,{number:!0}]]),l[51]||(l[51]=e("span",{class:"text-content-muted text-sm"},"min",-1))])):(o(),r("div",ua,c(E.value)+" min",1))]),e("div",pa,[l[56]||(l[56]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm mb-2 block"},"Activity Tier Thresholds (adverts/min)",-1)),e("div",va,[e("div",xa,[l[53]||(l[53]=e("div",{class:"text-xs text-green-600 dark:text-green-400 mb-1"},"Quiet Max",-1)),s.value?S((o(),r("input",{key:1,"onUpdate:modelValue":l[12]||(l[12]=T=>w.value=T),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)),[[V,w.value,void 0,{number:!0}]]):(o(),r("div",ba,c(w.value),1))]),e("div",ka,[l[54]||(l[54]=e("div",{class:"text-xs text-blue-600 dark:text-blue-400 mb-1"},"Normal Max",-1)),s.value?S((o(),r("input",{key:1,"onUpdate:modelValue":l[13]||(l[13]=T=>f.value=T),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)),[[V,f.value,void 0,{number:!0}]]):(o(),r("div",ga,c(f.value),1))]),e("div",ya,[l[55]||(l[55]=e("div",{class:"text-xs text-yellow-600 dark:text-yellow-400 mb-1"},"Busy Max",-1)),s.value?S((o(),r("input",{key:1,"onUpdate:modelValue":l[14]||(l[14]=T=>H.value=T),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)),[[V,H.value,void 0,{number:!0}]]):(o(),r("div",fa,c(H.value),1))])]),l[57]||(l[57]=e("p",{class:"text-xs text-content-muted dark:text-content-muted mt-2"},"Above Busy Max = Congested tier (strictest limiting)",-1))])]),N.value?(o(),r("div",{key:2,class:"fixed inset-0 bg-black/50 flex items-start justify-center z-50 p-4 overflow-y-auto",onClick:l[18]||(l[18]=Y(T=>N.value=!1,["self"]))},[e("div",{class:"bg-background dark:bg-background-dark rounded-lg shadow-xl max-w-3xl w-full my-8",onClick:l[17]||(l[17]=Y(()=>{},["stop"]))},[e("div",ha,[e("div",wa,[l[60]||(l[60]=e("h2",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"How Advert Rate Limiting Works",-1)),e("button",{onClick:l[15]||(l[15]=T=>N.value=!1),class:"text-content-muted hover:text-content-primary dark:text-content-muted dark:hover:text-content-primary"},l[59]||(l[59]=[e("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),l[61]||(l[61]=Q('<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)),e("div",_a,[e("button",{onClick:l[16]||(l[16]=T=>N.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! ")])])])])):L("",!0)]))}}),$a={class:"p-3 sm:p-6 space-y-4 sm:space-y-6"},Ma={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"},Aa={class:"text-cyan-700 dark:text-primary text-sm sm:text-base"},Sa={class:"mt-1 sm:mt-2 text-cyan-600 dark:text-primary/80"},ja={class:"glass-card rounded-[15px] p-3 sm:p-6"},Ta={class:"flex overflow-x-auto border-b border-stroke-subtle dark:border-stroke/10 mb-4 sm:mb-6 -mx-3 px-3 sm:mx-0 sm:px-0 scrollbar-hide"},Na=["onClick"],Ba={class:"flex items-center gap-1 sm:gap-2"},Ea={key:0,class:"w-3.5 h-3.5 sm:w-4 sm:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},La={key:1,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Fa={key:2,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Pa={key:3,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},za={key:4,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Va={key:5,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Da={key:6,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ia={key:7,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ha={class:"min-h-[400px]"},Ua={key:0,class:"flex items-center justify-center py-12"},Ra={key:1,class:"flex items-center justify-center py-12"},Ka={class:"text-center"},Oa={class:"text-content-secondary dark:text-content-muted text-sm mb-4"},qa={key:2},Xa=G({name:"ConfigurationView",__name:"Configuration",setup(I){const _=re(),d=m(Ae("configuration_activeTab","radio")),v=m(!1);te(d,u=>Se("configuration_activeTab",u));const k=[{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"}];ae(async()=>{try{await _.fetchStats(),v.value=!0}catch(u){console.error("Failed to load configuration data:",u),v.value=!0}});function i(u){d.value=u}return(u,s)=>{const p=be("router-link");return o(),r("div",$a,[s[14]||(s[14]=e("div",null,[e("h1",{class:"text-xl sm:text-2xl font-bold text-content-primary dark:text-content-primary"},"Configuration"),e("p",{class:"text-content-secondary dark:text-content-muted mt-1 sm:mt-2 text-sm sm:text-base"},"System configuration and settings")],-1)),e("div",Ma,[e("div",Aa,[s[3]||(s[3]=e("strong",null,"CAD Calibration Tool Available",-1)),e("p",Sa,[s[2]||(s[2]=U(" Optimize your Channel Activity Detection settings. ",-1)),O(p,{to:"/cad-calibration",class:"underline hover:text-cyan-800 dark:hover:text-primary transition-colors"},{default:ve(()=>s[1]||(s[1]=[U(" Launch CAD Calibration Tool → ",-1)])),_:1,__:[1]})])])]),e("div",ja,[e("div",Ta,[(o(),r(K,null,Z(k,y=>e("button",{key:y.id,onClick:h=>i(y.id),class:D(["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",d.value===y.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"])},[e("div",Ba,[y.icon==="radio"?(o(),r("svg",Ea,s[4]||(s[4]=[e("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)]))):y.icon==="repeater"?(o(),r("svg",La,s[5]||(s[5]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14M5 12l4-4m-4 4l4 4"},null,-1)]))):y.icon==="advert"?(o(),r("svg",Fa,s[6]||(s[6]=[e("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)]))):y.icon==="duty"?(o(),r("svg",Pa,s[7]||(s[7]=[e("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)]))):y.icon==="delays"?(o(),r("svg",za,s[8]||(s[8]=[e("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)]))):y.icon==="keys"?(o(),r("svg",Va,s[9]||(s[9]=[e("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)]))):y.icon==="tokens"?(o(),r("svg",Da,s[10]||(s[10]=[e("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)]))):y.icon==="web"?(o(),r("svg",Ia,s[11]||(s[11]=[e("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)]))):L("",!0),U(" "+c(y.label),1)])],10,Na)),64))]),e("div",Ha,[!v.value&&J(_).isLoading?(o(),r("div",Ua,s[12]||(s[12]=[e("div",{class:"text-center"},[e("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"}),e("div",{class:"text-content-secondary dark:text-content-muted"},"Loading configuration...")],-1)]))):J(_).error&&!v.value?(o(),r("div",Ra,[e("div",Ka,[s[13]||(s[13]=e("div",{class:"text-red-500 dark:text-red-400 mb-2"},"Failed to load configuration",-1)),e("div",Oa,c(J(_).error),1),e("button",{onClick:s[0]||(s[0]=y=>J(_).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 ")])])):(o(),r("div",qa,[S(e("div",null,[O(st,{key:"radio-settings"})],512),[[ee,d.value==="radio"]]),S(e("div",null,[O(zt,{key:"repeater-settings"})],512),[[ee,d.value==="repeater"]]),S(e("div",null,[O(Ca,{key:"advert-settings"})],512),[[ee,d.value==="advert"]]),S(e("div",null,[O(Qt,{key:"duty-cycle"})],512),[[ee,d.value==="duty"]]),S(e("div",null,[O(co,{key:"transmission-delays"})],512),[[ee,d.value==="delays"]]),S(e("div",null,[O(cs,{key:"transport-keys"})],512),[[ee,d.value==="transport"]]),S(e("div",null,[O(Vs,{key:"api-tokens"})],512),[[ee,d.value==="api-tokens"]]),S(e("div",null,[O(cn,{key:"web-settings"})],512),[[ee,d.value==="web"]])]))])])])}}});export{Xa as default};
|