@idmwx/idmui-gl4 0.7.2 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1761,6 +1761,9 @@ const Fi = {
1761
1761
  },
1762
1762
  forecastModel: {
1763
1763
  type: String
1764
+ },
1765
+ realTime: {
1766
+ type: String
1764
1767
  }
1765
1768
  },
1766
1769
  emits: ["map", "other", "menuToggle", "mapFeather", "theme", "followLayerList", "otherCheckList"],
@@ -1774,7 +1777,7 @@ const Fi = {
1774
1777
  otherLayers: {},
1775
1778
  activeOtherLayers: [],
1776
1779
  cache: {
1777
- v: "0.0.1",
1780
+ v: "0.0.2",
1778
1781
  versionKey: "otherLayerCacheVersionGL4",
1779
1782
  checkListKey: "otherChecklistCacheGL4",
1780
1783
  followListKey: "otherFollowListCacheGL4",
@@ -1827,8 +1830,16 @@ const Fi = {
1827
1830
  immediate: !0
1828
1831
  },
1829
1832
  checkList: {
1830
- handler() {
1831
- localStorage.setItem(this.cache.checkListKey, JSON.stringify(this.checkList)), this.activeOtherLayers = this.tagLayers.filter((t) => this.checkList.includes(t.key)) || [], this.handleLayersChange(), this.$emit("otherCheckList", this.checkList);
1833
+ handler(t, e) {
1834
+ localStorage.setItem(this.cache.checkListKey, JSON.stringify(this.checkList)), this.activeOtherLayers = this.tagLayers.filter((r) => this.checkList.includes(r.key)) || [];
1835
+ const o = t == null ? void 0 : t.filter((r) => !(e != null && e.includes(r))), i = e == null ? void 0 : e.filter((r) => !(t != null && t.includes(r))), a = t == null ? void 0 : t.filter((r) => e == null ? void 0 : e.includes(r));
1836
+ if ((i == null ? void 0 : i.length) > 0 && i.forEach((r) => {
1837
+ this.otherLayers[r] = void 0, delete this.otherLayers[r];
1838
+ }), (o == null ? void 0 : o.length) > 0) {
1839
+ const r = this.tagLayers.filter((s) => this.checkList.includes(s.key) && !a.includes(s.key)) || [];
1840
+ this.handleLayersChange(r);
1841
+ }
1842
+ this.$emit("otherCheckList", this.checkList);
1832
1843
  }
1833
1844
  },
1834
1845
  followList: {
@@ -1858,7 +1869,7 @@ const Fi = {
1858
1869
  async fetchOtherLayers(t = { all: !1, dayNight: !1 }) {
1859
1870
  var o, i, a, r;
1860
1871
  let e = this.layerWeight;
1861
- if (this.otherLayers = {}, e) {
1872
+ if (e) {
1862
1873
  if (t.all) {
1863
1874
  const s = this.assistGateway[Math.round(Math.random() * (this.assistGateway.length - 1))], c = await Be.get(`${s}/api/arc/other/layers/links?l=${e}&t=${this.realTime}`, {
1864
1875
  headers: {
@@ -1906,13 +1917,11 @@ const Fi = {
1906
1917
  });
1907
1918
  }
1908
1919
  }
1909
- } else
1910
- this.otherLayers = {};
1920
+ }
1911
1921
  },
1912
- handleLayersChange() {
1913
- var e;
1914
- const t = (e = this.activeOtherLayers) == null ? void 0 : e.reduce((o, i) => o + (i == null ? void 0 : i.weight), 0);
1915
- this.layerWeight !== t && (this.layerWeight = t, this.fetchOtherLayers({ all: !0 }));
1922
+ handleLayersChange(t) {
1923
+ const e = t == null ? void 0 : t.reduce((o, i) => o + (i == null ? void 0 : i.weight), 0);
1924
+ this.layerWeight = e, this.fetchOtherLayers({ all: !0 });
1916
1925
  }
1917
1926
  }
1918
1927
  }, Hi = { class: "idm-gl4-other-layer" }, Wi = { class: "header-box d-flex justify-space-between align-center px-4" }, Gi = { class: "text-h5 font-weight-medium" }, Ui = { class: "list-box scroll pl-4 pr-2 overflow-y-auto" }, Vi = { class: "layers-body mt-4 d-flex justify-start align-center flex-wrap" }, Yi = ["onClick"], Zi = {
@@ -2060,7 +2069,7 @@ function Ji(t, e, o, i, a, r) {
2060
2069
  }),
2061
2070
  m(d, { class: "py-2" }, {
2062
2071
  default: u(() => [
2063
- (b(!0), I(ke, null, Le(a.tagLayers.filter((F) => ["ports", "nav-warnings", "tidal-stations"].includes(F.key)), (F) => (b(), j(p, {
2072
+ (b(!0), I(ke, null, Le(a.tagLayers.filter((F) => ["ports", "alert-zones", "tidal-stations"].includes(F.key)), (F) => (b(), j(p, {
2064
2073
  key: F.key,
2065
2074
  modelValue: a.checkList,
2066
2075
  "onUpdate:modelValue": e[1] || (e[1] = (se) => a.checkList = se),
@@ -2099,7 +2108,7 @@ function Ji(t, e, o, i, a, r) {
2099
2108
  }),
2100
2109
  m(d, { class: "py-2" }, {
2101
2110
  default: u(() => [
2102
- (b(!0), I(ke, null, Le(a.tagLayers.filter((F) => !["graticule", "day-night", "time-zones", "ports", "nav-warnings", "tidal-stations"].includes(F.key)), (F) => (b(), j(p, {
2111
+ (b(!0), I(ke, null, Le(a.tagLayers.filter((F) => !["graticule", "day-night", "time-zones", "ports", "alert-zones", "tidal-stations"].includes(F.key)), (F) => (b(), j(p, {
2103
2112
  key: F.key,
2104
2113
  modelValue: a.checkList,
2105
2114
  "onUpdate:modelValue": e[2] || (e[2] = (se) => a.checkList = se),
@@ -1,4 +1,4 @@
1
- (function(W,J){typeof exports=="object"&&typeof module<"u"?J(exports,require("axios"),require("vuetify"),require("vue"),require("mapbox-gl"),require("@idm-plugin/geo"),require("@turf/turf"),require("@idm-plugin/tag-nop"),require("moment"),require("@mapbox/sphericalmercator"),require("@idm-plugin/tag"),require("@idm-plugin/meteo")):typeof define=="function"&&define.amd?define(["exports","axios","vuetify","vue","mapbox-gl","@idm-plugin/geo","@turf/turf","@idm-plugin/tag-nop","moment","@mapbox/sphericalmercator","@idm-plugin/tag","@idm-plugin/meteo"],J):(W=typeof globalThis<"u"?globalThis:W||self,J(W["idm-gl"]={},W.axios,W.vuetify,W.Vue,W["mapbox-gl"],W["@idm-plugin/geo"],W["@turf/turf"],W["@idm-plugin/tag-nop"],W.moment,W["@mapbox/sphericalmercator"],W["@idm-plugin/tag"],W["@idm-plugin/meteo"]))})(this,function(W,J,se,e,me,R,ua,Me,P,fa,ya,Ht){"use strict";var Vn=Object.defineProperty;var On=(W,J,se)=>J in W?Vn(W,J,{enumerable:!0,configurable:!0,writable:!0,value:se}):W[J]=se;var Q=(W,J,se)=>(On(W,typeof J!="symbol"?J+"":J,se),se);function ba(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const a in o)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(o,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:()=>o[a]})}}return t.default=o,Object.freeze(t)}const N=ba(ua),O=(o,t)=>{const a=o.__vccOpts||o;for(const[r,i]of t)a[r]=i;return a},wa={name:"IdmWarZone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:se.useTheme()}},data(){return{source:"war-zone-source",zoneLayer:"war-zone-layer",zoneLabelLayer:"war-zone-label-layer"}},watch:{zone:{handler(){this.handleRender()},immediate:!0}},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-color":this.Theme.current.value.colors["map-red"],"fill-opacity":.4}},this.beforeLayer),this.map.addLayer({id:this.zoneLayer+"-border",type:"line",source:this.source,filter:["==","$type","Polygon"],paint:{"line-width":1,"line-opacity":.7,"line-color":this.Theme.current.value.colors["map-red"]}},this.beforeLayer),this.map.addLayer({id:this.zoneLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-size":.7,"icon-image":"identify","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,1],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.zoneLayer)&&this.map.removeLayer(this.zoneLayer),this.map.getLayer(this.zoneLayer+"-border")&&this.map.removeLayer(this.zoneLayer+"-border"),this.map.getLayer(this.zoneLabelLayer)&&this.map.removeLayer(this.zoneLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function xa(o,t,a,r,i,l){return e.openBlock(),e.createElementBlock("div")}const _a=O(wa,[["render",xa]]),ka={name:"IdmGmdssArea",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:se.useTheme()}},data(){return{source:"gmdss-area-source",areaLayer:"gmdss-area-layer",areaLabelLayer:"gmdss-area-label-layer"}},watch:{area:{handler(){this.handleRender()},immediate:!0}},methods:{handleRender(){this.map?(this.handleClear(),this.area&&(this.map.addSource(this.source,{type:"geojson",data:this.area}),console.log(this.beforeLayer),this.map.addLayer({id:this.areaLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"rgba(255,255,255,0.3)","fill-opacity":.4,"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":.7,"icon-image":"identify","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":12,"text-offset":[0,1],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer))):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 va(o,t,a,r,i,l){return e.openBlock(),e.createElementBlock("div")}const za=O(ka,[["render",va]]),La={name:"IdmEcaZone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:se.useTheme()}},data(){return{source:"eca-zone-source",zoneLayer:"eca-zone-layer",zoneLabelLayer:"eca-zone-label-layer"}},watch:{zone:{handler(){this.zone?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var o;this.map?(this.handleClear(),this.zone&&(this.map.getSource(this.source)?(o=this.map)==null||o.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-opacity":.3,"fill-color":"#05f324"}},this.beforeLayer),this.map.addLayer({id:this.zoneLayer+"-border",type:"line",source:this.source,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"line-color":"#05f324","line-width":1,"line-opacity":1}},this.beforeLayer),this.map.addLayer({id:this.zoneLabelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":.7,"icon-image":"identify","text-max-width":16,"text-justify":"left","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,1],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer)))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.zoneLayer)&&this.map.removeLayer(this.zoneLayer),this.map.getLayer(this.zoneLayer+"-border")&&this.map.removeLayer(this.zoneLayer+"-border"),this.map.getLayer(this.zoneLabelLayer)&&this.map.removeLayer(this.zoneLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Ca(o,t,a,r,i,l){return e.openBlock(),e.createElementBlock("div")}const Pa=O(La,[["render",Ca]]),jn="",Sa={name:"IdmAlertZone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:se.useTheme()}},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 o,t;this.zone?(this.handleRender(),(o=this.map)==null||o.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))},immediate:!0}},methods:{handleClick(o){var r;const t=o.features[0],a=(r=this.zone)==null?void 0:r.features.filter(i=>{var l;return i.properties.id===((l=t==null?void 0:t.properties)==null?void 0:l.id)})[0];if(a){this.showZone=!0,this.form={...a.properties};const i=document.getElementById("idm-gl4-zone-info");this.marker?this.marker.setLngLat([o.lngLat.lng,o.lngLat.lat]):this.marker=new me.Marker(i).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,0]).addTo(this.map)}},handleRender(){var o;this.map?(this.handleClear(),this.zone&&(this.map.getSource(this.source)?(o=this.map)==null||o.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":this.Theme.current.value.colors["map-warning"],"fill-opacity":.4,"fill-color":this.Theme.current.value.colors["map-warning"]}},this.beforeLayer),this.map.addLayer({id:this.polygonLayer+"-border",type:"line",source:this.source,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"line-width":1,"line-color":this.Theme.current.value.colors["map-warning"]}},this.beforeLayer),this.map.addLayer({id:this.lineLayer,type:"line",source:this.source,filter:["all",["==","$type","LineString"],["!=","disabled",!0]],paint:{"line-color":this.Theme.current.value.colors["map-warning"],"line-width":2}},this.beforeLayer),this.map.addLayer({id:this.polygonLabelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-image":"warning","icon-size":.7,"icon-allow-overlap":!0,"icon-rotation-alignment":"viewport"},paint:{"icon-opacity":.8}},this.beforeLayer),this.map.addLayer({id:this.lineLabelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","LineString"],["!=","disabled",!0]],layout:{"symbol-placement":"line-center","icon-image":"warning","icon-size":.7,"icon-allow-overlap":!0,"icon-rotation-alignment":"viewport"},paint:{"icon-opacity":.8}},this.beforeLayer),this.map.addLayer({id:this.pointLayer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-image":"warning","icon-size":.7},paint:{"icon-opacity":.8}},this.beforeLayer)))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.polygonLayer)&&this.map.removeLayer(this.polygonLayer),this.map.getLayer(this.polygonLayer+"-border")&&this.map.removeLayer(this.polygonLayer+"-border"),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)}}},Na=["innerHTML"];function Ta(o,t,a,r,i,l){const n=e.resolveComponent("VBtn"),c=e.resolveComponent("v-card-text"),s=e.resolveComponent("v-card");return e.withDirectives((e.openBlock(),e.createBlock(s,{class:"scroll",id:"idm-gl4-zone-info"},{default:e.withCtx(()=>[e.createVNode(c,null,{default:e.withCtx(()=>{var p;return[e.createVNode(n,{icon:"",density:"comfortable",variant:"plain",class:"mr-n2 close",onClick:t[0]||(t[0]=h=>i.showZone=!1)},{default:e.withCtx(()=>t[1]||(t[1]=[e.createElementVNode("i",{class:"iconfont icon-close",style:{"font-size":"16px"}},null,-1)])),_:1,__:[1]}),e.createElementVNode("div",{class:"rich-context",innerHTML:(p=i.form)==null?void 0:p.name},null,8,Na)]}),_:1})]),_:1},512)),[[e.vShow,i.showZone]])}const Ma=O(Sa,[["render",Ta]]),Fn="",Ea={name:"IdmPort",props:{map:{type:Object},port:{type:Object},beforeLayer:{type:String},forecastModel:{type:String}},emits:["meteoMore"],setup(){return{Theme:se.useTheme()}},data(){return{source:"port-source",layer:"port-layer",showInfo:!1,form:{},marker:void 0}},computed:{computeLat(){return function(o){return R.LngLatHelper.lat2pretty(o,4).pretty}},computeLng(){return function(o){return R.LngLatHelper.lng2pretty(o,4).pretty}}},watch:{port:{handler(){var o,t;this.port?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick)):(this.handleClear(),(t=this.map)==null||t.off("click",[this.layer],this.handleClick))},immediate:!0}},methods:{handleClick(o){var r;const t=o.features[0],a=(r=this.port)==null?void 0:r.features.filter(i=>{var l;return i.properties.id===((l=t==null?void 0:t.properties)==null?void 0:l.id)})[0];if(console.log(a),a){this.showInfo=!0,this.form={...a.properties},this.form.lng=a.geometry.coordinates[0],this.form.lat=a.geometry.coordinates[1];const i=document.getElementById("port-info");this.marker?this.marker.setLngLat([o.lngLat.lng,o.lngLat.lat]):this.marker=new me.Marker(i).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-85]).addTo(this.map)}else this.map.zoomIn()},handleRender(){var o;this.map?this.port&&(this.map.getSource(this.source)?(o=this.map)==null||o.getSource(this.source).setData(this.port):(this.map.addSource(this.source,{type:"geojson",data:this.port,cluster:!0,clusterRadius:50}),this.map.addLayer({id:this.layer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":.7,"icon-image":"port","text-field":"{name}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,1.5]},paint:{"text-opacity":["step",["zoom"],0,2,0,4,1],"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.showInfo=!1,this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source)},handleClickMeteo(o){o.forecastModel=this.forecastModel,this.$emit("meteoMore",o)}}},Da={class:"port-box d-flex flex-column justify-center align-start ga-2"},Ba={class:"d-flex justify-start align-center"},Ia={class:"d-flex justify-start align-center"},Aa={class:"d-flex justify-start align-center"},Ra={class:"d-flex justify-start align-center"};function Va(o,t,a,r,i,l){const n=e.resolveComponent("VBtn"),c=e.resolveComponent("v-card-text"),s=e.resolveComponent("v-divider"),p=e.resolveComponent("v-btn"),h=e.resolveComponent("v-card-actions"),d=e.resolveComponent("v-card");return e.withDirectives((e.openBlock(),e.createBlock(d,{id:"port-info",ref:"idmPortInfo"},{default:e.withCtx(()=>[e.createVNode(c,{class:"pr-8"},{default:e.withCtx(()=>[e.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2 close",onClick:t[0]||(t[0]=g=>i.showInfo=!1)},{default:e.withCtx(()=>t[2]||(t[2]=[e.createElementVNode("i",{class:"iconfont icon-close",style:{"font-size":"16px"}},null,-1)])),_:1,__:[2]}),e.createElementVNode("div",Da,[e.createElementVNode("div",Ba,[t[3]||(t[3]=e.createElementVNode("label",{class:"opacity-70 pr-1"},"Name : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.form.name||"-"),1)]),e.createElementVNode("div",Ia,[t[4]||(t[4]=e.createElementVNode("label",{class:"opacity-70 pr-1"},"Position : ",-1)),e.createElementVNode("span",null,e.toDisplayString(l.computeLat(i.form.lat))+", "+e.toDisplayString(l.computeLng(i.form.lng)),1)]),e.createElementVNode("div",Aa,[t[5]||(t[5]=e.createElementVNode("label",{class:"opacity-70 pr-1"},"LoCode : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.form.loCode||"-"),1)]),e.createElementVNode("div",Ra,[t[6]||(t[6]=e.createElementVNode("label",{class:"opacity-70 pr-1"},"Region : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.form.zoneName||"-"),1)])])]),_:1}),e.createVNode(s),e.createVNode(h,{class:"d-flex justify-end align-center"},{default:e.withCtx(()=>[e.createVNode(p,{variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"meteo-forecast flex-end text-none",onClick:t[1]||(t[1]=g=>l.handleClickMeteo(i.form))},{default:e.withCtx(()=>t[7]||(t[7]=[e.createTextVNode(" Meteo Forecast ",-1)])),_:1,__:[7]})]),_:1})]),_:1},512)),[[e.vShow,i.showInfo]])}const Oa=O(Ea,[["render",Va],["__scopeId","data-v-0cf4535a"]]),ja={name:"IdmLoadLine",props:{map:{type:Object},line:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:se.useTheme()}},data(){return{source:"load-line-source",lineLayer:"load-line-layer",lineLabelLayer:"load-line-label-layer"}},watch:{line:{handler(){this.handleRender()},immediate:!0}},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":"rgba(255,255,255,0.3)","fill-opacity":.6,"fill-color":["match",["get","val"],"LLGreen","rgba(164, 214, 217, 1)","LLRed","rgba(217, 150, 151, 1)","LLBlue","rgba(53, 121, 194, 1)","#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,"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer))):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 Fa(o,t,a,r,i,l){return e.openBlock(),e.createElementBlock("div")}const Ha=O(ja,[["render",Fa]]),Ga={name:"IdmTimezone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:se.useTheme()}},data(){return{source:"time-zone-source",zoneLayer:"time-zone-layer",zoneLabelLayer:"time-zone-label-layer"}},watch:{zone:{handler(){this.handleRender()},immediate:!0}},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":"rgba(255, 255, 255, 0.5)","fill-opacity":.25,"fill-color":["match",["get","offSet"],"-11.5","rgba(255, 92, 88, 1)","-11","rgba(39, 195, 70, 1)","-10.5","rgba(39, 195, 70, 1)","-10","rgba(40, 106, 255, 1)","-9.5","rgba(40, 106, 255, 1)","-9","rgba(255, 92, 88, 1)","-8.5","rgba(255, 92, 88, 1)","-8","rgba(39, 195, 70, 1)","-7.5","rgba(39, 195, 70, 1)","-7","rgba(40, 106, 255, 1)","-6.5","rgba(40, 106, 255, 1)","-6","rgba(255, 92, 88, 1)","-5.5","rgba(255, 92, 88, 1)","-5","rgba(39, 195, 70, 1)","-4.5","rgba(39, 195, 70, 1)","-4","rgba(40, 106, 255, 1)","-3.5","rgba(40, 106, 255, 1)","-3","rgba(255, 92, 88, 1)","-2.5","rgba(255, 92, 88, 1)","-2","rgba(39, 195, 70, 1)","-1.5","rgba(39, 195, 70, 1)","-1","rgba(40, 106, 255, 1)","-0.5","rgba(40, 106, 255, 1)","+0","rgba(255, 92, 88, 1)","+0.5","rgba(255, 92, 88, 1)","+1","rgba(39, 195, 70, 1)","+1.5","rgba(39, 195, 70, 1)","+2","rgba(40, 106, 255, 1)","+2.5","rgba(40, 106, 255, 1)","+3","rgba(255, 92, 88, 1)","+3.5","rgba(255, 92, 88, 1)","+4","rgba(39, 195, 70, 1)","+4.5","rgba(39, 195, 70, 1)","+5","rgba(40, 106, 255, 1)","+5.5","rgba(40, 106, 255, 1)","+6","rgba(255, 92, 88, 1)","+6.5","rgba(255, 92, 88, 1)","+7","rgba(39, 195, 70, 1)","+7.5","rgba(39, 195, 70, 1)","+8","rgba(40, 106, 255, 1)","+8.5","rgba(40, 106, 255, 1)","+9","rgba(255, 92, 88, 1)","+9.5","rgba(255, 92, 88, 1)","+10","rgba(39, 195, 70, 1)","+10.5","rgba(39, 195, 70, 1)","+11","rgba(40, 106, 255, 1)","+11.5","rgba(40, 106, 255, 1)","rgba(255, 92, 88, 1)"]}},this.beforeLayer),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":10,"text-offset":[0,1],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer))):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 Wa(o,t,a,r,i,l){return e.openBlock(),e.createElementBlock("div")}const Ua=O(Ga,[["render",Wa]]),Ya={name:"IdmVoluntaryReportingArea",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:se.useTheme()}},data(){return{source:"vra-source",areaLayer:"vra-layer",areaLabelLayer:"vra-label-layer"}},watch:{area:{handler(){this.area?this.handleRender():this.handleClear()},immediate:!0}},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-opacity":.3,"fill-color":"rgba(144, 96, 217, 1)"}},this.beforeLayer),this.map.addLayer({id:this.areaLayer+"-border",type:"line",source:this.source,filter:["==","$type","Polygon"],paint:{"line-width":1,"line-opacity":1,"line-color":"rgba(164, 125, 222, 1)"}},this.beforeLayer),this.map.addLayer({id:this.areaLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-size":.1,"icon-image":"identify","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,1],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.areaLayer)&&this.map.removeLayer(this.areaLayer),this.map.getLayer(this.areaLayer+"-border")&&this.map.removeLayer(this.areaLayer+"-border"),this.map.getLayer(this.areaLabelLayer)&&this.map.removeLayer(this.areaLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Za(o,t,a,r,i,l){return e.openBlock(),e.createElementBlock("div")}const Xa=O(Ya,[["render",Za]]),qa={name:"IdmSpecialArea",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:se.useTheme()}},data(){return{source:"special-area-source",areaLayer:"special-area-layer",areaLabelLayer:"special-area-label-layer"}},watch:{area:{handler(){this.handleRender()},immediate:!0}},methods:{handleRender(){this.map?(this.handleClear(),this.area&&(this.area.features.forEach(o=>{o.geometry.type==="Polygon"&&o.geometry.coordinates.forEach(t=>R.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-opacity":.25,"fill-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.areaLayer+"-border",type:"line",source:this.source,filter:["==","$type","Polygon"],paint:{"line-width":1,"line-opacity":.7,"line-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.areaLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-size":.7,"icon-image":"identify","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,1],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.areaLayer)&&this.map.removeLayer(this.areaLayer),this.map.getLayer(this.areaLayer+"-border")&&this.map.removeLayer(this.areaLayer+"-border"),this.map.getLayer(this.areaLabelLayer)&&this.map.removeLayer(this.areaLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Ka(o,t,a,r,i,l){return e.openBlock(),e.createElementBlock("div")}const Qa=O(qa,[["render",Ka]]),Ja={name:"IdmTerminator",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},data(){return{source:"terminator-source",layer:"terminator-layer"}},computed:{},watch:{area:{handler(){this.handleRender()},immediate:!0}},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":"rgba(255,255,255,0.3)","fill-color":"rgba(0, 0, 0, 0.3)"}},this.beforeLayer))):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 $a(o,t,a,r,i,l){return e.openBlock(),e.createElementBlock("div")}const ei=O(Ja,[["render",$a]]),ti={name:"IdmWorld12nm",props:{map:{type:Object},show:{type:Boolean},weatherLayers:{type:Object,default:()=>({})},zoom:{type:Number,default:3},left:{type:String,default:"10px"},bottom:{type:String,default:"64px"},token:{type:String,default:""}},data(){return{layer:"world-12nm-v4-20231025"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var o;this.map?(o=this.map)!=null&&o.getLayer(this.layer)&&(this.map.setLayoutProperty(this.layer,"visibility","visible"),this.map.setPaintProperty(this.layer,"line-color","rgb(210,54,83)"),this.map.setPaintProperty(this.layer,"line-width",2)):setTimeout(()=>{this.handleRender()},500)},handleClear(){var o;(o=this.map)!=null&&o.getLayer(this.layer)&&this.map.setLayoutProperty(this.layer,"visibility","none")}}};function oi(o,t,a,r,i,l){return null}const ai=O(ti,[["render",oi]]),Hn="",ii={name:"IdmWorldMarine",props:{map:{type:Object},show:{type:Boolean}},data(){return{labelLayer:"ne-10m-label",lineLayer:"ne-10m-outline"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var o,t;this.map?((o=this.map)!=null&&o.getLayer(this.lineLayer)&&(this.map.setLayoutProperty(this.lineLayer,"visibility","visible"),this.map.setPaintProperty(this.lineLayer,"line-width",1)),(t=this.map)!=null&&t.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","visible")):setTimeout(()=>{this.handleRender()},500)},handleClear(){var o,t;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","none"),(t=this.map)!=null&&t.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","none")}}};function ri(o,t,a,r,i,l){return null}const li=O(ii,[["render",ri]]),ni={name:"IdmChinaRoute",props:{map:{type:Object},show:{type:Boolean}},data(){return{labelLayer:"china-route-label",lineLayer:"china-route-line",fillLayer:"china-route-fill"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var o,t,a;this.map?((o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","visible"),(t=this.map)!=null&&t.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","visible"),(a=this.map)!=null&&a.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","visible")):setTimeout(()=>{this.handleRender()},500)},handleClear(){var o,t,a;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","none"),(t=this.map)!=null&&t.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","none"),(a=this.map)!=null&&a.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","none")}}};function si(o,t,a,r,i,l){return null}const ci=O(ni,[["render",si]]),Gn="",mi={name:"IdmTideStations",props:{map:{type:Object},show:{type:Boolean},locale:{type:String}},data(){return{layer:"tide-stations",showInfo:!1,form:{},marker:null}},computed:{computeLat(){return function(o){return R.LngLatHelper.lat2pretty(o,4).pretty}},computeLng(){return function(o){return R.LngLatHelper.lng2pretty(o,4).pretty}}},watch:{show:{handler(){var o,t;this.show?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick)):(this.handleClear(),(t=this.map)==null||t.off("click",[this.layer],this.handleClick))},immediate:!0},locale:{handler(){this.show&&this.handleRender()},immediate:!0}},methods:{handleClick(o){const t=o.features[0];if(t){this.showInfo=!0,this.form={...t.properties},this.form.name=this.locale==="en"?t.properties.Location_EN:t.properties.Location_CN,this.form.lng=o.lngLat.lng,this.form.lat=o.lngLat.lat;const a=document.getElementById("tidal-station-info");this.marker?this.marker.setLngLat([o.lngLat.lng,o.lngLat.lat]):this.marker=new me.Marker(a).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-85]).addTo(this.map)}else this.map.zoomIn()},handleRender(){var o;this.map?(o=this.map)!=null&&o.getLayer(this.layer)&&(this.map.setLayoutProperty(this.layer,"visibility","visible"),this.map.setLayoutProperty(this.layer,"text-field",this.locale==="en"?"{Location_EN}":"{Location_CN}")):setTimeout(()=>{this.handleRender()},500)},handleClear(){var o;this.showInfo=!1,(o=this.map)!=null&&o.getLayer(this.layer)&&this.map.setLayoutProperty(this.layer,"visibility","none")}}},di={class:"port-box d-flex flex-column justify-center align-start ga-2"},hi={class:"d-flex justify-start align-center"},pi={class:"d-flex justify-start align-center"},gi={class:"d-flex justify-start align-center"},ui={class:"d-flex justify-start align-center"};function fi(o,t,a,r,i,l){const n=e.resolveComponent("VBtn"),c=e.resolveComponent("v-card-text"),s=e.resolveComponent("v-card");return e.withDirectives((e.openBlock(),e.createBlock(s,{id:"tidal-station-info"},{default:e.withCtx(()=>[e.createVNode(c,{class:"pr-8"},{default:e.withCtx(()=>[e.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2 close",onClick:t[0]||(t[0]=p=>i.showInfo=!1)},{default:e.withCtx(()=>t[1]||(t[1]=[e.createElementVNode("i",{class:"iconfont icon-close",style:{"font-size":"16px"}},null,-1)])),_:1,__:[1]}),e.createElementVNode("div",di,[e.createElementVNode("div",hi,[t[2]||(t[2]=e.createElementVNode("label",{class:"opacity-70 pr-1 pr-1"},"Name : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.form.name),1)]),e.createElementVNode("div",pi,[t[3]||(t[3]=e.createElementVNode("label",{class:"opacity-70 pr-1"},"Position : ",-1)),e.createElementVNode("span",null,e.toDisplayString(l.computeLat(i.form.lat))+", "+e.toDisplayString(l.computeLng(i.form.lng)),1)]),e.createElementVNode("div",gi,[t[4]||(t[4]=e.createElementVNode("label",{class:"opacity-70 pr-1"},"LoCode : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.form.Code||"-"),1)]),e.createElementVNode("div",ui,[t[5]||(t[5]=e.createElementVNode("label",{class:"opacity-70 pr-1"},"Country : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.form.Country||"-"),1)])])]),_:1})]),_:1},512)),[[e.vShow,i.showInfo]])}const yi=O(mi,[["render",fi],["__scopeId","data-v-fb4aeed3"]]),bi={name:"IdmIceAreas",props:{map:{type:Object},show:{type:Boolean}},data(){return{lineLayer:"ice-area-line",fillLayer:"ice-area-fill"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var o,t;this.map?((o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","visible"),(t=this.map)!=null&&t.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","visible")):setTimeout(()=>{this.handleRender()},500)},handleClear(){var o,t;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","none"),(t=this.map)!=null&&t.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","none")}}};function wi(o,t,a,r,i,l){return null}const xi=O(bi,[["render",wi]]),Wn="",_i={name:"IdmLatLng",props:{map:{type:Object},show:{type:Boolean},mapFeather:{type:String},beforeLayer:{type:String},menuToggle:{type:Object}},data(){return{lngLat:{e:{lng:0,lat:0},lng:0,lat:0,str:""},source:"idm-lat-lng-source",layer:"idm-lat-lng-layer",labelLayer:"idm-lat-lng-label-layer",right:10}},computed:{lineColor(){return["satellite","dark"].includes(this.mapFeather)?"rgba(255, 255, 255, 0.3)":"rgba(0, 0, 0, 0.3)"}},watch:{show:{handler(){this.handleBind()},immediate:!0},map:{handler(){var o;this.map&&((o=this.map)==null||o.on("mousemove",this.handleMouseMove))},immediate:!0},"menuToggle.v":{handler(){var o;this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10},immediate:!0},"lngLat.e":{handler(o){this.lngLat.lng=R.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty,this.lngLat.lat=R.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty,this.lngLat.str=`[${o==null?void 0:o.lng.toFixed(4)}, ${o==null?void 0:o.lat.toFixed(4)}]`},immediate:!0}},methods:{handleBind(){var o,t;this.show?((o=this.map)==null||o.on("zoomend",this.handleZoomEnd),this.handleRender()):(this.handleClear(),(t=this.map)==null||t.off("zoomend",this.handleZoomEnd))},handleMouseMove(o){this.lngLat.e=o.lngLat},handleComputeLatLngs(){var r;const o=(r=this.map)==null?void 0:r.getZoom();let t=30;o>4?t=10:o>3&&(t=15);const a=[];for(let i=-60;i<90;i+=t)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[-180,i],[180,i]]}});for(let i=-180;i<180;i+=t)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[i,-90],[i,90]]}});for(let i=180;i>-180;i-=t)for(let l=-60;l<90;l+=t)a.push({type:"Feature",geometry:{type:"Point",coordinates:[i,l]},properties:{val:`${l>0?l+" N":l===0?l:l*-1+" S"}, ${i>0?i+" E":i*-1+" W"}`}});return a},handleZoomEnd(){var t;const o=this.handleComputeLatLngs();(t=this.map)==null||t.getSource(this.source).setData(N.featureCollection(o))},handleRender(){if(this.handleClear(),this.map){const o=this.handleComputeLatLngs();this.map.addSource(this.source,{type:"geojson",data:{type:"FeatureCollection",features:o}}),this.map.addLayer({id:this.layer,type:"line",source:this.source,filter:["==","$type","LineString"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":this.lineColor,"line-width":1}},this.beforeLayer),this.map.addLayer({id:this.labelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","text-field":"{val}","text-rotation-alignment":"viewport","text-offset":[0,1],"text-size":10,"text-allow-overlap":!0},paint:{"text-opacity":.8,"text-color":this.lineColor}},this.beforeLayer)}},handleClear(){var o,t,a,r,i,l;(o=this.map)!=null&&o.getLayer(this.layer)&&((t=this.map)==null||t.removeLayer(this.layer)),(a=this.map)!=null&&a.getLayer(this.labelLayer)&&((r=this.map)==null||r.removeLayer(this.labelLayer)),(i=this.map)!=null&&i.getSource(this.source)&&((l=this.map)==null||l.removeSource(this.source))}}};function ki(o,t,a,r,i,l){var n,c,s;return e.openBlock(),e.createElementBlock("div",{class:"idm-lat-lng-tip-gl4 pa-2 text-caption text-right rounded",style:e.normalizeStyle({right:i.right+"px"})},[e.createElementVNode("div",null,e.toDisplayString((n=i.lngLat)==null?void 0:n.lat),1),e.createElementVNode("div",null,e.toDisplayString((c=i.lngLat)==null?void 0:c.lng),1),e.createElementVNode("div",null,e.toDisplayString((s=i.lngLat)==null?void 0:s.str),1)],4)}const Gt=O(_i,[["render",ki]]),Un="",vi={name:"IdmOtherLayerr",components:{IdmWarZone:_a,IdmGmdssArea:za,IdmEcaZone:Pa,IdmAlertZone:Ma,IdmPort:Oa,IdmLoadLine:Ha,IdmTimezone:Ua,IdmVRA:Xa,IdmSpecialArea:Qa,IdmTerminator:ei,IdmWorld12nm:ai,IdmWorldMarine:li,IdmChinaRoute:ci,IdmTideStations:yi,IdmIceAreas:xi,IdmLatLng:Gt},props:{map:{type:Object},theme:{type:String},token:{type:String},isLogin:{type:Boolean,default:!1},defaultMeteoToken:{type:String},gateway:{type:String},assistGateway:{type:Array,default:[]},top:{type:Number,default:60},menuToggle:{type:Object,default:{}},ts:{type:String},forecastModel:{type:String}},emits:["map","other","menuToggle","mapFeather","theme","followLayerList","otherCheckList"],data(){return{right:10,toggle:!1,mapFeather:localStorage.getItem("mapFeathersCacheGL4")||"light",tagLayers:[...Me.LayerHelper.OTHER_LAYERS.filter(o=>o.enabled)],layerWeight:0,otherLayers:{},activeOtherLayers:[],cache:{v:"0.0.1",versionKey:"otherLayerCacheVersionGL4",checkListKey:"otherChecklistCacheGL4",followListKey:"otherFollowListCacheGL4",mapFeatherKey:"mapFeathersCacheGL4"},mapFeathers:[{name:"Light Map",value:"light",locale:"lightMap"},{name:"Dark Map",value:"dark",locale:"darkMap"},{name:"Satelite Map",value:"satellite",locale:"satelliteMap"},{name:"Nautical Map",value:"nautical",locale:"nauticalMap"}],checkList:[],followList:[]}},computed:{computeLayerClass(){return function(o,t){let a="layer flex-between";return t.some(r=>r.key===o.key)&&(a=a+" active"),a}}},watch:{isLogin:{handler(){this.isLogin&&this.fetchOtherLayers()},immediate:!0},"menuToggle.v":{handler(){this.toggle=this.menuToggle.otherLayers,this.$nextTick(()=>{var o;this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10})},immediate:!0},theme:{handler(){this.theme==="light"?this.mapFeather=["light","nautical"].includes(this.mapFeather)?this.mapFeather:"light":this.mapFeather=["dark","satellite"].includes(this.mapFeather)?this.mapFeather:"dark"},immediate:!0},mapFeather:{handler(){localStorage.setItem(this.cache.mapFeatherKey,this.mapFeather),this.$emit("mapFeather",this.mapFeather),this.$emit("theme",["light","nautical"].includes(this.mapFeather)?"light":"dark")},immediate:!0},checkList:{handler(){localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),this.activeOtherLayers=this.tagLayers.filter(o=>this.checkList.includes(o.key))||[],this.handleLayersChange(),this.$emit("otherCheckList",this.checkList)}},followList:{handler(){localStorage.setItem(this.cache.followListKey,JSON.stringify(this.followList)),this.$emit("followLayerList",this.followList)}}},async mounted(){this.fetchCache()},methods:{fetchCache(){const o=localStorage.getItem(this.cache.versionKey);this.cache.v!==o&&(localStorage.removeItem(this.cache.checkListKey),localStorage.removeItem(this.cache.followListKey),localStorage.removeItem(this.cache.mapFeatherKey),localStorage.setItem(this.cache.versionKey,this.cache.v));let t=localStorage.getItem(this.cache.checkListKey);this.checkList=JSON.parse(t||'["eca-zones"]'),localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),t=localStorage.getItem(this.cache.followListKey),this.followList=JSON.parse(t||"[]"),localStorage.setItem(this.cache.followListKey,JSON.stringify(this.followList)),t=localStorage.getItem(this.cache.mapFeatherKey);const a=t||"light";this.$emit("mapFeather",a),localStorage.setItem(this.cache.mapFeatherKey,a)},handleMenuToggle(){this.$emit("menuToggle","otherLayers")},handleToggleMapFeather(o){this.$emit("map",void 0),this.mapFeather=o.value},async fetchOtherLayers(o={all:!1,dayNight:!1}){var a,r,i,l;let t=this.layerWeight;if(this.otherLayers={},t){if(o.all){const n=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],c=await J.get(`${n}/api/arc/other/layers/links?l=${t}&t=${this.realTime}`,{headers:{Authorization:this.token||this.defaultMeteoToken}});if(((a=c==null?void 0:c.data)==null?void 0:a.code)===0){const s=(r=c==null?void 0:c.data)==null?void 0:r.data,p=[];for(const d in s)p.push(J.get(s[d],{headers:{Authorization:this.token||this.defaultMeteoToken,key:d}}));(await Promise.all(p)).map(d=>{var f,v,k;const g=((f=d==null?void 0:d.data)==null?void 0:f.data)||(d==null?void 0:d.data),b=(k=(v=d==null?void 0:d.config)==null?void 0:v.headers)==null?void 0:k.key;this.otherLayers[b]=g})}}else if(o.dayNight&&t&1024){const n=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],c=await J.get(`${n}/api/arc/other/layers/links?l=1024&t=${this.realTime}`,{headers:{Authorization:this.token||this.defaultMeteoToken}});if(((i=c==null?void 0:c.data)==null?void 0:i.code)===0){const s=(l=c==null?void 0:c.data)==null?void 0:l.data,p=[];for(const d in s)p.push(J.get(s[d],{headers:{Authorization:this.token||this.defaultMeteoToken,key:d}}));(await Promise.all(p)).map(d=>{var f,v,k;const g=((f=d==null?void 0:d.data)==null?void 0:f.data)||(d==null?void 0:d.data),b=(k=(v=d==null?void 0:d.config)==null?void 0:v.headers)==null?void 0:k.key;this.otherLayers[b]=g})}}}else this.otherLayers={}},handleLayersChange(){var t;const o=(t=this.activeOtherLayers)==null?void 0:t.reduce((a,r)=>a+(r==null?void 0:r.weight),0);this.layerWeight!==o&&(this.layerWeight=o,this.fetchOtherLayers({all:!0}))}}},zi={class:"idm-gl4-other-layer"},Li={class:"header-box d-flex justify-space-between align-center px-4"},Ci={class:"text-h5 font-weight-medium"},Pi={class:"list-box scroll pl-4 pr-2 overflow-y-auto"},Si={class:"layers-body mt-4 d-flex justify-start align-center flex-wrap"},Ni=["onClick"],Ti={key:0,src:"https://osshz.idmwx.com/asset/dark-map.png",class:"border rounded-sm"},Mi={key:1,src:"https://osshz.idmwx.com/asset/nautical-map.png",class:"border rounded-sm"},Ei={key:2,src:"https://osshz.idmwx.com/asset/satellite-map.png",class:"border rounded-sm"},Di={key:3,src:"https://osshz.idmwx.com/asset/light-map.png",class:"border rounded-sm"},Bi={class:"text-body-2 text-center pt-1"};function Ii(o,t,a,r,i,l){var U,Y,H,ee,ae,ie,te,F,X,re;const n=e.resolveComponent("VBtn"),c=e.resolveComponent("VTooltip"),s=e.resolveComponent("VCardTitle"),p=e.resolveComponent("VCardItem"),h=e.resolveComponent("VCheckbox"),d=e.resolveComponent("VCardText"),g=e.resolveComponent("VCard"),b=e.resolveComponent("IdmTideStations"),f=e.resolveComponent("IdmIceAreas"),v=e.resolveComponent("IdmWorld12nm"),k=e.resolveComponent("IdmWorldMarine"),T=e.resolveComponent("IdmChinaRoute"),z=e.resolveComponent("IdmWarZone"),x=e.resolveComponent("IdmGmdssArea"),y=e.resolveComponent("IdmEcaZone"),w=e.resolveComponent("IdmAlertZone"),_=e.resolveComponent("IdmPort"),u=e.resolveComponent("IdmLoadLine"),L=e.resolveComponent("IdmTimezone"),B=e.resolveComponent("IdmVRA"),A=e.resolveComponent("IdmSpecialArea"),j=e.resolveComponent("IdmTerminator"),V=e.resolveComponent("IdmLatLng");return e.openBlock(),e.createElementBlock("div",zi,[e.createElementVNode("div",{class:"menu-bar-box transition px-1 rounded",style:e.normalizeStyle({top:a.top+10+"px",right:i.right+"px"})},[e.createVNode(c,{text:o.$t("layer.mapLayers"),location:"left"},{activator:e.withCtx(({props:M})=>[e.createVNode(n,e.mergeProps(M,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:e.withCtx(()=>t[5]||(t[5]=[e.createElementVNode("i",{class:"iconfont icon-Layer text-h4"},null,-1)])),_:2,__:[5]},1040,["class","onClick"])]),_:1},8,["text"])],4),e.createElementVNode("div",{class:e.normalizeClass(["available-layers transition",i.toggle?"right-bar":""]),style:e.normalizeStyle({top:a.top+"px",right:i.toggle?"0px":"-280px"})},[e.createElementVNode("div",Li,[e.createElementVNode("div",Ci,e.toDisplayString(o.$t("layer.layers")),1),e.createVNode(n,{icon:"",density:"comfortable",variant:"plain",class:"mr-n2",onClick:l.handleMenuToggle},{default:e.withCtx(()=>t[6]||(t[6]=[e.createElementVNode("i",{class:"iconfont icon-close",style:{"font-size":"20px"}},null,-1)])),_:1,__:[6]},8,["onClick"])]),e.createElementVNode("div",Pi,[e.createVNode(g,{class:"menu-card mx-auto mb-3",elevation:"0"},{default:e.withCtx(()=>[e.createVNode(p,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-subtitle-1 font-weight-medium",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("layer.mapFeathers")),1)]),_:1})]),_:1}),e.createVNode(d,{class:"pb-2"},{default:e.withCtx(()=>[e.createElementVNode("div",Si,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.mapFeathers,M=>(e.openBlock(),e.createElementBlock("div",{key:M.value,class:"mb-2 feather-item",onClick:$=>l.handleToggleMapFeather(M)},[e.createElementVNode("div",{class:e.normalizeClass([i.mapFeather===M.value?"active":"","img-box"])},[M.value==="dark"?(e.openBlock(),e.createElementBlock("img",Ti)):M.value==="nautical"?(e.openBlock(),e.createElementBlock("img",Mi)):M.value==="satellite"?(e.openBlock(),e.createElementBlock("img",Ei)):(e.openBlock(),e.createElementBlock("img",Di))],2),e.createElementVNode("div",Bi,e.toDisplayString(o.$t(`layer.${M.locale}`)),1)],8,Ni))),128))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tagLayers.filter(M=>["graticule","day-night","time-zones"].includes(M.key)),M=>(e.openBlock(),e.createBlock(h,{key:M.key,modelValue:i.checkList,"onUpdate:modelValue":t[0]||(t[0]=$=>i.checkList=$),value:M.key,label:o.$t(`layer.${M.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),e.createVNode(g,{class:"menu-card mx-auto mb-3",elevation:"0"},{default:e.withCtx(()=>[e.createVNode(p,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-subtitle-1 font-weight-medium",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("layer.pointsOfInteresting")),1)]),_:1})]),_:1}),e.createVNode(d,{class:"py-2"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tagLayers.filter(M=>["ports","nav-warnings","tidal-stations"].includes(M.key)),M=>(e.openBlock(),e.createBlock(h,{key:M.key,modelValue:i.checkList,"onUpdate:modelValue":t[1]||(t[1]=$=>i.checkList=$),value:M.key,label:o.$t(`layer.${M.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),e.createVNode(g,{class:"menu-card mx-auto mb-3",elevation:"0"},{default:e.withCtx(()=>[e.createVNode(p,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-subtitle-1 font-weight-medium",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("layer.otherLayers")),1)]),_:1})]),_:1}),e.createVNode(d,{class:"py-2"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tagLayers.filter(M=>!["graticule","day-night","time-zones","ports","nav-warnings","tidal-stations"].includes(M.key)),M=>(e.openBlock(),e.createBlock(h,{key:M.key,modelValue:i.checkList,"onUpdate:modelValue":t[2]||(t[2]=$=>i.checkList=$),value:M.key,label:o.$t(`layer.${M.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),e.createVNode(g,{class:"menu-card mx-auto mb-3",elevation:"0"},{default:e.withCtx(()=>[e.createVNode(p,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-subtitle-1 font-weight-medium",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("layer.myFollows")),1)]),_:1})]),_:1}),e.createVNode(d,{class:"py-2"},{default:e.withCtx(()=>[e.createVNode(h,{modelValue:i.followList,"onUpdate:modelValue":t[3]||(t[3]=M=>i.followList=M),value:"ports",label:o.$t("layer.ports"),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","label"]),e.createVNode(h,{modelValue:i.followList,"onUpdate:modelValue":t[4]||(t[4]=M=>i.followList=M),value:"locations",label:o.$t("layer.locations"),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","label"])]),_:1})]),_:1})])],6),a.map?(e.openBlock(),e.createBlock(b,e.mergeProps({key:0,map:a.map,show:i.checkList.includes("tidal-stations")},o.$attrs),null,16,["map","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(f,e.mergeProps({key:1,map:a.map,show:i.checkList.includes("ice-areas")},o.$attrs),null,16,["map","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(v,e.mergeProps({key:2,map:a.map,token:a.token,show:i.checkList.includes("world12nm")},o.$attrs),null,16,["map","token","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(k,e.mergeProps({key:3,map:a.map,token:a.token,show:i.checkList.includes("worldMarine")},o.$attrs),null,16,["map","token","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(T,e.mergeProps({key:4,map:a.map,token:a.token,show:i.checkList.includes("chinaRoute")},o.$attrs),null,16,["map","token","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(z,e.mergeProps({key:5,map:a.map,zone:(U=i.otherLayers)==null?void 0:U["war-zones"]},o.$attrs),null,16,["map","zone"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(x,e.mergeProps({key:6,map:a.map,area:(Y=i.otherLayers)==null?void 0:Y["gmdss-areas"]},o.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(y,e.mergeProps({key:7,map:a.map,zone:(H=i.otherLayers)==null?void 0:H["eca-zones"]},o.$attrs),null,16,["map","zone"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(w,e.mergeProps({key:8,map:a.map,zone:(ee=i.otherLayers)==null?void 0:ee["alert-zones"]},o.$attrs,{"before-layer":"empty-layer-3",theme:a.theme}),null,16,["map","zone","theme"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(_,e.mergeProps({key:9,map:a.map,port:(ae=i.otherLayers)==null?void 0:ae.ports,"forecast-model":a.forecastModel},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["map","port","forecast-model"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(u,e.mergeProps({key:10,map:a.map,line:(ie=i.otherLayers)==null?void 0:ie["load-lines"]},o.$attrs),null,16,["map","line"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(L,e.mergeProps({key:11,map:a.map,zone:(te=i.otherLayers)==null?void 0:te["time-zones"]},o.$attrs),null,16,["map","zone"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(B,e.mergeProps({key:12,map:a.map,area:(F=i.otherLayers)==null?void 0:F["voluntary-reporting-area"]},o.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(A,e.mergeProps({key:13,map:a.map,area:(X=i.otherLayers)==null?void 0:X["special-area"]},o.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(j,e.mergeProps({key:14,map:a.map,area:(re=i.otherLayers)==null?void 0:re["day-night"]},o.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(V,e.mergeProps({key:15,map:a.map,"menu-toggle":a.menuToggle,show:i.checkList.includes("graticule")},o.$attrs),null,16,["map","menu-toggle","show"])):e.createCommentVNode("",!0)])}const Ai=O(vi,[["render",Ii]]);class jt{constructor(t){Q(this,"map");Q(this,"mercator");Q(this,"rampColorLayer");Q(this,"rampColorSource");Q(this,"particleLayer");Q(this,"particleSource");Q(this,"rampColorCanvas");Q(this,"particleCanvas");Q(this,"ratio");this.map=t,this.mercator=new fa,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,a=0){return t>180?this.convertNLng(t-360,a+1):t<-180?this.convertNLng(t+360,a+1):[t,a]}getBoundLngLat(){var a;const t=(a=this.map)==null?void 0:a.getBounds();return t?[[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(){var f,v;const t=(f=this.map)==null?void 0:f.getBounds();if(!t)return[];const a=((v=this.map)==null?void 0:v.getZoom())+1,r=[t._ne.lng,t._ne.lat],i=[t._sw.lng,t._sw.lat],[l,n]=this.convertNLng(r[0]),[c,s]=this.convertNLng(i[0]),[p,h]=this.mercator.px([l,r[1]],a),[d,g]=this.mercator.px([c,i[1]],a),b=Math.round(this.mercator.size*Math.pow(2,a)*(n+s));return[d,g,p+b,h]}getBoundRange(){const t=this.map.getZoom()+1,a=this.mercator.size*Math.pow(2,t),r=this.getBoundPixel();return[r[0]/a,r[2]/a,r[3]/a,r[1]/a]}getWorldCopy(t,a){const r=2**a,[i,l,n,c]=t.map(h=>~~(h/(r*256))),s=[];for(let h=c;h<=l;h++)for(let d=i;d<=n;d++)s.push([d,h]);return s.map(h=>{const d=2**a*256;return[h[0]*d,h[1]*d,d]})}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){var i;const a=(i=this.map)==null?void 0:i.getLayoutProperty(this.rampColorLayer,"visibility"),r=t?"visible":"none";a!==r&&this.map.setLayoutProperty(this.rampColorLayer,"visibility",r)}toggleParticle(t){var i;const a=(i=this.map)==null?void 0:i.getLayoutProperty(this.particleLayer,"visibility"),r=t?"visible":"none";a!==r&&this.map.setLayoutProperty(this.particleLayer,"visibility",r)}}class be{createShader(t,a,r){const i=t.createShader(a);if(i&&(t.shaderSource(i,r),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS)))throw new Error(t.getShaderInfoLog(i)||"error happened while create shader...");return i}createTexture(t,a,r,i,l,n,c){const s=t.createTexture();return t.bindTexture(t.TEXTURE_2D,s),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,a),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),l instanceof Uint8Array?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,n,c,0,t.RGBA,t.UNSIGNED_BYTE,l):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,l),t.bindTexture(t.TEXTURE_2D,null),s}createDataBuffer(t,a,r){if(t){const i=t.createBuffer();return a==="array"?(t.bindBuffer(t.ARRAY_BUFFER,i),r&&t.bufferData(t.ARRAY_BUFFER,r,t.STATIC_DRAW)):a==="element"&&(t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,i),r&&t.bufferData(t.ELEMENT_ARRAY_BUFFER,r,t.STATIC_DRAW)),i}return null}createProgram(t,a,r){const i=t.createProgram(),l=this.createShader(t,t.VERTEX_SHADER,a),n=this.createShader(t,t.FRAGMENT_SHADER,r);if(i&&l&&n&&(t.attachShader(i,l),t.attachShader(i,n),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS)))throw new Error(t.getProgramInfoLog(i)||"error happened while creating ramp color program");return i}createProgramWrapper(t,a,r){const i=this.createProgram(t,a,r);if(i){const l={program:i},n=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){const p=t.getActiveAttrib(i,s);l[p.name]=t.getAttribLocation(i,p.name)}const c=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let s=0;s<c;s++){const p=t.getActiveUniform(i,s);l[p.name]=t.getUniformLocation(i,p.name)}return l}}setup(t,a,r=!1,i,l){const n=document.createElement("canvas");n.width=256,n.height=1;const c=n.getContext("2d");if(c&&t){const s=c==null?void 0:c.createLinearGradient(0,0,256,0);return a.forEach(([p,h])=>{s.addColorStop(p,h)}),c.fillStyle=s,c.fillRect(0,0,256,1),{canvas:n,texture:this.createTexture(t,t.LINEAR,t.LINEAR,t.CLAMP_TO_EDGE,r?new Uint8Array(c.getImageData(0,0,256,1).data):n,i,l)}}}setupParticle(t,a=1e3){const r=Math.ceil(Math.sqrt(a)),i=r*r,l=new Uint8Array(i*4);for(let h=0;h<l.length;h++)l[h]=Math.floor(Math.random()*256);const n=this.createTexture(t,t.NEAREST,t.NEAREST,t.CLAMP_TO_EDGE,l,r,r),c=this.createTexture(t,t.NEAREST,t.NEAREST,t.CLAMP_TO_EDGE,l,r,r),s=new Float32Array(i);for(let h=0;h<i;h++)s[h]=h;const p=this.createDataBuffer(t,"array",s);return{resolution:r,total:i,texture0:n,texture1:c,indexBuffer:p}}bind(t,a,r){const i=this.createProgram(t,a,r);if(i){const l=this.createDataBuffer(t,"array",void 0),n=t.getAttribLocation(i,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0);const c=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]);this.createDataBuffer(t,"array",c);const s=t.getAttribLocation(i,"a_texCoord");return t.enableVertexAttribArray(s),t.vertexAttribPointer(s,2,t.FLOAT,!1,0,0),{program:i,aPositionBuffer:l}}return{}}bindParticle(t,a,r,i,l,n){const c=this.createProgramWrapper(t,a,r),s=this.createProgramWrapper(t,i,l),p=this.createProgramWrapper(t,i,n),h=this.createDataBuffer(t,"array",new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1])),d=t.createFramebuffer();return{particle:c,screen:s,update:p,quadBuffer:h,frameBuffer:d}}draw(t,a,r,i,l,n,c){var s,p;if(a&&r){t.resize(),a==null||a.viewport(0,0,(s=a==null?void 0:a.canvas)==null?void 0:s.width,(p=a==null?void 0:a.canvas)==null?void 0:p.height),a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT);try{a.useProgram(r);const h={resolution:a.getUniformLocation(r,"u_resolution"),image:a.getUniformLocation(r,"u_image"),color:a.getUniformLocation(r,"u_color"),scale:a.getUniformLocation(r,"u_scale"),uvRange:a.getUniformLocation(r,"u_range_u_v"),sRange:a.getUniformLocation(r,"u_range_s")};h.resolution&&a.uniform2f(h.resolution,a.canvas.width*t.ratio,a.canvas.height*t.ratio),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,i),h.image&&a.uniform1i(h.image,0),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,l),h.color&&a.uniform1i(h.color,1),c!=null&&c.uvRange&&(c!=null&&c.sRange)&&(h.uvRange&&a.uniform2f(h.uvRange,c.uvRange[0],c.uvRange[1]),h.sRange&&a.uniform2f(h.sRange,c.sRange[0],c.sRange[1])),h.scale&&a.uniform1f(h.scale,(c==null?void 0:c.scale)||1);const d=t.getBoundPixel(),g=t.map.getZoom()+1,b=t.getWorldCopy(d,g);for(const f of b){const v=(f[0]-d[0])*t.ratio,k=(f[1]-d[3])*t.ratio,T=f[2]*t.ratio,[z,x,y,w]=[v,T+v,k,T+k],_=new Float32Array([z,y,x,y,z,w,z,w,x,y,x,w]);a.bindBuffer(a.ARRAY_BUFFER,n),a.bufferData(a.ARRAY_BUFFER,_,a.STATIC_DRAW),a.drawArrays(a.TRIANGLES,0,6)}}catch(h){console.log(`render failed...${h}`)}}}drawParticle(t,a,r,i,l){var n,c;a&&(a==null||a.viewport(0,0,(n=a==null?void 0:a.canvas)==null?void 0:n.width,(c=a==null?void 0:a.canvas)==null?void 0:c.height),a.disable(a.DEPTH_TEST),a.disable(a.STENCIL_TEST),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,r),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,i.texture0),this.renderScreen(t,a,i,l),this.updateParticles(t,a,i,l))}renderScreen(t,a,r,i){a.bindFramebuffer(a.FRAMEBUFFER,r.frameBuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r.screenTexture,0),a.viewport(0,0,a.canvas.width,a.canvas.height),this.renderScreenTexture(a,r.backgroundTexture,r.screen,r.quadBuffer,.95),this.renderParticles(t,a,r,i),a.bindFramebuffer(a.FRAMEBUFFER,null),this.renderScreenTexture(a,r.screenTexture,r.screen,r.quadBuffer,1);const l=r.backgroundTexture;r.backgroundTexture=r.screenTexture,r.screenTexture=l}renderScreenTexture(t,a,r,i,l){t&&(t.useProgram(r.program),t.bindBuffer(t.ARRAY_BUFFER,i),t.enableVertexAttribArray(r.a_pos),t.vertexAttribPointer(r.a_pos,2,t.FLOAT,!1,0,0),t.activeTexture(t.TEXTURE2),t.bindTexture(t.TEXTURE_2D,a),t.uniform1i(r.u_screen,2),t.uniform1f(r.u_opacity,l),t.drawArrays(t.TRIANGLES,0,6))}renderParticles(t,a,r,i){if(a){a.useProgram(r.particle.program),a.bindBuffer(a.ARRAY_BUFFER,r.indexBuffer),a.enableVertexAttribArray(r.particle.a_index),a.vertexAttribPointer(r.particle.a_index,1,a.FLOAT,!1,0,0),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,r.color.texture),a.uniform1i(r.particle.u_factor,0),a.uniform1i(r.particle.u_particles,1),a.uniform1i(r.particle.u_color_ramp,2),a.uniform1f(r.particle.u_particles_resolution,r.resolution*t.ratio),a.uniform1f(r.particle.u_point,t.ratio);const l=t.getBoundRange();a.uniform4f(r.particle.u_viewport,l[0],l[1],l[2],l[3]),a.uniform2f(r.particle.u_factor_min,i.uvRange[0],i.uvRange[0]),a.uniform2f(r.particle.u_factor_max,i.uvRange[1],i.uvRange[1]),a.drawArrays(a.POINTS,0,r.total)}}updateParticles(t,a,r,i){var n,c;if(a){a.bindFramebuffer(a.FRAMEBUFFER,r.frameBuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r.texture1,0),a.viewport(0,0,r.resolution,r.resolution),a.useProgram(r.update.program),a.bindBuffer(a.ARRAY_BUFFER,r.quadBuffer),a.enableVertexAttribArray(r.update.a_pos),a.vertexAttribPointer(r.update.a_pos,2,a.FLOAT,!1,0,0),a.uniform1i(r.update.u_factor,0),a.uniform1i(r.update.u_particles,1);const s=t.getBoundRange();a.uniform4f(r.update.u_viewport,s[0],s[1],s[2],s[3]),a.uniform1f(r.update.u_rand_seed,Math.random()),a.uniform2f(r.update.u_factor_res,(n=r==null?void 0:r.image)==null?void 0:n.width,(c=r==null?void 0:r.image)==null?void 0:c.height),a.uniform2f(r.update.u_factor_min,i.uvRange[0],i.uvRange[0]),a.uniform2f(r.update.u_factor_max,i.uvRange[1],i.uvRange[1]),a.uniform1f(r.update.u_speed_factor,i.speedFactor*t.ratio),a.uniform1f(r.update.u_drop_rate,i.dropRate),a.uniform1f(r.update.u_drop_rate_bump,i.dropRateBump),a.drawArrays(a.TRIANGLES,0,6)}const l=r.texture0;r.texture0=r.texture1,r.texture1=l}resize(t,a){t.resize();const r=new Uint8Array(a.canvas.width*a.canvas.height*4).fill(0,0,a.canvas.width*a.canvas.height*4),i=this.createTexture(a,a.NEAREST,a.NEAREST,a.CLAMP_TO_EDGE,r,a.canvas.width,a.canvas.height),l=this.createTexture(a,a.NEAREST,a.NEAREST,a.CLAMP_TO_EDGE,r,a.canvas.width,a.canvas.height);return{screenTexture:i,backgroundTexture:l}}async loadImg(t){return new Promise(a=>{const r=new Blob([t],{type:t.type}),i=URL.createObjectURL(r),l=new Image;l.crossOrigin="anonymous",l.src=i,l.onload=()=>a(l)})}}class K{}Q(K,"vertexSchema",`
1
+ (function(W,J){typeof exports=="object"&&typeof module<"u"?J(exports,require("axios"),require("vuetify"),require("vue"),require("mapbox-gl"),require("@idm-plugin/geo"),require("@turf/turf"),require("@idm-plugin/tag-nop"),require("moment"),require("@mapbox/sphericalmercator"),require("@idm-plugin/tag"),require("@idm-plugin/meteo")):typeof define=="function"&&define.amd?define(["exports","axios","vuetify","vue","mapbox-gl","@idm-plugin/geo","@turf/turf","@idm-plugin/tag-nop","moment","@mapbox/sphericalmercator","@idm-plugin/tag","@idm-plugin/meteo"],J):(W=typeof globalThis<"u"?globalThis:W||self,J(W["idm-gl"]={},W.axios,W.vuetify,W.Vue,W["mapbox-gl"],W["@idm-plugin/geo"],W["@turf/turf"],W["@idm-plugin/tag-nop"],W.moment,W["@mapbox/sphericalmercator"],W["@idm-plugin/tag"],W["@idm-plugin/meteo"]))})(this,function(W,J,se,e,me,R,ua,Me,P,fa,ya,Ht){"use strict";var Vn=Object.defineProperty;var On=(W,J,se)=>J in W?Vn(W,J,{enumerable:!0,configurable:!0,writable:!0,value:se}):W[J]=se;var Q=(W,J,se)=>(On(W,typeof J!="symbol"?J+"":J,se),se);function ba(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const a in o)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(o,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:()=>o[a]})}}return t.default=o,Object.freeze(t)}const N=ba(ua),O=(o,t)=>{const a=o.__vccOpts||o;for(const[r,i]of t)a[r]=i;return a},wa={name:"IdmWarZone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:se.useTheme()}},data(){return{source:"war-zone-source",zoneLayer:"war-zone-layer",zoneLabelLayer:"war-zone-label-layer"}},watch:{zone:{handler(){this.handleRender()},immediate:!0}},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-color":this.Theme.current.value.colors["map-red"],"fill-opacity":.4}},this.beforeLayer),this.map.addLayer({id:this.zoneLayer+"-border",type:"line",source:this.source,filter:["==","$type","Polygon"],paint:{"line-width":1,"line-opacity":.7,"line-color":this.Theme.current.value.colors["map-red"]}},this.beforeLayer),this.map.addLayer({id:this.zoneLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-size":.7,"icon-image":"identify","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,1],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.zoneLayer)&&this.map.removeLayer(this.zoneLayer),this.map.getLayer(this.zoneLayer+"-border")&&this.map.removeLayer(this.zoneLayer+"-border"),this.map.getLayer(this.zoneLabelLayer)&&this.map.removeLayer(this.zoneLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function xa(o,t,a,r,i,l){return e.openBlock(),e.createElementBlock("div")}const _a=O(wa,[["render",xa]]),ka={name:"IdmGmdssArea",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:se.useTheme()}},data(){return{source:"gmdss-area-source",areaLayer:"gmdss-area-layer",areaLabelLayer:"gmdss-area-label-layer"}},watch:{area:{handler(){this.handleRender()},immediate:!0}},methods:{handleRender(){this.map?(this.handleClear(),this.area&&(this.map.addSource(this.source,{type:"geojson",data:this.area}),console.log(this.beforeLayer),this.map.addLayer({id:this.areaLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"rgba(255,255,255,0.3)","fill-opacity":.4,"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":.7,"icon-image":"identify","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":12,"text-offset":[0,1],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer))):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 va(o,t,a,r,i,l){return e.openBlock(),e.createElementBlock("div")}const za=O(ka,[["render",va]]),La={name:"IdmEcaZone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:se.useTheme()}},data(){return{source:"eca-zone-source",zoneLayer:"eca-zone-layer",zoneLabelLayer:"eca-zone-label-layer"}},watch:{zone:{handler(){this.zone?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var o;this.map?(this.handleClear(),this.zone&&(this.map.getSource(this.source)?(o=this.map)==null||o.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-opacity":.3,"fill-color":"#05f324"}},this.beforeLayer),this.map.addLayer({id:this.zoneLayer+"-border",type:"line",source:this.source,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"line-color":"#05f324","line-width":1,"line-opacity":1}},this.beforeLayer),this.map.addLayer({id:this.zoneLabelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":.7,"icon-image":"identify","text-max-width":16,"text-justify":"left","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,1],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer)))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.zoneLayer)&&this.map.removeLayer(this.zoneLayer),this.map.getLayer(this.zoneLayer+"-border")&&this.map.removeLayer(this.zoneLayer+"-border"),this.map.getLayer(this.zoneLabelLayer)&&this.map.removeLayer(this.zoneLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Ca(o,t,a,r,i,l){return e.openBlock(),e.createElementBlock("div")}const Pa=O(La,[["render",Ca]]),jn="",Sa={name:"IdmAlertZone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:se.useTheme()}},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 o,t;this.zone?(this.handleRender(),(o=this.map)==null||o.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))},immediate:!0}},methods:{handleClick(o){var r;const t=o.features[0],a=(r=this.zone)==null?void 0:r.features.filter(i=>{var l;return i.properties.id===((l=t==null?void 0:t.properties)==null?void 0:l.id)})[0];if(a){this.showZone=!0,this.form={...a.properties};const i=document.getElementById("idm-gl4-zone-info");this.marker?this.marker.setLngLat([o.lngLat.lng,o.lngLat.lat]):this.marker=new me.Marker(i).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,0]).addTo(this.map)}},handleRender(){var o;this.map?(this.handleClear(),this.zone&&(this.map.getSource(this.source)?(o=this.map)==null||o.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":this.Theme.current.value.colors["map-warning"],"fill-opacity":.4,"fill-color":this.Theme.current.value.colors["map-warning"]}},this.beforeLayer),this.map.addLayer({id:this.polygonLayer+"-border",type:"line",source:this.source,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"line-width":1,"line-color":this.Theme.current.value.colors["map-warning"]}},this.beforeLayer),this.map.addLayer({id:this.lineLayer,type:"line",source:this.source,filter:["all",["==","$type","LineString"],["!=","disabled",!0]],paint:{"line-color":this.Theme.current.value.colors["map-warning"],"line-width":2}},this.beforeLayer),this.map.addLayer({id:this.polygonLabelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-image":"warning","icon-size":.7,"icon-allow-overlap":!0,"icon-rotation-alignment":"viewport"},paint:{"icon-opacity":.8}},this.beforeLayer),this.map.addLayer({id:this.lineLabelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","LineString"],["!=","disabled",!0]],layout:{"symbol-placement":"line-center","icon-image":"warning","icon-size":.7,"icon-allow-overlap":!0,"icon-rotation-alignment":"viewport"},paint:{"icon-opacity":.8}},this.beforeLayer),this.map.addLayer({id:this.pointLayer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-image":"warning","icon-size":.7},paint:{"icon-opacity":.8}},this.beforeLayer)))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.polygonLayer)&&this.map.removeLayer(this.polygonLayer),this.map.getLayer(this.polygonLayer+"-border")&&this.map.removeLayer(this.polygonLayer+"-border"),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)}}},Na=["innerHTML"];function Ta(o,t,a,r,i,l){const n=e.resolveComponent("VBtn"),c=e.resolveComponent("v-card-text"),s=e.resolveComponent("v-card");return e.withDirectives((e.openBlock(),e.createBlock(s,{class:"scroll",id:"idm-gl4-zone-info"},{default:e.withCtx(()=>[e.createVNode(c,null,{default:e.withCtx(()=>{var p;return[e.createVNode(n,{icon:"",density:"comfortable",variant:"plain",class:"mr-n2 close",onClick:t[0]||(t[0]=h=>i.showZone=!1)},{default:e.withCtx(()=>t[1]||(t[1]=[e.createElementVNode("i",{class:"iconfont icon-close",style:{"font-size":"16px"}},null,-1)])),_:1,__:[1]}),e.createElementVNode("div",{class:"rich-context",innerHTML:(p=i.form)==null?void 0:p.name},null,8,Na)]}),_:1})]),_:1},512)),[[e.vShow,i.showZone]])}const Ma=O(Sa,[["render",Ta]]),Fn="",Ea={name:"IdmPort",props:{map:{type:Object},port:{type:Object},beforeLayer:{type:String},forecastModel:{type:String}},emits:["meteoMore"],setup(){return{Theme:se.useTheme()}},data(){return{source:"port-source",layer:"port-layer",showInfo:!1,form:{},marker:void 0}},computed:{computeLat(){return function(o){return R.LngLatHelper.lat2pretty(o,4).pretty}},computeLng(){return function(o){return R.LngLatHelper.lng2pretty(o,4).pretty}}},watch:{port:{handler(){var o,t;this.port?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick)):(this.handleClear(),(t=this.map)==null||t.off("click",[this.layer],this.handleClick))},immediate:!0}},methods:{handleClick(o){var r;const t=o.features[0],a=(r=this.port)==null?void 0:r.features.filter(i=>{var l;return i.properties.id===((l=t==null?void 0:t.properties)==null?void 0:l.id)})[0];if(console.log(a),a){this.showInfo=!0,this.form={...a.properties},this.form.lng=a.geometry.coordinates[0],this.form.lat=a.geometry.coordinates[1];const i=document.getElementById("port-info");this.marker?this.marker.setLngLat([o.lngLat.lng,o.lngLat.lat]):this.marker=new me.Marker(i).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-85]).addTo(this.map)}else this.map.zoomIn()},handleRender(){var o;this.map?this.port&&(this.map.getSource(this.source)?(o=this.map)==null||o.getSource(this.source).setData(this.port):(this.map.addSource(this.source,{type:"geojson",data:this.port,cluster:!0,clusterRadius:50}),this.map.addLayer({id:this.layer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":.7,"icon-image":"port","text-field":"{name}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,1.5]},paint:{"text-opacity":["step",["zoom"],0,2,0,4,1],"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.showInfo=!1,this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source)},handleClickMeteo(o){o.forecastModel=this.forecastModel,this.$emit("meteoMore",o)}}},Da={class:"port-box d-flex flex-column justify-center align-start ga-2"},Ba={class:"d-flex justify-start align-center"},Ia={class:"d-flex justify-start align-center"},Aa={class:"d-flex justify-start align-center"},Ra={class:"d-flex justify-start align-center"};function Va(o,t,a,r,i,l){const n=e.resolveComponent("VBtn"),c=e.resolveComponent("v-card-text"),s=e.resolveComponent("v-divider"),p=e.resolveComponent("v-btn"),h=e.resolveComponent("v-card-actions"),d=e.resolveComponent("v-card");return e.withDirectives((e.openBlock(),e.createBlock(d,{id:"port-info",ref:"idmPortInfo"},{default:e.withCtx(()=>[e.createVNode(c,{class:"pr-8"},{default:e.withCtx(()=>[e.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2 close",onClick:t[0]||(t[0]=g=>i.showInfo=!1)},{default:e.withCtx(()=>t[2]||(t[2]=[e.createElementVNode("i",{class:"iconfont icon-close",style:{"font-size":"16px"}},null,-1)])),_:1,__:[2]}),e.createElementVNode("div",Da,[e.createElementVNode("div",Ba,[t[3]||(t[3]=e.createElementVNode("label",{class:"opacity-70 pr-1"},"Name : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.form.name||"-"),1)]),e.createElementVNode("div",Ia,[t[4]||(t[4]=e.createElementVNode("label",{class:"opacity-70 pr-1"},"Position : ",-1)),e.createElementVNode("span",null,e.toDisplayString(l.computeLat(i.form.lat))+", "+e.toDisplayString(l.computeLng(i.form.lng)),1)]),e.createElementVNode("div",Aa,[t[5]||(t[5]=e.createElementVNode("label",{class:"opacity-70 pr-1"},"LoCode : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.form.loCode||"-"),1)]),e.createElementVNode("div",Ra,[t[6]||(t[6]=e.createElementVNode("label",{class:"opacity-70 pr-1"},"Region : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.form.zoneName||"-"),1)])])]),_:1}),e.createVNode(s),e.createVNode(h,{class:"d-flex justify-end align-center"},{default:e.withCtx(()=>[e.createVNode(p,{variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"meteo-forecast flex-end text-none",onClick:t[1]||(t[1]=g=>l.handleClickMeteo(i.form))},{default:e.withCtx(()=>t[7]||(t[7]=[e.createTextVNode(" Meteo Forecast ",-1)])),_:1,__:[7]})]),_:1})]),_:1},512)),[[e.vShow,i.showInfo]])}const Oa=O(Ea,[["render",Va],["__scopeId","data-v-0cf4535a"]]),ja={name:"IdmLoadLine",props:{map:{type:Object},line:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:se.useTheme()}},data(){return{source:"load-line-source",lineLayer:"load-line-layer",lineLabelLayer:"load-line-label-layer"}},watch:{line:{handler(){this.handleRender()},immediate:!0}},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":"rgba(255,255,255,0.3)","fill-opacity":.6,"fill-color":["match",["get","val"],"LLGreen","rgba(164, 214, 217, 1)","LLRed","rgba(217, 150, 151, 1)","LLBlue","rgba(53, 121, 194, 1)","#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,"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer))):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 Fa(o,t,a,r,i,l){return e.openBlock(),e.createElementBlock("div")}const Ha=O(ja,[["render",Fa]]),Ga={name:"IdmTimezone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:se.useTheme()}},data(){return{source:"time-zone-source",zoneLayer:"time-zone-layer",zoneLabelLayer:"time-zone-label-layer"}},watch:{zone:{handler(){this.handleRender()},immediate:!0}},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":"rgba(255, 255, 255, 0.5)","fill-opacity":.25,"fill-color":["match",["get","offSet"],"-11.5","rgba(255, 92, 88, 1)","-11","rgba(39, 195, 70, 1)","-10.5","rgba(39, 195, 70, 1)","-10","rgba(40, 106, 255, 1)","-9.5","rgba(40, 106, 255, 1)","-9","rgba(255, 92, 88, 1)","-8.5","rgba(255, 92, 88, 1)","-8","rgba(39, 195, 70, 1)","-7.5","rgba(39, 195, 70, 1)","-7","rgba(40, 106, 255, 1)","-6.5","rgba(40, 106, 255, 1)","-6","rgba(255, 92, 88, 1)","-5.5","rgba(255, 92, 88, 1)","-5","rgba(39, 195, 70, 1)","-4.5","rgba(39, 195, 70, 1)","-4","rgba(40, 106, 255, 1)","-3.5","rgba(40, 106, 255, 1)","-3","rgba(255, 92, 88, 1)","-2.5","rgba(255, 92, 88, 1)","-2","rgba(39, 195, 70, 1)","-1.5","rgba(39, 195, 70, 1)","-1","rgba(40, 106, 255, 1)","-0.5","rgba(40, 106, 255, 1)","+0","rgba(255, 92, 88, 1)","+0.5","rgba(255, 92, 88, 1)","+1","rgba(39, 195, 70, 1)","+1.5","rgba(39, 195, 70, 1)","+2","rgba(40, 106, 255, 1)","+2.5","rgba(40, 106, 255, 1)","+3","rgba(255, 92, 88, 1)","+3.5","rgba(255, 92, 88, 1)","+4","rgba(39, 195, 70, 1)","+4.5","rgba(39, 195, 70, 1)","+5","rgba(40, 106, 255, 1)","+5.5","rgba(40, 106, 255, 1)","+6","rgba(255, 92, 88, 1)","+6.5","rgba(255, 92, 88, 1)","+7","rgba(39, 195, 70, 1)","+7.5","rgba(39, 195, 70, 1)","+8","rgba(40, 106, 255, 1)","+8.5","rgba(40, 106, 255, 1)","+9","rgba(255, 92, 88, 1)","+9.5","rgba(255, 92, 88, 1)","+10","rgba(39, 195, 70, 1)","+10.5","rgba(39, 195, 70, 1)","+11","rgba(40, 106, 255, 1)","+11.5","rgba(40, 106, 255, 1)","rgba(255, 92, 88, 1)"]}},this.beforeLayer),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":10,"text-offset":[0,1],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer))):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 Wa(o,t,a,r,i,l){return e.openBlock(),e.createElementBlock("div")}const Ua=O(Ga,[["render",Wa]]),Ya={name:"IdmVoluntaryReportingArea",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:se.useTheme()}},data(){return{source:"vra-source",areaLayer:"vra-layer",areaLabelLayer:"vra-label-layer"}},watch:{area:{handler(){this.area?this.handleRender():this.handleClear()},immediate:!0}},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-opacity":.3,"fill-color":"rgba(144, 96, 217, 1)"}},this.beforeLayer),this.map.addLayer({id:this.areaLayer+"-border",type:"line",source:this.source,filter:["==","$type","Polygon"],paint:{"line-width":1,"line-opacity":1,"line-color":"rgba(164, 125, 222, 1)"}},this.beforeLayer),this.map.addLayer({id:this.areaLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-size":.1,"icon-image":"identify","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,1],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.areaLayer)&&this.map.removeLayer(this.areaLayer),this.map.getLayer(this.areaLayer+"-border")&&this.map.removeLayer(this.areaLayer+"-border"),this.map.getLayer(this.areaLabelLayer)&&this.map.removeLayer(this.areaLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Za(o,t,a,r,i,l){return e.openBlock(),e.createElementBlock("div")}const Xa=O(Ya,[["render",Za]]),qa={name:"IdmSpecialArea",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:se.useTheme()}},data(){return{source:"special-area-source",areaLayer:"special-area-layer",areaLabelLayer:"special-area-label-layer"}},watch:{area:{handler(){this.handleRender()},immediate:!0}},methods:{handleRender(){this.map?(this.handleClear(),this.area&&(this.area.features.forEach(o=>{o.geometry.type==="Polygon"&&o.geometry.coordinates.forEach(t=>R.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-opacity":.25,"fill-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.areaLayer+"-border",type:"line",source:this.source,filter:["==","$type","Polygon"],paint:{"line-width":1,"line-opacity":.7,"line-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.areaLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-size":.7,"icon-image":"identify","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,1],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.areaLayer)&&this.map.removeLayer(this.areaLayer),this.map.getLayer(this.areaLayer+"-border")&&this.map.removeLayer(this.areaLayer+"-border"),this.map.getLayer(this.areaLabelLayer)&&this.map.removeLayer(this.areaLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Ka(o,t,a,r,i,l){return e.openBlock(),e.createElementBlock("div")}const Qa=O(qa,[["render",Ka]]),Ja={name:"IdmTerminator",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},data(){return{source:"terminator-source",layer:"terminator-layer"}},computed:{},watch:{area:{handler(){this.handleRender()},immediate:!0}},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":"rgba(255,255,255,0.3)","fill-color":"rgba(0, 0, 0, 0.3)"}},this.beforeLayer))):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 $a(o,t,a,r,i,l){return e.openBlock(),e.createElementBlock("div")}const ei=O(Ja,[["render",$a]]),ti={name:"IdmWorld12nm",props:{map:{type:Object},show:{type:Boolean},weatherLayers:{type:Object,default:()=>({})},zoom:{type:Number,default:3},left:{type:String,default:"10px"},bottom:{type:String,default:"64px"},token:{type:String,default:""}},data(){return{layer:"world-12nm-v4-20231025"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var o;this.map?(o=this.map)!=null&&o.getLayer(this.layer)&&(this.map.setLayoutProperty(this.layer,"visibility","visible"),this.map.setPaintProperty(this.layer,"line-color","rgb(210,54,83)"),this.map.setPaintProperty(this.layer,"line-width",2)):setTimeout(()=>{this.handleRender()},500)},handleClear(){var o;(o=this.map)!=null&&o.getLayer(this.layer)&&this.map.setLayoutProperty(this.layer,"visibility","none")}}};function oi(o,t,a,r,i,l){return null}const ai=O(ti,[["render",oi]]),Hn="",ii={name:"IdmWorldMarine",props:{map:{type:Object},show:{type:Boolean}},data(){return{labelLayer:"ne-10m-label",lineLayer:"ne-10m-outline"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var o,t;this.map?((o=this.map)!=null&&o.getLayer(this.lineLayer)&&(this.map.setLayoutProperty(this.lineLayer,"visibility","visible"),this.map.setPaintProperty(this.lineLayer,"line-width",1)),(t=this.map)!=null&&t.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","visible")):setTimeout(()=>{this.handleRender()},500)},handleClear(){var o,t;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","none"),(t=this.map)!=null&&t.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","none")}}};function ri(o,t,a,r,i,l){return null}const li=O(ii,[["render",ri]]),ni={name:"IdmChinaRoute",props:{map:{type:Object},show:{type:Boolean}},data(){return{labelLayer:"china-route-label",lineLayer:"china-route-line",fillLayer:"china-route-fill"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var o,t,a;this.map?((o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","visible"),(t=this.map)!=null&&t.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","visible"),(a=this.map)!=null&&a.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","visible")):setTimeout(()=>{this.handleRender()},500)},handleClear(){var o,t,a;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","none"),(t=this.map)!=null&&t.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","none"),(a=this.map)!=null&&a.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","none")}}};function si(o,t,a,r,i,l){return null}const ci=O(ni,[["render",si]]),Gn="",mi={name:"IdmTideStations",props:{map:{type:Object},show:{type:Boolean},locale:{type:String}},data(){return{layer:"tide-stations",showInfo:!1,form:{},marker:null}},computed:{computeLat(){return function(o){return R.LngLatHelper.lat2pretty(o,4).pretty}},computeLng(){return function(o){return R.LngLatHelper.lng2pretty(o,4).pretty}}},watch:{show:{handler(){var o,t;this.show?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick)):(this.handleClear(),(t=this.map)==null||t.off("click",[this.layer],this.handleClick))},immediate:!0},locale:{handler(){this.show&&this.handleRender()},immediate:!0}},methods:{handleClick(o){const t=o.features[0];if(t){this.showInfo=!0,this.form={...t.properties},this.form.name=this.locale==="en"?t.properties.Location_EN:t.properties.Location_CN,this.form.lng=o.lngLat.lng,this.form.lat=o.lngLat.lat;const a=document.getElementById("tidal-station-info");this.marker?this.marker.setLngLat([o.lngLat.lng,o.lngLat.lat]):this.marker=new me.Marker(a).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-85]).addTo(this.map)}else this.map.zoomIn()},handleRender(){var o;this.map?(o=this.map)!=null&&o.getLayer(this.layer)&&(this.map.setLayoutProperty(this.layer,"visibility","visible"),this.map.setLayoutProperty(this.layer,"text-field",this.locale==="en"?"{Location_EN}":"{Location_CN}")):setTimeout(()=>{this.handleRender()},500)},handleClear(){var o;this.showInfo=!1,(o=this.map)!=null&&o.getLayer(this.layer)&&this.map.setLayoutProperty(this.layer,"visibility","none")}}},di={class:"port-box d-flex flex-column justify-center align-start ga-2"},hi={class:"d-flex justify-start align-center"},pi={class:"d-flex justify-start align-center"},gi={class:"d-flex justify-start align-center"},ui={class:"d-flex justify-start align-center"};function fi(o,t,a,r,i,l){const n=e.resolveComponent("VBtn"),c=e.resolveComponent("v-card-text"),s=e.resolveComponent("v-card");return e.withDirectives((e.openBlock(),e.createBlock(s,{id:"tidal-station-info"},{default:e.withCtx(()=>[e.createVNode(c,{class:"pr-8"},{default:e.withCtx(()=>[e.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2 close",onClick:t[0]||(t[0]=p=>i.showInfo=!1)},{default:e.withCtx(()=>t[1]||(t[1]=[e.createElementVNode("i",{class:"iconfont icon-close",style:{"font-size":"16px"}},null,-1)])),_:1,__:[1]}),e.createElementVNode("div",di,[e.createElementVNode("div",hi,[t[2]||(t[2]=e.createElementVNode("label",{class:"opacity-70 pr-1 pr-1"},"Name : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.form.name),1)]),e.createElementVNode("div",pi,[t[3]||(t[3]=e.createElementVNode("label",{class:"opacity-70 pr-1"},"Position : ",-1)),e.createElementVNode("span",null,e.toDisplayString(l.computeLat(i.form.lat))+", "+e.toDisplayString(l.computeLng(i.form.lng)),1)]),e.createElementVNode("div",gi,[t[4]||(t[4]=e.createElementVNode("label",{class:"opacity-70 pr-1"},"LoCode : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.form.Code||"-"),1)]),e.createElementVNode("div",ui,[t[5]||(t[5]=e.createElementVNode("label",{class:"opacity-70 pr-1"},"Country : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.form.Country||"-"),1)])])]),_:1})]),_:1},512)),[[e.vShow,i.showInfo]])}const yi=O(mi,[["render",fi],["__scopeId","data-v-fb4aeed3"]]),bi={name:"IdmIceAreas",props:{map:{type:Object},show:{type:Boolean}},data(){return{lineLayer:"ice-area-line",fillLayer:"ice-area-fill"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var o,t;this.map?((o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","visible"),(t=this.map)!=null&&t.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","visible")):setTimeout(()=>{this.handleRender()},500)},handleClear(){var o,t;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","none"),(t=this.map)!=null&&t.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","none")}}};function wi(o,t,a,r,i,l){return null}const xi=O(bi,[["render",wi]]),Wn="",_i={name:"IdmLatLng",props:{map:{type:Object},show:{type:Boolean},mapFeather:{type:String},beforeLayer:{type:String},menuToggle:{type:Object}},data(){return{lngLat:{e:{lng:0,lat:0},lng:0,lat:0,str:""},source:"idm-lat-lng-source",layer:"idm-lat-lng-layer",labelLayer:"idm-lat-lng-label-layer",right:10}},computed:{lineColor(){return["satellite","dark"].includes(this.mapFeather)?"rgba(255, 255, 255, 0.3)":"rgba(0, 0, 0, 0.3)"}},watch:{show:{handler(){this.handleBind()},immediate:!0},map:{handler(){var o;this.map&&((o=this.map)==null||o.on("mousemove",this.handleMouseMove))},immediate:!0},"menuToggle.v":{handler(){var o;this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10},immediate:!0},"lngLat.e":{handler(o){this.lngLat.lng=R.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty,this.lngLat.lat=R.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty,this.lngLat.str=`[${o==null?void 0:o.lng.toFixed(4)}, ${o==null?void 0:o.lat.toFixed(4)}]`},immediate:!0}},methods:{handleBind(){var o,t;this.show?((o=this.map)==null||o.on("zoomend",this.handleZoomEnd),this.handleRender()):(this.handleClear(),(t=this.map)==null||t.off("zoomend",this.handleZoomEnd))},handleMouseMove(o){this.lngLat.e=o.lngLat},handleComputeLatLngs(){var r;const o=(r=this.map)==null?void 0:r.getZoom();let t=30;o>4?t=10:o>3&&(t=15);const a=[];for(let i=-60;i<90;i+=t)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[-180,i],[180,i]]}});for(let i=-180;i<180;i+=t)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[i,-90],[i,90]]}});for(let i=180;i>-180;i-=t)for(let l=-60;l<90;l+=t)a.push({type:"Feature",geometry:{type:"Point",coordinates:[i,l]},properties:{val:`${l>0?l+" N":l===0?l:l*-1+" S"}, ${i>0?i+" E":i*-1+" W"}`}});return a},handleZoomEnd(){var t;const o=this.handleComputeLatLngs();(t=this.map)==null||t.getSource(this.source).setData(N.featureCollection(o))},handleRender(){if(this.handleClear(),this.map){const o=this.handleComputeLatLngs();this.map.addSource(this.source,{type:"geojson",data:{type:"FeatureCollection",features:o}}),this.map.addLayer({id:this.layer,type:"line",source:this.source,filter:["==","$type","LineString"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":this.lineColor,"line-width":1}},this.beforeLayer),this.map.addLayer({id:this.labelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","text-field":"{val}","text-rotation-alignment":"viewport","text-offset":[0,1],"text-size":10,"text-allow-overlap":!0},paint:{"text-opacity":.8,"text-color":this.lineColor}},this.beforeLayer)}},handleClear(){var o,t,a,r,i,l;(o=this.map)!=null&&o.getLayer(this.layer)&&((t=this.map)==null||t.removeLayer(this.layer)),(a=this.map)!=null&&a.getLayer(this.labelLayer)&&((r=this.map)==null||r.removeLayer(this.labelLayer)),(i=this.map)!=null&&i.getSource(this.source)&&((l=this.map)==null||l.removeSource(this.source))}}};function ki(o,t,a,r,i,l){var n,c,s;return e.openBlock(),e.createElementBlock("div",{class:"idm-lat-lng-tip-gl4 pa-2 text-caption text-right rounded",style:e.normalizeStyle({right:i.right+"px"})},[e.createElementVNode("div",null,e.toDisplayString((n=i.lngLat)==null?void 0:n.lat),1),e.createElementVNode("div",null,e.toDisplayString((c=i.lngLat)==null?void 0:c.lng),1),e.createElementVNode("div",null,e.toDisplayString((s=i.lngLat)==null?void 0:s.str),1)],4)}const Gt=O(_i,[["render",ki]]),Un="",vi={name:"IdmOtherLayerr",components:{IdmWarZone:_a,IdmGmdssArea:za,IdmEcaZone:Pa,IdmAlertZone:Ma,IdmPort:Oa,IdmLoadLine:Ha,IdmTimezone:Ua,IdmVRA:Xa,IdmSpecialArea:Qa,IdmTerminator:ei,IdmWorld12nm:ai,IdmWorldMarine:li,IdmChinaRoute:ci,IdmTideStations:yi,IdmIceAreas:xi,IdmLatLng:Gt},props:{map:{type:Object},theme:{type:String},token:{type:String},isLogin:{type:Boolean,default:!1},defaultMeteoToken:{type:String},gateway:{type:String},assistGateway:{type:Array,default:[]},top:{type:Number,default:60},menuToggle:{type:Object,default:{}},ts:{type:String},forecastModel:{type:String},realTime:{type:String}},emits:["map","other","menuToggle","mapFeather","theme","followLayerList","otherCheckList"],data(){return{right:10,toggle:!1,mapFeather:localStorage.getItem("mapFeathersCacheGL4")||"light",tagLayers:[...Me.LayerHelper.OTHER_LAYERS.filter(o=>o.enabled)],layerWeight:0,otherLayers:{},activeOtherLayers:[],cache:{v:"0.0.2",versionKey:"otherLayerCacheVersionGL4",checkListKey:"otherChecklistCacheGL4",followListKey:"otherFollowListCacheGL4",mapFeatherKey:"mapFeathersCacheGL4"},mapFeathers:[{name:"Light Map",value:"light",locale:"lightMap"},{name:"Dark Map",value:"dark",locale:"darkMap"},{name:"Satelite Map",value:"satellite",locale:"satelliteMap"},{name:"Nautical Map",value:"nautical",locale:"nauticalMap"}],checkList:[],followList:[]}},computed:{computeLayerClass(){return function(o,t){let a="layer flex-between";return t.some(r=>r.key===o.key)&&(a=a+" active"),a}}},watch:{isLogin:{handler(){this.isLogin&&this.fetchOtherLayers()},immediate:!0},"menuToggle.v":{handler(){this.toggle=this.menuToggle.otherLayers,this.$nextTick(()=>{var o;this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10})},immediate:!0},theme:{handler(){this.theme==="light"?this.mapFeather=["light","nautical"].includes(this.mapFeather)?this.mapFeather:"light":this.mapFeather=["dark","satellite"].includes(this.mapFeather)?this.mapFeather:"dark"},immediate:!0},mapFeather:{handler(){localStorage.setItem(this.cache.mapFeatherKey,this.mapFeather),this.$emit("mapFeather",this.mapFeather),this.$emit("theme",["light","nautical"].includes(this.mapFeather)?"light":"dark")},immediate:!0},checkList:{handler(o,t){localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),this.activeOtherLayers=this.tagLayers.filter(l=>this.checkList.includes(l.key))||[];const a=o==null?void 0:o.filter(l=>!(t!=null&&t.includes(l))),r=t==null?void 0:t.filter(l=>!(o!=null&&o.includes(l))),i=o==null?void 0:o.filter(l=>t==null?void 0:t.includes(l));if((r==null?void 0:r.length)>0&&r.forEach(l=>{this.otherLayers[l]=void 0,delete this.otherLayers[l]}),(a==null?void 0:a.length)>0){const l=this.tagLayers.filter(n=>this.checkList.includes(n.key)&&!i.includes(n.key))||[];this.handleLayersChange(l)}this.$emit("otherCheckList",this.checkList)}},followList:{handler(){localStorage.setItem(this.cache.followListKey,JSON.stringify(this.followList)),this.$emit("followLayerList",this.followList)}}},async mounted(){this.fetchCache()},methods:{fetchCache(){const o=localStorage.getItem(this.cache.versionKey);this.cache.v!==o&&(localStorage.removeItem(this.cache.checkListKey),localStorage.removeItem(this.cache.followListKey),localStorage.removeItem(this.cache.mapFeatherKey),localStorage.setItem(this.cache.versionKey,this.cache.v));let t=localStorage.getItem(this.cache.checkListKey);this.checkList=JSON.parse(t||'["eca-zones"]'),localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),t=localStorage.getItem(this.cache.followListKey),this.followList=JSON.parse(t||"[]"),localStorage.setItem(this.cache.followListKey,JSON.stringify(this.followList)),t=localStorage.getItem(this.cache.mapFeatherKey);const a=t||"light";this.$emit("mapFeather",a),localStorage.setItem(this.cache.mapFeatherKey,a)},handleMenuToggle(){this.$emit("menuToggle","otherLayers")},handleToggleMapFeather(o){this.$emit("map",void 0),this.mapFeather=o.value},async fetchOtherLayers(o={all:!1,dayNight:!1}){var a,r,i,l;let t=this.layerWeight;if(t){if(o.all){const n=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],c=await J.get(`${n}/api/arc/other/layers/links?l=${t}&t=${this.realTime}`,{headers:{Authorization:this.token||this.defaultMeteoToken}});if(((a=c==null?void 0:c.data)==null?void 0:a.code)===0){const s=(r=c==null?void 0:c.data)==null?void 0:r.data,p=[];for(const d in s)p.push(J.get(s[d],{headers:{Authorization:this.token||this.defaultMeteoToken,key:d}}));(await Promise.all(p)).map(d=>{var f,v,k;const g=((f=d==null?void 0:d.data)==null?void 0:f.data)||(d==null?void 0:d.data),b=(k=(v=d==null?void 0:d.config)==null?void 0:v.headers)==null?void 0:k.key;this.otherLayers[b]=g})}}else if(o.dayNight&&t&1024){const n=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],c=await J.get(`${n}/api/arc/other/layers/links?l=1024&t=${this.realTime}`,{headers:{Authorization:this.token||this.defaultMeteoToken}});if(((i=c==null?void 0:c.data)==null?void 0:i.code)===0){const s=(l=c==null?void 0:c.data)==null?void 0:l.data,p=[];for(const d in s)p.push(J.get(s[d],{headers:{Authorization:this.token||this.defaultMeteoToken,key:d}}));(await Promise.all(p)).map(d=>{var f,v,k;const g=((f=d==null?void 0:d.data)==null?void 0:f.data)||(d==null?void 0:d.data),b=(k=(v=d==null?void 0:d.config)==null?void 0:v.headers)==null?void 0:k.key;this.otherLayers[b]=g})}}}},handleLayersChange(o){const t=o==null?void 0:o.reduce((a,r)=>a+(r==null?void 0:r.weight),0);this.layerWeight=t,this.fetchOtherLayers({all:!0})}}},zi={class:"idm-gl4-other-layer"},Li={class:"header-box d-flex justify-space-between align-center px-4"},Ci={class:"text-h5 font-weight-medium"},Pi={class:"list-box scroll pl-4 pr-2 overflow-y-auto"},Si={class:"layers-body mt-4 d-flex justify-start align-center flex-wrap"},Ni=["onClick"],Ti={key:0,src:"https://osshz.idmwx.com/asset/dark-map.png",class:"border rounded-sm"},Mi={key:1,src:"https://osshz.idmwx.com/asset/nautical-map.png",class:"border rounded-sm"},Ei={key:2,src:"https://osshz.idmwx.com/asset/satellite-map.png",class:"border rounded-sm"},Di={key:3,src:"https://osshz.idmwx.com/asset/light-map.png",class:"border rounded-sm"},Bi={class:"text-body-2 text-center pt-1"};function Ii(o,t,a,r,i,l){var U,Y,H,ee,ae,ie,te,F,X,re;const n=e.resolveComponent("VBtn"),c=e.resolveComponent("VTooltip"),s=e.resolveComponent("VCardTitle"),p=e.resolveComponent("VCardItem"),h=e.resolveComponent("VCheckbox"),d=e.resolveComponent("VCardText"),g=e.resolveComponent("VCard"),b=e.resolveComponent("IdmTideStations"),f=e.resolveComponent("IdmIceAreas"),v=e.resolveComponent("IdmWorld12nm"),k=e.resolveComponent("IdmWorldMarine"),T=e.resolveComponent("IdmChinaRoute"),z=e.resolveComponent("IdmWarZone"),x=e.resolveComponent("IdmGmdssArea"),y=e.resolveComponent("IdmEcaZone"),w=e.resolveComponent("IdmAlertZone"),_=e.resolveComponent("IdmPort"),u=e.resolveComponent("IdmLoadLine"),L=e.resolveComponent("IdmTimezone"),B=e.resolveComponent("IdmVRA"),A=e.resolveComponent("IdmSpecialArea"),j=e.resolveComponent("IdmTerminator"),V=e.resolveComponent("IdmLatLng");return e.openBlock(),e.createElementBlock("div",zi,[e.createElementVNode("div",{class:"menu-bar-box transition px-1 rounded",style:e.normalizeStyle({top:a.top+10+"px",right:i.right+"px"})},[e.createVNode(c,{text:o.$t("layer.mapLayers"),location:"left"},{activator:e.withCtx(({props:M})=>[e.createVNode(n,e.mergeProps(M,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:e.withCtx(()=>t[5]||(t[5]=[e.createElementVNode("i",{class:"iconfont icon-Layer text-h4"},null,-1)])),_:2,__:[5]},1040,["class","onClick"])]),_:1},8,["text"])],4),e.createElementVNode("div",{class:e.normalizeClass(["available-layers transition",i.toggle?"right-bar":""]),style:e.normalizeStyle({top:a.top+"px",right:i.toggle?"0px":"-280px"})},[e.createElementVNode("div",Li,[e.createElementVNode("div",Ci,e.toDisplayString(o.$t("layer.layers")),1),e.createVNode(n,{icon:"",density:"comfortable",variant:"plain",class:"mr-n2",onClick:l.handleMenuToggle},{default:e.withCtx(()=>t[6]||(t[6]=[e.createElementVNode("i",{class:"iconfont icon-close",style:{"font-size":"20px"}},null,-1)])),_:1,__:[6]},8,["onClick"])]),e.createElementVNode("div",Pi,[e.createVNode(g,{class:"menu-card mx-auto mb-3",elevation:"0"},{default:e.withCtx(()=>[e.createVNode(p,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-subtitle-1 font-weight-medium",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("layer.mapFeathers")),1)]),_:1})]),_:1}),e.createVNode(d,{class:"pb-2"},{default:e.withCtx(()=>[e.createElementVNode("div",Si,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.mapFeathers,M=>(e.openBlock(),e.createElementBlock("div",{key:M.value,class:"mb-2 feather-item",onClick:$=>l.handleToggleMapFeather(M)},[e.createElementVNode("div",{class:e.normalizeClass([i.mapFeather===M.value?"active":"","img-box"])},[M.value==="dark"?(e.openBlock(),e.createElementBlock("img",Ti)):M.value==="nautical"?(e.openBlock(),e.createElementBlock("img",Mi)):M.value==="satellite"?(e.openBlock(),e.createElementBlock("img",Ei)):(e.openBlock(),e.createElementBlock("img",Di))],2),e.createElementVNode("div",Bi,e.toDisplayString(o.$t(`layer.${M.locale}`)),1)],8,Ni))),128))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tagLayers.filter(M=>["graticule","day-night","time-zones"].includes(M.key)),M=>(e.openBlock(),e.createBlock(h,{key:M.key,modelValue:i.checkList,"onUpdate:modelValue":t[0]||(t[0]=$=>i.checkList=$),value:M.key,label:o.$t(`layer.${M.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),e.createVNode(g,{class:"menu-card mx-auto mb-3",elevation:"0"},{default:e.withCtx(()=>[e.createVNode(p,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-subtitle-1 font-weight-medium",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("layer.pointsOfInteresting")),1)]),_:1})]),_:1}),e.createVNode(d,{class:"py-2"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tagLayers.filter(M=>["ports","alert-zones","tidal-stations"].includes(M.key)),M=>(e.openBlock(),e.createBlock(h,{key:M.key,modelValue:i.checkList,"onUpdate:modelValue":t[1]||(t[1]=$=>i.checkList=$),value:M.key,label:o.$t(`layer.${M.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),e.createVNode(g,{class:"menu-card mx-auto mb-3",elevation:"0"},{default:e.withCtx(()=>[e.createVNode(p,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-subtitle-1 font-weight-medium",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("layer.otherLayers")),1)]),_:1})]),_:1}),e.createVNode(d,{class:"py-2"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tagLayers.filter(M=>!["graticule","day-night","time-zones","ports","alert-zones","tidal-stations"].includes(M.key)),M=>(e.openBlock(),e.createBlock(h,{key:M.key,modelValue:i.checkList,"onUpdate:modelValue":t[2]||(t[2]=$=>i.checkList=$),value:M.key,label:o.$t(`layer.${M.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),e.createVNode(g,{class:"menu-card mx-auto mb-3",elevation:"0"},{default:e.withCtx(()=>[e.createVNode(p,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-subtitle-1 font-weight-medium",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("layer.myFollows")),1)]),_:1})]),_:1}),e.createVNode(d,{class:"py-2"},{default:e.withCtx(()=>[e.createVNode(h,{modelValue:i.followList,"onUpdate:modelValue":t[3]||(t[3]=M=>i.followList=M),value:"ports",label:o.$t("layer.ports"),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","label"]),e.createVNode(h,{modelValue:i.followList,"onUpdate:modelValue":t[4]||(t[4]=M=>i.followList=M),value:"locations",label:o.$t("layer.locations"),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","label"])]),_:1})]),_:1})])],6),a.map?(e.openBlock(),e.createBlock(b,e.mergeProps({key:0,map:a.map,show:i.checkList.includes("tidal-stations")},o.$attrs),null,16,["map","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(f,e.mergeProps({key:1,map:a.map,show:i.checkList.includes("ice-areas")},o.$attrs),null,16,["map","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(v,e.mergeProps({key:2,map:a.map,token:a.token,show:i.checkList.includes("world12nm")},o.$attrs),null,16,["map","token","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(k,e.mergeProps({key:3,map:a.map,token:a.token,show:i.checkList.includes("worldMarine")},o.$attrs),null,16,["map","token","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(T,e.mergeProps({key:4,map:a.map,token:a.token,show:i.checkList.includes("chinaRoute")},o.$attrs),null,16,["map","token","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(z,e.mergeProps({key:5,map:a.map,zone:(U=i.otherLayers)==null?void 0:U["war-zones"]},o.$attrs),null,16,["map","zone"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(x,e.mergeProps({key:6,map:a.map,area:(Y=i.otherLayers)==null?void 0:Y["gmdss-areas"]},o.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(y,e.mergeProps({key:7,map:a.map,zone:(H=i.otherLayers)==null?void 0:H["eca-zones"]},o.$attrs),null,16,["map","zone"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(w,e.mergeProps({key:8,map:a.map,zone:(ee=i.otherLayers)==null?void 0:ee["alert-zones"]},o.$attrs,{"before-layer":"empty-layer-3",theme:a.theme}),null,16,["map","zone","theme"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(_,e.mergeProps({key:9,map:a.map,port:(ae=i.otherLayers)==null?void 0:ae.ports,"forecast-model":a.forecastModel},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["map","port","forecast-model"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(u,e.mergeProps({key:10,map:a.map,line:(ie=i.otherLayers)==null?void 0:ie["load-lines"]},o.$attrs),null,16,["map","line"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(L,e.mergeProps({key:11,map:a.map,zone:(te=i.otherLayers)==null?void 0:te["time-zones"]},o.$attrs),null,16,["map","zone"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(B,e.mergeProps({key:12,map:a.map,area:(F=i.otherLayers)==null?void 0:F["voluntary-reporting-area"]},o.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(A,e.mergeProps({key:13,map:a.map,area:(X=i.otherLayers)==null?void 0:X["special-area"]},o.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(j,e.mergeProps({key:14,map:a.map,area:(re=i.otherLayers)==null?void 0:re["day-night"]},o.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(V,e.mergeProps({key:15,map:a.map,"menu-toggle":a.menuToggle,show:i.checkList.includes("graticule")},o.$attrs),null,16,["map","menu-toggle","show"])):e.createCommentVNode("",!0)])}const Ai=O(vi,[["render",Ii]]);class jt{constructor(t){Q(this,"map");Q(this,"mercator");Q(this,"rampColorLayer");Q(this,"rampColorSource");Q(this,"particleLayer");Q(this,"particleSource");Q(this,"rampColorCanvas");Q(this,"particleCanvas");Q(this,"ratio");this.map=t,this.mercator=new fa,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,a=0){return t>180?this.convertNLng(t-360,a+1):t<-180?this.convertNLng(t+360,a+1):[t,a]}getBoundLngLat(){var a;const t=(a=this.map)==null?void 0:a.getBounds();return t?[[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(){var f,v;const t=(f=this.map)==null?void 0:f.getBounds();if(!t)return[];const a=((v=this.map)==null?void 0:v.getZoom())+1,r=[t._ne.lng,t._ne.lat],i=[t._sw.lng,t._sw.lat],[l,n]=this.convertNLng(r[0]),[c,s]=this.convertNLng(i[0]),[p,h]=this.mercator.px([l,r[1]],a),[d,g]=this.mercator.px([c,i[1]],a),b=Math.round(this.mercator.size*Math.pow(2,a)*(n+s));return[d,g,p+b,h]}getBoundRange(){const t=this.map.getZoom()+1,a=this.mercator.size*Math.pow(2,t),r=this.getBoundPixel();return[r[0]/a,r[2]/a,r[3]/a,r[1]/a]}getWorldCopy(t,a){const r=2**a,[i,l,n,c]=t.map(h=>~~(h/(r*256))),s=[];for(let h=c;h<=l;h++)for(let d=i;d<=n;d++)s.push([d,h]);return s.map(h=>{const d=2**a*256;return[h[0]*d,h[1]*d,d]})}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){var i;const a=(i=this.map)==null?void 0:i.getLayoutProperty(this.rampColorLayer,"visibility"),r=t?"visible":"none";a!==r&&this.map.setLayoutProperty(this.rampColorLayer,"visibility",r)}toggleParticle(t){var i;const a=(i=this.map)==null?void 0:i.getLayoutProperty(this.particleLayer,"visibility"),r=t?"visible":"none";a!==r&&this.map.setLayoutProperty(this.particleLayer,"visibility",r)}}class be{createShader(t,a,r){const i=t.createShader(a);if(i&&(t.shaderSource(i,r),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS)))throw new Error(t.getShaderInfoLog(i)||"error happened while create shader...");return i}createTexture(t,a,r,i,l,n,c){const s=t.createTexture();return t.bindTexture(t.TEXTURE_2D,s),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,a),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),l instanceof Uint8Array?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,n,c,0,t.RGBA,t.UNSIGNED_BYTE,l):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,l),t.bindTexture(t.TEXTURE_2D,null),s}createDataBuffer(t,a,r){if(t){const i=t.createBuffer();return a==="array"?(t.bindBuffer(t.ARRAY_BUFFER,i),r&&t.bufferData(t.ARRAY_BUFFER,r,t.STATIC_DRAW)):a==="element"&&(t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,i),r&&t.bufferData(t.ELEMENT_ARRAY_BUFFER,r,t.STATIC_DRAW)),i}return null}createProgram(t,a,r){const i=t.createProgram(),l=this.createShader(t,t.VERTEX_SHADER,a),n=this.createShader(t,t.FRAGMENT_SHADER,r);if(i&&l&&n&&(t.attachShader(i,l),t.attachShader(i,n),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS)))throw new Error(t.getProgramInfoLog(i)||"error happened while creating ramp color program");return i}createProgramWrapper(t,a,r){const i=this.createProgram(t,a,r);if(i){const l={program:i},n=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){const p=t.getActiveAttrib(i,s);l[p.name]=t.getAttribLocation(i,p.name)}const c=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let s=0;s<c;s++){const p=t.getActiveUniform(i,s);l[p.name]=t.getUniformLocation(i,p.name)}return l}}setup(t,a,r=!1,i,l){const n=document.createElement("canvas");n.width=256,n.height=1;const c=n.getContext("2d");if(c&&t){const s=c==null?void 0:c.createLinearGradient(0,0,256,0);return a.forEach(([p,h])=>{s.addColorStop(p,h)}),c.fillStyle=s,c.fillRect(0,0,256,1),{canvas:n,texture:this.createTexture(t,t.LINEAR,t.LINEAR,t.CLAMP_TO_EDGE,r?new Uint8Array(c.getImageData(0,0,256,1).data):n,i,l)}}}setupParticle(t,a=1e3){const r=Math.ceil(Math.sqrt(a)),i=r*r,l=new Uint8Array(i*4);for(let h=0;h<l.length;h++)l[h]=Math.floor(Math.random()*256);const n=this.createTexture(t,t.NEAREST,t.NEAREST,t.CLAMP_TO_EDGE,l,r,r),c=this.createTexture(t,t.NEAREST,t.NEAREST,t.CLAMP_TO_EDGE,l,r,r),s=new Float32Array(i);for(let h=0;h<i;h++)s[h]=h;const p=this.createDataBuffer(t,"array",s);return{resolution:r,total:i,texture0:n,texture1:c,indexBuffer:p}}bind(t,a,r){const i=this.createProgram(t,a,r);if(i){const l=this.createDataBuffer(t,"array",void 0),n=t.getAttribLocation(i,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0);const c=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]);this.createDataBuffer(t,"array",c);const s=t.getAttribLocation(i,"a_texCoord");return t.enableVertexAttribArray(s),t.vertexAttribPointer(s,2,t.FLOAT,!1,0,0),{program:i,aPositionBuffer:l}}return{}}bindParticle(t,a,r,i,l,n){const c=this.createProgramWrapper(t,a,r),s=this.createProgramWrapper(t,i,l),p=this.createProgramWrapper(t,i,n),h=this.createDataBuffer(t,"array",new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1])),d=t.createFramebuffer();return{particle:c,screen:s,update:p,quadBuffer:h,frameBuffer:d}}draw(t,a,r,i,l,n,c){var s,p;if(a&&r){t.resize(),a==null||a.viewport(0,0,(s=a==null?void 0:a.canvas)==null?void 0:s.width,(p=a==null?void 0:a.canvas)==null?void 0:p.height),a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT);try{a.useProgram(r);const h={resolution:a.getUniformLocation(r,"u_resolution"),image:a.getUniformLocation(r,"u_image"),color:a.getUniformLocation(r,"u_color"),scale:a.getUniformLocation(r,"u_scale"),uvRange:a.getUniformLocation(r,"u_range_u_v"),sRange:a.getUniformLocation(r,"u_range_s")};h.resolution&&a.uniform2f(h.resolution,a.canvas.width*t.ratio,a.canvas.height*t.ratio),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,i),h.image&&a.uniform1i(h.image,0),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,l),h.color&&a.uniform1i(h.color,1),c!=null&&c.uvRange&&(c!=null&&c.sRange)&&(h.uvRange&&a.uniform2f(h.uvRange,c.uvRange[0],c.uvRange[1]),h.sRange&&a.uniform2f(h.sRange,c.sRange[0],c.sRange[1])),h.scale&&a.uniform1f(h.scale,(c==null?void 0:c.scale)||1);const d=t.getBoundPixel(),g=t.map.getZoom()+1,b=t.getWorldCopy(d,g);for(const f of b){const v=(f[0]-d[0])*t.ratio,k=(f[1]-d[3])*t.ratio,T=f[2]*t.ratio,[z,x,y,w]=[v,T+v,k,T+k],_=new Float32Array([z,y,x,y,z,w,z,w,x,y,x,w]);a.bindBuffer(a.ARRAY_BUFFER,n),a.bufferData(a.ARRAY_BUFFER,_,a.STATIC_DRAW),a.drawArrays(a.TRIANGLES,0,6)}}catch(h){console.log(`render failed...${h}`)}}}drawParticle(t,a,r,i,l){var n,c;a&&(a==null||a.viewport(0,0,(n=a==null?void 0:a.canvas)==null?void 0:n.width,(c=a==null?void 0:a.canvas)==null?void 0:c.height),a.disable(a.DEPTH_TEST),a.disable(a.STENCIL_TEST),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,r),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,i.texture0),this.renderScreen(t,a,i,l),this.updateParticles(t,a,i,l))}renderScreen(t,a,r,i){a.bindFramebuffer(a.FRAMEBUFFER,r.frameBuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r.screenTexture,0),a.viewport(0,0,a.canvas.width,a.canvas.height),this.renderScreenTexture(a,r.backgroundTexture,r.screen,r.quadBuffer,.95),this.renderParticles(t,a,r,i),a.bindFramebuffer(a.FRAMEBUFFER,null),this.renderScreenTexture(a,r.screenTexture,r.screen,r.quadBuffer,1);const l=r.backgroundTexture;r.backgroundTexture=r.screenTexture,r.screenTexture=l}renderScreenTexture(t,a,r,i,l){t&&(t.useProgram(r.program),t.bindBuffer(t.ARRAY_BUFFER,i),t.enableVertexAttribArray(r.a_pos),t.vertexAttribPointer(r.a_pos,2,t.FLOAT,!1,0,0),t.activeTexture(t.TEXTURE2),t.bindTexture(t.TEXTURE_2D,a),t.uniform1i(r.u_screen,2),t.uniform1f(r.u_opacity,l),t.drawArrays(t.TRIANGLES,0,6))}renderParticles(t,a,r,i){if(a){a.useProgram(r.particle.program),a.bindBuffer(a.ARRAY_BUFFER,r.indexBuffer),a.enableVertexAttribArray(r.particle.a_index),a.vertexAttribPointer(r.particle.a_index,1,a.FLOAT,!1,0,0),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,r.color.texture),a.uniform1i(r.particle.u_factor,0),a.uniform1i(r.particle.u_particles,1),a.uniform1i(r.particle.u_color_ramp,2),a.uniform1f(r.particle.u_particles_resolution,r.resolution*t.ratio),a.uniform1f(r.particle.u_point,t.ratio);const l=t.getBoundRange();a.uniform4f(r.particle.u_viewport,l[0],l[1],l[2],l[3]),a.uniform2f(r.particle.u_factor_min,i.uvRange[0],i.uvRange[0]),a.uniform2f(r.particle.u_factor_max,i.uvRange[1],i.uvRange[1]),a.drawArrays(a.POINTS,0,r.total)}}updateParticles(t,a,r,i){var n,c;if(a){a.bindFramebuffer(a.FRAMEBUFFER,r.frameBuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r.texture1,0),a.viewport(0,0,r.resolution,r.resolution),a.useProgram(r.update.program),a.bindBuffer(a.ARRAY_BUFFER,r.quadBuffer),a.enableVertexAttribArray(r.update.a_pos),a.vertexAttribPointer(r.update.a_pos,2,a.FLOAT,!1,0,0),a.uniform1i(r.update.u_factor,0),a.uniform1i(r.update.u_particles,1);const s=t.getBoundRange();a.uniform4f(r.update.u_viewport,s[0],s[1],s[2],s[3]),a.uniform1f(r.update.u_rand_seed,Math.random()),a.uniform2f(r.update.u_factor_res,(n=r==null?void 0:r.image)==null?void 0:n.width,(c=r==null?void 0:r.image)==null?void 0:c.height),a.uniform2f(r.update.u_factor_min,i.uvRange[0],i.uvRange[0]),a.uniform2f(r.update.u_factor_max,i.uvRange[1],i.uvRange[1]),a.uniform1f(r.update.u_speed_factor,i.speedFactor*t.ratio),a.uniform1f(r.update.u_drop_rate,i.dropRate),a.uniform1f(r.update.u_drop_rate_bump,i.dropRateBump),a.drawArrays(a.TRIANGLES,0,6)}const l=r.texture0;r.texture0=r.texture1,r.texture1=l}resize(t,a){t.resize();const r=new Uint8Array(a.canvas.width*a.canvas.height*4).fill(0,0,a.canvas.width*a.canvas.height*4),i=this.createTexture(a,a.NEAREST,a.NEAREST,a.CLAMP_TO_EDGE,r,a.canvas.width,a.canvas.height),l=this.createTexture(a,a.NEAREST,a.NEAREST,a.CLAMP_TO_EDGE,r,a.canvas.width,a.canvas.height);return{screenTexture:i,backgroundTexture:l}}async loadImg(t){return new Promise(a=>{const r=new Blob([t],{type:t.type}),i=URL.createObjectURL(r),l=new Image;l.crossOrigin="anonymous",l.src=i,l.onload=()=>a(l)})}}class K{}Q(K,"vertexSchema",`
2
2
  //canvas 坐标系上的坐标 (x, y)
