12 lines
57 KiB
JavaScript
12 lines
57 KiB
JavaScript
var Fl=Object.defineProperty;var Al=(e,n,s)=>n in e?Fl(e,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[n]=s;var Dt=(e,n,s)=>Al(e,typeof n!="symbol"?n+"":n,s);(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const f of i.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&o(f)}).observe(document,{childList:!0,subtree:!0});function s(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(r){if(r.ep)return;r.ep=!0;const i=s(r);fetch(r.href,i)}})();function Se(){}function Sl(e){return e()}function ll(){return Object.create(null)}function tt(e){e.forEach(Sl)}function Cl(e){return typeof e=="function"}function rt(e,n){return e!=e?n==n:e!==n||e&&typeof e=="object"||typeof e=="function"}function Il(e){return Object.keys(e).length===0}function l(e,n){e.appendChild(n)}function ne(e,n,s){e.insertBefore(n,s||null)}function te(e){e.parentNode&&e.parentNode.removeChild(e)}function It(e,n){for(let s=0;s<e.length;s+=1)e[s]&&e[s].d(n)}function a(e){return document.createElement(e)}function I(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function k(e){return document.createTextNode(e)}function v(){return k(" ")}function nl(){return k("")}function Te(e,n,s,o){return e.addEventListener(n,s,o),()=>e.removeEventListener(n,s,o)}function t(e,n,s){s==null?e.removeAttribute(n):e.getAttribute(n)!==s&&e.setAttribute(n,s)}function zl(e){return Array.from(e.childNodes)}function E(e,n){n=""+n,e.data!==n&&(e.data=n)}function Pt(e,n){e.value=n??""}function Z(e,n,s,o){s==null?e.style.removeProperty(n):e.style.setProperty(n,s,"")}function Ft(e,n,s){for(let o=0;o<e.options.length;o+=1){const r=e.options[o];if(r.__value===n){r.selected=!0;return}}(!s||n!==void 0)&&(e.selectedIndex=-1)}function Nl(e){const n=e.querySelector(":checked");return n&&n.__value}function N(e,n,s){e.classList.toggle(n,!!s)}let jt;function Ct(e){jt=e}function jl(){if(!jt)throw new Error("Function called outside component initialization");return jt}function El(e){jl().$$.on_mount.push(e)}function Dl(e){jl().$$.on_destroy.push(e)}const yt=[],sl=[];let kt=[];const ol=[],Rl=Promise.resolve();let Lt=!1;function Ll(){Lt||(Lt=!0,Rl.then(Pl))}function At(e){kt.push(e)}const Rt=new Set;let bt=0;function Pl(){if(bt!==0)return;const e=jt;do{try{for(;bt<yt.length;){const n=yt[bt];bt++,Ct(n),Bl(n.$$)}}catch(n){throw yt.length=0,bt=0,n}for(Ct(null),yt.length=0,bt=0;sl.length;)sl.pop()();for(let n=0;n<kt.length;n+=1){const s=kt[n];Rt.has(s)||(Rt.add(s),s())}kt.length=0}while(yt.length);for(;ol.length;)ol.pop()();Lt=!1,Rt.clear(),Ct(e)}function Bl(e){if(e.fragment!==null){e.update(),tt(e.before_update);const n=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,n),e.after_update.forEach(At)}}function Gl(e){const n=[],s=[];kt.forEach(o=>e.indexOf(o)===-1?n.push(o):s.push(o)),s.forEach(o=>o()),kt=n}const Ot=new Set;let Hl;function ft(e,n){e&&e.i&&(Ot.delete(e),e.i(n))}function gt(e,n,s,o){if(e&&e.o){if(Ot.has(e))return;Ot.add(e),Hl.c.push(()=>{Ot.delete(e)}),e.o(n)}}function it(e){return(e==null?void 0:e.length)!==void 0?e:Array.from(e)}function wt(e){e&&e.c()}function ut(e,n,s){const{fragment:o,after_update:r}=e.$$;o&&o.m(n,s),At(()=>{const i=e.$$.on_mount.map(Sl).filter(Cl);e.$$.on_destroy?e.$$.on_destroy.push(...i):tt(i),e.$$.on_mount=[]}),r.forEach(At)}function vt(e,n){const s=e.$$;s.fragment!==null&&(Gl(s.after_update),tt(s.on_destroy),s.fragment&&s.fragment.d(n),s.on_destroy=s.fragment=null,s.ctx=[])}function Wl(e,n){e.$$.dirty[0]===-1&&(yt.push(e),Ll(),e.$$.dirty.fill(0)),e.$$.dirty[n/31|0]|=1<<n%31}function ht(e,n,s,o,r,i,f=null,c=[-1]){const m=jt;Ct(e);const d=e.$$={fragment:null,ctx:[],props:i,update:Se,not_equal:r,bound:ll(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(n.context||(m?m.$$.context:[])),callbacks:ll(),dirty:c,skip_bound:!1,root:n.target||m.$$.root};f&&f(d.root);let w=!1;if(d.ctx=s?s(e,n.props||{},(u,_,...y)=>{const M=y.length?y[0]:_;return d.ctx&&r(d.ctx[u],d.ctx[u]=M)&&(!d.skip_bound&&d.bound[u]&&d.bound[u](M),w&&Wl(e,u)),_}):[],d.update(),w=!0,tt(d.before_update),d.fragment=o?o(d.ctx):!1,n.target){if(n.hydrate){const u=zl(n.target);d.fragment&&d.fragment.l(u),u.forEach(te)}else d.fragment&&d.fragment.c();n.intro&&ft(e.$$.fragment),ut(e,n.target,n.anchor),Pl()}Ct(m)}class pt{constructor(){Dt(this,"$$");Dt(this,"$$set")}$destroy(){vt(this,1),this.$destroy=Se}$on(n,s){if(!Cl(s))return Se;const o=this.$$.callbacks[n]||(this.$$.callbacks[n]=[]);return o.push(s),()=>{const r=o.indexOf(s);r!==-1&&o.splice(r,1)}}$set(n){this.$$set&&!Il(n)&&(this.$$.skip_bound=!0,this.$$set(n),this.$$.skip_bound=!1)}}const Xl="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Xl);const _t=[];function Gt(e,n=Se){let s;const o=new Set;function r(c){if(rt(e,c)&&(e=c,s)){const m=!_t.length;for(const d of o)d[1](),_t.push(d,e);if(m){for(let d=0;d<_t.length;d+=2)_t[d][0](_t[d+1]);_t.length=0}}}function i(c){r(c(e))}function f(c,m=Se){const d=[c,m];return o.add(d),o.size===1&&(s=n(r,i)||Se),c(e),()=>{o.delete(d),o.size===0&&s&&(s(),s=null)}}return{set:r,update:i,subscribe:f}}const Bt=Gt(!1),Ol=Gt(null),Ul=Gt(null);class ql{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"),Bt.set(!0)},this.ws.onmessage=o=>{try{const r=JSON.parse(o.data);r.type==="update"&&(console.log("System status updated:",r.data),Ol.set(r.data),Ul.set(new Date(r.timestamp)))}catch(r){console.error("Error parsing message:",r)}},this.ws.onerror=o=>{console.error("WebSocket error:",o)},this.ws.onclose=()=>{console.log("WebSocket disconnected"),Bt.set(!1),this.scheduleReconnect()}}catch(o){console.error("Error creating WebSocket:",o),this.scheduleReconnect()}}scheduleReconnect(){this.reconnectTimeout&&clearTimeout(this.reconnectTimeout),this.reconnectTimeout=setTimeout(()=>{console.log("Attempting to reconnect..."),this.connect()},this.reconnectDelay)}send(n){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(n))}disconnect(){this.reconnectTimeout&&clearTimeout(this.reconnectTimeout),this.ws&&this.ws.close()}}const al=new ql,Jl="/api";async function ye(e,n={}){try{const s=await fetch(`${Jl}${e}`,{...n,headers:{"Content-Type":"application/json",...n.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 Fe={getStatus:()=>ye("/status"),getConfig:()=>ye("/config"),webswitch:{relayOn:e=>ye(`/webswitch/relay/on?relay=${e}`,{method:"POST"}),relayOff:e=>ye(`/webswitch/relay/off?relay=${e}`,{method:"POST"}),allOn:()=>ye("/webswitch/all/on",{method:"POST"}),allOff:()=>ye("/webswitch/all/off",{method:"POST"})},rotator:{move:(e,n)=>ye("/rotator/move",{method:"POST",body:JSON.stringify({rotator:e,azimuth:n})}),cw:e=>ye(`/rotator/cw?rotator=${e}`,{method:"POST"}),ccw:e=>ye(`/rotator/ccw?rotator=${e}`,{method:"POST"}),stop:()=>ye("/rotator/stop",{method:"POST"})},tuner:{setOperate:e=>ye("/tuner/operate",{method:"POST",body:JSON.stringify({value:e})}),setBypass:e=>ye("/tuner/bypass",{method:"POST",body:JSON.stringify({value:e})}),autoTune:()=>ye("/tuner/autotune",{method:"POST"})},antenna:{selectAntenna:(e,n)=>ye("/antenna/select",{method:"POST",body:JSON.stringify({port:e,antenna:n})}),deselectAntenna:(e,n)=>ye("/antenna/deselect",{method:"POST",body:JSON.stringify({port:e,antenna:n})}),reboot:()=>ye("/antenna/reboot",{method:"POST"})},power:{setFanMode:e=>ye("/power/fanmode",{method:"POST",body:JSON.stringify({mode:e})}),setOperate:e=>ye("/power/operate",{method:"POST",body:JSON.stringify({value:e})})},rotator:{setHeading:e=>ye("/rotator/heading",{method:"POST",body:JSON.stringify({heading:e})}),rotateCW:()=>ye("/rotator/cw",{method:"POST"}),rotateCCW:()=>ye("/rotator/ccw",{method:"POST"}),stop:()=>ye("/rotator/stop",{method:"POST"})},ultrabeam:{setFrequency:(e,n)=>ye("/ultrabeam/frequency",{method:"POST",body:JSON.stringify({frequency:e,direction:n})}),retract:()=>ye("/ultrabeam/retract",{method:"POST"}),setAutoTrack:(e,n)=>ye("/ultrabeam/autotrack",{method:"POST",body:JSON.stringify({enabled:e,threshold:n})}),setDirection:e=>ye("/ultrabeam/direction",{method:"POST",body:JSON.stringify({direction:e})})}};function il(e,n,s){var f;const o=e.slice();o[10]=n[s];const r=o[1].find(function(...m){return e[9](o[10],...m)});o[11]=r;const i=((f=o[11])==null?void 0:f.state)||!1;return o[12]=i,o}function rl(e){let n,s,o,r,i,f,c=e[12]?"ON":"OFF",m,d,w,u,_,y,M,g;function h(){return e[8](e[10])}return{c(){n=a("div"),s=a("div"),o=a("div"),r=a("div"),r.textContent=`${e[3][e[10]]}`,i=v(),f=a("div"),m=k(c),d=v(),w=a("button"),u=a("div"),u.innerHTML='<div class="toggle-thumb svelte-z2csmj"></div>',y=v(),t(r,"class","relay-name svelte-z2csmj"),t(f,"class","relay-status svelte-z2csmj"),t(o,"class","relay-details svelte-z2csmj"),t(s,"class","relay-info svelte-z2csmj"),t(u,"class","toggle-track svelte-z2csmj"),t(w,"class","relay-toggle svelte-z2csmj"),w.disabled=_=e[0][e[10]],N(w,"active",e[12]),N(w,"loading",e[0][e[10]]),t(n,"class","relay-card svelte-z2csmj"),N(n,"relay-on",e[12])},m(p,T){ne(p,n,T),l(n,s),l(s,o),l(o,r),l(o,i),l(o,f),l(f,m),l(n,d),l(n,w),l(w,u),l(n,y),M||(g=Te(w,"click",h),M=!0)},p(p,T){e=p,T&2&&c!==(c=e[12]?"ON":"OFF")&&E(m,c),T&1&&_!==(_=e[0][e[10]])&&(w.disabled=_),T&2&&N(w,"active",e[12]),T&1&&N(w,"loading",e[0][e[10]]),T&2&&N(n,"relay-on",e[12])},d(p){p&&te(n),M=!1,g()}}}function Yl(e){let n,s,o,r,i,f,c,m,d,w,u,_,y,M,g,h=it([1,2,3,4,5]),p=[];for(let T=0;T<5;T+=1)p[T]=rl(il(e,h,T));return{c(){n=a("div"),s=a("div"),o=a("h2"),o.textContent="WebSwitch",r=v(),i=a("span"),f=v(),c=a("div"),m=a("div");for(let T=0;T<5;T+=1)p[T].c();d=v(),w=a("div"),u=a("button"),u.innerHTML=`<span class="btn-icon svelte-z2csmj">⚡</span>
|
|
ALL ON`,_=v(),y=a("button"),y.innerHTML=`<span class="btn-icon svelte-z2csmj">⏻</span>
|
|
ALL OFF`,t(o,"class","svelte-z2csmj"),t(i,"class","status-dot svelte-z2csmj"),N(i,"disconnected",!e[2]),t(s,"class","card-header svelte-z2csmj"),t(m,"class","relays svelte-z2csmj"),t(u,"class","control-btn all-on svelte-z2csmj"),t(y,"class","control-btn all-off svelte-z2csmj"),t(w,"class","controls svelte-z2csmj"),t(c,"class","metrics svelte-z2csmj"),t(n,"class","card svelte-z2csmj")},m(T,b){ne(T,n,b),l(n,s),l(s,o),l(s,r),l(s,i),l(n,f),l(n,c),l(c,m);for(let A=0;A<5;A+=1)p[A]&&p[A].m(m,null);l(c,d),l(c,w),l(w,u),l(w,_),l(w,y),M||(g=[Te(u,"click",e[5]),Te(y,"click",e[6])],M=!0)},p(T,[b]){if(b&4&&N(i,"disconnected",!T[2]),b&27){h=it([1,2,3,4,5]);let A;for(A=0;A<5;A+=1){const U=il(T,h,A);p[A]?p[A].p(U,b):(p[A]=rl(U),p[A].c(),p[A].m(m,null))}for(;A<5;A+=1)p[A].d(1)}},i:Se,o:Se,d(T){T&&te(n),It(p,T),M=!1,tt(g)}}}function Vl(e,n,s){let o,r,{status:i}=n;const f={1:"Power Supply",2:"PGXL",3:"TGXL",4:"Flex Radio Start",5:"Reserve"};let c={};async function m(y){const M=o.find(h=>h.number===y),g=(M==null?void 0:M.state)||!1;s(0,c[y]=!0,c);try{g?await Fe.webswitch.relayOff(y):await Fe.webswitch.relayOn(y)}catch(h){console.error("Failed to toggle relay:",h),alert("Failed to control relay")}finally{s(0,c[y]=!1,c)}}async function d(){try{await Fe.webswitch.allOn()}catch(y){console.error("Failed to turn all on:",y)}}async function w(){try{await Fe.webswitch.allOff()}catch(y){console.error("Failed to turn all off:",y)}}const u=y=>m(y),_=(y,M)=>M.number===y;return e.$$set=y=>{"status"in y&&s(7,i=y.status)},e.$$.update=()=>{e.$$.dirty&128&&s(1,o=(i==null?void 0:i.relays)||[]),e.$$.dirty&128&&s(2,r=(i==null?void 0:i.connected)||!1)},[c,o,r,f,m,d,w,i,u,_]}class Kl extends pt{constructor(n){super(),ht(this,n,Vl,Yl,rt,{status:7})}}function Zl(e){let n,s,o,r,i,f,c,m,d,w,u,_,y,M,g,h,p,T=e[1].toFixed(0)+"",b,A,U,D,z,P,se,me,Q,x,oe=e[2].toFixed(2)+"",$,ie,j,K,O,F,W,R=e[3].toFixed(1)+"",ve,Pe,be,fe,ke,Me,ue,Oe,ae,G,Ce=e[12].toFixed(1)+"",ge,De,je,Ee,Ae,X,J,re,Y,L,le,ee,q,C=e[15].toFixed(0)+"",S,H,V,Ie,lt,Le,Ve=e[14].toFixed(1)+"",He,We,ze,Xe,Qe,Re,xe=e[13].toFixed(1)+"",Be,Ke,Ue,ce,he,nt,qe,Ze,Mt,Ge,ct,$e,dt,Ye,et,st,Je,Tt,Ne,we,ot,at,mt,St;return{c(){n=a("div"),s=a("div"),o=a("h2"),o.textContent="Power Genius XL",r=v(),i=a("div"),f=a("button"),c=k(e[7]),m=v(),d=a("span"),w=v(),u=a("div"),_=a("div"),y=a("div"),M=a("div"),g=a("span"),g.textContent="Power",h=v(),p=a("span"),b=k(T),A=k(" W"),U=v(),D=a("div"),z=a("div"),P=a("div"),se=a("div"),me=v(),Q=a("div"),x=a("div"),$=k(oe),ie=v(),j=a("div"),j.textContent="SWR",K=v(),O=a("div"),F=a("div"),W=a("div"),ve=k(R),Pe=k("°"),be=v(),fe=a("div"),fe.textContent="PA Temp",ke=v(),Me=a("div"),ue=a("div"),Oe=v(),ae=a("div"),G=a("div"),ge=k(Ce),De=k("°"),je=v(),Ee=a("div"),Ee.textContent="HL Temp",Ae=v(),X=a("div"),J=a("div"),re=v(),Y=a("div"),L=a("div"),le=a("div"),le.textContent="VAC",ee=v(),q=a("div"),S=k(C),H=v(),V=a("div"),Ie=a("div"),Ie.textContent="VDD",lt=v(),Le=a("div"),He=k(Ve),We=v(),ze=a("div"),Xe=a("div"),Xe.textContent="ID Peak",Qe=v(),Re=a("div"),Be=k(xe),Ke=v(),Ue=a("div"),ce=a("div"),he=a("span"),he.textContent="Band A",nt=v(),qe=a("span"),Ze=k(e[10]),Mt=v(),Ge=a("div"),ct=a("span"),ct.textContent="Band B",$e=v(),dt=a("span"),Ye=k(e[9]),et=v(),st=a("div"),Je=a("label"),Je.textContent="Fan Mode",Tt=v(),Ne=a("select"),we=a("option"),we.textContent="Standard",ot=a("option"),ot.textContent="Contest",at=a("option"),at.textContent="Broadcast",t(o,"class","svelte-1h3han9"),t(f,"class","state-badge svelte-1h3han9"),N(f,"idle",e[0]==="IDLE"),N(f,"transmit",e[0].includes("TRANSMIT")),t(d,"class","status-dot svelte-1h3han9"),N(d,"disconnected",!e[8]),t(i,"class","header-right svelte-1h3han9"),t(s,"class","card-header svelte-1h3han9"),t(g,"class","power-label-inline svelte-1h3han9"),t(p,"class","power-value-inline svelte-1h3han9"),t(M,"class","power-header svelte-1h3han9"),t(se,"class","power-bar-glow svelte-1h3han9"),t(P,"class","power-bar-fill svelte-1h3han9"),Z(P,"width",e[4]+"%"),t(z,"class","power-bar-bg svelte-1h3han9"),t(D,"class","power-bar-container svelte-1h3han9"),t(y,"class","power-section svelte-1h3han9"),t(x,"class","swr-value-compact svelte-1h3han9"),t(j,"class","swr-label-compact svelte-1h3han9"),t(Q,"class","swr-circle-compact svelte-1h3han9"),Z(Q,"--swr-color",e[5]),t(_,"class","power-swr-row svelte-1h3han9"),t(W,"class","temp-value svelte-1h3han9"),Z(W,"color",e[6]),t(fe,"class","temp-label svelte-1h3han9"),t(ue,"class","temp-mini-fill svelte-1h3han9"),Z(ue,"width",e[3]/80*100+"%"),Z(ue,"background",e[6]),t(Me,"class","temp-mini-bar svelte-1h3han9"),t(F,"class","temp-item svelte-1h3han9"),t(G,"class","temp-value svelte-1h3han9"),Z(G,"color",e[6]),t(Ee,"class","temp-label svelte-1h3han9"),t(J,"class","temp-mini-fill svelte-1h3han9"),Z(J,"width",e[12]/80*100+"%"),Z(J,"background",e[6]),t(X,"class","temp-mini-bar svelte-1h3han9"),t(ae,"class","temp-item svelte-1h3han9"),t(O,"class","temp-group svelte-1h3han9"),t(le,"class","param-label svelte-1h3han9"),t(q,"class","param-value svelte-1h3han9"),t(L,"class","param-box svelte-1h3han9"),t(Ie,"class","param-label svelte-1h3han9"),t(Le,"class","param-value svelte-1h3han9"),t(V,"class","param-box svelte-1h3han9"),t(Xe,"class","param-label svelte-1h3han9"),t(Re,"class","param-value svelte-1h3han9"),t(ze,"class","param-box svelte-1h3han9"),t(Y,"class","params-grid svelte-1h3han9"),t(he,"class","band-label svelte-1h3han9"),t(qe,"class","band-value svelte-1h3han9"),t(ce,"class","band-item svelte-1h3han9"),t(ct,"class","band-label svelte-1h3han9"),t(dt,"class","band-value svelte-1h3han9"),t(Ge,"class","band-item svelte-1h3han9"),t(Ue,"class","band-display svelte-1h3han9"),t(Je,"for","fan-mode-select"),t(Je,"class","control-label svelte-1h3han9"),we.__value="STANDARD",Pt(we,we.__value),ot.__value="CONTEST",Pt(ot,ot.__value),at.__value="BROADCAST",Pt(at,at.__value),t(Ne,"id","fan-mode-select"),t(Ne,"class","svelte-1h3han9"),t(st,"class","fan-control svelte-1h3han9"),t(u,"class","metrics svelte-1h3han9"),t(n,"class","card svelte-1h3han9")},m(de,pe){ne(de,n,pe),l(n,s),l(s,o),l(s,r),l(s,i),l(i,f),l(f,c),l(i,m),l(i,d),l(n,w),l(n,u),l(u,_),l(_,y),l(y,M),l(M,g),l(M,h),l(M,p),l(p,b),l(p,A),l(y,U),l(y,D),l(D,z),l(z,P),l(P,se),l(_,me),l(_,Q),l(Q,x),l(x,$),l(Q,ie),l(Q,j),l(u,K),l(u,O),l(O,F),l(F,W),l(W,ve),l(W,Pe),l(F,be),l(F,fe),l(F,ke),l(F,Me),l(Me,ue),l(O,Oe),l(O,ae),l(ae,G),l(G,ge),l(G,De),l(ae,je),l(ae,Ee),l(ae,Ae),l(ae,X),l(X,J),l(u,re),l(u,Y),l(Y,L),l(L,le),l(L,ee),l(L,q),l(q,S),l(Y,H),l(Y,V),l(V,Ie),l(V,lt),l(V,Le),l(Le,He),l(Y,We),l(Y,ze),l(ze,Xe),l(ze,Qe),l(ze,Re),l(Re,Be),l(u,Ke),l(u,Ue),l(Ue,ce),l(ce,he),l(ce,nt),l(ce,qe),l(qe,Ze),l(Ue,Mt),l(Ue,Ge),l(Ge,ct),l(Ge,$e),l(Ge,dt),l(dt,Ye),l(u,et),l(u,st),l(st,Je),l(st,Tt),l(st,Ne),l(Ne,we),l(Ne,ot),l(Ne,at),Ft(Ne,e[11]),mt||(St=[Te(f,"click",e[17]),Te(Ne,"change",e[19])],mt=!0)},p(de,[pe]){pe&128&&E(c,de[7]),pe&1&&N(f,"idle",de[0]==="IDLE"),pe&1&&N(f,"transmit",de[0].includes("TRANSMIT")),pe&256&&N(d,"disconnected",!de[8]),pe&2&&T!==(T=de[1].toFixed(0)+"")&&E(b,T),pe&16&&Z(P,"width",de[4]+"%"),pe&4&&oe!==(oe=de[2].toFixed(2)+"")&&E($,oe),pe&32&&Z(Q,"--swr-color",de[5]),pe&8&&R!==(R=de[3].toFixed(1)+"")&&E(ve,R),pe&64&&Z(W,"color",de[6]),pe&8&&Z(ue,"width",de[3]/80*100+"%"),pe&64&&Z(ue,"background",de[6]),pe&4096&&Ce!==(Ce=de[12].toFixed(1)+"")&&E(ge,Ce),pe&64&&Z(G,"color",de[6]),pe&4096&&Z(J,"width",de[12]/80*100+"%"),pe&64&&Z(J,"background",de[6]),pe&32768&&C!==(C=de[15].toFixed(0)+"")&&E(S,C),pe&16384&&Ve!==(Ve=de[14].toFixed(1)+"")&&E(He,Ve),pe&8192&&xe!==(xe=de[13].toFixed(1)+"")&&E(Be,xe),pe&1024&&E(Ze,de[10]),pe&512&&E(Ye,de[9]),pe&2048&&Ft(Ne,de[11])},i:Se,o:Se,d(de){de&&te(n),mt=!1,tt(St)}}}function Ql(e,n,s){let o,r,i,f,c,m,d,w,u,_,y,M,g,h,p,T,{status:b}=n;async function A(z){try{await Fe.power.setFanMode(z)}catch(P){console.error("Failed to set fan mode:",P)}}async function U(){try{const z=u==="IDLE"?0:1;await Fe.power.setOperate(z)}catch(z){console.error("Failed to toggle operate:",z)}}const D=z=>A(z.target.value);return e.$$set=z=>{"status"in z&&s(18,b=z.status)},e.$$.update=()=>{e.$$.dirty&262144&&s(1,o=(b==null?void 0:b.power_forward)||0),e.$$.dirty&262144&&b!=null&&b.power_reflected,e.$$.dirty&262144&&s(2,r=(b==null?void 0:b.swr)||1),e.$$.dirty&262144&&s(15,i=(b==null?void 0:b.voltage)||0),e.$$.dirty&262144&&s(14,f=(b==null?void 0:b.vdd)||0),e.$$.dirty&262144&&b!=null&&b.current,e.$$.dirty&262144&&s(13,c=(b==null?void 0:b.peak_current)||0),e.$$.dirty&262144&&s(3,m=(b==null?void 0:b.temperature)||0),e.$$.dirty&262144&&s(12,d=(b==null?void 0:b.harmonic_load_temp)||0),e.$$.dirty&262144&&s(11,w=(b==null?void 0:b.fan_mode)||"CONTEST"),e.$$.dirty&262144&&s(0,u=(b==null?void 0:b.state)||"IDLE"),e.$$.dirty&262144&&s(10,_=(b==null?void 0:b.band_a)||"0"),e.$$.dirty&262144&&s(9,y=(b==null?void 0:b.band_b)||"0"),e.$$.dirty&262144&&s(8,M=(b==null?void 0:b.connected)||!1),e.$$.dirty&1&&s(7,g=u.replace("TRANSMIT_A","TRANSMIT").replace("TRANSMIT_B","TRANSMIT")),e.$$.dirty&8&&s(6,h=m<40?"#4caf50":m<60?"#ffc107":m<75?"#ff9800":"#f44336"),e.$$.dirty&4&&s(5,p=r<1.5?"#4caf50":r<2?"#ffc107":r<3?"#ff9800":"#f44336"),e.$$.dirty&2&&s(4,T=Math.min(o/2e3*100,100))},[u,o,r,m,T,p,h,g,M,y,_,w,d,c,f,i,A,U,b,D]}class xl extends pt{constructor(n){super(),ht(this,n,Ql,Zl,rt,{status:18})}}function $l(e){let n,s,o,r,i,f,c,m,d,w,u,_,y,M,g,h,p,T=e[0].toFixed(0)+"",b,A,U,D,z,P,se,me,Q,x,oe=e[1].toFixed(2)+"",$,ie,j,K,O,F,W,R,ve,Pe,be,fe,ke,Me,ue,Oe,ae,G,Ce,ge,De,je,Ee,Ae,X,J,re,Y,L=(e[11]/1e3).toFixed(3)+"",le,ee,q,C,S,H,V,Ie=(e[10]/1e3).toFixed(3)+"",lt,Le,Ve,He,We,ze=e[8]===1?"OPERATE":"STANDBY",Xe,Qe,Re,xe,Be,Ke,Ue;return{c(){n=a("div"),s=a("div"),o=a("h2"),o.textContent="Tuner Genius XL",r=v(),i=a("div"),f=a("span"),c=k(e[12]),m=v(),d=a("span"),w=v(),u=a("div"),_=a("div"),y=a("div"),M=a("div"),g=a("span"),g.textContent="Power",h=v(),p=a("span"),b=k(T),A=k(" W"),U=v(),D=a("div"),z=a("div"),P=a("div"),se=a("div"),me=v(),Q=a("div"),x=a("div"),$=k(oe),ie=v(),j=a("div"),j.textContent="SWR",K=v(),O=a("div"),F=a("div"),W=a("div"),R=k(e[7]),ve=v(),Pe=a("div"),Pe.textContent="C1",be=v(),fe=a("div"),ke=a("div"),Me=k(e[6]),ue=v(),Oe=a("div"),Oe.textContent="L",ae=v(),G=a("div"),Ce=a("div"),ge=k(e[5]),De=v(),je=a("div"),je.textContent="C2",Ee=v(),Ae=a("div"),X=a("div"),J=a("div"),J.textContent="Freq A",re=v(),Y=a("div"),le=k(L),ee=a("span"),ee.textContent="MHz",q=v(),C=a("div"),S=a("div"),S.textContent="Freq B",H=v(),V=a("div"),lt=k(Ie),Le=a("span"),Le.textContent="MHz",Ve=v(),He=a("div"),We=a("button"),Xe=k(ze),Qe=v(),Re=a("button"),Re.textContent="BYPASS",xe=v(),Be=a("button"),Be.innerHTML=`<span class="tune-icon svelte-j68xon">⚡</span>
|
|
AUTO TUNE`,t(o,"class","svelte-j68xon"),t(f,"class","tuning-badge svelte-j68xon"),N(f,"tuning",e[12]==="TUNING"),t(d,"class","status-dot svelte-j68xon"),N(d,"disconnected",!e[4]),t(i,"class","header-right svelte-j68xon"),t(s,"class","card-header svelte-j68xon"),t(g,"class","power-label-inline svelte-j68xon"),t(p,"class","power-value-inline svelte-j68xon"),t(M,"class","power-header svelte-j68xon"),t(se,"class","power-bar-glow svelte-j68xon"),t(P,"class","power-bar-fill svelte-j68xon"),Z(P,"width",e[2]+"%"),t(z,"class","power-bar-bg svelte-j68xon"),t(D,"class","power-bar-container svelte-j68xon"),t(y,"class","power-section svelte-j68xon"),t(x,"class","swr-value-compact svelte-j68xon"),t(j,"class","swr-label-compact svelte-j68xon"),t(Q,"class","swr-circle-compact svelte-j68xon"),Z(Q,"--swr-color",e[3]),t(_,"class","power-swr-row svelte-j68xon"),t(W,"class","cap-value svelte-j68xon"),t(Pe,"class","cap-label svelte-j68xon"),t(F,"class","cap-item svelte-j68xon"),t(ke,"class","cap-value svelte-j68xon"),t(Oe,"class","cap-label svelte-j68xon"),t(fe,"class","cap-item svelte-j68xon"),t(Ce,"class","cap-value svelte-j68xon"),t(je,"class","cap-label svelte-j68xon"),t(G,"class","cap-item svelte-j68xon"),t(O,"class","capacitors svelte-j68xon"),t(J,"class","freq-label svelte-j68xon"),t(ee,"class","freq-unit svelte-j68xon"),t(Y,"class","freq-value svelte-j68xon"),t(X,"class","freq-item svelte-j68xon"),t(S,"class","freq-label svelte-j68xon"),t(Le,"class","freq-unit svelte-j68xon"),t(V,"class","freq-value svelte-j68xon"),t(C,"class","freq-item svelte-j68xon"),t(Ae,"class","freq-display svelte-j68xon"),t(We,"class","control-btn operate svelte-j68xon"),N(We,"active",e[8]===1),t(Re,"class","control-btn bypass svelte-j68xon"),N(Re,"active",e[9]),t(He,"class","controls svelte-j68xon"),t(Be,"class","tune-btn svelte-j68xon"),t(u,"class","metrics svelte-j68xon"),t(n,"class","card svelte-j68xon")},m(ce,he){ne(ce,n,he),l(n,s),l(s,o),l(s,r),l(s,i),l(i,f),l(f,c),l(i,m),l(i,d),l(n,w),l(n,u),l(u,_),l(_,y),l(y,M),l(M,g),l(M,h),l(M,p),l(p,b),l(p,A),l(y,U),l(y,D),l(D,z),l(z,P),l(P,se),l(_,me),l(_,Q),l(Q,x),l(x,$),l(Q,ie),l(Q,j),l(u,K),l(u,O),l(O,F),l(F,W),l(W,R),l(F,ve),l(F,Pe),l(O,be),l(O,fe),l(fe,ke),l(ke,Me),l(fe,ue),l(fe,Oe),l(O,ae),l(O,G),l(G,Ce),l(Ce,ge),l(G,De),l(G,je),l(u,Ee),l(u,Ae),l(Ae,X),l(X,J),l(X,re),l(X,Y),l(Y,le),l(Y,ee),l(Ae,q),l(Ae,C),l(C,S),l(C,H),l(C,V),l(V,lt),l(V,Le),l(u,Ve),l(u,He),l(He,We),l(We,Xe),l(He,Qe),l(He,Re),l(u,xe),l(u,Be),Ke||(Ue=[Te(We,"click",e[17]),Te(Re,"click",e[18]),Te(Be,"click",e[13])],Ke=!0)},p(ce,[he]){he&4096&&E(c,ce[12]),he&4096&&N(f,"tuning",ce[12]==="TUNING"),he&16&&N(d,"disconnected",!ce[4]),he&1&&T!==(T=ce[0].toFixed(0)+"")&&E(b,T),he&4&&Z(P,"width",ce[2]+"%"),he&2&&oe!==(oe=ce[1].toFixed(2)+"")&&E($,oe),he&8&&Z(Q,"--swr-color",ce[3]),he&128&&E(R,ce[7]),he&64&&E(Me,ce[6]),he&32&&E(ge,ce[5]),he&2048&&L!==(L=(ce[11]/1e3).toFixed(3)+"")&&E(le,L),he&1024&&Ie!==(Ie=(ce[10]/1e3).toFixed(3)+"")&&E(lt,Ie),he&256&&ze!==(ze=ce[8]===1?"OPERATE":"STANDBY")&&E(Xe,ze),he&256&&N(We,"active",ce[8]===1),he&512&&N(Re,"active",ce[9])},i:Se,o:Se,d(ce){ce&&te(n),Ke=!1,tt(Ue)}}}function en(e,n,s){let o,r,i,f,c,m,d,w,u,_,y,M,g,{status:h}=n;async function p(){try{await Fe.tuner.autoTune()}catch(D){console.error("Failed to tune:",D)}}async function T(D){try{await Fe.tuner.setBypass(D)}catch(z){console.error("Failed to set bypass:",z)}}async function b(D){try{await Fe.tuner.setOperate(D)}catch(z){console.error("Failed to set operate:",z)}}const A=()=>b(d===1?0:1),U=()=>T(m?0:1);return e.$$set=D=>{"status"in D&&s(16,h=D.status)},e.$$.update=()=>{e.$$.dirty&65536&&s(0,o=(h==null?void 0:h.power_forward)||0),e.$$.dirty&65536&&s(1,r=(h==null?void 0:h.swr)||1),e.$$.dirty&65536&&s(12,i=(h==null?void 0:h.tuning_status)||"READY"),e.$$.dirty&65536&&s(11,f=(h==null?void 0:h.frequency_a)||0),e.$$.dirty&65536&&s(10,c=(h==null?void 0:h.frequency_b)||0),e.$$.dirty&65536&&s(9,m=(h==null?void 0:h.bypass)||!1),e.$$.dirty&65536&&s(8,d=(h==null?void 0:h.state)||0),e.$$.dirty&65536&&s(7,w=(h==null?void 0:h.c1)||0),e.$$.dirty&65536&&s(6,u=(h==null?void 0:h.l)||0),e.$$.dirty&65536&&s(5,_=(h==null?void 0:h.c2)||0),e.$$.dirty&65536&&s(4,y=(h==null?void 0:h.connected)||!1),e.$$.dirty&2&&s(3,M=r<1.5?"#4caf50":r<2?"#ffc107":r<3?"#ff9800":"#f44336"),e.$$.dirty&1&&s(2,g=Math.min(o/2e3*100,100))},[o,r,g,M,y,_,u,w,d,m,c,f,i,p,T,b,h,A,U]}class tn extends pt{constructor(n){super(),ht(this,n,en,$l,rt,{status:16})}}function cl(e,n,s){const o=e.slice();o[14]=n[s];const r=o[1].tx&&o[1].tx_ant===o[14].number;o[15]=r;const i=o[0].tx&&o[0].tx_ant===o[14].number;o[16]=i;const f=!o[1].tx&&o[1].rx_ant===o[14].number;o[17]=f;const c=!o[0].tx&&o[0].rx_ant===o[14].number;o[18]=c;const m=o[15]||o[16];o[19]=m;const d=o[17]||o[15];o[20]=d;const w=o[18]||o[16];return o[21]=w,o}function dl(e){let n,s,o=e[14].name+"",r,i,f,c,m,d,w,u,_;function y(){return e[11](e[14])}function M(){return e[12](e[14])}return{c(){n=a("div"),s=a("div"),r=k(o),i=v(),f=a("div"),c=a("button"),c.textContent="A",m=v(),d=a("button"),d.textContent="B",w=v(),t(s,"class","antenna-name svelte-vlabwb"),t(c,"class","port-btn svelte-vlabwb"),N(c,"active",e[20]),t(d,"class","port-btn svelte-vlabwb"),N(d,"active",e[21]),t(f,"class","antenna-ports svelte-vlabwb"),t(n,"class","antenna-card svelte-vlabwb"),N(n,"tx",e[19]),N(n,"active-a",e[20]),N(n,"active-b",e[21])},m(g,h){ne(g,n,h),l(n,s),l(s,r),l(n,i),l(n,f),l(f,c),l(f,m),l(f,d),l(n,w),u||(_=[Te(c,"click",y),Te(d,"click",M)],u=!0)},p(g,h){e=g,h&16&&o!==(o=e[14].name+"")&&E(r,o),h&18&&N(c,"active",e[20]),h&17&&N(d,"active",e[21]),h&19&&N(n,"tx",e[19]),h&18&&N(n,"active-a",e[20]),h&17&&N(n,"active-b",e[21])},d(g){g&&te(n),u=!1,tt(_)}}}function ln(e){let n,s,o,r,i,f,c,m,d,w,u=(e[1].source||"FLEX")+"",_,y,M,g,h=(e[0].source||"FLEX")+"",p,T,b,A,U,D,z,P,se,me,Q,x,oe,$,ie,j,K=it(e[4]),O=[];for(let F=0;F<K.length;F+=1)O[F]=dl(cl(e,K,F));return{c(){n=a("div"),s=a("div"),o=a("h2"),o.textContent="Antenna Genius",r=v(),i=a("span"),f=v(),c=a("div"),m=a("div"),d=a("div"),w=a("div"),_=k(u),y=v(),M=a("div"),g=a("div"),p=k(h),T=v(),b=a("div"),A=a("div"),U=a("div"),D=k(e[3]),z=v(),P=a("div"),se=a("div"),me=k(e[2]),Q=v(),x=a("div");for(let F=0;F<O.length;F+=1)O[F].c();oe=v(),$=a("button"),$.innerHTML=`<span class="reboot-icon svelte-vlabwb">🔄</span>
|
|
REBOOT`,t(o,"class","svelte-vlabwb"),t(i,"class","status-dot svelte-vlabwb"),N(i,"disconnected",!e[5]),t(s,"class","card-header svelte-vlabwb"),t(w,"class","source-label svelte-vlabwb"),t(d,"class","source-item svelte-vlabwb"),t(g,"class","source-label svelte-vlabwb"),t(M,"class","source-item svelte-vlabwb"),t(m,"class","sources svelte-vlabwb"),t(U,"class","band-value svelte-vlabwb"),t(A,"class","band-item svelte-vlabwb"),t(se,"class","band-value svelte-vlabwb"),t(P,"class","band-item svelte-vlabwb"),t(b,"class","bands svelte-vlabwb"),t(x,"class","antennas svelte-vlabwb"),t($,"class","reboot-btn svelte-vlabwb"),t(c,"class","metrics svelte-vlabwb"),t(n,"class","card svelte-vlabwb")},m(F,W){ne(F,n,W),l(n,s),l(s,o),l(s,r),l(s,i),l(n,f),l(n,c),l(c,m),l(m,d),l(d,w),l(w,_),l(m,y),l(m,M),l(M,g),l(g,p),l(c,T),l(c,b),l(b,A),l(A,U),l(U,D),l(b,z),l(b,P),l(P,se),l(se,me),l(c,Q),l(c,x);for(let R=0;R<O.length;R+=1)O[R]&&O[R].m(x,null);l(c,oe),l(c,$),ie||(j=Te($,"click",e[7]),ie=!0)},p(F,[W]){if(W&32&&N(i,"disconnected",!F[5]),W&2&&u!==(u=(F[1].source||"FLEX")+"")&&E(_,u),W&1&&h!==(h=(F[0].source||"FLEX")+"")&&E(p,h),W&8&&E(D,F[3]),W&4&&E(me,F[2]),W&83){K=it(F[4]);let R;for(R=0;R<K.length;R+=1){const ve=cl(F,K,R);O[R]?O[R].p(ve,W):(O[R]=dl(ve),O[R].c(),O[R].m(x,null))}for(;R<O.length;R+=1)O[R].d(1);O.length=K.length}},i:Se,o:Se,d(F){F&&te(n),It(O,F),ie=!1,j()}}}function nn(e,n,s){let o,r,i,f,c,m,{status:d}=n;const w={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(p,T){try{p===1&&r.rx_ant===T||p===2&&i.rx_ant===T?(console.log(`Deselecting antenna ${T} from port ${p}`),await Fe.antenna.deselectAntenna(p,T)):(console.log(`Selecting antenna ${T} on port ${p}`),await Fe.antenna.selectAntenna(p,T))}catch(b){console.error("Failed to select/deselect antenna:",b)}}let _=!1,y=!1;async function M(){if(confirm("Are you sure you want to reboot the Antenna Genius?"))try{await Fe.antenna.reboot(),console.log("Antenna Genius reboot command sent")}catch(p){console.error("Failed to reboot:",p)}}const g=p=>u(1,p.number),h=p=>u(2,p.number);return e.$$set=p=>{"status"in p&&s(8,d=p.status)},e.$$.update=()=>{e.$$.dirty&256&&s(5,o=(d==null?void 0:d.connected)||!1),e.$$.dirty&256&&s(1,r=(d==null?void 0:d.port_a)||{}),e.$$.dirty&256&&s(0,i=(d==null?void 0:d.port_b)||{}),e.$$.dirty&256&&s(4,f=(d==null?void 0:d.antennas)||[]),e.$$.dirty&2&&s(3,c=w[r.band]||"None"),e.$$.dirty&1&&s(2,m=w[i.band]||"None"),e.$$.dirty&1795&&d&&(r.tx!==_||i.tx!==y)&&(console.log("AntennaGenius TX state changed:",{portA_tx:r.tx,portB_tx:i.tx,portA_tx_ant:r.tx_ant,portB_tx_ant:i.tx_ant}),s(9,_=r.tx),s(10,y=i.tx))},[i,r,m,c,f,o,u,M,d,_,y,g,h]}class sn extends pt{constructor(n){super(),ht(this,n,nn,ln,rt,{status:8})}}function fl(e,n,s){const o=e.slice();o[14]=n[s];const r=150+125*Math.sin(o[14]*Math.PI/180);o[15]=r;const i=150-125*Math.cos(o[14]*Math.PI/180);return o[16]=i,o}function ul(e){let n,s,o,r;return{c(){n=a("span"),s=k("→ "),o=k(e[0]),r=k("°"),t(n,"class","target-indicator svelte-1smey2p")},m(i,f){ne(i,n,f),l(n,s),l(n,o),l(n,r)},p(i,f){f&1&&E(o,i[0])},d(i){i&&te(n)}}}function vl(e){let n,s,o,r,i;return{c(){n=I("g"),s=I("line"),o=I("g"),r=I("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(r,"points","0,-8 -5,5 5,5"),t(r,"fill","rgba(255, 255, 255, 0.4)"),t(r,"stroke","rgba(255, 255, 255, 0.5)"),t(r,"stroke-width","1"),t(o,"transform","translate(0, -125)"),t(n,"transform",i="rotate("+e[3]+")")},m(f,c){ne(f,n,c),l(n,s),l(n,o),l(o,r)},p(f,c){c&8&&i!==(i="rotate("+f[3]+")")&&t(n,"transform",i)},d(f){f&&te(n)}}}function hl(e){let n,s,o,r,i;return{c(){n=I("path"),s=I("line"),o=I("line"),r=I("g"),i=I("polygon"),t(n,"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(n,"fill","url(#beamGradient)"),t(n,"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(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.9"),t(i,"points","0,-20 -8,5 0,0 8,5"),t(i,"fill","#4fc3f7"),t(i,"stroke","#0288d1"),t(i,"stroke-width","2"),Z(i,"filter","drop-shadow(0 0 10px rgba(79, 195, 247, 1))"),t(r,"transform","translate(0, -110)")},m(f,c){ne(f,n,c),ne(f,s,c),ne(f,o,c),ne(f,r,c),l(r,i)},p:Se,d(f){f&&(te(n),te(s),te(o),te(r))}}}function pl(e){let n,s,o,r,i;return{c(){n=I("path"),s=I("line"),o=I("line"),r=I("g"),i=I("polygon"),t(n,"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(n,"fill","url(#beamGradient)"),t(n,"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(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.9"),t(i,"points","0,20 -8,-5 0,0 8,-5"),t(i,"fill","#4fc3f7"),t(i,"stroke","#0288d1"),t(i,"stroke-width","2"),Z(i,"filter","drop-shadow(0 0 10px rgba(79, 195, 247, 1))"),t(r,"transform","translate(0, 110)")},m(f,c){ne(f,n,c),ne(f,s,c),ne(f,o,c),ne(f,r,c),l(r,i)},p:Se,d(f){f&&(te(n),te(s),te(o),te(r))}}}function ml(e){let n,s,o,r,i,f,c,m,d,w;return{c(){n=I("path"),s=I("path"),o=I("line"),r=I("line"),i=I("line"),f=I("line"),c=I("g"),m=I("polygon"),d=I("g"),w=I("polygon"),t(n,"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(n,"fill","url(#beamGradient)"),t(n,"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(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(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(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(m,"points","0,-20 -8,5 0,0 8,5"),t(m,"fill","#4fc3f7"),t(m,"stroke","#0288d1"),t(m,"stroke-width","2"),Z(m,"filter","drop-shadow(0 0 10px rgba(79, 195, 247, 1))"),t(c,"transform","translate(0, -110)"),t(w,"points","0,20 -8,-5 0,0 8,-5"),t(w,"fill","#4fc3f7"),t(w,"stroke","#0288d1"),t(w,"stroke-width","2"),Z(w,"filter","drop-shadow(0 0 10px rgba(79, 195, 247, 1))"),t(d,"transform","translate(0, 110)")},m(u,_){ne(u,n,_),ne(u,s,_),ne(u,o,_),ne(u,r,_),ne(u,i,_),ne(u,f,_),ne(u,c,_),l(c,m),ne(u,d,_),l(d,w)},p:Se,d(u){u&&(te(n),te(s),te(o),te(r),te(i),te(f),te(c),te(d))}}}function bl(e){let n,s,o,r,i,f;return{c(){n=I("g"),s=I("line"),o=I("g"),r=I("polygon"),i=I("animate"),t(s,"x1","0"),t(s,"y1","0"),t(s,"x2","0"),t(s,"y2","-120"),t(s,"stroke","#ffc107"),t(s,"stroke-width","3"),t(s,"stroke-dasharray","8,4"),t(s,"opacity","0.9"),t(i,"attributeName","opacity"),t(i,"values","0.8;1;0.8"),t(i,"dur","1s"),t(i,"repeatCount","indefinite"),t(r,"points","0,-15 -10,10 0,5 10,10"),t(r,"fill","#ffc107"),t(r,"stroke","#ff9800"),t(r,"stroke-width","2"),Z(r,"filter","drop-shadow(0 0 10px rgba(255, 193, 7, 0.8))"),t(o,"transform","translate(0, -120)"),t(n,"transform",f="rotate("+e[0]+")")},m(c,m){ne(c,n,m),l(n,s),l(n,o),l(o,r),l(r,i)},p(c,m){m&1&&f!==(f="rotate("+c[0]+")")&&t(n,"transform",f)},d(c){c&&te(n)}}}function gl(e){let n,s,o;return{c(){n=I("text"),s=k(e[14]),o=k("°"),t(n,"x",e[15]),t(n,"y",e[16]),t(n,"text-anchor","middle"),t(n,"dominant-baseline","middle"),t(n,"class","degree-label svelte-1smey2p")},m(r,i){ne(r,n,i),l(n,s),l(n,o)},p:Se,d(r){r&&te(n)}}}function wl(e){let n;return{c(){n=a("div"),n.innerHTML='<div class="legend-item svelte-1smey2p"><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-1smey2p"><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(n,"class","map-legend svelte-1smey2p")},m(s,o){ne(s,n,o)},d(s){s&&te(n)}}}function on(e){let n,s,o,r,i,f,c,m,d,w,u,_,y,M,g,h,p,T,b,A,U,D,z,P,se,me,Q,x,oe,$,ie,j,K,O,F,W,R,ve,Pe,be,fe,ke,Me,ue,Oe,ae,G,Ce,ge,De,je,Ee,Ae,X=e[1]&&ul(e),J=(e[4]===1||e[4]===2)&&vl(e),re=e[4]===0&&hl(),Y=e[4]===1&&pl(),L=e[4]===2&&ml(),le=e[1]&&bl(e),ee=it([45,135,225,315]),q=[];for(let S=0;S<4;S+=1)q[S]=gl(fl(e,ee,S));let C=(e[4]===1||e[4]===2)&&wl();return{c(){n=a("div"),s=a("div"),o=a("h2"),o.textContent="Rotator Genius",r=v(),i=a("span"),f=v(),c=a("div"),m=a("div"),d=a("div"),w=a("div"),w.textContent="CURRENT HEADING",u=v(),_=a("div"),y=k(e[3]),M=k(`°\r
|
|
`),X&&X.c(),g=v(),h=a("div"),p=a("button"),p.textContent="↺",T=v(),b=a("button"),b.textContent="■",A=v(),U=a("button"),U.textContent="↻",D=v(),z=a("div"),P=I("svg"),se=I("defs"),me=I("radialGradient"),Q=I("stop"),x=I("stop"),oe=I("circle"),$=I("circle"),ie=I("circle"),j=I("circle"),K=I("g"),J&&J.c(),O=I("g"),re&&re.c(),F=nl(),Y&&Y.c(),W=nl(),L&&L.c(),le&&le.c(),ve=I("circle"),Pe=I("animate"),be=I("circle"),fe=I("animate"),ke=I("animate"),Me=I("text"),ue=k("N"),Oe=I("text"),ae=k("E"),G=I("text"),Ce=k("S"),ge=I("text"),De=k("W");for(let S=0;S<4;S+=1)q[S].c();je=v(),C&&C.c(),t(o,"class","svelte-1smey2p"),t(i,"class","status-dot svelte-1smey2p"),N(i,"disconnected",!e[2]),t(s,"class","card-header svelte-1smey2p"),t(w,"class","heading-label svelte-1smey2p"),t(_,"class","heading-value svelte-1smey2p"),t(d,"class","heading-display-compact svelte-1smey2p"),t(p,"class","btn-mini ccw svelte-1smey2p"),t(p,"title","Rotate Counter-Clockwise"),t(b,"class","btn-mini stop svelte-1smey2p"),t(b,"title","Stop Rotation"),t(U,"class","btn-mini cw svelte-1smey2p"),t(U,"title","Rotate Clockwise"),t(h,"class","controls-compact svelte-1smey2p"),t(m,"class","heading-controls-row svelte-1smey2p"),t(Q,"offset","0%"),Z(Q,"stop-color","rgba(79, 195, 247, 0.7)"),Z(Q,"stop-opacity","1"),t(x,"offset","100%"),Z(x,"stop-color","rgba(79, 195, 247, 0)"),Z(x,"stop-opacity","0"),t(me,"id","beamGradient"),t(oe,"cx","150"),t(oe,"cy","150"),t(oe,"r","140"),t(oe,"fill","rgba(30, 64, 175, 0.15)"),t(oe,"stroke","rgba(79, 195, 247, 0.4)"),t(oe,"stroke-width","2"),t($,"cx","150"),t($,"cy","150"),t($,"r","105"),t($,"fill","none"),t($,"stroke","rgba(79,195,247,0.2)"),t($,"stroke-width","1"),t($,"stroke-dasharray","3,3"),t(ie,"cx","150"),t(ie,"cy","150"),t(ie,"r","70"),t(ie,"fill","none"),t(ie,"stroke","rgba(79,195,247,0.2)"),t(ie,"stroke-width","1"),t(ie,"stroke-dasharray","3,3"),t(j,"cx","150"),t(j,"cy","150"),t(j,"r","35"),t(j,"fill","none"),t(j,"stroke","rgba(79,195,247,0.2)"),t(j,"stroke-width","1"),t(j,"stroke-dasharray","3,3"),t(O,"transform",R="rotate("+e[3]+")"),t(Pe,"attributeName","r"),t(Pe,"values","5;7;5"),t(Pe,"dur","2s"),t(Pe,"repeatCount","indefinite"),t(ve,"cx","0"),t(ve,"cy","0"),t(ve,"r","5"),t(ve,"fill","#f44336"),t(ve,"stroke","#fff"),t(ve,"stroke-width","2"),t(fe,"attributeName","r"),t(fe,"values","10;16;10"),t(fe,"dur","2s"),t(fe,"repeatCount","indefinite"),t(ke,"attributeName","opacity"),t(ke,"values","0.5;0;0.5"),t(ke,"dur","2s"),t(ke,"repeatCount","indefinite"),t(be,"cx","0"),t(be,"cy","0"),t(be,"r","10"),t(be,"fill","none"),t(be,"stroke","#f44336"),t(be,"stroke-width","1.5"),t(be,"opacity","0.5"),t(K,"transform","translate(150, 150)"),t(Me,"x","150"),t(Me,"y","20"),t(Me,"text-anchor","middle"),t(Me,"class","cardinal svelte-1smey2p"),t(Oe,"x","280"),t(Oe,"y","155"),t(Oe,"text-anchor","middle"),t(Oe,"class","cardinal svelte-1smey2p"),t(G,"x","150"),t(G,"y","285"),t(G,"text-anchor","middle"),t(G,"class","cardinal svelte-1smey2p"),t(ge,"x","20"),t(ge,"y","155"),t(ge,"text-anchor","middle"),t(ge,"class","cardinal svelte-1smey2p"),t(P,"viewBox","0 0 300 300"),t(P,"class","map-svg clickable-compass svelte-1smey2p"),t(P,"role","button"),t(P,"tabindex","0"),t(P,"aria-label","Click to rotate antenna to direction"),t(z,"class","map-container svelte-1smey2p"),t(c,"class","metrics svelte-1smey2p"),t(n,"class","card svelte-1smey2p")},m(S,H){ne(S,n,H),l(n,s),l(s,o),l(s,r),l(s,i),l(n,f),l(n,c),l(c,m),l(m,d),l(d,w),l(d,u),l(d,_),l(_,y),l(_,M),X&&X.m(_,null),l(m,g),l(m,h),l(h,p),l(h,T),l(h,b),l(h,A),l(h,U),l(c,D),l(c,z),l(z,P),l(P,se),l(se,me),l(me,Q),l(me,x),l(P,oe),l(P,$),l(P,ie),l(P,j),l(P,K),J&&J.m(K,null),l(K,O),re&&re.m(O,null),l(O,F),Y&&Y.m(O,null),l(O,W),L&&L.m(O,null),le&&le.m(K,null),l(K,ve),l(ve,Pe),l(K,be),l(be,fe),l(be,ke),l(P,Me),l(Me,ue),l(P,Oe),l(Oe,ae),l(P,G),l(G,Ce),l(P,ge),l(ge,De);for(let V=0;V<4;V+=1)q[V]&&q[V].m(P,null);l(c,je),C&&C.m(c,null),Ee||(Ae=[Te(p,"click",e[6]),Te(b,"click",e[7]),Te(U,"click",e[5]),Te(P,"click",e[8]),Te(P,"keydown",e[12])],Ee=!0)},p(S,[H]){if(H&4&&N(i,"disconnected",!S[2]),H&8&&E(y,S[3]),S[1]?X?X.p(S,H):(X=ul(S),X.c(),X.m(_,null)):X&&(X.d(1),X=null),S[4]===1||S[4]===2?J?J.p(S,H):(J=vl(S),J.c(),J.m(K,O)):J&&(J.d(1),J=null),S[4]===0?re?re.p(S,H):(re=hl(),re.c(),re.m(O,F)):re&&(re.d(1),re=null),S[4]===1?Y?Y.p(S,H):(Y=pl(),Y.c(),Y.m(O,W)):Y&&(Y.d(1),Y=null),S[4]===2?L?L.p(S,H):(L=ml(),L.c(),L.m(O,null)):L&&(L.d(1),L=null),H&8&&R!==(R="rotate("+S[3]+")")&&t(O,"transform",R),S[1]?le?le.p(S,H):(le=bl(S),le.c(),le.m(K,ve)):le&&(le.d(1),le=null),H&0){ee=it([45,135,225,315]);let V;for(V=0;V<4;V+=1){const Ie=fl(S,ee,V);q[V]?q[V].p(Ie,H):(q[V]=gl(Ie),q[V].c(),q[V].m(P,null))}for(;V<4;V+=1)q[V].d(1)}S[4]===1||S[4]===2?C||(C=wl(),C.c(),C.m(c,null)):C&&(C.d(1),C=null)},i:Se,o:Se,d(S){S&&te(n),X&&X.d(),J&&J.d(),re&&re.d(),Y&&Y.d(),L&&L.d(),le&&le.d(),It(q,S),C&&C.d(),Ee=!1,tt(Ae)}}}function an(e,n,s){let o,r,{status:i}=n,{ultrabeam:f=null}=n,c=null,m=!1,d=0,w=!1;async function u(){if(!(d<0||d>359))try{s(1,w=!0);const p=(d-10+360)%360;await Fe.rotator.setHeading(p)}catch(p){console.error("Failed to set heading:",p),s(1,w=!1)}}async function _(){try{await Fe.rotator.rotateCW()}catch(p){console.error("Failed to rotate CW:",p)}}async function y(){try{await Fe.rotator.rotateCCW()}catch(p){console.error("Failed to rotate CCW:",p)}}async function M(){try{await Fe.rotator.stop()}catch(p){console.error("Failed to stop:",p)}}function g(p){const b=p.currentTarget.getBoundingClientRect(),A=b.width/2,U=b.height/2,D=p.clientX-b.left-A,z=p.clientY-b.top-U;let P=Math.atan2(D,-z)*(180/Math.PI);P<0&&(P+=360);const se=Math.round(P/5)*5;s(0,d=se),u()}const h=p=>p.key==="Enter"&&g(p);return e.$$set=p=>{"status"in p&&s(9,i=p.status),"ultrabeam"in p&&s(10,f=p.ultrabeam)},e.$$.update=()=>{if(e.$$.dirty&1024&&s(4,o=(f==null?void 0:f.direction)??0),e.$$.dirty&2560&&(i==null?void 0:i.heading)!==void 0&&(i==null?void 0:i.heading)!==null){const p=i.heading;console.log(`RotatorGenius heading update: ${c} -> ${p}`),c===null?(s(11,c=p),console.log(` ✓ First load, set to ${c}°`)):p===0&&c>10&&c<350?console.log(` ✗ IGNORED glitch jump from ${c}° to 0°`):(s(11,c=p),console.log(` ✓ Updated to ${c}°`))}if(e.$$.dirty&2048&&s(3,r=c!==null?c:0),e.$$.dirty&512&&s(2,m=(i==null?void 0:i.connected)||!1),e.$$.dirty&2051&&w&&c!==null){const p=Math.abs(c-d);Math.min(p,360-p)<5&&s(1,w=!1)}},[d,w,m,r,o,_,y,M,g,i,f,c,h]}class rn extends pt{constructor(n){super(),ht(this,n,an,on,rt,{status:9,ultrabeam:10})}}function _l(e,n,s){const o=e.slice();return o[35]=n[s],o}function yl(e){let n,s=e[3]==="READY"?"🔓 TX OK":e[3]==="NOT_READY"?"🔒 TX Block":e[3]==="PTT_REQUESTED"?"⏳ PTT":e[3]==="TRANSMITTING"?"📡 TX":"❓",o;return{c(){n=a("div"),o=k(s),t(n,"class","interlock-badge svelte-5zw21e"),Z(n,"border-color",e[9]),Z(n,"color",e[9])},m(r,i){ne(r,n,i),l(n,o)},p(r,i){i[0]&8&&s!==(s=r[3]==="READY"?"🔓 TX OK":r[3]==="NOT_READY"?"🔒 TX Block":r[3]==="PTT_REQUESTED"?"⏳ PTT":r[3]==="TRANSMITTING"?"📡 TX":"❓")&&E(o,s),i[0]&512&&Z(n,"border-color",r[9]),i[0]&512&&Z(n,"color",r[9])},d(r){r&&te(n)}}}function kl(e){let n,s=e[35].label+"",o;return{c(){n=a("option"),o=k(s),n.__value=e[35].value,Pt(n,n.__value)},m(r,i){ne(r,n,i),l(n,o)},p:Se,d(r){r&&te(n)}}}function Ml(e){let n,s,o,r,i,f,c,m,d,w=e[7].toFixed(0)+"",u,_;return{c(){n=a("div"),s=a("h3"),s.textContent="Motors Moving...",o=v(),r=a("div"),i=a("div"),f=v(),c=a("div"),m=k(e[0]),d=k(" / 60 ("),u=k(w),_=k("%)"),t(s,"class","svelte-5zw21e"),t(i,"class","progress-fill svelte-5zw21e"),Z(i,"width",e[7]+"%"),t(r,"class","progress-bar svelte-5zw21e"),t(c,"class","progress-text svelte-5zw21e"),t(n,"class","progress-section svelte-5zw21e")},m(y,M){ne(y,n,M),l(n,s),l(n,o),l(n,r),l(r,i),l(n,f),l(n,c),l(c,m),l(c,d),l(c,u),l(c,_)},p(y,M){M[0]&128&&Z(i,"width",y[7]+"%"),M[0]&1&&E(m,y[0]),M[0]&128&&w!==(w=y[7].toFixed(0)+"")&&E(u,w)},d(y){y&&te(n)}}}function cn(e){let n,s,o,r,i,f,c,m,d,w,u,_,y,M,g=(e[1]/1e3).toFixed(3)+"",h,p,T,b,A,U,D,z,P,se,me,Q,x,oe=e[13][e[2]]+"",$,ie,j,K,O,F,W,R,ve,Pe,be,fe,ke,Me,ue,Oe,ae,G,Ce,ge,De,je,Ee,Ae,X,J,re,Y,L=e[10]&&e[3]&&yl(e),le=it(e[14]),ee=[];for(let C=0;C<le.length;C+=1)ee[C]=kl(_l(e,le,C));let q=e[11]>0&&Ml(e);return{c(){n=a("div"),s=a("div"),o=a("h2"),o.textContent="Ultrabeam VL2.3",r=v(),i=a("div"),L&&L.c(),f=v(),c=a("span"),m=v(),d=a("div"),w=a("div"),u=a("div"),_=a("div"),_.textContent="Frequency",y=v(),M=a("div"),h=k(g),p=k(" MHz"),T=v(),b=a("div"),A=a("div"),A.textContent="Band",U=v(),D=a("div"),z=k(e[8]),P=v(),se=a("div"),me=a("div"),me.textContent="Direction",Q=v(),x=a("div"),$=k(oe),ie=v(),j=a("div"),K=a("h3"),K.textContent="Auto Tracking",O=v(),F=a("div"),W=a("label"),R=a("input"),ve=v(),Pe=a("span"),Pe.textContent="Enable Auto-Track from Tuner",be=v(),fe=a("div"),ke=a("label"),ke.textContent="Threshold:",Me=v(),ue=a("select");for(let C=0;C<ee.length;C+=1)ee[C].c();Oe=v(),ae=a("div"),G=a("button"),G.textContent="Normal",Ce=v(),ge=a("button"),ge.textContent="180°",De=v(),je=a("button"),je.textContent="Bi-Dir",Ee=v(),q&&q.c(),Ae=v(),X=a("div"),J=a("button"),J.innerHTML=`<span class="icon">↓</span>
|
|
Retract Elements`,t(o,"class","svelte-5zw21e"),t(c,"class","status-dot svelte-5zw21e"),N(c,"disconnected",!e[12]),t(i,"class","header-right svelte-5zw21e"),t(s,"class","card-header svelte-5zw21e"),t(_,"class","status-label svelte-5zw21e"),t(M,"class","status-value freq svelte-5zw21e"),t(u,"class","status-item svelte-5zw21e"),t(A,"class","status-label svelte-5zw21e"),t(D,"class","status-value band svelte-5zw21e"),t(b,"class","status-item svelte-5zw21e"),t(me,"class","status-label svelte-5zw21e"),t(x,"class","status-value direction svelte-5zw21e"),t(se,"class","status-item svelte-5zw21e"),t(w,"class","status-grid svelte-5zw21e"),t(K,"class","svelte-5zw21e"),t(R,"type","checkbox"),t(R,"class","svelte-5zw21e"),t(W,"class","toggle-label svelte-5zw21e"),t(ke,"for","threshold-select"),t(ke,"class","svelte-5zw21e"),t(ue,"id","threshold-select"),e[5]===void 0&&At(()=>e[23].call(ue)),t(fe,"class","threshold-group svelte-5zw21e"),t(F,"class","auto-track-controls svelte-5zw21e"),t(G,"class","dir-btn svelte-5zw21e"),N(G,"active",e[6]===0),t(ge,"class","dir-btn svelte-5zw21e"),N(ge,"active",e[6]===1),t(je,"class","dir-btn svelte-5zw21e"),N(je,"active",e[6]===2),t(ae,"class","direction-buttons svelte-5zw21e"),t(j,"class","control-section compact svelte-5zw21e"),t(J,"class","btn-danger"),t(X,"class","actions svelte-5zw21e"),t(d,"class","metrics svelte-5zw21e"),t(n,"class","card svelte-5zw21e")},m(C,S){ne(C,n,S),l(n,s),l(s,o),l(s,r),l(s,i),L&&L.m(i,null),l(i,f),l(i,c),l(n,m),l(n,d),l(d,w),l(w,u),l(u,_),l(u,y),l(u,M),l(M,h),l(M,p),l(w,T),l(w,b),l(b,A),l(b,U),l(b,D),l(D,z),l(w,P),l(w,se),l(se,me),l(se,Q),l(se,x),l(x,$),l(d,ie),l(d,j),l(j,K),l(j,O),l(j,F),l(F,W),l(W,R),R.checked=e[4],l(W,ve),l(W,Pe),l(F,be),l(F,fe),l(fe,ke),l(fe,Me),l(fe,ue);for(let H=0;H<ee.length;H+=1)ee[H]&&ee[H].m(ue,null);Ft(ue,e[5],!0),l(j,Oe),l(j,ae),l(ae,G),l(ae,Ce),l(ae,ge),l(ae,De),l(ae,je),l(d,Ee),q&&q.m(d,null),l(d,Ae),l(d,X),l(X,J),re||(Y=[Te(R,"change",e[22]),Te(R,"change",e[16]),Te(ue,"change",e[23]),Te(ue,"change",e[16]),Te(G,"click",e[24]),Te(ge,"click",e[25]),Te(je,"click",e[26]),Te(J,"click",e[17])],re=!0)},p(C,S){if(C[10]&&C[3]?L?L.p(C,S):(L=yl(C),L.c(),L.m(i,f)):L&&(L.d(1),L=null),S[0]&4096&&N(c,"disconnected",!C[12]),S[0]&2&&g!==(g=(C[1]/1e3).toFixed(3)+"")&&E(h,g),S[0]&256&&E(z,C[8]),S[0]&4&&oe!==(oe=C[13][C[2]]+"")&&E($,oe),S[0]&16&&(R.checked=C[4]),S[0]&16384){le=it(C[14]);let H;for(H=0;H<le.length;H+=1){const V=_l(C,le,H);ee[H]?ee[H].p(V,S):(ee[H]=kl(V),ee[H].c(),ee[H].m(ue,null))}for(;H<ee.length;H+=1)ee[H].d(1);ee.length=le.length}S[0]&16416&&Ft(ue,C[5]),S[0]&64&&N(G,"active",C[6]===0),S[0]&64&&N(ge,"active",C[6]===1),S[0]&64&&N(je,"active",C[6]===2),C[11]>0?q?q.p(C,S):(q=Ml(C),q.c(),q.m(d,Ae)):q&&(q.d(1),q=null)},i:Se,o:Se,d(C){C&&te(n),L&&L.d(),It(ee,C),q&&q.d(),re=!1,tt(Y)}}}function dn(e){switch(e){case"READY":return"#4caf50";case"NOT_READY":return"#f44336";case"PTT_REQUESTED":return"#ffc107";case"TRANSMITTING":return"#ff9800";default:return"rgba(255, 255, 255, 0.3)"}}function fn(e,n,s){let o,r,i,f,c,m,d,w,u,_,y,M,{status:g}=n,{flexradio:h=null}=n;const p=["6M","10M","12M","15M","17M","20M","30M","40M"];function T(j,K){return K>=0&&K<=7?p[K]:j>=7e3&&j<=7300?"40M":j>=10100&&j<=10150?"30M":j>=14e3&&j<=14350?"20M":j>=18068&&j<=18168?"17M":j>=21e3&&j<=21450?"15M":j>=24890&&j<=24990?"12M":j>=28e3&&j<=29700?"10M":j>=5e4&&j<=54e3?"6M":"Unknown"}const b=["Normal","180°","Bi-Dir"],A=[{value:25,label:"25 kHz"},{value:50,label:"50 kHz"},{value:100,label:"100 kHz"}];let U=!0,D=25,z=0;async function P(){if(r!==0)try{await Fe.ultrabeam.setFrequency(r,z),await Fe.ultrabeam.setDirection(z)}catch(j){console.log("Direction change sent (may show code 30 if busy):",j)}}async function se(){try{await Fe.ultrabeam.setAutoTrack(U,D)}catch(j){console.error("Failed to update auto-track:",j)}}async function me(){if(confirm("Retract all antenna elements?"))try{await Fe.ultrabeam.retract()}catch(j){console.error("Failed to retract:",j)}}function Q(){U=this.checked,s(4,U)}function x(){D=Nl(this),s(5,D),s(14,A)}const oe=()=>{s(6,z=0),P()},$=()=>{s(6,z=1),P()},ie=()=>{s(6,z=2),P()};return e.$$set=j=>{"status"in j&&s(18,g=j.status),"flexradio"in j&&s(19,h=j.flexradio)},e.$$.update=()=>{e.$$.dirty[0]&262144&&s(12,o=(g==null?void 0:g.connected)||!1),e.$$.dirty[0]&262144&&s(1,r=(g==null?void 0:g.frequency)||0),e.$$.dirty[0]&262144&&s(21,i=(g==null?void 0:g.band)||0),e.$$.dirty[0]&262144&&s(2,f=(g==null?void 0:g.direction)||0),e.$$.dirty[0]&262144&&s(11,c=(g==null?void 0:g.motors_moving)||0),e.$$.dirty[0]&262144&&s(20,m=(g==null?void 0:g.progress_total)||0),e.$$.dirty[0]&262144&&s(0,d=(g==null?void 0:g.progress_current)||0),e.$$.dirty[0]&262144&&g!=null&&g.element_lengths,e.$$.dirty[0]&262144&&g&&`${g.firmware_major}${g.firmware_minor}`,e.$$.dirty[0]&524288&&s(10,w=(h==null?void 0:h.connected)||!1),e.$$.dirty[0]&524288&&s(3,u=(h==null?void 0:h.interlock_state)||null),e.$$.dirty[0]&8&&s(9,_=dn(u)),e.$$.dirty[0]&2097154&&s(8,y=T(r,i)),e.$$.dirty[0]&4&&s(6,z=f),e.$$.dirty[0]&2097152,e.$$.dirty[0]&1048577&&s(7,M=m>0?d/60*100:0)},[d,r,f,u,U,D,z,M,y,_,w,c,o,b,A,P,se,me,g,h,m,i,Q,x,oe,$,ie]}class un extends pt{constructor(n){super(),ht(this,n,fn,cn,rt,{status:18,flexradio:19},null,[-1,-1])}}function vn(e){var ot,at,mt,St,de,pe,Ht,Wt,Xt;let n,s,o,r,i,f,c,m,d,w,u=e[1]?"Connected":"Disconnected",_,y,M,g,h,p,T,b=e[5].sfi+"",A,U,D,z,P,se=e[5].sunspots+"",me,Q,x,oe,$,ie=e[5].a_index+"",j,K,O,F,W,R=e[5].k_index+"",ve,Pe,be,fe,ke,Me=e[5].geomag+"",ue,Oe,ae,G,Ce,ge,De=e[4].wind_speed.toFixed(1)+"",je,Ee,Ae,X,J,re=e[4].wind_gust.toFixed(1)+"",Y,L,le,ee,q,C=e[4].temp.toFixed(1)+"",S,H,V,Ie,lt,Le=e[4].feels_like.toFixed(1)+"",Ve,He,We,ze,Xe,Qe=Tl(e[2])+"",Re,xe,Be,Ke=e[2].toLocaleDateString()+"",Ue,ce,he,nt,qe,Ze,Mt,Ge,ct,$e,dt,Ye,et,st,Je,Tt,Ne,we;return Ze=new Kl({props:{status:(ot=e[0])==null?void 0:ot.webswitch}}),Ge=new xl({props:{status:(at=e[0])==null?void 0:at.power_genius}}),$e=new tn({props:{status:(mt=e[0])==null?void 0:mt.tuner_genius,flexradio:(St=e[0])==null?void 0:St.flexradio}}),et=new sn({props:{status:(de=e[0])==null?void 0:de.antenna_genius}}),Je=new un({props:{status:(pe=e[0])==null?void 0:pe.ultrabeam,flexradio:(Ht=e[0])==null?void 0:Ht.flexradio}}),Ne=new rn({props:{status:(Wt=e[0])==null?void 0:Wt.rotator_genius,ultrabeam:(Xt=e[0])==null?void 0:Xt.ultrabeam}}),{c(){n=a("div"),s=a("header"),o=a("div"),r=a("h1"),i=k(e[3]),f=k(" Shack"),c=v(),m=a("div"),d=a("span"),w=v(),_=k(u),y=v(),M=a("div"),g=a("div"),h=a("span"),p=k("SFI "),T=a("span"),A=k(b),U=v(),D=a("span"),z=k("Spots "),P=a("span"),me=k(se),Q=v(),x=a("span"),oe=k("A "),$=a("span"),j=k(ie),K=v(),O=a("span"),F=k("K "),W=a("span"),ve=k(R),Pe=v(),be=a("span"),fe=k("G "),ke=a("span"),ue=k(Me),Oe=v(),ae=a("div"),G=a("div"),Ce=a("span"),ge=k("🌬️ "),je=k(De),Ee=k("m/s"),Ae=v(),X=a("span"),J=k("💨 "),Y=k(re),L=k("m/s"),le=v(),ee=a("span"),q=k("🌡️ "),S=k(C),H=k("°C"),V=v(),Ie=a("span"),lt=k("→ "),Ve=k(Le),He=k("°C"),We=v(),ze=a("div"),Xe=a("span"),Re=k(Qe),xe=v(),Be=a("span"),Ue=k(Ke),ce=v(),he=a("main"),nt=a("div"),qe=a("div"),wt(Ze.$$.fragment),Mt=v(),wt(Ge.$$.fragment),ct=v(),wt($e.$$.fragment),dt=v(),Ye=a("div"),wt(et.$$.fragment),st=v(),wt(Je.$$.fragment),Tt=v(),wt(Ne.$$.fragment),t(r,"class","svelte-18f70jl"),t(d,"class","status-indicator"),N(d,"status-online",e[1]),N(d,"status-offline",!e[1]),t(m,"class","connection-status svelte-18f70jl"),t(o,"class","header-left svelte-18f70jl"),t(T,"class","value svelte-18f70jl"),t(h,"class","solar-item svelte-18f70jl"),t(P,"class","value svelte-18f70jl"),t(D,"class","solar-item svelte-18f70jl"),t($,"class","value svelte-18f70jl"),t(x,"class","solar-item svelte-18f70jl"),t(W,"class","value svelte-18f70jl"),t(O,"class","solar-item svelte-18f70jl"),t(ke,"class","value svelte-18f70jl"),t(be,"class","solar-item svelte-18f70jl"),t(g,"class","solar-info svelte-18f70jl"),t(M,"class","header-center svelte-18f70jl"),t(Ce,"title","Wind"),t(X,"title","Gust"),t(ee,"title","Temperature"),t(Ie,"title","Feels like"),t(G,"class","weather-info svelte-18f70jl"),t(Xe,"class","time svelte-18f70jl"),t(Be,"class","date svelte-18f70jl"),t(ze,"class","clock svelte-18f70jl"),t(ae,"class","header-right svelte-18f70jl"),t(s,"class","svelte-18f70jl"),t(qe,"class","row svelte-18f70jl"),t(Ye,"class","row svelte-18f70jl"),t(nt,"class","dashboard-grid svelte-18f70jl"),t(he,"class","svelte-18f70jl"),t(n,"class","app svelte-18f70jl")},m(B,_e){ne(B,n,_e),l(n,s),l(s,o),l(o,r),l(r,i),l(r,f),l(o,c),l(o,m),l(m,d),l(m,w),l(m,_),l(s,y),l(s,M),l(M,g),l(g,h),l(h,p),l(h,T),l(T,A),l(g,U),l(g,D),l(D,z),l(D,P),l(P,me),l(g,Q),l(g,x),l(x,oe),l(x,$),l($,j),l(g,K),l(g,O),l(O,F),l(O,W),l(W,ve),l(g,Pe),l(g,be),l(be,fe),l(be,ke),l(ke,ue),l(s,Oe),l(s,ae),l(ae,G),l(G,Ce),l(Ce,ge),l(Ce,je),l(Ce,Ee),l(G,Ae),l(G,X),l(X,J),l(X,Y),l(X,L),l(G,le),l(G,ee),l(ee,q),l(ee,S),l(ee,H),l(G,V),l(G,Ie),l(Ie,lt),l(Ie,Ve),l(Ie,He),l(ae,We),l(ae,ze),l(ze,Xe),l(Xe,Re),l(ze,xe),l(ze,Be),l(Be,Ue),l(n,ce),l(n,he),l(he,nt),l(nt,qe),ut(Ze,qe,null),l(qe,Mt),ut(Ge,qe,null),l(qe,ct),ut($e,qe,null),l(nt,dt),l(nt,Ye),ut(et,Ye,null),l(Ye,st),ut(Je,Ye,null),l(Ye,Tt),ut(Ne,Ye,null),we=!0},p(B,[_e]){var Yt,Vt,Kt,Zt,Qt,xt,$t,el,tl;(!we||_e&8)&&E(i,B[3]),(!we||_e&2)&&N(d,"status-online",B[1]),(!we||_e&2)&&N(d,"status-offline",!B[1]),(!we||_e&2)&&u!==(u=B[1]?"Connected":"Disconnected")&&E(_,u),(!we||_e&32)&&b!==(b=B[5].sfi+"")&&E(A,b),(!we||_e&32)&&se!==(se=B[5].sunspots+"")&&E(me,se),(!we||_e&32)&&ie!==(ie=B[5].a_index+"")&&E(j,ie),(!we||_e&32)&&R!==(R=B[5].k_index+"")&&E(ve,R),(!we||_e&32)&&Me!==(Me=B[5].geomag+"")&&E(ue,Me),(!we||_e&16)&&De!==(De=B[4].wind_speed.toFixed(1)+"")&&E(je,De),(!we||_e&16)&&re!==(re=B[4].wind_gust.toFixed(1)+"")&&E(Y,re),(!we||_e&16)&&C!==(C=B[4].temp.toFixed(1)+"")&&E(S,C),(!we||_e&16)&&Le!==(Le=B[4].feels_like.toFixed(1)+"")&&E(Ve,Le),(!we||_e&4)&&Qe!==(Qe=Tl(B[2])+"")&&E(Re,Qe),(!we||_e&4)&&Ke!==(Ke=B[2].toLocaleDateString()+"")&&E(Ue,Ke);const Ut={};_e&1&&(Ut.status=(Yt=B[0])==null?void 0:Yt.webswitch),Ze.$set(Ut);const qt={};_e&1&&(qt.status=(Vt=B[0])==null?void 0:Vt.power_genius),Ge.$set(qt);const zt={};_e&1&&(zt.status=(Kt=B[0])==null?void 0:Kt.tuner_genius),_e&1&&(zt.flexradio=(Zt=B[0])==null?void 0:Zt.flexradio),$e.$set(zt);const Jt={};_e&1&&(Jt.status=(Qt=B[0])==null?void 0:Qt.antenna_genius),et.$set(Jt);const Nt={};_e&1&&(Nt.status=(xt=B[0])==null?void 0:xt.ultrabeam),_e&1&&(Nt.flexradio=($t=B[0])==null?void 0:$t.flexradio),Je.$set(Nt);const Et={};_e&1&&(Et.status=(el=B[0])==null?void 0:el.rotator_genius),_e&1&&(Et.ultrabeam=(tl=B[0])==null?void 0:tl.ultrabeam),Ne.$set(Et)},i(B){we||(ft(Ze.$$.fragment,B),ft(Ge.$$.fragment,B),ft($e.$$.fragment,B),ft(et.$$.fragment,B),ft(Je.$$.fragment,B),ft(Ne.$$.fragment,B),we=!0)},o(B){gt(Ze.$$.fragment,B),gt(Ge.$$.fragment,B),gt($e.$$.fragment,B),gt(et.$$.fragment,B),gt(Je.$$.fragment,B),gt(Ne.$$.fragment,B),we=!1},d(B){B&&te(n),vt(Ze),vt(Ge),vt($e),vt(et),vt(Je),vt(Ne)}}}function Tl(e){return e.toTimeString().slice(0,8)}function hn(e,n,s){let o,r,i=null,f=!1,c=new Date,m="F4BPO";const d=Ol.subscribe(u=>{s(0,i=u)}),w=Bt.subscribe(u=>{s(1,f=u)});return El(async()=>{al.connect();try{const _=await Fe.getConfig();_.callsign&&s(3,m=_.callsign)}catch(_){console.error("Failed to fetch config:",_)}const u=setInterval(()=>{s(2,c=new Date)},1e3);return()=>{clearInterval(u)}}),Dl(()=>{al.disconnect(),d(),w()}),e.$$.update=()=>{e.$$.dirty&1&&s(5,o=(i==null?void 0:i.solar)||{sfi:0,sunspots:0,a_index:0,k_index:0,geomag:"Unknown"}),e.$$.dirty&1&&s(4,r=(i==null?void 0:i.weather)||{wind_speed:0,wind_gust:0,temp:0,feels_like:0})},[i,f,c,m,r,o]}class pn extends pt{constructor(n){super(),ht(this,n,hn,vn,rt,{})}}new pn({target:document.getElementById("app")});
|