(function(k,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("mapbox-gl"),require("vue"),require("element-plus"),require("@element-plus/icons-vue"),require("moment"),require("@idmwx/idmwx-base"),require("@turf/turf"),require("@idm-plugin/geo"),require("axios")):typeof define=="function"&&define.amd?define(["exports","mapbox-gl","vue","element-plus","@element-plus/icons-vue","moment","@idmwx/idmwx-base","@turf/turf","@idm-plugin/geo","axios"],I):(k=typeof globalThis<"u"?globalThis:k||self,I(k["idmui-report"]={},k["mapbox-gl"],k.Vue,k["element-plus"],k["@element-plus/icons-vue"],k.moment,k["@idmwx/idmwx-base"],k["@turf/turf"],k["@idm-plugin/geo"],k.axios))})(this,function(k,I,e,$,Z,N,P,Aa,S,j){"use strict";function za(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const o in a)if(o!=="default"){const l=Object.getOwnPropertyDescriptor(a,o);Object.defineProperty(t,o,l.get?l:{enumerable:!0,get:()=>a[o]})}}return t.default=a,Object.freeze(t)}const x=za(Aa),Mc="",Ac="",zc="",G=(a,t)=>{const o=a.__vccOpts||a;for(const[l,r]of t)o[l]=r;return o},Oa={name:"MapInitial",props:{center:{type:Object,default:()=>({})},mapboxToken:{type:String,default:""},mapboxStyle:{type:String,default:""}},emits:["initialized"],data(){return{map:void 0,lngLat:void 0,marker:void 0}},watch:{center:{handler(){this.$nextTick(()=>{var t,o,l,r,i;((o=(t=this.center)==null?void 0:t.position)==null?void 0:o.length)===2&&((l=this.center)!=null&&l.flyTo)&&((i=this.map)==null||i.flyTo({center:(r=this.center)==null?void 0:r.position}));const a=document.getElementById("center-marker");this.marker=new I.Marker(a).setLngLat([this.center.position[0],this.center.position[1]]).addTo(this.map),this.marker._element.style.display="block"})},deep:!0}},mounted(){this.initMap()},methods:{async initMap(){I.accessToken=this.mapboxToken;const a=new I.Map({container:"map",style:this.mapboxStyle,projection:"mercator",preserveDrawingBuffer:!0,zoom:3,dragRotate:!1,pitchWithRotate:!1,minZoom:2,center:[100,20]});a.on("load",()=>{this.map=a,this.$emit("initialized",this.map),this.initControl()})},initControl(){var t;const a=new I.ScaleControl({maxWidth:80,unit:"imperial"});(t=this.map)==null||t.addControl(a),a.setUnit("metric")}}},Wa={class:"initial-map-box"};function Fa(a,t,o,l,r,i){return e.openBlock(),e.createElementBlock("div",Wa,t[0]||(t[0]=[e.createElementVNode("div",{id:"map"},null,-1),e.createElementVNode("div",{id:"center-marker"},null,-1)]))}const Ue=G(Oa,[["render",Fa],["__scopeId","data-v-f207dfd3"]]),ja=function(a){typeof a=="string"&&(a=Number(a));let t;switch(a){case 7:t="Sun";break;case 1:t="Mon";break;case 2:t="Tue";break;case 3:t="Wed";break;case 4:t="Thu";break;case 5:t="Fri";break;case 6:t="Sat";break;default:t="-"}return t},Oc="",$a={name:"MapTimeline",components:{ElButton:$.ElButton,ElIcon:$.ElIcon,ElScrollbar:$.ElScrollbar,ElDatePicker:$.ElDatePicker,DArrowLeft:Z.DArrowLeft,DArrowRight:Z.DArrowRight,VideoPause:Z.VideoPause,VideoPlay:Z.VideoPlay,Calendar:Z.Calendar},props:{realTime:{type:Object},startDate:{type:Object,default:()=>N()},endDate:{type:Object,default:()=>N().add(13,"day")},reset:{type:Number,default:0},interval:{type:Number,default:3},bottom:{type:Number,default:0},top:{type:Number,default:void 0}},emits:["realTime","dateChange"],data(){return{hours:Math.ceil(N().utc().hour()/this.interval)*this.interval,paused:!0,animation:void 0,resetTime:!1,startTime:0,progress:0,step:0,frequency:1e3,showCalendar:!1,pickDate:void 0,shortcuts:[]}},computed:{dates(){const a=[];if(this.startDate&&this.endDate){const t=this.startDate.clone().utc().set({hour:0,minute:0,second:0,millisecond:0});for(;t.isSameOrBefore(this.endDate);)a.push(t.clone()),t.add(1,"day")}return a},computeTotalHours(){var t;return((t=this.computeOffsetEndDate)==null?void 0:t.diff(this.computeOffsetStartDate,"h",!0))+24||1},computeOffsetStartDate(){return this.dates[0]},computeOffsetEndDate(){return this.dates[this.dates.length-1]},computeDate(){return function(a){return`${a==null?void 0:a.utc().format("MMM-DD")} ${ja(a==null?void 0:a.utc().format("E"))}`}},computeDateTime(){var t;const a=(t=this.computeOffsetStartDate)==null?void 0:t.clone().add(this.hours,"h");return this.$emit("realTime",a),`${a==null?void 0:a.utc().format("MM-DD/HHmm")}Z`},disableDate(){const a=this.startDate,t=this.endDate;return function(o){const l=N(o);return l.isBefore(a==null?void 0:a.clone().add(-14,"day"))||l.isAfter(t)}}},watch:{realTime:{handler(){this.realTime?this.hours=this.realTime.diff(this.computeOffsetStartDate,"hour",!0):this.hours=Math.ceil(N().utc().hour()/this.interval)*this.interval}},hours:{handler(){const a=document.documentElement.clientWidth,t=this.hours*20/this.interval;t>a/2?this.$refs.scrollBar.setScrollLeft(t-a/2):t=this.computeTotalHours?this.pause():this.step>=0&&(this.hours%this.interval===0?this.hours+=this.interval:this.hours+=this.interval-this.hours%this.interval)}},reset:{handler(){this.reset&&this.handleReset()}}},methods:{pause(){this.animation&&cancelAnimationFrame(this.animation),this.paused=!0},resume(){this.resetTime=!0,this.paused=!1,this.animateSpeeds()},animateSpeeds(a){this.resetTime?(this.startTime=performance.now()-this.progress,this.resetTime=!1):this.progress=a-this.startTime,this.step=Math.floor(this.progress/this.frequency),this.animation=requestAnimationFrame(this.animateSpeeds)},handleJump(a,t=!0){const o=!this.paused;this.pause(),a=a<0?0:a,a%this.interval===0?this.hours=a:this.hours=t?a-a%this.interval:a+this.interval-a%this.interval,o&&this.resume()},handleReset(){this.pause(),this.resetTime=!0,this.startTime=0,this.progress=0,this.hours=Math.ceil(N().utc().hour()/this.interval)*this.interval},handleDatePick(){this.pickDate=this.startDate,this.showCalendar=!this.showCalendar,this.shortcuts=[{text:"Current",value:this.pickDate.toDate()},{text:"A week ago",value:()=>this.pickDate.clone().add(-7,"day").toDate()}]},handleDateChange(){this.showCalendar=!1,this.$emit("dateChange",this.pickDate,this.endDate)}}},Ua={class:"timeline-tip"},Ha={key:0,class:"time"},Ga={key:1,class:"time"},Xa={class:"buttons flex-center"},Za={class:"timeline-progress"},Ya=["onClick"],qa={class:"date"},Ja=["onClick"];function Qa(a,t,o,l,r,i){const s=e.resolveComponent("ElDatePicker"),n=e.resolveComponent("Calendar"),c=e.resolveComponent("ElIcon"),p=e.resolveComponent("ElButton"),h=e.resolveComponent("DArrowLeft"),d=e.resolveComponent("VideoPlay"),y=e.resolveComponent("VideoPause"),m=e.resolveComponent("DArrowRight"),u=e.resolveComponent("ElScrollbar");return e.openBlock(),e.createElementBlock("div",{ref:"mapTimeline",class:"map-timeline flex-start",style:e.normalizeStyle({bottom:o.bottom,top:o.top})},[e.createElementVNode("div",Ua,[r.showCalendar?(e.openBlock(),e.createElementBlock("div",Ha,[e.createVNode(s,{modelValue:r.pickDate,"onUpdate:modelValue":t[0]||(t[0]=f=>r.pickDate=f),format:"MM/DD",style:{width:"80px"},size:"small",type:"date","clear-icon":"",shortcuts:r.shortcuts,"disabled-date":i.disableDate,onChange:i.handleDateChange},null,8,["modelValue","shortcuts","disabled-date","onChange"])])):(e.openBlock(),e.createElementBlock("div",Ga,e.toDisplayString(i.computeDateTime),1)),e.createElementVNode("div",Xa,[e.createVNode(p,{size:"small",link:"",onClick:i.handleDatePick},{default:e.withCtx(()=>[e.createVNode(c,null,{default:e.withCtx(()=>[e.createVNode(n)]),_:1})]),_:1},8,["onClick"]),e.createVNode(p,{disabled:r.hours<=0,size:"small",link:"",onClick:t[1]||(t[1]=f=>i.handleJump(r.hours-o.interval,!1))},{default:e.withCtx(()=>[e.createVNode(c,null,{default:e.withCtx(()=>[e.createVNode(h)]),_:1})]),_:1},8,["disabled"]),e.createVNode(p,{size:"small",link:""},{default:e.withCtx(()=>[e.createVNode(c,null,{default:e.withCtx(()=>[r.paused?(e.openBlock(),e.createBlock(d,{key:0,onClick:i.resume},null,8,["onClick"])):(e.openBlock(),e.createBlock(y,{key:1,onClick:i.pause},null,8,["onClick"]))]),_:1})]),_:1}),e.createVNode(p,{disabled:r.hours>=i.computeTotalHours,size:"small",link:"",onClick:t[2]||(t[2]=f=>i.handleJump(r.hours+o.interval,!0))},{default:e.withCtx(()=>[e.createVNode(c,null,{default:e.withCtx(()=>[e.createVNode(m)]),_:1})]),_:1},8,["disabled"])])]),e.createVNode(u,{ref:"scrollBar"},{default:e.withCtx(()=>[e.createElementVNode("div",Za,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.computeTotalHours,(f,g)=>{var w;return e.openBlock(),e.createElementBlock(e.Fragment,{key:g},[g%o.interval===0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[g%24===0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(f<=r.hours?"progress-step active":"progress-step"),onClick:b=>i.handleJump(f+o.interval-1)},[e.createElementVNode("span",qa,e.toDisplayString(i.computeDate((w=i.computeOffsetStartDate)==null?void 0:w.clone().add(f,"h"))),1)],10,Ya)):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(f<=r.hours?"progress-step active":"progress-step"),onClick:b=>i.handleJump(f+o.interval-1)},null,10,Ja))],64)):e.createCommentVNode("",!0)],64)}),128))])]),_:1},512)],4)}const He=G($a,[["render",Qa],["__scopeId","data-v-da2c10bc"]]);function Ka(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Ke={exports:{}};(function(a,t){var o=function(){var l={},r=Math.PI/180,i=180/Math.PI,s=6378137,n=20037508342789244e-9;function c(h){return Number(h)===h&&h%1!==0}function p(h){if(h=h||{},this.size=h.size||256,this.expansion=h.antimeridian===!0?2:1,!l[this.size]){var d=this.size,y=l[this.size]={};y.Bc=[],y.Cc=[],y.zc=[],y.Ac=[];for(var m=0;m<30;m++)y.Bc.push(d/360),y.Cc.push(d/(2*Math.PI)),y.zc.push(d/2),y.Ac.push(d),d*=2}this.Bc=l[this.size].Bc,this.Cc=l[this.size].Cc,this.zc=l[this.size].zc,this.Ac=l[this.size].Ac}return p.prototype.px=function(h,d){if(c(d)){var y=this.size*Math.pow(2,d),m=y/2,u=y/360,f=y/(2*Math.PI),g=y,w=Math.min(Math.max(Math.sin(r*h[1]),-.9999),.9999),b=m+h[0]*u,v=m+.5*Math.log((1+w)/(1-w))*-f;return b>g*this.expansion&&(b=g*this.expansion),v>g&&(v=g),[b,v]}else{var m=this.zc[d],w=Math.min(Math.max(Math.sin(r*h[1]),-.9999),.9999),b=Math.round(m+h[0]*this.Bc[d]),v=Math.round(m+.5*Math.log((1+w)/(1-w))*-this.Cc[d]);return b>this.Ac[d]*this.expansion&&(b=this.Ac[d]*this.expansion),v>this.Ac[d]&&(v=this.Ac[d]),[b,v]}},p.prototype.ll=function(h,d){if(c(d)){var y=this.size*Math.pow(2,d),m=y/360,u=y/(2*Math.PI),f=y/2,g=(h[1]-f)/-u,w=(h[0]-f)/m,b=i*(2*Math.atan(Math.exp(g))-.5*Math.PI);return[w,b]}else{var g=(h[1]-this.zc[d])/-this.Cc[d],w=(h[0]-this.zc[d])/this.Bc[d],b=i*(2*Math.atan(Math.exp(g))-.5*Math.PI);return[w,b]}},p.prototype.bbox=function(h,d,y,m,u){m&&(d=Math.pow(2,y)-1-d);var f=[h*this.size,(+d+1)*this.size],g=[(+h+1)*this.size,d*this.size],w=this.ll(f,y).concat(this.ll(g,y));return u==="900913"?this.convert(w,"900913"):w},p.prototype.xyz=function(h,d,y,m){m==="900913"&&(h=this.convert(h,"WGS84"));var u=[h[0],h[1]],f=[h[2],h[3]],g=this.px(u,d),w=this.px(f,d),b=[Math.floor(g[0]/this.size),Math.floor((w[0]-1)/this.size)],v=[Math.floor(w[1]/this.size),Math.floor((g[1]-1)/this.size)],E={minX:Math.min.apply(Math,b)<0?0:Math.min.apply(Math,b),minY:Math.min.apply(Math,v)<0?0:Math.min.apply(Math,v),maxX:Math.max.apply(Math,b),maxY:Math.max.apply(Math,v)};if(y){var C={minY:Math.pow(2,d)-1-E.maxY,maxY:Math.pow(2,d)-1-E.minY};E.minY=C.minY,E.maxY=C.maxY}return E},p.prototype.convert=function(h,d){return d==="900913"?this.forward(h.slice(0,2)).concat(this.forward(h.slice(2,4))):this.inverse(h.slice(0,2)).concat(this.inverse(h.slice(2,4)))},p.prototype.forward=function(h){var d=[s*h[0]*r,s*Math.log(Math.tan(Math.PI*.25+.5*h[1]*r))];return d[0]>n&&(d[0]=n),d[0]<-n&&(d[0]=-n),d[1]>n&&(d[1]=n),d[1]<-n&&(d[1]=-n),d},p.prototype.inverse=function(h){return[h[0]*i/s,(Math.PI*.5-2*Math.atan(Math.exp(-h[1]/s)))*i]},p}();a.exports=o})(Ke);var eo=Ke.exports;const to=Ka(eo);var ao=Object.defineProperty,oo=(a,t,o)=>t in a?ao(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,M=(a,t,o)=>(oo(a,typeof t!="symbol"?t+"":t,o),o);const _=(a,t)=>{const o=a.__vccOpts||a;for(const[l,r]of t)o[l]=r;return o},ro={name:"IdmGlLayer",props:{map:{type:Object},top:{type:String,default:"10px"},left:{type:String,default:"10px"}},emits:["weather","other","coordinate","measure","point","3d","meteoSource"],data(){return{showLayers:!1,source:"",weatherLayers:[],activeWeatherLayers:[],autoActive:!0,otherLayers:[],layers:{weather:[...P.LayerHelper.WEATHER_LAYERS],other:[...P.LayerHelper.OTHER_LAYERS]},weatherLayersCache:"weatherLayersCache",autoActiveCache:"autoActiveCache",otherLayersCache:"otherLayersCache",sourceCache:"defaultSourceCache",showCoord:!1,showMeasure:!1,showPoint:!1,show3d:!1,version:{v:"0.0.4",k:"glCacheVersion"}}},computed:{computeLayerClass(){return function(a,t){return a.enabled?t.some(o=>o.key===a.key)?"layer active":"layer":"layer disabled"}}},watch:{},mounted(){const a=localStorage.getItem(this.version.k);this.version.v!==a&&(localStorage.removeItem(this.weatherLayersCache),localStorage.setItem(this.version.k,this.version.v));let t=localStorage.getItem(this.autoActiveCache);this.autoActive=t!=="false",t=localStorage.getItem(this.weatherLayersCache);let o=JSON.parse(t||'[{"weight":1,"name":"Wind","key":"wind","enabled":true,"type":"json","particle":true},{"weight":16,"name":"Sig Waves","key":"sig-wave-height","enabled":true,"type":"json"},{"weight":4096,"name":"Pressure","key":"prmsl","enabled":true,"type":"json"},{"weight":256,"name":"Tropicals","key":"tropicals","enabled":true,"type":"json"}]');this.weatherLayers=o,this.autoActive&&(this.activeWeatherLayers=[...o]),t=localStorage.getItem(this.otherLayersCache),o=JSON.parse(t||'[{"weight":2048,"name":"ENC","key":"enc","enabled":true,"type":"json"},{"weight":4,"name":"ECA Zones","key":"eca-zones","enabled":true,"type":"json"}]'),this.otherLayers=o,t=localStorage.getItem(this.sourceCache),this.source=t||"GFS",this.handleConfirm()},methods:{handleConfirm(){this.showLayers=!1,this.$emit("weather",this.weatherLayers,this.activeWeatherLayers,this.source),this.$emit("other",this.otherLayers),localStorage.setItem(this.autoActiveCache,this.autoActive),localStorage.setItem(this.sourceCache,this.source),this.$emit("meteoSource",this.source)},handleWeatherLayerPick(a){this.weatherLayers.some(t=>t.key===a.key)?(this.weatherLayers=this.weatherLayers.filter(t=>t.key!==a.key),this.activeWeatherLayers=this.activeWeatherLayers.filter(t=>t.key!==a.key)):this.weatherLayers.length<12&&a.enabled&&(["png","jpg"].includes(a.type)&&(this.weatherLayers=this.weatherLayers.filter(t=>t.type==="json"),this.activeWeatherLayers=this.activeWeatherLayers.filter(t=>t.type==="json")),this.weatherLayers.push(a),this.activeWeatherLayers.push(a)),localStorage.setItem(this.weatherLayersCache,JSON.stringify(this.weatherLayers))},handleActiveWeatherLayerPick(a){if(this.activeWeatherLayers.some(t=>t.key===a.key))this.activeWeatherLayers=this.activeWeatherLayers.filter(t=>t.key!==a.key);else if(a.enabled){this.activeWeatherLayers.push(a);for(const t of this.weatherLayers)a.weight>t.weight&&a.weight&t.weight&&this.activeWeatherLayers.push(t)}this.$emit("weather",this.weatherLayers,this.activeWeatherLayers,this.source)},handleOtherLayerPick(a){this.otherLayers.some(t=>t.key===a.key)?this.otherLayers=this.otherLayers.filter(t=>t.key!==a.key):a.enabled&&this.otherLayers.push(a),localStorage.setItem(this.otherLayersCache,JSON.stringify(this.otherLayers))},handleCoordToggle(){this.showCoord=!this.showCoord,this.$emit("coordinate",this.showCoord)},handlePointToggle(){this.showPoint=!this.showPoint,this.$emit("point",this.showPoint)},handleMeasureToggle(){this.showMeasure=!this.showMeasure,this.$emit("measure",this.showMeasure)},handle3DToggle(){this.show3d=!this.show3d,this.$emit("3d",this.show3d)}}},io={class:"layer-bars flex-start"},lo=e.createElementVNode("span",{class:"iconfont"},"",-1),so=[lo],no={class:"other-bars"},co=e.createElementVNode("span",{class:"iconfont"},"",-1),ho=[co],po=e.createElementVNode("span",{class:"iconfont"},"",-1),mo=[po],yo=e.createElementVNode("span",{class:"iconfont"},"",-1),go=[yo],fo=e.createElementVNode("span",{class:"iconfont"},"",-1),uo=[fo],bo={key:0,class:"active-layers"},wo=["onClick"],Lo=e.createElementVNode("div",{class:"checkbox"},null,-1),vo={key:0,class:"available-layers"},xo={class:"weather-layers"},Eo={class:"layers-title",style:{display:"flex","align-items":"center","justify-content":"space-between"}},Co=e.createElementVNode("div",{class:"checkbox"},null,-1),So=e.createElementVNode("span",null,"Auto Act.",-1),_o=[Co,So],ko={class:"layers-body"},No=["onClick"],Vo=e.createElementVNode("div",{class:"checkbox"},null,-1),To={class:"other-layers"},Do=e.createElementVNode("div",{class:"layers-title"},"Other Layers",-1),Po={class:"layers-body"},Bo=["onClick"],Ro=e.createElementVNode("div",{class:"checkbox"},null,-1),Io={class:"source-layers"},Mo=e.createElementVNode("div",{class:"layers-title"},"Forecast Model",-1),Ao={class:"layers-body"},zo=e.createElementVNode("div",{class:"checkbox"},null,-1),Oo=e.createElementVNode("span",null,"GFS",-1),Wo=[zo,Oo],Fo=e.createElementVNode("div",{class:"checkbox"},null,-1),jo=e.createElementVNode("span",null,"ECMWF",-1),$o=[Fo,jo],Uo={class:"layer",style:{"justify-content":"flex-end",flex:"1"}};function Ho(a,t,o,l,r,i){return e.openBlock(),e.createElementBlock("div",{class:"idm-gl2-layer",style:e.normalizeStyle({top:o.top,left:o.left})},[e.createElementVNode("div",io,[e.createElementVNode("div",{class:e.normalizeClass(r.showLayers?"layer-icon active":"layer-icon"),onClick:t[0]||(t[0]=s=>r.showLayers=!r.showLayers)},so,2)]),e.createElementVNode("div",no,[e.createElementVNode("div",{class:e.normalizeClass(r.showMeasure?"layer-icon active":"layer-icon"),onClick:t[1]||(t[1]=(...s)=>i.handleMeasureToggle&&i.handleMeasureToggle(...s))},ho,2),e.createElementVNode("div",{class:e.normalizeClass(r.showPoint?"layer-icon active":"layer-icon"),onClick:t[2]||(t[2]=(...s)=>i.handlePointToggle&&i.handlePointToggle(...s))},mo,2),e.createElementVNode("div",{class:e.normalizeClass(r.showCoord?"layer-icon active":"layer-icon"),onClick:t[3]||(t[3]=(...s)=>i.handleCoordToggle&&i.handleCoordToggle(...s))},go,2),e.createElementVNode("div",{class:e.normalizeClass(r.show3d?"layer-icon active":"layer-icon"),onClick:t[4]||(t[4]=(...s)=>i.handle3DToggle&&i.handle3DToggle(...s))},uo,2)]),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[r.showLayers?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",bo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.weatherLayers,s=>(e.openBlock(),e.createElementBlock("div",{key:s.key,class:e.normalizeClass(i.computeLayerClass(s,r.activeWeatherLayers)),onClick:n=>i.handleActiveWeatherLayerPick(s)},[Lo,e.createElementVNode("span",null,e.toDisplayString(s.name),1)],10,wo))),128))]))]),_:1}),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[r.showLayers?(e.openBlock(),e.createElementBlock("div",vo,[e.createElementVNode("div",xo,[e.createElementVNode("div",Eo,[e.createElementVNode("div",null,"Weather Layers ["+e.toDisplayString(r.weatherLayers.length)+"/12 (Max)]",1),e.createElementVNode("div",{class:e.normalizeClass(r.autoActive?"layer active":"layer"),style:{"padding-top":"0"},onClick:t[5]||(t[5]=s=>r.autoActive=!r.autoActive)},_o,2)]),e.createElementVNode("div",ko,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.layers.weather,s=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:s.key},[s.hide?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.computeLayerClass(s,r.weatherLayers)),onClick:n=>i.handleWeatherLayerPick(s)},[Vo,e.createElementVNode("span",null,e.toDisplayString(s.name),1)],10,No))],64))),128))])]),e.createElementVNode("div",To,[Do,e.createElementVNode("div",Po,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.layers.other,s=>(e.openBlock(),e.createElementBlock("div",{key:s.key,class:e.normalizeClass(i.computeLayerClass(s,r.otherLayers)),onClick:n=>i.handleOtherLayerPick(s)},[Ro,e.createElementVNode("span",null,e.toDisplayString(s.name),1)],10,Bo))),128))])]),e.createElementVNode("div",Io,[Mo,e.createElementVNode("div",Ao,[e.createElementVNode("div",{class:e.normalizeClass(r.source==="GFS"?"layer active":"layer"),onClick:t[6]||(t[6]=s=>r.source="GFS")},Wo,2),e.createElementVNode("div",{class:e.normalizeClass(r.source==="CMEMS"?"layer active":"layer"),onClick:t[7]||(t[7]=s=>r.source="CMEMS")},$o,2),e.createElementVNode("div",Uo,[e.createElementVNode("div",{class:"confirm",onClick:t[8]||(t[8]=(...s)=>i.handleConfirm&&i.handleConfirm(...s))},"Confirm")])])])])):e.createCommentVNode("",!0)]),_:1})],4)}const Go=_(ro,[["render",Ho]]),Xo={name:"IdmWindBarb",props:{map:{type:Object},wind:{type:Object},beforeLayer:{type:String},left:{type:String,default:"10px"},bottom:{type:String,default:"70px"},showParticle:{type:Boolean,default:!1},marginBottom:{type:String,default:"30px"}},emits:["particle"],data(){return{source:"wind-barb-source",barbs:[0,2,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105],empty:x.featureCollection([]),showFeather:!0}},watch:{"wind.version":{handler(){var a;(a=this.wind)!=null&&a.active?this.handleRender():this.handleClear()},deep:!0},showParticle:{handler(){this.showFeather=!this.showParticle},immediate:!0},showFeather:{handler(){this.handleToggle()},immediate:!0}},methods:{handleParticle(){this.$emit("particle",{particle:!this.showParticle,key:"wind",weight:1})},handleRender(){var a,t,o,l;if(!this.map)setTimeout(()=>{this.handleRender()},500);else if(this.wind){const r=new Date().valueOf();let i=0,s=0,n=this.empty;if((a=this.wind)!=null&&a.active&&(n=(t=this.wind)==null?void 0:t.data),(o=this.map)!=null&&o.getSource(this.source))(l=this.map)==null||l.getSource(this.source).setData(n),s=new Date().valueOf()-(r+i),console.log("[wind] update elapsed: ",s,", total: ",i+=s);else{this.map.addSource(this.source,{type:"geojson",data:n});for(let c=0;c<(this.barbs??[]).length-1;c++){const p=(this.barbs??[])[c]||0,h=(this.barbs??[])[c+1]||0,d=p<10?`00${p}kts`:p<100?`0${p}kts`:`${p}kts`;this.map.addLayer({id:d,type:"symbol",filter:["all",[">=","spd",p],["<","spd",h]],source:this.source,layout:{"symbol-placement":"point","icon-image":d,"icon-size":{base:1,stops:[[2,.6],[6,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":1}})}s=new Date().valueOf()-(r+i),console.log("[wind] add elapsed: ",s,", total: ",i+=s)}}},handleToggle(){for(const a of this.barbs??[]){const t=a<10?`00${a}kts`:a<100?`0${a}kts`:`${a}kts`;this.map.getLayer(t)&&this.map.setLayoutProperty(t,"visibility",this.showFeather?"visible":"none")}},handleClear(){for(const a of this.barbs??[]){const t=a<10?`00${a}kts`:a<100?`0${a}kts`:`${a}kts`;this.map.getLayer(t)&&this.map.removeLayer(t)}this.map.getSource(this.source)&&this.map.removeSource(this.source)}}},Zo={key:0,class:"iconfont active"},Yo={key:1,class:"iconfont"},qo={key:0,class:"iconfont active"},Jo={key:1,class:"iconfont"};function Qo(a,t,o,l,r,i){var s;return(s=o.wind)!=null&&s.active?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle({position:"absolute",left:o.left,bottom:o.bottom})},[e.createElementVNode("div",{class:"legend-bars flex-center",style:e.normalizeStyle({marginBottom:o.marginBottom})},[e.createElementVNode("div",{class:"flex-start",onClick:t[0]||(t[0]=(...n)=>i.handleParticle&&i.handleParticle(...n))},[o.showParticle?(e.openBlock(),e.createElementBlock("i",Zo,"")):(e.openBlock(),e.createElementBlock("i",Yo,"")),e.createElementVNode("span",{class:e.normalizeClass(o.showParticle?"active":"")},"Wind Particles",2)]),o.showParticle?(e.openBlock(),e.createElementBlock("div",{key:0,class:"flex-start",style:{"margin-left":"16px"},onClick:t[1]||(t[1]=n=>r.showFeather=!r.showFeather)},[r.showFeather?(e.openBlock(),e.createElementBlock("i",qo,"")):(e.openBlock(),e.createElementBlock("i",Jo,"")),e.createElementVNode("span",{class:e.normalizeClass(r.showFeather?"active":"")},"Wind Feather",2)])):e.createCommentVNode("",!0)],4)],4)):e.createCommentVNode("",!0)}const Ko=_(Xo,[["render",Qo],["__scopeId","data-v-15131bb2"]]);class Ge{constructor(t){M(this,"map"),M(this,"mercator"),M(this,"rampColorLayer"),M(this,"rampColorSource"),M(this,"particleLayer"),M(this,"particleSource"),M(this,"rampColorCanvas"),M(this,"particleCanvas"),M(this,"ratio"),this.map=t,this.mercator=new to,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(t,o=0){return t>180?this.convertNLng(t-360,o+1):t<-180?this.convertNLng(t+360,o+1):[t,o]}getBoundLngLat(){const t=this.map.getBounds();return[[t._sw.lng,t._ne.lat],[t._ne.lng,t._ne.lat],[t._ne.lng,t._sw.lat],[t._sw.lng,t._sw.lat]]}getBoundPixel(){const t=this.map.getBounds(),o=this.map.getZoom()+1,l=[t._ne.lng,t._ne.lat],r=[t._sw.lng,t._sw.lat],[i,s]=this.convertNLng(l[0]),[n,c]=this.convertNLng(r[0]),[p,h]=this.mercator.px([i,l[1]],o),[d,y]=this.mercator.px([n,r[1]],o),m=Math.round(this.mercator.size*Math.pow(2,o)*(s+c));return[d,y,p+m,h]}getBoundRange(){const t=this.map.getZoom()+1,o=this.mercator.size*Math.pow(2,t),l=this.getBoundPixel();return[l[0]/o,l[2]/o,l[3]/o,l[1]/o]}getWorldCopy(t,o){const l=2**o,[r,i,s,n]=t.map(p=>~~(p/(l*256))),c=[];for(let p=n;p<=i;p++)for(let h=r;h<=s;h++)c.push([h,p]);return c.map(p=>{const h=2**o*256;return[p[0]*h,p[1]*h,h]})}resize(){let t=this.map.getSource(this.rampColorSource);t.setCoordinates(this.getBoundLngLat()),t=this.map.getSource(this.particleSource),t.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(t){this.map.setLayoutProperty(this.rampColorLayer,"visibility",t?"visible":"none")}toggleParticle(t){this.map.setLayoutProperty(this.particleLayer,"visibility",t?"visible":"none")}}class Y{createShader(t,o,l){const r=t.createShader(o);if(r&&(t.shaderSource(r,l),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)))throw new Error(t.getShaderInfoLog(r)||"error happened while create shader...");return r}createTexture(t,o,l,r,i,s,n){const c=t.createTexture();return t.bindTexture(t.TEXTURE_2D,c),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,o),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,l),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,r),i instanceof Uint8Array?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,s,n,0,t.RGBA,t.UNSIGNED_BYTE,i):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,i),t.bindTexture(t.TEXTURE_2D,null),c}createDataBuffer(t,o,l){if(t){const r=t.createBuffer();return o==="array"?(t.bindBuffer(t.ARRAY_BUFFER,r),l&&t.bufferData(t.ARRAY_BUFFER,l,t.STATIC_DRAW)):o==="element"&&(t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,r),l&&t.bufferData(t.ELEMENT_ARRAY_BUFFER,l,t.STATIC_DRAW)),r}return null}createProgram(t,o,l){const r=t.createProgram(),i=this.createShader(t,t.VERTEX_SHADER,o),s=this.createShader(t,t.FRAGMENT_SHADER,l);if(r&&i&&s&&(t.attachShader(r,i),t.attachShader(r,s),t.linkProgram(r),!t.getProgramParameter(r,t.LINK_STATUS)))throw new Error(t.getProgramInfoLog(r)||"error happened while creating ramp color program");return r}createProgramWrapper(t,o,l){const r=this.createProgram(t,o,l);if(r){const i={program:r},s=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let c=0;c{c.addColorStop(p,h)}),n.fillStyle=c,n.fillRect(0,0,256,1),{canvas:s,texture:this.createTexture(t,t.LINEAR,t.LINEAR,t.CLAMP_TO_EDGE,l?new Uint8Array(n.getImageData(0,0,256,1).data):s,r,i)}}}setupParticle(t,o=1e3){const l=Math.ceil(Math.sqrt(o)),r=l*l,i=new Uint8Array(r*4);for(let h=0;h{const l=new Blob([t],{type:t.type}),r=URL.createObjectURL(l),i=new Image;i.crossOrigin="anonymous",i.src=r,i.onload=()=>o(i)})}}class B{}M(B,"vertexSchema",` //canvas 坐标系上的坐标 (x, y) attribute vec2 a_position; //像素坐标 attribute vec2 a_texCoord; //纹理坐标 // canvas 宽高 uniform vec2 u_resolution; //全局变量 varying vec2 v_texCoord; //向fragmentSchema传值 void main() { // 将屏幕坐标系转化为裁剪坐标(裁剪坐标系) convert the position from pixels to 0.0 to 1.0 vec2 position = (a_position / u_resolution) * 2.0 - 1.0; // canvas的 Y 轴坐标方向和 设备坐标系的相反 gl_Position = vec4(position * vec2(1, -1), 0.0, 1.0); v_texCoord = a_texCoord; }`),M(B,"uvFragmentSchema",` precision mediump float; uniform sampler2D u_image; uniform vec2 u_range_u_v; uniform vec2 u_range_s; uniform sampler2D u_color; varying vec2 v_texCoord; void main() { vec4 uv = texture2D(u_image, v_texCoord); float u = uv.r * (u_range_u_v.y - u_range_u_v.x) + u_range_u_v.x; float v = uv.g * (u_range_u_v.y - u_range_u_v.x) + u_range_u_v.x; float s = sqrt(u * u + v * v); float r = (s - u_range_s.x) / (u_range_s.y - u_range_s.x); float f = 1.0 - uv.b; vec4 color = texture2D(u_color, vec2(r, 0.5)) * f; gl_FragColor = color; }`),M(B,"fragmentSchema",` precision mediump float; uniform sampler2D u_image; // 灰度 uniform sampler2D u_color; // 色值映射 varying vec2 v_texCoord;// 坐标 void main() { vec4 rgba = texture2D(u_image, v_texCoord); vec4 color = texture2D(u_color, vec2(rgba.r, 0)); gl_FragColor = color; }`);class z{}M(z,"vertexSchema",` precision mediump float; attribute float a_index; // 索引 uniform sampler2D u_particles; // 粒子纹理 uniform float u_particles_resolution; // Math.ceil(Math.sqrt(numParticles))) uniform float u_point; uniform vec4 u_viewport; varying vec2 v_particle_pos_uv; void main() { vec4 color = texture2D(u_particles, vec2( fract(a_index / u_particles_resolution), floor(a_index / u_particles_resolution) / u_particles_resolution)); vec2 v_particle_pos = vec2(color.r / 255.0 + color.b, color.g / 255.0 + color.a); v_particle_pos_uv = vec2(fract(v_particle_pos.x * (u_viewport.y - u_viewport.x) + u_viewport.x), v_particle_pos.y * (u_viewport.w - u_viewport.z) + u_viewport.z); gl_PointSize = 1.0; // gl_PointSize = u_point; gl_Position = vec4(2.0 * v_particle_pos.x - 1.0, 1.0 - 2.0 * v_particle_pos.y, 0, 1); }`),M(z,"fragmentSchema",` precision mediump float; uniform sampler2D u_factor; uniform vec2 u_factor_min; uniform vec2 u_factor_max; uniform sampler2D u_color_ramp; varying vec2 v_particle_pos_uv; void main() { vec4 uv = texture2D(u_factor, v_particle_pos_uv); vec2 velocity = mix(u_factor_min, u_factor_max, uv.rg); float speed_t = length(velocity) / length(u_factor_max); // color ramp is encoded in a 16x16 texture vec2 ramp_pos = vec2( fract(16.0 * speed_t), floor(16.0 * speed_t) / 16.0); float f = 1.0 - uv.b; gl_FragColor = texture2D(u_color_ramp, ramp_pos) * f; }`),M(z,"quadVertSchema",` precision mediump float; attribute vec2 a_pos; varying vec2 v_tex_pos; void main() { v_tex_pos = a_pos; gl_Position = vec4(1.0 - 2.0 * a_pos, 0, 1); }`),M(z,"screenFragmentSchema",` precision mediump float; uniform sampler2D u_screen; uniform float u_opacity; varying vec2 v_tex_pos; void main() { vec4 color = texture2D(u_screen, 1.0 - v_tex_pos); // a hack to guarantee opacity fade out even with a value close to 1.0 gl_FragColor = vec4(floor(255.0 * color * u_opacity) / 255.0); }`),M(z,"updateFragmentSchema",` precision mediump float; uniform sampler2D u_particles; uniform sampler2D u_factor; uniform vec2 u_factor_res; uniform vec2 u_factor_min; uniform vec2 u_factor_max; uniform float u_rand_seed; uniform float u_speed_factor; uniform float u_drop_rate; uniform float u_drop_rate_bump; uniform vec4 u_viewport; varying vec2 v_tex_pos; // pseudo-random generator const vec3 rand_constants = vec3(989.6543, 43.456, 287.6543); float rand(const vec2 co) { float t = dot(rand_constants.xy, co); return fract(sin(t) * (rand_constants.z + t)); } // factor speed lookup; use manual bilinear filtering based on 4 adjacent pixels for smooth interpolation vec2 lookup_factor(const vec2 uv) { vec2 px = 1.0 / u_factor_res; vec2 vc = (floor(uv * u_factor_res)) * px; vec2 f = fract(uv * u_factor_res); vec2 tl = texture2D(u_factor, vc).rg; vec2 tr = texture2D(u_factor, vc + vec2(px.x, 0)).rg; vec2 bl = texture2D(u_factor, vc + vec2(0, px.y)).rg; vec2 br = texture2D(u_factor, vc + px).rg; return mix(mix(tl, tr, f.x), mix(bl, br, f.x), f.y); } void main() { vec4 color = texture2D(u_particles, v_tex_pos); // decode particle position from pixel RGBA vec2 pos = vec2( color.r / 255.0 + color.b, color.g / 255.0 + color.a); vec2 pos_uv = vec2( fract(pos.x * (u_viewport.y - u_viewport.x) + u_viewport.x), pos.y * (u_viewport.w - u_viewport.z) + u_viewport.z); vec2 velocity = mix(u_factor_min, u_factor_max, lookup_factor(pos_uv)); float speed_t = length(velocity) / length(u_factor_max); float b = texture2D(u_factor, pos_uv).b; float p = (b / -1.0) + 1.0; velocity = velocity * p; speed_t = speed_t * p; // take EPSG:4236 distortion into account for calculating where the particle moved float distortion = cos(radians(pos.y * 180.0 - 90.0)); // float distortion = cos(radians(pos.y * 180.0 - 90.0)); vec2 offset = vec2(velocity.x, -velocity.y) * 0.0001 * u_speed_factor; // update particle position, wrapping around the date line pos = fract(1.0 + pos + offset); // a random seed to use for the particle drop vec2 seed = (pos + v_tex_pos) * u_rand_seed; // drop rate is a chance a particle will restart at random position, to avoid degeneration float drop_rate = u_drop_rate + speed_t * u_drop_rate_bump; float drop = step(1.0 - drop_rate, rand(seed)); vec2 random_pos = vec2( rand(seed + 1.3), rand(seed + 2.1)); pos = mix(pos, random_pos, drop); // 将新的粒子位置编码回RGBA gl_FragColor = vec4( fract(pos * 255.0), floor(pos * 255.0) / 255.0); }`);const er={name:"IdmWindParticle",props:{factor:{type:Object},viewport:{type:Ge},left:{type:String,default:"10px"},bottom:{type:String,default:"70px"}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new Y,etime:void 0,wrapper:void 0,animation:void 0,particleContext:void 0,particleTexture:void 0,particleOptions:{fadeOpacity:.9,speedFactor:.25,dropRate:.003,dropRateBump:.01,uvRange:[-25,26],sRange:[0,31.985]},paused:!1,initial:!0}},watch:{"factor.version":{handler(){var a;(a=this.factor)!=null&&a.active?this.handleRender():this.handleClear()},deep:!0}},methods:{handleRender(){if(!this.viewport)setTimeout(()=>{this.handleRender()},500);else if(this.factor){const a=new Date().valueOf();let t=0,o=0;this.handleDraw(),o=new Date().valueOf()-(a+t),console.log("[wind-particle] add elapsed: ",o,", total: ",t+=o)}},handleClear(){var a,t,o,l,r,i,s;(a=this.viewport)==null||a.toggle(!1),this.context=void 0,this.particleContext=void 0,this.etime=void 0,this.initial=!0,(o=(t=this.viewport)==null?void 0:t.map)==null||o.off("resize",this.handleResize),(r=(l=this.viewport)==null?void 0:l.map)==null||r.off("movestart",this.handlePause),(s=(i=this.viewport)==null?void 0:i.map)==null||s.off("moveend",this.handlePlay),this.handlePause()},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const a=[[0,"rgb(98, 113, 184, 0.8)"],[12/255,"rgb(98, 113, 184)"],[24/255,"rgb(61, 110, 163)"],[32/255,"rgb(74, 146, 148)"],[40/255,"rgb(77, 142, 124)"],[60/255,"rgb(76, 164, 76)"],[80/255,"rgb(103, 164, 54)"],[100/255,"rgb(162, 135, 64)"],[120/255,"rgb(162, 109, 92)"],[140/255,"rgb(141, 63, 92)"],[160/255,"rgb(151, 75, 145)"],[200/255,"rgb(95, 100, 160)"],[240/255,"rgb(91, 136, 161)"],[1,"rgb(91, 136, 161)"]];this.rampColor=this.webgl.setup(this.context,a);const{program:t,aPositionBuffer:o}=this.webgl.bind(this.context,B.vertexSchema,B.uvFragmentSchema);this.program=t,this.aPositionBuffer=o}this.handleParticleSetup()},handleParticleSetup(){if(!this.particleContext){this.particleContext=this.viewport.particleCanvas.getContext("webgl");const a=[[0,"rgb(205,255,255)"],[1,"rgb(235,255,255)"]];this.wrapper=this.webgl.bindParticle(this.particleContext,z.vertexSchema,z.fragmentSchema,z.quadVertSchema,z.screenFragmentSchema,z.updateFragmentSchema),this.wrapper.color=this.webgl.setup(this.particleContext,a,!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 a=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,a),this.particleTexture=this.webgl.createTexture(this.particleContext,this.particleContext.NEAREST,this.particleContext.LINEAR,this.particleContext.CLAMP_TO_EDGE,a),this.wrapper.image=a}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()})}}},tr=a=>(e.pushScopeId("data-v-c5a5b507"),a=a(),e.popScopeId(),a),ar=tr(()=>e.createElementVNode("div",{class:"legend-bars flex-center"},[e.createElementVNode("span",null,"kts"),e.createElementVNode("span",null,"0"),e.createElementVNode("span",null,"5"),e.createElementVNode("span",null,"10"),e.createElementVNode("span",null,"20"),e.createElementVNode("span",null,"30"),e.createElementVNode("span",null,"40"),e.createElementVNode("span",null,"60")],-1)),or=[ar];function rr(a,t,o,l,r,i){var s;return(s=o.factor)!=null&&s.active?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle([{position:"absolute"},{left:o.left,bottom:o.bottom}])},or,4)):e.createCommentVNode("",!0)}const ir=_(er,[["render",rr],["__scopeId","data-v-c5a5b507"]]),lr={name:"IdmCurrent",props:{map:{type:Object},current:{type:Object},beforeLayer:{type:String},left:{type:String,default:"10px"},bottom:{type:String,default:"70px"},showParticle:{type:Boolean,default:!1},marginBottom:{type:String,default:"30px"}},emits:["particle"],data(){return{source:"current-source",directionLayer:"current-direction-layer",speedLayer:"current-speed-layer",speedLabelLayer:"current-speed-label-layer",empty:x.featureCollection([]),showJson:!0}},watch:{"current.version":{handler(){var a;(a=this.current)!=null&&a.active?this.handleRender():this.handleClear()},deep:!0},showParticle:{handler(){this.showParticle?this.showJson=!1:this.showJson=!0},immediate:!0},showJson:{handler(){this.handleToggle()},immediate:!0,deep:!0}},methods:{handleParticle(){this.$emit("particle",{particle:!this.showParticle,key:"current",weight:96})},handleRender(){var a,t;if(!this.map)setTimeout(()=>{this.handleRender()},500);else if(this.current){const o=new Date().valueOf();let l=0,r=0,i=this.empty;this.current.active&&(i=this.current.data),(a=this.map)!=null&&a.getSource(this.source)?((t=this.map)==null||t.getSource(this.source).setData(i),r=new Date().valueOf()-(o+l),console.log("[current] update elapsed: ",r,", total: ",l+=r)):(this.map.addSource(this.source,{type:"geojson",data:i}),this.map.addLayer({id:this.speedLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-opacity":.5,"fill-color":["step",["get","val"],"#D9FFB3",1,"#FFFF80",3,"#FF8040",4,"#FD5200",5,"#FF0000"]}},this.beforeLayer),this.map.addLayer({id:this.speedLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Polygon"],layout:{"symbol-placement":"line","text-field":"{val} kts","text-allow-overlap":!0,"text-rotation-alignment":"viewport","text-size":12},paint:{"text-halo-color":"rgba(0, 0, 0, 0.2)","text-halo-width":.6}},this.beforeLayer),this.map.addLayer({id:this.directionLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-image":"arrow-red","icon-size":["interpolate",["linear"],["get","spd"],.5,.5,3,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":.7}},this.beforeLayer),r=new Date().valueOf()-(o+l),console.log("[current] add elapsed: ",r,", total: ",l+=r)),this.handleToggle()}},handleToggle(){this.map.getLayer(this.speedLayer)&&this.map.setLayoutProperty(this.speedLayer,"visibility",this.showJson?"visible":"none"),this.map.getLayer(this.speedLabelLayer)&&this.map.setLayoutProperty(this.speedLabelLayer,"visibility",this.showJson?"visible":"none"),this.map.getLayer(this.directionLayer)&&this.map.setLayoutProperty(this.directionLayer,"visibility",this.showJson?"visible":"none")},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)}}},sr={key:0,class:"iconfont active"},nr={key:1,class:"iconfont"},cr={key:0,class:"iconfont active"},dr={key:1,class:"iconfont"};function hr(a,t,o,l,r,i){var s;return(s=o.current)!=null&&s.active?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle([{position:"absolute"},{left:o.left,bottom:o.bottom}])},[e.createElementVNode("div",{class:"legend-bars flex-center",style:e.normalizeStyle({marginBottom:o.marginBottom})},[e.createElementVNode("div",{class:"flex-start",onClick:t[0]||(t[0]=(...n)=>i.handleParticle&&i.handleParticle(...n))},[o.showParticle?(e.openBlock(),e.createElementBlock("i",sr,"")):(e.openBlock(),e.createElementBlock("i",nr,"")),e.createElementVNode("span",{class:e.normalizeClass(o.showParticle?"active":"")},"Current Particles",2)]),o.showParticle?(e.openBlock(),e.createElementBlock("div",{key:0,class:"flex-start",style:{"margin-left":"16px"},onClick:t[1]||(t[1]=n=>r.showJson=!r.showJson)},[r.showJson?(e.openBlock(),e.createElementBlock("i",cr,"")):(e.openBlock(),e.createElementBlock("i",dr,"")),e.createElementVNode("span",{class:e.normalizeClass(r.showJson?"active":"")},"Current",2)])):e.createCommentVNode("",!0)],4)],4)):e.createCommentVNode("",!0)}const pr=_(lr,[["render",hr],["__scopeId","data-v-e7a4c6fa"]]),mr={name:"IdmCurrentParticle",props:{factor:{type:Object},viewport:{type:Ge},left:{type:String,default:"10px"},bottom:{type:String,default:"70px"}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new Y,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]},paused:!1,initial:!0}},watch:{"factor.version":{handler(){var a;(a=this.factor)!=null&&a.active?this.handleRender():this.handleClear()},deep:!0}},methods:{handleRender(){if(!this.viewport)setTimeout(()=>{this.handleRender()},500);else if(this.factor){const a=new Date().valueOf();let t=0,o=0;this.handleDraw(),o=new Date().valueOf()-(a+t),console.log("[current-particle] add elapsed: ",o,", total: ",t+=o)}},handleClear(){var a,t,o,l,r,i,s;(a=this.viewport)==null||a.toggle(!1),this.context=void 0,this.particleContext=void 0,this.etime=void 0,this.initial=!0,(o=(t=this.viewport)==null?void 0:t.map)==null||o.off("resize",this.handleResize),(r=(l=this.viewport)==null?void 0:l.map)==null||r.off("movestart",this.handlePause),(s=(i=this.viewport)==null?void 0:i.map)==null||s.off("moveend",this.handlePlay),this.handlePause()},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const a=[[0/255,"rgb(64, 77, 144)"],[5/255,"rgb(61, 121, 110)"],[10/255,"rgb(50, 140, 50)"],[15/255,"rgb(140, 133, 49)"],[20/255,"rgb(143, 115, 50)"],[30/255,"rgb(117, 52, 68)"],[40/255,"rgb(107, 67, 131)"],[45/255,"rgb(67, 93, 133)"],[50/255,"rgb(73, 122, 132)"],[65/255,"rgb(115, 135, 139)"],[80/255,"rgb(144, 144, 144)"],[254/255,"rgb(144, 144, 144)"],[1,"rgb(144, 144, 144)"]];this.rampColor=this.webgl.setup(this.context,a);const{program:t,aPositionBuffer:o}=this.webgl.bind(this.context,B.vertexSchema,B.uvFragmentSchema);this.program=t,this.aPositionBuffer=o}this.handleParticleSetup()},handleParticleSetup(){if(!this.particleContext){this.particleContext=this.viewport.particleCanvas.getContext("webgl");const a=[[0,"rgb(205,255,255)"],[1,"rgb(235,255,255)"]];this.wrapper=this.webgl.bindParticle(this.particleContext,z.vertexSchema,z.fragmentSchema,z.quadVertSchema,z.screenFragmentSchema,z.updateFragmentSchema),this.wrapper.color=this.webgl.setup(this.particleContext,a,!0,16,16),this.wrapper={...this.wrapper,...this.webgl.setupParticle(this.particleContext,12e3),...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 a=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,a),this.particleTexture=this.webgl.createTexture(this.particleContext,this.particleContext.NEAREST,this.particleContext.LINEAR,this.particleContext.CLAMP_TO_EDGE,a),this.wrapper.image=a}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()})}}},yr=a=>(e.pushScopeId("data-v-6e48fcb1"),a=a(),e.popScopeId(),a),gr=yr(()=>e.createElementVNode("div",{class:"legend-bars flex-center"},[e.createElementVNode("span",null,"kts"),e.createElementVNode("span",null,"0"),e.createElementVNode("span",null,"0.4"),e.createElementVNode("span",null,"0.8"),e.createElementVNode("span",null,"1.6"),e.createElementVNode("span",null,"2"),e.createElementVNode("span",null,"3.2")],-1)),fr=[gr];function ur(a,t,o,l,r,i){var s;return(s=o.factor)!=null&&s.active?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle([{position:"absolute"},{left:o.left,bottom:o.bottom}])},fr,4)):e.createCommentVNode("",!0)}const br=_(mr,[["render",ur],["__scopeId","data-v-6e48fcb1"]]),wr={name:"IdmSigWave",props:{map:{type:Object},viewport:{type:Object},sigWave:{type:Object},beforeLayer:{type:String},left:{type:String,default:"10px"},bottom:{type:String,default:"70px"},marginBottom:{type:String,default:"0"}},emits:["ramp"],data(){return{showRamp:!1,showContourLine:!1,source:"sig-wave-source",heightLayer:"sig-wave-height-layer",heightLabelLayer:"sig-wave-height-label-layer",empty:x.featureCollection([])}},watch:{"sigWave.version":{handler(){var a;(a=this.sigWave)!=null&&a.active?(this.showRamp=!1,this.handleRender()):(this.showRamp=!0,this.handleClear())},deep:!0}},methods:{handleToggleRamp(){this.showRamp=!this.showRamp,this.$emit("ramp",{ramp:this.showRamp,key:"sigWave",weight:16})},handleRender(){var a,t;if(!this.map)setTimeout(()=>{this.handleRender()},500);else if(this.sigWave){const o=this.map.getLayer("barb")?"barb":this.beforeLayer,l=new Date().valueOf();let r=0,i=0,s=this.empty;this.sigWave.active&&(s=this.sigWave.data),(a=this.map)!=null&&a.getSource(this.source)?((t=this.map)==null||t.getSource(this.source).setData(s),i=new Date().valueOf()-(l+r),console.log("[sig.wave] update elapsed: ",i,", total: ",r+=i)):(this.map.addSource(this.source,{type:"geojson",data:s}),this.map.addLayer({id:this.heightLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],layout:{"fill-sort-key":["get","val"]},paint:{"fill-outline-color":"silver","fill-opacity":.8,"fill-color":["step",["get","val"],"rgba(111,248,201,0.6)",3,"#6ff8c9",4,"#36cd9a",5,"#6bff6b",6,"#fee600",7,"#ffa200",8,"#ff6600",9,"#e23304",10,"#f80078",11,"#dc03d2",12,"#a603f8",13,"#7102ab"]}},o),this.map.addLayer({id:this.heightLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Polygon"],layout:{"symbol-placement":"line","symbol-avoid-edges":!0,"symbol-sort-key":["get","val"],"text-field":"{val} m","text-rotation-alignment":"viewport","text-size":10},paint:{"text-opacity":.5}},this.beforeLayer),i=new Date().valueOf()-(l+r),console.log("[sig.wave] 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)}}},Lr={key:0,class:"iconfont active"},vr={key:1,class:"iconfont"};function xr(a,t,o,l,r,i){return o.sigWave?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle({position:"absolute",left:o.left,bottom:o.bottom})},[e.createElementVNode("div",{class:"legend-bars flex-center",style:e.normalizeStyle({marginBottom:o.marginBottom})},[e.createElementVNode("div",{class:"flex-start",onClick:t[0]||(t[0]=(...s)=>i.handleToggleRamp&&i.handleToggleRamp(...s))},[r.showRamp?(e.openBlock(),e.createElementBlock("i",Lr,"")):(e.openBlock(),e.createElementBlock("i",vr,"")),e.createElementVNode("span",{class:e.normalizeClass(r.showRamp?"active":"")},"Sig Waves Ramp",2)])],4)],4)):e.createCommentVNode("",!0)}const Er=_(wr,[["render",xr],["__scopeId","data-v-cf15516a"]]),Cr={name:"IdmSigWaveRamp",props:{factor:{type:Object},viewport:{type:Object},left:{type:String,default:"10px"},bottom:{type:String,default:"70px"}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new Y,etime:void 0}},watch:{factor:{handler(){var a;(a=this.factor)!=null&&a.active?this.handleRender():this.handleClear()},deep:!0}},methods:{handleRender(){if(!this.viewport)setTimeout(()=>{this.handleRender()},500);else if(this.factor){const a=new Date().valueOf();let t=0,o=0;this.handleDraw(),o=new Date().valueOf()-(a+t),console.log("[sigWave] add elapsed: ",o,", total: ",t+=o)}},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 a=[[0/255,"rgba(50, 158, 186,0)"],[20/255,"rgba(111,248,201,0)"],[40/255,"rgba(111,248,201,0)"],[41/255,"rgba(111,248,201,0.6)"],[60/255,"#6ff8c9"],[80/255,"#36cd9a"],[100/255,"#6bff6b"],[120/255,"#fee600"],[140/255,"#ffa200"],[160/255,"#ff6600"],[180/255,"#e23304"],[200/255,"#f80078"],[220/255,"#dc03d2"],[240/255,"#a603f8"],[1,"#7102ab"]];this.rampColor=this.webgl.setup(this.context,a);const{program:t,aPositionBuffer:o}=this.webgl.bind(this.context,B.vertexSchema,B.fragmentSchema);this.program=t,this.aPositionBuffer=o}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const a=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,a)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},Sr=a=>(e.pushScopeId("data-v-db8eaf6f"),a=a(),e.popScopeId(),a),_r=Sr(()=>e.createElementVNode("div",{class:"legend-bars flex-center"},[e.createElementVNode("span",null,"m"),e.createElementVNode("span",null,"2"),e.createElementVNode("span",null,"4"),e.createElementVNode("span",null,"6"),e.createElementVNode("span",null,"8"),e.createElementVNode("span",null,"10"),e.createElementVNode("span",null,"12")],-1)),kr=[_r];function Nr(a,t,o,l,r,i){var s;return(s=o.factor)!=null&&s.active?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle([{position:"absolute"},{left:o.left,bottom:o.bottom}])},kr,4)):e.createCommentVNode("",!0)}const Vr=_(Cr,[["render",Nr],["__scopeId","data-v-db8eaf6f"]]),Tr={name:"IdmSwell",props:{map:{type:Object},swell:{type:Object},beforeLayer:{type:String}},data(){return{source:"swell-source",directionLayer:"swell-direction-layer",heightLayer:"swell-height-layer",heightLabelLayer:"swell-height-label-layer",empty:x.featureCollection([])}},watch:{"swell.version":{handler(){var a;(a=this.swell)!=null&&a.active?this.handleRender():this.handleClear()},deep:!0}},methods:{handleRender(){var a,t;if(!this.map)setTimeout(()=>{this.handleRender()},500);else if(this.swell){const o=new Date().valueOf();let l=0,r=0,i=this.empty;this.swell.active&&(i=this.swell.data),(a=this.map)!=null&&a.getSource(this.source)?((t=this.map)==null||t.getSource(this.source).setData(i),r=new Date().valueOf()-(o+l),console.log("[swell] update elapsed: ",r,", total: ",l+=r)):(this.map.addSource(this.source,{type:"geojson",data:i}),this.map.addLayer({id:this.heightLayer,type:"line",source:this.source,filter:["==","$type","LineString"],paint:{"line-opacity":.5,"line-width":2,"line-color":["match",["get","val"],2,"#ffeb3b",3,"#ffc107",4,"#ff9800",5,"#ff5722",6,"#f44336","#f44336"]}},this.beforeLayer),this.map.addLayer({id:this.heightLabelLayer,type:"symbol",source:this.source,filter:["==","$type","LineString"],layout:{"symbol-placement":"line","text-rotation-alignment":"viewport","text-field":"{val}M","text-size":12},paint:{"text-color":["step",["get","val"],"black",5,"white",6,"white"],"text-halo-color":["match",["get","val"],2,"#ffeb3b",3,"#ffc107",4,"#ff9800",5,"#ff5722",6,"#f44336","#f44336"],"text-halo-width":4}}),this.map.addLayer({id:this.directionLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-image":"arrow-yellow","icon-size":{base:1,stops:[[2,.6],[6,1]]},"icon-offset":[0,-20],"icon-allow-overlap":!0,"icon-rotation-alignment":"map","icon-rotate":{property:"val",stops:[[0,180],[360,540]]}},paint:{"icon-opacity":1}},this.beforeLayer),r=new Date().valueOf()-(o+l),console.log("[swell] add elapsed: ",r,", total: ",l+=r))}},handleClear(){this.map.getLayer(this.heightLayer)&&this.map.removeLayer(this.heightLayer),this.map.getLayer(this.heightLabelLayer)&&this.map.removeLayer(this.heightLabelLayer),this.map.getLayer(this.directionLayer)&&this.map.removeLayer(this.directionLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Dr(a,t,o,l,r,i){return e.openBlock(),e.createElementBlock("div")}const Pr=_(Tr,[["render",Dr]]),Br={name:"IdmPrmsl",props:{map:{type:Object},prmsl:{type:Object},beforeLayer:{type:String}},data(){return{source:"prmsl-source",layer:"prmsl-layer",labelLayer:"prmsl-label-layer",pointLabelLayer:"prmsl-point-label-layer",empty:x.featureCollection([])}},watch:{"prmsl.version":{handler(){var a;(a=this.prmsl)!=null&&a.active?this.handleRender():this.handleClear()},deep:!0}},methods:{handleRender(){var a,t,o;if(!this.map)setTimeout(()=>{this.handleRender()},500);else if(this.prmsl){const l=new Date().valueOf();let r=0,i=0,s=this.empty;this.prmsl.active&&(s=this.prmsl.data),(a=this.map)!=null&&a.getSource(this.source)?((t=this.map)==null||t.getSource(this.source).setData(s),i=new Date().valueOf()-(l+r),console.log("[prmsl] update elapsed: ",i,", total: ",r+=i)):(this.map.addSource(this.source,{type:"geojson",data:s}),this.map.addLayer({id:this.layer,type:"line",source:this.source,filter:["==","$type","LineString"],paint:{"line-color":["step",["get","val"],"#e91e63",920,"#f44336",980,"#ffeb3b",1100,"#673ab7"],"line-width":1,"line-opacity":1}}),(o=this.map)==null||o.addLayer({id:this.labelLayer,type:"symbol",source:this.source,filter:["==","$type","LineString"],layout:{"symbol-placement":"line","text-rotation-alignment":"viewport","text-field":"{val}","text-size":12},paint:{"text-color":["step",["get","val"],"white",980,"black",1100,"black"],"text-halo-color":["step",["get","val"],"#e91e63",920,"#f44336",980,"#ffeb3b",1100,"#673ab7"],"text-halo-width":4}}),this.map.addLayer({id:this.pointLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","text-field":["format",["get","type"],{"font-scale":1.03},` `,["get","val"],{"font-scale":1}],"text-rotation-alignment":"map","text-line-height":1.3,"text-size":12},paint:{"text-color":["match",["get","type"],"L","#e91e63","H","#ffeb3b","#ffeb3b"],"text-halo-color":"rgba(255, 255, 255, 0.8)","text-halo-width":.2}}),i=new Date().valueOf()-(l+r),console.log("[prmsl] add elapsed: ",i,", total: ",r+=i))}},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 Rr(a,t,o,l,r,i){return e.openBlock(),e.createElementBlock("div")}const Ir=_(Br,[["render",Rr]]),Mr={name:"IdmIceberg",props:{map:{type:Object},iceberg:{type:Object},beforeLayer:{type:String}},data(){return{source:"iceberg-source",layer:"iceberg-layer",empty:x.featureCollection([])}},watch:{"iceberg.version":{handler(){var a;(a=this.iceberg)!=null&&a.active?this.handleRender():this.handleClear()},deep:!0}},methods:{handleRender(){var a,t;if(!this.map)setTimeout(()=>{this.handleRender()},500);else if(this.iceberg){const o=new Date().valueOf();let l=0,r=0,i=this.empty;this.iceberg.active&&(i=this.iceberg.data),(a=this.map)!=null&&a.getSource(this.source)?((t=this.map)==null||t.getSource(this.source).setData(i),r=new Date().valueOf()-(o+l),console.log("[iceberg] update elapsed: ",r,", total: ",l+=r)):(this.map.addSource(this.source,{type:"geojson",data:i}),this.map.addLayer({id:this.layer,type:"line",source:this.source,filter:["==","$type","LineString"],paint:{"line-color":"rgba(255,255,255, 0.8)","line-width":2,"line-opacity":1}}),r=new Date().valueOf()-(o+l),console.log("[iceberg] add elapsed: ",r,", total: ",l+=r))}},handleClear(){this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Ar(a,t,o,l,r,i){return e.openBlock(),e.createElementBlock("div")}const zr=_(Mr,[["render",Ar]]),Or={name:"IdmTropicals",props:{map:{type:Object},tropicals:{type:Object},date:{type:String}},emits:["tropical"],data(){return{sourceData:[],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",interpolateData:[],interpolateMarkers:[],interpolateSource:"tropicals-interpolate-source",interpolateLineLayer:"tropicals-interpolate-line-layer",showTropicals:!1,activeTropicals:void 0,activeTropicalsMarker:void 0,empty:x.featureCollection([]),circleSource:"circle-source",circleSourceData:x.featureCollection([]),circleLayer:"tropical-circle-layer"}},computed:{computeTime(){return function(a){if(a){const t=N(a).utc();return`${t.format("MMM-DD,HHmm[Z]")} (${t==null?void 0:t.fromNow()})`}return"-"}}},watch:{"tropicals.version":{handler(){var a,t,o;(a=this.tropicals)!=null&&a.active?(this.handleRender(),(t=this.map)==null||t.on("click",[this.forecastNameLayer,this.pointCircleLayer,this.pointLabelLayer],this.handleClick)):(this.handleClear(),(o=this.map)==null||o.off("click",[this.forecastNameLayer,this.pointCircleLayer,this.pointLabelLayer],this.handleClick))},immediate:!0}},methods:{handleRender(){var a,t,o,l,r,i,s,n,c,p;if(!this.map)setTimeout(()=>{this.handleRender()},500);else{if(this.tropicals){const h=new Date().valueOf();let d=0,y=0;this.sourceData=(a=this.tropicals)!=null&&a.active?this.tropicals.data:this.empty,(t=this.map)!=null&&t.getSource(this.source)?((o=this.map)==null||o.getSource(this.source).setData(this.sourceData),y=new Date().valueOf()-(h+d),console.log("[tropicals] update elapsed: ",y,", total: ",d+=y)):(this.map.addSource(this.source,{type:"geojson",data:this.sourceData}),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":"rgba(0, 0, 0, 0.4)","line-width":3,"line-opacity":1}}),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"],"jma","#F56C6C","ecmwf","#E6A23C","ukm","#67C23A","noaa-at","#FFA6FC","noaa-ep","#FFA6FC","#ffffff"],"line-width":3,"line-opacity":1,"line-dasharray":[2,2]}}),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":13},paint:{"text-color":"#6e6e6e","text-halo-color":"#fff","text-halo-width":1}}),this.map.addLayer({id:this.forecastNameLayer,type:"symbol",source:this.source,filter:["all",["==","$type","LineString"],["==","type","forecast"]],layout:{"symbol-placement":"point","text-field":"{name}","text-rotation-alignment":"viewport","text-size":13},paint:{"text-color":"rgba(255, 0, 0, 0.8)","text-halo-color":"#fff","text-halo-width":1}}),y=new Date().valueOf()-(h+d),console.log("[tropical] add elapsed: ",y,", total: ",d+=y)),(l=this.map)!=null&&l.getSource(this.clusterSource)?((i=this.map)==null||i.getSource(this.clusterSource).setData((r=this.tropicals)!=null&&r.active?this.tropicals.data:this.empty),y=new Date().valueOf()-(h+d),console.log("[tropical] update elapsed: ",y,", total: ",d+=y)):(this.map.addSource(this.clusterSource,{type:"geojson",data:(s=this.tropicals)!=null&&s.active?(n=this.tropicals)==null?void 0:n.data:this.empty}),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","spd",["get","wind"]],17.2]],"#5eff02",["boolean",["<=",["get","spd",["get","wind"]],24.5]],"#f2da00",["boolean",["<=",["get","spd",["get","wind"]],32.7]],"#f27d00",["boolean",["<=",["get","spd",["get","wind"]],41.5]],"#f00000",["boolean",["<",["get","spd",["get","wind"]],51]],"#971d12",["boolean",[">=",["get","spd",["get","wind"]],51]],"#010101","#ffffff"]}}),this.map.addLayer({id:this.pointLabelLayer,type:"symbol",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","forecast"],["!=","disabled",!0]],layout:{"text-field":["get","format"],"text-offset":[0,-.5],"text-anchor":"bottom-left","text-size":14},paint:{"text-color":"#6e6e6e","text-halo-color":"#fff","text-halo-width":2}}),y=new Date().valueOf()-(h+d),console.log("[tropical] add elapsed: ",y,", total: ",d+=y)),(c=this.map)!=null&&c.getSource(this.circleSource)?(p=this.map)==null||p.getSource(this.circleSource).setData(this.circleSourceData):(this.map.addSource(this.circleSource,{type:"geojson",data:this.circleSourceData}),this.map.addLayer({id:this.circleLayer,type:"line",source:this.circleSource,filter:["all",["==","$type","Polygon"],["==","type","tropicalCircle"]],paint:{"line-color":"#fff","line-width":2,"line-opacity":1,"line-dasharray":[1,1]}}))}this.interpolateData=S.TropicalHelper.interpolate(this.tropicals,1),this.handleDateChange()}},handleClear(){var a;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.pointLabelLayer)&&this.map.removeLayer(this.pointLabelLayer),this.map.getLayer(this.interpolateLineLayer)&&this.map.removeLayer(this.interpolateLineLayer),(a=this.interpolateMarkers)==null||a.forEach(t=>t==null?void 0:t.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),this.map.getLayer(this.circleLayer)&&this.map.removeLayer(this.circleLayer),this.map.getSource(this.circleSource)&&this.map.removeSource(this.circleSource))},handleDateChange(){var a,t,o,l,r,i,s,n,c,p,h,d,y,m,u,f;if((a=this.interpolateMarkers)==null||a.forEach(g=>g==null?void 0:g.remove()),this.circleSourceData.features=[],(o=(t=this.map)==null?void 0:t.getSource(this.circleSource))==null||o.setData(this.circleSourceData),(l=this.interpolateData)!=null&&l.length&&this.tropicals.active){const g=N(this.date).utc().set({minute:0,second:0,millisecond:0}),w=this.interpolateData.filter(E=>E.properties.date===g.format()&&!E.properties.disabled),b=this.handleComputePolygons(w),v=x.featureCollection([...w]);b.forEach(E=>{v.features.push(E)}),(r=this.map)!=null&&r.getSource(this.interpolateSource)?(i=this.map)==null||i.getSource(this.interpolateSource).setData(v):((s=this.map)==null||s.addSource(this.interpolateSource,{type:"geojson",data:v}),(n=this.map)==null||n.addLayer({id:this.interpolateLineLayer,type:"line",source:this.interpolateSource,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"line-color":["match",["get","level"],7,"#34fa8a",10,"#f85c5c","#ffffff"],"line-width":1.3}})),this.interpolateMarkers=[];for(const E of w)if(!E.properties.disabled){const C=document.createElement("div");C.className="hurricane-hourly-marker",C.innerHTML=`
`;const V=new I.Marker(C).setLngLat(E.geometry.coordinates).addTo(this.map);if(this.interpolateMarkers.push(V),(c=E.properties)!=null&&c.showCircle){const T={radius:100,coordinates:E.geometry.coordinates},R={radius:200,coordinates:E.geometry.coordinates},A={radius:500,coordinates:E.geometry.coordinates};(p=this.circleSourceData)==null||p.features.push(x.circle(T.coordinates,T.radius,{steps:100,units:"kilometers",properties:{type:"tropicalCircle",distance:"100nm"}})),(h=this.circleSourceData)==null||h.features.push(x.circle(R.coordinates,R.radius,{steps:100,units:"kilometers",properties:{type:"tropicalCircle",distance:"200nm"}})),(d=this.circleSourceData)==null||d.features.push(x.circle(A.coordinates,A.radius,{steps:100,units:"kilometers",properties:{type:"tropicalCircle",distance:"500nm"}})),(m=(y=this.map)==null?void 0:y.getSource(this.circleSource))==null||m.setData(this.circleSourceData)}}}else(u=this.map)!=null&&u.getSource(this.interpolateSource)&&((f=this.map)==null||f.getSource(this.interpolateSource).setData(this.empty))},handleClick(a){var t,o,l,r,i,s,n,c;const p=a.features[0],h=(o=(t=this.tropicals)==null?void 0:t.data)==null?void 0:o.features.filter(m=>{var u;return m.geometry.type==="LineString"&&m.properties.type==="forecast"&&m.properties.name===((u=p==null?void 0:p.properties)==null?void 0:u.name)});h.sort((m,u)=>{var f,g,w,b;return((f=m.properties)==null?void 0:f.model)==="cma"?-1:((g=m.properties)==null?void 0:g.model)==="jma"?((w=u.properties)==null?void 0:w.model)==="cma"?1:-1:m.properties.model==="ecmwf"?["jma","cma"].includes((b=u.properties)==null?void 0:b.model)?1:-1:0});const d=(r=(l=this.tropicals)==null?void 0:l.data)==null?void 0:r.features.filter(m=>{var u;return m.geometry.type==="LineString"&&m.properties.type==="history"&&m.properties.name===((u=p==null?void 0:p.properties)==null?void 0:u.name)});this.activeTropicals={name:(i=p==null?void 0:p.properties)==null?void 0:i.name,forecasts:h.map(m=>m.properties),history:(s=d[0])==null?void 0:s.properties,showCircle:(c=(n=h[0])==null?void 0:n.properties)==null?void 0:c.showCircle},this.showTropicals=!0;const y=document.getElementById("active-tropical");this.activeTropicalsMarker?this.activeTropicalsMarker.setLngLat([a.lngLat.lng,a.lngLat.lat]):this.activeTropicalsMarker=new I.Marker(y).setLngLat([a.lngLat.lng,a.lngLat.lat]).setOffset([220,0]).addTo(this.map)},handleForecastToggle(a){var t,o,l,r,i,s;a.disabled=!a.disabled;const n=`${a.name}-${a.model}`,c=(o=(t=this.map)==null?void 0:t.getSource(this.source)._data)==null?void 0:o.features;c.forEach(p=>{p.properties.category===n&&(p.properties.disabled=a.disabled)}),this.interpolateData.forEach(p=>{p.properties.category===n&&(p.properties.disabled=a.disabled)}),(r=(l=this.map)==null?void 0:l.getSource(this.source))==null||r.setData(x.featureCollection(c)),(s=(i=this.map)==null?void 0:i.getSource(this.clusterSource))==null||s.setData(x.featureCollection(c)),this.handleDateChange()},handleToggleCircles(a){var t,o;a.showCircle=!a.showCircle,(o=(t=this.tropicals.data)==null?void 0:t.features)==null||o.forEach(l=>{l.properties.name===a.name&&(l.properties.showCircle=a.showCircle)}),this.handleRender()},handleStrikeProbability(a){this.$emit("tropical",a)},handleComputePolygons(a){const t=[];for(const o of a){const l=o.properties.wind,r={ne:l.r7ne>=0?l.r7ne:void 0,se:l.r7se>=0?l.r7se:void 0,sw:l.r7sw>=0?l.r7sw:void 0,nw:l.r7nw>=0?l.r7nw:void 0},i=this.handleComputeArc(o.geometry.coordinates,r,{...o.properties,level:7});t.push(i);const s={ne:l.r10ne>=0?l.r10ne:void 0,se:l.r10se>=0?l.r10se:void 0,sw:l.r10sw>=0?l.r10sw:void 0,nw:l.r10nw>=0?l.r10nw:void 0},n=this.handleComputeArc(o.geometry.coordinates,s,{...o.properties,level:10});t.push(n)}return t},handleComputeArc(a,t,o){var l;const r=[];for(const s in t){const n=t[s]??0;let c;switch(s){case"ne":c=x.lineArc(a,n*1.852,0,90,{steps:n>0?64:1});break;case"se":c=x.lineArc(a,n*1.852,90,180,{steps:n>0?64:1});break;case"sw":c=x.lineArc(a,n*1.852,180,270,{steps:n>0?64:1});break;case"nw":c=x.lineArc(a,n*1.852,270,360,{steps:n>0?64:1});break}r.push(...(l=c==null?void 0:c.geometry)==null?void 0:l.coordinates)}const i=x.lineString(r);return x.lineToPolygon(i,{properties:o})}}},ue=a=>(e.pushScopeId("data-v-d102a25c"),a=a(),e.popScopeId(),a),Wr={id:"active-tropical",class:"active-tropical"},Fr={class:"flex-start"},jr=ue(()=>e.createElementVNode("i",{class:"iconfont"},"",-1)),$r={class:"info"},Ur={class:"label"},Hr={class:"name"},Gr={class:"info flex"},Xr={class:"label"},Zr={class:"flex-space"},Yr={class:"flex-start"},qr=ue(()=>e.createElementVNode("i",{class:"iconfont"},"",-1)),Jr={class:"info"},Qr=ue(()=>e.createElementVNode("div",{class:"label"},"Wind speed",-1)),Kr={class:"number"},ei=ue(()=>e.createElementVNode("span",null,"kts",-1)),ti={class:"flex-start"},ai=ue(()=>e.createElementVNode("i",{class:"iconfont"},"",-1)),oi={class:"info"},ri=ue(()=>e.createElementVNode("div",{class:"label"},"Pressure",-1)),ii={class:"number"},li=ue(()=>e.createElementVNode("span",null,"hPa",-1)),si={class:"flex-space",style:{"border-bottom":"var(--idm-dashed-border)","padding-bottom":"10px","border-color":"var(--idm-white-9)"}},ni={class:"forecast-models flex-end"},ci=["onClick"],di=e.createStaticVNode('
TD
TS
STS
TY
STY
Super TY
',1),hi={class:"forecast-legends flex-space"},pi=e.createStaticVNode('
History
35kts Radii
50kts Radii
',3),mi={class:"legend"};function yi(a,t,o,l,r,i){var s,n,c,p,h,d,y,m,u,f,g,w,b,v;return e.withDirectives((e.openBlock(),e.createElementBlock("div",Wr,[e.createElementVNode("div",Fr,[jr,e.createElementVNode("div",$r,[e.createElementVNode("div",Ur,e.toDisplayString(((n=(s=r.activeTropicals)==null?void 0:s.history)==null?void 0:n.level)||"Unknown"),1),e.createElementVNode("div",Hr,e.toDisplayString((c=r.activeTropicals)==null?void 0:c.name),1)]),e.createElementVNode("div",Gr,[e.createElementVNode("div",Xr," Last update: "+e.toDisplayString(i.computeTime(((h=(p=r.activeTropicals)==null?void 0:p.history)==null?void 0:h.updated)||((m=(y=(d=r.activeTropicals)==null?void 0:d.forecasts)==null?void 0:y.filter(E=>!E.disabled)[0])==null?void 0:m.date))),1)])]),e.createElementVNode("div",Zr,[e.createElementVNode("div",Yr,[qr,e.createElementVNode("div",Jr,[Qr,e.createElementVNode("div",Kr,[e.createTextVNode(e.toDisplayString(((f=(u=r.activeTropicals)==null?void 0:u.history)==null?void 0:f.kts)||"-"),1),ei])])]),e.createElementVNode("div",ti,[ai,e.createElementVNode("div",oi,[ri,e.createElementVNode("div",ii,[e.createTextVNode(e.toDisplayString(((w=(g=r.activeTropicals)==null?void 0:g.history)==null?void 0:w.pressure)||"-"),1),li])])])]),e.createElementVNode("div",si,[e.createElementVNode("div",{class:e.normalizeClass(["circle",(b=r.activeTropicals)!=null&&b.showCircle?"active":""]),onClick:t[0]||(t[0]=E=>i.handleToggleCircles(r.activeTropicals))},"circle",2),e.createElementVNode("div",ni,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList((v=r.activeTropicals)==null?void 0:v.forecasts,(E,C)=>(e.openBlock(),e.createElementBlock("div",{key:C,class:e.normalizeClass(E.disabled?"model":"model active"),onClick:V=>i.handleForecastToggle(E)},[e.createElementVNode("span",{class:e.normalizeClass(E.model)},e.toDisplayString(E.model),3)],10,ci))),128))])]),di,e.createElementVNode("div",hi,[pi,e.createElementVNode("div",mi,[e.createElementVNode("div",{class:"button",onClick:t[1]||(t[1]=E=>i.handleStrikeProbability(r.activeTropicals))},"Strike Probability")])]),e.createElementVNode("div",{class:"close",onClick:t[2]||(t[2]=E=>r.showTropicals=!1)},"X")],512)),[[e.vShow,r.showTropicals]])}const gi=_(Or,[["render",yi],["__scopeId","data-v-d102a25c"]]),fi={name:"IdmPrecip3h",props:{factor:{type:Object},viewport:{type:Object},left:{type:String,default:"10px"},bottom:{type:String,default:"70px"}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new Y,etime:void 0}},watch:{"factor.version":{handler(){var a;(a=this.factor)!=null&&a.active?this.handleRender():this.handleClear()},deep:!0}},methods:{handleRender(){if(!this.viewport)setTimeout(()=>{this.handleRender()},500);else if(this.factor){const a=new Date().valueOf();let t=0,o=0;this.handleDraw(),o=new Date().valueOf()-(a+t),console.log("[precip3h] add elapsed: ",o,", total: ",t+=o)}},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 a=[[0,"rgba(59, 124, 162, 0)"],[14/255,"rgba(59, 126, 162, 0)"],[15/255,"rgba(59, 126, 162, 1)"],[20/255,"rgba(58, 137, 162, 1)"],[30/255,"rgba(58, 153, 162, 1)"],[49/255,"rgba(74, 164, 57, 0.8)"],[57/255,"rgba(129, 162, 59, 0.8)"],[73/255,"rgba(162, 60, 59, 0.9)"],[82/255,"rgba(171, 54, 107, 0.9)"],[1,"rgba(164, 58, 154, 1)"]];this.rampColor=this.webgl.setup(this.context,a);const{program:t,aPositionBuffer:o}=this.webgl.bind(this.context,B.vertexSchema,B.fragmentSchema);this.program=t,this.aPositionBuffer=o}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const a=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,a)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},ui=a=>(e.pushScopeId("data-v-ab67a7c5"),a=a(),e.popScopeId(),a),bi=ui(()=>e.createElementVNode("div",{class:"legend-bars flex-center"},[e.createElementVNode("span",null,"mm"),e.createElementVNode("span",null,"1.5"),e.createElementVNode("span",null,"2"),e.createElementVNode("span",null,"3"),e.createElementVNode("span",null,"7"),e.createElementVNode("span",null,"10"),e.createElementVNode("span",null,"20"),e.createElementVNode("span",null,"30")],-1)),wi=[bi];function Li(a,t,o,l,r,i){var s;return(s=o.factor)!=null&&s.active?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle([{position:"absolute"},{left:o.left,bottom:o.bottom}])},wi,4)):e.createCommentVNode("",!0)}const vi=_(fi,[["render",Li],["__scopeId","data-v-ab67a7c5"]]),xi={name:"IdmVisibility",props:{factor:{type:Object},viewport:{type:Object},left:{type:String,default:"10px"},bottom:{type:String,default:"70px"}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new Y,etime:void 0}},watch:{"factor.version":{handler(){var a;(a=this.factor)!=null&&a.active?this.handleRender():this.handleClear()},deep:!0}},methods:{handleRender(){if(!this.viewport)setTimeout(()=>{this.handleRender()},500);else if(this.factor){const a=new Date().valueOf();let t=0,o=0;this.handleDraw(),o=new Date().valueOf()-(a+t),console.log("[visibility] add elapsed: ",o,", total: ",t+=o)}},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 a=[[0,"rgba(164, 89, 164, 1)"],[8/255,"rgba(168, 86, 86, 1)"],[27/255,"rgba(89, 99, 164, 1)"],[60/255,"rgba(70, 180, 74, 1)"],[160/255,"rgba(91, 158, 85, 1)"],[161/255,"rgba(91, 158, 85, 0)"],[1,"rgba(76, 165, 228, 0)"]];this.rampColor=this.webgl.setup(this.context,a);const{program:t,aPositionBuffer:o}=this.webgl.bind(this.context,B.vertexSchema,B.fragmentSchema);this.program=t,this.aPositionBuffer=o}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const a=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,a)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},Ei=a=>(e.pushScopeId("data-v-a11080b9"),a=a(),e.popScopeId(),a),Ci=Ei(()=>e.createElementVNode("div",{class:"legend-bars flex-center"},[e.createElementVNode("span",null,"nm"),e.createElementVNode("span",null,"0.5"),e.createElementVNode("span",null,"1.5"),e.createElementVNode("span",null,"3"),e.createElementVNode("span",null,"9")],-1)),Si=[Ci];function _i(a,t,o,l,r,i){var s;return(s=o.factor)!=null&&s.active?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle([{position:"absolute"},{left:o.left,bottom:o.bottom}])},Si,4)):e.createCommentVNode("",!0)}const ki=_(xi,[["render",_i],["__scopeId","data-v-a11080b9"]]),Ni={name:"IdmWaterTemp",props:{factor:{type:Object},viewport:{type:Object},left:{type:String,default:"10px"},bottom:{type:String,default:"70px"}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new Y,etime:void 0}},watch:{"factor.version":{handler(){var a;(a=this.factor)!=null&&a.active?this.handleRender():this.handleClear()},deep:!0}},methods:{handleRender(){if(!this.viewport)setTimeout(()=>{this.handleRender()},500);else if(this.factor){const a=new Date().valueOf();let t=0,o=0;this.handleDraw(),o=new Date().valueOf()-(a+t),console.log("[water-temp] add elapsed: ",o,", total: ",t+=o)}},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 a=[[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,a);const{program:t,aPositionBuffer:o}=this.webgl.bind(this.context,B.vertexSchema,B.fragmentSchema);this.program=t,this.aPositionBuffer=o}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const a=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,a)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},Vi=a=>(e.pushScopeId("data-v-ade9d0c1"),a=a(),e.popScopeId(),a),Ti=Vi(()=>e.createElementVNode("div",{class:"legend-bars flex-center"},[e.createElementVNode("span",null,"°C"),e.createElementVNode("span",null,"0"),e.createElementVNode("span",null,"10"),e.createElementVNode("span",null,"20"),e.createElementVNode("span",null,"30"),e.createElementVNode("span",null,"40")],-1)),Di=[Ti];function Pi(a,t,o,l,r,i){var s;return(s=o.factor)!=null&&s.active?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle([{position:"absolute"},{left:o.left,bottom:o.bottom}])},Di,4)):e.createCommentVNode("",!0)}const Bi=_(Ni,[["render",Pi],["__scopeId","data-v-ade9d0c1"]]),Ri={name:"IdmTemp",props:{factor:{type:Object},viewport:{type:Object},left:{type:String,default:"10px"},bottom:{type:String,default:"70px"}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new Y,etime:void 0}},watch:{"factor.version":{handler(){var a;(a=this.factor)!=null&&a.active?this.handleRender():this.handleClear()},deep:!0}},methods:{handleRender(){if(!this.viewport)setTimeout(()=>{this.handleRender()},500);else if(this.factor){const a=new Date().valueOf();let t=0,o=0;this.handleDraw(),o=new Date().valueOf()-(a+t),console.log("[water-temp] add elapsed: ",o,", total: ",t+=o)}},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 a=[[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,a);const{program:t,aPositionBuffer:o}=this.webgl.bind(this.context,B.vertexSchema,B.fragmentSchema);this.program=t,this.aPositionBuffer=o}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const a=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,a)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},Ii=a=>(e.pushScopeId("data-v-6f7b1b8e"),a=a(),e.popScopeId(),a),Mi=Ii(()=>e.createElementVNode("div",{class:"legend-bars flex-center"},[e.createElementVNode("span",null,"°C"),e.createElementVNode("span",null,"-20"),e.createElementVNode("span",null,"-10"),e.createElementVNode("span",null,"0"),e.createElementVNode("span",null,"10"),e.createElementVNode("span",null,"20"),e.createElementVNode("span",null,"30"),e.createElementVNode("span",null,"40")],-1)),Ai=[Mi];function zi(a,t,o,l,r,i){var s;return(s=o.factor)!=null&&s.active?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle([{position:"absolute"},{left:o.left,bottom:o.bottom}])},Ai,4)):e.createCommentVNode("",!0)}const Oi=_(Ri,[["render",zi],["__scopeId","data-v-6f7b1b8e"]]),Wi={name:"IdmArctic",props:{factor:{type:Object},viewport:{type:Object},left:{type:String,default:"10px"},bottom:{type:String,default:"70px"}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new Y,etime:void 0}},watch:{"factor.version":{handler(){var a;(a=this.factor)!=null&&a.active?this.handleRender():this.handleClear()},deep:!0}},methods:{handleRender(){if(!this.viewport)setTimeout(()=>{this.handleRender()},500);else if(this.factor){const a=new Date().valueOf();let t=0,o=0;this.handleDraw(),o=new Date().valueOf()-(a+t),console.log("[water-temp] add elapsed: ",o,", total: ",t+=o)}},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 a=[[0,"rgba(76, 165, 228, 0)"],[50/255,"rgba(76, 165, 228, 0)"],[51/255,"rgb(76, 165, 228)"],[102/255,"rgb(129, 204, 197)"],[153/255,"rgb(150, 209, 216)"],[204/255,"rgb(180, 209, 216)"],[1,"rgb(180, 209, 216)"]];this.rampColor=this.webgl.setup(this.context,a);const{program:t,aPositionBuffer:o}=this.webgl.bind(this.context,B.vertexSchema,B.fragmentSchema);this.program=t,this.aPositionBuffer=o}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const a=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,a)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},Fi=a=>(e.pushScopeId("data-v-471e6a5a"),a=a(),e.popScopeId(),a),ji=Fi(()=>e.createElementVNode("div",{class:"legend-bars flex-center"},[e.createElementVNode("span",null,"m"),e.createElementVNode("span",null,"0"),e.createElementVNode("span",null,"0.5"),e.createElementVNode("span",null,"1"),e.createElementVNode("span",null,"1.5"),e.createElementVNode("span",null,"2")],-1)),$i=[ji];function Ui(a,t,o,l,r,i){var s;return(s=o.factor)!=null&&s.active?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle([{position:"absolute"},{left:o.left,bottom:o.bottom}])},$i,4)):e.createCommentVNode("",!0)}const Hi=_(Wi,[["render",Ui],["__scopeId","data-v-471e6a5a"]]),Gi={name:"IdmPoint",emits:["point","more"],props:{map:{type:Object},show:{type:Boolean},meteo:{type:Object}},data(){return{showMeteo:!1,meteoMarker:void 0,helper:P.CompanyHelper}},watch:{show:{handler(){this.handleBind()},immediate:!0},map:{handler(){this.map&&this.show&&this.handleBind()}},meteo:{handler(){this.meteo?(this.showMeteo=!0,this.handleRender()):this.showMeteo=!1}}},computed:{computeTime(){return function(a){return a?`${N(a).utc().format("MMM-DD,HHmm[Z]")}`:"-"}},computeLat(){return function(a,t=4){return S.LngLatHelper.lat2pretty(a,t).pretty}},computeLng(){return function(a,t=4){return S.LngLatHelper.lng2pretty(a,t).pretty}},roundPrecision(){return function(a,t=4){return isNaN(a)?"-":S.LngLatHelper.roundPrecision(a,t)}}},methods:{handleBind(){var a,t;this.show?(a=this.map)==null||a.on("click",this.handleClick):((t=this.map)==null||t.off("click",this.handleClick),this.showMeteo=!1)},handleClick(a){a.originalEvent.stopPropagation();const t=a.originalEvent.target.className;t==="close"?this.showMeteo=!1:t==="more"?this.$emit("more",this.meteo):this.$emit("point",a.lngLat)},handleRender(){var a;if(this.meteo){const t=document.getElementById("point-meteo");this.meteoMarker?(a=this.meteoMarker)==null||a.setLngLat([this.meteo.lng,this.meteo.lat]):this.meteoMarker=new I.Marker(t).setLngLat([this.meteo.lng,this.meteo.lat]).addTo(this.map)}}}},W=a=>(e.pushScopeId("data-v-d7ceb1b9"),a=a(),e.popScopeId(),a),Xi={id:"point-meteo",class:"point-meteo"},Zi={class:"meteo-box"},Yi=W(()=>e.createElementVNode("div",{class:"close"},"X",-1)),qi={class:"flex-space"},Ji=W(()=>e.createElementVNode("label",null,"Date Time",-1)),Qi={class:"flex-space"},Ki=W(()=>e.createElementVNode("label",null,"Position",-1)),el={class:"flex-space"},tl=W(()=>e.createElementVNode("label",null,"Wind",-1)),al={class:"flex-space"},ol=W(()=>e.createElementVNode("label",null,"Wind.Wave",-1)),rl={class:"flex-space"},il=W(()=>e.createElementVNode("label",null,"Swell",-1)),ll={class:"flex-space"},sl=W(()=>e.createElementVNode("label",null,"Sig.Wave",-1)),nl={class:"flex-space"},cl=W(()=>e.createElementVNode("label",null,"Current",-1)),dl={class:"flex-space"},hl=W(()=>e.createElementVNode("label",null,"Precip",-1)),pl={class:"flex-space"},ml=W(()=>e.createElementVNode("label",null,"Visibility",-1)),yl={class:"flex-space"},gl=W(()=>e.createElementVNode("label",null,"Temp",-1)),fl={class:"flex-space"},ul=W(()=>e.createElementVNode("label",null,"Water Temp",-1)),bl={key:0,class:"flex-space",style:{"justify-content":"flex-end"}},wl=W(()=>e.createElementVNode("span",{class:"more"},"More >>>",-1)),Ll=[wl];function vl(a,t,o,l,r,i){var s,n,c,p,h,d,y,m,u,f,g,w,b,v,E,C,V,T,R,A,O,F,q,J,Q,K,ee,te,ae,oe,re,ie,le,se,ne,ce,de,he,pe,me,ye,ge,be,we,Le,ve,xe;return e.withDirectives((e.openBlock(),e.createElementBlock("div",Xi,[e.createElementVNode("div",Zi,[Yi,e.createElementVNode("div",qi,[Ji,e.createElementVNode("span",null,e.toDisplayString(i.computeTime((s=o.meteo)==null?void 0:s.utc)),1)]),e.createElementVNode("div",Qi,[Ki,e.createElementVNode("span",null,e.toDisplayString(i.computeLat((n=o.meteo)==null?void 0:n.lat))+","+e.toDisplayString(i.computeLng((c=o.meteo)==null?void 0:c.lng)),1)]),e.createElementVNode("div",el,[tl,e.createElementVNode("span",null,e.toDisplayString(((h=(p=o.meteo)==null?void 0:p.wind)==null?void 0:h.direction)||"-")+"/"+e.toDisplayString(i.roundPrecision((y=(d=o.meteo)==null?void 0:d.wind)==null?void 0:y.kts,1))+"[kts]/"+e.toDisplayString((u=(m=o.meteo)==null?void 0:m.wind)==null?void 0:u.scale)+"[BF]/"+e.toDisplayString(i.roundPrecision((g=(f=o.meteo)==null?void 0:f.gusts)==null?void 0:g.kts,1))+"[kts]",1)]),e.createElementVNode("div",al,[ol,e.createElementVNode("span",null,e.toDisplayString(((v=(b=(w=o.meteo)==null?void 0:w.wave)==null?void 0:b.wd)==null?void 0:v.direction)||"-")+"/"+e.toDisplayString(i.roundPrecision((V=(C=(E=o.meteo)==null?void 0:E.wave)==null?void 0:C.wd)==null?void 0:V.height,1))+"[m]/"+e.toDisplayString(i.roundPrecision((A=(R=(T=o.meteo)==null?void 0:T.wave)==null?void 0:R.wd)==null?void 0:A.period,1))+"[s]",1)]),e.createElementVNode("div",rl,[il,e.createElementVNode("span",null,e.toDisplayString(((q=(F=(O=o.meteo)==null?void 0:O.wave)==null?void 0:F.swell)==null?void 0:q.direction)||"-")+"/"+e.toDisplayString(i.roundPrecision((K=(Q=(J=o.meteo)==null?void 0:J.wave)==null?void 0:Q.swell)==null?void 0:K.height,1))+"[m]/"+e.toDisplayString(i.roundPrecision((ae=(te=(ee=o.meteo)==null?void 0:ee.wave)==null?void 0:te.swell)==null?void 0:ae.period,1))+"[s]",1)]),e.createElementVNode("div",ll,[sl,e.createElementVNode("span",null,e.toDisplayString(((ie=(re=(oe=o.meteo)==null?void 0:oe.wave)==null?void 0:re.sig)==null?void 0:ie.direction)||"-")+"/"+e.toDisplayString(i.roundPrecision((ne=(se=(le=o.meteo)==null?void 0:le.wave)==null?void 0:se.sig)==null?void 0:ne.height,1))+"[m]/"+e.toDisplayString(i.roundPrecision((he=(de=(ce=o.meteo)==null?void 0:ce.wave)==null?void 0:de.sig)==null?void 0:he.period,1))+"[s]",1)]),e.createElementVNode("div",nl,[cl,e.createElementVNode("span",null,e.toDisplayString(((me=(pe=o.meteo)==null?void 0:pe.current)==null?void 0:me.direction)||"-")+"/"+e.toDisplayString(i.roundPrecision((ge=(ye=o.meteo)==null?void 0:ye.current)==null?void 0:ge.kts,2))+"[kts]",1)]),e.createElementVNode("div",dl,[hl,e.createElementVNode("span",null,e.toDisplayString(i.roundPrecision((we=(be=o.meteo)==null?void 0:be.precip)==null?void 0:we.inter6h,2))+"[mm]",1)]),e.createElementVNode("div",pl,[ml,e.createElementVNode("span",null,e.toDisplayString(i.roundPrecision(((Le=o.meteo)==null?void 0:Le.visibility)/1852,0))+"[nm]",1)]),e.createElementVNode("div",yl,[gl,e.createElementVNode("span",null,e.toDisplayString(i.roundPrecision((ve=o.meteo)==null?void 0:ve.temp,0))+"[°C]",1)]),e.createElementVNode("div",fl,[ul,e.createElementVNode("span",null,e.toDisplayString(i.roundPrecision((xe=o.meteo)==null?void 0:xe.waterTemp,2))+"[°C]",1)]),a.$attrs.permission&r.helper.LEVEL.Prime?(e.openBlock(),e.createElementBlock("div",bl,Ll)):e.createCommentVNode("",!0)])],512)),[[e.vShow,r.showMeteo]])}const xl=_(Gi,[["render",vl],["__scopeId","data-v-d7ceb1b9"]]),El={name:"IdmWarZone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},data(){return{source:"war-zone-source",zoneLayer:"war-zone-layer",zoneLabelLayer:"war-zone-label-layer"}},watch:{zone:{handler(){this.handleRender()}}},methods:{handleRender(){this.map?(this.handleClear(),this.zone&&(this.map.addSource(this.source,{type:"geojson",data:this.zone}),this.map.addLayer({id:this.zoneLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-opacity":.5,"fill-color":["match",["get","val"],"PiracyArea","#DF2CF3","ConvoyArea","#FFFF00","JWCriskArea","#DF2CF3","#ffffff"]}},this.beforeLayer),this.map.addLayer({id:this.zoneLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-size":.3,"icon-image":"{icon}","text-anchor":"left","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":12,"text-offset":[0,1]},paint:{"text-opacity":.8,"text-color":"#fff"}}))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.zoneLayer)&&this.map.removeLayer(this.zoneLayer),this.map.getLayer(this.zoneLabelLayer)&&this.map.removeLayer(this.zoneLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Cl(a,t,o,l,r,i){return e.openBlock(),e.createElementBlock("div")}const Sl=_(El,[["render",Cl]]),_l={name:"IdmGmdssArea",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},data(){return{source:"gmdss-area-source",areaLayer:"gmdss-area-layer",areaLabelLayer:"gmdss-area-label-layer"}},watch:{area:{handler(){this.handleRender()}}},methods:{handleRender(){this.map?(this.handleClear(),this.area&&(this.map.addSource(this.source,{type:"geojson",data:this.area}),this.map.addLayer({id:this.areaLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-opacity":.5,"fill-color":["match",["get","val"],"AreaI","#EB8996","AreaII","#6F448B","AreaIII","#3E8BD3","AreaIV","#5EBCC4","AreaV","#00AAE7","AreaVI","#9CCE6D","AreaVII","#F4AE00","AreaVIII","#EF9A85","AreaIX","#00AAA7","AreaX","#7AC49F","AreaXI","#DFDFDF","AreaXII","#FFF974","AreaXIII","#EF9A85","AreaXIV","#86A2D1","AreaXV","#EC8972","AreaXVI","#EAC2DA","AreaXVII","#B9C8E7","AreaXVIII","#BBA1C8","AreaXIX","#FAE0BD","AreaXX","#DBECC8","AreaXXI","#D496AF","#ffffff"]}},this.beforeLayer),this.map.addLayer({id:this.areaLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-size":.3,"icon-image":"{icon}","text-anchor":"left","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":12,"text-offset":[0,1]},paint:{"text-opacity":.8,"text-color":"#003399"}}))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.areaLayer)&&this.map.removeLayer(this.areaLayer),this.map.getLayer(this.areaLabelLayer)&&this.map.removeLayer(this.areaLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function kl(a,t,o,l,r,i){return e.openBlock(),e.createElementBlock("div")}const Nl=_(_l,[["render",kl]]),Vl={name:"IdmEcaZone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},data(){return{source:"eca-zone-source",zoneLayer:"eca-zone-layer",zoneLabelLayer:"eca-zone-label-layer"}},watch:{zone:{handler(){this.zone?this.handleRender():this.handleClear()}}},methods:{handleRender(){var a;this.map?(this.handleClear(),this.zone&&(this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(this.zone):(this.map.addSource(this.source,{type:"geojson",data:this.zone}),this.map.addLayer({id:this.zoneLayer,type:"fill",source:this.source,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"fill-outline-color":"silver","fill-opacity":.5,"fill-color":"#1CD537"}}),this.map.addLayer({id:this.zoneLabelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":.3,"icon-image":"{icon}","text-anchor":"left","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":12,"text-offset":[0,1]},paint:{"text-opacity":.8}})))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.zoneLayer)&&this.map.removeLayer(this.zoneLayer),this.map.getLayer(this.zoneLabelLayer)&&this.map.removeLayer(this.zoneLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Tl(a,t,o,l,r,i){return e.openBlock(),e.createElementBlock("div")}const Dl=_(Vl,[["render",Tl]]),Pl={name:"IdmAlertZone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},data(){return{source:"alert-zone-source",polygonLayer:"alert-zone-polygon-layer",polygonLabelLayer:"alert-zone-polygon-label-layer",lineLayer:"alert-zone-line-layer",lineLabelLayer:"alert-zone-line-label-layer",pointLayer:"alert-zone-point-layer",showZone:!1,form:{}}},watch:{zone:{handler(){var a,t;this.zone?(this.handleRender(),(a=this.map)==null||a.on("click",[this.polygonLabelLayer,this.lineLabelLayer,this.pointLayer],this.handleClick)):(this.handleClear(),(t=this.map)==null||t.off("click",[this.polygonLabelLayer,this.lineLabelLayer,this.pointLayer],this.handleClick))}}},methods:{handleClick(a){var t;const o=a.features[0],l=(t=this.zone)==null?void 0:t.features.filter(r=>{var i;return r.properties.id===((i=o==null?void 0:o.properties)==null?void 0:i.id)})[0];if(l){this.showZone=!0,this.form={...l.properties},console.log("[alert zone] ",this.form);const r=document.getElementById("zone-info");this.marker?this.marker.setLngLat([a.lngLat.lng,a.lngLat.lat]):this.marker=new I.Marker(r).setLngLat([a.lngLat.lng,a.lngLat.lat]).setOffset([0,0]).addTo(this.map)}},handleRender(){var a;this.map?(this.handleClear(),this.zone&&(this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(this.zone):(this.map.addSource(this.source,{type:"geojson",data:this.zone}),this.map.addLayer({id:this.polygonLayer,type:"fill",source:this.source,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"fill-outline-color":"#ffa046","fill-opacity":.5,"fill-color":"#c2ccb8"}}),this.map.addLayer({id:this.polygonLabelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-image":"alert","icon-size":1,"icon-allow-overlap":!0,"icon-rotation-alignment":"viewport"}}),this.map.addLayer({id:this.lineLayer,type:"line",source:this.source,filter:["all",["==","$type","LineString"],["!=","disabled",!0]],paint:{"line-color":"#ffa046","line-width":2}}),this.map.addLayer({id:this.lineLabelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","LineString"],["!=","disabled",!0]],layout:{"symbol-placement":"line-center","icon-image":"alert","icon-size":1,"icon-allow-overlap":!0,"icon-rotation-alignment":"viewport"}}),this.map.addLayer({id:this.pointLayer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-image":"alert","icon-size":1}})))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.polygonLayer)&&this.map.removeLayer(this.polygonLayer),this.map.getLayer(this.polygonLabelLayer)&&this.map.removeLayer(this.polygonLabelLayer),this.map.getLayer(this.lineLayer)&&this.map.removeLayer(this.lineLayer),this.map.getLayer(this.lineLabelLayer)&&this.map.removeLayer(this.lineLabelLayer),this.map.getLayer(this.pointLayer)&&this.map.removeLayer(this.pointLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}},Bl={id:"zone-info"},Rl=["innerHTML"];function Il(a,t,o,l,r,i){var s;return e.withDirectives((e.openBlock(),e.createElementBlock("div",Bl,[e.createElementVNode("div",{class:"close",onClick:t[0]||(t[0]=n=>r.showZone=!1)},"X"),e.createElementVNode("div",{class:"rich-context",innerHTML:(s=r.form)==null?void 0:s.name},null,8,Rl)],512)),[[e.vShow,r.showZone]])}const Ml=_(Pl,[["render",Il],["__scopeId","data-v-9ad7e59d"]]),Al={name:"IdmPort",emits:["port"],props:{map:{type:Object},port:{type:Object},beforeLayer:{type:String}},data(){return{source:"port-source",layer:"port-layer",showPort:!1,form:{},marker:void 0}},watch:{port:{handler(){var a,t;this.port?(this.handleRender(),(a=this.map)==null||a.on("click",[this.layer],this.handleClick)):(this.handleClear(),(t=this.map)==null||t.off("click",[this.layer],this.handleClick))}}},computed:{computeLat(){return function(a){return S.LngLatHelper.lat2pretty(a,4).pretty}},computeLng(){return function(a){return S.LngLatHelper.lng2pretty(a,4).pretty}}},methods:{handleClick(a){var t;const o=a.features[0],l=(t=this.port)==null?void 0:t.features.filter(r=>{var i;return r.properties.id===((i=o==null?void 0:o.properties)==null?void 0:i.id)})[0];if(l){this.showPort=!0,this.form={...l.properties},this.form.lng=l.geometry.coordinates[0],this.form.lat=l.geometry.coordinates[1];const r=document.getElementById("port-info");this.marker?this.marker.setLngLat([a.lngLat.lng,a.lngLat.lat]):this.marker=new I.Marker(r).setLngLat([a.lngLat.lng,a.lngLat.lat]).setOffset([0,0]).addTo(this.map)}},handleEmit(){this.$emit("port",this.form)},handleRender(){var a;this.map?this.port&&(this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(this.port):(this.map.addSource(this.source,{type:"geojson",data:this.port}),this.map.addLayer({id:this.layer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":.3,"icon-image":"port","text-anchor":"left","text-field":"{name}","text-rotation-alignment":"viewport","text-size":13,"text-offset":[1,0]},paint:{"text-opacity":.8,"text-color":"#000","text-halo-color":"#fff","text-halo-width":2,"text-halo-blur":1}}))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.showPort=!1,this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}},Ee=a=>(e.pushScopeId("data-v-837eb38a"),a=a(),e.popScopeId(),a),zl={id:"port-info"},Ol={class:"port-box"},Wl={class:"flex-space"},Fl=Ee(()=>e.createElementVNode("label",null,"Name",-1)),jl={class:"flex-space"},$l=Ee(()=>e.createElementVNode("label",null,"Position",-1)),Ul={class:"flex-space"},Hl=Ee(()=>e.createElementVNode("label",null,"LoCode",-1)),Gl={class:"flex-space"},Xl=Ee(()=>e.createElementVNode("label",null,"Region",-1));function Zl(a,t,o,l,r,i){return e.withDirectives((e.openBlock(),e.createElementBlock("div",zl,[e.createElementVNode("div",{class:"close",onClick:t[0]||(t[0]=s=>r.showPort=!1)},"X"),e.createElementVNode("div",Ol,[e.createElementVNode("div",Wl,[Fl,e.createElementVNode("span",{class:"link",onClick:t[1]||(t[1]=(...s)=>i.handleEmit&&i.handleEmit(...s))},e.toDisplayString(r.form.name),1)]),e.createElementVNode("div",jl,[$l,e.createElementVNode("span",null,e.toDisplayString(i.computeLat(r.form.lat))+", "+e.toDisplayString(i.computeLng(r.form.lng)),1)]),e.createElementVNode("div",Ul,[Hl,e.createElementVNode("span",null,e.toDisplayString(r.form.loCode||"-"),1)]),e.createElementVNode("div",Gl,[Xl,e.createElementVNode("span",null,e.toDisplayString(r.form.city||"-")+", "+e.toDisplayString(r.form.country||"-"),1)])])],512)),[[e.vShow,r.showPort]])}const Yl=_(Al,[["render",Zl],["__scopeId","data-v-837eb38a"]]),ql={name:"IdmLoadLine",props:{map:{type:Object},line:{type:Object},beforeLayer:{type:String}},data(){return{source:"load-line-source",lineLayer:"load-line-layer",lineLabelLayer:"load-line-label-layer"}},watch:{line:{handler(){this.handleRender()}}},methods:{handleRender(){this.map?(this.handleClear(),this.line&&(this.map.addSource(this.source,{type:"geojson",data:this.line}),this.map.addLayer({id:this.lineLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-opacity":.75,"fill-color":["match",["get","val"],"LLGreen","#A0C0C0","LLRed","#F5A39D","LLBlue","#6B94E4","#ffffff"]}},this.beforeLayer),this.map.addLayer({id:this.lineLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","text-field":"{lbl} (Length < {shipLength}, {start} - {end})","text-rotation-alignment":"viewport","text-offset":[0,1],"text-size":10,"text-allow-overlap":!0},paint:{"text-opacity":.8}}))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.lineLayer)&&this.map.removeLayer(this.lineLayer),this.map.getLayer(this.lineLabelLayer)&&this.map.removeLayer(this.lineLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Jl(a,t,o,l,r,i){return e.openBlock(),e.createElementBlock("div")}const Ql=_(ql,[["render",Jl]]),Kl={name:"IdmTimezone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},data(){return{source:"time-zone-source",zoneLayer:"time-zone-layer",zoneLabelLayer:"time-zone-label-layer"}},watch:{zone:{handler(){this.handleRender()}}},methods:{handleRender(){this.map?(this.handleClear(),this.zone&&(this.map.addSource(this.source,{type:"geojson",data:this.zone}),this.map.addLayer({id:this.zoneLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-opacity":.5,"fill-color":["match",["get","offSet"],"-11.5","rgba(255,0,0,0.4)","-11","rgba(0,255,0,0.3)","-10.5","rgba(0,255,0,0.3)","-10","rgba(0,0,255,0.3)","-9.5","rgba(0,0,255,0.3)","-9","rgba(255,0,0,0.4)","-8.5","rgba(255,0,0,0.4)","-8","rgba(0,255,0,0.3)","-7.5","rgba(0,255,0,0.3)","-7","rgba(0,0,255,0.3)","-6.5","rgba(0,0,255,0.3)","-6","rgba(255,0,0,0.4)","-5.5","rgba(255,0,0,0.4)","-5","rgba(0,255,0,0.3)","-4.5","rgba(0,255,0,0.3)","-4","rgba(0,0,255,0.3)","-3.5","rgba(0,0,255,0.3)","-3","rgba(255,0,0,0.4)","-2.5","rgba(255,0,0,0.4)","-2","rgba(0,255,0,0.3)","-1.5","rgba(0,255,0,0.3)","-1","rgba(0,0,255,0.3)","-0.5","rgba(0,0,255,0.3)","+0","rgba(255,0,0,0.4)","+0.5","rgba(255,0,0,0.4)","+1","rgba(0,255,0,0.3)","+1.5","rgba(0,255,0,0.3)","+2","rgba(0,0,255,0.3)","+2.5","rgba(0,0,255,0.3)","+3","rgba(255,0,0,0.4)","+3.5","rgba(255,0,0,0.4)","+4","rgba(0,255,0,0.3)","+4.5","rgba(0,255,0,0.3)","+5","rgba(0,0,255,0.3)","+5.5","rgba(0,0,255,0.3)","+6","rgba(255,0,0,0.4)","+6.5","rgba(255,0,0,0.4)","+7","rgba(0,255,0,0.3)","+7.5","rgba(0,255,0,0.3)","+8","rgba(0,0,255,0.3)","+8.5","rgba(0,0,255,0.3)","+9","rgba(255,0,0,0.4)","+9.5","rgba(255,0,0,0.4)","+10","rgba(0,255,0,0.3)","+10.5","rgba(0,255,0,0.3)","+11","rgba(0,0,255,0.3)","+11.5","rgba(0,0,255,0.3)","rgba(255,0,0,0.4)"]}}),this.map.addLayer({id:this.zoneLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","text-field":"{offSet}","text-rotation-alignment":"viewport","text-size":12,"text-offset":[0,1]},paint:{"text-opacity":.8,"text-color":"#fff"}}))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.zoneLayer)&&this.map.removeLayer(this.zoneLayer),this.map.getLayer(this.zoneLabelLayer)&&this.map.removeLayer(this.zoneLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function es(a,t,o,l,r,i){return e.openBlock(),e.createElementBlock("div")}const ts=_(Kl,[["render",es]]),as={name:"IdmVoluntaryReportingArea",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},data(){return{source:"vra-source",areaLayer:"vra-layer",areaLabelLayer:"vra-label-layer"}},watch:{area:{handler(){this.handleRender()}}},methods:{handleRender(){this.map?(this.handleClear(),this.area&&(this.map.addSource(this.source,{type:"geojson",data:this.area}),this.map.addLayer({id:this.areaLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-opacity":.5,"fill-color":"#9ec3ba"}},this.beforeLayer),this.map.addLayer({id:this.areaLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-size":.3,"icon-image":"{icon}","text-anchor":"left","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":12,"text-offset":[1,0]},paint:{"text-opacity":.8,"text-color":"#000"}}))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.areaLayer)&&this.map.removeLayer(this.areaLayer),this.map.getLayer(this.areaLabelLayer)&&this.map.removeLayer(this.areaLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function os(a,t,o,l,r,i){return e.openBlock(),e.createElementBlock("div")}const rs=_(as,[["render",os]]),is={name:"IdmSpecialArea",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},data(){return{source:"special-area-source",areaLayer:"special-area-layer",areaLabelLayer:"special-area-label-layer"}},watch:{area:{handler(){this.handleRender()}}},methods:{handleRender(){this.map?(this.handleClear(),this.area&&(this.area.features.forEach(a=>{a.geometry.type==="Polygon"&&a.geometry.coordinates.forEach(t=>S.LngLatHelper.convertToMonotonicLng2(t))}),this.map.addSource(this.source,{type:"geojson",data:this.area}),this.map.addLayer({id:this.areaLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-opacity":.5,"fill-color":["match",["get","val"],"DefaultStyle","#CA7C7C","JWCriskArea","#CA7C7C","#ffffff"]}},this.beforeLayer),this.map.addLayer({id:this.areaLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-size":.3,"icon-image":"{icon}","text-anchor":"left","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":12,"text-offset":[1,0]},paint:{"text-opacity":.8,"text-color":"#000"}}))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.areaLayer)&&this.map.removeLayer(this.areaLayer),this.map.getLayer(this.areaLabelLayer)&&this.map.removeLayer(this.areaLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function ls(a,t,o,l,r,i){return e.openBlock(),e.createElementBlock("div")}const ss=_(is,[["render",ls]]),ns={name:"IdmTerminator",props:{map:{type:Object},area:{type:Object}},data(){return{source:"terminator-source",layer:"terminator-layer"}},watch:{area:{handler(){this.handleRender()}}},methods:{handleRender(){this.map?(this.handleClear(),this.area&&(this.map.addSource(this.source,{type:"geojson",data:this.area}),this.map.addLayer({id:this.layer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-opacity":.5,"fill-color":"rgba(0, 0, 0, 0.4)"}}))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function cs(a,t,o,l,r,i){return e.openBlock(),e.createElementBlock("div")}const ds=_(ns,[["render",cs]]),hs={name:"IdmLatLng",props:{map:{type:Object},show:{type:Boolean},left:{type:String,default:"10px"},bottom:{type:String,default:"70px"}},data(){return{lngLat:void 0,source:"idm-lat-lng-source",layer:"idm-lat-lng-layer",labelLayer:"idm-lat-lng-label-layer"}},watch:{show:{handler(){this.handleBind()},immediate:!0},map:{handler(){var a;this.map&&((a=this.map)==null||a.on("mousemove",this.handleMouseMove))},immediate:!0}},methods:{handleBind(){var a,t;this.show?((a=this.map)==null||a.on("zoomend",this.handleZoomEnd),this.handleRender()):(this.handleClear(),(t=this.map)==null||t.off("zoomend",this.handleZoomEnd))},handleMouseMove(a){const t=a.lngLat,o=S.LngLatHelper.lng2pretty(t.lng,2),l=S.LngLatHelper.lat2pretty(t.lat,2);this.lngLat={lng:o,lat:l}},handleComputeLatLngs(){var a;const t=(a=this.map)==null?void 0:a.getZoom();console.log(t);let o=30;t>4?o=10:t>3&&(o=15);const l=[];for(let r=-60;r<90;r+=o)l.push({type:"Feature",geometry:{type:"LineString",coordinates:[[-180,r],[180,r]]}});for(let r=-180;r<180;r+=o)l.push({type:"Feature",geometry:{type:"LineString",coordinates:[[r,-90],[r,90]]}});for(let r=180;r>-180;r-=o)for(let i=-60;i<90;i+=o)l.push({type:"Feature",geometry:{type:"Point",coordinates:[r,i]},properties:{val:`${i>0?i+" N":i===0?i:i*-1+" S"}, ${r>0?r+" E":r*-1+" W"}`}});return l},handleZoomEnd(){var a;const t=this.handleComputeLatLngs();(a=this.map)==null||a.getSource(this.source).setData(x.featureCollection(t))},handleRender(){if(this.map){const a=this.handleComputeLatLngs();this.map.addSource(this.source,{type:"geojson",data:{type:"FeatureCollection",features:a}}),this.map.addLayer({id:this.layer,type:"line",source:this.source,filter:["==","$type","LineString"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"rgba(0, 0, 0, 0.3)","line-width":1}}),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":.8}})}},handleClear(){var a,t,o,l,r,i;(a=this.map)!=null&&a.getLayer(this.layer)&&((t=this.map)==null||t.removeLayer(this.layer)),(o=this.map)!=null&&o.getLayer(this.labelLayer)&&((l=this.map)==null||l.removeLayer(this.labelLayer)),(r=this.map)!=null&&r.getSource(this.source)&&((i=this.map)==null||i.removeSource(this.source))}}},ps=a=>(e.pushScopeId("data-v-9bd85ade"),a=a(),e.popScopeId(),a),ms=ps(()=>e.createElementVNode("span",null,", ",-1));function ys(a,t,o,l,r,i){return r.lngLat?(e.openBlock(),e.createElementBlock("div",{key:0,class:"lat-lng-tip",style:e.normalizeStyle({left:o.left,bottom:o.bottom})},[e.createElementVNode("span",null,e.toDisplayString(r.lngLat.lat.pretty),1),ms,e.createElementVNode("span",null,e.toDisplayString(r.lngLat.lng.pretty),1)],4)):e.createCommentVNode("",!0)}const gs=_(hs,[["render",ys],["__scopeId","data-v-9bd85ade"]]),fs={name:"IdmMeasure",props:{map:{type:Object},show:{type:Boolean}},data(){return{geojson:[],source:"measure-source",layer:"measure-layer",labelLayer:"measure-label-layer",tmpSource:"measure-tmp-source",tmpLayer:"measure-tmp-layer",tmpLabelLayer:"measure-tmp-label-layer",closeMarkers:{},pointMarkers:{},tipMarker:void 0,contextmenu:void 0,navigation:"RL"}},watch:{show:{handler(){this.handleBind()},immediate:!0},map:{handler(){this.map&&this.handleBind()}}},methods:{handleBind(){var a,t,o,l,r,i,s,n,c,p;if(this.show)(a=this.map)==null||a.getCanvas().addEventListener("keydown",this.handleKeydown),(t=this.map)==null||t.on("mousemove",this.handleMove),(o=this.map)==null||o.on("dblclick",this.handleDblClick),(l=this.map)==null||l.on("click",this.handleClick),(r=this.map)==null||r.on("contextmenu",this.handleContextmenu),this.map&&(this.map.getCanvas().style.cursor="crosshair");else{(i=this.map)==null||i.getCanvas().removeEventListener("keydown",this.handleKeydown),(s=this.map)==null||s.off("mousemove",this.handleMove),(n=this.map)==null||n.off("dblclick",this.handleDblClick),(c=this.map)==null||c.off("click",this.handleClick),(p=this.map)==null||p.off("contextmenu",this.handleContextmenu);for(const h of this.geojson)this.handleClear(h,!0);this.geojson=[],this.map&&(this.map.getCanvas().style.cursor="grab")}},handleKeydown(a){if(a.key==="Shift"){this.navigation=this.navigation==="RL"?"GC":"RL";const t=this.geojson.at(-1).features.filter(o=>o.geometry.type==="Point");t.length&&(t.at(-1).properties.mode=this.navigation)}},handleDrag(a){var t,o,l,r,i,s,n,c,p,h;const d=(o=(t=a.target)==null?void 0:t._element)==null?void 0:o.id;if((d==null?void 0:d.split("-").length)===2){const y=this.geojson.filter(f=>f.id===d.split("-")[0])[0];this.pointMarkers[y.id].filter(f=>{var g;return((g=f._element)==null?void 0:g.id)===d})[0].setLngLat([(r=(l=a.target)==null?void 0:l._lngLat)==null?void 0:r.lng,(s=(i=a.target)==null?void 0:i._lngLat)==null?void 0:s.lat]);let m;y.features.forEach((f,g)=>{if(f.geometry.type==="Point"&&f.properties.id==d.split("-")[1]){m=g;return}});const u=y.features.filter(f=>f.geometry.type==="Point");this.handleTmpPointUpdate(y,u[m-1],{lng:(c=(n=a.target)==null?void 0:n._lngLat)==null?void 0:c.lng,lat:(h=(p=a.target)==null?void 0:p._lngLat)==null?void 0:h.lat,properties:u[m].properties},m===u.length-1?void 0:u[m+1])}},handleDragEnd(a){var t,o,l,r,i,s,n,c,p,h;const d=(o=(t=a.target)==null?void 0:t._element)==null?void 0:o.id;if((d==null?void 0:d.split("-").length)===2){const y=this.geojson.filter(u=>u.id===d.split("-")[0])[0];this.pointMarkers[y.id].filter(u=>{var f;return((f=u._element)==null?void 0:f.id)===d})[0].setLngLat([(r=(l=a.target)==null?void 0:l._lngLat)==null?void 0:r.lng,(s=(i=a.target)==null?void 0:i._lngLat)==null?void 0:s.lat]);const m=y.features.filter(u=>u.geometry.type==="Point"&&u.properties.id==d.split("-")[1])[0];m.geometry.coordinates=[(c=(n=a.target)==null?void 0:n._lngLat)==null?void 0:c.lng,(h=(p=a.target)==null?void 0:p._lngLat)==null?void 0:h.lat],y.features=y.features.filter(u=>u.geometry.type==="Point"),this.handlePointUpdate(y)}},handleContextmenu(a){var t,o,l,r;a.preventDefault(),(t=this.contextmenu)==null||t.remove();const i=(r=(l=(o=a.originalEvent)==null?void 0:o.target)==null?void 0:l.parentElement)==null?void 0:r.id;if((i==null?void 0:i.split("-").length)===2){const s=this.geojson.filter(n=>n.id===i.split("-")[0])[0].features.filter(n=>n.geometry.type==="Point");if(s.length>2&&s.filter(n=>n.properties.id===(i==null?void 0:i.split("-")[1]))[0]){const n=document.createElement("div");n.className="point-contextmenu-marker",n.innerHTML=`Del`,this.contextmenu=new I.Marker(n).setOffset([24,0]).setLngLat([a.lngLat.lng,a.lngLat.lat]).addTo(this.map)}}},handleClick(a){var t,o,l,r,i;(t=this.contextmenu)==null||t.remove();const s=a.originalEvent.target.className;if(s==="marker-close"){const n=(l=(o=a.originalEvent)==null?void 0:o.srcElement)==null?void 0:l.id,c=this.geojson.filter(p=>p.id===n)[0];c&&this.handleClear(c,!0),this.geojson=this.geojson.filter(p=>p.id!==n)}else if(s==="del-point"){const n=(i=(r=a.originalEvent.target.id)==null?void 0:r.replace("del-",""))==null?void 0:i.split("-"),c=this.geojson.filter(p=>p.id===n[0])[0];c.features=c.features.filter(p=>p.geometry.type==="Point"&&p.properties.id!==n[1]),this.handlePointUpdate(c)}else if(s!=="marker-label"){let n=this.geojson.at(-1);n||(n=x.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(n)),n.features=n.features.filter(p=>p.geometry.type==="Point");const c=x.feature({type:"Point",coordinates:[a.lngLat.lng,a.lngLat.lat]},{id:new Date().getTime().toString(),mode:this.navigation});n.features.push(c),this.handlePointUpdate(n)}},handlePointUpdate(a){const t=a.features;if(t.length>1){let o=0;const l=[];for(let r=1;r[u.lng,u.lat]));m.properties.dist=h,m.properties.bearing=d,m.properties.total=o,l.push(m)}t.push(...l),a.total=o}return this.handleRender(a),a},handleTmpPointUpdate(a,t,o,l){const r=x.featureCollection([]);let i,s;if(t){const c=t.properties,p={lng:t.geometry.coordinates[0],lat:t.geometry.coordinates[1]},h={lng:o.lng,lat:o.lat};i=S.LaneHelper.calculateDistance(p,h,c.mode==="RL",2),s=S.LaneHelper.calculateBearing(p,h,c.mode==="RL",2);let d;c.mode==="RL"?d=S.LngLatHelper.convertToMonotonicLng([p,h]):d=S.LngLatHelper.convertToMonotonicLng(S.LaneHelper.interpolateCoordinates(p,h,200));const y=x.lineString(d.map(m=>[m.lng,m.lat]));y.properties.dist=i,y.properties.bearing=s,r.features.push(y)}if(l){const c=o.properties,p=o,h={lng:l.geometry.coordinates[0],lat:l.geometry.coordinates[1]};i=S.LaneHelper.calculateDistance(p,h,c.mode==="RL",2),s=S.LaneHelper.calculateBearing(p,h,c.mode==="RL",2);let d;c.mode==="RL"?d=S.LngLatHelper.convertToMonotonicLng([p,h]):d=S.LngLatHelper.convertToMonotonicLng(S.LaneHelper.interpolateCoordinates(p,h,200));const y=x.lineString(d.map(m=>[m.lng,m.lat]));y.properties.dist=i,y.properties.bearing=s,r.features.push(y)}this.map.getSource(this.tmpSource)?this.map.getSource(this.tmpSource).setData(r):this.map.addSource(this.tmpSource,{type:"geojson",data:r}),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":"#F44336","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","text-rotation-alignment":"map","text-size":12},paint:{"text-opacity":1,"text-color":"#fff","text-halo-color":"#F44336","text-halo-width":4,"text-halo-blur":0}});let n;if(l?n='
Drag and drop
':n=`
Tol distance: ${S.LngLatHelper.roundPrecision((a.total??0)+i,2)}nm, bearing: ${s}°
${this.navigation==="RL"?"RL":"GC"} mode, using 'Shift' to switch
Double click to end
`,this.tipMarker)this.tipMarker._element.innerHTML=n,this.tipMarker.setLngLat([o.lng,o.lat]);else{const c=document.createElement("div");c.className="tip-marker",c.innerHTML=n,this.tipMarker=new I.Marker(c).setOffset([140,0]).setLngLat([o.lng,o.lat]).addTo(this.map)}},handleMove(a){this.map.getCanvas().style.cursor="crosshair";let t=this.geojson.at(-1);t||(t=x.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(t));const o=t.features.filter(l=>l.geometry.type==="Point");o!=null&&o.length&&this.handleTmpPointUpdate(t,o.at(-1),{lng:a.lngLat.lng,lat:a.lngLat.lat})},handleDblClick(a){a.preventDefault();let t=this.geojson.at(-1);t.closed=!0,this.handleRender(t),t=x.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(t)},handleRender(a){var t;if((t=a==null?void 0:a.features)!=null&&t.length){const o=`${a.id}-${this.source}`,l=`${a.id}-${this.layer}`,r=`${a.id}-${this.labelLayer}`;this.map.getSource(o)?this.map.getSource(o).setData(a):this.map.addSource(o,{type:"geojson",data:a}),this.handleClear(a,!1),this.map.addLayer({id:l,type:"line",source:o,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#F44336","line-width":2}}),this.map.addLayer({id:r,type:"symbol",source:o,filter:["==","$type","LineString"],layout:{"symbol-placement":"line-center","text-field":"{dist}nm,{bearing}°","text-rotation-alignment":"map","text-size":12},paint:{"text-opacity":1,"text-color":"#fff","text-halo-color":"#F44336","text-halo-width":4,"text-halo-blur":0}});const i=a.features.filter(s=>s.geometry.type==="Point");for(const s of i){const n=document.createElement("div");n.id=`${a.id}-${s.properties.id}`,n.className=`${a.closed?"point-marker closed":"point-marker"}`,n.innerHTML='
';const c=new I.Marker({element:n,draggable:!0,contextmenu:!0}).setLngLat(s.geometry.coordinates).addTo(this.map);c.on("drag",this.handleDrag),c.on("dragend",this.handleDragEnd),this.pointMarkers[a.id]?this.pointMarkers[a.id].push(c):this.pointMarkers[a.id]=[c]}if(a.closed){const s=i.at(-1),n=a.features.filter(p=>p.geometry.type==="LineString").at(-1),c=document.createElement("div");c.className="point-summary-marker",c.innerHTML=`
×
Tol: ${n.properties.total}nm
`,this.closeMarkers[a.id]=new I.Marker(c).setOffset([60,0]).setLngLat(s.geometry.coordinates).addTo(this.map)}}},handleClear(a,t=!0){var o,l,r,i,s,n,c,p,h;const d=`${a.id}-${this.source}`,y=`${a.id}-${this.layer}`,m=`${a.id}-${this.labelLayer}`;(o=this.map)!=null&&o.getLayer(y)&&this.map.removeLayer(y),(l=this.map)!=null&&l.getLayer(m)&&this.map.removeLayer(m),(r=this.map)!=null&&r.getLayer(this.tmpLayer)&&this.map.removeLayer(this.tmpLayer),(i=this.map)!=null&&i.getLayer(this.tmpLabelLayer)&&this.map.removeLayer(this.tmpLabelLayer),(s=this.closeMarkers[a.id])==null||s.remove(),this.closeMarkers[a.id]=void 0,(n=this.pointMarkers[a.id])==null||n.forEach(u=>{u==null||u.remove()}),this.pointMarkers[a.id]=[],(c=this.tipMarker)==null||c.remove(),this.tipMarker=void 0,t&&(p=this.map)!=null&&p.getSource(d)&&this.map.removeSource(d),t&&(h=this.map)!=null&&h.getSource(this.tmpSource)&&this.map.removeSource(this.tmpSource)}}};function us(a,t,o,l,r,i){return e.openBlock(),e.createElementBlock("div")}const bs=_(fs,[["render",us]]),ws={name:"IdmENC",props:{map:{type:Object},enabled:{type:Boolean},weatherLayers:{type:Object,default:()=>({})},beforeLayer:{type:String,default:"land-structure-line"},left:{type:String,default:"10px"},bottom:{type:String,default:"64px"},token:{type:String,default:""}},data(){return{source:"enc-source",layer:"enc-layer",helper:P.CompanyHelper,vendor:this.$attrs.permission&P.CompanyHelper.LEVEL.Supper?"hi":"i4"}},watch:{enabled:{handler(){this.enabled?(this.handleRender(),Object.keys(this.weatherLayers).some(a=>{var t;return(t=this.weatherLayers)==null?void 0:t[a].active})?this.map.getLayer(this.layer)&&this.map.moveLayer(this.layer,this.beforeLayer):this.map.getLayer(this.layer)&&this.map.moveLayer(this.layer,null)):this.handleClear()}},weatherLayers:{handler(){Object.keys(this.weatherLayers).some(a=>{var t;return(t=this.weatherLayers)==null?void 0:t[a].active})?this.map.getLayer(this.layer)&&this.map.moveLayer(this.layer,this.beforeLayer):this.map.getLayer(this.layer)&&this.map.moveLayer(this.layer,"continent-label")},deep:!0},vendor:{handler(){var a;const t=(a=this.map)==null?void 0:a.getSource(this.source);t&&(this.vendor==="hi"?t.setTiles([`https://assist1.idmwx.com/api/arc/hifleets/{z}/{y}/{x}/nauticalmap?tk=${this.token}`,`https://assist2.idmwx.com/api/arc/hifleets/{z}/{y}/{x}/nauticalmap?tk=${this.token}`,`https://assist3.idmwx.com/api/arc/hifleets/{z}/{y}/{x}/nauticalmap?tk=${this.token}`,`https://assist4.idmwx.com/api/arc/hifleets/{z}/{y}/{x}/nauticalmap?tk=${this.token}`]):t.setTiles(["https://osshz.idmwx.com/nautical/{z}/{x}/{y}.png","https://osshz1.idmwx.com/nautical/{z}/{x}/{y}.png","https://osshz2.idmwx.com/nautical/{z}/{x}/{y}.png","https://osshz3.idmwx.com/nautical/{z}/{x}/{y}.png","https://osshz4.idmwx.com/nautical/{z}/{x}/{y}.png"]))},immediate:!0}},methods:{handleRender(){if(!this.map)setTimeout(()=>{this.handleRender()},500);else{this.handleClear();let a;this.vendor==="hi"?a=[`https://assist1.idmwx.com/api/arc/hifleets/{z}/{y}/{x}/nauticalmap?tk=${this.token}`,`https://assist2.idmwx.com/api/arc/hifleets/{z}/{y}/{x}/nauticalmap?tk=${this.token}`,`https://assist3.idmwx.com/api/arc/hifleets/{z}/{y}/{x}/nauticalmap?tk=${this.token}`,`https://assist4.idmwx.com/api/arc/hifleets/{z}/{y}/{x}/nauticalmap?tk=${this.token}`]:a=["https://osshz.idmwx.com/nautical/{z}/{x}/{y}.png","https://osshz1.idmwx.com/nautical/{z}/{x}/{y}.png","https://osshz2.idmwx.com/nautical/{z}/{x}/{y}.png","https://osshz3.idmwx.com/nautical/{z}/{x}/{y}.png","https://osshz4.idmwx.com/nautical/{z}/{x}/{y}.png"],this.map.addSource(this.source,{type:"raster",tiles:a,titleSize:256,minzoom:5}),this.map.addLayer({id:this.layer,type:"raster",source:this.source,layout:{visibility:"visible"}},this.beforeLayer)}},handleClear(){var a,t;(a=this.map)!=null&&a.getLayer(this.layer)&&this.map.removeLayer(this.layer),(t=this.map)!=null&&t.getSource(this.source)&&this.map.removeSource(this.source)}}},Ls={class:"legend-bars"};function vs(a,t,o,l,r,i){return o.enabled&&a.$attrs.permission&r.helper.LEVEL.Supper?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle({position:"absolute",left:o.left,bottom:o.bottom})},[e.createElementVNode("div",Ls,[e.createElementVNode("div",{class:e.normalizeClass(r.vendor==="hi"?"active":""),onClick:t[0]||(t[0]=s=>r.vendor="hi")},"HI",2),e.createElementVNode("div",{class:e.normalizeClass(r.vendor==="i4"?"active":""),onClick:t[1]||(t[1]=s=>r.vendor="i4")},"I4",2)])],4)):e.createCommentVNode("",!0)}const xs={name:"IdmGLV2",components:{IdmGlLayer:Go,IdmWindBarb:Ko,IdmWindParticle:ir,IdmCurrents:pr,IdmCurrentParticle:br,IdmSigWave:Er,IdmSigWaveRamp:Vr,IdmSwell:Pr,IdmPrmsl:Ir,IdmIceberg:zr,IdmTropicals:gi,IdmPrecip3h:vi,IdmVisibility:ki,IdmWaterTemp:Bi,IdmTemp:Oi,IdmArctic:Hi,IdmWarZone:Sl,IdmGmdssArea:Nl,IdmEcaZone:Dl,IdmAlertZone:Ml,IdmPort:Yl,IdmLoadLine:Ql,IdmTimezone:ts,IdmVRA:rs,IdmSpecialArea:ss,IdmTerminator:ds,IdmLatLng:gs,IdmMeasure:bs,IdmPoint:xl,IdmENC:_(ws,[["render",vs],["__scopeId","data-v-787baf3a"]])},props:{map:{type:Object},token:{type:String},ts:{type:String},beforeLayer:{type:String,default:"country-boundaries"}},emits:["tropicals"],data(){return{weatherLayers:{},activeWeatherLayers:[],weatherWeight:0,otherLayers:{},otherWeight:0,showCoord:!1,showMeasure:!1,showPoint:!1,show3d:!1,meteo:void 0,source:"",gateway:"https://cbe.idmwx.com",zoom:6,viewport:void 0,particleFactor:void 0,showRampColor:!1,activeWindLayer:!1,showWindParticle:!1,showCurrentParticle:!1,rampFactor:void 0}},watch:{ts:{handler(){this.ts&&this.$nextTick(()=>{this.handleDateChange({tropicals:!1})})},immediate:!0},map:{handler(){this.map&&(this.map.on("zoomend",this.handleDragEndWithZoom4Json),this.map.on("dragend",this.handleDragEndWithZoom4Json),this.map.on("move",this.handleDragEndWithZoom4Image),this.viewport=new Ge(this.map),this.handleRampColorInitial())},immediate:!0}},methods:{async fetchWeatherLayers(a={tropicals:!1}){var t,o,l,r,i,s,n,c;const p=new Date().valueOf();let h=0,d=0;if(this.map){const y=((t=this.map)==null?void 0:t.getZoom())+1,m=(o=this.map)==null?void 0:o.getBounds(),u=`${m._sw.lng},${m._sw.lat},${m._ne.lng},${m._ne.lat}`;if(this.handleRampColorState(),this.particleFactor){const f=P.LayerHelper.WEATHER_LAYERS.find(g=>{var w;return((w=g.peer)==null?void 0:w.weight)===this.particleFactor.weight});this.particleFactor.particle?this.weatherWeight=this.weatherWeight&f.weight?this.weatherWeight:this.weatherWeight+f.weight:this.weatherWeight=this.weatherWeight&f.weight?this.weatherWeight-f.weight:this.weatherWeight}if(this.rampFactor){const f=P.LayerHelper.WEATHER_LAYERS.find(g=>{var w;return((w=g.peer)==null?void 0:w.weight)===this.rampFactor.weight});this.rampFactor.ramp?this.weatherWeight=this.weatherWeight&f.weight?this.weatherWeight:this.weatherWeight+f.weight:this.weatherWeight=this.weatherWeight&f.weight?this.weatherWeight-f.weight:this.weatherWeight}if(this.weatherWeight>0){let f=this.weatherWeight,g;if(a.tropicals||this.weatherWeight&256&&(g=this.weatherLayers.tropicals,g&&(f-=256,g.version=Math.random()+1)),f>0){const w=await j.get(`${this.gateway}/api/arc/weather/layers/links?l=${f}&v=${this.source}&z=${y}&bbox=${u}&t=${this.ts}`,{headers:{Authorization:this.token}});if(d=new Date().valueOf()-(p+h),console.log("weather links elapsed: ",d,", total: ",h+=d),((l=w==null?void 0:w.data)==null?void 0:l.code)===0){const b=(r=w==null?void 0:w.data)==null?void 0:r.data,v=[];for(const C in b)C!=="tropicals"&&v.push(j.get(b[C],{headers:{Authorization:this.token,key:C},responseType:/\.(jpg|png)$/.test(b[C])?"blob":"json"}).catch(V=>{console.log(`[${C}] fetch layer error: ${V}`)}));const E=await Promise.all(v);this.weatherLayers={},E.map(C=>{var V,T,R,A;const O=((V=C==null?void 0:C.data)==null?void 0:V.data)||(C==null?void 0:C.data),F=(R=(T=C==null?void 0:C.config)==null?void 0:T.headers)==null?void 0:R.key;F&&O&&(this.weatherLayers[F]={raw:O,type:((A=C==null?void 0:C.config)==null?void 0:A.responseType)==="blob"?"image":"json",etime:this.ts})}),b.tropicals&&j.get(b.tropicals,{headers:{Authorization:this.token,key:"tropicals"}}).then(C=>{var V,T,R,A;const O=S.TropicalHelper.convert2Geojson(((V=C==null?void 0:C.data)==null?void 0:V.data)||(C==null?void 0:C.data));this.$emit("tropicals",{raw:(T=C==null?void 0:C.data)==null?void 0:T.data,geojson:O});const F=(A=(R=C==null?void 0:C.config)==null?void 0:R.headers)==null?void 0:A.key;this.weatherLayers[F]={data:O,active:!0,cached:!1,type:"json",etime:this.ts,version:Math.random()+1}})}if(d=new Date().valueOf()-(p+h),console.log("weather layers elapsed: ",d,", total: ",h+=d),this.weatherLayers["swell-direction"]||this.weatherLayers["swell-height"]){const b=(i=this.weatherLayers["swell-direction"])==null?void 0:i.raw,v=(s=this.weatherLayers["swell-height"])==null?void 0:s.raw;delete this.weatherLayers["swell-direction"],delete this.weatherLayers["swell-height"],this.weatherLayers.swell={type:"json",direction:b,height:{raw:v},etime:this.ts}}if(this.weatherLayers["current-direction"]||this.weatherLayers["current-speed"]){const b=(n=this.weatherLayers["current-direction"])==null?void 0:n.raw,v=(c=this.weatherLayers["current-speed"])==null?void 0:c.raw;delete this.weatherLayers["current-direction"],delete this.weatherLayers["current-speed"],this.weatherLayers.current={type:"json",direction:b,speed:{raw:v},etime:this.ts}}}g&&(g.etime=this.ts,g.cached=!0,this.weatherLayers.tropicals=g)}this.handleWeatherLayerToggle(),this.handleDragEndWithZoom4Json()}},async fetchOtherLayers(a={all:!1,dayNight:!1,enc:!1}){var t,o,l,r;if(this.map){let i=this.otherWeight;if(i){let s=!1;if(this.otherWeight&2048&&(i=this.otherWeight-2048,s=!0),i){if(a.all){const n=await j.get(`${this.gateway}/api/arc/other/layers/links?l=${i}&t=${this.ts}`,{headers:{Authorization:this.token}});if(((t=n==null?void 0:n.data)==null?void 0:t.code)===0){const c=(o=n==null?void 0:n.data)==null?void 0:o.data,p=[];for(const d in c)p.push(j.get(c[d],{headers:{Authorization:this.token,key:d}}));const h=await Promise.all(p);this.otherLayers={enc:s},h.map(d=>{var y,m,u;const f=((y=d==null?void 0:d.data)==null?void 0:y.data)||(d==null?void 0:d.data),g=(u=(m=d==null?void 0:d.config)==null?void 0:m.headers)==null?void 0:u.key;this.otherLayers[g]=f})}}else if(a.dayNight&&i&1024){const n=await j.get(`${this.gateway}/api/arc/other/layers/links?l=1024&t=${this.ts}`,{headers:{Authorization:this.token}});if(((l=n==null?void 0:n.data)==null?void 0:l.code)===0){const c=(r=n==null?void 0:n.data)==null?void 0:r.data,p=[];for(const h in c)p.push(j.get(c[h],{headers:{Authorization:this.token,key:h}}));(await Promise.all(p)).map(h=>{var d,y,m;const u=((d=h==null?void 0:h.data)==null?void 0:d.data)||(h==null?void 0:h.data),f=(m=(y=h==null?void 0:h.config)==null?void 0:y.headers)==null?void 0:m.key;this.otherLayers[f]=u})}}}else this.otherLayers={enc:s}}else this.otherLayers={};this.handleBeforeLayerToggle()}},handleRampColorState(){var a;if(this.showRampColor=!1,this.showWindParticle=!1,this.showCurrentParticle=!1,(a=this.particleFactor)!=null&&a.particle)this.showRampColor=!0,this.showWindParticle=this.particleFactor.key==="wind",this.showCurrentParticle=this.particleFactor.key==="current",this.activeWeatherLayers=this.activeWeatherLayers.filter(t=>t.type==="json");else for(const t of this.activeWeatherLayers)["png","jpg"].includes(t.type)&&(this.showRampColor=!0);this.activeWindLayer=!!this.activeWeatherLayers.find(t=>t.key==="wind"),this.$refs.layer&&(this.$refs.layer.activeWeatherLayers=this.activeWeatherLayers)},handleRampColorInitial(){var a,t,o,l,r,i,s,n,c,p,h,d;this.viewport.map.getSource((a=this.viewport)==null?void 0:a.rampColorSource)||this.viewport.map.addSource((t=this.viewport)==null?void 0:t.rampColorSource,{type:"canvas",canvas:(o=this.viewport)==null?void 0:o.rampColorCanvas,animate:!0,coordinates:this.viewport.getBoundLngLat()}),this.viewport.map.getLayer((l=this.viewport)==null?void 0:l.rampColorLayer)||this.viewport.map.addLayer({type:"raster",id:(r=this.viewport)==null?void 0:r.rampColorLayer,source:(i=this.viewport)==null?void 0:i.rampColorSource,layout:{visibility:"none"}},this.beforeLayer),this.viewport.map.getSource((s=this.viewport)==null?void 0:s.particleSource)||this.viewport.map.addSource((n=this.viewport)==null?void 0:n.particleSource,{type:"canvas",canvas:(c=this.viewport)==null?void 0:c.particleCanvas,animate:!0,coordinates:this.viewport.getBoundLngLat()}),this.viewport.map.getLayer((p=this.viewport)==null?void 0:p.particleLayer)||this.viewport.map.addLayer({type:"raster",id:(h=this.viewport)==null?void 0:h.particleLayer,source:(d=this.viewport)==null?void 0:d.particleSource,layout:{visibility:"none"}},this.beforeLayer)},handleDragEndWithZoom4Json(){var a,t,o,l;const r=new Date().valueOf();let i=0,s=0;const n=(a=this.map)==null?void 0:a.getBounds(),c=this.map.getZoom(),p=P.convertToStandardLng(n._sw.lng),h=P.convertToStandardLng(n._ne.lng),d=Math.floor(n._sw.lat),y=Math.ceil(n._ne.lat);for(const m in this.weatherLayers)if(this.weatherLayers[m].active&&this.weatherLayers[m].type==="json"){this.weatherLayers[m].active=!1,this.weatherLayers[m].version=Math.random()+1;let u=[];if(["swell","current"].includes(m)){const f=((t=this.weatherLayers[m])==null?void 0:t.direction)||{};for(const g in f)if(g>d&&gh?w.forEach((b,v)=>{var E;if((b>=p&&b<=180||b>=-180&&b<=h)&&(!(c<=this.zoom)||b%(c{var E;if(b>=p&&b<=h&&(!(c<=this.zoom)||b%(cb.properties.val>.5):g.data.features;u=u.concat(w),s=new Date().valueOf()-(r+i),console.log("speed elapsed: ",s,", total: ",i+=s)}}}else if(m==="wind"){const f=this.weatherLayers.wind.raw;for(const g in f)if(g>d&&gh?w.forEach((b,v)=>{if((b>=p&&b<=180||b>=-180&&b<=h)&&(!(c<=this.zoom)||b%(c{if(b>=p&&b<=h&&(!(c<=this.zoom)||b%(c{b=P.convertToStandardLng(b),g.push(x.point([b,w],{val:f.Point[w].val[v],type:f.Point[w].type[v]}))});u=u.concat(g)}}s=new Date().valueOf()-(r+i),console.log("prmsl elapsed: ",s,", total: ",i+=s)}else if(m==="arctic"||m==="iceberg"){if(this.weatherLayers[m].data)u=this.weatherLayers[m].data;else{const f=this.weatherLayers[m].raw;if(f){const g=[];for(const w in f.LineString){const b=f.LineString[w];for(const v of b)g.push(x.lineString(v,{val:Number(w)}))}u=u.concat(g)}}s=new Date().valueOf()-(r+i)}console.log(m," elapsed: ",s,", total: ",i+=s),u.length&&(this.weatherLayers[m].data=x.featureCollection(u)),this.weatherLayers[m].active=!0,this.weatherLayers[m].version=Math.random()+1}},handleDragEndWithZoom4Image(){for(const a in this.weatherLayers)this.weatherLayers[a].active&&this.weatherLayers[a].type==="image"&&(this.weatherLayers[a].active=!0,this.weatherLayers[a].version=Math.random()+1)},handleBboxClip(a,t){const o=[],l=P.convertToStandardLng(t._sw.lng),r=P.convertToStandardLng(t._ne.lng);return a.features.forEach(i=>{if(i.geometry.type!=="Point")if(l>r){let s=[l,t._sw.lat,180,t._ne.lat],n=x.bboxClip(i,s);n.geometry.coordinates.length&&o.push(n),s=[-180,t._sw.lat,r,t._ne.lat],n=x.bboxClip(i,s),n.geometry.coordinates.length&&o.push(n)}else{const s=[l,t._sw.lat,r,t._ne.lat],n=x.bboxClip(i,s);n.geometry.coordinates.length&&o.push(n)}else o.push(i)}),o},handleWeatherLayerToggle(){var a;for(const t in this.weatherLayers)this.weatherLayers[t].active=!1,this.weatherLayers[t].version=Math.random()+1;for(const t of this.activeWeatherLayers){let o=t.key;o.indexOf("swell")>-1?o="swell":o.indexOf("current")>-1&&(o="current"),this.weatherLayers[o]&&(this.weatherLayers[o].active=!0,this.weatherLayers[o].version=Math.random()+1,((a=this.particleFactor)==null?void 0:a.key)===o&&this.weatherLayers[`${o}-particle`]&&(this.weatherLayers[`${o}-particle`].active=this.particleFactor.particle),t.key==="sig-wave"&&t.ramp&&(this.weatherLayers["sig-wave-height"].active=!1))}this.handleBeforeLayerToggle()},handleBeforeLayerToggle(){var a,t,o,l,r,i,s,n,c,p,h,d,y;(a=this.map)!=null&&a.getLayer(this.beforeLayer)&&((t=this.activeWeatherLayers)!=null&&t.length||(o=this.otherLayers)!=null&&o["war-zones"]||(l=this.otherLayers)!=null&&l["gmdss-areas"]||(r=this.otherLayers)!=null&&r["load-lines"]||(i=this.otherLayers)!=null&&i["high-risk-area"]||(s=this.otherLayers)!=null&&s["time-zones"]||(n=this.otherLayers)!=null&&n.pirates||(c=this.otherLayers)!=null&&c.ports||(p=this.otherLayers)!=null&&p.enc||(h=this.otherLayers)!=null&&h["voluntary-reporting-area"]||(d=this.otherLayers)!=null&&d["eca-zones"]||(y=this.otherLayers)!=null&&y["special-area"]?this.map.setLayoutProperty(this.beforeLayer,"visibility","visible"):this.map.setLayoutProperty(this.beforeLayer,"visibility","none"))},handleDateChange(a={tropicals:!1}){this.fetchWeatherLayers(a),this.fetchOtherLayers({dayNight:!0})},handleWeatherLayerChange(a,t,o){if(!this.map)setTimeout(()=>{this.handleWeatherLayerChange(a,t,o)},500);else{this.activeWeatherLayers=t,this.activeWeatherLayers.some(r=>["png","jpg"].includes(r.type))&&this.particleFactor&&(this.particleFactor.particle=!1,this.rampFactor={ramp:!1,key:"sigWave",weight:16});const l=t==null?void 0:t.reduce((r,i)=>r+(r&(i==null?void 0:i.weight)?0:i==null?void 0:i.weight),0);this.weatherWeight!==l||this.source!==o?(this.source=o,this.weatherWeight=l,this.fetchWeatherLayers({tropicals:!1})):this.handleWeatherLayerToggle()}},handleOtherLayerChange(a){if(!this.map)setTimeout(()=>{this.handleOtherLayerChange(a)},500);else{const t=a==null?void 0:a.reduce((o,l)=>o+(l==null?void 0:l.weight),0);this.otherWeight!=t&&(this.otherWeight=t,this.fetchOtherLayers({all:!0}))}},async handlePointChange(a){const t=this.ts?N(this.ts):N(),o={lat:a.lat,lng:a.lng,ts:t.utc().format(),wt:!0,src:this.source},l=await j.get(`${this.gateway}/api/arc/meteo/query`,{params:o,headers:{Authorization:this.token}});(l==null?void 0:l.status)===200&&(this.meteo={...l==null?void 0:l.data,...a})},handle3dToggle(a){a?this.map.setProjection("globe"):this.map.setProjection("mercator")},handleParticle(a){this.particleFactor=a,this.particleFactor.particle&&(this.rampFactor=a={ramp:!1,key:"sigWave",weight:16}),this.fetchWeatherLayers({tropicals:!1})},handleRamp(a){this.rampFactor=a,this.rampFactor.ramp?(this.particleFactor={particle:!1,key:"wind",weight:1},this.activeWeatherLayers=this.activeWeatherLayers.filter(t=>t.key!=="sig-wave"&&!["png","jpg"].includes(t.type)),this.activeWeatherLayers.push({enabled:!0,h5:!0,key:"sig-wave",name:"Sig Waves",type:"jpg",weight:524304,ramp:!0})):this.activeWeatherLayers=this.activeWeatherLayers.filter(t=>t.key!=="sig-wave"),this.fetchWeatherLayers({tropicals:!1})}}},Es={key:0,class:"map-gl-home"};function Cs(a,t,o,l,r,i){var s,n,c,p,h,d,y,m,u,f,g,w,b,v,E,C,V,T,R,A,O,F,q,J,Q,K,ee,te,ae,oe,re,ie,le,se,ne,ce,de,he,pe,me,ye,ge;const be=e.resolveComponent("IdmGlLayer"),we=e.resolveComponent("IdmENC"),Le=e.resolveComponent("IdmSigWave"),ve=e.resolveComponent("IdmSigWaveRamp"),xe=e.resolveComponent("IdmSwell"),Ce=e.resolveComponent("IdmPrmsl"),Se=e.resolveComponent("IdmIceberg"),_e=e.resolveComponent("IdmTropicals"),ke=e.resolveComponent("IdmCurrents"),Ne=e.resolveComponent("IdmCurrentParticle"),Ve=e.resolveComponent("IdmWindBarb"),Te=e.resolveComponent("IdmWindParticle"),De=e.resolveComponent("IdmPrecip3h"),Pe=e.resolveComponent("IdmVisibility"),Be=e.resolveComponent("IdmWaterTemp"),Re=e.resolveComponent("IdmTemp"),Ie=e.resolveComponent("IdmArctic"),Me=e.resolveComponent("IdmWarZone"),Ae=e.resolveComponent("IdmGmdssArea"),ze=e.resolveComponent("IdmEcaZone"),Oe=e.resolveComponent("IdmAlertZone"),D=e.resolveComponent("IdmPort"),U=e.resolveComponent("IdmLoadLine"),H=e.resolveComponent("IdmTimezone"),L=e.resolveComponent("IdmVRA"),X=e.resolveComponent("IdmSpecialArea"),We=e.resolveComponent("IdmTerminator"),Fe=e.resolveComponent("IdmLatLng"),je=e.resolveComponent("IdmMeasure"),$e=e.resolveComponent("IdmPoint");return o.map?(e.openBlock(),e.createElementBlock("div",Es,[e.createVNode(be,e.mergeProps({ref:"layer",map:o.map},a.$attrs,{onWeather:i.handleWeatherLayerChange,onOther:i.handleOtherLayerChange,onCoordinate:t[0]||(t[0]=fe=>r.showCoord=fe),onMeasure:t[1]||(t[1]=fe=>r.showMeasure=fe),onPoint:t[2]||(t[2]=fe=>r.showPoint=fe),on3d:i.handle3dToggle}),null,16,["map","onWeather","onOther","on3d"]),e.createVNode(we,e.mergeProps({map:o.map,token:o.token,weatherLayers:r.weatherLayers,enabled:(s=r.otherLayers)==null?void 0:s.enc},a.$attrs),null,16,["map","token","weatherLayers","enabled"]),e.createVNode(Le,e.mergeProps({ref:"sigWave",map:o.map,"sig-wave":(n=r.weatherLayers)==null?void 0:n["sig-wave-height"],"before-layer":o.beforeLayer,"margin-bottom":(p=(c=r.weatherLayers)==null?void 0:c.wind)!=null&&p.active&&(d=(h=r.weatherLayers)==null?void 0:h.current)!=null&&d.active&&r.showRampColor?"108px":((m=(y=r.weatherLayers)==null?void 0:y.wind)!=null&&m.active||(f=(u=r.weatherLayers)==null?void 0:u.current)!=null&&f.active)&&r.showRampColor?"82px":(w=(g=r.weatherLayers)==null?void 0:g.wind)!=null&&w.active||(v=(b=r.weatherLayers)==null?void 0:b.current)!=null&&v.active||r.showRampColor?"56px":"30px",onRamp:i.handleRamp},a.$attrs),null,16,["map","sig-wave","before-layer","margin-bottom","onRamp"]),e.createVNode(ve,e.mergeProps({viewport:r.viewport,factor:(E=r.weatherLayers)==null?void 0:E["sig-wave"],"before-layer":o.beforeLayer},a.$attrs),null,16,["viewport","factor","before-layer"]),e.createVNode(xe,e.mergeProps({map:o.map,swell:(C=r.weatherLayers)==null?void 0:C.swell,"before-layer":o.beforeLayer},a.$attrs),null,16,["map","swell","before-layer"]),e.createVNode(Ce,e.mergeProps({map:o.map,prmsl:(V=r.weatherLayers)==null?void 0:V.prmsl,"before-layer":o.beforeLayer},a.$attrs),null,16,["map","prmsl","before-layer"]),e.createVNode(Se,e.mergeProps({map:o.map,iceberg:(T=r.weatherLayers)==null?void 0:T.iceberg,"before-layer":o.beforeLayer},a.$attrs),null,16,["map","iceberg","before-layer"]),e.createVNode(_e,e.mergeProps({map:o.map,date:o.ts,tropicals:(R=r.weatherLayers)==null?void 0:R.tropicals,"before-layer":o.beforeLayer},a.$attrs),null,16,["map","date","tropicals","before-layer"]),e.createVNode(ke,e.mergeProps({map:o.map,current:(A=r.weatherLayers)==null?void 0:A.current,"before-layer":o.beforeLayer,"show-particle":r.showCurrentParticle,"margin-bottom":(F=(O=r.weatherLayers)==null?void 0:O.wind)!=null&&F.active&&r.showRampColor?"82px":(J=(q=r.weatherLayers)==null?void 0:q.wind)!=null&&J.active||r.showRampColor?"58px":"30px"},a.$attrs,{onParticle:i.handleParticle}),null,16,["map","current","before-layer","show-particle","margin-bottom","onParticle"]),e.createVNode(Ne,e.mergeProps({viewport:r.viewport,factor:(Q=r.weatherLayers)==null?void 0:Q["current-particle"],"before-layer":o.beforeLayer},a.$attrs),null,16,["viewport","factor","before-layer"]),e.createVNode(Ve,e.mergeProps({map:o.map,wind:(K=r.weatherLayers)==null?void 0:K.wind,"before-layer":o.beforeLayer,"margin-bottom":r.showRampColor?"56px":"30px","show-particle":r.showWindParticle},a.$attrs,{onParticle:i.handleParticle}),null,16,["map","wind","before-layer","margin-bottom","show-particle","onParticle"]),e.createVNode(Te,e.mergeProps({viewport:r.viewport,factor:(ee=r.weatherLayers)==null?void 0:ee["wind-particle"],"before-layer":o.beforeLayer},a.$attrs),null,16,["viewport","factor","before-layer"]),e.createVNode(De,e.mergeProps({viewport:r.viewport,factor:(te=r.weatherLayers)==null?void 0:te.precip3h,"before-layer":o.beforeLayer},a.$attrs),null,16,["viewport","factor","before-layer"]),e.createVNode(Pe,e.mergeProps({viewport:r.viewport,factor:(ae=r.weatherLayers)==null?void 0:ae.visibility,"before-layer":o.beforeLayer},a.$attrs),null,16,["viewport","factor","before-layer"]),e.createVNode(Be,e.mergeProps({viewport:r.viewport,factor:(oe=r.weatherLayers)==null?void 0:oe["water-temp"],"before-layer":o.beforeLayer},a.$attrs),null,16,["viewport","factor","before-layer"]),e.createVNode(Re,e.mergeProps({viewport:r.viewport,factor:(re=r.weatherLayers)==null?void 0:re.temp,"before-layer":o.beforeLayer},a.$attrs),null,16,["viewport","factor","before-layer"]),e.createVNode(Ie,e.mergeProps({viewport:r.viewport,factor:(ie=r.weatherLayers)==null?void 0:ie.arctic,"before-layer":o.beforeLayer},a.$attrs),null,16,["viewport","factor","before-layer"]),e.createVNode(Me,e.mergeProps({map:o.map,zone:(le=r.otherLayers)==null?void 0:le["war-zones"],"before-layer":o.beforeLayer},a.$attrs),null,16,["map","zone","before-layer"]),e.createVNode(Ae,e.mergeProps({map:o.map,area:(se=r.otherLayers)==null?void 0:se["gmdss-areas"],"before-layer":o.beforeLayer},a.$attrs),null,16,["map","area","before-layer"]),e.createVNode(ze,e.mergeProps({map:o.map,zone:(ne=r.otherLayers)==null?void 0:ne["eca-zones"],"before-layer":o.beforeLayer},a.$attrs),null,16,["map","zone","before-layer"]),e.createVNode(Oe,e.mergeProps({map:o.map,zone:(ce=r.otherLayers)==null?void 0:ce["alert-zones"],"before-layer":o.beforeLayer},a.$attrs),null,16,["map","zone","before-layer"]),e.createVNode(D,e.mergeProps({map:o.map,port:(de=r.otherLayers)==null?void 0:de.ports,"before-layer":o.beforeLayer},a.$attrs),null,16,["map","port","before-layer"]),e.createVNode(U,e.mergeProps({map:o.map,line:(he=r.otherLayers)==null?void 0:he["load-lines"],"before-layer":o.beforeLayer},a.$attrs),null,16,["map","line","before-layer"]),e.createVNode(H,e.mergeProps({map:o.map,zone:(pe=r.otherLayers)==null?void 0:pe["time-zones"],"before-layer":o.beforeLayer},a.$attrs),null,16,["map","zone","before-layer"]),e.createVNode(L,e.mergeProps({map:o.map,area:(me=r.otherLayers)==null?void 0:me["voluntary-reporting-area"],"before-layer":o.beforeLayer},a.$attrs),null,16,["map","area","before-layer"]),e.createVNode(X,e.mergeProps({map:o.map,area:(ye=r.otherLayers)==null?void 0:ye["special-area"],"before-layer":o.beforeLayer},a.$attrs),null,16,["map","area","before-layer"]),e.createVNode(We,e.mergeProps({map:o.map,area:(ge=r.otherLayers)==null?void 0:ge["day-night"]},a.$attrs),null,16,["map","area"]),e.createVNode(Fe,e.mergeProps({map:o.map,show:r.showCoord},a.$attrs),null,16,["map","show"]),e.createVNode(je,e.mergeProps({map:o.map,show:r.showMeasure},a.$attrs),null,16,["map","show"]),e.createVNode($e,e.mergeProps({map:o.map,show:r.showPoint,meteo:r.meteo},a.$attrs,{onPoint:i.handlePointChange}),null,16,["map","show","meteo","onPoint"])])):e.createCommentVNode("",!0)}const Ss={name:"MapMeteo",components:{MapboxGL:_(xs,[["render",Cs]])},props:{map:{type:Object,default:()=>({})}},emits:["measurable"],data(){return{showPointRpt:!1,pointQuery:{}}},methods:{handleMore(a){this.pointQuery={...a,d:7,st:6}},handleMeasurableChange(a){this.$emit("measurable",a)}}};function _s(a,t,o,l,r,i){const s=e.resolveComponent("MapboxGL");return e.openBlock(),e.createBlock(s,e.mergeProps({map:o.map,token:a.$attrs.token,permission:a.$attrs.permission,top:"32px",bottom:"64px","before-layer":"country-boundaries"},a.$attrs),null,16,["map","token","permission"])}const Xe=G(Ss,[["render",_s]]),jc="",ks={name:"VoyageFleet",components:{ElSelect:$.ElSelect,ElOption:$.ElOption,ElScrollbar:$.ElScrollbar,HideIcon:Z.Hide,ViewIcon:Z.View,UserFilled:Z.UserFilled},props:{token:{type:String},route:{type:Object,default:void 0},weights:{type:Object,default:void 0},toggle:{type:Boolean,default:!0}},emits:["update","select","toggle","hide"],data(){return{listQuery:{vid:void 0,id:void 0,smp:!0,pid:void 0,pn:1,ps:500},list:[],filterList:[],total:0,voyage:void 0,hide:!1,items:[],keyword:void 0,gateway:"https://cbe.idmwx.com"}},watch:{"route.query.vid":{handler(){var a,t;(t=(a=this.route)==null?void 0:a.query)!=null&&t.vid&&this.handleVoyageIdChange()},immediate:!0},keyword:{handler(){this.keyword?(this.filterList=this.list.filter(a=>{var o,l,r,i,s,n,c,p,h,d,y;const t=this.keyword.toLowerCase();return((r=(l=(o=a.vessel)==null?void 0:o.name)==null?void 0:l.toLowerCase())==null?void 0:r.indexOf(t))>-1||((n=(s=(i=a.company)==null?void 0:i.name)==null?void 0:s.toLowerCase())==null?void 0:n.indexOf(t))>-1||((h=(p=(c=a.vessel)==null?void 0:c.imo)==null?void 0:p.toString())==null?void 0:h.indexOf(t))>-1||((y=(d=a.pic)==null?void 0:d.email)==null?void 0:y.indexOf(t))>-1}),this.list=this.list.map(a=>(a.hide=!this.filterList.some(t=>a.id===t.id),a)),this.$emit("update",this.list)):this.filterList=this.list},immediate:!0}},mounted(){this.fetchMyActiveVoyage()},methods:{async handleVoyageIdChange(){var t,o,l,r;await this.fetchMyActiveVoyage(),this.listQuery.id=(o=(t=this.route)==null?void 0:t.query)==null?void 0:o.vid,this.$emit("toggle",!1),this.$emit("select",this.list[0]);const a=(r=(l=this.list[0])==null?void 0:l.vessel)==null?void 0:r.imo;this.keyword=a},async fetchMyActiveVoyage(){var t,o,l,r,i;const a=await j.get(`${this.gateway}/api/rsv/voyages/my/active`,{headers:{Authorization:this.token},params:this.listQuery});((t=a==null?void 0:a.data)==null?void 0:t.code)===0&&(this.list=(l=(o=a.data)==null?void 0:o.data)==null?void 0:l.rows,this.list=this.list.map(s=>(s.hide=!1,s)),this.total=(i=(r=a.data)==null?void 0:r.data)==null?void 0:i.total,this.$emit("update",this.list),this.filterList=this.list)},handleFleetHide(a){this.hide=a,this.$emit("hide",a)},handleChange(){var t,o;const a=this.$data.items.filter(l=>l.id===this.keyword);!this.keyword||((t=a[0])==null?void 0:t.type)==="VESSEL"?(this.listQuery.id=void 0,this.listQuery.pid=void 0,this.listQuery.vid=this.keyword,this.fetchMyActiveVoyage()):((o=a[0])==null?void 0:o.type)==="PIC"&&(this.listQuery.id=void 0,this.listQuery.vid=void 0,this.listQuery.pid=this.keyword,this.fetchMyActiveVoyage())},handleRowClick(a){this.voyage=a,this.$emit("select",a)},handleToggle(a){this.$emit("toggle",a)}}},Ns={class:"main-container"},Vs={class:"search-box"},Ts={class:"active-voyages"},Ds={class:"header-box flex-space"},Ps={class:"voyage-list"},Bs=["onClick"],Rs={class:"vessel-name"},Is={class:"side-bar"},Ms={key:0,class:"iconfont"},As={key:1,class:"iconfont"};function zs(a,t,o,l,r,i){var h;const s=e.resolveComponent("ElInput"),n=e.resolveComponent("ViewIcon"),c=e.resolveComponent("HideIcon"),p=e.resolveComponent("ElScrollbar");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(o.toggle?"voyage-fleet-container":"voyage-fleet-container hidden")},[e.createElementVNode("div",Ns,[e.createElementVNode("div",Vs,[e.createVNode(s,{modelValue:r.keyword,"onUpdate:modelValue":t[0]||(t[0]=d=>r.keyword=d),placeholder:"Vessel / Company / IMO / PIC"},null,8,["modelValue"])]),e.createElementVNode("div",Ts,[e.createElementVNode("div",Ds,[e.createElementVNode("label",null,"Vessels ( "+e.toDisplayString((h=r.filterList)==null?void 0:h.length)+" / "+e.toDisplayString(r.total)+" )",1),r.hide?(e.openBlock(),e.createBlock(c,{key:1,style:{height:"14px",cursor:"pointer"},onClick:t[2]||(t[2]=d=>i.handleFleetHide(!1))})):(e.openBlock(),e.createBlock(n,{key:0,style:{height:"14px",cursor:"pointer"},onClick:t[1]||(t[1]=d=>i.handleFleetHide(!0))}))]),e.createElementVNode("div",Ps,[e.createVNode(p,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.filterList,d=>{var y,m;return e.openBlock(),e.createElementBlock("div",{key:d.id,class:e.normalizeClass(((y=r.voyage)==null?void 0:y.id)===d.id?"flex-space voyage-item active":"flex-space voyage-item"),onClick:u=>i.handleRowClick(d)},[e.createElementVNode("span",Rs,e.toDisplayString((m=d.vessel)==null?void 0:m.name),1),e.createElementVNode("span",{class:e.normalizeClass(`voyage-status ${d.status} ${d.tag>0?"warning":""}`)},e.toDisplayString(d.status),3)],10,Bs)}),128))]),_:1})])]),t[4]||(t[4]=e.createElementVNode("div",{class:"inactive-voyages"},null,-1))]),e.createElementVNode("div",Is,[e.createElementVNode("div",{class:"toggle",onClick:t[3]||(t[3]=d=>i.handleToggle(!o.toggle))},[o.toggle?(e.openBlock(),e.createElementBlock("i",Ms,"")):(e.openBlock(),e.createElementBlock("i",As,""))])])],2)}const Ze=G(ks,[["render",zs],["__scopeId","data-v-f8da55ba"]]),$c="",Os={name:"VoyageDetail",components:{ElProgress:$.ElProgress,ElScrollbar:$.ElScrollbar,ElTooltip:$.ElTooltip},props:{voyageId:{type:String},token:{type:String},weights:{type:Object,default:void 0}},emits:["center","route","line","toggle"],data(){return{voyage:void 0,leg:void 0,toggle:!0,bps:void 0}},computed:{computeWeight(){return function(a,t){return(a&t)>0}},computeIconStyle(){return function(a,t){var l,r,i,s;let o="font-size:18px;";return t==="adverse"&&(a&((r=(l=this.weights)==null?void 0:l.adverse)==null?void 0:r.heavy))>0?o=o+"color:var(--adverse-heavy);":t==="adverse"&&(a&((s=(i=this.weights)==null?void 0:i.adverse)==null?void 0:s.severe))>0?o=o+"color:var(--adverse-severe);":o=o+"color:var(--adverse-heavy);margin-left:5px",o}},computeWayport(){return function(a){return a!=null&&a.name?a==null?void 0:a.name:`${S.LngLatHelper.lat2pretty(a==null?void 0:a.lat,2).pretty},${S.LngLatHelper.lng2pretty(a==null?void 0:a.lng,2).pretty}`}},computeLegProgress(){return function(a){return a?(a==null?void 0:a.sailingDistance)/((a==null?void 0:a.sailingDistance)+(a==null?void 0:a.remainDistance))*100:0}},computeLocalTime(){return function(a,t,o="MMM-DD,HHmm[LT]"){if(a){const l=t!=null&&t.lng&&(t!=null&&t.lat)?S.LngLatHelper.guessTimeZoneOffset(t==null?void 0:t.lng,t==null?void 0:t.lat):0;return N(a).utcOffset(l).format(o)}return"-"}},computeUTCTime(){return function(a,t="MMM-DD,HHmm[Z]"){return a?N(a).utc().format(t):"-"}},computeUpdateTime(){return function(a){return N.unix(a).fromNow()}},computeTimeOffset(){return function(a){const t=a!=null&&a.lng&&(a!=null&&a.lat)?S.LngLatHelper.guessTimeZoneOffset(a==null?void 0:a.lng,a==null?void 0:a.lat):0;return S.LngLatHelper.prettyTimeZoneOffset(t)}},computeCiiDiscountZ(){return function(a){return S.LngLatHelper.roundPrecision(((a==null?void 0:a.ciiRef)-(a==null?void 0:a.discountCii))/(a==null?void 0:a.ciiRef)*100,0)}},computeRoundPrecision(){return function(a,t=4){return S.LngLatHelper.roundPrecision(a,t)}}},watch:{voyageId:{handler(){this.voyageId&&this.fetchVoyage()},immediate:!0}},methods:{async fetchVoyage(){var t,o;const a=await j.get(`https://cbe.idmwx.com/api/rsv/voyages/${this.voyageId}`,{headers:{Authorization:this.token},params:this.listQuery});((t=a==null?void 0:a.data)==null?void 0:t.code)===0&&(this.voyage=a.data.data,this.leg=(o=this.voyage)==null?void 0:o.legs[0],this.toggle=!0,this.fetchLine().then(),this.fetchBPS().then())},async fetchLine(){var a,t,o,l,r,i;if((t=(a=this.leg)==null?void 0:a.line)!=null&&t.id&&((o=this.voyage)==null?void 0:o.status)!=="Ready"){const s=await j.get(`https://cbe.idmwx.com/api/als/lines/${(r=(l=this.leg)==null?void 0:l.line)==null?void 0:r.id}`,{headers:{Authorization:this.token}});((i=s==null?void 0:s.data)==null?void 0:i.code)===0&&this.$emit("line",s.data.data)}else this.$emit("line",{})},async fetchBPS(){var t,o;const a=await j.get(`https://cbe.idmwx.com/api/als/voyages/${this.voyageId}/bps/latest`,{headers:{Authorization:this.token}});((t=a==null?void 0:a.data)==null?void 0:t.code)===0&&(this.bps=(o=a.data)==null?void 0:o.data)},handleCenter(a){this.$emit("center",a)},handleRouteTo(){var a;this.$emit("route",(a=this.voyage)==null?void 0:a.id)},handleToggle(){this.toggle=!this.toggle,this.$emit("toggle",this.toggle)}}},Ws={class:"main-container"},Fs={class:"title flex-space"},js={class:"border-box realtime-ais"},$s={class:"flex-space ais-row"},Us={class:"load"},Hs={class:"type"},Gs={class:"flex-start ais-row"},Xs={class:"text-ellipsis"},Zs={class:"flex-space ais-row"},Ys={class:"flex-space ais-row"},qs={class:"flex-end ais-row"},Js={key:0,class:"border-box active-leg"},Qs={class:"flex-space"},Ks={class:"flex-center line-grogress"},en={class:"flex-space"},tn={class:"wayport sailing"},an={class:"time flex-start"},on={class:"time flex-start"},rn={key:0},ln={key:1},sn={key:2},nn={key:3},cn={class:"distance flex-start"},dn={class:"wayport sailing"},hn={class:"time flex-end"},pn={class:"time flex-end"},mn={key:0},yn={key:1},gn={key:2},fn={key:3},un={class:"distance flex-end"},bn={key:1,class:"border-box active-leg"},wn={class:"border-box bps"},Ln={key:0},vn={class:"flex-space cp"},xn={class:"flex-space based-on"},En={class:"summary"},Cn={class:"flex-space row"},Sn={class:"flex-space row"},_n={class:"flex"},kn={class:"flex"},Nn={class:"flex"},Vn={class:"flex-space row"},Tn={class:"flex"},Dn={class:"flex"},Pn={class:"flex"},Bn={class:"flex-space row"},Rn={class:"flex"},In={class:"flex"},Mn={class:"flex"},An={class:"flex-space row"},zn={class:"flex"},On={class:"flex"},Wn={class:"flex"},Fn={class:"flex-space row"},jn={class:"flex"},$n={class:"flex"},Un={class:"flex"},Hn={class:"flex-space row light"},Gn={class:"flex-space row"},Xn={class:"flex"},Zn={class:"flex"},Yn={class:"flex"},qn={class:"flex-space row"},Jn={class:"flex"},Qn={class:"flex"},Kn={class:"flex"},ec={class:"flex-space row light"},tc={key:0},ac={key:1},oc={key:2},rc={class:"flex-space row"},ic={class:"flex"},lc={class:"flex"},sc={class:"flex"},nc={class:"flex-space row"},cc={class:"flex"},dc={class:"flex"},hc={class:"flex"},pc={class:"flex-space row light"},mc={key:0},yc={key:1},gc={key:2},fc={class:"flex-space row"},uc={style:{flex:"3"}},bc={class:"flex-space row"},wc={style:{flex:"3"}},Lc={key:1,style:{color:"var(--idm-white-7)","margin-top":"20px"}},vc={key:0,class:"side-bar"},xc={key:1,class:"side-bar"};function Ec(a,t,o,l,r,i){var p,h,d,y,m,u,f,g,w,b,v,E,C,V,T,R,A,O,F,q,J,Q,K,ee,te,ae,oe,re,ie,le,se,ne,ce,de,he,pe,me,ye,ge,be,we,Le,ve,xe,Ce,Se,_e,ke,Ne,Ve,Te,De,Pe,Be,Re,Ie,Me,Ae,ze,Oe;const s=e.resolveComponent("ElTooltip"),n=e.resolveComponent("ElProgress"),c=e.resolveComponent("ElScrollbar");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(r.toggle?"voyage-detail-container":"voyage-detail-container hidden")},[e.createElementVNode("div",Ws,[e.createElementVNode("div",Fs,[e.createElementVNode("div",null,[t[6]||(t[6]=e.createElementVNode("label",null,"No.",-1)),e.createElementVNode("span",{class:"link",onClick:t[0]||(t[0]=(...D)=>i.handleRouteTo&&i.handleRouteTo(...D))},[t[5]||(t[5]=e.createElementVNode("i",{class:"iconfont"},"",-1)),e.createTextVNode(e.toDisplayString((p=r.voyage)==null?void 0:p.number),1)]),t[7]||(t[7]=e.createElementVNode("label",{style:{margin:"0 3px"}},"/",-1)),e.createElementVNode("span",null,e.toDisplayString((d=(h=r.voyage)==null?void 0:h.vessel)==null?void 0:d.name),1)]),e.createElementVNode("div",null,[i.computeWeight((y=r.voyage)==null?void 0:y.tag,(m=o.weights)==null?void 0:m.adverse.total)?(e.openBlock(),e.createBlock(s,{key:0,effect:"dark",content:"Adverse Weather",placement:"bottom"},{default:e.withCtx(()=>{var D;return[e.createElementVNode("i",{class:"iconfont",style:e.normalizeStyle(i.computeIconStyle((D=r.voyage)==null?void 0:D.tag,"adverse"))},"",4)]}),_:1})):e.createCommentVNode("",!0),i.computeWeight((u=r.voyage)==null?void 0:u.tag,(f=o.weights)==null?void 0:f.deviation)?(e.openBlock(),e.createBlock(s,{key:1,effect:"dark",content:"Deviation",placement:"bottom"},{default:e.withCtx(()=>{var D;return[e.createElementVNode("i",{class:"iconfont",style:e.normalizeStyle(i.computeIconStyle((D=r.voyage)==null?void 0:D.tag,"deviation"))},"",4)]}),_:1})):e.createCommentVNode("",!0),i.computeWeight((g=r.voyage)==null?void 0:g.tag,(w=o.weights)==null?void 0:w.stoppage)?(e.openBlock(),e.createBlock(s,{key:2,effect:"dark",content:"Stoppage",placement:"bottom"},{default:e.withCtx(()=>{var D;return[e.createElementVNode("i",{class:"iconfont",style:e.normalizeStyle(i.computeIconStyle((D=r.voyage)==null?void 0:D.tag,"stoppage"))},"",4)]}),_:1})):e.createCommentVNode("",!0)])]),e.createElementVNode("div",js,[e.createElementVNode("div",$s,[e.createElementVNode("span",Us,e.toDisplayString(((b=r.voyage)==null?void 0:b.loadCondition)||"-"),1),e.createElementVNode("span",Hs,e.toDisplayString(((v=r.voyage)==null?void 0:v.serviceType)||"-"),1),e.createElementVNode("span",{class:e.normalizeClass("status "+((E=r.voyage)==null?void 0:E.status))},e.toDisplayString(((C=r.voyage)==null?void 0:C.status)||"-"),3)]),e.createElementVNode("div",Gs,[t[8]||(t[8]=e.createElementVNode("label",null,"Company",-1)),e.createElementVNode("span",Xs,e.toDisplayString((T=(V=r.voyage)==null?void 0:V.company)==null?void 0:T.name)+" ("+e.toDisplayString((A=(R=r.voyage)==null?void 0:R.company)==null?void 0:A.code)+")",1)]),e.createElementVNode("div",Zs,[e.createElementVNode("div",null,[t[9]||(t[9]=e.createElementVNode("label",null,"SOG",-1)),e.createElementVNode("span",null,e.toDisplayString(i.computeRoundPrecision((q=(F=(O=r.voyage)==null?void 0:O.vessel)==null?void 0:F.ais)==null?void 0:q.sog,1))+"kts",1)]),e.createElementVNode("div",null,[t[10]||(t[10]=e.createElementVNode("label",null,"COG",-1)),e.createElementVNode("span",null,e.toDisplayString(i.computeRoundPrecision((K=(Q=(J=r.voyage)==null?void 0:J.vessel)==null?void 0:Q.ais)==null?void 0:K.cog,0))+"deg",1)]),e.createElementVNode("div",null,[t[11]||(t[11]=e.createElementVNode("label",null,"Draught",-1)),e.createElementVNode("span",null,e.toDisplayString(i.computeRoundPrecision((ae=(te=(ee=r.voyage)==null?void 0:ee.vessel)==null?void 0:te.ais)==null?void 0:ae.draught,1))+"m",1)])]),e.createElementVNode("div",Ys,[e.createElementVNode("div",null,[t[12]||(t[12]=e.createElementVNode("label",null,"IMO",-1)),e.createElementVNode("span",null,e.toDisplayString((ie=(re=(oe=r.voyage)==null?void 0:oe.vessel)==null?void 0:re.ais)==null?void 0:ie.imo),1)]),e.createElementVNode("div",null,[t[13]||(t[13]=e.createElementVNode("label",null,"MMSI",-1)),e.createElementVNode("span",null,e.toDisplayString((ne=(se=(le=r.voyage)==null?void 0:le.vessel)==null?void 0:se.ais)==null?void 0:ne.mmsi),1)])]),e.createElementVNode("div",qs,[e.createElementVNode("span",null,"Updated at "+e.toDisplayString(i.computeUpdateTime((he=(de=(ce=r.voyage)==null?void 0:ce.vessel)==null?void 0:de.ais)==null?void 0:he.positionTime)),1)])]),r.leg?(e.openBlock(),e.createElementBlock("div",Js,[e.createElementVNode("div",Qs,[e.createElementVNode("div",{class:"wayport text-ellipsis",style:{"text-align":"left"},onClick:t[1]||(t[1]=D=>{var U,H,L,X;return i.handleCenter({position:[(H=(U=r.leg)==null?void 0:U.departure)==null?void 0:H.lng,(X=(L=r.leg)==null?void 0:L.departure)==null?void 0:X.lat],flyTo:!0})})},e.toDisplayString(i.computeWayport((pe=r.leg)==null?void 0:pe.departure)),1),e.createElementVNode("div",{class:"wayport text-ellipsis",style:{"text-align":"right"},onClick:t[2]||(t[2]=D=>{var U,H,L,X;return i.handleCenter({position:[(H=(U=r.leg)==null?void 0:U.destination)==null?void 0:H.lng,(X=(L=r.leg)==null?void 0:L.destination)==null?void 0:X.lat],flyTo:!0})})},e.toDisplayString(i.computeWayport((me=r.leg)==null?void 0:me.destination)),1)]),e.createElementVNode("div",Ks,[e.createVNode(n,{percentage:i.computeLegProgress((ye=r.leg)==null?void 0:ye.line),"show-text":!1,style:{width:"100%"},color:"var(--idm-success-color)"},null,8,["percentage"])]),e.createElementVNode("div",en,[e.createElementVNode("div",tn,[e.createElementVNode("div",an,[t[14]||(t[14]=e.createElementVNode("label",null,"UTC Offset",-1)),e.createElementVNode("span",null,e.toDisplayString(i.computeTimeOffset((ge=r.leg)==null?void 0:ge.departure)),1)]),e.createElementVNode("div",on,[(be=r.leg)!=null&&be.atd?(e.openBlock(),e.createElementBlock("label",rn,"ATD")):(e.openBlock(),e.createElementBlock("label",ln,"ETD")),(we=r.leg)!=null&&we.atd?(e.openBlock(),e.createElementBlock("span",sn,e.toDisplayString(i.computeLocalTime((Le=r.leg)==null?void 0:Le.atd,(ve=r.leg)==null?void 0:ve.departure)),1)):(e.openBlock(),e.createElementBlock("span",nn,e.toDisplayString(i.computeLocalTime((xe=r.leg)==null?void 0:xe.etd,(Ce=r.leg)==null?void 0:Ce.departure)),1))]),e.createElementVNode("div",cn,[e.createElementVNode("span",null,[t[15]||(t[15]=e.createElementVNode("i",{class:"iconfont"},"",-1)),e.createTextVNode(e.toDisplayString(i.computeRoundPrecision((_e=(Se=r.leg)==null?void 0:Se.line)==null?void 0:_e.sailingTime,0))+"hrs",1)]),t[17]||(t[17]=e.createElementVNode("label",null,"/",-1)),e.createElementVNode("span",null,[t[16]||(t[16]=e.createElementVNode("i",{class:"iconfont"},"",-1)),e.createTextVNode(e.toDisplayString(i.computeRoundPrecision((Ne=(ke=r.leg)==null?void 0:ke.line)==null?void 0:Ne.sailingDistance,0))+"nm",1)])])]),e.createElementVNode("div",dn,[e.createElementVNode("div",hn,[t[18]||(t[18]=e.createElementVNode("label",null,"UTC Offset",-1)),e.createElementVNode("span",null,e.toDisplayString(i.computeTimeOffset((Ve=r.leg)==null?void 0:Ve.destination)),1)]),e.createElementVNode("div",pn,[(Te=r.leg)!=null&&Te.ata?(e.openBlock(),e.createElementBlock("label",mn,"ATA")):(e.openBlock(),e.createElementBlock("label",yn,"ETA")),(De=r.leg)!=null&&De.ata?(e.openBlock(),e.createElementBlock("span",gn,e.toDisplayString(i.computeLocalTime((Pe=r.leg)==null?void 0:Pe.ata,(Be=r.leg)==null?void 0:Be.destination)),1)):(e.openBlock(),e.createElementBlock("span",fn,e.toDisplayString(i.computeLocalTime((Re=r.leg)==null?void 0:Re.eta,(Ie=r.leg)==null?void 0:Ie.destination)),1))]),e.createElementVNode("div",un,[e.createElementVNode("span",null,[t[19]||(t[19]=e.createElementVNode("i",{class:"iconfont"},"",-1)),e.createTextVNode(e.toDisplayString(i.computeRoundPrecision((Ae=(Me=r.leg)==null?void 0:Me.line)==null?void 0:Ae.remainTime,0))+"hrs",1)]),t[21]||(t[21]=e.createElementVNode("label",null,"/",-1)),e.createElementVNode("span",null,[t[20]||(t[20]=e.createElementVNode("i",{class:"iconfont"},"",-1)),e.createTextVNode(e.toDisplayString(i.computeRoundPrecision((Oe=(ze=r.leg)==null?void 0:ze.line)==null?void 0:Oe.remainDistance,0))+"nm",1)])])])])])):(e.openBlock(),e.createElementBlock("div",bn,t[22]||(t[22]=[e.createElementVNode("div",{class:"flex-space",style:{color:"var(--idm-white-7)"}},"No Active Leg For Now!",-1)]))),e.createElementVNode("div",wn,[t[51]||(t[51]=e.createElementVNode("div",null,[e.createElementVNode("span",null,[e.createTextVNode("Performance since BOSP"),e.createElementVNode("i",{class:"iconfont",style:{"margin-left":"3px"}},"")])],-1)),e.createVNode(c,{class:"bps-scrollbar"},{default:e.withCtx(()=>{var D,U,H;return[(U=(D=r.bps)==null?void 0:D.segments)!=null&&U.length?(e.openBlock(),e.createElementBlock("section",Ln,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList((H=r.bps)==null?void 0:H.segments,(L,X)=>{var We,Fe,je,$e,fe,tt,at,ot,rt,it,lt,st,nt,ct,dt,ht,pt,mt,yt,gt,ft,ut,bt,wt,Lt,vt,xt,Et,Ct,St,_t,kt,Nt,Vt,Tt,Dt,Pt,Bt,Rt,It,Mt,At,zt,Ot,Wt,Ft,jt,$t,Ut,Ht,Gt,Xt,Zt,Yt,qt,Jt,Qt,Kt,ea,ta,aa,oa,ra,ia,la,sa,na,ca,da,ha,pa,ma,ya,ga,fa,ua,ba,wa,La,va,xa,Ea,Ca,Sa,_a,ka,Na,Va,Ta,Da,Pa,Ba,Ra,Ia,Ma;return e.openBlock(),e.createElementBlock("div",{key:X,class:"border-box"},[e.createElementVNode("div",null,[e.createElementVNode("span",null,"Seg "+e.toDisplayString(L.seg),1)]),e.createElementVNode("div",vn,[t[23]||(t[23]=e.createElementVNode("label",null,"CP",-1)),e.createElementVNode("span",null,e.toDisplayString((Fe=(We=L.extend)==null?void 0:We.cp)==null?void 0:Fe.loadCondition),1),e.createElementVNode("span",null,e.toDisplayString(($e=(je=L.extend)==null?void 0:je.cp)==null?void 0:$e.type),1),e.createElementVNode("span",null,"SPD "+e.toDisplayString((tt=(fe=L.extend)==null?void 0:fe.cp)==null?void 0:tt.speed)+"kts",1),e.createElementVNode("span",null,"FO "+e.toDisplayString((ot=(at=L.extend)==null?void 0:at.cp)==null?void 0:ot.fo)+"mt",1),e.createElementVNode("span",null,"GO "+e.toDisplayString((it=(rt=L.extend)==null?void 0:rt.cp)==null?void 0:it.dgo)+"mt",1)]),e.createElementVNode("div",xn,[t[24]||(t[24]=e.createElementVNode("label",null,"Based on",-1)),e.createElementVNode("span",null,e.toDisplayString((nt=(st=(lt=L.extend)==null?void 0:lt.segTimes[0])==null?void 0:st.departure)==null?void 0:nt.noonType)+" "+e.toDisplayString(i.computeUTCTime((ht=(dt=(ct=L.extend)==null?void 0:ct.segTimes[0])==null?void 0:dt.departure)==null?void 0:ht.utcTime)),1),t[25]||(t[25]=e.createElementVNode("span",null,"~~",-1)),e.createElementVNode("span",null,e.toDisplayString((yt=(mt=(pt=L.extend)==null?void 0:pt.segTimes[0])==null?void 0:mt.arrival)==null?void 0:yt.noonType)+" "+e.toDisplayString(i.computeUTCTime((ut=(ft=(gt=L.extend)==null?void 0:gt.segTimes[0])==null?void 0:ft.arrival)==null?void 0:ut.utcTime)),1)]),e.createElementVNode("div",En,[t[49]||(t[49]=e.createElementVNode("div",{class:"flex-space row"},[e.createElementVNode("div",{class:"flex label"}),e.createElementVNode("div",{class:"flex"},"Entire"),e.createElementVNode("div",{class:"flex"},"Good Wx"),e.createElementVNode("div",{class:"flex"},"Adverse Wx")],-1)),e.createElementVNode("div",Cn,[t[26]||(t[26]=e.createElementVNode("div",{class:"flex label"},[e.createElementVNode("label",null,"CII")],-1)),e.createElementVNode("div",{class:e.normalizeClass("flex cii "+((wt=(bt=L.allWxCii)==null?void 0:bt.ciiLevel)==null?void 0:wt.toLowerCase()))},e.toDisplayString((Lt=L.allWxCii)==null?void 0:Lt.ciiLevel)+" "+e.toDisplayString((vt=L.allWxCii)==null?void 0:vt.cii),3),e.createElementVNode("div",{class:e.normalizeClass("flex cii "+((Et=(xt=L.goodWxCii)==null?void 0:xt.ciiLevel)==null?void 0:Et.toLowerCase()))},e.toDisplayString((Ct=L.goodWxCii)==null?void 0:Ct.ciiLevel)+" "+e.toDisplayString((St=L.goodWxCii)==null?void 0:St.cii),3),e.createElementVNode("div",{class:e.normalizeClass("flex cii "+((kt=(_t=L.badWxCii)==null?void 0:_t.ciiLevel)==null?void 0:kt.toLowerCase()))},e.toDisplayString((Nt=L.badWxCii)==null?void 0:Nt.ciiLevel)+" "+e.toDisplayString((Vt=L.badWxCii)==null?void 0:Vt.cii),3)]),e.createElementVNode("div",Sn,[t[27]||(t[27]=e.createElementVNode("div",{class:"flex label"},[e.createElementVNode("label",null,"Distance(nm)")],-1)),e.createElementVNode("div",_n,e.toDisplayString(((Tt=L.allWx)==null?void 0:Tt.distance)||"-"),1),e.createElementVNode("div",kn,e.toDisplayString(((Dt=L.goodWx)==null?void 0:Dt.distance)||"-"),1),e.createElementVNode("div",Nn,e.toDisplayString(((Pt=L.badWx)==null?void 0:Pt.distance)||"-"),1)]),e.createElementVNode("div",Vn,[t[28]||(t[28]=e.createElementVNode("div",{class:"flex label"},[e.createElementVNode("label",null,"Time(hrs)")],-1)),e.createElementVNode("div",Tn,e.toDisplayString(((Bt=L.allWx)==null?void 0:Bt.time)||"-"),1),e.createElementVNode("div",Dn,e.toDisplayString(((Rt=L.goodWx)==null?void 0:Rt.time)||"-"),1),e.createElementVNode("div",Pn,e.toDisplayString(((It=L.badWx)==null?void 0:It.time)||"-"),1)]),e.createElementVNode("div",Bn,[t[29]||(t[29]=e.createElementVNode("div",{class:"flex label"},[e.createElementVNode("label",null,"Avg.Spd(kts)")],-1)),e.createElementVNode("div",Rn,e.toDisplayString(((Mt=L.allWx)==null?void 0:Mt.avgSpd)||"-"),1),e.createElementVNode("div",In,e.toDisplayString(((At=L.goodWx)==null?void 0:At.avgSpd)||"-"),1),e.createElementVNode("div",Mn,e.toDisplayString(((zt=L.badWx)==null?void 0:zt.avgSpd)||"-"),1)]),e.createElementVNode("div",An,[t[30]||(t[30]=e.createElementVNode("div",{class:"flex label"},[e.createElementVNode("label",null,"Weather Factor(kts)")],-1)),e.createElementVNode("div",zn,e.toDisplayString(((Ot=L.allWx)==null?void 0:Ot.avgWf)||"-"),1),e.createElementVNode("div",On,e.toDisplayString(((Wt=L.goodWx)==null?void 0:Wt.avgWf)||"-"),1),e.createElementVNode("div",Wn,e.toDisplayString(((Ft=L.badWx)==null?void 0:Ft.avgWf)||"-"),1)]),e.createElementVNode("div",Fn,[t[31]||(t[31]=e.createElementVNode("div",{class:"flex label"},[e.createElementVNode("label",null,"Current Factor(kts)")],-1)),e.createElementVNode("div",jn,e.toDisplayString(((jt=L.allWx)==null?void 0:jt.avgCf)||"-"),1),e.createElementVNode("div",$n,e.toDisplayString((($t=L.goodWx)==null?void 0:$t.avgCf)||"-"),1),e.createElementVNode("div",Un,e.toDisplayString(((Ut=L.badWx)==null?void 0:Ut.avgCf)||"-"),1)]),e.createElementVNode("div",Hn,[t[32]||(t[32]=e.createElementVNode("div",{class:"flex label"},[e.createElementVNode("label",null,"Perf.Spd(kts)")],-1)),e.createElementVNode("div",{class:e.normalizeClass("flex spd "+((Gt=(Ht=L.allWx)==null?void 0:Ht.pfmStatus)==null?void 0:Gt.toLowerCase()))},e.toDisplayString(((Xt=L.allWx)==null?void 0:Xt.pfmSpd)||"-"),3),e.createElementVNode("div",{class:e.normalizeClass("flex spd "+((Yt=(Zt=L.goodWx)==null?void 0:Zt.pfmStatus)==null?void 0:Yt.toLowerCase()))},e.toDisplayString(((qt=L.goodWx)==null?void 0:qt.pfmSpd)||"-"),3),e.createElementVNode("div",{class:e.normalizeClass("flex spd "+((Qt=(Jt=L.badWx)==null?void 0:Jt.pfmStatus)==null?void 0:Qt.toLowerCase()))},e.toDisplayString(((Kt=L.badWx)==null?void 0:Kt.pfmSpd)||"-"),3)]),e.createElementVNode("div",Gn,[t[33]||(t[33]=e.createElementVNode("div",{class:"flex label"},[e.createElementVNode("label",null,"Avg.Fo.Cons(mt/day)")],-1)),e.createElementVNode("div",Xn,e.toDisplayString(((ea=L.allWx)==null?void 0:ea.avgFoCons)||"-"),1),e.createElementVNode("div",Zn,e.toDisplayString(((ta=L.goodWx)==null?void 0:ta.avgFoCons)||"-"),1),e.createElementVNode("div",Yn,e.toDisplayString(((aa=L.badWx)==null?void 0:aa.avgFoCons)||"-"),1)]),e.createElementVNode("div",qn,[t[34]||(t[34]=e.createElementVNode("div",{class:"flex label"},[e.createElementVNode("label",null,"TTL.Fo.Cons(mt)")],-1)),e.createElementVNode("div",Jn,e.toDisplayString(((oa=L.allWx)==null?void 0:oa.sumFoCons)||"-"),1),e.createElementVNode("div",Qn,e.toDisplayString(((ra=L.goodWx)==null?void 0:ra.sumFoCons)||"-"),1),e.createElementVNode("div",Kn,e.toDisplayString(((ia=L.badWx)==null?void 0:ia.sumFoCons)||"-"),1)]),e.createElementVNode("div",ec,[t[38]||(t[38]=e.createElementVNode("div",{class:"flex label"},[e.createElementVNode("label",null,"Fo Conclusion")],-1)),e.createElementVNode("div",{style:{flex:"3"},class:e.normalizeClass("fo-dgo "+((na=(sa=(la=L.fuelConclusion)==null?void 0:la.fo)==null?void 0:sa.conclusionStatus)==null?void 0:na.toLowerCase()))},[((da=(ca=L.fuelConclusion)==null?void 0:ca.fo)==null?void 0:da.conclusionStatus)==="Over"?(e.openBlock(),e.createElementBlock("span",tc,[e.createElementVNode("b",null,e.toDisplayString((pa=(ha=L.fuelConclusion)==null?void 0:ha.fo)==null?void 0:pa.overCons),1),t[35]||(t[35]=e.createElementVNode("span",null,"MT Over-consumption",-1))])):((ya=(ma=L.fuelConclusion)==null?void 0:ma.fo)==null?void 0:ya.conclusionStatus)==="No"?(e.openBlock(),e.createElementBlock("span",ac,t[36]||(t[36]=[e.createElementVNode("span",null,"No Fuel Oil Over-consumption/Saving",-1)]))):(e.openBlock(),e.createElementBlock("span",oc,[e.createElementVNode("b",null,e.toDisplayString((fa=(ga=L.fuelConclusion)==null?void 0:ga.fo)==null?void 0:fa.saving),1),t[37]||(t[37]=e.createElementVNode("span",null,"MT Saving",-1))]))],2)]),e.createElementVNode("div",rc,[t[39]||(t[39]=e.createElementVNode("div",{class:"flex label"},[e.createElementVNode("label",null,"Avg.Do.Cons(mt/day)")],-1)),e.createElementVNode("div",ic,e.toDisplayString(((ua=L.allWx)==null?void 0:ua.avgDgoCons)||"-"),1),e.createElementVNode("div",lc,e.toDisplayString(((ba=L.goodWx)==null?void 0:ba.avgDgoCons)||"-"),1),e.createElementVNode("div",sc,e.toDisplayString(((wa=L.badWx)==null?void 0:wa.avgDgoCons)||"-"),1)]),e.createElementVNode("div",nc,[t[40]||(t[40]=e.createElementVNode("div",{class:"flex label"},[e.createElementVNode("label",null,"TTL.Do.Cons(mt)")],-1)),e.createElementVNode("div",cc,e.toDisplayString(((La=L.allWx)==null?void 0:La.sumDgoCons)||"-"),1),e.createElementVNode("div",dc,e.toDisplayString(((va=L.goodWx)==null?void 0:va.sumDgoCons)||"-"),1),e.createElementVNode("div",hc,e.toDisplayString(((xa=L.badWx)==null?void 0:xa.sumDgoCons)||"-"),1)]),e.createElementVNode("div",pc,[t[44]||(t[44]=e.createElementVNode("div",{class:"flex label"},[e.createElementVNode("label",null,"Do Conclusion")],-1)),e.createElementVNode("div",{style:{flex:"3"},class:e.normalizeClass("fo-dgo "+((Sa=(Ca=(Ea=L.fuelConclusion)==null?void 0:Ea.dgo)==null?void 0:Ca.conclusionStatus)==null?void 0:Sa.toLowerCase()))},[((ka=(_a=L.fuelConclusion)==null?void 0:_a.dgo)==null?void 0:ka.conclusionStatus)==="Over"?(e.openBlock(),e.createElementBlock("span",mc,[e.createElementVNode("b",null,e.toDisplayString((Va=(Na=L.fuelConclusion)==null?void 0:Na.dgo)==null?void 0:Va.overCons),1),t[41]||(t[41]=e.createElementVNode("span",null,"MT Over-consumption",-1))])):((Da=(Ta=L.fuelConclusion)==null?void 0:Ta.dgo)==null?void 0:Da.conclusionStatus)==="No"?(e.openBlock(),e.createElementBlock("span",yc,t[42]||(t[42]=[e.createElementVNode("span",null,"No Fuel Oil Over-consumption/Saving",-1)]))):(e.openBlock(),e.createElementBlock("span",gc,[e.createElementVNode("b",null,e.toDisplayString((Ba=(Pa=L.fuelConclusion)==null?void 0:Pa.dgo)==null?void 0:Ba.saving),1),t[43]||(t[43]=e.createElementVNode("span",null,"MT Saving",-1))]))],2)]),t[50]||(t[50]=e.createElementVNode("div",{class:"flex-center row"},[e.createElementVNode("div",{style:{"font-weight":"300",color:"var(--idm-white-6)"}},"Appendix")],-1)),e.createElementVNode("div",fc,[t[46]||(t[46]=e.createElementVNode("div",{class:"flex"},[e.createElementVNode("label",null,[e.createTextVNode("CII"),e.createElementVNode("sub",null,"ref")])],-1)),e.createElementVNode("div",uc,[e.createTextVNode(e.toDisplayString((Ra=L.allWxCii)==null?void 0:Ra.ciiRef),1),t[45]||(t[45]=e.createElementVNode("sub",{style:{"margin-left":"2px"}},"[2019]",-1))])]),e.createElementVNode("div",bc,[t[48]||(t[48]=e.createElementVNode("div",{class:"flex"},[e.createElementVNode("label",null,[e.createTextVNode("CII"),e.createElementVNode("sub",null,"discount")])],-1)),e.createElementVNode("div",wc,[e.createTextVNode(e.toDisplayString((Ia=L.allWxCii)==null?void 0:Ia.discountCii)+"="+e.toDisplayString((Ma=L.allWxCii)==null?void 0:Ma.ciiRef),1),t[47]||(t[47]=e.createElementVNode("sub",{style:{"margin-left":"2px"}},"[2019]",-1)),e.createTextVNode(" * (1 - "+e.toDisplayString(i.computeCiiDiscountZ(L.allWxCii))+"/100) ",1)])])])])}),128))])):(e.openBlock(),e.createElementBlock("div",Lc,"No Performance For Now!"))]}),_:1})])]),r.toggle?(e.openBlock(),e.createElementBlock("div",vc,[e.createElementVNode("div",{class:"menu-item toggle",onClick:t[3]||(t[3]=(...D)=>i.handleToggle&&i.handleToggle(...D))},t[52]||(t[52]=[e.createElementVNode("i",{class:"iconfont"},"",-1)])),t[53]||(t[53]=e.createElementVNode("div",{class:"menu-item"},[e.createElementVNode("i",{class:"iconfont"},""),e.createElementVNode("span",null,"Summary")],-1))])):(e.openBlock(),e.createElementBlock("div",xc,[e.createElementVNode("div",{class:"menu-item toggle",onClick:t[4]||(t[4]=(...D)=>i.handleToggle&&i.handleToggle(...D))},t[54]||(t[54]=[e.createElementVNode("i",{class:"iconfont"},"",-1)]))]))],2)}const Ye=G(Os,[["render",Ec],["__scopeId","data-v-0b0cbe04"]]),Cc={install(a){a.component("VoyageFleet",Ze),a.component("VoyageDetail",Ye)}},Sc={name:"MapVoyage",components:{VoyageDetail:Ye},props:{map:{type:Object},voyages:{type:Array},voyageId:{type:String},hide:{type:Boolean,default:!1}},emits:["link","center"],data(){return{showDetail:!1,layer:"active-voyage-layer",source:"active-voyage-source"}},watch:{voyages:{handler(){var a,t;this.voyages?((a=this.map)==null||a.on("click",[this.layer],this.handleClick),this.handleRender()):((t=this.map)==null||t.off("click",[this.layer],this.handleClick),this.handleClear())}},voyageId:{handler(){this.voyageId?this.showDetail=!0:this.showDetail=!0}},hide:{handler(){var t,o,l;const a=(o=(t=this.map)==null?void 0:t.getSource(this.source)._data)==null?void 0:o.features;this.hide?a.forEach(r=>r.properties.hide=!0):a.forEach(r=>r.properties.hide=!1),(l=this.map)==null||l.getSource(this.source).setData(x.featureCollection(a))}}},methods:{handleRender(){var o;const a=[];(o=this.voyages)==null||o.forEach(l=>{var i,s;const r=l.vessel;if((i=r==null?void 0:r.ais)!=null&&i.lat&&((s=r==null?void 0:r.ais)!=null&&s.lng)){const n=this.parseVesselType(r.vesselType),c=x.point([r.ais.lng,r.ais.lat],{cog:r.ais.cog,name:r.name,type:n,icon:l.status.toLowerCase(),status:l.status,voyageId:l.id,hide:l.hide});a.push(c)}});const t=x.featureCollection(a);this.map.getSource(this.source)?this.map.getSource(this.source).setData(t):(this.map.addSource(this.source,{type:"geojson",data:t}),this.map.addLayer({id:this.layer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["==","hide",!1]],layout:{"icon-allow-overlap":!0,"icon-ignore-placement":!0,"icon-image":"vessel-{icon}","icon-size":{base:.8,stops:[[2,.6],[6,.8]]},"icon-rotate":{property:"cog",stops:[[0,0],[360,360]]},"icon-rotation-alignment":"map","symbol-placement":"point","text-optional":!0,"text-field":"{name}","text-rotation-alignment":"viewport","text-size":13,"text-offset":[0,1.4],"text-allow-overlap":!1},paint:{"icon-opacity":1,"text-color":"white","text-halo-color":["match",["get","status"],"Underway","#398626","Ready","#67C23A","Reached","#DE8600","#67C23A"],"text-halo-width":4}}))},handleClear(){this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source)},parseVesselType(a){var s;let t="other";const o=(s=a==null?void 0:a.name)==null?void 0:s.toUpperCase(),l=["Combination carrier".toUpperCase(),"Ro-ro cargo ship(vehicle carrier)".toUpperCase(),"General cargo ship".toUpperCase(),"Container ship".toUpperCase(),"Refrigerated cargo carrier".toUpperCase(),"Bulk carrier".toUpperCase(),"Ro-ro cargo ship".toUpperCase()],r=["LNG carrier".toUpperCase(),"Gas carrier".toUpperCase(),"Tanker".toUpperCase()],i=["Ro-ro passenger ship".toUpperCase(),"Cruise passenger ship".toUpperCase()];return l.includes(o)?t="cargo":r.includes(o)?t="tanker":i.includes(o)&&(t="passenger"),t},handleClick(a){const o=a.features[0].properties.voyageId;this.handleLink(o)},handleLink(a){var o,l,r,i,s;const t=(o=this.voyages)==null?void 0:o.filter(n=>n.id===a)[0];this.handleCenter({position:[(r=(l=t==null?void 0:t.vessel)==null?void 0:l.ais)==null?void 0:r.lng,(s=(i=t==null?void 0:t.vessel)==null?void 0:i.ais)==null?void 0:s.lat],flyTo:!0}),this.$emit("link",a)},handleCenter(a){this.$emit("center",a)}}},_c={class:"map-voyage-fleet"};function kc(a,t,o,l,r,i){const s=e.resolveComponent("VoyageDetail");return e.openBlock(),e.createElementBlock("div",_c,[r.showDetail?(e.openBlock(),e.createBlock(s,e.mergeProps({key:0,"voyage-id":o.voyageId},a.$attrs,{onCenter:i.handleCenter}),null,16,["voyage-id","onCenter"])):e.createCommentVNode("",!0)])}const qe=G(Sc,[["render",kc]]),Nc={name:"MapLine",props:{line:{type:Object,default:()=>({})},map:{type:Object,default:()=>{}}},emits:[],data(){return{pointLayer:"voyage-line-point-layer",layer:"voyage-line-layer",layerBorder:"voyage-line-layer-border",arrowLayer:"voyage-line-layer-arrow",source:"voyage-line-source"}},watch:{"line.version":{handler(){this.line?this.handleRender():this.handleClear()}}},methods:{handleRender(){var r,i,s,n,c,p,h;const a=[],t=(i=(r=this.line)==null?void 0:r.remain)==null?void 0:i.route;t==null||t.forEach(d=>{const y=x.lineString(d,{type:"remain"});a.push(y)});let o=(n=(s=this.line)==null?void 0:s.remain)==null?void 0:n.waypoints;if(o==null||o.forEach(d=>{const y=x.point([d.lng,d.lat],{...d});a.push(y)}),o=(p=(c=this.line)==null?void 0:c.sailing)==null?void 0:p.waypoints,(o==null?void 0:o.length)>1){const d=S.LaneHelper.generateRouteAccordingToWaypoints(o);for(const y of d)y.length>1&&a.push(x.lineString(y,{type:"sailing"}))}const l=x.featureCollection(a);if(this.map.getSource(this.source))this.map.getSource(this.source).setData(l);else{this.map.addSource(this.source,{type:"geojson",data:l}),(h=this.map)==null||h.addLayer({id:this.layerBorder,type:"line",source:this.source,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fff","line-width":7,"line-opacity":.6}}),this.map.addLayer({id:this.layer,type:"line",source:this.source,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["match",["get","type"],"sailing","#f44336","remain","#0000ff","#0000ff"],"line-width":5,"line-opacity":1,"line-dasharray":["case",["==",["get","type"],"sailing"],["literal",[1,0]],["==",["get","type"],"remain"],["literal",[2,2]],["literal",[2,2]]]}}),this.map.addLayer({id:this.pointLayer,type:"circle",source:this.source,filter:["==","$type","Point"],paint:{"circle-color":"#0000ff","circle-radius":5,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}});const d='',y="data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(d)));let m=new Image(20,20);m.src=y,m.onload=()=>{this.map.addImage("arrowIcon",m),this.map.addLayer({id:this.arrowLayer,type:"symbol",source:this.source,filter:["all",["==","$type","LineString"],["==","type","sailing"]],layout:{"symbol-placement":"line","symbol-spacing":50,"icon-image":"arrowIcon","icon-size":.5}})}}},handleClear(){this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getLayer(this.layerBorder)&&this.map.removeLayer(this.layerBorder),this.map.getLayer(this.arrowLayer)&&this.map.removeLayer(this.arrowLayer),this.map.getLayer(this.pointLayer)&&this.map.removeLayer(this.pointLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Vc(a,t,o,l,r,i){return e.openBlock(),e.createElementBlock("div")}const Je=G(Nc,[["render",Vc]]),Tc={name:"MapSpeed",components:{},props:{map:{type:Object},speed:{type:Object},realTime:{type:Object}},data(){return{etd:void 0,source:"speed-source",layer:"speed-layer",layerBorder:"speed-layer-border",iconLayer:"speed-icon-layer"}},computed:{},watch:{"speed.version":{handler(){this.speed&&this.handlerRender()}},realTime:{handler(){var a;(a=this.realTime)!=null&&a.isSameOrAfter(this.etd)&&this.handleJump()}}},methods:{handlerRender(){this.etd=N(this.speed.etd);const a=x.featureCollection([]);this.map&&this.drawLayer(a)},handleClear(){this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getLayer(this.layerBorder)&&this.map.removeLayer(this.layerBorder),this.map.getSource(this.source)&&this.map.removeSource(this.source),this.etd=void 0},drawLayer(a){if(this.map.getSource(this.source))this.map.getSource(this.source).setData(a);else{this.map.addSource(this.source,{type:"geojson",data:a});const t="#f44336";this.map.addLayer({id:this.layerBorder,type:"line",source:this.source,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fff","line-width":7,"line-opacity":.6}}),this.map.addLayer({id:this.layer,type:"line",source:this.source,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":t,"line-width":5,"line-opacity":1,"line-dasharray":[2,2]}});const o=` `,l="data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(o)));let r=new Image(40,40);r.src=l,r.onload=()=>{this.map.addImage("vesselActiveIcon",r),this.map.addLayer({id:this.iconLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-image":"vesselActiveIcon","icon-size":{base:1,stops:[[2,1],[6,1.2]]},"icon-allow-overlap":!0,"icon-ignore-placement":!0,"icon-rotation-alignment":"map","icon-rotate":{property:"cog",stops:[[0,0],[360,360]]},"text-field":["format",["get","spd"],{"font-scale":1.1}],"text-rotation-alignment":"map","text-line-height":1.3,"text-size":14,"text-offset":[0,-2]},paint:{"icon-opacity":1,"text-color":"#0000ff","text-halo-color":"#fff","text-halo-width":1}})}}},handleJump(){var a,t,o,l,r;if((a=this.speed)!=null&&a.items){const i=[];for(const s of(t=this.speed)==null?void 0:t.items)if((l=(o=s==null?void 0:s.sample)==null?void 0:o.hours)!=null&&l.length){let n=N(s.sample.hours.at(-1).eta);n=this.realTime.isAfter(n)?n:this.realTime;let c=s.sample.hours.findIndex(h=>N(h.eta).isSame(this.realTime));c<0&&(c=s.sample.hours.findIndex(h=>N(h.eta).isAfter(this.realTime)),c=c<0?s.sample.hours.length-1:c-1);const p=s.sample.hours[c];if(p){const h=s.sample.hours[0];let d=p;const y=n.diff(N(p.etd),"hour",!0);if(y>0){const g=S.LaneHelper.calculateSubRoute(p,s.route);d=(r=S.LaneHelper.calculateNextCoordinateAlongRoute(p,p.speed*y,g))==null?void 0:r.coordinate}const m=S.LaneHelper.calculateRangeWaypoints(h,d,s.route),u=S.LaneHelper.generateRouteAccordingToWaypoints(m);for(const g of u)g.length>1&&i.push(x.lineString(g));const f=x.point([d.lng,d.lat],{icon:"vessel-active",cog:d.bearing,spd:`${p.speed??"-"} kts`});i.push(f)}}this.drawLayer(x.featureCollection(i))}}}};function Dc(a,t,o,l,r,i){return e.openBlock(),e.createElementBlock("div")}const Qe=G(Tc,[["render",Dc]]),Uc="",Pc={name:"MapIndex",components:{MapSpeed:Qe,MapTimeline:He,MapInitial:Ue,MapMeteo:Xe,MapVoyage:qe,MapLine:Je,VoyageFleet:Ze},props:{token:{type:String},mapboxStyle:{type:String,default:"mapbox://styles/neatchenheng/clxwst0tq00wd01rn0usb2eer"},mapboxToken:{type:String,default:"pk.eyJ1IjoibmVhdGNoZW5oZW5nIiwiYSI6ImNsdXM3cnBmODBsemgycW1vaXc1bjV6bXMifQ.w6fqHGRbhNhLvm0LnX4ZVw"},route:{type:Object,default:void 0}},data(){return{map:void 0,voyages:[],line:void 0,speed:void 0,voyageId:void 0,center:void 0,realTime:N(),startDate:void 0,endDate:void 0,resetTimeline:0,voyageToggle:!1,fleetHide:!1,weights:{adverse:{heavy:void 0,severe:void 0,total:void 0},deviation:void 0,stoppage:void 0,all:void 0}}},mounted(){this.fetchWeight()},methods:{fetchWeight(){var a,t,o,l;this.weights.adverse.heavy=(a=P.VoyageTagHelper.WEATHER_TAG.find(r=>r.key===P.VoyageTagKey.HEAVY))==null?void 0:a.weight,this.weights.adverse.severe=(t=P.VoyageTagHelper.WEATHER_TAG.find(r=>r.key===P.VoyageTagKey.SEVERE))==null?void 0:t.weight,this.weights.adverse.total=this.weights.adverse.heavy+this.weights.adverse.severe,this.weights.deviation=(o=P.VoyageTagHelper.SAILING_TAG.find(r=>r.key===P.VoyageTagKey.DEVIATION))==null?void 0:o.weight,this.weights.stoppage=(l=P.VoyageTagHelper.SAILING_TAG.find(r=>r.key===P.VoyageTagKey.STOPPAGE))==null?void 0:l.weight,this.weights.all=this.weights.adverse.total+this.weights.deviation+this.weights.stoppage},handleVoyageSelect(a){var t;(t=a==null?void 0:a.vessel)!=null&&t.ais&&(this.center={position:[a.vessel.ais.lng,a.vessel.ais.lat],flyTo:!0}),this.voyageId=a==null?void 0:a.id},handleTimelineChange(a,t){this.startDate=N(a),this.endDate=N(t),this.resetTimeline++},handleLineChange(a){var r,i,s,n,c,p;const t=(((r=this.line)==null?void 0:r.version)??0)+1;this.line=a,this.line.version=t;const o=N.unix(((n=(s=(i=this.line)==null?void 0:i.remain)==null?void 0:s.from)==null?void 0:n.positionTime)??N().unix()),l=N(((p=(c=this.line)==null?void 0:c.remain)==null?void 0:p.eta)||o.clone().add(7,"day"));this.handleTimelineChange(o,l),this.realTime=o,this.speed={etd:o.utc().format(),eta:l.utc().format(),items:[{...a.remain,etd:o.utc().format()}],version:t}}}},Bc={class:"mapbox-container"};function Rc(a,t,o,l,r,i){var m;const s=e.resolveComponent("VoyageFleet"),n=e.resolveComponent("MapInitial"),c=e.resolveComponent("MapTimeline"),p=e.resolveComponent("MapMeteo"),h=e.resolveComponent("MapVoyage"),d=e.resolveComponent("MapLine"),y=e.resolveComponent("MapSpeed");return e.openBlock(),e.createElementBlock("div",Bc,[r.map?(e.openBlock(),e.createBlock(s,{key:0,token:o.token,route:o.route,toggle:r.voyageToggle,onUpdate:t[0]||(t[0]=u=>r.voyages=u),onSelect:i.handleVoyageSelect,onToggle:t[1]||(t[1]=u=>r.voyageToggle=u),onHide:t[2]||(t[2]=u=>r.fleetHide=u)},null,8,["token","route","toggle","onSelect"])):e.createCommentVNode("",!0),e.createVNode(n,e.mergeProps({"mapbox-style":o.mapboxStyle,"mapbox-token":o.mapboxToken},a.$attrs,{center:r.center,onInitialized:t[3]||(t[3]=u=>r.map=u)}),null,16,["mapbox-style","mapbox-token","center"]),r.map?(e.openBlock(),e.createBlock(c,e.mergeProps({key:1,"start-date":r.startDate,"end-date":r.endDate,reset:r.resetTimeline,map:r.map,"real-time":r.realTime},a.$attrs,{onRealTime:t[4]||(t[4]=u=>r.realTime=u),onDateChange:i.handleTimelineChange}),null,16,["start-date","end-date","reset","map","real-time","onDateChange"])):e.createCommentVNode("",!0),r.map?(e.openBlock(),e.createBlock(p,e.mergeProps({key:2,map:r.map,token:o.token,ts:(m=r.realTime)==null?void 0:m.utc().format(),left:r.voyageToggle?"310px":"10px",top:"106px",bottom:"70px"},a.$attrs),null,16,["map","token","ts","left"])):e.createCommentVNode("",!0),r.map?(e.openBlock(),e.createBlock(h,e.mergeProps({key:3,ref:"voyage",map:r.map,token:o.token,voyages:r.voyages,"voyage-id":r.voyageId,hide:r.fleetHide,weights:r.weights},a.$attrs,{onLink:t[5]||(t[5]=u=>r.voyageId=u),onCenter:t[6]||(t[6]=u=>r.center=u),onLine:i.handleLineChange}),null,16,["map","token","voyages","voyage-id","hide","weights","onLine"])):e.createCommentVNode("",!0),e.createVNode(d,{map:r.map,line:r.line},null,8,["map","line"]),e.createVNode(y,{map:r.map,speed:r.speed,"real-time":r.realTime},null,8,["map","speed","real-time"])])}const et=G(Pc,[["render",Rc],["__scopeId","data-v-bb1ced68"]]),Ic={install(a){a.component("MapInitial",Ue),a.component("MapTimeline",He),a.component("MapMeteo",Xe),a.component("MapVoyage",qe),a.component("MapLine",Je),a.component("MapSpeed",Qe),a.component("MapIndex",et)}};k.MapIndex=et,k.MapInitial=Ue,k.MapLine=Je,k.MapMeteo=Xe,k.MapSpeed=Qe,k.MapTimeline=He,k.MapVoyage=qe,k.MapboxPlugin=Ic,k.VoyageDetail=Ye,k.VoyageFleet=Ze,k.VoyagePlugin=Cc,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});