Files
ShackMaster/cmd/server/web/dist/assets/index-iLwnoiIw.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 Xl(e){return e()}function fl(){return Object.create(null)}function nt(e){e.forEach(Xl)}function Yl(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 Vl(){if(!St)throw new Error("Function called outside component initialization");return St}function Zl(e){Vl().$$.on_mount.push(e)}function Kl(e){Vl().$$.on_destroy.push(e)}const yt=[],ul=[];let kt=[];const vl=[],ln=Promise.resolve();let Gt=!1;function nn(){Gt||(Gt=!0,ln.then(Hl))}function Nt(e){kt.push(e)}const Bt=new Set;let wt=0;function Hl(){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 pt(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(Xl).filter(Yl);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 m=!1;if(c.ctx=s?s(e,l.props||{},(u,w,...g)=>{const h=g.length?g[0]:w;return c.ctx&&o(c.ctx[u],c.ctx[u]=h)&&(!c.skip_bound&&c.bound[u]&&c.bound[u](h),m&&rn(e,u)),w}):[],c.update(),m=!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),Hl()}Ct(v)}class ht{constructor(){Wt(this,"$$");Wt(this,"$$set")}$destroy(){ft(this,1),this.$destroy=we}$on(l,s){if(!Yl(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 Ut(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=Ut(!1),Ql=Ut(null),dn=Ut(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),Ql.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 hl=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 hn(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 mn(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 pn(e){let l,s,i,o,r=(e[11]||"Radio is on")+"",f,d,v,c=e[9]&&ml(e),m=e[10]&&pl(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(),m&&m.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),m&&m.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=ml(u),c.c(),c.m(l,v)):c&&(c.d(1),c=null),u[10]?m?m.p(u,w):(m=pl(u),m.c(),m.m(l,null)):m&&(m.d(1),m=null)},d(u){u&&E(l),c&&c.d(),m&&m.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,m){L(c,l,m),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,m){c[9]?d?d.p(c,m):(d=bl(c),d.c(),d.m(l,f)):d&&(d.d(1),d=null),c[10]?v?v.p(c,m):(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,m,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(),m=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(h,k){L(h,l,k),n(l,s),n(s,o),n(l,r),n(l,f),L(h,d,k),u&&u.m(h,k),L(h,v,k),w&&w.m(h,k),L(h,c,k),g&&g.m(h,k),L(h,m,k)},p(h,k){k[0]&8&&i!==(i=Cl(h[3])+"")&&R(o,i),k[0]&4194304&&ae(s,"--band-color",h[22]),h[4]?u?u.p(h,k):(u=wl(h),u.c(),u.m(v.parentNode,v)):u&&(u.d(1),u=null),h[25]?w?w.p(h,k):(w=_l(h),w.c(),w.m(c.parentNode,c)):w&&(w.d(1),w=null),h[24]?g||(g=yl(),g.c(),g.m(m.parentNode,m)):g&&(g.d(1),g=null)},d(h){h&&(E(l),E(d),E(v),E(c),E(m)),u&&u.d(h),w&&w.d(h),g&&g.d(h)}}}function ml(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 pl(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])+"",m,u,w,g,h,k,y,M,T,p=Ft(e[13])+"",C,A,S;function F(O,X){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(),m=z(c),u=b(),w=a("span"),g=D("svg"),h=D("line"),k=D("path"),y=D("path"),M=D("path"),T=b(),C=z(p),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(h,"x1","2"),t(h,"y1","18"),t(h,"x2","22"),t(h,"y2","18"),t(h,"stroke","currentColor"),t(h,"stroke-width","1.5"),t(h,"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,X){L(O,l,X),n(l,s),n(s,i),n(i,o),n(i,r),n(i,f),n(i,d),n(s,v),n(s,m),n(l,u),n(l,w),n(w,g),n(g,h),n(g,k),n(g,y),n(g,M),n(w,T),n(w,C),L(O,A,X),I&&I.m(O,X),L(O,S,X)},p(O,X){X[0]&4096&&c!==(c=Ft(O[12])+"")&&R(m,c),X[0]&8192&&p!==(p=Ft(O[13])+"")&&R(C,p),_===(_=F(O))&&I?I.p(O,X):(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(m,u){L(m,l,u),n(l,s),n(l,i),n(l,o),n(o,r),n(o,f),n(f,v),n(f,c)},p(m,u){u[0]&256&&d!==(d=m[8].toFixed(0)+"")&&R(v,d)},d(m){m&&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(m,u){L(m,l,u),n(l,s),n(l,i),n(l,o),n(o,r),n(o,f),n(f,v),n(f,c)},p(m,u){u[0]&128&&d!==(d=m[7].toFixed(0)+"")&&R(v,d)},d(m){m&&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,m,u,w,g,h;function k(_,I){return _[21]?gn:_[19]?bn:_[20]?pn:_[17]?mn:_[18]?hn:vn}let y=k(e),M=y(e);function T(_,I){return _[0]&&_[1]?_n:wn}let p=T(e),C=p(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(),m=a("div"),u=b(),w=a("div"),A&&A.c(),g=b(),S&&S.c(),h=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(m,"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,m),n(l,u),n(l,w),A&&A.m(w,null),n(w,g),S&&S.m(w,null),n(w,h),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))),p===(p=T(_))&&C?C.p(_,I):(C.d(1),C=p(_),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,h)):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,m=Math.cos(c)/(Math.cos(v)*Math.cos(d))-Math.tan(v)*Math.tan(d);if(m>1||m<-1)return{sunrise:null,sunset:null};const u=Math.acos(m)/i,w=720-4*(s+u)-f,g=720-4*(s-u)-f,h=new Date(e);h.setUTCHours(0,0,0,0),h.setUTCMinutes(w);const k=new Date(e);return k.setUTCHours(0,0,0,0),k.setUTCMinutes(g),{sunrise:h,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,m,u,w,g,h,k,y,M,T,p,C,A,S,F,{flexradio:_=null}=l,{weather:I=null}=l,{latitude:O=null}=l,{longitude:X=null}=l,{windWarningThreshold:$=30}=l,{gustWarningThreshold:re=50}=l,{graylineWindow:Q=30}=l,P=null,le=null,J=!1,N="",B="",se=new Date,H;Zl(()=>{fe(),H=setInterval(()=>{se=new Date,Me(),ee()},1e4)}),Kl(()=>{H&&clearInterval(H)});function fe(){if(!O||!X)return;const K=Tl(new Date,O,X);s(12,P=K.sunrise),s(13,le=K.sunset),Me(),ee()}function Me(){if(!P||!le){s(14,J=!1);return}const Z=se.getTime(),K=Q*60*1e3,ie=Math.abs(Z-P.getTime())<=K,ce=Math.abs(Z-le.getTime())<=K;s(14,J=ie||ce),s(15,N=ie?"sunrise":ce?"sunset":"")}function ee(){if(!P||!le){s(16,B="");return}const Z=se.getTime();let K=null,ie="";if(Z<P.getTime())K=P,ie="Sunrise";else if(Z<le.getTime())K=le,ie="Sunset";else{const ce=new Date(se);ce.setDate(ce.getDate()+1),K=Tl(ce,O,X).sunrise,ie="Sunrise"}if(K){const ce=K.getTime()-Z,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=Z=>{"flexradio"in Z&&s(26,_=Z.flexradio),"weather"in Z&&s(27,I=Z.weather),"latitude"in Z&&s(0,O=Z.latitude),"longitude"in Z&&s(1,X=Z.longitude),"windWarningThreshold"in Z&&s(28,$=Z.windWarningThreshold),"gustWarningThreshold"in Z&&s(29,re=Z.gustWarningThreshold),"graylineWindow"in Z&&s(30,Q=Z.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,m=(_==null?void 0:_.model)||""),e.$$.dirty[0]&67108864&&s(32,u=(_==null?void 0:_.active_slices)||0),e.$$.dirty[0]&3&&O&&X&&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:m}),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,h=w>=$),e.$$.dirty[0]&536871040&&s(5,k=g>=re),e.$$.dirty[0]&96&&s(23,y=h||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,p=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,X,f,i,M,k,h,g,w,m,c,v,P,le,J,N,B,F,S,A,C,p,T,y,r,o,_,I,$,re,Q,d,u]}class Fn extends ht{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,m,u,w,g,h,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(),m=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(m,"class","relay-toggle svelte-z2csmj"),m.disabled=w=e[0][e[10]],W(m,"active",e[12]),W(m,"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,m),n(m,u),n(l,g),h||(k=Ce(m,"click",y),h=!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]])&&(m.disabled=w),T&2&&W(m,"active",e[12]),T&1&&W(m,"loading",e[0][e[10]]),T&2&&W(l,"relay-on",e[12])},d(M){M&&E(l),h=!1,k()}}}function Pn(e){let l,s,i,o,r,f,d,v,c,m,u,w,g,h,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(),m=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(m,"class","controls svelte-z2csmj"),t(d,"class","metrics svelte-z2csmj"),t(l,"class","card svelte-z2csmj")},m(T,p){L(T,l,p),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,m),n(m,u),n(m,w),n(m,g),h||(k=[Ce(u,"click",e[5]),Ce(g,"click",e[6])],h=!0)},p(T,[p]){if(p&4&&W(r,"disconnected",!T[2]),p&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,p):(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),h=!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 h=i.find(y=>y.number===g),k=(h==null?void 0:h.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 m(){try{await Oe.webswitch.allOff()}catch(g){console.error("Failed to turn all off:",g)}}const u=g=>v(g),w=(g,h)=>h.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,m,r,u,w]}class An extends ht{constructor(l){super(),vt(this,l,On,Pn,ot,{status:7})}}function In(e){let l,s,i,o,r,f,d,v,c,m,u,w,g,h,k,y,M,T=e[1].toFixed(0)+"",p,C,A,S,F,_,I,O,X,$=e[2].toFixed(2)+"",re,Q,P,le,J,N,B,se=e[3].toFixed(1)+"",H,fe,Me,ee,Z,K,ie,ce,oe,ue,ne=e[12].toFixed(1)+"",Ae,Te,Ie,Ne,Pe,Se,te,ye,q,Y,x,G,de,V=e[15].toFixed(0)+"",ve,j,be,he,Ee,Ve,Ze=e[14].toFixed(1)+"",We,Xe,Be,Le,$e,De,qe=e[13].toFixed(1)+"",Ke,xe,Ge,me,ze,et,mt,rt,st,Re,He,Mt,Qe,gt,tt,it,je,lt,Ye,Ue,at,Je,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"),m=b(),u=a("div"),w=a("div"),g=a("div"),h=a("div"),k=a("span"),k.textContent="Power",y=b(),M=a("span"),p=z(T),C=z(" W"),A=b(),S=a("div"),F=a("div"),_=a("div"),I=b(),O=a("div"),X=a("div"),re=z($),Q=b(),P=a("div"),P.textContent="SWR",le=b(),J=a("div"),N=a("div"),B=a("div"),H=z(se),fe=z("°"),Me=b(),ee=a("div"),ee.textContent="PA Temp",Z=b(),K=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"),Y=a("div"),x=a("div"),x.textContent="VAC",G=b(),de=a("div"),ve=z(V),j=b(),be=a("div"),he=a("div"),he.textContent="VDD",Ee=b(),Ve=a("div"),We=z(Ze),Xe=b(),Be=a("div"),Le=a("div"),Le.textContent="ID Peak",$e=b(),De=a("div"),Ke=z(qe),xe=b(),Ge=a("div"),me=a("div"),ze=a("span"),ze.textContent="Band A",et=b(),mt=a("span"),rt=z(e[10]),st=b(),Re=a("div"),He=a("span"),He.textContent="Band B",Mt=b(),Qe=a("span"),gt=z(e[9]),tt=b(),it=a("div"),je=a("label"),je.textContent="Fan Mode",lt=b(),Ye=a("select"),Ue=a("option"),Ue.textContent="Standard",at=a("option"),at.textContent="Contest",Je=a("option"),Je.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(h,"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(X,"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(K,"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(J,"class","temp-group svelte-vwcbgz"),t(x,"class","param-label svelte-vwcbgz"),t(de,"class","param-value svelte-vwcbgz"),t(Y,"class","param-box svelte-vwcbgz"),t(he,"class","param-label svelte-vwcbgz"),t(Ve,"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(mt,"class","band-value svelte-vwcbgz"),t(me,"class","band-item svelte-vwcbgz"),t(He,"class","band-label svelte-vwcbgz"),t(Qe,"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"),Ue.__value="STANDARD",Pt(Ue,Ue.__value),at.__value="CONTEST",Pt(at,at.__value),Je.__value="BROADCAST",Pt(Je,Je.__value),t(Ye,"id","fan-mode-select"),t(Ye,"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,m),n(l,u),n(u,w),n(w,g),n(g,h),n(h,k),n(h,y),n(h,M),n(M,p),n(M,C),n(g,A),n(g,S),n(S,F),n(F,_),n(w,I),n(w,O),n(O,X),n(X,re),n(O,Q),n(O,P),n(u,le),n(u,J),n(J,N),n(N,B),n(B,H),n(B,fe),n(N,Me),n(N,ee),n(N,Z),n(N,K),n(K,ie),n(J,ce),n(J,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,Y),n(Y,x),n(Y,G),n(Y,de),n(de,ve),n(q,j),n(q,be),n(be,he),n(be,Ee),n(be,Ve),n(Ve,We),n(q,Xe),n(q,Be),n(Be,Le),n(Be,$e),n(Be,De),n(De,Ke),n(u,xe),n(u,Ge),n(Ge,me),n(me,ze),n(me,et),n(me,mt),n(mt,rt),n(Ge,st),n(Ge,Re),n(Re,He),n(Re,Mt),n(Re,Qe),n(Qe,gt),n(u,tt),n(u,it),n(it,je),n(it,lt),n(it,Ye),n(Ye,Ue),n(Ye,at),n(Ye,Je),It(Ye,e[11]),Fe||(zt=[Ce(f,"click",e[17]),Ce(Ye,"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(p,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(H,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&&V!==(V=ge[15].toFixed(0)+"")&&R(ve,V),_e&16384&&Ze!==(Ze=ge[14].toFixed(1)+"")&&R(We,Ze),_e&8192&&qe!==(qe=ge[13].toFixed(1)+"")&&R(Ke,qe),_e&1024&&R(rt,ge[10]),_e&512&&R(gt,ge[9]),_e&2048&&It(Ye,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,m,u,w,g,h,k,y,M,T,{status:p}=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,p=F.status)},e.$$.update=()=>{e.$$.dirty&262144&&s(1,i=(p==null?void 0:p.power_forward)||0),e.$$.dirty&262144&&p!=null&&p.power_reflected,e.$$.dirty&262144&&s(2,o=(p==null?void 0:p.swr)||1),e.$$.dirty&262144&&s(15,r=(p==null?void 0:p.voltage)||0),e.$$.dirty&262144&&s(14,f=(p==null?void 0:p.vdd)||0),e.$$.dirty&262144&&p!=null&&p.current,e.$$.dirty&262144&&s(13,d=(p==null?void 0:p.peak_current)||0),e.$$.dirty&262144&&s(3,v=(p==null?void 0:p.temperature)||0),e.$$.dirty&262144&&s(12,c=(p==null?void 0:p.harmonic_load_temp)||0),e.$$.dirty&262144&&s(11,m=(p==null?void 0:p.fan_mode)||"CONTEST"),e.$$.dirty&262144&&s(0,u=(p==null?void 0:p.state)||"IDLE"),e.$$.dirty&262144&&s(10,w=(p==null?void 0:p.band_a)||"0"),e.$$.dirty&262144&&s(9,g=(p==null?void 0:p.band_b)||"0"),e.$$.dirty&262144&&s(8,h=(p==null?void 0:p.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,h,g,w,m,c,d,f,r,C,A,p,S]}class Dn extends ht{constructor(l){super(),vt(this,l,Nn,In,ot,{status:18})}}function En(e){let l,s,i,o,r,f,d,v,c,m,u,w,g,h,k,y,M,T=e[0].toFixed(0)+"",p,C,A,S,F,_,I,O,X,$=e[1].toFixed(2)+"",re,Q,P,le,J,N,B,se,H,fe,Me,ee,Z,K,ie,ce,oe,ue,ne,Ae,Te,Ie,Ne,Pe,Se,te,ye,q,Y=(e[11]/1e3).toFixed(3)+"",x,G,de,V,ve,j,be,he=(e[10]/1e3).toFixed(3)+"",Ee,Ve,Ze,We,Xe,Be=e[8]===1?"OPERATE":"STANDBY",Le,$e,De,qe,Ke,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"),m=b(),u=a("div"),w=a("div"),g=a("div"),h=a("div"),k=a("span"),k.textContent="Power",y=b(),M=a("span"),p=z(T),C=z(" W"),A=b(),S=a("div"),F=a("div"),_=a("div"),I=b(),O=a("div"),X=a("div"),re=z($),Q=b(),P=a("div"),P.textContent="SWR",le=b(),J=a("div"),N=a("div"),B=a("div"),se=z(e[7]),H=b(),fe=a("div"),fe.textContent="C1",Me=b(),ee=a("div"),Z=a("div"),K=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(Y),G=a("span"),G.textContent="MHz",de=b(),V=a("div"),ve=a("div"),ve.textContent="Freq B",j=b(),be=a("div"),Ee=z(he),Ve=a("span"),Ve.textContent="MHz",Ze=b(),We=a("div"),Xe=a("button"),Le=z(Be),$e=b(),De=a("button"),De.textContent="BYPASS",qe=b(),Ke=a("button"),Ke.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(h,"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(X,"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(Z,"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(J,"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(Ve,"class","freq-unit svelte-zuda7"),t(be,"class","freq-value svelte-zuda7"),t(V,"class","freq-item svelte-zuda7"),t(Pe,"class","freq-display svelte-zuda7"),t(Xe,"class","control-btn operate svelte-zuda7"),W(Xe,"active",e[8]===1),t(De,"class","control-btn bypass svelte-zuda7"),W(De,"active",e[9]),t(We,"class","controls svelte-zuda7"),t(Ke,"class","tune-btn svelte-zuda7"),t(u,"class","metrics svelte-zuda7"),t(l,"class","card svelte-zuda7")},m(me,ze){L(me,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,m),n(l,u),n(u,w),n(w,g),n(g,h),n(h,k),n(h,y),n(h,M),n(M,p),n(M,C),n(g,A),n(g,S),n(S,F),n(F,_),n(w,I),n(w,O),n(O,X),n(X,re),n(O,Q),n(O,P),n(u,le),n(u,J),n(J,N),n(N,B),n(B,se),n(N,H),n(N,fe),n(J,Me),n(J,ee),n(ee,Z),n(Z,K),n(ee,ie),n(ee,ce),n(J,oe),n(J,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,V),n(V,ve),n(V,j),n(V,be),n(be,Ee),n(be,Ve),n(u,Ze),n(u,We),n(We,Xe),n(Xe,Le),n(We,$e),n(We,De),n(u,qe),n(u,Ke),xe||(Ge=[Ce(Xe,"click",e[17]),Ce(De,"click",e[18]),Ce(Ke,"click",e[13])],xe=!0)},p(me,[ze]){ze&4096&&R(d,me[12]),ze&4096&&W(f,"tuning",me[12]==="TUNING"),ze&16&&W(c,"disconnected",!me[4]),ze&1&&T!==(T=me[0].toFixed(0)+"")&&R(p,T),ze&4&&ae(_,"width",me[2]+"%"),ze&2&&$!==($=me[1].toFixed(2)+"")&&R(re,$),ze&8&&ae(O,"--swr-color",me[3]),ze&128&&R(se,me[7]),ze&64&&R(K,me[6]),ze&32&&R(Ae,me[5]),ze&2048&&Y!==(Y=(me[11]/1e3).toFixed(3)+"")&&R(x,Y),ze&1024&&he!==(he=(me[10]/1e3).toFixed(3)+"")&&R(Ee,he),ze&256&&Be!==(Be=me[8]===1?"OPERATE":"STANDBY")&&R(Le,Be),ze&256&&W(Xe,"active",me[8]===1),ze&512&&W(De,"active",me[9])},i:we,o:we,d(me){me&&E(l),xe=!1,nt(Ge)}}}function Ln(e,l,s){let i,o,r,f,d,v,c,m,u,w,g,h,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 p(S){try{await Oe.tuner.setOperate(S)}catch(F){console.error("Failed to set operate:",F)}}const C=()=>p(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,m=(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,h=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,h,g,w,u,m,c,v,d,f,r,M,T,p,y,C,A]}class Rn extends ht{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 m=i[18]||i[16];return i[21]=m,i}function Ol(e){let l,s,i=e[14].name+"",o,r,f,d,v,c,m,u,w;function g(){return e[11](e[14])}function h(){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",m=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,m),u||(w=[Ce(d,"click",g),Ce(c,"click",h)],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,m,u=(e[1].source||"FLEX")+"",w,g,h,k,y=(e[0].source||"FLEX")+"",M,T,p,C,A,S,F,_,I,O,X,$,re,Q,P,le,J=ut(e[4]),N=[];for(let B=0;B<J.length;B+=1)N[B]=Ol(Pl(e,J,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"),m=a("div"),w=z(u),g=b(),h=a("div"),k=a("div"),M=z(y),T=b(),p=a("div"),C=a("div"),A=a("div"),S=z(e[3]),F=b(),_=a("div"),I=a("div"),O=z(e[2]),X=b(),$=a("div");for(let B=0;B<N.length;B+=1)N[B].c();re=b(),Q=a("button"),Q.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(m,"class","source-label svelte-vlabwb"),t(c,"class","source-item svelte-vlabwb"),t(k,"class","source-label svelte-vlabwb"),t(h,"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(p,"class","bands svelte-vlabwb"),t($,"class","antennas svelte-vlabwb"),t(Q,"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,m),n(m,w),n(v,g),n(v,h),n(h,k),n(k,M),n(d,T),n(d,p),n(p,C),n(C,A),n(A,S),n(p,F),n(p,_),n(_,I),n(I,O),n(d,X),n(d,$);for(let H=0;H<N.length;H+=1)N[H]&&N[H].m($,null);n(d,re),n(d,Q),P||(le=Ce(Q,"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){J=ut(B[4]);let H;for(H=0;H<J.length;H+=1){const fe=Pl(B,J,H);N[H]?N[H].p(fe,se):(N[H]=Ol(fe),N[H].c(),N[H].m($,null))}for(;H<N.length;H+=1)N[H].d(1);N.length=J.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 m={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(p){console.error("Failed to select/deselect antenna:",p)}}let w=!1,g=!1;async function h(){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=m[o.band]||"None"),e.$$.dirty&1&&s(2,v=m[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,h,c,w,g,k,y]}class Gn extends ht{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,m;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"),m=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(m,"points","0,20 -8,-5 0,0 8,-5"),t(m,"fill","#4fc3f7"),t(m,"stroke","#0288d1"),t(m,"stroke-width","2"),ae(m,"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,m)},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,m,u,w,g,h,k,y,M,T,p,C,A,S,F,_,I,O,X,$,re,Q,P,le,J,N,B,se,H,fe,Me,ee,Z,K,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(),Y=e[4]===1&&El(),x=e[4]===2&&Ll(),G=e[2]&&e[0]!==null&&Rl(e),de=ut([45,135,225,315]),V=[];for(let j=0;j<4;j+=1)V[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"),m=a("div"),m.textContent="CURRENT HEADING",u=b(),w=a("div"),g=z(e[3]),h=z(`°\r
`),te&&te.c(),k=b(),y=a("div"),M=a("button"),M.textContent="↺",T=b(),p=a("button"),p.textContent="■",C=b(),A=a("button"),A.textContent="↻",S=b(),F=a("div"),_=D("svg"),I=D("defs"),O=D("radialGradient"),X=D("stop"),$=D("stop"),re=D("circle"),Q=D("circle"),P=D("circle"),le=D("circle"),J=D("g"),ye&&ye.c(),N=D("g"),q&&q.c(),B=At(),Y&&Y.c(),se=At(),x&&x.c(),G&&G.c(),fe=D("circle"),Me=D("animate"),ee=D("circle"),Z=D("animate"),K=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)V[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(m,"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(p,"class","btn-mini stop svelte-3omzwr"),t(p,"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(X,"offset","0%"),ae(X,"stop-color","rgba(79, 195, 247, 0.7)"),ae(X,"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(Q,"cx","150"),t(Q,"cy","150"),t(Q,"r","105"),t(Q,"fill","none"),t(Q,"stroke","rgba(79,195,247,0.2)"),t(Q,"stroke-width","1"),t(Q,"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",H="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(Z,"attributeName","r"),t(Z,"values","10;16;10"),t(Z,"dur","2s"),t(Z,"repeatCount","indefinite"),t(K,"attributeName","opacity"),t(K,"values","0.5;0;0.5"),t(K,"dur","2s"),t(K,"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(J,"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,m),n(c,u),n(c,w),n(w,g),n(w,h),te&&te.m(w,null),n(v,k),n(v,y),n(y,M),n(y,T),n(y,p),n(y,C),n(y,A),n(d,S),n(d,F),n(F,_),n(_,I),n(I,O),n(O,X),n(O,$),n(_,re),n(_,Q),n(_,P),n(_,le),n(_,J),ye&&ye.m(J,null),n(J,N),q&&q.m(N,null),n(N,B),Y&&Y.m(N,null),n(N,se),x&&x.m(N,null),G&&G.m(J,null),n(J,fe),n(fe,Me),n(J,ee),n(ee,Z),n(ee,K),n(_,ie),n(ie,ce),n(_,oe),n(oe,ue),n(_,ne),n(ne,Ae),n(_,Te),n(Te,Ie);for(let he=0;he<4;he+=1)V[he]&&V[he].m(_,null);n(d,Ne),ve&&ve.m(d,null),Pe||(Se=[Ce(M,"click",e[6]),Ce(p,"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(J,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?Y?Y.p(j,be):(Y=El(),Y.c(),Y.m(N,se)):Y&&(Y.d(1),Y=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&&H!==(H="rotate("+j[3]+")")&&t(N,"transform",H),j[2]&&j[0]!==null?G?G.p(j,be):(G=Rl(j),G.c(),G.m(J,fe)):G&&(G.d(1),G=null),be&0){de=ut([45,135,225,315]);let he;for(he=0;he<4;he+=1){const Ee=Al(j,de,he);V[he]?V[he].p(Ee,be):(V[he]=Wl(Ee),V[he].c(),V[he].m(_,null))}for(;he<4;he+=1)V[he].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(),Y&&Y.d(),x&&x.d(),G&&G.d(),Dt(V,j),ve&&ve.d(),Pe=!1,nt(Se)}}}function Un(e,l,s){let i,o,r,f,d,v,{status:c}=l,{ultrabeam:m=null}=l,u=null,w=!1,g=null;async function h(){try{await Oe.rotator.rotateCW()}catch(p){console.error("Failed to rotate CW:",p)}}async function k(){try{await Oe.rotator.rotateCCW()}catch(p){console.error("Failed to rotate CCW:",p)}}async function y(){try{s(12,g=null),await Oe.rotator.stop()}catch(p){console.error("Failed to stop:",p)}}async function M(p){const A=p.currentTarget.getBoundingClientRect(),S=A.width/2,F=A.height/2,_=p.clientX-A.left-S,I=p.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=p=>p.key==="Enter"&&M(p);return e.$$set=p=>{"status"in p&&s(9,c=p.status),"ultrabeam"in p&&s(10,m=p.ultrabeam)},e.$$.update=()=>{if(e.$$.dirty&1024&&s(4,i=(m==null?void 0:m.direction)??0),e.$$.dirty&2560&&(c==null?void 0:c.heading)!==void 0&&(c==null?void 0:c.heading)!==null){const p=c.heading;u===null?(s(11,u=p),console.log(` ✓ First load, set to ${u}°`)):p===0&&u>10&&u<350?console.log(` ✗ IGNORED glitch jump from ${u}° to 0°`):s(11,u=p)}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 p=Math.abs(r-u);return Math.min(p,360-p)>2})()),e.$$.dirty&6144&&g!==null&&u!==null){const p=Math.abs(u-g);Math.min(p,360-p)<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 p=Math.abs(d-u);return Math.min(p,360-p)>2})())},[d,w,v,o,i,h,k,y,M,c,m,u,g,r,f,T]}class Jn extends ht{constructor(l){super(),vt(this,l,Un,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 Ul(e){let l,s,i,o,r,f,d,v,c,m=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(m),w=z("%)"),t(s,"class","svelte-t8himz"),t(r,"class","progress-fill svelte-t8himz"),ae(r,"width",e[6]+"%"),t(o,"class","progress-bar svelte-t8himz"),t(d,"class","progress-text svelte-t8himz"),t(l,"class","progress-section svelte-t8himz")},m(g,h){L(g,l,h),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,h){h[0]&64&&ae(r,"width",g[6]+"%"),h[0]&1&&R(v,g[0]),h[0]&64&&m!==(m=g[6].toFixed(0)+"")&&R(u,m)},d(g){g&&E(l)}}}function Xn(e){let l,s,i,o,r,f,d,v,c,m,u,w,g=(e[1]/1e3).toFixed(3)+"",h,k,y,M,T,p,C,A,S,F,_,I,O,X=e[10][e[2]]+"",$,re,Q,P,le,J,N,B,se,H,fe,Me,ee,Z,K,ie,ce,oe,ue,ne,Ae,Te,Ie,Ne,Pe,Se,te,ye,q=ut(e[11]),Y=[];for(let G=0;G<q.length;G+=1)Y[G]=jl(Gl(e,q,G));let x=e[8]>0&&Ul(e);return{c(){l=a("div"),s=a("div"),i=a("h2"),i.textContent="Ultrabeam",o=b(),r=a("span"),f=b(),d=a("div"),v=a("div"),c=a("div"),m=a("div"),m.textContent="Frequency",u=b(),w=a("div"),h=z(g),k=z(" MHz"),y=b(),M=a("div"),T=a("div"),T.textContent="Band",p=b(),C=a("div"),A=z(e[7]),S=b(),F=a("div"),_=a("div"),_.textContent="Direction",I=b(),O=a("div"),$=z(X),re=b(),Q=a("div"),P=a("h3"),P.textContent="Auto Tracking",le=b(),J=a("div"),N=a("label"),B=a("input"),se=b(),H=a("span"),H.textContent="Enable Auto-Track from Tuner",fe=b(),Me=a("div"),ee=a("label"),ee.textContent="Threshold:",Z=b(),K=a("select");for(let G=0;G<Y.length;G+=1)Y[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-t8himz"),t(r,"class","status-dot svelte-t8himz"),W(r,"disconnected",!e[9]),t(s,"class","card-header svelte-t8himz"),t(m,"class","status-label svelte-t8himz"),t(w,"class","status-value freq svelte-t8himz"),t(c,"class","status-item svelte-t8himz"),t(T,"class","status-label svelte-t8himz"),t(C,"class","status-value band svelte-t8himz"),t(M,"class","status-item svelte-t8himz"),t(_,"class","status-label svelte-t8himz"),t(O,"class","status-value direction svelte-t8himz"),t(F,"class","status-item svelte-t8himz"),t(v,"class","status-grid svelte-t8himz"),t(P,"class","svelte-t8himz"),t(B,"type","checkbox"),t(B,"class","svelte-t8himz"),t(N,"class","toggle-label svelte-t8himz"),t(ee,"for","threshold-select"),t(ee,"class","svelte-t8himz"),t(K,"id","threshold-select"),e[4]===void 0&&Nt(()=>e[22].call(K)),t(Me,"class","threshold-group svelte-t8himz"),t(J,"class","auto-track-controls svelte-t8himz"),t(oe,"class","dir-btn svelte-t8himz"),W(oe,"active",e[5]===0),t(ne,"class","dir-btn svelte-t8himz"),W(ne,"active",e[5]===1),t(Te,"class","dir-btn svelte-t8himz"),W(Te,"active",e[5]===2),t(ce,"class","direction-buttons svelte-t8himz"),t(Q,"class","control-section compact svelte-t8himz"),t(Se,"class","btn-danger"),t(Pe,"class","actions svelte-t8himz"),t(d,"class","metrics svelte-t8himz"),t(l,"class","card svelte-t8himz")},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,m),n(c,u),n(c,w),n(w,h),n(w,k),n(v,y),n(v,M),n(M,T),n(M,p),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,Q),n(Q,P),n(Q,le),n(Q,J),n(J,N),n(N,B),B.checked=e[3],n(N,se),n(N,H),n(J,fe),n(J,Me),n(Me,ee),n(Me,Z),n(Me,K);for(let V=0;V<Y.length;V+=1)Y[V]&&Y[V].m(K,null);It(K,e[4],!0),n(Q,ie),n(Q,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(K,"change",e[22]),Ce(K,"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(h,g),de[0]&128&&R(A,G[7]),de[0]&4&&X!==(X=G[10][G[2]]+"")&&R($,X),de[0]&8&&(B.checked=G[3]),de[0]&2048){q=ut(G[11]);let V;for(V=0;V<q.length;V+=1){const ve=Gl(G,q,V);Y[V]?Y[V].p(ve,de):(Y[V]=jl(ve),Y[V].c(),Y[V].m(K,null))}for(;V<Y.length;V+=1)Y[V].d(1);Y.length=q.length}de[0]&2064&&It(K,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=Ul(G),x.c(),x.m(d,Ne)):x&&(x.d(1),x=null)},i:we,o:we,d(G){G&&E(l),Dt(Y,G),x&&x.d(),te=!1,nt(ye)}}}function Yn(e,l,s){let i,o,r,f,d,v,c,m,u,w,g,{status:h}=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"],p=[{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 X(){A=tn(this),s(4,A),s(11,p)}const $=()=>{s(5,S=0),F()},re=()=>{s(5,S=1),F()},Q=()=>{s(5,S=2),F()};return e.$$set=P=>{"status"in P&&s(15,h=P.status),"flexradio"in P&&s(16,k=P.flexradio)},e.$$.update=()=>{e.$$.dirty[0]&32768&&s(9,i=(h==null?void 0:h.connected)||!1),e.$$.dirty[0]&32768&&s(1,o=(h==null?void 0:h.frequency)||0),e.$$.dirty[0]&32768&&s(18,r=(h==null?void 0:h.band)||0),e.$$.dirty[0]&32768&&s(2,f=(h==null?void 0:h.direction)||0),e.$$.dirty[0]&32768&&s(8,d=(h==null?void 0:h.motors_moving)||0),e.$$.dirty[0]&32768&&s(17,v=(h==null?void 0:h.progress_total)||0),e.$$.dirty[0]&32768&&s(0,c=(h==null?void 0:h.progress_current)||0),e.$$.dirty[0]&32768&&h!=null&&h.element_lengths,e.$$.dirty[0]&32768&&h&&`${h.firmware_major}${h.firmware_minor}`,e.$$.dirty[0]&65536&&s(20,m=(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:m,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,p,F,_,I,h,k,v,r,u,m,O,X,$,re,Q]}class Vn extends ht{constructor(l){super(),vt(this,l,Yn,Xn,ot,{status:15,flexradio:16},null,[-1,-1])}}function Zn(e){var zt,ge,_e,Jt,Xt,Yt,Vt,Zt,Kt,Ht,Qt;let l,s,i,o,r,f,d,v,c,m,u=e[1]?"Connected":"Disconnected",w,g,h,k,y,M,T,p=e[7].sfi+"",C,A,S,F,_,I=e[7].sunspots+"",O,X,$,re,Q,P=e[7].a_index+"",le,J,N,B,se,H=e[7].k_index+"",fe,Me,ee,Z,K,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)+"",Y,x,G,de,V,ve=e[6].temp.toFixed(1)+"",j,be,he,Ee,Ve,Ze=e[6].feels_like.toFixed(1)+"",We,Xe,Be,Le,$e,De=Jl(e[2])+"",qe,Ke,xe,Ge=e[2].toLocaleDateString()+"",me,ze,et,mt,rt,st,Re,He,Mt,Qe,gt,tt,it,je,lt,Ye,Ue,at,Je,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}}),He=new An({props:{status:(_e=e[0])==null?void 0:_e.webswitch}}),Qe=new Dn({props:{status:(Jt=e[0])==null?void 0:Jt.power_genius}}),tt=new Rn({props:{status:(Xt=e[0])==null?void 0:Xt.tuner_genius,flexradio:(Yt=e[0])==null?void 0:Yt.flexradio}}),lt=new Gn({props:{status:(Vt=e[0])==null?void 0:Vt.antenna_genius}}),Ue=new Vn({props:{status:(Zt=e[0])==null?void 0:Zt.ultrabeam,flexradio:(Kt=e[0])==null?void 0:Kt.flexradio}}),Je=new Jn({props:{status:(Ht=e[0])==null?void 0:Ht.rotator_genius,ultrabeam:(Qt=e[0])==null?void 0:Qt.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"),m=b(),w=z(u),g=b(),h=a("div"),k=a("div"),y=a("span"),M=z("SFI "),T=a("span"),C=z(p),A=b(),S=a("span"),F=z("Spots "),_=a("span"),O=z(I),X=b(),$=a("span"),re=z("A "),Q=a("span"),le=z(P),J=b(),N=a("span"),B=z("K "),se=a("span"),fe=z(H),Me=b(),ee=a("span"),Z=z("G "),K=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("💨 "),Y=z(q),x=z(" km/h"),G=b(),de=a("span"),V=z("🌡️ "),j=z(ve),be=z(" °C"),he=b(),Ee=a("span"),Ve=z("→ "),We=z(Ze),Xe=z(" °C"),Be=b(),Le=a("div"),$e=a("span"),qe=z(De),Ke=b(),xe=a("span"),me=z(Ge),ze=b(),bt(et.$$.fragment),mt=b(),rt=a("main"),st=a("div"),Re=a("div"),bt(He.$$.fragment),Mt=b(),bt(Qe.$$.fragment),gt=b(),bt(tt.$$.fragment),it=b(),je=a("div"),bt(lt.$$.fragment),Ye=b(),bt(Ue.$$.fragment),at=b(),bt(Je.$$.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(Q,"class","value svelte-a5dfm6"),t($,"class","solar-item svelte-a5dfm6"),t(se,"class","value svelte-a5dfm6"),t(N,"class","solar-item svelte-a5dfm6"),t(K,"class","value svelte-a5dfm6"),t(ee,"class","solar-item svelte-a5dfm6"),t(k,"class","solar-info svelte-a5dfm6"),t(h,"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(U,pe){L(U,l,pe),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,m),n(v,w),n(s,g),n(s,h),n(h,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,X),n(k,$),n($,re),n($,Q),n(Q,le),n(k,J),n(k,N),n(N,B),n(N,se),n(se,fe),n(k,Me),n(k,ee),n(ee,Z),n(ee,K),n(K,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,Y),n(te,x),n(ne,G),n(ne,de),n(de,V),n(de,j),n(de,be),n(ne,he),n(ne,Ee),n(Ee,Ve),n(Ee,We),n(Ee,Xe),n(ue,Be),n(ue,Le),n(Le,$e),n($e,qe),n(Le,Ke),n(Le,xe),n(xe,me),n(l,ze),dt(et,l,null),n(l,mt),n(l,rt),n(rt,st),n(st,Re),dt(He,Re,null),n(Re,Mt),dt(Qe,Re,null),n(Re,gt),dt(tt,Re,null),n(st,it),n(st,je),dt(lt,je,null),n(je,Ye),dt(Ue,je,null),n(je,at),dt(Je,je,null),Fe=!0},p(U,[pe]){var el,tl,ll,nl,sl,il,al,ol,rl,cl,dl;(!Fe||pe&8)&&R(r,U[3]),(!Fe||pe&2)&&W(c,"status-online",U[1]),(!Fe||pe&2)&&W(c,"status-offline",!U[1]),(!Fe||pe&2)&&u!==(u=U[1]?"Connected":"Disconnected")&&R(w,u),(!Fe||pe&128)&&p!==(p=U[7].sfi+"")&&R(C,p),(!Fe||pe&128)&&I!==(I=U[7].sunspots+"")&&R(O,I),(!Fe||pe&128)&&P!==(P=U[7].a_index+"")&&R(le,P),(!Fe||pe&128)&&H!==(H=U[7].k_index+"")&&R(fe,H),(!Fe||pe&128)&&ie!==(ie=U[7].geomag+"")&&R(ce,ie),(!Fe||pe&64)&&Ie!==(Ie=U[6].wind_speed.toFixed(1)+"")&&R(Ne,Ie),(!Fe||pe&64)&&q!==(q=U[6].wind_gust.toFixed(1)+"")&&R(Y,q),(!Fe||pe&64)&&ve!==(ve=U[6].temp.toFixed(1)+"")&&R(j,ve),(!Fe||pe&64)&&Ze!==(Ze=U[6].feels_like.toFixed(1)+"")&&R(We,Ze),(!Fe||pe&4)&&De!==(De=Jl(U[2])+"")&&R(qe,De),(!Fe||pe&4)&&Ge!==(Ge=U[2].toLocaleDateString()+"")&&R(me,Ge);const Tt={};pe&1&&(Tt.flexradio=(el=U[0])==null?void 0:el.flexradio),pe&1&&(Tt.weather=(tl=U[0])==null?void 0:tl.weather),pe&16&&(Tt.latitude=U[4]),pe&32&&(Tt.longitude=U[5]),et.$set(Tt);const qt={};pe&1&&(qt.status=(ll=U[0])==null?void 0:ll.webswitch),He.$set(qt);const xt={};pe&1&&(xt.status=(nl=U[0])==null?void 0:nl.power_genius),Qe.$set(xt);const Et={};pe&1&&(Et.status=(sl=U[0])==null?void 0:sl.tuner_genius),pe&1&&(Et.flexradio=(il=U[0])==null?void 0:il.flexradio),tt.$set(Et);const $t={};pe&1&&($t.status=(al=U[0])==null?void 0:al.antenna_genius),lt.$set($t);const Lt={};pe&1&&(Lt.status=(ol=U[0])==null?void 0:ol.ultrabeam),pe&1&&(Lt.flexradio=(rl=U[0])==null?void 0:rl.flexradio),Ue.$set(Lt);const Rt={};pe&1&&(Rt.status=(cl=U[0])==null?void 0:cl.rotator_genius),pe&1&&(Rt.ultrabeam=(dl=U[0])==null?void 0:dl.ultrabeam),Je.$set(Rt)},i(U){Fe||(ct(et.$$.fragment,U),ct(He.$$.fragment,U),ct(Qe.$$.fragment,U),ct(tt.$$.fragment,U),ct(lt.$$.fragment,U),ct(Ue.$$.fragment,U),ct(Je.$$.fragment,U),Fe=!0)},o(U){pt(et.$$.fragment,U),pt(He.$$.fragment,U),pt(Qe.$$.fragment,U),pt(tt.$$.fragment,U),pt(lt.$$.fragment,U),pt(Ue.$$.fragment,U),pt(Je.$$.fragment,U),Fe=!1},d(U){U&&E(l),ft(et),ft(He),ft(Qe),ft(tt),ft(lt),ft(Ue),ft(Je)}}}function Jl(e){return e.toTimeString().slice(0,8)}function Kn(e,l,s){let i,o,r=null,f=!1,d=new Date,v="F4BPO",c=null,m=null;const u=Ql.subscribe(g=>{s(0,r=g)}),w=jt.subscribe(g=>{s(1,f=g)});return Zl(async()=>{hl.connect();try{const h=await Oe.getConfig();h.callsign&&s(3,v=h.callsign),h.location&&(s(4,c=h.location.latitude),s(5,m=h.location.longitude))}catch(h){console.error("Failed to fetch config:",h)}const g=setInterval(()=>{s(2,d=new Date)},1e3);return()=>{clearInterval(g)}}),Kl(()=>{hl.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,m,o,i]}class Hn extends ht{constructor(l){super(),vt(this,l,Kn,Zn,ot,{})}}new Hn({target:document.getElementById("app")});