@idmwx/idmui-gl4 3.5.5 → 3.5.6

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.
@@ -1,4 +1,4 @@
1
- import { l as b } from "./index-072c6099.js";
1
+ import { l as b } from "./index-09c24825.js";
2
2
  function M(e) {
3
3
  return typeof e == "string" && /^data:image\/svg\+xml/i.test(e);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { W as a } from "./chunk-3VYIPD3A-169b1505.js";
1
+ import { W as a } from "./chunk-3VYIPD3A-cf03439d.js";
2
2
  async function o(r, t) {
3
3
  let i = await a(r, t), e = new Image();
4
4
  return e.src = i.toDataURL(`image/${t.format}`, t.quality), await e.decode(), e.style.width = `${i.width / t.dpr}px`, e.style.height = `${i.height / t.dpr}px`, e;
@@ -1,4 +1,4 @@
1
- import { W as m } from "./chunk-3VYIPD3A-169b1505.js";
1
+ import { W as m } from "./chunk-3VYIPD3A-cf03439d.js";
2
2
  async function a(n, e) {
3
3
  let o = e.type;
4
4
  if (o === "svg") {
@@ -1,6 +1,6 @@
1
- import { m as d } from "./chunk-T4JIPPZO-8d452d84.js";
2
- import { W as f } from "./chunk-3VYIPD3A-169b1505.js";
3
- import "./index-072c6099.js";
1
+ import { m as d } from "./chunk-T4JIPPZO-5a4c177d.js";
2
+ import { W as f } from "./chunk-3VYIPD3A-cf03439d.js";
3
+ import "./index-09c24825.js";
4
4
  import "axios";
5
5
  import "vuetify";
6
6
  import "vue";
@@ -10202,8 +10202,6 @@ const Dh = {
10202
10202
  },
10203
10203
  async fetchData() {
10204
10204
  var o;
10205
- if (isNaN(this.form.latDegree) || isNaN(this.form.latMinute) || isNaN(this.form.lngDegree) || isNaN(this.form.lngMinute))
10206
- return !1;
10207
10205
  this.form.lat = (Number(this.form.latDegree ?? 0) + Number(this.form.latMinute ?? 0) / 60) * (this.form.latDirection === "N" ? 1 : -1), this.form.lng = (Number(this.form.lngDegree ?? 0) + Number(this.form.lngMinute ?? 0) / 60) * (this.form.lngDirection === "E" ? 1 : -1);
10208
10206
  const t = S();
10209
10207
  ((o = S(this.realTime)) == null ? void 0 : o.diff(t, "d", !0)) >= 0 ? await this.fetchForecastData(this.form) : await this.fetchHistoryData(this.form);
@@ -17103,52 +17101,52 @@ Se.capture = async (t, e, o) => {
17103
17101
  if (o !== Pl)
17104
17102
  throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");
17105
17103
  let i = await Ml(t, e), a = { img: async (u, h) => {
17106
- let { toImg: f } = await import("./toImg-7b1d4fe2.js");
17104
+ let { toImg: f } = await import("./toImg-8b5a242b.js");
17107
17105
  return f(i, { ...u, ...h || {} });
17108
17106
  }, svg: async (u, h) => {
17109
- let { toSvg: f } = await import("./toImg-7b1d4fe2.js");
17107
+ let { toSvg: f } = await import("./toImg-8b5a242b.js");
17110
17108
  return f(i, { ...u, ...h || {} });
17111
17109
  }, canvas: async (u, h) => {
17112
- let { toCanvas: f } = await import("./toCanvas-5c78f5b9.js");
17110
+ let { toCanvas: f } = await import("./toCanvas-3499e459.js");
17113
17111
  return f(i, { ...u, ...h || {} });
17114
17112
  }, blob: async (u, h) => {
17115
- let { toBlob: f } = await import("./toBlob-ee45412b.js");
17113
+ let { toBlob: f } = await import("./toBlob-e6884cbe.js");
17116
17114
  return f(i, { ...u, ...h || {} });
17117
17115
  }, png: async (u, h) => {
17118
- let { rasterize: f } = await import("./rasterize-JS5G2XHH-65db591b.js");
17116
+ let { rasterize: f } = await import("./rasterize-JS5G2XHH-0d20ff11.js");
17119
17117
  return f(i, { ...u, ...h || {}, format: "png" });
17120
17118
  }, jpeg: async (u, h) => {
17121
- let { rasterize: f } = await import("./rasterize-JS5G2XHH-65db591b.js");
17119
+ let { rasterize: f } = await import("./rasterize-JS5G2XHH-0d20ff11.js");
17122
17120
  return f(i, { ...u, ...h || {}, format: "jpeg" });
17123
17121
  }, webp: async (u, h) => {
17124
- let { rasterize: f } = await import("./rasterize-JS5G2XHH-65db591b.js");
17122
+ let { rasterize: f } = await import("./rasterize-JS5G2XHH-0d20ff11.js");
17125
17123
  return f(i, { ...u, ...h || {}, format: "webp" });
17126
17124
  }, download: async (u, h) => {
17127
- let { download: f } = await import("./download-b6376108.js");
17125
+ let { download: f } = await import("./download-c234aa09.js");
17128
17126
  return f(i, { ...u, ...h || {} });
17129
17127
  } }, l = { ...e, export: { url: i }, exports: { svg: async (u) => {
17130
- let { toSvg: h } = await import("./toImg-7b1d4fe2.js");
17128
+ let { toSvg: h } = await import("./toImg-8b5a242b.js");
17131
17129
  return h(i, { ...e, ...u || {}, [mo]: !0 });
17132
17130
  }, canvas: async (u) => {
17133
- let { toCanvas: h } = await import("./toCanvas-5c78f5b9.js");
17131
+ let { toCanvas: h } = await import("./toCanvas-3499e459.js");
17134
17132
  return h(i, { ...e, ...u || {}, [mo]: !0 });
17135
17133
  }, png: async (u) => {
17136
- let { rasterize: h } = await import("./rasterize-JS5G2XHH-65db591b.js");
17134
+ let { rasterize: h } = await import("./rasterize-JS5G2XHH-0d20ff11.js");
17137
17135
  return h(i, { ...e, ...u || {}, format: "png", [mo]: !0 });
17138
17136
  }, jpeg: async (u) => {
17139
- let { rasterize: h } = await import("./rasterize-JS5G2XHH-65db591b.js");
17137
+ let { rasterize: h } = await import("./rasterize-JS5G2XHH-0d20ff11.js");
17140
17138
  return h(i, { ...e, ...u || {}, format: "jpeg", [mo]: !0 });
17141
17139
  }, jpg: async (u) => {
17142
- let { rasterize: h } = await import("./rasterize-JS5G2XHH-65db591b.js");
17140
+ let { rasterize: h } = await import("./rasterize-JS5G2XHH-0d20ff11.js");
17143
17141
  return h(i, { ...e, ...u || {}, format: "jpeg", [mo]: !0 });
17144
17142
  }, webp: async (u) => {
17145
- let { rasterize: h } = await import("./rasterize-JS5G2XHH-65db591b.js");
17143
+ let { rasterize: h } = await import("./rasterize-JS5G2XHH-0d20ff11.js");
17146
17144
  return h(i, { ...e, ...u || {}, format: "webp", [mo]: !0 });
17147
17145
  }, blob: async (u) => {
17148
- let { toBlob: h } = await import("./toBlob-ee45412b.js");
17146
+ let { toBlob: h } = await import("./toBlob-e6884cbe.js");
17149
17147
  return h(i, { ...e, ...u || {}, [mo]: !0 });
17150
17148
  }, img: async (u) => {
17151
- let { toImg: h } = await import("./toImg-7b1d4fe2.js");
17149
+ let { toImg: h } = await import("./toImg-8b5a242b.js");
17152
17150
  return h(i, { ...e, ...u || {}, [mo]: !0 });
17153
17151
  } } }, r = await b0("defineExports", l), c = Object.assign({}, ...r.filter((u) => u && typeof u == "object")), s = { ...a, ...c };
17154
17152
  s.jpeg && !s.jpg && (s.jpg = (u, h) => s.jpeg(u, h));
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { B as x, c as D, D as T, L as g, a as S, b as W, M as f, f as h, e as k, P as y, T as B, V, W as d, d as u } from "./index-072c6099.js";
1
+ import { B as x, c as D, D as T, L as g, a as S, b as W, M as f, f as h, e as k, P as y, T as B, V, W as d, d as u } from "./index-09c24825.js";
2
2
  import "axios";
3
3
  import "vuetify";
4
4
  import "vue";
@@ -214,7 +214,7 @@
214
214
  <path
215
215
  d="M420.66666667 959.17a16.08 16.08 0 0 1-15.91-13.49A15.89 15.89 0 0 1 415.50666667 928c1.49-0.55 38.88-14.76 72.79-65.52A354.55 354.55 0 0 1 162.66666667 509.17a450.14 450.14 0 0 1 450.5-450.5 16.07 16.07 0 0 1 15.91 13.48 15.88 15.88 0 0 1-10.75 17.66c-1.58 0.58-39.13 14.9-73.07 65.95A354.22 354.22 0 0 1 871.66666667 509.17a16 16 0 0 1-0.52 4.05A450.14 450.14 0 0 1 420.66666667 959.17zM554.80666667 94.72C351.57666667 123.2 194.66666667 298.21 194.66666667 509.17c0 177.08 144.06 321.74 321.13 322.48a16 16 0 0 1 14.07 23.49c-16.11 30.42-34.27 52.37-50.85 68C682.25666667 894.63 839.16666667 719.63 839.16666667 508.67a15.94 15.94 0 0 1 0.47-3.86C837.30666667 329.33 693.82666667 187 517.80666667 186.67A16 16 0 0 1 503.66666667 163.21c16.21-30.69 34.47-52.79 51.14-68.49z"
216
216
  fill="#ffffff" p-id="18386"></path>
217
- </svg>`,ge=document.createElement("div");ge.className="idm-tropical-gl4-hourly-marker",ge.innerHTML=`<div class="${E.geometry.coordinates[1]>=0?"center north":"center south"}">${ie}</div>`;const ue=new me.Marker(ge).setLngLat(E.geometry.coordinates).addTo(this.map);this.interpolateMarkers.push(ue)}this.$emit("tropicalCenterPoints",J)}else(S=this.map)!=null&&S.getSource(this.interpolateSource)&&((W=this.map)==null||W.getSource(this.interpolateSource).setData(this.empty))},handleClick(o){var i,l,n,c,s,m,d,g,u,y,p;const e=o.features[0],a=(l=(i=this.tropicals)==null?void 0:i.data)==null?void 0:l.features.filter(h=>{var f;return h.geometry.type==="LineString"&&h.properties.type==="forecast"&&h.properties.name===((f=e==null?void 0:e.properties)==null?void 0:f.name)}),r=(c=(n=this.tropicals)==null?void 0:n.data)==null?void 0:c.features.filter(h=>{var f;return h.geometry.type==="LineString"&&h.properties.type==="history"&&h.properties.name===((f=e==null?void 0:e.properties)==null?void 0:f.name)});this.activeTropicals={name:((s=e==null?void 0:e.properties)==null?void 0:s.name)||"-",nameCn:((m=e==null?void 0:e.properties)==null?void 0:m.nameCn)||((d=e==null?void 0:e.properties)==null?void 0:d.name)||"-",Name:((g=e==null?void 0:e.properties)==null?void 0:g.Name)||"-",forecasts:a.map(h=>h.properties),history:(u=r[0])==null?void 0:u.properties,showCircle:(p=(y=a[0])==null?void 0:y.properties)==null?void 0:p.showCircle},this.showTropicalsInfo=!0,this.simple||this.drawTropicalsInfoMaker([o.lngLat.lng,o.lngLat.lat])},drawTropicalsInfoMaker(o){this.$nextTick(()=>{const e=document.getElementById("idm-tropical-gl4-info");this.activeTropicalsMarker?this.activeTropicalsMarker.setLngLat(o).setOffset([220,0]):this.activeTropicalsMarker=new me.Marker(e).setLngLat(o).setOffset([220,0]).addTo(this.map)})},handleCloseInfoMarker(){this.showTropicalsInfo=!1,this.$nextTick(()=>{var o;(o=this.activeTropicalsMarker)==null||o.remove(),this.activeTropicalsMarker=void 0})},handleForecastToggle(o){var r,i,l,n,c,s;o.disabled=!o.disabled;const e=`${o.name}-${o.model}`,a=(i=(r=this.map)==null?void 0:r.getSource(this.source)._data)==null?void 0:i.features;a.forEach(m=>{m.properties.category===e&&(m.properties.disabled=o.disabled)}),this.interpolateData.forEach(m=>{m.properties.category===e&&(m.properties.disabled=o.disabled)}),(n=(l=this.map)==null?void 0:l.getSource(this.source))==null||n.setData(T.featureCollection(a)),(s=(c=this.map)==null?void 0:c.getSource(this.clusterSource))==null||s.setData(T.featureCollection(a)),this.handleDateChange()},handleStrikeProbability(o){this.$emit("tropicalProbability",o)},handleToggleCircles(o){var e,a;o.showCircle=!o.showCircle,(a=(e=this.tropicals.data)==null?void 0:e.features)==null||a.forEach(r=>{r.properties.name===o.name&&(r.properties.showCircle=o.showCircle)}),this.handleRender()},handleComputePolygons(o){const e=[];for(const a of o){const r=a.properties.wind,i={ne:r.r7ne>=0?r.r7ne:void 0,se:r.r7se>=0?r.r7se:void 0,sw:r.r7sw>=0?r.r7sw:void 0,nw:r.r7nw>=0?r.r7nw:void 0},l=this.handleComputeArc(a.geometry.coordinates,i,{...a.properties,level:7});e.push(l);const n={ne:r.r10ne>=0?r.r10ne:void 0,se:r.r10se>=0?r.r10se:void 0,sw:r.r10sw>=0?r.r10sw:void 0,nw:r.r10nw>=0?r.r10nw:void 0},c=this.handleComputeArc(a.geometry.coordinates,n,{...a.properties,level:10});e.push(c)}return e},handleComputeArc(o,e,a){var l;const r=[];for(const n in e){const c=e[n]??0;let s;switch(n){case"ne":s=T.lineArc(o,c,0,90,{steps:c>0?32:1,units:"nauticalmiles"});break;case"se":s=T.lineArc(o,c,90,180,{steps:c>0?32:1,units:"nauticalmiles"});break;case"sw":s=T.lineArc(o,c,180,270,{steps:c>0?32:1,units:"nauticalmiles"});break;case"nw":s=T.lineArc(o,c,270,360,{steps:c>0?32:1,units:"nauticalmiles"});break}r.push(...(l=s==null?void 0:s.geometry)==null?void 0:l.coordinates)}const i=T.lineString(r);return T.lineToPolygon(i,{properties:a})},handleNotification(o){this.$emit("tropicalNotification",o)},handleHover(o){var i,l,n,c,s;this.map.getCanvas().style.cursor="pointer";const a=this.map.queryRenderedFeatures(o.point,{layers:[this.pointCircleLayer,this.pointCircleLayer+"-border",this.historyPointCircleLayer,this.historyPointCircleLayer+"-border",this.historyPointCircleLayer+"-inner"]})[0];this.hoverPoint=a==null?void 0:a.properties;const r=(l=(i=this.tropicals)==null?void 0:i.data)==null?void 0:l.features.filter(m=>{var d;return m.geometry.type==="LineString"&&m.properties.type==="forecast"&&m.properties.name===((d=a==null?void 0:a.properties)==null?void 0:d.name)});this.hoverPoint&&(this.hoverPoint.lng=a.geometry.coordinates[0],this.hoverPoint.lat=a.geometry.coordinates[1],this.hoverPoint.update=(c=(n=r==null?void 0:r[0])==null?void 0:n.properties)==null?void 0:c.date,(s=this.hoverMarker)==null||s.remove(),this.showHoverPoint=!0,this.$nextTick(()=>{const m=document.getElementById("tropicalHoverMarkerInfo").cloneNode(!0);this.hoverMarker=new me.Marker(m).setLngLat(a.geometry.coordinates).setOffset([160,0]).addTo(this.map)}))},handleLeave(){var o;this.map.getCanvas().style.cursor="grab",this.showHoverPoint=!1,(o=this.hoverMarker)==null||o.remove(),this.hoverMarker=void 0}}},Fm={class:"idm-tropical-gl4"},Gm={class:"pb-1"},jm={class:"text-h5 font-weight-600"},Wm={key:0,class:"text-h5 font-weight-600"},Zm={class:"text-body-1"},Xm={class:"text-label"},Hm={class:"d-flex justify-space-between align-center"},Om={class:"w-60"},Ym={class:"text-label pr-1"},Um={class:"flex-1-1-0"},Jm={class:"text-label pr-1"},Km={class:"py-2 d-flex justify-space-between align-center"},Qm={class:"w-60"},qm={class:"text-label pr-1"},$m={class:"flex-1-1-0"},ed={class:"text-label pr-1"},td={class:"d-flex align-center flex-1-1-100 justify-start mt-n1"},od={class:"text-label pr-1",style:{width:"70px"}},ad={class:"model-box d-flex justify-end align-center flex-wrap ga-1 pa-1"},id={class:"more"},rd={key:0,class:"w-100 d-flex justify-space-between align-center px-2"},ld={class:"pa-1"},nd={class:"legend d-flex justify-start align-center py-2"},sd={class:"label"},cd={class:"legend d-flex justify-start align-center py-2"},md={class:"label"},dd={class:"legend d-flex justify-start align-center py-2"},hd={class:"label"},pd={class:"pa-1"},gd={class:"legend d-flex justify-start align-center py-2"},ud={class:"label"},fd={class:"legend d-flex justify-start align-center py-2"},yd={class:"label"},bd={class:"legend d-flex justify-start align-center py-2"},wd={class:"label"},xd={class:"pa-1"},kd={class:"w-100 legend d-flex justify-start align-center py-2 ga-2"},Ad={class:"label"},Ld={class:"label"},Cd={class:"w-100 legend d-flex justify-start align-center py-2"},vd={class:"label"},zd={class:"w-100 legend d-flex justify-start align-center py-2"},_d={class:"label"},Sd={key:1,class:"my-3 w-100",style:{height:"80px"}},Nd={class:"legend d-flex justify-start align-center"},Md={class:"label"},Pd={class:"legend d-flex justify-start align-center"},Vd={class:"label"},Td={class:"legend d-flex justify-start align-center"},Ed={class:"label"},Dd={class:"legend d-flex justify-start align-center"},Rd={class:"label"},Bd={class:"legend d-flex justify-start align-center"},Id={class:"label"},Fd={class:"legend d-flex justify-start align-center"},Gd={class:"label"},jd={class:"legend d-flex justify-start align-center"},Wd={class:"label"},Zd={class:"legend d-flex justify-start align-center"},Xd={class:"label"},Hd={class:"legend d-flex justify-start align-center"},Od={class:"label"},Yd={class:"legend d-flex justify-start align-center"},Ud={class:"label"},Jd={class:"d-flex justify-star align-center"},Kd={class:"font-weight-600 mr-1"},Qd={class:""},qd={class:"d-flex flex-column justify-center align-start ga-2"},$d={key:0,class:"d-flex justify-start align-center"},eh={class:"text-label pr-1"},th={key:1,class:"d-flex justify-start align-center"},oh={class:"text-label pr-1"},ah={key:2,class:"d-flex justify-start align-center"},ih={class:"text-label pr-1"},rh={key:3,class:"d-flex justify-start align-center"},lh={class:"text-label pr-1"},nh={key:4,class:"d-flex justify-start align-center"},sh={class:"text-label pr-1"},ch={key:5,class:"d-flex justify-start align-center"},mh={class:"text-label pr-1"},dh={class:"d-flex justify-start align-center"},hh={class:"text-label pr-1"},ph={key:6,class:"d-flex justify-start align-center"},gh={class:"text-label pr-1"},uh={key:7,class:"d-flex justify-start align-center"},fh={class:"text-label pr-1"},yh={class:"d-flex justify-start align-center"},bh={class:"text-label pr-1"};function wh(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardText"),m=t.resolveComponent("VDivider"),d=t.resolveComponent("VCardActions"),g=t.resolveComponent("VCard"),u=t.resolveComponent("VCardTitle");return t.openBlock(),t.createElementBlock("div",Fm,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+86+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("tropical.tropicals"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:y})=>[t.createVNode(n,t.mergeProps(y,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[2]||(e[2]=[t.createElementVNode("i",{class:"iconfont icon-Tropical text-h4"},null,-1)])),_:2,__:[2]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),i.showTropicalsInfo&&!o.$attrs.hideTropicalsLegend?(t.openBlock(),t.createElementBlock("div",{key:0,id:"idm-tropical-gl4-info",ref:"tropicalsInfo",class:t.normalizeClass(["idm-tropical-gl4-info",a.simple?"page":"dialog"])},[t.createVNode(g,{class:t.normalizeClass(["w-100",a.simple?"rounded-t-4 bg-none":""]),elevation:a.simple?0:16},{default:t.withCtx(()=>[t.createVNode(s,null,{default:t.withCtx(()=>{var y,p,h,f,w,b,A,x,C,k,_,z;return[t.createElementVNode("div",Gm,[t.createElementVNode("span",jm,t.toDisplayString(a.locale==="en"?(y=i.activeTropicals)==null?void 0:y.Name:((p=i.activeTropicals)==null?void 0:p.nameCn)||((h=i.activeTropicals)==null?void 0:h.Name)||"-"),1),(w=(f=i.activeTropicals)==null?void 0:f.history)!=null&&w.levelI18n?(t.openBlock(),t.createElementBlock("span",Wm," , "+t.toDisplayString(o.$t("tropical."+((A=(b=i.activeTropicals)==null?void 0:b.history)==null?void 0:A.levelI18n))),1)):t.createCommentVNode("",!0)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"close",onClick:t.withModifiers(l.handleCloseInfoMarker,["stop"])},{default:t.withCtx(()=>e[3]||(e[3]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[3]},8,["onClick"]),t.createElementVNode("div",Zm,[t.createElementVNode("span",Xm,t.toDisplayString(o.$t("actions.lastUpdate"))+": ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTime(((C=(x=i.activeTropicals)==null?void 0:x.history)==null?void 0:C.updated)||((z=(_=(k=i.activeTropicals)==null?void 0:k.forecasts)==null?void 0:_.filter(M=>!M.disabled)[0])==null?void 0:z.date),a.timeZone)),1)])]}),_:1}),t.createVNode(m),t.createVNode(s,{class:"text-body-1 py-3"},{default:t.withCtx(()=>{var y,p,h,f,w,b,A,x,C;return[t.createElementVNode("div",Hm,[t.createElementVNode("div",Om,[t.createElementVNode("label",Ym,t.toDisplayString(o.$t("weather.windSpeed"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((p=(y=i.activeTropicals)==null?void 0:y.history)==null?void 0:p.kts)||"-")+" kts",1),t.createElementVNode("span",null,", BF "+t.toDisplayString(l.computeBF(((f=(h=i.activeTropicals)==null?void 0:h.history)==null?void 0:f.kts)||"-")),1)]),t.createElementVNode("div",Um,[t.createElementVNode("label",Jm,t.toDisplayString(o.$t("weather.pressure"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((b=(w=i.activeTropicals)==null?void 0:w.history)==null?void 0:b.pressure)||"-")+" hPa",1)])]),t.createElementVNode("div",Km,[t.createElementVNode("div",Qm,[t.createElementVNode("label",qm,t.toDisplayString(o.$t("tropical.moveSpeed"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((A=l.computeMovement(i.activeTropicals))==null?void 0:A.kts)||"-")+" kts",1)]),t.createElementVNode("div",$m,[t.createElementVNode("label",ed,t.toDisplayString(o.$t("tropical.moveDir"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((x=l.computeMovement(i.activeTropicals))==null?void 0:x.deg)||"-")+"°",1)])]),t.createElementVNode("div",td,[t.createElementVNode("label",od,t.toDisplayString(o.$t("tropical.models"))+" : ",1),t.createElementVNode("div",ad,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList((C=i.activeTropicals)==null?void 0:C.forecasts,(k,_)=>(t.openBlock(),t.createBlock(n,{key:_,density:"compact",variant:k.disabled?"text":"flat",color:k.disabled?"":"primary","min-width":30,class:t.normalizeClass(["model text-none text-body-1 px-1",k.disabled?"btn-border-1 btn-bg-1":""]),onClick:t.withModifiers(z=>l.handleForecastToggle(k),["stop"])},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(k.model),1)]),_:2},1032,["variant","color","class","onClick"]))),128))])])]}),_:1}),t.createVNode(m),a.simple?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(d,{key:0,class:"d-flex justify-space-between"},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact","prepend-icon":"",variant:"text",color:i.showLegend?"primary":"",class:"text-none text-body-1",onClick:e[0]||(e[0]=t.withModifiers(y=>i.showLegend=!i.showLegend,["stop"]))},{prepend:t.withCtx(()=>e[4]||(e[4]=[t.createElementVNode("i",{class:"iconfont icon-Legend text-h4"},null,-1)])),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(o.$t("weather.legend")),1)]),_:1},8,["color"]),t.createElementVNode("div",id,[t.createVNode(n,{variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:e[1]||(e[1]=t.withModifiers(y=>l.handleStrikeProbability(i.activeTropicals),["stop"]))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.viewReport")),1)]),_:1})])]),_:1}))]),_:1},8,["class","elevation"]),a.simple?(t.openBlock(),t.createElementBlock("div",rd,[t.createElementVNode("div",ld,[t.createElementVNode("div",nd,[e[5]||(e[5]=t.createElementVNode("div",{class:"icon td"},null,-1)),t.createElementVNode("div",sd,t.toDisplayString(o.$t("tropical.td")),1)]),t.createElementVNode("div",cd,[e[6]||(e[6]=t.createElementVNode("div",{class:"icon sts"},null,-1)),t.createElementVNode("div",md,t.toDisplayString(o.$t("tropical.sts")),1)]),t.createElementVNode("div",dd,[e[7]||(e[7]=t.createElementVNode("div",{class:"icon sty"},null,-1)),t.createElementVNode("div",hd,t.toDisplayString(o.$t("tropical.sty")),1)])]),t.createElementVNode("div",pd,[t.createElementVNode("div",gd,[e[8]||(e[8]=t.createElementVNode("div",{class:"icon ts"},null,-1)),t.createElementVNode("div",ud,t.toDisplayString(o.$t("tropical.ts")),1)]),t.createElementVNode("div",fd,[e[9]||(e[9]=t.createElementVNode("div",{class:"icon ty"},null,-1)),t.createElementVNode("div",yd,t.toDisplayString(o.$t("tropical.ty")),1)]),t.createElementVNode("div",bd,[e[10]||(e[10]=t.createElementVNode("div",{class:"icon supper-ty"},null,-1)),t.createElementVNode("div",wd,t.toDisplayString(o.$t("tropical.superTy")),1)])]),t.createElementVNode("div",xd,[t.createElementVNode("div",kd,[e[11]||(e[11]=t.createElementVNode("div",{class:"icon history"},null,-1)),t.createElementVNode("div",Ad,t.toDisplayString(o.$t("tropical.history")),1),e[12]||(e[12]=t.createElementVNode("div",{class:"icon forecast"},null,-1)),t.createElementVNode("div",Ld,t.toDisplayString(o.$t("tropical.forecast")),1)]),t.createElementVNode("div",Cd,[e[13]||(e[13]=t.createElementVNode("div",{class:"icon r7"},null,-1)),t.createElementVNode("div",vd,"35kts "+t.toDisplayString(o.$t("tropical.radii")),1)]),t.createElementVNode("div",zd,[e[14]||(e[14]=t.createElementVNode("div",{class:"icon r10"},null,-1)),t.createElementVNode("div",_d,"50kts "+t.toDisplayString(o.$t("tropical.radii")),1)])])])):(t.openBlock(),t.createElementBlock("div",Sd,[t.withDirectives(t.createVNode(g,{elevation:"16"},{default:t.withCtx(()=>[t.createVNode(s,null,{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["pa-1 d-flex justify-space-between align-center flex-wrap",a.locale==="zhHans"?" ga-2":" ga-3"])},[t.createElementVNode("div",Nd,[e[15]||(e[15]=t.createElementVNode("div",{class:"icon td"},null,-1)),t.createElementVNode("div",Md,t.toDisplayString(o.$t("tropical.td")),1)]),t.createElementVNode("div",Pd,[e[16]||(e[16]=t.createElementVNode("div",{class:"icon ts"},null,-1)),t.createElementVNode("div",Vd,t.toDisplayString(o.$t("tropical.ts")),1)]),t.createElementVNode("div",Td,[e[17]||(e[17]=t.createElementVNode("div",{class:"icon sts"},null,-1)),t.createElementVNode("div",Ed,t.toDisplayString(o.$t("tropical.sts")),1)]),t.createElementVNode("div",Dd,[e[18]||(e[18]=t.createElementVNode("div",{class:"icon ty"},null,-1)),t.createElementVNode("div",Rd,t.toDisplayString(o.$t("tropical.ty")),1)]),t.createElementVNode("div",Bd,[e[19]||(e[19]=t.createElementVNode("div",{class:"icon sty"},null,-1)),t.createElementVNode("div",Id,t.toDisplayString(o.$t("tropical.sty")),1)]),t.createElementVNode("div",Fd,[e[20]||(e[20]=t.createElementVNode("div",{class:"icon supper-ty"},null,-1)),t.createElementVNode("div",Gd,t.toDisplayString(o.$t("tropical.superTy")),1)]),t.createElementVNode("div",jd,[e[21]||(e[21]=t.createElementVNode("div",{class:"icon history"},null,-1)),t.createElementVNode("div",Wd,t.toDisplayString(o.$t("tropical.history")),1)]),t.createElementVNode("div",Zd,[e[22]||(e[22]=t.createElementVNode("div",{class:"icon forecast"},null,-1)),t.createElementVNode("div",Xd,t.toDisplayString(o.$t("tropical.forecast")),1)]),t.createElementVNode("div",Hd,[e[23]||(e[23]=t.createElementVNode("div",{class:"icon r7"},null,-1)),t.createElementVNode("div",Od,"35kts "+t.toDisplayString(o.$t("tropical.radii")),1)]),t.createElementVNode("div",Yd,[e[24]||(e[24]=t.createElementVNode("div",{class:"icon r10"},null,-1)),t.createElementVNode("div",Ud,"50kts "+t.toDisplayString(o.$t("tropical.radii")),1)])],2),[[t.vShow,i.showLegend]])]),_:1})]),_:1},512),[[t.vShow,i.showLegend]])]))],2)):t.createCommentVNode("",!0),t.withDirectives(t.createVNode(g,{id:"tropicalHoverMarkerInfo",elevation:"16","max-width":"290"},{default:t.withCtx(()=>[t.createVNode(u,null,{default:t.withCtx(()=>{var y,p,h,f;return[t.createElementVNode("div",Jd,[t.createElementVNode("span",Kd,t.toDisplayString(a.locale==="en"?(y=i.hoverPoint)==null?void 0:y.Name:((p=i.hoverPoint)==null?void 0:p.nameCn)||((h=i.hoverPoint)==null?void 0:h.Name)),1),t.createElementVNode("span",Qd," ["+t.toDisplayString(o.$t("tropical."+((f=i.hoverPoint)==null?void 0:f.levelI18n)))+"]",1)])]}),_:1}),t.createVNode(m),t.createVNode(s,{class:"text-body-1"},{default:t.withCtx(()=>{var y,p,h,f,w,b,A,x,C,k,_,z,M,V,P,Y,U,K,de,ne;return[t.createElementVNode("div",qd,[((y=i.hoverPoint)==null?void 0:y.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",$d,[t.createElementVNode("label",eh,t.toDisplayString(o.$t("tropical.updated"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTzTime((p=i.hoverPoint)==null?void 0:p.update,a.timeZone)),1)])):t.createCommentVNode("",!0),((h=i.hoverPoint)==null?void 0:h.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",th,[t.createElementVNode("label",oh,t.toDisplayString(o.$t("tropical.forecast"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTzTime((f=i.hoverPoint)==null?void 0:f.date,a.timeZone)),1)])):t.createCommentVNode("",!0),((w=i.hoverPoint)==null?void 0:w.type)==="history"?(t.openBlock(),t.createElementBlock("div",ah,[t.createElementVNode("label",ih,t.toDisplayString(o.$t("tropical.forecast"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTzTime((b=i.hoverPoint)==null?void 0:b.date,a.timeZone)),1)])):t.createCommentVNode("",!0),((A=i.hoverPoint)==null?void 0:A.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",rh,[t.createElementVNode("label",lh,t.toDisplayString(o.$t("tropical.model"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((x=i.hoverPoint)==null?void 0:x.model)??"-"),1)])):t.createCommentVNode("",!0),((C=i.hoverPoint)==null?void 0:C.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",nh,[t.createElementVNode("label",sh,t.toDisplayString(o.$t("weather.wind"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((_=JSON.parse(((k=i.hoverPoint)==null?void 0:k.wind)||"{}"))==null?void 0:_.kts)??"-")+" kts",1)])):t.createCommentVNode("",!0),((z=i.hoverPoint)==null?void 0:z.type)==="history"?(t.openBlock(),t.createElementBlock("div",ch,[t.createElementVNode("label",mh,t.toDisplayString(o.$t("weather.wind"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((M=i.hoverPoint)==null?void 0:M.kts)??"-")+" kts",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",dh,[t.createElementVNode("label",hh,t.toDisplayString(o.$t("weather.pressure"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((V=i.hoverPoint)==null?void 0:V.pressure)??"-")+" hPa",1)]),((P=i.hoverPoint)==null?void 0:P.type)==="history"?(t.openBlock(),t.createElementBlock("div",ph,[t.createElementVNode("label",gh,t.toDisplayString(o.$t("tropical.moveSpeed"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((U=JSON.parse(((Y=i.hoverPoint)==null?void 0:Y.movement)||"{}"))==null?void 0:U.kts)??"-")+" kts",1)])):t.createCommentVNode("",!0),((K=i.hoverPoint)==null?void 0:K.type)==="history"?(t.openBlock(),t.createElementBlock("div",uh,[t.createElementVNode("label",fh,t.toDisplayString(o.$t("tropical.moveDir"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((ne=JSON.parse(((de=i.hoverPoint)==null?void 0:de.movement)||"{}"))==null?void 0:ne.deg)??"-")+" °",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",yh,[t.createElementVNode("label",bh,t.toDisplayString(o.$t("tropical.position"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computePosition(i.hoverPoint)),1)])])]}),_:1})]),_:1},512),[[t.vShow,i.showHoverPoint]])])}const Wo=Q(Im,[["render",wh]]),D1="",xh={name:"DateTimePicker",props:{width:{type:Number,default:null},height:{type:Number,default:30},position:{type:String,default:"top"},bgClass:{type:String,default:""},locale:{type:String,default:"en"},style:{type:Object,default:{}},intervalHour:{type:Number,default:3},timeZone:{type:Number},dateTime:{type:String},dayAbout:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1}},emits:["dateTime","currentTimestamp","currentRealTime","minTimestamp","maxTimestamp"],data(){return{showDatePicker:!1,minDate:void 0,maxDate:void 0,minTimestamp:void 0,maxTimestamp:void 0,currentDate:void 0,currentTime:void 0,currentTimestamp:void 0,currentDateTimeZ:void 0,currentDateTime:void 0,currentRealTime:void 0,timer:null}},computed:{getStyle(){const o=this.width||220;return this.position==="top"?{bottom:"40px",left:`-${(420-o)/2}px`}:this.position==="bottom"?{top:"40px",left:`-${(420-o)/2}px`}:this.position==="left"?{bottom:"-140px",left:"-428px"}:this.position==="right"?{bottom:"-140px",right:"-428px"}:{bottom:"40px",left:`-${(420-o)/2}px`}},hourOptions(){const o=[];for(let e=0;e<24;e++)o.push(e<10?`0${e}:00`:`${e}:00`);return o.filter((e,a)=>(a-this.timeZone)%this.intervalHour===0)},timeZoneNames(){return v.tz.names()},timeZoneName(){var o;return(o=this.timeZoneNames.filter(e=>v.tz(v(),e).utcOffset()===this.timeZone*60))==null?void 0:o[0]},utcTimeZoneName(){return"Africa/Abidjan"},localTimeZoneName(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"Asia/Shanghai"}},watch:{timeZone:{handler(o,e){o!==e&&(this.handleResetDateTime(this.dateTime),this.handleResetMinMax())}},dateTime:{handler(o,e){o&&this.handleResetDateTime(this.dateTime)},immediate:!0},currentTimestamp:{handler(){this.currentDateTimeZ=v(this.currentTimestamp).utc().format("yyyy-MM-DD HH:00[Z]"),this.$emit("dateTime",this.currentDateTimeZ),this.$emit("currentTimestamp",this.currentTimestamp),this.currentDateTime=`${v.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`},immediate:!0},currentRealTime:{handler(o,e){o!==e&&this.$emit("currentRealTime",this.currentRealTime)}}},mounted(){this.timer=setInterval(()=>{this.currentRealTime=`${v.tz(v().unix()*1e3,this.timeZoneName).clone().format("HH:mm")}`},100),document.addEventListener("click",this.handleClickOutside)},unmounted(){clearInterval(this.timer),this.handleCancelDate(),document.removeEventListener("click",this.handleClickOutside)},methods:{handleReset(){this.handleResetDateTime(),this.handleResetMinMax()},handleResetDateTime(o){var i;const e=v(o).utc().date(),a=Math.ceil(v(o).utc().hour()/this.intervalHour)*this.intervalHour;this.currentTimestamp=((i=v(o))==null?void 0:i.utc().set({date:e,hour:a,minute:0,second:0,millisecond:0}).unix())*1e3;const r=v.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=r.clone().format("YYYY-MM-DD"),this.currentTime=r.clone().format("HH:00"),this.currentDateTime=`${v.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`,this.currentRealTime=`${v.tz(v().unix()*1e3,this.timeZoneName).clone().format("HH:mm")}`},handleResetMinMax(){var i,l,n,c,s;if(this.dayAbout.h==null||this.dayAbout.f==null)return;const o=v().utc().date(),e=Math.ceil(v().utc().hour()/this.intervalHour)*this.intervalHour,a=((i=v())==null?void 0:i.utc().set({date:o,hour:e,minute:0,second:0,millisecond:0}).unix())*1e3,r=v.tz(a,this.timeZoneName).clone();this.minDate=r.clone().add(this.dayAbout.h,"day").format("yyyy-MM-DD"),this.maxDate=r.clone().add(this.dayAbout.f,"day").format("yyyy-MM-DD"),this.minTimestamp=((n=(l=v())==null?void 0:l.utc())==null?void 0:n.set({date:o+this.dayAbout.h,hour:0,minute:0,second:0,millisecond:0}).unix())*1e3,this.maxTimestamp=((s=(c=v())==null?void 0:c.utc())==null?void 0:s.set({date:o+this.dayAbout.f,hour:0,minute:0,second:0,millisecond:0}).unix())*1e3,this.$emit("minTimestamp",this.minTimestamp),this.$emit("maxTimestamp",this.maxTimestamp)},handleOpenDatePicker(){this.disabled||(this.showDatePicker=!this.showDatePicker)},handleUpdateMonth(o){const e=o||v.tz(this.currentTimestamp,this.timeZoneName).clone().month(),a=this.locale==="en"?v.tz(this.currentTimestamp,this.timeZoneName).set({month:e}).clone().format("MMM"):v.tz(this.currentTimestamp,this.timeZoneName).set({month:e}).clone().format("M月");this.$nextTick(()=>{const r=document.querySelector(".v-date-picker-controls__month-btn");r.innerText=a})},handleConfirmDate(){const o=v(this.currentDate).format("yyyy-MM-DD"),e=this.currentTime,a=`${o} ${e}`,r=v.tz(a,"YYYY-MM-DD HH:00",this.timeZoneName).clone().tz(this.localTimeZoneName);this.currentTimestamp=r.unix()*1e3,this.showDatePicker=!1},handleCancelDate(){this.showDatePicker=!1;const o=v.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=o.clone().format("YYYY-MM-DD"),this.currentTime=o.clone().format("HH:00")},handleClickOutside(o){const e=this.$refs.idmGl4Timepicker;e&&!e.contains(o.target)&&(this.showDatePicker=!1)}}},kh={ref:"idmGl4Timepicker",class:"idm-gl4-time-picker"},Ah={class:"pa-0",style:{width:"320px"}},Lh={class:"h-100 pa-0 d-flex flex-column justify-start align-center",style:{width:"100px"}},Ch={class:"d-flex justify-center align-center text-body-2",style:{height:"44px"}};function vh(o,e,a,r,i,l){const n=t.resolveComponent("VDatePicker"),c=t.resolveComponent("VDivider"),s=t.resolveComponent("VListItemTitle"),m=t.resolveComponent("VListItem"),d=t.resolveComponent("VList"),g=t.resolveComponent("VCardText"),u=t.resolveComponent("VBtn"),y=t.resolveComponent("VCardActions"),p=t.resolveComponent("VCard");return t.openBlock(),t.createElementBlock("div",kh,[t.createElementVNode("div",{style:t.normalizeStyle({height:a.height+"px",width:a.width?a.width+"px":"auto"}),class:t.normalizeClass([[a.bgClass,{"cursor-pointer":!a.disabled}],"rounded text-body-1 btn-border-1 btn-bg-1 d-flex align-center justify-center px-2"]),onClick:e[0]||(e[0]=(...h)=>l.handleOpenDatePicker&&l.handleOpenDatePicker(...h))},t.toDisplayString(i.currentDateTime)+" | UTC "+t.toDisplayString(a.timeZone<0?a.timeZone:"+"+a.timeZone),7),i.showDatePicker?(t.openBlock(),t.createBlock(p,{key:0,class:"card-box d-flex flex-column border elevation-12",style:t.normalizeStyle(l.getStyle)},{default:t.withCtx(()=>[t.createVNode(g,{class:"w-100 flex-1-1-0 d-flex pa-0 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",Ah,[t.createVNode(n,{modelValue:i.currentDate,"onUpdate:modelValue":e[1]||(e[1]=h=>i.currentDate=h),min:i.minDate,max:i.maxDate,"weekday-format":"narrow",color:"primary",density:"compact",class:"w-100","hide-header":""},null,8,["modelValue","min","max"])]),t.createVNode(c,{class:"h-100",vertical:""}),t.createElementVNode("div",Lh,[t.createElementVNode("div",Ch,t.toDisplayString(o.$t("time.time")),1),t.createVNode(d,{class:"pa-0 flex-1-1-0 scroll"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.hourOptions,(h,f)=>(t.openBlock(),t.createBlock(m,{key:f,value:h,color:"primary",active:i.currentTime===h,rounded:"",height:"26","min-height":"26",class:"rounded-xl",variant:i.currentTime===h?"flat":"text"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-body-2 font-weight-600 text-center",onClick:w=>i.currentTime=h},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(h),1)]),_:2},1032,["onClick"])]),_:2},1032,["value","active","variant"]))),128))]),_:1})])]),_:1}),t.createVNode(c),t.createVNode(y,{class:"w-100 d-flex justify-end align-center px-4 ga-4",style:{height:"50px"}},{default:t.withCtx(()=>[t.createVNode(u,{size:"small",variant:"tonal",class:"text-none text-body-1 px-4",onClick:l.handleCancelDate},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.cancel")),1)]),_:1},8,["onClick"]),t.createVNode(u,{size:"small",variant:"flat",color:"primary",class:"text-none text-body-1 px-4",onClick:l.handleConfirmDate},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.confirm")),1)]),_:1},8,["onClick"])]),_:1})]),_:1},8,["style"])):t.createCommentVNode("",!0)],512)}const to=Q(xh,[["render",vh]]),R1="",zh={name:"IdmPoint",components:{DateTimePicker:to},props:{simple:{type:Boolean,default:!1},isLogin:{type:Boolean,default:!1},token:{type:String},defaultMeteoToken:{type:String},theme:{type:String,default:"zh"},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}},gateway:{type:String},timeZone:{type:Number},forecastModel:{type:String},realTime:{type:String},followList:{type:Array,default:()=>[]}},emits:["meteoMore","follow","cancelFollow","login"],data(){return{right:10,toggle:!1,showForm:!1,showMeteo:!1,loading:!1,form:{lng:void 0,lngDegree:void 0,lngMinute:void 0,lngDirection:"E",lat:void 0,latDegree:void 0,latMinute:void 0,latDirection:"N",dateTime:void 0,forecastModel:""},formRules:{lngDegree:[o=>o!=null&&o!==""||"required",o=>/^\d{1,3}$/.test(o)||"number",o=>parseInt(o)>=0&&parseInt(o)<=180||"0 ~ 180"],lngMinute:[o=>o===void 0||o===null&&o===""||/^\d{1,2}(\.\d+)?$/.test(o)||"number",o=>o===void 0||o===null&&o===""||parseInt(o)>=0&&parseInt(o)<=59||"0 ~ 59"],latDegree:[o=>o!=null&&o!==""||"required",o=>/^\d{1,2}$/.test(o)||"number",o=>parseInt(o)>=0&&parseInt(o)<=90||"0 ~ 90"],latMinute:[o=>o===void 0||o===null&&o===""||/^\d{1,2}(\.\d+)?$/.test(o)||"number",o=>o===void 0||o===null&&o===""||parseInt(o)>=0&&parseInt(o)<=59||"0 ~ 59"]},meteoData:void 0,currentHourData:{},positionOffset:void 0,positionGmt:void 0,positionMarker:void 0,meteoInfoMarker:void 0}},computed:{timeZoneNames(){return v.tz.names()},timeZoneName(){var o;return(o=this.timeZoneNames.filter(e=>v.tz(v(),e).utcOffset()===this.timeZone*60))==null?void 0:o[0]},computedTzTime(){return o=>v.tz(v(o),this.timeZoneName).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(this.timeZone>=0?"+":"")+this.timeZone+")"},computedLocalTime(){return o=>{var r,i,l;const e=Number((r=this.positionOffset)==null?void 0:r.slice(1,3))*(((i=this.positionOffset)==null?void 0:i.slice(0,1))==="+"?1:-1),a=(l=this.timeZoneNames.filter(n=>v.tz(v(),n).utcOffset()===e*60))==null?void 0:l[0];return o?v.tz(v(o),a).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(e>=0?"+":"")+e+")":"-"}},computePosition(){return function(o){return!o||o.lng===null||o.lng===void 0||isNaN(o.lng)||o.lat===null||o.lat===void 0||isNaN(o.lat)?"-":N.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty+" / "+N.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty}},computeRoundPrecision(){return function(o,e=4){return o==null||isNaN(o)||isNaN(e)?"-":N.LngLatHelper.roundPrecision(o,e)}}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},toggle:{handler(){this.toggle?this.showForm=!0:(this.showForm=!1,this.showMeteo=!1),this.map&&this.handleBind()},immediate:!0},map:{handler(){this.map&&this.toggle&&this.handleBind()}},showForm:{handler(){this.showForm?(this.realTime&&(this.form.dateTime=this.realTime),this.$nextTick(()=>{var o;(o=this.$refs.spotForm)==null||o.resetValidation()})):this.handleCloseForm()}},showMeteo:{handler(){var o,e,a,r,i,l;this.showMeteo?((a=(e=(o=this.$parent)==null?void 0:o.$refs)==null?void 0:e.idmBottomBar)==null||a.handleToggle("spot",!0),this.simple&&this.$nextTick(()=>{var n,c;this.$parent.playerBottom=((c=(n=this.$refs.spotMeteo)==null?void 0:n.$el)==null?void 0:c.clientHeight)+10})):((l=(i=(r=this.$parent)==null?void 0:r.$refs)==null?void 0:i.idmBottomBar)==null||l.handleToggle("spot",!1),this.simple&&(this.$parent.playerBottom=30))}},realTime:{handler(){this.realTime&&(this.form.dateTime=this.realTime,this.showMeteo&&this.fetchData())}},forecastModel:{handler(){this.form.forecastModel=this.forecastModel},immediate:!0},"form.forecastModel":{handler(o,e){!o&&e&&(this.form.forecastModel=e==="GFS"?"ECMWF":"GFS")}}},methods:{handleMenuToggle(){this.isLogin?this.toggle=!this.toggle:this.$emit("login")},submitForm(){this.handleCloseMeteo(),this.$refs.spotForm.validate().then(async o=>{o!=null&&o.valid&&this.fetchData()})},cancelForm(){var o;(o=this.$refs.spotForm)==null||o.reset(),this.form={lng:void 0,lngDegree:void 0,lngMinute:void 0,lngDirection:"E",lat:void 0,latDegree:void 0,latMinute:void 0,latDirection:"N",dateTime:void 0,forecastModel:this.forecastModel}},handleCloseForm(){this.showForm=!1,this.cancelForm(),this.toggle=!1},async fetchData(){var a;if(isNaN(this.form.latDegree)||isNaN(this.form.latMinute)||isNaN(this.form.lngDegree)||isNaN(this.form.lngMinute))return!1;this.form.lat=(Number(this.form.latDegree??0)+Number(this.form.latMinute??0)/60)*(this.form.latDirection==="N"?1:-1),this.form.lng=(Number(this.form.lngDegree??0)+Number(this.form.lngMinute??0)/60)*(this.form.lngDirection==="E"?1:-1);const o=v();((a=v(this.realTime))==null?void 0:a.diff(o,"d",!0))>=0?await this.fetchForecastData(this.form):await this.fetchHistoryData(this.form)},async fetchForecastData(o){this.loading=!0,this.showMeteo=!0,this.form.lng=o.lng,this.form.lat=o.lat,this.form.followId=o.followId,this.handleDrawInfoMarker([o.lng,o.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Kt.Meteo2Assist.autoPickMeteoModel(o.forecastModel);let r={lat:o.lat,lng:o.lng,datetime:v(o.dateTime).utc().format(),forecastDays:o.day??3,weatherModels:e,marineModels:a};await ce.post(`${this.gateway}/api/arc/meteo2/spot/forecast`,r,{headers:{Authorization:this.token||this.defaultMeteoToken}}).then(i=>{(i==null?void 0:i.data.code)===0?(this.meteoData=i==null?void 0:i.data.data,this.meteoData.lng=o.lng,this.meteoData.lat=o.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1})},async fetchHistoryData(o){this.loading=!0,this.showMeteo=!0,this.form.lng=o.lng,this.form.lat=o.lat,this.form.followId=o.followId,this.handleDrawInfoMarker([o.lng,o.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Kt.Meteo2Assist.autoPickMeteoModel(o.forecastModel),r={lat:o.lat,lng:o.lng,datetime:v(o.dateTime).utc().format(),forecastDays:2,pastDays:1,weatherModels:e,marineModels:a};await ce.post(`${this.gateway}/api/arc/meteo2/spot/forecast`,r,{headers:{Authorization:this.token||this.defaultMeteoToken}}).then(i=>{(i==null?void 0:i.data.code)===0?(this.meteoData=i==null?void 0:i.data.data,this.meteoData.lng=o.lng,this.meteoData.lat=o.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1}),this.loading=!1},initTableData(o){var a,r,i,l,n,c,s,m,d,g,u,y,p,h,f,w,b,A,x,C,k,_,z,M,V,P,Y,U,K,de,ne,S,W,X,q,j,B,J,E,I,ie,ge,ue;this.currentHourData={},this.positionGmt=(r=(a=o==null?void 0:o.weather)==null?void 0:a[0])==null?void 0:r.timezone,this.positionOffset=(l=(i=o==null?void 0:o.weather)==null?void 0:i[0])==null?void 0:l.offset;const e=((n=Kt.Meteo2Assist.pickHourly(o,v(this.form.dateTime)))==null?void 0:n[0])||{};this.currentHourData.utc=e.utc,this.currentHourData.lat=o.lat,this.currentHourData.lng=o.lng,this.currentHourData.temp=this.computeRoundPrecision((c=e==null?void 0:e.weather)==null?void 0:c.temp,0)??"-",this.currentHourData.precipProbability=this.computeRoundPrecision((m=(s=e==null?void 0:e.weather)==null?void 0:s.precip)==null?void 0:m.probability,0)??"-",this.currentHourData.precip1h=this.computeRoundPrecision((g=(d=e==null?void 0:e.weather)==null?void 0:d.precip)==null?void 0:g.sum,0)??"-",this.currentHourData.visibility=this.computeRoundPrecision((u=e==null?void 0:e.weather)==null?void 0:u.visibility,0)??"-",this.currentHourData.windSpeed=this.computeRoundPrecision((p=(y=e==null?void 0:e.weather)==null?void 0:y.wind)==null?void 0:p.kts,1)??"-",this.currentHourData.windDir=((f=(h=e==null?void 0:e.weather)==null?void 0:h.wind)==null?void 0:f.direction)??"-",this.currentHourData.windLevel=this.computeRoundPrecision((b=(w=e==null?void 0:e.weather)==null?void 0:w.wind)==null?void 0:b.scale,0)??"-",this.currentHourData.windGust=this.computeRoundPrecision((x=(A=e==null?void 0:e.weather)==null?void 0:A.wind)==null?void 0:x.gusts,1)??"-",this.currentHourData.sigwaveHeight=this.computeRoundPrecision((k=(C=e==null?void 0:e.wave)==null?void 0:C.sig)==null?void 0:k.height,1)??"-",this.currentHourData.sigwaveDir=(z=(_=e==null?void 0:e.wave)==null?void 0:_.sig)==null?void 0:z.direction,this.currentHourData.sigwavePeriod=this.computeRoundPrecision((V=(M=e==null?void 0:e.wave)==null?void 0:M.sig)==null?void 0:V.period,1)??"-",this.currentHourData.windwaveHeight=this.computeRoundPrecision((Y=(P=e==null?void 0:e.wave)==null?void 0:P.wd)==null?void 0:Y.height,1)??"-",this.currentHourData.windwaveDir=(K=(U=e==null?void 0:e.wave)==null?void 0:U.wd)==null?void 0:K.direction,this.currentHourData.windwavePeriod=this.computeRoundPrecision((ne=(de=e==null?void 0:e.wave)==null?void 0:de.wd)==null?void 0:ne.period,1)??"-",this.currentHourData.swellHeight=this.computeRoundPrecision((W=(S=e==null?void 0:e.wave)==null?void 0:S.swell)==null?void 0:W.height,1)??"-",this.currentHourData.swellDir=(q=(X=e==null?void 0:e.wave)==null?void 0:X.swell)==null?void 0:q.direction,this.currentHourData.swellPeriod=this.computeRoundPrecision((B=(j=e==null?void 0:e.wave)==null?void 0:j.swell)==null?void 0:B.period,1)??"-",this.currentHourData.currentSpeed=this.computeRoundPrecision((J=e==null?void 0:e.current)==null?void 0:J.speed,1)??"-",this.currentHourData.currentDir=(E=e==null?void 0:e.current)==null?void 0:E.direction,this.currentHourData.currentSpeed=this.computeRoundPrecision((I=e==null?void 0:e.current)==null?void 0:I.speed,1)??"-",this.currentHourData.seaLevel=this.computeRoundPrecision(e==null?void 0:e.height,1)??"-",this.currentHourData.seaTemp=this.computeRoundPrecision(e==null?void 0:e.sst,0)??"-",this.currentHourData.weatherUrls=(ie=e==null?void 0:e.weather)==null?void 0:ie.url,this.currentHourData.sit=(ge=e==null?void 0:e.ice)==null?void 0:ge.sit,this.currentHourData.sic=this.computeRoundPrecision(((ue=e==null?void 0:e.ice)==null?void 0:ue.sic)*100,0)??"-",this.currentHourData.showIce=o.lat>=65||o.lat<=-65},handleBind(){var o,e;this.toggle?((o=this.map)==null||o.on("click",this.handleClick),this.map&&(this.map.getCanvas().style.cursor="crosshair")):((e=this.map)==null||e.off("click",this.handleClick),this.handleCloseMeteo(),this.map&&(this.map.getCanvas().style.cursor="grab"))},handleClick(o){if(o.originalEvent.stopPropagation(),o.originalEvent.target.className==="mapboxgl-canvas")this.handleGetPosition(o.lngLat),this.$nextTick(()=>{this.fetchData()});else return!1},handleGetPosition(o){if(isNaN(o.lat)||isNaN(o.lng))return!1;this.form.latDegree=Number(N.LngLatHelper.lat2pretty(o.lat).degree),this.form.latMinute=Number(N.LngLatHelper.lat2pretty(o.lat).minute),this.form.latDirection=N.LngLatHelper.lat2pretty(o.lat).direction,this.form.lngDegree=Number(N.LngLatHelper.lng2pretty(o.lng).degree),this.form.lngMinute=Number(N.LngLatHelper.lng2pretty(o.lng).minute),this.form.lngDirection=N.LngLatHelper.lng2pretty(o.lng).direction},handleDrawInfoMarker(o){this.drawPositionMarker(o),this.simple||this.drawMeteoInfoMarker(o)},drawPositionMarker(o){o&&(this.map.flyTo({center:o,duration:300}),this.$nextTick(()=>{var a,r;(a=this.positionMarker)==null||a.remove();const e=(r=document.getElementById("idm-position-icon"))==null?void 0:r.cloneNode(!0);this.positionMarker=new me.Marker(e).setLngLat(o).setOffset([0,-15]).addTo(this.map)}))},drawMeteoInfoMarker(o){this.$nextTick(()=>{var a;const e=document.getElementById("idm-gl4-spot-meteo");this.meteoInfoMarker?(a=this.meteoInfoMarker)==null||a.setLngLat(o):this.meteoInfoMarker=new me.Marker(e).setLngLat(o).setOffset([0,-190]).addTo(this.map)})},handleMeteoMore(){this.form.forecastModel=this.forecastModel,this.$emit("meteoMore",this.form)},handleCloseMeteo(){this.showMeteo=!1,this.$nextTick(()=>{var o,e;(o=this.positionMarker)==null||o.remove(),this.positionMarker=void 0,(e=this.meteoInfoMarker)==null||e.remove(),this.meteoInfoMarker=void 0})},handleFollow(){this.$emit("follow",this.form)},handleCancelFollow(){var e,a,r;const o=((e=this.form)==null?void 0:e.followId)||((r=(a=this.followList)==null?void 0:a.find(i=>{var l,n;return(i==null?void 0:i.id)===this.form.followId||((l=i==null?void 0:i.coordinate)==null?void 0:l.lng)===this.form.lng&&((n=i==null?void 0:i.coordinate)==null?void 0:n.lat)===this.form.lat}))==null?void 0:r.id);this.$emit("cancelFollow",o)}}},_h={class:"idm-gl4-spot"},Sh={class:"d-flex justify-start align-center"},Nh={class:"text-h6 font-weight-600"},Mh={class:"d-flex justify-start align-center ga-1 mb-2"},Ph={class:"text-label"},Vh={class:"w-100 d-flex ma-0"},Th={class:"w-30 pa-0 d-flex"},Eh={class:"flex-1-1-0 pa-0 d-flex"},Dh={class:"pa-0"},Rh={class:"d-flex justify-start align-center ga-1 mb-2"},Bh={class:"text-label"},Ih={class:"w-100 d-flex ma-0"},Fh={class:"w-30 pa-0 d-flex"},Gh={class:"flex-1-1-0 pa-0 d-flex"},jh={class:"pa-0"},Wh={class:"d-flex justify-start align-center ga-1 mb-2"},Zh={class:"text-label"},Xh={class:"d-flex justify-start align-center ga-1 mb-2"},Hh={class:"text-label"},Oh={class:"d-flex justify-start align-center"},Yh={class:"mx-2"},Uh={class:"mx-0 py-2 d-flex align-center justify-start"},Jh={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Kh={class:"pa-0 px-0"},Qh={class:"mx-0 py-2 d-flex align-center justify-start"},qh={cols:"9",class:"pa-0 px-0"},$h={class:"mx-0 py-2 d-flex align-center justify-start"},ep={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},tp={style:{width:"150px"},class:"pa-0 text-left"},op={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},ap={cols:"3",class:"pa-0 px-0 text-left"},ip={class:"mx-0 py-2 d-flex align-center justify-start"},rp={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},lp={style:{width:"150px"},class:"pa-0 text-left"},np={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},sp={cols:"3",class:"pa-0 text-left"},cp={class:"mx-0 py-2 d-flex align-center justify-start"},mp={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},dp={style:{width:"150px"},class:"pa-0 text-left"},hp={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},pp={class:"pa-0 text-left"},gp={key:0,class:"mx-0 py-2 d-flex align-center justify-start"},up={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},fp={style:{width:"150px"},class:"pa-0 text-left"},yp={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},bp={class:"pa-0 text-left"},wp={class:"d-flex justify-space-between align-center"},xp={class:"d-flex justify-start align-center"},kp={class:"mx-1"},Ap={class:"d-flex justify-end align-center"},Lp={class:"mx-0 py-1 d-flex align-center justify-start"},Cp={style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},vp={class:"pa-0 px-0"},zp={class:"mx-0 py-1 d-flex align-center justify-start"},_p={class:"pa-0 px-0"},Sp={class:"gray-bg-2 mx-4 my-2 py-3 px-2 rounded text-font-13 d-flex align-center justify-space-between"},Np={class:"d-flex flex-column align-start justify-center ga-3"},Mp={class:"text-label pr-2"},Pp={class:"text-label pr-2"},Vp={class:"text-label pr-2"},Tp={key:0},Ep={class:"text-label pr-2"},Dp={class:"d-flex flex-column align-start justify-center ga-3"},Rp={class:"text-label pr-2"},Bp={class:"text-label pr-2"},Ip={class:"text-label pr-2"},Fp={key:0},Gp={class:"text-label pr-2"},jp={id:"idm-position-icon"},Wp={class:"multi-color-icon",style:{height:"30px",width:"30px"},"aria-hidden":"true"},Zp=["xlink:href"];function Xp(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardTitle"),m=t.resolveComponent("VDivider"),d=t.resolveComponent("VTextField"),g=t.resolveComponent("DateTimePicker"),u=t.resolveComponent("VCol"),y=t.resolveComponent("VRow"),p=t.resolveComponent("VBtnToggle"),h=t.resolveComponent("VCardText"),f=t.resolveComponent("VCardActions"),w=t.resolveComponent("VForm"),b=t.resolveComponent("VCard");return t.openBlock(),t.createElementBlock("div",_h,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("spot.spotsMeteo"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:A})=>[t.createVNode(n,t.mergeProps(A,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[8]||(e[8]=[t.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h4"},null,-1)])),_:2,__:[8]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),i.showForm&&!a.simple?(t.openBlock(),t.createBlock(b,{key:0,class:"spot-form-card",style:t.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+50+"px"})},{default:t.withCtx(()=>[t.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>[t.createElementVNode("div",Sh,[t.createElementVNode("div",Nh,t.toDisplayString(o.$t("spot.spotWeather")),1)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleCloseForm},{default:t.withCtx(()=>e[9]||(e[9]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[9]},8,["onClick"])]),_:1}),t.createVNode(m),t.createVNode(w,{ref:"spotForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.submitForm,["prevent"])},{default:t.withCtx(()=>[t.createVNode(h,{class:"text-body-1 pa-4 py-2"},{default:t.withCtx(()=>[t.createElementVNode("div",Mh,[t.createElementVNode("div",Ph,[t.createTextVNode(t.toDisplayString(o.$t("spot.lat")),1),e[10]||(e[10]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createElementVNode("div",Vh,[t.createElementVNode("div",Th,[t.createVNode(d,{modelValue:i.form.latDegree,"onUpdate:modelValue":e[0]||(e[0]=A=>i.form.latDegree=A),rules:i.formRules.latDegree,label:"",density:"compact",variant:"outlined",height:"32px","min-height":"32px",required:"",dense:"",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[11]||(e[11]=t.createElementVNode("span",{class:"px-1"},"°",-1))]),t.createElementVNode("div",Eh,[t.createVNode(d,{modelValue:i.form.latMinute,"onUpdate:modelValue":e[1]||(e[1]=A=>i.form.latMinute=A),rules:i.formRules.latMinute,label:"",density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[12]||(e[12]=t.createElementVNode("span",{class:"px-1"},"'",-1))]),t.createElementVNode("div",Dh,[t.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[2]||(e[2]=A=>i.form.latDirection=i.form.latDirection==="N"?"S":"N")},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.form.latDirection),1)]),_:1})])]),t.createElementVNode("div",Rh,[t.createElementVNode("div",Bh,[t.createTextVNode(t.toDisplayString(o.$t("spot.lng")),1),e[13]||(e[13]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createElementVNode("div",Ih,[t.createElementVNode("div",Fh,[t.createVNode(d,{modelValue:i.form.lngDegree,"onUpdate:modelValue":e[3]||(e[3]=A=>i.form.lngDegree=A),rules:i.formRules.lngDegree,density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[14]||(e[14]=t.createElementVNode("span",{class:"px-1"},"°",-1))]),t.createElementVNode("div",Gh,[t.createVNode(d,{modelValue:i.form.lngMinute,"onUpdate:modelValue":e[4]||(e[4]=A=>i.form.lngMinute=A),rules:i.formRules.lngMinute,label:"",density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[15]||(e[15]=t.createElementVNode("span",{class:"px-1"},"'",-1))]),t.createElementVNode("div",jh,[t.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[5]||(e[5]=A=>i.form.lngDirection=i.form.lngDirection==="E"?"W":"E")},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.form.lngDirection),1)]),_:1})])]),t.createElementVNode("div",Wh,[t.createElementVNode("div",Zh,[t.createTextVNode(t.toDisplayString(o.$t("spot.dateTime")),1),e[16]||(e[16]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createVNode(y,{class:"ma-0 mb-4"},{default:t.withCtx(()=>[t.createVNode(u,{cols:"12",class:"pa-0"},{default:t.withCtx(()=>[t.createVNode(g,t.mergeProps({"date-time":i.form.dateTime,"time-zone":a.timeZone},o.$attrs,{onDateTime:e[6]||(e[6]=A=>i.form.dateTime=A)}),null,16,["date-time","time-zone"])]),_:1})]),_:1}),t.createElementVNode("div",Xh,[t.createElementVNode("div",Hh,[t.createTextVNode(t.toDisplayString(o.$t("weather.forecastModel")),1),e[17]||(e[17]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createVNode(y,{class:"ma-0"},{default:t.withCtx(()=>[t.createVNode(u,{cols:"12",class:"pa-0"},{default:t.withCtx(()=>[t.createVNode(p,{modelValue:i.form.forecastModel,"onUpdate:modelValue":e[7]||(e[7]=A=>i.form.forecastModel=A),class:"w-100",rounded:"",height:"30",density:"compact",group:"",mandatory:""},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact",height:"30",value:"GFS",class:t.normalizeClass(["text-none flex-1-1-0",i.form.forecastModel==="GFS"?"":"btn-border-1 btn-bg-1"]),color:i.form.forecastModel==="GFS"?"primary":"","base-color":""},{default:t.withCtx(()=>e[18]||(e[18]=[t.createTextVNode(" NOAA ",-1)])),_:1,__:[18]},8,["class","color"]),t.createVNode(n,{density:"compact",height:"30",class:t.normalizeClass(["text-none flex-1-1-0",i.form.forecastModel==="ECMWF"?"":"btn-border-1 btn-bg-1"]),color:i.form.forecastModel==="ECMWF"?"primary":"","base-color":"",value:"ECMWF"},{default:t.withCtx(()=>e[19]||(e[19]=[t.createTextVNode(" ECMWF ",-1)])),_:1,__:[19]},8,["class","color"])]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),t.createVNode(m),t.createVNode(f,{class:"d-flex justify-end align-center ga-4 pa-4 py-2"},{default:t.withCtx(()=>[t.createVNode(n,{size:"small",variant:"tonal",class:"text-none text-body-1 btn-bg-1",onClick:l.cancelForm},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.clear")),1)]),_:1},8,["onClick"]),t.createVNode(n,{ref:"submitSpot",loading:i.loading,size:"small",variant:"flat",color:"primary",type:"submit",class:"text-none text-body-1"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.confirm")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])]),_:1},8,["style"])):t.createCommentVNode("",!0),i.showMeteo&&!a.simple?(t.openBlock(),t.createBlock(b,{key:1,id:"idm-gl4-spot-meteo",class:"spot-meteo",style:{width:"490px","z-index":"9"}},{default:t.withCtx(()=>[t.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>[t.createElementVNode("div",Oh,[e[20]||(e[20]=t.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),t.createElementVNode("div",Yh,t.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),t.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:t.withModifiers(l.handleCloseMeteo,["stop"])},{default:t.withCtx(()=>e[21]||(e[21]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[21]},8,["onClick"])]),_:1}),t.createVNode(m),t.createVNode(h,{class:"text-body-1 px-0 py-1"},{default:t.withCtx(()=>{var A,x;return[t.createElementVNode("div",Uh,[t.createElementVNode("div",Jh,t.toDisplayString(o.$t("time.time")),1),t.createElementVNode("div",Kh,t.toDisplayString(l.computedTzTime((A=i.currentHourData)==null?void 0:A.utc)),1)]),t.createElementVNode("div",Qh,[e[22]||(e[22]=t.createElementVNode("div",{style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),t.createElementVNode("div",qh,t.toDisplayString(l.computedLocalTime((x=i.currentHourData)==null?void 0:x.utc)),1)]),t.createElementVNode("div",$h,[t.createElementVNode("div",ep,t.toDisplayString(o.$t("weather.wind")),1),t.createElementVNode("div",tp,t.toDisplayString(i.currentHourData.windDir??"-")+"/"+t.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+t.toDisplayString(i.currentHourData.windLevel??"-"),1),t.createElementVNode("div",op,t.toDisplayString(o.$t("weather.sigWave")),1),t.createElementVNode("div",ap,t.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s ",1)]),t.createElementVNode("div",ip,[t.createElementVNode("div",rp,t.toDisplayString(o.$t("weather.windWave")),1),t.createElementVNode("div",lp,t.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s ",1),t.createElementVNode("div",np,t.toDisplayString(o.$t("weather.swell")),1),t.createElementVNode("div",sp,t.toDisplayString(i.currentHourData.swellDir??"-")+"/"+t.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.swellPeriod??"-")+"s ",1)]),t.createElementVNode("div",cp,[t.createElementVNode("div",mp,t.toDisplayString(o.$t("weather.current")),1),t.createElementVNode("div",dp,t.toDisplayString(i.currentHourData.currentDir??"-")+"/"+t.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1),t.createElementVNode("div",hp,t.toDisplayString(o.$t("weather.visibility")),1),t.createElementVNode("div",pp,t.toDisplayString(i.currentHourData.visibility??"-")+"nm",1)]),i.currentHourData.showIce?(t.openBlock(),t.createElementBlock("div",gp,[t.createElementVNode("div",up,t.toDisplayString(o.$t("weather.sit")),1),t.createElementVNode("div",fp,t.toDisplayString(i.currentHourData.sit??"-")+"m",1),t.createElementVNode("div",yp,t.toDisplayString(o.$t("weather.sic")),1),t.createElementVNode("div",bp,t.toDisplayString(i.currentHourData.sic??"-")+"%",1)])):t.createCommentVNode("",!0)]}),_:1}),t.createVNode(m),t.createVNode(f,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>{var A;return[(A=a.followList)!=null&&A.some(x=>{var C,k;return(x==null?void 0:x.id)===i.form.followId||((C=x==null?void 0:x.coordinate)==null?void 0:C.lng)===i.form.lng&&((k=x==null?void 0:x.coordinate)==null?void 0:k.lat)===i.form.lat})?(t.openBlock(),t.createBlock(n,{key:0,id:"idm-gl4-spot-meteo-follow",class:"text-none text-body-1",variant:"text",density:"compact",height:"32",onClick:t.withModifiers(l.handleCancelFollow,["stop"])},{prepend:t.withCtx(()=>e[23]||(e[23]=[t.createElementVNode("i",{class:"iconfont icon-yishoucang text-h6 text-warning"},null,-1)])),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(o.$t("actions.unfollow")),1)]),_:1},8,["onClick"])):(t.openBlock(),t.createBlock(n,{key:1,id:"idm-gl4-spot-meteo-unfollow",class:"text-none text-body-1",variant:"text",density:"compact",height:"32",onClick:t.withModifiers(l.handleFollow,["stop"])},{prepend:t.withCtx(()=>e[24]||(e[24]=[t.createElementVNode("i",{class:"iconfont icon-weishoucang text-h6"},null,-1)])),default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.follow"))+" ",1)]),_:1},8,["onClick"])),t.createVNode(n,{height:"32",variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:t.withModifiers(l.handleMeteoMore,["stop"])},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("spot.forecast")),1)]),_:1},8,["onClick"])]}),_:1})]),_:1})):t.createCommentVNode("",!0),i.showMeteo&&a.simple?(t.openBlock(),t.createBlock(b,{key:2,ref:"spotMeteo",class:"position-absolute bottom-0 rounded-t-4",style:{width:"100vw","z-index":"1001"}},{default:t.withCtx(()=>[t.createVNode(s,null,{default:t.withCtx(()=>{var A;return[t.createElementVNode("div",wp,[t.createElementVNode("div",xp,[e[25]||(e[25]=t.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),t.createElementVNode("div",kp,t.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),t.createElementVNode("div",Ap,[(A=a.followList)!=null&&A.some(x=>{var C,k;return(x==null?void 0:x.id)===i.form.followId||((C=x==null?void 0:x.coordinate)==null?void 0:C.lng)===i.form.lng&&((k=x==null?void 0:x.coordinate)==null?void 0:k.lat)===i.form.lat})?(t.openBlock(),t.createBlock(n,{key:0,class:"text-none text-body-1 rounded-circle",variant:"text",density:"compact",height:"32",width:"28","min-width":"28",onClick:t.withModifiers(l.handleCancelFollow,["stop"])},{default:t.withCtx(()=>e[26]||(e[26]=[t.createElementVNode("i",{class:"iconfont icon-yishoucang text-h4 text-warning"},null,-1)])),_:1,__:[26]},8,["onClick"])):(t.openBlock(),t.createBlock(n,{key:1,class:"text-none text-body-1 rounded-circle",variant:"plain",density:"compact",height:"32",width:"28","min-width":"28",onClick:t.withModifiers(l.handleFollow,["stop"])},{default:t.withCtx(()=>e[27]||(e[27]=[t.createElementVNode("i",{class:"iconfont icon-weishoucang text-h4"},null,-1)])),_:1,__:[27]},8,["onClick"])),t.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:t.withModifiers(l.handleCloseMeteo,["stop"])},{default:t.withCtx(()=>e[28]||(e[28]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[28]},8,["onClick"])])]),e[29]||(e[29]=t.createElementVNode("div",{class:"px-5 py-0 text-label text-body-1"},"Spot Weather",-1))]}),_:1,__:[29]}),t.createVNode(m),t.createVNode(h,{class:"text-body-1 px-0 py-2"},{default:t.withCtx(()=>{var A,x;return[t.createElementVNode("div",Lp,[t.createElementVNode("div",Cp,t.toDisplayString(o.$t("time.time")),1),t.createElementVNode("div",vp,t.toDisplayString(l.computedTzTime((A=i.currentHourData)==null?void 0:A.utc)),1)]),t.createElementVNode("div",zp,[e[30]||(e[30]=t.createElementVNode("div",{style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),t.createElementVNode("div",_p,t.toDisplayString(l.computedLocalTime((x=i.currentHourData)==null?void 0:x.utc)),1)]),t.createElementVNode("div",Sp,[t.createElementVNode("div",Np,[t.createElementVNode("div",null,[t.createElementVNode("span",Mp,t.toDisplayString(o.$t("weather.wind")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.windDir??"-")+"/"+t.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+t.toDisplayString(i.currentHourData.windLevel??"-"),1)]),t.createElementVNode("div",null,[t.createElementVNode("span",Pp,t.toDisplayString(o.$t("weather.sigWave")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s",1)]),t.createElementVNode("div",null,[t.createElementVNode("span",Vp,t.toDisplayString(o.$t("weather.windWave")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s",1)]),i.currentHourData.showIce?(t.openBlock(),t.createElementBlock("div",Tp,[t.createElementVNode("span",Ep,t.toDisplayString(o.$t("weather.sit")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.sit??"-")+"m",1)])):t.createCommentVNode("",!0)]),t.createElementVNode("div",Dp,[t.createElementVNode("div",null,[t.createElementVNode("span",Rp,t.toDisplayString(o.$t("weather.swell")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.swellDir??"-")+"/"+t.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.swellPeriod??"-")+"s",1)]),t.createElementVNode("div",null,[t.createElementVNode("span",Bp,t.toDisplayString(o.$t("weather.current")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.currentDir??"-")+"/"+t.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1)]),t.createElementVNode("div",null,[t.createElementVNode("span",Ip,t.toDisplayString(o.$t("weather.visibility")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.visibility??"-")+" nm",1)]),i.currentHourData.showIce?(t.openBlock(),t.createElementBlock("div",Fp,[t.createElementVNode("span",Gp,t.toDisplayString(o.$t("weather.sic")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.sic??"-")+"%",1)])):t.createCommentVNode("",!0)])])]}),_:1})]),_:1},512)):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("div",jp,[(t.openBlock(),t.createElementBlock("svg",Wp,[t.createElementVNode("use",{"xlink:href":`#icon-spot-${a.theme}`},null,8,Zp)]))],512),[[t.vShow,i.showMeteo]])])}const Hp=Q(zh,[["render",Xp]]),B1="",Op={name:"IdmMeasure",props:{simple:{type:Boolean,default:!1},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}}},setup(){return{Theme:ye.useTheme()}},data(){return{right:10,toggle:!1,geojson:[],source:"measure-source",layer:"measure-layer",labelLayer:"measure-label-layer",sumLayer:"measure-suml-layer",tmpSource:"measure-tmp-source",tmpLayer:"measure-tmp-layer",tmpLabelLayer:"measure-tmp-label-layer",closeMarkers:{},pointMarkers:{},tipMarker:void 0,contextmenu:void 0,navigation:"RL",currentLineIndex:1}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},toggle:{handler(){var o,e,a;if(this.toggle)this.handleBind();else{(o=this.map)==null||o.getCanvas().removeEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.off("mousemove",this.handleMove),(a=this.map)==null||a.off("dblclick",this.handleDblClick),this.map;let r=this.geojson.find(i=>!i.closed);r&&this.handleClear(r,!0),this.geojson=this.geojson.filter(i=>!!i.closed),r=T.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(r)}},immediate:!0},map:{handler(){this.map&&(this.toggle?this.handleBind():this.handleUnbind())}}},methods:{handleMenuToggle(){this.toggle=!this.toggle},handleBind(){var o,e,a,r,i;(o=this.map)==null||o.getCanvas().addEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.on("mousemove",this.handleMove),(a=this.map)==null||a.on("dblclick",this.handleDblClick),(r=this.map)==null||r.on("click",this.handleClick),(i=this.map)==null||i.on("contextmenu",this.handleContextmenu),this.map&&(this.map.getCanvas().style.cursor="crosshair")},handleUnbind(){var o,e,a,r,i;(o=this.map)==null||o.getCanvas().removeEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.off("mousemove",this.handleMove),(a=this.map)==null||a.off("dblclick",this.handleDblClick),(r=this.map)==null||r.off("click",this.handleClick),(i=this.map)==null||i.off("contextmenu",this.handleContextmenu);for(const l of this.geojson)this.handleClear(l,!0);this.geojson=[],this.map&&(this.map.getCanvas().style.cursor="grab")},handleKeydown(o){if(o.key==="Shift"){this.navigation=this.navigation==="RL"?"GC":"RL";const e=this.geojson.at(-1),a=e.features.filter(r=>r.geometry.type==="Point");a!=null&&a.length&&(a.at(-1).properties.mode=this.navigation),this.handleRender(e)}},handleDrag(o){var a,r,i,l,n,c,s,m,d,g;const e=(r=(a=o.target)==null?void 0:a._element)==null?void 0:r.id;if((e==null?void 0:e.split("-").length)===2){const u=this.geojson.filter(f=>f.id===e.split("-")[0])[0];this.pointMarkers[u.id].filter(f=>{var w;return((w=f._element)==null?void 0:w.id)===e})[0].setLngLat([(l=(i=o.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(c=(n=o.target)==null?void 0:n._lngLat)==null?void 0:c.lat]);let p;u.features.forEach((f,w)=>{if(f.geometry.type==="Point"&&f.properties.id===e.split("-")[1]){p=w;return}});const h=u.features.filter(f=>f.geometry.type==="Point");this.handleTmpPointUpdate(u,h[p-1],{lng:(m=(s=o.target)==null?void 0:s._lngLat)==null?void 0:m.lng,lat:(g=(d=o.target)==null?void 0:d._lngLat)==null?void 0:g.lat,properties:h[p].properties},p===h.length-1?void 0:h[p+1])}},handleDragEnd(o){var a,r,i,l,n,c,s,m,d,g;const e=(r=(a=o.target)==null?void 0:a._element)==null?void 0:r.id;if((e==null?void 0:e.split("-").length)===2){const u=this.geojson.filter(h=>h.id===e.split("-")[0])[0];this.pointMarkers[u.id].filter(h=>{var f;return((f=h._element)==null?void 0:f.id)===e})[0].setLngLat([(l=(i=o.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(c=(n=o.target)==null?void 0:n._lngLat)==null?void 0:c.lat]);const p=u.features.filter(h=>h.geometry.type==="Point"&&h.properties.id===e.split("-")[1])[0];p.geometry.coordinates=[(m=(s=o.target)==null?void 0:s._lngLat)==null?void 0:m.lng,(g=(d=o.target)==null?void 0:d._lngLat)==null?void 0:g.lat],u.features=u.features.filter(h=>h.geometry.type==="Point"),this.handlePointUpdate(u)}},handleContextmenu(o){var a,r,i,l;o.preventDefault(),(a=this.contextmenu)==null||a.remove();const e=(l=(i=(r=o.originalEvent)==null?void 0:r.target)==null?void 0:i.parentElement)==null?void 0:l.id;if((e==null?void 0:e.split("-").length)===2){const c=this.geojson.filter(s=>s.id===e.split("-")[0])[0].features.filter(s=>s.geometry.type==="Point");if(c.length>2&&c.filter(m=>m.properties.id===(e==null?void 0:e.split("-")[1]))[0]){const m=document.createElement("div");m.className="idm-gl4-measure-contextmenu-marker",m.innerHTML=`<span id="del-${e}" class="del-point">${this.$t("actions.detele")}</span>`,this.contextmenu=new me.Marker(m).setOffset([24,0]).setLngLat([o.lngLat.lng,o.lngLat.lat]).addTo(this.map)}}},handleClick(o){var a,r,i,l,n,c;(a=this.contextmenu)==null||a.remove();const e=o.originalEvent.target.className;if(e==="marker-close"){const s=(i=(r=o.originalEvent)==null?void 0:r.srcElement)==null?void 0:i.id,m=this.geojson.filter(d=>d.id===s)[0];m&&this.handleClear(m,!0),this.geojson=this.geojson.filter(d=>d.id!==s),!this.toggle&&!((l=this.geojson)!=null&&l.some(d=>d.closed))&&this.handleUnbind()}else if(e==="del-point"){const s=(c=(n=o.originalEvent.target.id)==null?void 0:n.replace("del-",""))==null?void 0:c.split("-"),m=this.geojson.filter(d=>d.id===s[0])[0];m.features=m.features.filter(d=>d.geometry.type==="Point"&&d.properties.id!==s[1]),this.handlePointUpdate(m)}else if(e!=="marker-label"&&this.toggle){let s=this.geojson.at(-1);s||(s=T.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(s)),s.features=s.features.filter(d=>d.geometry.type==="Point");const m=T.feature({type:"Point",coordinates:[o.lngLat.lng,o.lngLat.lat]},{id:new Date().getTime().toString(),mode:this.navigation,sumLabel:"Start"});s.features.push(m),this.handlePointUpdate(s)}},handlePointUpdate(o){const e=o.features;if(e.length>1){let a=0;const r=[];for(let i=1;i<e.length;i++){const l=e[i-1],n=e[i],c=l.properties,s={lng:l.geometry.coordinates[0],lat:l.geometry.coordinates[1]},m={lng:n.geometry.coordinates[0],lat:n.geometry.coordinates[1]},d=N.LaneHelper.calculateDistance(s,m,c.mode==="RL",4),g=N.LaneHelper.calculateBearing(s,m,c.mode==="RL",2);a=N.LngLatHelper.roundPrecision(a+d,4);let u;c.mode==="RL"?u=N.LngLatHelper.convertToMonotonicLng([s,m]):u=N.LngLatHelper.convertToMonotonicLng(N.LaneHelper.interpolateCoordinates(s,m,200));const y=T.lineString(u.map(h=>[h.lng,h.lat]));y.properties.dist=d,y.properties.bearing=g,y.properties.total=a,y.properties.name="Line "+this.currentLineIndex,r.push(y);const p=e[i];p.properties.totalDist=N.LngLatHelper.roundPrecision((c.totalDist?c.totalDist:0)+d,4),p.properties.sumLabel=p.properties.totalDist+" nm"}e.push(...r),o.total=a}return this.handleRender(o),o},handleTmpPointUpdate(o,e,a,r){const i=T.featureCollection([]);let l,n;if(e){const s=e.properties,m={lng:e.geometry.coordinates[0],lat:e.geometry.coordinates[1]},d={lng:a.lng,lat:a.lat};l=N.LaneHelper.calculateDistance(m,d,s.mode==="RL",4),n=N.LaneHelper.calculateBearing(m,d,s.mode==="RL",2);let g;s.mode==="RL"?g=N.LngLatHelper.convertToMonotonicLng([m,d]):g=N.LngLatHelper.convertToMonotonicLng(N.LaneHelper.interpolateCoordinates(m,d,200));const u=T.lineString(g.map(y=>[y.lng,y.lat]));u.properties.dist=l,u.properties.bearing=n,i.features.push(u)}if(r){const s=a.properties,m=a,d={lng:r.geometry.coordinates[0],lat:r.geometry.coordinates[1]};l=N.LaneHelper.calculateDistance(m,d,s.mode==="RL",4),n=N.LaneHelper.calculateBearing(m,d,s.mode==="RL",2);let g;s.mode==="RL"?g=N.LngLatHelper.convertToMonotonicLng([m,d]):g=N.LngLatHelper.convertToMonotonicLng(N.LaneHelper.interpolateCoordinates(m,d,200));const u=T.lineString(g.map(y=>[y.lng,y.lat]));u.properties.dist=l,u.properties.bearing=n,i.features.push(u)}this.map.getSource(this.tmpSource)?this.map.getSource(this.tmpSource).setData(i):this.map.addSource(this.tmpSource,{type:"geojson",data:i}),this.map.getLayer(this.tmpLayer)||this.map.addLayer({id:this.tmpLayer,type:"line",source:this.tmpSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["map-orange"],"line-width":2,"line-opacity":1,"line-dasharray":[3,2]}}),this.map.getLayer(this.tmpLabelLayer)||this.map.addLayer({id:this.tmpLabelLayer,type:"symbol",source:this.tmpSource,filter:["==","$type","LineString"],layout:{"symbol-placement":"line-center","text-field":"{dist}nm / {bearing}°","text-rotation-alignment":"map","text-size":11,"text-offset":[0,-1]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}});let c;if(r)c=`<div class="marker-label">${this.$t("measure.dragTips")}</div>`;else{const s=N.LngLatHelper.roundPrecision((o.total??0)+l,1);c=`<div class="marker-label">${this.$t("measure.totalDistance")}: <b>${s}</b>nm, ${this.$t("measure.bearing")}: <b>${n}</b>°</div><div class="marker-label"> ${this.$t("measure.mode")}${this.navigation==="RL"?"RL":"GC"}, ${this.$t("measure.switchTips")}</div><div class="marker-label">${this.$t("measure.clickTips")}</div>`}if(this.tipMarker)this.tipMarker._element.innerHTML=c,this.tipMarker.setLngLat([a.lng,a.lat]);else{const s=document.createElement("div");s.className="idm-gl4-measure-tip-marker",s.innerHTML=c,this.tipMarker=new me.Marker(s).setOffset([140,0]).setLngLat([a.lng,a.lat]).addTo(this.map)}},handleMove(o){this.map.getCanvas().style.cursor="crosshair";let e=this.geojson.at(-1);e||(e=T.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e));const a=e.features.filter(r=>r.geometry.type==="Point");a!=null&&a.length&&this.handleTmpPointUpdate(e,a.at(-1),{lng:o.lngLat.lng,lat:o.lngLat.lat})},handleDblClick(o){o.preventDefault();let e=this.geojson.at(-1);e.closed=!0,this.handleRender(e),e=T.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e),this.currentLineIndex++},handleRender(o){var e;if((e=o==null?void 0:o.features)!=null&&e.length){const a=`${o.id}-${this.source}`,r=`${o.id}-${this.layer}`,i=`${o.id}-${this.labelLayer}`,l=`${o.id}-${this.sumLayer}`;this.map.getSource(a)?this.map.getSource(a).setData(o):this.map.addSource(a,{type:"geojson",data:o}),this.handleClear(o,!1),this.map.addLayer({id:r,type:"line",source:a,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["map-orange"],"line-width":2}}),this.map.addLayer({id:i,type:"symbol",source:a,filter:["==","$type","LineString"],layout:{"symbol-placement":"line-center","text-field":"{dist}nm / {bearing}°","text-rotation-alignment":"map","text-size":11,"text-offset":[0,-1]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}}),this.map.addLayer({id:l,type:"symbol",source:a,filter:["==","$type","Point"],layout:{"text-field":"{sumLabel}","text-rotation-alignment":"map","text-size":12,"text-offset":[0,1.5]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}});const n=o.features.filter(c=>c.geometry.type==="Point");for(const c of n){const s=document.createElement("div");s.id=`${o.id}-${c.properties.id}`,s.className=`${o.closed?"idm-gl4-measure-marker closed":"idm-gl4-measure-marker"}`,s.innerHTML='<div class="marker-circle"></div>';const m=new me.Marker({element:s,draggable:!0,contextmenu:!0}).setLngLat(c.geometry.coordinates).addTo(this.map);m.on("drag",this.handleDrag),m.on("dragend",this.handleDragEnd),this.pointMarkers[o.id]?this.pointMarkers[o.id].push(m):this.pointMarkers[o.id]=[m]}if(o.closed){const c=n.at(-1),m=o.features.filter(g=>g.geometry.type==="LineString").at(-1),d=document.createElement("div");d.className="idm-gl4-measure-summary-marker",d.innerHTML=`<div class="marker-label">${m.properties.name}</div><div id="${o.id}" class="marker-close">X</div>`,this.closeMarkers[o.id]=new me.Marker(d).setOffset([0,-30]).setLngLat(c.geometry.coordinates).addTo(this.map)}}},handleClear(o,e=!0){var n,c,s,m,d,g,u,y,p,h;const a=`${o.id}-${this.source}`,r=`${o.id}-${this.layer}`,i=`${o.id}-${this.labelLayer}`,l=`${o.id}-${this.sumLayer}`;(n=this.map)!=null&&n.getLayer(r)&&this.map.removeLayer(r),(c=this.map)!=null&&c.getLayer(i)&&this.map.removeLayer(i),(s=this.map)!=null&&s.getLayer(l)&&this.map.removeLayer(l),(m=this.map)!=null&&m.getLayer(this.tmpLayer)&&this.map.removeLayer(this.tmpLayer),(d=this.map)!=null&&d.getLayer(this.tmpLabelLayer)&&this.map.removeLayer(this.tmpLabelLayer),(g=this.closeMarkers[o.id])==null||g.remove(),this.closeMarkers[o.id]=void 0,(u=this.pointMarkers[o.id])==null||u.forEach(f=>{f==null||f.remove()}),this.pointMarkers[o.id]=[],(y=this.tipMarker)==null||y.remove(),this.tipMarker=void 0,e&&((p=this.map)!=null&&p.getSource(a))&&this.map.removeSource(a),e&&((h=this.map)!=null&&h.getSource(this.tmpSource))&&this.map.removeSource(this.tmpSource)}}},Yp={class:"idm-gl4-measure"};function Up(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip");return t.openBlock(),t.createElementBlock("div",Yp,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+166+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("measure.measure"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:s})=>[t.createVNode(n,t.mergeProps(s,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[0]||(e[0]=[t.createElementVNode("i",{class:"iconfont icon-a-Measuredistance text-h4"},null,-1)])),_:2,__:[0]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4)])}const Jp=Q(Op,[["render",Up]]),I1="",Kp={name:"IdmDrawMarker",props:{map:{type:Object},gateway:{type:String},token:{type:String},simple:{type:Boolean,default:!1},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:()=>({})},editLayer:{type:Object,default:null},group:{type:Object,default:()=>({})}},emits:["close","save","hideLayer"],setup(){return{Theme:ye.useTheme()}},data(){var o;return{markerType:"Point",form:{latDegree:"",latMinute:"",latDir:"N",lngDegree:"",lngMinute:"",lngDir:"E",areaType:"Polygon",color:(o=this.Theme.current.value.colors)==null?void 0:o["map-green"],name:""},formRules:{lngDegree:[e=>e!=null&&e!==""||"required",e=>/^\d{1,3}$/.test(e)||"number",e=>parseInt(e)>=0&&parseInt(e)<=180||"0 ~ 180"],lngMinute:[e=>e==null||e===""||/^\d{1,2}(\.\d+)?$/.test(e)||"number",e=>e==null||e===""||parseInt(e)>=0&&parseInt(e)<=59||"0 ~ 59"],latDegree:[e=>e!=null&&e!==""||"required",e=>/^\d{1,2}$/.test(e)||"number",e=>parseInt(e)>=0&&parseInt(e)<=90||"0 ~ 90"],latMinute:[e=>e==null||e===""||/^\d{1,2}(\.\d+)?$/.test(e)||"number",e=>e==null||e===""||parseInt(e)>=0&&parseInt(e)<=59||"0 ~ 59"],color:[e=>e!=null&&e!==""||"required"],name:[e=>e!=null&&e!==""||"required"]},saving:!1,drawSource:"draw-marker-source",drawPointLayer:"draw-marker-point-layer",drawLineLayer:"draw-marker-line-layer",drawFillLayer:"draw-marker-fill-layer",drawTmpSource:"draw-marker-tmp-source",drawTmpLayer:"draw-marker-tmp-layer",drawCoords:[],rectCornerMarkers:[],polygonVertexMarkers:[],circleMarkers:[],drawRadiusSource:"draw-marker-radius-source",drawRadiusLayer:"draw-marker-radius-layer",tipMarker:null,pointMarker:null,pointHighlightMarker:null,editMarkers:[],deleteBtn:null,originalProperties:{}}},watch:{markerType:{handler(){var o;(o=this.editLayer)!=null&&o.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},immediate:!0},"form.areaType"(){var o;(o=this.editLayer)!=null&&o.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},map:{handler(){var o;this.map&&(this.handleBindMap(),(o=this.editLayer)!=null&&o.id&&this.loadEditLayer())},immediate:!0},"form.color":{handler(){this.handleChangePoint(),this.handleUpdateLayerColors()},immediate:!0}},beforeUnmount(){this.handleClearDraw(!0),this.handleUnbindMap()},methods:{handleClose(){this.handleClearDraw(!0),this.handleUnbindMap(),this.$emit("close")},handleBindMap(){var o,e;this.map&&(this.markerType==="Point"?(this.map.on("click",this.handleMapClickPoint),this.map.getCanvas().style.cursor="crosshair"):this.markerType==="Line"&&!((o=this.editLayer)!=null&&o.id)?(this.map.on("click",this.handleMapClickLine),this.map.on("mousemove",this.handleMapMoveLine),this.map.on("dblclick",this.handleMapDblClickLine),this.map.getCanvas().style.cursor="crosshair"):this.markerType==="Area"&&!((e=this.editLayer)!=null&&e.id)&&(this.form.areaType==="Polygon"?(this.map.on("click",this.handleMapClickPolygon),this.map.on("mousemove",this.handleMapMovePolygon),this.map.on("dblclick",this.handleMapDblClickPolygon)):this.form.areaType==="Circle"?(this.map.on("click",this.handleMapClickCircle),this.map.on("mousemove",this.handleMapMoveCircle)):this.form.areaType==="Rect"&&(this.map.on("click",this.handleMapClickRect),this.map.on("mousemove",this.handleMapMoveRect)),this.map.getCanvas().style.cursor="crosshair"))},handleUnbindMap(){this.map&&(this.map.off("click",this.handleMapClickPoint),this.map.off("click",this.handleMapClickLine),this.map.off("mousemove",this.handleMapMoveLine),this.map.off("dblclick",this.handleMapDblClickLine),this.map.off("click",this.handleMapClickPolygon),this.map.off("mousemove",this.handleMapMovePolygon),this.map.off("dblclick",this.handleMapDblClickPolygon),this.map.off("click",this.handleMapClickCircle),this.map.off("mousemove",this.handleMapMoveCircle),this.map.off("click",this.handleMapClickRect),this.map.off("mousemove",this.handleMapMoveRect),this.map.getCanvas().style.cursor="grab")},handleRebindMap(){this.handleUnbindMap(),this.handleBindMap()},loadEditLayer(){var i,l,n,c,s,m;if(!((i=this.editLayer)!=null&&i.extend)||!this.map)return;const o=typeof this.editLayer.extend=="string"?JSON.parse(this.editLayer.extend):this.editLayer.extend;if(!o)return;const a=(o.features||(o.type==="Feature"?[o]:[]))[0];if(!a)return;this.originalProperties=a.properties||{},this.form.name=this.editLayer.name||"",this.form.color=this.editLayer.color||((l=this.originalProperties)==null?void 0:l.color)||((n=this.Theme.current.value.colors)==null?void 0:n["map-green"])||"#4CAF50";const r=(c=a.geometry)==null?void 0:c.type;if(r==="Point"){this.markerType="Point";const[d,g]=a.geometry.coordinates;this.drawCoords=[[d,g]],this.form.latDegree=Number(N.LngLatHelper.lat2pretty(g).degree),this.form.latMinute=Number(N.LngLatHelper.lat2pretty(g).minute),this.form.latDir=N.LngLatHelper.lat2pretty(g).direction,this.form.lngDegree=Number(N.LngLatHelper.lng2pretty(d).degree),this.form.lngMinute=Number(N.LngLatHelper.lng2pretty(d).minute),this.form.lngDir=N.LngLatHelper.lng2pretty(d).direction,this.handleRenderPoint(this.drawCoords,this.form.color),this.setupPointEdit()}else r==="LineString"?(this.markerType="Line",this.$nextTick(()=>{this.handlerRenderEditLine(a),this.setupLineEdit(),this.handleUnbindMap()})):r==="Polygon"&&(this.markerType="Area",this.form.areaType=(m=(s=this.originalProperties)==null?void 0:s.shape)==null?void 0:m.toLowerCase(),this.$nextTick(()=>{this.handlerRenderEditPolygon(o),this.setupPolygonEdit(a),this.handleUnbindMap()}));this.$emit("hideLayer",this.editLayer.id)},setupPointEdit(){var a;if(!this.pointMarker)return;this.pointMarker.setDraggable(!0),this.pointMarker.off("drag",this.handlePointDrag),this.pointMarker.on("drag",this.handlePointDrag),this.pointMarker.off("dragend",this.handlePointDrag),this.pointMarker.on("dragend",this.handlePointDrag),(a=this.pointHighlightMarker)==null||a.remove();const o=document.createElement("div");o.className="idm-gl4-point-center-ring";const e=this.pointMarker.getLngLat();this.pointHighlightMarker=new me.Marker({element:o,anchor:"center",offset:[0,0]}).setLngLat(e).addTo(this.map),this.pointMarker.on("drag",()=>{var r;(r=this.pointHighlightMarker)==null||r.setLngLat(this.pointMarker.getLngLat())})},handlePointDrag(){const{lng:o,lat:e}=this.pointMarker.getLngLat();this.drawCoords=[[o,e]],this.form.latDegree=Number(N.LngLatHelper.lat2pretty(e).degree),this.form.latMinute=Number(N.LngLatHelper.lat2pretty(e).minute),this.form.latDir=N.LngLatHelper.lat2pretty(e).direction,this.form.lngDegree=Number(N.LngLatHelper.lng2pretty(o).degree),this.form.lngMinute=Number(N.LngLatHelper.lng2pretty(o).minute),this.form.lngDir=N.LngLatHelper.lng2pretty(o).direction},clearEditMarkers(){this.editMarkers.forEach(o=>o.remove()),this.editMarkers=[],this._edgeContextMenuHandler&&this.map&&(this.map.off("contextmenu",this._edgeContextMenuHandler),this._edgeContextMenuHandler=null)},handlerRenderEditLine(o){this.drawCoords=o.geometry.coordinates.map(r=>[...r]);const e=T.featureCollection([o,...this.drawCoords.map(r=>T.point(r))]);this.handleSetDrawSource(e);const a=3;this.map.getLayer(this.drawLineLayer)||this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":a}})},setupLineEdit(){this.clearEditMarkers(),this.drawCoords.forEach((e,a)=>{const r=document.createElement("div");r.className="idm-gl4-edit-vertex",r.style.backgroundColor=this.form.color;const i=new me.Marker({element:r,draggable:!0}).setLngLat(e).addTo(this.map);i.on("dragstart",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:l,lat:n}=i.getLngLat();this.handleRenderVertexLabel([l,n],40)}),i.on("drag",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:l,lat:n}=i.getLngLat();this.handleUpdateVertexLabel([l,n]),this.drawCoords[a]=[l,n],this.handlerRenderEditLine(T.lineString(this.drawCoords,{type:"Line",color:this.form.color}))}),i.on("dragend",()=>{this.map.getCanvas().style.cursor="grab";const{lng:l,lat:n}=i.getLngLat();this.drawCoords[a]=[l,n],this.handlerRenderEditLine(T.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.handleClearVertexLabels()}),r.addEventListener("contextmenu",l=>{l.preventDefault(),l.stopPropagation(),this.drawCoords.length>2&&this.showDeleteButton(e,()=>{this.drawCoords.splice(a,1),this.handlerRenderEditLine(T.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()})}),this.editMarkers.push(i)});const o=e=>{e.preventDefault();const{lng:a,lat:r}=e.lngLat,i=T.point([a,r]),l=T.lineString(this.drawCoords),n=T.nearestPointOnLine(l,i);if(n){const c=n.properties.index;this.showDeleteButton([a,r],()=>{this.drawCoords.splice(c+1,0,[a,r]),this.handlerRenderEditLine(T.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()},this.$t("actions.add")||"新增","add")}};this.map.on("contextmenu",o),this._edgeContextMenuHandler=o},showDeleteButton(o,e,a,r="delete"){this.hideDeleteButton();const i=this.map.getContainer(),l=document.createElement("button");l.textContent=a||this.$t("actions.delete"),l.className=r==="add"?"idm-gl4-edit-add-btn":"idm-gl4-edit-delete-btn";const n=this.map.project(o);l.style.left=`${n.x}px`,l.style.top=`${n.y}px`;const c=s=>{s.stopPropagation(),e(),this.hideDeleteButton()};l.addEventListener("click",c),i.appendChild(l),this.deleteBtn=l,this.map.once("click",()=>this.hideDeleteButton())},hideDeleteButton(){this.deleteBtn&&(this.deleteBtn.remove(),this.deleteBtn=null)},handlerRenderEditPolygon(o){this.handleSetDrawSource(o);const e=3;this.map.getLayer(this.drawFillLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-width",e),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":e}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},setupPolygonEdit(o){this.clearEditMarkers();const e=o.geometry.coordinates[0].slice(0,-1);this.drawCoords=e.map(r=>[...r]),this.drawCoords.forEach((r,i)=>{const l=document.createElement("div");l.className="idm-gl4-edit-vertex",l.style.backgroundColor=this.form.color;const n=new me.Marker({element:l,draggable:!0}).setLngLat(r).addTo(this.map);n.on("dragstart",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:c,lat:s}=n.getLngLat();this.handleRenderVertexLabel([c,s])}),n.on("drag",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:c,lat:s}=n.getLngLat();this.handleUpdateVertexLabel([c,s]),this.drawCoords[i]=[c,s],this.handleRenderPolygonFill(this.drawCoords)}),n.on("dragend",()=>{this.map.getCanvas().style.cursor="grab";const{lng:c,lat:s}=n.getLngLat();this.drawCoords[i]=[c,s],this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels()}),l.addEventListener("contextmenu",c=>{c.preventDefault(),c.stopPropagation(),this.drawCoords.length>3&&this.showDeleteButton(r,()=>{this.drawCoords.splice(i,1),this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels(),this.setupPolygonEdit({geometry:{type:"Polygon",coordinates:[[...this.drawCoords,this.drawCoords[0]]]},properties:this.originalProperties})})}),this.editMarkers.push(n)});const a=r=>{r.preventDefault();const{lng:i,lat:l}=r.lngLat,n=T.point([i,l]),c=T.lineString([...this.drawCoords,this.drawCoords[0]]),s=T.nearestPointOnLine(c,n);if(s){const m=s.properties.index,d=m>=this.drawCoords.length-1?this.drawCoords.length-1:m;this.showDeleteButton([i,l],()=>{this.drawCoords.splice(d+1,0,[i,l]),this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels(),this.setupPolygonEdit({geometry:{type:"Polygon",coordinates:[[...this.drawCoords,this.drawCoords[0]]]},properties:this.originalProperties})},this.$t("actions.add")||"新增","add")}};this.map.on("contextmenu",a),this._edgeContextMenuHandler=a},handleMapClickPoint(o){var r;const{lng:e,lat:a}=o.lngLat;this.drawCoords=[[e,a]],this.form.latDegree=Number(N.LngLatHelper.lat2pretty(a).degree),this.form.latMinute=Number(N.LngLatHelper.lat2pretty(a).minute),this.form.latDir=N.LngLatHelper.lat2pretty(a).direction,this.form.lngDegree=Number(N.LngLatHelper.lng2pretty(e).degree),this.form.lngMinute=Number(N.LngLatHelper.lng2pretty(e).minute),this.form.lngDir=N.LngLatHelper.lng2pretty(e).direction,this.handleRenderPoint(this.drawCoords,this.form.color),(r=this.editLayer)!=null&&r.id&&this.setupPointEdit()},handleChangePoint(){var u;const{latDegree:o,latMinute:e,latDir:a,lngDegree:r,lngMinute:i,lngDir:l}=this.form,n=parseFloat(o),c=parseFloat(e),s=parseFloat(r),m=parseFloat(i);if(isNaN(n)||isNaN(s))return;const d=(n+(isNaN(c)?0:c)/60)*(a==="S"?-1:1),g=(s+(isNaN(m)?0:m)/60)*(l==="W"?-1:1);this.drawCoords=[[g,d]],this.handleRenderPoint(this.drawCoords,this.form.color),(u=this.editLayer)!=null&&u.id&&this.setupPointEdit()},handleRenderPoint(o,e){var i;if((i=this.pointMarker)==null||i.remove(),!o||!o.length)return;const[a,r]=o[0];this.pointMarker=new me.Marker({color:e}).setLngLat([a,r]).addTo(this.map)},handleMapClickLine(o){var r;const{lng:e,lat:a}=o.lngLat;this.drawCoords.push([e,a]),this.handleRenderLine(this.drawCoords),(r=this.editLayer)!=null&&r.id&&this.setupLineEdit()},handleMapMoveLine(o){if(!this.drawCoords.length)return;const{lng:e,lat:a}=o.lngLat;this.handleRenderTmpLine(this.drawCoords.at(-1),[e,a])},handleMapDblClickLine(o){o.preventDefault(),this.drawCoords.length>1&&this.drawCoords.pop(),this.handleRenderLine(this.drawCoords),this.handleClearTmp(),this.map.off("click",this.handleMapClickLine),this.map.off("mousemove",this.handleMapMoveLine),this.map.off("dblclick",this.handleMapDblClickLine)},handleRenderLine(o){if(!o||o.length<1)return;const e=[];o==null||o.forEach((i,l)=>{e.push(N.GeoJsonHelper.drawPoint(i==null?void 0:i[1],i==null?void 0:i[0]))}),(o==null?void 0:o.length)>=2&&e.push(N.GeoJsonHelper.drawLine(o));const a=2,r=T.featureCollection(e);this.handleSetDrawSource(r),this.map.getLayer(this.drawLineLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-color",this.form.color),this.map.setPaintProperty(this.drawLineLayer,"line-width",a),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":a}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},handleRenderTmpLine(o,e){const a=N.GeoJsonHelper.drawLine([o,e]),r=T.featureCollection([a]);this.map.getSource(this.drawTmpSource)?this.map.getSource(this.drawTmpSource).setData(r):this.map.addSource(this.drawTmpSource,{type:"geojson",data:r}),this.map.getLayer(this.drawTmpLayer)||this.map.addLayer({id:this.drawTmpLayer,type:"line",source:this.drawTmpSource,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":2,"line-dasharray":[3,2]}});const i={lng:o[0],lat:o[1]},l={lng:e[0],lat:e[1]},n=N.LaneHelper.calculateDistance(i,l,!0,2),c=N.LaneHelper.calculateBearing(i,l,!0,2);let s=0;for(let d=1;d<this.drawCoords.length;d++){const g={lng:this.drawCoords[d-1][0],lat:this.drawCoords[d-1][1]},u={lng:this.drawCoords[d][0],lat:this.drawCoords[d][1]};s+=N.LaneHelper.calculateDistance(g,u,!0,4)}s=N.LngLatHelper.roundPrecision(s+n,1);const m=`
217
+ </svg>`,ge=document.createElement("div");ge.className="idm-tropical-gl4-hourly-marker",ge.innerHTML=`<div class="${E.geometry.coordinates[1]>=0?"center north":"center south"}">${ie}</div>`;const ue=new me.Marker(ge).setLngLat(E.geometry.coordinates).addTo(this.map);this.interpolateMarkers.push(ue)}this.$emit("tropicalCenterPoints",J)}else(S=this.map)!=null&&S.getSource(this.interpolateSource)&&((W=this.map)==null||W.getSource(this.interpolateSource).setData(this.empty))},handleClick(o){var i,l,n,c,s,m,d,g,u,y,p;const e=o.features[0],a=(l=(i=this.tropicals)==null?void 0:i.data)==null?void 0:l.features.filter(h=>{var f;return h.geometry.type==="LineString"&&h.properties.type==="forecast"&&h.properties.name===((f=e==null?void 0:e.properties)==null?void 0:f.name)}),r=(c=(n=this.tropicals)==null?void 0:n.data)==null?void 0:c.features.filter(h=>{var f;return h.geometry.type==="LineString"&&h.properties.type==="history"&&h.properties.name===((f=e==null?void 0:e.properties)==null?void 0:f.name)});this.activeTropicals={name:((s=e==null?void 0:e.properties)==null?void 0:s.name)||"-",nameCn:((m=e==null?void 0:e.properties)==null?void 0:m.nameCn)||((d=e==null?void 0:e.properties)==null?void 0:d.name)||"-",Name:((g=e==null?void 0:e.properties)==null?void 0:g.Name)||"-",forecasts:a.map(h=>h.properties),history:(u=r[0])==null?void 0:u.properties,showCircle:(p=(y=a[0])==null?void 0:y.properties)==null?void 0:p.showCircle},this.showTropicalsInfo=!0,this.simple||this.drawTropicalsInfoMaker([o.lngLat.lng,o.lngLat.lat])},drawTropicalsInfoMaker(o){this.$nextTick(()=>{const e=document.getElementById("idm-tropical-gl4-info");this.activeTropicalsMarker?this.activeTropicalsMarker.setLngLat(o).setOffset([220,0]):this.activeTropicalsMarker=new me.Marker(e).setLngLat(o).setOffset([220,0]).addTo(this.map)})},handleCloseInfoMarker(){this.showTropicalsInfo=!1,this.$nextTick(()=>{var o;(o=this.activeTropicalsMarker)==null||o.remove(),this.activeTropicalsMarker=void 0})},handleForecastToggle(o){var r,i,l,n,c,s;o.disabled=!o.disabled;const e=`${o.name}-${o.model}`,a=(i=(r=this.map)==null?void 0:r.getSource(this.source)._data)==null?void 0:i.features;a.forEach(m=>{m.properties.category===e&&(m.properties.disabled=o.disabled)}),this.interpolateData.forEach(m=>{m.properties.category===e&&(m.properties.disabled=o.disabled)}),(n=(l=this.map)==null?void 0:l.getSource(this.source))==null||n.setData(T.featureCollection(a)),(s=(c=this.map)==null?void 0:c.getSource(this.clusterSource))==null||s.setData(T.featureCollection(a)),this.handleDateChange()},handleStrikeProbability(o){this.$emit("tropicalProbability",o)},handleToggleCircles(o){var e,a;o.showCircle=!o.showCircle,(a=(e=this.tropicals.data)==null?void 0:e.features)==null||a.forEach(r=>{r.properties.name===o.name&&(r.properties.showCircle=o.showCircle)}),this.handleRender()},handleComputePolygons(o){const e=[];for(const a of o){const r=a.properties.wind,i={ne:r.r7ne>=0?r.r7ne:void 0,se:r.r7se>=0?r.r7se:void 0,sw:r.r7sw>=0?r.r7sw:void 0,nw:r.r7nw>=0?r.r7nw:void 0},l=this.handleComputeArc(a.geometry.coordinates,i,{...a.properties,level:7});e.push(l);const n={ne:r.r10ne>=0?r.r10ne:void 0,se:r.r10se>=0?r.r10se:void 0,sw:r.r10sw>=0?r.r10sw:void 0,nw:r.r10nw>=0?r.r10nw:void 0},c=this.handleComputeArc(a.geometry.coordinates,n,{...a.properties,level:10});e.push(c)}return e},handleComputeArc(o,e,a){var l;const r=[];for(const n in e){const c=e[n]??0;let s;switch(n){case"ne":s=T.lineArc(o,c,0,90,{steps:c>0?32:1,units:"nauticalmiles"});break;case"se":s=T.lineArc(o,c,90,180,{steps:c>0?32:1,units:"nauticalmiles"});break;case"sw":s=T.lineArc(o,c,180,270,{steps:c>0?32:1,units:"nauticalmiles"});break;case"nw":s=T.lineArc(o,c,270,360,{steps:c>0?32:1,units:"nauticalmiles"});break}r.push(...(l=s==null?void 0:s.geometry)==null?void 0:l.coordinates)}const i=T.lineString(r);return T.lineToPolygon(i,{properties:a})},handleNotification(o){this.$emit("tropicalNotification",o)},handleHover(o){var i,l,n,c,s;this.map.getCanvas().style.cursor="pointer";const a=this.map.queryRenderedFeatures(o.point,{layers:[this.pointCircleLayer,this.pointCircleLayer+"-border",this.historyPointCircleLayer,this.historyPointCircleLayer+"-border",this.historyPointCircleLayer+"-inner"]})[0];this.hoverPoint=a==null?void 0:a.properties;const r=(l=(i=this.tropicals)==null?void 0:i.data)==null?void 0:l.features.filter(m=>{var d;return m.geometry.type==="LineString"&&m.properties.type==="forecast"&&m.properties.name===((d=a==null?void 0:a.properties)==null?void 0:d.name)});this.hoverPoint&&(this.hoverPoint.lng=a.geometry.coordinates[0],this.hoverPoint.lat=a.geometry.coordinates[1],this.hoverPoint.update=(c=(n=r==null?void 0:r[0])==null?void 0:n.properties)==null?void 0:c.date,(s=this.hoverMarker)==null||s.remove(),this.showHoverPoint=!0,this.$nextTick(()=>{const m=document.getElementById("tropicalHoverMarkerInfo").cloneNode(!0);this.hoverMarker=new me.Marker(m).setLngLat(a.geometry.coordinates).setOffset([160,0]).addTo(this.map)}))},handleLeave(){var o;this.map.getCanvas().style.cursor="grab",this.showHoverPoint=!1,(o=this.hoverMarker)==null||o.remove(),this.hoverMarker=void 0}}},Fm={class:"idm-tropical-gl4"},Gm={class:"pb-1"},jm={class:"text-h5 font-weight-600"},Wm={key:0,class:"text-h5 font-weight-600"},Zm={class:"text-body-1"},Xm={class:"text-label"},Hm={class:"d-flex justify-space-between align-center"},Om={class:"w-60"},Ym={class:"text-label pr-1"},Um={class:"flex-1-1-0"},Jm={class:"text-label pr-1"},Km={class:"py-2 d-flex justify-space-between align-center"},Qm={class:"w-60"},qm={class:"text-label pr-1"},$m={class:"flex-1-1-0"},ed={class:"text-label pr-1"},td={class:"d-flex align-center flex-1-1-100 justify-start mt-n1"},od={class:"text-label pr-1",style:{width:"70px"}},ad={class:"model-box d-flex justify-end align-center flex-wrap ga-1 pa-1"},id={class:"more"},rd={key:0,class:"w-100 d-flex justify-space-between align-center px-2"},ld={class:"pa-1"},nd={class:"legend d-flex justify-start align-center py-2"},sd={class:"label"},cd={class:"legend d-flex justify-start align-center py-2"},md={class:"label"},dd={class:"legend d-flex justify-start align-center py-2"},hd={class:"label"},pd={class:"pa-1"},gd={class:"legend d-flex justify-start align-center py-2"},ud={class:"label"},fd={class:"legend d-flex justify-start align-center py-2"},yd={class:"label"},bd={class:"legend d-flex justify-start align-center py-2"},wd={class:"label"},xd={class:"pa-1"},kd={class:"w-100 legend d-flex justify-start align-center py-2 ga-2"},Ad={class:"label"},Ld={class:"label"},Cd={class:"w-100 legend d-flex justify-start align-center py-2"},vd={class:"label"},zd={class:"w-100 legend d-flex justify-start align-center py-2"},_d={class:"label"},Sd={key:1,class:"my-3 w-100",style:{height:"80px"}},Nd={class:"legend d-flex justify-start align-center"},Md={class:"label"},Pd={class:"legend d-flex justify-start align-center"},Vd={class:"label"},Td={class:"legend d-flex justify-start align-center"},Ed={class:"label"},Dd={class:"legend d-flex justify-start align-center"},Rd={class:"label"},Bd={class:"legend d-flex justify-start align-center"},Id={class:"label"},Fd={class:"legend d-flex justify-start align-center"},Gd={class:"label"},jd={class:"legend d-flex justify-start align-center"},Wd={class:"label"},Zd={class:"legend d-flex justify-start align-center"},Xd={class:"label"},Hd={class:"legend d-flex justify-start align-center"},Od={class:"label"},Yd={class:"legend d-flex justify-start align-center"},Ud={class:"label"},Jd={class:"d-flex justify-star align-center"},Kd={class:"font-weight-600 mr-1"},Qd={class:""},qd={class:"d-flex flex-column justify-center align-start ga-2"},$d={key:0,class:"d-flex justify-start align-center"},eh={class:"text-label pr-1"},th={key:1,class:"d-flex justify-start align-center"},oh={class:"text-label pr-1"},ah={key:2,class:"d-flex justify-start align-center"},ih={class:"text-label pr-1"},rh={key:3,class:"d-flex justify-start align-center"},lh={class:"text-label pr-1"},nh={key:4,class:"d-flex justify-start align-center"},sh={class:"text-label pr-1"},ch={key:5,class:"d-flex justify-start align-center"},mh={class:"text-label pr-1"},dh={class:"d-flex justify-start align-center"},hh={class:"text-label pr-1"},ph={key:6,class:"d-flex justify-start align-center"},gh={class:"text-label pr-1"},uh={key:7,class:"d-flex justify-start align-center"},fh={class:"text-label pr-1"},yh={class:"d-flex justify-start align-center"},bh={class:"text-label pr-1"};function wh(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardText"),m=t.resolveComponent("VDivider"),d=t.resolveComponent("VCardActions"),g=t.resolveComponent("VCard"),u=t.resolveComponent("VCardTitle");return t.openBlock(),t.createElementBlock("div",Fm,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+86+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("tropical.tropicals"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:y})=>[t.createVNode(n,t.mergeProps(y,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[2]||(e[2]=[t.createElementVNode("i",{class:"iconfont icon-Tropical text-h4"},null,-1)])),_:2,__:[2]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),i.showTropicalsInfo&&!o.$attrs.hideTropicalsLegend?(t.openBlock(),t.createElementBlock("div",{key:0,id:"idm-tropical-gl4-info",ref:"tropicalsInfo",class:t.normalizeClass(["idm-tropical-gl4-info",a.simple?"page":"dialog"])},[t.createVNode(g,{class:t.normalizeClass(["w-100",a.simple?"rounded-t-4 bg-none":""]),elevation:a.simple?0:16},{default:t.withCtx(()=>[t.createVNode(s,null,{default:t.withCtx(()=>{var y,p,h,f,w,b,A,x,C,k,_,z;return[t.createElementVNode("div",Gm,[t.createElementVNode("span",jm,t.toDisplayString(a.locale==="en"?(y=i.activeTropicals)==null?void 0:y.Name:((p=i.activeTropicals)==null?void 0:p.nameCn)||((h=i.activeTropicals)==null?void 0:h.Name)||"-"),1),(w=(f=i.activeTropicals)==null?void 0:f.history)!=null&&w.levelI18n?(t.openBlock(),t.createElementBlock("span",Wm," , "+t.toDisplayString(o.$t("tropical."+((A=(b=i.activeTropicals)==null?void 0:b.history)==null?void 0:A.levelI18n))),1)):t.createCommentVNode("",!0)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"close",onClick:t.withModifiers(l.handleCloseInfoMarker,["stop"])},{default:t.withCtx(()=>e[3]||(e[3]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[3]},8,["onClick"]),t.createElementVNode("div",Zm,[t.createElementVNode("span",Xm,t.toDisplayString(o.$t("actions.lastUpdate"))+": ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTime(((C=(x=i.activeTropicals)==null?void 0:x.history)==null?void 0:C.updated)||((z=(_=(k=i.activeTropicals)==null?void 0:k.forecasts)==null?void 0:_.filter(M=>!M.disabled)[0])==null?void 0:z.date),a.timeZone)),1)])]}),_:1}),t.createVNode(m),t.createVNode(s,{class:"text-body-1 py-3"},{default:t.withCtx(()=>{var y,p,h,f,w,b,A,x,C;return[t.createElementVNode("div",Hm,[t.createElementVNode("div",Om,[t.createElementVNode("label",Ym,t.toDisplayString(o.$t("weather.windSpeed"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((p=(y=i.activeTropicals)==null?void 0:y.history)==null?void 0:p.kts)||"-")+" kts",1),t.createElementVNode("span",null,", BF "+t.toDisplayString(l.computeBF(((f=(h=i.activeTropicals)==null?void 0:h.history)==null?void 0:f.kts)||"-")),1)]),t.createElementVNode("div",Um,[t.createElementVNode("label",Jm,t.toDisplayString(o.$t("weather.pressure"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((b=(w=i.activeTropicals)==null?void 0:w.history)==null?void 0:b.pressure)||"-")+" hPa",1)])]),t.createElementVNode("div",Km,[t.createElementVNode("div",Qm,[t.createElementVNode("label",qm,t.toDisplayString(o.$t("tropical.moveSpeed"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((A=l.computeMovement(i.activeTropicals))==null?void 0:A.kts)||"-")+" kts",1)]),t.createElementVNode("div",$m,[t.createElementVNode("label",ed,t.toDisplayString(o.$t("tropical.moveDir"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((x=l.computeMovement(i.activeTropicals))==null?void 0:x.deg)||"-")+"°",1)])]),t.createElementVNode("div",td,[t.createElementVNode("label",od,t.toDisplayString(o.$t("tropical.models"))+" : ",1),t.createElementVNode("div",ad,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList((C=i.activeTropicals)==null?void 0:C.forecasts,(k,_)=>(t.openBlock(),t.createBlock(n,{key:_,density:"compact",variant:k.disabled?"text":"flat",color:k.disabled?"":"primary","min-width":30,class:t.normalizeClass(["model text-none text-body-1 px-1",k.disabled?"btn-border-1 btn-bg-1":""]),onClick:t.withModifiers(z=>l.handleForecastToggle(k),["stop"])},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(k.model),1)]),_:2},1032,["variant","color","class","onClick"]))),128))])])]}),_:1}),t.createVNode(m),a.simple?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(d,{key:0,class:"d-flex justify-space-between"},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact","prepend-icon":"",variant:"text",color:i.showLegend?"primary":"",class:"text-none text-body-1",onClick:e[0]||(e[0]=t.withModifiers(y=>i.showLegend=!i.showLegend,["stop"]))},{prepend:t.withCtx(()=>e[4]||(e[4]=[t.createElementVNode("i",{class:"iconfont icon-Legend text-h4"},null,-1)])),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(o.$t("weather.legend")),1)]),_:1},8,["color"]),t.createElementVNode("div",id,[t.createVNode(n,{variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:e[1]||(e[1]=t.withModifiers(y=>l.handleStrikeProbability(i.activeTropicals),["stop"]))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.viewReport")),1)]),_:1})])]),_:1}))]),_:1},8,["class","elevation"]),a.simple?(t.openBlock(),t.createElementBlock("div",rd,[t.createElementVNode("div",ld,[t.createElementVNode("div",nd,[e[5]||(e[5]=t.createElementVNode("div",{class:"icon td"},null,-1)),t.createElementVNode("div",sd,t.toDisplayString(o.$t("tropical.td")),1)]),t.createElementVNode("div",cd,[e[6]||(e[6]=t.createElementVNode("div",{class:"icon sts"},null,-1)),t.createElementVNode("div",md,t.toDisplayString(o.$t("tropical.sts")),1)]),t.createElementVNode("div",dd,[e[7]||(e[7]=t.createElementVNode("div",{class:"icon sty"},null,-1)),t.createElementVNode("div",hd,t.toDisplayString(o.$t("tropical.sty")),1)])]),t.createElementVNode("div",pd,[t.createElementVNode("div",gd,[e[8]||(e[8]=t.createElementVNode("div",{class:"icon ts"},null,-1)),t.createElementVNode("div",ud,t.toDisplayString(o.$t("tropical.ts")),1)]),t.createElementVNode("div",fd,[e[9]||(e[9]=t.createElementVNode("div",{class:"icon ty"},null,-1)),t.createElementVNode("div",yd,t.toDisplayString(o.$t("tropical.ty")),1)]),t.createElementVNode("div",bd,[e[10]||(e[10]=t.createElementVNode("div",{class:"icon supper-ty"},null,-1)),t.createElementVNode("div",wd,t.toDisplayString(o.$t("tropical.superTy")),1)])]),t.createElementVNode("div",xd,[t.createElementVNode("div",kd,[e[11]||(e[11]=t.createElementVNode("div",{class:"icon history"},null,-1)),t.createElementVNode("div",Ad,t.toDisplayString(o.$t("tropical.history")),1),e[12]||(e[12]=t.createElementVNode("div",{class:"icon forecast"},null,-1)),t.createElementVNode("div",Ld,t.toDisplayString(o.$t("tropical.forecast")),1)]),t.createElementVNode("div",Cd,[e[13]||(e[13]=t.createElementVNode("div",{class:"icon r7"},null,-1)),t.createElementVNode("div",vd,"35kts "+t.toDisplayString(o.$t("tropical.radii")),1)]),t.createElementVNode("div",zd,[e[14]||(e[14]=t.createElementVNode("div",{class:"icon r10"},null,-1)),t.createElementVNode("div",_d,"50kts "+t.toDisplayString(o.$t("tropical.radii")),1)])])])):(t.openBlock(),t.createElementBlock("div",Sd,[t.withDirectives(t.createVNode(g,{elevation:"16"},{default:t.withCtx(()=>[t.createVNode(s,null,{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["pa-1 d-flex justify-space-between align-center flex-wrap",a.locale==="zhHans"?" ga-2":" ga-3"])},[t.createElementVNode("div",Nd,[e[15]||(e[15]=t.createElementVNode("div",{class:"icon td"},null,-1)),t.createElementVNode("div",Md,t.toDisplayString(o.$t("tropical.td")),1)]),t.createElementVNode("div",Pd,[e[16]||(e[16]=t.createElementVNode("div",{class:"icon ts"},null,-1)),t.createElementVNode("div",Vd,t.toDisplayString(o.$t("tropical.ts")),1)]),t.createElementVNode("div",Td,[e[17]||(e[17]=t.createElementVNode("div",{class:"icon sts"},null,-1)),t.createElementVNode("div",Ed,t.toDisplayString(o.$t("tropical.sts")),1)]),t.createElementVNode("div",Dd,[e[18]||(e[18]=t.createElementVNode("div",{class:"icon ty"},null,-1)),t.createElementVNode("div",Rd,t.toDisplayString(o.$t("tropical.ty")),1)]),t.createElementVNode("div",Bd,[e[19]||(e[19]=t.createElementVNode("div",{class:"icon sty"},null,-1)),t.createElementVNode("div",Id,t.toDisplayString(o.$t("tropical.sty")),1)]),t.createElementVNode("div",Fd,[e[20]||(e[20]=t.createElementVNode("div",{class:"icon supper-ty"},null,-1)),t.createElementVNode("div",Gd,t.toDisplayString(o.$t("tropical.superTy")),1)]),t.createElementVNode("div",jd,[e[21]||(e[21]=t.createElementVNode("div",{class:"icon history"},null,-1)),t.createElementVNode("div",Wd,t.toDisplayString(o.$t("tropical.history")),1)]),t.createElementVNode("div",Zd,[e[22]||(e[22]=t.createElementVNode("div",{class:"icon forecast"},null,-1)),t.createElementVNode("div",Xd,t.toDisplayString(o.$t("tropical.forecast")),1)]),t.createElementVNode("div",Hd,[e[23]||(e[23]=t.createElementVNode("div",{class:"icon r7"},null,-1)),t.createElementVNode("div",Od,"35kts "+t.toDisplayString(o.$t("tropical.radii")),1)]),t.createElementVNode("div",Yd,[e[24]||(e[24]=t.createElementVNode("div",{class:"icon r10"},null,-1)),t.createElementVNode("div",Ud,"50kts "+t.toDisplayString(o.$t("tropical.radii")),1)])],2),[[t.vShow,i.showLegend]])]),_:1})]),_:1},512),[[t.vShow,i.showLegend]])]))],2)):t.createCommentVNode("",!0),t.withDirectives(t.createVNode(g,{id:"tropicalHoverMarkerInfo",elevation:"16","max-width":"290"},{default:t.withCtx(()=>[t.createVNode(u,null,{default:t.withCtx(()=>{var y,p,h,f;return[t.createElementVNode("div",Jd,[t.createElementVNode("span",Kd,t.toDisplayString(a.locale==="en"?(y=i.hoverPoint)==null?void 0:y.Name:((p=i.hoverPoint)==null?void 0:p.nameCn)||((h=i.hoverPoint)==null?void 0:h.Name)),1),t.createElementVNode("span",Qd," ["+t.toDisplayString(o.$t("tropical."+((f=i.hoverPoint)==null?void 0:f.levelI18n)))+"]",1)])]}),_:1}),t.createVNode(m),t.createVNode(s,{class:"text-body-1"},{default:t.withCtx(()=>{var y,p,h,f,w,b,A,x,C,k,_,z,M,V,P,Y,U,K,de,ne;return[t.createElementVNode("div",qd,[((y=i.hoverPoint)==null?void 0:y.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",$d,[t.createElementVNode("label",eh,t.toDisplayString(o.$t("tropical.updated"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTzTime((p=i.hoverPoint)==null?void 0:p.update,a.timeZone)),1)])):t.createCommentVNode("",!0),((h=i.hoverPoint)==null?void 0:h.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",th,[t.createElementVNode("label",oh,t.toDisplayString(o.$t("tropical.forecast"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTzTime((f=i.hoverPoint)==null?void 0:f.date,a.timeZone)),1)])):t.createCommentVNode("",!0),((w=i.hoverPoint)==null?void 0:w.type)==="history"?(t.openBlock(),t.createElementBlock("div",ah,[t.createElementVNode("label",ih,t.toDisplayString(o.$t("tropical.forecast"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTzTime((b=i.hoverPoint)==null?void 0:b.date,a.timeZone)),1)])):t.createCommentVNode("",!0),((A=i.hoverPoint)==null?void 0:A.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",rh,[t.createElementVNode("label",lh,t.toDisplayString(o.$t("tropical.model"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((x=i.hoverPoint)==null?void 0:x.model)??"-"),1)])):t.createCommentVNode("",!0),((C=i.hoverPoint)==null?void 0:C.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",nh,[t.createElementVNode("label",sh,t.toDisplayString(o.$t("weather.wind"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((_=JSON.parse(((k=i.hoverPoint)==null?void 0:k.wind)||"{}"))==null?void 0:_.kts)??"-")+" kts",1)])):t.createCommentVNode("",!0),((z=i.hoverPoint)==null?void 0:z.type)==="history"?(t.openBlock(),t.createElementBlock("div",ch,[t.createElementVNode("label",mh,t.toDisplayString(o.$t("weather.wind"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((M=i.hoverPoint)==null?void 0:M.kts)??"-")+" kts",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",dh,[t.createElementVNode("label",hh,t.toDisplayString(o.$t("weather.pressure"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((V=i.hoverPoint)==null?void 0:V.pressure)??"-")+" hPa",1)]),((P=i.hoverPoint)==null?void 0:P.type)==="history"?(t.openBlock(),t.createElementBlock("div",ph,[t.createElementVNode("label",gh,t.toDisplayString(o.$t("tropical.moveSpeed"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((U=JSON.parse(((Y=i.hoverPoint)==null?void 0:Y.movement)||"{}"))==null?void 0:U.kts)??"-")+" kts",1)])):t.createCommentVNode("",!0),((K=i.hoverPoint)==null?void 0:K.type)==="history"?(t.openBlock(),t.createElementBlock("div",uh,[t.createElementVNode("label",fh,t.toDisplayString(o.$t("tropical.moveDir"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((ne=JSON.parse(((de=i.hoverPoint)==null?void 0:de.movement)||"{}"))==null?void 0:ne.deg)??"-")+" °",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",yh,[t.createElementVNode("label",bh,t.toDisplayString(o.$t("tropical.position"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computePosition(i.hoverPoint)),1)])])]}),_:1})]),_:1},512),[[t.vShow,i.showHoverPoint]])])}const Wo=Q(Im,[["render",wh]]),D1="",xh={name:"DateTimePicker",props:{width:{type:Number,default:null},height:{type:Number,default:30},position:{type:String,default:"top"},bgClass:{type:String,default:""},locale:{type:String,default:"en"},style:{type:Object,default:{}},intervalHour:{type:Number,default:3},timeZone:{type:Number},dateTime:{type:String},dayAbout:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1}},emits:["dateTime","currentTimestamp","currentRealTime","minTimestamp","maxTimestamp"],data(){return{showDatePicker:!1,minDate:void 0,maxDate:void 0,minTimestamp:void 0,maxTimestamp:void 0,currentDate:void 0,currentTime:void 0,currentTimestamp:void 0,currentDateTimeZ:void 0,currentDateTime:void 0,currentRealTime:void 0,timer:null}},computed:{getStyle(){const o=this.width||220;return this.position==="top"?{bottom:"40px",left:`-${(420-o)/2}px`}:this.position==="bottom"?{top:"40px",left:`-${(420-o)/2}px`}:this.position==="left"?{bottom:"-140px",left:"-428px"}:this.position==="right"?{bottom:"-140px",right:"-428px"}:{bottom:"40px",left:`-${(420-o)/2}px`}},hourOptions(){const o=[];for(let e=0;e<24;e++)o.push(e<10?`0${e}:00`:`${e}:00`);return o.filter((e,a)=>(a-this.timeZone)%this.intervalHour===0)},timeZoneNames(){return v.tz.names()},timeZoneName(){var o;return(o=this.timeZoneNames.filter(e=>v.tz(v(),e).utcOffset()===this.timeZone*60))==null?void 0:o[0]},utcTimeZoneName(){return"Africa/Abidjan"},localTimeZoneName(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"Asia/Shanghai"}},watch:{timeZone:{handler(o,e){o!==e&&(this.handleResetDateTime(this.dateTime),this.handleResetMinMax())}},dateTime:{handler(o,e){o&&this.handleResetDateTime(this.dateTime)},immediate:!0},currentTimestamp:{handler(){this.currentDateTimeZ=v(this.currentTimestamp).utc().format("yyyy-MM-DD HH:00[Z]"),this.$emit("dateTime",this.currentDateTimeZ),this.$emit("currentTimestamp",this.currentTimestamp),this.currentDateTime=`${v.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`},immediate:!0},currentRealTime:{handler(o,e){o!==e&&this.$emit("currentRealTime",this.currentRealTime)}}},mounted(){this.timer=setInterval(()=>{this.currentRealTime=`${v.tz(v().unix()*1e3,this.timeZoneName).clone().format("HH:mm")}`},100),document.addEventListener("click",this.handleClickOutside)},unmounted(){clearInterval(this.timer),this.handleCancelDate(),document.removeEventListener("click",this.handleClickOutside)},methods:{handleReset(){this.handleResetDateTime(),this.handleResetMinMax()},handleResetDateTime(o){var i;const e=v(o).utc().date(),a=Math.ceil(v(o).utc().hour()/this.intervalHour)*this.intervalHour;this.currentTimestamp=((i=v(o))==null?void 0:i.utc().set({date:e,hour:a,minute:0,second:0,millisecond:0}).unix())*1e3;const r=v.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=r.clone().format("YYYY-MM-DD"),this.currentTime=r.clone().format("HH:00"),this.currentDateTime=`${v.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`,this.currentRealTime=`${v.tz(v().unix()*1e3,this.timeZoneName).clone().format("HH:mm")}`},handleResetMinMax(){var i,l,n,c,s;if(this.dayAbout.h==null||this.dayAbout.f==null)return;const o=v().utc().date(),e=Math.ceil(v().utc().hour()/this.intervalHour)*this.intervalHour,a=((i=v())==null?void 0:i.utc().set({date:o,hour:e,minute:0,second:0,millisecond:0}).unix())*1e3,r=v.tz(a,this.timeZoneName).clone();this.minDate=r.clone().add(this.dayAbout.h,"day").format("yyyy-MM-DD"),this.maxDate=r.clone().add(this.dayAbout.f,"day").format("yyyy-MM-DD"),this.minTimestamp=((n=(l=v())==null?void 0:l.utc())==null?void 0:n.set({date:o+this.dayAbout.h,hour:0,minute:0,second:0,millisecond:0}).unix())*1e3,this.maxTimestamp=((s=(c=v())==null?void 0:c.utc())==null?void 0:s.set({date:o+this.dayAbout.f,hour:0,minute:0,second:0,millisecond:0}).unix())*1e3,this.$emit("minTimestamp",this.minTimestamp),this.$emit("maxTimestamp",this.maxTimestamp)},handleOpenDatePicker(){this.disabled||(this.showDatePicker=!this.showDatePicker)},handleUpdateMonth(o){const e=o||v.tz(this.currentTimestamp,this.timeZoneName).clone().month(),a=this.locale==="en"?v.tz(this.currentTimestamp,this.timeZoneName).set({month:e}).clone().format("MMM"):v.tz(this.currentTimestamp,this.timeZoneName).set({month:e}).clone().format("M月");this.$nextTick(()=>{const r=document.querySelector(".v-date-picker-controls__month-btn");r.innerText=a})},handleConfirmDate(){const o=v(this.currentDate).format("yyyy-MM-DD"),e=this.currentTime,a=`${o} ${e}`,r=v.tz(a,"YYYY-MM-DD HH:00",this.timeZoneName).clone().tz(this.localTimeZoneName);this.currentTimestamp=r.unix()*1e3,this.showDatePicker=!1},handleCancelDate(){this.showDatePicker=!1;const o=v.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=o.clone().format("YYYY-MM-DD"),this.currentTime=o.clone().format("HH:00")},handleClickOutside(o){const e=this.$refs.idmGl4Timepicker;e&&!e.contains(o.target)&&(this.showDatePicker=!1)}}},kh={ref:"idmGl4Timepicker",class:"idm-gl4-time-picker"},Ah={class:"pa-0",style:{width:"320px"}},Lh={class:"h-100 pa-0 d-flex flex-column justify-start align-center",style:{width:"100px"}},Ch={class:"d-flex justify-center align-center text-body-2",style:{height:"44px"}};function vh(o,e,a,r,i,l){const n=t.resolveComponent("VDatePicker"),c=t.resolveComponent("VDivider"),s=t.resolveComponent("VListItemTitle"),m=t.resolveComponent("VListItem"),d=t.resolveComponent("VList"),g=t.resolveComponent("VCardText"),u=t.resolveComponent("VBtn"),y=t.resolveComponent("VCardActions"),p=t.resolveComponent("VCard");return t.openBlock(),t.createElementBlock("div",kh,[t.createElementVNode("div",{style:t.normalizeStyle({height:a.height+"px",width:a.width?a.width+"px":"auto"}),class:t.normalizeClass([[a.bgClass,{"cursor-pointer":!a.disabled}],"rounded text-body-1 btn-border-1 btn-bg-1 d-flex align-center justify-center px-2"]),onClick:e[0]||(e[0]=(...h)=>l.handleOpenDatePicker&&l.handleOpenDatePicker(...h))},t.toDisplayString(i.currentDateTime)+" | UTC "+t.toDisplayString(a.timeZone<0?a.timeZone:"+"+a.timeZone),7),i.showDatePicker?(t.openBlock(),t.createBlock(p,{key:0,class:"card-box d-flex flex-column border elevation-12",style:t.normalizeStyle(l.getStyle)},{default:t.withCtx(()=>[t.createVNode(g,{class:"w-100 flex-1-1-0 d-flex pa-0 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",Ah,[t.createVNode(n,{modelValue:i.currentDate,"onUpdate:modelValue":e[1]||(e[1]=h=>i.currentDate=h),min:i.minDate,max:i.maxDate,"weekday-format":"narrow",color:"primary",density:"compact",class:"w-100","hide-header":""},null,8,["modelValue","min","max"])]),t.createVNode(c,{class:"h-100",vertical:""}),t.createElementVNode("div",Lh,[t.createElementVNode("div",Ch,t.toDisplayString(o.$t("time.time")),1),t.createVNode(d,{class:"pa-0 flex-1-1-0 scroll"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.hourOptions,(h,f)=>(t.openBlock(),t.createBlock(m,{key:f,value:h,color:"primary",active:i.currentTime===h,rounded:"",height:"26","min-height":"26",class:"rounded-xl",variant:i.currentTime===h?"flat":"text"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-body-2 font-weight-600 text-center",onClick:w=>i.currentTime=h},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(h),1)]),_:2},1032,["onClick"])]),_:2},1032,["value","active","variant"]))),128))]),_:1})])]),_:1}),t.createVNode(c),t.createVNode(y,{class:"w-100 d-flex justify-end align-center px-4 ga-4",style:{height:"50px"}},{default:t.withCtx(()=>[t.createVNode(u,{size:"small",variant:"tonal",class:"text-none text-body-1 px-4",onClick:l.handleCancelDate},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.cancel")),1)]),_:1},8,["onClick"]),t.createVNode(u,{size:"small",variant:"flat",color:"primary",class:"text-none text-body-1 px-4",onClick:l.handleConfirmDate},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.confirm")),1)]),_:1},8,["onClick"])]),_:1})]),_:1},8,["style"])):t.createCommentVNode("",!0)],512)}const to=Q(xh,[["render",vh]]),R1="",zh={name:"IdmPoint",components:{DateTimePicker:to},props:{simple:{type:Boolean,default:!1},isLogin:{type:Boolean,default:!1},token:{type:String},defaultMeteoToken:{type:String},theme:{type:String,default:"zh"},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}},gateway:{type:String},timeZone:{type:Number},forecastModel:{type:String},realTime:{type:String},followList:{type:Array,default:()=>[]}},emits:["meteoMore","follow","cancelFollow","login"],data(){return{right:10,toggle:!1,showForm:!1,showMeteo:!1,loading:!1,form:{lng:void 0,lngDegree:void 0,lngMinute:void 0,lngDirection:"E",lat:void 0,latDegree:void 0,latMinute:void 0,latDirection:"N",dateTime:void 0,forecastModel:""},formRules:{lngDegree:[o=>o!=null&&o!==""||"required",o=>/^\d{1,3}$/.test(o)||"number",o=>parseInt(o)>=0&&parseInt(o)<=180||"0 ~ 180"],lngMinute:[o=>o===void 0||o===null&&o===""||/^\d{1,2}(\.\d+)?$/.test(o)||"number",o=>o===void 0||o===null&&o===""||parseInt(o)>=0&&parseInt(o)<=59||"0 ~ 59"],latDegree:[o=>o!=null&&o!==""||"required",o=>/^\d{1,2}$/.test(o)||"number",o=>parseInt(o)>=0&&parseInt(o)<=90||"0 ~ 90"],latMinute:[o=>o===void 0||o===null&&o===""||/^\d{1,2}(\.\d+)?$/.test(o)||"number",o=>o===void 0||o===null&&o===""||parseInt(o)>=0&&parseInt(o)<=59||"0 ~ 59"]},meteoData:void 0,currentHourData:{},positionOffset:void 0,positionGmt:void 0,positionMarker:void 0,meteoInfoMarker:void 0}},computed:{timeZoneNames(){return v.tz.names()},timeZoneName(){var o;return(o=this.timeZoneNames.filter(e=>v.tz(v(),e).utcOffset()===this.timeZone*60))==null?void 0:o[0]},computedTzTime(){return o=>v.tz(v(o),this.timeZoneName).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(this.timeZone>=0?"+":"")+this.timeZone+")"},computedLocalTime(){return o=>{var r,i,l;const e=Number((r=this.positionOffset)==null?void 0:r.slice(1,3))*(((i=this.positionOffset)==null?void 0:i.slice(0,1))==="+"?1:-1),a=(l=this.timeZoneNames.filter(n=>v.tz(v(),n).utcOffset()===e*60))==null?void 0:l[0];return o?v.tz(v(o),a).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(e>=0?"+":"")+e+")":"-"}},computePosition(){return function(o){return!o||o.lng===null||o.lng===void 0||isNaN(o.lng)||o.lat===null||o.lat===void 0||isNaN(o.lat)?"-":N.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty+" / "+N.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty}},computeRoundPrecision(){return function(o,e=4){return o==null||isNaN(o)||isNaN(e)?"-":N.LngLatHelper.roundPrecision(o,e)}}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},toggle:{handler(){this.toggle?this.showForm=!0:(this.showForm=!1,this.showMeteo=!1),this.map&&this.handleBind()},immediate:!0},map:{handler(){this.map&&this.toggle&&this.handleBind()}},showForm:{handler(){this.showForm?(this.realTime&&(this.form.dateTime=this.realTime),this.$nextTick(()=>{var o;(o=this.$refs.spotForm)==null||o.resetValidation()})):this.handleCloseForm()}},showMeteo:{handler(){var o,e,a,r,i,l;this.showMeteo?((a=(e=(o=this.$parent)==null?void 0:o.$refs)==null?void 0:e.idmBottomBar)==null||a.handleToggle("spot",!0),this.simple&&this.$nextTick(()=>{var n,c;this.$parent.playerBottom=((c=(n=this.$refs.spotMeteo)==null?void 0:n.$el)==null?void 0:c.clientHeight)+10})):((l=(i=(r=this.$parent)==null?void 0:r.$refs)==null?void 0:i.idmBottomBar)==null||l.handleToggle("spot",!1),this.simple&&(this.$parent.playerBottom=30))}},realTime:{handler(){this.realTime&&(this.form.dateTime=this.realTime,this.showMeteo&&this.fetchData())}},forecastModel:{handler(){this.form.forecastModel=this.forecastModel},immediate:!0},"form.forecastModel":{handler(o,e){!o&&e&&(this.form.forecastModel=e==="GFS"?"ECMWF":"GFS")}}},methods:{handleMenuToggle(){this.isLogin?this.toggle=!this.toggle:this.$emit("login")},submitForm(){this.handleCloseMeteo(),this.$refs.spotForm.validate().then(async o=>{o!=null&&o.valid&&this.fetchData()})},cancelForm(){var o;(o=this.$refs.spotForm)==null||o.reset(),this.form={lng:void 0,lngDegree:void 0,lngMinute:void 0,lngDirection:"E",lat:void 0,latDegree:void 0,latMinute:void 0,latDirection:"N",dateTime:void 0,forecastModel:this.forecastModel}},handleCloseForm(){this.showForm=!1,this.cancelForm(),this.toggle=!1},async fetchData(){var a;this.form.lat=(Number(this.form.latDegree??0)+Number(this.form.latMinute??0)/60)*(this.form.latDirection==="N"?1:-1),this.form.lng=(Number(this.form.lngDegree??0)+Number(this.form.lngMinute??0)/60)*(this.form.lngDirection==="E"?1:-1);const o=v();((a=v(this.realTime))==null?void 0:a.diff(o,"d",!0))>=0?await this.fetchForecastData(this.form):await this.fetchHistoryData(this.form)},async fetchForecastData(o){this.loading=!0,this.showMeteo=!0,this.form.lng=o.lng,this.form.lat=o.lat,this.form.followId=o.followId,this.handleDrawInfoMarker([o.lng,o.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Kt.Meteo2Assist.autoPickMeteoModel(o.forecastModel);let r={lat:o.lat,lng:o.lng,datetime:v(o.dateTime).utc().format(),forecastDays:o.day??3,weatherModels:e,marineModels:a};await ce.post(`${this.gateway}/api/arc/meteo2/spot/forecast`,r,{headers:{Authorization:this.token||this.defaultMeteoToken}}).then(i=>{(i==null?void 0:i.data.code)===0?(this.meteoData=i==null?void 0:i.data.data,this.meteoData.lng=o.lng,this.meteoData.lat=o.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1})},async fetchHistoryData(o){this.loading=!0,this.showMeteo=!0,this.form.lng=o.lng,this.form.lat=o.lat,this.form.followId=o.followId,this.handleDrawInfoMarker([o.lng,o.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Kt.Meteo2Assist.autoPickMeteoModel(o.forecastModel),r={lat:o.lat,lng:o.lng,datetime:v(o.dateTime).utc().format(),forecastDays:2,pastDays:1,weatherModels:e,marineModels:a};await ce.post(`${this.gateway}/api/arc/meteo2/spot/forecast`,r,{headers:{Authorization:this.token||this.defaultMeteoToken}}).then(i=>{(i==null?void 0:i.data.code)===0?(this.meteoData=i==null?void 0:i.data.data,this.meteoData.lng=o.lng,this.meteoData.lat=o.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1}),this.loading=!1},initTableData(o){var a,r,i,l,n,c,s,m,d,g,u,y,p,h,f,w,b,A,x,C,k,_,z,M,V,P,Y,U,K,de,ne,S,W,X,q,j,B,J,E,I,ie,ge,ue;this.currentHourData={},this.positionGmt=(r=(a=o==null?void 0:o.weather)==null?void 0:a[0])==null?void 0:r.timezone,this.positionOffset=(l=(i=o==null?void 0:o.weather)==null?void 0:i[0])==null?void 0:l.offset;const e=((n=Kt.Meteo2Assist.pickHourly(o,v(this.form.dateTime)))==null?void 0:n[0])||{};this.currentHourData.utc=e.utc,this.currentHourData.lat=o.lat,this.currentHourData.lng=o.lng,this.currentHourData.temp=this.computeRoundPrecision((c=e==null?void 0:e.weather)==null?void 0:c.temp,0)??"-",this.currentHourData.precipProbability=this.computeRoundPrecision((m=(s=e==null?void 0:e.weather)==null?void 0:s.precip)==null?void 0:m.probability,0)??"-",this.currentHourData.precip1h=this.computeRoundPrecision((g=(d=e==null?void 0:e.weather)==null?void 0:d.precip)==null?void 0:g.sum,0)??"-",this.currentHourData.visibility=this.computeRoundPrecision((u=e==null?void 0:e.weather)==null?void 0:u.visibility,0)??"-",this.currentHourData.windSpeed=this.computeRoundPrecision((p=(y=e==null?void 0:e.weather)==null?void 0:y.wind)==null?void 0:p.kts,1)??"-",this.currentHourData.windDir=((f=(h=e==null?void 0:e.weather)==null?void 0:h.wind)==null?void 0:f.direction)??"-",this.currentHourData.windLevel=this.computeRoundPrecision((b=(w=e==null?void 0:e.weather)==null?void 0:w.wind)==null?void 0:b.scale,0)??"-",this.currentHourData.windGust=this.computeRoundPrecision((x=(A=e==null?void 0:e.weather)==null?void 0:A.wind)==null?void 0:x.gusts,1)??"-",this.currentHourData.sigwaveHeight=this.computeRoundPrecision((k=(C=e==null?void 0:e.wave)==null?void 0:C.sig)==null?void 0:k.height,1)??"-",this.currentHourData.sigwaveDir=(z=(_=e==null?void 0:e.wave)==null?void 0:_.sig)==null?void 0:z.direction,this.currentHourData.sigwavePeriod=this.computeRoundPrecision((V=(M=e==null?void 0:e.wave)==null?void 0:M.sig)==null?void 0:V.period,1)??"-",this.currentHourData.windwaveHeight=this.computeRoundPrecision((Y=(P=e==null?void 0:e.wave)==null?void 0:P.wd)==null?void 0:Y.height,1)??"-",this.currentHourData.windwaveDir=(K=(U=e==null?void 0:e.wave)==null?void 0:U.wd)==null?void 0:K.direction,this.currentHourData.windwavePeriod=this.computeRoundPrecision((ne=(de=e==null?void 0:e.wave)==null?void 0:de.wd)==null?void 0:ne.period,1)??"-",this.currentHourData.swellHeight=this.computeRoundPrecision((W=(S=e==null?void 0:e.wave)==null?void 0:S.swell)==null?void 0:W.height,1)??"-",this.currentHourData.swellDir=(q=(X=e==null?void 0:e.wave)==null?void 0:X.swell)==null?void 0:q.direction,this.currentHourData.swellPeriod=this.computeRoundPrecision((B=(j=e==null?void 0:e.wave)==null?void 0:j.swell)==null?void 0:B.period,1)??"-",this.currentHourData.currentSpeed=this.computeRoundPrecision((J=e==null?void 0:e.current)==null?void 0:J.speed,1)??"-",this.currentHourData.currentDir=(E=e==null?void 0:e.current)==null?void 0:E.direction,this.currentHourData.currentSpeed=this.computeRoundPrecision((I=e==null?void 0:e.current)==null?void 0:I.speed,1)??"-",this.currentHourData.seaLevel=this.computeRoundPrecision(e==null?void 0:e.height,1)??"-",this.currentHourData.seaTemp=this.computeRoundPrecision(e==null?void 0:e.sst,0)??"-",this.currentHourData.weatherUrls=(ie=e==null?void 0:e.weather)==null?void 0:ie.url,this.currentHourData.sit=(ge=e==null?void 0:e.ice)==null?void 0:ge.sit,this.currentHourData.sic=this.computeRoundPrecision(((ue=e==null?void 0:e.ice)==null?void 0:ue.sic)*100,0)??"-",this.currentHourData.showIce=o.lat>=65||o.lat<=-65},handleBind(){var o,e;this.toggle?((o=this.map)==null||o.on("click",this.handleClick),this.map&&(this.map.getCanvas().style.cursor="crosshair")):((e=this.map)==null||e.off("click",this.handleClick),this.handleCloseMeteo(),this.map&&(this.map.getCanvas().style.cursor="grab"))},handleClick(o){if(o.originalEvent.stopPropagation(),o.originalEvent.target.className==="mapboxgl-canvas")this.handleGetPosition(o.lngLat),this.$nextTick(()=>{this.fetchData()});else return!1},handleGetPosition(o){if(isNaN(o.lat)||isNaN(o.lng))return!1;this.form.latDegree=Number(N.LngLatHelper.lat2pretty(o.lat).degree),this.form.latMinute=Number(N.LngLatHelper.lat2pretty(o.lat).minute),this.form.latDirection=N.LngLatHelper.lat2pretty(o.lat).direction,this.form.lngDegree=Number(N.LngLatHelper.lng2pretty(o.lng).degree),this.form.lngMinute=Number(N.LngLatHelper.lng2pretty(o.lng).minute),this.form.lngDirection=N.LngLatHelper.lng2pretty(o.lng).direction},handleDrawInfoMarker(o){this.drawPositionMarker(o),this.simple||this.drawMeteoInfoMarker(o)},drawPositionMarker(o){o&&(this.map.flyTo({center:o,duration:300}),this.$nextTick(()=>{var a,r;(a=this.positionMarker)==null||a.remove();const e=(r=document.getElementById("idm-position-icon"))==null?void 0:r.cloneNode(!0);this.positionMarker=new me.Marker(e).setLngLat(o).setOffset([0,-15]).addTo(this.map)}))},drawMeteoInfoMarker(o){this.$nextTick(()=>{var a;const e=document.getElementById("idm-gl4-spot-meteo");this.meteoInfoMarker?(a=this.meteoInfoMarker)==null||a.setLngLat(o):this.meteoInfoMarker=new me.Marker(e).setLngLat(o).setOffset([0,-190]).addTo(this.map)})},handleMeteoMore(){this.form.forecastModel=this.forecastModel,this.$emit("meteoMore",this.form)},handleCloseMeteo(){this.showMeteo=!1,this.$nextTick(()=>{var o,e;(o=this.positionMarker)==null||o.remove(),this.positionMarker=void 0,(e=this.meteoInfoMarker)==null||e.remove(),this.meteoInfoMarker=void 0})},handleFollow(){this.$emit("follow",this.form)},handleCancelFollow(){var e,a,r;const o=((e=this.form)==null?void 0:e.followId)||((r=(a=this.followList)==null?void 0:a.find(i=>{var l,n;return(i==null?void 0:i.id)===this.form.followId||((l=i==null?void 0:i.coordinate)==null?void 0:l.lng)===this.form.lng&&((n=i==null?void 0:i.coordinate)==null?void 0:n.lat)===this.form.lat}))==null?void 0:r.id);this.$emit("cancelFollow",o)}}},_h={class:"idm-gl4-spot"},Sh={class:"d-flex justify-start align-center"},Nh={class:"text-h6 font-weight-600"},Mh={class:"d-flex justify-start align-center ga-1 mb-2"},Ph={class:"text-label"},Vh={class:"w-100 d-flex ma-0"},Th={class:"w-30 pa-0 d-flex"},Eh={class:"flex-1-1-0 pa-0 d-flex"},Dh={class:"pa-0"},Rh={class:"d-flex justify-start align-center ga-1 mb-2"},Bh={class:"text-label"},Ih={class:"w-100 d-flex ma-0"},Fh={class:"w-30 pa-0 d-flex"},Gh={class:"flex-1-1-0 pa-0 d-flex"},jh={class:"pa-0"},Wh={class:"d-flex justify-start align-center ga-1 mb-2"},Zh={class:"text-label"},Xh={class:"d-flex justify-start align-center ga-1 mb-2"},Hh={class:"text-label"},Oh={class:"d-flex justify-start align-center"},Yh={class:"mx-2"},Uh={class:"mx-0 py-2 d-flex align-center justify-start"},Jh={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Kh={class:"pa-0 px-0"},Qh={class:"mx-0 py-2 d-flex align-center justify-start"},qh={cols:"9",class:"pa-0 px-0"},$h={class:"mx-0 py-2 d-flex align-center justify-start"},ep={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},tp={style:{width:"150px"},class:"pa-0 text-left"},op={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},ap={cols:"3",class:"pa-0 px-0 text-left"},ip={class:"mx-0 py-2 d-flex align-center justify-start"},rp={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},lp={style:{width:"150px"},class:"pa-0 text-left"},np={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},sp={cols:"3",class:"pa-0 text-left"},cp={class:"mx-0 py-2 d-flex align-center justify-start"},mp={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},dp={style:{width:"150px"},class:"pa-0 text-left"},hp={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},pp={class:"pa-0 text-left"},gp={key:0,class:"mx-0 py-2 d-flex align-center justify-start"},up={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},fp={style:{width:"150px"},class:"pa-0 text-left"},yp={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},bp={class:"pa-0 text-left"},wp={class:"d-flex justify-space-between align-center"},xp={class:"d-flex justify-start align-center"},kp={class:"mx-1"},Ap={class:"d-flex justify-end align-center"},Lp={class:"mx-0 py-1 d-flex align-center justify-start"},Cp={style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},vp={class:"pa-0 px-0"},zp={class:"mx-0 py-1 d-flex align-center justify-start"},_p={class:"pa-0 px-0"},Sp={class:"gray-bg-2 mx-4 my-2 py-3 px-2 rounded text-font-13 d-flex align-center justify-space-between"},Np={class:"d-flex flex-column align-start justify-center ga-3"},Mp={class:"text-label pr-2"},Pp={class:"text-label pr-2"},Vp={class:"text-label pr-2"},Tp={key:0},Ep={class:"text-label pr-2"},Dp={class:"d-flex flex-column align-start justify-center ga-3"},Rp={class:"text-label pr-2"},Bp={class:"text-label pr-2"},Ip={class:"text-label pr-2"},Fp={key:0},Gp={class:"text-label pr-2"},jp={id:"idm-position-icon"},Wp={class:"multi-color-icon",style:{height:"30px",width:"30px"},"aria-hidden":"true"},Zp=["xlink:href"];function Xp(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardTitle"),m=t.resolveComponent("VDivider"),d=t.resolveComponent("VTextField"),g=t.resolveComponent("DateTimePicker"),u=t.resolveComponent("VCol"),y=t.resolveComponent("VRow"),p=t.resolveComponent("VBtnToggle"),h=t.resolveComponent("VCardText"),f=t.resolveComponent("VCardActions"),w=t.resolveComponent("VForm"),b=t.resolveComponent("VCard");return t.openBlock(),t.createElementBlock("div",_h,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("spot.spotsMeteo"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:A})=>[t.createVNode(n,t.mergeProps(A,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[8]||(e[8]=[t.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h4"},null,-1)])),_:2,__:[8]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),i.showForm&&!a.simple?(t.openBlock(),t.createBlock(b,{key:0,class:"spot-form-card",style:t.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+50+"px"})},{default:t.withCtx(()=>[t.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>[t.createElementVNode("div",Sh,[t.createElementVNode("div",Nh,t.toDisplayString(o.$t("spot.spotWeather")),1)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleCloseForm},{default:t.withCtx(()=>e[9]||(e[9]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[9]},8,["onClick"])]),_:1}),t.createVNode(m),t.createVNode(w,{ref:"spotForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.submitForm,["prevent"])},{default:t.withCtx(()=>[t.createVNode(h,{class:"text-body-1 pa-4 py-2"},{default:t.withCtx(()=>[t.createElementVNode("div",Mh,[t.createElementVNode("div",Ph,[t.createTextVNode(t.toDisplayString(o.$t("spot.lat")),1),e[10]||(e[10]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createElementVNode("div",Vh,[t.createElementVNode("div",Th,[t.createVNode(d,{modelValue:i.form.latDegree,"onUpdate:modelValue":e[0]||(e[0]=A=>i.form.latDegree=A),rules:i.formRules.latDegree,label:"",density:"compact",variant:"outlined",height:"32px","min-height":"32px",required:"",dense:"",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[11]||(e[11]=t.createElementVNode("span",{class:"px-1"},"°",-1))]),t.createElementVNode("div",Eh,[t.createVNode(d,{modelValue:i.form.latMinute,"onUpdate:modelValue":e[1]||(e[1]=A=>i.form.latMinute=A),rules:i.formRules.latMinute,label:"",density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[12]||(e[12]=t.createElementVNode("span",{class:"px-1"},"'",-1))]),t.createElementVNode("div",Dh,[t.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[2]||(e[2]=A=>i.form.latDirection=i.form.latDirection==="N"?"S":"N")},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.form.latDirection),1)]),_:1})])]),t.createElementVNode("div",Rh,[t.createElementVNode("div",Bh,[t.createTextVNode(t.toDisplayString(o.$t("spot.lng")),1),e[13]||(e[13]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createElementVNode("div",Ih,[t.createElementVNode("div",Fh,[t.createVNode(d,{modelValue:i.form.lngDegree,"onUpdate:modelValue":e[3]||(e[3]=A=>i.form.lngDegree=A),rules:i.formRules.lngDegree,density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[14]||(e[14]=t.createElementVNode("span",{class:"px-1"},"°",-1))]),t.createElementVNode("div",Gh,[t.createVNode(d,{modelValue:i.form.lngMinute,"onUpdate:modelValue":e[4]||(e[4]=A=>i.form.lngMinute=A),rules:i.formRules.lngMinute,label:"",density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[15]||(e[15]=t.createElementVNode("span",{class:"px-1"},"'",-1))]),t.createElementVNode("div",jh,[t.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[5]||(e[5]=A=>i.form.lngDirection=i.form.lngDirection==="E"?"W":"E")},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.form.lngDirection),1)]),_:1})])]),t.createElementVNode("div",Wh,[t.createElementVNode("div",Zh,[t.createTextVNode(t.toDisplayString(o.$t("spot.dateTime")),1),e[16]||(e[16]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createVNode(y,{class:"ma-0 mb-4"},{default:t.withCtx(()=>[t.createVNode(u,{cols:"12",class:"pa-0"},{default:t.withCtx(()=>[t.createVNode(g,t.mergeProps({"date-time":i.form.dateTime,"time-zone":a.timeZone},o.$attrs,{onDateTime:e[6]||(e[6]=A=>i.form.dateTime=A)}),null,16,["date-time","time-zone"])]),_:1})]),_:1}),t.createElementVNode("div",Xh,[t.createElementVNode("div",Hh,[t.createTextVNode(t.toDisplayString(o.$t("weather.forecastModel")),1),e[17]||(e[17]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createVNode(y,{class:"ma-0"},{default:t.withCtx(()=>[t.createVNode(u,{cols:"12",class:"pa-0"},{default:t.withCtx(()=>[t.createVNode(p,{modelValue:i.form.forecastModel,"onUpdate:modelValue":e[7]||(e[7]=A=>i.form.forecastModel=A),class:"w-100",rounded:"",height:"30",density:"compact",group:"",mandatory:""},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact",height:"30",value:"GFS",class:t.normalizeClass(["text-none flex-1-1-0",i.form.forecastModel==="GFS"?"":"btn-border-1 btn-bg-1"]),color:i.form.forecastModel==="GFS"?"primary":"","base-color":""},{default:t.withCtx(()=>e[18]||(e[18]=[t.createTextVNode(" NOAA ",-1)])),_:1,__:[18]},8,["class","color"]),t.createVNode(n,{density:"compact",height:"30",class:t.normalizeClass(["text-none flex-1-1-0",i.form.forecastModel==="ECMWF"?"":"btn-border-1 btn-bg-1"]),color:i.form.forecastModel==="ECMWF"?"primary":"","base-color":"",value:"ECMWF"},{default:t.withCtx(()=>e[19]||(e[19]=[t.createTextVNode(" ECMWF ",-1)])),_:1,__:[19]},8,["class","color"])]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),t.createVNode(m),t.createVNode(f,{class:"d-flex justify-end align-center ga-4 pa-4 py-2"},{default:t.withCtx(()=>[t.createVNode(n,{size:"small",variant:"tonal",class:"text-none text-body-1 btn-bg-1",onClick:l.cancelForm},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.clear")),1)]),_:1},8,["onClick"]),t.createVNode(n,{ref:"submitSpot",loading:i.loading,size:"small",variant:"flat",color:"primary",type:"submit",class:"text-none text-body-1"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.confirm")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])]),_:1},8,["style"])):t.createCommentVNode("",!0),i.showMeteo&&!a.simple?(t.openBlock(),t.createBlock(b,{key:1,id:"idm-gl4-spot-meteo",class:"spot-meteo",style:{width:"490px","z-index":"9"}},{default:t.withCtx(()=>[t.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>[t.createElementVNode("div",Oh,[e[20]||(e[20]=t.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),t.createElementVNode("div",Yh,t.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),t.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:t.withModifiers(l.handleCloseMeteo,["stop"])},{default:t.withCtx(()=>e[21]||(e[21]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[21]},8,["onClick"])]),_:1}),t.createVNode(m),t.createVNode(h,{class:"text-body-1 px-0 py-1"},{default:t.withCtx(()=>{var A,x;return[t.createElementVNode("div",Uh,[t.createElementVNode("div",Jh,t.toDisplayString(o.$t("time.time")),1),t.createElementVNode("div",Kh,t.toDisplayString(l.computedTzTime((A=i.currentHourData)==null?void 0:A.utc)),1)]),t.createElementVNode("div",Qh,[e[22]||(e[22]=t.createElementVNode("div",{style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),t.createElementVNode("div",qh,t.toDisplayString(l.computedLocalTime((x=i.currentHourData)==null?void 0:x.utc)),1)]),t.createElementVNode("div",$h,[t.createElementVNode("div",ep,t.toDisplayString(o.$t("weather.wind")),1),t.createElementVNode("div",tp,t.toDisplayString(i.currentHourData.windDir??"-")+"/"+t.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+t.toDisplayString(i.currentHourData.windLevel??"-"),1),t.createElementVNode("div",op,t.toDisplayString(o.$t("weather.sigWave")),1),t.createElementVNode("div",ap,t.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s ",1)]),t.createElementVNode("div",ip,[t.createElementVNode("div",rp,t.toDisplayString(o.$t("weather.windWave")),1),t.createElementVNode("div",lp,t.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s ",1),t.createElementVNode("div",np,t.toDisplayString(o.$t("weather.swell")),1),t.createElementVNode("div",sp,t.toDisplayString(i.currentHourData.swellDir??"-")+"/"+t.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.swellPeriod??"-")+"s ",1)]),t.createElementVNode("div",cp,[t.createElementVNode("div",mp,t.toDisplayString(o.$t("weather.current")),1),t.createElementVNode("div",dp,t.toDisplayString(i.currentHourData.currentDir??"-")+"/"+t.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1),t.createElementVNode("div",hp,t.toDisplayString(o.$t("weather.visibility")),1),t.createElementVNode("div",pp,t.toDisplayString(i.currentHourData.visibility??"-")+"nm",1)]),i.currentHourData.showIce?(t.openBlock(),t.createElementBlock("div",gp,[t.createElementVNode("div",up,t.toDisplayString(o.$t("weather.sit")),1),t.createElementVNode("div",fp,t.toDisplayString(i.currentHourData.sit??"-")+"m",1),t.createElementVNode("div",yp,t.toDisplayString(o.$t("weather.sic")),1),t.createElementVNode("div",bp,t.toDisplayString(i.currentHourData.sic??"-")+"%",1)])):t.createCommentVNode("",!0)]}),_:1}),t.createVNode(m),t.createVNode(f,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>{var A;return[(A=a.followList)!=null&&A.some(x=>{var C,k;return(x==null?void 0:x.id)===i.form.followId||((C=x==null?void 0:x.coordinate)==null?void 0:C.lng)===i.form.lng&&((k=x==null?void 0:x.coordinate)==null?void 0:k.lat)===i.form.lat})?(t.openBlock(),t.createBlock(n,{key:0,id:"idm-gl4-spot-meteo-follow",class:"text-none text-body-1",variant:"text",density:"compact",height:"32",onClick:t.withModifiers(l.handleCancelFollow,["stop"])},{prepend:t.withCtx(()=>e[23]||(e[23]=[t.createElementVNode("i",{class:"iconfont icon-yishoucang text-h6 text-warning"},null,-1)])),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(o.$t("actions.unfollow")),1)]),_:1},8,["onClick"])):(t.openBlock(),t.createBlock(n,{key:1,id:"idm-gl4-spot-meteo-unfollow",class:"text-none text-body-1",variant:"text",density:"compact",height:"32",onClick:t.withModifiers(l.handleFollow,["stop"])},{prepend:t.withCtx(()=>e[24]||(e[24]=[t.createElementVNode("i",{class:"iconfont icon-weishoucang text-h6"},null,-1)])),default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.follow"))+" ",1)]),_:1},8,["onClick"])),t.createVNode(n,{height:"32",variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:t.withModifiers(l.handleMeteoMore,["stop"])},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("spot.forecast")),1)]),_:1},8,["onClick"])]}),_:1})]),_:1})):t.createCommentVNode("",!0),i.showMeteo&&a.simple?(t.openBlock(),t.createBlock(b,{key:2,ref:"spotMeteo",class:"position-absolute bottom-0 rounded-t-4",style:{width:"100vw","z-index":"1001"}},{default:t.withCtx(()=>[t.createVNode(s,null,{default:t.withCtx(()=>{var A;return[t.createElementVNode("div",wp,[t.createElementVNode("div",xp,[e[25]||(e[25]=t.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),t.createElementVNode("div",kp,t.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),t.createElementVNode("div",Ap,[(A=a.followList)!=null&&A.some(x=>{var C,k;return(x==null?void 0:x.id)===i.form.followId||((C=x==null?void 0:x.coordinate)==null?void 0:C.lng)===i.form.lng&&((k=x==null?void 0:x.coordinate)==null?void 0:k.lat)===i.form.lat})?(t.openBlock(),t.createBlock(n,{key:0,class:"text-none text-body-1 rounded-circle",variant:"text",density:"compact",height:"32",width:"28","min-width":"28",onClick:t.withModifiers(l.handleCancelFollow,["stop"])},{default:t.withCtx(()=>e[26]||(e[26]=[t.createElementVNode("i",{class:"iconfont icon-yishoucang text-h4 text-warning"},null,-1)])),_:1,__:[26]},8,["onClick"])):(t.openBlock(),t.createBlock(n,{key:1,class:"text-none text-body-1 rounded-circle",variant:"plain",density:"compact",height:"32",width:"28","min-width":"28",onClick:t.withModifiers(l.handleFollow,["stop"])},{default:t.withCtx(()=>e[27]||(e[27]=[t.createElementVNode("i",{class:"iconfont icon-weishoucang text-h4"},null,-1)])),_:1,__:[27]},8,["onClick"])),t.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:t.withModifiers(l.handleCloseMeteo,["stop"])},{default:t.withCtx(()=>e[28]||(e[28]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[28]},8,["onClick"])])]),e[29]||(e[29]=t.createElementVNode("div",{class:"px-5 py-0 text-label text-body-1"},"Spot Weather",-1))]}),_:1,__:[29]}),t.createVNode(m),t.createVNode(h,{class:"text-body-1 px-0 py-2"},{default:t.withCtx(()=>{var A,x;return[t.createElementVNode("div",Lp,[t.createElementVNode("div",Cp,t.toDisplayString(o.$t("time.time")),1),t.createElementVNode("div",vp,t.toDisplayString(l.computedTzTime((A=i.currentHourData)==null?void 0:A.utc)),1)]),t.createElementVNode("div",zp,[e[30]||(e[30]=t.createElementVNode("div",{style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),t.createElementVNode("div",_p,t.toDisplayString(l.computedLocalTime((x=i.currentHourData)==null?void 0:x.utc)),1)]),t.createElementVNode("div",Sp,[t.createElementVNode("div",Np,[t.createElementVNode("div",null,[t.createElementVNode("span",Mp,t.toDisplayString(o.$t("weather.wind")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.windDir??"-")+"/"+t.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+t.toDisplayString(i.currentHourData.windLevel??"-"),1)]),t.createElementVNode("div",null,[t.createElementVNode("span",Pp,t.toDisplayString(o.$t("weather.sigWave")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s",1)]),t.createElementVNode("div",null,[t.createElementVNode("span",Vp,t.toDisplayString(o.$t("weather.windWave")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s",1)]),i.currentHourData.showIce?(t.openBlock(),t.createElementBlock("div",Tp,[t.createElementVNode("span",Ep,t.toDisplayString(o.$t("weather.sit")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.sit??"-")+"m",1)])):t.createCommentVNode("",!0)]),t.createElementVNode("div",Dp,[t.createElementVNode("div",null,[t.createElementVNode("span",Rp,t.toDisplayString(o.$t("weather.swell")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.swellDir??"-")+"/"+t.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.swellPeriod??"-")+"s",1)]),t.createElementVNode("div",null,[t.createElementVNode("span",Bp,t.toDisplayString(o.$t("weather.current")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.currentDir??"-")+"/"+t.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1)]),t.createElementVNode("div",null,[t.createElementVNode("span",Ip,t.toDisplayString(o.$t("weather.visibility")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.visibility??"-")+" nm",1)]),i.currentHourData.showIce?(t.openBlock(),t.createElementBlock("div",Fp,[t.createElementVNode("span",Gp,t.toDisplayString(o.$t("weather.sic")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.sic??"-")+"%",1)])):t.createCommentVNode("",!0)])])]}),_:1})]),_:1},512)):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("div",jp,[(t.openBlock(),t.createElementBlock("svg",Wp,[t.createElementVNode("use",{"xlink:href":`#icon-spot-${a.theme}`},null,8,Zp)]))],512),[[t.vShow,i.showMeteo]])])}const Hp=Q(zh,[["render",Xp]]),B1="",Op={name:"IdmMeasure",props:{simple:{type:Boolean,default:!1},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}}},setup(){return{Theme:ye.useTheme()}},data(){return{right:10,toggle:!1,geojson:[],source:"measure-source",layer:"measure-layer",labelLayer:"measure-label-layer",sumLayer:"measure-suml-layer",tmpSource:"measure-tmp-source",tmpLayer:"measure-tmp-layer",tmpLabelLayer:"measure-tmp-label-layer",closeMarkers:{},pointMarkers:{},tipMarker:void 0,contextmenu:void 0,navigation:"RL",currentLineIndex:1}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},toggle:{handler(){var o,e,a;if(this.toggle)this.handleBind();else{(o=this.map)==null||o.getCanvas().removeEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.off("mousemove",this.handleMove),(a=this.map)==null||a.off("dblclick",this.handleDblClick),this.map;let r=this.geojson.find(i=>!i.closed);r&&this.handleClear(r,!0),this.geojson=this.geojson.filter(i=>!!i.closed),r=T.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(r)}},immediate:!0},map:{handler(){this.map&&(this.toggle?this.handleBind():this.handleUnbind())}}},methods:{handleMenuToggle(){this.toggle=!this.toggle},handleBind(){var o,e,a,r,i;(o=this.map)==null||o.getCanvas().addEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.on("mousemove",this.handleMove),(a=this.map)==null||a.on("dblclick",this.handleDblClick),(r=this.map)==null||r.on("click",this.handleClick),(i=this.map)==null||i.on("contextmenu",this.handleContextmenu),this.map&&(this.map.getCanvas().style.cursor="crosshair")},handleUnbind(){var o,e,a,r,i;(o=this.map)==null||o.getCanvas().removeEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.off("mousemove",this.handleMove),(a=this.map)==null||a.off("dblclick",this.handleDblClick),(r=this.map)==null||r.off("click",this.handleClick),(i=this.map)==null||i.off("contextmenu",this.handleContextmenu);for(const l of this.geojson)this.handleClear(l,!0);this.geojson=[],this.map&&(this.map.getCanvas().style.cursor="grab")},handleKeydown(o){if(o.key==="Shift"){this.navigation=this.navigation==="RL"?"GC":"RL";const e=this.geojson.at(-1),a=e.features.filter(r=>r.geometry.type==="Point");a!=null&&a.length&&(a.at(-1).properties.mode=this.navigation),this.handleRender(e)}},handleDrag(o){var a,r,i,l,n,c,s,m,d,g;const e=(r=(a=o.target)==null?void 0:a._element)==null?void 0:r.id;if((e==null?void 0:e.split("-").length)===2){const u=this.geojson.filter(f=>f.id===e.split("-")[0])[0];this.pointMarkers[u.id].filter(f=>{var w;return((w=f._element)==null?void 0:w.id)===e})[0].setLngLat([(l=(i=o.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(c=(n=o.target)==null?void 0:n._lngLat)==null?void 0:c.lat]);let p;u.features.forEach((f,w)=>{if(f.geometry.type==="Point"&&f.properties.id===e.split("-")[1]){p=w;return}});const h=u.features.filter(f=>f.geometry.type==="Point");this.handleTmpPointUpdate(u,h[p-1],{lng:(m=(s=o.target)==null?void 0:s._lngLat)==null?void 0:m.lng,lat:(g=(d=o.target)==null?void 0:d._lngLat)==null?void 0:g.lat,properties:h[p].properties},p===h.length-1?void 0:h[p+1])}},handleDragEnd(o){var a,r,i,l,n,c,s,m,d,g;const e=(r=(a=o.target)==null?void 0:a._element)==null?void 0:r.id;if((e==null?void 0:e.split("-").length)===2){const u=this.geojson.filter(h=>h.id===e.split("-")[0])[0];this.pointMarkers[u.id].filter(h=>{var f;return((f=h._element)==null?void 0:f.id)===e})[0].setLngLat([(l=(i=o.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(c=(n=o.target)==null?void 0:n._lngLat)==null?void 0:c.lat]);const p=u.features.filter(h=>h.geometry.type==="Point"&&h.properties.id===e.split("-")[1])[0];p.geometry.coordinates=[(m=(s=o.target)==null?void 0:s._lngLat)==null?void 0:m.lng,(g=(d=o.target)==null?void 0:d._lngLat)==null?void 0:g.lat],u.features=u.features.filter(h=>h.geometry.type==="Point"),this.handlePointUpdate(u)}},handleContextmenu(o){var a,r,i,l;o.preventDefault(),(a=this.contextmenu)==null||a.remove();const e=(l=(i=(r=o.originalEvent)==null?void 0:r.target)==null?void 0:i.parentElement)==null?void 0:l.id;if((e==null?void 0:e.split("-").length)===2){const c=this.geojson.filter(s=>s.id===e.split("-")[0])[0].features.filter(s=>s.geometry.type==="Point");if(c.length>2&&c.filter(m=>m.properties.id===(e==null?void 0:e.split("-")[1]))[0]){const m=document.createElement("div");m.className="idm-gl4-measure-contextmenu-marker",m.innerHTML=`<span id="del-${e}" class="del-point">${this.$t("actions.detele")}</span>`,this.contextmenu=new me.Marker(m).setOffset([24,0]).setLngLat([o.lngLat.lng,o.lngLat.lat]).addTo(this.map)}}},handleClick(o){var a,r,i,l,n,c;(a=this.contextmenu)==null||a.remove();const e=o.originalEvent.target.className;if(e==="marker-close"){const s=(i=(r=o.originalEvent)==null?void 0:r.srcElement)==null?void 0:i.id,m=this.geojson.filter(d=>d.id===s)[0];m&&this.handleClear(m,!0),this.geojson=this.geojson.filter(d=>d.id!==s),!this.toggle&&!((l=this.geojson)!=null&&l.some(d=>d.closed))&&this.handleUnbind()}else if(e==="del-point"){const s=(c=(n=o.originalEvent.target.id)==null?void 0:n.replace("del-",""))==null?void 0:c.split("-"),m=this.geojson.filter(d=>d.id===s[0])[0];m.features=m.features.filter(d=>d.geometry.type==="Point"&&d.properties.id!==s[1]),this.handlePointUpdate(m)}else if(e!=="marker-label"&&this.toggle){let s=this.geojson.at(-1);s||(s=T.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(s)),s.features=s.features.filter(d=>d.geometry.type==="Point");const m=T.feature({type:"Point",coordinates:[o.lngLat.lng,o.lngLat.lat]},{id:new Date().getTime().toString(),mode:this.navigation,sumLabel:"Start"});s.features.push(m),this.handlePointUpdate(s)}},handlePointUpdate(o){const e=o.features;if(e.length>1){let a=0;const r=[];for(let i=1;i<e.length;i++){const l=e[i-1],n=e[i],c=l.properties,s={lng:l.geometry.coordinates[0],lat:l.geometry.coordinates[1]},m={lng:n.geometry.coordinates[0],lat:n.geometry.coordinates[1]},d=N.LaneHelper.calculateDistance(s,m,c.mode==="RL",4),g=N.LaneHelper.calculateBearing(s,m,c.mode==="RL",2);a=N.LngLatHelper.roundPrecision(a+d,4);let u;c.mode==="RL"?u=N.LngLatHelper.convertToMonotonicLng([s,m]):u=N.LngLatHelper.convertToMonotonicLng(N.LaneHelper.interpolateCoordinates(s,m,200));const y=T.lineString(u.map(h=>[h.lng,h.lat]));y.properties.dist=d,y.properties.bearing=g,y.properties.total=a,y.properties.name="Line "+this.currentLineIndex,r.push(y);const p=e[i];p.properties.totalDist=N.LngLatHelper.roundPrecision((c.totalDist?c.totalDist:0)+d,4),p.properties.sumLabel=p.properties.totalDist+" nm"}e.push(...r),o.total=a}return this.handleRender(o),o},handleTmpPointUpdate(o,e,a,r){const i=T.featureCollection([]);let l,n;if(e){const s=e.properties,m={lng:e.geometry.coordinates[0],lat:e.geometry.coordinates[1]},d={lng:a.lng,lat:a.lat};l=N.LaneHelper.calculateDistance(m,d,s.mode==="RL",4),n=N.LaneHelper.calculateBearing(m,d,s.mode==="RL",2);let g;s.mode==="RL"?g=N.LngLatHelper.convertToMonotonicLng([m,d]):g=N.LngLatHelper.convertToMonotonicLng(N.LaneHelper.interpolateCoordinates(m,d,200));const u=T.lineString(g.map(y=>[y.lng,y.lat]));u.properties.dist=l,u.properties.bearing=n,i.features.push(u)}if(r){const s=a.properties,m=a,d={lng:r.geometry.coordinates[0],lat:r.geometry.coordinates[1]};l=N.LaneHelper.calculateDistance(m,d,s.mode==="RL",4),n=N.LaneHelper.calculateBearing(m,d,s.mode==="RL",2);let g;s.mode==="RL"?g=N.LngLatHelper.convertToMonotonicLng([m,d]):g=N.LngLatHelper.convertToMonotonicLng(N.LaneHelper.interpolateCoordinates(m,d,200));const u=T.lineString(g.map(y=>[y.lng,y.lat]));u.properties.dist=l,u.properties.bearing=n,i.features.push(u)}this.map.getSource(this.tmpSource)?this.map.getSource(this.tmpSource).setData(i):this.map.addSource(this.tmpSource,{type:"geojson",data:i}),this.map.getLayer(this.tmpLayer)||this.map.addLayer({id:this.tmpLayer,type:"line",source:this.tmpSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["map-orange"],"line-width":2,"line-opacity":1,"line-dasharray":[3,2]}}),this.map.getLayer(this.tmpLabelLayer)||this.map.addLayer({id:this.tmpLabelLayer,type:"symbol",source:this.tmpSource,filter:["==","$type","LineString"],layout:{"symbol-placement":"line-center","text-field":"{dist}nm / {bearing}°","text-rotation-alignment":"map","text-size":11,"text-offset":[0,-1]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}});let c;if(r)c=`<div class="marker-label">${this.$t("measure.dragTips")}</div>`;else{const s=N.LngLatHelper.roundPrecision((o.total??0)+l,1);c=`<div class="marker-label">${this.$t("measure.totalDistance")}: <b>${s}</b>nm, ${this.$t("measure.bearing")}: <b>${n}</b>°</div><div class="marker-label"> ${this.$t("measure.mode")}${this.navigation==="RL"?"RL":"GC"}, ${this.$t("measure.switchTips")}</div><div class="marker-label">${this.$t("measure.clickTips")}</div>`}if(this.tipMarker)this.tipMarker._element.innerHTML=c,this.tipMarker.setLngLat([a.lng,a.lat]);else{const s=document.createElement("div");s.className="idm-gl4-measure-tip-marker",s.innerHTML=c,this.tipMarker=new me.Marker(s).setOffset([140,0]).setLngLat([a.lng,a.lat]).addTo(this.map)}},handleMove(o){this.map.getCanvas().style.cursor="crosshair";let e=this.geojson.at(-1);e||(e=T.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e));const a=e.features.filter(r=>r.geometry.type==="Point");a!=null&&a.length&&this.handleTmpPointUpdate(e,a.at(-1),{lng:o.lngLat.lng,lat:o.lngLat.lat})},handleDblClick(o){o.preventDefault();let e=this.geojson.at(-1);e.closed=!0,this.handleRender(e),e=T.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e),this.currentLineIndex++},handleRender(o){var e;if((e=o==null?void 0:o.features)!=null&&e.length){const a=`${o.id}-${this.source}`,r=`${o.id}-${this.layer}`,i=`${o.id}-${this.labelLayer}`,l=`${o.id}-${this.sumLayer}`;this.map.getSource(a)?this.map.getSource(a).setData(o):this.map.addSource(a,{type:"geojson",data:o}),this.handleClear(o,!1),this.map.addLayer({id:r,type:"line",source:a,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["map-orange"],"line-width":2}}),this.map.addLayer({id:i,type:"symbol",source:a,filter:["==","$type","LineString"],layout:{"symbol-placement":"line-center","text-field":"{dist}nm / {bearing}°","text-rotation-alignment":"map","text-size":11,"text-offset":[0,-1]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}}),this.map.addLayer({id:l,type:"symbol",source:a,filter:["==","$type","Point"],layout:{"text-field":"{sumLabel}","text-rotation-alignment":"map","text-size":12,"text-offset":[0,1.5]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}});const n=o.features.filter(c=>c.geometry.type==="Point");for(const c of n){const s=document.createElement("div");s.id=`${o.id}-${c.properties.id}`,s.className=`${o.closed?"idm-gl4-measure-marker closed":"idm-gl4-measure-marker"}`,s.innerHTML='<div class="marker-circle"></div>';const m=new me.Marker({element:s,draggable:!0,contextmenu:!0}).setLngLat(c.geometry.coordinates).addTo(this.map);m.on("drag",this.handleDrag),m.on("dragend",this.handleDragEnd),this.pointMarkers[o.id]?this.pointMarkers[o.id].push(m):this.pointMarkers[o.id]=[m]}if(o.closed){const c=n.at(-1),m=o.features.filter(g=>g.geometry.type==="LineString").at(-1),d=document.createElement("div");d.className="idm-gl4-measure-summary-marker",d.innerHTML=`<div class="marker-label">${m.properties.name}</div><div id="${o.id}" class="marker-close">X</div>`,this.closeMarkers[o.id]=new me.Marker(d).setOffset([0,-30]).setLngLat(c.geometry.coordinates).addTo(this.map)}}},handleClear(o,e=!0){var n,c,s,m,d,g,u,y,p,h;const a=`${o.id}-${this.source}`,r=`${o.id}-${this.layer}`,i=`${o.id}-${this.labelLayer}`,l=`${o.id}-${this.sumLayer}`;(n=this.map)!=null&&n.getLayer(r)&&this.map.removeLayer(r),(c=this.map)!=null&&c.getLayer(i)&&this.map.removeLayer(i),(s=this.map)!=null&&s.getLayer(l)&&this.map.removeLayer(l),(m=this.map)!=null&&m.getLayer(this.tmpLayer)&&this.map.removeLayer(this.tmpLayer),(d=this.map)!=null&&d.getLayer(this.tmpLabelLayer)&&this.map.removeLayer(this.tmpLabelLayer),(g=this.closeMarkers[o.id])==null||g.remove(),this.closeMarkers[o.id]=void 0,(u=this.pointMarkers[o.id])==null||u.forEach(f=>{f==null||f.remove()}),this.pointMarkers[o.id]=[],(y=this.tipMarker)==null||y.remove(),this.tipMarker=void 0,e&&((p=this.map)!=null&&p.getSource(a))&&this.map.removeSource(a),e&&((h=this.map)!=null&&h.getSource(this.tmpSource))&&this.map.removeSource(this.tmpSource)}}},Yp={class:"idm-gl4-measure"};function Up(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip");return t.openBlock(),t.createElementBlock("div",Yp,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+166+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("measure.measure"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:s})=>[t.createVNode(n,t.mergeProps(s,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[0]||(e[0]=[t.createElementVNode("i",{class:"iconfont icon-a-Measuredistance text-h4"},null,-1)])),_:2,__:[0]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4)])}const Jp=Q(Op,[["render",Up]]),I1="",Kp={name:"IdmDrawMarker",props:{map:{type:Object},gateway:{type:String},token:{type:String},simple:{type:Boolean,default:!1},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:()=>({})},editLayer:{type:Object,default:null},group:{type:Object,default:()=>({})}},emits:["close","save","hideLayer"],setup(){return{Theme:ye.useTheme()}},data(){var o;return{markerType:"Point",form:{latDegree:"",latMinute:"",latDir:"N",lngDegree:"",lngMinute:"",lngDir:"E",areaType:"Polygon",color:(o=this.Theme.current.value.colors)==null?void 0:o["map-green"],name:""},formRules:{lngDegree:[e=>e!=null&&e!==""||"required",e=>/^\d{1,3}$/.test(e)||"number",e=>parseInt(e)>=0&&parseInt(e)<=180||"0 ~ 180"],lngMinute:[e=>e==null||e===""||/^\d{1,2}(\.\d+)?$/.test(e)||"number",e=>e==null||e===""||parseInt(e)>=0&&parseInt(e)<=59||"0 ~ 59"],latDegree:[e=>e!=null&&e!==""||"required",e=>/^\d{1,2}$/.test(e)||"number",e=>parseInt(e)>=0&&parseInt(e)<=90||"0 ~ 90"],latMinute:[e=>e==null||e===""||/^\d{1,2}(\.\d+)?$/.test(e)||"number",e=>e==null||e===""||parseInt(e)>=0&&parseInt(e)<=59||"0 ~ 59"],color:[e=>e!=null&&e!==""||"required"],name:[e=>e!=null&&e!==""||"required"]},saving:!1,drawSource:"draw-marker-source",drawPointLayer:"draw-marker-point-layer",drawLineLayer:"draw-marker-line-layer",drawFillLayer:"draw-marker-fill-layer",drawTmpSource:"draw-marker-tmp-source",drawTmpLayer:"draw-marker-tmp-layer",drawCoords:[],rectCornerMarkers:[],polygonVertexMarkers:[],circleMarkers:[],drawRadiusSource:"draw-marker-radius-source",drawRadiusLayer:"draw-marker-radius-layer",tipMarker:null,pointMarker:null,pointHighlightMarker:null,editMarkers:[],deleteBtn:null,originalProperties:{}}},watch:{markerType:{handler(){var o;(o=this.editLayer)!=null&&o.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},immediate:!0},"form.areaType"(){var o;(o=this.editLayer)!=null&&o.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},map:{handler(){var o;this.map&&(this.handleBindMap(),(o=this.editLayer)!=null&&o.id&&this.loadEditLayer())},immediate:!0},"form.color":{handler(){this.handleChangePoint(),this.handleUpdateLayerColors()},immediate:!0}},beforeUnmount(){this.handleClearDraw(!0),this.handleUnbindMap()},methods:{handleClose(){this.handleClearDraw(!0),this.handleUnbindMap(),this.$emit("close")},handleBindMap(){var o,e;this.map&&(this.markerType==="Point"?(this.map.on("click",this.handleMapClickPoint),this.map.getCanvas().style.cursor="crosshair"):this.markerType==="Line"&&!((o=this.editLayer)!=null&&o.id)?(this.map.on("click",this.handleMapClickLine),this.map.on("mousemove",this.handleMapMoveLine),this.map.on("dblclick",this.handleMapDblClickLine),this.map.getCanvas().style.cursor="crosshair"):this.markerType==="Area"&&!((e=this.editLayer)!=null&&e.id)&&(this.form.areaType==="Polygon"?(this.map.on("click",this.handleMapClickPolygon),this.map.on("mousemove",this.handleMapMovePolygon),this.map.on("dblclick",this.handleMapDblClickPolygon)):this.form.areaType==="Circle"?(this.map.on("click",this.handleMapClickCircle),this.map.on("mousemove",this.handleMapMoveCircle)):this.form.areaType==="Rect"&&(this.map.on("click",this.handleMapClickRect),this.map.on("mousemove",this.handleMapMoveRect)),this.map.getCanvas().style.cursor="crosshair"))},handleUnbindMap(){this.map&&(this.map.off("click",this.handleMapClickPoint),this.map.off("click",this.handleMapClickLine),this.map.off("mousemove",this.handleMapMoveLine),this.map.off("dblclick",this.handleMapDblClickLine),this.map.off("click",this.handleMapClickPolygon),this.map.off("mousemove",this.handleMapMovePolygon),this.map.off("dblclick",this.handleMapDblClickPolygon),this.map.off("click",this.handleMapClickCircle),this.map.off("mousemove",this.handleMapMoveCircle),this.map.off("click",this.handleMapClickRect),this.map.off("mousemove",this.handleMapMoveRect),this.map.getCanvas().style.cursor="grab")},handleRebindMap(){this.handleUnbindMap(),this.handleBindMap()},loadEditLayer(){var i,l,n,c,s,m;if(!((i=this.editLayer)!=null&&i.extend)||!this.map)return;const o=typeof this.editLayer.extend=="string"?JSON.parse(this.editLayer.extend):this.editLayer.extend;if(!o)return;const a=(o.features||(o.type==="Feature"?[o]:[]))[0];if(!a)return;this.originalProperties=a.properties||{},this.form.name=this.editLayer.name||"",this.form.color=this.editLayer.color||((l=this.originalProperties)==null?void 0:l.color)||((n=this.Theme.current.value.colors)==null?void 0:n["map-green"])||"#4CAF50";const r=(c=a.geometry)==null?void 0:c.type;if(r==="Point"){this.markerType="Point";const[d,g]=a.geometry.coordinates;this.drawCoords=[[d,g]],this.form.latDegree=Number(N.LngLatHelper.lat2pretty(g).degree),this.form.latMinute=Number(N.LngLatHelper.lat2pretty(g).minute),this.form.latDir=N.LngLatHelper.lat2pretty(g).direction,this.form.lngDegree=Number(N.LngLatHelper.lng2pretty(d).degree),this.form.lngMinute=Number(N.LngLatHelper.lng2pretty(d).minute),this.form.lngDir=N.LngLatHelper.lng2pretty(d).direction,this.handleRenderPoint(this.drawCoords,this.form.color),this.setupPointEdit()}else r==="LineString"?(this.markerType="Line",this.$nextTick(()=>{this.handlerRenderEditLine(a),this.setupLineEdit(),this.handleUnbindMap()})):r==="Polygon"&&(this.markerType="Area",this.form.areaType=(m=(s=this.originalProperties)==null?void 0:s.shape)==null?void 0:m.toLowerCase(),this.$nextTick(()=>{this.handlerRenderEditPolygon(o),this.setupPolygonEdit(a),this.handleUnbindMap()}));this.$emit("hideLayer",this.editLayer.id)},setupPointEdit(){var a;if(!this.pointMarker)return;this.pointMarker.setDraggable(!0),this.pointMarker.off("drag",this.handlePointDrag),this.pointMarker.on("drag",this.handlePointDrag),this.pointMarker.off("dragend",this.handlePointDrag),this.pointMarker.on("dragend",this.handlePointDrag),(a=this.pointHighlightMarker)==null||a.remove();const o=document.createElement("div");o.className="idm-gl4-point-center-ring";const e=this.pointMarker.getLngLat();this.pointHighlightMarker=new me.Marker({element:o,anchor:"center",offset:[0,0]}).setLngLat(e).addTo(this.map),this.pointMarker.on("drag",()=>{var r;(r=this.pointHighlightMarker)==null||r.setLngLat(this.pointMarker.getLngLat())})},handlePointDrag(){const{lng:o,lat:e}=this.pointMarker.getLngLat();this.drawCoords=[[o,e]],this.form.latDegree=Number(N.LngLatHelper.lat2pretty(e).degree),this.form.latMinute=Number(N.LngLatHelper.lat2pretty(e).minute),this.form.latDir=N.LngLatHelper.lat2pretty(e).direction,this.form.lngDegree=Number(N.LngLatHelper.lng2pretty(o).degree),this.form.lngMinute=Number(N.LngLatHelper.lng2pretty(o).minute),this.form.lngDir=N.LngLatHelper.lng2pretty(o).direction},clearEditMarkers(){this.editMarkers.forEach(o=>o.remove()),this.editMarkers=[],this._edgeContextMenuHandler&&this.map&&(this.map.off("contextmenu",this._edgeContextMenuHandler),this._edgeContextMenuHandler=null)},handlerRenderEditLine(o){this.drawCoords=o.geometry.coordinates.map(r=>[...r]);const e=T.featureCollection([o,...this.drawCoords.map(r=>T.point(r))]);this.handleSetDrawSource(e);const a=3;this.map.getLayer(this.drawLineLayer)||this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":a}})},setupLineEdit(){this.clearEditMarkers(),this.drawCoords.forEach((e,a)=>{const r=document.createElement("div");r.className="idm-gl4-edit-vertex",r.style.backgroundColor=this.form.color;const i=new me.Marker({element:r,draggable:!0}).setLngLat(e).addTo(this.map);i.on("dragstart",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:l,lat:n}=i.getLngLat();this.handleRenderVertexLabel([l,n],40)}),i.on("drag",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:l,lat:n}=i.getLngLat();this.handleUpdateVertexLabel([l,n]),this.drawCoords[a]=[l,n],this.handlerRenderEditLine(T.lineString(this.drawCoords,{type:"Line",color:this.form.color}))}),i.on("dragend",()=>{this.map.getCanvas().style.cursor="grab";const{lng:l,lat:n}=i.getLngLat();this.drawCoords[a]=[l,n],this.handlerRenderEditLine(T.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.handleClearVertexLabels()}),r.addEventListener("contextmenu",l=>{l.preventDefault(),l.stopPropagation(),this.drawCoords.length>2&&this.showDeleteButton(e,()=>{this.drawCoords.splice(a,1),this.handlerRenderEditLine(T.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()})}),this.editMarkers.push(i)});const o=e=>{e.preventDefault();const{lng:a,lat:r}=e.lngLat,i=T.point([a,r]),l=T.lineString(this.drawCoords),n=T.nearestPointOnLine(l,i);if(n){const c=n.properties.index;this.showDeleteButton([a,r],()=>{this.drawCoords.splice(c+1,0,[a,r]),this.handlerRenderEditLine(T.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()},this.$t("actions.add")||"新增","add")}};this.map.on("contextmenu",o),this._edgeContextMenuHandler=o},showDeleteButton(o,e,a,r="delete"){this.hideDeleteButton();const i=this.map.getContainer(),l=document.createElement("button");l.textContent=a||this.$t("actions.delete"),l.className=r==="add"?"idm-gl4-edit-add-btn":"idm-gl4-edit-delete-btn";const n=this.map.project(o);l.style.left=`${n.x}px`,l.style.top=`${n.y}px`;const c=s=>{s.stopPropagation(),e(),this.hideDeleteButton()};l.addEventListener("click",c),i.appendChild(l),this.deleteBtn=l,this.map.once("click",()=>this.hideDeleteButton())},hideDeleteButton(){this.deleteBtn&&(this.deleteBtn.remove(),this.deleteBtn=null)},handlerRenderEditPolygon(o){this.handleSetDrawSource(o);const e=3;this.map.getLayer(this.drawFillLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-width",e),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":e}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},setupPolygonEdit(o){this.clearEditMarkers();const e=o.geometry.coordinates[0].slice(0,-1);this.drawCoords=e.map(r=>[...r]),this.drawCoords.forEach((r,i)=>{const l=document.createElement("div");l.className="idm-gl4-edit-vertex",l.style.backgroundColor=this.form.color;const n=new me.Marker({element:l,draggable:!0}).setLngLat(r).addTo(this.map);n.on("dragstart",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:c,lat:s}=n.getLngLat();this.handleRenderVertexLabel([c,s])}),n.on("drag",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:c,lat:s}=n.getLngLat();this.handleUpdateVertexLabel([c,s]),this.drawCoords[i]=[c,s],this.handleRenderPolygonFill(this.drawCoords)}),n.on("dragend",()=>{this.map.getCanvas().style.cursor="grab";const{lng:c,lat:s}=n.getLngLat();this.drawCoords[i]=[c,s],this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels()}),l.addEventListener("contextmenu",c=>{c.preventDefault(),c.stopPropagation(),this.drawCoords.length>3&&this.showDeleteButton(r,()=>{this.drawCoords.splice(i,1),this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels(),this.setupPolygonEdit({geometry:{type:"Polygon",coordinates:[[...this.drawCoords,this.drawCoords[0]]]},properties:this.originalProperties})})}),this.editMarkers.push(n)});const a=r=>{r.preventDefault();const{lng:i,lat:l}=r.lngLat,n=T.point([i,l]),c=T.lineString([...this.drawCoords,this.drawCoords[0]]),s=T.nearestPointOnLine(c,n);if(s){const m=s.properties.index,d=m>=this.drawCoords.length-1?this.drawCoords.length-1:m;this.showDeleteButton([i,l],()=>{this.drawCoords.splice(d+1,0,[i,l]),this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels(),this.setupPolygonEdit({geometry:{type:"Polygon",coordinates:[[...this.drawCoords,this.drawCoords[0]]]},properties:this.originalProperties})},this.$t("actions.add")||"新增","add")}};this.map.on("contextmenu",a),this._edgeContextMenuHandler=a},handleMapClickPoint(o){var r;const{lng:e,lat:a}=o.lngLat;this.drawCoords=[[e,a]],this.form.latDegree=Number(N.LngLatHelper.lat2pretty(a).degree),this.form.latMinute=Number(N.LngLatHelper.lat2pretty(a).minute),this.form.latDir=N.LngLatHelper.lat2pretty(a).direction,this.form.lngDegree=Number(N.LngLatHelper.lng2pretty(e).degree),this.form.lngMinute=Number(N.LngLatHelper.lng2pretty(e).minute),this.form.lngDir=N.LngLatHelper.lng2pretty(e).direction,this.handleRenderPoint(this.drawCoords,this.form.color),(r=this.editLayer)!=null&&r.id&&this.setupPointEdit()},handleChangePoint(){var u;const{latDegree:o,latMinute:e,latDir:a,lngDegree:r,lngMinute:i,lngDir:l}=this.form,n=parseFloat(o),c=parseFloat(e),s=parseFloat(r),m=parseFloat(i);if(isNaN(n)||isNaN(s))return;const d=(n+(isNaN(c)?0:c)/60)*(a==="S"?-1:1),g=(s+(isNaN(m)?0:m)/60)*(l==="W"?-1:1);this.drawCoords=[[g,d]],this.handleRenderPoint(this.drawCoords,this.form.color),(u=this.editLayer)!=null&&u.id&&this.setupPointEdit()},handleRenderPoint(o,e){var i;if((i=this.pointMarker)==null||i.remove(),!o||!o.length)return;const[a,r]=o[0];this.pointMarker=new me.Marker({color:e}).setLngLat([a,r]).addTo(this.map)},handleMapClickLine(o){var r;const{lng:e,lat:a}=o.lngLat;this.drawCoords.push([e,a]),this.handleRenderLine(this.drawCoords),(r=this.editLayer)!=null&&r.id&&this.setupLineEdit()},handleMapMoveLine(o){if(!this.drawCoords.length)return;const{lng:e,lat:a}=o.lngLat;this.handleRenderTmpLine(this.drawCoords.at(-1),[e,a])},handleMapDblClickLine(o){o.preventDefault(),this.drawCoords.length>1&&this.drawCoords.pop(),this.handleRenderLine(this.drawCoords),this.handleClearTmp(),this.map.off("click",this.handleMapClickLine),this.map.off("mousemove",this.handleMapMoveLine),this.map.off("dblclick",this.handleMapDblClickLine)},handleRenderLine(o){if(!o||o.length<1)return;const e=[];o==null||o.forEach((i,l)=>{e.push(N.GeoJsonHelper.drawPoint(i==null?void 0:i[1],i==null?void 0:i[0]))}),(o==null?void 0:o.length)>=2&&e.push(N.GeoJsonHelper.drawLine(o));const a=2,r=T.featureCollection(e);this.handleSetDrawSource(r),this.map.getLayer(this.drawLineLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-color",this.form.color),this.map.setPaintProperty(this.drawLineLayer,"line-width",a),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":a}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},handleRenderTmpLine(o,e){const a=N.GeoJsonHelper.drawLine([o,e]),r=T.featureCollection([a]);this.map.getSource(this.drawTmpSource)?this.map.getSource(this.drawTmpSource).setData(r):this.map.addSource(this.drawTmpSource,{type:"geojson",data:r}),this.map.getLayer(this.drawTmpLayer)||this.map.addLayer({id:this.drawTmpLayer,type:"line",source:this.drawTmpSource,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":2,"line-dasharray":[3,2]}});const i={lng:o[0],lat:o[1]},l={lng:e[0],lat:e[1]},n=N.LaneHelper.calculateDistance(i,l,!0,2),c=N.LaneHelper.calculateBearing(i,l,!0,2);let s=0;for(let d=1;d<this.drawCoords.length;d++){const g={lng:this.drawCoords[d-1][0],lat:this.drawCoords[d-1][1]},u={lng:this.drawCoords[d][0],lat:this.drawCoords[d][1]};s+=N.LaneHelper.calculateDistance(g,u,!0,4)}s=N.LngLatHelper.roundPrecision(s+n,1);const m=`
218
218
  <div class="marker-label">${this.$t("measure.totalDistance")}: <b>${s}</b>nm, ${this.$t("measure.bearing")}: <b>${c}</b>°</div>
219
219
  <div class="marker-label"> ${this.$t("measure.clickTips")}</div>`;if(this.tipMarker)this.tipMarker._element.innerHTML=m,this.tipMarker.setLngLat([e[0],e[1]]);else{const d=document.createElement("div");d.className="idm-gl4-draw-tip-marker",d.innerHTML=m,this.tipMarker=new me.Marker(d).setOffset([140,0]).setLngLat([e[0],e[1]]).addTo(this.map)}},handleRefreshLine(){this.drawCoords.length>=1&&this.handleRenderLine(this.drawCoords)},handleMapClickPolygon(o){var r;const{lng:e,lat:a}=o.lngLat;this.drawCoords.push([e,a]),this.drawCoords.length>=3&&this.handleRenderPolygonFill(this.drawCoords),this.handleRenderAllVertexLabels(this.drawCoords),(r=this.editLayer)!=null&&r.id&&this.setupPolygonEdit()},handleMapMovePolygon(o){if(!this.drawCoords.length)return;const{lng:e,lat:a}=o.lngLat,r=[...this.drawCoords,[e,a]];r.length>=1&&this.handleRenderPolygonFill(r),this.handleRenderAllVertexLabels(r)},handleMapDblClickPolygon(o){o.preventDefault(),this.drawCoords.length>=1&&this.drawCoords.pop(),this.drawCoords.length>=1&&this.handleRenderPolygonFill(this.drawCoords),this.handleRenderAllVertexLabels(this.drawCoords),this.map.off("click",this.handleMapClickPolygon),this.map.off("mousemove",this.handleMapMovePolygon),this.map.off("dblclick",this.handleMapDblClickPolygon)},handleRenderPolygonFill(o){var i;let e=[];if(o==null||o.forEach((l,n)=>{e.push(T.point(l))}),(o==null?void 0:o.length)>2){const l=[...o,o[0]];e.push(N.GeoJsonHelper.drawPolygon(l,{...this.originalProperties}))}const a=T.featureCollection(e);this.handleSetDrawSource(a);const r=(i=this.editLayer)!=null&&i.id?3:2;this.map.getLayer(this.drawFillLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-width",r),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":r}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},handleRenderVertexLabel(o,e=8){this.handleClearVertexLabels();const a=N.LngLatHelper.lat2pretty(o[1],4).pretty,r=N.LngLatHelper.lng2pretty(o[0],4).pretty,i=document.createElement("div");i.className="idm-gl4-draw-corner-label center",i.innerHTML=`<span class="corner-text">${a} <br/> ${r}</span>`;const l=new me.Marker(i,{anchor:"bottom",offset:[0,e]}).setLngLat(o).addTo(this.map);this.polygonVertexMarkers.push(l)},handleRenderAllVertexLabels(o){this.handleClearVertexLabels();const e=o.reduce((a,r)=>[a[0]+r[0],a[1]+r[1]],[0,0]);e[0]/=o.length,e[1]/=o.length,o.forEach(a=>{const r=a[0]-e[0],i=a[1]-e[1];let l="center";i>=0&&r>=0?l="bottom-left":i>=0&&r<0?l="bottom-right":i<0&&r>=0?l="top-left":l="top-right";const n=N.LngLatHelper.lat2pretty(a[1],4).pretty,c=N.LngLatHelper.lng2pretty(a[0],4).pretty,s=document.createElement("div");s.className="idm-gl4-draw-corner-label "+l,s.innerHTML=`<span class="corner-text">${n} <br/> ${c}</span>`;const m=new me.Marker(s,{anchor:l}).setLngLat(a).addTo(this.map);this.polygonVertexMarkers.push(m)})},handleUpdateVertexLabel(o){if(!this.polygonVertexMarkers.length)return;const e=this.polygonVertexMarkers[0];e.setLngLat(o);const a=N.LngLatHelper.lat2pretty(o[1],4).pretty,r=N.LngLatHelper.lng2pretty(o[0],4).pretty,i=e.getElement().querySelector(".corner-text");i&&(i.innerHTML=`${a} <br/> ${r}`)},handleClearVertexLabels(){this.polygonVertexMarkers.forEach(o=>o.remove()),this.polygonVertexMarkers=[]},handleMapClickCircle(o){const{lng:e,lat:a}=o.lngLat;if(this.drawCoords.length===0){this.drawCoords.push([e,a]);const r=T.featureCollection([T.point([e,a])]);this.handleSetDrawSource(r),this.map.getLayer(this.drawPointLayer)||this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}),this.handleRenderCircleCenterLabel([e,a])}else{const r=this.drawCoords[0],i=[e,a],l=T.distance(T.point(r),T.point(i),{units:"nauticalmiles"}),n=N.GeoJsonHelper.drawCircle(r[0],r[1],l),c=T.featureCollection([T.point(r),n]);this.handleSetDrawSource(c),this.handleRenderAreaLayers(),this.handleRenderRadiusLine(r,i,l),this.drawCoords=[r,i],this.map.off("click",this.handleMapClickCircle),this.map.off("mousemove",this.handleMapMoveCircle)}},handleMapMoveCircle(o){if(this.drawCoords.length!==1)return;const e=this.drawCoords[0],a=[o.lngLat.lng,o.lngLat.lat],r=T.distance(T.point(e),T.point(a),{units:"nauticalmiles"}),i=N.GeoJsonHelper.drawCircle(e[0],e[1],r),l=T.featureCollection([T.point(e),i]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderAreaLayers(),this.handleRenderRadiusLine(e,a,r)},handleRenderCircleCenterLabel(o){const e=N.LngLatHelper.lat2pretty(o[1],4).pretty,a=N.LngLatHelper.lng2pretty(o[0],4).pretty,r=document.createElement("div");r.className="idm-gl4-draw-corner-label bottom-right",r.innerHTML=`<span class="corner-text">${e} <br/> ${a}</span>`;const i=new me.Marker(r,{anchor:"bottom-right"}).setLngLat(o).addTo(this.map);this.circleMarkers.push(i)},handleRenderRadiusLine(o,e,a){const r=N.LngLatHelper.roundPrecision(a,2),i=T.featureCollection([T.lineString([o,e])]);this.map.getSource(this.drawRadiusSource)?this.map.getSource(this.drawRadiusSource).setData(i):this.map.addSource(this.drawRadiusSource,{type:"geojson",data:i}),this.map.getLayer(this.drawRadiusLayer)||this.map.addLayer({id:this.drawRadiusLayer,type:"line",source:this.drawRadiusSource,layout:{"line-cap":"round"},paint:{"line-color":this.form.color,"line-width":1.5,"line-dasharray":[4,3]}});const l=[(o[0]+e[0])/2,(o[1]+e[1])/2],n=this.map.project(o),c=this.map.project(e),s=c.x-n.x,m=c.y-n.y;let d=Math.atan2(m,s)*180/Math.PI;d>90&&(d-=180),d<-90&&(d+=180);const g=16,u=(d-90)*Math.PI/180,y=Math.round(Math.cos(u)*g),p=Math.round(Math.sin(u)*g);this.circleMarkers.length>1&&(this.circleMarkers[1].remove(),this.circleMarkers.splice(1,1));const h=document.createElement("div"),f=document.createElement("span");f.className="idm-gl4-draw-radius-label",f.style.transform=`rotate(${d}deg)`,f.style.transformOrigin="center",f.style.display="inline-block",f.textContent=`${r} nm`,h.appendChild(f);const w=new me.Marker(h,{anchor:"center",offset:[y,p]}).setLngLat(l).addTo(this.map);this.circleMarkers.push(w)},handleClearCircleLabels(){var o,e;this.circleMarkers.forEach(a=>a.remove()),this.circleMarkers=[],(o=this.map)!=null&&o.getLayer(this.drawRadiusLayer)&&this.map.removeLayer(this.drawRadiusLayer),(e=this.map)!=null&&e.getSource(this.drawRadiusSource)&&this.map.removeSource(this.drawRadiusSource)},buildRectFeatureCollection(o,e){const a=Math.min(o[0],e[0]),r=Math.max(o[0],e[0]),i=Math.min(o[1],e[1]),l=Math.max(o[1],e[1]);return[[a,l],[r,l],[r,i],[a,i]]},handleMapClickRect(o){const{lng:e,lat:a}=o.lngLat;if(this.drawCoords.length===0)this.drawCoords.push([e,a]);else{const r=this.drawCoords[0],i=[e,a],l=N.GeoJsonHelper.drawRect(r,i);delete l.bbox;const n=this.buildRectFeatureCollection(r,i),c=T.featureCollection([l,...n.map(s=>T.point(s))]);this.handleSetDrawSource(c),this.handleRenderRectLayers(),this.handleRenderRectCorners(r,i),this.drawCoords=[r,i],this.map.off("click",this.handleMapClickRect),this.map.off("mousemove",this.handleMapMoveRect)}},handleMapMoveRect(o){if(this.drawCoords.length!==1)return;const e=this.drawCoords[0],a=[o.lngLat.lng,o.lngLat.lat],r=N.GeoJsonHelper.drawRect(e,a),i=this.buildRectFeatureCollection(e,a),l=T.featureCollection([r,...i.map(n=>T.point(n))]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderRectLayers(),this.handleRenderRectCorners(e,a)},handleRenderRectLayers(){var e;const o=(e=this.editLayer)!=null&&e.id?3:2;this.map.getLayer(this.drawFillLayer)||this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.getLayer(this.drawLineLayer)?this.map.setPaintProperty(this.drawLineLayer,"line-width",o):this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":o}}),this.map.getLayer(this.drawPointLayer)||this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}})},handleRenderRectCorners(o,e){const a=Math.min(o[0],e[0]),r=Math.max(o[0],e[0]),i=Math.min(o[1],e[1]),l=Math.max(o[1],e[1]),n=[{coord:[a,l],anchor:"bottom-right"},{coord:[r,l],anchor:"bottom-left"},{coord:[r,i],anchor:"top-left"},{coord:[a,i],anchor:"top-right"}];this.handleClearRectCorners(),n.forEach(({coord:c,anchor:s})=>{const m=N.LngLatHelper.lat2pretty(c[1],4).pretty,d=N.LngLatHelper.lng2pretty(c[0],4).pretty,g=document.createElement("div");g.className="idm-gl4-draw-corner-label "+s,g.innerHTML=`<span class="corner-text">${m} <br/> ${d}</span>`;const u=new me.Marker(g,{anchor:s}).setLngLat(c).addTo(this.map);this.rectCornerMarkers.push(u)})},handleClearRectCorners(){this.rectCornerMarkers.forEach(o=>o.remove()),this.rectCornerMarkers=[]},handleRenderAreaLayers(){var e;const o=(e=this.editLayer)!=null&&e.id?3:2;this.map.getLayer(this.drawFillLayer)||this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.getLayer(this.drawLineLayer)?this.map.setPaintProperty(this.drawLineLayer,"line-width",o):this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":o}})},handleSetDrawSource(o){this.map.getSource(this.drawSource)?this.map.getSource(this.drawSource).setData(o):this.map.addSource(this.drawSource,{type:"geojson",data:o})},handleClearTmp(){var o,e,a;(o=this.map)!=null&&o.getLayer(this.drawTmpLayer)&&this.map.removeLayer(this.drawTmpLayer),(e=this.map)!=null&&e.getSource(this.drawTmpSource)&&this.map.removeSource(this.drawTmpSource),(a=this.tipMarker)==null||a.remove(),this.tipMarker=null},handleUpdateLayerColors(){if(!this.map)return;const o=this.form.color;this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",o),this.map.getLayer(this.drawLineLayer)&&this.map.setPaintProperty(this.drawLineLayer,"line-color",o),this.map.getLayer(this.drawFillLayer)&&this.map.setPaintProperty(this.drawFillLayer,"fill-color",o),this.map.getLayer(this.drawRadiusLayer)&&this.map.setPaintProperty(this.drawRadiusLayer,"line-color",o),this.map.getLayer(this.drawTmpLayer)&&this.map.setPaintProperty(this.drawTmpLayer,"line-color",o),this.editMarkers.forEach(e=>{e.getElement()&&(e.getElement().style.backgroundColor=o)})},handleClearDraw(o=!1){var a,r,i,l,n;this.handleClearTmp(),this.hideDeleteButton();const e=[this.drawPointLayer,this.drawLineLayer,this.drawFillLayer];for(const c of e)(a=this.map)!=null&&a.getLayer(c)&&((r=this.map)==null||r.removeLayer(c));(i=this.map)!=null&&i.getSource(this.drawSource)&&this.map.removeSource(this.drawSource),this.drawCoords=[],this.originalProperties={},this.handleClearRectCorners(),this.handleClearVertexLabels(),this.handleClearCircleLabels(),(l=this.pointMarker)==null||l.remove(),this.pointMarker=null,(n=this.pointHighlightMarker)==null||n.remove(),this.pointHighlightMarker=null,this.clearEditMarkers(),this.handleRebindMap()},async handleSave(){var r,i;let o=null;if(this.markerType==="Point"?await this.$refs.pointForm.validate().then(l=>{var n;if(l!=null&&l.valid){if(!this.drawCoords.length)return;const[c,s]=this.drawCoords[0];o=T.featureCollection([N.GeoJsonHelper.drawPoint(s,c,{...this.originalProperties,color:this.form.color,name:this.form.name})]),(n=o.features)==null||n.forEach(m=>{m.properties.color=this.form.color,m.properties.name=this.form.name})}}):this.markerType==="Line"?await this.$refs.lineForm.validate().then(l=>{if(l!=null&&l.valid){if(this.drawCoords.length<2)return;const n=[],c=N.LaneHelper.generateRouteAccordingToWaypoints(this.drawCoords.map(s=>({lng:s==null?void 0:s[0],lat:s==null?void 0:s[1]})));for(const s of c)s.length>1&&n.push(N.GeoJsonHelper.drawLine(s,{properties:{...this.originalProperties,color:this.form.color,name:this.form.name}}));o=T.featureCollection(n)}}):this.markerType==="Area"&&await this.$refs.areaForm.validate().then(l=>{var n,c,s;if(l!=null&&l.valid){const m=(n=this.map)==null?void 0:n.getSource(this.drawSource);if(!m)return;const d=m._data;if(!((c=d==null?void 0:d.features)!=null&&c.length))return;let g=((s=d.features)==null?void 0:s.filter(u=>u.geometry.type==="Polygon"))||[];if(g=g==null?void 0:g.map(u=>(u.properties.name=this.form.name,u.properties.color=this.form.color,u)),!g.length)return;o=T.featureCollection(g)}}),!o)return!1;const e={name:this.form.name,format:"geojson",color:this.form.color,extend:o};this.saving=!0,await((r=this.editLayer)!=null&&r.id?ce.put(`${this.gateway}/api/arc/layers/${this.editLayer.id}`,e,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}):ce.post(`${this.gateway}/api/arc/lygroups/${(i=this.group)==null?void 0:i.id}/layers`,e,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}})).then(l=>{var n,c,s,m;((n=l.data)==null?void 0:n.code)===0&&this.$emit("save",{...e,id:((c=this.editLayer)==null?void 0:c.id)||((m=(s=l.data)==null?void 0:s.data)==null?void 0:m.id)}),this.saving=!1}).catch(l=>{console.error("save marker error",l),this.saving=!1})}}},Qp={class:"text-h6 font-weight-600"},qp={class:"text-label mb-1"},$p={class:"text-label mb-1"},eg={class:"mb-1"},tg={class:"text-label mb-1"},og={class:"mb-1"},ag={class:"text-label mb-1"},ig={class:"mb-1"},rg={class:"text-label mb-1"},lg={class:"color-picker-row d-flex align-start ga-2"},ng=["value"],sg={class:"mb-n2"},cg={class:"text-label mb-1"},mg={class:"mb-1"},dg={class:"text-label mb-1"},hg={class:"color-picker-row d-flex align-start ga-2"},pg=["value"],gg={class:"mb-n2"},ug={class:"text-label mb-1"},fg={key:0,class:"mb-3"},yg={class:"text-label mb-1"},bg={class:"mb-1"},wg={class:"text-label mb-1"},xg={class:"color-picker-row d-flex align-start ga-2"},kg=["value"],Ag={class:"mb-n2"},Lg={class:"text-label mb-1"};function Cg(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VTextField"),d=t.resolveComponent("VCardText"),g=t.resolveComponent("VBtnToggle"),u=t.resolveComponent("VCol"),y=t.resolveComponent("VRow"),p=t.resolveComponent("VCardActions"),h=t.resolveComponent("VForm"),f=t.resolveComponent("VCard");return t.openBlock(),t.createBlock(f,{class:"idm-gl4-draw-dialog-card",elevation:"4"},{default:t.withCtx(()=>{var w;return[t.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>{var b;return[t.createElementVNode("span",Qp,t.toDisplayString((b=a.editLayer)!=null&&b.id?o.$t("actions.edit"):o.$t("actions.addMarker")),1),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:t.withCtx(()=>e[21]||(e[21]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[21]},8,["onClick"])]}),_:1}),t.createVNode(s),t.createVNode(d,{class:"text-body-1 px-4 pb-0"},{default:t.withCtx(()=>{var b;return[t.createElementVNode("div",qp,t.toDisplayString(o.$t("marker.group")),1),t.createVNode(m,{"model-value":(b=a.group)==null?void 0:b.name,density:"compact",variant:"outlined","hide-details":"",disabled:"",class:"input-btn-bg-1"},null,8,["model-value"])]}),_:1}),(w=a.editLayer)!=null&&w.id?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(d,{key:0,class:"text-body-1 px-4 pb-0"},{default:t.withCtx(()=>{var b;return[t.createElementVNode("div",$p,[t.createTextVNode(t.toDisplayString(o.$t("marker.markerType")),1),e[22]||(e[22]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(g,{modelValue:i.markerType,"onUpdate:modelValue":e[0]||(e[0]=A=>i.markerType=A),mandatory:"",group:"",density:"compact",variant:"flat",class:"w-100",disabled:!!((b=a.editLayer)!=null&&b.id)},{default:t.withCtx(()=>[t.createVNode(n,{value:"Point",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.markerType==="Point"?"":"btn-border-1 btn-bg-1"]),color:i.markerType==="Point"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.point")),1)]),_:1},8,["class","color"]),t.createVNode(n,{value:"Line",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.markerType==="Line"?"":"btn-border-1 btn-bg-1"]),style:{"border-left":"0 !important","border-right":"0 !important"},color:i.markerType==="Line"?"primary":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.line")),1)]),_:1},8,["class","color"]),t.createVNode(n,{value:"Area",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.markerType==="Area"?"":"btn-border-1 btn-bg-1"]),color:i.markerType==="Area"?"primary":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.area")),1)]),_:1},8,["class","color"])]),_:1},8,["modelValue","disabled"])]}),_:1})),i.markerType==="Point"?(t.openBlock(),t.createBlock(h,{key:1,ref:"pointForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.handleSave,["prevent"])},{default:t.withCtx(()=>[t.createVNode(d,{class:"px-4 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",eg,[t.createElementVNode("div",tg,[t.createTextVNode(t.toDisplayString(o.$t("marker.lat")),1),e[23]||(e[23]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(y,{class:"ma-0"},{default:t.withCtx(()=>[t.createVNode(u,{cols:"4",class:"pa-0 d-flex"},{default:t.withCtx(()=>[t.createVNode(m,{modelValue:i.form.latDegree,"onUpdate:modelValue":[e[1]||(e[1]=b=>i.form.latDegree=b),e[2]||(e[2]=b=>l.handleChangePoint())],rules:i.formRules.latDegree,label:"",autocomplete:"off",density:"compact",variant:"outlined",height:"32px","min-height":"32px",required:"",dense:"",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[24]||(e[24]=t.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[24]}),t.createVNode(u,{cols:"6",class:"pa-0 d-flex"},{default:t.withCtx(()=>[t.createVNode(m,{modelValue:i.form.latMinute,"onUpdate:modelValue":[e[3]||(e[3]=b=>i.form.latMinute=b),e[4]||(e[4]=b=>l.handleChangePoint())],rules:i.formRules.latMinute,label:"",height:"32px","min-height":"32px",autocomplete:"off",density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[25]||(e[25]=t.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[25]}),t.createVNode(u,{cols:"2",class:"pa-0"},{default:t.withCtx(()=>[t.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[5]||(e[5]=b=>{i.form.latDir=i.form.latDir==="N"?"S":"N",l.handleChangePoint()})},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.form.latDir),1)]),_:1})]),_:1})]),_:1})]),t.createElementVNode("div",og,[t.createElementVNode("div",ag,[t.createTextVNode(t.toDisplayString(o.$t("marker.lng")),1),e[26]||(e[26]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(y,{class:"ma-0"},{default:t.withCtx(()=>[t.createVNode(u,{cols:"4",class:"pa-0 d-flex"},{default:t.withCtx(()=>[t.createVNode(m,{modelValue:i.form.lngDegree,"onUpdate:modelValue":[e[6]||(e[6]=b=>i.form.lngDegree=b),e[7]||(e[7]=b=>l.handleChangePoint())],rules:i.formRules.lngDegree,density:"compact",variant:"outlined",autocomplete:"off",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[27]||(e[27]=t.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[27]}),t.createVNode(u,{cols:"6",class:"pa-0 d-flex"},{default:t.withCtx(()=>[t.createVNode(m,{modelValue:i.form.lngMinute,"onUpdate:modelValue":[e[8]||(e[8]=b=>i.form.lngMinute=b),e[9]||(e[9]=b=>l.handleChangePoint())],rules:i.formRules.lngMinute,density:"compact",variant:"outlined",autocomplete:"off",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[28]||(e[28]=t.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[28]}),t.createVNode(u,{cols:"2",class:"pa-0"},{default:t.withCtx(()=>[t.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[10]||(e[10]=b=>{i.form.lngDir=i.form.lngDir==="E"?"W":"E",l.handleChangePoint()})},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.form.lngDir),1)]),_:1})]),_:1})]),_:1})]),t.createElementVNode("div",ig,[t.createElementVNode("div",rg,[t.createTextVNode(t.toDisplayString(o.$t("marker.color")),1),e[29]||(e[29]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createElementVNode("div",lg,[t.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[11]||(e[11]=b=>i.form.color=b.target.value)},null,40,ng),t.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[12]||(e[12]=b=>i.form.color=b),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),t.createElementVNode("div",sg,[t.createElementVNode("div",cg,[t.createTextVNode(t.toDisplayString(o.$t("marker.name")),1),e[30]||(e[30]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[13]||(e[13]=b=>i.form.name=b),density:"compact",variant:"outlined",rules:i.formRules.name,autocomplete:"off",class:"input-btn-bg-1"},null,8,["modelValue","rules"])])]),_:1}),t.createVNode(s),t.createVNode(p,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.clear")),1)]),_:1},8,["onClick"]),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])):t.createCommentVNode("",!0),i.markerType==="Line"?(t.openBlock(),t.createBlock(h,{key:2,ref:"lineForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.handleSave,["prevent"])},{default:t.withCtx(()=>[t.createVNode(d,{class:"px-4 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",mg,[t.createElementVNode("div",dg,[t.createTextVNode(t.toDisplayString(o.$t("marker.color")),1),e[31]||(e[31]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createElementVNode("div",hg,[t.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[14]||(e[14]=b=>i.form.color=b.target.value)},null,40,pg),t.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[15]||(e[15]=b=>i.form.color=b),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),t.createElementVNode("div",gg,[t.createElementVNode("div",ug,[t.createTextVNode(t.toDisplayString(o.$t("marker.name")),1),e[32]||(e[32]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[16]||(e[16]=b=>i.form.name=b),density:"compact",variant:"outlined",rules:i.formRules.name,autocomplete:"off",class:"input-btn-bg-1"},null,8,["modelValue","rules"])])]),_:1}),t.createVNode(s),t.createVNode(p,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.clear")),1)]),_:1},8,["onClick"]),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])):t.createCommentVNode("",!0),i.markerType==="Area"?(t.openBlock(),t.createBlock(h,{key:3,ref:"areaForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.handleSave,["prevent"])},{default:t.withCtx(()=>[t.createVNode(d,{class:"px-4 text-body-1"},{default:t.withCtx(()=>{var b,A;return[(b=a.editLayer)!=null&&b.id?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",fg,[t.createElementVNode("div",yg,[t.createTextVNode(t.toDisplayString(o.$t("marker.areaType")),1),e[33]||(e[33]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(g,{modelValue:i.form.areaType,"onUpdate:modelValue":e[17]||(e[17]=x=>i.form.areaType=x),mandatory:"",group:"",density:"compact",variant:"flat",color:"primary",class:"w-100",disabled:!!((A=a.editLayer)!=null&&A.id)},{default:t.withCtx(()=>[t.createVNode(n,{value:"Polygon",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.form.areaType==="Polygon"?"":"btn-border-1 btn-bg-1"]),color:i.form.areaType==="Polygon"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.polygon")),1)]),_:1},8,["class","color"]),t.createVNode(n,{value:"Circle",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.form.areaType==="Circle"?"":"btn-border-1 btn-bg-1"]),style:{"border-left":"0 !important","border-right":"0 !important"},color:i.form.areaType==="Circle"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.circle")),1)]),_:1},8,["class","color"]),t.createVNode(n,{value:"Rect",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.form.areaType==="Rect"?"":"btn-border-1 btn-bg-1"]),color:i.form.areaType==="Rect"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.rect")),1)]),_:1},8,["class","color"])]),_:1},8,["modelValue","disabled"])])),t.createElementVNode("div",bg,[t.createElementVNode("div",wg,[t.createTextVNode(t.toDisplayString(o.$t("marker.color")),1),e[34]||(e[34]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createElementVNode("div",xg,[t.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[18]||(e[18]=x=>i.form.color=x.target.value)},null,40,kg),t.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[19]||(e[19]=x=>i.form.color=x),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),t.createElementVNode("div",Ag,[t.createElementVNode("div",Lg,[t.createTextVNode(t.toDisplayString(o.$t("marker.name")),1),e[35]||(e[35]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[20]||(e[20]=x=>i.form.name=x),density:"compact",variant:"outlined",rules:i.formRules.name,autocomplete:"off",class:"input-btn-bg-1"},null,8,["modelValue","rules"])])]}),_:1}),t.createVNode(s),t.createVNode(p,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>{var b;return[(b=a.editLayer)!=null&&b.id?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(n,{key:0,class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.clear")),1)]),_:1},8,["onClick"])),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.save")),1)]),_:1},8,["loading"])]}),_:1})]),_:1},8,["onSubmit"])):t.createCommentVNode("",!0)]}),_:1})}const vg=Q(Kp,[["render",Cg]]),F1="",zg={name:"IdmImportMarker",props:{map:{type:Object},gateway:{type:String},token:{type:String},defaultMeteoToken:{type:String},group:{type:Object,default:null}},emits:["close","import"],setup(){return{Theme:ye.useTheme()}},data(){var o;return{form:{groupName:"",name:"",file:null,format:"",extend:void 0,color:(o=this.Theme.current.value.colors)==null?void 0:o["map-green"]},formRules:{groupName:[e=>e!=null&&e!==""||"required"],color:[e=>e!=null&&e!==""||"required"]},isDragOver:!1,uploading:!1,fileError:"",previewSourceId:"__import_preview__",previewMarkers:[]}},watch:{"form.color":{handler(o){var e;(e=this.form.extend)!=null&&e.features&&this.form.extend.features.forEach(a=>{a.properties.color=o}),this.handleDrawLayers()},immediate:!0}},mounted(){var o;this.form.groupName=((o=this.group)==null?void 0:o.name)||"Import layer 1"},beforeUnmount(){this.handleClearPreview()},methods:{handleClose(){this.$emit("close")},handleReset(){var o;this.form={groupName:((o=this.group)==null?void 0:o.name)||"Import layer 1",file:null,format:"",extend:void 0},this.fileError=""},handleSelectFile(){this.$refs.fileInput.click()},handleFileChange(o){const e=o.target.files[0];e&&this.onUpload(e)},handleDrop(o){this.isDragOver=!1;const e=o.dataTransfer.files[0];e&&this.onUpload(e)},async onUpload(o){var r,i,l,n;if(o.size>10485760){this.fileError=this.$t("marker.fileTooLarge");return}this.form.file=o,this.fileError="",this.form.name=(r=o.name.split("."))==null?void 0:r[0];const a=(i=o.name.split(".").pop())==null?void 0:i.toLowerCase();try{let c;if(a==="json"||a==="geojson"){const s=await o.text();c=JSON.parse(s)}else if(a==="kml"){const s=await o.text();c=await N.GeoJsonHelper.convertKML2GeoJSON(s)}else if(a==="kmz"){const s=await o.arrayBuffer();c=await N.GeoJsonHelper.convertKMZ2GeoJSON(s)}else if(a==="zip"||a==="shp"){const s=await o.arrayBuffer();c=await N.GeoJsonHelper.convertZIP2GeoJSON(s)}else{this.fileError="Unsupported format: "+a;return}this.form.extend=c,this.form.format="geojson",(n=(l=this.form.extend)==null?void 0:l.features)==null||n.forEach(s=>{s.properties.color=this.form.color}),this.handleDrawLayers()}catch{this.fileError="Failed to parse file",this.form.file=null}},handleRemoveFile(){this.form.file=null,this.$refs.fileInput.value="",this.handleClearPreview()},async handleConfirm(){const{valid:o}=await this.$refs.importForm.validate();if(!o)return;if(!this.form.file){this.fileError=this.$t("marker.fileRequired");return}this.uploading=!0;let e=this.group.id;if(e||await ce.post(`${this.gateway}/api/arc/lygroups`,{name:this.form.groupName},{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(r=>{var i,l;((i=r.data)==null?void 0:i.code)===0&&(e=(l=r.data.data)==null?void 0:l.id)}),!e){this.uploading=!1;return}const a={format:this.form.format,extend:this.form.extend};ce.post(`${this.gateway}/api/arc/lygroups/${e}/layers`,a,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(r=>{var i;((i=r.data)==null?void 0:i.code)===0&&(this.$emit("import"),this.uploading=!1)}).catch(r=>{this.uploading=!1})},handleDrawLayers(){if(!this.map||!this.form.extend)return;const o=this.form.extend,e=this.previewSourceId,a=o.features||(o.type==="Feature"?[o]:[]);a.forEach(i=>{var n,c,s;const l=((n=i==null?void 0:i.properties)==null?void 0:n.color)||((c=this.Theme.current.value.colors)==null?void 0:c["map-green"]);if(((s=i.geometry)==null?void 0:s.type)==="Point"){const[m,d]=i.geometry.coordinates;this.previewMarkers.push(new me.Marker({color:l}).setLngLat([m,d]).addTo(this.map))}i.properties.color||(i.properties.color=l)}),this.map.getSource(e)?this.map.getSource(e).setData(o):this.map.addSource(e,{type:"geojson",data:o});const r=new Set(a.map(i=>{var l;return(l=i.geometry)==null?void 0:l.type}));(r.has("LineString")||r.has("MultiLineString"))&&!this.map.getLayer(`${e}-line`)&&this.map.addLayer({id:`${e}-line`,type:"line",source:e,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["get","color"],"line-width":2}}),(r.has("Polygon")||r.has("MultiPolygon"))&&(this.map.getLayer(`${e}-fill`)||this.map.addLayer({id:`${e}-fill`,type:"fill",source:e,filter:["==","$type","Polygon"],paint:{"fill-color":["get","color"],"fill-opacity":.35}}),this.map.getLayer(`${e}-outline`)||this.map.addLayer({id:`${e}-outline`,type:"line",source:e,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["get","color"],"line-width":2}}))},handleClearPreview(){if(!this.map)return;this.previewMarkers.forEach(a=>a.remove()),this.previewMarkers=[];const o=this.previewSourceId;[`${o}-vertex`,`${o}-point`,`${o}-line`,`${o}-fill`,`${o}-outline`].forEach(a=>{this.map.getLayer(a)&&this.map.removeLayer(a)}),this.map.getSource(o)&&this.map.removeSource(o)}}},_g={class:"text-h6 font-weight-600"},Sg={class:"mb-4"},Ng={class:"text-label mb-1"},Mg={class:"mb-1"},Pg={class:"text-label mb-1"},Vg={class:"color-picker-row d-flex align-start ga-2"},Tg=["value"],Eg={class:"text-body-2 text-center text-label"},Dg={class:"text-body-1 text-primary mt-2 cursor-pointer"},Rg={class:"text-body-2 text-left text-label mt-1"},Bg={key:0,class:"text-body-2 text-left text-danger mt-1"},Ig={key:1,class:"file-item d-flex align-center justify-space-between mt-2 gray-bg-1 pa-1"},Fg={class:"text-body-2 text-truncate"};function Gg(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VTextField"),d=t.resolveComponent("VIcon"),g=t.resolveComponent("VCardText"),u=t.resolveComponent("VCardActions"),y=t.resolveComponent("VForm"),p=t.resolveComponent("VCard");return t.openBlock(),t.createBlock(p,{class:"idm-gl4-import-dialog-card",elevation:"4"},{default:t.withCtx(()=>[t.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>[t.createElementVNode("span",_g,t.toDisplayString(o.$t("marker.importLayer")),1),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:t.withCtx(()=>e[9]||(e[9]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[9]},8,["onClick"])]),_:1}),t.createVNode(s),t.createVNode(y,{ref:"importForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.handleConfirm,["prevent"])},{default:t.withCtx(()=>[t.createVNode(g,{class:"px-4 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",Sg,[t.createElementVNode("div",Ng,[t.createTextVNode(t.toDisplayString(o.$t("marker.group")),1),e[10]||(e[10]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.form.groupName,"onUpdate:modelValue":e[0]||(e[0]=h=>i.form.groupName=h),density:"compact",variant:"outlined","hide-details":"",class:"input-btn-bg-1"},null,8,["modelValue"])]),t.createElementVNode("div",Mg,[t.createElementVNode("div",Pg,[t.createTextVNode(t.toDisplayString(o.$t("marker.color")),1),e[11]||(e[11]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createElementVNode("div",Vg,[t.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[1]||(e[1]=h=>i.form.color=h.target.value)},null,40,Tg),t.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[2]||(e[2]=h=>i.form.color=h),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),t.createElementVNode("div",{class:t.normalizeClass(["upload-area btn-bg-1 d-flex flex-column justify-center align-center pa-4",{"drag-over":i.isDragOver,"upload-error":i.fileError}]),onDragenter:e[4]||(e[4]=t.withModifiers(h=>i.isDragOver=!0,["prevent"])),onDragleave:e[5]||(e[5]=t.withModifiers(h=>i.isDragOver=!1,["prevent"])),onDragover:e[6]||(e[6]=t.withModifiers(()=>{},["prevent"])),onDrop:e[7]||(e[7]=t.withModifiers((...h)=>l.handleDrop&&l.handleDrop(...h),["prevent"])),onClick:e[8]||(e[8]=(...h)=>l.handleSelectFile&&l.handleSelectFile(...h))},[t.createVNode(d,{size:"36",color:"grey",class:"mb-2"},{default:t.withCtx(()=>e[12]||(e[12]=[t.createTextVNode("mdi-cloud-upload-outline",-1)])),_:1,__:[12]}),t.createElementVNode("div",Eg,t.toDisplayString(o.$t("marker.uploadHint")),1),t.createElementVNode("div",Dg,t.toDisplayString(o.$t("marker.selectFile")),1),t.createElementVNode("input",{ref:"fileInput",type:"file",style:{display:"none"},accept:".json,.geojson,.zip,.shp,.kml,.kmz",onChange:e[3]||(e[3]=(...h)=>l.handleFileChange&&l.handleFileChange(...h))},null,544)],34),t.createElementVNode("div",Rg,t.toDisplayString(o.$t("marker.uploadLimit")),1),i.fileError?(t.openBlock(),t.createElementBlock("div",Bg,t.toDisplayString(i.fileError),1)):t.createCommentVNode("",!0),i.form.file?(t.openBlock(),t.createElementBlock("div",Ig,[t.createElementVNode("span",Fg,[t.createVNode(d,{size:"16",color:"success",class:"mr-1"},{default:t.withCtx(()=>e[13]||(e[13]=[t.createTextVNode("mdi-check-circle",-1)])),_:1,__:[13]}),t.createTextVNode(" "+t.toDisplayString(i.form.file.name),1)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",size:"small",class:"file-remove-btn",onClick:l.handleRemoveFile},{default:t.withCtx(()=>[t.createVNode(d,{size:"16"},{default:t.withCtx(()=>e[14]||(e[14]=[t.createTextVNode("mdi-close",-1)])),_:1,__:[14]})]),_:1},8,["onClick"])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(s),t.createVNode(u,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleReset},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.reset")),1)]),_:1},8,["onClick"]),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.uploading},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.confirm")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])]),_:1})}const jg=Q(zg,[["render",Gg]]),G1="",Wg={name:"IdmGroupDialog",props:{modelValue:{type:Boolean,default:!1},group:{type:Object,default:null},gateway:{type:String},token:{type:String},defaultMeteoToken:{type:String}},emits:["update:modelValue","saved"],data(){return{localName:"",saving:!1}},watch:{group:{handler(o){this.localName=(o==null?void 0:o.name)||""},immediate:!0}},methods:{handleClose(){this.$emit("update:modelValue",!1)},async handleConfirm(){var o;!this.group||!((o=this.localName)!=null&&o.trim())||(this.saving=!0,await ce.put(`${this.gateway}/api/arc/lygroups/${this.group.id}`,{name:this.localName},{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(e=>{var a;((a=e.data)==null?void 0:a.code)===0&&this.$emit("saved")}).finally(()=>{this.saving=!1}))}}},Zg={class:"text-h6 font-weight-600"},Xg={class:"text-label mb-2"};function Hg(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VTextField"),d=t.resolveComponent("VCardText"),g=t.resolveComponent("VCardActions"),u=t.resolveComponent("VCard"),y=t.resolveComponent("VDialog");return t.openBlock(),t.createBlock(y,{"model-value":a.modelValue,"max-width":"320",persistent:"","onUpdate:modelValue":e[1]||(e[1]=p=>o.$emit("update:modelValue",p))},{default:t.withCtx(()=>[t.createVNode(u,{class:"",elevation:"4"},{default:t.withCtx(()=>[t.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>[t.createElementVNode("span",Zg,t.toDisplayString(o.$t("actions.editGroup")),1),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:t.withCtx(()=>e[2]||(e[2]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[2]},8,["onClick"])]),_:1}),t.createVNode(s),t.createVNode(d,{class:"px-4 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",Xg,[t.createTextVNode(t.toDisplayString(o.$t("marker.groupName")),1),e[3]||(e[3]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.localName,"onUpdate:modelValue":e[0]||(e[0]=p=>i.localName=p),density:"compact",variant:"outlined","hide-details":"",autocomplete:"off",height:"32px","min-height":"32px",class:"input-btn-bg-1"},null,8,["modelValue"])]),_:1}),t.createVNode(s),t.createVNode(g,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClose},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.cancel")),1)]),_:1},8,["onClick"]),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",loading:i.saving,onClick:l.handleConfirm},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.confirm")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["model-value"])}const Og=Q(Wg,[["render",Hg]]),Yg={name:"DeleteDialog",props:{title:{type:String},tips:{type:String},loading:{type:Boolean,default:!1}},emits:["close","delete"],data(){return{showDialog:!1}},methods:{handleClose(){this.showDialog=!1},handleDelete(){this.$emit("delete")},open(){this.showDialog=!0}}},Ug={class:"text-body-1 pb-1"},Jg={class:"text-body-1"};function Kg(o,e,a,r,i,l){const n=t.resolveComponent("VIcon"),c=t.resolveComponent("VBtn"),s=t.resolveComponent("VCardTitle"),m=t.resolveComponent("VCardText"),d=t.resolveComponent("VCardActions"),g=t.resolveComponent("VCard"),u=t.resolveComponent("VDialog");return t.openBlock(),t.createBlock(u,{modelValue:i.showDialog,"onUpdate:modelValue":e[0]||(e[0]=y=>i.showDialog=y),width:"500","min-width":"500","max-width":"500"},{default:t.withCtx(()=>[t.createVNode(g,{class:""},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6 font-weight-600 d-flex justify-center align-center py-4"},{default:t.withCtx(()=>[t.createVNode(n,{color:"warning",icon:"mdi-alert-circle",size:"small",class:"mr-2"}),t.createElementVNode("div",null,t.toDisplayString(a.title),1),t.createVNode(c,{icon:"",density:"compact",variant:"plain",class:"position-absolute top-0 right-0 mt-2 mr-2",onClick:l.handleClose},{default:t.withCtx(()=>e[1]||(e[1]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[1]},8,["onClick"])]),_:1}),t.createVNode(m,{class:"py-4 text-center"},{default:t.withCtx(()=>[t.createElementVNode("p",Ug,t.toDisplayString(a.tips),1),t.createElementVNode("p",Jg,t.toDisplayString(o.$t("tips.doYouWantToContinue")),1)]),_:1}),t.createVNode(d,{class:"w-100 d-flex justify-center align-center ga-8 py-6"},{default:t.withCtx(()=>[t.createVNode(c,{variant:"tonal",class:"text-none text-body-1",height:"32",onClick:l.handleClose},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.cancel")),1)]),_:1},8,["onClick"]),t.createVNode(c,{loading:a.loading,variant:"flat",color:"danger",class:"text-none text-body-1",height:"32",onClick:l.handleDelete},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.delete")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["modelValue"])}const Qg=Q(Yg,[["render",Kg]]),j1="",W1="",qg={name:"IdmMarker",components:{IdmDrawMarker:vg,IdmImportMarker:jg,IdmGroupDialog:Og,DeleteDialog:Qg},props:{simple:{type:Boolean,default:!1},map:{type:Object},theme:{type:String},token:{type:String},isLogin:{type:Boolean,default:!1},defaultMeteoToken:{type:String},gateway:{type:String},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}}},emits:["map","menuToggle","theme","login"],setup(){return{Theme:ye.useTheme()}},data(){return{right:10,toggle:!1,autoActive:localStorage.getItem("autoActiveMarkersGL4")==="true"||void 0,keyword:"",drawDialog:!1,importDialog:!1,loading:!1,deleteDialog:!1,deleteLoading:!1,layerGroup:[],layers:[],groupIndex:0,currentLayer:void 0,drawnLayerIds:[],layerMarkers:{},groupDialog:!1,currentGroup:null,currentGroupId:"",currentGroupName:""}},computed:{listStyle(){return this.simple?{top:this.top+"px",left:this.toggle?"0px":"-280px"}:{top:this.top+"px",right:this.toggle?"0px":"-280px"}}},watch:{"menuToggle.v":{handler(){this.toggle=this.menuToggle.markerLayers,this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},toggle:{async handler(){this.toggle&&(localStorage.getItem("autoActiveMarkersGL4")||(this.autoActive=!0))}},autoActive:{async handler(){(this.autoActive===!0||this.autoActive===!1)&&localStorage.setItem("autoActiveMarkersGL4",this.autoActive),this.layerGroup.length===0&&await this.fetchAllLayers(),this.autoActive?this.handleDrawAllLayers():this.handleClearAllLayers()},immediate:!0},map:{handler(){this.map&&(this.handleDrawAllLayers(),this.map.on("zoom",this.handleZoomChange))}}},methods:{handleMenuToggle(){this.isLogin?(this.toggle=!this.toggle,this.$emit("menuToggle","markerLayers")):this.$emit("login")},handleEditGroup(o){this.drawDialog=!1,this.importDialog=!1,this.currentGroup=o,this.groupDialog=!0},handleSaveGroup(){this.fetchAllLayers(),this.groupDialog=!1,this.currentGroup=void 0},handleOpenDelete(o,e){o==="group"?(this.currentGroup=e,this.currentLayer=void 0):o==="layer"&&(this.currentGroup=void 0,this.currentLayer=e),this.$refs.deleteDialog.open()},confirmDelete(){var o;this.currentGroup?this.handleDeleteGroup((o=this.currentGroup)==null?void 0:o.id):this.currentLayer&&this.handleDeleteLayer(this.currentLayer)},async handleDeleteGroup(o){o&&(this.deleteLoading=!0,await ce.delete(`${this.gateway}/api/arc/lygroups/${o}`,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(e=>{var a;((a=e.data)==null?void 0:a.code)===0&&(this.fetchAllLayers(),this.currentGroup=void 0,this.$refs.deleteDialog.handleClose(),this.deleteLoading=!1)}).catch(()=>{this.deleteLoading=!1}))},handleOpenDrawMarkers(o){this.handleCloseDraw(),this.currentGroup=o||this.layerGroup.find(e=>e.name==="Custom Layers"),this.importDialog=!1,this.drawDialog=!0},handleOpenImportDialog(o){this.drawDialog=!1,this.handleCloseDraw(),this.currentGroup=o||void 0,this.importDialog=!0},handleImportLayer(o){this.fetchAllLayers(),this.importDialog=!1},handleSaveMarker(o){this.fetchAllLayers(),this.drawDialog=!1,this.currentLayer=null},handleCloseDraw(){this.drawDialog=!1,this.currentLayer=null,this.autoActive&&this.handleDrawAllLayers(),this.currentGroup=void 0},handleEditLayer(o,e){var a;this.importDialog=!1,this.drawDialog&&((a=this.currentLayer)!=null&&a.id)&&this.currentLayer.id!==e.id&&this.autoActive&&this.handleDrawAllLayers(),this.currentGroup=o,this.currentLayer=e,this.drawDialog=!0},async fetchAllLayers(){this.loading=!0,this.layerGroup=[],await ce.get(`${this.gateway}/api/arc/lygroups/my`,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(o=>{var e,a,r,i,l,n;if(((e=o.data)==null?void 0:e.code)===0){this.loading=!1,this.layerGroup=((i=(r=(a=o.data)==null?void 0:a.data)==null?void 0:r.rows)==null?void 0:i.reverse())||[];const c=[];(l=this.layerGroup)==null||l.forEach(s=>{var m;s.show=!0,(m=s.layers)==null||m.forEach(d=>{var u;d.layerGroupId=s.id;const g=typeof d.extend=="string"?JSON.parse(d.extend):d.extend;(u=g==null?void 0:g.features)==null||u.forEach(y=>{y.properties.lgId=s.id,y.properties.layerId=d.id,y.properties.name||(y.properties.name=d.name)}),c.push(d)})}),this.layers=c,this.handleDrawAllLayers(),(n=this.$refs.drawDialog)==null||n.handleClearDraw()}}).catch(()=>{this.loading=!1})},async handleDeleteLayer(o){this.deleteLoading=!0,await ce.delete(`${this.gateway}/api/arc/layers/${o.id}`,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(e=>{var a;((a=e.data)==null?void 0:a.code)===0&&(this.deleteLoading=!1,this.fetchAllLayers(),this.$refs.deleteDialog.handleClose())}).catch(()=>{this.deleteLoading=!1})},handleRenderLayer(o){if(!this.map||!(o!=null&&o.extend))return;const e=typeof o.extend=="string"?JSON.parse(o.extend):o.extend;if(!e)return;const a=`marker-layer-${o.id}`;this.handleClearLayerMarkers(o.id);const r=e.features||(e.type==="Feature"?[e]:[]);if(r.some(c=>{var s,m;return(((s=c.geometry)==null?void 0:s.type)==="Point"||((m=c.geometry)==null?void 0:m.type)==="MultiPoint")&&c.properties.shape==="point"})){const c=[];r.forEach(s=>{var u,y,p,h;const m=(u=s.geometry)==null?void 0:u.type,d=((y=s.properties)==null?void 0:y.name)||"",g=((p=s.properties)==null?void 0:p.color)||o.color||((h=this.Theme.current.value.colors)==null?void 0:h["map-green"]);if(m==="Point"){const[f,w]=s.geometry.coordinates,b=`<div style="font-size:12px;line-height:1.5;">
220
220
  <div style="font-weight:600;">${d}</div>
@@ -147,7 +147,7 @@ declare namespace _sfc_main {
147
147
  function submitForm(): void;
148
148
  function cancelForm(): void;
149
149
  function handleCloseForm(): void;
150
- function fetchData(): Promise<false | undefined>;
150
+ function fetchData(): Promise<void>;
151
151
  function fetchForecastData(form: any): Promise<void>;
152
152
  function fetchHistoryData(form: any): Promise<void>;
153
153
  function initTableData(meteoData: any): void;
@@ -1,6 +1,6 @@
1
- import { d as l } from "./chunk-ANSXOGKI-b209a90c.js";
2
- import "./chunk-3VYIPD3A-169b1505.js";
3
- import "./index-072c6099.js";
1
+ import { d as l } from "./chunk-ANSXOGKI-e50e6699.js";
2
+ import "./chunk-3VYIPD3A-cf03439d.js";
3
+ import "./index-09c24825.js";
4
4
  import "axios";
5
5
  import "vuetify";
6
6
  import "vue";
@@ -1,6 +1,6 @@
1
- import { m as k } from "./chunk-T4JIPPZO-8d452d84.js";
2
- import "./chunk-3VYIPD3A-169b1505.js";
3
- import "./index-072c6099.js";
1
+ import { m as k } from "./chunk-T4JIPPZO-5a4c177d.js";
2
+ import "./chunk-3VYIPD3A-cf03439d.js";
3
+ import "./index-09c24825.js";
4
4
  import "axios";
5
5
  import "vuetify";
6
6
  import "vue";
@@ -1,5 +1,5 @@
1
- import { W as g } from "./chunk-3VYIPD3A-169b1505.js";
2
- import "./index-072c6099.js";
1
+ import { W as g } from "./chunk-3VYIPD3A-cf03439d.js";
2
+ import "./index-09c24825.js";
3
3
  import "axios";
4
4
  import "vuetify";
5
5
  import "vue";
@@ -1,6 +1,6 @@
1
- import { d as u } from "./chunk-ANSXOGKI-b209a90c.js";
2
- import { l as g } from "./index-072c6099.js";
3
- import "./chunk-3VYIPD3A-169b1505.js";
1
+ import { d as u } from "./chunk-ANSXOGKI-e50e6699.js";
2
+ import { l as g } from "./index-09c24825.js";
3
+ import "./chunk-3VYIPD3A-cf03439d.js";
4
4
  import "axios";
5
5
  import "vuetify";
6
6
  import "vue";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@idmwx/idmui-gl4",
3
3
  "private": false,
4
- "version": "3.5.5",
4
+ "version": "3.5.6",
5
5
  "description": "idm webgl4",
6
6
  "type": "module",
7
7
  "keywords": [