Files
ShackMaster/cmd/server/web/dist/assets/index-CZJHCP4k.js
2026-02-28 11:49:23 +01:00

12 lines
70 KiB
JavaScript

var Ql=Object.defineProperty;var xl=(e,l,s)=>l in e?Ql(e,l,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[l]=s;var Wt=(e,l,s)=>xl(e,typeof l!="symbol"?l+"":l,s);(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const r of o)if(r.type==="childList")for(const f of r.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&i(f)}).observe(document,{childList:!0,subtree:!0});function s(o){const r={};return o.integrity&&(r.integrity=o.integrity),o.referrerPolicy&&(r.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?r.credentials="include":o.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(o){if(o.ep)return;o.ep=!0;const r=s(o);fetch(o.href,r)}})();function we(){}function Jl(e){return e()}function fl(){return Object.create(null)}function nt(e){e.forEach(Jl)}function Xl(e){return typeof e=="function"}function ot(e,l){return e!=e?l==l:e!==l||e&&typeof e=="object"||typeof e=="function"}function $l(e){return Object.keys(e).length===0}function n(e,l){e.appendChild(l)}function L(e,l,s){e.insertBefore(l,s||null)}function E(e){e.parentNode&&e.parentNode.removeChild(e)}function Dt(e,l){for(let s=0;s<e.length;s+=1)e[s]&&e[s].d(l)}function a(e){return document.createElement(e)}function D(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function z(e){return document.createTextNode(e)}function b(){return z(" ")}function At(){return z("")}function Ce(e,l,s,i){return e.addEventListener(l,s,i),()=>e.removeEventListener(l,s,i)}function t(e,l,s){s==null?e.removeAttribute(l):e.getAttribute(l)!==s&&e.setAttribute(l,s)}function en(e){return Array.from(e.childNodes)}function R(e,l){l=""+l,e.data!==l&&(e.data=l)}function Pt(e,l){e.value=l??""}function ae(e,l,s,i){s==null?e.style.removeProperty(l):e.style.setProperty(l,s,"")}function It(e,l,s){for(let i=0;i<e.options.length;i+=1){const o=e.options[i];if(o.__value===l){o.selected=!0;return}}(!s||l!==void 0)&&(e.selectedIndex=-1)}function tn(e){const l=e.querySelector(":checked");return l&&l.__value}function W(e,l,s){e.classList.toggle(l,!!s)}let St;function Ct(e){St=e}function Yl(){if(!St)throw new Error("Function called outside component initialization");return St}function Vl(e){Yl().$$.on_mount.push(e)}function Zl(e){Yl().$$.on_destroy.push(e)}const yt=[],ul=[];let kt=[];const vl=[],ln=Promise.resolve();let Gt=!1;function nn(){Gt||(Gt=!0,ln.then(Kl))}function Nt(e){kt.push(e)}const Bt=new Set;let wt=0;function Kl(){if(wt!==0)return;const e=St;do{try{for(;wt<yt.length;){const l=yt[wt];wt++,Ct(l),sn(l.$$)}}catch(l){throw yt.length=0,wt=0,l}for(Ct(null),yt.length=0,wt=0;ul.length;)ul.pop()();for(let l=0;l<kt.length;l+=1){const s=kt[l];Bt.has(s)||(Bt.add(s),s())}kt.length=0}while(yt.length);for(;vl.length;)vl.pop()();Gt=!1,Bt.clear(),Ct(e)}function sn(e){if(e.fragment!==null){e.update(),nt(e.before_update);const l=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,l),e.after_update.forEach(Nt)}}function an(e){const l=[],s=[];kt.forEach(i=>e.indexOf(i)===-1?l.push(i):s.push(i)),s.forEach(i=>i()),kt=l}const Ot=new Set;let on;function ct(e,l){e&&e.i&&(Ot.delete(e),e.i(l))}function mt(e,l,s,i){if(e&&e.o){if(Ot.has(e))return;Ot.add(e),on.c.push(()=>{Ot.delete(e)}),e.o(l)}}function ut(e){return(e==null?void 0:e.length)!==void 0?e:Array.from(e)}function bt(e){e&&e.c()}function dt(e,l,s){const{fragment:i,after_update:o}=e.$$;i&&i.m(l,s),Nt(()=>{const r=e.$$.on_mount.map(Jl).filter(Xl);e.$$.on_destroy?e.$$.on_destroy.push(...r):nt(r),e.$$.on_mount=[]}),o.forEach(Nt)}function ft(e,l){const s=e.$$;s.fragment!==null&&(an(s.after_update),nt(s.on_destroy),s.fragment&&s.fragment.d(l),s.on_destroy=s.fragment=null,s.ctx=[])}function rn(e,l){e.$$.dirty[0]===-1&&(yt.push(e),nn(),e.$$.dirty.fill(0)),e.$$.dirty[l/31|0]|=1<<l%31}function vt(e,l,s,i,o,r,f=null,d=[-1]){const v=St;Ct(e);const c=e.$$={fragment:null,ctx:[],props:r,update:we,not_equal:o,bound:fl(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(l.context||(v?v.$$.context:[])),callbacks:fl(),dirty:d,skip_bound:!1,root:l.target||v.$$.root};f&&f(c.root);let h=!1;if(c.ctx=s?s(e,l.props||{},(u,w,...g)=>{const p=g.length?g[0]:w;return c.ctx&&o(c.ctx[u],c.ctx[u]=p)&&(!c.skip_bound&&c.bound[u]&&c.bound[u](p),h&&rn(e,u)),w}):[],c.update(),h=!0,nt(c.before_update),c.fragment=i?i(c.ctx):!1,l.target){if(l.hydrate){const u=en(l.target);c.fragment&&c.fragment.l(u),u.forEach(E)}else c.fragment&&c.fragment.c();l.intro&&ct(e.$$.fragment),dt(e,l.target,l.anchor),Kl()}Ct(v)}class pt{constructor(){Wt(this,"$$");Wt(this,"$$set")}$destroy(){ft(this,1),this.$destroy=we}$on(l,s){if(!Xl(s))return we;const i=this.$$.callbacks[l]||(this.$$.callbacks[l]=[]);return i.push(s),()=>{const o=i.indexOf(s);o!==-1&&i.splice(o,1)}}$set(l){this.$$set&&!$l(l)&&(this.$$.skip_bound=!0,this.$$set(l),this.$$.skip_bound=!1)}}const cn="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(cn);const _t=[];function qt(e,l=we){let s;const i=new Set;function o(d){if(ot(e,d)&&(e=d,s)){const v=!_t.length;for(const c of i)c[1](),_t.push(c,e);if(v){for(let c=0;c<_t.length;c+=2)_t[c][0](_t[c+1]);_t.length=0}}}function r(d){o(d(e))}function f(d,v=we){const c=[d,v];return i.add(c),i.size===1&&(s=l(o,r)||we),d(e),()=>{i.delete(c),i.size===0&&s&&(s(),s=null)}}return{set:o,update:r,subscribe:f}}const jt=qt(!1),Hl=qt(null),dn=qt(null);class fn{constructor(){this.ws=null,this.reconnectTimeout=null,this.reconnectDelay=3e3}connect(){const s=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;try{this.ws=new WebSocket(s),this.ws.onopen=()=>{console.log("WebSocket connected"),jt.set(!0)},this.ws.onmessage=i=>{try{const o=JSON.parse(i.data);o.type==="update"&&(console.log("System status updated:",o.data),Hl.set(o.data),dn.set(new Date(o.timestamp)))}catch(o){console.error("Error parsing message:",o)}},this.ws.onerror=i=>{console.error("WebSocket error:",i)},this.ws.onclose=()=>{console.log("WebSocket disconnected"),jt.set(!1),this.scheduleReconnect()}}catch(i){console.error("Error creating WebSocket:",i),this.scheduleReconnect()}}scheduleReconnect(){this.reconnectTimeout&&clearTimeout(this.reconnectTimeout),this.reconnectTimeout=setTimeout(()=>{console.log("Attempting to reconnect..."),this.connect()},this.reconnectDelay)}send(l){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(l))}disconnect(){this.reconnectTimeout&&clearTimeout(this.reconnectTimeout),this.ws&&this.ws.close()}}const pl=new fn,un="/api";async function ke(e,l={}){try{const s=await fetch(`${un}${e}`,{...l,headers:{"Content-Type":"application/json",...l.headers}});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return await s.json()}catch(s){throw console.error("API request failed:",s),s}}const Oe={getStatus:()=>ke("/status"),getConfig:()=>ke("/config"),webswitch:{relayOn:e=>ke(`/webswitch/relay/on?relay=${e}`,{method:"POST"}),relayOff:e=>ke(`/webswitch/relay/off?relay=${e}`,{method:"POST"}),allOn:()=>ke("/webswitch/all/on",{method:"POST"}),allOff:()=>ke("/webswitch/all/off",{method:"POST"})},rotator:{move:(e,l)=>ke("/rotator/move",{method:"POST",body:JSON.stringify({rotator:e,azimuth:l})}),cw:e=>ke(`/rotator/cw?rotator=${e}`,{method:"POST"}),ccw:e=>ke(`/rotator/ccw?rotator=${e}`,{method:"POST"}),stop:()=>ke("/rotator/stop",{method:"POST"})},tuner:{setOperate:e=>ke("/tuner/operate",{method:"POST",body:JSON.stringify({value:e})}),setBypass:e=>ke("/tuner/bypass",{method:"POST",body:JSON.stringify({value:e})}),autoTune:()=>ke("/tuner/autotune",{method:"POST"})},antenna:{selectAntenna:(e,l)=>ke("/antenna/select",{method:"POST",body:JSON.stringify({port:e,antenna:l})}),deselectAntenna:(e,l)=>ke("/antenna/deselect",{method:"POST",body:JSON.stringify({port:e,antenna:l})}),reboot:()=>ke("/antenna/reboot",{method:"POST"})},power:{setFanMode:e=>ke("/power/fanmode",{method:"POST",body:JSON.stringify({mode:e})}),setOperate:e=>ke("/power/operate",{method:"POST",body:JSON.stringify({value:e})})},rotator:{setHeading:e=>ke("/rotator/heading",{method:"POST",body:JSON.stringify({heading:e})}),rotateCW:()=>ke("/rotator/cw",{method:"POST"}),rotateCCW:()=>ke("/rotator/ccw",{method:"POST"}),stop:()=>ke("/rotator/stop",{method:"POST"})},ultrabeam:{setFrequency:(e,l)=>ke("/ultrabeam/frequency",{method:"POST",body:JSON.stringify({frequency:e,direction:l})}),retract:()=>ke("/ultrabeam/retract",{method:"POST"}),setAutoTrack:(e,l)=>ke("/ultrabeam/autotrack",{method:"POST",body:JSON.stringify({enabled:e,threshold:l})}),setDirection:e=>ke("/ultrabeam/direction",{method:"POST",body:JSON.stringify({direction:e})})}};function vn(e){let l;return{c(){l=a("span"),l.textContent="Checking FlexRadio...",t(l,"class","no-signal svelte-h7ie36")},m(s,i){L(s,l,i)},p:we,d(s){s&&E(l)}}}function pn(e){let l;return{c(){l=a("span"),l.textContent="FlexRadio not connected",t(l,"class","no-signal svelte-h7ie36")},m(s,i){L(s,l,i)},p:we,d(s){s&&E(l)}}}function hn(e){let l;return{c(){l=a("div"),l.innerHTML='<span class="radio-off-indicator svelte-h7ie36">○</span> <span class="radio-status-text svelte-h7ie36">TCP connected, radio off</span>',t(l,"class","radio-status svelte-h7ie36")},m(s,i){L(s,l,i)},p:we,d(s){s&&E(l)}}}function mn(e){let l,s,i,o,r=(e[11]||"Radio is on")+"",f,d,v,c=e[9]&&hl(e),h=e[10]&&ml(e);return{c(){l=a("div"),s=a("span"),s.textContent="●",i=b(),o=a("span"),f=z(r),d=b(),c&&c.c(),v=b(),h&&h.c(),t(s,"class","radio-on-indicator svelte-h7ie36"),t(o,"class","radio-status-text svelte-h7ie36"),t(l,"class","radio-status svelte-h7ie36")},m(u,w){L(u,l,w),n(l,s),n(l,i),n(l,o),n(o,f),n(l,d),c&&c.m(l,null),n(l,v),h&&h.m(l,null)},p(u,w){w[0]&2048&&r!==(r=(u[11]||"Radio is on")+"")&&R(f,r),u[9]?c?c.p(u,w):(c=hl(u),c.c(),c.m(l,v)):c&&(c.d(1),c=null),u[10]?h?h.p(u,w):(h=ml(u),h.c(),h.m(l,null)):h&&(h.d(1),h=null)},d(u){u&&E(l),c&&c.d(),h&&h.d()}}}function bn(e){let l,s,i,o,r,f,d=e[9]&&bl(e),v=e[10]&&gl(e);return{c(){l=a("div"),s=a("span"),s.textContent="●",i=b(),o=a("span"),o.textContent="Slice active, waiting for frequency...",r=b(),d&&d.c(),f=b(),v&&v.c(),t(s,"class","radio-on-indicator svelte-h7ie36"),t(o,"class","radio-status-text svelte-h7ie36"),t(l,"class","radio-status svelte-h7ie36")},m(c,h){L(c,l,h),n(l,s),n(l,i),n(l,o),n(l,r),d&&d.m(l,null),n(l,f),v&&v.m(l,null)},p(c,h){c[9]?d?d.p(c,h):(d=bl(c),d.c(),d.m(l,f)):d&&(d.d(1),d=null),c[10]?v?v.p(c,h):(v=gl(c),v.c(),v.m(l,null)):v&&(v.d(1),v=null)},d(c){c&&E(l),d&&d.d(),v&&v.d()}}}function gn(e){let l,s,i=Cl(e[3])+"",o,r,f,d,v,c,h,u=e[4]&&wl(e),w=e[25]&&_l(e),g=e[24]&&yl();return{c(){l=a("div"),s=a("span"),o=z(i),r=b(),f=a("span"),f.textContent="MHz",d=b(),u&&u.c(),v=b(),w&&w.c(),c=b(),g&&g.c(),h=At(),t(s,"class","frequency svelte-h7ie36"),ae(s,"--band-color",e[22]),t(f,"class","unit svelte-h7ie36"),t(l,"class","frequency-display svelte-h7ie36")},m(p,k){L(p,l,k),n(l,s),n(s,o),n(l,r),n(l,f),L(p,d,k),u&&u.m(p,k),L(p,v,k),w&&w.m(p,k),L(p,c,k),g&&g.m(p,k),L(p,h,k)},p(p,k){k[0]&8&&i!==(i=Cl(p[3])+"")&&R(o,i),k[0]&4194304&&ae(s,"--band-color",p[22]),p[4]?u?u.p(p,k):(u=wl(p),u.c(),u.m(v.parentNode,v)):u&&(u.d(1),u=null),p[25]?w?w.p(p,k):(w=_l(p),w.c(),w.m(c.parentNode,c)):w&&(w.d(1),w=null),p[24]?g||(g=yl(),g.c(),g.m(h.parentNode,h)):g&&(g.d(1),g=null)},d(p){p&&(E(l),E(d),E(v),E(c),E(h)),u&&u.d(p),w&&w.d(p),g&&g.d(p)}}}function hl(e){let l,s;return{c(){l=a("span"),s=z(e[9]),t(l,"class","model-badge svelte-h7ie36")},m(i,o){L(i,l,o),n(l,s)},p(i,o){o[0]&512&&R(s,i[9])},d(i){i&&E(l)}}}function ml(e){let l,s;return{c(){l=a("span"),s=z(e[10]),t(l,"class","callsign-badge svelte-h7ie36")},m(i,o){L(i,l,o),n(l,s)},p(i,o){o[0]&1024&&R(s,i[10])},d(i){i&&E(l)}}}function bl(e){let l,s;return{c(){l=a("span"),s=z(e[9]),t(l,"class","model-badge svelte-h7ie36")},m(i,o){L(i,l,o),n(l,s)},p(i,o){o[0]&512&&R(s,i[9])},d(i){i&&E(l)}}}function gl(e){let l,s;return{c(){l=a("span"),s=z(e[10]),t(l,"class","callsign-badge svelte-h7ie36")},m(i,o){L(i,l,o),n(l,s)},p(i,o){o[0]&1024&&R(s,i[10])},d(i){i&&E(l)}}}function wl(e){let l,s;return{c(){l=a("span"),s=z(e[4]),t(l,"class","band-badge svelte-h7ie36"),ae(l,"background-color",e[22])},m(i,o){L(i,l,o),n(l,s)},p(i,o){o[0]&16&&R(s,i[4]),o[0]&4194304&&ae(l,"background-color",i[22])},d(i){i&&E(l)}}}function _l(e){let l,s;return{c(){l=a("span"),s=z(e[25]),t(l,"class","mode-badge svelte-h7ie36")},m(i,o){L(i,l,o),n(l,s)},p(i,o){o[0]&33554432&&R(s,i[25])},d(i){i&&E(l)}}}function yl(e){let l;return{c(){l=a("span"),l.textContent="TX",t(l,"class","tx-indicator svelte-h7ie36")},m(s,i){L(s,l,i)},d(s){s&&E(l)}}}function wn(e){let l;return{c(){l=a("span"),l.textContent="📍 Position not set",t(l,"class","no-location svelte-h7ie36")},m(s,i){L(s,l,i)},p:we,d(s){s&&E(l)}}}function _n(e){let l,s,i,o,r,f,d,v,c=Ft(e[12])+"",h,u,w,g,p,k,y,M,T,m=Ft(e[13])+"",C,A,S;function F(O,J){if(O[14])return kn;if(O[16])return yn}let _=F(e),I=_&&_(e);return{c(){l=a("div"),s=a("span"),i=D("svg"),o=D("line"),r=D("path"),f=D("path"),d=D("path"),v=b(),h=z(c),u=b(),w=a("span"),g=D("svg"),p=D("line"),k=D("path"),y=D("path"),M=D("path"),T=b(),C=z(m),A=b(),I&&I.c(),S=At(),t(o,"x1","2"),t(o,"y1","18"),t(o,"x2","22"),t(o,"y2","18"),t(o,"stroke","currentColor"),t(o,"stroke-width","1.5"),t(o,"opacity","0.5"),t(r,"d","M12 18 A6 6 0 0 1 12 6 A6 6 0 0 1 12 18"),t(r,"fill","#fbbf24"),t(f,"d","M12 2v3M5.6 5.6l2.1 2.1M2 12h3M19 12h3M18.4 5.6l-2.1 2.1"),t(f,"stroke","#fbbf24"),t(f,"stroke-width","2"),t(f,"stroke-linecap","round"),t(d,"d","M12 14l-3 3M12 14l3 3M12 14v5"),t(d,"stroke","#22c55e"),t(d,"stroke-width","2"),t(d,"stroke-linecap","round"),t(d,"fill","none"),t(i,"class","sun-icon sunrise-icon svelte-h7ie36"),t(i,"width","18"),t(i,"height","18"),t(i,"viewBox","0 0 24 24"),t(s,"class","sun-item svelte-h7ie36"),t(s,"title","Sunrise"),t(p,"x1","2"),t(p,"y1","18"),t(p,"x2","22"),t(p,"y2","18"),t(p,"stroke","currentColor"),t(p,"stroke-width","1.5"),t(p,"opacity","0.5"),t(k,"d","M12 18 A6 6 0 0 1 12 6 A6 6 0 0 1 12 18"),t(k,"fill","#f97316"),t(y,"d","M12 2v3M5.6 5.6l2.1 2.1M2 12h3M19 12h3M18.4 5.6l-2.1 2.1"),t(y,"stroke","#f97316"),t(y,"stroke-width","2"),t(y,"stroke-linecap","round"),t(y,"opacity","0.7"),t(M,"d","M12 22l-3-3M12 22l3-3M12 22v-5"),t(M,"stroke","#ef4444"),t(M,"stroke-width","2"),t(M,"stroke-linecap","round"),t(M,"fill","none"),t(g,"class","sun-icon sunset-icon svelte-h7ie36"),t(g,"width","18"),t(g,"height","18"),t(g,"viewBox","0 0 24 24"),t(w,"class","sun-item svelte-h7ie36"),t(w,"title","Sunset"),t(l,"class","sun-times svelte-h7ie36")},m(O,J){L(O,l,J),n(l,s),n(s,i),n(i,o),n(i,r),n(i,f),n(i,d),n(s,v),n(s,h),n(l,u),n(l,w),n(w,g),n(g,p),n(g,k),n(g,y),n(g,M),n(w,T),n(w,C),L(O,A,J),I&&I.m(O,J),L(O,S,J)},p(O,J){J[0]&4096&&c!==(c=Ft(O[12])+"")&&R(h,c),J[0]&8192&&m!==(m=Ft(O[13])+"")&&R(C,m),_===(_=F(O))&&I?I.p(O,J):(I&&I.d(1),I=_&&_(O),I&&(I.c(),I.m(S.parentNode,S)))},d(O){O&&(E(l),E(A),E(S)),I&&I.d(O)}}}function yn(e){let l,s;return{c(){l=a("span"),s=z(e[16]),t(l,"class","next-event svelte-h7ie36")},m(i,o){L(i,l,o),n(l,s)},p(i,o){o[0]&65536&&R(s,i[16])},d(i){i&&E(l)}}}function kn(e){let l;return{c(){l=a("span"),l.textContent="✨ Grayline",t(l,"class","grayline-badge svelte-h7ie36"),W(l,"sunrise",e[15]==="sunrise"),W(l,"sunset",e[15]==="sunset")},m(s,i){L(s,l,i)},p(s,i){i[0]&32768&&W(l,"sunrise",s[15]==="sunrise"),i[0]&32768&&W(l,"sunset",s[15]==="sunset")},d(s){s&&E(l)}}}function kl(e){let l,s,i,o,r,f,d=e[8].toFixed(0)+"",v,c;return{c(){l=a("div"),s=a("span"),s.textContent="⚠️",i=b(),o=a("span"),r=z("Vent: "),f=a("strong"),v=z(d),c=z(" km/h"),t(s,"class","alert-icon svelte-h7ie36"),t(f,"class","svelte-h7ie36"),t(o,"class","alert-text svelte-h7ie36"),t(l,"class","alert wind-alert svelte-h7ie36")},m(h,u){L(h,l,u),n(l,s),n(l,i),n(l,o),n(o,r),n(o,f),n(f,v),n(f,c)},p(h,u){u[0]&256&&d!==(d=h[8].toFixed(0)+"")&&R(v,d)},d(h){h&&E(l)}}}function Ml(e){let l,s,i,o,r,f,d=e[7].toFixed(0)+"",v,c;return{c(){l=a("div"),s=a("span"),s.textContent="🌪️",i=b(),o=a("span"),r=z("Rafales: "),f=a("strong"),v=z(d),c=z(" km/h"),t(s,"class","alert-icon svelte-h7ie36"),t(f,"class","svelte-h7ie36"),t(o,"class","alert-text svelte-h7ie36"),t(l,"class","alert gust-alert svelte-h7ie36")},m(h,u){L(h,l,u),n(l,s),n(l,i),n(l,o),n(o,r),n(o,f),n(f,v),n(f,c)},p(h,u){u[0]&128&&d!==(d=h[7].toFixed(0)+"")&&R(v,d)},d(h){h&&E(l)}}}function zl(e){let l;return{c(){l=a("div"),l.innerHTML='<span class="ok-icon svelte-h7ie36">✓</span> <span class="ok-text svelte-h7ie36">Weather OK</span>',t(l,"class","status-ok svelte-h7ie36")},m(s,i){L(s,l,i)},d(s){s&&E(l)}}}function Mn(e){let l,s,i,o,r,f,d,v,c,h,u,w,g,p;function k(_,I){return _[21]?gn:_[19]?bn:_[20]?mn:_[17]?hn:_[18]?pn:vn}let y=k(e),M=y(e);function T(_,I){return _[0]&&_[1]?_n:wn}let m=T(e),C=m(e),A=e[6]&&kl(e),S=e[5]&&Ml(e),F=!e[23]&&zl();return{c(){l=a("div"),s=a("div"),i=a("div"),i.textContent="📻",o=b(),M.c(),r=b(),f=a("div"),d=b(),v=a("div"),C.c(),c=b(),h=a("div"),u=b(),w=a("div"),A&&A.c(),g=b(),S&&S.c(),p=b(),F&&F.c(),t(i,"class","flex-icon svelte-h7ie36"),W(i,"connected",e[2]),W(i,"disconnected",!e[2]),t(s,"class","flex-section svelte-h7ie36"),t(f,"class","separator svelte-h7ie36"),t(v,"class","grayline-section svelte-h7ie36"),t(h,"class","separator svelte-h7ie36"),t(w,"class","weather-section svelte-h7ie36"),t(l,"class","status-banner svelte-h7ie36"),W(l,"has-warning",e[23])},m(_,I){L(_,l,I),n(l,s),n(s,i),n(s,o),M.m(s,null),n(l,r),n(l,f),n(l,d),n(l,v),C.m(v,null),n(l,c),n(l,h),n(l,u),n(l,w),A&&A.m(w,null),n(w,g),S&&S.m(w,null),n(w,p),F&&F.m(w,null)},p(_,I){I[0]&4&&W(i,"connected",_[2]),I[0]&4&&W(i,"disconnected",!_[2]),y===(y=k(_))&&M?M.p(_,I):(M.d(1),M=y(_),M&&(M.c(),M.m(s,null))),m===(m=T(_))&&C?C.p(_,I):(C.d(1),C=m(_),C&&(C.c(),C.m(v,null))),_[6]?A?A.p(_,I):(A=kl(_),A.c(),A.m(w,g)):A&&(A.d(1),A=null),_[5]?S?S.p(_,I):(S=Ml(_),S.c(),S.m(w,p)):S&&(S.d(1),S=null),_[23]?F&&(F.d(1),F=null):F||(F=zl(),F.c(),F.m(w,null)),I[0]&8388608&&W(l,"has-warning",_[23])},i:we,o:we,d(_){_&&E(l),M.d(),C.d(),A&&A.d(),S&&S.d(),F&&F.d()}}}function Tl(e,l,s){const i=Math.PI/180,o=zn(e),r=2*Math.PI/365*(o-1+(e.getHours()-12)/24),f=229.18*(75e-6+.001868*Math.cos(r)-.032077*Math.sin(r)-.014615*Math.cos(2*r)-.040849*Math.sin(2*r)),d=.006918-.399912*Math.cos(r)+.070257*Math.sin(r)-.006758*Math.cos(2*r)+907e-6*Math.sin(2*r)-.002697*Math.cos(3*r)+.00148*Math.sin(3*r),v=l*i,c=90.833*i,h=Math.cos(c)/(Math.cos(v)*Math.cos(d))-Math.tan(v)*Math.tan(d);if(h>1||h<-1)return{sunrise:null,sunset:null};const u=Math.acos(h)/i,w=720-4*(s+u)-f,g=720-4*(s-u)-f,p=new Date(e);p.setUTCHours(0,0,0,0),p.setUTCMinutes(w);const k=new Date(e);return k.setUTCHours(0,0,0,0),k.setUTCMinutes(g),{sunrise:p,sunset:k}}function zn(e){const l=new Date(e.getFullYear(),0,0),s=e-l,i=1e3*60*60*24;return Math.floor(s/i)}function Ft(e){return e?e.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"}):"--:--"}function Cl(e){return!e||e===0?"---":e<10?e.toFixed(4):e<100?e.toFixed(3):e.toFixed(2)}function Tn(e){return!e||e===0?"":e>=1.8&&e<=2?"160M":e>=3.5&&e<=4?"80M":e>=5.3&&e<=5.4?"60M":e>=7&&e<=7.3?"40M":e>=10.1&&e<=10.15?"30M":e>=14&&e<=14.35?"20M":e>=18.068&&e<=18.168?"17M":e>=21&&e<=21.45?"15M":e>=24.89&&e<=24.99?"12M":e>=28&&e<=29.7?"10M":e>=50&&e<=54?"6M":e>=144&&e<=148?"2M":e>=430&&e<=440?"70CM":""}function Cn(e){return{"160M":"#9c27b0","80M":"#673ab7","60M":"#3f51b5","40M":"#2196f3","30M":"#00bcd4","20M":"#009688","17M":"#4caf50","15M":"#8bc34a","12M":"#cddc39","10M":"#ffeb3b","6M":"#ff9800","2M":"#ff5722","70CM":"#f44336"}[e]||"#4fc3f7"}function Sn(e,l,s){let i,o,r,f,d,v,c,h,u,w,g,p,k,y,M,T,m,C,A,S,F,{flexradio:_=null}=l,{weather:I=null}=l,{latitude:O=null}=l,{longitude:J=null}=l,{windWarningThreshold:$=30}=l,{gustWarningThreshold:re=50}=l,{graylineWindow:H=30}=l,P=null,le=null,U=!1,N="",B="",se=new Date,K;Vl(()=>{fe(),K=setInterval(()=>{se=new Date,Me(),ee()},1e4)}),Zl(()=>{K&&clearInterval(K)});function fe(){if(!O||!J)return;const Z=Tl(new Date,O,J);s(12,P=Z.sunrise),s(13,le=Z.sunset),Me(),ee()}function Me(){if(!P||!le){s(14,U=!1);return}const V=se.getTime(),Z=H*60*1e3,ie=Math.abs(V-P.getTime())<=Z,ce=Math.abs(V-le.getTime())<=Z;s(14,U=ie||ce),s(15,N=ie?"sunrise":ce?"sunset":"")}function ee(){if(!P||!le){s(16,B="");return}const V=se.getTime();let Z=null,ie="";if(V<P.getTime())Z=P,ie="Sunrise";else if(V<le.getTime())Z=le,ie="Sunset";else{const ce=new Date(se);ce.setDate(ce.getDate()+1),Z=Tl(ce,O,J).sunrise,ie="Sunrise"}if(Z){const ce=Z.getTime()-V,oe=Math.floor(ce/(1e3*60*60)),ue=Math.floor(ce%(1e3*60*60)/(1e3*60));oe>0?s(16,B=`${ie} in ${oe}h${ue.toString().padStart(2,"0")}m`):s(16,B=`${ie} in ${ue}m`)}}return e.$$set=V=>{"flexradio"in V&&s(26,_=V.flexradio),"weather"in V&&s(27,I=V.weather),"latitude"in V&&s(0,O=V.latitude),"longitude"in V&&s(1,J=V.longitude),"windWarningThreshold"in V&&s(28,$=V.windWarningThreshold),"gustWarningThreshold"in V&&s(29,re=V.gustWarningThreshold),"graylineWindow"in V&&s(30,H=V.graylineWindow)},e.$$.update=()=>{e.$$.dirty[0]&67108864&&s(3,i=(_==null?void 0:_.frequency)||0),e.$$.dirty[0]&67108864&&s(25,o=(_==null?void 0:_.mode)||""),e.$$.dirty[0]&67108864&&s(24,r=(_==null?void 0:_.tx)||!1),e.$$.dirty[0]&67108864&&s(2,f=(_==null?void 0:_.connected)||!1),e.$$.dirty[0]&67108864&&s(31,d=(_==null?void 0:_.radio_on)||!1),e.$$.dirty[0]&67108864&&s(11,v=(_==null?void 0:_.radio_info)||""),e.$$.dirty[0]&67108864&&s(10,c=(_==null?void 0:_.callsign)||""),e.$$.dirty[0]&67108864&&s(9,h=(_==null?void 0:_.model)||""),e.$$.dirty[0]&67108864&&s(32,u=(_==null?void 0:_.active_slices)||0),e.$$.dirty[0]&3&&O&&J&&fe(),e.$$.dirty[0]&3596|e.$$.dirty[1]&3&&console.log("FlexRadio status:",{connected:f,radioOn:d,frequency:i,activeSlices:u,radioInfo:v,callsign:c,model:h}),e.$$.dirty[0]&134217728&&s(8,w=(I==null?void 0:I.wind_speed)||0),e.$$.dirty[0]&134217728&&s(7,g=(I==null?void 0:I.wind_gust)||0),e.$$.dirty[0]&268435712&&s(6,p=w>=$),e.$$.dirty[0]&536871040&&s(5,k=g>=re),e.$$.dirty[0]&96&&s(23,y=p||k),e.$$.dirty[0]&8&&s(4,M=Tn(i)),e.$$.dirty[0]&16&&s(22,T=Cn(M)),e.$$.dirty[0]&8|e.$$.dirty[1]&1&&s(21,m=d&&i>0),e.$$.dirty[0]&8|e.$$.dirty[1]&3&&s(20,C=d&&i===0&&u===0),e.$$.dirty[0]&8|e.$$.dirty[1]&3&&s(19,A=d&&i===0&&u>0),e.$$.dirty[0]&4&&s(18,S=!f),e.$$.dirty[0]&4|e.$$.dirty[1]&1&&s(17,F=f&&!d)},[O,J,f,i,M,k,p,g,w,h,c,v,P,le,U,N,B,F,S,A,C,m,T,y,r,o,_,I,$,re,H,d,u]}class Fn extends pt{constructor(l){super(),vt(this,l,Sn,Mn,ot,{flexradio:26,weather:27,latitude:0,longitude:1,windWarningThreshold:28,gustWarningThreshold:29,graylineWindow:30},null,[-1,-1])}}function Sl(e,l,s){var f;const i=e.slice();i[10]=l[s];const o=i[1].find(function(...v){return e[9](i[10],...v)});i[11]=o;const r=((f=i[11])==null?void 0:f.state)||!1;return i[12]=r,i}function Fl(e){let l,s,i,o,r,f,d=e[12]?"ON":"OFF",v,c,h,u,w,g,p,k;function y(){return e[8](e[10])}return{c(){l=a("div"),s=a("div"),i=a("div"),o=a("div"),o.textContent=`${e[3][e[10]]}`,r=b(),f=a("div"),v=z(d),c=b(),h=a("button"),u=a("div"),u.innerHTML='<div class="toggle-thumb svelte-z2csmj"></div>',g=b(),t(o,"class","relay-name svelte-z2csmj"),t(f,"class","relay-status svelte-z2csmj"),t(i,"class","relay-details svelte-z2csmj"),t(s,"class","relay-info svelte-z2csmj"),t(u,"class","toggle-track svelte-z2csmj"),t(h,"class","relay-toggle svelte-z2csmj"),h.disabled=w=e[0][e[10]],W(h,"active",e[12]),W(h,"loading",e[0][e[10]]),t(l,"class","relay-card svelte-z2csmj"),W(l,"relay-on",e[12])},m(M,T){L(M,l,T),n(l,s),n(s,i),n(i,o),n(i,r),n(i,f),n(f,v),n(l,c),n(l,h),n(h,u),n(l,g),p||(k=Ce(h,"click",y),p=!0)},p(M,T){e=M,T&2&&d!==(d=e[12]?"ON":"OFF")&&R(v,d),T&1&&w!==(w=e[0][e[10]])&&(h.disabled=w),T&2&&W(h,"active",e[12]),T&1&&W(h,"loading",e[0][e[10]]),T&2&&W(l,"relay-on",e[12])},d(M){M&&E(l),p=!1,k()}}}function Pn(e){let l,s,i,o,r,f,d,v,c,h,u,w,g,p,k,y=ut([1,2,3,4,5]),M=[];for(let T=0;T<5;T+=1)M[T]=Fl(Sl(e,y,T));return{c(){l=a("div"),s=a("div"),i=a("h2"),i.textContent="WebSwitch",o=b(),r=a("span"),f=b(),d=a("div"),v=a("div");for(let T=0;T<5;T+=1)M[T].c();c=b(),h=a("div"),u=a("button"),u.innerHTML=`<span class="btn-icon svelte-z2csmj">⚡</span>
ALL ON`,w=b(),g=a("button"),g.innerHTML=`<span class="btn-icon svelte-z2csmj">⏻</span>
ALL OFF`,t(i,"class","svelte-z2csmj"),t(r,"class","status-dot svelte-z2csmj"),W(r,"disconnected",!e[2]),t(s,"class","card-header svelte-z2csmj"),t(v,"class","relays svelte-z2csmj"),t(u,"class","control-btn all-on svelte-z2csmj"),t(g,"class","control-btn all-off svelte-z2csmj"),t(h,"class","controls svelte-z2csmj"),t(d,"class","metrics svelte-z2csmj"),t(l,"class","card svelte-z2csmj")},m(T,m){L(T,l,m),n(l,s),n(s,i),n(s,o),n(s,r),n(l,f),n(l,d),n(d,v);for(let C=0;C<5;C+=1)M[C]&&M[C].m(v,null);n(d,c),n(d,h),n(h,u),n(h,w),n(h,g),p||(k=[Ce(u,"click",e[5]),Ce(g,"click",e[6])],p=!0)},p(T,[m]){if(m&4&&W(r,"disconnected",!T[2]),m&27){y=ut([1,2,3,4,5]);let C;for(C=0;C<5;C+=1){const A=Sl(T,y,C);M[C]?M[C].p(A,m):(M[C]=Fl(A),M[C].c(),M[C].m(v,null))}for(;C<5;C+=1)M[C].d(1)}},i:we,o:we,d(T){T&&E(l),Dt(M,T),p=!1,nt(k)}}}function On(e,l,s){let i,o,{status:r}=l;const f={1:"Power Supply",2:"PGXL",3:"TGXL",4:"Flex Radio Start",5:"Reserve"};let d={};async function v(g){const p=i.find(y=>y.number===g),k=(p==null?void 0:p.state)||!1;s(0,d[g]=!0,d);try{k?await Oe.webswitch.relayOff(g):await Oe.webswitch.relayOn(g)}catch(y){console.error("Failed to toggle relay:",y),alert("Failed to control relay")}finally{s(0,d[g]=!1,d)}}async function c(){try{await Oe.webswitch.allOn()}catch(g){console.error("Failed to turn all on:",g)}}async function h(){try{await Oe.webswitch.allOff()}catch(g){console.error("Failed to turn all off:",g)}}const u=g=>v(g),w=(g,p)=>p.number===g;return e.$$set=g=>{"status"in g&&s(7,r=g.status)},e.$$.update=()=>{e.$$.dirty&128&&s(1,i=(r==null?void 0:r.relays)||[]),e.$$.dirty&128&&s(2,o=(r==null?void 0:r.connected)||!1)},[d,i,o,f,v,c,h,r,u,w]}class An extends pt{constructor(l){super(),vt(this,l,On,Pn,ot,{status:7})}}function In(e){let l,s,i,o,r,f,d,v,c,h,u,w,g,p,k,y,M,T=e[1].toFixed(0)+"",m,C,A,S,F,_,I,O,J,$=e[2].toFixed(2)+"",re,H,P,le,U,N,B,se=e[3].toFixed(1)+"",K,fe,Me,ee,V,Z,ie,ce,oe,ue,ne=e[12].toFixed(1)+"",Ae,Te,Ie,Ne,Pe,Se,te,ye,Q,X,x,G,de,Y=e[15].toFixed(0)+"",ve,j,be,pe,Ee,Ye,Ve=e[14].toFixed(1)+"",We,Je,Be,Le,$e,De,Qe=e[13].toFixed(1)+"",Ze,xe,Ge,he,ze,et,ht,rt,st,Re,Ke,Mt,He,gt,tt,it,je,lt,Xe,qe,at,Ue,Fe,zt;return{c(){l=a("div"),s=a("div"),i=a("h2"),i.textContent="Power Genius XL",o=b(),r=a("div"),f=a("button"),d=z(e[7]),v=b(),c=a("span"),h=b(),u=a("div"),w=a("div"),g=a("div"),p=a("div"),k=a("span"),k.textContent="Power",y=b(),M=a("span"),m=z(T),C=z(" W"),A=b(),S=a("div"),F=a("div"),_=a("div"),I=b(),O=a("div"),J=a("div"),re=z($),H=b(),P=a("div"),P.textContent="SWR",le=b(),U=a("div"),N=a("div"),B=a("div"),K=z(se),fe=z("°"),Me=b(),ee=a("div"),ee.textContent="PA Temp",V=b(),Z=a("div"),ie=a("div"),ce=b(),oe=a("div"),ue=a("div"),Ae=z(ne),Te=z("°"),Ie=b(),Ne=a("div"),Ne.textContent="HL Temp",Pe=b(),Se=a("div"),te=a("div"),ye=b(),Q=a("div"),X=a("div"),x=a("div"),x.textContent="VAC",G=b(),de=a("div"),ve=z(Y),j=b(),be=a("div"),pe=a("div"),pe.textContent="VDD",Ee=b(),Ye=a("div"),We=z(Ve),Je=b(),Be=a("div"),Le=a("div"),Le.textContent="ID Peak",$e=b(),De=a("div"),Ze=z(Qe),xe=b(),Ge=a("div"),he=a("div"),ze=a("span"),ze.textContent="Band A",et=b(),ht=a("span"),rt=z(e[10]),st=b(),Re=a("div"),Ke=a("span"),Ke.textContent="Band B",Mt=b(),He=a("span"),gt=z(e[9]),tt=b(),it=a("div"),je=a("label"),je.textContent="Fan Mode",lt=b(),Xe=a("select"),qe=a("option"),qe.textContent="Standard",at=a("option"),at.textContent="Contest",Ue=a("option"),Ue.textContent="Broadcast",t(i,"class","svelte-vwcbgz"),t(f,"class","state-badge svelte-vwcbgz"),W(f,"idle",e[0]==="IDLE"),W(f,"transmit",e[0].includes("TRANSMIT")),t(c,"class","status-dot svelte-vwcbgz"),W(c,"disconnected",!e[8]),t(r,"class","header-right svelte-vwcbgz"),t(s,"class","card-header svelte-vwcbgz"),t(k,"class","power-label-inline svelte-vwcbgz"),t(M,"class","power-value-inline svelte-vwcbgz"),t(p,"class","power-header svelte-vwcbgz"),t(_,"class","power-bar-fill svelte-vwcbgz"),ae(_,"width",e[4]+"%"),t(F,"class","power-bar-bg svelte-vwcbgz"),t(S,"class","power-bar-container svelte-vwcbgz"),t(g,"class","power-section svelte-vwcbgz"),t(J,"class","swr-value-compact svelte-vwcbgz"),t(P,"class","swr-label-compact svelte-vwcbgz"),t(O,"class","swr-circle-compact svelte-vwcbgz"),ae(O,"--swr-color",e[5]),t(w,"class","power-swr-row svelte-vwcbgz"),t(B,"class","temp-value svelte-vwcbgz"),ae(B,"color",e[6]),t(ee,"class","temp-label svelte-vwcbgz"),t(ie,"class","temp-mini-fill svelte-vwcbgz"),ae(ie,"width",e[3]/80*100+"%"),ae(ie,"background",e[6]),t(Z,"class","temp-mini-bar svelte-vwcbgz"),t(N,"class","temp-item svelte-vwcbgz"),t(ue,"class","temp-value svelte-vwcbgz"),ae(ue,"color",e[6]),t(Ne,"class","temp-label svelte-vwcbgz"),t(te,"class","temp-mini-fill svelte-vwcbgz"),ae(te,"width",e[12]/80*100+"%"),ae(te,"background",e[6]),t(Se,"class","temp-mini-bar svelte-vwcbgz"),t(oe,"class","temp-item svelte-vwcbgz"),t(U,"class","temp-group svelte-vwcbgz"),t(x,"class","param-label svelte-vwcbgz"),t(de,"class","param-value svelte-vwcbgz"),t(X,"class","param-box svelte-vwcbgz"),t(pe,"class","param-label svelte-vwcbgz"),t(Ye,"class","param-value svelte-vwcbgz"),t(be,"class","param-box svelte-vwcbgz"),t(Le,"class","param-label svelte-vwcbgz"),t(De,"class","param-value svelte-vwcbgz"),t(Be,"class","param-box svelte-vwcbgz"),t(Q,"class","params-grid svelte-vwcbgz"),t(ze,"class","band-label svelte-vwcbgz"),t(ht,"class","band-value svelte-vwcbgz"),t(he,"class","band-item svelte-vwcbgz"),t(Ke,"class","band-label svelte-vwcbgz"),t(He,"class","band-value svelte-vwcbgz"),t(Re,"class","band-item svelte-vwcbgz"),t(Ge,"class","band-display svelte-vwcbgz"),t(je,"for","fan-mode-select"),t(je,"class","control-label svelte-vwcbgz"),qe.__value="STANDARD",Pt(qe,qe.__value),at.__value="CONTEST",Pt(at,at.__value),Ue.__value="BROADCAST",Pt(Ue,Ue.__value),t(Xe,"id","fan-mode-select"),t(Xe,"class","svelte-vwcbgz"),t(it,"class","fan-control svelte-vwcbgz"),t(u,"class","metrics svelte-vwcbgz"),t(l,"class","card svelte-vwcbgz")},m(ge,_e){L(ge,l,_e),n(l,s),n(s,i),n(s,o),n(s,r),n(r,f),n(f,d),n(r,v),n(r,c),n(l,h),n(l,u),n(u,w),n(w,g),n(g,p),n(p,k),n(p,y),n(p,M),n(M,m),n(M,C),n(g,A),n(g,S),n(S,F),n(F,_),n(w,I),n(w,O),n(O,J),n(J,re),n(O,H),n(O,P),n(u,le),n(u,U),n(U,N),n(N,B),n(B,K),n(B,fe),n(N,Me),n(N,ee),n(N,V),n(N,Z),n(Z,ie),n(U,ce),n(U,oe),n(oe,ue),n(ue,Ae),n(ue,Te),n(oe,Ie),n(oe,Ne),n(oe,Pe),n(oe,Se),n(Se,te),n(u,ye),n(u,Q),n(Q,X),n(X,x),n(X,G),n(X,de),n(de,ve),n(Q,j),n(Q,be),n(be,pe),n(be,Ee),n(be,Ye),n(Ye,We),n(Q,Je),n(Q,Be),n(Be,Le),n(Be,$e),n(Be,De),n(De,Ze),n(u,xe),n(u,Ge),n(Ge,he),n(he,ze),n(he,et),n(he,ht),n(ht,rt),n(Ge,st),n(Ge,Re),n(Re,Ke),n(Re,Mt),n(Re,He),n(He,gt),n(u,tt),n(u,it),n(it,je),n(it,lt),n(it,Xe),n(Xe,qe),n(Xe,at),n(Xe,Ue),It(Xe,e[11]),Fe||(zt=[Ce(f,"click",e[17]),Ce(Xe,"change",e[19])],Fe=!0)},p(ge,[_e]){_e&128&&R(d,ge[7]),_e&1&&W(f,"idle",ge[0]==="IDLE"),_e&1&&W(f,"transmit",ge[0].includes("TRANSMIT")),_e&256&&W(c,"disconnected",!ge[8]),_e&2&&T!==(T=ge[1].toFixed(0)+"")&&R(m,T),_e&16&&ae(_,"width",ge[4]+"%"),_e&4&&$!==($=ge[2].toFixed(2)+"")&&R(re,$),_e&32&&ae(O,"--swr-color",ge[5]),_e&8&&se!==(se=ge[3].toFixed(1)+"")&&R(K,se),_e&64&&ae(B,"color",ge[6]),_e&8&&ae(ie,"width",ge[3]/80*100+"%"),_e&64&&ae(ie,"background",ge[6]),_e&4096&&ne!==(ne=ge[12].toFixed(1)+"")&&R(Ae,ne),_e&64&&ae(ue,"color",ge[6]),_e&4096&&ae(te,"width",ge[12]/80*100+"%"),_e&64&&ae(te,"background",ge[6]),_e&32768&&Y!==(Y=ge[15].toFixed(0)+"")&&R(ve,Y),_e&16384&&Ve!==(Ve=ge[14].toFixed(1)+"")&&R(We,Ve),_e&8192&&Qe!==(Qe=ge[13].toFixed(1)+"")&&R(Ze,Qe),_e&1024&&R(rt,ge[10]),_e&512&&R(gt,ge[9]),_e&2048&&It(Xe,ge[11])},i:we,o:we,d(ge){ge&&E(l),Fe=!1,nt(zt)}}}function Nn(e,l,s){let i,o,r,f,d,v,c,h,u,w,g,p,k,y,M,T,{status:m}=l;async function C(F){try{await Oe.power.setFanMode(F)}catch(_){console.error("Failed to set fan mode:",_)}}async function A(){try{const F=u==="IDLE"?0:1;await Oe.power.setOperate(F)}catch(F){console.error("Failed to toggle operate:",F)}}const S=F=>C(F.target.value);return e.$$set=F=>{"status"in F&&s(18,m=F.status)},e.$$.update=()=>{e.$$.dirty&262144&&s(1,i=(m==null?void 0:m.power_forward)||0),e.$$.dirty&262144&&m!=null&&m.power_reflected,e.$$.dirty&262144&&s(2,o=(m==null?void 0:m.swr)||1),e.$$.dirty&262144&&s(15,r=(m==null?void 0:m.voltage)||0),e.$$.dirty&262144&&s(14,f=(m==null?void 0:m.vdd)||0),e.$$.dirty&262144&&m!=null&&m.current,e.$$.dirty&262144&&s(13,d=(m==null?void 0:m.peak_current)||0),e.$$.dirty&262144&&s(3,v=(m==null?void 0:m.temperature)||0),e.$$.dirty&262144&&s(12,c=(m==null?void 0:m.harmonic_load_temp)||0),e.$$.dirty&262144&&s(11,h=(m==null?void 0:m.fan_mode)||"CONTEST"),e.$$.dirty&262144&&s(0,u=(m==null?void 0:m.state)||"IDLE"),e.$$.dirty&262144&&s(10,w=(m==null?void 0:m.band_a)||"0"),e.$$.dirty&262144&&s(9,g=(m==null?void 0:m.band_b)||"0"),e.$$.dirty&262144&&s(8,p=(m==null?void 0:m.connected)||!1),e.$$.dirty&1&&s(7,k=u.replace("TRANSMIT_A","TRANSMIT").replace("TRANSMIT_B","TRANSMIT")),e.$$.dirty&8&&s(6,y=v<40?"#4caf50":v<60?"#ffc107":v<75?"#ff9800":"#f44336"),e.$$.dirty&4&&s(5,M=o<1.5?"#4caf50":o<2?"#ffc107":o<3?"#ff9800":"#f44336"),e.$$.dirty&2&&s(4,T=Math.min(i/2e3*100,100))},[u,i,o,v,T,M,y,k,p,g,w,h,c,d,f,r,C,A,m,S]}class Dn extends pt{constructor(l){super(),vt(this,l,Nn,In,ot,{status:18})}}function En(e){let l,s,i,o,r,f,d,v,c,h,u,w,g,p,k,y,M,T=e[0].toFixed(0)+"",m,C,A,S,F,_,I,O,J,$=e[1].toFixed(2)+"",re,H,P,le,U,N,B,se,K,fe,Me,ee,V,Z,ie,ce,oe,ue,ne,Ae,Te,Ie,Ne,Pe,Se,te,ye,Q,X=(e[11]/1e3).toFixed(3)+"",x,G,de,Y,ve,j,be,pe=(e[10]/1e3).toFixed(3)+"",Ee,Ye,Ve,We,Je,Be=e[8]===1?"OPERATE":"STANDBY",Le,$e,De,Qe,Ze,xe,Ge;return{c(){l=a("div"),s=a("div"),i=a("h2"),i.textContent="Tuner Genius XL",o=b(),r=a("div"),f=a("span"),d=z(e[12]),v=b(),c=a("span"),h=b(),u=a("div"),w=a("div"),g=a("div"),p=a("div"),k=a("span"),k.textContent="Power",y=b(),M=a("span"),m=z(T),C=z(" W"),A=b(),S=a("div"),F=a("div"),_=a("div"),I=b(),O=a("div"),J=a("div"),re=z($),H=b(),P=a("div"),P.textContent="SWR",le=b(),U=a("div"),N=a("div"),B=a("div"),se=z(e[7]),K=b(),fe=a("div"),fe.textContent="C1",Me=b(),ee=a("div"),V=a("div"),Z=z(e[6]),ie=b(),ce=a("div"),ce.textContent="L",oe=b(),ue=a("div"),ne=a("div"),Ae=z(e[5]),Te=b(),Ie=a("div"),Ie.textContent="C2",Ne=b(),Pe=a("div"),Se=a("div"),te=a("div"),te.textContent="Freq A",ye=b(),Q=a("div"),x=z(X),G=a("span"),G.textContent="MHz",de=b(),Y=a("div"),ve=a("div"),ve.textContent="Freq B",j=b(),be=a("div"),Ee=z(pe),Ye=a("span"),Ye.textContent="MHz",Ve=b(),We=a("div"),Je=a("button"),Le=z(Be),$e=b(),De=a("button"),De.textContent="BYPASS",Qe=b(),Ze=a("button"),Ze.innerHTML=`<span class="tune-icon svelte-zuda7">⚡</span>
AUTO TUNE`,t(i,"class","svelte-zuda7"),t(f,"class","tuning-badge svelte-zuda7"),W(f,"tuning",e[12]==="TUNING"),t(c,"class","status-dot svelte-zuda7"),W(c,"disconnected",!e[4]),t(r,"class","header-right svelte-zuda7"),t(s,"class","card-header svelte-zuda7"),t(k,"class","power-label-inline svelte-zuda7"),t(M,"class","power-value-inline svelte-zuda7"),t(p,"class","power-header svelte-zuda7"),t(_,"class","power-bar-fill svelte-zuda7"),ae(_,"width",e[2]+"%"),t(F,"class","power-bar-bg svelte-zuda7"),t(S,"class","power-bar-container svelte-zuda7"),t(g,"class","power-section svelte-zuda7"),t(J,"class","swr-value-compact svelte-zuda7"),t(P,"class","swr-label-compact svelte-zuda7"),t(O,"class","swr-circle-compact svelte-zuda7"),ae(O,"--swr-color",e[3]),t(w,"class","power-swr-row svelte-zuda7"),t(B,"class","cap-value svelte-zuda7"),t(fe,"class","cap-label svelte-zuda7"),t(N,"class","cap-item svelte-zuda7"),t(V,"class","cap-value svelte-zuda7"),t(ce,"class","cap-label svelte-zuda7"),t(ee,"class","cap-item svelte-zuda7"),t(ne,"class","cap-value svelte-zuda7"),t(Ie,"class","cap-label svelte-zuda7"),t(ue,"class","cap-item svelte-zuda7"),t(U,"class","capacitors svelte-zuda7"),t(te,"class","freq-label svelte-zuda7"),t(G,"class","freq-unit svelte-zuda7"),t(Q,"class","freq-value svelte-zuda7"),t(Se,"class","freq-item svelte-zuda7"),t(ve,"class","freq-label svelte-zuda7"),t(Ye,"class","freq-unit svelte-zuda7"),t(be,"class","freq-value svelte-zuda7"),t(Y,"class","freq-item svelte-zuda7"),t(Pe,"class","freq-display svelte-zuda7"),t(Je,"class","control-btn operate svelte-zuda7"),W(Je,"active",e[8]===1),t(De,"class","control-btn bypass svelte-zuda7"),W(De,"active",e[9]),t(We,"class","controls svelte-zuda7"),t(Ze,"class","tune-btn svelte-zuda7"),t(u,"class","metrics svelte-zuda7"),t(l,"class","card svelte-zuda7")},m(he,ze){L(he,l,ze),n(l,s),n(s,i),n(s,o),n(s,r),n(r,f),n(f,d),n(r,v),n(r,c),n(l,h),n(l,u),n(u,w),n(w,g),n(g,p),n(p,k),n(p,y),n(p,M),n(M,m),n(M,C),n(g,A),n(g,S),n(S,F),n(F,_),n(w,I),n(w,O),n(O,J),n(J,re),n(O,H),n(O,P),n(u,le),n(u,U),n(U,N),n(N,B),n(B,se),n(N,K),n(N,fe),n(U,Me),n(U,ee),n(ee,V),n(V,Z),n(ee,ie),n(ee,ce),n(U,oe),n(U,ue),n(ue,ne),n(ne,Ae),n(ue,Te),n(ue,Ie),n(u,Ne),n(u,Pe),n(Pe,Se),n(Se,te),n(Se,ye),n(Se,Q),n(Q,x),n(Q,G),n(Pe,de),n(Pe,Y),n(Y,ve),n(Y,j),n(Y,be),n(be,Ee),n(be,Ye),n(u,Ve),n(u,We),n(We,Je),n(Je,Le),n(We,$e),n(We,De),n(u,Qe),n(u,Ze),xe||(Ge=[Ce(Je,"click",e[17]),Ce(De,"click",e[18]),Ce(Ze,"click",e[13])],xe=!0)},p(he,[ze]){ze&4096&&R(d,he[12]),ze&4096&&W(f,"tuning",he[12]==="TUNING"),ze&16&&W(c,"disconnected",!he[4]),ze&1&&T!==(T=he[0].toFixed(0)+"")&&R(m,T),ze&4&&ae(_,"width",he[2]+"%"),ze&2&&$!==($=he[1].toFixed(2)+"")&&R(re,$),ze&8&&ae(O,"--swr-color",he[3]),ze&128&&R(se,he[7]),ze&64&&R(Z,he[6]),ze&32&&R(Ae,he[5]),ze&2048&&X!==(X=(he[11]/1e3).toFixed(3)+"")&&R(x,X),ze&1024&&pe!==(pe=(he[10]/1e3).toFixed(3)+"")&&R(Ee,pe),ze&256&&Be!==(Be=he[8]===1?"OPERATE":"STANDBY")&&R(Le,Be),ze&256&&W(Je,"active",he[8]===1),ze&512&&W(De,"active",he[9])},i:we,o:we,d(he){he&&E(l),xe=!1,nt(Ge)}}}function Ln(e,l,s){let i,o,r,f,d,v,c,h,u,w,g,p,k,{status:y}=l;async function M(){try{await Oe.tuner.autoTune()}catch(S){console.error("Failed to tune:",S)}}async function T(S){try{await Oe.tuner.setBypass(S)}catch(F){console.error("Failed to set bypass:",F)}}async function m(S){try{await Oe.tuner.setOperate(S)}catch(F){console.error("Failed to set operate:",F)}}const C=()=>m(c===1?0:1),A=()=>T(v?0:1);return e.$$set=S=>{"status"in S&&s(16,y=S.status)},e.$$.update=()=>{e.$$.dirty&65536&&s(0,i=(y==null?void 0:y.power_forward)||0),e.$$.dirty&65536&&s(1,o=(y==null?void 0:y.swr)||1),e.$$.dirty&65536&&s(12,r=(y==null?void 0:y.tuning_status)||"READY"),e.$$.dirty&65536&&s(11,f=(y==null?void 0:y.frequency_a)||0),e.$$.dirty&65536&&s(10,d=(y==null?void 0:y.frequency_b)||0),e.$$.dirty&65536&&s(9,v=(y==null?void 0:y.bypass)||!1),e.$$.dirty&65536&&s(8,c=(y==null?void 0:y.state)||0),e.$$.dirty&65536&&s(7,h=(y==null?void 0:y.c1)||0),e.$$.dirty&65536&&s(6,u=(y==null?void 0:y.l)||0),e.$$.dirty&65536&&s(5,w=(y==null?void 0:y.c2)||0),e.$$.dirty&65536&&s(4,g=(y==null?void 0:y.connected)||!1),e.$$.dirty&2&&s(3,p=o<1.5?"#4caf50":o<2?"#ffc107":o<3?"#ff9800":"#f44336"),e.$$.dirty&1&&s(2,k=Math.min(i/2e3*100,100))},[i,o,k,p,g,w,u,h,c,v,d,f,r,M,T,m,y,C,A]}class Rn extends pt{constructor(l){super(),vt(this,l,Ln,En,ot,{status:16})}}function Pl(e,l,s){const i=e.slice();i[14]=l[s];const o=i[1].tx&&i[1].tx_ant===i[14].number;i[15]=o;const r=i[0].tx&&i[0].tx_ant===i[14].number;i[16]=r;const f=!i[1].tx&&i[1].rx_ant===i[14].number;i[17]=f;const d=!i[0].tx&&i[0].rx_ant===i[14].number;i[18]=d;const v=i[15]||i[16];i[19]=v;const c=i[17]||i[15];i[20]=c;const h=i[18]||i[16];return i[21]=h,i}function Ol(e){let l,s,i=e[14].name+"",o,r,f,d,v,c,h,u,w;function g(){return e[11](e[14])}function p(){return e[12](e[14])}return{c(){l=a("div"),s=a("div"),o=z(i),r=b(),f=a("div"),d=a("button"),d.textContent="A",v=b(),c=a("button"),c.textContent="B",h=b(),t(s,"class","antenna-name svelte-vlabwb"),t(d,"class","port-btn svelte-vlabwb"),W(d,"active",e[20]),t(c,"class","port-btn svelte-vlabwb"),W(c,"active",e[21]),t(f,"class","antenna-ports svelte-vlabwb"),t(l,"class","antenna-card svelte-vlabwb"),W(l,"tx",e[19]),W(l,"active-a",e[20]),W(l,"active-b",e[21])},m(k,y){L(k,l,y),n(l,s),n(s,o),n(l,r),n(l,f),n(f,d),n(f,v),n(f,c),n(l,h),u||(w=[Ce(d,"click",g),Ce(c,"click",p)],u=!0)},p(k,y){e=k,y&16&&i!==(i=e[14].name+"")&&R(o,i),y&18&&W(d,"active",e[20]),y&17&&W(c,"active",e[21]),y&19&&W(l,"tx",e[19]),y&18&&W(l,"active-a",e[20]),y&17&&W(l,"active-b",e[21])},d(k){k&&E(l),u=!1,nt(w)}}}function Wn(e){let l,s,i,o,r,f,d,v,c,h,u=(e[1].source||"FLEX")+"",w,g,p,k,y=(e[0].source||"FLEX")+"",M,T,m,C,A,S,F,_,I,O,J,$,re,H,P,le,U=ut(e[4]),N=[];for(let B=0;B<U.length;B+=1)N[B]=Ol(Pl(e,U,B));return{c(){l=a("div"),s=a("div"),i=a("h2"),i.textContent="Antenna Genius",o=b(),r=a("span"),f=b(),d=a("div"),v=a("div"),c=a("div"),h=a("div"),w=z(u),g=b(),p=a("div"),k=a("div"),M=z(y),T=b(),m=a("div"),C=a("div"),A=a("div"),S=z(e[3]),F=b(),_=a("div"),I=a("div"),O=z(e[2]),J=b(),$=a("div");for(let B=0;B<N.length;B+=1)N[B].c();re=b(),H=a("button"),H.innerHTML=`<span class="reboot-icon svelte-vlabwb">🔄</span>
REBOOT`,t(i,"class","svelte-vlabwb"),t(r,"class","status-dot svelte-vlabwb"),W(r,"disconnected",!e[5]),t(s,"class","card-header svelte-vlabwb"),t(h,"class","source-label svelte-vlabwb"),t(c,"class","source-item svelte-vlabwb"),t(k,"class","source-label svelte-vlabwb"),t(p,"class","source-item svelte-vlabwb"),t(v,"class","sources svelte-vlabwb"),t(A,"class","band-value svelte-vlabwb"),t(C,"class","band-item svelte-vlabwb"),t(I,"class","band-value svelte-vlabwb"),t(_,"class","band-item svelte-vlabwb"),t(m,"class","bands svelte-vlabwb"),t($,"class","antennas svelte-vlabwb"),t(H,"class","reboot-btn svelte-vlabwb"),t(d,"class","metrics svelte-vlabwb"),t(l,"class","card svelte-vlabwb")},m(B,se){L(B,l,se),n(l,s),n(s,i),n(s,o),n(s,r),n(l,f),n(l,d),n(d,v),n(v,c),n(c,h),n(h,w),n(v,g),n(v,p),n(p,k),n(k,M),n(d,T),n(d,m),n(m,C),n(C,A),n(A,S),n(m,F),n(m,_),n(_,I),n(I,O),n(d,J),n(d,$);for(let K=0;K<N.length;K+=1)N[K]&&N[K].m($,null);n(d,re),n(d,H),P||(le=Ce(H,"click",e[7]),P=!0)},p(B,[se]){if(se&32&&W(r,"disconnected",!B[5]),se&2&&u!==(u=(B[1].source||"FLEX")+"")&&R(w,u),se&1&&y!==(y=(B[0].source||"FLEX")+"")&&R(M,y),se&8&&R(S,B[3]),se&4&&R(O,B[2]),se&83){U=ut(B[4]);let K;for(K=0;K<U.length;K+=1){const fe=Pl(B,U,K);N[K]?N[K].p(fe,se):(N[K]=Ol(fe),N[K].c(),N[K].m($,null))}for(;K<N.length;K+=1)N[K].d(1);N.length=U.length}},i:we,o:we,d(B){B&&E(l),Dt(N,B),P=!1,le()}}}function Bn(e,l,s){let i,o,r,f,d,v,{status:c}=l;const h={0:"160M",1:"80M",2:"60M",3:"40M",4:"30M",5:"20M",6:"17M",7:"15M",8:"12M",9:"10M",10:"6M",11:"4M",12:"2M",13:"1.25M",14:"70CM",15:"GEN"};async function u(M,T){try{M===1&&o.rx_ant===T||M===2&&r.rx_ant===T?(console.log(`Deselecting antenna ${T} from port ${M}`),await Oe.antenna.deselectAntenna(M,T)):(console.log(`Selecting antenna ${T} on port ${M}`),await Oe.antenna.selectAntenna(M,T))}catch(m){console.error("Failed to select/deselect antenna:",m)}}let w=!1,g=!1;async function p(){if(confirm("Are you sure you want to reboot the Antenna Genius?"))try{await Oe.antenna.reboot(),console.log("Antenna Genius reboot command sent")}catch(M){console.error("Failed to reboot:",M)}}const k=M=>u(1,M.number),y=M=>u(2,M.number);return e.$$set=M=>{"status"in M&&s(8,c=M.status)},e.$$.update=()=>{e.$$.dirty&256&&s(5,i=(c==null?void 0:c.connected)||!1),e.$$.dirty&256&&s(1,o=(c==null?void 0:c.port_a)||{}),e.$$.dirty&256&&s(0,r=(c==null?void 0:c.port_b)||{}),e.$$.dirty&256&&s(4,f=(c==null?void 0:c.antennas)||[]),e.$$.dirty&2&&s(3,d=h[o.band]||"None"),e.$$.dirty&1&&s(2,v=h[r.band]||"None"),e.$$.dirty&1795&&c&&(o.tx!==w||r.tx!==g)&&(console.log("AntennaGenius TX state changed:",{portA_tx:o.tx,portB_tx:r.tx,portA_tx_ant:o.tx_ant,portB_tx_ant:r.tx_ant}),s(9,w=o.tx),s(10,g=r.tx))},[r,o,v,d,f,i,u,p,c,w,g,k,y]}class Gn extends pt{constructor(l){super(),vt(this,l,Bn,Wn,ot,{status:8})}}function Al(e,l,s){const i=e.slice();i[16]=l[s];const o=150+125*Math.sin(i[16]*Math.PI/180);i[17]=o;const r=150-125*Math.cos(i[16]*Math.PI/180);return i[18]=r,i}function Il(e){let l,s,i,o;return{c(){l=a("span"),s=z("→ "),i=z(e[0]),o=z("°"),t(l,"class","target-indicator svelte-3omzwr")},m(r,f){L(r,l,f),n(l,s),n(l,i),n(l,o)},p(r,f){f&1&&R(i,r[0])},d(r){r&&E(l)}}}function Nl(e){let l,s,i,o,r;return{c(){l=D("g"),s=D("line"),i=D("g"),o=D("polygon"),t(s,"x1","0"),t(s,"y1","0"),t(s,"x2","0"),t(s,"y2","-125"),t(s,"stroke","rgba(255, 255, 255, 0.3)"),t(s,"stroke-width","2"),t(s,"stroke-dasharray","5,5"),t(s,"opacity","0.6"),t(o,"points","0,-8 -5,5 5,5"),t(o,"fill","rgba(255, 255, 255, 0.4)"),t(o,"stroke","rgba(255, 255, 255, 0.5)"),t(o,"stroke-width","1"),t(i,"transform","translate(0, -125)"),t(l,"transform",r="rotate("+e[3]+")")},m(f,d){L(f,l,d),n(l,s),n(l,i),n(i,o)},p(f,d){d&8&&r!==(r="rotate("+f[3]+")")&&t(l,"transform",r)},d(f){f&&E(l)}}}function Dl(e){let l,s,i,o,r;return{c(){l=D("path"),s=D("line"),i=D("line"),o=D("g"),r=D("polygon"),t(l,"d","M 0,0 L "+-Math.sin(15*Math.PI/180)*130+","+-Math.cos(15*Math.PI/180)*130+` \r
A 130,130 0 0,1 `+Math.sin(15*Math.PI/180)*130+","+-Math.cos(15*Math.PI/180)*130+" Z"),t(l,"fill","url(#beamGradient)"),t(l,"opacity","0.85"),t(s,"x1","0"),t(s,"y1","0"),t(s,"x2",-Math.sin(15*Math.PI/180)*130),t(s,"y2",-Math.cos(15*Math.PI/180)*130),t(s,"stroke","#4fc3f7"),t(s,"stroke-width","2"),t(s,"opacity","0.9"),t(i,"x1","0"),t(i,"y1","0"),t(i,"x2",Math.sin(15*Math.PI/180)*130),t(i,"y2",-Math.cos(15*Math.PI/180)*130),t(i,"stroke","#4fc3f7"),t(i,"stroke-width","2"),t(i,"opacity","0.9"),t(r,"points","0,-20 -8,5 0,0 8,5"),t(r,"fill","#4fc3f7"),t(r,"stroke","#0288d1"),t(r,"stroke-width","2"),ae(r,"filter","drop-shadow(0 0 10px rgba(79, 195, 247, 1))"),t(o,"transform","translate(0, -110)")},m(f,d){L(f,l,d),L(f,s,d),L(f,i,d),L(f,o,d),n(o,r)},p:we,d(f){f&&(E(l),E(s),E(i),E(o))}}}function El(e){let l,s,i,o,r;return{c(){l=D("path"),s=D("line"),i=D("line"),o=D("g"),r=D("polygon"),t(l,"d","M 0,0 L "+-Math.sin(15*Math.PI/180)*130+","+Math.cos(15*Math.PI/180)*130+` \r
A 130,130 0 0,0 `+Math.sin(15*Math.PI/180)*130+","+Math.cos(15*Math.PI/180)*130+" Z"),t(l,"fill","url(#beamGradient)"),t(l,"opacity","0.85"),t(s,"x1","0"),t(s,"y1","0"),t(s,"x2",-Math.sin(15*Math.PI/180)*130),t(s,"y2",Math.cos(15*Math.PI/180)*130),t(s,"stroke","#4fc3f7"),t(s,"stroke-width","2"),t(s,"opacity","0.9"),t(i,"x1","0"),t(i,"y1","0"),t(i,"x2",Math.sin(15*Math.PI/180)*130),t(i,"y2",Math.cos(15*Math.PI/180)*130),t(i,"stroke","#4fc3f7"),t(i,"stroke-width","2"),t(i,"opacity","0.9"),t(r,"points","0,20 -8,-5 0,0 8,-5"),t(r,"fill","#4fc3f7"),t(r,"stroke","#0288d1"),t(r,"stroke-width","2"),ae(r,"filter","drop-shadow(0 0 10px rgba(79, 195, 247, 1))"),t(o,"transform","translate(0, 110)")},m(f,d){L(f,l,d),L(f,s,d),L(f,i,d),L(f,o,d),n(o,r)},p:we,d(f){f&&(E(l),E(s),E(i),E(o))}}}function Ll(e){let l,s,i,o,r,f,d,v,c,h;return{c(){l=D("path"),s=D("path"),i=D("line"),o=D("line"),r=D("line"),f=D("line"),d=D("g"),v=D("polygon"),c=D("g"),h=D("polygon"),t(l,"d","M 0,0 L "+-Math.sin(15*Math.PI/180)*130+","+-Math.cos(15*Math.PI/180)*130+` \r
A 130,130 0 0,1 `+Math.sin(15*Math.PI/180)*130+","+-Math.cos(15*Math.PI/180)*130+" Z"),t(l,"fill","url(#beamGradient)"),t(l,"opacity","0.7"),t(s,"d","M 0,0 L "+-Math.sin(15*Math.PI/180)*130+","+Math.cos(15*Math.PI/180)*130+` \r
A 130,130 0 0,0 `+Math.sin(15*Math.PI/180)*130+","+Math.cos(15*Math.PI/180)*130+" Z"),t(s,"fill","url(#beamGradient)"),t(s,"opacity","0.7"),t(i,"x1","0"),t(i,"y1","0"),t(i,"x2",-Math.sin(15*Math.PI/180)*130),t(i,"y2",-Math.cos(15*Math.PI/180)*130),t(i,"stroke","#4fc3f7"),t(i,"stroke-width","2"),t(i,"opacity","0.8"),t(o,"x1","0"),t(o,"y1","0"),t(o,"x2",Math.sin(15*Math.PI/180)*130),t(o,"y2",-Math.cos(15*Math.PI/180)*130),t(o,"stroke","#4fc3f7"),t(o,"stroke-width","2"),t(o,"opacity","0.8"),t(r,"x1","0"),t(r,"y1","0"),t(r,"x2",-Math.sin(15*Math.PI/180)*130),t(r,"y2",Math.cos(15*Math.PI/180)*130),t(r,"stroke","#4fc3f7"),t(r,"stroke-width","2"),t(r,"opacity","0.8"),t(f,"x1","0"),t(f,"y1","0"),t(f,"x2",Math.sin(15*Math.PI/180)*130),t(f,"y2",Math.cos(15*Math.PI/180)*130),t(f,"stroke","#4fc3f7"),t(f,"stroke-width","2"),t(f,"opacity","0.8"),t(v,"points","0,-20 -8,5 0,0 8,5"),t(v,"fill","#4fc3f7"),t(v,"stroke","#0288d1"),t(v,"stroke-width","2"),ae(v,"filter","drop-shadow(0 0 10px rgba(79, 195, 247, 1))"),t(d,"transform","translate(0, -110)"),t(h,"points","0,20 -8,-5 0,0 8,-5"),t(h,"fill","#4fc3f7"),t(h,"stroke","#0288d1"),t(h,"stroke-width","2"),ae(h,"filter","drop-shadow(0 0 10px rgba(79, 195, 247, 1))"),t(c,"transform","translate(0, 110)")},m(u,w){L(u,l,w),L(u,s,w),L(u,i,w),L(u,o,w),L(u,r,w),L(u,f,w),L(u,d,w),n(d,v),L(u,c,w),n(c,h)},p:we,d(u){u&&(E(l),E(s),E(i),E(o),E(r),E(f),E(d),E(c))}}}function Rl(e){let l,s,i,o,r,f;return{c(){l=D("g"),s=D("line"),i=D("g"),o=D("polygon"),r=D("animate"),t(s,"x1","0"),t(s,"y1","0"),t(s,"x2","0"),t(s,"y2","-135"),t(s,"stroke","#ffc107"),t(s,"stroke-width","3"),t(s,"stroke-dasharray","8,4"),t(s,"opacity","0.9"),t(r,"attributeName","opacity"),t(r,"values","0.8;1;0.8"),t(r,"dur","1s"),t(r,"repeatCount","indefinite"),t(o,"points","0,-12 -8,6 0,2 8,6"),t(o,"fill","#ffc107"),t(o,"stroke","#ff9800"),t(o,"stroke-width","1.5"),ae(o,"filter","drop-shadow(0 0 10px rgba(255, 193, 7, 0.8))"),t(i,"transform","translate(0, -135)"),t(l,"transform",f="rotate("+e[0]+")")},m(d,v){L(d,l,v),n(l,s),n(l,i),n(i,o),n(o,r)},p(d,v){v&1&&f!==(f="rotate("+d[0]+")")&&t(l,"transform",f)},d(d){d&&E(l)}}}function Wl(e){let l,s,i;return{c(){l=D("text"),s=z(e[16]),i=z("°"),t(l,"x",e[17]),t(l,"y",e[18]),t(l,"text-anchor","middle"),t(l,"dominant-baseline","middle"),t(l,"class","degree-label svelte-3omzwr")},m(o,r){L(o,l,r),n(l,s),n(l,i)},p:we,d(o){o&&E(l)}}}function Bl(e){let l;return{c(){l=a("div"),l.innerHTML='<div class="legend-item svelte-3omzwr"><svg width="30" height="20" viewBox="0 0 30 20"><line x1="5" y1="10" x2="25" y2="10" stroke="rgba(255,255,255,0.3)" stroke-width="2" stroke-dasharray="3,3"></line></svg> <span>Physical antenna</span></div> <div class="legend-item svelte-3omzwr"><svg width="30" height="20" viewBox="0 0 30 20"><line x1="5" y1="10" x2="25" y2="10" stroke="#4fc3f7" stroke-width="2"></line></svg> <span>Radiation pattern</span></div>',t(l,"class","map-legend svelte-3omzwr")},m(s,i){L(s,l,i)},d(s){s&&E(l)}}}function jn(e){let l,s,i,o,r,f,d,v,c,h,u,w,g,p,k,y,M,T,m,C,A,S,F,_,I,O,J,$,re,H,P,le,U,N,B,se,K,fe,Me,ee,V,Z,ie,ce,oe,ue,ne,Ae,Te,Ie,Ne,Pe,Se,te=e[2]&&e[0]!==null&&Il(e),ye=(e[4]===1||e[4]===2)&&Nl(e),Q=e[4]===0&&Dl(),X=e[4]===1&&El(),x=e[4]===2&&Ll(),G=e[2]&&e[0]!==null&&Rl(e),de=ut([45,135,225,315]),Y=[];for(let j=0;j<4;j+=1)Y[j]=Wl(Al(e,de,j));let ve=(e[4]===1||e[4]===2)&&Bl();return{c(){l=a("div"),s=a("div"),i=a("h2"),i.textContent="Rotator Genius",o=b(),r=a("span"),f=b(),d=a("div"),v=a("div"),c=a("div"),h=a("div"),h.textContent="CURRENT HEADING",u=b(),w=a("div"),g=z(e[3]),p=z(`°\r
`),te&&te.c(),k=b(),y=a("div"),M=a("button"),M.textContent="↺",T=b(),m=a("button"),m.textContent="■",C=b(),A=a("button"),A.textContent="↻",S=b(),F=a("div"),_=D("svg"),I=D("defs"),O=D("radialGradient"),J=D("stop"),$=D("stop"),re=D("circle"),H=D("circle"),P=D("circle"),le=D("circle"),U=D("g"),ye&&ye.c(),N=D("g"),Q&&Q.c(),B=At(),X&&X.c(),se=At(),x&&x.c(),G&&G.c(),fe=D("circle"),Me=D("animate"),ee=D("circle"),V=D("animate"),Z=D("animate"),ie=D("text"),ce=z("N"),oe=D("text"),ue=z("E"),ne=D("text"),Ae=z("S"),Te=D("text"),Ie=z("W");for(let j=0;j<4;j+=1)Y[j].c();Ne=b(),ve&&ve.c(),t(i,"class","svelte-3omzwr"),t(r,"class","status-dot svelte-3omzwr"),W(r,"disconnected",!e[1]),t(s,"class","card-header svelte-3omzwr"),t(h,"class","heading-label svelte-3omzwr"),t(w,"class","heading-value svelte-3omzwr"),t(c,"class","heading-display-compact svelte-3omzwr"),t(M,"class","btn-mini ccw svelte-3omzwr"),t(M,"title","Rotate Counter-Clockwise"),t(m,"class","btn-mini stop svelte-3omzwr"),t(m,"title","Stop Rotation"),t(A,"class","btn-mini cw svelte-3omzwr"),t(A,"title","Rotate Clockwise"),t(y,"class","controls-compact svelte-3omzwr"),t(v,"class","heading-controls-row svelte-3omzwr"),t(J,"offset","0%"),ae(J,"stop-color","rgba(79, 195, 247, 0.7)"),ae(J,"stop-opacity","1"),t($,"offset","100%"),ae($,"stop-color","rgba(79, 195, 247, 0)"),ae($,"stop-opacity","0"),t(O,"id","beamGradient"),t(re,"cx","150"),t(re,"cy","150"),t(re,"r","140"),t(re,"fill","rgba(30, 64, 175, 0.15)"),t(re,"stroke","rgba(79, 195, 247, 0.4)"),t(re,"stroke-width","2"),t(H,"cx","150"),t(H,"cy","150"),t(H,"r","105"),t(H,"fill","none"),t(H,"stroke","rgba(79,195,247,0.2)"),t(H,"stroke-width","1"),t(H,"stroke-dasharray","3,3"),t(P,"cx","150"),t(P,"cy","150"),t(P,"r","70"),t(P,"fill","none"),t(P,"stroke","rgba(79,195,247,0.2)"),t(P,"stroke-width","1"),t(P,"stroke-dasharray","3,3"),t(le,"cx","150"),t(le,"cy","150"),t(le,"r","35"),t(le,"fill","none"),t(le,"stroke","rgba(79,195,247,0.2)"),t(le,"stroke-width","1"),t(le,"stroke-dasharray","3,3"),t(N,"transform",K="rotate("+e[3]+")"),t(Me,"attributeName","r"),t(Me,"values","5;7;5"),t(Me,"dur","2s"),t(Me,"repeatCount","indefinite"),t(fe,"cx","0"),t(fe,"cy","0"),t(fe,"r","5"),t(fe,"fill","#f44336"),t(fe,"stroke","#fff"),t(fe,"stroke-width","2"),t(V,"attributeName","r"),t(V,"values","10;16;10"),t(V,"dur","2s"),t(V,"repeatCount","indefinite"),t(Z,"attributeName","opacity"),t(Z,"values","0.5;0;0.5"),t(Z,"dur","2s"),t(Z,"repeatCount","indefinite"),t(ee,"cx","0"),t(ee,"cy","0"),t(ee,"r","10"),t(ee,"fill","none"),t(ee,"stroke","#f44336"),t(ee,"stroke-width","1.5"),t(ee,"opacity","0.5"),t(U,"transform","translate(150, 150)"),t(ie,"x","150"),t(ie,"y","20"),t(ie,"text-anchor","middle"),t(ie,"class","cardinal svelte-3omzwr"),t(oe,"x","280"),t(oe,"y","155"),t(oe,"text-anchor","middle"),t(oe,"class","cardinal svelte-3omzwr"),t(ne,"x","150"),t(ne,"y","285"),t(ne,"text-anchor","middle"),t(ne,"class","cardinal svelte-3omzwr"),t(Te,"x","20"),t(Te,"y","155"),t(Te,"text-anchor","middle"),t(Te,"class","cardinal svelte-3omzwr"),t(_,"viewBox","0 0 300 300"),t(_,"class","map-svg clickable-compass svelte-3omzwr"),t(_,"role","button"),t(_,"tabindex","0"),t(_,"aria-label","Click to rotate antenna to direction"),t(F,"class","map-container svelte-3omzwr"),t(d,"class","metrics svelte-3omzwr"),t(l,"class","card svelte-3omzwr")},m(j,be){L(j,l,be),n(l,s),n(s,i),n(s,o),n(s,r),n(l,f),n(l,d),n(d,v),n(v,c),n(c,h),n(c,u),n(c,w),n(w,g),n(w,p),te&&te.m(w,null),n(v,k),n(v,y),n(y,M),n(y,T),n(y,m),n(y,C),n(y,A),n(d,S),n(d,F),n(F,_),n(_,I),n(I,O),n(O,J),n(O,$),n(_,re),n(_,H),n(_,P),n(_,le),n(_,U),ye&&ye.m(U,null),n(U,N),Q&&Q.m(N,null),n(N,B),X&&X.m(N,null),n(N,se),x&&x.m(N,null),G&&G.m(U,null),n(U,fe),n(fe,Me),n(U,ee),n(ee,V),n(ee,Z),n(_,ie),n(ie,ce),n(_,oe),n(oe,ue),n(_,ne),n(ne,Ae),n(_,Te),n(Te,Ie);for(let pe=0;pe<4;pe+=1)Y[pe]&&Y[pe].m(_,null);n(d,Ne),ve&&ve.m(d,null),Pe||(Se=[Ce(M,"click",e[6]),Ce(m,"click",e[7]),Ce(A,"click",e[5]),Ce(_,"click",e[8]),Ce(_,"keydown",e[15])],Pe=!0)},p(j,[be]){if(be&2&&W(r,"disconnected",!j[1]),be&8&&R(g,j[3]),j[2]&&j[0]!==null?te?te.p(j,be):(te=Il(j),te.c(),te.m(w,null)):te&&(te.d(1),te=null),j[4]===1||j[4]===2?ye?ye.p(j,be):(ye=Nl(j),ye.c(),ye.m(U,N)):ye&&(ye.d(1),ye=null),j[4]===0?Q?Q.p(j,be):(Q=Dl(),Q.c(),Q.m(N,B)):Q&&(Q.d(1),Q=null),j[4]===1?X?X.p(j,be):(X=El(),X.c(),X.m(N,se)):X&&(X.d(1),X=null),j[4]===2?x?x.p(j,be):(x=Ll(),x.c(),x.m(N,null)):x&&(x.d(1),x=null),be&8&&K!==(K="rotate("+j[3]+")")&&t(N,"transform",K),j[2]&&j[0]!==null?G?G.p(j,be):(G=Rl(j),G.c(),G.m(U,fe)):G&&(G.d(1),G=null),be&0){de=ut([45,135,225,315]);let pe;for(pe=0;pe<4;pe+=1){const Ee=Al(j,de,pe);Y[pe]?Y[pe].p(Ee,be):(Y[pe]=Wl(Ee),Y[pe].c(),Y[pe].m(_,null))}for(;pe<4;pe+=1)Y[pe].d(1)}j[4]===1||j[4]===2?ve||(ve=Bl(),ve.c(),ve.m(d,null)):ve&&(ve.d(1),ve=null)},i:we,o:we,d(j){j&&E(l),te&&te.d(),ye&&ye.d(),Q&&Q.d(),X&&X.d(),x&&x.d(),G&&G.d(),Dt(Y,j),ve&&ve.d(),Pe=!1,nt(Se)}}}function qn(e,l,s){let i,o,r,f,d,v,{status:c}=l,{ultrabeam:h=null}=l,u=null,w=!1,g=null;async function p(){try{await Oe.rotator.rotateCW()}catch(m){console.error("Failed to rotate CW:",m)}}async function k(){try{await Oe.rotator.rotateCCW()}catch(m){console.error("Failed to rotate CCW:",m)}}async function y(){try{s(12,g=null),await Oe.rotator.stop()}catch(m){console.error("Failed to stop:",m)}}async function M(m){const A=m.currentTarget.getBoundingClientRect(),S=A.width/2,F=A.height/2,_=m.clientX-A.left-S,I=m.clientY-A.top-F;let O=Math.atan2(_,-I)*(180/Math.PI);O<0&&(O+=360);const $=(Math.round(O/5)*5+360)%360;try{await Oe.rotator.setHeading($),s(12,g=$)}catch(re){console.error("Failed to set heading:",re)}}const T=m=>m.key==="Enter"&&M(m);return e.$$set=m=>{"status"in m&&s(9,c=m.status),"ultrabeam"in m&&s(10,h=m.ultrabeam)},e.$$.update=()=>{if(e.$$.dirty&1024&&s(4,i=(h==null?void 0:h.direction)??0),e.$$.dirty&2560&&(c==null?void 0:c.heading)!==void 0&&(c==null?void 0:c.heading)!==null){const m=c.heading;u===null?(s(11,u=m),console.log(` ✓ First load, set to ${u}°`)):m===0&&u>10&&u<350?console.log(` ✗ IGNORED glitch jump from ${u}° to 0°`):s(11,u=m)}if(e.$$.dirty&2048&&s(3,o=u!==null?u:0),e.$$.dirty&512&&s(1,w=(c==null?void 0:c.connected)||!1),e.$$.dirty&512&&s(13,r=(c==null?void 0:c.target_heading)??null),e.$$.dirty&10240&&s(14,f=r!==null&&u!==null&&(()=>{const m=Math.abs(r-u);return Math.min(m,360-m)>2})()),e.$$.dirty&6144&&g!==null&&u!==null){const m=Math.abs(u-g);Math.min(m,360-m)<3&&s(12,g=null)}e.$$.dirty&28672&&s(0,d=g??(f?r:null)),e.$$.dirty&2049&&s(2,v=d!==null&&u!==null&&(()=>{const m=Math.abs(d-u);return Math.min(m,360-m)>2})())},[d,w,v,o,i,p,k,y,M,c,h,u,g,r,f,T]}class Un extends pt{constructor(l){super(),vt(this,l,qn,jn,ot,{status:9,ultrabeam:10})}}function Gl(e,l,s){const i=e.slice();return i[35]=l[s],i}function jl(e){let l,s=e[35].label+"",i;return{c(){l=a("option"),i=z(s),l.__value=e[35].value,Pt(l,l.__value)},m(o,r){L(o,l,r),n(l,i)},p:we,d(o){o&&E(l)}}}function ql(e){let l,s,i,o,r,f,d,v,c,h=e[6].toFixed(0)+"",u,w;return{c(){l=a("div"),s=a("h3"),s.textContent="Motors Moving...",i=b(),o=a("div"),r=a("div"),f=b(),d=a("div"),v=z(e[0]),c=z(" / 60 ("),u=z(h),w=z("%)"),t(s,"class","svelte-17wppqz"),t(r,"class","progress-fill svelte-17wppqz"),ae(r,"width",e[6]+"%"),t(o,"class","progress-bar svelte-17wppqz"),t(d,"class","progress-text svelte-17wppqz"),t(l,"class","progress-section svelte-17wppqz")},m(g,p){L(g,l,p),n(l,s),n(l,i),n(l,o),n(o,r),n(l,f),n(l,d),n(d,v),n(d,c),n(d,u),n(d,w)},p(g,p){p[0]&64&&ae(r,"width",g[6]+"%"),p[0]&1&&R(v,g[0]),p[0]&64&&h!==(h=g[6].toFixed(0)+"")&&R(u,h)},d(g){g&&E(l)}}}function Jn(e){let l,s,i,o,r,f,d,v,c,h,u,w,g=(e[1]/1e3).toFixed(3)+"",p,k,y,M,T,m,C,A,S,F,_,I,O,J=e[10][e[2]]+"",$,re,H,P,le,U,N,B,se,K,fe,Me,ee,V,Z,ie,ce,oe,ue,ne,Ae,Te,Ie,Ne,Pe,Se,te,ye,Q=ut(e[11]),X=[];for(let G=0;G<Q.length;G+=1)X[G]=jl(Gl(e,Q,G));let x=e[8]>0&&ql(e);return{c(){l=a("div"),s=a("div"),i=a("h2"),i.textContent="Ultrabeam VL2.3",o=b(),r=a("span"),f=b(),d=a("div"),v=a("div"),c=a("div"),h=a("div"),h.textContent="Frequency",u=b(),w=a("div"),p=z(g),k=z(" MHz"),y=b(),M=a("div"),T=a("div"),T.textContent="Band",m=b(),C=a("div"),A=z(e[7]),S=b(),F=a("div"),_=a("div"),_.textContent="Direction",I=b(),O=a("div"),$=z(J),re=b(),H=a("div"),P=a("h3"),P.textContent="Auto Tracking",le=b(),U=a("div"),N=a("label"),B=a("input"),se=b(),K=a("span"),K.textContent="Enable Auto-Track from Tuner",fe=b(),Me=a("div"),ee=a("label"),ee.textContent="Threshold:",V=b(),Z=a("select");for(let G=0;G<X.length;G+=1)X[G].c();ie=b(),ce=a("div"),oe=a("button"),oe.textContent="Normal",ue=b(),ne=a("button"),ne.textContent="180°",Ae=b(),Te=a("button"),Te.textContent="Bi-Dir",Ie=b(),x&&x.c(),Ne=b(),Pe=a("div"),Se=a("button"),Se.innerHTML=`<span class="icon">↓</span>
Retract Elements`,t(i,"class","svelte-17wppqz"),t(r,"class","status-dot svelte-17wppqz"),W(r,"disconnected",!e[9]),t(s,"class","card-header svelte-17wppqz"),t(h,"class","status-label svelte-17wppqz"),t(w,"class","status-value freq svelte-17wppqz"),t(c,"class","status-item svelte-17wppqz"),t(T,"class","status-label svelte-17wppqz"),t(C,"class","status-value band svelte-17wppqz"),t(M,"class","status-item svelte-17wppqz"),t(_,"class","status-label svelte-17wppqz"),t(O,"class","status-value direction svelte-17wppqz"),t(F,"class","status-item svelte-17wppqz"),t(v,"class","status-grid svelte-17wppqz"),t(P,"class","svelte-17wppqz"),t(B,"type","checkbox"),t(B,"class","svelte-17wppqz"),t(N,"class","toggle-label svelte-17wppqz"),t(ee,"for","threshold-select"),t(ee,"class","svelte-17wppqz"),t(Z,"id","threshold-select"),e[4]===void 0&&Nt(()=>e[22].call(Z)),t(Me,"class","threshold-group svelte-17wppqz"),t(U,"class","auto-track-controls svelte-17wppqz"),t(oe,"class","dir-btn svelte-17wppqz"),W(oe,"active",e[5]===0),t(ne,"class","dir-btn svelte-17wppqz"),W(ne,"active",e[5]===1),t(Te,"class","dir-btn svelte-17wppqz"),W(Te,"active",e[5]===2),t(ce,"class","direction-buttons svelte-17wppqz"),t(H,"class","control-section compact svelte-17wppqz"),t(Se,"class","btn-danger"),t(Pe,"class","actions svelte-17wppqz"),t(d,"class","metrics svelte-17wppqz"),t(l,"class","card svelte-17wppqz")},m(G,de){L(G,l,de),n(l,s),n(s,i),n(s,o),n(s,r),n(l,f),n(l,d),n(d,v),n(v,c),n(c,h),n(c,u),n(c,w),n(w,p),n(w,k),n(v,y),n(v,M),n(M,T),n(M,m),n(M,C),n(C,A),n(v,S),n(v,F),n(F,_),n(F,I),n(F,O),n(O,$),n(d,re),n(d,H),n(H,P),n(H,le),n(H,U),n(U,N),n(N,B),B.checked=e[3],n(N,se),n(N,K),n(U,fe),n(U,Me),n(Me,ee),n(Me,V),n(Me,Z);for(let Y=0;Y<X.length;Y+=1)X[Y]&&X[Y].m(Z,null);It(Z,e[4],!0),n(H,ie),n(H,ce),n(ce,oe),n(ce,ue),n(ce,ne),n(ce,Ae),n(ce,Te),n(d,Ie),x&&x.m(d,null),n(d,Ne),n(d,Pe),n(Pe,Se),te||(ye=[Ce(B,"change",e[21]),Ce(B,"change",e[13]),Ce(Z,"change",e[22]),Ce(Z,"change",e[13]),Ce(oe,"click",e[23]),Ce(ne,"click",e[24]),Ce(Te,"click",e[25]),Ce(Se,"click",e[14])],te=!0)},p(G,de){if(de[0]&512&&W(r,"disconnected",!G[9]),de[0]&2&&g!==(g=(G[1]/1e3).toFixed(3)+"")&&R(p,g),de[0]&128&&R(A,G[7]),de[0]&4&&J!==(J=G[10][G[2]]+"")&&R($,J),de[0]&8&&(B.checked=G[3]),de[0]&2048){Q=ut(G[11]);let Y;for(Y=0;Y<Q.length;Y+=1){const ve=Gl(G,Q,Y);X[Y]?X[Y].p(ve,de):(X[Y]=jl(ve),X[Y].c(),X[Y].m(Z,null))}for(;Y<X.length;Y+=1)X[Y].d(1);X.length=Q.length}de[0]&2064&&It(Z,G[4]),de[0]&32&&W(oe,"active",G[5]===0),de[0]&32&&W(ne,"active",G[5]===1),de[0]&32&&W(Te,"active",G[5]===2),G[8]>0?x?x.p(G,de):(x=ql(G),x.c(),x.m(d,Ne)):x&&(x.d(1),x=null)},i:we,o:we,d(G){G&&E(l),Dt(X,G),x&&x.d(),te=!1,nt(ye)}}}function Xn(e,l,s){let i,o,r,f,d,v,c,h,u,w,g,{status:p}=l,{flexradio:k=null}=l;const y=["6M","10M","12M","15M","17M","20M","30M","40M"];function M(P,le){return le>=0&&le<=7?y[le]:P>=7e3&&P<=7300?"40M":P>=10100&&P<=10150?"30M":P>=14e3&&P<=14350?"20M":P>=18068&&P<=18168?"17M":P>=21e3&&P<=21450?"15M":P>=24890&&P<=24990?"12M":P>=28e3&&P<=29700?"10M":P>=5e4&&P<=54e3?"6M":"Unknown"}const T=["Normal","180°","Bi-Dir"],m=[{value:25,label:"25 kHz"},{value:50,label:"50 kHz"},{value:100,label:"100 kHz"}];let C=!0,A=25,S=0;async function F(){if(o!==0)try{await Oe.ultrabeam.setFrequency(o,S),await Oe.ultrabeam.setDirection(S)}catch(P){console.log("Direction change sent (may show code 30 if busy):",P)}}async function _(){try{await Oe.ultrabeam.setAutoTrack(C,A)}catch(P){console.error("Failed to update auto-track:",P)}}async function I(){if(confirm("Retract all antenna elements?"))try{await Oe.ultrabeam.retract()}catch(P){console.error("Failed to retract:",P)}}function O(){C=this.checked,s(3,C)}function J(){A=tn(this),s(4,A),s(11,m)}const $=()=>{s(5,S=0),F()},re=()=>{s(5,S=1),F()},H=()=>{s(5,S=2),F()};return e.$$set=P=>{"status"in P&&s(15,p=P.status),"flexradio"in P&&s(16,k=P.flexradio)},e.$$.update=()=>{e.$$.dirty[0]&32768&&s(9,i=(p==null?void 0:p.connected)||!1),e.$$.dirty[0]&32768&&s(1,o=(p==null?void 0:p.frequency)||0),e.$$.dirty[0]&32768&&s(18,r=(p==null?void 0:p.band)||0),e.$$.dirty[0]&32768&&s(2,f=(p==null?void 0:p.direction)||0),e.$$.dirty[0]&32768&&s(8,d=(p==null?void 0:p.motors_moving)||0),e.$$.dirty[0]&32768&&s(17,v=(p==null?void 0:p.progress_total)||0),e.$$.dirty[0]&32768&&s(0,c=(p==null?void 0:p.progress_current)||0),e.$$.dirty[0]&32768&&p!=null&&p.element_lengths,e.$$.dirty[0]&32768&&p&&`${p.firmware_major}${p.firmware_minor}`,e.$$.dirty[0]&65536&&s(20,h=(k==null?void 0:k.connected)||!1),e.$$.dirty[0]&65536&&s(19,u=(k==null?void 0:k.interlock_state)||null),e.$$.dirty[0]&524288,e.$$.dirty[0]&1638400&&k&&console.log("FlexRadio data:",{connected:k.connected,interlock_state:k.interlock_state,interlockConnected:h,interlockState:u}),e.$$.dirty[0]&262146&&s(7,w=M(o,r)),e.$$.dirty[0]&4&&s(5,S=f),e.$$.dirty[0]&262144,e.$$.dirty[0]&131073&&s(6,g=v>0?c/60*100:0)},[c,o,f,C,A,S,g,w,d,i,T,m,F,_,I,p,k,v,r,u,h,O,J,$,re,H]}class Yn extends pt{constructor(l){super(),vt(this,l,Xn,Jn,ot,{status:15,flexradio:16},null,[-1,-1])}}function Vn(e){var zt,ge,_e,Ut,Jt,Xt,Yt,Vt,Zt,Kt,Ht;let l,s,i,o,r,f,d,v,c,h,u=e[1]?"Connected":"Disconnected",w,g,p,k,y,M,T,m=e[7].sfi+"",C,A,S,F,_,I=e[7].sunspots+"",O,J,$,re,H,P=e[7].a_index+"",le,U,N,B,se,K=e[7].k_index+"",fe,Me,ee,V,Z,ie=e[7].geomag+"",ce,oe,ue,ne,Ae,Te,Ie=e[6].wind_speed.toFixed(1)+"",Ne,Pe,Se,te,ye,Q=e[6].wind_gust.toFixed(1)+"",X,x,G,de,Y,ve=e[6].temp.toFixed(1)+"",j,be,pe,Ee,Ye,Ve=e[6].feels_like.toFixed(1)+"",We,Je,Be,Le,$e,De=Ul(e[2])+"",Qe,Ze,xe,Ge=e[2].toLocaleDateString()+"",he,ze,et,ht,rt,st,Re,Ke,Mt,He,gt,tt,it,je,lt,Xe,qe,at,Ue,Fe;return et=new Fn({props:{flexradio:(zt=e[0])==null?void 0:zt.flexradio,weather:(ge=e[0])==null?void 0:ge.weather,latitude:e[4],longitude:e[5],windWarningThreshold:30,gustWarningThreshold:50}}),Ke=new An({props:{status:(_e=e[0])==null?void 0:_e.webswitch}}),He=new Dn({props:{status:(Ut=e[0])==null?void 0:Ut.power_genius}}),tt=new Rn({props:{status:(Jt=e[0])==null?void 0:Jt.tuner_genius,flexradio:(Xt=e[0])==null?void 0:Xt.flexradio}}),lt=new Gn({props:{status:(Yt=e[0])==null?void 0:Yt.antenna_genius}}),qe=new Yn({props:{status:(Vt=e[0])==null?void 0:Vt.ultrabeam,flexradio:(Zt=e[0])==null?void 0:Zt.flexradio}}),Ue=new Un({props:{status:(Kt=e[0])==null?void 0:Kt.rotator_genius,ultrabeam:(Ht=e[0])==null?void 0:Ht.ultrabeam}}),{c(){l=a("div"),s=a("header"),i=a("div"),o=a("h1"),r=z(e[3]),f=z(" Shack"),d=b(),v=a("div"),c=a("span"),h=b(),w=z(u),g=b(),p=a("div"),k=a("div"),y=a("span"),M=z("SFI "),T=a("span"),C=z(m),A=b(),S=a("span"),F=z("Spots "),_=a("span"),O=z(I),J=b(),$=a("span"),re=z("A "),H=a("span"),le=z(P),U=b(),N=a("span"),B=z("K "),se=a("span"),fe=z(K),Me=b(),ee=a("span"),V=z("G "),Z=a("span"),ce=z(ie),oe=b(),ue=a("div"),ne=a("div"),Ae=a("span"),Te=z("🌬️ "),Ne=z(Ie),Pe=z(" km/h"),Se=b(),te=a("span"),ye=z("💨 "),X=z(Q),x=z(" km/h"),G=b(),de=a("span"),Y=z("🌡️ "),j=z(ve),be=z(" °C"),pe=b(),Ee=a("span"),Ye=z("→ "),We=z(Ve),Je=z(" °C"),Be=b(),Le=a("div"),$e=a("span"),Qe=z(De),Ze=b(),xe=a("span"),he=z(Ge),ze=b(),bt(et.$$.fragment),ht=b(),rt=a("main"),st=a("div"),Re=a("div"),bt(Ke.$$.fragment),Mt=b(),bt(He.$$.fragment),gt=b(),bt(tt.$$.fragment),it=b(),je=a("div"),bt(lt.$$.fragment),Xe=b(),bt(qe.$$.fragment),at=b(),bt(Ue.$$.fragment),t(o,"class","svelte-a5dfm6"),t(c,"class","status-indicator"),W(c,"status-online",e[1]),W(c,"status-offline",!e[1]),t(v,"class","connection-status svelte-a5dfm6"),t(i,"class","header-left svelte-a5dfm6"),t(T,"class","value svelte-a5dfm6"),t(y,"class","solar-item svelte-a5dfm6"),t(_,"class","value svelte-a5dfm6"),t(S,"class","solar-item svelte-a5dfm6"),t(H,"class","value svelte-a5dfm6"),t($,"class","solar-item svelte-a5dfm6"),t(se,"class","value svelte-a5dfm6"),t(N,"class","solar-item svelte-a5dfm6"),t(Z,"class","value svelte-a5dfm6"),t(ee,"class","solar-item svelte-a5dfm6"),t(k,"class","solar-info svelte-a5dfm6"),t(p,"class","header-center svelte-a5dfm6"),t(Ae,"title","Wind"),t(te,"title","Gust"),t(de,"title","Temperature"),t(Ee,"title","Feels like"),t(ne,"class","weather-info svelte-a5dfm6"),t($e,"class","time svelte-a5dfm6"),t(xe,"class","date svelte-a5dfm6"),t(Le,"class","clock svelte-a5dfm6"),t(ue,"class","header-right svelte-a5dfm6"),t(s,"class","svelte-a5dfm6"),t(Re,"class","row svelte-a5dfm6"),t(je,"class","row svelte-a5dfm6"),t(st,"class","dashboard-grid svelte-a5dfm6"),t(rt,"class","svelte-a5dfm6"),t(l,"class","app svelte-a5dfm6")},m(q,me){L(q,l,me),n(l,s),n(s,i),n(i,o),n(o,r),n(o,f),n(i,d),n(i,v),n(v,c),n(v,h),n(v,w),n(s,g),n(s,p),n(p,k),n(k,y),n(y,M),n(y,T),n(T,C),n(k,A),n(k,S),n(S,F),n(S,_),n(_,O),n(k,J),n(k,$),n($,re),n($,H),n(H,le),n(k,U),n(k,N),n(N,B),n(N,se),n(se,fe),n(k,Me),n(k,ee),n(ee,V),n(ee,Z),n(Z,ce),n(s,oe),n(s,ue),n(ue,ne),n(ne,Ae),n(Ae,Te),n(Ae,Ne),n(Ae,Pe),n(ne,Se),n(ne,te),n(te,ye),n(te,X),n(te,x),n(ne,G),n(ne,de),n(de,Y),n(de,j),n(de,be),n(ne,pe),n(ne,Ee),n(Ee,Ye),n(Ee,We),n(Ee,Je),n(ue,Be),n(ue,Le),n(Le,$e),n($e,Qe),n(Le,Ze),n(Le,xe),n(xe,he),n(l,ze),dt(et,l,null),n(l,ht),n(l,rt),n(rt,st),n(st,Re),dt(Ke,Re,null),n(Re,Mt),dt(He,Re,null),n(Re,gt),dt(tt,Re,null),n(st,it),n(st,je),dt(lt,je,null),n(je,Xe),dt(qe,je,null),n(je,at),dt(Ue,je,null),Fe=!0},p(q,[me]){var el,tl,ll,nl,sl,il,al,ol,rl,cl,dl;(!Fe||me&8)&&R(r,q[3]),(!Fe||me&2)&&W(c,"status-online",q[1]),(!Fe||me&2)&&W(c,"status-offline",!q[1]),(!Fe||me&2)&&u!==(u=q[1]?"Connected":"Disconnected")&&R(w,u),(!Fe||me&128)&&m!==(m=q[7].sfi+"")&&R(C,m),(!Fe||me&128)&&I!==(I=q[7].sunspots+"")&&R(O,I),(!Fe||me&128)&&P!==(P=q[7].a_index+"")&&R(le,P),(!Fe||me&128)&&K!==(K=q[7].k_index+"")&&R(fe,K),(!Fe||me&128)&&ie!==(ie=q[7].geomag+"")&&R(ce,ie),(!Fe||me&64)&&Ie!==(Ie=q[6].wind_speed.toFixed(1)+"")&&R(Ne,Ie),(!Fe||me&64)&&Q!==(Q=q[6].wind_gust.toFixed(1)+"")&&R(X,Q),(!Fe||me&64)&&ve!==(ve=q[6].temp.toFixed(1)+"")&&R(j,ve),(!Fe||me&64)&&Ve!==(Ve=q[6].feels_like.toFixed(1)+"")&&R(We,Ve),(!Fe||me&4)&&De!==(De=Ul(q[2])+"")&&R(Qe,De),(!Fe||me&4)&&Ge!==(Ge=q[2].toLocaleDateString()+"")&&R(he,Ge);const Tt={};me&1&&(Tt.flexradio=(el=q[0])==null?void 0:el.flexradio),me&1&&(Tt.weather=(tl=q[0])==null?void 0:tl.weather),me&16&&(Tt.latitude=q[4]),me&32&&(Tt.longitude=q[5]),et.$set(Tt);const Qt={};me&1&&(Qt.status=(ll=q[0])==null?void 0:ll.webswitch),Ke.$set(Qt);const xt={};me&1&&(xt.status=(nl=q[0])==null?void 0:nl.power_genius),He.$set(xt);const Et={};me&1&&(Et.status=(sl=q[0])==null?void 0:sl.tuner_genius),me&1&&(Et.flexradio=(il=q[0])==null?void 0:il.flexradio),tt.$set(Et);const $t={};me&1&&($t.status=(al=q[0])==null?void 0:al.antenna_genius),lt.$set($t);const Lt={};me&1&&(Lt.status=(ol=q[0])==null?void 0:ol.ultrabeam),me&1&&(Lt.flexradio=(rl=q[0])==null?void 0:rl.flexradio),qe.$set(Lt);const Rt={};me&1&&(Rt.status=(cl=q[0])==null?void 0:cl.rotator_genius),me&1&&(Rt.ultrabeam=(dl=q[0])==null?void 0:dl.ultrabeam),Ue.$set(Rt)},i(q){Fe||(ct(et.$$.fragment,q),ct(Ke.$$.fragment,q),ct(He.$$.fragment,q),ct(tt.$$.fragment,q),ct(lt.$$.fragment,q),ct(qe.$$.fragment,q),ct(Ue.$$.fragment,q),Fe=!0)},o(q){mt(et.$$.fragment,q),mt(Ke.$$.fragment,q),mt(He.$$.fragment,q),mt(tt.$$.fragment,q),mt(lt.$$.fragment,q),mt(qe.$$.fragment,q),mt(Ue.$$.fragment,q),Fe=!1},d(q){q&&E(l),ft(et),ft(Ke),ft(He),ft(tt),ft(lt),ft(qe),ft(Ue)}}}function Ul(e){return e.toTimeString().slice(0,8)}function Zn(e,l,s){let i,o,r=null,f=!1,d=new Date,v="F4BPO",c=null,h=null;const u=Hl.subscribe(g=>{s(0,r=g)}),w=jt.subscribe(g=>{s(1,f=g)});return Vl(async()=>{pl.connect();try{const p=await Oe.getConfig();p.callsign&&s(3,v=p.callsign),p.location&&(s(4,c=p.location.latitude),s(5,h=p.location.longitude))}catch(p){console.error("Failed to fetch config:",p)}const g=setInterval(()=>{s(2,d=new Date)},1e3);return()=>{clearInterval(g)}}),Zl(()=>{pl.disconnect(),u(),w()}),e.$$.update=()=>{e.$$.dirty&1&&s(7,i=(r==null?void 0:r.solar)||{sfi:0,sunspots:0,a_index:0,k_index:0,geomag:"Unknown"}),e.$$.dirty&1&&s(6,o=(r==null?void 0:r.weather)||{wind_speed:0,wind_gust:0,temp:0,feels_like:0})},[r,f,d,v,c,h,o,i]}class Kn extends pt{constructor(l){super(),vt(this,l,Zn,Vn,ot,{})}}new Kn({target:document.getElementById("app")});