@idmui/spot 0.1.0 → 0.1.2
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 +352 -320
- package/dist/index.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(y,k){typeof exports=="object"&&typeof module<"u"?k(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"],k):(y=typeof globalThis<"u"?globalThis:y||self,k(y["idmui-report"]={},y.moment,y["moment-timezone"],y["@element-plus/icons-vue"],y["@idm-plugin/geo"],y.echarts,y.Vue,y.axios))})(this,function(y,k,U,ie,Y,re,e,X){"use strict";function le(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const s in o)if(s!=="default"){const l=Object.getOwnPropertyDescriptor(o,s);Object.defineProperty(t,s,l.get?l:{enumerable:!0,get:()=>o[s]})}}return t.default=o,Object.freeze(t)}const v=le(re);class ${static pickHourly(t,s){var l,a,w,E,D,f,x,b,_,B,z,n,i,R,u,L,C,I,M,P,T,H,F,W,V,A,S,G,p,g,m,c,N,r,j,q,te,se;const ae=typeof s=="string"?k(s):s,J=t.weather,ot=t.marine,ne=k(J[0].hourly.date).utc(),Q=ne.clone().add(J[0].hourly.time.at(0),"h"),it=ne.clone().add(J[0].hourly.time.at(-1),"h"),oe=[];if(ae.isBetween(Q,it,"millisecond","[]")){const d=ae.utc().diff(Q,"h",!1);let O,Z;for(const K of J){const h=K.hourly;O={temp:(l=h.temperature_2m)==null?void 0:l.at(d),apparentTemp:(a=h.apparent_temperature)==null?void 0:a.at(d),rh:(w=h.relative_humidity_2m)==null?void 0:w.at(d),dp:(E=h.dew_point_2m)==null?void 0:E.at(d),precip:{probability:(D=h.precipitation_probability)==null?void 0:D.at(d),sum:(f=h.precipitation)==null?void 0:f.at(d)},code:(x=h.weather_code)==null?void 0:x.at(d),visibility:this.m2nm((b=h.visibility)==null?void 0:b.at(d)),wind:{speed:(_=h.wind_speed_10m)==null?void 0:_.at(d),kts:(B=h.wind_speed_10m)==null?void 0:B.at(d),degree:(z=h.wind_direction_10m)==null?void 0:z.at(d),bearing:((n=h.wind_direction_10m)==null?void 0:n.at(d))!==null?(((i=h.wind_direction_10m)==null?void 0:i.at(d))+180)%360:null,gusts:(R=h.wind_gusts_10m)==null?void 0:R.at(d)},isDay:(u=h.is_day)==null?void 0:u.at(d)};const{name:rt,url:lt}=this.parseWeatherCode(O.code,O.isDay);O.name=rt,O.url=lt,O.wind.scale=this.beaufort(this.kts2ms(O.wind.kts)),O.wind.direction=this.degree2Direction(O.wind.degree)}for(const K of ot){const h=K.hourly;Z={wave:{sig:{height:(L=h.wave_height)==null?void 0:L.at(d),degree:(C=h.wave_direction)==null?void 0:C.at(d),bearing:((I=h.wave_direction)==null?void 0:I.at(d))!==null?(((M=h.wave_direction)==null?void 0:M.at(d))+180)%360:null,period:(P=h.wave_period)==null?void 0:P.at(d)},swell:{height:(T=h.swell_wave_height)==null?void 0:T.at(d),degree:(H=h.swell_wave_direction)==null?void 0:H.at(d),bearing:((F=h.swell_wave_direction)==null?void 0:F.at(d))!==null?(((W=h.swell_wave_direction)==null?void 0:W.at(d))+180)%360:null,period:(V=h.swell_wave_period)==null?void 0:V.at(d),peakPeriod:(A=h.swell_wave_peak_period)==null?void 0:A.at(d)},wd:{height:(S=h.wind_wave_height)==null?void 0:S.at(d),degree:(G=h.wind_wave_direction)==null?void 0:G.at(d),bearing:((p=h.wind_wave_direction)==null?void 0:p.at(d))!==null?(((g=h.wind_wave_direction)==null?void 0:g.at(d))+180)%360:null,period:(m=h.wind_wave_period)==null?void 0:m.at(d),peakPeriod:(c=h.wind_wave_peak_period)==null?void 0:c.at(d)}},current:{speed:(N=h.ocean_current_velocity)==null?void 0:N.at(d),kts:(r=h.ocean_current_velocity)==null?void 0:r.at(d),degree:(j=h.ocean_current_direction)==null?void 0:j.at(d),bearing:((q=h.ocean_current_direction)==null?void 0:q.at(d))??null},sst:(te=h.sea_surface_temperature)==null?void 0:te.at(d),height:(se=h.sea_level_height_msl)==null?void 0:se.at(d)},Z.wave=this.parseWave(Z.wave),Z.current.direction=this.degree2Direction(Z.current.degree)}oe.push({utc:Q.add(d,"h").format(),weather:{...O},...Z})}return oe}static pickDaily(t,s){var l,a,w,E,D,f,x,b,_,B,z,n,i,R,u,L,C,I,M,P,T,H,F;const W=typeof s=="string"?k(s):s,V=t.weather,A=t.marine,S=k(V[0].daily.time.at(0)),G=k(V[0].daily.time.at(-1)),p=[];if(W.isBetween(S,G,"millisecond","[]")){let g,m;const c=W.diff(S,"d",!1);for(const N of V){const r=N.daily;g={code:(l=r.weather_code)==null?void 0:l.at(c),temp:{max:(a=r.temperature_2m_max)==null?void 0:a.at(c),min:(w=r.temperature_2m_min)==null?void 0:w.at(c)},apparentTemp:{max:(E=r.apparent_temperature_max)==null?void 0:E.at(c),min:(D=r.apparent_temperature_min)==null?void 0:D.at(c)},precip:{sum:(f=r.precipitation_sum)==null?void 0:f.at(c),hours:(x=r.precipitation_hours)==null?void 0:x.at(c),probability:(b=r.precipitation_probability_max)==null?void 0:b.at(c)},wind:{speed:(_=r.wind_speed_10m_max)==null?void 0:_.at(c),kts:(B=r.wind_speed_10m_max)==null?void 0:B.at(c),degree:(z=r.wind_direction_10m_dominant)==null?void 0:z.at(c),gusts:(n=r.wind_gusts_10m_max)==null?void 0:n.at(c)}};const{name:j,url:q}=this.parseWeatherCode(g.code,!0);g.name=j,g.url=q,g.wind.scale=this.beaufort(this.kts2ms(g.wind.kts)),g.wind.direction=this.degree2Direction(g.wind.degree)}for(const N of A){const r=N.daily;m={wave:{sig:{height:(i=r.wave_height_max)==null?void 0:i.at(c),degree:(R=r.wave_direction_dominant)==null?void 0:R.at(c),period:(u=r.wave_period_max)==null?void 0:u.at(c)},swell:{height:(L=r.swell_wave_height_max)==null?void 0:L.at(c),degree:(C=r.wave_direction_dominant)==null?void 0:C.at(c),period:(I=r.swell_wave_period_max)==null?void 0:I.at(c),peakPeriod:(M=r.swell_wave_peak_period_max)==null?void 0:M.at(c)},wd:{height:(P=r.wind_wave_height_max)==null?void 0:P.at(c),degree:(T=r.wind_wave_direction_dominant)==null?void 0:T.at(c),period:(H=r.wind_wave_period_max)==null?void 0:H.at(c),peakPeriod:(F=r.wind_wave_peak_period_max)==null?void 0:F.at(c)}}},m.wave=this.parseWave(m.wave)}p.push({utc:S.add(c,"d").utc().format(),weather:{...g},...m})}return p}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 l=this.weatherCode(t);return s?l.day:l.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:Math.round(t*1852/3600*1e4)/1e4}static kts2kmh(t){return isNaN(t)?t:t*1.852}static m2nm(t){return isNaN(t)?t:Math.round(t/1e3/1.852*1e4)/1e4}static kmh2kts(t){return isNaN(t)?t:this.ms2kts(t*1e3/3600)}static ms2kts(t){return isNaN(t)?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 l="N/A";const a=Math.PI/16;return s<a?l="N":s>=a&&s<3*a?l="NNE":s>=3*a&&s<5*a?l="NE":s>=5*a&&s<7*a?l="ENE":s>=7*a&&s<9*a?l="E":s>=9*a&&s<11*a?l="ESE":s>=11*a&&s<13*a?l="SE":s>=13*a&&s<15*a?l="SSE":s>=15*a&&s<17*a?l="S":s>=17*a&&s<19*a?l="SSW":s>=19*a&&s<21*a?l="SW":s>=21*a&&s<23*a?l="WSW":s>=23*a&&s<25*a?l="W":s>=25*a&&s<27*a?l="WNW":s>=27*a&&s<29*a?l="NW":s>=29*a&&s<31*a?l="NNW":s>=31*a&&s<32*a&&(l="N"),l}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 ct="",ce=(o,t)=>{const s=o.__vccOpts||o;for(const[l,a]of t)s[l]=a;return s},de={name:"SpotReport",props:{token:{type:String,default:""},ts:{type:String,default:k().utc().format()},timeZone:{type:Number,default:8},report:{type:Object,default:()=>({})}},data(){return{placeholder:"search for port name or coordinates",searchName:void 0,rawSearchIcon:e.markRaw(ie.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?`${U(o).tz(this.positionGmt).format("HH")}`:"-"}},computeHourZ(){return function(o){return o?`${k(o).utc().format("HH")}Z`:"-"}},computeWeek(){return function(o){return o?`${U(o).tz(this.positionGmt).format("dddd")}`:"-"}},computeMMMDD(){return function(o){return o?`${U(o).tz(this.positionGmt).format("MMM-DD")}`:"-"}},computeLat(){return function(o,t=4){return Y.LngLatHelper.lat2pretty(o,t).pretty}},computeLng(){return function(o,t=4){return Y.LngLatHelper.lng2pretty(o,t).pretty}},roundPrecision(){return function(o,t=4){return isNaN(o)?"-":Y.LngLatHelper.roundPrecision(o,t)}}},watch:{"report.version":{handler(){var o,t;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: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=k(this.ts).utc().format("MMM-DD/HHmm[Z], YYYY"),this.activeIndex=U(this.ts).tz(this.positionGmt).hour(),this.pickedDate=U(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 l;return s.name===((l=this.position)==null?void 0:l.name)})},initTableData(){var o,t,s,l,a,w,E,D,f,x,b,_,B,z,n,i,R,u,L,C,I,M,P,T,H,F,W,V,A,S,G,p,g,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 c=0;c<24;c++){const N=k(this.pickedDate).clone().add(c,"h").format();this.tableData.hours.push(N);const r=((o=$.pickHourly(this.meteoData,N))==null?void 0:o[0])||{};this.tableData.weatherUrls.push((t=r.weather)==null?void 0:t.url),this.tableData.weatherNames.push(((s=r.weather)==null?void 0:s.name)??"-"),this.tableData.temp.push(this.roundPrecision((l=r.weather)==null?void 0:l.temp,0)??"-"),this.tableData.precipProbability.push(this.roundPrecision((w=(a=r.weather)==null?void 0:a.precip)==null?void 0:w.probability,0)??"-"),this.tableData.precip1h.push(this.roundPrecision((D=(E=r.weather)==null?void 0:E.precip)==null?void 0:D.sum,0)??"-"),this.tableData.visibility.push(this.roundPrecision((f=r.weather)==null?void 0:f.visibility,0)??"-"),this.tableData.humidity.push(this.roundPrecision((x=r.weather)==null?void 0:x.rh,0)??"-"),this.tableData.windSpeed.push(this.roundPrecision((_=(b=r.weather)==null?void 0:b.wind)==null?void 0:_.kts,1)),this.tableData.windDir.push((z=(B=r.weather)==null?void 0:B.wind)==null?void 0:z.bearing),this.tableData.windGust.push(this.roundPrecision((i=(n=r.weather)==null?void 0:n.wind)==null?void 0:i.gusts,1)??"-"),this.tableData.sigwaveHeight.push(this.roundPrecision((u=(R=r.wave)==null?void 0:R.sig)==null?void 0:u.height,1)??"-"),this.tableData.sigwaveDir.push((C=(L=r.wave)==null?void 0:L.sig)==null?void 0:C.bearing),this.tableData.windwaveHeight.push(this.roundPrecision((M=(I=r.wave)==null?void 0:I.wd)==null?void 0:M.height,1)??"-"),this.tableData.windwaveDir.push((T=(P=r.wave)==null?void 0:P.wd)==null?void 0:T.bearing),this.tableData.windwavePeriod.push(this.roundPrecision((F=(H=r.wave)==null?void 0:H.wd)==null?void 0:F.period,1)??"-"),this.tableData.swellHeight.push(this.roundPrecision((V=(W=r.wave)==null?void 0:W.swell)==null?void 0:V.height,1)??"-"),this.tableData.swellDir.push((S=(A=r.wave)==null?void 0:A.swell)==null?void 0:S.bearing),this.tableData.swellPeriod.push(this.roundPrecision((p=(G=r.wave)==null?void 0:G.swell)==null?void 0:p.period,1)??"-"),this.tableData.currentSpeed.push(this.roundPrecision((g=r.current)==null?void 0:g.speed,1)??"-"),this.tableData.currentDir.push((m=r.current)==null?void 0:m.bearing),this.tableData.seaLevel.push(this.roundPrecision(r.height,1)??"-"),this.tableData.seaTemp.push(this.roundPrecision(r.sst,0)??"-")}},initEchart(){var L,C,I,M,P,T,H,F,W,V,A,S,G;const o=[],t=[],s=[],l=[],a=[],w=[],E=[],D=[],f=[],x=[],b={};for(let p=0;p<7;p++){const g=k(this.pickedDate).clone().add(p,"d");o.push(U(g).tz(this.positionGmt).format("yyyy-MM-DD")),t.push(this.computeMMMDD(g)),s.push(p===0?"Today":this.computeWeek(g));const m=((L=$.pickDaily(this.meteoData,g))==null?void 0:L[0])||{};l.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"),x.push(this.roundPrecision((W=(F=m.weather)==null?void 0:F.precip)==null?void 0:W.sum,0)??"- mm"),w.push({symbol:"image://"+((V=m.weather)==null?void 0:V.url)}),E.push((A=m.weather)==null?void 0:A.name),f.push((G=(S=m.weather)==null?void 0:S.wind)==null?void 0:G.degree)}const _=Math.max(...a.filter(p=>typeof p=="number"&&!isNaN(p)))-Math.min(...l.filter(p=>typeof p=="number"&&!isNaN(p))),B=Math.min(...l.filter(p=>typeof p=="number"&&!isNaN(p)))-1.5*_,z=Math.max(...a.filter(p=>typeof p=="number"&&!isNaN(p)))+2*_,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>'))),R="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=R,u.onload=()=>{for(let m=0;m<7;m++){const c=document.createElement("canvas"),N=c.getContext("2d");c.width=u.width,c.height=u.height;const j=f[m]*(Math.PI/180);N.translate(c.width/2,c.height/2),N.rotate(j),N.translate(-u.width/2,-u.height/2),N.drawImage(u,0,0,64,64);const q=c.toDataURL();b[`WindIcon${m}`]={height:12,width:12,align:"left",backgroundColor:{image:q}}}const p=v.init(document.getElementById("weather-chart")),g={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: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:B,max:z,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:l,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:D,label:{show:!0,color:"#fff",rich:{...b,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:x,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(g),p.on("click",m=>{const c=m.dataIndex;this.pickedDate=U(o[c]).tz(this.positionGmt).set({hour:0,minute:0,second:0,millisecond:0}).format(),this.pickedWeek=c===0?"Today":this.computeWeek(this.pickedDate),this.activeIndex=c===0?U(this.ts).tz(this.positionGmt).hour():void 0,this.initTableData(),g.series[3].markArea={itemStyle:{color:"rgb(71,143,206)"},data:[[{x:4+c/o.length*92+"%"},{x:4+(c+1)/o.length*92+"%"}]]},p.setOption(g)})}},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 l;const t=o.replaceAll(",",",");if(!t)return this.positionList=this.collectList,!1;const s=await X.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=(l=s==null?void 0:s.data.data)==null?void 0:l.map(a=>(a.name=a.id?a.name:this.computeLat(a.lat)+", "+this.computeLng(a.lng),a)))},async handleFetchMeteo(){var s,l,a;if(!this.searchName)return!1;this.position={portId:(s=this.positionList.find(w=>w.name===this.searchName))==null?void 0:s.id,lat:(l=this.positionList.find(w=>w.name===this.searchName))==null?void 0:l.lat,lng:(a=this.positionList.find(w=>w.name===this.searchName))==null?void 0:a.lng,name:this.searchName},this.handleClear();const o={lat:this.position.lat,lng:this.position.lng,datetime:this.ts?k(this.ts).utc().add(-1,"d").format():k().add(-1,"d").utc().format(),forecastDays:8,selfHosted:!1},t=await X.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,v.dispose(document.getElementById("weather-chart"))}}},he={class:"spot-report"},me={class:"header-box flex-between"},pe={class:"bg"},we={class:"search-box flex-start"},ge={class:"content-box"},ke={class:"title-box flex-between"},ue={class:"main-title"},ye={class:"sub-title"},fe={class:"flex-end"},xe={key:0,id:"weather-chart"},be={key:1,class:"weather-chart flex-center"},_e={key:2,class:"weather-chart flex-center"},Ne={key:3,class:"card-box"},Ee={class:"date"},De={class:"basic-table"},Be={class:"day"},ze={class:"hour"},Ve={class:"icon"},Se=["src"],Le={class:"text"},Ce={class:"text"},Ie={class:"text"},Me={class:"text"},Pe={class:"text"},Te={class:"text"},He={key:1},Fe={class:"text"},We={class:"text"},Re={class:"wave-current-table"},Ae={class:"text"},Ge={class:"text"},Oe={key:1},Ue={class:"text"},je={class:"text"},qe={class:"text"},Ze={key:1},Je={class:"text"},Ye={class:"text"},Qe={class:"text"},Ke={key:1},Xe={class:"text"},ve={class:"sea-table"},$e={class:"text"},et={class:"text"},tt={key:4,class:"card-box flex-center"},st={key:5,class:"card-box flex-center"};function at(o,t,s,l,a,w){var x,b,_,B,z;const E=e.resolveComponent("ElOption"),D=e.resolveComponent("ElSelect"),f=e.resolveComponent("ElTooltip");return e.openBlock(),e.createElementBlock("div",he,[e.createElementVNode("div",me,[e.createElementVNode("div",pe,[e.createElementVNode("div",we,[e.createVNode(D,{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":w.fetchSuggestPosition,onChange:w.handleFetchMeteo},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.positionList,n=>(e.openBlock(),e.createBlock(E,{key:n.name,label:n.name,value:n.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","remote-method","onChange"])])])]),e.createElementVNode("div",ge,[e.createElementVNode("div",ke,[e.createElementVNode("div",null,[e.createElementVNode("div",ue,"Weather forecast for "+e.toDisplayString(((x=a.position)==null?void 0:x.name)||"-")+" ( "+e.toDisplayString(a.positionGmt)+" )",1),e.createElementVNode("div",ye,"At "+e.toDisplayString((b=a.position)!=null&&b.portId?"port":"coordinates")+", issued "+e.toDisplayString(a.issuedDate),1)]),e.createElementVNode("div",fe,[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]=(...n)=>w.handleCollect&&w.handleCollect(...n))},"")):(e.openBlock(),e.createElementBlock("span",{key:1,class:"iconfont icon",onClick:t[4]||(t[4]=(...n)=>w.handleCollect&&w.handleCollect(...n))},""))]),_:1},8,["content"])])]),(_=a.position)!=null&&_.name&&!a.loading?(e.openBlock(),e.createElementBlock("div",xe)):a.loading?(e.openBlock(),e.createElementBlock("div",be,"Loading....")):a.position.name?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",_e,"No Data")),(B=a.position)!=null&&B.name&&!a.loading?(e.openBlock(),e.createElementBlock("div",Ne,[e.createElementVNode("div",Ee,e.toDisplayString(a.pickedWeek)+" "+e.toDisplayString(w.computeMMMDD(a.pickedDate)),1),e.createElementVNode("table",De,[e.createElementVNode("tr",Be,[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(w.computeHourL(n)),3))),128))]),e.createElementVNode("tr",ze,[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(w.computeHourZ(n)),3))),128))]),e.createElementVNode("tr",Ve,[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(f,{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,Se)):e.createCommentVNode("",!0)]),_:2},1032,["content"])],2))),128))]),e.createElementVNode("tr",Le,[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",Ce,[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",Ie,[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",Me,[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",Pe,[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",Te,[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",He,"-")):(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",Fe,[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",We,[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",Re,[e.createElementVNode("tr",Ae,[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",Ge,[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",Oe,"-")):(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",Ue,[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",je,[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",qe,[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",Ze,"-")):(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",Je,[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",Ye,[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",Qe,[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",Ke,"-")):(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[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",ve,[e.createElementVNode("tr",$e,[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",et,[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",tt,"Loading....")):(z=a.position)!=null&&z.name?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",st,"No Data"))])])}const ee=ce(de,[["render",at],["__scopeId","data-v-961e1c0d"]]),nt={install(o){o.component("SpotReport",ee)}};y.SpotReport=ee,y.SpotReportPlugin=nt,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(x,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):(x=typeof globalThis<"u"?globalThis:x||self,y(x["idmui-report"]={},x.moment,x["moment-timezone"],x["@element-plus/icons-vue"],x["@idm-plugin/geo"],x.echarts,x.Vue,x.axios))})(this,function(x,y,J,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,f,L,C,I,M,P,T,H,F,W,R,A,G,O,p,k,m,u,S,d,j,h,Z,w,Q,X;const oe=typeof s=="string"?y(s):s,K=t.weather,ie=t.marine,re=y(K[0].hourly.date).utc(),$=re.clone().add(K[0].hourly.time.at(0),"h"),lt=re.clone().add(K[0].hourly.time.at(-1),"h"),le=[];if(oe.isBetween($,lt,"millisecond","[]")){const l=oe.utc().diff($,"h",!1);let U,Y;if(K)for(const ee of K){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?(((f=c.wind_direction_10m)==null?void 0:f.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;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:(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:(Z=c.ocean_current_direction)==null?void 0:Z.at(l),bearing:((w=c.ocean_current_direction)==null?void 0:w.at(l))??null},sst:(Q=c.sea_surface_temperature)==null?void 0:Q.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:$.add(l,"h").format(),weather:{...U},...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,g,D,B,_,b,N,E,z,V,n,i,q,f,L,C,I,M,P,T,H,F,W,R,A,G;const O=typeof s=="string"?y(s):s,p=t.weather,k=t.marine,m=y(p[0].daily.time.at(0)),u=y(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 Z of p){const w=Z.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:(f=w.wind_direction_10m_dominant)==null?void 0:f.at(h),gusts:(L=w.wind_gusts_10m_max)==null?void 0:L.at(h)}};const{name:Q,url:X}=this.parseWeatherCode(d.code,!0);d.name=Q,d.url=X,d.wind.scale=this.beaufort(this.kts2ms(d.wind.kts)),d.wind.direction=this.degree2Direction(d.wind.degree)}if(k)for(const Z of k){const w=Z.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:y().utc().format()},timeZone:{type:Number,default:8},report:{type:Object,default:()=>({})}},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?`${J(o).tz(this.positionGmt).format("HH")}`:"-"}},computeHourZ(){return function(o){return o?`${y(o).utc().format("HH")}Z`:"-"}},computeWeek(){return function(o){return o?`${J(o).tz(this.positionGmt).format("dddd")}`:"-"}},computeMMMDD(){return function(o){return o?`${J(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;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: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=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 o,t,s,r,a,g,D,B,_,b,N,E,z,V,n,i,q,f,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=y(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((f=(q=d.wave)==null?void 0:q.sig)==null?void 0:f.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=y(this.pickedDate).clone().add(p,"d");o.push(J(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>'))),f=new Image(64,64);f.src=q,f.onload=()=>{for(let m=0;m<7;m++){const u=document.createElement("canvas"),S=u.getContext("2d");u.width=f.width,u.height=f.height;const j=_[m]*(Math.PI/180);S.translate(u.width/2,u.height/2),S.rotate(j),S.translate(-f.width/2,-f.height/2),S.drawImage(f,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=J(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?J(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.handleClear();const o={lat:this.position.lat,lng:this.position.lng,datetime:this.ts?y(this.ts).utc().add(-1,"d").format():y().add(-1,"d").utc().format(),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},Je={class:"text"},Ze={class:"text"},Ye={class:"text"},Ke={key:1},Qe={class:"text"},Xe={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",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,(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",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,(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[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",Ke,"-")):(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",Qe,[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",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,(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-e4818d13"]]),rt={install(o){o.component("SpotReport",ne)}};x.SpotReport=ne,x.SpotReportPlugin=rt,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@page{size:1200px;margin:20px auto 40px}.spot-report[data-v-
|
|
1
|
+
@page{size:1200px;margin:20px auto 40px}.spot-report[data-v-e4818d13]{height:100%;width:1160px;margin:0 auto;padding:0;display:flex;flex-direction:column;color:var(--idm-black-8)}.spot-report .header-box[data-v-e4818d13]{width:100%;padding:10px 0}.spot-report .header-box .search-box .input[data-v-e4818d13]{width:300px}.spot-report .header-box .search-box .info[data-v-e4818d13]{margin:0 10px;color:var(--idm-info-color);font-size:12px}.spot-report .content-box[data-v-e4818d13]{flex:1;width:100%;box-sizing:border-box}.spot-report .content-box .title-box .main-title[data-v-e4818d13]{font-size:16px;font-weight:700}.spot-report .content-box .title-box .sub-title[data-v-e4818d13]{font-size:13px;padding:2px 0}.spot-report .content-box .title-box .icon[data-v-e4818d13]{cursor:pointer;margin-left:10px;font-size:16px}.spot-report .content-box .title-box .icon[data-v-e4818d13]:hover{color:var(--idm-primary-color)}.spot-report .content-box .title-box .icon.active[data-v-e4818d13]{color:var(--idm-warning-color)}.spot-report .content-box #weather-chart[data-v-e4818d13],.spot-report .content-box .weather-chart[data-v-e4818d13]{height:225px;width:100%;font-size:14px;color:#fff;border:1px solid var(--idm-gray-light);border-radius:5px;box-sizing:border-box;background:rgb(104,184,251)}.spot-report .content-box .card-box[data-v-e4818d13]{min-height:500px;margin:5px 0;background:var(--idm-gray-light);border-radius:4px;font-size:14px;color:var(--idm-black-8);line-height:26px}.spot-report .content-box .card-box .date[data-v-e4818d13]{font-weight:700;padding:2px 10px;background:var(--idm-white)}.spot-report .content-box .card-box .basic-table[data-v-e4818d13],.spot-report .content-box .card-box .wave-current-table[data-v-e4818d13],.spot-report .content-box .card-box .sea-table[data-v-e4818d13]{width:100%;font-size:12px;padding:5px;border-collapse:collapse;border:1px solid var(--idm-gray-light)}.spot-report .content-box .card-box .basic-table .tr-title[data-v-e4818d13],.spot-report .content-box .card-box .wave-current-table .tr-title[data-v-e4818d13],.spot-report .content-box .card-box .sea-table .tr-title[data-v-e4818d13]{width:200px;padding-right:10px;text-align:right!important;background:none}.spot-report .content-box .card-box .basic-table .tr-title .unit[data-v-e4818d13],.spot-report .content-box .card-box .wave-current-table .tr-title .unit[data-v-e4818d13],.spot-report .content-box .card-box .sea-table .tr-title .unit[data-v-e4818d13]{width:20px;padding:0 5px;text-align:left;display:inline-block;color:var(--idm-info-color)}.spot-report .content-box .card-box .basic-table td[data-v-e4818d13],.spot-report .content-box .card-box .wave-current-table td[data-v-e4818d13],.spot-report .content-box .card-box .sea-table td[data-v-e4818d13]{text-align:center;line-height:20px;width:40px;background:var(--idm-white)}.spot-report .content-box .card-box .basic-table td.active[data-v-e4818d13],.spot-report .content-box .card-box .wave-current-table td.active[data-v-e4818d13],.spot-report .content-box .card-box .sea-table td.active[data-v-e4818d13]{color:#fff;background:rgb(71,143,206)}.spot-report .content-box .card-box .basic-table th[data-v-e4818d13],.spot-report .content-box .card-box .wave-current-table th[data-v-e4818d13],.spot-report .content-box .card-box .sea-table th[data-v-e4818d13]{color:var(--idm-info-color);font-weight:400;text-align:center;line-height:20px;width:40px}.spot-report .content-box .card-box .basic-table .weather-icon[data-v-e4818d13],.spot-report .content-box .card-box .wave-current-table .weather-icon[data-v-e4818d13],.spot-report .content-box .card-box .sea-table .weather-icon[data-v-e4818d13]{width:24px;height:24px;cursor:pointer}
|
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.2",
|
|
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.1.
|
|
32
|
+
"@idm-plugin/meteo": "^0.1.9",
|
|
33
33
|
"@idmui/brand": "^0.0.2",
|
|
34
34
|
"@idmui/style": "^0.1.4",
|
|
35
35
|
"axios": "^1.3.5",
|