@idmwx/idmui-gl4 3.6.1 → 3.6.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/{chunk-3VYIPD3A-7d0f9c9c.js → chunk-3VYIPD3A-52fe9379.js} +1 -1
- package/dist/{chunk-ANSXOGKI-81d7aebb.js → chunk-ANSXOGKI-15751fc7.js} +1 -1
- package/dist/{chunk-T4JIPPZO-7fdd2f7f.js → chunk-T4JIPPZO-fb5cd7a4.js} +1 -1
- package/dist/{download-1e14a88f.js → download-83864995.js} +3 -3
- package/dist/{index-91c63063.js → index-a86cae16.js} +24 -24
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +3 -3
- package/dist/{rasterize-JS5G2XHH-f30008d7.js → rasterize-JS5G2XHH-0aad2beb.js} +3 -3
- package/dist/style.css +1 -1
- package/dist/{toBlob-881b3d23.js → toBlob-a1c72402.js} +3 -3
- package/dist/{toCanvas-46a8ad3a.js → toCanvas-df7a24a4.js} +2 -2
- package/dist/{toImg-e5f57246.js → toImg-171b933c.js} +3 -3
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<span style="display:inline-block; height: 8px;width: 8px;border-radius: 50%;background-color: ${l.color}"></span>
|
|
8
8
|
<span>${l.seriesName} : </span>
|
|
9
9
|
<strong>${l.value[1]}m</strong>
|
|
10
|
-
</div>`)}),r}},legend:{show:!0,right:20,top:0,itemWidth:30,data:["Height"],textStyle:{color:this.Theme.current.value.colors["on-surface"]}},grid:{top:40,left:10,right:10,bottom:30,containLabel:!0},xAxis:[{type:"category",data:this.xDate,boundaryGap:!0,axisTick:{alignWithLabel:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLabel:{interval:"auto",margin:15,textStyle:{fontSize:12,color:this.Theme.current.value.colors["echart-axis"]}}}],yAxis:[{name:"(m)",show:!0,nameLocation:"end",position:"left",nameGap:15,splitNumber:5,splitLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-split"]}},alignTicks:!0,axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLabel:{textStyle:{fontSize:12,color:this.Theme.current.value.colors["echart-axis"]}}}],series:[{name:"Height",type:"line",showSymbol:!0,yAxisIndex:0,lineStyle:{color:this.Theme.current.value.colors["map-perple"]},itemStyle:{color:this.Theme.current.value.colors["map-perple"]},data:this.echartData.height}]};o==null||o.setOption(e)},handleClose(){this.$emit("close")}}},$n={class:"d-flex justify-space-between align-center"},es={class:"d-flex justify-start text-h5 my-2"},ts={class:"d-flex justify-start align-center text-h6 text-label ga-3"},os={class:"summary-box w-100"},as={class:"d-flex justify-space-between align-center py-2"},is={class:"d-flex justify-center align-center text-h6 ga-2"},rs={class:"multi-color-icon","aria-hidden":"true"},ls=["xlink:href"],ns={class:"gray-bg-2 rounded d-flex flex-column ga-4 pa-4"},ss={class:"w-100 d-flex justify-start align-center"},cs={class:"w-30 text-label font-weight-400"},ms={class:"flex-1-1-0"},ds={class:"w-100 d-flex justify-start align-center"},hs={class:"w-30 text-label font-weight-400"},ps={class:"flex-1-1-0"},gs={class:"w-100 d-flex justify-start align-center"},us={class:"w-30 text-label font-weight-400"},fs={class:"flex-1-1-0"},ys={class:"table-box w-100 mt-2 mb-4 d-flex flex-column justify-start align-center"},bs={class:"w-100 d-flex justify-space-between align-center py-2"},ws={class:"d-flex justify-center align-center text-h6 ga-2"},xs={class:"multi-color-icon","aria-hidden":"true"},ks=["xlink:href"],As={ref:"tideEchart",class:"w-100",style:{height:"244px"}},Ls={"fixed-header":"",density:"compact",class:"w-100 tide-table bg-none"},Cs={class:"px-1 text-center text-label font-weight-400",width:"120"},vs={class:"px-1 text-center text-label font-weight-400",width:"120"},zs={class:"px-1 text-center text-label font-weight-400",width:"120"},_s={class:"px-1 text-center"},Ss={class:"px-1 text-center"},Ns={class:"px-1 text-center"};function Ms(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VBtnToggle"),d=t.resolveComponent("VCard");return t.openBlock(),t.createBlock(d,{class:t.normalizeClass(["tide-detail-container d-flex flex-column justify-start align-center",a.simple?"page":"dialog"])},{default:t.withCtx(()=>{var g,u;return[t.createVNode(c,{class:"w-100"},{default:t.withCtx(()=>{var y;return[t.createElementVNode("div",$n,[t.createElementVNode("div",es,[t.createElementVNode("div",null,t.toDisplayString((y=a.station)==null?void 0:y.name),1)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"",onClick:l.handleClose},{default:t.withCtx(()=>e[1]||(e[1]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[1]},8,["onClick"])]),t.createElementVNode("div",ts,[t.createElementVNode("div",null,t.toDisplayString(o.$t("tide.tideStation")),1)])]}),_:1}),t.createVNode(s,{class:"w-100"}),t.createElementVNode("div",{class:t.normalizeClass(["w-100 pt-0 pb-0 overflow-y-auto scroll",a.simple?"px-3":"px-5"])},[t.createElementVNode("div",os,[t.createElementVNode("div",as,[t.createElementVNode("div",is,[(t.openBlock(),t.createElementBlock("svg",rs,[t.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,ls)])),t.createElementVNode("div",null,t.toDisplayString(o.$t("detail.summary")),1)])]),t.createElementVNode("div",ns,[t.createElementVNode("div",ss,[t.createElementVNode("div",cs,t.toDisplayString(o.$t("tide.region")),1),t.createElementVNode("div",ms,t.toDisplayString(((g=a.station)==null?void 0:g.Country)??((u=a.station)==null?void 0:u.city)??"-"),1)]),t.createElementVNode("div",ds,[t.createElementVNode("div",hs,t.toDisplayString(o.$t("tide.position")),1),t.createElementVNode("div",ps,t.toDisplayString(l.computePosition(a.station)),1)]),t.createElementVNode("div",gs,[t.createElementVNode("div",us,t.toDisplayString(o.$t("time.localTime")),1),t.createElementVNode("div",fs,t.toDisplayString(l.computeLocalTime(a.realTime,a.station))+" "+t.toDisplayString(l.computeTimeOffset(a.station)),1)])])]),t.createElementVNode("div",ys,[t.createElementVNode("div",bs,[t.createElementVNode("div",ws,[(t.openBlock(),t.createElementBlock("svg",xs,[t.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,ks)])),t.createElementVNode("div",null,t.toDisplayString(o.$t("tide.tideTimes")),1)]),e[2]||(e[2]=t.createElementVNode("div",{class:"text-body-2 text-success ga-2"},null,-1))]),t.createElementVNode("div",{class:t.normalizeClass(["w-100 gray-bg-2 rounded",a.simple?"pa-2":"pa-4 py-2"])},[t.createVNode(m,{modelValue:i.currentIndex,"onUpdate:modelValue":e[0]||(e[0]=y=>i.currentIndex=y),class:"w-100 d-flex justify-space-around align-center ga-0 mb-4",density:"compact",group:"",height:"26","min-height":"26",rounded:"1",mandatory:""},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.dateList,y=>(t.openBlock(),t.createBlock(n,{key:y.label,class:t.normalizeClass(["text-none text-body-1 flex-1-1-0",`bg-${y.index===i.currentIndex?"bg-primary":"gray-bg-2"}`]),density:"compact",color:"primary",height:"26",value:y.index},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(y.label),1)]),_:2},1032,["class","value"]))),128))]),_:1},8,["modelValue"]),t.createElementVNode("div",As,null,512),t.createElementVNode("table",Ls,[t.createElementVNode("tbody",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",Cs,t.toDisplayString(o.$t("tide.tide")),1),t.createElementVNode("th",vs,t.toDisplayString(o.$t("time.time"))+" ( LT ) ",1),t.createElementVNode("th",zs,t.toDisplayString(o.$t("tide.height"))+" ( m )",1)]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tideTableData,(y,p)=>{var h;return t.openBlock(),t.createElementBlock("tr",{key:p},[t.createElementVNode("td",_s,t.toDisplayString(o.$t(`tide.${(h=y==null?void 0:y.type)==null?void 0:h.toLowerCase()}`))+" "+t.toDisplayString(o.$t("tide.tide")),1),t.createElementVNode("td",Ss,t.toDisplayString(l.computeLocalTime(y==null?void 0:y.date,a.station,"MM-DD HH:mm")),1),t.createElementVNode("td",Ns,t.toDisplayString((y==null?void 0:y.height)??"-")+" m",1)])}),128))])])],2)])],2)]}),_:1},8,["class"])}const Ps=Q(qn,[["render",Ms],["__scopeId","data-v-5c51381d"]]),j1="",Vs={name:"IdmTideStations",components:{TideDetail:Ps},props:{map:{type:Object},show:{type:Boolean},locale:{type:String},beforeLayer:{type:String}},data(){return{layer:"tide-stations",showInfo:!1,hoverStation:void 0,marker:null,showDetail:!1,station:void 0}},watch:{show:{handler(){var o,e,a,r,i,l;this.show?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):(this.handleClear(),(r=this.map)==null||r.off("click",[this.layer],this.handleClick),(i=this.map)==null||i.off("mousemove",[this.layer],this.handleHover),(l=this.map)==null||l.off("mouseleave",[this.layer],this.handleLeave))},immediate:!0},locale:{handler(){this.show&&this.handleRender()},immediate:!0}},methods:{handleRender(){var o;(o=this.map)!=null&&o.getLayer(this.layer)&&(this.map.setLayoutProperty(this.layer,"visibility","visible"),this.map.setLayoutProperty(this.layer,"text-field",this.locale==="en"?"{Location_EN}":"{Location_CN}"))},handleClear(){var o;this.showInfo=!1,(o=this.map)!=null&&o.getLayer(this.layer)&&this.map.setLayoutProperty(this.layer,"visibility","none")},handleClick(o){const e=o.features[0];e.properties&&(this.station=e.properties,this.station.name=this.locale==="en"?e.properties.Location_EN:e.properties.Location_CN,this.station.lng=e.geometry.coordinates[0],this.station.lat=e.geometry.coordinates[1],this.showDetail=!0)},handleHover(o){var a,r;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties){this.showInfo=!0,this.hoverStation=e.properties,this.hoverStation.name=this.locale==="en"?e.properties.Location_EN:e.properties.Location_CN,this.hoverStation.lng=e.geometry.coordinates[0],this.hoverStation.lat=e.geometry.coordinates[1],(a=this.marker)==null||a.remove();const i=(r=document.getElementById("idmTidalInfo"))==null?void 0:r.cloneNode(!0);this.marker=new me.Marker(i).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-60]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,this.hoverStation={},(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"},handleCloseDetail(){this.showDetail=!1}}},Ts={class:"station-box d-flex flex-column justify-center align-start ga-1"},Es={class:"d-flex justify-start align-center"},Ds={class:"d-flex justify-start align-center"},Rs={class:"text-label"};function Bs(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard"),s=t.resolveComponent("TideDetail");return t.openBlock(),t.createElementBlock("div",null,[t.withDirectives(t.createVNode(c,{id:"idmTidalInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"pr-8 text-body-1"},{default:t.withCtx(()=>{var m,d;return[t.createElementVNode("div",Ts,[t.createElementVNode("div",Es,t.toDisplayString(o.$t("tide.tideStation")),1),t.createElementVNode("div",Ds,[t.createElementVNode("label",Rs,t.toDisplayString((m=i.hoverStation)==null?void 0:m.name)+" , "+t.toDisplayString(((d=i.hoverStation)==null?void 0:d.Country)||"-"),1)])])]}),_:1})]),_:1},512),[[t.vShow,i.showInfo]]),i.showDetail?(t.openBlock(),t.createBlock(s,t.mergeProps({key:0,station:i.station},o.$attrs,{onClose:l.handleCloseDetail}),null,16,["station","onClose"])):t.createCommentVNode("",!0)])}const Is=Q(Vs,[["render",Bs],["__scopeId","data-v-ad725d5e"]]),Fs={name:"IdmIceAreas",props:{map:{type:Object},show:{type:Boolean}},data(){return{lineLayer:"ice-area-line",fillLayer:"ice-area-fill"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var o,e;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","visible"),(e=this.map)!=null&&e.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","visible")},handleClear(){var o,e;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","none"),(e=this.map)!=null&&e.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","none")}}};function Gs(o,e,a,r,i,l){return null}const js=Q(Fs,[["render",Gs]]),W1="",Ws={name:"IdmLatLng",props:{simple:{type:Boolean,default:!1},map:{type:Object},show:{type:Boolean},mapFeather:{type:String},beforeLayer:{type:String},menuToggle:{type:Object}},data(){return{lngLat:{e:{lng:0,lat:0},lng:0,lat:0,str:""},source:"idm-lat-lng-source",layer:"idm-lat-lng-layer",labelLayer:"idm-lat-lng-label-layer",right:10}},computed:{lineColor(){return["satellite","dark"].includes(this.mapFeather)?"rgba(255, 255, 255, 0.3)":"rgba(0, 0, 0, 0.3)"},labelColor(){return["satellite","dark"].includes(this.mapFeather)?"rgba(255, 255, 255, 0.8)":"rgba(0, 0, 0, 0.5)"}},watch:{show:{handler(){this.handleBind()},immediate:!0},map:{handler(){var o;this.map&&((o=this.map)==null||o.on("mousemove",this.handleMouseMove))},immediate:!0},"menuToggle.v":{handler(){var o;this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10},immediate:!0},"lngLat.e":{handler(o){this.lngLat.lng=M.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty,this.lngLat.lat=M.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty,this.lngLat.str=`[${M.LngLatHelper.str2Lat(o==null?void 0:o.lat,4)}, ${M.LngLatHelper.str2Lng(o==null?void 0:o.lng,4)}]`},immediate:!0}},methods:{handleBind(){var o,e;this.show?((o=this.map)==null||o.on("zoomend",this.handleZoomEnd),this.handleRender()):(this.handleClear(),(e=this.map)==null||e.off("zoomend",this.handleZoomEnd))},handleMouseMove(o){this.lngLat.e=o.lngLat},handleComputeLatLngs(){var r;const o=(r=this.map)==null?void 0:r.getZoom();let e=30;o>4?e=10:o>3&&(e=15);const a=[];for(let i=-60;i<90;i+=e)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[-180,i],[180,i]]}});for(let i=-180;i<180;i+=e)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[i,-90],[i,90]]}});for(let i=180;i>-180;i-=e)for(let l=-60;l<90;l+=e)a.push({type:"Feature",geometry:{type:"Point",coordinates:[i,l]},properties:{val:`${l>0?l+" N":l===0?l:l*-1+" S"}, ${i>0?i+" E":i*-1+" W"}`}});return a},handleZoomEnd(){var e;const o=this.handleComputeLatLngs();(e=this.map)==null||e.getSource(this.source).setData(T.featureCollection(o))},handleRender(){if(this.handleClear(),this.map){const o=this.handleComputeLatLngs();this.map.addSource(this.source,{type:"geojson",data:{type:"FeatureCollection",features:o}}),this.map.addLayer({id:this.layer,type:"line",source:this.source,filter:["==","$type","LineString"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":this.lineColor,"line-width":1}},this.beforeLayer),this.map.addLayer({id:this.labelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","text-field":"{val}","text-rotation-alignment":"viewport","text-offset":[0,1],"text-size":10,"text-allow-overlap":!0},paint:{"text-opacity":1,"text-color":this.labelColor}},this.beforeLayer)}},handleClear(){var o,e,a,r,i,l;(o=this.map)!=null&&o.getLayer(this.layer)&&((e=this.map)==null||e.removeLayer(this.layer)),(a=this.map)!=null&&a.getLayer(this.labelLayer)&&((r=this.map)==null||r.removeLayer(this.labelLayer)),(i=this.map)!=null&&i.getSource(this.source)&&((l=this.map)==null||l.removeSource(this.source))}}};function Zs(o,e,a,r,i,l){var n,c,s;return a.simple?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,class:"idm-lat-lng-tip-gl4 pa-2 py-1 text-caption text-right rounded",style:t.normalizeStyle({right:i.right+"px"})},[t.createElementVNode("div",null,t.toDisplayString((n=i.lngLat)==null?void 0:n.lat),1),t.createElementVNode("div",null,t.toDisplayString((c=i.lngLat)==null?void 0:c.lng),1),t.createElementVNode("div",null,t.toDisplayString((s=i.lngLat)==null?void 0:s.str),1)],4))}const jo=Q(Ws,[["render",Zs]]),Z1="",Xs={name:"IdmFollowPort",components:{PortDetail:No},props:{map:{type:Object},beforeLayer:{type:String},forecastModel:{type:String},show:{type:Boolean},followList:{type:Array}},emits:["closeAllDetail"],setup(){return{Theme:ye.useTheme()}},data(){return{source:"follow-port-source",layer:"follow-port-layer",showInfo:!1,portId:"",hoverPort:{},port:{},marker:void 0,showDetail:!1}},watch:{show:{handler(){var o,e,a;this.show?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()},immediate:!0},followList:{handler(){var o,e,a;this.followList&&this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()}}},methods:{handleRender(){var e,a;const o={features:[],type:"FeatureCollection"};(e=this.followList)==null||e.forEach(r=>{var i;if((i=r.port)!=null&&i.id){const l=r.port,n={type:"Feature",properties:l,geometry:{type:"Point",coordinates:[l.lng,l.lat]}};o.features.push(n)}}),this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(o):(this.map.addSource(this.source,{type:"geojson",data:o}),this.map.addLayer({id:this.layer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":1,"icon-image":"port","icon-offset":[0,-13],"text-anchor":"bottom","text-field":"{name}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,1.6]},paint:{"text-color":this.Theme.current.value.colors["on-surface"],"text-halo-width":1}},this.beforeLayer))},handleClear(){var o,e,a;this.showInfo=!1,this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)},handleClick(o){const e=o.features[0];this.portId=e.properties.id,e.properties.id&&(this.port=e.properties,this.port.lng=e.geometry.coordinates[0],this.port.lat=e.geometry.coordinates[1],this.port.forecastModel=this.forecastModel,this.showDetail=!0)},handleHover(o){var r,i;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties.id){this.showInfo=!0,this.hoverPort=e.properties,(r=this.marker)==null||r.remove();const l=(i=document.getElementById("idmFollowPortInfo"))==null?void 0:i.cloneNode(!0);this.marker=new me.Marker(l).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-70]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,this.hoverPort={},(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"},handleCloseDetail(){this.showDetail=!1}}},Hs={class:"port-box d-flex flex-column justify-center align-start ga-1"},Os={class:"d-flex justify-start align-center text-label"},Ys={class:"d-flex justify-start align-center text-label"};function Us(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard"),s=t.resolveComponent("PortDetail");return t.openBlock(),t.createElementBlock("div",null,[t.withDirectives(t.createVNode(c,{id:"idmFollowPortInfo",ref:"idmFollowPortInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-body-1 pr-8"},{default:t.withCtx(()=>[t.createElementVNode("div",Hs,[t.createElementVNode("div",null,t.toDisplayString(o.$t("port.port")),1),t.createElementVNode("div",Os,[t.createElementVNode("span",null,t.toDisplayString(i.hoverPort.name??"-"),1)]),t.createElementVNode("div",Ys,[e[1]||(e[1]=t.createElementVNode("label",{class:"pr-1"},"LoCode : ",-1)),t.createElementVNode("span",null,t.toDisplayString(i.hoverPort.loCode??"-"),1)])])]),_:1})]),_:1},512),[[t.vShow,i.showInfo]]),i.showDetail?(t.openBlock(),t.createBlock(s,t.mergeProps({key:0,"port-id":i.portId,port:i.port,"forecast-model":a.forecastModel,"follow-list":a.followList},o.$attrs,{onClose:l.handleCloseDetail,onCloseAllDetail:e[0]||(e[0]=m=>o.$emit("closeAllDetail",{followPort:!0}))}),null,16,["port-id","port","forecast-model","follow-list","onClose"])):t.createCommentVNode("",!0)])}const Js=Q(Xs,[["render",Us],["__scopeId","data-v-9b28c4ea"]]),X1="",Ks={name:"IdmFollowPosition",props:{map:{type:Object},beforeLayer:{type:String},forecastModel:{type:String},show:{type:Boolean},followList:{type:Array},realTime:{type:String}},setup(){return{Theme:ye.useTheme()}},data(){return{source:"follow-coordinate-source",layer:"follow-coordinate-layer",position:{},showInfo:!1,marker:null}},computed:{computePosition(){return function(o){return!o||o.lng===null||o.lng===void 0||isNaN(o.lng)||o.lat===null||o.lat===void 0||isNaN(o.lat)?"-":M.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty+" / "+M.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty}}},watch:{show:{handler(){var o,e,a;this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()},immediate:!0},followList:{handler(){var o,e,a;this.followList&&this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()}}},methods:{handleRender(){var e,a;const o={features:[],type:"FeatureCollection"};(e=this.followList)==null||e.forEach(r=>{if(r.coordinate){const i=r.coordinate,l={type:"Feature",properties:{id:r.id,remark:r.remark,...r.coordinate},geometry:{type:"Point",coordinates:[i.lng,i.lat]}};o.features.push(l)}}),this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(o):(this.map.addSource(this.source,{type:"geojson",data:o}),this.map.addLayer({id:this.layer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":1.1,"icon-image":"location","icon-offset":[0,-16]},paint:{"text-color":this.Theme.current.value.colors["on-surface"],"text-halo-width":1}},this.beforeLayer))},handleClear(){var o,e,a;this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source),(o=this.map)==null||o.off("click",[this.layer],this.handleClick),(e=this.map)==null||e.off("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.off("mouseleave",[this.layer],this.handleLeave)},handleClick(o){var a,r,i,l,n,c,s,m,d;const e=o.features[0];if(e.properties){const g=e.properties;g.lng=e.geometry.coordinates[0],g.lat=e.geometry.coordinates[1];const u=v(),y=(a=v(this.realTime))==null?void 0:a.diff(u,"d",!0),p={followId:g.id,lat:g.lat,lng:g.lng,datetime:this.realTime,forecastModel:this.forecastModel};y>=0?(n=(l=(i=(r=this.$parent)==null?void 0:r.$parent)==null?void 0:i.$refs)==null?void 0:l.idmSpot)==null||n.fetchForecastData(p):(d=(m=(s=(c=this.$parent)==null?void 0:c.$parent)==null?void 0:s.$refs)==null?void 0:m.idmSpot)==null||d.fetchHistoryData(p)}},handleHover(o){var a;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties.id){this.showInfo=!0,this.position=e.properties,(a=this.marker)==null||a.remove();const r=document.getElementById("idmFollowPositionInfo").cloneNode(!0);this.marker=new me.Marker(r).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-70]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"}}},Qs={class:"position-box d-flex flex-column justify-center align-start ga-1"},qs={class:"d-flex justify-start align-center text-label"},$s={key:0,class:"d-flex justify-start align-center text-label"};function ec(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard");return t.withDirectives((t.openBlock(),t.createBlock(c,{id:"idmFollowPositionInfo",ref:"idmFollowPositionInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-body-1 pr-8"},{default:t.withCtx(()=>[t.createElementVNode("div",Qs,[e[0]||(e[0]=t.createElementVNode("div",null,"Location",-1)),t.createElementVNode("div",qs,[t.createElementVNode("span",null,t.toDisplayString(l.computePosition(i.position)),1)]),i.position.remark?(t.openBlock(),t.createElementBlock("div",$s,[t.createElementVNode("span",null,t.toDisplayString(i.position.remark??"-"),1)])):t.createCommentVNode("",!0)])]),_:1})]),_:1},512)),[[t.vShow,i.showInfo]])}const tc=Q(Ks,[["render",ec],["__scopeId","data-v-1de14e27"]]),H1="",oc={name:"IdmOtherLayerr",components:{IdmWarZone:il,IdmGmdssArea:nl,IdmEcaZone:ml,IdmAlertZone:gl,IdmPort:Cn,IdmLoadLine:_n,IdmTimezone:Mn,IdmVRA:Tn,IdmSpecialArea:Rn,IdmTerminator:Fn,IdmWorld12nm:Wn,IdmWorldMarine:Hn,IdmChinaRoute:Un,IdmNsrAreas:Qn,IdmTideStations:Is,IdmIceAreas:js,IdmLatLng:jo,IdmFollowPort:Js,IdmFollowPosition:tc},props:{simple:{type:Boolean,default:!1},map:{type:Object},theme:{type:String},token:{type:String},isLogin:{type:Boolean,default:!1},defaultMeteoToken:{type:String},gateway:{type:String},assistGateway:{type:Array,default:[]},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuHeight:{type:Number,default:248},menuToggle:{type:Object,default:{}},ts:{type:String},forecastModel:{type:String},realTime:{type:String}},emits:["map","other","menuToggle","mapFeather","theme","followLayerList","otherCheckList"],data(){return{right:10,toggle:!1,mapFeather:localStorage.getItem("mapFeathersCacheGL4")||"dark",tagLayers:[...eo.LayerHelper.OTHER_LAYERS.filter(o=>o.enabled)],layerWeight:0,otherLayers:{},activeOtherLayers:[],cache:{v:"0.0.2",versionKey:"otherLayerCacheVersionGL4",checkListKey:"otherChecklistCacheGL4",followListKey:"otherFollowListCacheGL4",mapFeatherKey:"mapFeathersCacheGL4"},mapFeathers:[{name:"Light Map",value:"light",locale:"lightMap"},{name:"Dark Map",value:"dark",locale:"darkMap"},{name:"Satelite Map",value:"satellite",locale:"satelliteMap"},{name:"Nautical Map",value:"nautical",locale:"nauticalMap"}],checkList:[]}},computed:{listStyle(){return this.simple?{top:this.top+"px",left:this.toggle?"0px":"-280px"}:{top:this.top+"px",right:this.toggle?"0px":"-280px"}}},watch:{"menuToggle.v":{handler(){this.toggle=this.menuToggle.otherLayers,this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},realTime:{handler(o,e){o&&e&&o!==e&&this.checkList.includes("day-night")&&this.fetchDayNightLayer()}},theme:{handler(){this.theme==="light"?this.mapFeather=["light","nautical"].includes(this.mapFeather)?this.mapFeather:"light":this.theme==="dark"&&(this.mapFeather=["dark","satellite"].includes(this.mapFeather)?this.mapFeather:"dark")}},mapFeather:{handler(){localStorage.setItem(this.cache.mapFeatherKey,this.mapFeather),this.$emit("mapFeather",this.mapFeather),this.$emit("theme",["light","nautical"].includes(this.mapFeather)?"light":"dark")},immediate:!0},checkList:{handler(o,e){localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),this.activeOtherLayers=this.tagLayers.filter(l=>this.checkList.includes(l.key))||[];const a=o==null?void 0:o.filter(l=>!(e!=null&&e.includes(l))),r=e==null?void 0:e.filter(l=>!(o!=null&&o.includes(l))),i=o==null?void 0:o.filter(l=>e==null?void 0:e.includes(l));if((r==null?void 0:r.length)>0&&r.forEach(l=>{this.otherLayers[l]=void 0,delete this.otherLayers[l]}),(a==null?void 0:a.length)>0){const l=this.tagLayers.filter(n=>this.checkList.includes(n.key)&&!i.includes(n.key))||[];this.handleLayersChange(l)}this.$emit("otherCheckList",this.checkList)}}},async mounted(){this.fetchCache()},methods:{fetchCache(){const o=localStorage.getItem(this.cache.versionKey);this.cache.v!==o&&(localStorage.removeItem(this.cache.checkListKey),localStorage.removeItem(this.cache.followListKey),localStorage.removeItem(this.cache.mapFeatherKey),localStorage.setItem(this.cache.versionKey,this.cache.v));let e=localStorage.getItem(this.cache.checkListKey);this.checkList=JSON.parse(e||'["eca-zones"]'),localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),e=localStorage.getItem(this.cache.mapFeatherKey);const a=e||"dark";this.$emit("mapFeather",a),localStorage.setItem(this.cache.mapFeatherKey,a)},handleMenuToggle(){this.$emit("menuToggle","otherLayers")},handleToggleMapFeather(o){this.mapFeather=o.value},async fetchOtherLayers(){var e,a;let o=this.layerWeight;if(o){const r=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],i=await ce.get(`${r}/api/arc/other/layers/links?l=${o}&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});if(((e=i==null?void 0:i.data)==null?void 0:e.code)===0){const l=(a=i==null?void 0:i.data)==null?void 0:a.data,n=[];for(const s in l)n.push(ce.get(l[s],{headers:{Authorization:this.defaultMeteoToken,key:s}}));(await Promise.all(n)).map(s=>{var g,u,y;const m=((g=s==null?void 0:s.data)==null?void 0:g.data)||(s==null?void 0:s.data),d=(y=(u=s==null?void 0:s.config)==null?void 0:u.headers)==null?void 0:y.key;this.otherLayers[d]=m})}}},async fetchDayNightLayer(){var a,r;const o=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],e=await ce.get(`${o}/api/arc/other/layers/links?l=1024&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});((a=e==null?void 0:e.data)==null?void 0:a.code)===0&&(this.otherLayers["day-night"]=((r=e==null?void 0:e.data)==null?void 0:r.data)||(e==null?void 0:e.data))},handleLayersChange(o){const e=o==null?void 0:o.reduce((a,r)=>a+(r==null?void 0:r.weight),0);this.layerWeight=e,this.fetchOtherLayers()}}},ac={class:"idm-gl4-other-layer"},ic={class:"header-box w-100 d-flex justify-space-between align-center px-4"},rc={class:"text-h5 font-weight-medium"},lc={class:"layers-body mt-4 mb-2 d-flex justify-start align-center flex-wrap"},nc=["onClick"],sc={key:0,src:"https://ossimg.ormwx.com/asset/dark-map.png",class:"border rounded-sm"},cc={key:1,src:"https://ossimg.ormwx.com/asset/nautical-map.png",class:"border rounded-sm"},mc={key:2,src:"https://ossimg.ormwx.com/asset/satellite-map.png",class:"border rounded-sm"},dc={key:3,src:"https://ossimg.ormwx.com/asset/light-map.png",class:"border rounded-sm"},hc={class:"text-body-2 text-center pt-2"};function pc(o,e,a,r,i,l){var ne,S,Z,H,q,W,B,J,E;const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardTitle"),m=t.resolveComponent("VCardItem"),d=t.resolveComponent("VCheckbox"),g=t.resolveComponent("VCardText"),u=t.resolveComponent("VCard"),y=t.resolveComponent("IdmPort"),p=t.resolveComponent("IdmTideStations"),h=t.resolveComponent("IdmLatLng"),f=t.resolveComponent("IdmTerminator"),w=t.resolveComponent("IdmTimezone"),b=t.resolveComponent("IdmAlertZone"),L=t.resolveComponent("IdmEcaZone"),k=t.resolveComponent("IdmWarZone"),C=t.resolveComponent("IdmGmdssArea"),A=t.resolveComponent("IdmLoadLine"),_=t.resolveComponent("IdmWorldMarine"),z=t.resolveComponent("IdmVRA"),P=t.resolveComponent("IdmSpecialArea"),V=t.resolveComponent("IdmWorld12nm"),N=t.resolveComponent("IdmChinaRoute"),j=t.resolveComponent("IdmIceAreas"),U=t.resolveComponent("IdmNsrAreas"),K=t.resolveComponent("IdmFollowPort"),de=t.resolveComponent("IdmFollowPosition");return t.openBlock(),t.createElementBlock("div",ac,[t.createElementVNode("div",{class:t.normalizeClass(["menu-bar-box transition px-1 rounded",a.simple?"simple":""]),style:t.normalizeStyle({top:a.top+10+"px",right:i.right+"px",paddingTop:a.paddingTop+"px",height:a.menuHeight+"px"})},[t.createVNode(c,{text:o.$t("layer.mapLayers"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:I})=>[t.createVNode(n,t.mergeProps(I,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[5]||(e[5]=[t.createElementVNode("i",{class:"iconfont icon-Layer text-h4"},null,-1)])),_:2,__:[5]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],6),t.createElementVNode("div",{class:t.normalizeClass(["available-layers transition d-flex flex-column justify-start align-start",i.toggle?"right-bar":""]),style:t.normalizeStyle(l.listStyle)},[t.createElementVNode("div",ic,[t.createElementVNode("div",rc,t.toDisplayString(o.$t("layer.layers")),1),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleMenuToggle},{default:t.withCtx(()=>e[6]||(e[6]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[6]},8,["onClick"])]),t.createElementVNode("div",{class:t.normalizeClass(["list-box w-100 flex-1-1-0 scroll overflow-y-auto",a.simple?"px-3":"pl-4 pr-2"])},[t.createVNode(u,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.mapFeathers")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"pb-2"},{default:t.withCtx(()=>[t.createElementVNode("div",lc,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.mapFeathers,I=>(t.openBlock(),t.createElementBlock("div",{key:I.value,class:"mb-4 feather-item",onClick:ie=>l.handleToggleMapFeather(I)},[t.createElementVNode("div",{class:t.normalizeClass([i.mapFeather===I.value?"active":"","img-box"])},[I.value==="dark"?(t.openBlock(),t.createElementBlock("img",sc)):I.value==="nautical"?(t.openBlock(),t.createElementBlock("img",cc)):I.value==="satellite"?(t.openBlock(),t.createElementBlock("img",mc)):(t.openBlock(),t.createElementBlock("img",dc))],2),t.createElementVNode("div",hc,t.toDisplayString(o.$t(`layer.${I.locale}`)),1)],8,nc))),128))]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(I=>["graticule","day-night","time-zones"].includes(I.key)),I=>(t.openBlock(),t.createBlock(d,{key:I.key,modelValue:i.checkList,"onUpdate:modelValue":e[0]||(e[0]=ie=>i.checkList=ie),value:I.key,label:o.$t(`layer.${I.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2 mx-n1","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),t.createVNode(u,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.pointsOfInteresting")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(I=>["ports","alert-zones","tidal-stations"].includes(I.key)),I=>(t.openBlock(),t.createBlock(d,{key:I.key,modelValue:i.checkList,"onUpdate:modelValue":e[1]||(e[1]=ie=>i.checkList=ie),value:I.key,label:o.$t(`layer.${I.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),t.createVNode(u,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.otherLayers")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(I=>!["graticule","day-night","time-zones","ports","alert-zones","tidal-stations"].includes(I.key)),I=>(t.openBlock(),t.createBlock(d,{key:I.key,modelValue:i.checkList,"onUpdate:modelValue":e[2]||(e[2]=ie=>i.checkList=ie),value:I.key,label:o.$t(`layer.${I.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),t.createVNode(u,{class:"block-bg mx-auto mb-3",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.myFollows")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[t.createVNode(d,{modelValue:i.checkList,"onUpdate:modelValue":e[3]||(e[3]=I=>i.checkList=I),value:"follow-ports",label:o.$t("layer.ports"),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","label"]),t.createVNode(d,{modelValue:i.checkList,"onUpdate:modelValue":e[4]||(e[4]=I=>i.checkList=I),value:"follow-positions",label:o.$t("layer.locations"),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","label"])]),_:1})]),_:1})],2)],6),a.map?(t.openBlock(),t.createBlock(y,t.mergeProps({key:0,ref:"idmPorts",simple:a.simple,map:a.map,ports:(ne=i.otherLayers)==null?void 0:ne.ports,gateway:a.gateway,token:a.token,"forecast-model":a.forecastModel,"real-time":a.realTime,theme:a.theme},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","ports","gateway","token","forecast-model","real-time","theme"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(p,t.mergeProps({key:1,ref:"idmIideStation",simple:a.simple,map:a.map,gateway:a.gateway,token:a.token,"default-meteo-token":a.defaultMeteoToken,show:i.checkList.includes("tidal-stations"),theme:a.theme,"real-time":a.realTime,"forecast-model":a.forecastModel,"before-layer":"empty-layer-3"},o.$attrs),null,16,["simple","map","gateway","token","default-meteo-token","show","theme","real-time","forecast-model"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(h,t.mergeProps({key:2,simple:a.simple,map:a.map,"menu-toggle":a.menuToggle,show:i.checkList.includes("graticule")},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","menu-toggle","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(f,t.mergeProps({key:3,map:a.map,area:(S=i.otherLayers)==null?void 0:S["day-night"]},o.$attrs,{"before-layer":"empty-layer-2"}),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(w,t.mergeProps({key:4,map:a.map,zone:(Z=i.otherLayers)==null?void 0:Z["time-zones"],"real-time":a.realTime},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["map","zone","real-time"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(b,t.mergeProps({key:5,map:a.map,simple:a.simple,zone:(H=i.otherLayers)==null?void 0:H["alert-zones"]},o.$attrs,{"before-layer":"empty-layer-3",theme:a.theme}),null,16,["map","simple","zone","theme"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(L,t.mergeProps({key:6,map:a.map,zone:(q=i.otherLayers)==null?void 0:q["eca-zones"]},o.$attrs),null,16,["map","zone"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(k,t.mergeProps({key:7,map:a.map,zone:(W=i.otherLayers)==null?void 0:W["war-zones"]},o.$attrs),null,16,["map","zone"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(C,t.mergeProps({key:8,map:a.map,area:(B=i.otherLayers)==null?void 0:B["gmdss-areas"]},o.$attrs),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(A,t.mergeProps({key:9,map:a.map,show:i.checkList.includes("load-lines")},o.$attrs),null,16,["map","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(_,t.mergeProps({key:10,map:a.map,token:a.token,show:i.checkList.includes("worldMarine")},o.$attrs),null,16,["map","token","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(z,t.mergeProps({key:11,map:a.map,area:(J=i.otherLayers)==null?void 0:J["voluntary-reporting-area"]},o.$attrs),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(P,t.mergeProps({key:12,map:a.map,area:(E=i.otherLayers)==null?void 0:E["special-area"]},o.$attrs),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(V,t.mergeProps({key:13,map:a.map,token:a.token,show:i.checkList.includes("world12nm")},o.$attrs),null,16,["map","token","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(N,t.mergeProps({key:14,map:a.map,token:a.token,show:i.checkList.includes("chinaRoute")},o.$attrs),null,16,["map","token","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(j,t.mergeProps({key:15,map:a.map,show:i.checkList.includes("ice-areas")},o.$attrs),null,16,["map","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(U,t.mergeProps({key:16,map:a.map,show:i.checkList.includes("nsr")},o.$attrs),null,16,["map","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(K,t.mergeProps({key:17,ref:"idmFollowPort",simple:a.simple,map:a.map,show:i.checkList.includes("follow-ports"),gateway:a.gateway,token:a.token,"forecast-model":a.forecastModel,"real-time":a.realTime},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","show","gateway","token","forecast-model","real-time"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(de,t.mergeProps({key:18,ref:"idmFollowPosition",simple:a.simple,map:a.map,show:i.checkList.includes("follow-positions"),"forecast-model":a.forecastModel,"real-time":a.realTime},o.$attrs),null,16,["simple","map","show","forecast-model","real-time"])):t.createCommentVNode("",!0)])}const gc=Q(oc,[["render",pc]]);class Mo{constructor(e){pe(this,"map");pe(this,"mercator");pe(this,"rampColorLayer");pe(this,"rampColorSource");pe(this,"particleLayer");pe(this,"particleSource");pe(this,"rampColorCanvas");pe(this,"particleCanvas");pe(this,"ratio");this.map=e,this.mercator=new qr,this.rampColorLayer="ramp-color-layer",this.rampColorSource="ramp-color-source",this.particleLayer="particle-layer",this.particleSource="particle-source",this.rampColorCanvas=document.createElement("canvas"),this.particleCanvas=document.createElement("canvas"),this.ratio=window.devicePixelRatio}convertNLng(e,a=0){return e>180?this.convertNLng(e-360,a+1):e<-180?this.convertNLng(e+360,a+1):[e,a]}getBoundLngLat(){var a;const e=(a=this.map)==null?void 0:a.getBounds();return e?[[e._sw.lng,e._ne.lat],[e._ne.lng,e._ne.lat],[e._ne.lng,e._sw.lat],[e._sw.lng,e._sw.lat]]:[]}getBoundPixel(){var p,h;const e=(p=this.map)==null?void 0:p.getBounds();if(!e)return[];const a=((h=this.map)==null?void 0:h.getZoom())+1,r=[e._ne.lng,e._ne.lat],i=[e._sw.lng,e._sw.lat],[l,n]=this.convertNLng(r[0]),[c,s]=this.convertNLng(i[0]),[m,d]=this.mercator.px([l,r[1]],a),[g,u]=this.mercator.px([c,i[1]],a),y=Math.round(this.mercator.size*Math.pow(2,a)*(n+s));return[g,u,m+y,d]}getBoundRange(){const e=this.map.getZoom()+1,a=this.mercator.size*Math.pow(2,e),r=this.getBoundPixel();return[r[0]/a,r[2]/a,r[3]/a,r[1]/a]}getWorldCopy(e,a){const r=2**a,[i,l,n,c]=e.map(d=>~~(d/(r*256))),s=[];for(let d=c;d<=l;d++)for(let g=i;g<=n;g++)s.push([g,d]);return s.map(d=>{const g=2**a*256;return[d[0]*g,d[1]*g,g]})}resize(){let e=this.map.getSource(this.rampColorSource);e==null||e.setCoordinates(this.getBoundLngLat()),e=this.map.getSource(this.particleSource),e==null||e.setCoordinates(this.getBoundLngLat()),this.rampColorCanvas.width=this.map._canvas.clientWidth,this.rampColorCanvas.height=this.map._canvas.clientHeight,this.particleCanvas.width=this.map._canvas.clientWidth,this.particleCanvas.height=this.map._canvas.clientHeight}toggle(e){var i;if(!((i=this.map)!=null&&i.getLayer(this.rampColorLayer)))return;const a=this.map.getLayoutProperty(this.rampColorLayer,"visibility"),r=e?"visible":"none";a!==r&&this.map.setLayoutProperty(this.rampColorLayer,"visibility",r)}toggleParticle(e){var i;if(!((i=this.map)!=null&&i.getLayer(this.particleLayer)))return;const a=this.map.getLayoutProperty(this.particleLayer,"visibility"),r=e?"visible":"none";a!==r&&this.map.setLayoutProperty(this.particleLayer,"visibility",r)}}class $e{createShader(e,a,r){const i=e.createShader(a);if(i&&(e.shaderSource(i,r),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)))throw new Error(e.getShaderInfoLog(i)||"error happened while create shader...");return i}createTexture(e,a,r,i,l,n,c){const s=e.createTexture();return e.bindTexture(e.TEXTURE_2D,s),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,i),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,i),l instanceof Uint8Array?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n,c,0,e.RGBA,e.UNSIGNED_BYTE,l):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,l),e.bindTexture(e.TEXTURE_2D,null),s}createDataBuffer(e,a,r){if(e){const i=e.createBuffer();return a==="array"?(e.bindBuffer(e.ARRAY_BUFFER,i),r&&e.bufferData(e.ARRAY_BUFFER,r,e.STATIC_DRAW)):a==="element"&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i),r&&e.bufferData(e.ELEMENT_ARRAY_BUFFER,r,e.STATIC_DRAW)),i}return null}createProgram(e,a,r){const i=e.createProgram(),l=this.createShader(e,e.VERTEX_SHADER,a),n=this.createShader(e,e.FRAGMENT_SHADER,r);if(i&&l&&n&&(e.attachShader(i,l),e.attachShader(i,n),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS)))throw new Error(e.getProgramInfoLog(i)||"error happened while creating ramp color program");return i}createProgramWrapper(e,a,r){const i=this.createProgram(e,a,r);if(i){const l={program:i},n=e.getProgramParameter(i,e.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){const m=e.getActiveAttrib(i,s);l[m.name]=e.getAttribLocation(i,m.name)}const c=e.getProgramParameter(i,e.ACTIVE_UNIFORMS);for(let s=0;s<c;s++){const m=e.getActiveUniform(i,s);l[m.name]=e.getUniformLocation(i,m.name)}return l}}setup(e,a,r=!1,i,l){const n=document.createElement("canvas");n.width=256,n.height=1;const c=n.getContext("2d");if(c&&e){const s=c==null?void 0:c.createLinearGradient(0,0,256,0);return a.forEach(([m,d])=>{s.addColorStop(m,d)}),c.fillStyle=s,c.fillRect(0,0,256,1),{canvas:n,texture:this.createTexture(e,e.LINEAR,e.LINEAR,e.CLAMP_TO_EDGE,r?new Uint8Array(c.getImageData(0,0,256,1).data):n,i,l)}}}setupParticle(e,a=1e3){const r=Math.ceil(Math.sqrt(a)),i=r*r,l=new Uint8Array(i*4);for(let d=0;d<l.length;d++)l[d]=Math.floor(Math.random()*256);const n=this.createTexture(e,e.NEAREST,e.NEAREST,e.CLAMP_TO_EDGE,l,r,r),c=this.createTexture(e,e.NEAREST,e.NEAREST,e.CLAMP_TO_EDGE,l,r,r),s=new Float32Array(i);for(let d=0;d<i;d++)s[d]=d;const m=this.createDataBuffer(e,"array",s);return{resolution:r,total:i,texture0:n,texture1:c,indexBuffer:m}}bind(e,a,r){const i=this.createProgram(e,a,r);if(i){const l=this.createDataBuffer(e,"array",void 0),n=e.getAttribLocation(i,"a_position");e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0);const c=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]);this.createDataBuffer(e,"array",c);const s=e.getAttribLocation(i,"a_texCoord");return e.enableVertexAttribArray(s),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),{program:i,aPositionBuffer:l}}return{}}bindParticle(e,a,r,i,l,n){const c=this.createProgramWrapper(e,a,r),s=this.createProgramWrapper(e,i,l),m=this.createProgramWrapper(e,i,n),d=this.createDataBuffer(e,"array",new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1])),g=e.createFramebuffer();return{particle:c,screen:s,update:m,quadBuffer:d,frameBuffer:g}}draw(e,a,r,i,l,n,c){var s,m;if(a&&r){e.resize(),a==null||a.viewport(0,0,(s=a==null?void 0:a.canvas)==null?void 0:s.width,(m=a==null?void 0:a.canvas)==null?void 0:m.height),a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT);try{a.useProgram(r);const d={resolution:a.getUniformLocation(r,"u_resolution"),image:a.getUniformLocation(r,"u_image"),color:a.getUniformLocation(r,"u_color"),scale:a.getUniformLocation(r,"u_scale"),uvRange:a.getUniformLocation(r,"u_range_u_v"),sRange:a.getUniformLocation(r,"u_range_s")};d.resolution&&a.uniform2f(d.resolution,a.canvas.width*e.ratio,a.canvas.height*e.ratio),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,i),d.image&&a.uniform1i(d.image,0),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,l),d.color&&a.uniform1i(d.color,1),c!=null&&c.uvRange&&(c!=null&&c.sRange)&&(d.uvRange&&a.uniform2f(d.uvRange,c.uvRange[0],c.uvRange[1]),d.sRange&&a.uniform2f(d.sRange,c.sRange[0],c.sRange[1])),d.scale&&a.uniform1f(d.scale,(c==null?void 0:c.scale)||1);const g=e.getBoundPixel(),u=e.map.getZoom()+1,y=e.getWorldCopy(g,u);for(const p of y){const h=(p[0]-g[0])*e.ratio,f=(p[1]-g[3])*e.ratio,w=p[2]*e.ratio,[b,L,k,C]=[h,w+h,f,w+f],A=new Float32Array([b,k,L,k,b,C,b,C,L,k,L,C]);a.bindBuffer(a.ARRAY_BUFFER,n),a.bufferData(a.ARRAY_BUFFER,A,a.STATIC_DRAW),a.drawArrays(a.TRIANGLES,0,6)}}catch(d){console.log(`render failed...${d}`)}}}drawParticle(e,a,r,i,l){var n,c;a&&(a==null||a.viewport(0,0,(n=a==null?void 0:a.canvas)==null?void 0:n.width,(c=a==null?void 0:a.canvas)==null?void 0:c.height),a.disable(a.DEPTH_TEST),a.disable(a.STENCIL_TEST),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,r),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,i.texture0),this.renderScreen(e,a,i,l),this.updateParticles(e,a,i,l))}renderScreen(e,a,r,i){a.bindFramebuffer(a.FRAMEBUFFER,r.frameBuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r.screenTexture,0),a.viewport(0,0,a.canvas.width,a.canvas.height),this.renderScreenTexture(a,r.backgroundTexture,r.screen,r.quadBuffer,.95),this.renderParticles(e,a,r,i),a.bindFramebuffer(a.FRAMEBUFFER,null),this.renderScreenTexture(a,r.screenTexture,r.screen,r.quadBuffer,1);const l=r.backgroundTexture;r.backgroundTexture=r.screenTexture,r.screenTexture=l}renderScreenTexture(e,a,r,i,l){e&&(e.useProgram(r.program),e.bindBuffer(e.ARRAY_BUFFER,i),e.enableVertexAttribArray(r.a_pos),e.vertexAttribPointer(r.a_pos,2,e.FLOAT,!1,0,0),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,a),e.uniform1i(r.u_screen,2),e.uniform1f(r.u_opacity,l),e.drawArrays(e.TRIANGLES,0,6))}renderParticles(e,a,r,i){if(a){a.useProgram(r.particle.program),a.bindBuffer(a.ARRAY_BUFFER,r.indexBuffer),a.enableVertexAttribArray(r.particle.a_index),a.vertexAttribPointer(r.particle.a_index,1,a.FLOAT,!1,0,0),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,r.color.texture),a.uniform1i(r.particle.u_factor,0),a.uniform1i(r.particle.u_particles,1),a.uniform1i(r.particle.u_color_ramp,2),a.uniform1f(r.particle.u_particles_resolution,r.resolution*e.ratio),a.uniform1f(r.particle.u_point,e.ratio);const l=e.getBoundRange();a.uniform4f(r.particle.u_viewport,l[0],l[1],l[2],l[3]),a.uniform2f(r.particle.u_factor_min,i.uvRange[0],i.uvRange[0]),a.uniform2f(r.particle.u_factor_max,i.uvRange[1],i.uvRange[1]),a.drawArrays(a.POINTS,0,r.total)}}updateParticles(e,a,r,i){var n,c;if(a){a.bindFramebuffer(a.FRAMEBUFFER,r.frameBuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r.texture1,0),a.viewport(0,0,r.resolution,r.resolution),a.useProgram(r.update.program),a.bindBuffer(a.ARRAY_BUFFER,r.quadBuffer),a.enableVertexAttribArray(r.update.a_pos),a.vertexAttribPointer(r.update.a_pos,2,a.FLOAT,!1,0,0),a.uniform1i(r.update.u_factor,0),a.uniform1i(r.update.u_particles,1);const s=e.getBoundRange();a.uniform4f(r.update.u_viewport,s[0],s[1],s[2],s[3]),a.uniform1f(r.update.u_rand_seed,Math.random()),a.uniform2f(r.update.u_factor_res,(n=r==null?void 0:r.image)==null?void 0:n.width,(c=r==null?void 0:r.image)==null?void 0:c.height),a.uniform2f(r.update.u_factor_min,i.uvRange[0],i.uvRange[0]),a.uniform2f(r.update.u_factor_max,i.uvRange[1],i.uvRange[1]),a.uniform1f(r.update.u_speed_factor,i.speedFactor*e.ratio),a.uniform1f(r.update.u_drop_rate,i.dropRate),a.uniform1f(r.update.u_drop_rate_bump,i.dropRateBump),a.drawArrays(a.TRIANGLES,0,6)}const l=r.texture0;r.texture0=r.texture1,r.texture1=l}resize(e,a){e.resize();const r=new Uint8Array(a.canvas.width*a.canvas.height*4).fill(0,0,a.canvas.width*a.canvas.height*4),i=this.createTexture(a,a.NEAREST,a.NEAREST,a.CLAMP_TO_EDGE,r,a.canvas.width,a.canvas.height),l=this.createTexture(a,a.NEAREST,a.NEAREST,a.CLAMP_TO_EDGE,r,a.canvas.width,a.canvas.height);return{screenTexture:i,backgroundTexture:l}}async loadImg(e){return new Promise(a=>{const r=new Blob([e],{type:e.type}),i=URL.createObjectURL(r),l=new Image;l.crossOrigin="anonymous",l.src=i,l.onload=()=>a(l)})}}class fe{}pe(fe,"vertexSchema",`
|
|
10
|
+
</div>`)}),r}},legend:{show:!0,right:20,top:0,itemWidth:30,data:["Height"],textStyle:{color:this.Theme.current.value.colors["on-surface"]}},grid:{top:40,left:10,right:10,bottom:30,containLabel:!0},xAxis:[{type:"category",data:this.xDate,boundaryGap:!0,axisTick:{alignWithLabel:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLabel:{interval:"auto",margin:15,textStyle:{fontSize:12,color:this.Theme.current.value.colors["echart-axis"]}}}],yAxis:[{name:"(m)",show:!0,nameLocation:"end",position:"left",nameGap:15,splitNumber:5,splitLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-split"]}},alignTicks:!0,axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLabel:{textStyle:{fontSize:12,color:this.Theme.current.value.colors["echart-axis"]}}}],series:[{name:"Height",type:"line",showSymbol:!0,yAxisIndex:0,lineStyle:{color:this.Theme.current.value.colors["map-perple"]},itemStyle:{color:this.Theme.current.value.colors["map-perple"]},data:this.echartData.height}]};o==null||o.setOption(e)},handleClose(){this.$emit("close")}}},$n={class:"d-flex justify-space-between align-center"},es={class:"d-flex justify-start text-h5 my-2"},ts={class:"d-flex justify-start align-center text-h6 text-label ga-3"},os={class:"summary-box w-100"},as={class:"d-flex justify-space-between align-center py-2"},is={class:"d-flex justify-center align-center text-h6 ga-2"},rs={class:"multi-color-icon","aria-hidden":"true"},ls=["xlink:href"],ns={class:"gray-bg-2 rounded d-flex flex-column ga-4 pa-4"},ss={class:"w-100 d-flex justify-start align-center"},cs={class:"w-30 text-label font-weight-400"},ms={class:"flex-1-1-0"},ds={class:"w-100 d-flex justify-start align-center"},hs={class:"w-30 text-label font-weight-400"},ps={class:"flex-1-1-0"},gs={class:"w-100 d-flex justify-start align-center"},us={class:"w-30 text-label font-weight-400"},fs={class:"flex-1-1-0"},ys={class:"table-box w-100 mt-2 mb-4 d-flex flex-column justify-start align-center"},bs={class:"w-100 d-flex justify-space-between align-center py-2"},ws={class:"d-flex justify-center align-center text-h6 ga-2"},xs={class:"multi-color-icon","aria-hidden":"true"},ks=["xlink:href"],As={ref:"tideEchart",class:"w-100",style:{height:"244px"}},Ls={"fixed-header":"",density:"compact",class:"w-100 tide-table bg-none"},Cs={class:"px-1 text-center text-label font-weight-400",width:"120"},vs={class:"px-1 text-center text-label font-weight-400",width:"120"},zs={class:"px-1 text-center text-label font-weight-400",width:"120"},_s={class:"px-1 text-center"},Ss={class:"px-1 text-center"},Ns={class:"px-1 text-center"};function Ms(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VBtnToggle"),d=t.resolveComponent("VCard");return t.openBlock(),t.createBlock(d,{class:t.normalizeClass(["tide-detail-container d-flex flex-column justify-start align-center",a.simple?"page":"dialog"])},{default:t.withCtx(()=>{var g,u;return[t.createVNode(c,{class:"w-100"},{default:t.withCtx(()=>{var y;return[t.createElementVNode("div",$n,[t.createElementVNode("div",es,[t.createElementVNode("div",null,t.toDisplayString((y=a.station)==null?void 0:y.name),1)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"",onClick:l.handleClose},{default:t.withCtx(()=>e[1]||(e[1]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[1]},8,["onClick"])]),t.createElementVNode("div",ts,[t.createElementVNode("div",null,t.toDisplayString(o.$t("tide.tideStation")),1)])]}),_:1}),t.createVNode(s,{class:"w-100"}),t.createElementVNode("div",{class:t.normalizeClass(["w-100 pt-0 pb-0 overflow-y-auto scroll",a.simple?"px-3":"px-5"])},[t.createElementVNode("div",os,[t.createElementVNode("div",as,[t.createElementVNode("div",is,[(t.openBlock(),t.createElementBlock("svg",rs,[t.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,ls)])),t.createElementVNode("div",null,t.toDisplayString(o.$t("detail.summary")),1)])]),t.createElementVNode("div",ns,[t.createElementVNode("div",ss,[t.createElementVNode("div",cs,t.toDisplayString(o.$t("tide.region")),1),t.createElementVNode("div",ms,t.toDisplayString(((g=a.station)==null?void 0:g.Country)??((u=a.station)==null?void 0:u.city)??"-"),1)]),t.createElementVNode("div",ds,[t.createElementVNode("div",hs,t.toDisplayString(o.$t("tide.position")),1),t.createElementVNode("div",ps,t.toDisplayString(l.computePosition(a.station)),1)]),t.createElementVNode("div",gs,[t.createElementVNode("div",us,t.toDisplayString(o.$t("time.localTime")),1),t.createElementVNode("div",fs,t.toDisplayString(l.computeLocalTime(a.realTime,a.station))+" "+t.toDisplayString(l.computeTimeOffset(a.station)),1)])])]),t.createElementVNode("div",ys,[t.createElementVNode("div",bs,[t.createElementVNode("div",ws,[(t.openBlock(),t.createElementBlock("svg",xs,[t.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,ks)])),t.createElementVNode("div",null,t.toDisplayString(o.$t("tide.tideTimes")),1)]),e[2]||(e[2]=t.createElementVNode("div",{class:"text-body-2 text-success ga-2"},null,-1))]),t.createElementVNode("div",{class:t.normalizeClass(["w-100 gray-bg-2 rounded",a.simple?"pa-2":"pa-4 py-2"])},[t.createVNode(m,{modelValue:i.currentIndex,"onUpdate:modelValue":e[0]||(e[0]=y=>i.currentIndex=y),class:"w-100 d-flex justify-space-around align-center ga-0 mb-4",density:"compact",group:"",height:"26","min-height":"26",rounded:"1",mandatory:""},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.dateList,y=>(t.openBlock(),t.createBlock(n,{key:y.label,class:t.normalizeClass(["text-none text-body-1 flex-1-1-0",`bg-${y.index===i.currentIndex?"bg-primary":"gray-bg-2"}`]),density:"compact",color:"primary",height:"26",value:y.index},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(y.label),1)]),_:2},1032,["class","value"]))),128))]),_:1},8,["modelValue"]),t.createElementVNode("div",As,null,512),t.createElementVNode("table",Ls,[t.createElementVNode("tbody",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",Cs,t.toDisplayString(o.$t("tide.tide")),1),t.createElementVNode("th",vs,t.toDisplayString(o.$t("time.time"))+" ( LT ) ",1),t.createElementVNode("th",zs,t.toDisplayString(o.$t("tide.height"))+" ( m )",1)]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tideTableData,(y,p)=>{var h;return t.openBlock(),t.createElementBlock("tr",{key:p},[t.createElementVNode("td",_s,t.toDisplayString(o.$t(`tide.${(h=y==null?void 0:y.type)==null?void 0:h.toLowerCase()}`))+" "+t.toDisplayString(o.$t("tide.tide")),1),t.createElementVNode("td",Ss,t.toDisplayString(l.computeLocalTime(y==null?void 0:y.date,a.station,"MM-DD HH:mm")),1),t.createElementVNode("td",Ns,t.toDisplayString((y==null?void 0:y.height)??"-")+" m",1)])}),128))])])],2)])],2)]}),_:1},8,["class"])}const Ps=Q(qn,[["render",Ms],["__scopeId","data-v-5c51381d"]]),j1="",Vs={name:"IdmTideStations",components:{TideDetail:Ps},props:{map:{type:Object},show:{type:Boolean},locale:{type:String},beforeLayer:{type:String}},data(){return{layer:"tide-stations",showInfo:!1,hoverStation:void 0,marker:null,showDetail:!1,station:void 0}},watch:{show:{handler(){var o,e,a,r,i,l;this.show?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):(this.handleClear(),(r=this.map)==null||r.off("click",[this.layer],this.handleClick),(i=this.map)==null||i.off("mousemove",[this.layer],this.handleHover),(l=this.map)==null||l.off("mouseleave",[this.layer],this.handleLeave))},immediate:!0},locale:{handler(){this.show&&this.handleRender()},immediate:!0}},methods:{handleRender(){var o;(o=this.map)!=null&&o.getLayer(this.layer)&&(this.map.setLayoutProperty(this.layer,"visibility","visible"),this.map.setLayoutProperty(this.layer,"text-field",this.locale==="en"?"{Location_EN}":"{Location_CN}"))},handleClear(){var o;this.showInfo=!1,(o=this.map)!=null&&o.getLayer(this.layer)&&this.map.setLayoutProperty(this.layer,"visibility","none")},handleClick(o){const e=o.features[0];e.properties&&(this.station=e.properties,this.station.name=this.locale==="en"?e.properties.Location_EN:e.properties.Location_CN,this.station.lng=e.geometry.coordinates[0],this.station.lat=e.geometry.coordinates[1],this.showDetail=!0)},handleHover(o){var a,r;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties){this.showInfo=!0,this.hoverStation=e.properties,this.hoverStation.name=this.locale==="en"?e.properties.Location_EN:e.properties.Location_CN,this.hoverStation.lng=e.geometry.coordinates[0],this.hoverStation.lat=e.geometry.coordinates[1],(a=this.marker)==null||a.remove();const i=(r=document.getElementById("idmTidalInfo"))==null?void 0:r.cloneNode(!0);this.marker=new me.Marker(i).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-60]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,this.hoverStation={},(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"},handleCloseDetail(){this.showDetail=!1}}},Ts={class:"station-box d-flex flex-column justify-center align-start ga-1"},Es={class:"d-flex justify-start align-center"},Ds={class:"d-flex justify-start align-center"},Rs={class:"text-label"};function Bs(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard"),s=t.resolveComponent("TideDetail");return t.openBlock(),t.createElementBlock("div",null,[t.withDirectives(t.createVNode(c,{id:"idmTidalInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"pr-8 text-body-1"},{default:t.withCtx(()=>{var m,d;return[t.createElementVNode("div",Ts,[t.createElementVNode("div",Es,t.toDisplayString(o.$t("tide.tideStation")),1),t.createElementVNode("div",Ds,[t.createElementVNode("label",Rs,t.toDisplayString((m=i.hoverStation)==null?void 0:m.name)+" , "+t.toDisplayString(((d=i.hoverStation)==null?void 0:d.Country)||"-"),1)])])]}),_:1})]),_:1},512),[[t.vShow,i.showInfo]]),i.showDetail?(t.openBlock(),t.createBlock(s,t.mergeProps({key:0,station:i.station},o.$attrs,{onClose:l.handleCloseDetail}),null,16,["station","onClose"])):t.createCommentVNode("",!0)])}const Is=Q(Vs,[["render",Bs],["__scopeId","data-v-ad725d5e"]]),Fs={name:"IdmIceAreas",props:{map:{type:Object},show:{type:Boolean}},data(){return{lineLayer:"ice-area-line",fillLayer:"ice-area-fill"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var o,e;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","visible"),(e=this.map)!=null&&e.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","visible")},handleClear(){var o,e;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","none"),(e=this.map)!=null&&e.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","none")}}};function Gs(o,e,a,r,i,l){return null}const js=Q(Fs,[["render",Gs]]),W1="",Ws={name:"IdmLatLng",props:{simple:{type:Boolean,default:!1},map:{type:Object},show:{type:Boolean},mapFeather:{type:String},beforeLayer:{type:String},menuToggle:{type:Object}},data(){return{lngLat:{e:{lng:0,lat:0},lng:0,lat:0,str:""},source:"idm-lat-lng-source",layer:"idm-lat-lng-layer",labelLayer:"idm-lat-lng-label-layer",right:10}},computed:{lineColor(){return["satellite","dark"].includes(this.mapFeather)?"rgba(255, 255, 255, 0.3)":"rgba(0, 0, 0, 0.3)"},labelColor(){return["satellite","dark"].includes(this.mapFeather)?"rgba(255, 255, 255, 0.8)":"rgba(0, 0, 0, 0.5)"}},watch:{show:{handler(){this.handleBind()},immediate:!0},map:{handler(){var o;this.map&&((o=this.map)==null||o.on("mousemove",this.handleMouseMove))},immediate:!0},"menuToggle.v":{handler(){var o;this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10},immediate:!0},"lngLat.e":{handler(o){this.lngLat.lng=M.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty,this.lngLat.lat=M.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty,this.lngLat.str=`[${M.LngLatHelper.str2Lat(o==null?void 0:o.lat,4)}, ${M.LngLatHelper.str2Lng(o==null?void 0:o.lng,4)}]`},immediate:!0}},methods:{handleBind(){var o,e;this.show?((o=this.map)==null||o.on("zoomend",this.handleZoomEnd),this.handleRender()):(this.handleClear(),(e=this.map)==null||e.off("zoomend",this.handleZoomEnd))},handleMouseMove(o){this.lngLat.e=o.lngLat},handleComputeLatLngs(){var r;const o=(r=this.map)==null?void 0:r.getZoom();let e=30;o>4?e=10:o>3&&(e=15);const a=[];for(let i=-60;i<90;i+=e)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[-180,i],[180,i]]}});for(let i=-180;i<180;i+=e)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[i,-90],[i,90]]}});for(let i=180;i>-180;i-=e)for(let l=-60;l<90;l+=e)a.push({type:"Feature",geometry:{type:"Point",coordinates:[i,l]},properties:{val:`${l>0?l+" N":l===0?l:l*-1+" S"}, ${i>0?i+" E":i*-1+" W"}`}});return a},handleZoomEnd(){var e;const o=this.handleComputeLatLngs();(e=this.map)==null||e.getSource(this.source).setData(T.featureCollection(o))},handleRender(){if(this.handleClear(),this.map){const o=this.handleComputeLatLngs();this.map.addSource(this.source,{type:"geojson",data:{type:"FeatureCollection",features:o}}),this.map.addLayer({id:this.layer,type:"line",source:this.source,filter:["==","$type","LineString"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":this.lineColor,"line-width":1}},this.beforeLayer),this.map.addLayer({id:this.labelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","text-field":"{val}","text-rotation-alignment":"viewport","text-offset":[0,1],"text-size":10,"text-allow-overlap":!0},paint:{"text-opacity":1,"text-color":this.labelColor}},this.beforeLayer)}},handleClear(){var o,e,a,r,i,l;(o=this.map)!=null&&o.getLayer(this.layer)&&((e=this.map)==null||e.removeLayer(this.layer)),(a=this.map)!=null&&a.getLayer(this.labelLayer)&&((r=this.map)==null||r.removeLayer(this.labelLayer)),(i=this.map)!=null&&i.getSource(this.source)&&((l=this.map)==null||l.removeSource(this.source))}}};function Zs(o,e,a,r,i,l){var n,c,s;return a.simple?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,class:"idm-lat-lng-tip-gl4 pa-2 py-1 text-caption text-right rounded",style:t.normalizeStyle({right:i.right+"px"})},[t.createElementVNode("div",null,t.toDisplayString((n=i.lngLat)==null?void 0:n.lat),1),t.createElementVNode("div",null,t.toDisplayString((c=i.lngLat)==null?void 0:c.lng),1),t.createElementVNode("div",null,t.toDisplayString((s=i.lngLat)==null?void 0:s.str),1)],4))}const jo=Q(Ws,[["render",Zs]]),Z1="",Xs={name:"IdmFollowPort",components:{PortDetail:No},props:{map:{type:Object},beforeLayer:{type:String},forecastModel:{type:String},show:{type:Boolean},followList:{type:Array}},emits:["closeAllDetail"],setup(){return{Theme:ye.useTheme()}},data(){return{source:"follow-port-source",layer:"follow-port-layer",showInfo:!1,portId:"",hoverPort:{},port:{},marker:void 0,showDetail:!1}},watch:{show:{handler(){var o,e,a;this.show?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()},immediate:!0},followList:{handler(){var o,e,a;this.followList&&this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()}}},methods:{handleRender(){var e,a;const o={features:[],type:"FeatureCollection"};(e=this.followList)==null||e.forEach(r=>{var i;if((i=r.port)!=null&&i.id){const l=r.port,n={type:"Feature",properties:l,geometry:{type:"Point",coordinates:[l.lng,l.lat]}};o.features.push(n)}}),this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(o):(this.map.addSource(this.source,{type:"geojson",data:o}),this.map.addLayer({id:this.layer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":1,"icon-image":"port","icon-offset":[0,-13],"text-anchor":"bottom","text-field":"{name}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,1.6]},paint:{"text-color":this.Theme.current.value.colors["on-surface"],"text-halo-width":1}},this.beforeLayer))},handleClear(){var o,e,a;this.showInfo=!1,this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)},handleClick(o){const e=o.features[0];this.portId=e.properties.id,e.properties.id&&(this.port=e.properties,this.port.lng=e.geometry.coordinates[0],this.port.lat=e.geometry.coordinates[1],this.port.forecastModel=this.forecastModel,this.showDetail=!0)},handleHover(o){var r,i;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties.id){this.showInfo=!0,this.hoverPort=e.properties,(r=this.marker)==null||r.remove();const l=(i=document.getElementById("idmFollowPortInfo"))==null?void 0:i.cloneNode(!0);this.marker=new me.Marker(l).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-70]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,this.hoverPort={},(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"},handleCloseDetail(){this.showDetail=!1}}},Hs={class:"port-box d-flex flex-column justify-center align-start ga-1"},Os={class:"d-flex justify-start align-center text-label"},Ys={class:"d-flex justify-start align-center text-label"};function Us(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard"),s=t.resolveComponent("PortDetail");return t.openBlock(),t.createElementBlock("div",null,[t.withDirectives(t.createVNode(c,{id:"idmFollowPortInfo",ref:"idmFollowPortInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-body-1 pr-8"},{default:t.withCtx(()=>[t.createElementVNode("div",Hs,[t.createElementVNode("div",null,t.toDisplayString(o.$t("port.port")),1),t.createElementVNode("div",Os,[t.createElementVNode("span",null,t.toDisplayString(i.hoverPort.name??"-"),1)]),t.createElementVNode("div",Ys,[e[1]||(e[1]=t.createElementVNode("label",{class:"pr-1"},"LoCode : ",-1)),t.createElementVNode("span",null,t.toDisplayString(i.hoverPort.loCode??"-"),1)])])]),_:1})]),_:1},512),[[t.vShow,i.showInfo]]),i.showDetail?(t.openBlock(),t.createBlock(s,t.mergeProps({key:0,"port-id":i.portId,port:i.port,"forecast-model":a.forecastModel,"follow-list":a.followList},o.$attrs,{onClose:l.handleCloseDetail,onCloseAllDetail:e[0]||(e[0]=m=>o.$emit("closeAllDetail",{followPort:!0}))}),null,16,["port-id","port","forecast-model","follow-list","onClose"])):t.createCommentVNode("",!0)])}const Js=Q(Xs,[["render",Us],["__scopeId","data-v-9b28c4ea"]]),X1="",Ks={name:"IdmFollowPosition",props:{map:{type:Object},beforeLayer:{type:String},forecastModel:{type:String},show:{type:Boolean},followList:{type:Array},realTime:{type:String}},setup(){return{Theme:ye.useTheme()}},data(){return{source:"follow-coordinate-source",layer:"follow-coordinate-layer",position:{},showInfo:!1,marker:null}},computed:{computePosition(){return function(o){return!o||o.lng===null||o.lng===void 0||isNaN(o.lng)||o.lat===null||o.lat===void 0||isNaN(o.lat)?"-":M.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty+" / "+M.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty}}},watch:{show:{handler(){var o,e,a;this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()},immediate:!0},followList:{handler(){var o,e,a;this.followList&&this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()}}},methods:{handleRender(){var e,a;const o={features:[],type:"FeatureCollection"};(e=this.followList)==null||e.forEach(r=>{if(r.coordinate){const i=r.coordinate,l={type:"Feature",properties:{id:r.id,remark:r.remark,...r.coordinate},geometry:{type:"Point",coordinates:[i.lng,i.lat]}};o.features.push(l)}}),this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(o):(this.map.addSource(this.source,{type:"geojson",data:o}),this.map.addLayer({id:this.layer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":1.1,"icon-image":"location","icon-offset":[0,-16]},paint:{"text-color":this.Theme.current.value.colors["on-surface"],"text-halo-width":1}},this.beforeLayer))},handleClear(){var o,e,a;this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source),(o=this.map)==null||o.off("click",[this.layer],this.handleClick),(e=this.map)==null||e.off("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.off("mouseleave",[this.layer],this.handleLeave)},handleClick(o){var a,r,i,l,n,c,s,m,d;const e=o.features[0];if(e.properties){const g=e.properties;g.lng=e.geometry.coordinates[0],g.lat=e.geometry.coordinates[1];const u=v(),y=(a=v(this.realTime))==null?void 0:a.diff(u,"d",!0),p={followId:g.id,lat:g.lat,lng:g.lng,datetime:this.realTime,forecastModel:this.forecastModel};y>=0?(n=(l=(i=(r=this.$parent)==null?void 0:r.$parent)==null?void 0:i.$refs)==null?void 0:l.idmSpot)==null||n.fetchForecastData(p):(d=(m=(s=(c=this.$parent)==null?void 0:c.$parent)==null?void 0:s.$refs)==null?void 0:m.idmSpot)==null||d.fetchHistoryData(p)}},handleHover(o){var a;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties.id){this.showInfo=!0,this.position=e.properties,(a=this.marker)==null||a.remove();const r=document.getElementById("idmFollowPositionInfo").cloneNode(!0);this.marker=new me.Marker(r).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-70]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"}}},Qs={class:"position-box d-flex flex-column justify-center align-start ga-1"},qs={class:"d-flex justify-start align-center text-label"},$s={key:0,class:"d-flex justify-start align-center text-label"};function ec(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard");return t.withDirectives((t.openBlock(),t.createBlock(c,{id:"idmFollowPositionInfo",ref:"idmFollowPositionInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-body-1 pr-8"},{default:t.withCtx(()=>[t.createElementVNode("div",Qs,[e[0]||(e[0]=t.createElementVNode("div",null,"Location",-1)),t.createElementVNode("div",qs,[t.createElementVNode("span",null,t.toDisplayString(l.computePosition(i.position)),1)]),i.position.remark?(t.openBlock(),t.createElementBlock("div",$s,[t.createElementVNode("span",null,t.toDisplayString(i.position.remark??"-"),1)])):t.createCommentVNode("",!0)])]),_:1})]),_:1},512)),[[t.vShow,i.showInfo]])}const tc=Q(Ks,[["render",ec],["__scopeId","data-v-1de14e27"]]),H1="",oc={name:"IdmOtherLayerr",components:{IdmWarZone:il,IdmGmdssArea:nl,IdmEcaZone:ml,IdmAlertZone:gl,IdmPort:Cn,IdmLoadLine:_n,IdmTimezone:Mn,IdmVRA:Tn,IdmSpecialArea:Rn,IdmTerminator:Fn,IdmWorld12nm:Wn,IdmWorldMarine:Hn,IdmChinaRoute:Un,IdmNsrAreas:Qn,IdmTideStations:Is,IdmIceAreas:js,IdmLatLng:jo,IdmFollowPort:Js,IdmFollowPosition:tc},props:{simple:{type:Boolean,default:!1},map:{type:Object},theme:{type:String},token:{type:String},isLogin:{type:Boolean,default:!1},defaultMeteoToken:{type:String},gateway:{type:String},assistGateway:{type:Array,default:[]},top:{type:Number,default:0},paddingTop:{type:Number,default:8},menuHeight:{type:Number,default:248},menuToggle:{type:Object,default:{}},ts:{type:String},forecastModel:{type:String},realTime:{type:String}},emits:["map","other","menuToggle","mapFeather","theme","followLayerList","otherCheckList"],data(){return{right:10,toggle:!1,mapFeather:localStorage.getItem("mapFeathersCacheGL4")||"dark",tagLayers:[...eo.LayerHelper.OTHER_LAYERS.filter(o=>o.enabled)],layerWeight:0,otherLayers:{},activeOtherLayers:[],cache:{v:"0.0.2",versionKey:"otherLayerCacheVersionGL4",checkListKey:"otherChecklistCacheGL4",followListKey:"otherFollowListCacheGL4",mapFeatherKey:"mapFeathersCacheGL4"},mapFeathers:[{name:"Light Map",value:"light",locale:"lightMap"},{name:"Dark Map",value:"dark",locale:"darkMap"},{name:"Satelite Map",value:"satellite",locale:"satelliteMap"},{name:"Nautical Map",value:"nautical",locale:"nauticalMap"}],checkList:[]}},computed:{listStyle(){return this.simple?{top:this.top+"px",left:this.toggle?"0px":"-280px",height:"calc(100vh - "+this.top+"px)"}:{top:this.top+"px",right:this.toggle?"0px":"-280px",height:"calc(100vh - "+this.top+"px)"}}},watch:{"menuToggle.v":{handler(){this.toggle=this.menuToggle.otherLayers,this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},realTime:{handler(o,e){o&&e&&o!==e&&this.checkList.includes("day-night")&&this.fetchDayNightLayer()}},theme:{handler(){this.theme==="light"?this.mapFeather=["light","nautical"].includes(this.mapFeather)?this.mapFeather:"light":this.theme==="dark"&&(this.mapFeather=["dark","satellite"].includes(this.mapFeather)?this.mapFeather:"dark")}},mapFeather:{handler(){localStorage.setItem(this.cache.mapFeatherKey,this.mapFeather),this.$emit("mapFeather",this.mapFeather),this.$emit("theme",["light","nautical"].includes(this.mapFeather)?"light":"dark")},immediate:!0},checkList:{handler(o,e){localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),this.activeOtherLayers=this.tagLayers.filter(l=>this.checkList.includes(l.key))||[];const a=o==null?void 0:o.filter(l=>!(e!=null&&e.includes(l))),r=e==null?void 0:e.filter(l=>!(o!=null&&o.includes(l))),i=o==null?void 0:o.filter(l=>e==null?void 0:e.includes(l));if((r==null?void 0:r.length)>0&&r.forEach(l=>{this.otherLayers[l]=void 0,delete this.otherLayers[l]}),(a==null?void 0:a.length)>0){const l=this.tagLayers.filter(n=>this.checkList.includes(n.key)&&!i.includes(n.key))||[];this.handleLayersChange(l)}this.$emit("otherCheckList",this.checkList)}}},async mounted(){this.fetchCache()},methods:{fetchCache(){const o=localStorage.getItem(this.cache.versionKey);this.cache.v!==o&&(localStorage.removeItem(this.cache.checkListKey),localStorage.removeItem(this.cache.followListKey),localStorage.removeItem(this.cache.mapFeatherKey),localStorage.setItem(this.cache.versionKey,this.cache.v));let e=localStorage.getItem(this.cache.checkListKey);this.checkList=JSON.parse(e||'["eca-zones"]'),localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),e=localStorage.getItem(this.cache.mapFeatherKey);const a=e||"dark";this.$emit("mapFeather",a),localStorage.setItem(this.cache.mapFeatherKey,a)},handleMenuToggle(){this.$emit("menuToggle","otherLayers")},handleToggleMapFeather(o){this.mapFeather=o.value},async fetchOtherLayers(){var e,a;let o=this.layerWeight;if(o){const r=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],i=await ce.get(`${r}/api/arc/other/layers/links?l=${o}&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});if(((e=i==null?void 0:i.data)==null?void 0:e.code)===0){const l=(a=i==null?void 0:i.data)==null?void 0:a.data,n=[];for(const s in l)n.push(ce.get(l[s],{headers:{Authorization:this.defaultMeteoToken,key:s}}));(await Promise.all(n)).map(s=>{var g,u,y;const m=((g=s==null?void 0:s.data)==null?void 0:g.data)||(s==null?void 0:s.data),d=(y=(u=s==null?void 0:s.config)==null?void 0:u.headers)==null?void 0:y.key;this.otherLayers[d]=m})}}},async fetchDayNightLayer(){var a,r;const o=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],e=await ce.get(`${o}/api/arc/other/layers/links?l=1024&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});((a=e==null?void 0:e.data)==null?void 0:a.code)===0&&(this.otherLayers["day-night"]=((r=e==null?void 0:e.data)==null?void 0:r.data)||(e==null?void 0:e.data))},handleLayersChange(o){const e=o==null?void 0:o.reduce((a,r)=>a+(r==null?void 0:r.weight),0);this.layerWeight=e,this.fetchOtherLayers()}}},ac={class:"idm-gl4-other-layer"},ic={class:"header-box w-100 d-flex justify-space-between align-center px-4"},rc={class:"text-h5 font-weight-medium"},lc={class:"layers-body mt-4 mb-2 d-flex justify-start align-center flex-wrap"},nc=["onClick"],sc={key:0,src:"https://ossimg.ormwx.com/asset/dark-map.png",class:"border rounded-sm"},cc={key:1,src:"https://ossimg.ormwx.com/asset/nautical-map.png",class:"border rounded-sm"},mc={key:2,src:"https://ossimg.ormwx.com/asset/satellite-map.png",class:"border rounded-sm"},dc={key:3,src:"https://ossimg.ormwx.com/asset/light-map.png",class:"border rounded-sm"},hc={class:"text-body-2 text-center pt-2"};function pc(o,e,a,r,i,l){var ne,S,Z,H,q,W,B,J,E;const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardTitle"),m=t.resolveComponent("VCardItem"),d=t.resolveComponent("VCheckbox"),g=t.resolveComponent("VCardText"),u=t.resolveComponent("VCard"),y=t.resolveComponent("IdmPort"),p=t.resolveComponent("IdmTideStations"),h=t.resolveComponent("IdmLatLng"),f=t.resolveComponent("IdmTerminator"),w=t.resolveComponent("IdmTimezone"),b=t.resolveComponent("IdmAlertZone"),L=t.resolveComponent("IdmEcaZone"),k=t.resolveComponent("IdmWarZone"),C=t.resolveComponent("IdmGmdssArea"),A=t.resolveComponent("IdmLoadLine"),_=t.resolveComponent("IdmWorldMarine"),z=t.resolveComponent("IdmVRA"),P=t.resolveComponent("IdmSpecialArea"),V=t.resolveComponent("IdmWorld12nm"),N=t.resolveComponent("IdmChinaRoute"),j=t.resolveComponent("IdmIceAreas"),U=t.resolveComponent("IdmNsrAreas"),K=t.resolveComponent("IdmFollowPort"),de=t.resolveComponent("IdmFollowPosition");return t.openBlock(),t.createElementBlock("div",ac,[t.createElementVNode("div",{class:t.normalizeClass(["menu-bar-box transition px-1 rounded",a.simple?"simple":""]),style:t.normalizeStyle({top:a.top+10+"px",right:i.right+"px",paddingTop:a.paddingTop+"px",height:a.menuHeight+"px"})},[t.createVNode(c,{text:o.$t("layer.mapLayers"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:I})=>[t.createVNode(n,t.mergeProps(I,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[5]||(e[5]=[t.createElementVNode("i",{class:"iconfont icon-Layer text-h4"},null,-1)])),_:2,__:[5]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],6),t.createElementVNode("div",{class:t.normalizeClass(["available-layers transition d-flex flex-column justify-start align-start",i.toggle?"right-bar":""]),style:t.normalizeStyle(l.listStyle)},[t.createElementVNode("div",ic,[t.createElementVNode("div",rc,t.toDisplayString(o.$t("layer.layers")),1),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleMenuToggle},{default:t.withCtx(()=>e[6]||(e[6]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[6]},8,["onClick"])]),t.createElementVNode("div",{class:t.normalizeClass(["list-box w-100 flex-1-1-0 scroll overflow-y-auto",a.simple?"px-3":"pl-4 pr-2"])},[t.createVNode(u,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.mapFeathers")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"pb-2"},{default:t.withCtx(()=>[t.createElementVNode("div",lc,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.mapFeathers,I=>(t.openBlock(),t.createElementBlock("div",{key:I.value,class:"mb-4 feather-item",onClick:ie=>l.handleToggleMapFeather(I)},[t.createElementVNode("div",{class:t.normalizeClass([i.mapFeather===I.value?"active":"","img-box"])},[I.value==="dark"?(t.openBlock(),t.createElementBlock("img",sc)):I.value==="nautical"?(t.openBlock(),t.createElementBlock("img",cc)):I.value==="satellite"?(t.openBlock(),t.createElementBlock("img",mc)):(t.openBlock(),t.createElementBlock("img",dc))],2),t.createElementVNode("div",hc,t.toDisplayString(o.$t(`layer.${I.locale}`)),1)],8,nc))),128))]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(I=>["graticule","day-night","time-zones"].includes(I.key)),I=>(t.openBlock(),t.createBlock(d,{key:I.key,modelValue:i.checkList,"onUpdate:modelValue":e[0]||(e[0]=ie=>i.checkList=ie),value:I.key,label:o.$t(`layer.${I.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2 mx-n1","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),t.createVNode(u,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.pointsOfInteresting")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(I=>["ports","alert-zones","tidal-stations"].includes(I.key)),I=>(t.openBlock(),t.createBlock(d,{key:I.key,modelValue:i.checkList,"onUpdate:modelValue":e[1]||(e[1]=ie=>i.checkList=ie),value:I.key,label:o.$t(`layer.${I.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),t.createVNode(u,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.otherLayers")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(I=>!["graticule","day-night","time-zones","ports","alert-zones","tidal-stations"].includes(I.key)),I=>(t.openBlock(),t.createBlock(d,{key:I.key,modelValue:i.checkList,"onUpdate:modelValue":e[2]||(e[2]=ie=>i.checkList=ie),value:I.key,label:o.$t(`layer.${I.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),t.createVNode(u,{class:"block-bg mx-auto mb-3",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.myFollows")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[t.createVNode(d,{modelValue:i.checkList,"onUpdate:modelValue":e[3]||(e[3]=I=>i.checkList=I),value:"follow-ports",label:o.$t("layer.ports"),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","label"]),t.createVNode(d,{modelValue:i.checkList,"onUpdate:modelValue":e[4]||(e[4]=I=>i.checkList=I),value:"follow-positions",label:o.$t("layer.locations"),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","label"])]),_:1})]),_:1})],2)],6),a.map?(t.openBlock(),t.createBlock(y,t.mergeProps({key:0,ref:"idmPorts",simple:a.simple,map:a.map,ports:(ne=i.otherLayers)==null?void 0:ne.ports,gateway:a.gateway,token:a.token,"forecast-model":a.forecastModel,"real-time":a.realTime,theme:a.theme},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","ports","gateway","token","forecast-model","real-time","theme"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(p,t.mergeProps({key:1,ref:"idmIideStation",simple:a.simple,map:a.map,gateway:a.gateway,token:a.token,"default-meteo-token":a.defaultMeteoToken,show:i.checkList.includes("tidal-stations"),theme:a.theme,"real-time":a.realTime,"forecast-model":a.forecastModel,"before-layer":"empty-layer-3"},o.$attrs),null,16,["simple","map","gateway","token","default-meteo-token","show","theme","real-time","forecast-model"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(h,t.mergeProps({key:2,simple:a.simple,map:a.map,"menu-toggle":a.menuToggle,show:i.checkList.includes("graticule")},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","menu-toggle","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(f,t.mergeProps({key:3,map:a.map,area:(S=i.otherLayers)==null?void 0:S["day-night"]},o.$attrs,{"before-layer":"empty-layer-2"}),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(w,t.mergeProps({key:4,map:a.map,zone:(Z=i.otherLayers)==null?void 0:Z["time-zones"],"real-time":a.realTime},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["map","zone","real-time"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(b,t.mergeProps({key:5,map:a.map,simple:a.simple,zone:(H=i.otherLayers)==null?void 0:H["alert-zones"]},o.$attrs,{"before-layer":"empty-layer-3",theme:a.theme}),null,16,["map","simple","zone","theme"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(L,t.mergeProps({key:6,map:a.map,zone:(q=i.otherLayers)==null?void 0:q["eca-zones"]},o.$attrs),null,16,["map","zone"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(k,t.mergeProps({key:7,map:a.map,zone:(W=i.otherLayers)==null?void 0:W["war-zones"]},o.$attrs),null,16,["map","zone"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(C,t.mergeProps({key:8,map:a.map,area:(B=i.otherLayers)==null?void 0:B["gmdss-areas"]},o.$attrs),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(A,t.mergeProps({key:9,map:a.map,show:i.checkList.includes("load-lines")},o.$attrs),null,16,["map","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(_,t.mergeProps({key:10,map:a.map,token:a.token,show:i.checkList.includes("worldMarine")},o.$attrs),null,16,["map","token","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(z,t.mergeProps({key:11,map:a.map,area:(J=i.otherLayers)==null?void 0:J["voluntary-reporting-area"]},o.$attrs),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(P,t.mergeProps({key:12,map:a.map,area:(E=i.otherLayers)==null?void 0:E["special-area"]},o.$attrs),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(V,t.mergeProps({key:13,map:a.map,token:a.token,show:i.checkList.includes("world12nm")},o.$attrs),null,16,["map","token","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(N,t.mergeProps({key:14,map:a.map,token:a.token,show:i.checkList.includes("chinaRoute")},o.$attrs),null,16,["map","token","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(j,t.mergeProps({key:15,map:a.map,show:i.checkList.includes("ice-areas")},o.$attrs),null,16,["map","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(U,t.mergeProps({key:16,map:a.map,show:i.checkList.includes("nsr")},o.$attrs),null,16,["map","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(K,t.mergeProps({key:17,ref:"idmFollowPort",simple:a.simple,map:a.map,show:i.checkList.includes("follow-ports"),gateway:a.gateway,token:a.token,"forecast-model":a.forecastModel,"real-time":a.realTime},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","show","gateway","token","forecast-model","real-time"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(de,t.mergeProps({key:18,ref:"idmFollowPosition",simple:a.simple,map:a.map,show:i.checkList.includes("follow-positions"),"forecast-model":a.forecastModel,"real-time":a.realTime},o.$attrs),null,16,["simple","map","show","forecast-model","real-time"])):t.createCommentVNode("",!0)])}const gc=Q(oc,[["render",pc]]);class Mo{constructor(e){pe(this,"map");pe(this,"mercator");pe(this,"rampColorLayer");pe(this,"rampColorSource");pe(this,"particleLayer");pe(this,"particleSource");pe(this,"rampColorCanvas");pe(this,"particleCanvas");pe(this,"ratio");this.map=e,this.mercator=new qr,this.rampColorLayer="ramp-color-layer",this.rampColorSource="ramp-color-source",this.particleLayer="particle-layer",this.particleSource="particle-source",this.rampColorCanvas=document.createElement("canvas"),this.particleCanvas=document.createElement("canvas"),this.ratio=window.devicePixelRatio}convertNLng(e,a=0){return e>180?this.convertNLng(e-360,a+1):e<-180?this.convertNLng(e+360,a+1):[e,a]}getBoundLngLat(){var a;const e=(a=this.map)==null?void 0:a.getBounds();return e?[[e._sw.lng,e._ne.lat],[e._ne.lng,e._ne.lat],[e._ne.lng,e._sw.lat],[e._sw.lng,e._sw.lat]]:[]}getBoundPixel(){var p,h;const e=(p=this.map)==null?void 0:p.getBounds();if(!e)return[];const a=((h=this.map)==null?void 0:h.getZoom())+1,r=[e._ne.lng,e._ne.lat],i=[e._sw.lng,e._sw.lat],[l,n]=this.convertNLng(r[0]),[c,s]=this.convertNLng(i[0]),[m,d]=this.mercator.px([l,r[1]],a),[g,u]=this.mercator.px([c,i[1]],a),y=Math.round(this.mercator.size*Math.pow(2,a)*(n+s));return[g,u,m+y,d]}getBoundRange(){const e=this.map.getZoom()+1,a=this.mercator.size*Math.pow(2,e),r=this.getBoundPixel();return[r[0]/a,r[2]/a,r[3]/a,r[1]/a]}getWorldCopy(e,a){const r=2**a,[i,l,n,c]=e.map(d=>~~(d/(r*256))),s=[];for(let d=c;d<=l;d++)for(let g=i;g<=n;g++)s.push([g,d]);return s.map(d=>{const g=2**a*256;return[d[0]*g,d[1]*g,g]})}resize(){let e=this.map.getSource(this.rampColorSource);e==null||e.setCoordinates(this.getBoundLngLat()),e=this.map.getSource(this.particleSource),e==null||e.setCoordinates(this.getBoundLngLat()),this.rampColorCanvas.width=this.map._canvas.clientWidth,this.rampColorCanvas.height=this.map._canvas.clientHeight,this.particleCanvas.width=this.map._canvas.clientWidth,this.particleCanvas.height=this.map._canvas.clientHeight}toggle(e){var i;if(!((i=this.map)!=null&&i.getLayer(this.rampColorLayer)))return;const a=this.map.getLayoutProperty(this.rampColorLayer,"visibility"),r=e?"visible":"none";a!==r&&this.map.setLayoutProperty(this.rampColorLayer,"visibility",r)}toggleParticle(e){var i;if(!((i=this.map)!=null&&i.getLayer(this.particleLayer)))return;const a=this.map.getLayoutProperty(this.particleLayer,"visibility"),r=e?"visible":"none";a!==r&&this.map.setLayoutProperty(this.particleLayer,"visibility",r)}}class $e{createShader(e,a,r){const i=e.createShader(a);if(i&&(e.shaderSource(i,r),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)))throw new Error(e.getShaderInfoLog(i)||"error happened while create shader...");return i}createTexture(e,a,r,i,l,n,c){const s=e.createTexture();return e.bindTexture(e.TEXTURE_2D,s),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,i),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,i),l instanceof Uint8Array?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n,c,0,e.RGBA,e.UNSIGNED_BYTE,l):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,l),e.bindTexture(e.TEXTURE_2D,null),s}createDataBuffer(e,a,r){if(e){const i=e.createBuffer();return a==="array"?(e.bindBuffer(e.ARRAY_BUFFER,i),r&&e.bufferData(e.ARRAY_BUFFER,r,e.STATIC_DRAW)):a==="element"&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i),r&&e.bufferData(e.ELEMENT_ARRAY_BUFFER,r,e.STATIC_DRAW)),i}return null}createProgram(e,a,r){const i=e.createProgram(),l=this.createShader(e,e.VERTEX_SHADER,a),n=this.createShader(e,e.FRAGMENT_SHADER,r);if(i&&l&&n&&(e.attachShader(i,l),e.attachShader(i,n),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS)))throw new Error(e.getProgramInfoLog(i)||"error happened while creating ramp color program");return i}createProgramWrapper(e,a,r){const i=this.createProgram(e,a,r);if(i){const l={program:i},n=e.getProgramParameter(i,e.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){const m=e.getActiveAttrib(i,s);l[m.name]=e.getAttribLocation(i,m.name)}const c=e.getProgramParameter(i,e.ACTIVE_UNIFORMS);for(let s=0;s<c;s++){const m=e.getActiveUniform(i,s);l[m.name]=e.getUniformLocation(i,m.name)}return l}}setup(e,a,r=!1,i,l){const n=document.createElement("canvas");n.width=256,n.height=1;const c=n.getContext("2d");if(c&&e){const s=c==null?void 0:c.createLinearGradient(0,0,256,0);return a.forEach(([m,d])=>{s.addColorStop(m,d)}),c.fillStyle=s,c.fillRect(0,0,256,1),{canvas:n,texture:this.createTexture(e,e.LINEAR,e.LINEAR,e.CLAMP_TO_EDGE,r?new Uint8Array(c.getImageData(0,0,256,1).data):n,i,l)}}}setupParticle(e,a=1e3){const r=Math.ceil(Math.sqrt(a)),i=r*r,l=new Uint8Array(i*4);for(let d=0;d<l.length;d++)l[d]=Math.floor(Math.random()*256);const n=this.createTexture(e,e.NEAREST,e.NEAREST,e.CLAMP_TO_EDGE,l,r,r),c=this.createTexture(e,e.NEAREST,e.NEAREST,e.CLAMP_TO_EDGE,l,r,r),s=new Float32Array(i);for(let d=0;d<i;d++)s[d]=d;const m=this.createDataBuffer(e,"array",s);return{resolution:r,total:i,texture0:n,texture1:c,indexBuffer:m}}bind(e,a,r){const i=this.createProgram(e,a,r);if(i){const l=this.createDataBuffer(e,"array",void 0),n=e.getAttribLocation(i,"a_position");e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0);const c=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]);this.createDataBuffer(e,"array",c);const s=e.getAttribLocation(i,"a_texCoord");return e.enableVertexAttribArray(s),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),{program:i,aPositionBuffer:l}}return{}}bindParticle(e,a,r,i,l,n){const c=this.createProgramWrapper(e,a,r),s=this.createProgramWrapper(e,i,l),m=this.createProgramWrapper(e,i,n),d=this.createDataBuffer(e,"array",new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1])),g=e.createFramebuffer();return{particle:c,screen:s,update:m,quadBuffer:d,frameBuffer:g}}draw(e,a,r,i,l,n,c){var s,m;if(a&&r){e.resize(),a==null||a.viewport(0,0,(s=a==null?void 0:a.canvas)==null?void 0:s.width,(m=a==null?void 0:a.canvas)==null?void 0:m.height),a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT);try{a.useProgram(r);const d={resolution:a.getUniformLocation(r,"u_resolution"),image:a.getUniformLocation(r,"u_image"),color:a.getUniformLocation(r,"u_color"),scale:a.getUniformLocation(r,"u_scale"),uvRange:a.getUniformLocation(r,"u_range_u_v"),sRange:a.getUniformLocation(r,"u_range_s")};d.resolution&&a.uniform2f(d.resolution,a.canvas.width*e.ratio,a.canvas.height*e.ratio),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,i),d.image&&a.uniform1i(d.image,0),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,l),d.color&&a.uniform1i(d.color,1),c!=null&&c.uvRange&&(c!=null&&c.sRange)&&(d.uvRange&&a.uniform2f(d.uvRange,c.uvRange[0],c.uvRange[1]),d.sRange&&a.uniform2f(d.sRange,c.sRange[0],c.sRange[1])),d.scale&&a.uniform1f(d.scale,(c==null?void 0:c.scale)||1);const g=e.getBoundPixel(),u=e.map.getZoom()+1,y=e.getWorldCopy(g,u);for(const p of y){const h=(p[0]-g[0])*e.ratio,f=(p[1]-g[3])*e.ratio,w=p[2]*e.ratio,[b,L,k,C]=[h,w+h,f,w+f],A=new Float32Array([b,k,L,k,b,C,b,C,L,k,L,C]);a.bindBuffer(a.ARRAY_BUFFER,n),a.bufferData(a.ARRAY_BUFFER,A,a.STATIC_DRAW),a.drawArrays(a.TRIANGLES,0,6)}}catch(d){console.log(`render failed...${d}`)}}}drawParticle(e,a,r,i,l){var n,c;a&&(a==null||a.viewport(0,0,(n=a==null?void 0:a.canvas)==null?void 0:n.width,(c=a==null?void 0:a.canvas)==null?void 0:c.height),a.disable(a.DEPTH_TEST),a.disable(a.STENCIL_TEST),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,r),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,i.texture0),this.renderScreen(e,a,i,l),this.updateParticles(e,a,i,l))}renderScreen(e,a,r,i){a.bindFramebuffer(a.FRAMEBUFFER,r.frameBuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r.screenTexture,0),a.viewport(0,0,a.canvas.width,a.canvas.height),this.renderScreenTexture(a,r.backgroundTexture,r.screen,r.quadBuffer,.95),this.renderParticles(e,a,r,i),a.bindFramebuffer(a.FRAMEBUFFER,null),this.renderScreenTexture(a,r.screenTexture,r.screen,r.quadBuffer,1);const l=r.backgroundTexture;r.backgroundTexture=r.screenTexture,r.screenTexture=l}renderScreenTexture(e,a,r,i,l){e&&(e.useProgram(r.program),e.bindBuffer(e.ARRAY_BUFFER,i),e.enableVertexAttribArray(r.a_pos),e.vertexAttribPointer(r.a_pos,2,e.FLOAT,!1,0,0),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,a),e.uniform1i(r.u_screen,2),e.uniform1f(r.u_opacity,l),e.drawArrays(e.TRIANGLES,0,6))}renderParticles(e,a,r,i){if(a){a.useProgram(r.particle.program),a.bindBuffer(a.ARRAY_BUFFER,r.indexBuffer),a.enableVertexAttribArray(r.particle.a_index),a.vertexAttribPointer(r.particle.a_index,1,a.FLOAT,!1,0,0),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,r.color.texture),a.uniform1i(r.particle.u_factor,0),a.uniform1i(r.particle.u_particles,1),a.uniform1i(r.particle.u_color_ramp,2),a.uniform1f(r.particle.u_particles_resolution,r.resolution*e.ratio),a.uniform1f(r.particle.u_point,e.ratio);const l=e.getBoundRange();a.uniform4f(r.particle.u_viewport,l[0],l[1],l[2],l[3]),a.uniform2f(r.particle.u_factor_min,i.uvRange[0],i.uvRange[0]),a.uniform2f(r.particle.u_factor_max,i.uvRange[1],i.uvRange[1]),a.drawArrays(a.POINTS,0,r.total)}}updateParticles(e,a,r,i){var n,c;if(a){a.bindFramebuffer(a.FRAMEBUFFER,r.frameBuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r.texture1,0),a.viewport(0,0,r.resolution,r.resolution),a.useProgram(r.update.program),a.bindBuffer(a.ARRAY_BUFFER,r.quadBuffer),a.enableVertexAttribArray(r.update.a_pos),a.vertexAttribPointer(r.update.a_pos,2,a.FLOAT,!1,0,0),a.uniform1i(r.update.u_factor,0),a.uniform1i(r.update.u_particles,1);const s=e.getBoundRange();a.uniform4f(r.update.u_viewport,s[0],s[1],s[2],s[3]),a.uniform1f(r.update.u_rand_seed,Math.random()),a.uniform2f(r.update.u_factor_res,(n=r==null?void 0:r.image)==null?void 0:n.width,(c=r==null?void 0:r.image)==null?void 0:c.height),a.uniform2f(r.update.u_factor_min,i.uvRange[0],i.uvRange[0]),a.uniform2f(r.update.u_factor_max,i.uvRange[1],i.uvRange[1]),a.uniform1f(r.update.u_speed_factor,i.speedFactor*e.ratio),a.uniform1f(r.update.u_drop_rate,i.dropRate),a.uniform1f(r.update.u_drop_rate_bump,i.dropRateBump),a.drawArrays(a.TRIANGLES,0,6)}const l=r.texture0;r.texture0=r.texture1,r.texture1=l}resize(e,a){e.resize();const r=new Uint8Array(a.canvas.width*a.canvas.height*4).fill(0,0,a.canvas.width*a.canvas.height*4),i=this.createTexture(a,a.NEAREST,a.NEAREST,a.CLAMP_TO_EDGE,r,a.canvas.width,a.canvas.height),l=this.createTexture(a,a.NEAREST,a.NEAREST,a.CLAMP_TO_EDGE,r,a.canvas.width,a.canvas.height);return{screenTexture:i,backgroundTexture:l}}async loadImg(e){return new Promise(a=>{const r=new Blob([e],{type:e.type}),i=URL.createObjectURL(r),l=new Image;l.crossOrigin="anonymous",l.src=i,l.onload=()=>a(l)})}}class fe{}pe(fe,"vertexSchema",`
|
|
11
11
|
//canvas 坐标系上的坐标 (x, y)
|
|
12
12
|
attribute vec2 a_position; //像素坐标
|
|
13
13
|
attribute vec2 a_texCoord; //纹理坐标
|
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
<path d="M10 2.5V17.5" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
201
201
|
<path d="M5 7.5L10 2.5L15 7.5" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
202
202
|
</svg>`;s.src="data:image/svg+xml;base64,"+window.btoa(m);const d=[s];let g=0;d.forEach(u=>{u.onload=()=>{g++,this.map.hasImage("currentDirIcon")||this.map.addImage("currentDirIcon",s),g===1&&this.map.addLayer({id:this.directionLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-image":"currentDirIcon","icon-size":["interpolate",["linear"],["get","spd"],.5,.3,1,.5,1.5,.7,2,.8,3.5,1],"icon-offset":[0,-20],"icon-allow-overlap":!0,"icon-rotation-alignment":"map","icon-rotate":{property:"val",stops:[[0,0],[360,360]]}},paint:{"icon-opacity":this.opacity}},this.beforeLayer)}}),i=new Date().valueOf()-(a+r),console.log("[current] add elapsed: ",i,", total: ",r+=i)}}},handleClear(){this.map.getLayer(this.speedLayer)&&this.map.removeLayer(this.speedLayer),this.map.getLayer(this.speedLabelLayer)&&this.map.removeLayer(this.speedLabelLayer),this.map.getLayer(this.directionLayer)&&this.map.removeLayer(this.directionLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Cc(o,e,a,r,i,l){return null}const vc=Q(Lc,[["render",Cc]]),Y1="",zc={name:"IdmCurrentParticle",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Mo},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,wrapper:void 0,animation:void 0,particleContext:void 0,particleTexture:void 0,particleOptions:{fadeOpacity:.96,speedFactor:4,dropRate:.005,dropRateBump:.01,uvRange:[-2.5,2.6],sRange:[0,3],scale:.3},paused:!1,initial:!0,right:10}},watch:{"factor.version":{async handler(){var o,e;(o=this.factor)!=null&&o.active?await this.handleRender():this.handleClear(),(e=this.factor)!=null&&e.particle||this.handleClearParticle()},immediate:!0},"factor.particle":{async handler(o,e){o!==e&&e!==void 0&&(o?(this.handleClear(),await this.handleRender()):this.handleClearParticle())}},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{async handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;await this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[current-particle] add elapsed: ",a,", total: ",e+=a)}},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0/255,"rgba(95, 143, 197,1)"],[5/255,"rgba(64,127,115,1)"],[10/255,"rgb(58,164,58)"],[15/255,"rgb(191,182,67)"],[20/255,"rgb(197,154,68)"],[30/255,"rgb(160,70,94)"],[40/255,"rgb(138,84,166)"],[45/255,"rgb(82,113,165)"],[50/255,"rgb(84,142,152)"],[65/255,"rgb(150,181,184)"],[80/255,"rgb(195,194,194)"],[254/255,"rgb(195,194,194)"],[1,"rgb(195,194,194)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.uvFragmentSchema);this.program=e,this.aPositionBuffer=a}this.handleParticleSetup()},handleParticleSetup(){if(!this.particleContext){this.particleContext=this.viewport.particleCanvas.getContext("webgl");const o=[[0,"rgb(183,224,224)"],[1,"rgb(199,202,202)"],[.6,"rgb(199,202,202)"]];this.wrapper=this.webgl.bindParticle(this.particleContext,Ne.vertexSchema,Ne.fragmentSchema,Ne.quadVertSchema,Ne.screenFragmentSchema,Ne.updateFragmentSchema),this.wrapper.color=this.webgl.setup(this.particleContext,o,!0,16,16),this.wrapper={...this.wrapper,...this.webgl.setupParticle(this.particleContext,9e3),...this.webgl.resize(this.viewport,this.particleContext)},this.viewport.map.on("resize",this.handleResize),this.viewport.map.on("movestart",this.handlePause),this.viewport.map.on("moveend",this.handlePlay)}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o),this.particleTexture=this.webgl.createTexture(this.particleContext,this.particleContext.NEAREST,this.particleContext.LINEAR,this.particleContext.CLAMP_TO_EDGE,o),this.wrapper.image=o}this.initial&&(this.initial=!1,this.handlePlay()),this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer,this.particleOptions),this.viewport.toggle(!0)},handleResize(){this.wrapper={...this.wrapper,...this.webgl.resize(this.viewport,this.particleContext)}},handlePause(){this.paused=!0,this.animation&&(cancelAnimationFrame(this.animation),this.viewport.toggleParticle(!1))},handlePlay(){this.paused=!1,this.animation=requestAnimationFrame(()=>{this.webgl.drawParticle(this.viewport,this.particleContext,this.particleTexture,this.wrapper,this.particleOptions),this.viewport.toggleParticle(!0),this.handlePlay()})},handleClearParticle(){var o,e,a,r,i,l,n;(o=this.viewport)==null||o.toggleParticle(!1),this.particleContext=void 0,this.initial=!0,(a=(e=this.viewport)==null?void 0:e.map)==null||a.off("resize",this.handleResize),(i=(r=this.viewport)==null?void 0:r.map)==null||i.off("movestart",this.handlePause),(n=(l=this.viewport)==null?void 0:l.map)==null||n.off("moveend",this.handlePlay),this.handlePause()},handleClear(){var o;(o=this.viewport)==null||o.toggle(!1),this.context=void 0,this.etime=void 0,this.handleClearParticle()}}},_c={key:0};function Sc(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",_c,[t.createElementVNode("div",{class:"legend-bars-gl4 current",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"kts",-1),t.createElementVNode("span",null,"0",-1),t.createElementVNode("span",null,"0.4",-1),t.createElementVNode("span",null,"0.8",-1),t.createElementVNode("span",null,"1.6",-1),t.createElementVNode("span",null,"2",-1),t.createElementVNode("span",null,"3.2",-1)]),4)])):t.createCommentVNode("",!0)}const Nc=Q(zc,[["render",Sc]]),U1="",Mc={name:"IdmSigWave",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[sig-wave] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgb(50, 158, 186)"],[10/255,"rgb(50, 158, 186)"],[20/255,"rgb(48, 128, 164)"],[30/255,"rgb(48, 99, 142)"],[40/255,"rgb(57, 61, 143)"],[50/255,"rgb(179, 86, 189)"],[60/255,"rgb(154, 45, 123)"],[80/255,"rgb(134, 48, 48)"],[120/255,"rgb(194, 77, 91)"],[150/255,"rgb(192, 118, 105)"],[180/255,"rgb(192, 163, 157)"],[1,"rgb(192, 163, 157)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},Pc={key:0};function Vc(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",Pc,[t.createElementVNode("div",{class:"legend-bars-gl4 sig-wave",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"m",-1),t.createElementVNode("span",null,"0.5",-1),t.createElementVNode("span",null,"1",-1),t.createElementVNode("span",null,"1.5",-1),t.createElementVNode("span",null,"2",-1),t.createElementVNode("span",null,"6",-1),t.createElementVNode("span",null,"9",-1)]),4)])):t.createCommentVNode("",!0)}const Tc=Q(Mc,[["render",Vc],["__scopeId","data-v-b562523c"]]),Ec={name:"IdmSigWaveHeight",props:{map:{type:Object},sigWaveHeight:{type:Object},beforeLayer:{type:String},menuToggle:{type:Object}},data(){return{right:10,toggle:!1,showCaption:!1,source:"sig-wave-height-source",heightLayer:"sig-wave-height-layer",heightLabelLayer:"sig-wave-height-label-layer",empty:T.featureCollection([])}},watch:{"sigWaveHeight.version":{handler(){var o;(o=this.sigWaveHeight)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleMenuToggle(){this.toggle=!this.toggle,this.showCaption=!this.showCaption},handleRender(){var o,e;if(this.sigWaveHeight){const a=new Date().valueOf();let r=0,i=0,l=this.empty;this.sigWaveHeight.active&&(l=this.sigWaveHeight.data),(o=this.map)!=null&&o.getSource(this.source)?((e=this.map)==null||e.getSource(this.source).setData(l),i=new Date().valueOf()-(a+r),console.log("[sig-wave-height] update elapsed: ",i,", total: ",r+=i)):(this.map.addSource(this.source,{type:"geojson",data:l}),this.map.addLayer({id:this.heightLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-opacity":.8,"fill-color":["step",["get","val"],"rgba(0,235,156,0)",2,"rgba(0,235,156,0.4)",3,"#ffed00",4,"#ff9800",5,"#f77800",6,"#e4711e",7,"#e06128",8,"#dc5132",9,"#d5453c",10,"#cd3a46",12,"#be2c50",14,"#b41a5a"]}},this.beforeLayer),this.map.addLayer({id:this.heightLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","symbol-spacing":100,"text-field":["format",["get","val"],{"font-scale":1}],"text-rotation-alignment":"map","text-line-height":1.3,"text-size":10},paint:{"text-color":["step",["get","val"],"rgba(0, 0, 0, 0.7)",9,"rgba(255,255,255,0.8)"]}},this.beforeLayer),i=new Date().valueOf()-(a+r),console.log("[sig-wave-height] add elapsed: ",i,", total: ",r+=i))}},handleClear(){this.map.getLayer(this.heightLayer)&&this.map.removeLayer(this.heightLayer),this.map.getLayer(this.heightLabelLayer)&&this.map.removeLayer(this.heightLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Dc(o,e,a,r,i,l){return null}const Rc=Q(Ec,[["render",Dc]]),J1="",Bc={name:"IdmSwell",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[sig-wave] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgb(50, 158, 186)"],[10/255,"rgb(50, 158, 186)"],[20/255,"rgb(48, 128, 164)"],[30/255,"rgb(48, 99, 142)"],[40/255,"rgb(57, 61, 143)"],[50/255,"rgb(179, 86, 189)"],[60/255,"rgb(154, 45, 123)"],[80/255,"rgb(134, 48, 48)"],[120/255,"rgb(194, 77, 91)"],[150/255,"rgb(192, 118, 105)"],[180/255,"rgb(192, 163, 157)"],[1,"rgb(192, 163, 157)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},Ic={key:0};function Fc(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",Ic,[t.createElementVNode("div",{class:"legend-bars-gl4 swell",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"m",-1),t.createElementVNode("span",null,"0.5",-1),t.createElementVNode("span",null,"1",-1),t.createElementVNode("span",null,"1.5",-1),t.createElementVNode("span",null,"2",-1),t.createElementVNode("span",null,"6",-1),t.createElementVNode("span",null,"9",-1)]),4)])):t.createCommentVNode("",!0)}const Gc=Q(Bc,[["render",Fc],["__scopeId","data-v-7ee2face"]]),jc={name:"IdmPrmsl",props:{map:{type:Object},prmsl:{type:Object},beforeLayer:{type:String},showRampColor:{type:Boolean},activeWeatherLayers:{type:Array},theme:{type:String}},data(){return{right:10,toggle:!1,source:"prmsl-source",layer:"prmsl-layer",labelLayer:"prmsl-label-layer",pointLabelLayer:"prmsl-point-label-layer",empty:T.featureCollection([])}},watch:{"prmsl.version":{handler(){var o;(o=this.prmsl)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleMenuToggle(){this.toggle=!this.toggle},handleRender(){var o,e,a;if(this.prmsl){const r=new Date().valueOf();let i=0,l=0,n=this.empty;this.prmsl.active&&(n=this.prmsl.data),(o=this.map)!=null&&o.getSource(this.source)?((e=this.map)==null||e.getSource(this.source).setData(n),l=new Date().valueOf()-(r+i),console.log("[prmsl] update elapsed: ",l,", total: ",i+=l)):(this.map.addSource(this.source,{type:"geojson",data:n}),this.map.addLayer({id:this.layer,type:"line",source:this.source,filter:["==","$type","LineString"],paint:{"line-color":["step",["get","val"],"rgba(162,13,2,1)",920,"rgba(255, 96, 98, 1)",980,"rgba(255, 246, 184, 1)",1100,"rgba(199,171,250,1)"],"line-width":1,"line-opacity":this.theme==="light"?1:.3}},this.beforeLayer),(a=this.map)==null||a.addLayer({id:this.labelLayer,type:"symbol",source:this.source,minzoom:4,filter:["==","$type","LineString"],layout:{"symbol-placement":"line","text-rotation-alignment":"viewport","text-field":"{val}","text-size":10},paint:{"text-color":"black","text-halo-color":"rgba(255,255,255,1)","text-opacity":.7,"text-halo-width":1}},this.beforeLayer),this.map.addLayer({id:this.pointLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","text-allow-overlap":!0,"text-field":["format",["get","type"],{"font-scale":1.03},`
|
|
203
|
-
`,["get","val"],{"font-scale":1}],"text-rotation-alignment":"map","text-line-height":1.3,"text-size":12,"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.theme==="light"?["step",["get","val"],"rgba(0, 0, 0, 0.5)",920,"rgba(0, 0, 0, 0.5)",980,"rgba(0, 0, 0, 0.7)",1100,"rgba(0, 0, 0, 0.7)"]:"rgba(0,0,0,1)","text-halo-color":["step",["get","val"],"rgba(162,13,2,1)",920,"rgba(255, 96, 98, 1)",980,"rgba(255, 246, 184, 1)",1100,"rgba(199,171,250,1)"],"text-halo-width":1}},this.beforeLayer),l=new Date().valueOf()-(r+i),console.log("[prmsl] add elapsed: ",l,", total: ",i+=l))}},handleClear(){this.map.getLayer(this.pointLabelLayer)&&this.map.removeLayer(this.pointLabelLayer),this.map.getLayer(this.labelLayer)&&this.map.removeLayer(this.labelLayer),this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Wc(o,e,a,r,i,l){return null}const Zc=Q(jc,[["render",Wc]]),K1="",Xc={name:"IdmIceEdge",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[ice-edge] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(86, 169, 230, 0)"],[1/255,"rgba(86, 169, 230, 0)"],[25/255,"rgba(86, 169, 230, 1)"],[25/255,"rgba(47, 226, 155, 1)"],[100/255,"rgba(47, 226, 155, 1)"],[100/255,"rgba(213, 253, 37, 1)"],[175/255,"rgba(213, 253, 37, 1)"],[175/255,"rgba(230, 176, 39, 1)"],[225/255,"rgba(230, 176, 39, 1)"],[225/255,"rgba(230, 84, 39, 1)"],[250/255,"rgba(230, 84, 39, 1)"],[1,"rgba(230, 84, 39, 1)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},Hc={key:0};function Oc(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",Hc,[t.createElementVNode("div",{class:"legend-bars-gl4 ice-edge",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",{style:{color:"rgba(var(--v-theme-black), 0.7)"}},"%",-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,"10",-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,"40",-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,"70",-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,"90",-1),t.createElementVNode("span",null,null,-1)]),4)])):t.createCommentVNode("",!0)}const Yc=Q(Xc,[["render",Oc]]),Q1="",Uc={name:"IdmCover",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[ice-cover] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(68, 1, 84, 0)"],[1/255,"rgba(63, 72, 137, 0)"],[50/255,"rgba(53, 125, 177, 1)"],[100/255,"rgba(33, 145, 140, 1)"],[150/255,"rgba(45, 178, 125, 1)"],[200/255,"rgba(112, 207, 87, 1)"],[250/255,"rgba(253, 231, 37, 0.8)"],[1,"rgba(253, 231, 37, 1)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},Jc={key:0};function Kc(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",Jc,[t.createElementVNode("div",{class:"legend-bars-gl4 ice-cover",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"%",-1),t.createElementVNode("span",null,"20",-1),t.createElementVNode("span",null,"40",-1),t.createElementVNode("span",null,"60",-1),t.createElementVNode("span",null,"80",-1),t.createElementVNode("span",null,"100",-1)]),4)])):t.createCommentVNode("",!0)}const Qc=Q(Uc,[["render",Kc],["__scopeId","data-v-3d1a7675"]]),q1="",qc={name:"IdmThickness",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},menuToggle:{type:Object},bottom:{type:String,default:"70px"}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[ice-thickness] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(4, 6, 19, 0)"],[1/255,"rgba(4, 6, 19, 0)"],[20/255,"rgba(51, 50, 102, 1)"],[40/255,"rgba(63, 82, 158, 1)"],[50/255,"rgba(66, 123, 183, 1)"],[60/255,"rgba(92, 161, 197, 1)"],[80/255,"rgba(134, 199, 212, 0.7)"],[100/255,"rgba(134, 199, 212, 1)"],[150/255,"rgba(234, 253, 2536, 0.8)"],[250/255,"rgba(234, 253, 2536, 0.9)"],[1,"rgba(234, 253, 2536, 1)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},$c={key:0};function em(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",$c,[t.createElementVNode("div",{class:"legend-bars-gl4 ice-thickness",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"m",-1),t.createElementVNode("span",null,"0",-1),t.createElementVNode("span",null,"0.6",-1),t.createElementVNode("span",null,"1",-1),t.createElementVNode("span",null,"1.5",-1),t.createElementVNode("span",null,"2",-1),t.createElementVNode("span",null,"3",-1)]),4)])):t.createCommentVNode("",!0)}const tm=Q(qc,[["render",em]]),$1="",om={name:"IdmPrecip3h",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},deeimmediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[precip3h] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(59, 126, 162, 0)"],[14/255,"rgba(84,170,230, 0)"],[15/255,"rgba(172, 210, 255, 0.8)"],[20/255,"rgba(51,202,248,0.8)"],[30/255,"rgba(3,248,103,0.8)"],[49/255,"rgba(14,201,3,0.8)"],[57/255,"rgba(190,226,2,0.8)"],[73/255,"rgba(248,1,1,0.8)"],[82/255,"rgba(197,5,58,0.8)"],[1,"rgba(197,5,58,0.8)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},am={key:0};function im(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",am,[t.createElementVNode("div",{class:"legend-bars-gl4 precip3h",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"mm",-1),t.createElementVNode("span",null,"1.5",-1),t.createElementVNode("span",null,"2",-1),t.createElementVNode("span",null,"3",-1),t.createElementVNode("span",null,"7",-1),t.createElementVNode("span",null,"10",-1),t.createElementVNode("span",null,"20",-1),t.createElementVNode("span",null,"30",-1)]),4)])):t.createCommentVNode("",!0)}const rm=Q(om,[["render",im]]),eb="",lm={name:"IdmVisibility",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{right:10,program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[visibility] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(189,50,160,0.8)"],[8/255,"rgba(208,56,56,0.8)"],[27/255,"rgba(190,226,2,0.8)"],[60/255,"rgba(3,236,118,0.8)"],[160/255,"rgba(172, 210,255,0.8)"],[161/255,"rgba(172, 210,255,0)"],[1,"rgba(144,144,144,0)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},nm={key:0};function sm(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",nm,[t.createElementVNode("div",{class:"legend-bars-gl4 visibility",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"nm",-1),t.createElementVNode("span",null,"0",-1),t.createElementVNode("span",null,"0.5",-1),t.createElementVNode("span",null,"1.5",-1),t.createElementVNode("span",null,"3",-1),t.createElementVNode("span",null,"9",-1)]),4)])):t.createCommentVNode("",!0)}const cm=Q(lm,[["render",sm]]),tb="",mm={name:"IdmWaterTemp",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[water-temp] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(95, 143, 197)"],[46/255,"rgba(95, 143, 197)"],[69/255,"rgb(80, 140, 62)"],[92/255,"rgb(121, 146, 28)"],[115/255,"rgb(171, 161, 14)"],[138/255,"rgb(223, 177, 69)"],[161/255,"rgb(243, 150, 6)"],[184/255,"rgb(236, 95, 21)"],[207/255,"rgb(190, 65, 18)"],[230/255,"rgb(138, 43, 10)"],[1,"rgb(138, 43, 10)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},dm={key:0};function hm(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",dm,[t.createElementVNode("div",{class:"legend-bars-gl4 water-temp",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"°C",-1),t.createElementVNode("span",null,"0",-1),t.createElementVNode("span",null,"10",-1),t.createElementVNode("span",null,"20",-1),t.createElementVNode("span",null,"30",-1),t.createElementVNode("span",null,"40",-1)]),4)])):t.createCommentVNode("",!0)}const pm=Q(mm,[["render",hm]]),ob="",gm={name:"IdmTemp",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0;this.handleDraw(),new Date().valueOf()-(o+e)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgb(149, 137, 211)"],[100/255,"rgb(149, 137, 211)"],[110/255,"rgb(150, 209, 216)"],[120/255,"rgb(129, 204, 197)"],[130/255,"rgb(103, 180, 186)"],[140/255,"rgb(95, 143, 197)"],[150/255,"rgb(80, 140, 62)"],[160/255,"rgb(121, 146, 28)"],[170/255,"rgb(171, 161, 14)"],[180/255,"rgb(223, 177, 6)"],[190/255,"rgb(243, 150, 6)"],[200/255,"rgb(236, 95, 21)"],[210/255,"rgb(190, 65, 18)"],[220/255,"rgb(138, 43, 10)"],[1,"rgb(138, 43, 10)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},um={key:0};function fm(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",um,[t.createElementVNode("div",{class:"legend-bars-gl4 temp",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"°C",-1),t.createElementVNode("span",null,"-20",-1),t.createElementVNode("span",null,"-10",-1),t.createElementVNode("span",null,"0",-1),t.createElementVNode("span",null,"10",-1),t.createElementVNode("span",null,"20",-1),t.createElementVNode("span",null,"30",-1),t.createElementVNode("span",null,"40",-1)]),4)])):t.createCommentVNode("",!0)}const ym=Q(gm,[["render",fm]]),ab="",bm={name:"IdmGlLayer",components:{IdmWindBarb:bc,IdmWindParticle:Ac,IdmCurrentDirection:vc,IdmCurrentParticle:Nc,IdmWave:Tc,IdmSigWaveHeight:Rc,IdmSwell:Gc,IdmPrmsl:Zc,IdmIceEdge:Yc,IdmIceCover:Qc,IdmIceThickness:tm,IdmPrecip3h:rm,IdmVisibility:cm,IdmWaterTemp:pm,IdmTemp:ym},props:{simple:{type:Boolean,default:!1},isLogin:{type:Boolean,default:!1},theme:{type:String},map:{type:Object},mapFeather:{type:String},gateway:{type:String},assistGateway:{type:Array,default:[]},defaultMeteoToken:{type:String},top:{type:Number,default:0},paddingTop:{type:Number,default:48},menuHeight:{type:Number,default:248},menuToggle:{type:Object,default:{}},realTime:{type:String},forecastModel:{type:String},beforeLayer:{type:String},platform:{type:String}},emits:["forecastModel","menuToggle","weatherCheckList","autoActive","weatherRendered"],data(){return{right:10,toggle:!1,autoActive:!0,weatherWeight:0,allLayers:[...eo.LayerHelper.WEATHER_LAYERS],tagLayers:[...eo.LayerHelper.WEATHER_LAYERS.filter(o=>!o.hide)],checkList:[],renderKey:"",iceToggleValue:void 0,waveToggleValue:void 0,weatherLayers:{},activeWeatherLayers:[],cache:{v:"0.0.1",versionKey:"weatherLayerCacheVersionGL4",autoActiveKey:"autoActiveCacheGL4",checkListKey:"weatherCheckListCacheGL4"},models:{},currentModel:localStorage.getItem("forecastModelCacheGL4")==="GFS"?"GFS":"ECMWF",zoom:6,viewport:void 0,particleFactor:void 0,showWindParticle:!0,showCurrentParticle:!0,legendToggle:!1,legend:{barbs:[2,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,0],current:[{label:"0-0.5 kts",size:.3,color:"rgb(58, 164, 58)"},{label:"0.5-1 kts",size:.4,color:"#ffff00"},{label:"1-1.5 kts",size:.6,color:"#ff9500"},{label:"1.5-2 kts",size:.8,color:"#f44336"},{label:">= 2 kts",size:1,color:"#e4711e"}],sigWaveHeight:[{label:"< 2 m",color:"rgba(0,235,156,0)"},{label:"2-3 m",color:"rgba(0,235,156,0.4)"},{label:"3-4 m",color:"#ffed00"},{label:"4-5 m",color:"#ff9800"},{label:"5-6 m",color:"#f77800"},{label:"6-7 m",color:"#e4711e"},{label:"7-8 m",color:"#e06128"},{label:"8-9 m",color:"#dc5132"},{label:"9-10 m",color:"#d5453c"},{label:"10-12 m",color:"#cd3a46"},{label:"12-14 m",color:"#be2c50"},{label:"> 14 m",color:"#aa1a5a"}]}}},computed:{listStyle(){return this.simple?{top:this.top+"px",left:this.toggle?"0px":"-280px"}:{top:this.top+"px",right:this.toggle?"0px":"-280px"}},computeDateZ(){return function(o){var e;if(o){const a=v(o);return`${(e=a==null?void 0:a.utc())==null?void 0:e.format("MMM-DD/HHmm")}Z`}return"-"}},computeDateUpdate(){return function(o){return o?v(o).fromNow():"-"}},overlaysKeys(){return this.tagLayers.filter(o=>o.overlays).map(o=>o.key)},rendersKeys(){return this.allLayers.filter(o=>!o.overlays&&o.enabled).map(o=>o.key)},showTipMenu(){return this.checkList.includes("wind")||this.checkList.includes("current-direction")||this.checkList.includes("sig-wave-height")},barbsIconName(){var e,a,r;const o=[];for(let i=0;i<((a=(e=this.legend)==null?void 0:e.barbs)==null?void 0:a.length);i++){const l=((r=this.legend)==null?void 0:r.barbs[i])||0,n=l<10?`00${l}kts`:l<100?`0${l}kts`:`${l}kts`;o.push("icon-a-"+n)}return o},lengendTipTop(){return this.platform==="ops"?this.top+this.menuHeight+232:this.top+this.menuHeight+142}},watch:{"menuToggle.v":{handler(){this.toggle=this.menuToggle.weatherLayers,this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})}},currentModel:{handler(o,e){this.$emit("forecastModel",o),localStorage.setItem("forecastModelCacheGL4",o)},immediate:!0},forecastModel:{handler(o,e){o&&o!==e&&this.handleWeatherLayerChange({sourceChanged:!0})}},map:{handler(){const o=this.map;o&&(this.viewport=new Mo(o),o.once("idle",()=>{this.map===o&&(this.fetchCache(),o.on("move",this.handleMove4Weather),this.handleRampColorInitial())}),o.triggerRepaint())},immediate:!0},realTime:{handler(o,e){o&&e&&v(o).utc().format("yyyy-MM-DD HH")!==v(e).utc().format("yyyy-MM-DD HH")&&this.$nextTick(()=>{this.fetchWeatherLayers()})},immediate:!0},renderKey:{handler(o,e){if(o&&o!==e){const a=this.checkList.filter(r=>!this.rendersKeys.some(i=>i===r));o==="wave-group"?(this.waveToggleValue=this.waveToggleValue||"sig-wave",this.checkList=[...a,"wave-group",this.waveToggleValue]):o==="ice-forecast"?(this.iceToggleValue=this.iceToggleValue||"ice-cover",this.checkList=[...a,"ice-forecast",this.iceToggleValue||"ice-cover"]):this.checkList=[...a,o]}else!o&&e&&(this.checkList=this.checkList.filter(a=>a!==e))}},checkList:{handler(o,e){var a,r,i,l,n,c;this.handleCheckListChange(o,e),this.$emit("weatherCheckList",o),this.autoActive&&this.checkList.length?(i=(r=(a=this.$parent)==null?void 0:a.$refs)==null?void 0:r.idmBottomBar)==null||i.handleToggle("weather",!0):(c=(n=(l=this.$parent)==null?void 0:l.$refs)==null?void 0:n.idmBottomBar)==null||c.handleToggle("weather",!1)}},autoActive:{handler(o){var e,a,r,i,l,n;localStorage.setItem(this.cache.autoActiveKey,this.autoActive),this.activeWeatherLayers=this.autoActive?this.allLayers.filter(c=>this.checkList.includes(c.key)):[],this.handleWeatherLayerChange(),this.autoActive&&this.checkList.length?(r=(a=(e=this.$parent)==null?void 0:e.$refs)==null?void 0:a.idmBottomBar)==null||r.handleToggle("weather",!0):(n=(l=(i=this.$parent)==null?void 0:i.$refs)==null?void 0:l.idmBottomBar)==null||n.handleToggle("weather",!1),this.$emit("autoActive",this.autoActive)}},iceToggleValue:{handler(o){if(o){const e=this.checkList.filter(a=>!this.rendersKeys.some(r=>r===a));this.checkList=[...e,"ice-forecast",this.iceToggleValue]}}},waveToggleValue:{handler(o){if(o){const e=this.checkList.filter(a=>!this.rendersKeys.some(r=>r===a));this.checkList=[...e,"wave-group",this.waveToggleValue]}}},showWindParticle:{handler(o){let e="wind-particle";this.weatherLayers[e]&&(this.weatherLayers[e].particle=o,this.weatherLayers[e].version=Math.random()+1)}},showCurrentParticle:{handler(o){let e="current-particle";this.weatherLayers[e]&&(this.weatherLayers[e].particle=o,this.weatherLayers[e].version=Math.random()+1)}},isLogin:{handler(o){o?this.fetchModels():this.models={}},immediate:!0}},mounted(){this.fetchModels()},methods:{arraysEqual(o,e){if((o==null?void 0:o.length)!==(e==null?void 0:e.length))return!1;for(let a=0;a<(o==null?void 0:o.length);a++)if((o==null?void 0:o[a])!==(e==null?void 0:e[a]))return!1;return!0},fetchCache(){var a,r;const o=localStorage.getItem(this.cache.versionKey);this.cache.v!==o&&(localStorage.removeItem(this.cache.autoActiveKey),localStorage.removeItem(this.cache.checkListKey),localStorage.setItem(this.cache.versionKey,this.cache.v));let e=localStorage.getItem(this.cache.autoActiveKey);this.autoActive=e!=="false",localStorage.setItem(this.cache.autoActiveKey,this.autoActive),e=localStorage.getItem(this.cache.checkListKey),this.waveToggleValue=(a=JSON.parse(e))!=null&&a.some(i=>i==="swell")?"swell":void 0,this.iceToggleValue=(r=JSON.parse(e))!=null&&r.some(i=>i==="ice-thickness")?"ice-thickness":void 0,this.checkList=JSON.parse(e||JSON.stringify(["wind","sig-wave-height"])),this.checkList.find(i=>this.rendersKeys.includes(i))&&(this.renderKey=this.checkList.find(i=>this.rendersKeys.includes(i))),localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList))},handleMenuToggle(){this.$emit("menuToggle","weatherLayers")},handleFastWeatherToggle(o){let e=[];this.checkList.includes(o)?e=this.checkList.filter(a=>a!==o):(e=[...this.checkList,o],this.checkList=e),this.handleCheckListChange(e,this.checkList)},handleCheckListChange(o,e){if(this.arraysEqual(o,e))return this.handleMove4Weather(),!1;const a=[...new Set(o)],r=a==null?void 0:a.filter(n=>!(e!=null&&e.includes(n)))[0],i=e==null?void 0:e.filter(n=>!(a!=null&&a.includes(n)))[0],l=this.checkList.filter(n=>!this.rendersKeys.some(c=>c===n));if(r)if(r==="ice-cover"||r==="ice-thickness"||r==="ice-forecast")this.checkList=[...l,"ice-forecast",this.iceToggleValue||"ice-cover"],this.iceToggleValue=this.iceToggleValue||"ice-cover";else if(r==="sig-wave"||r==="swell"||r==="wave-group")this.checkList=[...l,"wave-group",this.waveToggleValue||"sig-wave"],this.waveToggleValue=this.waveToggleValue||"sig-wave";else if(this.rendersKeys.includes(r))this.checkList=[...l,r];else{const n=a.filter(s=>!this.rendersKeys.includes(s)),c=this.checkList.filter(s=>this.rendersKeys.includes(s));this.checkList=[...n,...c]}i&&(i==="ice-forecast"?(this.checkList=a.filter(n=>!["ice-cover","ice-thickness","ice-forecast"].includes(n)),this.iceToggleValue=void 0):i==="wave-group"?(this.checkList=a.filter(n=>!["wave-group","sig-wave","swell"].includes(n)),this.waveToggleValue=void 0):this.checkList=a),this.checkList.includes("wind-particle")&&!(e!=null&&e.includes("wind-particle"))&&(this.showWindParticle=!0),this.checkList.includes("current-particle")&&!(e!=null&&e.includes("current-particle"))&&(this.showCurrentParticle=!0),localStorage.setItem(this.cache.checkListKey,JSON.stringify(a)),this.activeWeatherLayers=this.autoActive?this.allLayers.filter(n=>a.includes(n.key)):[],this.handleWeatherLayerChange()},async fetchModels(){this.models={};const o=await ce.get(`${this.gateway}/api/arc/meteo2/models2`,{headers:{Authorization:this.defaultMeteoToken}});(o==null?void 0:o.data.code)===0&&(this.models=o==null?void 0:o.data.data)},async fetchWeatherLayers(o={}){var r,i,l,n,c,s,m,d,g;const e=new Date().valueOf();let a=0;if(this.map){const u=((r=this.map)==null?void 0:r.getZoom())+1,y=(i=this.map)==null?void 0:i.getBounds(),p=`${y._sw.lng},${y._sw.lat},${y._ne.lng},${y._ne.lat}`;if(this.particleFactor&&((l=this.$refs.layer)!=null&&l.autoActive)){const h=eo.LayerHelper.WEATHER_LAYERS.find(f=>{var w;return((w=f.peer)==null?void 0:w.weight)===this.particleFactor.weight});this.particleFactor.particle&&(this.showWindParticle||this.showCurrentParticle)?this.weatherWeight=this.weatherWeight&h.weight?this.weatherWeight:this.weatherWeight+h.weight:this.weatherWeight=this.weatherWeight&h.weight?this.weatherWeight-h.weight:this.weatherWeight}if(this.weatherWeight>0){let h=this.weatherWeight;if(h>0){const f=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],w=await ce.get(`${f}/api/arc/weather/layers2/links?l=${h}&v=${this.forecastModel}&z=${u}&bbox=${p}&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});if(new Date().valueOf()-(e+a),((n=w==null?void 0:w.data)==null?void 0:n.code)===0){const b=(c=w==null?void 0:w.data)==null?void 0:c.data,L=[];for(const C in b)L.push(ce.get(b[C],{headers:{Authorization:this.defaultMeteoToken,key:C},responseType:/\.(jpg|png)$/.test(b[C])?"blob":"json"}).catch(A=>{console.log(`[${C}] fetch layer error: ${A}`)}));const k=await Promise.all(L);this.weatherLayers={},k.map(C=>{var z,P,V,N;const A=((z=C==null?void 0:C.data)==null?void 0:z.data)||(C==null?void 0:C.data);let _=(V=(P=C==null?void 0:C.config)==null?void 0:P.headers)==null?void 0:V.key;_&&A&&(this.weatherLayers[_]={raw:A,type:((N=C==null?void 0:C.config)==null?void 0:N.responseType)==="blob"?"image":"json",etime:w.data.etime})})}if(new Date().valueOf()-(e+a),this.weatherLayers["swell-direction"]||this.weatherLayers["swell-height"]){const b=(s=this.weatherLayers["swell-direction"])==null?void 0:s.raw,L=(m=this.weatherLayers["swell-height"])==null?void 0:m.raw;delete this.weatherLayers["swell-direction"],delete this.weatherLayers["swell-height"],this.weatherLayers.swell={type:"json",direction:b,height:{raw:L},etime:w.data.etime}}if(this.weatherLayers["current-direction"]||this.weatherLayers["current-speed"]){const b=(d=this.weatherLayers["current-direction"])==null?void 0:d.raw,L=(g=this.weatherLayers["current-speed"])==null?void 0:g.raw;delete this.weatherLayers["current-direction"],delete this.weatherLayers["current-speed"],this.weatherLayers.current={type:"json",direction:b,speed:{raw:L},etime:w.data.etime}}}}this.handleWeatherLayerToggle(),this.handleDrawWeather4Json(),this.$nextTick(()=>{var h,f,w,b,L;(L=(b=(w=(f=(h=this.$parent)==null?void 0:h.$refs)==null?void 0:f.idmBottomBar)==null?void 0:w.$refs)==null?void 0:b.capture)==null||L.captureCurrentFrame()})}},handleWeatherLayerToggle(){for(const o in this.weatherLayers)this.weatherLayers[o].active=!1,this.weatherLayers[o].version=Math.random()+1;for(const o of this.activeWeatherLayers){let e=o.key;e==="current-direction"&&(e="current"),this.weatherLayers[e]&&(this.weatherLayers[e].active=!0,this.weatherLayers[e].version=Math.random()+1,e==="wind-particle"&&(this.weatherLayers[e].particle=this.showWindParticle),e==="current-particle"&&(this.weatherLayers[e].particle=this.showCurrentParticle))}},handleWeatherLayerChange(o={sourceChanged:!1}){var a;const e=(a=this.activeWeatherLayers)==null?void 0:a.reduce((r,i)=>r+(r&(i==null?void 0:i.weight)?0:i==null?void 0:i.weight),0);o!=null&&o.sourceChanged||this.weatherWeight!==e?(this.weatherWeight=e,this.fetchWeatherLayers()):this.handleWeatherLayerToggle()},handleRampColorInitial(){var o,e,a,r,i,l,n,c,s,m,d,g;this.viewport.map.getSource((o=this.viewport)==null?void 0:o.rampColorSource)||this.viewport.map.addSource((e=this.viewport)==null?void 0:e.rampColorSource,{type:"canvas",canvas:(a=this.viewport)==null?void 0:a.rampColorCanvas,animate:!0,coordinates:this.viewport.getBoundLngLat()}),this.viewport.map.getLayer((r=this.viewport)==null?void 0:r.rampColorLayer)||this.viewport.map.addLayer({type:"raster",id:(i=this.viewport)==null?void 0:i.rampColorLayer,source:(l=this.viewport)==null?void 0:l.rampColorSource,layout:{visibility:"none"},paint:{"raster-fade-duration":0}},this.beforeLayer),this.viewport.map.getSource((n=this.viewport)==null?void 0:n.particleSource)||this.viewport.map.addSource((c=this.viewport)==null?void 0:c.particleSource,{type:"canvas",canvas:(s=this.viewport)==null?void 0:s.particleCanvas,animate:!0,coordinates:this.viewport.getBoundLngLat()}),this.viewport.map.getLayer((m=this.viewport)==null?void 0:m.particleLayer)||this.viewport.map.addLayer({type:"raster",id:(d=this.viewport)==null?void 0:d.particleLayer,source:(g=this.viewport)==null?void 0:g.particleSource,layout:{visibility:"none"},paint:{"raster-fade-duration":0}},this.beforeLayer)},handleDrawWeather4Json(){var i,l,n,c,s,m,d;const o=new Date().valueOf();let e=0;const a=(i=this.map)==null?void 0:i.getBounds(),r=(l=this.map)==null?void 0:l.getZoom();if(a&&r){const g=M.LngLatHelper.convertToStdLng(a._sw.lng),u=M.LngLatHelper.convertToStdLng(a._ne.lng),y=Math.floor(a._sw.lat),p=Math.ceil(a._ne.lat);for(const h in this.weatherLayers){let f=!1;if(this.weatherLayers[h].active&&this.weatherLayers[h].type==="json"){let w=[];if(h==="swell"){f=!0;const b=((n=this.weatherLayers[h])==null?void 0:n.direction)||{};for(const k in b)if(k>y&&k<p&&(!(r<=this.zoom)||k%(r<2?10:r<4?5:3)===0)){const C=b[k].lng;g>u?C.forEach((A,_)=>{var z,P,V,N,j,U;if(r<2){if((A>=0&&A<=360||A>=-360&&A<=0)&&A%10===0){const K=T.point([A,k],{val:((z=b[k].val)==null?void 0:z[_])||((P=b[k].dir)==null?void 0:P[_]),spd:(V=b[k].spd)==null?void 0:V[_]});w.push(K)}}else if((A>=g&&A<=180||A>=-180&&A<=u)&&(!(r<=this.zoom)||A%(r<2?10:r<4?5:3)===0)){const K=T.point([A,k],{val:((N=b[k].val)==null?void 0:N[_])||((j=b[k].dir)==null?void 0:j[_]),spd:(U=b[k].spd)==null?void 0:U[_]});w.push(K)}}):C.forEach((A,_)=>{var z,P,V,N,j,U;if(g<2){if((A>=0&&A<=360||A>=-360&&A<=0)&&A%10===0){const K=T.point([A,k],{val:((z=b[k].val)==null?void 0:z[_])||((P=b[k].dir)==null?void 0:P[_]),spd:(V=b[k].spd)==null?void 0:V[_]});w.push(K)}}else if(A>=g&&A<=u&&(!(r<=this.zoom)||A%(r<2?10:r<4?5:3)===0)){const K=T.point([A,k],{val:((N=b[k].val)==null?void 0:N[_])||((j=b[k].dir)==null?void 0:j[_]),spd:(U=b[k].spd)==null?void 0:U[_]});w.push(K)}})}new Date().valueOf()-(o+e);const L=this.weatherLayers[h].height;if(L){if(!L.data){const k=[];for(const C in(c=L.raw)==null?void 0:c.LineString){const A=L.raw.LineString[C];for(const _ of A)k.push(T.lineString(_,{val:Number(C)}));L.data=T.featureCollection(k)}}if(L.data){const k=this.handleBboxClip(L.data,a);w=w.concat(k)}new Date().valueOf()-(o+e)}}else if(h==="current"){f=!0;const b=((s=this.weatherLayers[h])==null?void 0:s.direction)||{};for(const k in b)if(k>y&&k<p&&(!(r<=this.zoom)||k%(r<2?10:r<4?5:3)===0)){const C=b[k].lng;g>u?C.forEach((A,_)=>{var z,P,V,N,j,U;if(r<2){if((A>=0&&A<=360||A>=-360&&A<=0)&&A%10===0){const K=T.point([A,k],{val:((z=b[k].val)==null?void 0:z[_])||((P=b[k].dir)==null?void 0:P[_]),spd:(V=b[k].spd)==null?void 0:V[_]});w.push(K)}}else if((A>=g&&A<=180||A>=-180&&A<=u)&&(!(r<=this.zoom)||A%(r<2?10:r<4?5:3)===0)){const K=T.point([A,k],{val:((N=b[k].val)==null?void 0:N[_])||((j=b[k].dir)==null?void 0:j[_]),spd:(U=b[k].spd)==null?void 0:U[_]});w.push(K)}}):C.forEach((A,_)=>{var z,P,V,N,j,U;if(g<2){if((A>=0&&A<=360||A>=-360&&A<=0)&&A%10===0){const K=T.point([A,k],{val:((z=b[k].val)==null?void 0:z[_])||((P=b[k].dir)==null?void 0:P[_]),spd:(V=b[k].spd)==null?void 0:V[_]});w.push(K)}}else if(A>=g&&A<=u&&(!(r<=this.zoom)||A%(r<this.zoom/2?5:3)===0)){const K=T.point([A,k],{val:((N=b[k].val)==null?void 0:N[_])||((j=b[k].dir)==null?void 0:j[_]),spd:(U=b[k].spd)==null?void 0:U[_]});w.push(K)}})}new Date().valueOf()-(o+e);const L=this.weatherLayers[h].speed;if(L){if(!L.data){const C=[];for(const A in(m=L.raw)==null?void 0:m.Polygon){const _=L.raw.Polygon[A];for(const z of _)C.push(T.polygon(z,{val:Number(A)}))}L.data=T.featureCollection(C)}const k=r<this.zoom?L.data.features.filter(C=>C.properties.val>.5):L.data.features;w=w.concat(k),new Date().valueOf()-(o+e)}}else if(h==="wind"){f=!0;const b=this.weatherLayers.wind.raw;for(const L in b)if(L>y&&L<p&&(!(r<=this.zoom)||L%(r<2?10:r<4?5:3)===0)){const k=b[L].lng;g>u?k.forEach((C,A)=>{var _,z,P,V;if(r<2){if((C>=0&&C<=360||C>=-360&&C<=0)&&C%10===0){const N=T.point([C,L],{dir:((_=b[L].val)==null?void 0:_[A])||((z=b[L].dir)==null?void 0:z[A]),spd:b[L].spd[A]});w.push(N)}}else if((C>=g&&C<=180||C>=-180&&C<=u)&&(!(r<=this.zoom)||C%(r<2?10:r<4?5:3)===0)){const N=T.point([C,L],{dir:((P=b[L].val)==null?void 0:P[A])||((V=b[L].dir)==null?void 0:V[A]),spd:b[L].spd[A]});w.push(N)}}):k.forEach((C,A)=>{var _,z,P,V;if(r<2){if((C>=0&&C<=360||C>=-360&&C<=0)&&C%10===0){const N=T.point([C,L],{dir:((_=b[L].val)==null?void 0:_[A])||((z=b[L].dir)==null?void 0:z[A]),spd:b[L].spd[A]});w.push(N)}}else if(C>=g&&C<=u&&(!(r<=this.zoom)||C%(r<2?10:r<4?5:3)===0)){const N=T.point([C,L],{dir:((P=b[L].val)==null?void 0:P[A])||((V=b[L].dir)==null?void 0:V[A]),spd:b[L].spd[A]});w.push(N)}})}new Date().valueOf()-(o+e)}else if(h==="sig-wave-height"){if(this.weatherLayers[h].data)w=this.weatherLayers[h].data;else{f=!0;const b=this.weatherLayers[h].raw;if(b){const L=[];for(const k in b.Polygon){const C=b.Polygon[k];for(const A of C)L.push(T.polygon(A,{val:Number(k)}))}for(const k in b.MultiPolygon){const C=b.MultiPolygon[k];for(const A of C)L.push(T.multiPolygon(A,{val:Number(k)}))}for(const k in b.Point){const C=b.Point[k];for(let A=0;A<((d=C.lng)==null?void 0:d.length);A++)L.push(T.point([C.lng[A],k],{val:Number(C.val[A])}))}w=w.concat(L)}}new Date().valueOf()-(o+e)}else if(h==="prmsl"){if(this.weatherLayers[h].data)w=this.weatherLayers[h].data;else{f=!0;const b=this.weatherLayers[h].raw;if(b){const L=[];for(const k in b.LineString){const C=b.LineString[k];for(const A of C)L.push(T.lineString(A,{val:Number(k)}))}for(const k in b.Point)b.Point[k].lng.forEach((C,A)=>{C=M.LngLatHelper.convertToStdLng(C),L.push(T.point([C,k],{val:b.Point[k].val[A],type:b.Point[k].type[A]}))});w=w.concat(L)}}new Date().valueOf()-(o+e)}w.length&&(this.weatherLayers[h].data=T.featureCollection(w)),f&&(this.weatherLayers[h].version=Math.random()+1)}}}},handleMove4Weather(){for(const o in this.weatherLayers)this.weatherLayers[o].active&&this.weatherLayers[o].type==="image"&&(this.weatherLayers[o].active=!0,this.weatherLayers[o].version=Math.random()+1);this.handleDrawWeather4Json()},handleBboxClip(o,e){const a=[],r=M.LngLatHelper.convertToStdLng(e._sw.lng),i=M.LngLatHelper.convertToStdLng(e._ne.lng);return o.features.forEach(l=>{if(l.geometry.type!=="Point")if(r>i){let n=[r,e._sw.lat,180,e._ne.lat],c=T.bboxClip(l,n);c.geometry.coordinates.length&&a.push(c),n=[-180,e._sw.lat,i,e._ne.lat],c=T.bboxClip(l,n),c.geometry.coordinates.length&&a.push(c)}else{const n=[r,e._sw.lat,i,e._ne.lat],c=T.bboxClip(l,n);c.geometry.coordinates.length&&a.push(c)}else a.push(l)}),a}}},wm={class:"idm-gl4-meteo-layers"},xm={key:0,class:"legend-tip-btn-gl4"},km={class:"d-flex flex-row justify-start align-center flex-wrap text-body-2"},Am={class:"d-flex flex-row justify-center align-center"},Lm={class:"text-caption"},Cm={class:"d-flex flex-row justify-start align-center flex-wrap text-body-2"},vm={class:"d-flex flex-row justify-center align-center"},zm={key:0,style:{width:"24px",height:"12px",border:"1px solid rgba(var(--v-border-color), var(--v-border-opacity))"}},_m={class:"text-caption px-2"},Sm={class:"d-flex flex-row justify-start align-start flex-wrap text-body-2 ml-n1"},Nm={class:"d-flex flex-row justify-start align-center"},Mm={class:"d-flex flex-row justify-center align-center",style:{width:"40px"}},Pm={class:"text-caption"},Vm={class:"d-flex justify-start align-center ga-3"},Tm={class:"text-h5 font-weight-medium"},Em={key:0,class:"w-100 d-flex justify-space-between align-center ga-1 mb-2 px-3"},Dm={key:0,class:"d-flex justify-start align-center ga-4 pl-6"},Rm={key:1,class:"d-flex justify-start align-center ga-4 pl-6"},Bm={class:"text-body-1 py-2"},Im={class:"text-body-1 font-weight-medium"},Fm={class:"text-body-2 text-label"},Gm={class:"text-body-2 text-label"},jm={class:"text-body-2 text-label mb-3"},Wm={class:"text-body-1 font-weight-medium"},Zm={class:"text-body-2 text-label"},Xm={class:"text-body-2 text-label"},Hm={class:"text-body-2 text-label mb-3"},Om={class:"text-body-1 py-2"},Ym={class:"text-body-1 font-weight-medium"},Um={class:"text-body-2 text-label"},Jm={class:"text-body-2 text-label"},Km={class:"text-body-2 text-label mb-3"},Qm={class:"text-body-1 font-weight-medium"},qm={class:"text-body-2 text-label"},$m={class:"text-body-2 text-label"},ed={class:"text-body-2 text-label mb-3"},td={class:"text-body-1 py-2"},od={class:"text-body-1 font-weight-medium"},ad={class:"text-body-2 text-label"},id={class:"text-body-2 text-label"},rd={class:"text-body-2 text-label mb-3"};function ld(o,e,a,r,i,l){var ne,S,Z,H,q,W,B,J,E,I,ie,ge,ue,oe,he;const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardText"),m=t.resolveComponent("VDivider"),d=t.resolveComponent("VCard"),g=t.resolveComponent("VSwitch"),u=t.resolveComponent("VBtnToggle"),y=t.resolveComponent("VCardTitle"),p=t.resolveComponent("VCardItem"),h=t.resolveComponent("VCheckbox"),f=t.resolveComponent("VRadio"),w=t.resolveComponent("IdmWindBarb"),b=t.resolveComponent("IdmSigWaveHeight"),L=t.resolveComponent("IdmCurrentDirection"),k=t.resolveComponent("IdmPrmsl"),C=t.resolveComponent("IdmWindParticle"),A=t.resolveComponent("IdmCurrentParticle"),_=t.resolveComponent("IdmWave"),z=t.resolveComponent("IdmSwell"),P=t.resolveComponent("IdmIceEdge"),V=t.resolveComponent("IdmIceCover"),N=t.resolveComponent("IdmIceThickness"),j=t.resolveComponent("IdmPrecip3h"),U=t.resolveComponent("IdmVisibility"),K=t.resolveComponent("IdmWaterTemp"),de=t.resolveComponent("IdmTemp");return t.openBlock(),t.createElementBlock("div",wm,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+46+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("weather.weatherLayers"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:X})=>[t.createVNode(n,t.mergeProps(X,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[9]||(e[9]=[t.createElementVNode("i",{class:"iconfont icon-Weather text-h4"},null,-1)])),_:2,__:[9]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),l.showTipMenu?(t.openBlock(),t.createElementBlock("div",xm,[t.createElementVNode("div",{class:t.normalizeClass(["menu-bar-box pa-1 rounded",a.simple?"simple":""]),style:t.normalizeStyle({right:i.right+"px",top:a.simple?"394px":l.lengendTipTop+"px"})},[t.createVNode(c,{text:o.$t("weather.legend"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:X})=>[t.createVNode(n,t.mergeProps(X,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.legendToggle?"bg-primary active-border":""],onClick:e[0]||(e[0]=se=>i.legendToggle=!i.legendToggle)}),{default:t.withCtx(()=>e[10]||(e[10]=[t.createElementVNode("i",{class:"iconfont icon-Legend text-h4"},null,-1)])),_:2,__:[10]},1040,["class"])]),_:1},8,["text","open-on-focus","open-on-hover"])],6),i.legendToggle?(t.openBlock(),t.createBlock(d,{key:0,elevation:"16",class:"card-info d-flex justify-center align-start",style:t.normalizeStyle({position:"absolute",top:a.simple?"200px":"340px",right:i.right+50+"px"})},{default:t.withCtx(()=>[t.createVNode(s,{class:"d-flex flex-column justify-center align-start text-label px-1",style:{width:"120px"}},{default:t.withCtx(()=>[e[11]||(e[11]=t.createElementVNode("div",{class:"text-body-2 font-weight-600 mb-2 mx-1"},"Wind Level",-1)),t.createElementVNode("div",km,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.legend.barbs,(X,se)=>(t.openBlock(),t.createElementBlock("div",{key:X,class:"w-50 d-flex flex-row justify-start align-center py-1 px-0 ma-0"},[t.createElementVNode("div",Am,[t.createElementVNode("i",{class:t.normalizeClass(["iconfont",l.barbsIconName[se]]),style:t.normalizeStyle({color:a.theme==="dark"?"#fff":"#000"})},null,6),t.createElementVNode("span",Lm,t.toDisplayString(Number(X)<10?`00${X}kts`:Number(X)<100?`0${X}kts`:`${X}kts`),1)])]))),128))])]),_:1,__:[11]}),t.createVNode(m,{vertical:""}),t.createVNode(s,{class:"d-flex flex-column justify-center align-start text-label px-2",style:{width:"100px"}},{default:t.withCtx(()=>[e[12]||(e[12]=t.createElementVNode("div",{class:"text-body-2 font-weight-600 mb-2"},"Wave Height",-1)),t.createElementVNode("div",Cm,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.legend.sigWaveHeight,(X,se)=>(t.openBlock(),t.createElementBlock("div",{key:se,class:"w-100 d-flex flex-row justify-start align-center py-1 px-0 ma-0"},[t.createElementVNode("div",vm,[se===0?(t.openBlock(),t.createElementBlock("div",zm)):(t.openBlock(),t.createElementBlock("div",{key:1,style:t.normalizeStyle({width:"24px",height:"12px",background:X.color})},null,4)),t.createElementVNode("div",_m,t.toDisplayString(X.label),1)])]))),128))])]),_:1,__:[12]}),t.createVNode(m,{vertical:""}),t.createVNode(s,{class:"d-flex flex-column justify-center align-start text-label pl-0 pr-2",style:{width:"100px"}},{default:t.withCtx(()=>[e[13]||(e[13]=t.createElementVNode("div",{class:"text-body-2 font-weight-600 mb-2 mx-2"},"Current",-1)),t.createElementVNode("div",Sm,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.legend.current,(X,se)=>(t.openBlock(),t.createElementBlock("div",{key:se,class:"w-100 d-flex flex-row justify-center align-center py-1 px-0 ma-0"},[t.createElementVNode("div",Nm,[t.createElementVNode("div",Mm,[t.createElementVNode("i",{class:"iconfont icon-a-direction-arrow text-label",style:t.normalizeStyle({fontSize:40*X.size+"px"})},null,4)]),t.createElementVNode("div",Pm,t.toDisplayString(X.label),1)])]))),128))])]),_:1,__:[13]})]),_:1},8,["style"])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["available-layers transition d-flex flex-column justify-start align-start",i.toggle?"right-bar":""]),style:t.normalizeStyle(l.listStyle)},[t.createElementVNode("div",{class:t.normalizeClass(["header-box w-100 d-flex justify-space-between align-center",a.simple?"px-3":"px-4"])},[t.createElementVNode("div",Vm,[t.createElementVNode("div",Tm,t.toDisplayString(o.$t("weather.weather")),1),t.createVNode(g,{modelValue:i.autoActive,"onUpdate:modelValue":e[1]||(e[1]=X=>i.autoActive=X),class:"small-switch",color:"primary","base-color":"disabled",inset:"","hide-details":""},null,8,["modelValue"])]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleMenuToggle},{default:t.withCtx(()=>e[14]||(e[14]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[14]},8,["onClick"])],2),a.simple?(t.openBlock(),t.createElementBlock("div",Em,[t.createElementVNode("div",null,t.toDisplayString(o.$t("weather.forecastModel")),1),t.createVNode(u,{modelValue:i.currentModel,"onUpdate:modelValue":e[2]||(e[2]=X=>i.currentModel=X),rounded:"",height:"28",density:"compact",mandatory:"",group:""},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact",height:"28",value:"GFS",class:"text-none btn-bg-2 px-1 text-body-1 mt-1",color:i.currentModel==="GFS"?"primary":"","base-color":""},{default:t.withCtx(()=>e[15]||(e[15]=[t.createTextVNode(" NOAA ",-1)])),_:1,__:[15]},8,["color"]),t.createVNode(n,{density:"compact",height:"28",class:"text-none btn-bg-2 px-1 text-body-1 mt-1",color:i.currentModel==="ECMWF"?"primary":"","base-color":"",value:"ECMWF"},{default:t.withCtx(()=>e[16]||(e[16]=[t.createTextVNode(" ECMWF ",-1)])),_:1,__:[16]},8,["color"])]),_:1},8,["modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["list-box w-100 scroll overflow-y-auto",[i.autoActive?"":"cursor-not-allowed",a.simple?"px-3":"pl-4 pr-2"]])},[t.createVNode(d,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(p,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(y,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.overlays")),1)]),_:1})]),_:1}),t.createVNode(s,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(X=>X.overlays),X=>(t.openBlock(),t.createBlock(h,{key:X.key,modelValue:i.checkList,"onUpdate:modelValue":e[3]||(e[3]=se=>i.checkList=se),value:X.key,label:o.$t(`weather.${X.locale}`),disabled:!i.autoActive,color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label","disabled"]))),128))]),_:1})]),_:1}),t.createVNode(d,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(p,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(y,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.renders")),1)]),_:1})]),_:1}),t.createVNode(s,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(X=>!X.overlays),X=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:X.key},[t.createVNode(f,{modelValue:i.renderKey,"onUpdate:modelValue":e[4]||(e[4]=se=>i.renderKey=se),label:o.$t(`weather.${X.locale}`),value:X.key,disabled:!i.autoActive,color:"primary",density:"compact",style:{height:"36px"},class:"text-body-2 py-1","hide-details":"",onClick:se=>i.renderKey=i.renderKey===X.key?"":X.key},null,8,["modelValue","label","value","disabled","onClick"]),i.renderKey==="wind-particle"&&X.key==="wind-particle"?(t.openBlock(),t.createElementBlock("div",Dm,[t.createElementVNode("span",null,t.toDisplayString(o.$t("weather.particleAnimatiom")),1),t.createVNode(g,{modelValue:i.showWindParticle,"onUpdate:modelValue":e[5]||(e[5]=se=>i.showWindParticle=se),label:"",class:"small-switch",color:"primary","base-color":"disabled",density:"compact",inset:"",style:{"font-size":"14px"},"hide-details":""},null,8,["modelValue"])])):t.createCommentVNode("",!0),i.renderKey==="current-particle"&&X.key==="current-particle"?(t.openBlock(),t.createElementBlock("div",Rm,[t.createElementVNode("span",null,t.toDisplayString(o.$t("weather.particleAnimatiom")),1),t.createVNode(g,{modelValue:i.showCurrentParticle,"onUpdate:modelValue":e[6]||(e[6]=se=>i.showCurrentParticle=se),label:"",class:"small-switch",color:"primary","base-color":"disabled",inset:"",density:"compact",height:"20","hide-details":""},null,8,["modelValue"])])):t.createCommentVNode("",!0),i.renderKey==="wave-group"&&X.key==="wave-group"?(t.openBlock(),t.createBlock(u,{key:2,modelValue:i.waveToggleValue,"onUpdate:modelValue":e[7]||(e[7]=se=>i.waveToggleValue=se),class:"w-100 pl-7 rounded",rounded:"0",height:"30",density:"compact",group:"",mandatory:"",disabled:!i.autoActive},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact",height:"30",value:"sig-wave",class:"w-50 text-none px-2 text-body-1",color:i.waveToggleValue==="sig-wave"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.significant")),1)]),_:1},8,["color","disabled"]),t.createVNode(n,{density:"compact",height:"30",class:"w-50 text-none px-2 text-body-1",color:i.waveToggleValue==="swell"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive,value:"swell"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.swell")),1)]),_:1},8,["color","disabled"])]),_:1},8,["modelValue","disabled"])):t.createCommentVNode("",!0),i.renderKey==="ice-forecast"&&X.key==="ice-forecast"?(t.openBlock(),t.createBlock(u,{key:3,modelValue:i.iceToggleValue,"onUpdate:modelValue":e[8]||(e[8]=se=>i.iceToggleValue=se),class:"w-100 pl-7 rounded",rounded:"0",height:"30",density:"compact",group:"",mandatory:"",disabled:!i.autoActive},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact",height:"30",value:"ice-cover",class:"w-50 text-none px-2 text-body-1",color:i.iceToggleValue==="ice-cover"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.coverage")),1)]),_:1},8,["color","disabled"]),t.createVNode(n,{density:"compact",height:"30",class:"w-50 text-none px-2 text-body-1",color:i.iceToggleValue==="ice-thickness"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive,value:"ice-thickness"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.thickness")),1)]),_:1},8,["color","disabled"])]),_:1},8,["modelValue","disabled"])):t.createCommentVNode("",!0)],64))),128))]),_:1})]),_:1}),t.createVNode(d,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(p,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(y,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.forecastModel")),1)]),_:1})]),_:1}),t.createVNode(s,{class:""},{default:t.withCtx(()=>{var X,se,Ae,Le,Fe,Ge,De,ze,je,Ve,Te,Re,We,Ze,Be,we,xe,_e,Xe,He,Oe,Me,at,it,rt,lt,nt,st,ct,mt,dt,ht,pt,gt,ut,ft,yt,bt,wt,xt,kt,At,Lt,Ct,vt,zt,_t,St,Nt,Mt,Pt,Vt,Tt,Et,Dt,Rt,Bt,It,Ft,Gt,jt,Pe,Ee,Wt,Ye,Zt,et,ke,Ue,te,Ce,Y,O,Je,Ie,Se,F,Xt,$,ve,Ke,tt,ot,R,Qe,G,qe,Ot,ae,$t,re,go,uo,fo,yo,bo,wo,xo,ko,Ao,Lo,Co,vo,zo,_o;return[t.createElementVNode("div",Bm,t.toDisplayString(o.$t("weather.atmospheric")),1),t.createElementVNode("div",Im,t.toDisplayString((Ae=(se=(X=i.models)==null?void 0:X.weather)==null?void 0:se.NOAA)==null?void 0:Ae.source)+" "+t.toDisplayString((Ge=(Fe=(Le=i.models)==null?void 0:Le.weather)==null?void 0:Fe.NOAA)==null?void 0:Ge.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((Ve=(je=(ze=(De=i.models)==null?void 0:De.weather)==null?void 0:ze.NOAA)==null?void 0:je.meta)==null?void 0:Ve.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",Fm,t.toDisplayString(o.$t("weather.source"))+": NOAA",1),t.createElementVNode("div",Gm,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((Ze=(We=(Re=(Te=i.models)==null?void 0:Te.weather)==null?void 0:Re.NOAA)==null?void 0:We.meta)==null?void 0:Ze.availabilityTime)),1),t.createElementVNode("div",jm,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((_e=(xe=(we=(Be=i.models)==null?void 0:Be.weather)==null?void 0:we.NOAA)==null?void 0:xe.meta)==null?void 0:_e.initialisationTime)),1),t.createElementVNode("div",Wm,t.toDisplayString((Oe=(He=(Xe=i.models)==null?void 0:Xe.weather)==null?void 0:He.ECMWF)==null?void 0:Oe.source)+" "+t.toDisplayString((it=(at=(Me=i.models)==null?void 0:Me.weather)==null?void 0:at.ECMWF)==null?void 0:it.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((st=(nt=(lt=(rt=i.models)==null?void 0:rt.weather)==null?void 0:lt.ECMWF)==null?void 0:nt.meta)==null?void 0:st.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",Zm,t.toDisplayString(o.$t("weather.source"))+": ECMWF",1),t.createElementVNode("div",Xm,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((ht=(dt=(mt=(ct=i.models)==null?void 0:ct.weather)==null?void 0:mt.ECMWF)==null?void 0:dt.meta)==null?void 0:ht.availabilityTime)),1),t.createElementVNode("div",Hm,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((ft=(ut=(gt=(pt=i.models)==null?void 0:pt.weather)==null?void 0:gt.ECMWF)==null?void 0:ut.meta)==null?void 0:ft.initialisationTime)),1),t.createVNode(m),t.createElementVNode("div",Om,t.toDisplayString(o.$t("weather.wave")),1),t.createElementVNode("div",Ym,t.toDisplayString((xt=(wt=(bt=(yt=i.models)==null?void 0:yt.marine)==null?void 0:bt.wave)==null?void 0:wt.NOAA)==null?void 0:xt.source)+" "+t.toDisplayString((Ct=(Lt=(At=(kt=i.models)==null?void 0:kt.marine)==null?void 0:At.wave)==null?void 0:Lt.NOAA)==null?void 0:Ct.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((Nt=(St=(_t=(zt=(vt=i.models)==null?void 0:vt.marine)==null?void 0:zt.wave)==null?void 0:_t.NOAA)==null?void 0:St.meta)==null?void 0:Nt.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",Um,t.toDisplayString(o.$t("weather.source"))+": NOAA",1),t.createElementVNode("div",Jm,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((Et=(Tt=(Vt=(Pt=(Mt=i.models)==null?void 0:Mt.marine)==null?void 0:Pt.wave)==null?void 0:Vt.NOAA)==null?void 0:Tt.meta)==null?void 0:Et.availabilityTime)),1),t.createElementVNode("div",Km,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((Ft=(It=(Bt=(Rt=(Dt=i.models)==null?void 0:Dt.marine)==null?void 0:Rt.wave)==null?void 0:Bt.NOAA)==null?void 0:It.meta)==null?void 0:Ft.initialisationTime)),1),t.createElementVNode("div",Qm,t.toDisplayString((Ee=(Pe=(jt=(Gt=i.models)==null?void 0:Gt.marine)==null?void 0:jt.wave)==null?void 0:Pe.ECMWF)==null?void 0:Ee.source)+" "+t.toDisplayString((et=(Zt=(Ye=(Wt=i.models)==null?void 0:Wt.marine)==null?void 0:Ye.wave)==null?void 0:Zt.ECMWF)==null?void 0:et.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((Y=(Ce=(te=(Ue=(ke=i.models)==null?void 0:ke.marine)==null?void 0:Ue.wave)==null?void 0:te.ECMWF)==null?void 0:Ce.meta)==null?void 0:Y.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",qm,t.toDisplayString(o.$t("weather.source"))+": ECMWF",1),t.createElementVNode("div",$m,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((F=(Se=(Ie=(Je=(O=i.models)==null?void 0:O.marine)==null?void 0:Je.wave)==null?void 0:Ie.ECMWF)==null?void 0:Se.meta)==null?void 0:F.availabilityTime)),1),t.createElementVNode("div",ed,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((tt=(Ke=(ve=($=(Xt=i.models)==null?void 0:Xt.marine)==null?void 0:$.wave)==null?void 0:ve.ECMWF)==null?void 0:Ke.meta)==null?void 0:tt.initialisationTime)),1),t.createVNode(m),t.createElementVNode("div",td,t.toDisplayString(o.$t("weather.currents")),1),t.createElementVNode("div",od,t.toDisplayString((G=(Qe=(R=(ot=i.models)==null?void 0:ot.marine)==null?void 0:R.current)==null?void 0:Qe.ECMWF)==null?void 0:G.source)+" "+t.toDisplayString(($t=(ae=(Ot=(qe=i.models)==null?void 0:qe.marine)==null?void 0:Ot.current)==null?void 0:ae.ECMWF)==null?void 0:$t.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((yo=(fo=(uo=(go=(re=i.models)==null?void 0:re.marine)==null?void 0:go.current)==null?void 0:uo.ECMWF)==null?void 0:fo.meta)==null?void 0:yo.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",ad,t.toDisplayString(o.$t("weather.source"))+": ECMWF",1),t.createElementVNode("div",id,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((Ao=(ko=(xo=(wo=(bo=i.models)==null?void 0:bo.marine)==null?void 0:wo.current)==null?void 0:xo.ECMWF)==null?void 0:ko.meta)==null?void 0:Ao.availabilityTime)),1),t.createElementVNode("div",rd,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((_o=(zo=(vo=(Co=(Lo=i.models)==null?void 0:Lo.marine)==null?void 0:Co.current)==null?void 0:vo.ECMWF)==null?void 0:zo.meta)==null?void 0:_o.initialisationTime)),1)]}),_:1})]),_:1})],2)],6),a.map?(t.openBlock(),t.createBlock(w,t.mergeProps({key:1,ref:"windBarb",map:a.map,"map-feather":a.mapFeather,"before-layer":"empty-layer-3",wind:(ne=i.weatherLayers)==null?void 0:ne.wind,"menu-toggle":a.menuToggle},o.$attrs),null,16,["map","map-feather","wind","menu-toggle"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(b,t.mergeProps({key:2,map:a.map,"before-layer":"empty-layer-2","sig-wave-height":(S=i.weatherLayers)==null?void 0:S["sig-wave-height"],"menu-toggle":a.menuToggle,"active-weather-layers":i.activeWeatherLayers},o.$attrs),null,16,["map","sig-wave-height","menu-toggle","active-weather-layers"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(L,t.mergeProps({key:3,map:a.map,"map-feather":a.mapFeather,"before-layer":"empty-layer-2",current:(Z=i.weatherLayers)==null?void 0:Z.current,"menu-toggle":a.menuToggle},o.$attrs),null,16,["map","map-feather","current","menu-toggle"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(k,t.mergeProps({key:4,map:a.map,"before-layer":"empty-layer-3",prmsl:(H=i.weatherLayers)==null?void 0:H.prmsl,"menu-toggle":a.menuToggle,"active-weather-layers":i.activeWeatherLayers},o.$attrs,{theme:a.theme}),null,16,["map","prmsl","menu-toggle","active-weather-layers","theme"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(C,t.mergeProps({key:5,viewport:i.viewport,factor:(q=i.weatherLayers)==null?void 0:q["wind-particle"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(A,t.mergeProps({key:6,viewport:i.viewport,factor:(W=i.weatherLayers)==null?void 0:W["current-particle"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(_,t.mergeProps({key:7,viewport:i.viewport,factor:(B=i.weatherLayers)==null?void 0:B["sig-wave"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(z,t.mergeProps({key:8,map:a.map,viewport:i.viewport,factor:(J=i.weatherLayers)==null?void 0:J.swell,"menu-toggle":a.menuToggle,"active-weather-layers":i.activeWeatherLayers,simple:a.simple},o.$attrs),null,16,["map","viewport","factor","menu-toggle","active-weather-layers","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(P,t.mergeProps({key:9,viewport:i.viewport,factor:(E=i.weatherLayers)==null?void 0:E["ice-edge"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(V,t.mergeProps({key:10,viewport:i.viewport,factor:(I=i.weatherLayers)==null?void 0:I["ice-cover"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(N,t.mergeProps({key:11,viewport:i.viewport,factor:(ie=i.weatherLayers)==null?void 0:ie["ice-thickness"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(j,t.mergeProps({key:12,viewport:i.viewport,factor:(ge=i.weatherLayers)==null?void 0:ge.precip3h,"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(U,t.mergeProps({key:13,viewport:i.viewport,factor:(ue=i.weatherLayers)==null?void 0:ue.visibility,"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(K,t.mergeProps({key:14,viewport:i.viewport,factor:(oe=i.weatherLayers)==null?void 0:oe["water-temp"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(de,t.mergeProps({key:15,viewport:i.viewport,factor:(he=i.weatherLayers)==null?void 0:he.temp,"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0)])}const nd=Q(bm,[["render",ld]]),no=[{rank:0,name:"Best Match",alias:"BEST MATCH",model:"best_match",models:["best_match"]},{rank:1,name:"GFS",alias:"GFS",model:"gfs_seamless",provider:"NOAA",country:"United States",resolution:25,tips:"3-25km",length:16,frequency:1,models:["gfs_seamless"],categories:"ncep_gfs013,ncep_gfs025,ncep_gfs_graphcast025,ncep_hrrr_conus,ncep_nbm_conus",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:2,name:"ECMWF",alias:"ECMWF",model:"ecmwf_ifs025",provider:"ECMWF",country:"European Union",resolution:25,tips:"25km",length:15,frequency:6,models:["ecmwf_ifs025","ecmwf_aifs025_single","ecmwf_ifs"],categories:"ecmwf_ifs025,ecmwf_aifs025_single,ecmwf_ifs",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:3,disabled:!0,name:"ICON",alias:"ECMWF",model:"icon_seamless",provider:"Deutscher Wetterdienst (DWD)",country:"Germany",resolution:13,tips:"2-13km",length:7.5,frequency:3,models:["icon_seamless","icon_global","icon_eu","icon_d2"],categories:"dwd_icon,dwd_icon_eps,dwd_icon_d2,dwd_icon_d2_eps,dwd_icon_eu,dwd_icon_eu_eps",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:4,name:"ARPEGE",disabled:!0,alias:"ECMWF",model:"arpege_seamless",provider:"Météo-France",country:"France",resolution:25,tips:"1-25km",length:4,frequency:1,models:["arpege_seamless","arpege_world","arpege_europe"],categories:"meteofrance_arpege_europe,meteofrance_arpege_europe_probabilities,meteofrance_arpege_world025",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:5,name:"UKMO",disabled:!0,alias:"ECMWF",model:"ukmo_seamless",provider:"UK Met Office",country:"United Kingdom",resolution:10,tips:"2-10km",length:7,frequency:1,models:["ukmo_seamless","ukmo_global_deterministic_10km","ukmo_uk_deterministic_2km"],categories:"ukmo_global_deterministic_10km,ukmo_uk_deterministic_2km",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:6,name:"JMA",disabled:!0,alias:"GFS",model:"jma_seamless",provider:"JMA",country:"Japan",resolution:55,tips:"5-55km",length:11,frequency:3,models:["jma_seamless","jma_msm","jma_gsm"],categories:"jma_gsm,jma_msm",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:7,name:"GEM",disabled:!0,alias:"GFS",model:"gem_seamless",provider:"Canadian Weather Service",country:"Canada",resolution:2.5,tips:"2.5km",length:10,frequency:6,models:["gem_seamless","gem_global","gem_regional"],categories:"cmc_gem_gdps,cmc_gem_hrdps,cmc_gem_rdps",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:8,name:"GRAPES",disabled:!0,alias:"GFS",model:"cma_grapes_global",provider:"China Meteorological Administration (CMA)",country:"China",resolution:15,tips:"15km",length:10,frequency:6,models:["cma_grapes_global"],categories:"cma_grapes_global",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:9,name:"ACCESS-G",disabled:!0,alias:"GFS",model:"bom_access_global",provider:"Australian Bureau of Meteorology (BOM)",country:"Australia",resolution:15,tips:"15km",length:10,frequency:6,models:["bom_access_global"],categories:"bom_access_global",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"}],so=[{rank:0,name:"Best Match",alias:"BEST MATCH",model:"best_match",models:["best_match"]},{rank:1,name:"MFWAM",alias:"ECMWF",model:"meteofrance_wave",provider:"MeteoFrance",country:"France",resolution:8,tips:"8km",length:10,frequency:12,models:["meteofrance_wave"],categories:"meteofrance_wave",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:2,disabled:!0,name:"SMOC",alias:"ECMWF",model:"meteofrance_currents",provider:"MeteoFrance",country:"France",resolution:8,tips:"8km",length:10,frequency:24,models:["meteofrance_currents"],categories:"meteofrance_currents, meteofrance_sea_surface_temperature",variables:"ocean_u_current,ocean_v_current,invert_barometer_height,sea_level_height_msl,sea_surface_temperature"},{rank:3,disabled:!0,name:"EWAM",alias:"ECMWF",model:"ewam",provider:"DWD",country:"Germany",resolution:5,tips:"5km",length:8,frequency:2,models:["ewam"],categories:"dwd_ewam",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:4,disabled:!0,name:"GWAM",alias:"ECMWF",model:"gwam",provider:"DWD",country:"Germany",resolution:5,tips:"5km",length:4,frequency:2,models:["gwam"],categories:"dwd_gwam",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:5,disabled:!0,name:"ECWAM",alias:"ECMWF",model:"ecmwf_wam025",provider:"ECMWF",country:"Europe",resolution:25,tips:"25km",length:10,frequency:6,models:["ecmwf_wam025"],categories:"ecmwf_wam025",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:6,name:"GFSWave",alias:"GFS",model:"ncep_gfswave025",provider:"NCEP",country:"USA",resolution:25,tips:"25km",length:10,frequency:6,models:["ncep_gfswave025","ncep_gfswave016"],categories:"ncep_gfswave025,ncep_gfswave016",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:7,disabled:!0,name:"ERA5-Ocean",alias:"ECMWF",model:"era5_ocean",provider:"Copernicus",country:"Europe",resolution:50,tips:"50km",length:-5,frequency:1,models:["era5_ocean"],categories:"copernicus_era5_ocean",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"}];let la=class{static standardWeatherModels(){return no.filter(e=>!e.disabled&&e.alias)}static standardMarineModels(){return so.filter(e=>!e.disabled&&e.alias)}static autoPickLayerModel(e,a="copernicus"){return a=a||"copernicus",a=a==null?void 0:a.toLowerCase(),a=["gfs","ecmwf","copernicus"].includes(a)?a:"copernicus",e=e==null?void 0:e.toLowerCase(),e==="gfs"?"gfs":["ec","ecmwf"].includes(e)?"ecmwf":["copernicus","cmems"].includes(e)?"copernicus":a}static autoPickPeerModel(e,a,r="copernicus"){if(a=this.autoPickLayerModel(a,r),$r.LayerHelper.WEATHER_LAYERS.reduce((i,l)=>l.atmos?i+l.weight:i,0)&e.weight){if(a==="copernicus")return"ecmwf"}else{if(["sig-wave","sig-wave-height","sig-wave-height-contour"].includes(e.key))return a;if(a==="ecmwf")return"copernicus"}return a}static autoPickMeteoModel(e="best_match"){var a,r;e=e==null?void 0:e.toLowerCase(),e=e==="ec"?"ecmwf":e;const i=e.toLowerCase().split(","),l=[],n=[];for(const c of i){let s=no.find(d=>{var g,u,y;return((g=d.models)==null?void 0:g.includes(c))||((u=d.alias)==null?void 0:u.toLowerCase())===c||((y=d.name)==null?void 0:y.toLowerCase())===c}),m=so.find(d=>{var g,u,y;return((g=d.models)==null?void 0:g.includes(c))||((u=d.alias)==null?void 0:u.toLowerCase())===c||((y=d.name)==null?void 0:y.toLowerCase())===c});s=s||no.find(d=>{var g,u;return((g=d.alias)==null?void 0:g.toLowerCase())===((u=m==null?void 0:m.alias)==null?void 0:u.toLowerCase())}),m=m||so.find(d=>{var g,u;return((g=d.alias)==null?void 0:g.toLowerCase())===((u=s==null?void 0:s.alias)==null?void 0:u.toLowerCase())}),s=s||no[0],m=m||so[0],l.push((a=s.models)!=null&&a.includes(c)?c:s.model),n.push((r=m.models)!=null&&r.includes(c)?c:m.model)}return{weatherModels:l.join(","),marineModels:n.join(",")}}static autoPickSubCategories(e){e=e.toUpperCase();const a=no.filter(l=>l.alias===e),r=so.filter(l=>l.alias===e),i=[];return a.forEach(l=>{l.categories&&i.push(...l.categories.split(","))}),r.forEach(l=>{l.categories&&i.push(...l.categories.split(","))}),i}static pickHourly(e,a){var r,i,l,n,c,s,m,d,g,u,y,p,h,f,w,b,L,k,C,A,_,z,P,V,N,j,U,K,de,ne,S,Z,H,q,W,B,J,E,I,ie,ge,ue,oe,he,X,se,Ae,Le,Fe,Ge,De,ze,je,Ve,Te,Re,We,Ze,Be,we,xe,_e,Xe,He,Oe,Me,at,it,rt,lt,nt,st,ct,mt,dt,ht,pt,gt,ut,ft,yt,bt,wt,xt,kt,At,Lt,Ct,vt,zt,_t,St,Nt,Mt,Pt,Vt,Tt,Et,Dt,Rt,Bt,It,Ft,Gt,jt,Pe,Ee,Wt,Ye,Zt,et,ke,Ue;const te=typeof a=="string"?v(a):a;let Ce=te.clone();const Y=e==null?void 0:e.weather,O=e==null?void 0:e.marine,Je=((i=(r=Y==null?void 0:Y[0])==null?void 0:r.hourly)==null?void 0:i.date)||((n=(l=O==null?void 0:O[0])==null?void 0:l.hourly)==null?void 0:n.date),Ie=v.utc(Je),Se=Ie.clone().add(((m=(s=(c=Y==null?void 0:Y[0])==null?void 0:c.hourly)==null?void 0:s.time)==null?void 0:m.at(0))||((u=(g=(d=O==null?void 0:O[0])==null?void 0:d.hourly)==null?void 0:g.time)==null?void 0:u.at(0)),"h"),F=Ie.clone().add(((h=(p=(y=Y==null?void 0:Y[0])==null?void 0:y.hourly)==null?void 0:p.time)==null?void 0:h.at(-1))||((b=(w=(f=O==null?void 0:O[0])==null?void 0:f.hourly)==null?void 0:w.time)==null?void 0:b.at(-1)),"h"),Xt=[];Ce=Ce.isBefore(Se)?Se.clone():Ce,Ce=Ce.isAfter(F)?F.clone():Ce;const $=Ce.utc().diff(Se,"h",!1);let ve,Ke;if(Y!=null&&Y.length){let tt=0,ot=0,R=0;for(const Qe of Y){const G=Qe==null?void 0:Qe.hourly;for(let re=$-($-1)%3;re<=$;re++)tt+=((L=G==null?void 0:G.precipitation)==null?void 0:L.at(re))??0;for(let re=$-($-1)%6;re<=$;re++)ot+=((k=G==null?void 0:G.precipitation)==null?void 0:k.at(re))??0;for(let re=$-($-1)%12;re<=$;re++)R+=((C=G==null?void 0:G.precipitation)==null?void 0:C.at(re))??0;const qe=((A=G==null?void 0:G.wind_direction_10m)==null?void 0:A.at($))??((z=(_=G==null?void 0:G.wind_direction_10m)==null?void 0:_.filter(re=>re!==null))==null?void 0:z.at(-1));ve={temp:((P=G==null?void 0:G.temperature_2m)==null?void 0:P.at($))??((N=(V=G==null?void 0:G.temperature_2m)==null?void 0:V.filter(re=>re!==null))==null?void 0:N.at(-1)),apparentTemp:((j=G==null?void 0:G.apparent_temperature)==null?void 0:j.at($))??((K=(U=G==null?void 0:G.apparent_temperature)==null?void 0:U.filter(re=>re!==null))==null?void 0:K.at(-1)),rh:((de=G==null?void 0:G.relative_humidity_2m)==null?void 0:de.at($))??((S=(ne=G==null?void 0:G.relative_humidity_2m)==null?void 0:ne.filter(re=>re!==null))==null?void 0:S.at(-1)),dp:((Z=G==null?void 0:G.dew_point_2m)==null?void 0:Z.at($))??((q=(H=G==null?void 0:G.dew_point_2m)==null?void 0:H.filter(re=>re!==null))==null?void 0:q.at(-1)),precip:{probability:((W=G==null?void 0:G.precipitation_probability)==null?void 0:W.at($))??0,sum:((B=G==null?void 0:G.precipitation)==null?void 0:B.at($))??0,sum1Hours:((J=G==null?void 0:G.precipitation)==null?void 0:J.at($))??0,sum3Hours:Math.round(tt*100)/100,sum6Hours:Math.round(ot*100)/100,sum12Hours:Math.round(R*100)/100},pmsl:((E=G==null?void 0:G.pressure_msl)==null?void 0:E.at($))??((ie=(I=G==null?void 0:G.pressure_msl)==null?void 0:I.filter(re=>re!==null))==null?void 0:ie.at(-1)),psurf:((ge=G==null?void 0:G.surface_pressure)==null?void 0:ge.at($))??((oe=(ue=G==null?void 0:G.surface_pressure)==null?void 0:ue.filter(re=>re!==null))==null?void 0:oe.at(-1)),code:((he=G==null?void 0:G.weather_code)==null?void 0:he.at($))??((se=(X=G==null?void 0:G.weather_code)==null?void 0:X.filter(re=>re!==null))==null?void 0:se.at(-1)),visibility:this.m2nm(((Ae=G==null?void 0:G.visibility)==null?void 0:Ae.at($))??((Fe=(Le=G==null?void 0:G.visibility)==null?void 0:Le.filter(re=>re!==null))==null?void 0:Fe.at(-1))),wind:{speed:((Ge=G==null?void 0:G.wind_speed_10m)==null?void 0:Ge.at($))??((ze=(De=G==null?void 0:G.wind_speed_10m)==null?void 0:De.filter(re=>re!==null))==null?void 0:ze.at(-1)),kts:((je=G==null?void 0:G.wind_speed_10m)==null?void 0:je.at($))??((Te=(Ve=G==null?void 0:G.wind_speed_10m)==null?void 0:Ve.filter(re=>re!==null))==null?void 0:Te.at(-1)),degree:qe,bearing:qe!==null?Math.round((qe+180)%360):null,gusts:((Re=G==null?void 0:G.wind_gusts_10m)==null?void 0:Re.at($))??((Ze=(We=G==null?void 0:G.wind_gusts_10m)==null?void 0:We.filter(re=>re!==null))==null?void 0:Ze.at(-1))},isDay:(Be=G==null?void 0:G.is_day)==null?void 0:Be.at($)};const{name:Ot,url:ae,bg:$t}=this.parseWeatherCode(ve.code,ve.isDay);ve.name=Ot,ve.url=ae,ve.bg=$t,ve.wind.scale=this.beaufort(this.kts2ms(ve.wind.kts)),ve.wind.direction=this.degree2Direction(ve.wind.degree),Xt.push({utc:te.utc().format(),realUTC:Se.add($,"h").format(),model:Qe.model,weather:{...ve}})}}if(O!=null&&O.length){let tt=0;for(const ot of O){const R=ot==null?void 0:ot.hourly,Qe=((we=R==null?void 0:R.wave_direction)==null?void 0:we.at($))??((_e=(xe=R==null?void 0:R.wave_direction)==null?void 0:xe.filter(ae=>ae!==null))==null?void 0:_e.at(-1)),G=((Xe=R==null?void 0:R.swell_wave_direction)==null?void 0:Xe.at($))??((Oe=(He=R==null?void 0:R.swell_wave_direction)==null?void 0:He.filter(ae=>ae!==null))==null?void 0:Oe.at(-1)),qe=((Me=R==null?void 0:R.wind_wave_direction)==null?void 0:Me.at($))??((it=(at=R==null?void 0:R.wind_wave_direction)==null?void 0:at.filter(ae=>ae!==null))==null?void 0:it.at(-1)),Ot=((rt=R==null?void 0:R.ocean_current_direction)==null?void 0:rt.at($))??((nt=(lt=R==null?void 0:R.ocean_current_direction)==null?void 0:lt.filter(ae=>ae!==null))==null?void 0:nt.at(-1));Ke={wave:{sig:{height:((st=R==null?void 0:R.wave_height)==null?void 0:st.at($))??((mt=(ct=R==null?void 0:R.wave_height)==null?void 0:ct.filter(ae=>ae!==null))==null?void 0:mt.at(-1)),degree:Qe,bearing:Qe!==null?Math.round((Qe+180)%360):null,period:((dt=R==null?void 0:R.wave_period)==null?void 0:dt.at($))??((pt=(ht=R==null?void 0:R.wave_period)==null?void 0:ht.filter(ae=>ae!==null))==null?void 0:pt.at(-1))},swell:{height:((gt=R==null?void 0:R.swell_wave_height)==null?void 0:gt.at($))??((ft=(ut=R==null?void 0:R.swell_wave_height)==null?void 0:ut.filter(ae=>ae!==null))==null?void 0:ft.at(-1)),degree:G,bearing:G!==null?Math.round((G+180)%360):null,period:((yt=R==null?void 0:R.swell_wave_period)==null?void 0:yt.at($))??((wt=(bt=R==null?void 0:R.swell_wave_period)==null?void 0:bt.filter(ae=>ae!==null))==null?void 0:wt.at(-1)),peakPeriod:((xt=R==null?void 0:R.swell_wave_peak_period)==null?void 0:xt.at($))??((At=(kt=R==null?void 0:R.swell_wave_peak_period)==null?void 0:kt.filter(ae=>ae!==null))==null?void 0:At.at(-1))},wd:{height:((Lt=R==null?void 0:R.wind_wave_height)==null?void 0:Lt.at($))??((vt=(Ct=R==null?void 0:R.wind_wave_height)==null?void 0:Ct.filter(ae=>ae!==null))==null?void 0:vt.at(-1)),degree:qe,bearing:qe!==null?Math.round((qe+180)%360):null,period:((zt=R==null?void 0:R.wind_wave_period)==null?void 0:zt.at($))??((St=(_t=R==null?void 0:R.wind_wave_period)==null?void 0:_t.filter(ae=>ae!==null))==null?void 0:St.at(-1)),peakPeriod:((Nt=R==null?void 0:R.wind_wave_peak_period)==null?void 0:Nt.at($))??((Pt=(Mt=R==null?void 0:R.wind_wave_peak_period)==null?void 0:Mt.filter(ae=>ae!==null))==null?void 0:Pt.at(-1))}},current:{speed:((Vt=R==null?void 0:R.ocean_current_velocity)==null?void 0:Vt.at($))??((Et=(Tt=R==null?void 0:R.ocean_current_velocity)==null?void 0:Tt.filter(ae=>ae!==null))==null?void 0:Et.at(-1)),kts:((Dt=R==null?void 0:R.ocean_current_velocity)==null?void 0:Dt.at($))??((Bt=(Rt=R==null?void 0:R.ocean_current_velocity)==null?void 0:Rt.filter(ae=>ae!==null))==null?void 0:Bt.at(-1)),degree:Ot,bearing:Ot},sst:((It=R==null?void 0:R.sea_surface_temperature)==null?void 0:It.at($))??((Gt=(Ft=R==null?void 0:R.sea_surface_temperature)==null?void 0:Ft.filter(ae=>ae!==null))==null?void 0:Gt.at(-1)),height:((jt=R==null?void 0:R.sea_level_height_msl)==null?void 0:jt.at($))??((Ee=(Pe=R==null?void 0:R.sea_level_height_msl)==null?void 0:Pe.filter(ae=>ae!==null))==null?void 0:Ee.at(-1)),ice:{sit:((Wt=R==null?void 0:R.sea_ice_thickness)==null?void 0:Wt.at($))??((Zt=(Ye=R==null?void 0:R.sea_ice_thickness)==null?void 0:Ye.filter(ae=>ae!==null))==null?void 0:Zt.at(-1)),sic:((et=R==null?void 0:R.sea_ice_concentration)==null?void 0:et.at($))??((Ue=(ke=R==null?void 0:R.sea_ice_concentration)==null?void 0:ke.filter(ae=>ae!==null))==null?void 0:Ue.at(-1))}},Ke.wave=this.parseWave(Ke.wave,ve==null?void 0:ve.wind),Ke.current.direction=this.degree2Direction(Ke.current.degree),Xt[tt]?Object.assign(Xt[tt],Ke):Xt.push({utc:te.utc().format(),realUTC:Se.add($,"h").format(),model:ot.model,...Ke}),tt++}}return Xt}static toLegacy(e){var a,r,i,l,n,c,s,m,d,g;return{wind:(a=e==null?void 0:e.weather)==null?void 0:a.wind,visibility:(r=e==null?void 0:e.weather)==null?void 0:r.visibility,temp:(i=e==null?void 0:e.weather)==null?void 0:i.temp,prmsl:(l=e==null?void 0:e.weather)==null?void 0:l.pmsl,gusts:{kts:(c=(n=e==null?void 0:e.weather)==null?void 0:n.wind)==null?void 0:c.gusts},precip:(s=e==null?void 0:e.weather)==null?void 0:s.precip,code:(m=e==null?void 0:e.weather)==null?void 0:m.code,name:(d=e==null?void 0:e.weather)==null?void 0:d.name,url:(g=e==null?void 0:e.weather)==null?void 0:g.url,wave:e==null?void 0:e.wave,current:e==null?void 0:e.current,sst:e==null?void 0:e.sst,height:e==null?void 0:e.height,utc:e==null?void 0:e.utc,source:e==null?void 0:e.model,ice:e==null?void 0:e.ice}}static pickDaily(e,a){var r,i,l,n,c,s,m,d,g,u,y,p,h,f,w,b,L,k,C,A,_,z,P,V,N,j,U,K,de,ne,S,Z,H,q,W,B,J,E,I,ie,ge,ue,oe,he,X,se,Ae,Le,Fe,Ge,De,ze,je,Ve,Te,Re,We,Ze,Be,we,xe,_e,Xe,He,Oe,Me,at,it,rt,lt,nt,st,ct,mt,dt,ht,pt,gt,ut,ft,yt,bt,wt,xt,kt,At,Lt,Ct,vt,zt,_t,St,Nt,Mt,Pt,Vt,Tt,Et,Dt,Rt,Bt,It,Ft,Gt;const jt=typeof a=="string"?v(a):a;let Pe=jt.clone();const Ee=e==null?void 0:e.weather,Wt=e==null?void 0:e.marine,Ye=v((l=(i=(r=Ee==null?void 0:Ee[0])==null?void 0:r.daily)==null?void 0:i.time)==null?void 0:l.at(0)),Zt=v((s=(c=(n=Ee==null?void 0:Ee[0])==null?void 0:n.daily)==null?void 0:c.time)==null?void 0:s.at(-1)),et=[];Pe=Pe.isBefore(Ye)?Ye.clone():Pe,Pe=Pe.isAfter(Zt)?Zt.clone():Pe;let ke,Ue;const te=Pe.diff(Ye,"d",!1);if(Ee)for(const Ce of Ee){const Y=Ce.daily,O=((m=Y.wind_direction_10m_dominant)==null?void 0:m.at(te))??((g=(d=Y.wind_direction_10m_dominant)==null?void 0:d.filter(F=>F!==null))==null?void 0:g.at(-1));ke={code:((u=Y.weather_code)==null?void 0:u.at(te))??((p=(y=Y.weather_code)==null?void 0:y.filter(F=>F!==null))==null?void 0:p.at(-1)),temp:{max:((h=Y.temperature_2m_max)==null?void 0:h.at(te))??((w=(f=Y.temperature_2m_max)==null?void 0:f.filter(F=>F!==null))==null?void 0:w.at(-1)),min:((b=Y.temperature_2m_min)==null?void 0:b.at(te))??((k=(L=Y.temperature_2m_min)==null?void 0:L.filter(F=>F!==null))==null?void 0:k.at(-1)),mean:((C=Y.temperature_2m_mean)==null?void 0:C.at(te))??((_=(A=Y.temperature_2m_mean)==null?void 0:A.filter(F=>F!==null))==null?void 0:_.at(-1))},apparentTemp:{max:((z=Y.apparent_temperature_max)==null?void 0:z.at(te))??((V=(P=Y.apparent_temperature_max)==null?void 0:P.filter(F=>F!==null))==null?void 0:V.at(-1)),min:((N=Y.apparent_temperature_min)==null?void 0:N.at(te))??((U=(j=Y.apparent_temperature_min)==null?void 0:j.filter(F=>F!==null))==null?void 0:U.at(-1))},precip:{sum:((K=Y.precipitation_sum)==null?void 0:K.at(te))??((ne=(de=Y.precipitation_sum)==null?void 0:de.filter(F=>F!==null))==null?void 0:ne.at(-1)),rainSum:((S=Y.rain_sum)==null?void 0:S.at(te))??((H=(Z=Y.rain_sum)==null?void 0:Z.filter(F=>F!==null))==null?void 0:H.at(-1)),snowfallSum:((q=Y.snowfall_sum)==null?void 0:q.at(te))??((B=(W=Y.snowfall_sum)==null?void 0:W.filter(F=>F!==null))==null?void 0:B.at(-1)),showersSum:((J=Y.showers_sum)==null?void 0:J.at(te))??((I=(E=Y.showers_sum)==null?void 0:E.filter(F=>F!==null))==null?void 0:I.at(-1)),hours:((ie=Y.precipitation_hours)==null?void 0:ie.at(te))??0,probability:((ge=Y.precipitation_probability_max)==null?void 0:ge.at(te))??0},rh:{max:((ue=Y.relative_humidity_2m_max)==null?void 0:ue.at(te))??((he=(oe=Y.relative_humidity_2m_max)==null?void 0:oe.filter(F=>F!==null))==null?void 0:he.at(-1)),min:((X=Y.relative_humidity_2m_min)==null?void 0:X.at(te))??((Ae=(se=Y.relative_humidity_2m_min)==null?void 0:se.filter(F=>F!==null))==null?void 0:Ae.at(-1)),mean:((Le=Y.relative_humidity_2m_mean)==null?void 0:Le.at(te))??((Ge=(Fe=Y.relative_humidity_2m_mean)==null?void 0:Fe.filter(F=>F!==null))==null?void 0:Ge.at(-1))},wind:{speed:((De=Y.wind_speed_10m_max)==null?void 0:De.at(te))??((je=(ze=Y.wind_speed_10m_max)==null?void 0:ze.filter(F=>F!==null))==null?void 0:je.at(-1)),kts:((Ve=Y.wind_speed_10m_max)==null?void 0:Ve.at(te))??((Re=(Te=Y.wind_speed_10m_max)==null?void 0:Te.filter(F=>F!==null))==null?void 0:Re.at(-1)),degree:O,gusts:((We=Y.wind_gusts_10m_max)==null?void 0:We.at(te))??((Be=(Ze=Y.wind_gusts_10m_max)==null?void 0:Ze.filter(F=>F!==null))==null?void 0:Be.at(-1)),mean:((we=Y.wind_speed_10m_mean)==null?void 0:we.at(te))??((_e=(xe=Y.wind_speed_10m_mean)==null?void 0:xe.filter(F=>F!==null))==null?void 0:_e.at(-1)),bearing:O!==null?Math.round((O+180)%360):null},visibility:{max:this.m2nm(((Xe=Y.visibility_max)==null?void 0:Xe.at(te))??((Oe=(He=Y.visibility_max)==null?void 0:He.filter(F=>F!==null))==null?void 0:Oe.at(-1))),min:this.m2nm(((Me=Y.visibility_min)==null?void 0:Me.at(te))??((it=(at=Y.visibility_min)==null?void 0:at.filter(F=>F!==null))==null?void 0:it.at(-1))),mean:this.m2nm(((rt=Y.visibility_mean)==null?void 0:rt.at(te))??((nt=(lt=Y.visibility_mean)==null?void 0:lt.filter(F=>F!==null))==null?void 0:nt.at(-1)))}};const{name:Je,url:Ie,bg:Se}=this.parseWeatherCode(ke.code,!0);ke.name=Je,ke.url=Ie,ke.bg=Se,ke.wind.scale=this.beaufort(this.kts2ms(ke.wind.kts)),ke.wind.direction=this.degree2Direction(ke.wind.degree),et.push({utc:jt.utc().format(),realUTC:Ye.add(te,"d").utc().format(),model:Ce.model,weather:{...ke}})}if(Wt){let Ce=0;for(const Y of Wt){const O=Y.daily,Je=((st=O==null?void 0:O.wave_direction_dominant)==null?void 0:st.at(te))||((mt=(ct=O==null?void 0:O.wave_direction_dominant)==null?void 0:ct.filter(F=>F!==null))==null?void 0:mt.at(-1)),Ie=((dt=O==null?void 0:O.swell_wave_direction_dominant)==null?void 0:dt.at(te))||((pt=(ht=O==null?void 0:O.swell_wave_direction_dominant)==null?void 0:ht.filter(F=>F!==null))==null?void 0:pt.at(-1)),Se=((gt=O==null?void 0:O.wind_wave_direction_dominant)==null?void 0:gt.at(te))||((ft=(ut=O==null?void 0:O.wind_wave_direction_dominant)==null?void 0:ut.filter(F=>F!==null))==null?void 0:ft.at(-1));Ue={wave:{sig:{height:((yt=O==null?void 0:O.wave_height_max)==null?void 0:yt.at(te))||((wt=(bt=O==null?void 0:O.wave_height_max)==null?void 0:bt.filter(F=>F!==null))==null?void 0:wt.at(-1)),degree:Je,period:((xt=O==null?void 0:O.wave_period_max)==null?void 0:xt.at(te))||((At=(kt=O==null?void 0:O.wave_period_max)==null?void 0:kt.filter(F=>F!==null))==null?void 0:At.at(-1)),bearing:Je!==null?Math.round((Je+180)%360):null},swell:{height:((Lt=O==null?void 0:O.swell_wave_height_max)==null?void 0:Lt.at(te))??((vt=(Ct=O==null?void 0:O.swell_wave_height_max)==null?void 0:Ct.filter(F=>F!==null))==null?void 0:vt.at(-1)),degree:Ie,period:((zt=O==null?void 0:O.swell_wave_period_max)==null?void 0:zt.at(te))??((St=(_t=O==null?void 0:O.swell_wave_period_max)==null?void 0:_t.filter(F=>F!==null))==null?void 0:St.at(-1)),peakPeriod:((Nt=O==null?void 0:O.swell_wave_peak_period_max)==null?void 0:Nt.at(te))??((Pt=(Mt=O==null?void 0:O.swell_wave_peak_period_max)==null?void 0:Mt.filter(F=>F!==null))==null?void 0:Pt.at(-1)),bearing:Ie!==null?Math.round((Ie+180)%360):null},wd:{height:((Vt=O==null?void 0:O.wind_wave_height_max)==null?void 0:Vt.at(te))??((Et=(Tt=O==null?void 0:O.wind_wave_height_max)==null?void 0:Tt.filter(F=>F!==null))==null?void 0:Et.at(-1)),degree:Se,period:((Dt=O==null?void 0:O.wind_wave_period_max)==null?void 0:Dt.at(te))??((Bt=(Rt=O==null?void 0:O.wind_wave_period_max)==null?void 0:Rt.filter(F=>F!==null))==null?void 0:Bt.at(-1)),peakPeriod:((It=O==null?void 0:O.wind_wave_peak_period_max)==null?void 0:It.at(te))??((Gt=(Ft=O==null?void 0:O.wind_wave_peak_period_max)==null?void 0:Ft.filter(F=>F!==null))==null?void 0:Gt.at(-1)),bearing:Se!==null?Math.round((Se+180)%360):null}}},Ue.wave=this.parseWave(Ue.wave,ke==null?void 0:ke.wind),Object.assign(et[Ce]||{},Ue),Ce++}}return et}static parseWave(e,a){if(e.sig.direction=this.degree2Direction(e.sig.degree),e.swell.direction=this.degree2Direction(e.swell.degree),e.wd.direction=this.degree2Direction(e.wd.degree),e.sig.scale=this.douglas(e.sig.height),e.swell.scale=this.douglas(e.swell.height),e.wd.scale=this.douglas(e.wd.height),e.sig.height==0){const r=Math.sqrt(Math.pow(e.swell.height||0,2)+Math.pow(e.wd.height||0,2));e.sig.height=r?Math.round(r*100)/100:.1}if(e.swell.height===0)if(e.sig.height>e.wd.height){const r=Math.sqrt(Math.abs(Math.pow(e.sig.height||0,2)-Math.pow(e.wd.height||0,2)));e.swell.height=Math.round(r*100)/100}else{const r=Math.round(.12*this.kts2ms((a==null?void 0:a.kts)||0)*100)/100,i=r>1?r/10:r>.5?r/5:r>.3?r/2:r,l=Math.max(e.sig.height,e.wd.height);e.swell.height=Math.round((i<l?i:l/2)*100)/100}if(e.wd.height===0)if(e.sig.height>e.swell.height){const r=Math.sqrt(Math.abs(Math.pow(e.sig.height||0,2)-Math.pow(e.swell.height||0,2))),i=.24*this.kts2ms((a==null?void 0:a.kts)||0);e.wd.height=Math.round(Math.min(r,i)*100)/100}else{const r=.24*this.kts2ms((a==null?void 0:a.kts)||0),i=Math.max(e.sig.height,e.swell.height);e.wd.height=Math.round((r<i?r:i/2)*100)/100}if(e.swell.height>=e.sig.height&&(e.swell.height=Math.round(e.sig.height*.8*100)/100),e.wd.height>=e.sig.height&&(e.wd.height=Math.round(e.sig.height*.8*100)/100),!e.sig.period){const r=Math.max(e.swell.period,e.wd.period);e.sig.period=Math.round(6*Math.sqrt(e.sig.height)),e.sig.period=isNaN(r)?void 0:e.sig.period>r?r:e.sig.period}if(!e.swell.period){e.swell.period=Math.round(6*Math.sqrt(e.swell.height));const r=Math.max(e.sig.period,e.wd.period);e.swell.period=isNaN(r)?void 0:e.swell.period>r?r:e.swell.period}if(!e.wd.period){e.wd.period=Math.round(6*Math.sqrt(e.wd.height));const r=Math.max(e.sig.period,e.swell.period);e.wd.period=isNaN(r)?void 0:e.wd.period>r?r:e.wd.period}return e}static parseWeatherCode(e,a){const r=this.weatherCode(e);return(a?r.day:r.night)||{}}static weatherCode(e){const a={code:e};switch(e){case 0:a.day={name:"Sunny",url:"https://ossimg.ormwx.com/asset/weather/01d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"},a.night={name:"Clear",url:"https://ossimg.ormwx.com/asset/weather/01n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"};break;case 1:a.day={name:"Mainly Sunny",url:"https://ossimg.ormwx.com/asset/weather/01d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"},a.night={name:"Mainly Clear",url:"https://ossimg.ormwx.com/asset/weather/01n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"};break;case 2:a.day={name:"Partly Cloudy",url:"https://ossimg.ormwx.com/asset/weather/02d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg2.png"},a.night={name:"Partly Cloudy",url:"https://ossimg.ormwx.com/asset/weather/02n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg2.png"};break;case 3:a.day={name:"Overcast",url:"https://ossimg.ormwx.com/asset/weather/04d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg3.png"},a.night={name:"Overcast",url:"https://ossimg.ormwx.com/asset/weather/04n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg3.png"};break;case 45:a.day={name:"Foggy",url:"https://ossimg.ormwx.com/asset/weather/50d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"},a.night={name:"Foggy",url:"https://ossimg.ormwx.com/asset/weather/50n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"};break;case 48:a.day={name:"Rime Fog",url:"https://ossimg.ormwx.com/asset/weather/50d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"},a.night={name:"Rime Fog",url:"https://ossimg.ormwx.com/asset/weather/50n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"};break;case 51:a.day={name:"Light Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 53:a.day={name:"Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 55:a.day={name:"Heavy Drizzle",url:"https://ossimg.ormwx.com/asset/weather/15d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Heavy Drizzle",url:"https://ossimg.ormwx.com/asset/weather/15n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 56:a.day={name:"Light Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 57:a.day={name:"Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 61:a.day={name:"Light Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 63:a.day={name:"Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 65:a.day={name:"Heavy Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Heavy Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 66:a.day={name:"Light Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 67:a.day={name:"Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 71:a.day={name:"Light Snow",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Light Snow",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 73:a.day={name:"Snow",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Snow",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 75:a.day={name:"Heavy Snow",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Heavy Snow",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 77:a.day={name:"Snow Grains",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Snow Grains",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 80:a.day={name:"Light Showers",url:"https://ossimg.ormwx.com/asset/weather/09d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Showers",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 81:a.day={name:"Showers",url:"https://ossimg.ormwx.com/asset/weather/09d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Showers",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 82:a.day={name:"Heavy Showers",url:"https://ossimg.ormwx.com/asset/weather/09d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Heavy Showers",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 85:a.day={name:"Light Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Light Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 86:a.day={name:"Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 95:a.day={name:"Thunderstorm",url:"https://ossimg.ormwx.com/asset/weather/11d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Thunderstorm",url:"https://ossimg.ormwx.com/asset/weather/11n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 96:a.day={name:"Light Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 99:a.day={name:"Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break}return a}static kts2ms(e){return isNaN(e)||e===null?e:Math.round(e*1852/3600*1e4)/1e4}static kts2kmh(e){return isNaN(e)||e===null?e:e*1.852}static m2nm(e){return isNaN(e)||e===null?e:Math.round(e/1e3/1.852*1e4)/1e4}static kmh2kts(e){return isNaN(e)||e===null?e:this.ms2kts(e*1e3/3600)}static ms2kts(e){return isNaN(e)||e===null?e:Math.round(e*3600/1852*1e4)/1e4}static degree2Radian(e){if(isNaN(e)||e===null)return e;let a=e%360/360*2*Math.PI;return a=a<0?a+2*Math.PI:a,a}static degree2Direction(e){const a=this.degree2Radian(e);if(isNaN(a)||a===null)return null;let r="N/A";const i=Math.PI/16;return a<i?r="N":a>=i&&a<3*i?r="NNE":a>=3*i&&a<5*i?r="NE":a>=5*i&&a<7*i?r="ENE":a>=7*i&&a<9*i?r="E":a>=9*i&&a<11*i?r="ESE":a>=11*i&&a<13*i?r="SE":a>=13*i&&a<15*i?r="SSE":a>=15*i&&a<17*i?r="S":a>=17*i&&a<19*i?r="SSW":a>=19*i&&a<21*i?r="SW":a>=21*i&&a<23*i?r="WSW":a>=23*i&&a<25*i?r="W":a>=25*i&&a<27*i?r="WNW":a>=27*i&&a<29*i?r="NW":a>=29*i&&a<31*i?r="NNW":a>=31*i&&a<32*i&&(r="N"),r}static beaufort(e){let a=0;return isNaN(e)||(e=Math.round(e*10)/10,e<=.2?a=0:e<=1.5?a=1:e<=3.3?a=2:e<=5.4?a=3:e<=7.9?a=4:e<=10.7?a=5:e<=13.8?a=6:e<=17.1?a=7:e<=20.7?a=8:e<=22.4?a=9:e<=28.4?a=10:e<=32.6?a=11:e<=36.9?a=12:e<=41.4?a=13:e<=46.1?a=14:e<=50.9?a=15:e<=55.9?a=16:e<=61.2?a=17:e>61.2&&(a=18)),a}static douglas(e){let a="Calm";return isNaN(e)||e<=.1?a="Calm":e<=.5?a="Smooth":e<=1.25?a="Slight":e<=2.5?a="Moderate":e<=4?a="Rough":e<=6?a="VeryRough":e<=9?a="High":e<=14?a="VeryHigh":a="Precipitous",a}};const ib="",sd={name:"IdmTropicals",props:{simple:{type:Boolean,default:!1},permission:{type:Number},locale:{type:String},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}},timeZone:{type:Number},token:{type:String},defaultMeteoToken:{type:String},gateway:{type:String,default:"aa"},assistGateway:{type:Array,default:[]},forecastModel:{type:String},realTime:{type:String},beforeLayer:{type:String}},emits:["tropical","tropicalCenterPoints","tropicalProbability","tropicalNotification"],setup(){return{Theme:ye.useTheme()}},data(){return{right:10,toggle:!1,helper:eo.CompanyHelper,tropicals:void 0,tropicalCacheKey:"tropicalCacheGL4",source:"tropicals-source",clusterSource:"tropicals-cluster-source",historyLayer:"tropicals-history-layer",forecastLayer:"tropicals-forecast-layer",forecastModelLayer:"tropicals-forecast-model-layer",forecastNameLayer:"tropicals-forecast-name-layer",pointCircleLayer:"tropicals-point-circle-layer",pointLabelLayer:"tropicals-point-label-layer",historyPointCircleLayer:"history-tropicals-point-circle-layer",historyPointLabelLayer:"history-tropicals-point-label-layer",interpolateData:[],interpolateMarkers:[],interpolateSource:"tropicals-interpolate-source",interpolateLineLayer:"tropicals-interpolate-line-layer",showTropicalsInfo:!1,activeTropicals:void 0,activeTropicalsMarker:void 0,empty:T.featureCollection([]),showLegend:!1,showHoverPoint:!1,hoverPoint:void 0,hoverMarker:void 0}},computed:{hoverLayers(){return[this.forecastNameLayer,this.forecastLayer,this.historyLayer,this.pointCircleLayer,this.pointCircleLayer+"-border",this.historyPointCircleLayer,this.historyPointCircleLayer+"-border",this.historyPointCircleLayer+"-inner"]},clickLayers(){return[this.forecastNameLayer,this.historyLayer]},computeTime(){return(o,e)=>{if(o){const a=v(o).utcOffset(e),r=e<0?e:"+"+e;return`${a==null?void 0:a.format("MMM-DD/HHmm")} (UTC${r}) ${a==null?void 0:a.fromNow()} `}return"-"}},computeTzTime(){return(o,e,a="MM-DD HH:mm")=>{var r,i;if(o){const l=e||0,n=(i=(r=v(o))==null?void 0:r.utcOffset(l))==null?void 0:i.format(a),c=`(UTC ${l>=0?"+":""}${l})`;return n+" "+c}return"-"}},computeTimezone(){return this.timeZone<0?this.timeZone:"+"+this.timeZone},computeBF(){return function(o){const e=la.kts2ms(o);return la.beaufort(e)}},computeMovement(){return function(o){var e,a;return(a=(e=o==null?void 0:o.forecasts)==null?void 0:e.find(r=>!r.disabled))==null?void 0:a.movement}},computePosition(){return o=>!o||o.lng===null||o.lng===void 0||isNaN(o.lng)||o.lat===null||o.lat===void 0||isNaN(o.lat)?"-":M.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty+" / "+M.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},map:{handler(){this.map?(this.toggle=localStorage.getItem(this.tropicalCacheKey)==="true"||!1,localStorage.setItem(this.tropicalCacheKey,this.toggle),this.toggle&&this.fetchTropicals()):this.handleClear()}},showTropicalsInfo:{handler(){this.$emit("tropical",this.showTropicalsInfo),this.simple&&this.showTropicalsInfo?this.$nextTick(()=>{var o,e;this.$parent.playerBottom=((e=(o=this.$refs.tropicalsInfo)==null?void 0:o.$el)==null?void 0:e.clientHeight)+10}):this.simple&&(this.$parent.playerBottom=30)},immediate:!0},"tropicals.version":{handler(){this.handleRefresh()}},timeZone:{handler(o,e){o!==e&&this.handleRefresh()}},realTime:{handler(o){this.map&&o&&this.toggle&&this.handleRender()}},locale:{handler(o){this.map&&this.toggle&&this.handleRefresh()}}},methods:{handleMenuToggle(){var o,e,a;this.toggle=!this.toggle,localStorage.setItem(this.tropicalCacheKey,this.toggle),this.toggle?this.fetchTropicals():(this.handleClear(),(a=(e=(o=this.$parent)==null?void 0:o.$refs)==null?void 0:e.idmBottomBar)==null||a.handleToggle("tropical",!1))},async fetchTropicals(){var i,l,n;const o=new Date().valueOf();let e=0,a=0,r=(i=eo.LayerHelper.WEATHER_LAYERS.find(c=>c.key==="tropicals"))==null?void 0:i.weight;if(r>0){const c=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],s=await ce.get(`${c}/api/arc/weather/layers2/links?l=${r}&v=${this.forecastModel}&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});if(a=new Date().valueOf()-(o+e),console.log("weather links elapsed: ",a,", total: ",e+=a),((l=s==null?void 0:s.data)==null?void 0:l.code)===0){const m=(n=s==null?void 0:s.data)==null?void 0:n.data;await ce.get(m.tropicals,{headers:{Authorization:this.defaultMeteoToken,key:"tropicals"},responseType:/\.(jpg|png)$/.test(m.tropicals)?"blob":"json"}).then(d=>{var y,p,h;const g=M.TropicalHelper.convert2Geojson(((y=d==null?void 0:d.data)==null?void 0:y.data)||(d==null?void 0:d.data));((h=(p=d==null?void 0:d.config)==null?void 0:p.headers)==null?void 0:h.key)&&g&&(this.tropicals={data:g,active:!0,cached:!0,type:"json",etime:s.data.etime,version:Math.random()+1})}).catch(d=>{console.log(`tropicals fetch layer error: ${d}`)})}a=new Date().valueOf()-(o+e),console.log("tropicals elapsed: ",a,", total: ",e+=a)}},handleRefresh(){var e,a;(((a=(e=this.tropicals)==null?void 0:e.data)==null?void 0:a.features)||[]).forEach(r=>{var l,n,c,s,m,d,g,u,y,p,h,f,w,b,L,k,C,A,_;let i="";switch(!0){case(((l=r.properties.wind)==null?void 0:l.kts)<32||((n=r.properties)==null?void 0:n.kts)<32):i="td";break;case(((c=r.properties.wind)==null?void 0:c.kts)<47||((s=r.properties)==null?void 0:s.kts)<47):i="ts";break;case(((m=r.properties.wind)==null?void 0:m.kts)<63||((d=r.properties)==null?void 0:d.kts)<63):i="sts";break;case(((g=r.properties.wind)==null?void 0:g.kts)<79||((u=r.properties)==null?void 0:u.kts)<79):i="ty";break;case(((y=r.properties.wind)==null?void 0:y.kts)<94||((p=r.properties)==null?void 0:p.kts)<94):i="sty";break;case(((h=r.properties.wind)==null?void 0:h.kts)>=94||((f=r.properties)==null?void 0:f.kts)>=94):i="superTy";break;default:i="superTy";break}r.properties.levelI18n=i,((w=r.geometry)==null?void 0:w.type)==="Point"&&((b=r.properties)!=null&&b.important)&&(r.properties.format=(k=(L=v(r.properties.date))==null?void 0:L.utcOffset(this.timeZone))==null?void 0:k.format(`MMM-DD/HHmm [(utc${this.computeTimezone})]`)),((C=r.geometry)==null?void 0:C.type)==="Point"&&(r.properties.Name=((_=(A=r.properties.name)==null?void 0:A.trim())==null?void 0:_.replace(/^./,z=>z.toUpperCase()))||r.properties.nameCn,r.properties.nameCn=r.properties.nameCn||r.properties.Name||"-")}),this.handleInit()},handleInit(){var o,e,a,r,i,l,n,c,s,m,d,g;this.handleClear(),this.tropicals&&this.map&&(this.handleRender(),(o=this.map)==null||o.on("click",this.clickLayers,this.handleClick),(e=this.map)==null||e.on("mousemove",this.hoverLayers,this.handleHover),(a=this.map)==null||a.on("mouseleave",this.hoverLayers,this.handleLeave)),((l=(i=(r=this.tropicals)==null?void 0:r.data)==null?void 0:i.features)==null?void 0:l.length)>0?(s=(c=(n=this.$parent)==null?void 0:n.$refs)==null?void 0:c.idmBottomBar)==null||s.handleToggle("tropical",!0):(g=(d=(m=this.$parent)==null?void 0:m.$refs)==null?void 0:d.idmBottomBar)==null||g.handleToggle("tropical",!1)},handleRender(){var o,e,a,r,i,l,n,c,s,m;if(this.tropicals&&this.map){const d=new Date().valueOf();let g=0,u=0;(o=this.map)!=null&&o.getSource(this.source)?((a=this.map)==null||a.getSource(this.source).setData((e=this.tropicals)!=null&&e.active?this.tropicals.data:this.empty),u=new Date().valueOf()-(d+g),console.log("[tropicals] update elapsed: ",u,", total: ",g+=u)):(this.map.addSource(this.source,{type:"geojson",data:(r=this.tropicals)!=null&&r.active?(i=this.tropicals)==null?void 0:i.data:this.empty}),this.map.addLayer({id:this.historyLayer,type:"line",source:this.source,filter:["all",["==","$type","LineString"],["==","type","history"],["!=","disabled",!0]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["on-surface"],"line-width":3,"line-opacity":.7}},this.beforeLayer),this.map.addLayer({id:this.forecastLayer,type:"line",source:this.source,filter:["all",["==","$type","LineString"],["==","type","forecast"],["!=","disabled",!0]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["match",["get","model"],"cma",this.Theme.current.value.colors["tropicals-cma"],"jma",this.Theme.current.value.colors["tropicals-jma"],"ecmwf",this.Theme.current.value.colors["tropicals-ecmwf"],"ukm",this.Theme.current.value.colors["tropicals-ukm"],"noaa-at",this.Theme.current.value.colors["tropicals-noaa-at"],"noaa-ep",this.Theme.current.value.colors["tropicals-noaa-ep"],this.Theme.current.value.colors["tropicals-noaa-other"]],"line-width":2,"line-opacity":1,"line-dasharray":[1,2]}},this.beforeLayer),this.map.addLayer({id:this.forecastModelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","LineString"],["==","type","forecast"],["!=","disabled",!0]],layout:{"symbol-placement":"line","text-field":"{model}","text-rotation-alignment":"viewport","text-size":12},paint:{"text-color":this.Theme.current.value.dark?"#333":"#fff","text-opacity":1,"text-halo-color":["match",["get","model"],"cma",this.Theme.current.value.colors["tropicals-cma"],"jma",this.Theme.current.value.colors["tropicals-jma"],"ecmwf",this.Theme.current.value.colors["tropicals-ecmwf"],"ukm",this.Theme.current.value.colors["tropicals-ukm"],"noaa-at",this.Theme.current.value.colors["tropicals-noaa-at"],"noaa-ep",this.Theme.current.value.colors["tropicals-noaa-ep"],this.Theme.current.value.colors["tropicals-noaa-other"]],"text-halo-width":4}},this.beforeLayer),u=new Date().valueOf()-(d+g),console.log("[tropical] add elapsed: ",u,", total: ",g+=u)),(l=this.map)!=null&&l.getSource(this.clusterSource)?((c=this.map)==null||c.getSource(this.clusterSource).setData((n=this.tropicals)!=null&&n.active?this.tropicals.data:this.empty),u=new Date().valueOf()-(d+g),console.log("[tropical] update elapsed: ",u,", total: ",g+=u)):(this.map.addSource(this.clusterSource,{type:"geojson",data:(s=this.tropicals)!=null&&s.active?(m=this.tropicals)==null?void 0:m.data:this.empty}),this.map.addLayer({id:this.pointCircleLayer+"-border",type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","forecast"],["!=","disabled",!0]],paint:{"circle-radius":5,"circle-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.pointCircleLayer,type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","forecast"],["!=","disabled",!0]],paint:{"circle-radius":4,"circle-color":["case",["boolean",["==",["get","kts",["get","wind"]],null]],this.Theme.current.value.colors["tropicals-td"],["boolean",["<",["get","kts",["get","wind"]],32]],this.Theme.current.value.colors["tropicals-td"],["boolean",["<",["get","kts",["get","wind"]],47]],this.Theme.current.value.colors["tropicals-ts"],["boolean",["<",["get","kts",["get","wind"]],63]],this.Theme.current.value.colors["tropicals-sts"],["boolean",["<",["get","kts",["get","wind"]],79]],this.Theme.current.value.colors["tropicals-ty"],["boolean",["<",["get","kts",["get","wind"]],94]],this.Theme.current.value.colors["tropicals-sty"],["boolean",[">=",["get","kts",["get","wind"]],94]],this.Theme.current.value.colors["tropicals-super-ty"],"#fff"]}},this.beforeLayer),this.map.addLayer({id:this.pointLabelLayer,type:"symbol",source:this.clusterSource,minzoom:5,filter:["all",["==","$type","Point"],["==","type","forecast"],["!=","disabled",!0]],layout:{"text-field":["get","format"],"text-offset":[1,0],"text-anchor":"left","text-size":10},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.historyPointCircleLayer+"-border",type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],paint:{"circle-radius":6,"circle-color":"#fff"}},this.beforeLayer),this.map.addLayer({id:this.historyPointCircleLayer,type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],paint:{"circle-radius":5,"circle-color":"rgba(0,0,0,0.7)"}},this.beforeLayer),this.map.addLayer({id:this.historyPointCircleLayer+"-inner",type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],paint:{"circle-radius":3,"circle-color":"#fff"}},this.beforeLayer),this.map.addLayer({id:this.historyPointLabelLayer,type:"symbol",source:this.clusterSource,minzoom:5,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],layout:{"text-field":["get","format"],"text-offset":[1,0],"text-anchor":"left","text-size":10},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.forecastNameLayer,type:"symbol",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","forecast"],["==","important",!0]],layout:{"text-field":["get",this.locale==="en"?"Name":"nameCn"],"text-anchor":"bottom","text-size":16,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-font":["DIN Pro Regular","Arial Unicode MS Regular"],"text-offset":[0,2]},paint:{"text-color":this.Theme.current.value.colors["map-blue"],"text-halo-color":"#ffffff","text-halo-width":2}},this.beforeLayer),u=new Date().valueOf()-(d+g),console.log("[tropical] add elapsed: ",u,", total: ",g+=u));const y=M.TropicalHelper.interpolate(this.tropicals,1);this.interpolateData=JSON.parse(JSON.stringify(y)),this.handleDateChange()}},handleClear(){var o,e,a,r;this.map&&(this.map.getLayer(this.historyLayer)&&this.map.removeLayer(this.historyLayer),this.map.getLayer(this.forecastLayer)&&this.map.removeLayer(this.forecastLayer),this.map.getLayer(this.forecastModelLayer)&&this.map.removeLayer(this.forecastModelLayer),this.map.getLayer(this.forecastNameLayer)&&this.map.removeLayer(this.forecastNameLayer),this.map.getLayer(this.pointCircleLayer)&&this.map.removeLayer(this.pointCircleLayer),this.map.getLayer(this.pointCircleLayer+"-border")&&this.map.removeLayer(this.pointCircleLayer+"-border"),this.map.getLayer(this.pointLabelLayer)&&this.map.removeLayer(this.pointLabelLayer),this.map.getLayer(this.historyPointCircleLayer)&&this.map.removeLayer(this.historyPointCircleLayer),this.map.getLayer(this.historyPointCircleLayer+"-border")&&this.map.removeLayer(this.historyPointCircleLayer+"-border"),this.map.getLayer(this.historyPointCircleLayer+"-inner")&&this.map.removeLayer(this.historyPointCircleLayer+"-inner"),this.map.getLayer(this.historyPointLabelLayer)&&this.map.removeLayer(this.historyPointLabelLayer),this.map.getLayer(this.interpolateLineLayer)&&this.map.removeLayer(this.interpolateLineLayer),(o=this.interpolateMarkers)==null||o.forEach(i=>i==null?void 0:i.remove()),this.map.getSource(this.source)&&this.map.removeSource(this.source),this.map.getSource(this.clusterSource)&&this.map.removeSource(this.clusterSource),this.map.getSource(this.interpolateSource)&&this.map.removeSource(this.interpolateSource)),(e=this.map)==null||e.off("click",this.clickLayers,this.handleClick),(a=this.map)==null||a.off("mousemove",this.hoverLayers,this.handleHover),(r=this.map)==null||r.off("mouseleave",this.hoverLayers,this.handleLeave),this.handleCloseInfoMarker()},handleDateChange(){var o,e,a,r,i,l,n,c,s,m,d,g,u,y,p,h,f,w,b,L,k,C,A,_,z,P,V,N,j,U,K,de,ne,S,Z;if((o=this.interpolateMarkers)==null||o.forEach(H=>H==null?void 0:H.remove()),(e=this.interpolateData)!=null&&e.length&&this.tropicals.active){const H=v(this.realTime).utc().set({minute:0,second:0,millisecond:0}),q=this.interpolateData.filter(E=>E.properties.date===(H==null?void 0:H.format())&&!E.properties.disabled),W=this.handleComputePolygons(q),B=T.featureCollection([...q]);W.forEach(E=>{B.features.push(E)}),(a=this.map)!=null&&a.getSource(this.interpolateSource)?(r=this.map)==null||r.getSource(this.interpolateSource).setData(B):((i=this.map)==null||i.addSource(this.interpolateSource,{type:"geojson",data:B}),(l=this.map)==null||l.addLayer({id:this.interpolateLineLayer,type:"line",source:this.interpolateSource,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"line-opacity":1,"line-color":["match",["get","level"],7,this.Theme.current.value.colors["tropicals-r7"],10,this.Theme.current.value.colors["tropicals-r10"],this.Theme.current.value.colors["tropicals-r10"]],"line-width":1}},"empty-layer-3")),this.interpolateMarkers=[];const J=[];for(const E of q)if(!E.properties.disabled){if(!J.some(oe=>{var he;return oe.properties.name===((he=E.properties)==null?void 0:he.name)})){const oe=((c=(n=this.tropicals.data.features.find(he=>{var X;return he.properties.name===((X=E.properties)==null?void 0:X.name)}))==null?void 0:n.properties)==null?void 0:c.nameCn)||((s=E.properties)==null?void 0:s.Name)||"-";E.properties.nameCn=oe,E.properties.Name=((d=(m=E.properties.name)==null?void 0:m.trim())==null?void 0:d.replace(/^./,he=>he.toUpperCase()))||E.properties.nameCn,J.push(E)}let I=this.Theme.current.value.colors["tropicals-ty"];((u=(g=E.properties)==null?void 0:g.wind)==null?void 0:u.kts)<32||!((p=(y=E.properties)==null?void 0:y.wind)!=null&&p.kts)?I=this.Theme.current.value.colors["tropicals-td"]:((f=(h=E.properties)==null?void 0:h.wind)==null?void 0:f.kts)>=32&&((b=(w=E.properties)==null?void 0:w.wind)==null?void 0:b.kts)<47?I=this.Theme.current.value.colors["tropicals-ts"]:((k=(L=E.properties)==null?void 0:L.wind)==null?void 0:k.kts)>=47&&((A=(C=E.properties)==null?void 0:C.wind)==null?void 0:A.kts)<63?I=this.Theme.current.value.colors["tropicals-sts"]:((z=(_=E.properties)==null?void 0:_.wind)==null?void 0:z.kts)>=63&&((V=(P=E.properties)==null?void 0:P.wind)==null?void 0:V.kts)<79?I=this.Theme.current.value.colors["tropicals-ty"]:((j=(N=E.properties)==null?void 0:N.wind)==null?void 0:j.kts)>=79&&((K=(U=E.properties)==null?void 0:U.wind)==null?void 0:K.kts)<94?I=this.Theme.current.value.colors["tropicals-sty"]:((ne=(de=E.properties)==null?void 0:de.wind)==null?void 0:ne.kts)>=94?I=this.Theme.current.value.colors["tropicals-super-ty"]:I=this.Theme.current.value.colors["tropicals-ty"];const ie=`<svg t="1719918955501"
|
|
203
|
+
`,["get","val"],{"font-scale":1}],"text-rotation-alignment":"map","text-line-height":1.3,"text-size":12,"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.theme==="light"?["step",["get","val"],"rgba(0, 0, 0, 0.5)",920,"rgba(0, 0, 0, 0.5)",980,"rgba(0, 0, 0, 0.7)",1100,"rgba(0, 0, 0, 0.7)"]:"rgba(0,0,0,1)","text-halo-color":["step",["get","val"],"rgba(162,13,2,1)",920,"rgba(255, 96, 98, 1)",980,"rgba(255, 246, 184, 1)",1100,"rgba(199,171,250,1)"],"text-halo-width":1}},this.beforeLayer),l=new Date().valueOf()-(r+i),console.log("[prmsl] add elapsed: ",l,", total: ",i+=l))}},handleClear(){this.map.getLayer(this.pointLabelLayer)&&this.map.removeLayer(this.pointLabelLayer),this.map.getLayer(this.labelLayer)&&this.map.removeLayer(this.labelLayer),this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Wc(o,e,a,r,i,l){return null}const Zc=Q(jc,[["render",Wc]]),K1="",Xc={name:"IdmIceEdge",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[ice-edge] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(86, 169, 230, 0)"],[1/255,"rgba(86, 169, 230, 0)"],[25/255,"rgba(86, 169, 230, 1)"],[25/255,"rgba(47, 226, 155, 1)"],[100/255,"rgba(47, 226, 155, 1)"],[100/255,"rgba(213, 253, 37, 1)"],[175/255,"rgba(213, 253, 37, 1)"],[175/255,"rgba(230, 176, 39, 1)"],[225/255,"rgba(230, 176, 39, 1)"],[225/255,"rgba(230, 84, 39, 1)"],[250/255,"rgba(230, 84, 39, 1)"],[1,"rgba(230, 84, 39, 1)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},Hc={key:0};function Oc(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",Hc,[t.createElementVNode("div",{class:"legend-bars-gl4 ice-edge",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",{style:{color:"rgba(var(--v-theme-black), 0.7)"}},"%",-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,"10",-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,"40",-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,"70",-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,"90",-1),t.createElementVNode("span",null,null,-1)]),4)])):t.createCommentVNode("",!0)}const Yc=Q(Xc,[["render",Oc]]),Q1="",Uc={name:"IdmCover",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[ice-cover] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(68, 1, 84, 0)"],[1/255,"rgba(63, 72, 137, 0)"],[50/255,"rgba(53, 125, 177, 1)"],[100/255,"rgba(33, 145, 140, 1)"],[150/255,"rgba(45, 178, 125, 1)"],[200/255,"rgba(112, 207, 87, 1)"],[250/255,"rgba(253, 231, 37, 0.8)"],[1,"rgba(253, 231, 37, 1)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},Jc={key:0};function Kc(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",Jc,[t.createElementVNode("div",{class:"legend-bars-gl4 ice-cover",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"%",-1),t.createElementVNode("span",null,"20",-1),t.createElementVNode("span",null,"40",-1),t.createElementVNode("span",null,"60",-1),t.createElementVNode("span",null,"80",-1),t.createElementVNode("span",null,"100",-1)]),4)])):t.createCommentVNode("",!0)}const Qc=Q(Uc,[["render",Kc],["__scopeId","data-v-3d1a7675"]]),q1="",qc={name:"IdmThickness",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},menuToggle:{type:Object},bottom:{type:String,default:"70px"}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[ice-thickness] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(4, 6, 19, 0)"],[1/255,"rgba(4, 6, 19, 0)"],[20/255,"rgba(51, 50, 102, 1)"],[40/255,"rgba(63, 82, 158, 1)"],[50/255,"rgba(66, 123, 183, 1)"],[60/255,"rgba(92, 161, 197, 1)"],[80/255,"rgba(134, 199, 212, 0.7)"],[100/255,"rgba(134, 199, 212, 1)"],[150/255,"rgba(234, 253, 2536, 0.8)"],[250/255,"rgba(234, 253, 2536, 0.9)"],[1,"rgba(234, 253, 2536, 1)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},$c={key:0};function em(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",$c,[t.createElementVNode("div",{class:"legend-bars-gl4 ice-thickness",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"m",-1),t.createElementVNode("span",null,"0",-1),t.createElementVNode("span",null,"0.6",-1),t.createElementVNode("span",null,"1",-1),t.createElementVNode("span",null,"1.5",-1),t.createElementVNode("span",null,"2",-1),t.createElementVNode("span",null,"3",-1)]),4)])):t.createCommentVNode("",!0)}const tm=Q(qc,[["render",em]]),$1="",om={name:"IdmPrecip3h",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},deeimmediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[precip3h] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(59, 126, 162, 0)"],[14/255,"rgba(84,170,230, 0)"],[15/255,"rgba(172, 210, 255, 0.8)"],[20/255,"rgba(51,202,248,0.8)"],[30/255,"rgba(3,248,103,0.8)"],[49/255,"rgba(14,201,3,0.8)"],[57/255,"rgba(190,226,2,0.8)"],[73/255,"rgba(248,1,1,0.8)"],[82/255,"rgba(197,5,58,0.8)"],[1,"rgba(197,5,58,0.8)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},am={key:0};function im(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",am,[t.createElementVNode("div",{class:"legend-bars-gl4 precip3h",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"mm",-1),t.createElementVNode("span",null,"1.5",-1),t.createElementVNode("span",null,"2",-1),t.createElementVNode("span",null,"3",-1),t.createElementVNode("span",null,"7",-1),t.createElementVNode("span",null,"10",-1),t.createElementVNode("span",null,"20",-1),t.createElementVNode("span",null,"30",-1)]),4)])):t.createCommentVNode("",!0)}const rm=Q(om,[["render",im]]),eb="",lm={name:"IdmVisibility",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{right:10,program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[visibility] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(189,50,160,0.8)"],[8/255,"rgba(208,56,56,0.8)"],[27/255,"rgba(190,226,2,0.8)"],[60/255,"rgba(3,236,118,0.8)"],[160/255,"rgba(172, 210,255,0.8)"],[161/255,"rgba(172, 210,255,0)"],[1,"rgba(144,144,144,0)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},nm={key:0};function sm(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",nm,[t.createElementVNode("div",{class:"legend-bars-gl4 visibility",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"nm",-1),t.createElementVNode("span",null,"0",-1),t.createElementVNode("span",null,"0.5",-1),t.createElementVNode("span",null,"1.5",-1),t.createElementVNode("span",null,"3",-1),t.createElementVNode("span",null,"9",-1)]),4)])):t.createCommentVNode("",!0)}const cm=Q(lm,[["render",sm]]),tb="",mm={name:"IdmWaterTemp",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[water-temp] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(95, 143, 197)"],[46/255,"rgba(95, 143, 197)"],[69/255,"rgb(80, 140, 62)"],[92/255,"rgb(121, 146, 28)"],[115/255,"rgb(171, 161, 14)"],[138/255,"rgb(223, 177, 69)"],[161/255,"rgb(243, 150, 6)"],[184/255,"rgb(236, 95, 21)"],[207/255,"rgb(190, 65, 18)"],[230/255,"rgb(138, 43, 10)"],[1,"rgb(138, 43, 10)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},dm={key:0};function hm(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",dm,[t.createElementVNode("div",{class:"legend-bars-gl4 water-temp",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"°C",-1),t.createElementVNode("span",null,"0",-1),t.createElementVNode("span",null,"10",-1),t.createElementVNode("span",null,"20",-1),t.createElementVNode("span",null,"30",-1),t.createElementVNode("span",null,"40",-1)]),4)])):t.createCommentVNode("",!0)}const pm=Q(mm,[["render",hm]]),ob="",gm={name:"IdmTemp",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0;this.handleDraw(),new Date().valueOf()-(o+e)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgb(149, 137, 211)"],[100/255,"rgb(149, 137, 211)"],[110/255,"rgb(150, 209, 216)"],[120/255,"rgb(129, 204, 197)"],[130/255,"rgb(103, 180, 186)"],[140/255,"rgb(95, 143, 197)"],[150/255,"rgb(80, 140, 62)"],[160/255,"rgb(121, 146, 28)"],[170/255,"rgb(171, 161, 14)"],[180/255,"rgb(223, 177, 6)"],[190/255,"rgb(243, 150, 6)"],[200/255,"rgb(236, 95, 21)"],[210/255,"rgb(190, 65, 18)"],[220/255,"rgb(138, 43, 10)"],[1,"rgb(138, 43, 10)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},um={key:0};function fm(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",um,[t.createElementVNode("div",{class:"legend-bars-gl4 temp",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"°C",-1),t.createElementVNode("span",null,"-20",-1),t.createElementVNode("span",null,"-10",-1),t.createElementVNode("span",null,"0",-1),t.createElementVNode("span",null,"10",-1),t.createElementVNode("span",null,"20",-1),t.createElementVNode("span",null,"30",-1),t.createElementVNode("span",null,"40",-1)]),4)])):t.createCommentVNode("",!0)}const ym=Q(gm,[["render",fm]]),ab="",bm={name:"IdmGlLayer",components:{IdmWindBarb:bc,IdmWindParticle:Ac,IdmCurrentDirection:vc,IdmCurrentParticle:Nc,IdmWave:Tc,IdmSigWaveHeight:Rc,IdmSwell:Gc,IdmPrmsl:Zc,IdmIceEdge:Yc,IdmIceCover:Qc,IdmIceThickness:tm,IdmPrecip3h:rm,IdmVisibility:cm,IdmWaterTemp:pm,IdmTemp:ym},props:{simple:{type:Boolean,default:!1},isLogin:{type:Boolean,default:!1},theme:{type:String},map:{type:Object},mapFeather:{type:String},gateway:{type:String},assistGateway:{type:Array,default:[]},defaultMeteoToken:{type:String},top:{type:Number,default:0},paddingTop:{type:Number,default:8},menuHeight:{type:Number,default:248},menuToggle:{type:Object,default:{}},realTime:{type:String},forecastModel:{type:String},beforeLayer:{type:String},platform:{type:String}},emits:["forecastModel","menuToggle","weatherCheckList","autoActive","weatherRendered"],data(){return{right:10,toggle:!1,autoActive:!0,weatherWeight:0,allLayers:[...eo.LayerHelper.WEATHER_LAYERS],tagLayers:[...eo.LayerHelper.WEATHER_LAYERS.filter(o=>!o.hide)],checkList:[],renderKey:"",iceToggleValue:void 0,waveToggleValue:void 0,weatherLayers:{},activeWeatherLayers:[],cache:{v:"0.0.1",versionKey:"weatherLayerCacheVersionGL4",autoActiveKey:"autoActiveCacheGL4",checkListKey:"weatherCheckListCacheGL4"},models:{},currentModel:localStorage.getItem("forecastModelCacheGL4")==="GFS"?"GFS":"ECMWF",zoom:6,viewport:void 0,particleFactor:void 0,showWindParticle:!0,showCurrentParticle:!0,legendToggle:!1,legend:{barbs:[2,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,0],current:[{label:"0-0.5 kts",size:.3,color:"rgb(58, 164, 58)"},{label:"0.5-1 kts",size:.4,color:"#ffff00"},{label:"1-1.5 kts",size:.6,color:"#ff9500"},{label:"1.5-2 kts",size:.8,color:"#f44336"},{label:">= 2 kts",size:1,color:"#e4711e"}],sigWaveHeight:[{label:"< 2 m",color:"rgba(0,235,156,0)"},{label:"2-3 m",color:"rgba(0,235,156,0.4)"},{label:"3-4 m",color:"#ffed00"},{label:"4-5 m",color:"#ff9800"},{label:"5-6 m",color:"#f77800"},{label:"6-7 m",color:"#e4711e"},{label:"7-8 m",color:"#e06128"},{label:"8-9 m",color:"#dc5132"},{label:"9-10 m",color:"#d5453c"},{label:"10-12 m",color:"#cd3a46"},{label:"12-14 m",color:"#be2c50"},{label:"> 14 m",color:"#aa1a5a"}]}}},computed:{listStyle(){return this.simple?{top:this.top+"px",left:this.toggle?"0px":"-280px",height:"calc(100vh - "+this.top+"px)"}:{top:this.top+"px",right:this.toggle?"0px":"-280px",height:"calc(100vh - "+this.top+"px)"}},computeDateZ(){return function(o){var e;if(o){const a=v(o);return`${(e=a==null?void 0:a.utc())==null?void 0:e.format("MMM-DD/HHmm")}Z`}return"-"}},computeDateUpdate(){return function(o){return o?v(o).fromNow():"-"}},overlaysKeys(){return this.tagLayers.filter(o=>o.overlays).map(o=>o.key)},rendersKeys(){return this.allLayers.filter(o=>!o.overlays&&o.enabled).map(o=>o.key)},showTipMenu(){return this.checkList.includes("wind")||this.checkList.includes("current-direction")||this.checkList.includes("sig-wave-height")},barbsIconName(){var e,a,r;const o=[];for(let i=0;i<((a=(e=this.legend)==null?void 0:e.barbs)==null?void 0:a.length);i++){const l=((r=this.legend)==null?void 0:r.barbs[i])||0,n=l<10?`00${l}kts`:l<100?`0${l}kts`:`${l}kts`;o.push("icon-a-"+n)}return o},lengendTipTop(){return this.platform==="ops"?this.top+this.menuHeight+232:this.top+this.menuHeight+142}},watch:{"menuToggle.v":{handler(){this.toggle=this.menuToggle.weatherLayers,this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})}},currentModel:{handler(o,e){this.$emit("forecastModel",o),localStorage.setItem("forecastModelCacheGL4",o)},immediate:!0},forecastModel:{handler(o,e){o&&o!==e&&this.handleWeatherLayerChange({sourceChanged:!0})}},map:{handler(){const o=this.map;o&&(this.viewport=new Mo(o),o.once("idle",()=>{this.map===o&&(this.fetchCache(),o.on("move",this.handleMove4Weather),this.handleRampColorInitial())}),o.triggerRepaint())},immediate:!0},realTime:{handler(o,e){o&&e&&v(o).utc().format("yyyy-MM-DD HH")!==v(e).utc().format("yyyy-MM-DD HH")&&this.$nextTick(()=>{this.fetchWeatherLayers()})},immediate:!0},renderKey:{handler(o,e){if(o&&o!==e){const a=this.checkList.filter(r=>!this.rendersKeys.some(i=>i===r));o==="wave-group"?(this.waveToggleValue=this.waveToggleValue||"sig-wave",this.checkList=[...a,"wave-group",this.waveToggleValue]):o==="ice-forecast"?(this.iceToggleValue=this.iceToggleValue||"ice-cover",this.checkList=[...a,"ice-forecast",this.iceToggleValue||"ice-cover"]):this.checkList=[...a,o]}else!o&&e&&(this.checkList=this.checkList.filter(a=>a!==e))}},checkList:{handler(o,e){var a,r,i,l,n,c;this.handleCheckListChange(o,e),this.$emit("weatherCheckList",o),this.autoActive&&this.checkList.length?(i=(r=(a=this.$parent)==null?void 0:a.$refs)==null?void 0:r.idmBottomBar)==null||i.handleToggle("weather",!0):(c=(n=(l=this.$parent)==null?void 0:l.$refs)==null?void 0:n.idmBottomBar)==null||c.handleToggle("weather",!1)}},autoActive:{handler(o){var e,a,r,i,l,n;localStorage.setItem(this.cache.autoActiveKey,this.autoActive),this.activeWeatherLayers=this.autoActive?this.allLayers.filter(c=>this.checkList.includes(c.key)):[],this.handleWeatherLayerChange(),this.autoActive&&this.checkList.length?(r=(a=(e=this.$parent)==null?void 0:e.$refs)==null?void 0:a.idmBottomBar)==null||r.handleToggle("weather",!0):(n=(l=(i=this.$parent)==null?void 0:i.$refs)==null?void 0:l.idmBottomBar)==null||n.handleToggle("weather",!1),this.$emit("autoActive",this.autoActive)}},iceToggleValue:{handler(o){if(o){const e=this.checkList.filter(a=>!this.rendersKeys.some(r=>r===a));this.checkList=[...e,"ice-forecast",this.iceToggleValue]}}},waveToggleValue:{handler(o){if(o){const e=this.checkList.filter(a=>!this.rendersKeys.some(r=>r===a));this.checkList=[...e,"wave-group",this.waveToggleValue]}}},showWindParticle:{handler(o){let e="wind-particle";this.weatherLayers[e]&&(this.weatherLayers[e].particle=o,this.weatherLayers[e].version=Math.random()+1)}},showCurrentParticle:{handler(o){let e="current-particle";this.weatherLayers[e]&&(this.weatherLayers[e].particle=o,this.weatherLayers[e].version=Math.random()+1)}},isLogin:{handler(o){o?this.fetchModels():this.models={}},immediate:!0}},mounted(){this.fetchModels()},methods:{arraysEqual(o,e){if((o==null?void 0:o.length)!==(e==null?void 0:e.length))return!1;for(let a=0;a<(o==null?void 0:o.length);a++)if((o==null?void 0:o[a])!==(e==null?void 0:e[a]))return!1;return!0},fetchCache(){var a,r;const o=localStorage.getItem(this.cache.versionKey);this.cache.v!==o&&(localStorage.removeItem(this.cache.autoActiveKey),localStorage.removeItem(this.cache.checkListKey),localStorage.setItem(this.cache.versionKey,this.cache.v));let e=localStorage.getItem(this.cache.autoActiveKey);this.autoActive=e!=="false",localStorage.setItem(this.cache.autoActiveKey,this.autoActive),e=localStorage.getItem(this.cache.checkListKey),this.waveToggleValue=(a=JSON.parse(e))!=null&&a.some(i=>i==="swell")?"swell":void 0,this.iceToggleValue=(r=JSON.parse(e))!=null&&r.some(i=>i==="ice-thickness")?"ice-thickness":void 0,this.checkList=JSON.parse(e||JSON.stringify(["wind","sig-wave-height"])),this.checkList.find(i=>this.rendersKeys.includes(i))&&(this.renderKey=this.checkList.find(i=>this.rendersKeys.includes(i))),localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList))},handleMenuToggle(){this.$emit("menuToggle","weatherLayers")},handleFastWeatherToggle(o){let e=[];this.checkList.includes(o)?e=this.checkList.filter(a=>a!==o):(e=[...this.checkList,o],this.checkList=e),this.handleCheckListChange(e,this.checkList)},handleCheckListChange(o,e){if(this.arraysEqual(o,e))return this.handleMove4Weather(),!1;const a=[...new Set(o)],r=a==null?void 0:a.filter(n=>!(e!=null&&e.includes(n)))[0],i=e==null?void 0:e.filter(n=>!(a!=null&&a.includes(n)))[0],l=this.checkList.filter(n=>!this.rendersKeys.some(c=>c===n));if(r)if(r==="ice-cover"||r==="ice-thickness"||r==="ice-forecast")this.checkList=[...l,"ice-forecast",this.iceToggleValue||"ice-cover"],this.iceToggleValue=this.iceToggleValue||"ice-cover";else if(r==="sig-wave"||r==="swell"||r==="wave-group")this.checkList=[...l,"wave-group",this.waveToggleValue||"sig-wave"],this.waveToggleValue=this.waveToggleValue||"sig-wave";else if(this.rendersKeys.includes(r))this.checkList=[...l,r];else{const n=a.filter(s=>!this.rendersKeys.includes(s)),c=this.checkList.filter(s=>this.rendersKeys.includes(s));this.checkList=[...n,...c]}i&&(i==="ice-forecast"?(this.checkList=a.filter(n=>!["ice-cover","ice-thickness","ice-forecast"].includes(n)),this.iceToggleValue=void 0):i==="wave-group"?(this.checkList=a.filter(n=>!["wave-group","sig-wave","swell"].includes(n)),this.waveToggleValue=void 0):this.checkList=a),this.checkList.includes("wind-particle")&&!(e!=null&&e.includes("wind-particle"))&&(this.showWindParticle=!0),this.checkList.includes("current-particle")&&!(e!=null&&e.includes("current-particle"))&&(this.showCurrentParticle=!0),localStorage.setItem(this.cache.checkListKey,JSON.stringify(a)),this.activeWeatherLayers=this.autoActive?this.allLayers.filter(n=>a.includes(n.key)):[],this.handleWeatherLayerChange()},async fetchModels(){this.models={};const o=await ce.get(`${this.gateway}/api/arc/meteo2/models2`,{headers:{Authorization:this.defaultMeteoToken}});(o==null?void 0:o.data.code)===0&&(this.models=o==null?void 0:o.data.data)},async fetchWeatherLayers(o={}){var r,i,l,n,c,s,m,d,g;const e=new Date().valueOf();let a=0;if(this.map){const u=((r=this.map)==null?void 0:r.getZoom())+1,y=(i=this.map)==null?void 0:i.getBounds(),p=`${y._sw.lng},${y._sw.lat},${y._ne.lng},${y._ne.lat}`;if(this.particleFactor&&((l=this.$refs.layer)!=null&&l.autoActive)){const h=eo.LayerHelper.WEATHER_LAYERS.find(f=>{var w;return((w=f.peer)==null?void 0:w.weight)===this.particleFactor.weight});this.particleFactor.particle&&(this.showWindParticle||this.showCurrentParticle)?this.weatherWeight=this.weatherWeight&h.weight?this.weatherWeight:this.weatherWeight+h.weight:this.weatherWeight=this.weatherWeight&h.weight?this.weatherWeight-h.weight:this.weatherWeight}if(this.weatherWeight>0){let h=this.weatherWeight;if(h>0){const f=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],w=await ce.get(`${f}/api/arc/weather/layers2/links?l=${h}&v=${this.forecastModel}&z=${u}&bbox=${p}&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});if(new Date().valueOf()-(e+a),((n=w==null?void 0:w.data)==null?void 0:n.code)===0){const b=(c=w==null?void 0:w.data)==null?void 0:c.data,L=[];for(const C in b)L.push(ce.get(b[C],{headers:{Authorization:this.defaultMeteoToken,key:C},responseType:/\.(jpg|png)$/.test(b[C])?"blob":"json"}).catch(A=>{console.log(`[${C}] fetch layer error: ${A}`)}));const k=await Promise.all(L);this.weatherLayers={},k.map(C=>{var z,P,V,N;const A=((z=C==null?void 0:C.data)==null?void 0:z.data)||(C==null?void 0:C.data);let _=(V=(P=C==null?void 0:C.config)==null?void 0:P.headers)==null?void 0:V.key;_&&A&&(this.weatherLayers[_]={raw:A,type:((N=C==null?void 0:C.config)==null?void 0:N.responseType)==="blob"?"image":"json",etime:w.data.etime})})}if(new Date().valueOf()-(e+a),this.weatherLayers["swell-direction"]||this.weatherLayers["swell-height"]){const b=(s=this.weatherLayers["swell-direction"])==null?void 0:s.raw,L=(m=this.weatherLayers["swell-height"])==null?void 0:m.raw;delete this.weatherLayers["swell-direction"],delete this.weatherLayers["swell-height"],this.weatherLayers.swell={type:"json",direction:b,height:{raw:L},etime:w.data.etime}}if(this.weatherLayers["current-direction"]||this.weatherLayers["current-speed"]){const b=(d=this.weatherLayers["current-direction"])==null?void 0:d.raw,L=(g=this.weatherLayers["current-speed"])==null?void 0:g.raw;delete this.weatherLayers["current-direction"],delete this.weatherLayers["current-speed"],this.weatherLayers.current={type:"json",direction:b,speed:{raw:L},etime:w.data.etime}}}}this.handleWeatherLayerToggle(),this.handleDrawWeather4Json(),this.$nextTick(()=>{var h,f,w,b,L;(L=(b=(w=(f=(h=this.$parent)==null?void 0:h.$refs)==null?void 0:f.idmBottomBar)==null?void 0:w.$refs)==null?void 0:b.capture)==null||L.captureCurrentFrame()})}},handleWeatherLayerToggle(){for(const o in this.weatherLayers)this.weatherLayers[o].active=!1,this.weatherLayers[o].version=Math.random()+1;for(const o of this.activeWeatherLayers){let e=o.key;e==="current-direction"&&(e="current"),this.weatherLayers[e]&&(this.weatherLayers[e].active=!0,this.weatherLayers[e].version=Math.random()+1,e==="wind-particle"&&(this.weatherLayers[e].particle=this.showWindParticle),e==="current-particle"&&(this.weatherLayers[e].particle=this.showCurrentParticle))}},handleWeatherLayerChange(o={sourceChanged:!1}){var a;const e=(a=this.activeWeatherLayers)==null?void 0:a.reduce((r,i)=>r+(r&(i==null?void 0:i.weight)?0:i==null?void 0:i.weight),0);o!=null&&o.sourceChanged||this.weatherWeight!==e?(this.weatherWeight=e,this.fetchWeatherLayers()):this.handleWeatherLayerToggle()},handleRampColorInitial(){var o,e,a,r,i,l,n,c,s,m,d,g;this.viewport.map.getSource((o=this.viewport)==null?void 0:o.rampColorSource)||this.viewport.map.addSource((e=this.viewport)==null?void 0:e.rampColorSource,{type:"canvas",canvas:(a=this.viewport)==null?void 0:a.rampColorCanvas,animate:!0,coordinates:this.viewport.getBoundLngLat()}),this.viewport.map.getLayer((r=this.viewport)==null?void 0:r.rampColorLayer)||this.viewport.map.addLayer({type:"raster",id:(i=this.viewport)==null?void 0:i.rampColorLayer,source:(l=this.viewport)==null?void 0:l.rampColorSource,layout:{visibility:"none"},paint:{"raster-fade-duration":0}},this.beforeLayer),this.viewport.map.getSource((n=this.viewport)==null?void 0:n.particleSource)||this.viewport.map.addSource((c=this.viewport)==null?void 0:c.particleSource,{type:"canvas",canvas:(s=this.viewport)==null?void 0:s.particleCanvas,animate:!0,coordinates:this.viewport.getBoundLngLat()}),this.viewport.map.getLayer((m=this.viewport)==null?void 0:m.particleLayer)||this.viewport.map.addLayer({type:"raster",id:(d=this.viewport)==null?void 0:d.particleLayer,source:(g=this.viewport)==null?void 0:g.particleSource,layout:{visibility:"none"},paint:{"raster-fade-duration":0}},this.beforeLayer)},handleDrawWeather4Json(){var i,l,n,c,s,m,d;const o=new Date().valueOf();let e=0;const a=(i=this.map)==null?void 0:i.getBounds(),r=(l=this.map)==null?void 0:l.getZoom();if(a&&r){const g=M.LngLatHelper.convertToStdLng(a._sw.lng),u=M.LngLatHelper.convertToStdLng(a._ne.lng),y=Math.floor(a._sw.lat),p=Math.ceil(a._ne.lat);for(const h in this.weatherLayers){let f=!1;if(this.weatherLayers[h].active&&this.weatherLayers[h].type==="json"){let w=[];if(h==="swell"){f=!0;const b=((n=this.weatherLayers[h])==null?void 0:n.direction)||{};for(const k in b)if(k>y&&k<p&&(!(r<=this.zoom)||k%(r<2?10:r<4?5:3)===0)){const C=b[k].lng;g>u?C.forEach((A,_)=>{var z,P,V,N,j,U;if(r<2){if((A>=0&&A<=360||A>=-360&&A<=0)&&A%10===0){const K=T.point([A,k],{val:((z=b[k].val)==null?void 0:z[_])||((P=b[k].dir)==null?void 0:P[_]),spd:(V=b[k].spd)==null?void 0:V[_]});w.push(K)}}else if((A>=g&&A<=180||A>=-180&&A<=u)&&(!(r<=this.zoom)||A%(r<2?10:r<4?5:3)===0)){const K=T.point([A,k],{val:((N=b[k].val)==null?void 0:N[_])||((j=b[k].dir)==null?void 0:j[_]),spd:(U=b[k].spd)==null?void 0:U[_]});w.push(K)}}):C.forEach((A,_)=>{var z,P,V,N,j,U;if(g<2){if((A>=0&&A<=360||A>=-360&&A<=0)&&A%10===0){const K=T.point([A,k],{val:((z=b[k].val)==null?void 0:z[_])||((P=b[k].dir)==null?void 0:P[_]),spd:(V=b[k].spd)==null?void 0:V[_]});w.push(K)}}else if(A>=g&&A<=u&&(!(r<=this.zoom)||A%(r<2?10:r<4?5:3)===0)){const K=T.point([A,k],{val:((N=b[k].val)==null?void 0:N[_])||((j=b[k].dir)==null?void 0:j[_]),spd:(U=b[k].spd)==null?void 0:U[_]});w.push(K)}})}new Date().valueOf()-(o+e);const L=this.weatherLayers[h].height;if(L){if(!L.data){const k=[];for(const C in(c=L.raw)==null?void 0:c.LineString){const A=L.raw.LineString[C];for(const _ of A)k.push(T.lineString(_,{val:Number(C)}));L.data=T.featureCollection(k)}}if(L.data){const k=this.handleBboxClip(L.data,a);w=w.concat(k)}new Date().valueOf()-(o+e)}}else if(h==="current"){f=!0;const b=((s=this.weatherLayers[h])==null?void 0:s.direction)||{};for(const k in b)if(k>y&&k<p&&(!(r<=this.zoom)||k%(r<2?10:r<4?5:3)===0)){const C=b[k].lng;g>u?C.forEach((A,_)=>{var z,P,V,N,j,U;if(r<2){if((A>=0&&A<=360||A>=-360&&A<=0)&&A%10===0){const K=T.point([A,k],{val:((z=b[k].val)==null?void 0:z[_])||((P=b[k].dir)==null?void 0:P[_]),spd:(V=b[k].spd)==null?void 0:V[_]});w.push(K)}}else if((A>=g&&A<=180||A>=-180&&A<=u)&&(!(r<=this.zoom)||A%(r<2?10:r<4?5:3)===0)){const K=T.point([A,k],{val:((N=b[k].val)==null?void 0:N[_])||((j=b[k].dir)==null?void 0:j[_]),spd:(U=b[k].spd)==null?void 0:U[_]});w.push(K)}}):C.forEach((A,_)=>{var z,P,V,N,j,U;if(g<2){if((A>=0&&A<=360||A>=-360&&A<=0)&&A%10===0){const K=T.point([A,k],{val:((z=b[k].val)==null?void 0:z[_])||((P=b[k].dir)==null?void 0:P[_]),spd:(V=b[k].spd)==null?void 0:V[_]});w.push(K)}}else if(A>=g&&A<=u&&(!(r<=this.zoom)||A%(r<this.zoom/2?5:3)===0)){const K=T.point([A,k],{val:((N=b[k].val)==null?void 0:N[_])||((j=b[k].dir)==null?void 0:j[_]),spd:(U=b[k].spd)==null?void 0:U[_]});w.push(K)}})}new Date().valueOf()-(o+e);const L=this.weatherLayers[h].speed;if(L){if(!L.data){const C=[];for(const A in(m=L.raw)==null?void 0:m.Polygon){const _=L.raw.Polygon[A];for(const z of _)C.push(T.polygon(z,{val:Number(A)}))}L.data=T.featureCollection(C)}const k=r<this.zoom?L.data.features.filter(C=>C.properties.val>.5):L.data.features;w=w.concat(k),new Date().valueOf()-(o+e)}}else if(h==="wind"){f=!0;const b=this.weatherLayers.wind.raw;for(const L in b)if(L>y&&L<p&&(!(r<=this.zoom)||L%(r<2?10:r<4?5:3)===0)){const k=b[L].lng;g>u?k.forEach((C,A)=>{var _,z,P,V;if(r<2){if((C>=0&&C<=360||C>=-360&&C<=0)&&C%10===0){const N=T.point([C,L],{dir:((_=b[L].val)==null?void 0:_[A])||((z=b[L].dir)==null?void 0:z[A]),spd:b[L].spd[A]});w.push(N)}}else if((C>=g&&C<=180||C>=-180&&C<=u)&&(!(r<=this.zoom)||C%(r<2?10:r<4?5:3)===0)){const N=T.point([C,L],{dir:((P=b[L].val)==null?void 0:P[A])||((V=b[L].dir)==null?void 0:V[A]),spd:b[L].spd[A]});w.push(N)}}):k.forEach((C,A)=>{var _,z,P,V;if(r<2){if((C>=0&&C<=360||C>=-360&&C<=0)&&C%10===0){const N=T.point([C,L],{dir:((_=b[L].val)==null?void 0:_[A])||((z=b[L].dir)==null?void 0:z[A]),spd:b[L].spd[A]});w.push(N)}}else if(C>=g&&C<=u&&(!(r<=this.zoom)||C%(r<2?10:r<4?5:3)===0)){const N=T.point([C,L],{dir:((P=b[L].val)==null?void 0:P[A])||((V=b[L].dir)==null?void 0:V[A]),spd:b[L].spd[A]});w.push(N)}})}new Date().valueOf()-(o+e)}else if(h==="sig-wave-height"){if(this.weatherLayers[h].data)w=this.weatherLayers[h].data;else{f=!0;const b=this.weatherLayers[h].raw;if(b){const L=[];for(const k in b.Polygon){const C=b.Polygon[k];for(const A of C)L.push(T.polygon(A,{val:Number(k)}))}for(const k in b.MultiPolygon){const C=b.MultiPolygon[k];for(const A of C)L.push(T.multiPolygon(A,{val:Number(k)}))}for(const k in b.Point){const C=b.Point[k];for(let A=0;A<((d=C.lng)==null?void 0:d.length);A++)L.push(T.point([C.lng[A],k],{val:Number(C.val[A])}))}w=w.concat(L)}}new Date().valueOf()-(o+e)}else if(h==="prmsl"){if(this.weatherLayers[h].data)w=this.weatherLayers[h].data;else{f=!0;const b=this.weatherLayers[h].raw;if(b){const L=[];for(const k in b.LineString){const C=b.LineString[k];for(const A of C)L.push(T.lineString(A,{val:Number(k)}))}for(const k in b.Point)b.Point[k].lng.forEach((C,A)=>{C=M.LngLatHelper.convertToStdLng(C),L.push(T.point([C,k],{val:b.Point[k].val[A],type:b.Point[k].type[A]}))});w=w.concat(L)}}new Date().valueOf()-(o+e)}w.length&&(this.weatherLayers[h].data=T.featureCollection(w)),f&&(this.weatherLayers[h].version=Math.random()+1)}}}},handleMove4Weather(){for(const o in this.weatherLayers)this.weatherLayers[o].active&&this.weatherLayers[o].type==="image"&&(this.weatherLayers[o].active=!0,this.weatherLayers[o].version=Math.random()+1);this.handleDrawWeather4Json()},handleBboxClip(o,e){const a=[],r=M.LngLatHelper.convertToStdLng(e._sw.lng),i=M.LngLatHelper.convertToStdLng(e._ne.lng);return o.features.forEach(l=>{if(l.geometry.type!=="Point")if(r>i){let n=[r,e._sw.lat,180,e._ne.lat],c=T.bboxClip(l,n);c.geometry.coordinates.length&&a.push(c),n=[-180,e._sw.lat,i,e._ne.lat],c=T.bboxClip(l,n),c.geometry.coordinates.length&&a.push(c)}else{const n=[r,e._sw.lat,i,e._ne.lat],c=T.bboxClip(l,n);c.geometry.coordinates.length&&a.push(c)}else a.push(l)}),a}}},wm={class:"idm-gl4-meteo-layers"},xm={key:0,class:"legend-tip-btn-gl4"},km={class:"d-flex flex-row justify-start align-center flex-wrap text-body-2"},Am={class:"d-flex flex-row justify-center align-center"},Lm={class:"text-caption"},Cm={class:"d-flex flex-row justify-start align-center flex-wrap text-body-2"},vm={class:"d-flex flex-row justify-center align-center"},zm={key:0,style:{width:"24px",height:"12px",border:"1px solid rgba(var(--v-border-color), var(--v-border-opacity))"}},_m={class:"text-caption px-2"},Sm={class:"d-flex flex-row justify-start align-start flex-wrap text-body-2 ml-n1"},Nm={class:"d-flex flex-row justify-start align-center"},Mm={class:"d-flex flex-row justify-center align-center",style:{width:"40px"}},Pm={class:"text-caption"},Vm={class:"d-flex justify-start align-center ga-3"},Tm={class:"text-h5 font-weight-medium"},Em={key:0,class:"w-100 d-flex justify-space-between align-center ga-1 mb-2 px-3"},Dm={key:0,class:"d-flex justify-start align-center ga-4 pl-6"},Rm={key:1,class:"d-flex justify-start align-center ga-4 pl-6"},Bm={class:"text-body-1 py-2"},Im={class:"text-body-1 font-weight-medium"},Fm={class:"text-body-2 text-label"},Gm={class:"text-body-2 text-label"},jm={class:"text-body-2 text-label mb-3"},Wm={class:"text-body-1 font-weight-medium"},Zm={class:"text-body-2 text-label"},Xm={class:"text-body-2 text-label"},Hm={class:"text-body-2 text-label mb-3"},Om={class:"text-body-1 py-2"},Ym={class:"text-body-1 font-weight-medium"},Um={class:"text-body-2 text-label"},Jm={class:"text-body-2 text-label"},Km={class:"text-body-2 text-label mb-3"},Qm={class:"text-body-1 font-weight-medium"},qm={class:"text-body-2 text-label"},$m={class:"text-body-2 text-label"},ed={class:"text-body-2 text-label mb-3"},td={class:"text-body-1 py-2"},od={class:"text-body-1 font-weight-medium"},ad={class:"text-body-2 text-label"},id={class:"text-body-2 text-label"},rd={class:"text-body-2 text-label mb-3"};function ld(o,e,a,r,i,l){var ne,S,Z,H,q,W,B,J,E,I,ie,ge,ue,oe,he;const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardText"),m=t.resolveComponent("VDivider"),d=t.resolveComponent("VCard"),g=t.resolveComponent("VSwitch"),u=t.resolveComponent("VBtnToggle"),y=t.resolveComponent("VCardTitle"),p=t.resolveComponent("VCardItem"),h=t.resolveComponent("VCheckbox"),f=t.resolveComponent("VRadio"),w=t.resolveComponent("IdmWindBarb"),b=t.resolveComponent("IdmSigWaveHeight"),L=t.resolveComponent("IdmCurrentDirection"),k=t.resolveComponent("IdmPrmsl"),C=t.resolveComponent("IdmWindParticle"),A=t.resolveComponent("IdmCurrentParticle"),_=t.resolveComponent("IdmWave"),z=t.resolveComponent("IdmSwell"),P=t.resolveComponent("IdmIceEdge"),V=t.resolveComponent("IdmIceCover"),N=t.resolveComponent("IdmIceThickness"),j=t.resolveComponent("IdmPrecip3h"),U=t.resolveComponent("IdmVisibility"),K=t.resolveComponent("IdmWaterTemp"),de=t.resolveComponent("IdmTemp");return t.openBlock(),t.createElementBlock("div",wm,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+46+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("weather.weatherLayers"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:X})=>[t.createVNode(n,t.mergeProps(X,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[9]||(e[9]=[t.createElementVNode("i",{class:"iconfont icon-Weather text-h4"},null,-1)])),_:2,__:[9]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),l.showTipMenu?(t.openBlock(),t.createElementBlock("div",xm,[t.createElementVNode("div",{class:t.normalizeClass(["menu-bar-box pa-1 rounded",a.simple?"simple":""]),style:t.normalizeStyle({right:i.right+"px",top:a.simple?"394px":l.lengendTipTop+"px"})},[t.createVNode(c,{text:o.$t("weather.legend"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:X})=>[t.createVNode(n,t.mergeProps(X,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.legendToggle?"bg-primary active-border":""],onClick:e[0]||(e[0]=se=>i.legendToggle=!i.legendToggle)}),{default:t.withCtx(()=>e[10]||(e[10]=[t.createElementVNode("i",{class:"iconfont icon-Legend text-h4"},null,-1)])),_:2,__:[10]},1040,["class"])]),_:1},8,["text","open-on-focus","open-on-hover"])],6),i.legendToggle?(t.openBlock(),t.createBlock(d,{key:0,elevation:"16",class:"card-info d-flex justify-center align-start",style:t.normalizeStyle({position:"absolute",top:a.simple?"200px":"340px",right:i.right+50+"px"})},{default:t.withCtx(()=>[t.createVNode(s,{class:"d-flex flex-column justify-center align-start text-label px-1",style:{width:"120px"}},{default:t.withCtx(()=>[e[11]||(e[11]=t.createElementVNode("div",{class:"text-body-2 font-weight-600 mb-2 mx-1"},"Wind Level",-1)),t.createElementVNode("div",km,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.legend.barbs,(X,se)=>(t.openBlock(),t.createElementBlock("div",{key:X,class:"w-50 d-flex flex-row justify-start align-center py-1 px-0 ma-0"},[t.createElementVNode("div",Am,[t.createElementVNode("i",{class:t.normalizeClass(["iconfont",l.barbsIconName[se]]),style:t.normalizeStyle({color:a.theme==="dark"?"#fff":"#000"})},null,6),t.createElementVNode("span",Lm,t.toDisplayString(Number(X)<10?`00${X}kts`:Number(X)<100?`0${X}kts`:`${X}kts`),1)])]))),128))])]),_:1,__:[11]}),t.createVNode(m,{vertical:""}),t.createVNode(s,{class:"d-flex flex-column justify-center align-start text-label px-2",style:{width:"100px"}},{default:t.withCtx(()=>[e[12]||(e[12]=t.createElementVNode("div",{class:"text-body-2 font-weight-600 mb-2"},"Wave Height",-1)),t.createElementVNode("div",Cm,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.legend.sigWaveHeight,(X,se)=>(t.openBlock(),t.createElementBlock("div",{key:se,class:"w-100 d-flex flex-row justify-start align-center py-1 px-0 ma-0"},[t.createElementVNode("div",vm,[se===0?(t.openBlock(),t.createElementBlock("div",zm)):(t.openBlock(),t.createElementBlock("div",{key:1,style:t.normalizeStyle({width:"24px",height:"12px",background:X.color})},null,4)),t.createElementVNode("div",_m,t.toDisplayString(X.label),1)])]))),128))])]),_:1,__:[12]}),t.createVNode(m,{vertical:""}),t.createVNode(s,{class:"d-flex flex-column justify-center align-start text-label pl-0 pr-2",style:{width:"100px"}},{default:t.withCtx(()=>[e[13]||(e[13]=t.createElementVNode("div",{class:"text-body-2 font-weight-600 mb-2 mx-2"},"Current",-1)),t.createElementVNode("div",Sm,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.legend.current,(X,se)=>(t.openBlock(),t.createElementBlock("div",{key:se,class:"w-100 d-flex flex-row justify-center align-center py-1 px-0 ma-0"},[t.createElementVNode("div",Nm,[t.createElementVNode("div",Mm,[t.createElementVNode("i",{class:"iconfont icon-a-direction-arrow text-label",style:t.normalizeStyle({fontSize:40*X.size+"px"})},null,4)]),t.createElementVNode("div",Pm,t.toDisplayString(X.label),1)])]))),128))])]),_:1,__:[13]})]),_:1},8,["style"])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["available-layers transition d-flex flex-column justify-start align-start",i.toggle?"right-bar":""]),style:t.normalizeStyle(l.listStyle)},[t.createElementVNode("div",{class:t.normalizeClass(["header-box w-100 d-flex justify-space-between align-center",a.simple?"px-3":"px-4"])},[t.createElementVNode("div",Vm,[t.createElementVNode("div",Tm,t.toDisplayString(o.$t("weather.weather")),1),t.createVNode(g,{modelValue:i.autoActive,"onUpdate:modelValue":e[1]||(e[1]=X=>i.autoActive=X),class:"small-switch",color:"primary","base-color":"disabled",inset:"","hide-details":""},null,8,["modelValue"])]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleMenuToggle},{default:t.withCtx(()=>e[14]||(e[14]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[14]},8,["onClick"])],2),a.simple?(t.openBlock(),t.createElementBlock("div",Em,[t.createElementVNode("div",null,t.toDisplayString(o.$t("weather.forecastModel")),1),t.createVNode(u,{modelValue:i.currentModel,"onUpdate:modelValue":e[2]||(e[2]=X=>i.currentModel=X),rounded:"",height:"28",density:"compact",mandatory:"",group:""},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact",height:"28",value:"GFS",class:"text-none btn-bg-2 px-1 text-body-1 mt-1",color:i.currentModel==="GFS"?"primary":"","base-color":""},{default:t.withCtx(()=>e[15]||(e[15]=[t.createTextVNode(" NOAA ",-1)])),_:1,__:[15]},8,["color"]),t.createVNode(n,{density:"compact",height:"28",class:"text-none btn-bg-2 px-1 text-body-1 mt-1",color:i.currentModel==="ECMWF"?"primary":"","base-color":"",value:"ECMWF"},{default:t.withCtx(()=>e[16]||(e[16]=[t.createTextVNode(" ECMWF ",-1)])),_:1,__:[16]},8,["color"])]),_:1},8,["modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["list-box w-100 scroll overflow-y-auto",[i.autoActive?"":"cursor-not-allowed",a.simple?"px-3":"pl-4 pr-2"]])},[t.createVNode(d,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(p,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(y,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.overlays")),1)]),_:1})]),_:1}),t.createVNode(s,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(X=>X.overlays),X=>(t.openBlock(),t.createBlock(h,{key:X.key,modelValue:i.checkList,"onUpdate:modelValue":e[3]||(e[3]=se=>i.checkList=se),value:X.key,label:o.$t(`weather.${X.locale}`),disabled:!i.autoActive,color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label","disabled"]))),128))]),_:1})]),_:1}),t.createVNode(d,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(p,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(y,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.renders")),1)]),_:1})]),_:1}),t.createVNode(s,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(X=>!X.overlays),X=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:X.key},[t.createVNode(f,{modelValue:i.renderKey,"onUpdate:modelValue":e[4]||(e[4]=se=>i.renderKey=se),label:o.$t(`weather.${X.locale}`),value:X.key,disabled:!i.autoActive,color:"primary",density:"compact",style:{height:"36px"},class:"text-body-2 py-1","hide-details":"",onClick:se=>i.renderKey=i.renderKey===X.key?"":X.key},null,8,["modelValue","label","value","disabled","onClick"]),i.renderKey==="wind-particle"&&X.key==="wind-particle"?(t.openBlock(),t.createElementBlock("div",Dm,[t.createElementVNode("span",null,t.toDisplayString(o.$t("weather.particleAnimatiom")),1),t.createVNode(g,{modelValue:i.showWindParticle,"onUpdate:modelValue":e[5]||(e[5]=se=>i.showWindParticle=se),label:"",class:"small-switch",color:"primary","base-color":"disabled",density:"compact",inset:"",style:{"font-size":"14px"},"hide-details":""},null,8,["modelValue"])])):t.createCommentVNode("",!0),i.renderKey==="current-particle"&&X.key==="current-particle"?(t.openBlock(),t.createElementBlock("div",Rm,[t.createElementVNode("span",null,t.toDisplayString(o.$t("weather.particleAnimatiom")),1),t.createVNode(g,{modelValue:i.showCurrentParticle,"onUpdate:modelValue":e[6]||(e[6]=se=>i.showCurrentParticle=se),label:"",class:"small-switch",color:"primary","base-color":"disabled",inset:"",density:"compact",height:"20","hide-details":""},null,8,["modelValue"])])):t.createCommentVNode("",!0),i.renderKey==="wave-group"&&X.key==="wave-group"?(t.openBlock(),t.createBlock(u,{key:2,modelValue:i.waveToggleValue,"onUpdate:modelValue":e[7]||(e[7]=se=>i.waveToggleValue=se),class:"w-100 pl-7 rounded",rounded:"0",height:"30",density:"compact",group:"",mandatory:"",disabled:!i.autoActive},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact",height:"30",value:"sig-wave",class:"w-50 text-none px-2 text-body-1",color:i.waveToggleValue==="sig-wave"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.significant")),1)]),_:1},8,["color","disabled"]),t.createVNode(n,{density:"compact",height:"30",class:"w-50 text-none px-2 text-body-1",color:i.waveToggleValue==="swell"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive,value:"swell"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.swell")),1)]),_:1},8,["color","disabled"])]),_:1},8,["modelValue","disabled"])):t.createCommentVNode("",!0),i.renderKey==="ice-forecast"&&X.key==="ice-forecast"?(t.openBlock(),t.createBlock(u,{key:3,modelValue:i.iceToggleValue,"onUpdate:modelValue":e[8]||(e[8]=se=>i.iceToggleValue=se),class:"w-100 pl-7 rounded",rounded:"0",height:"30",density:"compact",group:"",mandatory:"",disabled:!i.autoActive},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact",height:"30",value:"ice-cover",class:"w-50 text-none px-2 text-body-1",color:i.iceToggleValue==="ice-cover"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.coverage")),1)]),_:1},8,["color","disabled"]),t.createVNode(n,{density:"compact",height:"30",class:"w-50 text-none px-2 text-body-1",color:i.iceToggleValue==="ice-thickness"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive,value:"ice-thickness"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.thickness")),1)]),_:1},8,["color","disabled"])]),_:1},8,["modelValue","disabled"])):t.createCommentVNode("",!0)],64))),128))]),_:1})]),_:1}),t.createVNode(d,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(p,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(y,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.forecastModel")),1)]),_:1})]),_:1}),t.createVNode(s,{class:""},{default:t.withCtx(()=>{var X,se,Ae,Le,Fe,Ge,De,ze,je,Ve,Te,Re,We,Ze,Be,we,xe,_e,Xe,He,Oe,Me,at,it,rt,lt,nt,st,ct,mt,dt,ht,pt,gt,ut,ft,yt,bt,wt,xt,kt,At,Lt,Ct,vt,zt,_t,St,Nt,Mt,Pt,Vt,Tt,Et,Dt,Rt,Bt,It,Ft,Gt,jt,Pe,Ee,Wt,Ye,Zt,et,ke,Ue,te,Ce,Y,O,Je,Ie,Se,F,Xt,$,ve,Ke,tt,ot,R,Qe,G,qe,Ot,ae,$t,re,go,uo,fo,yo,bo,wo,xo,ko,Ao,Lo,Co,vo,zo,_o;return[t.createElementVNode("div",Bm,t.toDisplayString(o.$t("weather.atmospheric")),1),t.createElementVNode("div",Im,t.toDisplayString((Ae=(se=(X=i.models)==null?void 0:X.weather)==null?void 0:se.NOAA)==null?void 0:Ae.source)+" "+t.toDisplayString((Ge=(Fe=(Le=i.models)==null?void 0:Le.weather)==null?void 0:Fe.NOAA)==null?void 0:Ge.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((Ve=(je=(ze=(De=i.models)==null?void 0:De.weather)==null?void 0:ze.NOAA)==null?void 0:je.meta)==null?void 0:Ve.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",Fm,t.toDisplayString(o.$t("weather.source"))+": NOAA",1),t.createElementVNode("div",Gm,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((Ze=(We=(Re=(Te=i.models)==null?void 0:Te.weather)==null?void 0:Re.NOAA)==null?void 0:We.meta)==null?void 0:Ze.availabilityTime)),1),t.createElementVNode("div",jm,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((_e=(xe=(we=(Be=i.models)==null?void 0:Be.weather)==null?void 0:we.NOAA)==null?void 0:xe.meta)==null?void 0:_e.initialisationTime)),1),t.createElementVNode("div",Wm,t.toDisplayString((Oe=(He=(Xe=i.models)==null?void 0:Xe.weather)==null?void 0:He.ECMWF)==null?void 0:Oe.source)+" "+t.toDisplayString((it=(at=(Me=i.models)==null?void 0:Me.weather)==null?void 0:at.ECMWF)==null?void 0:it.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((st=(nt=(lt=(rt=i.models)==null?void 0:rt.weather)==null?void 0:lt.ECMWF)==null?void 0:nt.meta)==null?void 0:st.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",Zm,t.toDisplayString(o.$t("weather.source"))+": ECMWF",1),t.createElementVNode("div",Xm,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((ht=(dt=(mt=(ct=i.models)==null?void 0:ct.weather)==null?void 0:mt.ECMWF)==null?void 0:dt.meta)==null?void 0:ht.availabilityTime)),1),t.createElementVNode("div",Hm,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((ft=(ut=(gt=(pt=i.models)==null?void 0:pt.weather)==null?void 0:gt.ECMWF)==null?void 0:ut.meta)==null?void 0:ft.initialisationTime)),1),t.createVNode(m),t.createElementVNode("div",Om,t.toDisplayString(o.$t("weather.wave")),1),t.createElementVNode("div",Ym,t.toDisplayString((xt=(wt=(bt=(yt=i.models)==null?void 0:yt.marine)==null?void 0:bt.wave)==null?void 0:wt.NOAA)==null?void 0:xt.source)+" "+t.toDisplayString((Ct=(Lt=(At=(kt=i.models)==null?void 0:kt.marine)==null?void 0:At.wave)==null?void 0:Lt.NOAA)==null?void 0:Ct.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((Nt=(St=(_t=(zt=(vt=i.models)==null?void 0:vt.marine)==null?void 0:zt.wave)==null?void 0:_t.NOAA)==null?void 0:St.meta)==null?void 0:Nt.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",Um,t.toDisplayString(o.$t("weather.source"))+": NOAA",1),t.createElementVNode("div",Jm,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((Et=(Tt=(Vt=(Pt=(Mt=i.models)==null?void 0:Mt.marine)==null?void 0:Pt.wave)==null?void 0:Vt.NOAA)==null?void 0:Tt.meta)==null?void 0:Et.availabilityTime)),1),t.createElementVNode("div",Km,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((Ft=(It=(Bt=(Rt=(Dt=i.models)==null?void 0:Dt.marine)==null?void 0:Rt.wave)==null?void 0:Bt.NOAA)==null?void 0:It.meta)==null?void 0:Ft.initialisationTime)),1),t.createElementVNode("div",Qm,t.toDisplayString((Ee=(Pe=(jt=(Gt=i.models)==null?void 0:Gt.marine)==null?void 0:jt.wave)==null?void 0:Pe.ECMWF)==null?void 0:Ee.source)+" "+t.toDisplayString((et=(Zt=(Ye=(Wt=i.models)==null?void 0:Wt.marine)==null?void 0:Ye.wave)==null?void 0:Zt.ECMWF)==null?void 0:et.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((Y=(Ce=(te=(Ue=(ke=i.models)==null?void 0:ke.marine)==null?void 0:Ue.wave)==null?void 0:te.ECMWF)==null?void 0:Ce.meta)==null?void 0:Y.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",qm,t.toDisplayString(o.$t("weather.source"))+": ECMWF",1),t.createElementVNode("div",$m,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((F=(Se=(Ie=(Je=(O=i.models)==null?void 0:O.marine)==null?void 0:Je.wave)==null?void 0:Ie.ECMWF)==null?void 0:Se.meta)==null?void 0:F.availabilityTime)),1),t.createElementVNode("div",ed,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((tt=(Ke=(ve=($=(Xt=i.models)==null?void 0:Xt.marine)==null?void 0:$.wave)==null?void 0:ve.ECMWF)==null?void 0:Ke.meta)==null?void 0:tt.initialisationTime)),1),t.createVNode(m),t.createElementVNode("div",td,t.toDisplayString(o.$t("weather.currents")),1),t.createElementVNode("div",od,t.toDisplayString((G=(Qe=(R=(ot=i.models)==null?void 0:ot.marine)==null?void 0:R.current)==null?void 0:Qe.ECMWF)==null?void 0:G.source)+" "+t.toDisplayString(($t=(ae=(Ot=(qe=i.models)==null?void 0:qe.marine)==null?void 0:Ot.current)==null?void 0:ae.ECMWF)==null?void 0:$t.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((yo=(fo=(uo=(go=(re=i.models)==null?void 0:re.marine)==null?void 0:go.current)==null?void 0:uo.ECMWF)==null?void 0:fo.meta)==null?void 0:yo.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",ad,t.toDisplayString(o.$t("weather.source"))+": ECMWF",1),t.createElementVNode("div",id,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((Ao=(ko=(xo=(wo=(bo=i.models)==null?void 0:bo.marine)==null?void 0:wo.current)==null?void 0:xo.ECMWF)==null?void 0:ko.meta)==null?void 0:Ao.availabilityTime)),1),t.createElementVNode("div",rd,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((_o=(zo=(vo=(Co=(Lo=i.models)==null?void 0:Lo.marine)==null?void 0:Co.current)==null?void 0:vo.ECMWF)==null?void 0:zo.meta)==null?void 0:_o.initialisationTime)),1)]}),_:1})]),_:1})],2)],6),a.map?(t.openBlock(),t.createBlock(w,t.mergeProps({key:1,ref:"windBarb",map:a.map,"map-feather":a.mapFeather,"before-layer":"empty-layer-3",wind:(ne=i.weatherLayers)==null?void 0:ne.wind,"menu-toggle":a.menuToggle},o.$attrs),null,16,["map","map-feather","wind","menu-toggle"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(b,t.mergeProps({key:2,map:a.map,"before-layer":"empty-layer-2","sig-wave-height":(S=i.weatherLayers)==null?void 0:S["sig-wave-height"],"menu-toggle":a.menuToggle,"active-weather-layers":i.activeWeatherLayers},o.$attrs),null,16,["map","sig-wave-height","menu-toggle","active-weather-layers"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(L,t.mergeProps({key:3,map:a.map,"map-feather":a.mapFeather,"before-layer":"empty-layer-2",current:(Z=i.weatherLayers)==null?void 0:Z.current,"menu-toggle":a.menuToggle},o.$attrs),null,16,["map","map-feather","current","menu-toggle"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(k,t.mergeProps({key:4,map:a.map,"before-layer":"empty-layer-3",prmsl:(H=i.weatherLayers)==null?void 0:H.prmsl,"menu-toggle":a.menuToggle,"active-weather-layers":i.activeWeatherLayers},o.$attrs,{theme:a.theme}),null,16,["map","prmsl","menu-toggle","active-weather-layers","theme"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(C,t.mergeProps({key:5,viewport:i.viewport,factor:(q=i.weatherLayers)==null?void 0:q["wind-particle"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(A,t.mergeProps({key:6,viewport:i.viewport,factor:(W=i.weatherLayers)==null?void 0:W["current-particle"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(_,t.mergeProps({key:7,viewport:i.viewport,factor:(B=i.weatherLayers)==null?void 0:B["sig-wave"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(z,t.mergeProps({key:8,map:a.map,viewport:i.viewport,factor:(J=i.weatherLayers)==null?void 0:J.swell,"menu-toggle":a.menuToggle,"active-weather-layers":i.activeWeatherLayers,simple:a.simple},o.$attrs),null,16,["map","viewport","factor","menu-toggle","active-weather-layers","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(P,t.mergeProps({key:9,viewport:i.viewport,factor:(E=i.weatherLayers)==null?void 0:E["ice-edge"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(V,t.mergeProps({key:10,viewport:i.viewport,factor:(I=i.weatherLayers)==null?void 0:I["ice-cover"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(N,t.mergeProps({key:11,viewport:i.viewport,factor:(ie=i.weatherLayers)==null?void 0:ie["ice-thickness"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(j,t.mergeProps({key:12,viewport:i.viewport,factor:(ge=i.weatherLayers)==null?void 0:ge.precip3h,"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(U,t.mergeProps({key:13,viewport:i.viewport,factor:(ue=i.weatherLayers)==null?void 0:ue.visibility,"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(K,t.mergeProps({key:14,viewport:i.viewport,factor:(oe=i.weatherLayers)==null?void 0:oe["water-temp"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(de,t.mergeProps({key:15,viewport:i.viewport,factor:(he=i.weatherLayers)==null?void 0:he.temp,"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0)])}const nd=Q(bm,[["render",ld]]),no=[{rank:0,name:"Best Match",alias:"BEST MATCH",model:"best_match",models:["best_match"]},{rank:1,name:"GFS",alias:"GFS",model:"gfs_seamless",provider:"NOAA",country:"United States",resolution:25,tips:"3-25km",length:16,frequency:1,models:["gfs_seamless"],categories:"ncep_gfs013,ncep_gfs025,ncep_gfs_graphcast025,ncep_hrrr_conus,ncep_nbm_conus",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:2,name:"ECMWF",alias:"ECMWF",model:"ecmwf_ifs025",provider:"ECMWF",country:"European Union",resolution:25,tips:"25km",length:15,frequency:6,models:["ecmwf_ifs025","ecmwf_aifs025_single","ecmwf_ifs"],categories:"ecmwf_ifs025,ecmwf_aifs025_single,ecmwf_ifs",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:3,disabled:!0,name:"ICON",alias:"ECMWF",model:"icon_seamless",provider:"Deutscher Wetterdienst (DWD)",country:"Germany",resolution:13,tips:"2-13km",length:7.5,frequency:3,models:["icon_seamless","icon_global","icon_eu","icon_d2"],categories:"dwd_icon,dwd_icon_eps,dwd_icon_d2,dwd_icon_d2_eps,dwd_icon_eu,dwd_icon_eu_eps",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:4,name:"ARPEGE",disabled:!0,alias:"ECMWF",model:"arpege_seamless",provider:"Météo-France",country:"France",resolution:25,tips:"1-25km",length:4,frequency:1,models:["arpege_seamless","arpege_world","arpege_europe"],categories:"meteofrance_arpege_europe,meteofrance_arpege_europe_probabilities,meteofrance_arpege_world025",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:5,name:"UKMO",disabled:!0,alias:"ECMWF",model:"ukmo_seamless",provider:"UK Met Office",country:"United Kingdom",resolution:10,tips:"2-10km",length:7,frequency:1,models:["ukmo_seamless","ukmo_global_deterministic_10km","ukmo_uk_deterministic_2km"],categories:"ukmo_global_deterministic_10km,ukmo_uk_deterministic_2km",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:6,name:"JMA",disabled:!0,alias:"GFS",model:"jma_seamless",provider:"JMA",country:"Japan",resolution:55,tips:"5-55km",length:11,frequency:3,models:["jma_seamless","jma_msm","jma_gsm"],categories:"jma_gsm,jma_msm",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:7,name:"GEM",disabled:!0,alias:"GFS",model:"gem_seamless",provider:"Canadian Weather Service",country:"Canada",resolution:2.5,tips:"2.5km",length:10,frequency:6,models:["gem_seamless","gem_global","gem_regional"],categories:"cmc_gem_gdps,cmc_gem_hrdps,cmc_gem_rdps",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:8,name:"GRAPES",disabled:!0,alias:"GFS",model:"cma_grapes_global",provider:"China Meteorological Administration (CMA)",country:"China",resolution:15,tips:"15km",length:10,frequency:6,models:["cma_grapes_global"],categories:"cma_grapes_global",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:9,name:"ACCESS-G",disabled:!0,alias:"GFS",model:"bom_access_global",provider:"Australian Bureau of Meteorology (BOM)",country:"Australia",resolution:15,tips:"15km",length:10,frequency:6,models:["bom_access_global"],categories:"bom_access_global",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"}],so=[{rank:0,name:"Best Match",alias:"BEST MATCH",model:"best_match",models:["best_match"]},{rank:1,name:"MFWAM",alias:"ECMWF",model:"meteofrance_wave",provider:"MeteoFrance",country:"France",resolution:8,tips:"8km",length:10,frequency:12,models:["meteofrance_wave"],categories:"meteofrance_wave",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:2,disabled:!0,name:"SMOC",alias:"ECMWF",model:"meteofrance_currents",provider:"MeteoFrance",country:"France",resolution:8,tips:"8km",length:10,frequency:24,models:["meteofrance_currents"],categories:"meteofrance_currents, meteofrance_sea_surface_temperature",variables:"ocean_u_current,ocean_v_current,invert_barometer_height,sea_level_height_msl,sea_surface_temperature"},{rank:3,disabled:!0,name:"EWAM",alias:"ECMWF",model:"ewam",provider:"DWD",country:"Germany",resolution:5,tips:"5km",length:8,frequency:2,models:["ewam"],categories:"dwd_ewam",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:4,disabled:!0,name:"GWAM",alias:"ECMWF",model:"gwam",provider:"DWD",country:"Germany",resolution:5,tips:"5km",length:4,frequency:2,models:["gwam"],categories:"dwd_gwam",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:5,disabled:!0,name:"ECWAM",alias:"ECMWF",model:"ecmwf_wam025",provider:"ECMWF",country:"Europe",resolution:25,tips:"25km",length:10,frequency:6,models:["ecmwf_wam025"],categories:"ecmwf_wam025",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:6,name:"GFSWave",alias:"GFS",model:"ncep_gfswave025",provider:"NCEP",country:"USA",resolution:25,tips:"25km",length:10,frequency:6,models:["ncep_gfswave025","ncep_gfswave016"],categories:"ncep_gfswave025,ncep_gfswave016",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:7,disabled:!0,name:"ERA5-Ocean",alias:"ECMWF",model:"era5_ocean",provider:"Copernicus",country:"Europe",resolution:50,tips:"50km",length:-5,frequency:1,models:["era5_ocean"],categories:"copernicus_era5_ocean",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"}];let la=class{static standardWeatherModels(){return no.filter(e=>!e.disabled&&e.alias)}static standardMarineModels(){return so.filter(e=>!e.disabled&&e.alias)}static autoPickLayerModel(e,a="copernicus"){return a=a||"copernicus",a=a==null?void 0:a.toLowerCase(),a=["gfs","ecmwf","copernicus"].includes(a)?a:"copernicus",e=e==null?void 0:e.toLowerCase(),e==="gfs"?"gfs":["ec","ecmwf"].includes(e)?"ecmwf":["copernicus","cmems"].includes(e)?"copernicus":a}static autoPickPeerModel(e,a,r="copernicus"){if(a=this.autoPickLayerModel(a,r),$r.LayerHelper.WEATHER_LAYERS.reduce((i,l)=>l.atmos?i+l.weight:i,0)&e.weight){if(a==="copernicus")return"ecmwf"}else{if(["sig-wave","sig-wave-height","sig-wave-height-contour"].includes(e.key))return a;if(a==="ecmwf")return"copernicus"}return a}static autoPickMeteoModel(e="best_match"){var a,r;e=e==null?void 0:e.toLowerCase(),e=e==="ec"?"ecmwf":e;const i=e.toLowerCase().split(","),l=[],n=[];for(const c of i){let s=no.find(d=>{var g,u,y;return((g=d.models)==null?void 0:g.includes(c))||((u=d.alias)==null?void 0:u.toLowerCase())===c||((y=d.name)==null?void 0:y.toLowerCase())===c}),m=so.find(d=>{var g,u,y;return((g=d.models)==null?void 0:g.includes(c))||((u=d.alias)==null?void 0:u.toLowerCase())===c||((y=d.name)==null?void 0:y.toLowerCase())===c});s=s||no.find(d=>{var g,u;return((g=d.alias)==null?void 0:g.toLowerCase())===((u=m==null?void 0:m.alias)==null?void 0:u.toLowerCase())}),m=m||so.find(d=>{var g,u;return((g=d.alias)==null?void 0:g.toLowerCase())===((u=s==null?void 0:s.alias)==null?void 0:u.toLowerCase())}),s=s||no[0],m=m||so[0],l.push((a=s.models)!=null&&a.includes(c)?c:s.model),n.push((r=m.models)!=null&&r.includes(c)?c:m.model)}return{weatherModels:l.join(","),marineModels:n.join(",")}}static autoPickSubCategories(e){e=e.toUpperCase();const a=no.filter(l=>l.alias===e),r=so.filter(l=>l.alias===e),i=[];return a.forEach(l=>{l.categories&&i.push(...l.categories.split(","))}),r.forEach(l=>{l.categories&&i.push(...l.categories.split(","))}),i}static pickHourly(e,a){var r,i,l,n,c,s,m,d,g,u,y,p,h,f,w,b,L,k,C,A,_,z,P,V,N,j,U,K,de,ne,S,Z,H,q,W,B,J,E,I,ie,ge,ue,oe,he,X,se,Ae,Le,Fe,Ge,De,ze,je,Ve,Te,Re,We,Ze,Be,we,xe,_e,Xe,He,Oe,Me,at,it,rt,lt,nt,st,ct,mt,dt,ht,pt,gt,ut,ft,yt,bt,wt,xt,kt,At,Lt,Ct,vt,zt,_t,St,Nt,Mt,Pt,Vt,Tt,Et,Dt,Rt,Bt,It,Ft,Gt,jt,Pe,Ee,Wt,Ye,Zt,et,ke,Ue;const te=typeof a=="string"?v(a):a;let Ce=te.clone();const Y=e==null?void 0:e.weather,O=e==null?void 0:e.marine,Je=((i=(r=Y==null?void 0:Y[0])==null?void 0:r.hourly)==null?void 0:i.date)||((n=(l=O==null?void 0:O[0])==null?void 0:l.hourly)==null?void 0:n.date),Ie=v.utc(Je),Se=Ie.clone().add(((m=(s=(c=Y==null?void 0:Y[0])==null?void 0:c.hourly)==null?void 0:s.time)==null?void 0:m.at(0))||((u=(g=(d=O==null?void 0:O[0])==null?void 0:d.hourly)==null?void 0:g.time)==null?void 0:u.at(0)),"h"),F=Ie.clone().add(((h=(p=(y=Y==null?void 0:Y[0])==null?void 0:y.hourly)==null?void 0:p.time)==null?void 0:h.at(-1))||((b=(w=(f=O==null?void 0:O[0])==null?void 0:f.hourly)==null?void 0:w.time)==null?void 0:b.at(-1)),"h"),Xt=[];Ce=Ce.isBefore(Se)?Se.clone():Ce,Ce=Ce.isAfter(F)?F.clone():Ce;const $=Ce.utc().diff(Se,"h",!1);let ve,Ke;if(Y!=null&&Y.length){let tt=0,ot=0,R=0;for(const Qe of Y){const G=Qe==null?void 0:Qe.hourly;for(let re=$-($-1)%3;re<=$;re++)tt+=((L=G==null?void 0:G.precipitation)==null?void 0:L.at(re))??0;for(let re=$-($-1)%6;re<=$;re++)ot+=((k=G==null?void 0:G.precipitation)==null?void 0:k.at(re))??0;for(let re=$-($-1)%12;re<=$;re++)R+=((C=G==null?void 0:G.precipitation)==null?void 0:C.at(re))??0;const qe=((A=G==null?void 0:G.wind_direction_10m)==null?void 0:A.at($))??((z=(_=G==null?void 0:G.wind_direction_10m)==null?void 0:_.filter(re=>re!==null))==null?void 0:z.at(-1));ve={temp:((P=G==null?void 0:G.temperature_2m)==null?void 0:P.at($))??((N=(V=G==null?void 0:G.temperature_2m)==null?void 0:V.filter(re=>re!==null))==null?void 0:N.at(-1)),apparentTemp:((j=G==null?void 0:G.apparent_temperature)==null?void 0:j.at($))??((K=(U=G==null?void 0:G.apparent_temperature)==null?void 0:U.filter(re=>re!==null))==null?void 0:K.at(-1)),rh:((de=G==null?void 0:G.relative_humidity_2m)==null?void 0:de.at($))??((S=(ne=G==null?void 0:G.relative_humidity_2m)==null?void 0:ne.filter(re=>re!==null))==null?void 0:S.at(-1)),dp:((Z=G==null?void 0:G.dew_point_2m)==null?void 0:Z.at($))??((q=(H=G==null?void 0:G.dew_point_2m)==null?void 0:H.filter(re=>re!==null))==null?void 0:q.at(-1)),precip:{probability:((W=G==null?void 0:G.precipitation_probability)==null?void 0:W.at($))??0,sum:((B=G==null?void 0:G.precipitation)==null?void 0:B.at($))??0,sum1Hours:((J=G==null?void 0:G.precipitation)==null?void 0:J.at($))??0,sum3Hours:Math.round(tt*100)/100,sum6Hours:Math.round(ot*100)/100,sum12Hours:Math.round(R*100)/100},pmsl:((E=G==null?void 0:G.pressure_msl)==null?void 0:E.at($))??((ie=(I=G==null?void 0:G.pressure_msl)==null?void 0:I.filter(re=>re!==null))==null?void 0:ie.at(-1)),psurf:((ge=G==null?void 0:G.surface_pressure)==null?void 0:ge.at($))??((oe=(ue=G==null?void 0:G.surface_pressure)==null?void 0:ue.filter(re=>re!==null))==null?void 0:oe.at(-1)),code:((he=G==null?void 0:G.weather_code)==null?void 0:he.at($))??((se=(X=G==null?void 0:G.weather_code)==null?void 0:X.filter(re=>re!==null))==null?void 0:se.at(-1)),visibility:this.m2nm(((Ae=G==null?void 0:G.visibility)==null?void 0:Ae.at($))??((Fe=(Le=G==null?void 0:G.visibility)==null?void 0:Le.filter(re=>re!==null))==null?void 0:Fe.at(-1))),wind:{speed:((Ge=G==null?void 0:G.wind_speed_10m)==null?void 0:Ge.at($))??((ze=(De=G==null?void 0:G.wind_speed_10m)==null?void 0:De.filter(re=>re!==null))==null?void 0:ze.at(-1)),kts:((je=G==null?void 0:G.wind_speed_10m)==null?void 0:je.at($))??((Te=(Ve=G==null?void 0:G.wind_speed_10m)==null?void 0:Ve.filter(re=>re!==null))==null?void 0:Te.at(-1)),degree:qe,bearing:qe!==null?Math.round((qe+180)%360):null,gusts:((Re=G==null?void 0:G.wind_gusts_10m)==null?void 0:Re.at($))??((Ze=(We=G==null?void 0:G.wind_gusts_10m)==null?void 0:We.filter(re=>re!==null))==null?void 0:Ze.at(-1))},isDay:(Be=G==null?void 0:G.is_day)==null?void 0:Be.at($)};const{name:Ot,url:ae,bg:$t}=this.parseWeatherCode(ve.code,ve.isDay);ve.name=Ot,ve.url=ae,ve.bg=$t,ve.wind.scale=this.beaufort(this.kts2ms(ve.wind.kts)),ve.wind.direction=this.degree2Direction(ve.wind.degree),Xt.push({utc:te.utc().format(),realUTC:Se.add($,"h").format(),model:Qe.model,weather:{...ve}})}}if(O!=null&&O.length){let tt=0;for(const ot of O){const R=ot==null?void 0:ot.hourly,Qe=((we=R==null?void 0:R.wave_direction)==null?void 0:we.at($))??((_e=(xe=R==null?void 0:R.wave_direction)==null?void 0:xe.filter(ae=>ae!==null))==null?void 0:_e.at(-1)),G=((Xe=R==null?void 0:R.swell_wave_direction)==null?void 0:Xe.at($))??((Oe=(He=R==null?void 0:R.swell_wave_direction)==null?void 0:He.filter(ae=>ae!==null))==null?void 0:Oe.at(-1)),qe=((Me=R==null?void 0:R.wind_wave_direction)==null?void 0:Me.at($))??((it=(at=R==null?void 0:R.wind_wave_direction)==null?void 0:at.filter(ae=>ae!==null))==null?void 0:it.at(-1)),Ot=((rt=R==null?void 0:R.ocean_current_direction)==null?void 0:rt.at($))??((nt=(lt=R==null?void 0:R.ocean_current_direction)==null?void 0:lt.filter(ae=>ae!==null))==null?void 0:nt.at(-1));Ke={wave:{sig:{height:((st=R==null?void 0:R.wave_height)==null?void 0:st.at($))??((mt=(ct=R==null?void 0:R.wave_height)==null?void 0:ct.filter(ae=>ae!==null))==null?void 0:mt.at(-1)),degree:Qe,bearing:Qe!==null?Math.round((Qe+180)%360):null,period:((dt=R==null?void 0:R.wave_period)==null?void 0:dt.at($))??((pt=(ht=R==null?void 0:R.wave_period)==null?void 0:ht.filter(ae=>ae!==null))==null?void 0:pt.at(-1))},swell:{height:((gt=R==null?void 0:R.swell_wave_height)==null?void 0:gt.at($))??((ft=(ut=R==null?void 0:R.swell_wave_height)==null?void 0:ut.filter(ae=>ae!==null))==null?void 0:ft.at(-1)),degree:G,bearing:G!==null?Math.round((G+180)%360):null,period:((yt=R==null?void 0:R.swell_wave_period)==null?void 0:yt.at($))??((wt=(bt=R==null?void 0:R.swell_wave_period)==null?void 0:bt.filter(ae=>ae!==null))==null?void 0:wt.at(-1)),peakPeriod:((xt=R==null?void 0:R.swell_wave_peak_period)==null?void 0:xt.at($))??((At=(kt=R==null?void 0:R.swell_wave_peak_period)==null?void 0:kt.filter(ae=>ae!==null))==null?void 0:At.at(-1))},wd:{height:((Lt=R==null?void 0:R.wind_wave_height)==null?void 0:Lt.at($))??((vt=(Ct=R==null?void 0:R.wind_wave_height)==null?void 0:Ct.filter(ae=>ae!==null))==null?void 0:vt.at(-1)),degree:qe,bearing:qe!==null?Math.round((qe+180)%360):null,period:((zt=R==null?void 0:R.wind_wave_period)==null?void 0:zt.at($))??((St=(_t=R==null?void 0:R.wind_wave_period)==null?void 0:_t.filter(ae=>ae!==null))==null?void 0:St.at(-1)),peakPeriod:((Nt=R==null?void 0:R.wind_wave_peak_period)==null?void 0:Nt.at($))??((Pt=(Mt=R==null?void 0:R.wind_wave_peak_period)==null?void 0:Mt.filter(ae=>ae!==null))==null?void 0:Pt.at(-1))}},current:{speed:((Vt=R==null?void 0:R.ocean_current_velocity)==null?void 0:Vt.at($))??((Et=(Tt=R==null?void 0:R.ocean_current_velocity)==null?void 0:Tt.filter(ae=>ae!==null))==null?void 0:Et.at(-1)),kts:((Dt=R==null?void 0:R.ocean_current_velocity)==null?void 0:Dt.at($))??((Bt=(Rt=R==null?void 0:R.ocean_current_velocity)==null?void 0:Rt.filter(ae=>ae!==null))==null?void 0:Bt.at(-1)),degree:Ot,bearing:Ot},sst:((It=R==null?void 0:R.sea_surface_temperature)==null?void 0:It.at($))??((Gt=(Ft=R==null?void 0:R.sea_surface_temperature)==null?void 0:Ft.filter(ae=>ae!==null))==null?void 0:Gt.at(-1)),height:((jt=R==null?void 0:R.sea_level_height_msl)==null?void 0:jt.at($))??((Ee=(Pe=R==null?void 0:R.sea_level_height_msl)==null?void 0:Pe.filter(ae=>ae!==null))==null?void 0:Ee.at(-1)),ice:{sit:((Wt=R==null?void 0:R.sea_ice_thickness)==null?void 0:Wt.at($))??((Zt=(Ye=R==null?void 0:R.sea_ice_thickness)==null?void 0:Ye.filter(ae=>ae!==null))==null?void 0:Zt.at(-1)),sic:((et=R==null?void 0:R.sea_ice_concentration)==null?void 0:et.at($))??((Ue=(ke=R==null?void 0:R.sea_ice_concentration)==null?void 0:ke.filter(ae=>ae!==null))==null?void 0:Ue.at(-1))}},Ke.wave=this.parseWave(Ke.wave,ve==null?void 0:ve.wind),Ke.current.direction=this.degree2Direction(Ke.current.degree),Xt[tt]?Object.assign(Xt[tt],Ke):Xt.push({utc:te.utc().format(),realUTC:Se.add($,"h").format(),model:ot.model,...Ke}),tt++}}return Xt}static toLegacy(e){var a,r,i,l,n,c,s,m,d,g;return{wind:(a=e==null?void 0:e.weather)==null?void 0:a.wind,visibility:(r=e==null?void 0:e.weather)==null?void 0:r.visibility,temp:(i=e==null?void 0:e.weather)==null?void 0:i.temp,prmsl:(l=e==null?void 0:e.weather)==null?void 0:l.pmsl,gusts:{kts:(c=(n=e==null?void 0:e.weather)==null?void 0:n.wind)==null?void 0:c.gusts},precip:(s=e==null?void 0:e.weather)==null?void 0:s.precip,code:(m=e==null?void 0:e.weather)==null?void 0:m.code,name:(d=e==null?void 0:e.weather)==null?void 0:d.name,url:(g=e==null?void 0:e.weather)==null?void 0:g.url,wave:e==null?void 0:e.wave,current:e==null?void 0:e.current,sst:e==null?void 0:e.sst,height:e==null?void 0:e.height,utc:e==null?void 0:e.utc,source:e==null?void 0:e.model,ice:e==null?void 0:e.ice}}static pickDaily(e,a){var r,i,l,n,c,s,m,d,g,u,y,p,h,f,w,b,L,k,C,A,_,z,P,V,N,j,U,K,de,ne,S,Z,H,q,W,B,J,E,I,ie,ge,ue,oe,he,X,se,Ae,Le,Fe,Ge,De,ze,je,Ve,Te,Re,We,Ze,Be,we,xe,_e,Xe,He,Oe,Me,at,it,rt,lt,nt,st,ct,mt,dt,ht,pt,gt,ut,ft,yt,bt,wt,xt,kt,At,Lt,Ct,vt,zt,_t,St,Nt,Mt,Pt,Vt,Tt,Et,Dt,Rt,Bt,It,Ft,Gt;const jt=typeof a=="string"?v(a):a;let Pe=jt.clone();const Ee=e==null?void 0:e.weather,Wt=e==null?void 0:e.marine,Ye=v((l=(i=(r=Ee==null?void 0:Ee[0])==null?void 0:r.daily)==null?void 0:i.time)==null?void 0:l.at(0)),Zt=v((s=(c=(n=Ee==null?void 0:Ee[0])==null?void 0:n.daily)==null?void 0:c.time)==null?void 0:s.at(-1)),et=[];Pe=Pe.isBefore(Ye)?Ye.clone():Pe,Pe=Pe.isAfter(Zt)?Zt.clone():Pe;let ke,Ue;const te=Pe.diff(Ye,"d",!1);if(Ee)for(const Ce of Ee){const Y=Ce.daily,O=((m=Y.wind_direction_10m_dominant)==null?void 0:m.at(te))??((g=(d=Y.wind_direction_10m_dominant)==null?void 0:d.filter(F=>F!==null))==null?void 0:g.at(-1));ke={code:((u=Y.weather_code)==null?void 0:u.at(te))??((p=(y=Y.weather_code)==null?void 0:y.filter(F=>F!==null))==null?void 0:p.at(-1)),temp:{max:((h=Y.temperature_2m_max)==null?void 0:h.at(te))??((w=(f=Y.temperature_2m_max)==null?void 0:f.filter(F=>F!==null))==null?void 0:w.at(-1)),min:((b=Y.temperature_2m_min)==null?void 0:b.at(te))??((k=(L=Y.temperature_2m_min)==null?void 0:L.filter(F=>F!==null))==null?void 0:k.at(-1)),mean:((C=Y.temperature_2m_mean)==null?void 0:C.at(te))??((_=(A=Y.temperature_2m_mean)==null?void 0:A.filter(F=>F!==null))==null?void 0:_.at(-1))},apparentTemp:{max:((z=Y.apparent_temperature_max)==null?void 0:z.at(te))??((V=(P=Y.apparent_temperature_max)==null?void 0:P.filter(F=>F!==null))==null?void 0:V.at(-1)),min:((N=Y.apparent_temperature_min)==null?void 0:N.at(te))??((U=(j=Y.apparent_temperature_min)==null?void 0:j.filter(F=>F!==null))==null?void 0:U.at(-1))},precip:{sum:((K=Y.precipitation_sum)==null?void 0:K.at(te))??((ne=(de=Y.precipitation_sum)==null?void 0:de.filter(F=>F!==null))==null?void 0:ne.at(-1)),rainSum:((S=Y.rain_sum)==null?void 0:S.at(te))??((H=(Z=Y.rain_sum)==null?void 0:Z.filter(F=>F!==null))==null?void 0:H.at(-1)),snowfallSum:((q=Y.snowfall_sum)==null?void 0:q.at(te))??((B=(W=Y.snowfall_sum)==null?void 0:W.filter(F=>F!==null))==null?void 0:B.at(-1)),showersSum:((J=Y.showers_sum)==null?void 0:J.at(te))??((I=(E=Y.showers_sum)==null?void 0:E.filter(F=>F!==null))==null?void 0:I.at(-1)),hours:((ie=Y.precipitation_hours)==null?void 0:ie.at(te))??0,probability:((ge=Y.precipitation_probability_max)==null?void 0:ge.at(te))??0},rh:{max:((ue=Y.relative_humidity_2m_max)==null?void 0:ue.at(te))??((he=(oe=Y.relative_humidity_2m_max)==null?void 0:oe.filter(F=>F!==null))==null?void 0:he.at(-1)),min:((X=Y.relative_humidity_2m_min)==null?void 0:X.at(te))??((Ae=(se=Y.relative_humidity_2m_min)==null?void 0:se.filter(F=>F!==null))==null?void 0:Ae.at(-1)),mean:((Le=Y.relative_humidity_2m_mean)==null?void 0:Le.at(te))??((Ge=(Fe=Y.relative_humidity_2m_mean)==null?void 0:Fe.filter(F=>F!==null))==null?void 0:Ge.at(-1))},wind:{speed:((De=Y.wind_speed_10m_max)==null?void 0:De.at(te))??((je=(ze=Y.wind_speed_10m_max)==null?void 0:ze.filter(F=>F!==null))==null?void 0:je.at(-1)),kts:((Ve=Y.wind_speed_10m_max)==null?void 0:Ve.at(te))??((Re=(Te=Y.wind_speed_10m_max)==null?void 0:Te.filter(F=>F!==null))==null?void 0:Re.at(-1)),degree:O,gusts:((We=Y.wind_gusts_10m_max)==null?void 0:We.at(te))??((Be=(Ze=Y.wind_gusts_10m_max)==null?void 0:Ze.filter(F=>F!==null))==null?void 0:Be.at(-1)),mean:((we=Y.wind_speed_10m_mean)==null?void 0:we.at(te))??((_e=(xe=Y.wind_speed_10m_mean)==null?void 0:xe.filter(F=>F!==null))==null?void 0:_e.at(-1)),bearing:O!==null?Math.round((O+180)%360):null},visibility:{max:this.m2nm(((Xe=Y.visibility_max)==null?void 0:Xe.at(te))??((Oe=(He=Y.visibility_max)==null?void 0:He.filter(F=>F!==null))==null?void 0:Oe.at(-1))),min:this.m2nm(((Me=Y.visibility_min)==null?void 0:Me.at(te))??((it=(at=Y.visibility_min)==null?void 0:at.filter(F=>F!==null))==null?void 0:it.at(-1))),mean:this.m2nm(((rt=Y.visibility_mean)==null?void 0:rt.at(te))??((nt=(lt=Y.visibility_mean)==null?void 0:lt.filter(F=>F!==null))==null?void 0:nt.at(-1)))}};const{name:Je,url:Ie,bg:Se}=this.parseWeatherCode(ke.code,!0);ke.name=Je,ke.url=Ie,ke.bg=Se,ke.wind.scale=this.beaufort(this.kts2ms(ke.wind.kts)),ke.wind.direction=this.degree2Direction(ke.wind.degree),et.push({utc:jt.utc().format(),realUTC:Ye.add(te,"d").utc().format(),model:Ce.model,weather:{...ke}})}if(Wt){let Ce=0;for(const Y of Wt){const O=Y.daily,Je=((st=O==null?void 0:O.wave_direction_dominant)==null?void 0:st.at(te))||((mt=(ct=O==null?void 0:O.wave_direction_dominant)==null?void 0:ct.filter(F=>F!==null))==null?void 0:mt.at(-1)),Ie=((dt=O==null?void 0:O.swell_wave_direction_dominant)==null?void 0:dt.at(te))||((pt=(ht=O==null?void 0:O.swell_wave_direction_dominant)==null?void 0:ht.filter(F=>F!==null))==null?void 0:pt.at(-1)),Se=((gt=O==null?void 0:O.wind_wave_direction_dominant)==null?void 0:gt.at(te))||((ft=(ut=O==null?void 0:O.wind_wave_direction_dominant)==null?void 0:ut.filter(F=>F!==null))==null?void 0:ft.at(-1));Ue={wave:{sig:{height:((yt=O==null?void 0:O.wave_height_max)==null?void 0:yt.at(te))||((wt=(bt=O==null?void 0:O.wave_height_max)==null?void 0:bt.filter(F=>F!==null))==null?void 0:wt.at(-1)),degree:Je,period:((xt=O==null?void 0:O.wave_period_max)==null?void 0:xt.at(te))||((At=(kt=O==null?void 0:O.wave_period_max)==null?void 0:kt.filter(F=>F!==null))==null?void 0:At.at(-1)),bearing:Je!==null?Math.round((Je+180)%360):null},swell:{height:((Lt=O==null?void 0:O.swell_wave_height_max)==null?void 0:Lt.at(te))??((vt=(Ct=O==null?void 0:O.swell_wave_height_max)==null?void 0:Ct.filter(F=>F!==null))==null?void 0:vt.at(-1)),degree:Ie,period:((zt=O==null?void 0:O.swell_wave_period_max)==null?void 0:zt.at(te))??((St=(_t=O==null?void 0:O.swell_wave_period_max)==null?void 0:_t.filter(F=>F!==null))==null?void 0:St.at(-1)),peakPeriod:((Nt=O==null?void 0:O.swell_wave_peak_period_max)==null?void 0:Nt.at(te))??((Pt=(Mt=O==null?void 0:O.swell_wave_peak_period_max)==null?void 0:Mt.filter(F=>F!==null))==null?void 0:Pt.at(-1)),bearing:Ie!==null?Math.round((Ie+180)%360):null},wd:{height:((Vt=O==null?void 0:O.wind_wave_height_max)==null?void 0:Vt.at(te))??((Et=(Tt=O==null?void 0:O.wind_wave_height_max)==null?void 0:Tt.filter(F=>F!==null))==null?void 0:Et.at(-1)),degree:Se,period:((Dt=O==null?void 0:O.wind_wave_period_max)==null?void 0:Dt.at(te))??((Bt=(Rt=O==null?void 0:O.wind_wave_period_max)==null?void 0:Rt.filter(F=>F!==null))==null?void 0:Bt.at(-1)),peakPeriod:((It=O==null?void 0:O.wind_wave_peak_period_max)==null?void 0:It.at(te))??((Gt=(Ft=O==null?void 0:O.wind_wave_peak_period_max)==null?void 0:Ft.filter(F=>F!==null))==null?void 0:Gt.at(-1)),bearing:Se!==null?Math.round((Se+180)%360):null}}},Ue.wave=this.parseWave(Ue.wave,ke==null?void 0:ke.wind),Object.assign(et[Ce]||{},Ue),Ce++}}return et}static parseWave(e,a){if(e.sig.direction=this.degree2Direction(e.sig.degree),e.swell.direction=this.degree2Direction(e.swell.degree),e.wd.direction=this.degree2Direction(e.wd.degree),e.sig.scale=this.douglas(e.sig.height),e.swell.scale=this.douglas(e.swell.height),e.wd.scale=this.douglas(e.wd.height),e.sig.height==0){const r=Math.sqrt(Math.pow(e.swell.height||0,2)+Math.pow(e.wd.height||0,2));e.sig.height=r?Math.round(r*100)/100:.1}if(e.swell.height===0)if(e.sig.height>e.wd.height){const r=Math.sqrt(Math.abs(Math.pow(e.sig.height||0,2)-Math.pow(e.wd.height||0,2)));e.swell.height=Math.round(r*100)/100}else{const r=Math.round(.12*this.kts2ms((a==null?void 0:a.kts)||0)*100)/100,i=r>1?r/10:r>.5?r/5:r>.3?r/2:r,l=Math.max(e.sig.height,e.wd.height);e.swell.height=Math.round((i<l?i:l/2)*100)/100}if(e.wd.height===0)if(e.sig.height>e.swell.height){const r=Math.sqrt(Math.abs(Math.pow(e.sig.height||0,2)-Math.pow(e.swell.height||0,2))),i=.24*this.kts2ms((a==null?void 0:a.kts)||0);e.wd.height=Math.round(Math.min(r,i)*100)/100}else{const r=.24*this.kts2ms((a==null?void 0:a.kts)||0),i=Math.max(e.sig.height,e.swell.height);e.wd.height=Math.round((r<i?r:i/2)*100)/100}if(e.swell.height>=e.sig.height&&(e.swell.height=Math.round(e.sig.height*.8*100)/100),e.wd.height>=e.sig.height&&(e.wd.height=Math.round(e.sig.height*.8*100)/100),!e.sig.period){const r=Math.max(e.swell.period,e.wd.period);e.sig.period=Math.round(6*Math.sqrt(e.sig.height)),e.sig.period=isNaN(r)?void 0:e.sig.period>r?r:e.sig.period}if(!e.swell.period){e.swell.period=Math.round(6*Math.sqrt(e.swell.height));const r=Math.max(e.sig.period,e.wd.period);e.swell.period=isNaN(r)?void 0:e.swell.period>r?r:e.swell.period}if(!e.wd.period){e.wd.period=Math.round(6*Math.sqrt(e.wd.height));const r=Math.max(e.sig.period,e.swell.period);e.wd.period=isNaN(r)?void 0:e.wd.period>r?r:e.wd.period}return e}static parseWeatherCode(e,a){const r=this.weatherCode(e);return(a?r.day:r.night)||{}}static weatherCode(e){const a={code:e};switch(e){case 0:a.day={name:"Sunny",url:"https://ossimg.ormwx.com/asset/weather/01d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"},a.night={name:"Clear",url:"https://ossimg.ormwx.com/asset/weather/01n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"};break;case 1:a.day={name:"Mainly Sunny",url:"https://ossimg.ormwx.com/asset/weather/01d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"},a.night={name:"Mainly Clear",url:"https://ossimg.ormwx.com/asset/weather/01n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"};break;case 2:a.day={name:"Partly Cloudy",url:"https://ossimg.ormwx.com/asset/weather/02d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg2.png"},a.night={name:"Partly Cloudy",url:"https://ossimg.ormwx.com/asset/weather/02n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg2.png"};break;case 3:a.day={name:"Overcast",url:"https://ossimg.ormwx.com/asset/weather/04d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg3.png"},a.night={name:"Overcast",url:"https://ossimg.ormwx.com/asset/weather/04n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg3.png"};break;case 45:a.day={name:"Foggy",url:"https://ossimg.ormwx.com/asset/weather/50d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"},a.night={name:"Foggy",url:"https://ossimg.ormwx.com/asset/weather/50n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"};break;case 48:a.day={name:"Rime Fog",url:"https://ossimg.ormwx.com/asset/weather/50d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"},a.night={name:"Rime Fog",url:"https://ossimg.ormwx.com/asset/weather/50n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"};break;case 51:a.day={name:"Light Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 53:a.day={name:"Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 55:a.day={name:"Heavy Drizzle",url:"https://ossimg.ormwx.com/asset/weather/15d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Heavy Drizzle",url:"https://ossimg.ormwx.com/asset/weather/15n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 56:a.day={name:"Light Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 57:a.day={name:"Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 61:a.day={name:"Light Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 63:a.day={name:"Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 65:a.day={name:"Heavy Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Heavy Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 66:a.day={name:"Light Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 67:a.day={name:"Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 71:a.day={name:"Light Snow",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Light Snow",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 73:a.day={name:"Snow",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Snow",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 75:a.day={name:"Heavy Snow",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Heavy Snow",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 77:a.day={name:"Snow Grains",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Snow Grains",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 80:a.day={name:"Light Showers",url:"https://ossimg.ormwx.com/asset/weather/09d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Showers",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 81:a.day={name:"Showers",url:"https://ossimg.ormwx.com/asset/weather/09d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Showers",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 82:a.day={name:"Heavy Showers",url:"https://ossimg.ormwx.com/asset/weather/09d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Heavy Showers",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 85:a.day={name:"Light Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Light Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 86:a.day={name:"Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 95:a.day={name:"Thunderstorm",url:"https://ossimg.ormwx.com/asset/weather/11d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Thunderstorm",url:"https://ossimg.ormwx.com/asset/weather/11n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 96:a.day={name:"Light Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 99:a.day={name:"Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break}return a}static kts2ms(e){return isNaN(e)||e===null?e:Math.round(e*1852/3600*1e4)/1e4}static kts2kmh(e){return isNaN(e)||e===null?e:e*1.852}static m2nm(e){return isNaN(e)||e===null?e:Math.round(e/1e3/1.852*1e4)/1e4}static kmh2kts(e){return isNaN(e)||e===null?e:this.ms2kts(e*1e3/3600)}static ms2kts(e){return isNaN(e)||e===null?e:Math.round(e*3600/1852*1e4)/1e4}static degree2Radian(e){if(isNaN(e)||e===null)return e;let a=e%360/360*2*Math.PI;return a=a<0?a+2*Math.PI:a,a}static degree2Direction(e){const a=this.degree2Radian(e);if(isNaN(a)||a===null)return null;let r="N/A";const i=Math.PI/16;return a<i?r="N":a>=i&&a<3*i?r="NNE":a>=3*i&&a<5*i?r="NE":a>=5*i&&a<7*i?r="ENE":a>=7*i&&a<9*i?r="E":a>=9*i&&a<11*i?r="ESE":a>=11*i&&a<13*i?r="SE":a>=13*i&&a<15*i?r="SSE":a>=15*i&&a<17*i?r="S":a>=17*i&&a<19*i?r="SSW":a>=19*i&&a<21*i?r="SW":a>=21*i&&a<23*i?r="WSW":a>=23*i&&a<25*i?r="W":a>=25*i&&a<27*i?r="WNW":a>=27*i&&a<29*i?r="NW":a>=29*i&&a<31*i?r="NNW":a>=31*i&&a<32*i&&(r="N"),r}static beaufort(e){let a=0;return isNaN(e)||(e=Math.round(e*10)/10,e<=.2?a=0:e<=1.5?a=1:e<=3.3?a=2:e<=5.4?a=3:e<=7.9?a=4:e<=10.7?a=5:e<=13.8?a=6:e<=17.1?a=7:e<=20.7?a=8:e<=22.4?a=9:e<=28.4?a=10:e<=32.6?a=11:e<=36.9?a=12:e<=41.4?a=13:e<=46.1?a=14:e<=50.9?a=15:e<=55.9?a=16:e<=61.2?a=17:e>61.2&&(a=18)),a}static douglas(e){let a="Calm";return isNaN(e)||e<=.1?a="Calm":e<=.5?a="Smooth":e<=1.25?a="Slight":e<=2.5?a="Moderate":e<=4?a="Rough":e<=6?a="VeryRough":e<=9?a="High":e<=14?a="VeryHigh":a="Precipitous",a}};const ib="",sd={name:"IdmTropicals",props:{simple:{type:Boolean,default:!1},permission:{type:Number},locale:{type:String},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}},timeZone:{type:Number},token:{type:String},defaultMeteoToken:{type:String},gateway:{type:String,default:"aa"},assistGateway:{type:Array,default:[]},forecastModel:{type:String},realTime:{type:String},beforeLayer:{type:String}},emits:["tropical","tropicalCenterPoints","tropicalProbability","tropicalNotification"],setup(){return{Theme:ye.useTheme()}},data(){return{right:10,toggle:!1,helper:eo.CompanyHelper,tropicals:void 0,tropicalCacheKey:"tropicalCacheGL4",source:"tropicals-source",clusterSource:"tropicals-cluster-source",historyLayer:"tropicals-history-layer",forecastLayer:"tropicals-forecast-layer",forecastModelLayer:"tropicals-forecast-model-layer",forecastNameLayer:"tropicals-forecast-name-layer",pointCircleLayer:"tropicals-point-circle-layer",pointLabelLayer:"tropicals-point-label-layer",historyPointCircleLayer:"history-tropicals-point-circle-layer",historyPointLabelLayer:"history-tropicals-point-label-layer",interpolateData:[],interpolateMarkers:[],interpolateSource:"tropicals-interpolate-source",interpolateLineLayer:"tropicals-interpolate-line-layer",showTropicalsInfo:!1,activeTropicals:void 0,activeTropicalsMarker:void 0,empty:T.featureCollection([]),showLegend:!1,showHoverPoint:!1,hoverPoint:void 0,hoverMarker:void 0}},computed:{hoverLayers(){return[this.forecastNameLayer,this.forecastLayer,this.historyLayer,this.pointCircleLayer,this.pointCircleLayer+"-border",this.historyPointCircleLayer,this.historyPointCircleLayer+"-border",this.historyPointCircleLayer+"-inner"]},clickLayers(){return[this.forecastNameLayer,this.historyLayer]},computeTime(){return(o,e)=>{if(o){const a=v(o).utcOffset(e),r=e<0?e:"+"+e;return`${a==null?void 0:a.format("MMM-DD/HHmm")} (UTC${r}) ${a==null?void 0:a.fromNow()} `}return"-"}},computeTzTime(){return(o,e,a="MM-DD HH:mm")=>{var r,i;if(o){const l=e||0,n=(i=(r=v(o))==null?void 0:r.utcOffset(l))==null?void 0:i.format(a),c=`(UTC ${l>=0?"+":""}${l})`;return n+" "+c}return"-"}},computeTimezone(){return this.timeZone<0?this.timeZone:"+"+this.timeZone},computeBF(){return function(o){const e=la.kts2ms(o);return la.beaufort(e)}},computeMovement(){return function(o){var e,a;return(a=(e=o==null?void 0:o.forecasts)==null?void 0:e.find(r=>!r.disabled))==null?void 0:a.movement}},computePosition(){return o=>!o||o.lng===null||o.lng===void 0||isNaN(o.lng)||o.lat===null||o.lat===void 0||isNaN(o.lat)?"-":M.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty+" / "+M.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},map:{handler(){this.map?(this.toggle=localStorage.getItem(this.tropicalCacheKey)==="true"||!1,localStorage.setItem(this.tropicalCacheKey,this.toggle),this.toggle&&this.fetchTropicals()):this.handleClear()}},showTropicalsInfo:{handler(){this.$emit("tropical",this.showTropicalsInfo),this.simple&&this.showTropicalsInfo?this.$nextTick(()=>{var o,e;this.$parent.playerBottom=((e=(o=this.$refs.tropicalsInfo)==null?void 0:o.$el)==null?void 0:e.clientHeight)+10}):this.simple&&(this.$parent.playerBottom=30)},immediate:!0},"tropicals.version":{handler(){this.handleRefresh()}},timeZone:{handler(o,e){o!==e&&this.handleRefresh()}},realTime:{handler(o){this.map&&o&&this.toggle&&this.handleRender()}},locale:{handler(o){this.map&&this.toggle&&this.handleRefresh()}}},methods:{handleMenuToggle(){var o,e,a;this.toggle=!this.toggle,localStorage.setItem(this.tropicalCacheKey,this.toggle),this.toggle?this.fetchTropicals():(this.handleClear(),(a=(e=(o=this.$parent)==null?void 0:o.$refs)==null?void 0:e.idmBottomBar)==null||a.handleToggle("tropical",!1))},async fetchTropicals(){var i,l,n;const o=new Date().valueOf();let e=0,a=0,r=(i=eo.LayerHelper.WEATHER_LAYERS.find(c=>c.key==="tropicals"))==null?void 0:i.weight;if(r>0){const c=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],s=await ce.get(`${c}/api/arc/weather/layers2/links?l=${r}&v=${this.forecastModel}&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});if(a=new Date().valueOf()-(o+e),console.log("weather links elapsed: ",a,", total: ",e+=a),((l=s==null?void 0:s.data)==null?void 0:l.code)===0){const m=(n=s==null?void 0:s.data)==null?void 0:n.data;await ce.get(m.tropicals,{headers:{Authorization:this.defaultMeteoToken,key:"tropicals"},responseType:/\.(jpg|png)$/.test(m.tropicals)?"blob":"json"}).then(d=>{var y,p,h;const g=M.TropicalHelper.convert2Geojson(((y=d==null?void 0:d.data)==null?void 0:y.data)||(d==null?void 0:d.data));((h=(p=d==null?void 0:d.config)==null?void 0:p.headers)==null?void 0:h.key)&&g&&(this.tropicals={data:g,active:!0,cached:!0,type:"json",etime:s.data.etime,version:Math.random()+1})}).catch(d=>{console.log(`tropicals fetch layer error: ${d}`)})}a=new Date().valueOf()-(o+e),console.log("tropicals elapsed: ",a,", total: ",e+=a)}},handleRefresh(){var e,a;(((a=(e=this.tropicals)==null?void 0:e.data)==null?void 0:a.features)||[]).forEach(r=>{var l,n,c,s,m,d,g,u,y,p,h,f,w,b,L,k,C,A,_;let i="";switch(!0){case(((l=r.properties.wind)==null?void 0:l.kts)<32||((n=r.properties)==null?void 0:n.kts)<32):i="td";break;case(((c=r.properties.wind)==null?void 0:c.kts)<47||((s=r.properties)==null?void 0:s.kts)<47):i="ts";break;case(((m=r.properties.wind)==null?void 0:m.kts)<63||((d=r.properties)==null?void 0:d.kts)<63):i="sts";break;case(((g=r.properties.wind)==null?void 0:g.kts)<79||((u=r.properties)==null?void 0:u.kts)<79):i="ty";break;case(((y=r.properties.wind)==null?void 0:y.kts)<94||((p=r.properties)==null?void 0:p.kts)<94):i="sty";break;case(((h=r.properties.wind)==null?void 0:h.kts)>=94||((f=r.properties)==null?void 0:f.kts)>=94):i="superTy";break;default:i="superTy";break}r.properties.levelI18n=i,((w=r.geometry)==null?void 0:w.type)==="Point"&&((b=r.properties)!=null&&b.important)&&(r.properties.format=(k=(L=v(r.properties.date))==null?void 0:L.utcOffset(this.timeZone))==null?void 0:k.format(`MMM-DD/HHmm [(utc${this.computeTimezone})]`)),((C=r.geometry)==null?void 0:C.type)==="Point"&&(r.properties.Name=((_=(A=r.properties.name)==null?void 0:A.trim())==null?void 0:_.replace(/^./,z=>z.toUpperCase()))||r.properties.nameCn,r.properties.nameCn=r.properties.nameCn||r.properties.Name||"-")}),this.handleInit()},handleInit(){var o,e,a,r,i,l,n,c,s,m,d,g;this.handleClear(),this.tropicals&&this.map&&(this.handleRender(),(o=this.map)==null||o.on("click",this.clickLayers,this.handleClick),(e=this.map)==null||e.on("mousemove",this.hoverLayers,this.handleHover),(a=this.map)==null||a.on("mouseleave",this.hoverLayers,this.handleLeave)),((l=(i=(r=this.tropicals)==null?void 0:r.data)==null?void 0:i.features)==null?void 0:l.length)>0?(s=(c=(n=this.$parent)==null?void 0:n.$refs)==null?void 0:c.idmBottomBar)==null||s.handleToggle("tropical",!0):(g=(d=(m=this.$parent)==null?void 0:m.$refs)==null?void 0:d.idmBottomBar)==null||g.handleToggle("tropical",!1)},handleRender(){var o,e,a,r,i,l,n,c,s,m;if(this.tropicals&&this.map){const d=new Date().valueOf();let g=0,u=0;(o=this.map)!=null&&o.getSource(this.source)?((a=this.map)==null||a.getSource(this.source).setData((e=this.tropicals)!=null&&e.active?this.tropicals.data:this.empty),u=new Date().valueOf()-(d+g),console.log("[tropicals] update elapsed: ",u,", total: ",g+=u)):(this.map.addSource(this.source,{type:"geojson",data:(r=this.tropicals)!=null&&r.active?(i=this.tropicals)==null?void 0:i.data:this.empty}),this.map.addLayer({id:this.historyLayer,type:"line",source:this.source,filter:["all",["==","$type","LineString"],["==","type","history"],["!=","disabled",!0]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["on-surface"],"line-width":3,"line-opacity":.7}},this.beforeLayer),this.map.addLayer({id:this.forecastLayer,type:"line",source:this.source,filter:["all",["==","$type","LineString"],["==","type","forecast"],["!=","disabled",!0]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["match",["get","model"],"cma",this.Theme.current.value.colors["tropicals-cma"],"jma",this.Theme.current.value.colors["tropicals-jma"],"ecmwf",this.Theme.current.value.colors["tropicals-ecmwf"],"ukm",this.Theme.current.value.colors["tropicals-ukm"],"noaa-at",this.Theme.current.value.colors["tropicals-noaa-at"],"noaa-ep",this.Theme.current.value.colors["tropicals-noaa-ep"],this.Theme.current.value.colors["tropicals-noaa-other"]],"line-width":2,"line-opacity":1,"line-dasharray":[1,2]}},this.beforeLayer),this.map.addLayer({id:this.forecastModelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","LineString"],["==","type","forecast"],["!=","disabled",!0]],layout:{"symbol-placement":"line","text-field":"{model}","text-rotation-alignment":"viewport","text-size":12},paint:{"text-color":this.Theme.current.value.dark?"#333":"#fff","text-opacity":1,"text-halo-color":["match",["get","model"],"cma",this.Theme.current.value.colors["tropicals-cma"],"jma",this.Theme.current.value.colors["tropicals-jma"],"ecmwf",this.Theme.current.value.colors["tropicals-ecmwf"],"ukm",this.Theme.current.value.colors["tropicals-ukm"],"noaa-at",this.Theme.current.value.colors["tropicals-noaa-at"],"noaa-ep",this.Theme.current.value.colors["tropicals-noaa-ep"],this.Theme.current.value.colors["tropicals-noaa-other"]],"text-halo-width":4}},this.beforeLayer),u=new Date().valueOf()-(d+g),console.log("[tropical] add elapsed: ",u,", total: ",g+=u)),(l=this.map)!=null&&l.getSource(this.clusterSource)?((c=this.map)==null||c.getSource(this.clusterSource).setData((n=this.tropicals)!=null&&n.active?this.tropicals.data:this.empty),u=new Date().valueOf()-(d+g),console.log("[tropical] update elapsed: ",u,", total: ",g+=u)):(this.map.addSource(this.clusterSource,{type:"geojson",data:(s=this.tropicals)!=null&&s.active?(m=this.tropicals)==null?void 0:m.data:this.empty}),this.map.addLayer({id:this.pointCircleLayer+"-border",type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","forecast"],["!=","disabled",!0]],paint:{"circle-radius":5,"circle-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.pointCircleLayer,type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","forecast"],["!=","disabled",!0]],paint:{"circle-radius":4,"circle-color":["case",["boolean",["==",["get","kts",["get","wind"]],null]],this.Theme.current.value.colors["tropicals-td"],["boolean",["<",["get","kts",["get","wind"]],32]],this.Theme.current.value.colors["tropicals-td"],["boolean",["<",["get","kts",["get","wind"]],47]],this.Theme.current.value.colors["tropicals-ts"],["boolean",["<",["get","kts",["get","wind"]],63]],this.Theme.current.value.colors["tropicals-sts"],["boolean",["<",["get","kts",["get","wind"]],79]],this.Theme.current.value.colors["tropicals-ty"],["boolean",["<",["get","kts",["get","wind"]],94]],this.Theme.current.value.colors["tropicals-sty"],["boolean",[">=",["get","kts",["get","wind"]],94]],this.Theme.current.value.colors["tropicals-super-ty"],"#fff"]}},this.beforeLayer),this.map.addLayer({id:this.pointLabelLayer,type:"symbol",source:this.clusterSource,minzoom:5,filter:["all",["==","$type","Point"],["==","type","forecast"],["!=","disabled",!0]],layout:{"text-field":["get","format"],"text-offset":[1,0],"text-anchor":"left","text-size":10},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.historyPointCircleLayer+"-border",type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],paint:{"circle-radius":6,"circle-color":"#fff"}},this.beforeLayer),this.map.addLayer({id:this.historyPointCircleLayer,type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],paint:{"circle-radius":5,"circle-color":"rgba(0,0,0,0.7)"}},this.beforeLayer),this.map.addLayer({id:this.historyPointCircleLayer+"-inner",type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],paint:{"circle-radius":3,"circle-color":"#fff"}},this.beforeLayer),this.map.addLayer({id:this.historyPointLabelLayer,type:"symbol",source:this.clusterSource,minzoom:5,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],layout:{"text-field":["get","format"],"text-offset":[1,0],"text-anchor":"left","text-size":10},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.forecastNameLayer,type:"symbol",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","forecast"],["==","important",!0]],layout:{"text-field":["get",this.locale==="en"?"Name":"nameCn"],"text-anchor":"bottom","text-size":16,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-font":["DIN Pro Regular","Arial Unicode MS Regular"],"text-offset":[0,2]},paint:{"text-color":this.Theme.current.value.colors["map-blue"],"text-halo-color":"#ffffff","text-halo-width":2}},this.beforeLayer),u=new Date().valueOf()-(d+g),console.log("[tropical] add elapsed: ",u,", total: ",g+=u));const y=M.TropicalHelper.interpolate(this.tropicals,1);this.interpolateData=JSON.parse(JSON.stringify(y)),this.handleDateChange()}},handleClear(){var o,e,a,r;this.map&&(this.map.getLayer(this.historyLayer)&&this.map.removeLayer(this.historyLayer),this.map.getLayer(this.forecastLayer)&&this.map.removeLayer(this.forecastLayer),this.map.getLayer(this.forecastModelLayer)&&this.map.removeLayer(this.forecastModelLayer),this.map.getLayer(this.forecastNameLayer)&&this.map.removeLayer(this.forecastNameLayer),this.map.getLayer(this.pointCircleLayer)&&this.map.removeLayer(this.pointCircleLayer),this.map.getLayer(this.pointCircleLayer+"-border")&&this.map.removeLayer(this.pointCircleLayer+"-border"),this.map.getLayer(this.pointLabelLayer)&&this.map.removeLayer(this.pointLabelLayer),this.map.getLayer(this.historyPointCircleLayer)&&this.map.removeLayer(this.historyPointCircleLayer),this.map.getLayer(this.historyPointCircleLayer+"-border")&&this.map.removeLayer(this.historyPointCircleLayer+"-border"),this.map.getLayer(this.historyPointCircleLayer+"-inner")&&this.map.removeLayer(this.historyPointCircleLayer+"-inner"),this.map.getLayer(this.historyPointLabelLayer)&&this.map.removeLayer(this.historyPointLabelLayer),this.map.getLayer(this.interpolateLineLayer)&&this.map.removeLayer(this.interpolateLineLayer),(o=this.interpolateMarkers)==null||o.forEach(i=>i==null?void 0:i.remove()),this.map.getSource(this.source)&&this.map.removeSource(this.source),this.map.getSource(this.clusterSource)&&this.map.removeSource(this.clusterSource),this.map.getSource(this.interpolateSource)&&this.map.removeSource(this.interpolateSource)),(e=this.map)==null||e.off("click",this.clickLayers,this.handleClick),(a=this.map)==null||a.off("mousemove",this.hoverLayers,this.handleHover),(r=this.map)==null||r.off("mouseleave",this.hoverLayers,this.handleLeave),this.handleCloseInfoMarker()},handleDateChange(){var o,e,a,r,i,l,n,c,s,m,d,g,u,y,p,h,f,w,b,L,k,C,A,_,z,P,V,N,j,U,K,de,ne,S,Z;if((o=this.interpolateMarkers)==null||o.forEach(H=>H==null?void 0:H.remove()),(e=this.interpolateData)!=null&&e.length&&this.tropicals.active){const H=v(this.realTime).utc().set({minute:0,second:0,millisecond:0}),q=this.interpolateData.filter(E=>E.properties.date===(H==null?void 0:H.format())&&!E.properties.disabled),W=this.handleComputePolygons(q),B=T.featureCollection([...q]);W.forEach(E=>{B.features.push(E)}),(a=this.map)!=null&&a.getSource(this.interpolateSource)?(r=this.map)==null||r.getSource(this.interpolateSource).setData(B):((i=this.map)==null||i.addSource(this.interpolateSource,{type:"geojson",data:B}),(l=this.map)==null||l.addLayer({id:this.interpolateLineLayer,type:"line",source:this.interpolateSource,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"line-opacity":1,"line-color":["match",["get","level"],7,this.Theme.current.value.colors["tropicals-r7"],10,this.Theme.current.value.colors["tropicals-r10"],this.Theme.current.value.colors["tropicals-r10"]],"line-width":1}},"empty-layer-3")),this.interpolateMarkers=[];const J=[];for(const E of q)if(!E.properties.disabled){if(!J.some(oe=>{var he;return oe.properties.name===((he=E.properties)==null?void 0:he.name)})){const oe=((c=(n=this.tropicals.data.features.find(he=>{var X;return he.properties.name===((X=E.properties)==null?void 0:X.name)}))==null?void 0:n.properties)==null?void 0:c.nameCn)||((s=E.properties)==null?void 0:s.Name)||"-";E.properties.nameCn=oe,E.properties.Name=((d=(m=E.properties.name)==null?void 0:m.trim())==null?void 0:d.replace(/^./,he=>he.toUpperCase()))||E.properties.nameCn,J.push(E)}let I=this.Theme.current.value.colors["tropicals-ty"];((u=(g=E.properties)==null?void 0:g.wind)==null?void 0:u.kts)<32||!((p=(y=E.properties)==null?void 0:y.wind)!=null&&p.kts)?I=this.Theme.current.value.colors["tropicals-td"]:((f=(h=E.properties)==null?void 0:h.wind)==null?void 0:f.kts)>=32&&((b=(w=E.properties)==null?void 0:w.wind)==null?void 0:b.kts)<47?I=this.Theme.current.value.colors["tropicals-ts"]:((k=(L=E.properties)==null?void 0:L.wind)==null?void 0:k.kts)>=47&&((A=(C=E.properties)==null?void 0:C.wind)==null?void 0:A.kts)<63?I=this.Theme.current.value.colors["tropicals-sts"]:((z=(_=E.properties)==null?void 0:_.wind)==null?void 0:z.kts)>=63&&((V=(P=E.properties)==null?void 0:P.wind)==null?void 0:V.kts)<79?I=this.Theme.current.value.colors["tropicals-ty"]:((j=(N=E.properties)==null?void 0:N.wind)==null?void 0:j.kts)>=79&&((K=(U=E.properties)==null?void 0:U.wind)==null?void 0:K.kts)<94?I=this.Theme.current.value.colors["tropicals-sty"]:((ne=(de=E.properties)==null?void 0:de.wind)==null?void 0:ne.kts)>=94?I=this.Theme.current.value.colors["tropicals-super-ty"]:I=this.Theme.current.value.colors["tropicals-ty"];const ie=`<svg t="1719918955501"
|
|
204
204
|
class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" p-id="18382"
|
|
205
205
|
xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200">
|
|
206
206
|
<path
|
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
fill="#ffffff" p-id="18386"></path>
|
|
217
217
|
</svg>`,ge=document.createElement("div");ge.className="idm-tropical-gl4-hourly-marker",ge.innerHTML=`<div class="${E.geometry.coordinates[1]>=0?"center north":"center south"}">${ie}</div>`;const ue=new me.Marker(ge).setLngLat(E.geometry.coordinates).addTo(this.map);this.interpolateMarkers.push(ue)}this.$emit("tropicalCenterPoints",J)}else(S=this.map)!=null&&S.getSource(this.interpolateSource)&&((Z=this.map)==null||Z.getSource(this.interpolateSource).setData(this.empty))},handleClick(o){var i,l,n,c,s,m,d,g,u,y,p;const e=o.features[0],a=(l=(i=this.tropicals)==null?void 0:i.data)==null?void 0:l.features.filter(h=>{var f;return h.geometry.type==="LineString"&&h.properties.type==="forecast"&&h.properties.name===((f=e==null?void 0:e.properties)==null?void 0:f.name)}),r=(c=(n=this.tropicals)==null?void 0:n.data)==null?void 0:c.features.filter(h=>{var f;return h.geometry.type==="LineString"&&h.properties.type==="history"&&h.properties.name===((f=e==null?void 0:e.properties)==null?void 0:f.name)});this.activeTropicals={name:((s=e==null?void 0:e.properties)==null?void 0:s.name)||"-",nameCn:((m=e==null?void 0:e.properties)==null?void 0:m.nameCn)||((d=e==null?void 0:e.properties)==null?void 0:d.name)||"-",Name:((g=e==null?void 0:e.properties)==null?void 0:g.Name)||"-",forecasts:a.map(h=>h.properties),history:(u=r[0])==null?void 0:u.properties,showCircle:(p=(y=a[0])==null?void 0:y.properties)==null?void 0:p.showCircle},this.showTropicalsInfo=!0,this.simple||this.drawTropicalsInfoMaker([o.lngLat.lng,o.lngLat.lat])},drawTropicalsInfoMaker(o){this.$nextTick(()=>{const e=document.getElementById("idm-tropical-gl4-info");this.activeTropicalsMarker?this.activeTropicalsMarker.setLngLat(o).setOffset([220,0]):this.activeTropicalsMarker=new me.Marker(e).setLngLat(o).setOffset([220,0]).addTo(this.map)})},handleCloseInfoMarker(){this.showTropicalsInfo=!1,this.$nextTick(()=>{var o;(o=this.activeTropicalsMarker)==null||o.remove(),this.activeTropicalsMarker=void 0})},handleForecastToggle(o){var r,i,l,n,c,s;o.disabled=!o.disabled;const e=`${o.name}-${o.model}`,a=(i=(r=this.map)==null?void 0:r.getSource(this.source)._data)==null?void 0:i.features;a.forEach(m=>{m.properties.category===e&&(m.properties.disabled=o.disabled)}),this.interpolateData.forEach(m=>{m.properties.category===e&&(m.properties.disabled=o.disabled)}),(n=(l=this.map)==null?void 0:l.getSource(this.source))==null||n.setData(T.featureCollection(a)),(s=(c=this.map)==null?void 0:c.getSource(this.clusterSource))==null||s.setData(T.featureCollection(a)),this.handleDateChange()},handleStrikeProbability(o){this.$emit("tropicalProbability",o)},handleToggleCircles(o){var e,a;o.showCircle=!o.showCircle,(a=(e=this.tropicals.data)==null?void 0:e.features)==null||a.forEach(r=>{r.properties.name===o.name&&(r.properties.showCircle=o.showCircle)}),this.handleRender()},handleComputePolygons(o){const e=[];for(const a of o){const r=a.properties.wind,i={ne:r.r7ne>=0?r.r7ne:void 0,se:r.r7se>=0?r.r7se:void 0,sw:r.r7sw>=0?r.r7sw:void 0,nw:r.r7nw>=0?r.r7nw:void 0},l=this.handleComputeArc(a.geometry.coordinates,i,{...a.properties,level:7});e.push(l);const n={ne:r.r10ne>=0?r.r10ne:void 0,se:r.r10se>=0?r.r10se:void 0,sw:r.r10sw>=0?r.r10sw:void 0,nw:r.r10nw>=0?r.r10nw:void 0},c=this.handleComputeArc(a.geometry.coordinates,n,{...a.properties,level:10});e.push(c)}return e},handleComputeArc(o,e,a){var l;const r=[];for(const n in e){const c=e[n]??0;let s;switch(n){case"ne":s=T.lineArc(o,c,0,90,{steps:c>0?32:1,units:"nauticalmiles"});break;case"se":s=T.lineArc(o,c,90,180,{steps:c>0?32:1,units:"nauticalmiles"});break;case"sw":s=T.lineArc(o,c,180,270,{steps:c>0?32:1,units:"nauticalmiles"});break;case"nw":s=T.lineArc(o,c,270,360,{steps:c>0?32:1,units:"nauticalmiles"});break}r.push(...(l=s==null?void 0:s.geometry)==null?void 0:l.coordinates)}const i=T.lineString(r);return T.lineToPolygon(i,{properties:a})},handleNotification(o){this.$emit("tropicalNotification",o)},handleHover(o){var i,l,n,c,s;this.map.getCanvas().style.cursor="pointer";const a=this.map.queryRenderedFeatures(o.point,{layers:[this.pointCircleLayer,this.pointCircleLayer+"-border",this.historyPointCircleLayer,this.historyPointCircleLayer+"-border",this.historyPointCircleLayer+"-inner"]})[0];this.hoverPoint=a==null?void 0:a.properties;const r=(l=(i=this.tropicals)==null?void 0:i.data)==null?void 0:l.features.filter(m=>{var d;return m.geometry.type==="LineString"&&m.properties.type==="forecast"&&m.properties.name===((d=a==null?void 0:a.properties)==null?void 0:d.name)});this.hoverPoint&&(this.hoverPoint.lng=a.geometry.coordinates[0],this.hoverPoint.lat=a.geometry.coordinates[1],this.hoverPoint.update=(c=(n=r==null?void 0:r[0])==null?void 0:n.properties)==null?void 0:c.date,(s=this.hoverMarker)==null||s.remove(),this.showHoverPoint=!0,this.$nextTick(()=>{const m=document.getElementById("tropicalHoverMarkerInfo").cloneNode(!0);this.hoverMarker=new me.Marker(m).setLngLat(a.geometry.coordinates).setOffset([160,0]).addTo(this.map)}))},handleLeave(){var o;this.map.getCanvas().style.cursor="grab",this.showHoverPoint=!1,(o=this.hoverMarker)==null||o.remove(),this.hoverMarker=void 0}}},cd={class:"idm-tropical-gl4"},md={class:"pb-1"},dd={class:"text-h5 font-weight-600"},hd={key:0,class:"text-h5 font-weight-600"},pd={class:"text-body-1"},gd={class:"text-label"},ud={class:"d-flex justify-space-between align-center"},fd={class:"w-60"},yd={class:"text-label pr-1"},bd={class:"flex-1-1-0"},wd={class:"text-label pr-1"},xd={class:"py-2 d-flex justify-space-between align-center"},kd={class:"w-60"},Ad={class:"text-label pr-1"},Ld={class:"flex-1-1-0"},Cd={class:"text-label pr-1"},vd={class:"d-flex align-center flex-1-1-100 justify-start mt-n1"},zd={class:"text-label pr-1",style:{width:"70px"}},_d={class:"model-box d-flex justify-end align-center flex-wrap ga-1 pa-1"},Sd={class:"more"},Nd={key:0,class:"w-100 d-flex justify-space-between align-center px-2"},Md={class:"pa-1"},Pd={class:"legend d-flex justify-start align-center py-2"},Vd={class:"label"},Td={class:"legend d-flex justify-start align-center py-2"},Ed={class:"label"},Dd={class:"legend d-flex justify-start align-center py-2"},Rd={class:"label"},Bd={class:"pa-1"},Id={class:"legend d-flex justify-start align-center py-2"},Fd={class:"label"},Gd={class:"legend d-flex justify-start align-center py-2"},jd={class:"label"},Wd={class:"legend d-flex justify-start align-center py-2"},Zd={class:"label"},Xd={class:"pa-1"},Hd={class:"w-100 legend d-flex justify-start align-center py-2 ga-2"},Od={class:"label"},Yd={class:"label"},Ud={class:"w-100 legend d-flex justify-start align-center py-2"},Jd={class:"label"},Kd={class:"w-100 legend d-flex justify-start align-center py-2"},Qd={class:"label"},qd={key:1,class:"my-3 w-100",style:{height:"80px"}},$d={class:"legend d-flex justify-start align-center"},eh={class:"label"},th={class:"legend d-flex justify-start align-center"},oh={class:"label"},ah={class:"legend d-flex justify-start align-center"},ih={class:"label"},rh={class:"legend d-flex justify-start align-center"},lh={class:"label"},nh={class:"legend d-flex justify-start align-center"},sh={class:"label"},ch={class:"legend d-flex justify-start align-center"},mh={class:"label"},dh={class:"legend d-flex justify-start align-center"},hh={class:"label"},ph={class:"legend d-flex justify-start align-center"},gh={class:"label"},uh={class:"legend d-flex justify-start align-center"},fh={class:"label"},yh={class:"legend d-flex justify-start align-center"},bh={class:"label"},wh={class:"d-flex justify-star align-center"},xh={class:"font-weight-600 mr-1"},kh={class:""},Ah={class:"d-flex flex-column justify-center align-start ga-2"},Lh={key:0,class:"d-flex justify-start align-center"},Ch={class:"text-label pr-1"},vh={key:1,class:"d-flex justify-start align-center"},zh={class:"text-label pr-1"},_h={key:2,class:"d-flex justify-start align-center"},Sh={class:"text-label pr-1"},Nh={key:3,class:"d-flex justify-start align-center"},Mh={class:"text-label pr-1"},Ph={key:4,class:"d-flex justify-start align-center"},Vh={class:"text-label pr-1"},Th={key:5,class:"d-flex justify-start align-center"},Eh={class:"text-label pr-1"},Dh={class:"d-flex justify-start align-center"},Rh={class:"text-label pr-1"},Bh={key:6,class:"d-flex justify-start align-center"},Ih={class:"text-label pr-1"},Fh={key:7,class:"d-flex justify-start align-center"},Gh={class:"text-label pr-1"},jh={class:"d-flex justify-start align-center"},Wh={class:"text-label pr-1"};function Zh(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardText"),m=t.resolveComponent("VDivider"),d=t.resolveComponent("VCardActions"),g=t.resolveComponent("VCard"),u=t.resolveComponent("VCardTitle");return t.openBlock(),t.createElementBlock("div",cd,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+86+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("tropical.tropicals"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:y})=>[t.createVNode(n,t.mergeProps(y,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[2]||(e[2]=[t.createElementVNode("i",{class:"iconfont icon-Tropical text-h4"},null,-1)])),_:2,__:[2]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),i.showTropicalsInfo&&!o.$attrs.hideTropicalsLegend?(t.openBlock(),t.createElementBlock("div",{key:0,id:"idm-tropical-gl4-info",ref:"tropicalsInfo",class:t.normalizeClass(["idm-tropical-gl4-info",a.simple?"page":"dialog"])},[t.createVNode(g,{class:t.normalizeClass(["w-100",a.simple?"rounded-t-4 bg-none":""]),elevation:a.simple?0:16},{default:t.withCtx(()=>[t.createVNode(s,null,{default:t.withCtx(()=>{var y,p,h,f,w,b,L,k,C,A,_,z;return[t.createElementVNode("div",md,[t.createElementVNode("span",dd,t.toDisplayString(a.locale==="en"?(y=i.activeTropicals)==null?void 0:y.Name:((p=i.activeTropicals)==null?void 0:p.nameCn)||((h=i.activeTropicals)==null?void 0:h.Name)||"-"),1),(w=(f=i.activeTropicals)==null?void 0:f.history)!=null&&w.levelI18n?(t.openBlock(),t.createElementBlock("span",hd," , "+t.toDisplayString(o.$t("tropical."+((L=(b=i.activeTropicals)==null?void 0:b.history)==null?void 0:L.levelI18n))),1)):t.createCommentVNode("",!0)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"close",onClick:t.withModifiers(l.handleCloseInfoMarker,["stop"])},{default:t.withCtx(()=>e[3]||(e[3]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[3]},8,["onClick"]),t.createElementVNode("div",pd,[t.createElementVNode("span",gd,t.toDisplayString(o.$t("actions.lastUpdate"))+": ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTime(((C=(k=i.activeTropicals)==null?void 0:k.history)==null?void 0:C.updated)||((z=(_=(A=i.activeTropicals)==null?void 0:A.forecasts)==null?void 0:_.filter(P=>!P.disabled)[0])==null?void 0:z.date),a.timeZone)),1)])]}),_:1}),t.createVNode(m),t.createVNode(s,{class:"text-body-1 py-3"},{default:t.withCtx(()=>{var y,p,h,f,w,b,L,k,C;return[t.createElementVNode("div",ud,[t.createElementVNode("div",fd,[t.createElementVNode("label",yd,t.toDisplayString(o.$t("weather.windSpeed"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((p=(y=i.activeTropicals)==null?void 0:y.history)==null?void 0:p.kts)||"-")+" kts",1),t.createElementVNode("span",null,", BF "+t.toDisplayString(l.computeBF(((f=(h=i.activeTropicals)==null?void 0:h.history)==null?void 0:f.kts)||"-")),1)]),t.createElementVNode("div",bd,[t.createElementVNode("label",wd,t.toDisplayString(o.$t("weather.pressure"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((b=(w=i.activeTropicals)==null?void 0:w.history)==null?void 0:b.pressure)||"-")+" hPa",1)])]),t.createElementVNode("div",xd,[t.createElementVNode("div",kd,[t.createElementVNode("label",Ad,t.toDisplayString(o.$t("tropical.moveSpeed"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((L=l.computeMovement(i.activeTropicals))==null?void 0:L.kts)||"-")+" kts",1)]),t.createElementVNode("div",Ld,[t.createElementVNode("label",Cd,t.toDisplayString(o.$t("tropical.moveDir"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((k=l.computeMovement(i.activeTropicals))==null?void 0:k.deg)||"-")+"°",1)])]),t.createElementVNode("div",vd,[t.createElementVNode("label",zd,t.toDisplayString(o.$t("tropical.models"))+" : ",1),t.createElementVNode("div",_d,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList((C=i.activeTropicals)==null?void 0:C.forecasts,(A,_)=>(t.openBlock(),t.createBlock(n,{key:_,density:"compact",variant:A.disabled?"text":"flat",color:A.disabled?"":"primary","min-width":30,class:t.normalizeClass(["model text-none text-body-1 px-1",A.disabled?"btn-border-1 btn-bg-1":""]),onClick:t.withModifiers(z=>l.handleForecastToggle(A),["stop"])},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(A.model),1)]),_:2},1032,["variant","color","class","onClick"]))),128))])])]}),_:1}),t.createVNode(m),a.simple?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(d,{key:0,class:"d-flex justify-space-between"},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact","prepend-icon":"",variant:"text",color:i.showLegend?"primary":"",class:"text-none text-body-1",onClick:e[0]||(e[0]=t.withModifiers(y=>i.showLegend=!i.showLegend,["stop"]))},{prepend:t.withCtx(()=>e[4]||(e[4]=[t.createElementVNode("i",{class:"iconfont icon-Legend text-h4"},null,-1)])),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(o.$t("weather.legend")),1)]),_:1},8,["color"]),t.createElementVNode("div",Sd,[t.createVNode(n,{variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:e[1]||(e[1]=t.withModifiers(y=>l.handleStrikeProbability(i.activeTropicals),["stop"]))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.viewReport")),1)]),_:1})])]),_:1}))]),_:1},8,["class","elevation"]),a.simple?(t.openBlock(),t.createElementBlock("div",Nd,[t.createElementVNode("div",Md,[t.createElementVNode("div",Pd,[e[5]||(e[5]=t.createElementVNode("div",{class:"icon td"},null,-1)),t.createElementVNode("div",Vd,t.toDisplayString(o.$t("tropical.td")),1)]),t.createElementVNode("div",Td,[e[6]||(e[6]=t.createElementVNode("div",{class:"icon sts"},null,-1)),t.createElementVNode("div",Ed,t.toDisplayString(o.$t("tropical.sts")),1)]),t.createElementVNode("div",Dd,[e[7]||(e[7]=t.createElementVNode("div",{class:"icon sty"},null,-1)),t.createElementVNode("div",Rd,t.toDisplayString(o.$t("tropical.sty")),1)])]),t.createElementVNode("div",Bd,[t.createElementVNode("div",Id,[e[8]||(e[8]=t.createElementVNode("div",{class:"icon ts"},null,-1)),t.createElementVNode("div",Fd,t.toDisplayString(o.$t("tropical.ts")),1)]),t.createElementVNode("div",Gd,[e[9]||(e[9]=t.createElementVNode("div",{class:"icon ty"},null,-1)),t.createElementVNode("div",jd,t.toDisplayString(o.$t("tropical.ty")),1)]),t.createElementVNode("div",Wd,[e[10]||(e[10]=t.createElementVNode("div",{class:"icon supper-ty"},null,-1)),t.createElementVNode("div",Zd,t.toDisplayString(o.$t("tropical.superTy")),1)])]),t.createElementVNode("div",Xd,[t.createElementVNode("div",Hd,[e[11]||(e[11]=t.createElementVNode("div",{class:"icon history"},null,-1)),t.createElementVNode("div",Od,t.toDisplayString(o.$t("tropical.history")),1),e[12]||(e[12]=t.createElementVNode("div",{class:"icon forecast"},null,-1)),t.createElementVNode("div",Yd,t.toDisplayString(o.$t("tropical.forecast")),1)]),t.createElementVNode("div",Ud,[e[13]||(e[13]=t.createElementVNode("div",{class:"icon r7"},null,-1)),t.createElementVNode("div",Jd,"35kts "+t.toDisplayString(o.$t("tropical.radii")),1)]),t.createElementVNode("div",Kd,[e[14]||(e[14]=t.createElementVNode("div",{class:"icon r10"},null,-1)),t.createElementVNode("div",Qd,"50kts "+t.toDisplayString(o.$t("tropical.radii")),1)])])])):(t.openBlock(),t.createElementBlock("div",qd,[t.withDirectives(t.createVNode(g,{elevation:"16"},{default:t.withCtx(()=>[t.createVNode(s,null,{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["pa-1 d-flex justify-space-between align-center flex-wrap",a.locale==="zhHans"?" ga-2":" ga-3"])},[t.createElementVNode("div",$d,[e[15]||(e[15]=t.createElementVNode("div",{class:"icon td"},null,-1)),t.createElementVNode("div",eh,t.toDisplayString(o.$t("tropical.td")),1)]),t.createElementVNode("div",th,[e[16]||(e[16]=t.createElementVNode("div",{class:"icon ts"},null,-1)),t.createElementVNode("div",oh,t.toDisplayString(o.$t("tropical.ts")),1)]),t.createElementVNode("div",ah,[e[17]||(e[17]=t.createElementVNode("div",{class:"icon sts"},null,-1)),t.createElementVNode("div",ih,t.toDisplayString(o.$t("tropical.sts")),1)]),t.createElementVNode("div",rh,[e[18]||(e[18]=t.createElementVNode("div",{class:"icon ty"},null,-1)),t.createElementVNode("div",lh,t.toDisplayString(o.$t("tropical.ty")),1)]),t.createElementVNode("div",nh,[e[19]||(e[19]=t.createElementVNode("div",{class:"icon sty"},null,-1)),t.createElementVNode("div",sh,t.toDisplayString(o.$t("tropical.sty")),1)]),t.createElementVNode("div",ch,[e[20]||(e[20]=t.createElementVNode("div",{class:"icon supper-ty"},null,-1)),t.createElementVNode("div",mh,t.toDisplayString(o.$t("tropical.superTy")),1)]),t.createElementVNode("div",dh,[e[21]||(e[21]=t.createElementVNode("div",{class:"icon history"},null,-1)),t.createElementVNode("div",hh,t.toDisplayString(o.$t("tropical.history")),1)]),t.createElementVNode("div",ph,[e[22]||(e[22]=t.createElementVNode("div",{class:"icon forecast"},null,-1)),t.createElementVNode("div",gh,t.toDisplayString(o.$t("tropical.forecast")),1)]),t.createElementVNode("div",uh,[e[23]||(e[23]=t.createElementVNode("div",{class:"icon r7"},null,-1)),t.createElementVNode("div",fh,"35kts "+t.toDisplayString(o.$t("tropical.radii")),1)]),t.createElementVNode("div",yh,[e[24]||(e[24]=t.createElementVNode("div",{class:"icon r10"},null,-1)),t.createElementVNode("div",bh,"50kts "+t.toDisplayString(o.$t("tropical.radii")),1)])],2),[[t.vShow,i.showLegend]])]),_:1})]),_:1},512),[[t.vShow,i.showLegend]])]))],2)):t.createCommentVNode("",!0),t.withDirectives(t.createVNode(g,{id:"tropicalHoverMarkerInfo",elevation:"16","max-width":"290"},{default:t.withCtx(()=>[t.createVNode(u,null,{default:t.withCtx(()=>{var y,p,h,f;return[t.createElementVNode("div",wh,[t.createElementVNode("span",xh,t.toDisplayString(a.locale==="en"?(y=i.hoverPoint)==null?void 0:y.Name:((p=i.hoverPoint)==null?void 0:p.nameCn)||((h=i.hoverPoint)==null?void 0:h.Name)),1),t.createElementVNode("span",kh," ["+t.toDisplayString(o.$t("tropical."+((f=i.hoverPoint)==null?void 0:f.levelI18n)))+"]",1)])]}),_:1}),t.createVNode(m),t.createVNode(s,{class:"text-body-1"},{default:t.withCtx(()=>{var y,p,h,f,w,b,L,k,C,A,_,z,P,V,N,j,U,K,de,ne;return[t.createElementVNode("div",Ah,[((y=i.hoverPoint)==null?void 0:y.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",Lh,[t.createElementVNode("label",Ch,t.toDisplayString(o.$t("tropical.updated"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTzTime((p=i.hoverPoint)==null?void 0:p.update,a.timeZone)),1)])):t.createCommentVNode("",!0),((h=i.hoverPoint)==null?void 0:h.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",vh,[t.createElementVNode("label",zh,t.toDisplayString(o.$t("tropical.forecast"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTzTime((f=i.hoverPoint)==null?void 0:f.date,a.timeZone)),1)])):t.createCommentVNode("",!0),((w=i.hoverPoint)==null?void 0:w.type)==="history"?(t.openBlock(),t.createElementBlock("div",_h,[t.createElementVNode("label",Sh,t.toDisplayString(o.$t("tropical.forecast"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTzTime((b=i.hoverPoint)==null?void 0:b.date,a.timeZone)),1)])):t.createCommentVNode("",!0),((L=i.hoverPoint)==null?void 0:L.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",Nh,[t.createElementVNode("label",Mh,t.toDisplayString(o.$t("tropical.model"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((k=i.hoverPoint)==null?void 0:k.model)??"-"),1)])):t.createCommentVNode("",!0),((C=i.hoverPoint)==null?void 0:C.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",Ph,[t.createElementVNode("label",Vh,t.toDisplayString(o.$t("weather.wind"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((_=JSON.parse(((A=i.hoverPoint)==null?void 0:A.wind)||"{}"))==null?void 0:_.kts)??"-")+" kts",1)])):t.createCommentVNode("",!0),((z=i.hoverPoint)==null?void 0:z.type)==="history"?(t.openBlock(),t.createElementBlock("div",Th,[t.createElementVNode("label",Eh,t.toDisplayString(o.$t("weather.wind"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((P=i.hoverPoint)==null?void 0:P.kts)??"-")+" kts",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",Dh,[t.createElementVNode("label",Rh,t.toDisplayString(o.$t("weather.pressure"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((V=i.hoverPoint)==null?void 0:V.pressure)??"-")+" hPa",1)]),((N=i.hoverPoint)==null?void 0:N.type)==="history"?(t.openBlock(),t.createElementBlock("div",Bh,[t.createElementVNode("label",Ih,t.toDisplayString(o.$t("tropical.moveSpeed"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((U=JSON.parse(((j=i.hoverPoint)==null?void 0:j.movement)||"{}"))==null?void 0:U.kts)??"-")+" kts",1)])):t.createCommentVNode("",!0),((K=i.hoverPoint)==null?void 0:K.type)==="history"?(t.openBlock(),t.createElementBlock("div",Fh,[t.createElementVNode("label",Gh,t.toDisplayString(o.$t("tropical.moveDir"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((ne=JSON.parse(((de=i.hoverPoint)==null?void 0:de.movement)||"{}"))==null?void 0:ne.deg)??"-")+" °",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",jh,[t.createElementVNode("label",Wh,t.toDisplayString(o.$t("tropical.position"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computePosition(i.hoverPoint)),1)])])]}),_:1})]),_:1},512),[[t.vShow,i.showHoverPoint]])])}const Wo=Q(sd,[["render",Zh]]),rb="",Xh={name:"DateTimePicker",props:{width:{type:Number,default:null},height:{type:Number,default:30},position:{type:String,default:"top"},bgClass:{type:String,default:""},locale:{type:String,default:"en"},style:{type:Object,default:{}},intervalHour:{type:Number,default:3},timeZone:{type:Number},dateTime:{type:String},dayAbout:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1}},emits:["dateTime","currentTimestamp","currentRealTime","minTimestamp","maxTimestamp"],data(){return{showDatePicker:!1,minDate:void 0,maxDate:void 0,minTimestamp:void 0,maxTimestamp:void 0,currentDate:void 0,currentTime:void 0,currentTimestamp:void 0,currentDateTimeZ:void 0,currentDateTime:void 0,currentRealTime:void 0,timer:null}},computed:{getStyle(){const o=this.width||220;return this.position==="top"?{bottom:"40px",left:`-${(420-o)/2}px`}:this.position==="bottom"?{top:"40px",left:`-${(420-o)/2}px`}:this.position==="left"?{bottom:"-140px",left:"-428px"}:this.position==="right"?{bottom:"-140px",right:"-428px"}:{bottom:"40px",left:`-${(420-o)/2}px`}},hourOptions(){const o=[];for(let e=0;e<24;e++)o.push(e<10?`0${e}:00`:`${e}:00`);return o.filter((e,a)=>(a-this.timeZone)%this.intervalHour===0)},timeZoneNames(){return v.tz.names()},timeZoneName(){var o;return(o=this.timeZoneNames.filter(e=>v.tz(v(),e).utcOffset()===this.timeZone*60))==null?void 0:o[0]},utcTimeZoneName(){return"Africa/Abidjan"},localTimeZoneName(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"Asia/Shanghai"}},watch:{timeZone:{handler(o,e){o!==e&&(this.handleResetDateTime(this.dateTime),this.handleResetMinMax())}},dateTime:{handler(o,e){o&&this.handleResetDateTime(this.dateTime)},immediate:!0},currentTimestamp:{handler(){this.currentDateTimeZ=v(this.currentTimestamp).utc().format("yyyy-MM-DD HH:00[Z]"),this.$emit("dateTime",this.currentDateTimeZ),this.$emit("currentTimestamp",this.currentTimestamp),this.currentDateTime=`${v.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`},immediate:!0},currentRealTime:{handler(o,e){o!==e&&this.$emit("currentRealTime",this.currentRealTime)}}},mounted(){this.timer=setInterval(()=>{this.currentRealTime=`${v.tz(v().unix()*1e3,this.timeZoneName).clone().format("HH:mm")}`},100),document.addEventListener("click",this.handleClickOutside)},unmounted(){clearInterval(this.timer),this.handleCancelDate(),document.removeEventListener("click",this.handleClickOutside)},methods:{handleReset(){this.handleResetDateTime(),this.handleResetMinMax()},handleResetDateTime(o){var i;const e=v(o).utc().date(),a=Math.ceil(v(o).utc().hour()/this.intervalHour)*this.intervalHour;this.currentTimestamp=((i=v(o))==null?void 0:i.utc().set({date:e,hour:a,minute:0,second:0,millisecond:0}).unix())*1e3;const r=v.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=r.clone().format("YYYY-MM-DD"),this.currentTime=r.clone().format("HH:00"),this.currentDateTime=`${v.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`,this.currentRealTime=`${v.tz(v().unix()*1e3,this.timeZoneName).clone().format("HH:mm")}`},handleResetMinMax(){var i,l,n,c,s;if(this.dayAbout.h==null||this.dayAbout.f==null)return;const o=v().utc().date(),e=Math.ceil(v().utc().hour()/this.intervalHour)*this.intervalHour,a=((i=v())==null?void 0:i.utc().set({date:o,hour:e,minute:0,second:0,millisecond:0}).unix())*1e3,r=v.tz(a,this.timeZoneName).clone();this.minDate=r.clone().add(this.dayAbout.h,"day").format("yyyy-MM-DD"),this.maxDate=r.clone().add(this.dayAbout.f,"day").format("yyyy-MM-DD"),this.minTimestamp=((n=(l=v())==null?void 0:l.utc())==null?void 0:n.set({date:o+this.dayAbout.h,hour:0,minute:0,second:0,millisecond:0}).unix())*1e3,this.maxTimestamp=((s=(c=v())==null?void 0:c.utc())==null?void 0:s.set({date:o+this.dayAbout.f,hour:0,minute:0,second:0,millisecond:0}).unix())*1e3,this.$emit("minTimestamp",this.minTimestamp),this.$emit("maxTimestamp",this.maxTimestamp)},handleOpenDatePicker(){this.disabled||(this.showDatePicker=!this.showDatePicker)},handleUpdateMonth(o){const e=o||v.tz(this.currentTimestamp,this.timeZoneName).clone().month(),a=this.locale==="en"?v.tz(this.currentTimestamp,this.timeZoneName).set({month:e}).clone().format("MMM"):v.tz(this.currentTimestamp,this.timeZoneName).set({month:e}).clone().format("M月");this.$nextTick(()=>{const r=document.querySelector(".v-date-picker-controls__month-btn");r.innerText=a})},handleConfirmDate(){const o=v(this.currentDate).format("yyyy-MM-DD"),e=this.currentTime,a=`${o} ${e}`,r=v.tz(a,"YYYY-MM-DD HH:00",this.timeZoneName).clone().tz(this.localTimeZoneName);this.currentTimestamp=r.unix()*1e3,this.showDatePicker=!1},handleCancelDate(){this.showDatePicker=!1;const o=v.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=o.clone().format("YYYY-MM-DD"),this.currentTime=o.clone().format("HH:00")},handleClickOutside(o){const e=this.$refs.idmGl4Timepicker;e&&!e.contains(o.target)&&(this.showDatePicker=!1)}}},Hh={ref:"idmGl4Timepicker",class:"idm-gl4-time-picker"},Oh={class:"pa-0",style:{width:"320px"}},Yh={class:"h-100 pa-0 d-flex flex-column justify-start align-center",style:{width:"100px"}},Uh={class:"d-flex justify-center align-center text-body-2",style:{height:"44px"}};function Jh(o,e,a,r,i,l){const n=t.resolveComponent("VDatePicker"),c=t.resolveComponent("VDivider"),s=t.resolveComponent("VListItemTitle"),m=t.resolveComponent("VListItem"),d=t.resolveComponent("VList"),g=t.resolveComponent("VCardText"),u=t.resolveComponent("VBtn"),y=t.resolveComponent("VCardActions"),p=t.resolveComponent("VCard");return t.openBlock(),t.createElementBlock("div",Hh,[t.createElementVNode("div",{style:t.normalizeStyle({height:a.height+"px",width:a.width?a.width+"px":"auto"}),class:t.normalizeClass([[a.bgClass,{"cursor-pointer":!a.disabled}],"rounded text-body-1 btn-border-1 btn-bg-1 d-flex align-center justify-center px-2"]),onClick:e[0]||(e[0]=(...h)=>l.handleOpenDatePicker&&l.handleOpenDatePicker(...h))},t.toDisplayString(i.currentDateTime)+" | UTC "+t.toDisplayString(a.timeZone<0?a.timeZone:"+"+a.timeZone),7),i.showDatePicker?(t.openBlock(),t.createBlock(p,{key:0,class:"card-box d-flex flex-column border elevation-12",style:t.normalizeStyle(l.getStyle)},{default:t.withCtx(()=>[t.createVNode(g,{class:"w-100 flex-1-1-0 d-flex pa-0 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",Oh,[t.createVNode(n,{modelValue:i.currentDate,"onUpdate:modelValue":e[1]||(e[1]=h=>i.currentDate=h),min:i.minDate,max:i.maxDate,"weekday-format":"narrow",color:"primary",density:"compact",class:"w-100","hide-header":""},null,8,["modelValue","min","max"])]),t.createVNode(c,{class:"h-100",vertical:""}),t.createElementVNode("div",Yh,[t.createElementVNode("div",Uh,t.toDisplayString(o.$t("time.time")),1),t.createVNode(d,{class:"pa-0 flex-1-1-0 scroll"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.hourOptions,(h,f)=>(t.openBlock(),t.createBlock(m,{key:f,value:h,color:"primary",active:i.currentTime===h,rounded:"",height:"26","min-height":"26",class:"rounded-xl",variant:i.currentTime===h?"flat":"text"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-body-2 font-weight-600 text-center",onClick:w=>i.currentTime=h},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(h),1)]),_:2},1032,["onClick"])]),_:2},1032,["value","active","variant"]))),128))]),_:1})])]),_:1}),t.createVNode(c),t.createVNode(y,{class:"w-100 d-flex justify-end align-center px-4 ga-4",style:{height:"50px"}},{default:t.withCtx(()=>[t.createVNode(u,{size:"small",variant:"tonal",class:"text-none text-body-1 px-4",onClick:l.handleCancelDate},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.cancel")),1)]),_:1},8,["onClick"]),t.createVNode(u,{size:"small",variant:"flat",color:"primary",class:"text-none text-body-1 px-4",onClick:l.handleConfirmDate},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.confirm")),1)]),_:1},8,["onClick"])]),_:1})]),_:1},8,["style"])):t.createCommentVNode("",!0)],512)}const to=Q(Xh,[["render",Jh]]),lb="",Kh={name:"IdmPoint",components:{DateTimePicker:to},props:{simple:{type:Boolean,default:!1},isLogin:{type:Boolean,default:!1},token:{type:String},defaultMeteoToken:{type:String},theme:{type:String,default:"zh"},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}},gateway:{type:String},timeZone:{type:Number},forecastModel:{type:String},realTime:{type:String},followList:{type:Array,default:()=>[]}},emits:["meteoMore","follow","cancelFollow","login"],data(){return{right:10,toggle:!1,showForm:!1,showMeteo:!1,loading:!1,form:{lng:void 0,lngDegree:void 0,lngMinute:void 0,lngDirection:"E",lat:void 0,latDegree:void 0,latMinute:void 0,latDirection:"N",dateTime:void 0,forecastModel:""},formRules:{lngDegree:[o=>o!=null&&o!==""||"required",o=>/^\d{1,3}$/.test(o)||"number",o=>parseInt(o)>=0&&parseInt(o)<=180||"0 ~ 180"],lngMinute:[o=>o===void 0||o===null&&o===""||/^\d{1,2}(\.\d+)?$/.test(o)||"number",o=>o===void 0||o===null&&o===""||parseInt(o)>=0&&parseInt(o)<=59||"0 ~ 59"],latDegree:[o=>o!=null&&o!==""||"required",o=>/^\d{1,2}$/.test(o)||"number",o=>parseInt(o)>=0&&parseInt(o)<=90||"0 ~ 90"],latMinute:[o=>o===void 0||o===null&&o===""||/^\d{1,2}(\.\d+)?$/.test(o)||"number",o=>o===void 0||o===null&&o===""||parseInt(o)>=0&&parseInt(o)<=59||"0 ~ 59"]},meteoData:void 0,currentHourData:{},positionOffset:void 0,positionGmt:void 0,positionMarker:void 0,meteoInfoMarker:void 0}},computed:{timeZoneNames(){return v.tz.names()},timeZoneName(){var o;return(o=this.timeZoneNames.filter(e=>v.tz(v(),e).utcOffset()===this.timeZone*60))==null?void 0:o[0]},computedTzTime(){return o=>v.tz(v(o),this.timeZoneName).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(this.timeZone>=0?"+":"")+this.timeZone+")"},computedLocalTime(){return o=>{var r,i,l;const e=Number((r=this.positionOffset)==null?void 0:r.slice(1,3))*(((i=this.positionOffset)==null?void 0:i.slice(0,1))==="+"?1:-1),a=(l=this.timeZoneNames.filter(n=>v.tz(v(),n).utcOffset()===e*60))==null?void 0:l[0];return o?v.tz(v(o),a).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(e>=0?"+":"")+e+")":"-"}},computePosition(){return function(o){return!o||o.lng===null||o.lng===void 0||isNaN(o.lng)||o.lat===null||o.lat===void 0||isNaN(o.lat)?"-":M.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty+" / "+M.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty}},computeRoundPrecision(){return function(o,e=4){return o==null||isNaN(o)||isNaN(e)?"-":M.LngLatHelper.roundPrecision(o,e)}}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},toggle:{handler(){this.toggle?this.showForm=!0:(this.showForm=!1,this.showMeteo=!1),this.map&&this.handleBind()},immediate:!0},map:{handler(){this.map&&this.toggle&&this.handleBind()}},showForm:{handler(){this.showForm?(this.realTime&&(this.form.dateTime=this.realTime),this.$nextTick(()=>{var o;(o=this.$refs.spotForm)==null||o.resetValidation()})):this.handleCloseForm()}},showMeteo:{handler(){var o,e,a,r,i,l;this.showMeteo?((a=(e=(o=this.$parent)==null?void 0:o.$refs)==null?void 0:e.idmBottomBar)==null||a.handleToggle("spot",!0),this.simple&&this.$nextTick(()=>{var n,c;this.$parent.playerBottom=((c=(n=this.$refs.spotMeteo)==null?void 0:n.$el)==null?void 0:c.clientHeight)+10})):((l=(i=(r=this.$parent)==null?void 0:r.$refs)==null?void 0:i.idmBottomBar)==null||l.handleToggle("spot",!1),this.simple&&(this.$parent.playerBottom=30))}},realTime:{handler(){this.realTime&&(this.form.dateTime=this.realTime,this.showMeteo&&this.fetchData())}},forecastModel:{handler(){this.form.forecastModel=this.forecastModel},immediate:!0},"form.forecastModel":{handler(o,e){!o&&e&&(this.form.forecastModel=e==="GFS"?"ECMWF":"GFS")}}},methods:{handleMenuToggle(){this.isLogin?this.toggle=!this.toggle:this.$emit("login")},submitForm(){this.handleCloseMeteo(),this.$refs.spotForm.validate().then(async o=>{o!=null&&o.valid&&this.fetchData()})},cancelForm(){var o;(o=this.$refs.spotForm)==null||o.reset(),this.form={lng:void 0,lngDegree:void 0,lngMinute:void 0,lngDirection:"E",lat:void 0,latDegree:void 0,latMinute:void 0,latDirection:"N",dateTime:void 0,forecastModel:this.forecastModel}},handleCloseForm(){this.showForm=!1,this.cancelForm(),this.toggle=!1},async fetchData(){var a;this.form.lat=(Number(this.form.latDegree??0)+Number(this.form.latMinute??0)/60)*(this.form.latDirection==="N"?1:-1),this.form.lng=(Number(this.form.lngDegree??0)+Number(this.form.lngMinute??0)/60)*(this.form.lngDirection==="E"?1:-1);const o=v();((a=v(this.realTime))==null?void 0:a.diff(o,"d",!0))>=0?await this.fetchForecastData(this.form):await this.fetchHistoryData(this.form)},async fetchForecastData(o){this.loading=!0,this.showMeteo=!0,this.form.lng=o.lng,this.form.lat=o.lat,this.form.followId=o.followId,this.handleDrawInfoMarker([o.lng,o.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Kt.Meteo2Assist.autoPickMeteoModel(o.forecastModel);let r={lat:o.lat,lng:o.lng,datetime:v(o.dateTime).utc().format(),forecastDays:o.day??3,weatherModels:e,marineModels:a};await ce.post(`${this.gateway}/api/arc/meteo2/spot/forecast`,r,{headers:{Authorization:this.token||this.defaultMeteoToken}}).then(i=>{(i==null?void 0:i.data.code)===0?(this.meteoData=i==null?void 0:i.data.data,this.meteoData.lng=o.lng,this.meteoData.lat=o.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1})},async fetchHistoryData(o){this.loading=!0,this.showMeteo=!0,this.form.lng=o.lng,this.form.lat=o.lat,this.form.followId=o.followId,this.handleDrawInfoMarker([o.lng,o.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Kt.Meteo2Assist.autoPickMeteoModel(o.forecastModel),r={lat:o.lat,lng:o.lng,datetime:v(o.dateTime).utc().format(),forecastDays:2,pastDays:1,weatherModels:e,marineModels:a};await ce.post(`${this.gateway}/api/arc/meteo2/spot/forecast`,r,{headers:{Authorization:this.token||this.defaultMeteoToken}}).then(i=>{(i==null?void 0:i.data.code)===0?(this.meteoData=i==null?void 0:i.data.data,this.meteoData.lng=o.lng,this.meteoData.lat=o.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1}),this.loading=!1},initTableData(o){var a,r,i,l,n,c,s,m,d,g,u,y,p,h,f,w,b,L,k,C,A,_,z,P,V,N,j,U,K,de,ne,S,Z,H,q,W,B,J,E,I,ie,ge,ue;this.currentHourData={},this.positionGmt=(r=(a=o==null?void 0:o.weather)==null?void 0:a[0])==null?void 0:r.timezone,this.positionOffset=(l=(i=o==null?void 0:o.weather)==null?void 0:i[0])==null?void 0:l.offset;const e=((n=Kt.Meteo2Assist.pickHourly(o,v(this.form.dateTime)))==null?void 0:n[0])||{};this.currentHourData.utc=e.utc,this.currentHourData.lat=o.lat,this.currentHourData.lng=o.lng,this.currentHourData.temp=this.computeRoundPrecision((c=e==null?void 0:e.weather)==null?void 0:c.temp,0)??"-",this.currentHourData.precipProbability=this.computeRoundPrecision((m=(s=e==null?void 0:e.weather)==null?void 0:s.precip)==null?void 0:m.probability,0)??"-",this.currentHourData.precip1h=this.computeRoundPrecision((g=(d=e==null?void 0:e.weather)==null?void 0:d.precip)==null?void 0:g.sum,0)??"-",this.currentHourData.visibility=this.computeRoundPrecision((u=e==null?void 0:e.weather)==null?void 0:u.visibility,0)??"-",this.currentHourData.windSpeed=this.computeRoundPrecision((p=(y=e==null?void 0:e.weather)==null?void 0:y.wind)==null?void 0:p.kts,1)??"-",this.currentHourData.windDir=((f=(h=e==null?void 0:e.weather)==null?void 0:h.wind)==null?void 0:f.direction)??"-",this.currentHourData.windLevel=this.computeRoundPrecision((b=(w=e==null?void 0:e.weather)==null?void 0:w.wind)==null?void 0:b.scale,0)??"-",this.currentHourData.windGust=this.computeRoundPrecision((k=(L=e==null?void 0:e.weather)==null?void 0:L.wind)==null?void 0:k.gusts,1)??"-",this.currentHourData.sigwaveHeight=this.computeRoundPrecision((A=(C=e==null?void 0:e.wave)==null?void 0:C.sig)==null?void 0:A.height,1)??"-",this.currentHourData.sigwaveDir=(z=(_=e==null?void 0:e.wave)==null?void 0:_.sig)==null?void 0:z.direction,this.currentHourData.sigwavePeriod=this.computeRoundPrecision((V=(P=e==null?void 0:e.wave)==null?void 0:P.sig)==null?void 0:V.period,1)??"-",this.currentHourData.windwaveHeight=this.computeRoundPrecision((j=(N=e==null?void 0:e.wave)==null?void 0:N.wd)==null?void 0:j.height,1)??"-",this.currentHourData.windwaveDir=(K=(U=e==null?void 0:e.wave)==null?void 0:U.wd)==null?void 0:K.direction,this.currentHourData.windwavePeriod=this.computeRoundPrecision((ne=(de=e==null?void 0:e.wave)==null?void 0:de.wd)==null?void 0:ne.period,1)??"-",this.currentHourData.swellHeight=this.computeRoundPrecision((Z=(S=e==null?void 0:e.wave)==null?void 0:S.swell)==null?void 0:Z.height,1)??"-",this.currentHourData.swellDir=(q=(H=e==null?void 0:e.wave)==null?void 0:H.swell)==null?void 0:q.direction,this.currentHourData.swellPeriod=this.computeRoundPrecision((B=(W=e==null?void 0:e.wave)==null?void 0:W.swell)==null?void 0:B.period,1)??"-",this.currentHourData.currentSpeed=this.computeRoundPrecision((J=e==null?void 0:e.current)==null?void 0:J.speed,1)??"-",this.currentHourData.currentDir=(E=e==null?void 0:e.current)==null?void 0:E.direction,this.currentHourData.currentSpeed=this.computeRoundPrecision((I=e==null?void 0:e.current)==null?void 0:I.speed,1)??"-",this.currentHourData.seaLevel=this.computeRoundPrecision(e==null?void 0:e.height,1)??"-",this.currentHourData.seaTemp=this.computeRoundPrecision(e==null?void 0:e.sst,0)??"-",this.currentHourData.weatherUrls=(ie=e==null?void 0:e.weather)==null?void 0:ie.url,this.currentHourData.sit=(ge=e==null?void 0:e.ice)==null?void 0:ge.sit,this.currentHourData.sic=this.computeRoundPrecision(((ue=e==null?void 0:e.ice)==null?void 0:ue.sic)*100,0)??"-",this.currentHourData.showIce=o.lat>=65||o.lat<=-65},handleBind(){var o,e;this.toggle?((o=this.map)==null||o.on("click",this.handleClick),this.map&&(this.map.getCanvas().style.cursor="crosshair")):((e=this.map)==null||e.off("click",this.handleClick),this.handleCloseMeteo(),this.map&&(this.map.getCanvas().style.cursor="grab"))},handleClick(o){if(o.originalEvent.stopPropagation(),o.originalEvent.target.className==="mapboxgl-canvas")this.handleGetPosition(o.lngLat),this.$nextTick(()=>{this.fetchData()});else return!1},handleGetPosition(o){if(isNaN(o.lat)||isNaN(o.lng))return!1;this.form.latDegree=Number(M.LngLatHelper.lat2pretty(o.lat).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(o.lat).minute),this.form.latDirection=M.LngLatHelper.lat2pretty(o.lat).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(o.lng).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(o.lng).minute),this.form.lngDirection=M.LngLatHelper.lng2pretty(o.lng).direction},handleDrawInfoMarker(o){this.drawPositionMarker(o),this.simple||this.drawMeteoInfoMarker(o)},drawPositionMarker(o){o&&(this.map.flyTo({center:o,duration:300}),this.$nextTick(()=>{var a,r;(a=this.positionMarker)==null||a.remove();const e=(r=document.getElementById("idm-position-icon"))==null?void 0:r.cloneNode(!0);this.positionMarker=new me.Marker(e).setLngLat(o).setOffset([0,-15]).addTo(this.map)}))},drawMeteoInfoMarker(o){this.$nextTick(()=>{var a;const e=document.getElementById("idm-gl4-spot-meteo");this.meteoInfoMarker?(a=this.meteoInfoMarker)==null||a.setLngLat(o):this.meteoInfoMarker=new me.Marker(e).setLngLat(o).setOffset([0,-190]).addTo(this.map)})},handleMeteoMore(){this.form.forecastModel=this.forecastModel,this.$emit("meteoMore",this.form)},handleCloseMeteo(){this.showMeteo=!1,this.$nextTick(()=>{var o,e;(o=this.positionMarker)==null||o.remove(),this.positionMarker=void 0,(e=this.meteoInfoMarker)==null||e.remove(),this.meteoInfoMarker=void 0})},handleFollow(){this.$emit("follow",this.form)},handleCancelFollow(){var e,a,r;const o=((e=this.form)==null?void 0:e.followId)||((r=(a=this.followList)==null?void 0:a.find(i=>{var l,n;return(i==null?void 0:i.id)===this.form.followId||((l=i==null?void 0:i.coordinate)==null?void 0:l.lng)===this.form.lng&&((n=i==null?void 0:i.coordinate)==null?void 0:n.lat)===this.form.lat}))==null?void 0:r.id);this.$emit("cancelFollow",o)}}},Qh={class:"idm-gl4-spot"},qh={class:"d-flex justify-start align-center"},$h={class:"text-h6 font-weight-600"},ep={class:"d-flex justify-start align-center ga-1 mb-2"},tp={class:"text-label"},op={class:"w-100 d-flex ma-0"},ap={class:"w-30 pa-0 d-flex"},ip={class:"flex-1-1-0 pa-0 d-flex"},rp={class:"pa-0"},lp={class:"d-flex justify-start align-center ga-1 mb-2"},np={class:"text-label"},sp={class:"w-100 d-flex ma-0"},cp={class:"w-30 pa-0 d-flex"},mp={class:"flex-1-1-0 pa-0 d-flex"},dp={class:"pa-0"},hp={class:"d-flex justify-start align-center ga-1 mb-2"},pp={class:"text-label"},gp={class:"d-flex justify-start align-center ga-1 mb-2"},up={class:"text-label"},fp={class:"d-flex justify-start align-center"},yp={class:"mx-2"},bp={class:"mx-0 py-2 d-flex align-center justify-start"},wp={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},xp={class:"pa-0 px-0"},kp={class:"mx-0 py-2 d-flex align-center justify-start"},Ap={cols:"9",class:"pa-0 px-0"},Lp={class:"mx-0 py-2 d-flex align-center justify-start"},Cp={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},vp={style:{width:"150px"},class:"pa-0 text-left"},zp={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},_p={cols:"3",class:"pa-0 px-0 text-left"},Sp={class:"mx-0 py-2 d-flex align-center justify-start"},Np={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Mp={style:{width:"150px"},class:"pa-0 text-left"},Pp={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Vp={cols:"3",class:"pa-0 text-left"},Tp={class:"mx-0 py-2 d-flex align-center justify-start"},Ep={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Dp={style:{width:"150px"},class:"pa-0 text-left"},Rp={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Bp={class:"pa-0 text-left"},Ip={key:0,class:"mx-0 py-2 d-flex align-center justify-start"},Fp={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Gp={style:{width:"150px"},class:"pa-0 text-left"},jp={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Wp={class:"pa-0 text-left"},Zp={class:"d-flex justify-space-between align-center"},Xp={class:"d-flex justify-start align-center"},Hp={class:"mx-1"},Op={class:"d-flex justify-end align-center"},Yp={class:"mx-0 py-1 d-flex align-center justify-start"},Up={style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},Jp={class:"pa-0 px-0"},Kp={class:"mx-0 py-1 d-flex align-center justify-start"},Qp={class:"pa-0 px-0"},qp={class:"gray-bg-2 mx-4 my-2 py-3 px-2 rounded text-font-13 d-flex align-center justify-space-between"},$p={class:"d-flex flex-column align-start justify-center ga-3"},eg={class:"text-label pr-2"},tg={class:"text-label pr-2"},og={class:"text-label pr-2"},ag={key:0},ig={class:"text-label pr-2"},rg={class:"d-flex flex-column align-start justify-center ga-3"},lg={class:"text-label pr-2"},ng={class:"text-label pr-2"},sg={class:"text-label pr-2"},cg={key:0},mg={class:"text-label pr-2"},dg={id:"idm-position-icon"},hg={class:"multi-color-icon",style:{height:"30px",width:"30px"},"aria-hidden":"true"},pg=["xlink:href"];function gg(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardTitle"),m=t.resolveComponent("VDivider"),d=t.resolveComponent("VTextField"),g=t.resolveComponent("DateTimePicker"),u=t.resolveComponent("VCol"),y=t.resolveComponent("VRow"),p=t.resolveComponent("VBtnToggle"),h=t.resolveComponent("VCardText"),f=t.resolveComponent("VCardActions"),w=t.resolveComponent("VForm"),b=t.resolveComponent("VCard");return t.openBlock(),t.createElementBlock("div",Qh,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("spot.spotsMeteo"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:L})=>[t.createVNode(n,t.mergeProps(L,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[8]||(e[8]=[t.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h4"},null,-1)])),_:2,__:[8]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),i.showForm&&!a.simple?(t.openBlock(),t.createBlock(b,{key:0,class:"spot-form-card",style:t.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+50+"px"})},{default:t.withCtx(()=>[t.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>[t.createElementVNode("div",qh,[t.createElementVNode("div",$h,t.toDisplayString(o.$t("spot.spotWeather")),1)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleCloseForm},{default:t.withCtx(()=>e[9]||(e[9]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[9]},8,["onClick"])]),_:1}),t.createVNode(m),t.createVNode(w,{ref:"spotForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.submitForm,["prevent"])},{default:t.withCtx(()=>[t.createVNode(h,{class:"text-body-1 pa-4 py-2"},{default:t.withCtx(()=>[t.createElementVNode("div",ep,[t.createElementVNode("div",tp,[t.createTextVNode(t.toDisplayString(o.$t("spot.lat")),1),e[10]||(e[10]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createElementVNode("div",op,[t.createElementVNode("div",ap,[t.createVNode(d,{modelValue:i.form.latDegree,"onUpdate:modelValue":e[0]||(e[0]=L=>i.form.latDegree=L),rules:i.formRules.latDegree,label:"",density:"compact",variant:"outlined",height:"32px","min-height":"32px",required:"",dense:"",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[11]||(e[11]=t.createElementVNode("span",{class:"px-1"},"°",-1))]),t.createElementVNode("div",ip,[t.createVNode(d,{modelValue:i.form.latMinute,"onUpdate:modelValue":e[1]||(e[1]=L=>i.form.latMinute=L),rules:i.formRules.latMinute,label:"",density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[12]||(e[12]=t.createElementVNode("span",{class:"px-1"},"'",-1))]),t.createElementVNode("div",rp,[t.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[2]||(e[2]=L=>i.form.latDirection=i.form.latDirection==="N"?"S":"N")},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.form.latDirection),1)]),_:1})])]),t.createElementVNode("div",lp,[t.createElementVNode("div",np,[t.createTextVNode(t.toDisplayString(o.$t("spot.lng")),1),e[13]||(e[13]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createElementVNode("div",sp,[t.createElementVNode("div",cp,[t.createVNode(d,{modelValue:i.form.lngDegree,"onUpdate:modelValue":e[3]||(e[3]=L=>i.form.lngDegree=L),rules:i.formRules.lngDegree,density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[14]||(e[14]=t.createElementVNode("span",{class:"px-1"},"°",-1))]),t.createElementVNode("div",mp,[t.createVNode(d,{modelValue:i.form.lngMinute,"onUpdate:modelValue":e[4]||(e[4]=L=>i.form.lngMinute=L),rules:i.formRules.lngMinute,label:"",density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[15]||(e[15]=t.createElementVNode("span",{class:"px-1"},"'",-1))]),t.createElementVNode("div",dp,[t.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[5]||(e[5]=L=>i.form.lngDirection=i.form.lngDirection==="E"?"W":"E")},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.form.lngDirection),1)]),_:1})])]),t.createElementVNode("div",hp,[t.createElementVNode("div",pp,[t.createTextVNode(t.toDisplayString(o.$t("spot.dateTime")),1),e[16]||(e[16]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createVNode(y,{class:"ma-0 mb-4"},{default:t.withCtx(()=>[t.createVNode(u,{cols:"12",class:"pa-0"},{default:t.withCtx(()=>[t.createVNode(g,t.mergeProps({"date-time":i.form.dateTime,"time-zone":a.timeZone},o.$attrs,{onDateTime:e[6]||(e[6]=L=>i.form.dateTime=L)}),null,16,["date-time","time-zone"])]),_:1})]),_:1}),t.createElementVNode("div",gp,[t.createElementVNode("div",up,[t.createTextVNode(t.toDisplayString(o.$t("weather.forecastModel")),1),e[17]||(e[17]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createVNode(y,{class:"ma-0"},{default:t.withCtx(()=>[t.createVNode(u,{cols:"12",class:"pa-0"},{default:t.withCtx(()=>[t.createVNode(p,{modelValue:i.form.forecastModel,"onUpdate:modelValue":e[7]||(e[7]=L=>i.form.forecastModel=L),class:"w-100",rounded:"",height:"30",density:"compact",group:"",mandatory:""},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact",height:"30",value:"GFS",class:t.normalizeClass(["text-none flex-1-1-0",i.form.forecastModel==="GFS"?"":"btn-border-1 btn-bg-1"]),color:i.form.forecastModel==="GFS"?"primary":"","base-color":""},{default:t.withCtx(()=>e[18]||(e[18]=[t.createTextVNode(" NOAA ",-1)])),_:1,__:[18]},8,["class","color"]),t.createVNode(n,{density:"compact",height:"30",class:t.normalizeClass(["text-none flex-1-1-0",i.form.forecastModel==="ECMWF"?"":"btn-border-1 btn-bg-1"]),color:i.form.forecastModel==="ECMWF"?"primary":"","base-color":"",value:"ECMWF"},{default:t.withCtx(()=>e[19]||(e[19]=[t.createTextVNode(" ECMWF ",-1)])),_:1,__:[19]},8,["class","color"])]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),t.createVNode(m),t.createVNode(f,{class:"d-flex justify-end align-center ga-4 pa-4 py-2"},{default:t.withCtx(()=>[t.createVNode(n,{size:"small",variant:"tonal",class:"text-none text-body-1 btn-bg-1",onClick:l.cancelForm},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.clear")),1)]),_:1},8,["onClick"]),t.createVNode(n,{ref:"submitSpot",loading:i.loading,size:"small",variant:"flat",color:"primary",type:"submit",class:"text-none text-body-1"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.confirm")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])]),_:1},8,["style"])):t.createCommentVNode("",!0),i.showMeteo&&!a.simple?(t.openBlock(),t.createBlock(b,{key:1,id:"idm-gl4-spot-meteo",class:"spot-meteo",style:{width:"490px","z-index":"9"}},{default:t.withCtx(()=>[t.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>[t.createElementVNode("div",fp,[e[20]||(e[20]=t.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),t.createElementVNode("div",yp,t.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),t.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:t.withModifiers(l.handleCloseMeteo,["stop"])},{default:t.withCtx(()=>e[21]||(e[21]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[21]},8,["onClick"])]),_:1}),t.createVNode(m),t.createVNode(h,{class:"text-body-1 px-0 py-1"},{default:t.withCtx(()=>{var L,k;return[t.createElementVNode("div",bp,[t.createElementVNode("div",wp,t.toDisplayString(o.$t("time.time")),1),t.createElementVNode("div",xp,t.toDisplayString(l.computedTzTime((L=i.currentHourData)==null?void 0:L.utc)),1)]),t.createElementVNode("div",kp,[e[22]||(e[22]=t.createElementVNode("div",{style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),t.createElementVNode("div",Ap,t.toDisplayString(l.computedLocalTime((k=i.currentHourData)==null?void 0:k.utc)),1)]),t.createElementVNode("div",Lp,[t.createElementVNode("div",Cp,t.toDisplayString(o.$t("weather.wind")),1),t.createElementVNode("div",vp,t.toDisplayString(i.currentHourData.windDir??"-")+"/"+t.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+t.toDisplayString(i.currentHourData.windLevel??"-"),1),t.createElementVNode("div",zp,t.toDisplayString(o.$t("weather.sigWave")),1),t.createElementVNode("div",_p,t.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s ",1)]),t.createElementVNode("div",Sp,[t.createElementVNode("div",Np,t.toDisplayString(o.$t("weather.windWave")),1),t.createElementVNode("div",Mp,t.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s ",1),t.createElementVNode("div",Pp,t.toDisplayString(o.$t("weather.swell")),1),t.createElementVNode("div",Vp,t.toDisplayString(i.currentHourData.swellDir??"-")+"/"+t.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.swellPeriod??"-")+"s ",1)]),t.createElementVNode("div",Tp,[t.createElementVNode("div",Ep,t.toDisplayString(o.$t("weather.current")),1),t.createElementVNode("div",Dp,t.toDisplayString(i.currentHourData.currentDir??"-")+"/"+t.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1),t.createElementVNode("div",Rp,t.toDisplayString(o.$t("weather.visibility")),1),t.createElementVNode("div",Bp,t.toDisplayString(i.currentHourData.visibility??"-")+"nm",1)]),i.currentHourData.showIce?(t.openBlock(),t.createElementBlock("div",Ip,[t.createElementVNode("div",Fp,t.toDisplayString(o.$t("weather.sit")),1),t.createElementVNode("div",Gp,t.toDisplayString(i.currentHourData.sit??"-")+"m",1),t.createElementVNode("div",jp,t.toDisplayString(o.$t("weather.sic")),1),t.createElementVNode("div",Wp,t.toDisplayString(i.currentHourData.sic??"-")+"%",1)])):t.createCommentVNode("",!0)]}),_:1}),t.createVNode(m),t.createVNode(f,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>{var L;return[(L=a.followList)!=null&&L.some(k=>{var C,A;return(k==null?void 0:k.id)===i.form.followId||((C=k==null?void 0:k.coordinate)==null?void 0:C.lng)===i.form.lng&&((A=k==null?void 0:k.coordinate)==null?void 0:A.lat)===i.form.lat})?(t.openBlock(),t.createBlock(n,{key:0,id:"idm-gl4-spot-meteo-follow",class:"text-none text-body-1",variant:"text",density:"compact",height:"32",onClick:t.withModifiers(l.handleCancelFollow,["stop"])},{prepend:t.withCtx(()=>e[23]||(e[23]=[t.createElementVNode("i",{class:"iconfont icon-yishoucang text-h6 text-warning"},null,-1)])),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(o.$t("actions.unfollow")),1)]),_:1},8,["onClick"])):(t.openBlock(),t.createBlock(n,{key:1,id:"idm-gl4-spot-meteo-unfollow",class:"text-none text-body-1",variant:"text",density:"compact",height:"32",onClick:t.withModifiers(l.handleFollow,["stop"])},{prepend:t.withCtx(()=>e[24]||(e[24]=[t.createElementVNode("i",{class:"iconfont icon-weishoucang text-h6"},null,-1)])),default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.follow"))+" ",1)]),_:1},8,["onClick"])),t.createVNode(n,{height:"32",variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:t.withModifiers(l.handleMeteoMore,["stop"])},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("spot.forecast")),1)]),_:1},8,["onClick"])]}),_:1})]),_:1})):t.createCommentVNode("",!0),i.showMeteo&&a.simple?(t.openBlock(),t.createBlock(b,{key:2,ref:"spotMeteo",class:"position-absolute bottom-0 rounded-t-4",style:{width:"100vw","z-index":"1001"}},{default:t.withCtx(()=>[t.createVNode(s,null,{default:t.withCtx(()=>{var L;return[t.createElementVNode("div",Zp,[t.createElementVNode("div",Xp,[e[25]||(e[25]=t.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),t.createElementVNode("div",Hp,t.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),t.createElementVNode("div",Op,[(L=a.followList)!=null&&L.some(k=>{var C,A;return(k==null?void 0:k.id)===i.form.followId||((C=k==null?void 0:k.coordinate)==null?void 0:C.lng)===i.form.lng&&((A=k==null?void 0:k.coordinate)==null?void 0:A.lat)===i.form.lat})?(t.openBlock(),t.createBlock(n,{key:0,class:"text-none text-body-1 rounded-circle",variant:"text",density:"compact",height:"32",width:"28","min-width":"28",onClick:t.withModifiers(l.handleCancelFollow,["stop"])},{default:t.withCtx(()=>e[26]||(e[26]=[t.createElementVNode("i",{class:"iconfont icon-yishoucang text-h4 text-warning"},null,-1)])),_:1,__:[26]},8,["onClick"])):(t.openBlock(),t.createBlock(n,{key:1,class:"text-none text-body-1 rounded-circle",variant:"plain",density:"compact",height:"32",width:"28","min-width":"28",onClick:t.withModifiers(l.handleFollow,["stop"])},{default:t.withCtx(()=>e[27]||(e[27]=[t.createElementVNode("i",{class:"iconfont icon-weishoucang text-h4"},null,-1)])),_:1,__:[27]},8,["onClick"])),t.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:t.withModifiers(l.handleCloseMeteo,["stop"])},{default:t.withCtx(()=>e[28]||(e[28]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[28]},8,["onClick"])])]),e[29]||(e[29]=t.createElementVNode("div",{class:"px-5 py-0 text-label text-body-1"},"Spot Weather",-1))]}),_:1,__:[29]}),t.createVNode(m),t.createVNode(h,{class:"text-body-1 px-0 py-2"},{default:t.withCtx(()=>{var L,k;return[t.createElementVNode("div",Yp,[t.createElementVNode("div",Up,t.toDisplayString(o.$t("time.time")),1),t.createElementVNode("div",Jp,t.toDisplayString(l.computedTzTime((L=i.currentHourData)==null?void 0:L.utc)),1)]),t.createElementVNode("div",Kp,[e[30]||(e[30]=t.createElementVNode("div",{style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),t.createElementVNode("div",Qp,t.toDisplayString(l.computedLocalTime((k=i.currentHourData)==null?void 0:k.utc)),1)]),t.createElementVNode("div",qp,[t.createElementVNode("div",$p,[t.createElementVNode("div",null,[t.createElementVNode("span",eg,t.toDisplayString(o.$t("weather.wind")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.windDir??"-")+"/"+t.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+t.toDisplayString(i.currentHourData.windLevel??"-"),1)]),t.createElementVNode("div",null,[t.createElementVNode("span",tg,t.toDisplayString(o.$t("weather.sigWave")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s",1)]),t.createElementVNode("div",null,[t.createElementVNode("span",og,t.toDisplayString(o.$t("weather.windWave")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s",1)]),i.currentHourData.showIce?(t.openBlock(),t.createElementBlock("div",ag,[t.createElementVNode("span",ig,t.toDisplayString(o.$t("weather.sit")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.sit??"-")+"m",1)])):t.createCommentVNode("",!0)]),t.createElementVNode("div",rg,[t.createElementVNode("div",null,[t.createElementVNode("span",lg,t.toDisplayString(o.$t("weather.swell")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.swellDir??"-")+"/"+t.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.swellPeriod??"-")+"s",1)]),t.createElementVNode("div",null,[t.createElementVNode("span",ng,t.toDisplayString(o.$t("weather.current")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.currentDir??"-")+"/"+t.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1)]),t.createElementVNode("div",null,[t.createElementVNode("span",sg,t.toDisplayString(o.$t("weather.visibility")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.visibility??"-")+" nm",1)]),i.currentHourData.showIce?(t.openBlock(),t.createElementBlock("div",cg,[t.createElementVNode("span",mg,t.toDisplayString(o.$t("weather.sic")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.sic??"-")+"%",1)])):t.createCommentVNode("",!0)])])]}),_:1})]),_:1},512)):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("div",dg,[(t.openBlock(),t.createElementBlock("svg",hg,[t.createElementVNode("use",{"xlink:href":`#icon-spot-${a.theme}`},null,8,pg)]))],512),[[t.vShow,i.showMeteo]])])}const ug=Q(Kh,[["render",gg]]),nb="",fg={name:"IdmMeasure",props:{simple:{type:Boolean,default:!1},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}}},setup(){return{Theme:ye.useTheme()}},data(){return{right:10,toggle:!1,geojson:[],source:"measure-source",layer:"measure-layer",labelLayer:"measure-label-layer",sumLayer:"measure-suml-layer",tmpSource:"measure-tmp-source",tmpLayer:"measure-tmp-layer",tmpLabelLayer:"measure-tmp-label-layer",closeMarkers:{},pointMarkers:{},tipMarker:void 0,contextmenu:void 0,navigation:"RL",currentLineIndex:1}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},toggle:{handler(){var o,e,a;if(this.toggle)this.handleBind();else{(o=this.map)==null||o.getCanvas().removeEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.off("mousemove",this.handleMove),(a=this.map)==null||a.off("dblclick",this.handleDblClick),this.map;let r=this.geojson.find(i=>!i.closed);r&&this.handleClear(r,!0),this.geojson=this.geojson.filter(i=>!!i.closed),r=T.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(r)}},immediate:!0},map:{handler(){this.map&&(this.toggle?this.handleBind():this.handleUnbind())}}},methods:{handleMenuToggle(){this.toggle=!this.toggle},handleBind(){var o,e,a,r,i;(o=this.map)==null||o.getCanvas().addEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.on("mousemove",this.handleMove),(a=this.map)==null||a.on("dblclick",this.handleDblClick),(r=this.map)==null||r.on("click",this.handleClick),(i=this.map)==null||i.on("contextmenu",this.handleContextmenu),this.map&&(this.map.getCanvas().style.cursor="crosshair")},handleUnbind(){var o,e,a,r,i;(o=this.map)==null||o.getCanvas().removeEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.off("mousemove",this.handleMove),(a=this.map)==null||a.off("dblclick",this.handleDblClick),(r=this.map)==null||r.off("click",this.handleClick),(i=this.map)==null||i.off("contextmenu",this.handleContextmenu);for(const l of this.geojson)this.handleClear(l,!0);this.geojson=[],this.map&&(this.map.getCanvas().style.cursor="grab")},handleKeydown(o){if(o.key==="Shift"){this.navigation=this.navigation==="RL"?"GC":"RL";const e=this.geojson.at(-1),a=e.features.filter(r=>r.geometry.type==="Point");a!=null&&a.length&&(a.at(-1).properties.mode=this.navigation),this.handleRender(e)}},handleDrag(o){var a,r,i,l,n,c,s,m,d,g;const e=(r=(a=o.target)==null?void 0:a._element)==null?void 0:r.id;if((e==null?void 0:e.split("-").length)===2){const u=this.geojson.filter(f=>f.id===e.split("-")[0])[0];this.pointMarkers[u.id].filter(f=>{var w;return((w=f._element)==null?void 0:w.id)===e})[0].setLngLat([(l=(i=o.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(c=(n=o.target)==null?void 0:n._lngLat)==null?void 0:c.lat]);let p;u.features.forEach((f,w)=>{if(f.geometry.type==="Point"&&f.properties.id===e.split("-")[1]){p=w;return}});const h=u.features.filter(f=>f.geometry.type==="Point");this.handleTmpPointUpdate(u,h[p-1],{lng:(m=(s=o.target)==null?void 0:s._lngLat)==null?void 0:m.lng,lat:(g=(d=o.target)==null?void 0:d._lngLat)==null?void 0:g.lat,properties:h[p].properties},p===h.length-1?void 0:h[p+1])}},handleDragEnd(o){var a,r,i,l,n,c,s,m,d,g;const e=(r=(a=o.target)==null?void 0:a._element)==null?void 0:r.id;if((e==null?void 0:e.split("-").length)===2){const u=this.geojson.filter(h=>h.id===e.split("-")[0])[0];this.pointMarkers[u.id].filter(h=>{var f;return((f=h._element)==null?void 0:f.id)===e})[0].setLngLat([(l=(i=o.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(c=(n=o.target)==null?void 0:n._lngLat)==null?void 0:c.lat]);const p=u.features.filter(h=>h.geometry.type==="Point"&&h.properties.id===e.split("-")[1])[0];p.geometry.coordinates=[(m=(s=o.target)==null?void 0:s._lngLat)==null?void 0:m.lng,(g=(d=o.target)==null?void 0:d._lngLat)==null?void 0:g.lat],u.features=u.features.filter(h=>h.geometry.type==="Point"),this.handlePointUpdate(u)}},handleContextmenu(o){var a,r,i,l;o.preventDefault(),(a=this.contextmenu)==null||a.remove();const e=(l=(i=(r=o.originalEvent)==null?void 0:r.target)==null?void 0:i.parentElement)==null?void 0:l.id;if((e==null?void 0:e.split("-").length)===2){const c=this.geojson.filter(s=>s.id===e.split("-")[0])[0].features.filter(s=>s.geometry.type==="Point");if(c.length>2&&c.filter(m=>m.properties.id===(e==null?void 0:e.split("-")[1]))[0]){const m=document.createElement("div");m.className="idm-gl4-measure-contextmenu-marker",m.innerHTML=`<span id="del-${e}" class="del-point">${this.$t("actions.detele")}</span>`,this.contextmenu=new me.Marker(m).setOffset([24,0]).setLngLat([o.lngLat.lng,o.lngLat.lat]).addTo(this.map)}}},handleClick(o){var a,r,i,l,n,c;(a=this.contextmenu)==null||a.remove();const e=o.originalEvent.target.className;if(e==="marker-close"){const s=(i=(r=o.originalEvent)==null?void 0:r.srcElement)==null?void 0:i.id,m=this.geojson.filter(d=>d.id===s)[0];m&&this.handleClear(m,!0),this.geojson=this.geojson.filter(d=>d.id!==s),!this.toggle&&!((l=this.geojson)!=null&&l.some(d=>d.closed))&&this.handleUnbind()}else if(e==="del-point"){const s=(c=(n=o.originalEvent.target.id)==null?void 0:n.replace("del-",""))==null?void 0:c.split("-"),m=this.geojson.filter(d=>d.id===s[0])[0];m.features=m.features.filter(d=>d.geometry.type==="Point"&&d.properties.id!==s[1]),this.handlePointUpdate(m)}else if(e!=="marker-label"&&this.toggle){let s=this.geojson.at(-1);s||(s=T.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(s)),s.features=s.features.filter(d=>d.geometry.type==="Point");const m=T.feature({type:"Point",coordinates:[o.lngLat.lng,o.lngLat.lat]},{id:new Date().getTime().toString(),mode:this.navigation,sumLabel:"Start"});s.features.push(m),this.handlePointUpdate(s)}},handlePointUpdate(o){const e=o.features;if(e.length>1){let a=0;const r=[];for(let i=1;i<e.length;i++){const l=e[i-1],n=e[i],c=l.properties,s={lng:l.geometry.coordinates[0],lat:l.geometry.coordinates[1]},m={lng:n.geometry.coordinates[0],lat:n.geometry.coordinates[1]},d=M.LaneHelper.calculateDistance(s,m,c.mode==="RL",4),g=M.LaneHelper.calculateBearing(s,m,c.mode==="RL",2);a=M.LngLatHelper.roundPrecision(a+d,4);let u;c.mode==="RL"?u=M.LngLatHelper.convertToMonotonicLng([s,m]):u=M.LngLatHelper.convertToMonotonicLng(M.LaneHelper.interpolateCoordinates(s,m,200));const y=T.lineString(u.map(h=>[h.lng,h.lat]));y.properties.dist=d,y.properties.bearing=g,y.properties.total=a,y.properties.name="Line "+this.currentLineIndex,r.push(y);const p=e[i];p.properties.totalDist=M.LngLatHelper.roundPrecision((c.totalDist?c.totalDist:0)+d,4),p.properties.sumLabel=p.properties.totalDist+" nm"}e.push(...r),o.total=a}return this.handleRender(o),o},handleTmpPointUpdate(o,e,a,r){const i=T.featureCollection([]);let l,n;if(e){const s=e.properties,m={lng:e.geometry.coordinates[0],lat:e.geometry.coordinates[1]},d={lng:a.lng,lat:a.lat};l=M.LaneHelper.calculateDistance(m,d,s.mode==="RL",4),n=M.LaneHelper.calculateBearing(m,d,s.mode==="RL",2);let g;s.mode==="RL"?g=M.LngLatHelper.convertToMonotonicLng([m,d]):g=M.LngLatHelper.convertToMonotonicLng(M.LaneHelper.interpolateCoordinates(m,d,200));const u=T.lineString(g.map(y=>[y.lng,y.lat]));u.properties.dist=l,u.properties.bearing=n,i.features.push(u)}if(r){const s=a.properties,m=a,d={lng:r.geometry.coordinates[0],lat:r.geometry.coordinates[1]};l=M.LaneHelper.calculateDistance(m,d,s.mode==="RL",4),n=M.LaneHelper.calculateBearing(m,d,s.mode==="RL",2);let g;s.mode==="RL"?g=M.LngLatHelper.convertToMonotonicLng([m,d]):g=M.LngLatHelper.convertToMonotonicLng(M.LaneHelper.interpolateCoordinates(m,d,200));const u=T.lineString(g.map(y=>[y.lng,y.lat]));u.properties.dist=l,u.properties.bearing=n,i.features.push(u)}this.map.getSource(this.tmpSource)?this.map.getSource(this.tmpSource).setData(i):this.map.addSource(this.tmpSource,{type:"geojson",data:i}),this.map.getLayer(this.tmpLayer)||this.map.addLayer({id:this.tmpLayer,type:"line",source:this.tmpSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["map-orange"],"line-width":2,"line-opacity":1,"line-dasharray":[3,2]}}),this.map.getLayer(this.tmpLabelLayer)||this.map.addLayer({id:this.tmpLabelLayer,type:"symbol",source:this.tmpSource,filter:["==","$type","LineString"],layout:{"symbol-placement":"line-center","text-field":"{dist}nm / {bearing}°","text-rotation-alignment":"map","text-size":11,"text-offset":[0,-1]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}});let c;if(r)c=`<div class="marker-label">${this.$t("measure.dragTips")}</div>`;else{const s=M.LngLatHelper.roundPrecision((o.total??0)+l,1);c=`<div class="marker-label">${this.$t("measure.totalDistance")}: <b>${s}</b>nm, ${this.$t("measure.bearing")}: <b>${n}</b>°</div><div class="marker-label"> ${this.$t("measure.mode")}${this.navigation==="RL"?"RL":"GC"}, ${this.$t("measure.switchTips")}</div><div class="marker-label">${this.$t("measure.clickTips")}</div>`}if(this.tipMarker)this.tipMarker._element.innerHTML=c,this.tipMarker.setLngLat([a.lng,a.lat]);else{const s=document.createElement("div");s.className="idm-gl4-measure-tip-marker",s.innerHTML=c,this.tipMarker=new me.Marker(s).setOffset([140,0]).setLngLat([a.lng,a.lat]).addTo(this.map)}},handleMove(o){this.map.getCanvas().style.cursor="crosshair";let e=this.geojson.at(-1);e||(e=T.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e));const a=e.features.filter(r=>r.geometry.type==="Point");a!=null&&a.length&&this.handleTmpPointUpdate(e,a.at(-1),{lng:o.lngLat.lng,lat:o.lngLat.lat})},handleDblClick(o){o.preventDefault();let e=this.geojson.at(-1);e.closed=!0,this.handleRender(e),e=T.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e),this.currentLineIndex++},handleRender(o){var e;if((e=o==null?void 0:o.features)!=null&&e.length){const a=`${o.id}-${this.source}`,r=`${o.id}-${this.layer}`,i=`${o.id}-${this.labelLayer}`,l=`${o.id}-${this.sumLayer}`;this.map.getSource(a)?this.map.getSource(a).setData(o):this.map.addSource(a,{type:"geojson",data:o}),this.handleClear(o,!1),this.map.addLayer({id:r,type:"line",source:a,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["map-orange"],"line-width":2}}),this.map.addLayer({id:i,type:"symbol",source:a,filter:["==","$type","LineString"],layout:{"symbol-placement":"line-center","text-field":"{dist}nm / {bearing}°","text-rotation-alignment":"map","text-size":11,"text-offset":[0,-1]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}}),this.map.addLayer({id:l,type:"symbol",source:a,filter:["==","$type","Point"],layout:{"text-field":"{sumLabel}","text-rotation-alignment":"map","text-size":12,"text-offset":[0,1.5]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}});const n=o.features.filter(c=>c.geometry.type==="Point");for(const c of n){const s=document.createElement("div");s.id=`${o.id}-${c.properties.id}`,s.className=`${o.closed?"idm-gl4-measure-marker closed":"idm-gl4-measure-marker"}`,s.innerHTML='<div class="marker-circle"></div>';const m=new me.Marker({element:s,draggable:!0,contextmenu:!0}).setLngLat(c.geometry.coordinates).addTo(this.map);m.on("drag",this.handleDrag),m.on("dragend",this.handleDragEnd),this.pointMarkers[o.id]?this.pointMarkers[o.id].push(m):this.pointMarkers[o.id]=[m]}if(o.closed){const c=n.at(-1),m=o.features.filter(g=>g.geometry.type==="LineString").at(-1),d=document.createElement("div");d.className="idm-gl4-measure-summary-marker",d.innerHTML=`<div class="marker-label">${m.properties.name}</div><div id="${o.id}" class="marker-close">X</div>`,this.closeMarkers[o.id]=new me.Marker(d).setOffset([0,-30]).setLngLat(c.geometry.coordinates).addTo(this.map)}}},handleClear(o,e=!0){var n,c,s,m,d,g,u,y,p,h;const a=`${o.id}-${this.source}`,r=`${o.id}-${this.layer}`,i=`${o.id}-${this.labelLayer}`,l=`${o.id}-${this.sumLayer}`;(n=this.map)!=null&&n.getLayer(r)&&this.map.removeLayer(r),(c=this.map)!=null&&c.getLayer(i)&&this.map.removeLayer(i),(s=this.map)!=null&&s.getLayer(l)&&this.map.removeLayer(l),(m=this.map)!=null&&m.getLayer(this.tmpLayer)&&this.map.removeLayer(this.tmpLayer),(d=this.map)!=null&&d.getLayer(this.tmpLabelLayer)&&this.map.removeLayer(this.tmpLabelLayer),(g=this.closeMarkers[o.id])==null||g.remove(),this.closeMarkers[o.id]=void 0,(u=this.pointMarkers[o.id])==null||u.forEach(f=>{f==null||f.remove()}),this.pointMarkers[o.id]=[],(y=this.tipMarker)==null||y.remove(),this.tipMarker=void 0,e&&((p=this.map)!=null&&p.getSource(a))&&this.map.removeSource(a),e&&((h=this.map)!=null&&h.getSource(this.tmpSource))&&this.map.removeSource(this.tmpSource)}}},yg={class:"idm-gl4-measure"};function bg(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip");return t.openBlock(),t.createElementBlock("div",yg,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+166+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("measure.measure"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:s})=>[t.createVNode(n,t.mergeProps(s,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[0]||(e[0]=[t.createElementVNode("i",{class:"iconfont icon-a-Measuredistance text-h4"},null,-1)])),_:2,__:[0]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4)])}const wg=Q(fg,[["render",bg]]),sb="",xg={name:"IdmDrawMarker",props:{map:{type:Object},gateway:{type:String},token:{type:String},simple:{type:Boolean,default:!1},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:()=>({})},editLayer:{type:Object,default:null},group:{type:Object,default:()=>({})}},emits:["close","save","hideLayer"],setup(){return{Theme:ye.useTheme()}},data(){var o;return{markerType:"Point",form:{latDegree:"",latMinute:"",latDir:"N",lngDegree:"",lngMinute:"",lngDir:"E",areaType:"Polygon",color:(o=this.Theme.current.value.colors)==null?void 0:o["map-green"],name:""},formRules:{lngDegree:[e=>e!=null&&e!==""||"required",e=>/^\d{1,3}$/.test(e)||"number",e=>parseInt(e)>=0&&parseInt(e)<=180||"0 ~ 180"],lngMinute:[e=>e==null||e===""||/^\d{1,2}(\.\d+)?$/.test(e)||"number",e=>e==null||e===""||parseInt(e)>=0&&parseInt(e)<=59||"0 ~ 59"],latDegree:[e=>e!=null&&e!==""||"required",e=>/^\d{1,2}$/.test(e)||"number",e=>parseInt(e)>=0&&parseInt(e)<=90||"0 ~ 90"],latMinute:[e=>e==null||e===""||/^\d{1,2}(\.\d+)?$/.test(e)||"number",e=>e==null||e===""||parseInt(e)>=0&&parseInt(e)<=59||"0 ~ 59"],color:[e=>e!=null&&e!==""||"required"],name:[e=>e!=null&&e!==""||"required"]},saving:!1,drawSource:"draw-marker-source",drawPointLayer:"draw-marker-point-layer",drawLineLayer:"draw-marker-line-layer",drawFillLayer:"draw-marker-fill-layer",drawTmpSource:"draw-marker-tmp-source",drawTmpLayer:"draw-marker-tmp-layer",drawCoords:[],rectCornerMarkers:[],polygonVertexMarkers:[],circleMarkers:[],drawRadiusSource:"draw-marker-radius-source",drawRadiusLayer:"draw-marker-radius-layer",tipMarker:null,pointMarker:null,pointHighlightMarker:null,editMarkers:[],deleteBtn:null,originalProperties:{}}},watch:{markerType:{handler(){var o;(o=this.editLayer)!=null&&o.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},immediate:!0},"form.areaType"(){var o;(o=this.editLayer)!=null&&o.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},map:{handler(){var o;this.map&&(this.handleBindMap(),(o=this.editLayer)!=null&&o.id&&this.loadEditLayer())},immediate:!0},"form.color":{handler(){this.handleChangePoint(),this.handleUpdateLayerColors()},immediate:!0}},beforeUnmount(){this.handleClearDraw(!0),this.handleUnbindMap()},methods:{handleClose(){this.handleClearDraw(!0),this.handleUnbindMap(),this.$emit("close")},handleBindMap(){var o,e;this.map&&(this.markerType==="Point"?(this.map.on("click",this.handleMapClickPoint),this.map.getCanvas().style.cursor="crosshair"):this.markerType==="Line"&&!((o=this.editLayer)!=null&&o.id)?(this.map.on("click",this.handleMapClickLine),this.map.on("mousemove",this.handleMapMoveLine),this.map.on("dblclick",this.handleMapDblClickLine),this.map.getCanvas().style.cursor="crosshair"):this.markerType==="Area"&&!((e=this.editLayer)!=null&&e.id)&&(this.form.areaType==="Polygon"?(this.map.on("click",this.handleMapClickPolygon),this.map.on("mousemove",this.handleMapMovePolygon),this.map.on("dblclick",this.handleMapDblClickPolygon)):this.form.areaType==="Circle"?(this.map.on("click",this.handleMapClickCircle),this.map.on("mousemove",this.handleMapMoveCircle)):this.form.areaType==="Rect"&&(this.map.on("click",this.handleMapClickRect),this.map.on("mousemove",this.handleMapMoveRect)),this.map.getCanvas().style.cursor="crosshair"))},handleUnbindMap(){this.map&&(this.map.off("click",this.handleMapClickPoint),this.map.off("click",this.handleMapClickLine),this.map.off("mousemove",this.handleMapMoveLine),this.map.off("dblclick",this.handleMapDblClickLine),this.map.off("click",this.handleMapClickPolygon),this.map.off("mousemove",this.handleMapMovePolygon),this.map.off("dblclick",this.handleMapDblClickPolygon),this.map.off("click",this.handleMapClickCircle),this.map.off("mousemove",this.handleMapMoveCircle),this.map.off("click",this.handleMapClickRect),this.map.off("mousemove",this.handleMapMoveRect),this.map.getCanvas().style.cursor="grab")},handleRebindMap(){this.handleUnbindMap(),this.handleBindMap()},loadEditLayer(){var i,l,n,c,s,m;if(!((i=this.editLayer)!=null&&i.extend)||!this.map)return;const o=typeof this.editLayer.extend=="string"?JSON.parse(this.editLayer.extend):this.editLayer.extend;if(!o)return;const a=(o.features||(o.type==="Feature"?[o]:[]))[0];if(!a)return;this.originalProperties=a.properties||{},this.form.name=this.editLayer.name||"",this.form.color=this.editLayer.color||((l=this.originalProperties)==null?void 0:l.color)||((n=this.Theme.current.value.colors)==null?void 0:n["map-green"])||"#4CAF50";const r=(c=a.geometry)==null?void 0:c.type;if(r==="Point"){this.markerType="Point";const[d,g]=a.geometry.coordinates;this.drawCoords=[[d,g]],this.form.latDegree=Number(M.LngLatHelper.lat2pretty(g).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(g).minute),this.form.latDir=M.LngLatHelper.lat2pretty(g).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(d).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(d).minute),this.form.lngDir=M.LngLatHelper.lng2pretty(d).direction,this.handleRenderPoint(this.drawCoords,this.form.color),this.setupPointEdit()}else r==="LineString"?(this.markerType="Line",this.$nextTick(()=>{this.handlerRenderEditLine(a),this.setupLineEdit(),this.handleUnbindMap()})):r==="Polygon"&&(this.markerType="Area",this.form.areaType=(m=(s=this.originalProperties)==null?void 0:s.shape)==null?void 0:m.toLowerCase(),this.$nextTick(()=>{this.handlerRenderEditPolygon(o),this.setupPolygonEdit(a),this.handleUnbindMap()}));this.$emit("hideLayer",this.editLayer.id)},setupPointEdit(){var a;if(!this.pointMarker)return;this.pointMarker.setDraggable(!0),this.pointMarker.off("drag",this.handlePointDrag),this.pointMarker.on("drag",this.handlePointDrag),this.pointMarker.off("dragend",this.handlePointDrag),this.pointMarker.on("dragend",this.handlePointDrag),(a=this.pointHighlightMarker)==null||a.remove();const o=document.createElement("div");o.className="idm-gl4-point-center-ring";const e=this.pointMarker.getLngLat();this.pointHighlightMarker=new me.Marker({element:o,anchor:"center",offset:[0,0]}).setLngLat(e).addTo(this.map),this.pointMarker.on("drag",()=>{var r;(r=this.pointHighlightMarker)==null||r.setLngLat(this.pointMarker.getLngLat())})},handlePointDrag(){const{lng:o,lat:e}=this.pointMarker.getLngLat();this.drawCoords=[[o,e]],this.form.latDegree=Number(M.LngLatHelper.lat2pretty(e).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(e).minute),this.form.latDir=M.LngLatHelper.lat2pretty(e).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(o).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(o).minute),this.form.lngDir=M.LngLatHelper.lng2pretty(o).direction},clearEditMarkers(){this.editMarkers.forEach(o=>o.remove()),this.editMarkers=[],this._edgeContextMenuHandler&&this.map&&(this.map.off("contextmenu",this._edgeContextMenuHandler),this._edgeContextMenuHandler=null)},handlerRenderEditLine(o){this.drawCoords=o.geometry.coordinates.map(r=>[...r]);const e=T.featureCollection([o,...this.drawCoords.map(r=>T.point(r))]);this.handleSetDrawSource(e);const a=3;this.map.getLayer(this.drawLineLayer)||this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":a}})},setupLineEdit(){this.clearEditMarkers(),this.drawCoords.forEach((e,a)=>{const r=document.createElement("div");r.className="idm-gl4-edit-vertex",r.style.backgroundColor=this.form.color;const i=new me.Marker({element:r,draggable:!0}).setLngLat(e).addTo(this.map);i.on("dragstart",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:l,lat:n}=i.getLngLat();this.handleRenderVertexLabel([l,n],40)}),i.on("drag",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:l,lat:n}=i.getLngLat();this.handleUpdateVertexLabel([l,n]),this.drawCoords[a]=[l,n],this.handlerRenderEditLine(T.lineString(this.drawCoords,{type:"Line",color:this.form.color}))}),i.on("dragend",()=>{this.map.getCanvas().style.cursor="grab";const{lng:l,lat:n}=i.getLngLat();this.drawCoords[a]=[l,n],this.handlerRenderEditLine(T.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.handleClearVertexLabels()}),r.addEventListener("contextmenu",l=>{l.preventDefault(),l.stopPropagation(),this.drawCoords.length>2&&this.showDeleteButton(e,()=>{this.drawCoords.splice(a,1),this.handlerRenderEditLine(T.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()})}),this.editMarkers.push(i)});const o=e=>{e.preventDefault();const{lng:a,lat:r}=e.lngLat,i=T.point([a,r]),l=T.lineString(this.drawCoords),n=T.nearestPointOnLine(l,i);if(n){const c=n.properties.index;this.showDeleteButton([a,r],()=>{this.drawCoords.splice(c+1,0,[a,r]),this.handlerRenderEditLine(T.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()},this.$t("actions.add")||"新增","add")}};this.map.on("contextmenu",o),this._edgeContextMenuHandler=o},showDeleteButton(o,e,a,r="delete"){this.hideDeleteButton();const i=this.map.getContainer(),l=document.createElement("button");l.textContent=a||this.$t("actions.delete"),l.className=r==="add"?"idm-gl4-edit-add-btn":"idm-gl4-edit-delete-btn";const n=this.map.project(o);l.style.left=`${n.x}px`,l.style.top=`${n.y}px`;const c=s=>{s.stopPropagation(),e(),this.hideDeleteButton()};l.addEventListener("click",c),i.appendChild(l),this.deleteBtn=l,this.map.once("click",()=>this.hideDeleteButton())},hideDeleteButton(){this.deleteBtn&&(this.deleteBtn.remove(),this.deleteBtn=null)},handlerRenderEditPolygon(o){this.handleSetDrawSource(o);const e=3;this.map.getLayer(this.drawFillLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-width",e),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":e}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},setupPolygonEdit(o){this.clearEditMarkers();const e=o.geometry.coordinates[0].slice(0,-1);this.drawCoords=e.map(r=>[...r]),this.drawCoords.forEach((r,i)=>{const l=document.createElement("div");l.className="idm-gl4-edit-vertex",l.style.backgroundColor=this.form.color;const n=new me.Marker({element:l,draggable:!0}).setLngLat(r).addTo(this.map);n.on("dragstart",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:c,lat:s}=n.getLngLat();this.handleRenderVertexLabel([c,s])}),n.on("drag",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:c,lat:s}=n.getLngLat();this.handleUpdateVertexLabel([c,s]),this.drawCoords[i]=[c,s],this.handleRenderPolygonFill(this.drawCoords)}),n.on("dragend",()=>{this.map.getCanvas().style.cursor="grab";const{lng:c,lat:s}=n.getLngLat();this.drawCoords[i]=[c,s],this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels()}),l.addEventListener("contextmenu",c=>{c.preventDefault(),c.stopPropagation(),this.drawCoords.length>3&&this.showDeleteButton(r,()=>{this.drawCoords.splice(i,1),this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels(),this.setupPolygonEdit({geometry:{type:"Polygon",coordinates:[[...this.drawCoords,this.drawCoords[0]]]},properties:this.originalProperties})})}),this.editMarkers.push(n)});const a=r=>{r.preventDefault();const{lng:i,lat:l}=r.lngLat,n=T.point([i,l]),c=T.lineString([...this.drawCoords,this.drawCoords[0]]),s=T.nearestPointOnLine(c,n);if(s){const m=s.properties.index,d=m>=this.drawCoords.length-1?this.drawCoords.length-1:m;this.showDeleteButton([i,l],()=>{this.drawCoords.splice(d+1,0,[i,l]),this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels(),this.setupPolygonEdit({geometry:{type:"Polygon",coordinates:[[...this.drawCoords,this.drawCoords[0]]]},properties:this.originalProperties})},this.$t("actions.add")||"新增","add")}};this.map.on("contextmenu",a),this._edgeContextMenuHandler=a},handleMapClickPoint(o){var r;const{lng:e,lat:a}=o.lngLat;this.drawCoords=[[e,a]],this.form.latDegree=Number(M.LngLatHelper.lat2pretty(a).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(a).minute),this.form.latDir=M.LngLatHelper.lat2pretty(a).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(e).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(e).minute),this.form.lngDir=M.LngLatHelper.lng2pretty(e).direction,this.handleRenderPoint(this.drawCoords,this.form.color),(r=this.editLayer)!=null&&r.id&&this.setupPointEdit()},handleChangePoint(){var u;const{latDegree:o,latMinute:e,latDir:a,lngDegree:r,lngMinute:i,lngDir:l}=this.form,n=parseFloat(o),c=parseFloat(e),s=parseFloat(r),m=parseFloat(i);if(isNaN(n)||isNaN(s))return;const d=(n+(isNaN(c)?0:c)/60)*(a==="S"?-1:1),g=(s+(isNaN(m)?0:m)/60)*(l==="W"?-1:1);this.drawCoords=[[g,d]],this.handleRenderPoint(this.drawCoords,this.form.color),(u=this.editLayer)!=null&&u.id&&this.setupPointEdit()},handleRenderPoint(o,e){var i;if((i=this.pointMarker)==null||i.remove(),!o||!o.length)return;const[a,r]=o[0];this.pointMarker=new me.Marker({color:e}).setLngLat([a,r]).addTo(this.map)},handleMapClickLine(o){var r;const{lng:e,lat:a}=o.lngLat;this.drawCoords.push([e,a]),this.handleRenderLine(this.drawCoords),(r=this.editLayer)!=null&&r.id&&this.setupLineEdit()},handleMapMoveLine(o){if(!this.drawCoords.length)return;const{lng:e,lat:a}=o.lngLat;this.handleRenderTmpLine(this.drawCoords.at(-1),[e,a])},handleMapDblClickLine(o){o.preventDefault(),this.drawCoords.length>1&&this.drawCoords.pop(),this.handleRenderLine(this.drawCoords),this.handleClearTmp(),this.map.off("click",this.handleMapClickLine),this.map.off("mousemove",this.handleMapMoveLine),this.map.off("dblclick",this.handleMapDblClickLine)},handleRenderLine(o){if(!o||o.length<1)return;const e=[];o==null||o.forEach((i,l)=>{e.push(M.GeoJsonHelper.drawPoint(i==null?void 0:i[1],i==null?void 0:i[0]))}),(o==null?void 0:o.length)>=2&&e.push(M.GeoJsonHelper.drawLine(o));const a=2,r=T.featureCollection(e);this.handleSetDrawSource(r),this.map.getLayer(this.drawLineLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-color",this.form.color),this.map.setPaintProperty(this.drawLineLayer,"line-width",a),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":a}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},handleRenderTmpLine(o,e){const a=M.GeoJsonHelper.drawLine([o,e]),r=T.featureCollection([a]);this.map.getSource(this.drawTmpSource)?this.map.getSource(this.drawTmpSource).setData(r):this.map.addSource(this.drawTmpSource,{type:"geojson",data:r}),this.map.getLayer(this.drawTmpLayer)||this.map.addLayer({id:this.drawTmpLayer,type:"line",source:this.drawTmpSource,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":2,"line-dasharray":[3,2]}});const i={lng:o[0],lat:o[1]},l={lng:e[0],lat:e[1]},n=M.LaneHelper.calculateDistance(i,l,!0,2),c=M.LaneHelper.calculateBearing(i,l,!0,2);let s=0;for(let d=1;d<this.drawCoords.length;d++){const g={lng:this.drawCoords[d-1][0],lat:this.drawCoords[d-1][1]},u={lng:this.drawCoords[d][0],lat:this.drawCoords[d][1]};s+=M.LaneHelper.calculateDistance(g,u,!0,4)}s=M.LngLatHelper.roundPrecision(s+n,1);const m=`
|
|
218
218
|
<div class="marker-label">${this.$t("measure.totalDistance")}: <b>${s}</b>nm, ${this.$t("measure.bearing")}: <b>${c}</b>°</div>
|
|
219
|
-
<div class="marker-label"> ${this.$t("measure.clickTips")}</div>`;if(this.tipMarker)this.tipMarker._element.innerHTML=m,this.tipMarker.setLngLat([e[0],e[1]]);else{const d=document.createElement("div");d.className="idm-gl4-draw-tip-marker",d.innerHTML=m,this.tipMarker=new me.Marker(d).setOffset([140,0]).setLngLat([e[0],e[1]]).addTo(this.map)}},handleRefreshLine(){this.drawCoords.length>=1&&this.handleRenderLine(this.drawCoords)},handleMapClickPolygon(o){var r;const{lng:e,lat:a}=o.lngLat;this.drawCoords.push([e,a]),this.drawCoords.length>=3&&this.handleRenderPolygonFill(this.drawCoords),this.handleRenderAllVertexLabels(this.drawCoords),(r=this.editLayer)!=null&&r.id&&this.setupPolygonEdit()},handleMapMovePolygon(o){if(!this.drawCoords.length)return;const{lng:e,lat:a}=o.lngLat,r=[...this.drawCoords,[e,a]];r.length>=1&&this.handleRenderPolygonFill(r),this.handleRenderAllVertexLabels(r)},handleMapDblClickPolygon(o){o.preventDefault(),this.drawCoords.length>=1&&this.drawCoords.pop(),this.drawCoords.length>=1&&this.handleRenderPolygonFill(this.drawCoords),this.handleRenderAllVertexLabels(this.drawCoords),this.map.off("click",this.handleMapClickPolygon),this.map.off("mousemove",this.handleMapMovePolygon),this.map.off("dblclick",this.handleMapDblClickPolygon)},handleRenderPolygonFill(o){var i;let e=[];if(o==null||o.forEach((l,n)=>{e.push(T.point(l))}),(o==null?void 0:o.length)>2){const l=[...o,o[0]];e.push(M.GeoJsonHelper.drawPolygon(l,{...this.originalProperties}))}const a=T.featureCollection(e);this.handleSetDrawSource(a);const r=(i=this.editLayer)!=null&&i.id?3:2;this.map.getLayer(this.drawFillLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-width",r),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":r}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},handleRenderVertexLabel(o,e=8){this.handleClearVertexLabels();const a=M.LngLatHelper.lat2pretty(o[1],4).pretty,r=M.LngLatHelper.lng2pretty(o[0],4).pretty,i=document.createElement("div");i.className="idm-gl4-draw-corner-label center",i.innerHTML=`<span class="corner-text">${a} <br/> ${r}</span>`;const l=new me.Marker(i,{anchor:"bottom",offset:[0,e]}).setLngLat(o).addTo(this.map);this.polygonVertexMarkers.push(l)},handleRenderAllVertexLabels(o){this.handleClearVertexLabels();const e=o.reduce((a,r)=>[a[0]+r[0],a[1]+r[1]],[0,0]);e[0]/=o.length,e[1]/=o.length,o.forEach(a=>{const r=a[0]-e[0],i=a[1]-e[1];let l="center";i>=0&&r>=0?l="bottom-left":i>=0&&r<0?l="bottom-right":i<0&&r>=0?l="top-left":l="top-right";const n=M.LngLatHelper.lat2pretty(a[1],4).pretty,c=M.LngLatHelper.lng2pretty(a[0],4).pretty,s=document.createElement("div");s.className="idm-gl4-draw-corner-label "+l,s.innerHTML=`<span class="corner-text">${n} <br/> ${c}</span>`;const m=new me.Marker(s,{anchor:l}).setLngLat(a).addTo(this.map);this.polygonVertexMarkers.push(m)})},handleUpdateVertexLabel(o){if(!this.polygonVertexMarkers.length)return;const e=this.polygonVertexMarkers[0];e.setLngLat(o);const a=M.LngLatHelper.lat2pretty(o[1],4).pretty,r=M.LngLatHelper.lng2pretty(o[0],4).pretty,i=e.getElement().querySelector(".corner-text");i&&(i.innerHTML=`${a} <br/> ${r}`)},handleClearVertexLabels(){this.polygonVertexMarkers.forEach(o=>o.remove()),this.polygonVertexMarkers=[]},handleMapClickCircle(o){const{lng:e,lat:a}=o.lngLat;if(this.drawCoords.length===0){this.drawCoords.push([e,a]);const r=T.featureCollection([T.point([e,a])]);this.handleSetDrawSource(r),this.map.getLayer(this.drawPointLayer)||this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}),this.handleRenderCircleCenterLabel([e,a])}else{const r=this.drawCoords[0],i=[e,a],l=T.distance(T.point(r),T.point(i),{units:"nauticalmiles"}),n=M.GeoJsonHelper.drawCircle(r[0],r[1],l),c=T.featureCollection([T.point(r),n]);this.handleSetDrawSource(c),this.handleRenderAreaLayers(),this.handleRenderRadiusLine(r,i,l),this.drawCoords=[r,i],this.map.off("click",this.handleMapClickCircle),this.map.off("mousemove",this.handleMapMoveCircle)}},handleMapMoveCircle(o){if(this.drawCoords.length!==1)return;const e=this.drawCoords[0],a=[o.lngLat.lng,o.lngLat.lat],r=T.distance(T.point(e),T.point(a),{units:"nauticalmiles"}),i=M.GeoJsonHelper.drawCircle(e[0],e[1],r),l=T.featureCollection([T.point(e),i]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderAreaLayers(),this.handleRenderRadiusLine(e,a,r)},handleRenderCircleCenterLabel(o){const e=M.LngLatHelper.lat2pretty(o[1],4).pretty,a=M.LngLatHelper.lng2pretty(o[0],4).pretty,r=document.createElement("div");r.className="idm-gl4-draw-corner-label bottom-right",r.innerHTML=`<span class="corner-text">${e} <br/> ${a}</span>`;const i=new me.Marker(r,{anchor:"bottom-right"}).setLngLat(o).addTo(this.map);this.circleMarkers.push(i)},handleRenderRadiusLine(o,e,a){const r=M.LngLatHelper.roundPrecision(a,2),i=T.featureCollection([T.lineString([o,e])]);this.map.getSource(this.drawRadiusSource)?this.map.getSource(this.drawRadiusSource).setData(i):this.map.addSource(this.drawRadiusSource,{type:"geojson",data:i}),this.map.getLayer(this.drawRadiusLayer)||this.map.addLayer({id:this.drawRadiusLayer,type:"line",source:this.drawRadiusSource,layout:{"line-cap":"round"},paint:{"line-color":this.form.color,"line-width":1.5,"line-dasharray":[4,3]}});const l=[(o[0]+e[0])/2,(o[1]+e[1])/2],n=this.map.project(o),c=this.map.project(e),s=c.x-n.x,m=c.y-n.y;let d=Math.atan2(m,s)*180/Math.PI;d>90&&(d-=180),d<-90&&(d+=180);const g=16,u=(d-90)*Math.PI/180,y=Math.round(Math.cos(u)*g),p=Math.round(Math.sin(u)*g);this.circleMarkers.length>1&&(this.circleMarkers[1].remove(),this.circleMarkers.splice(1,1));const h=document.createElement("div"),f=document.createElement("span");f.className="idm-gl4-draw-radius-label",f.style.transform=`rotate(${d}deg)`,f.style.transformOrigin="center",f.style.display="inline-block",f.textContent=`${r} nm`,h.appendChild(f);const w=new me.Marker(h,{anchor:"center",offset:[y,p]}).setLngLat(l).addTo(this.map);this.circleMarkers.push(w)},handleClearCircleLabels(){var o,e;this.circleMarkers.forEach(a=>a.remove()),this.circleMarkers=[],(o=this.map)!=null&&o.getLayer(this.drawRadiusLayer)&&this.map.removeLayer(this.drawRadiusLayer),(e=this.map)!=null&&e.getSource(this.drawRadiusSource)&&this.map.removeSource(this.drawRadiusSource)},buildRectFeatureCollection(o,e){const a=Math.min(o[0],e[0]),r=Math.max(o[0],e[0]),i=Math.min(o[1],e[1]),l=Math.max(o[1],e[1]);return[[a,l],[r,l],[r,i],[a,i]]},handleMapClickRect(o){const{lng:e,lat:a}=o.lngLat;if(this.drawCoords.length===0)this.drawCoords.push([e,a]);else{const r=this.drawCoords[0],i=[e,a],l=M.GeoJsonHelper.drawRect(r,i);delete l.bbox;const n=this.buildRectFeatureCollection(r,i),c=T.featureCollection([l,...n.map(s=>T.point(s))]);this.handleSetDrawSource(c),this.handleRenderRectLayers(),this.handleRenderRectCorners(r,i),this.drawCoords=[r,i],this.map.off("click",this.handleMapClickRect),this.map.off("mousemove",this.handleMapMoveRect)}},handleMapMoveRect(o){if(this.drawCoords.length!==1)return;const e=this.drawCoords[0],a=[o.lngLat.lng,o.lngLat.lat],r=M.GeoJsonHelper.drawRect(e,a),i=this.buildRectFeatureCollection(e,a),l=T.featureCollection([r,...i.map(n=>T.point(n))]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderRectLayers(),this.handleRenderRectCorners(e,a)},handleRenderRectLayers(){var e;const o=(e=this.editLayer)!=null&&e.id?3:2;this.map.getLayer(this.drawFillLayer)||this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.getLayer(this.drawLineLayer)?this.map.setPaintProperty(this.drawLineLayer,"line-width",o):this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":o}}),this.map.getLayer(this.drawPointLayer)||this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}})},handleRenderRectCorners(o,e){const a=Math.min(o[0],e[0]),r=Math.max(o[0],e[0]),i=Math.min(o[1],e[1]),l=Math.max(o[1],e[1]),n=[{coord:[a,l],anchor:"bottom-right"},{coord:[r,l],anchor:"bottom-left"},{coord:[r,i],anchor:"top-left"},{coord:[a,i],anchor:"top-right"}];this.handleClearRectCorners(),n.forEach(({coord:c,anchor:s})=>{const m=M.LngLatHelper.lat2pretty(c[1],4).pretty,d=M.LngLatHelper.lng2pretty(c[0],4).pretty,g=document.createElement("div");g.className="idm-gl4-draw-corner-label "+s,g.innerHTML=`<span class="corner-text">${m} <br/> ${d}</span>`;const u=new me.Marker(g,{anchor:s}).setLngLat(c).addTo(this.map);this.rectCornerMarkers.push(u)})},handleClearRectCorners(){this.rectCornerMarkers.forEach(o=>o.remove()),this.rectCornerMarkers=[]},handleRenderAreaLayers(){var e;const o=(e=this.editLayer)!=null&&e.id?3:2;this.map.getLayer(this.drawFillLayer)||this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.getLayer(this.drawLineLayer)?this.map.setPaintProperty(this.drawLineLayer,"line-width",o):this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":o}})},handleSetDrawSource(o){this.map.getSource(this.drawSource)?this.map.getSource(this.drawSource).setData(o):this.map.addSource(this.drawSource,{type:"geojson",data:o})},handleClearTmp(){var o,e,a;(o=this.map)!=null&&o.getLayer(this.drawTmpLayer)&&this.map.removeLayer(this.drawTmpLayer),(e=this.map)!=null&&e.getSource(this.drawTmpSource)&&this.map.removeSource(this.drawTmpSource),(a=this.tipMarker)==null||a.remove(),this.tipMarker=null},handleUpdateLayerColors(){if(!this.map)return;const o=this.form.color;this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",o),this.map.getLayer(this.drawLineLayer)&&this.map.setPaintProperty(this.drawLineLayer,"line-color",o),this.map.getLayer(this.drawFillLayer)&&this.map.setPaintProperty(this.drawFillLayer,"fill-color",o),this.map.getLayer(this.drawRadiusLayer)&&this.map.setPaintProperty(this.drawRadiusLayer,"line-color",o),this.map.getLayer(this.drawTmpLayer)&&this.map.setPaintProperty(this.drawTmpLayer,"line-color",o),this.editMarkers.forEach(e=>{e.getElement()&&(e.getElement().style.backgroundColor=o)})},handleClearDraw(o=!1){var a,r,i,l,n;this.handleClearTmp(),this.hideDeleteButton();const e=[this.drawPointLayer,this.drawLineLayer,this.drawFillLayer];for(const c of e)(a=this.map)!=null&&a.getLayer(c)&&((r=this.map)==null||r.removeLayer(c));(i=this.map)!=null&&i.getSource(this.drawSource)&&this.map.removeSource(this.drawSource),this.drawCoords=[],this.originalProperties={},this.handleClearRectCorners(),this.handleClearVertexLabels(),this.handleClearCircleLabels(),(l=this.pointMarker)==null||l.remove(),this.pointMarker=null,(n=this.pointHighlightMarker)==null||n.remove(),this.pointHighlightMarker=null,this.clearEditMarkers(),this.handleRebindMap()},async handleSave(){var r,i;let o=null;if(this.markerType==="Point"?await this.$refs.pointForm.validate().then(l=>{var n;if(l!=null&&l.valid){if(!this.drawCoords.length)return;const[c,s]=this.drawCoords[0];o=T.featureCollection([M.GeoJsonHelper.drawPoint(s,c,{...this.originalProperties,color:this.form.color,name:this.form.name})]),(n=o.features)==null||n.forEach(m=>{m.properties.color=this.form.color,m.properties.name=this.form.name})}}):this.markerType==="Line"?await this.$refs.lineForm.validate().then(l=>{if(l!=null&&l.valid){if(this.drawCoords.length<2)return;const n=[],c=M.LaneHelper.generateRouteAccordingToWaypoints(this.drawCoords.map(s=>({lng:s==null?void 0:s[0],lat:s==null?void 0:s[1]})));for(const s of c)s.length>1&&n.push(M.GeoJsonHelper.drawLine(s,{properties:{...this.originalProperties,color:this.form.color,name:this.form.name}}));o=T.featureCollection(n)}}):this.markerType==="Area"&&await this.$refs.areaForm.validate().then(l=>{var n,c,s;if(l!=null&&l.valid){const m=(n=this.map)==null?void 0:n.getSource(this.drawSource);if(!m)return;const d=m._data;if(!((c=d==null?void 0:d.features)!=null&&c.length))return;let g=((s=d.features)==null?void 0:s.filter(u=>u.geometry.type==="Polygon"))||[];if(g=g==null?void 0:g.map(u=>(u.properties.name=this.form.name,u.properties.color=this.form.color,u)),!g.length)return;o=T.featureCollection(g)}}),!o)return!1;const e={name:this.form.name,format:"geojson",color:this.form.color,extend:o};this.saving=!0,await((r=this.editLayer)!=null&&r.id?ce.put(`${this.gateway}/api/arc/layers/${this.editLayer.id}`,e,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}):ce.post(`${this.gateway}/api/arc/lygroups/${(i=this.group)==null?void 0:i.id}/layers`,e,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}})).then(l=>{var n,c,s,m;((n=l.data)==null?void 0:n.code)===0&&this.$emit("save",{...e,id:((c=this.editLayer)==null?void 0:c.id)||((m=(s=l.data)==null?void 0:s.data)==null?void 0:m.id)}),this.saving=!1}).catch(l=>{console.error("save marker error",l),this.saving=!1})}}},kg={class:"text-h6 font-weight-600"},Ag={class:"text-label mb-1"},Lg={class:"text-label mb-1"},Cg={class:"mb-1"},vg={class:"text-label mb-1"},zg={class:"mb-1"},_g={class:"text-label mb-1"},Sg={class:"mb-1"},Ng={class:"text-label mb-1"},Mg={class:"color-picker-row d-flex align-start ga-2"},Pg=["value"],Vg={class:"mb-n2"},Tg={class:"text-label mb-1"},Eg={class:"mb-1"},Dg={class:"text-label mb-1"},Rg={class:"color-picker-row d-flex align-start ga-2"},Bg=["value"],Ig={class:"mb-n2"},Fg={class:"text-label mb-1"},Gg={key:0,class:"mb-3"},jg={class:"text-label mb-1"},Wg={class:"mb-1"},Zg={class:"text-label mb-1"},Xg={class:"color-picker-row d-flex align-start ga-2"},Hg=["value"],Og={class:"mb-n2"},Yg={class:"text-label mb-1"};function Ug(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VTextField"),d=t.resolveComponent("VCardText"),g=t.resolveComponent("VBtnToggle"),u=t.resolveComponent("VCol"),y=t.resolveComponent("VRow"),p=t.resolveComponent("VCardActions"),h=t.resolveComponent("VForm"),f=t.resolveComponent("VCard");return t.openBlock(),t.createBlock(f,{class:"idm-gl4-draw-dialog-card",elevation:"4"},{default:t.withCtx(()=>{var w;return[t.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>{var b;return[t.createElementVNode("span",kg,t.toDisplayString((b=a.editLayer)!=null&&b.id?o.$t("actions.edit"):o.$t("actions.addMarker")),1),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:t.withCtx(()=>e[21]||(e[21]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[21]},8,["onClick"])]}),_:1}),t.createVNode(s),t.createVNode(d,{class:"text-body-1 px-4 pb-0"},{default:t.withCtx(()=>{var b;return[t.createElementVNode("div",Ag,t.toDisplayString(o.$t("marker.group")),1),t.createVNode(m,{"model-value":(b=a.group)==null?void 0:b.name,density:"compact",variant:"outlined","hide-details":"",disabled:"",class:"input-btn-bg-1"},null,8,["model-value"])]}),_:1}),(w=a.editLayer)!=null&&w.id?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(d,{key:0,class:"text-body-1 px-4 pb-0"},{default:t.withCtx(()=>{var b;return[t.createElementVNode("div",Lg,[t.createTextVNode(t.toDisplayString(o.$t("marker.markerType")),1),e[22]||(e[22]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(g,{modelValue:i.markerType,"onUpdate:modelValue":e[0]||(e[0]=L=>i.markerType=L),mandatory:"",group:"",density:"compact",variant:"flat",class:"w-100",disabled:!!((b=a.editLayer)!=null&&b.id)},{default:t.withCtx(()=>[t.createVNode(n,{value:"Point",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.markerType==="Point"?"":"btn-border-1 btn-bg-1"]),color:i.markerType==="Point"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.point")),1)]),_:1},8,["class","color"]),t.createVNode(n,{value:"Line",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.markerType==="Line"?"":"btn-border-1 btn-bg-1"]),style:{"border-left":"0 !important","border-right":"0 !important"},color:i.markerType==="Line"?"primary":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.line")),1)]),_:1},8,["class","color"]),t.createVNode(n,{value:"Area",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.markerType==="Area"?"":"btn-border-1 btn-bg-1"]),color:i.markerType==="Area"?"primary":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.area")),1)]),_:1},8,["class","color"])]),_:1},8,["modelValue","disabled"])]}),_:1})),i.markerType==="Point"?(t.openBlock(),t.createBlock(h,{key:1,ref:"pointForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.handleSave,["prevent"])},{default:t.withCtx(()=>[t.createVNode(d,{class:"px-4 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",Cg,[t.createElementVNode("div",vg,[t.createTextVNode(t.toDisplayString(o.$t("marker.lat")),1),e[23]||(e[23]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(y,{class:"ma-0"},{default:t.withCtx(()=>[t.createVNode(u,{cols:"4",class:"pa-0 d-flex"},{default:t.withCtx(()=>[t.createVNode(m,{modelValue:i.form.latDegree,"onUpdate:modelValue":[e[1]||(e[1]=b=>i.form.latDegree=b),e[2]||(e[2]=b=>l.handleChangePoint())],rules:i.formRules.latDegree,label:"",autocomplete:"off",density:"compact",variant:"outlined",height:"32px","min-height":"32px",required:"",dense:"",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[24]||(e[24]=t.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[24]}),t.createVNode(u,{cols:"6",class:"pa-0 d-flex"},{default:t.withCtx(()=>[t.createVNode(m,{modelValue:i.form.latMinute,"onUpdate:modelValue":[e[3]||(e[3]=b=>i.form.latMinute=b),e[4]||(e[4]=b=>l.handleChangePoint())],rules:i.formRules.latMinute,label:"",height:"32px","min-height":"32px",autocomplete:"off",density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[25]||(e[25]=t.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[25]}),t.createVNode(u,{cols:"2",class:"pa-0"},{default:t.withCtx(()=>[t.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[5]||(e[5]=b=>{i.form.latDir=i.form.latDir==="N"?"S":"N",l.handleChangePoint()})},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.form.latDir),1)]),_:1})]),_:1})]),_:1})]),t.createElementVNode("div",zg,[t.createElementVNode("div",_g,[t.createTextVNode(t.toDisplayString(o.$t("marker.lng")),1),e[26]||(e[26]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(y,{class:"ma-0"},{default:t.withCtx(()=>[t.createVNode(u,{cols:"4",class:"pa-0 d-flex"},{default:t.withCtx(()=>[t.createVNode(m,{modelValue:i.form.lngDegree,"onUpdate:modelValue":[e[6]||(e[6]=b=>i.form.lngDegree=b),e[7]||(e[7]=b=>l.handleChangePoint())],rules:i.formRules.lngDegree,density:"compact",variant:"outlined",autocomplete:"off",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[27]||(e[27]=t.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[27]}),t.createVNode(u,{cols:"6",class:"pa-0 d-flex"},{default:t.withCtx(()=>[t.createVNode(m,{modelValue:i.form.lngMinute,"onUpdate:modelValue":[e[8]||(e[8]=b=>i.form.lngMinute=b),e[9]||(e[9]=b=>l.handleChangePoint())],rules:i.formRules.lngMinute,density:"compact",variant:"outlined",autocomplete:"off",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[28]||(e[28]=t.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[28]}),t.createVNode(u,{cols:"2",class:"pa-0"},{default:t.withCtx(()=>[t.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[10]||(e[10]=b=>{i.form.lngDir=i.form.lngDir==="E"?"W":"E",l.handleChangePoint()})},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.form.lngDir),1)]),_:1})]),_:1})]),_:1})]),t.createElementVNode("div",Sg,[t.createElementVNode("div",Ng,[t.createTextVNode(t.toDisplayString(o.$t("marker.color")),1),e[29]||(e[29]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createElementVNode("div",Mg,[t.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[11]||(e[11]=b=>i.form.color=b.target.value)},null,40,Pg),t.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[12]||(e[12]=b=>i.form.color=b),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),t.createElementVNode("div",Vg,[t.createElementVNode("div",Tg,[t.createTextVNode(t.toDisplayString(o.$t("marker.name")),1),e[30]||(e[30]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[13]||(e[13]=b=>i.form.name=b),density:"compact",variant:"outlined",rules:i.formRules.name,autocomplete:"off",class:"input-btn-bg-1"},null,8,["modelValue","rules"])])]),_:1}),t.createVNode(s),t.createVNode(p,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.clear")),1)]),_:1},8,["onClick"]),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])):t.createCommentVNode("",!0),i.markerType==="Line"?(t.openBlock(),t.createBlock(h,{key:2,ref:"lineForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.handleSave,["prevent"])},{default:t.withCtx(()=>[t.createVNode(d,{class:"px-4 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",Eg,[t.createElementVNode("div",Dg,[t.createTextVNode(t.toDisplayString(o.$t("marker.color")),1),e[31]||(e[31]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createElementVNode("div",Rg,[t.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[14]||(e[14]=b=>i.form.color=b.target.value)},null,40,Bg),t.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[15]||(e[15]=b=>i.form.color=b),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),t.createElementVNode("div",Ig,[t.createElementVNode("div",Fg,[t.createTextVNode(t.toDisplayString(o.$t("marker.name")),1),e[32]||(e[32]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[16]||(e[16]=b=>i.form.name=b),density:"compact",variant:"outlined",rules:i.formRules.name,autocomplete:"off",class:"input-btn-bg-1"},null,8,["modelValue","rules"])])]),_:1}),t.createVNode(s),t.createVNode(p,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.clear")),1)]),_:1},8,["onClick"]),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])):t.createCommentVNode("",!0),i.markerType==="Area"?(t.openBlock(),t.createBlock(h,{key:3,ref:"areaForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.handleSave,["prevent"])},{default:t.withCtx(()=>[t.createVNode(d,{class:"px-4 text-body-1"},{default:t.withCtx(()=>{var b,L;return[(b=a.editLayer)!=null&&b.id?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Gg,[t.createElementVNode("div",jg,[t.createTextVNode(t.toDisplayString(o.$t("marker.areaType")),1),e[33]||(e[33]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(g,{modelValue:i.form.areaType,"onUpdate:modelValue":e[17]||(e[17]=k=>i.form.areaType=k),mandatory:"",group:"",density:"compact",variant:"flat",color:"primary",class:"w-100",disabled:!!((L=a.editLayer)!=null&&L.id)},{default:t.withCtx(()=>[t.createVNode(n,{value:"Polygon",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.form.areaType==="Polygon"?"":"btn-border-1 btn-bg-1"]),color:i.form.areaType==="Polygon"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.polygon")),1)]),_:1},8,["class","color"]),t.createVNode(n,{value:"Circle",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.form.areaType==="Circle"?"":"btn-border-1 btn-bg-1"]),style:{"border-left":"0 !important","border-right":"0 !important"},color:i.form.areaType==="Circle"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.circle")),1)]),_:1},8,["class","color"]),t.createVNode(n,{value:"Rect",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.form.areaType==="Rect"?"":"btn-border-1 btn-bg-1"]),color:i.form.areaType==="Rect"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.rect")),1)]),_:1},8,["class","color"])]),_:1},8,["modelValue","disabled"])])),t.createElementVNode("div",Wg,[t.createElementVNode("div",Zg,[t.createTextVNode(t.toDisplayString(o.$t("marker.color")),1),e[34]||(e[34]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createElementVNode("div",Xg,[t.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[18]||(e[18]=k=>i.form.color=k.target.value)},null,40,Hg),t.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[19]||(e[19]=k=>i.form.color=k),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),t.createElementVNode("div",Og,[t.createElementVNode("div",Yg,[t.createTextVNode(t.toDisplayString(o.$t("marker.name")),1),e[35]||(e[35]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[20]||(e[20]=k=>i.form.name=k),density:"compact",variant:"outlined",rules:i.formRules.name,autocomplete:"off",class:"input-btn-bg-1"},null,8,["modelValue","rules"])])]}),_:1}),t.createVNode(s),t.createVNode(p,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>{var b;return[(b=a.editLayer)!=null&&b.id?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(n,{key:0,class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.clear")),1)]),_:1},8,["onClick"])),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.save")),1)]),_:1},8,["loading"])]}),_:1})]),_:1},8,["onSubmit"])):t.createCommentVNode("",!0)]}),_:1})}const Jg=Q(xg,[["render",Ug]]),cb="",Kg={name:"IdmImportMarker",props:{map:{type:Object},gateway:{type:String},token:{type:String},defaultMeteoToken:{type:String},group:{type:Object,default:null}},emits:["close","import"],setup(){return{Theme:ye.useTheme()}},data(){var o;return{form:{groupName:"",name:"",file:null,format:"",extend:void 0,color:(o=this.Theme.current.value.colors)==null?void 0:o["map-green"]},formRules:{groupName:[e=>e!=null&&e!==""||"required"],color:[e=>e!=null&&e!==""||"required"]},isDragOver:!1,uploading:!1,fileError:"",previewSourceId:"__import_preview__",previewMarkers:[]}},watch:{"form.color":{handler(o){var e;(e=this.form.extend)!=null&&e.features&&this.form.extend.features.forEach(a=>{a.properties.color=o}),this.handleDrawLayers()},immediate:!0}},mounted(){var o;this.form.groupName=((o=this.group)==null?void 0:o.name)||"Import layer 1"},beforeUnmount(){this.handleClearPreview()},methods:{handleClose(){this.$emit("close")},handleReset(){var o;this.form={groupName:((o=this.group)==null?void 0:o.name)||"Import layer 1",file:null,format:"",extend:void 0},this.fileError=""},handleSelectFile(){this.$refs.fileInput.click()},handleFileChange(o){const e=o.target.files[0];e&&this.onUpload(e)},handleDrop(o){this.isDragOver=!1;const e=o.dataTransfer.files[0];e&&this.onUpload(e)},async onUpload(o){var r,i,l,n;if(o.size>10485760){this.fileError=this.$t("marker.fileTooLarge");return}this.form.file=o,this.fileError="",this.form.name=(r=o.name.split("."))==null?void 0:r[0];const a=(i=o.name.split(".").pop())==null?void 0:i.toLowerCase();try{let c;if(a==="json"||a==="geojson"){const s=await o.text();c=JSON.parse(s)}else if(a==="kml"){const s=await o.text();c=await M.GeoJsonHelper.convertKML2GeoJSON(s)}else if(a==="kmz"){const s=await o.arrayBuffer();c=await M.GeoJsonHelper.convertKMZ2GeoJSON(s)}else if(a==="zip"||a==="shp"){const s=await o.arrayBuffer();c=await M.GeoJsonHelper.convertZIP2GeoJSON(s)}else{this.fileError="Unsupported format: "+a;return}this.form.extend=c,this.form.format="geojson",(n=(l=this.form.extend)==null?void 0:l.features)==null||n.forEach(s=>{s.properties.color=this.form.color}),this.handleDrawLayers()}catch{this.fileError="Failed to parse file",this.form.file=null}},handleRemoveFile(){this.form.file=null,this.$refs.fileInput.value="",this.handleClearPreview()},async handleConfirm(){const{valid:o}=await this.$refs.importForm.validate();if(!o)return;if(!this.form.file){this.fileError=this.$t("marker.fileRequired");return}this.uploading=!0;let e=this.group.id;if(e||await ce.post(`${this.gateway}/api/arc/lygroups`,{name:this.form.groupName},{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(r=>{var i,l;((i=r.data)==null?void 0:i.code)===0&&(e=(l=r.data.data)==null?void 0:l.id)}),!e){this.uploading=!1;return}const a={format:this.form.format,extend:this.form.extend};ce.post(`${this.gateway}/api/arc/lygroups/${e}/layers`,a,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(r=>{var i;((i=r.data)==null?void 0:i.code)===0&&(this.$emit("import"),this.uploading=!1)}).catch(r=>{this.uploading=!1})},handleDrawLayers(){if(!this.map||!this.form.extend)return;const o=this.form.extend,e=this.previewSourceId,a=o.features||(o.type==="Feature"?[o]:[]);a.forEach(i=>{var n,c,s;const l=((n=i==null?void 0:i.properties)==null?void 0:n.color)||((c=this.Theme.current.value.colors)==null?void 0:c["map-green"]);if(((s=i.geometry)==null?void 0:s.type)==="Point"){const[m,d]=i.geometry.coordinates;this.previewMarkers.push(new me.Marker({color:l}).setLngLat([m,d]).addTo(this.map))}i.properties.color||(i.properties.color=l)}),this.map.getSource(e)?this.map.getSource(e).setData(o):this.map.addSource(e,{type:"geojson",data:o});const r=new Set(a.map(i=>{var l;return(l=i.geometry)==null?void 0:l.type}));(r.has("LineString")||r.has("MultiLineString"))&&!this.map.getLayer(`${e}-line`)&&this.map.addLayer({id:`${e}-line`,type:"line",source:e,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["get","color"],"line-width":2}}),(r.has("Polygon")||r.has("MultiPolygon"))&&(this.map.getLayer(`${e}-fill`)||this.map.addLayer({id:`${e}-fill`,type:"fill",source:e,filter:["==","$type","Polygon"],paint:{"fill-color":["get","color"],"fill-opacity":.35}}),this.map.getLayer(`${e}-outline`)||this.map.addLayer({id:`${e}-outline`,type:"line",source:e,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["get","color"],"line-width":2}}))},handleClearPreview(){if(!this.map)return;this.previewMarkers.forEach(a=>a.remove()),this.previewMarkers=[];const o=this.previewSourceId;[`${o}-vertex`,`${o}-point`,`${o}-line`,`${o}-fill`,`${o}-outline`].forEach(a=>{this.map.getLayer(a)&&this.map.removeLayer(a)}),this.map.getSource(o)&&this.map.removeSource(o)}}},Qg={class:"text-h6 font-weight-600"},qg={class:"mb-4"},$g={class:"text-label mb-1"},eu={class:"mb-1"},tu={class:"text-label mb-1"},ou={class:"color-picker-row d-flex align-start ga-2"},au=["value"],iu={class:"text-body-2 text-center text-label"},ru={class:"text-body-1 text-primary mt-2 cursor-pointer"},lu={class:"text-body-2 text-left text-label mt-1"},nu={key:0,class:"text-body-2 text-left text-danger mt-1"},su={key:1,class:"file-item d-flex align-center justify-space-between mt-2 gray-bg-1 pa-1"},cu={class:"text-body-2 text-truncate"};function mu(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VTextField"),d=t.resolveComponent("VIcon"),g=t.resolveComponent("VCardText"),u=t.resolveComponent("VCardActions"),y=t.resolveComponent("VForm"),p=t.resolveComponent("VCard");return t.openBlock(),t.createBlock(p,{class:"idm-gl4-import-dialog-card",elevation:"4"},{default:t.withCtx(()=>[t.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>[t.createElementVNode("span",Qg,t.toDisplayString(o.$t("marker.importLayer")),1),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:t.withCtx(()=>e[9]||(e[9]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[9]},8,["onClick"])]),_:1}),t.createVNode(s),t.createVNode(y,{ref:"importForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.handleConfirm,["prevent"])},{default:t.withCtx(()=>[t.createVNode(g,{class:"px-4 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",qg,[t.createElementVNode("div",$g,[t.createTextVNode(t.toDisplayString(o.$t("marker.group")),1),e[10]||(e[10]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.form.groupName,"onUpdate:modelValue":e[0]||(e[0]=h=>i.form.groupName=h),density:"compact",variant:"outlined","hide-details":"",class:"input-btn-bg-1"},null,8,["modelValue"])]),t.createElementVNode("div",eu,[t.createElementVNode("div",tu,[t.createTextVNode(t.toDisplayString(o.$t("marker.color")),1),e[11]||(e[11]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createElementVNode("div",ou,[t.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[1]||(e[1]=h=>i.form.color=h.target.value)},null,40,au),t.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[2]||(e[2]=h=>i.form.color=h),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),t.createElementVNode("div",{class:t.normalizeClass(["upload-area btn-bg-1 d-flex flex-column justify-center align-center pa-4",{"drag-over":i.isDragOver,"upload-error":i.fileError}]),onDragenter:e[4]||(e[4]=t.withModifiers(h=>i.isDragOver=!0,["prevent"])),onDragleave:e[5]||(e[5]=t.withModifiers(h=>i.isDragOver=!1,["prevent"])),onDragover:e[6]||(e[6]=t.withModifiers(()=>{},["prevent"])),onDrop:e[7]||(e[7]=t.withModifiers((...h)=>l.handleDrop&&l.handleDrop(...h),["prevent"])),onClick:e[8]||(e[8]=(...h)=>l.handleSelectFile&&l.handleSelectFile(...h))},[t.createVNode(d,{size:"36",color:"grey",class:"mb-2"},{default:t.withCtx(()=>e[12]||(e[12]=[t.createTextVNode("mdi-cloud-upload-outline",-1)])),_:1,__:[12]}),t.createElementVNode("div",iu,t.toDisplayString(o.$t("marker.uploadHint")),1),t.createElementVNode("div",ru,t.toDisplayString(o.$t("marker.selectFile")),1),t.createElementVNode("input",{ref:"fileInput",type:"file",style:{display:"none"},accept:".json,.geojson,.zip,.shp,.kml,.kmz",onChange:e[3]||(e[3]=(...h)=>l.handleFileChange&&l.handleFileChange(...h))},null,544)],34),t.createElementVNode("div",lu,t.toDisplayString(o.$t("marker.uploadLimit")),1),i.fileError?(t.openBlock(),t.createElementBlock("div",nu,t.toDisplayString(i.fileError),1)):t.createCommentVNode("",!0),i.form.file?(t.openBlock(),t.createElementBlock("div",su,[t.createElementVNode("span",cu,[t.createVNode(d,{size:"16",color:"success",class:"mr-1"},{default:t.withCtx(()=>e[13]||(e[13]=[t.createTextVNode("mdi-check-circle",-1)])),_:1,__:[13]}),t.createTextVNode(" "+t.toDisplayString(i.form.file.name),1)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",size:"small",class:"file-remove-btn",onClick:l.handleRemoveFile},{default:t.withCtx(()=>[t.createVNode(d,{size:"16"},{default:t.withCtx(()=>e[14]||(e[14]=[t.createTextVNode("mdi-close",-1)])),_:1,__:[14]})]),_:1},8,["onClick"])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(s),t.createVNode(u,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleReset},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.reset")),1)]),_:1},8,["onClick"]),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.uploading},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.confirm")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])]),_:1})}const du=Q(Kg,[["render",mu]]),mb="",hu={name:"IdmGroupDialog",props:{modelValue:{type:Boolean,default:!1},group:{type:Object,default:null},gateway:{type:String},token:{type:String},defaultMeteoToken:{type:String}},emits:["update:modelValue","saved"],data(){return{localName:"",saving:!1}},watch:{group:{handler(o){this.localName=(o==null?void 0:o.name)||""},immediate:!0}},methods:{handleClose(){this.$emit("update:modelValue",!1)},async handleConfirm(){var o;!this.group||!((o=this.localName)!=null&&o.trim())||(this.saving=!0,await ce.put(`${this.gateway}/api/arc/lygroups/${this.group.id}`,{name:this.localName},{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(e=>{var a;((a=e.data)==null?void 0:a.code)===0&&this.$emit("saved")}).finally(()=>{this.saving=!1}))}}},pu={class:"text-h6 font-weight-600"},gu={class:"text-label mb-2"};function uu(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VTextField"),d=t.resolveComponent("VCardText"),g=t.resolveComponent("VCardActions"),u=t.resolveComponent("VCard"),y=t.resolveComponent("VDialog");return t.openBlock(),t.createBlock(y,{"model-value":a.modelValue,"max-width":"320",persistent:"","onUpdate:modelValue":e[1]||(e[1]=p=>o.$emit("update:modelValue",p))},{default:t.withCtx(()=>[t.createVNode(u,{class:"",elevation:"4"},{default:t.withCtx(()=>[t.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>[t.createElementVNode("span",pu,t.toDisplayString(o.$t("actions.editGroup")),1),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:t.withCtx(()=>e[2]||(e[2]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[2]},8,["onClick"])]),_:1}),t.createVNode(s),t.createVNode(d,{class:"px-4 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",gu,[t.createTextVNode(t.toDisplayString(o.$t("marker.groupName")),1),e[3]||(e[3]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.localName,"onUpdate:modelValue":e[0]||(e[0]=p=>i.localName=p),density:"compact",variant:"outlined","hide-details":"",autocomplete:"off",height:"32px","min-height":"32px",class:"input-btn-bg-1"},null,8,["modelValue"])]),_:1}),t.createVNode(s),t.createVNode(g,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClose},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.cancel")),1)]),_:1},8,["onClick"]),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",loading:i.saving,onClick:l.handleConfirm},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.confirm")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["model-value"])}const fu=Q(hu,[["render",uu]]),yu={name:"DeleteDialog",props:{title:{type:String},tips:{type:String},loading:{type:Boolean,default:!1}},emits:["close","delete"],data(){return{showDialog:!1}},methods:{handleClose(){this.showDialog=!1},handleDelete(){this.$emit("delete")},open(){this.showDialog=!0}}},bu={class:"text-body-1 pb-1"},wu={class:"text-body-1"};function xu(o,e,a,r,i,l){const n=t.resolveComponent("VIcon"),c=t.resolveComponent("VBtn"),s=t.resolveComponent("VCardTitle"),m=t.resolveComponent("VCardText"),d=t.resolveComponent("VCardActions"),g=t.resolveComponent("VCard"),u=t.resolveComponent("VDialog");return t.openBlock(),t.createBlock(u,{modelValue:i.showDialog,"onUpdate:modelValue":e[0]||(e[0]=y=>i.showDialog=y),width:"500","min-width":"500","max-width":"500"},{default:t.withCtx(()=>[t.createVNode(g,{class:""},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6 font-weight-600 d-flex justify-center align-center py-4"},{default:t.withCtx(()=>[t.createVNode(n,{color:"warning",icon:"mdi-alert-circle",size:"small",class:"mr-2"}),t.createElementVNode("div",null,t.toDisplayString(a.title),1),t.createVNode(c,{icon:"",density:"compact",variant:"plain",class:"position-absolute top-0 right-0 mt-2 mr-2",onClick:l.handleClose},{default:t.withCtx(()=>e[1]||(e[1]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[1]},8,["onClick"])]),_:1}),t.createVNode(m,{class:"py-4 text-center"},{default:t.withCtx(()=>[t.createElementVNode("p",bu,t.toDisplayString(a.tips),1),t.createElementVNode("p",wu,t.toDisplayString(o.$t("tips.doYouWantToContinue")),1)]),_:1}),t.createVNode(d,{class:"w-100 d-flex justify-center align-center ga-8 py-6"},{default:t.withCtx(()=>[t.createVNode(c,{variant:"tonal",class:"text-none text-body-1",height:"32",onClick:l.handleClose},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.cancel")),1)]),_:1},8,["onClick"]),t.createVNode(c,{loading:a.loading,variant:"flat",color:"danger",class:"text-none text-body-1",height:"32",onClick:l.handleDelete},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.delete")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["modelValue"])}const ku=Q(yu,[["render",xu]]),db="",hb="",Au={name:"IdmMarker",components:{IdmDrawMarker:Jg,IdmImportMarker:du,IdmGroupDialog:fu,DeleteDialog:ku},props:{simple:{type:Boolean,default:!1},map:{type:Object},theme:{type:String},token:{type:String},isLogin:{type:Boolean,default:!1},defaultMeteoToken:{type:String},gateway:{type:String},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}}},emits:["map","menuToggle","theme","login"],setup(){return{Theme:ye.useTheme()}},data(){return{right:10,toggle:!1,autoActive:localStorage.getItem("autoActiveMarkersGL4")==="true"||void 0,keyword:"",drawDialog:!1,importDialog:!1,loading:!1,deleteDialog:!1,deleteLoading:!1,layerGroup:[],layers:[],groupIndex:0,currentLayer:void 0,drawnLayerIds:[],layerMarkers:{},groupDialog:!1,currentGroup:null,currentGroupId:"",currentGroupName:""}},computed:{listStyle(){return this.simple?{top:this.top+"px",left:this.toggle?"0px":"-280px"}:{top:this.top+"px",right:this.toggle?"0px":"-280px"}}},watch:{"menuToggle.v":{handler(){this.toggle=this.menuToggle.markerLayers,this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},toggle:{async handler(){this.toggle&&(localStorage.getItem("autoActiveMarkersGL4")||(this.autoActive=!0))}},autoActive:{async handler(){(this.autoActive===!0||this.autoActive===!1)&&localStorage.setItem("autoActiveMarkersGL4",this.autoActive),this.layerGroup.length===0&&await this.fetchAllLayers(),this.autoActive?this.handleDrawAllLayers():this.handleClearAllLayers()},immediate:!0},map:{handler(){this.map&&(this.handleDrawAllLayers(),this.map.on("zoom",this.handleZoomChange))}}},methods:{handleMenuToggle(){this.isLogin?(this.toggle=!this.toggle,this.$emit("menuToggle","markerLayers")):this.$emit("login")},handleEditGroup(o){this.drawDialog=!1,this.importDialog=!1,this.currentGroup=o,this.groupDialog=!0},handleSaveGroup(){this.fetchAllLayers(),this.groupDialog=!1,this.currentGroup=void 0},handleOpenDelete(o,e){o==="group"?(this.currentGroup=e,this.currentLayer=void 0):o==="layer"&&(this.currentGroup=void 0,this.currentLayer=e),this.$refs.deleteDialog.open()},confirmDelete(){var o;this.currentGroup?this.handleDeleteGroup((o=this.currentGroup)==null?void 0:o.id):this.currentLayer&&this.handleDeleteLayer(this.currentLayer)},async handleDeleteGroup(o){o&&(this.deleteLoading=!0,await ce.delete(`${this.gateway}/api/arc/lygroups/${o}`,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(e=>{var a;((a=e.data)==null?void 0:a.code)===0&&(this.fetchAllLayers(),this.currentGroup=void 0,this.$refs.deleteDialog.handleClose(),this.deleteLoading=!1)}).catch(()=>{this.deleteLoading=!1}))},handleOpenDrawMarkers(o){this.handleCloseDraw(),this.currentGroup=o||this.layerGroup.find(e=>e.name==="Custom Layers"),this.importDialog=!1,this.drawDialog=!0},handleOpenImportDialog(o){this.drawDialog=!1,this.handleCloseDraw(),this.currentGroup=o||void 0,this.importDialog=!0},handleImportLayer(o){this.fetchAllLayers(),this.importDialog=!1},handleSaveMarker(o){this.fetchAllLayers(),this.drawDialog=!1,this.currentLayer=null},handleCloseDraw(){this.drawDialog=!1,this.currentLayer=null,this.autoActive&&this.handleDrawAllLayers(),this.currentGroup=void 0},handleEditLayer(o,e){var a;this.importDialog=!1,this.drawDialog&&((a=this.currentLayer)!=null&&a.id)&&this.currentLayer.id!==e.id&&this.autoActive&&this.handleDrawAllLayers(),this.currentGroup=o,this.currentLayer=e,this.drawDialog=!0},async fetchAllLayers(){this.loading=!0,this.layerGroup=[],await ce.get(`${this.gateway}/api/arc/lygroups/my`,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(o=>{var e,a,r,i,l,n;if(((e=o.data)==null?void 0:e.code)===0){this.loading=!1,this.layerGroup=((i=(r=(a=o.data)==null?void 0:a.data)==null?void 0:r.rows)==null?void 0:i.reverse())||[];const c=[];(l=this.layerGroup)==null||l.forEach(s=>{var m;s.show=!0,(m=s.layers)==null||m.forEach(d=>{var u;d.layerGroupId=s.id;const g=typeof d.extend=="string"?JSON.parse(d.extend):d.extend;(u=g==null?void 0:g.features)==null||u.forEach(y=>{y.properties.lgId=s.id,y.properties.layerId=d.id,y.properties.name||(y.properties.name=d.name)}),c.push(d)})}),this.layers=c,this.handleDrawAllLayers(),(n=this.$refs.drawDialog)==null||n.handleClearDraw()}}).catch(()=>{this.loading=!1})},async handleDeleteLayer(o){this.deleteLoading=!0,await ce.delete(`${this.gateway}/api/arc/layers/${o.id}`,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(e=>{var a;((a=e.data)==null?void 0:a.code)===0&&(this.deleteLoading=!1,this.fetchAllLayers(),this.$refs.deleteDialog.handleClose())}).catch(()=>{this.deleteLoading=!1})},handleRenderLayer(o){if(!this.map||!(o!=null&&o.extend))return;const e=typeof o.extend=="string"?JSON.parse(o.extend):o.extend;if(!e)return;const a=`marker-layer-${o.id}`;this.handleClearLayerMarkers(o.id);const r=e.features||(e.type==="Feature"?[e]:[]);if(r.some(c=>{var s,m;return(((s=c.geometry)==null?void 0:s.type)==="Point"||((m=c.geometry)==null?void 0:m.type)==="MultiPoint")&&c.properties.shape==="point"})){const c=[];r.forEach(s=>{var u,y,p,h;const m=(u=s.geometry)==null?void 0:u.type,d=((y=s.properties)==null?void 0:y.name)||"",g=((p=s.properties)==null?void 0:p.color)||o.color||((h=this.Theme.current.value.colors)==null?void 0:h["map-green"]);if(m==="Point"){const[f,w]=s.geometry.coordinates,b=`<div style="font-size:12px;line-height:1.5;">
|
|
219
|
+
<div class="marker-label"> ${this.$t("measure.clickTips")}</div>`;if(this.tipMarker)this.tipMarker._element.innerHTML=m,this.tipMarker.setLngLat([e[0],e[1]]);else{const d=document.createElement("div");d.className="idm-gl4-draw-tip-marker",d.innerHTML=m,this.tipMarker=new me.Marker(d).setOffset([140,0]).setLngLat([e[0],e[1]]).addTo(this.map)}},handleRefreshLine(){this.drawCoords.length>=1&&this.handleRenderLine(this.drawCoords)},handleMapClickPolygon(o){var r;const{lng:e,lat:a}=o.lngLat;this.drawCoords.push([e,a]),this.drawCoords.length>=3&&this.handleRenderPolygonFill(this.drawCoords),this.handleRenderAllVertexLabels(this.drawCoords),(r=this.editLayer)!=null&&r.id&&this.setupPolygonEdit()},handleMapMovePolygon(o){if(!this.drawCoords.length)return;const{lng:e,lat:a}=o.lngLat,r=[...this.drawCoords,[e,a]];r.length>=1&&this.handleRenderPolygonFill(r),this.handleRenderAllVertexLabels(r)},handleMapDblClickPolygon(o){o.preventDefault(),this.drawCoords.length>=1&&this.drawCoords.pop(),this.drawCoords.length>=1&&this.handleRenderPolygonFill(this.drawCoords),this.handleRenderAllVertexLabels(this.drawCoords),this.map.off("click",this.handleMapClickPolygon),this.map.off("mousemove",this.handleMapMovePolygon),this.map.off("dblclick",this.handleMapDblClickPolygon)},handleRenderPolygonFill(o){var i;let e=[];if(o==null||o.forEach((l,n)=>{e.push(T.point(l))}),(o==null?void 0:o.length)>2){const l=[...o,o[0]];e.push(M.GeoJsonHelper.drawPolygon(l,{...this.originalProperties}))}const a=T.featureCollection(e);this.handleSetDrawSource(a);const r=(i=this.editLayer)!=null&&i.id?3:2;this.map.getLayer(this.drawFillLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-width",r),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":r}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},handleRenderVertexLabel(o,e=8){this.handleClearVertexLabels();const a=M.LngLatHelper.lat2pretty(o[1],4).pretty,r=M.LngLatHelper.lng2pretty(o[0],4).pretty,i=document.createElement("div");i.className="idm-gl4-draw-corner-label center",i.innerHTML=`<span class="corner-text">${a} <br/> ${r}</span>`;const l=new me.Marker(i,{anchor:"bottom",offset:[0,e]}).setLngLat(o).addTo(this.map);this.polygonVertexMarkers.push(l)},handleRenderAllVertexLabels(o){this.handleClearVertexLabels();const e=o.reduce((a,r)=>[a[0]+r[0],a[1]+r[1]],[0,0]);e[0]/=o.length,e[1]/=o.length,o.forEach(a=>{const r=a[0]-e[0],i=a[1]-e[1];let l="center";i>=0&&r>=0?l="bottom-left":i>=0&&r<0?l="bottom-right":i<0&&r>=0?l="top-left":l="top-right";const n=M.LngLatHelper.lat2pretty(a[1],4).pretty,c=M.LngLatHelper.lng2pretty(a[0],4).pretty,s=document.createElement("div");s.className="idm-gl4-draw-corner-label "+l,s.innerHTML=`<span class="corner-text">${n} <br/> ${c}</span>`;const m=new me.Marker(s,{anchor:l}).setLngLat(a).addTo(this.map);this.polygonVertexMarkers.push(m)})},handleUpdateVertexLabel(o){if(!this.polygonVertexMarkers.length)return;const e=this.polygonVertexMarkers[0];e.setLngLat(o);const a=M.LngLatHelper.lat2pretty(o[1],4).pretty,r=M.LngLatHelper.lng2pretty(o[0],4).pretty,i=e.getElement().querySelector(".corner-text");i&&(i.innerHTML=`${a} <br/> ${r}`)},handleClearVertexLabels(){this.polygonVertexMarkers.forEach(o=>o.remove()),this.polygonVertexMarkers=[]},handleMapClickCircle(o){const{lng:e,lat:a}=o.lngLat;if(this.drawCoords.length===0){this.drawCoords.push([e,a]);const r=T.featureCollection([T.point([e,a])]);this.handleSetDrawSource(r),this.map.getLayer(this.drawPointLayer)||this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}),this.handleRenderCircleCenterLabel([e,a])}else{const r=this.drawCoords[0],i=[e,a],l=T.distance(T.point(r),T.point(i),{units:"nauticalmiles"}),n=M.GeoJsonHelper.drawCircle(r[0],r[1],l),c=T.featureCollection([T.point(r),n]);this.handleSetDrawSource(c),this.handleRenderAreaLayers(),this.handleRenderRadiusLine(r,i,l),this.drawCoords=[r,i],this.map.off("click",this.handleMapClickCircle),this.map.off("mousemove",this.handleMapMoveCircle)}},handleMapMoveCircle(o){if(this.drawCoords.length!==1)return;const e=this.drawCoords[0],a=[o.lngLat.lng,o.lngLat.lat],r=T.distance(T.point(e),T.point(a),{units:"nauticalmiles"}),i=M.GeoJsonHelper.drawCircle(e[0],e[1],r),l=T.featureCollection([T.point(e),i]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderAreaLayers(),this.handleRenderRadiusLine(e,a,r)},handleRenderCircleCenterLabel(o){const e=M.LngLatHelper.lat2pretty(o[1],4).pretty,a=M.LngLatHelper.lng2pretty(o[0],4).pretty,r=document.createElement("div");r.className="idm-gl4-draw-corner-label bottom-right",r.innerHTML=`<span class="corner-text">${e} <br/> ${a}</span>`;const i=new me.Marker(r,{anchor:"bottom-right"}).setLngLat(o).addTo(this.map);this.circleMarkers.push(i)},handleRenderRadiusLine(o,e,a){const r=M.LngLatHelper.roundPrecision(a,2),i=T.featureCollection([T.lineString([o,e])]);this.map.getSource(this.drawRadiusSource)?this.map.getSource(this.drawRadiusSource).setData(i):this.map.addSource(this.drawRadiusSource,{type:"geojson",data:i}),this.map.getLayer(this.drawRadiusLayer)||this.map.addLayer({id:this.drawRadiusLayer,type:"line",source:this.drawRadiusSource,layout:{"line-cap":"round"},paint:{"line-color":this.form.color,"line-width":1.5,"line-dasharray":[4,3]}});const l=[(o[0]+e[0])/2,(o[1]+e[1])/2],n=this.map.project(o),c=this.map.project(e),s=c.x-n.x,m=c.y-n.y;let d=Math.atan2(m,s)*180/Math.PI;d>90&&(d-=180),d<-90&&(d+=180);const g=16,u=(d-90)*Math.PI/180,y=Math.round(Math.cos(u)*g),p=Math.round(Math.sin(u)*g);this.circleMarkers.length>1&&(this.circleMarkers[1].remove(),this.circleMarkers.splice(1,1));const h=document.createElement("div"),f=document.createElement("span");f.className="idm-gl4-draw-radius-label",f.style.transform=`rotate(${d}deg)`,f.style.transformOrigin="center",f.style.display="inline-block",f.textContent=`${r} nm`,h.appendChild(f);const w=new me.Marker(h,{anchor:"center",offset:[y,p]}).setLngLat(l).addTo(this.map);this.circleMarkers.push(w)},handleClearCircleLabels(){var o,e;this.circleMarkers.forEach(a=>a.remove()),this.circleMarkers=[],(o=this.map)!=null&&o.getLayer(this.drawRadiusLayer)&&this.map.removeLayer(this.drawRadiusLayer),(e=this.map)!=null&&e.getSource(this.drawRadiusSource)&&this.map.removeSource(this.drawRadiusSource)},buildRectFeatureCollection(o,e){const a=Math.min(o[0],e[0]),r=Math.max(o[0],e[0]),i=Math.min(o[1],e[1]),l=Math.max(o[1],e[1]);return[[a,l],[r,l],[r,i],[a,i]]},handleMapClickRect(o){const{lng:e,lat:a}=o.lngLat;if(this.drawCoords.length===0)this.drawCoords.push([e,a]);else{const r=this.drawCoords[0],i=[e,a],l=M.GeoJsonHelper.drawRect(r,i);delete l.bbox;const n=this.buildRectFeatureCollection(r,i),c=T.featureCollection([l,...n.map(s=>T.point(s))]);this.handleSetDrawSource(c),this.handleRenderRectLayers(),this.handleRenderRectCorners(r,i),this.drawCoords=[r,i],this.map.off("click",this.handleMapClickRect),this.map.off("mousemove",this.handleMapMoveRect)}},handleMapMoveRect(o){if(this.drawCoords.length!==1)return;const e=this.drawCoords[0],a=[o.lngLat.lng,o.lngLat.lat],r=M.GeoJsonHelper.drawRect(e,a),i=this.buildRectFeatureCollection(e,a),l=T.featureCollection([r,...i.map(n=>T.point(n))]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderRectLayers(),this.handleRenderRectCorners(e,a)},handleRenderRectLayers(){var e;const o=(e=this.editLayer)!=null&&e.id?3:2;this.map.getLayer(this.drawFillLayer)||this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.getLayer(this.drawLineLayer)?this.map.setPaintProperty(this.drawLineLayer,"line-width",o):this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":o}}),this.map.getLayer(this.drawPointLayer)||this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}})},handleRenderRectCorners(o,e){const a=Math.min(o[0],e[0]),r=Math.max(o[0],e[0]),i=Math.min(o[1],e[1]),l=Math.max(o[1],e[1]),n=[{coord:[a,l],anchor:"bottom-right"},{coord:[r,l],anchor:"bottom-left"},{coord:[r,i],anchor:"top-left"},{coord:[a,i],anchor:"top-right"}];this.handleClearRectCorners(),n.forEach(({coord:c,anchor:s})=>{const m=M.LngLatHelper.lat2pretty(c[1],4).pretty,d=M.LngLatHelper.lng2pretty(c[0],4).pretty,g=document.createElement("div");g.className="idm-gl4-draw-corner-label "+s,g.innerHTML=`<span class="corner-text">${m} <br/> ${d}</span>`;const u=new me.Marker(g,{anchor:s}).setLngLat(c).addTo(this.map);this.rectCornerMarkers.push(u)})},handleClearRectCorners(){this.rectCornerMarkers.forEach(o=>o.remove()),this.rectCornerMarkers=[]},handleRenderAreaLayers(){var e;const o=(e=this.editLayer)!=null&&e.id?3:2;this.map.getLayer(this.drawFillLayer)||this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.getLayer(this.drawLineLayer)?this.map.setPaintProperty(this.drawLineLayer,"line-width",o):this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":o}})},handleSetDrawSource(o){this.map.getSource(this.drawSource)?this.map.getSource(this.drawSource).setData(o):this.map.addSource(this.drawSource,{type:"geojson",data:o})},handleClearTmp(){var o,e,a;(o=this.map)!=null&&o.getLayer(this.drawTmpLayer)&&this.map.removeLayer(this.drawTmpLayer),(e=this.map)!=null&&e.getSource(this.drawTmpSource)&&this.map.removeSource(this.drawTmpSource),(a=this.tipMarker)==null||a.remove(),this.tipMarker=null},handleUpdateLayerColors(){if(!this.map)return;const o=this.form.color;this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",o),this.map.getLayer(this.drawLineLayer)&&this.map.setPaintProperty(this.drawLineLayer,"line-color",o),this.map.getLayer(this.drawFillLayer)&&this.map.setPaintProperty(this.drawFillLayer,"fill-color",o),this.map.getLayer(this.drawRadiusLayer)&&this.map.setPaintProperty(this.drawRadiusLayer,"line-color",o),this.map.getLayer(this.drawTmpLayer)&&this.map.setPaintProperty(this.drawTmpLayer,"line-color",o),this.editMarkers.forEach(e=>{e.getElement()&&(e.getElement().style.backgroundColor=o)})},handleClearDraw(o=!1){var a,r,i,l,n;this.handleClearTmp(),this.hideDeleteButton();const e=[this.drawPointLayer,this.drawLineLayer,this.drawFillLayer];for(const c of e)(a=this.map)!=null&&a.getLayer(c)&&((r=this.map)==null||r.removeLayer(c));(i=this.map)!=null&&i.getSource(this.drawSource)&&this.map.removeSource(this.drawSource),this.drawCoords=[],this.originalProperties={},this.handleClearRectCorners(),this.handleClearVertexLabels(),this.handleClearCircleLabels(),(l=this.pointMarker)==null||l.remove(),this.pointMarker=null,(n=this.pointHighlightMarker)==null||n.remove(),this.pointHighlightMarker=null,this.clearEditMarkers(),this.handleRebindMap()},async handleSave(){var r,i;let o=null;if(this.markerType==="Point"?await this.$refs.pointForm.validate().then(l=>{var n;if(l!=null&&l.valid){if(!this.drawCoords.length)return;const[c,s]=this.drawCoords[0];o=T.featureCollection([M.GeoJsonHelper.drawPoint(s,c,{...this.originalProperties,color:this.form.color,name:this.form.name})]),(n=o.features)==null||n.forEach(m=>{m.properties.color=this.form.color,m.properties.name=this.form.name})}}):this.markerType==="Line"?await this.$refs.lineForm.validate().then(l=>{if(l!=null&&l.valid){if(this.drawCoords.length<2)return;const n=[],c=M.LaneHelper.generateRouteAccordingToWaypoints(this.drawCoords.map(s=>({lng:s==null?void 0:s[0],lat:s==null?void 0:s[1]})));for(const s of c)s.length>1&&n.push(M.GeoJsonHelper.drawLine(s,{properties:{...this.originalProperties,color:this.form.color,name:this.form.name}}));o=T.featureCollection(n)}}):this.markerType==="Area"&&await this.$refs.areaForm.validate().then(l=>{var n,c,s;if(l!=null&&l.valid){const m=(n=this.map)==null?void 0:n.getSource(this.drawSource);if(!m)return;const d=m._data;if(!((c=d==null?void 0:d.features)!=null&&c.length))return;let g=((s=d.features)==null?void 0:s.filter(u=>u.geometry.type==="Polygon"))||[];if(g=g==null?void 0:g.map(u=>(u.properties.name=this.form.name,u.properties.color=this.form.color,u)),!g.length)return;o=T.featureCollection(g)}}),!o)return!1;const e={name:this.form.name,format:"geojson",color:this.form.color,extend:o};this.saving=!0,await((r=this.editLayer)!=null&&r.id?ce.put(`${this.gateway}/api/arc/layers/${this.editLayer.id}`,e,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}):ce.post(`${this.gateway}/api/arc/lygroups/${(i=this.group)==null?void 0:i.id}/layers`,e,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}})).then(l=>{var n,c,s,m;((n=l.data)==null?void 0:n.code)===0&&this.$emit("save",{...e,id:((c=this.editLayer)==null?void 0:c.id)||((m=(s=l.data)==null?void 0:s.data)==null?void 0:m.id)}),this.saving=!1}).catch(l=>{console.error("save marker error",l),this.saving=!1})}}},kg={class:"text-h6 font-weight-600"},Ag={class:"text-label mb-1"},Lg={class:"text-label mb-1"},Cg={class:"mb-1"},vg={class:"text-label mb-1"},zg={class:"mb-1"},_g={class:"text-label mb-1"},Sg={class:"mb-1"},Ng={class:"text-label mb-1"},Mg={class:"color-picker-row d-flex align-start ga-2"},Pg=["value"],Vg={class:"mb-n2"},Tg={class:"text-label mb-1"},Eg={class:"mb-1"},Dg={class:"text-label mb-1"},Rg={class:"color-picker-row d-flex align-start ga-2"},Bg=["value"],Ig={class:"mb-n2"},Fg={class:"text-label mb-1"},Gg={key:0,class:"mb-3"},jg={class:"text-label mb-1"},Wg={class:"mb-1"},Zg={class:"text-label mb-1"},Xg={class:"color-picker-row d-flex align-start ga-2"},Hg=["value"],Og={class:"mb-n2"},Yg={class:"text-label mb-1"};function Ug(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VTextField"),d=t.resolveComponent("VCardText"),g=t.resolveComponent("VBtnToggle"),u=t.resolveComponent("VCol"),y=t.resolveComponent("VRow"),p=t.resolveComponent("VCardActions"),h=t.resolveComponent("VForm"),f=t.resolveComponent("VCard");return t.openBlock(),t.createBlock(f,{class:"idm-gl4-draw-dialog-card",elevation:"4"},{default:t.withCtx(()=>{var w;return[t.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>{var b;return[t.createElementVNode("span",kg,t.toDisplayString((b=a.editLayer)!=null&&b.id?o.$t("actions.edit"):o.$t("actions.addMarker")),1),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:t.withCtx(()=>e[21]||(e[21]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[21]},8,["onClick"])]}),_:1}),t.createVNode(s),t.createVNode(d,{class:"text-body-1 px-4 pb-0"},{default:t.withCtx(()=>{var b;return[t.createElementVNode("div",Ag,t.toDisplayString(o.$t("marker.group")),1),t.createVNode(m,{"model-value":(b=a.group)==null?void 0:b.name,density:"compact",variant:"outlined","hide-details":"",disabled:"",class:"input-btn-bg-1"},null,8,["model-value"])]}),_:1}),(w=a.editLayer)!=null&&w.id?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(d,{key:0,class:"text-body-1 px-4 pb-0"},{default:t.withCtx(()=>{var b;return[t.createElementVNode("div",Lg,[t.createTextVNode(t.toDisplayString(o.$t("marker.markerType")),1),e[22]||(e[22]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(g,{modelValue:i.markerType,"onUpdate:modelValue":e[0]||(e[0]=L=>i.markerType=L),mandatory:"",group:"",density:"compact",variant:"flat",class:"w-100",disabled:!!((b=a.editLayer)!=null&&b.id)},{default:t.withCtx(()=>[t.createVNode(n,{value:"Point",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.markerType==="Point"?"":"btn-border-1 btn-bg-1"]),color:i.markerType==="Point"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.point")),1)]),_:1},8,["class","color"]),t.createVNode(n,{value:"Line",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.markerType==="Line"?"":"btn-border-1 btn-bg-1"]),style:{"border-left":"0 !important","border-right":"0 !important"},color:i.markerType==="Line"?"primary":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.line")),1)]),_:1},8,["class","color"]),t.createVNode(n,{value:"Area",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.markerType==="Area"?"":"btn-border-1 btn-bg-1"]),color:i.markerType==="Area"?"primary":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.area")),1)]),_:1},8,["class","color"])]),_:1},8,["modelValue","disabled"])]}),_:1})),i.markerType==="Point"?(t.openBlock(),t.createBlock(h,{key:1,ref:"pointForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.handleSave,["prevent"])},{default:t.withCtx(()=>[t.createVNode(d,{class:"px-4 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",Cg,[t.createElementVNode("div",vg,[t.createTextVNode(t.toDisplayString(o.$t("marker.lat")),1),e[23]||(e[23]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(y,{class:"ma-0"},{default:t.withCtx(()=>[t.createVNode(u,{cols:"4",class:"pa-0 d-flex"},{default:t.withCtx(()=>[t.createVNode(m,{modelValue:i.form.latDegree,"onUpdate:modelValue":[e[1]||(e[1]=b=>i.form.latDegree=b),e[2]||(e[2]=b=>l.handleChangePoint())],rules:i.formRules.latDegree,label:"",autocomplete:"off",density:"compact",variant:"outlined",height:"32px","min-height":"32px",required:"",dense:"",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[24]||(e[24]=t.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[24]}),t.createVNode(u,{cols:"6",class:"pa-0 d-flex"},{default:t.withCtx(()=>[t.createVNode(m,{modelValue:i.form.latMinute,"onUpdate:modelValue":[e[3]||(e[3]=b=>i.form.latMinute=b),e[4]||(e[4]=b=>l.handleChangePoint())],rules:i.formRules.latMinute,label:"",height:"32px","min-height":"32px",autocomplete:"off",density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[25]||(e[25]=t.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[25]}),t.createVNode(u,{cols:"2",class:"pa-0"},{default:t.withCtx(()=>[t.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[5]||(e[5]=b=>{i.form.latDir=i.form.latDir==="N"?"S":"N",l.handleChangePoint()})},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.form.latDir),1)]),_:1})]),_:1})]),_:1})]),t.createElementVNode("div",zg,[t.createElementVNode("div",_g,[t.createTextVNode(t.toDisplayString(o.$t("marker.lng")),1),e[26]||(e[26]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(y,{class:"ma-0"},{default:t.withCtx(()=>[t.createVNode(u,{cols:"4",class:"pa-0 d-flex"},{default:t.withCtx(()=>[t.createVNode(m,{modelValue:i.form.lngDegree,"onUpdate:modelValue":[e[6]||(e[6]=b=>i.form.lngDegree=b),e[7]||(e[7]=b=>l.handleChangePoint())],rules:i.formRules.lngDegree,density:"compact",variant:"outlined",autocomplete:"off",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[27]||(e[27]=t.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[27]}),t.createVNode(u,{cols:"6",class:"pa-0 d-flex"},{default:t.withCtx(()=>[t.createVNode(m,{modelValue:i.form.lngMinute,"onUpdate:modelValue":[e[8]||(e[8]=b=>i.form.lngMinute=b),e[9]||(e[9]=b=>l.handleChangePoint())],rules:i.formRules.lngMinute,density:"compact",variant:"outlined",autocomplete:"off",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[28]||(e[28]=t.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[28]}),t.createVNode(u,{cols:"2",class:"pa-0"},{default:t.withCtx(()=>[t.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[10]||(e[10]=b=>{i.form.lngDir=i.form.lngDir==="E"?"W":"E",l.handleChangePoint()})},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.form.lngDir),1)]),_:1})]),_:1})]),_:1})]),t.createElementVNode("div",Sg,[t.createElementVNode("div",Ng,[t.createTextVNode(t.toDisplayString(o.$t("marker.color")),1),e[29]||(e[29]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createElementVNode("div",Mg,[t.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[11]||(e[11]=b=>i.form.color=b.target.value)},null,40,Pg),t.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[12]||(e[12]=b=>i.form.color=b),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),t.createElementVNode("div",Vg,[t.createElementVNode("div",Tg,[t.createTextVNode(t.toDisplayString(o.$t("marker.name")),1),e[30]||(e[30]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[13]||(e[13]=b=>i.form.name=b),density:"compact",variant:"outlined",rules:i.formRules.name,autocomplete:"off",class:"input-btn-bg-1"},null,8,["modelValue","rules"])])]),_:1}),t.createVNode(s),t.createVNode(p,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.clear")),1)]),_:1},8,["onClick"]),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])):t.createCommentVNode("",!0),i.markerType==="Line"?(t.openBlock(),t.createBlock(h,{key:2,ref:"lineForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.handleSave,["prevent"])},{default:t.withCtx(()=>[t.createVNode(d,{class:"px-4 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",Eg,[t.createElementVNode("div",Dg,[t.createTextVNode(t.toDisplayString(o.$t("marker.color")),1),e[31]||(e[31]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createElementVNode("div",Rg,[t.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[14]||(e[14]=b=>i.form.color=b.target.value)},null,40,Bg),t.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[15]||(e[15]=b=>i.form.color=b),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),t.createElementVNode("div",Ig,[t.createElementVNode("div",Fg,[t.createTextVNode(t.toDisplayString(o.$t("marker.name")),1),e[32]||(e[32]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[16]||(e[16]=b=>i.form.name=b),density:"compact",variant:"outlined",rules:i.formRules.name,autocomplete:"off",class:"input-btn-bg-1"},null,8,["modelValue","rules"])])]),_:1}),t.createVNode(s),t.createVNode(p,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.clear")),1)]),_:1},8,["onClick"]),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])):t.createCommentVNode("",!0),i.markerType==="Area"?(t.openBlock(),t.createBlock(h,{key:3,ref:"areaForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.handleSave,["prevent"])},{default:t.withCtx(()=>[t.createVNode(d,{class:"px-4 text-body-1"},{default:t.withCtx(()=>{var b,L;return[(b=a.editLayer)!=null&&b.id?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Gg,[t.createElementVNode("div",jg,[t.createTextVNode(t.toDisplayString(o.$t("marker.areaType")),1),e[33]||(e[33]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(g,{modelValue:i.form.areaType,"onUpdate:modelValue":e[17]||(e[17]=k=>i.form.areaType=k),mandatory:"",group:"",density:"compact",variant:"flat",color:"primary",class:"w-100",disabled:!!((L=a.editLayer)!=null&&L.id)},{default:t.withCtx(()=>[t.createVNode(n,{value:"Polygon",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.form.areaType==="Polygon"?"":"btn-border-1 btn-bg-1"]),color:i.form.areaType==="Polygon"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.polygon")),1)]),_:1},8,["class","color"]),t.createVNode(n,{value:"Circle",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.form.areaType==="Circle"?"":"btn-border-1 btn-bg-1"]),style:{"border-left":"0 !important","border-right":"0 !important"},color:i.form.areaType==="Circle"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.circle")),1)]),_:1},8,["class","color"]),t.createVNode(n,{value:"Rect",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.form.areaType==="Rect"?"":"btn-border-1 btn-bg-1"]),color:i.form.areaType==="Rect"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.rect")),1)]),_:1},8,["class","color"])]),_:1},8,["modelValue","disabled"])])),t.createElementVNode("div",Wg,[t.createElementVNode("div",Zg,[t.createTextVNode(t.toDisplayString(o.$t("marker.color")),1),e[34]||(e[34]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createElementVNode("div",Xg,[t.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[18]||(e[18]=k=>i.form.color=k.target.value)},null,40,Hg),t.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[19]||(e[19]=k=>i.form.color=k),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),t.createElementVNode("div",Og,[t.createElementVNode("div",Yg,[t.createTextVNode(t.toDisplayString(o.$t("marker.name")),1),e[35]||(e[35]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[20]||(e[20]=k=>i.form.name=k),density:"compact",variant:"outlined",rules:i.formRules.name,autocomplete:"off",class:"input-btn-bg-1"},null,8,["modelValue","rules"])])]}),_:1}),t.createVNode(s),t.createVNode(p,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>{var b;return[(b=a.editLayer)!=null&&b.id?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(n,{key:0,class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.clear")),1)]),_:1},8,["onClick"])),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.save")),1)]),_:1},8,["loading"])]}),_:1})]),_:1},8,["onSubmit"])):t.createCommentVNode("",!0)]}),_:1})}const Jg=Q(xg,[["render",Ug]]),cb="",Kg={name:"IdmImportMarker",props:{map:{type:Object},gateway:{type:String},token:{type:String},defaultMeteoToken:{type:String},group:{type:Object,default:null}},emits:["close","import"],setup(){return{Theme:ye.useTheme()}},data(){var o;return{form:{groupName:"",name:"",file:null,format:"",extend:void 0,color:(o=this.Theme.current.value.colors)==null?void 0:o["map-green"]},formRules:{groupName:[e=>e!=null&&e!==""||"required"],color:[e=>e!=null&&e!==""||"required"]},isDragOver:!1,uploading:!1,fileError:"",previewSourceId:"__import_preview__",previewMarkers:[]}},watch:{"form.color":{handler(o){var e;(e=this.form.extend)!=null&&e.features&&this.form.extend.features.forEach(a=>{a.properties.color=o}),this.handleDrawLayers()},immediate:!0}},mounted(){var o;this.form.groupName=((o=this.group)==null?void 0:o.name)||"Import layer 1"},beforeUnmount(){this.handleClearPreview()},methods:{handleClose(){this.$emit("close")},handleReset(){var o;this.form={groupName:((o=this.group)==null?void 0:o.name)||"Import layer 1",file:null,format:"",extend:void 0},this.fileError=""},handleSelectFile(){this.$refs.fileInput.click()},handleFileChange(o){const e=o.target.files[0];e&&this.onUpload(e)},handleDrop(o){this.isDragOver=!1;const e=o.dataTransfer.files[0];e&&this.onUpload(e)},async onUpload(o){var r,i,l,n;if(o.size>10485760){this.fileError=this.$t("marker.fileTooLarge");return}this.form.file=o,this.fileError="",this.form.name=(r=o.name.split("."))==null?void 0:r[0];const a=(i=o.name.split(".").pop())==null?void 0:i.toLowerCase();try{let c;if(a==="json"||a==="geojson"){const s=await o.text();c=JSON.parse(s)}else if(a==="kml"){const s=await o.text();c=await M.GeoJsonHelper.convertKML2GeoJSON(s)}else if(a==="kmz"){const s=await o.arrayBuffer();c=await M.GeoJsonHelper.convertKMZ2GeoJSON(s)}else if(a==="zip"||a==="shp"){const s=await o.arrayBuffer();c=await M.GeoJsonHelper.convertZIP2GeoJSON(s)}else{this.fileError="Unsupported format: "+a;return}this.form.extend=c,this.form.format="geojson",(n=(l=this.form.extend)==null?void 0:l.features)==null||n.forEach(s=>{s.properties.color=this.form.color}),this.handleDrawLayers()}catch{this.fileError="Failed to parse file",this.form.file=null}},handleRemoveFile(){this.form.file=null,this.$refs.fileInput.value="",this.handleClearPreview()},async handleConfirm(){const{valid:o}=await this.$refs.importForm.validate();if(!o)return;if(!this.form.file){this.fileError=this.$t("marker.fileRequired");return}this.uploading=!0;let e=this.group.id;if(e||await ce.post(`${this.gateway}/api/arc/lygroups`,{name:this.form.groupName},{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(r=>{var i,l;((i=r.data)==null?void 0:i.code)===0&&(e=(l=r.data.data)==null?void 0:l.id)}),!e){this.uploading=!1;return}const a={format:this.form.format,extend:this.form.extend};ce.post(`${this.gateway}/api/arc/lygroups/${e}/layers`,a,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(r=>{var i;((i=r.data)==null?void 0:i.code)===0&&(this.$emit("import"),this.uploading=!1)}).catch(r=>{this.uploading=!1})},handleDrawLayers(){if(!this.map||!this.form.extend)return;const o=this.form.extend,e=this.previewSourceId,a=o.features||(o.type==="Feature"?[o]:[]);a.forEach(i=>{var n,c,s;const l=((n=i==null?void 0:i.properties)==null?void 0:n.color)||((c=this.Theme.current.value.colors)==null?void 0:c["map-green"]);if(((s=i.geometry)==null?void 0:s.type)==="Point"){const[m,d]=i.geometry.coordinates;this.previewMarkers.push(new me.Marker({color:l}).setLngLat([m,d]).addTo(this.map))}i.properties.color||(i.properties.color=l)}),this.map.getSource(e)?this.map.getSource(e).setData(o):this.map.addSource(e,{type:"geojson",data:o});const r=new Set(a.map(i=>{var l;return(l=i.geometry)==null?void 0:l.type}));(r.has("LineString")||r.has("MultiLineString"))&&!this.map.getLayer(`${e}-line`)&&this.map.addLayer({id:`${e}-line`,type:"line",source:e,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["get","color"],"line-width":2}}),(r.has("Polygon")||r.has("MultiPolygon"))&&(this.map.getLayer(`${e}-fill`)||this.map.addLayer({id:`${e}-fill`,type:"fill",source:e,filter:["==","$type","Polygon"],paint:{"fill-color":["get","color"],"fill-opacity":.35}}),this.map.getLayer(`${e}-outline`)||this.map.addLayer({id:`${e}-outline`,type:"line",source:e,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["get","color"],"line-width":2}}))},handleClearPreview(){if(!this.map)return;this.previewMarkers.forEach(a=>a.remove()),this.previewMarkers=[];const o=this.previewSourceId;[`${o}-vertex`,`${o}-point`,`${o}-line`,`${o}-fill`,`${o}-outline`].forEach(a=>{this.map.getLayer(a)&&this.map.removeLayer(a)}),this.map.getSource(o)&&this.map.removeSource(o)}}},Qg={class:"text-h6 font-weight-600"},qg={class:"mb-4"},$g={class:"text-label mb-1"},eu={class:"mb-1"},tu={class:"text-label mb-1"},ou={class:"color-picker-row d-flex align-start ga-2"},au=["value"],iu={class:"text-body-2 text-center text-label"},ru={class:"text-body-1 text-primary mt-2 cursor-pointer"},lu={class:"text-body-2 text-left text-label mt-1"},nu={key:0,class:"text-body-2 text-left text-danger mt-1"},su={key:1,class:"file-item d-flex align-center justify-space-between mt-2 gray-bg-1 pa-1"},cu={class:"text-body-2 text-truncate"};function mu(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VTextField"),d=t.resolveComponent("VIcon"),g=t.resolveComponent("VCardText"),u=t.resolveComponent("VCardActions"),y=t.resolveComponent("VForm"),p=t.resolveComponent("VCard");return t.openBlock(),t.createBlock(p,{class:"idm-gl4-import-dialog-card",elevation:"4"},{default:t.withCtx(()=>[t.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>[t.createElementVNode("span",Qg,t.toDisplayString(o.$t("marker.importLayer")),1),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:t.withCtx(()=>e[9]||(e[9]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[9]},8,["onClick"])]),_:1}),t.createVNode(s),t.createVNode(y,{ref:"importForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.handleConfirm,["prevent"])},{default:t.withCtx(()=>[t.createVNode(g,{class:"px-4 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",qg,[t.createElementVNode("div",$g,[t.createTextVNode(t.toDisplayString(o.$t("marker.group")),1),e[10]||(e[10]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.form.groupName,"onUpdate:modelValue":e[0]||(e[0]=h=>i.form.groupName=h),density:"compact",variant:"outlined","hide-details":"",class:"input-btn-bg-1"},null,8,["modelValue"])]),t.createElementVNode("div",eu,[t.createElementVNode("div",tu,[t.createTextVNode(t.toDisplayString(o.$t("marker.color")),1),e[11]||(e[11]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createElementVNode("div",ou,[t.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[1]||(e[1]=h=>i.form.color=h.target.value)},null,40,au),t.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[2]||(e[2]=h=>i.form.color=h),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),t.createElementVNode("div",{class:t.normalizeClass(["upload-area btn-bg-1 d-flex flex-column justify-center align-center pa-4",{"drag-over":i.isDragOver,"upload-error":i.fileError}]),onDragenter:e[4]||(e[4]=t.withModifiers(h=>i.isDragOver=!0,["prevent"])),onDragleave:e[5]||(e[5]=t.withModifiers(h=>i.isDragOver=!1,["prevent"])),onDragover:e[6]||(e[6]=t.withModifiers(()=>{},["prevent"])),onDrop:e[7]||(e[7]=t.withModifiers((...h)=>l.handleDrop&&l.handleDrop(...h),["prevent"])),onClick:e[8]||(e[8]=(...h)=>l.handleSelectFile&&l.handleSelectFile(...h))},[t.createVNode(d,{size:"36",color:"grey",class:"mb-2"},{default:t.withCtx(()=>e[12]||(e[12]=[t.createTextVNode("mdi-cloud-upload-outline",-1)])),_:1,__:[12]}),t.createElementVNode("div",iu,t.toDisplayString(o.$t("marker.uploadHint")),1),t.createElementVNode("div",ru,t.toDisplayString(o.$t("marker.selectFile")),1),t.createElementVNode("input",{ref:"fileInput",type:"file",style:{display:"none"},accept:".json,.geojson,.zip,.shp,.kml,.kmz",onChange:e[3]||(e[3]=(...h)=>l.handleFileChange&&l.handleFileChange(...h))},null,544)],34),t.createElementVNode("div",lu,t.toDisplayString(o.$t("marker.uploadLimit")),1),i.fileError?(t.openBlock(),t.createElementBlock("div",nu,t.toDisplayString(i.fileError),1)):t.createCommentVNode("",!0),i.form.file?(t.openBlock(),t.createElementBlock("div",su,[t.createElementVNode("span",cu,[t.createVNode(d,{size:"16",color:"success",class:"mr-1"},{default:t.withCtx(()=>e[13]||(e[13]=[t.createTextVNode("mdi-check-circle",-1)])),_:1,__:[13]}),t.createTextVNode(" "+t.toDisplayString(i.form.file.name),1)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",size:"small",class:"file-remove-btn",onClick:l.handleRemoveFile},{default:t.withCtx(()=>[t.createVNode(d,{size:"16"},{default:t.withCtx(()=>e[14]||(e[14]=[t.createTextVNode("mdi-close",-1)])),_:1,__:[14]})]),_:1},8,["onClick"])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(s),t.createVNode(u,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleReset},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.reset")),1)]),_:1},8,["onClick"]),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.uploading},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.confirm")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])]),_:1})}const du=Q(Kg,[["render",mu]]),mb="",hu={name:"IdmGroupDialog",props:{modelValue:{type:Boolean,default:!1},group:{type:Object,default:null},gateway:{type:String},token:{type:String},defaultMeteoToken:{type:String}},emits:["update:modelValue","saved"],data(){return{localName:"",saving:!1}},watch:{group:{handler(o){this.localName=(o==null?void 0:o.name)||""},immediate:!0}},methods:{handleClose(){this.$emit("update:modelValue",!1)},async handleConfirm(){var o;!this.group||!((o=this.localName)!=null&&o.trim())||(this.saving=!0,await ce.put(`${this.gateway}/api/arc/lygroups/${this.group.id}`,{name:this.localName},{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(e=>{var a;((a=e.data)==null?void 0:a.code)===0&&this.$emit("saved")}).finally(()=>{this.saving=!1}))}}},pu={class:"text-h6 font-weight-600"},gu={class:"text-label mb-2"};function uu(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VTextField"),d=t.resolveComponent("VCardText"),g=t.resolveComponent("VCardActions"),u=t.resolveComponent("VCard"),y=t.resolveComponent("VDialog");return t.openBlock(),t.createBlock(y,{"model-value":a.modelValue,"max-width":"320",persistent:"","onUpdate:modelValue":e[1]||(e[1]=p=>o.$emit("update:modelValue",p))},{default:t.withCtx(()=>[t.createVNode(u,{class:"",elevation:"4"},{default:t.withCtx(()=>[t.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>[t.createElementVNode("span",pu,t.toDisplayString(o.$t("actions.editGroup")),1),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:t.withCtx(()=>e[2]||(e[2]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[2]},8,["onClick"])]),_:1}),t.createVNode(s),t.createVNode(d,{class:"px-4 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",gu,[t.createTextVNode(t.toDisplayString(o.$t("marker.groupName")),1),e[3]||(e[3]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.localName,"onUpdate:modelValue":e[0]||(e[0]=p=>i.localName=p),density:"compact",variant:"outlined","hide-details":"",autocomplete:"off",height:"32px","min-height":"32px",class:"input-btn-bg-1"},null,8,["modelValue"])]),_:1}),t.createVNode(s),t.createVNode(g,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClose},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.cancel")),1)]),_:1},8,["onClick"]),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",loading:i.saving,onClick:l.handleConfirm},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.confirm")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["model-value"])}const fu=Q(hu,[["render",uu]]),yu={name:"DeleteDialog",props:{title:{type:String},tips:{type:String},loading:{type:Boolean,default:!1}},emits:["close","delete"],data(){return{showDialog:!1}},methods:{handleClose(){this.showDialog=!1},handleDelete(){this.$emit("delete")},open(){this.showDialog=!0}}},bu={class:"text-body-1 pb-1"},wu={class:"text-body-1"};function xu(o,e,a,r,i,l){const n=t.resolveComponent("VIcon"),c=t.resolveComponent("VBtn"),s=t.resolveComponent("VCardTitle"),m=t.resolveComponent("VCardText"),d=t.resolveComponent("VCardActions"),g=t.resolveComponent("VCard"),u=t.resolveComponent("VDialog");return t.openBlock(),t.createBlock(u,{modelValue:i.showDialog,"onUpdate:modelValue":e[0]||(e[0]=y=>i.showDialog=y),width:"500","min-width":"500","max-width":"500"},{default:t.withCtx(()=>[t.createVNode(g,{class:""},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6 font-weight-600 d-flex justify-center align-center py-4"},{default:t.withCtx(()=>[t.createVNode(n,{color:"warning",icon:"mdi-alert-circle",size:"small",class:"mr-2"}),t.createElementVNode("div",null,t.toDisplayString(a.title),1),t.createVNode(c,{icon:"",density:"compact",variant:"plain",class:"position-absolute top-0 right-0 mt-2 mr-2",onClick:l.handleClose},{default:t.withCtx(()=>e[1]||(e[1]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[1]},8,["onClick"])]),_:1}),t.createVNode(m,{class:"py-4 text-center"},{default:t.withCtx(()=>[t.createElementVNode("p",bu,t.toDisplayString(a.tips),1),t.createElementVNode("p",wu,t.toDisplayString(o.$t("tips.doYouWantToContinue")),1)]),_:1}),t.createVNode(d,{class:"w-100 d-flex justify-center align-center ga-8 py-6"},{default:t.withCtx(()=>[t.createVNode(c,{variant:"tonal",class:"text-none text-body-1",height:"32",onClick:l.handleClose},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.cancel")),1)]),_:1},8,["onClick"]),t.createVNode(c,{loading:a.loading,variant:"flat",color:"danger",class:"text-none text-body-1",height:"32",onClick:l.handleDelete},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.delete")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["modelValue"])}const ku=Q(yu,[["render",xu]]),db="",hb="",Au={name:"IdmMarker",components:{IdmDrawMarker:Jg,IdmImportMarker:du,IdmGroupDialog:fu,DeleteDialog:ku},props:{simple:{type:Boolean,default:!1},map:{type:Object},theme:{type:String},token:{type:String},isLogin:{type:Boolean,default:!1},defaultMeteoToken:{type:String},gateway:{type:String},top:{type:Number,default:0},paddingTop:{type:Number,default:8},menuToggle:{type:Object,default:{}}},emits:["map","menuToggle","theme","login"],setup(){return{Theme:ye.useTheme()}},data(){return{right:10,toggle:!1,autoActive:localStorage.getItem("autoActiveMarkersGL4")==="true"||void 0,keyword:"",drawDialog:!1,importDialog:!1,loading:!1,deleteDialog:!1,deleteLoading:!1,layerGroup:[],layers:[],groupIndex:0,currentLayer:void 0,drawnLayerIds:[],layerMarkers:{},groupDialog:!1,currentGroup:null,currentGroupId:"",currentGroupName:""}},computed:{listStyle(){return this.simple?{top:this.top+"px",left:this.toggle?"0px":"-280px",height:"calc(100vh - "+this.top+"px)"}:{top:this.top+"px",right:this.toggle?"0px":"-280px",height:"calc(100vh - "+this.top+"px)"}}},watch:{"menuToggle.v":{handler(){this.toggle=this.menuToggle.markerLayers,this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},toggle:{async handler(){this.toggle&&(localStorage.getItem("autoActiveMarkersGL4")||(this.autoActive=!0))}},autoActive:{async handler(){(this.autoActive===!0||this.autoActive===!1)&&localStorage.setItem("autoActiveMarkersGL4",this.autoActive),this.layerGroup.length===0&&await this.fetchAllLayers(),this.autoActive?this.handleDrawAllLayers():this.handleClearAllLayers()},immediate:!0},map:{handler(){this.map&&(this.handleDrawAllLayers(),this.map.on("zoom",this.handleZoomChange))}}},methods:{handleMenuToggle(){this.isLogin?(this.toggle=!this.toggle,this.$emit("menuToggle","markerLayers")):this.$emit("login")},handleEditGroup(o){this.drawDialog=!1,this.importDialog=!1,this.currentGroup=o,this.groupDialog=!0},handleSaveGroup(){this.fetchAllLayers(),this.groupDialog=!1,this.currentGroup=void 0},handleOpenDelete(o,e){o==="group"?(this.currentGroup=e,this.currentLayer=void 0):o==="layer"&&(this.currentGroup=void 0,this.currentLayer=e),this.$refs.deleteDialog.open()},confirmDelete(){var o;this.currentGroup?this.handleDeleteGroup((o=this.currentGroup)==null?void 0:o.id):this.currentLayer&&this.handleDeleteLayer(this.currentLayer)},async handleDeleteGroup(o){o&&(this.deleteLoading=!0,await ce.delete(`${this.gateway}/api/arc/lygroups/${o}`,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(e=>{var a;((a=e.data)==null?void 0:a.code)===0&&(this.fetchAllLayers(),this.currentGroup=void 0,this.$refs.deleteDialog.handleClose(),this.deleteLoading=!1)}).catch(()=>{this.deleteLoading=!1}))},handleOpenDrawMarkers(o){this.handleCloseDraw(),this.currentGroup=o||this.layerGroup.find(e=>e.name==="Custom Layers"),this.importDialog=!1,this.drawDialog=!0},handleOpenImportDialog(o){this.drawDialog=!1,this.handleCloseDraw(),this.currentGroup=o||void 0,this.importDialog=!0},handleImportLayer(o){this.fetchAllLayers(),this.importDialog=!1},handleSaveMarker(o){this.fetchAllLayers(),this.drawDialog=!1,this.currentLayer=null},handleCloseDraw(){this.drawDialog=!1,this.currentLayer=null,this.autoActive&&this.handleDrawAllLayers(),this.currentGroup=void 0},handleEditLayer(o,e){var a;this.importDialog=!1,this.drawDialog&&((a=this.currentLayer)!=null&&a.id)&&this.currentLayer.id!==e.id&&this.autoActive&&this.handleDrawAllLayers(),this.currentGroup=o,this.currentLayer=e,this.drawDialog=!0},async fetchAllLayers(){this.loading=!0,this.layerGroup=[],await ce.get(`${this.gateway}/api/arc/lygroups/my`,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(o=>{var e,a,r,i,l,n;if(((e=o.data)==null?void 0:e.code)===0){this.loading=!1,this.layerGroup=((i=(r=(a=o.data)==null?void 0:a.data)==null?void 0:r.rows)==null?void 0:i.reverse())||[];const c=[];(l=this.layerGroup)==null||l.forEach(s=>{var m;s.show=!0,(m=s.layers)==null||m.forEach(d=>{var u;d.layerGroupId=s.id;const g=typeof d.extend=="string"?JSON.parse(d.extend):d.extend;(u=g==null?void 0:g.features)==null||u.forEach(y=>{y.properties.lgId=s.id,y.properties.layerId=d.id,y.properties.name||(y.properties.name=d.name)}),c.push(d)})}),this.layers=c,this.handleDrawAllLayers(),(n=this.$refs.drawDialog)==null||n.handleClearDraw()}}).catch(()=>{this.loading=!1})},async handleDeleteLayer(o){this.deleteLoading=!0,await ce.delete(`${this.gateway}/api/arc/layers/${o.id}`,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(e=>{var a;((a=e.data)==null?void 0:a.code)===0&&(this.deleteLoading=!1,this.fetchAllLayers(),this.$refs.deleteDialog.handleClose())}).catch(()=>{this.deleteLoading=!1})},handleRenderLayer(o){if(!this.map||!(o!=null&&o.extend))return;const e=typeof o.extend=="string"?JSON.parse(o.extend):o.extend;if(!e)return;const a=`marker-layer-${o.id}`;this.handleClearLayerMarkers(o.id);const r=e.features||(e.type==="Feature"?[e]:[]);if(r.some(c=>{var s,m;return(((s=c.geometry)==null?void 0:s.type)==="Point"||((m=c.geometry)==null?void 0:m.type)==="MultiPoint")&&c.properties.shape==="point"})){const c=[];r.forEach(s=>{var u,y,p,h;const m=(u=s.geometry)==null?void 0:u.type,d=((y=s.properties)==null?void 0:y.name)||"",g=((p=s.properties)==null?void 0:p.color)||o.color||((h=this.Theme.current.value.colors)==null?void 0:h["map-green"]);if(m==="Point"){const[f,w]=s.geometry.coordinates,b=`<div style="font-size:12px;line-height:1.5;">
|
|
220
220
|
<div style="font-weight:600;">${d}</div>
|
|
221
221
|
<div>${M.LngLatHelper.lat2pretty(w,4).pretty}, ${M.LngLatHelper.lng2pretty(f,4).pretty}</div>
|
|
222
222
|
</div>`,L=new me.Popup({offset:40,closeButton:!1,closeOnClick:!1,anchor:"bottom",className:"marker-popup-dark"}).setHTML(b),k=new me.Marker({color:g}).setLngLat([f,w]).addTo(this.map),C=k.getElement();C.addEventListener("mouseenter",()=>L.setLngLat([f,w]).addTo(this.map)),C.addEventListener("mouseleave",()=>L.remove()),c.push(k)}else m==="MultiPoint"&&s.geometry.coordinates.forEach(([f,w])=>{const b=`<div style="font-size:12px;line-height:1.5;">
|