@idmui/spot 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +550 -494
- package/dist/index.umd.cjs +1 -1
- package/package.json +2 -2
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(f,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("moment"),require("moment-timezone"),require("@element-plus/icons-vue"),require("@idm-plugin/geo"),require("echarts"),require("vue"),require("axios")):typeof define=="function"&&define.amd?define(["exports","moment","moment-timezone","@element-plus/icons-vue","@idm-plugin/geo","echarts","vue","axios"],x):(f=typeof globalThis<"u"?globalThis:f||self,x(f["idmui-spot"]={},f.moment,f["moment-timezone"],f["@element-plus/icons-vue"],f["@idm-plugin/geo"],f.echarts,f.Vue,f.axios))})(this,function(f,x,Z,ce,v,de,e,te){"use strict";function he(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const s in o)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(o,s);Object.defineProperty(t,s,r.get?r:{enumerable:!0,get:()=>o[s]})}}return t.default=o,Object.freeze(t)}const se=he(de);class ae{static pickHourly(t,s){var r,a,g,D,B,_,b,N,E,z,V,n,i,q,y,L,C,I,M,P,T,H,F,W,R,A,G,O,p,k,m,u,S,d,J,h,Y,w,X,j;const oe=typeof s=="string"?x(s):s,Q=t.weather,ie=t.marine,re=x(Q[0].hourly.date).utc(),$=re.clone().add(Q[0].hourly.time.at(0),"h"),lt=re.clone().add(Q[0].hourly.time.at(-1),"h"),le=[];if(oe.isBetween($,lt,"millisecond","[]")){const l=oe.utc().diff($,"h",!1);let U,K;if(Q)for(const ee of Q){const c=ee.hourly;U={temp:(r=c.temperature_2m)==null?void 0:r.at(l),apparentTemp:(a=c.apparent_temperature)==null?void 0:a.at(l),rh:(g=c.relative_humidity_2m)==null?void 0:g.at(l),dp:(D=c.dew_point_2m)==null?void 0:D.at(l),precip:{probability:(B=c.precipitation_probability)==null?void 0:B.at(l),sum:(_=c.precipitation)==null?void 0:_.at(l)},pmsl:(b=c.pressure_msl)==null?void 0:b.at(l),psurf:(N=c.surface_pressure)==null?void 0:N.at(l),code:(E=c.weather_code)==null?void 0:E.at(l),visibility:this.m2nm((z=c.visibility)==null?void 0:z.at(l)),wind:{speed:(V=c.wind_speed_10m)==null?void 0:V.at(l),kts:(n=c.wind_speed_10m)==null?void 0:n.at(l),degree:(i=c.wind_direction_10m)==null?void 0:i.at(l),bearing:((q=c.wind_direction_10m)==null?void 0:q.at(l))!==null?(((y=c.wind_direction_10m)==null?void 0:y.at(l))+180)%360:null,gusts:(L=c.wind_gusts_10m)==null?void 0:L.at(l)},isDay:(C=c.is_day)==null?void 0:C.at(l)};const{name:ct,url:dt}=this.parseWeatherCode(U.code,U.isDay);U.name=ct,U.url=dt,U.wind.scale=this.beaufort(this.kts2ms(U.wind.kts)),U.wind.direction=this.degree2Direction(U.wind.degree)}if(ie)for(const ee of ie){const c=ee.hourly;K={wave:{sig:{height:(I=c.wave_height)==null?void 0:I.at(l),degree:(M=c.wave_direction)==null?void 0:M.at(l),bearing:((P=c.wave_direction)==null?void 0:P.at(l))!==null?(((T=c.wave_direction)==null?void 0:T.at(l))+180)%360:null,period:(H=c.wave_period)==null?void 0:H.at(l)},swell:{height:(F=c.swell_wave_height)==null?void 0:F.at(l),degree:(W=c.swell_wave_direction)==null?void 0:W.at(l),bearing:((R=c.swell_wave_direction)==null?void 0:R.at(l))!==null?(((A=c.swell_wave_direction)==null?void 0:A.at(l))+180)%360:null,period:(G=c.swell_wave_period)==null?void 0:G.at(l),peakPeriod:(O=c.swell_wave_peak_period)==null?void 0:O.at(l)},wd:{height:(p=c.wind_wave_height)==null?void 0:p.at(l),degree:(k=c.wind_wave_direction)==null?void 0:k.at(l),bearing:((m=c.wind_wave_direction)==null?void 0:m.at(l))!==null?(((u=c.wind_wave_direction)==null?void 0:u.at(l))+180)%360:null,period:(S=c.wind_wave_period)==null?void 0:S.at(l),peakPeriod:(d=c.wind_wave_peak_period)==null?void 0:d.at(l)}},current:{speed:(J=c.ocean_current_velocity)==null?void 0:J.at(l),kts:(h=c.ocean_current_velocity)==null?void 0:h.at(l),degree:(Y=c.ocean_current_direction)==null?void 0:Y.at(l),bearing:((w=c.ocean_current_direction)==null?void 0:w.at(l))??null},sst:(X=c.sea_surface_temperature)==null?void 0:X.at(l),height:(j=c.sea_level_height_msl)==null?void 0:j.at(l)},K.wave=this.parseWave(K.wave),K.current.direction=this.degree2Direction(K.current.degree)}le.push({utc:$.add(l,"h").format(),weather:{...U},...K})}return le}static toLegacy(t){return{wind:t.weather.wind,visibility:t.weather.visibility,temp:t.weather.temp,prmsl:t.weather.pmsl,gusts:{kts:t.weather.wind.gusts},precip:t.weather.precip,code:t.weather.code,name:t.weather.name,url:t.weather.url,wave:t.wave,current:t.current,sst:t.sst,height:t.height,utc:t.utc}}static pickDaily(t,s){var r,a,g,D,B,_,b,N,E,z,V,n,i,q,y,L,C,I,M,P,T,H,F,W,R,A,G;const O=typeof s=="string"?x(s):s,p=t.weather,k=t.marine,m=x(p[0].daily.time.at(0)),u=x(p[0].daily.time.at(-1)),S=[];if(O.isBetween(m,u,"millisecond","[]")){let d,J;const h=O.diff(m,"d",!1);if(p)for(const Y of p){const w=Y.daily;d={code:(r=w.weather_code)==null?void 0:r.at(h),temp:{max:(a=w.temperature_2m_max)==null?void 0:a.at(h),min:(g=w.temperature_2m_min)==null?void 0:g.at(h),mean:(D=w.temperature_2m_mean)==null?void 0:D.at(h)},apparentTemp:{max:(B=w.apparent_temperature_max)==null?void 0:B.at(h),min:(_=w.apparent_temperature_min)==null?void 0:_.at(h)},precip:{sum:(b=w.precipitation_sum)==null?void 0:b.at(h),hours:(N=w.precipitation_hours)==null?void 0:N.at(h),probability:(E=w.precipitation_probability_max)==null?void 0:E.at(h)},rh:{max:(z=w.relative_humidity_2m_max)==null?void 0:z.at(h),min:(V=w.relative_humidity_2m_min)==null?void 0:V.at(h),mean:(n=w.relative_humidity_2m_mean)==null?void 0:n.at(h)},wind:{speed:(i=w.wind_speed_10m_max)==null?void 0:i.at(h),kts:(q=w.wind_speed_10m_max)==null?void 0:q.at(h),degree:(y=w.wind_direction_10m_dominant)==null?void 0:y.at(h),gusts:(L=w.wind_gusts_10m_max)==null?void 0:L.at(h)}};const{name:X,url:j}=this.parseWeatherCode(d.code,!0);d.name=X,d.url=j,d.wind.scale=this.beaufort(this.kts2ms(d.wind.kts)),d.wind.direction=this.degree2Direction(d.wind.degree)}if(k)for(const Y of k){const w=Y.daily;J={wave:{sig:{height:(C=w.wave_height_max)==null?void 0:C.at(h),degree:(I=w.wave_direction_dominant)==null?void 0:I.at(h),period:(M=w.wave_period_max)==null?void 0:M.at(h)},swell:{height:(P=w.swell_wave_height_max)==null?void 0:P.at(h),degree:(T=w.wave_direction_dominant)==null?void 0:T.at(h),period:(H=w.swell_wave_period_max)==null?void 0:H.at(h),peakPeriod:(F=w.swell_wave_peak_period_max)==null?void 0:F.at(h)},wd:{height:(W=w.wind_wave_height_max)==null?void 0:W.at(h),degree:(R=w.wind_wave_direction_dominant)==null?void 0:R.at(h),period:(A=w.wind_wave_period_max)==null?void 0:A.at(h),peakPeriod:(G=w.wind_wave_peak_period_max)==null?void 0:G.at(h)}}},J.wave=this.parseWave(J.wave)}S.push({utc:m.add(h,"d").utc().format(),weather:{...d},...J})}return S}static parseWave(t){return t.sig.direction=this.degree2Direction(t.sig.degree),t.swell.direction=this.degree2Direction(t.swell.degree),t.wd.direction=this.degree2Direction(t.wd.degree),t.sig.scale=this.douglas(t.sig.height),t.swell.scale=this.douglas(t.swell.height),t.wd.scale=this.douglas(t.wd.height),t}static parseWeatherCode(t,s){const r=this.weatherCode(t);return(s?r.day:r.night)||{}}static weatherCode(t){const s={code:t};switch(t){case 0:s.day={name:"Sunny",url:"https://osshz.idmwx.com/asset/weather/01d.svg"},s.night={name:"Clear",url:"https://osshz.idmwx.com/asset/weather/01n.svg"};break;case 1:s.day={name:"Mainly Sunny",url:"https://osshz.idmwx.com/asset/weather/01d.svg"},s.night={name:"Mainly Clear",url:"https://osshz.idmwx.com/asset/weather/01n.svg"};break;case 2:s.day={name:"Partly Cloudy",url:"https://osshz.idmwx.com/asset/weather/02d.svg"},s.night={name:"Partly Cloudy",url:"https://osshz.idmwx.com/asset/weather/02n.svg"};break;case 3:s.day={name:"Cloudy",url:"https://osshz.idmwx.com/asset/weather/03d.svg"},s.night={name:"Cloudy",url:"https://osshz.idmwx.com/asset/weather/03n.svg"};break;case 45:s.day={name:"Foggy",url:"https://osshz.idmwx.com/asset/weather/50d.svg"},s.night={name:"Foggy",url:"https://osshz.idmwx.com/asset/weather/50n.svg"};break;case 48:s.day={name:"Rime Fog",url:"https://osshz.idmwx.com/asset/weather/50d.svg"},s.night={name:"Rime Fog",url:"https://osshz.idmwx.com/asset/weather/50n.svg"};break;case 51:s.day={name:"Light Drizzle",url:"https://osshz.idmwx.com/asset/weather/09d.svg"},s.night={name:"Light Drizzle",url:"https://osshz.idmwx.com/asset/weather/09n.svg"};break;case 53:s.day={name:"Drizzle",url:"https://osshz.idmwx.com/asset/weather/09d.svg"},s.night={name:"Drizzle",url:"https://osshz.idmwx.com/asset/weather/09n.svg"};break;case 55:s.day={name:"Heavy Drizzle",url:"https://osshz.idmwx.com/asset/weather/09d.svg"},s.night={name:"Heavy Drizzle",url:"https://osshz.idmwx.com/asset/weather/09n.svg"};break;case 56:s.day={name:"Light Freezing Drizzle",url:"https://osshz.idmwx.com/asset/weather/09d.svg"},s.night={name:"Light Freezing Drizzle",url:"https://osshz.idmwx.com/asset/weather/09n.svg"};break;case 57:s.day={name:"Freezing Drizzle",url:"https://osshz.idmwx.com/asset/weather/09d.svg"},s.night={name:"Freezing Drizzle",url:"https://osshz.idmwx.com/asset/weather/09n.svg"};break;case 61:s.day={name:"Light Rain",url:"https://osshz.idmwx.com/asset/weather/10d.svg"},s.night={name:"Light Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg"};break;case 63:s.day={name:"Rain",url:"https://osshz.idmwx.com/asset/weather/10d.svg"},s.night={name:"Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg"};break;case 65:s.day={name:"Heavy Rain",url:"https://osshz.idmwx.com/asset/weather/10d.svg"},s.night={name:"Heavy Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg"};break;case 66:s.day={name:"Light Freezing Rain",url:"https://osshz.idmwx.com/asset/weather/10d.svg"},s.night={name:"Light Freezing Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg"};break;case 67:s.day={name:"Freezing Rain",url:"https://osshz.idmwx.com/asset/weather/10d.svg"},s.night={name:"Freezing Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg"};break;case 71:s.day={name:"Light Snow",url:"https://osshz.idmwx.com/asset/weather/13d.svg"},s.night={name:"Light Snow",url:"https://osshz.idmwx.com/asset/weather/13n.svg"};break;case 73:s.day={name:"Snow",url:"https://osshz.idmwx.com/asset/weather/13d.svg"},s.night={name:"Snow",url:"https://osshz.idmwx.com/asset/weather/13n.svg"};break;case 75:s.day={name:"Heavy Snow",url:"https://osshz.idmwx.com/asset/weather/13d.svg"},s.night={name:"Heavy Snow",url:"https://osshz.idmwx.com/asset/weather/13n.svg"};break;case 77:s.day={name:"Snow Grains",url:"https://osshz.idmwx.com/asset/weather/13d.svg"},s.night={name:"Snow Grains",url:"https://osshz.idmwx.com/asset/weather/13n.svg"};break;case 80:s.day={name:"Light Showers",url:"https://osshz.idmwx.com/asset/weather/09d.svg"},s.night={name:"Light Showers",url:"https://osshz.idmwx.com/asset/weather/09n.svg"};break;case 81:s.day={name:"Showers",url:"https://osshz.idmwx.com/asset/weather/09d.svg"},s.night={name:"Showers",url:"https://osshz.idmwx.com/asset/weather/09n.svg"};break;case 82:s.day={name:"Heavy Showers",url:"https://osshz.idmwx.com/asset/weather/09d.svg"},s.night={name:"Heavy Showers",url:"https://osshz.idmwx.com/asset/weather/09n.svg"};break;case 85:s.day={name:"Light Snow Showers",url:"https://osshz.idmwx.com/asset/weather/13d.svg"},s.night={name:"Light Snow Showers",url:"https://osshz.idmwx.com/asset/weather/13n.svg"};break;case 86:s.day={name:"Snow Showers",url:"https://osshz.idmwx.com/asset/weather/13d.svg"},s.night={name:"Snow Showers",url:"https://osshz.idmwx.com/asset/weather/13n.svg"};break;case 95:s.day={name:"Thunderstorm",url:"https://osshz.idmwx.com/asset/weather/11d.svg"},s.night={name:"Thunderstorm",url:"https://osshz.idmwx.com/asset/weather/11n.svg"};break;case 96:s.day={name:"Light Thunderstorms With Hail",url:"https://osshz.idmwx.com/asset/weather/11d.svg"},s.night={name:"Light Thunderstorms With Hail",url:"https://osshz.idmwx.com/asset/weather/11n.svg"};break;case 99:s.day={name:"Thunderstorms With Hail",url:"https://osshz.idmwx.com/asset/weather/11d.svg"},s.night={name:"Thunderstorms With Hail",url:"https://osshz.idmwx.com/asset/weather/11n.svg"};break}return s}static kts2ms(t){return isNaN(t)||t===null?t:Math.round(t*1852/3600*1e4)/1e4}static kts2kmh(t){return isNaN(t)||t===null?t:t*1.852}static m2nm(t){return isNaN(t)||t===null?t:Math.round(t/1e3/1.852*1e4)/1e4}static kmh2kts(t){return isNaN(t)||t===null?t:this.ms2kts(t*1e3/3600)}static ms2kts(t){return isNaN(t)||t===null?t:Math.round(t*3600/1852*1e4)/1e4}static degree2Radian(t){if(isNaN(t)||t===null)return t;let s=t%360/360*2*Math.PI;return s=s<0?s+2*Math.PI:s,s}static degree2Direction(t){const s=this.degree2Radian(t);if(isNaN(s)||s===null)return null;let r="N/A";const a=Math.PI/16;return s<a?r="N":s>=a&&s<3*a?r="NNE":s>=3*a&&s<5*a?r="NE":s>=5*a&&s<7*a?r="ENE":s>=7*a&&s<9*a?r="E":s>=9*a&&s<11*a?r="ESE":s>=11*a&&s<13*a?r="SE":s>=13*a&&s<15*a?r="SSE":s>=15*a&&s<17*a?r="S":s>=17*a&&s<19*a?r="SSW":s>=19*a&&s<21*a?r="SW":s>=21*a&&s<23*a?r="WSW":s>=23*a&&s<25*a?r="W":s>=25*a&&s<27*a?r="WNW":s>=27*a&&s<29*a?r="NW":s>=29*a&&s<31*a?r="NNW":s>=31*a&&s<32*a&&(r="N"),r}static beaufort(t){let s=0;return isNaN(t)||(t=Math.round(t*10)/10,t<=.2?s=0:t<=1.5?s=1:t<=3.3?s=2:t<=5.4?s=3:t<=7.9?s=4:t<=10.7?s=5:t<=13.8?s=6:t<=17.1?s=7:t<=20.7?s=8:t<=22.4?s=9:t<=28.4?s=10:t<=32.6?s=11:t>32.6&&(s=12)),s}static douglas(t){let s="Calm";return isNaN(t)||t<=.1?s="Calm":t<=.5?s="Smooth":t<=1.25?s="Slight":t<=2.5?s="Moderate":t<=4?s="Rough":t<=6?s="VeryRough":t<=9?s="High":t<=14?s="VeryHigh":s="Precipitous",s}}const ht="",me=(o,t)=>{const s=o.__vccOpts||o;for(const[r,a]of t)s[r]=a;return s},pe={name:"SpotReport",props:{token:{type:String,default:""},ts:{type:String,default:x().utc().format()},timeZone:{type:Number,default:8},report:{type:Object,default:()=>({})}},emits:["url"],data(){return{placeholder:"search for port name or coordinates",searchName:void 0,rawSearchIcon:e.markRaw(ce.Search),positionGmt:void 0,issuedDate:void 0,meteoData:{},a:void 0,positionList:[],position:void 0,loading:!0,activeIndex:void 0,tableData:{},pickedDate:void 0,pickedWeek:"Today",collectList:[],isCollected:!1}},computed:{computeHourL(){return function(o){return o?`${Z(o).tz(this.positionGmt).format("HH")}`:"-"}},computeHourZ(){return function(o){return o?`${x(o).utc().format("HH")}Z`:"-"}},computeWeek(){return function(o){return o?`${Z(o).tz(this.positionGmt).format("dddd")}`:"-"}},computeMMMDD(){return function(o){return o?`${Z(o).tz(this.positionGmt).format("MMM-DD")}`:"-"}},computeLat(){return function(o,t=4){return v.LngLatHelper.lat2pretty(o,t).pretty}},computeLng(){return function(o,t=4){return v.LngLatHelper.lng2pretty(o,t).pretty}},roundPrecision(){return function(o,t=4){return isNaN(o)?"-":v.LngLatHelper.roundPrecision(o,t)}}},watch:{"report.version":{handler(){var o,t,s;this.report&&(this.meteoData=this.report,this.position={id:this.report.portId,lat:(o=this.report)==null?void 0:o.lat,lng:(t=this.report)==null?void 0:t.lng,name:((s=this.report)==null?void 0:s.searchName)||this.computeLat(this.report.lat)+","+this.computeLng(this.report.lng)},this.handleRender())}}},methods:{handleRender(){this.initInfo(),this.initTableData(),this.$nextTick(()=>{this.initEchart()})},initInfo(){var o,t;this.loading=!1,this.positionGmt=(t=(o=this.meteoData.weather)==null?void 0:o[0])==null?void 0:t.timezone,this.issuedDate=x(this.ts).utc().format("MMM-DD/HHmm[Z], YYYY"),this.activeIndex=Z(this.ts).tz(this.positionGmt).hour(),this.pickedDate=Z(this.ts).tz(this.positionGmt).set({hour:0,minute:0,second:0,millisecond:0}).format(),this.collectList=JSON.parse(localStorage.getItem("idmCollectList")||"[]"),this.positionList=JSON.parse(JSON.stringify(this.collectList)),this.isCollected=this.collectList.some(s=>{var r;return s.name===((r=this.position)==null?void 0:r.name)})},initTableData(){var o,t,s,r,a,g,D,B,_,b,N,E,z,V,n,i,q,y,L,C,I,M,P,T,H,F,W,R,A,G,O,p,k,m;this.tableData={hours:[],utcHours:[],weatherUrls:[],weatherNames:[],temp:[],precipProbability:[],precip1h:[],visibility:[],humidity:[],windSpeed:[],windDir:[],windGust:[],sigwaveHeight:[],sigwaveDir:[],windwaveHeight:[],windwaveDir:[],windwavePeriod:[],swellHeight:[],swellDir:[],swellPeriod:[],currentSpeed:[],currentDir:[],seaLevel:[],seaTemp:[]};for(let u=0;u<24;u++){const S=x(this.pickedDate).clone().add(u,"h").format();this.tableData.hours.push(S);const d=((o=ae.pickHourly(this.meteoData,S))==null?void 0:o[0])||{};this.tableData.weatherUrls.push((t=d.weather)==null?void 0:t.url),this.tableData.weatherNames.push(((s=d.weather)==null?void 0:s.name)??"-"),this.tableData.temp.push(this.roundPrecision((r=d.weather)==null?void 0:r.temp,0)??"-"),this.tableData.precipProbability.push(this.roundPrecision((g=(a=d.weather)==null?void 0:a.precip)==null?void 0:g.probability,0)??"-"),this.tableData.precip1h.push(this.roundPrecision((B=(D=d.weather)==null?void 0:D.precip)==null?void 0:B.sum,0)??"-"),this.tableData.visibility.push(this.roundPrecision((_=d.weather)==null?void 0:_.visibility,0)??"-"),this.tableData.humidity.push(this.roundPrecision((b=d.weather)==null?void 0:b.rh,0)??"-"),this.tableData.windSpeed.push(this.roundPrecision((E=(N=d.weather)==null?void 0:N.wind)==null?void 0:E.kts,1)),this.tableData.windDir.push((V=(z=d.weather)==null?void 0:z.wind)==null?void 0:V.bearing),this.tableData.windGust.push(this.roundPrecision((i=(n=d.weather)==null?void 0:n.wind)==null?void 0:i.gusts,1)??"-"),this.tableData.sigwaveHeight.push(this.roundPrecision((y=(q=d.wave)==null?void 0:q.sig)==null?void 0:y.height,1)??"-"),this.tableData.sigwaveDir.push((C=(L=d.wave)==null?void 0:L.sig)==null?void 0:C.bearing),this.tableData.windwaveHeight.push(this.roundPrecision((M=(I=d.wave)==null?void 0:I.wd)==null?void 0:M.height,1)??"-"),this.tableData.windwaveDir.push((T=(P=d.wave)==null?void 0:P.wd)==null?void 0:T.bearing),this.tableData.windwavePeriod.push(this.roundPrecision((F=(H=d.wave)==null?void 0:H.wd)==null?void 0:F.period,1)??"-"),this.tableData.swellHeight.push(this.roundPrecision((R=(W=d.wave)==null?void 0:W.swell)==null?void 0:R.height,1)??"-"),this.tableData.swellDir.push((G=(A=d.wave)==null?void 0:A.swell)==null?void 0:G.bearing),this.tableData.swellPeriod.push(this.roundPrecision((p=(O=d.wave)==null?void 0:O.swell)==null?void 0:p.period,1)??"-"),this.tableData.currentSpeed.push(this.roundPrecision((k=d.current)==null?void 0:k.speed,1)??"-"),this.tableData.currentDir.push((m=d.current)==null?void 0:m.bearing),this.tableData.seaLevel.push(this.roundPrecision(d.height,1)??"-"),this.tableData.seaTemp.push(this.roundPrecision(d.sst,0)??"-")}},initEchart(){var L,C,I,M,P,T,H,F,W,R,A,G,O;const o=[],t=[],s=[],r=[],a=[],g=[],D=[],B=[],_=[],b=[],N={};for(let p=0;p<7;p++){const k=x(this.pickedDate).clone().add(p,"d");o.push(Z(k).tz(this.positionGmt).format("yyyy-MM-DD")),t.push(this.computeMMMDD(k)),s.push(p===0?"Today":this.computeWeek(k));const m=((L=ae.pickDaily(this.meteoData,k))==null?void 0:L[0])||{};r.push(this.roundPrecision((I=(C=m.weather)==null?void 0:C.temp)==null?void 0:I.min,0)),a.push(this.roundPrecision((P=(M=m.weather)==null?void 0:M.temp)==null?void 0:P.max,0)),B.push(this.roundPrecision((H=(T=m.weather)==null?void 0:T.wind)==null?void 0:H.kts,1)??"- kts"),b.push(this.roundPrecision((W=(F=m.weather)==null?void 0:F.precip)==null?void 0:W.sum,0)??"- mm"),g.push({symbol:"image://"+((R=m.weather)==null?void 0:R.url)}),D.push((A=m.weather)==null?void 0:A.name),_.push((O=(G=m.weather)==null?void 0:G.wind)==null?void 0:O.degree)}const E=Math.max(...a.filter(p=>typeof p=="number"&&!isNaN(p)))-Math.min(...r.filter(p=>typeof p=="number"&&!isNaN(p))),z=Math.min(...r.filter(p=>typeof p=="number"&&!isNaN(p)))-1.5*E,V=Math.max(...a.filter(p=>typeof p=="number"&&!isNaN(p)))+2*E,n=4+.5/o.length*92+"%",i="data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent('<svg t="1740385441519" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10951" width="200" height="200"><path d="M512 804.83593751A276.87183211 276.87183211 0 0 1 235.12816789 527.9641054Q235.12816789 375.21005376 512 13.82031251q276.87183211 361.30792288 276.87183211 514.14379289a276.87183211 276.87183211 0 0 1-276.87183211 276.87183211zM294.4461577 527.9641054a217.47202472 217.47202472 0 0 0 217.5538423 217.55384231 19.79993605 19.79993605 0 1 0 0-39.51805453 177.9539702 177.9539702 0 0 1-177.9539702-178.03578778 19.79993605 19.79993605 0 0 0-39.5998721 0z" fill="#0c73a8" p-id="10952"></path></svg>'))),q="data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent('<svg t="1740383449285" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10797" width="200" height="200"><path d="M133.8 579l-44.4-44.4c-18.8-18.8-18.8-49.2 0-67.8L478 78c18.8-18.8 49.2-18.8 67.8 0l388.6 388.6c18.8 18.8 18.8 49.2 0 67.8L890 578.8c-19 19-50 18.6-68.6-0.8L592 337.2V912c0 26.6-21.4 48-48 48h-64c-26.6 0-48-21.4-48-48V337.2L202.4 578.2c-18.6 19.6-49.6 20-68.6 0.8z" fill="#ffffff" p-id="10798"></path></svg>'))),y=new Image(64,64);y.src=q,y.onload=()=>{for(let m=0;m<7;m++){const u=document.createElement("canvas"),S=u.getContext("2d");u.width=y.width,u.height=y.height;const J=_[m]*(Math.PI/180);S.translate(u.width/2,u.height/2),S.rotate(J),S.translate(-y.width/2,-y.height/2),S.drawImage(y,0,0,64,64);const h=u.toDataURL();N[`WindIcon${m}`]={height:12,width:12,align:"left",backgroundColor:{image:h}}}const p=se.init(document.getElementById("weather-chart")),k={grid:{bottom:0,top:0,left:"4%",right:"4%"},tooltip:{trigger:"item",show:!0,position:"right",formatter:function(m){return m.seriesName==="Weather Icon"?D[m.dataIndex]:!1}},legend:{show:!1},xAxis:{left:0,right:0,top:"50%",height:"50%",type:"category",data:o,show:!1},singleAxis:[{left:n,right:n,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:o,top:"7%",height:"2%"},{left:n,right:n,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:o,top:"16%",height:"2%"},{left:n,right:n,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:o,top:"27%",height:"2%"},{left:n,right:n,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:o,top:"84%",height:"2%"},{left:n,right:n,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:o,top:"93%",height:"2%"}],yAxis:{type:"value",name:"温度(℃)",show:!1,min:z,max:V,axisLabel:{formatter:"{value} °C"}},series:[{singleAxisIndex:0,coordinateSystem:"singleAxis",type:"scatter",data:s,label:{show:!0,color:"#fff",fontSize:14,formatter:"{c}"},symbolSize:0},{singleAxisIndex:1,coordinateSystem:"singleAxis",type:"scatter",data:t,label:{show:!0,color:"#fff",formatter:"{c}"},symbolSize:0},{name:"Weather Icon",singleAxisIndex:2,coordinateSystem:"singleAxis",type:"scatter",data:g,symbolSize:36},{name:"温度(℃)",type:"line",data:r,smooth:!0,itemStyle:{color:"rgba(255,255,255,0.7)"},label:{show:!0,color:"rgba(255,255,255,1)",position:[-10,12],formatter:"{c} °C",fontSize:12},markArea:{itemStyle:{color:"rgb(71,143,206)"},data:[[{x:"4%"},{x:4+1/o.length*92+"%"}]]}},{name:"温度(℃)",type:"line",data:a,smooth:!0,itemStyle:{color:"rgba(255,255,255,0.7)"},label:{show:!0,color:"rgba(255,255,255,1)",position:[-10,-12],formatter:"{c} °C",fontSize:12}},{singleAxisIndex:3,coordinateSystem:"singleAxis",type:"scatter",data:B,label:{show:!0,color:"#fff",rich:{...N,title:{align:"center",vertical:"center"}},formatter:function(m){return`{WindIcon${m.dataIndex}|}{title|${m.value}} kts`}},symbolSize:0},{singleAxisIndex:4,coordinateSystem:"singleAxis",type:"scatter",data:b,label:{show:!0,color:"#fff",rich:{dIcon:{height:16,width:16,align:"left",backgroundColor:{image:i}},title:{align:"center",vertical:"center"}},formatter:function(m){return`{dIcon|}{title|${m.value}} mm`}},symbolSize:0}]};p.setOption(k),p.on("click",m=>{const u=m.dataIndex;this.pickedDate=Z(o[u]).tz(this.positionGmt).set({hour:0,minute:0,second:0,millisecond:0}).format(),this.pickedWeek=u===0?"Today":this.computeWeek(this.pickedDate),this.activeIndex=u===0?Z(this.ts).tz(this.positionGmt).hour():void 0,this.initTableData(),k.series[3].markArea={itemStyle:{color:"rgb(71,143,206)"},data:[[{x:4+u/o.length*92+"%"},{x:4+(u+1)/o.length*92+"%"}]]},p.setOption(k)})}},handleCollect(){this.isCollected=!this.isCollected,this.isCollected?this.collectList.push({name:this.position.name,lat:this.position.lat,lng:this.position.lng}):this.collectList=this.collectList.filter(o=>o.name!==this.position.name),localStorage.setItem("idmCollectList",JSON.stringify(this.collectList))},async fetchSuggestPosition(o){var r;const t=o.replaceAll(",",",");if(!t)return this.positionList=this.collectList,!1;const s=await te.get(`https://cbe.idmwx.com/api/arc/ports/suggest?n=${t}`,{headers:{Authorization:this.token}});(s==null?void 0:s.data.code)===0&&(this.positionList=(r=s==null?void 0:s.data.data)==null?void 0:r.map(a=>(a.name=a.id?a.name:this.computeLat(a.lat)+", "+this.computeLng(a.lng),a)))},async handleFetchMeteo(){var s,r,a;if(!this.searchName)return!1;this.position={portId:(s=this.positionList.find(g=>g.name===this.searchName))==null?void 0:s.id,lat:(r=this.positionList.find(g=>g.name===this.searchName))==null?void 0:r.lat,lng:(a=this.positionList.find(g=>g.name===this.searchName))==null?void 0:a.lng,name:this.searchName},this.$emit("url",this.position),this.handleClear();const o={lat:this.position.lat,lng:this.position.lng,forecastDays:8,selfHosted:!1},t=await te.post("https://cbe.idmwx.com/api/arc/meteo2/spot/forecast",o,{headers:{Authorization:this.token}});(t==null?void 0:t.data.code)===0&&(this.meteoData={...t==null?void 0:t.data.data}),this.handleRender()},handleClear(){this.loading=!0,this.meteoData={},this.isCollected=!1,se.dispose(document.getElementById("weather-chart"))}}},we={class:"spot-report"},ge={class:"header-box flex-between"},ue={class:"bg"},ke={class:"search-box flex-start"},ye={class:"content-box"},fe={class:"title-box flex-between"},xe={class:"main-title"},_e={class:"sub-title"},be={class:"flex-end"},Ne={key:0,id:"weather-chart"},Ee={key:1,class:"weather-chart flex-center"},De={key:2,class:"weather-chart flex-center"},Be={key:3,class:"card-box"},ze={class:"date"},Ve={class:"basic-table"},Se={class:"day"},Le={class:"hour"},Ce={class:"icon"},Ie=["src"],Me={class:"text"},Pe={class:"text"},Te={class:"text"},He={class:"text"},Fe={class:"text"},We={class:"text"},Re={key:1},Ae={class:"text"},Ge={class:"text"},Oe={class:"wave-current-table"},qe={class:"text"},Ue={class:"text"},Je={key:1},Ze={class:"text"},Ye={class:"text"},Ke={class:"text"},Qe={key:1},Xe={class:"text"},je={class:"text"},ve={class:"text"},$e={key:1},et={class:"text"},tt={class:"sea-table"},st={class:"text"},at={class:"text"},nt={key:4,class:"card-box flex-center"},ot={key:5,class:"card-box flex-center"};function it(o,t,s,r,a,g){var b,N,E,z,V;const D=e.resolveComponent("ElOption"),B=e.resolveComponent("ElSelect"),_=e.resolveComponent("ElTooltip");return e.openBlock(),e.createElementBlock("div",we,[e.createElementVNode("div",ge,[e.createElementVNode("div",ue,[e.createElementVNode("div",ke,[e.createVNode(B,{modelValue:a.searchName,"onUpdate:modelValue":t[0]||(t[0]=n=>a.searchName=n),filterable:"",class:"input",clearable:"",remote:"",placeholder:a.placeholder,autocomplete:"","remote-show-suffix":"",onFocus:t[1]||(t[1]=n=>a.placeholder=""),onBlur:t[2]||(t[2]=n=>a.placeholder="search for port name or coordinates"),"remote-method":g.fetchSuggestPosition,onChange:g.handleFetchMeteo},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.positionList,n=>(e.openBlock(),e.createBlock(D,{key:n.name,label:n.name,value:n.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","remote-method","onChange"])])])]),e.createElementVNode("div",ye,[e.createElementVNode("div",fe,[e.createElementVNode("div",null,[e.createElementVNode("div",xe,"Weather forecast for "+e.toDisplayString(((b=a.position)==null?void 0:b.name)||"-")+" ( "+e.toDisplayString(a.positionGmt)+" )",1),e.createElementVNode("div",_e,"At "+e.toDisplayString((N=a.position)!=null&&N.portId?"port":"coordinates")+", issued "+e.toDisplayString(a.issuedDate),1)]),e.createElementVNode("div",be,[e.createVNode(_,{placement:"left",effect:"light",content:a.isCollected?"remove the port/coordinate from the search list":"add the port/coordinate to the search list","show-after":1e3},{default:e.withCtx(()=>[a.isCollected?(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon active",onClick:t[3]||(t[3]=(...n)=>g.handleCollect&&g.handleCollect(...n))},"")):(e.openBlock(),e.createElementBlock("span",{key:1,class:"iconfont icon",onClick:t[4]||(t[4]=(...n)=>g.handleCollect&&g.handleCollect(...n))},""))]),_:1},8,["content"])])]),(E=a.position)!=null&&E.name&&!a.loading?(e.openBlock(),e.createElementBlock("div",Ne)):a.loading?(e.openBlock(),e.createElementBlock("div",Ee,"Loading....")):a.position.name?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",De,"No Data")),(z=a.position)!=null&&z.name&&!a.loading?(e.openBlock(),e.createElementBlock("div",Be,[e.createElementVNode("div",ze,e.toDisplayString(a.pickedWeek)+" "+e.toDisplayString(g.computeMMMDD(a.pickedDate)),1),e.createElementVNode("table",Ve,[e.createElementVNode("tr",Se,[t[5]||(t[5]=e.createElementVNode("th",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Local time"),e.createElementVNode("span",{class:"unit"},"(LT)")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.hours,(n,i)=>(e.openBlock(),e.createElementBlock("th",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+"local"},e.toDisplayString(g.computeHourL(n)),3))),128))]),e.createElementVNode("tr",Le,[t[6]||(t[6]=e.createElementVNode("th",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("UTC"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.hours,(n,i)=>(e.openBlock(),e.createElementBlock("th",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+"z"},e.toDisplayString(g.computeHourZ(n)),3))),128))]),e.createElementVNode("tr",Ce,[t[7]||(t[7]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Weather"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.weatherUrls,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+"url"},[e.createVNode(_,{placement:"top",effect:"light",content:a.tableData.weatherNames[i],"show-after":500},{default:e.withCtx(()=>[n?(e.openBlock(),e.createElementBlock("img",{key:0,class:"iconfont weather-icon",src:n},null,8,Ie)):e.createCommentVNode("",!0)]),_:2},1032,["content"])],2))),128))]),e.createElementVNode("tr",Me,[t[8]||(t[8]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Temperature"),e.createElementVNode("span",{class:"unit"},"°C")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.temp,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",Pe,[t[9]||(t[9]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Precipitation Probability"),e.createElementVNode("span",{class:"unit"},"%")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.precipProbability,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",Te,[t[10]||(t[10]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Precipitation 1h"),e.createElementVNode("span",{class:"unit"},"mm")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.precip1h,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",He,[t[11]||(t[11]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Visibility"),e.createElementVNode("span",{class:"unit"},"nm")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.visibility,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",Fe,[t[12]||(t[12]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Relative Humidity"),e.createElementVNode("span",{class:"unit"},"%")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.humidity,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",We,[t[13]||(t[13]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind direction"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windDir,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+n},[isNaN(n)?(e.openBlock(),e.createElementBlock("span",Re,"-")):(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon",style:e.normalizeStyle({display:"inline-block",transform:`rotate(${n}deg)`})},"",4))],2))),128))]),e.createElementVNode("tr",Ae,[t[14]||(t[14]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind speed"),e.createElementVNode("span",{class:"unit"},"kts")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windSpeed,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",Ge,[t[15]||(t[15]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind gust"),e.createElementVNode("span",{class:"unit"},"kts")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windGust,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))])]),t[27]||(t[27]=e.createElementVNode("div",{style:{"text-align":"center",padding:"3px"}},null,-1)),e.createElementVNode("table",Oe,[e.createElementVNode("tr",qe,[t[16]||(t[16]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind wave height"),e.createElementVNode("span",{class:"unit"},"m")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windwaveHeight,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",Ue,[t[17]||(t[17]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind wave direction"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windwaveDir,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+n},[isNaN(n)?(e.openBlock(),e.createElementBlock("span",Je,"-")):(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon",style:e.normalizeStyle({display:"inline-block",transform:`rotate(${n}deg)`})},"",4))],2))),128))]),e.createElementVNode("tr",Ze,[t[18]||(t[18]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind wave period"),e.createElementVNode("span",{class:"unit"},"s")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windwavePeriod,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",Ye,[t[19]||(t[19]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Swell height"),e.createElementVNode("span",{class:"unit"},"m")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.swellHeight,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",Ke,[t[20]||(t[20]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Swell direction"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.swellDir,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+n},[isNaN(n)?(e.openBlock(),e.createElementBlock("span",Qe,"-")):(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon",style:e.normalizeStyle({display:"inline-block",transform:`rotate(${n}deg)`})},"",4))],2))),128))]),e.createElementVNode("tr",Xe,[t[21]||(t[21]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Swell period"),e.createElementVNode("span",{class:"unit"},"s")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.swellPeriod,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",je,[t[22]||(t[22]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Sig wave height"),e.createElementVNode("span",{class:"unit"},"m")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.sigwaveHeight,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",ve,[t[23]||(t[23]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Current direction"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.currentDir,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+n},[isNaN(n)?(e.openBlock(),e.createElementBlock("span",$e,"-")):(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon",style:e.normalizeStyle({display:"inline-block",transform:`rotate(${n}deg)`})},"",4))],2))),128))]),e.createElementVNode("tr",et,[t[24]||(t[24]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Current speed"),e.createElementVNode("span",{class:"unit"},"kts")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.currentSpeed,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))])]),t[28]||(t[28]=e.createElementVNode("div",{style:{"text-align":"center",padding:"3px"}},null,-1)),e.createElementVNode("table",tt,[e.createElementVNode("tr",st,[t[25]||(t[25]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Sea level height"),e.createElementVNode("span",{class:"unit"},"m")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.seaLevel,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",at,[t[26]||(t[26]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Sea surface temperature"),e.createElementVNode("span",{class:"unit"},"°C")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.seaTemp,(n,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))])])])):a.loading?(e.openBlock(),e.createElementBlock("div",nt,"Loading....")):(V=a.position)!=null&&V.name?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",ot,"No Data"))])])}const ne=me(pe,[["render",it],["__scopeId","data-v-299b53fa"]]),rt={install(o){o.component("SpotReport",ne)}};f.SpotReport=ne,f.SpotReportPlugin=rt,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(k,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("moment"),require("moment-timezone"),require("@element-plus/icons-vue"),require("@idm-plugin/geo"),require("echarts"),require("vue"),require("axios")):typeof define=="function"&&define.amd?define(["exports","moment","moment-timezone","@element-plus/icons-vue","@idm-plugin/geo","echarts","vue","axios"],y):(k=typeof globalThis<"u"?globalThis:k||self,y(k["idmui-spot"]={},k.moment,k["moment-timezone"],k["@element-plus/icons-vue"],k["@idm-plugin/geo"],k.echarts,k.Vue,k.axios))})(this,function(k,y,J,ce,$,de,e,se){"use strict";function he(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const s in n)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(t,s,r.get?r:{enumerable:!0,get:()=>n[s]})}}return t.default=n,Object.freeze(t)}const ae=he(de);class oe{static pickHourly(t,s){var r,a,w,E,D,f,_,z,N,B,S,o,i,U,u,L,C,I,M,P,T,H,F,W,R,A,G,O,p,x,m,b,V,d,j,h,Z,g,K,X;const v=typeof s=="string"?y(s):s,Q=t.weather,ie=t.marine,re=y(Q[0].hourly.date).utc(),ee=re.clone().add(Q[0].hourly.time.at(0),"h"),lt=re.clone().add(Q[0].hourly.time.at(-1),"h"),le=[];if(v.isBetween(ee,lt,"millisecond","[]")){const l=v.utc().diff(ee,"h",!1);let q,Y;if(Q)for(const te of Q){const c=te.hourly;q={temp:(r=c.temperature_2m)==null?void 0:r.at(l),apparentTemp:(a=c.apparent_temperature)==null?void 0:a.at(l),rh:(w=c.relative_humidity_2m)==null?void 0:w.at(l),dp:(E=c.dew_point_2m)==null?void 0:E.at(l),precip:{probability:(D=c.precipitation_probability)==null?void 0:D.at(l),sum:(f=c.precipitation)==null?void 0:f.at(l)},pmsl:(_=c.pressure_msl)==null?void 0:_.at(l),psurf:(z=c.surface_pressure)==null?void 0:z.at(l),code:(N=c.weather_code)==null?void 0:N.at(l),visibility:this.m2nm((B=c.visibility)==null?void 0:B.at(l)),wind:{speed:(S=c.wind_speed_10m)==null?void 0:S.at(l),kts:(o=c.wind_speed_10m)==null?void 0:o.at(l),degree:(i=c.wind_direction_10m)==null?void 0:i.at(l),bearing:((U=c.wind_direction_10m)==null?void 0:U.at(l))!==null?(((u=c.wind_direction_10m)==null?void 0:u.at(l))+180)%360:null,gusts:(L=c.wind_gusts_10m)==null?void 0:L.at(l)},isDay:(C=c.is_day)==null?void 0:C.at(l)};const{name:ct,url:dt,bg:ht}=this.parseWeatherCode(q.code,q.isDay);q.name=ct,q.url=dt,q.bg=ht,q.wind.scale=this.beaufort(this.kts2ms(q.wind.kts)),q.wind.direction=this.degree2Direction(q.wind.degree)}if(ie)for(const te of ie){const c=te.hourly;Y={wave:{sig:{height:(I=c.wave_height)==null?void 0:I.at(l),degree:(M=c.wave_direction)==null?void 0:M.at(l),bearing:((P=c.wave_direction)==null?void 0:P.at(l))!==null?(((T=c.wave_direction)==null?void 0:T.at(l))+180)%360:null,period:(H=c.wave_period)==null?void 0:H.at(l)},swell:{height:(F=c.swell_wave_height)==null?void 0:F.at(l),degree:(W=c.swell_wave_direction)==null?void 0:W.at(l),bearing:((R=c.swell_wave_direction)==null?void 0:R.at(l))!==null?(((A=c.swell_wave_direction)==null?void 0:A.at(l))+180)%360:null,period:(G=c.swell_wave_period)==null?void 0:G.at(l),peakPeriod:(O=c.swell_wave_peak_period)==null?void 0:O.at(l)},wd:{height:(p=c.wind_wave_height)==null?void 0:p.at(l),degree:(x=c.wind_wave_direction)==null?void 0:x.at(l),bearing:((m=c.wind_wave_direction)==null?void 0:m.at(l))!==null?(((b=c.wind_wave_direction)==null?void 0:b.at(l))+180)%360:null,period:(V=c.wind_wave_period)==null?void 0:V.at(l),peakPeriod:(d=c.wind_wave_peak_period)==null?void 0:d.at(l)}},current:{speed:(j=c.ocean_current_velocity)==null?void 0:j.at(l),kts:(h=c.ocean_current_velocity)==null?void 0:h.at(l),degree:(Z=c.ocean_current_direction)==null?void 0:Z.at(l),bearing:((g=c.ocean_current_direction)==null?void 0:g.at(l))??null},sst:(K=c.sea_surface_temperature)==null?void 0:K.at(l),height:(X=c.sea_level_height_msl)==null?void 0:X.at(l)},Y.wave=this.parseWave(Y.wave),Y.current.direction=this.degree2Direction(Y.current.degree)}le.push({utc:ee.add(l,"h").format(),weather:{...q},...Y})}return le}static toLegacy(t){return{wind:t.weather.wind,visibility:t.weather.visibility,temp:t.weather.temp,prmsl:t.weather.pmsl,gusts:{kts:t.weather.wind.gusts},precip:t.weather.precip,code:t.weather.code,name:t.weather.name,url:t.weather.url,wave:t.wave,current:t.current,sst:t.sst,height:t.height,utc:t.utc}}static pickDaily(t,s){var r,a,w,E,D,f,_,z,N,B,S,o,i,U,u,L,C,I,M,P,T,H,F,W,R,A,G;const O=typeof s=="string"?y(s):s,p=t.weather,x=t.marine,m=y(p[0].daily.time.at(0)),b=y(p[0].daily.time.at(-1)),V=[];if(O.isBetween(m,b,"millisecond","[]")){let d,j;const h=O.diff(m,"d",!1);if(p)for(const Z of p){const g=Z.daily;d={code:(r=g.weather_code)==null?void 0:r.at(h),temp:{max:(a=g.temperature_2m_max)==null?void 0:a.at(h),min:(w=g.temperature_2m_min)==null?void 0:w.at(h),mean:(E=g.temperature_2m_mean)==null?void 0:E.at(h)},apparentTemp:{max:(D=g.apparent_temperature_max)==null?void 0:D.at(h),min:(f=g.apparent_temperature_min)==null?void 0:f.at(h)},precip:{sum:(_=g.precipitation_sum)==null?void 0:_.at(h),hours:(z=g.precipitation_hours)==null?void 0:z.at(h),probability:(N=g.precipitation_probability_max)==null?void 0:N.at(h)},rh:{max:(B=g.relative_humidity_2m_max)==null?void 0:B.at(h),min:(S=g.relative_humidity_2m_min)==null?void 0:S.at(h),mean:(o=g.relative_humidity_2m_mean)==null?void 0:o.at(h)},wind:{speed:(i=g.wind_speed_10m_max)==null?void 0:i.at(h),kts:(U=g.wind_speed_10m_max)==null?void 0:U.at(h),degree:(u=g.wind_direction_10m_dominant)==null?void 0:u.at(h),gusts:(L=g.wind_gusts_10m_max)==null?void 0:L.at(h)}};const{name:K,url:X,bg:v}=this.parseWeatherCode(d.code,!0);d.name=K,d.url=X,d.bg=v,d.wind.scale=this.beaufort(this.kts2ms(d.wind.kts)),d.wind.direction=this.degree2Direction(d.wind.degree)}if(x)for(const Z of x){const g=Z.daily;j={wave:{sig:{height:(C=g.wave_height_max)==null?void 0:C.at(h),degree:(I=g.wave_direction_dominant)==null?void 0:I.at(h),period:(M=g.wave_period_max)==null?void 0:M.at(h)},swell:{height:(P=g.swell_wave_height_max)==null?void 0:P.at(h),degree:(T=g.wave_direction_dominant)==null?void 0:T.at(h),period:(H=g.swell_wave_period_max)==null?void 0:H.at(h),peakPeriod:(F=g.swell_wave_peak_period_max)==null?void 0:F.at(h)},wd:{height:(W=g.wind_wave_height_max)==null?void 0:W.at(h),degree:(R=g.wind_wave_direction_dominant)==null?void 0:R.at(h),period:(A=g.wind_wave_period_max)==null?void 0:A.at(h),peakPeriod:(G=g.wind_wave_peak_period_max)==null?void 0:G.at(h)}}},j.wave=this.parseWave(j.wave)}V.push({utc:m.add(h,"d").utc().format(),weather:{...d},...j})}return V}static parseWave(t){return t.sig.direction=this.degree2Direction(t.sig.degree),t.swell.direction=this.degree2Direction(t.swell.degree),t.wd.direction=this.degree2Direction(t.wd.degree),t.sig.scale=this.douglas(t.sig.height),t.swell.scale=this.douglas(t.swell.height),t.wd.scale=this.douglas(t.wd.height),t}static parseWeatherCode(t,s){const r=this.weatherCode(t);return(s?r.day:r.night)||{}}static weatherCode(t){const s={code:t};switch(t){case 0:s.day={name:"Sunny",url:"https://osshz.idmwx.com/asset/weather/01d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg1.png"},s.night={name:"Clear",url:"https://osshz.idmwx.com/asset/weather/01n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg1.png"};break;case 1:s.day={name:"Mainly Sunny",url:"https://osshz.idmwx.com/asset/weather/01d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg1.png"},s.night={name:"Mainly Clear",url:"https://osshz.idmwx.com/asset/weather/01n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg1.png"};break;case 2:s.day={name:"Partly Cloudy",url:"https://osshz.idmwx.com/asset/weather/02d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg2.png"},s.night={name:"Partly Cloudy",url:"https://osshz.idmwx.com/asset/weather/02n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg2.png"};break;case 3:s.day={name:"Overcast",url:"https://osshz.idmwx.com/asset/weather/04d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg3.png"},s.night={name:"Overcast",url:"https://osshz.idmwx.com/asset/weather/04n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg3.png"};break;case 45:s.day={name:"Foggy",url:"https://osshz.idmwx.com/asset/weather/50d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg4.png"},s.night={name:"Foggy",url:"https://osshz.idmwx.com/asset/weather/50n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg4.png"};break;case 48:s.day={name:"Rime Fog",url:"https://osshz.idmwx.com/asset/weather/50d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg4.png"},s.night={name:"Rime Fog",url:"https://osshz.idmwx.com/asset/weather/50n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg4.png"};break;case 51:s.day={name:"Light Drizzle",url:"https://osshz.idmwx.com/asset/weather/14d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Light Drizzle",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 53:s.day={name:"Drizzle",url:"https://osshz.idmwx.com/asset/weather/14d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Drizzle",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 55:s.day={name:"Heavy Drizzle",url:"https://osshz.idmwx.com/asset/weather/15d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Heavy Drizzle",url:"https://osshz.idmwx.com/asset/weather/15n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 56:s.day={name:"Light Freezing Drizzle",url:"https://osshz.idmwx.com/asset/weather/14d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Light Freezing Drizzle",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 57:s.day={name:"Freezing Drizzle",url:"https://osshz.idmwx.com/asset/weather/14d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Freezing Drizzle",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 61:s.day={name:"Light Rain",url:"https://osshz.idmwx.com/asset/weather/16d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Light Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 63:s.day={name:"Rain",url:"https://osshz.idmwx.com/asset/weather/16d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 65:s.day={name:"Heavy Rain",url:"https://osshz.idmwx.com/asset/weather/16d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Heavy Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 66:s.day={name:"Light Freezing Rain",url:"https://osshz.idmwx.com/asset/weather/16d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Light Freezing Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 67:s.day={name:"Freezing Rain",url:"https://osshz.idmwx.com/asset/weather/16d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Freezing Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 71:s.day={name:"Light Snow",url:"https://osshz.idmwx.com/asset/weather/17d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"},s.night={name:"Light Snow",url:"https://osshz.idmwx.com/asset/weather/13n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"};break;case 73:s.day={name:"Snow",url:"https://osshz.idmwx.com/asset/weather/17d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"},s.night={name:"Snow",url:"https://osshz.idmwx.com/asset/weather/13n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"};break;case 75:s.day={name:"Heavy Snow",url:"https://osshz.idmwx.com/asset/weather/17d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"},s.night={name:"Heavy Snow",url:"https://osshz.idmwx.com/asset/weather/13n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"};break;case 77:s.day={name:"Snow Grains",url:"https://osshz.idmwx.com/asset/weather/17d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"},s.night={name:"Snow Grains",url:"https://osshz.idmwx.com/asset/weather/13n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"};break;case 80:s.day={name:"Light Showers",url:"https://osshz.idmwx.com/asset/weather/09d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Light Showers",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 81:s.day={name:"Showers",url:"https://osshz.idmwx.com/asset/weather/09d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Showers",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 82:s.day={name:"Heavy Showers",url:"https://osshz.idmwx.com/asset/weather/09d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Heavy Showers",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 85:s.day={name:"Light Snow Showers",url:"https://osshz.idmwx.com/asset/weather/13d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"},s.night={name:"Light Snow Showers",url:"https://osshz.idmwx.com/asset/weather/13n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"};break;case 86:s.day={name:"Snow Showers",url:"https://osshz.idmwx.com/asset/weather/13d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"},s.night={name:"Snow Showers",url:"https://osshz.idmwx.com/asset/weather/13n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"};break;case 95:s.day={name:"Thunderstorm",url:"https://osshz.idmwx.com/asset/weather/11d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Thunderstorm",url:"https://osshz.idmwx.com/asset/weather/11n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 96:s.day={name:"Light Thunderstorms With Hail",url:"https://osshz.idmwx.com/asset/weather/11d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Light Thunderstorms With Hail",url:"https://osshz.idmwx.com/asset/weather/11n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 99:s.day={name:"Thunderstorms With Hail",url:"https://osshz.idmwx.com/asset/weather/11d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Thunderstorms With Hail",url:"https://osshz.idmwx.com/asset/weather/11n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break}return s}static kts2ms(t){return isNaN(t)||t===null?t:Math.round(t*1852/3600*1e4)/1e4}static kts2kmh(t){return isNaN(t)||t===null?t:t*1.852}static m2nm(t){return isNaN(t)||t===null?t:Math.round(t/1e3/1.852*1e4)/1e4}static kmh2kts(t){return isNaN(t)||t===null?t:this.ms2kts(t*1e3/3600)}static ms2kts(t){return isNaN(t)||t===null?t:Math.round(t*3600/1852*1e4)/1e4}static degree2Radian(t){if(isNaN(t)||t===null)return t;let s=t%360/360*2*Math.PI;return s=s<0?s+2*Math.PI:s,s}static degree2Direction(t){const s=this.degree2Radian(t);if(isNaN(s)||s===null)return null;let r="N/A";const a=Math.PI/16;return s<a?r="N":s>=a&&s<3*a?r="NNE":s>=3*a&&s<5*a?r="NE":s>=5*a&&s<7*a?r="ENE":s>=7*a&&s<9*a?r="E":s>=9*a&&s<11*a?r="ESE":s>=11*a&&s<13*a?r="SE":s>=13*a&&s<15*a?r="SSE":s>=15*a&&s<17*a?r="S":s>=17*a&&s<19*a?r="SSW":s>=19*a&&s<21*a?r="SW":s>=21*a&&s<23*a?r="WSW":s>=23*a&&s<25*a?r="W":s>=25*a&&s<27*a?r="WNW":s>=27*a&&s<29*a?r="NW":s>=29*a&&s<31*a?r="NNW":s>=31*a&&s<32*a&&(r="N"),r}static beaufort(t){let s=0;return isNaN(t)||(t=Math.round(t*10)/10,t<=.2?s=0:t<=1.5?s=1:t<=3.3?s=2:t<=5.4?s=3:t<=7.9?s=4:t<=10.7?s=5:t<=13.8?s=6:t<=17.1?s=7:t<=20.7?s=8:t<=22.4?s=9:t<=28.4?s=10:t<=32.6?s=11:t>32.6&&(s=12)),s}static douglas(t){let s="Calm";return isNaN(t)||t<=.1?s="Calm":t<=.5?s="Smooth":t<=1.25?s="Slight":t<=2.5?s="Moderate":t<=4?s="Rough":t<=6?s="VeryRough":t<=9?s="High":t<=14?s="VeryHigh":s="Precipitous",s}}const mt="",me=(n,t)=>{const s=n.__vccOpts||n;for(const[r,a]of t)s[r]=a;return s},pe={name:"SpotReport",props:{token:{type:String,default:""},ts:{type:String,default:y().utc().format()},timeZone:{type:Number,default:8},report:{type:Object,default:()=>({})}},emits:["url"],data(){return{placeholder:"search for port name or coordinates",searchName:void 0,rawSearchIcon:e.markRaw(ce.Search),positionGmt:void 0,issuedDate:void 0,meteoData:{},a:void 0,positionList:[],position:void 0,loading:!0,activeIndex:void 0,tableData:{},pickedDate:void 0,pickedWeek:"Today",collectList:[],isCollected:!1}},computed:{computeHourL(){return function(n){return n?`${J(n).tz(this.positionGmt).format("HH")}`:"-"}},computeHourZ(){return function(n){return n?`${y(n).utc().format("HH")}Z`:"-"}},computeWeek(){return function(n){return n?`${J(n).tz(this.positionGmt).format("dddd")}`:"-"}},computeMMMDD(){return function(n){return n?`${J(n).tz(this.positionGmt).format("MMM-DD")}`:"-"}},computeLat(){return function(n,t=4){return $.LngLatHelper.lat2pretty(n,t).pretty}},computeLng(){return function(n,t=4){return $.LngLatHelper.lng2pretty(n,t).pretty}},roundPrecision(){return function(n,t=4){return isNaN(n)?"-":$.LngLatHelper.roundPrecision(n,t)}}},watch:{"report.version":{handler(){var n,t,s;this.report&&(this.meteoData=this.report,this.position={id:this.report.portId,lat:(n=this.report)==null?void 0:n.lat,lng:(t=this.report)==null?void 0:t.lng,name:((s=this.report)==null?void 0:s.searchName)||this.computeLat(this.report.lat)+","+this.computeLng(this.report.lng)},this.handleRender())}}},methods:{handleRender(){this.initInfo(),this.initTableData(),this.$nextTick(()=>{this.initEchart()})},initInfo(){var n,t;this.loading=!1,this.positionGmt=(t=(n=this.meteoData.weather)==null?void 0:n[0])==null?void 0:t.timezone,this.issuedDate=y(this.ts).utc().format("MMM-DD/HHmm[Z], YYYY"),this.activeIndex=J(this.ts).tz(this.positionGmt).hour(),this.pickedDate=J(this.ts).tz(this.positionGmt).set({hour:0,minute:0,second:0,millisecond:0}).format(),this.collectList=JSON.parse(localStorage.getItem("idmCollectList")||"[]"),this.positionList=JSON.parse(JSON.stringify(this.collectList)),this.isCollected=this.collectList.some(s=>{var r;return s.name===((r=this.position)==null?void 0:r.name)})},initTableData(){var n,t,s,r,a,w,E,D,f,_,z,N,B,S,o,i,U,u,L,C,I,M,P,T,H,F,W,R,A,G,O,p,x,m;this.tableData={hours:[],utcHours:[],weatherUrls:[],weatherNames:[],temp:[],precipProbability:[],precip1h:[],visibility:[],humidity:[],windSpeed:[],windDir:[],windGust:[],sigwaveHeight:[],sigwaveDir:[],windwaveHeight:[],windwaveDir:[],windwavePeriod:[],swellHeight:[],swellDir:[],swellPeriod:[],currentSpeed:[],currentDir:[],seaLevel:[],seaTemp:[]};for(let b=0;b<24;b++){const V=y(this.pickedDate).clone().add(b,"h").format();this.tableData.hours.push(V);const d=((n=oe.pickHourly(this.meteoData,V))==null?void 0:n[0])||{};this.tableData.weatherUrls.push((t=d.weather)==null?void 0:t.url),this.tableData.weatherNames.push(((s=d.weather)==null?void 0:s.name)??"-"),this.tableData.temp.push(this.roundPrecision((r=d.weather)==null?void 0:r.temp,0)??"-"),this.tableData.precipProbability.push(this.roundPrecision((w=(a=d.weather)==null?void 0:a.precip)==null?void 0:w.probability,0)??"-"),this.tableData.precip1h.push(this.roundPrecision((D=(E=d.weather)==null?void 0:E.precip)==null?void 0:D.sum,0)??"-"),this.tableData.visibility.push(this.roundPrecision((f=d.weather)==null?void 0:f.visibility,0)??"-"),this.tableData.humidity.push(this.roundPrecision((_=d.weather)==null?void 0:_.rh,0)??"-"),this.tableData.windSpeed.push(this.roundPrecision((N=(z=d.weather)==null?void 0:z.wind)==null?void 0:N.kts,1)),this.tableData.windDir.push((S=(B=d.weather)==null?void 0:B.wind)==null?void 0:S.bearing),this.tableData.windGust.push(this.roundPrecision((i=(o=d.weather)==null?void 0:o.wind)==null?void 0:i.gusts,1)??"-"),this.tableData.sigwaveHeight.push(this.roundPrecision((u=(U=d.wave)==null?void 0:U.sig)==null?void 0:u.height,1)??"-"),this.tableData.sigwaveDir.push((C=(L=d.wave)==null?void 0:L.sig)==null?void 0:C.bearing),this.tableData.windwaveHeight.push(this.roundPrecision((M=(I=d.wave)==null?void 0:I.wd)==null?void 0:M.height,1)??"-"),this.tableData.windwaveDir.push((T=(P=d.wave)==null?void 0:P.wd)==null?void 0:T.bearing),this.tableData.windwavePeriod.push(this.roundPrecision((F=(H=d.wave)==null?void 0:H.wd)==null?void 0:F.period,1)??"-"),this.tableData.swellHeight.push(this.roundPrecision((R=(W=d.wave)==null?void 0:W.swell)==null?void 0:R.height,1)??"-"),this.tableData.swellDir.push((G=(A=d.wave)==null?void 0:A.swell)==null?void 0:G.bearing),this.tableData.swellPeriod.push(this.roundPrecision((p=(O=d.wave)==null?void 0:O.swell)==null?void 0:p.period,1)??"-"),this.tableData.currentSpeed.push(this.roundPrecision((x=d.current)==null?void 0:x.speed,1)??"-"),this.tableData.currentDir.push((m=d.current)==null?void 0:m.bearing),this.tableData.seaLevel.push(this.roundPrecision(d.height,1)??"-"),this.tableData.seaTemp.push(this.roundPrecision(d.sst,0)??"-")}},initEchart(){var L,C,I,M,P,T,H,F,W,R,A,G,O;const n=[],t=[],s=[],r=[],a=[],w=[],E=[],D=[],f=[],_=[],z={};for(let p=0;p<7;p++){const x=y(this.pickedDate).clone().add(p,"d");n.push(J(x).tz(this.positionGmt).format("yyyy-MM-DD")),t.push(this.computeMMMDD(x)),s.push(p===0?"Today":this.computeWeek(x));const m=((L=oe.pickDaily(this.meteoData,x))==null?void 0:L[0])||{};r.push(this.roundPrecision((I=(C=m.weather)==null?void 0:C.temp)==null?void 0:I.min,0)),a.push(this.roundPrecision((P=(M=m.weather)==null?void 0:M.temp)==null?void 0:P.max,0)),D.push(this.roundPrecision((H=(T=m.weather)==null?void 0:T.wind)==null?void 0:H.kts,1)??"- kts"),_.push(this.roundPrecision((W=(F=m.weather)==null?void 0:F.precip)==null?void 0:W.sum,0)??"- mm"),w.push({symbol:"image://"+((R=m.weather)==null?void 0:R.url)}),E.push((A=m.weather)==null?void 0:A.name),f.push((O=(G=m.weather)==null?void 0:G.wind)==null?void 0:O.degree)}const N=Math.max(...a.filter(p=>typeof p=="number"&&!isNaN(p)))-Math.min(...r.filter(p=>typeof p=="number"&&!isNaN(p))),B=Math.min(...r.filter(p=>typeof p=="number"&&!isNaN(p)))-1.5*N,S=Math.max(...a.filter(p=>typeof p=="number"&&!isNaN(p)))+2*N,o=4+.5/n.length*92+"%",i="data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent('<svg t="1740385441519" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10951" width="200" height="200"><path d="M512 804.83593751A276.87183211 276.87183211 0 0 1 235.12816789 527.9641054Q235.12816789 375.21005376 512 13.82031251q276.87183211 361.30792288 276.87183211 514.14379289a276.87183211 276.87183211 0 0 1-276.87183211 276.87183211zM294.4461577 527.9641054a217.47202472 217.47202472 0 0 0 217.5538423 217.55384231 19.79993605 19.79993605 0 1 0 0-39.51805453 177.9539702 177.9539702 0 0 1-177.9539702-178.03578778 19.79993605 19.79993605 0 0 0-39.5998721 0z" fill="#0c73a8" p-id="10952"></path></svg>'))),U="data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent('<svg t="1740383449285" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10797" width="200" height="200"><path d="M133.8 579l-44.4-44.4c-18.8-18.8-18.8-49.2 0-67.8L478 78c18.8-18.8 49.2-18.8 67.8 0l388.6 388.6c18.8 18.8 18.8 49.2 0 67.8L890 578.8c-19 19-50 18.6-68.6-0.8L592 337.2V912c0 26.6-21.4 48-48 48h-64c-26.6 0-48-21.4-48-48V337.2L202.4 578.2c-18.6 19.6-49.6 20-68.6 0.8z" fill="#ffffff" p-id="10798"></path></svg>'))),u=new Image(64,64);u.src=U,u.onload=()=>{for(let m=0;m<7;m++){const b=document.createElement("canvas"),V=b.getContext("2d");b.width=u.width,b.height=u.height;const j=f[m]*(Math.PI/180);V.translate(b.width/2,b.height/2),V.rotate(j),V.translate(-u.width/2,-u.height/2),V.drawImage(u,0,0,64,64);const h=b.toDataURL();z[`WindIcon${m}`]={height:12,width:12,align:"left",backgroundColor:{image:h}}}const p=ae.init(document.getElementById("weather-chart")),x={grid:{bottom:0,top:0,left:"4%",right:"4%"},tooltip:{trigger:"item",show:!0,position:"right",formatter:function(m){return m.seriesName==="Weather Icon"?E[m.dataIndex]:!1}},legend:{show:!1},xAxis:{left:0,right:0,top:"50%",height:"50%",type:"category",data:n,show:!1},singleAxis:[{left:o,right:o,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:n,top:"7%",height:"2%"},{left:o,right:o,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:n,top:"16%",height:"2%"},{left:o,right:o,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:n,top:"27%",height:"2%"},{left:o,right:o,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:n,top:"84%",height:"2%"},{left:o,right:o,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:n,top:"93%",height:"2%"}],yAxis:{type:"value",name:"温度(℃)",show:!1,min:B,max:S,axisLabel:{formatter:"{value} °C"}},series:[{singleAxisIndex:0,coordinateSystem:"singleAxis",type:"scatter",data:s,label:{show:!0,color:"#fff",fontSize:14,formatter:"{c}"},symbolSize:0},{singleAxisIndex:1,coordinateSystem:"singleAxis",type:"scatter",data:t,label:{show:!0,color:"#fff",formatter:"{c}"},symbolSize:0},{name:"Weather Icon",singleAxisIndex:2,coordinateSystem:"singleAxis",type:"scatter",data:w,symbolSize:36},{name:"温度(℃)",type:"line",data:r,smooth:!0,itemStyle:{color:"rgba(255,255,255,0.7)"},label:{show:!0,color:"rgba(255,255,255,1)",position:[-10,12],formatter:"{c} °C",fontSize:12},markArea:{itemStyle:{color:"rgb(71,143,206)"},data:[[{x:"4%"},{x:4+1/n.length*92+"%"}]]}},{name:"温度(℃)",type:"line",data:a,smooth:!0,itemStyle:{color:"rgba(255,255,255,0.7)"},label:{show:!0,color:"rgba(255,255,255,1)",position:[-10,-12],formatter:"{c} °C",fontSize:12}},{singleAxisIndex:3,coordinateSystem:"singleAxis",type:"scatter",data:D,label:{show:!0,color:"#fff",rich:{...z,title:{align:"center",vertical:"center"}},formatter:function(m){return`{WindIcon${m.dataIndex}|}{title|${m.value}} kts`}},symbolSize:0},{singleAxisIndex:4,coordinateSystem:"singleAxis",type:"scatter",data:_,label:{show:!0,color:"#fff",rich:{dIcon:{height:16,width:16,align:"left",backgroundColor:{image:i}},title:{align:"center",vertical:"center"}},formatter:function(m){return`{dIcon|}{title|${m.value}} mm`}},symbolSize:0}]};p.setOption(x),p.on("click",m=>{const b=m.dataIndex;this.pickedDate=J(n[b]).tz(this.positionGmt).set({hour:0,minute:0,second:0,millisecond:0}).format(),this.pickedWeek=b===0?"Today":this.computeWeek(this.pickedDate),this.activeIndex=b===0?J(this.ts).tz(this.positionGmt).hour():void 0,this.initTableData(),x.series[3].markArea={itemStyle:{color:"rgb(71,143,206)"},data:[[{x:4+b/n.length*92+"%"},{x:4+(b+1)/n.length*92+"%"}]]},p.setOption(x)})}},handleCollect(){this.isCollected=!this.isCollected,this.isCollected?this.collectList.push({name:this.position.name,lat:this.position.lat,lng:this.position.lng}):this.collectList=this.collectList.filter(n=>n.name!==this.position.name),localStorage.setItem("idmCollectList",JSON.stringify(this.collectList))},async fetchSuggestPosition(n){var r;const t=n.replaceAll(",",",");if(!t)return this.positionList=this.collectList,!1;const s=await se.get(`https://cbe.idmwx.com/api/arc/ports/suggest?n=${t}`,{headers:{Authorization:this.token}});(s==null?void 0:s.data.code)===0&&(this.positionList=(r=s==null?void 0:s.data.data)==null?void 0:r.map(a=>(a.name=a.id?a.name:this.computeLat(a.lat)+", "+this.computeLng(a.lng),a)))},async handleFetchMeteo(){var s,r,a;if(!this.searchName)return!1;this.position={portId:(s=this.positionList.find(w=>w.name===this.searchName))==null?void 0:s.id,lat:(r=this.positionList.find(w=>w.name===this.searchName))==null?void 0:r.lat,lng:(a=this.positionList.find(w=>w.name===this.searchName))==null?void 0:a.lng,name:this.searchName},this.$emit("url",this.position),this.handleClear();const n={lat:this.position.lat,lng:this.position.lng,forecastDays:8,selfHosted:!1},t=await se.post("https://cbe.idmwx.com/api/arc/meteo2/spot/forecast",n,{headers:{Authorization:this.token}});(t==null?void 0:t.data.code)===0&&(this.meteoData={...t==null?void 0:t.data.data}),this.handleRender()},handleClear(){this.loading=!0,this.meteoData={},this.isCollected=!1,ae.dispose(document.getElementById("weather-chart"))}}},ge={class:"spot-report"},we={class:"header-box flex-between"},be={class:"bg"},xe={class:"search-box flex-start"},ue={class:"content-box"},ke={class:"title-box flex-between"},ye={class:"main-title"},fe={class:"sub-title"},_e={class:"flex-end"},ze={key:0,id:"weather-chart"},Ne={key:1,class:"weather-chart flex-center"},Ee={key:2,class:"weather-chart flex-center"},De={key:3,class:"card-box"},Be={class:"date"},Se={class:"basic-table"},Ve={class:"day"},Le={class:"hour"},Ce={class:"icon"},Ie=["src"],Me={class:"text"},Pe={class:"text"},Te={class:"text"},He={class:"text"},Fe={class:"text"},We={class:"text"},Re={key:1},Ae={class:"text"},Ge={class:"text"},Oe={class:"wave-current-table"},qe={class:"text"},Ue={class:"text"},je={key:1},Je={class:"text"},Ze={class:"text"},Ye={class:"text"},Qe={key:1},Ke={class:"text"},Xe={class:"text"},ve={class:"text"},$e={key:1},et={class:"text"},tt={class:"sea-table"},st={class:"text"},at={class:"text"},ot={key:4,class:"card-box flex-center"},nt={key:5,class:"card-box flex-center"};function it(n,t,s,r,a,w){var _,z,N,B,S;const E=e.resolveComponent("ElOption"),D=e.resolveComponent("ElSelect"),f=e.resolveComponent("ElTooltip");return e.openBlock(),e.createElementBlock("div",ge,[e.createElementVNode("div",we,[e.createElementVNode("div",be,[e.createElementVNode("div",xe,[e.createVNode(D,{modelValue:a.searchName,"onUpdate:modelValue":t[0]||(t[0]=o=>a.searchName=o),filterable:"",class:"input",clearable:"",remote:"",placeholder:a.placeholder,autocomplete:"","remote-show-suffix":"",onFocus:t[1]||(t[1]=o=>a.placeholder=""),onBlur:t[2]||(t[2]=o=>a.placeholder="search for port name or coordinates"),"remote-method":w.fetchSuggestPosition,onChange:w.handleFetchMeteo},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.positionList,o=>(e.openBlock(),e.createBlock(E,{key:o.name,label:o.name,value:o.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","remote-method","onChange"])])])]),e.createElementVNode("div",ue,[e.createElementVNode("div",ke,[e.createElementVNode("div",null,[e.createElementVNode("div",ye,"Weather forecast for "+e.toDisplayString(((_=a.position)==null?void 0:_.name)||"-")+" ( "+e.toDisplayString(a.positionGmt)+" )",1),e.createElementVNode("div",fe,"At "+e.toDisplayString((z=a.position)!=null&&z.portId?"port":"coordinates")+", issued "+e.toDisplayString(a.issuedDate),1)]),e.createElementVNode("div",_e,[e.createVNode(f,{placement:"left",effect:"light",content:a.isCollected?"remove the port/coordinate from the search list":"add the port/coordinate to the search list","show-after":1e3},{default:e.withCtx(()=>[a.isCollected?(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon active",onClick:t[3]||(t[3]=(...o)=>w.handleCollect&&w.handleCollect(...o))},"")):(e.openBlock(),e.createElementBlock("span",{key:1,class:"iconfont icon",onClick:t[4]||(t[4]=(...o)=>w.handleCollect&&w.handleCollect(...o))},""))]),_:1},8,["content"])])]),(N=a.position)!=null&&N.name&&!a.loading?(e.openBlock(),e.createElementBlock("div",ze)):a.loading?(e.openBlock(),e.createElementBlock("div",Ne,"Loading....")):a.position.name?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ee,"No Data")),(B=a.position)!=null&&B.name&&!a.loading?(e.openBlock(),e.createElementBlock("div",De,[e.createElementVNode("div",Be,e.toDisplayString(a.pickedWeek)+" "+e.toDisplayString(w.computeMMMDD(a.pickedDate)),1),e.createElementVNode("table",Se,[e.createElementVNode("tr",Ve,[t[5]||(t[5]=e.createElementVNode("th",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Local time"),e.createElementVNode("span",{class:"unit"},"(LT)")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.hours,(o,i)=>(e.openBlock(),e.createElementBlock("th",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+"local"},e.toDisplayString(w.computeHourL(o)),3))),128))]),e.createElementVNode("tr",Le,[t[6]||(t[6]=e.createElementVNode("th",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("UTC"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.hours,(o,i)=>(e.openBlock(),e.createElementBlock("th",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+"z"},e.toDisplayString(w.computeHourZ(o)),3))),128))]),e.createElementVNode("tr",Ce,[t[7]||(t[7]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Weather"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.weatherUrls,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+"url"},[e.createVNode(f,{placement:"top",effect:"light",content:a.tableData.weatherNames[i],"show-after":500},{default:e.withCtx(()=>[o?(e.openBlock(),e.createElementBlock("img",{key:0,class:"iconfont weather-icon",src:o},null,8,Ie)):e.createCommentVNode("",!0)]),_:2},1032,["content"])],2))),128))]),e.createElementVNode("tr",Me,[t[8]||(t[8]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Temperature"),e.createElementVNode("span",{class:"unit"},"°C")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.temp,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+o},e.toDisplayString(o),3))),128))]),e.createElementVNode("tr",Pe,[t[9]||(t[9]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Precipitation Probability"),e.createElementVNode("span",{class:"unit"},"%")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.precipProbability,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+o},e.toDisplayString(o),3))),128))]),e.createElementVNode("tr",Te,[t[10]||(t[10]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Precipitation 1h"),e.createElementVNode("span",{class:"unit"},"mm")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.precip1h,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+o},e.toDisplayString(o),3))),128))]),e.createElementVNode("tr",He,[t[11]||(t[11]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Visibility"),e.createElementVNode("span",{class:"unit"},"nm")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.visibility,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+o},e.toDisplayString(o),3))),128))]),e.createElementVNode("tr",Fe,[t[12]||(t[12]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Relative Humidity"),e.createElementVNode("span",{class:"unit"},"%")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.humidity,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+o},e.toDisplayString(o),3))),128))]),e.createElementVNode("tr",We,[t[13]||(t[13]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind direction"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windDir,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+o},[isNaN(o)?(e.openBlock(),e.createElementBlock("span",Re,"-")):(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon",style:e.normalizeStyle({display:"inline-block",transform:`rotate(${o}deg)`})},"",4))],2))),128))]),e.createElementVNode("tr",Ae,[t[14]||(t[14]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind speed"),e.createElementVNode("span",{class:"unit"},"kts")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windSpeed,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+o},e.toDisplayString(o),3))),128))]),e.createElementVNode("tr",Ge,[t[15]||(t[15]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind gust"),e.createElementVNode("span",{class:"unit"},"kts")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windGust,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+o},e.toDisplayString(o),3))),128))])]),t[27]||(t[27]=e.createElementVNode("div",{style:{"text-align":"center",padding:"3px"}},null,-1)),e.createElementVNode("table",Oe,[e.createElementVNode("tr",qe,[t[16]||(t[16]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind wave height"),e.createElementVNode("span",{class:"unit"},"m")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windwaveHeight,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+o},e.toDisplayString(o),3))),128))]),e.createElementVNode("tr",Ue,[t[17]||(t[17]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind wave direction"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windwaveDir,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+o},[isNaN(o)?(e.openBlock(),e.createElementBlock("span",je,"-")):(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon",style:e.normalizeStyle({display:"inline-block",transform:`rotate(${o}deg)`})},"",4))],2))),128))]),e.createElementVNode("tr",Je,[t[18]||(t[18]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind wave period"),e.createElementVNode("span",{class:"unit"},"s")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windwavePeriod,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+o},e.toDisplayString(o),3))),128))]),e.createElementVNode("tr",Ze,[t[19]||(t[19]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Swell height"),e.createElementVNode("span",{class:"unit"},"m")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.swellHeight,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+o},e.toDisplayString(o),3))),128))]),e.createElementVNode("tr",Ye,[t[20]||(t[20]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Swell direction"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.swellDir,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+o},[isNaN(o)?(e.openBlock(),e.createElementBlock("span",Qe,"-")):(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon",style:e.normalizeStyle({display:"inline-block",transform:`rotate(${o}deg)`})},"",4))],2))),128))]),e.createElementVNode("tr",Ke,[t[21]||(t[21]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Swell period"),e.createElementVNode("span",{class:"unit"},"s")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.swellPeriod,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+o},e.toDisplayString(o),3))),128))]),e.createElementVNode("tr",Xe,[t[22]||(t[22]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Sig wave height"),e.createElementVNode("span",{class:"unit"},"m")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.sigwaveHeight,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+o},e.toDisplayString(o),3))),128))]),e.createElementVNode("tr",ve,[t[23]||(t[23]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Current direction"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.currentDir,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+o},[isNaN(o)?(e.openBlock(),e.createElementBlock("span",$e,"-")):(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon",style:e.normalizeStyle({display:"inline-block",transform:`rotate(${o}deg)`})},"",4))],2))),128))]),e.createElementVNode("tr",et,[t[24]||(t[24]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Current speed"),e.createElementVNode("span",{class:"unit"},"kts")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.currentSpeed,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+o},e.toDisplayString(o),3))),128))])]),t[28]||(t[28]=e.createElementVNode("div",{style:{"text-align":"center",padding:"3px"}},null,-1)),e.createElementVNode("table",tt,[e.createElementVNode("tr",st,[t[25]||(t[25]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Sea level height"),e.createElementVNode("span",{class:"unit"},"m")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.seaLevel,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+o},e.toDisplayString(o),3))),128))]),e.createElementVNode("tr",at,[t[26]||(t[26]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Sea surface temperature"),e.createElementVNode("span",{class:"unit"},"°C")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.seaTemp,(o,i)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===i?"active":""),key:Math.random()+o},e.toDisplayString(o),3))),128))])])])):a.loading?(e.openBlock(),e.createElementBlock("div",ot,"Loading....")):(S=a.position)!=null&&S.name?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",nt,"No Data"))])])}const ne=me(pe,[["render",it],["__scopeId","data-v-299b53fa"]]),rt={install(n){n.component("SpotReport",ne)}};k.SpotReport=ne,k.SpotReportPlugin=rt,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idmui/spot",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.5",
|
|
5
5
|
"description": "idm ui spot",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"keywords": [
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@element-plus/icons-vue": "^2.1.0",
|
|
31
31
|
"@idm-plugin/geo": "^1.5.7",
|
|
32
|
-
"@idm-plugin/meteo": "^0.
|
|
32
|
+
"@idm-plugin/meteo": "^0.2.4",
|
|
33
33
|
"@idmui/brand": "^0.0.2",
|
|
34
34
|
"@idmui/style": "^0.1.4",
|
|
35
35
|
"axios": "^1.3.5",
|