3
3
  attribute vec2 a_position; //像素坐标
4
4
  attribute vec2 a_texCoord; //纹理坐标
@@ -54,6 +54,10 @@ declare namespace _sfc_main {
54
54
  const type_10: StringConstructor;
55
55
  export { type_10 as type };
56
56
  }
57
+ namespace realTime {
58
+ const type_11: StringConstructor;
59
+ export { type_11 as type };
60
+ }
57
61
  }
58
62
  const emits: string[];
59
63
  function data(): {
@@ -100,7 +104,7 @@ declare namespace _sfc_main {
100
104
  immediate: boolean;
101
105
  };
102
106
  checkList: {
103
- handler(): void;
107
+ handler(newV: any, oldV: any): void;
104
108
  };
105
109
  followList: {
106
110
  handler(): void;
@@ -115,6 +119,6 @@ declare namespace _sfc_main {
115
119
  all: boolean;
116
120
  dayNight: boolean;
117
121
  }): Promise<void>;
118
- function handleLayersChange(): void;
122
+ function handleLayersChange(layers: any): void;
119
123
  }
120
124
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@idmwx/idmui-gl4",
3
3
  "private": false,
4
- "version": "0.7.2",
4
+ "version": "0.7.3",
5
5
  "description": "idm webgl4",
6
6
  "type": "module",
7
7
  "keywords": [
@@ -49,7 +49,7 @@
49
49
  "@idm-plugin/geo": "^1.8.6",
50
50
  "@idm-plugin/meteo": "^0.5.2",
51
51
  "@idm-plugin/tag": "^0.2.6",
52
- "@idm-plugin/tag-nop": "^0.1.2",
52
+ "@idm-plugin/tag-nop": "^0.1.3",
53
53
  "@mdi/font": "^7.4.47",
54
54
  "@turf/turf": "^6.5.0",
55
55
  "@types/mapbox-gl": "^3.1.0",