k5web/assets/index.5ed4969d.js

2 lines
13 KiB
JavaScript
Raw Normal View History

2024-02-18 12:10:21 +00:00
import{S as mt}from"./index.c93dfeeb.js";import{e as ft,q as _t,_ as gt}from"./index.0402bd15.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{d as wt,r as bt,o as Ft,bp as yt,bY as xt,bU as ht,aU as St,bB as Ct,bN as Dt,bC as At,C as g,D as h,aI as u,aH as l,u as Et,aM as m,aN as S,bw as et,G as ot,bx as nt,aK as D,aJ as A,aE as E,n as st,ba as Bt,bX as Vt,aZ as vt,b8 as Tt,bZ as Pt,bD as kt,bM as It}from"./arco.beabb834.js";import{e as I,g as ut,h as i,f as c,s as Ut}from"./serial.b70f48dc.js";import{u as Ot}from"./loading.04079284.js";import"./chart.83b8c11b.js";import"./vue.30c84055.js";const Ht={class:"container"},Nt=["innerHTML"],Mt={name:"Sat"},Yt=wt({...Mt,setup(Lt){const{loading:rt,setLoading:_}=Ot(!0),o=ft(),t=bt({showHide:0,status:"\u70B9\u51FB\u5199\u5165\u6309\u94AE\u5199\u5165\u536B\u661F\u6570\u636E\u5230\u8BBE\u5907<br/><br/>",sat:"",satData:[],lng:0,lat:0,alt:0,tx:0,rx:0,txTone:0,rxTone:0,CTCSSOption:[67,69.3,71.9,74.4,77,79.7,82.5,85.4,88.5,91.5,94.8,97.4,100,103.5,107.2,110.9,114.8,118.8,123,127.3,131.8,136.5,141.3,146.2,151.4,156.7,159.8,162.2,165.5,167.9,171.3,173.8,177.3,179.9,183.5,186.2,189.9,192.8,196.6,199.5,203.5,206.5,210.7,218.1,225.7,229.1,233.6,241.8,250.3,254.1],pass:void 0,passOption:[],dt:"",timer:void 0,passCustom:void 0,dtCustom:void 0,freqDb:[]});Ft(async()=>{const r=await(await fetch("https://mirror.ghproxy.com/https://raw.githubusercontent.com/palewire/ham-satellite-database/main/data/amsat-active-frequencies.json")).text();t.freqDb=JSON.parse(r),t.timer=setInterval(()=>{t.dt=new Date().toLocaleString("zh-CN",{timeZone:"Asia/Shanghai"})},1e3)}),yt(()=>{try{clearInterval(t.timer)}catch{}});const lt=async()=>{if(o.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}_(!0),await I(o.connectPort),await U(),await ut(o.connectPort),_(!1)},U=async()=>{var n;const r=t.dtCustom?new Date(t.dtCustom):new Date,a=[...i(parseInt(r.getFullYear().toString().substring(2,4)).toString(16)),...i((r.getMonth()+1).toString(16)),...i(r.getDate().toString(16)),...i(r.getHours().toString(16)),...i(r.getMinutes().toString(16)),...i(r.getSeconds().toString(16))];await c(o.connectPort,11200,new Uint8Array(a),6,(n=o.configuration)==null?void 0:n.uart)},it=async r=>{const a=t.satData.find(n=>n.name==r);if(a&&a.path){t.status+="<br/>\u536B\u661F\u53C2\u6570\uFF1A<br/>",a.path.map(e=>{t.status+=e+"<br/>"});let n=!1;t.freqDb.map(e=>{a.path[1].split(" ")[1]==e.norad_id&&e.mode.indexOf("FM")!=-1&&(console.log(e),n=!0,t.tx=e.uplink?parseFloat(e.uplink.split("/")[0]):0,t.rx=e.downlink?parseFloat(e.downlink.split("/")[0]):0,t.txTone=parseFloat([0,...t.CTCSSOption].reduce((d,y)=>e.mode.indexOf(y)!=-1?y:d)))}),n||(t.tx=0,t.rx=0,t.txTone=0,t.rxTone=0)}st(()=>{const n=document==null?void 0:document.getElementById("statusArea");n&&(n.scrollTop=n==null?void 0:n.scrollHeight)})};(async()=>{_(!0);const a=(await(await fetch("https://celestrak.org/NORAD/elements/amateur.txt")).text()).split(/\r?\n/),n=[];let e={};for(let d=0;d<a.length;d++)Number.isNaN(parseInt(a[d].substring(0,1)))?(e.name&&e.name!=""&&(n.push(e),e={}),e.name=a[d]):(e.path||(e.path=[]),e.path.push(a[d]));t.satData=n,_(!1)})();const O=async()=>{_(!0),navigator.geolocation.getCurrentPosition(r=>{r.coords&&(t.lat=r.coords.latitude,t.lng=r.coords.longitude,r.coords.altitude&&(t.alt=r.coords.altitude))}),_(!1)};O();const pt=async(r=0,a)=>{var n;await I(o.connectPort);for(let e=r;e<a.length+r;e+=128)await c(o.connectPort,e,a.slice(e-r,e-r+128),128,(n=o.configuration)==null?void 0:n.uart),t.status=t.status+"\u5199\u5165\u8FDB\u5EA6\uFF1A"+((e-r)/a.length*100).toFixed(1)+"%<br/>",st(()=>{const d=document==null?void 0:document.getElementById("statusArea");d&&(d.scrollTop=d==null?void 0:d.scrollHeight)});t.status=t.status+"\u5199\u5165\u8FDB\u5EA6\uFF1A100.0%<br/>"},ct=async()=>{if(!t.sat){alert("\u8BF7